@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,477 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { Platform, findNodeHandle } from 'react-native';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* WordPress dependencies
|
|
8
|
-
*/
|
|
9
|
-
import {
|
|
10
|
-
getClipboard,
|
|
11
|
-
setClipboard,
|
|
12
|
-
ToolbarGroup,
|
|
13
|
-
ToolbarButton,
|
|
14
|
-
Picker,
|
|
15
|
-
} from '@wordpress/components';
|
|
16
|
-
import {
|
|
17
|
-
getBlockType,
|
|
18
|
-
getDefaultBlockName,
|
|
19
|
-
hasBlockSupport,
|
|
20
|
-
serialize,
|
|
21
|
-
rawHandler,
|
|
22
|
-
createBlock,
|
|
23
|
-
isUnmodifiedDefaultBlock,
|
|
24
|
-
isReusableBlock,
|
|
25
|
-
} from '@wordpress/blocks';
|
|
26
|
-
import { __, sprintf } from '@wordpress/i18n';
|
|
27
|
-
import { withDispatch, withSelect, useSelect } from '@wordpress/data';
|
|
28
|
-
import { withInstanceId, compose } from '@wordpress/compose';
|
|
29
|
-
import { moreHorizontal } from '@wordpress/icons';
|
|
30
|
-
import { useRef, useState } from '@wordpress/element';
|
|
31
|
-
import { store as noticesStore } from '@wordpress/notices';
|
|
32
|
-
import { store as reusableBlocksStore } from '@wordpress/reusable-blocks';
|
|
33
|
-
// Disable Reason: Needs to be refactored.
|
|
34
|
-
// eslint-disable-next-line no-restricted-imports
|
|
35
|
-
import { store as coreStore } from '@wordpress/core-data';
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Internal dependencies
|
|
39
|
-
*/
|
|
40
|
-
import { getMoversSetup } from '../block-mover/mover-description';
|
|
41
|
-
import { store as blockEditorStore } from '../../store';
|
|
42
|
-
import BlockTransformationsMenu from '../block-switcher/block-transformations-menu';
|
|
43
|
-
import {
|
|
44
|
-
useConvertToGroupButtons,
|
|
45
|
-
useConvertToGroupButtonProps,
|
|
46
|
-
} from '../convert-to-group-buttons';
|
|
47
|
-
|
|
48
|
-
const BlockActionsMenu = ( {
|
|
49
|
-
// Select.
|
|
50
|
-
blockTitle,
|
|
51
|
-
canInsertBlockType,
|
|
52
|
-
getBlocksByClientId,
|
|
53
|
-
isEmptyDefaultBlock,
|
|
54
|
-
isLocked,
|
|
55
|
-
canDuplicate,
|
|
56
|
-
isFirst,
|
|
57
|
-
isLast,
|
|
58
|
-
isReusableBlockType,
|
|
59
|
-
reusableBlock,
|
|
60
|
-
rootClientId,
|
|
61
|
-
selectedBlockClientId,
|
|
62
|
-
selectedBlockPossibleTransformations,
|
|
63
|
-
// Dispatch.
|
|
64
|
-
createSuccessNotice,
|
|
65
|
-
convertToRegularBlocks,
|
|
66
|
-
duplicateBlock,
|
|
67
|
-
onMoveDown,
|
|
68
|
-
onMoveUp,
|
|
69
|
-
openGeneralSidebar,
|
|
70
|
-
pasteBlock,
|
|
71
|
-
removeBlocks,
|
|
72
|
-
// Passed in.
|
|
73
|
-
anchorNodeRef,
|
|
74
|
-
isStackedHorizontally,
|
|
75
|
-
onDelete,
|
|
76
|
-
wrapBlockMover,
|
|
77
|
-
wrapBlockSettings,
|
|
78
|
-
} ) => {
|
|
79
|
-
const [ clipboard, setCurrentClipboard ] = useState( getClipboard() );
|
|
80
|
-
const blockActionsMenuPickerRef = useRef();
|
|
81
|
-
const blockTransformationMenuPickerRef = useRef();
|
|
82
|
-
const moversOptions = { keys: [ 'icon', 'actionTitle' ] };
|
|
83
|
-
const clipboardBlock = clipboard && rawHandler( { HTML: clipboard } )[ 0 ];
|
|
84
|
-
const isPasteEnabled =
|
|
85
|
-
clipboardBlock &&
|
|
86
|
-
canInsertBlockType( clipboardBlock.name, rootClientId );
|
|
87
|
-
|
|
88
|
-
const innerBlockCount = useSelect(
|
|
89
|
-
( select ) =>
|
|
90
|
-
select( blockEditorStore ).getBlockCount( selectedBlockClientId ),
|
|
91
|
-
[ selectedBlockClientId ]
|
|
92
|
-
);
|
|
93
|
-
|
|
94
|
-
const {
|
|
95
|
-
actionTitle: {
|
|
96
|
-
backward: backwardButtonTitle,
|
|
97
|
-
forward: forwardButtonTitle,
|
|
98
|
-
},
|
|
99
|
-
} = getMoversSetup( isStackedHorizontally, moversOptions );
|
|
100
|
-
|
|
101
|
-
// Check if selected block is Groupable and/or Ungroupable.
|
|
102
|
-
const convertToGroupButtonProps = useConvertToGroupButtonProps(
|
|
103
|
-
// `selectedBlockClientId` can be undefined in some cases where this
|
|
104
|
-
// component gets re-rendered right after the block is removed.
|
|
105
|
-
selectedBlockClientId ? [ selectedBlockClientId ] : []
|
|
106
|
-
);
|
|
107
|
-
const { isGroupable, isUngroupable } = convertToGroupButtonProps;
|
|
108
|
-
const showConvertToGroupButton = isGroupable || isUngroupable;
|
|
109
|
-
const convertToGroupButtons = useConvertToGroupButtons( {
|
|
110
|
-
...convertToGroupButtonProps,
|
|
111
|
-
} );
|
|
112
|
-
|
|
113
|
-
const allOptions = {
|
|
114
|
-
settings: {
|
|
115
|
-
id: 'settingsOption',
|
|
116
|
-
label: __( 'Block settings' ),
|
|
117
|
-
value: 'settingsOption',
|
|
118
|
-
onSelect: openGeneralSidebar,
|
|
119
|
-
},
|
|
120
|
-
backwardButton: {
|
|
121
|
-
id: 'backwardButtonOption',
|
|
122
|
-
label: backwardButtonTitle,
|
|
123
|
-
value: 'backwardButtonOption',
|
|
124
|
-
disabled: isFirst,
|
|
125
|
-
onSelect: onMoveUp,
|
|
126
|
-
},
|
|
127
|
-
forwardButton: {
|
|
128
|
-
id: 'forwardButtonOption',
|
|
129
|
-
label: forwardButtonTitle,
|
|
130
|
-
value: 'forwardButtonOption',
|
|
131
|
-
disabled: isLast,
|
|
132
|
-
onSelect: onMoveDown,
|
|
133
|
-
},
|
|
134
|
-
delete: {
|
|
135
|
-
id: 'deleteOption',
|
|
136
|
-
label: __( 'Remove block' ),
|
|
137
|
-
value: 'deleteOption',
|
|
138
|
-
separated: true,
|
|
139
|
-
disabled: isEmptyDefaultBlock,
|
|
140
|
-
onSelect: () => {
|
|
141
|
-
onDelete();
|
|
142
|
-
createSuccessNotice(
|
|
143
|
-
// translators: displayed right after the block is removed.
|
|
144
|
-
__( 'Block removed' )
|
|
145
|
-
);
|
|
146
|
-
},
|
|
147
|
-
},
|
|
148
|
-
transformButton: {
|
|
149
|
-
id: 'transformButtonOption',
|
|
150
|
-
label: __( 'Transform block…' ),
|
|
151
|
-
value: 'transformButtonOption',
|
|
152
|
-
onSelect: () => {
|
|
153
|
-
if ( blockTransformationMenuPickerRef.current ) {
|
|
154
|
-
blockTransformationMenuPickerRef.current.presentPicker();
|
|
155
|
-
}
|
|
156
|
-
},
|
|
157
|
-
},
|
|
158
|
-
copyButton: {
|
|
159
|
-
id: 'copyButtonOption',
|
|
160
|
-
label: __( 'Copy' ),
|
|
161
|
-
value: 'copyButtonOption',
|
|
162
|
-
onSelect: () => {
|
|
163
|
-
const serializedBlock = serialize(
|
|
164
|
-
getBlocksByClientId( selectedBlockClientId )
|
|
165
|
-
);
|
|
166
|
-
setCurrentClipboard( serializedBlock );
|
|
167
|
-
setClipboard( serializedBlock );
|
|
168
|
-
createSuccessNotice(
|
|
169
|
-
// translators: displayed right after the block is copied.
|
|
170
|
-
__( 'Block copied' )
|
|
171
|
-
);
|
|
172
|
-
},
|
|
173
|
-
},
|
|
174
|
-
cutButton: {
|
|
175
|
-
id: 'cutButtonOption',
|
|
176
|
-
label: __( 'Cut block' ),
|
|
177
|
-
value: 'cutButtonOption',
|
|
178
|
-
onSelect: () => {
|
|
179
|
-
setClipboard(
|
|
180
|
-
serialize( getBlocksByClientId( selectedBlockClientId ) )
|
|
181
|
-
);
|
|
182
|
-
removeBlocks( selectedBlockClientId );
|
|
183
|
-
createSuccessNotice(
|
|
184
|
-
// translators: displayed right after the block is cut.
|
|
185
|
-
__( 'Block cut' )
|
|
186
|
-
);
|
|
187
|
-
},
|
|
188
|
-
},
|
|
189
|
-
pasteButton: {
|
|
190
|
-
id: 'pasteButtonOption',
|
|
191
|
-
label: __( 'Paste block after' ),
|
|
192
|
-
value: 'pasteButtonOption',
|
|
193
|
-
onSelect: () => {
|
|
194
|
-
onPasteBlock();
|
|
195
|
-
createSuccessNotice(
|
|
196
|
-
// translators: displayed right after the block is pasted.
|
|
197
|
-
__( 'Block pasted' )
|
|
198
|
-
);
|
|
199
|
-
},
|
|
200
|
-
},
|
|
201
|
-
duplicateButton: {
|
|
202
|
-
id: 'duplicateButtonOption',
|
|
203
|
-
label: __( 'Duplicate block' ),
|
|
204
|
-
value: 'duplicateButtonOption',
|
|
205
|
-
onSelect: () => {
|
|
206
|
-
duplicateBlock();
|
|
207
|
-
createSuccessNotice(
|
|
208
|
-
// translators: displayed right after the block is duplicated.
|
|
209
|
-
__( 'Block duplicated' )
|
|
210
|
-
);
|
|
211
|
-
},
|
|
212
|
-
},
|
|
213
|
-
convertToRegularBlocks: {
|
|
214
|
-
id: 'convertToRegularBlocksOption',
|
|
215
|
-
label: __( 'Detach' ),
|
|
216
|
-
value: 'convertToRegularBlocksOption',
|
|
217
|
-
onSelect: () => {
|
|
218
|
-
/* translators: %s: name of the synced block */
|
|
219
|
-
const successNotice = __( '%s detached' );
|
|
220
|
-
createSuccessNotice(
|
|
221
|
-
sprintf(
|
|
222
|
-
successNotice,
|
|
223
|
-
reusableBlock?.title?.raw || blockTitle
|
|
224
|
-
)
|
|
225
|
-
);
|
|
226
|
-
convertToRegularBlocks();
|
|
227
|
-
},
|
|
228
|
-
},
|
|
229
|
-
};
|
|
230
|
-
|
|
231
|
-
const options = [
|
|
232
|
-
wrapBlockMover && allOptions.backwardButton,
|
|
233
|
-
wrapBlockMover && allOptions.forwardButton,
|
|
234
|
-
wrapBlockSettings && allOptions.settings,
|
|
235
|
-
! isLocked &&
|
|
236
|
-
selectedBlockPossibleTransformations.length &&
|
|
237
|
-
allOptions.transformButton,
|
|
238
|
-
canDuplicate && allOptions.copyButton,
|
|
239
|
-
canDuplicate && allOptions.cutButton,
|
|
240
|
-
canDuplicate && isPasteEnabled && allOptions.pasteButton,
|
|
241
|
-
canDuplicate && allOptions.duplicateButton,
|
|
242
|
-
showConvertToGroupButton && isGroupable && convertToGroupButtons.group,
|
|
243
|
-
showConvertToGroupButton &&
|
|
244
|
-
isUngroupable &&
|
|
245
|
-
convertToGroupButtons.ungroup,
|
|
246
|
-
isReusableBlockType &&
|
|
247
|
-
innerBlockCount > 0 &&
|
|
248
|
-
allOptions.convertToRegularBlocks,
|
|
249
|
-
! isLocked && allOptions.delete,
|
|
250
|
-
].filter( Boolean );
|
|
251
|
-
|
|
252
|
-
// End early if there are no options to show.
|
|
253
|
-
if ( ! options.length ) {
|
|
254
|
-
return (
|
|
255
|
-
<ToolbarGroup>
|
|
256
|
-
<ToolbarButton
|
|
257
|
-
title={ __( 'Open Block Actions Menu' ) }
|
|
258
|
-
icon={ moreHorizontal }
|
|
259
|
-
disabled
|
|
260
|
-
/>
|
|
261
|
-
</ToolbarGroup>
|
|
262
|
-
);
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
function onPasteBlock() {
|
|
266
|
-
if ( ! clipboard ) {
|
|
267
|
-
return;
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
pasteBlock( rawHandler( { HTML: clipboard } )[ 0 ] );
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
function onPickerSelect( value ) {
|
|
274
|
-
const selectedItem = options.find( ( item ) => item.value === value );
|
|
275
|
-
selectedItem.onSelect();
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
function onPickerPresent() {
|
|
279
|
-
if ( blockActionsMenuPickerRef.current ) {
|
|
280
|
-
blockActionsMenuPickerRef.current.presentPicker();
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
const disabledButtonIndices = options
|
|
285
|
-
.map( ( option, index ) => option.disabled && index + 1 )
|
|
286
|
-
.filter( Boolean );
|
|
287
|
-
|
|
288
|
-
const accessibilityHint =
|
|
289
|
-
Platform.OS === 'ios'
|
|
290
|
-
? __( 'Double tap to open Action Sheet with available options' )
|
|
291
|
-
: __( 'Double tap to open Bottom Sheet with available options' );
|
|
292
|
-
|
|
293
|
-
const getAnchor = () =>
|
|
294
|
-
anchorNodeRef ? findNodeHandle( anchorNodeRef ) : undefined;
|
|
295
|
-
|
|
296
|
-
return (
|
|
297
|
-
<ToolbarGroup>
|
|
298
|
-
<ToolbarButton
|
|
299
|
-
title={ __( 'Open Block Actions Menu' ) }
|
|
300
|
-
onClick={ onPickerPresent }
|
|
301
|
-
icon={ moreHorizontal }
|
|
302
|
-
extraProps={ {
|
|
303
|
-
hint: accessibilityHint,
|
|
304
|
-
} }
|
|
305
|
-
/>
|
|
306
|
-
<Picker
|
|
307
|
-
testID="block-actions-menu"
|
|
308
|
-
ref={ blockActionsMenuPickerRef }
|
|
309
|
-
options={ options }
|
|
310
|
-
onChange={ onPickerSelect }
|
|
311
|
-
destructiveButtonIndex={ options.length }
|
|
312
|
-
disabledButtonIndices={ disabledButtonIndices }
|
|
313
|
-
hideCancelButton={ Platform.OS !== 'ios' }
|
|
314
|
-
leftAlign
|
|
315
|
-
getAnchor={ getAnchor }
|
|
316
|
-
// translators: %s: block title e.g: "Paragraph".
|
|
317
|
-
title={ sprintf( __( '%s block options' ), blockTitle ) }
|
|
318
|
-
/>
|
|
319
|
-
<BlockTransformationsMenu
|
|
320
|
-
anchorNodeRef={ anchorNodeRef }
|
|
321
|
-
blockTitle={ blockTitle }
|
|
322
|
-
pickerRef={ blockTransformationMenuPickerRef }
|
|
323
|
-
possibleTransformations={ selectedBlockPossibleTransformations }
|
|
324
|
-
selectedBlock={ getBlocksByClientId( selectedBlockClientId ) }
|
|
325
|
-
selectedBlockClientId={ selectedBlockClientId }
|
|
326
|
-
/>
|
|
327
|
-
</ToolbarGroup>
|
|
328
|
-
);
|
|
329
|
-
};
|
|
330
|
-
|
|
331
|
-
const EMPTY_BLOCK_LIST = [];
|
|
332
|
-
|
|
333
|
-
export default compose(
|
|
334
|
-
withSelect( ( select, { clientId } ) => {
|
|
335
|
-
const {
|
|
336
|
-
getBlockIndex,
|
|
337
|
-
getBlockRootClientId,
|
|
338
|
-
getBlockOrder,
|
|
339
|
-
getBlockName,
|
|
340
|
-
getBlockTransformItems,
|
|
341
|
-
getBlock,
|
|
342
|
-
getBlocksByClientId,
|
|
343
|
-
getSelectedBlockClientIds,
|
|
344
|
-
canInsertBlockType,
|
|
345
|
-
getTemplateLock,
|
|
346
|
-
} = select( blockEditorStore );
|
|
347
|
-
const block = getBlock( clientId );
|
|
348
|
-
const blockName = getBlockName( clientId );
|
|
349
|
-
const blockType = getBlockType( blockName );
|
|
350
|
-
const blockTitle = blockType?.title;
|
|
351
|
-
const rootClientId = getBlockRootClientId( clientId );
|
|
352
|
-
const blockOrder = getBlockOrder( rootClientId );
|
|
353
|
-
|
|
354
|
-
const currentBlockIndex = getBlockIndex( clientId );
|
|
355
|
-
const isFirst = currentBlockIndex === 0;
|
|
356
|
-
const isLast = currentBlockIndex === blockOrder.length - 1;
|
|
357
|
-
|
|
358
|
-
const innerBlocks = getBlocksByClientId( clientId );
|
|
359
|
-
|
|
360
|
-
const canDuplicate = innerBlocks.every( ( innerBlock ) => {
|
|
361
|
-
return (
|
|
362
|
-
!! innerBlock &&
|
|
363
|
-
hasBlockSupport( innerBlock.name, 'multiple', true ) &&
|
|
364
|
-
canInsertBlockType( innerBlock.name, rootClientId )
|
|
365
|
-
);
|
|
366
|
-
} );
|
|
367
|
-
|
|
368
|
-
const isDefaultBlock = blockName === getDefaultBlockName();
|
|
369
|
-
const isEmptyContent = block?.attributes.content === '';
|
|
370
|
-
const isExactlyOneBlock = blockOrder.length === 1;
|
|
371
|
-
const isEmptyDefaultBlock =
|
|
372
|
-
isExactlyOneBlock && isDefaultBlock && isEmptyContent;
|
|
373
|
-
const isLocked = !! getTemplateLock( rootClientId );
|
|
374
|
-
|
|
375
|
-
const selectedBlockClientId = getSelectedBlockClientIds()[ 0 ];
|
|
376
|
-
const selectedBlock = selectedBlockClientId
|
|
377
|
-
? getBlocksByClientId( selectedBlockClientId )[ 0 ]
|
|
378
|
-
: undefined;
|
|
379
|
-
const selectedBlockPossibleTransformations = selectedBlock
|
|
380
|
-
? getBlockTransformItems( selectedBlock, rootClientId )
|
|
381
|
-
: EMPTY_BLOCK_LIST;
|
|
382
|
-
|
|
383
|
-
const isReusableBlockType = block ? isReusableBlock( block ) : false;
|
|
384
|
-
const reusableBlock = isReusableBlockType
|
|
385
|
-
? select( coreStore ).getEntityRecord(
|
|
386
|
-
'postType',
|
|
387
|
-
'wp_block',
|
|
388
|
-
block?.attributes.ref
|
|
389
|
-
)
|
|
390
|
-
: undefined;
|
|
391
|
-
|
|
392
|
-
return {
|
|
393
|
-
blockTitle,
|
|
394
|
-
canInsertBlockType,
|
|
395
|
-
currentIndex: currentBlockIndex,
|
|
396
|
-
getBlocksByClientId,
|
|
397
|
-
isEmptyDefaultBlock,
|
|
398
|
-
isLocked,
|
|
399
|
-
canDuplicate,
|
|
400
|
-
isFirst,
|
|
401
|
-
isLast,
|
|
402
|
-
isReusableBlockType,
|
|
403
|
-
reusableBlock,
|
|
404
|
-
rootClientId,
|
|
405
|
-
selectedBlockClientId,
|
|
406
|
-
selectedBlockPossibleTransformations,
|
|
407
|
-
};
|
|
408
|
-
} ),
|
|
409
|
-
withDispatch(
|
|
410
|
-
(
|
|
411
|
-
dispatch,
|
|
412
|
-
{ clientId, rootClientId, currentIndex, selectedBlockClientId },
|
|
413
|
-
{ select }
|
|
414
|
-
) => {
|
|
415
|
-
const {
|
|
416
|
-
moveBlocksDown,
|
|
417
|
-
moveBlocksUp,
|
|
418
|
-
duplicateBlocks,
|
|
419
|
-
removeBlocks,
|
|
420
|
-
insertBlock,
|
|
421
|
-
replaceBlock,
|
|
422
|
-
clearSelectedBlock,
|
|
423
|
-
} = dispatch( blockEditorStore );
|
|
424
|
-
const { openGeneralSidebar } = dispatch( 'core/edit-post' );
|
|
425
|
-
const { getBlockSelectionEnd, getBlock } =
|
|
426
|
-
select( blockEditorStore );
|
|
427
|
-
const { createSuccessNotice } = dispatch( noticesStore );
|
|
428
|
-
|
|
429
|
-
const { __experimentalConvertBlockToStatic: convertBlockToStatic } =
|
|
430
|
-
dispatch( reusableBlocksStore );
|
|
431
|
-
|
|
432
|
-
return {
|
|
433
|
-
createSuccessNotice,
|
|
434
|
-
convertToRegularBlocks() {
|
|
435
|
-
clearSelectedBlock();
|
|
436
|
-
// Convert action is executed at the end of the current JavaScript execution block
|
|
437
|
-
// to prevent issues related to undo/redo actions.
|
|
438
|
-
setImmediate( () =>
|
|
439
|
-
convertBlockToStatic( selectedBlockClientId )
|
|
440
|
-
);
|
|
441
|
-
},
|
|
442
|
-
duplicateBlock() {
|
|
443
|
-
return duplicateBlocks( [ clientId ] );
|
|
444
|
-
},
|
|
445
|
-
onMoveDown: ( ...args ) =>
|
|
446
|
-
moveBlocksDown( [ clientId ], rootClientId, ...args ),
|
|
447
|
-
onMoveUp: ( ...args ) =>
|
|
448
|
-
moveBlocksUp( [ clientId ], rootClientId, ...args ),
|
|
449
|
-
openGeneralSidebar: () =>
|
|
450
|
-
openGeneralSidebar( 'edit-post/block' ),
|
|
451
|
-
pasteBlock: ( clipboardBlock ) => {
|
|
452
|
-
const canReplaceBlock = isUnmodifiedDefaultBlock(
|
|
453
|
-
getBlock( getBlockSelectionEnd() )
|
|
454
|
-
);
|
|
455
|
-
|
|
456
|
-
if ( ! canReplaceBlock ) {
|
|
457
|
-
const insertedBlock = createBlock(
|
|
458
|
-
clipboardBlock.name,
|
|
459
|
-
clipboardBlock.attributes,
|
|
460
|
-
clipboardBlock.innerBlocks
|
|
461
|
-
);
|
|
462
|
-
|
|
463
|
-
insertBlock(
|
|
464
|
-
insertedBlock,
|
|
465
|
-
currentIndex + 1,
|
|
466
|
-
rootClientId
|
|
467
|
-
);
|
|
468
|
-
} else {
|
|
469
|
-
replaceBlock( clientId, clipboardBlock );
|
|
470
|
-
}
|
|
471
|
-
},
|
|
472
|
-
removeBlocks,
|
|
473
|
-
};
|
|
474
|
-
}
|
|
475
|
-
),
|
|
476
|
-
withInstanceId
|
|
477
|
-
)( BlockActionsMenu );
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { useSelect, useDispatch } from '@wordpress/data';
|
|
5
|
-
import { useCallback } from '@wordpress/element';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Internal dependencies
|
|
9
|
-
*/
|
|
10
|
-
import BlockActionsMenu from './block-toolbar-menu';
|
|
11
|
-
import BlockControls from '../block-controls';
|
|
12
|
-
import BlockMover from '../block-mover';
|
|
13
|
-
import UngroupButton from '../ungroup-button';
|
|
14
|
-
import { BlockSettingsButton } from '../block-settings';
|
|
15
|
-
import { store as blockEditorStore } from '../../store';
|
|
16
|
-
|
|
17
|
-
const REMOVE_EMPTY_PARENT_BLOCKS = [
|
|
18
|
-
'core/buttons',
|
|
19
|
-
'core/columns',
|
|
20
|
-
'core/social-links',
|
|
21
|
-
];
|
|
22
|
-
|
|
23
|
-
export default function BlockToolbar( { anchorNodeRef } ) {
|
|
24
|
-
const {
|
|
25
|
-
rootClientId,
|
|
26
|
-
blockClientId,
|
|
27
|
-
isSelected,
|
|
28
|
-
isValidAndVisual,
|
|
29
|
-
isStackedHorizontally,
|
|
30
|
-
parentBlockName,
|
|
31
|
-
parentNumberOfInnerBlocks,
|
|
32
|
-
} = useSelect( ( select ) => {
|
|
33
|
-
const {
|
|
34
|
-
getBlockListSettings,
|
|
35
|
-
getBlockMode,
|
|
36
|
-
getBlockName,
|
|
37
|
-
getBlockCount,
|
|
38
|
-
getBlockRootClientId,
|
|
39
|
-
getSelectedBlockClientIds,
|
|
40
|
-
isBlockValid,
|
|
41
|
-
} = select( blockEditorStore );
|
|
42
|
-
const selectedBlockClientIds = getSelectedBlockClientIds();
|
|
43
|
-
const selectedBlockClientId = selectedBlockClientIds[ 0 ];
|
|
44
|
-
const blockRootClientId = getBlockRootClientId( selectedBlockClientId );
|
|
45
|
-
const blockListSettings = getBlockListSettings( blockRootClientId );
|
|
46
|
-
const orientation = blockListSettings?.orientation;
|
|
47
|
-
const isBlockStackedHorizontally = orientation === 'horizontal';
|
|
48
|
-
const parentName = getBlockName( blockRootClientId );
|
|
49
|
-
const numberOfInnerBlocks = getBlockCount( blockRootClientId );
|
|
50
|
-
|
|
51
|
-
return {
|
|
52
|
-
rootClientId: blockRootClientId,
|
|
53
|
-
blockClientId: selectedBlockClientId,
|
|
54
|
-
isSelected: selectedBlockClientIds.length > 0,
|
|
55
|
-
isStackedHorizontally: isBlockStackedHorizontally,
|
|
56
|
-
parentBlockName: parentName,
|
|
57
|
-
parentNumberOfInnerBlocks: numberOfInnerBlocks,
|
|
58
|
-
isValidAndVisual:
|
|
59
|
-
selectedBlockClientIds.length === 1
|
|
60
|
-
? isBlockValid( selectedBlockClientIds[ 0 ] ) &&
|
|
61
|
-
getBlockMode( selectedBlockClientIds[ 0 ] ) === 'visual'
|
|
62
|
-
: false,
|
|
63
|
-
};
|
|
64
|
-
}, [] );
|
|
65
|
-
|
|
66
|
-
const { removeBlock } = useDispatch( blockEditorStore );
|
|
67
|
-
const onRemove = useCallback( () => {
|
|
68
|
-
// Temp: remove parent block for specific cases where they don't
|
|
69
|
-
// have inner blocks, ideally we should match the behavior as in
|
|
70
|
-
// the Web editor and show a placeholder instead of removing the parent.
|
|
71
|
-
if (
|
|
72
|
-
REMOVE_EMPTY_PARENT_BLOCKS.includes( parentBlockName ) &&
|
|
73
|
-
parentNumberOfInnerBlocks === 1
|
|
74
|
-
) {
|
|
75
|
-
removeBlock( rootClientId );
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
removeBlock( blockClientId );
|
|
80
|
-
}, [
|
|
81
|
-
blockClientId,
|
|
82
|
-
parentBlockName,
|
|
83
|
-
parentNumberOfInnerBlocks,
|
|
84
|
-
removeBlock,
|
|
85
|
-
rootClientId,
|
|
86
|
-
] );
|
|
87
|
-
|
|
88
|
-
if ( ! isSelected ) {
|
|
89
|
-
return null;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
return (
|
|
93
|
-
<>
|
|
94
|
-
{ isValidAndVisual && (
|
|
95
|
-
<>
|
|
96
|
-
<BlockSettingsButton.Slot>
|
|
97
|
-
{ /* Render only one settings icon even if we have more than one fill - need for hooks with controls. */ }
|
|
98
|
-
{ ( fills = [ null ] ) => {
|
|
99
|
-
if ( ! fills?.length > 0 ) {
|
|
100
|
-
return null;
|
|
101
|
-
}
|
|
102
|
-
return fills[ 0 ];
|
|
103
|
-
} }
|
|
104
|
-
</BlockSettingsButton.Slot>
|
|
105
|
-
<BlockControls.Slot group="block" />
|
|
106
|
-
<BlockControls.Slot />
|
|
107
|
-
<BlockControls.Slot group="inline" />
|
|
108
|
-
<BlockControls.Slot group="other" />
|
|
109
|
-
<UngroupButton />
|
|
110
|
-
|
|
111
|
-
<BlockMover
|
|
112
|
-
clientIds={ [ blockClientId ] }
|
|
113
|
-
isStackedHorizontally={ isStackedHorizontally }
|
|
114
|
-
/>
|
|
115
|
-
|
|
116
|
-
<BlockActionsMenu
|
|
117
|
-
clientId={ blockClientId }
|
|
118
|
-
isStackedHorizontally={ isStackedHorizontally }
|
|
119
|
-
onDelete={ onRemove }
|
|
120
|
-
anchorNodeRef={ anchorNodeRef }
|
|
121
|
-
/>
|
|
122
|
-
</>
|
|
123
|
-
) }
|
|
124
|
-
</>
|
|
125
|
-
);
|
|
126
|
-
}
|