Hi, I just wanted to suggest using TinyMCE for the editor instead of reinventing the wheel and coping with a buggy Document.execCommand().
Perhaps there’s something I’m missing here and you’ve all already thought about it.
But on the off chance that you haven’t, please let me explain why this is a good idea:
- Any contentEditable element can be hooked. So it’s very easy to implement.
- Issues and bugs with Document.execCommand() would be fully solved. We’d have alphabetical lists. Better list handling in general. Better undo/redo etc.
- The accompanying toolbar and other elements can be completely turned off. Meaning that Anki’s toolbar can be kept intact. So this change wouldn’t break addons nor the look and feel.
- Image handling is vastly superior. It would get rid loads of issues the current handling has. We would also get crop and flip functionality as well out of the box! We would also finally be able to drag the images freely and without much fuss.
- Table support
- Many more goodies
I really don’t see any negatives at all here. It’s also licensed with MIT or LGPL (depending on the source).
They have rebuilt execCommands to be much better (something that would require a ton of work to do from scratch):
https:// www.tiny(dot)cloud/blog/tinymce-exec-commands/
To remove the toolbars and such have a look at:
https:// www.tiny(dot)cloud/docs/tinymce/6/toolbar-configuration-options/
So, what do you think?