Skip to content

Commit

Permalink
remove copy and paste styles actions
Browse files Browse the repository at this point in the history
  • Loading branch information
draganescu committed Aug 14, 2023
1 parent f924b9d commit 7a2ad93
Showing 1 changed file with 0 additions and 33 deletions.
33 changes: 0 additions & 33 deletions packages/block-editor/src/components/use-block-commands/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ import {
* Internal dependencies
*/
import { store as blockEditorStore } from '../../store';
import { useNotifyCopy } from '../copy-handler';
import usePasteStyles from '../use-paste-styles';

export const useTransformCommands = () => {
const { clientIds } = useSelect( ( select ) => {
Expand Down Expand Up @@ -135,14 +133,6 @@ const useActionsCommands = () => {
const blocks = getBlocksByClientId( clientIds );
const rootClientId = getBlockRootClientId( clientIds[ 0 ] );

const canCopyStyles = blocks.every( ( block ) => {
return (
!! block &&
( hasBlockSupport( block.name, 'color' ) ||
hasBlockSupport( block.name, 'typography' ) )
);
} );

const canDuplicate = blocks.every( ( block ) => {
return (
!! block &&
Expand All @@ -165,15 +155,11 @@ const useActionsCommands = () => {
duplicateBlocks,
insertAfterBlock,
insertBeforeBlock,
flashBlock,
setBlockMovingClientId,
setNavigationMode,
selectBlock,
} = useDispatch( blockEditorStore );

const notifyCopy = useNotifyCopy();
const pasteStyles = usePasteStyles();

const onDuplicate = () => {
if ( ! canDuplicate ) {
return;
Expand Down Expand Up @@ -238,29 +224,12 @@ const useActionsCommands = () => {

replaceBlocks( clientIds, innerBlocks );
};
const onCopy = () => {
const selectedBlockClientIds = blocks.map(
( { clientId } ) => clientId
);
if ( blocks.length === 1 ) {
flashBlock( selectedBlockClientIds[ 0 ] );
}
notifyCopy( 'copy', selectedBlockClientIds );
};
const onPasteStyles = async () => {
if ( ! canCopyStyles ) {
return;
}
await pasteStyles( blocks );
};

if ( ! clientIds || clientIds.length < 1 ) {
return { isLoading: false, commands: [] };
}

const icons = {
paste: copy,
copy,
ungroup,
group,
move,
Expand All @@ -270,8 +239,6 @@ const useActionsCommands = () => {
};

const commands = [
onPasteStyles,
onCopy,
onUngroup,
onGroup,
onMoveTo,
Expand Down

0 comments on commit 7a2ad93

Please sign in to comment.