Is it possible to embed an inline CodeMirror view inside ProseMirror? The flow would be:
- someone types ``` (just like they write code)
- an inline, CodeMirror backed, custom node would popup that expands horizontally as the user is typing.
I’m trying to figure out if this is even possible.
Yes, it is, there’s even an example like that on the ProseMirror website.
Yes! But I was thinking as an inline node, meaning instead of being a full width div, it just expands as the user types.
For instance, consider this paragraph with
code as an inline codemirror in the middle of it. The part with
code as an inline codemirror would be the codemirror instance.
Ah, no, CodeMirror assumes it is a block element, so for this you’d have to wrap it in some kind of
inline-block container and add a kludge that constantly resizes it to match its content size. It won’t work as a regular content-fitting inline element.