Skip to content

Commit

Permalink
chore: sync super markdown import implementation with lexical
Browse files Browse the repository at this point in the history
  • Loading branch information
amanharwara committed Dec 22, 2023
1 parent 0efcf13 commit 69a7563
Showing 1 changed file with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 69a7563

Please sign in to comment.