fix: fix mappes positions for paste rules, fix #2002

This commit is contained in:
Philipp Kühn 2021-10-08 22:40:06 +02:00
parent ed00dbbe56
commit 770c4e18e1

View File

@ -104,7 +104,7 @@ function run(config: {
return
}
const start = resolvedFrom + match.index
const start = resolvedFrom + match.index + 1
const end = start + match[0].length
const range = {
from: state.tr.mapping.map(start),
@ -118,7 +118,7 @@ function run(config: {
})
})
})
}, from)
})
}
/**
@ -141,7 +141,7 @@ export function pasteRulesPlugin(rules: PasteRule[]): Plugin {
const from = before.content.findDiffStart(doc.content)
const to = before.content.findDiffEnd(doc.content)
if (!from || !to) {
if (!from || !to || from === to.b) {
return
}
@ -155,7 +155,7 @@ export function pasteRulesPlugin(rules: PasteRule[]): Plugin {
run({
state: chainableState,
from,
from: Math.max(from - 1, 0),
to: to.b,
rules,
plugin,