Merge pull request #280 from StickyKnow/fix-getMarkRange
Fix getMarkRange
This commit is contained in:
@@ -17,19 +17,18 @@ export default function ($pos = null, type = null) {
|
||||
|
||||
let startIndex = $pos.index()
|
||||
let startPos = $pos.start() + start.offset
|
||||
let endIndex = startIndex + 1
|
||||
let endPos = startPos + start.node.nodeSize
|
||||
|
||||
while (startIndex > 0 && link.isInSet($pos.parent.child(startIndex - 1).marks)) {
|
||||
startIndex -= 1
|
||||
startPos -= $pos.parent.child(startIndex).nodeSize
|
||||
}
|
||||
|
||||
// const endIndex = $pos.indexAfter()
|
||||
const endPos = startPos + start.node.nodeSize
|
||||
|
||||
// disable for now. see #156
|
||||
// while (endIndex < $pos.parent.childCount && link.isInSet($pos.parent.child(endIndex).marks)) {
|
||||
// endPos += $pos.parent.child(endIndex).nodeSize
|
||||
// endIndex += 1
|
||||
// }
|
||||
while (endIndex < $pos.parent.childCount && link.isInSet($pos.parent.child(endIndex).marks)) {
|
||||
endPos += $pos.parent.child(endIndex).nodeSize
|
||||
endIndex += 1
|
||||
}
|
||||
|
||||
return { from: startPos, to: endPos }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user