@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
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import
|
|
4
|
+
import { render } from 'test/helpers';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Internal dependencies
|
|
8
8
|
*/
|
|
9
9
|
import { Inserter } from '../index';
|
|
10
|
-
import '../../..'; // Ensure store dependencies are imported via root.
|
|
11
10
|
|
|
12
11
|
const getStylesFromColorScheme = () => {
|
|
13
12
|
return { color: 'white' };
|
|
@@ -15,13 +14,10 @@ const getStylesFromColorScheme = () => {
|
|
|
15
14
|
|
|
16
15
|
describe( 'Inserter', () => {
|
|
17
16
|
it( 'button contains the testID "add-block-button"', () => {
|
|
18
|
-
const
|
|
17
|
+
const screen = render(
|
|
19
18
|
<Inserter getStylesFromColorScheme={ getStylesFromColorScheme } />
|
|
20
19
|
);
|
|
21
|
-
const testInstance = testRenderer.root;
|
|
22
20
|
|
|
23
|
-
expect( ()
|
|
24
|
-
testInstance.findByProps( { testID: 'add-block-button' } );
|
|
25
|
-
} ).not.toThrow();
|
|
21
|
+
expect( screen.getByTestId( 'add-block-button' ) ).toBeTruthy();
|
|
26
22
|
} );
|
|
27
23
|
} );
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { render } from 'test/helpers';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
@@ -13,9 +13,7 @@ import { useSelect } from '@wordpress/data';
|
|
|
13
13
|
*/
|
|
14
14
|
import items from './fixtures';
|
|
15
15
|
import ReusableBlocksTab from '../reusable-blocks-tab';
|
|
16
|
-
import BlockTypesList from '../../block-types-list';
|
|
17
16
|
|
|
18
|
-
jest.mock( '../../block-types-list' );
|
|
19
17
|
jest.mock( '@wordpress/data/src/components/use-select' );
|
|
20
18
|
|
|
21
19
|
const fetchReusableBlocks = jest.fn();
|
|
@@ -34,11 +32,11 @@ describe( 'ReusableBlocksTab component', () => {
|
|
|
34
32
|
} );
|
|
35
33
|
|
|
36
34
|
it( 'renders without crashing', () => {
|
|
37
|
-
const component =
|
|
35
|
+
const component = render(
|
|
38
36
|
<ReusableBlocksTab
|
|
39
37
|
rootClientId={ 0 }
|
|
40
38
|
onSelect={ jest.fn() }
|
|
41
|
-
listProps={ {} }
|
|
39
|
+
listProps={ { contentContainerStyle: {} } }
|
|
42
40
|
/>
|
|
43
41
|
);
|
|
44
42
|
expect( component ).toBeTruthy();
|
|
@@ -50,15 +48,15 @@ describe( 'ReusableBlocksTab component', () => {
|
|
|
50
48
|
const reusableBlockItems = items.filter(
|
|
51
49
|
( { category } ) => category === 'reusable'
|
|
52
50
|
);
|
|
53
|
-
const component =
|
|
51
|
+
const component = render(
|
|
54
52
|
<ReusableBlocksTab
|
|
55
53
|
rootClientId={ 0 }
|
|
56
54
|
onSelect={ jest.fn() }
|
|
57
|
-
listProps={ {} }
|
|
55
|
+
listProps={ { contentContainerStyle: {} } }
|
|
58
56
|
/>
|
|
59
57
|
);
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
);
|
|
58
|
+
reusableBlockItems.forEach( ( { title } ) => {
|
|
59
|
+
expect( component.getByText( title ) ).toBeTruthy();
|
|
60
|
+
} );
|
|
63
61
|
} );
|
|
64
62
|
} );
|
|
@@ -6,5 +6,7 @@ import { useContext } from '@wordpress/element';
|
|
|
6
6
|
|
|
7
7
|
export default function BlockSupportSlotContainer( { Slot, ...props } ) {
|
|
8
8
|
const toolsPanelContext = useContext( ToolsPanelContext );
|
|
9
|
-
return
|
|
9
|
+
return (
|
|
10
|
+
<Slot { ...props } fillProps={ toolsPanelContext } bubblesVirtually />
|
|
11
|
+
);
|
|
10
12
|
}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { __experimentalToolsPanel as ToolsPanel } from '@wordpress/components';
|
|
5
5
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
6
|
+
import { useCallback } from '@wordpress/element';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Internal dependencies
|
|
@@ -11,74 +12,54 @@ import { store as blockEditorStore } from '../../store';
|
|
|
11
12
|
import { cleanEmptyObject } from '../../hooks/utils';
|
|
12
13
|
|
|
13
14
|
export default function BlockSupportToolsPanel( { children, group, label } ) {
|
|
14
|
-
const {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
// When we currently have a multi-selection, the value returned from
|
|
23
|
-
// `getSelectedBlockClientId()` is `null`. When a `null` value is used
|
|
24
|
-
// for the `panelId`, a `ToolsPanel` will still allow panel items to
|
|
25
|
-
// register themselves despite their panelIds not matching.
|
|
26
|
-
const selectedBlockClientId = getSelectedBlockClientId();
|
|
27
|
-
|
|
28
|
-
if ( hasMultiSelection() ) {
|
|
29
|
-
const selectedBlockClientIds = getMultiSelectedBlockClientIds();
|
|
30
|
-
const selectedBlockAttributes = selectedBlockClientIds.reduce(
|
|
31
|
-
( blockAttributes, blockId ) => {
|
|
32
|
-
blockAttributes[ blockId ] = getBlockAttributes( blockId );
|
|
33
|
-
return blockAttributes;
|
|
34
|
-
},
|
|
35
|
-
{}
|
|
36
|
-
);
|
|
15
|
+
const { updateBlockAttributes } = useDispatch( blockEditorStore );
|
|
16
|
+
const {
|
|
17
|
+
getBlockAttributes,
|
|
18
|
+
getMultiSelectedBlockClientIds,
|
|
19
|
+
getSelectedBlockClientId,
|
|
20
|
+
hasMultiSelection,
|
|
21
|
+
} = useSelect( blockEditorStore );
|
|
37
22
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
};
|
|
43
|
-
}
|
|
23
|
+
const panelId = getSelectedBlockClientId();
|
|
24
|
+
const resetAll = useCallback(
|
|
25
|
+
( resetFilters = [] ) => {
|
|
26
|
+
const newAttributes = {};
|
|
44
27
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
attributes: {
|
|
49
|
-
[ selectedBlockClientId ]: getBlockAttributes(
|
|
50
|
-
selectedBlockClientId
|
|
51
|
-
),
|
|
52
|
-
},
|
|
53
|
-
};
|
|
54
|
-
}, [] );
|
|
55
|
-
const { updateBlockAttributes } = useDispatch( blockEditorStore );
|
|
28
|
+
const clientIds = hasMultiSelection()
|
|
29
|
+
? getMultiSelectedBlockClientIds()
|
|
30
|
+
: [ panelId ];
|
|
56
31
|
|
|
57
|
-
|
|
58
|
-
|
|
32
|
+
clientIds.forEach( ( clientId ) => {
|
|
33
|
+
const { style } = getBlockAttributes( clientId );
|
|
34
|
+
let newBlockAttributes = { style };
|
|
59
35
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
36
|
+
resetFilters.forEach( ( resetFilter ) => {
|
|
37
|
+
newBlockAttributes = {
|
|
38
|
+
...newBlockAttributes,
|
|
39
|
+
...resetFilter( newBlockAttributes ),
|
|
40
|
+
};
|
|
41
|
+
} );
|
|
63
42
|
|
|
64
|
-
|
|
43
|
+
// Enforce a cleaned style object.
|
|
65
44
|
newBlockAttributes = {
|
|
66
45
|
...newBlockAttributes,
|
|
67
|
-
|
|
46
|
+
style: cleanEmptyObject( newBlockAttributes.style ),
|
|
68
47
|
};
|
|
69
|
-
} );
|
|
70
|
-
|
|
71
|
-
// Enforce a cleaned style object.
|
|
72
|
-
newBlockAttributes = {
|
|
73
|
-
...newBlockAttributes,
|
|
74
|
-
style: cleanEmptyObject( newBlockAttributes.style ),
|
|
75
|
-
};
|
|
76
48
|
|
|
77
|
-
|
|
78
|
-
|
|
49
|
+
newAttributes[ clientId ] = newBlockAttributes;
|
|
50
|
+
} );
|
|
79
51
|
|
|
80
|
-
|
|
81
|
-
|
|
52
|
+
updateBlockAttributes( clientIds, newAttributes, true );
|
|
53
|
+
},
|
|
54
|
+
[
|
|
55
|
+
cleanEmptyObject,
|
|
56
|
+
getBlockAttributes,
|
|
57
|
+
getMultiSelectedBlockClientIds,
|
|
58
|
+
hasMultiSelection,
|
|
59
|
+
panelId,
|
|
60
|
+
updateBlockAttributes,
|
|
61
|
+
]
|
|
62
|
+
);
|
|
82
63
|
|
|
83
64
|
return (
|
|
84
65
|
<ToolsPanel
|
|
@@ -14,7 +14,7 @@ import warning from '@wordpress/warning';
|
|
|
14
14
|
* Internal dependencies
|
|
15
15
|
*/
|
|
16
16
|
import groups from './groups';
|
|
17
|
-
import
|
|
17
|
+
import useDisplayBlockControls from '../use-display-block-controls';
|
|
18
18
|
import { BlockSettingsButton } from '../block-settings';
|
|
19
19
|
|
|
20
20
|
export default function InspectorControlsFill( {
|
|
@@ -22,13 +22,14 @@ export default function InspectorControlsFill( {
|
|
|
22
22
|
__experimentalGroup: group = 'default',
|
|
23
23
|
...props
|
|
24
24
|
} ) {
|
|
25
|
-
const
|
|
25
|
+
const isDisplayed = useDisplayBlockControls();
|
|
26
|
+
|
|
26
27
|
const Fill = groups[ group ]?.Fill;
|
|
27
28
|
if ( ! Fill ) {
|
|
28
29
|
warning( `Unknown InspectorControl group "${ group }" provided.` );
|
|
29
30
|
return null;
|
|
30
31
|
}
|
|
31
|
-
if ( !
|
|
32
|
+
if ( ! isDisplayed ) {
|
|
32
33
|
return null;
|
|
33
34
|
}
|
|
34
35
|
|
|
@@ -5,6 +5,7 @@ import { createSlotFill } from '@wordpress/components';
|
|
|
5
5
|
|
|
6
6
|
const InspectorControlsDefault = createSlotFill( 'InspectorControls' );
|
|
7
7
|
const InspectorControlsAdvanced = createSlotFill( 'InspectorAdvancedControls' );
|
|
8
|
+
const InspectorControlsBorder = createSlotFill( 'InspectorControlsBorder' );
|
|
8
9
|
const InspectorControlsDimensions = createSlotFill(
|
|
9
10
|
'InspectorControlsDimensions'
|
|
10
11
|
);
|
|
@@ -15,6 +16,7 @@ const InspectorControlsTypography = createSlotFill(
|
|
|
15
16
|
const groups = {
|
|
16
17
|
default: InspectorControlsDefault,
|
|
17
18
|
advanced: InspectorControlsAdvanced,
|
|
19
|
+
border: InspectorControlsBorder,
|
|
18
20
|
dimensions: InspectorControlsDimensions,
|
|
19
21
|
typography: InspectorControlsTypography,
|
|
20
22
|
};
|
|
@@ -13,7 +13,6 @@ import groups from './groups';
|
|
|
13
13
|
|
|
14
14
|
export default function InspectorControlsSlot( {
|
|
15
15
|
__experimentalGroup: group = 'default',
|
|
16
|
-
bubblesVirtually = true,
|
|
17
16
|
label,
|
|
18
17
|
...props
|
|
19
18
|
} ) {
|
|
@@ -32,14 +31,10 @@ export default function InspectorControlsSlot( {
|
|
|
32
31
|
if ( label ) {
|
|
33
32
|
return (
|
|
34
33
|
<BlockSupportToolsPanel group={ group } label={ label }>
|
|
35
|
-
<BlockSupportSlotContainer
|
|
36
|
-
{ ...props }
|
|
37
|
-
bubblesVirtually={ bubblesVirtually }
|
|
38
|
-
Slot={ Slot }
|
|
39
|
-
/>
|
|
34
|
+
<BlockSupportSlotContainer { ...props } Slot={ Slot } />
|
|
40
35
|
</BlockSupportToolsPanel>
|
|
41
36
|
);
|
|
42
37
|
}
|
|
43
38
|
|
|
44
|
-
return <Slot { ...props } bubblesVirtually
|
|
39
|
+
return <Slot { ...props } bubblesVirtually />;
|
|
45
40
|
}
|
|
@@ -15,12 +15,12 @@ import useSetting from '../../components/use-setting';
|
|
|
15
15
|
/**
|
|
16
16
|
* Control for letter-spacing.
|
|
17
17
|
*
|
|
18
|
-
* @param {Object}
|
|
19
|
-
* @param {string}
|
|
20
|
-
* @param {Function}
|
|
21
|
-
* @param {
|
|
18
|
+
* @param {Object} props Component props.
|
|
19
|
+
* @param {string} props.value Currently selected letter-spacing.
|
|
20
|
+
* @param {Function} props.onChange Handles change in letter-spacing selection.
|
|
21
|
+
* @param {string|number|undefined} props.__unstableInputWidth Input width to pass through to inner UnitControl. Should be a valid CSS value.
|
|
22
22
|
*
|
|
23
|
-
* @return {WPElement}
|
|
23
|
+
* @return {WPElement} Letter-spacing control.
|
|
24
24
|
*/
|
|
25
25
|
export default function LetterSpacingControl( {
|
|
26
26
|
value,
|
|
@@ -33,7 +33,7 @@ export default function LetterSpacingControl( {
|
|
|
33
33
|
} );
|
|
34
34
|
return (
|
|
35
35
|
<UnitControl
|
|
36
|
-
label={ __( 'Letter
|
|
36
|
+
label={ __( 'Letter spacing' ) }
|
|
37
37
|
value={ value }
|
|
38
38
|
__unstableInputWidth={ __unstableInputWidth }
|
|
39
39
|
units={ units }
|
|
@@ -36,6 +36,7 @@ export const LinkControlSearchItem = ( {
|
|
|
36
36
|
icon={ globe }
|
|
37
37
|
/>
|
|
38
38
|
) }
|
|
39
|
+
|
|
39
40
|
<span className="block-editor-link-control__search-item-header">
|
|
40
41
|
<span className="block-editor-link-control__search-item-title">
|
|
41
42
|
<TextHighlight
|
|
@@ -57,12 +58,20 @@ export const LinkControlSearchItem = ( {
|
|
|
57
58
|
</span>
|
|
58
59
|
{ shouldShowType && suggestion.type && (
|
|
59
60
|
<span className="block-editor-link-control__search-item-type">
|
|
60
|
-
{
|
|
61
|
-
{ suggestion.type === 'post_tag' ? 'tag' : suggestion.type }
|
|
61
|
+
{ getVisualTypeName( suggestion ) }
|
|
62
62
|
</span>
|
|
63
63
|
) }
|
|
64
64
|
</Button>
|
|
65
65
|
);
|
|
66
66
|
};
|
|
67
67
|
|
|
68
|
+
function getVisualTypeName( suggestion ) {
|
|
69
|
+
if ( suggestion.isFrontPage ) {
|
|
70
|
+
return 'front page';
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// Rename 'post_tag' to 'tag'. Ideally, the API would return the localised CPT or taxonomy label.
|
|
74
|
+
return suggestion.type === 'post_tag' ? 'tag' : suggestion.type;
|
|
75
|
+
}
|
|
76
|
+
|
|
68
77
|
export default LinkControlSearchItem;
|
|
@@ -61,7 +61,7 @@ $preview-image-height: 140px;
|
|
|
61
61
|
// Specificity overide of URLInput defaults.
|
|
62
62
|
&.block-editor-url-input input[type="text"].block-editor-url-input__input {
|
|
63
63
|
@include input-control;
|
|
64
|
-
width: calc(100% - #{$grid-unit-20*2});
|
|
64
|
+
width: calc(100% - #{$grid-unit-20 * 2});
|
|
65
65
|
display: block;
|
|
66
66
|
padding: 11px $grid-unit-20;
|
|
67
67
|
padding-right: ( $button-size * $block-editor-link-control-number-of-actions ); // width of reset and submit buttons
|
|
@@ -287,6 +287,7 @@ $preview-image-height: 140px;
|
|
|
287
287
|
font-size: 0.9em;
|
|
288
288
|
background-color: $gray-100;
|
|
289
289
|
border-radius: 2px;
|
|
290
|
+
white-space: nowrap; // tags shouldn't go over two lines.
|
|
290
291
|
}
|
|
291
292
|
|
|
292
293
|
.block-editor-link-control__search-item-description {
|
|
@@ -51,6 +51,8 @@ jest.mock( '@wordpress/data/src/components/use-dispatch', () => ( {
|
|
|
51
51
|
useDispatch: () => ( { saveEntityRecords: jest.fn() } ),
|
|
52
52
|
} ) );
|
|
53
53
|
|
|
54
|
+
jest.useRealTimers();
|
|
55
|
+
|
|
54
56
|
/**
|
|
55
57
|
* Wait for next tick of event loop. This is required
|
|
56
58
|
* because the `fetchSearchSuggestions` Promise will
|
|
@@ -1634,6 +1636,7 @@ describe( 'Selecting links', () => {
|
|
|
1634
1636
|
);
|
|
1635
1637
|
|
|
1636
1638
|
// We should have highlighted the first item using the keyboard
|
|
1639
|
+
// eslint-disable-next-line jest/no-conditional-expect
|
|
1637
1640
|
expect( selectedSearchResultElement ).toEqual(
|
|
1638
1641
|
secondSearchSuggestion
|
|
1639
1642
|
);
|
|
@@ -1648,6 +1651,7 @@ describe( 'Selecting links', () => {
|
|
|
1648
1651
|
);
|
|
1649
1652
|
|
|
1650
1653
|
// We should be back to highlighting the first search result again
|
|
1654
|
+
// eslint-disable-next-line jest/no-conditional-expect
|
|
1651
1655
|
expect( selectedSearchResultElement ).toEqual(
|
|
1652
1656
|
firstSearchSuggestion
|
|
1653
1657
|
);
|
|
@@ -52,21 +52,39 @@ const handleEntitySearch = async (
|
|
|
52
52
|
fetchSearchSuggestions,
|
|
53
53
|
directEntryHandler,
|
|
54
54
|
withCreateSuggestion,
|
|
55
|
-
withURLSuggestion
|
|
55
|
+
withURLSuggestion,
|
|
56
|
+
pageOnFront
|
|
56
57
|
) => {
|
|
57
58
|
const { isInitialSuggestions } = suggestionsQuery;
|
|
59
|
+
let resultsIncludeFrontPage = false;
|
|
58
60
|
|
|
59
61
|
let results = await Promise.all( [
|
|
60
62
|
fetchSearchSuggestions( val, suggestionsQuery ),
|
|
61
63
|
directEntryHandler( val ),
|
|
62
64
|
] );
|
|
63
65
|
|
|
66
|
+
// Identify front page and update type to match.
|
|
67
|
+
results[ 0 ] = results[ 0 ].map( ( result ) => {
|
|
68
|
+
if ( Number( result.id ) === pageOnFront ) {
|
|
69
|
+
resultsIncludeFrontPage = true;
|
|
70
|
+
result.isFrontPage = true;
|
|
71
|
+
return result;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return result;
|
|
75
|
+
} );
|
|
76
|
+
|
|
64
77
|
const couldBeURL = ! val.includes( ' ' );
|
|
65
78
|
|
|
66
79
|
// If it's potentially a URL search then concat on a URL search suggestion
|
|
67
80
|
// just for good measure. That way once the actual results run out we always
|
|
68
81
|
// have a URL option to fallback on.
|
|
69
|
-
if (
|
|
82
|
+
if (
|
|
83
|
+
! resultsIncludeFrontPage &&
|
|
84
|
+
couldBeURL &&
|
|
85
|
+
withURLSuggestion &&
|
|
86
|
+
! isInitialSuggestions
|
|
87
|
+
) {
|
|
70
88
|
results = results[ 0 ].concat( results[ 1 ] );
|
|
71
89
|
} else {
|
|
72
90
|
results = results[ 0 ];
|
|
@@ -109,9 +127,11 @@ export default function useSearchHandler(
|
|
|
109
127
|
withCreateSuggestion,
|
|
110
128
|
withURLSuggestion
|
|
111
129
|
) {
|
|
112
|
-
const { fetchSearchSuggestions } = useSelect( ( select ) => {
|
|
130
|
+
const { fetchSearchSuggestions, pageOnFront } = useSelect( ( select ) => {
|
|
113
131
|
const { getSettings } = select( blockEditorStore );
|
|
132
|
+
|
|
114
133
|
return {
|
|
134
|
+
pageOnFront: getSettings().pageOnFront,
|
|
115
135
|
fetchSearchSuggestions: getSettings()
|
|
116
136
|
.__experimentalFetchLinkSuggestions,
|
|
117
137
|
};
|
|
@@ -131,7 +151,8 @@ export default function useSearchHandler(
|
|
|
131
151
|
fetchSearchSuggestions,
|
|
132
152
|
directEntryHandler,
|
|
133
153
|
withCreateSuggestion,
|
|
134
|
-
withURLSuggestion
|
|
154
|
+
withURLSuggestion,
|
|
155
|
+
pageOnFront
|
|
135
156
|
);
|
|
136
157
|
},
|
|
137
158
|
[ directEntryHandler, fetchSearchSuggestions, withCreateSuggestion ]
|
|
@@ -19,6 +19,7 @@ import useBlockDisplayInformation from '../use-block-display-information';
|
|
|
19
19
|
import { getBlockPositionDescription } from './utils';
|
|
20
20
|
import BlockTitle from '../block-title';
|
|
21
21
|
import ListViewExpander from './expander';
|
|
22
|
+
import { SPACE, ENTER } from '@wordpress/keycodes';
|
|
22
23
|
|
|
23
24
|
function ListViewBlockSelectButton(
|
|
24
25
|
{
|
|
@@ -47,6 +48,22 @@ function ListViewBlockSelectButton(
|
|
|
47
48
|
level
|
|
48
49
|
);
|
|
49
50
|
|
|
51
|
+
// The `href` attribute triggers the browser's native HTML drag operations.
|
|
52
|
+
// When the link is dragged, the element's outerHTML is set in DataTransfer object as text/html.
|
|
53
|
+
// We need to clear any HTML drag data to prevent `pasteHandler` from firing
|
|
54
|
+
// inside the `useOnBlockDrop` hook.
|
|
55
|
+
const onDragStartHandler = ( event ) => {
|
|
56
|
+
event.dataTransfer.clearData();
|
|
57
|
+
onDragStart( event );
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
function onKeyDownHandler( event ) {
|
|
61
|
+
if ( event.keyCode === ENTER || event.keyCode === SPACE ) {
|
|
62
|
+
event.preventDefault();
|
|
63
|
+
onClick( event );
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
50
67
|
return (
|
|
51
68
|
<>
|
|
52
69
|
<Button
|
|
@@ -55,13 +72,15 @@ function ListViewBlockSelectButton(
|
|
|
55
72
|
className
|
|
56
73
|
) }
|
|
57
74
|
onClick={ onClick }
|
|
75
|
+
onKeyDown={ onKeyDownHandler }
|
|
58
76
|
aria-describedby={ descriptionId }
|
|
59
77
|
ref={ ref }
|
|
60
78
|
tabIndex={ tabIndex }
|
|
61
79
|
onFocus={ onFocus }
|
|
62
|
-
onDragStart={
|
|
80
|
+
onDragStart={ onDragStartHandler }
|
|
63
81
|
onDragEnd={ onDragEnd }
|
|
64
82
|
draggable={ draggable }
|
|
83
|
+
href={ `#block-${ clientId }` }
|
|
65
84
|
>
|
|
66
85
|
<ListViewExpander onClick={ onToggleExpanded } />
|
|
67
86
|
<BlockIcon icon={ blockInformation?.icon } showColors />
|
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
memo,
|
|
20
20
|
} from '@wordpress/element';
|
|
21
21
|
import { useDispatch } from '@wordpress/data';
|
|
22
|
+
import { sprintf, __ } from '@wordpress/i18n';
|
|
22
23
|
|
|
23
24
|
/**
|
|
24
25
|
* Internal dependencies
|
|
@@ -32,6 +33,7 @@ import ListViewBlockContents from './block-contents';
|
|
|
32
33
|
import BlockSettingsDropdown from '../block-settings-menu/block-settings-dropdown';
|
|
33
34
|
import { useListViewContext } from './context';
|
|
34
35
|
import { store as blockEditorStore } from '../../store';
|
|
36
|
+
import useBlockDisplayInformation from '../use-block-display-information';
|
|
35
37
|
|
|
36
38
|
function ListViewBlock( {
|
|
37
39
|
block,
|
|
@@ -143,6 +145,13 @@ function ListViewBlock( {
|
|
|
143
145
|
'has-single-cell': hideBlockActions,
|
|
144
146
|
} );
|
|
145
147
|
|
|
148
|
+
const blockInformation = useBlockDisplayInformation( clientId );
|
|
149
|
+
const settingsAriaLabel = sprintf(
|
|
150
|
+
// translators: %s: The title of the block.
|
|
151
|
+
__( 'Options for %s block' ),
|
|
152
|
+
blockInformation.title
|
|
153
|
+
);
|
|
154
|
+
|
|
146
155
|
return (
|
|
147
156
|
<ListViewLeaf
|
|
148
157
|
className={ classes }
|
|
@@ -218,6 +227,7 @@ function ListViewBlock( {
|
|
|
218
227
|
<BlockSettingsDropdown
|
|
219
228
|
clientIds={ [ clientId ] }
|
|
220
229
|
icon={ moreVertical }
|
|
230
|
+
label={ settingsAriaLabel }
|
|
221
231
|
toggleProps={ {
|
|
222
232
|
ref,
|
|
223
233
|
className: 'block-editor-list-view-block__menu',
|
|
@@ -75,6 +75,7 @@ export function MediaPlaceholder( {
|
|
|
75
75
|
onDoubleClick,
|
|
76
76
|
onFilesPreUpload = noop,
|
|
77
77
|
onHTMLDrop = noop,
|
|
78
|
+
onClose = noop,
|
|
78
79
|
children,
|
|
79
80
|
mediaLibraryButton,
|
|
80
81
|
placeholder,
|
|
@@ -328,6 +329,7 @@ export function MediaPlaceholder( {
|
|
|
328
329
|
gallery={ multiple && onlyAllowsImages() }
|
|
329
330
|
multiple={ multiple }
|
|
330
331
|
onSelect={ onSelect }
|
|
332
|
+
onClose={ onClose }
|
|
331
333
|
allowedTypes={ allowedTypes }
|
|
332
334
|
value={
|
|
333
335
|
Array.isArray( value )
|
|
@@ -34,15 +34,20 @@ import { store as blockEditorStore } from '../../store';
|
|
|
34
34
|
const MediaReplaceFlow = ( {
|
|
35
35
|
mediaURL,
|
|
36
36
|
mediaId,
|
|
37
|
+
mediaIds,
|
|
37
38
|
allowedTypes,
|
|
38
39
|
accept,
|
|
39
40
|
onSelect,
|
|
40
41
|
onSelectURL,
|
|
41
42
|
onFilesUpload = noop,
|
|
43
|
+
onCloseModal = noop,
|
|
42
44
|
name = __( 'Replace' ),
|
|
43
45
|
createNotice,
|
|
44
46
|
removeNotice,
|
|
45
47
|
children,
|
|
48
|
+
multiple = false,
|
|
49
|
+
addToGallery,
|
|
50
|
+
handleUpload = true,
|
|
46
51
|
} ) => {
|
|
47
52
|
const [ mediaURLValue, setMediaURLValue ] = useState( mediaURL );
|
|
48
53
|
const mediaUpload = useSelect( ( select ) => {
|
|
@@ -77,7 +82,8 @@ const MediaReplaceFlow = ( {
|
|
|
77
82
|
}, 1000 );
|
|
78
83
|
};
|
|
79
84
|
|
|
80
|
-
const selectMedia = ( media ) => {
|
|
85
|
+
const selectMedia = ( media, closeMenu ) => {
|
|
86
|
+
closeMenu();
|
|
81
87
|
setMediaURLValue( media.url );
|
|
82
88
|
// Calling `onSelect` after the state update since it might unmount the component.
|
|
83
89
|
onSelect( media );
|
|
@@ -89,11 +95,15 @@ const MediaReplaceFlow = ( {
|
|
|
89
95
|
onSelectURL( newURL );
|
|
90
96
|
};
|
|
91
97
|
|
|
92
|
-
const uploadFiles = ( event ) => {
|
|
98
|
+
const uploadFiles = ( event, closeMenu ) => {
|
|
93
99
|
const files = event.target.files;
|
|
100
|
+
if ( ! handleUpload ) {
|
|
101
|
+
closeMenu();
|
|
102
|
+
return onSelect( files );
|
|
103
|
+
}
|
|
94
104
|
onFilesUpload( files );
|
|
95
105
|
const setMedia = ( [ media ] ) => {
|
|
96
|
-
selectMedia( media );
|
|
106
|
+
selectMedia( media, closeMenu );
|
|
97
107
|
};
|
|
98
108
|
mediaUpload( {
|
|
99
109
|
allowedTypes,
|
|
@@ -110,6 +120,19 @@ const MediaReplaceFlow = ( {
|
|
|
110
120
|
}
|
|
111
121
|
};
|
|
112
122
|
|
|
123
|
+
const onlyAllowsImages = () => {
|
|
124
|
+
if ( ! allowedTypes || allowedTypes.length === 0 ) {
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
return allowedTypes.every(
|
|
129
|
+
( allowedType ) =>
|
|
130
|
+
allowedType === 'image' || allowedType.startsWith( 'image/' )
|
|
131
|
+
);
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
const gallery = multiple && onlyAllowsImages();
|
|
135
|
+
|
|
113
136
|
const POPOVER_PROPS = {
|
|
114
137
|
isAlternate: true,
|
|
115
138
|
};
|
|
@@ -133,9 +156,15 @@ const MediaReplaceFlow = ( {
|
|
|
133
156
|
<>
|
|
134
157
|
<NavigableMenu className="block-editor-media-replace-flow__media-upload-menu">
|
|
135
158
|
<MediaUpload
|
|
136
|
-
|
|
137
|
-
|
|
159
|
+
gallery={ gallery }
|
|
160
|
+
addToGallery={ addToGallery }
|
|
161
|
+
multiple={ multiple }
|
|
162
|
+
value={ multiple ? mediaIds : mediaId }
|
|
163
|
+
onSelect={ ( media ) =>
|
|
164
|
+
selectMedia( media, onClose )
|
|
165
|
+
}
|
|
138
166
|
allowedTypes={ allowedTypes }
|
|
167
|
+
onClose={ onCloseModal }
|
|
139
168
|
render={ ( { open } ) => (
|
|
140
169
|
<MenuItem icon={ mediaIcon } onClick={ open }>
|
|
141
170
|
{ __( 'Open Media Library' ) }
|
|
@@ -148,6 +177,7 @@ const MediaReplaceFlow = ( {
|
|
|
148
177
|
uploadFiles( event, onClose );
|
|
149
178
|
} }
|
|
150
179
|
accept={ accept }
|
|
180
|
+
multiple={ multiple }
|
|
151
181
|
render={ ( { openFileDialog } ) => {
|
|
152
182
|
return (
|
|
153
183
|
<MenuItem
|