For integrating CKEditor with Grails you have to do following :
1. Installation:
grails install-plugin ckeditor
2. Usage in GSP:
add following in head section of your GSP,
<head>
…
<ckeditor:resources/>
…
</head>
and in your page add following,
<ckeditor:editor name=”myeditor” height=”400px” width=”80%”>
${initialValue}
</ckeditor:editor>
3. Configurations:
You have to do some configuration for file manager in config.groovy file as shown below:
ckeditor {
config = “/js/myckconfig.js”
skipAllowedItemsCheck = false
defaultFileBrowser = “ofm”
upload {
basedir = “/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 = []
}
}
}
4. Advanced topics:
- Internal URI’s customization:
It is possible to customize the URI’s used to invoke the plugin’s connectors,
ckeditor.connectors.prefix = “/my/app/ck/”
- Custom upload types:
You can customize upload types add following in above code snippet,
…
upload {
…
avatar {
browser = true
upload = true
allowed = ['gif', 'jpg']
denied = ['exe', 'sh', 'cgi']
}
…
}
…
ProsperaSoft offers Grails development solutions. You can email at info@prosperasoft.com to get in touch with ProsperaSoft Grails experts and consultants.