Forum OpenACS Development: CKEditor 5

Collapse
Posted by Josue Cardona on
Is CKEditor 5 stil an option for upgrade or are we going to move to a different WYSIWYG plugin, if so can you recommend something else to use?

Thanks

Josue C.

Collapse
2: Re: CKEditor 5 (response to 1)
Posted by Antonio Pisano on

Dear Josue,

We did some work that is already available upstream to integrate TinyMCE 7.

ad_form richtext fields and xowiki formfields work. For xowiki formfields, this includes repeated fields, compound fields and repeated-compound fields.

What is missing compared to the CKEditor 4 integration is custom OpenACS plugins. Some we have implemented downstream in a way that may be suitable for contribution at some point, for instance: * xowiki includelet * xowiki links * mathjax formulas * multimedia (with xowiki or file-storage backend)

However, as we are about to release we were not sure there was enough time to bring them up to the right quality.

Ideally, this should be the chance to rework the existing OpenACS plugins so that they could work with different editors regardless of their specific api. Our downstream implementations try to do this, but we still need to battle test them to see if we found a good solution.

During the implementation we have introduced for richtext editors the concept of "preset". A preset is basically a proc returning a configuration for the editor that we want to label according to a use case. An example of preset is "standard", "minimal", or "forum".

The reason we have introduced this concept is, that on LEARN we have coalesced on 5 or 6 configurations for our editor, that we use here and there on the system. So far, these configurations were dependent on the ckeditor4 syntax, but if we are to move, we wanted to provide a way to separate the logical aspect, e.g. "we want here a richtext editor with the minimal set of tools" from the editor-specifics. If we implement a ::richtext::ckeditor4::preset::minimal and a ::richtext::tinymce::preset::minimal, both returning an editor-specific configuration for the "minimal" use case, as soon as we change the preferred richtext editor in the parameter, the forms will keep behaving according to their preset, but using the new editor.

So far, we do not provide any out-of-the box preset in the usptream repo, because the idea is that presets are the places where we can put the nitty-gritty of our downstream richtext behavior. We may provide some upstream namespaced presets like "oacs_standard" at some point.

Feel free to try the richtext-tinymce package from the oacs-5-10 branch, feedback is welcome!

Concerning CKEditor 5, the current usptream code was based on a very early version of the editor and is probably not what you want. We are also working on an integration with the latest version, downstream-only for now. Upstreaming seems to be more complicated because of the way the editor has to be "built" for deployment, but I am not the person working on it. I will point my colleague to this post.

Collapse
3: Re: CKEditor 5 (response to 1)
Posted by Gustaf Neumann on
Well, it depends.

The oacs-5-10 branch has 3 supported editors

* CKeditor 4
* xinha
* Tinymce

In the head branch, there is basic support for CKeditor 5, which i did a few years ago in a weekend project.

CKeditor 4 has its problems, since versions after 4.22.1 require a license, and 4.22.1 has vulnerabilities (for most applications, these are not an issue, check yourself on Snyk).

CKeditor 5 is currently free of issues, but they have now a very "modular" design, where some of the modules (which were free with version 4) require a license as well. Furthermore, they advocate a composition with npm, which makes packaging for OpenACS more of an issue. I have heard, that Markus Moser picked up the version and added some more support, but I do not know the details.

xinha is still working, the project got some newer updates after years of a standstill, but still, maintenance is not great.

TinyMCE is regularly updated, and looks like a pretty solid option.

However, it is not so easy to give a general recommendation. If one needs just a basic rich-text widget, all of these might be useful. If one has very detailed requirements, custom plugins, support for mobile devices, etc. things might look different. ckeditor4 offers a version detailed configuration interface from the xowiki form fields (choose between standard, inplace, inline, templates, image selectors, allowedContent, various callbacks and skins), which are not available (to this extent and/or in a fully compatible way) for the other editors. If it comes to user-experience, end-users are sometimes very passionate about certain features. Moreover, on-site documentation with screenshots has to be adjusted, when the editor is switched, etc.

We still keep for OpenACS 5.10.1 CKEditor 4 the default choice for xowiki, but that might change in the future.

Collapse
4: Re: CKEditor 5 (response to 1)
Posted by Josue Cardona on
thank you for your answers, we will be looking at this internally, but one of the main plugins we use and need is multimedia. If you have an example with tinyMCE that would be great.
Collapse
5: Re: CKEditor 5 (response to 4)
Posted by Antonio Pisano on
We will see what we can do, maybe we can try to wrap up what we do on LEARN.

In the meantime, TinyMCE own plugins for multimedia do work, but without a backend they will store files as base64 into the document.

A cheap approach, that we also applied to some use case, is to extract this base64 content on the server side and create a file on the fly, e.g. in the file-storage.

Just ideas for the impatients for now 😊

Collapse
6: Re: CKEditor 5 (response to 5)
Posted by Gustaf Neumann on
One should not use the file-storage (unless fiddling with stale images), but rather use the approach based on attachments and child-resources, as used with ckeditor4. (see ckfinder-procs)
Collapse
7: Re: CKEditor 5 (response to 6)
Posted by Antonio Pisano on
Chances are we can use the same ckfinder backend also for other editors. I will fiddle a bit.
Collapse
8: Re: CKEditor 5 (response to 7)
Posted by Gustaf Neumann on
would be cool. ... it might be moved to some core package (acs-templating or attachments).
Collapse
9: Re: CKEditor 5 (response to 8)
Posted by Antonio Pisano on

In attachments and richtext-tinymce I have implemented something similar to what we have done on LEARN: a generic UI that does not rely on the specific editor API, integrated via a trivial plugin in the editor package.

I have used some of the api from the previous implementation, but to keep the interface "editor agnostic", I could not use any of the "CKEditor tech".

If you have a look at the plugin code for tinymce, there is actually very little going on: it opens an iframe to the attachments page and waits until the iframe sends a message containing the content we are supposed to inject on the page. I expect this to be possible In a very similar way for other editors, e.g. ckeditor5.

To test it, install the latest richtext-tinymce, then in the site-wide DefaultConfig parameter input something like like:

relative_urls "false"
menu "{insert: { title: 'Insert', items: 'oacsAttachments | charmap hr' }}" 
external_plugins {{oacsAttachments: '/resources/richtext-tinymce/plugins/oacsAttachments.js'}}
plugins "oacsAttachments"
toolbar "blocks fontsize | bold italic underline strikethrough forecolor backcolor subscript superscript | link unlink anchor | oacsAttachments | alignleft aligncenter alignright alignjustify numlist bullist | removeformat table hr tlfMathJax | fullscreen code"

(the important is to load the plugin and make it part of menu, toolbar or both somehow)

Let me know if this goes in the right direction.

Ciao

Antonio