@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
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { forwardRef } from '@wordpress/element';
|
|
5
|
+
import deprecated from '@wordpress/deprecated';
|
|
6
|
+
import { useDispatch } from '@wordpress/data';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Internal dependencies
|
|
10
|
+
*/
|
|
11
|
+
import { RichTextWrapper } from './';
|
|
12
|
+
import { store as blockEditorStore } from '../../store';
|
|
13
|
+
import { useBlockEditContext } from '../block-edit';
|
|
14
|
+
import { getMultilineTag } from './utils';
|
|
15
|
+
|
|
16
|
+
function RichTextMultiline(
|
|
17
|
+
{
|
|
18
|
+
children,
|
|
19
|
+
identifier,
|
|
20
|
+
tagName: TagName = 'div',
|
|
21
|
+
value = '',
|
|
22
|
+
onChange,
|
|
23
|
+
multiline,
|
|
24
|
+
...props
|
|
25
|
+
},
|
|
26
|
+
forwardedRef
|
|
27
|
+
) {
|
|
28
|
+
deprecated( 'wp.blockEditor.RichText multiline prop', {
|
|
29
|
+
since: '6.1',
|
|
30
|
+
version: '6.3',
|
|
31
|
+
alternative: 'nested blocks (InnerBlocks)',
|
|
32
|
+
link: 'https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/nested-blocks-inner-blocks/',
|
|
33
|
+
} );
|
|
34
|
+
|
|
35
|
+
const { clientId } = useBlockEditContext();
|
|
36
|
+
const { selectionChange } = useDispatch( blockEditorStore );
|
|
37
|
+
|
|
38
|
+
const multilineTagName = getMultilineTag( multiline );
|
|
39
|
+
value = value || `<${ multilineTagName }></${ multilineTagName }>`;
|
|
40
|
+
const padded = `</${ multilineTagName }>${ value }<${ multilineTagName }>`;
|
|
41
|
+
const values = padded.split(
|
|
42
|
+
`</${ multilineTagName }><${ multilineTagName }>`
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
values.shift();
|
|
46
|
+
values.pop();
|
|
47
|
+
|
|
48
|
+
function _onChange( newValues ) {
|
|
49
|
+
onChange(
|
|
50
|
+
`<${ multilineTagName }>${ newValues.join(
|
|
51
|
+
`</${ multilineTagName }><${ multilineTagName }>`
|
|
52
|
+
) }</${ multilineTagName }>`
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return (
|
|
57
|
+
<TagName ref={ forwardedRef }>
|
|
58
|
+
{ values.map( ( _value, index ) => {
|
|
59
|
+
return (
|
|
60
|
+
<RichTextWrapper
|
|
61
|
+
key={ index }
|
|
62
|
+
identifier={ `${ identifier }-${ index }` }
|
|
63
|
+
tagName={ multilineTagName }
|
|
64
|
+
value={ _value }
|
|
65
|
+
onChange={ ( newValue ) => {
|
|
66
|
+
const newValues = values.slice();
|
|
67
|
+
newValues[ index ] = newValue;
|
|
68
|
+
_onChange( newValues );
|
|
69
|
+
} }
|
|
70
|
+
isSelected={ undefined }
|
|
71
|
+
onSplit={ ( v ) => v }
|
|
72
|
+
onReplace={ ( array ) => {
|
|
73
|
+
const newValues = values.slice();
|
|
74
|
+
newValues.splice( index, 1, ...array );
|
|
75
|
+
_onChange( newValues );
|
|
76
|
+
selectionChange(
|
|
77
|
+
clientId,
|
|
78
|
+
`${ identifier }-${ index + 1 }`,
|
|
79
|
+
0,
|
|
80
|
+
0
|
|
81
|
+
);
|
|
82
|
+
} }
|
|
83
|
+
onMerge={ ( forward ) => {
|
|
84
|
+
const newValues = values.slice();
|
|
85
|
+
let offset = 0;
|
|
86
|
+
if ( forward ) {
|
|
87
|
+
if ( ! newValues[ index + 1 ] ) return;
|
|
88
|
+
newValues.splice(
|
|
89
|
+
index,
|
|
90
|
+
2,
|
|
91
|
+
newValues[ index ] + newValues[ index + 1 ]
|
|
92
|
+
);
|
|
93
|
+
offset = newValues[ index ].length - 1;
|
|
94
|
+
} else {
|
|
95
|
+
if ( ! newValues[ index - 1 ] ) return;
|
|
96
|
+
newValues.splice(
|
|
97
|
+
index - 1,
|
|
98
|
+
2,
|
|
99
|
+
newValues[ index - 1 ] + newValues[ index ]
|
|
100
|
+
);
|
|
101
|
+
offset = newValues[ index - 1 ].length - 1;
|
|
102
|
+
}
|
|
103
|
+
_onChange( newValues );
|
|
104
|
+
selectionChange(
|
|
105
|
+
clientId,
|
|
106
|
+
`${ identifier }-${
|
|
107
|
+
index - ( forward ? 0 : 1 )
|
|
108
|
+
}`,
|
|
109
|
+
offset,
|
|
110
|
+
offset
|
|
111
|
+
);
|
|
112
|
+
} }
|
|
113
|
+
{ ...props }
|
|
114
|
+
/>
|
|
115
|
+
);
|
|
116
|
+
} ) }
|
|
117
|
+
</TagName>
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export default forwardRef( RichTextMultiline );
|
|
@@ -8,14 +8,7 @@ import { isEmpty, split, toHTMLString } from '@wordpress/rich-text';
|
|
|
8
8
|
* as a result of splitting the block by pressing enter, or with blocks as a
|
|
9
9
|
* result of splitting the block by pasting block content in the instance.
|
|
10
10
|
*/
|
|
11
|
-
export function splitValue( {
|
|
12
|
-
value,
|
|
13
|
-
pastedBlocks = [],
|
|
14
|
-
onReplace,
|
|
15
|
-
onSplit,
|
|
16
|
-
onSplitMiddle,
|
|
17
|
-
multilineTag,
|
|
18
|
-
} ) {
|
|
11
|
+
export function splitValue( { value, pastedBlocks = [], onReplace, onSplit } ) {
|
|
19
12
|
if ( ! onReplace || ! onSplit ) {
|
|
20
13
|
return;
|
|
21
14
|
}
|
|
@@ -35,17 +28,11 @@ export function splitValue( {
|
|
|
35
28
|
|
|
36
29
|
// Create a block with the content before the caret if there's no pasted
|
|
37
30
|
// blocks, or if there are pasted blocks and the value is not empty. We do
|
|
38
|
-
// not want a leading empty block on paste, but we do if split with e.g.
|
|
39
|
-
// enter key.
|
|
31
|
+
// not want a leading empty block on paste, but we do if we split with e.g.
|
|
32
|
+
// the enter key.
|
|
40
33
|
if ( ! hasPastedBlocks || ! isEmpty( before ) ) {
|
|
41
34
|
blocks.push(
|
|
42
|
-
onSplit(
|
|
43
|
-
toHTMLString( {
|
|
44
|
-
value: before,
|
|
45
|
-
multilineTag,
|
|
46
|
-
} ),
|
|
47
|
-
! isAfterOriginal
|
|
48
|
-
)
|
|
35
|
+
onSplit( toHTMLString( { value: before } ), ! isAfterOriginal )
|
|
49
36
|
);
|
|
50
37
|
lastPastedBlockIndex += 1;
|
|
51
38
|
}
|
|
@@ -53,27 +40,15 @@ export function splitValue( {
|
|
|
53
40
|
if ( hasPastedBlocks ) {
|
|
54
41
|
blocks.push( ...pastedBlocks );
|
|
55
42
|
lastPastedBlockIndex += pastedBlocks.length;
|
|
56
|
-
} else if ( onSplitMiddle ) {
|
|
57
|
-
blocks.push( onSplitMiddle() );
|
|
58
43
|
}
|
|
59
44
|
|
|
60
|
-
//
|
|
61
|
-
//
|
|
62
|
-
//
|
|
63
|
-
//
|
|
64
|
-
if (
|
|
65
|
-
hasPastedBlocks
|
|
66
|
-
? ! isEmpty( after )
|
|
67
|
-
: ! onSplitMiddle || ! isEmpty( after )
|
|
68
|
-
) {
|
|
45
|
+
// Create a block with the content after the caret if there's no pasted
|
|
46
|
+
// blocks, or if there are pasted blocks and the value is not empty. We do
|
|
47
|
+
// not want a trailing empty block on paste, but we do if we split with e.g.
|
|
48
|
+
// the enter key.
|
|
49
|
+
if ( ! hasPastedBlocks || ! isEmpty( after ) ) {
|
|
69
50
|
blocks.push(
|
|
70
|
-
onSplit(
|
|
71
|
-
toHTMLString( {
|
|
72
|
-
value: after,
|
|
73
|
-
multilineTag,
|
|
74
|
-
} ),
|
|
75
|
-
isAfterOriginal
|
|
76
|
-
)
|
|
51
|
+
onSplit( toHTMLString( { value: after } ), isAfterOriginal )
|
|
77
52
|
);
|
|
78
53
|
}
|
|
79
54
|
|
|
@@ -4,13 +4,9 @@
|
|
|
4
4
|
import { useRef } from '@wordpress/element';
|
|
5
5
|
import { useRefEffect } from '@wordpress/compose';
|
|
6
6
|
import { ENTER } from '@wordpress/keycodes';
|
|
7
|
-
import {
|
|
8
|
-
insert,
|
|
9
|
-
__unstableIsEmptyLine as isEmptyLine,
|
|
10
|
-
__unstableInsertLineSeparator as insertLineSeparator,
|
|
11
|
-
} from '@wordpress/rich-text';
|
|
7
|
+
import { insert, remove } from '@wordpress/rich-text';
|
|
12
8
|
import { getBlockTransforms, findTransform } from '@wordpress/blocks';
|
|
13
|
-
import { useDispatch } from '@wordpress/data';
|
|
9
|
+
import { useDispatch, useRegistry } from '@wordpress/data';
|
|
14
10
|
|
|
15
11
|
/**
|
|
16
12
|
* Internal dependencies
|
|
@@ -19,6 +15,7 @@ import { store as blockEditorStore } from '../../store';
|
|
|
19
15
|
import { splitValue } from './split-value';
|
|
20
16
|
|
|
21
17
|
export function useEnter( props ) {
|
|
18
|
+
const registry = useRegistry();
|
|
22
19
|
const { __unstableMarkAutomaticChange } = useDispatch( blockEditorStore );
|
|
23
20
|
const propsRef = useRef( props );
|
|
24
21
|
propsRef.current = props;
|
|
@@ -37,11 +34,10 @@ export function useEnter( props ) {
|
|
|
37
34
|
value,
|
|
38
35
|
onReplace,
|
|
39
36
|
onSplit,
|
|
40
|
-
onSplitMiddle,
|
|
41
|
-
multilineTag,
|
|
42
37
|
onChange,
|
|
43
38
|
disableLineBreaks,
|
|
44
39
|
onSplitAtEnd,
|
|
40
|
+
onSplitAtDoubleLineEnd,
|
|
45
41
|
} = propsRef.current;
|
|
46
42
|
|
|
47
43
|
event.preventDefault();
|
|
@@ -68,42 +64,36 @@ export function useEnter( props ) {
|
|
|
68
64
|
}
|
|
69
65
|
}
|
|
70
66
|
|
|
71
|
-
|
|
72
|
-
if ( event.shiftKey ) {
|
|
73
|
-
if ( ! disableLineBreaks ) {
|
|
74
|
-
onChange( insert( _value, '\n' ) );
|
|
75
|
-
}
|
|
76
|
-
} else if ( canSplit && isEmptyLine( _value ) ) {
|
|
77
|
-
splitValue( {
|
|
78
|
-
value: _value,
|
|
79
|
-
onReplace,
|
|
80
|
-
onSplit,
|
|
81
|
-
onSplitMiddle,
|
|
82
|
-
multilineTag,
|
|
83
|
-
} );
|
|
84
|
-
} else {
|
|
85
|
-
onChange( insertLineSeparator( _value ) );
|
|
86
|
-
}
|
|
87
|
-
} else {
|
|
88
|
-
const { text, start, end } = _value;
|
|
89
|
-
const canSplitAtEnd =
|
|
90
|
-
onSplitAtEnd && start === end && end === text.length;
|
|
67
|
+
const { text, start, end } = _value;
|
|
91
68
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
}
|
|
96
|
-
} else if ( ! canSplit && canSplitAtEnd ) {
|
|
97
|
-
onSplitAtEnd();
|
|
98
|
-
} else if ( canSplit ) {
|
|
99
|
-
splitValue( {
|
|
100
|
-
value: _value,
|
|
101
|
-
onReplace,
|
|
102
|
-
onSplit,
|
|
103
|
-
onSplitMiddle,
|
|
104
|
-
multilineTag,
|
|
105
|
-
} );
|
|
69
|
+
if ( event.shiftKey ) {
|
|
70
|
+
if ( ! disableLineBreaks ) {
|
|
71
|
+
onChange( insert( _value, '\n' ) );
|
|
106
72
|
}
|
|
73
|
+
} else if ( canSplit ) {
|
|
74
|
+
splitValue( {
|
|
75
|
+
value: _value,
|
|
76
|
+
onReplace,
|
|
77
|
+
onSplit,
|
|
78
|
+
} );
|
|
79
|
+
} else if ( onSplitAtEnd && start === end && end === text.length ) {
|
|
80
|
+
onSplitAtEnd();
|
|
81
|
+
} else if (
|
|
82
|
+
// For some blocks it's desirable to split at the end of the
|
|
83
|
+
// block when there are two line breaks at the end of the
|
|
84
|
+
// block, so triple Enter exits the block.
|
|
85
|
+
onSplitAtDoubleLineEnd &&
|
|
86
|
+
start === end &&
|
|
87
|
+
end === text.length &&
|
|
88
|
+
text.slice( -2 ) === '\n\n'
|
|
89
|
+
) {
|
|
90
|
+
registry.batch( () => {
|
|
91
|
+
_value.start = _value.end - 2;
|
|
92
|
+
onChange( remove( _value ) );
|
|
93
|
+
onSplitAtDoubleLineEnd();
|
|
94
|
+
} );
|
|
95
|
+
} else if ( ! disableLineBreaks ) {
|
|
96
|
+
onChange( insert( _value, '\n' ) );
|
|
107
97
|
}
|
|
108
98
|
}
|
|
109
99
|
|
|
@@ -9,13 +9,7 @@ import {
|
|
|
9
9
|
findTransform,
|
|
10
10
|
getBlockTransforms,
|
|
11
11
|
} from '@wordpress/blocks';
|
|
12
|
-
import {
|
|
13
|
-
isEmpty,
|
|
14
|
-
insert,
|
|
15
|
-
create,
|
|
16
|
-
replace,
|
|
17
|
-
__UNSTABLE_LINE_SEPARATOR as LINE_SEPARATOR,
|
|
18
|
-
} from '@wordpress/rich-text';
|
|
12
|
+
import { isEmpty, insert, create } from '@wordpress/rich-text';
|
|
19
13
|
import { isURL } from '@wordpress/url';
|
|
20
14
|
|
|
21
15
|
/**
|
|
@@ -27,23 +21,6 @@ import { shouldDismissPastedFiles } from '../../utils/pasting';
|
|
|
27
21
|
|
|
28
22
|
/** @typedef {import('@wordpress/rich-text').RichTextValue} RichTextValue */
|
|
29
23
|
|
|
30
|
-
/**
|
|
31
|
-
* Replaces line separators with line breaks if not multiline.
|
|
32
|
-
* Replaces line breaks with line separators if multiline.
|
|
33
|
-
*
|
|
34
|
-
* @param {RichTextValue} value Value to adjust.
|
|
35
|
-
* @param {boolean} isMultiline Whether to adjust to multiline or not.
|
|
36
|
-
*
|
|
37
|
-
* @return {RichTextValue} Adjusted value.
|
|
38
|
-
*/
|
|
39
|
-
function adjustLines( value, isMultiline ) {
|
|
40
|
-
if ( isMultiline ) {
|
|
41
|
-
return replace( value, /\n+/g, LINE_SEPARATOR );
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
return replace( value, new RegExp( LINE_SEPARATOR, 'g' ), '\n' );
|
|
45
|
-
}
|
|
46
|
-
|
|
47
24
|
export function usePasteHandler( props ) {
|
|
48
25
|
const propsRef = useRef( props );
|
|
49
26
|
propsRef.current = props;
|
|
@@ -58,9 +35,7 @@ export function usePasteHandler( props ) {
|
|
|
58
35
|
tagName,
|
|
59
36
|
onReplace,
|
|
60
37
|
onSplit,
|
|
61
|
-
onSplitMiddle,
|
|
62
38
|
__unstableEmbedURLOnPaste,
|
|
63
|
-
multilineTag,
|
|
64
39
|
preserveWhiteSpace,
|
|
65
40
|
pastePlainText,
|
|
66
41
|
} = propsRef.current;
|
|
@@ -129,6 +104,20 @@ export function usePasteHandler( props ) {
|
|
|
129
104
|
}
|
|
130
105
|
|
|
131
106
|
const files = [ ...getFilesFromDataTransfer( clipboardData ) ];
|
|
107
|
+
const isInternal = clipboardData.getData( 'rich-text' ) === 'true';
|
|
108
|
+
|
|
109
|
+
// If the data comes from a rich text instance, we can directly use it
|
|
110
|
+
// without filtering the data. The filters are only meant for externally
|
|
111
|
+
// pasted content and remove inline styles.
|
|
112
|
+
if ( isInternal ) {
|
|
113
|
+
const pastedValue = create( {
|
|
114
|
+
html,
|
|
115
|
+
preserveWhiteSpace,
|
|
116
|
+
} );
|
|
117
|
+
addActiveFormats( pastedValue, value.activeFormats );
|
|
118
|
+
onChange( insert( value, pastedValue ) );
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
132
121
|
|
|
133
122
|
if ( pastePlainText ) {
|
|
134
123
|
onChange( insert( value, create( { text: plainText } ) ) );
|
|
@@ -179,8 +168,6 @@ export function usePasteHandler( props ) {
|
|
|
179
168
|
pastedBlocks: blocks,
|
|
180
169
|
onReplace,
|
|
181
170
|
onSplit,
|
|
182
|
-
onSplitMiddle,
|
|
183
|
-
multilineTag,
|
|
184
171
|
} );
|
|
185
172
|
}
|
|
186
173
|
|
|
@@ -215,19 +202,10 @@ export function usePasteHandler( props ) {
|
|
|
215
202
|
mode,
|
|
216
203
|
tagName,
|
|
217
204
|
preserveWhiteSpace,
|
|
218
|
-
// If the data comes from a rich text instance, we can directly
|
|
219
|
-
// use it without filtering the data. The filters are only meant
|
|
220
|
-
// for externally pasted content and remove inline styles.
|
|
221
|
-
disableFilters: !! clipboardData.getData( 'rich-text' ),
|
|
222
205
|
} );
|
|
223
206
|
|
|
224
207
|
if ( typeof content === 'string' ) {
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
// If the content should be multiline, we should process text
|
|
228
|
-
// separated by a line break as separate lines.
|
|
229
|
-
valueToInsert = adjustLines( valueToInsert, !! multilineTag );
|
|
230
|
-
|
|
208
|
+
const valueToInsert = create( { html: content } );
|
|
231
209
|
addActiveFormats( valueToInsert, value.activeFormats );
|
|
232
210
|
onChange( insert( value, valueToInsert ) );
|
|
233
211
|
} else if ( content.length > 0 ) {
|
|
@@ -239,8 +217,6 @@ export function usePasteHandler( props ) {
|
|
|
239
217
|
pastedBlocks: content,
|
|
240
218
|
onReplace,
|
|
241
219
|
onSplit,
|
|
242
|
-
onSplitMiddle,
|
|
243
|
-
multilineTag,
|
|
244
220
|
} );
|
|
245
221
|
}
|
|
246
222
|
}
|
|
@@ -39,15 +39,9 @@
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
.spacing-sizes-control__wrapper {
|
|
43
|
-
& + & {
|
|
44
|
-
margin-top: $grid-unit-10;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
42
|
.spacing-sizes-control__header {
|
|
49
43
|
height: $grid-unit-20;
|
|
50
|
-
margin-bottom: $grid-unit-
|
|
44
|
+
margin-bottom: $grid-unit-15;
|
|
51
45
|
}
|
|
52
46
|
|
|
53
47
|
.spacing-sizes-control__dropdown {
|
|
@@ -63,3 +57,7 @@
|
|
|
63
57
|
.spacing-sizes-control__custom-toggle {
|
|
64
58
|
flex: 0 0 auto;
|
|
65
59
|
}
|
|
60
|
+
|
|
61
|
+
.spacing-sizes-control__icon {
|
|
62
|
+
margin-left: $grid-unit-05 * -1; // Aligns the icon to the control header.
|
|
63
|
+
}
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
5
|
import {
|
|
6
6
|
sidesAll,
|
|
7
|
-
sidesAxial,
|
|
8
7
|
sidesBottom,
|
|
9
8
|
sidesHorizontal,
|
|
10
9
|
sidesLeft,
|
|
@@ -24,7 +23,7 @@ export const DEFAULT_VALUES = {
|
|
|
24
23
|
|
|
25
24
|
export const ICONS = {
|
|
26
25
|
custom: sidesAll,
|
|
27
|
-
axial:
|
|
26
|
+
axial: sidesAll,
|
|
28
27
|
horizontal: sidesHorizontal,
|
|
29
28
|
vertical: sidesVertical,
|
|
30
29
|
top: sidesTop,
|
|
@@ -12,8 +12,8 @@ import { useSelect, useDispatch } from '@wordpress/data';
|
|
|
12
12
|
import { useCommandLoader } from '@wordpress/commands';
|
|
13
13
|
import {
|
|
14
14
|
copy,
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
trash as remove,
|
|
16
|
+
plus as add,
|
|
17
17
|
group,
|
|
18
18
|
ungroup,
|
|
19
19
|
moveTo as move,
|
|
@@ -112,12 +112,18 @@ export const useTransformCommands = () => {
|
|
|
112
112
|
};
|
|
113
113
|
|
|
114
114
|
const useActionsCommands = () => {
|
|
115
|
-
const { clientIds } = useSelect( ( select ) => {
|
|
116
|
-
const {
|
|
115
|
+
const { clientIds, isUngroupable, isGroupable } = useSelect( ( select ) => {
|
|
116
|
+
const {
|
|
117
|
+
getSelectedBlockClientIds,
|
|
118
|
+
isUngroupable: _isUngroupable,
|
|
119
|
+
isGroupable: _isGroupable,
|
|
120
|
+
} = select( blockEditorStore );
|
|
117
121
|
const selectedBlockClientIds = getSelectedBlockClientIds();
|
|
118
122
|
|
|
119
123
|
return {
|
|
120
124
|
clientIds: selectedBlockClientIds,
|
|
125
|
+
isUngroupable: _isUngroupable(),
|
|
126
|
+
isGroupable: _isGroupable(),
|
|
121
127
|
};
|
|
122
128
|
}, [] );
|
|
123
129
|
const {
|
|
@@ -194,20 +200,7 @@ const useActionsCommands = () => {
|
|
|
194
200
|
canMoveBlocks( clientIds, rootClientId ) &&
|
|
195
201
|
getBlockCount( rootClientId ) !== 1;
|
|
196
202
|
|
|
197
|
-
const commands = [
|
|
198
|
-
{
|
|
199
|
-
name: 'ungroup',
|
|
200
|
-
label: __( 'Ungroup' ),
|
|
201
|
-
callback: onUngroup,
|
|
202
|
-
icon: ungroup,
|
|
203
|
-
},
|
|
204
|
-
{
|
|
205
|
-
name: 'Group',
|
|
206
|
-
label: __( 'Group' ),
|
|
207
|
-
callback: onGroup,
|
|
208
|
-
icon: group,
|
|
209
|
-
},
|
|
210
|
-
];
|
|
203
|
+
const commands = [];
|
|
211
204
|
if ( canInsertDefaultBlock ) {
|
|
212
205
|
commands.push(
|
|
213
206
|
{
|
|
@@ -237,7 +230,7 @@ const useActionsCommands = () => {
|
|
|
237
230
|
if ( canRemove ) {
|
|
238
231
|
commands.push( {
|
|
239
232
|
name: 'remove',
|
|
240
|
-
label: __( '
|
|
233
|
+
label: __( 'Delete' ),
|
|
241
234
|
callback: () => removeBlocks( clientIds, true ),
|
|
242
235
|
icon: remove,
|
|
243
236
|
} );
|
|
@@ -262,7 +255,22 @@ const useActionsCommands = () => {
|
|
|
262
255
|
icon: move,
|
|
263
256
|
} );
|
|
264
257
|
}
|
|
265
|
-
|
|
258
|
+
if ( isUngroupable ) {
|
|
259
|
+
commands.push( {
|
|
260
|
+
name: 'ungroup',
|
|
261
|
+
label: __( 'Ungroup' ),
|
|
262
|
+
callback: onUngroup,
|
|
263
|
+
icon: ungroup,
|
|
264
|
+
} );
|
|
265
|
+
}
|
|
266
|
+
if ( isGroupable ) {
|
|
267
|
+
commands.push( {
|
|
268
|
+
name: 'Group',
|
|
269
|
+
label: __( 'Group' ),
|
|
270
|
+
callback: onGroup,
|
|
271
|
+
icon: group,
|
|
272
|
+
} );
|
|
273
|
+
}
|
|
266
274
|
return {
|
|
267
275
|
isLoading: false,
|
|
268
276
|
commands: commands.map( ( command ) => ( {
|
|
@@ -26,6 +26,7 @@ import { store as blockEditorStore } from '../../store';
|
|
|
26
26
|
* @property {WPIcon} icon Block type icon.
|
|
27
27
|
* @property {string} description A detailed block type description.
|
|
28
28
|
* @property {string} anchor HTML anchor.
|
|
29
|
+
* @property {name} name A custom, human readable name for the block.
|
|
29
30
|
*/
|
|
30
31
|
|
|
31
32
|
/**
|
|
@@ -94,6 +95,7 @@ export default function useBlockDisplayInformation( clientId ) {
|
|
|
94
95
|
anchor: attributes?.anchor,
|
|
95
96
|
positionLabel,
|
|
96
97
|
positionType: attributes?.style?.position?.type,
|
|
98
|
+
name: attributes?.metadata?.name,
|
|
97
99
|
};
|
|
98
100
|
if ( ! match ) return blockTypeInfo;
|
|
99
101
|
|
|
@@ -105,6 +107,7 @@ export default function useBlockDisplayInformation( clientId ) {
|
|
|
105
107
|
anchor: attributes?.anchor,
|
|
106
108
|
positionLabel,
|
|
107
109
|
positionType: attributes?.style?.position?.type,
|
|
110
|
+
name: attributes?.metadata?.name,
|
|
108
111
|
};
|
|
109
112
|
},
|
|
110
113
|
[ clientId ]
|