@wordpress/block-editor 12.19.5 → 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 +4 -0
- package/build/components/block-canvas/index.js +2 -0
- package/build/components/block-canvas/index.js.map +1 -1
- package/build/components/block-heading-level-dropdown/index.js +14 -17
- package/build/components/block-heading-level-dropdown/index.js.map +1 -1
- package/build/components/block-inspector/index.js +0 -3
- 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/index.js +9 -9
- package/build/components/block-list/index.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-parent-selector-menu-item.js +54 -0
- package/build/components/block-settings-menu/block-parent-selector-menu-item.js.map +1 -0
- package/build/components/block-settings-menu/block-settings-dropdown.js +9 -37
- 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 +7 -5
- 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 +37 -5
- 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/date-format-picker/index.js +0 -1
- package/build/components/date-format-picker/index.js.map +1 -1
- package/build/components/font-appearance-control/index.js +1 -2
- package/build/components/font-appearance-control/index.js.map +1 -1
- 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/dimensions-panel.js +30 -19
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/image-settings-panel.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 +0 -4
- package/build/components/inspector-controls-tabs/styles-tab.js.map +1 -1
- package/build/components/link-control/search-input.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/observe-typing/index.js +5 -10
- package/build/components/observe-typing/index.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/format-toolbar-container.js +1 -31
- package/build/components/rich-text/format-toolbar-container.js.map +1 -1
- package/build/components/rich-text/index.js +1 -2
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/skip-to-selected-block/index.js +7 -14
- package/build/components/skip-to-selected-block/index.js.map +1 -1
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js +0 -1
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build/components/url-input/index.js +5 -8
- package/build/components/url-input/index.js.map +1 -1
- package/build/hooks/background.js.map +1 -1
- package/build/hooks/block-hooks.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 +89 -1
- 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/position.js +0 -1
- package/build/hooks/position.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-typography-props.js +1 -2
- package/build/hooks/use-typography-props.js.map +1 -1
- package/build/layouts/grid.js +111 -14
- package/build/layouts/grid.js.map +1 -1
- package/build/private-apis.js +2 -2
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +4 -36
- package/build/store/actions.js.map +1 -1
- package/build/store/private-actions.js +29 -45
- package/build/store/private-actions.js.map +1 -1
- package/build/store/reducer.js +2 -4
- 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-canvas/index.js +2 -0
- package/build-module/components/block-canvas/index.js.map +1 -1
- package/build-module/components/block-heading-level-dropdown/index.js +14 -17
- package/build-module/components/block-heading-level-dropdown/index.js.map +1 -1
- package/build-module/components/block-inspector/index.js +1 -4
- 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/index.js +9 -9
- package/build-module/components/block-list/index.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-parent-selector-menu-item.js +46 -0
- package/build-module/components/block-settings-menu/block-parent-selector-menu-item.js.map +1 -0
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +12 -40
- 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 +7 -6
- 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 +38 -6
- 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/date-format-picker/index.js +0 -1
- package/build-module/components/date-format-picker/index.js.map +1 -1
- package/build-module/components/font-appearance-control/index.js +1 -2
- package/build-module/components/font-appearance-control/index.js.map +1 -1
- 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/dimensions-panel.js +30 -19
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/image-settings-panel.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 +0 -4
- package/build-module/components/inspector-controls-tabs/styles-tab.js.map +1 -1
- package/build-module/components/link-control/search-input.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/observe-typing/index.js +5 -10
- package/build-module/components/observe-typing/index.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/format-toolbar-container.js +1 -31
- package/build-module/components/rich-text/format-toolbar-container.js.map +1 -1
- package/build-module/components/rich-text/index.js +1 -2
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/skip-to-selected-block/index.js +8 -14
- package/build-module/components/skip-to-selected-block/index.js.map +1 -1
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js +0 -1
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build-module/components/url-input/index.js +5 -8
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/hooks/background.js.map +1 -1
- package/build-module/hooks/block-hooks.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 +89 -1
- 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/position.js +0 -1
- package/build-module/hooks/position.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-typography-props.js +2 -3
- package/build-module/hooks/use-typography-props.js.map +1 -1
- package/build-module/layouts/grid.js +113 -16
- package/build-module/layouts/grid.js.map +1 -1
- package/build-module/private-apis.js +2 -2
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/actions.js +4 -36
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/private-actions.js +29 -45
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/reducer.js +2 -4
- 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 +7 -2
- package/build-style/content.css +7 -2
- package/build-style/style-rtl.css +55 -25
- package/build-style/style.css +55 -25
- package/package.json +31 -32
- package/src/components/block-canvas/index.js +2 -0
- package/src/components/block-draggable/test/index.native.js +2 -2
- package/src/components/block-heading-level-dropdown/index.js +17 -25
- package/src/components/block-inspector/index.js +0 -11
- 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/index.js +55 -55
- package/src/components/block-list/test/block-outline.native.js +255 -0
- 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-parent-selector-menu-item.js +50 -0
- package/src/components/block-settings-menu/block-settings-dropdown.js +9 -50
- package/src/components/block-styles/style.scss +0 -4
- 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 +5 -11
- 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 +85 -44
- 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/date-format-picker/index.js +0 -1
- package/src/components/default-block-appender/content.scss +5 -2
- package/src/components/font-appearance-control/index.js +0 -1
- package/src/components/global-styles/border-panel.js +2 -2
- package/src/components/global-styles/color-panel.js +1 -1
- package/src/components/global-styles/dimensions-panel.js +36 -24
- package/src/components/global-styles/image-settings-panel.js +1 -1
- package/src/components/global-styles/test/typography-utils.js +231 -81
- package/src/components/global-styles/test/use-global-styles-output.js +3 -2
- 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 +0 -7
- package/src/components/line-height-control/test/index.js +1 -1
- package/src/components/link-control/search-input.js +1 -1
- 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/observe-typing/index.js +7 -10
- 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/format-toolbar-container.js +1 -48
- package/src/components/rich-text/index.js +1 -2
- package/src/components/skip-to-selected-block/index.js +10 -13
- package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +4 -5
- package/src/components/url-input/index.js +6 -15
- package/src/hooks/anchor.scss +1 -1
- package/src/hooks/background.js +1 -1
- package/src/hooks/block-hooks.js +1 -1
- 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 +91 -1
- package/src/hooks/layout.js +12 -1
- package/src/hooks/line-height.js +1 -1
- package/src/hooks/position.js +0 -1
- package/src/hooks/spacing-visualizer.js +126 -0
- package/src/hooks/{padding.scss → spacing.scss} +1 -1
- package/src/hooks/use-typography-props.js +2 -8
- package/src/layouts/grid.js +137 -53
- package/src/layouts/test/grid.js +16 -2
- package/src/private-apis.js +2 -2
- package/src/store/actions.js +4 -42
- package/src/store/private-actions.js +34 -69
- package/src/store/reducer.js +2 -8
- package/src/store/selectors.js +41 -46
- package/src/store/test/actions.js +0 -105
- package/src/style.scss +2 -2
- package/src/utils/calculate-scale.js +20 -0
- package/build/components/default-style-picker/index.js +0 -70
- package/build/components/default-style-picker/index.js.map +0 -1
- 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/components/default-style-picker/index.js +0 -63
- package/build-module/components/default-style-picker/index.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/components/block-settings-menu/style.scss +0 -3
- package/src/components/default-style-picker/index.js +0 -70
- 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
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { createElement } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* WordPress dependencies
|
|
4
|
+
*/
|
|
5
|
+
import { useState, useEffect } from '@wordpress/element';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Internal dependencies
|
|
9
|
+
*/
|
|
10
|
+
import { __unstableUseBlockElement as useBlockElement } from '../block-list/use-block-props/use-block-refs';
|
|
11
|
+
import BlockPopoverCover from '../block-popover/cover';
|
|
12
|
+
import { getComputedCSS } from './utils';
|
|
13
|
+
export function GridVisualizer({
|
|
14
|
+
clientId
|
|
15
|
+
}) {
|
|
16
|
+
const blockElement = useBlockElement(clientId);
|
|
17
|
+
if (!blockElement) {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
return createElement(BlockPopoverCover, {
|
|
21
|
+
className: "block-editor-grid-visualizer",
|
|
22
|
+
clientId: clientId,
|
|
23
|
+
__unstablePopoverSlot: "block-toolbar"
|
|
24
|
+
}, createElement(GridVisualizerGrid, {
|
|
25
|
+
blockElement: blockElement
|
|
26
|
+
}));
|
|
27
|
+
}
|
|
28
|
+
function GridVisualizerGrid({
|
|
29
|
+
blockElement
|
|
30
|
+
}) {
|
|
31
|
+
const [gridInfo, setGridInfo] = useState(() => getGridInfo(blockElement));
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
const observers = [];
|
|
34
|
+
for (const element of [blockElement, ...blockElement.children]) {
|
|
35
|
+
const observer = new window.ResizeObserver(() => {
|
|
36
|
+
setGridInfo(getGridInfo(blockElement));
|
|
37
|
+
});
|
|
38
|
+
observer.observe(element);
|
|
39
|
+
observers.push(observer);
|
|
40
|
+
}
|
|
41
|
+
return () => {
|
|
42
|
+
for (const observer of observers) {
|
|
43
|
+
observer.disconnect();
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
}, [blockElement]);
|
|
47
|
+
return createElement("div", {
|
|
48
|
+
className: "block-editor-grid-visualizer__grid",
|
|
49
|
+
style: gridInfo.style
|
|
50
|
+
}, Array.from({
|
|
51
|
+
length: gridInfo.numItems
|
|
52
|
+
}, (_, i) => createElement("div", {
|
|
53
|
+
key: i,
|
|
54
|
+
className: "block-editor-grid-visualizer__item"
|
|
55
|
+
})));
|
|
56
|
+
}
|
|
57
|
+
function getGridInfo(blockElement) {
|
|
58
|
+
const gridTemplateColumns = getComputedCSS(blockElement, 'grid-template-columns');
|
|
59
|
+
const gridTemplateRows = getComputedCSS(blockElement, 'grid-template-rows');
|
|
60
|
+
const numColumns = gridTemplateColumns.split(' ').length;
|
|
61
|
+
const numRows = gridTemplateRows.split(' ').length;
|
|
62
|
+
const numItems = numColumns * numRows;
|
|
63
|
+
return {
|
|
64
|
+
numItems,
|
|
65
|
+
style: {
|
|
66
|
+
gridTemplateColumns,
|
|
67
|
+
gridTemplateRows,
|
|
68
|
+
gap: getComputedCSS(blockElement, 'gap'),
|
|
69
|
+
padding: getComputedCSS(blockElement, 'padding')
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=grid-visualizer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useState","useEffect","__unstableUseBlockElement","useBlockElement","BlockPopoverCover","getComputedCSS","GridVisualizer","clientId","blockElement","createElement","className","__unstablePopoverSlot","GridVisualizerGrid","gridInfo","setGridInfo","getGridInfo","observers","element","children","observer","window","ResizeObserver","observe","push","disconnect","style","Array","from","length","numItems","_","i","key","gridTemplateColumns","gridTemplateRows","numColumns","split","numRows","gap","padding"],"sources":["@wordpress/block-editor/src/components/grid-visualizer/grid-visualizer.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState, useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { __unstableUseBlockElement as useBlockElement } from '../block-list/use-block-props/use-block-refs';\nimport BlockPopoverCover from '../block-popover/cover';\nimport { getComputedCSS } from './utils';\n\nexport function GridVisualizer( { clientId } ) {\n\tconst blockElement = useBlockElement( clientId );\n\tif ( ! blockElement ) {\n\t\treturn null;\n\t}\n\treturn (\n\t\t<BlockPopoverCover\n\t\t\tclassName=\"block-editor-grid-visualizer\"\n\t\t\tclientId={ clientId }\n\t\t\t__unstablePopoverSlot=\"block-toolbar\"\n\t\t>\n\t\t\t<GridVisualizerGrid blockElement={ blockElement } />\n\t\t</BlockPopoverCover>\n\t);\n}\n\nfunction GridVisualizerGrid( { blockElement } ) {\n\tconst [ gridInfo, setGridInfo ] = useState( () =>\n\t\tgetGridInfo( blockElement )\n\t);\n\tuseEffect( () => {\n\t\tconst observers = [];\n\t\tfor ( const element of [ blockElement, ...blockElement.children ] ) {\n\t\t\tconst observer = new window.ResizeObserver( () => {\n\t\t\t\tsetGridInfo( getGridInfo( blockElement ) );\n\t\t\t} );\n\t\t\tobserver.observe( element );\n\t\t\tobservers.push( observer );\n\t\t}\n\t\treturn () => {\n\t\t\tfor ( const observer of observers ) {\n\t\t\t\tobserver.disconnect();\n\t\t\t}\n\t\t};\n\t}, [ blockElement ] );\n\treturn (\n\t\t<div\n\t\t\tclassName=\"block-editor-grid-visualizer__grid\"\n\t\t\tstyle={ gridInfo.style }\n\t\t>\n\t\t\t{ Array.from( { length: gridInfo.numItems }, ( _, i ) => (\n\t\t\t\t<div key={ i } className=\"block-editor-grid-visualizer__item\" />\n\t\t\t) ) }\n\t\t</div>\n\t);\n}\n\nfunction getGridInfo( blockElement ) {\n\tconst gridTemplateColumns = getComputedCSS(\n\t\tblockElement,\n\t\t'grid-template-columns'\n\t);\n\tconst gridTemplateRows = getComputedCSS(\n\t\tblockElement,\n\t\t'grid-template-rows'\n\t);\n\tconst numColumns = gridTemplateColumns.split( ' ' ).length;\n\tconst numRows = gridTemplateRows.split( ' ' ).length;\n\tconst numItems = numColumns * numRows;\n\treturn {\n\t\tnumItems,\n\t\tstyle: {\n\t\t\tgridTemplateColumns,\n\t\t\tgridTemplateRows,\n\t\t\tgap: getComputedCSS( blockElement, 'gap' ),\n\t\t\tpadding: getComputedCSS( blockElement, 'padding' ),\n\t\t},\n\t};\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,QAAQ,EAAEC,SAAS,QAAQ,oBAAoB;;AAExD;AACA;AACA;AACA,SAASC,yBAAyB,IAAIC,eAAe,QAAQ,8CAA8C;AAC3G,OAAOC,iBAAiB,MAAM,wBAAwB;AACtD,SAASC,cAAc,QAAQ,SAAS;AAExC,OAAO,SAASC,cAAcA,CAAE;EAAEC;AAAS,CAAC,EAAG;EAC9C,MAAMC,YAAY,GAAGL,eAAe,CAAEI,QAAS,CAAC;EAChD,IAAK,CAAEC,YAAY,EAAG;IACrB,OAAO,IAAI;EACZ;EACA,OACCC,aAAA,CAACL,iBAAiB;IACjBM,SAAS,EAAC,8BAA8B;IACxCH,QAAQ,EAAGA,QAAU;IACrBI,qBAAqB,EAAC;EAAe,GAErCF,aAAA,CAACG,kBAAkB;IAACJ,YAAY,EAAGA;EAAc,CAAE,CACjC,CAAC;AAEtB;AAEA,SAASI,kBAAkBA,CAAE;EAAEJ;AAAa,CAAC,EAAG;EAC/C,MAAM,CAAEK,QAAQ,EAAEC,WAAW,CAAE,GAAGd,QAAQ,CAAE,MAC3Ce,WAAW,CAAEP,YAAa,CAC3B,CAAC;EACDP,SAAS,CAAE,MAAM;IAChB,MAAMe,SAAS,GAAG,EAAE;IACpB,KAAM,MAAMC,OAAO,IAAI,CAAET,YAAY,EAAE,GAAGA,YAAY,CAACU,QAAQ,CAAE,EAAG;MACnE,MAAMC,QAAQ,GAAG,IAAIC,MAAM,CAACC,cAAc,CAAE,MAAM;QACjDP,WAAW,CAAEC,WAAW,CAAEP,YAAa,CAAE,CAAC;MAC3C,CAAE,CAAC;MACHW,QAAQ,CAACG,OAAO,CAAEL,OAAQ,CAAC;MAC3BD,SAAS,CAACO,IAAI,CAAEJ,QAAS,CAAC;IAC3B;IACA,OAAO,MAAM;MACZ,KAAM,MAAMA,QAAQ,IAAIH,SAAS,EAAG;QACnCG,QAAQ,CAACK,UAAU,CAAC,CAAC;MACtB;IACD,CAAC;EACF,CAAC,EAAE,CAAEhB,YAAY,CAAG,CAAC;EACrB,OACCC,aAAA;IACCC,SAAS,EAAC,oCAAoC;IAC9Ce,KAAK,EAAGZ,QAAQ,CAACY;EAAO,GAEtBC,KAAK,CAACC,IAAI,CAAE;IAAEC,MAAM,EAAEf,QAAQ,CAACgB;EAAS,CAAC,EAAE,CAAEC,CAAC,EAAEC,CAAC,KAClDtB,aAAA;IAAKuB,GAAG,EAAGD,CAAG;IAACrB,SAAS,EAAC;EAAoC,CAAE,CAC9D,CACE,CAAC;AAER;AAEA,SAASK,WAAWA,CAAEP,YAAY,EAAG;EACpC,MAAMyB,mBAAmB,GAAG5B,cAAc,CACzCG,YAAY,EACZ,uBACD,CAAC;EACD,MAAM0B,gBAAgB,GAAG7B,cAAc,CACtCG,YAAY,EACZ,oBACD,CAAC;EACD,MAAM2B,UAAU,GAAGF,mBAAmB,CAACG,KAAK,CAAE,GAAI,CAAC,CAACR,MAAM;EAC1D,MAAMS,OAAO,GAAGH,gBAAgB,CAACE,KAAK,CAAE,GAAI,CAAC,CAACR,MAAM;EACpD,MAAMC,QAAQ,GAAGM,UAAU,GAAGE,OAAO;EACrC,OAAO;IACNR,QAAQ;IACRJ,KAAK,EAAE;MACNQ,mBAAmB;MACnBC,gBAAgB;MAChBI,GAAG,EAAEjC,cAAc,CAAEG,YAAY,EAAE,KAAM,CAAC;MAC1C+B,OAAO,EAAElC,cAAc,CAAEG,YAAY,EAAE,SAAU;IAClD;EACD,CAAC;AACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["GridVisualizer","GridItemResizer"],"sources":["@wordpress/block-editor/src/components/grid-visualizer/index.js"],"sourcesContent":["export { GridVisualizer } from './grid-visualizer';\nexport { GridItemResizer } from './grid-item-resizer';\n"],"mappings":"AAAA,SAASA,cAAc,QAAQ,mBAAmB;AAClD,SAASC,eAAe,QAAQ,qBAAqB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["getComputedCSS","element","property","ownerDocument","defaultView","getComputedStyle","getPropertyValue"],"sources":["@wordpress/block-editor/src/components/grid-visualizer/utils.js"],"sourcesContent":["export function getComputedCSS( element, property ) {\n\treturn element.ownerDocument.defaultView\n\t\t.getComputedStyle( element )\n\t\t.getPropertyValue( property );\n}\n"],"mappings":"AAAA,OAAO,SAASA,cAAcA,CAAEC,OAAO,EAAEC,QAAQ,EAAG;EACnD,OAAOD,OAAO,CAACE,aAAa,CAACC,WAAW,CACtCC,gBAAgB,CAAEJ,OAAQ,CAAC,CAC3BK,gBAAgB,CAAEJ,QAAS,CAAC;AAC/B"}
|
|
@@ -20,6 +20,7 @@ import { useBlockSelectionClearer } from '../block-selection-clearer';
|
|
|
20
20
|
import { useWritingFlow } from '../writing-flow';
|
|
21
21
|
import { getCompatibilityStyles } from './get-compatibility-styles';
|
|
22
22
|
import { store as blockEditorStore } from '../../store';
|
|
23
|
+
import calculateScale from '../../utils/calculate-scale';
|
|
23
24
|
function bubbleEvent(event, Constructor, frame) {
|
|
24
25
|
const init = {};
|
|
25
26
|
for (const key in event) {
|
|
@@ -92,21 +93,26 @@ function Iframe({
|
|
|
92
93
|
contentRef,
|
|
93
94
|
children,
|
|
94
95
|
tabIndex = 0,
|
|
95
|
-
|
|
96
|
-
frameSize = 0,
|
|
97
|
-
expand = false,
|
|
96
|
+
shouldZoom = false,
|
|
98
97
|
readonly,
|
|
99
98
|
forwardedRef: ref,
|
|
99
|
+
title = __('Editor canvas'),
|
|
100
100
|
...props
|
|
101
101
|
}) {
|
|
102
102
|
const {
|
|
103
103
|
resolvedAssets,
|
|
104
|
-
isPreviewMode
|
|
104
|
+
isPreviewMode,
|
|
105
|
+
isZoomOutMode
|
|
105
106
|
} = useSelect(select => {
|
|
106
|
-
const
|
|
107
|
+
const {
|
|
108
|
+
getSettings,
|
|
109
|
+
__unstableGetEditorMode
|
|
110
|
+
} = select(blockEditorStore);
|
|
111
|
+
const settings = getSettings();
|
|
107
112
|
return {
|
|
108
113
|
resolvedAssets: settings.__unstableResolvedAssets,
|
|
109
|
-
isPreviewMode: settings.__unstableIsPreviewMode
|
|
114
|
+
isPreviewMode: settings.__unstableIsPreviewMode,
|
|
115
|
+
isZoomOutMode: __unstableGetEditorMode() === 'zoom-out'
|
|
110
116
|
};
|
|
111
117
|
}, []);
|
|
112
118
|
const {
|
|
@@ -118,8 +124,21 @@ function Iframe({
|
|
|
118
124
|
const clearerRef = useBlockSelectionClearer();
|
|
119
125
|
const [before, writingFlowRef, after] = useWritingFlow();
|
|
120
126
|
const [contentResizeListener, {
|
|
121
|
-
height: contentHeight
|
|
127
|
+
height: contentHeight,
|
|
128
|
+
width: contentWidth
|
|
122
129
|
}] = useResizeObserver();
|
|
130
|
+
|
|
131
|
+
// When zoom-out mode is enabled, the iframe is scaled down to fit the
|
|
132
|
+
// content within the viewport.
|
|
133
|
+
// At 1000px wide, the iframe is scaled to 45%.
|
|
134
|
+
// At 400px wide, the iframe is scaled to 90%.
|
|
135
|
+
const scale = isZoomOutMode && shouldZoom ? calculateScale({
|
|
136
|
+
maxWidth: 1000,
|
|
137
|
+
minWidth: 400,
|
|
138
|
+
maxScale: 0.45,
|
|
139
|
+
minScale: 0.9
|
|
140
|
+
}, contentWidth) : 1;
|
|
141
|
+
const frameSize = isZoomOutMode ? 100 : 0;
|
|
123
142
|
const setRef = useRefEffect(node => {
|
|
124
143
|
node._load = () => {
|
|
125
144
|
setIframeDocument(node.contentDocument);
|
|
@@ -138,6 +157,7 @@ function Iframe({
|
|
|
138
157
|
documentElement
|
|
139
158
|
} = contentDocument;
|
|
140
159
|
iFrameDocument = contentDocument;
|
|
160
|
+
documentElement.classList.add('block-editor-iframe__html');
|
|
141
161
|
clearerRef(documentElement);
|
|
142
162
|
|
|
143
163
|
// Ideally ALL classes that are added through get_body_class should
|
|
@@ -179,7 +199,19 @@ function Iframe({
|
|
|
179
199
|
<head>
|
|
180
200
|
<meta charset="utf-8">
|
|
181
201
|
<script>window.frameElement._load()</script>
|
|
182
|
-
<style>
|
|
202
|
+
<style>
|
|
203
|
+
html{
|
|
204
|
+
height: auto !important;
|
|
205
|
+
min-height: 100%;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
body {
|
|
209
|
+
margin: 0;
|
|
210
|
+
/* Default background color in case zoom out mode background
|
|
211
|
+
colors the html element */
|
|
212
|
+
background: white;
|
|
213
|
+
}
|
|
214
|
+
</style>
|
|
183
215
|
${styles}
|
|
184
216
|
${scripts}
|
|
185
217
|
</head>
|
|
@@ -199,15 +231,28 @@ function Iframe({
|
|
|
199
231
|
// is e.g. 0.45, then the top + bottom margin is 0.55 (1 - scale). Just the
|
|
200
232
|
// top or bottom margin is 0.55 / 2 ((1 - scale) / 2).
|
|
201
233
|
const marginFromScaling = contentHeight * (1 - scale) / 2;
|
|
202
|
-
|
|
234
|
+
useEffect(() => {
|
|
235
|
+
if (iframeDocument && scale !== 1) {
|
|
236
|
+
iframeDocument.documentElement.style.transform = `scale( ${scale} )`;
|
|
237
|
+
iframeDocument.documentElement.style.marginTop = `${frameSize}px`;
|
|
238
|
+
iframeDocument.documentElement.style.marginBottom = `${-marginFromScaling * 2 + frameSize}px`;
|
|
239
|
+
return () => {
|
|
240
|
+
iframeDocument.documentElement.style.transform = '';
|
|
241
|
+
iframeDocument.documentElement.style.marginTop = '';
|
|
242
|
+
iframeDocument.documentElement.style.marginBottom = '';
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
}, [scale, frameSize, marginFromScaling, iframeDocument]);
|
|
246
|
+
|
|
247
|
+
// Make sure to not render the before and after focusable div elements in view
|
|
248
|
+
// mode. They're only needed to capture focus in edit mode.
|
|
249
|
+
const shouldRenderFocusCaptureElements = tabIndex >= 0 && !isPreviewMode;
|
|
250
|
+
return createElement(Fragment, null, shouldRenderFocusCaptureElements && before, createElement("iframe", {
|
|
203
251
|
...props,
|
|
204
252
|
style: {
|
|
205
253
|
border: 0,
|
|
206
254
|
...props.style,
|
|
207
|
-
height:
|
|
208
|
-
marginTop: scale !== 1 ? -marginFromScaling + frameSize : props.style?.marginTop,
|
|
209
|
-
marginBottom: scale !== 1 ? -marginFromScaling + frameSize : props.style?.marginBottom,
|
|
210
|
-
transform: scale !== 1 ? `scale( ${scale} )` : props.style?.transform,
|
|
255
|
+
height: props.style?.height,
|
|
211
256
|
transition: 'all .3s'
|
|
212
257
|
},
|
|
213
258
|
ref: useMergeRefs([ref, setRef]),
|
|
@@ -217,7 +262,7 @@ function Iframe({
|
|
|
217
262
|
// content.
|
|
218
263
|
,
|
|
219
264
|
src: src,
|
|
220
|
-
title:
|
|
265
|
+
title: title,
|
|
221
266
|
onKeyDown: event => {
|
|
222
267
|
if (props.onKeyDown) {
|
|
223
268
|
props.onKeyDown(event);
|
|
@@ -228,7 +273,7 @@ function Iframe({
|
|
|
228
273
|
// though by doing so we also trigger another React event,
|
|
229
274
|
// so we need to stop the propagation of this event to avoid
|
|
230
275
|
// duplication.
|
|
231
|
-
|
|
276
|
+
if (event.currentTarget.ownerDocument !== event.target.ownerDocument) {
|
|
232
277
|
event.stopPropagation();
|
|
233
278
|
bubbleEvent(event, window.KeyboardEvent, event.currentTarget);
|
|
234
279
|
}
|
|
@@ -242,7 +287,7 @@ function Iframe({
|
|
|
242
287
|
className: classnames('block-editor-iframe__body', 'editor-styles-wrapper', ...bodyClasses)
|
|
243
288
|
}, contentResizeListener, createElement(StyleProvider, {
|
|
244
289
|
document: iframeDocument
|
|
245
|
-
}, children)), iframeDocument.documentElement)),
|
|
290
|
+
}, children)), iframeDocument.documentElement)), shouldRenderFocusCaptureElements && after);
|
|
246
291
|
}
|
|
247
292
|
function IframeIfReady(props, ref) {
|
|
248
293
|
const isInitialised = useSelect(select => select(blockEditorStore).getSettings().__internalIsInitialized, []);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["classnames","useState","createPortal","forwardRef","useMemo","useEffect","__","useResizeObserver","useMergeRefs","useRefEffect","useDisabled","__experimentalStyleProvider","StyleProvider","useSelect","useBlockSelectionClearer","useWritingFlow","getCompatibilityStyles","store","blockEditorStore","bubbleEvent","event","Constructor","frame","init","key","contentDocument","defaultView","MouseEvent","rect","getBoundingClientRect","clientX","left","clientY","top","newEvent","type","defaultPrevented","preventDefault","cancelled","dispatchEvent","useBubbleEvents","iframeDocument","frameElement","html","documentElement","eventTypes","handlers","name","prototype","Object","getPrototypeOf","constructorName","constructor","window","addEventListener","removeEventListener","Iframe","contentRef","children","tabIndex","scale","frameSize","expand","readonly","forwardedRef","ref","props","resolvedAssets","isPreviewMode","select","settings","getSettings","__unstableResolvedAssets","__unstableIsPreviewMode","styles","scripts","setIframeDocument","bodyClasses","setBodyClasses","clearerRef","before","writingFlowRef","after","contentResizeListener","height","contentHeight","setRef","node","_load","iFrameDocument","preventFileDropDefault","onLoad","ownerDocument","Array","from","body","classList","filter","startsWith","dir","compatStyle","getElementById","id","head","appendChild","cloneNode","console","warn","disabledRef","isDisabled","bodyRef","src","cleanup","_src","URL","createObjectURL","Blob","revokeObjectURL","marginFromScaling","createElement","Fragment","style","border","marginTop","marginBottom","transform","transition","title","onKeyDown","currentTarget","target","stopPropagation","KeyboardEvent","className","document","IframeIfReady","isInitialised","__internalIsInitialized"],"sources":["@wordpress/block-editor/src/components/iframe/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseState,\n\tcreatePortal,\n\tforwardRef,\n\tuseMemo,\n\tuseEffect,\n} from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tuseResizeObserver,\n\tuseMergeRefs,\n\tuseRefEffect,\n\tuseDisabled,\n} from '@wordpress/compose';\nimport { __experimentalStyleProvider as StyleProvider } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { useBlockSelectionClearer } from '../block-selection-clearer';\nimport { useWritingFlow } from '../writing-flow';\nimport { getCompatibilityStyles } from './get-compatibility-styles';\nimport { store as blockEditorStore } from '../../store';\n\nfunction bubbleEvent( event, Constructor, frame ) {\n\tconst init = {};\n\n\tfor ( const key in event ) {\n\t\tinit[ key ] = event[ key ];\n\t}\n\n\t// Check if the event is a MouseEvent generated within the iframe.\n\t// If so, adjust the coordinates to be relative to the position of\n\t// the iframe. This ensures that components such as Draggable\n\t// receive coordinates relative to the window, instead of relative\n\t// to the iframe. Without this, the Draggable event handler would\n\t// result in components \"jumping\" position as soon as the user\n\t// drags over the iframe.\n\tif ( event instanceof frame.contentDocument.defaultView.MouseEvent ) {\n\t\tconst rect = frame.getBoundingClientRect();\n\t\tinit.clientX += rect.left;\n\t\tinit.clientY += rect.top;\n\t}\n\n\tconst newEvent = new Constructor( event.type, init );\n\tif ( init.defaultPrevented ) {\n\t\tnewEvent.preventDefault();\n\t}\n\tconst cancelled = ! frame.dispatchEvent( newEvent );\n\n\tif ( cancelled ) {\n\t\tevent.preventDefault();\n\t}\n}\n\n/**\n * Bubbles some event types (keydown, keypress, and dragover) to parent document\n * document to ensure that the keyboard shortcuts and drag and drop work.\n *\n * Ideally, we should remove event bubbling in the future. Keyboard shortcuts\n * should be context dependent, e.g. actions on blocks like Cmd+A should not\n * work globally outside the block editor.\n *\n * @param {Document} iframeDocument Document to attach listeners to.\n */\nfunction useBubbleEvents( iframeDocument ) {\n\treturn useRefEffect( () => {\n\t\tconst { defaultView } = iframeDocument;\n\t\tif ( ! defaultView ) {\n\t\t\treturn;\n\t\t}\n\t\tconst { frameElement } = defaultView;\n\t\tconst html = iframeDocument.documentElement;\n\t\tconst eventTypes = [ 'dragover', 'mousemove' ];\n\t\tconst handlers = {};\n\t\tfor ( const name of eventTypes ) {\n\t\t\thandlers[ name ] = ( event ) => {\n\t\t\t\tconst prototype = Object.getPrototypeOf( event );\n\t\t\t\tconst constructorName = prototype.constructor.name;\n\t\t\t\tconst Constructor = window[ constructorName ];\n\t\t\t\tbubbleEvent( event, Constructor, frameElement );\n\t\t\t};\n\t\t\thtml.addEventListener( name, handlers[ name ] );\n\t\t}\n\n\t\treturn () => {\n\t\t\tfor ( const name of eventTypes ) {\n\t\t\t\thtml.removeEventListener( name, handlers[ name ] );\n\t\t\t}\n\t\t};\n\t} );\n}\n\nfunction Iframe( {\n\tcontentRef,\n\tchildren,\n\ttabIndex = 0,\n\tscale = 1,\n\tframeSize = 0,\n\texpand = false,\n\treadonly,\n\tforwardedRef: ref,\n\t...props\n} ) {\n\tconst { resolvedAssets, isPreviewMode } = useSelect( ( select ) => {\n\t\tconst settings = select( blockEditorStore ).getSettings();\n\t\treturn {\n\t\t\tresolvedAssets: settings.__unstableResolvedAssets,\n\t\t\tisPreviewMode: settings.__unstableIsPreviewMode,\n\t\t};\n\t}, [] );\n\tconst { styles = '', scripts = '' } = resolvedAssets;\n\tconst [ iframeDocument, setIframeDocument ] = useState();\n\tconst [ bodyClasses, setBodyClasses ] = useState( [] );\n\tconst clearerRef = useBlockSelectionClearer();\n\tconst [ before, writingFlowRef, after ] = useWritingFlow();\n\tconst [ contentResizeListener, { height: contentHeight } ] =\n\t\tuseResizeObserver();\n\tconst setRef = useRefEffect( ( node ) => {\n\t\tnode._load = () => {\n\t\t\tsetIframeDocument( node.contentDocument );\n\t\t};\n\t\tlet iFrameDocument;\n\t\t// Prevent the default browser action for files dropped outside of dropzones.\n\t\tfunction preventFileDropDefault( event ) {\n\t\t\tevent.preventDefault();\n\t\t}\n\t\tfunction onLoad() {\n\t\t\tconst { contentDocument, ownerDocument } = node;\n\t\t\tconst { documentElement } = contentDocument;\n\t\t\tiFrameDocument = contentDocument;\n\n\t\t\tclearerRef( documentElement );\n\n\t\t\t// Ideally ALL classes that are added through get_body_class should\n\t\t\t// be added in the editor too, which we'll somehow have to get from\n\t\t\t// the server in the future (which will run the PHP filters).\n\t\t\tsetBodyClasses(\n\t\t\t\tArray.from( ownerDocument.body.classList ).filter(\n\t\t\t\t\t( name ) =>\n\t\t\t\t\t\tname.startsWith( 'admin-color-' ) ||\n\t\t\t\t\t\tname.startsWith( 'post-type-' ) ||\n\t\t\t\t\t\tname === 'wp-embed-responsive'\n\t\t\t\t)\n\t\t\t);\n\n\t\t\tcontentDocument.dir = ownerDocument.dir;\n\n\t\t\tfor ( const compatStyle of getCompatibilityStyles() ) {\n\t\t\t\tif ( contentDocument.getElementById( compatStyle.id ) ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tcontentDocument.head.appendChild(\n\t\t\t\t\tcompatStyle.cloneNode( true )\n\t\t\t\t);\n\n\t\t\t\tif ( ! isPreviewMode ) {\n\t\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t`${ compatStyle.id } was added to the iframe incorrectly. Please use block.json or enqueue_block_assets to add styles to the iframe.`,\n\t\t\t\t\t\tcompatStyle\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tiFrameDocument.addEventListener(\n\t\t\t\t'dragover',\n\t\t\t\tpreventFileDropDefault,\n\t\t\t\tfalse\n\t\t\t);\n\t\t\tiFrameDocument.addEventListener(\n\t\t\t\t'drop',\n\t\t\t\tpreventFileDropDefault,\n\t\t\t\tfalse\n\t\t\t);\n\t\t}\n\n\t\tnode.addEventListener( 'load', onLoad );\n\n\t\treturn () => {\n\t\t\tdelete node._load;\n\t\t\tnode.removeEventListener( 'load', onLoad );\n\t\t\tiFrameDocument?.removeEventListener(\n\t\t\t\t'dragover',\n\t\t\t\tpreventFileDropDefault\n\t\t\t);\n\t\t\tiFrameDocument?.removeEventListener(\n\t\t\t\t'drop',\n\t\t\t\tpreventFileDropDefault\n\t\t\t);\n\t\t};\n\t}, [] );\n\n\tconst disabledRef = useDisabled( { isDisabled: ! readonly } );\n\tconst bodyRef = useMergeRefs( [\n\t\tuseBubbleEvents( iframeDocument ),\n\t\tcontentRef,\n\t\tclearerRef,\n\t\twritingFlowRef,\n\t\tdisabledRef,\n\t] );\n\n\t// Correct doctype is required to enable rendering in standards\n\t// mode. Also preload the styles to avoid a flash of unstyled\n\t// content.\n\tconst html = `<!doctype html>\n<html>\n\t<head>\n\t\t<meta charset=\"utf-8\">\n\t\t<script>window.frameElement._load()</script>\n\t\t<style>html{height:auto!important;min-height:100%;}body{margin:0}</style>\n\t\t${ styles }\n\t\t${ scripts }\n\t</head>\n\t<body>\n\t\t<script>document.currentScript.parentElement.remove()</script>\n\t</body>\n</html>`;\n\n\tconst [ src, cleanup ] = useMemo( () => {\n\t\tconst _src = URL.createObjectURL(\n\t\t\tnew window.Blob( [ html ], { type: 'text/html' } )\n\t\t);\n\t\treturn [ _src, () => URL.revokeObjectURL( _src ) ];\n\t}, [ html ] );\n\n\tuseEffect( () => cleanup, [ cleanup ] );\n\n\t// We need to counter the margin created by scaling the iframe. If the scale\n\t// is e.g. 0.45, then the top + bottom margin is 0.55 (1 - scale). Just the\n\t// top or bottom margin is 0.55 / 2 ((1 - scale) / 2).\n\tconst marginFromScaling = ( contentHeight * ( 1 - scale ) ) / 2;\n\n\treturn (\n\t\t<>\n\t\t\t{ tabIndex >= 0 && before }\n\t\t\t{ /* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */ }\n\t\t\t<iframe\n\t\t\t\t{ ...props }\n\t\t\t\tstyle={ {\n\t\t\t\t\tborder: 0,\n\t\t\t\t\t...props.style,\n\t\t\t\t\theight: expand ? contentHeight : props.style?.height,\n\t\t\t\t\tmarginTop:\n\t\t\t\t\t\tscale !== 1\n\t\t\t\t\t\t\t? -marginFromScaling + frameSize\n\t\t\t\t\t\t\t: props.style?.marginTop,\n\t\t\t\t\tmarginBottom:\n\t\t\t\t\t\tscale !== 1\n\t\t\t\t\t\t\t? -marginFromScaling + frameSize\n\t\t\t\t\t\t\t: props.style?.marginBottom,\n\t\t\t\t\ttransform:\n\t\t\t\t\t\tscale !== 1\n\t\t\t\t\t\t\t? `scale( ${ scale } )`\n\t\t\t\t\t\t\t: props.style?.transform,\n\t\t\t\t\ttransition: 'all .3s',\n\t\t\t\t} }\n\t\t\t\tref={ useMergeRefs( [ ref, setRef ] ) }\n\t\t\t\ttabIndex={ tabIndex }\n\t\t\t\t// Correct doctype is required to enable rendering in standards\n\t\t\t\t// mode. Also preload the styles to avoid a flash of unstyled\n\t\t\t\t// content.\n\t\t\t\tsrc={ src }\n\t\t\t\ttitle={ __( 'Editor canvas' ) }\n\t\t\t\tonKeyDown={ ( event ) => {\n\t\t\t\t\tif ( props.onKeyDown ) {\n\t\t\t\t\t\tprops.onKeyDown( event );\n\t\t\t\t\t}\n\t\t\t\t\t// If the event originates from inside the iframe, it means\n\t\t\t\t\t// it bubbled through the portal, but only with React\n\t\t\t\t\t// events. We need to to bubble native events as well,\n\t\t\t\t\t// though by doing so we also trigger another React event,\n\t\t\t\t\t// so we need to stop the propagation of this event to avoid\n\t\t\t\t\t// duplication.\n\t\t\t\t\telse if (\n\t\t\t\t\t\tevent.currentTarget.ownerDocument !==\n\t\t\t\t\t\tevent.target.ownerDocument\n\t\t\t\t\t) {\n\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\tbubbleEvent(\n\t\t\t\t\t\t\tevent,\n\t\t\t\t\t\t\twindow.KeyboardEvent,\n\t\t\t\t\t\t\tevent.currentTarget\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ iframeDocument &&\n\t\t\t\t\tcreatePortal(\n\t\t\t\t\t\t// We want to prevent React events from bubbling throught the iframe\n\t\t\t\t\t\t// we bubble these manually.\n\t\t\t\t\t\t/* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */\n\t\t\t\t\t\t<body\n\t\t\t\t\t\t\tref={ bodyRef }\n\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t'block-editor-iframe__body',\n\t\t\t\t\t\t\t\t'editor-styles-wrapper',\n\t\t\t\t\t\t\t\t...bodyClasses\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ contentResizeListener }\n\t\t\t\t\t\t\t<StyleProvider document={ iframeDocument }>\n\t\t\t\t\t\t\t\t{ children }\n\t\t\t\t\t\t\t</StyleProvider>\n\t\t\t\t\t\t</body>,\n\t\t\t\t\t\tiframeDocument.documentElement\n\t\t\t\t\t) }\n\t\t\t</iframe>\n\t\t\t{ tabIndex >= 0 && after }\n\t\t</>\n\t);\n}\n\nfunction IframeIfReady( props, ref ) {\n\tconst isInitialised = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getSettings().__internalIsInitialized,\n\t\t[]\n\t);\n\n\t// We shouldn't render the iframe until the editor settings are initialised.\n\t// The initial settings are needed to get the styles for the srcDoc, which\n\t// cannot be changed after the iframe is mounted. srcDoc is used to to set\n\t// the initial iframe HTML, which is required to avoid a flash of unstyled\n\t// content.\n\tif ( ! isInitialised ) {\n\t\treturn null;\n\t}\n\n\treturn <Iframe { ...props } forwardedRef={ ref } />;\n}\n\nexport default forwardRef( IframeIfReady );\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SACCC,QAAQ,EACRC,YAAY,EACZC,UAAU,EACVC,OAAO,EACPC,SAAS,QACH,oBAAoB;AAC3B,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SACCC,iBAAiB,EACjBC,YAAY,EACZC,YAAY,EACZC,WAAW,QACL,oBAAoB;AAC3B,SAASC,2BAA2B,IAAIC,aAAa,QAAQ,uBAAuB;AACpF,SAASC,SAAS,QAAQ,iBAAiB;;AAE3C;AACA;AACA;AACA,SAASC,wBAAwB,QAAQ,4BAA4B;AACrE,SAASC,cAAc,QAAQ,iBAAiB;AAChD,SAASC,sBAAsB,QAAQ,4BAA4B;AACnE,SAASC,KAAK,IAAIC,gBA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createPortal","forwardRef","useMemo","useEffect","__","useResizeObserver","useMergeRefs","useRefEffect","useDisabled","__experimentalStyleProvider","StyleProvider","useSelect","useBlockSelectionClearer","useWritingFlow","getCompatibilityStyles","store","blockEditorStore","calculateScale","bubbleEvent","event","Constructor","frame","init","key","contentDocument","defaultView","MouseEvent","rect","getBoundingClientRect","clientX","left","clientY","top","newEvent","type","defaultPrevented","preventDefault","cancelled","dispatchEvent","useBubbleEvents","iframeDocument","frameElement","html","documentElement","eventTypes","handlers","name","prototype","Object","getPrototypeOf","constructorName","constructor","window","addEventListener","removeEventListener","Iframe","contentRef","children","tabIndex","shouldZoom","readonly","forwardedRef","ref","title","props","resolvedAssets","isPreviewMode","isZoomOutMode","select","getSettings","__unstableGetEditorMode","settings","__unstableResolvedAssets","__unstableIsPreviewMode","styles","scripts","setIframeDocument","bodyClasses","setBodyClasses","clearerRef","before","writingFlowRef","after","contentResizeListener","height","contentHeight","width","contentWidth","scale","maxWidth","minWidth","maxScale","minScale","frameSize","setRef","node","_load","iFrameDocument","preventFileDropDefault","onLoad","ownerDocument","classList","add","Array","from","body","filter","startsWith","dir","compatStyle","getElementById","id","head","appendChild","cloneNode","console","warn","disabledRef","isDisabled","bodyRef","src","cleanup","_src","URL","createObjectURL","Blob","revokeObjectURL","marginFromScaling","style","transform","marginTop","marginBottom","shouldRenderFocusCaptureElements","createElement","Fragment","border","transition","onKeyDown","currentTarget","target","stopPropagation","KeyboardEvent","className","document","IframeIfReady","isInitialised","__internalIsInitialized"],"sources":["@wordpress/block-editor/src/components/iframe/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseState,\n\tcreatePortal,\n\tforwardRef,\n\tuseMemo,\n\tuseEffect,\n} from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tuseResizeObserver,\n\tuseMergeRefs,\n\tuseRefEffect,\n\tuseDisabled,\n} from '@wordpress/compose';\nimport { __experimentalStyleProvider as StyleProvider } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { useBlockSelectionClearer } from '../block-selection-clearer';\nimport { useWritingFlow } from '../writing-flow';\nimport { getCompatibilityStyles } from './get-compatibility-styles';\nimport { store as blockEditorStore } from '../../store';\nimport calculateScale from '../../utils/calculate-scale';\nfunction bubbleEvent( event, Constructor, frame ) {\n\tconst init = {};\n\n\tfor ( const key in event ) {\n\t\tinit[ key ] = event[ key ];\n\t}\n\n\t// Check if the event is a MouseEvent generated within the iframe.\n\t// If so, adjust the coordinates to be relative to the position of\n\t// the iframe. This ensures that components such as Draggable\n\t// receive coordinates relative to the window, instead of relative\n\t// to the iframe. Without this, the Draggable event handler would\n\t// result in components \"jumping\" position as soon as the user\n\t// drags over the iframe.\n\tif ( event instanceof frame.contentDocument.defaultView.MouseEvent ) {\n\t\tconst rect = frame.getBoundingClientRect();\n\t\tinit.clientX += rect.left;\n\t\tinit.clientY += rect.top;\n\t}\n\n\tconst newEvent = new Constructor( event.type, init );\n\tif ( init.defaultPrevented ) {\n\t\tnewEvent.preventDefault();\n\t}\n\tconst cancelled = ! frame.dispatchEvent( newEvent );\n\n\tif ( cancelled ) {\n\t\tevent.preventDefault();\n\t}\n}\n\n/**\n * Bubbles some event types (keydown, keypress, and dragover) to parent document\n * document to ensure that the keyboard shortcuts and drag and drop work.\n *\n * Ideally, we should remove event bubbling in the future. Keyboard shortcuts\n * should be context dependent, e.g. actions on blocks like Cmd+A should not\n * work globally outside the block editor.\n *\n * @param {Document} iframeDocument Document to attach listeners to.\n */\nfunction useBubbleEvents( iframeDocument ) {\n\treturn useRefEffect( () => {\n\t\tconst { defaultView } = iframeDocument;\n\t\tif ( ! defaultView ) {\n\t\t\treturn;\n\t\t}\n\t\tconst { frameElement } = defaultView;\n\t\tconst html = iframeDocument.documentElement;\n\t\tconst eventTypes = [ 'dragover', 'mousemove' ];\n\t\tconst handlers = {};\n\t\tfor ( const name of eventTypes ) {\n\t\t\thandlers[ name ] = ( event ) => {\n\t\t\t\tconst prototype = Object.getPrototypeOf( event );\n\t\t\t\tconst constructorName = prototype.constructor.name;\n\t\t\t\tconst Constructor = window[ constructorName ];\n\t\t\t\tbubbleEvent( event, Constructor, frameElement );\n\t\t\t};\n\t\t\thtml.addEventListener( name, handlers[ name ] );\n\t\t}\n\n\t\treturn () => {\n\t\t\tfor ( const name of eventTypes ) {\n\t\t\t\thtml.removeEventListener( name, handlers[ name ] );\n\t\t\t}\n\t\t};\n\t} );\n}\n\nfunction Iframe( {\n\tcontentRef,\n\tchildren,\n\ttabIndex = 0,\n\tshouldZoom = false,\n\treadonly,\n\tforwardedRef: ref,\n\ttitle = __( 'Editor canvas' ),\n\t...props\n} ) {\n\tconst { resolvedAssets, isPreviewMode, isZoomOutMode } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getSettings, __unstableGetEditorMode } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst settings = getSettings();\n\t\t\treturn {\n\t\t\t\tresolvedAssets: settings.__unstableResolvedAssets,\n\t\t\t\tisPreviewMode: settings.__unstableIsPreviewMode,\n\t\t\t\tisZoomOutMode: __unstableGetEditorMode() === 'zoom-out',\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst { styles = '', scripts = '' } = resolvedAssets;\n\tconst [ iframeDocument, setIframeDocument ] = useState();\n\tconst [ bodyClasses, setBodyClasses ] = useState( [] );\n\tconst clearerRef = useBlockSelectionClearer();\n\tconst [ before, writingFlowRef, after ] = useWritingFlow();\n\tconst [\n\t\tcontentResizeListener,\n\t\t{ height: contentHeight, width: contentWidth },\n\t] = useResizeObserver();\n\n\t// When zoom-out mode is enabled, the iframe is scaled down to fit the\n\t// content within the viewport.\n\t// At 1000px wide, the iframe is scaled to 45%.\n\t// At 400px wide, the iframe is scaled to 90%.\n\tconst scale =\n\t\tisZoomOutMode && shouldZoom\n\t\t\t? calculateScale(\n\t\t\t\t\t{\n\t\t\t\t\t\tmaxWidth: 1000,\n\t\t\t\t\t\tminWidth: 400,\n\t\t\t\t\t\tmaxScale: 0.45,\n\t\t\t\t\t\tminScale: 0.9,\n\t\t\t\t\t},\n\t\t\t\t\tcontentWidth\n\t\t\t )\n\t\t\t: 1;\n\tconst frameSize = isZoomOutMode ? 100 : 0;\n\n\tconst setRef = useRefEffect( ( node ) => {\n\t\tnode._load = () => {\n\t\t\tsetIframeDocument( node.contentDocument );\n\t\t};\n\t\tlet iFrameDocument;\n\t\t// Prevent the default browser action for files dropped outside of dropzones.\n\t\tfunction preventFileDropDefault( event ) {\n\t\t\tevent.preventDefault();\n\t\t}\n\t\tfunction onLoad() {\n\t\t\tconst { contentDocument, ownerDocument } = node;\n\t\t\tconst { documentElement } = contentDocument;\n\t\t\tiFrameDocument = contentDocument;\n\n\t\t\tdocumentElement.classList.add( 'block-editor-iframe__html' );\n\n\t\t\tclearerRef( documentElement );\n\n\t\t\t// Ideally ALL classes that are added through get_body_class should\n\t\t\t// be added in the editor too, which we'll somehow have to get from\n\t\t\t// the server in the future (which will run the PHP filters).\n\t\t\tsetBodyClasses(\n\t\t\t\tArray.from( ownerDocument.body.classList ).filter(\n\t\t\t\t\t( name ) =>\n\t\t\t\t\t\tname.startsWith( 'admin-color-' ) ||\n\t\t\t\t\t\tname.startsWith( 'post-type-' ) ||\n\t\t\t\t\t\tname === 'wp-embed-responsive'\n\t\t\t\t)\n\t\t\t);\n\n\t\t\tcontentDocument.dir = ownerDocument.dir;\n\n\t\t\tfor ( const compatStyle of getCompatibilityStyles() ) {\n\t\t\t\tif ( contentDocument.getElementById( compatStyle.id ) ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tcontentDocument.head.appendChild(\n\t\t\t\t\tcompatStyle.cloneNode( true )\n\t\t\t\t);\n\n\t\t\t\tif ( ! isPreviewMode ) {\n\t\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t`${ compatStyle.id } was added to the iframe incorrectly. Please use block.json or enqueue_block_assets to add styles to the iframe.`,\n\t\t\t\t\t\tcompatStyle\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tiFrameDocument.addEventListener(\n\t\t\t\t'dragover',\n\t\t\t\tpreventFileDropDefault,\n\t\t\t\tfalse\n\t\t\t);\n\t\t\tiFrameDocument.addEventListener(\n\t\t\t\t'drop',\n\t\t\t\tpreventFileDropDefault,\n\t\t\t\tfalse\n\t\t\t);\n\t\t}\n\n\t\tnode.addEventListener( 'load', onLoad );\n\n\t\treturn () => {\n\t\t\tdelete node._load;\n\t\t\tnode.removeEventListener( 'load', onLoad );\n\t\t\tiFrameDocument?.removeEventListener(\n\t\t\t\t'dragover',\n\t\t\t\tpreventFileDropDefault\n\t\t\t);\n\t\t\tiFrameDocument?.removeEventListener(\n\t\t\t\t'drop',\n\t\t\t\tpreventFileDropDefault\n\t\t\t);\n\t\t};\n\t}, [] );\n\n\tconst disabledRef = useDisabled( { isDisabled: ! readonly } );\n\tconst bodyRef = useMergeRefs( [\n\t\tuseBubbleEvents( iframeDocument ),\n\t\tcontentRef,\n\t\tclearerRef,\n\t\twritingFlowRef,\n\t\tdisabledRef,\n\t] );\n\n\t// Correct doctype is required to enable rendering in standards\n\t// mode. Also preload the styles to avoid a flash of unstyled\n\t// content.\n\tconst html = `<!doctype html>\n<html>\n\t<head>\n\t\t<meta charset=\"utf-8\">\n\t\t<script>window.frameElement._load()</script>\n\t\t<style>\n\t\t\thtml{\n\t\t\t\theight: auto !important;\n\t\t\t\tmin-height: 100%;\n\t\t\t}\n\n\t\t\tbody {\n\t\t\t\tmargin: 0;\n\t\t\t\t/* Default background color in case zoom out mode background\n\t\t\t\tcolors the html element */\n\t\t\t\tbackground: white;\n\t\t\t}\n\t\t</style>\n\t\t${ styles }\n\t\t${ scripts }\n\t</head>\n\t<body>\n\t\t<script>document.currentScript.parentElement.remove()</script>\n\t</body>\n</html>`;\n\n\tconst [ src, cleanup ] = useMemo( () => {\n\t\tconst _src = URL.createObjectURL(\n\t\t\tnew window.Blob( [ html ], { type: 'text/html' } )\n\t\t);\n\t\treturn [ _src, () => URL.revokeObjectURL( _src ) ];\n\t}, [ html ] );\n\n\tuseEffect( () => cleanup, [ cleanup ] );\n\n\t// We need to counter the margin created by scaling the iframe. If the scale\n\t// is e.g. 0.45, then the top + bottom margin is 0.55 (1 - scale). Just the\n\t// top or bottom margin is 0.55 / 2 ((1 - scale) / 2).\n\tconst marginFromScaling = ( contentHeight * ( 1 - scale ) ) / 2;\n\n\tuseEffect( () => {\n\t\tif ( iframeDocument && scale !== 1 ) {\n\t\t\tiframeDocument.documentElement.style.transform = `scale( ${ scale } )`;\n\t\t\tiframeDocument.documentElement.style.marginTop = `${ frameSize }px`;\n\t\t\tiframeDocument.documentElement.style.marginBottom = `${\n\t\t\t\t-marginFromScaling * 2 + frameSize\n\t\t\t}px`;\n\t\t\treturn () => {\n\t\t\t\tiframeDocument.documentElement.style.transform = '';\n\t\t\t\tiframeDocument.documentElement.style.marginTop = '';\n\t\t\t\tiframeDocument.documentElement.style.marginBottom = '';\n\t\t\t};\n\t\t}\n\t}, [ scale, frameSize, marginFromScaling, iframeDocument ] );\n\n\t// Make sure to not render the before and after focusable div elements in view\n\t// mode. They're only needed to capture focus in edit mode.\n\tconst shouldRenderFocusCaptureElements = tabIndex >= 0 && ! isPreviewMode;\n\n\treturn (\n\t\t<>\n\t\t\t{ shouldRenderFocusCaptureElements && before }\n\t\t\t{ /* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */ }\n\t\t\t<iframe\n\t\t\t\t{ ...props }\n\t\t\t\tstyle={ {\n\t\t\t\t\tborder: 0,\n\t\t\t\t\t...props.style,\n\t\t\t\t\theight: props.style?.height,\n\t\t\t\t\ttransition: 'all .3s',\n\t\t\t\t} }\n\t\t\t\tref={ useMergeRefs( [ ref, setRef ] ) }\n\t\t\t\ttabIndex={ tabIndex }\n\t\t\t\t// Correct doctype is required to enable rendering in standards\n\t\t\t\t// mode. Also preload the styles to avoid a flash of unstyled\n\t\t\t\t// content.\n\t\t\t\tsrc={ src }\n\t\t\t\ttitle={ title }\n\t\t\t\tonKeyDown={ ( event ) => {\n\t\t\t\t\tif ( props.onKeyDown ) {\n\t\t\t\t\t\tprops.onKeyDown( event );\n\t\t\t\t\t}\n\t\t\t\t\t// If the event originates from inside the iframe, it means\n\t\t\t\t\t// it bubbled through the portal, but only with React\n\t\t\t\t\t// events. We need to to bubble native events as well,\n\t\t\t\t\t// though by doing so we also trigger another React event,\n\t\t\t\t\t// so we need to stop the propagation of this event to avoid\n\t\t\t\t\t// duplication.\n\t\t\t\t\tif (\n\t\t\t\t\t\tevent.currentTarget.ownerDocument !==\n\t\t\t\t\t\tevent.target.ownerDocument\n\t\t\t\t\t) {\n\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\tbubbleEvent(\n\t\t\t\t\t\t\tevent,\n\t\t\t\t\t\t\twindow.KeyboardEvent,\n\t\t\t\t\t\t\tevent.currentTarget\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ iframeDocument &&\n\t\t\t\t\tcreatePortal(\n\t\t\t\t\t\t// We want to prevent React events from bubbling throught the iframe\n\t\t\t\t\t\t// we bubble these manually.\n\t\t\t\t\t\t/* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */\n\t\t\t\t\t\t<body\n\t\t\t\t\t\t\tref={ bodyRef }\n\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t'block-editor-iframe__body',\n\t\t\t\t\t\t\t\t'editor-styles-wrapper',\n\t\t\t\t\t\t\t\t...bodyClasses\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ contentResizeListener }\n\t\t\t\t\t\t\t<StyleProvider document={ iframeDocument }>\n\t\t\t\t\t\t\t\t{ children }\n\t\t\t\t\t\t\t</StyleProvider>\n\t\t\t\t\t\t</body>,\n\t\t\t\t\t\tiframeDocument.documentElement\n\t\t\t\t\t) }\n\t\t\t</iframe>\n\t\t\t{ shouldRenderFocusCaptureElements && after }\n\t\t</>\n\t);\n}\n\nfunction IframeIfReady( props, ref ) {\n\tconst isInitialised = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getSettings().__internalIsInitialized,\n\t\t[]\n\t);\n\n\t// We shouldn't render the iframe until the editor settings are initialised.\n\t// The initial settings are needed to get the styles for the srcDoc, which\n\t// cannot be changed after the iframe is mounted. srcDoc is used to to set\n\t// the initial iframe HTML, which is required to avoid a flash of unstyled\n\t// content.\n\tif ( ! isInitialised ) {\n\t\treturn null;\n\t}\n\n\treturn <Iframe { ...props } forwardedRef={ ref } />;\n}\n\nexport default forwardRef( IframeIfReady );\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SACCC,QAAQ,EACRC,YAAY,EACZC,UAAU,EACVC,OAAO,EACPC,SAAS,QACH,oBAAoB;AAC3B,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SACCC,iBAAiB,EACjBC,YAAY,EACZC,YAAY,EACZC,WAAW,QACL,oBAAoB;AAC3B,SAASC,2BAA2B,IAAIC,aAAa,QAAQ,uBAAuB;AACpF,SAASC,SAAS,QAAQ,iBAAiB;;AAE3C;AACA;AACA;AACA,SAASC,wBAAwB,QAAQ,4BAA4B;AACrE,SAASC,cAAc,QAAQ,iBAAiB;AAChD,SAASC,sBAAsB,QAAQ,4BAA4B;AACnE,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AACvD,OAAOC,cAAc,MAAM,6BAA6B;AACxD,SAASC,WAAWA,CAAEC,KAAK,EAAEC,WAAW,EAAEC,KAAK,EAAG;EACjD,MAAMC,IAAI,GAAG,CAAC,CAAC;EAEf,KAAM,MAAMC,GAAG,IAAIJ,KAAK,EAAG;IAC1BG,IAAI,CAAEC,GAAG,CAAE,GAAGJ,K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B,EAC3B,uBAAuB,EACvB,GAAG+E,WACJ;EAAG,GAEDM,qBAAqB,EACvBkD,aAAA,CAAC3H,aAAa;IAACqI,QAAQ,EAAGvG;EAAgB,GACvCiB,QACY,CACV,CAAC,EACPjB,cAAc,CAACG,eAChB,CACM,CAAC,EACPyF,gCAAgC,IAAIlD,KACrC,CAAC;AAEL;AAEA,SAAS8D,aAAaA,CAAEhF,KAAK,EAAEF,GAAG,EAAG;EACpC,MAAMmF,aAAa,GAAGtI,SAAS,CAC5ByD,MAAM,IACPA,MAAM,CAAEpD,gBAAiB,CAAC,CAACqD,WAAW,CAAC,CAAC,CAAC6E,uBAAuB,EACjE,EACD,CAAC;;EAED;EACA;EACA;EACA;EACA;EACA,IAAK,CAAED,aAAa,EAAG;IACtB,OAAO,IAAI;EACZ;EAEA,OAAOZ,aAAA,CAAC9E,MAAM;IAAA,GAAMS,KAAK;IAAGH,YAAY,EAAGC;EAAK,CAAE,CAAC;AACpD;AAEA,eAAe7D,UAAU,CAAE+I,aAAc,CAAC"}
|
|
@@ -21,7 +21,7 @@ export { default as MediaPlaceholder } from './media-placeholder';
|
|
|
21
21
|
export { default as MediaUpload } from './media-upload';
|
|
22
22
|
export { MEDIA_TYPE_IMAGE, MEDIA_TYPE_VIDEO, MEDIA_TYPE_AUDIO, MEDIA_TYPE_ANY } from './media-upload/constants';
|
|
23
23
|
export { default as MediaUploadProgress } from './media-upload-progress';
|
|
24
|
-
export { MEDIA_UPLOAD_STATE_UPLOADING, MEDIA_UPLOAD_STATE_SUCCEEDED, MEDIA_UPLOAD_STATE_FAILED, MEDIA_UPLOAD_STATE_RESET } from './media-upload-progress/constants';
|
|
24
|
+
export { MEDIA_UPLOAD_STATE_UPLOADING, MEDIA_UPLOAD_STATE_SUCCEEDED, MEDIA_UPLOAD_STATE_PAUSED, MEDIA_UPLOAD_STATE_FAILED, MEDIA_UPLOAD_STATE_RESET } from './media-upload-progress/constants';
|
|
25
25
|
export { default as BlockMediaUpdateProgress } from './block-media-update-progress';
|
|
26
26
|
export { default as URLInput } from './url-input';
|
|
27
27
|
export { default as BlockInvalidWarning } from './block-list/block-invalid-warning';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["BlockAlignmentControl","BlockAlignmentToolbar","BlockContextProvider","default","BlockControls","BlockFormatControls","BlockEdit","useBlockEditContext","BlockIcon","BlockVerticalAlignmentToolbar","BlockVerticalAlignmentControl","AlignmentControl","AlignmentToolbar","InnerBlocks","useInnerBlocksProps","InspectorControls","InspectorAdvancedControls","JustifyToolbar","JustifyContentControl","LineHeightControl","HeadingLevelDropdown","PlainText","RichText","RichTextShortcut","RichTextToolbarButton","__unstableRichTextInputEvent","MediaReplaceFlow","MediaPlaceholder","MediaUpload","MEDIA_TYPE_IMAGE","MEDIA_TYPE_VIDEO","MEDIA_TYPE_AUDIO","MEDIA_TYPE_ANY","MediaUploadProgress","MEDIA_UPLOAD_STATE_UPLOADING","MEDIA_UPLOAD_STATE_SUCCEEDED","MEDIA_UPLOAD_STATE_FAILED","MEDIA_UPLOAD_STATE_RESET","BlockMediaUpdateProgress","URLInput","BlockInvalidWarning","BlockCaption","Caption","PanelColorSettings","__experimentalPanelColorGradientSettings","useSettings","useSetting","RecursionProvider","DeprecatedExperimentalRecursionProvider","__experimentalRecursionProvider","useHasRecursion","DeprecatedExperimentalUseHasRecursion","__experimentalUseHasRecursion","Warning","ContrastChecker","useMultipleOriginColorsAndGradients","UnsupportedBlockDetails","BottomSheetSettings","BlockSettingsButton","blockSettingsScreens","VideoPlayer","VIDEO_ASPECT_RATIO","getSpacingPresetCssVar","getCustomValueFromPreset","isValueSpacingPreset","BlockList","BlockMover","BlockToolbar","BlockVariationPicker","BlockStyles","DefaultBlockAppender","__unstableEditorStyles","Inserter","InserterButton","useBlockProps","FloatingToolbar","BlockEditorProvider"],"sources":["@wordpress/block-editor/src/components/index.native.js"],"sourcesContent":["// Block Creation Components.\nexport {\n\tBlockAlignmentControl,\n\tBlockAlignmentToolbar,\n} from './block-alignment-control';\nexport { BlockContextProvider } from './block-context';\nexport {\n\tdefault as BlockControls,\n\tBlockFormatControls,\n} from './block-controls';\nexport { default as BlockEdit, useBlockEditContext } from './block-edit';\nexport { default as BlockIcon } from './block-icon';\nexport {\n\tBlockVerticalAlignmentToolbar,\n\tBlockVerticalAlignmentControl,\n} from './block-vertical-alignment-control';\nexport * from './colors';\nexport * from './gradients';\nexport * from './font-sizes';\nexport { AlignmentControl, AlignmentToolbar } from './alignment-control';\nexport { default as InnerBlocks, useInnerBlocksProps } from './inner-blocks';\nexport {\n\tdefault as InspectorControls,\n\tInspectorAdvancedControls,\n} from './inspector-controls';\nexport {\n\tJustifyToolbar,\n\tJustifyContentControl,\n} from './justify-content-control';\nexport { default as LineHeightControl } from './line-height-control';\nexport { default as HeadingLevelDropdown } from './block-heading-level-dropdown';\nexport { default as PlainText } from './plain-text';\nexport {\n\tdefault as RichText,\n\tRichTextShortcut,\n\tRichTextToolbarButton,\n\t__unstableRichTextInputEvent,\n} from './rich-text';\nexport { default as MediaReplaceFlow } from './media-replace-flow';\nexport { default as MediaPlaceholder } from './media-placeholder';\nexport { default as MediaUpload } from './media-upload';\nexport {\n\tMEDIA_TYPE_IMAGE,\n\tMEDIA_TYPE_VIDEO,\n\tMEDIA_TYPE_AUDIO,\n\tMEDIA_TYPE_ANY,\n} from './media-upload/constants';\nexport { default as MediaUploadProgress } from './media-upload-progress';\nexport {\n\tMEDIA_UPLOAD_STATE_UPLOADING,\n\tMEDIA_UPLOAD_STATE_SUCCEEDED,\n\tMEDIA_UPLOAD_STATE_FAILED,\n\tMEDIA_UPLOAD_STATE_RESET,\n} from './media-upload-progress/constants';\nexport { default as BlockMediaUpdateProgress } from './block-media-update-progress';\nexport { default as URLInput } from './url-input';\nexport { default as BlockInvalidWarning } from './block-list/block-invalid-warning';\nexport { default as BlockCaption } from './block-caption';\nexport { default as Caption } from './caption';\nexport { default as PanelColorSettings } from './panel-color-settings';\nexport { default as __experimentalPanelColorGradientSettings } from './colors-gradients/panel-color-gradient-settings';\nexport { useSettings, default as useSetting } from './use-settings';\nexport {\n\tRecursionProvider,\n\tDeprecatedExperimentalRecursionProvider as __experimentalRecursionProvider,\n\tuseHasRecursion,\n\tDeprecatedExperimentalUseHasRecursion as __experimentalUseHasRecursion,\n} from './recursion-provider';\nexport { default as Warning } from './warning';\nexport { default as ContrastChecker } from './contrast-checker';\nexport { default as useMultipleOriginColorsAndGradients } from './colors-gradients/use-multiple-origin-colors-and-gradients';\nexport { default as UnsupportedBlockDetails } from './unsupported-block-details';\n\nexport {\n\tBottomSheetSettings,\n\tBlockSettingsButton,\n\tblockSettingsScreens,\n} from './block-settings';\nexport { default as VideoPlayer, VIDEO_ASPECT_RATIO } from './video-player';\n\nexport {\n\tgetSpacingPresetCssVar,\n\tgetCustomValueFromPreset,\n\tisValueSpacingPreset,\n} from './spacing-sizes-control/utils';\n// Content Related Components.\nexport { default as BlockList } from './block-list';\nexport { default as BlockMover } from './block-mover';\nexport { default as BlockToolbar } from './block-toolbar';\nexport { default as BlockVariationPicker } from './block-variation-picker';\nexport { default as BlockStyles } from './block-styles';\nexport { default as DefaultBlockAppender } from './default-block-appender';\nexport { default as __unstableEditorStyles } from './editor-styles';\nexport { default as Inserter } from './inserter';\nexport { default as InserterButton } from './inserter-button';\nexport { useBlockProps } from './block-list/use-block-props';\nexport { default as FloatingToolbar } from './floating-toolbar';\n\n// State Related Components.\nexport { default as BlockEditorProvider } from './provider';\n"],"mappings":"AAAA;AACA,SACCA,qBAAqB,EACrBC,qBAAqB,QACf,2BAA2B;AAClC,SAASC,oBAAoB,QAAQ,iBAAiB;AACtD,SACCC,OAAO,IAAIC,aAAa,EACxBC,mBAAmB,QACb,kBAAkB;AACzB,SAASF,OAAO,IAAIG,SAAS,EAAEC,mBAAmB,QAAQ,cAAc;AACxE,SAASJ,OAAO,IAAIK,SAAS,QAAQ,cAAc;AACnD,SACCC,6BAA6B,EAC7BC,6BAA6B,QACvB,oCAAoC;AAC3C,cAAc,UAAU;AACxB,cAAc,aAAa;AAC3B,cAAc,cAAc;AAC5B,SAASC,gBAAgB,EAAEC,gBAAgB,QAAQ,qBAAqB;AACxE,SAAST,OAAO,IAAIU,WAAW,EAAEC,mBAAmB,QAAQ,gBAAgB;AAC5E,SACCX,OAAO,IAAIY,iBAAiB,EAC5BC,yBAAyB,QACnB,sBAAsB;AAC7B,SACCC,cAAc,EACdC,qBAAqB,QACf,2BAA2B;AAClC,SAASf,OAAO,IAAIgB,iBAAiB,QAAQ,uBAAuB;AACpE,SAAShB,OAAO,IAAIiB,oBAAoB,QAAQ,gCAAgC;AAChF,SAASjB,OAAO,IAAIkB,SAAS,QAAQ,cAAc;AACnD,SACClB,OAAO,IAAImB,QAAQ,EACnBC,gBAAgB,EAChBC,qBAAqB,EACrBC,4BAA4B,QACtB,aAAa;AACpB,SAAStB,OAAO,IAAIuB,gBAAgB,QAAQ,sBAAsB;AAClE,SAASvB,OAAO,IAAIwB,gBAAgB,QAAQ,qBAAqB;AACjE,SAASxB,OAAO,IAAIyB,WAAW,QAAQ,gBAAgB;AACvD,SACCC,gBAAgB,EAChBC,gBAAgB,EAChBC,gBAAgB,EAChBC,cAAc,QACR,0BAA0B;AACjC,SAAS7B,OAAO,IAAI8B,mBAAmB,QAAQ,yBAAyB;AACxE,SACCC,4BAA4B,EAC5BC,4BAA4B,EAC5BC,yBAAyB,EACzBC,wBAAwB,QAClB,mCAAmC;AAC1C,
|
|
1
|
+
{"version":3,"names":["BlockAlignmentControl","BlockAlignmentToolbar","BlockContextProvider","default","BlockControls","BlockFormatControls","BlockEdit","useBlockEditContext","BlockIcon","BlockVerticalAlignmentToolbar","BlockVerticalAlignmentControl","AlignmentControl","AlignmentToolbar","InnerBlocks","useInnerBlocksProps","InspectorControls","InspectorAdvancedControls","JustifyToolbar","JustifyContentControl","LineHeightControl","HeadingLevelDropdown","PlainText","RichText","RichTextShortcut","RichTextToolbarButton","__unstableRichTextInputEvent","MediaReplaceFlow","MediaPlaceholder","MediaUpload","MEDIA_TYPE_IMAGE","MEDIA_TYPE_VIDEO","MEDIA_TYPE_AUDIO","MEDIA_TYPE_ANY","MediaUploadProgress","MEDIA_UPLOAD_STATE_UPLOADING","MEDIA_UPLOAD_STATE_SUCCEEDED","MEDIA_UPLOAD_STATE_PAUSED","MEDIA_UPLOAD_STATE_FAILED","MEDIA_UPLOAD_STATE_RESET","BlockMediaUpdateProgress","URLInput","BlockInvalidWarning","BlockCaption","Caption","PanelColorSettings","__experimentalPanelColorGradientSettings","useSettings","useSetting","RecursionProvider","DeprecatedExperimentalRecursionProvider","__experimentalRecursionProvider","useHasRecursion","DeprecatedExperimentalUseHasRecursion","__experimentalUseHasRecursion","Warning","ContrastChecker","useMultipleOriginColorsAndGradients","UnsupportedBlockDetails","BottomSheetSettings","BlockSettingsButton","blockSettingsScreens","VideoPlayer","VIDEO_ASPECT_RATIO","getSpacingPresetCssVar","getCustomValueFromPreset","isValueSpacingPreset","BlockList","BlockMover","BlockToolbar","BlockVariationPicker","BlockStyles","DefaultBlockAppender","__unstableEditorStyles","Inserter","InserterButton","useBlockProps","FloatingToolbar","BlockEditorProvider"],"sources":["@wordpress/block-editor/src/components/index.native.js"],"sourcesContent":["// Block Creation Components.\nexport {\n\tBlockAlignmentControl,\n\tBlockAlignmentToolbar,\n} from './block-alignment-control';\nexport { BlockContextProvider } from './block-context';\nexport {\n\tdefault as BlockControls,\n\tBlockFormatControls,\n} from './block-controls';\nexport { default as BlockEdit, useBlockEditContext } from './block-edit';\nexport { default as BlockIcon } from './block-icon';\nexport {\n\tBlockVerticalAlignmentToolbar,\n\tBlockVerticalAlignmentControl,\n} from './block-vertical-alignment-control';\nexport * from './colors';\nexport * from './gradients';\nexport * from './font-sizes';\nexport { AlignmentControl, AlignmentToolbar } from './alignment-control';\nexport { default as InnerBlocks, useInnerBlocksProps } from './inner-blocks';\nexport {\n\tdefault as InspectorControls,\n\tInspectorAdvancedControls,\n} from './inspector-controls';\nexport {\n\tJustifyToolbar,\n\tJustifyContentControl,\n} from './justify-content-control';\nexport { default as LineHeightControl } from './line-height-control';\nexport { default as HeadingLevelDropdown } from './block-heading-level-dropdown';\nexport { default as PlainText } from './plain-text';\nexport {\n\tdefault as RichText,\n\tRichTextShortcut,\n\tRichTextToolbarButton,\n\t__unstableRichTextInputEvent,\n} from './rich-text';\nexport { default as MediaReplaceFlow } from './media-replace-flow';\nexport { default as MediaPlaceholder } from './media-placeholder';\nexport { default as MediaUpload } from './media-upload';\nexport {\n\tMEDIA_TYPE_IMAGE,\n\tMEDIA_TYPE_VIDEO,\n\tMEDIA_TYPE_AUDIO,\n\tMEDIA_TYPE_ANY,\n} from './media-upload/constants';\nexport { default as MediaUploadProgress } from './media-upload-progress';\nexport {\n\tMEDIA_UPLOAD_STATE_UPLOADING,\n\tMEDIA_UPLOAD_STATE_SUCCEEDED,\n\tMEDIA_UPLOAD_STATE_PAUSED,\n\tMEDIA_UPLOAD_STATE_FAILED,\n\tMEDIA_UPLOAD_STATE_RESET,\n} from './media-upload-progress/constants';\nexport { default as BlockMediaUpdateProgress } from './block-media-update-progress';\nexport { default as URLInput } from './url-input';\nexport { default as BlockInvalidWarning } from './block-list/block-invalid-warning';\nexport { default as BlockCaption } from './block-caption';\nexport { default as Caption } from './caption';\nexport { default as PanelColorSettings } from './panel-color-settings';\nexport { default as __experimentalPanelColorGradientSettings } from './colors-gradients/panel-color-gradient-settings';\nexport { useSettings, default as useSetting } from './use-settings';\nexport {\n\tRecursionProvider,\n\tDeprecatedExperimentalRecursionProvider as __experimentalRecursionProvider,\n\tuseHasRecursion,\n\tDeprecatedExperimentalUseHasRecursion as __experimentalUseHasRecursion,\n} from './recursion-provider';\nexport { default as Warning } from './warning';\nexport { default as ContrastChecker } from './contrast-checker';\nexport { default as useMultipleOriginColorsAndGradients } from './colors-gradients/use-multiple-origin-colors-and-gradients';\nexport { default as UnsupportedBlockDetails } from './unsupported-block-details';\n\nexport {\n\tBottomSheetSettings,\n\tBlockSettingsButton,\n\tblockSettingsScreens,\n} from './block-settings';\nexport { default as VideoPlayer, VIDEO_ASPECT_RATIO } from './video-player';\n\nexport {\n\tgetSpacingPresetCssVar,\n\tgetCustomValueFromPreset,\n\tisValueSpacingPreset,\n} from './spacing-sizes-control/utils';\n// Content Related Components.\nexport { default as BlockList } from './block-list';\nexport { default as BlockMover } from './block-mover';\nexport { default as BlockToolbar } from './block-toolbar';\nexport { default as BlockVariationPicker } from './block-variation-picker';\nexport { default as BlockStyles } from './block-styles';\nexport { default as DefaultBlockAppender } from './default-block-appender';\nexport { default as __unstableEditorStyles } from './editor-styles';\nexport { default as Inserter } from './inserter';\nexport { default as InserterButton } from './inserter-button';\nexport { useBlockProps } from './block-list/use-block-props';\nexport { default as FloatingToolbar } from './floating-toolbar';\n\n// State Related Components.\nexport { default as BlockEditorProvider } from './provider';\n"],"mappings":"AAAA;AACA,SACCA,qBAAqB,EACrBC,qBAAqB,QACf,2BAA2B;AAClC,SAASC,oBAAoB,QAAQ,iBAAiB;AACtD,SACCC,OAAO,IAAIC,aAAa,EACxBC,mBAAmB,QACb,kBAAkB;AACzB,SAASF,OAAO,IAAIG,SAAS,EAAEC,mBAAmB,QAAQ,cAAc;AACxE,SAASJ,OAAO,IAAIK,SAAS,QAAQ,cAAc;AACnD,SACCC,6BAA6B,EAC7BC,6BAA6B,QACvB,oCAAoC;AAC3C,cAAc,UAAU;AACxB,cAAc,aAAa;AAC3B,cAAc,cAAc;AAC5B,SAASC,gBAAgB,EAAEC,gBAAgB,QAAQ,qBAAqB;AACxE,SAAST,OAAO,IAAIU,WAAW,EAAEC,mBAAmB,QAAQ,gBAAgB;AAC5E,SACCX,OAAO,IAAIY,iBAAiB,EAC5BC,yBAAyB,QACnB,sBAAsB;AAC7B,SACCC,cAAc,EACdC,qBAAqB,QACf,2BAA2B;AAClC,SAASf,OAAO,IAAIgB,iBAAiB,QAAQ,uBAAuB;AACpE,SAAShB,OAAO,IAAIiB,oBAAoB,QAAQ,gCAAgC;AAChF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QAAQ,6BAA6B;AAEhF,SACCC,mBAAmB,EACnBC,mBAAmB,EACnBC,oBAAoB,QACd,kBAAkB;AACzB,SAASzD,OAAO,IAAI0D,WAAW,EAAEC,kBAAkB,QAAQ,gBAAgB;AAE3E,SACCC,sBAAsB,EACtBC,wBAAwB,EACxBC,oBAAoB,QACd,+BAA+B;AACtC;AACA,SAAS9D,OAAO,IAAI+D,SAAS,QAAQ,cAAc;AACnD,SAAS/D,OAAO,IAAIgE,UAAU,QAAQ,eAAe;AACrD,SAAShE,OAAO,IAAIiE,YAAY,QAAQ,iBAAiB;AACzD,SAASjE,OAAO,IAAIkE,oBAAoB,QAAQ,0BAA0B;AAC1E,SAASlE,OAAO,IAAImE,WAAW,QAAQ,gBAAgB;AACvD,SAASnE,OAAO,IAAIoE,oBAAoB,QAAQ,0BAA0B;AAC1E,SAASpE,OAAO,IAAIqE,sBAAsB,QAAQ,iBAAiB;AACnE,SAASrE,OAAO,IAAIsE,QAAQ,QAAQ,YAAY;AAChD,SAAStE,OAAO,IAAIuE,cAAc,QAAQ,mBAAmB;AAC7D,SAASC,aAAa,QAAQ,8BAA8B;AAC5D,SAASxE,OAAO,IAAIyE,eAAe,QAAQ,oBAAoB;;AAE/D;AACA,SAASzE,OAAO,IAAI0E,mBAAmB,QAAQ,YAAY"}
|
|
@@ -36,11 +36,11 @@ function useShallowMemo(value) {
|
|
|
36
36
|
* in inner blocks.
|
|
37
37
|
* @param {string[]} prioritizedInserterBlocks Block names and/or block variations to be prioritized in the inserter, in the format {blockName}/{variationName}.
|
|
38
38
|
* @param {?WPDirectInsertBlock} defaultBlock The default block to insert: [ blockName, { blockAttributes } ].
|
|
39
|
-
* @param {?
|
|
39
|
+
* @param {?boolean} directInsert If a default block should be inserted directly by the appender.
|
|
40
40
|
*
|
|
41
41
|
* @param {?WPDirectInsertBlock} __experimentalDefaultBlock A deprecated prop for the default block to insert: [ blockName, { blockAttributes } ]. Use `defaultBlock` instead.
|
|
42
42
|
*
|
|
43
|
-
* @param {?
|
|
43
|
+
* @param {?boolean} __experimentalDirectInsert A deprecated prop for whether a default block should be inserted directly by the appender. Use `directInsert` instead.
|
|
44
44
|
*
|
|
45
45
|
* @param {string} [templateLock] The template lock specified for the inner
|
|
46
46
|
* blocks component. (e.g. "all")
|
|
@@ -113,6 +113,12 @@ export default function useNestedSettingsUpdate(clientId, parentLock, allowedBlo
|
|
|
113
113
|
if (directInsert !== undefined) {
|
|
114
114
|
newSettings.directInsert = directInsert;
|
|
115
115
|
}
|
|
116
|
+
if (newSettings.directInsert !== undefined && typeof newSettings.directInsert !== 'boolean') {
|
|
117
|
+
deprecated('Using `Function` as a `directInsert` argument', {
|
|
118
|
+
alternative: '`boolean` values',
|
|
119
|
+
since: '6.5'
|
|
120
|
+
});
|
|
121
|
+
}
|
|
116
122
|
|
|
117
123
|
// Batch updates to block list settings to avoid triggering cascading renders
|
|
118
124
|
// for each container block included in a tree and optimize initial render.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useLayoutEffect","useMemo","useState","useDispatch","useRegistry","deprecated","isShallowEqual","store","blockEditorStore","getLayoutType","pendingSettingsUpdates","WeakMap","useShallowMemo","value","prevValue","setPrevValue","useNestedSettingsUpdate","clientId","parentLock","allowedBlocks","prioritizedInserterBlocks","defaultBlock","directInsert","__experimentalDefaultBlock","__experimentalDirectInsert","templateLock","captureToolbars","orientation","layout","updateBlockListSettings","registry","_allowedBlocks","_prioritizedInserterBlocks","_templateLock","undefined","newSettings","__experimentalCaptureToolbars","layoutType","type","getOrientation","alternative","since","version","get","set","push","window","queueMicrotask","length","batch","forEach","args"],"sources":["@wordpress/block-editor/src/components/inner-blocks/use-nested-settings-update.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useLayoutEffect, useMemo, useState } from '@wordpress/element';\nimport { useDispatch, useRegistry } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport isShallowEqual from '@wordpress/is-shallow-equal';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { getLayoutType } from '../../layouts';\n\n/** @typedef {import('../../selectors').WPDirectInsertBlock } WPDirectInsertBlock */\n\nconst pendingSettingsUpdates = new WeakMap();\n\nfunction useShallowMemo( value ) {\n\tconst [ prevValue, setPrevValue ] = useState( value );\n\tif ( ! isShallowEqual( prevValue, value ) ) {\n\t\tsetPrevValue( value );\n\t}\n\treturn prevValue;\n}\n\n/**\n * This hook is a side effect which updates the block-editor store when changes\n * happen to inner block settings. The given props are transformed into a\n * settings object, and if that is different from the current settings object in\n * the block-editor store, then the store is updated with the new settings which\n * came from props.\n *\n * @param {string} clientId The client ID of the block to update.\n * @param {string} parentLock\n * @param {string[]} allowedBlocks An array of block names which are permitted\n * in inner blocks.\n * @param {string[]} prioritizedInserterBlocks Block names and/or block variations to be prioritized in the inserter, in the format {blockName}/{variationName}.\n * @param {?WPDirectInsertBlock} defaultBlock The default block to insert: [ blockName, { blockAttributes } ].\n * @param {?Function|boolean} directInsert If a default block should be inserted directly by the appender.\n *\n * @param {?WPDirectInsertBlock} __experimentalDefaultBlock A deprecated prop for the default block to insert: [ blockName, { blockAttributes } ]. Use `defaultBlock` instead.\n *\n * @param {?Function|boolean} __experimentalDirectInsert A deprecated prop for whether a default block should be inserted directly by the appender. Use `directInsert` instead.\n *\n * @param {string} [templateLock] The template lock specified for the inner\n * blocks component. (e.g. \"all\")\n * @param {boolean} captureToolbars Whether or children toolbars should be shown\n * in the inner blocks component rather than on\n * the child block.\n * @param {string} orientation The direction in which the block\n * should face.\n * @param {Object} layout The layout object for the block container.\n */\nexport default function useNestedSettingsUpdate(\n\tclientId,\n\tparentLock,\n\tallowedBlocks,\n\tprioritizedInserterBlocks,\n\tdefaultBlock,\n\tdirectInsert,\n\t__experimentalDefaultBlock,\n\t__experimentalDirectInsert,\n\ttemplateLock,\n\tcaptureToolbars,\n\torientation,\n\tlayout\n) {\n\t// Instead of adding a useSelect mapping here, please add to the useSelect\n\t// mapping in InnerBlocks! Every subscription impacts performance.\n\n\tconst { updateBlockListSettings } = useDispatch( blockEditorStore );\n\tconst registry = useRegistry();\n\n\t// Implementors often pass a new array on every render,\n\t// and the contents of the arrays are just strings, so the entire array\n\t// can be passed as dependencies but We need to include the length of the array,\n\t// otherwise if the arrays change length but the first elements are equal the comparison,\n\t// does not works as expected.\n\tconst _allowedBlocks = useShallowMemo( allowedBlocks );\n\n\tconst _prioritizedInserterBlocks = useMemo(\n\t\t() => prioritizedInserterBlocks,\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\tprioritizedInserterBlocks\n\t);\n\n\tconst _templateLock =\n\t\ttemplateLock === undefined || parentLock === 'contentOnly'\n\t\t\t? parentLock\n\t\t\t: templateLock;\n\n\tuseLayoutEffect( () => {\n\t\tconst newSettings = {\n\t\t\tallowedBlocks: _allowedBlocks,\n\t\t\tprioritizedInserterBlocks: _prioritizedInserterBlocks,\n\t\t\ttemplateLock: _templateLock,\n\t\t};\n\n\t\t// These values are not defined for RN, so only include them if they\n\t\t// are defined.\n\t\tif ( captureToolbars !== undefined ) {\n\t\t\tnewSettings.__experimentalCaptureToolbars = captureToolbars;\n\t\t}\n\n\t\t// Orientation depends on layout,\n\t\t// ideally the separate orientation prop should be deprecated.\n\t\tif ( orientation !== undefined ) {\n\t\t\tnewSettings.orientation = orientation;\n\t\t} else {\n\t\t\tconst layoutType = getLayoutType( layout?.type );\n\t\t\tnewSettings.orientation = layoutType.getOrientation( layout );\n\t\t}\n\n\t\tif ( __experimentalDefaultBlock !== undefined ) {\n\t\t\tdeprecated( '__experimentalDefaultBlock', {\n\t\t\t\talternative: 'defaultBlock',\n\t\t\t\tsince: '6.3',\n\t\t\t\tversion: '6.4',\n\t\t\t} );\n\t\t\tnewSettings.defaultBlock = __experimentalDefaultBlock;\n\t\t}\n\n\t\tif ( defaultBlock !== undefined ) {\n\t\t\tnewSettings.defaultBlock = defaultBlock;\n\t\t}\n\n\t\tif ( __experimentalDirectInsert !== undefined ) {\n\t\t\tdeprecated( '__experimentalDirectInsert', {\n\t\t\t\talternative: 'directInsert',\n\t\t\t\tsince: '6.3',\n\t\t\t\tversion: '6.4',\n\t\t\t} );\n\t\t\tnewSettings.directInsert = __experimentalDirectInsert;\n\t\t}\n\n\t\tif ( directInsert !== undefined ) {\n\t\t\tnewSettings.directInsert = directInsert;\n\t\t}\n\n\t\t// Batch updates to block list settings to avoid triggering cascading renders\n\t\t// for each container block included in a tree and optimize initial render.\n\t\t// To avoid triggering updateBlockListSettings for each container block\n\t\t// causing X re-renderings for X container blocks,\n\t\t// we batch all the updatedBlockListSettings in a single \"data\" batch\n\t\t// which results in a single re-render.\n\t\tif ( ! pendingSettingsUpdates.get( registry ) ) {\n\t\t\tpendingSettingsUpdates.set( registry, [] );\n\t\t}\n\t\tpendingSettingsUpdates\n\t\t\t.get( registry )\n\t\t\t.push( [ clientId, newSettings ] );\n\t\twindow.queueMicrotask( () => {\n\t\t\tif ( pendingSettingsUpdates.get( registry )?.length ) {\n\t\t\t\tregistry.batch( () => {\n\t\t\t\t\tpendingSettingsUpdates\n\t\t\t\t\t\t.get( registry )\n\t\t\t\t\t\t.forEach( ( args ) => {\n\t\t\t\t\t\t\tupdateBlockListSettings( ...args );\n\t\t\t\t\t\t} );\n\t\t\t\t\tpendingSettingsUpdates.set( registry, [] );\n\t\t\t\t} );\n\t\t\t}\n\t\t} );\n\t}, [\n\t\tclientId,\n\t\t_allowedBlocks,\n\t\t_prioritizedInserterBlocks,\n\t\t_templateLock,\n\t\tdefaultBlock,\n\t\tdirectInsert,\n\t\t__experimentalDefaultBlock,\n\t\t__experimentalDirectInsert,\n\t\tcaptureToolbars,\n\t\torientation,\n\t\tupdateBlockListSettings,\n\t\tlayout,\n\t\tregistry,\n\t] );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,eAAe,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,oBAAoB;AACvE,SAASC,WAAW,EAAEC,WAAW,QAAQ,iBAAiB;AAC1D,OA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b,QAAS,CAAC,CACfe,IAAI,CAAE,CAAE5B,QAAQ,EAAEkB,WAAW,CAAG,CAAC;IACnCW,MAAM,CAACC,cAAc,CAAE,MAAM;MAC5B,IAAKrC,sBAAsB,CAACiC,GAAG,CAAEb,QAAS,CAAC,EAAEkB,MAAM,EAAG;QACrDlB,QAAQ,CAACmB,KAAK,CAAE,MAAM;UACrBvC,sBAAsB,CACpBiC,GAAG,CAAEb,QAAS,CAAC,CACfoB,OAAO,CAAIC,IAAI,IAAM;YACrBtB,uBAAuB,CAAE,GAAGsB,IAAK,CAAC;UACnC,CAAE,CAAC;UACJzC,sBAAsB,CAACkC,GAAG,CAAEd,QAAQ,EAAE,EAAG,CAAC;QAC3C,CAAE,CAAC;MACJ;IACD,CAAE,CAAC;EACJ,CAAC,EAAE,CACFb,QAAQ,EACRc,cAAc,EACdC,0BAA0B,EAC1BC,aAAa,EACbZ,YAAY,EACZC,YAAY,EACZC,0BAA0B,EAC1BC,0BAA0B,EAC1BE,eAAe,EACfC,WAAW,EACXE,uBAAuB,EACvBD,MAAM,EACNE,QAAQ,CACP,CAAC;AACJ"}
|
|
1
|
+
{"version":3,"names":["useLayoutEffect","useMemo","useState","useDispatch","useRegistry","deprecated","isShallowEqual","store","blockEditorStore","getLayoutType","pendingSettingsUpdates","WeakMap","useShallowMemo","value","prevValue","setPrevValue","useNestedSettingsUpdate","clientId","parentLock","allowedBlocks","prioritizedInserterBlocks","defaultBlock","directInsert","__experimentalDefaultBlock","__experimentalDirectInsert","templateLock","captureToolbars","orientation","layout","updateBlockListSettings","registry","_allowedBlocks","_prioritizedInserterBlocks","_templateLock","undefined","newSettings","__experimentalCaptureToolbars","layoutType","type","getOrientation","alternative","since","version","get","set","push","window","queueMicrotask","length","batch","forEach","args"],"sources":["@wordpress/block-editor/src/components/inner-blocks/use-nested-settings-update.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useLayoutEffect, useMemo, useState } from '@wordpress/element';\nimport { useDispatch, useRegistry } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport isShallowEqual from '@wordpress/is-shallow-equal';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { getLayoutType } from '../../layouts';\n\n/** @typedef {import('../../selectors').WPDirectInsertBlock } WPDirectInsertBlock */\n\nconst pendingSettingsUpdates = new WeakMap();\n\nfunction useShallowMemo( value ) {\n\tconst [ prevValue, setPrevValue ] = useState( value );\n\tif ( ! isShallowEqual( prevValue, value ) ) {\n\t\tsetPrevValue( value );\n\t}\n\treturn prevValue;\n}\n\n/**\n * This hook is a side effect which updates the block-editor store when changes\n * happen to inner block settings. The given props are transformed into a\n * settings object, and if that is different from the current settings object in\n * the block-editor store, then the store is updated with the new settings which\n * came from props.\n *\n * @param {string} clientId The client ID of the block to update.\n * @param {string} parentLock\n * @param {string[]} allowedBlocks An array of block names which are permitted\n * in inner blocks.\n * @param {string[]} prioritizedInserterBlocks Block names and/or block variations to be prioritized in the inserter, in the format {blockName}/{variationName}.\n * @param {?WPDirectInsertBlock} defaultBlock The default block to insert: [ blockName, { blockAttributes } ].\n * @param {?boolean} directInsert If a default block should be inserted directly by the appender.\n *\n * @param {?WPDirectInsertBlock} __experimentalDefaultBlock A deprecated prop for the default block to insert: [ blockName, { blockAttributes } ]. Use `defaultBlock` instead.\n *\n * @param {?boolean} __experimentalDirectInsert A deprecated prop for whether a default block should be inserted directly by the appender. Use `directInsert` instead.\n *\n * @param {string} [templateLock] The template lock specified for the inner\n * blocks component. (e.g. \"all\")\n * @param {boolean} captureToolbars Whether or children toolbars should be shown\n * in the inner blocks component rather than on\n * the child block.\n * @param {string} orientation The direction in which the block\n * should face.\n * @param {Object} layout The layout object for the block container.\n */\nexport default function useNestedSettingsUpdate(\n\tclientId,\n\tparentLock,\n\tallowedBlocks,\n\tprioritizedInserterBlocks,\n\tdefaultBlock,\n\tdirectInsert,\n\t__experimentalDefaultBlock,\n\t__experimentalDirectInsert,\n\ttemplateLock,\n\tcaptureToolbars,\n\torientation,\n\tlayout\n) {\n\t// Instead of adding a useSelect mapping here, please add to the useSelect\n\t// mapping in InnerBlocks! Every subscription impacts performance.\n\n\tconst { updateBlockListSettings } = useDispatch( blockEditorStore );\n\tconst registry = useRegistry();\n\n\t// Implementors often pass a new array on every render,\n\t// and the contents of the arrays are just strings, so the entire array\n\t// can be passed as dependencies but We need to include the length of the array,\n\t// otherwise if the arrays change length but the first elements are equal the comparison,\n\t// does not works as expected.\n\tconst _allowedBlocks = useShallowMemo( allowedBlocks );\n\n\tconst _prioritizedInserterBlocks = useMemo(\n\t\t() => prioritizedInserterBlocks,\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\tprioritizedInserterBlocks\n\t);\n\n\tconst _templateLock =\n\t\ttemplateLock === undefined || parentLock === 'contentOnly'\n\t\t\t? parentLock\n\t\t\t: templateLock;\n\n\tuseLayoutEffect( () => {\n\t\tconst newSettings = {\n\t\t\tallowedBlocks: _allowedBlocks,\n\t\t\tprioritizedInserterBlocks: _prioritizedInserterBlocks,\n\t\t\ttemplateLock: _templateLock,\n\t\t};\n\n\t\t// These values are not defined for RN, so only include them if they\n\t\t// are defined.\n\t\tif ( captureToolbars !== undefined ) {\n\t\t\tnewSettings.__experimentalCaptureToolbars = captureToolbars;\n\t\t}\n\n\t\t// Orientation depends on layout,\n\t\t// ideally the separate orientation prop should be deprecated.\n\t\tif ( orientation !== undefined ) {\n\t\t\tnewSettings.orientation = orientation;\n\t\t} else {\n\t\t\tconst layoutType = getLayoutType( layout?.type );\n\t\t\tnewSettings.orientation = layoutType.getOrientation( layout );\n\t\t}\n\n\t\tif ( __experimentalDefaultBlock !== undefined ) {\n\t\t\tdeprecated( '__experimentalDefaultBlock', {\n\t\t\t\talternative: 'defaultBlock',\n\t\t\t\tsince: '6.3',\n\t\t\t\tversion: '6.4',\n\t\t\t} );\n\t\t\tnewSettings.defaultBlock = __experimentalDefaultBlock;\n\t\t}\n\n\t\tif ( defaultBlock !== undefined ) {\n\t\t\tnewSettings.defaultBlock = defaultBlock;\n\t\t}\n\n\t\tif ( __experimentalDirectInsert !== undefined ) {\n\t\t\tdeprecated( '__experimentalDirectInsert', {\n\t\t\t\talternative: 'directInsert',\n\t\t\t\tsince: '6.3',\n\t\t\t\tversion: '6.4',\n\t\t\t} );\n\t\t\tnewSettings.directInsert = __experimentalDirectInsert;\n\t\t}\n\n\t\tif ( directInsert !== undefined ) {\n\t\t\tnewSettings.directInsert = directInsert;\n\t\t}\n\n\t\tif (\n\t\t\tnewSettings.directInsert !== undefined &&\n\t\t\ttypeof newSettings.directInsert !== 'boolean'\n\t\t) {\n\t\t\tdeprecated( 'Using `Function` as a `directInsert` argument', {\n\t\t\t\talternative: '`boolean` values',\n\t\t\t\tsince: '6.5',\n\t\t\t} );\n\t\t}\n\n\t\t// Batch updates to block list settings to avoid triggering cascading renders\n\t\t// for each container block included in a tree and optimize initial render.\n\t\t// To avoid triggering updateBlockListSettings for each container block\n\t\t// causing X re-renderings for X container blocks,\n\t\t// we batch all the updatedBlockListSettings in a single \"data\" batch\n\t\t// which results in a single re-render.\n\t\tif ( ! pendingSettingsUpdates.get( registry ) ) {\n\t\t\tpendingSettingsUpdates.set( registry, [] );\n\t\t}\n\t\tpendingSettingsUpdates\n\t\t\t.get( registry )\n\t\t\t.push( [ clientId, newSettings ] );\n\t\twindow.queueMicrotask( () => {\n\t\t\tif ( pendingSettingsUpdates.get( registry )?.length ) {\n\t\t\t\tregistry.batch( () => {\n\t\t\t\t\tpendingSettingsUpdates\n\t\t\t\t\t\t.get( registry )\n\t\t\t\t\t\t.forEach( ( args ) => {\n\t\t\t\t\t\t\tupdateBlockListSettings( ...args );\n\t\t\t\t\t\t} );\n\t\t\t\t\tpendingSettingsUpdates.set( registry, [] );\n\t\t\t\t} );\n\t\t\t}\n\t\t} );\n\t}, [\n\t\tclientId,\n\t\t_allowedBlocks,\n\t\t_prioritizedInserterBlocks,\n\t\t_templateLock,\n\t\tdefaultBlock,\n\t\tdirectInsert,\n\t\t__experimentalDefaultBlock,\n\t\t__experimentalDirectInsert,\n\t\tcaptureToolbars,\n\t\torientation,\n\t\tupdateBlockListSettings,\n\t\tlayout,\n\t\tregistry,\n\t] );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,eAAe,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,oBAAoB;AACvE,SAASC,WAAW,EAAEC,WAAW,QAAQ,iBAAiB;AAC1D,OAAOC,UAAU,MAAM,uBAAuB;AAC9C,OAAOC,cAAc,MAAM,6BAA6B;;AAExD;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AACvD,SAASC,aAAa,QAAQ,eAAe;;AAE7C;;AAEA,MAAMC,sBAAsB,GAAG,IAAIC,OAAO,CAAC,CAAC;AAE5C,SAASC,cAAcA,CAAEC,KAAK,EAAG;EAChC,MAAM,CAAEC,SAAS,EAAEC,YAAY,CAAE,GAAGb,QAAQ,CAAEW,KAAM,CAAC;EACrD,IAAK,CAAEP,cAAc,CAAEQ,SAAS,EAAED,KAAM,CAAC,EAAG;IAC3CE,YAAY,CAAEF,KAAM,CAAC;EACtB;EACA,OAAOC,SAAS;AACjB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASE,uBAAuBA,CAC9CC,QAAQ,EACRC,UAAU,EACVC,aAAa,EACbC,yBAAyB,EACzBC,YAAY,EACZC,YAAY,EACZC,0BAA0B,EAC1BC,0BAA0B,EAC1BC,YAAY,EACZC,eAAe,EACfC,WAAW,EACXC,MAAM,EACL;EACD;EACA;;EAEA,MAAM;IAAEC;EAAwB,CAAC,GAAG1B,WAAW,CAAEK,gBAAiB,CAAC;EACnE,MAAMsB,QAAQ,GAAG1B,WAAW,CAAC,CAAC;;EAE9B;EACA;EACA;EACA;EACA;EACA,MA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downMenu","MenuGroup","MenuItem","Spinner","Modal","Flex","FlexItem","Button","privateApis","componentsPrivateApis","__experimentalVStack","VStack","__","sprintf","useMemo","useCallback","useState","cloneBlock","moreVertical","external","useSelect","useDispatch","store","noticesStore","isBlobURL","InserterDraggableBlocks","getBlockAndPreviewFromMedia","blockEditorStore","unlock","ALLOWED_MEDIA_TYPES","MAXIMUM_TITLE_LENGTH","MEDIA_OPTIONS_POPOVER_PROPS","position","className","CompositeItemV2","CompositeItem","MediaPreviewOptions","category","media","getReportUrl","reportUrl","createElement","label","popoverProps","icon","onClick","window","open","focus","mediaType","InsertExternalImageModal","onClose","onSubmit","title","onRequestClose","spacing","justify","expanded","variant","MediaPreview","showExternalUploadModal","setShowExternalUploadModal","isHovered","setIsHovered","isInserting","setIsInserting","block","preview","createErrorNotice","createSuccessNotice","mediaUpload","select","getSettings","onMediaInsert","previewBlock","clonedBlock","id","url","caption","attributes","fetch","then","response","blob","filesList","additionalData","onFileChange","img","type","allowedTypes","onError","message","catch","rendered","truncatedTitle","length","omission","slice","onMouseEnter","onMouseLeave","Fragment","isEnabled","blocks","draggable","onDragStart","onDragEnd","text","render","role"],"sources":["@wordpress/block-editor/src/components/inserter/media-tab/media-preview.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tTooltip,\n\tDropdownMenu,\n\tMenuGroup,\n\tMenuItem,\n\tSpinner,\n\tModal,\n\tFlex,\n\tFlexItem,\n\tButton,\n\tprivateApis as componentsPrivateApis,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useMemo, useCallback, useState } from '@wordpress/element';\nimport { cloneBlock } from '@wordpress/blocks';\nimport { moreVertical, external } from '@wordpress/icons';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { isBlobURL } from '@wordpress/blob';\n\n/**\n * Internal dependencies\n */\nimport InserterDraggableBlocks from '../../inserter-draggable-blocks';\nimport { getBlockAndPreviewFromMedia } from './utils';\nimport { store as blockEditorStore } from '../../../store';\nimport { unlock } from '../../../lock-unlock';\n\nconst ALLOWED_MEDIA_TYPES = [ 'image' ];\nconst MAXIMUM_TITLE_LENGTH = 25;\nconst MEDIA_OPTIONS_POPOVER_PROPS = {\n\tposition: 'bottom left',\n\tclassName:\n\t\t'block-editor-inserter__media-list__item-preview-options__popover',\n};\n\nconst { CompositeItemV2: CompositeItem } = unlock( componentsPrivateApis );\n\nfunction MediaPreviewOptions( { category, media } ) {\n\tif ( ! category.getReportUrl ) {\n\t\treturn null;\n\t}\n\tconst reportUrl = category.getReportUrl( media );\n\treturn (\n\t\t<DropdownMenu\n\t\t\tclassName=\"block-editor-inserter__media-list__item-preview-options\"\n\t\t\tlabel={ __( 'Options' ) }\n\t\t\tpopoverProps={ MEDIA_OPTIONS_POPOVER_PROPS }\n\t\t\ticon={ moreVertical }\n\t\t>\n\t\t\t{ () => (\n\t\t\t\t<MenuGroup>\n\t\t\t\t\t<MenuItem\n\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\twindow.open( reportUrl, '_blank' ).focus()\n\t\t\t\t\t\t}\n\t\t\t\t\t\ticon={ external }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t/* translators: %s: The media type to report e.g: \"image\", \"video\", \"audio\" */\n\t\t\t\t\t\t\t__( 'Report %s' ),\n\t\t\t\t\t\t\tcategory.mediaType\n\t\t\t\t\t\t) }\n\t\t\t\t\t</MenuItem>\n\t\t\t\t</MenuGroup>\n\t\t\t) }\n\t\t</DropdownMenu>\n\t);\n}\n\nfunction InsertExternalImageModal( { onClose, onSubmit } ) {\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ __( 'Insert external image' ) }\n\t\t\tonRequestClose={ onClose }\n\t\t\tclassName=\"block-editor-inserter-media-tab-media-preview-inserter-external-image-modal\"\n\t\t>\n\t\t\t<VStack spacing={ 3 }>\n\t\t\t\t<p>\n\t\t\t\t\t{ __(\n\t\t\t\t\t\t'This image cannot be uploaded to your Media Library, but it can still be inserted as an external image.'\n\t\t\t\t\t) }\n\t\t\t\t</p>\n\t\t\t\t<p>\n\t\t\t\t\t{ __(\n\t\t\t\t\t\t'External images can be removed by the external provider without warning and could even have legal compliance issues related to privacy legislation.'\n\t\t\t\t\t) }\n\t\t\t\t</p>\n\t\t\t</VStack>\n\t\t\t<Flex\n\t\t\t\tclassName=\"block-editor-block-lock-modal__actions\"\n\t\t\t\tjustify=\"flex-end\"\n\t\t\t\texpanded={ false }\n\t\t\t>\n\t\t\t\t<FlexItem>\n\t\t\t\t\t<Button variant=\"tertiary\" onClick={ onClose }>\n\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</FlexItem>\n\t\t\t\t<FlexItem>\n\t\t\t\t\t<Button variant=\"primary\" onClick={ onSubmit }>\n\t\t\t\t\t\t{ __( 'Insert' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</FlexItem>\n\t\t\t</Flex>\n\t\t</Modal>\n\t);\n}\n\nexport function MediaPreview( { media, onClick, category } ) {\n\tconst [ showExternalUploadModal, setShowExternalUploadModal ] =\n\t\tuseState( false );\n\tconst [ isHovered, setIsHovered ] = useState( false );\n\tconst [ isInserting, setIsInserting ] = useState( false );\n\tconst [ block, preview ] = useMemo(\n\t\t() => getBlockAndPreviewFromMedia( media, category.mediaType ),\n\t\t[ media, category.mediaType ]\n\t);\n\tconst { createErrorNotice, createSuccessNotice } =\n\t\tuseDispatch( noticesStore );\n\tconst mediaUpload = useSelect(\n\t\t( select ) => select( blockEditorStore ).getSettings().mediaUpload,\n\t\t[]\n\t);\n\tconst onMediaInsert = useCallback(\n\t\t( previewBlock ) => {\n\t\t\t// Prevent multiple uploads when we're in the process of inserting.\n\t\t\tif ( isInserting ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst clonedBlock = cloneBlock( previewBlock );\n\t\t\tconst { id, url, caption } = clonedBlock.attributes;\n\t\t\t// Media item already exists in library, so just insert it.\n\t\t\tif ( !! id ) {\n\t\t\t\tonClick( clonedBlock );\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tsetIsInserting( true );\n\t\t\t// Media item does not exist in library, so try to upload it.\n\t\t\t// Fist fetch the image data. This may fail if the image host\n\t\t\t// doesn't allow CORS with the domain.\n\t\t\t// If this happens, we insert the image block using the external\n\t\t\t// URL and let the user know about the possible implications.\n\t\t\twindow\n\t\t\t\t.fetch( url )\n\t\t\t\t.then( ( response ) => response.blob() )\n\t\t\t\t.then( ( blob ) => {\n\t\t\t\t\tmediaUpload( {\n\t\t\t\t\t\tfilesList: [ blob ],\n\t\t\t\t\t\tadditionalData: { caption },\n\t\t\t\t\t\tonFileChange( [ img ] ) {\n\t\t\t\t\t\t\tif ( isBlobURL( img.url ) ) {\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonClick( {\n\t\t\t\t\t\t\t\t...clonedBlock,\n\t\t\t\t\t\t\t\tattributes: {\n\t\t\t\t\t\t\t\t\t...clonedBlock.attributes,\n\t\t\t\t\t\t\t\t\tid: img.id,\n\t\t\t\t\t\t\t\t\turl: img.url,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\t\t\t\t__( 'Image uploaded and inserted.' ),\n\t\t\t\t\t\t\t\t{ type: 'snackbar' }\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tsetIsInserting( false );\n\t\t\t\t\t\t},\n\t\t\t\t\t\tallowedTypes: ALLOWED_MEDIA_TYPES,\n\t\t\t\t\t\tonError( message ) {\n\t\t\t\t\t\t\tcreateErrorNotice( message, { type: 'snackbar' } );\n\t\t\t\t\t\t\tsetIsInserting( false );\n\t\t\t\t\t\t},\n\t\t\t\t\t} );\n\t\t\t\t} )\n\t\t\t\t.catch( () => {\n\t\t\t\t\tsetShowExternalUploadModal( true );\n\t\t\t\t\tsetIsInserting( false );\n\t\t\t\t} );\n\t\t},\n\t\t[\n\t\t\tisInserting,\n\t\t\tonClick,\n\t\t\tmediaUpload,\n\t\t\tcreateErrorNotice,\n\t\t\tcreateSuccessNotice,\n\t\t]\n\t);\n\n\tconst title =\n\t\ttypeof media.title === 'string'\n\t\t\t? media.title\n\t\t\t: media.title?.rendered || __( 'no title' );\n\n\tlet truncatedTitle;\n\tif ( title.length > MAXIMUM_TITLE_LENGTH ) {\n\t\tconst omission = '...';\n\t\ttruncatedTitle =\n\t\t\ttitle.slice( 0, MAXIMUM_TITLE_LENGTH - omission.length ) + omission;\n\t}\n\tconst onMouseEnter = useCallback( () => setIsHovered( true ), [] );\n\tconst onMouseLeave = useCallback( () => setIsHovered( false ), [] );\n\treturn (\n\t\t<>\n\t\t\t<InserterDraggableBlocks isEnabled={ true } blocks={ [ block ] }>\n\t\t\t\t{ ( { draggable, onDragStart, onDragEnd } ) => (\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t'block-editor-inserter__media-list__list-item',\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t'is-hovered': isHovered,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tdraggable={ draggable }\n\t\t\t\t\t\tonDragStart={ onDragStart }\n\t\t\t\t\t\tonDragEnd={ onDragEnd }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ /* Adding `is-hovered` class to the wrapper element is needed\n\t\t\t\t\t\tbecause the options Popover is rendered outside of this node. */ }\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tonMouseEnter={ onMouseEnter }\n\t\t\t\t\t\t\tonMouseLeave={ onMouseLeave }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Tooltip text={ truncatedTitle || title }>\n\t\t\t\t\t\t\t\t<CompositeItem\n\t\t\t\t\t\t\t\t\trender={\n\t\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\t\taria-label={ title }\n\t\t\t\t\t\t\t\t\t\t\trole=\"option\"\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"block-editor-inserter__media-list__item\"\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tonClick={ () => onMediaInsert( block ) }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<div className=\"block-editor-inserter__media-list__item-preview\">\n\t\t\t\t\t\t\t\t\t\t{ preview }\n\t\t\t\t\t\t\t\t\t\t{ isInserting && (\n\t\t\t\t\t\t\t\t\t\t\t<div className=\"block-editor-inserter__media-list__item-preview-spinner\">\n\t\t\t\t\t\t\t\t\t\t\t\t<Spinner />\n\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</CompositeItem>\n\t\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t\t\t{ ! isInserting && (\n\t\t\t\t\t\t\t\t<MediaPreviewOptions\n\t\t\t\t\t\t\t\t\tcategory={ category }\n\t\t\t\t\t\t\t\t\tmedia={ media }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t</InserterDraggableBlocks>\n\t\t\t{ showExternalUploadModal && (\n\t\t\t\t<InsertExternalImageModal\n\t\t\t\t\tonClose={ () => setShowExternalUploadModal( false ) }\n\t\t\t\t\tonSubmit={ () => {\n\t\t\t\t\t\tonClick( cloneBlock( block ) );\n\t\t\t\t\t\tcreateSuccessNotice( __( 'Image inserted.' ), {\n\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t} );\n\t\t\t\t\t\tsetShowExternalUploadModal( false );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\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dvB,aAAA,CAACL,mBAAmB;IACnBC,QAAQ,EAAGA,QAAU;IACrBC,KAAK,EAAGA;EAAO,CACf,CAEE,CACD,CAEkB,CAAC,EACxBsB,uBAAuB,IACxBnB,aAAA,CAACS,wBAAwB;IACxBC,OAAO,EAAGA,CAAA,KAAMU,0BAA0B,CAAE,KAAM,CAAG;IACrDT,QAAQ,EAAGA,CAAA,KAAM;MAChBP,OAAO,CAAE5B,UAAU,CAAEiD,KAAM,CAAE,CAAC;MAC9BG,mBAAmB,CAAEzD,EAAE,CAAE,iBAAkB,CAAC,EAAE;QAC7C4E,IAAI,EAAE;MACP,CAAE,CAAC;MACH3B,0BAA0B,CAAE,KAAM,CAAC;IACpC;EAAG,CACH,CAED,CAAC;AAEL"}
|
|
1
|
+
{"version":3,"names":["classnames","Tooltip","DropdownMenu","MenuGroup","MenuItem","Spinner","Modal","Flex","FlexItem","Button","privateApis","componentsPrivateApis","__experimentalVStack","VStack","__","sprintf","useMemo","useCallback","useState","cloneBlock","moreVertical","external","useSelect","useDispatch","store","noticesStore","isBlobURL","InserterDraggableBlocks","getBlockAndPreviewFromMedia","blockEditorStore","unlock","ALLOWED_MEDIA_TYPES","MAXIMUM_TITLE_LENGTH","MEDIA_OPTIONS_POPOVER_PROPS","position","className","CompositeItemV2","CompositeItem","MediaPreviewOptions","category","media","getReportUrl","reportUrl","createElement","label","popoverProps","icon","onClick","window","open","focus","mediaType","InsertExternalImageModal","onClose","onSubmit","title","onRequestClose","spacing","justify","expanded","variant","MediaPreview","showExternalUploadModal","setShowExternalUploadModal","isHovered","setIsHovered","isInserting","setIsInserting","block","preview","createErrorNotice","createSuccessNotice","mediaUpload","select","getSettings","onMediaInsert","previewBlock","clonedBlock","id","url","caption","attributes","fetch","then","response","blob","filesList","additionalData","onFileChange","img","type","allowedTypes","onError","message","catch","rendered","truncatedTitle","length","omission","slice","onMouseEnter","onMouseLeave","Fragment","isEnabled","blocks","draggable","onDragStart","onDragEnd","text","render","role"],"sources":["@wordpress/block-editor/src/components/inserter/media-tab/media-preview.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tTooltip,\n\tDropdownMenu,\n\tMenuGroup,\n\tMenuItem,\n\tSpinner,\n\tModal,\n\tFlex,\n\tFlexItem,\n\tButton,\n\tprivateApis as componentsPrivateApis,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useMemo, useCallback, useState } from '@wordpress/element';\nimport { cloneBlock } from '@wordpress/blocks';\nimport { moreVertical, external } from '@wordpress/icons';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { isBlobURL } from '@wordpress/blob';\n\n/**\n * Internal dependencies\n */\nimport InserterDraggableBlocks from '../../inserter-draggable-blocks';\nimport { getBlockAndPreviewFromMedia } from './utils';\nimport { store as blockEditorStore } from '../../../store';\nimport { unlock } from '../../../lock-unlock';\n\nconst ALLOWED_MEDIA_TYPES = [ 'image' ];\nconst MAXIMUM_TITLE_LENGTH = 25;\nconst MEDIA_OPTIONS_POPOVER_PROPS = {\n\tposition: 'bottom left',\n\tclassName:\n\t\t'block-editor-inserter__media-list__item-preview-options__popover',\n};\n\nconst { CompositeItemV2: CompositeItem } = unlock( componentsPrivateApis );\n\nfunction MediaPreviewOptions( { category, media } ) {\n\tif ( ! category.getReportUrl ) {\n\t\treturn null;\n\t}\n\tconst reportUrl = category.getReportUrl( media );\n\treturn (\n\t\t<DropdownMenu\n\t\t\tclassName=\"block-editor-inserter__media-list__item-preview-options\"\n\t\t\tlabel={ __( 'Options' ) }\n\t\t\tpopoverProps={ MEDIA_OPTIONS_POPOVER_PROPS }\n\t\t\ticon={ moreVertical }\n\t\t>\n\t\t\t{ () => (\n\t\t\t\t<MenuGroup>\n\t\t\t\t\t<MenuItem\n\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\twindow.open( reportUrl, '_blank' ).focus()\n\t\t\t\t\t\t}\n\t\t\t\t\t\ticon={ external }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t/* translators: %s: The media type to report e.g: \"image\", \"video\", \"audio\" */\n\t\t\t\t\t\t\t__( 'Report %s' ),\n\t\t\t\t\t\t\tcategory.mediaType\n\t\t\t\t\t\t) }\n\t\t\t\t\t</MenuItem>\n\t\t\t\t</MenuGroup>\n\t\t\t) }\n\t\t</DropdownMenu>\n\t);\n}\n\nfunction InsertExternalImageModal( { onClose, onSubmit } ) {\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ __( 'Insert external image' ) }\n\t\t\tonRequestClose={ onClose }\n\t\t\tclassName=\"block-editor-inserter-media-tab-media-preview-inserter-external-image-modal\"\n\t\t>\n\t\t\t<VStack spacing={ 3 }>\n\t\t\t\t<p>\n\t\t\t\t\t{ __(\n\t\t\t\t\t\t'This image cannot be uploaded to your Media Library, but it can still be inserted as an external image.'\n\t\t\t\t\t) }\n\t\t\t\t</p>\n\t\t\t\t<p>\n\t\t\t\t\t{ __(\n\t\t\t\t\t\t'External images can be removed by the external provider without warning and could even have legal compliance issues related to privacy legislation.'\n\t\t\t\t\t) }\n\t\t\t\t</p>\n\t\t\t</VStack>\n\t\t\t<Flex\n\t\t\t\tclassName=\"block-editor-block-lock-modal__actions\"\n\t\t\t\tjustify=\"flex-end\"\n\t\t\t\texpanded={ false }\n\t\t\t>\n\t\t\t\t<FlexItem>\n\t\t\t\t\t<Button variant=\"tertiary\" onClick={ onClose }>\n\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</FlexItem>\n\t\t\t\t<FlexItem>\n\t\t\t\t\t<Button variant=\"primary\" onClick={ onSubmit }>\n\t\t\t\t\t\t{ __( 'Insert' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</FlexItem>\n\t\t\t</Flex>\n\t\t</Modal>\n\t);\n}\n\nexport function MediaPreview( { media, onClick, category } ) {\n\tconst [ showExternalUploadModal, setShowExternalUploadModal ] =\n\t\tuseState( false );\n\tconst [ isHovered, setIsHovered ] = useState( false );\n\tconst [ isInserting, setIsInserting ] = useState( false );\n\tconst [ block, preview ] = useMemo(\n\t\t() => getBlockAndPreviewFromMedia( media, category.mediaType ),\n\t\t[ media, category.mediaType ]\n\t);\n\tconst { createErrorNotice, createSuccessNotice } =\n\t\tuseDispatch( noticesStore );\n\tconst mediaUpload = useSelect(\n\t\t( select ) => select( blockEditorStore ).getSettings().mediaUpload,\n\t\t[]\n\t);\n\tconst onMediaInsert = useCallback(\n\t\t( previewBlock ) => {\n\t\t\t// Prevent multiple uploads when we're in the process of inserting.\n\t\t\tif ( isInserting ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst clonedBlock = cloneBlock( previewBlock );\n\t\t\tconst { id, url, caption } = clonedBlock.attributes;\n\t\t\t// Media item already exists in library, so just insert it.\n\t\t\tif ( !! id ) {\n\t\t\t\tonClick( clonedBlock );\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tsetIsInserting( true );\n\t\t\t// Media item does not exist in library, so try to upload it.\n\t\t\t// Fist fetch the image data. This may fail if the image host\n\t\t\t// doesn't allow CORS with the domain.\n\t\t\t// If this happens, we insert the image block using the external\n\t\t\t// URL and let the user know about the possible implications.\n\t\t\twindow\n\t\t\t\t.fetch( url )\n\t\t\t\t.then( ( response ) => response.blob() )\n\t\t\t\t.then( ( blob ) => {\n\t\t\t\t\tmediaUpload( {\n\t\t\t\t\t\tfilesList: [ blob ],\n\t\t\t\t\t\tadditionalData: { caption },\n\t\t\t\t\t\tonFileChange( [ img ] ) {\n\t\t\t\t\t\t\tif ( isBlobURL( img.url ) ) {\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonClick( {\n\t\t\t\t\t\t\t\t...clonedBlock,\n\t\t\t\t\t\t\t\tattributes: {\n\t\t\t\t\t\t\t\t\t...clonedBlock.attributes,\n\t\t\t\t\t\t\t\t\tid: img.id,\n\t\t\t\t\t\t\t\t\turl: img.url,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\t\t\t\t__( 'Image uploaded and inserted.' ),\n\t\t\t\t\t\t\t\t{ type: 'snackbar' }\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tsetIsInserting( false );\n\t\t\t\t\t\t},\n\t\t\t\t\t\tallowedTypes: ALLOWED_MEDIA_TYPES,\n\t\t\t\t\t\tonError( message ) {\n\t\t\t\t\t\t\tcreateErrorNotice( message, { type: 'snackbar' } );\n\t\t\t\t\t\t\tsetIsInserting( false );\n\t\t\t\t\t\t},\n\t\t\t\t\t} );\n\t\t\t\t} )\n\t\t\t\t.catch( () => {\n\t\t\t\t\tsetShowExternalUploadModal( true );\n\t\t\t\t\tsetIsInserting( false );\n\t\t\t\t} );\n\t\t},\n\t\t[\n\t\t\tisInserting,\n\t\t\tonClick,\n\t\t\tmediaUpload,\n\t\t\tcreateErrorNotice,\n\t\t\tcreateSuccessNotice,\n\t\t]\n\t);\n\n\tconst title =\n\t\ttypeof media.title === 'string'\n\t\t\t? media.title\n\t\t\t: media.title?.rendered || __( 'no title' );\n\n\tlet truncatedTitle;\n\tif ( title.length > MAXIMUM_TITLE_LENGTH ) {\n\t\tconst omission = '...';\n\t\ttruncatedTitle =\n\t\t\ttitle.slice( 0, MAXIMUM_TITLE_LENGTH - omission.length ) + omission;\n\t}\n\tconst onMouseEnter = useCallback( () => setIsHovered( true ), [] );\n\tconst onMouseLeave = useCallback( () => setIsHovered( false ), [] );\n\treturn (\n\t\t<>\n\t\t\t<InserterDraggableBlocks isEnabled blocks={ [ block ] }>\n\t\t\t\t{ ( { draggable, onDragStart, onDragEnd } ) => (\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t'block-editor-inserter__media-list__list-item',\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t'is-hovered': isHovered,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tdraggable={ draggable }\n\t\t\t\t\t\tonDragStart={ onDragStart }\n\t\t\t\t\t\tonDragEnd={ onDragEnd }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ /* Adding `is-hovered` class to the wrapper element is needed\n\t\t\t\t\t\tbecause the options Popover is rendered outside of this node. */ }\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tonMouseEnter={ onMouseEnter }\n\t\t\t\t\t\t\tonMouseLeave={ onMouseLeave }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Tooltip text={ truncatedTitle || title }>\n\t\t\t\t\t\t\t\t<CompositeItem\n\t\t\t\t\t\t\t\t\trender={\n\t\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\t\taria-label={ title }\n\t\t\t\t\t\t\t\t\t\t\trole=\"option\"\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"block-editor-inserter__media-list__item\"\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tonClick={ () => onMediaInsert( block ) }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<div className=\"block-editor-inserter__media-list__item-preview\">\n\t\t\t\t\t\t\t\t\t\t{ preview }\n\t\t\t\t\t\t\t\t\t\t{ isInserting && (\n\t\t\t\t\t\t\t\t\t\t\t<div className=\"block-editor-inserter__media-list__item-preview-spinner\">\n\t\t\t\t\t\t\t\t\t\t\t\t<Spinner />\n\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</CompositeItem>\n\t\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t\t\t{ ! isInserting && (\n\t\t\t\t\t\t\t\t<MediaPreviewOptions\n\t\t\t\t\t\t\t\t\tcategory={ category }\n\t\t\t\t\t\t\t\t\tmedia={ media }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t</InserterDraggableBlocks>\n\t\t\t{ showExternalUploadModal && (\n\t\t\t\t<InsertExternalImageModal\n\t\t\t\t\tonClose={ () => setShowExternalUploadModal( false ) }\n\t\t\t\t\tonSubmit={ () => {\n\t\t\t\t\t\tonClick( cloneBlock( block ) );\n\t\t\t\t\t\tcreateSuccessNotice( __( 'Image inserted.' ), {\n\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t} );\n\t\t\t\t\t\tsetShowExternalUploadModal( false );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SACCC,OAAO,EACPC,YAAY,EACZC,SAAS,EACTC,QAAQ,EACRC,OAAO,EACPC,KAAK,EACLC,IAAI,EACJC,QAAQ,EACRC,MAAM,EACNC,WAAW,IAAIC,qBAAqB,EACpCC,oBAAoB,IAAIC,MAAM,QACxB,uBAAuB;AAC9B,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,OAAO,EAAEC,WAAW,EAAEC,QAAQ,QAAQ,oBAAoB;AACnE,SAASC,UAAU,QAAQ,mBAAmB;AAC9C,SAASC,YAAY,EAAEC,QAAQ,QAAQ,kBAAkB;AACzD,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,KAAK,IAAIC,YAAY,QAAQ,oBAAoB;AAC1D,SAASC,SAAS,QAAQ,iBAAiB;;AAE3C;AACA;AACA;AACA,OAAOC,uBAAuB,MAAM,iCAAiC;AACrE,SAASC,2BAA2B,QAAQ,SAAS;AACrD,SAASJ,KAAK,IAAIK,gBAAgB,Q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