@wordpress/block-editor 12.0.0 → 12.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 +4 -0
- package/README.md +1 -1
- package/build/components/block-controls/slot.js +12 -4
- package/build/components/block-controls/slot.js.map +1 -1
- package/build/components/block-controls/slot.native.js +10 -1
- package/build/components/block-controls/slot.native.js.map +1 -1
- package/build/components/block-draggable/index.js +11 -7
- package/build/components/block-draggable/index.js.map +1 -1
- package/build/components/block-draggable/use-scroll-when-dragging.js +2 -2
- package/build/components/block-draggable/use-scroll-when-dragging.js.map +1 -1
- package/build/components/block-list/block-invalid-warning.native.js +15 -7
- package/build/components/block-list/block-invalid-warning.native.js.map +1 -1
- package/build/components/block-list/block-list-item-cell.native.js +15 -2
- package/build/components/block-list/block-list-item-cell.native.js.map +1 -1
- package/build/components/block-list/block-list-item.native.js +158 -195
- package/build/components/block-list/block-list-item.native.js.map +1 -1
- package/build/components/block-list/block-outline.native.js +57 -0
- package/build/components/block-list/block-outline.native.js.map +1 -0
- package/build/components/block-list/block.native.js +343 -299
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-list/index.native.js +202 -298
- package/build/components/block-list/index.native.js.map +1 -1
- package/build/components/block-list/insertion-point.native.js +4 -2
- package/build/components/block-list/insertion-point.native.js.map +1 -1
- package/build/components/block-mobile-toolbar/block-actions-menu.native.js +1 -1
- package/build/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +8 -10
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-settings-menu-controls/index.js +15 -4
- package/build/components/block-settings-menu-controls/index.js.map +1 -1
- package/build/components/block-tools/block-contextual-toolbar.js +17 -62
- package/build/components/block-tools/block-contextual-toolbar.js.map +1 -1
- package/build/components/block-tools/selected-block-popover.js +3 -8
- package/build/components/block-tools/selected-block-popover.js.map +1 -1
- package/build/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +3 -2
- package/build/components/colors-gradients/use-multiple-origin-colors-and-gradients.js.map +1 -1
- package/build/components/global-styles/advanced-panel.js +86 -0
- package/build/components/global-styles/advanced-panel.js.map +1 -0
- package/build/components/global-styles/color-panel.js +4 -1
- package/build/components/global-styles/color-panel.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +6 -6
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/hooks.js +1 -2
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/index.js +24 -0
- package/build/components/global-styles/index.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +1 -1
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +27 -4
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js +30 -0
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/image-editor/use-save-image.js +24 -8
- package/build/components/image-editor/use-save-image.js.map +1 -1
- package/build/components/inserter-draggable-blocks/index.js +5 -0
- package/build/components/inserter-draggable-blocks/index.js.map +1 -1
- package/build/components/inspector-controls/fill.js +1 -1
- package/build/components/inspector-controls/fill.js.map +1 -1
- package/build/components/inspector-controls/fill.native.js +1 -1
- package/build/components/inspector-controls/fill.native.js.map +1 -1
- package/build/components/inspector-controls/slot.js +3 -6
- package/build/components/inspector-controls/slot.js.map +1 -1
- package/build/components/inspector-controls/slot.native.js +1 -1
- package/build/components/inspector-controls/slot.native.js.map +1 -1
- package/build/components/line-height-control/index.js +7 -2
- package/build/components/line-height-control/index.js.map +1 -1
- package/build/components/link-control/use-internal-input-value.js +9 -8
- package/build/components/link-control/use-internal-input-value.js.map +1 -1
- package/build/components/list-view/block-contents.js +7 -2
- package/build/components/list-view/block-contents.js.map +1 -1
- package/build/components/list-view/block-select-button.js +2 -1
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/list-view/block.js +4 -4
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/index.js +32 -18
- package/build/components/list-view/index.js.map +1 -1
- package/build/components/list-view/use-list-view-drop-zone.js +163 -11
- package/build/components/list-view/use-list-view-drop-zone.js.map +1 -1
- package/build/components/media-placeholder/index.js +68 -7
- package/build/components/media-placeholder/index.js.map +1 -1
- package/build/components/multi-selection-inspector/index.js +2 -2
- package/build/components/multi-selection-inspector/index.js.map +1 -1
- package/build/components/off-canvas-editor/leaf-more-menu.js +3 -1
- package/build/components/off-canvas-editor/leaf-more-menu.js.map +1 -1
- package/build/components/preview-options/index.js +6 -1
- package/build/components/preview-options/index.js.map +1 -1
- package/build/components/spacing-sizes-control/spacing-input-control.js +1 -1
- package/build/components/spacing-sizes-control/spacing-input-control.js.map +1 -1
- package/build/components/url-input/index.js +1 -2
- package/build/components/url-input/index.js.map +1 -1
- package/build/hooks/align.js +1 -1
- package/build/hooks/align.js.map +1 -1
- package/build/hooks/border.js +1 -1
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/color.js +1 -1
- package/build/hooks/color.js.map +1 -1
- package/build/hooks/content-lock-ui.js +8 -12
- package/build/hooks/content-lock-ui.js.map +1 -1
- package/build/hooks/duotone.js +1 -1
- package/build/hooks/duotone.js.map +1 -1
- package/build/hooks/index.native.js +8 -0
- package/build/hooks/index.native.js.map +1 -1
- package/build/hooks/layout.js +2 -2
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/position.js +1 -1
- package/build/hooks/position.js.map +1 -1
- package/build/hooks/style.js +1 -1
- package/build/hooks/style.js.map +1 -1
- package/build/hooks/use-editor-wrapper-styles.native.js +255 -0
- package/build/hooks/use-editor-wrapper-styles.native.js.map +1 -0
- package/build/hooks/use-typography-props.js +14 -10
- package/build/hooks/use-typography-props.js.map +1 -1
- package/build/index.native.js +31 -0
- package/build/index.native.js.map +1 -0
- package/build/utils/use-should-contextual-toolbar-show.js +16 -12
- package/build/utils/use-should-contextual-toolbar-show.js.map +1 -1
- package/build-module/components/block-controls/slot.js +11 -4
- package/build-module/components/block-controls/slot.js.map +1 -1
- package/build-module/components/block-controls/slot.native.js +9 -1
- package/build-module/components/block-controls/slot.native.js.map +1 -1
- package/build-module/components/block-draggable/index.js +10 -6
- package/build-module/components/block-draggable/index.js.map +1 -1
- package/build-module/components/block-draggable/use-scroll-when-dragging.js +2 -2
- package/build-module/components/block-draggable/use-scroll-when-dragging.js.map +1 -1
- package/build-module/components/block-list/block-invalid-warning.native.js +16 -8
- package/build-module/components/block-list/block-invalid-warning.native.js.map +1 -1
- package/build-module/components/block-list/block-list-item-cell.native.js +13 -2
- package/build-module/components/block-list/block-list-item-cell.native.js.map +1 -1
- package/build-module/components/block-list/block-list-item.native.js +160 -190
- package/build-module/components/block-list/block-list-item.native.js.map +1 -1
- package/build-module/components/block-list/block-outline.native.js +44 -0
- package/build-module/components/block-list/block-outline.native.js.map +1 -0
- package/build-module/components/block-list/block.native.js +341 -298
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-list/index.native.js +203 -293
- package/build-module/components/block-list/index.native.js.map +1 -1
- package/build-module/components/block-list/insertion-point.native.js +4 -2
- package/build-module/components/block-list/insertion-point.native.js.map +1 -1
- package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js +1 -1
- package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +8 -9
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-settings-menu-controls/index.js +13 -5
- package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
- package/build-module/components/block-tools/block-contextual-toolbar.js +18 -62
- package/build-module/components/block-tools/block-contextual-toolbar.js.map +1 -1
- package/build-module/components/block-tools/selected-block-popover.js +3 -7
- package/build-module/components/block-tools/selected-block-popover.js.map +1 -1
- package/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +3 -2
- package/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js.map +1 -1
- package/build-module/components/global-styles/advanced-panel.js +74 -0
- package/build-module/components/global-styles/advanced-panel.js.map +1 -0
- package/build-module/components/global-styles/color-panel.js +5 -2
- package/build-module/components/global-styles/color-panel.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +6 -6
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +1 -2
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/index.js +3 -1
- package/build-module/components/global-styles/index.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +1 -1
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +25 -4
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js +25 -0
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/image-editor/use-save-image.js +24 -8
- package/build-module/components/image-editor/use-save-image.js.map +1 -1
- package/build-module/components/inserter-draggable-blocks/index.js +4 -0
- package/build-module/components/inserter-draggable-blocks/index.js.map +1 -1
- package/build-module/components/inspector-controls/fill.js +1 -1
- package/build-module/components/inspector-controls/fill.js.map +1 -1
- package/build-module/components/inspector-controls/fill.native.js +1 -1
- package/build-module/components/inspector-controls/fill.native.js.map +1 -1
- package/build-module/components/inspector-controls/slot.js +4 -7
- package/build-module/components/inspector-controls/slot.js.map +1 -1
- package/build-module/components/inspector-controls/slot.native.js +1 -1
- package/build-module/components/inspector-controls/slot.native.js.map +1 -1
- package/build-module/components/line-height-control/index.js +7 -2
- package/build-module/components/line-height-control/index.js.map +1 -1
- package/build-module/components/link-control/use-internal-input-value.js +9 -8
- package/build-module/components/link-control/use-internal-input-value.js.map +1 -1
- package/build-module/components/list-view/block-contents.js +7 -3
- package/build-module/components/list-view/block-contents.js.map +1 -1
- package/build-module/components/list-view/block-select-button.js +2 -1
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/list-view/block.js +4 -4
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/index.js +32 -18
- package/build-module/components/list-view/index.js.map +1 -1
- package/build-module/components/list-view/use-list-view-drop-zone.js +160 -11
- package/build-module/components/list-view/use-list-view-drop-zone.js.map +1 -1
- package/build-module/components/media-placeholder/index.js +66 -7
- package/build-module/components/media-placeholder/index.js.map +1 -1
- package/build-module/components/multi-selection-inspector/index.js +2 -2
- package/build-module/components/multi-selection-inspector/index.js.map +1 -1
- package/build-module/components/off-canvas-editor/leaf-more-menu.js +3 -1
- package/build-module/components/off-canvas-editor/leaf-more-menu.js.map +1 -1
- package/build-module/components/preview-options/index.js +7 -2
- package/build-module/components/preview-options/index.js.map +1 -1
- package/build-module/components/spacing-sizes-control/spacing-input-control.js +1 -1
- package/build-module/components/spacing-sizes-control/spacing-input-control.js.map +1 -1
- package/build-module/components/url-input/index.js +1 -2
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/hooks/align.js +1 -1
- package/build-module/hooks/align.js.map +1 -1
- package/build-module/hooks/border.js +1 -1
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/color.js +1 -1
- package/build-module/hooks/color.js.map +1 -1
- package/build-module/hooks/content-lock-ui.js +8 -11
- package/build-module/hooks/content-lock-ui.js.map +1 -1
- package/build-module/hooks/duotone.js +1 -1
- package/build-module/hooks/duotone.js.map +1 -1
- package/build-module/hooks/index.native.js +1 -0
- package/build-module/hooks/index.native.js.map +1 -1
- package/build-module/hooks/layout.js +2 -2
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/hooks/position.js +1 -1
- package/build-module/hooks/position.js.map +1 -1
- package/build-module/hooks/style.js +1 -1
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/hooks/use-editor-wrapper-styles.native.js +242 -0
- package/build-module/hooks/use-editor-wrapper-styles.native.js.map +1 -0
- package/build-module/hooks/use-typography-props.js +14 -10
- package/build-module/hooks/use-typography-props.js.map +1 -1
- package/build-module/index.native.js +6 -0
- package/build-module/index.native.js.map +1 -0
- package/build-module/utils/use-should-contextual-toolbar-show.js +16 -12
- package/build-module/utils/use-should-contextual-toolbar-show.js.map +1 -1
- package/build-style/content-rtl.css +0 -1
- package/build-style/content.css +0 -1
- package/build-style/style-rtl.css +37 -13
- package/build-style/style.css +37 -13
- package/package.json +31 -31
- package/src/components/block-breadcrumb/style.scss +2 -1
- package/src/components/block-controls/slot.js +8 -4
- package/src/components/block-controls/slot.native.js +6 -1
- package/src/components/block-draggable/index.js +10 -6
- package/src/components/block-draggable/use-scroll-when-dragging.js +8 -2
- package/src/components/block-list/block-invalid-warning.native.js +17 -9
- package/src/components/block-list/block-list-item-cell.native.js +10 -1
- package/src/components/block-list/block-list-item.native.js +180 -208
- package/src/components/block-list/block-outline.native.js +58 -0
- package/src/components/block-list/block.native.js +564 -523
- package/src/components/block-list/content.scss +0 -1
- package/src/components/block-list/index.native.js +229 -298
- package/src/components/block-list/insertion-point.native.js +2 -2
- package/src/components/block-list/test/block-invalid-warning.native.js +48 -0
- package/src/components/block-list/test/index.native.js +205 -0
- package/src/components/block-mobile-toolbar/block-actions-menu.native.js +3 -1
- package/src/components/block-pattern-setup/style.scss +1 -4
- package/src/components/block-patterns-list/style.scss +1 -4
- package/src/components/block-settings-menu/block-settings-dropdown.js +10 -17
- package/src/components/block-settings-menu-controls/index.js +24 -4
- package/src/components/block-styles/style.scss +4 -4
- package/src/components/block-tools/block-contextual-toolbar.js +28 -62
- package/src/components/block-tools/selected-block-popover.js +3 -5
- package/src/components/block-tools/style.scss +8 -0
- package/src/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +16 -2
- package/src/components/global-styles/advanced-panel.js +82 -0
- package/src/components/global-styles/color-panel.js +6 -1
- package/src/components/global-styles/dimensions-panel.js +6 -6
- package/src/components/global-styles/hooks.js +1 -5
- package/src/components/global-styles/index.js +6 -1
- package/src/components/global-styles/style.scss +14 -0
- package/src/components/global-styles/test/utils.js +57 -1
- package/src/components/global-styles/typography-panel.js +1 -1
- package/src/components/global-styles/use-global-styles-output.js +21 -3
- package/src/components/global-styles/utils.js +27 -0
- package/src/components/image-editor/use-save-image.js +20 -9
- package/src/components/inserter-draggable-blocks/index.js +4 -0
- package/src/components/inspector-controls/fill.js +1 -1
- package/src/components/inspector-controls/fill.native.js +1 -1
- package/src/components/inspector-controls/slot.js +4 -9
- package/src/components/inspector-controls/slot.native.js +1 -1
- package/src/components/line-height-control/index.js +7 -2
- package/src/components/line-height-control/stories/index.js +1 -1
- package/src/components/link-control/test/index.js +42 -0
- package/src/components/link-control/use-internal-input-value.js +8 -7
- package/src/components/list-view/block-contents.js +26 -20
- package/src/components/list-view/block-select-button.js +5 -1
- package/src/components/list-view/block.js +5 -2
- package/src/components/list-view/index.js +26 -14
- package/src/components/list-view/style.scss +5 -2
- package/src/components/list-view/test/use-list-view-drop-zone.js +88 -12
- package/src/components/list-view/use-list-view-drop-zone.js +194 -11
- package/src/components/media-placeholder/index.js +74 -1
- package/src/components/multi-selection-inspector/index.js +2 -2
- package/src/components/off-canvas-editor/leaf-more-menu.js +2 -1
- package/src/components/preview-options/index.js +9 -2
- package/src/components/spacing-sizes-control/spacing-input-control.js +1 -0
- package/src/components/url-input/index.js +1 -2
- package/src/hooks/align.js +2 -1
- package/src/hooks/border.js +2 -1
- package/src/hooks/color.js +2 -1
- package/src/hooks/content-lock-ui.js +3 -15
- package/src/hooks/duotone.js +1 -0
- package/src/hooks/index.native.js +1 -0
- package/src/hooks/layout.js +4 -2
- package/src/hooks/position.js +2 -1
- package/src/hooks/style.js +2 -1
- package/src/hooks/test/use-editor-wrapper-styles.native.js +282 -0
- package/src/hooks/test/use-typography-props.js +47 -2
- package/src/hooks/use-editor-wrapper-styles.native.js +250 -0
- package/src/hooks/use-editor-wrapper-styles.native.scss +11 -0
- package/src/hooks/use-typography-props.js +10 -11
- package/src/index.native.js +6 -0
- package/src/utils/use-should-contextual-toolbar-show.js +19 -9
- package/tsconfig.json +1 -0
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import {
|
|
5
|
+
fireEvent,
|
|
6
|
+
getBlock,
|
|
7
|
+
getEditorHtml,
|
|
8
|
+
initializeEditor,
|
|
9
|
+
setupCoreBlocks,
|
|
10
|
+
} from 'test/helpers';
|
|
11
|
+
|
|
12
|
+
setupCoreBlocks();
|
|
13
|
+
|
|
14
|
+
describe( 'Block invalid warning', () => {
|
|
15
|
+
it( 'shows invalid placeholder', async () => {
|
|
16
|
+
// Arrange
|
|
17
|
+
const screen = await initializeEditor( {
|
|
18
|
+
initialHtml: `<!-- wp:spacer -->
|
|
19
|
+
<div styless="height:100px" aria-hidden="true" class="wp-block-spacer"></div>
|
|
20
|
+
<!-- /wp:spacer -->`,
|
|
21
|
+
} );
|
|
22
|
+
|
|
23
|
+
// Assert
|
|
24
|
+
const warningElement = screen.getByText( /Problem displaying block./ );
|
|
25
|
+
expect( warningElement ).toBeVisible();
|
|
26
|
+
} );
|
|
27
|
+
|
|
28
|
+
it( 'recovers a block successfully', async () => {
|
|
29
|
+
// Arrange
|
|
30
|
+
const screen = await initializeEditor( {
|
|
31
|
+
initialHtml: `<!-- wp:spacer -->
|
|
32
|
+
<div styless="height:100px" aria-hidden="true" class="wp-block-spacer"></div>
|
|
33
|
+
<!-- /wp:spacer -->`,
|
|
34
|
+
} );
|
|
35
|
+
|
|
36
|
+
// Act
|
|
37
|
+
fireEvent.press( screen.getByText( /Problem displaying block./ ) );
|
|
38
|
+
const spacerBlock = getBlock( screen, 'Spacer' );
|
|
39
|
+
fireEvent.press( spacerBlock );
|
|
40
|
+
|
|
41
|
+
// Assert
|
|
42
|
+
expect( getEditorHtml() ).toMatchInlineSnapshot( `
|
|
43
|
+
"<!-- wp:spacer -->
|
|
44
|
+
<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>
|
|
45
|
+
<!-- /wp:spacer -->"
|
|
46
|
+
` );
|
|
47
|
+
} );
|
|
48
|
+
} );
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import {
|
|
5
|
+
addBlock,
|
|
6
|
+
getBlock,
|
|
7
|
+
fireEvent,
|
|
8
|
+
initializeEditor,
|
|
9
|
+
screen,
|
|
10
|
+
setupCoreBlocks,
|
|
11
|
+
triggerBlockListLayout,
|
|
12
|
+
within,
|
|
13
|
+
} from 'test/helpers';
|
|
14
|
+
|
|
15
|
+
setupCoreBlocks();
|
|
16
|
+
|
|
17
|
+
describe( 'BlockList', () => {
|
|
18
|
+
describe( 'when empty', () => {
|
|
19
|
+
beforeEach( async () => {
|
|
20
|
+
// Arrange
|
|
21
|
+
await initializeEditor();
|
|
22
|
+
} );
|
|
23
|
+
|
|
24
|
+
it( 'renders a post title', async () => {
|
|
25
|
+
// Assert
|
|
26
|
+
expect( screen.getByPlaceholderText( 'Add title' ) ).toBeTruthy();
|
|
27
|
+
} );
|
|
28
|
+
|
|
29
|
+
it( 'renders a block appender as a content placeholder', async () => {
|
|
30
|
+
// Act
|
|
31
|
+
const appender = screen.getByPlaceholderText( /Start writing/ );
|
|
32
|
+
fireEvent.press( appender );
|
|
33
|
+
|
|
34
|
+
// Assert
|
|
35
|
+
expect( await getBlock( screen, 'Paragraph' ) ).toBeVisible();
|
|
36
|
+
} );
|
|
37
|
+
|
|
38
|
+
it( 'renders an end-of-list paragraph appender', async () => {
|
|
39
|
+
// Act
|
|
40
|
+
const appender = screen.getByLabelText( 'Add paragraph block' );
|
|
41
|
+
fireEvent.press( appender );
|
|
42
|
+
|
|
43
|
+
// Assert
|
|
44
|
+
expect( await getBlock( screen, 'Paragraph' ) ).toBeVisible();
|
|
45
|
+
} );
|
|
46
|
+
} );
|
|
47
|
+
|
|
48
|
+
describe( 'when not empty', () => {
|
|
49
|
+
it( 'renders a footer appender', async () => {
|
|
50
|
+
// Arrange
|
|
51
|
+
await initializeEditor();
|
|
52
|
+
await addBlock( screen, 'Social Icons' );
|
|
53
|
+
const socialLinksBlock = await getBlock( screen, 'Social Icons' );
|
|
54
|
+
fireEvent.press( socialLinksBlock );
|
|
55
|
+
triggerBlockListLayout( socialLinksBlock );
|
|
56
|
+
|
|
57
|
+
// Act
|
|
58
|
+
fireEvent.press(
|
|
59
|
+
within( socialLinksBlock ).getByTestId( 'appender-button' )
|
|
60
|
+
);
|
|
61
|
+
const blockList = screen.getByTestId( 'InserterUI-Blocks' );
|
|
62
|
+
fireEvent.scroll( blockList, {
|
|
63
|
+
nativeEvent: {
|
|
64
|
+
contentOffset: { y: 0, x: 0 },
|
|
65
|
+
contentSize: { width: 100, height: 100 },
|
|
66
|
+
layoutMeasurement: { width: 100, height: 100 },
|
|
67
|
+
},
|
|
68
|
+
} );
|
|
69
|
+
fireEvent.press( await screen.findByText( 'Amazon' ) );
|
|
70
|
+
|
|
71
|
+
// Assert
|
|
72
|
+
const amazonSettings = await screen.findByTestId(
|
|
73
|
+
'navigation-screen-LinkSettingsScreen'
|
|
74
|
+
);
|
|
75
|
+
expect( amazonSettings ).toBeVisible();
|
|
76
|
+
} );
|
|
77
|
+
} );
|
|
78
|
+
|
|
79
|
+
describe( 'for inner blocks', () => {
|
|
80
|
+
it( 'renders an inner block appender', async () => {
|
|
81
|
+
// Arrange
|
|
82
|
+
await initializeEditor();
|
|
83
|
+
await addBlock( screen, 'Group' );
|
|
84
|
+
const groupBlock = await getBlock( screen, 'Group' );
|
|
85
|
+
triggerBlockListLayout( groupBlock );
|
|
86
|
+
|
|
87
|
+
// Assert
|
|
88
|
+
expect(
|
|
89
|
+
within( groupBlock ).getByTestId( 'appender-button' )
|
|
90
|
+
).toBeTruthy();
|
|
91
|
+
} );
|
|
92
|
+
|
|
93
|
+
describe( 'when a non-last block is selected', () => {
|
|
94
|
+
beforeEach( async () => {
|
|
95
|
+
// Arrange
|
|
96
|
+
await initializeEditor();
|
|
97
|
+
await addBlock( screen, 'Group' );
|
|
98
|
+
const groupBlock = await getBlock( screen, 'Group' );
|
|
99
|
+
fireEvent.press(
|
|
100
|
+
within( groupBlock ).getByTestId( 'appender-button' )
|
|
101
|
+
);
|
|
102
|
+
await addBlock( screen, 'Paragraph', { isPickerOpened: true } );
|
|
103
|
+
fireEvent.press( screen.getByLabelText( 'Navigate Up' ) );
|
|
104
|
+
fireEvent.press(
|
|
105
|
+
within( groupBlock ).getByTestId( 'appender-button' )
|
|
106
|
+
);
|
|
107
|
+
await addBlock( screen, 'Paragraph', { isPickerOpened: true } );
|
|
108
|
+
} );
|
|
109
|
+
|
|
110
|
+
it( 'renders an insertion point before the block', async () => {
|
|
111
|
+
// Act
|
|
112
|
+
const paragraphBlock = await getBlock( screen, 'Paragraph', {
|
|
113
|
+
rowIndex: 1,
|
|
114
|
+
} );
|
|
115
|
+
fireEvent.press( paragraphBlock );
|
|
116
|
+
fireEvent( screen.getByLabelText( 'Add block' ), 'longPress' );
|
|
117
|
+
fireEvent.press( screen.getByText( 'Add Block Before' ) );
|
|
118
|
+
|
|
119
|
+
// Assert
|
|
120
|
+
expect( screen.getByText( 'ADD BLOCK HERE' ) ).toBeTruthy();
|
|
121
|
+
expect(
|
|
122
|
+
screen.getByTestId( 'block-insertion-point-before-row-1' )
|
|
123
|
+
).toBeTruthy();
|
|
124
|
+
} );
|
|
125
|
+
|
|
126
|
+
it( 'renders an insertion point after the block', async () => {
|
|
127
|
+
// Act
|
|
128
|
+
const paragraphBlock = await getBlock( screen, 'Paragraph', {
|
|
129
|
+
rowIndex: 1,
|
|
130
|
+
} );
|
|
131
|
+
fireEvent.press( paragraphBlock );
|
|
132
|
+
fireEvent( screen.getByLabelText( 'Add block' ), 'longPress' );
|
|
133
|
+
fireEvent.press( screen.getByText( 'Add Block After' ) );
|
|
134
|
+
|
|
135
|
+
// Assert
|
|
136
|
+
expect( screen.getByText( 'ADD BLOCK HERE' ) ).toBeTruthy();
|
|
137
|
+
expect(
|
|
138
|
+
screen.getByTestId( 'block-insertion-point-before-row-2' )
|
|
139
|
+
).toBeTruthy();
|
|
140
|
+
} );
|
|
141
|
+
} );
|
|
142
|
+
|
|
143
|
+
describe( 'when the last block is selected', () => {
|
|
144
|
+
it( 'renders an insertion point before the block', async () => {
|
|
145
|
+
// Arrange
|
|
146
|
+
await initializeEditor();
|
|
147
|
+
await addBlock( screen, 'Group' );
|
|
148
|
+
const groupBlock = await getBlock( screen, 'Group' );
|
|
149
|
+
fireEvent.press(
|
|
150
|
+
within( groupBlock ).getByTestId( 'appender-button' )
|
|
151
|
+
);
|
|
152
|
+
await addBlock( screen, 'Paragraph', { isPickerOpened: true } );
|
|
153
|
+
fireEvent.press( screen.getByLabelText( 'Navigate Up' ) );
|
|
154
|
+
fireEvent.press(
|
|
155
|
+
within( groupBlock ).getByTestId( 'appender-button' )
|
|
156
|
+
);
|
|
157
|
+
await addBlock( screen, 'Paragraph', { isPickerOpened: true } );
|
|
158
|
+
|
|
159
|
+
// Act
|
|
160
|
+
const paragraphBlock = await getBlock( screen, 'Paragraph', {
|
|
161
|
+
rowIndex: 2,
|
|
162
|
+
} );
|
|
163
|
+
fireEvent.press( paragraphBlock );
|
|
164
|
+
fireEvent( screen.getByLabelText( 'Add block' ), 'longPress' );
|
|
165
|
+
fireEvent.press( screen.getByText( 'Add Block Before' ) );
|
|
166
|
+
|
|
167
|
+
// Assert
|
|
168
|
+
expect( screen.getByText( 'ADD BLOCK HERE' ) ).toBeTruthy();
|
|
169
|
+
expect(
|
|
170
|
+
screen.getByTestId( 'block-insertion-point-before-row-2' )
|
|
171
|
+
).toBeTruthy();
|
|
172
|
+
} );
|
|
173
|
+
|
|
174
|
+
it( 'renders an insertion point after the block', async () => {
|
|
175
|
+
// Arrange
|
|
176
|
+
await initializeEditor();
|
|
177
|
+
await addBlock( screen, 'Group' );
|
|
178
|
+
const groupBlock = await getBlock( screen, 'Group' );
|
|
179
|
+
fireEvent.press(
|
|
180
|
+
within( groupBlock ).getByTestId( 'appender-button' )
|
|
181
|
+
);
|
|
182
|
+
await addBlock( screen, 'Paragraph', { isPickerOpened: true } );
|
|
183
|
+
fireEvent.press( screen.getByLabelText( 'Navigate Up' ) );
|
|
184
|
+
fireEvent.press(
|
|
185
|
+
within( groupBlock ).getByTestId( 'appender-button' )
|
|
186
|
+
);
|
|
187
|
+
await addBlock( screen, 'Paragraph', { isPickerOpened: true } );
|
|
188
|
+
|
|
189
|
+
// Act
|
|
190
|
+
const paragraphBlock = await getBlock( screen, 'Paragraph', {
|
|
191
|
+
rowIndex: 2,
|
|
192
|
+
} );
|
|
193
|
+
fireEvent.press( paragraphBlock );
|
|
194
|
+
fireEvent( screen.getByLabelText( 'Add block' ), 'longPress' );
|
|
195
|
+
fireEvent.press( screen.getByText( 'Add Block After' ) );
|
|
196
|
+
|
|
197
|
+
// Assert
|
|
198
|
+
expect( screen.getByText( 'ADD BLOCK HERE' ) ).toBeTruthy();
|
|
199
|
+
expect(
|
|
200
|
+
screen.getByTestId( 'block-insertion-point-after-row-2' )
|
|
201
|
+
).toBeTruthy();
|
|
202
|
+
} );
|
|
203
|
+
} );
|
|
204
|
+
} );
|
|
205
|
+
} );
|
|
@@ -229,7 +229,9 @@ const BlockActionsMenu = ( {
|
|
|
229
229
|
canDuplicate && allOptions.cutButton,
|
|
230
230
|
canDuplicate && isPasteEnabled && allOptions.pasteButton,
|
|
231
231
|
canDuplicate && allOptions.duplicateButton,
|
|
232
|
-
isReusableBlockType &&
|
|
232
|
+
isReusableBlockType &&
|
|
233
|
+
innerBlockCount > 0 &&
|
|
234
|
+
allOptions.convertToRegularBlocks,
|
|
233
235
|
! isLocked && allOptions.delete,
|
|
234
236
|
].filter( Boolean );
|
|
235
237
|
|
|
@@ -37,10 +37,7 @@
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
&:focus .block-editor-block-preview__container {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
// Windows High Contrast mode will show this outline, but not the box-shadow.
|
|
43
|
-
outline: 2px solid transparent;
|
|
40
|
+
@include button-style-outset__focus(var(--wp-admin-theme-color));
|
|
44
41
|
}
|
|
45
42
|
&:hover .block-editor-block-pattern-setup-list__item-title,
|
|
46
43
|
&:focus .block-editor-block-pattern-setup-list__item-title {
|
|
@@ -37,10 +37,7 @@
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
&:focus .block-editor-block-preview__container {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
// Windows High Contrast mode will show this outline, but not the box-shadow.
|
|
43
|
-
outline: 2px solid transparent;
|
|
40
|
+
@include button-style-outset__focus(var(--wp-admin-theme-color));
|
|
44
41
|
}
|
|
45
42
|
|
|
46
43
|
|
|
@@ -24,7 +24,6 @@ import { pipe, useCopyToClipboard } from '@wordpress/compose';
|
|
|
24
24
|
*/
|
|
25
25
|
import BlockActions from '../block-actions';
|
|
26
26
|
import BlockIcon from '../block-icon';
|
|
27
|
-
import BlockModeToggle from './block-mode-toggle';
|
|
28
27
|
import BlockHTMLConvertButton from './block-html-convert-button';
|
|
29
28
|
import __unstableBlockSettingsMenuFirstItem from './block-settings-menu-first-item';
|
|
30
29
|
import BlockSettingsMenuControls from '../block-settings-menu-controls';
|
|
@@ -278,7 +277,7 @@ export function BlockSettingsDropdown( {
|
|
|
278
277
|
) }
|
|
279
278
|
shortcut={ shortcuts.insertBefore }
|
|
280
279
|
>
|
|
281
|
-
{ __( '
|
|
280
|
+
{ __( 'Add before' ) }
|
|
282
281
|
</MenuItem>
|
|
283
282
|
<MenuItem
|
|
284
283
|
onClick={ pipe(
|
|
@@ -287,23 +286,10 @@ export function BlockSettingsDropdown( {
|
|
|
287
286
|
) }
|
|
288
287
|
shortcut={ shortcuts.insertAfter }
|
|
289
288
|
>
|
|
290
|
-
{ __( '
|
|
289
|
+
{ __( 'Add after' ) }
|
|
291
290
|
</MenuItem>
|
|
292
291
|
</>
|
|
293
292
|
) }
|
|
294
|
-
{ canMove && ! onlyBlock && (
|
|
295
|
-
<MenuItem
|
|
296
|
-
onClick={ pipe( onClose, onMoveTo ) }
|
|
297
|
-
>
|
|
298
|
-
{ __( 'Move to' ) }
|
|
299
|
-
</MenuItem>
|
|
300
|
-
) }
|
|
301
|
-
{ count === 1 && (
|
|
302
|
-
<BlockModeToggle
|
|
303
|
-
clientId={ firstBlockClientId }
|
|
304
|
-
onToggle={ onClose }
|
|
305
|
-
/>
|
|
306
|
-
) }
|
|
307
293
|
</MenuGroup>
|
|
308
294
|
<MenuGroup>
|
|
309
295
|
<CopyMenuItem
|
|
@@ -316,7 +302,14 @@ export function BlockSettingsDropdown( {
|
|
|
316
302
|
</MenuItem>
|
|
317
303
|
</MenuGroup>
|
|
318
304
|
<BlockSettingsMenuControls.Slot
|
|
319
|
-
fillProps={ {
|
|
305
|
+
fillProps={ {
|
|
306
|
+
onClose,
|
|
307
|
+
canMove,
|
|
308
|
+
onMoveTo,
|
|
309
|
+
onlyBlock,
|
|
310
|
+
count,
|
|
311
|
+
firstBlockClientId,
|
|
312
|
+
} }
|
|
320
313
|
clientIds={ clientIds }
|
|
321
314
|
__unstableDisplayLocation={
|
|
322
315
|
__unstableDisplayLocation
|
|
@@ -4,9 +4,12 @@
|
|
|
4
4
|
import {
|
|
5
5
|
createSlotFill,
|
|
6
6
|
MenuGroup,
|
|
7
|
+
MenuItem,
|
|
7
8
|
__experimentalStyleProvider as StyleProvider,
|
|
8
9
|
} from '@wordpress/components';
|
|
9
10
|
import { useSelect } from '@wordpress/data';
|
|
11
|
+
import { pipe } from '@wordpress/compose';
|
|
12
|
+
import { __ } from '@wordpress/i18n';
|
|
10
13
|
|
|
11
14
|
/**
|
|
12
15
|
* Internal dependencies
|
|
@@ -17,6 +20,7 @@ import {
|
|
|
17
20
|
} from '../convert-to-group-buttons';
|
|
18
21
|
import { BlockLockMenuItem, useBlockLock } from '../block-lock';
|
|
19
22
|
import { store as blockEditorStore } from '../../store';
|
|
23
|
+
import BlockModeToggle from '../block-settings-menu/block-mode-toggle';
|
|
20
24
|
|
|
21
25
|
const { Fill, Slot } = createSlotFill( 'BlockSettingsMenuControls' );
|
|
22
26
|
|
|
@@ -74,16 +78,32 @@ const BlockSettingsMenuControlsSlot = ( {
|
|
|
74
78
|
|
|
75
79
|
return (
|
|
76
80
|
<MenuGroup>
|
|
81
|
+
{ showConvertToGroupButton && (
|
|
82
|
+
<ConvertToGroupButton
|
|
83
|
+
{ ...convertToGroupButtonProps }
|
|
84
|
+
onClose={ fillProps?.onClose }
|
|
85
|
+
/>
|
|
86
|
+
) }
|
|
77
87
|
{ showLockButton && (
|
|
78
88
|
<BlockLockMenuItem
|
|
79
89
|
clientId={ selectedClientIds[ 0 ] }
|
|
80
90
|
/>
|
|
81
91
|
) }
|
|
82
92
|
{ fills }
|
|
83
|
-
{
|
|
84
|
-
<
|
|
85
|
-
{
|
|
86
|
-
|
|
93
|
+
{ fillProps?.canMove && ! fillProps?.onlyBlock && (
|
|
94
|
+
<MenuItem
|
|
95
|
+
onClick={ pipe(
|
|
96
|
+
fillProps?.onClose,
|
|
97
|
+
fillProps?.onMoveTo
|
|
98
|
+
) }
|
|
99
|
+
>
|
|
100
|
+
{ __( 'Move to' ) }
|
|
101
|
+
</MenuItem>
|
|
102
|
+
) }
|
|
103
|
+
{ fillProps?.count === 1 && (
|
|
104
|
+
<BlockModeToggle
|
|
105
|
+
clientId={ fillProps?.firstBlockClientId }
|
|
106
|
+
onToggle={ fillProps?.onClose }
|
|
87
107
|
/>
|
|
88
108
|
) }
|
|
89
109
|
</MenuGroup>
|
|
@@ -37,16 +37,15 @@
|
|
|
37
37
|
justify-content: space-between;
|
|
38
38
|
gap: $grid-unit-10;
|
|
39
39
|
|
|
40
|
-
.block-editor-block-styles__item {
|
|
40
|
+
button.components-button.block-editor-block-styles__item {
|
|
41
41
|
color: $gray-900;
|
|
42
42
|
box-shadow: inset 0 0 0 1px $gray-400;
|
|
43
43
|
display: inline-block;
|
|
44
44
|
width: calc(50% - #{$grid-unit-05});
|
|
45
45
|
|
|
46
|
-
&:focus,
|
|
47
46
|
&:hover {
|
|
48
47
|
color: var(--wp-admin-theme-color);
|
|
49
|
-
box-shadow: inset 0 0 0
|
|
48
|
+
box-shadow: inset 0 0 0 1px $gray-400;
|
|
50
49
|
}
|
|
51
50
|
|
|
52
51
|
&.is-active,
|
|
@@ -60,8 +59,9 @@
|
|
|
60
59
|
color: $white;
|
|
61
60
|
}
|
|
62
61
|
|
|
62
|
+
&:focus,
|
|
63
63
|
&.is-active:focus {
|
|
64
|
-
|
|
64
|
+
@include button-style__focus();
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
|
|
@@ -7,7 +7,7 @@ import classnames from 'classnames';
|
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
9
|
import { __ } from '@wordpress/i18n';
|
|
10
|
-
import {
|
|
10
|
+
import { useEffect, useRef, useState } from '@wordpress/element';
|
|
11
11
|
import { hasBlockSupport, store as blocksStore } from '@wordpress/blocks';
|
|
12
12
|
import { useSelect } from '@wordpress/data';
|
|
13
13
|
import {
|
|
@@ -26,53 +26,12 @@ import BlockToolbar from '../block-toolbar';
|
|
|
26
26
|
import { store as blockEditorStore } from '../../store';
|
|
27
27
|
import BlockIcon from '../block-icon';
|
|
28
28
|
|
|
29
|
-
const CollapseFixedToolbarButton = forwardRef( ( { onClick }, ref ) => {
|
|
30
|
-
return (
|
|
31
|
-
<ToolbarItem
|
|
32
|
-
as={ ToolbarButton }
|
|
33
|
-
className="block-editor-block-toolbar__collapse-fixed-toolbar"
|
|
34
|
-
icon={ levelUp }
|
|
35
|
-
onClick={ onClick }
|
|
36
|
-
ref={ ref }
|
|
37
|
-
label={ __( 'Show document tools' ) }
|
|
38
|
-
/>
|
|
39
|
-
);
|
|
40
|
-
} );
|
|
41
|
-
|
|
42
|
-
const ExpandFixedToolbarButton = forwardRef( ( { onClick, icon }, ref ) => {
|
|
43
|
-
return (
|
|
44
|
-
<ToolbarItem
|
|
45
|
-
as={ ToolbarButton }
|
|
46
|
-
className="block-editor-block-toolbar__expand-fixed-toolbar"
|
|
47
|
-
icon={ <BlockIcon icon={ icon } /> }
|
|
48
|
-
onClick={ onClick }
|
|
49
|
-
ref={ ref }
|
|
50
|
-
label={ __( 'Show block tools' ) }
|
|
51
|
-
/>
|
|
52
|
-
);
|
|
53
|
-
} );
|
|
54
|
-
|
|
55
29
|
function BlockContextualToolbar( { focusOnMount, isFixed, ...props } ) {
|
|
56
30
|
// When the toolbar is fixed it can be collapsed
|
|
57
31
|
const [ isCollapsed, setIsCollapsed ] = useState( false );
|
|
58
|
-
const
|
|
59
|
-
const collapseFixedToolbarButtonRef = useRef();
|
|
60
|
-
|
|
61
|
-
// Don't focus the block toolbar just because it mounts
|
|
62
|
-
const initialRender = useRef( true );
|
|
63
|
-
useEffect( () => {
|
|
64
|
-
if ( initialRender.current ) {
|
|
65
|
-
initialRender.current = false;
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
if ( isCollapsed && expandFixedToolbarButtonRef.current ) {
|
|
69
|
-
expandFixedToolbarButtonRef.current.focus();
|
|
70
|
-
}
|
|
71
|
-
if ( ! isCollapsed && collapseFixedToolbarButtonRef.current ) {
|
|
72
|
-
collapseFixedToolbarButtonRef.current.focus();
|
|
73
|
-
}
|
|
74
|
-
}, [ isCollapsed ] );
|
|
32
|
+
const toolbarButtonRef = useRef();
|
|
75
33
|
|
|
34
|
+
const isLargeViewport = useViewportMatch( 'medium' );
|
|
76
35
|
const { blockType, hasParents, showParentSelector, selectedBlockClientId } =
|
|
77
36
|
useSelect( ( select ) => {
|
|
78
37
|
const {
|
|
@@ -113,12 +72,11 @@ function BlockContextualToolbar( { focusOnMount, isFixed, ...props } ) {
|
|
|
113
72
|
setIsCollapsed( false );
|
|
114
73
|
}, [ selectedBlockClientId ] );
|
|
115
74
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
}
|
|
75
|
+
if (
|
|
76
|
+
blockType &&
|
|
77
|
+
! hasBlockSupport( blockType, '__experimentalToolbar', true )
|
|
78
|
+
) {
|
|
79
|
+
return null;
|
|
122
80
|
}
|
|
123
81
|
|
|
124
82
|
// Shifts the toolbar to make room for the parent block selector.
|
|
@@ -144,18 +102,26 @@ function BlockContextualToolbar( { focusOnMount, isFixed, ...props } ) {
|
|
|
144
102
|
: 'block-editor-block-toolbar__group-collapse-fixed-toolbar'
|
|
145
103
|
}
|
|
146
104
|
>
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
105
|
+
<ToolbarItem
|
|
106
|
+
as={ ToolbarButton }
|
|
107
|
+
ref={ toolbarButtonRef }
|
|
108
|
+
icon={
|
|
109
|
+
isCollapsed ? (
|
|
110
|
+
<BlockIcon icon={ blockType.icon } />
|
|
111
|
+
) : (
|
|
112
|
+
levelUp
|
|
113
|
+
)
|
|
114
|
+
}
|
|
115
|
+
onClick={ () => {
|
|
116
|
+
setIsCollapsed( ( collapsed ) => ! collapsed );
|
|
117
|
+
toolbarButtonRef.current.focus();
|
|
118
|
+
} }
|
|
119
|
+
label={
|
|
120
|
+
isCollapsed
|
|
121
|
+
? __( 'Show block tools' )
|
|
122
|
+
: __( 'Show document tools' )
|
|
123
|
+
}
|
|
124
|
+
/>
|
|
159
125
|
</ToolbarGroup>
|
|
160
126
|
) }
|
|
161
127
|
{ ! isCollapsed && <BlockToolbar hideDragHandle={ isFixed } /> }
|
|
@@ -20,8 +20,7 @@ import { store as blockEditorStore } from '../../store';
|
|
|
20
20
|
import BlockPopover from '../block-popover';
|
|
21
21
|
import useBlockToolbarPopoverProps from './use-block-toolbar-popover-props';
|
|
22
22
|
import Inserter from '../inserter';
|
|
23
|
-
import {
|
|
24
|
-
import { privateApis } from '../../private-apis';
|
|
23
|
+
import { useShouldContextualToolbarShow } from '../../utils/use-should-contextual-toolbar-show';
|
|
25
24
|
|
|
26
25
|
function selector( select ) {
|
|
27
26
|
const {
|
|
@@ -29,7 +28,7 @@ function selector( select ) {
|
|
|
29
28
|
hasMultiSelection,
|
|
30
29
|
isTyping,
|
|
31
30
|
getLastMultiSelectedBlockClientId,
|
|
32
|
-
} =
|
|
31
|
+
} = select( blockEditorStore );
|
|
33
32
|
|
|
34
33
|
return {
|
|
35
34
|
editorMode: __unstableGetEditorMode(),
|
|
@@ -54,7 +53,6 @@ function SelectedBlockPopover( {
|
|
|
54
53
|
[]
|
|
55
54
|
);
|
|
56
55
|
|
|
57
|
-
const { useShouldContextualToolbarShow } = unlock( privateApis );
|
|
58
56
|
const isInsertionPointVisible = useSelect(
|
|
59
57
|
( select ) => {
|
|
60
58
|
const {
|
|
@@ -75,7 +73,7 @@ function SelectedBlockPopover( {
|
|
|
75
73
|
);
|
|
76
74
|
const isToolbarForced = useRef( false );
|
|
77
75
|
const { shouldShowContextualToolbar, canFocusHiddenToolbar } =
|
|
78
|
-
useShouldContextualToolbarShow(
|
|
76
|
+
useShouldContextualToolbarShow();
|
|
79
77
|
|
|
80
78
|
const { stopTyping } = useDispatch( blockEditorStore );
|
|
81
79
|
|
|
@@ -61,7 +61,12 @@ export default function useMultipleOriginColorsAndGradients() {
|
|
|
61
61
|
} );
|
|
62
62
|
}
|
|
63
63
|
return result;
|
|
64
|
-
}, [
|
|
64
|
+
}, [
|
|
65
|
+
defaultColors,
|
|
66
|
+
themeColors,
|
|
67
|
+
customColors,
|
|
68
|
+
shouldDisplayDefaultColors,
|
|
69
|
+
] );
|
|
65
70
|
|
|
66
71
|
const customGradients = useSetting( 'color.gradients.custom' );
|
|
67
72
|
const themeGradients = useSetting( 'color.gradients.theme' );
|
|
@@ -103,7 +108,16 @@ export default function useMultipleOriginColorsAndGradients() {
|
|
|
103
108
|
} );
|
|
104
109
|
}
|
|
105
110
|
return result;
|
|
106
|
-
}, [
|
|
111
|
+
}, [
|
|
112
|
+
customGradients,
|
|
113
|
+
themeGradients,
|
|
114
|
+
defaultGradients,
|
|
115
|
+
shouldDisplayDefaultGradients,
|
|
116
|
+
] );
|
|
117
|
+
|
|
118
|
+
colorGradientSettings.hasColorsOrGradients =
|
|
119
|
+
!! colorGradientSettings.colors.length ||
|
|
120
|
+
!! colorGradientSettings.gradients.length;
|
|
107
121
|
|
|
108
122
|
return colorGradientSettings;
|
|
109
123
|
}
|