fix: only start at block with removing if not an inline node (#4791)

Co-authored-by: Pepijn Hillemans <pepijn.hillemans@cm.com>
This commit is contained in:
PHillemans 2024-05-09 15:47:13 +02:00 committed by GitHub
parent 7213843951
commit fb2b1c0b02
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -57,7 +57,9 @@ export function nodeInputRule(config: {
// insert node from input rule
tr.replaceWith(matchStart, end, newNode)
} else if (match[0]) {
tr.insert(start - 1, config.type.create(attributes)).delete(
const insertionStart = config.type.isInline ? start : start - 1
tr.insert(insertionStart, config.type.create(attributes)).delete(
tr.mapping.map(start),
tr.mapping.map(end),
)