@wordpress/block-editor 15.21.0 → 15.22.1-next.v.202606191442.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 +23 -1
- package/build/components/block-card/index.cjs +4 -5
- package/build/components/block-card/index.cjs.map +2 -2
- package/build/components/block-compare/index.cjs +2 -2
- package/build/components/block-compare/index.cjs.map +2 -2
- package/build/components/block-inspector/index.cjs +3 -4
- package/build/components/block-inspector/index.cjs.map +2 -2
- package/build/components/block-mover/mover-description.cjs +6 -6
- package/build/components/block-mover/mover-description.cjs.map +1 -1
- package/build/components/block-patterns-list/index.cjs +1 -1
- package/build/components/block-patterns-list/index.cjs.map +2 -2
- package/build/components/block-patterns-paging/index.cjs +4 -4
- package/build/components/block-patterns-paging/index.cjs.map +2 -2
- package/build/components/block-popover/use-popover-scroll.cjs.map +1 -1
- package/build/components/block-quick-navigation/index.cjs +7 -5
- package/build/components/block-quick-navigation/index.cjs.map +2 -2
- package/build/components/block-switcher/block-transformations-menu.cjs +16 -15
- package/build/components/block-switcher/block-transformations-menu.cjs.map +2 -2
- package/build/components/block-switcher/index.cjs +4 -4
- package/build/components/block-switcher/index.cjs.map +2 -2
- package/build/components/block-toolbar/edit-section-button.cjs.map +1 -1
- package/build/components/block-tools/use-block-toolbar-popover-props.cjs +10 -4
- package/build/components/block-tools/use-block-toolbar-popover-props.cjs.map +2 -2
- package/build/components/child-layout-control/index.cjs +51 -19
- package/build/components/child-layout-control/index.cjs.map +2 -2
- package/build/components/dimensions-tool/index.cjs +4 -5
- package/build/components/dimensions-tool/index.cjs.map +2 -2
- package/build/components/dimensions-tool/scale-tool.cjs +1 -1
- package/build/components/dimensions-tool/scale-tool.cjs.map +2 -2
- package/build/components/global-styles/advanced-panel.cjs +23 -15
- package/build/components/global-styles/advanced-panel.cjs.map +2 -2
- package/build/components/global-styles/background-panel.cjs +2 -2
- package/build/components/global-styles/background-panel.cjs.map +2 -2
- package/build/components/global-styles/border-panel.cjs +2 -0
- package/build/components/global-styles/border-panel.cjs.map +2 -2
- package/build/components/global-styles/dimensions-panel.cjs +2 -2
- package/build/components/global-styles/dimensions-panel.cjs.map +2 -2
- package/build/components/global-styles/shadow-panel-components.cjs.map +2 -2
- package/build/components/grid/grid-item-resizer.cjs.map +1 -1
- package/build/components/grid/grid-visualizer.cjs.map +1 -1
- package/build/components/iframe/index.cjs +6 -3
- package/build/components/iframe/index.cjs.map +3 -3
- package/build/components/image-editor/use-transform-image.cjs.map +1 -1
- package/build/components/inner-blocks/use-inner-block-template-sync.cjs +3 -1
- package/build/components/inner-blocks/use-inner-block-template-sync.cjs.map +2 -2
- package/build/components/inserter/get-appender-label.cjs.map +1 -1
- package/build/components/inserter/hooks/use-patterns-state.cjs +1 -1
- package/build/components/inserter/hooks/use-patterns-state.cjs.map +2 -2
- package/build/components/inserter/index.cjs +179 -220
- package/build/components/inserter/index.cjs.map +3 -3
- package/build/components/inserter/media-tab/media-preview.cjs.map +2 -2
- package/build/components/inserter/search-items.cjs.map +1 -1
- package/build/components/inserter/search-results.cjs +1 -1
- package/build/components/inserter/search-results.cjs.map +2 -2
- package/build/components/inspector-controls/fill.cjs +1 -3
- package/build/components/inspector-controls/fill.cjs.map +2 -2
- package/build/components/inspector-controls-tabs/index.cjs.map +2 -2
- package/build/components/inspector-controls-tabs/styles-tab.cjs +1 -1
- package/build/components/inspector-controls-tabs/styles-tab.cjs.map +2 -2
- package/build/components/keyboard-shortcuts/index.cjs.map +1 -1
- package/build/components/line-height-control/index.cjs.map +1 -1
- package/build/components/link-control/index.cjs +1 -1
- package/build/components/link-control/index.cjs.map +1 -1
- package/build/components/link-control/normalize-url.cjs.map +1 -1
- package/build/components/list-view/block-select-button.cjs +10 -12
- package/build/components/list-view/block-select-button.cjs.map +2 -2
- package/build/components/list-view/block.cjs +2 -1
- package/build/components/list-view/block.cjs.map +2 -2
- package/build/components/list-view/utils.cjs.map +1 -1
- package/build/components/preset-input-control/custom-value-controls.cjs.map +2 -2
- package/build/components/provider/index.cjs.map +1 -1
- package/build/components/provider/use-block-sync.cjs +11 -2
- package/build/components/provider/use-block-sync.cjs.map +2 -2
- package/build/components/rich-text/event-listeners/before-input-rules.cjs +5 -5
- package/build/components/rich-text/event-listeners/before-input-rules.cjs.map +3 -3
- package/build/components/rich-text/event-listeners/delete.cjs +4 -4
- package/build/components/rich-text/event-listeners/delete.cjs.map +3 -3
- package/build/components/rich-text/event-listeners/enter.cjs +7 -2
- package/build/components/rich-text/event-listeners/enter.cjs.map +2 -2
- package/build/components/rich-text/event-listeners/input-events.cjs +4 -4
- package/build/components/rich-text/event-listeners/input-events.cjs.map +3 -3
- package/build/components/rich-text/event-listeners/input-rules.cjs +17 -4
- package/build/components/rich-text/event-listeners/input-rules.cjs.map +3 -3
- package/build/components/rich-text/event-listeners/insert-replacement-text.cjs +4 -4
- package/build/components/rich-text/event-listeners/insert-replacement-text.cjs.map +3 -3
- package/build/components/rich-text/event-listeners/paste-handler.cjs.map +1 -1
- package/build/components/rich-text/event-listeners/remove-browser-shortcuts.cjs +4 -4
- package/build/components/rich-text/event-listeners/remove-browser-shortcuts.cjs.map +3 -3
- package/build/components/rich-text/event-listeners/shortcuts.cjs +4 -4
- package/build/components/rich-text/event-listeners/shortcuts.cjs.map +3 -3
- package/build/components/rich-text/event-listeners/undo-automatic-change.cjs +4 -4
- package/build/components/rich-text/event-listeners/undo-automatic-change.cjs.map +3 -3
- package/build/components/rich-text/index.cjs +1 -23
- package/build/components/rich-text/index.cjs.map +2 -2
- package/build/components/rich-text/prevent-event-discovery.cjs +1 -1
- package/build/components/rich-text/prevent-event-discovery.cjs.map +1 -1
- package/build/components/use-block-commands/index.cjs +5 -5
- package/build/components/use-block-commands/index.cjs.map +2 -2
- package/build/components/writing-flow/use-tab-nav.cjs.map +1 -1
- package/build/hooks/anchor.cjs +12 -16
- package/build/hooks/anchor.cjs.map +2 -2
- package/build/hooks/background.cjs.map +1 -1
- package/build/hooks/block-fields/index.cjs +13 -2
- package/build/hooks/block-fields/index.cjs.map +2 -2
- package/build/hooks/border.cjs +0 -3
- package/build/hooks/border.cjs.map +2 -2
- package/build/hooks/color.cjs +1 -4
- package/build/hooks/color.cjs.map +2 -2
- package/build/hooks/dimensions.cjs +13 -5
- package/build/hooks/dimensions.cjs.map +2 -2
- package/build/hooks/fit-text.cjs +11 -0
- package/build/hooks/fit-text.cjs.map +2 -2
- package/build/hooks/layout-child.cjs +27 -2
- package/build/hooks/layout-child.cjs.map +2 -2
- package/build/hooks/list-view.cjs +10 -7
- package/build/hooks/list-view.cjs.map +2 -2
- package/build/hooks/position.cjs +19 -22
- package/build/hooks/position.cjs.map +2 -2
- package/build/hooks/spacing-visualizer.cjs.map +1 -1
- package/build/hooks/state-utils.cjs.map +1 -1
- package/build/hooks/style.cjs +42 -2
- package/build/hooks/style.cjs.map +2 -2
- package/build/hooks/supports.cjs +0 -7
- package/build/hooks/supports.cjs.map +2 -2
- package/build/private-apis.cjs +4 -0
- package/build/private-apis.cjs.map +2 -2
- package/build/store/actions.cjs +7 -3
- package/build/store/actions.cjs.map +2 -2
- package/build/store/private-actions.cjs +1 -2
- package/build/store/private-actions.cjs.map +2 -2
- package/build/store/private-selectors.cjs +42 -2
- package/build/store/private-selectors.cjs.map +2 -2
- package/build/store/reducer.cjs +14 -6
- package/build/store/reducer.cjs.map +2 -2
- package/build/store/selectors.cjs +60 -41
- package/build/store/selectors.cjs.map +2 -2
- package/build/utils/dom.cjs.map +1 -1
- package/build/utils/selection.cjs +1 -1
- package/build-module/components/block-card/index.mjs +5 -6
- package/build-module/components/block-card/index.mjs.map +2 -2
- package/build-module/components/block-compare/index.mjs +1 -1
- package/build-module/components/block-compare/index.mjs.map +2 -2
- package/build-module/components/block-inspector/index.mjs +3 -5
- package/build-module/components/block-inspector/index.mjs.map +2 -2
- package/build-module/components/block-mover/mover-description.mjs +6 -6
- package/build-module/components/block-mover/mover-description.mjs.map +1 -1
- package/build-module/components/block-patterns-list/index.mjs +1 -1
- package/build-module/components/block-patterns-list/index.mjs.map +2 -2
- package/build-module/components/block-patterns-paging/index.mjs +4 -4
- package/build-module/components/block-patterns-paging/index.mjs.map +2 -2
- package/build-module/components/block-popover/use-popover-scroll.mjs.map +1 -1
- package/build-module/components/block-quick-navigation/index.mjs +8 -6
- package/build-module/components/block-quick-navigation/index.mjs.map +2 -2
- package/build-module/components/block-switcher/block-transformations-menu.mjs +16 -15
- package/build-module/components/block-switcher/block-transformations-menu.mjs.map +2 -2
- package/build-module/components/block-switcher/index.mjs +4 -4
- package/build-module/components/block-switcher/index.mjs.map +2 -2
- package/build-module/components/block-toolbar/edit-section-button.mjs.map +1 -1
- package/build-module/components/block-tools/use-block-toolbar-popover-props.mjs +10 -4
- package/build-module/components/block-tools/use-block-toolbar-popover-props.mjs.map +2 -2
- package/build-module/components/child-layout-control/index.mjs +51 -19
- package/build-module/components/child-layout-control/index.mjs.map +2 -2
- package/build-module/components/dimensions-tool/index.mjs +4 -5
- package/build-module/components/dimensions-tool/index.mjs.map +2 -2
- package/build-module/components/dimensions-tool/scale-tool.mjs +1 -1
- package/build-module/components/dimensions-tool/scale-tool.mjs.map +2 -2
- package/build-module/components/global-styles/advanced-panel.mjs +23 -15
- package/build-module/components/global-styles/advanced-panel.mjs.map +2 -2
- package/build-module/components/global-styles/background-panel.mjs +3 -3
- package/build-module/components/global-styles/background-panel.mjs.map +2 -2
- package/build-module/components/global-styles/border-panel.mjs +2 -0
- package/build-module/components/global-styles/border-panel.mjs.map +2 -2
- package/build-module/components/global-styles/dimensions-panel.mjs +3 -4
- package/build-module/components/global-styles/dimensions-panel.mjs.map +2 -2
- package/build-module/components/global-styles/shadow-panel-components.mjs.map +2 -2
- package/build-module/components/grid/grid-item-resizer.mjs.map +1 -1
- package/build-module/components/grid/grid-visualizer.mjs.map +1 -1
- package/build-module/components/iframe/index.mjs +6 -3
- package/build-module/components/iframe/index.mjs.map +2 -2
- package/build-module/components/image-editor/use-transform-image.mjs.map +1 -1
- package/build-module/components/inner-blocks/use-inner-block-template-sync.mjs +3 -1
- package/build-module/components/inner-blocks/use-inner-block-template-sync.mjs.map +2 -2
- package/build-module/components/inserter/get-appender-label.mjs.map +1 -1
- package/build-module/components/inserter/hooks/use-patterns-state.mjs +1 -1
- package/build-module/components/inserter/hooks/use-patterns-state.mjs.map +2 -2
- package/build-module/components/inserter/index.mjs +185 -222
- package/build-module/components/inserter/index.mjs.map +3 -3
- package/build-module/components/inserter/media-tab/media-preview.mjs.map +2 -2
- package/build-module/components/inserter/search-items.mjs.map +1 -1
- package/build-module/components/inserter/search-results.mjs +1 -1
- package/build-module/components/inserter/search-results.mjs.map +2 -2
- package/build-module/components/inspector-controls/fill.mjs +1 -3
- package/build-module/components/inspector-controls/fill.mjs.map +2 -2
- package/build-module/components/inspector-controls-tabs/index.mjs.map +2 -2
- package/build-module/components/inspector-controls-tabs/styles-tab.mjs +1 -1
- package/build-module/components/inspector-controls-tabs/styles-tab.mjs.map +2 -2
- package/build-module/components/keyboard-shortcuts/index.mjs.map +1 -1
- package/build-module/components/line-height-control/index.mjs.map +1 -1
- package/build-module/components/link-control/index.mjs +1 -1
- package/build-module/components/link-control/index.mjs.map +1 -1
- package/build-module/components/link-control/normalize-url.mjs.map +1 -1
- package/build-module/components/list-view/block-select-button.mjs +10 -12
- package/build-module/components/list-view/block-select-button.mjs.map +2 -2
- package/build-module/components/list-view/block.mjs +2 -1
- package/build-module/components/list-view/block.mjs.map +2 -2
- package/build-module/components/list-view/utils.mjs.map +1 -1
- package/build-module/components/preset-input-control/custom-value-controls.mjs.map +2 -2
- package/build-module/components/provider/index.mjs.map +1 -1
- package/build-module/components/provider/use-block-sync.mjs +11 -2
- package/build-module/components/provider/use-block-sync.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/before-input-rules.mjs +5 -5
- package/build-module/components/rich-text/event-listeners/before-input-rules.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/delete.mjs +4 -4
- package/build-module/components/rich-text/event-listeners/delete.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/enter.mjs +7 -2
- package/build-module/components/rich-text/event-listeners/enter.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/input-events.mjs +4 -4
- package/build-module/components/rich-text/event-listeners/input-events.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/input-rules.mjs +17 -4
- package/build-module/components/rich-text/event-listeners/input-rules.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/insert-replacement-text.mjs +4 -4
- package/build-module/components/rich-text/event-listeners/insert-replacement-text.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/paste-handler.mjs.map +1 -1
- package/build-module/components/rich-text/event-listeners/remove-browser-shortcuts.mjs +4 -4
- package/build-module/components/rich-text/event-listeners/remove-browser-shortcuts.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/shortcuts.mjs +4 -4
- package/build-module/components/rich-text/event-listeners/shortcuts.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/undo-automatic-change.mjs +4 -4
- package/build-module/components/rich-text/event-listeners/undo-automatic-change.mjs.map +2 -2
- package/build-module/components/rich-text/index.mjs +1 -23
- package/build-module/components/rich-text/index.mjs.map +2 -2
- package/build-module/components/rich-text/prevent-event-discovery.mjs +1 -1
- package/build-module/components/rich-text/prevent-event-discovery.mjs.map +1 -1
- package/build-module/components/use-block-commands/index.mjs +5 -5
- package/build-module/components/use-block-commands/index.mjs.map +2 -2
- package/build-module/components/writing-flow/use-tab-nav.mjs.map +1 -1
- package/build-module/hooks/anchor.mjs +12 -16
- package/build-module/hooks/anchor.mjs.map +2 -2
- package/build-module/hooks/background.mjs.map +1 -1
- package/build-module/hooks/block-fields/index.mjs +13 -2
- package/build-module/hooks/block-fields/index.mjs.map +2 -2
- package/build-module/hooks/border.mjs +1 -4
- package/build-module/hooks/border.mjs.map +2 -2
- package/build-module/hooks/color.mjs +2 -5
- package/build-module/hooks/color.mjs.map +2 -2
- package/build-module/hooks/dimensions.mjs +13 -6
- package/build-module/hooks/dimensions.mjs.map +2 -2
- package/build-module/hooks/fit-text.mjs +11 -0
- package/build-module/hooks/fit-text.mjs.map +2 -2
- package/build-module/hooks/layout-child.mjs +27 -2
- package/build-module/hooks/layout-child.mjs.map +2 -2
- package/build-module/hooks/list-view.mjs +10 -7
- package/build-module/hooks/list-view.mjs.map +2 -2
- package/build-module/hooks/position.mjs +20 -23
- package/build-module/hooks/position.mjs.map +2 -2
- package/build-module/hooks/spacing-visualizer.mjs.map +1 -1
- package/build-module/hooks/state-utils.mjs.map +1 -1
- package/build-module/hooks/style.mjs +44 -3
- package/build-module/hooks/style.mjs.map +2 -2
- package/build-module/hooks/supports.mjs +0 -7
- package/build-module/hooks/supports.mjs.map +2 -2
- package/build-module/private-apis.mjs +8 -0
- package/build-module/private-apis.mjs.map +2 -2
- package/build-module/store/actions.mjs +7 -3
- package/build-module/store/actions.mjs.map +2 -2
- package/build-module/store/private-actions.mjs +1 -2
- package/build-module/store/private-actions.mjs.map +2 -2
- package/build-module/store/private-selectors.mjs +39 -1
- package/build-module/store/private-selectors.mjs.map +2 -2
- package/build-module/store/reducer.mjs +14 -6
- package/build-module/store/reducer.mjs.map +2 -2
- package/build-module/store/selectors.mjs +62 -42
- package/build-module/store/selectors.mjs.map +2 -2
- package/build-module/utils/dom.mjs.map +1 -1
- package/build-module/utils/selection.mjs +1 -1
- package/build-style/content-rtl.css +12 -0
- package/build-style/content.css +12 -0
- package/build-style/style-rtl.css +26 -8
- package/build-style/style.css +26 -8
- package/package.json +54 -46
- package/src/components/block-breadcrumb/README.md +2 -2
- package/src/components/block-card/index.js +7 -13
- package/src/components/block-compare/README.md +6 -6
- package/src/components/block-compare/index.js +1 -3
- package/src/components/block-inspector/index.js +2 -10
- package/src/components/block-patterns-list/index.js +1 -2
- package/src/components/block-preview/README.md +1 -1
- package/src/components/block-quick-navigation/index.js +7 -7
- package/src/components/block-switcher/block-transformations-menu.js +16 -18
- package/src/components/block-switcher/index.js +4 -4
- package/src/components/block-tools/use-block-toolbar-popover-props.js +10 -4
- package/src/components/block-types-list/README.md +0 -19
- package/src/components/child-layout-control/index.js +65 -20
- package/src/components/child-layout-control/test/index.js +64 -0
- package/src/components/dimensions-tool/index.js +4 -9
- package/src/components/dimensions-tool/scale-tool.js +1 -2
- package/src/components/dimensions-tool/test/index.js +89 -11
- package/src/components/global-styles/advanced-panel.js +5 -1
- package/src/components/global-styles/background-panel.js +3 -3
- package/src/components/global-styles/border-panel.js +2 -0
- package/src/components/global-styles/dimensions-panel.js +13 -15
- package/src/components/global-styles/shadow-panel-components.js +0 -1
- package/src/components/iframe/index.js +8 -3
- package/src/components/inner-blocks/use-inner-block-template-sync.js +3 -1
- package/src/components/inserter/hooks/use-patterns-state.js +1 -1
- package/src/components/inserter/index.js +257 -288
- package/src/components/inserter/media-tab/media-preview.js +0 -1
- package/src/components/inserter/search-results.js +1 -3
- package/src/components/inspector-controls/fill.js +6 -8
- package/src/components/inspector-controls-tabs/index.js +0 -1
- package/src/components/inspector-controls-tabs/styles-tab.js +5 -1
- package/src/components/justify-content-control/README.md +1 -1
- package/src/components/list-view/block-select-button.js +9 -14
- package/src/components/list-view/block.js +1 -0
- package/src/components/media-placeholder/README.md +1 -29
- package/src/components/media-upload/README.md +0 -19
- package/src/components/preset-input-control/custom-value-controls.js +0 -1
- package/src/components/provider/test/use-block-sync.js +40 -0
- package/src/components/provider/use-block-sync.js +12 -2
- package/src/components/rich-text/event-listeners/before-input-rules.js +5 -4
- package/src/components/rich-text/event-listeners/delete.js +9 -4
- package/src/components/rich-text/event-listeners/enter.js +9 -2
- package/src/components/rich-text/event-listeners/input-events.js +13 -4
- package/src/components/rich-text/event-listeners/input-rules.js +20 -4
- package/src/components/rich-text/event-listeners/insert-replacement-text.js +9 -4
- package/src/components/rich-text/event-listeners/remove-browser-shortcuts.js +9 -4
- package/src/components/rich-text/event-listeners/shortcuts.js +13 -4
- package/src/components/rich-text/event-listeners/undo-automatic-change.js +5 -4
- package/src/components/rich-text/index.js +1 -33
- package/src/components/unit-control/README.md +1 -1
- package/src/components/url-popover/README.md +1 -1
- package/src/components/use-block-commands/index.js +5 -5
- package/src/hooks/anchor.js +9 -17
- package/src/hooks/block-fields/index.js +27 -2
- package/src/hooks/border.js +1 -5
- package/src/hooks/color.js +1 -6
- package/src/hooks/dimensions.js +15 -8
- package/src/hooks/fit-text.js +16 -0
- package/src/hooks/layout-child.js +41 -2
- package/src/hooks/list-view.js +10 -11
- package/src/hooks/position.js +23 -27
- package/src/hooks/style.js +80 -2
- package/src/hooks/supports.js +0 -9
- package/src/hooks/test/dimensions.js +71 -0
- package/src/hooks/test/layout-child.js +165 -0
- package/src/hooks/test/style.js +126 -4
- package/src/private-apis.js +8 -0
- package/src/store/actions.js +13 -3
- package/src/store/private-actions.js +1 -4
- package/src/store/private-selectors.js +89 -0
- package/src/store/reducer.js +19 -7
- package/src/store/selectors.js +91 -53
- package/src/store/test/actions.js +21 -0
- package/src/store/test/private-selectors.js +138 -0
- package/src/store/test/reducer.js +46 -0
- package/src/store/test/selectors.js +77 -0
- package/build/components/media-upload-progress/constants.cjs +0 -46
- package/build/components/media-upload-progress/constants.cjs.map +0 -7
- package/build/components/rich-text/native/format-edit.cjs +0 -60
- package/build/components/rich-text/native/format-edit.cjs.map +0 -7
- package/build/components/rich-text/native/index.cjs +0 -28
- package/build/components/rich-text/native/index.cjs.map +0 -7
- package/build/components/rich-text/native/use-format-types.cjs +0 -139
- package/build/components/rich-text/native/use-format-types.cjs.map +0 -7
- package/build-module/components/media-upload-progress/constants.mjs +0 -16
- package/build-module/components/media-upload-progress/constants.mjs.map +0 -7
- package/build-module/components/rich-text/native/format-edit.mjs +0 -39
- package/build-module/components/rich-text/native/format-edit.mjs.map +0 -7
- package/build-module/components/rich-text/native/index.mjs +0 -7
- package/build-module/components/rich-text/native/index.mjs.map +0 -7
- package/build-module/components/rich-text/native/use-format-types.mjs +0 -114
- package/build-module/components/rich-text/native/use-format-types.mjs.map +0 -7
- package/src/components/audio-player/audio-url-parser.native.js +0 -20
- package/src/components/audio-player/index.native.js +0 -225
- package/src/components/audio-player/styles.native.scss +0 -114
- package/src/components/audio-player/test/audio-url-parser.native.js +0 -53
- package/src/components/block-alignment-control/test/index.native.js +0 -37
- package/src/components/block-alignment-control/ui.native.js +0 -86
- package/src/components/block-caption/README.md +0 -104
- package/src/components/block-caption/index.native.js +0 -89
- package/src/components/block-caption/styles.native.scss +0 -7
- package/src/components/block-controls/slot.native.js +0 -33
- package/src/components/block-draggable/draggable-chip.native.js +0 -49
- package/src/components/block-draggable/dropping-insertion-point.native.js +0 -181
- package/src/components/block-draggable/dropping-insertion-point.native.scss +0 -8
- package/src/components/block-draggable/index.native.js +0 -467
- package/src/components/block-draggable/style.native.scss +0 -19
- package/src/components/block-draggable/test/__snapshots__/index.native.js.snap +0 -73
- package/src/components/block-draggable/test/helpers.native.js +0 -182
- package/src/components/block-draggable/test/index.native.js +0 -419
- package/src/components/block-draggable/use-scroll-when-dragging.native.js +0 -135
- package/src/components/block-edit/edit.native.js +0 -49
- package/src/components/block-edit/test/edit.native.js +0 -65
- package/src/components/block-heading-level-dropdown/index.native.js +0 -68
- package/src/components/block-icon/index.native.js +0 -47
- package/src/components/block-icon/style.native.scss +0 -7
- package/src/components/block-list/block-crash-boundary.native.js +0 -43
- package/src/components/block-list/block-crash-warning.native.js +0 -21
- package/src/components/block-list/block-invalid-warning.native.js +0 -70
- package/src/components/block-list/block-list-context.native.js +0 -172
- package/src/components/block-list/block-list-item-cell.native.js +0 -62
- package/src/components/block-list/block-list-item.native.js +0 -209
- package/src/components/block-list/block-list-item.native.scss +0 -16
- package/src/components/block-list/block-outline.native.js +0 -77
- package/src/components/block-list/block-selection-button.native.js +0 -100
- package/src/components/block-list/block-selection-button.native.scss +0 -34
- package/src/components/block-list/block.native.js +0 -716
- package/src/components/block-list/block.native.scss +0 -62
- package/src/components/block-list/grid-item.native.js +0 -58
- package/src/components/block-list/index.native.js +0 -437
- package/src/components/block-list/insertion-point.native.js +0 -36
- package/src/components/block-list/style.native.scss +0 -117
- package/src/components/block-list/test/block-invalid-warning.native.js +0 -62
- package/src/components/block-list/test/block-list-context.native.js +0 -243
- package/src/components/block-list/test/block-outline.native.js +0 -255
- package/src/components/block-list/test/fixtures/block-list-context.native.js +0 -79
- package/src/components/block-list/test/index.native.js +0 -205
- package/src/components/block-list/use-block-props/index.native.js +0 -10
- package/src/components/block-list/use-scroll-upon-insertion.native.js +0 -52
- package/src/components/block-list-appender/index.native.js +0 -70
- package/src/components/block-list-appender/style.native.scss +0 -8
- package/src/components/block-media-update-progress/README.md +0 -100
- package/src/components/block-media-update-progress/index.native.js +0 -299
- package/src/components/block-media-update-progress/styles.native.scss +0 -9
- package/src/components/block-media-update-progress/test/index.native.js +0 -543
- package/src/components/block-mover/index.native.js +0 -193
- package/src/components/block-mover/mover-description.native.js +0 -155
- package/src/components/block-mover/test/__snapshots__/index.native.js.snap +0 -218
- package/src/components/block-mover/test/index.native.js +0 -186
- package/src/components/block-settings/button.native.js +0 -41
- package/src/components/block-settings/container.native.js +0 -91
- package/src/components/block-settings/container.native.scss +0 -4
- package/src/components/block-settings/index.native.js +0 -5
- package/src/components/block-styles/index.native.js +0 -94
- package/src/components/block-styles/preview.native.js +0 -109
- package/src/components/block-styles/style.native.scss +0 -64
- package/src/components/block-switcher/block-transformations-menu.native.js +0 -91
- package/src/components/block-toolbar/block-toolbar-menu.native.js +0 -477
- package/src/components/block-toolbar/index.native.js +0 -126
- package/src/components/block-toolbar/test/__snapshots__/block-toolbar-menu.native.js.snap +0 -125
- package/src/components/block-toolbar/test/block-toolbar-menu.native.js +0 -405
- package/src/components/block-toolbar/test/index.native.js +0 -36
- package/src/components/block-types-list/index.native.js +0 -175
- package/src/components/block-types-list/style.native.scss +0 -25
- package/src/components/block-variation-picker/index.native.js +0 -107
- package/src/components/block-variation-picker/style.native.scss +0 -32
- package/src/components/button-block-appender/index.native.js +0 -92
- package/src/components/button-block-appender/styles.native.scss +0 -43
- package/src/components/caption/README.md +0 -44
- package/src/components/caption/index.native.js +0 -61
- package/src/components/colors-gradients/panel-color-gradient-settings.native.js +0 -59
- package/src/components/contrast-checker/index.native.js +0 -113
- package/src/components/contrast-checker/style.native.scss +0 -26
- package/src/components/convert-to-group-buttons/index.native.js +0 -79
- package/src/components/default-block-appender/index.native.js +0 -113
- package/src/components/default-block-appender/style.native.scss +0 -18
- package/src/components/floating-toolbar/floatingToolbar.android.scss +0 -4
- package/src/components/floating-toolbar/floatingToolbar.ios.scss +0 -3
- package/src/components/floating-toolbar/index.native.js +0 -141
- package/src/components/floating-toolbar/styles.native.scss +0 -43
- package/src/components/font-sizes/index.native.js +0 -7
- package/src/components/global-styles/color-panel.native.js +0 -207
- package/src/components/global-styles/test/use-global-styles-context.native.js +0 -435
- package/src/components/global-styles/use-global-styles-context.native.js +0 -592
- package/src/components/gradients/index.native.js +0 -2
- package/src/components/image-link-destinations/index.native.js +0 -152
- package/src/components/image-link-destinations/style.native.scss +0 -16
- package/src/components/index.native.js +0 -108
- package/src/components/inner-blocks/constants.native.js +0 -5
- package/src/components/inner-blocks/index.native.js +0 -221
- package/src/components/inner-blocks/warning-max-depth-exceeded.native.js +0 -124
- package/src/components/inserter/block-types-tab.native.js +0 -76
- package/src/components/inserter/hooks/use-block-type-impressions.native.js +0 -47
- package/src/components/inserter/hooks/use-clipboard-block.native.js +0 -40
- package/src/components/inserter/index.native.js +0 -424
- package/src/components/inserter/menu.native.js +0 -237
- package/src/components/inserter/no-results.native.js +0 -49
- package/src/components/inserter/reusable-blocks-tab.native.js +0 -45
- package/src/components/inserter/search-results.native.js +0 -67
- package/src/components/inserter/style.native.scss +0 -83
- package/src/components/inserter/tabs.native.js +0 -152
- package/src/components/inserter/test/__snapshots__/index.native.js.snap +0 -117
- package/src/components/inserter/test/fixtures/index.native.js +0 -12
- package/src/components/inserter/test/index.native.js +0 -273
- package/src/components/inserter/test/reusable-blocks-tab.native.js +0 -62
- package/src/components/inserter/test/utils.native.js +0 -37
- package/src/components/inserter/utils.native.js +0 -46
- package/src/components/inserter-button/index.native.js +0 -108
- package/src/components/inserter-button/style.native.scss +0 -72
- package/src/components/inspector-controls/fill.native.js +0 -62
- package/src/components/inspector-controls/slot.native.js +0 -35
- package/src/components/inspector-controls-tabs/advanced-controls-panel.native.js +0 -31
- package/src/components/line-height-control/index.native.js +0 -28
- package/src/components/media-placeholder/index.native.js +0 -258
- package/src/components/media-placeholder/styles.native.scss +0 -108
- package/src/components/media-replace-flow/index.native.js +0 -12
- package/src/components/media-upload/constants.native.js +0 -14
- package/src/components/media-upload/index.native.js +0 -356
- package/src/components/media-upload/style.native.scss +0 -4
- package/src/components/media-upload/test/index.native.js +0 -172
- package/src/components/media-upload-progress/README.md +0 -100
- package/src/components/media-upload-progress/constants.js +0 -6
- package/src/components/media-upload-progress/index.native.js +0 -233
- package/src/components/media-upload-progress/styles.native.scss +0 -15
- package/src/components/media-upload-progress/test/index.native.js +0 -220
- package/src/components/plain-text/index.native.js +0 -164
- package/src/components/plain-text/style.native.scss +0 -10
- package/src/components/provider/index.native.js +0 -32
- package/src/components/rich-text/embed-handler-picker.native.js +0 -65
- package/src/components/rich-text/file-paste-handler.native.js +0 -3
- package/src/components/rich-text/format-toolbar/index.native.js +0 -21
- package/src/components/rich-text/format-toolbar-container.native.js +0 -16
- package/src/components/rich-text/index.native.js +0 -701
- package/src/components/rich-text/input-event.native.js +0 -10
- package/src/components/rich-text/native/format-edit.js +0 -44
- package/src/components/rich-text/native/get-format-colors.native.js +0 -47
- package/src/components/rich-text/native/index.js +0 -1
- package/src/components/rich-text/native/index.native.js +0 -1389
- package/src/components/rich-text/native/style.native.scss +0 -28
- package/src/components/rich-text/native/test/__snapshots__/index.native.js.snap +0 -79
- package/src/components/rich-text/native/test/index.native.js +0 -345
- package/src/components/rich-text/native/test/performance/rich-text.native.js +0 -44
- package/src/components/rich-text/native/toolbar-button-with-options.native.js +0 -61
- package/src/components/rich-text/native/use-format-types.js +0 -146
- package/src/components/rich-text/remove-browser-shortcuts.native.js +0 -1
- package/src/components/rich-text/shortcut.native.js +0 -10
- package/src/components/ungroup-button/README.md +0 -23
- package/src/components/ungroup-button/index.native.js +0 -77
- package/src/components/unsupported-block-details/index.native.js +0 -187
- package/src/components/unsupported-block-details/style.native.scss +0 -56
- package/src/components/url-input/index.native.js +0 -33
- package/src/components/use-block-drop-zone/index.native.js +0 -207
- package/src/components/use-on-block-drop/index.native.js +0 -115
- package/src/components/use-unsupported-block-editor/index.native.js +0 -59
- package/src/components/video-player/gridicon-play.native.js +0 -13
- package/src/components/video-player/index.native.js +0 -133
- package/src/components/video-player/styles.native.scss +0 -29
- package/src/components/warning/index.native.js +0 -64
- package/src/components/warning/style.native.scss +0 -47
- package/src/hooks/align.native.js +0 -49
- package/src/hooks/custom-class-name.native.js +0 -70
- package/src/hooks/index.native.js +0 -36
- package/src/hooks/layout.native.js +0 -23
- package/src/hooks/test/__snapshots__/align.native.js.snap +0 -73
- package/src/hooks/test/__snapshots__/anchor.native.js.snap +0 -7
- package/src/hooks/test/align.native.js +0 -134
- package/src/hooks/test/anchor.native.js +0 -32
- package/src/hooks/test/use-editor-wrapper-styles.native.js +0 -282
- package/src/hooks/typography.native.js +0 -60
- package/src/hooks/use-editor-wrapper-styles.native.js +0 -250
- package/src/hooks/use-editor-wrapper-styles.native.scss +0 -12
- package/src/index.native.js +0 -6
- package/src/private-apis.native.js +0 -21
- package/src/store/defaults.native.js +0 -23
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/inner-blocks/use-inner-block-template-sync.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport fastDeepEqual from 'fast-deep-equal/es6/index.js';\n\n/**\n * WordPress dependencies\n */\nimport { useRef, useLayoutEffect } from '@wordpress/element';\nimport { useRegistry } from '@wordpress/data';\nimport { synchronizeBlocksWithTemplate } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\n/**\n * This hook makes sure that a block's inner blocks stay in sync with the given\n * block \"template\". The template is a block hierarchy to which inner blocks must\n * conform. If the blocks get \"out of sync\" with the template and the template\n * is meant to be locked (e.g. templateLock = \"all\" or templateLock = \"contentOnly\"),\n * then we replace the inner blocks with the correct value after synchronizing it with the template.\n *\n * @param {string} clientId The block client ID.\n * @param {Object} template The template to match.\n * @param {string} templateLock The template lock state for the inner blocks. For\n * example, if the template lock is set to \"all\",\n * then the inner blocks will stay in sync with the\n * template. If not defined or set to false, then\n * the inner blocks will not be synchronized with\n * the given template.\n * @param {boolean} templateInsertUpdatesSelection Whether or not to update the\n * block-editor selection state when inner blocks\n * are replaced after template synchronization.\n */\nexport default function useInnerBlockTemplateSync(\n\tclientId,\n\ttemplate,\n\ttemplateLock,\n\ttemplateInsertUpdatesSelection\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\tconst registry = useRegistry();\n\n\t// Maintain a reference to the previous value so we can do a deep equality check.\n\tconst existingTemplateRef = useRef( null );\n\n\tuseLayoutEffect( () => {\n\t\tlet isCancelled = false;\n\n\t\tconst {\n\t\t\tgetBlocks,\n\t\t\tgetSelectedBlocksInitialCaretPosition,\n\t\t\tisBlockSelected,\n\t\t} = registry.select( blockEditorStore );\n\t\tconst { replaceInnerBlocks, __unstableMarkNextChangeAsNotPersistent } =\n\t\t\tregistry.dispatch( blockEditorStore );\n\n\t\t// There's an implicit dependency between useInnerBlockTemplateSync and useNestedSettingsUpdate\n\t\t// The former needs to happen after the latter and since the latter is using microtasks to batch updates (performance optimization),\n\t\t// we need to schedule this one in a microtask as well.\n\t\t// Example: If you remove queueMicrotask here, ctrl + click to insert quote block won't close the inserter.\n\t\twindow.queueMicrotask( () => {\n\t\t\tif ( isCancelled ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Only synchronize innerBlocks with template if innerBlocks are empty\n\t\t\t// or a locking \"all\" or \"contentOnly\" exists directly on the block.\n\t\t\tconst currentInnerBlocks = getBlocks( clientId );\n\t\t\tconst shouldApplyTemplate =\n\t\t\t\tcurrentInnerBlocks.length === 0 ||\n\t\t\t\ttemplateLock === 'all' ||\n\t\t\t\ttemplateLock === 'contentOnly';\n\n\t\t\tconst hasTemplateChanged = ! fastDeepEqual(\n\t\t\t\ttemplate,\n\t\t\t\texistingTemplateRef.current\n\t\t\t);\n\n\t\t\tif ( ! shouldApplyTemplate || ! hasTemplateChanged ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\texistingTemplateRef.current = template;\n\t\t\tconst nextBlocks = synchronizeBlocksWithTemplate(\n\t\t\t\tcurrentInnerBlocks,\n\t\t\t\ttemplate\n\t\t\t);\n\n\t\t\tif ( ! fastDeepEqual( nextBlocks, currentInnerBlocks ) ) {\n\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\treplaceInnerBlocks(\n\t\t\t\t\tclientId,\n\t\t\t\t\tnextBlocks,\n\t\t\t\t\tcurrentInnerBlocks.length === 0 &&\n\t\t\t\t\t\ttemplateInsertUpdatesSelection &&\n\t\t\t\t\t\tnextBlocks.length !== 0 &&\n\t\t\t\t\t\tisBlockSelected( clientId ),\n\t\t\t\t\t// This ensures the \"initialPosition\" doesn't change when applying the template\n\t\t\t\t\t// If we're supposed to focus the block, we'll focus the first inner block\n\t\t\t\t\t// otherwise, we won't apply any auto-focus.\n\t\t\t\t\t// This ensures for instance that the focus stays in the inserter when inserting the \"buttons\" block.\n\t\t\t\t\tgetSelectedBlocksInitialCaretPosition()\n\t\t\t\t);\n\t\t\t}\n\t\t} );\n\n\t\treturn () => {\n\t\t\tisCancelled = true;\n\t\t};\n\t}, [\n\t\ttemplate,\n\t\ttemplateLock,\n\t\tclientId,\n\t\tregistry,\n\t\ttemplateInsertUpdatesSelection,\n\t] );\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,iBAA0B;AAK1B,qBAAwC;AACxC,kBAA4B;AAC5B,oBAA8C;AAK9C,mBAA0C;AAqB3B,SAAR,0BACN,UACA,UACA,cACA,gCACC;AAGD,QAAM,eAAW,yBAAY;AAG7B,QAAM,0BAAsB,uBAAQ,IAAK;AAEzC,sCAAiB,MAAM;AACtB,QAAI,cAAc;AAElB,UAAM;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,IACD,IAAI,SAAS,OAAQ,aAAAA,KAAiB;AACtC,UAAM,EAAE,oBAAoB,wCAAwC,IACnE,SAAS,SAAU,aAAAA,KAAiB;AAMrC,WAAO,eAAgB,MAAM;AAC5B,UAAK,aAAc;AAClB;AAAA,MACD;AAIA,YAAM,qBAAqB,UAAW,QAAS;AAC/C,YAAM,sBACL,mBAAmB,WAAW,KAC9B,iBAAiB,SACjB,iBAAiB;AAElB,YAAM,qBAAqB,KAAE,WAAAC;AAAA,QAC5B;AAAA,QACA,oBAAoB;AAAA,MACrB;AAEA,UAAK,CAAE,uBAAuB,CAAE,oBAAqB;AACpD;AAAA,MACD;AAEA,0BAAoB,UAAU;AAC9B,YAAM,iBAAa;AAAA,QAClB;AAAA,QACA;AAAA,MACD;AAEA,UAAK,KAAE,WAAAA,SAAe,YAAY,kBAAmB,GAAI;AACxD,
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport fastDeepEqual from 'fast-deep-equal/es6/index.js';\n\n/**\n * WordPress dependencies\n */\nimport { useRef, useLayoutEffect } from '@wordpress/element';\nimport { useRegistry } from '@wordpress/data';\nimport { synchronizeBlocksWithTemplate } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\n/**\n * This hook makes sure that a block's inner blocks stay in sync with the given\n * block \"template\". The template is a block hierarchy to which inner blocks must\n * conform. If the blocks get \"out of sync\" with the template and the template\n * is meant to be locked (e.g. templateLock = \"all\" or templateLock = \"contentOnly\"),\n * then we replace the inner blocks with the correct value after synchronizing it with the template.\n *\n * @param {string} clientId The block client ID.\n * @param {Object} template The template to match.\n * @param {string} templateLock The template lock state for the inner blocks. For\n * example, if the template lock is set to \"all\",\n * then the inner blocks will stay in sync with the\n * template. If not defined or set to false, then\n * the inner blocks will not be synchronized with\n * the given template.\n * @param {boolean} templateInsertUpdatesSelection Whether or not to update the\n * block-editor selection state when inner blocks\n * are replaced after template synchronization.\n */\nexport default function useInnerBlockTemplateSync(\n\tclientId,\n\ttemplate,\n\ttemplateLock,\n\ttemplateInsertUpdatesSelection\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\tconst registry = useRegistry();\n\n\t// Maintain a reference to the previous value so we can do a deep equality check.\n\tconst existingTemplateRef = useRef( null );\n\n\tuseLayoutEffect( () => {\n\t\tlet isCancelled = false;\n\n\t\tconst {\n\t\t\tgetBlocks,\n\t\t\tgetSelectedBlocksInitialCaretPosition,\n\t\t\tisBlockSelected,\n\t\t} = registry.select( blockEditorStore );\n\t\tconst { replaceInnerBlocks, __unstableMarkNextChangeAsNotPersistent } =\n\t\t\tregistry.dispatch( blockEditorStore );\n\n\t\t// There's an implicit dependency between useInnerBlockTemplateSync and useNestedSettingsUpdate\n\t\t// The former needs to happen after the latter and since the latter is using microtasks to batch updates (performance optimization),\n\t\t// we need to schedule this one in a microtask as well.\n\t\t// Example: If you remove queueMicrotask here, ctrl + click to insert quote block won't close the inserter.\n\t\twindow.queueMicrotask( () => {\n\t\t\tif ( isCancelled ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Only synchronize innerBlocks with template if innerBlocks are empty\n\t\t\t// or a locking \"all\" or \"contentOnly\" exists directly on the block.\n\t\t\tconst currentInnerBlocks = getBlocks( clientId );\n\t\t\tconst shouldApplyTemplate =\n\t\t\t\tcurrentInnerBlocks.length === 0 ||\n\t\t\t\ttemplateLock === 'all' ||\n\t\t\t\ttemplateLock === 'contentOnly';\n\n\t\t\tconst hasTemplateChanged = ! fastDeepEqual(\n\t\t\t\ttemplate,\n\t\t\t\texistingTemplateRef.current\n\t\t\t);\n\n\t\t\tif ( ! shouldApplyTemplate || ! hasTemplateChanged ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\texistingTemplateRef.current = template;\n\t\t\tconst nextBlocks = synchronizeBlocksWithTemplate(\n\t\t\t\tcurrentInnerBlocks,\n\t\t\t\ttemplate\n\t\t\t);\n\n\t\t\tif ( ! fastDeepEqual( nextBlocks, currentInnerBlocks ) ) {\n\t\t\t\t__unstableMarkNextChangeAsNotPersistent( {\n\t\t\t\t\thistory: 'ignore',\n\t\t\t\t} );\n\t\t\t\treplaceInnerBlocks(\n\t\t\t\t\tclientId,\n\t\t\t\t\tnextBlocks,\n\t\t\t\t\tcurrentInnerBlocks.length === 0 &&\n\t\t\t\t\t\ttemplateInsertUpdatesSelection &&\n\t\t\t\t\t\tnextBlocks.length !== 0 &&\n\t\t\t\t\t\tisBlockSelected( clientId ),\n\t\t\t\t\t// This ensures the \"initialPosition\" doesn't change when applying the template\n\t\t\t\t\t// If we're supposed to focus the block, we'll focus the first inner block\n\t\t\t\t\t// otherwise, we won't apply any auto-focus.\n\t\t\t\t\t// This ensures for instance that the focus stays in the inserter when inserting the \"buttons\" block.\n\t\t\t\t\tgetSelectedBlocksInitialCaretPosition()\n\t\t\t\t);\n\t\t\t}\n\t\t} );\n\n\t\treturn () => {\n\t\t\tisCancelled = true;\n\t\t};\n\t}, [\n\t\ttemplate,\n\t\ttemplateLock,\n\t\tclientId,\n\t\tregistry,\n\t\ttemplateInsertUpdatesSelection,\n\t] );\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,iBAA0B;AAK1B,qBAAwC;AACxC,kBAA4B;AAC5B,oBAA8C;AAK9C,mBAA0C;AAqB3B,SAAR,0BACN,UACA,UACA,cACA,gCACC;AAGD,QAAM,eAAW,yBAAY;AAG7B,QAAM,0BAAsB,uBAAQ,IAAK;AAEzC,sCAAiB,MAAM;AACtB,QAAI,cAAc;AAElB,UAAM;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,IACD,IAAI,SAAS,OAAQ,aAAAA,KAAiB;AACtC,UAAM,EAAE,oBAAoB,wCAAwC,IACnE,SAAS,SAAU,aAAAA,KAAiB;AAMrC,WAAO,eAAgB,MAAM;AAC5B,UAAK,aAAc;AAClB;AAAA,MACD;AAIA,YAAM,qBAAqB,UAAW,QAAS;AAC/C,YAAM,sBACL,mBAAmB,WAAW,KAC9B,iBAAiB,SACjB,iBAAiB;AAElB,YAAM,qBAAqB,KAAE,WAAAC;AAAA,QAC5B;AAAA,QACA,oBAAoB;AAAA,MACrB;AAEA,UAAK,CAAE,uBAAuB,CAAE,oBAAqB;AACpD;AAAA,MACD;AAEA,0BAAoB,UAAU;AAC9B,YAAM,iBAAa;AAAA,QAClB;AAAA,QACA;AAAA,MACD;AAEA,UAAK,KAAE,WAAAA,SAAe,YAAY,kBAAmB,GAAI;AACxD,gDAAyC;AAAA,UACxC,SAAS;AAAA,QACV,CAAE;AACF;AAAA,UACC;AAAA,UACA;AAAA,UACA,mBAAmB,WAAW,KAC7B,kCACA,WAAW,WAAW,KACtB,gBAAiB,QAAS;AAAA;AAAA;AAAA;AAAA;AAAA,UAK3B,sCAAsC;AAAA,QACvC;AAAA,MACD;AAAA,IACD,CAAE;AAEF,WAAO,MAAM;AACZ,oBAAc;AAAA,IACf;AAAA,EACD,GAAG;AAAA,IACF;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,CAAE;AACH;",
|
|
6
6
|
"names": ["blockEditorStore", "fastDeepEqual"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/inserter/get-appender-label.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * Returns the appender label for a default block if available.\n *\n * This function calls the block's __experimentalLabel function with the 'appender'\n * context to get a custom label for the inserter button. The block should return\n * the full display label (e.g., \"Add page\")
|
|
4
|
+
"sourcesContent": ["/**\n * Returns the appender label for a default block if available.\n *\n * This function calls the block's __experimentalLabel function with the 'appender'\n * context to get a custom label for the inserter button. The block should return\n * the full display label (e.g., \"Add page\") — consistent with how __experimentalLabel\n * works in other contexts like 'list-view'. The inserter uses the result directly\n * without reformatting.\n *\n * @param {Object} defaultBlock The default block configuration with name and attributes.\n * @param {Object} defaultBlockType The block type object containing __experimentalLabel.\n * @return {string|null} The full appender label, or null if not available.\n */\nconst MAX_APPENDER_LABEL_LENGTH = 50;\n\nexport function getAppenderLabel( defaultBlock, defaultBlockType ) {\n\tif (\n\t\t! defaultBlock ||\n\t\t! defaultBlock.attributes ||\n\t\t! defaultBlockType?.__experimentalLabel\n\t) {\n\t\treturn null;\n\t}\n\n\tconst result = defaultBlockType.__experimentalLabel(\n\t\tdefaultBlock.attributes,\n\t\t{ context: 'appender' }\n\t);\n\n\t// Only use if it's a string and not too long (safety check)\n\tif (\n\t\ttypeof result === 'string' &&\n\t\tresult.length < MAX_APPENDER_LABEL_LENGTH &&\n\t\tresult.length > 0\n\t) {\n\t\treturn result;\n\t}\n\n\treturn null;\n}\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAaA,IAAM,4BAA4B;AAE3B,SAAS,iBAAkB,cAAc,kBAAmB;AAClE,MACC,CAAE,gBACF,CAAE,aAAa,cACf,CAAE,kBAAkB,qBACnB;AACD,WAAO;AAAA,EACR;AAEA,QAAM,SAAS,iBAAiB;AAAA,IAC/B,aAAa;AAAA,IACb,EAAE,SAAS,WAAW;AAAA,EACvB;AAGA,MACC,OAAO,WAAW,YAClB,OAAO,SAAS,6BAChB,OAAO,SAAS,GACf;AACD,WAAO;AAAA,EACR;AAEA,SAAO;AACR;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -114,7 +114,7 @@ var usePatternsState = (onInsert, rootClientId, selectedCategory, isQuick) => {
|
|
|
114
114
|
createSuccessNotice(
|
|
115
115
|
(0, import_i18n.sprintf)(
|
|
116
116
|
/* translators: %s: block pattern title. */
|
|
117
|
-
(0, import_i18n.__)('
|
|
117
|
+
(0, import_i18n.__)('Pattern "%s" inserted.'),
|
|
118
118
|
pattern.title
|
|
119
119
|
),
|
|
120
120
|
{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/components/inserter/hooks/use-patterns-state.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useCallback, useMemo } from '@wordpress/element';\nimport { cloneBlock, createBlock } from '@wordpress/blocks';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../../store';\nimport { unlock } from '../../../lock-unlock';\nimport {\n\tisNavigationOverlayContextKey,\n\tuserPatternCategoriesSelectKey,\n} from '../../../store/private-keys';\nimport { INSERTER_PATTERN_TYPES } from '../block-patterns-tab/utils';\nimport { isFiltered } from '../../../store/utils';\n\n/**\n * Retrieves the block patterns inserter state.\n *\n * @param {Function} onInsert function called when inserter a list of blocks.\n * @param {string=} rootClientId Insertion's root client ID.\n * @param {string} selectedCategory The selected pattern category.\n * @param {boolean} isQuick For the quick inserter render only allowed patterns.\n *\n * @return {Array} Returns the patterns state. (patterns, categories, onSelect handler)\n */\nconst usePatternsState = (\n\tonInsert,\n\trootClientId,\n\tselectedCategory,\n\tisQuick\n) => {\n\tconst options = useMemo(\n\t\t() => ( { [ isFiltered ]: !! isQuick } ),\n\t\t[ isQuick ]\n\t);\n\n\t// Check if we're editing a navigation-overlay template part.\n\t// This information is passed through block editor settings to avoid\n\t// cross-package dependencies.\n\tconst isWithinNavigationOverlayContext = useSelect( ( select ) => {\n\t\tconst { getSettings } = unlock( select( blockEditorStore ) );\n\t\tconst settings = getSettings();\n\t\treturn settings[ isNavigationOverlayContextKey ] ?? false;\n\t}, [] );\n\n\tconst { patternCategories, patterns, userPatternCategories } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getSettings, __experimentalGetAllowedPatterns } = unlock(\n\t\t\t\tselect( blockEditorStore )\n\t\t\t);\n\t\t\tconst settings = getSettings();\n\t\t\tconst userPatternCategoriesSelect =\n\t\t\t\tsettings[ userPatternCategoriesSelectKey ];\n\t\t\treturn {\n\t\t\t\tpatterns: __experimentalGetAllowedPatterns(\n\t\t\t\t\trootClientId,\n\t\t\t\t\toptions\n\t\t\t\t),\n\t\t\t\tuserPatternCategories: userPatternCategoriesSelect\n\t\t\t\t\t? userPatternCategoriesSelect( select )\n\t\t\t\t\t: settings.__experimentalUserPatternCategories,\n\t\t\t\tpatternCategories:\n\t\t\t\t\tsettings.__experimentalBlockPatternCategories,\n\t\t\t};\n\t\t},\n\t\t[ rootClientId, options ]\n\t);\n\n\t// Filter out patterns with \"navigation\" category unless we're in\n\t// navigation-overlay template part context.\n\t// TO DO: create an api for patterns to decide in which context they should be shown.\n\tconst filteredPatterns = useMemo( () => {\n\t\treturn patterns.filter( ( pattern ) => {\n\t\t\tconst hasNavigationCategory =\n\t\t\t\tpattern.categories?.includes( 'navigation' );\n\t\t\tif ( hasNavigationCategory && ! isWithinNavigationOverlayContext ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn true;\n\t\t} );\n\t}, [ patterns, isWithinNavigationOverlayContext ] );\n\tconst { getClosestAllowedInsertionPointForPattern } = unlock(\n\t\tuseSelect( blockEditorStore )\n\t);\n\n\tconst allCategories = useMemo( () => {\n\t\tconst categories = [ ...patternCategories ];\n\t\tuserPatternCategories?.forEach( ( userCategory ) => {\n\t\t\tif (\n\t\t\t\t! categories.find(\n\t\t\t\t\t( existingCategory ) =>\n\t\t\t\t\t\texistingCategory.name === userCategory.name\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\tcategories.push( userCategory );\n\t\t\t}\n\t\t} );\n\t\treturn categories;\n\t}, [ patternCategories, userPatternCategories ] );\n\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\tconst onClickPattern = useCallback(\n\t\t( pattern, blocks ) => {\n\t\t\tconst destinationRootClientId = isQuick\n\t\t\t\t? rootClientId\n\t\t\t\t: getClosestAllowedInsertionPointForPattern(\n\t\t\t\t\t\tpattern,\n\t\t\t\t\t\trootClientId\n\t\t\t\t );\n\t\t\tif ( destinationRootClientId === null ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst patternBlocks =\n\t\t\t\tpattern.type === INSERTER_PATTERN_TYPES.user &&\n\t\t\t\tpattern.syncStatus !== 'unsynced'\n\t\t\t\t\t? [ createBlock( 'core/block', { ref: pattern.id } ) ]\n\t\t\t\t\t: blocks;\n\t\t\tonInsert(\n\t\t\t\t( patternBlocks ?? [] ).map( ( block ) => {\n\t\t\t\t\tconst clonedBlock = cloneBlock( block );\n\t\t\t\t\tif (\n\t\t\t\t\t\tclonedBlock.attributes.metadata?.categories?.includes(\n\t\t\t\t\t\t\tselectedCategory\n\t\t\t\t\t\t)\n\t\t\t\t\t) {\n\t\t\t\t\t\tclonedBlock.attributes.metadata.categories = [\n\t\t\t\t\t\t\tselectedCategory,\n\t\t\t\t\t\t];\n\t\t\t\t\t}\n\t\t\t\t\treturn clonedBlock;\n\t\t\t\t} ),\n\t\t\t\tpattern.name,\n\t\t\t\tfalse,\n\t\t\t\tdestinationRootClientId\n\t\t\t);\n\t\t\tcreateSuccessNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t/* translators: %s: block pattern title. */\n\t\t\t\t\t__( '
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAAqC;AACrC,oBAAwC;AACxC,kBAAuC;AACvC,kBAA4B;AAC5B,qBAAsC;AAKtC,mBAA0C;AAC1C,yBAAuB;AACvB,0BAGO;AACP,mBAAuC;AACvC,IAAAA,gBAA2B;AAY3B,IAAM,mBAAmB,CACxB,UACA,cACA,kBACA,YACI;AACJ,QAAM,cAAU;AAAA,IACf,OAAQ,EAAE,CAAE,wBAAW,GAAG,CAAC,CAAE,QAAQ;AAAA,IACrC,CAAE,OAAQ;AAAA,EACX;AAKA,QAAM,uCAAmC,uBAAW,CAAE,WAAY;AACjE,UAAM,EAAE,YAAY,QAAI,2BAAQ,OAAQ,aAAAC,KAAiB,CAAE;AAC3D,UAAM,WAAW,YAAY;AAC7B,WAAO,SAAU,iDAA8B,KAAK;AAAA,EACrD,GAAG,CAAC,CAAE;AAEN,QAAM,EAAE,mBAAmB,UAAU,sBAAsB,QAAI;AAAA,IAC9D,CAAE,WAAY;AACb,YAAM,EAAE,aAAa,iCAAiC,QAAI;AAAA,QACzD,OAAQ,aAAAA,KAAiB;AAAA,MAC1B;AACA,YAAM,WAAW,YAAY;AAC7B,YAAM,8BACL,SAAU,kDAA+B;AAC1C,aAAO;AAAA,QACN,UAAU;AAAA,UACT;AAAA,UACA;AAAA,QACD;AAAA,QACA,uBAAuB,8BACpB,4BAA6B,MAAO,IACpC,SAAS;AAAA,QACZ,mBACC,SAAS;AAAA,MACX;AAAA,IACD;AAAA,IACA,CAAE,cAAc,OAAQ;AAAA,EACzB;AAKA,QAAM,uBAAmB,wBAAS,MAAM;AACvC,WAAO,SAAS,OAAQ,CAAE,YAAa;AACtC,YAAM,wBACL,QAAQ,YAAY,SAAU,YAAa;AAC5C,UAAK,yBAAyB,CAAE,kCAAmC;AAClE,eAAO;AAAA,MACR;AACA,aAAO;AAAA,IACR,CAAE;AAAA,EACH,GAAG,CAAE,UAAU,gCAAiC,CAAE;AAClD,QAAM,EAAE,0CAA0C,QAAI;AAAA,QACrD,uBAAW,aAAAA,KAAiB;AAAA,EAC7B;AAEA,QAAM,oBAAgB,wBAAS,MAAM;AACpC,UAAM,aAAa,CAAE,GAAG,iBAAkB;AAC1C,2BAAuB,QAAS,CAAE,iBAAkB;AACnD,UACC,CAAE,WAAW;AAAA,QACZ,CAAE,qBACD,iBAAiB,SAAS,aAAa;AAAA,MACzC,GACC;AACD,mBAAW,KAAM,YAAa;AAAA,MAC/B;AAAA,IACD,CAAE;AACF,WAAO;AAAA,EACR,GAAG,CAAE,mBAAmB,qBAAsB,CAAE;AAEhD,QAAM,EAAE,oBAAoB,QAAI,yBAAa,eAAAC,KAAa;AAC1D,QAAM,qBAAiB;AAAA,IACtB,CAAE,SAAS,WAAY;AACtB,YAAM,0BAA0B,UAC7B,eACA;AAAA,QACA;AAAA,QACA;AAAA,MACA;AACH,UAAK,4BAA4B,MAAO;AACvC;AAAA,MACD;AACA,YAAM,gBACL,QAAQ,SAAS,oCAAuB,QACxC,QAAQ,eAAe,aACpB,KAAE,2BAAa,cAAc,EAAE,KAAK,QAAQ,GAAG,CAAE,CAAE,IACnD;AACJ;AAAA,SACG,iBAAiB,CAAC,GAAI,IAAK,CAAE,UAAW;AACzC,gBAAM,kBAAc,0BAAY,KAAM;AACtC,cACC,YAAY,WAAW,UAAU,YAAY;AAAA,YAC5C;AAAA,UACD,GACC;AACD,wBAAY,WAAW,SAAS,aAAa;AAAA,cAC5C;AAAA,YACD;AAAA,UACD;AACA,iBAAO;AAAA,QACR,CAAE;AAAA,QACF,QAAQ;AAAA,QACR;AAAA,QACA;AAAA,MACD;AACA;AAAA,YACC;AAAA;AAAA,cAEC,gBAAI,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useCallback, useMemo } from '@wordpress/element';\nimport { cloneBlock, createBlock } from '@wordpress/blocks';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../../store';\nimport { unlock } from '../../../lock-unlock';\nimport {\n\tisNavigationOverlayContextKey,\n\tuserPatternCategoriesSelectKey,\n} from '../../../store/private-keys';\nimport { INSERTER_PATTERN_TYPES } from '../block-patterns-tab/utils';\nimport { isFiltered } from '../../../store/utils';\n\n/**\n * Retrieves the block patterns inserter state.\n *\n * @param {Function} onInsert function called when inserter a list of blocks.\n * @param {string=} rootClientId Insertion's root client ID.\n * @param {string} selectedCategory The selected pattern category.\n * @param {boolean} isQuick For the quick inserter render only allowed patterns.\n *\n * @return {Array} Returns the patterns state. (patterns, categories, onSelect handler)\n */\nconst usePatternsState = (\n\tonInsert,\n\trootClientId,\n\tselectedCategory,\n\tisQuick\n) => {\n\tconst options = useMemo(\n\t\t() => ( { [ isFiltered ]: !! isQuick } ),\n\t\t[ isQuick ]\n\t);\n\n\t// Check if we're editing a navigation-overlay template part.\n\t// This information is passed through block editor settings to avoid\n\t// cross-package dependencies.\n\tconst isWithinNavigationOverlayContext = useSelect( ( select ) => {\n\t\tconst { getSettings } = unlock( select( blockEditorStore ) );\n\t\tconst settings = getSettings();\n\t\treturn settings[ isNavigationOverlayContextKey ] ?? false;\n\t}, [] );\n\n\tconst { patternCategories, patterns, userPatternCategories } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getSettings, __experimentalGetAllowedPatterns } = unlock(\n\t\t\t\tselect( blockEditorStore )\n\t\t\t);\n\t\t\tconst settings = getSettings();\n\t\t\tconst userPatternCategoriesSelect =\n\t\t\t\tsettings[ userPatternCategoriesSelectKey ];\n\t\t\treturn {\n\t\t\t\tpatterns: __experimentalGetAllowedPatterns(\n\t\t\t\t\trootClientId,\n\t\t\t\t\toptions\n\t\t\t\t),\n\t\t\t\tuserPatternCategories: userPatternCategoriesSelect\n\t\t\t\t\t? userPatternCategoriesSelect( select )\n\t\t\t\t\t: settings.__experimentalUserPatternCategories,\n\t\t\t\tpatternCategories:\n\t\t\t\t\tsettings.__experimentalBlockPatternCategories,\n\t\t\t};\n\t\t},\n\t\t[ rootClientId, options ]\n\t);\n\n\t// Filter out patterns with \"navigation\" category unless we're in\n\t// navigation-overlay template part context.\n\t// TO DO: create an api for patterns to decide in which context they should be shown.\n\tconst filteredPatterns = useMemo( () => {\n\t\treturn patterns.filter( ( pattern ) => {\n\t\t\tconst hasNavigationCategory =\n\t\t\t\tpattern.categories?.includes( 'navigation' );\n\t\t\tif ( hasNavigationCategory && ! isWithinNavigationOverlayContext ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn true;\n\t\t} );\n\t}, [ patterns, isWithinNavigationOverlayContext ] );\n\tconst { getClosestAllowedInsertionPointForPattern } = unlock(\n\t\tuseSelect( blockEditorStore )\n\t);\n\n\tconst allCategories = useMemo( () => {\n\t\tconst categories = [ ...patternCategories ];\n\t\tuserPatternCategories?.forEach( ( userCategory ) => {\n\t\t\tif (\n\t\t\t\t! categories.find(\n\t\t\t\t\t( existingCategory ) =>\n\t\t\t\t\t\texistingCategory.name === userCategory.name\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\tcategories.push( userCategory );\n\t\t\t}\n\t\t} );\n\t\treturn categories;\n\t}, [ patternCategories, userPatternCategories ] );\n\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\tconst onClickPattern = useCallback(\n\t\t( pattern, blocks ) => {\n\t\t\tconst destinationRootClientId = isQuick\n\t\t\t\t? rootClientId\n\t\t\t\t: getClosestAllowedInsertionPointForPattern(\n\t\t\t\t\t\tpattern,\n\t\t\t\t\t\trootClientId\n\t\t\t\t );\n\t\t\tif ( destinationRootClientId === null ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst patternBlocks =\n\t\t\t\tpattern.type === INSERTER_PATTERN_TYPES.user &&\n\t\t\t\tpattern.syncStatus !== 'unsynced'\n\t\t\t\t\t? [ createBlock( 'core/block', { ref: pattern.id } ) ]\n\t\t\t\t\t: blocks;\n\t\t\tonInsert(\n\t\t\t\t( patternBlocks ?? [] ).map( ( block ) => {\n\t\t\t\t\tconst clonedBlock = cloneBlock( block );\n\t\t\t\t\tif (\n\t\t\t\t\t\tclonedBlock.attributes.metadata?.categories?.includes(\n\t\t\t\t\t\t\tselectedCategory\n\t\t\t\t\t\t)\n\t\t\t\t\t) {\n\t\t\t\t\t\tclonedBlock.attributes.metadata.categories = [\n\t\t\t\t\t\t\tselectedCategory,\n\t\t\t\t\t\t];\n\t\t\t\t\t}\n\t\t\t\t\treturn clonedBlock;\n\t\t\t\t} ),\n\t\t\t\tpattern.name,\n\t\t\t\tfalse,\n\t\t\t\tdestinationRootClientId\n\t\t\t);\n\t\t\tcreateSuccessNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t/* translators: %s: block pattern title. */\n\t\t\t\t\t__( 'Pattern \"%s\" inserted.' ),\n\t\t\t\t\tpattern.title\n\t\t\t\t),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tid: 'inserter-notice',\n\t\t\t\t}\n\t\t\t);\n\t\t},\n\t\t[\n\t\t\tcreateSuccessNotice,\n\t\t\tonInsert,\n\t\t\tselectedCategory,\n\t\t\trootClientId,\n\t\t\tgetClosestAllowedInsertionPointForPattern,\n\t\t\tisQuick,\n\t\t]\n\t);\n\n\treturn [ filteredPatterns, allCategories, onClickPattern ];\n};\n\nexport default usePatternsState;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAAqC;AACrC,oBAAwC;AACxC,kBAAuC;AACvC,kBAA4B;AAC5B,qBAAsC;AAKtC,mBAA0C;AAC1C,yBAAuB;AACvB,0BAGO;AACP,mBAAuC;AACvC,IAAAA,gBAA2B;AAY3B,IAAM,mBAAmB,CACxB,UACA,cACA,kBACA,YACI;AACJ,QAAM,cAAU;AAAA,IACf,OAAQ,EAAE,CAAE,wBAAW,GAAG,CAAC,CAAE,QAAQ;AAAA,IACrC,CAAE,OAAQ;AAAA,EACX;AAKA,QAAM,uCAAmC,uBAAW,CAAE,WAAY;AACjE,UAAM,EAAE,YAAY,QAAI,2BAAQ,OAAQ,aAAAC,KAAiB,CAAE;AAC3D,UAAM,WAAW,YAAY;AAC7B,WAAO,SAAU,iDAA8B,KAAK;AAAA,EACrD,GAAG,CAAC,CAAE;AAEN,QAAM,EAAE,mBAAmB,UAAU,sBAAsB,QAAI;AAAA,IAC9D,CAAE,WAAY;AACb,YAAM,EAAE,aAAa,iCAAiC,QAAI;AAAA,QACzD,OAAQ,aAAAA,KAAiB;AAAA,MAC1B;AACA,YAAM,WAAW,YAAY;AAC7B,YAAM,8BACL,SAAU,kDAA+B;AAC1C,aAAO;AAAA,QACN,UAAU;AAAA,UACT;AAAA,UACA;AAAA,QACD;AAAA,QACA,uBAAuB,8BACpB,4BAA6B,MAAO,IACpC,SAAS;AAAA,QACZ,mBACC,SAAS;AAAA,MACX;AAAA,IACD;AAAA,IACA,CAAE,cAAc,OAAQ;AAAA,EACzB;AAKA,QAAM,uBAAmB,wBAAS,MAAM;AACvC,WAAO,SAAS,OAAQ,CAAE,YAAa;AACtC,YAAM,wBACL,QAAQ,YAAY,SAAU,YAAa;AAC5C,UAAK,yBAAyB,CAAE,kCAAmC;AAClE,eAAO;AAAA,MACR;AACA,aAAO;AAAA,IACR,CAAE;AAAA,EACH,GAAG,CAAE,UAAU,gCAAiC,CAAE;AAClD,QAAM,EAAE,0CAA0C,QAAI;AAAA,QACrD,uBAAW,aAAAA,KAAiB;AAAA,EAC7B;AAEA,QAAM,oBAAgB,wBAAS,MAAM;AACpC,UAAM,aAAa,CAAE,GAAG,iBAAkB;AAC1C,2BAAuB,QAAS,CAAE,iBAAkB;AACnD,UACC,CAAE,WAAW;AAAA,QACZ,CAAE,qBACD,iBAAiB,SAAS,aAAa;AAAA,MACzC,GACC;AACD,mBAAW,KAAM,YAAa;AAAA,MAC/B;AAAA,IACD,CAAE;AACF,WAAO;AAAA,EACR,GAAG,CAAE,mBAAmB,qBAAsB,CAAE;AAEhD,QAAM,EAAE,oBAAoB,QAAI,yBAAa,eAAAC,KAAa;AAC1D,QAAM,qBAAiB;AAAA,IACtB,CAAE,SAAS,WAAY;AACtB,YAAM,0BAA0B,UAC7B,eACA;AAAA,QACA;AAAA,QACA;AAAA,MACA;AACH,UAAK,4BAA4B,MAAO;AACvC;AAAA,MACD;AACA,YAAM,gBACL,QAAQ,SAAS,oCAAuB,QACxC,QAAQ,eAAe,aACpB,KAAE,2BAAa,cAAc,EAAE,KAAK,QAAQ,GAAG,CAAE,CAAE,IACnD;AACJ;AAAA,SACG,iBAAiB,CAAC,GAAI,IAAK,CAAE,UAAW;AACzC,gBAAM,kBAAc,0BAAY,KAAM;AACtC,cACC,YAAY,WAAW,UAAU,YAAY;AAAA,YAC5C;AAAA,UACD,GACC;AACD,wBAAY,WAAW,SAAS,aAAa;AAAA,cAC5C;AAAA,YACD;AAAA,UACD;AACA,iBAAO;AAAA,QACR,CAAE;AAAA,QACF,QAAQ;AAAA,QACR;AAAA,QACA;AAAA,MACD;AACA;AAAA,YACC;AAAA;AAAA,cAEC,gBAAI,wBAAyB;AAAA,UAC7B,QAAQ;AAAA,QACT;AAAA,QACA;AAAA,UACC,MAAM;AAAA,UACN,IAAI;AAAA,QACL;AAAA,MACD;AAAA,IACD;AAAA,IACA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACD;AAAA,EACD;AAEA,SAAO,CAAE,kBAAkB,eAAe,cAAe;AAC1D;AAEA,IAAO,6BAAQ;",
|
|
6
6
|
"names": ["import_utils", "blockEditorStore", "noticesStore"]
|
|
7
7
|
}
|
|
@@ -37,17 +37,16 @@ var import_clsx = __toESM(require("clsx"));
|
|
|
37
37
|
var import_a11y = require("@wordpress/a11y");
|
|
38
38
|
var import_i18n = require("@wordpress/i18n");
|
|
39
39
|
var import_components = require("@wordpress/components");
|
|
40
|
-
var import_element = require("@wordpress/element");
|
|
41
40
|
var import_data = require("@wordpress/data");
|
|
42
|
-
var import_compose = require("@wordpress/compose");
|
|
43
41
|
var import_blocks = require("@wordpress/blocks");
|
|
42
|
+
var import_element = require("@wordpress/element");
|
|
44
43
|
var import_icons = require("@wordpress/icons");
|
|
45
44
|
var import_menu = __toESM(require("./menu.cjs"));
|
|
46
45
|
var import_quick_inserter = __toESM(require("./quick-inserter.cjs"));
|
|
47
46
|
var import_store = require("../../store/index.cjs");
|
|
48
47
|
var import_get_appender_label = require("./get-appender-label.cjs");
|
|
49
48
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
50
|
-
var
|
|
49
|
+
var UnforwardedInserterToggle = ({
|
|
51
50
|
onToggle,
|
|
52
51
|
disabled,
|
|
53
52
|
isOpen,
|
|
@@ -55,7 +54,7 @@ var defaultRenderToggle = ({
|
|
|
55
54
|
hasSingleBlockType,
|
|
56
55
|
appenderLabel,
|
|
57
56
|
toggleProps = {}
|
|
58
|
-
}) => {
|
|
57
|
+
}, ref) => {
|
|
59
58
|
const {
|
|
60
59
|
as: Wrapper = import_components.Button,
|
|
61
60
|
label: labelProp,
|
|
@@ -85,6 +84,7 @@ var defaultRenderToggle = ({
|
|
|
85
84
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
86
85
|
Wrapper,
|
|
87
86
|
{
|
|
87
|
+
ref,
|
|
88
88
|
__next40pxDefaultSize: toggleProps.as ? void 0 : true,
|
|
89
89
|
icon: import_icons.plus,
|
|
90
90
|
label,
|
|
@@ -99,70 +99,169 @@ var defaultRenderToggle = ({
|
|
|
99
99
|
}
|
|
100
100
|
);
|
|
101
101
|
};
|
|
102
|
-
var
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
102
|
+
var InserterToggle = (0, import_element.forwardRef)(UnforwardedInserterToggle);
|
|
103
|
+
var UnforwardedInserter = ({
|
|
104
|
+
clientId,
|
|
105
|
+
rootClientId,
|
|
106
|
+
disabled,
|
|
107
|
+
isAppender,
|
|
108
|
+
position,
|
|
109
|
+
selectBlockOnInsert,
|
|
110
|
+
shouldDirectInsert = true,
|
|
111
|
+
showInserterHelpPanel,
|
|
112
|
+
// This prop is experimental to give some time for the quick inserter to mature
|
|
113
|
+
// Feel free to make them stable after a few releases.
|
|
114
|
+
__experimentalIsQuick: isQuick,
|
|
115
|
+
onSelectOrClose,
|
|
116
|
+
onToggle,
|
|
117
|
+
renderToggle: renderToggleProp,
|
|
118
|
+
toggleProps
|
|
119
|
+
}, ref) => {
|
|
120
|
+
const {
|
|
121
|
+
hasItems,
|
|
122
|
+
hasSingleBlockType,
|
|
123
|
+
blockTitle,
|
|
124
|
+
allowedBlockType,
|
|
125
|
+
blockToInsert,
|
|
126
|
+
appenderLabel,
|
|
127
|
+
targetRootClientId
|
|
128
|
+
} = (0, import_data.useSelect)(
|
|
129
|
+
(select) => {
|
|
130
|
+
const {
|
|
131
|
+
getBlockRootClientId: getBlockRootClientId2,
|
|
132
|
+
hasInserterItems,
|
|
133
|
+
getAllowedBlocks,
|
|
134
|
+
getDirectInsertBlock,
|
|
135
|
+
getBlockListSettings
|
|
136
|
+
} = select(import_store.store);
|
|
137
|
+
const { getBlockVariations, getBlockType: getBlockType2 } = select(import_blocks.store);
|
|
138
|
+
const _targetRootClientId = rootClientId || getBlockRootClientId2(clientId) || void 0;
|
|
139
|
+
const allowedBlocks = getAllowedBlocks(_targetRootClientId);
|
|
140
|
+
const directInsertBlock = shouldDirectInsert && getDirectInsertBlock(_targetRootClientId);
|
|
141
|
+
const { defaultBlock } = getBlockListSettings(_targetRootClientId) ?? {};
|
|
142
|
+
const _hasSingleBlockType = allowedBlocks?.length === 1 && getBlockVariations(allowedBlocks[0].name, "inserter")?.length === 0;
|
|
143
|
+
const _allowedBlockType = _hasSingleBlockType ? allowedBlocks[0] : null;
|
|
144
|
+
let _blockToInsert = directInsertBlock || null;
|
|
145
|
+
if (!_blockToInsert && _hasSingleBlockType && defaultBlock?.name === _allowedBlockType.name) {
|
|
146
|
+
_blockToInsert = defaultBlock;
|
|
147
|
+
}
|
|
148
|
+
const defaultBlockType = directInsertBlock ? getBlockType2(directInsertBlock.name) : null;
|
|
149
|
+
return {
|
|
150
|
+
hasItems: hasInserterItems(_targetRootClientId),
|
|
151
|
+
hasSingleBlockType: _hasSingleBlockType,
|
|
152
|
+
blockTitle: _allowedBlockType ? _allowedBlockType.title : "",
|
|
153
|
+
allowedBlockType: _allowedBlockType,
|
|
154
|
+
blockToInsert: _blockToInsert,
|
|
155
|
+
appenderLabel: (0, import_get_appender_label.getAppenderLabel)(
|
|
156
|
+
directInsertBlock,
|
|
157
|
+
defaultBlockType
|
|
158
|
+
),
|
|
159
|
+
targetRootClientId: _targetRootClientId
|
|
160
|
+
};
|
|
161
|
+
},
|
|
162
|
+
[rootClientId, clientId, shouldDirectInsert]
|
|
163
|
+
);
|
|
164
|
+
const { insertBlock } = (0, import_data.useDispatch)(import_store.store);
|
|
165
|
+
const {
|
|
166
|
+
getBlock,
|
|
167
|
+
getBlockIndex,
|
|
168
|
+
getBlockOrder,
|
|
169
|
+
getBlockRootClientId,
|
|
170
|
+
getBlockSelectionEnd,
|
|
171
|
+
getPreviousBlockClientId
|
|
172
|
+
} = (0, import_data.useSelect)(import_store.store);
|
|
173
|
+
const { getActiveBlockVariation, getBlockType } = (0, import_data.useSelect)(import_blocks.store);
|
|
174
|
+
if (!hasItems && (isAppender || targetRootClientId || clientId)) {
|
|
175
|
+
return null;
|
|
108
176
|
}
|
|
109
|
-
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
-
|
|
177
|
+
function insertOnlyAllowedBlock() {
|
|
178
|
+
const blockName = blockToInsert?.name ?? allowedBlockType.name;
|
|
179
|
+
function getAdjacentBlockAttributes(attributesToCopy) {
|
|
180
|
+
if (!attributesToCopy?.length) {
|
|
181
|
+
return {};
|
|
182
|
+
}
|
|
183
|
+
let adjacentAttributes;
|
|
184
|
+
if (clientId) {
|
|
185
|
+
const currentBlock = getBlock(clientId);
|
|
186
|
+
const previousBlock = getBlock(
|
|
187
|
+
getPreviousBlockClientId(clientId)
|
|
188
|
+
);
|
|
189
|
+
if (currentBlock?.name === previousBlock?.name) {
|
|
190
|
+
adjacentAttributes = previousBlock?.attributes;
|
|
191
|
+
}
|
|
192
|
+
} else if (targetRootClientId) {
|
|
193
|
+
const lastInnerBlock = getBlock(targetRootClientId)?.innerBlocks?.at(-1);
|
|
194
|
+
if (lastInnerBlock?.name === blockName) {
|
|
195
|
+
adjacentAttributes = lastInnerBlock.attributes;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
if (!adjacentAttributes) {
|
|
199
|
+
return {};
|
|
200
|
+
}
|
|
201
|
+
return Object.fromEntries(
|
|
202
|
+
attributesToCopy.filter((attr) => attr in adjacentAttributes).map((attr) => [attr, adjacentAttributes[attr]])
|
|
203
|
+
);
|
|
204
|
+
}
|
|
205
|
+
function getInsertionIndex() {
|
|
206
|
+
if (clientId) {
|
|
207
|
+
return getBlockIndex(clientId);
|
|
208
|
+
}
|
|
209
|
+
const end = getBlockSelectionEnd();
|
|
210
|
+
if (!isAppender && end && getBlockRootClientId(end) === targetRootClientId) {
|
|
211
|
+
return getBlockIndex(end) + 1;
|
|
212
|
+
}
|
|
213
|
+
return getBlockOrder(targetRootClientId).length;
|
|
214
|
+
}
|
|
215
|
+
const newAttributes = getAdjacentBlockAttributes(
|
|
216
|
+
blockToInsert?.attributesToCopy
|
|
217
|
+
);
|
|
218
|
+
const newBlock = (0, import_blocks.createBlock)(blockName, {
|
|
219
|
+
...blockToInsert?.attributes,
|
|
220
|
+
...newAttributes
|
|
221
|
+
});
|
|
222
|
+
insertBlock(
|
|
223
|
+
newBlock,
|
|
224
|
+
getInsertionIndex(),
|
|
225
|
+
targetRootClientId,
|
|
226
|
+
selectBlockOnInsert
|
|
227
|
+
);
|
|
228
|
+
onSelectOrClose?.(newBlock);
|
|
229
|
+
const blockTypeToInsert = getBlockType(blockName);
|
|
230
|
+
let blockLabelToInsert;
|
|
231
|
+
if (blockTypeToInsert) {
|
|
232
|
+
blockLabelToInsert = (0, import_blocks.__experimentalGetBlockLabel)(
|
|
233
|
+
blockTypeToInsert,
|
|
234
|
+
newBlock.attributes
|
|
235
|
+
);
|
|
236
|
+
if (blockLabelToInsert === blockTypeToInsert.title) {
|
|
237
|
+
blockLabelToInsert = getActiveBlockVariation(blockName, newBlock.attributes)?.title || blockLabelToInsert;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
if (blockLabelToInsert) {
|
|
241
|
+
const message = (0, import_i18n.sprintf)(
|
|
242
|
+
// translators: %s: the name of the block that has been added
|
|
243
|
+
(0, import_i18n.__)("%s block added"),
|
|
244
|
+
blockLabelToInsert
|
|
245
|
+
);
|
|
246
|
+
(0, import_a11y.speak)(message);
|
|
113
247
|
}
|
|
114
248
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
* @param {Object} options
|
|
119
|
-
* @param {Function} options.onToggle Callback to invoke when toggle is
|
|
120
|
-
* pressed.
|
|
121
|
-
* @param {boolean} options.isOpen Whether dropdown is currently open.
|
|
122
|
-
*
|
|
123
|
-
* @return {Element} Dropdown toggle element.
|
|
124
|
-
*/
|
|
125
|
-
renderToggle({ onToggle, isOpen }) {
|
|
126
|
-
const {
|
|
127
|
-
disabled,
|
|
128
|
-
blockTitle,
|
|
129
|
-
hasSingleBlockType,
|
|
130
|
-
appenderLabel,
|
|
131
|
-
toggleProps,
|
|
132
|
-
hasItems,
|
|
133
|
-
renderToggle = defaultRenderToggle
|
|
134
|
-
} = this.props;
|
|
135
|
-
return renderToggle({
|
|
136
|
-
onToggle,
|
|
249
|
+
function renderToggle({ onToggle: dropdownOnToggle, isOpen }) {
|
|
250
|
+
const toggleArgs = {
|
|
251
|
+
onToggle: dropdownOnToggle,
|
|
137
252
|
isOpen,
|
|
138
253
|
disabled: disabled || !hasItems,
|
|
139
254
|
blockTitle,
|
|
140
255
|
hasSingleBlockType,
|
|
141
256
|
appenderLabel,
|
|
142
257
|
toggleProps
|
|
143
|
-
}
|
|
258
|
+
};
|
|
259
|
+
if (renderToggleProp) {
|
|
260
|
+
return renderToggleProp(toggleArgs);
|
|
261
|
+
}
|
|
262
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(InserterToggle, { ref, ...toggleArgs });
|
|
144
263
|
}
|
|
145
|
-
|
|
146
|
-
* Render callback to display Dropdown content element.
|
|
147
|
-
*
|
|
148
|
-
* @param {Object} options
|
|
149
|
-
* @param {Function} options.onClose Callback to invoke when dropdown is
|
|
150
|
-
* closed.
|
|
151
|
-
*
|
|
152
|
-
* @return {Element} Dropdown content element.
|
|
153
|
-
*/
|
|
154
|
-
renderContent({ onClose }) {
|
|
155
|
-
const {
|
|
156
|
-
rootClientId,
|
|
157
|
-
clientId,
|
|
158
|
-
isAppender,
|
|
159
|
-
showInserterHelpPanel,
|
|
160
|
-
// This prop is experimental to give some time for the quick inserter to mature
|
|
161
|
-
// Feel free to make them stable after a few releases.
|
|
162
|
-
__experimentalIsQuick: isQuick,
|
|
163
|
-
onSelectOrClose,
|
|
164
|
-
selectBlockOnInsert
|
|
165
|
-
} = this.props;
|
|
264
|
+
function renderContent({ onClose }) {
|
|
166
265
|
if (isQuick) {
|
|
167
266
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
168
267
|
import_quick_inserter.default,
|
|
@@ -174,7 +273,7 @@ var Inserter = class extends import_element.Component {
|
|
|
174
273
|
}
|
|
175
274
|
onClose();
|
|
176
275
|
},
|
|
177
|
-
rootClientId,
|
|
276
|
+
rootClientId: targetRootClientId,
|
|
178
277
|
clientId,
|
|
179
278
|
isAppender,
|
|
180
279
|
selectBlockOnInsert
|
|
@@ -188,173 +287,33 @@ var Inserter = class extends import_element.Component {
|
|
|
188
287
|
onClose();
|
|
189
288
|
},
|
|
190
289
|
onClose,
|
|
191
|
-
rootClientId,
|
|
290
|
+
rootClientId: targetRootClientId,
|
|
192
291
|
clientId,
|
|
193
292
|
isAppender,
|
|
194
293
|
showInserterHelpPanel
|
|
195
294
|
}
|
|
196
295
|
);
|
|
197
296
|
}
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
position,
|
|
201
|
-
hasSingleBlockType,
|
|
202
|
-
blockToInsert,
|
|
203
|
-
insertOnlyAllowedBlock,
|
|
204
|
-
__experimentalIsQuick: isQuick,
|
|
205
|
-
onSelectOrClose
|
|
206
|
-
} = this.props;
|
|
207
|
-
if (hasSingleBlockType || blockToInsert) {
|
|
208
|
-
return this.renderToggle({ onToggle: insertOnlyAllowedBlock });
|
|
209
|
-
}
|
|
210
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
211
|
-
import_components.Dropdown,
|
|
212
|
-
{
|
|
213
|
-
className: "block-editor-inserter",
|
|
214
|
-
contentClassName: (0, import_clsx.default)("block-editor-inserter__popover", {
|
|
215
|
-
"is-quick": isQuick
|
|
216
|
-
}),
|
|
217
|
-
popoverProps: { position, shift: true },
|
|
218
|
-
onToggle: this.onToggle,
|
|
219
|
-
expandOnMobile: true,
|
|
220
|
-
headerTitle: (0, import_i18n.__)("Add a block"),
|
|
221
|
-
renderToggle: this.renderToggle,
|
|
222
|
-
renderContent: this.renderContent,
|
|
223
|
-
onClose: onSelectOrClose
|
|
224
|
-
}
|
|
225
|
-
);
|
|
297
|
+
if (hasSingleBlockType || blockToInsert) {
|
|
298
|
+
return renderToggle({ onToggle: insertOnlyAllowedBlock });
|
|
226
299
|
}
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
const directInsertBlock = shouldDirectInsert && getDirectInsertBlock(rootClientId);
|
|
242
|
-
const { defaultBlock } = getBlockListSettings(rootClientId) ?? {};
|
|
243
|
-
const hasSingleBlockType = allowedBlocks?.length === 1 && getBlockVariations(allowedBlocks[0].name, "inserter")?.length === 0;
|
|
244
|
-
const allowedBlockType = hasSingleBlockType ? allowedBlocks[0] : null;
|
|
245
|
-
let blockToInsert = directInsertBlock || null;
|
|
246
|
-
if (!blockToInsert && hasSingleBlockType && defaultBlock?.name === allowedBlockType.name) {
|
|
247
|
-
blockToInsert = defaultBlock;
|
|
248
|
-
}
|
|
249
|
-
const defaultBlockType = directInsertBlock ? getBlockType(directInsertBlock.name) : null;
|
|
250
|
-
const appenderLabel = (0, import_get_appender_label.getAppenderLabel)(
|
|
251
|
-
directInsertBlock,
|
|
252
|
-
defaultBlockType
|
|
253
|
-
);
|
|
254
|
-
return {
|
|
255
|
-
hasItems: hasInserterItems(rootClientId),
|
|
256
|
-
hasSingleBlockType,
|
|
257
|
-
blockTitle: allowedBlockType ? allowedBlockType.title : "",
|
|
258
|
-
allowedBlockType,
|
|
259
|
-
blockToInsert,
|
|
260
|
-
appenderLabel,
|
|
261
|
-
rootClientId
|
|
262
|
-
};
|
|
300
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
301
|
+
import_components.Dropdown,
|
|
302
|
+
{
|
|
303
|
+
className: "block-editor-inserter",
|
|
304
|
+
contentClassName: (0, import_clsx.default)("block-editor-inserter__popover", {
|
|
305
|
+
"is-quick": isQuick
|
|
306
|
+
}),
|
|
307
|
+
popoverProps: { position, shift: true },
|
|
308
|
+
onToggle,
|
|
309
|
+
expandOnMobile: true,
|
|
310
|
+
headerTitle: (0, import_i18n.__)("Add a block"),
|
|
311
|
+
renderToggle,
|
|
312
|
+
renderContent,
|
|
313
|
+
onClose: onSelectOrClose
|
|
263
314
|
}
|
|
264
|
-
)
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
const {
|
|
269
|
-
rootClientId,
|
|
270
|
-
clientId,
|
|
271
|
-
isAppender,
|
|
272
|
-
hasSingleBlockType,
|
|
273
|
-
allowedBlockType,
|
|
274
|
-
blockToInsert,
|
|
275
|
-
onSelectOrClose,
|
|
276
|
-
selectBlockOnInsert
|
|
277
|
-
} = ownProps;
|
|
278
|
-
if (!hasSingleBlockType && !blockToInsert) {
|
|
279
|
-
return;
|
|
280
|
-
}
|
|
281
|
-
const blockName = blockToInsert?.name ?? allowedBlockType.name;
|
|
282
|
-
function getAdjacentBlockAttributes(attributesToCopy) {
|
|
283
|
-
if (!attributesToCopy?.length) {
|
|
284
|
-
return {};
|
|
285
|
-
}
|
|
286
|
-
const { getBlock, getPreviousBlockClientId } = select(import_store.store);
|
|
287
|
-
let adjacentAttributes;
|
|
288
|
-
if (clientId) {
|
|
289
|
-
const currentBlock = getBlock(clientId);
|
|
290
|
-
const previousBlock = getBlock(
|
|
291
|
-
getPreviousBlockClientId(clientId)
|
|
292
|
-
);
|
|
293
|
-
if (currentBlock?.name === previousBlock?.name) {
|
|
294
|
-
adjacentAttributes = previousBlock?.attributes;
|
|
295
|
-
}
|
|
296
|
-
} else if (rootClientId) {
|
|
297
|
-
const lastInnerBlock = getBlock(rootClientId)?.innerBlocks?.at(-1);
|
|
298
|
-
if (lastInnerBlock?.name === blockName) {
|
|
299
|
-
adjacentAttributes = lastInnerBlock.attributes;
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
if (!adjacentAttributes) {
|
|
303
|
-
return {};
|
|
304
|
-
}
|
|
305
|
-
return Object.fromEntries(
|
|
306
|
-
attributesToCopy.filter((attr) => attr in adjacentAttributes).map((attr) => [
|
|
307
|
-
attr,
|
|
308
|
-
adjacentAttributes[attr]
|
|
309
|
-
])
|
|
310
|
-
);
|
|
311
|
-
}
|
|
312
|
-
function getInsertionIndex() {
|
|
313
|
-
const {
|
|
314
|
-
getBlockIndex,
|
|
315
|
-
getBlockSelectionEnd,
|
|
316
|
-
getBlockOrder,
|
|
317
|
-
getBlockRootClientId
|
|
318
|
-
} = select(import_store.store);
|
|
319
|
-
if (clientId) {
|
|
320
|
-
return getBlockIndex(clientId);
|
|
321
|
-
}
|
|
322
|
-
const end = getBlockSelectionEnd();
|
|
323
|
-
if (!isAppender && end && getBlockRootClientId(end) === rootClientId) {
|
|
324
|
-
return getBlockIndex(end) + 1;
|
|
325
|
-
}
|
|
326
|
-
return getBlockOrder(rootClientId).length;
|
|
327
|
-
}
|
|
328
|
-
const { insertBlock } = dispatch(import_store.store);
|
|
329
|
-
const newAttributes = getAdjacentBlockAttributes(
|
|
330
|
-
blockToInsert?.attributesToCopy
|
|
331
|
-
);
|
|
332
|
-
const newBlock = (0, import_blocks.createBlock)(blockName, {
|
|
333
|
-
...blockToInsert?.attributes || {},
|
|
334
|
-
...newAttributes
|
|
335
|
-
});
|
|
336
|
-
insertBlock(
|
|
337
|
-
newBlock,
|
|
338
|
-
getInsertionIndex(),
|
|
339
|
-
rootClientId,
|
|
340
|
-
selectBlockOnInsert
|
|
341
|
-
);
|
|
342
|
-
if (onSelectOrClose) {
|
|
343
|
-
onSelectOrClose(newBlock);
|
|
344
|
-
}
|
|
345
|
-
const message = (0, import_i18n.sprintf)(
|
|
346
|
-
// translators: %s: the name of the block that has been added
|
|
347
|
-
(0, import_i18n.__)("%s block added"),
|
|
348
|
-
allowedBlockType.title
|
|
349
|
-
);
|
|
350
|
-
(0, import_a11y.speak)(message);
|
|
351
|
-
}
|
|
352
|
-
};
|
|
353
|
-
}),
|
|
354
|
-
// The global inserter should always be visible, we are using ( ! isAppender && ! rootClientId && ! clientId ) as
|
|
355
|
-
// a way to detect the global Inserter.
|
|
356
|
-
(0, import_compose.ifCondition)(
|
|
357
|
-
({ hasItems, isAppender, rootClientId, clientId }) => hasItems || !isAppender && !rootClientId && !clientId
|
|
358
|
-
)
|
|
359
|
-
])(Inserter);
|
|
315
|
+
);
|
|
316
|
+
};
|
|
317
|
+
var Inserter = (0, import_element.forwardRef)(UnforwardedInserter);
|
|
318
|
+
var inserter_default = Inserter;
|
|
360
319
|
//# sourceMappingURL=index.cjs.map
|