The Magnolia 5 series uses CKEditor for rich-text editing. This page highlights the most important milestones of the CKEditor integration since Magnolia 5.0, as well as supported configuration options in the Rich text field definition.
CKEditor integration since Magnolia 5.0
Version | Notable changes | JIRA ticket |
---|---|---|
Magnolia 5.0 | initial CKEditor integration, replaces the FCKEditor module in Magnolia 4.5 | - |
Magnolia 5.2.2 |
| - MGNLUI-2403Getting issue details... STATUS |
Magnolia 5.3.1 |
| - MGNLUI-3052Getting issue details... STATUS |
Magnolia 5.3.4 |
| - MGNLUI-3150Getting issue details... STATUS |
Config overview
For the list of supported config options, along with example values, please head to the Rich text field documentation page.
FCKEditor Magnolia 4.5 | CKEditor Magnolia 5.0 | CKEditor Magnolia 5.2.2+ | Outcome | |
Basic configuration | ||||
alignment | enables "justify" plugin | |||
images - images from dam | always both images and dam assets | enables "image" plugin | ||
enables fork of "filebrowser" plugin to invoke assets chooser | ||||
fileUpload | no more direct upload in CKEditor | |||
lists | enables "enterkey", "indent" and "list" plugins (dependency chain for list) | |||
source | enables "sourcearea" plugin | |||
spellChecker | ||||
showSpellChecker | ||||
tables | enables "table" and "tabletools" plugin | |||
width | - | - | always 100% of parent Vaadin layout | |
height | sets height of Vaadin component | |||
colors | sets "colorButton_colors" and "colorButton_enableMore" config options, enables "colorbutton" plugin, disables "colordialog" plugin | |||
fonts | enables "font" and "fontSize" plugins, sets "font_names" config option, enables "Font" button | |||
fontSizes | enables "font" and "fontSize" plugins, sets "fontSize_sizes" config option, enables "FontSize" button | |||
enterMode | - | - | ||
shiftEnterMode | - | - | ||
Advanced configuration | ||||
configJsFile | called jsConfigFile | sets "customConfig" config option | ||
jsInitFile | - | - | no longer applies to CKEditor | |
css | use custom config.js file, see "contentsCss" | |||
styles | use custom config.js file, see "stylesSet" | |||
templates | use custom config.js file |
Definition vs. JS configuration
The set of config options that are offered by the RichTextFieldDefinition is mostly intended for a quick and easy customization of the editor.
As soon as you have more advanced requirements, you may switch to a configJsFile.
When using a configJsFile, all other definition options are ignored. This is intended because otherwise, they override any configuration done in the JS files.
Alternate Java-based configuration
As of Magnolia 5.0, customizing the MagnoliaRichTextField
can also be done the Java way, with the following steps:
- Create a new fieldType
- set definitionClass, e.g.
MyRichTextFieldDefinition
- set factoryClass
MyRichTextFieldFactory
extending magnolia'sRichTextFieldFactory
- set definitionClass, e.g.
- Override
#initializeCKEditorConfig()
- Return a custom extended
MagnoliaRichTextFieldConfig
- this is our default config / impl of the Vaadin ckeditor wrapper add-on's
CKEditorConfig
- it exposes common CKEditor config / can also set options as plain Json strings
- Return a custom extended
- Set some field class to
MyRichTextFieldDefinition
in any dialog definition
Although it is technically possible, it has the following limitations:
- One has to implement a Java config class from the Vaadin wrapper + our own definition & factory classes to customize the appearance/feature set of the CKEditor.
- Thus requiring changes in your module at every config change.
- For each different configuration, one must register a new field type and create a field factory
Switching to CKEditor in Magnolia 4.5
The CKEditor Module for Magnolia 4.5 is available in the forge.
It is very similar to the legacy FCKEditor module; it simply provides the CKEditor 4.x library, and offers a set of config options.
Note that it is however totally independent from the CKEditor integration in Magnolia 5, and that we do not provide any automatic upgrade to Magnolia 5 for its usages (using only the config.js file is then your safest bet).
6 Comments
Ryaan
Any documentation around hooking up ckeditor to pull images from the DAM?
Currently have images selection enabled in my config.js - but it doesnt seem to point to the DAM... where would I define this? YAML? Or in the config.js?
Richard Gange
Hi Ryaan-
It should be as easy as adding the "images" property to your config. Set it to "true". (See https://documentation.magnolia-cms.com/display/DOCS/Rich+text+field) I tested it out on our demo site and it worked ok for me.
Ryaan
Correct - but Im using a custom configuration for my ckeditor - Ive resolved the issuse. Was missing...
removePlugins = [];
removePlugins.push("elementspath");
removePlugins.push("filebrowser");
config.removePlugins = removePlugins.join(",");
config.extraPlugins = "magnolialink,magnoliaFileBrowser";
config.baseFloatZIndex = 150;
from my custom config
Richard Gange
Oh right! If you use a custom js then everything must be configured through the file. Forgot that, sorry. Anyway thanks for your feedback.
Peter Varga
Hello Richard,
We've found an issue with CKEditor integration. When inserting an image with default CKEditor command, on the second (Link) tab of the Image Properties dialog the Browse Server button links to the Assets chooser instead of the Pages chooser. Is there a way in the config to change this behaviour?
Varshali
Hi,
I am using custom-config.js for hooking up ckeditor. In CKEditor I want my custom styles to be added. But it is showing all the plugins, styles which are in Magnolias config-magnolia.js.
I am trying this in Blossom project with magnolia version 5.5.
In MyownComponent.java I am writing :
String configJsFile="webresources/ckeditor/custom-config.js";
richText.definition().setConfigJsFile(configJsFile);
I want simple CKeditor just like we are using for writing comments on this page with styles of my choice.
What could be the issue?