安装插件:
compile ":ckeditor:4.5.4.0"
在config.groovy中增加如下内容:
ckeditor {
config = "/js/myckconfig.js"
skipAllowedItemsCheck = false
defaultFileBrowser = "ofm"
upload {
basedir = "/uploads/"
overwrite = false
link {
browser = false
upload = true
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 = true
allowed = [‘swf‘]
denied = []
}
}
}复制下面的内容,保存到/web-app/js,命名为:myckconfig.js
/**
* @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
* For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.editorConfig = function( config ) {
// Define changes to default configuration here.
// For complete reference see:
// http://docs.ckeditor.com/#!/api/CKEDITOR.config
// The toolbar groups arrangement, optimized for two toolbar rows.
config.toolbarGroups = [
{ name: ‘basicstyles‘, groups: [ ‘basicstyles‘, ‘cleanup‘ ] },
{ name: ‘paragraph‘, groups: [ ‘list‘, ‘indent‘, ‘blocks‘, ‘align‘, ‘bidi‘ ] },
{ name: ‘insert‘ },
{ name: ‘links‘ },
{ name: ‘styles‘ },
{ name: ‘colors‘ },
{ name: ‘about‘ }
];
// Remove some buttons provided by the standard plugins, which are
// not needed in the Standard(s) toolbar.
config.removeButtons = ‘Underline,Subscript,Superscript‘;
// Set the most common block elements.
config.format_tags = ‘p;h1;h2;h3;pre‘;
// Simplify the dialog windows.
config.removeDialogTabs = ‘image:advanced;link:advanced‘;
};在_form.gsp中,需要用的地方,改成这样
<ckeditor:resources/>
<div class="fieldcontain ${hasErrors(bean: news, field: ‘content‘, ‘error‘)} ">
<span class="property-label">
<g:message code="news.content.label" default="Content"/>
</span>
<span class="property-value">
<ckeditor:editor name="content" width="95%">${news?.content}</ckeditor:editor>
</span>
</div>附件是改好的main.css,下载后将后缀.zip去掉即可
原文:http://xiaosa.blog.51cto.com/665033/1719744