chore: sync super markdown import implementation with lexical

This commit is contained in:
Aman Harwara
2023-12-22 12:32:07 +05:30
parent 0efcf13010
commit 69a7563b4e

View File

@@ -257,18 +257,15 @@ function importTextMatchTransformers(textNode_: TextNode, textMatchTransformers:
const startIndex = match.index || 0
const endIndex = startIndex + match[0].length
let replaceNode, leftTextNode, rightTextNode
let replaceNode, newTextNode
if (startIndex === 0) {
;[replaceNode, textNode] = textNode.splitText(endIndex)
} else {
;[leftTextNode, replaceNode, rightTextNode] = textNode.splitText(startIndex, endIndex)
;[, replaceNode, newTextNode] = textNode.splitText(startIndex, endIndex)
}
if (leftTextNode) {
importTextMatchTransformers(leftTextNode, textMatchTransformers)
}
if (rightTextNode) {
textNode = rightTextNode
if (newTextNode) {
importTextMatchTransformers(newTextNode, textMatchTransformers)
}
transformer.replace(replaceNode, match)
continue mainLoop