|
本帖最后由 Alexander 于 2013-9-17 10:17 编辑
CkEditor现在的最新版本是4.2,但我并不推荐使用,因为4.2不支持IE7和火狐3.6版本,所以我选择4.1.3版本.
CkFinder是CkEditor的图片上传插件,一款非常好的图片管理插件
CkFinder Java版最近已经升级到2.4,解决了之前不支持加水印的缺陷
在这里我教大家如何添加CkEditor 4.1.3 + CkFinder 2.4到自己的项目中,并破解某些功能(我最中意的word粘贴功能,格式基本不丢失,消除收费提示)
第一步:下载解压
CkEditor 4.1.3: http://download.cksource.com/CKE ... itor_4.1.3_full.zip
CkFinder 2.4 : http://download.cksource.com/CKF ... finder_java_2.4.zip
CkEditor解压到jeecg项目的plugin文件夹(jeecg原装的CKeditor如果不想要了可以删除)
CkFinder下载后先解压到其它地方然后解压CKFinderJava-2.4.war,把ckfinder复制到jeecg项目的plugin文件夹
第三步:删除一些无用的文件和文件夹
ckeditor下 删除samples文件夹(一些例子)、CHANGES.md、LICENSE.md、README.md、lang下除zh-cn.js其它都可以删(自定义保留一些,我保留了en.js/zh-cn.js/zh.js) plugins\a11yhelp\dialogs\lang 文件夹下同理
ckfinder下_samples文件夹、changelog.txt、install.txt、license.txt、translations.txt、lang文件夹同上、help文件夹除en其它全删
第四步:CKFinderJava-2.4.war解压后复制jar和config.xml
WEB-INF\lib下复制这些jar包到jeecg项目
WEB-INF\config.xml 复制到jeecg项目的WEB-INF下
第五步:配置config.xml- <?xml version="1.0" encoding="UTF-8"?>
- <config>
- <enabled>true</enabled>
- <!---注意:必须改成自己项目的,不然上传图片找不到具体的网络路径 -->
- <baseDir></baseDir>
- <!---这里我没有直接配置,而是用拦截器的形式加载,后面会说到 -->
- <baseURL></baseURL>
- <licenseKey></licenseKey>
- <licenseName></licenseName>
- <imgWidth>10000</imgWidth>
- <imgHeight>10000</imgHeight>
- <imgQuality>80</imgQuality>
- <uriEncoding>UTF-8</uriEncoding>
- <defaultResourceTypes></defaultResourceTypes>
- <types>
- <type name="Files">
- <url>%BASE_URL%files/</url>
- <directory>%BASE_DIR%files</directory>
- <maxSize>0</maxSize>
- <allowedExtensions>7z,aiff,asf,avi,bmp,csv,doc,docx,fla,flv,gif,gz,gzip,jpeg,jpg,mid,mov,mp3,mp4,mpc,mpeg,mpg,ods,odt,pdf,png,ppt,pptx,pxd,qt,ram,rar,rm,rmi,rmvb,rtf,sdc,sitd,swf,sxc,sxw,tar,tgz,tif,tiff,txt,vsd,wav,wma,wmv,xls,xlsx,zip
- </allowedExtensions>
- <deniedExtensions></deniedExtensions>
- </type>
- <type name="Images">
- <url>%BASE_URL%images/</url>
- <directory>%BASE_DIR%images</directory>
- <maxSize>0</maxSize>
- <allowedExtensions>bmp,gif,jpeg,jpg,png</allowedExtensions>
- <deniedExtensions></deniedExtensions>
- </type>
- <type name="Flash">
- <url>%BASE_URL%flash/</url>
- <directory>%BASE_DIR%flash</directory>
- <maxSize>0</maxSize>
- <allowedExtensions>swf,flv</allowedExtensions>
- <deniedExtensions></deniedExtensions>
- </type>
- </types>
- <userRoleSessionVar>CKFinder_UserRole</userRoleSessionVar>
- <accessControls>
- <accessControl>
- <role>admin</role>
- <resourceType>*</resourceType>
- <folder>/</folder>
- <folderView>true</folderView>
- <folderCreate>true</folderCreate>
- <folderRename>true</folderRename>
- <folderDelete>true</folderDelete>
- <fileView>true</fileView>
- <fileUpload>true</fileUpload>
- <fileRename>true</fileRename>
- <fileDelete>true</fileDelete>
- </accessControl>
- </accessControls>
- <thumbs>
- <enabled>true</enabled>
- <url>%BASE_URL%_thumbs/</url>
- <directory>%BASE_DIR%_thumbs</directory>
- <directAccess>false</directAccess>
- <maxHeight>100</maxHeight>
- <maxWidth>100</maxWidth>
- <quality>80</quality>
- </thumbs>
- <disallowUnsafeCharacters>false</disallowUnsafeCharacters>
- <checkDoubleExtension>true</checkDoubleExtension>
- <checkSizeAfterScaling>true</checkSizeAfterScaling>
- <secureImageUploads>true</secureImageUploads>
- <htmlExtensions>html,htm,xml,js</htmlExtensions>
- <forceASCII>false</forceASCII>
- <hideFolders>
- <folder>.*</folder>
- <folder>CVS</folder>
- </hideFolders>
- <hideFiles>
- <file>.*</file>
- </hideFiles>
- <plugins>
- <plugin>
- <name>imageresize</name>
- <class>com.ckfinder.connector.plugins.ImageResize</class>
- <params>
- <param name="smallThumb" value="90x90"></param>
- <param name="mediumThumb" value="120x120"></param>
- <param name="largeThumb" value="180x180"></param>
- </params>
- </plugin>
- <plugin>
- <name>fileeditor</name>
- <class>com.ckfinder.connector.plugins.FileEditor</class>
- <params></params>
- </plugin>
- <plugin>
- <name>watermark</name>
- <class>com.ckfinder.connector.plugins.Watermark</class>
- <params>
- <param name="source" value="/plug-in/ckfinder/logo.png"></param>
- <param name="transparency" value="0.8"></param>
- <param name="quality" value="100"></param>
- <param name="marginRight" value="5"></param>
- <param name="marginBottom" value="5"></param>
- </params>
- <internal>true</internal>
- </plugin>
- </plugins>
- <basePathBuilderImpl>com.ckfinder.connector.configuration.ConfigurationPathBuilder</basePathBuilderImpl>
- </config>
复制代码 第六步:配置ckeditor config.js(ckfinder config.js不用配置)- CKEDITOR.editorConfig = function( config ) {
- config.filebrowserBrowseUrl = 'plug-in/ckfinder/ckfinder.html';
- config.filebrowserImageBrowseUrl = 'plug-in/ckfinder/ckfinder.html?type=Images';
- config.filebrowserFlashBrowseUrl = 'plug-in/ckfinder/ckfinder.html?type=Flash';
- config.filebrowserUploadUrl = 'plug-in/ckfinder/core/connector/java/connector.java?command=QuickUpload&type=Files';
- config.filebrowserImageUploadUrl = 'plug-in/ckfinder/core/connector/java/connector.java?command=QuickUpload&type=Images';
- config.filebrowserFlashUploadUrl = 'plug-in/ckfinder/core/connector/java/connector.java?command=QuickUpload&type=Flash';
- config.enterMode = CKEDITOR.ENTER_BR;// CKEDITOR.ENTER_P;CKEDITOR.ENTER_DIV
- config.format_p = { element: 'p', attributes: { 'style': 'text-indent:24.0pt;line-height:150%' } };
- config.font_style = { element : 'span', styles : { 'font-size' : '14.0pt;', 'line-height' : '200%;', 'font-family' : '宋体;' } };
- config.font_defaultLabel = '宋体';
- config.fontSize_defaultLabel = '12px';
- config.tabSpaces = 2;
- config.language = "zh-cn";
- config.image_previewText = ' '; // 预览区域显示内容
- config.font_names = '宋体/宋体;黑体/黑体;仿宋/仿宋_GB2312;楷体/楷体_GB2312;隶书/隶书;幼圆/幼圆;微软雅黑/微软雅黑;'
- + config.font_names;
- config.skin = 'moonocolor';
- config.toolbarGroups = [
- { name: 'document', groups: [ 'mode', 'document', 'doctools' ] },
- { name: 'clipboard', groups: [ 'clipboard', 'undo' ] },
- { name: 'insert' },{name:'font'},{ name: 'tools' },
- { name: 'others' },{ name: 'editing', groups: [ 'find', 'selection' ] },
- { name: 'links' },{ name: 'basicstyles', groups: [ 'basicstyles', 'cleanup', 'font'] },
- { name: 'paragraph', groups: [ 'list', 'indent', 'blocks', 'align' ] },
- { name: 'forms' },{ name: 'styles' },{ name: 'colors' }];
- };
复制代码 |
|