grails集成ckeditor

 

创建项目后, 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 )

 

也可以不处理,但是在上传的时候不能直接使用那个文件,在上传之后重新选择即可。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值