Liferay 6.2 adding a new ckeditor

安稳与你 提交于 2019-12-12 03:45:48

问题


I want to add a new ckeditor to my liferay because we need to limit the functionality of the one available. However, I do not want to change the original one because we migth later on need it in a different form.

How can I add a new ckeditor that can be used to create a structure for webcontent articles? Do I need to create a new Theme for liferay or something like this?

Info: Our liferay runs on a Jboss server

EDIT:

I have created a hook that overrides the html\js\editor\ckeditor\ckconfig.jsp file and added

config.toolbar_Mini = [ 
    ['Bold', 'Italic', 'Underline', 'Strike'], 
    ['BulletedList'] 
]; 

Additionally, I have changed the lines in the concerning the liferay-ui:input editor in the \html\portlet\journal\article\content.jsp file.

<div class="journal-article-component-container">
    <liferay-ui:input-editor contentsLanguageId="<%= Validator.isNotNull(toLanguageId) ? toLanguageId : defaultLanguageId %>" editorImpl="<%= EDITOR_WYSIWYG_IMPL_KEY %>" name="articleContent" toolbarSet="Mini" width="100%" />
</div>

Other toolbarSet options which are already available (e.g. phoneor simple ) also have no effect. I also restarted my jboss-server several times - still no effect.

Also it seems, that changes made in the html\js\editor\ckeditor\config.js file have absolutely no effect on anything (e.g alert("foo")).


回答1:


You can make use of toolbarSet attribute of lifeary-ui:input-editor tag.

You have to override ckconfig.jsp using liferay-plugin hook to add your custom ckeditor configuration which represent your customr toolbar.

e.g. Add below code to ckconfig.jsp. config.toolbar_customToolbar=[ ['FontSize', 'TextColor', 'BGColor', '-', 'Bold', 'Italic', 'Underline', 'Strike']];

And then while using lifeary-ui:input-editor tag, provide toolbarSet attribute value as toolbarSet=custom-toolbar.

FYI: text formatter is used to map config.toolbar_XXXXX so custom-toolbar value of toolbarSet will map to customToolbar (config.toolbar_customToolbar).

Hope this helps.



来源:https://stackoverflow.com/questions/37114324/liferay-6-2-adding-a-new-ckeditor

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!