@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,17 +1,11 @@
|
|
|
1
1
|
import { createElement, Fragment } from "react";
|
|
2
|
-
/**
|
|
3
|
-
* External dependencies
|
|
4
|
-
*/
|
|
5
|
-
import classNames from 'classnames';
|
|
6
|
-
|
|
7
2
|
/**
|
|
8
3
|
* WordPress dependencies
|
|
9
4
|
*/
|
|
10
|
-
import { __
|
|
5
|
+
import { __ } from '@wordpress/i18n';
|
|
11
6
|
import { useViewportMatch } from '@wordpress/compose';
|
|
12
|
-
import {
|
|
7
|
+
import { Button } from '@wordpress/components';
|
|
13
8
|
import { useCallback, useMemo } from '@wordpress/element';
|
|
14
|
-
import { Icon, chevronRight, chevronLeft } from '@wordpress/icons';
|
|
15
9
|
|
|
16
10
|
/**
|
|
17
11
|
* Internal dependencies
|
|
@@ -22,12 +16,15 @@ import MediaUpload from '../../media-upload';
|
|
|
22
16
|
import { useMediaCategories } from './hooks';
|
|
23
17
|
import { getBlockAndPreviewFromMedia } from './utils';
|
|
24
18
|
import MobileTabNavigation from '../mobile-tab-navigation';
|
|
19
|
+
import CategoryTabs from '../category-tabs';
|
|
20
|
+
import InserterNoResults from '../no-results';
|
|
25
21
|
const ALLOWED_MEDIA_TYPES = ['image', 'video', 'audio'];
|
|
26
22
|
function MediaTab({
|
|
27
23
|
rootClientId,
|
|
28
24
|
selectedCategory,
|
|
29
25
|
onSelectCategory,
|
|
30
|
-
onInsert
|
|
26
|
+
onInsert,
|
|
27
|
+
children
|
|
31
28
|
}) {
|
|
32
29
|
const mediaCategories = useMediaCategories(rootClientId);
|
|
33
30
|
const isMobile = useViewportMatch('medium', '<');
|
|
@@ -39,31 +36,20 @@ function MediaTab({
|
|
|
39
36
|
const [block] = getBlockAndPreviewFromMedia(media, media.type);
|
|
40
37
|
onInsert(block);
|
|
41
38
|
}, [onInsert]);
|
|
42
|
-
const
|
|
39
|
+
const categories = useMemo(() => mediaCategories.map(mediaCategory => ({
|
|
43
40
|
...mediaCategory,
|
|
44
41
|
label: mediaCategory.labels.name
|
|
45
42
|
})), [mediaCategories]);
|
|
43
|
+
if (!categories.length) {
|
|
44
|
+
return createElement(InserterNoResults, null);
|
|
45
|
+
}
|
|
46
46
|
return createElement(Fragment, null, !isMobile && createElement("div", {
|
|
47
47
|
className: `${baseCssClass}-container`
|
|
48
|
-
}, createElement(
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}, mediaCategories.map(mediaCategory => createElement(Item, {
|
|
54
|
-
role: "listitem",
|
|
55
|
-
key: mediaCategory.name,
|
|
56
|
-
onClick: () => onSelectCategory(mediaCategory),
|
|
57
|
-
className: classNames(`${baseCssClass}__media-category`, {
|
|
58
|
-
'is-selected': selectedCategory === mediaCategory
|
|
59
|
-
}),
|
|
60
|
-
"aria-label": mediaCategory.labels.name,
|
|
61
|
-
"aria-current": mediaCategory === selectedCategory ? 'true' : undefined
|
|
62
|
-
}, createElement(HStack, null, createElement(FlexBlock, null, mediaCategory.labels.name), createElement(Icon, {
|
|
63
|
-
icon: isRTL() ? chevronLeft : chevronRight
|
|
64
|
-
})))), createElement("div", {
|
|
65
|
-
role: "listitem"
|
|
66
|
-
}, createElement(MediaUploadCheck, null, createElement(MediaUpload, {
|
|
48
|
+
}, createElement(CategoryTabs, {
|
|
49
|
+
categories: categories,
|
|
50
|
+
selectedCategory: selectedCategory,
|
|
51
|
+
onSelectCategory: onSelectCategory
|
|
52
|
+
}, children), createElement(MediaUploadCheck, null, createElement(MediaUpload, {
|
|
67
53
|
multiple: false,
|
|
68
54
|
onSelect: onSelectMedia,
|
|
69
55
|
allowedTypes: ALLOWED_MEDIA_TYPES,
|
|
@@ -84,8 +70,8 @@ function MediaTab({
|
|
|
84
70
|
variant: "secondary",
|
|
85
71
|
"data-unstable-ignore-focus-outside-for-relatedtarget": ".media-modal"
|
|
86
72
|
}, __('Open Media Library'))
|
|
87
|
-
})))
|
|
88
|
-
categories:
|
|
73
|
+
}))), isMobile && createElement(MobileTabNavigation, {
|
|
74
|
+
categories: categories
|
|
89
75
|
}, category => createElement(MediaCategoryPanel, {
|
|
90
76
|
onInsert: onInsert,
|
|
91
77
|
rootClientId: rootClientId,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["__","useViewportMatch","Button","useCallback","useMemo","MediaCategoryPanel","MediaUploadCheck","MediaUpload","useMediaCategories","getBlockAndPreviewFromMedia","MobileTabNavigation","CategoryTabs","InserterNoResults","ALLOWED_MEDIA_TYPES","MediaTab","rootClientId","selectedCategory","onSelectCategory","onInsert","children","mediaCategories","isMobile","baseCssClass","onSelectMedia","media","url","block","type","categories","map","mediaCategory","label","labels","name","length","createElement","Fragment","className","multiple","onSelect","allowedTypes","render","open","onClick","event","target","focus","variant","category"],"sources":["@wordpress/block-editor/src/components/inserter/media-tab/media-tab.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { Button } from '@wordpress/components';\nimport { useCallback, useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { MediaCategoryPanel } from './media-panel';\nimport MediaUploadCheck from '../../media-upload/check';\nimport MediaUpload from '../../media-upload';\nimport { useMediaCategories } from './hooks';\nimport { getBlockAndPreviewFromMedia } from './utils';\nimport MobileTabNavigation from '../mobile-tab-navigation';\nimport CategoryTabs from '../category-tabs';\nimport InserterNoResults from '../no-results';\n\nconst ALLOWED_MEDIA_TYPES = [ 'image', 'video', 'audio' ];\n\nfunction MediaTab( {\n\trootClientId,\n\tselectedCategory,\n\tonSelectCategory,\n\tonInsert,\n\tchildren,\n} ) {\n\tconst mediaCategories = useMediaCategories( rootClientId );\n\tconst isMobile = useViewportMatch( 'medium', '<' );\n\tconst baseCssClass = 'block-editor-inserter__media-tabs';\n\tconst onSelectMedia = useCallback(\n\t\t( media ) => {\n\t\t\tif ( ! media?.url ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst [ block ] = getBlockAndPreviewFromMedia( media, media.type );\n\t\t\tonInsert( block );\n\t\t},\n\t\t[ onInsert ]\n\t);\n\tconst categories = useMemo(\n\t\t() =>\n\t\t\tmediaCategories.map( ( mediaCategory ) => ( {\n\t\t\t\t...mediaCategory,\n\t\t\t\tlabel: mediaCategory.labels.name,\n\t\t\t} ) ),\n\t\t[ mediaCategories ]\n\t);\n\n\tif ( ! categories.length ) {\n\t\treturn <InserterNoResults />;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ ! isMobile && (\n\t\t\t\t<div className={ `${ baseCssClass }-container` }>\n\t\t\t\t\t<CategoryTabs\n\t\t\t\t\t\tcategories={ categories }\n\t\t\t\t\t\tselectedCategory={ selectedCategory }\n\t\t\t\t\t\tonSelectCategory={ onSelectCategory }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ children }\n\t\t\t\t\t</CategoryTabs>\n\t\t\t\t\t<MediaUploadCheck>\n\t\t\t\t\t\t<MediaUpload\n\t\t\t\t\t\t\tmultiple={ false }\n\t\t\t\t\t\t\tonSelect={ onSelectMedia }\n\t\t\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\t\t\t\trender={ ( { open } ) => (\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\t\t\t\t\t\t// Safari doesn't emit a focus event on button elements when\n\t\t\t\t\t\t\t\t\t\t// clicked and we need to manually focus the button here.\n\t\t\t\t\t\t\t\t\t\t// The reason is that core's Media Library modal explicitly triggers a\n\t\t\t\t\t\t\t\t\t\t// focus event and therefore a `blur` event is triggered on a different\n\t\t\t\t\t\t\t\t\t\t// element, which doesn't contain the `data-unstable-ignore-focus-outside-for-relatedtarget`\n\t\t\t\t\t\t\t\t\t\t// attribute making the Inserter dialog to close.\n\t\t\t\t\t\t\t\t\t\tevent.target.focus();\n\t\t\t\t\t\t\t\t\t\topen();\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\tclassName=\"block-editor-inserter__media-library-button\"\n\t\t\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t\t\t\tdata-unstable-ignore-focus-outside-for-relatedtarget=\".media-modal\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ __( 'Open Media Library' ) }\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</MediaUploadCheck>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t{ isMobile && (\n\t\t\t\t<MobileTabNavigation categories={ categories }>\n\t\t\t\t\t{ ( category ) => (\n\t\t\t\t\t\t<MediaCategoryPanel\n\t\t\t\t\t\t\tonInsert={ onInsert }\n\t\t\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t\t\tcategory={ category }\n\t\t\t\t\t\t/>\n\t\t\t\t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[]}
|
|
@@ -7,26 +7,23 @@ import classnames from 'classnames';
|
|
|
7
7
|
/**
|
|
8
8
|
* WordPress dependencies
|
|
9
9
|
*/
|
|
10
|
-
import { forwardRef, useState, useCallback, useMemo,
|
|
10
|
+
import { forwardRef, useState, useCallback, useMemo, useRef, useLayoutEffect } from '@wordpress/element';
|
|
11
11
|
import { VisuallyHidden, SearchControl, Popover } from '@wordpress/components';
|
|
12
12
|
import { __ } from '@wordpress/i18n';
|
|
13
|
-
import { useSelect } from '@wordpress/data';
|
|
14
13
|
import { useDebouncedInput } from '@wordpress/compose';
|
|
15
14
|
|
|
16
15
|
/**
|
|
17
16
|
* Internal dependencies
|
|
18
17
|
*/
|
|
19
|
-
import { unlock } from '../../lock-unlock';
|
|
20
18
|
import Tips from './tips';
|
|
21
19
|
import InserterPreviewPanel from './preview-panel';
|
|
22
20
|
import BlockTypesTab from './block-types-tab';
|
|
23
21
|
import BlockPatternsTab from './block-patterns-tab';
|
|
24
22
|
import { PatternCategoryPreviewPanel } from './block-patterns-tab/pattern-category-preview-panel';
|
|
25
|
-
import { MediaTab,
|
|
23
|
+
import { MediaTab, MediaCategoryPanel } from './media-tab';
|
|
26
24
|
import InserterSearchResults from './search-results';
|
|
27
25
|
import useInsertionPoint from './hooks/use-insertion-point';
|
|
28
26
|
import InserterTabs from './tabs';
|
|
29
|
-
import { store as blockEditorStore } from '../../store';
|
|
30
27
|
import { useZoomOut } from '../../hooks/use-zoom-out';
|
|
31
28
|
const NOOP = () => {};
|
|
32
29
|
function InserterMenu({
|
|
@@ -46,7 +43,7 @@ function InserterMenu({
|
|
|
46
43
|
const [selectedPatternCategory, setSelectedPatternCategory] = useState(null);
|
|
47
44
|
const [patternFilter, setPatternFilter] = useState('all');
|
|
48
45
|
const [selectedMediaCategory, setSelectedMediaCategory] = useState(null);
|
|
49
|
-
const [selectedTab, setSelectedTab] = useState(
|
|
46
|
+
const [selectedTab, setSelectedTab] = useState('blocks');
|
|
50
47
|
const [destinationRootClientId, onInsertBlocks, onToggleInsertionPoint] = useInsertionPoint({
|
|
51
48
|
rootClientId,
|
|
52
49
|
clientId,
|
|
@@ -54,18 +51,6 @@ function InserterMenu({
|
|
|
54
51
|
insertionIndex: __experimentalInsertionIndex,
|
|
55
52
|
shouldFocusBlock
|
|
56
53
|
});
|
|
57
|
-
const {
|
|
58
|
-
showPatterns
|
|
59
|
-
} = useSelect(select => {
|
|
60
|
-
const {
|
|
61
|
-
hasAllowedPatterns
|
|
62
|
-
} = unlock(select(blockEditorStore));
|
|
63
|
-
return {
|
|
64
|
-
showPatterns: hasAllowedPatterns(destinationRootClientId)
|
|
65
|
-
};
|
|
66
|
-
}, [destinationRootClientId]);
|
|
67
|
-
const mediaCategories = useMediaCategories(destinationRootClientId);
|
|
68
|
-
const showMedia = mediaCategories.length > 0;
|
|
69
54
|
const onInsert = useCallback((blocks, meta, shouldForceFocusBlock) => {
|
|
70
55
|
onInsertBlocks(blocks, meta, shouldForceFocusBlock);
|
|
71
56
|
onSelect();
|
|
@@ -90,9 +75,40 @@ function InserterMenu({
|
|
|
90
75
|
if (isZoomedOutViewExperimentEnabled) {
|
|
91
76
|
__experimentalOnPatternCategorySelection();
|
|
92
77
|
}
|
|
93
|
-
}, [setSelectedPatternCategory, __experimentalOnPatternCategorySelection]);
|
|
78
|
+
}, [setSelectedPatternCategory, __experimentalOnPatternCategorySelection, isZoomedOutViewExperimentEnabled]);
|
|
94
79
|
const showPatternPanel = selectedTab === 'patterns' && !delayedFilterValue && selectedPatternCategory;
|
|
95
|
-
const
|
|
80
|
+
const showMediaPanel = selectedTab === 'media' && selectedMediaCategory;
|
|
81
|
+
const inserterSearch = useMemo(() => {
|
|
82
|
+
if (selectedTab === 'media') {
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
return createElement(Fragment, null, createElement(SearchControl, {
|
|
86
|
+
__nextHasNoMarginBottom: true,
|
|
87
|
+
className: "block-editor-inserter__search",
|
|
88
|
+
onChange: value => {
|
|
89
|
+
if (hoveredItem) {
|
|
90
|
+
setHoveredItem(null);
|
|
91
|
+
}
|
|
92
|
+
setFilterValue(value);
|
|
93
|
+
},
|
|
94
|
+
value: filterValue,
|
|
95
|
+
label: __('Search for blocks and patterns'),
|
|
96
|
+
placeholder: __('Search')
|
|
97
|
+
}), !!delayedFilterValue && createElement(InserterSearchResults, {
|
|
98
|
+
filterValue: delayedFilterValue,
|
|
99
|
+
onSelect: onSelect,
|
|
100
|
+
onHover: onHover,
|
|
101
|
+
onHoverPattern: onHoverPattern,
|
|
102
|
+
rootClientId: rootClientId,
|
|
103
|
+
clientId: clientId,
|
|
104
|
+
isAppender: isAppender,
|
|
105
|
+
__experimentalInsertionIndex: __experimentalInsertionIndex,
|
|
106
|
+
showBlockDirectory: true,
|
|
107
|
+
shouldFocusBlock: shouldFocusBlock,
|
|
108
|
+
prioritizePatterns: selectedTab === 'patterns'
|
|
109
|
+
}));
|
|
110
|
+
}, [selectedTab, hoveredItem, setHoveredItem, setFilterValue, filterValue, delayedFilterValue, onSelect, onHover, onHoverPattern, shouldFocusBlock, clientId, rootClientId, __experimentalInsertionIndex, isAppender]);
|
|
111
|
+
const blocksTab = useMemo(() => createElement(Fragment, null, inserterSearch, !delayedFilterValue && createElement(Fragment, null, createElement("div", {
|
|
96
112
|
className: "block-editor-inserter__block-list"
|
|
97
113
|
}, createElement(BlockTypesTab, {
|
|
98
114
|
rootClientId: destinationRootClientId,
|
|
@@ -103,8 +119,8 @@ function InserterMenu({
|
|
|
103
119
|
className: "block-editor-inserter__tips"
|
|
104
120
|
}, createElement(VisuallyHidden, {
|
|
105
121
|
as: "h2"
|
|
106
|
-
}, __('A tip for using the block editor')), createElement(Tips, null))), [destinationRootClientId, onInsert, onHover, showMostUsedBlocks, showInserterHelpPanel]);
|
|
107
|
-
const patternsTab = useMemo(() => createElement(BlockPatternsTab, {
|
|
122
|
+
}, __('A tip for using the block editor')), createElement(Tips, null)))), [destinationRootClientId, onInsert, onHover, showMostUsedBlocks, showInserterHelpPanel, inserterSearch, delayedFilterValue]);
|
|
123
|
+
const patternsTab = useMemo(() => createElement(Fragment, null, inserterSearch, !delayedFilterValue && createElement(BlockPatternsTab, {
|
|
108
124
|
rootClientId: destinationRootClientId,
|
|
109
125
|
onInsert: onInsertPattern,
|
|
110
126
|
onSelectCategory: onClickPatternCategory,
|
|
@@ -116,26 +132,22 @@ function InserterMenu({
|
|
|
116
132
|
category: selectedPatternCategory,
|
|
117
133
|
patternFilter: patternFilter,
|
|
118
134
|
showTitlesAsTooltip: true
|
|
119
|
-
})), [destinationRootClientId, onInsertPattern, onClickPatternCategory, selectedPatternCategory, showPatternPanel]);
|
|
135
|
+
}))), [destinationRootClientId, onHoverPattern, onInsertPattern, onClickPatternCategory, patternFilter, selectedPatternCategory, showPatternPanel, inserterSearch, delayedFilterValue]);
|
|
120
136
|
const mediaTab = useMemo(() => createElement(MediaTab, {
|
|
121
137
|
rootClientId: destinationRootClientId,
|
|
122
138
|
selectedCategory: selectedMediaCategory,
|
|
123
139
|
onSelectCategory: setSelectedMediaCategory,
|
|
124
140
|
onInsert: onInsert
|
|
125
|
-
}
|
|
141
|
+
}, showMediaPanel && createElement(MediaCategoryPanel, {
|
|
142
|
+
rootClientId: destinationRootClientId,
|
|
143
|
+
onInsert: onInsert,
|
|
144
|
+
category: selectedMediaCategory
|
|
145
|
+
})), [destinationRootClientId, onInsert, selectedMediaCategory, setSelectedMediaCategory, showMediaPanel]);
|
|
126
146
|
const inserterTabsContents = useMemo(() => ({
|
|
127
147
|
blocks: blocksTab,
|
|
128
148
|
patterns: patternsTab,
|
|
129
149
|
media: mediaTab
|
|
130
150
|
}), [blocksTab, mediaTab, patternsTab]);
|
|
131
|
-
const searchRef = useRef();
|
|
132
|
-
useImperativeHandle(ref, () => ({
|
|
133
|
-
focusSearch: () => {
|
|
134
|
-
searchRef.current.focus();
|
|
135
|
-
}
|
|
136
|
-
}));
|
|
137
|
-
const showAsTabs = !delayedFilterValue && (showPatterns || showMedia);
|
|
138
|
-
const showMediaPanel = selectedTab === 'media' && !delayedFilterValue && selectedMediaCategory;
|
|
139
151
|
|
|
140
152
|
// When the pattern panel is showing, we want to use zoom out mode
|
|
141
153
|
useZoomOut(showPatternPanel);
|
|
@@ -146,50 +158,28 @@ function InserterMenu({
|
|
|
146
158
|
}
|
|
147
159
|
setSelectedTab(value);
|
|
148
160
|
};
|
|
161
|
+
|
|
162
|
+
// Focus first active tab, if any
|
|
163
|
+
const tabsRef = useRef();
|
|
164
|
+
useLayoutEffect(() => {
|
|
165
|
+
if (tabsRef.current) {
|
|
166
|
+
window.requestAnimationFrame(() => {
|
|
167
|
+
tabsRef.current.querySelector('[role="tab"][aria-selected="true"]')?.focus();
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
}, []);
|
|
149
171
|
return createElement("div", {
|
|
150
172
|
className: classnames('block-editor-inserter__menu', {
|
|
151
|
-
'show-panel': showPatternPanel
|
|
152
|
-
})
|
|
173
|
+
'show-panel': showPatternPanel || showMediaPanel
|
|
174
|
+
}),
|
|
175
|
+
ref: ref
|
|
153
176
|
}, createElement("div", {
|
|
154
|
-
className:
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
}, createElement(SearchControl, {
|
|
158
|
-
__nextHasNoMarginBottom: true,
|
|
159
|
-
className: "block-editor-inserter__search",
|
|
160
|
-
onChange: value => {
|
|
161
|
-
if (hoveredItem) setHoveredItem(null);
|
|
162
|
-
setFilterValue(value);
|
|
163
|
-
},
|
|
164
|
-
value: filterValue,
|
|
165
|
-
label: __('Search for blocks and patterns'),
|
|
166
|
-
placeholder: __('Search'),
|
|
167
|
-
ref: searchRef
|
|
168
|
-
}), !!delayedFilterValue && createElement("div", {
|
|
169
|
-
className: "block-editor-inserter__no-tab-container"
|
|
170
|
-
}, createElement(InserterSearchResults, {
|
|
171
|
-
filterValue: delayedFilterValue,
|
|
172
|
-
onSelect: onSelect,
|
|
173
|
-
onHover: onHover,
|
|
174
|
-
onHoverPattern: onHoverPattern,
|
|
175
|
-
rootClientId: rootClientId,
|
|
176
|
-
clientId: clientId,
|
|
177
|
-
isAppender: isAppender,
|
|
178
|
-
__experimentalInsertionIndex: __experimentalInsertionIndex,
|
|
179
|
-
showBlockDirectory: true,
|
|
180
|
-
shouldFocusBlock: shouldFocusBlock
|
|
181
|
-
})), showAsTabs && createElement(InserterTabs, {
|
|
182
|
-
showPatterns: showPatterns,
|
|
183
|
-
showMedia: showMedia,
|
|
177
|
+
className: "block-editor-inserter__main-area"
|
|
178
|
+
}, createElement(InserterTabs, {
|
|
179
|
+
ref: tabsRef,
|
|
184
180
|
onSelect: handleSetSelectedTab,
|
|
185
181
|
tabsContents: inserterTabsContents
|
|
186
|
-
}),
|
|
187
|
-
className: "block-editor-inserter__no-tab-container"
|
|
188
|
-
}, blocksTab)), showMediaPanel && createElement(MediaCategoryDialog, {
|
|
189
|
-
rootClientId: destinationRootClientId,
|
|
190
|
-
onInsert: onInsert,
|
|
191
|
-
category: selectedMediaCategory
|
|
192
|
-
}), showInserterHelpPanel && hoveredItem && createElement(Popover, {
|
|
182
|
+
})), showInserterHelpPanel && hoveredItem && createElement(Popover, {
|
|
193
183
|
className: "block-editor-inserter__preview-container__popover",
|
|
194
184
|
placement: "right-start",
|
|
195
185
|
offset: 16,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["classnames","forwardRef","useState","useCallback","useMemo","useImperativeHandle","useRef","VisuallyHidden","SearchControl","Popover","__","useSelect","useDebouncedInput","unlock","Tips","InserterPreviewPanel","BlockTypesTab","BlockPatternsTab","PatternCategoryPreviewPanel","MediaTab","MediaCategoryDialog","useMediaCategories","InserterSearchResults","useInsertionPoint","InserterTabs","store","blockEditorStore","useZoomOut","NOOP","InserterMenu","rootClientId","clientId","isAppender","__experimentalInsertionIndex","onSelect","showInserterHelpPanel","showMostUsedBlocks","__experimentalFilterValue","shouldFocusBlock","__experimentalOnPatternCategorySelection","ref","filterValue","setFilterValue","delayedFilterValue","hoveredItem","setHoveredItem","selectedPatternCategory","setSelectedPatternCategory","patternFilter","setPatternFilter","selectedMediaCategory","setSelectedMediaCategory","selectedTab","setSelectedTab","destinationRootClientId","onInsertBlocks","onToggleInsertionPoint","insertionIndex","showPatterns","select","hasAllowedPatterns","mediaCategories","showMedia","length","onInsert","blocks","meta","shouldForceFocusBlock","onInsertPattern","patternName","onHover","item","onHoverPattern","isZoomedOutViewExperimentEnabled","window","__experimentalEnableZoomedOutView","onClickPatternCategory","patternCategory","filter","showPatternPanel","blocksTab","createElement","Fragment","className","as","patternsTab","onSelectCategory","selectedCategory","category","showTitlesAsTooltip","mediaTab","inserterTabsContents","patterns","media","searchRef","focusSearch","current","focus","showAsTabs","showMediaPanel","handleSetSelectedTab","value","__nextHasNoMarginBottom","onChange","label","placeholder","showBlockDirectory","tabsContents","placement","offset","focusOnMount","animate"],"sources":["@wordpress/block-editor/src/components/inserter/menu.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tforwardRef,\n\tuseState,\n\tuseCallback,\n\tuseMemo,\n\tuseImperativeHandle,\n\tuseRef,\n} from '@wordpress/element';\nimport { VisuallyHidden, SearchControl, Popover } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { useDebouncedInput } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport Tips from './tips';\nimport InserterPreviewPanel from './preview-panel';\nimport BlockTypesTab from './block-types-tab';\nimport BlockPatternsTab from './block-patterns-tab';\nimport { PatternCategoryPreviewPanel } from './block-patterns-tab/pattern-category-preview-panel';\nimport { MediaTab, MediaCategoryDialog, useMediaCategories } from './media-tab';\nimport InserterSearchResults from './search-results';\nimport useInsertionPoint from './hooks/use-insertion-point';\nimport InserterTabs from './tabs';\nimport { store as blockEditorStore } from '../../store';\nimport { useZoomOut } from '../../hooks/use-zoom-out';\n\nconst NOOP = () => {};\nfunction InserterMenu(\n\t{\n\t\trootClientId,\n\t\tclientId,\n\t\tisAppender,\n\t\t__experimentalInsertionIndex,\n\t\tonSelect,\n\t\tshowInserterHelpPanel,\n\t\tshowMostUsedBlocks,\n\t\t__experimentalFilterValue = '',\n\t\tshouldFocusBlock = true,\n\t\t__experimentalOnPatternCategorySelection = NOOP,\n\t},\n\tref\n) {\n\tconst [ filterValue, setFilterValue, delayedFilterValue ] =\n\t\tuseDebouncedInput( __experimentalFilterValue );\n\tconst [ hoveredItem, setHoveredItem ] = useState( null );\n\tconst [ selectedPatternCategory, setSelectedPatternCategory ] =\n\t\tuseState( null );\n\tconst [ patternFilter, setPatternFilter ] = useState( 'all' );\n\tconst [ selectedMediaCategory, setSelectedMediaCategory ] =\n\t\tuseState( null );\n\tconst [ selectedTab, setSelectedTab ] = useState( null );\n\n\tconst [ destinationRootClientId, onInsertBlocks, onToggleInsertionPoint ] =\n\t\tuseInsertionPoint( {\n\t\t\trootClientId,\n\t\t\tclientId,\n\t\t\tisAppender,\n\t\t\tinsertionIndex: __experimentalInsertionIndex,\n\t\t\tshouldFocusBlock,\n\t\t} );\n\tconst { showPatterns } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { hasAllowedPatterns } = unlock( select( blockEditorStore ) );\n\t\t\treturn {\n\t\t\t\tshowPatterns: hasAllowedPatterns( destinationRootClientId ),\n\t\t\t};\n\t\t},\n\t\t[ destinationRootClientId ]\n\t);\n\n\tconst mediaCategories = useMediaCategories( destinationRootClientId );\n\tconst showMedia = mediaCategories.length > 0;\n\n\tconst onInsert = useCallback(\n\t\t( blocks, meta, shouldForceFocusBlock ) => {\n\t\t\tonInsertBlocks( blocks, meta, shouldForceFocusBlock );\n\t\t\tonSelect();\n\t\t},\n\t\t[ onInsertBlocks, onSelect ]\n\t);\n\n\tconst onInsertPattern = useCallback(\n\t\t( blocks, patternName ) => {\n\t\t\tonInsertBlocks( blocks, { patternName } );\n\t\t\tonSelect();\n\t\t},\n\t\t[ onInsertBlocks, onSelect ]\n\t);\n\n\tconst onHover = useCallback(\n\t\t( item ) => {\n\t\t\tonToggleInsertionPoint( !! item );\n\t\t\tsetHoveredItem( item );\n\t\t},\n\t\t[ onToggleInsertionPoint, setHoveredItem ]\n\t);\n\n\tconst onHoverPattern = useCallback(\n\t\t( item ) => {\n\t\t\tonToggleInsertionPoint( !! item );\n\t\t},\n\t\t[ onToggleInsertionPoint ]\n\t);\n\n\tconst isZoomedOutViewExperimentEnabled =\n\t\twindow?.__experimentalEnableZoomedOutView;\n\tconst onClickPatternCategory = useCallback(\n\t\t( patternCategory, filter ) => {\n\t\t\tsetSelectedPatternCategory( patternCategory );\n\t\t\tsetPatternFilter( filter );\n\t\t\tif ( isZoomedOutViewExperimentEnabled ) {\n\t\t\t\t__experimentalOnPatternCategorySelection();\n\t\t\t}\n\t\t},\n\t\t[ setSelectedPatternCategory, __experimentalOnPatternCategorySelection ]\n\t);\n\n\tconst showPatternPanel =\n\t\tselectedTab === 'patterns' &&\n\t\t! delayedFilterValue &&\n\t\tselectedPatternCategory;\n\n\tconst blocksTab = useMemo(\n\t\t() => (\n\t\t\t<>\n\t\t\t\t<div className=\"block-editor-inserter__block-list\">\n\t\t\t\t\t<BlockTypesTab\n\t\t\t\t\t\trootClientId={ destinationRootClientId }\n\t\t\t\t\t\tonInsert={ onInsert }\n\t\t\t\t\t\tonHover={ onHover }\n\t\t\t\t\t\tshowMostUsedBlocks={ showMostUsedBlocks }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t\t{ showInserterHelpPanel && (\n\t\t\t\t\t<div className=\"block-editor-inserter__tips\">\n\t\t\t\t\t\t<VisuallyHidden as=\"h2\">\n\t\t\t\t\t\t\t{ __( 'A tip for using the block editor' ) }\n\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t<Tips />\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t</>\n\t\t),\n\t\t[\n\t\t\tdestinationRootClientId,\n\t\t\tonInsert,\n\t\t\tonHover,\n\t\t\tshowMostUsedBlocks,\n\t\t\tshowInserterHelpPanel,\n\t\t]\n\t);\n\n\tconst patternsTab = useMemo(\n\t\t() => (\n\t\t\t<BlockPatternsTab\n\t\t\t\trootClientId={ destinationRootClientId }\n\t\t\t\tonInsert={ onInsertPattern }\n\t\t\t\tonSelectCategory={ onClickPatternCategory }\n\t\t\t\tselectedCategory={ selectedPatternCategory }\n\t\t\t>\n\t\t\t\t{ showPatternPanel && (\n\t\t\t\t\t<PatternCategoryPreviewPanel\n\t\t\t\t\t\trootClientId={ destinationRootClientId }\n\t\t\t\t\t\tonInsert={ onInsertPattern }\n\t\t\t\t\t\tonHover={ onHoverPattern }\n\t\t\t\t\t\tcategory={ selectedPatternCategory }\n\t\t\t\t\t\tpatternFilter={ patternFilter }\n\t\t\t\t\t\tshowTitlesAsTooltip\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</BlockPatternsTab>\n\t\t),\n\t\t[\n\t\t\tdestinationRootClientId,\n\t\t\tonInsertPattern,\n\t\t\tonClickPatternCategory,\n\t\t\tselectedPatternCategory,\n\t\t\tshowPatternPanel,\n\t\t]\n\t);\n\n\tconst mediaTab = useMemo(\n\t\t() => (\n\t\t\t<MediaTab\n\t\t\t\trootClientId={ destinationRootClientId }\n\t\t\t\tselectedCategory={ selectedMediaCategory }\n\t\t\t\tonSelectCategory={ setSelectedMediaCategory }\n\t\t\t\tonInsert={ onInsert }\n\t\t\t/>\n\t\t),\n\t\t[\n\t\t\tdestinationRootClientId,\n\t\t\tonInsert,\n\t\t\tselectedMediaCategory,\n\t\t\tsetSelectedMediaCategory,\n\t\t]\n\t);\n\n\tconst inserterTabsContents = useMemo(\n\t\t() => ( {\n\t\t\tblocks: blocksTab,\n\t\t\tpatterns: patternsTab,\n\t\t\tmedia: mediaTab,\n\t\t} ),\n\t\t[ blocksTab, mediaTab, patternsTab ]\n\t);\n\n\tconst searchRef = useRef();\n\tuseImperativeHandle( ref, () => ( {\n\t\tfocusSearch: () => {\n\t\t\tsearchRef.current.focus();\n\t\t},\n\t} ) );\n\n\tconst showAsTabs = ! delayedFilterValue && ( showPatterns || showMedia );\n\tconst showMediaPanel =\n\t\tselectedTab === 'media' &&\n\t\t! delayedFilterValue &&\n\t\tselectedMediaCategory;\n\n\t// When the pattern panel is showing, we want to use zoom out mode\n\tuseZoomOut( showPatternPanel );\n\n\tconst handleSetSelectedTab = ( value ) => {\n\t\t// If no longer on patterns tab remove the category setting.\n\t\tif ( value !== 'patterns' ) {\n\t\t\tsetSelectedPatternCategory( null );\n\t\t}\n\t\tsetSelectedTab( value );\n\t};\n\n\treturn (\n\t\t<div\n\t\t\tclassName={ classnames( 'block-editor-inserter__menu', {\n\t\t\t\t'show-panel': showPatternPanel,\n\t\t\t} ) }\n\t\t>\n\t\t\t<div\n\t\t\t\tclassName={ classnames( 'block-editor-inserter__main-area', {\n\t\t\t\t\t'show-as-tabs': showAsTabs,\n\t\t\t\t} ) }\n\t\t\t>\n\t\t\t\t<SearchControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tclassName=\"block-editor-inserter__search\"\n\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\tif ( hoveredItem ) setHoveredItem( null );\n\t\t\t\t\t\tsetFilterValue( value );\n\t\t\t\t\t} }\n\t\t\t\t\tvalue={ filterValue }\n\t\t\t\t\tlabel={ __( 'Search for blocks and patterns' ) }\n\t\t\t\t\tplaceholder={ __( 'Search' ) }\n\t\t\t\t\tref={ searchRef }\n\t\t\t\t/>\n\t\t\t\t{ !! delayedFilterValue && (\n\t\t\t\t\t<div className=\"block-editor-inserter__no-tab-container\">\n\t\t\t\t\t\t<InserterSearchResults\n\t\t\t\t\t\t\tfilterValue={ delayedFilterValue }\n\t\t\t\t\t\t\tonSelect={ onSelect }\n\t\t\t\t\t\t\tonHover={ onHover }\n\t\t\t\t\t\t\tonHoverPattern={ onHoverPattern }\n\t\t\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t\tisAppender={ isAppender }\n\t\t\t\t\t\t\t__experimentalInsertionIndex={\n\t\t\t\t\t\t\t\t__experimentalInsertionIndex\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tshowBlockDirectory\n\t\t\t\t\t\t\tshouldFocusBlock={ shouldFocusBlock }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t\t{ showAsTabs && (\n\t\t\t\t\t<InserterTabs\n\t\t\t\t\t\tshowPatterns={ showPatterns }\n\t\t\t\t\t\tshowMedia={ showMedia }\n\t\t\t\t\t\tonSelect={ handleSetSelectedTab }\n\t\t\t\t\t\ttabsContents={ inserterTabsContents }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ ! delayedFilterValue && ! showAsTabs && (\n\t\t\t\t\t<div className=\"block-editor-inserter__no-tab-container\">\n\t\t\t\t\t\t{ blocksTab }\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t\t{ showMediaPanel && (\n\t\t\t\t<MediaCategoryDialog\n\t\t\t\t\trootClientId={ destinationRootClientId }\n\t\t\t\t\tonInsert={ onInsert }\n\t\t\t\t\tcategory={ selectedMediaCategory }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ showInserterHelpPanel && hoveredItem && (\n\t\t\t\t<Popover\n\t\t\t\t\tclassName=\"block-editor-inserter__preview-container__popover\"\n\t\t\t\t\tplacement=\"right-start\"\n\t\t\t\t\toffset={ 16 }\n\t\t\t\t\tfocusOnMount={ false }\n\t\t\t\t\tanimate={ false }\n\t\t\t\t>\n\t\t\t\t\t<InserterPreviewPanel item={ hoveredItem } />\n\t\t\t\t</Popover>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n\nexport default forwardRef( InserterMenu );\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SACCC,UAAU,EACVC,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;IACrBoC,OAAO,EAAGA,OAAS;IACnBE,cAAc,EAAGA,cAAgB;IACjC1C,YAAY,EAAGA,YAAc;IAC7BC,QAAQ,EAAGA,QAAU;IACrBC,UAAU,EAAGA,UAAY;IACzBC,4BAA4B,EAC3BA,4BACA;IACDyE,kBAAkB;IAClBpE,gBAAgB,EAAGA;EAAkB,CACrC,CACG,CACL,EACC4D,UAAU,IACXjB,aAAA,CAACzD,YAAY;IACZkC,YAAY,EAAGA,YAAc;IAC7BI,SAAS,EAAGA,SAAW;IACvB5B,QAAQ,EAAGkE,oBAAsB;IACjCO,YAAY,EAAGhB;EAAsB,CACrC,CACD,EACC,CAAEhD,kBAAkB,IAAI,CAAEuD,UAAU,IACrCjB,aAAA;IAAKE,SAAS,EAAC;EAAyC,GACrDH,SACE,CAEF,CAAC,EACJmB,cAAc,IACflB,aAAA,CAAC7D,mBAAmB;IACnBU,YAAY,EAAGwB,uBAAyB;IACxCU,QAAQ,EAAGA,QAAU;IACrBwB,QAAQ,EAAGtC;EAAuB,CAClC,CACD,EACCf,qBAAqB,IAAIS,WAAW,IACrCqC,aAAA,CAACxE,OAAO;IACP0E,SAAS,EAAC,mDAAmD;IAC7DyB,SAAS,EAAC,aAAa;IACvBC,MAAM,EAAG,EAAI;IACbC,YAAY,EAAG,KAAO;IACtBC,OAAO,EAAG;EAAO,GAEjB9B,aAAA,CAAClE,oBAAoB;IAACwD,IAAI,EAAG3B;EAAa,CAAE,CACpC,CAEN,CAAC;AAER;AAEA,eAAe3C,UAAU,CAAE4B,YAAa,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["classnames","forwardRef","useState","useCallback","useMemo","useRef","useLayoutEffect","VisuallyHidden","SearchControl","Popover","__","useDebouncedInput","Tips","InserterPreviewPanel","BlockTypesTab","BlockPatternsTab","PatternCategoryPreviewPanel","MediaTab","MediaCategoryPanel","InserterSearchResults","useInsertionPoint","InserterTabs","useZoomOut","NOOP","InserterMenu","rootClientId","clientId","isAppender","__experimentalInsertionIndex","onSelect","showInserterHelpPanel","showMostUsedBlocks","__experimentalFilterValue","shouldFocusBlock","__experimentalOnPatternCategorySelection","ref","filterValue","setFilterValue","delayedFilterValue","hoveredItem","setHoveredItem","selectedPatternCategory","setSelectedPatternCategory","patternFilter","setPatternFilter","selectedMediaCategory","setSelectedMediaCategory","selectedTab","setSelectedTab","destinationRootClientId","onInsertBlocks","onToggleInsertionPoint","insertionIndex","onInsert","blocks","meta","shouldForceFocusBlock","onInsertPattern","patternName","onHover","item","onHoverPattern","isZoomedOutViewExperimentEnabled","window","__experimentalEnableZoomedOutView","onClickPatternCategory","patternCategory","filter","showPatternPanel","showMediaPanel","inserterSearch","createElement","Fragment","__nextHasNoMarginBottom","className","onChange","value","label","placeholder","showBlockDirectory","prioritizePatterns","blocksTab","as","patternsTab","onSelectCategory","selectedCategory","category","showTitlesAsTooltip","mediaTab","inserterTabsContents","patterns","media","handleSetSelectedTab","tabsRef","current","requestAnimationFrame","querySelector","focus","tabsContents","placement","offset","focusOnMount","animate"],"sources":["@wordpress/block-editor/src/components/inserter/menu.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tforwardRef,\n\tuseState,\n\tuseCallback,\n\tuseMemo,\n\tuseRef,\n\tuseLayoutEffect,\n} from '@wordpress/element';\nimport { VisuallyHidden, SearchControl, Popover } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useDebouncedInput } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport Tips from './tips';\nimport InserterPreviewPanel from './preview-panel';\nimport BlockTypesTab from './block-types-tab';\nimport BlockPatternsTab from './block-patterns-tab';\nimport { PatternCategoryPreviewPanel } from './block-patterns-tab/pattern-category-preview-panel';\nimport { MediaTab, MediaCategoryPanel } from './media-tab';\nimport InserterSearchResults from './search-results';\nimport useInsertionPoint from './hooks/use-insertion-point';\nimport InserterTabs from './tabs';\nimport { useZoomOut } from '../../hooks/use-zoom-out';\n\nconst NOOP = () => {};\nfunction InserterMenu(\n\t{\n\t\trootClientId,\n\t\tclientId,\n\t\tisAppender,\n\t\t__experimentalInsertionIndex,\n\t\tonSelect,\n\t\tshowInserterHelpPanel,\n\t\tshowMostUsedBlocks,\n\t\t__experimentalFilterValue = '',\n\t\tshouldFocusBlock = true,\n\t\t__experimentalOnPatternCategorySelection = NOOP,\n\t},\n\tref\n) {\n\tconst [ filterValue, setFilterValue, delayedFilterValue ] =\n\t\tuseDebouncedInput( __experimentalFilterValue );\n\tconst [ hoveredItem, setHoveredItem ] = useState( null );\n\tconst [ selectedPatternCategory, setSelectedPatternCategory ] =\n\t\tuseState( null );\n\tconst [ patternFilter, setPatternFilter ] = useState( 'all' );\n\tconst [ selectedMediaCategory, setSelectedMediaCategory ] =\n\t\tuseState( null );\n\tconst [ selectedTab, setSelectedTab ] = useState( 'blocks' );\n\n\tconst [ destinationRootClientId, onInsertBlocks, onToggleInsertionPoint ] =\n\t\tuseInsertionPoint( {\n\t\t\trootClientId,\n\t\t\tclientId,\n\t\t\tisAppender,\n\t\t\tinsertionIndex: __experimentalInsertionIndex,\n\t\t\tshouldFocusBlock,\n\t\t} );\n\n\tconst onInsert = useCallback(\n\t\t( blocks, meta, shouldForceFocusBlock ) => {\n\t\t\tonInsertBlocks( blocks, meta, shouldForceFocusBlock );\n\t\t\tonSelect();\n\t\t},\n\t\t[ onInsertBlocks, onSelect ]\n\t);\n\n\tconst onInsertPattern = useCallback(\n\t\t( blocks, patternName ) => {\n\t\t\tonInsertBlocks( blocks, { patternName } );\n\t\t\tonSelect();\n\t\t},\n\t\t[ onInsertBlocks, onSelect ]\n\t);\n\n\tconst onHover = useCallback(\n\t\t( item ) => {\n\t\t\tonToggleInsertionPoint( !! item );\n\t\t\tsetHoveredItem( item );\n\t\t},\n\t\t[ onToggleInsertionPoint, setHoveredItem ]\n\t);\n\n\tconst onHoverPattern = useCallback(\n\t\t( item ) => {\n\t\t\tonToggleInsertionPoint( !! item );\n\t\t},\n\t\t[ onToggleInsertionPoint ]\n\t);\n\n\tconst isZoomedOutViewExperimentEnabled =\n\t\twindow?.__experimentalEnableZoomedOutView;\n\tconst onClickPatternCategory = useCallback(\n\t\t( patternCategory, filter ) => {\n\t\t\tsetSelectedPatternCategory( patternCategory );\n\t\t\tsetPatternFilter( filter );\n\t\t\tif ( isZoomedOutViewExperimentEnabled ) {\n\t\t\t\t__experimentalOnPatternCategorySelection();\n\t\t\t}\n\t\t},\n\t\t[\n\t\t\tsetSelectedPatternCategory,\n\t\t\t__experimentalOnPatternCategorySelection,\n\t\t\tisZoomedOutViewExperimentEnabled,\n\t\t]\n\t);\n\n\tconst showPatternPanel =\n\t\tselectedTab === 'patterns' &&\n\t\t! delayedFilterValue &&\n\t\tselectedPatternCategory;\n\n\tconst showMediaPanel = selectedTab === 'media' && selectedMediaCategory;\n\n\tconst inserterSearch = useMemo( () => {\n\t\tif ( selectedTab === 'media' ) {\n\t\t\treturn null;\n\t\t}\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<SearchControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tclassName=\"block-editor-inserter__search\"\n\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\tif ( hoveredItem ) {\n\t\t\t\t\t\t\tsetHoveredItem( null );\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsetFilterValue( value );\n\t\t\t\t\t} }\n\t\t\t\t\tvalue={ filterValue }\n\t\t\t\t\tlabel={ __( 'Search for blocks and patterns' ) }\n\t\t\t\t\tplaceholder={ __( 'Search' ) }\n\t\t\t\t/>\n\t\t\t\t{ !! delayedFilterValue && (\n\t\t\t\t\t<InserterSearchResults\n\t\t\t\t\t\tfilterValue={ delayedFilterValue }\n\t\t\t\t\t\tonSelect={ onSelect }\n\t\t\t\t\t\tonHover={ onHover }\n\t\t\t\t\t\tonHoverPattern={ onHoverPattern }\n\t\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\tisAppender={ isAppender }\n\t\t\t\t\t\t__experimentalInsertionIndex={\n\t\t\t\t\t\t\t__experimentalInsertionIndex\n\t\t\t\t\t\t}\n\t\t\t\t\t\tshowBlockDirectory\n\t\t\t\t\t\tshouldFocusBlock={ shouldFocusBlock }\n\t\t\t\t\t\tprioritizePatterns={ selectedTab === 'patterns' }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t}, [\n\t\tselectedTab,\n\t\thoveredItem,\n\t\tsetHoveredItem,\n\t\tsetFilterValue,\n\t\tfilterValue,\n\t\tdelayedFilterValue,\n\t\tonSelect,\n\t\tonHover,\n\t\tonHoverPattern,\n\t\tshouldFocusBlock,\n\t\tclientId,\n\t\trootClientId,\n\t\t__experimentalInsertionIndex,\n\t\tisAppender,\n\t] );\n\n\tconst blocksTab = useMemo(\n\t\t() => (\n\t\t\t<>\n\t\t\t\t{ inserterSearch }\n\t\t\t\t{ ! delayedFilterValue && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<div className=\"block-editor-inserter__block-list\">\n\t\t\t\t\t\t\t<BlockTypesTab\n\t\t\t\t\t\t\t\trootClientId={ destinationRootClientId }\n\t\t\t\t\t\t\t\tonInsert={ onInsert }\n\t\t\t\t\t\t\t\tonHover={ onHover }\n\t\t\t\t\t\t\t\tshowMostUsedBlocks={ showMostUsedBlocks }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t{ showInserterHelpPanel && (\n\t\t\t\t\t\t\t<div className=\"block-editor-inserter__tips\">\n\t\t\t\t\t\t\t\t<VisuallyHidden as=\"h2\">\n\t\t\t\t\t\t\t\t\t{ __( 'A tip for using the block editor' ) }\n\t\t\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t\t\t<Tips />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</>\n\t\t),\n\t\t[\n\t\t\tdestinationRootClientId,\n\t\t\tonInsert,\n\t\t\tonHover,\n\t\t\tshowMostUsedBlocks,\n\t\t\tshowInserterHelpPanel,\n\t\t\tinserterSearch,\n\t\t\tdelayedFilterValue,\n\t\t]\n\t);\n\n\tconst patternsTab = useMemo(\n\t\t() => (\n\t\t\t<>\n\t\t\t\t{ inserterSearch }\n\t\t\t\t{ ! delayedFilterValue && (\n\t\t\t\t\t<BlockPatternsTab\n\t\t\t\t\t\trootClientId={ destinationRootClientId }\n\t\t\t\t\t\tonInsert={ onInsertPattern }\n\t\t\t\t\t\tonSelectCategory={ onClickPatternCategory }\n\t\t\t\t\t\tselectedCategory={ selectedPatternCategory }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ showPatternPanel && (\n\t\t\t\t\t\t\t<PatternCategoryPreviewPanel\n\t\t\t\t\t\t\t\trootClientId={ destinationRootClientId }\n\t\t\t\t\t\t\t\tonInsert={ onInsertPattern }\n\t\t\t\t\t\t\t\tonHover={ onHoverPattern }\n\t\t\t\t\t\t\t\tcategory={ selectedPatternCategory }\n\t\t\t\t\t\t\t\tpatternFilter={ patternFilter }\n\t\t\t\t\t\t\t\tshowTitlesAsTooltip\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</BlockPatternsTab>\n\t\t\t\t) }\n\t\t\t</>\n\t\t),\n\t\t[\n\t\t\tdestinationRootClientId,\n\t\t\tonHoverPattern,\n\t\t\tonInsertPattern,\n\t\t\tonClickPatternCategory,\n\t\t\tpatternFilter,\n\t\t\tselectedPatternCategory,\n\t\t\tshowPatternPanel,\n\t\t\tinserterSearch,\n\t\t\tdelayedFilterValue,\n\t\t]\n\t);\n\n\tconst mediaTab = useMemo(\n\t\t() => (\n\t\t\t<MediaTab\n\t\t\t\trootClientId={ destinationRootClientId }\n\t\t\t\tselectedCategory={ selectedMediaCategory }\n\t\t\t\tonSelectCategory={ setSelectedMediaCategory }\n\t\t\t\tonInsert={ onInsert }\n\t\t\t>\n\t\t\t\t{ showMediaPanel && (\n\t\t\t\t\t<MediaCategoryPanel\n\t\t\t\t\t\trootClientId={ destinationRootClientId }\n\t\t\t\t\t\tonInsert={ onInsert }\n\t\t\t\t\t\tcategory={ selectedMediaCategory }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</MediaTab>\n\t\t),\n\t\t[\n\t\t\tdestinationRootClientId,\n\t\t\tonInsert,\n\t\t\tselectedMediaCategory,\n\t\t\tsetSelectedMediaCategory,\n\t\t\tshowMediaPanel,\n\t\t]\n\t);\n\n\tconst inserterTabsContents = useMemo(\n\t\t() => ( {\n\t\t\tblocks: blocksTab,\n\t\t\tpatterns: patternsTab,\n\t\t\tmedia: mediaTab,\n\t\t} ),\n\t\t[ blocksTab, mediaTab, patternsTab ]\n\t);\n\n\t// When the pattern panel is showing, we want to use zoom out mode\n\tuseZoomOut( showPatternPanel );\n\n\tconst handleSetSelectedTab = ( value ) => {\n\t\t// If no longer on patterns tab remove the category setting.\n\t\tif ( value !== 'patterns' ) {\n\t\t\tsetSelectedPatternCategory( null );\n\t\t}\n\t\tsetSelectedTab( value );\n\t};\n\n\t// Focus first active tab, if any\n\tconst tabsRef = useRef();\n\tuseLayoutEffect( () => {\n\t\tif ( tabsRef.current ) {\n\t\t\twindow.requestAnimationFrame( () => {\n\t\t\t\ttabsRef.current\n\t\t\t\t\t.querySelector( '[role=\"tab\"][aria-selected=\"true\"]' )\n\t\t\t\t\t?.focus();\n\t\t\t} );\n\t\t}\n\t}, [] );\n\n\treturn (\n\t\t<div\n\t\t\tclassName={ classnames( 'block-editor-inserter__menu', {\n\t\t\t\t'show-panel': showPatternPanel || showMediaPanel,\n\t\t\t} ) }\n\t\t\tref={ ref }\n\t\t>\n\t\t\t<div className=\"block-editor-inserter__main-area\">\n\t\t\t\t<InserterTabs\n\t\t\t\t\tref={ tabsRef }\n\t\t\t\t\tonSelect={ handleSetSelectedTab }\n\t\t\t\t\ttabsContents={ inserterTabsContents }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t{ showInserterHelpPanel && hoveredItem && (\n\t\t\t\t<Popover\n\t\t\t\t\tclassName=\"block-editor-inserter__preview-container__popover\"\n\t\t\t\t\tplacement=\"right-start\"\n\t\t\t\t\toffset={ 16 }\n\t\t\t\t\tfocusOnMount={ false }\n\t\t\t\t\tanimate={ false }\n\t\t\t\t>\n\t\t\t\t\t<InserterPreviewPanel item={ hoveredItem } />\n\t\t\t\t</Popover>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n\nexport default forwardRef( InserterMenu );\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SACCC,UAAU,EACVC,QAAQ,EACRC,WAAW,EACXC,OAAO,EACPC,MAAM,EACNC,eAAe,QACT,oBAAoB;AAC3B,SAASC,cAAc,EAAEC,aAAa,EAAEC,OAAO,QAAQ,uBAAuB;AAC9E,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,iBAAiB,QAAQ,oBAAoB;;AAEtD;AACA;AACA;AACA,OAAOC,IAAI,MAAM,QAAQ;AACzB,OAAOC,oBAAoB,MAAM,iBAAiB;AAClD,OAAOC,aAAa,MAAM,mBAAmB;AAC7C,OAAOC,gBAAgB,MAAM,sBAAsB;AACnD,SAASC,2BAA2B,QAAQ,qDAAqD;AACjG,SAASC,QAAQ,EAAEC,kBAAkB,QAAQ,aAAa;AAC1D,OAAOC,qBAAqB,MAAM,kBAAkB;AACpD,OAAOC,iBAAiB,MAAM,6BAA6B;AAC3D,OAAOC,YAAY,MAAM,QAAQ;AACjC,SAASC,UAAU,QAAQ,0BAA0B;AAErD,MAAMC,IAAI,GAAGA,CAAA,KAAM,CAAC,CAAC;AACrB,SAASC,YAAYA,CACpB;EACCC,YAAY;EACZC,QAAQ;EACRC,UAAU;EACVC,4BAA4B;EAC5BC,QAAQ;EACRC,qBAAqB;EACrBC,kBAAkB;EAClBC,yBAAyB,GAAG,EAAE;EA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B;EAAa,CAAE,CACpC,CAEN,CAAC;AAER;AAEA,eAAetC,UAAU,CAAEuB,YAAa,CAAC","ignoreList":[]}
|
|
@@ -4,6 +4,7 @@ import { createElement } from "react";
|
|
|
4
4
|
*/
|
|
5
5
|
import { privateApis as componentsPrivateApis } from '@wordpress/components';
|
|
6
6
|
import { __ } from '@wordpress/i18n';
|
|
7
|
+
import { forwardRef } from '@wordpress/element';
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* Internal dependencies
|
|
@@ -28,14 +29,13 @@ const mediaTab = {
|
|
|
28
29
|
title: __('Media')
|
|
29
30
|
};
|
|
30
31
|
function InserterTabs({
|
|
31
|
-
showPatterns = false,
|
|
32
|
-
showMedia = false,
|
|
33
32
|
onSelect,
|
|
34
33
|
tabsContents
|
|
35
|
-
}) {
|
|
36
|
-
const tabs = [blocksTab,
|
|
34
|
+
}, ref) {
|
|
35
|
+
const tabs = [blocksTab, patternsTab, mediaTab];
|
|
37
36
|
return createElement("div", {
|
|
38
|
-
className: "block-editor-inserter__tabs"
|
|
37
|
+
className: "block-editor-inserter__tabs",
|
|
38
|
+
ref: ref
|
|
39
39
|
}, createElement(Tabs, {
|
|
40
40
|
onSelect: onSelect
|
|
41
41
|
}, createElement(Tabs.TabList, {
|
|
@@ -51,5 +51,5 @@ function InserterTabs({
|
|
|
51
51
|
className: "block-editor-inserter__tabpanel"
|
|
52
52
|
}, tabsContents[tab.name]))));
|
|
53
53
|
}
|
|
54
|
-
export default InserterTabs;
|
|
54
|
+
export default forwardRef(InserterTabs);
|
|
55
55
|
//# sourceMappingURL=tabs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["privateApis","componentsPrivateApis","__","unlock","Tabs","blocksTab","name","title","patternsTab","mediaTab","InserterTabs","
|
|
1
|
+
{"version":3,"names":["privateApis","componentsPrivateApis","__","forwardRef","unlock","Tabs","blocksTab","name","title","patternsTab","mediaTab","InserterTabs","onSelect","tabsContents","ref","tabs","createElement","className","TabList","map","tab","Tab","key","tabId","TabPanel","focusable"],"sources":["@wordpress/block-editor/src/components/inserter/tabs.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { privateApis as componentsPrivateApis } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nconst { Tabs } = unlock( componentsPrivateApis );\n\nconst blocksTab = {\n\tname: 'blocks',\n\t/* translators: Blocks tab title in the block inserter. */\n\ttitle: __( 'Blocks' ),\n};\nconst patternsTab = {\n\tname: 'patterns',\n\t/* translators: Theme and Directory Patterns tab title in the block inserter. */\n\ttitle: __( 'Patterns' ),\n};\n\nconst mediaTab = {\n\tname: 'media',\n\t/* translators: Media tab title in the block inserter. */\n\ttitle: __( 'Media' ),\n};\n\nfunction InserterTabs( { onSelect, tabsContents }, ref ) {\n\tconst tabs = [ blocksTab, patternsTab, mediaTab ];\n\n\treturn (\n\t\t<div className=\"block-editor-inserter__tabs\" ref={ ref }>\n\t\t\t<Tabs onSelect={ onSelect }>\n\t\t\t\t<Tabs.TabList className=\"block-editor-inserter__tablist\">\n\t\t\t\t\t{ tabs.map( ( tab ) => (\n\t\t\t\t\t\t<Tabs.Tab\n\t\t\t\t\t\t\tkey={ tab.name }\n\t\t\t\t\t\t\ttabId={ tab.name }\n\t\t\t\t\t\t\tclassName=\"block-editor-inserter__tab\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ tab.title }\n\t\t\t\t\t\t</Tabs.Tab>\n\t\t\t\t\t) ) }\n\t\t\t\t</Tabs.TabList>\n\t\t\t\t{ tabs.map( ( tab ) => (\n\t\t\t\t\t<Tabs.TabPanel\n\t\t\t\t\t\tkey={ tab.name }\n\t\t\t\t\t\ttabId={ tab.name }\n\t\t\t\t\t\tfocusable={ false }\n\t\t\t\t\t\tclassName=\"block-editor-inserter__tabpanel\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ t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AG,CAACZ,KACG,CACT,CACW,CAAC,EACbO,IAAI,CAACI,GAAG,CAAIC,GAAG,IAChBJ,aAAA,CAACX,IAAI,CAACmB,QAAQ;IACbF,GAAG,EAAGF,GAAG,CAACb,IAAM;IAChBgB,KAAK,EAAGH,GAAG,CAACb,IAAM;IAClBkB,SAAS,EAAG,KAAO;IACnBR,SAAS,EAAC;EAAiC,GAEzCJ,YAAY,CAAEO,GAAG,CAACb,IAAI,CACV,CACd,CACG,CACF,CAAC;AAER;AAEA,eAAeJ,UAAU,CAAEQ,YAAa,CAAC","ignoreList":[]}
|
|
@@ -21,7 +21,9 @@ const LineHeightControl = ({
|
|
|
21
21
|
const isDefined = isLineHeightDefined(lineHeight);
|
|
22
22
|
const adjustNextValue = (nextValue, wasTypedOrPasted) => {
|
|
23
23
|
// Set the next value without modification if lineHeight has been defined.
|
|
24
|
-
if (isDefined)
|
|
24
|
+
if (isDefined) {
|
|
25
|
+
return nextValue;
|
|
26
|
+
}
|
|
25
27
|
|
|
26
28
|
/**
|
|
27
29
|
* The following logic handles the initial spin up/down action
|
|
@@ -41,7 +43,9 @@ const LineHeightControl = ({
|
|
|
41
43
|
{
|
|
42
44
|
// This means the user explicitly input '0', rather than using the
|
|
43
45
|
// spin down action from an undefined value state.
|
|
44
|
-
if (wasTypedOrPasted)
|
|
46
|
+
if (wasTypedOrPasted) {
|
|
47
|
+
return nextValue;
|
|
48
|
+
}
|
|
45
49
|
// Decrement by spin value.
|
|
46
50
|
return BASE_DEFAULT_VALUE - spin;
|
|
47
51
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["deprecated","__","__experimentalNumberControl","NumberControl","BASE_DEFAULT_VALUE","RESET_VALUE","STEP","SPIN_FACTOR","isLineHeightDefined","LineHeightControl","value","lineHeight","onChange","__nextHasNoMarginBottom","__unstableInputWidth","otherProps","isDefined","adjustNextValue","nextValue","wasTypedOrPasted","spin","stateReducer","state","action","includes","payload","event","nativeEvent","inputType","since","version","hint","deprecatedStyles","undefined","marginBottom","handleOnChange","type","createElement","className","style","__unstableStateReducer","label","placeholder","step","spinFactor","min","spinControls"],"sources":["@wordpress/block-editor/src/components/line-height-control/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\nimport { __ } from '@wordpress/i18n';\nimport { __experimentalNumberControl as NumberControl } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport {\n\tBASE_DEFAULT_VALUE,\n\tRESET_VALUE,\n\tSTEP,\n\tSPIN_FACTOR,\n\tisLineHeightDefined,\n} from './utils';\n\nconst LineHeightControl = ( {\n\tvalue: lineHeight,\n\tonChange,\n\t/** Start opting into the new margin-free styles that will become the default in a future version. */\n\t__nextHasNoMarginBottom = false,\n\t__unstableInputWidth = '60px',\n\t...otherProps\n} ) => {\n\tconst isDefined = isLineHeightDefined( lineHeight );\n\n\tconst adjustNextValue = ( nextValue, wasTypedOrPasted ) => {\n\t\t// Set the next value without modification if lineHeight has been defined.\n\t\tif ( isDefined )
|
|
1
|
+
{"version":3,"names":["deprecated","__","__experimentalNumberControl","NumberControl","BASE_DEFAULT_VALUE","RESET_VALUE","STEP","SPIN_FACTOR","isLineHeightDefined","LineHeightControl","value","lineHeight","onChange","__nextHasNoMarginBottom","__unstableInputWidth","otherProps","isDefined","adjustNextValue","nextValue","wasTypedOrPasted","spin","stateReducer","state","action","includes","payload","event","nativeEvent","inputType","since","version","hint","deprecatedStyles","undefined","marginBottom","handleOnChange","type","createElement","className","style","__unstableStateReducer","label","placeholder","step","spinFactor","min","spinControls"],"sources":["@wordpress/block-editor/src/components/line-height-control/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\nimport { __ } from '@wordpress/i18n';\nimport { __experimentalNumberControl as NumberControl } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport {\n\tBASE_DEFAULT_VALUE,\n\tRESET_VALUE,\n\tSTEP,\n\tSPIN_FACTOR,\n\tisLineHeightDefined,\n} from './utils';\n\nconst LineHeightControl = ( {\n\tvalue: lineHeight,\n\tonChange,\n\t/** Start opting into the new margin-free styles that will become the default in a future version. */\n\t__nextHasNoMarginBottom = false,\n\t__unstableInputWidth = '60px',\n\t...otherProps\n} ) => {\n\tconst isDefined = isLineHeightDefined( lineHeight );\n\n\tconst adjustNextValue = ( nextValue, wasTypedOrPasted ) => {\n\t\t// Set the next value without modification if lineHeight has been defined.\n\t\tif ( isDefined ) {\n\t\t\treturn nextValue;\n\t\t}\n\n\t\t/**\n\t\t * The following logic handles the initial spin up/down action\n\t\t * (from an undefined value state) so that the next values are better suited for\n\t\t * line-height rendering. For example, the first spin up should immediately\n\t\t * go to 1.6, rather than the normally expected 0.1.\n\t\t *\n\t\t * Spin up/down actions can be triggered by keydowns of the up/down arrow keys,\n\t\t * dragging the input or by clicking the spin buttons.\n\t\t */\n\t\tconst spin = STEP * SPIN_FACTOR;\n\t\tswitch ( `${ nextValue }` ) {\n\t\t\tcase `${ spin }`:\n\t\t\t\t// Increment by spin value.\n\t\t\t\treturn BASE_DEFAULT_VALUE + spin;\n\t\t\tcase '0': {\n\t\t\t\t// This means the user explicitly input '0', rather than using the\n\t\t\t\t// spin down action from an undefined value state.\n\t\t\t\tif ( wasTypedOrPasted ) {\n\t\t\t\t\treturn nextValue;\n\t\t\t\t}\n\t\t\t\t// Decrement by spin value.\n\t\t\t\treturn BASE_DEFAULT_VALUE - spin;\n\t\t\t}\n\t\t\tcase '':\n\t\t\t\treturn BASE_DEFAULT_VALUE;\n\t\t\tdefault:\n\t\t\t\treturn nextValue;\n\t\t}\n\t};\n\n\tconst stateReducer = ( state, action ) => {\n\t\t// Be careful when changing this — cross-browser behavior of the\n\t\t// `inputType` field in `input` events are inconsistent.\n\t\t// For example, Firefox emits an input event with inputType=\"insertReplacementText\"\n\t\t// on spin button clicks, while other browsers do not even emit an input event.\n\t\tconst wasTypedOrPasted = [ 'insertText', 'insertFromPaste' ].includes(\n\t\t\taction.payload.event.nativeEvent?.inputType\n\t\t);\n\t\tconst value = adjustNextValue( state.value, wasTypedOrPasted );\n\t\treturn { ...state, value };\n\t};\n\n\tconst value = isDefined ? lineHeight : RESET_VALUE;\n\n\tif ( ! __nextHasNoMarginBottom ) {\n\t\tdeprecated(\n\t\t\t'Bottom margin styles for wp.blockEditor.LineHeightControl',\n\t\t\t{\n\t\t\t\tsince: '6.0',\n\t\t\t\tversion: '6.4',\n\t\t\t\thint: 'Set the `__nextHasNoMarginBottom` prop to true to start opting into the new styles, which will become the default in a future version',\n\t\t\t}\n\t\t);\n\t}\n\tconst deprecatedStyles = __nextHasNoMarginBottom\n\t\t? undefined\n\t\t: { marginBottom: 24 };\n\n\tconst handleOnChange = ( nextValue, { event } ) => {\n\t\tif ( nextValue === '' ) {\n\t\t\tonChange();\n\t\t\treturn;\n\t\t}\n\n\t\tif ( event.type === 'click' ) {\n\t\t\tonChange( adjustNextValue( `${ nextValue }`, false ) );\n\t\t\treturn;\n\t\t}\n\n\t\tonChange( `${ nextValue }` );\n\t};\n\n\treturn (\n\t\t<div\n\t\t\tclassName=\"block-editor-line-height-control\"\n\t\t\tstyle={ deprecatedStyles }\n\t\t>\n\t\t\t<NumberControl\n\t\t\t\t{ ...otherProps }\n\t\t\t\t__unstableInputWidth={ __unstableInputWidth }\n\t\t\t\t__unstableStateReducer={ stateReducer }\n\t\t\t\tonChange={ handleOnChange }\n\t\t\t\tlabel={ __( 'Line height' ) }\n\t\t\t\tplaceholder={ BASE_DEFAULT_VALUE }\n\t\t\t\tstep={ STEP }\n\t\t\t\tspinFactor={ SPIN_FACTOR }\n\t\t\t\tvalue={ value }\n\t\t\t\tmin={ 0 }\n\t\t\t\tspinControls=\"custom\"\n\t\t\t/>\n\t\t</div>\n\t);\n};\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/line-height-control/README.md\n */\nexport default LineHeightControl;\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAA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@@ -49,12 +49,16 @@ function SearchItemIcon({
|
|
|
49
49
|
*/
|
|
50
50
|
function addLeadingSlash(url) {
|
|
51
51
|
const trimmedURL = url?.trim();
|
|
52
|
-
if (!trimmedURL?.length)
|
|
52
|
+
if (!trimmedURL?.length) {
|
|
53
|
+
return url;
|
|
54
|
+
}
|
|
53
55
|
return url?.replace(/^\/?/, '/');
|
|
54
56
|
}
|
|
55
57
|
function removeTrailingSlash(url) {
|
|
56
58
|
const trimmedURL = url?.trim();
|
|
57
|
-
if (!trimmedURL?.length)
|
|
59
|
+
if (!trimmedURL?.length) {
|
|
60
|
+
return url;
|
|
61
|
+
}
|
|
58
62
|
return url?.replace(/\/$/, '');
|
|
59
63
|
}
|
|
60
64
|
const partialRight = (fn, ...partialArgs) => (...args) => fn(...args, ...partialArgs);
|
|
@@ -72,7 +76,9 @@ const defaultTo = d => v => {
|
|
|
72
76
|
* @return {string} the processed url to display.
|
|
73
77
|
*/
|
|
74
78
|
function getURLForDisplay(url) {
|
|
75
|
-
if (!url)
|
|
79
|
+
if (!url) {
|
|
80
|
+
return url;
|
|
81
|
+
}
|
|
76
82
|
return pipe(safeDecodeURI, getPath, defaultTo(''), partialRight(filterURLForDisplay, 24), removeTrailingSlash, addLeadingSlash)(url);
|
|
77
83
|
}
|
|
78
84
|
export const LinkControlSearchItem = ({
|