@wordpress/block-editor 9.0.0 → 9.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/README.md +1 -0
- package/build/components/block-alignment-matrix-control/index.js +1 -6
- package/build/components/block-alignment-matrix-control/index.js.map +1 -1
- package/build/components/block-content-overlay/index.js +4 -82
- package/build/components/block-content-overlay/index.js.map +1 -1
- package/build/components/block-draggable/draggable-chip.native.js +64 -0
- package/build/components/block-draggable/draggable-chip.native.js.map +1 -0
- package/build/components/block-draggable/dropping-insertion-point.native.js +157 -0
- package/build/components/block-draggable/dropping-insertion-point.native.js.map +1 -0
- package/build/components/block-draggable/index.native.js +484 -0
- package/build/components/block-draggable/index.native.js.map +1 -0
- package/build/components/block-draggable/use-scroll-when-dragging.native.js +130 -0
- package/build/components/block-draggable/use-scroll-when-dragging.native.js.map +1 -0
- package/build/components/block-list/block-list-context.native.js +195 -0
- package/build/components/block-list/block-list-context.native.js.map +1 -0
- package/build/components/block-list/block-list-item-cell.native.js +67 -0
- package/build/components/block-list/block-list-item-cell.native.js.map +1 -0
- package/build/components/block-list/block-list-item.native.js +12 -9
- package/build/components/block-list/block-list-item.native.js.map +1 -1
- package/build/components/block-list/block.native.js +26 -5
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-list/index.native.js +75 -23
- package/build/components/block-list/index.native.js.map +1 -1
- package/build/components/block-list/use-block-props/index.js +8 -4
- package/build/components/block-list/use-block-props/index.js.map +1 -1
- package/build/components/block-list/use-in-between-inserter.js +1 -1
- package/build/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build/components/block-mobile-toolbar/index.native.js +9 -3
- package/build/components/block-mobile-toolbar/index.native.js.map +1 -1
- package/build/components/block-mover/index.native.js +17 -4
- package/build/components/block-mover/index.native.js.map +1 -1
- package/build/components/block-popover/inbetween.js +10 -2
- package/build/components/block-popover/inbetween.js.map +1 -1
- package/build/components/block-popover/index.js +4 -16
- package/build/components/block-popover/index.js.map +1 -1
- package/build/components/block-preview/index.js +1 -1
- package/build/components/block-preview/index.js.map +1 -1
- package/build/components/block-tools/selected-block-popover.js +1 -29
- package/build/components/block-tools/selected-block-popover.js.map +1 -1
- package/build/components/border-radius-control/input-controls.js +10 -3
- package/build/components/border-radius-control/input-controls.js.map +1 -1
- package/build/components/colors-gradients/dropdown.js +149 -44
- package/build/components/colors-gradients/dropdown.js.map +1 -1
- package/build/components/iframe/index.js +51 -50
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/image-editor/use-save-image.js +3 -1
- package/build/components/image-editor/use-save-image.js.map +1 -1
- package/build/components/index.js +5 -14
- package/build/components/index.js.map +1 -1
- package/build/components/inserter/index.native.js +1 -1
- package/build/components/inserter/index.native.js.map +1 -1
- package/build/components/link-control/constants.js +11 -1
- package/build/components/link-control/constants.js.map +1 -1
- package/build/components/link-control/search-results.js +4 -3
- package/build/components/link-control/search-results.js.map +1 -1
- package/build/components/link-control/use-search-handler.js +4 -4
- package/build/components/link-control/use-search-handler.js.map +1 -1
- package/build/components/list-view/drop-indicator.js +0 -1
- package/build/components/list-view/drop-indicator.js.map +1 -1
- package/build/components/navigable-toolbar/index.js +12 -2
- package/build/components/navigable-toolbar/index.js.map +1 -1
- package/build/components/rich-text/format-toolbar-container.js +0 -1
- package/build/components/rich-text/format-toolbar-container.js.map +1 -1
- package/build/components/rich-text/index.js +1 -1
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/url-input/index.js +4 -1
- package/build/components/url-input/index.js.map +1 -1
- package/build/components/use-block-drop-zone/index.native.js +167 -0
- package/build/components/use-block-drop-zone/index.native.js.map +1 -0
- package/build/components/use-on-block-drop/index.native.js +95 -0
- package/build/components/use-on-block-drop/index.native.js.map +1 -0
- package/build/components/warning/index.js +6 -1
- package/build/components/warning/index.js.map +1 -1
- package/build/hooks/anchor.js.map +1 -1
- package/build/hooks/border.js +2 -7
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/color-panel.js +14 -7
- package/build/hooks/color-panel.js.map +1 -1
- package/build/hooks/style.js +14 -13
- package/build/hooks/style.js.map +1 -1
- package/build/hooks/typography.js +6 -2
- package/build/hooks/typography.js.map +1 -1
- package/build-module/components/block-alignment-matrix-control/index.js +1 -6
- package/build-module/components/block-alignment-matrix-control/index.js.map +1 -1
- package/build-module/components/block-content-overlay/index.js +3 -78
- package/build-module/components/block-content-overlay/index.js.map +1 -1
- package/build-module/components/block-draggable/draggable-chip.native.js +50 -0
- package/build-module/components/block-draggable/draggable-chip.native.js.map +1 -0
- package/build-module/components/block-draggable/dropping-insertion-point.native.js +137 -0
- package/build-module/components/block-draggable/dropping-insertion-point.native.js.map +1 -0
- package/build-module/components/block-draggable/index.native.js +449 -0
- package/build-module/components/block-draggable/index.native.js.map +1 -0
- package/build-module/components/block-draggable/use-scroll-when-dragging.native.js +120 -0
- package/build-module/components/block-draggable/use-scroll-when-dragging.native.js.map +1 -0
- package/build-module/components/block-list/block-list-context.native.js +179 -0
- package/build-module/components/block-list/block-list-context.native.js.map +1 -0
- package/build-module/components/block-list/block-list-item-cell.native.js +59 -0
- package/build-module/components/block-list/block-list-item-cell.native.js.map +1 -0
- package/build-module/components/block-list/block-list-item.native.js +12 -9
- package/build-module/components/block-list/block-list-item.native.js.map +1 -1
- package/build-module/components/block-list/block.native.js +25 -5
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-list/index.native.js +72 -23
- package/build-module/components/block-list/index.native.js.map +1 -1
- package/build-module/components/block-list/use-block-props/index.js +9 -5
- package/build-module/components/block-list/use-block-props/index.js.map +1 -1
- package/build-module/components/block-list/use-in-between-inserter.js +1 -1
- package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build-module/components/block-mobile-toolbar/index.native.js +8 -3
- package/build-module/components/block-mobile-toolbar/index.native.js.map +1 -1
- package/build-module/components/block-mover/index.native.js +18 -5
- package/build-module/components/block-mover/index.native.js.map +1 -1
- package/build-module/components/block-popover/inbetween.js +10 -2
- package/build-module/components/block-popover/inbetween.js.map +1 -1
- package/build-module/components/block-popover/index.js +4 -15
- package/build-module/components/block-popover/index.js.map +1 -1
- package/build-module/components/block-preview/index.js +1 -1
- package/build-module/components/block-preview/index.js.map +1 -1
- package/build-module/components/block-tools/selected-block-popover.js +2 -29
- package/build-module/components/block-tools/selected-block-popover.js.map +1 -1
- package/build-module/components/border-radius-control/input-controls.js +11 -4
- package/build-module/components/border-radius-control/input-controls.js.map +1 -1
- package/build-module/components/colors-gradients/dropdown.js +151 -46
- package/build-module/components/colors-gradients/dropdown.js.map +1 -1
- package/build-module/components/iframe/index.js +52 -51
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/image-editor/use-save-image.js +2 -1
- package/build-module/components/image-editor/use-save-image.js.map +1 -1
- package/build-module/components/index.js +1 -2
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/inserter/index.native.js +1 -1
- package/build-module/components/inserter/index.native.js.map +1 -1
- package/build-module/components/link-control/constants.js +5 -0
- package/build-module/components/link-control/constants.js.map +1 -1
- package/build-module/components/link-control/search-results.js +3 -4
- package/build-module/components/link-control/search-results.js.map +1 -1
- package/build-module/components/link-control/use-search-handler.js +5 -5
- package/build-module/components/link-control/use-search-handler.js.map +1 -1
- package/build-module/components/list-view/drop-indicator.js +0 -1
- package/build-module/components/list-view/drop-indicator.js.map +1 -1
- package/build-module/components/navigable-toolbar/index.js +12 -2
- package/build-module/components/navigable-toolbar/index.js.map +1 -1
- package/build-module/components/rich-text/format-toolbar-container.js +0 -1
- package/build-module/components/rich-text/format-toolbar-container.js.map +1 -1
- package/build-module/components/rich-text/index.js +1 -1
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/url-input/index.js +4 -1
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/components/use-block-drop-zone/index.native.js +148 -0
- package/build-module/components/use-block-drop-zone/index.native.js.map +1 -0
- package/build-module/components/use-on-block-drop/index.native.js +83 -0
- package/build-module/components/use-on-block-drop/index.native.js.map +1 -0
- package/build-module/components/warning/index.js +6 -1
- package/build-module/components/warning/index.js.map +1 -1
- package/build-module/hooks/anchor.js.map +1 -1
- package/build-module/hooks/border.js +2 -7
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/color-panel.js +11 -6
- package/build-module/hooks/color-panel.js.map +1 -1
- package/build-module/hooks/style.js +15 -14
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/hooks/typography.js +6 -2
- package/build-module/hooks/typography.js.map +1 -1
- package/build-style/style-rtl.css +60 -174
- package/build-style/style.css +60 -174
- package/package.json +28 -28
- package/src/components/block-alignment-matrix-control/index.js +1 -5
- package/src/components/block-content-overlay/index.js +8 -95
- package/src/components/block-content-overlay/style.scss +2 -11
- package/src/components/block-draggable/draggable-chip.native.js +49 -0
- package/src/components/block-draggable/dropping-insertion-point.native.js +181 -0
- package/src/components/block-draggable/dropping-insertion-point.native.scss +8 -0
- package/src/components/block-draggable/index.native.js +458 -0
- package/src/components/block-draggable/style.native.scss +19 -0
- package/src/components/block-draggable/use-scroll-when-dragging.native.js +135 -0
- package/src/components/block-list/block-list-context.native.js +175 -0
- package/src/components/block-list/block-list-item-cell.native.js +49 -0
- package/src/components/block-list/block-list-item.native.js +7 -11
- package/src/components/block-list/block.native.js +36 -8
- package/src/components/block-list/index.native.js +54 -13
- package/src/components/block-list/test/block-list-context.native.js +253 -0
- package/src/components/block-list/test/fixtures/block-list-context.native.js +79 -0
- package/src/components/block-list/use-block-props/index.js +10 -5
- package/src/components/block-list/use-in-between-inserter.js +1 -1
- package/src/components/block-mobile-toolbar/index.native.js +8 -1
- package/src/components/block-mover/index.native.js +22 -6
- package/src/components/block-mover/test/__snapshots__/index.native.js.snap +6 -0
- package/src/components/block-popover/inbetween.js +9 -1
- package/src/components/block-popover/index.js +1 -16
- package/src/components/block-popover/style.scss +1 -0
- package/src/components/block-preview/index.js +1 -4
- package/src/components/block-switcher/style.scss +2 -39
- package/src/components/block-tools/selected-block-popover.js +1 -36
- package/src/components/block-tools/style.scss +1 -12
- package/src/components/border-radius-control/input-controls.js +16 -8
- package/src/components/border-radius-control/style.scss +3 -2
- package/src/components/colors-gradients/dropdown.js +156 -62
- package/src/components/colors-gradients/style.scss +51 -23
- package/src/components/duotone-control/style.scss +1 -7
- package/src/components/iframe/index.js +62 -54
- package/src/components/image-editor/use-save-image.js +2 -1
- package/src/components/index.js +1 -2
- package/src/components/inserter/index.native.js +1 -1
- package/src/components/inserter/style.scss +2 -1
- package/src/components/link-control/constants.js +11 -0
- package/src/components/link-control/search-results.js +4 -5
- package/src/components/link-control/use-search-handler.js +11 -5
- package/src/components/list-view/drop-indicator.js +0 -1
- package/src/components/list-view/style.scss +2 -1
- package/src/components/navigable-toolbar/index.js +12 -2
- package/src/components/preview-options/style.scss +0 -4
- package/src/components/rich-text/format-toolbar-container.js +0 -1
- package/src/components/rich-text/index.js +1 -1
- package/src/components/rich-text/style.scss +2 -8
- package/src/components/url-input/index.js +3 -1
- package/src/components/use-block-drop-zone/index.native.js +173 -0
- package/src/components/use-on-block-drop/index.native.js +119 -0
- package/src/components/warning/index.js +47 -42
- package/src/components/warning/test/__snapshots__/index.js.snap +15 -6
- package/src/components/warning/test/index.js +1 -1
- package/src/hooks/anchor.js +1 -1
- package/src/hooks/border.js +2 -11
- package/src/hooks/border.scss +0 -48
- package/src/hooks/color-panel.js +13 -9
- package/src/hooks/color.scss +0 -62
- package/src/hooks/style.js +25 -39
- package/src/hooks/typography.js +2 -0
- package/src/style.scss +0 -1
- package/build/components/colors-gradients/tools-panel-color-dropdown.js +0 -89
- package/build/components/colors-gradients/tools-panel-color-dropdown.js.map +0 -1
- package/build-module/components/colors-gradients/tools-panel-color-dropdown.js +0 -75
- package/build-module/components/colors-gradients/tools-panel-color-dropdown.js.map +0 -1
- package/src/components/block-alignment-matrix-control/style.scss +0 -10
- package/src/components/colors-gradients/tools-panel-color-dropdown.js +0 -85
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { cloneDeep } from 'lodash';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import {
|
|
10
|
+
DEFAULT_BLOCK_LIST_CONTEXT,
|
|
11
|
+
deleteBlockLayoutByClientId,
|
|
12
|
+
} from '../block-list-context.native';
|
|
13
|
+
import {
|
|
14
|
+
BLOCKS_LAYOUTS_DATA,
|
|
15
|
+
DEEP_NESTED_ID,
|
|
16
|
+
GROUP_BLOCK_LAYOUT_DATA,
|
|
17
|
+
NESTED_WITH_INNER_BLOCKS_ID,
|
|
18
|
+
PARAGRAPH_BLOCK_LAYOUT_DATA,
|
|
19
|
+
ROOT_LEVEL_ID,
|
|
20
|
+
} from './fixtures/block-list-context.native';
|
|
21
|
+
|
|
22
|
+
describe( 'findBlockLayoutByClientId', () => {
|
|
23
|
+
it( "finds a block's layout data at root level", () => {
|
|
24
|
+
const { findBlockLayoutByClientId } = DEFAULT_BLOCK_LIST_CONTEXT;
|
|
25
|
+
const currentBlockLayouts = BLOCKS_LAYOUTS_DATA;
|
|
26
|
+
|
|
27
|
+
const blockRootLevel = findBlockLayoutByClientId(
|
|
28
|
+
currentBlockLayouts,
|
|
29
|
+
ROOT_LEVEL_ID
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
expect( blockRootLevel ).toEqual(
|
|
33
|
+
expect.objectContaining( { clientId: ROOT_LEVEL_ID } )
|
|
34
|
+
);
|
|
35
|
+
} );
|
|
36
|
+
|
|
37
|
+
it( "finds a nested block's layout data with inner blocks", () => {
|
|
38
|
+
const { findBlockLayoutByClientId } = DEFAULT_BLOCK_LIST_CONTEXT;
|
|
39
|
+
const currentBlockLayouts = BLOCKS_LAYOUTS_DATA;
|
|
40
|
+
|
|
41
|
+
const nestedBlock = findBlockLayoutByClientId(
|
|
42
|
+
currentBlockLayouts,
|
|
43
|
+
NESTED_WITH_INNER_BLOCKS_ID
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
expect( nestedBlock ).toEqual(
|
|
47
|
+
expect.objectContaining( { clientId: NESTED_WITH_INNER_BLOCKS_ID } )
|
|
48
|
+
);
|
|
49
|
+
} );
|
|
50
|
+
|
|
51
|
+
it( "finds a deep nested block's layout data", () => {
|
|
52
|
+
const { findBlockLayoutByClientId } = DEFAULT_BLOCK_LIST_CONTEXT;
|
|
53
|
+
const currentBlockLayouts = BLOCKS_LAYOUTS_DATA;
|
|
54
|
+
|
|
55
|
+
const deepNestedBlock = findBlockLayoutByClientId(
|
|
56
|
+
currentBlockLayouts,
|
|
57
|
+
DEEP_NESTED_ID
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
expect( deepNestedBlock ).toEqual(
|
|
61
|
+
expect.objectContaining( { clientId: DEEP_NESTED_ID } )
|
|
62
|
+
);
|
|
63
|
+
} );
|
|
64
|
+
} );
|
|
65
|
+
|
|
66
|
+
describe( 'deleteBlockLayoutByClientId', () => {
|
|
67
|
+
it( "deletes a block's layout data at root level", () => {
|
|
68
|
+
const { findBlockLayoutByClientId } = DEFAULT_BLOCK_LIST_CONTEXT;
|
|
69
|
+
const defaultBlockLayouts = cloneDeep( BLOCKS_LAYOUTS_DATA );
|
|
70
|
+
const currentBlockLayouts = deleteBlockLayoutByClientId(
|
|
71
|
+
defaultBlockLayouts,
|
|
72
|
+
ROOT_LEVEL_ID
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
const findDeletedBlock = findBlockLayoutByClientId(
|
|
76
|
+
currentBlockLayouts,
|
|
77
|
+
ROOT_LEVEL_ID
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
expect( findDeletedBlock ).toBeNull();
|
|
81
|
+
} );
|
|
82
|
+
|
|
83
|
+
it( "deletes a nested block's layout data with inner blocks", () => {
|
|
84
|
+
const { findBlockLayoutByClientId } = DEFAULT_BLOCK_LIST_CONTEXT;
|
|
85
|
+
const defaultBlockLayouts = cloneDeep( BLOCKS_LAYOUTS_DATA );
|
|
86
|
+
const currentBlockLayouts = deleteBlockLayoutByClientId(
|
|
87
|
+
defaultBlockLayouts,
|
|
88
|
+
NESTED_WITH_INNER_BLOCKS_ID
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
const findDeletedBlock = findBlockLayoutByClientId(
|
|
92
|
+
currentBlockLayouts,
|
|
93
|
+
NESTED_WITH_INNER_BLOCKS_ID
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
expect( findDeletedBlock ).toBeNull();
|
|
97
|
+
} );
|
|
98
|
+
|
|
99
|
+
it( "deletes a deep nested block's layout data", () => {
|
|
100
|
+
const { findBlockLayoutByClientId } = DEFAULT_BLOCK_LIST_CONTEXT;
|
|
101
|
+
const defaultBlockLayouts = cloneDeep( BLOCKS_LAYOUTS_DATA );
|
|
102
|
+
const currentBlockLayouts = deleteBlockLayoutByClientId(
|
|
103
|
+
defaultBlockLayouts,
|
|
104
|
+
DEEP_NESTED_ID
|
|
105
|
+
);
|
|
106
|
+
|
|
107
|
+
const findDeletedBlock = findBlockLayoutByClientId(
|
|
108
|
+
currentBlockLayouts,
|
|
109
|
+
DEEP_NESTED_ID
|
|
110
|
+
);
|
|
111
|
+
|
|
112
|
+
expect( findDeletedBlock ).toBeNull();
|
|
113
|
+
} );
|
|
114
|
+
} );
|
|
115
|
+
|
|
116
|
+
describe( 'updateBlocksLayouts', () => {
|
|
117
|
+
it( "adds a new block's layout data at root level with an empty object", () => {
|
|
118
|
+
const {
|
|
119
|
+
blocksLayouts,
|
|
120
|
+
findBlockLayoutByClientId,
|
|
121
|
+
updateBlocksLayouts,
|
|
122
|
+
} = DEFAULT_BLOCK_LIST_CONTEXT;
|
|
123
|
+
const currentBlockLayouts = cloneDeep( blocksLayouts );
|
|
124
|
+
const BLOCK_CLIENT_ID = PARAGRAPH_BLOCK_LAYOUT_DATA.clientId;
|
|
125
|
+
|
|
126
|
+
updateBlocksLayouts( currentBlockLayouts, PARAGRAPH_BLOCK_LAYOUT_DATA );
|
|
127
|
+
|
|
128
|
+
const findAddedBlock = findBlockLayoutByClientId(
|
|
129
|
+
currentBlockLayouts.current,
|
|
130
|
+
BLOCK_CLIENT_ID
|
|
131
|
+
);
|
|
132
|
+
|
|
133
|
+
expect( findAddedBlock ).toEqual(
|
|
134
|
+
expect.objectContaining( {
|
|
135
|
+
clientId: BLOCK_CLIENT_ID,
|
|
136
|
+
rootClientId: undefined,
|
|
137
|
+
} )
|
|
138
|
+
);
|
|
139
|
+
} );
|
|
140
|
+
|
|
141
|
+
it( "adds a new block's layout data at root level with inner blocks", () => {
|
|
142
|
+
const {
|
|
143
|
+
findBlockLayoutByClientId,
|
|
144
|
+
updateBlocksLayouts,
|
|
145
|
+
} = DEFAULT_BLOCK_LIST_CONTEXT;
|
|
146
|
+
const currentBlockLayouts = {
|
|
147
|
+
current: cloneDeep( BLOCKS_LAYOUTS_DATA ),
|
|
148
|
+
};
|
|
149
|
+
const PARENT_BLOCK_CLIENT_ID = GROUP_BLOCK_LAYOUT_DATA.clientId;
|
|
150
|
+
|
|
151
|
+
// Add parent block
|
|
152
|
+
updateBlocksLayouts( currentBlockLayouts, GROUP_BLOCK_LAYOUT_DATA );
|
|
153
|
+
|
|
154
|
+
const findAddedParentBlock = findBlockLayoutByClientId(
|
|
155
|
+
currentBlockLayouts.current,
|
|
156
|
+
PARENT_BLOCK_CLIENT_ID
|
|
157
|
+
);
|
|
158
|
+
|
|
159
|
+
expect( findAddedParentBlock ).toEqual(
|
|
160
|
+
expect.objectContaining( { clientId: PARENT_BLOCK_CLIENT_ID } )
|
|
161
|
+
);
|
|
162
|
+
|
|
163
|
+
// Add inner block to it's parent
|
|
164
|
+
updateBlocksLayouts( currentBlockLayouts, {
|
|
165
|
+
...PARAGRAPH_BLOCK_LAYOUT_DATA,
|
|
166
|
+
rootClientId: PARENT_BLOCK_CLIENT_ID,
|
|
167
|
+
} );
|
|
168
|
+
|
|
169
|
+
const findAddedInnerBlock = findBlockLayoutByClientId(
|
|
170
|
+
currentBlockLayouts.current,
|
|
171
|
+
PARAGRAPH_BLOCK_LAYOUT_DATA.clientId
|
|
172
|
+
);
|
|
173
|
+
|
|
174
|
+
expect( findAddedInnerBlock ).toEqual(
|
|
175
|
+
expect.objectContaining( {
|
|
176
|
+
clientId: PARAGRAPH_BLOCK_LAYOUT_DATA.clientId,
|
|
177
|
+
rootClientId: PARENT_BLOCK_CLIENT_ID,
|
|
178
|
+
} )
|
|
179
|
+
);
|
|
180
|
+
} );
|
|
181
|
+
|
|
182
|
+
it( "adds a new block's layout data at deep level", () => {
|
|
183
|
+
const {
|
|
184
|
+
findBlockLayoutByClientId,
|
|
185
|
+
updateBlocksLayouts,
|
|
186
|
+
} = DEFAULT_BLOCK_LIST_CONTEXT;
|
|
187
|
+
const currentBlockLayouts = {
|
|
188
|
+
current: cloneDeep( BLOCKS_LAYOUTS_DATA ),
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
// Add block layout data to it's parents inner blocks
|
|
192
|
+
updateBlocksLayouts( currentBlockLayouts, {
|
|
193
|
+
...PARAGRAPH_BLOCK_LAYOUT_DATA,
|
|
194
|
+
rootClientId: NESTED_WITH_INNER_BLOCKS_ID,
|
|
195
|
+
} );
|
|
196
|
+
|
|
197
|
+
const findAddedInnerBlock = findBlockLayoutByClientId(
|
|
198
|
+
currentBlockLayouts.current,
|
|
199
|
+
PARAGRAPH_BLOCK_LAYOUT_DATA.clientId
|
|
200
|
+
);
|
|
201
|
+
|
|
202
|
+
expect( findAddedInnerBlock ).toEqual(
|
|
203
|
+
expect.objectContaining( {
|
|
204
|
+
clientId: PARAGRAPH_BLOCK_LAYOUT_DATA.clientId,
|
|
205
|
+
rootClientId: NESTED_WITH_INNER_BLOCKS_ID,
|
|
206
|
+
} )
|
|
207
|
+
);
|
|
208
|
+
} );
|
|
209
|
+
|
|
210
|
+
it( "deletes a block's layout data at root level", () => {
|
|
211
|
+
const {
|
|
212
|
+
findBlockLayoutByClientId,
|
|
213
|
+
updateBlocksLayouts,
|
|
214
|
+
} = DEFAULT_BLOCK_LIST_CONTEXT;
|
|
215
|
+
const currentBlockLayouts = {
|
|
216
|
+
current: cloneDeep( BLOCKS_LAYOUTS_DATA ),
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
updateBlocksLayouts( currentBlockLayouts, {
|
|
220
|
+
shouldRemove: true,
|
|
221
|
+
clientId: ROOT_LEVEL_ID,
|
|
222
|
+
} );
|
|
223
|
+
|
|
224
|
+
const findDeletedBlock = findBlockLayoutByClientId(
|
|
225
|
+
currentBlockLayouts.current,
|
|
226
|
+
ROOT_LEVEL_ID
|
|
227
|
+
);
|
|
228
|
+
|
|
229
|
+
expect( findDeletedBlock ).toBeNull();
|
|
230
|
+
} );
|
|
231
|
+
|
|
232
|
+
it( "deletes a block's layout data at a deep level", () => {
|
|
233
|
+
const {
|
|
234
|
+
findBlockLayoutByClientId,
|
|
235
|
+
updateBlocksLayouts,
|
|
236
|
+
} = DEFAULT_BLOCK_LIST_CONTEXT;
|
|
237
|
+
const currentBlockLayouts = {
|
|
238
|
+
current: cloneDeep( BLOCKS_LAYOUTS_DATA ),
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
updateBlocksLayouts( currentBlockLayouts, {
|
|
242
|
+
shouldRemove: true,
|
|
243
|
+
clientId: DEEP_NESTED_ID,
|
|
244
|
+
} );
|
|
245
|
+
|
|
246
|
+
const findDeletedBlock = findBlockLayoutByClientId(
|
|
247
|
+
currentBlockLayouts.current,
|
|
248
|
+
DEEP_NESTED_ID
|
|
249
|
+
);
|
|
250
|
+
|
|
251
|
+
expect( findDeletedBlock ).toBeNull();
|
|
252
|
+
} );
|
|
253
|
+
} );
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
export const ROOT_LEVEL_ID = 'e59528f8-fb35-4ec1-aec6-5a065c236fa1';
|
|
2
|
+
export const ROOT_LEVEL_WITH_INNER_BLOCKS_ID =
|
|
3
|
+
'72a9220f-4c3d-4b00-bae1-4506513f63d8';
|
|
4
|
+
export const NESTED_WITH_INNER_BLOCKS_ID =
|
|
5
|
+
'9f3d1f1e-df85-485d-af63-dc8cb1b93cbc';
|
|
6
|
+
export const DEEP_NESTED_ID = 'abec845a-e4de-43fb-96f7-80dc3d51ad7a';
|
|
7
|
+
|
|
8
|
+
export const BLOCKS_LAYOUTS_DATA = {
|
|
9
|
+
[ ROOT_LEVEL_ID ]: {
|
|
10
|
+
clientId: ROOT_LEVEL_ID,
|
|
11
|
+
width: 390,
|
|
12
|
+
height: 54,
|
|
13
|
+
x: 0,
|
|
14
|
+
y: 83,
|
|
15
|
+
innerBlocks: {},
|
|
16
|
+
},
|
|
17
|
+
[ ROOT_LEVEL_WITH_INNER_BLOCKS_ID ]: {
|
|
18
|
+
clientId: ROOT_LEVEL_WITH_INNER_BLOCKS_ID,
|
|
19
|
+
width: 390,
|
|
20
|
+
height: 386,
|
|
21
|
+
x: 0,
|
|
22
|
+
y: 137,
|
|
23
|
+
innerBlocks: {
|
|
24
|
+
'62839858-48b0-44ed-b834-1343a1357e54': {
|
|
25
|
+
clientId: '62839858-48b0-44ed-b834-1343a1357e54',
|
|
26
|
+
rootClientId: ROOT_LEVEL_WITH_INNER_BLOCKS_ID,
|
|
27
|
+
width: 390,
|
|
28
|
+
height: 54,
|
|
29
|
+
x: 0,
|
|
30
|
+
y: 0,
|
|
31
|
+
innerBlocks: {},
|
|
32
|
+
},
|
|
33
|
+
[ NESTED_WITH_INNER_BLOCKS_ID ]: {
|
|
34
|
+
clientId: NESTED_WITH_INNER_BLOCKS_ID,
|
|
35
|
+
rootClientId: ROOT_LEVEL_WITH_INNER_BLOCKS_ID,
|
|
36
|
+
width: 390,
|
|
37
|
+
height: 332,
|
|
38
|
+
x: 0,
|
|
39
|
+
y: 54,
|
|
40
|
+
innerBlocks: {
|
|
41
|
+
'435d62a4-afa7-457c-a894-b04390d7b447': {
|
|
42
|
+
clientId: '435d62a4-afa7-457c-a894-b04390d7b447',
|
|
43
|
+
rootClientId: NESTED_WITH_INNER_BLOCKS_ID,
|
|
44
|
+
width: 358,
|
|
45
|
+
height: 54,
|
|
46
|
+
x: 0,
|
|
47
|
+
y: 0,
|
|
48
|
+
innerBlocks: {},
|
|
49
|
+
},
|
|
50
|
+
[ DEEP_NESTED_ID ]: {
|
|
51
|
+
clientId: DEEP_NESTED_ID,
|
|
52
|
+
rootClientId: NESTED_WITH_INNER_BLOCKS_ID,
|
|
53
|
+
width: 358,
|
|
54
|
+
height: 98,
|
|
55
|
+
x: 0,
|
|
56
|
+
y: 54,
|
|
57
|
+
innerBlocks: {},
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export const PARAGRAPH_BLOCK_LAYOUT_DATA = {
|
|
66
|
+
clientId: '22dda04f-4718-45b2-8cd2-36cedb9eae4d',
|
|
67
|
+
width: 390,
|
|
68
|
+
height: 98,
|
|
69
|
+
x: 0,
|
|
70
|
+
y: 83,
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export const GROUP_BLOCK_LAYOUT_DATA = {
|
|
74
|
+
clientId: 'e18249d9-ec06-4f54-b71e-6ec59be5213e',
|
|
75
|
+
width: 390,
|
|
76
|
+
height: 164,
|
|
77
|
+
x: 0,
|
|
78
|
+
y: 83,
|
|
79
|
+
};
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
__unstableGetBlockProps as getBlockProps,
|
|
13
13
|
getBlockType,
|
|
14
14
|
} from '@wordpress/blocks';
|
|
15
|
-
import { useMergeRefs } from '@wordpress/compose';
|
|
15
|
+
import { useMergeRefs, useDisabled } from '@wordpress/compose';
|
|
16
16
|
import { useSelect } from '@wordpress/data';
|
|
17
17
|
import warning from '@wordpress/warning';
|
|
18
18
|
|
|
@@ -50,14 +50,18 @@ const BLOCK_ANIMATION_THRESHOLD = 200;
|
|
|
50
50
|
* also pass any other props through this hook, and they will be merged and
|
|
51
51
|
* returned.
|
|
52
52
|
*
|
|
53
|
-
* @param {Object} props
|
|
54
|
-
*
|
|
55
|
-
* @param {Object} options
|
|
53
|
+
* @param {Object} props Optional. Props to pass to the element. Must contain
|
|
54
|
+
* the ref if one is defined.
|
|
55
|
+
* @param {Object} options Options for internal use only.
|
|
56
56
|
* @param {boolean} options.__unstableIsHtml
|
|
57
|
+
* @param {boolean} options.__unstableIsDisabled Whether the block should be disabled.
|
|
57
58
|
*
|
|
58
59
|
* @return {Object} Props to pass to the element to mark as a block.
|
|
59
60
|
*/
|
|
60
|
-
export function useBlockProps(
|
|
61
|
+
export function useBlockProps(
|
|
62
|
+
props = {},
|
|
63
|
+
{ __unstableIsHtml, __unstableIsDisabled = false } = {}
|
|
64
|
+
) {
|
|
61
65
|
const { clientId, className, wrapperProps = {}, isAligned } = useContext(
|
|
62
66
|
BlockListBlockContext
|
|
63
67
|
);
|
|
@@ -125,6 +129,7 @@ export function useBlockProps( props = {}, { __unstableIsHtml } = {} ) {
|
|
|
125
129
|
enableAnimation,
|
|
126
130
|
triggerAnimationOnChange: index,
|
|
127
131
|
} ),
|
|
132
|
+
useDisabled( { isDisabled: ! __unstableIsDisabled } ),
|
|
128
133
|
] );
|
|
129
134
|
|
|
130
135
|
const blockEditContext = useBlockEditContext();
|
|
@@ -110,7 +110,7 @@ export function useInBetweenInserter() {
|
|
|
110
110
|
// Don't show the insertion point if a parent block has an "overlay"
|
|
111
111
|
// See https://github.com/WordPress/gutenberg/pull/34012#pullrequestreview-727762337
|
|
112
112
|
const parentOverlay = element.parentElement?.closest(
|
|
113
|
-
'.block-editor-block-content-overlay
|
|
113
|
+
'.block-editor-block-content-overlay'
|
|
114
114
|
);
|
|
115
115
|
if ( parentOverlay ) {
|
|
116
116
|
return;
|
|
@@ -15,6 +15,7 @@ import { useState, useEffect } from '@wordpress/element';
|
|
|
15
15
|
*/
|
|
16
16
|
import styles from './style.scss';
|
|
17
17
|
import BlockMover from '../block-mover';
|
|
18
|
+
import BlockDraggable from '../block-draggable';
|
|
18
19
|
import BlockActionsMenu from './block-actions-menu';
|
|
19
20
|
import { BlockSettingsButton } from '../block-settings';
|
|
20
21
|
import { store as blockEditorStore } from '../../store';
|
|
@@ -33,6 +34,7 @@ const BlockMobileToolbar = ( {
|
|
|
33
34
|
blockWidth,
|
|
34
35
|
anchorNodeRef,
|
|
35
36
|
isFullWidth,
|
|
37
|
+
draggingClientId,
|
|
36
38
|
} ) => {
|
|
37
39
|
const [ fillsLength, setFillsLength ] = useState( null );
|
|
38
40
|
const [ appenderWidth, setAppenderWidth ] = useState( 0 );
|
|
@@ -73,7 +75,12 @@ const BlockMobileToolbar = ( {
|
|
|
73
75
|
/>
|
|
74
76
|
) }
|
|
75
77
|
|
|
76
|
-
<
|
|
78
|
+
<BlockDraggable
|
|
79
|
+
clientId={ clientId }
|
|
80
|
+
draggingClientId={ draggingClientId }
|
|
81
|
+
>
|
|
82
|
+
{ () => <View style={ styles.spacer } /> }
|
|
83
|
+
</BlockDraggable>
|
|
77
84
|
|
|
78
85
|
<BlockSettingsButton.Slot>
|
|
79
86
|
{ /* Render only one settings icon even if we have more than one fill - need for hooks with controls. */ }
|
|
@@ -11,7 +11,7 @@ import { __ } from '@wordpress/i18n';
|
|
|
11
11
|
import { Picker, ToolbarButton } from '@wordpress/components';
|
|
12
12
|
import { withInstanceId, compose } from '@wordpress/compose';
|
|
13
13
|
import { withSelect, withDispatch } from '@wordpress/data';
|
|
14
|
-
import { useRef, useState } from '@wordpress/element';
|
|
14
|
+
import { useCallback, useEffect, useRef, useState } from '@wordpress/element';
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* Internal dependencies
|
|
@@ -36,6 +36,7 @@ export const BlockMover = ( {
|
|
|
36
36
|
isStackedHorizontally,
|
|
37
37
|
} ) => {
|
|
38
38
|
const pickerRef = useRef();
|
|
39
|
+
const [ shouldPresentPicker, setShouldPresentPicker ] = useState( false );
|
|
39
40
|
const [ blockPageMoverState, setBlockPageMoverState ] = useState(
|
|
40
41
|
undefined
|
|
41
42
|
);
|
|
@@ -46,9 +47,17 @@ export const BlockMover = ( {
|
|
|
46
47
|
}
|
|
47
48
|
|
|
48
49
|
setBlockPageMoverState( direction );
|
|
49
|
-
|
|
50
|
+
setShouldPresentPicker( true );
|
|
50
51
|
};
|
|
51
52
|
|
|
53
|
+
// Ensure that the picker is only presented after state updates.
|
|
54
|
+
useEffect( () => {
|
|
55
|
+
if ( shouldPresentPicker ) {
|
|
56
|
+
pickerRef.current?.presentPicker();
|
|
57
|
+
setShouldPresentPicker( false );
|
|
58
|
+
}
|
|
59
|
+
}, [ shouldPresentPicker ] );
|
|
60
|
+
|
|
52
61
|
const {
|
|
53
62
|
description: {
|
|
54
63
|
backwardButtonHint,
|
|
@@ -86,6 +95,15 @@ export const BlockMover = ( {
|
|
|
86
95
|
if ( option && option.onSelect ) option.onSelect();
|
|
87
96
|
};
|
|
88
97
|
|
|
98
|
+
const onLongPressMoveUp = useCallback(
|
|
99
|
+
showBlockPageMover( BLOCK_MOVER_DIRECTION_TOP ),
|
|
100
|
+
[]
|
|
101
|
+
);
|
|
102
|
+
const onLongPressMoveDown = useCallback(
|
|
103
|
+
showBlockPageMover( BLOCK_MOVER_DIRECTION_BOTTOM ),
|
|
104
|
+
[]
|
|
105
|
+
);
|
|
106
|
+
|
|
89
107
|
if ( ! canMove || ( isFirst && isLast && ! rootClientId ) ) {
|
|
90
108
|
return null;
|
|
91
109
|
}
|
|
@@ -96,7 +114,7 @@ export const BlockMover = ( {
|
|
|
96
114
|
title={ ! isFirst ? backwardButtonTitle : firstBlockTitle }
|
|
97
115
|
isDisabled={ isFirst }
|
|
98
116
|
onClick={ onMoveUp }
|
|
99
|
-
onLongPress={
|
|
117
|
+
onLongPress={ onLongPressMoveUp }
|
|
100
118
|
icon={ backwardButtonIcon }
|
|
101
119
|
extraProps={ { hint: backwardButtonHint } }
|
|
102
120
|
/>
|
|
@@ -105,9 +123,7 @@ export const BlockMover = ( {
|
|
|
105
123
|
title={ ! isLast ? forwardButtonTitle : lastBlockTitle }
|
|
106
124
|
isDisabled={ isLast }
|
|
107
125
|
onClick={ onMoveDown }
|
|
108
|
-
onLongPress={
|
|
109
|
-
BLOCK_MOVER_DIRECTION_BOTTOM
|
|
110
|
-
) }
|
|
126
|
+
onLongPress={ onLongPressMoveDown }
|
|
111
127
|
icon={ forwardButtonIcon }
|
|
112
128
|
extraProps={ {
|
|
113
129
|
hint: forwardButtonHint,
|
|
@@ -34,6 +34,9 @@ Array [
|
|
|
34
34
|
}
|
|
35
35
|
>
|
|
36
36
|
<View
|
|
37
|
+
collapsable={false}
|
|
38
|
+
onGestureHandlerEvent={[Function]}
|
|
39
|
+
onGestureHandlerStateChange={[Function]}
|
|
37
40
|
style={
|
|
38
41
|
Object {
|
|
39
42
|
"alignItems": "center",
|
|
@@ -89,6 +92,9 @@ Array [
|
|
|
89
92
|
}
|
|
90
93
|
>
|
|
91
94
|
<View
|
|
95
|
+
collapsable={false}
|
|
96
|
+
onGestureHandlerEvent={[Function]}
|
|
97
|
+
onGestureHandlerStateChange={[Function]}
|
|
92
98
|
style={
|
|
93
99
|
Object {
|
|
94
100
|
"alignItems": "center",
|
|
@@ -107,6 +107,8 @@ function BlockPopoverInbetween( {
|
|
|
107
107
|
left: previousRect ? previousRect.right : nextRect.right,
|
|
108
108
|
right: previousRect ? previousRect.left : nextRect.left,
|
|
109
109
|
bottom: nextRect ? nextRect.top : previousRect.bottom,
|
|
110
|
+
height: 0,
|
|
111
|
+
width: 0,
|
|
110
112
|
ownerDocument,
|
|
111
113
|
};
|
|
112
114
|
}
|
|
@@ -116,6 +118,8 @@ function BlockPopoverInbetween( {
|
|
|
116
118
|
left: previousRect ? previousRect.left : nextRect.left,
|
|
117
119
|
right: previousRect ? previousRect.right : nextRect.right,
|
|
118
120
|
bottom: nextRect ? nextRect.top : previousRect.bottom,
|
|
121
|
+
height: 0,
|
|
122
|
+
width: 0,
|
|
119
123
|
ownerDocument,
|
|
120
124
|
};
|
|
121
125
|
}
|
|
@@ -126,6 +130,8 @@ function BlockPopoverInbetween( {
|
|
|
126
130
|
left: previousRect ? previousRect.left : nextRect.right,
|
|
127
131
|
right: nextRect ? nextRect.right : previousRect.left,
|
|
128
132
|
bottom: previousRect ? previousRect.bottom : nextRect.bottom,
|
|
133
|
+
height: 0,
|
|
134
|
+
width: 0,
|
|
129
135
|
ownerDocument,
|
|
130
136
|
};
|
|
131
137
|
}
|
|
@@ -135,6 +141,8 @@ function BlockPopoverInbetween( {
|
|
|
135
141
|
left: previousRect ? previousRect.right : nextRect.left,
|
|
136
142
|
right: nextRect ? nextRect.left : previousRect.right,
|
|
137
143
|
bottom: previousRect ? previousRect.bottom : nextRect.bottom,
|
|
144
|
+
height: 0,
|
|
145
|
+
width: 0,
|
|
138
146
|
ownerDocument,
|
|
139
147
|
};
|
|
140
148
|
}, [ previousElement, nextElement ] );
|
|
@@ -155,7 +163,6 @@ function BlockPopoverInbetween( {
|
|
|
155
163
|
return (
|
|
156
164
|
<Popover
|
|
157
165
|
ref={ popoverScrollRef }
|
|
158
|
-
noArrow
|
|
159
166
|
animate={ false }
|
|
160
167
|
getAnchorRect={ getAnchorRect }
|
|
161
168
|
focusOnMount={ false }
|
|
@@ -170,6 +177,7 @@ function BlockPopoverInbetween( {
|
|
|
170
177
|
'block-editor-block-popover',
|
|
171
178
|
props.className
|
|
172
179
|
) }
|
|
180
|
+
__unstableForcePosition
|
|
173
181
|
>
|
|
174
182
|
<div style={ style }>{ children }</div>
|
|
175
183
|
</Popover>
|
|
@@ -7,7 +7,6 @@ import classnames from 'classnames';
|
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
9
|
import { Popover } from '@wordpress/components';
|
|
10
|
-
import { getScrollContainer } from '@wordpress/dom';
|
|
11
10
|
import { useMemo } from '@wordpress/element';
|
|
12
11
|
|
|
13
12
|
/**
|
|
@@ -50,33 +49,19 @@ export default function BlockPopover( {
|
|
|
50
49
|
bottom: lastSelectedElement,
|
|
51
50
|
};
|
|
52
51
|
|
|
53
|
-
const { ownerDocument } = selectedElement;
|
|
54
|
-
const stickyBoundaryElement =
|
|
55
|
-
ownerDocument.defaultView.frameElement ||
|
|
56
|
-
getScrollContainer( selectedElement ) ||
|
|
57
|
-
ownerDocument.body;
|
|
58
|
-
|
|
59
52
|
return (
|
|
60
53
|
<Popover
|
|
61
54
|
ref={ popoverScrollRef }
|
|
62
|
-
noArrow
|
|
63
55
|
animate={ false }
|
|
64
56
|
position="top right left"
|
|
65
57
|
focusOnMount={ false }
|
|
66
58
|
anchorRef={ anchorRef }
|
|
67
|
-
__unstableStickyBoundaryElement={
|
|
68
|
-
__unstableCoverTarget ? undefined : stickyBoundaryElement
|
|
69
|
-
}
|
|
70
59
|
// Render in the old slot if needed for backward compatibility,
|
|
71
60
|
// otherwise render in place (not in the the default popover slot).
|
|
72
61
|
__unstableSlotName={ __unstablePopoverSlot || null }
|
|
73
|
-
__unstableBoundaryParent
|
|
74
62
|
// Observe movement for block animations (especially horizontal).
|
|
75
63
|
__unstableObserveElement={ selectedElement }
|
|
76
|
-
|
|
77
|
-
// obscure specific sections of a block.
|
|
78
|
-
__unstableEditorCanvasWrapper={ __unstableContentRef?.current }
|
|
79
|
-
__unstableForcePosition={ __unstableCoverTarget }
|
|
64
|
+
__unstableForcePosition
|
|
80
65
|
{ ...props }
|
|
81
66
|
className={ classnames(
|
|
82
67
|
'block-editor-block-popover',
|
|
@@ -7,10 +7,7 @@ import classnames from 'classnames';
|
|
|
7
7
|
/**
|
|
8
8
|
* WordPress dependencies
|
|
9
9
|
*/
|
|
10
|
-
import {
|
|
11
|
-
__experimentalUseDisabled as useDisabled,
|
|
12
|
-
useMergeRefs,
|
|
13
|
-
} from '@wordpress/compose';
|
|
10
|
+
import { useDisabled, useMergeRefs } from '@wordpress/compose';
|
|
14
11
|
import { useSelect } from '@wordpress/data';
|
|
15
12
|
import { memo, useMemo } from '@wordpress/element';
|
|
16
13
|
|
|
@@ -39,11 +39,6 @@
|
|
|
39
39
|
font-size: 14px;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
// Indent the popover to match the button position.
|
|
43
|
-
.block-editor-block-switcher__popover {
|
|
44
|
-
margin-left: 6px;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
42
|
.components-button.block-editor-block-switcher__no-switcher-icon {
|
|
48
43
|
display: flex;
|
|
49
44
|
|
|
@@ -93,43 +88,11 @@
|
|
|
93
88
|
min-width: 300px;
|
|
94
89
|
}
|
|
95
90
|
|
|
96
|
-
// We keep the min width the same for the border to work.
|
|
97
|
-
.components-popover.block-editor-block-switcher__popover .components-popover__content > div {
|
|
98
|
-
min-width: auto;
|
|
99
|
-
display: flex;
|
|
100
|
-
background: $white;
|
|
101
|
-
padding: 0;
|
|
102
|
-
|
|
103
|
-
.components-menu-group {
|
|
104
|
-
margin: 0;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
.block-editor-block-switcher__popover .components-popover__content {
|
|
109
|
-
|
|
110
|
-
.block-editor-block-styles {
|
|
111
|
-
margin: 0 -3px; // Remove the panel body padding while keeping it for the title.
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
// Hide the bottom border on the last panel so it stacks with the popover.
|
|
115
|
-
.components-panel__body {
|
|
116
|
-
border: 0;
|
|
117
|
-
|
|
118
|
-
// Elevate this so the hover style is visible.
|
|
119
|
-
position: relative;
|
|
120
|
-
z-index: 1;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
.components-panel__body + .components-panel__body {
|
|
124
|
-
border-top: $border-width solid $gray-200;
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
|
|
128
91
|
.block-editor-block-switcher__popover__preview__parent {
|
|
129
92
|
.block-editor-block-switcher__popover__preview__container {
|
|
130
93
|
position: absolute;
|
|
131
94
|
top: -$grid-unit-15;
|
|
132
|
-
left: calc(100% + #{$grid-unit-
|
|
95
|
+
left: calc(100% + #{$grid-unit-20});
|
|
133
96
|
}
|
|
134
97
|
}
|
|
135
98
|
|
|
@@ -138,7 +101,6 @@
|
|
|
138
101
|
|
|
139
102
|
// Position correctly. Needs specificity.
|
|
140
103
|
&.components-popover {
|
|
141
|
-
margin-left: $grid-unit-05;
|
|
142
104
|
margin-top: $grid-unit-15 - $border-width;
|
|
143
105
|
}
|
|
144
106
|
|
|
@@ -151,6 +113,7 @@
|
|
|
151
113
|
border: $border-width solid $gray-900;
|
|
152
114
|
background: $white;
|
|
153
115
|
border-radius: $radius-block-ui;
|
|
116
|
+
outline: none;
|
|
154
117
|
}
|
|
155
118
|
|
|
156
119
|
.block-editor-block-switcher__preview {
|