Hey, I am trying to figure out what I am doing wrong. In short, I have a doc Schema that defines a document to have this structure:
doc(article(title(),...,body(paragraph(...),...)))
There can be any number of paragraphs inside the body, and inside those there are inline nodes, usually text, but I also have a footnote inline node. Around each footnote node, I have a decoration so that I can follow it around and there is a plugin that takes care of mapping it through all transformations.
Now the oddity: If the body contains one paragraph with at least one footnote, like this:
body(paragraph(footnote))
And I put the caret behind the footnote and hit enter, I would expect to get a second paragraph and the footnote staying where it is. Instead, I get an error message:
editor.es5.js:82845 Uncaught RangeError: Position 15 outside of fragment (<paragraph(footnote), paragraph>)
15 is the position where the footnote was before the transformation and this error message is while using a node decoration. I have also tried with an inline decoration, and it gives me a similar result. If I fill the first poaragraph with more text, it will instead create a transformation mapping which increases the from value of the decoration to an unusually high value – adding something like 30 and therefore placing the decoration outside the document. For the mapping even there most simple way of mapping decorations in the apply method of the plugin gives results in the same error:
decos = decos.map(tr.mapping, tr.doc)
Any clues anyone? (Good chance I am doing something stupid here)