在Liferay中安装CKEditor插件

时间:2015-10-15 10:36:37

标签: liferay

我已按照以下步骤在Liferay 6.2 GA4中添加CKEditor YouTube插件,我可以在内容部分编辑器中添加插件。

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 \的ckconfig.jsp文件中添加以下' youtube' 条目编辑器\ ckeditor文件夹

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 Structures和模板时,此插件未出现在CKEditor中。 Liferay服务器需要做哪些其他更改?

1 个答案:

答案 0 :(得分:0)

在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']
];