We need a client editor that is capable of providing visual editing for mMD. While the browsers do provide a mechanism for editing HTML, it's more often than not flawed and inconsistent.
My idea for a good visual editor shares many of the concerns that this medium post points out very eloquently and I think we need to provide a simple editor that can manage the behaviors we need, without making it excessively complicated or restrictive. Here's a small list of requirements that this editor has:
- Inline level markup (most notably italic, bold and urls).
- Block level markup (most notably paragraphs, titles and block quotes)
- The editor should ship without support for images, embeds, tables, code, or lists (code and lists may be added at a later point, but are secondary to our mission at this point)
- Consistent behavior importing and exporting mMD.
- Importing and exporting a valid file without editing it should lead to the content being identical
- Precedence should be respected.
There are a few really challenging bits in this project, but most of them are alleviated when reducing the scope of the application. Therefore the editor should ship with the most limited feature set that makes sense for us.
We see a visual editor as a subset of a page editor, it is not intended to manage the media, embeds and interactive content that the user wishes to throw at it. It should just provide a balance between a page editor (the one that manages things like where the elements are on the page, whether the elements are images, text, video or other content) and the fact that a user may just want to add a bit of bold text to highlight something in the paragraph they're currently writing. We don't expect the user to create a "block" whenever they wish to add a bit of highlighted text. That would drive the most patient people mad.
But on the other hand, we do not want our editor to manage content that does not "fit" in a string. It shouldn't accept anything but plain text.
This are some of the most notable challenges that a visual editor comes across and that need to be properly managed:
- Selection. What text the user has currently selected. This gets especially tricky when it goes across multiple lines.
- Line breaks. As the medium post highlights, breaking a line is not as trivial as it may seem at first.
- Clipboard. Accepting data from the clipboard and sanitizing it is not that easy either.
- Performance. In our case this may be secondary, since our editor is intended only for small tidbits to be edited, but the data may become heavy and therefore the system would have to carefully decide when to update the models.