@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": ";AAGA,OAAO,mBAAmB;AAK1B,SAAS,QAAQ,uBAAuB;AACxC,SAAS,mBAAmB;AAC5B,SAAS,qCAAqC;AAK9C,SAAS,SAAS,wBAAwB;AAqB3B,SAAR,0BACN,UACA,UACA,cACA,gCACC;AAGD,QAAM,WAAW,YAAY;AAG7B,QAAM,sBAAsB,OAAQ,IAAK;AAEzC,kBAAiB,MAAM;AACtB,QAAI,cAAc;AAElB,UAAM;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,IACD,IAAI,SAAS,OAAQ,gBAAiB;AACtC,UAAM,EAAE,oBAAoB,wCAAwC,IACnE,SAAS,SAAU,gBAAiB;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,CAAE;AAAA,QAC5B;AAAA,QACA,oBAAoB;AAAA,MACrB;AAEA,UAAK,CAAE,uBAAuB,CAAE,oBAAqB;AACpD;AAAA,MACD;AAEA,0BAAoB,UAAU;AAC9B,YAAM,aAAa;AAAA,QAClB;AAAA,QACA;AAAA,MACD;AAEA,UAAK,CAAE,cAAe,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": ";AAGA,OAAO,mBAAmB;AAK1B,SAAS,QAAQ,uBAAuB;AACxC,SAAS,mBAAmB;AAC5B,SAAS,qCAAqC;AAK9C,SAAS,SAAS,wBAAwB;AAqB3B,SAAR,0BACN,UACA,UACA,cACA,gCACC;AAGD,QAAM,WAAW,YAAY;AAG7B,QAAM,sBAAsB,OAAQ,IAAK;AAEzC,kBAAiB,MAAM;AACtB,QAAI,cAAc;AAElB,UAAM;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,IACD,IAAI,SAAS,OAAQ,gBAAiB;AACtC,UAAM,EAAE,oBAAoB,wCAAwC,IACnE,SAAS,SAAU,gBAAiB;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,CAAE;AAAA,QAC5B;AAAA,QACA,oBAAoB;AAAA,MACrB;AAEA,UAAK,CAAE,uBAAuB,CAAE,oBAAqB;AACpD;AAAA,MACD;AAEA,0BAAoB,UAAU;AAC9B,YAAM,aAAa;AAAA,QAClB;AAAA,QACA;AAAA,MACD;AAEA,UAAK,CAAE,cAAe,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": []
|
|
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,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
|
}
|
|
@@ -93,7 +93,7 @@ var usePatternsState = (onInsert, rootClientId, selectedCategory, isQuick) => {
|
|
|
93
93
|
createSuccessNotice(
|
|
94
94
|
sprintf(
|
|
95
95
|
/* translators: %s: block pattern title. */
|
|
96
|
-
__('
|
|
96
|
+
__('Pattern "%s" inserted.'),
|
|
97
97
|
pattern.title
|
|
98
98
|
),
|
|
99
99
|
{
|
|
@@ -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": ";AAGA,SAAS,aAAa,eAAe;AACrC,SAAS,YAAY,mBAAmB;AACxC,SAAS,aAAa,iBAAiB;AACvC,SAAS,IAAI,eAAe;AAC5B,SAAS,SAAS,oBAAoB;AAKtC,SAAS,SAAS,wBAAwB;AAC1C,SAAS,cAAc;AACvB;AAAA,EACC;AAAA,EACA;AAAA,OACM;AACP,SAAS,8BAA8B;AACvC,SAAS,kBAAkB;AAY3B,IAAM,mBAAmB,CACxB,UACA,cACA,kBACA,YACI;AACJ,QAAM,UAAU;AAAA,IACf,OAAQ,EAAE,CAAE,UAAW,GAAG,CAAC,CAAE,QAAQ;AAAA,IACrC,CAAE,OAAQ;AAAA,EACX;AAKA,QAAM,mCAAmC,UAAW,CAAE,WAAY;AACjE,UAAM,EAAE,YAAY,IAAI,OAAQ,OAAQ,gBAAiB,CAAE;AAC3D,UAAM,WAAW,YAAY;AAC7B,WAAO,SAAU,6BAA8B,KAAK;AAAA,EACrD,GAAG,CAAC,CAAE;AAEN,QAAM,EAAE,mBAAmB,UAAU,sBAAsB,IAAI;AAAA,IAC9D,CAAE,WAAY;AACb,YAAM,EAAE,aAAa,iCAAiC,IAAI;AAAA,QACzD,OAAQ,gBAAiB;AAAA,MAC1B;AACA,YAAM,WAAW,YAAY;AAC7B,YAAM,8BACL,SAAU,8BAA+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,mBAAmB,QAAS,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,IAAI;AAAA,IACrD,UAAW,gBAAiB;AAAA,EAC7B;AAEA,QAAM,gBAAgB,QAAS,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,IAAI,YAAa,YAAa;AAC1D,QAAM,iBAAiB;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,uBAAuB,QACxC,QAAQ,eAAe,aACpB,CAAE,YAAa,cAAc,EAAE,KAAK,QAAQ,GAAG,CAAE,CAAE,IACnD;AACJ;AAAA,SACG,iBAAiB,CAAC,GAAI,IAAK,CAAE,UAAW;AACzC,gBAAM,cAAc,WAAY,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,QACC;AAAA;AAAA,UAEC,GAAI,
|
|
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": ";AAGA,SAAS,aAAa,eAAe;AACrC,SAAS,YAAY,mBAAmB;AACxC,SAAS,aAAa,iBAAiB;AACvC,SAAS,IAAI,eAAe;AAC5B,SAAS,SAAS,oBAAoB;AAKtC,SAAS,SAAS,wBAAwB;AAC1C,SAAS,cAAc;AACvB;AAAA,EACC;AAAA,EACA;AAAA,OACM;AACP,SAAS,8BAA8B;AACvC,SAAS,kBAAkB;AAY3B,IAAM,mBAAmB,CACxB,UACA,cACA,kBACA,YACI;AACJ,QAAM,UAAU;AAAA,IACf,OAAQ,EAAE,CAAE,UAAW,GAAG,CAAC,CAAE,QAAQ;AAAA,IACrC,CAAE,OAAQ;AAAA,EACX;AAKA,QAAM,mCAAmC,UAAW,CAAE,WAAY;AACjE,UAAM,EAAE,YAAY,IAAI,OAAQ,OAAQ,gBAAiB,CAAE;AAC3D,UAAM,WAAW,YAAY;AAC7B,WAAO,SAAU,6BAA8B,KAAK;AAAA,EACrD,GAAG,CAAC,CAAE;AAEN,QAAM,EAAE,mBAAmB,UAAU,sBAAsB,IAAI;AAAA,IAC9D,CAAE,WAAY;AACb,YAAM,EAAE,aAAa,iCAAiC,IAAI;AAAA,QACzD,OAAQ,gBAAiB;AAAA,MAC1B;AACA,YAAM,WAAW,YAAY;AAC7B,YAAM,8BACL,SAAU,8BAA+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,mBAAmB,QAAS,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,IAAI;AAAA,IACrD,UAAW,gBAAiB;AAAA,EAC7B;AAEA,QAAM,gBAAgB,QAAS,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,IAAI,YAAa,YAAa;AAC1D,QAAM,iBAAiB;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,uBAAuB,QACxC,QAAQ,eAAe,aACpB,CAAE,YAAa,cAAc,EAAE,KAAK,QAAQ,GAAG,CAAE,CAAE,IACnD;AACJ;AAAA,SACG,iBAAiB,CAAC,GAAI,IAAK,CAAE,UAAW;AACzC,gBAAM,cAAc,WAAY,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,QACC;AAAA;AAAA,UAEC,GAAI,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": []
|
|
7
7
|
}
|
|
@@ -3,17 +3,20 @@ import clsx from "clsx";
|
|
|
3
3
|
import { speak } from "@wordpress/a11y";
|
|
4
4
|
import { __, _x, sprintf } from "@wordpress/i18n";
|
|
5
5
|
import { Dropdown, Button } from "@wordpress/components";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
import { useDispatch, useSelect } from "@wordpress/data";
|
|
7
|
+
import {
|
|
8
|
+
createBlock,
|
|
9
|
+
store as blocksStore,
|
|
10
|
+
__experimentalGetBlockLabel as getBlockLabel
|
|
11
|
+
} from "@wordpress/blocks";
|
|
12
|
+
import { forwardRef } from "@wordpress/element";
|
|
10
13
|
import { plus } from "@wordpress/icons";
|
|
11
14
|
import InserterMenu from "./menu.mjs";
|
|
12
15
|
import QuickInserter from "./quick-inserter.mjs";
|
|
13
16
|
import { store as blockEditorStore } from "../../store/index.mjs";
|
|
14
17
|
import { getAppenderLabel } from "./get-appender-label.mjs";
|
|
15
18
|
import { jsx } from "react/jsx-runtime";
|
|
16
|
-
var
|
|
19
|
+
var UnforwardedInserterToggle = ({
|
|
17
20
|
onToggle,
|
|
18
21
|
disabled,
|
|
19
22
|
isOpen,
|
|
@@ -21,7 +24,7 @@ var defaultRenderToggle = ({
|
|
|
21
24
|
hasSingleBlockType,
|
|
22
25
|
appenderLabel,
|
|
23
26
|
toggleProps = {}
|
|
24
|
-
}) => {
|
|
27
|
+
}, ref) => {
|
|
25
28
|
const {
|
|
26
29
|
as: Wrapper = Button,
|
|
27
30
|
label: labelProp,
|
|
@@ -51,6 +54,7 @@ var defaultRenderToggle = ({
|
|
|
51
54
|
return /* @__PURE__ */ jsx(
|
|
52
55
|
Wrapper,
|
|
53
56
|
{
|
|
57
|
+
ref,
|
|
54
58
|
__next40pxDefaultSize: toggleProps.as ? void 0 : true,
|
|
55
59
|
icon: plus,
|
|
56
60
|
label,
|
|
@@ -65,70 +69,169 @@ var defaultRenderToggle = ({
|
|
|
65
69
|
}
|
|
66
70
|
);
|
|
67
71
|
};
|
|
68
|
-
var
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
var InserterToggle = forwardRef(UnforwardedInserterToggle);
|
|
73
|
+
var UnforwardedInserter = ({
|
|
74
|
+
clientId,
|
|
75
|
+
rootClientId,
|
|
76
|
+
disabled,
|
|
77
|
+
isAppender,
|
|
78
|
+
position,
|
|
79
|
+
selectBlockOnInsert,
|
|
80
|
+
shouldDirectInsert = true,
|
|
81
|
+
showInserterHelpPanel,
|
|
82
|
+
// This prop is experimental to give some time for the quick inserter to mature
|
|
83
|
+
// Feel free to make them stable after a few releases.
|
|
84
|
+
__experimentalIsQuick: isQuick,
|
|
85
|
+
onSelectOrClose,
|
|
86
|
+
onToggle,
|
|
87
|
+
renderToggle: renderToggleProp,
|
|
88
|
+
toggleProps
|
|
89
|
+
}, ref) => {
|
|
90
|
+
const {
|
|
91
|
+
hasItems,
|
|
92
|
+
hasSingleBlockType,
|
|
93
|
+
blockTitle,
|
|
94
|
+
allowedBlockType,
|
|
95
|
+
blockToInsert,
|
|
96
|
+
appenderLabel,
|
|
97
|
+
targetRootClientId
|
|
98
|
+
} = useSelect(
|
|
99
|
+
(select) => {
|
|
100
|
+
const {
|
|
101
|
+
getBlockRootClientId: getBlockRootClientId2,
|
|
102
|
+
hasInserterItems,
|
|
103
|
+
getAllowedBlocks,
|
|
104
|
+
getDirectInsertBlock,
|
|
105
|
+
getBlockListSettings
|
|
106
|
+
} = select(blockEditorStore);
|
|
107
|
+
const { getBlockVariations, getBlockType: getBlockType2 } = select(blocksStore);
|
|
108
|
+
const _targetRootClientId = rootClientId || getBlockRootClientId2(clientId) || void 0;
|
|
109
|
+
const allowedBlocks = getAllowedBlocks(_targetRootClientId);
|
|
110
|
+
const directInsertBlock = shouldDirectInsert && getDirectInsertBlock(_targetRootClientId);
|
|
111
|
+
const { defaultBlock } = getBlockListSettings(_targetRootClientId) ?? {};
|
|
112
|
+
const _hasSingleBlockType = allowedBlocks?.length === 1 && getBlockVariations(allowedBlocks[0].name, "inserter")?.length === 0;
|
|
113
|
+
const _allowedBlockType = _hasSingleBlockType ? allowedBlocks[0] : null;
|
|
114
|
+
let _blockToInsert = directInsertBlock || null;
|
|
115
|
+
if (!_blockToInsert && _hasSingleBlockType && defaultBlock?.name === _allowedBlockType.name) {
|
|
116
|
+
_blockToInsert = defaultBlock;
|
|
117
|
+
}
|
|
118
|
+
const defaultBlockType = directInsertBlock ? getBlockType2(directInsertBlock.name) : null;
|
|
119
|
+
return {
|
|
120
|
+
hasItems: hasInserterItems(_targetRootClientId),
|
|
121
|
+
hasSingleBlockType: _hasSingleBlockType,
|
|
122
|
+
blockTitle: _allowedBlockType ? _allowedBlockType.title : "",
|
|
123
|
+
allowedBlockType: _allowedBlockType,
|
|
124
|
+
blockToInsert: _blockToInsert,
|
|
125
|
+
appenderLabel: getAppenderLabel(
|
|
126
|
+
directInsertBlock,
|
|
127
|
+
defaultBlockType
|
|
128
|
+
),
|
|
129
|
+
targetRootClientId: _targetRootClientId
|
|
130
|
+
};
|
|
131
|
+
},
|
|
132
|
+
[rootClientId, clientId, shouldDirectInsert]
|
|
133
|
+
);
|
|
134
|
+
const { insertBlock } = useDispatch(blockEditorStore);
|
|
135
|
+
const {
|
|
136
|
+
getBlock,
|
|
137
|
+
getBlockIndex,
|
|
138
|
+
getBlockOrder,
|
|
139
|
+
getBlockRootClientId,
|
|
140
|
+
getBlockSelectionEnd,
|
|
141
|
+
getPreviousBlockClientId
|
|
142
|
+
} = useSelect(blockEditorStore);
|
|
143
|
+
const { getActiveBlockVariation, getBlockType } = useSelect(blocksStore);
|
|
144
|
+
if (!hasItems && (isAppender || targetRootClientId || clientId)) {
|
|
145
|
+
return null;
|
|
74
146
|
}
|
|
75
|
-
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
|
|
147
|
+
function insertOnlyAllowedBlock() {
|
|
148
|
+
const blockName = blockToInsert?.name ?? allowedBlockType.name;
|
|
149
|
+
function getAdjacentBlockAttributes(attributesToCopy) {
|
|
150
|
+
if (!attributesToCopy?.length) {
|
|
151
|
+
return {};
|
|
152
|
+
}
|
|
153
|
+
let adjacentAttributes;
|
|
154
|
+
if (clientId) {
|
|
155
|
+
const currentBlock = getBlock(clientId);
|
|
156
|
+
const previousBlock = getBlock(
|
|
157
|
+
getPreviousBlockClientId(clientId)
|
|
158
|
+
);
|
|
159
|
+
if (currentBlock?.name === previousBlock?.name) {
|
|
160
|
+
adjacentAttributes = previousBlock?.attributes;
|
|
161
|
+
}
|
|
162
|
+
} else if (targetRootClientId) {
|
|
163
|
+
const lastInnerBlock = getBlock(targetRootClientId)?.innerBlocks?.at(-1);
|
|
164
|
+
if (lastInnerBlock?.name === blockName) {
|
|
165
|
+
adjacentAttributes = lastInnerBlock.attributes;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
if (!adjacentAttributes) {
|
|
169
|
+
return {};
|
|
170
|
+
}
|
|
171
|
+
return Object.fromEntries(
|
|
172
|
+
attributesToCopy.filter((attr) => attr in adjacentAttributes).map((attr) => [attr, adjacentAttributes[attr]])
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
function getInsertionIndex() {
|
|
176
|
+
if (clientId) {
|
|
177
|
+
return getBlockIndex(clientId);
|
|
178
|
+
}
|
|
179
|
+
const end = getBlockSelectionEnd();
|
|
180
|
+
if (!isAppender && end && getBlockRootClientId(end) === targetRootClientId) {
|
|
181
|
+
return getBlockIndex(end) + 1;
|
|
182
|
+
}
|
|
183
|
+
return getBlockOrder(targetRootClientId).length;
|
|
184
|
+
}
|
|
185
|
+
const newAttributes = getAdjacentBlockAttributes(
|
|
186
|
+
blockToInsert?.attributesToCopy
|
|
187
|
+
);
|
|
188
|
+
const newBlock = createBlock(blockName, {
|
|
189
|
+
...blockToInsert?.attributes,
|
|
190
|
+
...newAttributes
|
|
191
|
+
});
|
|
192
|
+
insertBlock(
|
|
193
|
+
newBlock,
|
|
194
|
+
getInsertionIndex(),
|
|
195
|
+
targetRootClientId,
|
|
196
|
+
selectBlockOnInsert
|
|
197
|
+
);
|
|
198
|
+
onSelectOrClose?.(newBlock);
|
|
199
|
+
const blockTypeToInsert = getBlockType(blockName);
|
|
200
|
+
let blockLabelToInsert;
|
|
201
|
+
if (blockTypeToInsert) {
|
|
202
|
+
blockLabelToInsert = getBlockLabel(
|
|
203
|
+
blockTypeToInsert,
|
|
204
|
+
newBlock.attributes
|
|
205
|
+
);
|
|
206
|
+
if (blockLabelToInsert === blockTypeToInsert.title) {
|
|
207
|
+
blockLabelToInsert = getActiveBlockVariation(blockName, newBlock.attributes)?.title || blockLabelToInsert;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
if (blockLabelToInsert) {
|
|
211
|
+
const message = sprintf(
|
|
212
|
+
// translators: %s: the name of the block that has been added
|
|
213
|
+
__("%s block added"),
|
|
214
|
+
blockLabelToInsert
|
|
215
|
+
);
|
|
216
|
+
speak(message);
|
|
79
217
|
}
|
|
80
218
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
* @param {Object} options
|
|
85
|
-
* @param {Function} options.onToggle Callback to invoke when toggle is
|
|
86
|
-
* pressed.
|
|
87
|
-
* @param {boolean} options.isOpen Whether dropdown is currently open.
|
|
88
|
-
*
|
|
89
|
-
* @return {Element} Dropdown toggle element.
|
|
90
|
-
*/
|
|
91
|
-
renderToggle({ onToggle, isOpen }) {
|
|
92
|
-
const {
|
|
93
|
-
disabled,
|
|
94
|
-
blockTitle,
|
|
95
|
-
hasSingleBlockType,
|
|
96
|
-
appenderLabel,
|
|
97
|
-
toggleProps,
|
|
98
|
-
hasItems,
|
|
99
|
-
renderToggle = defaultRenderToggle
|
|
100
|
-
} = this.props;
|
|
101
|
-
return renderToggle({
|
|
102
|
-
onToggle,
|
|
219
|
+
function renderToggle({ onToggle: dropdownOnToggle, isOpen }) {
|
|
220
|
+
const toggleArgs = {
|
|
221
|
+
onToggle: dropdownOnToggle,
|
|
103
222
|
isOpen,
|
|
104
223
|
disabled: disabled || !hasItems,
|
|
105
224
|
blockTitle,
|
|
106
225
|
hasSingleBlockType,
|
|
107
226
|
appenderLabel,
|
|
108
227
|
toggleProps
|
|
109
|
-
}
|
|
228
|
+
};
|
|
229
|
+
if (renderToggleProp) {
|
|
230
|
+
return renderToggleProp(toggleArgs);
|
|
231
|
+
}
|
|
232
|
+
return /* @__PURE__ */ jsx(InserterToggle, { ref, ...toggleArgs });
|
|
110
233
|
}
|
|
111
|
-
|
|
112
|
-
* Render callback to display Dropdown content element.
|
|
113
|
-
*
|
|
114
|
-
* @param {Object} options
|
|
115
|
-
* @param {Function} options.onClose Callback to invoke when dropdown is
|
|
116
|
-
* closed.
|
|
117
|
-
*
|
|
118
|
-
* @return {Element} Dropdown content element.
|
|
119
|
-
*/
|
|
120
|
-
renderContent({ onClose }) {
|
|
121
|
-
const {
|
|
122
|
-
rootClientId,
|
|
123
|
-
clientId,
|
|
124
|
-
isAppender,
|
|
125
|
-
showInserterHelpPanel,
|
|
126
|
-
// This prop is experimental to give some time for the quick inserter to mature
|
|
127
|
-
// Feel free to make them stable after a few releases.
|
|
128
|
-
__experimentalIsQuick: isQuick,
|
|
129
|
-
onSelectOrClose,
|
|
130
|
-
selectBlockOnInsert
|
|
131
|
-
} = this.props;
|
|
234
|
+
function renderContent({ onClose }) {
|
|
132
235
|
if (isQuick) {
|
|
133
236
|
return /* @__PURE__ */ jsx(
|
|
134
237
|
QuickInserter,
|
|
@@ -140,7 +243,7 @@ var Inserter = class extends Component {
|
|
|
140
243
|
}
|
|
141
244
|
onClose();
|
|
142
245
|
},
|
|
143
|
-
rootClientId,
|
|
246
|
+
rootClientId: targetRootClientId,
|
|
144
247
|
clientId,
|
|
145
248
|
isAppender,
|
|
146
249
|
selectBlockOnInsert
|
|
@@ -154,175 +257,35 @@ var Inserter = class extends Component {
|
|
|
154
257
|
onClose();
|
|
155
258
|
},
|
|
156
259
|
onClose,
|
|
157
|
-
rootClientId,
|
|
260
|
+
rootClientId: targetRootClientId,
|
|
158
261
|
clientId,
|
|
159
262
|
isAppender,
|
|
160
263
|
showInserterHelpPanel
|
|
161
264
|
}
|
|
162
265
|
);
|
|
163
266
|
}
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
position,
|
|
167
|
-
hasSingleBlockType,
|
|
168
|
-
blockToInsert,
|
|
169
|
-
insertOnlyAllowedBlock,
|
|
170
|
-
__experimentalIsQuick: isQuick,
|
|
171
|
-
onSelectOrClose
|
|
172
|
-
} = this.props;
|
|
173
|
-
if (hasSingleBlockType || blockToInsert) {
|
|
174
|
-
return this.renderToggle({ onToggle: insertOnlyAllowedBlock });
|
|
175
|
-
}
|
|
176
|
-
return /* @__PURE__ */ jsx(
|
|
177
|
-
Dropdown,
|
|
178
|
-
{
|
|
179
|
-
className: "block-editor-inserter",
|
|
180
|
-
contentClassName: clsx("block-editor-inserter__popover", {
|
|
181
|
-
"is-quick": isQuick
|
|
182
|
-
}),
|
|
183
|
-
popoverProps: { position, shift: true },
|
|
184
|
-
onToggle: this.onToggle,
|
|
185
|
-
expandOnMobile: true,
|
|
186
|
-
headerTitle: __("Add a block"),
|
|
187
|
-
renderToggle: this.renderToggle,
|
|
188
|
-
renderContent: this.renderContent,
|
|
189
|
-
onClose: onSelectOrClose
|
|
190
|
-
}
|
|
191
|
-
);
|
|
267
|
+
if (hasSingleBlockType || blockToInsert) {
|
|
268
|
+
return renderToggle({ onToggle: insertOnlyAllowedBlock });
|
|
192
269
|
}
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
const directInsertBlock = shouldDirectInsert && getDirectInsertBlock(rootClientId);
|
|
208
|
-
const { defaultBlock } = getBlockListSettings(rootClientId) ?? {};
|
|
209
|
-
const hasSingleBlockType = allowedBlocks?.length === 1 && getBlockVariations(allowedBlocks[0].name, "inserter")?.length === 0;
|
|
210
|
-
const allowedBlockType = hasSingleBlockType ? allowedBlocks[0] : null;
|
|
211
|
-
let blockToInsert = directInsertBlock || null;
|
|
212
|
-
if (!blockToInsert && hasSingleBlockType && defaultBlock?.name === allowedBlockType.name) {
|
|
213
|
-
blockToInsert = defaultBlock;
|
|
214
|
-
}
|
|
215
|
-
const defaultBlockType = directInsertBlock ? getBlockType(directInsertBlock.name) : null;
|
|
216
|
-
const appenderLabel = getAppenderLabel(
|
|
217
|
-
directInsertBlock,
|
|
218
|
-
defaultBlockType
|
|
219
|
-
);
|
|
220
|
-
return {
|
|
221
|
-
hasItems: hasInserterItems(rootClientId),
|
|
222
|
-
hasSingleBlockType,
|
|
223
|
-
blockTitle: allowedBlockType ? allowedBlockType.title : "",
|
|
224
|
-
allowedBlockType,
|
|
225
|
-
blockToInsert,
|
|
226
|
-
appenderLabel,
|
|
227
|
-
rootClientId
|
|
228
|
-
};
|
|
270
|
+
return /* @__PURE__ */ jsx(
|
|
271
|
+
Dropdown,
|
|
272
|
+
{
|
|
273
|
+
className: "block-editor-inserter",
|
|
274
|
+
contentClassName: clsx("block-editor-inserter__popover", {
|
|
275
|
+
"is-quick": isQuick
|
|
276
|
+
}),
|
|
277
|
+
popoverProps: { position, shift: true },
|
|
278
|
+
onToggle,
|
|
279
|
+
expandOnMobile: true,
|
|
280
|
+
headerTitle: __("Add a block"),
|
|
281
|
+
renderToggle,
|
|
282
|
+
renderContent,
|
|
283
|
+
onClose: onSelectOrClose
|
|
229
284
|
}
|
|
230
|
-
)
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
const {
|
|
235
|
-
rootClientId,
|
|
236
|
-
clientId,
|
|
237
|
-
isAppender,
|
|
238
|
-
hasSingleBlockType,
|
|
239
|
-
allowedBlockType,
|
|
240
|
-
blockToInsert,
|
|
241
|
-
onSelectOrClose,
|
|
242
|
-
selectBlockOnInsert
|
|
243
|
-
} = ownProps;
|
|
244
|
-
if (!hasSingleBlockType && !blockToInsert) {
|
|
245
|
-
return;
|
|
246
|
-
}
|
|
247
|
-
const blockName = blockToInsert?.name ?? allowedBlockType.name;
|
|
248
|
-
function getAdjacentBlockAttributes(attributesToCopy) {
|
|
249
|
-
if (!attributesToCopy?.length) {
|
|
250
|
-
return {};
|
|
251
|
-
}
|
|
252
|
-
const { getBlock, getPreviousBlockClientId } = select(blockEditorStore);
|
|
253
|
-
let adjacentAttributes;
|
|
254
|
-
if (clientId) {
|
|
255
|
-
const currentBlock = getBlock(clientId);
|
|
256
|
-
const previousBlock = getBlock(
|
|
257
|
-
getPreviousBlockClientId(clientId)
|
|
258
|
-
);
|
|
259
|
-
if (currentBlock?.name === previousBlock?.name) {
|
|
260
|
-
adjacentAttributes = previousBlock?.attributes;
|
|
261
|
-
}
|
|
262
|
-
} else if (rootClientId) {
|
|
263
|
-
const lastInnerBlock = getBlock(rootClientId)?.innerBlocks?.at(-1);
|
|
264
|
-
if (lastInnerBlock?.name === blockName) {
|
|
265
|
-
adjacentAttributes = lastInnerBlock.attributes;
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
if (!adjacentAttributes) {
|
|
269
|
-
return {};
|
|
270
|
-
}
|
|
271
|
-
return Object.fromEntries(
|
|
272
|
-
attributesToCopy.filter((attr) => attr in adjacentAttributes).map((attr) => [
|
|
273
|
-
attr,
|
|
274
|
-
adjacentAttributes[attr]
|
|
275
|
-
])
|
|
276
|
-
);
|
|
277
|
-
}
|
|
278
|
-
function getInsertionIndex() {
|
|
279
|
-
const {
|
|
280
|
-
getBlockIndex,
|
|
281
|
-
getBlockSelectionEnd,
|
|
282
|
-
getBlockOrder,
|
|
283
|
-
getBlockRootClientId
|
|
284
|
-
} = select(blockEditorStore);
|
|
285
|
-
if (clientId) {
|
|
286
|
-
return getBlockIndex(clientId);
|
|
287
|
-
}
|
|
288
|
-
const end = getBlockSelectionEnd();
|
|
289
|
-
if (!isAppender && end && getBlockRootClientId(end) === rootClientId) {
|
|
290
|
-
return getBlockIndex(end) + 1;
|
|
291
|
-
}
|
|
292
|
-
return getBlockOrder(rootClientId).length;
|
|
293
|
-
}
|
|
294
|
-
const { insertBlock } = dispatch(blockEditorStore);
|
|
295
|
-
const newAttributes = getAdjacentBlockAttributes(
|
|
296
|
-
blockToInsert?.attributesToCopy
|
|
297
|
-
);
|
|
298
|
-
const newBlock = createBlock(blockName, {
|
|
299
|
-
...blockToInsert?.attributes || {},
|
|
300
|
-
...newAttributes
|
|
301
|
-
});
|
|
302
|
-
insertBlock(
|
|
303
|
-
newBlock,
|
|
304
|
-
getInsertionIndex(),
|
|
305
|
-
rootClientId,
|
|
306
|
-
selectBlockOnInsert
|
|
307
|
-
);
|
|
308
|
-
if (onSelectOrClose) {
|
|
309
|
-
onSelectOrClose(newBlock);
|
|
310
|
-
}
|
|
311
|
-
const message = sprintf(
|
|
312
|
-
// translators: %s: the name of the block that has been added
|
|
313
|
-
__("%s block added"),
|
|
314
|
-
allowedBlockType.title
|
|
315
|
-
);
|
|
316
|
-
speak(message);
|
|
317
|
-
}
|
|
318
|
-
};
|
|
319
|
-
}),
|
|
320
|
-
// The global inserter should always be visible, we are using ( ! isAppender && ! rootClientId && ! clientId ) as
|
|
321
|
-
// a way to detect the global Inserter.
|
|
322
|
-
ifCondition(
|
|
323
|
-
({ hasItems, isAppender, rootClientId, clientId }) => hasItems || !isAppender && !rootClientId && !clientId
|
|
324
|
-
)
|
|
325
|
-
])(Inserter);
|
|
285
|
+
);
|
|
286
|
+
};
|
|
287
|
+
var Inserter = forwardRef(UnforwardedInserter);
|
|
288
|
+
var inserter_default = Inserter;
|
|
326
289
|
export {
|
|
327
290
|
inserter_default as default
|
|
328
291
|
};
|