@wordpress/block-editor 10.5.0 → 11.1.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 +18 -0
- package/README.md +2 -1
- package/build/autocompleters/block.js +2 -6
- package/build/autocompleters/block.js.map +1 -1
- package/build/autocompleters/link.js +2 -0
- package/build/autocompleters/link.js.map +1 -1
- package/build/components/alignment-control/ui.js +1 -7
- package/build/components/alignment-control/ui.js.map +1 -1
- package/build/components/block-alignment-control/use-available-alignments.js +4 -3
- package/build/components/block-alignment-control/use-available-alignments.js.map +1 -1
- package/build/components/block-card/index.js +51 -3
- package/build/components/block-card/index.js.map +1 -1
- package/build/components/block-draggable/index.native.js +46 -39
- package/build/components/block-draggable/index.native.js.map +1 -1
- package/build/components/block-edit/edit.js +4 -3
- package/build/components/block-edit/edit.js.map +1 -1
- package/build/components/block-edit/edit.native.js +4 -7
- package/build/components/block-edit/edit.native.js.map +1 -1
- package/build/components/block-icon/index.js +4 -2
- package/build/components/block-icon/index.js.map +1 -1
- package/build/components/block-inspector/index.js +90 -37
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list/block-list-context.native.js +5 -8
- package/build/components/block-list/block-list-context.native.js.map +1 -1
- package/build/components/block-list/block.js +55 -24
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/block.native.js +61 -28
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-list-appender/index.js +46 -34
- package/build/components/block-list-appender/index.js.map +1 -1
- package/build/components/block-list-appender/index.native.js +39 -34
- package/build/components/block-list-appender/index.native.js.map +1 -1
- package/build/components/block-mobile-toolbar/block-actions-menu.native.js +30 -22
- package/build/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
- package/build/components/block-mobile-toolbar/index.native.js +1 -1
- package/build/components/block-mobile-toolbar/index.native.js.map +1 -1
- package/build/components/block-pattern-setup/index.js +16 -8
- package/build/components/block-pattern-setup/index.js.map +1 -1
- package/build/components/block-patterns-list/index.js +33 -11
- package/build/components/block-patterns-list/index.js.map +1 -1
- package/build/components/block-preview/auto.js +9 -3
- package/build/components/block-preview/auto.js.map +1 -1
- package/build/components/block-preview/index.js +5 -9
- package/build/components/block-preview/index.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +5 -2
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-styles/index.native.js +1 -3
- package/build/components/block-styles/index.native.js.map +1 -1
- package/build/components/block-styles/utils.js +7 -10
- package/build/components/block-styles/utils.js.map +1 -1
- package/build/components/block-toolbar/index.js +5 -1
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-toolbar/index.native.js +6 -8
- package/build/components/block-toolbar/index.native.js.map +1 -1
- package/build/components/block-tools/insertion-point.js +8 -49
- package/build/components/block-tools/insertion-point.js.map +1 -1
- package/build/components/block-tools/selected-block-popover.js +1 -3
- package/build/components/block-tools/selected-block-popover.js.map +1 -1
- package/build/components/block-variation-picker/index.js +2 -3
- package/build/components/block-variation-picker/index.js.map +1 -1
- package/build/components/colors/utils.js +2 -6
- package/build/components/colors/utils.js.map +1 -1
- package/build/components/colors-gradients/control.js +0 -3
- package/build/components/colors-gradients/control.js.map +1 -1
- package/build/components/colors-gradients/dropdown.js +0 -2
- package/build/components/colors-gradients/dropdown.js.map +1 -1
- package/build/components/colors-gradients/panel-color-gradient-settings.js +2 -19
- package/build/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
- package/build/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +4 -3
- package/build/components/colors-gradients/use-multiple-origin-colors-and-gradients.js.map +1 -1
- package/build/components/copy-handler/index.js +37 -9
- package/build/components/copy-handler/index.js.map +1 -1
- package/build/components/font-sizes/fluid-utils.js +5 -2
- package/build/components/font-sizes/fluid-utils.js.map +1 -1
- package/build/components/font-sizes/utils.js +10 -4
- package/build/components/font-sizes/utils.js.map +1 -1
- package/build/components/font-sizes/with-font-sizes.js +11 -6
- package/build/components/font-sizes/with-font-sizes.js.map +1 -1
- package/build/components/gradients/use-gradient.js +2 -8
- package/build/components/gradients/use-gradient.js.map +1 -1
- package/build/components/height-control/index.js +115 -0
- package/build/components/height-control/index.js.map +1 -0
- package/build/components/iframe/index.js +22 -101
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/iframe/use-compatibility-styles.js +93 -0
- package/build/components/iframe/use-compatibility-styles.js.map +1 -0
- package/build/components/image-editor/use-save-image.js +2 -0
- package/build/components/image-editor/use-save-image.js.map +1 -1
- package/build/components/image-editor/zoom-dropdown.js +1 -0
- package/build/components/image-editor/zoom-dropdown.js.map +1 -1
- package/build/components/index.js +9 -0
- package/build/components/index.js.map +1 -1
- package/build/components/inner-blocks/index.js +25 -7
- package/build/components/inner-blocks/index.js.map +1 -1
- package/build/components/inner-blocks/use-inner-block-template-sync.js +25 -10
- package/build/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
- package/build/components/inserter/block-patterns-explorer/sidebar.js +1 -0
- package/build/components/inserter/block-patterns-explorer/sidebar.js.map +1 -1
- package/build/components/inserter/block-patterns-tab.js +25 -46
- package/build/components/inserter/block-patterns-tab.js.map +1 -1
- package/build/components/inserter/block-types-tab.js +3 -1
- package/build/components/inserter/block-types-tab.js.map +1 -1
- package/build/components/inserter/hooks/use-debounced-input.js +27 -0
- package/build/components/inserter/hooks/use-debounced-input.js.map +1 -0
- package/build/components/inserter/hooks/use-insertion-point.js +4 -3
- package/build/components/inserter/hooks/use-insertion-point.js.map +1 -1
- package/build/components/inserter/index.js +20 -6
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/inserter/index.native.js +3 -4
- package/build/components/inserter/index.native.js.map +1 -1
- package/build/components/inserter/media-tab/hooks.js +106 -0
- package/build/components/inserter/media-tab/hooks.js.map +1 -0
- package/build/components/inserter/media-tab/index.js +32 -0
- package/build/components/inserter/media-tab/index.js.map +1 -0
- package/build/components/inserter/media-tab/media-list.js +100 -0
- package/build/components/inserter/media-tab/media-list.js.map +1 -0
- package/build/components/inserter/media-tab/media-panel.js +96 -0
- package/build/components/inserter/media-tab/media-panel.js.map +1 -0
- package/build/components/inserter/media-tab/media-tab.js +120 -0
- package/build/components/inserter/media-tab/media-tab.js.map +1 -0
- package/build/components/inserter/media-tab/utils.js +54 -0
- package/build/components/inserter/media-tab/utils.js.map +1 -0
- package/build/components/inserter/menu.js +35 -12
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/mobile-tab-navigation.js +70 -0
- package/build/components/inserter/mobile-tab-navigation.js.map +1 -0
- package/build/components/inserter/quick-inserter.js +7 -3
- package/build/components/inserter/quick-inserter.js.map +1 -1
- package/build/components/inserter/search-items.js +15 -14
- package/build/components/inserter/search-items.js.map +1 -1
- package/build/components/inserter/search-results.js +7 -3
- package/build/components/inserter/search-results.js.map +1 -1
- package/build/components/inserter/tabs.js +16 -2
- package/build/components/inserter/tabs.js.map +1 -1
- package/build/components/inserter-list-item/index.js +4 -1
- package/build/components/inserter-list-item/index.js.map +1 -1
- package/build/components/inspector-controls/groups.js +2 -0
- package/build/components/inspector-controls/groups.js.map +1 -1
- package/build/components/inspector-controls-tabs/advanced-controls-panel.js +46 -0
- package/build/components/inspector-controls-tabs/advanced-controls-panel.js.map +1 -0
- package/build/components/inspector-controls-tabs/index.js +71 -0
- package/build/components/inspector-controls-tabs/index.js.map +1 -0
- package/build/components/inspector-controls-tabs/settings-tab.js +28 -0
- package/build/components/inspector-controls-tabs/settings-tab.js.map +1 -0
- package/build/components/inspector-controls-tabs/styles-tab.js +61 -0
- package/build/components/inspector-controls-tabs/styles-tab.js.map +1 -0
- package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js +97 -0
- package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +1 -0
- package/build/components/inspector-controls-tabs/use-is-list-view-tab-disabled.js +18 -0
- package/build/components/inspector-controls-tabs/use-is-list-view-tab-disabled.js.map +1 -0
- package/build/components/inspector-controls-tabs/utils.js +37 -0
- package/build/components/inspector-controls-tabs/utils.js.map +1 -0
- package/build/components/link-control/index.js +1 -0
- package/build/components/link-control/index.js.map +1 -1
- package/build/components/link-control/search-input.js +0 -1
- package/build/components/link-control/search-input.js.map +1 -1
- package/build/components/link-control/use-internal-input-value.js +3 -3
- package/build/components/link-control/use-internal-input-value.js.map +1 -1
- package/build/components/list-view/block-select-button.js +1 -1
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/list-view/block.js +5 -2
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/branch.js +13 -12
- package/build/components/list-view/branch.js.map +1 -1
- package/build/components/media-upload/index.native.js +2 -3
- package/build/components/media-upload/index.native.js.map +1 -1
- package/build/components/off-canvas-editor/appender.js +99 -0
- package/build/components/off-canvas-editor/appender.js.map +1 -0
- package/build/components/off-canvas-editor/block-edit-button.js +50 -0
- package/build/components/off-canvas-editor/block-edit-button.js.map +1 -0
- package/build/components/off-canvas-editor/block-select-button.js +3 -2
- package/build/components/off-canvas-editor/block-select-button.js.map +1 -1
- package/build/components/off-canvas-editor/block.js +82 -38
- package/build/components/off-canvas-editor/block.js.map +1 -1
- package/build/components/off-canvas-editor/branch.js +3 -5
- package/build/components/off-canvas-editor/branch.js.map +1 -1
- package/build/components/off-canvas-editor/index.js +24 -11
- package/build/components/off-canvas-editor/index.js.map +1 -1
- package/build/components/off-canvas-editor/leaf.js +1 -1
- package/build/components/off-canvas-editor/leaf.js.map +1 -1
- package/build/components/off-canvas-editor/link-ui.js +185 -0
- package/build/components/off-canvas-editor/link-ui.js.map +1 -0
- package/build/components/off-canvas-editor/update-attributes.js +108 -0
- package/build/components/off-canvas-editor/update-attributes.js.map +1 -0
- package/build/components/off-canvas-editor/use-inserted-block.js +58 -0
- package/build/components/off-canvas-editor/use-inserted-block.js.map +1 -0
- package/build/components/responsive-block-control/label.js.map +1 -1
- package/build/components/rich-text/format-edit.js +12 -10
- package/build/components/rich-text/format-edit.js.map +1 -1
- package/build/components/rich-text/format-toolbar/index.js +8 -4
- package/build/components/rich-text/format-toolbar/index.js.map +1 -1
- package/build/components/rich-text/index.js +3 -3
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/index.native.js +0 -2
- package/build/components/rich-text/index.native.js.map +1 -1
- package/build/components/rich-text/use-insert-replacement-text.js +43 -0
- package/build/components/rich-text/use-insert-replacement-text.js.map +1 -0
- package/build/components/rich-text/use-paste-handler.js +21 -12
- package/build/components/rich-text/use-paste-handler.js.map +1 -1
- package/build/components/rich-text/use-undo-automatic-change.js +9 -1
- package/build/components/rich-text/use-undo-automatic-change.js.map +1 -1
- package/build/components/rich-text/utils.js +1 -19
- package/build/components/rich-text/utils.js.map +1 -1
- package/build/components/spacing-sizes-control/index.js +0 -1
- package/build/components/spacing-sizes-control/index.js.map +1 -1
- package/build/components/spacing-sizes-control/spacing-input-control.js +12 -3
- package/build/components/spacing-sizes-control/spacing-input-control.js.map +1 -1
- package/build/components/spacing-sizes-control/utils.js +1 -1
- package/build/components/spacing-sizes-control/utils.js.map +1 -1
- package/build/components/typewriter/index.js +1 -1
- package/build/components/typewriter/index.js.map +1 -1
- package/build/components/ungroup-button/index.native.js +4 -2
- package/build/components/ungroup-button/index.native.js.map +1 -1
- package/build/components/url-input/index.js +46 -43
- package/build/components/url-input/index.js.map +1 -1
- package/build/components/url-popover/image-url-input-ui.js +2 -2
- package/build/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build/components/use-block-display-information/index.js +8 -4
- package/build/components/use-block-display-information/index.js.map +1 -1
- package/build/components/use-setting/index.js +9 -1
- package/build/components/use-setting/index.js.map +1 -1
- package/build/components/writing-flow/index.js +1 -1
- package/build/components/writing-flow/index.js.map +1 -1
- package/build/hooks/border.js +0 -1
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/child-layout.js +209 -0
- package/build/hooks/child-layout.js.map +1 -0
- package/build/hooks/color-panel.js +0 -1
- package/build/hooks/color-panel.js.map +1 -1
- package/build/hooks/color.js +1 -2
- package/build/hooks/color.js.map +1 -1
- package/build/hooks/content-lock-ui.js +1 -1
- package/build/hooks/content-lock-ui.js.map +1 -1
- package/build/hooks/dimensions.js +25 -7
- package/build/hooks/dimensions.js.map +1 -1
- package/build/hooks/font-family.js +4 -4
- package/build/hooks/font-family.js.map +1 -1
- package/build/hooks/font-size.js +5 -3
- package/build/hooks/font-size.js.map +1 -1
- package/build/hooks/layout.js +57 -1
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/min-height.js +4 -10
- package/build/hooks/min-height.js.map +1 -1
- package/build/hooks/use-typography-props.js +11 -8
- package/build/hooks/use-typography-props.js.map +1 -1
- package/build/store/reducer.js +411 -274
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +58 -48
- package/build/store/selectors.js.map +1 -1
- package/build/utils/pasting.js +6 -11
- package/build/utils/pasting.js.map +1 -1
- package/build/utils/sorting.js +63 -0
- package/build/utils/sorting.js.map +1 -0
- package/build-module/autocompleters/block.js +2 -6
- package/build-module/autocompleters/block.js.map +1 -1
- package/build-module/autocompleters/link.js +2 -0
- package/build-module/autocompleters/link.js.map +1 -1
- package/build-module/components/alignment-control/ui.js +1 -6
- package/build-module/components/alignment-control/ui.js.map +1 -1
- package/build-module/components/block-alignment-control/use-available-alignments.js +4 -3
- package/build-module/components/block-alignment-control/use-available-alignments.js.map +1 -1
- package/build-module/components/block-card/index.js +45 -3
- package/build-module/components/block-card/index.js.map +1 -1
- package/build-module/components/block-draggable/index.native.js +40 -31
- package/build-module/components/block-draggable/index.native.js.map +1 -1
- package/build-module/components/block-edit/edit.js +4 -2
- package/build-module/components/block-edit/edit.js.map +1 -1
- package/build-module/components/block-edit/edit.native.js +4 -6
- package/build-module/components/block-edit/edit.native.js.map +1 -1
- package/build-module/components/block-icon/index.js +4 -2
- package/build-module/components/block-icon/index.js.map +1 -1
- package/build-module/components/block-inspector/index.js +87 -34
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list/block-list-context.native.js +5 -8
- package/build-module/components/block-list/block-list-context.native.js.map +1 -1
- package/build-module/components/block-list/block.js +55 -25
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/block.native.js +61 -28
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-list-appender/index.js +46 -34
- package/build-module/components/block-list-appender/index.js.map +1 -1
- package/build-module/components/block-list-appender/index.native.js +39 -32
- package/build-module/components/block-list-appender/index.native.js.map +1 -1
- package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js +31 -24
- package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
- package/build-module/components/block-mobile-toolbar/index.native.js +1 -1
- package/build-module/components/block-mobile-toolbar/index.native.js.map +1 -1
- package/build-module/components/block-pattern-setup/index.js +16 -8
- package/build-module/components/block-pattern-setup/index.js.map +1 -1
- package/build-module/components/block-patterns-list/index.js +35 -13
- package/build-module/components/block-patterns-list/index.js.map +1 -1
- package/build-module/components/block-preview/auto.js +9 -3
- package/build-module/components/block-preview/auto.js.map +1 -1
- package/build-module/components/block-preview/index.js +5 -8
- package/build-module/components/block-preview/index.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +5 -2
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-styles/index.native.js +1 -2
- package/build-module/components/block-styles/index.native.js.map +1 -1
- package/build-module/components/block-styles/utils.js +7 -9
- package/build-module/components/block-styles/utils.js.map +1 -1
- package/build-module/components/block-toolbar/index.js +6 -2
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-toolbar/index.native.js +6 -8
- package/build-module/components/block-toolbar/index.native.js.map +1 -1
- package/build-module/components/block-tools/insertion-point.js +8 -49
- package/build-module/components/block-tools/insertion-point.js.map +1 -1
- package/build-module/components/block-tools/selected-block-popover.js +1 -2
- package/build-module/components/block-tools/selected-block-popover.js.map +1 -1
- package/build-module/components/block-variation-picker/index.js +2 -3
- package/build-module/components/block-variation-picker/index.js.map +1 -1
- package/build-module/components/colors/utils.js +3 -7
- package/build-module/components/colors/utils.js.map +1 -1
- package/build-module/components/colors-gradients/control.js +0 -3
- package/build-module/components/colors-gradients/control.js.map +1 -1
- package/build-module/components/colors-gradients/dropdown.js +0 -2
- package/build-module/components/colors-gradients/dropdown.js.map +1 -1
- package/build-module/components/colors-gradients/panel-color-gradient-settings.js +4 -19
- package/build-module/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
- package/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +4 -2
- package/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js.map +1 -1
- package/build-module/components/copy-handler/index.js +38 -10
- package/build-module/components/copy-handler/index.js.map +1 -1
- package/build-module/components/font-sizes/fluid-utils.js +5 -2
- package/build-module/components/font-sizes/fluid-utils.js.map +1 -1
- package/build-module/components/font-sizes/utils.js +11 -5
- package/build-module/components/font-sizes/utils.js.map +1 -1
- package/build-module/components/font-sizes/with-font-sizes.js +12 -7
- package/build-module/components/font-sizes/with-font-sizes.js.map +1 -1
- package/build-module/components/gradients/use-gradient.js +2 -7
- package/build-module/components/gradients/use-gradient.js.map +1 -1
- package/build-module/components/height-control/index.js +103 -0
- package/build-module/components/height-control/index.js.map +1 -0
- package/build-module/components/iframe/index.js +21 -101
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/iframe/use-compatibility-styles.js +85 -0
- package/build-module/components/iframe/use-compatibility-styles.js.map +1 -0
- package/build-module/components/image-editor/use-save-image.js +2 -0
- package/build-module/components/image-editor/use-save-image.js.map +1 -1
- package/build-module/components/image-editor/zoom-dropdown.js +1 -0
- package/build-module/components/image-editor/zoom-dropdown.js.map +1 -1
- package/build-module/components/index.js +1 -0
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/inner-blocks/index.js +27 -9
- package/build-module/components/inner-blocks/index.js.map +1 -1
- package/build-module/components/inner-blocks/use-inner-block-template-sync.js +23 -10
- package/build-module/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
- package/build-module/components/inserter/block-patterns-explorer/sidebar.js +1 -0
- package/build-module/components/inserter/block-patterns-explorer/sidebar.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab.js +27 -49
- package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
- package/build-module/components/inserter/block-types-tab.js +3 -2
- package/build-module/components/inserter/block-types-tab.js.map +1 -1
- package/build-module/components/inserter/hooks/use-debounced-input.js +18 -0
- package/build-module/components/inserter/hooks/use-debounced-input.js.map +1 -0
- package/build-module/components/inserter/hooks/use-insertion-point.js +4 -3
- package/build-module/components/inserter/hooks/use-insertion-point.js.map +1 -1
- package/build-module/components/inserter/index.js +20 -6
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/inserter/index.native.js +3 -5
- package/build-module/components/inserter/index.native.js.map +1 -1
- package/build-module/components/inserter/media-tab/hooks.js +92 -0
- package/build-module/components/inserter/media-tab/hooks.js.map +1 -0
- package/build-module/components/inserter/media-tab/index.js +4 -0
- package/build-module/components/inserter/media-tab/index.js.map +1 -0
- package/build-module/components/inserter/media-tab/media-list.js +86 -0
- package/build-module/components/inserter/media-tab/media-list.js.map +1 -0
- package/build-module/components/inserter/media-tab/media-panel.js +77 -0
- package/build-module/components/inserter/media-tab/media-panel.js.map +1 -0
- package/build-module/components/inserter/media-tab/media-tab.js +100 -0
- package/build-module/components/inserter/media-tab/media-tab.js.map +1 -0
- package/build-module/components/inserter/media-tab/utils.js +45 -0
- package/build-module/components/inserter/media-tab/utils.js.map +1 -0
- package/build-module/components/inserter/menu.js +33 -12
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/mobile-tab-navigation.js +61 -0
- package/build-module/components/inserter/mobile-tab-navigation.js.map +1 -0
- package/build-module/components/inserter/quick-inserter.js +7 -3
- package/build-module/components/inserter/quick-inserter.js.map +1 -1
- package/build-module/components/inserter/search-items.js +15 -13
- package/build-module/components/inserter/search-items.js.map +1 -1
- package/build-module/components/inserter/search-results.js +7 -4
- package/build-module/components/inserter/search-results.js.map +1 -1
- package/build-module/components/inserter/tabs.js +15 -2
- package/build-module/components/inserter/tabs.js.map +1 -1
- package/build-module/components/inserter-list-item/index.js +5 -2
- package/build-module/components/inserter-list-item/index.js.map +1 -1
- package/build-module/components/inspector-controls/groups.js +2 -0
- package/build-module/components/inspector-controls/groups.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/advanced-controls-panel.js +32 -0
- package/build-module/components/inspector-controls-tabs/advanced-controls-panel.js.map +1 -0
- package/build-module/components/inspector-controls-tabs/index.js +56 -0
- package/build-module/components/inspector-controls-tabs/index.js.map +1 -0
- package/build-module/components/inspector-controls-tabs/settings-tab.js +17 -0
- package/build-module/components/inspector-controls-tabs/settings-tab.js.map +1 -0
- package/build-module/components/inspector-controls-tabs/styles-tab.js +46 -0
- package/build-module/components/inspector-controls-tabs/styles-tab.js.map +1 -0
- package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js +81 -0
- package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +1 -0
- package/build-module/components/inspector-controls-tabs/use-is-list-view-tab-disabled.js +8 -0
- package/build-module/components/inspector-controls-tabs/use-is-list-view-tab-disabled.js.map +1 -0
- package/build-module/components/inspector-controls-tabs/utils.js +26 -0
- package/build-module/components/inspector-controls-tabs/utils.js.map +1 -0
- package/build-module/components/link-control/index.js +1 -0
- package/build-module/components/link-control/index.js.map +1 -1
- package/build-module/components/link-control/search-input.js +0 -1
- package/build-module/components/link-control/search-input.js.map +1 -1
- package/build-module/components/link-control/use-internal-input-value.js +3 -3
- package/build-module/components/link-control/use-internal-input-value.js.map +1 -1
- package/build-module/components/list-view/block-select-button.js +1 -1
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/list-view/block.js +5 -2
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/branch.js +12 -11
- package/build-module/components/list-view/branch.js.map +1 -1
- package/build-module/components/media-upload/index.native.js +2 -4
- package/build-module/components/media-upload/index.native.js.map +1 -1
- package/build-module/components/off-canvas-editor/appender.js +83 -0
- package/build-module/components/off-canvas-editor/appender.js.map +1 -0
- package/build-module/components/off-canvas-editor/block-edit-button.js +35 -0
- package/build-module/components/off-canvas-editor/block-edit-button.js.map +1 -0
- package/build-module/components/off-canvas-editor/block-select-button.js +3 -2
- package/build-module/components/off-canvas-editor/block-select-button.js.map +1 -1
- package/build-module/components/off-canvas-editor/block.js +83 -41
- package/build-module/components/off-canvas-editor/block.js.map +1 -1
- package/build-module/components/off-canvas-editor/branch.js +3 -4
- package/build-module/components/off-canvas-editor/branch.js.map +1 -1
- package/build-module/components/off-canvas-editor/index.js +24 -12
- package/build-module/components/off-canvas-editor/index.js.map +1 -1
- package/build-module/components/off-canvas-editor/leaf.js +1 -1
- package/build-module/components/off-canvas-editor/leaf.js.map +1 -1
- package/build-module/components/off-canvas-editor/link-ui.js +165 -0
- package/build-module/components/off-canvas-editor/link-ui.js.map +1 -0
- package/build-module/components/off-canvas-editor/update-attributes.js +97 -0
- package/build-module/components/off-canvas-editor/update-attributes.js.map +1 -0
- package/build-module/components/off-canvas-editor/use-inserted-block.js +47 -0
- package/build-module/components/off-canvas-editor/use-inserted-block.js.map +1 -0
- package/build-module/components/responsive-block-control/label.js +1 -2
- package/build-module/components/responsive-block-control/label.js.map +1 -1
- package/build-module/components/rich-text/format-edit.js +12 -9
- package/build-module/components/rich-text/format-edit.js.map +1 -1
- package/build-module/components/rich-text/format-toolbar/index.js +6 -2
- package/build-module/components/rich-text/format-toolbar/index.js.map +1 -1
- package/build-module/components/rich-text/index.js +2 -3
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/index.native.js +0 -2
- package/build-module/components/rich-text/index.native.js.map +1 -1
- package/build-module/components/rich-text/use-insert-replacement-text.js +33 -0
- package/build-module/components/rich-text/use-insert-replacement-text.js.map +1 -0
- package/build-module/components/rich-text/use-paste-handler.js +22 -12
- package/build-module/components/rich-text/use-paste-handler.js.map +1 -1
- package/build-module/components/rich-text/use-undo-automatic-change.js +9 -1
- package/build-module/components/rich-text/use-undo-automatic-change.js.map +1 -1
- package/build-module/components/rich-text/utils.js +1 -16
- package/build-module/components/rich-text/utils.js.map +1 -1
- package/build-module/components/spacing-sizes-control/index.js +0 -1
- package/build-module/components/spacing-sizes-control/index.js.map +1 -1
- package/build-module/components/spacing-sizes-control/spacing-input-control.js +12 -3
- package/build-module/components/spacing-sizes-control/spacing-input-control.js.map +1 -1
- package/build-module/components/spacing-sizes-control/utils.js +1 -1
- package/build-module/components/spacing-sizes-control/utils.js.map +1 -1
- package/build-module/components/typewriter/index.js +1 -1
- package/build-module/components/typewriter/index.js.map +1 -1
- package/build-module/components/ungroup-button/index.native.js +3 -2
- package/build-module/components/ungroup-button/index.native.js.map +1 -1
- package/build-module/components/url-input/index.js +46 -43
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/components/url-popover/image-url-input-ui.js +3 -3
- package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build-module/components/use-block-display-information/index.js +9 -5
- package/build-module/components/use-block-display-information/index.js.map +1 -1
- package/build-module/components/use-setting/index.js +8 -1
- package/build-module/components/use-setting/index.js.map +1 -1
- package/build-module/components/writing-flow/index.js +1 -1
- package/build-module/components/writing-flow/index.js.map +1 -1
- package/build-module/hooks/border.js +0 -1
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/child-layout.js +189 -0
- package/build-module/hooks/child-layout.js.map +1 -0
- package/build-module/hooks/color-panel.js +0 -1
- package/build-module/hooks/color-panel.js.map +1 -1
- package/build-module/hooks/color.js +1 -2
- package/build-module/hooks/color.js.map +1 -1
- package/build-module/hooks/content-lock-ui.js +1 -1
- package/build-module/hooks/content-lock-ui.js.map +1 -1
- package/build-module/hooks/dimensions.js +25 -8
- package/build-module/hooks/dimensions.js.map +1 -1
- package/build-module/hooks/font-family.js +5 -5
- package/build-module/hooks/font-family.js.map +1 -1
- package/build-module/hooks/font-size.js +5 -3
- package/build-module/hooks/font-size.js.map +1 -1
- package/build-module/hooks/layout.js +55 -0
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/hooks/min-height.js +3 -9
- package/build-module/hooks/min-height.js.map +1 -1
- package/build-module/hooks/use-typography-props.js +11 -8
- package/build-module/hooks/use-typography-props.js.map +1 -1
- package/build-module/store/reducer.js +409 -274
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +55 -48
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/pasting.js +6 -10
- package/build-module/utils/pasting.js.map +1 -1
- package/build-module/utils/sorting.js +56 -0
- package/build-module/utils/sorting.js.map +1 -0
- package/build-style/content-rtl.css +701 -0
- package/build-style/content.css +701 -0
- package/build-style/default-editor-styles-rtl.css +17 -3
- package/build-style/default-editor-styles.css +17 -3
- package/build-style/style-rtl.css +313 -665
- package/build-style/style.css +313 -665
- package/package.json +32 -30
- package/src/autocompleters/block.js +2 -6
- package/src/autocompleters/link.js +2 -0
- package/src/components/alignment-control/test/index.js +6 -1
- package/src/components/alignment-control/ui.js +1 -7
- package/src/components/block-alignment-control/test/index.js +6 -1
- package/src/components/block-alignment-control/use-available-alignments.js +4 -3
- package/src/components/block-card/index.js +46 -2
- package/src/components/block-card/style.scss +4 -0
- package/src/components/block-content-overlay/{style.scss → content.scss} +7 -1
- package/src/components/block-draggable/content.scss +20 -0
- package/src/components/block-draggable/index.native.js +54 -40
- package/src/components/block-draggable/style.scss +0 -21
- package/src/components/block-draggable/test/helpers.native.js +7 -9
- package/src/components/block-draggable/test/index.native.js +35 -45
- package/src/components/block-edit/edit.js +5 -2
- package/src/components/block-edit/edit.native.js +5 -6
- package/src/components/block-icon/index.js +4 -2
- package/src/components/block-icon/test/index.js +9 -5
- package/src/components/block-inspector/index.js +173 -85
- package/src/components/block-inspector/style.scss +16 -1
- package/src/components/block-list/block-list-context.native.js +5 -8
- package/src/components/block-list/block.js +74 -23
- package/src/components/block-list/block.native.js +78 -23
- package/src/components/block-list/{style.scss → content.scss} +1 -15
- package/src/components/block-list-appender/{style.scss → content.scss} +0 -0
- package/src/components/block-list-appender/index.js +65 -54
- package/src/components/block-list-appender/index.native.js +45 -34
- package/src/components/block-mobile-toolbar/block-actions-menu.native.js +42 -28
- package/src/components/block-mobile-toolbar/index.native.js +1 -1
- package/src/components/block-mobile-toolbar/test/__snapshots__/block-actions-menu.native.js.snap +125 -0
- package/src/components/block-mobile-toolbar/test/block-actions-menu.native.js +439 -0
- package/src/components/block-mover/test/__snapshots__/index.native.js.snap +42 -2
- package/src/components/block-mover/test/index.native.js +157 -1
- package/src/components/block-pattern-setup/index.js +17 -7
- package/src/components/block-pattern-setup/style.scss +29 -1
- package/src/components/block-patterns-list/index.js +47 -24
- package/src/components/block-preview/README.md +15 -10
- package/src/components/block-preview/auto.js +7 -1
- package/src/components/block-preview/content.scss +4 -0
- package/src/components/block-preview/index.js +7 -12
- package/src/components/block-preview/style.scss +0 -7
- package/src/components/block-preview/test/index.js +18 -35
- package/src/components/block-selection-clearer/test/index.js +12 -12
- package/src/components/block-settings-menu/block-settings-dropdown.js +32 -20
- package/src/components/block-styles/index.native.js +1 -2
- package/src/components/block-styles/utils.js +5 -7
- package/src/components/block-switcher/test/index.js +6 -1
- package/src/components/block-toolbar/index.js +12 -5
- package/src/components/block-toolbar/index.native.js +8 -11
- package/src/components/block-toolbar/style.scss +10 -0
- package/src/components/block-tools/insertion-point.js +3 -47
- package/src/components/block-tools/selected-block-popover.js +1 -3
- package/src/components/block-tools/style.scss +12 -5
- package/src/components/block-variation-picker/index.js +6 -5
- package/src/components/block-vertical-alignment-control/test/index.js +6 -1
- package/src/components/colors/test/with-colors.js +2 -0
- package/src/components/colors/utils.js +5 -3
- package/src/components/colors-gradients/control.js +0 -7
- package/src/components/colors-gradients/dropdown.js +0 -2
- package/src/components/colors-gradients/panel-color-gradient-settings.js +4 -22
- package/src/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +4 -2
- package/src/components/copy-handler/index.js +53 -7
- package/src/components/default-block-appender/{style.scss → content.scss} +0 -0
- package/src/components/default-block-appender/test/index.js +2 -0
- package/src/components/font-sizes/fluid-utils.js +7 -1
- package/src/components/font-sizes/utils.js +5 -3
- package/src/components/font-sizes/with-font-sizes.js +4 -4
- package/src/components/gradients/use-gradient.js +2 -7
- package/src/components/height-control/index.js +123 -0
- package/src/components/height-control/stories/index.js +21 -0
- package/src/components/height-control/style.scss +5 -0
- package/src/components/iframe/index.js +33 -121
- package/src/components/iframe/use-compatibility-styles.js +95 -0
- package/src/components/image-editor/use-save-image.js +2 -0
- package/src/components/image-editor/zoom-dropdown.js +1 -0
- package/src/components/image-size-control/test/index.js +147 -79
- package/src/components/index.js +1 -0
- package/src/components/inner-blocks/{style.scss → content.scss} +0 -0
- package/src/components/inner-blocks/index.js +26 -7
- package/src/components/inner-blocks/use-inner-block-template-sync.js +28 -10
- package/src/components/inserter/block-patterns-explorer/sidebar.js +1 -0
- package/src/components/inserter/block-patterns-tab.js +28 -71
- package/src/components/inserter/block-types-tab.js +3 -2
- package/src/components/inserter/hooks/use-debounced-input.js +17 -0
- package/src/components/inserter/hooks/use-insertion-point.js +3 -2
- package/src/components/inserter/index.js +24 -3
- package/src/components/inserter/index.native.js +1 -1
- package/src/components/inserter/media-tab/hooks.js +89 -0
- package/src/components/inserter/media-tab/index.js +3 -0
- package/src/components/inserter/media-tab/media-list.js +93 -0
- package/src/components/inserter/media-tab/media-panel.js +83 -0
- package/src/components/inserter/media-tab/media-tab.js +135 -0
- package/src/components/inserter/media-tab/utils.js +37 -0
- package/src/components/inserter/menu.js +55 -13
- package/src/components/inserter/mobile-tab-navigation.js +85 -0
- package/src/components/inserter/quick-inserter.js +4 -0
- package/src/components/inserter/search-items.js +1 -2
- package/src/components/inserter/search-results.js +5 -2
- package/src/components/inserter/stories/index.js +1 -1
- package/src/components/inserter/stories/{fixtures.js → utils/fixtures.js} +0 -0
- package/src/components/inserter/style.scss +176 -11
- package/src/components/inserter/tabs.js +12 -1
- package/src/components/inserter-list-item/index.js +11 -1
- package/src/components/inserter-list-item/style.scss +26 -0
- package/src/components/inspector-controls/groups.js +2 -0
- package/src/components/inspector-controls-tabs/advanced-controls-panel.js +37 -0
- package/src/components/inspector-controls-tabs/index.js +62 -0
- package/src/components/inspector-controls-tabs/settings-tab.js +18 -0
- package/src/components/inspector-controls-tabs/styles-tab.js +51 -0
- package/src/components/inspector-controls-tabs/use-inspector-controls-tabs.js +89 -0
- package/src/components/inspector-controls-tabs/use-is-list-view-tab-disabled.js +9 -0
- package/src/components/inspector-controls-tabs/utils.js +28 -0
- package/src/components/line-height-control/test/index.js +5 -5
- package/src/components/link-control/README.md +1 -1
- package/src/components/link-control/index.js +1 -0
- package/src/components/link-control/search-input.js +0 -1
- package/src/components/link-control/test/index.js +204 -403
- package/src/components/link-control/use-internal-input-value.js +3 -3
- package/src/components/list-view/block-select-button.js +1 -1
- package/src/components/list-view/block.js +3 -0
- package/src/components/list-view/branch.js +10 -8
- package/src/components/list-view/style.scss +21 -16
- package/src/components/media-placeholder/{style.scss → content.scss} +0 -0
- package/src/components/media-replace-flow/test/index.js +39 -9
- package/src/components/media-upload/test/index.native.js +2 -0
- package/src/components/off-canvas-editor/appender.js +98 -0
- package/src/components/off-canvas-editor/block-edit-button.js +27 -0
- package/src/components/off-canvas-editor/block-select-button.js +6 -2
- package/src/components/off-canvas-editor/block.js +160 -77
- package/src/components/off-canvas-editor/branch.js +3 -5
- package/src/components/off-canvas-editor/index.js +68 -33
- package/src/components/off-canvas-editor/leaf.js +5 -1
- package/src/components/off-canvas-editor/link-ui.js +166 -0
- package/src/components/off-canvas-editor/style.scss +19 -386
- package/src/components/off-canvas-editor/test/use-inserted-block.js +108 -0
- package/src/components/off-canvas-editor/update-attributes.js +99 -0
- package/src/components/off-canvas-editor/use-inserted-block.js +47 -0
- package/src/components/plain-text/{style.scss → content.scss} +0 -0
- package/src/components/recursion-provider/test/index.js +27 -29
- package/src/components/responsive-block-control/label.js +2 -3
- package/src/components/responsive-block-control/test/index.js +4 -2
- package/src/components/rich-text/content.scss +42 -0
- package/src/components/rich-text/format-edit.js +6 -10
- package/src/components/rich-text/format-toolbar/index.js +6 -4
- package/src/components/rich-text/index.js +3 -2
- package/src/components/rich-text/index.native.js +0 -2
- package/src/components/rich-text/style.scss +0 -43
- package/src/components/rich-text/use-insert-replacement-text.js +31 -0
- package/src/components/rich-text/use-paste-handler.js +33 -14
- package/src/components/rich-text/use-undo-automatic-change.js +7 -1
- package/src/components/rich-text/utils.js +2 -21
- package/src/components/spacing-sizes-control/index.js +0 -1
- package/src/components/spacing-sizes-control/spacing-input-control.js +9 -0
- package/src/components/spacing-sizes-control/utils.js +1 -1
- package/src/components/typewriter/index.js +3 -1
- package/src/components/ungroup-button/index.native.js +6 -2
- package/src/components/url-input/index.js +57 -73
- package/src/components/url-input/test/button.js +2 -0
- package/src/components/url-popover/image-url-input-ui.js +5 -4
- package/src/components/url-popover/test/__snapshots__/index.js.snap +8 -6
- package/src/components/url-popover/test/index.js +37 -9
- package/src/components/use-block-display-information/index.js +14 -5
- package/src/components/use-setting/index.js +13 -1
- package/src/components/use-setting/test/index.js +99 -0
- package/src/components/warning/test/index.js +2 -0
- package/src/components/writing-flow/index.js +1 -1
- package/src/content.scss +10 -0
- package/src/hooks/border.js +0 -1
- package/src/hooks/child-layout.js +190 -0
- package/src/hooks/color-panel.js +0 -1
- package/src/hooks/color.js +0 -2
- package/src/hooks/content-lock-ui.js +1 -1
- package/src/hooks/dimensions.js +45 -7
- package/src/hooks/font-family.js +3 -5
- package/src/hooks/font-size.js +13 -4
- package/src/hooks/layout.js +60 -0
- package/src/hooks/min-height.js +2 -19
- package/src/hooks/test/use-typography-props.js +26 -0
- package/src/hooks/use-typography-props.js +15 -7
- package/src/store/reducer.js +471 -428
- package/src/store/selectors.js +57 -59
- package/src/store/test/performance.js +71 -0
- package/src/store/test/reducer.js +623 -491
- package/src/store/test/selectors.js +1820 -1306
- package/src/style.scss +4 -7
- package/src/utils/pasting.js +3 -9
- package/src/utils/sorting.js +54 -0
- package/src/utils/test/sorting.js +49 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/build/components/block-preview/live.js +0 -30
- package/build/components/block-preview/live.js.map +0 -1
- package/build/components/colors-gradients/use-common-single-multiple-selects.js +0 -21
- package/build/components/colors-gradients/use-common-single-multiple-selects.js.map +0 -1
- package/build/components/rich-text/file-paste-handler.js +0 -21
- package/build/components/rich-text/file-paste-handler.js.map +0 -1
- package/build-module/components/block-preview/live.js +0 -20
- package/build-module/components/block-preview/live.js.map +0 -1
- package/build-module/components/colors-gradients/use-common-single-multiple-selects.js +0 -11
- package/build-module/components/colors-gradients/use-common-single-multiple-selects.js.map +0 -1
- package/build-module/components/rich-text/file-paste-handler.js +0 -13
- package/build-module/components/rich-text/file-paste-handler.js.map +0 -1
- package/src/components/block-preview/live.js +0 -19
- package/src/components/colors-gradients/use-common-single-multiple-selects.js +0 -11
- package/src/components/rich-text/file-paste-handler.js +0 -13
|
@@ -8,20 +8,16 @@ import {
|
|
|
8
8
|
useRef,
|
|
9
9
|
useEffect,
|
|
10
10
|
} from '@wordpress/element';
|
|
11
|
-
import { _x, __
|
|
11
|
+
import { _x, __ } from '@wordpress/i18n';
|
|
12
12
|
import { useAsyncList, useViewportMatch } from '@wordpress/compose';
|
|
13
13
|
import {
|
|
14
14
|
__experimentalItemGroup as ItemGroup,
|
|
15
15
|
__experimentalItem as Item,
|
|
16
16
|
__experimentalHStack as HStack,
|
|
17
|
-
__experimentalNavigatorProvider as NavigatorProvider,
|
|
18
|
-
__experimentalNavigatorScreen as NavigatorScreen,
|
|
19
|
-
__experimentalNavigatorButton as NavigatorButton,
|
|
20
|
-
__experimentalNavigatorBackButton as NavigatorBackButton,
|
|
21
17
|
FlexBlock,
|
|
22
18
|
Button,
|
|
23
19
|
} from '@wordpress/components';
|
|
24
|
-
import { Icon, chevronRight
|
|
20
|
+
import { Icon, chevronRight } from '@wordpress/icons';
|
|
25
21
|
import { focus } from '@wordpress/dom';
|
|
26
22
|
|
|
27
23
|
/**
|
|
@@ -30,6 +26,7 @@ import { focus } from '@wordpress/dom';
|
|
|
30
26
|
import usePatternsState from './hooks/use-patterns-state';
|
|
31
27
|
import BlockPatternList from '../block-patterns-list';
|
|
32
28
|
import PatternsExplorerModal from './block-patterns-explorer/explorer';
|
|
29
|
+
import MobileTabNavigation from './mobile-tab-navigation';
|
|
33
30
|
|
|
34
31
|
function usePatternsCategories() {
|
|
35
32
|
const [ allPatterns, allCategories ] = usePatternsState();
|
|
@@ -56,10 +53,17 @@ function usePatternsCategories() {
|
|
|
56
53
|
)
|
|
57
54
|
)
|
|
58
55
|
.sort( ( { name: currentName }, { name: nextName } ) => {
|
|
59
|
-
if (
|
|
56
|
+
if (
|
|
57
|
+
! [ currentName, nextName ].some( ( categoryName ) =>
|
|
58
|
+
[ 'featured', 'text' ].includes( categoryName )
|
|
59
|
+
)
|
|
60
|
+
) {
|
|
60
61
|
return 0;
|
|
61
62
|
}
|
|
62
|
-
|
|
63
|
+
// Move `featured` category to the top and `text` to the bottom.
|
|
64
|
+
return currentName === 'featured' || nextName === 'text'
|
|
65
|
+
? -1
|
|
66
|
+
: 1;
|
|
63
67
|
} );
|
|
64
68
|
|
|
65
69
|
if (
|
|
@@ -86,6 +90,7 @@ export function BlockPatternsCategoryDialog( {
|
|
|
86
90
|
rootClientId,
|
|
87
91
|
onInsert,
|
|
88
92
|
category,
|
|
93
|
+
showTitlesAsTooltip,
|
|
89
94
|
} ) {
|
|
90
95
|
const container = useRef();
|
|
91
96
|
|
|
@@ -100,12 +105,13 @@ export function BlockPatternsCategoryDialog( {
|
|
|
100
105
|
return (
|
|
101
106
|
<div
|
|
102
107
|
ref={ container }
|
|
103
|
-
className="block-editor-inserter__patterns-category-
|
|
108
|
+
className="block-editor-inserter__patterns-category-dialog"
|
|
104
109
|
>
|
|
105
110
|
<BlockPatternsCategoryPanel
|
|
106
111
|
rootClientId={ rootClientId }
|
|
107
112
|
onInsert={ onInsert }
|
|
108
113
|
category={ category }
|
|
114
|
+
showTitlesAsTooltip={ showTitlesAsTooltip }
|
|
109
115
|
/>
|
|
110
116
|
</div>
|
|
111
117
|
);
|
|
@@ -115,6 +121,7 @@ export function BlockPatternsCategoryPanel( {
|
|
|
115
121
|
rootClientId,
|
|
116
122
|
onInsert,
|
|
117
123
|
category,
|
|
124
|
+
showTitlesAsTooltip,
|
|
118
125
|
} ) {
|
|
119
126
|
const [ allPatterns, , onClick ] = usePatternsState(
|
|
120
127
|
onInsert,
|
|
@@ -151,7 +158,7 @@ export function BlockPatternsCategoryPanel( {
|
|
|
151
158
|
}
|
|
152
159
|
|
|
153
160
|
return (
|
|
154
|
-
<div>
|
|
161
|
+
<div className="block-editor-inserter__patterns-category-panel">
|
|
155
162
|
<div className="block-editor-inserter__patterns-category-panel-title">
|
|
156
163
|
{ category.label }
|
|
157
164
|
</div>
|
|
@@ -164,6 +171,7 @@ export function BlockPatternsCategoryPanel( {
|
|
|
164
171
|
orientation="vertical"
|
|
165
172
|
category={ category.label }
|
|
166
173
|
isDraggable
|
|
174
|
+
showTitlesAsTooltip={ showTitlesAsTooltip }
|
|
167
175
|
/>
|
|
168
176
|
</div>
|
|
169
177
|
);
|
|
@@ -178,7 +186,6 @@ function BlockPatternsTabs( {
|
|
|
178
186
|
const [ showPatternsExplorer, setShowPatternsExplorer ] = useState( false );
|
|
179
187
|
const categories = usePatternsCategories();
|
|
180
188
|
const isMobile = useViewportMatch( 'medium', '<' );
|
|
181
|
-
|
|
182
189
|
return (
|
|
183
190
|
<>
|
|
184
191
|
{ ! isMobile && (
|
|
@@ -215,12 +222,6 @@ function BlockPatternsTabs( {
|
|
|
215
222
|
</HStack>
|
|
216
223
|
</Item>
|
|
217
224
|
) ) }
|
|
218
|
-
|
|
219
|
-
<div
|
|
220
|
-
role="presentation"
|
|
221
|
-
className="block-editor-inserter__patterns-fill-space"
|
|
222
|
-
/>
|
|
223
|
-
|
|
224
225
|
<div role="listitem">
|
|
225
226
|
<Button
|
|
226
227
|
className="block-editor-inserter__patterns-explore-button"
|
|
@@ -237,10 +238,16 @@ function BlockPatternsTabs( {
|
|
|
237
238
|
</div>
|
|
238
239
|
) }
|
|
239
240
|
{ isMobile && (
|
|
240
|
-
<
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
241
|
+
<MobileTabNavigation categories={ categories }>
|
|
242
|
+
{ ( category ) => (
|
|
243
|
+
<BlockPatternsCategoryPanel
|
|
244
|
+
onInsert={ onInsert }
|
|
245
|
+
rootClientId={ rootClientId }
|
|
246
|
+
category={ category }
|
|
247
|
+
showTitlesAsTooltip={ false }
|
|
248
|
+
/>
|
|
249
|
+
) }
|
|
250
|
+
</MobileTabNavigation>
|
|
244
251
|
) }
|
|
245
252
|
{ showPatternsExplorer && (
|
|
246
253
|
<PatternsExplorerModal
|
|
@@ -253,54 +260,4 @@ function BlockPatternsTabs( {
|
|
|
253
260
|
);
|
|
254
261
|
}
|
|
255
262
|
|
|
256
|
-
function BlockPatternsTabNavigation( { onInsert, rootClientId } ) {
|
|
257
|
-
const categories = usePatternsCategories();
|
|
258
|
-
|
|
259
|
-
return (
|
|
260
|
-
<NavigatorProvider initialPath="/">
|
|
261
|
-
<NavigatorScreen path="/">
|
|
262
|
-
<ItemGroup>
|
|
263
|
-
{ categories.map( ( category ) => (
|
|
264
|
-
<NavigatorButton
|
|
265
|
-
key={ category.name }
|
|
266
|
-
path={ `/category/${ category.name }` }
|
|
267
|
-
as={ Item }
|
|
268
|
-
isAction
|
|
269
|
-
>
|
|
270
|
-
<HStack>
|
|
271
|
-
<FlexBlock>{ category.label }</FlexBlock>
|
|
272
|
-
<Icon
|
|
273
|
-
icon={
|
|
274
|
-
isRTL() ? chevronLeft : chevronRight
|
|
275
|
-
}
|
|
276
|
-
/>
|
|
277
|
-
</HStack>
|
|
278
|
-
</NavigatorButton>
|
|
279
|
-
) ) }
|
|
280
|
-
</ItemGroup>
|
|
281
|
-
</NavigatorScreen>
|
|
282
|
-
|
|
283
|
-
{ categories.map( ( category ) => (
|
|
284
|
-
<NavigatorScreen
|
|
285
|
-
key={ category.name }
|
|
286
|
-
path={ `/category/${ category.name }` }
|
|
287
|
-
>
|
|
288
|
-
<NavigatorBackButton
|
|
289
|
-
icon={ isRTL() ? chevronRight : chevronLeft }
|
|
290
|
-
isSmall
|
|
291
|
-
aria-label={ __( 'Navigate to the categories list' ) }
|
|
292
|
-
>
|
|
293
|
-
{ __( 'Back' ) }
|
|
294
|
-
</NavigatorBackButton>
|
|
295
|
-
<BlockPatternsCategoryPanel
|
|
296
|
-
category={ category }
|
|
297
|
-
rootClientId={ rootClientId }
|
|
298
|
-
onInsert={ onInsert }
|
|
299
|
-
/>
|
|
300
|
-
</NavigatorScreen>
|
|
301
|
-
) ) }
|
|
302
|
-
</NavigatorProvider>
|
|
303
|
-
);
|
|
304
|
-
}
|
|
305
|
-
|
|
306
263
|
export default BlockPatternsTabs;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { map, groupBy
|
|
4
|
+
import { map, groupBy } from 'lodash';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
@@ -17,6 +17,7 @@ import BlockTypesList from '../block-types-list';
|
|
|
17
17
|
import InserterPanel from './panel';
|
|
18
18
|
import useBlockTypesState from './hooks/use-block-types-state';
|
|
19
19
|
import InserterListbox from '../inserter-listbox';
|
|
20
|
+
import { orderBy } from '../../utils/sorting';
|
|
20
21
|
|
|
21
22
|
const getBlockNamespace = ( item ) => item.name.split( '/' )[ 0 ];
|
|
22
23
|
|
|
@@ -42,7 +43,7 @@ export function BlockTypesTab( {
|
|
|
42
43
|
);
|
|
43
44
|
|
|
44
45
|
const suggestedItems = useMemo( () => {
|
|
45
|
-
return orderBy( items,
|
|
46
|
+
return orderBy( items, 'frecency', 'desc' ).slice(
|
|
46
47
|
0,
|
|
47
48
|
MAX_SUGGESTED_ITEMS
|
|
48
49
|
);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useEffect, useState } from '@wordpress/element';
|
|
5
|
+
import { useDebounce } from '@wordpress/compose';
|
|
6
|
+
|
|
7
|
+
export default function useDebouncedInput( defaultValue = '' ) {
|
|
8
|
+
const [ input, setInput ] = useState( defaultValue );
|
|
9
|
+
const [ debounced, setter ] = useState( defaultValue );
|
|
10
|
+
const setDebounced = useDebounce( setter, 250 );
|
|
11
|
+
useEffect( () => {
|
|
12
|
+
if ( debounced !== input ) {
|
|
13
|
+
setDebounced( input );
|
|
14
|
+
}
|
|
15
|
+
}, [ debounced, input ] );
|
|
16
|
+
return [ input, setInput, debounced ];
|
|
17
|
+
}
|
|
@@ -39,6 +39,7 @@ function useInsertionPoint( {
|
|
|
39
39
|
isAppender,
|
|
40
40
|
onSelect,
|
|
41
41
|
shouldFocusBlock = true,
|
|
42
|
+
selectBlockOnInsert = true,
|
|
42
43
|
} ) {
|
|
43
44
|
const { getSelectedBlock } = useSelect( blockEditorStore );
|
|
44
45
|
const { destinationRootClientId, destinationIndex } = useSelect(
|
|
@@ -108,7 +109,7 @@ function useInsertionPoint( {
|
|
|
108
109
|
blocks,
|
|
109
110
|
destinationIndex,
|
|
110
111
|
destinationRootClientId,
|
|
111
|
-
|
|
112
|
+
selectBlockOnInsert,
|
|
112
113
|
shouldFocusBlock || shouldForceFocusBlock ? 0 : null,
|
|
113
114
|
meta
|
|
114
115
|
);
|
|
@@ -122,7 +123,7 @@ function useInsertionPoint( {
|
|
|
122
123
|
speak( message );
|
|
123
124
|
|
|
124
125
|
if ( onSelect ) {
|
|
125
|
-
onSelect();
|
|
126
|
+
onSelect( blocks );
|
|
126
127
|
}
|
|
127
128
|
},
|
|
128
129
|
[
|
|
@@ -143,18 +143,31 @@ class Inserter extends Component {
|
|
|
143
143
|
// Feel free to make them stable after a few releases.
|
|
144
144
|
__experimentalIsQuick: isQuick,
|
|
145
145
|
prioritizePatterns,
|
|
146
|
+
onSelectOrClose,
|
|
147
|
+
selectBlockOnInsert,
|
|
146
148
|
} = this.props;
|
|
147
149
|
|
|
148
150
|
if ( isQuick ) {
|
|
149
151
|
return (
|
|
150
152
|
<QuickInserter
|
|
151
|
-
onSelect={ () => {
|
|
153
|
+
onSelect={ ( blocks ) => {
|
|
154
|
+
const firstBlock =
|
|
155
|
+
Array.isArray( blocks ) && blocks?.length
|
|
156
|
+
? blocks[ 0 ]
|
|
157
|
+
: blocks;
|
|
158
|
+
if (
|
|
159
|
+
onSelectOrClose &&
|
|
160
|
+
typeof onSelectOrClose === 'function'
|
|
161
|
+
) {
|
|
162
|
+
onSelectOrClose( firstBlock );
|
|
163
|
+
}
|
|
152
164
|
onClose();
|
|
153
165
|
} }
|
|
154
166
|
rootClientId={ rootClientId }
|
|
155
167
|
clientId={ clientId }
|
|
156
168
|
isAppender={ isAppender }
|
|
157
169
|
prioritizePatterns={ prioritizePatterns }
|
|
170
|
+
selectBlockOnInsert={ selectBlockOnInsert }
|
|
158
171
|
/>
|
|
159
172
|
);
|
|
160
173
|
}
|
|
@@ -260,6 +273,7 @@ export default compose( [
|
|
|
260
273
|
allowedBlockType,
|
|
261
274
|
directInsertBlock,
|
|
262
275
|
onSelectOrClose,
|
|
276
|
+
selectBlockOnInsert,
|
|
263
277
|
} = ownProps;
|
|
264
278
|
|
|
265
279
|
if ( ! hasSingleBlockType && ! directInsertBlock ) {
|
|
@@ -370,10 +384,17 @@ export default compose( [
|
|
|
370
384
|
blockToInsert = createBlock( allowedBlockType.name );
|
|
371
385
|
}
|
|
372
386
|
|
|
373
|
-
insertBlock(
|
|
387
|
+
insertBlock(
|
|
388
|
+
blockToInsert,
|
|
389
|
+
getInsertionIndex(),
|
|
390
|
+
rootClientId,
|
|
391
|
+
selectBlockOnInsert
|
|
392
|
+
);
|
|
374
393
|
|
|
375
394
|
if ( onSelectOrClose ) {
|
|
376
|
-
onSelectOrClose(
|
|
395
|
+
onSelectOrClose( {
|
|
396
|
+
clientId: blockToInsert?.clientId,
|
|
397
|
+
} );
|
|
377
398
|
}
|
|
378
399
|
|
|
379
400
|
const message = sprintf(
|
|
@@ -216,7 +216,7 @@ export class Inserter extends Component {
|
|
|
216
216
|
}
|
|
217
217
|
|
|
218
218
|
onInserterToggledAnnouncement( isOpen ) {
|
|
219
|
-
AccessibilityInfo.isScreenReaderEnabled().
|
|
219
|
+
AccessibilityInfo.isScreenReaderEnabled().then( ( isEnabled ) => {
|
|
220
220
|
if ( isEnabled ) {
|
|
221
221
|
const isIOS = Platform.OS === 'ios';
|
|
222
222
|
const announcement = isOpen
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
5
|
+
import { useEffect, useState } from '@wordpress/element';
|
|
6
|
+
import { useSelect } from '@wordpress/data';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Internal dependencies
|
|
10
|
+
*/
|
|
11
|
+
import { store as blockEditorStore } from '../../../store';
|
|
12
|
+
|
|
13
|
+
export function useMediaResults( options = {} ) {
|
|
14
|
+
const [ results, setResults ] = useState();
|
|
15
|
+
const settings = useSelect(
|
|
16
|
+
( select ) => select( blockEditorStore ).getSettings(),
|
|
17
|
+
[]
|
|
18
|
+
);
|
|
19
|
+
useEffect( () => {
|
|
20
|
+
( async () => {
|
|
21
|
+
setResults();
|
|
22
|
+
const _media = await settings?.__unstableFetchMedia( options );
|
|
23
|
+
if ( _media ) setResults( _media );
|
|
24
|
+
} )();
|
|
25
|
+
}, Object.values( options ) );
|
|
26
|
+
return results;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const MEDIA_CATEGORIES = [
|
|
30
|
+
{ label: __( 'Images' ), name: 'images', mediaType: 'image' },
|
|
31
|
+
{ label: __( 'Videos' ), name: 'videos', mediaType: 'video' },
|
|
32
|
+
{ label: __( 'Audio' ), name: 'audio', mediaType: 'audio' },
|
|
33
|
+
];
|
|
34
|
+
export function useMediaCategories( rootClientId ) {
|
|
35
|
+
const [ categories, setCategories ] = useState( [] );
|
|
36
|
+
const { canInsertImage, canInsertVideo, canInsertAudio, fetchMedia } =
|
|
37
|
+
useSelect(
|
|
38
|
+
( select ) => {
|
|
39
|
+
const { canInsertBlockType, getSettings } =
|
|
40
|
+
select( blockEditorStore );
|
|
41
|
+
return {
|
|
42
|
+
fetchMedia: getSettings().__unstableFetchMedia,
|
|
43
|
+
canInsertImage: canInsertBlockType(
|
|
44
|
+
'core/image',
|
|
45
|
+
rootClientId
|
|
46
|
+
),
|
|
47
|
+
canInsertVideo: canInsertBlockType(
|
|
48
|
+
'core/video',
|
|
49
|
+
rootClientId
|
|
50
|
+
),
|
|
51
|
+
canInsertAudio: canInsertBlockType(
|
|
52
|
+
'core/audio',
|
|
53
|
+
rootClientId
|
|
54
|
+
),
|
|
55
|
+
};
|
|
56
|
+
},
|
|
57
|
+
[ rootClientId ]
|
|
58
|
+
);
|
|
59
|
+
useEffect( () => {
|
|
60
|
+
( async () => {
|
|
61
|
+
// If `__unstableFetchMedia` is not defined in block
|
|
62
|
+
// editor settings, do not set any media categories.
|
|
63
|
+
if ( ! fetchMedia ) return;
|
|
64
|
+
const query = {
|
|
65
|
+
context: 'view',
|
|
66
|
+
per_page: 1,
|
|
67
|
+
_fields: [ 'id' ],
|
|
68
|
+
};
|
|
69
|
+
const [ image, video, audio ] = await Promise.allSettled( [
|
|
70
|
+
fetchMedia( { ...query, media_type: 'image' } ),
|
|
71
|
+
fetchMedia( { ...query, media_type: 'video' } ),
|
|
72
|
+
fetchMedia( { ...query, media_type: 'audio' } ),
|
|
73
|
+
] );
|
|
74
|
+
// The `value` property is only present if the promise's status is "fulfilled".
|
|
75
|
+
const showImage = canInsertImage && !! image.value?.length;
|
|
76
|
+
const showVideo = canInsertVideo && !! video.value?.length;
|
|
77
|
+
const showAudio = canInsertAudio && !! audio.value?.length;
|
|
78
|
+
setCategories(
|
|
79
|
+
MEDIA_CATEGORIES.filter(
|
|
80
|
+
( { mediaType } ) =>
|
|
81
|
+
( mediaType === 'image' && showImage ) ||
|
|
82
|
+
( mediaType === 'video' && showVideo ) ||
|
|
83
|
+
( mediaType === 'audio' && showAudio )
|
|
84
|
+
)
|
|
85
|
+
);
|
|
86
|
+
} )();
|
|
87
|
+
}, [ canInsertImage, canInsertVideo, canInsertAudio, fetchMedia ] );
|
|
88
|
+
return categories;
|
|
89
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import {
|
|
5
|
+
__unstableComposite as Composite,
|
|
6
|
+
__unstableUseCompositeState as useCompositeState,
|
|
7
|
+
__unstableCompositeItem as CompositeItem,
|
|
8
|
+
Tooltip,
|
|
9
|
+
} from '@wordpress/components';
|
|
10
|
+
import { __ } from '@wordpress/i18n';
|
|
11
|
+
import { useMemo, useCallback } from '@wordpress/element';
|
|
12
|
+
import { cloneBlock } from '@wordpress/blocks';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Internal dependencies
|
|
16
|
+
*/
|
|
17
|
+
import InserterDraggableBlocks from '../../inserter-draggable-blocks';
|
|
18
|
+
import { getBlockAndPreviewFromMedia } from './utils';
|
|
19
|
+
|
|
20
|
+
function MediaPreview( { media, onClick, composite, mediaType } ) {
|
|
21
|
+
const [ block, preview ] = useMemo(
|
|
22
|
+
() => getBlockAndPreviewFromMedia( media, mediaType ),
|
|
23
|
+
[ media, mediaType ]
|
|
24
|
+
);
|
|
25
|
+
const title = media.title?.rendered || media.title;
|
|
26
|
+
const baseCssClass = 'block-editor-inserter__media-list';
|
|
27
|
+
return (
|
|
28
|
+
<InserterDraggableBlocks isEnabled={ true } blocks={ [ block ] }>
|
|
29
|
+
{ ( { draggable, onDragStart, onDragEnd } ) => (
|
|
30
|
+
<div
|
|
31
|
+
className={ `${ baseCssClass }__list-item` }
|
|
32
|
+
draggable={ draggable }
|
|
33
|
+
onDragStart={ onDragStart }
|
|
34
|
+
onDragEnd={ onDragEnd }
|
|
35
|
+
>
|
|
36
|
+
<Tooltip text={ title }>
|
|
37
|
+
<CompositeItem
|
|
38
|
+
role="option"
|
|
39
|
+
as="div"
|
|
40
|
+
{ ...composite }
|
|
41
|
+
className={ `${ baseCssClass }__item` }
|
|
42
|
+
onClick={ () => {
|
|
43
|
+
onClick( block );
|
|
44
|
+
} }
|
|
45
|
+
aria-label={ title }
|
|
46
|
+
>
|
|
47
|
+
<div
|
|
48
|
+
className={ `${ baseCssClass }__item-preview` }
|
|
49
|
+
>
|
|
50
|
+
{ preview }
|
|
51
|
+
</div>
|
|
52
|
+
</CompositeItem>
|
|
53
|
+
</Tooltip>
|
|
54
|
+
</div>
|
|
55
|
+
) }
|
|
56
|
+
</InserterDraggableBlocks>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function MediaList( {
|
|
61
|
+
mediaList,
|
|
62
|
+
mediaType,
|
|
63
|
+
onClick,
|
|
64
|
+
label = __( 'Media List' ),
|
|
65
|
+
} ) {
|
|
66
|
+
const composite = useCompositeState();
|
|
67
|
+
const onPreviewClick = useCallback(
|
|
68
|
+
( block ) => {
|
|
69
|
+
onClick( cloneBlock( block ) );
|
|
70
|
+
},
|
|
71
|
+
[ onClick ]
|
|
72
|
+
);
|
|
73
|
+
return (
|
|
74
|
+
<Composite
|
|
75
|
+
{ ...composite }
|
|
76
|
+
role="listbox"
|
|
77
|
+
className="block-editor-inserter__media-list"
|
|
78
|
+
aria-label={ label }
|
|
79
|
+
>
|
|
80
|
+
{ mediaList.map( ( media ) => (
|
|
81
|
+
<MediaPreview
|
|
82
|
+
key={ media.id }
|
|
83
|
+
media={ media }
|
|
84
|
+
mediaType={ mediaType }
|
|
85
|
+
onClick={ onPreviewClick }
|
|
86
|
+
composite={ composite }
|
|
87
|
+
/>
|
|
88
|
+
) ) }
|
|
89
|
+
</Composite>
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export default MediaList;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useRef, useEffect } from '@wordpress/element';
|
|
5
|
+
import { Spinner, SearchControl } from '@wordpress/components';
|
|
6
|
+
import { focus } from '@wordpress/dom';
|
|
7
|
+
import { __, sprintf } from '@wordpress/i18n';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Internal dependencies
|
|
11
|
+
*/
|
|
12
|
+
import MediaList from './media-list';
|
|
13
|
+
import useDebouncedInput from '../hooks/use-debounced-input';
|
|
14
|
+
import { useMediaResults } from './hooks';
|
|
15
|
+
import InserterNoResults from '../no-results';
|
|
16
|
+
|
|
17
|
+
const INITIAL_MEDIA_ITEMS_PER_PAGE = 10;
|
|
18
|
+
|
|
19
|
+
export function MediaCategoryDialog( { rootClientId, onInsert, category } ) {
|
|
20
|
+
const container = useRef();
|
|
21
|
+
useEffect( () => {
|
|
22
|
+
const timeout = setTimeout( () => {
|
|
23
|
+
const [ firstTabbable ] = focus.tabbable.find( container.current );
|
|
24
|
+
firstTabbable?.focus();
|
|
25
|
+
} );
|
|
26
|
+
return () => clearTimeout( timeout );
|
|
27
|
+
}, [ category ] );
|
|
28
|
+
return (
|
|
29
|
+
<div ref={ container } className="block-editor-inserter__media-dialog">
|
|
30
|
+
<MediaCategoryPanel
|
|
31
|
+
rootClientId={ rootClientId }
|
|
32
|
+
onInsert={ onInsert }
|
|
33
|
+
category={ category }
|
|
34
|
+
/>
|
|
35
|
+
</div>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function MediaCategoryPanel( { rootClientId, onInsert, category } ) {
|
|
40
|
+
const [ search, setSearch, debouncedSearch ] = useDebouncedInput();
|
|
41
|
+
const mediaList = useMediaResults( {
|
|
42
|
+
per_page: !! debouncedSearch ? 20 : INITIAL_MEDIA_ITEMS_PER_PAGE,
|
|
43
|
+
media_type: category.mediaType,
|
|
44
|
+
search: debouncedSearch,
|
|
45
|
+
orderBy: !! debouncedSearch ? 'relevance' : 'date',
|
|
46
|
+
} );
|
|
47
|
+
const baseCssClass = 'block-editor-inserter__media-panel';
|
|
48
|
+
return (
|
|
49
|
+
<div className={ baseCssClass }>
|
|
50
|
+
<SearchControl
|
|
51
|
+
className={ `${ baseCssClass }-search` }
|
|
52
|
+
onChange={ setSearch }
|
|
53
|
+
value={ search }
|
|
54
|
+
label={ sprintf(
|
|
55
|
+
/* translators: %s: Name of the media category(ex. 'images, videos'). */
|
|
56
|
+
__( 'Search %s' ),
|
|
57
|
+
category.label.toLocaleLowerCase()
|
|
58
|
+
) }
|
|
59
|
+
placeholder={ sprintf(
|
|
60
|
+
/* translators: %s: Name of the media category(ex. 'images, videos'). */
|
|
61
|
+
__( 'Search %s' ),
|
|
62
|
+
category.label.toLocaleLowerCase()
|
|
63
|
+
) }
|
|
64
|
+
/>
|
|
65
|
+
{ ! mediaList && (
|
|
66
|
+
<div className={ `${ baseCssClass }-spinner` }>
|
|
67
|
+
<Spinner />
|
|
68
|
+
</div>
|
|
69
|
+
) }
|
|
70
|
+
{ Array.isArray( mediaList ) && ! mediaList.length && (
|
|
71
|
+
<InserterNoResults />
|
|
72
|
+
) }
|
|
73
|
+
{ !! mediaList?.length && (
|
|
74
|
+
<MediaList
|
|
75
|
+
rootClientId={ rootClientId }
|
|
76
|
+
onClick={ onInsert }
|
|
77
|
+
mediaList={ mediaList }
|
|
78
|
+
mediaType={ category.mediaType }
|
|
79
|
+
/>
|
|
80
|
+
) }
|
|
81
|
+
</div>
|
|
82
|
+
);
|
|
83
|
+
}
|