Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
TomosLeggett opened this issue Apr 6, 2024 · 8 comments
Labels
enhancement New feature or request

Comments

@TomosLeggett
Copy link

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
Copy link
Owner

redimp commented Apr 6, 2024

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
Copy link
Owner

redimp commented Apr 6, 2024

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

@TomosLeggett
Copy link
Author

@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:

  • Hitting backspace to delete an empty line will delete the last character of the line above as well.
  • Hitting enter not only breaks to the next line but will also indent the new line 10% of the time for seemingly no reason at all.
  • If you type too quickly for the cursor, it gets confused and goes to the start of the line, almost like a carriage return.
  • If you type further than the bounding box, the text will clip through it. Not sure if that's CodeMirror or this particular demonstration.
  • Sometimes it'll just create a new line below the line you're currently typing on for fun.
  • Backspace will delete two characters instead of one whenever it feels like it.

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
Copy link
Author

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
Copy link
Owner

redimp commented Apr 14, 2024

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
Copy link
Author

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:

screen-20240420-174935.mp4

@redimp
Copy link
Owner

redimp commented Apr 24, 2024

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 redimp changed the title Option to switch text editor Upgrade to CodeMirror 6, make the editor configureable (was: Option to switch text editor) Apr 24, 2024
@redimp redimp added the enhancement New feature or request label Apr 24, 2024
@redimp
Copy link
Owner

redimp commented May 12, 2024

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants