Skip to content

Commit

Permalink
revert partial selection copy in block actions menu item
Browse files Browse the repository at this point in the history
  • Loading branch information
ntsekouras committed Apr 11, 2022
1 parent f58e103 commit b2c8c40
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 38 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { castArray, flow, noop } from 'lodash';
/**
* WordPress dependencies
*/
import { getBlockType } from '@wordpress/blocks';
import { getBlockType, serialize } from '@wordpress/blocks';
import { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';
import { useDispatch, useSelect } from '@wordpress/data';
import { moreVertical } from '@wordpress/icons';
Expand All @@ -18,6 +18,7 @@ import {
} from '@wordpress/element';
import { __, sprintf } from '@wordpress/i18n';
import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';
import { useCopyToClipboard } from '@wordpress/compose';

/**
* Internal dependencies
Expand All @@ -26,7 +27,6 @@ import BlockActions from '../block-actions';
import BlockIcon from '../block-icon';
import BlockModeToggle from './block-mode-toggle';
import BlockHTMLConvertButton from './block-html-convert-button';
import CopyMenuItem from './block-copy-button';
import __unstableBlockSettingsMenuFirstItem from './block-settings-menu-first-item';
import BlockSettingsMenuControls from '../block-settings-menu-controls';
import { store as blockEditorStore } from '../../store';
Expand All @@ -39,6 +39,11 @@ const POPOVER_PROPS = {
isAlternate: true,
};

function CopyMenuItem( { blocks, onCopy } ) {
const ref = useCopyToClipboard( () => serialize( blocks ), onCopy );
return <MenuItem ref={ ref }>{ __( 'Copy' ) }</MenuItem>;
}

export function BlockSettingsDropdown( {
clientIds,
__experimentalSelectBlock,
Expand Down

0 comments on commit b2c8c40

Please sign in to comment.