Skip to content

Commit

Permalink
Fix prevSibling not getting updated after replacement
Browse files Browse the repository at this point in the history
  • Loading branch information
Sahejkm committed May 9, 2024
1 parent 5b20765 commit dda7560
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/lexical-text/src/registerLexicalTextEntity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export function registerLexicalTextEntity<T extends TextNode>(
return;
}

const prevSibling = node.getPreviousSibling();
let prevSibling = node.getPreviousSibling();
let text = node.getTextContent();
let currentNode = node;
let match;
Expand Down Expand Up @@ -131,7 +131,7 @@ export function registerLexicalTextEntity<T extends TextNode>(
} else {
const nextMatch = getMatch(nextText);

if (nextMatch !== null && nextMatch.start === 0) {
if (nextMatch !== null && nextMatch.start === 0 && match === null) {
return;
}
}
Expand Down Expand Up @@ -165,6 +165,7 @@ export function registerLexicalTextEntity<T extends TextNode>(
if (currentNode == null) {
return;
}
prevSibling = replacementNode;
}
};

Expand Down

0 comments on commit dda7560

Please sign in to comment.