programmable-matter icon indicating copy to clipboard operation
programmable-matter copied to clipboard

editor invariant crash if you delete a hanging selection at the end of a code block

Open jaked opened this issue 3 years ago • 0 comments

In an editor state like

<code>
<text code>... // some code

<cursor>
... // some more code
</text>
</code>
<p>
</anchor>Some text
</p>

if you delete the selection, the text of the following paragraph is moved into the code node; but now there are two text nodes (since the first one is marked), breaking the invariant on code.

There are a couple different problems here:

  • text inside a code should not have marks (strip them in normalization? but see below)
  • deleting a selection that hangs out of a code should not suck text into the code.

(Maybe text inside a code should support marks / inlines? E.g. it would be nice to be able to put links in code blocks, or even live code.)

jaked avatar Oct 25 '21 17:10 jaked