Drag and drop to a position not allowed by schema restrictions


I created a simplified Glitch :・゚✧ to demonstrate a drag and drop problem I’m having.

Nodes in the schema are the following and I’m also using prosemirror-dropcursor plugin:

  • doc node allows one outerNode.

  • outerNode allows one or more innerNode.

  • innerNode allows one or more paragraph.

When dragging innerNodes inside outerNode I can see the drop cursor and dropping works as it should by the schema restrictions.

However, innerNodes seem to be visually draggable outside the outerNode too, even not allowed by the schema. Dropping those there throws Uncaught TypeError: Cannot read property 'nodeSize' of undefined.

So wondering if I’m missing something in the schema to prevent this from happening, or could this be a bug?

This was three separate issues — a crash in replaceRangeWith, a false positive in dropPoint, and a failture to hide the cursor for invalid drop points in the drop cursor. prosemirror-transform 1.3.1 and prosemirror-dropcursor 1.3.4 should help.

1 Like

Thanks for a quick response @marijn. That solved the problem.