首页 > 代码库 > 【CKeditor】使用SpringMVC处理CKeditor上传图片

【CKeditor】使用SpringMVC处理CKeditor上传图片

0、了解CKeditor的相关文件

1、开启CKeditor上传图片功能

官方说明

简明的说,就是只需要在创建CKeditor时,添加以下两个配置:

在用CKEDITOR.replace()中配置

filebrowserBrowseUrl: ‘自定义的请求‘,
filebrowserUploadUrl: ‘自定义的请求

或,在config.js添加如下配置

config.filebrowserBrowseUrl=‘自定义的请求‘,
config.filebrowserUploadUrl=‘自定义的请求‘ 

2、编写自定义的请求



问题及解决方案:

1、解决ckeditor上传,返回时显示js代码不显示图片的问题

解决ckeditor上传,返回时显示js代码不显示图片的问题  

2、跨域问题

chrome console log:

Refused to display ‘http://localhost:8080/webcnmain/ifacompany/article/uploadArticleImageForCkeditor?CKEditor=articleContentZH&CKEditorFuncNum=1&langCode=zh-cn‘ in a frame because it set ‘X-Frame-Options‘ to ‘DENY‘.

response.setHeader("X-Frame-Options", "SAMEORIGIN");