為ckeditor編輯器修改添加一鍵排版功能

字號(hào):


    使用phpcms v9的朋友都知道,v9內(nèi)置使用ckeditor編輯器,但是默認(rèn)編輯器的排版功能不是很強(qiáng)大,下面綠茶小編教大家修改一下編輯器,改動(dòng)幾個(gè)地方,讓ckeditor編輯更加實(shí)用一些。
    1、批量去除超鏈接:
    打開(kāi) statics/js/ckeditor/ckeditor.js
    找到:
    $.execcommand('unlink',false,null);
    修改為:
    $.execcommand('unlink',false,true);
    2、上傳圖片自動(dòng)添加alt參數(shù)
    修改 statics/js/ckeditor/plugins/image/dialogs/image.js
    找到:
    accesskey:'t','default':''
    替換成:
    accesskey:'t','default':$('#title').val()
    3、修改編輯器回車換行
    or
    打開(kāi)文件 \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。
    其實(shí)上面的內(nèi)容主要就是給ckeditor編輯器添加一鍵排版功能的方法。有需要的朋友可以試下哦~非常實(shí)用的哈!