Skip to content

Commit

Permalink
Merge pull request #3912 from udecode/fix/block-menu
Browse files Browse the repository at this point in the history
Fix/block menu
  • Loading branch information
felixfeng33 authored Dec 25, 2024
2 parents 6af91a2 + 7fccf1b commit 6e26522
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/rich-years-sneeze.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@udecode/plate-selection': patch
---

Fix `selectedIds` has `undifinded`
5 changes: 1 addition & 4 deletions apps/www/src/registry/default/plate-ui/draggable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'
)}
>
<Gutter>
Expand Down
6 changes: 4 additions & 2 deletions packages/selection/src/react/BlockSelectionPlugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,12 @@ export const BlockSelectionPlugin = createTPlatePlugin<BlockSelectionConfig>({
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);
Expand Down

0 comments on commit 6e26522

Please sign in to comment.