How to use CKEditor 5 for OutSystems
This document will describe on how to use CKEditor 5 and how to display the HTML content you generate with CKEditor 5.
Installation
Please install CKEditor 5 from the Forge into your own environment via the for you available methods.
Contents
CKEditor 5 currently only contains the classic build of CKEditor 5. More builds like Inline, Balloon or Decoupled will arrive in the near future.
Web Blocks
CKEditor 5 for OutSystems has 2 web blocks.
CKEditor5Classic is the web block you will need to use to allow edit capabilities. Note that this web block has one event that needs to be handled since this will return the internal name of the editor that needs to be used for interaction.CKEditor5CSSStyles is the web block you will need to use on all pages that display content created with CKEditor 5
Client Actions
CKEditor 5 also has several Client Actions that are used to interact with the editor. Note that all of these Client Actions have an mandatory input parameter called EditorName. This is the name that is returned by the IsReady event of the CKEditor5Classic web block.
There are also 2 Client Actions that you, as a developer, can use to get more information about the editor.
Structures
CKEditor 5 also has 2 structures that is used by either the web block or an Client Action.
Web Block explanation
The CKEditor5Classic web block has several input parameters and one event
The input parameters are as follows;
There is also one mandatory Event is will be triggered when CKEditor 5 is fully loaded and available for use. This event has one parameter then contains the internal name for the editor. You will need to use this name for all interaction with the editor so be sure to store it in a local variable!
Usage
CKEditor 5 can be used to bind to two different widgets.
The only time you would want to use the TextArea widget is when you want Service Studio to give you a better representation of the actual page. In OutSystems the native behavior of CKEditor5 with Forms in combination with the TextArea widget doesn’t work as expected so it’s only a visual change.
The steps that you will need to follow to add CKEditor 5 to your Screen is as follows.
Now you have a working CKEditor 5 screen where you can create or edit HTML data.
When you want to save the data the end-user has created follow these steps;
View the content
To display the HTML content created with CKEditor 5 you need to create a new Screen or Web Block that contains the following.
After retrieving the HTML content load it into the container using the LoadHTMLIntoContainer Client Action.
And that’s it. You now have a working implementation of CKEditor 5. Be sure to check out the Demo for more implementation details.
Known issues
This section describes the following known issues.
Issue: The width and height is being reused for all CKEditor 5 instances throughout the application.Cause: This is because CKEditor5 uses only one CSS Class for its editor (ck-editor__editable). After this CSS class is set CKEditor5 will no longer change this class based on the configuration options provided. There is no fix is available at the current time