@wordpress/block-editor 8.0.13 → 8.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/LICENSE.md +1 -1
- package/README.md +12 -1
- package/build/components/block-caption/index.native.js +14 -3
- package/build/components/block-caption/index.native.js.map +1 -1
- package/build/components/block-edit/index.js +9 -0
- package/build/components/block-edit/index.js.map +1 -1
- package/build/components/block-inspector/index.js +8 -20
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list-appender/index.js +3 -11
- package/build/components/block-list-appender/index.js.map +1 -1
- package/build/components/block-media-update-progress/index.native.js +2 -1
- package/build/components/block-media-update-progress/index.native.js.map +1 -1
- package/build/components/block-preview/auto.js +30 -6
- package/build/components/block-preview/auto.js.map +1 -1
- package/build/components/block-settings/container.native.js +2 -1
- package/build/components/block-settings/container.native.js.map +1 -1
- package/build/components/block-styles/index.js +110 -134
- package/build/components/block-styles/index.js.map +1 -1
- package/build/components/block-styles/menu-items.js +63 -0
- package/build/components/block-styles/menu-items.js.map +1 -0
- package/build/components/block-styles/preview-panel.js +45 -0
- package/build/components/block-styles/preview-panel.js.map +1 -0
- package/build/components/block-styles/preview.native.js +2 -2
- package/build/components/block-styles/preview.native.js.map +1 -1
- package/build/components/block-styles/use-styles-for-block.js +119 -0
- package/build/components/block-styles/use-styles-for-block.js.map +1 -0
- package/build/components/block-styles/utils.js +39 -0
- package/build/components/block-styles/utils.js.map +1 -1
- package/build/components/block-switcher/block-styles-menu.js +3 -23
- package/build/components/block-switcher/block-styles-menu.js.map +1 -1
- package/build/components/block-tools/back-compat.js +2 -1
- package/build/components/block-tools/back-compat.js.map +1 -1
- package/build/components/block-tools/block-selection-button.js +5 -1
- package/build/components/block-tools/block-selection-button.js.map +1 -1
- package/build/components/block-tools/insertion-point.js +11 -1
- package/build/components/block-tools/insertion-point.js.map +1 -1
- package/build/components/block-types-list/index.native.js +2 -2
- package/build/components/block-types-list/index.native.js.map +1 -1
- package/build/components/button-block-appender/index.js +2 -1
- package/build/components/button-block-appender/index.js.map +1 -1
- package/build/components/colors-gradients/dropdown.js +88 -0
- package/build/components/colors-gradients/dropdown.js.map +1 -0
- package/build/components/colors-gradients/panel-color-gradient-settings.js +6 -5
- package/build/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
- package/build/components/colors-gradients/panel-color-gradient-settings.native.js +6 -3
- package/build/components/colors-gradients/panel-color-gradient-settings.native.js.map +1 -1
- package/build/components/contrast-checker/index.js +34 -9
- package/build/components/contrast-checker/index.js.map +1 -1
- package/build/components/contrast-checker/index.native.js +108 -0
- package/build/components/contrast-checker/index.native.js.map +1 -0
- package/build/components/default-block-appender/index.js +16 -19
- package/build/components/default-block-appender/index.js.map +1 -1
- package/build/components/default-style-picker/index.js +18 -3
- package/build/components/default-style-picker/index.js.map +1 -1
- package/build/components/font-appearance-control/index.js +11 -11
- package/build/components/font-appearance-control/index.js.map +1 -1
- package/build/components/iframe/index.js +6 -9
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/index.js +18 -9
- package/build/components/index.js.map +1 -1
- package/build/components/index.native.js +9 -0
- package/build/components/index.native.js.map +1 -1
- package/build/components/inner-blocks/default-block-appender.js +2 -4
- package/build/components/inner-blocks/default-block-appender.js.map +1 -1
- package/build/components/inner-blocks/use-nested-settings-update.js +16 -14
- package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build/components/inserter/index.js +61 -3
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/inserter/index.native.js +1 -1
- package/build/components/inserter/index.native.js.map +1 -1
- package/build/components/inserter/library.js +5 -3
- package/build/components/inserter/library.js.map +1 -1
- package/build/components/inserter/menu.js +11 -3
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/tabs.native.js +7 -4
- package/build/components/inserter/tabs.native.js.map +1 -1
- package/build/components/inspector-controls/block-support-slot-container.js +2 -1
- package/build/components/inspector-controls/block-support-slot-container.js.map +1 -1
- package/build/components/inspector-controls/block-support-tools-panel.js +11 -43
- package/build/components/inspector-controls/block-support-tools-panel.js.map +1 -1
- package/build/components/inspector-controls/fill.native.js +3 -5
- package/build/components/inspector-controls/fill.native.js.map +1 -1
- package/build/components/inspector-controls/groups.js +2 -0
- package/build/components/inspector-controls/groups.js.map +1 -1
- package/build/components/inspector-controls/slot.js +1 -3
- package/build/components/inspector-controls/slot.js.map +1 -1
- package/build/components/letter-spacing-control/index.js +6 -6
- package/build/components/letter-spacing-control/index.js.map +1 -1
- package/build/components/link-control/link-preview.js +1 -1
- package/build/components/link-control/link-preview.js.map +1 -1
- package/build/components/link-control/search-item.js +11 -1
- package/build/components/link-control/search-item.js.map +1 -1
- package/build/components/link-control/search-results.js +2 -1
- package/build/components/link-control/search-results.js.map +1 -1
- package/build/components/link-control/use-search-handler.js +18 -5
- package/build/components/link-control/use-search-handler.js.map +1 -1
- package/build/components/list-view/block-select-button.js +23 -3
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/list-view/block.js +8 -0
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/media-placeholder/index.js +2 -0
- package/build/components/media-placeholder/index.js.map +1 -1
- package/build/components/media-replace-flow/index.js +32 -6
- package/build/components/media-replace-flow/index.js.map +1 -1
- package/build/components/media-upload-progress/index.native.js +2 -1
- package/build/components/media-upload-progress/index.native.js.map +1 -1
- package/build/components/panel-color-settings/index.js +7 -3
- package/build/components/panel-color-settings/index.js.map +1 -1
- package/build/components/provider/block-refs-provider.js +4 -1
- package/build/components/provider/block-refs-provider.js.map +1 -1
- package/build/components/rich-text/file-paste-handler.js +1 -1
- package/build/components/rich-text/file-paste-handler.js.map +1 -1
- package/build/components/rich-text/prevent-event-discovery.js +33 -0
- package/build/components/rich-text/prevent-event-discovery.js.map +1 -0
- package/build/components/rich-text/use-input-rules.js +3 -1
- package/build/components/rich-text/use-input-rules.js.map +1 -1
- package/build/components/selection-scroll-into-view/index.js +2 -1
- package/build/components/selection-scroll-into-view/index.js.map +1 -1
- package/build/components/use-display-block-controls/index.native.js +45 -0
- package/build/components/use-display-block-controls/index.native.js.map +1 -0
- package/build/components/use-on-block-drop/index.js +7 -3
- package/build/components/use-on-block-drop/index.js.map +1 -1
- package/build/components/writing-flow/use-multi-selection.js +3 -1
- package/build/components/writing-flow/use-multi-selection.js.map +1 -1
- package/build/hooks/border-color.js +74 -10
- package/build/hooks/border-color.js.map +1 -1
- package/build/hooks/border-radius.js +47 -0
- package/build/hooks/border-radius.js.map +1 -1
- package/build/hooks/border-style.js +41 -0
- package/build/hooks/border-style.js.map +1 -1
- package/build/hooks/border-width.js +70 -31
- package/build/hooks/border-width.js.map +1 -1
- package/build/hooks/border.js +81 -11
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/color-panel.js +4 -1
- package/build/hooks/color-panel.js.map +1 -1
- package/build/hooks/color-panel.native.js +77 -0
- package/build/hooks/color-panel.native.js.map +1 -0
- package/build/hooks/color.js +6 -5
- package/build/hooks/color.js.map +1 -1
- package/build/hooks/index.native.js +2 -0
- package/build/hooks/index.native.js.map +1 -1
- package/build/hooks/layout.native.js +20 -0
- package/build/hooks/layout.native.js.map +1 -0
- package/build/hooks/letter-spacing.js +1 -1
- package/build/hooks/letter-spacing.js.map +1 -1
- package/build/hooks/typography.js +1 -1
- package/build/hooks/typography.js.map +1 -1
- package/build/store/actions.js +1 -2
- package/build/store/actions.js.map +1 -1
- package/build/store/defaults.js +5 -1
- package/build/store/defaults.js.map +1 -1
- package/build/store/defaults.native.js +2 -6
- package/build/store/defaults.native.js.map +1 -1
- package/build/store/selectors.js +10 -5
- package/build/store/selectors.js.map +1 -1
- package/build/utils/get-paste-event-data.js +1 -1
- package/build/utils/get-paste-event-data.js.map +1 -1
- package/build/utils/parse-css-unit-to-px.js +1 -1
- package/build/utils/parse-css-unit-to-px.js.map +1 -1
- package/build-module/components/block-caption/index.native.js +13 -3
- package/build-module/components/block-caption/index.native.js.map +1 -1
- package/build-module/components/block-edit/index.js +9 -0
- package/build-module/components/block-edit/index.js.map +1 -1
- package/build-module/components/block-inspector/index.js +8 -20
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list-appender/index.js +3 -10
- package/build-module/components/block-list-appender/index.js.map +1 -1
- package/build-module/components/block-media-update-progress/index.native.js +2 -1
- package/build-module/components/block-media-update-progress/index.native.js.map +1 -1
- package/build-module/components/block-preview/auto.js +31 -6
- package/build-module/components/block-preview/auto.js.map +1 -1
- package/build-module/components/block-settings/container.native.js +2 -1
- package/build-module/components/block-settings/container.native.js.map +1 -1
- package/build-module/components/block-styles/index.js +112 -133
- package/build-module/components/block-styles/index.js.map +1 -1
- package/build-module/components/block-styles/menu-items.js +50 -0
- package/build-module/components/block-styles/menu-items.js.map +1 -0
- package/build-module/components/block-styles/preview-panel.js +35 -0
- package/build-module/components/block-styles/preview-panel.js.map +1 -0
- package/build-module/components/block-styles/preview.native.js +2 -2
- package/build-module/components/block-styles/preview.native.js.map +1 -1
- package/build-module/components/block-styles/use-styles-for-block.js +107 -0
- package/build-module/components/block-styles/use-styles-for-block.js.map +1 -0
- package/build-module/components/block-styles/utils.js +34 -0
- package/build-module/components/block-styles/utils.js.map +1 -1
- package/build-module/components/block-switcher/block-styles-menu.js +3 -21
- package/build-module/components/block-switcher/block-styles-menu.js.map +1 -1
- package/build-module/components/block-tools/back-compat.js +2 -1
- package/build-module/components/block-tools/back-compat.js.map +1 -1
- package/build-module/components/block-tools/block-selection-button.js +5 -1
- package/build-module/components/block-tools/block-selection-button.js.map +1 -1
- package/build-module/components/block-tools/insertion-point.js +11 -1
- package/build-module/components/block-tools/insertion-point.js.map +1 -1
- package/build-module/components/block-types-list/index.native.js +2 -2
- package/build-module/components/block-types-list/index.native.js.map +1 -1
- package/build-module/components/button-block-appender/index.js +2 -1
- package/build-module/components/button-block-appender/index.js.map +1 -1
- package/build-module/components/colors-gradients/dropdown.js +75 -0
- package/build-module/components/colors-gradients/dropdown.js.map +1 -0
- package/build-module/components/colors-gradients/panel-color-gradient-settings.js +8 -7
- package/build-module/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
- package/build-module/components/colors-gradients/panel-color-gradient-settings.native.js +7 -4
- package/build-module/components/colors-gradients/panel-color-gradient-settings.native.js.map +1 -1
- package/build-module/components/contrast-checker/index.js +34 -9
- package/build-module/components/contrast-checker/index.js.map +1 -1
- package/build-module/components/contrast-checker/index.native.js +90 -0
- package/build-module/components/contrast-checker/index.native.js.map +1 -0
- package/build-module/components/default-block-appender/index.js +15 -18
- package/build-module/components/default-block-appender/index.js.map +1 -1
- package/build-module/components/default-style-picker/index.js +17 -3
- package/build-module/components/default-style-picker/index.js.map +1 -1
- package/build-module/components/font-appearance-control/index.js +12 -12
- package/build-module/components/font-appearance-control/index.js.map +1 -1
- package/build-module/components/iframe/index.js +6 -9
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/index.js +2 -1
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/index.native.js +1 -0
- package/build-module/components/index.native.js.map +1 -1
- package/build-module/components/inner-blocks/default-block-appender.js +2 -4
- package/build-module/components/inner-blocks/default-block-appender.js.map +1 -1
- package/build-module/components/inner-blocks/use-nested-settings-update.js +16 -14
- package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build-module/components/inserter/index.js +61 -3
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/inserter/index.native.js +2 -2
- package/build-module/components/inserter/index.native.js.map +1 -1
- package/build-module/components/inserter/library.js +5 -3
- package/build-module/components/inserter/library.js.map +1 -1
- package/build-module/components/inserter/menu.js +11 -4
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/tabs.native.js +7 -4
- package/build-module/components/inserter/tabs.native.js.map +1 -1
- package/build-module/components/inspector-controls/block-support-slot-container.js +2 -1
- package/build-module/components/inspector-controls/block-support-slot-container.js.map +1 -1
- package/build-module/components/inspector-controls/block-support-tools-panel.js +12 -43
- package/build-module/components/inspector-controls/block-support-tools-panel.js.map +1 -1
- package/build-module/components/inspector-controls/fill.native.js +3 -5
- package/build-module/components/inspector-controls/fill.native.js.map +1 -1
- package/build-module/components/inspector-controls/groups.js +2 -0
- package/build-module/components/inspector-controls/groups.js.map +1 -1
- package/build-module/components/inspector-controls/slot.js +1 -3
- package/build-module/components/inspector-controls/slot.js.map +1 -1
- package/build-module/components/letter-spacing-control/index.js +6 -6
- package/build-module/components/letter-spacing-control/index.js.map +1 -1
- package/build-module/components/link-control/link-preview.js +1 -1
- package/build-module/components/link-control/link-preview.js.map +1 -1
- package/build-module/components/link-control/search-item.js +11 -1
- package/build-module/components/link-control/search-item.js.map +1 -1
- package/build-module/components/link-control/search-results.js +2 -1
- package/build-module/components/link-control/search-results.js.map +1 -1
- package/build-module/components/link-control/use-search-handler.js +18 -5
- package/build-module/components/link-control/use-search-handler.js.map +1 -1
- package/build-module/components/list-view/block-select-button.js +22 -3
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/list-view/block.js +6 -0
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/media-placeholder/index.js +2 -0
- package/build-module/components/media-placeholder/index.js.map +1 -1
- package/build-module/components/media-replace-flow/index.js +32 -6
- package/build-module/components/media-replace-flow/index.js.map +1 -1
- package/build-module/components/media-upload-progress/index.native.js +2 -1
- package/build-module/components/media-upload-progress/index.native.js.map +1 -1
- package/build-module/components/panel-color-settings/index.js +7 -3
- package/build-module/components/panel-color-settings/index.js.map +1 -1
- package/build-module/components/provider/block-refs-provider.js +4 -1
- package/build-module/components/provider/block-refs-provider.js.map +1 -1
- package/build-module/components/rich-text/file-paste-handler.js +1 -1
- package/build-module/components/rich-text/file-paste-handler.js.map +1 -1
- package/build-module/components/rich-text/prevent-event-discovery.js +25 -0
- package/build-module/components/rich-text/prevent-event-discovery.js.map +1 -0
- package/build-module/components/rich-text/use-input-rules.js +2 -1
- package/build-module/components/rich-text/use-input-rules.js.map +1 -1
- package/build-module/components/selection-scroll-into-view/index.js +2 -1
- package/build-module/components/selection-scroll-into-view/index.js.map +1 -1
- package/build-module/components/use-display-block-controls/index.native.js +34 -0
- package/build-module/components/use-display-block-controls/index.native.js.map +1 -0
- package/build-module/components/use-on-block-drop/index.js +7 -3
- package/build-module/components/use-on-block-drop/index.js.map +1 -1
- package/build-module/components/writing-flow/use-multi-selection.js +3 -4
- package/build-module/components/writing-flow/use-multi-selection.js.map +1 -1
- package/build-module/hooks/border-color.js +72 -12
- package/build-module/hooks/border-color.js.map +1 -1
- package/build-module/hooks/border-radius.js +42 -0
- package/build-module/hooks/border-radius.js.map +1 -1
- package/build-module/hooks/border-style.js +36 -0
- package/build-module/hooks/border-style.js.map +1 -1
- package/build-module/hooks/border-width.js +66 -32
- package/build-module/hooks/border-width.js.map +1 -1
- package/build-module/hooks/border.js +80 -12
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/color-panel.js +4 -1
- package/build-module/hooks/color-panel.js.map +1 -1
- package/build-module/hooks/color-panel.native.js +62 -0
- package/build-module/hooks/color-panel.native.js.map +1 -0
- package/build-module/hooks/color.js +6 -5
- package/build-module/hooks/color.js.map +1 -1
- package/build-module/hooks/index.native.js +1 -0
- package/build-module/hooks/index.native.js.map +1 -1
- package/build-module/hooks/layout.native.js +16 -0
- package/build-module/hooks/layout.native.js.map +1 -0
- package/build-module/hooks/letter-spacing.js +1 -1
- package/build-module/hooks/letter-spacing.js.map +1 -1
- package/build-module/hooks/typography.js +1 -1
- package/build-module/hooks/typography.js.map +1 -1
- package/build-module/store/actions.js +1 -2
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/defaults.js +5 -1
- package/build-module/store/defaults.js.map +1 -1
- package/build-module/store/defaults.native.js +2 -5
- package/build-module/store/defaults.native.js.map +1 -1
- package/build-module/store/selectors.js +10 -5
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/get-paste-event-data.js +1 -1
- package/build-module/utils/get-paste-event-data.js.map +1 -1
- package/build-module/utils/parse-css-unit-to-px.js +1 -1
- package/build-module/utils/parse-css-unit-to-px.js.map +1 -1
- package/build-style/style-rtl.css +226 -181
- package/build-style/style.css +226 -181
- package/package.json +31 -27
- package/src/components/block-caption/index.native.js +22 -4
- package/src/components/block-card/README.md +1 -1
- package/src/components/block-edit/index.js +8 -0
- package/src/components/block-edit/test/edit.native.js +10 -9
- package/src/components/block-inspector/index.js +9 -16
- package/src/components/block-list-appender/index.js +5 -21
- package/src/components/block-media-update-progress/index.native.js +1 -1
- package/src/components/block-media-update-progress/test/index.native.js +136 -93
- package/src/components/block-mover/test/__snapshots__/index.native.js.snap +108 -47
- package/src/components/block-mover/test/index.native.js +5 -5
- package/src/components/block-preview/README.md +14 -26
- package/src/components/block-preview/auto.js +33 -3
- package/src/components/block-preview/test/index.js +2 -0
- package/src/components/block-settings/container.native.js +1 -0
- package/src/components/block-styles/index.js +125 -145
- package/src/components/block-styles/menu-items.js +49 -0
- package/src/components/block-styles/preview-panel.js +36 -0
- package/src/components/block-styles/preview.native.js +5 -2
- package/src/components/block-styles/style.scss +59 -51
- package/src/components/block-styles/test/{index.js → utils.js} +60 -1
- package/src/components/block-styles/use-styles-for-block.js +99 -0
- package/src/components/block-styles/utils.js +39 -0
- package/src/components/block-switcher/block-styles-menu.js +3 -38
- package/src/components/block-tools/back-compat.js +1 -0
- package/src/components/block-tools/block-selection-button.js +7 -1
- package/src/components/block-tools/insertion-point.js +10 -1
- package/src/components/block-types-list/index.native.js +5 -2
- package/src/components/border-radius-control/style.scss +1 -1
- package/src/components/border-style-control/style.scss +0 -1
- package/src/components/button-block-appender/index.js +1 -0
- package/src/components/color-palette/test/__snapshots__/control.js.snap +9 -4
- package/src/components/colors-gradients/dropdown.js +96 -0
- package/src/components/colors-gradients/panel-color-gradient-settings.js +23 -19
- package/src/components/colors-gradients/panel-color-gradient-settings.native.js +13 -2
- package/src/components/colors-gradients/style.scss +59 -5
- package/src/components/contrast-checker/README.md +3 -1
- package/src/components/contrast-checker/index.js +48 -20
- package/src/components/contrast-checker/index.native.js +113 -0
- package/src/components/contrast-checker/style.native.scss +26 -0
- package/src/components/contrast-checker/test/index.js +65 -0
- package/src/components/default-block-appender/index.js +17 -24
- package/src/components/default-block-appender/style.scss +4 -0
- package/src/components/default-block-appender/test/__snapshots__/index.js.snap +12 -24
- package/src/components/default-block-appender/test/index.js +4 -14
- package/src/components/default-style-picker/index.js +18 -6
- package/src/components/font-appearance-control/index.js +12 -12
- package/src/components/iframe/index.js +10 -10
- package/src/components/index.js +2 -1
- package/src/components/index.native.js +1 -0
- package/src/components/inner-blocks/README.md +2 -0
- package/src/components/inner-blocks/default-block-appender.js +2 -7
- package/src/components/inner-blocks/use-nested-settings-update.js +16 -14
- package/src/components/inserter/index.js +77 -5
- package/src/components/inserter/index.native.js +2 -2
- package/src/components/inserter/library.js +17 -12
- package/src/components/inserter/menu.js +31 -13
- package/src/components/inserter/tabs.native.js +5 -4
- package/src/components/inserter/test/block-types-tab.native.js +9 -10
- package/src/components/inserter/test/index.native.js +3 -7
- package/src/components/inserter/test/reusable-blocks-tab.native.js +8 -10
- package/src/components/inspector-controls/block-support-slot-container.js +3 -1
- package/src/components/inspector-controls/block-support-tools-panel.js +39 -58
- package/src/components/inspector-controls/fill.native.js +4 -3
- package/src/components/inspector-controls/groups.js +2 -0
- package/src/components/inspector-controls/slot.js +2 -7
- package/src/components/letter-spacing-control/index.js +6 -6
- package/src/components/link-control/README.md +1 -1
- package/src/components/link-control/link-preview.js +1 -1
- package/src/components/link-control/search-item.js +11 -2
- package/src/components/link-control/search-results.js +1 -0
- package/src/components/link-control/style.scss +2 -1
- package/src/components/link-control/test/index.js +4 -0
- package/src/components/link-control/use-search-handler.js +25 -4
- package/src/components/list-view/block-select-button.js +20 -1
- package/src/components/list-view/block.js +10 -0
- package/src/components/media-placeholder/index.js +2 -0
- package/src/components/media-replace-flow/index.js +35 -5
- package/src/components/media-upload/test/index.native.js +28 -47
- package/src/components/media-upload-progress/index.native.js +1 -0
- package/src/components/media-upload-progress/test/index.native.js +60 -47
- package/src/components/panel-color-settings/index.js +8 -4
- package/src/components/provider/block-refs-provider.js +4 -1
- package/src/components/rich-text/file-paste-handler.js +3 -1
- package/src/components/rich-text/prevent-event-discovery.js +23 -0
- package/src/components/rich-text/use-input-rules.js +2 -1
- package/src/components/selection-scroll-into-view/index.js +1 -0
- package/src/components/url-input/README.md +5 -0
- package/src/components/use-display-block-controls/index.native.js +38 -0
- package/src/components/use-on-block-drop/index.js +7 -3
- package/src/components/writing-flow/test/use-multi-selection.js +36 -0
- package/src/components/writing-flow/use-multi-selection.js +12 -9
- package/src/hooks/border-color.js +69 -9
- package/src/hooks/border-radius.js +32 -0
- package/src/hooks/border-style.js +26 -0
- package/src/hooks/border-width.js +56 -32
- package/src/hooks/border.js +115 -20
- package/src/hooks/border.scss +3 -17
- package/src/hooks/color-panel.js +3 -0
- package/src/hooks/color-panel.native.js +63 -0
- package/src/hooks/color.js +8 -7
- package/src/hooks/dimensions.scss +5 -0
- package/src/hooks/index.native.js +1 -0
- package/src/hooks/layout.native.js +23 -0
- package/src/hooks/letter-spacing.js +1 -1
- package/src/hooks/typography.js +1 -1
- package/src/store/actions.js +1 -2
- package/src/store/defaults.js +2 -0
- package/src/store/defaults.native.js +2 -6
- package/src/store/selectors.js +10 -5
- package/src/style.scss +4 -3
- package/src/utils/get-paste-event-data.js +1 -1
- package/src/utils/parse-css-unit-to-px.js +1 -1
- package/src/utils/test/parse-css-unit-to-px.js +3 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/build/components/use-canvas-click-redirect/index.js +0 -66
- package/build/components/use-canvas-click-redirect/index.js.map +0 -1
- package/build-module/components/use-canvas-click-redirect/index.js +0 -54
- package/build-module/components/use-canvas-click-redirect/index.js.map +0 -1
- package/src/components/use-canvas-click-redirect/index.js +0 -57
|
@@ -12,11 +12,13 @@ var _components = require("@wordpress/components");
|
|
|
12
12
|
*/
|
|
13
13
|
const InspectorControlsDefault = (0, _components.createSlotFill)('InspectorControls');
|
|
14
14
|
const InspectorControlsAdvanced = (0, _components.createSlotFill)('InspectorAdvancedControls');
|
|
15
|
+
const InspectorControlsBorder = (0, _components.createSlotFill)('InspectorControlsBorder');
|
|
15
16
|
const InspectorControlsDimensions = (0, _components.createSlotFill)('InspectorControlsDimensions');
|
|
16
17
|
const InspectorControlsTypography = (0, _components.createSlotFill)('InspectorControlsTypography');
|
|
17
18
|
const groups = {
|
|
18
19
|
default: InspectorControlsDefault,
|
|
19
20
|
advanced: InspectorControlsAdvanced,
|
|
21
|
+
border: InspectorControlsBorder,
|
|
20
22
|
dimensions: InspectorControlsDimensions,
|
|
21
23
|
typography: InspectorControlsTypography
|
|
22
24
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/inspector-controls/groups.js"],"names":["InspectorControlsDefault","InspectorControlsAdvanced","InspectorControlsDimensions","InspectorControlsTypography","groups","default","advanced","dimensions","typography"],"mappings":";;;;;;;AAGA;;AAHA;AACA;AACA;AAGA,MAAMA,wBAAwB,GAAG,gCAAgB,mBAAhB,CAAjC;AACA,MAAMC,yBAAyB,GAAG,gCAAgB,2BAAhB,CAAlC;AACA,MAAMC,2BAA2B,GAAG,gCACnC,6BADmC,CAApC;AAGA,MAAMC,2BAA2B,GAAG,gCACnC,6BADmC,CAApC;AAIA,MAAMC,MAAM,GAAG;AACdC,EAAAA,OAAO,
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/inspector-controls/groups.js"],"names":["InspectorControlsDefault","InspectorControlsAdvanced","InspectorControlsBorder","InspectorControlsDimensions","InspectorControlsTypography","groups","default","advanced","border","dimensions","typography"],"mappings":";;;;;;;AAGA;;AAHA;AACA;AACA;AAGA,MAAMA,wBAAwB,GAAG,gCAAgB,mBAAhB,CAAjC;AACA,MAAMC,yBAAyB,GAAG,gCAAgB,2BAAhB,CAAlC;AACA,MAAMC,uBAAuB,GAAG,gCAAgB,yBAAhB,CAAhC;AACA,MAAMC,2BAA2B,GAAG,gCACnC,6BADmC,CAApC;AAGA,MAAMC,2BAA2B,GAAG,gCACnC,6BADmC,CAApC;AAIA,MAAMC,MAAM,GAAG;AACdC,EAAAA,OAAO,EAAEN,wBADK;AAEdO,EAAAA,QAAQ,EAAEN,yBAFI;AAGdO,EAAAA,MAAM,EAAEN,uBAHM;AAIdO,EAAAA,UAAU,EAAEN,2BAJE;AAKdO,EAAAA,UAAU,EAAEN;AALE,CAAf;eAQeC,M","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createSlotFill } from '@wordpress/components';\n\nconst InspectorControlsDefault = createSlotFill( 'InspectorControls' );\nconst InspectorControlsAdvanced = createSlotFill( 'InspectorAdvancedControls' );\nconst InspectorControlsBorder = createSlotFill( 'InspectorControlsBorder' );\nconst InspectorControlsDimensions = createSlotFill(\n\t'InspectorControlsDimensions'\n);\nconst InspectorControlsTypography = createSlotFill(\n\t'InspectorControlsTypography'\n);\n\nconst groups = {\n\tdefault: InspectorControlsDefault,\n\tadvanced: InspectorControlsAdvanced,\n\tborder: InspectorControlsBorder,\n\tdimensions: InspectorControlsDimensions,\n\ttypography: InspectorControlsTypography,\n};\n\nexport default groups;\n"]}
|
|
@@ -33,7 +33,6 @@ function InspectorControlsSlot(_ref) {
|
|
|
33
33
|
|
|
34
34
|
let {
|
|
35
35
|
__experimentalGroup: group = 'default',
|
|
36
|
-
bubblesVirtually = true,
|
|
37
36
|
label,
|
|
38
37
|
...props
|
|
39
38
|
} = _ref;
|
|
@@ -56,13 +55,12 @@ function InspectorControlsSlot(_ref) {
|
|
|
56
55
|
group: group,
|
|
57
56
|
label: label
|
|
58
57
|
}, (0, _element.createElement)(_blockSupportSlotContainer.default, (0, _extends2.default)({}, props, {
|
|
59
|
-
bubblesVirtually: bubblesVirtually,
|
|
60
58
|
Slot: Slot
|
|
61
59
|
})));
|
|
62
60
|
}
|
|
63
61
|
|
|
64
62
|
return (0, _element.createElement)(Slot, (0, _extends2.default)({}, props, {
|
|
65
|
-
bubblesVirtually:
|
|
63
|
+
bubblesVirtually: true
|
|
66
64
|
}));
|
|
67
65
|
}
|
|
68
66
|
//# sourceMappingURL=slot.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/inspector-controls/slot.js"],"names":["InspectorControlsSlot","__experimentalGroup","group","
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/inspector-controls/slot.js"],"names":["InspectorControlsSlot","__experimentalGroup","group","label","props","Slot","groups","slot","__unstableName","hasFills","Boolean","fills","length"],"mappings":";;;;;;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AACA;;AAXA;AACA;AACA;;AAIA;AACA;AACA;AAKe,SAASA,qBAAT,OAIX;AAAA;;AAAA,MAJ2C;AAC9CC,IAAAA,mBAAmB,EAAEC,KAAK,GAAG,SADiB;AAE9CC,IAAAA,KAF8C;AAG9C,OAAGC;AAH2C,GAI3C;AACH,QAAMC,IAAI,oBAAGC,gBAAQJ,KAAR,CAAH,kDAAG,cAAiBG,IAA9B;AACA,QAAME,IAAI,GAAG,uCAASF,IAAT,aAASA,IAAT,uBAASA,IAAI,CAAEG,cAAf,CAAb;;AACA,MAAK,CAAEH,IAAF,IAAU,CAAEE,IAAjB,EAAwB;AACvB,mHAAU,mCAAmCL,KAAO,aAApD;AACA,WAAO,IAAP;AACA;;AAED,QAAMO,QAAQ,GAAGC,OAAO,CAAEH,IAAI,CAACI,KAAL,IAAcJ,IAAI,CAACI,KAAL,CAAWC,MAA3B,CAAxB;;AACA,MAAK,CAAEH,QAAP,EAAkB;AACjB,WAAO,IAAP;AACA;;AAED,MAAKN,KAAL,EAAa;AACZ,WACC,4BAAC,+BAAD;AAAwB,MAAA,KAAK,EAAGD,KAAhC;AAAwC,MAAA,KAAK,EAAGC;AAAhD,OACC,4BAAC,kCAAD,6BAAgCC,KAAhC;AAAwC,MAAA,IAAI,EAAGC;AAA/C,OADD,CADD;AAKA;;AAED,SAAO,4BAAC,IAAD,6BAAWD,KAAX;AAAmB,IAAA,gBAAgB;AAAnC,KAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalUseSlot as useSlot } from '@wordpress/components';\nimport warning from '@wordpress/warning';\n\n/**\n * Internal dependencies\n */\nimport BlockSupportToolsPanel from './block-support-tools-panel';\nimport BlockSupportSlotContainer from './block-support-slot-container';\nimport groups from './groups';\n\nexport default function InspectorControlsSlot( {\n\t__experimentalGroup: group = 'default',\n\tlabel,\n\t...props\n} ) {\n\tconst Slot = groups[ group ]?.Slot;\n\tconst slot = useSlot( Slot?.__unstableName );\n\tif ( ! Slot || ! slot ) {\n\t\twarning( `Unknown InspectorControl group \"${ group }\" provided.` );\n\t\treturn null;\n\t}\n\n\tconst hasFills = Boolean( slot.fills && slot.fills.length );\n\tif ( ! hasFills ) {\n\t\treturn null;\n\t}\n\n\tif ( label ) {\n\t\treturn (\n\t\t\t<BlockSupportToolsPanel group={ group } label={ label }>\n\t\t\t\t<BlockSupportSlotContainer { ...props } Slot={ Slot } />\n\t\t\t</BlockSupportToolsPanel>\n\t\t);\n\t}\n\n\treturn <Slot { ...props } bubblesVirtually />;\n}\n"]}
|
|
@@ -26,12 +26,12 @@ var _useSetting = _interopRequireDefault(require("../../components/use-setting")
|
|
|
26
26
|
/**
|
|
27
27
|
* Control for letter-spacing.
|
|
28
28
|
*
|
|
29
|
-
* @param {Object}
|
|
30
|
-
* @param {string}
|
|
31
|
-
* @param {Function}
|
|
32
|
-
* @param {
|
|
29
|
+
* @param {Object} props Component props.
|
|
30
|
+
* @param {string} props.value Currently selected letter-spacing.
|
|
31
|
+
* @param {Function} props.onChange Handles change in letter-spacing selection.
|
|
32
|
+
* @param {string|number|undefined} props.__unstableInputWidth Input width to pass through to inner UnitControl. Should be a valid CSS value.
|
|
33
33
|
*
|
|
34
|
-
* @return {WPElement}
|
|
34
|
+
* @return {WPElement} Letter-spacing control.
|
|
35
35
|
*/
|
|
36
36
|
function LetterSpacingControl(_ref) {
|
|
37
37
|
let {
|
|
@@ -48,7 +48,7 @@ function LetterSpacingControl(_ref) {
|
|
|
48
48
|
}
|
|
49
49
|
});
|
|
50
50
|
return (0, _element.createElement)(_components.__experimentalUnitControl, {
|
|
51
|
-
label: (0, _i18n.__)('Letter
|
|
51
|
+
label: (0, _i18n.__)('Letter spacing'),
|
|
52
52
|
value: value,
|
|
53
53
|
__unstableInputWidth: __unstableInputWidth,
|
|
54
54
|
units: units,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/letter-spacing-control/index.js"],"names":["LetterSpacingControl","value","onChange","__unstableInputWidth","units","availableUnits","defaultValues","px","em","rem"],"mappings":";;;;;;;;;;;AAGA;;AAIA;;AAKA;;AAZA;AACA;AACA;;AAOA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,oBAAT,OAIX;AAAA,MAJ0C;AAC7CC,IAAAA,KAD6C;AAE7CC,IAAAA,QAF6C;AAG7CC,IAAAA,oBAAoB,GAAG;AAHsB,GAI1C;AACH,QAAMC,KAAK,GAAG,8CAAgB;AAC7BC,IAAAA,cAAc,EAAE,yBAAY,eAAZ,KAAiC,CAAE,IAAF,EAAQ,IAAR,EAAc,KAAd,CADpB;AAE7BC,IAAAA,aAAa,EAAE;AAAEC,MAAAA,EAAE,EAAE,GAAN;AAAWC,MAAAA,EAAE,EAAE,IAAf;AAAqBC,MAAAA,GAAG,EAAE;AAA1B;AAFc,GAAhB,CAAd;AAIA,SACC,4BAAC,qCAAD;AACC,IAAA,KAAK,EAAG,cAAI,gBAAJ,CADT;AAEC,IAAA,KAAK,EAAGR,KAFT;AAGC,IAAA,oBAAoB,EAAGE,oBAHxB;AAIC,IAAA,KAAK,EAAGC,KAJT;AAKC,IAAA,QAAQ,EAAGF;AALZ,IADD;AASA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalUseCustomUnits as useCustomUnits,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport useSetting from '../../components/use-setting';\n\n/**\n * Control for letter-spacing.\n *\n * @param {Object}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/letter-spacing-control/index.js"],"names":["LetterSpacingControl","value","onChange","__unstableInputWidth","units","availableUnits","defaultValues","px","em","rem"],"mappings":";;;;;;;;;;;AAGA;;AAIA;;AAKA;;AAZA;AACA;AACA;;AAOA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,oBAAT,OAIX;AAAA,MAJ0C;AAC7CC,IAAAA,KAD6C;AAE7CC,IAAAA,QAF6C;AAG7CC,IAAAA,oBAAoB,GAAG;AAHsB,GAI1C;AACH,QAAMC,KAAK,GAAG,8CAAgB;AAC7BC,IAAAA,cAAc,EAAE,yBAAY,eAAZ,KAAiC,CAAE,IAAF,EAAQ,IAAR,EAAc,KAAd,CADpB;AAE7BC,IAAAA,aAAa,EAAE;AAAEC,MAAAA,EAAE,EAAE,GAAN;AAAWC,MAAAA,EAAE,EAAE,IAAf;AAAqBC,MAAAA,GAAG,EAAE;AAA1B;AAFc,GAAhB,CAAd;AAIA,SACC,4BAAC,qCAAD;AACC,IAAA,KAAK,EAAG,cAAI,gBAAJ,CADT;AAEC,IAAA,KAAK,EAAGR,KAFT;AAGC,IAAA,oBAAoB,EAAGE,oBAHxB;AAIC,IAAA,KAAK,EAAGC,KAJT;AAKC,IAAA,QAAQ,EAAGF;AALZ,IADD;AASA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalUseCustomUnits as useCustomUnits,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport useSetting from '../../components/use-setting';\n\n/**\n * Control for letter-spacing.\n *\n * @param {Object} props Component props.\n * @param {string} props.value Currently selected letter-spacing.\n * @param {Function} props.onChange Handles change in letter-spacing selection.\n * @param {string|number|undefined} props.__unstableInputWidth Input width to pass through to inner UnitControl. Should be a valid CSS value.\n *\n * @return {WPElement} Letter-spacing control.\n */\nexport default function LetterSpacingControl( {\n\tvalue,\n\tonChange,\n\t__unstableInputWidth = '60px',\n} ) {\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: useSetting( 'spacing.units' ) || [ 'px', 'em', 'rem' ],\n\t\tdefaultValues: { px: '2', em: '.2', rem: '.2' },\n\t} );\n\treturn (\n\t\t<UnitControl\n\t\t\tlabel={ __( 'Letter spacing' ) }\n\t\t\tvalue={ value }\n\t\t\t__unstableInputWidth={ __unstableInputWidth }\n\t\t\tunits={ units }\n\t\t\tonChange={ onChange }\n\t\t/>\n\t);\n}\n"]}
|
|
@@ -100,7 +100,7 @@ function LinkPreview(_ref) {
|
|
|
100
100
|
className: "block-editor-link-control__search-item-info"
|
|
101
101
|
}, displayURL)) : (0, _element.createElement)("span", {
|
|
102
102
|
className: "block-editor-link-control__search-item-error-notice"
|
|
103
|
-
},
|
|
103
|
+
}, (0, _i18n.__)('Link is empty')))), (0, _element.createElement)(_components.Button, {
|
|
104
104
|
icon: _icons.edit,
|
|
105
105
|
label: (0, _i18n.__)('Edit'),
|
|
106
106
|
className: "block-editor-link-control__search-item-action",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/link-control/link-preview.js"],"names":["LinkPreview","value","onEditClick","hasRichPreviews","hasUnlinkControl","onRemove","showRichPreviews","url","richData","isFetching","hasRichData","Object","keys","length","displayURL","displayTitle","title","isEmptyURL","icon","info","globe","edit","linkOff","image","description"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AACA;;AAKA;;AACA;;AACA;;AAKA;;AAEA;;AAvBA;AACA;AACA;;AAGA;AACA;AACA;;AAWA;AACA;AACA;AAKe,SAASA,WAAT,OAMX;AAAA,MANiC;AACpCC,IAAAA,KADoC;AAEpCC,IAAAA,WAFoC;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BAAa,cAAI,oBAAJ,CADd;AAEC,qBAAc,MAFf;AAGC,IAAA,SAAS,EAAG,yBAAY,wCAAZ,EAAsD;AACjE,oBAAc,IADmD;AAEjE,iBAAWV,WAFsD;AAGjE,qBAAe,CAAC,CAAED,UAH+C;AAIjE,oBAAc,IAJmD;AAKjE,kBAAYQ;AALqD,KAAtD;AAHb,KAWC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC;AAAM,IAAA,SAAS,EAAC;AAAhB,KACC;AACC,IAAA,SAAS,EAAG,yBACX,6CADW,EAEX;AACC,kBAAYT,QAAZ,aAAYA,QAAZ,uBAAYA,QAAQ,CAAEU;AADvB,KAFW;AADb,KAQGA,IARH,CADD,EAWC;AAAM,IAAA,SAAS,EAAC;AAAhB,KACG,CAAED,UAAF,GACD,qDACC,4BAAC,wBAAD;AACC,IAAA,SAAS,EAAC,8CADX;AAEC,IAAA,IAAI,EAAGhB,KAAK,CAACM;AAFd,KAIG,8BAAWQ,YAAX,CAJH,CADD,EAQG,CAAAd,KAAK,SAAL,IAAAA,KAAK,WAAL,YAAAA,KAAK,CAAEM,GAAP,KACD;AAAM,IAAA,SAAS,EAAC;AAAhB,KACGO,UADH,CATF,CADC,GAgBD;AAAM,IAAA,SAAS,EAAC;AAAhB,
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/link-control/link-preview.js"],"names":["LinkPreview","value","onEditClick","hasRichPreviews","hasUnlinkControl","onRemove","showRichPreviews","url","richData","isFetching","hasRichData","Object","keys","length","displayURL","displayTitle","title","isEmptyURL","icon","info","globe","edit","linkOff","image","description"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AACA;;AAKA;;AACA;;AACA;;AAKA;;AAEA;;AAvBA;AACA;AACA;;AAGA;AACA;AACA;;AAWA;AACA;AACA;AAKe,SAASA,WAAT,OAMX;AAAA,MANiC;AACpCC,IAAAA,KADoC;AAEpCC,IAAAA,WAFoC;AAGpCC,IAAAA,eAAe,GAAG,KAHkB;AAIpCC,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AlBF,CArEF,CADD;AA4GA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tButton,\n\tExternalLink,\n\t__experimentalText as Text,\n} from '@wordpress/components';\nimport { filterURLForDisplay, safeDecodeURI } from '@wordpress/url';\nimport { Icon, globe, info, linkOff, edit } from '@wordpress/icons';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\n\n/**\n * Internal dependencies\n */\nimport { ViewerSlot } from './viewer-slot';\n\nimport useRichUrlData from './use-rich-url-data';\n\nexport default function LinkPreview( {\n\tvalue,\n\tonEditClick,\n\thasRichPreviews = false,\n\thasUnlinkControl = false,\n\tonRemove,\n} ) {\n\t// Avoid fetching if rich previews are not desired.\n\tconst showRichPreviews = hasRichPreviews ? value?.url : null;\n\n\tconst { richData, isFetching } = useRichUrlData( showRichPreviews );\n\n\t// Rich data may be an empty object so test for that.\n\tconst hasRichData = richData && Object.keys( richData ).length;\n\n\tconst displayURL =\n\t\t( value && filterURLForDisplay( safeDecodeURI( value.url ), 16 ) ) ||\n\t\t'';\n\n\tconst displayTitle = richData?.title || value?.title || displayURL;\n\n\tconst isEmptyURL = ! value.url.length;\n\n\tlet icon;\n\n\tif ( richData?.icon ) {\n\t\ticon = <img src={ richData?.icon } alt=\"\" />;\n\t} else if ( isEmptyURL ) {\n\t\ticon = <Icon icon={ info } size={ 32 } />;\n\t} else {\n\t\ticon = <Icon icon={ globe } />;\n\t}\n\n\treturn (\n\t\t<div\n\t\t\taria-label={ __( 'Currently selected' ) }\n\t\t\taria-selected=\"true\"\n\t\t\tclassName={ classnames( 'block-editor-link-control__search-item', {\n\t\t\t\t'is-current': true,\n\t\t\t\t'is-rich': hasRichData,\n\t\t\t\t'is-fetching': !! isFetching,\n\t\t\t\t'is-preview': true,\n\t\t\t\t'is-error': isEmptyURL,\n\t\t\t} ) }\n\t\t>\n\t\t\t<div className=\"block-editor-link-control__search-item-top\">\n\t\t\t\t<span className=\"block-editor-link-control__search-item-header\">\n\t\t\t\t\t<span\n\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t'block-editor-link-control__search-item-icon',\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t'is-image': richData?.icon,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ icon }\n\t\t\t\t\t</span>\n\t\t\t\t\t<span className=\"block-editor-link-control__search-item-details\">\n\t\t\t\t\t\t{ ! isEmptyURL ? (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\t\t\tclassName=\"block-editor-link-control__search-item-title\"\n\t\t\t\t\t\t\t\t\thref={ value.url }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ stripHTML( displayTitle ) }\n\t\t\t\t\t\t\t\t</ExternalLink>\n\n\t\t\t\t\t\t\t\t{ value?.url && (\n\t\t\t\t\t\t\t\t\t<span className=\"block-editor-link-control__search-item-info\">\n\t\t\t\t\t\t\t\t\t\t{ displayURL }\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<span className=\"block-editor-link-control__search-item-error-notice\">\n\t\t\t\t\t\t\t\t{ __( 'Link is empty' ) }\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</span>\n\t\t\t\t</span>\n\n\t\t\t\t<Button\n\t\t\t\t\ticon={ edit }\n\t\t\t\t\tlabel={ __( 'Edit' ) }\n\t\t\t\t\tclassName=\"block-editor-link-control__search-item-action\"\n\t\t\t\t\tonClick={ onEditClick }\n\t\t\t\t\ticonSize={ 24 }\n\t\t\t\t/>\n\t\t\t\t{ hasUnlinkControl && (\n\t\t\t\t\t<Button\n\t\t\t\t\t\ticon={ linkOff }\n\t\t\t\t\t\tlabel={ __( 'Unlink' ) }\n\t\t\t\t\t\tclassName=\"block-editor-link-control__search-item-action block-editor-link-control__unlink\"\n\t\t\t\t\t\tonClick={ onRemove }\n\t\t\t\t\t\ticonSize={ 24 }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t<ViewerSlot fillProps={ value } />\n\t\t\t</div>\n\n\t\t\t{ ( ( hasRichData &&\n\t\t\t\t( richData?.image || richData?.description ) ) ||\n\t\t\t\tisFetching ) && (\n\t\t\t\t<div className=\"block-editor-link-control__search-item-bottom\">\n\t\t\t\t\t{ ( richData?.image || isFetching ) && (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\taria-hidden={ ! richData?.image }\n\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t'block-editor-link-control__search-item-image',\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t'is-placeholder': ! richData?.image,\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ richData?.image && (\n\t\t\t\t\t\t\t\t<img src={ richData?.image } alt=\"\" />\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ ( richData?.description || isFetching ) && (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\taria-hidden={ ! richData?.description }\n\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t'block-editor-link-control__search-item-description',\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t'is-placeholder': ! richData?.description,\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ richData?.description && (\n\t\t\t\t\t\t\t\t<Text truncate numberOfLines=\"2\">\n\t\t\t\t\t\t\t\t\t{ richData.description }\n\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n"]}
|
|
@@ -60,10 +60,20 @@ const LinkControlSearchItem = _ref => {
|
|
|
60
60
|
className: "block-editor-link-control__search-item-info"
|
|
61
61
|
}, !isURL && ((0, _url.filterURLForDisplay)((0, _url.safeDecodeURI)(suggestion.url)) || ''), isURL && (0, _i18n.__)('Press ENTER to add this link'))), shouldShowType && suggestion.type && (0, _element.createElement)("span", {
|
|
62
62
|
className: "block-editor-link-control__search-item-type"
|
|
63
|
-
}, suggestion
|
|
63
|
+
}, getVisualTypeName(suggestion)));
|
|
64
64
|
};
|
|
65
65
|
|
|
66
66
|
exports.LinkControlSearchItem = LinkControlSearchItem;
|
|
67
|
+
|
|
68
|
+
function getVisualTypeName(suggestion) {
|
|
69
|
+
if (suggestion.isFrontPage) {
|
|
70
|
+
return 'front page';
|
|
71
|
+
} // Rename 'post_tag' to 'tag'. Ideally, the API would return the localised CPT or taxonomy label.
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
return suggestion.type === 'post_tag' ? 'tag' : suggestion.type;
|
|
75
|
+
}
|
|
76
|
+
|
|
67
77
|
var _default = LinkControlSearchItem;
|
|
68
78
|
exports.default = _default;
|
|
69
79
|
//# sourceMappingURL=search-item.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/link-control/search-item.js"],"names":["LinkControlSearchItem","itemProps","suggestion","isSelected","onClick","isURL","searchTerm","shouldShowType","globe","title","url","type"],"mappings":";;;;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;AAXA;AACA;AACA;;AAGA;AACA;AACA;AAMO,MAAMA,qBAAqB,GAAG,QAQ9B;AAAA,MARgC;AACtCC,IAAAA,SADsC;AAEtCC,IAAAA,UAFsC;AAGtCC,IAAAA,UAAU,GAAG,KAHyB;AAItCC,IAAAA,OAJsC;AAKtCC,IAAAA,KAAK,GAAG,KAL8B;AAMtCC,IAAAA,UAAU,GAAG,EANyB;AAOtCC,IAAAA,cAAc,GAAG;AAPqB,GAQhC;AACN,SACC,4BAAC,kBAAD,6BACMN,SADN;AAEC,IAAA,OAAO,EAAGG,OAFX;AAGC,IAAA,SAAS,EAAG,yBAAY,wCAAZ,EAAsD;AACjE,qBAAeD,UADkD;AAEjE,gBAAUE,KAFuD;AAGjE,mBAAa,CAAEA;AAHkD,KAAtD;AAHb,MASGA,KAAK,IACN,4BAAC,WAAD;AACC,IAAA,SAAS,EAAC,6CADX;AAEC,IAAA,IAAI,EAAGG;AAFR,IAVF,
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/link-control/search-item.js"],"names":["LinkControlSearchItem","itemProps","suggestion","isSelected","onClick","isURL","searchTerm","shouldShowType","globe","title","url","type","getVisualTypeName","isFrontPage"],"mappings":";;;;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;AAXA;AACA;AACA;;AAGA;AACA;AACA;AAMO,MAAMA,qBAAqB,GAAG,QAQ9B;AAAA,MARgC;AACtCC,IAAAA,SADsC;AAEtCC,IAAAA,UAFsC;AAGtCC,IAAAA,UAAU,GAAG,KAHyB;AAItCC,IAAAA,OAJsC;AAKtCC,IAAAA,KAAK,GAAG,KAL8B;AAMtCC,IAAAA,UAAU,GAAG,EANyB;AAOtCC,IAAAA,cAAc,GAAG;AAPqB,GAQhC;AACN,SACC,4BAAC,kBAAD,6BACMN,SADN;AAEC,IAAA,OAAO,EAAGG,OAFX;AAGC,IAAA,SAAS,EAAG,yBAAY,wCAAZ,EAAsD;AACjE,qBAAeD,UADkD;AAEjE,gBAAUE,KAFuD;AAGjE,mBAAa,CAAEA;AAHkD,KAAtD;AAHb,MASGA,KAAK,IACN,4BAAC,WAAD;AACC,IAAA,SAAS,EAAC,6CADX;AAEC,IAAA,IAAI,EAAGG;AAFR,IAVF,EAgBC;AAAM,IAAA,SAAS,EAAC;AAAhB,KACC;AAAM,IAAA,SAAS,EAAC;AAAhB,KACC,4BAAC,yBAAD;AACC,IAAA,IAAI,EAAGN,UAAU,CAACO,KADnB;AAEC,IAAA,SAAS,EAAGH;AAFb,IADD,CADD,EAOC;AACC,mBAAc,CAAED,KADjB;AAEC,IAAA,SAAS,EAAC;AAFX,KAIG,CAAEA,KAAF,KACC,8BACD,wBAAeH,UAAU,CAACQ,GAA1B,CADC,KAGD,EAJA,CAJH,EASGL,KAAK,IAAI,cAAI,8BAAJ,CATZ,CAPD,CAhBD,EAmCGE,cAAc,IAAIL,UAAU,CAACS,IAA7B,IACD;AAAM,IAAA,SAAS,EAAC;AAAhB,KACGC,iBAAiB,CAAEV,UAAF,CADpB,CApCF,CADD;AA2CA,CApDM;;;;AAsDP,SAASU,iBAAT,CAA4BV,UAA5B,EAAyC;AACxC,MAAKA,UAAU,CAACW,WAAhB,EAA8B;AAC7B,WAAO,YAAP;AACA,GAHuC,CAKxC;;;AACA,SAAOX,UAAU,CAACS,IAAX,KAAoB,UAApB,GAAiC,KAAjC,GAAyCT,UAAU,CAACS,IAA3D;AACA;;eAEcX,qB","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { safeDecodeURI, filterURLForDisplay } from '@wordpress/url';\nimport { __ } from '@wordpress/i18n';\nimport { Button, TextHighlight } from '@wordpress/components';\nimport { Icon, globe } from '@wordpress/icons';\n\nexport const LinkControlSearchItem = ( {\n\titemProps,\n\tsuggestion,\n\tisSelected = false,\n\tonClick,\n\tisURL = false,\n\tsearchTerm = '',\n\tshouldShowType = false,\n} ) => {\n\treturn (\n\t\t<Button\n\t\t\t{ ...itemProps }\n\t\t\tonClick={ onClick }\n\t\t\tclassName={ classnames( 'block-editor-link-control__search-item', {\n\t\t\t\t'is-selected': isSelected,\n\t\t\t\t'is-url': isURL,\n\t\t\t\t'is-entity': ! isURL,\n\t\t\t} ) }\n\t\t>\n\t\t\t{ isURL && (\n\t\t\t\t<Icon\n\t\t\t\t\tclassName=\"block-editor-link-control__search-item-icon\"\n\t\t\t\t\ticon={ globe }\n\t\t\t\t/>\n\t\t\t) }\n\n\t\t\t<span className=\"block-editor-link-control__search-item-header\">\n\t\t\t\t<span className=\"block-editor-link-control__search-item-title\">\n\t\t\t\t\t<TextHighlight\n\t\t\t\t\t\ttext={ suggestion.title }\n\t\t\t\t\t\thighlight={ searchTerm }\n\t\t\t\t\t/>\n\t\t\t\t</span>\n\t\t\t\t<span\n\t\t\t\t\taria-hidden={ ! isURL }\n\t\t\t\t\tclassName=\"block-editor-link-control__search-item-info\"\n\t\t\t\t>\n\t\t\t\t\t{ ! isURL &&\n\t\t\t\t\t\t( filterURLForDisplay(\n\t\t\t\t\t\t\tsafeDecodeURI( suggestion.url )\n\t\t\t\t\t\t) ||\n\t\t\t\t\t\t\t'' ) }\n\t\t\t\t\t{ isURL && __( 'Press ENTER to add this link' ) }\n\t\t\t\t</span>\n\t\t\t</span>\n\t\t\t{ shouldShowType && suggestion.type && (\n\t\t\t\t<span className=\"block-editor-link-control__search-item-type\">\n\t\t\t\t\t{ getVisualTypeName( suggestion ) }\n\t\t\t\t</span>\n\t\t\t) }\n\t\t</Button>\n\t);\n};\n\nfunction getVisualTypeName( suggestion ) {\n\tif ( suggestion.isFrontPage ) {\n\t\treturn 'front page';\n\t}\n\n\t// Rename 'post_tag' to 'tag'. Ideally, the API would return the localised CPT or taxonomy label.\n\treturn suggestion.type === 'post_tag' ? 'tag' : suggestion.type;\n}\n\nexport default LinkControlSearchItem;\n"]}
|
|
@@ -109,7 +109,8 @@ function LinkControlSearchResults(_ref) {
|
|
|
109
109
|
isSelected: index === selectedSuggestion,
|
|
110
110
|
isURL: directLinkEntryTypes.includes(suggestion.type.toLowerCase()),
|
|
111
111
|
searchTerm: currentInputValue,
|
|
112
|
-
shouldShowType: shouldShowSuggestionsTypes
|
|
112
|
+
shouldShowType: shouldShowSuggestionsTypes,
|
|
113
|
+
isFrontPage: suggestion === null || suggestion === void 0 ? void 0 : suggestion.isFrontPage
|
|
113
114
|
});
|
|
114
115
|
})));
|
|
115
116
|
}
|
|
@@ -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"],"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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AAhC,EAAuC;AACtC,aAAO,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;
|
|
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;AAOjD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__, 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"]}
|
|
@@ -63,16 +63,27 @@ const handleDirectEntry = val => {
|
|
|
63
63
|
|
|
64
64
|
exports.handleDirectEntry = handleDirectEntry;
|
|
65
65
|
|
|
66
|
-
const handleEntitySearch = async (val, suggestionsQuery, fetchSearchSuggestions, directEntryHandler, withCreateSuggestion, withURLSuggestion) => {
|
|
66
|
+
const handleEntitySearch = async (val, suggestionsQuery, fetchSearchSuggestions, directEntryHandler, withCreateSuggestion, withURLSuggestion, pageOnFront) => {
|
|
67
67
|
const {
|
|
68
68
|
isInitialSuggestions
|
|
69
69
|
} = suggestionsQuery;
|
|
70
|
-
let
|
|
70
|
+
let resultsIncludeFrontPage = false;
|
|
71
|
+
let results = await Promise.all([fetchSearchSuggestions(val, suggestionsQuery), directEntryHandler(val)]); // Identify front page and update type to match.
|
|
72
|
+
|
|
73
|
+
results[0] = results[0].map(result => {
|
|
74
|
+
if (Number(result.id) === pageOnFront) {
|
|
75
|
+
resultsIncludeFrontPage = true;
|
|
76
|
+
result.isFrontPage = true;
|
|
77
|
+
return result;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return result;
|
|
81
|
+
});
|
|
71
82
|
const couldBeURL = !val.includes(' '); // If it's potentially a URL search then concat on a URL search suggestion
|
|
72
83
|
// just for good measure. That way once the actual results run out we always
|
|
73
84
|
// have a URL option to fallback on.
|
|
74
85
|
|
|
75
|
-
if (couldBeURL && withURLSuggestion && !isInitialSuggestions) {
|
|
86
|
+
if (!resultsIncludeFrontPage && couldBeURL && withURLSuggestion && !isInitialSuggestions) {
|
|
76
87
|
results = results[0].concat(results[1]);
|
|
77
88
|
} else {
|
|
78
89
|
results = results[0];
|
|
@@ -111,12 +122,14 @@ const handleEntitySearch = async (val, suggestionsQuery, fetchSearchSuggestions,
|
|
|
111
122
|
|
|
112
123
|
function useSearchHandler(suggestionsQuery, allowDirectEntry, withCreateSuggestion, withURLSuggestion) {
|
|
113
124
|
const {
|
|
114
|
-
fetchSearchSuggestions
|
|
125
|
+
fetchSearchSuggestions,
|
|
126
|
+
pageOnFront
|
|
115
127
|
} = (0, _data.useSelect)(select => {
|
|
116
128
|
const {
|
|
117
129
|
getSettings
|
|
118
130
|
} = select(_store.store);
|
|
119
131
|
return {
|
|
132
|
+
pageOnFront: getSettings().pageOnFront,
|
|
120
133
|
fetchSearchSuggestions: getSettings().__experimentalFetchLinkSuggestions
|
|
121
134
|
};
|
|
122
135
|
}, []);
|
|
@@ -129,7 +142,7 @@ function useSearchHandler(suggestionsQuery, allowDirectEntry, withCreateSuggesti
|
|
|
129
142
|
isInitialSuggestions
|
|
130
143
|
}) : handleEntitySearch(val, { ...suggestionsQuery,
|
|
131
144
|
isInitialSuggestions
|
|
132
|
-
}, fetchSearchSuggestions, directEntryHandler, withCreateSuggestion, withURLSuggestion);
|
|
145
|
+
}, fetchSearchSuggestions, directEntryHandler, withCreateSuggestion, withURLSuggestion, pageOnFront);
|
|
133
146
|
}, [directEntryHandler, fetchSearchSuggestions, withCreateSuggestion]);
|
|
134
147
|
}
|
|
135
148
|
//# sourceMappingURL=use-search-handler.js.map
|
|
@@ -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","isInitialSuggestions","results","all","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,
|
|
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,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lBC,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"]}
|
|
@@ -27,6 +27,8 @@ var _blockTitle = _interopRequireDefault(require("../block-title"));
|
|
|
27
27
|
|
|
28
28
|
var _expander = _interopRequireDefault(require("./expander"));
|
|
29
29
|
|
|
30
|
+
var _keycodes = require("@wordpress/keycodes");
|
|
31
|
+
|
|
30
32
|
/**
|
|
31
33
|
* External dependencies
|
|
32
34
|
*/
|
|
@@ -59,17 +61,35 @@ function ListViewBlockSelectButton(_ref, ref) {
|
|
|
59
61
|
const blockInformation = (0, _useBlockDisplayInformation.default)(clientId);
|
|
60
62
|
const instanceId = (0, _compose.useInstanceId)(ListViewBlockSelectButton);
|
|
61
63
|
const descriptionId = `list-view-block-select-button__${instanceId}`;
|
|
62
|
-
const blockPositionDescription = (0, _utils.getBlockPositionDescription)(position, siblingBlockCount, level);
|
|
64
|
+
const blockPositionDescription = (0, _utils.getBlockPositionDescription)(position, siblingBlockCount, level); // The `href` attribute triggers the browser's native HTML drag operations.
|
|
65
|
+
// When the link is dragged, the element's outerHTML is set in DataTransfer object as text/html.
|
|
66
|
+
// We need to clear any HTML drag data to prevent `pasteHandler` from firing
|
|
67
|
+
// inside the `useOnBlockDrop` hook.
|
|
68
|
+
|
|
69
|
+
const onDragStartHandler = event => {
|
|
70
|
+
event.dataTransfer.clearData();
|
|
71
|
+
onDragStart(event);
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
function onKeyDownHandler(event) {
|
|
75
|
+
if (event.keyCode === _keycodes.ENTER || event.keyCode === _keycodes.SPACE) {
|
|
76
|
+
event.preventDefault();
|
|
77
|
+
onClick(event);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
63
81
|
return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_components.Button, {
|
|
64
82
|
className: (0, _classnames.default)('block-editor-list-view-block-select-button', className),
|
|
65
83
|
onClick: onClick,
|
|
84
|
+
onKeyDown: onKeyDownHandler,
|
|
66
85
|
"aria-describedby": descriptionId,
|
|
67
86
|
ref: ref,
|
|
68
87
|
tabIndex: tabIndex,
|
|
69
88
|
onFocus: onFocus,
|
|
70
|
-
onDragStart:
|
|
89
|
+
onDragStart: onDragStartHandler,
|
|
71
90
|
onDragEnd: onDragEnd,
|
|
72
|
-
draggable: draggable
|
|
91
|
+
draggable: draggable,
|
|
92
|
+
href: `#block-${clientId}`
|
|
73
93
|
}, (0, _element.createElement)(_expander.default, {
|
|
74
94
|
onClick: onToggleExpanded
|
|
75
95
|
}), (0, _element.createElement)(_blockIcon.default, {
|
|
@@ -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","blockInformation","instanceId","descriptionId","blockPositionDescription","icon","anchor"],"mappings":";;;;;;;;;AAUA;;AAPA;;AAKA;;AACA;;AAEA;;AAKA;;AACA;;AACA;;AACA;;AACA;;
|
|
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","blockInformation","instanceId","descriptionId","blockPositionDescription","onDragStartHandler","event","dataTransfer","clearData","onKeyDownHandler","keyCode","ENTER","SPACE","preventDefault","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,OAgBCC,GAhBD,EAiBE;AAAA,MAhBD;AACCC,IAAAA,SADD;AAECC,IAAAA,KAAK,EAAE;AAAEC,MAAAA;AAAF,KAFR;AAGCC,IAAAA,UAHD;AAICC,IAAAA,OAJD;AAKCC,IAAAA,gBALD;AAMCC,IAAAA,QAND;AAOCC,IAAAA,iBAPD;AAQCC,IAAAA,KARD;AASCC,IAAAA,QATD;AAUCC,IAAAA,OAVD;AAWCC,IAAAA,WAXD;AAYCC,IAAAA,SAZD;AAaCC,IAAAA;AAbD,GAgBC;AACD,QAAMC,gBAAgB,GAAG,yCAA4BZ,QAA5B,CAAzB;AACA,QAAMa,UAAU,GAAG,4BAAejB,yBAAf,CAAnB;AACA,QAAMkB,aAAa,GAAI,kCAAkCD,UAAY,EAArE;AACA,QAAME,wBAAwB,GAAG,wCAChCX,QADgC,EAEhCC,iBAFgC,EAGhCC,KAHgC,CAAjC,CAJC,CAUD;AACA;AACA;AACA;;AACA,QAAMU,kBAAkB,GAAKC,KAAF,IAAa;AACvCA,IAAAA,KAAK,CAACC,YAAN,CAAmBC,SAAnB;AACAV,IAAAA,WAAW,CAAEQ,KAAF,CAAX;AACA,GAHD;;AAKA,WAASG,gBAAT,CAA2BH,KAA3B,EAAmC;AAClC,QAAKA,KAAK,CAACI,OAAN,KAAkBC,eAAlB,IAA2BL,KAAK,CAACI,OAAN,KAAkBE,eAAlD,EAA0D;AACzDN,MAAAA,KAAK,CAACO,cAAN;AACAtB,MAAAA,OAAO,CAAEe,KAAF,CAAP;AACA;AACD;;AAED,SACC,qDACC,4BAAC,kBAAD;AACC,IAAA,SAAS,EAAG,yBACX,4CADW,EAEXnB,SAFW,CADb;AAKC,IAAA,OAAO,EAAGI,OALX;AAMC,IAAA,SAAS,EAAGkB,gBANb;AAOC,wBAAmBN,aAPpB;AAQC,IAAA,GAAG,EAAGjB,GARP;AASC,IAAA,QAAQ,EAAGU,QATZ;AAUC,IAAA,OAAO,EAAGC,OAVX;AAWC,IAAA,WAAW,EAAGQ,kBAXf;AAYC,IAAA,SAAS,EAAGN,SAZb;AAaC,IAAA,SAAS,EAAGC,SAbb;AAcC,IAAA,IAAI,EAAI,UAAUX,QAAU;AAd7B,KAgBC,4BAAC,iBAAD;AAAkB,IAAA,OAAO,EAAGG;AAA5B,IAhBD,EAiBC,4BAAC,kBAAD;AAAW,IAAA,IAAI,EAAGS,gBAAH,aAAGA,gBAAH,uBAAGA,gBAAgB,CAAEa,IAApC;AAA2C,IAAA,UAAU;AAArD,IAjBD,EAkBC,4BAAC,mBAAD;AAAY,IAAA,QAAQ,EAAGzB;AAAvB,IAlBD,EAmBG,CAAAY,gBAAgB,SAAhB,IAAAA,gBAAgB,WAAhB,YAAAA,gBAAgB,CAAEc,MAAlB,KACD;AAAM,IAAA,SAAS,EAAC;AAAhB,KACGd,gBAAgB,CAACc,MADpB,CApBF,EAwBGzB,UAAU,IACX,4BAAC,0BAAD,QACG,cAAI,kBAAJ,CADH,CAzBF,CADD,EA+BC;AACC,IAAA,SAAS,EAAC,yDADX;AAEC,IAAA,EAAE,EAAGa;AAFN,KAIGC,wBAJH,CA/BD,CADD;AAwCA;;eAEc,yBAAYnB,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},\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\tevent.preventDefault();\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>\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 } />\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"]}
|
|
@@ -17,6 +17,8 @@ var _icons = require("@wordpress/icons");
|
|
|
17
17
|
|
|
18
18
|
var _data = require("@wordpress/data");
|
|
19
19
|
|
|
20
|
+
var _i18n = require("@wordpress/i18n");
|
|
21
|
+
|
|
20
22
|
var _leaf = _interopRequireDefault(require("./leaf"));
|
|
21
23
|
|
|
22
24
|
var _button = require("../block-mover/button");
|
|
@@ -29,6 +31,8 @@ var _context = require("./context");
|
|
|
29
31
|
|
|
30
32
|
var _store = require("../../store");
|
|
31
33
|
|
|
34
|
+
var _useBlockDisplayInformation = _interopRequireDefault(require("../use-block-display-information"));
|
|
35
|
+
|
|
32
36
|
/**
|
|
33
37
|
* External dependencies
|
|
34
38
|
*/
|
|
@@ -126,6 +130,9 @@ function ListViewBlock(_ref) {
|
|
|
126
130
|
'is-dragging': isDragged,
|
|
127
131
|
'has-single-cell': hideBlockActions
|
|
128
132
|
});
|
|
133
|
+
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);
|
|
129
136
|
return (0, _element.createElement)(_leaf.default, {
|
|
130
137
|
className: classes,
|
|
131
138
|
onMouseEnter: onMouseEnter,
|
|
@@ -203,6 +210,7 @@ function ListViewBlock(_ref) {
|
|
|
203
210
|
return (0, _element.createElement)(_blockSettingsDropdown.default, {
|
|
204
211
|
clientIds: [clientId],
|
|
205
212
|
icon: _icons.moreVertical,
|
|
213
|
+
label: settingsAriaLabel,
|
|
206
214
|
toggleProps: {
|
|
207
215
|
ref,
|
|
208
216
|
className: 'block-editor-list-view-block__menu',
|
|
@@ -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","ref","tabIndex","onFocus","moreVertical","className"],"mappings":";;;;;;;;;AAaA;;AAVA;;AAKA;;AAIA;;AAQA;;AAKA;;AACA;;AAIA;;AACA;;AACA;;AACA;;AAjCA;AACA;AACA;;AAGA;AACA;AACA;;AAeA;AACA;AACA;AAWA,SAASA,aAAT,OAaI;AAAA,MAboB;AACvBC,I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C,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';\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';\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\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/>\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\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","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,MAboB;AACvBC,IAAAA,KADuB;AAEvBC,IAAAA,SAFuB;AAGvBC,IAAAA,UAHuB;AAIvBC,IAAAA,gBAJuB;AAKvBC,IAAAA,WALuB;AAMvBC,IAAAA,QANuB;AAOvBC,IAAAA,KAPuB;AAQvBC,IAAAA,QARuB;AASvBC,IAAAA,iBATuB;AAUvBC,IAAAA,eAVuB;AAWvBC,IAAAA,IAXuB;AAYvBC,IAAAA;AAZuB,GAapB;AACH,QAAMC,OAAO,GAAG,qBAAQ,IAAR,CAAhB;AACA,QAAM,CAAEC,SAAF,EAAaC,YAAb,IAA8B,uBAAU,KAAV,CAApC;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAef,KAArB;AAEA,QAAM;AAAEgB,IAAAA;AAAF,MAA2B,uBAAaC,YAAb,CAAjC;AAEA,QAAM;AACL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EAAGC,QAJZ;AAKC,MAAA,OAAO,EAAGC;AALX,MADC;AAAA,GADH,CAJD,EAeC,4BAAC,sCAAD,QACG;AAAA,QAAE;AAAEF,MAAAA,GAAF;AAAOC,MAAAA,QAAP;AAAiBC,MAAAA;AAAjB,KAAF;AAAA,WACD,4BAAC,4BAAD;AACC,MAAA,WAAW,EAAC,UADb;AAEC,MAAA,SAAS,EAAG,CAAElC,QAAF,CAFb;AAGC,MAAA,GAAG,EAAGgC,GAHP;AAIC,MAAA,QAAQ,EAAGC,QAJZ;AAKC,MAAA,OAAO,EAAGC;AALX,MADC;AAAA,GADH,CAfD,CADD,CArCF,EAoEGT,gBAAgB,IACjB,4BAAC,sCAAD;AAAc,IAAA,SAAS,EAAGV;AAA1B,KACG;AAAA,QAAE;AAAEiB,MAAAA,GAAF;AAAOC,MAAAA,QAAP;AAAiBC,MAAAA;AAAjB,KAAF;AAAA,WACD,4BAAC,8BAAD;AACC,MAAA,SAAS,EAAG,CAAElC,QAAF,CADb;AAEC,MAAA,IAAI,EAAGmC,mBAFR;AAGC,MAAA,KAAK,EAAGL,iBAHT;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,CArEF,CADD;AA0FA;;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/>\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"]}
|
|
@@ -94,6 +94,7 @@ function MediaPlaceholder(_ref2) {
|
|
|
94
94
|
onDoubleClick,
|
|
95
95
|
onFilesPreUpload = _lodash.noop,
|
|
96
96
|
onHTMLDrop = _lodash.noop,
|
|
97
|
+
onClose = _lodash.noop,
|
|
97
98
|
children,
|
|
98
99
|
mediaLibraryButton,
|
|
99
100
|
placeholder,
|
|
@@ -333,6 +334,7 @@ function MediaPlaceholder(_ref2) {
|
|
|
333
334
|
gallery: multiple && onlyAllowsImages(),
|
|
334
335
|
multiple: multiple,
|
|
335
336
|
onSelect: onSelect,
|
|
337
|
+
onClose: onClose,
|
|
336
338
|
allowedTypes: allowedTypes,
|
|
337
339
|
value: Array.isArray(value) ? value.map(_ref7 => {
|
|
338
340
|
let {
|