@wordpress/block-editor 12.20.0 → 12.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/build/components/block-actions/index.js +45 -32
- package/build/components/block-actions/index.js.map +1 -1
- package/build/components/block-bindings-toolbar-indicator/index.js +25 -0
- package/build/components/block-bindings-toolbar-indicator/index.js.map +1 -0
- package/build/components/block-edit/context.js +2 -1
- package/build/components/block-edit/context.js.map +1 -1
- package/build/components/block-edit/index.js +8 -3
- package/build/components/block-edit/index.js.map +1 -1
- package/build/components/block-inspector/index.js +5 -4
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list/block-invalid-warning.native.js.map +1 -1
- package/build/components/block-list/block-list-item.native.js +1 -1
- package/build/components/block-list/block-list-item.native.js.map +1 -1
- package/build/components/block-list/block-outline.native.js +23 -7
- package/build/components/block-list/block-outline.native.js.map +1 -1
- package/build/components/block-list/block-selection-button.native.js.map +1 -1
- package/build/components/block-list/block.native.js +0 -3
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-list/use-block-props/index.js +8 -1
- package/build/components/block-list/use-block-props/index.js.map +1 -1
- package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js +3 -3
- package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
- package/build/components/block-mover/index.native.js.map +1 -1
- package/build/components/block-popover/cover.js +68 -0
- package/build/components/block-popover/cover.js.map +1 -0
- package/build/components/block-popover/drop-zone.js +2 -3
- package/build/components/block-popover/drop-zone.js.map +1 -1
- package/build/components/block-popover/index.js +1 -19
- package/build/components/block-popover/index.js.map +1 -1
- package/build/components/block-preview/index.js +2 -1
- package/build/components/block-preview/index.js.map +1 -1
- package/build/components/block-removal-warning-modal/index.js +2 -4
- package/build/components/block-removal-warning-modal/index.js.map +1 -1
- package/build/components/block-rename/modal.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +12 -10
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-switcher/block-transformations-menu.native.js.map +1 -1
- package/build/components/block-toolbar/block-toolbar-menu.native.js.map +1 -1
- package/build/components/block-toolbar/index.js +21 -10
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-toolbar/shuffle.js +89 -0
- package/build/components/block-toolbar/shuffle.js.map +1 -0
- package/build/components/block-toolbar/use-has-block-toolbar.js +43 -0
- package/build/components/block-toolbar/use-has-block-toolbar.js.map +1 -0
- package/build/components/block-tools/block-selection-button.js +5 -1
- package/build/components/block-tools/block-selection-button.js.map +1 -1
- package/build/components/block-tools/empty-block-inserter.js +2 -5
- package/build/components/block-tools/empty-block-inserter.js.map +1 -1
- package/build/components/block-tools/index.js +9 -26
- package/build/components/block-tools/index.js.map +1 -1
- package/build/components/block-tools/use-show-block-tools.js +60 -0
- package/build/components/block-tools/use-show-block-tools.js.map +1 -0
- package/build/components/caption/index.native.js.map +1 -1
- package/build/components/child-layout-control/index.js.map +1 -1
- package/build/components/color-palette/control.js.map +1 -1
- package/build/components/colors-gradients/control.js +1 -1
- package/build/components/colors-gradients/control.js.map +1 -1
- package/build/components/global-styles/border-panel.js +21 -8
- package/build/components/global-styles/border-panel.js.map +1 -1
- package/build/components/global-styles/color-panel.js +1 -1
- package/build/components/global-styles/color-panel.js.map +1 -1
- package/build/components/global-styles/image-settings-panel.js.map +1 -1
- package/build/components/global-styles/index.js +6 -0
- package/build/components/global-styles/index.js.map +1 -1
- package/build/components/global-styles/shadow-panel-components.js +80 -23
- package/build/components/global-styles/shadow-panel-components.js.map +1 -1
- package/build/components/global-styles/typography-utils.js +7 -5
- package/build/components/global-styles/typography-utils.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +15 -15
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js +1 -1
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/grid-visualizer/grid-item-resizer.js +77 -0
- package/build/components/grid-visualizer/grid-item-resizer.js.map +1 -0
- package/build/components/grid-visualizer/grid-visualizer.js +81 -0
- package/build/components/grid-visualizer/grid-visualizer.js.map +1 -0
- package/build/components/grid-visualizer/index.js +20 -0
- package/build/components/grid-visualizer/index.js.map +1 -0
- package/build/components/grid-visualizer/utils.js +10 -0
- package/build/components/grid-visualizer/utils.js.map +1 -0
- package/build/components/iframe/index.js +61 -16
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/index.native.js +7 -0
- package/build/components/index.native.js.map +1 -1
- package/build/components/inner-blocks/use-nested-settings-update.js +8 -2
- package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build/components/inserter/media-tab/media-preview.js.map +1 -1
- package/build/components/inserter/menu.js +9 -3
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/menu.native.js.map +1 -1
- package/build/components/inserter/mobile-tab-navigation.js +1 -1
- package/build/components/inserter/mobile-tab-navigation.js.map +1 -1
- package/build/components/inserter/search-results.js +3 -2
- package/build/components/inserter/search-results.js.map +1 -1
- package/build/components/inserter/tabs.js +2 -1
- package/build/components/inserter/tabs.js.map +1 -1
- package/build/components/inspector-controls/block-support-tools-panel.js.map +1 -1
- package/build/components/inspector-controls-tabs/index.js +1 -1
- package/build/components/inspector-controls-tabs/index.js.map +1 -1
- package/build/components/inspector-controls-tabs/styles-tab.js +1 -1
- package/build/components/inspector-controls-tabs/styles-tab.js.map +1 -1
- package/build/components/link-control/link-preview.js +4 -1
- package/build/components/link-control/link-preview.js.map +1 -1
- package/build/components/link-control/search-input.js.map +1 -1
- package/build/components/list-view/block-select-button.js +10 -2
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/list-view/branch.js.map +1 -1
- package/build/components/list-view/drop-indicator.js.map +1 -1
- package/build/components/list-view/index.js.map +1 -1
- package/build/components/list-view/use-clipboard-handler.js +2 -1
- package/build/components/list-view/use-clipboard-handler.js.map +1 -1
- package/build/components/panel-color-settings/index.js.map +1 -1
- package/build/components/provider/index.js.map +1 -1
- package/build/components/resizable-box-popover/index.js +3 -5
- package/build/components/resizable-box-popover/index.js.map +1 -1
- package/build/components/responsive-block-control/index.js +1 -1
- package/build/components/responsive-block-control/index.js.map +1 -1
- package/build/components/rich-text/index.js +46 -26
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/use-enter.js +3 -0
- package/build/components/rich-text/use-enter.js.map +1 -1
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build/components/url-popover/index.js +3 -3
- package/build/components/url-popover/index.js.map +1 -1
- package/build/components/writing-flow/use-clipboard-handler.js +2 -1
- package/build/components/writing-flow/use-clipboard-handler.js.map +1 -1
- package/build/components/writing-flow/utils.js +23 -6
- package/build/components/writing-flow/utils.js.map +1 -1
- package/build/hooks/background.js.map +1 -1
- package/build/hooks/block-hooks.js +34 -8
- package/build/hooks/block-hooks.js.map +1 -1
- package/build/hooks/border.js +6 -4
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/dimensions.js +3 -4
- package/build/hooks/dimensions.js.map +1 -1
- package/build/hooks/font-size.js +6 -7
- package/build/hooks/font-size.js.map +1 -1
- package/build/hooks/index.js +1 -1
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/layout-child.js +39 -0
- package/build/hooks/layout-child.js.map +1 -1
- package/build/hooks/layout.js +11 -4
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/line-height.js.map +1 -1
- package/build/hooks/spacing-visualizer.js +115 -0
- package/build/hooks/spacing-visualizer.js.map +1 -0
- package/build/hooks/use-bindings-attributes.js +171 -48
- package/build/hooks/use-bindings-attributes.js.map +1 -1
- package/build/hooks/use-typography-props.js +1 -2
- package/build/hooks/use-typography-props.js.map +1 -1
- package/build/layouts/grid.js +6 -2
- package/build/layouts/grid.js.map +1 -1
- package/build/private-apis.js +7 -3
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +42 -12
- package/build/store/actions.js.map +1 -1
- package/build/store/private-actions.js +29 -55
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-selectors.js +0 -8
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +3 -20
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +27 -15
- package/build/store/selectors.js.map +1 -1
- package/build/utils/calculate-scale.js +17 -0
- package/build/utils/calculate-scale.js.map +1 -0
- package/build-module/components/block-actions/index.js +45 -32
- package/build-module/components/block-actions/index.js.map +1 -1
- package/build-module/components/block-bindings-toolbar-indicator/index.js +18 -0
- package/build-module/components/block-bindings-toolbar-indicator/index.js.map +1 -0
- package/build-module/components/block-edit/context.js +1 -0
- package/build-module/components/block-edit/context.js.map +1 -1
- package/build-module/components/block-edit/index.js +9 -4
- package/build-module/components/block-edit/index.js.map +1 -1
- package/build-module/components/block-inspector/index.js +6 -5
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list/block-invalid-warning.native.js.map +1 -1
- package/build-module/components/block-list/block-list-item.native.js +1 -1
- package/build-module/components/block-list/block-list-item.native.js.map +1 -1
- package/build-module/components/block-list/block-outline.native.js +23 -7
- package/build-module/components/block-list/block-outline.native.js.map +1 -1
- package/build-module/components/block-list/block-selection-button.native.js.map +1 -1
- package/build-module/components/block-list/block.native.js +0 -3
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-list/use-block-props/index.js +9 -2
- package/build-module/components/block-list/use-block-props/index.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js +3 -3
- package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
- package/build-module/components/block-mover/index.native.js.map +1 -1
- package/build-module/components/block-popover/cover.js +60 -0
- package/build-module/components/block-popover/cover.js.map +1 -0
- package/build-module/components/block-popover/drop-zone.js +2 -3
- package/build-module/components/block-popover/drop-zone.js.map +1 -1
- package/build-module/components/block-popover/index.js +1 -19
- package/build-module/components/block-popover/index.js.map +1 -1
- package/build-module/components/block-preview/index.js +2 -1
- package/build-module/components/block-preview/index.js.map +1 -1
- package/build-module/components/block-removal-warning-modal/index.js +3 -5
- package/build-module/components/block-removal-warning-modal/index.js.map +1 -1
- package/build-module/components/block-rename/modal.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +12 -10
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-switcher/block-transformations-menu.native.js.map +1 -1
- package/build-module/components/block-toolbar/block-toolbar-menu.native.js.map +1 -1
- package/build-module/components/block-toolbar/index.js +21 -11
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-toolbar/shuffle.js +82 -0
- package/build-module/components/block-toolbar/shuffle.js.map +1 -0
- package/build-module/components/block-toolbar/use-has-block-toolbar.js +36 -0
- package/build-module/components/block-toolbar/use-has-block-toolbar.js.map +1 -0
- package/build-module/components/block-tools/block-selection-button.js +5 -1
- package/build-module/components/block-tools/block-selection-button.js.map +1 -1
- package/build-module/components/block-tools/empty-block-inserter.js +2 -5
- package/build-module/components/block-tools/empty-block-inserter.js.map +1 -1
- package/build-module/components/block-tools/index.js +9 -26
- package/build-module/components/block-tools/index.js.map +1 -1
- package/build-module/components/block-tools/use-show-block-tools.js +54 -0
- package/build-module/components/block-tools/use-show-block-tools.js.map +1 -0
- package/build-module/components/caption/index.native.js.map +1 -1
- package/build-module/components/child-layout-control/index.js.map +1 -1
- package/build-module/components/color-palette/control.js.map +1 -1
- package/build-module/components/colors-gradients/control.js +1 -1
- package/build-module/components/colors-gradients/control.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +22 -10
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/color-panel.js +1 -1
- package/build-module/components/global-styles/color-panel.js.map +1 -1
- package/build-module/components/global-styles/image-settings-panel.js.map +1 -1
- package/build-module/components/global-styles/index.js +1 -1
- package/build-module/components/global-styles/index.js.map +1 -1
- package/build-module/components/global-styles/shadow-panel-components.js +82 -24
- package/build-module/components/global-styles/shadow-panel-components.js.map +1 -1
- package/build-module/components/global-styles/typography-utils.js +7 -5
- package/build-module/components/global-styles/typography-utils.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +16 -16
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js +2 -2
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/grid-visualizer/grid-item-resizer.js +69 -0
- package/build-module/components/grid-visualizer/grid-item-resizer.js.map +1 -0
- package/build-module/components/grid-visualizer/grid-visualizer.js +73 -0
- package/build-module/components/grid-visualizer/grid-visualizer.js.map +1 -0
- package/build-module/components/grid-visualizer/index.js +3 -0
- package/build-module/components/grid-visualizer/index.js.map +1 -0
- package/build-module/components/grid-visualizer/utils.js +4 -0
- package/build-module/components/grid-visualizer/utils.js.map +1 -0
- package/build-module/components/iframe/index.js +61 -16
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/index.native.js +1 -1
- package/build-module/components/index.native.js.map +1 -1
- package/build-module/components/inner-blocks/use-nested-settings-update.js +8 -2
- package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-preview.js.map +1 -1
- package/build-module/components/inserter/menu.js +9 -3
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/menu.native.js.map +1 -1
- package/build-module/components/inserter/mobile-tab-navigation.js +1 -1
- package/build-module/components/inserter/mobile-tab-navigation.js.map +1 -1
- package/build-module/components/inserter/search-results.js +3 -2
- package/build-module/components/inserter/search-results.js.map +1 -1
- package/build-module/components/inserter/tabs.js +2 -1
- package/build-module/components/inserter/tabs.js.map +1 -1
- package/build-module/components/inspector-controls/block-support-tools-panel.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/index.js +1 -1
- package/build-module/components/inspector-controls-tabs/index.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/styles-tab.js +2 -2
- package/build-module/components/inspector-controls-tabs/styles-tab.js.map +1 -1
- package/build-module/components/link-control/link-preview.js +5 -2
- package/build-module/components/link-control/link-preview.js.map +1 -1
- package/build-module/components/link-control/search-input.js.map +1 -1
- package/build-module/components/list-view/block-select-button.js +11 -3
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/list-view/branch.js.map +1 -1
- package/build-module/components/list-view/drop-indicator.js.map +1 -1
- package/build-module/components/list-view/index.js.map +1 -1
- package/build-module/components/list-view/use-clipboard-handler.js +3 -2
- package/build-module/components/list-view/use-clipboard-handler.js.map +1 -1
- package/build-module/components/panel-color-settings/index.js.map +1 -1
- package/build-module/components/provider/index.js.map +1 -1
- package/build-module/components/resizable-box-popover/index.js +3 -5
- package/build-module/components/resizable-box-popover/index.js.map +1 -1
- package/build-module/components/responsive-block-control/index.js +1 -1
- package/build-module/components/responsive-block-control/index.js.map +1 -1
- package/build-module/components/rich-text/index.js +47 -28
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/use-enter.js +3 -0
- package/build-module/components/rich-text/use-enter.js.map +1 -1
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build-module/components/url-popover/index.js +3 -3
- package/build-module/components/url-popover/index.js.map +1 -1
- package/build-module/components/writing-flow/use-clipboard-handler.js +3 -2
- package/build-module/components/writing-flow/use-clipboard-handler.js.map +1 -1
- package/build-module/components/writing-flow/utils.js +22 -7
- package/build-module/components/writing-flow/utils.js.map +1 -1
- package/build-module/hooks/background.js.map +1 -1
- package/build-module/hooks/block-hooks.js +34 -8
- package/build-module/hooks/block-hooks.js.map +1 -1
- package/build-module/hooks/border.js +7 -5
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/dimensions.js +1 -2
- package/build-module/hooks/dimensions.js.map +1 -1
- package/build-module/hooks/font-size.js +7 -8
- package/build-module/hooks/font-size.js.map +1 -1
- package/build-module/hooks/index.js +1 -1
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/layout-child.js +39 -0
- package/build-module/hooks/layout-child.js.map +1 -1
- package/build-module/hooks/layout.js +11 -4
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/hooks/line-height.js.map +1 -1
- package/build-module/hooks/spacing-visualizer.js +106 -0
- package/build-module/hooks/spacing-visualizer.js.map +1 -0
- package/build-module/hooks/use-bindings-attributes.js +172 -49
- package/build-module/hooks/use-bindings-attributes.js.map +1 -1
- package/build-module/hooks/use-typography-props.js +2 -3
- package/build-module/hooks/use-typography-props.js.map +1 -1
- package/build-module/layouts/grid.js +6 -2
- package/build-module/layouts/grid.js.map +1 -1
- package/build-module/private-apis.js +7 -3
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/actions.js +42 -12
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/private-actions.js +29 -54
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-selectors.js +0 -6
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +3 -20
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +23 -13
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/calculate-scale.js +11 -0
- package/build-module/utils/calculate-scale.js.map +1 -0
- package/build-style/content-rtl.css +8 -2
- package/build-style/content.css +8 -2
- package/build-style/default-editor-styles-rtl.css +1 -0
- package/build-style/default-editor-styles.css +1 -0
- package/build-style/style-rtl.css +113 -22
- package/build-style/style.css +113 -22
- package/package.json +31 -31
- package/src/components/block-actions/index.js +57 -47
- package/src/components/block-bindings-toolbar-indicator/index.js +20 -0
- package/src/components/block-bindings-toolbar-indicator/style.scss +14 -0
- package/src/components/block-draggable/test/index.native.js +2 -2
- package/src/components/block-edit/context.js +1 -0
- package/src/components/block-edit/index.js +5 -1
- package/src/components/block-inspector/index.js +7 -5
- package/src/components/block-list/block-invalid-warning.native.js +1 -1
- package/src/components/block-list/block-list-item.native.js +1 -1
- package/src/components/block-list/block-outline.native.js +36 -21
- package/src/components/block-list/block-selection-button.native.js +1 -3
- package/src/components/block-list/block.native.js +0 -3
- package/src/components/block-list/content.scss +5 -1
- package/src/components/block-list/test/block-outline.native.js +255 -0
- package/src/components/block-list/use-block-props/index.js +12 -2
- package/src/components/block-list/use-block-props/use-selected-block-event-handlers.js +3 -7
- package/src/components/block-mover/index.native.js +1 -1
- package/src/components/block-popover/cover.js +63 -0
- package/src/components/block-popover/drop-zone.js +3 -4
- package/src/components/block-popover/index.js +1 -28
- package/src/components/block-preview/index.js +3 -1
- package/src/components/block-removal-warning-modal/index.js +5 -19
- package/src/components/block-rename/modal.js +1 -1
- package/src/components/block-settings-menu/block-settings-dropdown.js +12 -9
- package/src/components/block-switcher/block-transformations-menu.native.js +1 -1
- package/src/components/block-toolbar/block-toolbar-menu.native.js +2 -2
- package/src/components/block-toolbar/index.js +19 -15
- package/src/components/block-toolbar/shuffle.js +93 -0
- package/src/components/block-toolbar/use-has-block-toolbar.js +49 -0
- package/src/components/block-tools/block-selection-button.js +4 -0
- package/src/components/block-tools/empty-block-inserter.js +3 -6
- package/src/components/block-tools/index.js +13 -36
- package/src/components/block-tools/use-show-block-tools.js +73 -0
- package/src/components/caption/index.native.js +1 -1
- package/src/components/child-layout-control/index.js +1 -1
- package/src/components/color-palette/control.js +1 -1
- package/src/components/colors-gradients/control.js +1 -1
- package/src/components/colors-gradients/test/control.js +2 -2
- package/src/components/contrast-checker/test/index.js +10 -10
- package/src/components/default-block-appender/content.scss +5 -2
- package/src/components/global-styles/border-panel.js +35 -24
- package/src/components/global-styles/color-panel.js +1 -1
- package/src/components/global-styles/image-settings-panel.js +1 -1
- package/src/components/global-styles/index.js +5 -1
- package/src/components/global-styles/shadow-panel-components.js +92 -23
- package/src/components/global-styles/style.scss +33 -10
- package/src/components/global-styles/test/typography-utils.js +231 -81
- package/src/components/global-styles/typography-utils.js +10 -7
- package/src/components/global-styles/use-global-styles-output.js +14 -16
- package/src/components/global-styles/utils.js +2 -8
- package/src/components/grid-visualizer/grid-item-resizer.js +100 -0
- package/src/components/grid-visualizer/grid-visualizer.js +81 -0
- package/src/components/grid-visualizer/index.js +2 -0
- package/src/components/grid-visualizer/style.scss +33 -0
- package/src/components/grid-visualizer/utils.js +5 -0
- package/src/components/iframe/index.js +78 -31
- package/src/components/index.native.js +1 -0
- package/src/components/inner-blocks/use-nested-settings-update.js +12 -2
- package/src/components/inserter/media-tab/media-preview.js +1 -1
- package/src/components/inserter/menu.js +10 -4
- package/src/components/inserter/menu.native.js +3 -3
- package/src/components/inserter/mobile-tab-navigation.js +1 -1
- package/src/components/inserter/search-results.js +2 -1
- package/src/components/inserter/style.scss +10 -0
- package/src/components/inserter/tabs.js +2 -1
- package/src/components/inspector-controls/block-support-tools-panel.js +2 -2
- package/src/components/inspector-controls-tabs/index.js +1 -1
- package/src/components/inspector-controls-tabs/styles-tab.js +2 -2
- package/src/components/line-height-control/test/index.js +1 -1
- package/src/components/link-control/link-preview.js +9 -2
- package/src/components/link-control/search-input.js +1 -1
- package/src/components/link-control/style.scss +9 -0
- package/src/components/list-view/block-select-button.js +16 -2
- package/src/components/list-view/branch.js +1 -1
- package/src/components/list-view/drop-indicator.js +1 -1
- package/src/components/list-view/index.js +1 -1
- package/src/components/list-view/style.scss +8 -0
- package/src/components/list-view/use-clipboard-handler.js +3 -2
- package/src/components/panel-color-settings/index.js +1 -1
- package/src/components/panel-color-settings/test/index.js +3 -3
- package/src/components/provider/index.js +1 -4
- package/src/components/resizable-box-popover/index.js +4 -6
- package/src/components/responsive-block-control/README.md +4 -4
- package/src/components/responsive-block-control/index.js +1 -1
- package/src/components/responsive-block-control/test/index.js +5 -5
- package/src/components/rich-text/index.js +76 -53
- package/src/components/rich-text/use-enter.js +4 -0
- package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +4 -4
- package/src/components/url-popover/index.js +5 -5
- package/src/components/url-popover/style.scss +1 -0
- package/src/components/writing-flow/use-clipboard-handler.js +3 -2
- package/src/components/writing-flow/utils.js +31 -16
- package/src/hooks/background.js +1 -1
- package/src/hooks/block-hooks.js +47 -9
- package/src/hooks/block-hooks.scss +6 -0
- package/src/hooks/border.js +16 -4
- package/src/hooks/dimensions.js +1 -2
- package/src/hooks/font-size.js +7 -12
- package/src/hooks/index.js +1 -0
- package/src/hooks/layout-child.js +38 -0
- package/src/hooks/layout.js +12 -1
- package/src/hooks/line-height.js +1 -1
- package/src/hooks/spacing-visualizer.js +126 -0
- package/src/hooks/{padding.scss → spacing.scss} +1 -1
- package/src/hooks/use-bindings-attributes.js +215 -65
- package/src/hooks/use-typography-props.js +2 -8
- package/src/layouts/grid.js +8 -3
- package/src/private-apis.js +6 -2
- package/src/store/actions.js +56 -18
- package/src/store/private-actions.js +34 -79
- package/src/store/private-selectors.js +0 -8
- package/src/store/reducer.js +2 -23
- package/src/store/selectors.js +41 -46
- package/src/store/test/actions.js +0 -4
- package/src/style.scss +3 -1
- package/src/utils/calculate-scale.js +20 -0
- package/build/hooks/margin.js +0 -86
- package/build/hooks/margin.js.map +0 -1
- package/build/hooks/padding.js +0 -78
- package/build/hooks/padding.js.map +0 -1
- package/build/utils/use-can-block-toolbar-be-focused.js +0 -46
- package/build/utils/use-can-block-toolbar-be-focused.js.map +0 -1
- package/build-module/hooks/margin.js +0 -78
- package/build-module/hooks/margin.js.map +0 -1
- package/build-module/hooks/padding.js +0 -70
- package/build-module/hooks/padding.js.map +0 -1
- package/build-module/utils/use-can-block-toolbar-be-focused.js +0 -40
- package/build-module/utils/use-can-block-toolbar-be-focused.js.map +0 -1
- package/src/hooks/margin.js +0 -91
- package/src/hooks/padding.js +0 -82
- package/src/utils/use-can-block-toolbar-be-focused.js +0 -48
|
@@ -24,10 +24,7 @@ import {
|
|
|
24
24
|
getBlockStyleVariationSelector,
|
|
25
25
|
} from './utils';
|
|
26
26
|
import { getBlockCSSSelector } from './get-block-css-selector';
|
|
27
|
-
import {
|
|
28
|
-
getTypographyFontSizeValue,
|
|
29
|
-
getFluidTypographyOptionsFromSettings,
|
|
30
|
-
} from './typography-utils';
|
|
27
|
+
import { getTypographyFontSizeValue } from './typography-utils';
|
|
31
28
|
import { GlobalStylesContext } from './context';
|
|
32
29
|
import { useGlobalSetting } from './hooks';
|
|
33
30
|
import { getDuotoneFilter } from '../duotone/utils';
|
|
@@ -431,7 +428,7 @@ export function getStylesDeclarations(
|
|
|
431
428
|
*/
|
|
432
429
|
ruleValue = getTypographyFontSizeValue(
|
|
433
430
|
{ size: ruleValue },
|
|
434
|
-
|
|
431
|
+
tree?.settings
|
|
435
432
|
);
|
|
436
433
|
}
|
|
437
434
|
|
|
@@ -600,6 +597,7 @@ const STYLE_KEYS = [
|
|
|
600
597
|
'filter',
|
|
601
598
|
'outline',
|
|
602
599
|
'shadow',
|
|
600
|
+
'background',
|
|
603
601
|
];
|
|
604
602
|
|
|
605
603
|
function pickStyleKeys( treeToPickFrom ) {
|
|
@@ -1194,15 +1192,13 @@ export function useGlobalStylesOutputWithConfig( mergedConfig = {} ) {
|
|
|
1194
1192
|
|
|
1195
1193
|
const isTemplate = blockContext?.templateSlug !== undefined;
|
|
1196
1194
|
|
|
1197
|
-
const getBlockStyles = useSelect(
|
|
1198
|
-
return select( blocksStore ).getBlockStyles;
|
|
1199
|
-
}, [] );
|
|
1195
|
+
const { getBlockStyles } = useSelect( blocksStore );
|
|
1200
1196
|
|
|
1201
1197
|
return useMemo( () => {
|
|
1202
1198
|
if ( ! mergedConfig?.styles || ! mergedConfig?.settings ) {
|
|
1203
1199
|
return [];
|
|
1204
1200
|
}
|
|
1205
|
-
|
|
1201
|
+
const updatedConfig = updateConfigWithSeparator( mergedConfig );
|
|
1206
1202
|
|
|
1207
1203
|
const blockSelectors = getBlockSelectors(
|
|
1208
1204
|
getBlockTypes(),
|
|
@@ -1210,18 +1206,18 @@ export function useGlobalStylesOutputWithConfig( mergedConfig = {} ) {
|
|
|
1210
1206
|
);
|
|
1211
1207
|
|
|
1212
1208
|
const customProperties = toCustomProperties(
|
|
1213
|
-
|
|
1209
|
+
updatedConfig,
|
|
1214
1210
|
blockSelectors
|
|
1215
1211
|
);
|
|
1216
1212
|
const globalStyles = toStyles(
|
|
1217
|
-
|
|
1213
|
+
updatedConfig,
|
|
1218
1214
|
blockSelectors,
|
|
1219
1215
|
hasBlockGapSupport,
|
|
1220
1216
|
hasFallbackGapSupport,
|
|
1221
1217
|
disableLayoutStyles,
|
|
1222
1218
|
isTemplate
|
|
1223
1219
|
);
|
|
1224
|
-
const svgs = toSvgFilters(
|
|
1220
|
+
const svgs = toSvgFilters( updatedConfig, blockSelectors );
|
|
1225
1221
|
|
|
1226
1222
|
const styles = [
|
|
1227
1223
|
{
|
|
@@ -1234,7 +1230,7 @@ export function useGlobalStylesOutputWithConfig( mergedConfig = {} ) {
|
|
|
1234
1230
|
},
|
|
1235
1231
|
// Load custom CSS in own stylesheet so that any invalid CSS entered in the input won't break all the global styles in the editor.
|
|
1236
1232
|
{
|
|
1237
|
-
css:
|
|
1233
|
+
css: updatedConfig.styles.css ?? '',
|
|
1238
1234
|
isGlobalStyles: true,
|
|
1239
1235
|
},
|
|
1240
1236
|
{
|
|
@@ -1248,11 +1244,11 @@ export function useGlobalStylesOutputWithConfig( mergedConfig = {} ) {
|
|
|
1248
1244
|
// If there are, get the block selector and push the selector together with
|
|
1249
1245
|
// the CSS value to the 'stylesheets' array.
|
|
1250
1246
|
getBlockTypes().forEach( ( blockType ) => {
|
|
1251
|
-
if (
|
|
1247
|
+
if ( updatedConfig.styles.blocks[ blockType.name ]?.css ) {
|
|
1252
1248
|
const selector = blockSelectors[ blockType.name ].selector;
|
|
1253
1249
|
styles.push( {
|
|
1254
1250
|
css: processCSSNesting(
|
|
1255
|
-
|
|
1251
|
+
updatedConfig.styles.blocks[ blockType.name ]?.css,
|
|
1256
1252
|
selector
|
|
1257
1253
|
),
|
|
1258
1254
|
isGlobalStyles: true,
|
|
@@ -1260,12 +1256,14 @@ export function useGlobalStylesOutputWithConfig( mergedConfig = {} ) {
|
|
|
1260
1256
|
}
|
|
1261
1257
|
} );
|
|
1262
1258
|
|
|
1263
|
-
return [ styles,
|
|
1259
|
+
return [ styles, updatedConfig.settings ];
|
|
1264
1260
|
}, [
|
|
1265
1261
|
hasBlockGapSupport,
|
|
1266
1262
|
hasFallbackGapSupport,
|
|
1267
1263
|
mergedConfig,
|
|
1268
1264
|
disableLayoutStyles,
|
|
1265
|
+
isTemplate,
|
|
1266
|
+
getBlockStyles,
|
|
1269
1267
|
] );
|
|
1270
1268
|
}
|
|
1271
1269
|
|
|
@@ -6,10 +6,7 @@ import fastDeepEqual from 'fast-deep-equal/es6';
|
|
|
6
6
|
/**
|
|
7
7
|
* Internal dependencies
|
|
8
8
|
*/
|
|
9
|
-
import {
|
|
10
|
-
getTypographyFontSizeValue,
|
|
11
|
-
getFluidTypographyOptionsFromSettings,
|
|
12
|
-
} from './typography-utils';
|
|
9
|
+
import { getTypographyFontSizeValue } from './typography-utils';
|
|
13
10
|
import { getValueFromObjectPath } from '../../utils/object';
|
|
14
11
|
|
|
15
12
|
/* Supporting data. */
|
|
@@ -77,10 +74,7 @@ export const PRESET_METADATA = [
|
|
|
77
74
|
{
|
|
78
75
|
path: [ 'typography', 'fontSizes' ],
|
|
79
76
|
valueFunc: ( preset, settings ) =>
|
|
80
|
-
getTypographyFontSizeValue(
|
|
81
|
-
preset,
|
|
82
|
-
getFluidTypographyOptionsFromSettings( settings )
|
|
83
|
-
),
|
|
77
|
+
getTypographyFontSizeValue( preset, settings ),
|
|
84
78
|
valueKey: 'size',
|
|
85
79
|
cssVarInfix: 'font-size',
|
|
86
80
|
classes: [ { classSuffix: 'font-size', propertyName: 'font-size' } ],
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { ResizableBox } from '@wordpress/components';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import { __unstableUseBlockElement as useBlockElement } from '../block-list/use-block-props/use-block-refs';
|
|
10
|
+
import BlockPopoverCover from '../block-popover/cover';
|
|
11
|
+
import { getComputedCSS } from './utils';
|
|
12
|
+
|
|
13
|
+
export function GridItemResizer( { clientId, onChange } ) {
|
|
14
|
+
const blockElement = useBlockElement( clientId );
|
|
15
|
+
if ( ! blockElement ) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
return (
|
|
19
|
+
<BlockPopoverCover
|
|
20
|
+
className="block-editor-grid-item-resizer"
|
|
21
|
+
clientId={ clientId }
|
|
22
|
+
__unstablePopoverSlot="block-toolbar"
|
|
23
|
+
>
|
|
24
|
+
<ResizableBox
|
|
25
|
+
className="block-editor-grid-item-resizer__box"
|
|
26
|
+
size={ {
|
|
27
|
+
width: '100%',
|
|
28
|
+
height: '100%',
|
|
29
|
+
} }
|
|
30
|
+
enable={ {
|
|
31
|
+
bottom: true,
|
|
32
|
+
bottomLeft: false,
|
|
33
|
+
bottomRight: false,
|
|
34
|
+
left: false,
|
|
35
|
+
right: true,
|
|
36
|
+
top: false,
|
|
37
|
+
topLeft: false,
|
|
38
|
+
topRight: false,
|
|
39
|
+
} }
|
|
40
|
+
onResizeStop={ ( event, direction, boxElement ) => {
|
|
41
|
+
const gridElement = blockElement.parentElement;
|
|
42
|
+
const columnGap = parseFloat(
|
|
43
|
+
getComputedCSS( gridElement, 'column-gap' )
|
|
44
|
+
);
|
|
45
|
+
const rowGap = parseFloat(
|
|
46
|
+
getComputedCSS( gridElement, 'row-gap' )
|
|
47
|
+
);
|
|
48
|
+
const gridColumnLines = getGridLines(
|
|
49
|
+
getComputedCSS( gridElement, 'grid-template-columns' ),
|
|
50
|
+
columnGap
|
|
51
|
+
);
|
|
52
|
+
const gridRowLines = getGridLines(
|
|
53
|
+
getComputedCSS( gridElement, 'grid-template-rows' ),
|
|
54
|
+
rowGap
|
|
55
|
+
);
|
|
56
|
+
const columnStart = getClosestLine(
|
|
57
|
+
gridColumnLines,
|
|
58
|
+
blockElement.offsetLeft
|
|
59
|
+
);
|
|
60
|
+
const rowStart = getClosestLine(
|
|
61
|
+
gridRowLines,
|
|
62
|
+
blockElement.offsetTop
|
|
63
|
+
);
|
|
64
|
+
const columnEnd = getClosestLine(
|
|
65
|
+
gridColumnLines,
|
|
66
|
+
blockElement.offsetLeft + boxElement.offsetWidth
|
|
67
|
+
);
|
|
68
|
+
const rowEnd = getClosestLine(
|
|
69
|
+
gridRowLines,
|
|
70
|
+
blockElement.offsetTop + boxElement.offsetHeight
|
|
71
|
+
);
|
|
72
|
+
onChange( {
|
|
73
|
+
columnSpan: Math.max( columnEnd - columnStart, 1 ),
|
|
74
|
+
rowSpan: Math.max( rowEnd - rowStart, 1 ),
|
|
75
|
+
} );
|
|
76
|
+
} }
|
|
77
|
+
/>
|
|
78
|
+
</BlockPopoverCover>
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function getGridLines( template, gap ) {
|
|
83
|
+
const lines = [ 0 ];
|
|
84
|
+
for ( const size of template.split( ' ' ) ) {
|
|
85
|
+
const line = parseFloat( size );
|
|
86
|
+
lines.push( lines[ lines.length - 1 ] + line + gap );
|
|
87
|
+
}
|
|
88
|
+
return lines;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function getClosestLine( lines, position ) {
|
|
92
|
+
return lines.reduce(
|
|
93
|
+
( closest, line, index ) =>
|
|
94
|
+
Math.abs( line - position ) <
|
|
95
|
+
Math.abs( lines[ closest ] - position )
|
|
96
|
+
? index
|
|
97
|
+
: closest,
|
|
98
|
+
0
|
|
99
|
+
);
|
|
100
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useState, useEffect } from '@wordpress/element';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import { __unstableUseBlockElement as useBlockElement } from '../block-list/use-block-props/use-block-refs';
|
|
10
|
+
import BlockPopoverCover from '../block-popover/cover';
|
|
11
|
+
import { getComputedCSS } from './utils';
|
|
12
|
+
|
|
13
|
+
export function GridVisualizer( { clientId } ) {
|
|
14
|
+
const blockElement = useBlockElement( clientId );
|
|
15
|
+
if ( ! blockElement ) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
return (
|
|
19
|
+
<BlockPopoverCover
|
|
20
|
+
className="block-editor-grid-visualizer"
|
|
21
|
+
clientId={ clientId }
|
|
22
|
+
__unstablePopoverSlot="block-toolbar"
|
|
23
|
+
>
|
|
24
|
+
<GridVisualizerGrid blockElement={ blockElement } />
|
|
25
|
+
</BlockPopoverCover>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function GridVisualizerGrid( { blockElement } ) {
|
|
30
|
+
const [ gridInfo, setGridInfo ] = useState( () =>
|
|
31
|
+
getGridInfo( blockElement )
|
|
32
|
+
);
|
|
33
|
+
useEffect( () => {
|
|
34
|
+
const observers = [];
|
|
35
|
+
for ( const element of [ blockElement, ...blockElement.children ] ) {
|
|
36
|
+
const observer = new window.ResizeObserver( () => {
|
|
37
|
+
setGridInfo( getGridInfo( blockElement ) );
|
|
38
|
+
} );
|
|
39
|
+
observer.observe( element );
|
|
40
|
+
observers.push( observer );
|
|
41
|
+
}
|
|
42
|
+
return () => {
|
|
43
|
+
for ( const observer of observers ) {
|
|
44
|
+
observer.disconnect();
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
}, [ blockElement ] );
|
|
48
|
+
return (
|
|
49
|
+
<div
|
|
50
|
+
className="block-editor-grid-visualizer__grid"
|
|
51
|
+
style={ gridInfo.style }
|
|
52
|
+
>
|
|
53
|
+
{ Array.from( { length: gridInfo.numItems }, ( _, i ) => (
|
|
54
|
+
<div key={ i } className="block-editor-grid-visualizer__item" />
|
|
55
|
+
) ) }
|
|
56
|
+
</div>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function getGridInfo( blockElement ) {
|
|
61
|
+
const gridTemplateColumns = getComputedCSS(
|
|
62
|
+
blockElement,
|
|
63
|
+
'grid-template-columns'
|
|
64
|
+
);
|
|
65
|
+
const gridTemplateRows = getComputedCSS(
|
|
66
|
+
blockElement,
|
|
67
|
+
'grid-template-rows'
|
|
68
|
+
);
|
|
69
|
+
const numColumns = gridTemplateColumns.split( ' ' ).length;
|
|
70
|
+
const numRows = gridTemplateRows.split( ' ' ).length;
|
|
71
|
+
const numItems = numColumns * numRows;
|
|
72
|
+
return {
|
|
73
|
+
numItems,
|
|
74
|
+
style: {
|
|
75
|
+
gridTemplateColumns,
|
|
76
|
+
gridTemplateRows,
|
|
77
|
+
gap: getComputedCSS( blockElement, 'gap' ),
|
|
78
|
+
padding: getComputedCSS( blockElement, 'padding' ),
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// TODO: Specificity hacks to get rid of all these darn !importants.
|
|
2
|
+
|
|
3
|
+
.block-editor-grid-visualizer {
|
|
4
|
+
z-index: z-index(".block-editor-grid-visualizer") !important;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.block-editor-grid-visualizer .components-popover__content * {
|
|
8
|
+
pointer-events: none !important;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.block-editor-grid-visualizer__grid {
|
|
12
|
+
display: grid;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.block-editor-grid-visualizer__item {
|
|
16
|
+
border: $border-width dashed $gray-300;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.block-editor-grid-item-resizer {
|
|
20
|
+
z-index: z-index(".block-editor-grid-visualizer") !important;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.block-editor-grid-item-resizer .components-popover__content * {
|
|
24
|
+
pointer-events: none !important;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.block-editor-grid-item-resizer__box {
|
|
28
|
+
border: $border-width solid var(--wp-admin-theme-color);
|
|
29
|
+
|
|
30
|
+
.components-resizable-box__handle {
|
|
31
|
+
pointer-events: all !important;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -30,7 +30,7 @@ import { useBlockSelectionClearer } from '../block-selection-clearer';
|
|
|
30
30
|
import { useWritingFlow } from '../writing-flow';
|
|
31
31
|
import { getCompatibilityStyles } from './get-compatibility-styles';
|
|
32
32
|
import { store as blockEditorStore } from '../../store';
|
|
33
|
-
|
|
33
|
+
import calculateScale from '../../utils/calculate-scale';
|
|
34
34
|
function bubbleEvent( event, Constructor, frame ) {
|
|
35
35
|
const init = {};
|
|
36
36
|
|
|
@@ -104,27 +104,53 @@ function Iframe( {
|
|
|
104
104
|
contentRef,
|
|
105
105
|
children,
|
|
106
106
|
tabIndex = 0,
|
|
107
|
-
|
|
108
|
-
frameSize = 0,
|
|
109
|
-
expand = false,
|
|
107
|
+
shouldZoom = false,
|
|
110
108
|
readonly,
|
|
111
109
|
forwardedRef: ref,
|
|
110
|
+
title = __( 'Editor canvas' ),
|
|
112
111
|
...props
|
|
113
112
|
} ) {
|
|
114
|
-
const { resolvedAssets, isPreviewMode } = useSelect(
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
113
|
+
const { resolvedAssets, isPreviewMode, isZoomOutMode } = useSelect(
|
|
114
|
+
( select ) => {
|
|
115
|
+
const { getSettings, __unstableGetEditorMode } =
|
|
116
|
+
select( blockEditorStore );
|
|
117
|
+
const settings = getSettings();
|
|
118
|
+
return {
|
|
119
|
+
resolvedAssets: settings.__unstableResolvedAssets,
|
|
120
|
+
isPreviewMode: settings.__unstableIsPreviewMode,
|
|
121
|
+
isZoomOutMode: __unstableGetEditorMode() === 'zoom-out',
|
|
122
|
+
};
|
|
123
|
+
},
|
|
124
|
+
[]
|
|
125
|
+
);
|
|
121
126
|
const { styles = '', scripts = '' } = resolvedAssets;
|
|
122
127
|
const [ iframeDocument, setIframeDocument ] = useState();
|
|
123
128
|
const [ bodyClasses, setBodyClasses ] = useState( [] );
|
|
124
129
|
const clearerRef = useBlockSelectionClearer();
|
|
125
130
|
const [ before, writingFlowRef, after ] = useWritingFlow();
|
|
126
|
-
const [
|
|
127
|
-
|
|
131
|
+
const [
|
|
132
|
+
contentResizeListener,
|
|
133
|
+
{ height: contentHeight, width: contentWidth },
|
|
134
|
+
] = useResizeObserver();
|
|
135
|
+
|
|
136
|
+
// When zoom-out mode is enabled, the iframe is scaled down to fit the
|
|
137
|
+
// content within the viewport.
|
|
138
|
+
// At 1000px wide, the iframe is scaled to 45%.
|
|
139
|
+
// At 400px wide, the iframe is scaled to 90%.
|
|
140
|
+
const scale =
|
|
141
|
+
isZoomOutMode && shouldZoom
|
|
142
|
+
? calculateScale(
|
|
143
|
+
{
|
|
144
|
+
maxWidth: 1000,
|
|
145
|
+
minWidth: 400,
|
|
146
|
+
maxScale: 0.45,
|
|
147
|
+
minScale: 0.9,
|
|
148
|
+
},
|
|
149
|
+
contentWidth
|
|
150
|
+
)
|
|
151
|
+
: 1;
|
|
152
|
+
const frameSize = isZoomOutMode ? 100 : 0;
|
|
153
|
+
|
|
128
154
|
const setRef = useRefEffect( ( node ) => {
|
|
129
155
|
node._load = () => {
|
|
130
156
|
setIframeDocument( node.contentDocument );
|
|
@@ -139,6 +165,8 @@ function Iframe( {
|
|
|
139
165
|
const { documentElement } = contentDocument;
|
|
140
166
|
iFrameDocument = contentDocument;
|
|
141
167
|
|
|
168
|
+
documentElement.classList.add( 'block-editor-iframe__html' );
|
|
169
|
+
|
|
142
170
|
clearerRef( documentElement );
|
|
143
171
|
|
|
144
172
|
// Ideally ALL classes that are added through get_body_class should
|
|
@@ -218,7 +246,19 @@ function Iframe( {
|
|
|
218
246
|
<head>
|
|
219
247
|
<meta charset="utf-8">
|
|
220
248
|
<script>window.frameElement._load()</script>
|
|
221
|
-
<style>
|
|
249
|
+
<style>
|
|
250
|
+
html{
|
|
251
|
+
height: auto !important;
|
|
252
|
+
min-height: 100%;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
body {
|
|
256
|
+
margin: 0;
|
|
257
|
+
/* Default background color in case zoom out mode background
|
|
258
|
+
colors the html element */
|
|
259
|
+
background: white;
|
|
260
|
+
}
|
|
261
|
+
</style>
|
|
222
262
|
${ styles }
|
|
223
263
|
${ scripts }
|
|
224
264
|
</head>
|
|
@@ -241,28 +281,35 @@ function Iframe( {
|
|
|
241
281
|
// top or bottom margin is 0.55 / 2 ((1 - scale) / 2).
|
|
242
282
|
const marginFromScaling = ( contentHeight * ( 1 - scale ) ) / 2;
|
|
243
283
|
|
|
284
|
+
useEffect( () => {
|
|
285
|
+
if ( iframeDocument && scale !== 1 ) {
|
|
286
|
+
iframeDocument.documentElement.style.transform = `scale( ${ scale } )`;
|
|
287
|
+
iframeDocument.documentElement.style.marginTop = `${ frameSize }px`;
|
|
288
|
+
iframeDocument.documentElement.style.marginBottom = `${
|
|
289
|
+
-marginFromScaling * 2 + frameSize
|
|
290
|
+
}px`;
|
|
291
|
+
return () => {
|
|
292
|
+
iframeDocument.documentElement.style.transform = '';
|
|
293
|
+
iframeDocument.documentElement.style.marginTop = '';
|
|
294
|
+
iframeDocument.documentElement.style.marginBottom = '';
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
}, [ scale, frameSize, marginFromScaling, iframeDocument ] );
|
|
298
|
+
|
|
299
|
+
// Make sure to not render the before and after focusable div elements in view
|
|
300
|
+
// mode. They're only needed to capture focus in edit mode.
|
|
301
|
+
const shouldRenderFocusCaptureElements = tabIndex >= 0 && ! isPreviewMode;
|
|
302
|
+
|
|
244
303
|
return (
|
|
245
304
|
<>
|
|
246
|
-
{
|
|
305
|
+
{ shouldRenderFocusCaptureElements && before }
|
|
247
306
|
{ /* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */ }
|
|
248
307
|
<iframe
|
|
249
308
|
{ ...props }
|
|
250
309
|
style={ {
|
|
251
310
|
border: 0,
|
|
252
311
|
...props.style,
|
|
253
|
-
height:
|
|
254
|
-
marginTop:
|
|
255
|
-
scale !== 1
|
|
256
|
-
? -marginFromScaling + frameSize
|
|
257
|
-
: props.style?.marginTop,
|
|
258
|
-
marginBottom:
|
|
259
|
-
scale !== 1
|
|
260
|
-
? -marginFromScaling + frameSize
|
|
261
|
-
: props.style?.marginBottom,
|
|
262
|
-
transform:
|
|
263
|
-
scale !== 1
|
|
264
|
-
? `scale( ${ scale } )`
|
|
265
|
-
: props.style?.transform,
|
|
312
|
+
height: props.style?.height,
|
|
266
313
|
transition: 'all .3s',
|
|
267
314
|
} }
|
|
268
315
|
ref={ useMergeRefs( [ ref, setRef ] ) }
|
|
@@ -271,7 +318,7 @@ function Iframe( {
|
|
|
271
318
|
// mode. Also preload the styles to avoid a flash of unstyled
|
|
272
319
|
// content.
|
|
273
320
|
src={ src }
|
|
274
|
-
title={
|
|
321
|
+
title={ title }
|
|
275
322
|
onKeyDown={ ( event ) => {
|
|
276
323
|
if ( props.onKeyDown ) {
|
|
277
324
|
props.onKeyDown( event );
|
|
@@ -282,7 +329,7 @@ function Iframe( {
|
|
|
282
329
|
// though by doing so we also trigger another React event,
|
|
283
330
|
// so we need to stop the propagation of this event to avoid
|
|
284
331
|
// duplication.
|
|
285
|
-
|
|
332
|
+
if (
|
|
286
333
|
event.currentTarget.ownerDocument !==
|
|
287
334
|
event.target.ownerDocument
|
|
288
335
|
) {
|
|
@@ -316,7 +363,7 @@ function Iframe( {
|
|
|
316
363
|
iframeDocument.documentElement
|
|
317
364
|
) }
|
|
318
365
|
</iframe>
|
|
319
|
-
{
|
|
366
|
+
{ shouldRenderFocusCaptureElements && after }
|
|
320
367
|
</>
|
|
321
368
|
);
|
|
322
369
|
}
|
|
@@ -49,6 +49,7 @@ export { default as MediaUploadProgress } from './media-upload-progress';
|
|
|
49
49
|
export {
|
|
50
50
|
MEDIA_UPLOAD_STATE_UPLOADING,
|
|
51
51
|
MEDIA_UPLOAD_STATE_SUCCEEDED,
|
|
52
|
+
MEDIA_UPLOAD_STATE_PAUSED,
|
|
52
53
|
MEDIA_UPLOAD_STATE_FAILED,
|
|
53
54
|
MEDIA_UPLOAD_STATE_RESET,
|
|
54
55
|
} from './media-upload-progress/constants';
|
|
@@ -37,11 +37,11 @@ function useShallowMemo( value ) {
|
|
|
37
37
|
* in inner blocks.
|
|
38
38
|
* @param {string[]} prioritizedInserterBlocks Block names and/or block variations to be prioritized in the inserter, in the format {blockName}/{variationName}.
|
|
39
39
|
* @param {?WPDirectInsertBlock} defaultBlock The default block to insert: [ blockName, { blockAttributes } ].
|
|
40
|
-
* @param {?
|
|
40
|
+
* @param {?boolean} directInsert If a default block should be inserted directly by the appender.
|
|
41
41
|
*
|
|
42
42
|
* @param {?WPDirectInsertBlock} __experimentalDefaultBlock A deprecated prop for the default block to insert: [ blockName, { blockAttributes } ]. Use `defaultBlock` instead.
|
|
43
43
|
*
|
|
44
|
-
* @param {?
|
|
44
|
+
* @param {?boolean} __experimentalDirectInsert A deprecated prop for whether a default block should be inserted directly by the appender. Use `directInsert` instead.
|
|
45
45
|
*
|
|
46
46
|
* @param {string} [templateLock] The template lock specified for the inner
|
|
47
47
|
* blocks component. (e.g. "all")
|
|
@@ -138,6 +138,16 @@ export default function useNestedSettingsUpdate(
|
|
|
138
138
|
newSettings.directInsert = directInsert;
|
|
139
139
|
}
|
|
140
140
|
|
|
141
|
+
if (
|
|
142
|
+
newSettings.directInsert !== undefined &&
|
|
143
|
+
typeof newSettings.directInsert !== 'boolean'
|
|
144
|
+
) {
|
|
145
|
+
deprecated( 'Using `Function` as a `directInsert` argument', {
|
|
146
|
+
alternative: '`boolean` values',
|
|
147
|
+
since: '6.5',
|
|
148
|
+
} );
|
|
149
|
+
}
|
|
150
|
+
|
|
141
151
|
// Batch updates to block list settings to avoid triggering cascading renders
|
|
142
152
|
// for each container block included in a tree and optimize initial render.
|
|
143
153
|
// To avoid triggering updateBlockListSettings for each container block
|
|
@@ -211,7 +211,7 @@ export function MediaPreview( { media, onClick, category } ) {
|
|
|
211
211
|
const onMouseLeave = useCallback( () => setIsHovered( false ), [] );
|
|
212
212
|
return (
|
|
213
213
|
<>
|
|
214
|
-
<InserterDraggableBlocks isEnabled
|
|
214
|
+
<InserterDraggableBlocks isEnabled blocks={ [ block ] }>
|
|
215
215
|
{ ( { draggable, onDragStart, onDragEnd } ) => (
|
|
216
216
|
<div
|
|
217
217
|
className={ classnames(
|
|
@@ -66,10 +66,13 @@ function InserterMenu(
|
|
|
66
66
|
insertionIndex: __experimentalInsertionIndex,
|
|
67
67
|
shouldFocusBlock,
|
|
68
68
|
} );
|
|
69
|
-
const { showPatterns } = useSelect(
|
|
69
|
+
const { isZoomOutMode, showPatterns } = useSelect(
|
|
70
70
|
( select ) => {
|
|
71
|
-
const { hasAllowedPatterns } = unlock(
|
|
71
|
+
const { hasAllowedPatterns, __unstableGetEditorMode } = unlock(
|
|
72
|
+
select( blockEditorStore )
|
|
73
|
+
);
|
|
72
74
|
return {
|
|
75
|
+
isZoomOutMode: __unstableGetEditorMode() === 'zoom-out',
|
|
73
76
|
showPatterns: hasAllowedPatterns( destinationRootClientId ),
|
|
74
77
|
};
|
|
75
78
|
},
|
|
@@ -77,7 +80,8 @@ function InserterMenu(
|
|
|
77
80
|
);
|
|
78
81
|
|
|
79
82
|
const mediaCategories = useMediaCategories( destinationRootClientId );
|
|
80
|
-
const showMedia = mediaCategories.length > 0;
|
|
83
|
+
const showMedia = mediaCategories.length > 0 && ! isZoomOutMode;
|
|
84
|
+
const showBlocks = ! isZoomOutMode;
|
|
81
85
|
|
|
82
86
|
const onInsert = useCallback(
|
|
83
87
|
( blocks, meta, shouldForceFocusBlock ) => {
|
|
@@ -249,19 +253,21 @@ function InserterMenu(
|
|
|
249
253
|
__experimentalInsertionIndex
|
|
250
254
|
}
|
|
251
255
|
showBlockDirectory
|
|
256
|
+
showBlocks={ showBlocks }
|
|
252
257
|
shouldFocusBlock={ shouldFocusBlock }
|
|
253
258
|
/>
|
|
254
259
|
</div>
|
|
255
260
|
) }
|
|
256
261
|
{ showAsTabs && (
|
|
257
262
|
<InserterTabs
|
|
263
|
+
showBlocks={ showBlocks }
|
|
258
264
|
showPatterns={ showPatterns }
|
|
259
265
|
showMedia={ showMedia }
|
|
260
266
|
onSelect={ handleSetSelectedTab }
|
|
261
267
|
tabsContents={ inserterTabsContents }
|
|
262
268
|
/>
|
|
263
269
|
) }
|
|
264
|
-
{ ! delayedFilterValue && ! showAsTabs && (
|
|
270
|
+
{ ! delayedFilterValue && ! showAsTabs && showBlocks && (
|
|
265
271
|
<div className="block-editor-inserter__no-tab-container">
|
|
266
272
|
{ blocksTab }
|
|
267
273
|
</div>
|
|
@@ -177,7 +177,7 @@ function InserterMenu( {
|
|
|
177
177
|
|
|
178
178
|
return (
|
|
179
179
|
<BottomSheet
|
|
180
|
-
isVisible
|
|
180
|
+
isVisible
|
|
181
181
|
onClose={ onClose }
|
|
182
182
|
onKeyboardShow={ onKeyboardShow }
|
|
183
183
|
onKeyboardHide={ onKeyboardHide }
|
|
@@ -198,10 +198,10 @@ function InserterMenu( {
|
|
|
198
198
|
</>
|
|
199
199
|
}
|
|
200
200
|
hasNavigation
|
|
201
|
-
setMinHeightToMaxHeight
|
|
201
|
+
setMinHeightToMaxHeight
|
|
202
202
|
contentStyle={ styles[ 'inserter-menu__list' ] }
|
|
203
203
|
isFullScreen={ isFullScreen }
|
|
204
|
-
allowDragIndicator
|
|
204
|
+
allowDragIndicator
|
|
205
205
|
>
|
|
206
206
|
<BottomSheetConsumer>
|
|
207
207
|
{ ( { listProps } ) => (
|
|
@@ -50,6 +50,7 @@ function InserterSearchResults( {
|
|
|
50
50
|
shouldFocusBlock = true,
|
|
51
51
|
prioritizePatterns,
|
|
52
52
|
selectBlockOnInsert,
|
|
53
|
+
showBlocks = true,
|
|
53
54
|
} ) {
|
|
54
55
|
const debouncedSpeak = useDebounce( speak, 500 );
|
|
55
56
|
|
|
@@ -167,7 +168,7 @@ function InserterSearchResults( {
|
|
|
167
168
|
const hasItems =
|
|
168
169
|
filteredBlockTypes.length > 0 || filteredBlockPatterns.length > 0;
|
|
169
170
|
|
|
170
|
-
const blocksUI = !! filteredBlockTypes.length && (
|
|
171
|
+
const blocksUI = showBlocks && !! filteredBlockTypes.length && (
|
|
171
172
|
<InserterPanel
|
|
172
173
|
title={ <VisuallyHidden>{ __( 'Blocks' ) }</VisuallyHidden> }
|
|
173
174
|
>
|