Oracle APEX 23.1 - TinyMCE

Explore the new Rich Text Editor capabilities
Introduction
With every APEX release, there are a lot of new improvements and I like reading the What's New page because you sometimes find beautiful gems. And this time, I saw at the very end that TinyMCE has been integrated 😍

You know my passion for the Rich Text Editor, I already published several articles about CKEditor5 which is deprecated in started from 23.1. Not that the library has been upgraded from CKEditor5 35.0.1 to CKEditor5 36.0.0.
So let's see what can be done with this guy
How to use it?
Pretty simple, edit your page, add an item and choose the type "Rich Text Editor". Under Settings, you can decide if you want to use TinyMCE (default) or CKEditor as shown in the screenshot below:

Run your page and voila, you get a fresh new editor to play with:

As with the CKEditor, you can choose between Markdown and HTML syntax and the real strength of these libraries is the extensibility by adding plug-ins.
How to enable a plug-in?
You can find the list of available plug-ins here, some are open source and some are premium meaning you have to pay to use it. It seems that most of the open-source ones have been included in APEX 23.1 (I am still testing).
Some are enabled by default like list or table (depending on the toolbar attributes you selected) but for example, to enable the emoticons one, you need to add this code to the Initialization JavaScript Function of the RTE
function(options){
//Enable Emoticons plugin
options.editorOptions.plugins += " emoticons";
//Adding Emoticons button to the toolbar
options.editorOptions.toolbar += " emoticons";
return options;
}
Here is where you have to define it in the APEX Builder:

Now if you run your page, you will see the emoticon button on the toolbar and by clicking on it, you can choose an emoticon or you can simply type ":" followed by the emoticon's name, and a list will be displayed based on what you are typing:

Conclusion
This is cool to play with this new library because the API is way easier to use than the CKEditor one in my opinion. The syntax to enable plug-ins, modify the toolbar and add a menu is clear and easy to understand.
I will dig further to implement the file and image upload soon but sadly one of the features I like is part of the premium plug-ins: mentions. Maybe it will be implemented in a future release.
About the author
Oracle APEX Developer (Insum) from Paris Contributor of Flows for APEX Passionate about APEX and web development.
Comments
Join the discussionIs this transferrable to ORTL as TinyMCE is being deprecated in 24.1 patch version 5 (36926831)
ORTL seems to be a fork of CKEditor so anything that works for that library should work for ORTL
And I found it's able to paste image in clipboard! what an awesome feature!

Aw yes, I love this feature too 😍
Hi, Louis. How can i configure custom bottons?
Thanks
Hi Antonio Luis Gallardo Fernandez, Look at this thread on the Oracle APEX forum you could find useful things https://forums.oracle.com/ords/apexds/post/tinymce-custom-buttons-1319
Louis Moreaux Hi Louis.
I had already read that article, but it didn't work. However, there was an entry 2 days ago that solves it
Thanks for all.
Yes Antonio Luis Gallardo Fernandez, that's why I mentioned it 😉. I'm happy that it works for you
Hi Louis, How can I configure the editor to get a sticky toolbar? The docs say I should configure toolbar_sticky: true but i cannot figure out how to put it on the Apex initialization javascript. Tks for your help.
Hi Cezar Rosaneli, you can use this to enable the sticky toolbar:
function(options){
options.editorOptions.toolbar_sticky = true;
options.editorOptions.toolbar_sticky_offset = 100;
return options;
};
You will have to find the correct offset for your page
Hi. How can I put the contains readonly and How Can I print the contains? Cause CKEDITOR it's not working anymore, for example CKeditor.contains. Thanks in advance.
Hi Dennys Montero, I am not sure to understand what you are trying to achieve. Maybe you could give me a little more details about your problem. Regards, Louis
Just a tiny observation / question. plugins+= bit is fine but I could only get the toolbar to work when I referenced the toolbar array by index and append my plugin ... e.g. options.editorOptions.toolbar[4].items.push("image"); += syntax replaced the contents of the toolbar with just the new button
Hi Mohamed A.Helal, I double checked the code and the documentation and you are right, depending on the type of toolbar it could be an array or a string. I will update the blog post to handle it. Thanks
if (Array.isArray(options.editorOptions.toolbar)) {
options.editorOptions.toolbar[4].items.push("emoticons");
}
else {
options.editorOptions.toolbar +=" emoticons";
}
:-)




