@wordpress/block-editor 8.1.2-next.f435e9e01b.0 → 8.2.1-next.a55ed9455a.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 +11 -1
- package/README.md +6 -26
- package/build/autocompleters/link.js +78 -0
- package/build/autocompleters/link.js.map +1 -0
- package/build/components/autocomplete/index.js +3 -1
- package/build/components/autocomplete/index.js.map +1 -1
- package/build/components/block-actions/index.js +1 -1
- package/build/components/block-actions/index.js.map +1 -1
- package/build/components/block-breadcrumb/index.js +4 -2
- package/build/components/block-breadcrumb/index.js.map +1 -1
- package/build/components/block-compare/index.js +2 -2
- package/build/components/block-compare/index.js.map +1 -1
- package/build/components/block-controls/index.js +1 -1
- package/build/components/block-controls/index.js.map +1 -1
- package/build/components/block-draggable/index.js +1 -1
- package/build/components/block-draggable/index.js.map +1 -1
- package/build/components/block-edit/edit.js +1 -1
- package/build/components/block-edit/edit.js.map +1 -1
- package/build/components/block-list/block-html.js +1 -1
- package/build/components/block-list/block-html.js.map +1 -1
- package/build/components/block-list/block-invalid-warning.js +1 -1
- package/build/components/block-list/block-invalid-warning.js.map +1 -1
- package/build/components/block-list/block-list-item.native.js +4 -4
- package/build/components/block-list/block-list-item.native.js.map +1 -1
- package/build/components/block-list/block-selection-button.native.js +4 -3
- package/build/components/block-list/block-selection-button.native.js.map +1 -1
- package/build/components/block-list/block.js +17 -3
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/block.native.js +6 -6
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-list/index.native.js +5 -5
- package/build/components/block-list/index.native.js.map +1 -1
- package/build/components/block-list/use-block-props/use-block-class-names.js +1 -1
- package/build/components/block-list/use-block-props/use-block-class-names.js.map +1 -1
- package/build/components/block-list/use-block-props/use-focus-first-element.js +3 -0
- package/build/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
- package/build/components/block-list/use-block-props/use-multi-selection.js +25 -27
- package/build/components/block-list/use-block-props/use-multi-selection.js.map +1 -1
- package/build/components/block-media-update-progress/index.native.js +4 -4
- package/build/components/block-media-update-progress/index.native.js.map +1 -1
- package/build/components/block-mobile-toolbar/block-actions-menu.native.js +3 -3
- 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-mover/mover-description.js +4 -4
- package/build/components/block-mover/mover-description.js.map +1 -1
- package/build/components/block-mover/mover-description.native.js +5 -5
- package/build/components/block-mover/mover-description.native.js.map +1 -1
- package/build/components/block-settings/container.native.js +1 -5
- package/build/components/block-settings/container.native.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +7 -12
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-styles/preview.native.js +1 -1
- package/build/components/block-styles/preview.native.js.map +1 -1
- package/build/components/block-switcher/index.js +2 -1
- package/build/components/block-switcher/index.js.map +1 -1
- package/build/components/block-switcher/use-transformed-patterns.js +0 -1
- package/build/components/block-switcher/use-transformed-patterns.js.map +1 -1
- package/build/components/block-title/index.js +7 -62
- package/build/components/block-title/index.js.map +1 -1
- package/build/components/block-title/use-block-display-title.js +94 -0
- package/build/components/block-title/use-block-display-title.js.map +1 -0
- package/build/components/block-toolbar/utils.js +9 -1
- package/build/components/block-toolbar/utils.js.map +1 -1
- package/build/components/block-tools/block-popover.js +1 -1
- package/build/components/block-tools/block-popover.js.map +1 -1
- package/build/components/block-tools/block-selection-button.js +2 -1
- package/build/components/block-tools/block-selection-button.js.map +1 -1
- package/build/components/block-types-list/index.native.js +1 -1
- package/build/components/block-types-list/index.native.js.map +1 -1
- package/build/components/border-radius-control/index.js +2 -2
- package/build/components/border-radius-control/index.js.map +1 -1
- package/build/components/border-radius-control/utils.js +10 -6
- package/build/components/border-radius-control/utils.js.map +1 -1
- package/build/components/contrast-checker/index.js +3 -3
- package/build/components/contrast-checker/index.js.map +1 -1
- package/build/components/convert-to-group-buttons/index.js +1 -1
- package/build/components/convert-to-group-buttons/index.js.map +1 -1
- package/build/components/convert-to-group-buttons/use-convert-to-group-button-props.js +1 -3
- package/build/components/convert-to-group-buttons/use-convert-to-group-button-props.js.map +1 -1
- package/build/components/copy-handler/index.js +3 -3
- package/build/components/copy-handler/index.js.map +1 -1
- package/build/components/font-sizes/with-font-sizes.js +3 -3
- package/build/components/font-sizes/with-font-sizes.js.map +1 -1
- package/build/components/index.js +9 -0
- package/build/components/index.js.map +1 -1
- package/build/components/index.native.js +38 -1
- package/build/components/index.native.js.map +1 -1
- package/build/components/inserter/block-patterns-tab.js +4 -4
- package/build/components/inserter/block-patterns-tab.js.map +1 -1
- package/build/components/inserter/block-types-tab.js +1 -1
- package/build/components/inserter/block-types-tab.js.map +1 -1
- package/build/components/inserter/hooks/use-block-type-impressions.native.js +2 -2
- package/build/components/inserter/hooks/use-block-type-impressions.native.js.map +1 -1
- package/build/components/inserter/index.js +3 -3
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/inserter/index.native.js +7 -7
- package/build/components/inserter/index.native.js.map +1 -1
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/menu.native.js +3 -3
- package/build/components/inserter/menu.native.js.map +1 -1
- package/build/components/inserter/quick-inserter.js +20 -8
- package/build/components/inserter/quick-inserter.js.map +1 -1
- package/build/components/inserter/search-items.js +1 -1
- package/build/components/inserter/search-items.js.map +1 -1
- package/build/components/inserter/search-results.js +28 -11
- package/build/components/inserter/search-results.js.map +1 -1
- package/build/components/keyboard-shortcuts/index.js +1 -1
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/letter-spacing-control/index.js +3 -3
- package/build/components/letter-spacing-control/index.js.map +1 -1
- package/build/components/line-height-control/index.js +63 -45
- package/build/components/line-height-control/index.js.map +1 -1
- package/build/components/line-height-control/index.native.js +3 -1
- package/build/components/line-height-control/index.native.js.map +1 -1
- package/build/components/link-control/index.js +2 -2
- package/build/components/link-control/index.js.map +1 -1
- package/build/components/link-control/search-input.js +1 -1
- package/build/components/link-control/search-input.js.map +1 -1
- package/build/components/link-control/search-results.js +2 -2
- package/build/components/link-control/search-results.js.map +1 -1
- package/build/components/link-control/use-rich-url-data.js +1 -1
- package/build/components/link-control/use-rich-url-data.js.map +1 -1
- package/build/components/link-control/use-search-handler.js +2 -2
- package/build/components/link-control/use-search-handler.js.map +1 -1
- package/build/components/list-view/block-contents.js +8 -4
- package/build/components/list-view/block-contents.js.map +1 -1
- package/build/components/list-view/block-select-button.js +2 -2
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/list-view/block.js +20 -9
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/branch.js +2 -1
- package/build/components/list-view/branch.js.map +1 -1
- package/build/components/list-view/index.js +49 -41
- package/build/components/list-view/index.js.map +1 -1
- package/build/components/list-view/use-block-selection.js +139 -0
- package/build/components/list-view/use-block-selection.js.map +1 -0
- package/build/components/list-view/use-list-view-expand-selected-item.js +60 -0
- package/build/components/list-view/use-list-view-expand-selected-item.js.map +1 -0
- package/build/components/list-view/utils.js +29 -1
- package/build/components/list-view/utils.js.map +1 -1
- package/build/components/media-placeholder/index.native.js +7 -5
- package/build/components/media-placeholder/index.native.js.map +1 -1
- package/build/components/media-replace-flow/index.js +20 -24
- package/build/components/media-replace-flow/index.js.map +1 -1
- package/build/components/media-upload/index.native.js +4 -3
- package/build/components/media-upload/index.native.js.map +1 -1
- package/build/components/media-upload-progress/index.native.js +1 -1
- package/build/components/media-upload-progress/index.native.js.map +1 -1
- package/build/components/navigable-toolbar/index.js +3 -3
- package/build/components/navigable-toolbar/index.js.map +1 -1
- package/build/components/plain-text/index.native.js +3 -3
- package/build/components/plain-text/index.native.js.map +1 -1
- package/build/components/rich-text/format-toolbar-container.js +2 -2
- package/build/components/rich-text/format-toolbar-container.js.map +1 -1
- package/build/components/rich-text/format-toolbar-container.native.js +1 -1
- package/build/components/rich-text/format-toolbar-container.native.js.map +1 -1
- package/build/components/rich-text/index.js +7 -12
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/index.native.js +3 -3
- package/build/components/rich-text/index.native.js.map +1 -1
- package/build/components/rich-text/use-paste-handler.js +7 -12
- package/build/components/rich-text/use-paste-handler.js.map +1 -1
- package/build/components/url-input/index.js +11 -11
- package/build/components/url-input/index.js.map +1 -1
- package/build/components/use-moving-animation/index.js +1 -1
- package/build/components/use-moving-animation/index.js.map +1 -1
- package/build/components/use-on-block-drop/index.js +2 -2
- package/build/components/use-on-block-drop/index.js.map +1 -1
- package/build/components/writing-flow/index.js +1 -0
- package/build/components/writing-flow/index.js.map +1 -1
- package/build/components/writing-flow/use-multi-selection.js +22 -24
- package/build/components/writing-flow/use-multi-selection.js.map +1 -1
- package/build/components/writing-flow/use-select-all.js +3 -2
- package/build/components/writing-flow/use-select-all.js.map +1 -1
- package/build/components/writing-flow/use-tab-nav.js +4 -3
- package/build/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build/hooks/align.js +1 -1
- package/build/hooks/align.js.map +1 -1
- package/build/hooks/anchor.js +1 -1
- package/build/hooks/anchor.js.map +1 -1
- package/build/hooks/border.js +2 -14
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/color.js +2 -2
- package/build/hooks/color.js.map +1 -1
- package/build/hooks/custom-class-name.js +40 -0
- package/build/hooks/custom-class-name.js.map +1 -1
- package/build/hooks/generated-class-name.js +3 -3
- package/build/hooks/generated-class-name.js.map +1 -1
- package/build/hooks/line-height.js +2 -0
- package/build/hooks/line-height.js.map +1 -1
- package/build/hooks/lock.js +1 -1
- package/build/hooks/lock.js.map +1 -1
- package/build/hooks/style.js +32 -13
- package/build/hooks/style.js.map +1 -1
- package/build/layouts/flow.js +7 -5
- package/build/layouts/flow.js.map +1 -1
- package/build/store/actions.js +55 -48
- package/build/store/actions.js.map +1 -1
- package/build/store/defaults.js +2 -1
- package/build/store/defaults.js.map +1 -1
- package/build/store/index.js +1 -2
- package/build/store/index.js.map +1 -1
- package/build/store/reducer.js +13 -13
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +6 -6
- package/build/store/selectors.js.map +1 -1
- package/build/utils/index.js +0 -14
- package/build/utils/index.js.map +1 -1
- package/build/utils/parse-css-unit-to-px.js +3 -3
- package/build/utils/parse-css-unit-to-px.js.map +1 -1
- package/build/utils/pasting.js +91 -0
- package/build/utils/pasting.js.map +1 -0
- package/build/utils/transform-styles/ast/parse.js +5 -5
- package/build/utils/transform-styles/ast/parse.js.map +1 -1
- package/build/utils/transform-styles/transforms/url-rewrite.js +2 -2
- package/build/utils/transform-styles/transforms/url-rewrite.js.map +1 -1
- package/build-module/autocompleters/link.js +64 -0
- package/build-module/autocompleters/link.js.map +1 -0
- package/build-module/components/autocomplete/index.js +2 -1
- package/build-module/components/autocomplete/index.js.map +1 -1
- package/build-module/components/block-actions/index.js +1 -1
- package/build-module/components/block-actions/index.js.map +1 -1
- package/build-module/components/block-breadcrumb/index.js +4 -2
- package/build-module/components/block-breadcrumb/index.js.map +1 -1
- package/build-module/components/block-compare/index.js +2 -2
- package/build-module/components/block-compare/index.js.map +1 -1
- package/build-module/components/block-controls/index.js +1 -1
- package/build-module/components/block-controls/index.js.map +1 -1
- package/build-module/components/block-draggable/index.js +1 -1
- package/build-module/components/block-draggable/index.js.map +1 -1
- package/build-module/components/block-edit/edit.js +1 -1
- package/build-module/components/block-edit/edit.js.map +1 -1
- package/build-module/components/block-list/block-html.js +1 -1
- package/build-module/components/block-list/block-html.js.map +1 -1
- package/build-module/components/block-list/block-invalid-warning.js +1 -1
- package/build-module/components/block-list/block-invalid-warning.js.map +1 -1
- package/build-module/components/block-list/block-list-item.native.js +4 -4
- package/build-module/components/block-list/block-list-item.native.js.map +1 -1
- package/build-module/components/block-list/block-selection-button.native.js +4 -3
- package/build-module/components/block-list/block-selection-button.native.js.map +1 -1
- package/build-module/components/block-list/block.js +18 -4
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/block.native.js +7 -7
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-list/index.native.js +5 -5
- package/build-module/components/block-list/index.native.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-block-class-names.js +1 -1
- package/build-module/components/block-list/use-block-props/use-block-class-names.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-focus-first-element.js +2 -0
- package/build-module/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-multi-selection.js +23 -28
- package/build-module/components/block-list/use-block-props/use-multi-selection.js.map +1 -1
- package/build-module/components/block-media-update-progress/index.native.js +4 -4
- package/build-module/components/block-media-update-progress/index.native.js.map +1 -1
- package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js +3 -3
- 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-mover/mover-description.js +4 -4
- package/build-module/components/block-mover/mover-description.js.map +1 -1
- package/build-module/components/block-mover/mover-description.native.js +5 -5
- package/build-module/components/block-mover/mover-description.native.js.map +1 -1
- package/build-module/components/block-settings/container.native.js +2 -6
- package/build-module/components/block-settings/container.native.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +7 -13
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-styles/preview.native.js +1 -1
- package/build-module/components/block-styles/preview.native.js.map +1 -1
- package/build-module/components/block-switcher/index.js +2 -1
- package/build-module/components/block-switcher/index.js.map +1 -1
- package/build-module/components/block-switcher/use-transformed-patterns.js +0 -1
- package/build-module/components/block-switcher/use-transformed-patterns.js.map +1 -1
- package/build-module/components/block-title/index.js +7 -58
- package/build-module/components/block-title/index.js.map +1 -1
- package/build-module/components/block-title/use-block-display-title.js +80 -0
- package/build-module/components/block-title/use-block-display-title.js.map +1 -0
- package/build-module/components/block-toolbar/utils.js +9 -1
- package/build-module/components/block-toolbar/utils.js.map +1 -1
- package/build-module/components/block-tools/block-popover.js +1 -1
- package/build-module/components/block-tools/block-popover.js.map +1 -1
- package/build-module/components/block-tools/block-selection-button.js +2 -1
- package/build-module/components/block-tools/block-selection-button.js.map +1 -1
- package/build-module/components/block-types-list/index.native.js +1 -1
- package/build-module/components/block-types-list/index.native.js.map +1 -1
- package/build-module/components/border-radius-control/index.js +3 -3
- package/build-module/components/border-radius-control/index.js.map +1 -1
- package/build-module/components/border-radius-control/utils.js +11 -7
- package/build-module/components/border-radius-control/utils.js.map +1 -1
- package/build-module/components/contrast-checker/index.js +3 -3
- package/build-module/components/contrast-checker/index.js.map +1 -1
- package/build-module/components/convert-to-group-buttons/index.js +1 -1
- package/build-module/components/convert-to-group-buttons/index.js.map +1 -1
- package/build-module/components/convert-to-group-buttons/use-convert-to-group-button-props.js +1 -3
- package/build-module/components/convert-to-group-buttons/use-convert-to-group-button-props.js.map +1 -1
- package/build-module/components/copy-handler/index.js +2 -2
- package/build-module/components/copy-handler/index.js.map +1 -1
- package/build-module/components/font-sizes/with-font-sizes.js +3 -3
- package/build-module/components/font-sizes/with-font-sizes.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/index.native.js +5 -4
- package/build-module/components/index.native.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab.js +4 -4
- package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
- package/build-module/components/inserter/block-types-tab.js +1 -1
- package/build-module/components/inserter/block-types-tab.js.map +1 -1
- package/build-module/components/inserter/hooks/use-block-type-impressions.native.js +2 -2
- package/build-module/components/inserter/hooks/use-block-type-impressions.native.js.map +1 -1
- package/build-module/components/inserter/index.js +3 -3
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/inserter/index.native.js +7 -7
- package/build-module/components/inserter/index.native.js.map +1 -1
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/menu.native.js +3 -3
- package/build-module/components/inserter/menu.native.js.map +1 -1
- package/build-module/components/inserter/quick-inserter.js +20 -8
- package/build-module/components/inserter/quick-inserter.js.map +1 -1
- package/build-module/components/inserter/search-items.js +1 -1
- package/build-module/components/inserter/search-items.js.map +1 -1
- package/build-module/components/inserter/search-results.js +28 -11
- package/build-module/components/inserter/search-results.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/index.js +1 -1
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/letter-spacing-control/index.js +3 -3
- package/build-module/components/letter-spacing-control/index.js.map +1 -1
- package/build-module/components/line-height-control/index.js +61 -45
- package/build-module/components/line-height-control/index.js.map +1 -1
- package/build-module/components/line-height-control/index.native.js +3 -1
- package/build-module/components/line-height-control/index.native.js.map +1 -1
- package/build-module/components/link-control/index.js +2 -2
- package/build-module/components/link-control/index.js.map +1 -1
- package/build-module/components/link-control/search-input.js +1 -1
- package/build-module/components/link-control/search-input.js.map +1 -1
- package/build-module/components/link-control/search-results.js +2 -2
- package/build-module/components/link-control/search-results.js.map +1 -1
- package/build-module/components/link-control/use-rich-url-data.js +1 -1
- package/build-module/components/link-control/use-rich-url-data.js.map +1 -1
- package/build-module/components/link-control/use-search-handler.js +2 -2
- package/build-module/components/link-control/use-search-handler.js.map +1 -1
- package/build-module/components/list-view/block-contents.js +8 -4
- package/build-module/components/list-view/block-contents.js.map +1 -1
- package/build-module/components/list-view/block-select-button.js +2 -2
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/list-view/block.js +20 -9
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/branch.js +2 -1
- package/build-module/components/list-view/branch.js.map +1 -1
- package/build-module/components/list-view/index.js +46 -42
- package/build-module/components/list-view/index.js.map +1 -1
- package/build-module/components/list-view/use-block-selection.js +123 -0
- package/build-module/components/list-view/use-block-selection.js.map +1 -0
- package/build-module/components/list-view/use-list-view-expand-selected-item.js +50 -0
- package/build-module/components/list-view/use-list-view-expand-selected-item.js.map +1 -0
- package/build-module/components/list-view/utils.js +25 -0
- package/build-module/components/list-view/utils.js.map +1 -1
- package/build-module/components/media-placeholder/index.native.js +7 -5
- package/build-module/components/media-placeholder/index.native.js.map +1 -1
- package/build-module/components/media-replace-flow/index.js +22 -27
- package/build-module/components/media-replace-flow/index.js.map +1 -1
- package/build-module/components/media-upload/index.native.js +4 -3
- package/build-module/components/media-upload/index.native.js.map +1 -1
- package/build-module/components/media-upload-progress/index.native.js +1 -1
- package/build-module/components/media-upload-progress/index.native.js.map +1 -1
- package/build-module/components/navigable-toolbar/index.js +3 -3
- package/build-module/components/navigable-toolbar/index.js.map +1 -1
- package/build-module/components/plain-text/index.native.js +3 -3
- package/build-module/components/plain-text/index.native.js.map +1 -1
- package/build-module/components/rich-text/format-toolbar-container.js +2 -2
- package/build-module/components/rich-text/format-toolbar-container.js.map +1 -1
- package/build-module/components/rich-text/format-toolbar-container.native.js +1 -1
- package/build-module/components/rich-text/format-toolbar-container.native.js.map +1 -1
- package/build-module/components/rich-text/index.js +7 -12
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/index.native.js +3 -3
- package/build-module/components/rich-text/index.native.js.map +1 -1
- package/build-module/components/rich-text/use-paste-handler.js +6 -12
- package/build-module/components/rich-text/use-paste-handler.js.map +1 -1
- package/build-module/components/url-input/index.js +11 -11
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/components/use-moving-animation/index.js +1 -1
- package/build-module/components/use-moving-animation/index.js.map +1 -1
- package/build-module/components/use-on-block-drop/index.js +2 -2
- package/build-module/components/use-on-block-drop/index.js.map +1 -1
- package/build-module/components/writing-flow/index.js +1 -0
- package/build-module/components/writing-flow/index.js.map +1 -1
- package/build-module/components/writing-flow/use-multi-selection.js +21 -21
- package/build-module/components/writing-flow/use-multi-selection.js.map +1 -1
- package/build-module/components/writing-flow/use-select-all.js +3 -2
- package/build-module/components/writing-flow/use-select-all.js.map +1 -1
- package/build-module/components/writing-flow/use-tab-nav.js +4 -3
- package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build-module/hooks/align.js +1 -1
- package/build-module/hooks/align.js.map +1 -1
- package/build-module/hooks/anchor.js +1 -1
- package/build-module/hooks/anchor.js.map +1 -1
- package/build-module/hooks/border.js +2 -14
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/color.js +2 -2
- package/build-module/hooks/color.js.map +1 -1
- package/build-module/hooks/custom-class-name.js +38 -0
- package/build-module/hooks/custom-class-name.js.map +1 -1
- package/build-module/hooks/generated-class-name.js +3 -3
- package/build-module/hooks/generated-class-name.js.map +1 -1
- package/build-module/hooks/line-height.js +2 -0
- package/build-module/hooks/line-height.js.map +1 -1
- package/build-module/hooks/lock.js +1 -1
- package/build-module/hooks/lock.js.map +1 -1
- package/build-module/hooks/style.js +31 -13
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/layouts/flow.js +7 -5
- package/build-module/layouts/flow.js.map +1 -1
- package/build-module/store/actions.js +52 -45
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/defaults.js +2 -1
- package/build-module/store/defaults.js.map +1 -1
- package/build-module/store/index.js +1 -2
- package/build-module/store/index.js.map +1 -1
- package/build-module/store/reducer.js +13 -13
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +6 -6
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/index.js +0 -1
- package/build-module/utils/index.js.map +1 -1
- package/build-module/utils/parse-css-unit-to-px.js +3 -3
- package/build-module/utils/parse-css-unit-to-px.js.map +1 -1
- package/build-module/utils/pasting.js +80 -0
- package/build-module/utils/pasting.js.map +1 -0
- package/build-module/utils/transform-styles/ast/parse.js +5 -5
- package/build-module/utils/transform-styles/ast/parse.js.map +1 -1
- package/build-module/utils/transform-styles/transforms/url-rewrite.js +2 -2
- package/build-module/utils/transform-styles/transforms/url-rewrite.js.map +1 -1
- package/build-style/style-rtl.css +10 -12
- package/build-style/style.css +10 -12
- package/package.json +27 -26
- package/src/autocompleters/link.js +62 -0
- package/src/autocompleters/style.scss +8 -0
- package/src/components/alignment-control/test/index.js +2 -2
- package/src/components/autocomplete/index.js +2 -0
- package/src/components/block-actions/index.js +1 -1
- package/src/components/block-alignment-control/test/index.js +1 -1
- package/src/components/block-breadcrumb/index.js +5 -2
- package/src/components/block-compare/index.js +2 -2
- package/src/components/block-controls/index.js +1 -1
- package/src/components/block-draggable/index.js +1 -1
- package/src/components/block-draggable/stories/index.js +1 -1
- package/src/components/block-edit/edit.js +1 -1
- package/src/components/block-list/block-html.js +1 -1
- package/src/components/block-list/block-invalid-warning.js +1 -1
- package/src/components/block-list/block-list-item.native.js +4 -4
- package/src/components/block-list/block-selection-button.native.js +3 -3
- package/src/components/block-list/block.js +28 -4
- package/src/components/block-list/block.native.js +7 -6
- package/src/components/block-list/index.native.js +5 -5
- package/src/components/block-list/style.scss +3 -1
- package/src/components/block-list/use-block-props/use-block-class-names.js +1 -1
- package/src/components/block-list/use-block-props/use-focus-first-element.js +3 -0
- package/src/components/block-list/use-block-props/use-multi-selection.js +22 -30
- package/src/components/block-media-update-progress/index.native.js +4 -4
- package/src/components/block-media-update-progress/test/index.native.js +2 -2
- package/src/components/block-mobile-toolbar/block-actions-menu.native.js +3 -3
- package/src/components/block-mobile-toolbar/index.native.js +2 -2
- package/src/components/block-mover/mover-description.js +4 -4
- package/src/components/block-mover/mover-description.native.js +5 -5
- package/src/components/block-settings/container.native.js +5 -6
- package/src/components/block-settings-menu/block-settings-dropdown.js +7 -8
- package/src/components/block-styles/preview.native.js +1 -1
- package/src/components/block-switcher/index.js +4 -1
- package/src/components/block-switcher/use-transformed-patterns.js +0 -1
- package/src/components/block-title/README.md +17 -1
- package/src/components/block-title/index.js +7 -62
- package/src/components/block-title/test/index.js +21 -3
- package/src/components/block-title/use-block-display-title.js +83 -0
- package/src/components/block-toolbar/utils.js +12 -2
- package/src/components/block-tools/block-popover.js +1 -1
- package/src/components/block-tools/block-selection-button.js +4 -1
- package/src/components/block-types-list/index.native.js +1 -1
- package/src/components/border-radius-control/index.js +5 -3
- package/src/components/border-radius-control/test/utils.js +10 -10
- package/src/components/border-radius-control/utils.js +10 -8
- package/src/components/contrast-checker/index.js +3 -3
- package/src/components/convert-to-group-buttons/index.js +1 -1
- package/src/components/convert-to-group-buttons/use-convert-to-group-button-props.js +1 -6
- package/src/components/copy-handler/index.js +2 -2
- package/src/components/font-sizes/with-font-sizes.js +3 -3
- package/src/components/image-size-control/test/index.js +1 -1
- package/src/components/index.js +1 -0
- package/src/components/index.native.js +11 -4
- package/src/components/inserter/block-patterns-tab.js +13 -17
- package/src/components/inserter/block-types-tab.js +1 -1
- package/src/components/inserter/hooks/use-block-type-impressions.native.js +2 -2
- package/src/components/inserter/index.js +3 -3
- package/src/components/inserter/index.native.js +7 -7
- package/src/components/inserter/menu.js +1 -1
- package/src/components/inserter/menu.native.js +3 -3
- package/src/components/inserter/quick-inserter.js +32 -10
- package/src/components/inserter/search-items.js +1 -1
- package/src/components/inserter/search-results.js +55 -43
- package/src/components/inserter/test/fixtures/index.native.js +1 -1
- package/src/components/inserter/test/reusable-blocks-tab.js +2 -2
- package/src/components/justify-content-control/README.md +1 -1
- package/src/components/keyboard-shortcuts/index.js +1 -1
- package/src/components/letter-spacing-control/index.js +1 -1
- package/src/components/line-height-control/README.md +13 -2
- package/src/components/line-height-control/index.js +66 -43
- package/src/components/line-height-control/index.native.js +2 -0
- package/src/components/line-height-control/stories/index.js +33 -0
- package/src/components/line-height-control/test/index.js +61 -0
- package/src/components/link-control/index.js +2 -2
- package/src/components/link-control/search-input.js +1 -1
- package/src/components/link-control/search-results.js +2 -2
- package/src/components/link-control/test/index.js +142 -144
- package/src/components/link-control/use-rich-url-data.js +1 -1
- package/src/components/link-control/use-search-handler.js +2 -2
- package/src/components/list-view/README.md +2 -2
- package/src/components/list-view/block-contents.js +10 -3
- package/src/components/list-view/block-select-button.js +1 -2
- package/src/components/list-view/block.js +30 -10
- package/src/components/list-view/branch.js +1 -0
- package/src/components/list-view/index.js +56 -30
- package/src/components/list-view/test/utils.js +50 -0
- package/src/components/list-view/use-block-selection.js +163 -0
- package/src/components/list-view/use-list-view-expand-selected-item.js +58 -0
- package/src/components/list-view/utils.js +31 -0
- package/src/components/media-placeholder/index.native.js +11 -9
- package/src/components/media-replace-flow/README.md +7 -0
- package/src/components/media-replace-flow/index.js +20 -26
- package/src/components/media-replace-flow/test/index.js +100 -0
- package/src/components/media-upload/index.native.js +3 -2
- package/src/components/media-upload-progress/index.native.js +1 -1
- package/src/components/navigable-toolbar/index.js +3 -3
- package/src/components/plain-text/index.native.js +3 -3
- package/src/components/responsive-block-control/test/index.js +6 -6
- package/src/components/rich-text/format-toolbar-container.js +2 -2
- package/src/components/rich-text/format-toolbar-container.native.js +1 -1
- package/src/components/rich-text/index.js +7 -14
- package/src/components/rich-text/index.native.js +3 -3
- package/src/components/rich-text/use-paste-handler.js +7 -14
- package/src/components/url-input/index.js +11 -11
- package/src/components/use-block-drop-zone/test/index.js +1 -1
- package/src/components/use-moving-animation/index.js +1 -1
- package/src/components/use-on-block-drop/index.js +2 -2
- package/src/components/writing-flow/index.js +1 -0
- package/src/components/writing-flow/use-multi-selection.js +17 -20
- package/src/components/writing-flow/use-select-all.js +6 -2
- package/src/components/writing-flow/use-tab-nav.js +6 -3
- package/src/hooks/align.js +1 -1
- package/src/hooks/anchor.js +1 -1
- package/src/hooks/border.js +8 -19
- package/src/hooks/color.js +2 -2
- package/src/hooks/custom-class-name.js +45 -0
- package/src/hooks/generated-class-name.js +3 -3
- package/src/hooks/line-height.js +2 -0
- package/src/hooks/lock.js +1 -1
- package/src/hooks/style.js +31 -13
- package/src/hooks/test/align.js +1 -1
- package/src/hooks/typography.scss +0 -4
- package/src/layouts/flow.js +10 -5
- package/src/store/actions.js +24 -14
- package/src/store/defaults.js +2 -2
- package/src/store/index.js +0 -1
- package/src/store/reducer.js +13 -12
- package/src/store/selectors.js +6 -6
- package/src/store/test/actions.js +2 -2
- package/src/store/test/reducer.js +10 -1
- package/src/store/test/selectors.js +1 -1
- package/src/style.scss +0 -1
- package/src/utils/index.js +0 -1
- package/src/utils/parse-css-unit-to-px.js +3 -3
- package/src/utils/pasting.js +77 -0
- package/src/utils/test/parse-css-unit-to-px.js +5 -5
- package/src/utils/test/pasting.js +84 -0
- package/src/utils/transform-styles/ast/parse.js +5 -5
- package/src/utils/transform-styles/transforms/url-rewrite.js +2 -2
- package/build/utils/get-paste-event-data.js +0 -56
- package/build/utils/get-paste-event-data.js.map +0 -1
- package/build/utils/theme.js +0 -63
- package/build/utils/theme.js.map +0 -1
- package/build-module/utils/get-paste-event-data.js +0 -47
- package/build-module/utils/get-paste-event-data.js.map +0 -1
- package/build-module/utils/theme.js +0 -53
- package/build-module/utils/theme.js.map +0 -1
- package/src/components/line-height-control/style.scss +0 -8
- package/src/components/writing-flow/test/use-multi-selection.js +0 -36
- package/src/utils/get-paste-event-data.js +0 -42
- package/src/utils/theme.js +0 -48
|
@@ -67,7 +67,7 @@ function LinkControlSearchResults(_ref) {
|
|
|
67
67
|
// so we conditionally render it as a wrapper to visually hide the label
|
|
68
68
|
// when that is required.
|
|
69
69
|
|
|
70
|
-
const searchResultsLabel = (0, _element.createElement)(isInitialSuggestions ? _element.Fragment : _components.VisuallyHidden, {}, //
|
|
70
|
+
const searchResultsLabel = (0, _element.createElement)(isInitialSuggestions ? _element.Fragment : _components.VisuallyHidden, {}, // Empty props.
|
|
71
71
|
(0, _element.createElement)("span", {
|
|
72
72
|
className: "block-editor-link-control__search-results-label",
|
|
73
73
|
id: searchResultsLabelId
|
|
@@ -91,7 +91,7 @@ function LinkControlSearchResults(_ref) {
|
|
|
91
91
|
isSelected: index === selectedSuggestion
|
|
92
92
|
});
|
|
93
93
|
} // If we're not handling "Create" suggestions above then
|
|
94
|
-
// we don't want them in the main results so exit early
|
|
94
|
+
// we don't want them in the main results so exit early.
|
|
95
95
|
|
|
96
96
|
|
|
97
97
|
if (_constants.CREATE_TYPE === suggestion.type) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/link-control/search-results.js"],"names":["LinkControlSearchResults","instanceId","withCreateSuggestion","currentInputValue","handleSuggestionClick","suggestionsListProps","buildSuggestionItemProps","suggestions","selectedSuggestion","isLoading","isInitialSuggestions","createSuggestionButtonText","suggestionsQuery","resultsListClasses","directLinkEntryTypes","isSingleDirectEntryResult","length","includes","type","toLowerCase","shouldShowCreateSuggestion","shouldShowSuggestionsTypes","searchResultsLabelId","labelText","searchResultsLabel","Fragment","VisuallyHidden","map","suggestion","index","CREATE_TYPE","id","isFrontPage"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AAKA;;AACA;;AACA;;AAjBA;AACA;AACA;;AAIA;AACA;AACA;;AAIA;AACA;AACA;AAKe,SAASA,wBAAT,OAaX;AAAA,MAb8C;AACjDC,IAAAA,UADiD;AAEjDC,IAAAA,oBAFiD;AAGjDC,IAAAA,iBAHiD;AAIjDC,IAAAA,qBAJiD;AAKjDC,IAAAA,oBALiD;AAMjDC,IAAAA,wBANiD;AAOjDC,IAAAA,WAPiD;AAQjDC,IAAAA,kBARiD;AASjDC,IAAAA,SATiD;AAUjDC,IAAAA,oBAViD;AAWjDC,IAAAA,0BAXiD;AAYjDC,IAAAA;AAZiD,GAa9C;AACH,QAAMC,kBAAkB,GAAG,yBAC1B,2CAD0B,EAE1B;AACC,kBAAcJ;AADf,GAF0B,CAA3B;AAOA,QAAMK,oBAAoB,GAAG,CAAE,KAAF,EAAS,QAAT,EAAmB,KAAnB,EAA0B,UAA1B,CAA7B;AACA,QAAMC,yBAAyB,GAC9BR,WAAW,CAACS,MAAZ,KAAuB,CAAvB,IACAF,oBAAoB,CAACG,QAArB,CAA+BV,WAAW,CAAE,CAAF,CAAX,CAAiBW,IAAjB,CAAsBC,WAAtB,EAA/B,CAFD;AAGA,QAAMC,0BAA0B,GAC/BlB,oBAAoB,IACpB,CAAE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AAO,IAAP;AACA;;AAED,WACC,4BAAC,mBAAD;AACC,MAAA,GAAG,EAAI,GAAGU,UAAU,CAACG,EAAI,IAAIH,UAAU,CAACV,IAAM,EAD/C;AAEC,MAAA,SAAS,EAAGZ,wBAAwB,CACnCsB,UADmC,EAEnCC,KAFmC,CAFrC;AAMC,MAAA,UAAU,EAAGD,UANd;AAOC,MAAA,KAAK,EAAGC,KAPT;AAQC,MAAA,OAAO,EAAG,MAAM;AACfzB,QAAAA,qBAAqB,CAAEwB,UAAF,CAArB;AACA,OAVF;AAWC,MAAA,UAAU,EAAGC,KAAK,KAAKrB,kBAXxB;AAYC,MAAA,KAAK,EAAGM,oBAAoB,CAACG,QAArB,CACPW,UAAU,CAACV,IAAX,CAAgBC,WAAhB,EADO,CAZT;AAeC,MAAA,UAAU,EAAGhB,iBAfd;AAgBC,MAAA,cAAc,EAAGkB,0BAhBlB;AAiBC,MAAA,WAAW,EAAGO,UAAH,aAAGA,UAAH,uBAAGA,UAAU,CAAEI;AAjB3B,MADD;AAqBA,GApDC,CALH,CAFD,CADD;AAgEA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { VisuallyHidden } from '@wordpress/components';\n\n/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { createElement, Fragment } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport LinkControlSearchCreate from './search-create-button';\nimport LinkControlSearchItem from './search-item';\nimport { CREATE_TYPE } from './constants';\n\nexport default function LinkControlSearchResults( {\n\tinstanceId,\n\twithCreateSuggestion,\n\tcurrentInputValue,\n\thandleSuggestionClick,\n\tsuggestionsListProps,\n\tbuildSuggestionItemProps,\n\tsuggestions,\n\tselectedSuggestion,\n\tisLoading,\n\tisInitialSuggestions,\n\tcreateSuggestionButtonText,\n\tsuggestionsQuery,\n} ) {\n\tconst resultsListClasses = classnames(\n\t\t'block-editor-link-control__search-results',\n\t\t{\n\t\t\t'is-loading': isLoading,\n\t\t}\n\t);\n\n\tconst directLinkEntryTypes = [ 'url', 'mailto', 'tel', 'internal' ];\n\tconst isSingleDirectEntryResult =\n\t\tsuggestions.length === 1 &&\n\t\tdirectLinkEntryTypes.includes( suggestions[ 0 ].type.toLowerCase() );\n\tconst shouldShowCreateSuggestion =\n\t\twithCreateSuggestion &&\n\t\t! isSingleDirectEntryResult &&\n\t\t! isInitialSuggestions;\n\t// If the query has a specified type, then we can skip showing them in the result. See #24839.\n\tconst shouldShowSuggestionsTypes = ! suggestionsQuery?.type;\n\n\t// According to guidelines aria-label should be added if the label\n\t// itself is not visible.\n\t// See: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/listbox_role\n\tconst searchResultsLabelId = `block-editor-link-control-search-results-label-${ instanceId }`;\n\tconst labelText = isInitialSuggestions\n\t\t? __( 'Recently updated' )\n\t\t: sprintf(\n\t\t\t\t/* translators: %s: search term. */\n\t\t\t\t__( 'Search results for \"%s\"' ),\n\t\t\t\tcurrentInputValue\n\t\t );\n\n\t// VisuallyHidden rightly doesn't accept custom classNames\n\t// so we conditionally render it as a wrapper to visually hide the label\n\t// when that is required.\n\tconst searchResultsLabel = createElement(\n\t\tisInitialSuggestions ? Fragment : VisuallyHidden,\n\t\t{}, //
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/link-control/search-results.js"],"names":["LinkControlSearchResults","instanceId","withCreateSuggestion","currentInputValue","handleSuggestionClick","suggestionsListProps","buildSuggestionItemProps","suggestions","selectedSuggestion","isLoading","isInitialSuggestions","createSuggestionButtonText","suggestionsQuery","resultsListClasses","directLinkEntryTypes","isSingleDirectEntryResult","length","includes","type","toLowerCase","shouldShowCreateSuggestion","shouldShowSuggestionsTypes","searchResultsLabelId","labelText","searchResultsLabel","Fragment","VisuallyHidden","map","suggestion","index","CREATE_TYPE","id","isFrontPage"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AAKA;;AACA;;AACA;;AAjBA;AACA;AACA;;AAIA;AAC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U,EAAGhB,iBAfd;AAgBC,MAAA,cAAc,EAAGkB,0BAhBlB;AAiBC,MAAA,WAAW,EAAGO,UAAH,aAAGA,UAAH,uBAAGA,UAAU,CAAEI;AAjB3B,MADD;AAqBA,GApDC,CALH,CAFD,CADD;AAgEA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { VisuallyHidden } from '@wordpress/components';\n\n/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { createElement, Fragment } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport LinkControlSearchCreate from './search-create-button';\nimport LinkControlSearchItem from './search-item';\nimport { CREATE_TYPE } from './constants';\n\nexport default function LinkControlSearchResults( {\n\tinstanceId,\n\twithCreateSuggestion,\n\tcurrentInputValue,\n\thandleSuggestionClick,\n\tsuggestionsListProps,\n\tbuildSuggestionItemProps,\n\tsuggestions,\n\tselectedSuggestion,\n\tisLoading,\n\tisInitialSuggestions,\n\tcreateSuggestionButtonText,\n\tsuggestionsQuery,\n} ) {\n\tconst resultsListClasses = classnames(\n\t\t'block-editor-link-control__search-results',\n\t\t{\n\t\t\t'is-loading': isLoading,\n\t\t}\n\t);\n\n\tconst directLinkEntryTypes = [ 'url', 'mailto', 'tel', 'internal' ];\n\tconst isSingleDirectEntryResult =\n\t\tsuggestions.length === 1 &&\n\t\tdirectLinkEntryTypes.includes( suggestions[ 0 ].type.toLowerCase() );\n\tconst shouldShowCreateSuggestion =\n\t\twithCreateSuggestion &&\n\t\t! isSingleDirectEntryResult &&\n\t\t! isInitialSuggestions;\n\t// If the query has a specified type, then we can skip showing them in the result. See #24839.\n\tconst shouldShowSuggestionsTypes = ! suggestionsQuery?.type;\n\n\t// According to guidelines aria-label should be added if the label\n\t// itself is not visible.\n\t// See: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/listbox_role\n\tconst searchResultsLabelId = `block-editor-link-control-search-results-label-${ instanceId }`;\n\tconst labelText = isInitialSuggestions\n\t\t? __( 'Recently updated' )\n\t\t: sprintf(\n\t\t\t\t/* translators: %s: search term. */\n\t\t\t\t__( 'Search results for \"%s\"' ),\n\t\t\t\tcurrentInputValue\n\t\t );\n\n\t// VisuallyHidden rightly doesn't accept custom classNames\n\t// so we conditionally render it as a wrapper to visually hide the label\n\t// when that is required.\n\tconst searchResultsLabel = createElement(\n\t\tisInitialSuggestions ? Fragment : VisuallyHidden,\n\t\t{}, // Empty props.\n\t\t<span\n\t\t\tclassName=\"block-editor-link-control__search-results-label\"\n\t\t\tid={ searchResultsLabelId }\n\t\t>\n\t\t\t{ labelText }\n\t\t</span>\n\t);\n\n\treturn (\n\t\t<div className=\"block-editor-link-control__search-results-wrapper\">\n\t\t\t{ searchResultsLabel }\n\t\t\t<div\n\t\t\t\t{ ...suggestionsListProps }\n\t\t\t\tclassName={ resultsListClasses }\n\t\t\t\taria-labelledby={ searchResultsLabelId }\n\t\t\t>\n\t\t\t\t{ suggestions.map( ( suggestion, index ) => {\n\t\t\t\t\tif (\n\t\t\t\t\t\tshouldShowCreateSuggestion &&\n\t\t\t\t\t\tCREATE_TYPE === suggestion.type\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<LinkControlSearchCreate\n\t\t\t\t\t\t\t\tsearchTerm={ currentInputValue }\n\t\t\t\t\t\t\t\tbuttonText={ createSuggestionButtonText }\n\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\thandleSuggestionClick( suggestion )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t// Intentionally only using `type` here as\n\t\t\t\t\t\t\t\t// the constant is enough to uniquely\n\t\t\t\t\t\t\t\t// identify the single \"CREATE\" suggestion.\n\t\t\t\t\t\t\t\tkey={ suggestion.type }\n\t\t\t\t\t\t\t\titemProps={ buildSuggestionItemProps(\n\t\t\t\t\t\t\t\t\tsuggestion,\n\t\t\t\t\t\t\t\t\tindex\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tisSelected={ index === selectedSuggestion }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\t// If we're not handling \"Create\" suggestions above then\n\t\t\t\t\t// we don't want them in the main results so exit early.\n\t\t\t\t\tif ( CREATE_TYPE === suggestion.type ) {\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<LinkControlSearchItem\n\t\t\t\t\t\t\tkey={ `${ suggestion.id }-${ suggestion.type }` }\n\t\t\t\t\t\t\titemProps={ buildSuggestionItemProps(\n\t\t\t\t\t\t\t\tsuggestion,\n\t\t\t\t\t\t\t\tindex\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tsuggestion={ suggestion }\n\t\t\t\t\t\t\tindex={ index }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\thandleSuggestionClick( suggestion );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tisSelected={ index === selectedSuggestion }\n\t\t\t\t\t\t\tisURL={ directLinkEntryTypes.includes(\n\t\t\t\t\t\t\t\tsuggestion.type.toLowerCase()\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tsearchTerm={ currentInputValue }\n\t\t\t\t\t\t\tshouldShowType={ shouldShowSuggestionsTypes }\n\t\t\t\t\t\t\tisFrontPage={ suggestion?.isFrontPage }\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t} ) }\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/link-control/use-rich-url-data.js"],"names":["reducer","state","action","type","isFetching","richData","Error","useRemoteUrlData","url","dispatch","fetchRichUrlData","select","getSettings","blockEditorStore","__experimentalFetchRichUrlData","length","AbortController","controller","window","signal","then","urlData","catch","aborted","abort"],"mappings":";;;;;;;AAGA;;AAKA;;AACA;;AATA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,eAAX,EAAnB;AAEA,YAAMG,MAAM,GAAGF,UAAU,CAACE,MAA1B;AAEAT,MAAAA,gBAAgB,CAAEF,GAAF,EAAO;AACtBW,QAAAA;AADsB,OAAP,CAAhB,CAGEC,IAHF,CAGUC,OAAF,IAAe;AACrBZ,QAAAA,QAAQ,CAAE;AACTN,UAAAA,IAAI,EAAE,UADG;AAETE,UAAAA,QAAQ,EAAEgB;AAFD,SAAF,CAAR;AAIA,OARF,EASEC,KATF,CASS,MAAM;AACb;AACA,YAAK,CAAEH,MAAM,CAACI,OAAd,EAAwB;AACvBd,UAAAA,QAAQ,CAAE;AACTN,YAAAA,IAAI,EAAE;AADG,WAAF,CAAR;AAGA;AACD,OAhBF,EATC,CA0BD;;AACA,aAAO,MAAM;AACZc,QAAAA,UAAU,CAACO,KAAX;AACA,OAFD;AAGA;AACD,GAvCD,EAuCG,CAAEhB,GAAF,CAvCH;AAyCA,SAAOP,KAAP;AACA;;eAEcM,gB","sourcesContent":["/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useEffect, useReducer } from '@wordpress/element';\n\nfunction reducer( state, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'RESOLVED':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tisFetching: false,\n\t\t\t\trichData: action.richData,\n\t\t\t};\n\t\tcase 'ERROR':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tisFetching: false,\n\t\t\t\trichData: null,\n\t\t\t};\n\t\tcase 'LOADING':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tisFetching: true,\n\t\t\t};\n\t\tdefault:\n\t\t\tthrow new Error( `Unexpected action type ${ action.type }` );\n\t}\n}\n\nfunction useRemoteUrlData( url ) {\n\tconst [ state, dispatch ] = useReducer( reducer, {\n\t\trichData: null,\n\t\tisFetching: false,\n\t} );\n\n\tconst { fetchRichUrlData } = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn {\n\t\t\tfetchRichUrlData: getSettings().__experimentalFetchRichUrlData,\n\t\t};\n\t}, [] );\n\n\tuseEffect( () => {\n\t\t// Only make the request if we have an actual URL\n\t\t// and the fetching util is available. In some editors\n\t\t// there may not be such a util.\n\t\tif (\n\t\t\turl?.length &&\n\t\t\tfetchRichUrlData &&\n\t\t\ttypeof AbortController !== 'undefined'\n\t\t) {\n\t\t\tdispatch( {\n\t\t\t\ttype: 'LOADING',\n\t\t\t} );\n\n\t\t\tconst controller = new window.AbortController();\n\n\t\t\tconst signal = controller.signal;\n\n\t\t\tfetchRichUrlData( url, {\n\t\t\t\tsignal,\n\t\t\t} )\n\t\t\t\t.then( ( urlData ) => {\n\t\t\t\t\tdispatch( {\n\t\t\t\t\t\ttype: 'RESOLVED',\n\t\t\t\t\t\trichData: urlData,\n\t\t\t\t\t} );\n\t\t\t\t} )\n\t\t\t\t.catch( () => {\n\t\t\t\t\t// Avoid setting state on unmounted component\n\t\t\t\t\tif ( ! signal.aborted ) {\n\t\t\t\t\t\tdispatch( {\n\t\t\t\t\t\t\ttype: 'ERROR',\n\t\t\t\t\t\t} );\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t// Cleanup: when the URL changes the abort the current request
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/link-control/use-rich-url-data.js"],"names":["reducer","state","action","type","isFetching","richData","Error","useRemoteUrlData","url","dispatch","fetchRichUrlData","select","getSettings","blockEditorStore","__experimentalFetchRichUrlData","length","AbortController","controller","window","signal","then","urlData","catch","aborted","abort"],"mappings":";;;;;;;AAGA;;AAKA;;AACA;;AATA;AACA;AACA;;AAGA;AACA;AACA;AAIA,SAASA,OAAT,CAAkBC,KAAlB,EAAyBC,MAAzB,EAAkC;AACjC,UAASA,MAAM,CAACC,IAAhB;AACC,SAAK,UAAL;AACC,aAAO,EACN,GAAGF,KADG;AAENG,QAAAA,UAAU,EAAE,KAFN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,CAAE;AACTN,UAAAA,IAAI,EAAE,UADG;AAETE,UAAAA,QAAQ,EAAEgB;AAFD,SAAF,CAAR;AAIA,OARF,EASEC,KATF,CASS,MAAM;AACb;AACA,YAAK,CAAEH,MAAM,CAACI,OAAd,EAAwB;AACvBd,UAAAA,QAAQ,CAAE;AACTN,YAAAA,IAAI,EAAE;AADG,WAAF,CAAR;AAGA;AACD,OAhBF,EATC,CA0BD;;AACA,aAAO,MAAM;AACZc,QAAAA,UAAU,CAACO,KAAX;AACA,OAFD;AAGA;AACD,GAvCD,EAuCG,CAAEhB,GAAF,CAvCH;AAyCA,SAAOP,KAAP;AACA;;eAEcM,gB","sourcesContent":["/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useEffect, useReducer } from '@wordpress/element';\n\nfunction reducer( state, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'RESOLVED':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tisFetching: false,\n\t\t\t\trichData: action.richData,\n\t\t\t};\n\t\tcase 'ERROR':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tisFetching: false,\n\t\t\t\trichData: null,\n\t\t\t};\n\t\tcase 'LOADING':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tisFetching: true,\n\t\t\t};\n\t\tdefault:\n\t\t\tthrow new Error( `Unexpected action type ${ action.type }` );\n\t}\n}\n\nfunction useRemoteUrlData( url ) {\n\tconst [ state, dispatch ] = useReducer( reducer, {\n\t\trichData: null,\n\t\tisFetching: false,\n\t} );\n\n\tconst { fetchRichUrlData } = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn {\n\t\t\tfetchRichUrlData: getSettings().__experimentalFetchRichUrlData,\n\t\t};\n\t}, [] );\n\n\tuseEffect( () => {\n\t\t// Only make the request if we have an actual URL\n\t\t// and the fetching util is available. In some editors\n\t\t// there may not be such a util.\n\t\tif (\n\t\t\turl?.length &&\n\t\t\tfetchRichUrlData &&\n\t\t\ttypeof AbortController !== 'undefined'\n\t\t) {\n\t\t\tdispatch( {\n\t\t\t\ttype: 'LOADING',\n\t\t\t} );\n\n\t\t\tconst controller = new window.AbortController();\n\n\t\t\tconst signal = controller.signal;\n\n\t\t\tfetchRichUrlData( url, {\n\t\t\t\tsignal,\n\t\t\t} )\n\t\t\t\t.then( ( urlData ) => {\n\t\t\t\t\tdispatch( {\n\t\t\t\t\t\ttype: 'RESOLVED',\n\t\t\t\t\t\trichData: urlData,\n\t\t\t\t\t} );\n\t\t\t\t} )\n\t\t\t\t.catch( () => {\n\t\t\t\t\t// Avoid setting state on unmounted component\n\t\t\t\t\tif ( ! signal.aborted ) {\n\t\t\t\t\t\tdispatch( {\n\t\t\t\t\t\t\ttype: 'ERROR',\n\t\t\t\t\t\t} );\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t// Cleanup: when the URL changes the abort the current request.\n\t\t\treturn () => {\n\t\t\t\tcontroller.abort();\n\t\t\t};\n\t\t}\n\t}, [ url ] );\n\n\treturn state;\n}\n\nexport default useRemoteUrlData;\n"]}
|
|
@@ -113,9 +113,9 @@ const handleEntitySearch = async (val, suggestionsQuery, fetchSearchSuggestions,
|
|
|
113
113
|
// is never exposed as part of the component's public API.
|
|
114
114
|
// see: https://github.com/WordPress/gutenberg/pull/19775#discussion_r378931316.
|
|
115
115
|
title: val,
|
|
116
|
-
//
|
|
116
|
+
// Must match the existing `<input>`s text value.
|
|
117
117
|
url: val,
|
|
118
|
-
//
|
|
118
|
+
// Must match the existing `<input>`s text value.
|
|
119
119
|
type: _constants.CREATE_TYPE
|
|
120
120
|
});
|
|
121
121
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/link-control/use-search-handler.js"],"names":["handleNoop","Promise","resolve","handleDirectEntry","val","type","protocol","includes","id","title","url","handleEntitySearch","suggestionsQuery","fetchSearchSuggestions","directEntryHandler","withCreateSuggestion","withURLSuggestion","pageOnFront","isInitialSuggestions","resultsIncludeFrontPage","results","all","map","result","Number","isFrontPage","couldBeURL","concat","CREATE_TYPE","useSearchHandler","allowDirectEntry","select","getSettings","blockEditorStore","__experimentalFetchLinkSuggestions"],"mappings":";;;;;;;;;;AAGA;;AACA;;AACA;;AAKA;;AAKA;;AACA;;AACA;;AAjBA;AACA;AACA;;AAKA;AACA;AACA;;AAGA;AACA;AACA;AAKO,MAAMA,UAAU,GAAG,MAAMC,OAAO,CAACC,OAAR,CAAiB,EAAjB,CAAzB;;;;AAEA,MAAMC,iBAAiB,GAAKC,GAAF,IAAW;AAC3C,MAAIC,IAAI,GAAG,KAAX;AAEA,QAAMC,QAAQ,GAAG,sBAAaF,GAAb,KAAsB,EAAvC;;AAEA,MAAKE,QAAQ,CAACC,QAAT,CAAmB,QAAnB,CAAL,EAAqC;AACpCF,IAAAA,IAAI,GAAG,QAAP;AACA;;AAED,MAAKC,QAAQ,CAACC,QAAT,CAAmB,KAAnB,CAAL,EAAkC;AACjCF,IAAAA,IAAI,GAAG,KAAP;AACA;;AAED,MAAK,wBAAYD,GAAZ,EAAiB,GAAjB,CAAL,EAA8B;AAC7BC,IAAAA,IAAI,GAAG,UAAP;AACA;;AAED,SAAOJ,OAAO,CAACC,OAAR,CAAiB,CACvB;AACCM,IAAAA,EAAE,EAAEJ,GADL;AAECK,IAAAA,KAAK,EAAEL,GAFR;AAGCM,IAAAA,GAAG,EAAEL,IAAI,KAAK,KAAT,GAAiB,sBAAaD,GAAb,CAAjB,GAAsCA,GAH5C;AAICC,IAAAA;AAJD,GADuB,CAAjB,CAAP;AAQA,CAzBM;;;;AA2BP,MAAMM,kBAAkB,GAAG,OAC1BP,GAD0B,EAE1BQ,gBAF0B,EAG1BC,sBAH0B,EAI1BC,kBAJ0B,EAK1BC,oBAL0B,EAM1BC,iBAN0B,EAO1BC,WAP0B,KAQtB;AACJ,QAAM;AAAEC,IAAAA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C,IAAAA,IAAI,EAAEuB;AANU,GAAhB,CAFH;AAUA,CAzED;;AA2Ee,SAASC,gBAAT,CACdjB,gBADc,EAEdkB,gBAFc,EAGdf,oBAHc,EAIdC,iBAJc,EAKb;AACD,QAAM;AAAEH,IAAAA,sBAAF;AAA0BI,IAAAA;AAA1B,MAA0C,qBAAac,MAAF,IAAc;AACxE,UAAM;AAAEC,MAAAA;AAAF,QAAkBD,MAAM,CAAEE,YAAF,CAA9B;AAEA,WAAO;AACNhB,MAAAA,WAAW,EAAEe,WAAW,GAAGf,WADrB;AAENJ,MAAAA,sBAAsB,EAAEmB,WAAW,GACjCE;AAHI,KAAP;AAKA,GAR+C,EAQ7C,EAR6C,CAAhD;AAUA,QAAMpB,kBAAkB,GAAGgB,gBAAgB,GACxC3B,iBADwC,GAExCH,UAFH;AAIA,SAAO,0BACN,CAAEI,GAAF,WAAqC;AAAA,QAA9B;AAAEc,MAAAA;AAAF,KAA8B;AACpC,WAAO,wBAAWd,GAAX,IACJU,kBAAkB,CAAEV,GAAF,EAAO;AAAEc,MAAAA;AAAF,KAAP,CADd,GAEJP,kBAAkB,CAClBP,GADkB,EAElB,EAAE,GAAGQ,gBAAL;AAAuBM,MAAAA;AAAvB,KAFkB,EAGlBL,sBAHkB,EAIlBC,kBAJkB,EAKlBC,oBALkB,EAMlBC,iBANkB,EAOlBC,WAPkB,CAFrB;AAWA,GAbK,EAcN,CAAEH,kBAAF,EAAsBD,sBAAtB,EAA8CE,oBAA9C,CAdM,CAAP;AAgBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { getProtocol, prependHTTP } from '@wordpress/url';\nimport { useCallback } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * External dependencies\n */\nimport { startsWith } from 'lodash';\n\n/**\n * Internal dependencies\n */\nimport isURLLike from './is-url-like';\nimport { CREATE_TYPE } from './constants';\nimport { store as blockEditorStore } from '../../store';\n\nexport const handleNoop = () => Promise.resolve( [] );\n\nexport const handleDirectEntry = ( val ) => {\n\tlet type = 'URL';\n\n\tconst protocol = getProtocol( val ) || '';\n\n\tif ( protocol.includes( 'mailto' ) ) {\n\t\ttype = 'mailto';\n\t}\n\n\tif ( protocol.includes( 'tel' ) ) {\n\t\ttype = 'tel';\n\t}\n\n\tif ( startsWith( val, '#' ) ) {\n\t\ttype = 'internal';\n\t}\n\n\treturn Promise.resolve( [\n\t\t{\n\t\t\tid: val,\n\t\t\ttitle: val,\n\t\t\turl: type === 'URL' ? prependHTTP( val ) : val,\n\t\t\ttype,\n\t\t},\n\t] );\n};\n\nconst handleEntitySearch = async (\n\tval,\n\tsuggestionsQuery,\n\tfetchSearchSuggestions,\n\tdirectEntryHandler,\n\twithCreateSuggestion,\n\twithURLSuggestion,\n\tpageOnFront\n) => {\n\tconst { isInitialSuggestions } = suggestionsQuery;\n\tlet resultsIncludeFrontPage = false;\n\n\tlet results = await Promise.all( [\n\t\tfetchSearchSuggestions( val, suggestionsQuery ),\n\t\tdirectEntryHandler( val ),\n\t] );\n\n\t// Identify front page and update type to match.\n\tresults[ 0 ] = results[ 0 ].map( ( result ) => {\n\t\tif ( Number( result.id ) === pageOnFront ) {\n\t\t\tresultsIncludeFrontPage = true;\n\t\t\tresult.isFrontPage = true;\n\t\t\treturn result;\n\t\t}\n\n\t\treturn result;\n\t} );\n\n\tconst couldBeURL = ! val.includes( ' ' );\n\n\t// If it's potentially a URL search then concat on a URL search suggestion\n\t// just for good measure. That way once the actual results run out we always\n\t// have a URL option to fallback on.\n\tif (\n\t\t! resultsIncludeFrontPage &&\n\t\tcouldBeURL &&\n\t\twithURLSuggestion &&\n\t\t! isInitialSuggestions\n\t) {\n\t\tresults = results[ 0 ].concat( results[ 1 ] );\n\t} else {\n\t\tresults = results[ 0 ];\n\t}\n\n\t// If displaying initial suggestions just return plain results.\n\tif ( isInitialSuggestions ) {\n\t\treturn results;\n\t}\n\n\t// Here we append a faux suggestion to represent a \"CREATE\" option. This\n\t// is detected in the rendering of the search results and handled as a\n\t// special case. This is currently necessary because the suggestions\n\t// dropdown will only appear if there are valid suggestions and\n\t// therefore unless the create option is a suggestion it will not\n\t// display in scenarios where there are no results returned from the\n\t// API. In addition promoting CREATE to a first class suggestion affords\n\t// the a11y benefits afforded by `URLInput` to all suggestions (eg:\n\t// keyboard handling, ARIA roles...etc).\n\t//\n\t// Note also that the value of the `title` and `url` properties must correspond\n\t// to the text value of the `<input>`. This is because `title` is used\n\t// when creating the suggestion. Similarly `url` is used when using keyboard to select\n\t// the suggestion (the <form> `onSubmit` handler falls-back to `url`).\n\treturn isURLLike( val ) || ! withCreateSuggestion\n\t\t? results\n\t\t: results.concat( {\n\t\t\t\t// the `id` prop is intentionally ommitted here because it\n\t\t\t\t// is never exposed as part of the component's public API.\n\t\t\t\t// see: https://github.com/WordPress/gutenberg/pull/19775#discussion_r378931316.\n\t\t\t\ttitle: val, //
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/link-control/use-search-handler.js"],"names":["handleNoop","Promise","resolve","handleDirectEntry","val","type","protocol","includes","id","title","url","handleEntitySearch","suggestionsQuery","fetchSearchSuggestions","directEntryHandler","withCreateSuggestion","withURLSuggestion","pageOnFront","isInitialSuggestions","resultsIncludeFrontPage","results","all","map","result","Number","isFrontPage","couldBeURL","concat","CREATE_TYPE","useSearchHandler","allowDirectEntry","select","getSettings","blockEditorStore","__experimentalFetchLinkSuggestions"],"mappings":";;;;;;;;;;AAGA;;AACA;;AACA;;AAKA;;AAKA;;AACA;;AACA;;AAjBA;AACA;AACA;;AAKA;AACA;AACA;;AAGA;AACA;AACA;AAKO,MAAMA,UAAU,GAAG,MAAMC,OAAO,CAACC,OAAR,CAAiB,EAAjB,CAAzB;;;;AAEA,MAAMC,iBAAiB,GAAKC,GAAF,IAAW;AAC3C,MAAIC,IAAI,GAAG,KAAX;AAEA,QAAMC,QAAQ,GAAG,sBAAaF,GAAb,KAAsB,EAAvC;;AAEA,MAAKE,QAAQ,CAACC,QAAT,CAAmB,QAAnB,C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AA9B;AAAEc,MAAAA;AAAF,KAA8B;AACpC,WAAO,wBAAWd,GAAX,IACJU,kBAAkB,CAAEV,GAAF,EAAO;AAAEc,MAAAA;AAAF,KAAP,CADd,GAEJP,kBAAkB,CAClBP,GADkB,EAElB,EAAE,GAAGQ,gBAAL;AAAuBM,MAAAA;AAAvB,KAFkB,EAGlBL,sBAHkB,EAIlBC,kBAJkB,EAKlBC,oBALkB,EAMlBC,iBANkB,EAOlBC,WAPkB,CAFrB;AAWA,GAbK,EAcN,CAAEH,kBAAF,EAAsBD,sBAAtB,EAA8CE,oBAA9C,CAdM,CAAP;AAgBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { getProtocol, prependHTTP } from '@wordpress/url';\nimport { useCallback } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * External dependencies\n */\nimport { startsWith } from 'lodash';\n\n/**\n * Internal dependencies\n */\nimport isURLLike from './is-url-like';\nimport { CREATE_TYPE } from './constants';\nimport { store as blockEditorStore } from '../../store';\n\nexport const handleNoop = () => Promise.resolve( [] );\n\nexport const handleDirectEntry = ( val ) => {\n\tlet type = 'URL';\n\n\tconst protocol = getProtocol( val ) || '';\n\n\tif ( protocol.includes( 'mailto' ) ) {\n\t\ttype = 'mailto';\n\t}\n\n\tif ( protocol.includes( 'tel' ) ) {\n\t\ttype = 'tel';\n\t}\n\n\tif ( startsWith( val, '#' ) ) {\n\t\ttype = 'internal';\n\t}\n\n\treturn Promise.resolve( [\n\t\t{\n\t\t\tid: val,\n\t\t\ttitle: val,\n\t\t\turl: type === 'URL' ? prependHTTP( val ) : val,\n\t\t\ttype,\n\t\t},\n\t] );\n};\n\nconst handleEntitySearch = async (\n\tval,\n\tsuggestionsQuery,\n\tfetchSearchSuggestions,\n\tdirectEntryHandler,\n\twithCreateSuggestion,\n\twithURLSuggestion,\n\tpageOnFront\n) => {\n\tconst { isInitialSuggestions } = suggestionsQuery;\n\tlet resultsIncludeFrontPage = false;\n\n\tlet results = await Promise.all( [\n\t\tfetchSearchSuggestions( val, suggestionsQuery ),\n\t\tdirectEntryHandler( val ),\n\t] );\n\n\t// Identify front page and update type to match.\n\tresults[ 0 ] = results[ 0 ].map( ( result ) => {\n\t\tif ( Number( result.id ) === pageOnFront ) {\n\t\t\tresultsIncludeFrontPage = true;\n\t\t\tresult.isFrontPage = true;\n\t\t\treturn result;\n\t\t}\n\n\t\treturn result;\n\t} );\n\n\tconst couldBeURL = ! val.includes( ' ' );\n\n\t// If it's potentially a URL search then concat on a URL search suggestion\n\t// just for good measure. That way once the actual results run out we always\n\t// have a URL option to fallback on.\n\tif (\n\t\t! resultsIncludeFrontPage &&\n\t\tcouldBeURL &&\n\t\twithURLSuggestion &&\n\t\t! isInitialSuggestions\n\t) {\n\t\tresults = results[ 0 ].concat( results[ 1 ] );\n\t} else {\n\t\tresults = results[ 0 ];\n\t}\n\n\t// If displaying initial suggestions just return plain results.\n\tif ( isInitialSuggestions ) {\n\t\treturn results;\n\t}\n\n\t// Here we append a faux suggestion to represent a \"CREATE\" option. This\n\t// is detected in the rendering of the search results and handled as a\n\t// special case. This is currently necessary because the suggestions\n\t// dropdown will only appear if there are valid suggestions and\n\t// therefore unless the create option is a suggestion it will not\n\t// display in scenarios where there are no results returned from the\n\t// API. In addition promoting CREATE to a first class suggestion affords\n\t// the a11y benefits afforded by `URLInput` to all suggestions (eg:\n\t// keyboard handling, ARIA roles...etc).\n\t//\n\t// Note also that the value of the `title` and `url` properties must correspond\n\t// to the text value of the `<input>`. This is because `title` is used\n\t// when creating the suggestion. Similarly `url` is used when using keyboard to select\n\t// the suggestion (the <form> `onSubmit` handler falls-back to `url`).\n\treturn isURLLike( val ) || ! withCreateSuggestion\n\t\t? results\n\t\t: results.concat( {\n\t\t\t\t// the `id` prop is intentionally ommitted here because it\n\t\t\t\t// is never exposed as part of the component's public API.\n\t\t\t\t// see: https://github.com/WordPress/gutenberg/pull/19775#discussion_r378931316.\n\t\t\t\ttitle: val, // Must match the existing `<input>`s text value.\n\t\t\t\turl: val, // Must match the existing `<input>`s text value.\n\t\t\t\ttype: CREATE_TYPE,\n\t\t } );\n};\n\nexport default function useSearchHandler(\n\tsuggestionsQuery,\n\tallowDirectEntry,\n\twithCreateSuggestion,\n\twithURLSuggestion\n) {\n\tconst { fetchSearchSuggestions, pageOnFront } = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\n\t\treturn {\n\t\t\tpageOnFront: getSettings().pageOnFront,\n\t\t\tfetchSearchSuggestions: getSettings()\n\t\t\t\t.__experimentalFetchLinkSuggestions,\n\t\t};\n\t}, [] );\n\n\tconst directEntryHandler = allowDirectEntry\n\t\t? handleDirectEntry\n\t\t: handleNoop;\n\n\treturn useCallback(\n\t\t( val, { isInitialSuggestions } ) => {\n\t\t\treturn isURLLike( val )\n\t\t\t\t? directEntryHandler( val, { isInitialSuggestions } )\n\t\t\t\t: handleEntitySearch(\n\t\t\t\t\t\tval,\n\t\t\t\t\t\t{ ...suggestionsQuery, isInitialSuggestions },\n\t\t\t\t\t\tfetchSearchSuggestions,\n\t\t\t\t\t\tdirectEntryHandler,\n\t\t\t\t\t\twithCreateSuggestion,\n\t\t\t\t\t\twithURLSuggestion,\n\t\t\t\t\t\tpageOnFront\n\t\t\t\t );\n\t\t},\n\t\t[ directEntryHandler, fetchSearchSuggestions, withCreateSuggestion ]\n\t);\n}\n"]}
|
|
@@ -42,6 +42,7 @@ const ListViewBlockContents = (0, _element.forwardRef)((_ref, ref) => {
|
|
|
42
42
|
siblingBlockCount,
|
|
43
43
|
level,
|
|
44
44
|
isExpanded,
|
|
45
|
+
selectedClientIds,
|
|
45
46
|
...props
|
|
46
47
|
} = _ref;
|
|
47
48
|
const {
|
|
@@ -52,12 +53,10 @@ const ListViewBlockContents = (0, _element.forwardRef)((_ref, ref) => {
|
|
|
52
53
|
selectedBlockInBlockEditor
|
|
53
54
|
} = (0, _data.useSelect)(select => {
|
|
54
55
|
const {
|
|
55
|
-
getBlockRootClientId,
|
|
56
56
|
hasBlockMovingClientId,
|
|
57
57
|
getSelectedBlockClientId
|
|
58
58
|
} = select(_store.store);
|
|
59
59
|
return {
|
|
60
|
-
rootClientId: getBlockRootClientId(clientId) || '',
|
|
61
60
|
blockMovingClientId: hasBlockMovingClientId(),
|
|
62
61
|
selectedBlockInBlockEditor: getSelectedBlockClientId()
|
|
63
62
|
};
|
|
@@ -65,9 +64,14 @@ const ListViewBlockContents = (0, _element.forwardRef)((_ref, ref) => {
|
|
|
65
64
|
const isBlockMoveTarget = blockMovingClientId && selectedBlockInBlockEditor === clientId;
|
|
66
65
|
const className = (0, _classnames.default)('block-editor-list-view-block-contents', {
|
|
67
66
|
'is-dropping-before': isBlockMoveTarget
|
|
68
|
-
});
|
|
67
|
+
}); // Only include all selected blocks if the currently clicked on block
|
|
68
|
+
// is one of the selected blocks. This ensures that if a user attempts
|
|
69
|
+
// to drag a block that isn't part of the selection, they're still able
|
|
70
|
+
// to drag it and rearrange its position.
|
|
71
|
+
|
|
72
|
+
const draggableClientIds = selectedClientIds.includes(clientId) ? selectedClientIds : [clientId];
|
|
69
73
|
return (0, _element.createElement)(_blockDraggable.default, {
|
|
70
|
-
clientIds:
|
|
74
|
+
clientIds: draggableClientIds
|
|
71
75
|
}, _ref2 => {
|
|
72
76
|
let {
|
|
73
77
|
draggable,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/list-view/block-contents.js"],"names":["ListViewBlockContents","ref","onClick","onToggleExpanded","block","isSelected","position","siblingBlockCount","level","isExpanded","props","clientId","blockMovingClientId","selectedBlockInBlockEditor","select","
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/list-view/block-contents.js"],"names":["ListViewBlockContents","ref","onClick","onToggleExpanded","block","isSelected","position","siblingBlockCount","level","isExpanded","selectedClientIds","props","clientId","blockMovingClientId","selectedBlockInBlockEditor","select","hasBlockMovingClientId","getSelectedBlockClientId","blockEditorStore","isBlockMoveTarget","className","draggable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ACC,MAAA,GAAG,EAAGxB,GADP;AAEC,MAAA,SAAS,EAAGmB,SAFb;AAGC,MAAA,KAAK,EAAGhB,KAHT;AAIC,MAAA,OAAO,EAAGF,OAJX;AAKC,MAAA,gBAAgB,EAAGC,gBALpB;AAMC,MAAA,UAAU,EAAGE,UANd;AAOC,MAAA,QAAQ,EAAGC,QAPZ;AAQC,MAAA,iBAAiB,EAAGC,iBARrB;AASC,MAAA,KAAK,EAAGC,KATT;AAUC,MAAA,SAAS,EAAGe,SAVb;AAWC,MAAA,WAAW,EAAGC,WAXf;AAYC,MAAA,SAAS,EAAGC,SAZb;AAaC,MAAA,UAAU,EAAGhB;AAbd,OAcME,KAdN,EADC;AAAA,GADH,CADD;AAsBA,CArE4B,CAA9B;eAwEeX,qB","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport ListViewBlockSelectButton from './block-select-button';\nimport BlockDraggable from '../block-draggable';\nimport { store as blockEditorStore } from '../../store';\n\nconst ListViewBlockContents = forwardRef(\n\t(\n\t\t{\n\t\t\tonClick,\n\t\t\tonToggleExpanded,\n\t\t\tblock,\n\t\t\tisSelected,\n\t\t\tposition,\n\t\t\tsiblingBlockCount,\n\t\t\tlevel,\n\t\t\tisExpanded,\n\t\t\tselectedClientIds,\n\t\t\t...props\n\t\t},\n\t\tref\n\t) => {\n\t\tconst { clientId } = block;\n\n\t\tconst { blockMovingClientId, selectedBlockInBlockEditor } = useSelect(\n\t\t\t( select ) => {\n\t\t\t\tconst {\n\t\t\t\t\thasBlockMovingClientId,\n\t\t\t\t\tgetSelectedBlockClientId,\n\t\t\t\t} = select( blockEditorStore );\n\t\t\t\treturn {\n\t\t\t\t\tblockMovingClientId: hasBlockMovingClientId(),\n\t\t\t\t\tselectedBlockInBlockEditor: getSelectedBlockClientId(),\n\t\t\t\t};\n\t\t\t},\n\t\t\t[ clientId ]\n\t\t);\n\n\t\tconst isBlockMoveTarget =\n\t\t\tblockMovingClientId && selectedBlockInBlockEditor === clientId;\n\n\t\tconst className = classnames( 'block-editor-list-view-block-contents', {\n\t\t\t'is-dropping-before': isBlockMoveTarget,\n\t\t} );\n\n\t\t// Only include all selected blocks if the currently clicked on block\n\t\t// is one of the selected blocks. This ensures that if a user attempts\n\t\t// to drag a block that isn't part of the selection, they're still able\n\t\t// to drag it and rearrange its position.\n\t\tconst draggableClientIds = selectedClientIds.includes( clientId )\n\t\t\t? selectedClientIds\n\t\t\t: [ clientId ];\n\n\t\treturn (\n\t\t\t<BlockDraggable clientIds={ draggableClientIds }>\n\t\t\t\t{ ( { draggable, onDragStart, onDragEnd } ) => (\n\t\t\t\t\t<ListViewBlockSelectButton\n\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\tclassName={ className }\n\t\t\t\t\t\tblock={ block }\n\t\t\t\t\t\tonClick={ onClick }\n\t\t\t\t\t\tonToggleExpanded={ onToggleExpanded }\n\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\tposition={ position }\n\t\t\t\t\t\tsiblingBlockCount={ siblingBlockCount }\n\t\t\t\t\t\tlevel={ level }\n\t\t\t\t\t\tdraggable={ draggable }\n\t\t\t\t\t\tonDragStart={ onDragStart }\n\t\t\t\t\t\tonDragEnd={ onDragEnd }\n\t\t\t\t\t\tisExpanded={ isExpanded }\n\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</BlockDraggable>\n\t\t);\n\t}\n);\n\nexport default ListViewBlockContents;\n"]}
|
|
@@ -74,7 +74,6 @@ function ListViewBlockSelectButton(_ref, ref) {
|
|
|
74
74
|
|
|
75
75
|
function onKeyDownHandler(event) {
|
|
76
76
|
if (event.keyCode === _keycodes.ENTER || event.keyCode === _keycodes.SPACE) {
|
|
77
|
-
event.preventDefault();
|
|
78
77
|
onClick(event);
|
|
79
78
|
}
|
|
80
79
|
}
|
|
@@ -98,7 +97,8 @@ function ListViewBlockSelectButton(_ref, ref) {
|
|
|
98
97
|
icon: blockInformation === null || blockInformation === void 0 ? void 0 : blockInformation.icon,
|
|
99
98
|
showColors: true
|
|
100
99
|
}), (0, _element.createElement)(_blockTitle.default, {
|
|
101
|
-
clientId: clientId
|
|
100
|
+
clientId: clientId,
|
|
101
|
+
maximumLength: 35
|
|
102
102
|
}), (blockInformation === null || blockInformation === void 0 ? void 0 : blockInformation.anchor) && (0, _element.createElement)("span", {
|
|
103
103
|
className: "block-editor-list-view-block-select-button__anchor"
|
|
104
104
|
}, blockInformation.anchor), isSelected && (0, _element.createElement)(_components.VisuallyHidden, null, (0, _i18n.__)('(selected block)'))), (0, _element.createElement)("div", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/list-view/block-select-button.js"],"names":["ListViewBlockSelectButton","ref","className","block","clientId","isSelected","onClick","onToggleExpanded","position","siblingBlockCount","level","tabIndex","onFocus","onDragStart","onDragEnd","draggable","isExpanded","blockInformation","instanceId","descriptionId","blockPositionDescription","onDragStartHandler","event","dataTransfer","clearData","onKeyDownHandler","keyCode","ENTER","SPACE","
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/list-view/block-select-button.js"],"names":["ListViewBlockSelectButton","ref","className","block","clientId","isSelected","onClick","onToggleExpanded","position","siblingBlockCount","level","tabIndex","onFocus","onDragStart","onDragEnd","draggable","isExpanded","blockInformation","instanceId","descriptionId","blockPositionDescription","onDragStartHandler","event","dataTransfer","clearData","onKeyDownHandler","keyCode","ENTER","SPACE","icon","anchor"],"mappings":";;;;;;;;;AAUA;;AAPA;;AAKA;;AACA;;AAEA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AArBA;AACA;AACA;;AAGA;AACA;AACA;;AAMA;AACA;AACA;AAQA,SAASA,yBAAT,OAiBCC,GAjBD,EAkBE;AAAA,MAjBD;AACCC,IAAAA,SADD;AA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SAbb;AAcC,IAAA,IAAI,EAAI,UAAUX,QAAU,EAd7B;AAeC,qBAAgBY;AAfjB,KAiBC,4BAAC,iBAAD;AAAkB,IAAA,OAAO,EAAGT;AAA5B,IAjBD,EAkBC,4BAAC,kBAAD;AAAW,IAAA,IAAI,EAAGU,gBAAH,aAAGA,gBAAH,uBAAGA,gBAAgB,CAAEY,IAApC;AAA2C,IAAA,UAAU;AAArD,IAlBD,EAmBC,4BAAC,mBAAD;AAAY,IAAA,QAAQ,EAAGzB,QAAvB;AAAkC,IAAA,aAAa,EAAG;AAAlD,IAnBD,EAoBG,CAAAa,gBAAgB,SAAhB,IAAAA,gBAAgB,WAAhB,YAAAA,gBAAgB,CAAEa,MAAlB,KACD;AAAM,IAAA,SAAS,EAAC;AAAhB,KACGb,gBAAgB,CAACa,MADpB,CArBF,EAyBGzB,UAAU,IACX,4BAAC,0BAAD,QACG,cAAI,kBAAJ,CADH,CA1BF,CADD,EAgCC;AACC,IAAA,SAAS,EAAC,yDADX;AAEC,IAAA,EAAE,EAAGc;AAFN,KAIGC,wBAJH,CAhCD,CADD;AAyCA;;eAEc,yBAAYpB,yBAAZ,C","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { Button, VisuallyHidden } from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport { forwardRef } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport BlockIcon from '../block-icon';\nimport useBlockDisplayInformation from '../use-block-display-information';\nimport { getBlockPositionDescription } from './utils';\nimport BlockTitle from '../block-title';\nimport ListViewExpander from './expander';\nimport { SPACE, ENTER } from '@wordpress/keycodes';\n\nfunction ListViewBlockSelectButton(\n\t{\n\t\tclassName,\n\t\tblock: { clientId },\n\t\tisSelected,\n\t\tonClick,\n\t\tonToggleExpanded,\n\t\tposition,\n\t\tsiblingBlockCount,\n\t\tlevel,\n\t\ttabIndex,\n\t\tonFocus,\n\t\tonDragStart,\n\t\tonDragEnd,\n\t\tdraggable,\n\t\tisExpanded,\n\t},\n\tref\n) {\n\tconst blockInformation = useBlockDisplayInformation( clientId );\n\tconst instanceId = useInstanceId( ListViewBlockSelectButton );\n\tconst descriptionId = `list-view-block-select-button__${ instanceId }`;\n\tconst blockPositionDescription = getBlockPositionDescription(\n\t\tposition,\n\t\tsiblingBlockCount,\n\t\tlevel\n\t);\n\n\t// The `href` attribute triggers the browser's native HTML drag operations.\n\t// When the link is dragged, the element's outerHTML is set in DataTransfer object as text/html.\n\t// We need to clear any HTML drag data to prevent `pasteHandler` from firing\n\t// inside the `useOnBlockDrop` hook.\n\tconst onDragStartHandler = ( event ) => {\n\t\tevent.dataTransfer.clearData();\n\t\tonDragStart( event );\n\t};\n\n\tfunction onKeyDownHandler( event ) {\n\t\tif ( event.keyCode === ENTER || event.keyCode === SPACE ) {\n\t\t\tonClick( event );\n\t\t}\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<Button\n\t\t\t\tclassName={ classnames(\n\t\t\t\t\t'block-editor-list-view-block-select-button',\n\t\t\t\t\tclassName\n\t\t\t\t) }\n\t\t\t\tonClick={ onClick }\n\t\t\t\tonKeyDown={ onKeyDownHandler }\n\t\t\t\taria-describedby={ descriptionId }\n\t\t\t\tref={ ref }\n\t\t\t\ttabIndex={ tabIndex }\n\t\t\t\tonFocus={ onFocus }\n\t\t\t\tonDragStart={ onDragStartHandler }\n\t\t\t\tonDragEnd={ onDragEnd }\n\t\t\t\tdraggable={ draggable }\n\t\t\t\thref={ `#block-${ clientId }` }\n\t\t\t\taria-expanded={ isExpanded }\n\t\t\t>\n\t\t\t\t<ListViewExpander onClick={ onToggleExpanded } />\n\t\t\t\t<BlockIcon icon={ blockInformation?.icon } showColors />\n\t\t\t\t<BlockTitle clientId={ clientId } maximumLength={ 35 } />\n\t\t\t\t{ blockInformation?.anchor && (\n\t\t\t\t\t<span className=\"block-editor-list-view-block-select-button__anchor\">\n\t\t\t\t\t\t{ blockInformation.anchor }\n\t\t\t\t\t</span>\n\t\t\t\t) }\n\t\t\t\t{ isSelected && (\n\t\t\t\t\t<VisuallyHidden>\n\t\t\t\t\t\t{ __( '(selected block)' ) }\n\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t) }\n\t\t\t</Button>\n\t\t\t<div\n\t\t\t\tclassName=\"block-editor-list-view-block-select-button__description\"\n\t\t\t\tid={ descriptionId }\n\t\t\t>\n\t\t\t\t{ blockPositionDescription }\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default forwardRef( ListViewBlockSelectButton );\n"]}
|
|
@@ -57,7 +57,8 @@ function ListViewBlock(_ref) {
|
|
|
57
57
|
siblingBlockCount,
|
|
58
58
|
showBlockMovers,
|
|
59
59
|
path,
|
|
60
|
-
isExpanded
|
|
60
|
+
isExpanded,
|
|
61
|
+
selectedClientIds
|
|
61
62
|
} = _ref;
|
|
62
63
|
const cellRef = (0, _element.useRef)(null);
|
|
63
64
|
const [isHovered, setIsHovered] = (0, _element.useState)(false);
|
|
@@ -101,10 +102,14 @@ function ListViewBlock(_ref) {
|
|
|
101
102
|
highlightBlock(clientId, false);
|
|
102
103
|
}, [clientId, setIsHovered, highlightBlock]);
|
|
103
104
|
const selectEditorBlock = (0, _element.useCallback)(event => {
|
|
104
|
-
event
|
|
105
|
-
selectBlock(clientId);
|
|
105
|
+
selectBlock(event, clientId);
|
|
106
106
|
}, [clientId, selectBlock]);
|
|
107
|
+
const selectDuplicatedBlock = (0, _element.useCallback)(newClientId => {
|
|
108
|
+
selectBlock(undefined, newClientId);
|
|
109
|
+
}, [selectBlock]);
|
|
107
110
|
const toggleExpanded = (0, _element.useCallback)(event => {
|
|
111
|
+
// Prevent shift+click from opening link in a new window when toggling.
|
|
112
|
+
event.preventDefault();
|
|
108
113
|
event.stopPropagation();
|
|
109
114
|
|
|
110
115
|
if (isExpanded === true) {
|
|
@@ -113,7 +118,7 @@ function ListViewBlock(_ref) {
|
|
|
113
118
|
expand(clientId);
|
|
114
119
|
}
|
|
115
120
|
}, [clientId, expand, collapse, isExpanded]);
|
|
116
|
-
const showBlockActions = withExperimentalFeatures && ( //hide actions for blocks like core/widget-areas
|
|
121
|
+
const showBlockActions = withExperimentalFeatures && ( // hide actions for blocks like core/widget-areas
|
|
117
122
|
!hideContainerBlockActions || hideContainerBlockActions && level > 1);
|
|
118
123
|
const hideBlockActions = withExperimentalFeatures && !showBlockActions;
|
|
119
124
|
let colSpan;
|
|
@@ -131,8 +136,13 @@ function ListViewBlock(_ref) {
|
|
|
131
136
|
'has-single-cell': hideBlockActions
|
|
132
137
|
});
|
|
133
138
|
const blockInformation = (0, _useBlockDisplayInformation.default)(clientId);
|
|
134
|
-
const settingsAriaLabel = (0, _i18n.sprintf)( // translators: %s: The title of the block.
|
|
135
|
-
(0, _i18n.__)('Options for %s block'), blockInformation.title);
|
|
139
|
+
const settingsAriaLabel = blockInformation ? (0, _i18n.sprintf)( // translators: %s: The title of the block.
|
|
140
|
+
(0, _i18n.__)('Options for %s block'), blockInformation.title) : (0, _i18n.__)('Options'); // Only include all selected blocks if the currently clicked on block
|
|
141
|
+
// is one of the selected blocks. This ensures that if a user attempts
|
|
142
|
+
// to alter a block that isn't part of the selection, they're still able
|
|
143
|
+
// to do so.
|
|
144
|
+
|
|
145
|
+
const dropdownClientIds = selectedClientIds.includes(clientId) ? selectedClientIds : [clientId];
|
|
136
146
|
return (0, _element.createElement)(_leaf.default, {
|
|
137
147
|
className: classes,
|
|
138
148
|
onMouseEnter: onMouseEnter,
|
|
@@ -169,7 +179,8 @@ function ListViewBlock(_ref) {
|
|
|
169
179
|
ref: ref,
|
|
170
180
|
tabIndex: tabIndex,
|
|
171
181
|
onFocus: onFocus,
|
|
172
|
-
isExpanded: isExpanded
|
|
182
|
+
isExpanded: isExpanded,
|
|
183
|
+
selectedClientIds: selectedClientIds
|
|
173
184
|
}));
|
|
174
185
|
}), hasRenderedMovers && (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_components.__experimentalTreeGridCell, {
|
|
175
186
|
className: moverCellClassName,
|
|
@@ -209,7 +220,7 @@ function ListViewBlock(_ref) {
|
|
|
209
220
|
onFocus
|
|
210
221
|
} = _ref5;
|
|
211
222
|
return (0, _element.createElement)(_blockSettingsDropdown.default, {
|
|
212
|
-
clientIds:
|
|
223
|
+
clientIds: dropdownClientIds,
|
|
213
224
|
icon: _icons.moreVertical,
|
|
214
225
|
label: settingsAriaLabel,
|
|
215
226
|
toggleProps: {
|
|
@@ -219,7 +230,7 @@ function ListViewBlock(_ref) {
|
|
|
219
230
|
onFocus
|
|
220
231
|
},
|
|
221
232
|
disableOpenOnArrowDown: true,
|
|
222
|
-
__experimentalSelectBlock:
|
|
233
|
+
__experimentalSelectBlock: selectDuplicatedBlock
|
|
223
234
|
});
|
|
224
235
|
}));
|
|
225
236
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/list-view/block.js"],"names":["ListViewBlock","block","isDragged","isSelected","isBranchSelected","selectBlock","position","level","rowCount","siblingBlockCount","showBlockMovers","path","isExpanded","cellRef","isHovered","setIsHovered","clientId","toggleBlockHighlight","blockEditorStore","__experimentalFeatures","withExperimentalFeatures","__experimentalPersistentListViewFeatures","withExperimentalPersistentListViewFeatures","__experimentalHideContainerBlockActions","hideContainerBlockActions","isTreeGridMounted","expand","collapse","hasSiblings","hasRenderedMovers","moverCellClassName","listViewBlockSettingsClassName","current","focus","highlightBlock","onMouseEnter","onMouseLeave","selectEditorBlock","event","stopPropagation","toggleExpanded","showBlockActions","hideBlockActions","colSpan","classes","blockInformation","settingsAriaLabel","title","ref","tabIndex","onFocus","moreVertical","className"],"mappings":";;;;;;;;;AAaA;;AAVA;;AAKA;;AAIA;;AAQA;;AACA;;AAKA;;AACA;;AAIA;;AACA;;AACA;;AACA;;AACA;;AAnCA;AACA;AACA;;AAGA;AACA;AACA;;AAgBA;AACA;AACA;AAYA,SAASA,aAAT,OAaI;AAAA,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;AAIC,MAAA,WAAW,EAAG;AACbE,QAAAA,GADa;AAEbI,QAAAA,SAAS,EAAE,oCAFE;AAGbH,QAAAA,QAHa;AAIbC,QAAAA;AAJa,OAJf;AAUC,MAAA,sBAAsB,MAVvB;AAWC,MAAA,yBAAyB,EAAGb;AAX7B,MADC;AAAA,GADH,CAtEF,CADD;AA2FA;;eAEc,mBAAMrC,aAAN,C","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalTreeGridCell as TreeGridCell,\n\t__experimentalTreeGridItem as TreeGridItem,\n} from '@wordpress/components';\nimport { moreVertical } from '@wordpress/icons';\nimport {\n\tuseState,\n\tuseRef,\n\tuseEffect,\n\tuseCallback,\n\tmemo,\n} from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\nimport { sprintf, __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport ListViewLeaf from './leaf';\nimport {\n\tBlockMoverUpButton,\n\tBlockMoverDownButton,\n} from '../block-mover/button';\nimport ListViewBlockContents from './block-contents';\nimport BlockSettingsDropdown from '../block-settings-menu/block-settings-dropdown';\nimport { useListViewContext } from './context';\nimport { store as blockEditorStore } from '../../store';\nimport useBlockDisplayInformation from '../use-block-display-information';\n\nfunction ListViewBlock( {\n\tblock,\n\tisDragged,\n\tisSelected,\n\tisBranchSelected,\n\tselectBlock,\n\tposition,\n\tlevel,\n\trowCount,\n\tsiblingBlockCount,\n\tshowBlockMovers,\n\tpath,\n\tisExpanded,\n} ) {\n\tconst cellRef = useRef( null );\n\tconst [ isHovered, setIsHovered ] = useState( false );\n\tconst { clientId } = block;\n\n\tconst { toggleBlockHighlight } = useDispatch( blockEditorStore );\n\n\tconst {\n\t\t__experimentalFeatures: withExperimentalFeatures,\n\t\t__experimentalPersistentListViewFeatures: withExperimentalPersistentListViewFeatures,\n\t\t__experimentalHideContainerBlockActions: hideContainerBlockActions,\n\t\tisTreeGridMounted,\n\t\texpand,\n\t\tcollapse,\n\t} = useListViewContext();\n\n\tconst hasSiblings = siblingBlockCount > 0;\n\tconst hasRenderedMovers = showBlockMovers && hasSiblings;\n\tconst moverCellClassName = classnames(\n\t\t'block-editor-list-view-block__mover-cell',\n\t\t{ 'is-visible': isHovered || isSelected }\n\t);\n\n\tconst listViewBlockSettingsClassName = classnames(\n\t\t'block-editor-list-view-block__menu-cell',\n\t\t{ 'is-visible': isHovered || isSelected }\n\t);\n\n\t// If ListView has experimental features related to the Persistent List View,\n\t// only focus the selected list item on mount; otherwise the list would always\n\t// try to steal the focus from the editor canvas.\n\tuseEffect( () => {\n\t\tif (\n\t\t\twithExperimentalPersistentListViewFeatures &&\n\t\t\t! isTreeGridMounted &&\n\t\t\tisSelected\n\t\t) {\n\t\t\tcellRef.current.focus();\n\t\t}\n\t}, [] );\n\n\tconst highlightBlock = withExperimentalPersistentListViewFeatures\n\t\t? toggleBlockHighlight\n\t\t: () => {};\n\n\tconst onMouseEnter = useCallback( () => {\n\t\tsetIsHovered( true );\n\t\thighlightBlock( clientId, true );\n\t}, [ clientId, setIsHovered, highlightBlock ] );\n\tconst onMouseLeave = useCallback( () => {\n\t\tsetIsHovered( false );\n\t\thighlightBlock( clientId, false );\n\t}, [ clientId, setIsHovered, highlightBlock ] );\n\n\tconst selectEditorBlock = useCallback(\n\t\t( event ) => {\n\t\t\tevent.stopPropagation();\n\t\t\tselectBlock( clientId );\n\t\t},\n\t\t[ clientId, selectBlock ]\n\t);\n\n\tconst toggleExpanded = useCallback(\n\t\t( event ) => {\n\t\t\tevent.stopPropagation();\n\t\t\tif ( isExpanded === true ) {\n\t\t\t\tcollapse( clientId );\n\t\t\t} else if ( isExpanded === false ) {\n\t\t\t\texpand( clientId );\n\t\t\t}\n\t\t},\n\t\t[ clientId, expand, collapse, isExpanded ]\n\t);\n\n\tconst showBlockActions =\n\t\twithExperimentalFeatures &&\n\t\t//hide actions for blocks like core/widget-areas\n\t\t( ! hideContainerBlockActions ||\n\t\t\t( hideContainerBlockActions && level > 1 ) );\n\n\tconst hideBlockActions = withExperimentalFeatures && ! showBlockActions;\n\n\tlet colSpan;\n\tif ( hasRenderedMovers ) {\n\t\tcolSpan = 2;\n\t} else if ( hideBlockActions ) {\n\t\tcolSpan = 3;\n\t}\n\n\tconst classes = classnames( {\n\t\t'is-selected': isSelected,\n\t\t'is-branch-selected':\n\t\t\twithExperimentalPersistentListViewFeatures && isBranchSelected,\n\t\t'is-dragging': isDragged,\n\t\t'has-single-cell': hideBlockActions,\n\t} );\n\n\tconst blockInformation = useBlockDisplayInformation( clientId );\n\tconst settingsAriaLabel = sprintf(\n\t\t// translators: %s: The title of the block.\n\t\t__( 'Options for %s block' ),\n\t\tblockInformation.title\n\t);\n\n\treturn (\n\t\t<ListViewLeaf\n\t\t\tclassName={ classes }\n\t\t\tonMouseEnter={ onMouseEnter }\n\t\t\tonMouseLeave={ onMouseLeave }\n\t\t\tonFocus={ onMouseEnter }\n\t\t\tonBlur={ onMouseLeave }\n\t\t\tlevel={ level }\n\t\t\tposition={ position }\n\t\t\trowCount={ rowCount }\n\t\t\tpath={ path }\n\t\t\tid={ `list-view-block-${ clientId }` }\n\t\t\tdata-block={ clientId }\n\t\t\tisExpanded={ isExpanded }\n\t\t>\n\t\t\t<TreeGridCell\n\t\t\t\tclassName=\"block-editor-list-view-block__contents-cell\"\n\t\t\t\tcolSpan={ colSpan }\n\t\t\t\tref={ cellRef }\n\t\t\t>\n\t\t\t\t{ ( { ref, tabIndex, onFocus } ) => (\n\t\t\t\t\t<div className=\"block-editor-list-view-block__contents-container\">\n\t\t\t\t\t\t<ListViewBlockContents\n\t\t\t\t\t\t\tblock={ block }\n\t\t\t\t\t\t\tonClick={ selectEditorBlock }\n\t\t\t\t\t\t\tonToggleExpanded={ toggleExpanded }\n\t\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\t\tposition={ position }\n\t\t\t\t\t\t\tsiblingBlockCount={ siblingBlockCount }\n\t\t\t\t\t\t\tlevel={ level }\n\t\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\t\ttabIndex={ tabIndex }\n\t\t\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\t\t\tisExpanded={ isExpanded }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t</TreeGridCell>\n\t\t\t{ hasRenderedMovers && (\n\t\t\t\t<>\n\t\t\t\t\t<TreeGridCell\n\t\t\t\t\t\tclassName={ moverCellClassName }\n\t\t\t\t\t\twithoutGridItem\n\t\t\t\t\t>\n\t\t\t\t\t\t<TreeGridItem>\n\t\t\t\t\t\t\t{ ( { ref, tabIndex, onFocus } ) => (\n\t\t\t\t\t\t\t\t<BlockMoverUpButton\n\t\t\t\t\t\t\t\t\torientation=\"vertical\"\n\t\t\t\t\t\t\t\t\tclientIds={ [ clientId ] }\n\t\t\t\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\t\t\t\ttabIndex={ tabIndex }\n\t\t\t\t\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</TreeGridItem>\n\t\t\t\t\t\t<TreeGridItem>\n\t\t\t\t\t\t\t{ ( { ref, tabIndex, onFocus } ) => (\n\t\t\t\t\t\t\t\t<BlockMoverDownButton\n\t\t\t\t\t\t\t\t\torientation=\"vertical\"\n\t\t\t\t\t\t\t\t\tclientIds={ [ clientId ] }\n\t\t\t\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\t\t\t\ttabIndex={ tabIndex }\n\t\t\t\t\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</TreeGridItem>\n\t\t\t\t\t</TreeGridCell>\n\t\t\t\t</>\n\t\t\t) }\n\n\t\t\t{ showBlockActions && (\n\t\t\t\t<TreeGridCell className={ listViewBlockSettingsClassName }>\n\t\t\t\t\t{ ( { ref, tabIndex, onFocus } ) => (\n\t\t\t\t\t\t<BlockSettingsDropdown\n\t\t\t\t\t\t\tclientIds={ [ clientId ] }\n\t\t\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\t\t\tlabel={ settingsAriaLabel }\n\t\t\t\t\t\t\ttoggleProps={ {\n\t\t\t\t\t\t\t\tref,\n\t\t\t\t\t\t\t\tclassName: 'block-editor-list-view-block__menu',\n\t\t\t\t\t\t\t\ttabIndex,\n\t\t\t\t\t\t\t\tonFocus,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tdisableOpenOnArrowDown\n\t\t\t\t\t\t\t__experimentalSelectBlock={ selectEditorBlock }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</TreeGridCell>\n\t\t\t) }\n\t\t</ListViewLeaf>\n\t);\n}\n\nexport default memo( ListViewBlock );\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/list-view/block.js"],"names":["ListViewBlock","block","isDragged","isSelected","isBranchSelected","selectBlock","position","level","rowCount","siblingBlockCount","showBlockMovers","path","isExpanded","selectedClientIds","cellRef","isHovered","setIsHovered","clientId","toggleBlockHighlight","blockEditorStore","__experimentalFeatures","withExperimentalFeatures","__experimentalPersistentListViewFeatures","withExperimentalPersistentListViewFeatures","__experimentalHideContainerBlockActions","hideContainerBlockActions","isTreeGridMounted","expand","collapse","hasSiblings","hasRenderedMovers","moverCellClassName","listViewBlockSettingsClassName","current","focus","highlightBlock","onMouseEnter","onMouseLeave","selectEditorBlock","event","selectDuplicatedBlock","newClientId","undefined","toggleExpanded","preventDefault","stopPropagation","showBlockActions","hideBlockActions","colSpan","classes","blockInformation","settingsAriaLabel","title","dropdownClientIds","includes","ref","tabIndex","onFocus","moreVertical","className"],"mappings":";;;;;;;;;AAaA;;AAVA;;AAKA;;AAIA;;AAQA;;AACA;;AAKA;;AACA;;AAIA;;AACA;;AACA;;AACA;;AACA;;AAnCA;AACA;AACA;;AAGA;AACA;AACA;;AAg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,UADb;AAEC,MAAA,SAAS,EAAG,CAAExC,QAAF,CAFb;AAGC,MAAA,GAAG,EAAGsC,GAHP;AAIC,MAAA,QAAQ,EAAGC,QAJZ;AAKC,MAAA,OAAO,EAAGC;AALX,MADC;AAAA,GADH,CAfD,CADD,CAvCF,EAsEGX,gBAAgB,IACjB,4BAAC,sCAAD;AAAc,IAAA,SAAS,EAAGd;AAA1B,KACG;AAAA,QAAE;AAAEuB,MAAAA,GAAF;AAAOC,MAAAA,QAAP;AAAiBC,MAAAA;AAAjB,KAAF;AAAA,WACD,4BAAC,8BAAD;AACC,MAAA,SAAS,EAAGJ,iBADb;AAEC,MAAA,IAAI,EAAGK,mBAFR;AAGC,MAAA,KAAK,EAAGP,iBAHT;AAIC,MAAA,WAAW,EAAG;AACbI,QAAAA,GADa;AAEbI,QAAAA,SAAS,EAAE,oCAFE;AAGbH,QAAAA,QAHa;AAIbC,QAAAA;AAJa,OAJf;AAUC,MAAA,sBAAsB,MAVvB;AAWC,MAAA,yBAAyB,EAAGjB;AAX7B,MADC;AAAA,GADH,CAvEF,CADD;AA4FA;;eAEc,mBAAMxC,aAAN,C","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalTreeGridCell as TreeGridCell,\n\t__experimentalTreeGridItem as TreeGridItem,\n} from '@wordpress/components';\nimport { moreVertical } from '@wordpress/icons';\nimport {\n\tuseState,\n\tuseRef,\n\tuseEffect,\n\tuseCallback,\n\tmemo,\n} from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\nimport { sprintf, __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport ListViewLeaf from './leaf';\nimport {\n\tBlockMoverUpButton,\n\tBlockMoverDownButton,\n} from '../block-mover/button';\nimport ListViewBlockContents from './block-contents';\nimport BlockSettingsDropdown from '../block-settings-menu/block-settings-dropdown';\nimport { useListViewContext } from './context';\nimport { store as blockEditorStore } from '../../store';\nimport useBlockDisplayInformation from '../use-block-display-information';\n\nfunction ListViewBlock( {\n\tblock,\n\tisDragged,\n\tisSelected,\n\tisBranchSelected,\n\tselectBlock,\n\tposition,\n\tlevel,\n\trowCount,\n\tsiblingBlockCount,\n\tshowBlockMovers,\n\tpath,\n\tisExpanded,\n\tselectedClientIds,\n} ) {\n\tconst cellRef = useRef( null );\n\tconst [ isHovered, setIsHovered ] = useState( false );\n\tconst { clientId } = block;\n\n\tconst { toggleBlockHighlight } = useDispatch( blockEditorStore );\n\n\tconst {\n\t\t__experimentalFeatures: withExperimentalFeatures,\n\t\t__experimentalPersistentListViewFeatures: withExperimentalPersistentListViewFeatures,\n\t\t__experimentalHideContainerBlockActions: hideContainerBlockActions,\n\t\tisTreeGridMounted,\n\t\texpand,\n\t\tcollapse,\n\t} = useListViewContext();\n\n\tconst hasSiblings = siblingBlockCount > 0;\n\tconst hasRenderedMovers = showBlockMovers && hasSiblings;\n\tconst moverCellClassName = classnames(\n\t\t'block-editor-list-view-block__mover-cell',\n\t\t{ 'is-visible': isHovered || isSelected }\n\t);\n\n\tconst listViewBlockSettingsClassName = classnames(\n\t\t'block-editor-list-view-block__menu-cell',\n\t\t{ 'is-visible': isHovered || isSelected }\n\t);\n\n\t// If ListView has experimental features related to the Persistent List View,\n\t// only focus the selected list item on mount; otherwise the list would always\n\t// try to steal the focus from the editor canvas.\n\tuseEffect( () => {\n\t\tif (\n\t\t\twithExperimentalPersistentListViewFeatures &&\n\t\t\t! isTreeGridMounted &&\n\t\t\tisSelected\n\t\t) {\n\t\t\tcellRef.current.focus();\n\t\t}\n\t}, [] );\n\n\tconst highlightBlock = withExperimentalPersistentListViewFeatures\n\t\t? toggleBlockHighlight\n\t\t: () => {};\n\n\tconst onMouseEnter = useCallback( () => {\n\t\tsetIsHovered( true );\n\t\thighlightBlock( clientId, true );\n\t}, [ clientId, setIsHovered, highlightBlock ] );\n\tconst onMouseLeave = useCallback( () => {\n\t\tsetIsHovered( false );\n\t\thighlightBlock( clientId, false );\n\t}, [ clientId, setIsHovered, highlightBlock ] );\n\n\tconst selectEditorBlock = useCallback(\n\t\t( event ) => {\n\t\t\tselectBlock( event, clientId );\n\t\t},\n\t\t[ clientId, selectBlock ]\n\t);\n\n\tconst selectDuplicatedBlock = useCallback(\n\t\t( newClientId ) => {\n\t\t\tselectBlock( undefined, newClientId );\n\t\t},\n\t\t[ selectBlock ]\n\t);\n\n\tconst toggleExpanded = useCallback(\n\t\t( event ) => {\n\t\t\t// Prevent shift+click from opening link in a new window when toggling.\n\t\t\tevent.preventDefault();\n\t\t\tevent.stopPropagation();\n\t\t\tif ( isExpanded === true ) {\n\t\t\t\tcollapse( clientId );\n\t\t\t} else if ( isExpanded === false ) {\n\t\t\t\texpand( clientId );\n\t\t\t}\n\t\t},\n\t\t[ clientId, expand, collapse, isExpanded ]\n\t);\n\n\tconst showBlockActions =\n\t\twithExperimentalFeatures &&\n\t\t// hide actions for blocks like core/widget-areas\n\t\t( ! hideContainerBlockActions ||\n\t\t\t( hideContainerBlockActions && level > 1 ) );\n\n\tconst hideBlockActions = withExperimentalFeatures && ! showBlockActions;\n\n\tlet colSpan;\n\tif ( hasRenderedMovers ) {\n\t\tcolSpan = 2;\n\t} else if ( hideBlockActions ) {\n\t\tcolSpan = 3;\n\t}\n\n\tconst classes = classnames( {\n\t\t'is-selected': isSelected,\n\t\t'is-branch-selected':\n\t\t\twithExperimentalPersistentListViewFeatures && isBranchSelected,\n\t\t'is-dragging': isDragged,\n\t\t'has-single-cell': hideBlockActions,\n\t} );\n\n\tconst blockInformation = useBlockDisplayInformation( clientId );\n\tconst settingsAriaLabel = blockInformation\n\t\t? sprintf(\n\t\t\t\t// translators: %s: The title of the block.\n\t\t\t\t__( 'Options for %s block' ),\n\t\t\t\tblockInformation.title\n\t\t )\n\t\t: __( 'Options' );\n\n\t// Only include all selected blocks if the currently clicked on block\n\t// is one of the selected blocks. This ensures that if a user attempts\n\t// to alter a block that isn't part of the selection, they're still able\n\t// to do so.\n\tconst dropdownClientIds = selectedClientIds.includes( clientId )\n\t\t? selectedClientIds\n\t\t: [ clientId ];\n\n\treturn (\n\t\t<ListViewLeaf\n\t\t\tclassName={ classes }\n\t\t\tonMouseEnter={ onMouseEnter }\n\t\t\tonMouseLeave={ onMouseLeave }\n\t\t\tonFocus={ onMouseEnter }\n\t\t\tonBlur={ onMouseLeave }\n\t\t\tlevel={ level }\n\t\t\tposition={ position }\n\t\t\trowCount={ rowCount }\n\t\t\tpath={ path }\n\t\t\tid={ `list-view-block-${ clientId }` }\n\t\t\tdata-block={ clientId }\n\t\t\tisExpanded={ isExpanded }\n\t\t>\n\t\t\t<TreeGridCell\n\t\t\t\tclassName=\"block-editor-list-view-block__contents-cell\"\n\t\t\t\tcolSpan={ colSpan }\n\t\t\t\tref={ cellRef }\n\t\t\t>\n\t\t\t\t{ ( { ref, tabIndex, onFocus } ) => (\n\t\t\t\t\t<div className=\"block-editor-list-view-block__contents-container\">\n\t\t\t\t\t\t<ListViewBlockContents\n\t\t\t\t\t\t\tblock={ block }\n\t\t\t\t\t\t\tonClick={ selectEditorBlock }\n\t\t\t\t\t\t\tonToggleExpanded={ toggleExpanded }\n\t\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\t\tposition={ position }\n\t\t\t\t\t\t\tsiblingBlockCount={ siblingBlockCount }\n\t\t\t\t\t\t\tlevel={ level }\n\t\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\t\ttabIndex={ tabIndex }\n\t\t\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\t\t\tisExpanded={ isExpanded }\n\t\t\t\t\t\t\tselectedClientIds={ selectedClientIds }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t</TreeGridCell>\n\t\t\t{ hasRenderedMovers && (\n\t\t\t\t<>\n\t\t\t\t\t<TreeGridCell\n\t\t\t\t\t\tclassName={ moverCellClassName }\n\t\t\t\t\t\twithoutGridItem\n\t\t\t\t\t>\n\t\t\t\t\t\t<TreeGridItem>\n\t\t\t\t\t\t\t{ ( { ref, tabIndex, onFocus } ) => (\n\t\t\t\t\t\t\t\t<BlockMoverUpButton\n\t\t\t\t\t\t\t\t\torientation=\"vertical\"\n\t\t\t\t\t\t\t\t\tclientIds={ [ clientId ] }\n\t\t\t\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\t\t\t\ttabIndex={ tabIndex }\n\t\t\t\t\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</TreeGridItem>\n\t\t\t\t\t\t<TreeGridItem>\n\t\t\t\t\t\t\t{ ( { ref, tabIndex, onFocus } ) => (\n\t\t\t\t\t\t\t\t<BlockMoverDownButton\n\t\t\t\t\t\t\t\t\torientation=\"vertical\"\n\t\t\t\t\t\t\t\t\tclientIds={ [ clientId ] }\n\t\t\t\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\t\t\t\ttabIndex={ tabIndex }\n\t\t\t\t\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</TreeGridItem>\n\t\t\t\t\t</TreeGridCell>\n\t\t\t\t</>\n\t\t\t) }\n\n\t\t\t{ showBlockActions && (\n\t\t\t\t<TreeGridCell className={ listViewBlockSettingsClassName }>\n\t\t\t\t\t{ ( { ref, tabIndex, onFocus } ) => (\n\t\t\t\t\t\t<BlockSettingsDropdown\n\t\t\t\t\t\t\tclientIds={ dropdownClientIds }\n\t\t\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\t\t\tlabel={ settingsAriaLabel }\n\t\t\t\t\t\t\ttoggleProps={ {\n\t\t\t\t\t\t\t\tref,\n\t\t\t\t\t\t\t\tclassName: 'block-editor-list-view-block__menu',\n\t\t\t\t\t\t\t\ttabIndex,\n\t\t\t\t\t\t\t\tonFocus,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tdisableOpenOnArrowDown\n\t\t\t\t\t\t\t__experimentalSelectBlock={ selectDuplicatedBlock }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</TreeGridCell>\n\t\t\t) }\n\t\t</ListViewLeaf>\n\t);\n}\n\nexport default memo( ListViewBlock );\n"]}
|
|
@@ -143,7 +143,8 @@ function ListViewBranch(props) {
|
|
|
143
143
|
showBlockMovers: showBlockMovers,
|
|
144
144
|
path: updatedPath,
|
|
145
145
|
isExpanded: isExpanded,
|
|
146
|
-
listPosition: nextPosition
|
|
146
|
+
listPosition: nextPosition,
|
|
147
|
+
selectedClientIds: selectedClientIds
|
|
147
148
|
}), !showBlock && (0, _element.createElement)("tr", null, (0, _element.createElement)("td", {
|
|
148
149
|
className: "block-editor-list-view-placeholder"
|
|
149
150
|
})), hasNestedBlocks && isExpanded && !isDragged && (0, _element.createElement)(ListViewBranch, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/list-view/branch.js"],"names":["countBlocks","block","expandedState","draggedClientIds","isDragged","includes","clientId","isExpanded","innerBlocks","reduce","countReducer","count","length","ListViewBranch","props","blocks","selectBlock","showBlockMovers","showNestedBlocks","selectedClientIds","level","path","isBranchSelected","listPosition","fixedListWindow","__experimentalPersistentListViewFeatures","filteredBlocks","blockCount","nextPosition","map","index","usesWindowing","itemInView","blockInView","position","updatedPath","hasNestedBlocks","undefined","showBlock","isSelected","isSelectedBranch","defaultProps"],"mappings":";;;;;;;;;AAQA;;AALA;;AAMA;;AAKA;;AACA;;AACA;;AAhBA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,WAAT,CAAsBC,KAAtB,EAA6BC,aAA7B,EAA4CC,gBAA5C,EAA+D;AAAA;;AAC9D,QAAMC,SAAS,GAAGD,gBAAH,aAAGA,gBAAH,uBAAGA,gBAAgB,CA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C,CAkCzC;AACA;;AACA,UAAMM,UAAU,GAAG,+BAClBjC,QADkB,EAElBa,iBAFkB,CAAnB;AAIA,UAAMqB,gBAAgB,GACrBlB,gBAAgB,IAAMiB,UAAU,IAAIH,eADrC;AAEA,WACC,4BAAC,uBAAD;AAAmB,MAAA,GAAG,EAAG9B,QAAzB;AAAoC,MAAA,KAAK,EAAG,CAAEiC;AAA9C,OACGD,SAAS,IACV,4BAAC,cAAD;AACC,MAAA,KAAK,EAAGrC,KADT;AAEC,MAAA,WAAW,EAAGe,WAFf;AAGC,MAAA,UAAU,EAAGuB,UAHd;AAIC,MAAA,gBAAgB,EAAGC,gBAJpB;AAKC,MAAA,SAAS,EAAGpC,SALb;AAMC,MAAA,KAAK,EAAGgB,KANT;AAOC,MAAA,QAAQ,EAAGc,QAPZ;AAQC,MAAA,QAAQ,EAAGP,UARZ;AASC,MAAA,iBAAiB,EAAGA,UATrB;AAUC,MAAA,eAAe,EAAGV,eAVnB;AAWC,MAAA,IAAI,EAAGkB,WAXR;AAYC,MAAA,UAAU,EAAG5B,UAZd;AAaC,MAAA,YAAY,EAAGqB;
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/list-view/branch.js"],"names":["countBlocks","block","expandedState","draggedClientIds","isDragged","includes","clientId","isExpanded","innerBlocks","reduce","countReducer","count","length","ListViewBranch","props","blocks","selectBlock","showBlockMovers","showNestedBlocks","selectedClientIds","level","path","isBranchSelected","listPosition","fixedListWindow","__experimentalPersistentListViewFeatures","filteredBlocks","blockCount","nextPosition","map","index","usesWindowing","itemInView","blockInView","position","updatedPath","hasNestedBlocks","undefined","showBlock","isSelected","isSelectedBranch","defaultProps"],"mappings":";;;;;;;;;AAQA;;AALA;;AAMA;;AAKA;;AACA;;AACA;;AAhBA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,WAAT,CAAsBC,KAA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YAAY,GAAG,CAP/B;AAQC,MAAA,eAAe,EAAGJ,eARnB;AASC,MAAA,gBAAgB,EAAGgB,gBATpB;AAUC,MAAA,iBAAiB,EAAGrB;AAVrB,MAzBF,CADD;AAyCA,GAnFC,CADH,CADD;AAwFA;;AAEDN,cAAc,CAAC4B,YAAf,GAA8B;AAC7BzB,EAAAA,WAAW,EAAE,MAAM,CAAE;AADQ,CAA9B;;eAIe,mBAAMH,cAAN,C","sourcesContent":["/**\n * External dependencies\n */\nimport { compact } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { memo } from '@wordpress/element';\nimport { AsyncModeProvider } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport ListViewBlock from './block';\nimport { useListViewContext } from './context';\nimport { isClientIdSelected } from './utils';\n\n/**\n * Given a block, returns the total number of blocks in that subtree. This is used to help determine\n * the list position of a block.\n *\n * When a block is collapsed, we do not count their children as part of that total. In the current drag\n * implementation dragged blocks and their children are not counted.\n *\n * @param {Object} block block tree\n * @param {Object} expandedState state that notes which branches are collapsed\n * @param {Array} draggedClientIds a list of dragged client ids\n * @return {number} block count\n */\nfunction countBlocks( block, expandedState, draggedClientIds ) {\n\tconst isDragged = draggedClientIds?.includes( block.clientId );\n\tif ( isDragged ) {\n\t\treturn 0;\n\t}\n\tconst isExpanded = expandedState[ block.clientId ] ?? true;\n\tif ( isExpanded ) {\n\t\treturn (\n\t\t\t1 +\n\t\t\tblock.innerBlocks.reduce(\n\t\t\t\tcountReducer( expandedState, draggedClientIds ),\n\t\t\t\t0\n\t\t\t)\n\t\t);\n\t}\n\treturn 1;\n}\nconst countReducer = ( expandedState, draggedClientIds ) => (\n\tcount,\n\tblock\n) => {\n\tconst isDragged = draggedClientIds?.includes( block.clientId );\n\tif ( isDragged ) {\n\t\treturn count;\n\t}\n\tconst isExpanded = expandedState[ block.clientId ] ?? true;\n\tif ( isExpanded && block.innerBlocks.length > 0 ) {\n\t\treturn count + countBlocks( block, expandedState, draggedClientIds );\n\t}\n\treturn count + 1;\n};\n\nfunction ListViewBranch( props ) {\n\tconst {\n\t\tblocks,\n\t\tselectBlock,\n\t\tshowBlockMovers,\n\t\tshowNestedBlocks,\n\t\tselectedClientIds,\n\t\tlevel = 1,\n\t\tpath = '',\n\t\tisBranchSelected = false,\n\t\tlistPosition = 0,\n\t\tfixedListWindow,\n\t} = props;\n\n\tconst {\n\t\texpandedState,\n\t\tdraggedClientIds,\n\t\t__experimentalPersistentListViewFeatures,\n\t} = useListViewContext();\n\n\tconst filteredBlocks = compact( blocks );\n\tconst blockCount = filteredBlocks.length;\n\tlet nextPosition = listPosition;\n\n\treturn (\n\t\t<>\n\t\t\t{ filteredBlocks.map( ( block, index ) => {\n\t\t\t\tconst { clientId, innerBlocks } = block;\n\n\t\t\t\tif ( index > 0 ) {\n\t\t\t\t\tnextPosition += countBlocks(\n\t\t\t\t\t\tfilteredBlocks[ index - 1 ],\n\t\t\t\t\t\texpandedState,\n\t\t\t\t\t\tdraggedClientIds\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tconst usesWindowing = __experimentalPersistentListViewFeatures;\n\n\t\t\t\tconst { itemInView } = fixedListWindow;\n\n\t\t\t\tconst blockInView =\n\t\t\t\t\t! usesWindowing || itemInView( nextPosition );\n\n\t\t\t\tconst position = index + 1;\n\t\t\t\tconst updatedPath =\n\t\t\t\t\tpath.length > 0\n\t\t\t\t\t\t? `${ path }_${ position }`\n\t\t\t\t\t\t: `${ position }`;\n\t\t\t\tconst hasNestedBlocks =\n\t\t\t\t\tshowNestedBlocks && !! innerBlocks && !! innerBlocks.length;\n\n\t\t\t\tconst isExpanded = hasNestedBlocks\n\t\t\t\t\t? expandedState[ clientId ] ?? true\n\t\t\t\t\t: undefined;\n\n\t\t\t\tconst isDragged = !! draggedClientIds?.includes( clientId );\n\n\t\t\t\tconst showBlock = isDragged || blockInView;\n\n\t\t\t\t// Make updates to the selected or dragged blocks synchronous,\n\t\t\t\t// but asynchronous for any other block.\n\t\t\t\tconst isSelected = isClientIdSelected(\n\t\t\t\t\tclientId,\n\t\t\t\t\tselectedClientIds\n\t\t\t\t);\n\t\t\t\tconst isSelectedBranch =\n\t\t\t\t\tisBranchSelected || ( isSelected && hasNestedBlocks );\n\t\t\t\treturn (\n\t\t\t\t\t<AsyncModeProvider key={ clientId } value={ ! isSelected }>\n\t\t\t\t\t\t{ showBlock && (\n\t\t\t\t\t\t\t<ListViewBlock\n\t\t\t\t\t\t\t\tblock={ block }\n\t\t\t\t\t\t\t\tselectBlock={ selectBlock }\n\t\t\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\t\t\tisBranchSelected={ isSelectedBranch }\n\t\t\t\t\t\t\t\tisDragged={ isDragged }\n\t\t\t\t\t\t\t\tlevel={ level }\n\t\t\t\t\t\t\t\tposition={ position }\n\t\t\t\t\t\t\t\trowCount={ blockCount }\n\t\t\t\t\t\t\t\tsiblingBlockCount={ blockCount }\n\t\t\t\t\t\t\t\tshowBlockMovers={ showBlockMovers }\n\t\t\t\t\t\t\t\tpath={ updatedPath }\n\t\t\t\t\t\t\t\tisExpanded={ isExpanded }\n\t\t\t\t\t\t\t\tlistPosition={ nextPosition }\n\t\t\t\t\t\t\t\tselectedClientIds={ selectedClientIds }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ ! showBlock && (\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td className=\"block-editor-list-view-placeholder\" />\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ hasNestedBlocks && isExpanded && ! isDragged && (\n\t\t\t\t\t\t\t<ListViewBranch\n\t\t\t\t\t\t\t\tblocks={ innerBlocks }\n\t\t\t\t\t\t\t\tselectBlock={ selectBlock }\n\t\t\t\t\t\t\t\tshowBlockMovers={ showBlockMovers }\n\t\t\t\t\t\t\t\tshowNestedBlocks={ showNestedBlocks }\n\t\t\t\t\t\t\t\tlevel={ level + 1 }\n\t\t\t\t\t\t\t\tpath={ updatedPath }\n\t\t\t\t\t\t\t\tlistPosition={ nextPosition + 1 }\n\t\t\t\t\t\t\t\tfixedListWindow={ fixedListWindow }\n\t\t\t\t\t\t\t\tisBranchSelected={ isSelectedBranch }\n\t\t\t\t\t\t\t\tselectedClientIds={ selectedClientIds }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</AsyncModeProvider>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</>\n\t);\n}\n\nListViewBranch.defaultProps = {\n\tselectBlock: () => {},\n};\n\nexport default memo( ListViewBranch );\n"]}
|