@wordpress/block-editor 14.3.6 → 14.5.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/README.md +6 -2
- package/build/autocompleters/block.js.map +1 -1
- package/build/autocompleters/link.js +2 -1
- package/build/autocompleters/link.js.map +1 -1
- package/build/components/background-image-control/index.js +1 -1
- package/build/components/background-image-control/index.js.map +1 -1
- package/build/components/block-actions/index.js +1 -13
- package/build/components/block-actions/index.js.map +1 -1
- package/build/components/block-controls/slot.js.map +1 -1
- package/build/components/block-controls/slot.native.js.map +1 -1
- package/build/components/block-draggable/draggable-chip.js +1 -1
- package/build/components/block-draggable/draggable-chip.js.map +1 -1
- package/build/components/block-inspector/index.js +56 -75
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list/block-invalid-warning.native.js +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.map +1 -1
- package/build/components/block-list/block.js +5 -16
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/index.js +6 -8
- package/build/components/block-list/index.js.map +1 -1
- package/build/components/block-list/index.native.js.map +1 -1
- package/build/components/block-list/use-block-props/index.js +3 -8
- package/build/components/block-list/use-block-props/index.js.map +1 -1
- package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js +14 -6
- package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
- package/build/components/block-list/use-in-between-inserter.js +5 -3
- package/build/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build/components/block-list/zoom-out-separator.js +24 -13
- package/build/components/block-list/zoom-out-separator.js.map +1 -1
- package/build/components/block-lock/modal.js +1 -1
- package/build/components/block-lock/modal.js.map +1 -1
- package/build/components/block-mover/button.js.map +1 -1
- package/build/components/block-navigation/dropdown.js +2 -4
- package/build/components/block-navigation/dropdown.js.map +1 -1
- package/build/components/block-parent-selector/index.js +14 -11
- package/build/components/block-parent-selector/index.js.map +1 -1
- package/build/components/block-pattern-setup/index.js.map +1 -1
- package/build/components/block-pattern-setup/setup-toolbar.js +10 -20
- package/build/components/block-pattern-setup/setup-toolbar.js.map +1 -1
- package/build/components/block-patterns-list/index.js.map +1 -1
- package/build/components/block-patterns-paging/index.js +11 -13
- package/build/components/block-patterns-paging/index.js.map +1 -1
- package/build/components/block-popover/index.js +45 -2
- package/build/components/block-popover/index.js.map +1 -1
- package/build/components/block-preview/auto.js +1 -4
- package/build/components/block-preview/auto.js.map +1 -1
- package/build/components/block-preview/index.js.map +1 -1
- package/build/components/block-quick-navigation/index.js +2 -4
- package/build/components/block-quick-navigation/index.js.map +1 -1
- package/build/components/block-rename/modal.js +2 -2
- package/build/components/block-rename/modal.js.map +1 -1
- package/build/components/block-settings-menu/block-parent-selector-menu-item.js +1 -1
- package/build/components/block-settings-menu/block-parent-selector-menu-item.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +79 -76
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-settings-menu-controls/index.js +1 -6
- package/build/components/block-settings-menu-controls/index.js.map +1 -1
- package/build/components/block-switcher/block-transformations-menu.native.js +1 -1
- package/build/components/block-switcher/block-transformations-menu.native.js.map +1 -1
- package/build/components/block-switcher/index.js +19 -15
- package/build/components/block-switcher/index.js.map +1 -1
- package/build/components/block-switcher/pattern-transformations-menu.js.map +1 -1
- package/build/components/block-switcher/use-transformed-patterns.js +1 -0
- package/build/components/block-switcher/use-transformed-patterns.js.map +1 -1
- package/build/components/block-switcher/utils.js +1 -0
- package/build/components/block-switcher/utils.js.map +1 -1
- package/build/components/block-toolbar/index.js +16 -19
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-toolbar/use-has-block-toolbar.js +3 -5
- package/build/components/block-toolbar/use-has-block-toolbar.js.map +1 -1
- package/build/components/block-tools/index.js +8 -18
- package/build/components/block-tools/index.js.map +1 -1
- package/build/components/block-tools/insertion-point.js +1 -4
- package/build/components/block-tools/insertion-point.js.map +1 -1
- package/build/components/block-tools/use-show-block-tools.js +8 -7
- package/build/components/block-tools/use-show-block-tools.js.map +1 -1
- package/build/components/block-tools/zoom-out-mode-inserter-button.js +1 -12
- package/build/components/block-tools/zoom-out-mode-inserter-button.js.map +1 -1
- package/build/components/block-tools/zoom-out-mode-inserters.js +14 -17
- package/build/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
- package/build/components/block-tools/zoom-out-popover.js +3 -2
- package/build/components/block-tools/zoom-out-popover.js.map +1 -1
- package/build/components/block-tools/zoom-out-toolbar.js +5 -32
- package/build/components/block-tools/zoom-out-toolbar.js.map +1 -1
- package/build/components/block-types-list/index.js.map +1 -1
- package/build/components/block-types-list/index.native.js.map +1 -1
- package/build/components/block-variation-transforms/index.js +3 -2
- package/build/components/block-variation-transforms/index.js.map +1 -1
- package/build/components/border-radius-control/index.js.map +1 -1
- package/build/components/border-radius-control/utils.js.map +1 -1
- package/build/components/button-block-appender/index.js.map +1 -1
- package/build/components/color-style-selector/index.js.map +1 -1
- package/build/components/colors/utils.js.map +1 -1
- package/build/components/colors/with-colors.js.map +1 -1
- package/build/components/colors-gradients/panel-color-gradient-settings.native.js.map +1 -1
- package/build/components/date-format-picker/index.js +1 -0
- package/build/components/date-format-picker/index.js.map +1 -1
- package/build/components/duotone/utils.js.map +1 -1
- package/build/components/duotone-control/index.js.map +1 -1
- package/build/components/font-sizes/fluid-utils.js.map +1 -1
- package/build/components/font-sizes/utils.js.map +1 -1
- package/build/components/font-sizes/with-font-sizes.js.map +1 -1
- package/build/components/global-styles/border-panel.js +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 +3 -3
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/filters-panel.js.map +1 -1
- package/build/components/global-styles/get-block-css-selector.js.map +1 -1
- package/build/components/global-styles/get-global-styles-changes.js +2 -1
- package/build/components/global-styles/get-global-styles-changes.js.map +1 -1
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/use-global-styles-context.native.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/gradients/use-gradient.js.map +1 -1
- package/build/components/grid/grid-item-movers.js.map +1 -1
- package/build/components/grid/grid-visualizer.js.map +1 -1
- package/build/components/iframe/index.js +44 -9
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/image-editor/use-save-image.js +1 -1
- package/build/components/image-editor/use-save-image.js.map +1 -1
- package/build/components/inner-blocks/index.js +1 -9
- package/build/components/inner-blocks/index.js.map +1 -1
- package/build/components/inner-blocks/use-nested-settings-update.js +15 -8
- package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js +1 -1
- package/build/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js.map +1 -1
- package/build/components/inserter/block-patterns-explorer/pattern-list.js +2 -2
- package/build/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/use-pattern-categories.js +1 -1
- package/build/components/inserter/block-patterns-tab/use-pattern-categories.js.map +1 -1
- package/build/components/inserter/block-types-tab.js +1 -1
- package/build/components/inserter/block-types-tab.js.map +1 -1
- package/build/components/inserter/block-types-tab.native.js.map +1 -1
- package/build/components/inserter/category-tabs/index.js +1 -10
- package/build/components/inserter/category-tabs/index.js.map +1 -1
- package/build/components/inserter/hooks/use-block-types-state.js +24 -5
- package/build/components/inserter/hooks/use-block-types-state.js.map +1 -1
- package/build/components/inserter/hooks/use-insertion-point.js +22 -12
- package/build/components/inserter/hooks/use-insertion-point.js.map +1 -1
- package/build/components/inserter/hooks/use-patterns-state.js +24 -11
- package/build/components/inserter/hooks/use-patterns-state.js.map +1 -1
- package/build/components/inserter/media-tab/media-panel.js.map +1 -1
- package/build/components/inserter/media-tab/media-preview.js +36 -14
- package/build/components/inserter/media-tab/media-preview.js.map +1 -1
- package/build/components/inserter/media-tab/media-tab.js.map +1 -1
- package/build/components/inserter/media-tab/utils.js.map +1 -1
- package/build/components/inserter/menu.js +4 -4
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/mobile-tab-navigation.js +5 -5
- package/build/components/inserter/mobile-tab-navigation.js.map +1 -1
- package/build/components/inserter/preview-panel.js.map +1 -1
- package/build/components/inserter/quick-inserter.js +5 -5
- package/build/components/inserter/quick-inserter.js.map +1 -1
- package/build/components/inserter/search-results.js +1 -1
- package/build/components/inserter/search-results.js.map +1 -1
- package/build/components/inserter/tabs.native.js.map +1 -1
- package/build/components/inspector-controls/block-support-tools-panel.js.map +1 -1
- package/build/components/inspector-controls/fill.js.map +1 -1
- package/build/components/inspector-controls/fill.native.js.map +1 -1
- package/build/components/inspector-controls/slot.js.map +1 -1
- package/build/components/inspector-controls/slot.native.js.map +1 -1
- package/build/components/line-height-control/index.js.map +1 -1
- package/build/components/link-control/index.js +1 -2
- package/build/components/link-control/index.js.map +1 -1
- package/build/components/link-control/is-url-like.js.map +1 -1
- package/build/components/link-control/search-create-button.js +1 -1
- package/build/components/link-control/search-create-button.js.map +1 -1
- package/build/components/link-control/search-input.js +3 -5
- package/build/components/link-control/search-input.js.map +1 -1
- package/build/components/link-control/search-results.js +5 -15
- package/build/components/link-control/search-results.js.map +1 -1
- package/build/components/link-control/settings-drawer.js.map +1 -1
- package/build/components/link-control/use-rich-url-data.js.map +1 -1
- package/build/components/list-view/appender.js +1 -1
- package/build/components/list-view/appender.js.map +1 -1
- package/build/components/list-view/block-contents.js +1 -25
- package/build/components/list-view/block-contents.js.map +1 -1
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/branch.js.map +1 -1
- package/build/components/list-view/drop-indicator.js.map +1 -1
- package/build/components/list-view/index.js.map +1 -1
- package/build/components/list-view/use-block-selection.js +2 -2
- package/build/components/list-view/use-block-selection.js.map +1 -1
- package/build/components/list-view/utils.js +1 -1
- package/build/components/list-view/utils.js.map +1 -1
- package/build/components/media-placeholder/index.native.js +1 -1
- package/build/components/media-placeholder/index.native.js.map +1 -1
- package/build/components/media-replace-flow/index.js.map +1 -1
- package/build/components/multi-selection-inspector/index.js +2 -2
- package/build/components/multi-selection-inspector/index.js.map +1 -1
- package/build/components/observe-typing/index.js +1 -0
- package/build/components/observe-typing/index.js.map +1 -1
- package/build/components/recursion-provider/index.js +1 -0
- package/build/components/recursion-provider/index.js.map +1 -1
- package/build/components/responsive-block-control/index.js +3 -3
- package/build/components/responsive-block-control/index.js.map +1 -1
- package/build/components/responsive-block-control/label.js +1 -1
- package/build/components/responsive-block-control/label.js.map +1 -1
- package/build/components/rich-text/content.js.map +1 -1
- package/build/components/rich-text/file-paste-handler.native.js.map +1 -1
- package/build/components/rich-text/format-toolbar/index.js.map +1 -1
- package/build/components/rich-text/format-toolbar/index.native.js.map +1 -1
- package/build/components/rich-text/index.js +3 -2
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/multiline.js.map +1 -1
- package/build/components/rich-text/native/get-format-colors.native.js.map +1 -1
- package/build/components/rich-text/native/index.native.js.map +1 -1
- package/build/components/rich-text/native/use-format-types.js +1 -0
- package/build/components/rich-text/native/use-format-types.js.map +1 -1
- package/build/components/rich-text/toolbar-button.js.map +1 -1
- package/build/components/rich-text/use-format-types.js +1 -0
- package/build/components/rich-text/use-format-types.js.map +1 -1
- package/build/components/spacing-sizes-control/input-controls/axial.js.map +1 -1
- package/build/components/spacing-sizes-control/input-controls/separated.js.map +1 -1
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build/components/spacing-sizes-control/utils.js +1 -0
- package/build/components/spacing-sizes-control/utils.js.map +1 -1
- package/build/components/tool-selector/index.js +13 -8
- package/build/components/tool-selector/index.js.map +1 -1
- package/build/components/typewriter/index.js +1 -0
- package/build/components/typewriter/index.js.map +1 -1
- package/build/components/unsupported-block-details/index.native.js.map +1 -1
- package/build/components/url-input/index.js +1 -1
- package/build/components/url-input/index.js.map +1 -1
- package/build/components/use-block-commands/index.js +0 -61
- package/build/components/use-block-commands/index.js.map +1 -1
- package/build/components/use-block-drop-zone/index.js.map +1 -1
- package/build/components/use-flash-editable-blocks/index.js.map +1 -1
- package/build/components/use-moving-animation/index.js.map +1 -1
- package/build/components/writing-flow/use-tab-nav.js +23 -30
- package/build/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build/hooks/align.js.map +1 -1
- package/build/hooks/block-hooks.js +1 -1
- package/build/hooks/block-hooks.js.map +1 -1
- package/build/hooks/block-style-variation.js.map +1 -1
- package/build/hooks/duotone.js +4 -1
- package/build/hooks/duotone.js.map +1 -1
- package/build/hooks/font-family.js.map +1 -1
- package/build/hooks/gap.js.map +1 -1
- package/build/hooks/generated-class-name.js +1 -0
- package/build/hooks/generated-class-name.js.map +1 -1
- package/build/hooks/layout-child.js +3 -1
- package/build/hooks/layout-child.js.map +1 -1
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/position.js +4 -3
- package/build/hooks/position.js.map +1 -1
- package/build/hooks/spacing-visualizer.js.map +1 -1
- package/build/hooks/style.js.map +1 -1
- package/build/hooks/text-align.js.map +1 -1
- package/build/hooks/use-typography-props.js.map +1 -1
- package/build/hooks/use-zoom-out.js +24 -16
- package/build/hooks/use-zoom-out.js.map +1 -1
- package/build/layouts/constrained.js.map +1 -1
- package/build/layouts/flex.js.map +1 -1
- package/build/layouts/grid.js.map +1 -1
- package/build/layouts/utils.js.map +1 -1
- package/build/store/actions.js +18 -20
- package/build/store/actions.js.map +1 -1
- package/build/store/private-actions.js +15 -0
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-selectors.js +104 -7
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +24 -44
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +149 -71
- package/build/store/selectors.js.map +1 -1
- package/build/store/utils.js +4 -3
- package/build/store/utils.js.map +1 -1
- package/build/utils/block-bindings.js +2 -0
- package/build/utils/block-bindings.js.map +1 -1
- package/build/utils/get-font-styles-and-weights.js +1 -1
- package/build/utils/get-font-styles-and-weights.js.map +1 -1
- package/build/utils/object.js +1 -0
- package/build/utils/object.js.map +1 -1
- package/build/utils/pasting.js.map +1 -1
- package/build-module/autocompleters/block.js +1 -3
- package/build-module/autocompleters/block.js.map +1 -1
- package/build-module/autocompleters/link.js +3 -4
- package/build-module/autocompleters/link.js.map +1 -1
- package/build-module/components/audio-player/index.native.js +1 -2
- package/build-module/components/audio-player/index.native.js.map +1 -1
- package/build-module/components/background-image-control/index.js +2 -3
- package/build-module/components/background-image-control/index.js.map +1 -1
- package/build-module/components/block-actions/index.js +1 -13
- package/build-module/components/block-actions/index.js.map +1 -1
- package/build-module/components/block-alignment-control/ui.js +1 -2
- package/build-module/components/block-alignment-control/ui.js.map +1 -1
- package/build-module/components/block-breadcrumb/index.js +1 -2
- package/build-module/components/block-breadcrumb/index.js.map +1 -1
- package/build-module/components/block-canvas/index.js +1 -2
- package/build-module/components/block-canvas/index.js.map +1 -1
- package/build-module/components/block-card/index.js +1 -2
- package/build-module/components/block-card/index.js.map +1 -1
- package/build-module/components/block-compare/block-view.js +1 -2
- package/build-module/components/block-compare/block-view.js.map +1 -1
- package/build-module/components/block-compare/index.js +1 -2
- package/build-module/components/block-compare/index.js.map +1 -1
- package/build-module/components/block-controls/fill.js +1 -3
- package/build-module/components/block-controls/fill.js.map +1 -1
- package/build-module/components/block-controls/slot.js.map +1 -1
- package/build-module/components/block-controls/slot.native.js.map +1 -1
- package/build-module/components/block-draggable/draggable-chip.js +2 -3
- package/build-module/components/block-draggable/draggable-chip.js.map +1 -1
- package/build-module/components/block-draggable/draggable-chip.native.js +1 -2
- package/build-module/components/block-draggable/draggable-chip.native.js.map +1 -1
- package/build-module/components/block-draggable/index.native.js +1 -3
- package/build-module/components/block-draggable/index.native.js.map +1 -1
- package/build-module/components/block-edit/index.js +1 -2
- package/build-module/components/block-edit/index.js.map +1 -1
- package/build-module/components/block-edit/multiple-usage-warning.js +1 -2
- package/build-module/components/block-edit/multiple-usage-warning.js.map +1 -1
- package/build-module/components/block-inspector/index.js +57 -78
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list/block-crash-warning.js +1 -1
- package/build-module/components/block-list/block-crash-warning.js.map +1 -1
- package/build-module/components/block-list/block-crash-warning.native.js +1 -1
- package/build-module/components/block-list/block-crash-warning.native.js.map +1 -1
- package/build-module/components/block-list/block-invalid-warning.js +1 -3
- package/build-module/components/block-list/block-invalid-warning.js.map +1 -1
- package/build-module/components/block-list/block-invalid-warning.native.js +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 -2
- package/build-module/components/block-list/block-list-item.native.js.map +1 -1
- package/build-module/components/block-list/block-selection-button.native.js +1 -2
- package/build-module/components/block-list/block-selection-button.native.js.map +1 -1
- package/build-module/components/block-list/block.js +6 -19
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/block.native.js +1 -2
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-list/index.js +7 -10
- package/build-module/components/block-list/index.js.map +1 -1
- package/build-module/components/block-list/index.native.js +1 -3
- package/build-module/components/block-list/index.native.js.map +1 -1
- package/build-module/components/block-list/insertion-point.native.js +1 -2
- package/build-module/components/block-list/insertion-point.native.js.map +1 -1
- package/build-module/components/block-list/use-block-props/index.js +3 -8
- package/build-module/components/block-list/use-block-props/index.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js +14 -6
- package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
- package/build-module/components/block-list/use-in-between-inserter.js +5 -3
- package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build-module/components/block-list/zoom-out-separator.js +24 -13
- package/build-module/components/block-list/zoom-out-separator.js.map +1 -1
- package/build-module/components/block-lock/menu-item.js +1 -3
- package/build-module/components/block-lock/menu-item.js.map +1 -1
- package/build-module/components/block-lock/modal.js +2 -3
- package/build-module/components/block-lock/modal.js.map +1 -1
- package/build-module/components/block-lock/toolbar.js +1 -3
- package/build-module/components/block-lock/toolbar.js.map +1 -1
- package/build-module/components/block-media-update-progress/index.native.js +1 -2
- package/build-module/components/block-media-update-progress/index.native.js.map +1 -1
- package/build-module/components/block-mover/button.js +1 -3
- package/build-module/components/block-mover/button.js.map +1 -1
- package/build-module/components/block-mover/index.js +1 -2
- package/build-module/components/block-mover/index.js.map +1 -1
- package/build-module/components/block-mover/index.native.js +1 -2
- package/build-module/components/block-mover/index.native.js.map +1 -1
- package/build-module/components/block-navigation/dropdown.js +3 -6
- package/build-module/components/block-navigation/dropdown.js.map +1 -1
- package/build-module/components/block-parent-selector/index.js +14 -11
- package/build-module/components/block-parent-selector/index.js.map +1 -1
- package/build-module/components/block-pattern-setup/index.js +1 -3
- package/build-module/components/block-pattern-setup/index.js.map +1 -1
- package/build-module/components/block-pattern-setup/setup-toolbar.js +11 -22
- package/build-module/components/block-pattern-setup/setup-toolbar.js.map +1 -1
- package/build-module/components/block-patterns-list/index.js +1 -3
- package/build-module/components/block-patterns-list/index.js.map +1 -1
- package/build-module/components/block-patterns-paging/index.js +12 -15
- package/build-module/components/block-patterns-paging/index.js.map +1 -1
- package/build-module/components/block-popover/index.js +45 -2
- package/build-module/components/block-popover/index.js.map +1 -1
- package/build-module/components/block-preview/auto.js +2 -7
- package/build-module/components/block-preview/auto.js.map +1 -1
- package/build-module/components/block-preview/index.js +1 -2
- package/build-module/components/block-preview/index.js.map +1 -1
- package/build-module/components/block-quick-navigation/index.js +3 -6
- package/build-module/components/block-quick-navigation/index.js.map +1 -1
- package/build-module/components/block-removal-warning-modal/index.js +1 -2
- package/build-module/components/block-removal-warning-modal/index.js.map +1 -1
- package/build-module/components/block-rename/modal.js +3 -4
- package/build-module/components/block-rename/modal.js.map +1 -1
- package/build-module/components/block-rename/rename-control.js +1 -3
- package/build-module/components/block-rename/rename-control.js.map +1 -1
- package/build-module/components/block-settings/container.native.js +1 -3
- package/build-module/components/block-settings/container.native.js.map +1 -1
- package/build-module/components/block-settings-menu/block-parent-selector-menu-item.js +1 -1
- package/build-module/components/block-settings-menu/block-parent-selector-menu-item.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +80 -79
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-settings-menu-controls/index.js +3 -9
- package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
- package/build-module/components/block-styles/index.js +1 -2
- package/build-module/components/block-styles/index.js.map +1 -1
- package/build-module/components/block-styles/menu-items.js +1 -2
- package/build-module/components/block-styles/menu-items.js.map +1 -1
- package/build-module/components/block-styles/preview.native.js +1 -2
- package/build-module/components/block-styles/preview.native.js.map +1 -1
- package/build-module/components/block-switcher/block-transformations-menu.js +1 -3
- package/build-module/components/block-switcher/block-transformations-menu.js.map +1 -1
- package/build-module/components/block-switcher/block-transformations-menu.native.js +1 -1
- package/build-module/components/block-switcher/block-transformations-menu.native.js.map +1 -1
- package/build-module/components/block-switcher/block-variation-transformations.js +1 -3
- package/build-module/components/block-switcher/block-variation-transformations.js.map +1 -1
- package/build-module/components/block-switcher/index.js +20 -18
- package/build-module/components/block-switcher/index.js.map +1 -1
- package/build-module/components/block-switcher/pattern-transformations-menu.js +1 -2
- package/build-module/components/block-switcher/pattern-transformations-menu.js.map +1 -1
- package/build-module/components/block-switcher/preview-block-popover.js +1 -2
- package/build-module/components/block-switcher/preview-block-popover.js.map +1 -1
- package/build-module/components/block-switcher/use-transformed-patterns.js +1 -0
- package/build-module/components/block-switcher/use-transformed-patterns.js.map +1 -1
- package/build-module/components/block-switcher/utils.js +1 -0
- package/build-module/components/block-switcher/utils.js.map +1 -1
- package/build-module/components/block-toolbar/block-toolbar-menu.native.js +1 -2
- package/build-module/components/block-toolbar/block-toolbar-menu.native.js.map +1 -1
- package/build-module/components/block-toolbar/index.js +17 -22
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-toolbar/index.native.js +1 -3
- package/build-module/components/block-toolbar/index.native.js.map +1 -1
- package/build-module/components/block-toolbar/use-has-block-toolbar.js +3 -5
- package/build-module/components/block-toolbar/use-has-block-toolbar.js.map +1 -1
- package/build-module/components/block-tools/index.js +9 -20
- package/build-module/components/block-tools/index.js.map +1 -1
- package/build-module/components/block-tools/insertion-point.js +2 -6
- package/build-module/components/block-tools/insertion-point.js.map +1 -1
- package/build-module/components/block-tools/use-show-block-tools.js +8 -7
- package/build-module/components/block-tools/use-show-block-tools.js.map +1 -1
- package/build-module/components/block-tools/zoom-out-mode-inserter-button.js +1 -12
- package/build-module/components/block-tools/zoom-out-mode-inserter-button.js.map +1 -1
- package/build-module/components/block-tools/zoom-out-mode-inserters.js +14 -17
- package/build-module/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
- package/build-module/components/block-tools/zoom-out-popover.js +2 -1
- package/build-module/components/block-tools/zoom-out-popover.js.map +1 -1
- package/build-module/components/block-tools/zoom-out-toolbar.js +7 -35
- package/build-module/components/block-tools/zoom-out-toolbar.js.map +1 -1
- package/build-module/components/block-types-list/index.js +1 -2
- package/build-module/components/block-types-list/index.js.map +1 -1
- package/build-module/components/block-types-list/index.native.js +1 -2
- package/build-module/components/block-types-list/index.native.js.map +1 -1
- package/build-module/components/block-variation-picker/index.js +1 -2
- package/build-module/components/block-variation-picker/index.js.map +1 -1
- package/build-module/components/block-variation-picker/index.native.js +1 -2
- package/build-module/components/block-variation-picker/index.native.js.map +1 -1
- package/build-module/components/block-variation-transforms/index.js +4 -4
- package/build-module/components/block-variation-transforms/index.js.map +1 -1
- package/build-module/components/border-radius-control/index.js +1 -3
- package/build-module/components/border-radius-control/index.js.map +1 -1
- package/build-module/components/border-radius-control/utils.js.map +1 -1
- package/build-module/components/button-block-appender/index.js.map +1 -1
- package/build-module/components/button-block-appender/index.native.js +1 -2
- package/build-module/components/button-block-appender/index.native.js.map +1 -1
- package/build-module/components/child-layout-control/index.js +1 -3
- package/build-module/components/child-layout-control/index.js.map +1 -1
- package/build-module/components/color-style-selector/index.js.map +1 -1
- package/build-module/components/colors/utils.js.map +1 -1
- package/build-module/components/colors/with-colors.js.map +1 -1
- package/build-module/components/colors-gradients/control.js +1 -2
- package/build-module/components/colors-gradients/control.js.map +1 -1
- package/build-module/components/colors-gradients/dropdown.js +1 -3
- package/build-module/components/colors-gradients/dropdown.js.map +1 -1
- package/build-module/components/colors-gradients/panel-color-gradient-settings.js +1 -3
- package/build-module/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
- package/build-module/components/colors-gradients/panel-color-gradient-settings.native.js +1 -3
- package/build-module/components/colors-gradients/panel-color-gradient-settings.native.js.map +1 -1
- package/build-module/components/contrast-checker/index.native.js +1 -2
- package/build-module/components/contrast-checker/index.native.js.map +1 -1
- package/build-module/components/convert-to-group-buttons/index.js +1 -3
- package/build-module/components/convert-to-group-buttons/index.js.map +1 -1
- package/build-module/components/convert-to-group-buttons/toolbar.js +1 -2
- package/build-module/components/convert-to-group-buttons/toolbar.js.map +1 -1
- package/build-module/components/date-format-picker/index.js +2 -2
- package/build-module/components/date-format-picker/index.js.map +1 -1
- package/build-module/components/default-block-appender/index.js +1 -2
- package/build-module/components/default-block-appender/index.js.map +1 -1
- package/build-module/components/dimensions-tool/index.js +1 -3
- package/build-module/components/dimensions-tool/index.js.map +1 -1
- package/build-module/components/dimensions-tool/width-height-tool.js +1 -3
- package/build-module/components/dimensions-tool/width-height-tool.js.map +1 -1
- package/build-module/components/duotone/utils.js.map +1 -1
- package/build-module/components/duotone-control/index.js +1 -2
- package/build-module/components/duotone-control/index.js.map +1 -1
- package/build-module/components/editor-styles/index.js +1 -3
- package/build-module/components/editor-styles/index.js.map +1 -1
- package/build-module/components/floating-toolbar/index.native.js +1 -2
- package/build-module/components/floating-toolbar/index.native.js.map +1 -1
- package/build-module/components/floating-toolbar/nav-up-icon.js +1 -2
- package/build-module/components/floating-toolbar/nav-up-icon.js.map +1 -1
- package/build-module/components/font-sizes/fluid-utils.js.map +1 -1
- package/build-module/components/font-sizes/utils.js.map +1 -1
- package/build-module/components/font-sizes/with-font-sizes.js +2 -2
- package/build-module/components/font-sizes/with-font-sizes.js.map +1 -1
- package/build-module/components/global-styles/advanced-panel.js +1 -2
- package/build-module/components/global-styles/advanced-panel.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +2 -3
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/color-panel.js +2 -3
- package/build-module/components/global-styles/color-panel.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +2 -3
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/filters-panel.js +1 -2
- package/build-module/components/global-styles/filters-panel.js.map +1 -1
- package/build-module/components/global-styles/get-block-css-selector.js.map +1 -1
- package/build-module/components/global-styles/get-global-styles-changes.js +2 -1
- package/build-module/components/global-styles/get-global-styles-changes.js.map +1 -1
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/image-settings-panel.js +1 -2
- package/build-module/components/global-styles/image-settings-panel.js.map +1 -1
- package/build-module/components/global-styles/shadow-panel-components.js +1 -2
- package/build-module/components/global-styles/shadow-panel-components.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +1 -2
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-context.native.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/gradients/use-gradient.js.map +1 -1
- package/build-module/components/grid/grid-item-movers.js +1 -3
- package/build-module/components/grid/grid-item-movers.js.map +1 -1
- package/build-module/components/grid/grid-visualizer.js.map +1 -1
- package/build-module/components/height-control/index.js +1 -2
- package/build-module/components/height-control/index.js.map +1 -1
- package/build-module/components/iframe/index.js +45 -12
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/image-editor/aspect-ratio-dropdown.js +1 -3
- package/build-module/components/image-editor/aspect-ratio-dropdown.js.map +1 -1
- package/build-module/components/image-editor/cropper.js +1 -3
- package/build-module/components/image-editor/cropper.js.map +1 -1
- package/build-module/components/image-editor/form-controls.js +1 -3
- package/build-module/components/image-editor/form-controls.js.map +1 -1
- package/build-module/components/image-editor/index.js +1 -2
- package/build-module/components/image-editor/index.js.map +1 -1
- package/build-module/components/image-editor/use-save-image.js +1 -1
- package/build-module/components/image-editor/use-save-image.js.map +1 -1
- package/build-module/components/image-link-destinations/index.native.js +1 -3
- package/build-module/components/image-link-destinations/index.native.js.map +1 -1
- package/build-module/components/image-size-control/index.js +1 -3
- package/build-module/components/image-size-control/index.js.map +1 -1
- package/build-module/components/inner-blocks/index.js +1 -9
- package/build-module/components/inner-blocks/index.js.map +1 -1
- package/build-module/components/inner-blocks/use-nested-settings-update.js +16 -9
- package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build-module/components/inner-blocks/warning-max-depth-exceeded.native.js +1 -2
- package/build-module/components/inner-blocks/warning-max-depth-exceeded.native.js.map +1 -1
- package/build-module/components/inserter/block-patterns-explorer/index.js +1 -2
- package/build-module/components/inserter/block-patterns-explorer/index.js.map +1 -1
- package/build-module/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js +2 -3
- package/build-module/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js.map +1 -1
- package/build-module/components/inserter/block-patterns-explorer/pattern-list.js +3 -5
- package/build-module/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/index.js +1 -3
- package/build-module/components/inserter/block-patterns-tab/index.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js +1 -3
- package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/patterns-filter.js +1 -3
- package/build-module/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/use-pattern-categories.js +1 -1
- package/build-module/components/inserter/block-patterns-tab/use-pattern-categories.js.map +1 -1
- package/build-module/components/inserter/block-types-tab.js +2 -4
- package/build-module/components/inserter/block-types-tab.js.map +1 -1
- package/build-module/components/inserter/block-types-tab.native.js.map +1 -1
- package/build-module/components/inserter/category-tabs/index.js +3 -13
- package/build-module/components/inserter/category-tabs/index.js.map +1 -1
- package/build-module/components/inserter/hooks/use-block-types-state.js +27 -8
- package/build-module/components/inserter/hooks/use-block-types-state.js.map +1 -1
- package/build-module/components/inserter/hooks/use-insertion-point.js +22 -12
- package/build-module/components/inserter/hooks/use-insertion-point.js.map +1 -1
- package/build-module/components/inserter/hooks/use-patterns-state.js +24 -11
- package/build-module/components/inserter/hooks/use-patterns-state.js.map +1 -1
- package/build-module/components/inserter/index.native.js +1 -3
- package/build-module/components/inserter/index.native.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-panel.js +1 -2
- package/build-module/components/inserter/media-tab/media-panel.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-preview.js +37 -17
- package/build-module/components/inserter/media-tab/media-preview.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-tab.js +1 -3
- package/build-module/components/inserter/media-tab/media-tab.js.map +1 -1
- package/build-module/components/inserter/media-tab/utils.js.map +1 -1
- package/build-module/components/inserter/menu.js +5 -7
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/menu.native.js +1 -3
- package/build-module/components/inserter/menu.native.js.map +1 -1
- package/build-module/components/inserter/mobile-tab-navigation.js +7 -8
- package/build-module/components/inserter/mobile-tab-navigation.js.map +1 -1
- package/build-module/components/inserter/no-results.js +1 -2
- package/build-module/components/inserter/no-results.js.map +1 -1
- package/build-module/components/inserter/no-results.native.js +1 -2
- package/build-module/components/inserter/no-results.native.js.map +1 -1
- package/build-module/components/inserter/panel.js +1 -3
- package/build-module/components/inserter/panel.js.map +1 -1
- package/build-module/components/inserter/preview-panel.js +1 -2
- package/build-module/components/inserter/preview-panel.js.map +1 -1
- package/build-module/components/inserter/quick-inserter.js +6 -7
- package/build-module/components/inserter/quick-inserter.js.map +1 -1
- package/build-module/components/inserter/search-results.js +2 -3
- package/build-module/components/inserter/search-results.js.map +1 -1
- package/build-module/components/inserter/tabs.native.js.map +1 -1
- package/build-module/components/inserter-button/index.native.js +1 -2
- package/build-module/components/inserter-button/index.native.js.map +1 -1
- package/build-module/components/inserter-list-item/index.js +1 -2
- package/build-module/components/inserter-list-item/index.js.map +1 -1
- package/build-module/components/inserter-listbox/index.js +1 -2
- package/build-module/components/inserter-listbox/index.js.map +1 -1
- package/build-module/components/inspector-controls/block-support-tools-panel.js.map +1 -1
- package/build-module/components/inspector-controls/fill.js.map +1 -1
- package/build-module/components/inspector-controls/fill.native.js +1 -3
- package/build-module/components/inspector-controls/fill.native.js.map +1 -1
- package/build-module/components/inspector-controls/slot.js.map +1 -1
- package/build-module/components/inspector-controls/slot.native.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/index.js +1 -2
- package/build-module/components/inspector-controls-tabs/index.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/settings-tab.js +1 -3
- package/build-module/components/inspector-controls-tabs/settings-tab.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/styles-tab.js +1 -3
- package/build-module/components/inspector-controls-tabs/styles-tab.js.map +1 -1
- package/build-module/components/inspector-popover-header/index.js +1 -2
- package/build-module/components/inspector-popover-header/index.js.map +1 -1
- package/build-module/components/line-height-control/index.js.map +1 -1
- package/build-module/components/link-control/index.js +2 -5
- package/build-module/components/link-control/index.js.map +1 -1
- package/build-module/components/link-control/is-url-like.js.map +1 -1
- package/build-module/components/link-control/link-preview.js +1 -3
- package/build-module/components/link-control/link-preview.js.map +1 -1
- package/build-module/components/link-control/search-create-button.js +1 -1
- package/build-module/components/link-control/search-create-button.js.map +1 -1
- package/build-module/components/link-control/search-input.js +4 -7
- package/build-module/components/link-control/search-input.js.map +1 -1
- package/build-module/components/link-control/search-results.js +6 -17
- package/build-module/components/link-control/search-results.js.map +1 -1
- package/build-module/components/link-control/settings-drawer.js +1 -3
- package/build-module/components/link-control/settings-drawer.js.map +1 -1
- package/build-module/components/link-control/settings.js +1 -2
- package/build-module/components/link-control/settings.js.map +1 -1
- package/build-module/components/link-control/use-rich-url-data.js.map +1 -1
- package/build-module/components/list-view/appender.js +2 -3
- package/build-module/components/list-view/appender.js.map +1 -1
- package/build-module/components/list-view/block-contents.js +2 -28
- package/build-module/components/list-view/block-contents.js.map +1 -1
- package/build-module/components/list-view/block-select-button.js +1 -2
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/list-view/block.js +1 -3
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/branch.js +1 -3
- package/build-module/components/list-view/branch.js.map +1 -1
- package/build-module/components/list-view/drop-indicator.js +1 -2
- package/build-module/components/list-view/drop-indicator.js.map +1 -1
- package/build-module/components/list-view/index.js +1 -2
- package/build-module/components/list-view/index.js.map +1 -1
- package/build-module/components/list-view/use-block-selection.js +2 -2
- package/build-module/components/list-view/use-block-selection.js.map +1 -1
- package/build-module/components/list-view/utils.js +1 -1
- package/build-module/components/list-view/utils.js.map +1 -1
- package/build-module/components/media-placeholder/index.js +1 -3
- package/build-module/components/media-placeholder/index.js.map +1 -1
- package/build-module/components/media-placeholder/index.native.js +2 -4
- package/build-module/components/media-placeholder/index.native.js.map +1 -1
- package/build-module/components/media-replace-flow/index.js +1 -3
- package/build-module/components/media-replace-flow/index.js.map +1 -1
- package/build-module/components/media-upload/index.native.js +1 -3
- package/build-module/components/media-upload/index.native.js.map +1 -1
- package/build-module/components/media-upload-progress/index.native.js +1 -2
- package/build-module/components/media-upload-progress/index.native.js.map +1 -1
- package/build-module/components/multi-selection-inspector/index.js +3 -4
- package/build-module/components/multi-selection-inspector/index.js.map +1 -1
- package/build-module/components/observe-typing/index.js +1 -0
- package/build-module/components/observe-typing/index.js.map +1 -1
- package/build-module/components/provider/index.js +1 -2
- package/build-module/components/provider/index.js.map +1 -1
- package/build-module/components/publish-date-time-picker/index.js +1 -2
- package/build-module/components/publish-date-time-picker/index.js.map +1 -1
- package/build-module/components/recursion-provider/index.js +1 -0
- package/build-module/components/recursion-provider/index.js.map +1 -1
- package/build-module/components/responsive-block-control/index.js +4 -5
- package/build-module/components/responsive-block-control/index.js.map +1 -1
- package/build-module/components/responsive-block-control/label.js +2 -4
- package/build-module/components/responsive-block-control/label.js.map +1 -1
- package/build-module/components/rich-text/content.js.map +1 -1
- package/build-module/components/rich-text/event-listeners/before-input-rules.js +2 -2
- package/build-module/components/rich-text/event-listeners/before-input-rules.js.map +1 -1
- package/build-module/components/rich-text/event-listeners/delete.js +2 -2
- package/build-module/components/rich-text/event-listeners/delete.js.map +1 -1
- package/build-module/components/rich-text/event-listeners/enter.js +2 -2
- package/build-module/components/rich-text/event-listeners/enter.js.map +1 -1
- package/build-module/components/rich-text/event-listeners/firefox-compat.js +2 -2
- package/build-module/components/rich-text/event-listeners/firefox-compat.js.map +1 -1
- package/build-module/components/rich-text/event-listeners/input-events.js +2 -2
- package/build-module/components/rich-text/event-listeners/input-events.js.map +1 -1
- package/build-module/components/rich-text/event-listeners/input-rules.js +2 -2
- package/build-module/components/rich-text/event-listeners/input-rules.js.map +1 -1
- package/build-module/components/rich-text/event-listeners/insert-replacement-text.js +2 -2
- package/build-module/components/rich-text/event-listeners/insert-replacement-text.js.map +1 -1
- package/build-module/components/rich-text/event-listeners/paste-handler.js +2 -2
- package/build-module/components/rich-text/event-listeners/paste-handler.js.map +1 -1
- package/build-module/components/rich-text/event-listeners/remove-browser-shortcuts.js +2 -2
- package/build-module/components/rich-text/event-listeners/remove-browser-shortcuts.js.map +1 -1
- package/build-module/components/rich-text/event-listeners/shortcuts.js +2 -2
- package/build-module/components/rich-text/event-listeners/shortcuts.js.map +1 -1
- package/build-module/components/rich-text/event-listeners/undo-automatic-change.js +2 -2
- package/build-module/components/rich-text/event-listeners/undo-automatic-change.js.map +1 -1
- package/build-module/components/rich-text/file-paste-handler.native.js.map +1 -1
- package/build-module/components/rich-text/format-toolbar/index.js +1 -3
- package/build-module/components/rich-text/format-toolbar/index.js.map +1 -1
- package/build-module/components/rich-text/format-toolbar/index.native.js +1 -3
- package/build-module/components/rich-text/format-toolbar/index.native.js.map +1 -1
- package/build-module/components/rich-text/index.js +4 -5
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/index.native.js +1 -3
- package/build-module/components/rich-text/index.native.js.map +1 -1
- package/build-module/components/rich-text/multiline.js.map +1 -1
- package/build-module/components/rich-text/native/get-format-colors.native.js.map +1 -1
- package/build-module/components/rich-text/native/index.js +1 -1
- package/build-module/components/rich-text/native/index.js.map +1 -1
- package/build-module/components/rich-text/native/index.native.js +1 -3
- package/build-module/components/rich-text/native/index.native.js.map +1 -1
- package/build-module/components/rich-text/native/toolbar-button-with-options.native.js +1 -3
- package/build-module/components/rich-text/native/toolbar-button-with-options.native.js.map +1 -1
- package/build-module/components/rich-text/native/use-format-types.js +1 -0
- package/build-module/components/rich-text/native/use-format-types.js.map +1 -1
- package/build-module/components/rich-text/toolbar-button.js.map +1 -1
- package/build-module/components/rich-text/use-format-types.js +1 -0
- package/build-module/components/rich-text/use-format-types.js.map +1 -1
- package/build-module/components/spacing-sizes-control/index.js +1 -2
- package/build-module/components/spacing-sizes-control/index.js.map +1 -1
- package/build-module/components/spacing-sizes-control/input-controls/axial.js +1 -2
- package/build-module/components/spacing-sizes-control/input-controls/axial.js.map +1 -1
- package/build-module/components/spacing-sizes-control/input-controls/separated.js +1 -2
- package/build-module/components/spacing-sizes-control/input-controls/separated.js.map +1 -1
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js +1 -3
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build-module/components/spacing-sizes-control/utils.js +1 -0
- package/build-module/components/spacing-sizes-control/utils.js.map +1 -1
- package/build-module/components/tabbed-sidebar/index.js +1 -2
- package/build-module/components/tabbed-sidebar/index.js.map +1 -1
- package/build-module/components/tool-selector/index.js +14 -11
- package/build-module/components/tool-selector/index.js.map +1 -1
- package/build-module/components/typewriter/index.js +1 -0
- package/build-module/components/typewriter/index.js.map +1 -1
- package/build-module/components/unsupported-block-details/index.native.js +1 -2
- package/build-module/components/unsupported-block-details/index.native.js.map +1 -1
- package/build-module/components/url-input/button.js +1 -2
- package/build-module/components/url-input/button.js.map +1 -1
- package/build-module/components/url-input/index.js +2 -4
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/components/url-popover/image-url-input-ui.js +1 -3
- package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build-module/components/url-popover/index.js +1 -2
- package/build-module/components/url-popover/index.js.map +1 -1
- package/build-module/components/url-popover/link-editor.js +1 -2
- package/build-module/components/url-popover/link-editor.js.map +1 -1
- package/build-module/components/url-popover/link-viewer.js +1 -2
- package/build-module/components/url-popover/link-viewer.js.map +1 -1
- package/build-module/components/use-block-commands/index.js +1 -62
- package/build-module/components/use-block-commands/index.js.map +1 -1
- package/build-module/components/use-block-drop-zone/index.js.map +1 -1
- package/build-module/components/use-flash-editable-blocks/index.js.map +1 -1
- package/build-module/components/use-moving-animation/index.js.map +1 -1
- package/build-module/components/video-player/index.native.js +1 -2
- package/build-module/components/video-player/index.native.js.map +1 -1
- package/build-module/components/warning/index.js +1 -2
- package/build-module/components/warning/index.js.map +1 -1
- package/build-module/components/warning/index.native.js +1 -2
- package/build-module/components/warning/index.native.js.map +1 -1
- package/build-module/components/writing-flow/index.js +1 -3
- package/build-module/components/writing-flow/index.js.map +1 -1
- package/build-module/components/writing-flow/use-tab-nav.js +24 -31
- package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build-module/hooks/align.js.map +1 -1
- package/build-module/hooks/anchor.js +1 -3
- package/build-module/hooks/anchor.js.map +1 -1
- package/build-module/hooks/block-bindings.js +1 -3
- package/build-module/hooks/block-bindings.js.map +1 -1
- package/build-module/hooks/block-hooks.js +2 -3
- package/build-module/hooks/block-hooks.js.map +1 -1
- package/build-module/hooks/block-style-variation.js +1 -2
- package/build-module/hooks/block-style-variation.js.map +1 -1
- package/build-module/hooks/dimensions.js +1 -3
- package/build-module/hooks/dimensions.js.map +1 -1
- package/build-module/hooks/duotone.js +5 -4
- package/build-module/hooks/duotone.js.map +1 -1
- package/build-module/hooks/font-family.js.map +1 -1
- package/build-module/hooks/gap.js.map +1 -1
- package/build-module/hooks/generated-class-name.js +1 -0
- package/build-module/hooks/generated-class-name.js.map +1 -1
- package/build-module/hooks/grid-visualizer.js +1 -3
- package/build-module/hooks/grid-visualizer.js.map +1 -1
- package/build-module/hooks/layout-child.js +5 -4
- package/build-module/hooks/layout-child.js.map +1 -1
- package/build-module/hooks/layout.js +1 -3
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/hooks/position.js +5 -2
- package/build-module/hooks/position.js.map +1 -1
- package/build-module/hooks/spacing-visualizer.js.map +1 -1
- package/build-module/hooks/style.js +1 -3
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/hooks/text-align.js.map +1 -1
- package/build-module/hooks/typography.native.js +1 -2
- package/build-module/hooks/typography.native.js.map +1 -1
- package/build-module/hooks/use-bindings-attributes.js +1 -2
- package/build-module/hooks/use-bindings-attributes.js.map +1 -1
- package/build-module/hooks/use-typography-props.js.map +1 -1
- package/build-module/hooks/use-zoom-out.js +24 -17
- package/build-module/hooks/use-zoom-out.js.map +1 -1
- package/build-module/layouts/constrained.js +1 -3
- package/build-module/layouts/constrained.js.map +1 -1
- package/build-module/layouts/flex.js +1 -3
- package/build-module/layouts/flex.js.map +1 -1
- package/build-module/layouts/grid.js +1 -3
- package/build-module/layouts/grid.js.map +1 -1
- package/build-module/layouts/utils.js.map +1 -1
- package/build-module/store/actions.js +17 -18
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/private-actions.js +14 -0
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-selectors.js +98 -7
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +22 -41
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +150 -70
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/store/utils.js +3 -2
- package/build-module/store/utils.js.map +1 -1
- package/build-module/utils/block-bindings.js +2 -0
- package/build-module/utils/block-bindings.js.map +1 -1
- package/build-module/utils/get-font-styles-and-weights.js +1 -1
- package/build-module/utils/get-font-styles-and-weights.js.map +1 -1
- package/build-module/utils/get-px-from-css-unit.js +1 -1
- package/build-module/utils/get-px-from-css-unit.js.map +1 -1
- package/build-module/utils/object.js +1 -0
- package/build-module/utils/object.js.map +1 -1
- package/build-module/utils/pasting.js.map +1 -1
- package/build-style/content-rtl.css +22 -73
- package/build-style/content.css +22 -73
- package/build-style/default-editor-styles-rtl.css +10 -1
- package/build-style/default-editor-styles.css +10 -1
- package/build-style/style-rtl.css +48 -165
- package/build-style/style.css +48 -165
- package/package.json +33 -33
- package/src/autocompleters/link.js +2 -1
- package/src/components/block-actions/index.js +1 -13
- package/src/components/block-canvas/style.scss +0 -1
- package/src/components/block-draggable/style.scss +2 -2
- package/src/components/block-inspector/index.js +79 -95
- package/src/components/block-list/block.js +7 -25
- package/src/components/block-list/content.scss +4 -63
- package/src/components/block-list/index.js +21 -29
- package/src/components/block-list/use-block-props/index.js +2 -8
- package/src/components/block-list/use-block-props/use-selected-block-event-handlers.js +25 -4
- package/src/components/block-list/use-in-between-inserter.js +5 -2
- package/src/components/block-list/zoom-out-separator.js +32 -14
- package/src/components/block-navigation/dropdown.js +1 -2
- package/src/components/block-parent-selector/index.js +13 -10
- package/src/components/block-pattern-setup/setup-toolbar.js +5 -10
- package/src/components/block-patterns-paging/index.js +8 -7
- package/src/components/block-patterns-paging/style.scss +10 -27
- package/src/components/block-popover/index.js +64 -2
- package/src/components/block-preview/auto.js +1 -4
- package/src/components/block-quick-navigation/index.js +1 -2
- package/src/components/block-settings-menu/block-settings-dropdown.js +120 -106
- package/src/components/block-settings-menu-controls/index.js +0 -15
- package/src/components/block-switcher/index.js +37 -30
- package/src/components/block-toolbar/index.js +22 -34
- package/src/components/block-toolbar/style.scss +10 -1
- package/src/components/block-toolbar/use-has-block-toolbar.js +19 -31
- package/src/components/block-tools/index.js +7 -27
- package/src/components/block-tools/insertion-point.js +1 -4
- package/src/components/block-tools/style.scss +0 -90
- package/src/components/block-tools/use-show-block-tools.js +10 -13
- package/src/components/block-tools/zoom-out-mode-inserter-button.js +2 -17
- package/src/components/block-tools/zoom-out-mode-inserters.js +11 -19
- package/src/components/block-tools/zoom-out-popover.js +2 -1
- package/src/components/block-tools/zoom-out-toolbar.js +4 -36
- package/src/components/font-family/README.md +5 -1
- package/src/components/global-styles/border-panel.js +1 -1
- package/src/components/global-styles/dimensions-panel.js +1 -1
- package/src/components/iframe/content.scss +20 -24
- package/src/components/iframe/index.js +56 -12
- package/src/components/iframe/style.scss +6 -5
- package/src/components/inner-blocks/index.js +1 -16
- package/src/components/inner-blocks/use-nested-settings-update.js +16 -10
- package/src/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js +1 -1
- package/src/components/inserter/block-types-tab.js +1 -1
- package/src/components/inserter/category-tabs/index.js +1 -11
- package/src/components/inserter/hooks/use-block-types-state.js +34 -14
- package/src/components/inserter/hooks/use-insertion-point.js +35 -13
- package/src/components/inserter/hooks/use-patterns-state.js +46 -9
- package/src/components/inserter/media-tab/media-preview.js +38 -12
- package/src/components/inserter/menu.js +4 -4
- package/src/components/inserter/mobile-tab-navigation.js +10 -13
- package/src/components/inserter/quick-inserter.js +6 -5
- package/src/components/inserter/style.scss +1 -69
- package/src/components/inspector-controls-tabs/style.scss +2 -6
- package/src/components/link-control/index.js +0 -1
- package/src/components/link-control/search-input.js +4 -5
- package/src/components/link-control/search-results.js +2 -13
- package/src/components/link-control/test/index.js +84 -46
- package/src/components/list-view/block-contents.js +1 -28
- package/src/components/list-view/style.scss +0 -14
- package/src/components/media-replace-flow/test/index.js +1 -1
- package/src/components/responsive-block-control/style.scss +0 -1
- package/src/components/rich-text/style.scss +5 -0
- package/src/components/tool-selector/index.js +15 -7
- package/src/components/tool-selector/style.scss +5 -0
- package/src/components/use-block-commands/index.js +0 -58
- package/src/components/writing-flow/use-tab-nav.js +32 -40
- package/src/content.scss +0 -1
- package/src/hooks/duotone.js +4 -1
- package/src/hooks/layout-child.js +4 -1
- package/src/hooks/position.js +4 -1
- package/src/hooks/use-zoom-out.js +36 -20
- package/src/store/actions.js +17 -15
- package/src/store/private-actions.js +14 -0
- package/src/store/private-selectors.js +120 -16
- package/src/store/reducer.js +22 -45
- package/src/store/selectors.js +218 -118
- package/src/store/test/private-actions.js +15 -0
- package/src/store/test/private-selectors.js +41 -1
- package/src/store/test/reducer.js +40 -4
- package/src/store/test/selectors.js +195 -21
- package/src/store/utils.js +4 -2
- package/src/style.scss +1 -0
- package/src/utils/block-bindings.js +2 -0
- package/build/components/block-controls/use-has-block-controls.js +0 -43
- package/build/components/block-controls/use-has-block-controls.js.map +0 -1
- package/build/components/block-list/use-block-props/use-nav-mode-exit.js +0 -54
- package/build/components/block-list/use-block-props/use-nav-mode-exit.js.map +0 -1
- package/build/components/block-tools/block-selection-button.js +0 -259
- package/build/components/block-tools/block-selection-button.js.map +0 -1
- package/build/components/block-tools/block-toolbar-breadcrumb.js +0 -57
- package/build/components/block-tools/block-toolbar-breadcrumb.js.map +0 -1
- package/build/components/inserter/tabs.js +0 -78
- package/build/components/inserter/tabs.js.map +0 -1
- package/build-module/components/block-controls/use-has-block-controls.js +0 -34
- package/build-module/components/block-controls/use-has-block-controls.js.map +0 -1
- package/build-module/components/block-list/use-block-props/use-nav-mode-exit.js +0 -48
- package/build-module/components/block-list/use-block-props/use-nav-mode-exit.js.map +0 -1
- package/build-module/components/block-tools/block-selection-button.js +0 -254
- package/build-module/components/block-tools/block-selection-button.js.map +0 -1
- package/build-module/components/block-tools/block-toolbar-breadcrumb.js +0 -49
- package/build-module/components/block-tools/block-toolbar-breadcrumb.js.map +0 -1
- package/build-module/components/inserter/tabs.js +0 -72
- package/build-module/components/inserter/tabs.js.map +0 -1
- package/src/components/block-controls/use-has-block-controls.js +0 -35
- package/src/components/block-list/use-block-props/use-nav-mode-exit.js +0 -46
- package/src/components/block-tools/block-selection-button.js +0 -302
- package/src/components/block-tools/block-toolbar-breadcrumb.js +0 -51
- package/src/components/inner-blocks/content.scss +0 -13
- package/src/components/inserter/tabs.js +0 -78
- package/src/components/inserter/test/block-types-tab.native.js +0 -67
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["check","aspectRatio","aspectRatioIcon","DropdownMenu","MenuGroup","MenuItem","__","useSettings","POPOVER_PROPS","useImageEditingContext","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","AspectRatioGroup","aspectRatios","isDisabled","label","onClick","value","children","map","name","slug","ratio","disabled","role","isSelected","icon","undefined","ratioToNumber","str","a","b","rest","split","Number","isNaN","length","NaN","presetRatioAsNumber","AspectRatioDropdown","toggleProps","isInProgress","aspect","setAspect","defaultAspect","defaultRatios","themeRatios","showDefaultRatios","popoverProps","onClose","newAspect","filter"],"sources":["@wordpress/block-editor/src/components/image-editor/aspect-ratio-dropdown.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { check, aspectRatio as aspectRatioIcon } from '@wordpress/icons';\nimport { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { useSettings } from '../use-settings';\nimport { POPOVER_PROPS } from './constants';\nimport { useImageEditingContext } from './context';\n\nfunction AspectRatioGroup( {\n\taspectRatios,\n\tisDisabled,\n\tlabel,\n\tonClick,\n\tvalue,\n} ) {\n\treturn (\n\t\t<MenuGroup label={ label }>\n\t\t\t{ aspectRatios.map( ( { name, slug, ratio } ) => (\n\t\t\t\t<MenuItem\n\t\t\t\t\tkey={ slug }\n\t\t\t\t\tdisabled={ isDisabled }\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\tonClick( ratio );\n\t\t\t\t\t} }\n\t\t\t\t\trole=\"menuitemradio\"\n\t\t\t\t\tisSelected={ ratio === value }\n\t\t\t\t\ticon={ ratio === value ? check : undefined }\n\t\t\t\t>\n\t\t\t\t\t{ name }\n\t\t\t\t</MenuItem>\n\t\t\t) ) }\n\t\t</MenuGroup>\n\t);\n}\n\nexport function ratioToNumber( str ) {\n\t// TODO: support two-value aspect ratio?\n\t// https://css-tricks.com/almanac/properties/a/aspect-ratio/#aa-it-can-take-two-values\n\tconst [ a, b, ...rest ] = str.split( '/' ).map( Number );\n\tif (\n\t\ta <= 0 ||\n\t\tb <= 0 ||\n\t\tNumber.isNaN( a ) ||\n\t\tNumber.isNaN( b ) ||\n\t\trest.length\n\t) {\n\t\treturn NaN;\n\t}\n\treturn b ? a / b : a;\n}\n\nfunction presetRatioAsNumber( { ratio, ...rest } ) {\n\treturn {\n\t\tratio: ratioToNumber( ratio ),\n\t\t...rest,\n\t};\n}\n\nexport default function AspectRatioDropdown( { toggleProps } ) {\n\tconst { isInProgress, aspect, setAspect, defaultAspect } =\n\t\tuseImageEditingContext();\n\n\tconst [ defaultRatios, themeRatios, showDefaultRatios ] = useSettings(\n\t\t'dimensions.aspectRatios.default',\n\t\t'dimensions.aspectRatios.theme',\n\t\t'dimensions.defaultAspectRatios'\n\t);\n\n\treturn (\n\t\t<DropdownMenu\n\t\t\ticon={ aspectRatioIcon }\n\t\t\tlabel={ __( 'Aspect Ratio' ) }\n\t\t\tpopoverProps={ POPOVER_PROPS }\n\t\t\ttoggleProps={ toggleProps }\n\t\t>\n\t\t\t{ ( { onClose } ) => (\n\t\t\t\t<>\n\t\t\t\t\t<AspectRatioGroup\n\t\t\t\t\t\tisDisabled={ isInProgress }\n\t\t\t\t\t\tonClick={ ( newAspect ) => {\n\t\t\t\t\t\t\tsetAspect( newAspect );\n\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tvalue={ aspect }\n\t\t\t\t\t\taspectRatios={ [\n\t\t\t\t\t\t\t// All ratios should be mirrored in AspectRatioTool in @wordpress/block-editor.\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tslug: 'original',\n\t\t\t\t\t\t\t\tname: __( 'Original' ),\n\t\t\t\t\t\t\t\taspect: defaultAspect,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t...( showDefaultRatios\n\t\t\t\t\t\t\t\t? defaultRatios\n\t\t\t\t\t\t\t\t\t\t.map( presetRatioAsNumber )\n\t\t\t\t\t\t\t\t\t\t.filter( ( { ratio } ) => ratio === 1 )\n\t\t\t\t\t\t\t\t: [] ),\n\t\t\t\t\t\t] }\n\t\t\t\t\t/>\n\t\t\t\t\t{ themeRatios?.length > 0 && (\n\t\t\t\t\t\t<AspectRatioGroup\n\t\t\t\t\t\t\tlabel={ __( 'Theme' ) }\n\t\t\t\t\t\t\tisDisabled={ isInProgress }\n\t\t\t\t\t\t\tonClick={ ( newAspect ) => {\n\t\t\t\t\t\t\t\tsetAspect( newAspect );\n\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tvalue={ aspect }\n\t\t\t\t\t\t\taspectRatios={ themeRatios }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ showDefaultRatios && (\n\t\t\t\t\t\t<AspectRatioGroup\n\t\t\t\t\t\t\tlabel={ __( 'Landscape' ) }\n\t\t\t\t\t\t\tisDisabled={ isInProgress }\n\t\t\t\t\t\t\tonClick={ ( newAspect ) => {\n\t\t\t\t\t\t\t\tsetAspect( newAspect );\n\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tvalue={ aspect }\n\t\t\t\t\t\t\taspectRatios={ defaultRatios\n\t\t\t\t\t\t\t\t.map( presetRatioAsNumber )\n\t\t\t\t\t\t\t\t.filter( ( { ratio } ) => ratio > 1 ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ showDefaultRatios && (\n\t\t\t\t\t\t<AspectRatioGroup\n\t\t\t\t\t\t\tlabel={ __( 'Portrait' ) }\n\t\t\t\t\t\t\tisDisabled={ isInProgress }\n\t\t\t\t\t\t\tonClick={ ( newAspect ) => {\n\t\t\t\t\t\t\t\tsetAspect( newAspect );\n\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tvalue={ aspect }\n\t\t\t\t\t\t\taspectRatios={ defaultRatios\n\t\t\t\t\t\t\t\t.map( presetRatioAsNumber )\n\t\t\t\t\t\t\t\t.filter( ( { ratio } ) => ratio < 1 ) }\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</DropdownMenu>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAK,EAAEC,WAAW,IAAIC,eAAe,QAAQ,kBAAkB;AACxE,SAASC,YAAY,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,uBAAuB;AACzE,SAASC,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;AACA,SAASC,WAAW,QAAQ,iBAAiB;AAC7C,SAASC,aAAa,QAAQ,aAAa;AAC3C,SAASC,sBAAsB,QAAQ,WAAW;AAAC,SAAAC,GAAA,IAAAC,IAAA
|
|
1
|
+
{"version":3,"names":["check","aspectRatio","aspectRatioIcon","DropdownMenu","MenuGroup","MenuItem","__","useSettings","POPOVER_PROPS","useImageEditingContext","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","AspectRatioGroup","aspectRatios","isDisabled","label","onClick","value","children","map","name","slug","ratio","disabled","role","isSelected","icon","undefined","ratioToNumber","str","a","b","rest","split","Number","isNaN","length","NaN","presetRatioAsNumber","AspectRatioDropdown","toggleProps","isInProgress","aspect","setAspect","defaultAspect","defaultRatios","themeRatios","showDefaultRatios","popoverProps","onClose","newAspect","filter"],"sources":["@wordpress/block-editor/src/components/image-editor/aspect-ratio-dropdown.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { check, aspectRatio as aspectRatioIcon } from '@wordpress/icons';\nimport { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { useSettings } from '../use-settings';\nimport { POPOVER_PROPS } from './constants';\nimport { useImageEditingContext } from './context';\n\nfunction AspectRatioGroup( {\n\taspectRatios,\n\tisDisabled,\n\tlabel,\n\tonClick,\n\tvalue,\n} ) {\n\treturn (\n\t\t<MenuGroup label={ label }>\n\t\t\t{ aspectRatios.map( ( { name, slug, ratio } ) => (\n\t\t\t\t<MenuItem\n\t\t\t\t\tkey={ slug }\n\t\t\t\t\tdisabled={ isDisabled }\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\tonClick( ratio );\n\t\t\t\t\t} }\n\t\t\t\t\trole=\"menuitemradio\"\n\t\t\t\t\tisSelected={ ratio === value }\n\t\t\t\t\ticon={ ratio === value ? check : undefined }\n\t\t\t\t>\n\t\t\t\t\t{ name }\n\t\t\t\t</MenuItem>\n\t\t\t) ) }\n\t\t</MenuGroup>\n\t);\n}\n\nexport function ratioToNumber( str ) {\n\t// TODO: support two-value aspect ratio?\n\t// https://css-tricks.com/almanac/properties/a/aspect-ratio/#aa-it-can-take-two-values\n\tconst [ a, b, ...rest ] = str.split( '/' ).map( Number );\n\tif (\n\t\ta <= 0 ||\n\t\tb <= 0 ||\n\t\tNumber.isNaN( a ) ||\n\t\tNumber.isNaN( b ) ||\n\t\trest.length\n\t) {\n\t\treturn NaN;\n\t}\n\treturn b ? a / b : a;\n}\n\nfunction presetRatioAsNumber( { ratio, ...rest } ) {\n\treturn {\n\t\tratio: ratioToNumber( ratio ),\n\t\t...rest,\n\t};\n}\n\nexport default function AspectRatioDropdown( { toggleProps } ) {\n\tconst { isInProgress, aspect, setAspect, defaultAspect } =\n\t\tuseImageEditingContext();\n\n\tconst [ defaultRatios, themeRatios, showDefaultRatios ] = useSettings(\n\t\t'dimensions.aspectRatios.default',\n\t\t'dimensions.aspectRatios.theme',\n\t\t'dimensions.defaultAspectRatios'\n\t);\n\n\treturn (\n\t\t<DropdownMenu\n\t\t\ticon={ aspectRatioIcon }\n\t\t\tlabel={ __( 'Aspect Ratio' ) }\n\t\t\tpopoverProps={ POPOVER_PROPS }\n\t\t\ttoggleProps={ toggleProps }\n\t\t>\n\t\t\t{ ( { onClose } ) => (\n\t\t\t\t<>\n\t\t\t\t\t<AspectRatioGroup\n\t\t\t\t\t\tisDisabled={ isInProgress }\n\t\t\t\t\t\tonClick={ ( newAspect ) => {\n\t\t\t\t\t\t\tsetAspect( newAspect );\n\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tvalue={ aspect }\n\t\t\t\t\t\taspectRatios={ [\n\t\t\t\t\t\t\t// All ratios should be mirrored in AspectRatioTool in @wordpress/block-editor.\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tslug: 'original',\n\t\t\t\t\t\t\t\tname: __( 'Original' ),\n\t\t\t\t\t\t\t\taspect: defaultAspect,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t...( showDefaultRatios\n\t\t\t\t\t\t\t\t? defaultRatios\n\t\t\t\t\t\t\t\t\t\t.map( presetRatioAsNumber )\n\t\t\t\t\t\t\t\t\t\t.filter( ( { ratio } ) => ratio === 1 )\n\t\t\t\t\t\t\t\t: [] ),\n\t\t\t\t\t\t] }\n\t\t\t\t\t/>\n\t\t\t\t\t{ themeRatios?.length > 0 && (\n\t\t\t\t\t\t<AspectRatioGroup\n\t\t\t\t\t\t\tlabel={ __( 'Theme' ) }\n\t\t\t\t\t\t\tisDisabled={ isInProgress }\n\t\t\t\t\t\t\tonClick={ ( newAspect ) => {\n\t\t\t\t\t\t\t\tsetAspect( newAspect );\n\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tvalue={ aspect }\n\t\t\t\t\t\t\taspectRatios={ themeRatios }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ showDefaultRatios && (\n\t\t\t\t\t\t<AspectRatioGroup\n\t\t\t\t\t\t\tlabel={ __( 'Landscape' ) }\n\t\t\t\t\t\t\tisDisabled={ isInProgress }\n\t\t\t\t\t\t\tonClick={ ( newAspect ) => {\n\t\t\t\t\t\t\t\tsetAspect( newAspect );\n\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tvalue={ aspect }\n\t\t\t\t\t\t\taspectRatios={ defaultRatios\n\t\t\t\t\t\t\t\t.map( presetRatioAsNumber )\n\t\t\t\t\t\t\t\t.filter( ( { ratio } ) => ratio > 1 ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ showDefaultRatios && (\n\t\t\t\t\t\t<AspectRatioGroup\n\t\t\t\t\t\t\tlabel={ __( 'Portrait' ) }\n\t\t\t\t\t\t\tisDisabled={ isInProgress }\n\t\t\t\t\t\t\tonClick={ ( newAspect ) => {\n\t\t\t\t\t\t\t\tsetAspect( newAspect );\n\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tvalue={ aspect }\n\t\t\t\t\t\t\taspectRatios={ defaultRatios\n\t\t\t\t\t\t\t\t.map( presetRatioAsNumber )\n\t\t\t\t\t\t\t\t.filter( ( { ratio } ) => ratio < 1 ) }\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</DropdownMenu>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAK,EAAEC,WAAW,IAAIC,eAAe,QAAQ,kBAAkB;AACxE,SAASC,YAAY,EAAEC,SAAS,EAAEC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}
|
|
@@ -15,9 +15,7 @@ import { useResizeObserver } from '@wordpress/compose';
|
|
|
15
15
|
*/
|
|
16
16
|
import { MIN_ZOOM, MAX_ZOOM } from './constants';
|
|
17
17
|
import { useImageEditingContext } from './context';
|
|
18
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
19
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
20
|
-
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
18
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
21
19
|
export default function ImageCropper({
|
|
22
20
|
url,
|
|
23
21
|
width,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Cropper","clsx","Spinner","useResizeObserver","MIN_ZOOM","MAX_ZOOM","useImageEditingContext","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","ImageCropper","url","width","height","naturalHeight","naturalWidth","borderProps","isInProgress","editedUrl","position","zoom","aspect","setPosition","setCrop","setZoom","rotation","contentResizeListener","clientWidth","editedHeight","area","className","style","children","image","disabled","minZoom","maxZoom","crop","onCropChange","pos","onCropComplete","newCropPercent","onZoomChange","newZoom"],"sources":["@wordpress/block-editor/src/components/image-editor/cropper.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport Cropper from 'react-easy-crop';\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { Spinner } from '@wordpress/components';\nimport { useResizeObserver } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { MIN_ZOOM, MAX_ZOOM } from './constants';\n\nimport { useImageEditingContext } from './context';\n\nexport default function ImageCropper( {\n\turl,\n\twidth,\n\theight,\n\tnaturalHeight,\n\tnaturalWidth,\n\tborderProps,\n} ) {\n\tconst {\n\t\tisInProgress,\n\t\teditedUrl,\n\t\tposition,\n\t\tzoom,\n\t\taspect,\n\t\tsetPosition,\n\t\tsetCrop,\n\t\tsetZoom,\n\t\trotation,\n\t} = useImageEditingContext();\n\tconst [ contentResizeListener, { width: clientWidth } ] =\n\t\tuseResizeObserver();\n\n\tlet editedHeight = height || ( clientWidth * naturalHeight ) / naturalWidth;\n\n\tif ( rotation % 180 === 90 ) {\n\t\teditedHeight = ( clientWidth * naturalWidth ) / naturalHeight;\n\t}\n\n\tconst area = (\n\t\t<div\n\t\t\tclassName={ clsx(\n\t\t\t\t'wp-block-image__crop-area',\n\t\t\t\tborderProps?.className,\n\t\t\t\t{\n\t\t\t\t\t'is-applying': isInProgress,\n\t\t\t\t}\n\t\t\t) }\n\t\t\tstyle={ {\n\t\t\t\t...borderProps?.style,\n\t\t\t\twidth: width || clientWidth,\n\t\t\t\theight: editedHeight,\n\t\t\t} }\n\t\t>\n\t\t\t<Cropper\n\t\t\t\timage={ editedUrl || url }\n\t\t\t\tdisabled={ isInProgress }\n\t\t\t\tminZoom={ MIN_ZOOM / 100 }\n\t\t\t\tmaxZoom={ MAX_ZOOM / 100 }\n\t\t\t\tcrop={ position }\n\t\t\t\tzoom={ zoom / 100 }\n\t\t\t\taspect={ aspect }\n\t\t\t\tonCropChange={ ( pos ) => {\n\t\t\t\t\tsetPosition( pos );\n\t\t\t\t} }\n\t\t\t\tonCropComplete={ ( newCropPercent ) => {\n\t\t\t\t\tsetCrop( newCropPercent );\n\t\t\t\t} }\n\t\t\t\tonZoomChange={ ( newZoom ) => {\n\t\t\t\t\tsetZoom( newZoom * 100 );\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t{ isInProgress && <Spinner /> }\n\t\t</div>\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t{ contentResizeListener }\n\t\t\t{ area }\n\t\t</>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,OAAO,MAAM,iBAAiB;AACrC,OAAOC,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,OAAO,QAAQ,uBAAuB;AAC/C,SAASC,iBAAiB,QAAQ,oBAAoB;;AAEtD;AACA;AACA;AACA,SAASC,QAAQ,EAAEC,QAAQ,QAAQ,aAAa;AAEhD,SAASC,sBAAsB,QAAQ,WAAW;AAAC,SAAAC,GAAA,IAAAC,IAAA
|
|
1
|
+
{"version":3,"names":["Cropper","clsx","Spinner","useResizeObserver","MIN_ZOOM","MAX_ZOOM","useImageEditingContext","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","ImageCropper","url","width","height","naturalHeight","naturalWidth","borderProps","isInProgress","editedUrl","position","zoom","aspect","setPosition","setCrop","setZoom","rotation","contentResizeListener","clientWidth","editedHeight","area","className","style","children","image","disabled","minZoom","maxZoom","crop","onCropChange","pos","onCropComplete","newCropPercent","onZoomChange","newZoom"],"sources":["@wordpress/block-editor/src/components/image-editor/cropper.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport Cropper from 'react-easy-crop';\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { Spinner } from '@wordpress/components';\nimport { useResizeObserver } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { MIN_ZOOM, MAX_ZOOM } from './constants';\n\nimport { useImageEditingContext } from './context';\n\nexport default function ImageCropper( {\n\turl,\n\twidth,\n\theight,\n\tnaturalHeight,\n\tnaturalWidth,\n\tborderProps,\n} ) {\n\tconst {\n\t\tisInProgress,\n\t\teditedUrl,\n\t\tposition,\n\t\tzoom,\n\t\taspect,\n\t\tsetPosition,\n\t\tsetCrop,\n\t\tsetZoom,\n\t\trotation,\n\t} = useImageEditingContext();\n\tconst [ contentResizeListener, { width: clientWidth } ] =\n\t\tuseResizeObserver();\n\n\tlet editedHeight = height || ( clientWidth * naturalHeight ) / naturalWidth;\n\n\tif ( rotation % 180 === 90 ) {\n\t\teditedHeight = ( clientWidth * naturalWidth ) / naturalHeight;\n\t}\n\n\tconst area = (\n\t\t<div\n\t\t\tclassName={ clsx(\n\t\t\t\t'wp-block-image__crop-area',\n\t\t\t\tborderProps?.className,\n\t\t\t\t{\n\t\t\t\t\t'is-applying': isInProgress,\n\t\t\t\t}\n\t\t\t) }\n\t\t\tstyle={ {\n\t\t\t\t...borderProps?.style,\n\t\t\t\twidth: width || clientWidth,\n\t\t\t\theight: editedHeight,\n\t\t\t} }\n\t\t>\n\t\t\t<Cropper\n\t\t\t\timage={ editedUrl || url }\n\t\t\t\tdisabled={ isInProgress }\n\t\t\t\tminZoom={ MIN_ZOOM / 100 }\n\t\t\t\tmaxZoom={ MAX_ZOOM / 100 }\n\t\t\t\tcrop={ position }\n\t\t\t\tzoom={ zoom / 100 }\n\t\t\t\taspect={ aspect }\n\t\t\t\tonCropChange={ ( pos ) => {\n\t\t\t\t\tsetPosition( pos );\n\t\t\t\t} }\n\t\t\t\tonCropComplete={ ( newCropPercent ) => {\n\t\t\t\t\tsetCrop( newCropPercent );\n\t\t\t\t} }\n\t\t\t\tonZoomChange={ ( newZoom ) => {\n\t\t\t\t\tsetZoom( newZoom * 100 );\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t{ isInProgress && <Spinner /> }\n\t\t</div>\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t{ contentResizeListener }\n\t\t\t{ area }\n\t\t</>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,OAAO,MAAM,iBAAiB;AACrC,OAAOC,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,OAAO,QAAQ,uBAAuB;AAC/C,SAASC,iBAAiB,QAAQ,oBAAoB;;AAEtD;AACA;AACA;AACA,SAASC,QAAQ,EAAEC,QAAQ,QAAQ,aAAa;AAEhD,SAASC,sBAAsB,QAAQ,WAAW;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA,EAAAC,QAAA,IAAAC,SAAA;AAEnD,eAAe,SAASC,YAAYA,CAAE;EACrCC,GAAG;EACHC,KAAK;EACLC,MAAM;EACNC,aAAa;EACbC,YAAY;EACZC;AACD,CAAC,EAAG;EACH,MAAM;IACLC,YAAY;IACZC,SAAS;IACTC,QAAQ;IACRC,IAAI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,IAAA,CAACN,OAAO,IAAE,CAAC;EAAA,CACzB,CACL;EAED,oBACCQ,KAAA,CAAAE,SAAA;IAAAuB,QAAA,GACGN,qBAAqB,EACrBG,IAAI;EAAA,CACL,CAAC;AAEL","ignoreList":[]}
|
|
@@ -8,9 +8,7 @@ import { __ } from '@wordpress/i18n';
|
|
|
8
8
|
* Internal dependencies
|
|
9
9
|
*/
|
|
10
10
|
import { useImageEditingContext } from './context';
|
|
11
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
-
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
13
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
12
|
export default function FormControls() {
|
|
15
13
|
const {
|
|
16
14
|
isInProgress,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ToolbarButton","__","useImageEditingContext","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","FormControls","isInProgress","apply","cancel","children","onClick","disabled"],"sources":["@wordpress/block-editor/src/components/image-editor/form-controls.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { ToolbarButton } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { useImageEditingContext } from './context';\n\nexport default function FormControls() {\n\tconst { isInProgress, apply, cancel } = useImageEditingContext();\n\treturn (\n\t\t<>\n\t\t\t<ToolbarButton onClick={ apply } disabled={ isInProgress }>\n\t\t\t\t{ __( 'Apply' ) }\n\t\t\t</ToolbarButton>\n\t\t\t<ToolbarButton onClick={ cancel }>{ __( 'Cancel' ) }</ToolbarButton>\n\t\t</>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,aAAa,QAAQ,uBAAuB;AACrD,SAASC,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;AACA,SAASC,sBAAsB,QAAQ,WAAW;AAAC,SAAAC,GAAA,IAAAC,IAAA
|
|
1
|
+
{"version":3,"names":["ToolbarButton","__","useImageEditingContext","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","FormControls","isInProgress","apply","cancel","children","onClick","disabled"],"sources":["@wordpress/block-editor/src/components/image-editor/form-controls.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { ToolbarButton } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { useImageEditingContext } from './context';\n\nexport default function FormControls() {\n\tconst { isInProgress, apply, cancel } = useImageEditingContext();\n\treturn (\n\t\t<>\n\t\t\t<ToolbarButton onClick={ apply } disabled={ isInProgress }>\n\t\t\t\t{ __( 'Apply' ) }\n\t\t\t</ToolbarButton>\n\t\t\t<ToolbarButton onClick={ cancel }>{ __( 'Cancel' ) }</ToolbarButton>\n\t\t</>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,aAAa,QAAQ,uBAAuB;AACrD,SAASC,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;AACA,SAASC,sBAAsB,QAAQ,WAAW;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA,EAAAC,IAAA,IAAAC,KAAA;AAEnD,eAAe,SAASC,YAAYA,CAAA,EAAG;EACtC,MAAM;IAAEC,YAAY;IAAEC,KAAK;IAAEC;EAAO,CAAC,GAAGV,sBAAsB,CAAC,CAAC;EAChE,oBACCM,KAAA,CAAAF,SAAA;IAAAO,QAAA,gBACCT,IAAA,CAACJ,aAAa;MAACc,OAAO,EAAGH,KAAO;MAACI,QAAQ,EAAGL,YAAc;MAAAG,QAAA,EACvDZ,EAAE,CAAE,OAAQ;IAAC,CACD,CAAC,eAChBG,IAAA,CAACJ,aAAa;MAACc,OAAO,EAAGF,MAAQ;MAAAC,QAAA,EAAGZ,EAAE,CAAE,QAAS;IAAC,CAAiB,CAAC;EAAA,CACnE,CAAC;AAEL","ignoreList":[]}
|
|
@@ -13,8 +13,7 @@ import Cropper from './cropper';
|
|
|
13
13
|
import ZoomDropdown from './zoom-dropdown';
|
|
14
14
|
import RotationButton from './rotation-button';
|
|
15
15
|
import FormControls from './form-controls';
|
|
16
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
18
17
|
export default function ImageEditor({
|
|
19
18
|
id,
|
|
20
19
|
url,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ToolbarGroup","ToolbarItem","AspectRatioDropdown","BlockControls","ImageEditingProvider","Cropper","ZoomDropdown","RotationButton","FormControls","jsx","_jsx","jsxs","_jsxs","ImageEditor","id","url","width","height","naturalHeight","naturalWidth","onSaveImage","onFinishEditing","borderProps","children","toggleProps"],"sources":["@wordpress/block-editor/src/components/image-editor/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { ToolbarGroup, ToolbarItem } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport AspectRatioDropdown from './aspect-ratio-dropdown';\nimport BlockControls from '../block-controls';\nimport ImageEditingProvider from './context';\nimport Cropper from './cropper';\nimport ZoomDropdown from './zoom-dropdown';\nimport RotationButton from './rotation-button';\nimport FormControls from './form-controls';\n\nexport default function ImageEditor( {\n\tid,\n\turl,\n\twidth,\n\theight,\n\tnaturalHeight,\n\tnaturalWidth,\n\tonSaveImage,\n\tonFinishEditing,\n\tborderProps,\n} ) {\n\treturn (\n\t\t<ImageEditingProvider\n\t\t\tid={ id }\n\t\t\turl={ url }\n\t\t\tnaturalWidth={ naturalWidth }\n\t\t\tnaturalHeight={ naturalHeight }\n\t\t\tonSaveImage={ onSaveImage }\n\t\t\tonFinishEditing={ onFinishEditing }\n\t\t>\n\t\t\t<Cropper\n\t\t\t\tborderProps={ borderProps }\n\t\t\t\turl={ url }\n\t\t\t\twidth={ width }\n\t\t\t\theight={ height }\n\t\t\t\tnaturalHeight={ naturalHeight }\n\t\t\t\tnaturalWidth={ naturalWidth }\n\t\t\t/>\n\t\t\t<BlockControls>\n\t\t\t\t<ToolbarGroup>\n\t\t\t\t\t<ZoomDropdown />\n\t\t\t\t\t<ToolbarItem>\n\t\t\t\t\t\t{ ( toggleProps ) => (\n\t\t\t\t\t\t\t<AspectRatioDropdown toggleProps={ toggleProps } />\n\t\t\t\t\t\t) }\n\t\t\t\t\t</ToolbarItem>\n\t\t\t\t\t<RotationButton />\n\t\t\t\t</ToolbarGroup>\n\t\t\t\t<ToolbarGroup>\n\t\t\t\t\t<FormControls />\n\t\t\t\t</ToolbarGroup>\n\t\t\t</BlockControls>\n\t\t</ImageEditingProvider>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,YAAY,EAAEC,WAAW,QAAQ,uBAAuB;;AAEjE;AACA;AACA;AACA,OAAOC,mBAAmB,MAAM,yBAAyB;AACzD,OAAOC,aAAa,MAAM,mBAAmB;AAC7C,OAAOC,oBAAoB,MAAM,WAAW;AAC5C,OAAOC,OAAO,MAAM,WAAW;AAC/B,OAAOC,YAAY,MAAM,iBAAiB;AAC1C,OAAOC,cAAc,MAAM,mBAAmB;AAC9C,OAAOC,YAAY,MAAM,iBAAiB;AAAC,SAAAC,GAAA,IAAAC,IAAA
|
|
1
|
+
{"version":3,"names":["ToolbarGroup","ToolbarItem","AspectRatioDropdown","BlockControls","ImageEditingProvider","Cropper","ZoomDropdown","RotationButton","FormControls","jsx","_jsx","jsxs","_jsxs","ImageEditor","id","url","width","height","naturalHeight","naturalWidth","onSaveImage","onFinishEditing","borderProps","children","toggleProps"],"sources":["@wordpress/block-editor/src/components/image-editor/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { ToolbarGroup, ToolbarItem } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport AspectRatioDropdown from './aspect-ratio-dropdown';\nimport BlockControls from '../block-controls';\nimport ImageEditingProvider from './context';\nimport Cropper from './cropper';\nimport ZoomDropdown from './zoom-dropdown';\nimport RotationButton from './rotation-button';\nimport FormControls from './form-controls';\n\nexport default function ImageEditor( {\n\tid,\n\turl,\n\twidth,\n\theight,\n\tnaturalHeight,\n\tnaturalWidth,\n\tonSaveImage,\n\tonFinishEditing,\n\tborderProps,\n} ) {\n\treturn (\n\t\t<ImageEditingProvider\n\t\t\tid={ id }\n\t\t\turl={ url }\n\t\t\tnaturalWidth={ naturalWidth }\n\t\t\tnaturalHeight={ naturalHeight }\n\t\t\tonSaveImage={ onSaveImage }\n\t\t\tonFinishEditing={ onFinishEditing }\n\t\t>\n\t\t\t<Cropper\n\t\t\t\tborderProps={ borderProps }\n\t\t\t\turl={ url }\n\t\t\t\twidth={ width }\n\t\t\t\theight={ height }\n\t\t\t\tnaturalHeight={ naturalHeight }\n\t\t\t\tnaturalWidth={ naturalWidth }\n\t\t\t/>\n\t\t\t<BlockControls>\n\t\t\t\t<ToolbarGroup>\n\t\t\t\t\t<ZoomDropdown />\n\t\t\t\t\t<ToolbarItem>\n\t\t\t\t\t\t{ ( toggleProps ) => (\n\t\t\t\t\t\t\t<AspectRatioDropdown toggleProps={ toggleProps } />\n\t\t\t\t\t\t) }\n\t\t\t\t\t</ToolbarItem>\n\t\t\t\t\t<RotationButton />\n\t\t\t\t</ToolbarGroup>\n\t\t\t\t<ToolbarGroup>\n\t\t\t\t\t<FormControls />\n\t\t\t\t</ToolbarGroup>\n\t\t\t</BlockControls>\n\t\t</ImageEditingProvider>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,YAAY,EAAEC,WAAW,QAAQ,uBAAuB;;AAEjE;AACA;AACA;AACA,OAAOC,mBAAmB,MAAM,yBAAyB;AACzD,OAAOC,aAAa,MAAM,mBAAmB;AAC7C,OAAOC,oBAAoB,MAAM,WAAW;AAC5C,OAAOC,OAAO,MAAM,WAAW;AAC/B,OAAOC,YAAY,MAAM,iBAAiB;AAC1C,OAAOC,cAAc,MAAM,mBAAmB;AAC9C,OAAOC,YAAY,MAAM,iBAAiB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAE3C,eAAe,SAASC,WAAWA,CAAE;EACpCC,EAAE;EACFC,GAAG;EACHC,KAAK;EACLC,MAAM;EACNC,aAAa;EACbC,YAAY;EACZC,WAAW;EACXC,eAAe;EACfC;AACD,CAAC,EAAG;EACH,oBACCV,KAAA,CAACR,oBAAoB;IACpBU,EAAE,EAAGA,EAAI;IACTC,GAAG,EAAGA,GAAK;IACXI,YAAY,EAAGA,YAAc;IAC7BD,aAAa,EAAGA,aAAe;IAC/BE,WAAW,EAAGA,WAAa;IAC3BC,eAAe,EAAGA,eAAiB;IAAAE,QAAA,gBAEnCb,IAAA,CAACL,OAAO;MACPiB,WAAW,EAAGA,WAAa;MAC3BP,GAAG,EAAGA,GAAK;MACXC,KAAK,EAAGA,KAAO;MACfC,MAAM,EAAGA,MAAQ;MACjBC,aAAa,EAAGA,aAAe;MAC/BC,YAAY,EAAGA;IAAc,CAC7B,CAAC,eACFP,KAAA,CAACT,aAAa;MAAAoB,QAAA,gBACbX,KAAA,CAACZ,YAAY;QAAAuB,QAAA,gBACZb,IAAA,CAACJ,YAAY,IAAE,CAAC,eAChBI,IAAA,CAACT,WAAW;UAAAsB,QAAA,EACPC,WAAW,iBACdd,IAAA,CAACR,mBAAmB;YAACsB,WAAW,EAAGA;UAAa,CAAE;QAClD,CACW,CAAC,eACdd,IAAA,CAACH,cAAc,IAAE,CAAC;MAAA,CACL,CAAC,eACfG,IAAA,CAACV,YAAY;QAAAuB,QAAA,eACZb,IAAA,CAACF,YAAY,IAAE;MAAC,CACH,CAAC;IAAA,CACD,CAAC;EAAA,CACK,CAAC;AAEzB","ignoreList":[]}
|
|
@@ -69,7 +69,7 @@ export default function useSaveImage({
|
|
|
69
69
|
url: response.source_url
|
|
70
70
|
});
|
|
71
71
|
}).catch(error => {
|
|
72
|
-
createErrorNotice(sprintf(
|
|
72
|
+
createErrorNotice(sprintf(/* translators: 1. Error message */
|
|
73
73
|
__('Could not edit image. %s'), stripHTML(error.message)), {
|
|
74
74
|
id: 'image-editing-error',
|
|
75
75
|
type: 'snackbar'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["apiFetch","useDispatch","useCallback","useMemo","useState","__","sprintf","store","noticesStore","__unstableStripHTML","stripHTML","useSaveImage","crop","rotation","url","id","onSaveImage","onFinishEditing","createErrorNotice","isInProgress","setIsInProgress","cancel","apply","modifiers","push","type","args","angle","width","height","left","x","top","y","length","path","method","data","src","then","response","source_url","catch","error","message","finally"],"sources":["@wordpress/block-editor/src/components/image-editor/use-save-image.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\n// Disable Reason: Needs to be refactored.\n// eslint-disable-next-line no-restricted-imports\nimport apiFetch from '@wordpress/api-fetch';\nimport { useDispatch } from '@wordpress/data';\nimport { useCallback, useMemo, useState } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\n\nexport default function useSaveImage( {\n\tcrop,\n\trotation,\n\turl,\n\tid,\n\tonSaveImage,\n\tonFinishEditing,\n} ) {\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\tconst [ isInProgress, setIsInProgress ] = useState( false );\n\n\tconst cancel = useCallback( () => {\n\t\tsetIsInProgress( false );\n\t\tonFinishEditing();\n\t}, [ onFinishEditing ] );\n\n\tconst apply = useCallback( () => {\n\t\tsetIsInProgress( true );\n\n\t\tconst modifiers = [];\n\n\t\tif ( rotation > 0 ) {\n\t\t\tmodifiers.push( {\n\t\t\t\ttype: 'rotate',\n\t\t\t\targs: {\n\t\t\t\t\tangle: rotation,\n\t\t\t\t},\n\t\t\t} );\n\t\t}\n\n\t\t// The crop script may return some very small, sub-pixel values when the image was not cropped.\n\t\t// Crop only when the new size has changed by more than 0.1%.\n\t\tif ( crop.width < 99.9 || crop.height < 99.9 ) {\n\t\t\tmodifiers.push( {\n\t\t\t\ttype: 'crop',\n\t\t\t\targs: {\n\t\t\t\t\tleft: crop.x,\n\t\t\t\t\ttop: crop.y,\n\t\t\t\t\twidth: crop.width,\n\t\t\t\t\theight: crop.height,\n\t\t\t\t},\n\t\t\t} );\n\t\t}\n\n\t\tif ( modifiers.length === 0 ) {\n\t\t\t// No changes to apply.\n\t\t\tsetIsInProgress( false );\n\t\t\tonFinishEditing();\n\t\t\treturn;\n\t\t}\n\n\t\tapiFetch( {\n\t\t\tpath: `/wp/v2/media/${ id }/edit`,\n\t\t\tmethod: 'POST',\n\t\t\tdata: { src: url, modifiers },\n\t\t} )\n\t\t\t.then( ( response ) => {\n\t\t\t\tonSaveImage( {\n\t\t\t\t\tid: response.id,\n\t\t\t\t\turl: response.source_url,\n\t\t\t\t} );\n\t\t\t} )\n\t\t\t.catch( ( error ) => {\n\t\t\t\tcreateErrorNotice(\n\t\t\t\t\tsprintf(\n\t\t\t\t\t\t/* translators: 1. Error message */\n\t\t\t\t\t\t__( 'Could not edit image. %s' ),\n\t\t\t\t\t\tstripHTML( error.message )\n\t\t\t\t\t),\n\t\t\t\t\t{\n\t\t\t\t\t\tid: 'image-editing-error',\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t} )\n\t\t\t.finally( () => {\n\t\t\t\tsetIsInProgress( false );\n\t\t\t\tonFinishEditing();\n\t\t\t} );\n\t}, [\n\t\tcrop,\n\t\trotation,\n\t\tid,\n\t\turl,\n\t\tonSaveImage,\n\t\tcreateErrorNotice,\n\t\tonFinishEditing,\n\t] );\n\n\treturn useMemo(\n\t\t() => ( {\n\t\t\tisInProgress,\n\t\t\tapply,\n\t\t\tcancel,\n\t\t} ),\n\t\t[ isInProgress, apply, cancel ]\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA,OAAOA,QAAQ,MAAM,sBAAsB;AAC3C,SAASC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I,CAACiB;QACd;MACD,CAAE,CAAC;IACJ;IAEA,IAAKN,SAAS,CAACW,MAAM,KAAK,CAAC,EAAG;MAC7B;MACAd,eAAe,CAAE,KAAM,CAAC;MACxBH,eAAe,CAAC,CAAC;MACjB;IACD;IAEAjB,QAAQ,CAAE;MACTmC,IAAI,
|
|
1
|
+
{"version":3,"names":["apiFetch","useDispatch","useCallback","useMemo","useState","__","sprintf","store","noticesStore","__unstableStripHTML","stripHTML","useSaveImage","crop","rotation","url","id","onSaveImage","onFinishEditing","createErrorNotice","isInProgress","setIsInProgress","cancel","apply","modifiers","push","type","args","angle","width","height","left","x","top","y","length","path","method","data","src","then","response","source_url","catch","error","message","finally"],"sources":["@wordpress/block-editor/src/components/image-editor/use-save-image.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\n// Disable Reason: Needs to be refactored.\n// eslint-disable-next-line no-restricted-imports\nimport apiFetch from '@wordpress/api-fetch';\nimport { useDispatch } from '@wordpress/data';\nimport { useCallback, useMemo, useState } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\n\nexport default function useSaveImage( {\n\tcrop,\n\trotation,\n\turl,\n\tid,\n\tonSaveImage,\n\tonFinishEditing,\n} ) {\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\tconst [ isInProgress, setIsInProgress ] = useState( false );\n\n\tconst cancel = useCallback( () => {\n\t\tsetIsInProgress( false );\n\t\tonFinishEditing();\n\t}, [ onFinishEditing ] );\n\n\tconst apply = useCallback( () => {\n\t\tsetIsInProgress( true );\n\n\t\tconst modifiers = [];\n\n\t\tif ( rotation > 0 ) {\n\t\t\tmodifiers.push( {\n\t\t\t\ttype: 'rotate',\n\t\t\t\targs: {\n\t\t\t\t\tangle: rotation,\n\t\t\t\t},\n\t\t\t} );\n\t\t}\n\n\t\t// The crop script may return some very small, sub-pixel values when the image was not cropped.\n\t\t// Crop only when the new size has changed by more than 0.1%.\n\t\tif ( crop.width < 99.9 || crop.height < 99.9 ) {\n\t\t\tmodifiers.push( {\n\t\t\t\ttype: 'crop',\n\t\t\t\targs: {\n\t\t\t\t\tleft: crop.x,\n\t\t\t\t\ttop: crop.y,\n\t\t\t\t\twidth: crop.width,\n\t\t\t\t\theight: crop.height,\n\t\t\t\t},\n\t\t\t} );\n\t\t}\n\n\t\tif ( modifiers.length === 0 ) {\n\t\t\t// No changes to apply.\n\t\t\tsetIsInProgress( false );\n\t\t\tonFinishEditing();\n\t\t\treturn;\n\t\t}\n\n\t\tapiFetch( {\n\t\t\tpath: `/wp/v2/media/${ id }/edit`,\n\t\t\tmethod: 'POST',\n\t\t\tdata: { src: url, modifiers },\n\t\t} )\n\t\t\t.then( ( response ) => {\n\t\t\t\tonSaveImage( {\n\t\t\t\t\tid: response.id,\n\t\t\t\t\turl: response.source_url,\n\t\t\t\t} );\n\t\t\t} )\n\t\t\t.catch( ( error ) => {\n\t\t\t\tcreateErrorNotice(\n\t\t\t\t\tsprintf(\n\t\t\t\t\t\t/* translators: 1. Error message */\n\t\t\t\t\t\t__( 'Could not edit image. %s' ),\n\t\t\t\t\t\tstripHTML( error.message )\n\t\t\t\t\t),\n\t\t\t\t\t{\n\t\t\t\t\t\tid: 'image-editing-error',\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t} )\n\t\t\t.finally( () => {\n\t\t\t\tsetIsInProgress( false );\n\t\t\t\tonFinishEditing();\n\t\t\t} );\n\t}, [\n\t\tcrop,\n\t\trotation,\n\t\tid,\n\t\turl,\n\t\tonSaveImage,\n\t\tcreateErrorNotice,\n\t\tonFinishEditing,\n\t] );\n\n\treturn useMemo(\n\t\t() => ( {\n\t\t\tisInProgress,\n\t\t\tapply,\n\t\t\tcancel,\n\t\t} ),\n\t\t[ isInProgress, apply, cancel ]\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA,OAAOA,QA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KAAK;UACjBC,MAAM,EAAEjB,IAAI,CAACiB;QACd;MACD,CAAE,CAAC;IACJ;IAEA,IAAKN,SAAS,CAACW,MAAM,KAAK,CAAC,EAAG;MAC7B;MACAd,eAAe,CAAE,KAAM,CAAC;MACxBH,eAAe,CAAC,CAAC;MACjB;IACD;IAEAjB,QAAQ,CAAE;MACTmC,IAAI,EAAE,gBAAiBpB,EAAE,OAAQ;MACjCqB,MAAM,EAAE,MAAM;MACdC,IAAI,EAAE;QAAEC,GAAG,EAAExB,GAAG;QAAES;MAAU;IAC7B,CAAE,CAAC,CACDgB,IAAI,CAAIC,QAAQ,IAAM;MACtBxB,WAAW,CAAE;QACZD,EAAE,EAAEyB,QAAQ,CAACzB,EAAE;QACfD,GAAG,EAAE0B,QAAQ,CAACC;MACf,CAAE,CAAC;IACJ,CAAE,CAAC,CACFC,KAAK,CAAIC,KAAK,IAAM;MACpBzB,iBAAiB,CAChBZ,OAAO,CACN;MACAD,EAAE,CAAE,0BAA2B,CAAC,EAChCK,SAAS,CAAEiC,KAAK,CAACC,OAAQ,CAC1B,CAAC,EACD;QACC7B,EAAE,EAAE,qBAAqB;QACzBU,IAAI,EAAE;MACP,CACD,CAAC;IACF,CAAE,CAAC,CACFoB,OAAO,CAAE,MAAM;MACfzB,eAAe,CAAE,KAAM,CAAC;MACxBH,eAAe,CAAC,CAAC;IAClB,CAAE,CAAC;EACL,CAAC,EAAE,CACFL,IAAI,EACJC,QAAQ,EACRE,EAAE,EACFD,GAAG,EACHE,WAAW,EACXE,iBAAiB,EACjBD,eAAe,CACd,CAAC;EAEH,OAAOd,OAAO,CACb,OAAQ;IACPgB,YAAY;IACZG,KAAK;IACLD;EACD,CAAC,CAAE,EACH,CAAEF,YAAY,EAAEG,KAAK,EAAED,MAAM,CAC9B,CAAC;AACF","ignoreList":[]}
|
|
@@ -17,9 +17,7 @@ import { BottomSheet, PanelBody } from '@wordpress/components';
|
|
|
17
17
|
*/
|
|
18
18
|
import styles from './style.native.scss';
|
|
19
19
|
import { blockSettingsScreens } from '../block-settings';
|
|
20
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
21
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
22
|
-
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
20
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
23
21
|
const LINK_DESTINATION_NONE = 'none';
|
|
24
22
|
const LINK_DESTINATION_MEDIA = 'media';
|
|
25
23
|
const LINK_DESTINATION_ATTACHMENT = 'attachment';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useNavigation","useRoute","StyleSheet","__","Icon","check","chevronRight","usePreferredColorSchemeStyle","BottomSheet","PanelBody","styles","blockSettingsScreens","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","LINK_DESTINATION_NONE","LINK_DESTINATION_MEDIA","LINK_DESTINATION_ATTACHMENT","LINK_DESTINATION_CUSTOM","LinkDestination","children","isSelected","label","onPress","value","valueStyle","optionIcon","optionIconDark","Cell","icon","iconStyle","flatten","unselectedOptionIcon","leftAlign","separatorType","ImageLinkDestinationsScreen","props","navigation","route","url","inputValue","imageUrl","attachmentPageUrl","linkDestination","params","goToLinkPicker","navigate","linkPicker","setLinkDestination","newLinkDestination","newUrl","settings","text","NavBar","BackButton","goBack","Heading","undefined","placeholderTextColor"],"sources":["@wordpress/block-editor/src/components/image-link-destinations/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { useNavigation, useRoute } from '@react-navigation/native';\nimport { StyleSheet } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Icon, check, chevronRight } from '@wordpress/icons';\nimport { usePreferredColorSchemeStyle } from '@wordpress/compose';\nimport { BottomSheet, PanelBody } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.native.scss';\nimport { blockSettingsScreens } from '../block-settings';\n\nconst LINK_DESTINATION_NONE = 'none';\nconst LINK_DESTINATION_MEDIA = 'media';\nconst LINK_DESTINATION_ATTACHMENT = 'attachment';\nconst LINK_DESTINATION_CUSTOM = 'custom';\n\nfunction LinkDestination( {\n\tchildren,\n\tisSelected,\n\tlabel,\n\tonPress,\n\tvalue,\n\tvalueStyle,\n} ) {\n\tconst optionIcon = usePreferredColorSchemeStyle(\n\t\tstyles.optionIcon,\n\t\tstyles.optionIconDark\n\t);\n\n\treturn (\n\t\t<BottomSheet.Cell\n\t\t\ticon={ check }\n\t\t\ticonStyle={ StyleSheet.flatten( [\n\t\t\t\toptionIcon,\n\t\t\t\t! isSelected && styles.unselectedOptionIcon,\n\t\t\t] ) }\n\t\t\tlabel={ label }\n\t\t\tleftAlign\n\t\t\tonPress={ onPress }\n\t\t\tvalue={ value }\n\t\t\tvalueStyle={ valueStyle }\n\t\t\tseparatorType=\"leftMargin\"\n\t\t>\n\t\t\t{ children }\n\t\t</BottomSheet.Cell>\n\t);\n}\n\nfunction ImageLinkDestinationsScreen( props ) {\n\tconst navigation = useNavigation();\n\tconst route = useRoute();\n\tconst { url = '' } = props;\n\tconst {\n\t\tinputValue = url,\n\t\timageUrl,\n\t\tattachmentPageUrl,\n\t\tlinkDestination,\n\t} = route.params || {};\n\n\tfunction goToLinkPicker() {\n\t\tnavigation.navigate( blockSettingsScreens.linkPicker, {\n\t\t\tinputValue:\n\t\t\t\tlinkDestination === LINK_DESTINATION_CUSTOM ? inputValue : '',\n\t\t} );\n\t}\n\n\tconst setLinkDestination = ( newLinkDestination ) => () => {\n\t\tlet newUrl;\n\t\tswitch ( newLinkDestination ) {\n\t\t\tcase LINK_DESTINATION_MEDIA:\n\t\t\t\tnewUrl = imageUrl;\n\t\t\t\tbreak;\n\t\t\tcase LINK_DESTINATION_ATTACHMENT:\n\t\t\t\tnewUrl = attachmentPageUrl;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tnewUrl = '';\n\t\t\t\tbreak;\n\t\t}\n\n\t\tnavigation.navigate( blockSettingsScreens.settings, {\n\t\t\t// The `inputValue` name is reused from LinkPicker, as it helps avoid\n\t\t\t// bugs from stale values remaining in the React Navigation route\n\t\t\t// parameters.\n\t\t\tinputValue: newUrl,\n\t\t\t// Clear link text value that may be set from LinkPicker.\n\t\t\ttext: '',\n\t\t} );\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<BottomSheet.NavBar>\n\t\t\t\t<BottomSheet.NavBar.BackButton onPress={ navigation.goBack } />\n\t\t\t\t<BottomSheet.NavBar.Heading>\n\t\t\t\t\t{ __( 'Link To' ) }\n\t\t\t\t</BottomSheet.NavBar.Heading>\n\t\t\t</BottomSheet.NavBar>\n\t\t\t<PanelBody>\n\t\t\t\t<LinkDestination\n\t\t\t\t\tisSelected={ linkDestination === LINK_DESTINATION_NONE }\n\t\t\t\t\tlabel={ __( 'None' ) }\n\t\t\t\t\tonPress={ setLinkDestination( LINK_DESTINATION_NONE ) }\n\t\t\t\t/>\n\t\t\t\t<LinkDestination\n\t\t\t\t\tisSelected={ linkDestination === LINK_DESTINATION_MEDIA }\n\t\t\t\t\tlabel={ __( 'Media File' ) }\n\t\t\t\t\tonPress={ setLinkDestination( LINK_DESTINATION_MEDIA ) }\n\t\t\t\t/>\n\t\t\t\t{ !! attachmentPageUrl && (\n\t\t\t\t\t<LinkDestination\n\t\t\t\t\t\tisSelected={\n\t\t\t\t\t\t\tlinkDestination === LINK_DESTINATION_ATTACHMENT\n\t\t\t\t\t\t}\n\t\t\t\t\t\tlabel={ __( 'Attachment Page' ) }\n\t\t\t\t\t\tonPress={ setLinkDestination(\n\t\t\t\t\t\t\tLINK_DESTINATION_ATTACHMENT\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t<LinkDestination\n\t\t\t\t\tisSelected={ linkDestination === LINK_DESTINATION_CUSTOM }\n\t\t\t\t\tlabel={ __( 'Custom URL' ) }\n\t\t\t\t\tonPress={ goToLinkPicker }\n\t\t\t\t\tvalue={\n\t\t\t\t\t\tlinkDestination === LINK_DESTINATION_CUSTOM\n\t\t\t\t\t\t\t? inputValue\n\t\t\t\t\t\t\t: ''\n\t\t\t\t\t}\n\t\t\t\t\tvalueStyle={\n\t\t\t\t\t\tlinkDestination === LINK_DESTINATION_CUSTOM\n\t\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t\t: styles.placeholderTextColor\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t<Icon icon={ chevronRight }></Icon>\n\t\t\t\t</LinkDestination>\n\t\t\t</PanelBody>\n\t\t</>\n\t);\n}\n\nexport default ImageLinkDestinationsScreen;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,aAAa,EAAEC,QAAQ,QAAQ,0BAA0B;AAClE,SAASC,UAAU,QAAQ,cAAc;;AAEzC;AACA;AACA;AACA,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,IAAI,EAAEC,KAAK,EAAEC,YAAY,QAAQ,kBAAkB;AAC5D,SAASC,4BAA4B,QAAQ,oBAAoB;AACjE,SAASC,WAAW,EAAEC,SAAS,QAAQ,uBAAuB;;AAE9D;AACA;AACA;AACA,OAAOC,MAAM,MAAM,qBAAqB;AACxC,SAASC,oBAAoB,QAAQ,mBAAmB;AAAC,SAAAC,GAAA,IAAAC,IAAA
|
|
1
|
+
{"version":3,"names":["useNavigation","useRoute","StyleSheet","__","Icon","check","chevronRight","usePreferredColorSchemeStyle","BottomSheet","PanelBody","styles","blockSettingsScreens","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","LINK_DESTINATION_NONE","LINK_DESTINATION_MEDIA","LINK_DESTINATION_ATTACHMENT","LINK_DESTINATION_CUSTOM","LinkDestination","children","isSelected","label","onPress","value","valueStyle","optionIcon","optionIconDark","Cell","icon","iconStyle","flatten","unselectedOptionIcon","leftAlign","separatorType","ImageLinkDestinationsScreen","props","navigation","route","url","inputValue","imageUrl","attachmentPageUrl","linkDestination","params","goToLinkPicker","navigate","linkPicker","setLinkDestination","newLinkDestination","newUrl","settings","text","NavBar","BackButton","goBack","Heading","undefined","placeholderTextColor"],"sources":["@wordpress/block-editor/src/components/image-link-destinations/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { useNavigation, useRoute } from '@react-navigation/native';\nimport { StyleSheet } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Icon, check, chevronRight } from '@wordpress/icons';\nimport { usePreferredColorSchemeStyle } from '@wordpress/compose';\nimport { BottomSheet, PanelBody } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.native.scss';\nimport { blockSettingsScreens } from '../block-settings';\n\nconst LINK_DESTINATION_NONE = 'none';\nconst LINK_DESTINATION_MEDIA = 'media';\nconst LINK_DESTINATION_ATTACHMENT = 'attachment';\nconst LINK_DESTINATION_CUSTOM = 'custom';\n\nfunction LinkDestination( {\n\tchildren,\n\tisSelected,\n\tlabel,\n\tonPress,\n\tvalue,\n\tvalueStyle,\n} ) {\n\tconst optionIcon = usePreferredColorSchemeStyle(\n\t\tstyles.optionIcon,\n\t\tstyles.optionIconDark\n\t);\n\n\treturn (\n\t\t<BottomSheet.Cell\n\t\t\ticon={ check }\n\t\t\ticonStyle={ StyleSheet.flatten( [\n\t\t\t\toptionIcon,\n\t\t\t\t! isSelected && styles.unselectedOptionIcon,\n\t\t\t] ) }\n\t\t\tlabel={ label }\n\t\t\tleftAlign\n\t\t\tonPress={ onPress }\n\t\t\tvalue={ value }\n\t\t\tvalueStyle={ valueStyle }\n\t\t\tseparatorType=\"leftMargin\"\n\t\t>\n\t\t\t{ children }\n\t\t</BottomSheet.Cell>\n\t);\n}\n\nfunction ImageLinkDestinationsScreen( props ) {\n\tconst navigation = useNavigation();\n\tconst route = useRoute();\n\tconst { url = '' } = props;\n\tconst {\n\t\tinputValue = url,\n\t\timageUrl,\n\t\tattachmentPageUrl,\n\t\tlinkDestination,\n\t} = route.params || {};\n\n\tfunction goToLinkPicker() {\n\t\tnavigation.navigate( blockSettingsScreens.linkPicker, {\n\t\t\tinputValue:\n\t\t\t\tlinkDestination === LINK_DESTINATION_CUSTOM ? inputValue : '',\n\t\t} );\n\t}\n\n\tconst setLinkDestination = ( newLinkDestination ) => () => {\n\t\tlet newUrl;\n\t\tswitch ( newLinkDestination ) {\n\t\t\tcase LINK_DESTINATION_MEDIA:\n\t\t\t\tnewUrl = imageUrl;\n\t\t\t\tbreak;\n\t\t\tcase LINK_DESTINATION_ATTACHMENT:\n\t\t\t\tnewUrl = attachmentPageUrl;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tnewUrl = '';\n\t\t\t\tbreak;\n\t\t}\n\n\t\tnavigation.navigate( blockSettingsScreens.settings, {\n\t\t\t// The `inputValue` name is reused from LinkPicker, as it helps avoid\n\t\t\t// bugs from stale values remaining in the React Navigation route\n\t\t\t// parameters.\n\t\t\tinputValue: newUrl,\n\t\t\t// Clear link text value that may be set from LinkPicker.\n\t\t\ttext: '',\n\t\t} );\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<BottomSheet.NavBar>\n\t\t\t\t<BottomSheet.NavBar.BackButton onPress={ navigation.goBack } />\n\t\t\t\t<BottomSheet.NavBar.Heading>\n\t\t\t\t\t{ __( 'Link To' ) }\n\t\t\t\t</BottomSheet.NavBar.Heading>\n\t\t\t</BottomSheet.NavBar>\n\t\t\t<PanelBody>\n\t\t\t\t<LinkDestination\n\t\t\t\t\tisSelected={ linkDestination === LINK_DESTINATION_NONE }\n\t\t\t\t\tlabel={ __( 'None' ) }\n\t\t\t\t\tonPress={ setLinkDestination( LINK_DESTINATION_NONE ) }\n\t\t\t\t/>\n\t\t\t\t<LinkDestination\n\t\t\t\t\tisSelected={ linkDestination === LINK_DESTINATION_MEDIA }\n\t\t\t\t\tlabel={ __( 'Media File' ) }\n\t\t\t\t\tonPress={ setLinkDestination( LINK_DESTINATION_MEDIA ) }\n\t\t\t\t/>\n\t\t\t\t{ !! attachmentPageUrl && (\n\t\t\t\t\t<LinkDestination\n\t\t\t\t\t\tisSelected={\n\t\t\t\t\t\t\tlinkDestination === LINK_DESTINATION_ATTACHMENT\n\t\t\t\t\t\t}\n\t\t\t\t\t\tlabel={ __( 'Attachment Page' ) }\n\t\t\t\t\t\tonPress={ setLinkDestination(\n\t\t\t\t\t\t\tLINK_DESTINATION_ATTACHMENT\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t<LinkDestination\n\t\t\t\t\tisSelected={ linkDestination === LINK_DESTINATION_CUSTOM }\n\t\t\t\t\tlabel={ __( 'Custom URL' ) }\n\t\t\t\t\tonPress={ goToLinkPicker }\n\t\t\t\t\tvalue={\n\t\t\t\t\t\tlinkDestination === LINK_DESTINATION_CUSTOM\n\t\t\t\t\t\t\t? inputValue\n\t\t\t\t\t\t\t: ''\n\t\t\t\t\t}\n\t\t\t\t\tvalueStyle={\n\t\t\t\t\t\tlinkDestination === LINK_DESTINATION_CUSTOM\n\t\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t\t: styles.placeholderTextColor\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t<Icon icon={ chevronRight }></Icon>\n\t\t\t\t</LinkDestination>\n\t\t\t</PanelBody>\n\t\t</>\n\t);\n}\n\nexport default ImageLinkDestinationsScreen;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,aAAa,EAAEC,QAAQ,QAAQ,0BAA0B;AAClE,SAASC,UAAU,QAAQ,cAAc;;AAEzC;AACA;AACA;AACA,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,IAAI,EAAEC,KAAK,EAAEC,YAAY,QAAQ,kBAAkB;AAC5D,SAASC,4BAA4B,QAAQ,oBAAoB;AACjE,SAASC,WAAW,EAAEC,SAAS,QAAQ,uBAAuB;;AAE9D;AACA;AACA;AACA,OAAOC,MAAM,MAAM,qBAAqB;AACxC,SAASC,oBAAoB,QAAQ,mBAAmB;AAAC,SAAAC,GAAA,IAAAC,I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,CAACS,eAAe;QACfE,UAAU,EACTsB,eAAe,KAAK1B,2BACpB;QACDK,KAAK,EAAGtB,EAAE,CAAE,iBAAkB,CAAG;QACjCuB,OAAO,EAAGyB,kBAAkB,CAC3B/B,2BACD;MAAG,CACH,CACD,eACDP,IAAA,CAACS,eAAe;QACfE,UAAU,EAAGsB,eAAe,KAAKzB,uBAAyB;QAC1DI,KAAK,EAAGtB,EAAE,CAAE,YAAa,CAAG;QAC5BuB,OAAO,EAAGsB,cAAgB;QAC1BrB,KAAK,EACJmB,eAAe,KAAKzB,uBAAuB,GACxCsB,UAAU,GACV,EACH;QACDf,UAAU,EACTkB,eAAe,KAAKzB,uBAAuB,GACxCuC,SAAS,GACTlD,MAAM,CAACmD,oBACV;QAAAtC,QAAA,eAEDV,IAAA,CAACT,IAAI;UAAC4B,IAAI,EAAG1B;QAAc,CAAO;MAAC,CACnB,CAAC;IAAA,CACR,CAAC;EAAA,CACX,CAAC;AAEL;AAEA,eAAegC,2BAA2B","ignoreList":[]}
|
|
@@ -8,9 +8,7 @@ import { __ } from '@wordpress/i18n';
|
|
|
8
8
|
* Internal dependencies
|
|
9
9
|
*/
|
|
10
10
|
import useDimensionHandler from './use-dimension-handler';
|
|
11
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
11
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
14
12
|
const IMAGE_SIZE_PRESETS = [25, 50, 75, 100];
|
|
15
13
|
const noop = () => {};
|
|
16
14
|
export default function ImageSizeControl({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Button","ButtonGroup","SelectControl","__experimentalNumberControl","NumberControl","__experimentalHStack","HStack","__","useDimensionHandler","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","IMAGE_SIZE_PRESETS","noop","ImageSizeControl","imageSizeHelp","imageWidth","imageHeight","imageSizeOptions","isResizable","slug","width","height","onChange","onChangeImage","currentHeight","currentWidth","updateDimension","updateDimensions","children","length","__nextHasNoMarginBottom","label","value","options","help","size","className","align","spacing","min","map","scale","scaledWidth","Math","round","scaledHeight","isCurrent","variant","undefined","isPressed","onClick"],"sources":["@wordpress/block-editor/src/components/image-size-control/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tButtonGroup,\n\tSelectControl,\n\t__experimentalNumberControl as NumberControl,\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport useDimensionHandler from './use-dimension-handler';\n\nconst IMAGE_SIZE_PRESETS = [ 25, 50, 75, 100 ];\nconst noop = () => {};\n\nexport default function ImageSizeControl( {\n\timageSizeHelp,\n\timageWidth,\n\timageHeight,\n\timageSizeOptions = [],\n\tisResizable = true,\n\tslug,\n\twidth,\n\theight,\n\tonChange,\n\tonChangeImage = noop,\n} ) {\n\tconst { currentHeight, currentWidth, updateDimension, updateDimensions } =\n\t\tuseDimensionHandler( height, width, imageHeight, imageWidth, onChange );\n\n\treturn (\n\t\t<>\n\t\t\t{ imageSizeOptions && imageSizeOptions.length > 0 && (\n\t\t\t\t<SelectControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Resolution' ) }\n\t\t\t\t\tvalue={ slug }\n\t\t\t\t\toptions={ imageSizeOptions }\n\t\t\t\t\tonChange={ onChangeImage }\n\t\t\t\t\thelp={ imageSizeHelp }\n\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ isResizable && (\n\t\t\t\t<div className=\"block-editor-image-size-control\">\n\t\t\t\t\t<HStack align=\"baseline\" spacing=\"3\">\n\t\t\t\t\t\t<NumberControl\n\t\t\t\t\t\t\tclassName=\"block-editor-image-size-control__width\"\n\t\t\t\t\t\t\tlabel={ __( 'Width' ) }\n\t\t\t\t\t\t\tvalue={ currentWidth }\n\t\t\t\t\t\t\tmin={ 1 }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tupdateDimension( 'width', value )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<NumberControl\n\t\t\t\t\t\t\tclassName=\"block-editor-image-size-control__height\"\n\t\t\t\t\t\t\tlabel={ __( 'Height' ) }\n\t\t\t\t\t\t\tvalue={ currentHeight }\n\t\t\t\t\t\t\tmin={ 1 }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tupdateDimension( 'height', value )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</HStack>\n\t\t\t\t\t<HStack>\n\t\t\t\t\t\t<ButtonGroup aria-label={ __( 'Image size presets' ) }>\n\t\t\t\t\t\t\t{ IMAGE_SIZE_PRESETS.map( ( scale ) => {\n\t\t\t\t\t\t\t\tconst scaledWidth = Math.round(\n\t\t\t\t\t\t\t\t\timageWidth * ( scale / 100 )\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tconst scaledHeight = Math.round(\n\t\t\t\t\t\t\t\t\timageHeight * ( scale / 100 )\n\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\tconst isCurrent =\n\t\t\t\t\t\t\t\t\tcurrentWidth === scaledWidth &&\n\t\t\t\t\t\t\t\t\tcurrentHeight === scaledHeight;\n\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\tkey={ scale }\n\t\t\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\t\t\tvariant={\n\t\t\t\t\t\t\t\t\t\t\tisCurrent ? 'primary' : undefined\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tisPressed={ isCurrent }\n\t\t\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\t\t\tupdateDimensions(\n\t\t\t\t\t\t\t\t\t\t\t\tscaledHeight,\n\t\t\t\t\t\t\t\t\t\t\t\tscaledWidth\n\t\t\t\t\t\t\t\t\t\t\t)\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\t\t{ scale }%\n\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t</ButtonGroup>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\tonClick={ () => updateDimensions() }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Reset' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</HStack>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,MAAM,EACNC,WAAW,EACXC,aAAa,EACbC,2BAA2B,IAAIC,aAAa,EAC5CC,oBAAoB,IAAIC,MAAM,QACxB,uBAAuB;AAC9B,SAASC,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;AACA,OAAOC,mBAAmB,MAAM,yBAAyB;AAAC,SAAAC,GAAA,IAAAC,IAAA
|
|
1
|
+
{"version":3,"names":["Button","ButtonGroup","SelectControl","__experimentalNumberControl","NumberControl","__experimentalHStack","HStack","__","useDimensionHandler","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","IMAGE_SIZE_PRESETS","noop","ImageSizeControl","imageSizeHelp","imageWidth","imageHeight","imageSizeOptions","isResizable","slug","width","height","onChange","onChangeImage","currentHeight","currentWidth","updateDimension","updateDimensions","children","length","__nextHasNoMarginBottom","label","value","options","help","size","className","align","spacing","min","map","scale","scaledWidth","Math","round","scaledHeight","isCurrent","variant","undefined","isPressed","onClick"],"sources":["@wordpress/block-editor/src/components/image-size-control/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tButtonGroup,\n\tSelectControl,\n\t__experimentalNumberControl as NumberControl,\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport useDimensionHandler from './use-dimension-handler';\n\nconst IMAGE_SIZE_PRESETS = [ 25, 50, 75, 100 ];\nconst noop = () => {};\n\nexport default function ImageSizeControl( {\n\timageSizeHelp,\n\timageWidth,\n\timageHeight,\n\timageSizeOptions = [],\n\tisResizable = true,\n\tslug,\n\twidth,\n\theight,\n\tonChange,\n\tonChangeImage = noop,\n} ) {\n\tconst { currentHeight, currentWidth, updateDimension, updateDimensions } =\n\t\tuseDimensionHandler( height, width, imageHeight, imageWidth, onChange );\n\n\treturn (\n\t\t<>\n\t\t\t{ imageSizeOptions && imageSizeOptions.length > 0 && (\n\t\t\t\t<SelectControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Resolution' ) }\n\t\t\t\t\tvalue={ slug }\n\t\t\t\t\toptions={ imageSizeOptions }\n\t\t\t\t\tonChange={ onChangeImage }\n\t\t\t\t\thelp={ imageSizeHelp }\n\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ isResizable && (\n\t\t\t\t<div className=\"block-editor-image-size-control\">\n\t\t\t\t\t<HStack align=\"baseline\" spacing=\"3\">\n\t\t\t\t\t\t<NumberControl\n\t\t\t\t\t\t\tclassName=\"block-editor-image-size-control__width\"\n\t\t\t\t\t\t\tlabel={ __( 'Width' ) }\n\t\t\t\t\t\t\tvalue={ currentWidth }\n\t\t\t\t\t\t\tmin={ 1 }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tupdateDimension( 'width', value )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<NumberControl\n\t\t\t\t\t\t\tclassName=\"block-editor-image-size-control__height\"\n\t\t\t\t\t\t\tlabel={ __( 'Height' ) }\n\t\t\t\t\t\t\tvalue={ currentHeight }\n\t\t\t\t\t\t\tmin={ 1 }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tupdateDimension( 'height', value )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</HStack>\n\t\t\t\t\t<HStack>\n\t\t\t\t\t\t<ButtonGroup aria-label={ __( 'Image size presets' ) }>\n\t\t\t\t\t\t\t{ IMAGE_SIZE_PRESETS.map( ( scale ) => {\n\t\t\t\t\t\t\t\tconst scaledWidth = Math.round(\n\t\t\t\t\t\t\t\t\timageWidth * ( scale / 100 )\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tconst scaledHeight = Math.round(\n\t\t\t\t\t\t\t\t\timageHeight * ( scale / 100 )\n\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\tconst isCurrent =\n\t\t\t\t\t\t\t\t\tcurrentWidth === scaledWidth &&\n\t\t\t\t\t\t\t\t\tcurrentHeight === scaledHeight;\n\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\tkey={ scale }\n\t\t\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\t\t\tvariant={\n\t\t\t\t\t\t\t\t\t\t\tisCurrent ? 'primary' : undefined\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tisPressed={ isCurrent }\n\t\t\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\t\t\tupdateDimensions(\n\t\t\t\t\t\t\t\t\t\t\t\tscaledHeight,\n\t\t\t\t\t\t\t\t\t\t\t\tscaledWidth\n\t\t\t\t\t\t\t\t\t\t\t)\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\t\t{ scale }%\n\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t</ButtonGroup>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\tonClick={ () => updateDimensions() }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Reset' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</HStack>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,MAAM,EACNC,WAAW,EACXC,aAAa,EACbC,2BAA2B,IAAIC,aAAa,EAC5CC,oBAAoB,IAAIC,MAAM,QACxB,uBAAuB;AAC9B,SAASC,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;AACA,OAAOC,mBAAmB,MAAM,yBAAyB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA,EAAAC,QAAA,IAAAC,SAAA;AAE1D,MAAMC,kBAAkB,GAAG,CAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,CAAE;AAC9C,MAAMC,IAAI,GAAGA,CAAA,KAAM,CAAC,CAAC;AAErB,eAAe,SAASC,gBAAgBA,CAAE;EACzCC,aAAa;EACbC,UAAU;EACVC,WAAW;EACXC,gBAAgB,GAAG,EAAE;EACrBC,WAAW,GAAG,IAAI;EAClBC,IAAI;EACJC,KAAK;EACLC,MAAM;EACNC,QAAQ;EACRC,aAAa,GAAGX;AACjB,CAAC,EAAG;EACH,MAAM;IAAEY,aAAa;IAAEC,YAAY;IAAEC,eAAe;IAAEC;EAAiB,CAAC,GACvEvB,mBAAmB,CA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AA,EACnDjB,kBAAkB,CAAC6B,GAAG,CAAIC,KAAK,IAAM;YACtC,MAAMC,WAAW,GAAGC,IAAI,CAACC,KAAK,CAC7B7B,UAAU,IAAK0B,KAAK,GAAG,GAAG,CAC3B,CAAC;YACD,MAAMI,YAAY,GAAGF,IAAI,CAACC,KAAK,CAC9B5B,WAAW,IAAKyB,KAAK,GAAG,GAAG,CAC5B,CAAC;YAED,MAAMK,SAAS,GACdrB,YAAY,KAAKiB,WAAW,IAC5BlB,aAAa,KAAKqB,YAAY;YAE/B,oBACCrC,KAAA,CAACZ,MAAM;cAENuC,IAAI,EAAC,OAAO;cACZY,OAAO,EACND,SAAS,GAAG,SAAS,GAAGE,SACxB;cACDC,SAAS,EAAGH,SAAW;cACvBI,OAAO,EAAGA,CAAA,KACTvB,gBAAgB,CACfkB,YAAY,EACZH,WACD,CACA;cAAAd,QAAA,GAECa,KAAK,EAAE,GACV;YAAA,GAdOA,KAcC,CAAC;UAEX,CAAE;QAAC,CACS,CAAC,eACdnC,IAAA,CAACV,MAAM;UACNuC,IAAI,EAAC,OAAO;UACZe,OAAO,EAAGA,CAAA,KAAMvB,gBAAgB,CAAC,CAAG;UAAAC,QAAA,EAElCzB,EAAE,CAAE,OAAQ;QAAC,CACR,CAAC;MAAA,CACF,CAAC;IAAA,CACL,CACL;EAAA,CACA,CAAC;AAEL","ignoreList":[]}
|
|
@@ -163,14 +163,11 @@ export function useInnerBlocksProps(props = {}, options = {}) {
|
|
|
163
163
|
const selected = useSelect(select => {
|
|
164
164
|
const {
|
|
165
165
|
getBlockName,
|
|
166
|
-
isBlockSelected,
|
|
167
|
-
hasSelectedInnerBlock,
|
|
168
166
|
__unstableGetEditorMode,
|
|
169
167
|
getTemplateLock,
|
|
170
168
|
getBlockRootClientId,
|
|
171
169
|
getBlockEditingMode,
|
|
172
170
|
getBlockSettings,
|
|
173
|
-
isDragging,
|
|
174
171
|
getSectionRootClientId
|
|
175
172
|
} = unlock(select(blockEditorStore));
|
|
176
173
|
let _isDropZoneDisabled;
|
|
@@ -184,7 +181,6 @@ export function useInnerBlocksProps(props = {}, options = {}) {
|
|
|
184
181
|
getBlockType
|
|
185
182
|
} = select(blocksStore);
|
|
186
183
|
const blockName = getBlockName(clientId);
|
|
187
|
-
const enableClickThrough = __unstableGetEditorMode() === 'navigation';
|
|
188
184
|
const blockEditingMode = getBlockEditingMode(clientId);
|
|
189
185
|
const parentClientId = getBlockRootClientId(clientId);
|
|
190
186
|
const [defaultLayout] = getBlockSettings(clientId, 'layout');
|
|
@@ -198,7 +194,6 @@ export function useInnerBlocksProps(props = {}, options = {}) {
|
|
|
198
194
|
}
|
|
199
195
|
return {
|
|
200
196
|
__experimentalCaptureToolbars: hasBlockSupport(blockName, '__experimentalExposeControlsToChildren', false),
|
|
201
|
-
hasOverlay: blockName !== 'core/template' && !isBlockSelected(clientId) && !hasSelectedInnerBlock(clientId, true) && enableClickThrough && !isDragging(),
|
|
202
197
|
name: blockName,
|
|
203
198
|
blockType: getBlockType(blockName),
|
|
204
199
|
parentLock: getTemplateLock(parentClientId),
|
|
@@ -209,7 +204,6 @@ export function useInnerBlocksProps(props = {}, options = {}) {
|
|
|
209
204
|
}, [clientId]);
|
|
210
205
|
const {
|
|
211
206
|
__experimentalCaptureToolbars,
|
|
212
|
-
hasOverlay,
|
|
213
207
|
name,
|
|
214
208
|
blockType,
|
|
215
209
|
parentLock,
|
|
@@ -236,9 +230,7 @@ export function useInnerBlocksProps(props = {}, options = {}) {
|
|
|
236
230
|
return {
|
|
237
231
|
...props,
|
|
238
232
|
ref,
|
|
239
|
-
className: clsx(props.className, 'block-editor-block-list__layout', __unstableDisableLayoutClassNames ? '' : layoutClassNames,
|
|
240
|
-
'has-overlay': hasOverlay
|
|
241
|
-
}),
|
|
233
|
+
className: clsx(props.className, 'block-editor-block-list__layout', __unstableDisableLayoutClassNames ? '' : layoutClassNames),
|
|
242
234
|
children: clientId ? /*#__PURE__*/_jsx(InnerBlocks, {
|
|
243
235
|
...innerBlocksProps,
|
|
244
236
|
clientId: clientId
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["clsx","useMergeRefs","forwardRef","useMemo","memo","useSelect","getBlockSupport","store","blocksStore","__unstableGetInnerBlocksProps","getInnerBlocksProps","ButtonBlockAppender","DefaultBlockAppender","useNestedSettingsUpdate","useInnerBlockTemplateSync","useBlockContext","BlockListItems","BlockContextProvider","useBlockEditContext","useBlockSync","blockEditorStore","useBlockDropZone","unlock","jsx","_jsx","EMPTY_OBJECT","BlockContext","children","clientId","context","value","BlockListItemsMemo","UncontrolledInnerBlocks","props","allowedBlocks","prioritizedInserterBlocks","defaultBlock","directInsert","__experimentalDefaultBlock","__experimentalDirectInsert","template","templateLock","wrapperRef","templateInsertUpdatesSelection","__experimentalCaptureToolbars","captureToolbars","__experimentalAppenderTagName","renderAppender","orientation","placeholder","layout","name","blockType","parentLock","defaultLayout","defaultLayoutBlockSupport","allowSizingOnChildren","usedLayout","memoedLayout","items","rootClientId","providesContext","Object","keys","length","ControlledInnerBlocks","ForwardedInnerBlocks","ref","innerBlocksProps","useInnerBlocksProps","className","options","__unstableDisableLayoutClassNames","__unstableDisableDropZone","dropZoneElement","__unstableLayoutClassNames","layoutClassNames","selected","select","getBlockName","isBlockSelected","hasSelectedInnerBlock","__unstableGetEditorMode","getTemplateLock","getBlockRootClientId","getBlockEditingMode","getBlockSettings","isDragging","getSectionRootClientId","_isDropZoneDisabled","isDropZoneDisabled","hasBlockSupport","getBlockType","blockName","enableClickThrough","blockEditingMode","parentClientId","sectionRootClientId","hasOverlay","blockDropZoneRef","isManualPlacement","window","__experimentalEnableGridInteractivity","InnerBlocks","onChange","save","Content"],"sources":["@wordpress/block-editor/src/components/inner-blocks/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useMergeRefs } from '@wordpress/compose';\nimport { forwardRef, useMemo, memo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport {\n\tgetBlockSupport,\n\tstore as blocksStore,\n\t__unstableGetInnerBlocksProps as getInnerBlocksProps,\n} from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport ButtonBlockAppender from './button-block-appender';\nimport DefaultBlockAppender from './default-block-appender';\nimport useNestedSettingsUpdate from './use-nested-settings-update';\nimport useInnerBlockTemplateSync from './use-inner-block-template-sync';\nimport useBlockContext from './use-block-context';\nimport { BlockListItems } from '../block-list';\nimport { BlockContextProvider } from '../block-context';\nimport { useBlockEditContext } from '../block-edit/context';\nimport useBlockSync from '../provider/use-block-sync';\nimport { store as blockEditorStore } from '../../store';\nimport useBlockDropZone from '../use-block-drop-zone';\nimport { unlock } from '../../lock-unlock';\n\nconst EMPTY_OBJECT = {};\n\nfunction BlockContext( { children, clientId } ) {\n\tconst context = useBlockContext( clientId );\n\treturn (\n\t\t<BlockContextProvider value={ context }>\n\t\t\t{ children }\n\t\t</BlockContextProvider>\n\t);\n}\n\nconst BlockListItemsMemo = memo( BlockListItems );\n\n/**\n * InnerBlocks is a component which allows a single block to have multiple blocks\n * as children. The UncontrolledInnerBlocks component is used whenever the inner\n * blocks are not controlled by another entity. In other words, it is normally\n * used for inner blocks in the post editor\n *\n * @param {Object} props The component props.\n */\nfunction UncontrolledInnerBlocks( props ) {\n\tconst {\n\t\tclientId,\n\t\tallowedBlocks,\n\t\tprioritizedInserterBlocks,\n\t\tdefaultBlock,\n\t\tdirectInsert,\n\t\t__experimentalDefaultBlock,\n\t\t__experimentalDirectInsert,\n\t\ttemplate,\n\t\ttemplateLock,\n\t\twrapperRef,\n\t\ttemplateInsertUpdatesSelection,\n\t\t__experimentalCaptureToolbars: captureToolbars,\n\t\t__experimentalAppenderTagName,\n\t\trenderAppender,\n\t\torientation,\n\t\tplaceholder,\n\t\tlayout,\n\t\tname,\n\t\tblockType,\n\t\tparentLock,\n\t\tdefaultLayout,\n\t} = props;\n\n\tuseNestedSettingsUpdate(\n\t\tclientId,\n\t\tparentLock,\n\t\tallowedBlocks,\n\t\tprioritizedInserterBlocks,\n\t\tdefaultBlock,\n\t\tdirectInsert,\n\t\t__experimentalDefaultBlock,\n\t\t__experimentalDirectInsert,\n\t\ttemplateLock,\n\t\tcaptureToolbars,\n\t\torientation,\n\t\tlayout\n\t);\n\n\tuseInnerBlockTemplateSync(\n\t\tclientId,\n\t\ttemplate,\n\t\ttemplateLock,\n\t\ttemplateInsertUpdatesSelection\n\t);\n\n\tconst defaultLayoutBlockSupport =\n\t\tgetBlockSupport( name, 'layout' ) ||\n\t\tgetBlockSupport( name, '__experimentalLayout' ) ||\n\t\tEMPTY_OBJECT;\n\n\tconst { allowSizingOnChildren = false } = defaultLayoutBlockSupport;\n\tconst usedLayout = layout || defaultLayoutBlockSupport;\n\n\tconst memoedLayout = useMemo(\n\t\t() => ( {\n\t\t\t// Default layout will know about any content/wide size defined by the theme.\n\t\t\t...defaultLayout,\n\t\t\t...usedLayout,\n\t\t\t...( allowSizingOnChildren && {\n\t\t\t\tallowSizingOnChildren: true,\n\t\t\t} ),\n\t\t} ),\n\t\t[ defaultLayout, usedLayout, allowSizingOnChildren ]\n\t);\n\n\t// For controlled inner blocks, we don't want a change in blocks to\n\t// re-render the blocks list.\n\tconst items = (\n\t\t<BlockListItemsMemo\n\t\t\trootClientId={ clientId }\n\t\t\trenderAppender={ renderAppender }\n\t\t\t__experimentalAppenderTagName={ __experimentalAppenderTagName }\n\t\t\tlayout={ memoedLayout }\n\t\t\twrapperRef={ wrapperRef }\n\t\t\tplaceholder={ placeholder }\n\t\t/>\n\t);\n\n\tif (\n\t\t! blockType?.providesContext ||\n\t\tObject.keys( blockType.providesContext ).length === 0\n\t) {\n\t\treturn items;\n\t}\n\n\treturn <BlockContext clientId={ clientId }>{ items }</BlockContext>;\n}\n\n/**\n * The controlled inner blocks component wraps the uncontrolled inner blocks\n * component with the blockSync hook. This keeps the innerBlocks of the block in\n * the block-editor store in sync with the blocks of the controlling entity. An\n * example of an inner block controller is a template part block, which provides\n * its own blocks from the template part entity data source.\n *\n * @param {Object} props The component props.\n */\nfunction ControlledInnerBlocks( props ) {\n\tuseBlockSync( props );\n\treturn <UncontrolledInnerBlocks { ...props } />;\n}\n\nconst ForwardedInnerBlocks = forwardRef( ( props, ref ) => {\n\tconst innerBlocksProps = useInnerBlocksProps( { ref }, props );\n\treturn (\n\t\t<div className=\"block-editor-inner-blocks\">\n\t\t\t<div { ...innerBlocksProps } />\n\t\t</div>\n\t);\n} );\n\n/**\n * This hook is used to lightly mark an element as an inner blocks wrapper\n * element. Call this hook and pass the returned props to the element to mark as\n * an inner blocks wrapper, automatically rendering inner blocks as children. If\n * you define a ref for the element, it is important to pass the ref to this\n * hook, which the hook in turn will pass to the component through the props it\n * returns. Optionally, you can also pass any other props through this hook, and\n * they will be merged and returned.\n *\n * @param {Object} props Optional. Props to pass to the element. Must contain\n * the ref if one is defined.\n * @param {Object} options Optional. Inner blocks options.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/inner-blocks/README.md\n */\nexport function useInnerBlocksProps( props = {}, options = {} ) {\n\tconst {\n\t\t__unstableDisableLayoutClassNames,\n\t\t__unstableDisableDropZone,\n\t\tdropZoneElement,\n\t} = options;\n\tconst {\n\t\tclientId,\n\t\tlayout = null,\n\t\t__unstableLayoutClassNames: layoutClassNames = '',\n\t} = useBlockEditContext();\n\tconst selected = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockName,\n\t\t\t\tisBlockSelected,\n\t\t\t\thasSelectedInnerBlock,\n\t\t\t\t__unstableGetEditorMode,\n\t\t\t\tgetTemplateLock,\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\tgetBlockEditingMode,\n\t\t\t\tgetBlockSettings,\n\t\t\t\tisDragging,\n\t\t\t\tgetSectionRootClientId,\n\t\t\t} = unlock( select( blockEditorStore ) );\n\t\t\tlet _isDropZoneDisabled;\n\n\t\t\tif ( ! clientId ) {\n\t\t\t\treturn { isDropZoneDisabled: _isDropZoneDisabled };\n\t\t\t}\n\n\t\t\tconst { hasBlockSupport, getBlockType } = select( blocksStore );\n\t\t\tconst blockName = getBlockName( clientId );\n\t\t\tconst enableClickThrough =\n\t\t\t\t__unstableGetEditorMode() === 'navigation';\n\t\t\tconst blockEditingMode = getBlockEditingMode( clientId );\n\t\t\tconst parentClientId = getBlockRootClientId( clientId );\n\t\t\tconst [ defaultLayout ] = getBlockSettings( clientId, 'layout' );\n\n\t\t\t_isDropZoneDisabled = blockEditingMode === 'disabled';\n\n\t\t\tif ( __unstableGetEditorMode() === 'zoom-out' ) {\n\t\t\t\t// In zoom out mode, we want to disable the drop zone for the sections.\n\t\t\t\t// The inner blocks belonging to the section drop zone is\n\t\t\t\t// already disabled by the blocks themselves being disabled.\n\t\t\t\tconst sectionRootClientId = getSectionRootClientId();\n\n\t\t\t\t_isDropZoneDisabled = clientId !== sectionRootClientId;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\t__experimentalCaptureToolbars: hasBlockSupport(\n\t\t\t\t\tblockName,\n\t\t\t\t\t'__experimentalExposeControlsToChildren',\n\t\t\t\t\tfalse\n\t\t\t\t),\n\t\t\t\thasOverlay:\n\t\t\t\t\tblockName !== 'core/template' &&\n\t\t\t\t\t! isBlockSelected( clientId ) &&\n\t\t\t\t\t! hasSelectedInnerBlock( clientId, true ) &&\n\t\t\t\t\tenableClickThrough &&\n\t\t\t\t\t! isDragging(),\n\t\t\t\tname: blockName,\n\t\t\t\tblockType: getBlockType( blockName ),\n\t\t\t\tparentLock: getTemplateLock( parentClientId ),\n\t\t\t\tparentClientId,\n\t\t\t\tisDropZoneDisabled: _isDropZoneDisabled,\n\t\t\t\tdefaultLayout,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst {\n\t\t__experimentalCaptureToolbars,\n\t\thasOverlay,\n\t\tname,\n\t\tblockType,\n\t\tparentLock,\n\t\tparentClientId,\n\t\tisDropZoneDisabled,\n\t\tdefaultLayout,\n\t} = selected;\n\n\tconst blockDropZoneRef = useBlockDropZone( {\n\t\tdropZoneElement,\n\t\trootClientId: clientId,\n\t\tparentClientId,\n\t} );\n\n\tconst ref = useMergeRefs( [\n\t\tprops.ref,\n\t\t__unstableDisableDropZone ||\n\t\tisDropZoneDisabled ||\n\t\t( layout?.isManualPlacement &&\n\t\t\twindow.__experimentalEnableGridInteractivity )\n\t\t\t? null\n\t\t\t: blockDropZoneRef,\n\t] );\n\n\tconst innerBlocksProps = {\n\t\t__experimentalCaptureToolbars,\n\t\tlayout,\n\t\tname,\n\t\tblockType,\n\t\tparentLock,\n\t\tdefaultLayout,\n\t\t...options,\n\t};\n\tconst InnerBlocks =\n\t\tinnerBlocksProps.value && innerBlocksProps.onChange\n\t\t\t? ControlledInnerBlocks\n\t\t\t: UncontrolledInnerBlocks;\n\n\treturn {\n\t\t...props,\n\t\tref,\n\t\tclassName: clsx(\n\t\t\tprops.className,\n\t\t\t'block-editor-block-list__layout',\n\t\t\t__unstableDisableLayoutClassNames ? '' : layoutClassNames,\n\t\t\t{\n\t\t\t\t'has-overlay': hasOverlay,\n\t\t\t}\n\t\t),\n\t\tchildren: clientId ? (\n\t\t\t<InnerBlocks { ...innerBlocksProps } clientId={ clientId } />\n\t\t) : (\n\t\t\t<BlockListItems { ...options } />\n\t\t),\n\t};\n}\n\nuseInnerBlocksProps.save = getInnerBlocksProps;\n\n// Expose default appender placeholders as components.\nForwardedInnerBlocks.DefaultBlockAppender = DefaultBlockAppender;\nForwardedInnerBlocks.ButtonBlockAppender = ButtonBlockAppender;\n\nForwardedInnerBlocks.Content = () => useInnerBlocksProps.save().children;\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/inner-blocks/README.md\n */\nexport default ForwardedInnerBlocks;\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,YAAY,QAAQ,oBAAoB;AACjD,SAASC,UAAU,EAAEC,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AChEsD,oBAAoB,CAACvD,mBAAmB,GAAGA,mBAAmB;AAE9DuD,oBAAoB,CAACwC,OAAO,GAAG,MAAMrC,mBAAmB,CAACoC,IAAI,CAAC,CAAC,CAAC9E,QAAQ;;AAExE;AACA;AACA;AACA,eAAeuC,oBAAoB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["clsx","useMergeRefs","forwardRef","useMemo","memo","useSelect","getBlockSupport","store","blocksStore","__unstableGetInnerBlocksProps","getInnerBlocksProps","ButtonBlockAppender","DefaultBlockAppender","useNestedSettingsUpdate","useInnerBlockTemplateSync","useBlockContext","BlockListItems","BlockContextProvider","useBlockEditContext","useBlockSync","blockEditorStore","useBlockDropZone","unlock","jsx","_jsx","EMPTY_OBJECT","BlockContext","children","clientId","context","value","BlockListItemsMemo","UncontrolledInnerBlocks","props","allowedBlocks","prioritizedInserterBlocks","defaultBlock","directInsert","__experimentalDefaultBlock","__experimentalDirectInsert","template","templateLock","wrapperRef","templateInsertUpdatesSelection","__experimentalCaptureToolbars","captureToolbars","__experimentalAppenderTagName","renderAppender","orientation","placeholder","layout","name","blockType","parentLock","defaultLayout","defaultLayoutBlockSupport","allowSizingOnChildren","usedLayout","memoedLayout","items","rootClientId","providesContext","Object","keys","length","ControlledInnerBlocks","ForwardedInnerBlocks","ref","innerBlocksProps","useInnerBlocksProps","className","options","__unstableDisableLayoutClassNames","__unstableDisableDropZone","dropZoneElement","__unstableLayoutClassNames","layoutClassNames","selected","select","getBlockName","__unstableGetEditorMode","getTemplateLock","getBlockRootClientId","getBlockEditingMode","getBlockSettings","getSectionRootClientId","_isDropZoneDisabled","isDropZoneDisabled","hasBlockSupport","getBlockType","blockName","blockEditingMode","parentClientId","sectionRootClientId","blockDropZoneRef","isManualPlacement","window","__experimentalEnableGridInteractivity","InnerBlocks","onChange","save","Content"],"sources":["@wordpress/block-editor/src/components/inner-blocks/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useMergeRefs } from '@wordpress/compose';\nimport { forwardRef, useMemo, memo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport {\n\tgetBlockSupport,\n\tstore as blocksStore,\n\t__unstableGetInnerBlocksProps as getInnerBlocksProps,\n} from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport ButtonBlockAppender from './button-block-appender';\nimport DefaultBlockAppender from './default-block-appender';\nimport useNestedSettingsUpdate from './use-nested-settings-update';\nimport useInnerBlockTemplateSync from './use-inner-block-template-sync';\nimport useBlockContext from './use-block-context';\nimport { BlockListItems } from '../block-list';\nimport { BlockContextProvider } from '../block-context';\nimport { useBlockEditContext } from '../block-edit/context';\nimport useBlockSync from '../provider/use-block-sync';\nimport { store as blockEditorStore } from '../../store';\nimport useBlockDropZone from '../use-block-drop-zone';\nimport { unlock } from '../../lock-unlock';\n\nconst EMPTY_OBJECT = {};\n\nfunction BlockContext( { children, clientId } ) {\n\tconst context = useBlockContext( clientId );\n\treturn (\n\t\t<BlockContextProvider value={ context }>\n\t\t\t{ children }\n\t\t</BlockContextProvider>\n\t);\n}\n\nconst BlockListItemsMemo = memo( BlockListItems );\n\n/**\n * InnerBlocks is a component which allows a single block to have multiple blocks\n * as children. The UncontrolledInnerBlocks component is used whenever the inner\n * blocks are not controlled by another entity. In other words, it is normally\n * used for inner blocks in the post editor\n *\n * @param {Object} props The component props.\n */\nfunction UncontrolledInnerBlocks( props ) {\n\tconst {\n\t\tclientId,\n\t\tallowedBlocks,\n\t\tprioritizedInserterBlocks,\n\t\tdefaultBlock,\n\t\tdirectInsert,\n\t\t__experimentalDefaultBlock,\n\t\t__experimentalDirectInsert,\n\t\ttemplate,\n\t\ttemplateLock,\n\t\twrapperRef,\n\t\ttemplateInsertUpdatesSelection,\n\t\t__experimentalCaptureToolbars: captureToolbars,\n\t\t__experimentalAppenderTagName,\n\t\trenderAppender,\n\t\torientation,\n\t\tplaceholder,\n\t\tlayout,\n\t\tname,\n\t\tblockType,\n\t\tparentLock,\n\t\tdefaultLayout,\n\t} = props;\n\n\tuseNestedSettingsUpdate(\n\t\tclientId,\n\t\tparentLock,\n\t\tallowedBlocks,\n\t\tprioritizedInserterBlocks,\n\t\tdefaultBlock,\n\t\tdirectInsert,\n\t\t__experimentalDefaultBlock,\n\t\t__experimentalDirectInsert,\n\t\ttemplateLock,\n\t\tcaptureToolbars,\n\t\torientation,\n\t\tlayout\n\t);\n\n\tuseInnerBlockTemplateSync(\n\t\tclientId,\n\t\ttemplate,\n\t\ttemplateLock,\n\t\ttemplateInsertUpdatesSelection\n\t);\n\n\tconst defaultLayoutBlockSupport =\n\t\tgetBlockSupport( name, 'layout' ) ||\n\t\tgetBlockSupport( name, '__experimentalLayout' ) ||\n\t\tEMPTY_OBJECT;\n\n\tconst { allowSizingOnChildren = false } = defaultLayoutBlockSupport;\n\tconst usedLayout = layout || defaultLayoutBlockSupport;\n\n\tconst memoedLayout = useMemo(\n\t\t() => ( {\n\t\t\t// Default layout will know about any content/wide size defined by the theme.\n\t\t\t...defaultLayout,\n\t\t\t...usedLayout,\n\t\t\t...( allowSizingOnChildren && {\n\t\t\t\tallowSizingOnChildren: true,\n\t\t\t} ),\n\t\t} ),\n\t\t[ defaultLayout, usedLayout, allowSizingOnChildren ]\n\t);\n\n\t// For controlled inner blocks, we don't want a change in blocks to\n\t// re-render the blocks list.\n\tconst items = (\n\t\t<BlockListItemsMemo\n\t\t\trootClientId={ clientId }\n\t\t\trenderAppender={ renderAppender }\n\t\t\t__experimentalAppenderTagName={ __experimentalAppenderTagName }\n\t\t\tlayout={ memoedLayout }\n\t\t\twrapperRef={ wrapperRef }\n\t\t\tplaceholder={ placeholder }\n\t\t/>\n\t);\n\n\tif (\n\t\t! blockType?.providesContext ||\n\t\tObject.keys( blockType.providesContext ).length === 0\n\t) {\n\t\treturn items;\n\t}\n\n\treturn <BlockContext clientId={ clientId }>{ items }</BlockContext>;\n}\n\n/**\n * The controlled inner blocks component wraps the uncontrolled inner blocks\n * component with the blockSync hook. This keeps the innerBlocks of the block in\n * the block-editor store in sync with the blocks of the controlling entity. An\n * example of an inner block controller is a template part block, which provides\n * its own blocks from the template part entity data source.\n *\n * @param {Object} props The component props.\n */\nfunction ControlledInnerBlocks( props ) {\n\tuseBlockSync( props );\n\treturn <UncontrolledInnerBlocks { ...props } />;\n}\n\nconst ForwardedInnerBlocks = forwardRef( ( props, ref ) => {\n\tconst innerBlocksProps = useInnerBlocksProps( { ref }, props );\n\treturn (\n\t\t<div className=\"block-editor-inner-blocks\">\n\t\t\t<div { ...innerBlocksProps } />\n\t\t</div>\n\t);\n} );\n\n/**\n * This hook is used to lightly mark an element as an inner blocks wrapper\n * element. Call this hook and pass the returned props to the element to mark as\n * an inner blocks wrapper, automatically rendering inner blocks as children. If\n * you define a ref for the element, it is important to pass the ref to this\n * hook, which the hook in turn will pass to the component through the props it\n * returns. Optionally, you can also pass any other props through this hook, and\n * they will be merged and returned.\n *\n * @param {Object} props Optional. Props to pass to the element. Must contain\n * the ref if one is defined.\n * @param {Object} options Optional. Inner blocks options.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/inner-blocks/README.md\n */\nexport function useInnerBlocksProps( props = {}, options = {} ) {\n\tconst {\n\t\t__unstableDisableLayoutClassNames,\n\t\t__unstableDisableDropZone,\n\t\tdropZoneElement,\n\t} = options;\n\tconst {\n\t\tclientId,\n\t\tlayout = null,\n\t\t__unstableLayoutClassNames: layoutClassNames = '',\n\t} = useBlockEditContext();\n\tconst selected = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockName,\n\t\t\t\t__unstableGetEditorMode,\n\t\t\t\tgetTemplateLock,\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\tgetBlockEditingMode,\n\t\t\t\tgetBlockSettings,\n\t\t\t\tgetSectionRootClientId,\n\t\t\t} = unlock( select( blockEditorStore ) );\n\t\t\tlet _isDropZoneDisabled;\n\n\t\t\tif ( ! clientId ) {\n\t\t\t\treturn { isDropZoneDisabled: _isDropZoneDisabled };\n\t\t\t}\n\n\t\t\tconst { hasBlockSupport, getBlockType } = select( blocksStore );\n\t\t\tconst blockName = getBlockName( clientId );\n\t\t\tconst blockEditingMode = getBlockEditingMode( clientId );\n\t\t\tconst parentClientId = getBlockRootClientId( clientId );\n\t\t\tconst [ defaultLayout ] = getBlockSettings( clientId, 'layout' );\n\n\t\t\t_isDropZoneDisabled = blockEditingMode === 'disabled';\n\n\t\t\tif ( __unstableGetEditorMode() === 'zoom-out' ) {\n\t\t\t\t// In zoom out mode, we want to disable the drop zone for the sections.\n\t\t\t\t// The inner blocks belonging to the section drop zone is\n\t\t\t\t// already disabled by the blocks themselves being disabled.\n\t\t\t\tconst sectionRootClientId = getSectionRootClientId();\n\n\t\t\t\t_isDropZoneDisabled = clientId !== sectionRootClientId;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\t__experimentalCaptureToolbars: hasBlockSupport(\n\t\t\t\t\tblockName,\n\t\t\t\t\t'__experimentalExposeControlsToChildren',\n\t\t\t\t\tfalse\n\t\t\t\t),\n\t\t\t\tname: blockName,\n\t\t\t\tblockType: getBlockType( blockName ),\n\t\t\t\tparentLock: getTemplateLock( parentClientId ),\n\t\t\t\tparentClientId,\n\t\t\t\tisDropZoneDisabled: _isDropZoneDisabled,\n\t\t\t\tdefaultLayout,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst {\n\t\t__experimentalCaptureToolbars,\n\t\tname,\n\t\tblockType,\n\t\tparentLock,\n\t\tparentClientId,\n\t\tisDropZoneDisabled,\n\t\tdefaultLayout,\n\t} = selected;\n\n\tconst blockDropZoneRef = useBlockDropZone( {\n\t\tdropZoneElement,\n\t\trootClientId: clientId,\n\t\tparentClientId,\n\t} );\n\n\tconst ref = useMergeRefs( [\n\t\tprops.ref,\n\t\t__unstableDisableDropZone ||\n\t\tisDropZoneDisabled ||\n\t\t( layout?.isManualPlacement &&\n\t\t\twindow.__experimentalEnableGridInteractivity )\n\t\t\t? null\n\t\t\t: blockDropZoneRef,\n\t] );\n\n\tconst innerBlocksProps = {\n\t\t__experimentalCaptureToolbars,\n\t\tlayout,\n\t\tname,\n\t\tblockType,\n\t\tparentLock,\n\t\tdefaultLayout,\n\t\t...options,\n\t};\n\tconst InnerBlocks =\n\t\tinnerBlocksProps.value && innerBlocksProps.onChange\n\t\t\t? ControlledInnerBlocks\n\t\t\t: UncontrolledInnerBlocks;\n\n\treturn {\n\t\t...props,\n\t\tref,\n\t\tclassName: clsx(\n\t\t\tprops.className,\n\t\t\t'block-editor-block-list__layout',\n\t\t\t__unstableDisableLayoutClassNames ? '' : layoutClassNames\n\t\t),\n\t\tchildren: clientId ? (\n\t\t\t<InnerBlocks { ...innerBlocksProps } clientId={ clientId } />\n\t\t) : (\n\t\t\t<BlockListItems { ...options } />\n\t\t),\n\t};\n}\n\nuseInnerBlocksProps.save = getInnerBlocksProps;\n\n// Expose default appender placeholders as components.\nForwardedInnerBlocks.DefaultBlockAppender = DefaultBlockAppender;\nForwardedInnerBlocks.ButtonBlockAppender = ButtonBlockAppender;\n\nForwardedInnerBlocks.Content = () => useInnerBlocksProps.save().children;\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/inner-blocks/README.md\n */\nexport default ForwardedInnerBlocks;\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,YAAY,QAAQ,oBAAoB;AACjD,SAASC,UAAU,EAAEC,OAAO,EAAEC,IAAI,QAAQ,oBAAoB;AAC9D,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SACCC,eAAe,EACfC,KAAK,IAAIC,WAAW,EACpBC,6BAA6B,IAAIC,mBAAmB,QAC9C,mBAAmB;;AAE1B;AACA;AACA;AACA,OAAOC,mBAAmB,MAAM,yBAAyB;AACzD,OAAOC,oBAAoB,MAAM,0BAA0B;AAC3D,OAAOC,uBAAuB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ACTC,UAAU;IACVC,aAAa;IACb,GAAGiB;EACJ,CAAC;EACD,MAAM2B,WAAW,GAChB9B,gBAAgB,CAACtC,KAAK,IAAIsC,gBAAgB,CAAC+B,QAAQ,GAChDlC,qBAAqB,GACrBjC,uBAAuB;EAE3B,OAAO;IACN,GAAGC,KAAK;IACRkC,GAAG;IACHG,SAAS,EAAEtE,IAAI,CACdiC,KAAK,CAACqC,SAAS,EACf,iCAAiC,EACjCE,iCAAiC,GAAG,EAAE,GAAGI,gBAC1C,CAAC;IACDjD,QAAQ,EAAEC,QAAQ,gBACjBJ,IAAA,CAAC0E,WAAW;MAAA,GAAM9B,gBAAgB;MAAGxC,QAAQ,EAAGA;IAAU,CAAE,CAAC,gBAE7DJ,IAAA,CAACR,cAAc;MAAA,GAAMuD;IAAO,CAAI;EAElC,CAAC;AACF;AAEAF,mBAAmB,CAAC+B,IAAI,GAAG1F,mBAAmB;;AAE9C;AACAwD,oBAAoB,CAACtD,oBAAoB,GAAGA,oBAAoB;AAChEsD,oBAAoB,CAACvD,mBAAmB,GAAGA,mBAAmB;AAE9DuD,oBAAoB,CAACmC,OAAO,GAAG,MAAMhC,mBAAmB,CAAC+B,IAAI,CAAC,CAAC,CAACzE,QAAQ;;AAExE;AACA;AACA;AACA,eAAeuC,oBAAoB","ignoreList":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { useLayoutEffect,
|
|
4
|
+
import { useLayoutEffect, useState } from '@wordpress/element';
|
|
5
5
|
import { useRegistry } from '@wordpress/data';
|
|
6
6
|
import deprecated from '@wordpress/deprecated';
|
|
7
7
|
import isShallowEqual from '@wordpress/is-shallow-equal';
|
|
@@ -15,12 +15,21 @@ import { getLayoutType } from '../../layouts';
|
|
|
15
15
|
/** @typedef {import('../../selectors').WPDirectInsertBlock } WPDirectInsertBlock */
|
|
16
16
|
|
|
17
17
|
const pendingSettingsUpdates = new WeakMap();
|
|
18
|
+
|
|
19
|
+
// Creates a memoizing caching function that remembers the last value and keeps returning it
|
|
20
|
+
// as long as the new values are shallowly equal. Helps keep dependencies stable.
|
|
21
|
+
function createShallowMemo() {
|
|
22
|
+
let value;
|
|
23
|
+
return newValue => {
|
|
24
|
+
if (value === undefined || !isShallowEqual(value, newValue)) {
|
|
25
|
+
value = newValue;
|
|
26
|
+
}
|
|
27
|
+
return value;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
18
30
|
function useShallowMemo(value) {
|
|
19
|
-
const [
|
|
20
|
-
|
|
21
|
-
setPrevValue(value);
|
|
22
|
-
}
|
|
23
|
-
return prevValue;
|
|
31
|
+
const [memo] = useState(createShallowMemo);
|
|
32
|
+
return memo(value);
|
|
24
33
|
}
|
|
25
34
|
|
|
26
35
|
/**
|
|
@@ -63,9 +72,7 @@ export default function useNestedSettingsUpdate(clientId, parentLock, allowedBlo
|
|
|
63
72
|
// otherwise if the arrays change length but the first elements are equal the comparison,
|
|
64
73
|
// does not works as expected.
|
|
65
74
|
const _allowedBlocks = useShallowMemo(allowedBlocks);
|
|
66
|
-
const _prioritizedInserterBlocks =
|
|
67
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
68
|
-
prioritizedInserterBlocks);
|
|
75
|
+
const _prioritizedInserterBlocks = useShallowMemo(prioritizedInserterBlocks);
|
|
69
76
|
const _templateLock = templateLock === undefined || parentLock === 'contentOnly' ? parentLock : templateLock;
|
|
70
77
|
useLayoutEffect(() => {
|
|
71
78
|
const newSettings = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useLayoutEffect","useMemo","useState","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","registry","_allowedBlocks","_prioritizedInserterBlocks","_templateLock","undefined","newSettings","__experimentalCaptureToolbars","layoutType","type","getOrientation","alternative","since","version","get","set","window","queueMicrotask","settings","Object","keys","length","updateBlockListSettings","dispatch"],"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 { 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 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.get( registry )[ clientId ] = newSettings;\n\t\twindow.queueMicrotask( () => {\n\t\t\tconst settings = pendingSettingsUpdates.get( registry );\n\t\t\tif ( Object.keys( settings ).length ) {\n\t\t\t\tconst { updateBlockListSettings } =\n\t\t\t\t\tregistry.dispatch( blockEditorStore );\n\t\t\t\tupdateBlockListSettings( settings );\n\t\t\t\tpendingSettingsUpdates.set( registry, {} );\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\tlayout,\n\t\tregistry,\n\t] );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,eAAe,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,oBAAoB;AACvE,SAASC,WAAW,QAAQ,iBAAiB;AAC7C,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,GAAGZ,QAAQ,CAAEU,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,MAAMC,QAAQ,GAAGzB,WAAW,CAAC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isShallowEqual","store","blockEditorStore","getLayoutType","pendingSettingsUpdates","WeakMap","createShallowMemo","value","newValue","undefined","useShallowMemo","memo","useNestedSettingsUpdate","clientId","parentLock","allowedBlocks","prioritizedInserterBlocks","defaultBlock","directInsert","__experimentalDefaultBlock","__experimentalDirectInsert","templateLock","captureToolbars","orientation","layout","registry","_allowedBlocks","_prioritizedInserterBlocks","_templateLock","newSettings","__experimentalCaptureToolbars","layoutType","type","getOrientation","alternative","since","version","get","set","window","queueMicrotask","settings","Object","keys","length","updateBlockListSettings","dispatch"],"sources":["@wordpress/block-editor/src/components/inner-blocks/use-nested-settings-update.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useLayoutEffect, useState } from '@wordpress/element';\nimport { 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\n// Creates a memoizing caching function that remembers the last value and keeps returning it\n// as long as the new values are shallowly equal. Helps keep dependencies stable.\nfunction createShallowMemo() {\n\tlet value;\n\treturn ( newValue ) => {\n\t\tif ( value === undefined || ! isShallowEqual( value, newValue ) ) {\n\t\t\tvalue = newValue;\n\t\t}\n\t\treturn value;\n\t};\n}\n\nfunction useShallowMemo( value ) {\n\tconst [ memo ] = useState( createShallowMemo );\n\treturn memo( value );\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 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\tconst _prioritizedInserterBlocks = useShallowMemo(\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.get( registry )[ clientId ] = newSettings;\n\t\twindow.queueMicrotask( () => {\n\t\t\tconst settings = pendingSettingsUpdates.get( registry );\n\t\t\tif ( Object.keys( settings ).length ) {\n\t\t\t\tconst { updateBlockListSettings } =\n\t\t\t\t\tregistry.dispatch( blockEditorStore );\n\t\t\t\tupdateBlockListSettings( settings );\n\t\t\t\tpendingSettingsUpdates.set( registry, {} );\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\tlayout,\n\t\tregistry,\n\t] );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,eAAe,EAAEC,QAAQ,QAAQ,oBAAoB;AAC9D,SAASC,WAAW,QAAQ,iBAAiB;AAC7C,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;AACA;AACA,SAASC,iBAAiBA,CAAA,EAAG;EAC5B,IAAIC,KAAK;EACT,OAASC,QAAQ,IAAM;IACtB,IAAKD,KAAK,KAAKE,SAAS,IAAI,CAAET,cAAc,CAAEO,KAAK,EAAEC,QAAS,CAAC,EAAG;MACjED,KAAK,GAAGC,QAAQ;IACjB;IACA,OAAOD,KAAK;EACb,CAAC;AACF;AAEA,SAASG,cAAcA,CAAEH,KAAK,EAAG;EAChC,MAAM,CAAEI,IAAI,CAAE,GAAGd,QAAQ,CAAES,iBAAkB,CAAC;EAC9C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,CAAC;QACtC2C,uBAAuB,CAAEJ,QAAS,CAAC;QACnCrC,sBAAsB,CAACkC,GAAG,CAAEb,QAAQ,EAAE,CAAC,CAAE,CAAC;MAC3C;IACD,CAAE,CAAC;EACJ,CAAC,EAAE,CACFZ,QAAQ,EACRa,cAAc,EACdC,0BAA0B,EAC1BC,aAAa,EACbX,YAAY,EACZC,YAAY,EACZC,0BAA0B,EAC1BC,0BAA0B,EAC1BE,eAAe,EACfC,WAAW,EACXC,MAAM,EACNC,QAAQ,CACP,CAAC;AACJ","ignoreList":[]}
|
|
@@ -19,8 +19,7 @@ import { store as blockEditorStore } from '../../store';
|
|
|
19
19
|
import { MAX_NESTING_DEPTH } from './constants';
|
|
20
20
|
import useUnsupportedBlockEditor from '../use-unsupported-block-editor';
|
|
21
21
|
import { useConvertToGroupButtons, useConvertToGroupButtonProps } from '../convert-to-group-buttons';
|
|
22
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
23
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
22
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
23
|
const EMPTY_ARRAY = [];
|
|
25
24
|
const WarningMaxDepthExceeded = ({
|
|
26
25
|
clientId
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["TouchableWithoutFeedback","View","__","sprintf","useState","useSelect","Warning","UnsupportedBlockDetails","store","blockEditorStore","MAX_NESTING_DEPTH","useUnsupportedBlockEditor","useConvertToGroupButtons","useConvertToGroupButtonProps","jsx","_jsx","jsxs","_jsxs","EMPTY_ARRAY","WarningMaxDepthExceeded","clientId","showDetails","setShowDetails","isSelected","select","isBlockSelected","convertToGroupButtonProps","isUngroupable","convertToGroupButtons","onUngroup","ungroup","onSelect","isUnsupportedBlockEditorSupported","canEnableUnsupportedBlockEditor","descriptionFormat","description","disabled","accessibilityLabel","accessibilityRole","accessibilityHint","onPress","children","message","showSheet","onCloseSheet","title","customActions","label"],"sources":["@wordpress/block-editor/src/components/inner-blocks/warning-max-depth-exceeded.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { TouchableWithoutFeedback, View } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport Warning from '../warning';\nimport UnsupportedBlockDetails from '../unsupported-block-details';\nimport { store as blockEditorStore } from '../../store';\nimport { MAX_NESTING_DEPTH } from './constants';\nimport useUnsupportedBlockEditor from '../use-unsupported-block-editor';\nimport {\n\tuseConvertToGroupButtons,\n\tuseConvertToGroupButtonProps,\n} from '../convert-to-group-buttons';\n\nconst EMPTY_ARRAY = [];\n\nconst WarningMaxDepthExceeded = ( { clientId } ) => {\n\tconst [ showDetails, setShowDetails ] = useState( false );\n\n\tconst isSelected = useSelect(\n\t\t( select ) => select( blockEditorStore ).isBlockSelected( clientId ),\n\t\t[ clientId ]\n\t);\n\n\t// We rely on the logic related to the Group/Ungroup buttons used in the block options to\n\t// determine whether to use the Ungroup action.\n\tconst convertToGroupButtonProps = useConvertToGroupButtonProps( [\n\t\tclientId,\n\t] );\n\tconst { isUngroupable } = convertToGroupButtonProps;\n\tconst convertToGroupButtons = useConvertToGroupButtons( {\n\t\t...convertToGroupButtonProps,\n\t} );\n\tconst onUngroup = convertToGroupButtons.ungroup.onSelect;\n\n\tconst {\n\t\tisUnsupportedBlockEditorSupported,\n\t\tcanEnableUnsupportedBlockEditor,\n\t} = useUnsupportedBlockEditor( clientId );\n\n\t/* translators: Warning related to having blocks deeply nested. %d: The deepest nesting level. */\n\tconst descriptionFormat = __(\n\t\t'Blocks nested deeper than %d levels may not render properly in the mobile editor.'\n\t);\n\tlet description = sprintf( descriptionFormat, MAX_NESTING_DEPTH );\n\tif (\n\t\t! isUnsupportedBlockEditorSupported &&\n\t\t! canEnableUnsupportedBlockEditor\n\t) {\n\t\t// When UBE can't be used, the description mentions using the web browser to edit the block.\n\t\tdescription +=\n\t\t\t' ' +\n\t\t\t/* translators: Recommendation included in a warning related to having blocks deeply nested. */\n\t\t\t__(\n\t\t\t\t'For this reason, we recommend editing the block using your web browser.'\n\t\t\t);\n\t}\n\t// Otherwise, the description mentions using the web editor (i.e. UBE).\n\telse {\n\t\tdescription +=\n\t\t\t' ' +\n\t\t\t/* translators: Recommendation included in a warning related to having blocks deeply nested. */\n\t\t\t__(\n\t\t\t\t'For this reason, we recommend editing the block using the web editor.'\n\t\t\t);\n\t}\n\t// If the block can be flattened, we also suggest to ungroup the block.\n\tif ( isUngroupable ) {\n\t\tdescription +=\n\t\t\t' ' +\n\t\t\t/* translators: Alternative option included in a warning related to having blocks deeply nested. */\n\t\t\t__(\n\t\t\t\t'Alternatively, you can flatten the content by ungrouping the block.'\n\t\t\t);\n\t}\n\n\treturn (\n\t\t<TouchableWithoutFeedback\n\t\t\tdisabled={ ! isSelected }\n\t\t\taccessibilityLabel={ __( 'Warning message' ) }\n\t\t\taccessibilityRole=\"button\"\n\t\t\taccessibilityHint={ __( 'Tap here to show more details.' ) }\n\t\t\tonPress={ () => setShowDetails( true ) }\n\t\t>\n\t\t\t<View>\n\t\t\t\t<Warning\n\t\t\t\t\tmessage={ __(\n\t\t\t\t\t\t'Block cannot be rendered because it is deeply nested. Tap here for more details.'\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t\t<UnsupportedBlockDetails\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\tshowSheet={ showDetails }\n\t\t\t\t\tonCloseSheet={ () => setShowDetails( false ) }\n\t\t\t\t\ttitle={ __( 'Deeply nested block' ) }\n\t\t\t\t\tdescription={ description }\n\t\t\t\t\tcustomActions={\n\t\t\t\t\t\tisUngroupable\n\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\t\tlabel: __( 'Ungroup block' ),\n\t\t\t\t\t\t\t\t\t\tonPress: onUngroup,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t ]\n\t\t\t\t\t\t\t: EMPTY_ARRAY\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</View>\n\t\t</TouchableWithoutFeedback>\n\t);\n};\n\nexport default WarningMaxDepthExceeded;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,wBAAwB,EAAEC,IAAI,QAAQ,cAAc;;AAE7D;AACA;AACA;AACA,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,SAAS,QAAQ,iBAAiB;;AAE3C;AACA;AACA;AACA,OAAOC,OAAO,MAAM,YAAY;AAChC,OAAOC,uBAAuB,MAAM,8BAA8B;AAClE,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AACvD,SAASC,iBAAiB,QAAQ,aAAa;AAC/C,OAAOC,yBAAyB,MAAM,iCAAiC;AACvE,SACCC,wBAAwB,EACxBC,4BAA4B,QACtB,6BAA6B;AAAC,SAAAC,GAAA,IAAAC,IAAA
|
|
1
|
+
{"version":3,"names":["TouchableWithoutFeedback","View","__","sprintf","useState","useSelect","Warning","UnsupportedBlockDetails","store","blockEditorStore","MAX_NESTING_DEPTH","useUnsupportedBlockEditor","useConvertToGroupButtons","useConvertToGroupButtonProps","jsx","_jsx","jsxs","_jsxs","EMPTY_ARRAY","WarningMaxDepthExceeded","clientId","showDetails","setShowDetails","isSelected","select","isBlockSelected","convertToGroupButtonProps","isUngroupable","convertToGroupButtons","onUngroup","ungroup","onSelect","isUnsupportedBlockEditorSupported","canEnableUnsupportedBlockEditor","descriptionFormat","description","disabled","accessibilityLabel","accessibilityRole","accessibilityHint","onPress","children","message","showSheet","onCloseSheet","title","customActions","label"],"sources":["@wordpress/block-editor/src/components/inner-blocks/warning-max-depth-exceeded.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { TouchableWithoutFeedback, View } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport Warning from '../warning';\nimport UnsupportedBlockDetails from '../unsupported-block-details';\nimport { store as blockEditorStore } from '../../store';\nimport { MAX_NESTING_DEPTH } from './constants';\nimport useUnsupportedBlockEditor from '../use-unsupported-block-editor';\nimport {\n\tuseConvertToGroupButtons,\n\tuseConvertToGroupButtonProps,\n} from '../convert-to-group-buttons';\n\nconst EMPTY_ARRAY = [];\n\nconst WarningMaxDepthExceeded = ( { clientId } ) => {\n\tconst [ showDetails, setShowDetails ] = useState( false );\n\n\tconst isSelected = useSelect(\n\t\t( select ) => select( blockEditorStore ).isBlockSelected( clientId ),\n\t\t[ clientId ]\n\t);\n\n\t// We rely on the logic related to the Group/Ungroup buttons used in the block options to\n\t// determine whether to use the Ungroup action.\n\tconst convertToGroupButtonProps = useConvertToGroupButtonProps( [\n\t\tclientId,\n\t] );\n\tconst { isUngroupable } = convertToGroupButtonProps;\n\tconst convertToGroupButtons = useConvertToGroupButtons( {\n\t\t...convertToGroupButtonProps,\n\t} );\n\tconst onUngroup = convertToGroupButtons.ungroup.onSelect;\n\n\tconst {\n\t\tisUnsupportedBlockEditorSupported,\n\t\tcanEnableUnsupportedBlockEditor,\n\t} = useUnsupportedBlockEditor( clientId );\n\n\t/* translators: Warning related to having blocks deeply nested. %d: The deepest nesting level. */\n\tconst descriptionFormat = __(\n\t\t'Blocks nested deeper than %d levels may not render properly in the mobile editor.'\n\t);\n\tlet description = sprintf( descriptionFormat, MAX_NESTING_DEPTH );\n\tif (\n\t\t! isUnsupportedBlockEditorSupported &&\n\t\t! canEnableUnsupportedBlockEditor\n\t) {\n\t\t// When UBE can't be used, the description mentions using the web browser to edit the block.\n\t\tdescription +=\n\t\t\t' ' +\n\t\t\t/* translators: Recommendation included in a warning related to having blocks deeply nested. */\n\t\t\t__(\n\t\t\t\t'For this reason, we recommend editing the block using your web browser.'\n\t\t\t);\n\t}\n\t// Otherwise, the description mentions using the web editor (i.e. UBE).\n\telse {\n\t\tdescription +=\n\t\t\t' ' +\n\t\t\t/* translators: Recommendation included in a warning related to having blocks deeply nested. */\n\t\t\t__(\n\t\t\t\t'For this reason, we recommend editing the block using the web editor.'\n\t\t\t);\n\t}\n\t// If the block can be flattened, we also suggest to ungroup the block.\n\tif ( isUngroupable ) {\n\t\tdescription +=\n\t\t\t' ' +\n\t\t\t/* translators: Alternative option included in a warning related to having blocks deeply nested. */\n\t\t\t__(\n\t\t\t\t'Alternatively, you can flatten the content by ungrouping the block.'\n\t\t\t);\n\t}\n\n\treturn (\n\t\t<TouchableWithoutFeedback\n\t\t\tdisabled={ ! isSelected }\n\t\t\taccessibilityLabel={ __( 'Warning message' ) }\n\t\t\taccessibilityRole=\"button\"\n\t\t\taccessibilityHint={ __( 'Tap here to show more details.' ) }\n\t\t\tonPress={ () => setShowDetails( true ) }\n\t\t>\n\t\t\t<View>\n\t\t\t\t<Warning\n\t\t\t\t\tmessage={ __(\n\t\t\t\t\t\t'Block cannot be rendered because it is deeply nested. Tap here for more details.'\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t\t<UnsupportedBlockDetails\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\tshowSheet={ showDetails }\n\t\t\t\t\tonCloseSheet={ () => setShowDetails( false ) }\n\t\t\t\t\ttitle={ __( 'Deeply nested block' ) }\n\t\t\t\t\tdescription={ description }\n\t\t\t\t\tcustomActions={\n\t\t\t\t\t\tisUngroupable\n\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\t\tlabel: __( 'Ungroup block' ),\n\t\t\t\t\t\t\t\t\t\tonPress: onUngroup,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t ]\n\t\t\t\t\t\t\t: EMPTY_ARRAY\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</View>\n\t\t</TouchableWithoutFeedback>\n\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