| 内容 | 使用phpcms v9的朋友都知道,v9内置使用ckeditor编辑器,但是默认编辑器的排版功能不是很强大,下面绿茶小编教大家修改一下编辑器,改动几个地方,让ckeditor编辑更加实用一些。
 1、批量去除超链接:
 打开 statics/js/ckeditor/ckeditor.js
 找到:
 $.execcommand('unlink',false,null);
 修改为:
 $.execcommand('unlink',false,true);
 2、上传图片自动添加alt参数
 修改 statics/js/ckeditor/plugins/image/dialogs/image.js
 找到:
 accesskey:'t','default':''
 替换成:
 accesskey:'t','default':$('#title').val()
 3、修改编辑器回车换行
 or
 打开文件 \statics\js\ckeditor\config.js 把里面的:
 config.entermode = ckeditor.enter_br;
 config.shiftentermode = ckeditor.enter_p;
 修改为:
 config.entermode = ckeditor.enter_p;
 config.shiftentermode = ckeditor.enter_br;
 4、给编辑器添加一键排版功能
 修改phpcms\libs\classes栏目下的 form.class.php 找到['maximize'],在它下面添加['autoformat'],保存即可。
 找到statics\js\ckeditor文件夹下的 config.js 文件,找到:
 config.extraplugins = 'capture';
 修改为:
 config.extraplugins = 'capture,autoformat';
 保存即可,修改后记得更新缓存,清除cookies。
 其实上面的内容主要就是给ckeditor编辑器添加一键排版功能的方法。有需要的朋友可以试下哦~非常实用的哈!
 |