Moved this to not hijack the proseMirror-widget project thread.
We’re working on a related challenge from a different angle: widgets overlaid with PM editable content, outside of the editable flow.
Demo, with a CodeMirror widget in an iframe overlay: http://the-grid.github.io/ed/
There is only one extension to the schema: divs that act as placeholders for the overlays to stay in sync with. There is a little trickiness to keep the positions synchronized, but it seems to work.
TODO: making cut and paste work, making arrow ↑ ↓ caret navigation work as expected.