Skip to main content

Command Palette

Search for a command to run...

Oracle APEX 23.1 - TinyMCE

Published
3 min read
Oracle APEX 23.1 - TinyMCE
L

Oracle APEX Developer (Insum) from Paris Contributor of Flows for APEX Passionate about APEX and web development.

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 😍

Screenshot of the what's new page showing the integration of TinyMCE in Oracle APEX 23.1

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:

Screenshot showing how to choose TInyMCE as a rich text editor in Oracle APEX 23.1

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

Screenshot showing a TinyMCE rich text editor in a run time page using Oracle APEX 23.1

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:

Screenshot of the Initialization JavaScript Function code in the Oracle 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:

Animated Screenshot showing the emoticons plug-in

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.

D
D Edwards1y ago

Is this transferrable to ORTL as TinyMCE is being deprecated in 24.1 patch version 5 (36926831)

L

ORTL seems to be a fork of CKEditor so anything that works for that library should work for ORTL

V

And I found it's able to paste image in clipboard! what an awesome feature!

image.png

1
L

Aw yes, I love this feature too 😍

A

Hi, Louis. How can i configure custom bottons?

Thanks

L

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

A

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.

1
L

Yes Antonio Luis Gallardo Fernandez, that's why I mentioned it 😉. I'm happy that it works for you

C

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.

2
L

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

D

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.

L

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

M

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

1
L

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

M

Louis Moreaux

if (Array.isArray(options.editorOptions.toolbar)) {
  options.editorOptions.toolbar[4].items.push("emoticons");
}
else {
  options.editorOptions.toolbar +=" emoticons";
}

:-)

More from this blog

Oracle APEX tips and tricks - Louis Moreaux

32 posts