in src/plugin/fieldViews/ProseMirrorFieldView.ts [349:374]
protected applyDecorationsFromOuterEditor(
decorations: DecorationSource,
fieldNode: Node
) {
// Do nothing if the decorations have not changed.
if (decorations === this.outerDecorations) {
return;
}
this.outerDecorations = decorations;
// The incoming decorations are positioned relative to the parent NodeView, so we only
// need to consider the offset of this field from its parent NodeView, and can ignore
// the offset of the parent from the outer editor's document.
// The node we will be altering is a child of its parent, so we add +1 to the offset.
const fieldOffsetFromElement = this.offset + 1;
const mappedDecorationSet = getMappedDecorationsFromSource(
decorations,
fieldOffsetFromElement,
fieldNode,
this.outerView.state.doc
);
this.decorations = mappedDecorationSet;
this.decorationsPending = true;
}