@wordpress/block-editor 12.21.0 → 12.23.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 +4 -0
- package/build/components/block-actions/index.js +2 -4
- package/build/components/block-actions/index.js.map +1 -1
- package/build/components/block-heading-level-dropdown/index.js +5 -5
- package/build/components/block-heading-level-dropdown/index.js.map +1 -1
- package/build/components/block-heading-level-dropdown/index.native.js +5 -4
- package/build/components/block-heading-level-dropdown/index.native.js.map +1 -1
- package/build/components/block-list/block-crash-boundary.native.js +49 -0
- package/build/components/block-list/block-crash-boundary.native.js.map +1 -0
- package/build/components/block-list/block-crash-warning.native.js +24 -0
- package/build/components/block-list/block-crash-warning.native.js.map +1 -0
- package/build/components/block-list/block.js +11 -3
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/block.native.js +7 -2
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-mover/button.js +4 -1
- package/build/components/block-mover/button.js.map +1 -1
- package/build/components/block-mover/index.js +5 -1
- package/build/components/block-mover/index.js.map +1 -1
- package/build/components/block-patterns-list/index.js +4 -1
- package/build/components/block-patterns-list/index.js.map +1 -1
- package/build/components/block-settings/container.native.js +2 -1
- package/build/components/block-settings/container.native.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +36 -32
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-settings-menu-controls/index.js +1 -3
- package/build/components/block-settings-menu-controls/index.js.map +1 -1
- package/build/components/block-switcher/index.js +4 -3
- package/build/components/block-switcher/index.js.map +1 -1
- package/build/components/block-toolbar/index.js +8 -5
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-toolbar/shuffle.js +19 -10
- package/build/components/block-toolbar/shuffle.js.map +1 -1
- package/build/components/block-tools/block-selection-button.js +48 -8
- package/build/components/block-tools/block-selection-button.js.map +1 -1
- package/build/components/block-tools/index.js +14 -2
- package/build/components/block-tools/index.js.map +1 -1
- package/build/components/child-layout-control/index.js +108 -11
- package/build/components/child-layout-control/index.js.map +1 -1
- package/build/components/convert-to-group-buttons/toolbar.js +11 -0
- package/build/components/convert-to-group-buttons/toolbar.js.map +1 -1
- package/build/components/global-styles/advanced-panel.js +9 -2
- package/build/components/global-styles/advanced-panel.js.map +1 -1
- package/build/components/global-styles/background-panel.js +444 -0
- package/build/components/global-styles/background-panel.js.map +1 -0
- package/build/components/global-styles/color-panel.js +2 -1
- package/build/components/global-styles/color-panel.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +8 -33
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/get-global-styles-changes.js +3 -0
- package/build/components/global-styles/get-global-styles-changes.js.map +1 -1
- package/build/components/global-styles/hooks.js +1 -1
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/index.js +13 -0
- package/build/components/global-styles/index.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +16 -15
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js +2 -3
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/iframe/index.js +43 -34
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/inserter/block-patterns-explorer/index.js +3 -6
- package/build/components/inserter/block-patterns-explorer/index.js.map +1 -1
- package/build/components/inserter/block-patterns-explorer/pattern-list.js +3 -1
- package/build/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/index.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +5 -0
- package/build/components/inserter/block-patterns-tab/pattern-category-preview-panel.js.map +1 -1
- package/build/components/inserter/library.js +2 -0
- package/build/components/inserter/library.js.map +1 -1
- package/build/components/inserter/menu.js +11 -11
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/mobile-tab-navigation.js +1 -1
- package/build/components/inserter/mobile-tab-navigation.js.map +1 -1
- package/build/components/inserter/search-items.js +36 -15
- package/build/components/inserter/search-items.js.map +1 -1
- package/build/components/inserter/search-results.js +2 -3
- package/build/components/inserter/search-results.js.map +1 -1
- package/build/components/inserter/tabs.js +1 -2
- package/build/components/inserter/tabs.js.map +1 -1
- package/build/components/inspector-controls-tabs/advanced-controls-panel.native.js +36 -0
- package/build/components/inspector-controls-tabs/advanced-controls-panel.native.js.map +1 -0
- package/build/components/keyboard-shortcuts/index.js +11 -0
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/list-view/block-select-button.js +18 -12
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/list-view/block.js +4 -11
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/index.js +17 -2
- package/build/components/list-view/index.js.map +1 -1
- package/build/components/list-view/use-list-view-collapse-items.js +47 -0
- package/build/components/list-view/use-list-view-collapse-items.js.map +1 -0
- package/build/components/list-view/utils.js +5 -3
- package/build/components/list-view/utils.js.map +1 -1
- package/build/components/rich-text/index.js +14 -11
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/index.native.js +17 -11
- package/build/components/rich-text/index.native.js.map +1 -1
- package/build/components/rich-text/native/get-format-colors.native.js +1 -1
- package/build/components/rich-text/native/get-format-colors.native.js.map +1 -1
- package/build/components/rich-text/native/index.native.js +2 -2
- package/build/components/rich-text/native/index.native.js.map +1 -1
- package/build/components/rich-text/with-deprecations.js +0 -3
- package/build/components/rich-text/with-deprecations.js.map +1 -1
- package/build/components/spacing-sizes-control/sides-dropdown/index.js +1 -1
- package/build/components/spacing-sizes-control/sides-dropdown/index.js.map +1 -1
- package/build/components/url-popover/image-url-input-ui.js +50 -36
- package/build/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build/components/use-block-display-information/index.js +4 -6
- package/build/components/use-block-display-information/index.js.map +1 -1
- package/build/components/use-moving-animation/index.js +4 -0
- package/build/components/use-moving-animation/index.js.map +1 -1
- package/build/components/warning/index.native.js +9 -4
- package/build/components/warning/index.native.js.map +1 -1
- package/build/hooks/anchor.js +9 -10
- package/build/hooks/anchor.js.map +1 -1
- package/build/hooks/background.js +85 -402
- package/build/hooks/background.js.map +1 -1
- package/build/hooks/index.js +9 -1
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/layout-child.js +28 -6
- package/build/hooks/layout-child.js.map +1 -1
- package/build/hooks/layout.js +21 -10
- 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/use-zoom-out.js +47 -0
- package/build/hooks/use-zoom-out.js.map +1 -0
- package/build/index.js +7 -0
- package/build/index.js.map +1 -1
- package/build/private-apis.js +6 -1
- package/build/private-apis.js.map +1 -1
- package/build/private-apis.native.js +5 -1
- package/build/private-apis.native.js.map +1 -1
- package/build/store/private-actions.js +13 -0
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-keys.js +2 -1
- package/build/store/private-keys.js.map +1 -1
- package/build/store/private-selectors.js +24 -3
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +53 -26
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +34 -32
- package/build/store/selectors.js.map +1 -1
- package/build/store/utils.js +7 -1
- package/build/store/utils.js.map +1 -1
- package/build/utils/transform-styles/index.js +2 -1
- package/build/utils/transform-styles/index.js.map +1 -1
- package/build-module/components/block-actions/index.js +2 -4
- package/build-module/components/block-actions/index.js.map +1 -1
- package/build-module/components/block-heading-level-dropdown/index.js +5 -5
- package/build-module/components/block-heading-level-dropdown/index.js.map +1 -1
- package/build-module/components/block-heading-level-dropdown/index.native.js +5 -4
- package/build-module/components/block-heading-level-dropdown/index.native.js.map +1 -1
- package/build-module/components/block-list/block-crash-boundary.native.js +42 -0
- package/build-module/components/block-list/block-crash-boundary.native.js.map +1 -0
- package/build-module/components/block-list/block-crash-warning.native.js +15 -0
- package/build-module/components/block-list/block-crash-warning.native.js.map +1 -0
- package/build-module/components/block-list/block.js +11 -3
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/block.native.js +7 -2
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-mover/button.js +4 -1
- package/build-module/components/block-mover/button.js.map +1 -1
- package/build-module/components/block-mover/index.js +5 -1
- package/build-module/components/block-mover/index.js.map +1 -1
- package/build-module/components/block-patterns-list/index.js +4 -1
- package/build-module/components/block-patterns-list/index.js.map +1 -1
- package/build-module/components/block-settings/container.native.js +3 -2
- package/build-module/components/block-settings/container.native.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +37 -33
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-settings-menu-controls/index.js +1 -3
- package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
- package/build-module/components/block-switcher/index.js +4 -3
- package/build-module/components/block-switcher/index.js.map +1 -1
- package/build-module/components/block-toolbar/index.js +8 -5
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-toolbar/shuffle.js +19 -10
- package/build-module/components/block-toolbar/shuffle.js.map +1 -1
- package/build-module/components/block-tools/block-selection-button.js +50 -10
- package/build-module/components/block-tools/block-selection-button.js.map +1 -1
- package/build-module/components/block-tools/index.js +14 -2
- package/build-module/components/block-tools/index.js.map +1 -1
- package/build-module/components/child-layout-control/index.js +109 -12
- package/build-module/components/child-layout-control/index.js.map +1 -1
- package/build-module/components/convert-to-group-buttons/toolbar.js +12 -1
- package/build-module/components/convert-to-group-buttons/toolbar.js.map +1 -1
- package/build-module/components/global-styles/advanced-panel.js +9 -2
- package/build-module/components/global-styles/advanced-panel.js.map +1 -1
- package/build-module/components/global-styles/background-panel.js +430 -0
- package/build-module/components/global-styles/background-panel.js.map +1 -0
- package/build-module/components/global-styles/color-panel.js +2 -1
- package/build-module/components/global-styles/color-panel.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +9 -34
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/get-global-styles-changes.js +3 -0
- package/build-module/components/global-styles/get-global-styles-changes.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +1 -1
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/index.js +1 -0
- package/build-module/components/global-styles/index.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +17 -16
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js +1 -2
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/iframe/index.js +43 -34
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/inserter/block-patterns-explorer/index.js +3 -6
- package/build-module/components/inserter/block-patterns-explorer/index.js.map +1 -1
- package/build-module/components/inserter/block-patterns-explorer/pattern-list.js +3 -1
- package/build-module/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/index.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +5 -0
- package/build-module/components/inserter/block-patterns-tab/pattern-category-preview-panel.js.map +1 -1
- package/build-module/components/inserter/library.js +2 -0
- package/build-module/components/inserter/library.js.map +1 -1
- package/build-module/components/inserter/menu.js +11 -11
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/mobile-tab-navigation.js +1 -1
- package/build-module/components/inserter/mobile-tab-navigation.js.map +1 -1
- package/build-module/components/inserter/search-items.js +33 -15
- package/build-module/components/inserter/search-items.js.map +1 -1
- package/build-module/components/inserter/search-results.js +2 -3
- package/build-module/components/inserter/search-results.js.map +1 -1
- package/build-module/components/inserter/tabs.js +1 -2
- package/build-module/components/inserter/tabs.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/advanced-controls-panel.native.js +28 -0
- package/build-module/components/inspector-controls-tabs/advanced-controls-panel.native.js.map +1 -0
- package/build-module/components/keyboard-shortcuts/index.js +11 -0
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/list-view/block-select-button.js +19 -13
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/list-view/block.js +6 -13
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/index.js +17 -2
- package/build-module/components/list-view/index.js.map +1 -1
- package/build-module/components/list-view/use-list-view-collapse-items.js +40 -0
- package/build-module/components/list-view/use-list-view-collapse-items.js.map +1 -0
- package/build-module/components/list-view/utils.js +2 -1
- package/build-module/components/list-view/utils.js.map +1 -1
- package/build-module/components/rich-text/index.js +15 -12
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/index.native.js +16 -11
- package/build-module/components/rich-text/index.native.js.map +1 -1
- package/build-module/components/rich-text/native/get-format-colors.native.js +1 -1
- package/build-module/components/rich-text/native/get-format-colors.native.js.map +1 -1
- package/build-module/components/rich-text/native/index.native.js +2 -2
- package/build-module/components/rich-text/native/index.native.js.map +1 -1
- package/build-module/components/rich-text/with-deprecations.js +0 -3
- package/build-module/components/rich-text/with-deprecations.js.map +1 -1
- package/build-module/components/spacing-sizes-control/sides-dropdown/index.js +1 -1
- package/build-module/components/spacing-sizes-control/sides-dropdown/index.js.map +1 -1
- package/build-module/components/url-popover/image-url-input-ui.js +50 -36
- package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build-module/components/use-block-display-information/index.js +5 -7
- package/build-module/components/use-block-display-information/index.js.map +1 -1
- package/build-module/components/use-moving-animation/index.js +4 -0
- package/build-module/components/use-moving-animation/index.js.map +1 -1
- package/build-module/components/warning/index.native.js +9 -4
- package/build-module/components/warning/index.native.js.map +1 -1
- package/build-module/hooks/anchor.js +10 -11
- package/build-module/hooks/anchor.js.map +1 -1
- package/build-module/hooks/background.js +82 -397
- package/build-module/hooks/background.js.map +1 -1
- package/build-module/hooks/index.js +3 -1
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/layout-child.js +28 -6
- package/build-module/hooks/layout-child.js.map +1 -1
- package/build-module/hooks/layout.js +21 -10
- 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/use-zoom-out.js +41 -0
- package/build-module/hooks/use-zoom-out.js.map +1 -0
- package/build-module/index.js +1 -1
- package/build-module/index.js.map +1 -1
- package/build-module/private-apis.js +7 -2
- package/build-module/private-apis.js.map +1 -1
- package/build-module/private-apis.native.js +5 -1
- package/build-module/private-apis.native.js.map +1 -1
- package/build-module/store/private-actions.js +12 -0
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-keys.js +1 -0
- package/build-module/store/private-keys.js.map +1 -1
- package/build-module/store/private-selectors.js +22 -4
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +52 -26
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +35 -33
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/store/utils.js +6 -1
- package/build-module/store/utils.js.map +1 -1
- package/build-module/utils/transform-styles/index.js +2 -1
- package/build-module/utils/transform-styles/index.js.map +1 -1
- package/build-style/content-rtl.css +18 -1
- package/build-style/content.css +18 -1
- package/build-style/style-rtl.css +92 -99
- package/build-style/style.css +92 -99
- package/package.json +31 -31
- package/src/components/block-actions/index.js +2 -8
- package/src/components/block-bindings-toolbar-indicator/style.scss +10 -8
- package/src/components/block-heading-level-dropdown/README.md +5 -5
- package/src/components/block-heading-level-dropdown/index.js +5 -5
- package/src/components/block-heading-level-dropdown/index.native.js +5 -4
- package/src/components/block-list/block-crash-boundary.native.js +43 -0
- package/src/components/block-list/block-crash-warning.native.js +19 -0
- package/src/components/block-list/block.js +19 -3
- package/src/components/block-list/block.native.js +14 -7
- package/src/components/block-list/content.scss +16 -0
- package/src/components/block-mover/button.js +4 -1
- package/src/components/block-mover/index.js +8 -1
- package/src/components/block-patterns-list/index.js +22 -17
- package/src/components/block-preview/style.scss +28 -0
- package/src/components/block-settings/container.native.js +5 -1
- package/src/components/block-settings-menu/block-settings-dropdown.js +49 -58
- package/src/components/block-settings-menu-controls/README.md +0 -9
- package/src/components/block-settings-menu-controls/index.js +1 -6
- package/src/components/block-switcher/index.js +5 -3
- package/src/components/block-switcher/style.scss +1 -1
- package/src/components/block-toolbar/index.js +25 -20
- package/src/components/block-toolbar/shuffle.js +20 -14
- package/src/components/block-toolbar/style.scss +1 -1
- package/src/components/block-toolbar/test/index.native.js +1 -7
- package/src/components/block-tools/block-selection-button.js +66 -9
- package/src/components/block-tools/index.js +18 -1
- package/src/components/button-block-appender/content.scss +5 -1
- package/src/components/child-layout-control/index.js +147 -35
- package/src/components/convert-to-group-buttons/toolbar.js +13 -1
- package/src/components/default-block-appender/content.scss +2 -2
- package/src/components/global-styles/advanced-panel.js +8 -2
- package/src/components/global-styles/background-panel.js +591 -0
- package/src/components/global-styles/color-panel.js +2 -1
- package/src/components/global-styles/dimensions-panel.js +9 -34
- package/src/components/global-styles/get-global-styles-changes.js +3 -0
- package/src/components/global-styles/hooks.js +1 -0
- package/src/components/global-styles/index.js +4 -0
- package/src/components/global-styles/style.scss +78 -1
- package/src/{hooks/test/background.js → components/global-styles/test/background-panel.js} +36 -1
- package/src/components/global-styles/test/get-global-styles-changes.js +22 -3
- package/src/components/global-styles/test/use-global-styles-output.js +40 -9
- package/src/components/global-styles/use-global-styles-output.js +30 -17
- package/src/components/global-styles/utils.js +1 -18
- package/src/components/iframe/index.js +79 -53
- package/src/components/inserter/block-patterns-explorer/index.js +2 -9
- package/src/components/inserter/block-patterns-explorer/pattern-list.js +7 -1
- package/src/components/inserter/block-patterns-tab/index.js +1 -0
- package/src/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +5 -0
- package/src/components/inserter/library.js +4 -0
- package/src/components/inserter/menu.js +12 -11
- package/src/components/inserter/mobile-tab-navigation.js +1 -1
- package/src/components/inserter/search-items.js +37 -15
- package/src/components/inserter/search-results.js +1 -2
- package/src/components/inserter/style.scss +6 -12
- package/src/components/inserter/tabs.js +1 -2
- package/src/components/inspector-controls-tabs/advanced-controls-panel.native.js +31 -0
- package/src/components/keyboard-shortcuts/index.js +11 -0
- package/src/components/link-control/style.scss +0 -5
- package/src/components/list-view/block-select-button.js +15 -19
- package/src/components/list-view/block.js +12 -21
- package/src/components/list-view/index.js +18 -1
- package/src/components/list-view/style.scss +38 -28
- package/src/components/list-view/use-list-view-collapse-items.js +33 -0
- package/src/components/list-view/utils.js +4 -1
- package/src/components/rich-text/README.md +6 -0
- package/src/components/rich-text/index.js +30 -13
- package/src/components/rich-text/index.native.js +14 -11
- package/src/components/rich-text/native/get-format-colors.native.js +1 -1
- package/src/components/rich-text/native/index.native.js +2 -2
- package/src/components/rich-text/with-deprecations.js +0 -3
- package/src/components/spacing-sizes-control/sides-dropdown/index.js +1 -1
- package/src/components/url-popover/image-url-input-ui.js +68 -51
- package/src/components/use-block-display-information/index.js +8 -10
- package/src/components/use-moving-animation/index.js +1 -0
- package/src/components/warning/index.native.js +19 -15
- package/src/hooks/anchor.js +43 -61
- package/src/hooks/background.js +100 -516
- package/src/hooks/index.js +3 -0
- package/src/hooks/layout-child.js +44 -8
- package/src/hooks/layout.js +22 -18
- package/src/hooks/position.js +1 -1
- package/src/hooks/test/__snapshots__/anchor.native.js.snap +7 -0
- package/src/hooks/test/anchor.native.js +32 -0
- package/src/hooks/use-zoom-out.js +36 -0
- package/src/index.js +1 -0
- package/src/private-apis.js +13 -1
- package/src/private-apis.native.js +4 -0
- package/src/store/private-actions.js +12 -0
- package/src/store/private-keys.js +1 -0
- package/src/store/private-selectors.js +54 -27
- package/src/store/reducer.js +63 -41
- package/src/store/selectors.js +195 -180
- package/src/store/test/private-actions.js +10 -0
- package/src/store/test/private-selectors.js +13 -0
- package/src/store/test/reducer.js +26 -0
- package/src/store/test/selectors.js +90 -199
- package/src/store/utils.js +13 -0
- package/src/style.scss +0 -2
- package/src/utils/transform-styles/index.js +2 -1
- package/tsconfig.json +1 -0
- package/build/utils/calculate-scale.js +0 -17
- package/build/utils/calculate-scale.js.map +0 -1
- package/build-module/utils/calculate-scale.js +0 -11
- package/build-module/utils/calculate-scale.js.map +0 -1
- package/src/hooks/anchor.scss +0 -4
- package/src/hooks/background.scss +0 -75
- package/src/utils/calculate-scale.js +0 -20
|
@@ -19,7 +19,12 @@ import BlockDraggable from '../block-draggable';
|
|
|
19
19
|
import { BlockMoverUpButton, BlockMoverDownButton } from './button';
|
|
20
20
|
import { store as blockEditorStore } from '../../store';
|
|
21
21
|
|
|
22
|
-
function BlockMover( {
|
|
22
|
+
function BlockMover( {
|
|
23
|
+
clientIds,
|
|
24
|
+
hideDragHandle,
|
|
25
|
+
isBlockMoverUpButtonDisabled,
|
|
26
|
+
isBlockMoverDownButtonDisabled,
|
|
27
|
+
} ) {
|
|
23
28
|
const { canMove, rootClientId, isFirst, isLast, orientation } = useSelect(
|
|
24
29
|
( select ) => {
|
|
25
30
|
const {
|
|
@@ -83,6 +88,7 @@ function BlockMover( { clientIds, hideDragHandle } ) {
|
|
|
83
88
|
<ToolbarItem>
|
|
84
89
|
{ ( itemProps ) => (
|
|
85
90
|
<BlockMoverUpButton
|
|
91
|
+
disabled={ isBlockMoverUpButtonDisabled }
|
|
86
92
|
clientIds={ clientIds }
|
|
87
93
|
{ ...itemProps }
|
|
88
94
|
/>
|
|
@@ -91,6 +97,7 @@ function BlockMover( { clientIds, hideDragHandle } ) {
|
|
|
91
97
|
<ToolbarItem>
|
|
92
98
|
{ ( itemProps ) => (
|
|
93
99
|
<BlockMoverDownButton
|
|
100
|
+
disabled={ isBlockMoverDownButtonDisabled }
|
|
94
101
|
clientIds={ clientIds }
|
|
95
102
|
{ ...itemProps }
|
|
96
103
|
/>
|
|
@@ -45,6 +45,7 @@ function BlockPattern( {
|
|
|
45
45
|
pattern,
|
|
46
46
|
onClick,
|
|
47
47
|
onHover,
|
|
48
|
+
showTitle = true,
|
|
48
49
|
showTooltip,
|
|
49
50
|
} ) {
|
|
50
51
|
const [ isDragging, setIsDragging ] = useState( false );
|
|
@@ -122,25 +123,27 @@ function BlockPattern( {
|
|
|
122
123
|
viewportWidth={ viewportWidth }
|
|
123
124
|
/>
|
|
124
125
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
<
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
126
|
+
{ showTitle && (
|
|
127
|
+
<HStack className="block-editor-patterns__pattern-details">
|
|
128
|
+
{ pattern.type ===
|
|
129
|
+
INSERTER_PATTERN_TYPES.user &&
|
|
130
|
+
! pattern.syncStatus && (
|
|
131
|
+
<div className="block-editor-patterns__pattern-icon-wrapper">
|
|
132
|
+
<Icon
|
|
133
|
+
className="block-editor-patterns__pattern-icon"
|
|
134
|
+
icon={ symbol }
|
|
135
|
+
/>
|
|
136
|
+
</div>
|
|
137
|
+
) }
|
|
138
|
+
{ ( ! showTooltip ||
|
|
139
|
+
pattern.type ===
|
|
140
|
+
INSERTER_PATTERN_TYPES.user ) && (
|
|
141
|
+
<div className="block-editor-block-patterns-list__item-title">
|
|
142
|
+
{ pattern.title }
|
|
134
143
|
</div>
|
|
135
144
|
) }
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
INSERTER_PATTERN_TYPES.user ) && (
|
|
139
|
-
<div className="block-editor-block-patterns-list__item-title">
|
|
140
|
-
{ pattern.title }
|
|
141
|
-
</div>
|
|
142
|
-
) }
|
|
143
|
-
</HStack>
|
|
145
|
+
</HStack>
|
|
146
|
+
) }
|
|
144
147
|
|
|
145
148
|
{ !! pattern.description && (
|
|
146
149
|
<VisuallyHidden id={ descriptionId }>
|
|
@@ -170,6 +173,7 @@ function BlockPatternsList(
|
|
|
170
173
|
onClickPattern,
|
|
171
174
|
orientation,
|
|
172
175
|
label = __( 'Block patterns' ),
|
|
176
|
+
showTitle = true,
|
|
173
177
|
showTitlesAsTooltip,
|
|
174
178
|
pagingProps,
|
|
175
179
|
},
|
|
@@ -203,6 +207,7 @@ function BlockPatternsList(
|
|
|
203
207
|
onClick={ onClickPattern }
|
|
204
208
|
onHover={ onHover }
|
|
205
209
|
isDraggable={ isDraggable }
|
|
210
|
+
showTitle={ showTitle }
|
|
206
211
|
showTooltip={ showTitlesAsTooltip }
|
|
207
212
|
/>
|
|
208
213
|
) : (
|
|
@@ -48,3 +48,31 @@
|
|
|
48
48
|
bottom: 0;
|
|
49
49
|
z-index: 1;
|
|
50
50
|
}
|
|
51
|
+
|
|
52
|
+
// Restrict these shadows to the context of the inspector.
|
|
53
|
+
.interface-interface-skeleton__sidebar {
|
|
54
|
+
.block-editor-block-patterns-list__list-item {
|
|
55
|
+
.block-editor-block-preview__container {
|
|
56
|
+
box-shadow: 0 0 $border-width rgba($black, 0.1);
|
|
57
|
+
}
|
|
58
|
+
&:hover {
|
|
59
|
+
.block-editor-block-preview__container {
|
|
60
|
+
box-shadow: 0 0 0 2px $gray-900;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// Restrict these shadows to the context of the inserter.
|
|
67
|
+
.editor-inserter-sidebar {
|
|
68
|
+
.block-editor-block-patterns-list__list-item {
|
|
69
|
+
.block-editor-block-preview__container {
|
|
70
|
+
box-shadow: 0 15px 25px rgb(0 0 0 / 7%);
|
|
71
|
+
}
|
|
72
|
+
&:hover {
|
|
73
|
+
.block-editor-block-preview__container {
|
|
74
|
+
box-shadow: 0 0 0 2px $gray-900, 0 15px 25px rgb(0 0 0 / 7%);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -16,6 +16,7 @@ import styles from './container.native.scss';
|
|
|
16
16
|
import InspectorControls from '../inspector-controls';
|
|
17
17
|
import ImageLinkDestinationsScreen from '../image-link-destinations';
|
|
18
18
|
import useMultipleOriginColorsAndGradients from '../colors-gradients/use-multiple-origin-colors-and-gradients';
|
|
19
|
+
import AdvancedControls from '../inspector-controls-tabs/advanced-controls-panel';
|
|
19
20
|
|
|
20
21
|
export const blockSettingsScreens = {
|
|
21
22
|
settings: 'Settings',
|
|
@@ -46,7 +47,10 @@ export default function BottomSheetSettings( props ) {
|
|
|
46
47
|
<BottomSheet.NavigationScreen
|
|
47
48
|
name={ blockSettingsScreens.settings }
|
|
48
49
|
>
|
|
49
|
-
|
|
50
|
+
<>
|
|
51
|
+
<InspectorControls.Slot />
|
|
52
|
+
<AdvancedControls />
|
|
53
|
+
</>
|
|
50
54
|
</BottomSheet.NavigationScreen>
|
|
51
55
|
<BottomSheet.NavigationScreen
|
|
52
56
|
name={ BottomSheet.SubSheet.screenName }
|
|
@@ -9,8 +9,9 @@ import {
|
|
|
9
9
|
import { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';
|
|
10
10
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
11
11
|
import { moreVertical } from '@wordpress/icons';
|
|
12
|
-
import { Children, cloneElement
|
|
12
|
+
import { Children, cloneElement } from '@wordpress/element';
|
|
13
13
|
import { __ } from '@wordpress/i18n';
|
|
14
|
+
import { displayShortcut } from '@wordpress/keycodes';
|
|
14
15
|
import {
|
|
15
16
|
store as keyboardShortcutsStore,
|
|
16
17
|
__unstableUseShortcutEventMatch,
|
|
@@ -33,31 +34,31 @@ const POPOVER_PROPS = {
|
|
|
33
34
|
placement: 'bottom-start',
|
|
34
35
|
};
|
|
35
36
|
|
|
36
|
-
function CopyMenuItem( { clientIds, onCopy, label } ) {
|
|
37
|
+
function CopyMenuItem( { clientIds, onCopy, label, shortcut } ) {
|
|
37
38
|
const { getBlocksByClientId } = useSelect( blockEditorStore );
|
|
38
39
|
const ref = useCopyToClipboard(
|
|
39
40
|
() => serialize( getBlocksByClientId( clientIds ) ),
|
|
40
41
|
onCopy
|
|
41
42
|
);
|
|
42
43
|
const copyMenuItemLabel = label ? label : __( 'Copy' );
|
|
43
|
-
return
|
|
44
|
+
return (
|
|
45
|
+
<MenuItem ref={ ref } shortcut={ shortcut }>
|
|
46
|
+
{ copyMenuItemLabel }
|
|
47
|
+
</MenuItem>
|
|
48
|
+
);
|
|
44
49
|
}
|
|
45
50
|
|
|
46
51
|
export function BlockSettingsDropdown( {
|
|
47
52
|
block,
|
|
48
53
|
clientIds,
|
|
49
|
-
__experimentalSelectBlock,
|
|
50
54
|
children,
|
|
51
|
-
|
|
55
|
+
__experimentalSelectBlock,
|
|
52
56
|
...props
|
|
53
57
|
} ) {
|
|
54
58
|
// Get the client id of the current block for this menu, if one is set.
|
|
55
59
|
const currentClientId = block?.clientId;
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
: [ clientIds ];
|
|
59
|
-
const count = blockClientIds.length;
|
|
60
|
-
const firstBlockClientId = blockClientIds[ 0 ];
|
|
60
|
+
const count = clientIds.length;
|
|
61
|
+
const firstBlockClientId = clientIds[ 0 ];
|
|
61
62
|
const {
|
|
62
63
|
firstParentClientId,
|
|
63
64
|
onlyBlock,
|
|
@@ -127,41 +128,35 @@ export function BlockSettingsDropdown( {
|
|
|
127
128
|
const isMatch = __unstableUseShortcutEventMatch();
|
|
128
129
|
const hasSelectedBlocks = selectedBlockClientIds.length > 0;
|
|
129
130
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
if ( ids && ids[ 0 ] ) {
|
|
135
|
-
__experimentalSelectBlock( ids[ 0 ], false );
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
},
|
|
139
|
-
[ __experimentalSelectBlock ]
|
|
140
|
-
);
|
|
131
|
+
async function updateSelectionAfterDuplicate( clientIdsPromise ) {
|
|
132
|
+
if ( ! __experimentalSelectBlock ) {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
141
135
|
|
|
142
|
-
|
|
143
|
-
if (
|
|
144
|
-
|
|
136
|
+
const ids = await clientIdsPromise;
|
|
137
|
+
if ( ids && ids[ 0 ] ) {
|
|
138
|
+
__experimentalSelectBlock( ids[ 0 ], false );
|
|
139
|
+
}
|
|
140
|
+
}
|
|
145
141
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
142
|
+
function updateSelectionAfterRemove() {
|
|
143
|
+
if ( ! __experimentalSelectBlock ) {
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
150
146
|
|
|
151
|
-
|
|
152
|
-
const shouldUpdateSelection =
|
|
153
|
-
hasSelectedBlocks && getSelectedBlockClientIds().length === 0;
|
|
147
|
+
let blockToFocus = previousBlockClientId || firstParentClientId;
|
|
154
148
|
|
|
155
|
-
|
|
149
|
+
// Focus the first block if there's no previous block nor parent block.
|
|
150
|
+
if ( ! blockToFocus ) {
|
|
151
|
+
blockToFocus = getBlockOrder()[ 0 ];
|
|
156
152
|
}
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
] );
|
|
153
|
+
|
|
154
|
+
// Only update the selection if the original selection is removed.
|
|
155
|
+
const shouldUpdateSelection =
|
|
156
|
+
hasSelectedBlocks && getSelectedBlockClientIds().length === 0;
|
|
157
|
+
|
|
158
|
+
__experimentalSelectBlock( blockToFocus, shouldUpdateSelection );
|
|
159
|
+
}
|
|
165
160
|
|
|
166
161
|
// This can occur when the selected block (the parent)
|
|
167
162
|
// displays child blocks within a List View.
|
|
@@ -179,20 +174,17 @@ export function BlockSettingsDropdown( {
|
|
|
179
174
|
? undefined
|
|
180
175
|
: openedBlockSettingsMenu === currentClientId || false;
|
|
181
176
|
|
|
182
|
-
|
|
183
|
-
( localOpen )
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
)
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
},
|
|
194
|
-
[ currentClientId, openedBlockSettingsMenu, setOpenedBlockSettingsMenu ]
|
|
195
|
-
);
|
|
177
|
+
function onToggle( localOpen ) {
|
|
178
|
+
if ( localOpen && openedBlockSettingsMenu !== currentClientId ) {
|
|
179
|
+
setOpenedBlockSettingsMenu( currentClientId );
|
|
180
|
+
} else if (
|
|
181
|
+
! localOpen &&
|
|
182
|
+
openedBlockSettingsMenu &&
|
|
183
|
+
openedBlockSettingsMenu === currentClientId
|
|
184
|
+
) {
|
|
185
|
+
setOpenedBlockSettingsMenu( undefined );
|
|
186
|
+
}
|
|
187
|
+
}
|
|
196
188
|
|
|
197
189
|
return (
|
|
198
190
|
<BlockActions
|
|
@@ -233,7 +225,8 @@ export function BlockSettingsDropdown( {
|
|
|
233
225
|
canRemove
|
|
234
226
|
) {
|
|
235
227
|
event.preventDefault();
|
|
236
|
-
|
|
228
|
+
onRemove();
|
|
229
|
+
updateSelectionAfterRemove();
|
|
237
230
|
} else if (
|
|
238
231
|
isMatch(
|
|
239
232
|
'core/block-editor/duplicate',
|
|
@@ -291,6 +284,7 @@ export function BlockSettingsDropdown( {
|
|
|
291
284
|
<CopyMenuItem
|
|
292
285
|
clientIds={ clientIds }
|
|
293
286
|
onCopy={ onCopy }
|
|
287
|
+
shortcut={ displayShortcut.primary( 'c' ) }
|
|
294
288
|
/>
|
|
295
289
|
{ canDuplicate && (
|
|
296
290
|
<MenuItem
|
|
@@ -349,9 +343,6 @@ export function BlockSettingsDropdown( {
|
|
|
349
343
|
firstBlockClientId,
|
|
350
344
|
} }
|
|
351
345
|
clientIds={ clientIds }
|
|
352
|
-
__unstableDisplayLocation={
|
|
353
|
-
__unstableDisplayLocation
|
|
354
|
-
}
|
|
355
346
|
/>
|
|
356
347
|
{ typeof children === 'function'
|
|
357
348
|
? children( { onClose } )
|
|
@@ -16,12 +16,3 @@ function ReusableBlocksMenuItems() {
|
|
|
16
16
|
);
|
|
17
17
|
}
|
|
18
18
|
```
|
|
19
|
-
|
|
20
|
-
## Props
|
|
21
|
-
|
|
22
|
-
### `__unstableDisplayLocation`
|
|
23
|
-
|
|
24
|
-
- **Type:** `String`
|
|
25
|
-
- **Default:** `undefined`
|
|
26
|
-
|
|
27
|
-
A string representing the location where the component is being displayed within the UI. This can be used to conditionalize certain behaviors including the display of associated components. This behaviour will likely be refactored to a React.Context implementation.
|
|
@@ -26,11 +26,7 @@ import { BlockRenameControl, useBlockRename } from '../block-rename';
|
|
|
26
26
|
|
|
27
27
|
const { Fill, Slot } = createSlotFill( 'BlockSettingsMenuControls' );
|
|
28
28
|
|
|
29
|
-
const BlockSettingsMenuControlsSlot = ( {
|
|
30
|
-
fillProps,
|
|
31
|
-
clientIds = null,
|
|
32
|
-
__unstableDisplayLocation,
|
|
33
|
-
} ) => {
|
|
29
|
+
const BlockSettingsMenuControlsSlot = ( { fillProps, clientIds = null } ) => {
|
|
34
30
|
const { selectedBlocks, selectedClientIds } = useSelect(
|
|
35
31
|
( select ) => {
|
|
36
32
|
const { getBlockNamesByClientId, getSelectedBlockClientIds } =
|
|
@@ -61,7 +57,6 @@ const BlockSettingsMenuControlsSlot = ( {
|
|
|
61
57
|
<Slot
|
|
62
58
|
fillProps={ {
|
|
63
59
|
...fillProps,
|
|
64
|
-
__unstableDisplayLocation,
|
|
65
60
|
selectedBlocks,
|
|
66
61
|
selectedClientIds,
|
|
67
62
|
} }
|
|
@@ -160,7 +160,7 @@ function BlockSwitcherDropdownMenuContents( {
|
|
|
160
160
|
);
|
|
161
161
|
}
|
|
162
162
|
|
|
163
|
-
export const BlockSwitcher = ( { clientIds } ) => {
|
|
163
|
+
export const BlockSwitcher = ( { clientIds, disabled } ) => {
|
|
164
164
|
const {
|
|
165
165
|
canRemove,
|
|
166
166
|
hasBlockStyles,
|
|
@@ -182,7 +182,9 @@ export const BlockSwitcher = ( { clientIds } ) => {
|
|
|
182
182
|
if ( ! _blocks.length || _blocks.some( ( block ) => ! block ) ) {
|
|
183
183
|
return { invalidBlocks: true };
|
|
184
184
|
}
|
|
185
|
-
const rootClientId = getBlockRootClientId(
|
|
185
|
+
const rootClientId = getBlockRootClientId(
|
|
186
|
+
Array.isArray( clientIds ) ? clientIds[ 0 ] : clientIds
|
|
187
|
+
);
|
|
186
188
|
const [ { name: firstBlockName } ] = _blocks;
|
|
187
189
|
const _isSingleBlockSelected = _blocks.length === 1;
|
|
188
190
|
const blockType = getBlockType( firstBlockName );
|
|
@@ -229,8 +231,8 @@ export const BlockSwitcher = ( { clientIds } ) => {
|
|
|
229
231
|
const blockSwitcherLabel = isSingleBlock
|
|
230
232
|
? blockTitle
|
|
231
233
|
: __( 'Multiple blocks selected' );
|
|
232
|
-
const hideDropdown = ! hasBlockStyles && ! canRemove;
|
|
233
234
|
|
|
235
|
+
const hideDropdown = disabled || ( ! hasBlockStyles && ! canRemove );
|
|
234
236
|
if ( hideDropdown ) {
|
|
235
237
|
return (
|
|
236
238
|
<ToolbarGroup>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
.block-editor-block-switcher {
|
|
2
2
|
position: relative;
|
|
3
3
|
|
|
4
|
-
// @todo
|
|
4
|
+
// @todo override toolbar group inherited paddings from components/block-tools/style.scss.
|
|
5
5
|
// This is best fixed by making the mover control area a proper single toolbar group.
|
|
6
6
|
// It needs specificity due to style inherited from .components-accessible-toolbar .components-button.has-icon.has-icon.
|
|
7
7
|
.components-button.components-dropdown-menu__toggle.has-icon.has-icon {
|
|
@@ -63,6 +63,7 @@ export function PrivateBlockToolbar( {
|
|
|
63
63
|
isDefaultEditingMode,
|
|
64
64
|
blockType,
|
|
65
65
|
blockName,
|
|
66
|
+
toolbarKey,
|
|
66
67
|
shouldShowVisualToolbar,
|
|
67
68
|
showParentSelector,
|
|
68
69
|
isUsingBindings,
|
|
@@ -103,6 +104,7 @@ export function PrivateBlockToolbar( {
|
|
|
103
104
|
blockType: selectedBlockClientId && getBlockType( _blockName ),
|
|
104
105
|
shouldShowVisualToolbar: isValid && isVisual,
|
|
105
106
|
rootClientId: blockRootClientId,
|
|
107
|
+
toolbarKey: `${ selectedBlockClientId }${ firstParentClientId }`,
|
|
106
108
|
showParentSelector:
|
|
107
109
|
parentBlockType &&
|
|
108
110
|
getBlockEditingMode( firstParentClientId ) === 'default' &&
|
|
@@ -159,7 +161,7 @@ export function PrivateBlockToolbar( {
|
|
|
159
161
|
__experimentalOnIndexChange={ __experimentalOnIndexChange }
|
|
160
162
|
// Resets the index whenever the active block changes so
|
|
161
163
|
// this is not persisted. See https://github.com/WordPress/gutenberg/pull/25760#issuecomment-717906169
|
|
162
|
-
key={
|
|
164
|
+
key={ toolbarKey }
|
|
163
165
|
>
|
|
164
166
|
<div ref={ toolbarWrapperRef } className={ innerClasses }>
|
|
165
167
|
{ ! isMultiToolbar &&
|
|
@@ -168,26 +170,29 @@ export function PrivateBlockToolbar( {
|
|
|
168
170
|
{ isUsingBindings && canBindBlock( blockName ) && (
|
|
169
171
|
<BlockBindingsIndicator />
|
|
170
172
|
) }
|
|
171
|
-
{ ( shouldShowVisualToolbar || isMultiToolbar ) &&
|
|
172
|
-
|
|
173
|
-
<
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
173
|
+
{ ( shouldShowVisualToolbar || isMultiToolbar ) && (
|
|
174
|
+
<div ref={ nodeRef } { ...showHoveredOrFocusedGestures }>
|
|
175
|
+
<ToolbarGroup className="block-editor-block-toolbar__block-controls">
|
|
176
|
+
<BlockSwitcher
|
|
177
|
+
clientIds={ blockClientIds }
|
|
178
|
+
disabled={ ! isDefaultEditingMode }
|
|
179
|
+
/>
|
|
180
|
+
{ isDefaultEditingMode && (
|
|
181
|
+
<>
|
|
182
|
+
{ ! isMultiToolbar && (
|
|
183
|
+
<BlockLockToolbar
|
|
184
|
+
clientId={ blockClientId }
|
|
185
|
+
/>
|
|
186
|
+
) }
|
|
187
|
+
<BlockMover
|
|
188
|
+
clientIds={ blockClientIds }
|
|
189
|
+
hideDragHandle={ hideDragHandle }
|
|
182
190
|
/>
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
</ToolbarGroup>
|
|
189
|
-
</div>
|
|
190
|
-
) }
|
|
191
|
+
</>
|
|
192
|
+
) }
|
|
193
|
+
</ToolbarGroup>
|
|
194
|
+
</div>
|
|
195
|
+
) }
|
|
191
196
|
<Shuffle clientId={ blockClientId } />
|
|
192
197
|
{ shouldShowVisualToolbar && isMultiToolbar && (
|
|
193
198
|
<BlockGroupToolbar />
|
|
@@ -23,7 +23,7 @@ function Container( props ) {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
export default function Shuffle( { clientId, as = Container } ) {
|
|
26
|
-
const { categories, patterns } = useSelect(
|
|
26
|
+
const { categories, patterns, patternName } = useSelect(
|
|
27
27
|
( select ) => {
|
|
28
28
|
const {
|
|
29
29
|
getBlockAttributes,
|
|
@@ -32,11 +32,13 @@ export default function Shuffle( { clientId, as = Container } ) {
|
|
|
32
32
|
} = select( blockEditorStore );
|
|
33
33
|
const attributes = getBlockAttributes( clientId );
|
|
34
34
|
const _categories = attributes?.metadata?.categories || EMPTY_ARRAY;
|
|
35
|
+
const _patternName = attributes?.metadata?.patternName;
|
|
35
36
|
const rootBlock = getBlockRootClientId( clientId );
|
|
36
37
|
const _patterns = __experimentalGetAllowedPatterns( rootBlock );
|
|
37
38
|
return {
|
|
38
39
|
categories: _categories,
|
|
39
40
|
patterns: _patterns,
|
|
41
|
+
patternName: _patternName,
|
|
40
42
|
};
|
|
41
43
|
},
|
|
42
44
|
[ clientId ]
|
|
@@ -56,7 +58,7 @@ export default function Shuffle( { clientId, as = Container } ) {
|
|
|
56
58
|
// Check if the pattern has only one top level block,
|
|
57
59
|
// otherwise we may shuffle to pattern that will not allow to continue shuffling.
|
|
58
60
|
pattern.blocks.length === 1 &&
|
|
59
|
-
pattern.categories
|
|
61
|
+
pattern.categories?.some( ( category ) => {
|
|
60
62
|
return categories.includes( category );
|
|
61
63
|
} )
|
|
62
64
|
);
|
|
@@ -65,28 +67,32 @@ export default function Shuffle( { clientId, as = Container } ) {
|
|
|
65
67
|
if ( sameCategoryPatternsWithSingleWrapper.length === 0 ) {
|
|
66
68
|
return null;
|
|
67
69
|
}
|
|
70
|
+
|
|
71
|
+
function getNextPattern() {
|
|
72
|
+
const numberOfPatterns = sameCategoryPatternsWithSingleWrapper.length;
|
|
73
|
+
const patternIndex = sameCategoryPatternsWithSingleWrapper.findIndex(
|
|
74
|
+
( { name } ) => name === patternName
|
|
75
|
+
);
|
|
76
|
+
const nextPatternIndex =
|
|
77
|
+
patternIndex + 1 < numberOfPatterns ? patternIndex + 1 : 0;
|
|
78
|
+
return sameCategoryPatternsWithSingleWrapper[ nextPatternIndex ];
|
|
79
|
+
}
|
|
80
|
+
|
|
68
81
|
const ComponentToUse = as;
|
|
69
82
|
return (
|
|
70
83
|
<ComponentToUse
|
|
71
84
|
label={ __( 'Shuffle' ) }
|
|
72
85
|
icon={ shuffle }
|
|
73
86
|
onClick={ () => {
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
// eslint-disable-next-line no-restricted-syntax
|
|
78
|
-
Math.random() *
|
|
79
|
-
sameCategoryPatternsWithSingleWrapper.length
|
|
80
|
-
)
|
|
81
|
-
];
|
|
82
|
-
randomPattern.blocks[ 0 ].attributes = {
|
|
83
|
-
...randomPattern.blocks[ 0 ].attributes,
|
|
87
|
+
const nextPattern = getNextPattern();
|
|
88
|
+
nextPattern.blocks[ 0 ].attributes = {
|
|
89
|
+
...nextPattern.blocks[ 0 ].attributes,
|
|
84
90
|
metadata: {
|
|
85
|
-
...
|
|
91
|
+
...nextPattern.blocks[ 0 ].attributes.metadata,
|
|
86
92
|
categories,
|
|
87
93
|
},
|
|
88
94
|
};
|
|
89
|
-
replaceBlocks( clientId,
|
|
95
|
+
replaceBlocks( clientId, nextPattern.blocks );
|
|
90
96
|
} }
|
|
91
97
|
/>
|
|
92
98
|
);
|
|
@@ -133,7 +133,7 @@
|
|
|
133
133
|
}
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
-
// @todo
|
|
136
|
+
// @todo override toolbar group inherited paddings from components/block-tools/style.scss.
|
|
137
137
|
// This is best fixed by making the mover control area a proper single toolbar group.
|
|
138
138
|
.components-toolbar-group {
|
|
139
139
|
padding: 0;
|
|
@@ -15,13 +15,7 @@ describe( 'Block Toolbar', () => {
|
|
|
15
15
|
it( "doesn't render the block settings button if there aren't any settings for the current selected block", async () => {
|
|
16
16
|
// Arrange
|
|
17
17
|
const screen = await initializeEditor();
|
|
18
|
-
await addBlock( screen, '
|
|
19
|
-
|
|
20
|
-
// Act
|
|
21
|
-
fireEvent(
|
|
22
|
-
screen.getByTestId( 'media-options-picker' ),
|
|
23
|
-
'backdropPress'
|
|
24
|
-
);
|
|
18
|
+
await addBlock( screen, 'Shortcode' );
|
|
25
19
|
|
|
26
20
|
// Assert
|
|
27
21
|
expect( screen.queryByLabelText( 'Open Settings' ) ).toBeNull();
|