`
paper
  • 浏览: 74334 次
  • 性别: Icon_minigender_1
  • 来自: 郴州
社区版块
存档分类
最新评论

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 )

 

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

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics