Issue
In DXP 7.4, we want to change the HTML WYSIWYG editor in web content and documents and media types from CKEditor to AlloyEditor.
When we try to change it using the following portal-ext.properties property, the editor is not changed:
editor.wysiwyg.portal-impl.portlet.ddm.text_html.ftl=alloyeditor
- Is it possible to change the editor in DXP 7.4?
- If it is not possible to change it, can we modify the default editor behavior?
Environment
- Liferay DXP 7.4
Resolution
It is not possible to change the editor in DXP 7.4
In DXP 7.4 version, a reimplementation of the "web content" and documents and media "document types" has been done, in both cases aligning the editor with the structure editor used for Forms functionality.
As part of this rewrite, the new interface no longer makes use of editor.wysiwyg.portal-impl.portlet.ddm.text_html.ftl
property.
The editor is generated using the form field named "rich_text" instead. This field is implemented in the following points:
- Field type definition: com.liferay.dynamic.data.mapping.form.field.type.internal.rich.text.RichTextDDMFormFieldType
- Context contributor: com.liferay.dynamic.data.mapping.form.field.type.internal.rich.text.RichTextDDMFormFieldTemplateContextContributor
- Type settings: com.liferay.dynamic.data.mapping.form.field.type.internal.rich.text.RichTextDDMFormFieldTypeSettings
- Frontend implementation: modules/apps/dynamic-data-mapping/dynamic-data-mapping-form-field-type/src/main/resources/META-INF/resources/RichText/RichText.es.js
As you can see in these files the ckeditor_classic
is used directly and the component is not intended to be able to change the editor.
So it is not possible to change it from the configuration settings.
If it were completely necessary to change the editor, it would be necessary to create a custom form field that replaces the implementation of the "rich_text" that comes as standard.
It is possible to change the editor's behavior
It is possible to customize the ckeditor_classic that brings the form field "rich_text" by implementing an EditorConfigContributor .
This class can modify the configuration with which the CKEditor is instantiated, so it would be possible to add or remove options to it.
There is documentation about how to create such EditorConfigContributor but unfortunately, this documentation is for DXP 7.2, so it may be necessary to adapt it:
- (DXP 7.2 documentation) Modifying an Editor's Configuration
- (DXP 7.2 documentation) Creating the OSGi Module and Configuring the EditorConfigContributor Class
You can also see examples of EditorConfigContributor in the Liferay code itself, for example:
- AMJournalEditorConfigContributor
- JournalArticleDescriptionEditorConfigContributor
- JournalArticleContentEditorConfigContributor
- DocumentsAndMediaURLEditorConfigContributor
- CKEditorEmbedConfigContributor
- CKEditorConfigContributor
In any case, the implementation of an EditorConfigContributor, being customization of the product, would be out of the scope of the support service.