@wordpress/block-editor 13.4.0 → 14.1.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 +13 -0
- package/README.md +20 -15
- package/build/autocompleters/block.js +1 -1
- package/build/autocompleters/block.js.map +1 -1
- package/build/components/block-breadcrumb/index.js +3 -1
- package/build/components/block-breadcrumb/index.js.map +1 -1
- package/build/components/block-draggable/index.js +2 -2
- package/build/components/block-draggable/index.js.map +1 -1
- package/build/components/block-list/use-block-props/index.js +2 -2
- package/build/components/block-list/use-block-props/index.js.map +1 -1
- package/build/components/block-list/use-block-props/use-block-refs.js +24 -32
- package/build/components/block-list/use-block-props/use-block-refs.js.map +1 -1
- package/build/components/block-list/use-in-between-inserter.js +11 -4
- package/build/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build/components/block-mover/index.js +1 -2
- package/build/components/block-mover/index.js.map +1 -1
- package/build/components/block-popover/cover.js +1 -1
- package/build/components/block-popover/cover.js.map +1 -1
- package/build/components/block-popover/inbetween.js +2 -2
- package/build/components/block-popover/inbetween.js.map +1 -1
- package/build/components/block-popover/index.js +2 -2
- package/build/components/block-popover/index.js.map +1 -1
- package/build/components/block-settings-menu/block-mode-toggle.js +28 -34
- package/build/components/block-settings-menu/block-mode-toggle.js.map +1 -1
- package/build/components/block-tools/block-selection-button.js +1 -2
- package/build/components/block-tools/block-selection-button.js.map +1 -1
- package/build/components/block-tools/index.js +1 -1
- package/build/components/block-tools/index.js.map +1 -1
- package/build/components/block-tools/insertion-point.js +14 -3
- package/build/components/block-tools/insertion-point.js.map +1 -1
- package/build/components/block-tools/use-block-toolbar-popover-props.js +1 -1
- package/build/components/block-tools/use-block-toolbar-popover-props.js.map +1 -1
- package/build/components/block-tools/use-show-block-tools.js +2 -1
- package/build/components/block-tools/use-show-block-tools.js.map +1 -1
- package/build/components/block-tools/zoom-out-mode-inserters.js +22 -19
- package/build/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
- package/build/components/block-tools/zoom-out-toolbar.js +0 -1
- package/build/components/block-tools/zoom-out-toolbar.js.map +1 -1
- package/build/components/border-radius-control/index.js +1 -0
- package/build/components/border-radius-control/index.js.map +1 -1
- package/build/components/child-layout-control/index.js +3 -1
- package/build/components/child-layout-control/index.js.map +1 -1
- package/build/components/convert-to-group-buttons/index.js +1 -1
- package/build/components/convert-to-group-buttons/index.js.map +1 -1
- package/build/components/date-format-picker/index.js +2 -0
- package/build/components/date-format-picker/index.js.map +1 -1
- package/build/components/dimensions-tool/scale-tool.js +1 -0
- package/build/components/dimensions-tool/scale-tool.js.map +1 -1
- package/build/components/font-appearance-control/index.js +3 -0
- package/build/components/font-appearance-control/index.js.map +1 -1
- package/build/components/font-family/index.js +15 -0
- package/build/components/font-family/index.js.map +1 -1
- package/build/components/global-styles/background-panel.js +153 -77
- package/build/components/global-styles/background-panel.js.map +1 -1
- package/build/components/global-styles/get-global-styles-changes.js +3 -1
- package/build/components/global-styles/get-global-styles-changes.js.map +1 -1
- package/build/components/global-styles/hooks.js +0 -7
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/image-settings-panel.js +1 -0
- package/build/components/global-styles/image-settings-panel.js.map +1 -1
- package/build/components/global-styles/index.js +0 -6
- package/build/components/global-styles/index.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +0 -1
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +59 -40
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js +80 -0
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/grid/grid-item-movers.js +30 -26
- package/build/components/grid/grid-item-movers.js.map +1 -1
- package/build/components/grid/grid-item-resizer.js +14 -15
- package/build/components/grid/grid-item-resizer.js.map +1 -1
- package/build/components/grid/grid-visualizer.js +21 -6
- package/build/components/grid/grid-visualizer.js.map +1 -1
- package/build/components/grid/use-grid-layout-sync.js +56 -20
- package/build/components/grid/use-grid-layout-sync.js.map +1 -1
- package/build/components/height-control/index.js +1 -0
- package/build/components/height-control/index.js.map +1 -1
- package/build/components/iframe/index.js +2 -4
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/image-editor/zoom-dropdown.js +11 -7
- package/build/components/image-editor/zoom-dropdown.js.map +1 -1
- package/build/components/inner-blocks/button-block-appender.js +8 -8
- package/build/components/inner-blocks/button-block-appender.js.map +1 -1
- package/build/components/inner-blocks/default-block-appender.js +7 -25
- package/build/components/inner-blocks/default-block-appender.js.map +1 -1
- package/build/components/inner-blocks/index.js +9 -11
- package/build/components/inner-blocks/index.js.map +1 -1
- package/build/components/inserter/category-tabs/index.js +29 -2
- package/build/components/inserter/category-tabs/index.js.map +1 -1
- package/build/components/inserter/library.js +4 -2
- package/build/components/inserter/library.js.map +1 -1
- package/build/components/inserter/menu.js +32 -14
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/quick-inserter.js +4 -0
- package/build/components/inserter/quick-inserter.js.map +1 -1
- package/build/components/line-height-control/index.js +3 -15
- package/build/components/line-height-control/index.js.map +1 -1
- package/build/components/link-control/search-input.js +0 -1
- package/build/components/link-control/search-input.js.map +1 -1
- package/build/components/media-placeholder/index.js +9 -4
- package/build/components/media-placeholder/index.js.map +1 -1
- package/build/components/media-replace-flow/index.js +3 -1
- package/build/components/media-replace-flow/index.js.map +1 -1
- package/build/components/media-upload/index.native.js +4 -1
- package/build/components/media-upload/index.native.js.map +1 -1
- package/build/components/multi-selection-inspector/index.js +12 -12
- package/build/components/multi-selection-inspector/index.js.map +1 -1
- package/build/components/resolution-tool/index.js +1 -0
- package/build/components/resolution-tool/index.js.map +1 -1
- package/build/components/skip-to-selected-block/index.js +4 -2
- package/build/components/skip-to-selected-block/index.js.map +1 -1
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js +8 -8
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build/components/text-alignment-control/index.js +13 -8
- package/build/components/text-alignment-control/index.js.map +1 -1
- package/build/components/text-decoration-control/index.js +13 -8
- package/build/components/text-decoration-control/index.js.map +1 -1
- package/build/components/text-transform-control/index.js +13 -8
- package/build/components/text-transform-control/index.js.map +1 -1
- package/build/components/url-input/button.js +0 -1
- package/build/components/url-input/button.js.map +1 -1
- package/build/components/url-input/index.js +1 -11
- package/build/components/url-input/index.js.map +1 -1
- package/build/components/url-popover/image-url-input-ui.js +2 -0
- package/build/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build/components/url-popover/link-editor.js +0 -1
- package/build/components/url-popover/link-editor.js.map +1 -1
- package/build/components/use-block-drop-zone/index.js +42 -4
- package/build/components/use-block-drop-zone/index.js.map +1 -1
- package/build/components/use-on-block-drop/index.js +3 -6
- package/build/components/use-on-block-drop/index.js.map +1 -1
- package/build/components/use-resize-canvas/index.js +1 -3
- package/build/components/use-resize-canvas/index.js.map +1 -1
- package/build/components/use-settings/index.js +2 -1
- package/build/components/use-settings/index.js.map +1 -1
- package/build/components/writing-mode-control/index.js +13 -8
- package/build/components/writing-mode-control/index.js.map +1 -1
- package/build/hooks/background.js +19 -23
- package/build/hooks/background.js.map +1 -1
- package/build/hooks/block-bindings.js +209 -39
- package/build/hooks/block-bindings.js.map +1 -1
- package/build/hooks/block-hooks.js +1 -0
- package/build/hooks/block-hooks.js.map +1 -1
- package/build/hooks/block-style-variation.js +2 -2
- package/build/hooks/block-style-variation.js.map +1 -1
- package/build/hooks/contrast-checker.js +6 -6
- package/build/hooks/contrast-checker.js.map +1 -1
- package/build/hooks/duotone.js +3 -3
- package/build/hooks/duotone.js.map +1 -1
- package/build/hooks/index.js +7 -1
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/line-height.js +0 -1
- package/build/hooks/line-height.js.map +1 -1
- package/build/hooks/spacing-visualizer.js +1 -1
- package/build/hooks/spacing-visualizer.js.map +1 -1
- package/build/hooks/use-bindings-attributes.js +4 -0
- package/build/hooks/use-bindings-attributes.js.map +1 -1
- package/build/hooks/use-zoom-out.js +1 -1
- package/build/hooks/use-zoom-out.js.map +1 -1
- package/build/hooks/utils.js +20 -0
- package/build/hooks/utils.js.map +1 -1
- package/build/index.js +7 -0
- package/build/index.js.map +1 -1
- package/build/layouts/constrained.js +1 -0
- package/build/layouts/constrained.js.map +1 -1
- package/build/layouts/flex.js +2 -0
- package/build/layouts/flex.js.map +1 -1
- package/build/layouts/grid.js +3 -0
- package/build/layouts/grid.js.map +1 -1
- package/build/private-apis.js +3 -2
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +9 -1
- package/build/store/actions.js.map +1 -1
- package/build/store/private-selectors.js +30 -0
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +10 -1
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +4 -4
- package/build/store/selectors.js.map +1 -1
- package/build/utils/block-bindings.js +112 -0
- package/build/utils/block-bindings.js.map +1 -0
- package/build/utils/get-editor-region.js +1 -1
- package/build/utils/get-editor-region.js.map +1 -1
- package/build/utils/get-px-from-css-unit.js +1 -1
- package/build/utils/get-px-from-css-unit.js.map +1 -1
- package/build-module/autocompleters/block.js +1 -1
- package/build-module/autocompleters/block.js.map +1 -1
- package/build-module/components/block-breadcrumb/index.js +4 -2
- package/build-module/components/block-breadcrumb/index.js.map +1 -1
- package/build-module/components/block-draggable/index.js +3 -3
- package/build-module/components/block-draggable/index.js.map +1 -1
- package/build-module/components/block-list/use-block-props/index.js +2 -2
- package/build-module/components/block-list/use-block-props/index.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-block-refs.js +24 -34
- package/build-module/components/block-list/use-block-props/use-block-refs.js.map +1 -1
- package/build-module/components/block-list/use-in-between-inserter.js +11 -4
- package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build-module/components/block-mover/index.js +1 -2
- package/build-module/components/block-mover/index.js.map +1 -1
- package/build-module/components/block-popover/cover.js +1 -1
- package/build-module/components/block-popover/cover.js.map +1 -1
- package/build-module/components/block-popover/inbetween.js +1 -1
- package/build-module/components/block-popover/inbetween.js.map +1 -1
- package/build-module/components/block-popover/index.js +1 -1
- package/build-module/components/block-popover/index.js.map +1 -1
- package/build-module/components/block-settings-menu/block-mode-toggle.js +29 -34
- package/build-module/components/block-settings-menu/block-mode-toggle.js.map +1 -1
- package/build-module/components/block-tools/block-selection-button.js +1 -2
- package/build-module/components/block-tools/block-selection-button.js.map +1 -1
- package/build-module/components/block-tools/index.js +1 -1
- package/build-module/components/block-tools/index.js.map +1 -1
- package/build-module/components/block-tools/insertion-point.js +14 -3
- package/build-module/components/block-tools/insertion-point.js.map +1 -1
- package/build-module/components/block-tools/use-block-toolbar-popover-props.js +1 -1
- package/build-module/components/block-tools/use-block-toolbar-popover-props.js.map +1 -1
- package/build-module/components/block-tools/use-show-block-tools.js +2 -1
- 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 +23 -20
- package/build-module/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
- package/build-module/components/block-tools/zoom-out-toolbar.js +0 -1
- package/build-module/components/block-tools/zoom-out-toolbar.js.map +1 -1
- package/build-module/components/border-radius-control/index.js +1 -0
- package/build-module/components/border-radius-control/index.js.map +1 -1
- package/build-module/components/child-layout-control/index.js +3 -1
- package/build-module/components/child-layout-control/index.js.map +1 -1
- package/build-module/components/convert-to-group-buttons/index.js +1 -1
- package/build-module/components/convert-to-group-buttons/index.js.map +1 -1
- package/build-module/components/date-format-picker/index.js +2 -0
- package/build-module/components/date-format-picker/index.js.map +1 -1
- package/build-module/components/dimensions-tool/scale-tool.js +1 -0
- package/build-module/components/dimensions-tool/scale-tool.js.map +1 -1
- package/build-module/components/font-appearance-control/index.js +3 -0
- package/build-module/components/font-appearance-control/index.js.map +1 -1
- package/build-module/components/font-family/index.js +14 -0
- package/build-module/components/font-family/index.js.map +1 -1
- package/build-module/components/global-styles/background-panel.js +156 -80
- package/build-module/components/global-styles/background-panel.js.map +1 -1
- package/build-module/components/global-styles/get-global-styles-changes.js +3 -1
- package/build-module/components/global-styles/get-global-styles-changes.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +0 -6
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/image-settings-panel.js +1 -0
- package/build-module/components/global-styles/image-settings-panel.js.map +1 -1
- package/build-module/components/global-styles/index.js +1 -1
- package/build-module/components/global-styles/index.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +0 -1
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +61 -42
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js +77 -0
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/grid/grid-item-movers.js +30 -26
- package/build-module/components/grid/grid-item-movers.js.map +1 -1
- package/build-module/components/grid/grid-item-resizer.js +14 -15
- package/build-module/components/grid/grid-item-resizer.js.map +1 -1
- package/build-module/components/grid/grid-visualizer.js +21 -6
- package/build-module/components/grid/grid-visualizer.js.map +1 -1
- package/build-module/components/grid/use-grid-layout-sync.js +56 -20
- package/build-module/components/grid/use-grid-layout-sync.js.map +1 -1
- package/build-module/components/height-control/index.js +1 -0
- package/build-module/components/height-control/index.js.map +1 -1
- package/build-module/components/iframe/index.js +2 -4
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/image-editor/zoom-dropdown.js +12 -8
- package/build-module/components/image-editor/zoom-dropdown.js.map +1 -1
- package/build-module/components/inner-blocks/button-block-appender.js +7 -6
- package/build-module/components/inner-blocks/button-block-appender.js.map +1 -1
- package/build-module/components/inner-blocks/default-block-appender.js +6 -23
- package/build-module/components/inner-blocks/default-block-appender.js.map +1 -1
- package/build-module/components/inner-blocks/index.js +9 -11
- package/build-module/components/inner-blocks/index.js.map +1 -1
- package/build-module/components/inserter/category-tabs/index.js +30 -3
- package/build-module/components/inserter/category-tabs/index.js.map +1 -1
- package/build-module/components/inserter/library.js +4 -2
- package/build-module/components/inserter/library.js.map +1 -1
- package/build-module/components/inserter/menu.js +32 -14
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/quick-inserter.js +5 -1
- package/build-module/components/inserter/quick-inserter.js.map +1 -1
- package/build-module/components/line-height-control/index.js +3 -14
- package/build-module/components/line-height-control/index.js.map +1 -1
- package/build-module/components/link-control/search-input.js +0 -1
- package/build-module/components/link-control/search-input.js.map +1 -1
- package/build-module/components/media-placeholder/index.js +9 -4
- package/build-module/components/media-placeholder/index.js.map +1 -1
- package/build-module/components/media-replace-flow/index.js +3 -1
- package/build-module/components/media-replace-flow/index.js.map +1 -1
- package/build-module/components/media-upload/index.native.js +4 -1
- package/build-module/components/media-upload/index.native.js.map +1 -1
- package/build-module/components/multi-selection-inspector/index.js +12 -12
- package/build-module/components/multi-selection-inspector/index.js.map +1 -1
- package/build-module/components/resolution-tool/index.js +1 -0
- package/build-module/components/resolution-tool/index.js.map +1 -1
- package/build-module/components/skip-to-selected-block/index.js +5 -3
- package/build-module/components/skip-to-selected-block/index.js.map +1 -1
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js +8 -8
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build-module/components/text-alignment-control/index.js +13 -8
- package/build-module/components/text-alignment-control/index.js.map +1 -1
- package/build-module/components/text-decoration-control/index.js +13 -8
- package/build-module/components/text-decoration-control/index.js.map +1 -1
- package/build-module/components/text-transform-control/index.js +13 -8
- package/build-module/components/text-transform-control/index.js.map +1 -1
- package/build-module/components/url-input/button.js +0 -1
- package/build-module/components/url-input/button.js.map +1 -1
- package/build-module/components/url-input/index.js +1 -11
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/components/url-popover/image-url-input-ui.js +2 -0
- package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build-module/components/url-popover/link-editor.js +0 -1
- package/build-module/components/url-popover/link-editor.js.map +1 -1
- package/build-module/components/use-block-drop-zone/index.js +42 -4
- package/build-module/components/use-block-drop-zone/index.js.map +1 -1
- package/build-module/components/use-on-block-drop/index.js +3 -6
- package/build-module/components/use-on-block-drop/index.js.map +1 -1
- package/build-module/components/use-resize-canvas/index.js +1 -3
- package/build-module/components/use-resize-canvas/index.js.map +1 -1
- package/build-module/components/use-settings/index.js +2 -1
- package/build-module/components/use-settings/index.js.map +1 -1
- package/build-module/components/writing-mode-control/index.js +13 -8
- package/build-module/components/writing-mode-control/index.js.map +1 -1
- package/build-module/hooks/background.js +19 -23
- package/build-module/hooks/background.js.map +1 -1
- package/build-module/hooks/block-bindings.js +214 -43
- package/build-module/hooks/block-bindings.js.map +1 -1
- package/build-module/hooks/block-hooks.js +1 -0
- package/build-module/hooks/block-hooks.js.map +1 -1
- package/build-module/hooks/block-style-variation.js +3 -3
- package/build-module/hooks/block-style-variation.js.map +1 -1
- package/build-module/hooks/contrast-checker.js +7 -7
- package/build-module/hooks/contrast-checker.js.map +1 -1
- package/build-module/hooks/duotone.js +4 -4
- package/build-module/hooks/duotone.js.map +1 -1
- package/build-module/hooks/index.js +2 -1
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/line-height.js +0 -1
- package/build-module/hooks/line-height.js.map +1 -1
- package/build-module/hooks/spacing-visualizer.js +1 -1
- package/build-module/hooks/spacing-visualizer.js.map +1 -1
- package/build-module/hooks/use-bindings-attributes.js +3 -0
- package/build-module/hooks/use-bindings-attributes.js.map +1 -1
- package/build-module/hooks/use-zoom-out.js +1 -1
- package/build-module/hooks/use-zoom-out.js.map +1 -1
- package/build-module/hooks/utils.js +19 -0
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/index.js +1 -1
- package/build-module/index.js.map +1 -1
- package/build-module/layouts/constrained.js +1 -0
- package/build-module/layouts/constrained.js.map +1 -1
- package/build-module/layouts/flex.js +2 -0
- package/build-module/layouts/flex.js.map +1 -1
- package/build-module/layouts/grid.js +3 -0
- package/build-module/layouts/grid.js.map +1 -1
- package/build-module/private-apis.js +4 -3
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/actions.js +9 -1
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/private-selectors.js +27 -0
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +9 -1
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +4 -4
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/block-bindings.js +105 -0
- package/build-module/utils/block-bindings.js.map +1 -0
- package/build-module/utils/get-editor-region.js +1 -1
- package/build-module/utils/get-editor-region.js.map +1 -1
- package/build-module/utils/get-px-from-css-unit.js +1 -1
- package/build-module/utils/get-px-from-css-unit.js.map +1 -1
- package/build-style/content-rtl.css +12 -26
- package/build-style/content.css +12 -26
- package/build-style/default-editor-styles-rtl.css +5 -2
- package/build-style/default-editor-styles.css +5 -2
- package/build-style/style-rtl.css +123 -83
- package/build-style/style.css +123 -83
- package/package.json +32 -32
- package/src/autocompleters/block.js +2 -1
- package/src/autocompleters/style.scss +4 -0
- package/src/components/block-breadcrumb/index.js +4 -2
- package/src/components/block-canvas/style.scss +1 -0
- package/src/components/block-draggable/index.js +3 -3
- package/src/components/block-list/content.scss +5 -13
- package/src/components/block-list/use-block-props/index.js +2 -2
- package/src/components/block-list/use-block-props/use-block-refs.js +27 -43
- package/src/components/block-list/use-in-between-inserter.js +17 -5
- package/src/components/block-mover/index.js +5 -2
- package/src/components/block-popover/cover.js +1 -1
- package/src/components/block-popover/inbetween.js +1 -1
- package/src/components/block-popover/index.js +1 -1
- package/src/components/block-settings-menu/block-mode-toggle.js +28 -31
- package/src/components/block-settings-menu/test/block-mode-toggle.js +26 -23
- package/src/components/block-tools/block-selection-button.js +1 -2
- package/src/components/block-tools/index.js +5 -6
- package/src/components/block-tools/insertion-point.js +11 -0
- package/src/components/block-tools/style.scss +1 -1
- package/src/components/block-tools/use-block-toolbar-popover-props.js +1 -1
- package/src/components/block-tools/use-show-block-tools.js +4 -1
- package/src/components/block-tools/zoom-out-mode-inserters.js +21 -19
- package/src/components/block-tools/zoom-out-toolbar.js +0 -1
- package/src/components/block-variation-transforms/style.scss +1 -1
- package/src/components/border-radius-control/index.js +1 -0
- package/src/components/border-radius-control/style.scss +0 -10
- package/src/components/button-block-appender/content.scss +1 -1
- package/src/components/child-layout-control/index.js +2 -0
- package/src/components/color-palette/test/__snapshots__/control.js.snap +2 -2
- package/src/components/colors-gradients/test/control.js +3 -2
- package/src/components/convert-to-group-buttons/index.js +1 -1
- package/src/components/date-format-picker/index.js +2 -0
- package/src/components/dimensions-tool/scale-tool.js +1 -0
- package/src/components/font-appearance-control/index.js +3 -0
- package/src/components/font-family/README.md +17 -0
- package/src/components/font-family/index.js +19 -0
- package/src/components/font-family/stories/index.story.js +54 -0
- package/src/components/global-styles/background-panel.js +180 -93
- package/src/components/global-styles/get-global-styles-changes.js +4 -1
- package/src/components/global-styles/hooks.js +0 -5
- package/src/components/global-styles/image-settings-panel.js +1 -0
- package/src/components/global-styles/index.js +0 -1
- package/src/components/global-styles/style.scss +13 -12
- package/src/components/global-styles/test/use-global-styles-output.js +68 -7
- package/src/components/global-styles/test/utils.js +120 -0
- package/src/components/global-styles/typography-panel.js +0 -1
- package/src/components/global-styles/use-global-styles-output.js +71 -53
- package/src/components/global-styles/utils.js +90 -0
- package/src/components/grid/grid-item-movers.js +46 -44
- package/src/components/grid/grid-item-resizer.js +11 -17
- package/src/components/grid/grid-visualizer.js +23 -8
- package/src/components/grid/style.scss +60 -10
- package/src/components/grid/use-grid-layout-sync.js +68 -14
- package/src/components/height-control/index.js +1 -0
- package/src/components/iframe/content.scss +2 -2
- package/src/components/iframe/index.js +1 -3
- package/src/components/image-editor/zoom-dropdown.js +17 -9
- package/src/components/inner-blocks/button-block-appender.js +5 -7
- package/src/components/inner-blocks/default-block-appender.js +4 -23
- package/src/components/inner-blocks/index.js +10 -9
- package/src/components/inserter/category-tabs/index.js +35 -2
- package/src/components/inserter/library.js +2 -0
- package/src/components/inserter/menu.js +34 -29
- package/src/components/inserter/quick-inserter.js +4 -1
- package/src/components/inserter/style.scss +17 -12
- package/src/components/inserter-list-item/style.scss +1 -0
- package/src/components/inspector-controls/README.md +5 -0
- package/src/components/line-height-control/README.md +4 -5
- package/src/components/line-height-control/index.js +4 -21
- package/src/components/line-height-control/stories/index.story.js +0 -1
- package/src/components/line-height-control/test/index.js +1 -7
- package/src/components/link-control/search-input.js +0 -1
- package/src/components/link-control/style.scss +1 -1
- package/src/components/media-placeholder/index.js +12 -7
- package/src/components/media-replace-flow/README.md +7 -0
- package/src/components/media-replace-flow/index.js +3 -1
- package/src/components/media-upload/README.md +2 -0
- package/src/components/media-upload/index.native.js +2 -0
- package/src/components/multi-selection-inspector/index.js +8 -9
- package/src/components/resolution-tool/index.js +1 -0
- package/src/components/responsive-block-control/README.md +1 -0
- package/src/components/responsive-block-control/test/index.js +6 -1
- package/src/components/skip-to-selected-block/index.js +5 -3
- package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +11 -10
- package/src/components/spacing-sizes-control/style.scss +16 -16
- package/src/components/tabbed-sidebar/style.scss +1 -19
- package/src/components/text-alignment-control/index.js +20 -8
- package/src/components/text-decoration-control/index.js +20 -8
- package/src/components/text-decoration-control/stories/index.story.js +0 -4
- package/src/components/text-transform-control/index.js +20 -8
- package/src/components/text-transform-control/stories/index.story.js +0 -4
- package/src/components/url-input/README.md +0 -5
- package/src/components/url-input/button.js +0 -1
- package/src/components/url-input/index.js +1 -15
- package/src/components/url-input/style.scss +2 -2
- package/src/components/url-popover/image-url-input-ui.js +2 -0
- package/src/components/url-popover/link-editor.js +0 -1
- package/src/components/use-block-drop-zone/index.js +86 -16
- package/src/components/use-on-block-drop/index.js +1 -9
- package/src/components/use-resize-canvas/index.js +1 -3
- package/src/components/use-settings/index.js +2 -1
- package/src/components/writing-mode-control/index.js +20 -8
- package/src/hooks/background.js +21 -27
- package/src/hooks/block-bindings.js +248 -54
- package/src/hooks/block-bindings.scss +13 -2
- package/src/hooks/block-hooks.js +1 -0
- package/src/hooks/block-hooks.scss +1 -0
- package/src/hooks/block-style-variation.js +3 -3
- package/src/hooks/contrast-checker.js +7 -7
- package/src/hooks/duotone.js +4 -4
- package/src/hooks/index.js +2 -1
- package/src/hooks/line-height.js +0 -1
- package/src/hooks/spacing-visualizer.js +1 -1
- package/src/hooks/test/background.js +60 -0
- package/src/hooks/use-bindings-attributes.js +4 -0
- package/src/hooks/use-editor-wrapper-styles.native.scss +1 -0
- package/src/hooks/use-zoom-out.js +1 -1
- package/src/hooks/utils.js +14 -1
- package/src/index.js +1 -0
- package/src/layouts/constrained.js +1 -0
- package/src/layouts/flex.js +2 -0
- package/src/layouts/grid.js +3 -0
- package/src/private-apis.js +3 -2
- package/src/store/actions.js +13 -5
- package/src/store/private-selectors.js +36 -0
- package/src/store/reducer.js +7 -0
- package/src/store/selectors.js +4 -4
- package/src/store/test/private-selectors.js +89 -0
- package/src/style.scss +1 -2
- package/src/utils/block-bindings.js +98 -0
- package/src/utils/get-editor-region.js +1 -1
- package/src/utils/get-px-from-css-unit.js +1 -1
- package/src/utils/test/transform-styles.js +49 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/build/components/global-styles/theme-file-uri-utils.js +0 -80
- package/build/components/global-styles/theme-file-uri-utils.js.map +0 -1
- package/build/components/inner-blocks/with-client-id.js +0 -28
- package/build/components/inner-blocks/with-client-id.js.map +0 -1
- package/build/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +0 -30
- package/build/components/inserter/block-patterns-tab/pattern-category-preview-panel.js.map +0 -1
- package/build/components/segmented-text-control/index.js +0 -63
- package/build/components/segmented-text-control/index.js.map +0 -1
- package/build-module/components/global-styles/theme-file-uri-utils.js +0 -73
- package/build-module/components/global-styles/theme-file-uri-utils.js.map +0 -1
- package/build-module/components/inner-blocks/with-client-id.js +0 -21
- package/build-module/components/inner-blocks/with-client-id.js.map +0 -1
- package/build-module/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +0 -23
- package/build-module/components/inserter/block-patterns-tab/pattern-category-preview-panel.js.map +0 -1
- package/build-module/components/segmented-text-control/index.js +0 -58
- package/build-module/components/segmented-text-control/index.js.map +0 -1
- package/src/components/global-styles/test/theme-file-uri-utils.js +0 -66
- package/src/components/global-styles/theme-file-uri-utils.js +0 -77
- package/src/components/inner-blocks/with-client-id.js +0 -19
- package/src/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +0 -25
- package/src/components/segmented-text-control/index.js +0 -63
- package/src/components/segmented-text-control/style.scss +0 -15
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
5
|
-
useContext,
|
|
6
|
-
useMemo,
|
|
7
|
-
useRef,
|
|
8
|
-
useState,
|
|
9
|
-
useLayoutEffect,
|
|
10
|
-
} from '@wordpress/element';
|
|
4
|
+
import { useContext, useState, useLayoutEffect } from '@wordpress/element';
|
|
11
5
|
import { useRefEffect } from '@wordpress/compose';
|
|
12
6
|
|
|
13
7
|
/**
|
|
@@ -16,7 +10,7 @@ import { useRefEffect } from '@wordpress/compose';
|
|
|
16
10
|
import { BlockRefs } from '../../provider/block-refs-provider';
|
|
17
11
|
|
|
18
12
|
/** @typedef {import('@wordpress/element').RefCallback} RefCallback */
|
|
19
|
-
/** @typedef {import('@wordpress/element').
|
|
13
|
+
/** @typedef {import('@wordpress/element').Ref} Ref */
|
|
20
14
|
|
|
21
15
|
/**
|
|
22
16
|
* Provides a ref to the BlockRefs context.
|
|
@@ -36,31 +30,33 @@ export function useBlockRefProvider( clientId ) {
|
|
|
36
30
|
);
|
|
37
31
|
}
|
|
38
32
|
|
|
33
|
+
function assignRef( ref, value ) {
|
|
34
|
+
if ( typeof ref === 'function' ) {
|
|
35
|
+
ref( value );
|
|
36
|
+
} else if ( ref ) {
|
|
37
|
+
ref.current = value;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
39
41
|
/**
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
* reactive, i.e., it won't trigger a rerender of the calling component if the
|
|
43
|
-
* ref value changes. For reactive use cases there is the `useBlockElement` hook.
|
|
44
|
-
*
|
|
45
|
-
* @param {string} clientId The client ID to get a ref for.
|
|
42
|
+
* Tracks the DOM element for the block identified by `clientId` and assigns it to the `ref`
|
|
43
|
+
* whenever it changes.
|
|
46
44
|
*
|
|
47
|
-
* @
|
|
45
|
+
* @param {string} clientId The client ID to track.
|
|
46
|
+
* @param {Ref} ref The ref object/callback to assign to.
|
|
48
47
|
*/
|
|
49
|
-
function
|
|
48
|
+
export function useBlockElementRef( clientId, ref ) {
|
|
50
49
|
const { refsMap } = useContext( BlockRefs );
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
} ),
|
|
62
|
-
[ refsMap ]
|
|
63
|
-
);
|
|
50
|
+
useLayoutEffect( () => {
|
|
51
|
+
assignRef( ref, refsMap.get( clientId ) );
|
|
52
|
+
const unsubscribe = refsMap.subscribe( clientId, () =>
|
|
53
|
+
assignRef( ref, refsMap.get( clientId ) )
|
|
54
|
+
);
|
|
55
|
+
return () => {
|
|
56
|
+
unsubscribe();
|
|
57
|
+
assignRef( ref, null );
|
|
58
|
+
};
|
|
59
|
+
}, [ refsMap, clientId, ref ] );
|
|
64
60
|
}
|
|
65
61
|
|
|
66
62
|
/**
|
|
@@ -71,20 +67,8 @@ function useBlockRef( clientId ) {
|
|
|
71
67
|
*
|
|
72
68
|
* @return {Element|null} The block's wrapper element.
|
|
73
69
|
*/
|
|
74
|
-
function useBlockElement( clientId ) {
|
|
75
|
-
const { refsMap } = useContext( BlockRefs );
|
|
70
|
+
export function useBlockElement( clientId ) {
|
|
76
71
|
const [ blockElement, setBlockElement ] = useState( null );
|
|
77
|
-
|
|
78
|
-
// changes (i.e., the block is unmounted and re-mounted), this allows enough time
|
|
79
|
-
// for the ref callbacks to clean up the old element and set the new one.
|
|
80
|
-
useLayoutEffect( () => {
|
|
81
|
-
setBlockElement( refsMap.get( clientId ) );
|
|
82
|
-
return refsMap.subscribe( clientId, () =>
|
|
83
|
-
setBlockElement( refsMap.get( clientId ) )
|
|
84
|
-
);
|
|
85
|
-
}, [ refsMap, clientId ] );
|
|
72
|
+
useBlockElementRef( clientId, setBlockElement );
|
|
86
73
|
return blockElement;
|
|
87
74
|
}
|
|
88
|
-
|
|
89
|
-
export { useBlockRef as __unstableUseBlockRef };
|
|
90
|
-
export { useBlockElement as __unstableUseBlockElement };
|
|
@@ -25,6 +25,7 @@ export function useInBetweenInserter() {
|
|
|
25
25
|
getBlockIndex,
|
|
26
26
|
isMultiSelecting,
|
|
27
27
|
getSelectedBlockClientIds,
|
|
28
|
+
getSettings,
|
|
28
29
|
getTemplateLock,
|
|
29
30
|
__unstableIsWithinBlockOverlay,
|
|
30
31
|
getBlockEditingMode,
|
|
@@ -88,9 +89,11 @@ export function useInBetweenInserter() {
|
|
|
88
89
|
return;
|
|
89
90
|
}
|
|
90
91
|
|
|
92
|
+
const blockListSettings = getBlockListSettings( rootClientId );
|
|
91
93
|
const orientation =
|
|
92
|
-
|
|
93
|
-
|
|
94
|
+
blockListSettings?.orientation || 'vertical';
|
|
95
|
+
const captureToolbars =
|
|
96
|
+
!! blockListSettings?.__experimentalCaptureToolbars;
|
|
94
97
|
const offsetTop = event.clientY;
|
|
95
98
|
const offsetLeft = event.clientX;
|
|
96
99
|
|
|
@@ -135,9 +138,18 @@ export function useInBetweenInserter() {
|
|
|
135
138
|
return;
|
|
136
139
|
}
|
|
137
140
|
|
|
138
|
-
// Don't show the inserter
|
|
139
|
-
//
|
|
140
|
-
|
|
141
|
+
// Don't show the inserter if the following conditions are met,
|
|
142
|
+
// as it conflicts with the block toolbar:
|
|
143
|
+
// 1. when hovering above or inside selected block(s)
|
|
144
|
+
// 2. when the orientation is vertical
|
|
145
|
+
// 3. when the __experimentalCaptureToolbars is not enabled
|
|
146
|
+
// 4. when the Top Toolbar is not disabled
|
|
147
|
+
if (
|
|
148
|
+
getSelectedBlockClientIds().includes( clientId ) &&
|
|
149
|
+
orientation === 'vertical' &&
|
|
150
|
+
! captureToolbars &&
|
|
151
|
+
! getSettings().hasFixedToolbar
|
|
152
|
+
) {
|
|
141
153
|
return;
|
|
142
154
|
}
|
|
143
155
|
const elementRect = element.getBoundingClientRect();
|
|
@@ -69,7 +69,11 @@ function BlockMover( {
|
|
|
69
69
|
[ clientIds ]
|
|
70
70
|
);
|
|
71
71
|
|
|
72
|
-
if (
|
|
72
|
+
if (
|
|
73
|
+
! canMove ||
|
|
74
|
+
( isFirst && isLast && ! rootClientId ) ||
|
|
75
|
+
( hideDragHandle && isManualGrid )
|
|
76
|
+
) {
|
|
73
77
|
return null;
|
|
74
78
|
}
|
|
75
79
|
|
|
@@ -85,7 +89,6 @@ function BlockMover( {
|
|
|
85
89
|
<Button
|
|
86
90
|
icon={ dragHandle }
|
|
87
91
|
className="block-editor-block-mover__drag-handle"
|
|
88
|
-
aria-hidden="true"
|
|
89
92
|
label={ __( 'Drag' ) }
|
|
90
93
|
// Should not be able to tab to drag handle as this
|
|
91
94
|
// button can only be used with a pointer device.
|
|
@@ -6,7 +6,7 @@ import { useEffect, useState, useMemo, forwardRef } from '@wordpress/element';
|
|
|
6
6
|
/**
|
|
7
7
|
* Internal dependencies
|
|
8
8
|
*/
|
|
9
|
-
import {
|
|
9
|
+
import { useBlockElement } from '../block-list/use-block-props/use-block-refs';
|
|
10
10
|
import { PrivateBlockPopover } from '.';
|
|
11
11
|
|
|
12
12
|
function BlockPopoverCover(
|
|
@@ -20,7 +20,7 @@ import { isRTL } from '@wordpress/i18n';
|
|
|
20
20
|
* Internal dependencies
|
|
21
21
|
*/
|
|
22
22
|
import { store as blockEditorStore } from '../../store';
|
|
23
|
-
import {
|
|
23
|
+
import { useBlockElement } from '../block-list/use-block-props/use-block-refs';
|
|
24
24
|
import usePopoverScroll from './use-popover-scroll';
|
|
25
25
|
|
|
26
26
|
const MAX_POPOVER_RECOMPUTE_COUNTER = Number.MAX_SAFE_INTEGER;
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
/**
|
|
19
19
|
* Internal dependencies
|
|
20
20
|
*/
|
|
21
|
-
import {
|
|
21
|
+
import { useBlockElement } from '../block-list/use-block-props/use-block-refs';
|
|
22
22
|
import usePopoverScroll from './use-popover-scroll';
|
|
23
23
|
|
|
24
24
|
const MAX_POPOVER_RECOMPUTE_COUNTER = Number.MAX_SAFE_INTEGER;
|
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
5
|
import { MenuItem } from '@wordpress/components';
|
|
6
6
|
import { getBlockType, hasBlockSupport } from '@wordpress/blocks';
|
|
7
|
-
import {
|
|
8
|
-
import { compose } from '@wordpress/compose';
|
|
7
|
+
import { useDispatch, useSelect } from '@wordpress/data';
|
|
9
8
|
|
|
10
9
|
/**
|
|
11
10
|
* Internal dependencies
|
|
@@ -14,13 +13,23 @@ import { store as blockEditorStore } from '../../store';
|
|
|
14
13
|
|
|
15
14
|
const noop = () => {};
|
|
16
15
|
|
|
17
|
-
export function BlockModeToggle( {
|
|
18
|
-
blockType,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
16
|
+
export default function BlockModeToggle( { clientId, onToggle = noop } ) {
|
|
17
|
+
const { blockType, mode, isCodeEditingEnabled } = useSelect(
|
|
18
|
+
( select ) => {
|
|
19
|
+
const { getBlock, getBlockMode, getSettings } =
|
|
20
|
+
select( blockEditorStore );
|
|
21
|
+
const block = getBlock( clientId );
|
|
22
|
+
|
|
23
|
+
return {
|
|
24
|
+
mode: getBlockMode( clientId ),
|
|
25
|
+
blockType: block ? getBlockType( block.name ) : null,
|
|
26
|
+
isCodeEditingEnabled: getSettings().codeEditingEnabled,
|
|
27
|
+
};
|
|
28
|
+
},
|
|
29
|
+
[ clientId ]
|
|
30
|
+
);
|
|
31
|
+
const { toggleBlockMode } = useDispatch( blockEditorStore );
|
|
32
|
+
|
|
24
33
|
if (
|
|
25
34
|
! blockType ||
|
|
26
35
|
! hasBlockSupport( blockType, 'html', true ) ||
|
|
@@ -32,26 +41,14 @@ export function BlockModeToggle( {
|
|
|
32
41
|
const label =
|
|
33
42
|
mode === 'visual' ? __( 'Edit as HTML' ) : __( 'Edit visually' );
|
|
34
43
|
|
|
35
|
-
return
|
|
44
|
+
return (
|
|
45
|
+
<MenuItem
|
|
46
|
+
onClick={ () => {
|
|
47
|
+
toggleBlockMode( clientId );
|
|
48
|
+
onToggle();
|
|
49
|
+
} }
|
|
50
|
+
>
|
|
51
|
+
{ label }
|
|
52
|
+
</MenuItem>
|
|
53
|
+
);
|
|
36
54
|
}
|
|
37
|
-
|
|
38
|
-
export default compose( [
|
|
39
|
-
withSelect( ( select, { clientId } ) => {
|
|
40
|
-
const { getBlock, getBlockMode, getSettings } =
|
|
41
|
-
select( blockEditorStore );
|
|
42
|
-
const block = getBlock( clientId );
|
|
43
|
-
const isCodeEditingEnabled = getSettings().codeEditingEnabled;
|
|
44
|
-
|
|
45
|
-
return {
|
|
46
|
-
mode: getBlockMode( clientId ),
|
|
47
|
-
blockType: block ? getBlockType( block.name ) : null,
|
|
48
|
-
isCodeEditingEnabled,
|
|
49
|
-
};
|
|
50
|
-
} ),
|
|
51
|
-
withDispatch( ( dispatch, { onToggle = noop, clientId } ) => ( {
|
|
52
|
-
onToggleMode() {
|
|
53
|
-
dispatch( blockEditorStore ).toggleBlockMode( clientId );
|
|
54
|
-
onToggle();
|
|
55
|
-
},
|
|
56
|
-
} ) ),
|
|
57
|
-
] )( BlockModeToggle );
|
|
@@ -3,16 +3,32 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { render, screen } from '@testing-library/react';
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* WordPress dependencies
|
|
8
|
+
*/
|
|
9
|
+
import { useSelect } from '@wordpress/data';
|
|
10
|
+
|
|
6
11
|
/**
|
|
7
12
|
* Internal dependencies
|
|
8
13
|
*/
|
|
9
|
-
import
|
|
14
|
+
import BlockModeToggle from '../block-mode-toggle';
|
|
15
|
+
|
|
16
|
+
jest.mock( '@wordpress/data/src/components/use-select', () => jest.fn() );
|
|
17
|
+
|
|
18
|
+
function setupUseSelectMock( mode, blockType, codeEditingEnabled = true ) {
|
|
19
|
+
useSelect.mockImplementation( () => {
|
|
20
|
+
return {
|
|
21
|
+
mode,
|
|
22
|
+
blockType,
|
|
23
|
+
isCodeEditingEnabled: codeEditingEnabled,
|
|
24
|
+
};
|
|
25
|
+
} );
|
|
26
|
+
}
|
|
10
27
|
|
|
11
28
|
describe( 'BlockModeToggle', () => {
|
|
12
29
|
it( "should not render the HTML mode button if the block doesn't support it", () => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
);
|
|
30
|
+
setupUseSelectMock( undefined, { supports: { html: false } } );
|
|
31
|
+
render( <BlockModeToggle /> );
|
|
16
32
|
|
|
17
33
|
expect(
|
|
18
34
|
screen.queryByRole( 'menuitem', { name: 'Edit as HTML' } )
|
|
@@ -20,12 +36,8 @@ describe( 'BlockModeToggle', () => {
|
|
|
20
36
|
} );
|
|
21
37
|
|
|
22
38
|
it( 'should render the HTML mode button', () => {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
blockType={ { supports: { html: true } } }
|
|
26
|
-
mode="visual"
|
|
27
|
-
/>
|
|
28
|
-
);
|
|
39
|
+
setupUseSelectMock( 'visual', { supports: { html: true } } );
|
|
40
|
+
render( <BlockModeToggle /> );
|
|
29
41
|
|
|
30
42
|
expect(
|
|
31
43
|
screen.getByRole( 'menuitem', { name: 'Edit as HTML' } )
|
|
@@ -33,12 +45,8 @@ describe( 'BlockModeToggle', () => {
|
|
|
33
45
|
} );
|
|
34
46
|
|
|
35
47
|
it( 'should render the Visual mode button', () => {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
blockType={ { supports: { html: true } } }
|
|
39
|
-
mode="html"
|
|
40
|
-
/>
|
|
41
|
-
);
|
|
48
|
+
setupUseSelectMock( 'html', { supports: { html: true } } );
|
|
49
|
+
render( <BlockModeToggle /> );
|
|
42
50
|
|
|
43
51
|
expect(
|
|
44
52
|
screen.getByRole( 'menuitem', { name: 'Edit visually' } )
|
|
@@ -46,13 +54,8 @@ describe( 'BlockModeToggle', () => {
|
|
|
46
54
|
} );
|
|
47
55
|
|
|
48
56
|
it( 'should not render the Visual mode button if code editing is disabled', () => {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
blockType={ { supports: { html: true } } }
|
|
52
|
-
mode="html"
|
|
53
|
-
isCodeEditingEnabled={ false }
|
|
54
|
-
/>
|
|
55
|
-
);
|
|
57
|
+
setupUseSelectMock( 'html', { supports: { html: true } }, false );
|
|
58
|
+
render( <BlockModeToggle /> );
|
|
56
59
|
|
|
57
60
|
expect(
|
|
58
61
|
screen.queryByRole( 'menuitem', { name: 'Edit visually' } )
|
|
@@ -37,7 +37,7 @@ import BlockTitle from '../block-title';
|
|
|
37
37
|
import BlockIcon from '../block-icon';
|
|
38
38
|
import { store as blockEditorStore } from '../../store';
|
|
39
39
|
import BlockDraggable from '../block-draggable';
|
|
40
|
-
import {
|
|
40
|
+
import { useBlockElement } from '../block-list/use-block-props/use-block-refs';
|
|
41
41
|
|
|
42
42
|
/**
|
|
43
43
|
* Block selection button component, displaying the label of the block. If the block
|
|
@@ -259,7 +259,6 @@ function BlockSelectionButton( { clientId, rootClientId }, ref ) {
|
|
|
259
259
|
<Button
|
|
260
260
|
icon={ dragHandle }
|
|
261
261
|
className="block-selection-button_drag-handle"
|
|
262
|
-
aria-hidden="true"
|
|
263
262
|
label={ dragHandleLabel }
|
|
264
263
|
// Should not be able to tab to drag handle as this
|
|
265
264
|
// button can only be used with a pointer device.
|
|
@@ -251,12 +251,11 @@ export default function BlockTools( {
|
|
|
251
251
|
name="__unstable-block-tools-after"
|
|
252
252
|
ref={ blockToolbarAfterRef }
|
|
253
253
|
/>
|
|
254
|
-
{
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
) }
|
|
254
|
+
{ isZoomOutMode && (
|
|
255
|
+
<ZoomOutModeInserters
|
|
256
|
+
__unstableContentRef={ __unstableContentRef }
|
|
257
|
+
/>
|
|
258
|
+
) }
|
|
260
259
|
</InsertionPointOpenRef.Provider>
|
|
261
260
|
</div>
|
|
262
261
|
);
|
|
@@ -38,6 +38,7 @@ function InbetweenInsertionPointPopover( {
|
|
|
38
38
|
isInserterShown,
|
|
39
39
|
isDistractionFree,
|
|
40
40
|
isNavigationMode,
|
|
41
|
+
isZoomOutMode,
|
|
41
42
|
} = useSelect( ( select ) => {
|
|
42
43
|
const {
|
|
43
44
|
getBlockOrder,
|
|
@@ -48,6 +49,7 @@ function InbetweenInsertionPointPopover( {
|
|
|
48
49
|
getNextBlockClientId,
|
|
49
50
|
getSettings,
|
|
50
51
|
isNavigationMode: _isNavigationMode,
|
|
52
|
+
__unstableGetEditorMode,
|
|
51
53
|
} = select( blockEditorStore );
|
|
52
54
|
const insertionPoint = getBlockInsertionPoint();
|
|
53
55
|
const order = getBlockOrder( insertionPoint.rootClientId );
|
|
@@ -79,6 +81,7 @@ function InbetweenInsertionPointPopover( {
|
|
|
79
81
|
isNavigationMode: _isNavigationMode(),
|
|
80
82
|
isDistractionFree: settings.isDistractionFree,
|
|
81
83
|
isInserterShown: insertionPoint?.__unstableWithInserter,
|
|
84
|
+
isZoomOutMode: __unstableGetEditorMode() === 'zoom-out',
|
|
82
85
|
};
|
|
83
86
|
}, [] );
|
|
84
87
|
const { getBlockEditingMode } = useSelect( blockEditorStore );
|
|
@@ -145,6 +148,14 @@ function InbetweenInsertionPointPopover( {
|
|
|
145
148
|
return null;
|
|
146
149
|
}
|
|
147
150
|
|
|
151
|
+
// Zoom out mode should only show the insertion point for the insert operation.
|
|
152
|
+
// Other operations such as "group" are when the editor tries to create a row
|
|
153
|
+
// block by grouping the block being dragged with the block it's being dropped
|
|
154
|
+
// onto.
|
|
155
|
+
if ( isZoomOutMode && operation !== 'insert' ) {
|
|
156
|
+
return null;
|
|
157
|
+
}
|
|
158
|
+
|
|
148
159
|
const orientationClassname =
|
|
149
160
|
orientation === 'horizontal' || operation === 'group'
|
|
150
161
|
? 'is-horizontal'
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
* Internal dependencies
|
|
16
16
|
*/
|
|
17
17
|
import { store as blockEditorStore } from '../../store';
|
|
18
|
-
import {
|
|
18
|
+
import { useBlockElement } from '../block-list/use-block-props/use-block-refs';
|
|
19
19
|
import { hasStickyOrFixedPositionValue } from '../../hooks/position';
|
|
20
20
|
|
|
21
21
|
const COMMON_PROPS = {
|
|
@@ -20,6 +20,7 @@ export function useShowBlockTools() {
|
|
|
20
20
|
getSelectedBlockClientId,
|
|
21
21
|
getFirstMultiSelectedBlockClientId,
|
|
22
22
|
getBlock,
|
|
23
|
+
getBlockMode,
|
|
23
24
|
getSettings,
|
|
24
25
|
hasMultiSelection,
|
|
25
26
|
__unstableGetEditorMode,
|
|
@@ -33,7 +34,9 @@ export function useShowBlockTools() {
|
|
|
33
34
|
const editorMode = __unstableGetEditorMode();
|
|
34
35
|
const hasSelectedBlock = !! clientId && !! block;
|
|
35
36
|
const isEmptyDefaultBlock =
|
|
36
|
-
hasSelectedBlock &&
|
|
37
|
+
hasSelectedBlock &&
|
|
38
|
+
isUnmodifiedDefaultBlock( block ) &&
|
|
39
|
+
getBlockMode( clientId ) !== 'html';
|
|
37
40
|
const _showEmptyBlockSideInserter =
|
|
38
41
|
clientId &&
|
|
39
42
|
! isTyping() &&
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { useSelect } from '@wordpress/data';
|
|
4
|
+
import { useSelect, useDispatch } from '@wordpress/data';
|
|
5
5
|
import { useEffect, useState } from '@wordpress/element';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -16,40 +16,44 @@ function ZoomOutModeInserters() {
|
|
|
16
16
|
const [ isReady, setIsReady ] = useState( false );
|
|
17
17
|
const {
|
|
18
18
|
hasSelection,
|
|
19
|
+
blockInsertionPoint,
|
|
19
20
|
blockOrder,
|
|
20
|
-
|
|
21
|
+
blockInsertionPointVisible,
|
|
21
22
|
setInserterIsOpened,
|
|
22
23
|
sectionRootClientId,
|
|
23
24
|
selectedBlockClientId,
|
|
24
25
|
hoveredBlockClientId,
|
|
26
|
+
inserterSearchInputRef,
|
|
25
27
|
} = useSelect( ( select ) => {
|
|
26
28
|
const {
|
|
27
29
|
getSettings,
|
|
30
|
+
getBlockInsertionPoint,
|
|
28
31
|
getBlockOrder,
|
|
29
32
|
getSelectionStart,
|
|
30
33
|
getSelectedBlockClientId,
|
|
31
34
|
getHoveredBlockClientId,
|
|
32
|
-
|
|
35
|
+
isBlockInsertionPointVisible,
|
|
36
|
+
getInserterSearchInputRef,
|
|
37
|
+
} = unlock( select( blockEditorStore ) );
|
|
38
|
+
|
|
33
39
|
const { sectionRootClientId: root } = unlock( getSettings() );
|
|
34
|
-
|
|
35
|
-
// Or we perhaps we should move the insertion point state to the
|
|
36
|
-
// block-editor store. I'm not sure what it was ever moved to the editor
|
|
37
|
-
// store, because all the inserter components all live in the
|
|
38
|
-
// block-editor package.
|
|
39
|
-
// eslint-disable-next-line @wordpress/data-no-store-string-literals
|
|
40
|
-
const editor = select( 'core/editor' );
|
|
40
|
+
|
|
41
41
|
return {
|
|
42
42
|
hasSelection: !! getSelectionStart().clientId,
|
|
43
|
+
blockInsertionPoint: getBlockInsertionPoint(),
|
|
43
44
|
blockOrder: getBlockOrder( root ),
|
|
44
|
-
|
|
45
|
+
blockInsertionPointVisible: isBlockInsertionPointVisible(),
|
|
45
46
|
sectionRootClientId: root,
|
|
46
47
|
setInserterIsOpened:
|
|
47
48
|
getSettings().__experimentalSetIsInserterOpened,
|
|
48
49
|
selectedBlockClientId: getSelectedBlockClientId(),
|
|
49
50
|
hoveredBlockClientId: getHoveredBlockClientId(),
|
|
51
|
+
inserterSearchInputRef: getInserterSearchInputRef(),
|
|
50
52
|
};
|
|
51
53
|
}, [] );
|
|
52
54
|
|
|
55
|
+
const { showInsertionPoint } = useDispatch( blockEditorStore );
|
|
56
|
+
|
|
53
57
|
// Defer the initial rendering to avoid the jumps due to the animation.
|
|
54
58
|
useEffect( () => {
|
|
55
59
|
const timeout = setTimeout( () => {
|
|
@@ -65,14 +69,8 @@ function ZoomOutModeInserters() {
|
|
|
65
69
|
}
|
|
66
70
|
|
|
67
71
|
return [ undefined, ...blockOrder ].map( ( clientId, index ) => {
|
|
68
|
-
const shouldRenderInserter = insertionPoint.insertionIndex !== index;
|
|
69
|
-
|
|
70
72
|
const shouldRenderInsertionPoint =
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
if ( ! shouldRenderInserter && ! shouldRenderInsertionPoint ) {
|
|
74
|
-
return null;
|
|
75
|
-
}
|
|
73
|
+
blockInsertionPointVisible && blockInsertionPoint.index === index;
|
|
76
74
|
|
|
77
75
|
const previousClientId = clientId;
|
|
78
76
|
const nextClientId = blockOrder[ index ];
|
|
@@ -104,7 +102,7 @@ function ZoomOutModeInserters() {
|
|
|
104
102
|
className="block-editor-block-list__insertion-point-indicator"
|
|
105
103
|
/>
|
|
106
104
|
) }
|
|
107
|
-
{
|
|
105
|
+
{ ! shouldRenderInsertionPoint && (
|
|
108
106
|
<ZoomOutModeInserterButton
|
|
109
107
|
isVisible={ isSelected || isHovered }
|
|
110
108
|
onClick={ () => {
|
|
@@ -114,6 +112,10 @@ function ZoomOutModeInserters() {
|
|
|
114
112
|
tab: 'patterns',
|
|
115
113
|
category: 'all',
|
|
116
114
|
} );
|
|
115
|
+
showInsertionPoint( sectionRootClientId, index, {
|
|
116
|
+
operation: 'insert',
|
|
117
|
+
} );
|
|
118
|
+
inserterSearchInputRef?.current?.focus();
|
|
117
119
|
} }
|
|
118
120
|
/>
|
|
119
121
|
) }
|
|
@@ -100,7 +100,6 @@ export default function ZoomOutToolbar( { clientId, rootClientId } ) {
|
|
|
100
100
|
<Button
|
|
101
101
|
icon={ dragHandle }
|
|
102
102
|
className="block-selection-button_drag-handle zoom-out-toolbar-button"
|
|
103
|
-
aria-hidden="true"
|
|
104
103
|
label={ __( 'Drag' ) }
|
|
105
104
|
iconSize={ 24 }
|
|
106
105
|
size="compact"
|
|
@@ -104,6 +104,7 @@ export default function BorderRadiusControl( { onChange, values } ) {
|
|
|
104
104
|
units={ units }
|
|
105
105
|
/>
|
|
106
106
|
<RangeControl
|
|
107
|
+
__next40pxDefaultSize
|
|
107
108
|
label={ __( 'Border radius' ) }
|
|
108
109
|
hideLabelFromVision
|
|
109
110
|
className="components-border-radius-control__range-control"
|
|
@@ -45,7 +45,7 @@ exports[`ColorPaletteControl matches the snapshot 1`] = `
|
|
|
45
45
|
font-weight: 500;
|
|
46
46
|
line-height: 1.4;
|
|
47
47
|
text-transform: uppercase;
|
|
48
|
-
display:
|
|
48
|
+
display: block;
|
|
49
49
|
margin-bottom: calc(4px * 2);
|
|
50
50
|
padding: 0;
|
|
51
51
|
}
|
|
@@ -220,7 +220,7 @@ exports[`ColorPaletteControl matches the snapshot 1`] = `
|
|
|
220
220
|
aria-label="Color: red"
|
|
221
221
|
aria-selected="true"
|
|
222
222
|
class="components-button components-circular-option-picker__option"
|
|
223
|
-
data-active-item=""
|
|
223
|
+
data-active-item="true"
|
|
224
224
|
id="components-circular-option-picker-0-0"
|
|
225
225
|
role="option"
|
|
226
226
|
style="background-color: rgb(255, 0, 0); color: rgb(255, 0, 0);"
|