New extension: application-monaco-editor

Hi everyone,

FYI, I’ve created a new repository on xwiki-contrib for hosting an integration of the Monaco Editor within XWiki, as a source editor.

The goal is also at some point to link this with a language server for XWiki syntax.

Repository : https://github.com/xwiki-contrib/application-monaco-editor
JIRA : https://jira.xwiki.org/projects/MONACO

2 Likes

Thanks @caubin, this looks very cool. Is there something working at this stage that can be shown? :slight_smile:

Is the idea to contribute a new editor to the Edit menu (when advanced)?

Would also be interesting to compare it to CodeMirror, to see the pros and cons and see if it would make sense to replace codemirror by this or if it’s really a new editor.

Thanks

We should upgrade CodeMirror by the way since we a lot behind.

Hellow,

I was thinking more about adding the option to replace the CodeMirror editor by something else (and be able to choose which editor to use in the Wiki administration) as I didn’t looked at the process of contributing another editor in the edit menu yet ^^.

The integration is partially working now, should be committing a working version today.

I think that one is hard ATM since I don’t remember that we have an UIXP/XClass for that (but maybe we do and I just don’t know).

That should be easy since it’s a menu entry and we already have UIXPs for that.

We have the Editor Module / API that allows binding editors to data types. If you check editwiki.vm it uses

$!services.edit.syntaxContent.text(...)

which outputs the configured “text” editor for the “syntaxContent” data type. The configuration can be done in xwiki.properties or in the wiki using XWiki.EditorBindingClass. Check XWiki.DefaultWYSIWYGEditorConfig. Should be pretty easy to add XWiki.DefaultTextEditorConfig for the text editor.

As for @caubin he should follow what the CKEditor does in CKEditor.SyntaxContentEditor, i.e. provide an editor for “org.xwiki.rendering.syntax.SyntaxContent” data type with category “text” and role hint “monaco”.

cool!

@mflorea indeed, I did that and it worked perfectly

The integration is now working fine, however I’m looking at a way to add a section similar to the WYSIWYG editor configuration one in the wiki admin in order to choose which text editor should be used + set up a couple of parameters for Monaco itself.

I’ve noticed that the configuration code from CKEditor is quite generic, and some parts of it could be re-used for this task, however I’m not sure that it has the stability of an API.

Which code are you referring to? Can you give a link?

Thanks,
Marius