@wordpress/block-editor 13.3.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 +13 -0
- package/README.md +11 -5
- package/build/components/alignment-control/ui.js +2 -2
- package/build/components/alignment-control/ui.js.map +1 -1
- package/build/components/block-alignment-control/ui.js +1 -1
- package/build/components/block-alignment-control/ui.js.map +1 -1
- package/build/components/block-alignment-control/ui.native.js +1 -1
- package/build/components/block-alignment-control/ui.native.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-inspector/index.js +6 -3
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list/use-block-props/index.js +3 -1
- 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 +26 -27
- package/build/components/block-list/use-block-props/use-block-refs.js.map +1 -1
- package/build/components/block-list/use-block-props/use-is-hovered.js +25 -9
- package/build/components/block-list/use-block-props/use-is-hovered.js.map +1 -1
- package/build/components/block-list/use-in-between-inserter.js +3 -2
- package/build/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build/components/block-lock/modal.js +2 -0
- package/build/components/block-lock/modal.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-removal-warning-modal/index.js +2 -0
- package/build/components/block-removal-warning-modal/index.js.map +1 -1
- package/build/components/block-switcher/index.js +1 -1
- package/build/components/block-switcher/index.js.map +1 -1
- package/build/components/block-switcher/pattern-transformations-menu.js +11 -12
- package/build/components/block-switcher/pattern-transformations-menu.js.map +1 -1
- package/build/components/block-switcher/preview-block-popover.js +20 -17
- package/build/components/block-switcher/preview-block-popover.js.map +1 -1
- package/build/components/block-toolbar/shuffle.js +5 -2
- package/build/components/block-toolbar/shuffle.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/use-show-block-tools.js +7 -8
- package/build/components/block-tools/use-show-block-tools.js.map +1 -1
- package/build/components/block-tools/zoom-out-mode-inserter-button.js +45 -0
- package/build/components/block-tools/zoom-out-mode-inserter-button.js.map +1 -0
- package/build/components/block-tools/zoom-out-mode-inserters.js +35 -36
- package/build/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
- package/build/components/block-tools/zoom-out-popover.js +2 -1
- package/build/components/block-tools/zoom-out-popover.js.map +1 -1
- package/build/components/block-tools/zoom-out-toolbar.js +1 -2
- 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/date-format-picker/index.js +2 -11
- package/build/components/date-format-picker/index.js.map +1 -1
- package/build/components/default-block-appender/index.js +7 -4
- package/build/components/default-block-appender/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 +2 -7
- package/build/components/font-appearance-control/index.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 +63 -52
- package/build/components/global-styles/background-panel.js.map +1 -1
- package/build/components/global-styles/hooks.js +5 -1
- 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/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 +26 -44
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/typography-utils.js +78 -7
- package/build/components/global-styles/typography-utils.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +82 -44
- 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 +93 -44
- 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 +2 -2
- package/build/components/grid/grid-visualizer.js.map +1 -1
- package/build/components/grid/use-grid-layout-sync.js +93 -45
- 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/index.js +1 -9
- package/build/components/index.js.map +1 -1
- package/build/components/inner-blocks/index.js +1 -1
- package/build/components/inner-blocks/index.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/patterns-filter.js +20 -23
- package/build/components/inserter/block-patterns-tab/patterns-filter.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/media-tab/media-panel.js +1 -0
- package/build/components/inserter/media-tab/media-panel.js.map +1 -1
- package/build/components/inserter/menu.js +3 -3
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/preview-panel.js +20 -3
- package/build/components/inserter/preview-panel.js.map +1 -1
- package/build/components/inserter-draggable-blocks/index.js +10 -3
- package/build/components/inserter-draggable-blocks/index.js.map +1 -1
- package/build/components/inspector-controls-tabs/settings-tab.js +1 -2
- package/build/components/inspector-controls-tabs/settings-tab.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/list-view/block-select-button.js +2 -6
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/list-view/block.js +2 -2
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/utils.js +3 -1
- package/build/components/list-view/utils.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/rich-text/format-toolbar/index.js +1 -1
- package/build/components/rich-text/format-toolbar/index.js.map +1 -1
- package/build/components/rich-text/index.js +1 -1
- package/build/components/rich-text/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/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 +3 -3
- 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 +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/grid-visualizer.js +5 -8
- package/build/hooks/grid-visualizer.js.map +1 -1
- package/build/hooks/index.js +7 -1
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/layout-child.js +9 -2
- package/build/hooks/layout-child.js.map +1 -1
- package/build/hooks/line-height.js +0 -1
- package/build/hooks/line-height.js.map +1 -1
- package/build/hooks/position.js +3 -7
- package/build/hooks/position.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 +85 -50
- 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 +6 -2
- package/build/layouts/constrained.js.map +1 -1
- package/build/layouts/grid.js +2 -0
- package/build/layouts/grid.js.map +1 -1
- package/build/private-apis.js +0 -4
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +27 -2
- package/build/store/actions.js.map +1 -1
- package/build/store/reducer.js +19 -1
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +17 -5
- 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/alignment-control/ui.js +2 -2
- package/build-module/components/alignment-control/ui.js.map +1 -1
- package/build-module/components/block-alignment-control/ui.js +1 -1
- package/build-module/components/block-alignment-control/ui.js.map +1 -1
- package/build-module/components/block-alignment-control/ui.native.js +1 -1
- package/build-module/components/block-alignment-control/ui.native.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-inspector/index.js +6 -3
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list/use-block-props/index.js +3 -1
- 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 +27 -30
- package/build-module/components/block-list/use-block-props/use-block-refs.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-is-hovered.js +26 -9
- package/build-module/components/block-list/use-block-props/use-is-hovered.js.map +1 -1
- package/build-module/components/block-list/use-in-between-inserter.js +3 -2
- package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build-module/components/block-lock/modal.js +2 -0
- package/build-module/components/block-lock/modal.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-removal-warning-modal/index.js +2 -0
- package/build-module/components/block-removal-warning-modal/index.js.map +1 -1
- package/build-module/components/block-switcher/index.js +1 -1
- package/build-module/components/block-switcher/index.js.map +1 -1
- package/build-module/components/block-switcher/pattern-transformations-menu.js +12 -13
- package/build-module/components/block-switcher/pattern-transformations-menu.js.map +1 -1
- package/build-module/components/block-switcher/preview-block-popover.js +20 -17
- package/build-module/components/block-switcher/preview-block-popover.js.map +1 -1
- package/build-module/components/block-toolbar/shuffle.js +5 -2
- package/build-module/components/block-toolbar/shuffle.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/use-show-block-tools.js +7 -8
- package/build-module/components/block-tools/use-show-block-tools.js.map +1 -1
- package/build-module/components/block-tools/zoom-out-mode-inserter-button.js +37 -0
- package/build-module/components/block-tools/zoom-out-mode-inserter-button.js.map +1 -0
- package/build-module/components/block-tools/zoom-out-mode-inserters.js +37 -38
- package/build-module/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
- package/build-module/components/block-tools/zoom-out-popover.js +2 -1
- package/build-module/components/block-tools/zoom-out-popover.js.map +1 -1
- package/build-module/components/block-tools/zoom-out-toolbar.js +1 -2
- 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/date-format-picker/index.js +4 -12
- package/build-module/components/date-format-picker/index.js.map +1 -1
- package/build-module/components/default-block-appender/index.js +7 -4
- package/build-module/components/default-block-appender/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 -6
- package/build-module/components/font-appearance-control/index.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 +63 -52
- package/build-module/components/global-styles/background-panel.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +5 -1
- 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/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 +27 -45
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/typography-utils.js +76 -7
- package/build-module/components/global-styles/typography-utils.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +81 -43
- 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 +96 -46
- 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 +2 -2
- package/build-module/components/grid/grid-visualizer.js.map +1 -1
- package/build-module/components/grid/use-grid-layout-sync.js +94 -46
- 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/index.js +0 -5
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/inner-blocks/index.js +1 -1
- package/build-module/components/inner-blocks/index.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/patterns-filter.js +20 -23
- package/build-module/components/inserter/block-patterns-tab/patterns-filter.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/media-tab/media-panel.js +1 -0
- package/build-module/components/inserter/media-tab/media-panel.js.map +1 -1
- package/build-module/components/inserter/menu.js +3 -3
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/preview-panel.js +20 -3
- package/build-module/components/inserter/preview-panel.js.map +1 -1
- package/build-module/components/inserter-draggable-blocks/index.js +10 -3
- package/build-module/components/inserter-draggable-blocks/index.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/settings-tab.js +1 -2
- package/build-module/components/inspector-controls-tabs/settings-tab.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/list-view/block-select-button.js +3 -7
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/list-view/block.js +2 -2
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/utils.js +3 -1
- package/build-module/components/list-view/utils.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/rich-text/format-toolbar/index.js +1 -1
- package/build-module/components/rich-text/format-toolbar/index.js.map +1 -1
- package/build-module/components/rich-text/index.js +1 -1
- package/build-module/components/rich-text/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/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 +3 -3
- 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 +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/grid-visualizer.js +5 -8
- package/build-module/hooks/grid-visualizer.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/layout-child.js +9 -2
- package/build-module/hooks/layout-child.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/position.js +3 -7
- package/build-module/hooks/position.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 +84 -51
- 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 +6 -2
- package/build-module/layouts/constrained.js.map +1 -1
- package/build-module/layouts/grid.js +2 -0
- package/build-module/layouts/grid.js.map +1 -1
- package/build-module/private-apis.js +1 -5
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/actions.js +24 -1
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/reducer.js +18 -1
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +14 -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 +11 -18
- package/build-style/content.css +11 -18
- 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 +242 -136
- package/build-style/style.css +242 -136
- package/build-types/components/block-context/index.d.ts +2 -2
- package/build-types/components/block-context/index.d.ts.map +1 -1
- package/build-types/utils/dom.d.ts.map +1 -1
- package/package.json +31 -31
- package/src/autocompleters/style.scss +4 -0
- package/src/components/alignment-control/ui.js +2 -2
- package/src/components/block-alignment-control/ui.js +1 -1
- package/src/components/block-alignment-control/ui.native.js +1 -1
- package/src/components/block-breadcrumb/index.js +4 -2
- package/src/components/block-canvas/style.scss +1 -0
- package/src/components/block-context/README.md +4 -4
- package/src/components/block-draggable/index.js +3 -3
- package/src/components/block-inspector/index.js +8 -4
- package/src/components/block-list/content.scss +2 -16
- package/src/components/block-list/use-block-props/index.js +1 -1
- package/src/components/block-list/use-block-props/use-block-refs.js +30 -30
- package/src/components/block-list/use-block-props/use-is-hovered.js +26 -11
- package/src/components/block-list/use-in-between-inserter.js +5 -1
- package/src/components/block-lock/modal.js +10 -2
- package/src/components/block-lock/style.scss +4 -8
- package/src/components/block-mover/index.js +5 -2
- package/src/components/block-patterns-paging/style.scss +0 -23
- 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-removal-warning-modal/index.js +10 -2
- package/src/components/block-switcher/index.js +1 -1
- package/src/components/block-switcher/pattern-transformations-menu.js +17 -15
- package/src/components/block-switcher/preview-block-popover.js +20 -14
- package/src/components/block-switcher/style.scss +8 -17
- package/src/components/block-toolbar/shuffle.js +8 -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/style.scss +8 -0
- package/src/components/block-tools/use-block-toolbar-popover-props.js +1 -1
- package/src/components/block-tools/use-show-block-tools.js +12 -9
- package/src/components/block-tools/zoom-out-mode-inserter-button.js +47 -0
- package/src/components/block-tools/zoom-out-mode-inserters.js +48 -42
- package/src/components/block-tools/zoom-out-popover.js +1 -0
- package/src/components/block-tools/zoom-out-toolbar.js +1 -2
- 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/date-format-picker/index.js +2 -11
- package/src/components/default-block-appender/index.js +11 -4
- package/src/components/dimensions-tool/scale-tool.js +1 -0
- package/src/components/font-appearance-control/index.js +1 -5
- 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 +90 -62
- package/src/components/global-styles/hooks.js +5 -1
- package/src/components/global-styles/image-settings-panel.js +1 -0
- package/src/components/global-styles/style.scss +11 -9
- package/src/components/global-styles/test/theme-file-uri-utils.js +1 -26
- package/src/components/global-styles/test/typography-utils.js +325 -0
- package/src/components/global-styles/test/use-global-styles-output.js +52 -5
- 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 +36 -45
- package/src/components/global-styles/typography-utils.js +103 -7
- package/src/components/global-styles/use-global-styles-output.js +89 -50
- package/src/components/global-styles/utils.js +112 -0
- package/src/components/grid/grid-item-movers.js +141 -69
- package/src/components/grid/grid-item-resizer.js +11 -17
- package/src/components/grid/grid-visualizer.js +2 -2
- package/src/components/grid/style.scss +164 -0
- package/src/components/grid/use-grid-layout-sync.js +133 -40
- package/src/components/iframe/content.scss +3 -3
- package/src/components/iframe/index.js +3 -7
- package/src/components/index.js +0 -5
- package/src/components/inner-blocks/index.js +4 -1
- package/src/components/inserter/block-patterns-tab/patterns-filter.js +40 -44
- package/src/components/inserter/category-tabs/index.js +35 -2
- package/src/components/inserter/media-tab/media-panel.js +1 -0
- package/src/components/inserter/menu.js +3 -3
- package/src/components/inserter/preview-panel.js +27 -4
- package/src/components/inserter/style.scss +66 -47
- package/src/components/inserter-draggable-blocks/index.js +11 -3
- package/src/components/inspector-controls/README.md +5 -0
- package/src/components/inspector-controls-tabs/settings-tab.js +0 -2
- package/src/components/inspector-controls-tabs/style.scss +0 -21
- 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/list-view/block-select-button.js +3 -13
- package/src/components/list-view/block.js +10 -3
- package/src/components/list-view/style.scss +2 -1
- package/src/components/list-view/utils.js +13 -2
- 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/rich-text/format-toolbar/index.js +1 -1
- package/src/components/rich-text/index.js +1 -1
- package/src/components/skip-to-selected-block/index.js +5 -3
- package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +6 -7
- 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/image-url-input-ui.js +3 -3
- package/src/components/url-popover/link-editor.js +0 -1
- package/src/components/url-popover/style.scss +1 -0
- 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/grid-visualizer.js +5 -7
- package/src/hooks/index.js +2 -1
- package/src/hooks/layout-child.js +12 -3
- package/src/hooks/line-height.js +0 -1
- package/src/hooks/position.js +3 -13
- package/src/hooks/spacing-visualizer.js +1 -1
- package/src/hooks/use-bindings-attributes.js +93 -59
- 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 +10 -2
- package/src/layouts/grid.js +2 -0
- package/src/private-apis.js +1 -8
- package/src/store/actions.js +28 -5
- package/src/store/reducer.js +18 -0
- package/src/store/selectors.js +14 -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/components/inserter/reusable-block-rename-hint.js +0 -71
- package/build/components/inserter/reusable-block-rename-hint.js.map +0 -1
- package/build/components/inspector-controls-tabs/settings-tab-hint.js +0 -53
- package/build/components/inspector-controls-tabs/settings-tab-hint.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/inserter/reusable-block-rename-hint.js +0 -64
- package/build-module/components/inserter/reusable-block-rename-hint.js.map +0 -1
- package/build-module/components/inspector-controls-tabs/settings-tab-hint.js +0 -47
- package/build-module/components/inspector-controls-tabs/settings-tab-hint.js.map +0 -1
- package/src/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +0 -25
- package/src/components/inserter/reusable-block-rename-hint.js +0 -69
- package/src/components/inspector-controls-tabs/settings-tab-hint.js +0 -52
|
@@ -2,52 +2,66 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
5
|
-
import { useEffect } from '@wordpress/element';
|
|
5
|
+
import { useEffect, useMemo } from '@wordpress/element';
|
|
6
|
+
import { usePrevious } from '@wordpress/compose';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Internal dependencies
|
|
9
10
|
*/
|
|
10
11
|
import { store as blockEditorStore } from '../../store';
|
|
11
12
|
import { GridRect } from './utils';
|
|
13
|
+
import { setImmutably } from '../../utils/object';
|
|
12
14
|
|
|
13
15
|
export function useGridLayoutSync( { clientId: gridClientId } ) {
|
|
14
|
-
const { gridLayout, blockOrder } = useSelect(
|
|
16
|
+
const { gridLayout, blockOrder, selectedBlockLayout } = useSelect(
|
|
15
17
|
( select ) => {
|
|
16
18
|
const { getBlockAttributes, getBlockOrder } =
|
|
17
19
|
select( blockEditorStore );
|
|
20
|
+
const selectedBlock = select( blockEditorStore ).getSelectedBlock();
|
|
18
21
|
return {
|
|
19
22
|
gridLayout: getBlockAttributes( gridClientId ).layout ?? {},
|
|
20
23
|
blockOrder: getBlockOrder( gridClientId ),
|
|
24
|
+
selectedBlockLayout: selectedBlock?.attributes.style?.layout,
|
|
21
25
|
};
|
|
22
26
|
},
|
|
23
27
|
[ gridClientId ]
|
|
24
28
|
);
|
|
25
29
|
|
|
26
|
-
const { getBlockAttributes } =
|
|
30
|
+
const { getBlockAttributes, getBlockRootClientId } =
|
|
31
|
+
useSelect( blockEditorStore );
|
|
27
32
|
const { updateBlockAttributes, __unstableMarkNextChangeAsNotPersistent } =
|
|
28
33
|
useDispatch( blockEditorStore );
|
|
29
34
|
|
|
35
|
+
const selectedBlockRect = useMemo(
|
|
36
|
+
() =>
|
|
37
|
+
selectedBlockLayout ? new GridRect( selectedBlockLayout ) : null,
|
|
38
|
+
[ selectedBlockLayout ]
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
const previouslySelectedBlockRect = usePrevious( selectedBlockRect );
|
|
42
|
+
const previousIsManualPlacement = usePrevious(
|
|
43
|
+
gridLayout.isManualPlacement
|
|
44
|
+
);
|
|
45
|
+
const previousBlockOrder = usePrevious( blockOrder );
|
|
46
|
+
|
|
30
47
|
useEffect( () => {
|
|
31
48
|
const updates = {};
|
|
32
49
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
if ( isManualPlacement ) {
|
|
36
|
-
const rects = [];
|
|
50
|
+
if ( gridLayout.isManualPlacement ) {
|
|
51
|
+
const occupiedRects = [];
|
|
37
52
|
|
|
38
53
|
// Respect the position of blocks that already have a columnStart and rowStart value.
|
|
39
54
|
for ( const clientId of blockOrder ) {
|
|
40
|
-
const attributes = getBlockAttributes( clientId );
|
|
41
55
|
const {
|
|
42
56
|
columnStart,
|
|
43
57
|
rowStart,
|
|
44
58
|
columnSpan = 1,
|
|
45
59
|
rowSpan = 1,
|
|
46
|
-
} =
|
|
60
|
+
} = getBlockAttributes( clientId ).style?.layout ?? {};
|
|
47
61
|
if ( ! columnStart || ! rowStart ) {
|
|
48
62
|
continue;
|
|
49
63
|
}
|
|
50
|
-
|
|
64
|
+
occupiedRects.push(
|
|
51
65
|
new GridRect( {
|
|
52
66
|
columnStart,
|
|
53
67
|
rowStart,
|
|
@@ -65,17 +79,19 @@ export function useGridLayoutSync( { clientId: gridClientId } ) {
|
|
|
65
79
|
rowStart,
|
|
66
80
|
columnSpan = 1,
|
|
67
81
|
rowSpan = 1,
|
|
68
|
-
} = attributes.style?.layout
|
|
82
|
+
} = attributes.style?.layout ?? {};
|
|
69
83
|
if ( columnStart && rowStart ) {
|
|
70
84
|
continue;
|
|
71
85
|
}
|
|
72
|
-
const [ newColumnStart, newRowStart ] =
|
|
73
|
-
|
|
74
|
-
columnCount,
|
|
86
|
+
const [ newColumnStart, newRowStart ] = placeBlock(
|
|
87
|
+
occupiedRects,
|
|
88
|
+
gridLayout.columnCount,
|
|
75
89
|
columnSpan,
|
|
76
|
-
rowSpan
|
|
90
|
+
rowSpan,
|
|
91
|
+
previouslySelectedBlockRect?.columnEnd,
|
|
92
|
+
previouslySelectedBlockRect?.rowEnd
|
|
77
93
|
);
|
|
78
|
-
|
|
94
|
+
occupiedRects.push(
|
|
79
95
|
new GridRect( {
|
|
80
96
|
columnStart: newColumnStart,
|
|
81
97
|
rowStart: newRowStart,
|
|
@@ -96,8 +112,13 @@ export function useGridLayoutSync( { clientId: gridClientId } ) {
|
|
|
96
112
|
}
|
|
97
113
|
|
|
98
114
|
// Ensure there's enough rows to fit all blocks.
|
|
99
|
-
const bottomMostRow = Math.max(
|
|
100
|
-
|
|
115
|
+
const bottomMostRow = Math.max(
|
|
116
|
+
...occupiedRects.map( ( r ) => r.rowEnd )
|
|
117
|
+
);
|
|
118
|
+
if (
|
|
119
|
+
! gridLayout.rowCount ||
|
|
120
|
+
gridLayout.rowCount < bottomMostRow
|
|
121
|
+
) {
|
|
101
122
|
updates[ gridClientId ] = {
|
|
102
123
|
layout: {
|
|
103
124
|
...gridLayout,
|
|
@@ -105,25 +126,70 @@ export function useGridLayoutSync( { clientId: gridClientId } ) {
|
|
|
105
126
|
},
|
|
106
127
|
};
|
|
107
128
|
}
|
|
129
|
+
|
|
130
|
+
// Unset grid layout attributes for blocks removed from the grid.
|
|
131
|
+
for ( const clientId of previousBlockOrder ?? [] ) {
|
|
132
|
+
if ( ! blockOrder.includes( clientId ) ) {
|
|
133
|
+
const rootClientId = getBlockRootClientId( clientId );
|
|
134
|
+
|
|
135
|
+
// Block was removed from the editor, so nothing to do.
|
|
136
|
+
if ( rootClientId === null ) {
|
|
137
|
+
continue;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// Check if the block is being moved to another grid.
|
|
141
|
+
// If so, do nothing and let the new grid parent handle
|
|
142
|
+
// the attributes.
|
|
143
|
+
const rootAttributes = getBlockAttributes( rootClientId );
|
|
144
|
+
if ( rootAttributes?.layout?.type === 'grid' ) {
|
|
145
|
+
continue;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
const attributes = getBlockAttributes( clientId );
|
|
149
|
+
const {
|
|
150
|
+
columnStart,
|
|
151
|
+
rowStart,
|
|
152
|
+
columnSpan,
|
|
153
|
+
rowSpan,
|
|
154
|
+
...layout
|
|
155
|
+
} = attributes.style?.layout ?? {};
|
|
156
|
+
|
|
157
|
+
if ( columnStart || rowStart || columnSpan || rowSpan ) {
|
|
158
|
+
const hasEmptyLayoutAttribute =
|
|
159
|
+
Object.keys( layout ).length === 0;
|
|
160
|
+
|
|
161
|
+
updates[ clientId ] = setImmutably(
|
|
162
|
+
attributes,
|
|
163
|
+
[ 'style', 'layout' ],
|
|
164
|
+
hasEmptyLayoutAttribute ? undefined : layout
|
|
165
|
+
);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
108
169
|
} else {
|
|
109
|
-
//
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
const
|
|
113
|
-
attributes
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
layout
|
|
120
|
-
|
|
121
|
-
|
|
170
|
+
// Remove all of the columnStart and rowStart values
|
|
171
|
+
// when switching from manual to auto mode,
|
|
172
|
+
if ( previousIsManualPlacement === true ) {
|
|
173
|
+
for ( const clientId of blockOrder ) {
|
|
174
|
+
const attributes = getBlockAttributes( clientId );
|
|
175
|
+
const { columnStart, rowStart, ...layout } =
|
|
176
|
+
attributes.style?.layout ?? {};
|
|
177
|
+
// Only update attributes if columnStart or rowStart are set.
|
|
178
|
+
if ( columnStart || rowStart ) {
|
|
179
|
+
const hasEmptyLayoutAttribute =
|
|
180
|
+
Object.keys( layout ).length === 0;
|
|
181
|
+
|
|
182
|
+
updates[ clientId ] = setImmutably(
|
|
183
|
+
attributes,
|
|
184
|
+
[ 'style', 'layout' ],
|
|
185
|
+
hasEmptyLayoutAttribute ? undefined : layout
|
|
186
|
+
);
|
|
187
|
+
}
|
|
122
188
|
}
|
|
123
189
|
}
|
|
124
190
|
|
|
125
191
|
// Remove row styles in auto mode
|
|
126
|
-
if ( rowCount ) {
|
|
192
|
+
if ( gridLayout.rowCount ) {
|
|
127
193
|
updates[ gridClientId ] = {
|
|
128
194
|
layout: {
|
|
129
195
|
...gridLayout,
|
|
@@ -145,24 +211,51 @@ export function useGridLayoutSync( { clientId: gridClientId } ) {
|
|
|
145
211
|
// Actual deps to sync:
|
|
146
212
|
gridClientId,
|
|
147
213
|
gridLayout,
|
|
214
|
+
previousBlockOrder,
|
|
148
215
|
blockOrder,
|
|
149
|
-
|
|
216
|
+
previouslySelectedBlockRect,
|
|
217
|
+
previousIsManualPlacement,
|
|
218
|
+
// These won't change, but the linter thinks they might:
|
|
150
219
|
__unstableMarkNextChangeAsNotPersistent,
|
|
151
220
|
getBlockAttributes,
|
|
221
|
+
getBlockRootClientId,
|
|
152
222
|
updateBlockAttributes,
|
|
153
223
|
] );
|
|
154
224
|
}
|
|
155
225
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
226
|
+
/**
|
|
227
|
+
* @param {GridRect[]} occupiedRects
|
|
228
|
+
* @param {number} gridColumnCount
|
|
229
|
+
* @param {number} blockColumnSpan
|
|
230
|
+
* @param {number} blockRowSpan
|
|
231
|
+
* @param {number?} startColumn
|
|
232
|
+
* @param {number?} startRow
|
|
233
|
+
*/
|
|
234
|
+
function placeBlock(
|
|
235
|
+
occupiedRects,
|
|
236
|
+
gridColumnCount,
|
|
237
|
+
blockColumnSpan,
|
|
238
|
+
blockRowSpan,
|
|
239
|
+
startColumn = 1,
|
|
240
|
+
startRow = 1
|
|
241
|
+
) {
|
|
242
|
+
for ( let row = startRow; ; row++ ) {
|
|
243
|
+
for (
|
|
244
|
+
let column = row === startRow ? startColumn : 1;
|
|
245
|
+
column <= gridColumnCount;
|
|
246
|
+
column++
|
|
247
|
+
) {
|
|
248
|
+
const candidateRect = new GridRect( {
|
|
160
249
|
columnStart: column,
|
|
161
250
|
rowStart: row,
|
|
162
|
-
columnSpan,
|
|
163
|
-
rowSpan,
|
|
251
|
+
columnSpan: blockColumnSpan,
|
|
252
|
+
rowSpan: blockRowSpan,
|
|
164
253
|
} );
|
|
165
|
-
if (
|
|
254
|
+
if (
|
|
255
|
+
! occupiedRects.some( ( r ) =>
|
|
256
|
+
r.intersectsRect( candidateRect )
|
|
257
|
+
)
|
|
258
|
+
) {
|
|
166
259
|
return [ column, row ];
|
|
167
260
|
}
|
|
168
261
|
}
|
|
@@ -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 {
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
display: flex;
|
|
55
55
|
flex-direction: column;
|
|
56
56
|
|
|
57
|
-
> .is-root-container {
|
|
57
|
+
> .is-root-container:not(.wp-block-post-content) {
|
|
58
58
|
flex: 1;
|
|
59
59
|
display: flex;
|
|
60
60
|
flex-direction: column;
|
|
@@ -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 }
|
package/src/components/index.js
CHANGED
|
@@ -170,8 +170,3 @@ export { useBlockEditingMode } from './block-editing-mode';
|
|
|
170
170
|
export { default as BlockEditorProvider } from './provider';
|
|
171
171
|
export { useSettings, useSetting } from './use-settings';
|
|
172
172
|
export { useBlockCommands } from './use-block-commands';
|
|
173
|
-
|
|
174
|
-
/*
|
|
175
|
-
* The following rename hint component can be removed in 6.4.
|
|
176
|
-
*/
|
|
177
|
-
export { default as ReusableBlocksRenameHint } from './inserter/reusable-block-rename-hint';
|
|
@@ -132,7 +132,10 @@ function UncontrolledInnerBlocks( props ) {
|
|
|
132
132
|
/>
|
|
133
133
|
);
|
|
134
134
|
|
|
135
|
-
if (
|
|
135
|
+
if (
|
|
136
|
+
! blockType?.providesContext ||
|
|
137
|
+
Object.keys( blockType.providesContext ).length === 0
|
|
138
|
+
) {
|
|
136
139
|
return items;
|
|
137
140
|
}
|
|
138
141
|
|
|
@@ -22,11 +22,31 @@ import {
|
|
|
22
22
|
INSERTER_PATTERN_TYPES,
|
|
23
23
|
} from './utils';
|
|
24
24
|
|
|
25
|
-
const getShouldDisableSyncFilter = ( sourceFilter ) =>
|
|
26
|
-
|
|
25
|
+
const getShouldDisableSyncFilter = ( sourceFilter ) =>
|
|
26
|
+
sourceFilter !== 'all' && sourceFilter !== 'user';
|
|
27
|
+
const getShouldHideSourcesFilter = ( category ) => {
|
|
27
28
|
return category.name === myPatternsCategory.name;
|
|
28
29
|
};
|
|
29
30
|
|
|
31
|
+
const PATTERN_SOURCE_MENU_OPTIONS = [
|
|
32
|
+
{
|
|
33
|
+
value: 'all',
|
|
34
|
+
label: _x( 'All', 'patterns' ),
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
value: INSERTER_PATTERN_TYPES.directory,
|
|
38
|
+
label: __( 'Pattern Directory' ),
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
value: INSERTER_PATTERN_TYPES.theme,
|
|
42
|
+
label: __( 'Theme & Plugins' ),
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
value: INSERTER_PATTERN_TYPES.user,
|
|
46
|
+
label: __( 'User' ),
|
|
47
|
+
},
|
|
48
|
+
];
|
|
49
|
+
|
|
30
50
|
export function PatternsFilter( {
|
|
31
51
|
setPatternSyncFilter,
|
|
32
52
|
setPatternSourceFilter,
|
|
@@ -50,10 +70,9 @@ export function PatternsFilter( {
|
|
|
50
70
|
currentPatternSourceFilter
|
|
51
71
|
);
|
|
52
72
|
|
|
53
|
-
// We also
|
|
54
|
-
//
|
|
55
|
-
const
|
|
56
|
-
getShouldDisableNonUserSources( category );
|
|
73
|
+
// We also hide the directory and theme source filter if the category is `myPatterns`
|
|
74
|
+
// otherwise there will only be one option available.
|
|
75
|
+
const shouldHideSourcesFilter = getShouldHideSourcesFilter( category );
|
|
57
76
|
|
|
58
77
|
const patternSyncMenuOptions = useMemo(
|
|
59
78
|
() => [
|
|
@@ -75,31 +94,6 @@ export function PatternsFilter( {
|
|
|
75
94
|
[ shouldDisableSyncFilter ]
|
|
76
95
|
);
|
|
77
96
|
|
|
78
|
-
const patternSourceMenuOptions = useMemo(
|
|
79
|
-
() => [
|
|
80
|
-
{
|
|
81
|
-
value: 'all',
|
|
82
|
-
label: _x( 'All', 'patterns' ),
|
|
83
|
-
disabled: shouldDisableNonUserSources,
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
value: INSERTER_PATTERN_TYPES.directory,
|
|
87
|
-
label: __( 'Pattern Directory' ),
|
|
88
|
-
disabled: shouldDisableNonUserSources,
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
value: INSERTER_PATTERN_TYPES.theme,
|
|
92
|
-
label: __( 'Theme & Plugins' ),
|
|
93
|
-
disabled: shouldDisableNonUserSources,
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
value: INSERTER_PATTERN_TYPES.user,
|
|
97
|
-
label: __( 'User' ),
|
|
98
|
-
},
|
|
99
|
-
],
|
|
100
|
-
[ shouldDisableNonUserSources ]
|
|
101
|
-
);
|
|
102
|
-
|
|
103
97
|
function handleSetSourceFilterChange( newSourceFilter ) {
|
|
104
98
|
setPatternSourceFilter( newSourceFilter );
|
|
105
99
|
if ( getShouldDisableSyncFilter( newSourceFilter ) ) {
|
|
@@ -136,19 +130,21 @@ export function PatternsFilter( {
|
|
|
136
130
|
>
|
|
137
131
|
{ () => (
|
|
138
132
|
<>
|
|
139
|
-
|
|
140
|
-
<
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
133
|
+
{ ! shouldHideSourcesFilter && (
|
|
134
|
+
<MenuGroup label={ __( 'Source' ) }>
|
|
135
|
+
<MenuItemsChoice
|
|
136
|
+
choices={ PATTERN_SOURCE_MENU_OPTIONS }
|
|
137
|
+
onSelect={ ( value ) => {
|
|
138
|
+
handleSetSourceFilterChange( value );
|
|
139
|
+
scrollContainerRef.current?.scrollTo(
|
|
140
|
+
0,
|
|
141
|
+
0
|
|
142
|
+
);
|
|
143
|
+
} }
|
|
144
|
+
value={ currentPatternSourceFilter }
|
|
145
|
+
/>
|
|
146
|
+
</MenuGroup>
|
|
147
|
+
) }
|
|
152
148
|
<MenuGroup label={ __( 'Type' ) }>
|
|
153
149
|
<MenuItemsChoice
|
|
154
150
|
choices={ patternSyncMenuOptions }
|
|
@@ -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';
|
|
@@ -147,7 +147,7 @@ function InserterMenu(
|
|
|
147
147
|
const showMediaPanel = selectedTab === 'media' && !! selectedMediaCategory;
|
|
148
148
|
|
|
149
149
|
const showZoomOut =
|
|
150
|
-
showPatternPanel && window.__experimentalEnableZoomedOutPatternsTab;
|
|
150
|
+
showPatternPanel && !! window.__experimentalEnableZoomedOutPatternsTab;
|
|
151
151
|
|
|
152
152
|
useZoomOut( showZoomOut );
|
|
153
153
|
|
|
@@ -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 }
|
|
@@ -30,6 +30,15 @@ function InserterPreviewPanel( { item } ) {
|
|
|
30
30
|
innerBlocks: example.innerBlocks,
|
|
31
31
|
} );
|
|
32
32
|
}, [ name, example, initialAttributes ] );
|
|
33
|
+
// Same as height of BlockPreviewPanel.
|
|
34
|
+
const previewHeight = 144;
|
|
35
|
+
const sidebarWidth = 280;
|
|
36
|
+
const viewportWidth = example?.viewportWidth ?? 500;
|
|
37
|
+
const scale = sidebarWidth / viewportWidth;
|
|
38
|
+
const minHeight =
|
|
39
|
+
scale !== 0 && scale < 1 && previewHeight
|
|
40
|
+
? previewHeight / scale
|
|
41
|
+
: previewHeight;
|
|
33
42
|
|
|
34
43
|
return (
|
|
35
44
|
<div className="block-editor-inserter__preview-container">
|
|
@@ -38,10 +47,24 @@ function InserterPreviewPanel( { item } ) {
|
|
|
38
47
|
<div className="block-editor-inserter__preview-content">
|
|
39
48
|
<BlockPreview
|
|
40
49
|
blocks={ blocks }
|
|
41
|
-
viewportWidth={
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
50
|
+
viewportWidth={ viewportWidth }
|
|
51
|
+
minHeight={ previewHeight }
|
|
52
|
+
additionalStyles={
|
|
53
|
+
//We want this CSS to be in sync with the one in BlockPreviewPanel.
|
|
54
|
+
[
|
|
55
|
+
{
|
|
56
|
+
css: `
|
|
57
|
+
body {
|
|
58
|
+
padding: 24px;
|
|
59
|
+
min-height:${ Math.round( minHeight ) }px;
|
|
60
|
+
display:flex;
|
|
61
|
+
align-items:center;
|
|
62
|
+
}
|
|
63
|
+
.is-root-container { width: 100%; }
|
|
64
|
+
`,
|
|
65
|
+
},
|
|
66
|
+
]
|
|
67
|
+
}
|
|
45
68
|
/>
|
|
46
69
|
</div>
|
|
47
70
|
) : (
|