It currently provides two components: Editor, which saves the content as ProseMirror JSON, and HtmlEditor, which converts the content to and from HTML.
It works well for my use case, which is a single editor on a page, but I’m not sure how best to use componentWillReceiveProps to update the editor if the props change (currently it just attaches the editor when the component mounts and lets ProseMirror handle all the rendering). Does anyone have any ideas how this could be improved?
The conversion to and from HTML is nice and simple thanks to ProseMirror’s DOMParser and DOMSerializer. I wonder if perhaps the parse and serializeFragment methods could be updated to convert to/from strings as well as DOM nodes?
Not yet, in the absence of any implementation of a dropdown menu. I’m wondering if a “heading” button (create a heading at the current level) + indent might make sense…
That’s a good point, but I can’t see an obvious way to specify that restriction, given that sub and sup are marks and only nodes can have a content schema. Even if they were converted to inline nodes, it would need something like “inline* but not sup” as the content schema, which is getting complicated - probably best to just allow the combination, as it shouldn’t cause problems.
It would actually be useful for some cases (e.g. chemical formulae) to have a node type that contains both superscript + subscript, displaying them stacked above each other.
Yes, that’s true, although I can imagine a UI specifically for chemical formulae, with clickable placeholders for superscript and subscript modifiers around each element. It could still be LaTeX and MathJax behjnd the scenes, if there isn’t a more semantic way to do the markup with HTML.