@wordpress/block-editor 14.5.0 → 14.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/README.md +0 -8
- package/build/autocompleters/block.js +13 -5
- package/build/autocompleters/block.js.map +1 -1
- package/build/components/block-canvas/index.js +10 -0
- package/build/components/block-canvas/index.js.map +1 -1
- package/build/components/block-card/index.js +2 -2
- package/build/components/block-card/index.js.map +1 -1
- package/build/components/block-full-height-alignment-control/index.js +1 -1
- package/build/components/block-full-height-alignment-control/index.js.map +1 -1
- package/build/components/block-list/block.js +1 -1
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/block.native.js +1 -7
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-list/index.js +5 -5
- package/build/components/block-list/index.js.map +1 -1
- package/build/components/block-list/use-block-props/index.js +1 -2
- package/build/components/block-list/use-block-props/index.js.map +1 -1
- package/build/components/block-list/use-block-props/use-focus-first-element.js +4 -3
- package/build/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
- package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js +3 -6
- package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
- package/build/components/block-list/use-in-between-inserter.js +1 -1
- package/build/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build/components/block-patterns-paging/index.js +1 -1
- package/build/components/block-patterns-paging/index.js.map +1 -1
- package/build/components/block-popover/index.js +2 -45
- package/build/components/block-popover/index.js.map +1 -1
- package/build/components/block-preview/index.js +2 -2
- package/build/components/block-preview/index.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +5 -0
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-settings-menu/index.js +4 -3
- package/build/components/block-settings-menu/index.js.map +1 -1
- package/build/components/block-toolbar/change-design.js +122 -0
- package/build/components/block-toolbar/change-design.js.map +1 -0
- package/build/components/block-toolbar/index.js +19 -7
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-tools/index.js +4 -10
- package/build/components/block-tools/index.js.map +1 -1
- package/build/components/block-tools/insertion-point.js +4 -3
- package/build/components/block-tools/insertion-point.js.map +1 -1
- package/build/components/block-tools/use-show-block-tools.js +3 -9
- package/build/components/block-tools/use-show-block-tools.js.map +1 -1
- package/build/components/block-tools/zoom-out-mode-inserters.js +20 -29
- package/build/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
- package/build/components/block-variation-transforms/index.js +2 -2
- package/build/components/block-variation-transforms/index.js.map +1 -1
- package/build/components/block-vertical-alignment-control/ui.js +6 -10
- package/build/components/block-vertical-alignment-control/ui.js.map +1 -1
- package/build/components/border-radius-control/linked-button.js +7 -10
- package/build/components/border-radius-control/linked-button.js.map +1 -1
- package/build/components/collab/block-comment-icon-slot.js +18 -0
- package/build/components/collab/block-comment-icon-slot.js.map +1 -0
- package/build/components/collab/block-comment-icon-toolbar-slot.js +18 -0
- package/build/components/collab/block-comment-icon-toolbar-slot.js.map +1 -0
- package/build/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +7 -1
- package/build/components/colors-gradients/use-multiple-origin-colors-and-gradients.js.map +1 -1
- package/build/components/convert-to-group-buttons/toolbar.js +4 -4
- package/build/components/convert-to-group-buttons/toolbar.js.map +1 -1
- package/build/components/global-styles/color-panel.js +1 -4
- package/build/components/global-styles/color-panel.js.map +1 -1
- package/build/components/global-styles/use-global-styles-context.native.js +6 -0
- package/build/components/global-styles/use-global-styles-context.native.js.map +1 -1
- package/build/components/iframe/index.js +17 -22
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/image-size-control/index.js +61 -20
- package/build/components/image-size-control/index.js.map +1 -1
- package/build/components/inner-blocks/index.js +9 -5
- package/build/components/inner-blocks/index.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/pattern-category-previews.js +2 -2
- package/build/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/patterns-filter.js +1 -1
- package/build/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
- package/build/components/inserter/category-tabs/index.js +15 -2
- package/build/components/inserter/category-tabs/index.js.map +1 -1
- package/build/components/inserter/menu.js +4 -2
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter-button/index.native.js +1 -1
- package/build/components/inserter-button/index.native.js.map +1 -1
- package/build/components/inspector-controls-tabs/index.js +0 -2
- package/build/components/inspector-controls-tabs/index.js.map +1 -1
- package/build/components/inspector-controls-tabs/utils.js +3 -6
- package/build/components/inspector-controls-tabs/utils.js.map +1 -1
- package/build/components/link-control/link-preview.js +12 -9
- package/build/components/link-control/link-preview.js.map +1 -1
- package/build/components/list-view/appender.js +4 -3
- package/build/components/list-view/appender.js.map +1 -1
- package/build/components/list-view/branch.js +6 -5
- package/build/components/list-view/branch.js.map +1 -1
- package/build/components/list-view/index.js +1 -2
- package/build/components/list-view/index.js.map +1 -1
- package/build/components/provider/index.js +1 -1
- package/build/components/provider/index.js.map +1 -1
- package/build/components/rich-text/event-listeners/index.js +3 -1
- package/build/components/rich-text/event-listeners/index.js.map +1 -1
- package/build/components/rich-text/index.native.js +2 -6
- package/build/components/rich-text/index.native.js.map +1 -1
- package/build/components/spacing-sizes-control/index.js +2 -2
- package/build/components/spacing-sizes-control/index.js.map +1 -1
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js +3 -3
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build/components/spacing-sizes-control/linked-button.js +1 -5
- package/build/components/spacing-sizes-control/linked-button.js.map +1 -1
- package/build/components/tool-selector/index.js +1 -4
- package/build/components/tool-selector/index.js.map +1 -1
- package/build/components/url-input/index.js +1 -1
- package/build/components/url-input/index.js.map +1 -1
- package/build/components/use-block-commands/index.js +1 -1
- package/build/components/use-block-commands/index.js.map +1 -1
- package/build/components/use-block-drop-zone/index.js +5 -5
- package/build/components/use-block-drop-zone/index.js.map +1 -1
- package/build/components/use-block-drop-zone/index.native.js +0 -1
- package/build/components/use-block-drop-zone/index.native.js.map +1 -1
- package/build/components/use-moving-animation/index.js +1 -3
- package/build/components/use-moving-animation/index.js.map +1 -1
- package/build/components/use-settings/index.js +1 -3
- package/build/components/use-settings/index.js.map +1 -1
- package/build/components/writing-flow/index.js +5 -3
- package/build/components/writing-flow/index.js.map +1 -1
- package/build/components/writing-flow/use-tab-nav.js +2 -3
- package/build/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build/hooks/block-bindings.js +19 -8
- package/build/hooks/block-bindings.js.map +1 -1
- package/build/hooks/contrast-checker.js +0 -1
- package/build/hooks/contrast-checker.js.map +1 -1
- package/build/hooks/duotone.js +2 -2
- package/build/hooks/duotone.js.map +1 -1
- package/build/hooks/style.js +4 -1
- package/build/hooks/style.js.map +1 -1
- package/build/hooks/use-zoom-out.js +13 -22
- package/build/hooks/use-zoom-out.js.map +1 -1
- package/build/index.js +0 -7
- package/build/index.js.map +1 -1
- package/build/private-apis.js +6 -3
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +2 -33
- package/build/store/actions.js.map +1 -1
- package/build/store/defaults.js +1 -1
- package/build/store/defaults.js.map +1 -1
- package/build/store/private-actions.js +57 -8
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-selectors.js +9 -21
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +16 -6
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +44 -7
- package/build/store/selectors.js.map +1 -1
- package/build/utils/dom.js +16 -1
- package/build/utils/dom.js.map +1 -1
- package/build/utils/get-font-styles-and-weights.js +1 -1
- package/build/utils/get-font-styles-and-weights.js.map +1 -1
- package/build/utils/transform-styles/index.js +4 -3
- package/build/utils/transform-styles/index.js.map +1 -1
- package/build-module/autocompleters/block.js +14 -6
- package/build-module/autocompleters/block.js.map +1 -1
- package/build-module/components/block-canvas/index.js +11 -1
- package/build-module/components/block-canvas/index.js.map +1 -1
- package/build-module/components/block-card/index.js +3 -3
- package/build-module/components/block-card/index.js.map +1 -1
- package/build-module/components/block-full-height-alignment-control/index.js +1 -1
- package/build-module/components/block-full-height-alignment-control/index.js.map +1 -1
- package/build-module/components/block-list/block.js +1 -1
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/block.native.js +1 -7
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-list/index.js +5 -5
- package/build-module/components/block-list/index.js.map +1 -1
- package/build-module/components/block-list/use-block-props/index.js +1 -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-focus-first-element.js +4 -3
- package/build-module/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js +3 -6
- package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
- package/build-module/components/block-list/use-in-between-inserter.js +1 -1
- package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build-module/components/block-patterns-paging/index.js +1 -1
- package/build-module/components/block-patterns-paging/index.js.map +1 -1
- package/build-module/components/block-popover/index.js +2 -45
- package/build-module/components/block-popover/index.js.map +1 -1
- package/build-module/components/block-preview/index.js +2 -2
- package/build-module/components/block-preview/index.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +5 -0
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-settings-menu/index.js +5 -4
- package/build-module/components/block-settings-menu/index.js.map +1 -1
- package/build-module/components/block-toolbar/change-design.js +114 -0
- package/build-module/components/block-toolbar/change-design.js.map +1 -0
- package/build-module/components/block-toolbar/index.js +19 -7
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-tools/index.js +4 -10
- package/build-module/components/block-tools/index.js.map +1 -1
- package/build-module/components/block-tools/insertion-point.js +4 -3
- package/build-module/components/block-tools/insertion-point.js.map +1 -1
- package/build-module/components/block-tools/use-show-block-tools.js +3 -9
- package/build-module/components/block-tools/use-show-block-tools.js.map +1 -1
- package/build-module/components/block-tools/zoom-out-mode-inserters.js +20 -29
- package/build-module/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
- package/build-module/components/block-variation-transforms/index.js +2 -2
- package/build-module/components/block-variation-transforms/index.js.map +1 -1
- package/build-module/components/block-vertical-alignment-control/ui.js +6 -10
- package/build-module/components/block-vertical-alignment-control/ui.js.map +1 -1
- package/build-module/components/border-radius-control/linked-button.js +8 -11
- package/build-module/components/border-radius-control/linked-button.js.map +1 -1
- package/build-module/components/collab/block-comment-icon-slot.js +11 -0
- package/build-module/components/collab/block-comment-icon-slot.js.map +1 -0
- package/build-module/components/collab/block-comment-icon-toolbar-slot.js +11 -0
- package/build-module/components/collab/block-comment-icon-toolbar-slot.js.map +1 -0
- package/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +7 -1
- package/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js.map +1 -1
- package/build-module/components/convert-to-group-buttons/toolbar.js +4 -4
- package/build-module/components/convert-to-group-buttons/toolbar.js.map +1 -1
- package/build-module/components/global-styles/color-panel.js +2 -5
- package/build-module/components/global-styles/color-panel.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-context.native.js +6 -0
- package/build-module/components/global-styles/use-global-styles-context.native.js.map +1 -1
- package/build-module/components/iframe/index.js +17 -22
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/image-size-control/index.js +62 -21
- package/build-module/components/image-size-control/index.js.map +1 -1
- package/build-module/components/inner-blocks/index.js +9 -5
- package/build-module/components/inner-blocks/index.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js +2 -2
- package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/patterns-filter.js +1 -1
- package/build-module/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
- package/build-module/components/inserter/category-tabs/index.js +15 -2
- package/build-module/components/inserter/category-tabs/index.js.map +1 -1
- package/build-module/components/inserter/menu.js +5 -3
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter-button/index.native.js +1 -1
- package/build-module/components/inserter-button/index.native.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/index.js +0 -2
- package/build-module/components/inspector-controls-tabs/index.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/utils.js +3 -6
- package/build-module/components/inspector-controls-tabs/utils.js.map +1 -1
- package/build-module/components/link-control/link-preview.js +13 -10
- package/build-module/components/link-control/link-preview.js.map +1 -1
- package/build-module/components/list-view/appender.js +4 -3
- package/build-module/components/list-view/appender.js.map +1 -1
- package/build-module/components/list-view/branch.js +7 -6
- package/build-module/components/list-view/branch.js.map +1 -1
- package/build-module/components/list-view/index.js +1 -2
- package/build-module/components/list-view/index.js.map +1 -1
- package/build-module/components/provider/index.js +1 -1
- package/build-module/components/provider/index.js.map +1 -1
- package/build-module/components/rich-text/event-listeners/index.js +4 -2
- package/build-module/components/rich-text/event-listeners/index.js.map +1 -1
- package/build-module/components/rich-text/index.native.js +2 -6
- package/build-module/components/rich-text/index.native.js.map +1 -1
- package/build-module/components/spacing-sizes-control/index.js +3 -3
- package/build-module/components/spacing-sizes-control/index.js.map +1 -1
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js +4 -4
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build-module/components/spacing-sizes-control/linked-button.js +2 -6
- package/build-module/components/spacing-sizes-control/linked-button.js.map +1 -1
- package/build-module/components/tool-selector/index.js +1 -4
- package/build-module/components/tool-selector/index.js.map +1 -1
- package/build-module/components/url-input/index.js +1 -1
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/components/use-block-commands/index.js +1 -1
- package/build-module/components/use-block-commands/index.js.map +1 -1
- package/build-module/components/use-block-drop-zone/index.js +5 -5
- package/build-module/components/use-block-drop-zone/index.js.map +1 -1
- package/build-module/components/use-block-drop-zone/index.native.js +0 -1
- package/build-module/components/use-block-drop-zone/index.native.js.map +1 -1
- package/build-module/components/use-moving-animation/index.js +1 -3
- package/build-module/components/use-moving-animation/index.js.map +1 -1
- package/build-module/components/use-settings/index.js +1 -3
- package/build-module/components/use-settings/index.js.map +1 -1
- package/build-module/components/writing-flow/index.js +5 -3
- package/build-module/components/writing-flow/index.js.map +1 -1
- package/build-module/components/writing-flow/use-tab-nav.js +2 -3
- package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build-module/hooks/block-bindings.js +20 -9
- package/build-module/hooks/block-bindings.js.map +1 -1
- package/build-module/hooks/contrast-checker.js +0 -1
- package/build-module/hooks/contrast-checker.js.map +1 -1
- package/build-module/hooks/duotone.js +2 -2
- package/build-module/hooks/duotone.js.map +1 -1
- package/build-module/hooks/style.js +4 -1
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/hooks/use-zoom-out.js +15 -23
- package/build-module/hooks/use-zoom-out.js.map +1 -1
- package/build-module/index.js +1 -1
- package/build-module/index.js.map +1 -1
- package/build-module/private-apis.js +7 -5
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/actions.js +2 -33
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/defaults.js +1 -1
- package/build-module/store/defaults.js.map +1 -1
- package/build-module/store/private-actions.js +54 -7
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-selectors.js +9 -20
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +16 -6
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +45 -8
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/dom.js +16 -1
- package/build-module/utils/dom.js.map +1 -1
- package/build-module/utils/get-font-styles-and-weights.js +2 -2
- package/build-module/utils/get-font-styles-and-weights.js.map +1 -1
- package/build-module/utils/transform-styles/index.js +3 -2
- package/build-module/utils/transform-styles/index.js.map +1 -1
- package/build-style/content-rtl.css +9 -4
- package/build-style/content.css +9 -4
- package/build-style/style-rtl.css +33 -22
- package/build-style/style.css +33 -22
- package/build-types/utils/dom.d.ts.map +1 -1
- package/package.json +33 -32
- package/src/autocompleters/block.js +16 -7
- package/src/components/block-canvas/index.js +17 -1
- package/src/components/block-canvas/style.scss +2 -0
- package/src/components/block-card/index.js +3 -3
- package/src/components/block-full-height-alignment-control/index.js +1 -1
- package/src/components/block-inspector/style.scss +0 -6
- package/src/components/block-list/block.js +1 -2
- package/src/components/block-list/block.native.js +0 -4
- package/src/components/block-list/content.scss +1 -1
- package/src/components/block-list/index.js +4 -4
- package/src/components/block-list/use-block-props/index.js +0 -2
- package/src/components/block-list/use-block-props/use-focus-first-element.js +5 -3
- package/src/components/block-list/use-block-props/use-selected-block-event-handlers.js +7 -20
- package/src/components/block-list/use-in-between-inserter.js +1 -1
- package/src/components/block-patterns-list/stories/fixtures.js +834 -0
- package/src/components/block-patterns-list/stories/index.story.js +81 -0
- package/src/components/block-patterns-list/style.scss +2 -0
- package/src/components/block-patterns-paging/index.js +1 -1
- package/src/components/block-popover/index.js +0 -62
- package/src/components/block-preview/index.js +2 -2
- package/src/components/block-settings-menu/block-settings-dropdown.js +4 -0
- package/src/components/block-settings-menu/index.js +3 -0
- package/src/components/block-toolbar/change-design.js +133 -0
- package/src/components/block-toolbar/index.js +25 -8
- package/src/components/block-toolbar/style.scss +16 -0
- package/src/components/block-tools/index.js +4 -17
- package/src/components/block-tools/insertion-point.js +4 -3
- package/src/components/block-tools/style.scss +0 -20
- package/src/components/block-tools/use-show-block-tools.js +0 -13
- package/src/components/block-tools/zoom-out-mode-inserters.js +25 -40
- package/src/components/block-variation-transforms/index.js +2 -2
- package/src/components/block-vertical-alignment-control/ui.js +11 -15
- package/src/components/border-radius-control/linked-button.js +9 -11
- package/src/components/collab/block-comment-icon-slot.js +12 -0
- package/src/components/collab/block-comment-icon-toolbar-slot.js +12 -0
- package/src/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +7 -1
- package/src/components/convert-to-group-buttons/toolbar.js +4 -4
- package/src/components/global-styles/color-panel.js +2 -10
- package/src/components/global-styles/test/use-global-styles-context.native.js +1 -0
- package/src/components/global-styles/use-global-styles-context.native.js +6 -0
- package/src/components/iframe/content.scss +4 -9
- package/src/components/iframe/index.js +31 -34
- package/src/components/iframe/style.scss +2 -3
- package/src/components/image-size-control/index.js +74 -43
- package/src/components/image-size-control/test/index.js +5 -63
- package/src/components/inner-blocks/index.js +12 -6
- package/src/components/inserter/block-patterns-tab/pattern-category-previews.js +2 -3
- package/src/components/inserter/block-patterns-tab/patterns-filter.js +1 -1
- package/src/components/inserter/category-tabs/index.js +16 -2
- package/src/components/inserter/menu.js +6 -4
- package/src/components/inserter/style.scss +13 -0
- package/src/components/inserter-button/index.native.js +1 -1
- package/src/components/inspector-controls-tabs/index.js +1 -6
- package/src/components/inspector-controls-tabs/utils.js +0 -3
- package/src/components/link-control/link-preview.js +15 -8
- package/src/components/link-control/test/index.js +63 -24
- package/src/components/list-view/appender.js +5 -6
- package/src/components/list-view/branch.js +8 -6
- package/src/components/list-view/index.js +1 -2
- package/src/components/provider/index.js +1 -3
- package/src/components/provider/test/experimental-provider.js +43 -1
- package/src/components/rich-text/event-listeners/index.js +4 -2
- package/src/components/rich-text/index.native.js +0 -2
- package/src/components/spacing-sizes-control/index.js +3 -3
- package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +4 -4
- package/src/components/spacing-sizes-control/linked-button.js +2 -12
- package/src/components/tool-selector/index.js +1 -5
- package/src/components/url-input/index.js +1 -1
- package/src/components/use-block-commands/index.js +1 -1
- package/src/components/use-block-drop-zone/index.js +5 -5
- package/src/components/use-block-drop-zone/index.native.js +0 -1
- package/src/components/use-moving-animation/index.js +0 -1
- package/src/components/use-settings/index.js +0 -1
- package/src/components/writing-flow/index.js +5 -3
- package/src/components/writing-flow/use-tab-nav.js +1 -2
- package/src/hooks/block-bindings.js +48 -31
- package/src/hooks/contrast-checker.js +0 -1
- package/src/hooks/duotone.js +2 -2
- package/src/hooks/style.js +7 -3
- package/src/hooks/use-zoom-out.js +14 -34
- package/src/index.js +0 -1
- package/src/private-apis.js +6 -3
- package/src/store/actions.js +3 -52
- package/src/store/defaults.js +2 -1
- package/src/store/private-actions.js +71 -8
- package/src/store/private-selectors.js +9 -19
- package/src/store/reducer.js +25 -11
- package/src/store/selectors.js +59 -8
- package/src/store/test/actions.js +41 -0
- package/src/store/test/reducer.js +23 -0
- package/src/utils/dom.js +22 -2
- package/src/utils/get-font-styles-and-weights.js +2 -2
- package/src/utils/transform-styles/index.js +3 -2
- package/tsconfig.tsbuildinfo +1 -1
- package/build/components/block-list/use-block-props/use-zoom-out-mode-exit.js +0 -57
- package/build/components/block-list/use-block-props/use-zoom-out-mode-exit.js.map +0 -1
- package/build/components/block-toolbar/shuffle.js +0 -110
- package/build/components/block-toolbar/shuffle.js.map +0 -1
- package/build/components/block-tools/zoom-out-popover.js +0 -58
- package/build/components/block-tools/zoom-out-popover.js.map +0 -1
- package/build/components/block-tools/zoom-out-toolbar.js +0 -132
- package/build/components/block-tools/zoom-out-toolbar.js.map +0 -1
- package/build/components/block-vertical-alignment-control/icons.js +0 -48
- package/build/components/block-vertical-alignment-control/icons.js.map +0 -1
- package/build-module/components/block-list/use-block-props/use-zoom-out-mode-exit.js +0 -51
- package/build-module/components/block-list/use-block-props/use-zoom-out-mode-exit.js.map +0 -1
- package/build-module/components/block-toolbar/shuffle.js +0 -103
- package/build-module/components/block-toolbar/shuffle.js.map +0 -1
- package/build-module/components/block-tools/zoom-out-popover.js +0 -49
- package/build-module/components/block-tools/zoom-out-popover.js.map +0 -1
- package/build-module/components/block-tools/zoom-out-toolbar.js +0 -124
- package/build-module/components/block-tools/zoom-out-toolbar.js.map +0 -1
- package/build-module/components/block-vertical-alignment-control/icons.js +0 -41
- package/build-module/components/block-vertical-alignment-control/icons.js.map +0 -1
- package/src/components/block-list/use-block-props/use-zoom-out-mode-exit.js +0 -65
- package/src/components/block-toolbar/shuffle.js +0 -111
- package/src/components/block-tools/zoom-out-popover.js +0 -47
- package/src/components/block-tools/zoom-out-toolbar.js +0 -135
- package/src/components/block-vertical-alignment-control/icons.js +0 -34
|
@@ -16,30 +16,24 @@ function ZoomOutModeInserters() {
|
|
|
16
16
|
const [ isReady, setIsReady ] = useState( false );
|
|
17
17
|
const {
|
|
18
18
|
hasSelection,
|
|
19
|
-
insertionPoint,
|
|
20
19
|
blockOrder,
|
|
21
|
-
blockInsertionPointVisible,
|
|
22
20
|
setInserterIsOpened,
|
|
23
21
|
sectionRootClientId,
|
|
24
22
|
selectedBlockClientId,
|
|
25
23
|
} = useSelect( ( select ) => {
|
|
26
24
|
const {
|
|
27
25
|
getSettings,
|
|
28
|
-
getInsertionPoint,
|
|
29
26
|
getBlockOrder,
|
|
30
27
|
getSelectionStart,
|
|
31
28
|
getSelectedBlockClientId,
|
|
32
29
|
getSectionRootClientId,
|
|
33
|
-
isBlockInsertionPointVisible,
|
|
34
30
|
} = unlock( select( blockEditorStore ) );
|
|
35
31
|
|
|
36
32
|
const root = getSectionRootClientId();
|
|
37
33
|
|
|
38
34
|
return {
|
|
39
35
|
hasSelection: !! getSelectionStart().clientId,
|
|
40
|
-
insertionPoint: getInsertionPoint(),
|
|
41
36
|
blockOrder: getBlockOrder( root ),
|
|
42
|
-
blockInsertionPointVisible: isBlockInsertionPointVisible(),
|
|
43
37
|
sectionRootClientId: root,
|
|
44
38
|
setInserterIsOpened:
|
|
45
39
|
getSettings().__experimentalSetIsInserterOpened,
|
|
@@ -64,41 +58,32 @@ function ZoomOutModeInserters() {
|
|
|
64
58
|
return null;
|
|
65
59
|
}
|
|
66
60
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
61
|
+
const previousClientId = selectedBlockClientId;
|
|
62
|
+
const index = blockOrder.findIndex(
|
|
63
|
+
( clientId ) => selectedBlockClientId === clientId
|
|
64
|
+
);
|
|
65
|
+
const nextClientId = blockOrder[ index + 1 ];
|
|
70
66
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
category: 'all',
|
|
92
|
-
} );
|
|
93
|
-
showInsertionPoint( sectionRootClientId, index, {
|
|
94
|
-
operation: 'insert',
|
|
95
|
-
} );
|
|
96
|
-
} }
|
|
97
|
-
/>
|
|
98
|
-
) }
|
|
99
|
-
</BlockPopoverInbetween>
|
|
100
|
-
);
|
|
101
|
-
} );
|
|
67
|
+
return (
|
|
68
|
+
<BlockPopoverInbetween
|
|
69
|
+
previousClientId={ previousClientId }
|
|
70
|
+
nextClientId={ nextClientId }
|
|
71
|
+
>
|
|
72
|
+
<ZoomOutModeInserterButton
|
|
73
|
+
onClick={ () => {
|
|
74
|
+
setInserterIsOpened( {
|
|
75
|
+
rootClientId: sectionRootClientId,
|
|
76
|
+
insertionIndex: index + 1,
|
|
77
|
+
tab: 'patterns',
|
|
78
|
+
category: 'all',
|
|
79
|
+
} );
|
|
80
|
+
showInsertionPoint( sectionRootClientId, index + 1, {
|
|
81
|
+
operation: 'insert',
|
|
82
|
+
} );
|
|
83
|
+
} }
|
|
84
|
+
/>
|
|
85
|
+
</BlockPopoverInbetween>
|
|
86
|
+
);
|
|
102
87
|
}
|
|
103
88
|
|
|
104
89
|
export default ZoomOutModeInserters;
|
|
@@ -45,7 +45,7 @@ function VariationsButtons( {
|
|
|
45
45
|
selectedValue === variation.name
|
|
46
46
|
? variation.title
|
|
47
47
|
: sprintf(
|
|
48
|
-
/* translators: %s:
|
|
48
|
+
/* translators: %s: Block or block variation name. */
|
|
49
49
|
__( 'Transform to %s' ),
|
|
50
50
|
variation.title
|
|
51
51
|
)
|
|
@@ -127,7 +127,7 @@ function VariationsToggleGroupControl( {
|
|
|
127
127
|
selectedValue === variation.name
|
|
128
128
|
? variation.title
|
|
129
129
|
: sprintf(
|
|
130
|
-
/* translators: %s:
|
|
130
|
+
/* translators: %s: Block or block variation name. */
|
|
131
131
|
__( 'Transform to %s' ),
|
|
132
132
|
variation.title
|
|
133
133
|
)
|
|
@@ -3,37 +3,33 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { _x } from '@wordpress/i18n';
|
|
5
5
|
import { ToolbarGroup, ToolbarDropdownMenu } from '@wordpress/components';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Internal dependencies
|
|
9
|
-
*/
|
|
10
6
|
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
} from '
|
|
7
|
+
justifyTop,
|
|
8
|
+
justifyCenterVertical,
|
|
9
|
+
justifyBottom,
|
|
10
|
+
justifyStretchVertical,
|
|
11
|
+
justifySpaceBetweenVertical,
|
|
12
|
+
} from '@wordpress/icons';
|
|
17
13
|
|
|
18
14
|
const BLOCK_ALIGNMENTS_CONTROLS = {
|
|
19
15
|
top: {
|
|
20
|
-
icon:
|
|
16
|
+
icon: justifyTop,
|
|
21
17
|
title: _x( 'Align top', 'Block vertical alignment setting' ),
|
|
22
18
|
},
|
|
23
19
|
center: {
|
|
24
|
-
icon:
|
|
20
|
+
icon: justifyCenterVertical,
|
|
25
21
|
title: _x( 'Align middle', 'Block vertical alignment setting' ),
|
|
26
22
|
},
|
|
27
23
|
bottom: {
|
|
28
|
-
icon:
|
|
24
|
+
icon: justifyBottom,
|
|
29
25
|
title: _x( 'Align bottom', 'Block vertical alignment setting' ),
|
|
30
26
|
},
|
|
31
27
|
stretch: {
|
|
32
|
-
icon:
|
|
28
|
+
icon: justifyStretchVertical,
|
|
33
29
|
title: _x( 'Stretch to fill', 'Block vertical alignment setting' ),
|
|
34
30
|
},
|
|
35
31
|
'space-between': {
|
|
36
|
-
icon:
|
|
32
|
+
icon: justifySpaceBetweenVertical,
|
|
37
33
|
title: _x( 'Space between', 'Block vertical alignment setting' ),
|
|
38
34
|
},
|
|
39
35
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { Button
|
|
4
|
+
import { Button } from '@wordpress/components';
|
|
5
5
|
import { link, linkOff } from '@wordpress/icons';
|
|
6
6
|
import { __ } from '@wordpress/i18n';
|
|
7
7
|
|
|
@@ -9,15 +9,13 @@ export default function LinkedButton( { isLinked, ...props } ) {
|
|
|
9
9
|
const label = isLinked ? __( 'Unlink radii' ) : __( 'Link radii' );
|
|
10
10
|
|
|
11
11
|
return (
|
|
12
|
-
<
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
/>
|
|
21
|
-
</Tooltip>
|
|
12
|
+
<Button
|
|
13
|
+
{ ...props }
|
|
14
|
+
className="component-border-radius-control__linked-button"
|
|
15
|
+
size="small"
|
|
16
|
+
icon={ isLinked ? link : linkOff }
|
|
17
|
+
iconSize={ 24 }
|
|
18
|
+
label={ label }
|
|
19
|
+
/>
|
|
22
20
|
);
|
|
23
21
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { createSlotFill } from '@wordpress/components';
|
|
5
|
+
|
|
6
|
+
const { Fill: __unstableCommentIconFill, Slot } = createSlotFill(
|
|
7
|
+
'__unstableCommentIconFill'
|
|
8
|
+
);
|
|
9
|
+
|
|
10
|
+
__unstableCommentIconFill.Slot = Slot;
|
|
11
|
+
|
|
12
|
+
export default __unstableCommentIconFill;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { createSlotFill } from '@wordpress/components';
|
|
5
|
+
|
|
6
|
+
const { Fill: __unstableCommentIconToolbarFill, Slot } = createSlotFill(
|
|
7
|
+
'__unstableCommentIconToolbarFill'
|
|
8
|
+
);
|
|
9
|
+
|
|
10
|
+
__unstableCommentIconToolbarFill.Slot = Slot;
|
|
11
|
+
|
|
12
|
+
export default __unstableCommentIconToolbarFill;
|
|
@@ -55,6 +55,7 @@ export default function useMultipleOriginColorsAndGradients() {
|
|
|
55
55
|
'Theme',
|
|
56
56
|
'Indicates this palette comes from the theme.'
|
|
57
57
|
),
|
|
58
|
+
slug: 'theme',
|
|
58
59
|
colors: themeColors,
|
|
59
60
|
} );
|
|
60
61
|
}
|
|
@@ -68,6 +69,7 @@ export default function useMultipleOriginColorsAndGradients() {
|
|
|
68
69
|
'Default',
|
|
69
70
|
'Indicates this palette comes from WordPress.'
|
|
70
71
|
),
|
|
72
|
+
slug: 'default',
|
|
71
73
|
colors: defaultColors,
|
|
72
74
|
} );
|
|
73
75
|
}
|
|
@@ -75,8 +77,9 @@ export default function useMultipleOriginColorsAndGradients() {
|
|
|
75
77
|
result.push( {
|
|
76
78
|
name: _x(
|
|
77
79
|
'Custom',
|
|
78
|
-
'Indicates this palette
|
|
80
|
+
'Indicates this palette is created by the user.'
|
|
79
81
|
),
|
|
82
|
+
slug: 'custom',
|
|
80
83
|
colors: customColors,
|
|
81
84
|
} );
|
|
82
85
|
}
|
|
@@ -96,6 +99,7 @@ export default function useMultipleOriginColorsAndGradients() {
|
|
|
96
99
|
'Theme',
|
|
97
100
|
'Indicates this palette comes from the theme.'
|
|
98
101
|
),
|
|
102
|
+
slug: 'theme',
|
|
99
103
|
gradients: themeGradients,
|
|
100
104
|
} );
|
|
101
105
|
}
|
|
@@ -109,6 +113,7 @@ export default function useMultipleOriginColorsAndGradients() {
|
|
|
109
113
|
'Default',
|
|
110
114
|
'Indicates this palette comes from WordPress.'
|
|
111
115
|
),
|
|
116
|
+
slug: 'default',
|
|
112
117
|
gradients: defaultGradients,
|
|
113
118
|
} );
|
|
114
119
|
}
|
|
@@ -118,6 +123,7 @@ export default function useMultipleOriginColorsAndGradients() {
|
|
|
118
123
|
'Custom',
|
|
119
124
|
'Indicates this palette is created by the user.'
|
|
120
125
|
),
|
|
126
|
+
slug: 'custom',
|
|
121
127
|
gradients: customGradients,
|
|
122
128
|
} );
|
|
123
129
|
}
|
|
@@ -85,27 +85,27 @@ function BlockGroupToolbar() {
|
|
|
85
85
|
<ToolbarGroup>
|
|
86
86
|
<ToolbarButton
|
|
87
87
|
icon={ group }
|
|
88
|
-
label={ _x( 'Group', '
|
|
88
|
+
label={ _x( 'Group', 'action: convert blocks to group' ) }
|
|
89
89
|
onClick={ onConvertToGroup }
|
|
90
90
|
/>
|
|
91
91
|
{ canInsertRow && (
|
|
92
92
|
<ToolbarButton
|
|
93
93
|
icon={ row }
|
|
94
|
-
label={ _x( 'Row', '
|
|
94
|
+
label={ _x( 'Row', 'action: convert blocks to row' ) }
|
|
95
95
|
onClick={ onConvertToRow }
|
|
96
96
|
/>
|
|
97
97
|
) }
|
|
98
98
|
{ canInsertStack && (
|
|
99
99
|
<ToolbarButton
|
|
100
100
|
icon={ stack }
|
|
101
|
-
label={ _x( 'Stack', '
|
|
101
|
+
label={ _x( 'Stack', 'action: convert blocks to stack' ) }
|
|
102
102
|
onClick={ onConvertToStack }
|
|
103
103
|
/>
|
|
104
104
|
) }
|
|
105
105
|
{ canInsertGrid && (
|
|
106
106
|
<ToolbarButton
|
|
107
107
|
icon={ grid }
|
|
108
|
-
label={ _x( 'Grid', '
|
|
108
|
+
label={ _x( 'Grid', 'action: convert blocks to grid' ) }
|
|
109
109
|
onClick={ onConvertToGrid }
|
|
110
110
|
/>
|
|
111
111
|
) }
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
privateApis as componentsPrivateApis,
|
|
21
21
|
} from '@wordpress/components';
|
|
22
22
|
import { useCallback } from '@wordpress/element';
|
|
23
|
-
import { __
|
|
23
|
+
import { __ } from '@wordpress/i18n';
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
26
|
* Internal dependencies
|
|
@@ -167,10 +167,7 @@ const LabeledColorIndicators = ( { indicators, label } ) => (
|
|
|
167
167
|
</Flex>
|
|
168
168
|
) ) }
|
|
169
169
|
</ZStack>
|
|
170
|
-
<FlexItem
|
|
171
|
-
className="block-editor-panel-color-gradient-settings__color-name"
|
|
172
|
-
title={ label }
|
|
173
|
-
>
|
|
170
|
+
<FlexItem className="block-editor-panel-color-gradient-settings__color-name">
|
|
174
171
|
{ label }
|
|
175
172
|
</FlexItem>
|
|
176
173
|
</HStack>
|
|
@@ -231,11 +228,6 @@ function ColorPanelDropdown( {
|
|
|
231
228
|
{ 'is-open': isOpen }
|
|
232
229
|
),
|
|
233
230
|
'aria-expanded': isOpen,
|
|
234
|
-
'aria-label': sprintf(
|
|
235
|
-
/* translators: %s is the type of color property, e.g., "background" */
|
|
236
|
-
__( 'Color %s styles' ),
|
|
237
|
-
label
|
|
238
|
-
),
|
|
239
231
|
};
|
|
240
232
|
|
|
241
233
|
return (
|
|
@@ -410,6 +410,9 @@ export function getColorsAndGradients(
|
|
|
410
410
|
return {
|
|
411
411
|
__experimentalGlobalStylesBaseStyles: null,
|
|
412
412
|
__experimentalFeatures: {
|
|
413
|
+
// Set an empty object to avoid errors from shared web components relying
|
|
414
|
+
// upon block settings. E.g., the Gallery block.
|
|
415
|
+
blocks: {},
|
|
413
416
|
color: {
|
|
414
417
|
...( ! features?.color
|
|
415
418
|
? {
|
|
@@ -455,6 +458,9 @@ export function getGlobalStyles( rawStyles, rawFeatures ) {
|
|
|
455
458
|
|
|
456
459
|
return {
|
|
457
460
|
__experimentalFeatures: {
|
|
461
|
+
// Set an empty object to avoid errors from shared web components relying
|
|
462
|
+
// upon block settings. E.g., the Gallery block.
|
|
463
|
+
blocks: {},
|
|
458
464
|
color: {
|
|
459
465
|
palette: colors?.palette,
|
|
460
466
|
gradients,
|
|
@@ -1,24 +1,19 @@
|
|
|
1
1
|
.block-editor-iframe__body {
|
|
2
2
|
position: relative;
|
|
3
|
-
border: 0.01px solid transparent;
|
|
4
3
|
}
|
|
5
4
|
|
|
6
5
|
.block-editor-iframe__html {
|
|
7
6
|
transform-origin: top center;
|
|
8
|
-
// 400ms should match the animation speed used in iframe/index.js
|
|
9
|
-
$zoomOutAnimation: all 400ms cubic-bezier(0.46, 0.03, 0.52, 0.96);
|
|
10
|
-
|
|
11
7
|
// We don't want to animate the transform of the translateX because it is used
|
|
12
8
|
// to "center" the canvas. Leaving it on causes the canvas to slide around in
|
|
13
9
|
// odd ways.
|
|
14
|
-
|
|
15
|
-
@include reduce-motion("transition");
|
|
10
|
+
@include editor-canvas-resize-animation(transform 0s, scale 0s, padding 0s);
|
|
16
11
|
|
|
17
12
|
&.zoom-out-animation {
|
|
18
13
|
// we only want to animate the scaling when entering zoom out. When sidebars
|
|
19
14
|
// are toggled, the resizing of the iframe handles scaling the canvas as well,
|
|
20
15
|
// and the doubled animations cause very odd animations.
|
|
21
|
-
|
|
16
|
+
@include editor-canvas-resize-animation(transform 0s);
|
|
22
17
|
}
|
|
23
18
|
}
|
|
24
19
|
|
|
@@ -27,10 +22,10 @@
|
|
|
27
22
|
$frame-size: var(--wp-block-editor-iframe-zoom-out-frame-size);
|
|
28
23
|
$inner-height: var(--wp-block-editor-iframe-zoom-out-inner-height);
|
|
29
24
|
$content-height: var(--wp-block-editor-iframe-zoom-out-content-height);
|
|
30
|
-
$
|
|
25
|
+
$scale-container-width: var(--wp-block-editor-iframe-zoom-out-scale-container-width);
|
|
31
26
|
$container-width: var(--wp-block-editor-iframe-zoom-out-container-width, 100vw);
|
|
32
27
|
// Apply an X translation to center the scaled content within the available space.
|
|
33
|
-
transform: translateX(calc((
|
|
28
|
+
transform: translateX(calc((#{$scale-container-width} - #{$container-width}) / 2 / #{$scale}));
|
|
34
29
|
scale: #{$scale};
|
|
35
30
|
background-color: $gray-300;
|
|
36
31
|
|
|
@@ -117,12 +117,12 @@ function Iframe( {
|
|
|
117
117
|
const settings = getSettings();
|
|
118
118
|
return {
|
|
119
119
|
resolvedAssets: settings.__unstableResolvedAssets,
|
|
120
|
-
isPreviewMode: settings.
|
|
120
|
+
isPreviewMode: settings.isPreviewMode,
|
|
121
121
|
};
|
|
122
122
|
}, [] );
|
|
123
123
|
const { styles = '', scripts = '' } = resolvedAssets;
|
|
124
124
|
const [ iframeDocument, setIframeDocument ] = useState();
|
|
125
|
-
const
|
|
125
|
+
const initialContainerWidthRef = useRef( 0 );
|
|
126
126
|
const [ bodyClasses, setBodyClasses ] = useState( [] );
|
|
127
127
|
const clearerRef = useBlockSelectionClearer();
|
|
128
128
|
const [ before, writingFlowRef, after ] = useWritingFlow();
|
|
@@ -243,10 +243,15 @@ function Iframe( {
|
|
|
243
243
|
|
|
244
244
|
useEffect( () => {
|
|
245
245
|
if ( ! isZoomedOut ) {
|
|
246
|
-
|
|
246
|
+
initialContainerWidthRef.current = containerWidth;
|
|
247
247
|
}
|
|
248
248
|
}, [ containerWidth, isZoomedOut ] );
|
|
249
249
|
|
|
250
|
+
const scaleContainerWidth = Math.max(
|
|
251
|
+
initialContainerWidthRef.current,
|
|
252
|
+
containerWidth
|
|
253
|
+
);
|
|
254
|
+
|
|
250
255
|
const disabledRef = useDisabled( { isDisabled: ! readonly } );
|
|
251
256
|
const bodyRef = useMergeRefs( [
|
|
252
257
|
useBubbleEvents( iframeDocument ),
|
|
@@ -299,17 +304,6 @@ function Iframe( {
|
|
|
299
304
|
useEffect( () => cleanup, [ cleanup ] );
|
|
300
305
|
|
|
301
306
|
const zoomOutAnimationClassnameRef = useRef( null );
|
|
302
|
-
const handleZoomOutAnimationClassname = () => {
|
|
303
|
-
clearTimeout( zoomOutAnimationClassnameRef.current );
|
|
304
|
-
|
|
305
|
-
iframeDocument.documentElement.classList.add( 'zoom-out-animation' );
|
|
306
|
-
|
|
307
|
-
zoomOutAnimationClassnameRef.current = setTimeout( () => {
|
|
308
|
-
iframeDocument.documentElement.classList.remove(
|
|
309
|
-
'zoom-out-animation'
|
|
310
|
-
);
|
|
311
|
-
}, 400 ); // 400ms should match the animation speed used in components/iframe/content.scss
|
|
312
|
-
};
|
|
313
307
|
|
|
314
308
|
// Toggle zoom out CSS Classes only when zoom out mode changes. We could add these into the useEffect
|
|
315
309
|
// that controls settings the CSS variables, but then we would need to do more work to ensure we're
|
|
@@ -320,6 +314,20 @@ function Iframe( {
|
|
|
320
314
|
return;
|
|
321
315
|
}
|
|
322
316
|
|
|
317
|
+
const handleZoomOutAnimationClassname = () => {
|
|
318
|
+
clearTimeout( zoomOutAnimationClassnameRef.current );
|
|
319
|
+
|
|
320
|
+
iframeDocument.documentElement.classList.add(
|
|
321
|
+
'zoom-out-animation'
|
|
322
|
+
);
|
|
323
|
+
|
|
324
|
+
zoomOutAnimationClassnameRef.current = setTimeout( () => {
|
|
325
|
+
iframeDocument.documentElement.classList.remove(
|
|
326
|
+
'zoom-out-animation'
|
|
327
|
+
);
|
|
328
|
+
}, 400 ); // 400ms should match the animation speed used in components/iframe/content.scss
|
|
329
|
+
};
|
|
330
|
+
|
|
323
331
|
handleZoomOutAnimationClassname();
|
|
324
332
|
iframeDocument.documentElement.classList.add( 'is-zoomed-out' );
|
|
325
333
|
|
|
@@ -337,7 +345,7 @@ function Iframe( {
|
|
|
337
345
|
|
|
338
346
|
const maxWidth = 750;
|
|
339
347
|
// Note: When we initialize the zoom out when the canvas is smaller (sidebars open),
|
|
340
|
-
//
|
|
348
|
+
// initialContainerWidthRef will be smaller than the full page, and reflow will happen
|
|
341
349
|
// when the canvas area becomes larger due to sidebars closing. This is a known but
|
|
342
350
|
// minor divergence for now.
|
|
343
351
|
|
|
@@ -346,13 +354,10 @@ function Iframe( {
|
|
|
346
354
|
// but calc( 100px / 2px ) is not.
|
|
347
355
|
iframeDocument.documentElement.style.setProperty(
|
|
348
356
|
'--wp-block-editor-iframe-zoom-out-scale',
|
|
349
|
-
scale === '
|
|
357
|
+
scale === 'auto-scaled'
|
|
350
358
|
? ( Math.min( containerWidth, maxWidth ) -
|
|
351
359
|
parseInt( frameSize ) * 2 ) /
|
|
352
|
-
|
|
353
|
-
initialContainerWidth.current,
|
|
354
|
-
containerWidth
|
|
355
|
-
)
|
|
360
|
+
scaleContainerWidth
|
|
356
361
|
: scale
|
|
357
362
|
);
|
|
358
363
|
|
|
@@ -374,15 +379,10 @@ function Iframe( {
|
|
|
374
379
|
`${ containerWidth }px`
|
|
375
380
|
);
|
|
376
381
|
iframeDocument.documentElement.style.setProperty(
|
|
377
|
-
'--wp-block-editor-iframe-zoom-out-
|
|
378
|
-
`${
|
|
382
|
+
'--wp-block-editor-iframe-zoom-out-scale-container-width',
|
|
383
|
+
`${ scaleContainerWidth }px`
|
|
379
384
|
);
|
|
380
385
|
|
|
381
|
-
// iframeDocument.documentElement.style.setProperty(
|
|
382
|
-
// '--wp-block-editor-iframe-zoom-out-outer-container-width',
|
|
383
|
-
// `${ Math.max( initialContainerWidth.current, containerWidth ) }px`
|
|
384
|
-
// );
|
|
385
|
-
|
|
386
386
|
return () => {
|
|
387
387
|
iframeDocument.documentElement.style.removeProperty(
|
|
388
388
|
'--wp-block-editor-iframe-zoom-out-scale'
|
|
@@ -400,7 +400,7 @@ function Iframe( {
|
|
|
400
400
|
'--wp-block-editor-iframe-zoom-out-container-width'
|
|
401
401
|
);
|
|
402
402
|
iframeDocument.documentElement.style.removeProperty(
|
|
403
|
-
'--wp-block-editor-iframe-zoom-out-
|
|
403
|
+
'--wp-block-editor-iframe-zoom-out-scale-container-width'
|
|
404
404
|
);
|
|
405
405
|
};
|
|
406
406
|
}, [
|
|
@@ -412,6 +412,7 @@ function Iframe( {
|
|
|
412
412
|
containerWidth,
|
|
413
413
|
windowInnerWidth,
|
|
414
414
|
isZoomedOut,
|
|
415
|
+
scaleContainerWidth,
|
|
415
416
|
] );
|
|
416
417
|
|
|
417
418
|
// Make sure to not render the before and after focusable div elements in view
|
|
@@ -501,12 +502,8 @@ function Iframe( {
|
|
|
501
502
|
isZoomedOut && 'is-zoomed-out'
|
|
502
503
|
) }
|
|
503
504
|
style={ {
|
|
504
|
-
'--wp-block-editor-iframe-zoom-out-
|
|
505
|
-
isZoomedOut &&
|
|
506
|
-
`${ Math.max(
|
|
507
|
-
initialContainerWidth.current,
|
|
508
|
-
containerWidth
|
|
509
|
-
) }px`,
|
|
505
|
+
'--wp-block-editor-iframe-zoom-out-scale-container-width':
|
|
506
|
+
isZoomedOut && `${ scaleContainerWidth }px`,
|
|
510
507
|
} }
|
|
511
508
|
>
|
|
512
509
|
{ iframe }
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
.block-editor-iframe__container {
|
|
2
2
|
width: 100%;
|
|
3
3
|
height: 100%;
|
|
4
|
-
overflow-x: hidden;
|
|
5
4
|
}
|
|
6
5
|
|
|
7
6
|
.block-editor-iframe__scale-container {
|
|
@@ -9,8 +8,8 @@
|
|
|
9
8
|
}
|
|
10
9
|
|
|
11
10
|
.block-editor-iframe__scale-container.is-zoomed-out {
|
|
12
|
-
$
|
|
13
|
-
width: $
|
|
11
|
+
$scale-container-width: var(--wp-block-editor-iframe-zoom-out-scale-container-width, 100vw);
|
|
12
|
+
width: $scale-container-width;
|
|
14
13
|
// Position the iframe so that it is always aligned with the right side so that
|
|
15
14
|
// the scrollbar is always visible on the right side
|
|
16
15
|
position: absolute;
|