redimp / otterwiki

A minimalistic wiki powered by python, markdown and git.
https://otterwiki.com
MIT License
648 stars 29 forks source link

Upgrade to CodeMirror 6, make the editor configureable (was: Option to switch text editor) #105

Open TomosLeggett opened 7 months ago

TomosLeggett commented 7 months ago

Would it be possible or even practical to allow the host to switch the editor from codemirror to something else?

Although I like codemirror, it doesn't work at all on mobile. I can't delete blank lines and the mobile support is just awful in general with no autocorrect and all sorts of bizzare behaviour.

I'd like to be able to switch to a basic <textarea> element for mobile support. That way I can use OtterWiki as my own personal wiki/notebook.

redimp commented 7 months ago

Hey Tomos, I've observed strange codemirror behaviour on mobile, too. Never managed to pin it down or to fix it. I would apprecicate hints or help with fixing the issues.

An option for users to configure which editor (codemirror, plain textarea, ..) sounds like a good idea .. or just an additinal button that just hides codemirror.

Currently I'm reworking edit and preview to implemenet #64, #66 and #67. Will keep this request in mind.

redimp commented 7 months ago

@TomosLeggett By chance, have you tested how well codemirror 6 works in your mobile?

TomosLeggett commented 7 months ago

@TomosLeggett By chance, have you tested how well codemirror 6 works in your mobile?

Hey, sorry for some reason I've had 0 notifications about this thread. Didn't mean to ignore you.

I have tested a demo of CodeMirror 6 and I'm still experiencing weird issues, such as:

There's way more weird issues and bugs but at this point it's safe to say it's kind of un-usable on mobile. I think CodeMirror was really designed for code editors like VSCode on desktop computers/laptops rather than mobile devices like phones or tablets.

TomosLeggett commented 7 months ago

Hey Tomos, I've observed strange codemirror behaviour on mobile, too. Never managed to pin it down or to fix it. I would apprecicate hints or help with fixing the issues.

I'm not sure if it's something you can fix, as I've seen threads online that CodeMirror's mobile support is rather poor and isn't really considered a priority for them.

An option for users to configure which editor (codemirror, plain textarea, ..) sounds like a good idea .. or just an additinal button that just hides codemirror.

That sounds like a good idea. I don't think OtterWiki has a settings page, but if it did, I'd file this sort of option as a checkbox or a toggle labelled "Switch to simple editor" with a description underneath - something along the lines of "Use simple editor instead of CodeMirror. Fixes some compatibility issues with CodeMirror but sacrifices certain editor features such as multi-cursor, code-folding and syntax highlighting."

This could highlight to the end-user why they might want to switch to the basic editor without assuming their prior knowledge of what editors are and why CodeMirror acts the way it does.

redimp commented 7 months ago

To be sure, can you please check codemirrors offical demo: https://codemirror.net/try/?

The release of version 6 promised better mobile support and the issue list has very few complains about mobile browser: https://github.com/codemirror/dev/issues

No matter how it turns out, it is a good idea to add an option to pick the editor. An Otter wiki got /-/settings, but not much to configure yet.

TomosLeggett commented 7 months ago

To be sure, can you please check codemirrors offical demo: https://codemirror.net/try/?

The release of version 6 promised better mobile support and the issue list has very few complains about mobile browser: https://github.com/codemirror/dev/issues

No matter how it turns out, it is a good idea to add an option to pick the editor. An Otter wiki got /-/settings, but not much to configure yet.

Good news! Codemirror does seem to work on mobile using the demo you linked:

https://github.com/redimp/otterwiki/assets/29714592/68b2809a-e4a3-4654-ab4f-edaa201af5fd

redimp commented 7 months ago

Uhh, that's good news. This leaves the conclusion: We have to update to the new codemirror release. From the migration guide it can be seen that some adjustments are necessary to obtain the features like the toolbar.

redimp commented 6 months ago

I've started to work on replacing Codemirror 5 with Codemirror 6. It's more work than I'd expected to get all the features again. Even worse is that my time is currently unfortunately very limited. Thanks for the patience!