@wordpress/block-editor 13.1.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 +21 -17
- package/README.md +1 -2
- package/build/components/block-breadcrumb/index.js +12 -1
- package/build/components/block-breadcrumb/index.js.map +1 -1
- package/build/components/block-lock/modal.js +67 -67
- package/build/components/block-lock/modal.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 +12 -6
- 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 +4 -1
- 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 +193 -127
- 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 +25 -9
- 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 +94 -0
- package/build/components/grid/grid-item-movers.js.map +1 -0
- package/build/components/{grid-visualizer → grid}/grid-item-resizer.js +18 -56
- package/build/components/grid/grid-item-resizer.js.map +1 -0
- package/build/components/grid/grid-visualizer.js +305 -0
- package/build/components/grid/grid-visualizer.js.map +1 -0
- package/build/components/{grid-visualizer → grid}/index.js +14 -0
- package/build/components/grid/index.js.map +1 -0
- package/build/components/grid/use-get-number-of-blocks-before-cell.js +40 -0
- package/build/components/grid/use-get-number-of-blocks-before-cell.js.map +1 -0
- package/build/components/grid/use-grid-layout-sync.js +169 -0
- package/build/components/grid/use-grid-layout-sync.js.map +1 -0
- package/build/components/grid/utils.js +145 -0
- package/build/components/grid/utils.js.map +1 -0
- package/build/components/image-editor/aspect-ratio-dropdown.js +0 -1
- package/build/components/image-editor/aspect-ratio-dropdown.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/rich-text/event-listeners/input-rules.js +1 -0
- package/build/components/rich-text/event-listeners/input-rules.js.map +1 -1
- package/build/components/rich-text/index.native.js +10 -4
- package/build/components/rich-text/index.native.js.map +1 -1
- package/build/components/rich-text/native/index.native.js +14 -0
- package/build/components/rich-text/native/index.native.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 +195 -11
- 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 +65 -40
- 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 +5 -2
- 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 +92 -76
- package/build/layouts/grid.js.map +1 -1
- package/build/lock-unlock.js +1 -1
- package/build/lock-unlock.js.map +1 -1
- package/build/private-apis.js +6 -1
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +17 -1
- package/build/store/actions.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/modal.js +67 -67
- package/build-module/components/block-lock/modal.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 +12 -6
- 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 +4 -1
- 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 +194 -128
- 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 +25 -9
- 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 +87 -0
- package/build-module/components/grid/grid-item-movers.js.map +1 -0
- package/build-module/components/{grid-visualizer → grid}/grid-item-resizer.js +13 -51
- package/build-module/components/grid/grid-item-resizer.js.map +1 -0
- package/build-module/components/grid/grid-visualizer.js +297 -0
- package/build-module/components/grid/grid-visualizer.js.map +1 -0
- package/build-module/components/grid/index.js +5 -0
- package/build-module/components/grid/index.js.map +1 -0
- package/build-module/components/grid/use-get-number-of-blocks-before-cell.js +33 -0
- package/build-module/components/grid/use-get-number-of-blocks-before-cell.js.map +1 -0
- package/build-module/components/grid/use-grid-layout-sync.js +162 -0
- package/build-module/components/grid/use-grid-layout-sync.js.map +1 -0
- package/build-module/components/grid/utils.js +131 -0
- package/build-module/components/grid/utils.js.map +1 -0
- package/build-module/components/image-editor/aspect-ratio-dropdown.js +0 -1
- package/build-module/components/image-editor/aspect-ratio-dropdown.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/rich-text/event-listeners/input-rules.js +1 -1
- package/build-module/components/rich-text/event-listeners/input-rules.js.map +1 -1
- package/build-module/components/rich-text/index.native.js +11 -5
- package/build-module/components/rich-text/index.native.js.map +1 -1
- package/build-module/components/rich-text/native/index.native.js +14 -0
- package/build-module/components/rich-text/native/index.native.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 +193 -11
- 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 +63 -38
- 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 +5 -2
- 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 +92 -76
- package/build-module/layouts/grid.js.map +1 -1
- package/build-module/lock-unlock.js +1 -1
- package/build-module/lock-unlock.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/actions.js +17 -1
- package/build-module/store/actions.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 +238 -106
- package/build-style/style.css +238 -106
- package/package.json +32 -32
- package/src/components/block-breadcrumb/index.js +16 -1
- package/src/components/block-lock/modal.js +95 -82
- package/src/components/block-lock/style.scss +11 -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 +37 -24
- 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 +4 -1
- 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 +243 -160
- 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/test/use-global-styles-output.js +38 -3
- 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 +25 -9
- package/src/components/global-styles/utils.js +17 -6
- package/src/components/grid/grid-item-movers.js +112 -0
- package/src/components/{grid-visualizer → grid}/grid-item-resizer.js +15 -52
- package/src/components/grid/grid-visualizer.js +384 -0
- package/src/components/grid/index.js +4 -0
- package/src/components/grid/style.scss +98 -0
- package/src/components/grid/use-get-number-of-blocks-before-cell.js +30 -0
- package/src/components/grid/use-grid-layout-sync.js +170 -0
- package/src/components/grid/utils.js +178 -0
- package/src/components/iframe/content.scss +1 -0
- package/src/components/image-editor/aspect-ratio-dropdown.js +0 -1
- package/src/components/inner-blocks/index.js +4 -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/rich-text/event-listeners/input-rules.js +1 -1
- package/src/components/rich-text/index.native.js +10 -8
- package/src/components/rich-text/native/index.native.js +17 -0
- 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 +226 -9
- 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 +75 -39
- 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 +5 -1
- package/src/layouts/constrained.js +43 -2
- package/src/layouts/grid.js +175 -88
- package/src/lock-unlock.js +1 -1
- package/src/private-apis.js +12 -1
- package/src/store/actions.js +21 -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 +2 -2
- 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/build/components/grid-visualizer/grid-item-resizer.js.map +0 -1
- package/build/components/grid-visualizer/grid-visualizer.js +0 -92
- package/build/components/grid-visualizer/grid-visualizer.js.map +0 -1
- package/build/components/grid-visualizer/index.js.map +0 -1
- package/build/components/grid-visualizer/utils.js +0 -10
- package/build/components/grid-visualizer/utils.js.map +0 -1
- package/build-module/components/grid-visualizer/grid-item-resizer.js.map +0 -1
- package/build-module/components/grid-visualizer/grid-visualizer.js +0 -84
- package/build-module/components/grid-visualizer/grid-visualizer.js.map +0 -1
- package/build-module/components/grid-visualizer/index.js +0 -3
- package/build-module/components/grid-visualizer/index.js.map +0 -1
- package/build-module/components/grid-visualizer/utils.js +0 -4
- package/build-module/components/grid-visualizer/utils.js.map +0 -1
- package/src/components/grid-visualizer/grid-visualizer.js +0 -101
- package/src/components/grid-visualizer/index.js +0 -2
- package/src/components/grid-visualizer/style.scss +0 -34
- package/src/components/grid-visualizer/utils.js +0 -5
- package/src/hooks/position.scss +0 -18
- /package/src/components/font-sizes/{README.MD → README.md} +0 -0
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import clsx from 'clsx';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* WordPress dependencies
|
|
8
|
+
*/
|
|
9
|
+
import { dragHandle, trash } from '@wordpress/icons';
|
|
10
|
+
import { Button, ToolbarButton } from '@wordpress/components';
|
|
11
|
+
import { useSelect, useDispatch } from '@wordpress/data';
|
|
12
|
+
import { store as blocksStore } from '@wordpress/blocks';
|
|
13
|
+
import { __ } from '@wordpress/i18n';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Internal dependencies
|
|
17
|
+
*/
|
|
18
|
+
import { store as blockEditorStore } from '../../store';
|
|
19
|
+
import BlockDraggable from '../block-draggable';
|
|
20
|
+
import BlockMover from '../block-mover';
|
|
21
|
+
import Shuffle from '../block-toolbar/shuffle';
|
|
22
|
+
import NavigableToolbar from '../navigable-toolbar';
|
|
23
|
+
|
|
24
|
+
export default function ZoomOutToolbar( { clientId, rootClientId } ) {
|
|
25
|
+
const selected = useSelect(
|
|
26
|
+
( select ) => {
|
|
27
|
+
const {
|
|
28
|
+
getBlock,
|
|
29
|
+
hasBlockMovingClientId,
|
|
30
|
+
getNextBlockClientId,
|
|
31
|
+
getPreviousBlockClientId,
|
|
32
|
+
canRemoveBlock,
|
|
33
|
+
canMoveBlock,
|
|
34
|
+
} = select( blockEditorStore );
|
|
35
|
+
const { getBlockType } = select( blocksStore );
|
|
36
|
+
const { name } = getBlock( clientId );
|
|
37
|
+
const blockType = getBlockType( name );
|
|
38
|
+
const isBlockTemplatePart =
|
|
39
|
+
blockType?.name === 'core/template-part';
|
|
40
|
+
|
|
41
|
+
let isNextBlockTemplatePart = false;
|
|
42
|
+
const nextClientId = getNextBlockClientId();
|
|
43
|
+
if ( nextClientId ) {
|
|
44
|
+
const { name: nextName } = getBlock( nextClientId );
|
|
45
|
+
const nextBlockType = getBlockType( nextName );
|
|
46
|
+
isNextBlockTemplatePart =
|
|
47
|
+
nextBlockType?.name === 'core/template-part';
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
let isPrevBlockTemplatePart = false;
|
|
51
|
+
const prevClientId = getPreviousBlockClientId();
|
|
52
|
+
if ( prevClientId ) {
|
|
53
|
+
const { name: prevName } = getBlock( prevClientId );
|
|
54
|
+
const prevBlockType = getBlockType( prevName );
|
|
55
|
+
isPrevBlockTemplatePart =
|
|
56
|
+
prevBlockType?.name === 'core/template-part';
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return {
|
|
60
|
+
blockMovingMode: hasBlockMovingClientId(),
|
|
61
|
+
isBlockTemplatePart,
|
|
62
|
+
isNextBlockTemplatePart,
|
|
63
|
+
isPrevBlockTemplatePart,
|
|
64
|
+
canRemove: canRemoveBlock( clientId, rootClientId ),
|
|
65
|
+
canMove: canMoveBlock( clientId, rootClientId ),
|
|
66
|
+
};
|
|
67
|
+
},
|
|
68
|
+
[ clientId, rootClientId ]
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
const {
|
|
72
|
+
blockMovingMode,
|
|
73
|
+
isBlockTemplatePart,
|
|
74
|
+
isNextBlockTemplatePart,
|
|
75
|
+
isPrevBlockTemplatePart,
|
|
76
|
+
canRemove,
|
|
77
|
+
canMove,
|
|
78
|
+
} = selected;
|
|
79
|
+
|
|
80
|
+
const { removeBlock } = useDispatch( blockEditorStore );
|
|
81
|
+
|
|
82
|
+
const classNames = clsx( 'zoom-out-toolbar', {
|
|
83
|
+
'is-block-moving-mode': !! blockMovingMode,
|
|
84
|
+
} );
|
|
85
|
+
|
|
86
|
+
const showBlockDraggable = canMove && ! isBlockTemplatePart;
|
|
87
|
+
|
|
88
|
+
return (
|
|
89
|
+
<NavigableToolbar
|
|
90
|
+
className={ classNames }
|
|
91
|
+
/* translators: accessibility text for the block toolbar */
|
|
92
|
+
aria-label={ __( 'Block tools' ) }
|
|
93
|
+
// The variant is applied as "toolbar" when undefined, which is the black border style of the dropdown from the toolbar popover.
|
|
94
|
+
variant="unstyled"
|
|
95
|
+
orientation="vertical"
|
|
96
|
+
>
|
|
97
|
+
{ showBlockDraggable && (
|
|
98
|
+
<BlockDraggable clientIds={ [ clientId ] }>
|
|
99
|
+
{ ( draggableProps ) => (
|
|
100
|
+
<Button
|
|
101
|
+
icon={ dragHandle }
|
|
102
|
+
className="block-selection-button_drag-handle zoom-out-toolbar-button"
|
|
103
|
+
aria-hidden="true"
|
|
104
|
+
label={ __( 'Drag' ) }
|
|
105
|
+
iconSize={ 24 }
|
|
106
|
+
size="compact"
|
|
107
|
+
// Should not be able to tab to drag handle as this
|
|
108
|
+
// button can only be used with a pointer device.
|
|
109
|
+
tabIndex="-1"
|
|
110
|
+
{ ...draggableProps }
|
|
111
|
+
/>
|
|
112
|
+
) }
|
|
113
|
+
</BlockDraggable>
|
|
114
|
+
) }
|
|
115
|
+
{ ! isBlockTemplatePart && (
|
|
116
|
+
<BlockMover
|
|
117
|
+
clientIds={ [ clientId ] }
|
|
118
|
+
hideDragHandle
|
|
119
|
+
isBlockMoverUpButtonDisabled={ isPrevBlockTemplatePart }
|
|
120
|
+
isBlockMoverDownButtonDisabled={ isNextBlockTemplatePart }
|
|
121
|
+
iconSize={ 24 }
|
|
122
|
+
size="compact"
|
|
123
|
+
/>
|
|
124
|
+
) }
|
|
125
|
+
{ canMove && canRemove && (
|
|
126
|
+
<Shuffle clientId={ clientId } as={ ToolbarButton } />
|
|
127
|
+
) }
|
|
128
|
+
{ canRemove && ! isBlockTemplatePart && (
|
|
129
|
+
<ToolbarButton
|
|
130
|
+
className="zoom-out-toolbar-button"
|
|
131
|
+
icon={ trash }
|
|
132
|
+
label="Delete"
|
|
133
|
+
onClick={ () => {
|
|
134
|
+
removeBlock( clientId );
|
|
135
|
+
} }
|
|
136
|
+
/>
|
|
137
|
+
) }
|
|
138
|
+
</NavigableToolbar>
|
|
139
|
+
);
|
|
140
|
+
}
|
|
@@ -18,7 +18,7 @@ import deprecated from '@wordpress/deprecated';
|
|
|
18
18
|
import Inserter from '../inserter';
|
|
19
19
|
|
|
20
20
|
function ButtonBlockAppender(
|
|
21
|
-
{ rootClientId, className, onFocus, tabIndex },
|
|
21
|
+
{ rootClientId, className, onFocus, tabIndex, onSelect },
|
|
22
22
|
ref
|
|
23
23
|
) {
|
|
24
24
|
return (
|
|
@@ -26,6 +26,7 @@ function ButtonBlockAppender(
|
|
|
26
26
|
position="bottom center"
|
|
27
27
|
rootClientId={ rootClientId }
|
|
28
28
|
__experimentalIsQuick
|
|
29
|
+
onSelectOrClose={ onSelect }
|
|
29
30
|
renderToggle={ ( {
|
|
30
31
|
onToggle,
|
|
31
32
|
disabled,
|