感谢SWORD721,转贴自:http://sword721.javaeye.com/blog/211432
下载下面提供的压缩包,grails-fckeditor-0.6.zip.直接在命令行下输入:grails install-plugin "插件所在的路径"/grails-fckeditor-0.6.zip.安装成功之后我们就可以直接使用了.
- <fckeditor:editor id="content" name="content" width="600" height="400">
- ${article?.content?.encodeAsHTML()}
- </fckeditor:editor>
<fckeditor:editor id="content" name="content" width="600" height="400">
${article?.content?.encodeAsHTML()}
</fckeditor:editor>
还可以为fckeditor加入代码高亮显示,我用的是SyntaxHighlighter.
使用方法:
1、在您的FCKeditor的配置文件中(一般为fckconfig.js或custom.config.js)
配置其中的FCKConfig.ToolbarSets,添加HighLighter。
如:
FCKConfig.ToolbarSets["review"] = [
['HighLighter','Bold','Italic','Underline','StrikeThrough','Link','Unlink','Image','Rule','Smiley','TextColor','BGColor']
];
当然,你可以放到别的工具栏,不过记得注意大小写。
2、根据你指定的plugin目录,注册plugin
如:
// 代码语法高亮插件
FCKConfig.Plugins.Add( 'highlighter', 'zh-cn,en' ) ;
3、OK,你会发现你的FCK工具栏的图片多了一个带有"ab"字母,黄底的图标。你就可以使用语法高亮显示功能了。