【问题标题】:Installing a CKEditor plugin in Liferay在 Liferay 中安装 CKEditor 插件
【发布时间】:2015-10-15 10:36:36
【问题描述】:

我已经按照这些步骤在 Liferay 6.2 GA4 中添加了 CKEditor YouTube 插件,并且我可以在 Content 部分编辑器中添加插件。

CKEditor YouTube 插件:http://ckeditor.com/addon/youtube

所有插件都位于 ${LIFERAY_HOME}\tomcat-7.0.42\webapps\ROOT\html\js\editor\ckeditor\plugins 文件夹中。

1) 将 youtube 插件文件夹放在 plugins 文件夹中。

2) 在 ${LIFERAY_HOME}\tomcat-7.0.42\webapps\ROOT\html\js\editor\ckeditor 文件夹中的 config.js 文件中添加以下更改

CKEDITOR.editorConfig = function( config ) {
            // Define changes to default configuration here. For example:
            // config.language = 'fr';
            // config.uiColor = '#AADC6E';
            config.extraPlugins = 'youtube';
};

3) 在 ${LIFERAY_HOME}\tomcat-7.0.42\webapps\ROOT\html\js\editor\ckeditor 文件夹中的 ckconfig.jsp 文件中添加以下 'youtube' 条目

config.extraPlugins = 'ajaxsave,media,restore,scayt,wsc,youtube';

config.toolbar_liferayArticle = [
['Styles', 'FontSize', '-', 'TextColor','BGColor'],
['Bold', 'Italic', 'Underline', 'Strike'],
['Subscript', 'Superscript'],['Youtube'],
'/',['Undo', 'Redo', '-', 'Cut', 'Copy', 'Paste',
'PasteText',  'PasteFromWord', '-', 'SelectAll','RemoveFormat'],

4) 重启 Liferay。

我知道这可以通过使用 Liferay Hook 项目来实现。

但是,当我使用 Liferay 结构和模板时,CKEditor 中不会出现此插件。 Liferay 服务器还需要做哪些其他更改?

【问题讨论】:

    标签: liferay


    【解决方案1】:

    在 Liferay 中使用结构和模板时,它由不同类型的 CKEditor 工具栏组成。这些不同的工具栏在 ckconfig.jsp 中定义,您需要更改所有工具栏部分。

    config.toolbar_email = [
        ['FontSize', 'TextColor', 'BGColor', '-', 'Bold', 'Italic', 'Underline', 'Strike'],
        ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
        ['SpellChecker', 'Scayt'],
        ['Youtube'],
        '/',
        ['Undo', 'Redo', '-', 'Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'SelectAll', 'RemoveFormat'],
        ['Source'],
        ['Link', 'Unlink'],
        ['Image']
    ];
    
    config.toolbar_liferay = [
        ['Bold', 'Italic', 'Underline', 'Strike'],
    
        <c:if test="<%= inlineEdit %>">
            ['AjaxSave', '-', 'Restore'],
        </c:if>
    
        ['Undo', 'Redo', '-', 'Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', ],
        ['Styles', 'FontSize', '-', 'TextColor', 'BGColor'],
        ['Youtube'],
        '/',
        ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent'],
        ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
        ['Image', 'Link', 'Unlink', 'Anchor'],
        ['Flash', <c:if test="<%= XugglerUtil.isEnabled() %>"> 'Audio', 'Video',</c:if> 'Table', '-', 'Smiley', 'SpecialChar'],
        ['Find', 'Replace', 'SpellChecker', 'Scayt'],
        ['SelectAll', 'RemoveFormat'],
        ['Subscript', 'Superscript']
    
        <c:if test="<%= !inlineEdit %>">
            ,['Source']
        </c:if>
    ];
    
    config.toolbar_liferayArticle = [
        ['Styles', 'FontSize', '-', 'TextColor', 'BGColor'],
        ['Bold', 'Italic', 'Underline', 'Strike'],
        ['Subscript', 'Superscript'],
        ['Youtube'],
        '/',
        ['Undo', 'Redo', '-', 'Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'SelectAll', 'RemoveFormat'],
        ['Find', 'Replace', 'SpellChecker', 'Scayt'],
        ['NumberedList','BulletedList','-','Outdent','Indent','Blockquote'],
        ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
        '/',
        ['Source'],
        ['Link', 'Unlink', 'Anchor'],
        ['Image', 'Flash', <c:if test="<%= XugglerUtil.isEnabled() %>">'Audio', 'Video',</c:if> 'Table', '-', 'Smiley', 'SpecialChar', 'LiferayPageBreak']
    ];
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-01-19
      • 2018-08-03
      • 2016-07-27
      • 2020-02-17
      • 2016-04-05
      • 2020-04-30
      • 2021-05-27
      • 2019-04-18
      相关资源
      最近更新 更多