From 0cf905abb9f9546fb379b7f539428d9ff655fa02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20Ku=CC=88hn?= Date: Sat, 19 Jan 2019 09:29:15 +0100 Subject: [PATCH] fix a bug for getting mark range, fix #156 --- packages/tiptap-utils/src/utils/getMarkRange.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/packages/tiptap-utils/src/utils/getMarkRange.js b/packages/tiptap-utils/src/utils/getMarkRange.js index 115f8b6b..b7026156 100644 --- a/packages/tiptap-utils/src/utils/getMarkRange.js +++ b/packages/tiptap-utils/src/utils/getMarkRange.js @@ -22,12 +22,14 @@ export default function ($pos = null, type = null) { startPos -= $pos.parent.child(startIndex).nodeSize } - let endIndex = $pos.indexAfter() - let endPos = startPos + start.node.nodeSize - while (endIndex < $pos.parent.childCount && link.isInSet($pos.parent.child(endIndex).marks)) { - endPos += $pos.parent.child(endIndex).nodeSize - endIndex += 1 - } + 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 + // } return { from: startPos, to: endPos }