@wordpress/block-editor 13.4.0 → 14.0.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 +11 -0
- package/README.md +11 -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/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-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-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/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/zoom-out-mode-inserters.js +15 -16
- 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/child-layout-control/index.js +3 -1
- package/build/components/child-layout-control/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-family/index.js +12 -0
- package/build/components/font-family/index.js.map +1 -1
- package/build/components/global-styles/background-panel.js +55 -51
- package/build/components/global-styles/background-panel.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/theme-file-uri-utils.js +0 -59
- package/build/components/global-styles/theme-file-uri-utils.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 +58 -39
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js +96 -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 +1 -1
- 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/iframe/index.js +4 -8
- package/build/components/iframe/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/menu.js +2 -2
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/line-height-control/index.js +0 -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-replace-flow/index.js +3 -1
- package/build/components/media-replace-flow/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 +4 -6
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.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/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 +30 -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/hooks/block-bindings.js +248 -36
- 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/private-apis.js +0 -1
- 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/selectors.js +4 -4
- package/build/store/selectors.js.map +1 -1
- 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/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/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-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-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/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/zoom-out-mode-inserters.js +16 -17
- 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/child-layout-control/index.js +3 -1
- package/build-module/components/child-layout-control/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-family/index.js +11 -0
- package/build-module/components/font-family/index.js.map +1 -1
- package/build-module/components/global-styles/background-panel.js +55 -51
- package/build-module/components/global-styles/background-panel.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/theme-file-uri-utils.js +0 -58
- package/build-module/components/global-styles/theme-file-uri-utils.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 +57 -38
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js +92 -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 +1 -1
- 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/iframe/index.js +4 -8
- package/build-module/components/iframe/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/menu.js +2 -2
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/line-height-control/index.js +0 -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-replace-flow/index.js +3 -1
- package/build-module/components/media-replace-flow/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 +4 -6
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.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/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 +30 -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/hooks/block-bindings.js +253 -40
- 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/private-apis.js +1 -2
- 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/selectors.js +4 -4
- package/build-module/store/selectors.js.map +1 -1
- 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 +5 -12
- package/build-style/content.css +5 -12
- package/build-style/default-editor-styles-rtl.css +3 -0
- package/build-style/default-editor-styles.css +3 -0
- package/build-style/style-rtl.css +88 -46
- package/build-style/style.css +88 -46
- package/package.json +31 -31
- 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/use-block-props/use-block-refs.js +27 -43
- 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-tools/block-selection-button.js +1 -2
- package/src/components/block-tools/index.js +5 -6
- package/src/components/block-tools/use-block-toolbar-popover-props.js +1 -1
- package/src/components/block-tools/zoom-out-mode-inserters.js +14 -18
- package/src/components/block-tools/zoom-out-toolbar.js +0 -1
- 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/dimensions-tool/scale-tool.js +1 -0
- package/src/components/font-family/README.md +8 -0
- package/src/components/font-family/index.js +16 -0
- package/src/components/font-family/stories/index.story.js +54 -0
- package/src/components/global-styles/background-panel.js +69 -61
- package/src/components/global-styles/image-settings-panel.js +1 -0
- package/src/components/global-styles/style.scss +0 -10
- package/src/components/global-styles/test/theme-file-uri-utils.js +1 -26
- package/src/components/global-styles/test/use-global-styles-output.js +49 -4
- package/src/components/global-styles/test/utils.js +120 -0
- package/src/components/global-styles/theme-file-uri-utils.js +0 -59
- package/src/components/global-styles/typography-panel.js +0 -1
- package/src/components/global-styles/use-global-styles-output.js +67 -48
- package/src/components/global-styles/utils.js +112 -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 +1 -1
- package/src/components/grid/style.scss +60 -10
- package/src/components/grid/use-grid-layout-sync.js +68 -14
- package/src/components/iframe/content.scss +2 -2
- package/src/components/iframe/index.js +3 -7
- package/src/components/inserter/category-tabs/index.js +35 -2
- package/src/components/inserter/menu.js +2 -2
- package/src/components/inserter/style.scss +16 -11
- package/src/components/inspector-controls/README.md +5 -0
- package/src/components/line-height-control/README.md +0 -8
- package/src/components/line-height-control/index.js +1 -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/media-replace-flow/README.md +7 -0
- package/src/components/media-replace-flow/index.js +3 -1
- package/src/components/resolution-tool/index.js +1 -0
- package/src/components/responsive-block-control/test/index.js +5 -1
- package/src/components/skip-to-selected-block/index.js +5 -3
- package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +3 -6
- package/src/components/tabbed-sidebar/style.scss +1 -19
- 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-popover/link-editor.js +0 -1
- package/src/components/use-block-drop-zone/index.js +66 -14
- 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/hooks/block-bindings.js +303 -52
- 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/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/private-apis.js +1 -2
- package/src/store/actions.js +13 -5
- package/src/store/selectors.js +4 -4
- package/src/style.scss +1 -1
- package/src/utils/get-editor-region.js +1 -1
- package/src/utils/get-px-from-css-unit.js +1 -1
- package/tsconfig.tsbuildinfo +1 -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-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/src/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +0 -25
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
.block-editor-iframe__html {
|
|
25
|
+
border: 0 solid $gray-300;
|
|
25
26
|
transform-origin: top center;
|
|
26
|
-
|
|
27
|
-
@include reduce-motion("transition");
|
|
27
|
+
@include editor-canvas-resize-animation;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
.block-editor-iframe__html.is-zoomed-out {
|
|
@@ -242,10 +242,8 @@ function Iframe( {
|
|
|
242
242
|
const isZoomedOut = scale !== 1;
|
|
243
243
|
|
|
244
244
|
useEffect( () => {
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
}
|
|
248
|
-
}, [ containerWidth, isZoomedOut ] );
|
|
245
|
+
prevContainerWidth.current = containerWidth;
|
|
246
|
+
}, [ containerWidth ] );
|
|
249
247
|
|
|
250
248
|
const disabledRef = useDisabled( { isDisabled: ! readonly } );
|
|
251
249
|
const bodyRef = useMergeRefs( [
|
|
@@ -305,7 +303,7 @@ function Iframe( {
|
|
|
305
303
|
|
|
306
304
|
iframeDocument.documentElement.classList.add( 'is-zoomed-out' );
|
|
307
305
|
|
|
308
|
-
const maxWidth =
|
|
306
|
+
const maxWidth = 750;
|
|
309
307
|
iframeDocument.documentElement.style.setProperty(
|
|
310
308
|
'--wp-block-editor-iframe-zoom-out-scale',
|
|
311
309
|
scale === 'default'
|
|
@@ -378,10 +376,8 @@ function Iframe( {
|
|
|
378
376
|
<iframe
|
|
379
377
|
{ ...props }
|
|
380
378
|
style={ {
|
|
381
|
-
border: 0,
|
|
382
379
|
...props.style,
|
|
383
380
|
height: props.style?.height,
|
|
384
|
-
transition: 'all .3s',
|
|
385
381
|
} }
|
|
386
382
|
ref={ useMergeRefs( [ ref, setRef ] ) }
|
|
387
383
|
tabIndex={ tabIndex }
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
+
import { usePrevious, useReducedMotion } from '@wordpress/compose';
|
|
4
5
|
import { isRTL } from '@wordpress/i18n';
|
|
5
6
|
import {
|
|
6
7
|
__experimentalHStack as HStack,
|
|
7
8
|
FlexBlock,
|
|
8
9
|
privateApis as componentsPrivateApis,
|
|
10
|
+
__unstableMotion as motion,
|
|
9
11
|
} from '@wordpress/components';
|
|
10
12
|
import { Icon, chevronRight, chevronLeft } from '@wordpress/icons';
|
|
11
13
|
|
|
@@ -22,6 +24,17 @@ function CategoryTabs( {
|
|
|
22
24
|
onSelectCategory,
|
|
23
25
|
children,
|
|
24
26
|
} ) {
|
|
27
|
+
// Copied from InterfaceSkeleton.
|
|
28
|
+
const ANIMATION_DURATION = 0.25;
|
|
29
|
+
const disableMotion = useReducedMotion();
|
|
30
|
+
const defaultTransition = {
|
|
31
|
+
type: 'tween',
|
|
32
|
+
duration: disableMotion ? 0 : ANIMATION_DURATION,
|
|
33
|
+
ease: [ 0.6, 0, 0.4, 1 ],
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const previousSelectedCategory = usePrevious( selectedCategory );
|
|
37
|
+
|
|
25
38
|
return (
|
|
26
39
|
<Tabs
|
|
27
40
|
className="block-editor-inserter__category-tabs"
|
|
@@ -62,9 +75,29 @@ function CategoryTabs( {
|
|
|
62
75
|
key={ category.name }
|
|
63
76
|
tabId={ category.name }
|
|
64
77
|
focusable={ false }
|
|
65
|
-
className="block-editor-inserter__category-panel"
|
|
66
78
|
>
|
|
67
|
-
|
|
79
|
+
<motion.div
|
|
80
|
+
className="block-editor-inserter__category-panel"
|
|
81
|
+
initial={
|
|
82
|
+
! previousSelectedCategory ? 'closed' : 'open'
|
|
83
|
+
}
|
|
84
|
+
animate="open"
|
|
85
|
+
variants={ {
|
|
86
|
+
open: {
|
|
87
|
+
transform: 'translateX( 0 )',
|
|
88
|
+
transitionEnd: {
|
|
89
|
+
zIndex: '1',
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
closed: {
|
|
93
|
+
transform: 'translateX( -100% )',
|
|
94
|
+
zIndex: '-1',
|
|
95
|
+
},
|
|
96
|
+
} }
|
|
97
|
+
transition={ defaultTransition }
|
|
98
|
+
>
|
|
99
|
+
{ children }
|
|
100
|
+
</motion.div>
|
|
68
101
|
</Tabs.TabPanel>
|
|
69
102
|
) ) }
|
|
70
103
|
</Tabs>
|
|
@@ -26,7 +26,7 @@ import Tips from './tips';
|
|
|
26
26
|
import InserterPreviewPanel from './preview-panel';
|
|
27
27
|
import BlockTypesTab from './block-types-tab';
|
|
28
28
|
import BlockPatternsTab from './block-patterns-tab';
|
|
29
|
-
import {
|
|
29
|
+
import { PatternCategoryPreviews } from './block-patterns-tab/pattern-category-previews';
|
|
30
30
|
import { MediaTab, MediaCategoryPanel } from './media-tab';
|
|
31
31
|
import InserterSearchResults from './search-results';
|
|
32
32
|
import useInsertionPoint from './hooks/use-insertion-point';
|
|
@@ -246,7 +246,7 @@ function InserterMenu(
|
|
|
246
246
|
selectedCategory={ selectedPatternCategory }
|
|
247
247
|
>
|
|
248
248
|
{ showPatternPanel && (
|
|
249
|
-
<
|
|
249
|
+
<PatternCategoryPreviews
|
|
250
250
|
rootClientId={ destinationRootClientId }
|
|
251
251
|
onInsert={ onInsertPattern }
|
|
252
252
|
onHover={ onHoverPattern }
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
$block-inserter-preview-height: 350px;
|
|
2
|
-
$block-inserter-width: 350px;
|
|
2
|
+
$block-quick-inserter-width: 350px;
|
|
3
3
|
$block-inserter-tabs-height: 44px;
|
|
4
4
|
|
|
5
5
|
.block-editor-inserter {
|
|
@@ -24,6 +24,12 @@ $block-inserter-tabs-height: 44px;
|
|
|
24
24
|
&.show-as-tabs {
|
|
25
25
|
gap: 0;
|
|
26
26
|
}
|
|
27
|
+
|
|
28
|
+
.block-editor-tabbed-sidebar {
|
|
29
|
+
@include break-medium() {
|
|
30
|
+
width: $secondary-sidebar-width;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
27
33
|
}
|
|
28
34
|
|
|
29
35
|
.block-editor-inserter__popover.is-quick {
|
|
@@ -85,6 +91,12 @@ $block-inserter-tabs-height: 44px;
|
|
|
85
91
|
height: 100%;
|
|
86
92
|
position: relative;
|
|
87
93
|
overflow: visible;
|
|
94
|
+
|
|
95
|
+
&.show-panel {
|
|
96
|
+
@include break-medium() {
|
|
97
|
+
width: $secondary-sidebar-width + $sidebar-width;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
88
100
|
}
|
|
89
101
|
|
|
90
102
|
.block-editor-inserter__inline-elements {
|
|
@@ -299,14 +311,13 @@ $block-inserter-tabs-height: 44px;
|
|
|
299
311
|
@include break-medium {
|
|
300
312
|
border-left: $border-width solid $gray-200;
|
|
301
313
|
padding: 0;
|
|
302
|
-
left:
|
|
303
|
-
width:
|
|
314
|
+
left: $secondary-sidebar-width;
|
|
315
|
+
width: $sidebar-width;
|
|
304
316
|
position: absolute;
|
|
305
317
|
top: -$border-width;
|
|
306
318
|
height: calc(100% + #{$border-width});
|
|
307
319
|
background: $gray-100;
|
|
308
320
|
border-top: $border-width solid $gray-200;
|
|
309
|
-
box-shadow: $border-width $border-width 0 0 rgba($color: #000, $alpha: 0.133); // 0.133 = $gray-200 but with alpha.
|
|
310
321
|
|
|
311
322
|
.block-editor-inserter__media-list,
|
|
312
323
|
.block-editor-block-patterns-list {
|
|
@@ -366,7 +377,7 @@ $block-inserter-tabs-height: 44px;
|
|
|
366
377
|
max-width: 100%;
|
|
367
378
|
|
|
368
379
|
@include break-medium {
|
|
369
|
-
width: $block-inserter-width;
|
|
380
|
+
width: $block-quick-inserter-width;
|
|
370
381
|
}
|
|
371
382
|
}
|
|
372
383
|
|
|
@@ -679,12 +690,6 @@ $block-inserter-tabs-height: 44px;
|
|
|
679
690
|
height: 100%;
|
|
680
691
|
}
|
|
681
692
|
}
|
|
682
|
-
|
|
683
|
-
// Remove doubled-up shadow that occurs when categories panel is opened, only in zoom out.
|
|
684
|
-
// Shadow cannot be removed from the source, as it is required when not zoomed out.
|
|
685
|
-
.block-editor-inserter__category-panel {
|
|
686
|
-
box-shadow: none;
|
|
687
|
-
}
|
|
688
693
|
}
|
|
689
694
|
|
|
690
695
|
.show-icon-labels {
|
|
@@ -96,6 +96,7 @@ registerBlockType( 'my-plugin/inspector-controls-example', {
|
|
|
96
96
|
<InspectorControls>
|
|
97
97
|
<PanelBody title={ __( 'Settings' ) }>
|
|
98
98
|
<CheckboxControl
|
|
99
|
+
__nextHasNoMarginBottom
|
|
99
100
|
heading="Checkbox Field"
|
|
100
101
|
label="Tick Me"
|
|
101
102
|
help="Additional help text"
|
|
@@ -114,6 +115,7 @@ registerBlockType( 'my-plugin/inspector-controls-example', {
|
|
|
114
115
|
/>
|
|
115
116
|
|
|
116
117
|
<TextControl
|
|
118
|
+
__nextHasNoMarginBottom
|
|
117
119
|
label="Text Field"
|
|
118
120
|
help="Additional help text"
|
|
119
121
|
value={ textField }
|
|
@@ -121,12 +123,14 @@ registerBlockType( 'my-plugin/inspector-controls-example', {
|
|
|
121
123
|
/>
|
|
122
124
|
|
|
123
125
|
<ToggleControl
|
|
126
|
+
__nextHasNoMarginBottom
|
|
124
127
|
label="Toggle Field"
|
|
125
128
|
checked={ toggleField }
|
|
126
129
|
onChange={ onChangeToggleField }
|
|
127
130
|
/>
|
|
128
131
|
|
|
129
132
|
<SelectControl
|
|
133
|
+
__nextHasNoMarginBottom
|
|
130
134
|
label="Select Control"
|
|
131
135
|
value={ selectField }
|
|
132
136
|
options={ [
|
|
@@ -203,6 +207,7 @@ function MyBlockEdit( { attributes, setAttributes } ) {
|
|
|
203
207
|
</InspectorControls>
|
|
204
208
|
<InspectorAdvancedControls>
|
|
205
209
|
<TextControl
|
|
210
|
+
__nextHasNoMarginBottom
|
|
206
211
|
label="HTML anchor"
|
|
207
212
|
value={ attributes.anchor }
|
|
208
213
|
onChange={ ( nextValue ) => {
|
|
@@ -18,7 +18,6 @@ const MyLineHeightControl = () => (
|
|
|
18
18
|
<LineHeightControl
|
|
19
19
|
value={ lineHeight }
|
|
20
20
|
onChange={ onChange }
|
|
21
|
-
__nextHasNoMarginBottom={ true }
|
|
22
21
|
/>
|
|
23
22
|
);
|
|
24
23
|
```
|
|
@@ -37,13 +36,6 @@ The value of the line height.
|
|
|
37
36
|
|
|
38
37
|
A callback function that handles the application of the line height value.
|
|
39
38
|
|
|
40
|
-
#### `__nextHasNoMarginBottom`
|
|
41
|
-
|
|
42
|
-
- **Type:** `boolean`
|
|
43
|
-
- **Default:** `false`
|
|
44
|
-
|
|
45
|
-
Start opting into the new margin-free styles that will become the default in a future version, currently scheduled to be WordPress 6.4. (The prop can be safely removed once this happens.)
|
|
46
|
-
|
|
47
39
|
## Related components
|
|
48
40
|
|
|
49
41
|
Block Editor components are components that can be used to compose the UI of your block editor. Thus, they can only be used under a [`BlockEditorProvider`](https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/provider/README.md) in the components tree.
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import deprecated from '@wordpress/deprecated';
|
|
5
4
|
import { __ } from '@wordpress/i18n';
|
|
6
5
|
import { __experimentalNumberControl as NumberControl } from '@wordpress/components';
|
|
7
6
|
|
|
@@ -19,8 +18,6 @@ import {
|
|
|
19
18
|
const LineHeightControl = ( {
|
|
20
19
|
value: lineHeight,
|
|
21
20
|
onChange,
|
|
22
|
-
/** Start opting into the new margin-free styles that will become the default in a future version. */
|
|
23
|
-
__nextHasNoMarginBottom = false,
|
|
24
21
|
__unstableInputWidth = '60px',
|
|
25
22
|
...otherProps
|
|
26
23
|
} ) => {
|
|
@@ -76,20 +73,6 @@ const LineHeightControl = ( {
|
|
|
76
73
|
|
|
77
74
|
const value = isDefined ? lineHeight : RESET_VALUE;
|
|
78
75
|
|
|
79
|
-
if ( ! __nextHasNoMarginBottom ) {
|
|
80
|
-
deprecated(
|
|
81
|
-
'Bottom margin styles for wp.blockEditor.LineHeightControl',
|
|
82
|
-
{
|
|
83
|
-
since: '6.0',
|
|
84
|
-
version: '6.4',
|
|
85
|
-
hint: 'Set the `__nextHasNoMarginBottom` prop to true to start opting into the new styles, which will become the default in a future version',
|
|
86
|
-
}
|
|
87
|
-
);
|
|
88
|
-
}
|
|
89
|
-
const deprecatedStyles = __nextHasNoMarginBottom
|
|
90
|
-
? undefined
|
|
91
|
-
: { marginBottom: 24 };
|
|
92
|
-
|
|
93
76
|
const handleOnChange = ( nextValue, { event } ) => {
|
|
94
77
|
if ( nextValue === '' ) {
|
|
95
78
|
onChange();
|
|
@@ -105,10 +88,7 @@ const LineHeightControl = ( {
|
|
|
105
88
|
};
|
|
106
89
|
|
|
107
90
|
return (
|
|
108
|
-
<div
|
|
109
|
-
className="block-editor-line-height-control"
|
|
110
|
-
style={ deprecatedStyles }
|
|
111
|
-
>
|
|
91
|
+
<div className="block-editor-line-height-control">
|
|
112
92
|
<NumberControl
|
|
113
93
|
{ ...otherProps }
|
|
114
94
|
__unstableInputWidth={ __unstableInputWidth }
|
|
@@ -19,13 +19,7 @@ const SPIN = STEP * SPIN_FACTOR;
|
|
|
19
19
|
|
|
20
20
|
const ControlledLineHeightControl = () => {
|
|
21
21
|
const [ value, setValue ] = useState();
|
|
22
|
-
return
|
|
23
|
-
<LineHeightControl
|
|
24
|
-
value={ value }
|
|
25
|
-
onChange={ setValue }
|
|
26
|
-
__nextHasNoMarginBottom
|
|
27
|
-
/>
|
|
28
|
-
);
|
|
22
|
+
return <LineHeightControl value={ value } onChange={ setValue } />;
|
|
29
23
|
};
|
|
30
24
|
|
|
31
25
|
describe( 'LineHeightControl', () => {
|
|
@@ -119,7 +119,6 @@ const LinkControlSearchInput = forwardRef(
|
|
|
119
119
|
<div className="block-editor-link-control__search-input-container">
|
|
120
120
|
<URLInput
|
|
121
121
|
disableSuggestions={ currentLink?.url === value }
|
|
122
|
-
__nextHasNoMarginBottom
|
|
123
122
|
label={ __( 'Link' ) }
|
|
124
123
|
hideLabelFromVision={ hideLabelFromVision }
|
|
125
124
|
className={ className }
|
|
@@ -91,3 +91,10 @@ Removes a media replace notice.
|
|
|
91
91
|
- Required: No
|
|
92
92
|
|
|
93
93
|
If passed, children are rendered inside the dropdown.
|
|
94
|
+
|
|
95
|
+
### children
|
|
96
|
+
|
|
97
|
+
- Type: `Element | func`
|
|
98
|
+
- Required: No
|
|
99
|
+
|
|
100
|
+
If passed, children are rendered inside the dropdown. If a function is provided for this prop, it will receive an object with the `onClose` prop as an argument.
|
|
@@ -202,7 +202,9 @@ const MediaReplaceFlow = ( {
|
|
|
202
202
|
{ __( 'Use featured image' ) }
|
|
203
203
|
</MenuItem>
|
|
204
204
|
) }
|
|
205
|
-
{ children
|
|
205
|
+
{ typeof children === 'function'
|
|
206
|
+
? children( { onClose } )
|
|
207
|
+
: children }
|
|
206
208
|
</NavigableMenu>
|
|
207
209
|
{ onSelectURL && (
|
|
208
210
|
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
|
|
@@ -39,7 +39,11 @@ const sizeOptions = [
|
|
|
39
39
|
const renderTestDefaultControlComponent = ( labelComponent, device ) => {
|
|
40
40
|
return (
|
|
41
41
|
<>
|
|
42
|
-
<SelectControl
|
|
42
|
+
<SelectControl
|
|
43
|
+
label={ labelComponent }
|
|
44
|
+
options={ sizeOptions }
|
|
45
|
+
__nextHasNoMarginBottom
|
|
46
|
+
/>
|
|
43
47
|
<p id={ device.id }>
|
|
44
48
|
{ device.label } is used here for testing purposes to ensure we
|
|
45
49
|
have access to details about the device.
|
|
@@ -4,12 +4,13 @@
|
|
|
4
4
|
import { useSelect } from '@wordpress/data';
|
|
5
5
|
import { __ } from '@wordpress/i18n';
|
|
6
6
|
import { Button } from '@wordpress/components';
|
|
7
|
+
import { useRef } from '@wordpress/element';
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* Internal dependencies
|
|
10
11
|
*/
|
|
11
12
|
import { store as blockEditorStore } from '../../store';
|
|
12
|
-
import {
|
|
13
|
+
import { useBlockElementRef } from '../block-list/use-block-props/use-block-refs';
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/skip-to-selected-block/README.md
|
|
@@ -19,9 +20,10 @@ export default function SkipToSelectedBlock() {
|
|
|
19
20
|
( select ) => select( blockEditorStore ).getBlockSelectionStart(),
|
|
20
21
|
[]
|
|
21
22
|
);
|
|
22
|
-
const ref =
|
|
23
|
+
const ref = useRef();
|
|
24
|
+
useBlockElementRef( selectedBlockClientId, ref );
|
|
23
25
|
const onClick = () => {
|
|
24
|
-
ref.current
|
|
26
|
+
ref.current?.focus();
|
|
25
27
|
};
|
|
26
28
|
|
|
27
29
|
return selectedBlockClientId ? (
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
__experimentalUnitControl as UnitControl,
|
|
10
10
|
__experimentalUseCustomUnits as useCustomUnits,
|
|
11
11
|
__experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue,
|
|
12
|
-
|
|
12
|
+
CustomSelectControl,
|
|
13
13
|
} from '@wordpress/components';
|
|
14
14
|
import { useSelect } from '@wordpress/data';
|
|
15
15
|
import { useState, useMemo } from '@wordpress/element';
|
|
@@ -31,11 +31,6 @@ import {
|
|
|
31
31
|
getPresetValueFromCustomValue,
|
|
32
32
|
isValueSpacingPreset,
|
|
33
33
|
} from '../utils';
|
|
34
|
-
import { unlock } from '../../../lock-unlock';
|
|
35
|
-
|
|
36
|
-
const { CustomSelectControlV2Legacy: CustomSelectControl } = unlock(
|
|
37
|
-
componentsPrivateApis
|
|
38
|
-
);
|
|
39
34
|
|
|
40
35
|
const CUSTOM_VALUE_SETTINGS = {
|
|
41
36
|
px: { max: 300, steps: 1 },
|
|
@@ -266,6 +261,8 @@ export default function SpacingInputControl( {
|
|
|
266
261
|
onChange={ handleCustomValueSliderChange }
|
|
267
262
|
className="spacing-sizes-control__custom-value-range"
|
|
268
263
|
__nextHasNoMarginBottom
|
|
264
|
+
label={ ariaLabel }
|
|
265
|
+
hideLabelFromVision
|
|
269
266
|
/>
|
|
270
267
|
</>
|
|
271
268
|
) }
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
.block-editor-tabbed-sidebar {
|
|
2
|
+
background-color: $white;
|
|
2
3
|
height: 100%;
|
|
3
4
|
display: flex;
|
|
4
5
|
flex-direction: column;
|
|
5
6
|
flex-grow: 1;
|
|
6
7
|
overflow: hidden;
|
|
7
|
-
|
|
8
|
-
@include break-medium() {
|
|
9
|
-
width: 350px;
|
|
10
|
-
}
|
|
11
8
|
}
|
|
12
9
|
|
|
13
10
|
.block-editor-tabbed-sidebar__tablist-and-close-button {
|
|
@@ -26,22 +23,7 @@
|
|
|
26
23
|
}
|
|
27
24
|
|
|
28
25
|
.block-editor-tabbed-sidebar__tablist {
|
|
29
|
-
box-sizing: border-box;
|
|
30
|
-
flex-grow: 1;
|
|
31
26
|
margin-bottom: -$border-width;
|
|
32
|
-
width: 100%;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
.block-editor-tabbed-sidebar__tab {
|
|
36
|
-
flex-grow: 1;
|
|
37
|
-
margin-bottom: -$border-width;
|
|
38
|
-
|
|
39
|
-
&[id$="reusable"] {
|
|
40
|
-
flex-grow: inherit;
|
|
41
|
-
// These are to align the `reusable` icon with the search icon.
|
|
42
|
-
padding-left: $grid-unit-20;
|
|
43
|
-
padding-right: $grid-unit-20;
|
|
44
|
-
}
|
|
45
27
|
}
|
|
46
28
|
|
|
47
29
|
.block-editor-tabbed-sidebar__tabpanel {
|
|
@@ -130,10 +130,6 @@ When hiding the URLInput using CSS (as is sometimes done for accessibility purpo
|
|
|
130
130
|
|
|
131
131
|
This prop allows the suggestions list to be programmatically not rendered by passing a boolean—it can be `true` to make sure suggestions aren't rendered, or `false`/`undefined` to fall back to the default behaviour of showing suggestions when matching autocompletion items are found.
|
|
132
132
|
|
|
133
|
-
### `__nextHasNoMarginBottom: Boolean`
|
|
134
|
-
|
|
135
|
-
Start opting into the new margin-free styles that will become the default in a future version, currently scheduled to be WordPress 6.4. (The prop can be safely removed once this happens.)
|
|
136
|
-
|
|
137
133
|
## Example
|
|
138
134
|
|
|
139
135
|
|
|
@@ -156,7 +152,6 @@ registerBlockType( /* ... */, {
|
|
|
156
152
|
edit( { className, attributes, setAttributes } ) {
|
|
157
153
|
return (
|
|
158
154
|
<URLInput
|
|
159
|
-
__nextHasNoMarginBottom
|
|
160
155
|
className={ className }
|
|
161
156
|
value={ attributes.url }
|
|
162
157
|
onChange={ ( url, post ) => setAttributes( { url, text: (post && post.title) || 'Click here' } ) }
|
|
@@ -6,7 +6,6 @@ import clsx from 'clsx';
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
|
-
import deprecated from '@wordpress/deprecated';
|
|
10
9
|
import { __, sprintf, _n } from '@wordpress/i18n';
|
|
11
10
|
import { Component, createRef } from '@wordpress/element';
|
|
12
11
|
import { UP, DOWN, ENTER, TAB } from '@wordpress/keycodes';
|
|
@@ -416,8 +415,6 @@ class URLInput extends Component {
|
|
|
416
415
|
|
|
417
416
|
renderControl() {
|
|
418
417
|
const {
|
|
419
|
-
/** Start opting into the new margin-free styles that will become the default in a future version. */
|
|
420
|
-
__nextHasNoMarginBottom = false,
|
|
421
418
|
label = null,
|
|
422
419
|
className,
|
|
423
420
|
isFullWidth,
|
|
@@ -473,19 +470,8 @@ class URLInput extends Component {
|
|
|
473
470
|
return renderControl( controlProps, inputProps, loading );
|
|
474
471
|
}
|
|
475
472
|
|
|
476
|
-
if ( ! __nextHasNoMarginBottom ) {
|
|
477
|
-
deprecated( 'Bottom margin styles for wp.blockEditor.URLInput', {
|
|
478
|
-
since: '6.2',
|
|
479
|
-
version: '6.5',
|
|
480
|
-
hint: 'Set the `__nextHasNoMarginBottom` prop to true to start opting into the new styles, which will become the default in a future version',
|
|
481
|
-
} );
|
|
482
|
-
}
|
|
483
|
-
|
|
484
473
|
return (
|
|
485
|
-
<BaseControl
|
|
486
|
-
__nextHasNoMarginBottom={ __nextHasNoMarginBottom }
|
|
487
|
-
{ ...controlProps }
|
|
488
|
-
>
|
|
474
|
+
<BaseControl __nextHasNoMarginBottom { ...controlProps }>
|
|
489
475
|
<input { ...inputProps } />
|
|
490
476
|
{ loading && <Spinner /> }
|
|
491
477
|
</BaseControl>
|
|
@@ -301,8 +301,10 @@ export default function useBlockDropZone( {
|
|
|
301
301
|
operation: 'insert',
|
|
302
302
|
} );
|
|
303
303
|
|
|
304
|
-
const { getBlockType } =
|
|
304
|
+
const { getBlockType, getBlockVariations, getGroupingBlockName } =
|
|
305
|
+
useSelect( blocksStore );
|
|
305
306
|
const {
|
|
307
|
+
canInsertBlockType,
|
|
306
308
|
getBlockListSettings,
|
|
307
309
|
getBlocks,
|
|
308
310
|
getBlockIndex,
|
|
@@ -310,6 +312,7 @@ export default function useBlockDropZone( {
|
|
|
310
312
|
getBlockNamesByClientId,
|
|
311
313
|
getAllowedBlocks,
|
|
312
314
|
isDragging,
|
|
315
|
+
isGroupable,
|
|
313
316
|
} = unlock( useSelect( blockEditorStore ) );
|
|
314
317
|
const {
|
|
315
318
|
showInsertionPoint,
|
|
@@ -385,21 +388,66 @@ export default function useBlockDropZone( {
|
|
|
385
388
|
};
|
|
386
389
|
} );
|
|
387
390
|
|
|
391
|
+
const dropTargetPosition = getDropTargetPosition(
|
|
392
|
+
blocksData,
|
|
393
|
+
{ x: event.clientX, y: event.clientY },
|
|
394
|
+
getBlockListSettings( targetRootClientId )?.orientation,
|
|
395
|
+
{
|
|
396
|
+
dropZoneElement,
|
|
397
|
+
parentBlockClientId,
|
|
398
|
+
parentBlockOrientation: parentBlockClientId
|
|
399
|
+
? getBlockListSettings( parentBlockClientId )
|
|
400
|
+
?.orientation
|
|
401
|
+
: undefined,
|
|
402
|
+
rootBlockIndex: getBlockIndex( targetRootClientId ),
|
|
403
|
+
}
|
|
404
|
+
);
|
|
405
|
+
|
|
388
406
|
const [ targetIndex, operation, nearestSide ] =
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
rootBlockIndex: getBlockIndex( targetRootClientId ),
|
|
401
|
-
}
|
|
407
|
+
dropTargetPosition;
|
|
408
|
+
|
|
409
|
+
if ( operation === 'group' ) {
|
|
410
|
+
const targetBlock = blocks[ targetIndex ];
|
|
411
|
+
const areAllImages = [
|
|
412
|
+
targetBlock.name,
|
|
413
|
+
...draggedBlockNames,
|
|
414
|
+
].every( ( name ) => name === 'core/image' );
|
|
415
|
+
const canInsertGalleryBlock = canInsertBlockType(
|
|
416
|
+
'core/gallery',
|
|
417
|
+
targetRootClientId
|
|
402
418
|
);
|
|
419
|
+
const areGroupableBlocks = isGroupable( [
|
|
420
|
+
targetBlock.clientId,
|
|
421
|
+
getDraggedBlockClientIds(),
|
|
422
|
+
] );
|
|
423
|
+
const groupBlockVariations = getBlockVariations(
|
|
424
|
+
getGroupingBlockName(),
|
|
425
|
+
'block'
|
|
426
|
+
);
|
|
427
|
+
const canInsertRow =
|
|
428
|
+
groupBlockVariations &&
|
|
429
|
+
groupBlockVariations.find(
|
|
430
|
+
( { name } ) => name === 'group-row'
|
|
431
|
+
);
|
|
432
|
+
|
|
433
|
+
// If the dragged blocks and the target block are all images,
|
|
434
|
+
// check if it is creatable either a Row variation or a Gallery block.
|
|
435
|
+
if (
|
|
436
|
+
areAllImages &&
|
|
437
|
+
! canInsertGalleryBlock &&
|
|
438
|
+
( ! areGroupableBlocks || ! canInsertRow )
|
|
439
|
+
) {
|
|
440
|
+
return;
|
|
441
|
+
}
|
|
442
|
+
// If the dragged blocks and the target block are not all images,
|
|
443
|
+
// check if it is creatable a Row variation.
|
|
444
|
+
if (
|
|
445
|
+
! areAllImages &&
|
|
446
|
+
( ! areGroupableBlocks || ! canInsertRow )
|
|
447
|
+
) {
|
|
448
|
+
return;
|
|
449
|
+
}
|
|
450
|
+
}
|
|
403
451
|
|
|
404
452
|
registry.batch( () => {
|
|
405
453
|
setDropTarget( {
|
|
@@ -436,6 +484,10 @@ export default function useBlockDropZone( {
|
|
|
436
484
|
showInsertionPoint,
|
|
437
485
|
isDragging,
|
|
438
486
|
startDragging,
|
|
487
|
+
canInsertBlockType,
|
|
488
|
+
getBlockVariations,
|
|
489
|
+
getGroupingBlockName,
|
|
490
|
+
isGroupable,
|
|
439
491
|
]
|
|
440
492
|
),
|
|
441
493
|
200
|