@wordpress/block-editor 12.9.1-next.5a1d1283.0 → 12.10.1
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 +28 -8
- package/build/components/block-patterns-list/index.js.map +1 -1
- package/build/components/block-patterns-paging/index.js +68 -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 +45 -22
- package/build/components/inserter/block-patterns-explorer/patterns-list.js.map +1 -1
- package/build/components/inserter/block-patterns-explorer/sidebar.js +9 -9
- package/build/components/inserter/block-patterns-explorer/sidebar.js.map +1 -1
- package/build/components/inserter/block-patterns-filter.js +137 -0
- package/build/components/inserter/block-patterns-filter.js.map +1 -0
- package/build/components/inserter/block-patterns-tab.js +128 -42
- package/build/components/inserter/block-patterns-tab.js.map +1 -1
- package/build/components/inserter/hooks/use-patterns-paging.js +61 -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 +263 -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 +161 -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 +25 -3
- 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 +30 -10
- package/build-module/components/block-patterns-list/index.js.map +1 -1
- package/build-module/components/block-patterns-paging/index.js +61 -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 +47 -24
- package/build-module/components/inserter/block-patterns-explorer/patterns-list.js.map +1 -1
- package/build-module/components/inserter/block-patterns-explorer/sidebar.js +9 -9
- package/build-module/components/inserter/block-patterns-explorer/sidebar.js.map +1 -1
- package/build-module/components/inserter/block-patterns-filter.js +128 -0
- package/build-module/components/inserter/block-patterns-filter.js.map +1 -0
- package/build-module/components/inserter/block-patterns-tab.js +125 -44
- package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
- package/build-module/components/inserter/hooks/use-patterns-paging.js +54 -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 +249 -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 +154 -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 +23 -3
- 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 +201 -131
- package/build-style/style.css +201 -131
- 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 +53 -19
- 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 +45 -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 +68 -43
- package/src/components/inserter/block-patterns-explorer/sidebar.js +8 -8
- package/src/components/inserter/block-patterns-filter.js +183 -0
- package/src/components/inserter/block-patterns-tab.js +217 -58
- package/src/components/inserter/hooks/use-patterns-paging.js +76 -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 +36 -7
- 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 +299 -0
- package/src/hooks/background.scss +75 -0
- package/src/hooks/block-hooks.js +257 -0
- package/src/hooks/block-hooks.scss +16 -0
- package/src/hooks/block-rename-ui.js +231 -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 +28 -3
- 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
|
@@ -92,7 +92,7 @@ export function showBlockInterface() {
|
|
|
92
92
|
*/
|
|
93
93
|
export const privateRemoveBlocks =
|
|
94
94
|
( clientIds, selectPrevious = true, forceRemove = false ) =>
|
|
95
|
-
( { select, dispatch } ) => {
|
|
95
|
+
( { select, dispatch, registry } ) => {
|
|
96
96
|
if ( ! clientIds || ! clientIds.length ) {
|
|
97
97
|
return;
|
|
98
98
|
}
|
|
@@ -154,11 +154,14 @@ export const privateRemoveBlocks =
|
|
|
154
154
|
dispatch.selectPreviousBlock( clientIds[ 0 ], selectPrevious );
|
|
155
155
|
}
|
|
156
156
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
157
|
+
// We're batching these two actions because an extra `undo/redo` step can
|
|
158
|
+
// be created, based on whether we insert a default block or not.
|
|
159
|
+
registry.batch( () => {
|
|
160
|
+
dispatch( { type: 'REMOVE_BLOCKS', clientIds } );
|
|
161
|
+
// To avoid a focus loss when removing the last block, assure there is
|
|
162
|
+
// always a default block if the last of the blocks have been removed.
|
|
163
|
+
dispatch( ensureDefaultBlock() );
|
|
164
|
+
} );
|
|
162
165
|
};
|
|
163
166
|
|
|
164
167
|
/**
|
|
@@ -259,3 +262,31 @@ export function setBlockRemovalRules( rules = false ) {
|
|
|
259
262
|
rules,
|
|
260
263
|
};
|
|
261
264
|
}
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* Sets the client ID of the block settings menu that is currently open.
|
|
268
|
+
*
|
|
269
|
+
* @param {?string} clientId The block client ID.
|
|
270
|
+
* @return {Object} Action object.
|
|
271
|
+
*/
|
|
272
|
+
export function setOpenedBlockSettingsMenu( clientId ) {
|
|
273
|
+
return {
|
|
274
|
+
type: 'SET_OPENED_BLOCK_SETTINGS_MENU',
|
|
275
|
+
clientId,
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
export function setStyleOverride( id, style ) {
|
|
280
|
+
return {
|
|
281
|
+
type: 'SET_STYLE_OVERRIDE',
|
|
282
|
+
id,
|
|
283
|
+
style,
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
export function deleteStyleOverride( id ) {
|
|
288
|
+
return {
|
|
289
|
+
type: 'DELETE_STYLE_OVERRIDE',
|
|
290
|
+
id,
|
|
291
|
+
};
|
|
292
|
+
}
|
|
@@ -45,9 +45,8 @@ export function getLastInsertedBlocksClientIds( state ) {
|
|
|
45
45
|
export const isBlockSubtreeDisabled = createSelector(
|
|
46
46
|
( state, clientId ) => {
|
|
47
47
|
const isChildSubtreeDisabled = ( childClientId ) => {
|
|
48
|
-
const mode = state.blockEditingModes.get( childClientId );
|
|
49
48
|
return (
|
|
50
|
-
(
|
|
49
|
+
getBlockEditingMode( state, childClientId ) === 'disabled' &&
|
|
51
50
|
getBlockOrder( state, childClientId ).every(
|
|
52
51
|
isChildSubtreeDisabled
|
|
53
52
|
)
|
|
@@ -58,7 +57,12 @@ export const isBlockSubtreeDisabled = createSelector(
|
|
|
58
57
|
getBlockOrder( state, clientId ).every( isChildSubtreeDisabled )
|
|
59
58
|
);
|
|
60
59
|
},
|
|
61
|
-
( state ) => [
|
|
60
|
+
( state ) => [
|
|
61
|
+
state.blocks.parents,
|
|
62
|
+
state.blocks.order,
|
|
63
|
+
state.blockEditingModes,
|
|
64
|
+
state.blockListSettings,
|
|
65
|
+
]
|
|
62
66
|
);
|
|
63
67
|
|
|
64
68
|
/**
|
|
@@ -139,3 +143,24 @@ export function getRemovalPromptData( state ) {
|
|
|
139
143
|
export function getBlockRemovalRules( state ) {
|
|
140
144
|
return state.blockRemovalRules;
|
|
141
145
|
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Returns the client ID of the block settings menu that is currently open.
|
|
149
|
+
*
|
|
150
|
+
* @param {Object} state Global application state.
|
|
151
|
+
* @return {string|null} The client ID of the block menu that is currently open.
|
|
152
|
+
*/
|
|
153
|
+
export function getOpenedBlockSettingsMenu( state ) {
|
|
154
|
+
return state.openedBlockSettingsMenu;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Returns all style overrides, intended to be merged with global editor styles.
|
|
159
|
+
*
|
|
160
|
+
* @param {Object} state Global application state.
|
|
161
|
+
*
|
|
162
|
+
* @return {Map} A map of style IDs to style overrides.
|
|
163
|
+
*/
|
|
164
|
+
export function getStyleOverrides( state ) {
|
|
165
|
+
return state.styleOverrides;
|
|
166
|
+
}
|
package/src/store/reducer.js
CHANGED
|
@@ -1913,6 +1913,42 @@ export function blockEditingModes( state = new Map(), action ) {
|
|
|
1913
1913
|
return state;
|
|
1914
1914
|
}
|
|
1915
1915
|
|
|
1916
|
+
/**
|
|
1917
|
+
* Reducer returning the clientId of the block settings menu that is currently open.
|
|
1918
|
+
*
|
|
1919
|
+
* @param {string|null} state Current state.
|
|
1920
|
+
* @param {Object} action Dispatched action.
|
|
1921
|
+
*
|
|
1922
|
+
* @return {string|null} Updated state.
|
|
1923
|
+
*/
|
|
1924
|
+
export function openedBlockSettingsMenu( state = null, action ) {
|
|
1925
|
+
if ( 'SET_OPENED_BLOCK_SETTINGS_MENU' === action.type ) {
|
|
1926
|
+
return action?.clientId ?? null;
|
|
1927
|
+
}
|
|
1928
|
+
return state;
|
|
1929
|
+
}
|
|
1930
|
+
|
|
1931
|
+
/**
|
|
1932
|
+
* Reducer returning a map of style IDs to style overrides.
|
|
1933
|
+
*
|
|
1934
|
+
* @param {Map} state Current state.
|
|
1935
|
+
* @param {Object} action Dispatched action.
|
|
1936
|
+
*
|
|
1937
|
+
* @return {Map} Updated state.
|
|
1938
|
+
*/
|
|
1939
|
+
export function styleOverrides( state = new Map(), action ) {
|
|
1940
|
+
switch ( action.type ) {
|
|
1941
|
+
case 'SET_STYLE_OVERRIDE':
|
|
1942
|
+
return new Map( state ).set( action.id, action.style );
|
|
1943
|
+
case 'DELETE_STYLE_OVERRIDE': {
|
|
1944
|
+
const newState = new Map( state );
|
|
1945
|
+
newState.delete( action.id );
|
|
1946
|
+
return newState;
|
|
1947
|
+
}
|
|
1948
|
+
}
|
|
1949
|
+
return state;
|
|
1950
|
+
}
|
|
1951
|
+
|
|
1916
1952
|
const combinedReducers = combineReducers( {
|
|
1917
1953
|
blocks,
|
|
1918
1954
|
isTyping,
|
|
@@ -1936,8 +1972,10 @@ const combinedReducers = combineReducers( {
|
|
|
1936
1972
|
temporarilyEditingAsBlocks,
|
|
1937
1973
|
blockVisibility,
|
|
1938
1974
|
blockEditingModes,
|
|
1975
|
+
styleOverrides,
|
|
1939
1976
|
removalPromptData,
|
|
1940
1977
|
blockRemovalRules,
|
|
1978
|
+
openedBlockSettingsMenu,
|
|
1941
1979
|
} );
|
|
1942
1980
|
|
|
1943
1981
|
function withAutomaticChangeReset( reducer ) {
|
package/src/store/selectors.js
CHANGED
|
@@ -245,19 +245,20 @@ export const __unstableGetClientIdsTree = createSelector(
|
|
|
245
245
|
* given. Returned ids are ordered first by the order of the ids given, then
|
|
246
246
|
* by the order that they appear in the editor.
|
|
247
247
|
*
|
|
248
|
-
* @param {Object}
|
|
249
|
-
* @param {
|
|
248
|
+
* @param {Object} state Global application state.
|
|
249
|
+
* @param {string|string[]} clientIds Client ID(s) for which descendant blocks are to be returned.
|
|
250
250
|
*
|
|
251
|
-
* @return {Array}
|
|
251
|
+
* @return {Array} Client IDs of descendants.
|
|
252
252
|
*/
|
|
253
253
|
export const getClientIdsOfDescendants = createSelector(
|
|
254
254
|
( state, clientIds ) => {
|
|
255
|
+
const givenIds = Array.isArray( clientIds ) ? clientIds : [ clientIds ];
|
|
255
256
|
const collectedIds = [];
|
|
256
|
-
for ( const givenId of
|
|
257
|
+
for ( const givenId of givenIds ) {
|
|
257
258
|
for ( const descendantId of getBlockOrder( state, givenId ) ) {
|
|
258
259
|
collectedIds.push(
|
|
259
260
|
descendantId,
|
|
260
|
-
...getClientIdsOfDescendants( state,
|
|
261
|
+
...getClientIdsOfDescendants( state, descendantId )
|
|
261
262
|
);
|
|
262
263
|
}
|
|
263
264
|
}
|
|
@@ -281,7 +282,7 @@ export const getClientIdsWithDescendants = createSelector(
|
|
|
281
282
|
for ( const topLevelId of getBlockOrder( state ) ) {
|
|
282
283
|
collectedIds.push(
|
|
283
284
|
topLevelId,
|
|
284
|
-
...getClientIdsOfDescendants( state,
|
|
285
|
+
...getClientIdsOfDescendants( state, topLevelId )
|
|
285
286
|
);
|
|
286
287
|
}
|
|
287
288
|
return collectedIds;
|
|
@@ -2290,31 +2291,44 @@ const checkAllowListRecursive = ( blocks, allowedBlockTypes ) => {
|
|
|
2290
2291
|
return true;
|
|
2291
2292
|
};
|
|
2292
2293
|
|
|
2293
|
-
function
|
|
2294
|
-
const
|
|
2294
|
+
function getUserPatterns( state ) {
|
|
2295
|
+
const userPatterns =
|
|
2295
2296
|
state?.settings?.__experimentalReusableBlocks ?? EMPTY_ARRAY;
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2297
|
+
const userPatternCategories =
|
|
2298
|
+
state?.settings?.__experimentalUserPatternCategories ?? [];
|
|
2299
|
+
const categories = new Map();
|
|
2300
|
+
userPatternCategories.forEach( ( userCategory ) =>
|
|
2301
|
+
categories.set( userCategory.id, userCategory )
|
|
2302
|
+
);
|
|
2303
|
+
return userPatterns.map( ( userPattern ) => {
|
|
2304
|
+
return {
|
|
2305
|
+
name: `core/block/${ userPattern.id }`,
|
|
2306
|
+
id: userPattern.id,
|
|
2307
|
+
title: userPattern.title.raw,
|
|
2308
|
+
categories: userPattern.wp_pattern_category.map( ( catId ) =>
|
|
2309
|
+
categories && categories.get( catId )
|
|
2310
|
+
? categories.get( catId ).slug
|
|
2311
|
+
: catId
|
|
2312
|
+
),
|
|
2313
|
+
content: userPattern.content.raw,
|
|
2314
|
+
syncStatus: userPattern.wp_pattern_sync_status,
|
|
2315
|
+
};
|
|
2316
|
+
} );
|
|
2310
2317
|
}
|
|
2311
2318
|
|
|
2319
|
+
export const __experimentalUserPatternCategories = createSelector(
|
|
2320
|
+
( state ) => {
|
|
2321
|
+
return state?.settings?.__experimentalUserPatternCategories;
|
|
2322
|
+
},
|
|
2323
|
+
( state ) => [ state.settings.__experimentalUserPatternCategories ]
|
|
2324
|
+
);
|
|
2325
|
+
|
|
2312
2326
|
export const __experimentalGetParsedPattern = createSelector(
|
|
2313
2327
|
( state, patternName ) => {
|
|
2314
2328
|
const patterns = state.settings.__experimentalBlockPatterns;
|
|
2315
|
-
const
|
|
2329
|
+
const userPatterns = getUserPatterns( state );
|
|
2316
2330
|
|
|
2317
|
-
const pattern = [ ...patterns, ...
|
|
2331
|
+
const pattern = [ ...patterns, ...userPatterns ].find(
|
|
2318
2332
|
( { name } ) => name === patternName
|
|
2319
2333
|
);
|
|
2320
2334
|
if ( ! pattern ) {
|
|
@@ -2330,17 +2344,18 @@ export const __experimentalGetParsedPattern = createSelector(
|
|
|
2330
2344
|
( state ) => [
|
|
2331
2345
|
state.settings.__experimentalBlockPatterns,
|
|
2332
2346
|
state.settings.__experimentalReusableBlocks,
|
|
2347
|
+
state?.settings?.__experimentalUserPatternCategories,
|
|
2333
2348
|
]
|
|
2334
2349
|
);
|
|
2335
2350
|
|
|
2336
2351
|
const getAllAllowedPatterns = createSelector(
|
|
2337
2352
|
( state ) => {
|
|
2338
2353
|
const patterns = state.settings.__experimentalBlockPatterns;
|
|
2339
|
-
const
|
|
2354
|
+
const userPatterns = getUserPatterns( state );
|
|
2340
2355
|
|
|
2341
2356
|
const { allowedBlockTypes } = getSettings( state );
|
|
2342
2357
|
|
|
2343
|
-
const parsedPatterns = [ ...
|
|
2358
|
+
const parsedPatterns = [ ...userPatterns, ...patterns ]
|
|
2344
2359
|
.filter( ( { inserter = true } ) => !! inserter )
|
|
2345
2360
|
.map( ( { name } ) =>
|
|
2346
2361
|
__experimentalGetParsedPattern( state, name )
|
|
@@ -2354,6 +2369,7 @@ const getAllAllowedPatterns = createSelector(
|
|
|
2354
2369
|
state.settings.__experimentalBlockPatterns,
|
|
2355
2370
|
state.settings.__experimentalReusableBlocks,
|
|
2356
2371
|
state.settings.allowedBlockTypes,
|
|
2372
|
+
state?.settings?.__experimentalUserPatternCategories,
|
|
2357
2373
|
]
|
|
2358
2374
|
);
|
|
2359
2375
|
|
|
@@ -2941,3 +2957,68 @@ export const getBlockEditingMode = createRegistrySelector(
|
|
|
2941
2957
|
return parentMode === 'contentOnly' ? 'default' : parentMode;
|
|
2942
2958
|
}
|
|
2943
2959
|
);
|
|
2960
|
+
|
|
2961
|
+
/**
|
|
2962
|
+
* Indicates if a block is ungroupable.
|
|
2963
|
+
* A block is ungroupable if it is a single grouping block with inner blocks.
|
|
2964
|
+
* If a block has an `ungroup` transform, it is also ungroupable, without the
|
|
2965
|
+
* requirement of being the default grouping block.
|
|
2966
|
+
* Additionally a block can only be ungrouped if it has inner blocks and can
|
|
2967
|
+
* be removed.
|
|
2968
|
+
*
|
|
2969
|
+
* @param {Object} state Global application state.
|
|
2970
|
+
* @param {string} clientId Client Id of the block. If not passed the selected block's client id will be used.
|
|
2971
|
+
* @return {boolean} True if the block is ungroupable.
|
|
2972
|
+
*/
|
|
2973
|
+
export const isUngroupable = createRegistrySelector(
|
|
2974
|
+
( select ) =>
|
|
2975
|
+
( state, clientId = '' ) => {
|
|
2976
|
+
const _clientId = clientId || getSelectedBlockClientId( state );
|
|
2977
|
+
if ( ! _clientId ) {
|
|
2978
|
+
return false;
|
|
2979
|
+
}
|
|
2980
|
+
const { getGroupingBlockName } = select( blocksStore );
|
|
2981
|
+
const block = getBlock( state, _clientId );
|
|
2982
|
+
const groupingBlockName = getGroupingBlockName();
|
|
2983
|
+
const _isUngroupable =
|
|
2984
|
+
block &&
|
|
2985
|
+
( block.name === groupingBlockName ||
|
|
2986
|
+
getBlockType( block.name )?.transforms?.ungroup ) &&
|
|
2987
|
+
!! block.innerBlocks.length;
|
|
2988
|
+
|
|
2989
|
+
return _isUngroupable && canRemoveBlock( state, _clientId );
|
|
2990
|
+
}
|
|
2991
|
+
);
|
|
2992
|
+
|
|
2993
|
+
/**
|
|
2994
|
+
* Indicates if the provided blocks(by client ids) are groupable.
|
|
2995
|
+
* We need to have at least one block, have a grouping block name set and
|
|
2996
|
+
* be able to remove these blocks.
|
|
2997
|
+
*
|
|
2998
|
+
* @param {Object} state Global application state.
|
|
2999
|
+
* @param {string[]} clientIds Block client ids. If not passed the selected blocks client ids will be used.
|
|
3000
|
+
* @return {boolean} True if the blocks are groupable.
|
|
3001
|
+
*/
|
|
3002
|
+
export const isGroupable = createRegistrySelector(
|
|
3003
|
+
( select ) =>
|
|
3004
|
+
( state, clientIds = EMPTY_ARRAY ) => {
|
|
3005
|
+
const { getGroupingBlockName } = select( blocksStore );
|
|
3006
|
+
const groupingBlockName = getGroupingBlockName();
|
|
3007
|
+
const _clientIds = clientIds?.length
|
|
3008
|
+
? clientIds
|
|
3009
|
+
: getSelectedBlockClientIds( state );
|
|
3010
|
+
const rootClientId = _clientIds?.length
|
|
3011
|
+
? getBlockRootClientId( state, _clientIds[ 0 ] )
|
|
3012
|
+
: undefined;
|
|
3013
|
+
const groupingBlockAvailable = canInsertBlockType(
|
|
3014
|
+
state,
|
|
3015
|
+
groupingBlockName,
|
|
3016
|
+
rootClientId
|
|
3017
|
+
);
|
|
3018
|
+
const _isGroupable = groupingBlockAvailable && _clientIds.length;
|
|
3019
|
+
return (
|
|
3020
|
+
_isGroupable &&
|
|
3021
|
+
canRemoveBlocks( state, _clientIds, rootClientId )
|
|
3022
|
+
);
|
|
3023
|
+
}
|
|
3024
|
+
);
|
|
@@ -219,8 +219,9 @@ describe( 'actions', () => {
|
|
|
219
219
|
};
|
|
220
220
|
const dispatch = jest.fn();
|
|
221
221
|
dispatch.ensureDefaultBlock = jest.fn();
|
|
222
|
+
const registry = createRegistry();
|
|
222
223
|
|
|
223
|
-
replaceBlock( 'chicken', block )( { select, dispatch } );
|
|
224
|
+
replaceBlock( 'chicken', block )( { select, dispatch, registry } );
|
|
224
225
|
|
|
225
226
|
expect( dispatch ).toHaveBeenCalledWith( {
|
|
226
227
|
type: 'REPLACE_BLOCKS',
|
|
@@ -285,8 +286,12 @@ describe( 'actions', () => {
|
|
|
285
286
|
};
|
|
286
287
|
const dispatch = jest.fn();
|
|
287
288
|
dispatch.ensureDefaultBlock = jest.fn();
|
|
289
|
+
const registry = createRegistry();
|
|
288
290
|
|
|
289
|
-
replaceBlocks(
|
|
291
|
+
replaceBlocks(
|
|
292
|
+
[ 'chicken' ],
|
|
293
|
+
blocks
|
|
294
|
+
)( { select, dispatch, registry } );
|
|
290
295
|
|
|
291
296
|
expect( dispatch ).toHaveBeenCalledWith( {
|
|
292
297
|
type: 'REPLACE_BLOCKS',
|
|
@@ -319,6 +324,7 @@ describe( 'actions', () => {
|
|
|
319
324
|
};
|
|
320
325
|
const dispatch = jest.fn();
|
|
321
326
|
dispatch.ensureDefaultBlock = jest.fn();
|
|
327
|
+
const registry = createRegistry();
|
|
322
328
|
|
|
323
329
|
replaceBlocks(
|
|
324
330
|
[ 'chicken' ],
|
|
@@ -326,7 +332,7 @@ describe( 'actions', () => {
|
|
|
326
332
|
null,
|
|
327
333
|
null,
|
|
328
334
|
meta
|
|
329
|
-
)( { select, dispatch } );
|
|
335
|
+
)( { select, dispatch, registry } );
|
|
330
336
|
|
|
331
337
|
expect( dispatch ).toHaveBeenCalledWith( {
|
|
332
338
|
type: 'REPLACE_BLOCKS',
|
|
@@ -628,8 +634,9 @@ describe( 'actions', () => {
|
|
|
628
634
|
const dispatch = Object.assign( jest.fn(), {
|
|
629
635
|
selectPreviousBlock: jest.fn(),
|
|
630
636
|
} );
|
|
637
|
+
const registry = createRegistry();
|
|
631
638
|
|
|
632
|
-
removeBlocks( clientIds )( { select, dispatch } );
|
|
639
|
+
removeBlocks( clientIds )( { select, dispatch, registry } );
|
|
633
640
|
|
|
634
641
|
expect( dispatch.selectPreviousBlock ).toHaveBeenCalledWith(
|
|
635
642
|
clientId,
|
|
@@ -739,8 +746,8 @@ describe( 'actions', () => {
|
|
|
739
746
|
const dispatch = Object.assign( jest.fn(), {
|
|
740
747
|
selectPreviousBlock: jest.fn(),
|
|
741
748
|
} );
|
|
742
|
-
|
|
743
|
-
removeBlock( clientId )( { select, dispatch } );
|
|
749
|
+
const registry = createRegistry();
|
|
750
|
+
removeBlock( clientId )( { select, dispatch, registry } );
|
|
744
751
|
|
|
745
752
|
expect( dispatch.selectPreviousBlock ).toHaveBeenCalledWith(
|
|
746
753
|
clientId,
|
|
@@ -753,7 +760,7 @@ describe( 'actions', () => {
|
|
|
753
760
|
} );
|
|
754
761
|
} );
|
|
755
762
|
|
|
756
|
-
it( 'should dispatch REMOVE_BLOCKS action, opting out of select previous', () => {
|
|
763
|
+
it( 'should dispatch REMOVE_BLOCKS action, opting out of select previous', async () => {
|
|
757
764
|
const clientId = 'myclientid';
|
|
758
765
|
|
|
759
766
|
const select = {
|
|
@@ -765,7 +772,11 @@ describe( 'actions', () => {
|
|
|
765
772
|
selectPreviousBlock: jest.fn(),
|
|
766
773
|
} );
|
|
767
774
|
|
|
768
|
-
|
|
775
|
+
const registry = createRegistry();
|
|
776
|
+
removeBlocks(
|
|
777
|
+
[ clientId ],
|
|
778
|
+
false
|
|
779
|
+
)( { select, dispatch, registry } );
|
|
769
780
|
|
|
770
781
|
expect( dispatch.selectPreviousBlock ).not.toHaveBeenCalled();
|
|
771
782
|
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
hideBlockInterface,
|
|
6
6
|
showBlockInterface,
|
|
7
7
|
__experimentalUpdateSettings,
|
|
8
|
+
setOpenedBlockSettingsMenu,
|
|
8
9
|
} from '../private-actions';
|
|
9
10
|
|
|
10
11
|
describe( 'private actions', () => {
|
|
@@ -78,4 +79,20 @@ describe( 'private actions', () => {
|
|
|
78
79
|
} );
|
|
79
80
|
} );
|
|
80
81
|
} );
|
|
82
|
+
|
|
83
|
+
describe( 'setOpenedBlockSettingsMenu', () => {
|
|
84
|
+
it( 'should return the SET_OPENED_BLOCK_SETTINGS_MENU action', () => {
|
|
85
|
+
expect( setOpenedBlockSettingsMenu() ).toEqual( {
|
|
86
|
+
clientId: undefined,
|
|
87
|
+
type: 'SET_OPENED_BLOCK_SETTINGS_MENU',
|
|
88
|
+
} );
|
|
89
|
+
} );
|
|
90
|
+
|
|
91
|
+
it( 'should return the SET_OPENED_BLOCK_SETTINGS_MENU action with client id if provided', () => {
|
|
92
|
+
expect( setOpenedBlockSettingsMenu( 'abcd' ) ).toEqual( {
|
|
93
|
+
clientId: 'abcd',
|
|
94
|
+
type: 'SET_OPENED_BLOCK_SETTINGS_MENU',
|
|
95
|
+
} );
|
|
96
|
+
} );
|
|
97
|
+
} );
|
|
81
98
|
} );
|
|
@@ -33,6 +33,7 @@ import {
|
|
|
33
33
|
lastBlockAttributesChange,
|
|
34
34
|
lastBlockInserted,
|
|
35
35
|
blockEditingModes,
|
|
36
|
+
openedBlockSettingsMenu,
|
|
36
37
|
} from '../reducer';
|
|
37
38
|
|
|
38
39
|
const noop = () => {};
|
|
@@ -3415,4 +3416,28 @@ describe( 'state', () => {
|
|
|
3415
3416
|
);
|
|
3416
3417
|
} );
|
|
3417
3418
|
} );
|
|
3419
|
+
|
|
3420
|
+
describe( 'openedBlockSettingsMenu', () => {
|
|
3421
|
+
it( 'should return null by default', () => {
|
|
3422
|
+
expect( openedBlockSettingsMenu( undefined, {} ) ).toBe( null );
|
|
3423
|
+
} );
|
|
3424
|
+
|
|
3425
|
+
it( 'should set client id for opened block settings menu', () => {
|
|
3426
|
+
const state = openedBlockSettingsMenu( null, {
|
|
3427
|
+
type: 'SET_OPENED_BLOCK_SETTINGS_MENU',
|
|
3428
|
+
clientId: '14501cc2-90a6-4f52-aa36-ab6e896135d1',
|
|
3429
|
+
} );
|
|
3430
|
+
expect( state ).toBe( '14501cc2-90a6-4f52-aa36-ab6e896135d1' );
|
|
3431
|
+
} );
|
|
3432
|
+
|
|
3433
|
+
it( 'should clear the state when no client id is passed', () => {
|
|
3434
|
+
const state = openedBlockSettingsMenu(
|
|
3435
|
+
'14501cc2-90a6-4f52-aa36-ab6e896135d1',
|
|
3436
|
+
{
|
|
3437
|
+
type: 'SET_OPENED_BLOCK_SETTINGS_MENU',
|
|
3438
|
+
}
|
|
3439
|
+
);
|
|
3440
|
+
expect( state ).toBe( null );
|
|
3441
|
+
} );
|
|
3442
|
+
} );
|
|
3418
3443
|
} );
|