Last updated by mauk81 19 hours ago
FCKeditor Plugin
This plugin can be used to integrate rich web editing functionality in Grails applications.
The plugin is written in Groovy/Grails without any dependencies on external libraries.
The FCKeditor plugin is based on the great FCKeditor
http://www.fckeditor.net Web Rich Text Editor.
Source code
The source code of the plugin is now hosted on github:
http://github.com/stefanogualdi/grails-fckeditorCurrent version
Current version is
0.9.5Based on FCKeditor (
http://www.fckeditor.net) version
2.6.6This version is developed and tested with Grails 1.2.2
Tags reference
The plugin defines the following custom tags:
| Tag | Description |
|---|
| config | Configure the editor instance |
| editor | Render the wysiwyg editor |
| fileBrowser | Create a link to open just the file browser |
all the tags belongs to the namespace
fckeditorTag config
This tag give full access to every configuration option exposed by FCKeditor.
The config tag must precede the editor tag.
<fckeditor:config OptionName="option_value"/>
Many options can be set in one time:
<fckeditor:config
OptionOne="option_one_value"
OptionTwo="option_two_value" />Option names are case sentitive and must be written as indicated in the official documentation.
For a full reference of the available options please refer to the
official documentationTag editor
This tag render the wysiwyg editor
<fckeditor:editor
name="text"
width="100%"
height="400"
toolbar="Standard"
fileBrowser="default">
Initial text
</fckeditor:editor>available attributes are:
| Attribute | Description |
|---|
| name | Field name (default: "editor") |
| width | Width of the editing space (default: "100%") |
| height | Height of the editing space (default: "200") |
| toolbar | Toolbar to use as defined in fckconfig.js (default: "Default") |
| fileBrowser | Name of the file browser to use. Possible values are default or extended. The extended file browser supports deletion and rename of files and folders (default: "default") |
| userSpace | Name of the file user space to use for file browsing and uploads (default: "") |
For security reasons the userSpace attribute cannot contain any special character.
Any invalid character will be removed.
Tag fileBrowser
Render a link to open a stand alone file browser not associated with an editor instance
<fckeditor:fileBrowser browser="default">Open file browser</fckeditor:fileBrowser>
available attributes are:
| Attribute | Description |
|---|
| type | Type of resource (default: "") |
| browser | Name of the file browser to use. Possible values are default or extended. The extended file browser supports deletion and rename of files and folders (default: "default") |
| userSpace | Name of the file user space to use for file browsing and uploads (default: "") |
| target | Target attribute for the generated <A> tag (default: "") |
if you just need the link to the file browser there is a
fileBrowserLink tag:
<a href="${fckeditor.fileBrowserLink(type:'Image', browser:'extended', userSpace:'userone')}">Open file browser</a>Configuration
The plugin can be configured with the standard Config.groovy file.
Actually are available the following options:
| Config key | Default | Description |
|---|
| fckeditor.skipBrowserCheck | false | Skip browser detection. Always render the extented editor |
| fckeditor.upload.basedir | /uploads/ | Base directory relative to webapp root if baseurl not defined, otherwise the absolute path where to store the uploaded files |
| fckeditor.upload.baseurl | none | The base URL to access the uploaded files |
| fckeditor.upload.overwrite | false | Overwite files on upload |
| fckeditor.upload.link.browser | false | Enable file browser for file objects |
| fckeditor.upload.link.upload | false | Enable upload tab for file objects |
| fckeditor.upload.link.allowed | [ ] | Extensions allowed for file objects |
| fckeditor.upload.link.denied | [ ] | Extensions denied for file objects |
| fckeditor.upload.image.browser | false | Enable file browser for image objects |
| fckeditor.upload.image.upload | false | Enable upload tab for image objects |
| fckeditor.upload.image.allowed | [ ] | Extensions allowed for image objects |
| fckeditor.upload.image.denied | [ ] | Extensions denied for image objects |
| fckeditor.upload.flash.browser | false | Enable file browser for flash objects |
| fckeditor.upload.flash.upload | false | Enable upload tab for flash objects |
| fckeditor.upload.flash.allowed | [ ] | Extensions allowed for flash objects |
| fckeditor.upload.flash.denied | [ ] | Extensions denied for flash objects |
| fckeditor.upload.media.browser | false | Enable file browser for media objects |
| fckeditor.upload.media.upload | false | Enable upload tab for media objects |
| fckeditor.upload.media.allowed | [ ] | Extensions allowed for media objects |
| fckeditor.upload.media.denied | [ ] | Extensions denied for media objects |
Sample config
fckeditor {
upload {
basedir = "/tmp/storagearea/"
baseurl = "/uploads/"
overwrite = false
link {
browser = true
upload = false
allowed = []
denied = ['html', 'htm', 'php', 'php2', 'php3', 'php4', 'php5',
'phtml', 'pwml', 'inc', 'asp', 'aspx', 'ascx', 'jsp',
'cfm', 'cfc', 'pl', 'bat', 'exe', 'com', 'dll', 'vbs', 'js', 'reg',
'cgi', 'htaccess', 'asis', 'sh', 'shtml', 'shtm', 'phtm']
}
image {
browser = true
upload = true
allowed = ['jpg', 'gif', 'jpeg', 'png']
denied = []
}
flash {
browser = false
upload = false
allowed = ['swf']
denied = []
}
media {
browser = false
upload = false
allowed = ['mpg','mpeg','avi','wmv','asf','mov']
denied = []
}
}
}
Security noteFor security reasons it is important to define allowed/denied extensions.
Version history
0.9.5 (20/04/2010)
- Upgrade to FCKeditor version 2.6.6 final
- Resolved compatibility issue with Grails 1.2.x (Thanks to Luke Daley)
0.9.4 (12/07/2009)
- Upgrade to FCKeditor version 2.6.4.1 final
- Resolved jira issue GRAILSPLUGINS-1260 (thanks to Marc Palmer)
- Optimized HTML rendering (thanks to Marc Palmer)
0.9.3 (23/06/2009)
- No changes, just re-released due to a problem in zip file under linux (thanks to Scott Burch)
0.9.2 (21/05/2009)
- Added Iceweasel to browser detection code (thanks to Sergej Dechand for notifying and testing)
- Added new configuration flag skipBrowserCheck
0.9.1 (16/05/2009)
- Corrected typo
- Upgrade to Grails 1.1.1
0.9 (15/04/2009)
- Upgrade to FCKeditor version 2.6.4 final
- Added the config tag
- Added the fileBrowser tag
- Added user space handling for file browsing and uploading
- Added configuration setting for handling uploads outside the application context
0.8 (26/08/2008)
- Upgrade to FCKeditor version 2.6.3 final
0.7
- Upgrade to FCKeditor version 2.6.0 final
0.6
- This version correct an installation problem on windows XP (and maybe on other platforms) due to a missing respect of plugins naming conventions. Many thanks to Markus Samuelsson that first pointed out the problem and to Brian Bonner who sent me a patch.
- This version include a modified file browser with the support for delete/rename files and folders. To use it simple add fileBrowser="extended" to the editor tag attributes.
- Added youtube FCKeditor plugin http://sourceforge.net/projects/youtubepluginfo/
- Added embedmovies FCKeditor plugin http://sourceforge.net/tracker/download.php?group_id=75348&atid=737639&file_id=182612&aid=1510783
- Added two toolbars ('Standard' and 'Multimedia', the last one with the above plugins included)
0.5
Development
For issues, improvements or new features go to the plugin's
JIRA page
Last updated by stefano.gualdi 2 years ago
How can I add my own configurations?
You can use the config tag to point an alternative configuration file:
<fckeditor:config CustomConfigurationsPath="${g.createLinkTo(dir:'js/fckeditor', file: 'fckcustom.js')}"/>then create a new file under web-app/js/fckeditor named fckcustom.js (or whatever you want) and include the configurations you want to change.
How can I invoke the editor tag as a method?
You can use the following example in Grails 1.1.1:
class TestTagLib { def myeditor = { attrs, body ->
out << "Before" << fckeditor.editor(attrs, body().encodeAsHTML()) << "After"
}
}Note the call to encodeAsHTML() on body. This is caused by issue
GRAILS-4713 now fixed in 1.2-M1
Since Grails 1.2-M1 you can use the following code:
class TestTagLib { def myeditor = { attrs, body ->
out << "Before" << fckeditor.editor(attrs, body()) << "After"
}
}