[PLUGIN ADDED] Monaco Editor

NorfolkGreg
Posts: 88
Joined: Wed Sep 01, 2021 7:50 am

Possible Bug - Monaco Editor

Post by NorfolkGreg »

Is the Monaco meant to be used in conjunction with Summernote? I have removed Summernote and installed Monaco on my site.

It's an editor I'm not familiar with so it may be me but after a very quick play I find:

"mailto:" links create a new blank tab with CTRL-CLICK and open my copy of Thunderbird but I can't get CTRL-CLICK to work to follow page links. I have a number of subsidiary pages that don't appear on my menu and that means I can't find a way of reaching them to edit them.

Also, is there any way to alter the defaults that Wiz has set or find other options I can change, e.g. word wrap?

Any help appreciated.

NorfolkGreg
Posts: 88
Joined: Wed Sep 01, 2021 7:50 am

Re: Possible Bug - Monaco Editor

Post by NorfolkGreg »

NorfolkGreg wrote:
Thu Jan 20, 2022 4:34 pm
I can't get CTRL-CLICK to work to follow page links. I have a number of subsidiary pages that don't appear on my menu and that means I can't find a way of reaching them to edit them.
UPDATE:
You can reach non-menu pages! You have to use "Settings > Menu > [Page] Visit".
Then you get to the page in edit mode.

User avatar
wiz
Admin
Posts: 749
Joined: Sat Oct 30, 2010 12:23 am

Re: [PLUGIN ADDED] Monaco Editor

Post by wiz »

@NorfolkGreg
Only one editor should be used at a time.

If you can, please report there issues to mjxl GitHub, since he has setup the plugin completely on his own and I have not set any settings for this plugin in any regard.

Mjxl, help! :)

Also Greg, thank you for reporting!

NorfolkGreg
Posts: 88
Joined: Wed Sep 01, 2021 7:50 am

Re: [PLUGIN ADDED] Monaco Editor

Post by NorfolkGreg »

I'm still very hazy about using GitHub, but I'll have a go! I can confirm that Monaco appears to make Summernote disappear from view completely if it was installed previously.


User avatar
mjxl
Posts: 44
Joined: Thu Jan 30, 2020 4:57 am

Re: [PLUGIN ADDED] Monaco Editor

Post by mjxl »

Joo!

The Monaco Editor is not meant to be used in conjunction with a different one :P
I'm not quite sure what to do with your problem here :o

The newtab and email client opening on the "mailto:" links is default behaviour in Chrome (like most browsers)

Maybe we can go back to "default" behaviour of WonderCMS though, aka needing to click the area you want to edit, and THEN load the editor..?

NorfolkGreg
Posts: 88
Joined: Wed Sep 01, 2021 7:50 am

Re: [PLUGIN ADDED] Monaco Editor

Post by NorfolkGreg »

mjxl wrote:
Fri Jan 21, 2022 7:08 am
The Monaco Editor is not meant to be used in conjunction with a different one :P
I've no problem with that. I've managed to "train" the guy who will be editing the site, once I pass it over, to work with the default editor. He's now quite happy to add paragraph and heading tags round his text and even add classes to them. Indeed, I've even got him to use an external editor that allows will add tags around selected text and then paste the stuff into WonderCMS's default editor.
The newtab and email client opening on the "mailto:" links is default behaviour in Chrome (like most browsers)
I've only tested in Firefox so far. I haven't yet tried Edge, but from what you say it's what I should expect.

I've now found that the problem with non-response to CTRL-CLICK is because all links on my site are internal with relative addressing. (e.g. href="contacts" not href="https://mydomain.com/contacts") It works when an absolute address is in place opening a new tab - BUT it does not check whether I'm logged in so displays the page rather than the editor, so I then have to loginon that page again to enter the editor. :(

Further found that WonderCMS popup messages such as "WonderCMS successfully updated. Wohoo!" and "This page (capacity-to-litigate) is currently hidden from the menu. Open menu visibility settings" cannot be dismissed by clicking the "X". I have to reopen the page via the Modal to clear such messages.

I may have a solution to that. Perhaps you can confirm...
After removing and installing Monaco again I notice the message

Successfully installed/updated monaco-editor.
Hide all alerts until next login

I guess clicking the "Hide all alerts" link will cure this? Definitely something to be mentioned in the README.MD file!
Maybe we can go back to "default" behaviour of WonderCMS though, aka needing to click the area you want to edit, and THEN load the editor..?
That does have some advantages, if it means folks can only wreck one part of a page on CTRL-S rather than multiple parts. I do like the CTRL-S feature. You may have seen from another topic, that one of my concerns with the existing editor arrangement is the loss of edits if you get "called away from the desk" and find complex edits have been forgotten when you return an hour later as you've been logged out with unsaved edits. CTRL-S will induce a "save regularly" habit.

As I said earlier, I'm very new to Monaco, and I'm still reading the documentation to get my head around some of its features revealed on hitting F1. However, for WonderCMS purposes it appears to lack the one feature I would really wish to see added to the default editor - some keystrokes/dialogues that allow you to wrap selected text with a variety of common tags.

Currently, there are two reasons I will still encourage my client to use an external editor:
1. While Summernote provides the "wrapping tags" feature it also wrecks they layout of the source code making it near impossible to read and debug formatting errors that can be very difficult to cure using Summernote alone.
2. Monaco has two other awkwardnesses that the default editor doesn't have:
  • Lack of word wrap
  • Need to manually scroll the page to keep caret within the WonderCMS window.
Give me an internal text editor (rather than Summernote WYSIWYG editing) that has word wrap, tag wrapping and scrolling and I'd be an extremely happy man as my client would be able to sort all his own editing issues.

User avatar
mjxl
Posts: 44
Joined: Thu Jan 30, 2020 4:57 am

Re: [PLUGIN ADDED] Monaco Editor

Post by mjxl »

There are a few things that can be added to the configuration of the editor.

Taken from Monaco playground:

Code: Select all

wordWrap: 'wordWrapColumn',
wordWrapColumn: 40,
// Set this to false to not auto word wrap minified files
wordWrapMinified: true,
// try "same", "indent" or "none"
wrappingIndent: 'indent'
Also each editor saves only itself, not the rest of the page.

As for wrapping text with tags, there are a couple things we can do :) !
We could for example use all of Monaco's HTML features by adding a completionProvider, or we could create keybinds to make custom wrappers.

F9 to log console:

Code: Select all

editor.addCommand(monaco.KeyCode.F9, () => {
	let value = editor.getValue();
	// do whatever with the value :)
	console.log(value);
});

NorfolkGreg
Posts: 88
Joined: Wed Sep 01, 2021 7:50 am

Re: [PLUGIN ADDED] Monaco Editor

Post by NorfolkGreg »

Thanks mjxl,

While I know my HTML and CSS, almost everything else is at the limit of or beyond my understanding.

Are you saying this is something I can fix/try by playing with what is now on my server having installed the Monaco plugin or are you saying this is something that you could do to the plugin if others say they have the same priorities/needs as I.

Certainly what you suggest would appear to meet my requests.

User avatar
mjxl
Posts: 44
Joined: Thu Jan 30, 2020 4:57 am

Re: [PLUGIN ADDED] Monaco Editor

Post by mjxl »

I guess it's something 'we' could work on.
Atm I've got a sore shoulder, so I'm not crawling behind my pc.

If JS is new for you it can be quite a lot to process, i guess.
Let's get back on this!

Post Reply