Skip to content

Commit

Permalink
CharacterLimit prefer replace over insertBefore (#6032)
Browse files Browse the repository at this point in the history
  • Loading branch information
zurfyx authored May 5, 2024
1 parent ff98c26 commit cd533aa
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/lexical-react/src/shared/useCharacterLimit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ function $wrapOverflowedNodes(offset: number): void {

function $wrapNode(node: LexicalNode): OverflowNode {
const overflowNode = $createOverflowNode();
node.insertBefore(overflowNode);
node.replace(overflowNode);
overflowNode.append(node);
return overflowNode;
}
Expand Down
1 change: 1 addition & 0 deletions packages/lexical/src/LexicalUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ function internalMarkParentElementsAsDirty(
}
}

// TODO #6031 this function or their callers have to adjust selection (i.e. insertBefore)
export function removeFromParent(node: LexicalNode): void {
const oldParent = node.getParent();
if (oldParent !== null) {
Expand Down

0 comments on commit cd533aa

Please sign in to comment.