From 2081aa75a75aa93d336d884a7ba8e79c450e7c65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20Ku=CC=88hn?= Date: Fri, 17 May 2019 12:15:55 +0200 Subject: [PATCH] fix inline code input rule --- packages/tiptap-commands/src/commands/markInputRule.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/tiptap-commands/src/commands/markInputRule.js b/packages/tiptap-commands/src/commands/markInputRule.js index b8c59b29d..80893cf4f 100644 --- a/packages/tiptap-commands/src/commands/markInputRule.js +++ b/packages/tiptap-commands/src/commands/markInputRule.js @@ -24,9 +24,7 @@ export default function (regexp, markType, getAttrs) { if (match[m]) { const matchStart = start + match[0].indexOf(match[m - 1]) - // matchEnd index is -1 because the last matching char is not yet member of transaction - // and actually never will be because it triggered the inputrule and vanishes ;) - const matchEnd = matchStart + match[m - 1].length - 1 + const matchEnd = matchStart + match[m - 1].length const textStart = matchStart + match[m - 1].lastIndexOf(match[m]) const textEnd = textStart + match[m].length @@ -52,7 +50,7 @@ export default function (regexp, markType, getAttrs) { } tr.addMark(markStart, markEnd, markType.create(attrs)) - tr.removeStoredMark(markType) // Do not continue with mark. + tr.removeStoredMark(markType) return tr }) }