溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

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

發(fā)布時間:2020-03-24 13:14:04 來源:網(wǎng)絡(luò) 閱讀:1117 作者:愛神ONE 欄目:開發(fā)技術(shù)

由于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#副標(biāo)題#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目錄下添加相應(yīng)的語言包,修改plugin.js文件115行為相應(yīng)的語言。

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


附件:http://down.51cto.com/data/2367610
向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI