@wordpress/block-editor 13.2.0 → 13.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/README.md +0 -1
- package/build/components/block-breadcrumb/index.js +12 -1
- package/build/components/block-breadcrumb/index.js.map +1 -1
- package/build/components/block-lock/toolbar.js +0 -1
- package/build/components/block-lock/toolbar.js.map +1 -1
- package/build/components/block-mover/button.js +1 -1
- package/build/components/block-mover/button.js.map +1 -1
- package/build/components/block-mover/index.js +1 -1
- package/build/components/block-mover/index.js.map +1 -1
- package/build/components/block-pattern-setup/setup-toolbar.js +2 -2
- package/build/components/block-pattern-setup/setup-toolbar.js.map +1 -1
- package/build/components/block-patterns-paging/index.js +5 -7
- package/build/components/block-patterns-paging/index.js.map +1 -1
- package/build/components/block-quick-navigation/index.js +20 -17
- package/build/components/block-quick-navigation/index.js.map +1 -1
- package/build/components/block-rename/modal.js +4 -12
- package/build/components/block-rename/modal.js.map +1 -1
- package/build/components/block-toolbar/shuffle.js +1 -0
- package/build/components/block-toolbar/shuffle.js.map +1 -1
- package/build/components/block-tools/block-selection-button.js +7 -58
- package/build/components/block-tools/block-selection-button.js.map +1 -1
- package/build/components/block-tools/block-toolbar-breadcrumb.js +9 -2
- package/build/components/block-tools/block-toolbar-breadcrumb.js.map +1 -1
- package/build/components/block-tools/index.js +14 -1
- package/build/components/block-tools/index.js.map +1 -1
- package/build/components/block-tools/use-show-block-tools.js +4 -2
- package/build/components/block-tools/use-show-block-tools.js.map +1 -1
- package/build/components/block-tools/zoom-out-mode-inserters.js +5 -4
- package/build/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
- package/build/components/block-tools/zoom-out-popover.js +57 -0
- package/build/components/block-tools/zoom-out-popover.js.map +1 -0
- package/build/components/block-tools/zoom-out-toolbar.js +138 -0
- package/build/components/block-tools/zoom-out-toolbar.js.map +1 -0
- package/build/components/button-block-appender/index.js +3 -1
- package/build/components/button-block-appender/index.js.map +1 -1
- package/build/components/child-layout-control/index.js +26 -18
- package/build/components/child-layout-control/index.js.map +1 -1
- package/build/components/date-format-picker/index.js +10 -1
- package/build/components/date-format-picker/index.js.map +1 -1
- package/build/components/dimensions-tool/index.js +6 -4
- package/build/components/dimensions-tool/index.js.map +1 -1
- package/build/components/font-appearance-control/index.js +26 -61
- package/build/components/font-appearance-control/index.js.map +1 -1
- package/build/components/global-styles/background-panel.js +178 -116
- package/build/components/global-styles/background-panel.js.map +1 -1
- package/build/components/global-styles/border-panel.js +2 -1
- package/build/components/global-styles/border-panel.js.map +1 -1
- 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 +2 -1
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/filters-panel.js +2 -1
- package/build/components/global-styles/filters-panel.js.map +1 -1
- package/build/components/global-styles/hooks.js +8 -0
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/image-settings-panel.js +2 -1
- package/build/components/global-styles/image-settings-panel.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +50 -12
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/typography-utils.js +50 -0
- package/build/components/global-styles/typography-utils.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +23 -8
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js +17 -7
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/grid/grid-item-movers.js +11 -14
- package/build/components/grid/grid-item-movers.js.map +1 -1
- package/build/components/grid/grid-item-resizer.js +2 -2
- package/build/components/grid/grid-item-resizer.js.map +1 -1
- package/build/components/grid/grid-visualizer.js +116 -36
- package/build/components/grid/grid-visualizer.js.map +1 -1
- package/build/components/grid/use-grid-layout-sync.js +29 -22
- package/build/components/grid/use-grid-layout-sync.js.map +1 -1
- package/build/components/inner-blocks/index.js +1 -1
- package/build/components/inner-blocks/index.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +1 -19
- package/build/components/inserter/block-patterns-tab/pattern-category-preview-panel.js.map +1 -1
- package/build/components/inserter/menu.js +26 -4
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/quick-inserter.js +2 -1
- package/build/components/inserter/quick-inserter.js.map +1 -1
- package/build/components/inspector-controls/block-support-tools-panel.js +2 -1
- package/build/components/inspector-controls/block-support-tools-panel.js.map +1 -1
- package/build/components/link-control/link-preview.js +1 -1
- package/build/components/link-control/link-preview.js.map +1 -1
- package/build/components/media-placeholder/index.js +19 -23
- package/build/components/media-placeholder/index.js.map +1 -1
- package/build/components/navigable-toolbar/index.js +3 -1
- package/build/components/navigable-toolbar/index.js.map +1 -1
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js +5 -1
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build/components/tabbed-sidebar/index.js +66 -0
- package/build/components/tabbed-sidebar/index.js.map +1 -0
- package/build/components/url-popover/index.js +3 -0
- package/build/components/url-popover/index.js.map +1 -1
- package/build/hooks/background.js +26 -4
- package/build/hooks/background.js.map +1 -1
- package/build/hooks/block-hooks.js +11 -17
- package/build/hooks/block-hooks.js.map +1 -1
- package/build/hooks/block-style-variation.js +169 -4
- package/build/hooks/block-style-variation.js.map +1 -1
- package/build/hooks/duotone.js +16 -11
- package/build/hooks/duotone.js.map +1 -1
- package/build/hooks/grid-visualizer.js +65 -0
- package/build/hooks/grid-visualizer.js.map +1 -0
- package/build/hooks/index.js +15 -2
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/layout-child.js +39 -22
- package/build/hooks/layout-child.js.map +1 -1
- package/build/hooks/position.js +2 -9
- package/build/hooks/position.js.map +1 -1
- package/build/hooks/use-bindings-attributes.js +16 -6
- package/build/hooks/use-bindings-attributes.js.map +1 -1
- package/build/hooks/utils.js +2 -0
- package/build/hooks/utils.js.map +1 -1
- package/build/layouts/constrained.js +44 -2
- package/build/layouts/constrained.js.map +1 -1
- package/build/layouts/grid.js +90 -51
- package/build/layouts/grid.js.map +1 -1
- package/build/private-apis.js +6 -1
- package/build/private-apis.js.map +1 -1
- package/build/store/defaults.js +0 -2
- package/build/store/defaults.js.map +1 -1
- package/build/store/defaults.native.js +0 -3
- package/build/store/defaults.native.js.map +1 -1
- package/build/store/private-keys.js +2 -1
- package/build/store/private-keys.js.map +1 -1
- package/build/utils/format-font-style.js +45 -0
- package/build/utils/format-font-style.js.map +1 -0
- package/build/utils/format-font-weight.js +68 -0
- package/build/utils/format-font-weight.js.map +1 -0
- package/build/utils/get-editor-region.js +34 -0
- package/build/utils/get-editor-region.js.map +1 -0
- package/build/utils/get-font-styles-and-weights.js +167 -0
- package/build/utils/get-font-styles-and-weights.js.map +1 -0
- package/build/utils/pasting.js +5 -13
- package/build/utils/pasting.js.map +1 -1
- package/build-module/components/block-breadcrumb/index.js +12 -1
- package/build-module/components/block-breadcrumb/index.js.map +1 -1
- package/build-module/components/block-lock/toolbar.js +0 -1
- package/build-module/components/block-lock/toolbar.js.map +1 -1
- package/build-module/components/block-mover/button.js +1 -1
- package/build-module/components/block-mover/button.js.map +1 -1
- package/build-module/components/block-mover/index.js +1 -1
- package/build-module/components/block-mover/index.js.map +1 -1
- package/build-module/components/block-pattern-setup/setup-toolbar.js +2 -2
- package/build-module/components/block-pattern-setup/setup-toolbar.js.map +1 -1
- package/build-module/components/block-patterns-paging/index.js +5 -7
- package/build-module/components/block-patterns-paging/index.js.map +1 -1
- package/build-module/components/block-quick-navigation/index.js +20 -17
- package/build-module/components/block-quick-navigation/index.js.map +1 -1
- package/build-module/components/block-rename/modal.js +5 -13
- package/build-module/components/block-rename/modal.js.map +1 -1
- package/build-module/components/block-toolbar/shuffle.js +1 -0
- package/build-module/components/block-toolbar/shuffle.js.map +1 -1
- package/build-module/components/block-tools/block-selection-button.js +10 -61
- package/build-module/components/block-tools/block-selection-button.js.map +1 -1
- package/build-module/components/block-tools/block-toolbar-breadcrumb.js +9 -2
- package/build-module/components/block-tools/block-toolbar-breadcrumb.js.map +1 -1
- package/build-module/components/block-tools/index.js +14 -1
- package/build-module/components/block-tools/index.js.map +1 -1
- package/build-module/components/block-tools/use-show-block-tools.js +4 -2
- package/build-module/components/block-tools/use-show-block-tools.js.map +1 -1
- package/build-module/components/block-tools/zoom-out-mode-inserters.js +5 -4
- package/build-module/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
- package/build-module/components/block-tools/zoom-out-popover.js +48 -0
- package/build-module/components/block-tools/zoom-out-popover.js.map +1 -0
- package/build-module/components/block-tools/zoom-out-toolbar.js +131 -0
- package/build-module/components/block-tools/zoom-out-toolbar.js.map +1 -0
- package/build-module/components/button-block-appender/index.js +3 -1
- package/build-module/components/button-block-appender/index.js.map +1 -1
- package/build-module/components/child-layout-control/index.js +27 -19
- package/build-module/components/child-layout-control/index.js.map +1 -1
- package/build-module/components/date-format-picker/index.js +11 -3
- package/build-module/components/date-format-picker/index.js.map +1 -1
- package/build-module/components/dimensions-tool/index.js +6 -4
- package/build-module/components/dimensions-tool/index.js.map +1 -1
- package/build-module/components/font-appearance-control/index.js +28 -63
- package/build-module/components/font-appearance-control/index.js.map +1 -1
- package/build-module/components/global-styles/background-panel.js +181 -119
- package/build-module/components/global-styles/background-panel.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +3 -2
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/color-panel.js +3 -2
- package/build-module/components/global-styles/color-panel.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +3 -2
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/filters-panel.js +3 -2
- package/build-module/components/global-styles/filters-panel.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +8 -0
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/image-settings-panel.js +3 -2
- package/build-module/components/global-styles/image-settings-panel.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +52 -14
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/typography-utils.js +48 -0
- package/build-module/components/global-styles/typography-utils.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +23 -8
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js +15 -6
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/grid/grid-item-movers.js +11 -14
- package/build-module/components/grid/grid-item-movers.js.map +1 -1
- package/build-module/components/grid/grid-item-resizer.js +2 -2
- package/build-module/components/grid/grid-item-resizer.js.map +1 -1
- package/build-module/components/grid/grid-visualizer.js +117 -37
- package/build-module/components/grid/grid-visualizer.js.map +1 -1
- package/build-module/components/grid/use-grid-layout-sync.js +29 -22
- package/build-module/components/grid/use-grid-layout-sync.js.map +1 -1
- package/build-module/components/inner-blocks/index.js +1 -1
- package/build-module/components/inner-blocks/index.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +1 -19
- package/build-module/components/inserter/block-patterns-tab/pattern-category-preview-panel.js.map +1 -1
- package/build-module/components/inserter/menu.js +26 -4
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/quick-inserter.js +2 -1
- package/build-module/components/inserter/quick-inserter.js.map +1 -1
- package/build-module/components/inspector-controls/block-support-tools-panel.js +3 -2
- package/build-module/components/inspector-controls/block-support-tools-panel.js.map +1 -1
- package/build-module/components/link-control/link-preview.js +1 -1
- package/build-module/components/link-control/link-preview.js.map +1 -1
- package/build-module/components/media-placeholder/index.js +19 -23
- package/build-module/components/media-placeholder/index.js.map +1 -1
- package/build-module/components/navigable-toolbar/index.js +3 -1
- package/build-module/components/navigable-toolbar/index.js.map +1 -1
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js +5 -1
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build-module/components/tabbed-sidebar/index.js +60 -0
- package/build-module/components/tabbed-sidebar/index.js.map +1 -0
- package/build-module/components/url-popover/index.js +3 -0
- package/build-module/components/url-popover/index.js.map +1 -1
- package/build-module/hooks/background.js +26 -4
- package/build-module/hooks/background.js.map +1 -1
- package/build-module/hooks/block-hooks.js +11 -17
- package/build-module/hooks/block-hooks.js.map +1 -1
- package/build-module/hooks/block-style-variation.js +168 -4
- package/build-module/hooks/block-style-variation.js.map +1 -1
- package/build-module/hooks/duotone.js +16 -11
- package/build-module/hooks/duotone.js.map +1 -1
- package/build-module/hooks/grid-visualizer.js +64 -0
- package/build-module/hooks/grid-visualizer.js.map +1 -0
- package/build-module/hooks/index.js +3 -0
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/layout-child.js +39 -22
- package/build-module/hooks/layout-child.js.map +1 -1
- package/build-module/hooks/position.js +2 -9
- package/build-module/hooks/position.js.map +1 -1
- package/build-module/hooks/use-bindings-attributes.js +16 -6
- package/build-module/hooks/use-bindings-attributes.js.map +1 -1
- package/build-module/hooks/utils.js +2 -0
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/layouts/constrained.js +44 -2
- package/build-module/layouts/constrained.js.map +1 -1
- package/build-module/layouts/grid.js +90 -51
- package/build-module/layouts/grid.js.map +1 -1
- package/build-module/private-apis.js +8 -3
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/defaults.js +0 -2
- package/build-module/store/defaults.js.map +1 -1
- package/build-module/store/defaults.native.js +0 -3
- package/build-module/store/defaults.native.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/utils/format-font-style.js +39 -0
- package/build-module/utils/format-font-style.js.map +1 -0
- package/build-module/utils/format-font-weight.js +62 -0
- package/build-module/utils/format-font-weight.js.map +1 -0
- package/build-module/utils/get-editor-region.js +28 -0
- package/build-module/utils/get-editor-region.js.map +1 -0
- package/build-module/utils/get-font-styles-and-weights.js +160 -0
- package/build-module/utils/get-font-styles-and-weights.js.map +1 -0
- package/build-module/utils/pasting.js +5 -13
- package/build-module/utils/pasting.js.map +1 -1
- package/build-style/content-rtl.css +1 -0
- package/build-style/content.css +1 -0
- package/build-style/style-rtl.css +207 -96
- package/build-style/style.css +207 -96
- package/package.json +32 -32
- package/src/components/block-breadcrumb/index.js +16 -1
- package/src/components/block-lock/toolbar.js +0 -1
- package/src/components/block-mover/button.js +1 -1
- package/src/components/block-mover/index.js +1 -1
- package/src/components/block-pattern-setup/setup-toolbar.js +2 -2
- package/src/components/block-patterns-paging/index.js +8 -11
- package/src/components/block-patterns-paging/style.scss +18 -0
- package/src/components/block-quick-navigation/index.js +21 -28
- package/src/components/block-rename/modal.js +2 -8
- package/src/components/block-switcher/test/index.js +6 -6
- package/src/components/block-toolbar/shuffle.js +1 -0
- package/src/components/block-toolbar/style.scss +1 -11
- package/src/components/block-tools/block-selection-button.js +11 -83
- package/src/components/block-tools/block-toolbar-breadcrumb.js +9 -4
- package/src/components/block-tools/index.js +21 -1
- package/src/components/block-tools/style.scss +15 -0
- package/src/components/block-tools/use-show-block-tools.js +14 -6
- package/src/components/block-tools/zoom-out-mode-inserters.js +5 -4
- package/src/components/block-tools/zoom-out-popover.js +49 -0
- package/src/components/block-tools/zoom-out-toolbar.js +140 -0
- package/src/components/button-block-appender/index.js +2 -1
- package/src/components/child-layout-control/index.js +41 -23
- package/src/components/date-format-picker/index.js +10 -1
- package/src/components/date-format-picker/style.scss +0 -9
- package/src/components/dimensions-tool/index.js +97 -89
- package/src/components/font-appearance-control/index.js +29 -83
- package/src/components/font-appearance-control/style.scss +3 -5
- package/src/components/global-styles/background-panel.js +249 -170
- package/src/components/global-styles/border-panel.js +3 -2
- package/src/components/global-styles/color-panel.js +3 -2
- package/src/components/global-styles/dimensions-panel.js +3 -2
- package/src/components/global-styles/filters-panel.js +3 -2
- package/src/components/global-styles/hooks.js +9 -0
- package/src/components/global-styles/image-settings-panel.js +3 -2
- package/src/components/global-styles/style.scss +105 -20
- package/src/components/global-styles/test/typography-utils.js +269 -0
- package/src/components/global-styles/typography-panel.js +49 -12
- package/src/components/global-styles/typography-utils.js +63 -0
- package/src/components/global-styles/use-global-styles-output.js +23 -8
- package/src/components/global-styles/utils.js +17 -6
- package/src/components/grid/grid-item-movers.js +11 -27
- package/src/components/grid/grid-item-resizer.js +3 -2
- package/src/components/grid/grid-visualizer.js +171 -54
- package/src/components/grid/style.scss +43 -8
- package/src/components/grid/use-grid-layout-sync.js +31 -28
- package/src/components/iframe/content.scss +1 -0
- package/src/components/inner-blocks/index.js +2 -1
- package/src/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +1 -16
- package/src/components/inserter/menu.js +47 -13
- package/src/components/inserter/quick-inserter.js +6 -1
- package/src/components/inserter/style.scss +1 -49
- package/src/components/inspector-controls/block-support-tools-panel.js +3 -3
- package/src/components/link-control/link-preview.js +1 -1
- package/src/components/media-placeholder/index.js +22 -32
- package/src/components/navigable-toolbar/index.js +3 -1
- package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +6 -1
- package/src/components/tabbed-sidebar/README.md +76 -0
- package/src/components/tabbed-sidebar/index.js +70 -0
- package/src/components/tabbed-sidebar/style.scss +53 -0
- package/src/components/url-popover/index.js +3 -0
- package/src/hooks/background.js +25 -10
- package/src/hooks/block-hooks.js +9 -16
- package/src/hooks/block-style-variation.js +202 -3
- package/src/hooks/duotone.js +16 -12
- package/src/hooks/grid-visualizer.js +64 -0
- package/src/hooks/index.js +3 -0
- package/src/hooks/layout-child.js +53 -37
- package/src/hooks/position.js +3 -10
- package/src/hooks/test/get-variation-styles-with-ref-values.js +91 -0
- package/src/hooks/use-bindings-attributes.js +18 -4
- package/src/hooks/utils.js +2 -0
- package/src/layouts/constrained.js +43 -2
- package/src/layouts/grid.js +146 -51
- package/src/private-apis.js +12 -1
- package/src/store/defaults.js +0 -2
- package/src/store/defaults.native.js +0 -3
- package/src/store/private-keys.js +1 -0
- package/src/style.scss +1 -1
- package/src/utils/format-font-style.js +40 -0
- package/src/utils/format-font-weight.js +63 -0
- package/src/utils/get-editor-region.js +31 -0
- package/src/utils/get-font-styles-and-weights.js +191 -0
- package/src/utils/pasting.js +5 -12
- package/src/utils/test/format-font-style.js +34 -0
- package/src/utils/test/format-font-weight.js +66 -0
- package/src/utils/test/get-font-styles-and-weights.js +513 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/src/hooks/position.scss +0 -18
|
@@ -10,18 +10,16 @@ import {
|
|
|
10
10
|
FlexBlock,
|
|
11
11
|
FlexItem,
|
|
12
12
|
} from '@wordpress/components';
|
|
13
|
-
import {
|
|
14
|
-
__experimentalGetBlockLabel,
|
|
15
|
-
store as blocksStore,
|
|
16
|
-
} from '@wordpress/blocks';
|
|
17
13
|
|
|
18
14
|
/**
|
|
19
15
|
* Internal dependencies
|
|
20
16
|
*/
|
|
21
17
|
import { store as blockEditorStore } from '../../store';
|
|
22
18
|
import BlockIcon from '../block-icon';
|
|
19
|
+
import useBlockDisplayInformation from '../use-block-display-information';
|
|
20
|
+
import useBlockDisplayTitle from '../block-title/use-block-display-title';
|
|
23
21
|
|
|
24
|
-
export default function BlockQuickNavigation( { clientIds } ) {
|
|
22
|
+
export default function BlockQuickNavigation( { clientIds, onSelect } ) {
|
|
25
23
|
if ( ! clientIds.length ) {
|
|
26
24
|
return null;
|
|
27
25
|
}
|
|
@@ -29,6 +27,7 @@ export default function BlockQuickNavigation( { clientIds } ) {
|
|
|
29
27
|
<VStack spacing={ 1 }>
|
|
30
28
|
{ clientIds.map( ( clientId ) => (
|
|
31
29
|
<BlockQuickNavigationItem
|
|
30
|
+
onSelect={ onSelect }
|
|
32
31
|
key={ clientId }
|
|
33
32
|
clientId={ clientId }
|
|
34
33
|
/>
|
|
@@ -37,29 +36,18 @@ export default function BlockQuickNavigation( { clientIds } ) {
|
|
|
37
36
|
);
|
|
38
37
|
}
|
|
39
38
|
|
|
40
|
-
function BlockQuickNavigationItem( { clientId } ) {
|
|
41
|
-
const
|
|
39
|
+
function BlockQuickNavigationItem( { clientId, onSelect } ) {
|
|
40
|
+
const blockInformation = useBlockDisplayInformation( clientId );
|
|
41
|
+
const blockTitle = useBlockDisplayTitle( {
|
|
42
|
+
clientId,
|
|
43
|
+
context: 'list-view',
|
|
44
|
+
} );
|
|
45
|
+
const { isSelected } = useSelect(
|
|
42
46
|
( select ) => {
|
|
43
|
-
const {
|
|
44
|
-
|
|
45
|
-
getBlockAttributes,
|
|
46
|
-
isBlockSelected,
|
|
47
|
-
hasSelectedInnerBlock,
|
|
48
|
-
} = select( blockEditorStore );
|
|
49
|
-
const { getBlockType } = select( blocksStore );
|
|
50
|
-
|
|
51
|
-
const blockType = getBlockType( getBlockName( clientId ) );
|
|
52
|
-
const attributes = getBlockAttributes( clientId );
|
|
47
|
+
const { isBlockSelected, hasSelectedInnerBlock } =
|
|
48
|
+
select( blockEditorStore );
|
|
53
49
|
|
|
54
50
|
return {
|
|
55
|
-
name:
|
|
56
|
-
blockType &&
|
|
57
|
-
__experimentalGetBlockLabel(
|
|
58
|
-
blockType,
|
|
59
|
-
attributes,
|
|
60
|
-
'list-view'
|
|
61
|
-
),
|
|
62
|
-
icon: blockType?.icon,
|
|
63
51
|
isSelected:
|
|
64
52
|
isBlockSelected( clientId ) ||
|
|
65
53
|
hasSelectedInnerBlock( clientId, /* deep: */ true ),
|
|
@@ -72,14 +60,19 @@ function BlockQuickNavigationItem( { clientId } ) {
|
|
|
72
60
|
return (
|
|
73
61
|
<Button
|
|
74
62
|
isPressed={ isSelected }
|
|
75
|
-
onClick={ () =>
|
|
63
|
+
onClick={ async () => {
|
|
64
|
+
await selectBlock( clientId );
|
|
65
|
+
if ( onSelect ) {
|
|
66
|
+
onSelect( clientId );
|
|
67
|
+
}
|
|
68
|
+
} }
|
|
76
69
|
>
|
|
77
70
|
<Flex>
|
|
78
71
|
<FlexItem>
|
|
79
|
-
<BlockIcon icon={ icon } />
|
|
72
|
+
<BlockIcon icon={ blockInformation?.icon } />
|
|
80
73
|
</FlexItem>
|
|
81
74
|
<FlexBlock style={ { textAlign: 'left' } }>
|
|
82
|
-
<Truncate>{
|
|
75
|
+
<Truncate>{ blockTitle }</Truncate>
|
|
83
76
|
</FlexBlock>
|
|
84
77
|
</Flex>
|
|
85
78
|
</Button>
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
Modal,
|
|
10
10
|
} from '@wordpress/components';
|
|
11
11
|
import { __, sprintf } from '@wordpress/i18n';
|
|
12
|
-
import { useState
|
|
12
|
+
import { useState } from '@wordpress/element';
|
|
13
13
|
import { speak } from '@wordpress/a11y';
|
|
14
14
|
|
|
15
15
|
/**
|
|
@@ -27,7 +27,6 @@ export default function BlockRenameModal( {
|
|
|
27
27
|
hasOverridesWarning,
|
|
28
28
|
} ) {
|
|
29
29
|
const [ editedBlockName, setEditedBlockName ] = useState( blockName );
|
|
30
|
-
const descriptionId = useId();
|
|
31
30
|
|
|
32
31
|
const nameHasChanged = editedBlockName !== blockName;
|
|
33
32
|
const nameIsOriginal = editedBlockName === originalBlockName;
|
|
@@ -65,7 +64,6 @@ export default function BlockRenameModal( {
|
|
|
65
64
|
onRequestClose={ onClose }
|
|
66
65
|
overlayClassName="block-editor-block-rename-modal"
|
|
67
66
|
focusOnMount="firstContentElement"
|
|
68
|
-
aria={ { describedby: descriptionId } }
|
|
69
67
|
size="small"
|
|
70
68
|
>
|
|
71
69
|
<form
|
|
@@ -79,16 +77,12 @@ export default function BlockRenameModal( {
|
|
|
79
77
|
handleSubmit();
|
|
80
78
|
} }
|
|
81
79
|
>
|
|
82
|
-
<p id={ descriptionId }>
|
|
83
|
-
{ __( 'Enter a custom name for this block.' ) }
|
|
84
|
-
</p>
|
|
85
80
|
<VStack spacing="3">
|
|
86
81
|
<TextControl
|
|
87
82
|
__nextHasNoMarginBottom
|
|
88
83
|
__next40pxDefaultSize
|
|
89
84
|
value={ editedBlockName }
|
|
90
|
-
label={ __( '
|
|
91
|
-
hideLabelFromVision
|
|
85
|
+
label={ __( 'Name' ) }
|
|
92
86
|
help={
|
|
93
87
|
hasOverridesWarning
|
|
94
88
|
? __(
|
|
@@ -134,7 +134,7 @@ describe( 'BlockSwitcher', () => {
|
|
|
134
134
|
expect( items[ 1 ] ).toHaveTextContent( headingBlockType.title );
|
|
135
135
|
} );
|
|
136
136
|
|
|
137
|
-
test( 'should render disabled block switcher when we have a single selected block without styles and we cannot remove it', () => {
|
|
137
|
+
test( 'should render accessibly disabled block switcher when we have a single selected block without styles and we cannot remove it', () => {
|
|
138
138
|
useSelect.mockImplementation( () => ( {
|
|
139
139
|
blocks: [ headingBlock1 ],
|
|
140
140
|
icon: copy,
|
|
@@ -142,11 +142,11 @@ describe( 'BlockSwitcher', () => {
|
|
|
142
142
|
canRemove: false,
|
|
143
143
|
} ) );
|
|
144
144
|
render( <BlockSwitcher clientIds={ [ headingBlock1.clientId ] } /> );
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
).
|
|
145
|
+
const blockSwitcher = screen.getByRole( 'button', {
|
|
146
|
+
name: 'Block Name',
|
|
147
|
+
} );
|
|
148
|
+
expect( blockSwitcher ).toBeEnabled();
|
|
149
|
+
expect( blockSwitcher ).toHaveAttribute( 'aria-disabled', 'true' );
|
|
150
150
|
} );
|
|
151
151
|
|
|
152
152
|
test( 'should render message for no available transforms', async () => {
|
|
@@ -85,6 +85,7 @@ export default function Shuffle( { clientId, as = Container } ) {
|
|
|
85
85
|
<ComponentToUse
|
|
86
86
|
label={ __( 'Shuffle' ) }
|
|
87
87
|
icon={ shuffle }
|
|
88
|
+
className="block-editor-block-toolbar-shuffle"
|
|
88
89
|
onClick={ () => {
|
|
89
90
|
const nextPattern = getNextPattern();
|
|
90
91
|
nextPattern.blocks[ 0 ].attributes = {
|
|
@@ -24,8 +24,6 @@
|
|
|
24
24
|
.components-toolbar-group,
|
|
25
25
|
.components-toolbar {
|
|
26
26
|
background: none;
|
|
27
|
-
// IE11 has thick paddings without this.
|
|
28
|
-
line-height: 0;
|
|
29
27
|
|
|
30
28
|
// These margins make the buttons themselves overlap the chrome of the toolbar.
|
|
31
29
|
// This helps make them square, and maximize the hit area.
|
|
@@ -151,15 +149,7 @@
|
|
|
151
149
|
}
|
|
152
150
|
|
|
153
151
|
.block-editor-block-toolbar__slot {
|
|
154
|
-
|
|
155
|
-
display: inline-block;
|
|
156
|
-
// Fix for toolbar button misalignment on IE11
|
|
157
|
-
line-height: 0;
|
|
158
|
-
|
|
159
|
-
// IE11 doesn't read rules inside this query. They are applied only to modern browsers.
|
|
160
|
-
@supports (position: sticky) {
|
|
161
|
-
display: inline-flex;
|
|
162
|
-
}
|
|
152
|
+
display: inline-flex;
|
|
163
153
|
}
|
|
164
154
|
|
|
165
155
|
.show-icon-labels {
|
|
@@ -6,10 +6,10 @@ import clsx from 'clsx';
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
|
-
import { dragHandle
|
|
10
|
-
import { Button, Flex, FlexItem
|
|
9
|
+
import { dragHandle } from '@wordpress/icons';
|
|
10
|
+
import { Button, Flex, FlexItem } from '@wordpress/components';
|
|
11
11
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
12
|
-
import {
|
|
12
|
+
import { forwardRef, useEffect } from '@wordpress/element';
|
|
13
13
|
import {
|
|
14
14
|
BACKSPACE,
|
|
15
15
|
DELETE,
|
|
@@ -38,8 +38,6 @@ import BlockIcon from '../block-icon';
|
|
|
38
38
|
import { store as blockEditorStore } from '../../store';
|
|
39
39
|
import BlockDraggable from '../block-draggable';
|
|
40
40
|
import { __unstableUseBlockElement as useBlockElement } from '../block-list/use-block-props/use-block-refs';
|
|
41
|
-
import BlockMover from '../block-mover';
|
|
42
|
-
import Shuffle from '../block-toolbar/shuffle';
|
|
43
41
|
|
|
44
42
|
/**
|
|
45
43
|
* Block selection button component, displaying the label of the block. If the block
|
|
@@ -48,10 +46,11 @@ import Shuffle from '../block-toolbar/shuffle';
|
|
|
48
46
|
*
|
|
49
47
|
* @param {string} props Component props.
|
|
50
48
|
* @param {string} props.clientId Client ID of block.
|
|
49
|
+
* @param {Object} ref Reference to the component.
|
|
51
50
|
*
|
|
52
51
|
* @return {Component} The component to be rendered.
|
|
53
52
|
*/
|
|
54
|
-
function BlockSelectionButton( { clientId, rootClientId } ) {
|
|
53
|
+
function BlockSelectionButton( { clientId, rootClientId }, ref ) {
|
|
55
54
|
const selected = useSelect(
|
|
56
55
|
( select ) => {
|
|
57
56
|
const {
|
|
@@ -62,7 +61,6 @@ function BlockSelectionButton( { clientId, rootClientId } ) {
|
|
|
62
61
|
__unstableGetEditorMode,
|
|
63
62
|
getNextBlockClientId,
|
|
64
63
|
getPreviousBlockClientId,
|
|
65
|
-
canRemoveBlock,
|
|
66
64
|
canMoveBlock,
|
|
67
65
|
} = select( blockEditorStore );
|
|
68
66
|
const { getActiveBlockVariation, getBlockType } =
|
|
@@ -73,26 +71,6 @@ function BlockSelectionButton( { clientId, rootClientId } ) {
|
|
|
73
71
|
const orientation =
|
|
74
72
|
getBlockListSettings( rootClientId )?.orientation;
|
|
75
73
|
const match = getActiveBlockVariation( name, attributes );
|
|
76
|
-
const isBlockTemplatePart =
|
|
77
|
-
blockType?.name === 'core/template-part';
|
|
78
|
-
|
|
79
|
-
let isNextBlockTemplatePart = false;
|
|
80
|
-
const nextClientId = getNextBlockClientId();
|
|
81
|
-
if ( nextClientId ) {
|
|
82
|
-
const { name: nextName } = getBlock( nextClientId );
|
|
83
|
-
const nextBlockType = getBlockType( nextName );
|
|
84
|
-
isNextBlockTemplatePart =
|
|
85
|
-
nextBlockType?.name === 'core/template-part';
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
let isPrevBlockTemplatePart = false;
|
|
89
|
-
const prevClientId = getPreviousBlockClientId();
|
|
90
|
-
if ( prevClientId ) {
|
|
91
|
-
const { name: prevName } = getBlock( prevClientId );
|
|
92
|
-
const prevBlockType = getBlockType( prevName );
|
|
93
|
-
isPrevBlockTemplatePart =
|
|
94
|
-
prevBlockType?.name === 'core/template-part';
|
|
95
|
-
}
|
|
96
74
|
|
|
97
75
|
return {
|
|
98
76
|
blockMovingMode: hasBlockMovingClientId(),
|
|
@@ -104,28 +82,15 @@ function BlockSelectionButton( { clientId, rootClientId } ) {
|
|
|
104
82
|
index + 1,
|
|
105
83
|
orientation
|
|
106
84
|
),
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
canRemove: canRemoveBlock( clientId ),
|
|
111
|
-
canMove: canMoveBlock( clientId ),
|
|
85
|
+
canMove: canMoveBlock( clientId, rootClientId ),
|
|
86
|
+
getNextBlockClientId,
|
|
87
|
+
getPreviousBlockClientId,
|
|
112
88
|
};
|
|
113
89
|
},
|
|
114
90
|
[ clientId, rootClientId ]
|
|
115
91
|
);
|
|
116
|
-
const {
|
|
117
|
-
label,
|
|
118
|
-
icon,
|
|
119
|
-
blockMovingMode,
|
|
120
|
-
editorMode,
|
|
121
|
-
isBlockTemplatePart,
|
|
122
|
-
isNextBlockTemplatePart,
|
|
123
|
-
isPrevBlockTemplatePart,
|
|
124
|
-
canRemove,
|
|
125
|
-
canMove,
|
|
126
|
-
} = selected;
|
|
92
|
+
const { label, icon, blockMovingMode, editorMode, canMove } = selected;
|
|
127
93
|
const { setNavigationMode, removeBlock } = useDispatch( blockEditorStore );
|
|
128
|
-
const ref = useRef();
|
|
129
94
|
|
|
130
95
|
// Focus the breadcrumb in navigation mode.
|
|
131
96
|
useEffect( () => {
|
|
@@ -164,11 +129,6 @@ function BlockSelectionButton( { clientId, rootClientId } ) {
|
|
|
164
129
|
const isEnter = keyCode === ENTER;
|
|
165
130
|
const isSpace = keyCode === SPACE;
|
|
166
131
|
const isShift = event.shiftKey;
|
|
167
|
-
if ( isEscape && editorMode === 'navigation' ) {
|
|
168
|
-
setNavigationMode( false );
|
|
169
|
-
event.preventDefault();
|
|
170
|
-
return;
|
|
171
|
-
}
|
|
172
132
|
|
|
173
133
|
if ( keyCode === BACKSPACE || keyCode === DELETE ) {
|
|
174
134
|
removeBlock( clientId );
|
|
@@ -281,9 +241,7 @@ function BlockSelectionButton( { clientId, rootClientId } ) {
|
|
|
281
241
|
);
|
|
282
242
|
|
|
283
243
|
const dragHandleLabel = __( 'Drag' );
|
|
284
|
-
const showBlockDraggable =
|
|
285
|
-
( canMove && editorMode === 'navigation' ) ||
|
|
286
|
-
( editorMode === 'zoom-out' && canMove && ! isBlockTemplatePart );
|
|
244
|
+
const showBlockDraggable = canMove && editorMode === 'navigation';
|
|
287
245
|
|
|
288
246
|
return (
|
|
289
247
|
<div className={ classNames }>
|
|
@@ -312,36 +270,6 @@ function BlockSelectionButton( { clientId, rootClientId } ) {
|
|
|
312
270
|
</BlockDraggable>
|
|
313
271
|
</FlexItem>
|
|
314
272
|
) }
|
|
315
|
-
{ editorMode === 'zoom-out' && ! isBlockTemplatePart && (
|
|
316
|
-
<FlexItem>
|
|
317
|
-
<BlockMover
|
|
318
|
-
clientIds={ [ clientId ] }
|
|
319
|
-
hideDragHandle
|
|
320
|
-
isBlockMoverUpButtonDisabled={
|
|
321
|
-
isPrevBlockTemplatePart
|
|
322
|
-
}
|
|
323
|
-
isBlockMoverDownButtonDisabled={
|
|
324
|
-
isNextBlockTemplatePart
|
|
325
|
-
}
|
|
326
|
-
/>
|
|
327
|
-
</FlexItem>
|
|
328
|
-
) }
|
|
329
|
-
{ canMove && canRemove && editorMode === 'zoom-out' && (
|
|
330
|
-
<Shuffle clientId={ clientId } as={ Button } />
|
|
331
|
-
) }
|
|
332
|
-
{ canRemove &&
|
|
333
|
-
editorMode === 'zoom-out' &&
|
|
334
|
-
! isBlockTemplatePart && (
|
|
335
|
-
<FlexItem>
|
|
336
|
-
<ToolbarButton
|
|
337
|
-
icon={ trash }
|
|
338
|
-
label="Delete"
|
|
339
|
-
onClick={ () => {
|
|
340
|
-
removeBlock( clientId );
|
|
341
|
-
} }
|
|
342
|
-
/>
|
|
343
|
-
</FlexItem>
|
|
344
|
-
) }
|
|
345
273
|
{ editorMode === 'navigation' && (
|
|
346
274
|
<FlexItem>
|
|
347
275
|
<Button
|
|
@@ -368,4 +296,4 @@ function BlockSelectionButton( { clientId, rootClientId } ) {
|
|
|
368
296
|
);
|
|
369
297
|
}
|
|
370
298
|
|
|
371
|
-
export default BlockSelectionButton;
|
|
299
|
+
export default forwardRef( BlockSelectionButton );
|
|
@@ -3,6 +3,11 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* WordPress dependencies
|
|
8
|
+
*/
|
|
9
|
+
import { forwardRef } from '@wordpress/element';
|
|
10
|
+
|
|
6
11
|
/**
|
|
7
12
|
* Internal dependencies
|
|
8
13
|
*/
|
|
@@ -11,10 +16,7 @@ import { PrivateBlockPopover } from '../block-popover';
|
|
|
11
16
|
import useBlockToolbarPopoverProps from './use-block-toolbar-popover-props';
|
|
12
17
|
import useSelectedBlockToolProps from './use-selected-block-tool-props';
|
|
13
18
|
|
|
14
|
-
|
|
15
|
-
clientId,
|
|
16
|
-
__unstableContentRef,
|
|
17
|
-
} ) {
|
|
19
|
+
function BlockToolbarBreadcrumb( { clientId, __unstableContentRef }, ref ) {
|
|
18
20
|
const {
|
|
19
21
|
capturingClientId,
|
|
20
22
|
isInsertionPointVisible,
|
|
@@ -38,9 +40,12 @@ export default function BlockToolbarBreadcrumb( {
|
|
|
38
40
|
{ ...popoverProps }
|
|
39
41
|
>
|
|
40
42
|
<BlockSelectionButton
|
|
43
|
+
ref={ ref }
|
|
41
44
|
clientId={ clientId }
|
|
42
45
|
rootClientId={ rootClientId }
|
|
43
46
|
/>
|
|
44
47
|
</PrivateBlockPopover>
|
|
45
48
|
);
|
|
46
49
|
}
|
|
50
|
+
|
|
51
|
+
export default forwardRef( BlockToolbarBreadcrumb );
|
|
@@ -20,11 +20,13 @@ import {
|
|
|
20
20
|
} from './insertion-point';
|
|
21
21
|
import BlockToolbarPopover from './block-toolbar-popover';
|
|
22
22
|
import BlockToolbarBreadcrumb from './block-toolbar-breadcrumb';
|
|
23
|
+
import ZoomOutPopover from './zoom-out-popover';
|
|
23
24
|
import { store as blockEditorStore } from '../../store';
|
|
24
25
|
import usePopoverScroll from '../block-popover/use-popover-scroll';
|
|
25
26
|
import ZoomOutModeInserters from './zoom-out-mode-inserters';
|
|
26
27
|
import { useShowBlockTools } from './use-show-block-tools';
|
|
27
28
|
import { unlock } from '../../lock-unlock';
|
|
29
|
+
import getEditorRegion from '../../utils/get-editor-region';
|
|
28
30
|
|
|
29
31
|
function selector( select ) {
|
|
30
32
|
const {
|
|
@@ -78,9 +80,11 @@ export default function BlockTools( {
|
|
|
78
80
|
showEmptyBlockSideInserter,
|
|
79
81
|
showBreadcrumb,
|
|
80
82
|
showBlockToolbarPopover,
|
|
83
|
+
showZoomOutToolbar,
|
|
81
84
|
} = useShowBlockTools();
|
|
82
85
|
|
|
83
86
|
const {
|
|
87
|
+
clearSelectedBlock,
|
|
84
88
|
duplicateBlocks,
|
|
85
89
|
removeBlocks,
|
|
86
90
|
replaceBlocks,
|
|
@@ -92,6 +96,8 @@ export default function BlockTools( {
|
|
|
92
96
|
expandBlock,
|
|
93
97
|
} = unlock( useDispatch( blockEditorStore ) );
|
|
94
98
|
|
|
99
|
+
const blockSelectionButtonRef = useRef();
|
|
100
|
+
|
|
95
101
|
function onKeyDown( event ) {
|
|
96
102
|
if ( event.defaultPrevented ) {
|
|
97
103
|
return;
|
|
@@ -152,6 +158,13 @@ export default function BlockTools( {
|
|
|
152
158
|
// block so that focus is directed back to the beginning of the selection.
|
|
153
159
|
// In effect, to the user this feels like deselecting the multi-selection.
|
|
154
160
|
selectBlock( clientIds[ 0 ] );
|
|
161
|
+
} else if (
|
|
162
|
+
clientIds.length === 1 &&
|
|
163
|
+
event.target === blockSelectionButtonRef?.current
|
|
164
|
+
) {
|
|
165
|
+
event.preventDefault();
|
|
166
|
+
clearSelectedBlock();
|
|
167
|
+
getEditorRegion( __unstableContentRef.current )?.focus();
|
|
155
168
|
}
|
|
156
169
|
} else if ( isMatch( 'core/block-editor/collapse-list-view', event ) ) {
|
|
157
170
|
// If focus is currently within a text field, such as a rich text block or other editable field,
|
|
@@ -182,7 +195,6 @@ export default function BlockTools( {
|
|
|
182
195
|
}
|
|
183
196
|
}
|
|
184
197
|
}
|
|
185
|
-
|
|
186
198
|
const blockToolbarRef = usePopoverScroll( __unstableContentRef );
|
|
187
199
|
const blockToolbarAfterRef = usePopoverScroll( __unstableContentRef );
|
|
188
200
|
|
|
@@ -213,6 +225,14 @@ export default function BlockTools( {
|
|
|
213
225
|
|
|
214
226
|
{ showBreadcrumb && (
|
|
215
227
|
<BlockToolbarBreadcrumb
|
|
228
|
+
ref={ blockSelectionButtonRef }
|
|
229
|
+
__unstableContentRef={ __unstableContentRef }
|
|
230
|
+
clientId={ clientId }
|
|
231
|
+
/>
|
|
232
|
+
) }
|
|
233
|
+
|
|
234
|
+
{ showZoomOutToolbar && (
|
|
235
|
+
<ZoomOutPopover
|
|
216
236
|
__unstableContentRef={ __unstableContentRef }
|
|
217
237
|
clientId={ clientId }
|
|
218
238
|
/>
|
|
@@ -270,3 +270,18 @@
|
|
|
270
270
|
top: 50%;
|
|
271
271
|
left: 50%;
|
|
272
272
|
}
|
|
273
|
+
|
|
274
|
+
.zoom-out-toolbar {
|
|
275
|
+
|
|
276
|
+
.block-editor-block-mover-button.block-editor-block-mover-button:focus-visible::before,
|
|
277
|
+
.zoom-out-toolbar-button:focus::before,
|
|
278
|
+
.block-editor-block-toolbar-shuffle:focus::before,
|
|
279
|
+
.block-selection-button_drag-handle:focus::before {
|
|
280
|
+
box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
.block-editor-block-mover {
|
|
284
|
+
background: none;
|
|
285
|
+
border: none;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
@@ -41,18 +41,26 @@ export function useShowBlockTools() {
|
|
|
41
41
|
const maybeShowBreadcrumb =
|
|
42
42
|
hasSelectedBlock &&
|
|
43
43
|
! hasMultiSelection() &&
|
|
44
|
-
|
|
44
|
+
editorMode === 'navigation';
|
|
45
|
+
|
|
46
|
+
const _showBlockToolbarPopover =
|
|
47
|
+
editorMode !== 'zoom-out' &&
|
|
48
|
+
! getSettings().hasFixedToolbar &&
|
|
49
|
+
! _showEmptyBlockSideInserter &&
|
|
50
|
+
hasSelectedBlock &&
|
|
51
|
+
! isEmptyDefaultBlock &&
|
|
52
|
+
! maybeShowBreadcrumb;
|
|
45
53
|
|
|
46
54
|
return {
|
|
47
55
|
showEmptyBlockSideInserter: _showEmptyBlockSideInserter,
|
|
48
56
|
showBreadcrumb:
|
|
49
57
|
! _showEmptyBlockSideInserter && maybeShowBreadcrumb,
|
|
50
|
-
showBlockToolbarPopover:
|
|
51
|
-
|
|
58
|
+
showBlockToolbarPopover: _showBlockToolbarPopover,
|
|
59
|
+
showZoomOutToolbar:
|
|
60
|
+
editorMode === 'zoom-out' &&
|
|
52
61
|
! _showEmptyBlockSideInserter &&
|
|
53
|
-
|
|
54
|
-
!
|
|
55
|
-
! maybeShowBreadcrumb,
|
|
62
|
+
! maybeShowBreadcrumb &&
|
|
63
|
+
! _showBlockToolbarPopover,
|
|
56
64
|
};
|
|
57
65
|
}, [] );
|
|
58
66
|
}
|
|
@@ -21,9 +21,10 @@ function ZoomOutModeInserters() {
|
|
|
21
21
|
sectionRootClientId,
|
|
22
22
|
insertionPoint,
|
|
23
23
|
setInserterIsOpened,
|
|
24
|
-
|
|
24
|
+
hasSelection,
|
|
25
25
|
} = useSelect( ( select ) => {
|
|
26
|
-
const { getSettings, getBlockOrder } =
|
|
26
|
+
const { getSettings, getBlockOrder, getSelectionStart } =
|
|
27
|
+
select( blockEditorStore );
|
|
27
28
|
const { sectionRootClientId: root } = unlock( getSettings() );
|
|
28
29
|
// To do: move ZoomOutModeInserters to core/editor.
|
|
29
30
|
// Or we perhaps we should move the insertion point state to the
|
|
@@ -33,7 +34,7 @@ function ZoomOutModeInserters() {
|
|
|
33
34
|
// eslint-disable-next-line @wordpress/data-no-store-string-literals
|
|
34
35
|
const editor = select( 'core/editor' );
|
|
35
36
|
return {
|
|
36
|
-
|
|
37
|
+
hasSelection: !! getSelectionStart().clientId,
|
|
37
38
|
blockOrder: getBlockOrder( root ),
|
|
38
39
|
insertionPoint: unlock( editor ).getInsertionPoint(),
|
|
39
40
|
sectionRootClientId: root,
|
|
@@ -63,7 +64,7 @@ function ZoomOutModeInserters() {
|
|
|
63
64
|
};
|
|
64
65
|
}, [] );
|
|
65
66
|
|
|
66
|
-
if ( ! isReady || !
|
|
67
|
+
if ( ! isReady || ! hasSelection ) {
|
|
67
68
|
return null;
|
|
68
69
|
}
|
|
69
70
|
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import clsx from 'clsx';
|
|
5
|
+
/**
|
|
6
|
+
* Internal dependencies
|
|
7
|
+
*/
|
|
8
|
+
import BlockPopover from '../block-popover';
|
|
9
|
+
import useBlockToolbarPopoverProps from './use-block-toolbar-popover-props';
|
|
10
|
+
import useSelectedBlockToolProps from './use-selected-block-tool-props';
|
|
11
|
+
import ZoomOutToolbar from './zoom-out-toolbar';
|
|
12
|
+
|
|
13
|
+
export default function ZoomOutPopover( { clientId, __unstableContentRef } ) {
|
|
14
|
+
const {
|
|
15
|
+
capturingClientId,
|
|
16
|
+
isInsertionPointVisible,
|
|
17
|
+
lastClientId,
|
|
18
|
+
rootClientId,
|
|
19
|
+
} = useSelectedBlockToolProps( clientId );
|
|
20
|
+
|
|
21
|
+
const popoverProps = useBlockToolbarPopoverProps( {
|
|
22
|
+
contentElement: __unstableContentRef?.current,
|
|
23
|
+
clientId,
|
|
24
|
+
} );
|
|
25
|
+
|
|
26
|
+
// Override some of the popover props for the zoom-out toolbar.
|
|
27
|
+
const props = {
|
|
28
|
+
...popoverProps,
|
|
29
|
+
placement: 'left-start',
|
|
30
|
+
flip: false,
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<BlockPopover
|
|
35
|
+
clientId={ capturingClientId || clientId }
|
|
36
|
+
bottomClientId={ lastClientId }
|
|
37
|
+
className={ clsx( 'zoom-out-toolbar-popover', {
|
|
38
|
+
'is-insertion-point-visible': isInsertionPointVisible,
|
|
39
|
+
} ) }
|
|
40
|
+
resize={ false }
|
|
41
|
+
{ ...props }
|
|
42
|
+
>
|
|
43
|
+
<ZoomOutToolbar
|
|
44
|
+
clientId={ clientId }
|
|
45
|
+
rootClientId={ rootClientId }
|
|
46
|
+
/>
|
|
47
|
+
</BlockPopover>
|
|
48
|
+
);
|
|
49
|
+
}
|