Skip to content

Commit

Permalink
Don't execute copy handler if widget area block is included
Browse files Browse the repository at this point in the history
  • Loading branch information
t-hamano committed May 24, 2022
1 parent 8e6b18e commit c4a7de0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
9 changes: 9 additions & 0 deletions packages/block-editor/src/components/copy-handler/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ export function useNotifyCopy() {
export function useClipboardHandler() {
const {
getBlocksByClientId,
getBlockName,
getSelectedBlockClientIds,
hasMultiSelection,
getSettings,
Expand All @@ -100,6 +101,14 @@ export function useClipboardHandler() {
return;
}

// Don't execute if widget area block is included
if (
getBlockName( selectedBlockClientIds[ 0 ] ) ===
'core/widget-area'
) {
return;
}

// Always handle multiple selected blocks.
if ( ! hasMultiSelection() ) {
const { target } = event;
Expand Down
8 changes: 0 additions & 8 deletions packages/block-editor/src/store/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -711,14 +711,6 @@ export const getSelectedBlockClientIds = createSelector(
return EMPTY_ARRAY;
}

// Disable widget area selection.
if (
getBlockName( state, selectionStart.clientId ) ===
'core/widget-area'
) {
return EMPTY_ARRAY;
}

if ( selectionStart.clientId === selectionEnd.clientId ) {
return [ selectionStart.clientId ];
}
Expand Down

0 comments on commit c4a7de0

Please sign in to comment.