@wordpress/block-editor 12.9.1-next.5a1d1283.0 → 12.10.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 +6 -0
- package/README.md +33 -3
- package/build/components/block-canvas/index.js +107 -0
- package/build/components/block-canvas/index.js.map +1 -0
- package/build/components/block-inspector/index.js +4 -1
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-patterns-list/index.js +19 -4
- package/build/components/block-patterns-list/index.js.map +1 -1
- package/build/components/block-patterns-paging/index.js +66 -0
- package/build/components/block-patterns-paging/index.js.map +1 -0
- package/build/components/block-settings-menu/block-settings-dropdown.js +28 -0
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-settings-menu-controls/index.js +4 -7
- package/build/components/block-settings-menu-controls/index.js.map +1 -1
- package/build/components/block-styles/index.js +1 -0
- package/build/components/block-styles/index.js.map +1 -1
- package/build/components/block-toolbar/block-toolbar-menu.native.js +3 -7
- package/build/components/block-toolbar/block-toolbar-menu.native.js.map +1 -1
- package/build/components/block-tools/block-contextual-toolbar.js +18 -7
- package/build/components/block-tools/block-contextual-toolbar.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/border-radius-control/input-controls.js +1 -1
- package/build/components/border-radius-control/input-controls.js.map +1 -1
- package/build/components/border-radius-control/linked-button.js +2 -4
- package/build/components/border-radius-control/linked-button.js.map +1 -1
- package/build/components/colors/with-colors.js.map +1 -1
- package/build/components/convert-to-group-buttons/use-convert-to-group-button-props.js +8 -21
- package/build/components/convert-to-group-buttons/use-convert-to-group-button-props.js.map +1 -1
- package/build/components/default-block-appender/index.native.js +20 -1
- package/build/components/default-block-appender/index.native.js.map +1 -1
- package/build/components/duotone/utils.js +68 -0
- package/build/components/duotone/utils.js.map +1 -1
- package/build/components/editor-styles/index.js +28 -9
- package/build/components/editor-styles/index.js.map +1 -1
- package/build/components/global-styles/hooks.js +2 -101
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/image-settings-panel.js +61 -0
- package/build/components/global-styles/image-settings-panel.js.map +1 -0
- package/build/components/global-styles/index.js +11 -17
- package/build/components/global-styles/index.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +19 -15
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js +1 -1
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/iframe/index.js +67 -33
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/image-editor/use-save-image.js +2 -5
- package/build/components/image-editor/use-save-image.js.map +1 -1
- package/build/components/image-editor/use-transform-image.js +9 -9
- package/build/components/image-editor/use-transform-image.js.map +1 -1
- package/build/components/index.js +8 -12
- package/build/components/index.js.map +1 -1
- package/build/components/index.native.js +6 -5
- package/build/components/index.native.js.map +1 -1
- package/build/components/inner-blocks/use-nested-settings-update.js +13 -7
- package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build/components/inserter/block-patterns-explorer/explorer.js +12 -6
- package/build/components/inserter/block-patterns-explorer/explorer.js.map +1 -1
- package/build/components/inserter/block-patterns-explorer/patterns-list.js +57 -23
- package/build/components/inserter/block-patterns-explorer/patterns-list.js.map +1 -1
- package/build/components/inserter/block-patterns-explorer/sidebar.js +24 -9
- package/build/components/inserter/block-patterns-explorer/sidebar.js.map +1 -1
- package/build/components/inserter/block-patterns-source-filter.js +54 -0
- package/build/components/inserter/block-patterns-source-filter.js.map +1 -0
- package/build/components/inserter/block-patterns-sync-filter.js +46 -0
- package/build/components/inserter/block-patterns-sync-filter.js.map +1 -0
- package/build/components/inserter/block-patterns-tab.js +91 -45
- package/build/components/inserter/block-patterns-tab.js.map +1 -1
- package/build/components/inserter/hooks/use-patterns-paging.js +57 -0
- package/build/components/inserter/hooks/use-patterns-paging.js.map +1 -0
- package/build/components/inserter/hooks/use-patterns-state.js +21 -10
- package/build/components/inserter/hooks/use-patterns-state.js.map +1 -1
- package/build/components/inserter/menu.js +13 -11
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/search-results.js +4 -3
- package/build/components/inserter/search-results.js.map +1 -1
- package/build/components/inserter/tabs.js +1 -12
- package/build/components/inserter/tabs.js.map +1 -1
- package/build/components/inspector-controls/block-support-slot-container.js +12 -1
- package/build/components/inspector-controls/block-support-slot-container.js.map +1 -1
- package/build/components/inspector-controls/fill.js +24 -13
- package/build/components/inspector-controls/fill.js.map +1 -1
- package/build/components/inspector-controls/groups.js +5 -3
- package/build/components/inspector-controls/groups.js.map +1 -1
- package/build/components/inspector-controls/slot.js +13 -0
- package/build/components/inspector-controls/slot.js.map +1 -1
- package/build/components/inspector-controls-tabs/styles-tab.js +3 -0
- package/build/components/inspector-controls-tabs/styles-tab.js.map +1 -1
- package/build/components/link-control/index.js +12 -2
- package/build/components/link-control/index.js.map +1 -1
- package/build/components/list-view/block-select-button.js +1 -3
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/list-view/block.js +13 -1
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/use-block-selection.js +29 -24
- package/build/components/list-view/use-block-selection.js.map +1 -1
- package/build/components/media-placeholder/index.js +2 -2
- package/build/components/media-placeholder/index.js.map +1 -1
- package/build/components/media-placeholder/index.native.js +11 -11
- package/build/components/media-placeholder/index.native.js.map +1 -1
- package/build/components/media-replace-flow/index.js +2 -3
- package/build/components/media-replace-flow/index.js.map +1 -1
- package/build/components/media-upload/constants.js +30 -0
- package/build/components/media-upload/constants.js.map +1 -0
- package/build/components/media-upload/index.native.js +63 -53
- package/build/components/media-upload/index.native.js.map +1 -1
- package/build/components/preview-options/index.js +1 -1
- package/build/components/preview-options/index.js.map +1 -1
- package/build/components/rich-text/index.js +34 -35
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/index.native.js +14 -32
- package/build/components/rich-text/index.native.js.map +1 -1
- package/build/components/rich-text/multiline.js +95 -0
- package/build/components/rich-text/multiline.js.map +1 -0
- package/build/components/rich-text/split-value.js +10 -16
- package/build/components/rich-text/split-value.js.map +1 -1
- package/build/components/rich-text/use-enter.js +31 -40
- package/build/components/rich-text/use-enter.js.map +1 -1
- package/build/components/rich-text/use-paste-handler.js +18 -33
- package/build/components/rich-text/use-paste-handler.js.map +1 -1
- package/build/components/spacing-sizes-control/utils.js +1 -1
- package/build/components/spacing-sizes-control/utils.js.map +1 -1
- package/build/components/use-block-commands/index.js +30 -18
- package/build/components/use-block-commands/index.js.map +1 -1
- package/build/components/use-block-display-information/index.js +5 -2
- package/build/components/use-block-display-information/index.js.map +1 -1
- package/build/hooks/background.js +258 -0
- package/build/hooks/background.js.map +1 -0
- package/build/hooks/block-hooks.js +188 -0
- package/build/hooks/block-hooks.js.map +1 -0
- package/build/hooks/block-rename-ui.js +160 -0
- package/build/hooks/block-rename-ui.js.map +1 -0
- package/build/hooks/duotone.js +29 -42
- package/build/hooks/duotone.js.map +1 -1
- package/build/hooks/index.js +2 -2
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/layout.js +31 -14
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/position.js +4 -2
- package/build/hooks/position.js.map +1 -1
- package/build/hooks/style.js +10 -3
- package/build/hooks/style.js.map +1 -1
- package/build/private-apis.js +2 -0
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +33 -10
- package/build/store/actions.js.map +1 -1
- package/build/store/private-actions.js +42 -8
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-selectors.js +23 -0
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +43 -1
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +84 -23
- package/build/store/selectors.js.map +1 -1
- package/build/store/utils.js +0 -4
- package/build/store/utils.js.map +1 -1
- package/build-module/components/block-canvas/index.js +97 -0
- package/build-module/components/block-canvas/index.js.map +1 -0
- package/build-module/components/block-inspector/index.js +4 -1
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-patterns-list/index.js +20 -5
- package/build-module/components/block-patterns-list/index.js.map +1 -1
- package/build-module/components/block-patterns-paging/index.js +59 -0
- package/build-module/components/block-patterns-paging/index.js.map +1 -0
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +28 -0
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-settings-menu-controls/index.js +4 -7
- package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
- package/build-module/components/block-styles/index.js +1 -0
- package/build-module/components/block-styles/index.js.map +1 -1
- package/build-module/components/block-toolbar/block-toolbar-menu.native.js +3 -7
- package/build-module/components/block-toolbar/block-toolbar-menu.native.js.map +1 -1
- package/build-module/components/block-tools/block-contextual-toolbar.js +18 -7
- package/build-module/components/block-tools/block-contextual-toolbar.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/border-radius-control/input-controls.js +1 -1
- package/build-module/components/border-radius-control/input-controls.js.map +1 -1
- package/build-module/components/border-radius-control/linked-button.js +2 -4
- package/build-module/components/border-radius-control/linked-button.js.map +1 -1
- package/build-module/components/colors/with-colors.js.map +1 -1
- package/build-module/components/convert-to-group-buttons/use-convert-to-group-button-props.js +8 -21
- package/build-module/components/convert-to-group-buttons/use-convert-to-group-button-props.js.map +1 -1
- package/build-module/components/default-block-appender/index.native.js +20 -1
- package/build-module/components/default-block-appender/index.native.js.map +1 -1
- package/build-module/components/duotone/utils.js +65 -0
- package/build-module/components/duotone/utils.js.map +1 -1
- package/build-module/components/editor-styles/index.js +28 -9
- package/build-module/components/editor-styles/index.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +3 -100
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/image-settings-panel.js +53 -0
- package/build-module/components/global-styles/image-settings-panel.js.map +1 -0
- package/build-module/components/global-styles/index.js +2 -2
- package/build-module/components/global-styles/index.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +18 -16
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js +1 -1
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/iframe/index.js +66 -33
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/image-editor/use-save-image.js +2 -5
- package/build-module/components/image-editor/use-save-image.js.map +1 -1
- package/build-module/components/image-editor/use-transform-image.js +9 -9
- package/build-module/components/image-editor/use-transform-image.js.map +1 -1
- package/build-module/components/index.js +1 -1
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/index.native.js +2 -1
- package/build-module/components/index.native.js.map +1 -1
- package/build-module/components/inner-blocks/use-nested-settings-update.js +14 -8
- package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build-module/components/inserter/block-patterns-explorer/explorer.js +12 -6
- package/build-module/components/inserter/block-patterns-explorer/explorer.js.map +1 -1
- package/build-module/components/inserter/block-patterns-explorer/patterns-list.js +59 -25
- package/build-module/components/inserter/block-patterns-explorer/patterns-list.js.map +1 -1
- package/build-module/components/inserter/block-patterns-explorer/sidebar.js +23 -9
- package/build-module/components/inserter/block-patterns-explorer/sidebar.js.map +1 -1
- package/build-module/components/inserter/block-patterns-source-filter.js +44 -0
- package/build-module/components/inserter/block-patterns-source-filter.js.map +1 -0
- package/build-module/components/inserter/block-patterns-sync-filter.js +38 -0
- package/build-module/components/inserter/block-patterns-sync-filter.js.map +1 -0
- package/build-module/components/inserter/block-patterns-tab.js +87 -46
- package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
- package/build-module/components/inserter/hooks/use-patterns-paging.js +50 -0
- package/build-module/components/inserter/hooks/use-patterns-paging.js.map +1 -0
- package/build-module/components/inserter/hooks/use-patterns-state.js +22 -10
- package/build-module/components/inserter/hooks/use-patterns-state.js.map +1 -1
- package/build-module/components/inserter/menu.js +13 -11
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/search-results.js +4 -3
- package/build-module/components/inserter/search-results.js.map +1 -1
- package/build-module/components/inserter/tabs.js +1 -12
- package/build-module/components/inserter/tabs.js.map +1 -1
- package/build-module/components/inspector-controls/block-support-slot-container.js +13 -2
- package/build-module/components/inspector-controls/block-support-slot-container.js.map +1 -1
- package/build-module/components/inspector-controls/fill.js +25 -14
- package/build-module/components/inspector-controls/fill.js.map +1 -1
- package/build-module/components/inspector-controls/groups.js +5 -3
- package/build-module/components/inspector-controls/groups.js.map +1 -1
- package/build-module/components/inspector-controls/slot.js +15 -1
- package/build-module/components/inspector-controls/slot.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/styles-tab.js +3 -0
- package/build-module/components/inspector-controls-tabs/styles-tab.js.map +1 -1
- package/build-module/components/link-control/index.js +12 -2
- package/build-module/components/link-control/index.js.map +1 -1
- package/build-module/components/list-view/block-select-button.js +1 -3
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/list-view/block.js +13 -1
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/use-block-selection.js +30 -25
- package/build-module/components/list-view/use-block-selection.js.map +1 -1
- package/build-module/components/media-placeholder/index.js +2 -2
- package/build-module/components/media-placeholder/index.js.map +1 -1
- package/build-module/components/media-placeholder/index.native.js +7 -7
- package/build-module/components/media-placeholder/index.native.js.map +1 -1
- package/build-module/components/media-replace-flow/index.js +2 -3
- package/build-module/components/media-replace-flow/index.js.map +1 -1
- package/build-module/components/media-upload/constants.js +14 -0
- package/build-module/components/media-upload/constants.js.map +1 -0
- package/build-module/components/media-upload/index.native.js +53 -34
- package/build-module/components/media-upload/index.native.js.map +1 -1
- package/build-module/components/preview-options/index.js +1 -1
- package/build-module/components/preview-options/index.js.map +1 -1
- package/build-module/components/rich-text/index.js +35 -37
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/index.native.js +15 -33
- package/build-module/components/rich-text/index.native.js.map +1 -1
- package/build-module/components/rich-text/multiline.js +87 -0
- package/build-module/components/rich-text/multiline.js.map +1 -0
- package/build-module/components/rich-text/split-value.js +10 -16
- package/build-module/components/rich-text/split-value.js.map +1 -1
- package/build-module/components/rich-text/use-enter.js +33 -42
- package/build-module/components/rich-text/use-enter.js.map +1 -1
- package/build-module/components/rich-text/use-paste-handler.js +19 -34
- package/build-module/components/rich-text/use-paste-handler.js.map +1 -1
- package/build-module/components/spacing-sizes-control/utils.js +2 -2
- package/build-module/components/spacing-sizes-control/utils.js.map +1 -1
- package/build-module/components/use-block-commands/index.js +28 -16
- package/build-module/components/use-block-commands/index.js.map +1 -1
- package/build-module/components/use-block-display-information/index.js +5 -2
- package/build-module/components/use-block-display-information/index.js.map +1 -1
- package/build-module/hooks/background.js +244 -0
- package/build-module/hooks/background.js.map +1 -0
- package/build-module/hooks/block-hooks.js +181 -0
- package/build-module/hooks/block-hooks.js.map +1 -0
- package/build-module/hooks/block-rename-ui.js +153 -0
- package/build-module/hooks/block-rename-ui.js.map +1 -0
- package/build-module/hooks/duotone.js +26 -39
- package/build-module/hooks/duotone.js.map +1 -1
- package/build-module/hooks/index.js +2 -2
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/layout.js +33 -16
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/hooks/position.js +4 -2
- package/build-module/hooks/position.js.map +1 -1
- package/build-module/hooks/style.js +10 -3
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/private-apis.js +2 -0
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/actions.js +33 -10
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/private-actions.js +39 -8
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-selectors.js +21 -0
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +41 -1
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +78 -22
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/store/utils.js +0 -4
- package/build-module/store/utils.js.map +1 -1
- package/build-style/content-rtl.css +0 -1
- package/build-style/content.css +0 -1
- package/build-style/style-rtl.css +170 -127
- package/build-style/style.css +170 -127
- package/package.json +32 -32
- package/src/components/block-canvas/index.js +108 -0
- package/src/components/block-inspector/index.js +5 -1
- package/src/components/block-list/content.scss +0 -1
- package/src/components/block-patterns-list/index.js +32 -7
- package/src/components/block-patterns-list/style.scss +26 -9
- package/src/components/block-patterns-paging/index.js +92 -0
- package/src/components/block-patterns-paging/style.scss +42 -0
- package/src/components/block-settings-menu/block-settings-dropdown.js +44 -0
- package/src/components/block-settings-menu-controls/index.js +4 -9
- package/src/components/block-styles/index.js +1 -0
- package/src/components/block-styles/style.scss +3 -3
- package/src/components/block-toolbar/block-toolbar-menu.native.js +1 -6
- package/src/components/block-tools/block-contextual-toolbar.js +16 -5
- package/src/components/block-tools/block-selection-button.js +9 -1
- package/src/components/block-tools/style.scss +0 -98
- package/src/components/border-radius-control/input-controls.js +1 -1
- package/src/components/border-radius-control/linked-button.js +8 -11
- package/src/components/color-palette/test/__snapshots__/control.js.snap +34 -21
- package/src/components/colors/with-colors.js +3 -2
- package/src/components/convert-to-group-buttons/use-convert-to-group-button-props.js +8 -35
- package/src/components/default-block-appender/index.native.js +26 -3
- package/src/components/duotone/utils.js +65 -0
- package/src/components/editor-styles/index.js +32 -23
- package/src/components/global-styles/hooks.js +4 -112
- package/src/components/global-styles/image-settings-panel.js +71 -0
- package/src/components/global-styles/index.js +4 -3
- package/src/components/global-styles/use-global-styles-output.js +25 -16
- package/src/components/global-styles/utils.js +1 -2
- package/src/components/iframe/index.js +72 -33
- package/src/components/image-editor/use-save-image.js +2 -9
- package/src/components/image-editor/use-transform-image.js +9 -9
- package/src/components/index.js +1 -1
- package/src/components/index.native.js +2 -2
- package/src/components/inner-blocks/use-nested-settings-update.js +15 -10
- package/src/components/inserter/block-patterns-explorer/explorer.js +17 -5
- package/src/components/inserter/block-patterns-explorer/patterns-list.js +109 -40
- package/src/components/inserter/block-patterns-explorer/sidebar.js +23 -8
- package/src/components/inserter/block-patterns-source-filter.js +40 -0
- package/src/components/inserter/block-patterns-sync-filter.js +35 -0
- package/src/components/inserter/block-patterns-tab.js +168 -57
- package/src/components/inserter/hooks/use-patterns-paging.js +65 -0
- package/src/components/inserter/hooks/use-patterns-state.js +27 -16
- package/src/components/inserter/menu.js +15 -17
- package/src/components/inserter/search-results.js +6 -4
- package/src/components/inserter/style.scss +23 -2
- package/src/components/inserter/tabs.js +2 -12
- package/src/components/inserter/test/index.native.js +8 -12
- package/src/components/inspector-controls/block-support-slot-container.js +19 -3
- package/src/components/inspector-controls/fill.js +28 -14
- package/src/components/inspector-controls/groups.js +6 -2
- package/src/components/inspector-controls/slot.js +28 -3
- package/src/components/inspector-controls-tabs/styles-tab.js +4 -0
- package/src/components/link-control/index.js +13 -0
- package/src/components/link-control/style.scss +23 -2
- package/src/components/link-control/test/index.js +88 -6
- package/src/components/list-view/block-select-button.js +1 -3
- package/src/components/list-view/block.js +19 -1
- package/src/components/list-view/style.scss +1 -2
- package/src/components/list-view/use-block-selection.js +38 -32
- package/src/components/media-placeholder/README.md +2 -2
- package/src/components/media-placeholder/index.js +2 -2
- package/src/components/media-placeholder/index.native.js +11 -12
- package/src/components/media-replace-flow/index.js +2 -2
- package/src/components/media-replace-flow/test/index.js +5 -23
- package/src/components/media-upload/README.md +3 -2
- package/src/components/media-upload/constants.js +15 -0
- package/src/components/media-upload/index.native.js +66 -40
- package/src/components/media-upload/style.native.scss +4 -0
- package/src/components/media-upload/test/index.native.js +2 -2
- package/src/components/preview-options/README.md +7 -0
- package/src/components/preview-options/index.js +1 -1
- package/src/components/rich-text/index.js +48 -44
- package/src/components/rich-text/index.native.js +14 -42
- package/src/components/rich-text/multiline.js +121 -0
- package/src/components/rich-text/split-value.js +10 -35
- package/src/components/rich-text/use-enter.js +32 -42
- package/src/components/rich-text/use-paste-handler.js +16 -40
- package/src/components/spacing-sizes-control/style.scss +5 -7
- package/src/components/spacing-sizes-control/utils.js +1 -2
- package/src/components/use-block-commands/index.js +28 -20
- package/src/components/use-block-display-information/index.js +3 -0
- package/src/hooks/background.js +288 -0
- package/src/hooks/background.scss +57 -0
- package/src/hooks/block-hooks.js +257 -0
- package/src/hooks/block-hooks.scss +16 -0
- package/src/hooks/block-rename-ui.js +230 -0
- package/src/hooks/block-rename-ui.scss +3 -0
- package/src/hooks/duotone.js +42 -43
- package/src/hooks/index.js +2 -2
- package/src/hooks/layout.js +31 -33
- package/src/hooks/position.js +4 -3
- package/src/hooks/style.js +11 -2
- package/src/hooks/test/align.native.js +4 -3
- package/src/private-apis.js +2 -0
- package/src/store/actions.js +52 -10
- package/src/store/private-actions.js +37 -6
- package/src/store/private-selectors.js +21 -0
- package/src/store/reducer.js +38 -0
- package/src/store/selectors.js +107 -26
- package/src/store/test/actions.js +19 -8
- package/src/store/test/private-actions.js +17 -0
- package/src/store/test/reducer.js +25 -0
- package/src/store/test/selectors.js +130 -123
- package/src/store/utils.js +3 -10
- package/src/style.scss +4 -0
- package/build/components/duotone/components.js +0 -135
- package/build/components/duotone/components.js.map +0 -1
- package/build/components/duotone/index.js +0 -38
- package/build/components/duotone/index.js.map +0 -1
- package/build/components/global-styles/behaviors-panel.js +0 -64
- package/build/components/global-styles/behaviors-panel.js.map +0 -1
- package/build/components/inserter/reusable-blocks-tab.js +0 -85
- package/build/components/inserter/reusable-blocks-tab.js.map +0 -1
- package/build/hooks/auto-inserting-blocks.js +0 -174
- package/build/hooks/auto-inserting-blocks.js.map +0 -1
- package/build/hooks/behaviors.js +0 -173
- package/build/hooks/behaviors.js.map +0 -1
- package/build-module/components/duotone/components.js +0 -126
- package/build-module/components/duotone/components.js.map +0 -1
- package/build-module/components/duotone/index.js +0 -3
- package/build-module/components/duotone/index.js.map +0 -1
- package/build-module/components/global-styles/behaviors-panel.js +0 -57
- package/build-module/components/global-styles/behaviors-panel.js.map +0 -1
- package/build-module/components/inserter/reusable-blocks-tab.js +0 -76
- package/build-module/components/inserter/reusable-blocks-tab.js.map +0 -1
- package/build-module/hooks/auto-inserting-blocks.js +0 -167
- package/build-module/hooks/auto-inserting-blocks.js.map +0 -1
- package/build-module/hooks/behaviors.js +0 -166
- package/build-module/hooks/behaviors.js.map +0 -1
- package/src/components/duotone/components.js +0 -133
- package/src/components/duotone/index.js +0 -7
- package/src/components/global-styles/behaviors-panel.js +0 -71
- package/src/components/inserter/reusable-blocks-tab.js +0 -84
- package/src/components/inserter/test/reusable-blocks-tab.js +0 -73
- package/src/hooks/auto-inserting-blocks.js +0 -232
- package/src/hooks/behaviors.js +0 -206
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { symbol as reusableBlockIcon } from '@wordpress/icons';
|
|
5
4
|
import { useMemo } from '@wordpress/element';
|
|
6
5
|
import { TabPanel } from '@wordpress/components';
|
|
7
6
|
import { __ } from '@wordpress/i18n';
|
|
@@ -16,12 +15,7 @@ const patternsTab = {
|
|
|
16
15
|
/* translators: Theme and Directory Patterns tab title in the block inserter. */
|
|
17
16
|
title: __( 'Patterns' ),
|
|
18
17
|
};
|
|
19
|
-
|
|
20
|
-
name: 'reusable',
|
|
21
|
-
/* translators: Locally created Patterns tab title in the block inserter. */
|
|
22
|
-
title: __( 'Synced patterns' ),
|
|
23
|
-
icon: reusableBlockIcon,
|
|
24
|
-
};
|
|
18
|
+
|
|
25
19
|
const mediaTab = {
|
|
26
20
|
name: 'media',
|
|
27
21
|
/* translators: Media tab title in the block inserter. */
|
|
@@ -31,7 +25,6 @@ const mediaTab = {
|
|
|
31
25
|
function InserterTabs( {
|
|
32
26
|
children,
|
|
33
27
|
showPatterns = false,
|
|
34
|
-
showReusableBlocks = false,
|
|
35
28
|
showMedia = false,
|
|
36
29
|
onSelect,
|
|
37
30
|
prioritizePatterns,
|
|
@@ -48,11 +41,8 @@ function InserterTabs( {
|
|
|
48
41
|
if ( showMedia ) {
|
|
49
42
|
tempTabs.push( mediaTab );
|
|
50
43
|
}
|
|
51
|
-
if ( showReusableBlocks ) {
|
|
52
|
-
tempTabs.push( reusableBlocksTab );
|
|
53
|
-
}
|
|
54
44
|
return tempTabs;
|
|
55
|
-
}, [ prioritizePatterns, showPatterns,
|
|
45
|
+
}, [ prioritizePatterns, showPatterns, showMedia ] );
|
|
56
46
|
|
|
57
47
|
return (
|
|
58
48
|
<TabPanel
|
|
@@ -67,9 +67,8 @@ describe( 'Inserter', () => {
|
|
|
67
67
|
fireEvent( addBlockButton, 'onLongPress' );
|
|
68
68
|
|
|
69
69
|
// Get Add To Beginning option
|
|
70
|
-
const addBlockToBeginningButton =
|
|
71
|
-
'Add To Beginning'
|
|
72
|
-
);
|
|
70
|
+
const addBlockToBeginningButton =
|
|
71
|
+
await getByLabelText( 'Add To Beginning' );
|
|
73
72
|
expect( addBlockToBeginningButton ).toBeVisible();
|
|
74
73
|
fireEvent.press( addBlockToBeginningButton );
|
|
75
74
|
|
|
@@ -97,9 +96,8 @@ describe( 'Inserter', () => {
|
|
|
97
96
|
fireEvent( addBlockButton, 'onLongPress' );
|
|
98
97
|
|
|
99
98
|
// Get Add Block Before option
|
|
100
|
-
const addBlockBeforeButton =
|
|
101
|
-
'Add Block Before'
|
|
102
|
-
);
|
|
99
|
+
const addBlockBeforeButton =
|
|
100
|
+
await getByLabelText( 'Add Block Before' );
|
|
103
101
|
expect( addBlockBeforeButton ).toBeVisible();
|
|
104
102
|
fireEvent.press( addBlockBeforeButton );
|
|
105
103
|
|
|
@@ -135,9 +133,8 @@ describe( 'Inserter', () => {
|
|
|
135
133
|
fireEvent( addBlockButton, 'onLongPress' );
|
|
136
134
|
|
|
137
135
|
// Get Add Block After option
|
|
138
|
-
const addBlockAfterButton =
|
|
139
|
-
'Add Block After'
|
|
140
|
-
);
|
|
136
|
+
const addBlockAfterButton =
|
|
137
|
+
await getByLabelText( 'Add Block After' );
|
|
141
138
|
expect( addBlockAfterButton ).toBeVisible();
|
|
142
139
|
fireEvent.press( addBlockAfterButton );
|
|
143
140
|
|
|
@@ -233,9 +230,8 @@ describe( 'Inserter', () => {
|
|
|
233
230
|
await addBlock( screen, 'Heading' );
|
|
234
231
|
|
|
235
232
|
// Select the title
|
|
236
|
-
const titleInputElement =
|
|
237
|
-
'Post title. test'
|
|
238
|
-
)[ 0 ];
|
|
233
|
+
const titleInputElement =
|
|
234
|
+
await getAllByLabelText( 'Post title. test' )[ 0 ];
|
|
239
235
|
expect( titleInputElement ).toBeVisible();
|
|
240
236
|
fireEvent.press( titleInputElement );
|
|
241
237
|
|
|
@@ -2,11 +2,27 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { __experimentalToolsPanelContext as ToolsPanelContext } from '@wordpress/components';
|
|
5
|
-
import { useContext } from '@wordpress/element';
|
|
5
|
+
import { useContext, useMemo } from '@wordpress/element';
|
|
6
6
|
|
|
7
|
-
export default function BlockSupportSlotContainer( {
|
|
7
|
+
export default function BlockSupportSlotContainer( {
|
|
8
|
+
Slot,
|
|
9
|
+
fillProps,
|
|
10
|
+
...props
|
|
11
|
+
} ) {
|
|
12
|
+
// Add the toolspanel context provider and value to existing fill props
|
|
8
13
|
const toolsPanelContext = useContext( ToolsPanelContext );
|
|
14
|
+
const computedFillProps = useMemo(
|
|
15
|
+
() => ( {
|
|
16
|
+
...( fillProps ?? {} ),
|
|
17
|
+
forwardedContext: [
|
|
18
|
+
...( fillProps?.forwardedContext ?? [] ),
|
|
19
|
+
[ ToolsPanelContext.Provider, { value: toolsPanelContext } ],
|
|
20
|
+
],
|
|
21
|
+
} ),
|
|
22
|
+
[ toolsPanelContext, fillProps ]
|
|
23
|
+
);
|
|
24
|
+
|
|
9
25
|
return (
|
|
10
|
-
<Slot { ...props } fillProps={
|
|
26
|
+
<Slot { ...props } fillProps={ computedFillProps } bubblesVirtually />
|
|
11
27
|
);
|
|
12
28
|
}
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
} from '@wordpress/components';
|
|
8
8
|
import warning from '@wordpress/warning';
|
|
9
9
|
import deprecated from '@wordpress/deprecated';
|
|
10
|
-
import { useEffect } from '@wordpress/element';
|
|
10
|
+
import { useEffect, useContext } from '@wordpress/element';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Internal dependencies
|
|
@@ -60,28 +60,42 @@ export default function InspectorControlsFill( {
|
|
|
60
60
|
);
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
function
|
|
64
|
-
const { registerResetAllFilter, deregisterResetAllFilter } =
|
|
63
|
+
function RegisterResetAll( { resetAllFilter, children } ) {
|
|
64
|
+
const { registerResetAllFilter, deregisterResetAllFilter } =
|
|
65
|
+
useContext( ToolsPanelContext );
|
|
65
66
|
useEffect( () => {
|
|
66
|
-
if (
|
|
67
|
+
if (
|
|
68
|
+
resetAllFilter &&
|
|
69
|
+
registerResetAllFilter &&
|
|
70
|
+
deregisterResetAllFilter
|
|
71
|
+
) {
|
|
67
72
|
registerResetAllFilter( resetAllFilter );
|
|
68
|
-
|
|
69
|
-
return () => {
|
|
70
|
-
if ( resetAllFilter && deregisterResetAllFilter ) {
|
|
73
|
+
return () => {
|
|
71
74
|
deregisterResetAllFilter( resetAllFilter );
|
|
72
|
-
}
|
|
73
|
-
}
|
|
75
|
+
};
|
|
76
|
+
}
|
|
74
77
|
}, [ resetAllFilter, registerResetAllFilter, deregisterResetAllFilter ] );
|
|
78
|
+
return children;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function ToolsPanelInspectorControl( { children, resetAllFilter, fillProps } ) {
|
|
82
|
+
// `fillProps.forwardedContext` is an array of context provider entries, provided by slot,
|
|
83
|
+
// that should wrap the fill markup.
|
|
84
|
+
const { forwardedContext = [] } = fillProps;
|
|
75
85
|
|
|
76
86
|
// Children passed to InspectorControlsFill will not have
|
|
77
87
|
// access to any React Context whose Provider is part of
|
|
78
88
|
// the InspectorControlsSlot tree. So we re-create the
|
|
79
89
|
// Provider in this subtree.
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
return (
|
|
83
|
-
<ToolsPanelContext.Provider value={ value }>
|
|
90
|
+
const innerMarkup = (
|
|
91
|
+
<RegisterResetAll resetAllFilter={ resetAllFilter }>
|
|
84
92
|
{ children }
|
|
85
|
-
</
|
|
93
|
+
</RegisterResetAll>
|
|
94
|
+
);
|
|
95
|
+
return forwardedContext.reduce(
|
|
96
|
+
( inner, [ Provider, props ] ) => (
|
|
97
|
+
<Provider { ...props }>{ inner }</Provider>
|
|
98
|
+
),
|
|
99
|
+
innerMarkup
|
|
86
100
|
);
|
|
87
101
|
}
|
|
@@ -5,6 +5,9 @@ import { createSlotFill } from '@wordpress/components';
|
|
|
5
5
|
|
|
6
6
|
const InspectorControlsDefault = createSlotFill( 'InspectorControls' );
|
|
7
7
|
const InspectorControlsAdvanced = createSlotFill( 'InspectorAdvancedControls' );
|
|
8
|
+
const InspectorControlsBackground = createSlotFill(
|
|
9
|
+
'InspectorControlsBackground'
|
|
10
|
+
);
|
|
8
11
|
const InspectorControlsBorder = createSlotFill( 'InspectorControlsBorder' );
|
|
9
12
|
const InspectorControlsColor = createSlotFill( 'InspectorControlsColor' );
|
|
10
13
|
const InspectorControlsFilter = createSlotFill( 'InspectorControlsFilter' );
|
|
@@ -21,15 +24,16 @@ const InspectorControlsStyles = createSlotFill( 'InspectorControlsStyles' );
|
|
|
21
24
|
const groups = {
|
|
22
25
|
default: InspectorControlsDefault,
|
|
23
26
|
advanced: InspectorControlsAdvanced,
|
|
27
|
+
background: InspectorControlsBackground,
|
|
24
28
|
border: InspectorControlsBorder,
|
|
25
29
|
color: InspectorControlsColor,
|
|
26
|
-
filter: InspectorControlsFilter,
|
|
27
30
|
dimensions: InspectorControlsDimensions,
|
|
31
|
+
filter: InspectorControlsFilter,
|
|
28
32
|
list: InspectorControlsListView,
|
|
33
|
+
position: InspectorControlsPosition,
|
|
29
34
|
settings: InspectorControlsDefault, // Alias for default.
|
|
30
35
|
styles: InspectorControlsStyles,
|
|
31
36
|
typography: InspectorControlsTypography,
|
|
32
|
-
position: InspectorControlsPosition,
|
|
33
37
|
};
|
|
34
38
|
|
|
35
39
|
export default groups;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
__experimentalUseSlotFills as useSlotFills,
|
|
6
|
+
__unstableMotionContext as MotionContext,
|
|
7
|
+
} from '@wordpress/components';
|
|
8
|
+
import { useContext, useMemo } from '@wordpress/element';
|
|
5
9
|
import warning from '@wordpress/warning';
|
|
6
10
|
import deprecated from '@wordpress/deprecated';
|
|
7
11
|
|
|
@@ -16,6 +20,7 @@ export default function InspectorControlsSlot( {
|
|
|
16
20
|
__experimentalGroup,
|
|
17
21
|
group = 'default',
|
|
18
22
|
label,
|
|
23
|
+
fillProps,
|
|
19
24
|
...props
|
|
20
25
|
} ) {
|
|
21
26
|
if ( __experimentalGroup ) {
|
|
@@ -31,6 +36,20 @@ export default function InspectorControlsSlot( {
|
|
|
31
36
|
}
|
|
32
37
|
const Slot = groups[ group ]?.Slot;
|
|
33
38
|
const fills = useSlotFills( Slot?.__unstableName );
|
|
39
|
+
|
|
40
|
+
const motionContextValue = useContext( MotionContext );
|
|
41
|
+
|
|
42
|
+
const computedFillProps = useMemo(
|
|
43
|
+
() => ( {
|
|
44
|
+
...( fillProps ?? {} ),
|
|
45
|
+
forwardedContext: [
|
|
46
|
+
...( fillProps?.forwardedContext ?? [] ),
|
|
47
|
+
[ MotionContext.Provider, { value: motionContextValue } ],
|
|
48
|
+
],
|
|
49
|
+
} ),
|
|
50
|
+
[ motionContextValue, fillProps ]
|
|
51
|
+
);
|
|
52
|
+
|
|
34
53
|
if ( ! Slot ) {
|
|
35
54
|
warning( `Unknown InspectorControls group "${ group }" provided.` );
|
|
36
55
|
return null;
|
|
@@ -43,10 +62,16 @@ export default function InspectorControlsSlot( {
|
|
|
43
62
|
if ( label ) {
|
|
44
63
|
return (
|
|
45
64
|
<BlockSupportToolsPanel group={ group } label={ label }>
|
|
46
|
-
<BlockSupportSlotContainer
|
|
65
|
+
<BlockSupportSlotContainer
|
|
66
|
+
{ ...props }
|
|
67
|
+
fillProps={ computedFillProps }
|
|
68
|
+
Slot={ Slot }
|
|
69
|
+
/>
|
|
47
70
|
</BlockSupportToolsPanel>
|
|
48
71
|
);
|
|
49
72
|
}
|
|
50
73
|
|
|
51
|
-
return
|
|
74
|
+
return (
|
|
75
|
+
<Slot { ...props } fillProps={ computedFillProps } bubblesVirtually />
|
|
76
|
+
);
|
|
52
77
|
}
|
|
@@ -32,6 +32,10 @@ const StylesTab = ( { blockName, clientId, hasBlockStyles } ) => {
|
|
|
32
32
|
label={ __( 'Color' ) }
|
|
33
33
|
className="color-block-support-panel__inner-wrapper"
|
|
34
34
|
/>
|
|
35
|
+
<InspectorControls.Slot
|
|
36
|
+
group="background"
|
|
37
|
+
label={ __( 'Background image' ) }
|
|
38
|
+
/>
|
|
35
39
|
<InspectorControls.Slot group="filter" />
|
|
36
40
|
<InspectorControls.Slot
|
|
37
41
|
group="typography"
|
|
@@ -14,6 +14,7 @@ import { ENTER } from '@wordpress/keycodes';
|
|
|
14
14
|
import { isShallowEqualObjects } from '@wordpress/is-shallow-equal';
|
|
15
15
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
16
16
|
import { store as preferencesStore } from '@wordpress/preferences';
|
|
17
|
+
import { keyboardReturn } from '@wordpress/icons';
|
|
17
18
|
|
|
18
19
|
/**
|
|
19
20
|
* Internal dependencies
|
|
@@ -355,6 +356,7 @@ function LinkControl( {
|
|
|
355
356
|
className={ classnames( {
|
|
356
357
|
'block-editor-link-control__search-input-wrapper': true,
|
|
357
358
|
'has-text-control': showTextControl,
|
|
359
|
+
'has-actions': showActions,
|
|
358
360
|
} ) }
|
|
359
361
|
>
|
|
360
362
|
{ showTextControl && (
|
|
@@ -388,6 +390,17 @@ function LinkControl( {
|
|
|
388
390
|
}
|
|
389
391
|
hideLabelFromVision={ ! showTextControl }
|
|
390
392
|
/>
|
|
393
|
+
{ ! showActions && (
|
|
394
|
+
<div className="block-editor-link-control__search-enter">
|
|
395
|
+
<Button
|
|
396
|
+
onClick={ isDisabled ? noop : handleSubmit }
|
|
397
|
+
label={ __( 'Submit' ) }
|
|
398
|
+
icon={ keyboardReturn }
|
|
399
|
+
className="block-editor-link-control__search-submit"
|
|
400
|
+
aria-disabled={ isDisabled }
|
|
401
|
+
/>
|
|
402
|
+
</div>
|
|
403
|
+
) }
|
|
391
404
|
</div>
|
|
392
405
|
{ errorMessage && (
|
|
393
406
|
<Notice
|
|
@@ -46,7 +46,8 @@ $preview-image-height: 140px;
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
// Provides positioning context for search actions
|
|
49
|
-
.block-editor-link-control__search-input-container
|
|
49
|
+
.block-editor-link-control__search-input-container,
|
|
50
|
+
.block-editor-link-control__search-input-wrapper {
|
|
50
51
|
position: relative;
|
|
51
52
|
}
|
|
52
53
|
|
|
@@ -79,6 +80,17 @@ $preview-image-height: 140px;
|
|
|
79
80
|
margin: -$grid-unit-20 * 0.5 $grid-unit-20 $grid-unit-20; // negative margin to bring the error a bit closer to the button
|
|
80
81
|
}
|
|
81
82
|
|
|
83
|
+
.block-editor-link-control__search-enter {
|
|
84
|
+
position: absolute;
|
|
85
|
+
right: 19px; // specific to place the button properly.
|
|
86
|
+
top: 3px;
|
|
87
|
+
|
|
88
|
+
svg {
|
|
89
|
+
position: relative;
|
|
90
|
+
top: -2px; // the icon itself is not centered within the bounds; this centers it.
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
82
94
|
.block-editor-link-control__search-actions {
|
|
83
95
|
display: flex;
|
|
84
96
|
flex-direction: row-reverse; // put "Cancel" on the left but retain DOM order.
|
|
@@ -427,6 +439,10 @@ $preview-image-height: 140px;
|
|
|
427
439
|
padding-left: 0;
|
|
428
440
|
gap: 0;
|
|
429
441
|
|
|
442
|
+
&[aria-expanded="true"] {
|
|
443
|
+
color: $gray-900;
|
|
444
|
+
}
|
|
445
|
+
|
|
430
446
|
// Point downwards when open (same as list view expander)
|
|
431
447
|
&[aria-expanded="true"] svg {
|
|
432
448
|
visibility: visible;
|
|
@@ -452,10 +468,15 @@ $preview-image-height: 140px;
|
|
|
452
468
|
left: auto;
|
|
453
469
|
bottom: auto;
|
|
454
470
|
top: calc(50% - #{$spinner-size} / 2);
|
|
455
|
-
right: $grid-unit-
|
|
471
|
+
right: $grid-unit-50;
|
|
456
472
|
}
|
|
457
473
|
}
|
|
458
474
|
|
|
475
|
+
.block-editor-link-control .block-editor-link-control__search-input-wrapper.has-actions .components-spinner {
|
|
476
|
+
top: calc(50% + #{$spinner-size} / 4); // Add top spacing because this input has a visual label.
|
|
477
|
+
right: $grid-unit-15;
|
|
478
|
+
}
|
|
479
|
+
|
|
459
480
|
.block-editor-link-control__search-item-action {
|
|
460
481
|
margin-left: auto; // push to far right hand side
|
|
461
482
|
flex-shrink: 0;
|
|
@@ -766,9 +766,6 @@ describe( 'Manual link entry', () => {
|
|
|
766
766
|
name: 'Save',
|
|
767
767
|
} );
|
|
768
768
|
|
|
769
|
-
// debug the UI state
|
|
770
|
-
// screen.debug();
|
|
771
|
-
|
|
772
769
|
// Verify the submission UI is disabled.
|
|
773
770
|
expect( submitButton ).toBeVisible();
|
|
774
771
|
expect( submitButton ).toHaveAttribute(
|
|
@@ -939,6 +936,92 @@ describe( 'Manual link entry', () => {
|
|
|
939
936
|
} );
|
|
940
937
|
} );
|
|
941
938
|
|
|
939
|
+
describe( 'Link submission', () => {
|
|
940
|
+
it( 'should show a submit button when creating a link', async () => {
|
|
941
|
+
const user = userEvent.setup();
|
|
942
|
+
|
|
943
|
+
const LinkControlConsumer = () => {
|
|
944
|
+
const [ link, setLink ] = useState( {} );
|
|
945
|
+
|
|
946
|
+
return <LinkControl value={ link } onChange={ setLink } />;
|
|
947
|
+
};
|
|
948
|
+
|
|
949
|
+
render( <LinkControlConsumer /> );
|
|
950
|
+
|
|
951
|
+
const searchInput = screen.getByRole( 'combobox', {
|
|
952
|
+
name: 'Link',
|
|
953
|
+
} );
|
|
954
|
+
|
|
955
|
+
const submitButton = screen.getByRole( 'button', {
|
|
956
|
+
name: 'Submit',
|
|
957
|
+
} );
|
|
958
|
+
|
|
959
|
+
expect( submitButton ).toBeVisible();
|
|
960
|
+
expect( submitButton ).toHaveAttribute( 'aria-disabled', 'true' );
|
|
961
|
+
|
|
962
|
+
// Click the button and check it's not possible to prematurely submit the link.
|
|
963
|
+
await user.click( submitButton );
|
|
964
|
+
|
|
965
|
+
expect( searchInput ).toBeVisible();
|
|
966
|
+
expect( submitButton ).toBeVisible();
|
|
967
|
+
|
|
968
|
+
await user.type( searchInput, 'https://wordpress.org' );
|
|
969
|
+
|
|
970
|
+
expect( submitButton ).toHaveAttribute( 'aria-disabled', 'false' );
|
|
971
|
+
} );
|
|
972
|
+
|
|
973
|
+
it( 'should show a submit button when editing a link', async () => {
|
|
974
|
+
const user = userEvent.setup();
|
|
975
|
+
|
|
976
|
+
const LinkControlConsumer = () => {
|
|
977
|
+
const [ link, setLink ] = useState( fauxEntitySuggestions[ 0 ] );
|
|
978
|
+
|
|
979
|
+
return (
|
|
980
|
+
<LinkControl
|
|
981
|
+
forceIsEditingLink
|
|
982
|
+
value={ link }
|
|
983
|
+
onChange={ setLink }
|
|
984
|
+
/>
|
|
985
|
+
);
|
|
986
|
+
};
|
|
987
|
+
|
|
988
|
+
render( <LinkControlConsumer /> );
|
|
989
|
+
|
|
990
|
+
const searchInput = screen.getByRole( 'combobox', {
|
|
991
|
+
name: 'Link',
|
|
992
|
+
} );
|
|
993
|
+
|
|
994
|
+
const createSubmitButton = screen.queryByRole( 'button', {
|
|
995
|
+
name: 'Submit',
|
|
996
|
+
} );
|
|
997
|
+
|
|
998
|
+
// Check the submit button for "creation" of links is not displayed.
|
|
999
|
+
expect( createSubmitButton ).not.toBeInTheDocument();
|
|
1000
|
+
|
|
1001
|
+
const editSubmitButton = screen.getByRole( 'button', {
|
|
1002
|
+
name: 'Save',
|
|
1003
|
+
} );
|
|
1004
|
+
|
|
1005
|
+
expect( editSubmitButton ).toBeVisible();
|
|
1006
|
+
expect( editSubmitButton ).toHaveAttribute( 'aria-disabled', 'true' );
|
|
1007
|
+
|
|
1008
|
+
// Click the button and check it's not possible to prematurely submit the link.
|
|
1009
|
+
await user.click( editSubmitButton );
|
|
1010
|
+
|
|
1011
|
+
expect( searchInput ).toBeVisible();
|
|
1012
|
+
expect( editSubmitButton ).toBeVisible();
|
|
1013
|
+
|
|
1014
|
+
await user.type( searchInput, '#appendtolinktext' );
|
|
1015
|
+
|
|
1016
|
+
// As typing triggers the search handler, we need to wait for the
|
|
1017
|
+
// search results to be returned. We can use the presence of the
|
|
1018
|
+
// search results listbox as a proxy for this.
|
|
1019
|
+
expect( await screen.findByRole( 'listbox' ) ).toBeVisible();
|
|
1020
|
+
|
|
1021
|
+
expect( editSubmitButton ).toHaveAttribute( 'aria-disabled', 'false' );
|
|
1022
|
+
} );
|
|
1023
|
+
} );
|
|
1024
|
+
|
|
942
1025
|
describe( 'Default search suggestions', () => {
|
|
943
1026
|
it( 'should display a list of initial search suggestions when there is no search value or suggestions', async () => {
|
|
944
1027
|
render( <LinkControl showInitialSuggestions /> );
|
|
@@ -1135,9 +1218,8 @@ describe( 'Creating Entities (eg: Posts, Pages)', () => {
|
|
|
1135
1218
|
// Resolve the `createSuggestion` promise.
|
|
1136
1219
|
resolver();
|
|
1137
1220
|
|
|
1138
|
-
const currentLink =
|
|
1139
|
-
'Currently selected'
|
|
1140
|
-
);
|
|
1221
|
+
const currentLink =
|
|
1222
|
+
await screen.findByLabelText( 'Currently selected' );
|
|
1141
1223
|
|
|
1142
1224
|
expect( currentLink ).toHaveTextContent( entityNameText );
|
|
1143
1225
|
expect( currentLink ).toHaveTextContent( '/?p=123' );
|
|
@@ -233,9 +233,7 @@ function ListViewBlockSelectButton(
|
|
|
233
233
|
) }
|
|
234
234
|
{ positionLabel && isSticky && (
|
|
235
235
|
<Tooltip text={ positionLabel }>
|
|
236
|
-
<
|
|
237
|
-
<Icon icon={ pinSmall } />
|
|
238
|
-
</span>
|
|
236
|
+
<Icon icon={ pinSmall } />
|
|
239
237
|
</Tooltip>
|
|
240
238
|
) }
|
|
241
239
|
{ images.length ? (
|
|
@@ -23,6 +23,7 @@ import {
|
|
|
23
23
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
24
24
|
import { sprintf, __ } from '@wordpress/i18n';
|
|
25
25
|
import { focus } from '@wordpress/dom';
|
|
26
|
+
import { ESCAPE } from '@wordpress/keycodes';
|
|
26
27
|
|
|
27
28
|
/**
|
|
28
29
|
* Internal dependencies
|
|
@@ -72,7 +73,9 @@ function ListViewBlock( {
|
|
|
72
73
|
const { toggleBlockHighlight } = useDispatch( blockEditorStore );
|
|
73
74
|
|
|
74
75
|
const blockInformation = useBlockDisplayInformation( clientId );
|
|
75
|
-
const blockTitle =
|
|
76
|
+
const blockTitle =
|
|
77
|
+
blockInformation?.name || blockInformation?.title || __( 'Untitled' );
|
|
78
|
+
|
|
76
79
|
const block = useSelect(
|
|
77
80
|
( select ) => select( blockEditorStore ).getBlock( clientId ),
|
|
78
81
|
[ clientId ]
|
|
@@ -148,6 +151,20 @@ function ListViewBlock( {
|
|
|
148
151
|
}
|
|
149
152
|
}, [] );
|
|
150
153
|
|
|
154
|
+
// If multiple blocks are selected, deselect all blocks when the user
|
|
155
|
+
// presses the escape key.
|
|
156
|
+
const onKeyDown = ( event ) => {
|
|
157
|
+
if (
|
|
158
|
+
event.keyCode === ESCAPE &&
|
|
159
|
+
! event.defaultPrevented &&
|
|
160
|
+
selectedClientIds.length > 0
|
|
161
|
+
) {
|
|
162
|
+
event.stopPropagation();
|
|
163
|
+
event.preventDefault();
|
|
164
|
+
selectBlock( event, undefined );
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
|
|
151
168
|
const onMouseEnter = useCallback( () => {
|
|
152
169
|
setIsHovered( true );
|
|
153
170
|
toggleBlockHighlight( clientId, true );
|
|
@@ -255,6 +272,7 @@ function ListViewBlock( {
|
|
|
255
272
|
return (
|
|
256
273
|
<ListViewLeaf
|
|
257
274
|
className={ classes }
|
|
275
|
+
onKeyDown={ onKeyDown }
|
|
258
276
|
onMouseEnter={ onMouseEnter }
|
|
259
277
|
onMouseLeave={ onMouseLeave }
|
|
260
278
|
onFocus={ onMouseEnter }
|
|
@@ -5,7 +5,7 @@ import { speak } from '@wordpress/a11y';
|
|
|
5
5
|
import { __, sprintf } from '@wordpress/i18n';
|
|
6
6
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
7
7
|
import { useCallback } from '@wordpress/element';
|
|
8
|
-
import { UP, DOWN, HOME, END } from '@wordpress/keycodes';
|
|
8
|
+
import { UP, DOWN, HOME, END, ESCAPE } from '@wordpress/keycodes';
|
|
9
9
|
import { store as blocksStore } from '@wordpress/blocks';
|
|
10
10
|
|
|
11
11
|
/**
|
|
@@ -30,7 +30,7 @@ export default function useBlockSelection() {
|
|
|
30
30
|
|
|
31
31
|
const updateBlockSelection = useCallback(
|
|
32
32
|
async ( event, clientId, destinationClientId, focusPosition ) => {
|
|
33
|
-
if ( ! event?.shiftKey ) {
|
|
33
|
+
if ( ! event?.shiftKey && event?.keyCode !== ESCAPE ) {
|
|
34
34
|
selectBlock( clientId, focusPosition );
|
|
35
35
|
return;
|
|
36
36
|
}
|
|
@@ -39,6 +39,8 @@ export default function useBlockSelection() {
|
|
|
39
39
|
// the browser default behavior of opening the link in a new window.
|
|
40
40
|
event.preventDefault();
|
|
41
41
|
|
|
42
|
+
const isOnlyDeselection =
|
|
43
|
+
event.type === 'keydown' && event.keyCode === ESCAPE;
|
|
42
44
|
const isKeyPress =
|
|
43
45
|
event.type === 'keydown' &&
|
|
44
46
|
( event.keyCode === UP ||
|
|
@@ -63,10 +65,11 @@ export default function useBlockSelection() {
|
|
|
63
65
|
];
|
|
64
66
|
|
|
65
67
|
if (
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
isOnlyDeselection ||
|
|
69
|
+
( isKeyPress &&
|
|
70
|
+
! selectedBlocks.some( ( blockId ) =>
|
|
71
|
+
clientIdWithParents.includes( blockId )
|
|
72
|
+
) )
|
|
70
73
|
) {
|
|
71
74
|
// Ensure that shift-selecting blocks via the keyboard only
|
|
72
75
|
// expands the current selection if focusing over already
|
|
@@ -75,35 +78,38 @@ export default function useBlockSelection() {
|
|
|
75
78
|
await clearSelectedBlock();
|
|
76
79
|
}
|
|
77
80
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
81
|
+
// Update selection, if not only clearing the selection.
|
|
82
|
+
if ( ! isOnlyDeselection ) {
|
|
83
|
+
let startTarget = getBlockSelectionStart();
|
|
84
|
+
let endTarget = clientId;
|
|
85
|
+
|
|
86
|
+
// Handle keyboard behavior for selecting multiple blocks.
|
|
87
|
+
if ( isKeyPress ) {
|
|
88
|
+
if ( ! hasSelectedBlock() && ! hasMultiSelection() ) {
|
|
89
|
+
// Set the starting point of the selection to the currently
|
|
90
|
+
// focused block, if there are no blocks currently selected.
|
|
91
|
+
// This ensures that as the selection is expanded or contracted,
|
|
92
|
+
// the starting point of the selection is anchored to that block.
|
|
93
|
+
startTarget = clientId;
|
|
94
|
+
}
|
|
95
|
+
if ( destinationClientId ) {
|
|
96
|
+
// If the user presses UP or DOWN, we want to ensure that the block they're
|
|
97
|
+
// moving to is the target for selection, and not the currently focused one.
|
|
98
|
+
endTarget = destinationClientId;
|
|
99
|
+
}
|
|
89
100
|
}
|
|
90
|
-
if ( destinationClientId ) {
|
|
91
|
-
// If the user presses UP or DOWN, we want to ensure that the block they're
|
|
92
|
-
// moving to is the target for selection, and not the currently focused one.
|
|
93
|
-
endTarget = destinationClientId;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
101
|
|
|
97
|
-
|
|
98
|
-
|
|
102
|
+
const startParents = getBlockParents( startTarget );
|
|
103
|
+
const endParents = getBlockParents( endTarget );
|
|
99
104
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
105
|
+
const { start, end } = getCommonDepthClientIds(
|
|
106
|
+
startTarget,
|
|
107
|
+
endTarget,
|
|
108
|
+
startParents,
|
|
109
|
+
endParents
|
|
110
|
+
);
|
|
111
|
+
await multiSelect( start, end, null );
|
|
112
|
+
}
|
|
107
113
|
|
|
108
114
|
// Announce deselected block, or number of deselected blocks if
|
|
109
115
|
// the total number of blocks deselected is greater than one.
|