Fix extendMarkRange doesn't work when cursor is at end of mark

This commit is contained in:
JDinABox
2022-04-16 23:39:39 -04:00
committed by Dominik
parent 9430ca9679
commit 0fb68af3a1

View File

@@ -29,7 +29,11 @@ export function getMarkRange(
return
}
const start = $pos.parent.childAfter($pos.parentOffset)
let start = $pos.parent.childAfter($pos.parentOffset)
if ($pos.parentOffset === start.offset && start.offset !== 0) {
start = $pos.parent.childBefore($pos.parentOffset)
}
if (!start.node) {
return
@@ -41,7 +45,7 @@ export function getMarkRange(
return
}
let startIndex = $pos.index()
let startIndex = start.index
let startPos = $pos.start() + start.offset
let endIndex = startIndex + 1
let endPos = startPos + start.node.nodeSize