From 6f570580d8a4c05a1eee624590ebb04cd0e133b3 Mon Sep 17 00:00:00 2001 From: Felix Feng Date: Wed, 25 Dec 2024 10:33:36 +0800 Subject: [PATCH] fix block-menu --- apps/www/src/registry/default/plate-ui/draggable.tsx | 5 +---- packages/selection/src/react/BlockSelectionPlugin.tsx | 6 ++++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/apps/www/src/registry/default/plate-ui/draggable.tsx b/apps/www/src/registry/default/plate-ui/draggable.tsx index 928a3e7c4b..5e0bf38ddf 100644 --- a/apps/www/src/registry/default/plate-ui/draggable.tsx +++ b/apps/www/src/registry/default/plate-ui/draggable.tsx @@ -108,10 +108,7 @@ export const Draggable = withRef<'div', PlateRenderElementProps>( className={cn( 'relative', isDragging && 'opacity-50', - STRUCTURAL_TYPES.includes(element.type) - ? 'group/structural' - : 'group', - className + STRUCTURAL_TYPES.includes(element.type) ? 'group/structural' : 'group' )} > diff --git a/packages/selection/src/react/BlockSelectionPlugin.tsx b/packages/selection/src/react/BlockSelectionPlugin.tsx index 1cd8b8c605..656259286e 100644 --- a/packages/selection/src/react/BlockSelectionPlugin.tsx +++ b/packages/selection/src/react/BlockSelectionPlugin.tsx @@ -161,10 +161,12 @@ export const BlockSelectionPlugin = createTPlatePlugin({ const next = new Set(prev); if (added) { - extractSelectableIds(added).forEach((id) => next.add(id)); + extractSelectableIds(added).forEach((id) => id && next.add(id)); } if (removed) { - extractSelectableIds(removed).forEach((id) => next.delete(id)); + extractSelectableIds(removed).forEach( + (id) => id && next.delete(id) + ); } setOption('selectedIds', next);