Mapping of node/inline decorations

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:


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:


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 =, tr.doc)

Any clues anyone? (Good chance I am doing something stupid here)

Might be a bug. Can you condense this to a minimal script (simplified schema + plugin + document) that would make it easy for me to reproduce it?

Ok, it may be outdated now that 0.23 is out. I decided I didn’t really need decorations in that case, because I really just needed to track positions, and I could just as well do that by mapping a simple array of {from, to} objects around . That worked and there were no strange surprises any more. If this shows up again in one of the plugins where we do need decorations, I will prepare a minimal test for you.