From ea2992f8bdfb5c4253cf2d9e9278cd9768234c7a Mon Sep 17 00:00:00 2001 From: Daniel Richards Date: Thu, 27 Aug 2020 18:11:27 +0800 Subject: [PATCH 01/23] Add drag handle to block mover component --- .../src/components/block-mover/index.js | 53 +++++++++++++------ .../src/components/block-mover/style.scss | 15 +++++- .../src/components/block-toolbar/index.js | 18 ++----- packages/icons/src/index.js | 1 + packages/icons/src/library/drag-handle.js | 21 ++++++++ 5 files changed, 76 insertions(+), 32 deletions(-) create mode 100644 packages/icons/src/library/drag-handle.js diff --git a/packages/block-editor/src/components/block-mover/index.js b/packages/block-editor/src/components/block-mover/index.js index 45fc5a6e816c6..f5165195a0153 100644 --- a/packages/block-editor/src/components/block-mover/index.js +++ b/packages/block-editor/src/components/block-mover/index.js @@ -7,7 +7,9 @@ import classnames from 'classnames'; /** * WordPress dependencies */ -import { ToolbarGroup, ToolbarItem } from '@wordpress/components'; + +import { dragHandle } from '@wordpress/icons'; +import { ToolbarGroup, ToolbarItem, Button } from '@wordpress/components'; import { getBlockType } from '@wordpress/blocks'; import { useState } from '@wordpress/element'; import { withSelect } from '@wordpress/data'; @@ -15,6 +17,7 @@ import { withSelect } from '@wordpress/data'; /** * Internal dependencies */ +import BlockDraggable from '../block-draggable'; import { BlockMoverUpButton, BlockMoverDownButton } from './button'; function BlockMover( { @@ -47,22 +50,42 @@ function BlockMover( { } ) } > - - { ( itemProps ) => ( - - ) } - - - { ( itemProps ) => ( - + + { ( itemProps ) => ( + + ) } + + + { ( itemProps ) => ( + + ) } + + + + { ( { isDraggable, onDraggableStart, onDraggableEnd } ) => ( + @@ -338,7 +338,7 @@ exports[`ColorPicker should commit changes to all views on keyDown = DOWN 1`] = xmlns="http://www.w3.org/2000/svg" > @@ -512,7 +512,7 @@ exports[`ColorPicker should commit changes to all views on keyDown = ENTER 1`] = xmlns="http://www.w3.org/2000/svg" > @@ -686,7 +686,7 @@ exports[`ColorPicker should commit changes to all views on keyDown = UP 1`] = ` xmlns="http://www.w3.org/2000/svg" > @@ -860,7 +860,7 @@ exports[`ColorPicker should only update input view for draft changes 1`] = ` xmlns="http://www.w3.org/2000/svg" > @@ -1034,7 +1034,7 @@ exports[`ColorPicker should render color picker 1`] = ` xmlns="http://www.w3.org/2000/svg" > diff --git a/packages/edit-post/src/components/sidebar/plugin-post-publish-panel/test/__snapshots__/index.js.snap b/packages/edit-post/src/components/sidebar/plugin-post-publish-panel/test/__snapshots__/index.js.snap index aafa7c918f179..a6062e7af7b6b 100644 --- a/packages/edit-post/src/components/sidebar/plugin-post-publish-panel/test/__snapshots__/index.js.snap +++ b/packages/edit-post/src/components/sidebar/plugin-post-publish-panel/test/__snapshots__/index.js.snap @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`PluginPostPublishPanel renders fill properly 1`] = `"

My panel content
"`; +exports[`PluginPostPublishPanel renders fill properly 1`] = `"

My panel content
"`; diff --git a/packages/edit-post/src/components/sidebar/plugin-pre-publish-panel/test/__snapshots__/index.js.snap b/packages/edit-post/src/components/sidebar/plugin-pre-publish-panel/test/__snapshots__/index.js.snap index 6087ec62497e5..b14bc1c0458d2 100644 --- a/packages/edit-post/src/components/sidebar/plugin-pre-publish-panel/test/__snapshots__/index.js.snap +++ b/packages/edit-post/src/components/sidebar/plugin-pre-publish-panel/test/__snapshots__/index.js.snap @@ -1,3 +1,4 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`PluginPrePublishPanel renders fill properly 1`] = `"

My panel content
"`; +exports[`PluginPrePublishPanel renders fill properly 1`] = `"

My panel content
"`; +q