EQMS-1443: Fixed qms-comments position / decoration mapping (develop branch) (#8119)

Signed-off-by: Victor Ilyushchenko <alt13ri@gmail.com>
This commit is contained in:
Victor Ilyushchenko
2025-03-01 00:13:07 +03:00
committed by GitHub
parent 34cfc564b8
commit c05942c19b
@@ -88,7 +88,17 @@ export const NodeHighlightExtension: Extension<NodeHighlightExtensionOptions> =
}
const { schema, doc, tr } = view.state
const range = getMarkRange(doc.resolve(pos), schema.marks[NodeUuidExtension.name])
const $pos = doc.resolve(pos)
if ($pos.nodeAfter === null) {
return false
}
const nodeUuidMark = findNodeUuidMark($pos.nodeAfter)
if (nodeUuidMark === undefined) {
return false
}
const range = getMarkRange($pos, schema.marks[NodeUuidExtension.name], nodeUuidMark.attrs)
if (!isRange(range)) {
return false
@@ -216,7 +226,7 @@ const createDecorations = (
}
// the first pos does not contain the mark, so we need to add 1 (pos + 1) to get the correct range
const range = getMarkRange(doc.resolve(pos + 1), markType)
const range = getMarkRange(doc.resolve(pos + 1), markType, nodeUuidMark.attrs)
if (!isRange(range)) {
return
}