dedecms自帶CKEditor編輯添加行間距按鈕

由於dedecms將ckeditor做了集成,和一般的只針對於ckeditor對config.js修改不同,以後是我在dedecms 5.7版本上添加行間距按鈕的方法:

1、下載ckeditor的行距插件包(見附件) ;

2.解壓到ckeditor/plugins目錄下;

3、由於dedecms 5.7自己集成了一個dedepage插件,用來添加ckeditor自定義插件,在/include/ckeditor/plugins/dedepage文件夾下,打開plugin.js文件在最後面添加:      requires : [ 'lineheight' ],添加完之後的代碼如下:

// Register a plugin named "dedepage".
(function()
{
    CKEDITOR.plugins.add( 'dedepage',
    {
        init : function( editor )
        {
            // Register the command.
            editor.addCommand( 'dedepage',{
                exec : function( editor )
                {
                    // Create the element that represents a print break.
                    // alert('dedepageCmd!');
                    editor.insertHtml("#p#副標題#e#");
                }
            });
            // alert('dedepage!');
            // Register the toolbar button.
            editor.ui.addButton( 'MyPage',
            {
                label : '插入分頁符',
                command : 'dedepage',
                icon: 'p_w_picpaths/dedepage.gif'
            });
            // alert(editor.name);
        },
        requires : [ 'fakeobjects' ],
   requires : [ 'lineheight' ]
    });
})();


4、修改/include/ckeditor/ckeditor.inc.php文件,在$toolbar['Basic'] 的最後一行添加元素Code,修改後代碼如下:

$toolbar['Basic'] = array(
            array( 'Source','-','Templates'),
            array( 'Cut','Copy','Paste','PasteText','PasteFromWord','-','Print'),
            array( 'Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'),
            array( 'ShowBlocks'),array('Image','Flash','Addon'),array('Maximize'),'/',
            array( 'Bold','Italic','Underline','Strike','-'),
            array( 'NumberedList','BulletedList','-','Outdent','Indent','Blockquote'),
            array( 'JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'),
            array( 'Table','HorizontalRule','Smiley','SpecialChar'),
            array( 'Link','Unlink','Anchor'),'/',
            array( 'Styles','Format','Font','FontSize'),
            array( 'TextColor', 'BGColor', 'MyPage','MultiPic'),
    array( 'lineheight')
        );


至此OK!

ps,簡單的自定義行距功能

1.修改該功能的語言,在lineheight(就是行距插件的目錄)/lang目錄下添加相應的語言包,修改plugin.js文件115行爲相應的語言。

2.更改行距的功能按鈕,修改plugin.js文件139行。


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章