@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
|
@@ -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,
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
Flex,
|
|
13
13
|
FlexItem,
|
|
14
14
|
} from '@wordpress/components';
|
|
15
|
-
import { __ } from '@wordpress/i18n';
|
|
15
|
+
import { __, _x } from '@wordpress/i18n';
|
|
16
16
|
import { useEffect } from '@wordpress/element';
|
|
17
17
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
18
18
|
|
|
@@ -142,17 +142,26 @@ function FlexControls( {
|
|
|
142
142
|
<ToggleGroupControlOption
|
|
143
143
|
key="fit"
|
|
144
144
|
value="fit"
|
|
145
|
-
label={
|
|
145
|
+
label={ _x(
|
|
146
|
+
'Fit',
|
|
147
|
+
'Intrinsic block width in flex layout'
|
|
148
|
+
) }
|
|
146
149
|
/>
|
|
147
150
|
<ToggleGroupControlOption
|
|
148
151
|
key="fill"
|
|
149
152
|
value="fill"
|
|
150
|
-
label={
|
|
153
|
+
label={ _x(
|
|
154
|
+
'Grow',
|
|
155
|
+
'Block with expanding width in flex layout'
|
|
156
|
+
) }
|
|
151
157
|
/>
|
|
152
158
|
<ToggleGroupControlOption
|
|
153
159
|
key="fixed"
|
|
154
160
|
value="fixed"
|
|
155
|
-
label={
|
|
161
|
+
label={ _x(
|
|
162
|
+
'Fixed',
|
|
163
|
+
'Block with fixed width in flex layout'
|
|
164
|
+
) }
|
|
156
165
|
/>
|
|
157
166
|
</ToggleGroupControl>
|
|
158
167
|
{ selfStretch === 'fixed' && (
|
|
@@ -184,8 +193,7 @@ function GridControls( {
|
|
|
184
193
|
panelId,
|
|
185
194
|
} ) {
|
|
186
195
|
const { columnStart, rowStart, columnSpan, rowSpan } = childLayout;
|
|
187
|
-
const { columnCount } = parentLayout ?? {};
|
|
188
|
-
const gridColumnNumber = parseInt( columnCount, 10 ) || 3;
|
|
196
|
+
const { columnCount = 3, rowCount } = parentLayout ?? {};
|
|
189
197
|
const rootClientId = useSelect( ( select ) =>
|
|
190
198
|
select( blockEditorStore ).getBlockRootClientId( panelId )
|
|
191
199
|
);
|
|
@@ -193,7 +201,7 @@ function GridControls( {
|
|
|
193
201
|
useDispatch( blockEditorStore );
|
|
194
202
|
const getNumberOfBlocksBeforeCell = useGetNumberOfBlocksBeforeCell(
|
|
195
203
|
rootClientId,
|
|
196
|
-
|
|
204
|
+
columnCount
|
|
197
205
|
);
|
|
198
206
|
const hasStartValue = () => !! columnStart || !! rowStart;
|
|
199
207
|
const hasSpanValue = () => !! columnSpan || !! rowSpan;
|
|
@@ -225,14 +233,17 @@ function GridControls( {
|
|
|
225
233
|
label={ __( 'Column span' ) }
|
|
226
234
|
type="number"
|
|
227
235
|
onChange={ ( value ) => {
|
|
236
|
+
// Don't allow unsetting.
|
|
237
|
+
const newColumnSpan =
|
|
238
|
+
value === '' ? 1 : parseInt( value, 10 );
|
|
228
239
|
onChange( {
|
|
229
240
|
columnStart,
|
|
230
241
|
rowStart,
|
|
231
242
|
rowSpan,
|
|
232
|
-
columnSpan:
|
|
243
|
+
columnSpan: newColumnSpan,
|
|
233
244
|
} );
|
|
234
245
|
} }
|
|
235
|
-
value={ columnSpan }
|
|
246
|
+
value={ columnSpan ?? 1 }
|
|
236
247
|
min={ 1 }
|
|
237
248
|
/>
|
|
238
249
|
<InputControl
|
|
@@ -240,14 +251,17 @@ function GridControls( {
|
|
|
240
251
|
label={ __( 'Row span' ) }
|
|
241
252
|
type="number"
|
|
242
253
|
onChange={ ( value ) => {
|
|
254
|
+
// Don't allow unsetting.
|
|
255
|
+
const newRowSpan =
|
|
256
|
+
value === '' ? 1 : parseInt( value, 10 );
|
|
243
257
|
onChange( {
|
|
244
258
|
columnStart,
|
|
245
259
|
rowStart,
|
|
246
260
|
columnSpan,
|
|
247
|
-
rowSpan:
|
|
261
|
+
rowSpan: newRowSpan,
|
|
248
262
|
} );
|
|
249
263
|
} }
|
|
250
|
-
value={ rowSpan }
|
|
264
|
+
value={ rowSpan ?? 1 }
|
|
251
265
|
min={ 1 }
|
|
252
266
|
/>
|
|
253
267
|
</HStack>
|
|
@@ -269,8 +283,11 @@ function GridControls( {
|
|
|
269
283
|
label={ __( 'Column' ) }
|
|
270
284
|
type="number"
|
|
271
285
|
onChange={ ( value ) => {
|
|
286
|
+
// Don't allow unsetting.
|
|
287
|
+
const newColumnStart =
|
|
288
|
+
value === '' ? 1 : parseInt( value, 10 );
|
|
272
289
|
onChange( {
|
|
273
|
-
columnStart:
|
|
290
|
+
columnStart: newColumnStart,
|
|
274
291
|
rowStart,
|
|
275
292
|
columnSpan,
|
|
276
293
|
rowSpan,
|
|
@@ -281,16 +298,16 @@ function GridControls( {
|
|
|
281
298
|
rootClientId,
|
|
282
299
|
rootClientId,
|
|
283
300
|
getNumberOfBlocksBeforeCell(
|
|
284
|
-
|
|
301
|
+
newColumnStart,
|
|
285
302
|
rowStart
|
|
286
303
|
)
|
|
287
304
|
);
|
|
288
305
|
} }
|
|
289
|
-
value={ columnStart }
|
|
306
|
+
value={ columnStart ?? 1 }
|
|
290
307
|
min={ 1 }
|
|
291
308
|
max={
|
|
292
|
-
|
|
293
|
-
?
|
|
309
|
+
columnCount
|
|
310
|
+
? columnCount - ( columnSpan ?? 1 ) + 1
|
|
294
311
|
: undefined
|
|
295
312
|
}
|
|
296
313
|
/>
|
|
@@ -301,9 +318,12 @@ function GridControls( {
|
|
|
301
318
|
label={ __( 'Row' ) }
|
|
302
319
|
type="number"
|
|
303
320
|
onChange={ ( value ) => {
|
|
321
|
+
// Don't allow unsetting.
|
|
322
|
+
const newRowStart =
|
|
323
|
+
value === '' ? 1 : parseInt( value, 10 );
|
|
304
324
|
onChange( {
|
|
305
325
|
columnStart,
|
|
306
|
-
rowStart:
|
|
326
|
+
rowStart: newRowStart,
|
|
307
327
|
columnSpan,
|
|
308
328
|
rowSpan,
|
|
309
329
|
} );
|
|
@@ -314,17 +334,15 @@ function GridControls( {
|
|
|
314
334
|
rootClientId,
|
|
315
335
|
getNumberOfBlocksBeforeCell(
|
|
316
336
|
columnStart,
|
|
317
|
-
|
|
337
|
+
newRowStart
|
|
318
338
|
)
|
|
319
339
|
);
|
|
320
340
|
} }
|
|
321
|
-
value={ rowStart }
|
|
341
|
+
value={ rowStart ?? 1 }
|
|
322
342
|
min={ 1 }
|
|
323
343
|
max={
|
|
324
|
-
|
|
325
|
-
?
|
|
326
|
-
( rowSpan ?? 1 ) +
|
|
327
|
-
1
|
|
344
|
+
rowCount
|
|
345
|
+
? rowCount - ( rowSpan ?? 1 ) + 1
|
|
328
346
|
: undefined
|
|
329
347
|
}
|
|
330
348
|
/>
|
|
@@ -8,11 +8,20 @@ import {
|
|
|
8
8
|
TextControl,
|
|
9
9
|
ExternalLink,
|
|
10
10
|
VisuallyHidden,
|
|
11
|
-
CustomSelectControl,
|
|
12
11
|
ToggleControl,
|
|
13
12
|
__experimentalVStack as VStack,
|
|
13
|
+
privateApis as componentsPrivateApis,
|
|
14
14
|
} from '@wordpress/components';
|
|
15
15
|
|
|
16
|
+
/**
|
|
17
|
+
* Internal dependencies
|
|
18
|
+
*/
|
|
19
|
+
import { unlock } from '../../lock-unlock';
|
|
20
|
+
|
|
21
|
+
const { CustomSelectControlV2Legacy: CustomSelectControl } = unlock(
|
|
22
|
+
componentsPrivateApis
|
|
23
|
+
);
|
|
24
|
+
|
|
16
25
|
// So that we illustrate the different formats in the dropdown properly, show a date that is
|
|
17
26
|
// somwhat recent, has a day greater than 12, and a month with more than three letters.
|
|
18
27
|
const exampleDate = new Date();
|
|
@@ -4,13 +4,4 @@
|
|
|
4
4
|
|
|
5
5
|
.block-editor-date-format-picker__custom-format-select-control__custom-option {
|
|
6
6
|
border-top: 1px solid $gray-300;
|
|
7
|
-
|
|
8
|
-
&.has-hint {
|
|
9
|
-
grid-template-columns: auto 30px;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
.components-custom-select-control__item-hint {
|
|
13
|
-
grid-row: 2;
|
|
14
|
-
text-align: left;
|
|
15
|
-
}
|
|
16
7
|
}
|
|
@@ -58,6 +58,7 @@ function DimensionsTool( {
|
|
|
58
58
|
scaleOptions, // Default options handled by ScaleTool.
|
|
59
59
|
defaultScale = 'fill', // Match CSS default value for object-fit.
|
|
60
60
|
unitsOptions, // Default options handled by UnitControl.
|
|
61
|
+
tools = [ 'aspectRatio', 'widthHeight', 'scale' ],
|
|
61
62
|
} ) {
|
|
62
63
|
// Coerce undefined and CSS default values to be null.
|
|
63
64
|
const width =
|
|
@@ -92,95 +93,102 @@ function DimensionsTool( {
|
|
|
92
93
|
|
|
93
94
|
return (
|
|
94
95
|
<>
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
nextAspectRatio
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
96
|
+
{ tools.includes( 'aspectRatio' ) && (
|
|
97
|
+
<AspectRatioTool
|
|
98
|
+
panelId={ panelId }
|
|
99
|
+
options={ aspectRatioOptions }
|
|
100
|
+
defaultValue={ defaultAspectRatio }
|
|
101
|
+
value={ aspectRatioValue }
|
|
102
|
+
onChange={ ( nextAspectRatio ) => {
|
|
103
|
+
const nextValue = { ...value };
|
|
104
|
+
|
|
105
|
+
// 'auto' is CSS default, so it gets treated as null.
|
|
106
|
+
nextAspectRatio =
|
|
107
|
+
nextAspectRatio === 'auto' ? null : nextAspectRatio;
|
|
108
|
+
|
|
109
|
+
setLastAspectRatio( nextAspectRatio );
|
|
110
|
+
|
|
111
|
+
// Update aspectRatio.
|
|
112
|
+
if ( ! nextAspectRatio ) {
|
|
113
|
+
delete nextValue.aspectRatio;
|
|
114
|
+
} else {
|
|
115
|
+
nextValue.aspectRatio = nextAspectRatio;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// Auto-update scale.
|
|
119
|
+
if ( ! nextAspectRatio ) {
|
|
120
|
+
delete nextValue.scale;
|
|
121
|
+
} else if ( lastScale ) {
|
|
122
|
+
nextValue.scale = lastScale;
|
|
123
|
+
} else {
|
|
124
|
+
nextValue.scale = defaultScale;
|
|
125
|
+
setLastScale( defaultScale );
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// Auto-update width and height.
|
|
129
|
+
if ( 'custom' !== nextAspectRatio && width && height ) {
|
|
130
|
+
delete nextValue.height;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
onChange( nextValue );
|
|
134
|
+
} }
|
|
135
|
+
/>
|
|
136
|
+
) }
|
|
137
|
+
{ tools.includes( 'widthHeight' ) && (
|
|
138
|
+
<WidthHeightTool
|
|
139
|
+
panelId={ panelId }
|
|
140
|
+
units={ unitsOptions }
|
|
141
|
+
value={ { width, height } }
|
|
142
|
+
onChange={ ( { width: nextWidth, height: nextHeight } ) => {
|
|
143
|
+
const nextValue = { ...value };
|
|
144
|
+
|
|
145
|
+
// 'auto' is CSS default, so it gets treated as null.
|
|
146
|
+
nextWidth = nextWidth === 'auto' ? null : nextWidth;
|
|
147
|
+
nextHeight = nextHeight === 'auto' ? null : nextHeight;
|
|
148
|
+
|
|
149
|
+
// Update width.
|
|
150
|
+
if ( ! nextWidth ) {
|
|
151
|
+
delete nextValue.width;
|
|
152
|
+
} else {
|
|
153
|
+
nextValue.width = nextWidth;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// Update height.
|
|
157
|
+
if ( ! nextHeight ) {
|
|
158
|
+
delete nextValue.height;
|
|
159
|
+
} else {
|
|
160
|
+
nextValue.height = nextHeight;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
// Auto-update aspectRatio.
|
|
164
|
+
if ( nextWidth && nextHeight ) {
|
|
165
|
+
delete nextValue.aspectRatio;
|
|
166
|
+
} else if ( lastAspectRatio ) {
|
|
167
|
+
nextValue.aspectRatio = lastAspectRatio;
|
|
168
|
+
} else {
|
|
169
|
+
// No setting defaultAspectRatio here, because
|
|
170
|
+
// aspectRatio is optional in this scenario,
|
|
171
|
+
// unlike scale.
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// Auto-update scale.
|
|
175
|
+
if (
|
|
176
|
+
! lastAspectRatio &&
|
|
177
|
+
!! nextWidth !== !! nextHeight
|
|
178
|
+
) {
|
|
179
|
+
delete nextValue.scale;
|
|
180
|
+
} else if ( lastScale ) {
|
|
181
|
+
nextValue.scale = lastScale;
|
|
182
|
+
} else {
|
|
183
|
+
nextValue.scale = defaultScale;
|
|
184
|
+
setLastScale( defaultScale );
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
onChange( nextValue );
|
|
188
|
+
} }
|
|
189
|
+
/>
|
|
190
|
+
) }
|
|
191
|
+
{ tools.includes( 'scale' ) && showScaleControl && (
|
|
184
192
|
<ScaleTool
|
|
185
193
|
panelId={ panelId }
|
|
186
194
|
options={ scaleOptions }
|