@wordpress/block-editor 12.24.0 → 12.25.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 +2 -0
- package/README.md +1 -1
- package/build/components/alignment-control/ui.js +3 -1
- package/build/components/alignment-control/ui.js.map +1 -1
- package/build/components/block-inspector/index.js +1 -1
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list/block.js +0 -9
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/index.js +4 -3
- package/build/components/block-list/index.js.map +1 -1
- package/build/components/block-list/index.native.js +1 -9
- package/build/components/block-list/index.native.js.map +1 -1
- package/build/components/block-list/use-block-props/index.js +6 -6
- package/build/components/block-list/use-block-props/index.js.map +1 -1
- package/build/components/block-list/use-block-props/use-block-refs.js +17 -46
- package/build/components/block-list/use-block-props/use-block-refs.js.map +1 -1
- package/build/components/block-list/use-block-props/use-is-hovered.js +10 -14
- package/build/components/block-list/use-block-props/use-is-hovered.js.map +1 -1
- package/build/components/block-mover/index.native.js +3 -1
- package/build/components/block-mover/index.native.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +0 -25
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-switcher/pattern-transformations-menu.js +3 -1
- package/build/components/block-switcher/pattern-transformations-menu.js.map +1 -1
- package/build/components/block-switcher/use-transformed-patterns.js +6 -2
- package/build/components/block-switcher/use-transformed-patterns.js.map +1 -1
- package/build/components/block-switcher/utils.js +15 -5
- package/build/components/block-switcher/utils.js.map +1 -1
- package/build/components/block-toolbar/use-has-block-toolbar.js +14 -9
- package/build/components/block-toolbar/use-has-block-toolbar.js.map +1 -1
- package/build/components/block-tools/index.js +3 -1
- package/build/components/block-tools/index.js.map +1 -1
- package/build/components/block-tools/use-show-block-tools.js +2 -5
- package/build/components/block-tools/use-show-block-tools.js.map +1 -1
- package/build/components/block-tools/zoom-out-mode-inserters.js +5 -1
- package/build/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
- package/build/components/block-variation-picker/index.js +3 -2
- package/build/components/block-variation-picker/index.js.map +1 -1
- package/build/components/block-variation-transforms/index.js +3 -1
- package/build/components/block-variation-transforms/index.js.map +1 -1
- package/build/components/floating-toolbar/index.native.js +9 -5
- package/build/components/floating-toolbar/index.native.js.map +1 -1
- package/build/components/global-styles/background-panel.js +1 -1
- package/build/components/global-styles/background-panel.js.map +1 -1
- package/build/components/global-styles/color-panel.js +3 -1
- package/build/components/global-styles/color-panel.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +16 -0
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/hooks.js +3 -2
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +23 -23
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +149 -132
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js +45 -0
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/inner-blocks/index.js +16 -2
- package/build/components/inner-blocks/index.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/index.js +12 -31
- package/build/components/inserter/block-patterns-tab/index.js.map +1 -1
- package/build/components/inserter/block-types-tab.js +4 -0
- package/build/components/inserter/block-types-tab.js.map +1 -1
- package/build/components/inserter/category-tabs/index.js +56 -0
- package/build/components/inserter/category-tabs/index.js.map +1 -0
- package/build/components/inserter/media-tab/index.js +2 -2
- package/build/components/inserter/media-tab/index.js.map +1 -1
- package/build/components/inserter/media-tab/media-panel.js +0 -25
- package/build/components/inserter/media-tab/media-panel.js.map +1 -1
- package/build/components/inserter/media-tab/media-preview.js +13 -3
- package/build/components/inserter/media-tab/media-preview.js.map +1 -1
- package/build/components/inserter/media-tab/media-tab.js +15 -29
- package/build/components/inserter/media-tab/media-tab.js.map +1 -1
- package/build/components/inserter/menu.js +59 -69
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/tabs.js +6 -6
- package/build/components/inserter/tabs.js.map +1 -1
- package/build/components/line-height-control/index.js +6 -2
- package/build/components/line-height-control/index.js.map +1 -1
- package/build/components/link-control/search-item.js +9 -3
- package/build/components/link-control/search-item.js.map +1 -1
- package/build/components/list-view/block-select-button.js +5 -170
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/list-view/block.js +166 -14
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/index.js +1 -1
- package/build/components/list-view/index.js.map +1 -1
- package/build/components/list-view/use-list-view-drop-zone.js +1 -1
- package/build/components/list-view/use-list-view-drop-zone.js.map +1 -1
- package/build/components/list-view/utils.js +3 -1
- package/build/components/list-view/utils.js.map +1 -1
- package/build/components/media-placeholder/index.js +3 -3
- package/build/components/media-placeholder/index.js.map +1 -1
- package/build/components/navigable-toolbar/index.js +3 -1
- package/build/components/navigable-toolbar/index.js.map +1 -1
- package/build/components/provider/block-refs-provider.js +3 -4
- package/build/components/provider/block-refs-provider.js.map +1 -1
- package/build/components/provider/use-block-sync.js +3 -12
- package/build/components/provider/use-block-sync.js.map +1 -1
- package/build/components/rich-text/event-listeners/before-input-rules.js +93 -0
- package/build/components/rich-text/event-listeners/before-input-rules.js.map +1 -0
- package/build/components/rich-text/event-listeners/delete.js +58 -0
- package/build/components/rich-text/event-listeners/delete.js.map +1 -0
- package/build/components/rich-text/event-listeners/enter.js +98 -0
- package/build/components/rich-text/event-listeners/enter.js.map +1 -0
- package/build/components/rich-text/event-listeners/firefox-compat.js +36 -0
- package/build/components/rich-text/event-listeners/firefox-compat.js.map +1 -0
- package/build/components/rich-text/event-listeners/index.js +44 -0
- package/build/components/rich-text/event-listeners/index.js.map +1 -0
- package/build/components/rich-text/event-listeners/input-events.js +22 -0
- package/build/components/rich-text/event-listeners/input-events.js.map +1 -0
- package/build/components/rich-text/event-listeners/input-rules.js +135 -0
- package/build/components/rich-text/event-listeners/input-rules.js.map +1 -0
- package/build/components/rich-text/event-listeners/insert-replacement-text.js +33 -0
- package/build/components/rich-text/event-listeners/insert-replacement-text.js.map +1 -0
- package/build/components/rich-text/event-listeners/paste-handler.js +146 -0
- package/build/components/rich-text/event-listeners/paste-handler.js.map +1 -0
- package/build/components/rich-text/event-listeners/remove-browser-shortcuts.js +27 -0
- package/build/components/rich-text/event-listeners/remove-browser-shortcuts.js.map +1 -0
- package/build/components/rich-text/event-listeners/shortcuts.js +22 -0
- package/build/components/rich-text/event-listeners/shortcuts.js.map +1 -0
- package/build/components/rich-text/event-listeners/undo-automatic-change.js +51 -0
- package/build/components/rich-text/event-listeners/undo-automatic-change.js.map +1 -0
- package/build/components/rich-text/index.js +11 -31
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/index.native.js +13 -3
- package/build/components/rich-text/index.native.js.map +1 -1
- package/build/components/rich-text/multiline.js +6 -2
- package/build/components/rich-text/multiline.js.map +1 -1
- package/build/components/rich-text/native/index.native.js +12 -0
- package/build/components/rich-text/native/index.native.js.map +1 -1
- package/build/components/rich-text/use-format-types.js +8 -4
- package/build/components/rich-text/use-format-types.js.map +1 -1
- package/build/components/segmented-text-control/index.js +62 -0
- package/build/components/segmented-text-control/index.js.map +1 -0
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js +16 -2
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build/components/text-alignment-control/index.js +76 -0
- package/build/components/text-alignment-control/index.js.map +1 -0
- package/build/components/text-decoration-control/index.js +21 -25
- package/build/components/text-decoration-control/index.js.map +1 -1
- package/build/components/text-transform-control/index.js +18 -22
- package/build/components/text-transform-control/index.js.map +1 -1
- package/build/components/use-block-display-information/index.js +9 -3
- package/build/components/use-block-display-information/index.js.map +1 -1
- package/build/components/use-on-block-drop/index.js +3 -1
- package/build/components/use-on-block-drop/index.js.map +1 -1
- package/build/components/writing-flow/use-drag-selection.js +3 -1
- package/build/components/writing-flow/use-drag-selection.js.map +1 -1
- package/build/components/writing-flow/use-tab-nav.js +3 -1
- package/build/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build/components/writing-mode-control/index.js +16 -20
- package/build/components/writing-mode-control/index.js.map +1 -1
- package/build/hooks/duotone.js +3 -1
- package/build/hooks/duotone.js.map +1 -1
- package/build/hooks/utils.js +11 -6
- package/build/hooks/utils.js.map +1 -1
- package/build/private-apis.js +4 -2
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +32 -8
- package/build/store/actions.js.map +1 -1
- package/build/store/private-selectors.js +27 -6
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +11 -8
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +21 -7
- package/build/store/selectors.js.map +1 -1
- package/build/utils/object.js +17 -0
- package/build/utils/object.js.map +1 -1
- package/build/utils/order-inserter-block-items.js +6 -2
- package/build/utils/order-inserter-block-items.js.map +1 -1
- package/build/utils/pasting.js +6 -2
- package/build/utils/pasting.js.map +1 -1
- package/build-module/components/alignment-control/ui.js +3 -1
- package/build-module/components/alignment-control/ui.js.map +1 -1
- package/build-module/components/block-inspector/index.js +1 -1
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list/block.js +0 -9
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/index.js +4 -3
- package/build-module/components/block-list/index.js.map +1 -1
- package/build-module/components/block-list/index.native.js +1 -9
- package/build-module/components/block-list/index.native.js.map +1 -1
- package/build-module/components/block-list/use-block-props/index.js +6 -6
- package/build-module/components/block-list/use-block-props/index.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-block-refs.js +19 -48
- package/build-module/components/block-list/use-block-props/use-block-refs.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-is-hovered.js +10 -14
- package/build-module/components/block-list/use-block-props/use-is-hovered.js.map +1 -1
- package/build-module/components/block-mover/index.native.js +3 -1
- package/build-module/components/block-mover/index.native.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +1 -26
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-switcher/pattern-transformations-menu.js +3 -1
- package/build-module/components/block-switcher/pattern-transformations-menu.js.map +1 -1
- package/build-module/components/block-switcher/use-transformed-patterns.js +6 -2
- package/build-module/components/block-switcher/use-transformed-patterns.js.map +1 -1
- package/build-module/components/block-switcher/utils.js +15 -5
- package/build-module/components/block-switcher/utils.js.map +1 -1
- package/build-module/components/block-toolbar/use-has-block-toolbar.js +14 -9
- package/build-module/components/block-toolbar/use-has-block-toolbar.js.map +1 -1
- package/build-module/components/block-tools/index.js +3 -1
- package/build-module/components/block-tools/index.js.map +1 -1
- package/build-module/components/block-tools/use-show-block-tools.js +2 -5
- package/build-module/components/block-tools/use-show-block-tools.js.map +1 -1
- package/build-module/components/block-tools/zoom-out-mode-inserters.js +5 -1
- package/build-module/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
- package/build-module/components/block-variation-picker/index.js +3 -2
- package/build-module/components/block-variation-picker/index.js.map +1 -1
- package/build-module/components/block-variation-transforms/index.js +3 -1
- package/build-module/components/block-variation-transforms/index.js.map +1 -1
- package/build-module/components/floating-toolbar/index.native.js +9 -5
- package/build-module/components/floating-toolbar/index.native.js.map +1 -1
- package/build-module/components/global-styles/background-panel.js +1 -1
- package/build-module/components/global-styles/background-panel.js.map +1 -1
- package/build-module/components/global-styles/color-panel.js +3 -1
- package/build-module/components/global-styles/color-panel.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +17 -1
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +3 -2
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +24 -24
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +149 -132
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js +44 -0
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/inner-blocks/index.js +16 -2
- package/build-module/components/inner-blocks/index.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/index.js +13 -32
- package/build-module/components/inserter/block-patterns-tab/index.js.map +1 -1
- package/build-module/components/inserter/block-types-tab.js +4 -0
- package/build-module/components/inserter/block-types-tab.js.map +1 -1
- package/build-module/components/inserter/category-tabs/index.js +49 -0
- package/build-module/components/inserter/category-tabs/index.js.map +1 -0
- package/build-module/components/inserter/media-tab/index.js +1 -1
- package/build-module/components/inserter/media-tab/index.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-panel.js +0 -24
- package/build-module/components/inserter/media-tab/media-panel.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-preview.js +13 -3
- package/build-module/components/inserter/media-tab/media-preview.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-tab.js +17 -31
- package/build-module/components/inserter/media-tab/media-tab.js.map +1 -1
- package/build-module/components/inserter/menu.js +61 -71
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/tabs.js +6 -6
- package/build-module/components/inserter/tabs.js.map +1 -1
- package/build-module/components/line-height-control/index.js +6 -2
- package/build-module/components/line-height-control/index.js.map +1 -1
- package/build-module/components/link-control/search-item.js +9 -3
- package/build-module/components/link-control/search-item.js.map +1 -1
- package/build-module/components/list-view/block-select-button.js +7 -172
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/list-view/block.js +167 -15
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/index.js +1 -1
- package/build-module/components/list-view/index.js.map +1 -1
- package/build-module/components/list-view/use-list-view-drop-zone.js +1 -1
- package/build-module/components/list-view/use-list-view-drop-zone.js.map +1 -1
- package/build-module/components/list-view/utils.js +3 -1
- package/build-module/components/list-view/utils.js.map +1 -1
- package/build-module/components/media-placeholder/index.js +3 -3
- package/build-module/components/media-placeholder/index.js.map +1 -1
- package/build-module/components/navigable-toolbar/index.js +3 -1
- package/build-module/components/navigable-toolbar/index.js.map +1 -1
- package/build-module/components/provider/block-refs-provider.js +3 -4
- package/build-module/components/provider/block-refs-provider.js.map +1 -1
- package/build-module/components/provider/use-block-sync.js +4 -13
- package/build-module/components/provider/use-block-sync.js.map +1 -1
- package/build-module/components/rich-text/event-listeners/before-input-rules.js +86 -0
- package/build-module/components/rich-text/event-listeners/before-input-rules.js.map +1 -0
- package/build-module/components/rich-text/event-listeners/delete.js +51 -0
- package/build-module/components/rich-text/event-listeners/delete.js.map +1 -0
- package/build-module/components/rich-text/event-listeners/enter.js +92 -0
- package/build-module/components/rich-text/event-listeners/enter.js.map +1 -0
- package/build-module/components/rich-text/event-listeners/firefox-compat.js +29 -0
- package/build-module/components/rich-text/event-listeners/firefox-compat.js.map +1 -0
- package/build-module/components/rich-text/event-listeners/index.js +36 -0
- package/build-module/components/rich-text/event-listeners/index.js.map +1 -0
- package/build-module/components/rich-text/event-listeners/input-events.js +15 -0
- package/build-module/components/rich-text/event-listeners/input-events.js.map +1 -0
- package/build-module/components/rich-text/event-listeners/input-rules.js +127 -0
- package/build-module/components/rich-text/event-listeners/input-rules.js.map +1 -0
- package/build-module/components/rich-text/event-listeners/insert-replacement-text.js +27 -0
- package/build-module/components/rich-text/event-listeners/insert-replacement-text.js.map +1 -0
- package/build-module/components/rich-text/event-listeners/paste-handler.js +142 -0
- package/build-module/components/rich-text/event-listeners/paste-handler.js.map +1 -0
- package/build-module/components/rich-text/event-listeners/remove-browser-shortcuts.js +21 -0
- package/build-module/components/rich-text/event-listeners/remove-browser-shortcuts.js.map +1 -0
- package/build-module/components/rich-text/event-listeners/shortcuts.js +15 -0
- package/build-module/components/rich-text/event-listeners/shortcuts.js.map +1 -0
- package/build-module/components/rich-text/event-listeners/undo-automatic-change.js +45 -0
- package/build-module/components/rich-text/event-listeners/undo-automatic-change.js.map +1 -0
- package/build-module/components/rich-text/index.js +12 -32
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/index.native.js +13 -3
- package/build-module/components/rich-text/index.native.js.map +1 -1
- package/build-module/components/rich-text/multiline.js +6 -2
- package/build-module/components/rich-text/multiline.js.map +1 -1
- package/build-module/components/rich-text/native/index.native.js +12 -0
- package/build-module/components/rich-text/native/index.native.js.map +1 -1
- package/build-module/components/rich-text/use-format-types.js +8 -4
- package/build-module/components/rich-text/use-format-types.js.map +1 -1
- package/build-module/components/segmented-text-control/index.js +55 -0
- package/build-module/components/segmented-text-control/index.js.map +1 -0
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js +16 -2
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build-module/components/text-alignment-control/index.js +68 -0
- package/build-module/components/text-alignment-control/index.js.map +1 -0
- package/build-module/components/text-decoration-control/index.js +21 -25
- package/build-module/components/text-decoration-control/index.js.map +1 -1
- package/build-module/components/text-transform-control/index.js +18 -22
- package/build-module/components/text-transform-control/index.js.map +1 -1
- package/build-module/components/use-block-display-information/index.js +9 -3
- package/build-module/components/use-block-display-information/index.js.map +1 -1
- package/build-module/components/use-on-block-drop/index.js +3 -1
- package/build-module/components/use-on-block-drop/index.js.map +1 -1
- package/build-module/components/writing-flow/use-drag-selection.js +3 -1
- package/build-module/components/writing-flow/use-drag-selection.js.map +1 -1
- package/build-module/components/writing-flow/use-tab-nav.js +3 -1
- package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build-module/components/writing-mode-control/index.js +16 -20
- package/build-module/components/writing-mode-control/index.js.map +1 -1
- package/build-module/hooks/duotone.js +3 -1
- package/build-module/hooks/duotone.js.map +1 -1
- package/build-module/hooks/utils.js +11 -6
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/private-apis.js +4 -2
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/actions.js +32 -8
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/private-selectors.js +27 -5
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +11 -8
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +21 -7
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/object.js +16 -0
- package/build-module/utils/object.js.map +1 -1
- package/build-module/utils/order-inserter-block-items.js +6 -2
- package/build-module/utils/order-inserter-block-items.js.map +1 -1
- package/build-module/utils/pasting.js +6 -2
- package/build-module/utils/pasting.js.map +1 -1
- package/build-style/content-rtl.css +41 -68
- package/build-style/content.css +41 -68
- package/build-style/style-rtl.css +100 -199
- package/build-style/style.css +100 -199
- package/package.json +31 -31
- package/src/components/alignment-control/ui.js +3 -1
- package/src/components/block-bindings-toolbar-indicator/style.scss +1 -4
- package/src/components/block-canvas/style.scss +1 -3
- package/src/components/block-draggable/test/helpers.native.js +8 -8
- package/src/components/block-inspector/index.js +1 -2
- package/src/components/block-list/block.js +2 -13
- package/src/components/block-list/content.scss +9 -1
- package/src/components/block-list/index.js +4 -4
- package/src/components/block-list/index.native.js +1 -6
- package/src/components/block-list/use-block-props/index.js +12 -4
- package/src/components/block-list/use-block-props/use-block-refs.js +17 -57
- package/src/components/block-list/use-block-props/use-is-hovered.js +11 -16
- package/src/components/block-mover/index.native.js +3 -1
- package/src/components/block-patterns-list/style.scss +1 -3
- package/src/components/block-preview/style.scss +13 -15
- package/src/components/block-settings-menu/block-settings-dropdown.js +1 -51
- package/src/components/block-switcher/pattern-transformations-menu.js +3 -1
- package/src/components/block-switcher/use-transformed-patterns.js +6 -2
- package/src/components/block-switcher/utils.js +14 -5
- package/src/components/block-toolbar/style.scss +8 -11
- package/src/components/block-toolbar/use-has-block-toolbar.js +21 -16
- package/src/components/block-tools/index.js +3 -1
- package/src/components/block-tools/use-show-block-tools.js +36 -48
- package/src/components/block-tools/zoom-out-mode-inserters.js +5 -1
- package/src/components/block-variation-picker/content.scss +22 -72
- package/src/components/block-variation-picker/index.js +3 -2
- package/src/components/block-variation-transforms/index.js +3 -1
- package/src/components/floating-toolbar/index.native.js +5 -2
- package/src/components/global-styles/background-panel.js +1 -3
- package/src/components/global-styles/color-panel.js +3 -1
- package/src/components/global-styles/dimensions-panel.js +18 -1
- package/src/components/global-styles/hooks.js +2 -0
- package/src/components/global-styles/test/utils.js +21 -0
- package/src/components/global-styles/typography-panel.js +27 -23
- package/src/components/global-styles/use-global-styles-output.js +211 -187
- package/src/components/global-styles/utils.js +55 -0
- package/src/components/inner-blocks/index.js +14 -1
- package/src/components/inserter/block-patterns-tab/index.js +15 -65
- package/src/components/inserter/block-types-tab.js +5 -0
- package/src/components/inserter/category-tabs/index.js +74 -0
- package/src/components/inserter/media-tab/index.js +1 -1
- package/src/components/inserter/media-tab/media-panel.js +0 -22
- package/src/components/inserter/media-tab/media-preview.js +15 -7
- package/src/components/inserter/media-tab/media-tab.js +44 -83
- package/src/components/inserter/menu.js +139 -117
- package/src/components/inserter/style.scss +90 -170
- package/src/components/inserter/tabs.js +5 -13
- package/src/components/line-height-control/index.js +6 -2
- package/src/components/link-control/search-item.js +9 -3
- package/src/components/list-view/block-select-button.js +73 -266
- package/src/components/list-view/block.js +218 -28
- package/src/components/list-view/index.js +1 -1
- package/src/components/list-view/style.scss +20 -28
- package/src/components/list-view/use-list-view-drop-zone.js +1 -1
- package/src/components/list-view/utils.js +3 -1
- package/src/components/media-placeholder/content.scss +0 -11
- package/src/components/media-placeholder/index.js +3 -3
- package/src/components/navigable-toolbar/index.js +3 -1
- package/src/components/provider/block-refs-provider.js +3 -8
- package/src/components/provider/test/use-block-sync.js +7 -0
- package/src/components/provider/use-block-sync.js +3 -20
- package/src/components/rich-text/event-listeners/before-input-rules.js +92 -0
- package/src/components/rich-text/event-listeners/delete.js +53 -0
- package/src/components/rich-text/event-listeners/enter.js +104 -0
- package/src/components/rich-text/event-listeners/firefox-compat.js +31 -0
- package/src/components/rich-text/event-listeners/index.js +56 -0
- package/src/components/rich-text/event-listeners/input-events.js +13 -0
- package/src/components/rich-text/event-listeners/input-rules.js +146 -0
- package/src/components/rich-text/event-listeners/insert-replacement-text.js +28 -0
- package/src/components/rich-text/event-listeners/paste-handler.js +169 -0
- package/src/components/rich-text/event-listeners/remove-browser-shortcuts.js +24 -0
- package/src/components/rich-text/event-listeners/shortcuts.js +13 -0
- package/src/components/rich-text/event-listeners/undo-automatic-change.js +45 -0
- package/src/components/rich-text/index.js +7 -34
- package/src/components/rich-text/index.native.js +11 -0
- package/src/components/rich-text/multiline.js +6 -2
- package/src/components/rich-text/native/index.native.js +11 -0
- package/src/components/rich-text/use-format-types.js +6 -2
- package/src/components/segmented-text-control/index.js +63 -0
- package/src/components/{writing-mode-control → segmented-text-control}/style.scss +2 -5
- package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +16 -1
- package/src/components/text-alignment-control/index.js +91 -0
- package/src/components/text-alignment-control/stories/index.story.js +39 -0
- package/src/components/text-decoration-control/index.js +20 -33
- package/src/components/text-transform-control/index.js +17 -30
- package/src/components/use-block-display-information/index.js +9 -3
- package/src/components/use-on-block-drop/index.js +3 -1
- package/src/components/writing-flow/use-drag-selection.js +3 -1
- package/src/components/writing-flow/use-tab-nav.js +3 -1
- package/src/components/writing-mode-control/index.js +15 -28
- package/src/hooks/duotone.js +3 -1
- package/src/hooks/utils.js +16 -2
- package/src/private-apis.js +4 -2
- package/src/store/actions.js +36 -12
- package/src/store/private-selectors.js +28 -4
- package/src/store/reducer.js +13 -23
- package/src/store/selectors.js +20 -7
- package/src/style.scss +1 -2
- package/src/utils/object.js +16 -0
- package/src/utils/order-inserter-block-items.js +6 -2
- package/src/utils/pasting.js +6 -2
- package/build/components/block-list/use-block-props/use-block-moving-mode-class-names.js +0 -54
- package/build/components/block-list/use-block-props/use-block-moving-mode-class-names.js.map +0 -1
- package/build/components/rich-text/use-before-input-rules.js +0 -98
- package/build/components/rich-text/use-before-input-rules.js.map +0 -1
- package/build/components/rich-text/use-delete.js +0 -64
- package/build/components/rich-text/use-delete.js.map +0 -1
- package/build/components/rich-text/use-enter.js +0 -109
- package/build/components/rich-text/use-enter.js.map +0 -1
- package/build/components/rich-text/use-firefox-compat.js +0 -44
- package/build/components/rich-text/use-firefox-compat.js.map +0 -1
- package/build/components/rich-text/use-input-events.js +0 -25
- package/build/components/rich-text/use-input-events.js.map +0 -1
- package/build/components/rich-text/use-input-rules.js +0 -139
- package/build/components/rich-text/use-input-rules.js.map +0 -1
- package/build/components/rich-text/use-insert-replacement-text.js +0 -38
- package/build/components/rich-text/use-insert-replacement-text.js.map +0 -1
- package/build/components/rich-text/use-paste-handler.js +0 -158
- package/build/components/rich-text/use-paste-handler.js.map +0 -1
- package/build/components/rich-text/use-remove-browser-shortcuts.js +0 -32
- package/build/components/rich-text/use-remove-browser-shortcuts.js.map +0 -1
- package/build/components/rich-text/use-shortcuts.js +0 -25
- package/build/components/rich-text/use-shortcuts.js.map +0 -1
- package/build/components/rich-text/use-undo-automatic-change.js +0 -53
- package/build/components/rich-text/use-undo-automatic-change.js.map +0 -1
- package/build-module/components/block-list/use-block-props/use-block-moving-mode-class-names.js +0 -47
- package/build-module/components/block-list/use-block-props/use-block-moving-mode-class-names.js.map +0 -1
- package/build-module/components/rich-text/use-before-input-rules.js +0 -92
- package/build-module/components/rich-text/use-before-input-rules.js.map +0 -1
- package/build-module/components/rich-text/use-delete.js +0 -57
- package/build-module/components/rich-text/use-delete.js.map +0 -1
- package/build-module/components/rich-text/use-enter.js +0 -102
- package/build-module/components/rich-text/use-enter.js.map +0 -1
- package/build-module/components/rich-text/use-firefox-compat.js +0 -37
- package/build-module/components/rich-text/use-firefox-compat.js.map +0 -1
- package/build-module/components/rich-text/use-input-events.js +0 -18
- package/build-module/components/rich-text/use-input-events.js.map +0 -1
- package/build-module/components/rich-text/use-input-rules.js +0 -132
- package/build-module/components/rich-text/use-input-rules.js.map +0 -1
- package/build-module/components/rich-text/use-insert-replacement-text.js +0 -32
- package/build-module/components/rich-text/use-insert-replacement-text.js.map +0 -1
- package/build-module/components/rich-text/use-paste-handler.js +0 -152
- package/build-module/components/rich-text/use-paste-handler.js.map +0 -1
- package/build-module/components/rich-text/use-remove-browser-shortcuts.js +0 -26
- package/build-module/components/rich-text/use-remove-browser-shortcuts.js.map +0 -1
- package/build-module/components/rich-text/use-shortcuts.js +0 -18
- package/build-module/components/rich-text/use-shortcuts.js.map +0 -1
- package/build-module/components/rich-text/use-undo-automatic-change.js +0 -46
- package/build-module/components/rich-text/use-undo-automatic-change.js.map +0 -1
- package/src/components/block-list/use-block-props/use-block-moving-mode-class-names.js +0 -55
- package/src/components/rich-text/use-before-input-rules.js +0 -99
- package/src/components/rich-text/use-delete.js +0 -59
- package/src/components/rich-text/use-enter.js +0 -110
- package/src/components/rich-text/use-firefox-compat.js +0 -39
- package/src/components/rich-text/use-input-events.js +0 -19
- package/src/components/rich-text/use-input-rules.js +0 -150
- package/src/components/rich-text/use-insert-replacement-text.js +0 -31
- package/src/components/rich-text/use-paste-handler.js +0 -180
- package/src/components/rich-text/use-remove-browser-shortcuts.js +0 -29
- package/src/components/rich-text/use-shortcuts.js +0 -19
- package/src/components/rich-text/use-undo-automatic-change.js +0 -46
- package/src/components/text-decoration-control/style.scss +0 -18
- package/src/components/text-transform-control/style.scss +0 -18
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_blocks","require","_components","_data","_icons","_element","_i18n","_keycodes","_keyboardShortcuts","_compose","_blockActions","_interopRequireDefault","_blockHtmlConvertButton","_blockSettingsMenuFirstItem","_blockSettingsMenuControls","_blockParentSelectorMenuItem","_store","_lockUnlock","POPOVER_PROPS","className","placement","CopyMenuItem","clientIds","onCopy","label","shortcut","getBlocksByClientId","useSelect","blockEditorStore","ref","useCopyToClipboard","serialize","copyMenuItemLabel","__","_react","createElement","MenuItem","BlockSettingsDropdown","block","children","__experimentalSelectBlock","props","currentClientId","clientId","count","length","firstBlockClientId","firstParentClientId","onlyBlock","parentBlockType","previousBlockClientId","selectedBlockClientIds","openedBlockSettingsMenu","select","getBlockCount","getBlockName","getBlockRootClientId","getPreviousBlockClientId","getSelectedBlockClientIds","getBlockAttributes","getOpenedBlockSettingsMenu","unlock","getActiveBlockVariation","blocksStore","_firstParentClientId","parentBlockName","getBlockType","getBlockOrder","setOpenedBlockSettingsMenu","useDispatch","shortcuts","getShortcutRepresentation","keyboardShortcutsStore","duplicate","remove","insertAfter","insertBefore","isMatch","__unstableUseShortcutEventMatch","hasSelectedBlocks","updateSelectionAfterDuplicate","clientIdsPromise","ids","updateSelectionAfterRemove","blockToFocus","shouldUpdateSelection","parentBlockIsSelected","includes","open","undefined","onToggle","localOpen","default","__experimentalUpdateSelection","canCopyStyles","canDuplicate","canInsertBlock","canMove","canRemove","onDuplicate","onInsertAfter","onInsertBefore","onRemove","onPasteStyles","onMoveTo","DropdownMenu","icon","moreVertical","popoverProps","noIcons","menuProps","onKeyDown","event","defaultPrevented","preventDefault","onClose","Fragment","MenuGroup","Slot","fillProps","parentClientId","displayShortcut","primary","onClick","pipe","Children","map","child","cloneElement","_default","exports"],"sources":["@wordpress/block-editor/src/components/block-settings-menu/block-settings-dropdown.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tgetBlockType,\n\tserialize,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { moreVertical } from '@wordpress/icons';\nimport { Children, cloneElement } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport {\n\tstore as keyboardShortcutsStore,\n\t__unstableUseShortcutEventMatch,\n} from '@wordpress/keyboard-shortcuts';\nimport { pipe, useCopyToClipboard } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport BlockActions from '../block-actions';\nimport BlockHTMLConvertButton from './block-html-convert-button';\nimport __unstableBlockSettingsMenuFirstItem from './block-settings-menu-first-item';\nimport BlockSettingsMenuControls from '../block-settings-menu-controls';\nimport BlockParentSelectorMenuItem from './block-parent-selector-menu-item';\nimport { store as blockEditorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst POPOVER_PROPS = {\n\tclassName: 'block-editor-block-settings-menu__popover',\n\tplacement: 'bottom-start',\n};\n\nfunction CopyMenuItem( { clientIds, onCopy, label, shortcut } ) {\n\tconst { getBlocksByClientId } = useSelect( blockEditorStore );\n\tconst ref = useCopyToClipboard(\n\t\t() => serialize( getBlocksByClientId( clientIds ) ),\n\t\tonCopy\n\t);\n\tconst copyMenuItemLabel = label ? label : __( 'Copy' );\n\treturn (\n\t\t<MenuItem ref={ ref } shortcut={ shortcut }>\n\t\t\t{ copyMenuItemLabel }\n\t\t</MenuItem>\n\t);\n}\n\nexport function BlockSettingsDropdown( {\n\tblock,\n\tclientIds,\n\tchildren,\n\t__experimentalSelectBlock,\n\t...props\n} ) {\n\t// Get the client id of the current block for this menu, if one is set.\n\tconst currentClientId = block?.clientId;\n\tconst count = clientIds.length;\n\tconst firstBlockClientId = clientIds[ 0 ];\n\tconst {\n\t\tfirstParentClientId,\n\t\tonlyBlock,\n\t\tparentBlockType,\n\t\tpreviousBlockClientId,\n\t\tselectedBlockClientIds,\n\t\topenedBlockSettingsMenu,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockCount,\n\t\t\t\tgetBlockName,\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\tgetPreviousBlockClientId,\n\t\t\t\tgetSelectedBlockClientIds,\n\t\t\t\tgetBlockAttributes,\n\t\t\t\tgetOpenedBlockSettingsMenu,\n\t\t\t} = unlock( select( blockEditorStore ) );\n\n\t\t\tconst { getActiveBlockVariation } = select( blocksStore );\n\n\t\t\tconst _firstParentClientId =\n\t\t\t\tgetBlockRootClientId( firstBlockClientId );\n\t\t\tconst parentBlockName =\n\t\t\t\t_firstParentClientId && getBlockName( _firstParentClientId );\n\n\t\t\treturn {\n\t\t\t\tfirstParentClientId: _firstParentClientId,\n\t\t\t\tonlyBlock: 1 === getBlockCount( _firstParentClientId ),\n\t\t\t\tparentBlockType:\n\t\t\t\t\t_firstParentClientId &&\n\t\t\t\t\t( getActiveBlockVariation(\n\t\t\t\t\t\tparentBlockName,\n\t\t\t\t\t\tgetBlockAttributes( _firstParentClientId )\n\t\t\t\t\t) ||\n\t\t\t\t\t\tgetBlockType( parentBlockName ) ),\n\t\t\t\tpreviousBlockClientId:\n\t\t\t\t\tgetPreviousBlockClientId( firstBlockClientId ),\n\t\t\t\tselectedBlockClientIds: getSelectedBlockClientIds(),\n\t\t\t\topenedBlockSettingsMenu: getOpenedBlockSettingsMenu(),\n\t\t\t};\n\t\t},\n\t\t[ firstBlockClientId ]\n\t);\n\tconst { getBlockOrder, getSelectedBlockClientIds } =\n\t\tuseSelect( blockEditorStore );\n\n\tconst { setOpenedBlockSettingsMenu } = unlock(\n\t\tuseDispatch( blockEditorStore )\n\t);\n\n\tconst shortcuts = useSelect( ( select ) => {\n\t\tconst { getShortcutRepresentation } = select( keyboardShortcutsStore );\n\t\treturn {\n\t\t\tduplicate: getShortcutRepresentation(\n\t\t\t\t'core/block-editor/duplicate'\n\t\t\t),\n\t\t\tremove: getShortcutRepresentation( 'core/block-editor/remove' ),\n\t\t\tinsertAfter: getShortcutRepresentation(\n\t\t\t\t'core/block-editor/insert-after'\n\t\t\t),\n\t\t\tinsertBefore: getShortcutRepresentation(\n\t\t\t\t'core/block-editor/insert-before'\n\t\t\t),\n\t\t};\n\t}, [] );\n\tconst isMatch = __unstableUseShortcutEventMatch();\n\tconst hasSelectedBlocks = selectedBlockClientIds.length > 0;\n\n\tasync function updateSelectionAfterDuplicate( clientIdsPromise ) {\n\t\tif ( ! __experimentalSelectBlock ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst ids = await clientIdsPromise;\n\t\tif ( ids && ids[ 0 ] ) {\n\t\t\t__experimentalSelectBlock( ids[ 0 ], false );\n\t\t}\n\t}\n\n\tfunction updateSelectionAfterRemove() {\n\t\tif ( ! __experimentalSelectBlock ) {\n\t\t\treturn;\n\t\t}\n\n\t\tlet blockToFocus = previousBlockClientId || firstParentClientId;\n\n\t\t// Focus the first block if there's no previous block nor parent block.\n\t\tif ( ! blockToFocus ) {\n\t\t\tblockToFocus = getBlockOrder()[ 0 ];\n\t\t}\n\n\t\t// Only update the selection if the original selection is removed.\n\t\tconst shouldUpdateSelection =\n\t\t\thasSelectedBlocks && getSelectedBlockClientIds().length === 0;\n\n\t\t__experimentalSelectBlock( blockToFocus, shouldUpdateSelection );\n\t}\n\n\t// This can occur when the selected block (the parent)\n\t// displays child blocks within a List View.\n\tconst parentBlockIsSelected =\n\t\tselectedBlockClientIds?.includes( firstParentClientId );\n\n\t// When a currentClientId is in use, treat the menu as a controlled component.\n\t// This ensures that only one block settings menu is open at a time.\n\t// This is a temporary solution to work around an issue with `onFocusOutside`\n\t// where it does not allow a dropdown to be closed if focus was never within\n\t// the dropdown to begin with. Examples include a user either CMD+Clicking or\n\t// right clicking into an inactive window.\n\t// See: https://github.com/WordPress/gutenberg/pull/54083\n\tconst open = ! currentClientId\n\t\t? undefined\n\t\t: openedBlockSettingsMenu === currentClientId || false;\n\n\tfunction onToggle( localOpen ) {\n\t\tif ( localOpen && openedBlockSettingsMenu !== currentClientId ) {\n\t\t\tsetOpenedBlockSettingsMenu( currentClientId );\n\t\t} else if (\n\t\t\t! localOpen &&\n\t\t\topenedBlockSettingsMenu &&\n\t\t\topenedBlockSettingsMenu === currentClientId\n\t\t) {\n\t\t\tsetOpenedBlockSettingsMenu( undefined );\n\t\t}\n\t}\n\n\treturn (\n\t\t<BlockActions\n\t\t\tclientIds={ clientIds }\n\t\t\t__experimentalUpdateSelection={ ! __experimentalSelectBlock }\n\t\t>\n\t\t\t{ ( {\n\t\t\t\tcanCopyStyles,\n\t\t\t\tcanDuplicate,\n\t\t\t\tcanInsertBlock,\n\t\t\t\tcanMove,\n\t\t\t\tcanRemove,\n\t\t\t\tonDuplicate,\n\t\t\t\tonInsertAfter,\n\t\t\t\tonInsertBefore,\n\t\t\t\tonRemove,\n\t\t\t\tonCopy,\n\t\t\t\tonPasteStyles,\n\t\t\t\tonMoveTo,\n\t\t\t} ) => (\n\t\t\t\t<DropdownMenu\n\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\tlabel={ __( 'Options' ) }\n\t\t\t\t\tclassName=\"block-editor-block-settings-menu\"\n\t\t\t\t\tpopoverProps={ POPOVER_PROPS }\n\t\t\t\t\topen={ open }\n\t\t\t\t\tonToggle={ onToggle }\n\t\t\t\t\tnoIcons\n\t\t\t\t\tmenuProps={ {\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * @param {KeyboardEvent} event\n\t\t\t\t\t\t */\n\t\t\t\t\t\tonKeyDown( event ) {\n\t\t\t\t\t\t\tif ( event.defaultPrevented ) return;\n\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tisMatch( 'core/block-editor/remove', event ) &&\n\t\t\t\t\t\t\t\tcanRemove\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\t\tonRemove();\n\t\t\t\t\t\t\t\tupdateSelectionAfterRemove();\n\t\t\t\t\t\t\t} else if (\n\t\t\t\t\t\t\t\tisMatch(\n\t\t\t\t\t\t\t\t\t'core/block-editor/duplicate',\n\t\t\t\t\t\t\t\t\tevent\n\t\t\t\t\t\t\t\t) &&\n\t\t\t\t\t\t\t\tcanDuplicate\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\t\tupdateSelectionAfterDuplicate( onDuplicate() );\n\t\t\t\t\t\t\t} else if (\n\t\t\t\t\t\t\t\tisMatch(\n\t\t\t\t\t\t\t\t\t'core/block-editor/insert-after',\n\t\t\t\t\t\t\t\t\tevent\n\t\t\t\t\t\t\t\t) &&\n\t\t\t\t\t\t\t\tcanInsertBlock\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\t\tsetOpenedBlockSettingsMenu( undefined );\n\t\t\t\t\t\t\t\tonInsertAfter();\n\t\t\t\t\t\t\t} else if (\n\t\t\t\t\t\t\t\tisMatch(\n\t\t\t\t\t\t\t\t\t'core/block-editor/insert-before',\n\t\t\t\t\t\t\t\t\tevent\n\t\t\t\t\t\t\t\t) &&\n\t\t\t\t\t\t\t\tcanInsertBlock\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\t\tsetOpenedBlockSettingsMenu( undefined );\n\t\t\t\t\t\t\t\tonInsertBefore();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t} }\n\t\t\t\t\t{ ...props }\n\t\t\t\t>\n\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t\t<__unstableBlockSettingsMenuFirstItem.Slot\n\t\t\t\t\t\t\t\t\tfillProps={ { onClose } }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t{ ! parentBlockIsSelected &&\n\t\t\t\t\t\t\t\t\t!! firstParentClientId && (\n\t\t\t\t\t\t\t\t\t\t<BlockParentSelectorMenuItem\n\t\t\t\t\t\t\t\t\t\t\tparentClientId={\n\t\t\t\t\t\t\t\t\t\t\t\tfirstParentClientId\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tparentBlockType={ parentBlockType }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t{ count === 1 && (\n\t\t\t\t\t\t\t\t\t<BlockHTMLConvertButton\n\t\t\t\t\t\t\t\t\t\tclientId={ firstBlockClientId }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t<CopyMenuItem\n\t\t\t\t\t\t\t\t\tclientIds={ clientIds }\n\t\t\t\t\t\t\t\t\tonCopy={ onCopy }\n\t\t\t\t\t\t\t\t\tshortcut={ displayShortcut.primary( 'c' ) }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t{ canDuplicate && (\n\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\tonClick={ pipe(\n\t\t\t\t\t\t\t\t\t\t\tonClose,\n\t\t\t\t\t\t\t\t\t\t\tonDuplicate,\n\t\t\t\t\t\t\t\t\t\t\tupdateSelectionAfterDuplicate\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\tshortcut={ shortcuts.duplicate }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Duplicate' ) }\n\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t{ canInsertBlock && (\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\t\tonClick={ pipe(\n\t\t\t\t\t\t\t\t\t\t\t\tonClose,\n\t\t\t\t\t\t\t\t\t\t\t\tonInsertBefore\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\tshortcut={ shortcuts.insertBefore }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ __( 'Add before' ) }\n\t\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\t\tonClick={ pipe(\n\t\t\t\t\t\t\t\t\t\t\t\tonClose,\n\t\t\t\t\t\t\t\t\t\t\t\tonInsertAfter\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\tshortcut={ shortcuts.insertAfter }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ __( 'Add after' ) }\n\t\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t\t{ canCopyStyles && (\n\t\t\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t\t\t<CopyMenuItem\n\t\t\t\t\t\t\t\t\t\tclientIds={ clientIds }\n\t\t\t\t\t\t\t\t\t\tonCopy={ onCopy }\n\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Copy styles' ) }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t<MenuItem onClick={ onPasteStyles }>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Paste styles' ) }\n\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t<BlockSettingsMenuControls.Slot\n\t\t\t\t\t\t\t\tfillProps={ {\n\t\t\t\t\t\t\t\t\tonClose,\n\t\t\t\t\t\t\t\t\tcanMove,\n\t\t\t\t\t\t\t\t\tonMoveTo,\n\t\t\t\t\t\t\t\t\tonlyBlock,\n\t\t\t\t\t\t\t\t\tcount,\n\t\t\t\t\t\t\t\t\tfirstBlockClientId,\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\tclientIds={ clientIds }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t{ typeof children === 'function'\n\t\t\t\t\t\t\t\t? children( { onClose } )\n\t\t\t\t\t\t\t\t: Children.map( ( child ) =>\n\t\t\t\t\t\t\t\t\t\tcloneElement( child, { onClose } )\n\t\t\t\t\t\t\t\t ) }\n\t\t\t\t\t\t\t{ canRemove && (\n\t\t\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\tonClick={ pipe(\n\t\t\t\t\t\t\t\t\t\t\tonClose,\n\t\t\t\t\t\t\t\t\t\t\tonRemove,\n\t\t\t\t\t\t\t\t\t\t\tupdateSelectionAfterRemove\n\t\t\t\t\t\t\t\t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U,CAEF,CAAC;AAEjB;AAAC,IAAAgG,QAAA,GAAAC,OAAA,CAAAtC,OAAA,GAEcvD,qBAAqB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_blocks","require","_components","_data","_icons","_element","_i18n","_keycodes","_keyboardShortcuts","_compose","_blockActions","_interopRequireDefault","_blockHtmlConvertButton","_blockSettingsMenuFirstItem","_blockSettingsMenuControls","_blockParentSelectorMenuItem","_store","_lockUnlock","POPOVER_PROPS","className","placement","CopyMenuItem","clientIds","onCopy","label","shortcut","getBlocksByClientId","useSelect","blockEditorStore","ref","useCopyToClipboard","serialize","copyMenuItemLabel","__","_react","createElement","MenuItem","BlockSettingsDropdown","block","children","__experimentalSelectBlock","props","currentClientId","clientId","count","length","firstBlockClientId","firstParentClientId","onlyBlock","parentBlockType","previousBlockClientId","selectedBlockClientIds","openedBlockSettingsMenu","select","getBlockCount","getBlockName","getBlockRootClientId","getPreviousBlockClientId","getSelectedBlockClientIds","getBlockAttributes","getOpenedBlockSettingsMenu","unlock","getActiveBlockVariation","blocksStore","_firstParentClientId","parentBlockName","getBlockType","getBlockOrder","setOpenedBlockSettingsMenu","useDispatch","shortcuts","getShortcutRepresentation","keyboardShortcutsStore","duplicate","remove","insertAfter","insertBefore","hasSelectedBlocks","updateSelectionAfterDuplicate","clientIdsPromise","ids","updateSelectionAfterRemove","blockToFocus","shouldUpdateSelection","parentBlockIsSelected","includes","open","undefined","onToggle","localOpen","default","__experimentalUpdateSelection","canCopyStyles","canDuplicate","canInsertBlock","canMove","canRemove","onDuplicate","onInsertAfter","onInsertBefore","onRemove","onPasteStyles","onMoveTo","DropdownMenu","icon","moreVertical","popoverProps","noIcons","onClose","Fragment","MenuGroup","Slot","fillProps","parentClientId","displayShortcut","primary","onClick","pipe","Children","map","child","cloneElement","_default","exports"],"sources":["@wordpress/block-editor/src/components/block-settings-menu/block-settings-dropdown.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tgetBlockType,\n\tserialize,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { moreVertical } from '@wordpress/icons';\nimport { Children, cloneElement } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport { pipe, useCopyToClipboard } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport BlockActions from '../block-actions';\nimport BlockHTMLConvertButton from './block-html-convert-button';\nimport __unstableBlockSettingsMenuFirstItem from './block-settings-menu-first-item';\nimport BlockSettingsMenuControls from '../block-settings-menu-controls';\nimport BlockParentSelectorMenuItem from './block-parent-selector-menu-item';\nimport { store as blockEditorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst POPOVER_PROPS = {\n\tclassName: 'block-editor-block-settings-menu__popover',\n\tplacement: 'bottom-start',\n};\n\nfunction CopyMenuItem( { clientIds, onCopy, label, shortcut } ) {\n\tconst { getBlocksByClientId } = useSelect( blockEditorStore );\n\tconst ref = useCopyToClipboard(\n\t\t() => serialize( getBlocksByClientId( clientIds ) ),\n\t\tonCopy\n\t);\n\tconst copyMenuItemLabel = label ? label : __( 'Copy' );\n\treturn (\n\t\t<MenuItem ref={ ref } shortcut={ shortcut }>\n\t\t\t{ copyMenuItemLabel }\n\t\t</MenuItem>\n\t);\n}\n\nexport function BlockSettingsDropdown( {\n\tblock,\n\tclientIds,\n\tchildren,\n\t__experimentalSelectBlock,\n\t...props\n} ) {\n\t// Get the client id of the current block for this menu, if one is set.\n\tconst currentClientId = block?.clientId;\n\tconst count = clientIds.length;\n\tconst firstBlockClientId = clientIds[ 0 ];\n\tconst {\n\t\tfirstParentClientId,\n\t\tonlyBlock,\n\t\tparentBlockType,\n\t\tpreviousBlockClientId,\n\t\tselectedBlockClientIds,\n\t\topenedBlockSettingsMenu,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockCount,\n\t\t\t\tgetBlockName,\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\tgetPreviousBlockClientId,\n\t\t\t\tgetSelectedBlockClientIds,\n\t\t\t\tgetBlockAttributes,\n\t\t\t\tgetOpenedBlockSettingsMenu,\n\t\t\t} = unlock( select( blockEditorStore ) );\n\n\t\t\tconst { getActiveBlockVariation } = select( blocksStore );\n\n\t\t\tconst _firstParentClientId =\n\t\t\t\tgetBlockRootClientId( firstBlockClientId );\n\t\t\tconst parentBlockName =\n\t\t\t\t_firstParentClientId && getBlockName( _firstParentClientId );\n\n\t\t\treturn {\n\t\t\t\tfirstParentClientId: _firstParentClientId,\n\t\t\t\tonlyBlock: 1 === getBlockCount( _firstParentClientId ),\n\t\t\t\tparentBlockType:\n\t\t\t\t\t_firstParentClientId &&\n\t\t\t\t\t( getActiveBlockVariation(\n\t\t\t\t\t\tparentBlockName,\n\t\t\t\t\t\tgetBlockAttributes( _firstParentClientId )\n\t\t\t\t\t) ||\n\t\t\t\t\t\tgetBlockType( parentBlockName ) ),\n\t\t\t\tpreviousBlockClientId:\n\t\t\t\t\tgetPreviousBlockClientId( firstBlockClientId ),\n\t\t\t\tselectedBlockClientIds: getSelectedBlockClientIds(),\n\t\t\t\topenedBlockSettingsMenu: getOpenedBlockSettingsMenu(),\n\t\t\t};\n\t\t},\n\t\t[ firstBlockClientId ]\n\t);\n\tconst { getBlockOrder, getSelectedBlockClientIds } =\n\t\tuseSelect( blockEditorStore );\n\n\tconst { setOpenedBlockSettingsMenu } = unlock(\n\t\tuseDispatch( blockEditorStore )\n\t);\n\n\tconst shortcuts = useSelect( ( select ) => {\n\t\tconst { getShortcutRepresentation } = select( keyboardShortcutsStore );\n\t\treturn {\n\t\t\tduplicate: getShortcutRepresentation(\n\t\t\t\t'core/block-editor/duplicate'\n\t\t\t),\n\t\t\tremove: getShortcutRepresentation( 'core/block-editor/remove' ),\n\t\t\tinsertAfter: getShortcutRepresentation(\n\t\t\t\t'core/block-editor/insert-after'\n\t\t\t),\n\t\t\tinsertBefore: getShortcutRepresentation(\n\t\t\t\t'core/block-editor/insert-before'\n\t\t\t),\n\t\t};\n\t}, [] );\n\tconst hasSelectedBlocks = selectedBlockClientIds.length > 0;\n\n\tasync function updateSelectionAfterDuplicate( clientIdsPromise ) {\n\t\tif ( ! __experimentalSelectBlock ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst ids = await clientIdsPromise;\n\t\tif ( ids && ids[ 0 ] ) {\n\t\t\t__experimentalSelectBlock( ids[ 0 ], false );\n\t\t}\n\t}\n\n\tfunction updateSelectionAfterRemove() {\n\t\tif ( ! __experimentalSelectBlock ) {\n\t\t\treturn;\n\t\t}\n\n\t\tlet blockToFocus = previousBlockClientId || firstParentClientId;\n\n\t\t// Focus the first block if there's no previous block nor parent block.\n\t\tif ( ! blockToFocus ) {\n\t\t\tblockToFocus = getBlockOrder()[ 0 ];\n\t\t}\n\n\t\t// Only update the selection if the original selection is removed.\n\t\tconst shouldUpdateSelection =\n\t\t\thasSelectedBlocks && getSelectedBlockClientIds().length === 0;\n\n\t\t__experimentalSelectBlock( blockToFocus, shouldUpdateSelection );\n\t}\n\n\t// This can occur when the selected block (the parent)\n\t// displays child blocks within a List View.\n\tconst parentBlockIsSelected =\n\t\tselectedBlockClientIds?.includes( firstParentClientId );\n\n\t// When a currentClientId is in use, treat the menu as a controlled component.\n\t// This ensures that only one block settings menu is open at a time.\n\t// This is a temporary solution to work around an issue with `onFocusOutside`\n\t// where it does not allow a dropdown to be closed if focus was never within\n\t// the dropdown to begin with. Examples include a user either CMD+Clicking or\n\t// right clicking into an inactive window.\n\t// See: https://github.com/WordPress/gutenberg/pull/54083\n\tconst open = ! currentClientId\n\t\t? undefined\n\t\t: openedBlockSettingsMenu === currentClientId || false;\n\n\tfunction onToggle( localOpen ) {\n\t\tif ( localOpen && openedBlockSettingsMenu !== currentClientId ) {\n\t\t\tsetOpenedBlockSettingsMenu( currentClientId );\n\t\t} else if (\n\t\t\t! localOpen &&\n\t\t\topenedBlockSettingsMenu &&\n\t\t\topenedBlockSettingsMenu === currentClientId\n\t\t) {\n\t\t\tsetOpenedBlockSettingsMenu( undefined );\n\t\t}\n\t}\n\n\treturn (\n\t\t<BlockActions\n\t\t\tclientIds={ clientIds }\n\t\t\t__experimentalUpdateSelection={ ! __experimentalSelectBlock }\n\t\t>\n\t\t\t{ ( {\n\t\t\t\tcanCopyStyles,\n\t\t\t\tcanDuplicate,\n\t\t\t\tcanInsertBlock,\n\t\t\t\tcanMove,\n\t\t\t\tcanRemove,\n\t\t\t\tonDuplicate,\n\t\t\t\tonInsertAfter,\n\t\t\t\tonInsertBefore,\n\t\t\t\tonRemove,\n\t\t\t\tonCopy,\n\t\t\t\tonPasteStyles,\n\t\t\t\tonMoveTo,\n\t\t\t} ) => (\n\t\t\t\t<DropdownMenu\n\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\tlabel={ __( 'Options' ) }\n\t\t\t\t\tclassName=\"block-editor-block-settings-menu\"\n\t\t\t\t\tpopoverProps={ POPOVER_PROPS }\n\t\t\t\t\topen={ open }\n\t\t\t\t\tonToggle={ onToggle }\n\t\t\t\t\tnoIcons\n\t\t\t\t\t{ ...props }\n\t\t\t\t>\n\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t\t<__unstableBlockSettingsMenuFirstItem.Slot\n\t\t\t\t\t\t\t\t\tfillProps={ { onClose } }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t{ ! parentBlockIsSelected &&\n\t\t\t\t\t\t\t\t\t!! firstParentClientId && (\n\t\t\t\t\t\t\t\t\t\t<BlockParentSelectorMenuItem\n\t\t\t\t\t\t\t\t\t\t\tparentClientId={\n\t\t\t\t\t\t\t\t\t\t\t\tfirstParentClientId\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tparentBlockType={ parentBlockType }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t{ count === 1 && (\n\t\t\t\t\t\t\t\t\t<BlockHTMLConvertButton\n\t\t\t\t\t\t\t\t\t\tclientId={ firstBlockClientId }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t<CopyMenuItem\n\t\t\t\t\t\t\t\t\tclientIds={ clientIds }\n\t\t\t\t\t\t\t\t\tonCopy={ onCopy }\n\t\t\t\t\t\t\t\t\tshortcut={ displayShortcut.primary( 'c' ) }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t{ canDuplicate && (\n\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\tonClick={ pipe(\n\t\t\t\t\t\t\t\t\t\t\tonClose,\n\t\t\t\t\t\t\t\t\t\t\tonDuplicate,\n\t\t\t\t\t\t\t\t\t\t\tupdateSelectionAfterDuplicate\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\tshortcut={ shortcuts.duplicate }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Duplicate' ) }\n\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t{ canInsertBlock && (\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\t\tonClick={ pipe(\n\t\t\t\t\t\t\t\t\t\t\t\tonClose,\n\t\t\t\t\t\t\t\t\t\t\t\tonInsertBefore\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\tshortcut={ shortcuts.insertBefore }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ __( 'Add before' ) }\n\t\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\t\tonClick={ pipe(\n\t\t\t\t\t\t\t\t\t\t\t\tonClose,\n\t\t\t\t\t\t\t\t\t\t\t\tonInsertAfter\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\tshortcut={ shortcuts.insertAfter }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ __( 'Add after' ) }\n\t\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t\t{ canCopyStyles && (\n\t\t\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t\t\t<CopyMenuItem\n\t\t\t\t\t\t\t\t\t\tclientIds={ clientIds }\n\t\t\t\t\t\t\t\t\t\tonCopy={ onCopy }\n\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Copy styles' ) }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t<MenuItem onClick={ onPasteStyles }>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Paste styles' ) }\n\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t<BlockSettingsMenuControls.Slot\n\t\t\t\t\t\t\t\tfillProps={ {\n\t\t\t\t\t\t\t\t\tonClose,\n\t\t\t\t\t\t\t\t\tcanMove,\n\t\t\t\t\t\t\t\t\tonMoveTo,\n\t\t\t\t\t\t\t\t\tonlyBlock,\n\t\t\t\t\t\t\t\t\tcount,\n\t\t\t\t\t\t\t\t\tfirstBlockClientId,\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\tclientIds={ clientIds }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t{ typeof children === 'function'\n\t\t\t\t\t\t\t\t? children( { onClose } )\n\t\t\t\t\t\t\t\t: Children.map( ( child ) =>\n\t\t\t\t\t\t\t\t\t\tcloneElement( child, { onClose } )\n\t\t\t\t\t\t\t\t ) }\n\t\t\t\t\t\t\t{ canRemove && (\n\t\t\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\tonClick={ pipe(\n\t\t\t\t\t\t\t\t\t\t\tonClose,\n\t\t\t\t\t\t\t\t\t\t\tonRemove,\n\t\t\t\t\t\t\t\t\t\t\tupdateSelectionAfterRemove\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\tshortcut={ shortcuts.remove }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Delete' ) }\n\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t</DropdownMenu>\n\t\t\t) }\n\t\t</BlockActions>\n\t);\n}\n\nexport default BlockSettingsDropdown;\n"],"mappings":";;;;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AAKA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,kBAAA,GAAAP,OAAA;AACA,IAAAQ,QAAA,GAAAR,OAAA;AAKA,IAAAS,aAAA,GAAAC,sBAAA,CAAAV,OAAA;AACA,IAAAW,uBAAA,GAAAD,sBAAA,CAAAV,OAAA;AACA,IAAAY,2BAAA,GAAAF,sBAAA,CAAAV,OAAA;AACA,IAAAa,0BAAA,GAAAH,sBAAA,CAAAV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IAAApE,QAAE,EAAE,cAAe,CACZ,CACA,CACX,EACD,IAAAC,MAAA,CAAAC,aAAA,EAACrB,0BAAA,CAAA4E,OAAyB,CAACqB,IAAI;IAC9BC,SAAS,EAAG;MACXJ,OAAO;MACPb,OAAO;MACPO,QAAQ;MACRtD,SAAS;MACTJ,KAAK;MACLE;IACD,CAAG;IACHxB,SAAS,EAAGA;EAAW,CACvB,CAAC,EACA,OAAOiB,QAAQ,KAAK,UAAU,GAC7BA,QAAQ,CAAE;IAAEqE;EAAQ,CAAE,CAAC,GACvBU,iBAAQ,CAACC,GAAG,CAAIC,KAAK,IACrB,IAAAC,qBAAY,EAAED,KAAK,EAAE;IAAEZ;EAAQ,CAAE,CACjC,CAAC,EACFZ,SAAS,IACV,IAAA9D,MAAA,CAAAC,aAAA,EAACjC,WAAA,CAAA4G,SAAS,QACT,IAAA5E,MAAA,CAAAC,aAAA,EAACjC,WAAA,CAAAkC,QAAQ;IACRgF,OAAO,EAAG,IAAAC,aAAI,EACbT,OAAO,EACPR,QAAQ,EACRnB,0BACD,CAAG;IACHxD,QAAQ,EAAG6C,SAAS,CAACI;EAAQ,GAE3B,IAAAzC,QAAE,EAAE,QAAS,CACN,CACA,CAEX,CAEU,CAEF,CAAC;AAEjB;AAAC,IAAAyF,QAAA,GAAAC,OAAA,CAAAjC,OAAA,GAEcrD,qBAAqB","ignoreList":[]}
|
|
@@ -34,7 +34,9 @@ function PatternTransformationsMenu({
|
|
|
34
34
|
}) {
|
|
35
35
|
const [showTransforms, setShowTransforms] = (0, _element.useState)(false);
|
|
36
36
|
const patterns = (0, _useTransformedPatterns.default)(statePatterns, blocks);
|
|
37
|
-
if (!patterns.length)
|
|
37
|
+
if (!patterns.length) {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
38
40
|
return (0, _react.createElement)(_components.MenuGroup, {
|
|
39
41
|
className: "block-editor-block-switcher__pattern__transforms__menugroup"
|
|
40
42
|
}, showTransforms && (0, _react.createElement)(PreviewPatternsPopover, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_element","_compose","_icons","_components","_blockPreview","_interopRequireDefault","_useTransformedPatterns","_lockUnlock","CompositeV2","Composite","CompositeItemV2","CompositeItem","useCompositeStoreV2","useCompositeStore","unlock","componentsPrivateApis","PatternTransformationsMenu","blocks","patterns","statePatterns","onSelect","showTransforms","setShowTransforms","useState","useTransformedPatterns","length","_react","createElement","MenuGroup","className","PreviewPatternsPopover","MenuItem","onClick","event","preventDefault","icon","chevronRight","__","Popover","position","BlockPatternsList","composite","store","role","map","pattern","BlockPattern","key","name","baseClassName","descriptionId","useInstanceId","render","title","description","undefined","transformedBlocks","default","viewportWidth","VisuallyHidden","id","_default","exports"],"sources":["@wordpress/block-editor/src/components/block-switcher/pattern-transformations-menu.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport { useInstanceId } from '@wordpress/compose';\nimport { chevronRight } from '@wordpress/icons';\n\nimport {\n\tMenuGroup,\n\tMenuItem,\n\tPopover,\n\tVisuallyHidden,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport BlockPreview from '../block-preview';\nimport useTransformedPatterns from './use-transformed-patterns';\nimport { unlock } from '../../lock-unlock';\n\nconst {\n\tCompositeV2: Composite,\n\tCompositeItemV2: CompositeItem,\n\tuseCompositeStoreV2: useCompositeStore,\n} = unlock( componentsPrivateApis );\n\nfunction PatternTransformationsMenu( {\n\tblocks,\n\tpatterns: statePatterns,\n\tonSelect,\n} ) {\n\tconst [ showTransforms, setShowTransforms ] = useState( false );\n\tconst patterns = useTransformedPatterns( statePatterns, blocks );\n\tif ( ! patterns.length )
|
|
1
|
+
{"version":3,"names":["_i18n","require","_element","_compose","_icons","_components","_blockPreview","_interopRequireDefault","_useTransformedPatterns","_lockUnlock","CompositeV2","Composite","CompositeItemV2","CompositeItem","useCompositeStoreV2","useCompositeStore","unlock","componentsPrivateApis","PatternTransformationsMenu","blocks","patterns","statePatterns","onSelect","showTransforms","setShowTransforms","useState","useTransformedPatterns","length","_react","createElement","MenuGroup","className","PreviewPatternsPopover","MenuItem","onClick","event","preventDefault","icon","chevronRight","__","Popover","position","BlockPatternsList","composite","store","role","map","pattern","BlockPattern","key","name","baseClassName","descriptionId","useInstanceId","render","title","description","undefined","transformedBlocks","default","viewportWidth","VisuallyHidden","id","_default","exports"],"sources":["@wordpress/block-editor/src/components/block-switcher/pattern-transformations-menu.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport { useInstanceId } from '@wordpress/compose';\nimport { chevronRight } from '@wordpress/icons';\n\nimport {\n\tMenuGroup,\n\tMenuItem,\n\tPopover,\n\tVisuallyHidden,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport BlockPreview from '../block-preview';\nimport useTransformedPatterns from './use-transformed-patterns';\nimport { unlock } from '../../lock-unlock';\n\nconst {\n\tCompositeV2: Composite,\n\tCompositeItemV2: CompositeItem,\n\tuseCompositeStoreV2: useCompositeStore,\n} = unlock( componentsPrivateApis );\n\nfunction PatternTransformationsMenu( {\n\tblocks,\n\tpatterns: statePatterns,\n\tonSelect,\n} ) {\n\tconst [ showTransforms, setShowTransforms ] = useState( false );\n\tconst patterns = useTransformedPatterns( statePatterns, blocks );\n\tif ( ! patterns.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<MenuGroup className=\"block-editor-block-switcher__pattern__transforms__menugroup\">\n\t\t\t{ showTransforms && (\n\t\t\t\t<PreviewPatternsPopover\n\t\t\t\t\tpatterns={ patterns }\n\t\t\t\t\tonSelect={ onSelect }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t<MenuItem\n\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tsetShowTransforms( ! showTransforms );\n\t\t\t\t} }\n\t\t\t\ticon={ chevronRight }\n\t\t\t>\n\t\t\t\t{ __( 'Patterns' ) }\n\t\t\t</MenuItem>\n\t\t</MenuGroup>\n\t);\n}\n\nfunction PreviewPatternsPopover( { patterns, onSelect } ) {\n\treturn (\n\t\t<div className=\"block-editor-block-switcher__popover__preview__parent\">\n\t\t\t<div className=\"block-editor-block-switcher__popover__preview__container\">\n\t\t\t\t<Popover\n\t\t\t\t\tclassName=\"block-editor-block-switcher__preview__popover\"\n\t\t\t\t\tposition=\"bottom right\"\n\t\t\t\t>\n\t\t\t\t\t<div className=\"block-editor-block-switcher__preview is-pattern-list-preview\">\n\t\t\t\t\t\t<BlockPatternsList\n\t\t\t\t\t\t\tpatterns={ patterns }\n\t\t\t\t\t\t\tonSelect={ onSelect }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t</Popover>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n\nfunction BlockPatternsList( { patterns, onSelect } ) {\n\tconst composite = useCompositeStore();\n\treturn (\n\t\t<Composite\n\t\t\tstore={ composite }\n\t\t\trole=\"listbox\"\n\t\t\tclassName=\"block-editor-block-switcher__preview-patterns-container\"\n\t\t\taria-label={ __( 'Patterns list' ) }\n\t\t>\n\t\t\t{ patterns.map( ( pattern ) => (\n\t\t\t\t<BlockPattern\n\t\t\t\t\tkey={ pattern.name }\n\t\t\t\t\tpattern={ pattern }\n\t\t\t\t\tonSelect={ onSelect }\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t</Composite>\n\t);\n}\n\nfunction BlockPattern( { pattern, onSelect } ) {\n\t// TODO check pattern/preview width...\n\tconst baseClassName =\n\t\t'block-editor-block-switcher__preview-patterns-container';\n\tconst descriptionId = useInstanceId(\n\t\tBlockPattern,\n\t\t`${ baseClassName }-list__item-description`\n\t);\n\treturn (\n\t\t<div className={ `${ baseClassName }-list__list-item` }>\n\t\t\t<CompositeItem\n\t\t\t\trender={\n\t\t\t\t\t<div\n\t\t\t\t\t\trole=\"option\"\n\t\t\t\t\t\taria-label={ pattern.title }\n\t\t\t\t\t\taria-describedby={\n\t\t\t\t\t\t\tpattern.description ? descriptionId : undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t\tclassName={ `${ baseClassName }-list__item` }\n\t\t\t\t\t/>\n\t\t\t\t}\n\t\t\t\tonClick={ () => onSelect( pattern.transformedBlocks ) }\n\t\t\t>\n\t\t\t\t<BlockPreview\n\t\t\t\t\tblocks={ pattern.transformedBlocks }\n\t\t\t\t\tviewportWidth={ pattern.viewportWidth || 500 }\n\t\t\t\t/>\n\t\t\t\t<div className={ `${ baseClassName }-list__item-title` }>\n\t\t\t\t\t{ pattern.title }\n\t\t\t\t</div>\n\t\t\t</CompositeItem>\n\t\t\t{ !! pattern.description && (\n\t\t\t\t<VisuallyHidden id={ descriptionId }>\n\t\t\t\t\t{ pattern.description }\n\t\t\t\t</VisuallyHidden>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n\nexport default PatternTransformationsMenu;\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAEA,IAAAI,WAAA,GAAAJ,OAAA;AAWA,IAAAK,aAAA,GAAAC,sBAAA,CAAAN,OAAA;AACA,IAAAO,uBAAA,GAAAD,sBAAA,CAAAN,OAAA;AACA,IAAAQ,WAAA,GAAAR,OAAA;AArBA;AACA;AACA;;AAcA;AACA;AACA;;AAKA,MAAM;EACLS,WAAW,EAAEC,SAAS;EACtBC,eAAe,EAAEC,aAAa;EAC9BC,mBAAmB,EAAEC;AACtB,CAAC,GAAG,IAAAC,kBAAM,EAAEC,uBAAsB,CAAC;AAEnC,SAASC,0BAA0BA,CAAE;EACpCC,MAAM;EACNC,QAAQ,EAAEC,aAAa;EACvBC;AACD,CAAC,EAAG;EACH,MAAM,CAAEC,cAAc,EA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CAAC,EACF,IAAAhC,MAAA,CAAAC,aAAA;IAAKE,SAAS,EAAI,GAAGoB,aAAe;EAAoB,GACrDJ,OAAO,CAACQ,KACN,CACS,CAAC,EACd,CAAC,CAAER,OAAO,CAACS,WAAW,IACvB,IAAA5B,MAAA,CAAAC,aAAA,EAACxB,WAAA,CAAAwD,cAAc;IAACC,EAAE,EAAGV;EAAe,GACjCL,OAAO,CAACS,WACK,CAEb,CAAC;AAER;AAAC,IAAAO,QAAA,GAAAC,OAAA,CAAAL,OAAA,GAEczC,0BAA0B","ignoreList":[]}
|
|
@@ -57,7 +57,9 @@ const getPatternTransformedBlocks = (selectedBlocks, patternBlocks) => {
|
|
|
57
57
|
let isMatch = false;
|
|
58
58
|
for (const patternBlock of _patternBlocks) {
|
|
59
59
|
const match = (0, _utils.getMatchingBlockByName)(patternBlock, selectedBlock.name, consumedBlocks);
|
|
60
|
-
if (!match)
|
|
60
|
+
if (!match) {
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
61
63
|
isMatch = true;
|
|
62
64
|
consumedBlocks.add(match.clientId);
|
|
63
65
|
// We update (mutate) the matching pattern block.
|
|
@@ -66,7 +68,9 @@ const getPatternTransformedBlocks = (selectedBlocks, patternBlocks) => {
|
|
|
66
68
|
break;
|
|
67
69
|
}
|
|
68
70
|
// Bail eary if a selected block has not been matched.
|
|
69
|
-
if (!isMatch)
|
|
71
|
+
if (!isMatch) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
70
74
|
}
|
|
71
75
|
return _patternBlocks;
|
|
72
76
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_element","require","_blocks","_utils","transformMatchingBlock","match","selectedBlock","retainedBlockAttributes","getRetainedBlockAttributes","name","attributes","exports","getPatternTransformedBlocks","selectedBlocks","patternBlocks","_patternBlocks","map","block","cloneBlock","consumedBlocks","Set","isMatch","patternBlock","getMatchingBlockByName","add","clientId","useTransformedPatterns","patterns","useMemo","reduce","accumulator","_pattern","transformedBlocks","blocks","push","_default","default"],"sources":["@wordpress/block-editor/src/components/block-switcher/use-transformed-patterns.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport { cloneBlock } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { getMatchingBlockByName, getRetainedBlockAttributes } from './utils';\n\n/**\n * Mutate the matched block's attributes by getting\n * which block type's attributes to retain and prioritize\n * them in the merging of the attributes.\n *\n * @param {WPBlock} match The matched block.\n * @param {WPBlock} selectedBlock The selected block.\n * @return {void}\n */\nexport const transformMatchingBlock = ( match, selectedBlock ) => {\n\t// Get the block attributes to retain through the transformation.\n\tconst retainedBlockAttributes = getRetainedBlockAttributes(\n\t\tselectedBlock.name,\n\t\tselectedBlock.attributes\n\t);\n\tmatch.attributes = {\n\t\t...match.attributes,\n\t\t...retainedBlockAttributes,\n\t};\n};\n\n/**\n * By providing the selected blocks and pattern's blocks\n * find the matching blocks, transform them and return them.\n * If not all selected blocks are matched, return nothing.\n *\n * @param {WPBlock[]} selectedBlocks The selected blocks.\n * @param {WPBlock[]} patternBlocks The pattern's blocks.\n * @return {WPBlock[]|void} The transformed pattern's blocks or undefined if not all selected blocks have been matched.\n */\nexport const getPatternTransformedBlocks = (\n\tselectedBlocks,\n\tpatternBlocks\n) => {\n\t// Clone Pattern's blocks to produce new clientIds and be able to mutate the matches.\n\tconst _patternBlocks = patternBlocks.map( ( block ) =>\n\t\tcloneBlock( block )\n\t);\n\t/**\n\t * Keep track of the consumed pattern blocks.\n\t * This is needed because we loop the selected blocks\n\t * and for example we may have selected two paragraphs and\n\t * the pattern's blocks could have more `paragraphs`.\n\t */\n\tconst consumedBlocks = new Set();\n\tfor ( const selectedBlock of selectedBlocks ) {\n\t\tlet isMatch = false;\n\t\tfor ( const patternBlock of _patternBlocks ) {\n\t\t\tconst match = getMatchingBlockByName(\n\t\t\t\tpatternBlock,\n\t\t\t\tselectedBlock.name,\n\t\t\t\tconsumedBlocks\n\t\t\t);\n\t\t\tif ( ! match )
|
|
1
|
+
{"version":3,"names":["_element","require","_blocks","_utils","transformMatchingBlock","match","selectedBlock","retainedBlockAttributes","getRetainedBlockAttributes","name","attributes","exports","getPatternTransformedBlocks","selectedBlocks","patternBlocks","_patternBlocks","map","block","cloneBlock","consumedBlocks","Set","isMatch","patternBlock","getMatchingBlockByName","add","clientId","useTransformedPatterns","patterns","useMemo","reduce","accumulator","_pattern","transformedBlocks","blocks","push","_default","default"],"sources":["@wordpress/block-editor/src/components/block-switcher/use-transformed-patterns.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport { cloneBlock } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { getMatchingBlockByName, getRetainedBlockAttributes } from './utils';\n\n/**\n * Mutate the matched block's attributes by getting\n * which block type's attributes to retain and prioritize\n * them in the merging of the attributes.\n *\n * @param {WPBlock} match The matched block.\n * @param {WPBlock} selectedBlock The selected block.\n * @return {void}\n */\nexport const transformMatchingBlock = ( match, selectedBlock ) => {\n\t// Get the block attributes to retain through the transformation.\n\tconst retainedBlockAttributes = getRetainedBlockAttributes(\n\t\tselectedBlock.name,\n\t\tselectedBlock.attributes\n\t);\n\tmatch.attributes = {\n\t\t...match.attributes,\n\t\t...retainedBlockAttributes,\n\t};\n};\n\n/**\n * By providing the selected blocks and pattern's blocks\n * find the matching blocks, transform them and return them.\n * If not all selected blocks are matched, return nothing.\n *\n * @param {WPBlock[]} selectedBlocks The selected blocks.\n * @param {WPBlock[]} patternBlocks The pattern's blocks.\n * @return {WPBlock[]|void} The transformed pattern's blocks or undefined if not all selected blocks have been matched.\n */\nexport const getPatternTransformedBlocks = (\n\tselectedBlocks,\n\tpatternBlocks\n) => {\n\t// Clone Pattern's blocks to produce new clientIds and be able to mutate the matches.\n\tconst _patternBlocks = patternBlocks.map( ( block ) =>\n\t\tcloneBlock( block )\n\t);\n\t/**\n\t * Keep track of the consumed pattern blocks.\n\t * This is needed because we loop the selected blocks\n\t * and for example we may have selected two paragraphs and\n\t * the pattern's blocks could have more `paragraphs`.\n\t */\n\tconst consumedBlocks = new Set();\n\tfor ( const selectedBlock of selectedBlocks ) {\n\t\tlet isMatch = false;\n\t\tfor ( const patternBlock of _patternBlocks ) {\n\t\t\tconst match = getMatchingBlockByName(\n\t\t\t\tpatternBlock,\n\t\t\t\tselectedBlock.name,\n\t\t\t\tconsumedBlocks\n\t\t\t);\n\t\t\tif ( ! match ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tisMatch = true;\n\t\t\tconsumedBlocks.add( match.clientId );\n\t\t\t// We update (mutate) the matching pattern block.\n\t\t\ttransformMatchingBlock( match, selectedBlock );\n\t\t\t// No need to loop through other pattern's blocks.\n\t\t\tbreak;\n\t\t}\n\t\t// Bail eary if a selected block has not been matched.\n\t\tif ( ! isMatch ) {\n\t\t\treturn;\n\t\t}\n\t}\n\treturn _patternBlocks;\n};\n\n/**\n * @typedef {WPBlockPattern & {transformedBlocks: WPBlock[]}} TransformedBlockPattern\n */\n\n/**\n * Custom hook that accepts patterns from state and the selected\n * blocks and tries to match these with the pattern's blocks.\n * If all selected blocks are matched with a Pattern's block,\n * we transform them by retaining block's attributes with `role:content`.\n * The transformed pattern's blocks are set to a new pattern\n * property `transformedBlocks`.\n *\n * @param {WPBlockPattern[]} patterns Patterns from state.\n * @param {WPBlock[]} selectedBlocks The currently selected blocks.\n * @return {TransformedBlockPattern[]} Returns the eligible matched patterns with all the selected blocks.\n */\nconst useTransformedPatterns = ( patterns, selectedBlocks ) => {\n\treturn useMemo(\n\t\t() =>\n\t\t\tpatterns.reduce( ( accumulator, _pattern ) => {\n\t\t\t\tconst transformedBlocks = getPatternTransformedBlocks(\n\t\t\t\t\tselectedBlocks,\n\t\t\t\t\t_pattern.blocks\n\t\t\t\t);\n\t\t\t\tif ( transformedBlocks ) {\n\t\t\t\t\taccumulator.push( {\n\t\t\t\t\t\t..._pattern,\n\t\t\t\t\t\ttransformedBlocks,\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t\treturn accumulator;\n\t\t\t}, [] ),\n\t\t[ patterns, selectedBlocks ]\n\t);\n};\n\nexport default useTransformedPatterns;\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAKA,IAAAE,MAAA,GAAAF,OAAA;AATA;AACA;AACA;;AAIA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMG,sBAAsB,GAAGA,CAAEC,KAAK,EAAEC,aAAa,KAAM;EACjE;EACA,MAAMC,uBAAuB,GAAG,IAAAC,iCAA0B,EACzDF,aAAa,CAACG,IAAI,EAClBH,aAAa,CAACI,UACf,CAAC;EACDL,KAAK,CAACK,UAAU,GAAG;IAClB,GAAGL,KAAK,CAACK,UAAU;IACnB,GAAGH;EACJ,CAAC;AACF,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AARAI,OAAA,CAAAP,sBAAA,GAAAA,sBAAA;AASO,MAAMQ,2BAA2B,GAAGA,CAC1CC,cAAc,EACdC,aAAa,KACT;EACJ;EACA,MAAMC,cAAc,GAAGD,aAAa,CAACE,GAAG,CAAIC,KAAK,IAChD,IAAAC,kBAAU,EAAED,KAAM,CACnB,CAAC;EACD;AACD;AACA;AACA;AACA;AACA;EACC,MAAME,cAAc,GAAG,IAAIC,GAAG,CAAC,CAAC;EAChC,KAAM,MAAMd,aAAa,IAAIO,cAAc,EAAG;IAC7C,IAAIQ,OAAO,GAAG,KAAK;IACnB,KAAM,MAAMC,YAAY,IAAIP,cAAc,EAAG;MAC5C,MAAMV,KAAK,GAAG,IAAAkB,6BAAsB,EACnCD,YAAY,EACZhB,aAAa,CAACG,IAAI,EAClBU,cACD,CAAC;MACD,IAAK,CAAEd,KAAK,EAAG;QACd;MACD;MACAgB,OAAO,GAAG,IAAI;MACdF,cAAc,CAACK,GAAG,CAAEnB,KAAK,CAACoB,QAAS,CAAC;MACpC;MACArB,sBAAsB,CAAEC,KAAK,EAAEC,aAAc,CAAC;MAC9C;MACA;IACD;IACA;IACA,IAAK,CAAEe,OAAO,EAAG;MAChB;IACD;EACD;EACA,OAAON,cAAc;AACtB,CAAC;;AAED;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAXAJ,OAAA,CAAAC,2BAAA,GAAAA,2BAAA;AAYA,MAAMc,sBAAsB,GAAGA,CAAEC,QAAQ,EAAEd,cAAc,KAAM;EAC9D,OAAO,IAAAe,gBAAO,EACb,MACCD,QAAQ,CAACE,MAAM,CAAE,CAAEC,WAAW,EAAEC,QAAQ,KAAM;IAC7C,MAAMC,iBAAiB,GAAGpB,2BAA2B,CACpDC,cAAc,EACdkB,QAAQ,CAACE,MACV,CAAC;IACD,IAAKD,iBAAiB,EAAG;MACxBF,WAAW,CAACI,IAAI,CAAE;QACjB,GAAGH,QAAQ;QACXC;MACD,CAAE,CAAC;IACJ;IACA,OAAOF,WAAW;EACnB,CAAC,EAAE,EAAG,CAAC,EACR,CAAEH,QAAQ,EAAEd,cAAc,CAC3B,CAAC;AACF,CAAC;AAAC,IAAAsB,QAAA,GAAAxB,OAAA,CAAAyB,OAAA,GAEaV,sBAAsB","ignoreList":[]}
|
|
@@ -28,12 +28,18 @@ const getMatchingBlockByName = (block, selectedBlockName, consumedBlocks = new S
|
|
|
28
28
|
innerBlocks = []
|
|
29
29
|
} = block;
|
|
30
30
|
// Check if block has been consumed already.
|
|
31
|
-
if (consumedBlocks.has(clientId))
|
|
32
|
-
|
|
31
|
+
if (consumedBlocks.has(clientId)) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
if (name === selectedBlockName) {
|
|
35
|
+
return block;
|
|
36
|
+
}
|
|
33
37
|
// Try to find a matching block from InnerBlocks recursively.
|
|
34
38
|
for (const innerBlock of innerBlocks) {
|
|
35
39
|
const match = getMatchingBlockByName(innerBlock, selectedBlockName, consumedBlocks);
|
|
36
|
-
if (match)
|
|
40
|
+
if (match) {
|
|
41
|
+
return match;
|
|
42
|
+
}
|
|
37
43
|
}
|
|
38
44
|
};
|
|
39
45
|
|
|
@@ -50,9 +56,13 @@ const getMatchingBlockByName = (block, selectedBlockName, consumedBlocks = new S
|
|
|
50
56
|
exports.getMatchingBlockByName = getMatchingBlockByName;
|
|
51
57
|
const getRetainedBlockAttributes = (name, attributes) => {
|
|
52
58
|
const contentAttributes = (0, _blocks.__experimentalGetBlockAttributesNamesByRole)(name, 'content');
|
|
53
|
-
if (!contentAttributes?.length)
|
|
59
|
+
if (!contentAttributes?.length) {
|
|
60
|
+
return attributes;
|
|
61
|
+
}
|
|
54
62
|
return contentAttributes.reduce((_accumulator, attribute) => {
|
|
55
|
-
if (attributes[attribute])
|
|
63
|
+
if (attributes[attribute]) {
|
|
64
|
+
_accumulator[attribute] = attributes[attribute];
|
|
65
|
+
}
|
|
56
66
|
return _accumulator;
|
|
57
67
|
}, {});
|
|
58
68
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_blocks","require","getMatchingBlockByName","block","selectedBlockName","consumedBlocks","Set","clientId","name","innerBlocks","has","innerBlock","match","exports","getRetainedBlockAttributes","attributes","contentAttributes","getBlockAttributesNamesByRole","length","reduce","_accumulator","attribute"],"sources":["@wordpress/block-editor/src/components/block-switcher/utils.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalGetBlockAttributesNamesByRole as getBlockAttributesNamesByRole } from '@wordpress/blocks';\n\n/**\n * Try to find a matching block by a block's name in a provided\n * block. We recurse through InnerBlocks and return the reference\n * of the matched block (it could be an InnerBlock).\n * If no match is found return nothing.\n *\n * @param {WPBlock} block The block to try to find a match.\n * @param {string} selectedBlockName The block's name to use for matching condition.\n * @param {Set} consumedBlocks A set holding the previously matched/consumed blocks.\n *\n * @return {WPBlock | undefined} The matched block if found or nothing(`undefined`).\n */\nexport const getMatchingBlockByName = (\n\tblock,\n\tselectedBlockName,\n\tconsumedBlocks = new Set()\n) => {\n\tconst { clientId, name, innerBlocks = [] } = block;\n\t// Check if block has been consumed already.\n\tif ( consumedBlocks.has( clientId ) )
|
|
1
|
+
{"version":3,"names":["_blocks","require","getMatchingBlockByName","block","selectedBlockName","consumedBlocks","Set","clientId","name","innerBlocks","has","innerBlock","match","exports","getRetainedBlockAttributes","attributes","contentAttributes","getBlockAttributesNamesByRole","length","reduce","_accumulator","attribute"],"sources":["@wordpress/block-editor/src/components/block-switcher/utils.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalGetBlockAttributesNamesByRole as getBlockAttributesNamesByRole } from '@wordpress/blocks';\n\n/**\n * Try to find a matching block by a block's name in a provided\n * block. We recurse through InnerBlocks and return the reference\n * of the matched block (it could be an InnerBlock).\n * If no match is found return nothing.\n *\n * @param {WPBlock} block The block to try to find a match.\n * @param {string} selectedBlockName The block's name to use for matching condition.\n * @param {Set} consumedBlocks A set holding the previously matched/consumed blocks.\n *\n * @return {WPBlock | undefined} The matched block if found or nothing(`undefined`).\n */\nexport const getMatchingBlockByName = (\n\tblock,\n\tselectedBlockName,\n\tconsumedBlocks = new Set()\n) => {\n\tconst { clientId, name, innerBlocks = [] } = block;\n\t// Check if block has been consumed already.\n\tif ( consumedBlocks.has( clientId ) ) {\n\t\treturn;\n\t}\n\tif ( name === selectedBlockName ) {\n\t\treturn block;\n\t}\n\t// Try to find a matching block from InnerBlocks recursively.\n\tfor ( const innerBlock of innerBlocks ) {\n\t\tconst match = getMatchingBlockByName(\n\t\t\tinnerBlock,\n\t\t\tselectedBlockName,\n\t\t\tconsumedBlocks\n\t\t);\n\t\tif ( match ) {\n\t\t\treturn match;\n\t\t}\n\t}\n};\n\n/**\n * Find and return the block attributes to retain through\n * the transformation, based on Block Type's `role:content`\n * attributes. If no `role:content` attributes exist,\n * return selected block's attributes.\n *\n * @param {string} name Block type's namespaced name.\n * @param {Object} attributes Selected block's attributes.\n * @return {Object} The block's attributes to retain.\n */\nexport const getRetainedBlockAttributes = ( name, attributes ) => {\n\tconst contentAttributes = getBlockAttributesNamesByRole( name, 'content' );\n\tif ( ! contentAttributes?.length ) {\n\t\treturn attributes;\n\t}\n\n\treturn contentAttributes.reduce( ( _accumulator, attribute ) => {\n\t\tif ( attributes[ attribute ] ) {\n\t\t\t_accumulator[ attribute ] = attributes[ attribute ];\n\t\t}\n\t\treturn _accumulator;\n\t}, {} );\n};\n"],"mappings":";;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,sBAAsB,GAAGA,CACrCC,KAAK,EACLC,iBAAiB,EACjBC,cAAc,GAAG,IAAIC,GAAG,CAAC,CAAC,KACtB;EACJ,MAAM;IAAEC,QAAQ;IAAEC,IAAI;IAAEC,WAAW,GAAG;EAAG,CAAC,GAAGN,KAAK;EAClD;EACA,IAAKE,cAAc,CAACK,GAAG,CAAEH,QAAS,CAAC,EAAG;IACrC;EACD;EACA,IAAKC,IAAI,KAAKJ,iBAAiB,EAAG;IACjC,OAAOD,KAAK;EACb;EACA;EACA,KAAM,MAAMQ,UAAU,IAAIF,WAAW,EAAG;IACvC,MAAMG,KAAK,GAAGV,sBAAsB,CACnCS,UAAU,EACVP,iBAAiB,EACjBC,cACD,CAAC;IACD,IAAKO,KAAK,EAAG;MACZ,OAAOA,KAAK;IACb;EACD;AACD,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AATAC,OAAA,CAAAX,sBAAA,GAAAA,sBAAA;AAUO,MAAMY,0BAA0B,GAAGA,CAAEN,IAAI,EAAEO,UAAU,KAAM;EACjE,MAAMC,iBAAiB,GAAG,IAAAC,mDAA6B,EAAET,IAAI,EAAE,SAAU,CAAC;EAC1E,IAAK,CAAEQ,iBAAiB,EAAEE,MAAM,EAAG;IAClC,OAAOH,UAAU;EAClB;EAEA,OAAOC,iBAAiB,CAACG,MAAM,CAAE,CAAEC,YAAY,EAAEC,SAAS,KAAM;IAC/D,IAAKN,UAAU,CAAEM,SAAS,CAAE,EAAG;MAC9BD,YAAY,CAAEC,SAAS,CAAE,GAAGN,UAAU,CAAEM,SAAS,CAAE;IACpD;IACA,OAAOD,YAAY;EACpB,CAAC,EAAE,CAAC,CAAE,CAAC;AACR,CAAC;AAACP,OAAA,CAAAC,0BAAA,GAAAA,0BAAA","ignoreList":[]}
|
|
@@ -22,8 +22,10 @@ var _useHasBlockControls = require("../block-controls/use-has-block-controls");
|
|
|
22
22
|
* @return {boolean} Whether the block toolbar component will be rendered.
|
|
23
23
|
*/
|
|
24
24
|
function useHasBlockToolbar() {
|
|
25
|
-
const
|
|
26
|
-
|
|
25
|
+
const {
|
|
26
|
+
isToolbarEnabled,
|
|
27
|
+
isDefaultEditingMode
|
|
28
|
+
} = (0, _data.useSelect)(select => {
|
|
27
29
|
const {
|
|
28
30
|
getBlockEditingMode,
|
|
29
31
|
getBlockName,
|
|
@@ -34,13 +36,16 @@ function useHasBlockToolbar() {
|
|
|
34
36
|
// for the toolbar, so we use getBlockSelectionStart
|
|
35
37
|
// instead of getSelectedBlockClientIds
|
|
36
38
|
const selectedBlockClientId = getBlockSelectionStart();
|
|
37
|
-
const isDefaultEditingMode = getBlockEditingMode(selectedBlockClientId) === 'default';
|
|
38
39
|
const blockType = selectedBlockClientId && (0, _blocks.getBlockType)(getBlockName(selectedBlockClientId));
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
|
|
40
|
+
return {
|
|
41
|
+
isToolbarEnabled: blockType && (0, _blocks.hasBlockSupport)(blockType, '__experimentalToolbar', true),
|
|
42
|
+
isDefaultEditingMode: getBlockEditingMode(selectedBlockClientId) === 'default'
|
|
43
|
+
};
|
|
44
|
+
}, []);
|
|
45
|
+
const hasAnyBlockControls = (0, _useHasBlockControls.useHasAnyBlockControls)();
|
|
46
|
+
if (!isToolbarEnabled || !isDefaultEditingMode && !hasAnyBlockControls) {
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
return true;
|
|
45
50
|
}
|
|
46
51
|
//# sourceMappingURL=use-has-block-toolbar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_blocks","_store","_useHasBlockControls","useHasBlockToolbar","
|
|
1
|
+
{"version":3,"names":["_data","require","_blocks","_store","_useHasBlockControls","useHasBlockToolbar","isToolbarEnabled","isDefaultEditingMode","useSelect","select","getBlockEditingMode","getBlockName","getBlockSelectionStart","blockEditorStore","selectedBlockClientId","blockType","getBlockType","hasBlockSupport","hasAnyBlockControls","useHasAnyBlockControls"],"sources":["@wordpress/block-editor/src/components/block-toolbar/use-has-block-toolbar.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { getBlockType, hasBlockSupport } from '@wordpress/blocks';\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { useHasAnyBlockControls } from '../block-controls/use-has-block-controls';\n\n/**\n * Returns true if the block toolbar should be shown.\n *\n * @return {boolean} Whether the block toolbar component will be rendered.\n */\nexport function useHasBlockToolbar() {\n\tconst { isToolbarEnabled, isDefaultEditingMode } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockEditingMode,\n\t\t\t\tgetBlockName,\n\t\t\t\tgetBlockSelectionStart,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\t// we only care about the 1st selected block\n\t\t\t// for the toolbar, so we use getBlockSelectionStart\n\t\t\t// instead of getSelectedBlockClientIds\n\t\t\tconst selectedBlockClientId = getBlockSelectionStart();\n\n\t\t\tconst blockType =\n\t\t\t\tselectedBlockClientId &&\n\t\t\t\tgetBlockType( getBlockName( selectedBlockClientId ) );\n\n\t\t\treturn {\n\t\t\t\tisToolbarEnabled:\n\t\t\t\t\tblockType &&\n\t\t\t\t\thasBlockSupport( blockType, '__experimentalToolbar', true ),\n\t\t\t\tisDefaultEditingMode:\n\t\t\t\t\tgetBlockEditingMode( selectedBlockClientId ) === 'default',\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tconst hasAnyBlockControls = useHasAnyBlockControls();\n\n\tif (\n\t\t! isToolbarEnabled ||\n\t\t( ! isDefaultEditingMode && ! hasAnyBlockControls )\n\t) {\n\t\treturn false;\n\t}\n\n\treturn true;\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAIA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,oBAAA,GAAAH,OAAA;AATA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACO,SAASI,kBAAkBA,CAAA,EAAG;EACpC,MAAM;IAAEC,gBAAgB;IAAEC;EAAqB,CAAC,GAAG,IAAAC,eAAS,EACzDC,MAAM,IAAM;IACb,MAAM;MACLC,mBAAmB;MACnBC,YAAY;MACZC;IACD,CAAC,GAAGH,MAAM,CAAEI,YAAiB,CAAC;;IAE9B;IACA;IACA;IACA,MAAMC,qBAAqB,GAAGF,sBAAsB,CAAC,CAAC;IAEtD,MAAMG,SAAS,GACdD,qBAAqB,IACrB,IAAAE,oBAAY,EAAEL,YAAY,CAAEG,qBAAsB,CAAE,CAAC;IAEtD,OAAO;MACNR,gBAAgB,EACfS,SAAS,IACT,IAAAE,uBAAe,EAAEF,SAAS,EAAE,uBAAuB,EAAE,IAAK,CAAC;MAC5DR,oBAAoB,EACnBG,mBAAmB,CAAEI,qBAAsB,CAAC,KAAK;IACnD,CAAC;EACF,CAAC,EACD,EACD,CAAC;EAED,MAAMI,mBAAmB,GAAG,IAAAC,2CAAsB,EAAC,CAAC;EAEpD,IACC,CAAEb,gBAAgB,IAChB,CAAEC,oBAAoB,IAAI,CAAEW,mBAAqB,EAClD;IACD,OAAO,KAAK;EACb;EAEA,OAAO,IAAI;AACZ","ignoreList":[]}
|
|
@@ -89,7 +89,9 @@ function BlockTools({
|
|
|
89
89
|
expandBlock
|
|
90
90
|
} = (0, _lockUnlock.unlock)((0, _data.useDispatch)(_store.store));
|
|
91
91
|
function onKeyDown(event) {
|
|
92
|
-
if (event.defaultPrevented)
|
|
92
|
+
if (event.defaultPrevented) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
93
95
|
if (isMatch('core/block-editor/move-up', event)) {
|
|
94
96
|
const clientIds = getSelectedBlockClientIds();
|
|
95
97
|
if (clientIds.length) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_dom","_components","_keyboardShortcuts","_element","_emptyBlockInserter","_interopRequireDefault","_insertionPoint","_interopRequireWildcard","_blockToolbarPopover","_blockToolbarBreadcrumb","_store","_usePopoverScroll","_zoomOutModeInserters","_useShowBlockTools","_lockUnlock","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","selector","select","getSelectedBlockClientId","getFirstMultiSelectedBlockClientId","getSettings","__unstableGetEditorMode","isTyping","blockEditorStore","clientId","editorMode","hasFixedToolbar","isZoomOutMode","BlockTools","children","__unstableContentRef","props","useSelect","isMatch","useShortcutEventMatch","getSelectedBlockClientIds","getBlockRootClientId","showEmptyBlockSideInserter","showBreadcrumb","showBlockToolbarPopover","useShowBlockTools","duplicateBlocks","removeBlocks","insertAfterBlock","insertBeforeBlock","selectBlock","moveBlocksUp","moveBlocksDown","expandBlock","unlock","useDispatch","onKeyDown","event","defaultPrevented","clientIds","length","preventDefault","rootClientId","target","closest","isTextField","contentWindow","document","activeElement","blockToolbarRef","usePopoverScroll","blockToolbarAfterRef","_react","createElement","InsertionPointOpenRef","Provider","value","useRef","Popover","Slot","name","ref"],"sources":["@wordpress/block-editor/src/components/block-tools/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { isTextField } from '@wordpress/dom';\nimport { Popover } from '@wordpress/components';\nimport { __unstableUseShortcutEventMatch as useShortcutEventMatch } from '@wordpress/keyboard-shortcuts';\nimport { useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport EmptyBlockInserter from './empty-block-inserter';\nimport {\n\tInsertionPointOpenRef,\n\tdefault as InsertionPoint,\n} from './insertion-point';\nimport BlockToolbarPopover from './block-toolbar-popover';\nimport BlockToolbarBreadcrumb from './block-toolbar-breadcrumb';\nimport { store as blockEditorStore } from '../../store';\nimport usePopoverScroll from '../block-popover/use-popover-scroll';\nimport ZoomOutModeInserters from './zoom-out-mode-inserters';\nimport { useShowBlockTools } from './use-show-block-tools';\nimport { unlock } from '../../lock-unlock';\n\nfunction selector( select ) {\n\tconst {\n\t\tgetSelectedBlockClientId,\n\t\tgetFirstMultiSelectedBlockClientId,\n\t\tgetSettings,\n\t\t__unstableGetEditorMode,\n\t\tisTyping,\n\t} = select( blockEditorStore );\n\n\tconst clientId =\n\t\tgetSelectedBlockClientId() || getFirstMultiSelectedBlockClientId();\n\n\tconst editorMode = __unstableGetEditorMode();\n\n\treturn {\n\t\tclientId,\n\t\thasFixedToolbar: getSettings().hasFixedToolbar,\n\t\tisTyping: isTyping(),\n\t\tisZoomOutMode: editorMode === 'zoom-out',\n\t};\n}\n\n/**\n * Renders block tools (the block toolbar, select/navigation mode toolbar, the\n * insertion point and a slot for the inline rich text toolbar). Must be wrapped\n * around the block content and editor styles wrapper or iframe.\n *\n * @param {Object} $0 Props.\n * @param {Object} $0.children The block content and style container.\n * @param {Object} $0.__unstableContentRef Ref holding the content scroll container.\n */\nexport default function BlockTools( {\n\tchildren,\n\t__unstableContentRef,\n\t...props\n} ) {\n\tconst { clientId, hasFixedToolbar, isTyping, isZoomOutMode } = useSelect(\n\t\tselector,\n\t\t[]\n\t);\n\tconst isMatch = useShortcutEventMatch();\n\tconst { getSelectedBlockClientIds, getBlockRootClientId } =\n\t\tuseSelect( blockEditorStore );\n\n\tconst {\n\t\tshowEmptyBlockSideInserter,\n\t\tshowBreadcrumb,\n\t\tshowBlockToolbarPopover,\n\t} = useShowBlockTools();\n\n\tconst {\n\t\tduplicateBlocks,\n\t\tremoveBlocks,\n\t\tinsertAfterBlock,\n\t\tinsertBeforeBlock,\n\t\tselectBlock,\n\t\tmoveBlocksUp,\n\t\tmoveBlocksDown,\n\t\texpandBlock,\n\t} = unlock( useDispatch( blockEditorStore ) );\n\n\tfunction onKeyDown( event ) {\n\t\tif ( event.defaultPrevented ) return;\n\n\t\tif ( isMatch( 'core/block-editor/move-up', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tconst rootClientId = getBlockRootClientId( clientIds[ 0 ] );\n\t\t\t\tmoveBlocksUp( clientIds, rootClientId );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/move-down', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tconst rootClientId = getBlockRootClientId( clientIds[ 0 ] );\n\t\t\t\tmoveBlocksDown( clientIds, rootClientId );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/duplicate', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tduplicateBlocks( clientIds );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/remove', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tremoveBlocks( clientIds );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/insert-after', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tinsertAfterBlock( clientIds[ clientIds.length - 1 ] );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/insert-before', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tinsertBeforeBlock( clientIds[ 0 ] );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/unselect', event ) ) {\n\t\t\tif ( event.target.closest( '[role=toolbar]' ) ) {\n\t\t\t\t// This shouldn't be necessary, but we have a combination of a few things all combining to create a situation where:\n\t\t\t\t// - Because the block toolbar uses createPortal to populate the block toolbar fills, we can't rely on the React event bubbling to hit the onKeyDown listener for the block toolbar\n\t\t\t\t// - Since we can't use the React tree, we use the DOM tree which _should_ handle the event bubbling correctly from a `createPortal` element.\n\t\t\t\t// - This bubbles via the React tree, which hits this `unselect` escape keypress before the block toolbar DOM event listener has access to it.\n\t\t\t\t// An alternative would be to remove the addEventListener on the navigableToolbar and use this event to handle it directly right here. That feels hacky too though.\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length > 1 ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\t// If there is more than one block selected, select the first\n\t\t\t\t// block so that focus is directed back to the beginning of the selection.\n\t\t\t\t// In effect, to the user this feels like deselecting the multi-selection.\n\t\t\t\tselectBlock( clientIds[ 0 ] );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/collapse-list-view', event ) ) {\n\t\t\t// If focus is currently within a text field, such as a rich text block or other editable field,\n\t\t\t// skip collapsing the list view, and allow the keyboard shortcut to be handled by the text field.\n\t\t\t// This condition checks for both the active element and the active element within an iframed editor.\n\t\t\tif (\n\t\t\t\tisTextField( event.target ) ||\n\t\t\t\tisTextField(\n\t\t\t\t\tevent.target?.contentWindow?.document?.activeElement\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tevent.preventDefault();\n\t\t\texpandBlock( clientId );\n\t\t}\n\t}\n\n\tconst blockToolbarRef = usePopoverScroll( __unstableContentRef );\n\tconst blockToolbarAfterRef = usePopoverScroll( __unstableContentRef );\n\n\treturn (\n\t\t// eslint-disable-next-line jsx-a11y/no-static-element-interactions\n\t\t<div { ...props } onKeyDown={ onKeyDown }>\n\t\t\t<InsertionPointOpenRef.Provider value={ useRef( false ) }>\n\t\t\t\t{ ! isTyping && (\n\t\t\t\t\t<InsertionPoint\n\t\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\n\t\t\t\t{ showEmptyBlockSideInserter && (\n\t\t\t\t\t<EmptyBlockInserter\n\t\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\n\t\t\t\t{ showBlockToolbarPopover && (\n\t\t\t\t\t<BlockToolbarPopover\n\t\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\tisTyping={ isTyping }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\n\t\t\t\t{ showBreadcrumb && (\n\t\t\t\t\t<BlockToolbarBreadcrumb\n\t\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\n\t\t\t\t{ /* Used for the inline rich text toolbar. Until this toolbar is combined into BlockToolbar, someone implementing their own BlockToolbar will also need to use this to see the image caption toolbar. */ }\n\t\t\t\t{ ! isZoomOutMode && ! hasFixedToolbar && (\n\t\t\t\t\t<Popover.Slot\n\t\t\t\t\t\tname=\"block-toolbar\"\n\t\t\t\t\t\tref={ blockToolbarRef }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ children }\n\t\t\t\t{ /* Used for inline rich text popovers. */ }\n\t\t\t\t<Popover.Slot\n\t\t\t\t\tname=\"__unstable-block-tools-after\"\n\t\t\t\t\tref={ blockToolbarAfterRef }\n\t\t\t\t/>\n\t\t\t\t{ isZoomOutMode && (\n\t\t\t\t\t<ZoomOutModeInserters\n\t\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</InsertionPointOpenRef.Provider>\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,IAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,kBAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AAKA,IAAAK,mBAAA,GAAAC,sBAAA,CAAAN,OAAA;AACA,IAAAO,eAAA,GAAAC,uBAAA,CAAAR,OAAA;AAIA,IAAAS,oBAAA,GAAAH,sBAAA,CAAAN,OAAA;AACA,IAAAU,uBAAA,GAAAJ,sBAAA,CAAAN,OAAA;AACA,IAAAW,MAAA,GAAAX,OAAA;AACA,IAAAY,iBAAA,GAAAN,sBAAA,CAAAN,OAAA;AACA,IAAAa,qBAAA,GAAAP,sBAAA,CAAAN,OAAA;AACA,IAAAc,kBAAA,GAAAd,OAAA;AACA,IAAAe,WAAA,GAAAf,OAAA;AAA2C,SAAAgB,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAT,wBAAAS,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAA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uB,IACxB,IAAA4B,MAAA,CAAAC,aAAA,EAAC/E,oBAAA,CAAAa,OAAmB;MACnB4B,oBAAoB,EAAGA,oBAAsB;MAC7CN,QAAQ,EAAGA,QAAU;MACrBF,QAAQ,EAAGA;IAAU,CACrB,CACD,EAECgB,cAAc,IACf,IAAA6B,MAAA,CAAAC,aAAA,EAAC9E,uBAAA,CAAAY,OAAsB;MACtB4B,oBAAoB,EAAGA,oBAAsB;MAC7CN,QAAQ,EAAGA;IAAU,CACrB,CACD,EAGC,CAAEG,aAAa,IAAI,CAAED,eAAe,IACrC,IAAAyC,MAAA,CAAAC,aAAA,EAACtF,WAAA,CAAA2F,OAAO,CAACC,IAAI;MACZC,IAAI,EAAC,eAAe;MACpBC,GAAG,EAAGZ;IAAiB,CACvB,CACD,EACCnC,QAAQ,EAEV,IAAAsC,MAAA,CAAAC,aAAA,EAACtF,WAAA,CAAA2F,OAAO,CAACC,IAAI;MACZC,IAAI,EAAC,8BAA8B;MACnCC,GAAG,EAAGV;IAAsB,CAC5B,CAAC,EACAvC,aAAa,IACd,IAAAwC,MAAA,CAAAC,aAAA,EAAC3E,qBAAA,CAAAS,OAAoB;MACpB4B,oBAAoB,EAAGA;IAAsB,CAC7C,CAE6B,CAC5B;EAAC;AAER","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_data","require","_dom","_components","_keyboardShortcuts","_element","_emptyBlockInserter","_interopRequireDefault","_insertionPoint","_interopRequireWildcard","_blockToolbarPopover","_blockToolbarBreadcrumb","_store","_usePopoverScroll","_zoomOutModeInserters","_useShowBlockTools","_lockUnlock","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","selector","select","getSelectedBlockClientId","getFirstMultiSelectedBlockClientId","getSettings","__unstableGetEditorMode","isTyping","blockEditorStore","clientId","editorMode","hasFixedToolbar","isZoomOutMode","BlockTools","children","__unstableContentRef","props","useSelect","isMatch","useShortcutEventMatch","getSelectedBlockClientIds","getBlockRootClientId","showEmptyBlockSideInserter","showBreadcrumb","showBlockToolbarPopover","useShowBlockTools","duplicateBlocks","removeBlocks","insertAfterBlock","insertBeforeBlock","selectBlock","moveBlocksUp","moveBlocksDown","expandBlock","unlock","useDispatch","onKeyDown","event","defaultPrevented","clientIds","length","preventDefault","rootClientId","target","closest","isTextField","contentWindow","document","activeElement","blockToolbarRef","usePopoverScroll","blockToolbarAfterRef","_react","createElement","InsertionPointOpenRef","Provider","value","useRef","Popover","Slot","name","ref"],"sources":["@wordpress/block-editor/src/components/block-tools/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { isTextField } from '@wordpress/dom';\nimport { Popover } from '@wordpress/components';\nimport { __unstableUseShortcutEventMatch as useShortcutEventMatch } from '@wordpress/keyboard-shortcuts';\nimport { useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport EmptyBlockInserter from './empty-block-inserter';\nimport {\n\tInsertionPointOpenRef,\n\tdefault as InsertionPoint,\n} from './insertion-point';\nimport BlockToolbarPopover from './block-toolbar-popover';\nimport BlockToolbarBreadcrumb from './block-toolbar-breadcrumb';\nimport { store as blockEditorStore } from '../../store';\nimport usePopoverScroll from '../block-popover/use-popover-scroll';\nimport ZoomOutModeInserters from './zoom-out-mode-inserters';\nimport { useShowBlockTools } from './use-show-block-tools';\nimport { unlock } from '../../lock-unlock';\n\nfunction selector( select ) {\n\tconst {\n\t\tgetSelectedBlockClientId,\n\t\tgetFirstMultiSelectedBlockClientId,\n\t\tgetSettings,\n\t\t__unstableGetEditorMode,\n\t\tisTyping,\n\t} = select( blockEditorStore );\n\n\tconst clientId =\n\t\tgetSelectedBlockClientId() || getFirstMultiSelectedBlockClientId();\n\n\tconst editorMode = __unstableGetEditorMode();\n\n\treturn {\n\t\tclientId,\n\t\thasFixedToolbar: getSettings().hasFixedToolbar,\n\t\tisTyping: isTyping(),\n\t\tisZoomOutMode: editorMode === 'zoom-out',\n\t};\n}\n\n/**\n * Renders block tools (the block toolbar, select/navigation mode toolbar, the\n * insertion point and a slot for the inline rich text toolbar). Must be wrapped\n * around the block content and editor styles wrapper or iframe.\n *\n * @param {Object} $0 Props.\n * @param {Object} $0.children The block content and style container.\n * @param {Object} $0.__unstableContentRef Ref holding the content scroll container.\n */\nexport default function BlockTools( {\n\tchildren,\n\t__unstableContentRef,\n\t...props\n} ) {\n\tconst { clientId, hasFixedToolbar, isTyping, isZoomOutMode } = useSelect(\n\t\tselector,\n\t\t[]\n\t);\n\tconst isMatch = useShortcutEventMatch();\n\tconst { getSelectedBlockClientIds, getBlockRootClientId } =\n\t\tuseSelect( blockEditorStore );\n\n\tconst {\n\t\tshowEmptyBlockSideInserter,\n\t\tshowBreadcrumb,\n\t\tshowBlockToolbarPopover,\n\t} = useShowBlockTools();\n\n\tconst {\n\t\tduplicateBlocks,\n\t\tremoveBlocks,\n\t\tinsertAfterBlock,\n\t\tinsertBeforeBlock,\n\t\tselectBlock,\n\t\tmoveBlocksUp,\n\t\tmoveBlocksDown,\n\t\texpandBlock,\n\t} = unlock( useDispatch( blockEditorStore ) );\n\n\tfunction onKeyDown( event ) {\n\t\tif ( event.defaultPrevented ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( isMatch( 'core/block-editor/move-up', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tconst rootClientId = getBlockRootClientId( clientIds[ 0 ] );\n\t\t\t\tmoveBlocksUp( clientIds, rootClientId );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/move-down', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tconst rootClientId = getBlockRootClientId( clientIds[ 0 ] );\n\t\t\t\tmoveBlocksDown( clientIds, rootClientId );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/duplicate', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tduplicateBlocks( clientIds );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/remove', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tremoveBlocks( clientIds );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/insert-after', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tinsertAfterBlock( clientIds[ clientIds.length - 1 ] );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/insert-before', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tinsertBeforeBlock( clientIds[ 0 ] );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/unselect', event ) ) {\n\t\t\tif ( event.target.closest( '[role=toolbar]' ) ) {\n\t\t\t\t// This shouldn't be necessary, but we have a combination of a few things all combining to create a situation where:\n\t\t\t\t// - Because the block toolbar uses createPortal to populate the block toolbar fills, we can't rely on the React event bubbling to hit the onKeyDown listener for the block toolbar\n\t\t\t\t// - Since we can't use the React tree, we use the DOM tree which _should_ handle the event bubbling correctly from a `createPortal` element.\n\t\t\t\t// - This bubbles via the React tree, which hits this `unselect` escape keypress before the block toolbar DOM event listener has access to it.\n\t\t\t\t// An alternative would be to remove the addEventListener on the navigableToolbar and use this event to handle it directly right here. That feels hacky too though.\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length > 1 ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\t// If there is more than one block selected, select the first\n\t\t\t\t// block so that focus is directed back to the beginning of the selection.\n\t\t\t\t// In effect, to the user this feels like deselecting the multi-selection.\n\t\t\t\tselectBlock( clientIds[ 0 ] );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/collapse-list-view', event ) ) {\n\t\t\t// If focus is currently within a text field, such as a rich text block or other editable field,\n\t\t\t// skip collapsing the list view, and allow the keyboard shortcut to be handled by the text field.\n\t\t\t// This condition checks for both the active element and the active element within an iframed editor.\n\t\t\tif (\n\t\t\t\tisTextField( event.target ) ||\n\t\t\t\tisTextField(\n\t\t\t\t\tevent.target?.contentWindow?.document?.activeElement\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tevent.preventDefault();\n\t\t\texpandBlock( clientId );\n\t\t}\n\t}\n\n\tconst blockToolbarRef = usePopoverScroll( __unstableContentRef );\n\tconst blockToolbarAfterRef = usePopoverScroll( __unstableContentRef );\n\n\treturn (\n\t\t// eslint-disable-next-line jsx-a11y/no-static-element-interactions\n\t\t<div { ...props } onKeyDown={ onKeyDown }>\n\t\t\t<InsertionPointOpenRef.Provider value={ useRef( false ) }>\n\t\t\t\t{ ! isTyping && (\n\t\t\t\t\t<InsertionPoint\n\t\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\n\t\t\t\t{ showEmptyBlockSideInserter && (\n\t\t\t\t\t<EmptyBlockInserter\n\t\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\n\t\t\t\t{ showBlockToolbarPopover && (\n\t\t\t\t\t<BlockToolbarPopover\n\t\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\tisTyping={ isTyping }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\n\t\t\t\t{ showBreadcrumb && (\n\t\t\t\t\t<BlockToolbarBreadcrumb\n\t\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\n\t\t\t\t{ /* Used for the inline rich text toolbar. Until this toolbar is combined into BlockToolbar, someone implementing their own BlockToolbar will also need to use this to see the image caption toolbar. */ }\n\t\t\t\t{ ! isZoomOutMode && ! hasFixedToolbar && (\n\t\t\t\t\t<Popover.Slot\n\t\t\t\t\t\tname=\"block-toolbar\"\n\t\t\t\t\t\tref={ blockToolbarRef }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ children }\n\t\t\t\t{ /* Used for inline rich text popovers. */ }\n\t\t\t\t<Popover.Slot\n\t\t\t\t\tname=\"__unstable-block-tools-after\"\n\t\t\t\t\tref={ blockToolbarAfterRef }\n\t\t\t\t/>\n\t\t\t\t{ isZoomOutMode && (\n\t\t\t\t\t<ZoomOutModeInserters\n\t\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</InsertionPointOpenRef.Provider>\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,IAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,kBAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AAKA,IAAAK,mBAAA,GAAAC,sBAAA,CAAAN,OAAA;AACA,IAAAO,eAAA,GAAAC,uBAAA,CAAAR,OAAA;AAIA,IAAAS,oBAAA,GAAAH,sBAAA,CAAAN,OAAA;AACA,IAAAU,uBAAA,GAAAJ,sBAAA,CAAAN,OAAA;AACA,IAAAW,MAAA,GAAAX,OAAA;AACA,IAAAY,iBAAA,GAAAN,sBAAA,CAAAN,OAAA;AACA,IAAAa,qBAAA,GAAAP,sBAAA,CAAAN,OAAA;AACA,IAAAc,kBAAA,GAA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C;AAER","ignoreList":[]}
|
|
@@ -7,7 +7,6 @@ exports.useShowBlockTools = useShowBlockTools;
|
|
|
7
7
|
var _data = require("@wordpress/data");
|
|
8
8
|
var _blocks = require("@wordpress/blocks");
|
|
9
9
|
var _store = require("../../store");
|
|
10
|
-
var _useHasBlockToolbar = require("../block-toolbar/use-has-block-toolbar");
|
|
11
10
|
/**
|
|
12
11
|
* WordPress dependencies
|
|
13
12
|
*/
|
|
@@ -22,7 +21,6 @@ var _useHasBlockToolbar = require("../block-toolbar/use-has-block-toolbar");
|
|
|
22
21
|
* @return {Object} Object of which block tools will be shown.
|
|
23
22
|
*/
|
|
24
23
|
function useShowBlockTools() {
|
|
25
|
-
const hasBlockToolbar = (0, _useHasBlockToolbar.useHasBlockToolbar)();
|
|
26
24
|
return (0, _data.useSelect)(select => {
|
|
27
25
|
const {
|
|
28
26
|
getSelectedBlockClientId,
|
|
@@ -46,9 +44,8 @@ function useShowBlockTools() {
|
|
|
46
44
|
return {
|
|
47
45
|
showEmptyBlockSideInserter: _showEmptyBlockSideInserter,
|
|
48
46
|
showBreadcrumb: !_showEmptyBlockSideInserter && maybeShowBreadcrumb,
|
|
49
|
-
showBlockToolbarPopover:
|
|
50
|
-
showFixedToolbar: editorMode !== 'zoom-out' && hasBlockToolbar && getSettings().hasFixedToolbar
|
|
47
|
+
showBlockToolbarPopover: !getSettings().hasFixedToolbar && !_showEmptyBlockSideInserter && hasSelectedBlock && !isEmptyDefaultBlock && !maybeShowBreadcrumb
|
|
51
48
|
};
|
|
52
|
-
}, [
|
|
49
|
+
}, []);
|
|
53
50
|
}
|
|
54
51
|
//# sourceMappingURL=use-show-block-tools.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_blocks","_store","
|
|
1
|
+
{"version":3,"names":["_data","require","_blocks","_store","useShowBlockTools","useSelect","select","getSelectedBlockClientId","getFirstMultiSelectedBlockClientId","getBlock","getSettings","hasMultiSelection","__unstableGetEditorMode","isTyping","blockEditorStore","clientId","block","name","attributes","editorMode","hasSelectedBlock","isEmptyDefaultBlock","isUnmodifiedDefaultBlock","_showEmptyBlockSideInserter","maybeShowBreadcrumb","showEmptyBlockSideInserter","showBreadcrumb","showBlockToolbarPopover","hasFixedToolbar"],"sources":["@wordpress/block-editor/src/components/block-tools/use-show-block-tools.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { isUnmodifiedDefaultBlock } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\n/**\n * Source of truth for which block tools are showing in the block editor.\n *\n * @return {Object} Object of which block tools will be shown.\n */\nexport function useShowBlockTools() {\n\treturn useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetSelectedBlockClientId,\n\t\t\tgetFirstMultiSelectedBlockClientId,\n\t\t\tgetBlock,\n\t\t\tgetSettings,\n\t\t\thasMultiSelection,\n\t\t\t__unstableGetEditorMode,\n\t\t\tisTyping,\n\t\t} = select( blockEditorStore );\n\n\t\tconst clientId =\n\t\t\tgetSelectedBlockClientId() || getFirstMultiSelectedBlockClientId();\n\n\t\tconst block = getBlock( clientId ) || { name: '', attributes: {} };\n\t\tconst editorMode = __unstableGetEditorMode();\n\t\tconst hasSelectedBlock = clientId && block?.name;\n\t\tconst isEmptyDefaultBlock = isUnmodifiedDefaultBlock( block );\n\t\tconst _showEmptyBlockSideInserter =\n\t\t\tclientId &&\n\t\t\t! isTyping() &&\n\t\t\teditorMode === 'edit' &&\n\t\t\tisEmptyDefaultBlock;\n\t\tconst maybeShowBreadcrumb =\n\t\t\thasSelectedBlock &&\n\t\t\t! hasMultiSelection() &&\n\t\t\t( editorMode === 'navigation' || editorMode === 'zoom-out' );\n\n\t\treturn {\n\t\t\tshowEmptyBlockSideInserter: _showEmptyBlockSideInserter,\n\t\t\tshowBreadcrumb:\n\t\t\t\t! _showEmptyBlockSideInserter && maybeShowBreadcrumb,\n\t\t\tshowBlockToolbarP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ACvDG,cAAc,EACb,CAAEH,2BAA2B,IAAIC,mBAAmB;MACrDG,uBAAuB,EACtB,CAAEjB,WAAW,CAAC,CAAC,CAACkB,eAAe,IAC/B,CAAEL,2BAA2B,IAC7BH,gBAAgB,IAChB,CAAEC,mBAAmB,IACrB,CAAEG;IACJ,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;AACR","ignoreList":[]}
|
|
@@ -11,6 +11,7 @@ var _element = require("@wordpress/element");
|
|
|
11
11
|
var _inbetween = _interopRequireDefault(require("../block-popover/inbetween"));
|
|
12
12
|
var _store = require("../../store");
|
|
13
13
|
var _inserter = _interopRequireDefault(require("../inserter"));
|
|
14
|
+
var _lockUnlock = require("../../lock-unlock");
|
|
14
15
|
/**
|
|
15
16
|
* WordPress dependencies
|
|
16
17
|
*/
|
|
@@ -24,7 +25,10 @@ function ZoomOutModeInserters({
|
|
|
24
25
|
}) {
|
|
25
26
|
const [isReady, setIsReady] = (0, _element.useState)(false);
|
|
26
27
|
const blockOrder = (0, _data.useSelect)(select => {
|
|
27
|
-
|
|
28
|
+
const {
|
|
29
|
+
sectionRootClientId
|
|
30
|
+
} = (0, _lockUnlock.unlock)(select(_store.store).getSettings());
|
|
31
|
+
return select(_store.store).getBlockOrder(sectionRootClientId);
|
|
28
32
|
}, []);
|
|
29
33
|
|
|
30
34
|
// Defer the initial rendering to avoid the jumps due to the animation.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_element","_inbetween","_interopRequireDefault","_store","_inserter","ZoomOutModeInserters","__unstableContentRef","isReady","setIsReady","useState","blockOrder","useSelect","select","blockEditorStore","getBlockOrder","useEffect","timeout","setTimeout","clearTimeout","map","clientId","index","length","_react","createElement","default","key","previousClientId","nextClientId","className","position","__experimentalIsQuick","_default","exports"],"sources":["@wordpress/block-editor/src/components/block-tools/zoom-out-mode-inserters.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useEffect, useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport BlockPopoverInbetween from '../block-popover/inbetween';\nimport { store as blockEditorStore } from '../../store';\nimport Inserter from '../inserter';\n\nfunction ZoomOutModeInserters( { __unstableContentRef } ) {\n\tconst [ isReady, setIsReady ] = useState( false );\n\tconst blockOrder = useSelect( ( select ) => {\n\t\treturn select( blockEditorStore ).getBlockOrder();\n\t}, [] );\n\n\t// Defer the initial rendering to avoid the jumps due to the animation.\n\tuseEffect( () => {\n\t\tconst timeout = setTimeout( () => {\n\t\t\tsetIsReady( true );\n\t\t}, 500 );\n\t\treturn () => {\n\t\t\tclearTimeout( timeout );\n\t\t};\n\t}, [] );\n\n\tif ( ! isReady ) {\n\t\treturn null;\n\t}\n\n\treturn blockOrder.map( ( clientId, index ) => {\n\t\tif ( index === blockOrder.length - 1 ) {\n\t\t\treturn null;\n\t\t}\n\t\treturn (\n\t\t\t<BlockPopoverInbetween\n\t\t\t\tkey={ clientId }\n\t\t\t\tpreviousClientId={ clientId }\n\t\t\t\tnextClientId={ blockOrder[ index + 1 ] }\n\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t>\n\t\t\t\t<div className=\"block-editor-block-list__insertion-point-inserter is-with-inserter\">\n\t\t\t\t\t<Inserter\n\t\t\t\t\t\tposition=\"bottom center\"\n\t\t\t\t\t\tclientId={ blockOrder[ index + 1 ] }\n\t\t\t\t\t\t__experimentalIsQuick\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t</BlockPopoverInbetween>\n\t\t);\n\t} );\n}\n\nexport default ZoomOutModeInserters;\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAKA,IAAAE,UAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAF,sBAAA,CAAAH,OAAA;
|
|
1
|
+
{"version":3,"names":["_data","require","_element","_inbetween","_interopRequireDefault","_store","_inserter","_lockUnlock","ZoomOutModeInserters","__unstableContentRef","isReady","setIsReady","useState","blockOrder","useSelect","select","sectionRootClientId","unlock","blockEditorStore","getSettings","getBlockOrder","useEffect","timeout","setTimeout","clearTimeout","map","clientId","index","length","_react","createElement","default","key","previousClientId","nextClientId","className","position","__experimentalIsQuick","_default","exports"],"sources":["@wordpress/block-editor/src/components/block-tools/zoom-out-mode-inserters.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useEffect, useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport BlockPopoverInbetween from '../block-popover/inbetween';\nimport { store as blockEditorStore } from '../../store';\nimport Inserter from '../inserter';\nimport { unlock } from '../../lock-unlock';\n\nfunction ZoomOutModeInserters( { __unstableContentRef } ) {\n\tconst [ isReady, setIsReady ] = useState( false );\n\tconst blockOrder = useSelect( ( select ) => {\n\t\tconst { sectionRootClientId } = unlock(\n\t\t\tselect( blockEditorStore ).getSettings()\n\t\t);\n\t\treturn select( blockEditorStore ).getBlockOrder( sectionRootClientId );\n\t}, [] );\n\n\t// Defer the initial rendering to avoid the jumps due to the animation.\n\tuseEffect( () => {\n\t\tconst timeout = setTimeout( () => {\n\t\t\tsetIsReady( true );\n\t\t}, 500 );\n\t\treturn () => {\n\t\t\tclearTimeout( timeout );\n\t\t};\n\t}, [] );\n\n\tif ( ! isReady ) {\n\t\treturn null;\n\t}\n\n\treturn blockOrder.map( ( clientId, index ) => {\n\t\tif ( index === blockOrder.length - 1 ) {\n\t\t\treturn null;\n\t\t}\n\t\treturn (\n\t\t\t<BlockPopoverInbetween\n\t\t\t\tkey={ clientId }\n\t\t\t\tpreviousClientId={ clientId }\n\t\t\t\tnextClientId={ blockOrder[ index + 1 ] }\n\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t>\n\t\t\t\t<div className=\"block-editor-block-list__insertion-point-inserter is-with-inserter\">\n\t\t\t\t\t<Inserter\n\t\t\t\t\t\tposition=\"bottom center\"\n\t\t\t\t\t\tclientId={ blockOrder[ index + 1 ] }\n\t\t\t\t\t\t__experimentalIsQuick\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t</BlockPopoverInbetween>\n\t\t);\n\t} );\n}\n\nexport default ZoomOutModeInserters;\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAKA,IAAAE,UAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAF,sBAAA,CAAAH,OAAA;AACA,IAAAM,WAAA,GAAAN,OAAA;AAZA;AACA;AACA;;AAIA;AACA;AACA;;AAMA,SAASO,oBAAoBA,CAAE;EAAEC;AAAqB,CAAC,EAAG;EACzD,MAAM,CAAEC,OAAO,EAAEC,UAAU,CAAE,GAAG,IAAAC,iBAAQ,EAAE,KAAM,CAAC;EACjD,MAAMC,UAAU,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IAC3C,MAAM;MAAEC;IAAoB,CAAC,GAAG,IAAAC,kBAAM,EACrCF,MAAM,CAAEG,YAAiB,CAAC,CAACC,WAAW,CAAC,CACxC,CAAC;IACD,OAAOJ,MAAM,CAAEG,YAAiB,CAAC,CAACE,aAAa,CAAEJ,mBAAoB,CAAC;EACvE,CAAC,EAAE,EAAG,CAAC;;EAEP;EACA,IAAAK,kBAAS,EAAE,MAAM;IAChB,MAAMC,OAAO,GAAGC,UAAU,CAAE,MAAM;MACjCZ,UAAU,CAAE,IAAK,CAAC;IACnB,CAAC,EAAE,GAAI,CAAC;IACR,OAAO,MAAM;MACZa,YAAY,CAAEF,OAAQ,CAAC;IACxB,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,IAAK,CAAEZ,OAAO,EAAG;IAChB,OAAO,IAAI;EACZ;EAEA,OAAOG,UAAU,CAACY,GAAG,CAAE,CAAEC,QAAQ,EAAEC,KAAK,KAAM;IAC7C,IAAKA,KAAK,KAAKd,UAAU,CAACe,MAAM,GAAG,CAAC,EAAG;MACtC,OAAO,IAAI;IACZ;IACA,OACC,IAAAC,MAAA,CAAAC,aAAA,EAAC3B,UAAA,CAAA4B,OAAqB;MACrBC,GAAG,EAAGN,QAAU;MAChBO,gBAAgB,EAAGP,QAAU;MAC7BQ,YAAY,EAAGrB,UAAU,CAAEc,KAAK,GAAG,CAAC,CAAI;MACxClB,oBAAoB,EAAGA;IAAsB,GAE7C,IAAAoB,MAAA,CAAAC,aAAA;MAAKK,SAAS,EAAC;IAAoE,GAClF,IAAAN,MAAA,CAAAC,aAAA,EAACxB,SAAA,CAAAyB,OAAQ;MACRK,QAAQ,EAAC,eAAe;MACxBV,QAAQ,EAAGb,UAAU,CAAEc,KAAK,GAAG,CAAC,CAAI;MACpCU,qBAAqB;IAAA,CACrB,CACG,CACiB,CAAC;EAE1B,CAAE,CAAC;AACJ;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAR,OAAA,GAEcvB,oBAAoB","ignoreList":[]}
|
|
@@ -21,7 +21,7 @@ var _icons = require("@wordpress/icons");
|
|
|
21
21
|
function BlockVariationPicker({
|
|
22
22
|
icon = _icons.layout,
|
|
23
23
|
label = (0, _i18n.__)('Choose variation'),
|
|
24
|
-
instructions = (0, _i18n.__)('Select a variation to start with
|
|
24
|
+
instructions = (0, _i18n.__)('Select a variation to start with:'),
|
|
25
25
|
variations,
|
|
26
26
|
onSelect,
|
|
27
27
|
allowSkip
|
|
@@ -41,7 +41,8 @@ function BlockVariationPicker({
|
|
|
41
41
|
}, variations.map(variation => (0, _react.createElement)("li", {
|
|
42
42
|
key: variation.name
|
|
43
43
|
}, (0, _react.createElement)(_components.Button, {
|
|
44
|
-
|
|
44
|
+
__next40pxDefaultSize: true,
|
|
45
|
+
variant: "tertiary",
|
|
45
46
|
icon: variation.icon && variation.icon.src ? variation.icon.src : variation.icon,
|
|
46
47
|
iconSize: 48,
|
|
47
48
|
onClick: () => onSelect(variation),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_classnames","_interopRequireDefault","require","_i18n","_components","_icons","BlockVariationPicker","icon","layout","label","__","instructions","variations","onSelect","allowSkip","classes","classnames","length","_react","createElement","Placeholder","className","role","map","variation","key","name","Button","variant","src","iconSize","onClick","description","title","_default","exports","default"],"sources":["@wordpress/block-editor/src/components/block-variation-picker/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Button, Placeholder } from '@wordpress/components';\nimport { layout } from '@wordpress/icons';\n\nfunction BlockVariationPicker( {\n\ticon = layout,\n\tlabel = __( 'Choose variation' ),\n\tinstructions = __( 'Select a variation to start with
|
|
1
|
+
{"version":3,"names":["_classnames","_interopRequireDefault","require","_i18n","_components","_icons","BlockVariationPicker","icon","layout","label","__","instructions","variations","onSelect","allowSkip","classes","classnames","length","_react","createElement","Placeholder","className","role","map","variation","key","name","Button","__next40pxDefaultSize","variant","src","iconSize","onClick","description","title","_default","exports","default"],"sources":["@wordpress/block-editor/src/components/block-variation-picker/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Button, Placeholder } from '@wordpress/components';\nimport { layout } from '@wordpress/icons';\n\nfunction BlockVariationPicker( {\n\ticon = layout,\n\tlabel = __( 'Choose variation' ),\n\tinstructions = __( 'Select a variation to start with:' ),\n\tvariations,\n\tonSelect,\n\tallowSkip,\n} ) {\n\tconst classes = classnames( 'block-editor-block-variation-picker', {\n\t\t'has-many-variations': variations.length > 4,\n\t} );\n\n\treturn (\n\t\t<Placeholder\n\t\t\ticon={ icon }\n\t\t\tlabel={ label }\n\t\t\tinstructions={ instructions }\n\t\t\tclassName={ classes }\n\t\t>\n\t\t\t{ /*\n\t\t\t * Disable reason: The `list` ARIA role is redundant but\n\t\t\t * Safari+VoiceOver won't announce the list otherwise.\n\t\t\t */\n\t\t\t/* eslint-disable jsx-a11y/no-redundant-roles */ }\n\t\t\t<ul\n\t\t\t\tclassName=\"block-editor-block-variation-picker__variations\"\n\t\t\t\trole=\"list\"\n\t\t\t\taria-label={ __( 'Block variations' ) }\n\t\t\t>\n\t\t\t\t{ variations.map( ( variation ) => (\n\t\t\t\t\t<li key={ variation.name }>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\tvariation.icon && variation.icon.src\n\t\t\t\t\t\t\t\t\t? variation.icon.src\n\t\t\t\t\t\t\t\t\t: variation.icon\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\ticonSize={ 48 }\n\t\t\t\t\t\t\tonClick={ () => onSelect( variation ) }\n\t\t\t\t\t\t\tclassName=\"block-editor-block-variation-picker__variation\"\n\t\t\t\t\t\t\tlabel={ variation.description || variation.title }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<span className=\"block-editor-block-variation-picker__variation-label\">\n\t\t\t\t\t\t\t{ variation.title }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</li>\n\t\t\t\t) ) }\n\t\t\t</ul>\n\t\t\t{ /* eslint-enable jsx-a11y/no-redundant-roles */ }\n\t\t\t{ allowSkip && (\n\t\t\t\t<div className=\"block-editor-block-variation-picker__skip\">\n\t\t\t\t\t<Button variant=\"link\" onClick={ () => onSelect() }>\n\t\t\t\t\t\t{ __( 'Skip' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</Placeholder>\n\t);\n}\n\nexport default BlockVariationPicker;\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAA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CAAC,EACF,IAAAhB,MAAA,CAAAC,aAAA;IAAME,SAAS,EAAC;EAAsD,GACnEG,SAAS,CAACU,KACP,CACH,CACH,CACC,CAAC,EAEHpB,SAAS,IACV,IAAAI,MAAA,CAAAC,aAAA;IAAKE,SAAS,EAAC;EAA2C,GACzD,IAAAH,MAAA,CAAAC,aAAA,EAACf,WAAA,CAAAuB,MAAM;IAACE,OAAO,EAAC,MAAM;IAACG,OAAO,EAAGA,CAAA,KAAMnB,QAAQ,CAAC;EAAG,GAChD,IAAAH,QAAE,EAAE,MAAO,CACN,CACJ,CAEM,CAAC;AAEhB;AAAC,IAAAyB,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEc/B,oBAAoB","ignoreList":[]}
|
|
@@ -155,7 +155,9 @@ function __experimentalBlockVariationTransforms({
|
|
|
155
155
|
};
|
|
156
156
|
|
|
157
157
|
// Skip rendering if there are no variations
|
|
158
|
-
if (!variations?.length)
|
|
158
|
+
if (!variations?.length) {
|
|
159
|
+
return null;
|
|
160
|
+
}
|
|
159
161
|
const baseClass = 'block-editor-block-variation-transforms';
|
|
160
162
|
|
|
161
163
|
// Show buttons if there are more than 5 variations because the ToggleGroupControl does not wrap
|