为ckeditor添加行距的功能(转载)

为ckeditor添加行距的功能

发现CKeditor木有设置行距的功能,想想这么重要的功能肯定有相应的插件,于是百度google一下,倒是有不少的教程,不过都不全,所以记录一下,以备后用,嘿。

1.下载ckeditor的行距插件包 lineheight

2.解压到ckeditor/plugins目录下

3.修改ckeditor目录下的 config.js文件,在其中添加以下的代码

复制代码
config.extraPlugins += (config.extraPlugins ? ',lineheight' : 'lineheight');
    CKEDITOR.config.toolbar_Full =
    [
        { name: 'document',        items : [ 'Source','-','Save','NewPage','DocProps','Preview','Print','-','Templates' ] },
        { name: 'clipboard',    items : [ 'Cut','Copy','Paste','PasteText','PasteFromWord','-','Undo','Redo' ] },
        { name: 'editing',        items : [ 'Find','Replace','-','SelectAll','-','SpellChecker', 'Scayt' ] },
        { name: 'forms',        items : [ 'Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField' ] },
        '/',
        { name: 'basicstyles',    items : [ 'Bold','Italic','Underline','Strike','Subscript','Superscript','-','RemoveFormat' ] },
        { name: 'paragraph',    items : [ 'NumberedList','BulletedList','-','Outdent','Indent','-','Blockquote','CreateDiv','-','JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock','-','BidiLtr','BidiRtl' ] },
        { name: 'links',        items : [ 'Link','Unlink','Anchor' ] },
        { name: 'insert',        items : [ 'Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak','Iframe' ] },
        '/',
        { name: 'styles',        items : [ 'Styles','Format','Font','FontSize','lineheight' ] },
        { name: 'colors',        items : [ 'TextColor','BGColor' ] },
        { name: 'tools',        items : [ 'Maximize', 'ShowBlocks','-','About' ] }
    ];
复制代码

4.现在就ok了,行距功能就有了。

ps,简单的自定义行距功能

1.修改该功能的语言,在lineheight(就是行距插件的目录)/lang目录下添加相应的语言包,修改plugin.js文件115行为相应的语言。

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


亲自实践过了,确实能实现,在这里记录下来,分享给大家。。。。

原文地址:https://www.cnblogs.com/xcp19870712/p/2719760.html