Skip to content

Commit 3a140d2

Browse files
[lexical-playground] Bug Fix: Ensure Delete Node handles all node types (#7096)
Co-authored-by: shaheerkpzaigo <[email protected]>
1 parent 8e2ede2 commit 3a140d2

File tree

1 file changed

+9
-0
lines changed
  • packages/lexical-playground/src/plugins/ContextMenuPlugin

1 file changed

+9
-0
lines changed

packages/lexical-playground/src/plugins/ContextMenuPlugin/index.tsx

+9
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ import {
1717
import {
1818
$getNearestNodeFromDOMNode,
1919
$getSelection,
20+
$isDecoratorNode,
21+
$isNodeSelection,
2022
$isRangeSelection,
2123
COPY_COMMAND,
2224
CUT_COMMAND,
@@ -183,6 +185,13 @@ export default function ContextMenuPlugin(): JSX.Element {
183185
.at(-2);
184186

185187
ancestorNodeWithRootAsParent?.remove();
188+
} else if ($isNodeSelection(selection)) {
189+
const selectedNodes = selection.getNodes();
190+
selectedNodes.forEach((node) => {
191+
if ($isDecoratorNode(node)) {
192+
node.remove();
193+
}
194+
});
186195
}
187196
},
188197
}),

0 commit comments

Comments
 (0)