创建项目后,
install-plugin
ckeditor
集成
ckeditor
配置:
Config.groovy
加上以下配置:
ckeditor {
//
config = "/js/ckconfig.js"
upload {
//basedir = "/tmp/storagearea/"
// baseurl = "/uploads/"
overwrite = false
link {
browser = true
upload = true
allowed = ['doc', 'docx', 'flv', 'xls']
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 = true
upload = true
allowed = ['swf']
denied = []
}
flv {
browser = true
upload = true
allowed = ['flv']
denied = []
}
}
}
使用案例:
<html>
<head>
<title>Welcome to Grails</title>
<ckeditor:resources />
</head>
<body>
<div>
${params.editContent}
<g:form >
<ckeditor:config
height="300px"
width="50%" />
<ckeditor:editor
name="editContent"></ckeditor:editor>
<g:actionSubmit value="
提
交
"></g:actionSubmit>
</g:form>
</div>
</body>
</html>
会有的问题:
上传的中文文件
(
图片和
flash
如果是中文的话都会出现乱码问题,具体解决可以参考
http://hi.baidu.com/vottot/blog/item/fd6465069b99e277020881e2.html
)
也可以不处理,但是在上传的时候不能直接使用那个文件,在上传之后重新选择即可。
分享到:
相关推荐
- `CkeditorGrailsPlugin.groovy` - 这是Grails插件的核心文件,很可能包含了CKEditor与Grails集成的逻辑,包括初始化、配置以及扩展功能的定义。 - `application.properties` - 应用的配置文件,可能包含有关...
特征CKEditor版本4.x( ) Rails 5.x,4.2.x集成文件浏览器HTML5文件上传器用于formtastic和simple_form表单生成器的钩子与授权框架和集成安装对于基本用法,只需包含ckeditor gem: gem 'ckeditor'或者,如果您想...
Grails 是一个基于Groovy语言的开源Web应用框架,它构建在Spring Boot之上,提供了快速开发、简洁语法和强大的工具支持。...通过熟练掌握这两个工具的集成使用,你可以更有效地构建和管理复杂的Grails项目。
在Grails框架中,我们可以集成FCK Editor来提供这样的功能。FCK Editor是一款开源的、免费的JavaScript富文本编辑器,支持多种浏览器环境,提供了丰富的编辑功能。 本文将详细介绍如何在Grails应用中使用FCK Editor...
这些功能通常依赖于前端库,如 TinyMCE 或 CKEditor,以及后端的文件存储服务,如 Amazon S3 或者本地服务器存储。 通过 "gr8crm-web-master" 压缩包,我们可以预期找到项目的源代码,包括控制器(Controllers)、...