Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
felixfeng33 committed Nov 7, 2024
1 parent 0d209ba commit b76d135
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions packages/selection/src/react/BlockSelectionPlugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,22 @@ export const BlockSelectionAfterEditable: EditableSiblingComponent = () => {

export const BlockSelectionPlugin = createTPlatePlugin<BlockSelectionConfig>({
key: 'blockSelection',
extendEditor: ({ api, editor, getOptions }) => {
const { setSelection } = editor;

editor.setSelection = (...args) => {
if (
getOptions().selectedIds!.size > 0 &&
!editor.getOption(BlockMenuPlugin, 'openId')
) {
api.blockSelection.unselect();
}

setSelection(...args);
};

return editor;
},
options: {
areaOptions: {
behaviour: {
Expand Down Expand Up @@ -301,9 +317,6 @@ export const BlockSelectionPlugin = createTPlatePlugin<BlockSelectionConfig>({
const target = event.target as HTMLElement;

if (target.dataset.platePreventUnselect) return;

console.log(editor.getOption(BlockMenuPlugin, 'openId'), 'fj');

if (
event.button === 0 &&
getOptions().selectedIds!.size > 0 &&
Expand Down

0 comments on commit b76d135

Please sign in to comment.