@wordpress/block-editor 12.9.1-next.5a1d1283.0 → 12.10.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 +6 -0
- package/README.md +33 -3
- package/build/components/block-canvas/index.js +107 -0
- package/build/components/block-canvas/index.js.map +1 -0
- package/build/components/block-inspector/index.js +4 -1
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-patterns-list/index.js +19 -4
- package/build/components/block-patterns-list/index.js.map +1 -1
- package/build/components/block-patterns-paging/index.js +66 -0
- package/build/components/block-patterns-paging/index.js.map +1 -0
- package/build/components/block-settings-menu/block-settings-dropdown.js +28 -0
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-settings-menu-controls/index.js +4 -7
- package/build/components/block-settings-menu-controls/index.js.map +1 -1
- package/build/components/block-styles/index.js +1 -0
- package/build/components/block-styles/index.js.map +1 -1
- package/build/components/block-toolbar/block-toolbar-menu.native.js +3 -7
- package/build/components/block-toolbar/block-toolbar-menu.native.js.map +1 -1
- package/build/components/block-tools/block-contextual-toolbar.js +18 -7
- package/build/components/block-tools/block-contextual-toolbar.js.map +1 -1
- package/build/components/block-tools/block-selection-button.js +5 -1
- package/build/components/block-tools/block-selection-button.js.map +1 -1
- package/build/components/border-radius-control/input-controls.js +1 -1
- package/build/components/border-radius-control/input-controls.js.map +1 -1
- package/build/components/border-radius-control/linked-button.js +2 -4
- package/build/components/border-radius-control/linked-button.js.map +1 -1
- package/build/components/colors/with-colors.js.map +1 -1
- package/build/components/convert-to-group-buttons/use-convert-to-group-button-props.js +8 -21
- package/build/components/convert-to-group-buttons/use-convert-to-group-button-props.js.map +1 -1
- package/build/components/default-block-appender/index.native.js +20 -1
- package/build/components/default-block-appender/index.native.js.map +1 -1
- package/build/components/duotone/utils.js +68 -0
- package/build/components/duotone/utils.js.map +1 -1
- package/build/components/editor-styles/index.js +28 -9
- package/build/components/editor-styles/index.js.map +1 -1
- package/build/components/global-styles/hooks.js +2 -101
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/image-settings-panel.js +61 -0
- package/build/components/global-styles/image-settings-panel.js.map +1 -0
- package/build/components/global-styles/index.js +11 -17
- package/build/components/global-styles/index.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +19 -15
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js +1 -1
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/iframe/index.js +67 -33
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/image-editor/use-save-image.js +2 -5
- package/build/components/image-editor/use-save-image.js.map +1 -1
- package/build/components/image-editor/use-transform-image.js +9 -9
- package/build/components/image-editor/use-transform-image.js.map +1 -1
- package/build/components/index.js +8 -12
- package/build/components/index.js.map +1 -1
- package/build/components/index.native.js +6 -5
- package/build/components/index.native.js.map +1 -1
- package/build/components/inner-blocks/use-nested-settings-update.js +13 -7
- package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build/components/inserter/block-patterns-explorer/explorer.js +12 -6
- package/build/components/inserter/block-patterns-explorer/explorer.js.map +1 -1
- package/build/components/inserter/block-patterns-explorer/patterns-list.js +57 -23
- package/build/components/inserter/block-patterns-explorer/patterns-list.js.map +1 -1
- package/build/components/inserter/block-patterns-explorer/sidebar.js +24 -9
- package/build/components/inserter/block-patterns-explorer/sidebar.js.map +1 -1
- package/build/components/inserter/block-patterns-source-filter.js +54 -0
- package/build/components/inserter/block-patterns-source-filter.js.map +1 -0
- package/build/components/inserter/block-patterns-sync-filter.js +46 -0
- package/build/components/inserter/block-patterns-sync-filter.js.map +1 -0
- package/build/components/inserter/block-patterns-tab.js +91 -45
- package/build/components/inserter/block-patterns-tab.js.map +1 -1
- package/build/components/inserter/hooks/use-patterns-paging.js +57 -0
- package/build/components/inserter/hooks/use-patterns-paging.js.map +1 -0
- package/build/components/inserter/hooks/use-patterns-state.js +21 -10
- package/build/components/inserter/hooks/use-patterns-state.js.map +1 -1
- package/build/components/inserter/menu.js +13 -11
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/search-results.js +4 -3
- package/build/components/inserter/search-results.js.map +1 -1
- package/build/components/inserter/tabs.js +1 -12
- package/build/components/inserter/tabs.js.map +1 -1
- package/build/components/inspector-controls/block-support-slot-container.js +12 -1
- package/build/components/inspector-controls/block-support-slot-container.js.map +1 -1
- package/build/components/inspector-controls/fill.js +24 -13
- package/build/components/inspector-controls/fill.js.map +1 -1
- package/build/components/inspector-controls/groups.js +5 -3
- package/build/components/inspector-controls/groups.js.map +1 -1
- package/build/components/inspector-controls/slot.js +13 -0
- package/build/components/inspector-controls/slot.js.map +1 -1
- package/build/components/inspector-controls-tabs/styles-tab.js +3 -0
- package/build/components/inspector-controls-tabs/styles-tab.js.map +1 -1
- package/build/components/link-control/index.js +12 -2
- package/build/components/link-control/index.js.map +1 -1
- package/build/components/list-view/block-select-button.js +1 -3
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/list-view/block.js +13 -1
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/use-block-selection.js +29 -24
- package/build/components/list-view/use-block-selection.js.map +1 -1
- package/build/components/media-placeholder/index.js +2 -2
- package/build/components/media-placeholder/index.js.map +1 -1
- package/build/components/media-placeholder/index.native.js +11 -11
- package/build/components/media-placeholder/index.native.js.map +1 -1
- package/build/components/media-replace-flow/index.js +2 -3
- package/build/components/media-replace-flow/index.js.map +1 -1
- package/build/components/media-upload/constants.js +30 -0
- package/build/components/media-upload/constants.js.map +1 -0
- package/build/components/media-upload/index.native.js +63 -53
- package/build/components/media-upload/index.native.js.map +1 -1
- package/build/components/preview-options/index.js +1 -1
- package/build/components/preview-options/index.js.map +1 -1
- package/build/components/rich-text/index.js +34 -35
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/index.native.js +14 -32
- package/build/components/rich-text/index.native.js.map +1 -1
- package/build/components/rich-text/multiline.js +95 -0
- package/build/components/rich-text/multiline.js.map +1 -0
- package/build/components/rich-text/split-value.js +10 -16
- package/build/components/rich-text/split-value.js.map +1 -1
- package/build/components/rich-text/use-enter.js +31 -40
- package/build/components/rich-text/use-enter.js.map +1 -1
- package/build/components/rich-text/use-paste-handler.js +18 -33
- package/build/components/rich-text/use-paste-handler.js.map +1 -1
- package/build/components/spacing-sizes-control/utils.js +1 -1
- package/build/components/spacing-sizes-control/utils.js.map +1 -1
- package/build/components/use-block-commands/index.js +30 -18
- package/build/components/use-block-commands/index.js.map +1 -1
- package/build/components/use-block-display-information/index.js +5 -2
- package/build/components/use-block-display-information/index.js.map +1 -1
- package/build/hooks/background.js +258 -0
- package/build/hooks/background.js.map +1 -0
- package/build/hooks/block-hooks.js +188 -0
- package/build/hooks/block-hooks.js.map +1 -0
- package/build/hooks/block-rename-ui.js +160 -0
- package/build/hooks/block-rename-ui.js.map +1 -0
- package/build/hooks/duotone.js +29 -42
- package/build/hooks/duotone.js.map +1 -1
- package/build/hooks/index.js +2 -2
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/layout.js +31 -14
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/position.js +4 -2
- package/build/hooks/position.js.map +1 -1
- package/build/hooks/style.js +10 -3
- package/build/hooks/style.js.map +1 -1
- package/build/private-apis.js +2 -0
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +33 -10
- package/build/store/actions.js.map +1 -1
- package/build/store/private-actions.js +42 -8
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-selectors.js +23 -0
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +43 -1
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +84 -23
- package/build/store/selectors.js.map +1 -1
- package/build/store/utils.js +0 -4
- package/build/store/utils.js.map +1 -1
- package/build-module/components/block-canvas/index.js +97 -0
- package/build-module/components/block-canvas/index.js.map +1 -0
- package/build-module/components/block-inspector/index.js +4 -1
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-patterns-list/index.js +20 -5
- package/build-module/components/block-patterns-list/index.js.map +1 -1
- package/build-module/components/block-patterns-paging/index.js +59 -0
- package/build-module/components/block-patterns-paging/index.js.map +1 -0
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +28 -0
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-settings-menu-controls/index.js +4 -7
- package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
- package/build-module/components/block-styles/index.js +1 -0
- package/build-module/components/block-styles/index.js.map +1 -1
- package/build-module/components/block-toolbar/block-toolbar-menu.native.js +3 -7
- package/build-module/components/block-toolbar/block-toolbar-menu.native.js.map +1 -1
- package/build-module/components/block-tools/block-contextual-toolbar.js +18 -7
- package/build-module/components/block-tools/block-contextual-toolbar.js.map +1 -1
- package/build-module/components/block-tools/block-selection-button.js +5 -1
- package/build-module/components/block-tools/block-selection-button.js.map +1 -1
- package/build-module/components/border-radius-control/input-controls.js +1 -1
- package/build-module/components/border-radius-control/input-controls.js.map +1 -1
- package/build-module/components/border-radius-control/linked-button.js +2 -4
- package/build-module/components/border-radius-control/linked-button.js.map +1 -1
- package/build-module/components/colors/with-colors.js.map +1 -1
- package/build-module/components/convert-to-group-buttons/use-convert-to-group-button-props.js +8 -21
- package/build-module/components/convert-to-group-buttons/use-convert-to-group-button-props.js.map +1 -1
- package/build-module/components/default-block-appender/index.native.js +20 -1
- package/build-module/components/default-block-appender/index.native.js.map +1 -1
- package/build-module/components/duotone/utils.js +65 -0
- package/build-module/components/duotone/utils.js.map +1 -1
- package/build-module/components/editor-styles/index.js +28 -9
- package/build-module/components/editor-styles/index.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +3 -100
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/image-settings-panel.js +53 -0
- package/build-module/components/global-styles/image-settings-panel.js.map +1 -0
- package/build-module/components/global-styles/index.js +2 -2
- package/build-module/components/global-styles/index.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +18 -16
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js +1 -1
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/iframe/index.js +66 -33
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/image-editor/use-save-image.js +2 -5
- package/build-module/components/image-editor/use-save-image.js.map +1 -1
- package/build-module/components/image-editor/use-transform-image.js +9 -9
- package/build-module/components/image-editor/use-transform-image.js.map +1 -1
- package/build-module/components/index.js +1 -1
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/index.native.js +2 -1
- package/build-module/components/index.native.js.map +1 -1
- package/build-module/components/inner-blocks/use-nested-settings-update.js +14 -8
- package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build-module/components/inserter/block-patterns-explorer/explorer.js +12 -6
- package/build-module/components/inserter/block-patterns-explorer/explorer.js.map +1 -1
- package/build-module/components/inserter/block-patterns-explorer/patterns-list.js +59 -25
- package/build-module/components/inserter/block-patterns-explorer/patterns-list.js.map +1 -1
- package/build-module/components/inserter/block-patterns-explorer/sidebar.js +23 -9
- package/build-module/components/inserter/block-patterns-explorer/sidebar.js.map +1 -1
- package/build-module/components/inserter/block-patterns-source-filter.js +44 -0
- package/build-module/components/inserter/block-patterns-source-filter.js.map +1 -0
- package/build-module/components/inserter/block-patterns-sync-filter.js +38 -0
- package/build-module/components/inserter/block-patterns-sync-filter.js.map +1 -0
- package/build-module/components/inserter/block-patterns-tab.js +87 -46
- package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
- package/build-module/components/inserter/hooks/use-patterns-paging.js +50 -0
- package/build-module/components/inserter/hooks/use-patterns-paging.js.map +1 -0
- package/build-module/components/inserter/hooks/use-patterns-state.js +22 -10
- package/build-module/components/inserter/hooks/use-patterns-state.js.map +1 -1
- package/build-module/components/inserter/menu.js +13 -11
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/search-results.js +4 -3
- package/build-module/components/inserter/search-results.js.map +1 -1
- package/build-module/components/inserter/tabs.js +1 -12
- package/build-module/components/inserter/tabs.js.map +1 -1
- package/build-module/components/inspector-controls/block-support-slot-container.js +13 -2
- package/build-module/components/inspector-controls/block-support-slot-container.js.map +1 -1
- package/build-module/components/inspector-controls/fill.js +25 -14
- package/build-module/components/inspector-controls/fill.js.map +1 -1
- package/build-module/components/inspector-controls/groups.js +5 -3
- package/build-module/components/inspector-controls/groups.js.map +1 -1
- package/build-module/components/inspector-controls/slot.js +15 -1
- package/build-module/components/inspector-controls/slot.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/styles-tab.js +3 -0
- package/build-module/components/inspector-controls-tabs/styles-tab.js.map +1 -1
- package/build-module/components/link-control/index.js +12 -2
- package/build-module/components/link-control/index.js.map +1 -1
- package/build-module/components/list-view/block-select-button.js +1 -3
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/list-view/block.js +13 -1
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/use-block-selection.js +30 -25
- package/build-module/components/list-view/use-block-selection.js.map +1 -1
- package/build-module/components/media-placeholder/index.js +2 -2
- package/build-module/components/media-placeholder/index.js.map +1 -1
- package/build-module/components/media-placeholder/index.native.js +7 -7
- package/build-module/components/media-placeholder/index.native.js.map +1 -1
- package/build-module/components/media-replace-flow/index.js +2 -3
- package/build-module/components/media-replace-flow/index.js.map +1 -1
- package/build-module/components/media-upload/constants.js +14 -0
- package/build-module/components/media-upload/constants.js.map +1 -0
- package/build-module/components/media-upload/index.native.js +53 -34
- package/build-module/components/media-upload/index.native.js.map +1 -1
- package/build-module/components/preview-options/index.js +1 -1
- package/build-module/components/preview-options/index.js.map +1 -1
- package/build-module/components/rich-text/index.js +35 -37
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/index.native.js +15 -33
- package/build-module/components/rich-text/index.native.js.map +1 -1
- package/build-module/components/rich-text/multiline.js +87 -0
- package/build-module/components/rich-text/multiline.js.map +1 -0
- package/build-module/components/rich-text/split-value.js +10 -16
- package/build-module/components/rich-text/split-value.js.map +1 -1
- package/build-module/components/rich-text/use-enter.js +33 -42
- package/build-module/components/rich-text/use-enter.js.map +1 -1
- package/build-module/components/rich-text/use-paste-handler.js +19 -34
- package/build-module/components/rich-text/use-paste-handler.js.map +1 -1
- package/build-module/components/spacing-sizes-control/utils.js +2 -2
- package/build-module/components/spacing-sizes-control/utils.js.map +1 -1
- package/build-module/components/use-block-commands/index.js +28 -16
- package/build-module/components/use-block-commands/index.js.map +1 -1
- package/build-module/components/use-block-display-information/index.js +5 -2
- package/build-module/components/use-block-display-information/index.js.map +1 -1
- package/build-module/hooks/background.js +244 -0
- package/build-module/hooks/background.js.map +1 -0
- package/build-module/hooks/block-hooks.js +181 -0
- package/build-module/hooks/block-hooks.js.map +1 -0
- package/build-module/hooks/block-rename-ui.js +153 -0
- package/build-module/hooks/block-rename-ui.js.map +1 -0
- package/build-module/hooks/duotone.js +26 -39
- package/build-module/hooks/duotone.js.map +1 -1
- package/build-module/hooks/index.js +2 -2
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/layout.js +33 -16
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/hooks/position.js +4 -2
- package/build-module/hooks/position.js.map +1 -1
- package/build-module/hooks/style.js +10 -3
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/private-apis.js +2 -0
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/actions.js +33 -10
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/private-actions.js +39 -8
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-selectors.js +21 -0
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +41 -1
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +78 -22
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/store/utils.js +0 -4
- package/build-module/store/utils.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 +170 -127
- package/build-style/style.css +170 -127
- package/package.json +32 -32
- package/src/components/block-canvas/index.js +108 -0
- package/src/components/block-inspector/index.js +5 -1
- package/src/components/block-list/content.scss +0 -1
- package/src/components/block-patterns-list/index.js +32 -7
- package/src/components/block-patterns-list/style.scss +26 -9
- package/src/components/block-patterns-paging/index.js +92 -0
- package/src/components/block-patterns-paging/style.scss +42 -0
- package/src/components/block-settings-menu/block-settings-dropdown.js +44 -0
- package/src/components/block-settings-menu-controls/index.js +4 -9
- package/src/components/block-styles/index.js +1 -0
- package/src/components/block-styles/style.scss +3 -3
- package/src/components/block-toolbar/block-toolbar-menu.native.js +1 -6
- package/src/components/block-tools/block-contextual-toolbar.js +16 -5
- package/src/components/block-tools/block-selection-button.js +9 -1
- package/src/components/block-tools/style.scss +0 -98
- package/src/components/border-radius-control/input-controls.js +1 -1
- package/src/components/border-radius-control/linked-button.js +8 -11
- package/src/components/color-palette/test/__snapshots__/control.js.snap +34 -21
- package/src/components/colors/with-colors.js +3 -2
- package/src/components/convert-to-group-buttons/use-convert-to-group-button-props.js +8 -35
- package/src/components/default-block-appender/index.native.js +26 -3
- package/src/components/duotone/utils.js +65 -0
- package/src/components/editor-styles/index.js +32 -23
- package/src/components/global-styles/hooks.js +4 -112
- package/src/components/global-styles/image-settings-panel.js +71 -0
- package/src/components/global-styles/index.js +4 -3
- package/src/components/global-styles/use-global-styles-output.js +25 -16
- package/src/components/global-styles/utils.js +1 -2
- package/src/components/iframe/index.js +72 -33
- package/src/components/image-editor/use-save-image.js +2 -9
- package/src/components/image-editor/use-transform-image.js +9 -9
- package/src/components/index.js +1 -1
- package/src/components/index.native.js +2 -2
- package/src/components/inner-blocks/use-nested-settings-update.js +15 -10
- package/src/components/inserter/block-patterns-explorer/explorer.js +17 -5
- package/src/components/inserter/block-patterns-explorer/patterns-list.js +109 -40
- package/src/components/inserter/block-patterns-explorer/sidebar.js +23 -8
- package/src/components/inserter/block-patterns-source-filter.js +40 -0
- package/src/components/inserter/block-patterns-sync-filter.js +35 -0
- package/src/components/inserter/block-patterns-tab.js +168 -57
- package/src/components/inserter/hooks/use-patterns-paging.js +65 -0
- package/src/components/inserter/hooks/use-patterns-state.js +27 -16
- package/src/components/inserter/menu.js +15 -17
- package/src/components/inserter/search-results.js +6 -4
- package/src/components/inserter/style.scss +23 -2
- package/src/components/inserter/tabs.js +2 -12
- package/src/components/inserter/test/index.native.js +8 -12
- package/src/components/inspector-controls/block-support-slot-container.js +19 -3
- package/src/components/inspector-controls/fill.js +28 -14
- package/src/components/inspector-controls/groups.js +6 -2
- package/src/components/inspector-controls/slot.js +28 -3
- package/src/components/inspector-controls-tabs/styles-tab.js +4 -0
- package/src/components/link-control/index.js +13 -0
- package/src/components/link-control/style.scss +23 -2
- package/src/components/link-control/test/index.js +88 -6
- package/src/components/list-view/block-select-button.js +1 -3
- package/src/components/list-view/block.js +19 -1
- package/src/components/list-view/style.scss +1 -2
- package/src/components/list-view/use-block-selection.js +38 -32
- package/src/components/media-placeholder/README.md +2 -2
- package/src/components/media-placeholder/index.js +2 -2
- package/src/components/media-placeholder/index.native.js +11 -12
- package/src/components/media-replace-flow/index.js +2 -2
- package/src/components/media-replace-flow/test/index.js +5 -23
- package/src/components/media-upload/README.md +3 -2
- package/src/components/media-upload/constants.js +15 -0
- package/src/components/media-upload/index.native.js +66 -40
- package/src/components/media-upload/style.native.scss +4 -0
- package/src/components/media-upload/test/index.native.js +2 -2
- package/src/components/preview-options/README.md +7 -0
- package/src/components/preview-options/index.js +1 -1
- package/src/components/rich-text/index.js +48 -44
- package/src/components/rich-text/index.native.js +14 -42
- package/src/components/rich-text/multiline.js +121 -0
- package/src/components/rich-text/split-value.js +10 -35
- package/src/components/rich-text/use-enter.js +32 -42
- package/src/components/rich-text/use-paste-handler.js +16 -40
- package/src/components/spacing-sizes-control/style.scss +5 -7
- package/src/components/spacing-sizes-control/utils.js +1 -2
- package/src/components/use-block-commands/index.js +28 -20
- package/src/components/use-block-display-information/index.js +3 -0
- package/src/hooks/background.js +288 -0
- package/src/hooks/background.scss +57 -0
- package/src/hooks/block-hooks.js +257 -0
- package/src/hooks/block-hooks.scss +16 -0
- package/src/hooks/block-rename-ui.js +230 -0
- package/src/hooks/block-rename-ui.scss +3 -0
- package/src/hooks/duotone.js +42 -43
- package/src/hooks/index.js +2 -2
- package/src/hooks/layout.js +31 -33
- package/src/hooks/position.js +4 -3
- package/src/hooks/style.js +11 -2
- package/src/hooks/test/align.native.js +4 -3
- package/src/private-apis.js +2 -0
- package/src/store/actions.js +52 -10
- package/src/store/private-actions.js +37 -6
- package/src/store/private-selectors.js +21 -0
- package/src/store/reducer.js +38 -0
- package/src/store/selectors.js +107 -26
- package/src/store/test/actions.js +19 -8
- package/src/store/test/private-actions.js +17 -0
- package/src/store/test/reducer.js +25 -0
- package/src/store/test/selectors.js +130 -123
- package/src/store/utils.js +3 -10
- package/src/style.scss +4 -0
- package/build/components/duotone/components.js +0 -135
- package/build/components/duotone/components.js.map +0 -1
- package/build/components/duotone/index.js +0 -38
- package/build/components/duotone/index.js.map +0 -1
- package/build/components/global-styles/behaviors-panel.js +0 -64
- package/build/components/global-styles/behaviors-panel.js.map +0 -1
- package/build/components/inserter/reusable-blocks-tab.js +0 -85
- package/build/components/inserter/reusable-blocks-tab.js.map +0 -1
- package/build/hooks/auto-inserting-blocks.js +0 -174
- package/build/hooks/auto-inserting-blocks.js.map +0 -1
- package/build/hooks/behaviors.js +0 -173
- package/build/hooks/behaviors.js.map +0 -1
- package/build-module/components/duotone/components.js +0 -126
- package/build-module/components/duotone/components.js.map +0 -1
- package/build-module/components/duotone/index.js +0 -3
- package/build-module/components/duotone/index.js.map +0 -1
- package/build-module/components/global-styles/behaviors-panel.js +0 -57
- package/build-module/components/global-styles/behaviors-panel.js.map +0 -1
- package/build-module/components/inserter/reusable-blocks-tab.js +0 -76
- package/build-module/components/inserter/reusable-blocks-tab.js.map +0 -1
- package/build-module/hooks/auto-inserting-blocks.js +0 -167
- package/build-module/hooks/auto-inserting-blocks.js.map +0 -1
- package/build-module/hooks/behaviors.js +0 -166
- package/build-module/hooks/behaviors.js.map +0 -1
- package/src/components/duotone/components.js +0 -133
- package/src/components/duotone/index.js +0 -7
- package/src/components/global-styles/behaviors-panel.js +0 -71
- package/src/components/inserter/reusable-blocks-tab.js +0 -84
- package/src/components/inserter/test/reusable-blocks-tab.js +0 -73
- package/src/hooks/auto-inserting-blocks.js +0 -232
- package/src/hooks/behaviors.js +0 -206
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import classnames from 'classnames';
|
|
5
|
+
|
|
1
6
|
/**
|
|
2
7
|
* WordPress dependencies
|
|
3
8
|
*/
|
|
@@ -8,9 +13,11 @@ import {
|
|
|
8
13
|
__unstableUseCompositeState as useCompositeState,
|
|
9
14
|
__unstableCompositeItem as CompositeItem,
|
|
10
15
|
Tooltip,
|
|
16
|
+
__experimentalHStack as HStack,
|
|
11
17
|
} from '@wordpress/components';
|
|
12
18
|
import { useInstanceId } from '@wordpress/compose';
|
|
13
19
|
import { __ } from '@wordpress/i18n';
|
|
20
|
+
import { Icon, symbol } from '@wordpress/icons';
|
|
14
21
|
|
|
15
22
|
/**
|
|
16
23
|
* Internal dependencies
|
|
@@ -63,14 +70,20 @@ function BlockPattern( {
|
|
|
63
70
|
} }
|
|
64
71
|
>
|
|
65
72
|
<WithToolTip
|
|
66
|
-
showTooltip={ showTooltip }
|
|
73
|
+
showTooltip={ showTooltip && ! pattern.id }
|
|
67
74
|
title={ pattern.title }
|
|
68
75
|
>
|
|
69
76
|
<CompositeItem
|
|
70
77
|
role="option"
|
|
71
78
|
as="div"
|
|
72
79
|
{ ...composite }
|
|
73
|
-
className=
|
|
80
|
+
className={ classnames(
|
|
81
|
+
'block-editor-block-patterns-list__item',
|
|
82
|
+
{
|
|
83
|
+
'block-editor-block-patterns-list__list-item-synced':
|
|
84
|
+
pattern.id && ! pattern.syncStatus,
|
|
85
|
+
}
|
|
86
|
+
) }
|
|
74
87
|
onClick={ () => {
|
|
75
88
|
onClick( pattern, blocks );
|
|
76
89
|
onHover?.( null );
|
|
@@ -91,11 +104,23 @@ function BlockPattern( {
|
|
|
91
104
|
blocks={ blocks }
|
|
92
105
|
viewportWidth={ viewportWidth }
|
|
93
106
|
/>
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
107
|
+
|
|
108
|
+
<HStack className="block-editor-patterns__pattern-details">
|
|
109
|
+
{ pattern.id && ! pattern.syncStatus && (
|
|
110
|
+
<div className="block-editor-patterns__pattern-icon-wrapper">
|
|
111
|
+
<Icon
|
|
112
|
+
className="block-editor-patterns__pattern-icon"
|
|
113
|
+
icon={ symbol }
|
|
114
|
+
/>
|
|
115
|
+
</div>
|
|
116
|
+
) }
|
|
117
|
+
{ ( ! showTooltip || pattern.id ) && (
|
|
118
|
+
<div className="block-editor-block-patterns-list__item-title">
|
|
119
|
+
{ pattern.title }
|
|
120
|
+
</div>
|
|
121
|
+
) }
|
|
122
|
+
</HStack>
|
|
123
|
+
|
|
99
124
|
{ !! pattern.description && (
|
|
100
125
|
<VisuallyHidden id={ descriptionId }>
|
|
101
126
|
{ pattern.description }
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
min-height: 100px;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
&[draggable="true"]
|
|
14
|
+
&[draggable="true"] {
|
|
15
15
|
cursor: grab;
|
|
16
16
|
}
|
|
17
17
|
}
|
|
@@ -27,22 +27,39 @@
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
.block-editor-block-patterns-list__item-title {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
text-align: center;
|
|
30
|
+
text-align: left;
|
|
31
|
+
flex-grow: 1;
|
|
33
32
|
}
|
|
34
33
|
|
|
35
34
|
&:hover .block-editor-block-preview__container {
|
|
36
|
-
box-shadow: 0 0 0 2px
|
|
35
|
+
box-shadow: 0 0 0 2px $gray-900;
|
|
37
36
|
}
|
|
38
37
|
|
|
39
38
|
&:focus .block-editor-block-preview__container {
|
|
40
|
-
@include button-style-outset__focus(
|
|
39
|
+
@include button-style-outset__focus($gray-900);
|
|
41
40
|
}
|
|
42
41
|
|
|
42
|
+
&.block-editor-block-patterns-list__list-item-synced {
|
|
43
|
+
&:hover,
|
|
44
|
+
&:focus {
|
|
45
|
+
.block-editor-block-preview__container {
|
|
46
|
+
box-shadow:
|
|
47
|
+
0 0 0 2px var(--wp-block-synced-color),
|
|
48
|
+
0 15px 25px rgb(0 0 0 / 7%);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.block-editor-patterns__pattern-details {
|
|
54
|
+
align-items: center;
|
|
55
|
+
margin-top: $grid-unit-10;
|
|
56
|
+
}
|
|
43
57
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
58
|
+
.block-editor-patterns__pattern-icon-wrapper {
|
|
59
|
+
min-width: 24px;
|
|
60
|
+
height: 24px;
|
|
61
|
+
.block-editor-patterns__pattern-icon {
|
|
62
|
+
fill: var(--wp-block-synced-color);
|
|
63
|
+
}
|
|
47
64
|
}
|
|
48
65
|
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import {
|
|
5
|
+
__experimentalVStack as VStack,
|
|
6
|
+
__experimentalHStack as HStack,
|
|
7
|
+
__experimentalText as Text,
|
|
8
|
+
Button,
|
|
9
|
+
} from '@wordpress/components';
|
|
10
|
+
import { __, _x, _n, sprintf } from '@wordpress/i18n';
|
|
11
|
+
|
|
12
|
+
export default function Pagination( {
|
|
13
|
+
currentPage,
|
|
14
|
+
numPages,
|
|
15
|
+
changePage,
|
|
16
|
+
totalItems,
|
|
17
|
+
} ) {
|
|
18
|
+
return (
|
|
19
|
+
<VStack>
|
|
20
|
+
<Text variant="muted">
|
|
21
|
+
{
|
|
22
|
+
// translators: %s: Total number of patterns.
|
|
23
|
+
sprintf(
|
|
24
|
+
// translators: %s: Total number of patterns.
|
|
25
|
+
_n( '%s item', '%s items', totalItems ),
|
|
26
|
+
totalItems
|
|
27
|
+
)
|
|
28
|
+
}
|
|
29
|
+
</Text>
|
|
30
|
+
<HStack
|
|
31
|
+
expanded={ false }
|
|
32
|
+
spacing={ 3 }
|
|
33
|
+
justify="flex-start"
|
|
34
|
+
className="block-editor-patterns__grid-pagination"
|
|
35
|
+
>
|
|
36
|
+
<HStack
|
|
37
|
+
expanded={ false }
|
|
38
|
+
spacing={ 1 }
|
|
39
|
+
className="block-editor-patterns__grid-pagination-previous"
|
|
40
|
+
>
|
|
41
|
+
<Button
|
|
42
|
+
variant="tertiary"
|
|
43
|
+
onClick={ () => changePage( 1 ) }
|
|
44
|
+
disabled={ currentPage === 1 }
|
|
45
|
+
aria-label={ __( 'First page' ) }
|
|
46
|
+
>
|
|
47
|
+
<span>«</span>
|
|
48
|
+
</Button>
|
|
49
|
+
<Button
|
|
50
|
+
variant="tertiary"
|
|
51
|
+
onClick={ () => changePage( currentPage - 1 ) }
|
|
52
|
+
disabled={ currentPage === 1 }
|
|
53
|
+
aria-label={ __( 'Previous page' ) }
|
|
54
|
+
>
|
|
55
|
+
<span>‹</span>
|
|
56
|
+
</Button>
|
|
57
|
+
</HStack>
|
|
58
|
+
<Text variant="muted">
|
|
59
|
+
{ sprintf(
|
|
60
|
+
// translators: %1$s: Current page number, %2$s: Total number of pages.
|
|
61
|
+
_x( '%1$s of %2$s', 'paging' ),
|
|
62
|
+
currentPage,
|
|
63
|
+
numPages
|
|
64
|
+
) }
|
|
65
|
+
</Text>
|
|
66
|
+
<HStack
|
|
67
|
+
expanded={ false }
|
|
68
|
+
spacing={ 1 }
|
|
69
|
+
className="block-editor-patterns__grid-pagination-next"
|
|
70
|
+
>
|
|
71
|
+
<Button
|
|
72
|
+
variant="tertiary"
|
|
73
|
+
onClick={ () => changePage( currentPage + 1 ) }
|
|
74
|
+
disabled={ currentPage === numPages }
|
|
75
|
+
aria-label={ __( 'Next page' ) }
|
|
76
|
+
>
|
|
77
|
+
<span>›</span>
|
|
78
|
+
</Button>
|
|
79
|
+
<Button
|
|
80
|
+
variant="tertiary"
|
|
81
|
+
onClick={ () => changePage( numPages ) }
|
|
82
|
+
disabled={ currentPage === numPages }
|
|
83
|
+
aria-label={ __( 'Last page' ) }
|
|
84
|
+
size="default"
|
|
85
|
+
>
|
|
86
|
+
<span>»</span>
|
|
87
|
+
</Button>
|
|
88
|
+
</HStack>
|
|
89
|
+
</HStack>
|
|
90
|
+
</VStack>
|
|
91
|
+
);
|
|
92
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
.block-editor-patterns__grid-pagination {
|
|
2
|
+
border-top: 1px solid $gray-800;
|
|
3
|
+
padding: $grid-unit-05;
|
|
4
|
+
|
|
5
|
+
.components-button.is-tertiary {
|
|
6
|
+
width: auto;
|
|
7
|
+
height: $button-size-compact;
|
|
8
|
+
justify-content: center;
|
|
9
|
+
|
|
10
|
+
&:disabled {
|
|
11
|
+
color: $gray-600;
|
|
12
|
+
background: none;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
&:hover:not(:disabled) {
|
|
16
|
+
color: $white;
|
|
17
|
+
background-color: $gray-700;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.show-icon-labels {
|
|
23
|
+
.block-editor-patterns__grid-pagination {
|
|
24
|
+
flex-direction: column;
|
|
25
|
+
.block-editor-patterns__grid-pagination-previous,
|
|
26
|
+
.block-editor-patterns__grid-pagination-next {
|
|
27
|
+
flex-direction: column;
|
|
28
|
+
}
|
|
29
|
+
.components-button {
|
|
30
|
+
width: auto;
|
|
31
|
+
// Hide the button icons when labels are set to display...
|
|
32
|
+
span {
|
|
33
|
+
display: none;
|
|
34
|
+
}
|
|
35
|
+
// ... and display labels.
|
|
36
|
+
// Uses ::before as ::after is already used for active tab styling.
|
|
37
|
+
&::before {
|
|
38
|
+
content: attr(aria-label);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -31,6 +31,7 @@ import BlockHTMLConvertButton from './block-html-convert-button';
|
|
|
31
31
|
import __unstableBlockSettingsMenuFirstItem from './block-settings-menu-first-item';
|
|
32
32
|
import BlockSettingsMenuControls from '../block-settings-menu-controls';
|
|
33
33
|
import { store as blockEditorStore } from '../../store';
|
|
34
|
+
import { unlock } from '../../lock-unlock';
|
|
34
35
|
import { useShowHoveredOrFocusedGestures } from '../block-toolbar/utils';
|
|
35
36
|
|
|
36
37
|
const POPOVER_PROPS = {
|
|
@@ -47,12 +48,15 @@ function CopyMenuItem( { blocks, onCopy, label } ) {
|
|
|
47
48
|
}
|
|
48
49
|
|
|
49
50
|
export function BlockSettingsDropdown( {
|
|
51
|
+
block,
|
|
50
52
|
clientIds,
|
|
51
53
|
__experimentalSelectBlock,
|
|
52
54
|
children,
|
|
53
55
|
__unstableDisplayLocation,
|
|
54
56
|
...props
|
|
55
57
|
} ) {
|
|
58
|
+
// Get the client id of the current block for this menu, if one is set.
|
|
59
|
+
const currentClientId = block?.clientId;
|
|
56
60
|
const blockClientIds = Array.isArray( clientIds )
|
|
57
61
|
? clientIds
|
|
58
62
|
: [ clientIds ];
|
|
@@ -102,6 +106,16 @@ export function BlockSettingsDropdown( {
|
|
|
102
106
|
const { getBlockOrder, getSelectedBlockClientIds } =
|
|
103
107
|
useSelect( blockEditorStore );
|
|
104
108
|
|
|
109
|
+
const openedBlockSettingsMenu = useSelect(
|
|
110
|
+
( select ) =>
|
|
111
|
+
unlock( select( blockEditorStore ) ).getOpenedBlockSettingsMenu(),
|
|
112
|
+
[]
|
|
113
|
+
);
|
|
114
|
+
|
|
115
|
+
const { setOpenedBlockSettingsMenu } = unlock(
|
|
116
|
+
useDispatch( blockEditorStore )
|
|
117
|
+
);
|
|
118
|
+
|
|
105
119
|
const shortcuts = useSelect( ( select ) => {
|
|
106
120
|
const { getShortcutRepresentation } = select( keyboardShortcutsStore );
|
|
107
121
|
return {
|
|
@@ -174,6 +188,32 @@ export function BlockSettingsDropdown( {
|
|
|
174
188
|
const parentBlockIsSelected =
|
|
175
189
|
selectedBlockClientIds?.includes( firstParentClientId );
|
|
176
190
|
|
|
191
|
+
// When a currentClientId is in use, treat the menu as a controlled component.
|
|
192
|
+
// This ensures that only one block settings menu is open at a time.
|
|
193
|
+
// This is a temporary solution to work around an issue with `onFocusOutside`
|
|
194
|
+
// where it does not allow a dropdown to be closed if focus was never within
|
|
195
|
+
// the dropdown to begin with. Examples include a user either CMD+Clicking or
|
|
196
|
+
// right clicking into an inactive window.
|
|
197
|
+
// See: https://github.com/WordPress/gutenberg/pull/54083
|
|
198
|
+
const open = ! currentClientId
|
|
199
|
+
? undefined
|
|
200
|
+
: openedBlockSettingsMenu === currentClientId || false;
|
|
201
|
+
|
|
202
|
+
const onToggle = useCallback(
|
|
203
|
+
( localOpen ) => {
|
|
204
|
+
if ( localOpen && openedBlockSettingsMenu !== currentClientId ) {
|
|
205
|
+
setOpenedBlockSettingsMenu( currentClientId );
|
|
206
|
+
} else if (
|
|
207
|
+
! localOpen &&
|
|
208
|
+
openedBlockSettingsMenu &&
|
|
209
|
+
openedBlockSettingsMenu === currentClientId
|
|
210
|
+
) {
|
|
211
|
+
setOpenedBlockSettingsMenu( undefined );
|
|
212
|
+
}
|
|
213
|
+
},
|
|
214
|
+
[ currentClientId, openedBlockSettingsMenu, setOpenedBlockSettingsMenu ]
|
|
215
|
+
);
|
|
216
|
+
|
|
177
217
|
return (
|
|
178
218
|
<BlockActions
|
|
179
219
|
clientIds={ clientIds }
|
|
@@ -199,6 +239,8 @@ export function BlockSettingsDropdown( {
|
|
|
199
239
|
label={ __( 'Options' ) }
|
|
200
240
|
className="block-editor-block-settings-menu"
|
|
201
241
|
popoverProps={ POPOVER_PROPS }
|
|
242
|
+
open={ open }
|
|
243
|
+
onToggle={ onToggle }
|
|
202
244
|
noIcons
|
|
203
245
|
menuProps={ {
|
|
204
246
|
/**
|
|
@@ -230,6 +272,7 @@ export function BlockSettingsDropdown( {
|
|
|
230
272
|
canInsertDefaultBlock
|
|
231
273
|
) {
|
|
232
274
|
event.preventDefault();
|
|
275
|
+
setOpenedBlockSettingsMenu( undefined );
|
|
233
276
|
onInsertAfter();
|
|
234
277
|
} else if (
|
|
235
278
|
isMatch(
|
|
@@ -239,6 +282,7 @@ export function BlockSettingsDropdown( {
|
|
|
239
282
|
canInsertDefaultBlock
|
|
240
283
|
) {
|
|
241
284
|
event.preventDefault();
|
|
285
|
+
setOpenedBlockSettingsMenu( undefined );
|
|
242
286
|
onInsertBefore();
|
|
243
287
|
}
|
|
244
288
|
},
|
|
@@ -29,19 +29,15 @@ const BlockSettingsMenuControlsSlot = ( {
|
|
|
29
29
|
clientIds = null,
|
|
30
30
|
__unstableDisplayLocation,
|
|
31
31
|
} ) => {
|
|
32
|
-
const { selectedBlocks, selectedClientIds
|
|
32
|
+
const { selectedBlocks, selectedClientIds } = useSelect(
|
|
33
33
|
( select ) => {
|
|
34
|
-
const {
|
|
35
|
-
|
|
36
|
-
getSelectedBlockClientIds,
|
|
37
|
-
canRemoveBlocks,
|
|
38
|
-
} = select( blockEditorStore );
|
|
34
|
+
const { getBlockNamesByClientId, getSelectedBlockClientIds } =
|
|
35
|
+
select( blockEditorStore );
|
|
39
36
|
const ids =
|
|
40
37
|
clientIds !== null ? clientIds : getSelectedBlockClientIds();
|
|
41
38
|
return {
|
|
42
39
|
selectedBlocks: getBlockNamesByClientId( ids ),
|
|
43
40
|
selectedClientIds: ids,
|
|
44
|
-
canRemove: canRemoveBlocks( ids ),
|
|
45
41
|
};
|
|
46
42
|
},
|
|
47
43
|
[ clientIds ]
|
|
@@ -55,8 +51,7 @@ const BlockSettingsMenuControlsSlot = ( {
|
|
|
55
51
|
const convertToGroupButtonProps =
|
|
56
52
|
useConvertToGroupButtonProps( selectedClientIds );
|
|
57
53
|
const { isGroupable, isUngroupable } = convertToGroupButtonProps;
|
|
58
|
-
const showConvertToGroupButton =
|
|
59
|
-
( isGroupable || isUngroupable ) && canRemove;
|
|
54
|
+
const showConvertToGroupButton = isGroupable || isUngroupable;
|
|
60
55
|
|
|
61
56
|
return (
|
|
62
57
|
<Slot
|
|
@@ -36,13 +36,13 @@
|
|
|
36
36
|
|
|
37
37
|
button.components-button.block-editor-block-styles__item {
|
|
38
38
|
color: $gray-900;
|
|
39
|
-
box-shadow: inset 0 0 0
|
|
39
|
+
box-shadow: inset 0 0 0 $border-width $gray-300;
|
|
40
40
|
display: inline-block;
|
|
41
41
|
width: calc(50% - #{$grid-unit-05});
|
|
42
42
|
|
|
43
43
|
&:hover {
|
|
44
44
|
color: var(--wp-admin-theme-color);
|
|
45
|
-
box-shadow: inset 0 0 0
|
|
45
|
+
box-shadow: inset 0 0 0 $border-width $gray-300;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
&.is-active,
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
|
|
59
59
|
&:focus,
|
|
60
60
|
&.is-active:focus {
|
|
61
|
-
|
|
61
|
+
box-shadow: inset 0 0 0 $border-width var(--wp-components-color-background, #fff), 0 0 0 var(--wp-admin-border-width-focus) var(--wp-components-color-accent, var(--wp-admin-theme-color, #3858e9));
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
|
|
@@ -60,7 +60,6 @@ const BlockActionsMenu = ( {
|
|
|
60
60
|
rootClientId,
|
|
61
61
|
selectedBlockClientId,
|
|
62
62
|
selectedBlockPossibleTransformations,
|
|
63
|
-
canRemove,
|
|
64
63
|
// Dispatch.
|
|
65
64
|
createSuccessNotice,
|
|
66
65
|
convertToRegularBlocks,
|
|
@@ -106,8 +105,7 @@ const BlockActionsMenu = ( {
|
|
|
106
105
|
selectedBlockClientId ? [ selectedBlockClientId ] : []
|
|
107
106
|
);
|
|
108
107
|
const { isGroupable, isUngroupable } = convertToGroupButtonProps;
|
|
109
|
-
const showConvertToGroupButton =
|
|
110
|
-
( isGroupable || isUngroupable ) && canRemove;
|
|
108
|
+
const showConvertToGroupButton = isGroupable || isUngroupable;
|
|
111
109
|
const convertToGroupButtons = useConvertToGroupButtons( {
|
|
112
110
|
...convertToGroupButtonProps,
|
|
113
111
|
} );
|
|
@@ -348,7 +346,6 @@ export default compose(
|
|
|
348
346
|
getSelectedBlockClientIds,
|
|
349
347
|
canInsertBlockType,
|
|
350
348
|
getTemplateLock,
|
|
351
|
-
canRemoveBlock,
|
|
352
349
|
} = select( blockEditorStore );
|
|
353
350
|
const block = getBlock( clientId );
|
|
354
351
|
const blockName = getBlockName( clientId );
|
|
@@ -385,7 +382,6 @@ export default compose(
|
|
|
385
382
|
const selectedBlockPossibleTransformations = selectedBlock
|
|
386
383
|
? getBlockTransformItems( selectedBlock, rootClientId )
|
|
387
384
|
: EMPTY_BLOCK_LIST;
|
|
388
|
-
const canRemove = canRemoveBlock( selectedBlockClientId );
|
|
389
385
|
|
|
390
386
|
const isReusableBlockType = block ? isReusableBlock( block ) : false;
|
|
391
387
|
const reusableBlock = isReusableBlockType
|
|
@@ -411,7 +407,6 @@ export default compose(
|
|
|
411
407
|
rootClientId,
|
|
412
408
|
selectedBlockClientId,
|
|
413
409
|
selectedBlockPossibleTransformations,
|
|
414
|
-
canRemove,
|
|
415
410
|
};
|
|
416
411
|
} ),
|
|
417
412
|
withDispatch(
|
|
@@ -86,9 +86,15 @@ function BlockContextualToolbar( { focusOnMount, isFixed, ...props } ) {
|
|
|
86
86
|
const isFullscreen =
|
|
87
87
|
document.body.classList.contains( 'is-fullscreen-mode' );
|
|
88
88
|
|
|
89
|
+
/**
|
|
90
|
+
* The following code is a workaround to fix the width of the toolbar
|
|
91
|
+
* it should be removed when the toolbar will be rendered inline
|
|
92
|
+
* FIXME: remove this layout effect when the toolbar is no longer
|
|
93
|
+
* absolutely positioned
|
|
94
|
+
*/
|
|
89
95
|
useLayoutEffect( () => {
|
|
90
96
|
// don't do anything if not fixed toolbar
|
|
91
|
-
if ( ! isFixed
|
|
97
|
+
if ( ! isFixed ) {
|
|
92
98
|
return;
|
|
93
99
|
}
|
|
94
100
|
|
|
@@ -100,6 +106,11 @@ function BlockContextualToolbar( { focusOnMount, isFixed, ...props } ) {
|
|
|
100
106
|
return;
|
|
101
107
|
}
|
|
102
108
|
|
|
109
|
+
if ( ! blockType ) {
|
|
110
|
+
blockToolbar.style.width = 'initial';
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
|
|
103
114
|
if ( ! isLargerThanTabletViewport ) {
|
|
104
115
|
// set the width of the toolbar to auto
|
|
105
116
|
blockToolbar.style = {};
|
|
@@ -112,11 +123,10 @@ function BlockContextualToolbar( { focusOnMount, isFixed, ...props } ) {
|
|
|
112
123
|
return;
|
|
113
124
|
}
|
|
114
125
|
|
|
115
|
-
// get the width of the pinned items in the post editor
|
|
126
|
+
// get the width of the pinned items in the post editor or widget editor
|
|
116
127
|
const pinnedItems = document.querySelector(
|
|
117
|
-
'.edit-post-header__settings'
|
|
128
|
+
'.edit-post-header__settings, .edit-widgets-header__actions'
|
|
118
129
|
);
|
|
119
|
-
|
|
120
130
|
// get the width of the left header in the site editor
|
|
121
131
|
const leftHeader = document.querySelector(
|
|
122
132
|
'.edit-site-header-edit-mode__end'
|
|
@@ -132,7 +142,7 @@ function BlockContextualToolbar( { focusOnMount, isFixed, ...props } ) {
|
|
|
132
142
|
|
|
133
143
|
const marginLeft = parseFloat( computedToolbarStyle.marginLeft );
|
|
134
144
|
const pinnedItemsWidth = computedPinnedItemsStyle
|
|
135
|
-
? parseFloat( computedPinnedItemsStyle.width )
|
|
145
|
+
? parseFloat( computedPinnedItemsStyle.width )
|
|
136
146
|
: 0;
|
|
137
147
|
const leftHeaderWidth = computedLeftHeaderStyle
|
|
138
148
|
? parseFloat( computedLeftHeaderStyle.width )
|
|
@@ -143,6 +153,7 @@ function BlockContextualToolbar( { focusOnMount, isFixed, ...props } ) {
|
|
|
143
153
|
leftHeaderWidth +
|
|
144
154
|
pinnedItemsWidth +
|
|
145
155
|
marginLeft +
|
|
156
|
+
( pinnedItems || leftHeader ? 2 : 0 ) + // Prevents button focus border from being cut off
|
|
146
157
|
( isFullscreen ? 0 : 160 ) // the width of the admin sidebar expanded
|
|
147
158
|
}px)`;
|
|
148
159
|
}, [
|
|
@@ -165,7 +165,7 @@ function BlockSelectionButton( { clientId, rootClientId } ) {
|
|
|
165
165
|
selectedBlockClientId;
|
|
166
166
|
} else if ( navigateIn ) {
|
|
167
167
|
focusedBlockUid =
|
|
168
|
-
getClientIdsOfDescendants(
|
|
168
|
+
getClientIdsOfDescendants( selectedBlockClientId )[ 0 ] ??
|
|
169
169
|
selectedBlockClientId;
|
|
170
170
|
}
|
|
171
171
|
const startingBlockClientId = hasBlockMovingClientId();
|
|
@@ -193,6 +193,14 @@ function BlockSelectionButton( { clientId, rootClientId } ) {
|
|
|
193
193
|
selectBlock( startingBlockClientId );
|
|
194
194
|
setBlockMovingClientId( null );
|
|
195
195
|
}
|
|
196
|
+
// Prevent the block from being moved into itself.
|
|
197
|
+
if (
|
|
198
|
+
startingBlockClientId &&
|
|
199
|
+
selectedBlockClientId === startingBlockClientId &&
|
|
200
|
+
navigateIn
|
|
201
|
+
) {
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
196
204
|
if ( navigateDown || navigateUp || navigateOut || navigateIn ) {
|
|
197
205
|
if ( focusedBlockUid ) {
|
|
198
206
|
event.preventDefault();
|