@wordpress/block-editor 12.1.0 → 12.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/build/autocompleters/block.js +13 -5
- package/build/autocompleters/block.js.map +1 -1
- package/build/components/block-breadcrumb/index.js +6 -3
- package/build/components/block-breadcrumb/index.js.map +1 -1
- package/build/components/block-editing-mode/index.js +84 -0
- package/build/components/block-editing-mode/index.js.map +1 -0
- package/build/components/block-list/block-list-block-context.js +15 -0
- package/build/components/block-list/block-list-block-context.js.map +1 -0
- package/build/components/block-list/block.js +29 -37
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/block.native.js +14 -22
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-list/index.native.js +107 -108
- package/build/components/block-list/index.native.js.map +1 -1
- package/build/components/block-list/use-block-props/index.js +2 -2
- package/build/components/block-list/use-block-props/index.js.map +1 -1
- package/build/components/block-list/use-in-between-inserter.js +7 -5
- package/build/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build/components/block-list-appender/index.js +15 -1
- package/build/components/block-list-appender/index.js.map +1 -1
- package/build/components/block-mobile-toolbar/block-actions-menu.native.js +19 -4
- package/build/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
- package/build/components/block-styles/preview-panel.js +1 -2
- package/build/components/block-styles/preview-panel.js.map +1 -1
- package/build/components/block-switcher/block-transformations-menu.js +8 -0
- package/build/components/block-switcher/block-transformations-menu.js.map +1 -1
- package/build/components/block-switcher/block-variation-transformations.js +125 -0
- package/build/components/block-switcher/block-variation-transformations.js.map +1 -0
- package/build/components/block-switcher/index.js +34 -12
- package/build/components/block-switcher/index.js.map +1 -1
- package/build/components/block-switcher/pattern-transformations-menu.js +3 -3
- package/build/components/block-switcher/pattern-transformations-menu.js.map +1 -1
- package/build/components/block-toolbar/index.js +9 -7
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-tools/block-contextual-toolbar.js +5 -3
- package/build/components/block-tools/block-contextual-toolbar.js.map +1 -1
- package/build/components/block-tools/insertion-point.js +11 -5
- package/build/components/block-tools/insertion-point.js.map +1 -1
- package/build/components/convert-to-group-buttons/index.js +7 -2
- package/build/components/convert-to-group-buttons/index.js.map +1 -1
- package/build/components/convert-to-group-buttons/index.native.js +87 -3
- package/build/components/convert-to-group-buttons/index.native.js.map +1 -1
- package/build/components/convert-to-group-buttons/use-convert-to-group-button-props.js +23 -37
- package/build/components/convert-to-group-buttons/use-convert-to-group-button-props.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +3 -2
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/iframe/index.js +14 -7
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/inner-blocks/index.js +2 -1
- package/build/components/inner-blocks/index.js.map +1 -1
- package/build/components/inner-blocks/index.native.js +7 -7
- package/build/components/inner-blocks/index.native.js.map +1 -1
- package/build/components/inner-blocks/use-nested-settings-update.js +13 -5
- package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build/components/inserter/index.js +3 -7
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/inserter/quick-inserter.js +2 -4
- package/build/components/inserter/quick-inserter.js.map +1 -1
- package/build/components/inserter/search-results.js +19 -6
- package/build/components/inserter/search-results.js.map +1 -1
- package/build/components/list-view/appender.js +6 -1
- package/build/components/list-view/appender.js.map +1 -1
- package/build/components/list-view/block-contents.js +4 -2
- package/build/components/list-view/block-contents.js.map +1 -1
- package/build/components/list-view/block.js +21 -25
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/branch.js +1 -3
- package/build/components/list-view/branch.js.map +1 -1
- package/build/components/list-view/index.js +14 -7
- package/build/components/list-view/index.js.map +1 -1
- package/build/components/list-view/use-list-view-client-ids.js +27 -3
- package/build/components/list-view/use-list-view-client-ids.js.map +1 -1
- package/build/components/publish-date-time-picker/index.js +0 -2
- package/build/components/publish-date-time-picker/index.js.map +1 -1
- package/build/components/url-input/index.js +3 -0
- package/build/components/url-input/index.js.map +1 -1
- package/build/components/use-block-drop-zone/index.js +25 -15
- package/build/components/use-block-drop-zone/index.js.map +1 -1
- package/build/components/use-resize-canvas/index.js +8 -1
- package/build/components/use-resize-canvas/index.js.map +1 -1
- package/build/components/writing-flow/use-arrow-nav.js +13 -7
- package/build/components/writing-flow/use-arrow-nav.js.map +1 -1
- package/build/hooks/align.js +3 -7
- package/build/hooks/align.js.map +1 -1
- package/build/hooks/behaviors.js +115 -0
- package/build/hooks/behaviors.js.map +1 -0
- package/build/hooks/dimensions.js +0 -30
- package/build/hooks/dimensions.js.map +1 -1
- package/build/hooks/duotone.js +4 -8
- package/build/hooks/duotone.js.map +1 -1
- package/build/hooks/index.js +2 -0
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/layout.js +8 -9
- package/build/hooks/layout.js.map +1 -1
- package/build/private-apis.js +4 -7
- package/build/private-apis.js.map +1 -1
- package/build/store/private-actions.js +46 -0
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-selectors.js +88 -0
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +36 -1
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +28 -18
- package/build/store/selectors.js.map +1 -1
- package/build/utils/order-inserter-block-items.js +41 -0
- package/build/utils/order-inserter-block-items.js.map +1 -0
- package/build-module/autocompleters/block.js +12 -5
- package/build-module/autocompleters/block.js.map +1 -1
- package/build-module/components/block-breadcrumb/index.js +5 -3
- package/build-module/components/block-breadcrumb/index.js.map +1 -1
- package/build-module/components/block-editing-mode/index.js +72 -0
- package/build-module/components/block-editing-mode/index.js.map +1 -0
- package/build-module/components/block-list/block-list-block-context.js +6 -0
- package/build-module/components/block-list/block-list-block-context.js.map +1 -0
- package/build-module/components/block-list/block.js +26 -34
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/block.native.js +14 -22
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-list/index.native.js +108 -110
- package/build-module/components/block-list/index.native.js.map +1 -1
- package/build-module/components/block-list/use-block-props/index.js +1 -1
- package/build-module/components/block-list/use-block-props/index.js.map +1 -1
- package/build-module/components/block-list/use-in-between-inserter.js +6 -5
- package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build-module/components/block-list-appender/index.js +15 -1
- package/build-module/components/block-list-appender/index.js.map +1 -1
- package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js +18 -4
- package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
- package/build-module/components/block-styles/preview-panel.js +1 -2
- package/build-module/components/block-styles/preview-panel.js.map +1 -1
- package/build-module/components/block-switcher/block-transformations-menu.js +7 -0
- package/build-module/components/block-switcher/block-transformations-menu.js.map +1 -1
- package/build-module/components/block-switcher/block-variation-transformations.js +108 -0
- package/build-module/components/block-switcher/block-variation-transformations.js.map +1 -0
- package/build-module/components/block-switcher/index.js +33 -12
- package/build-module/components/block-switcher/index.js.map +1 -1
- package/build-module/components/block-switcher/pattern-transformations-menu.js +3 -3
- package/build-module/components/block-switcher/pattern-transformations-menu.js.map +1 -1
- package/build-module/components/block-toolbar/index.js +8 -7
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-tools/block-contextual-toolbar.js +4 -3
- package/build-module/components/block-tools/block-contextual-toolbar.js.map +1 -1
- package/build-module/components/block-tools/insertion-point.js +11 -5
- package/build-module/components/block-tools/insertion-point.js.map +1 -1
- package/build-module/components/convert-to-group-buttons/index.js +7 -2
- package/build-module/components/convert-to-group-buttons/index.js.map +1 -1
- package/build-module/components/convert-to-group-buttons/index.native.js +76 -1
- package/build-module/components/convert-to-group-buttons/index.native.js.map +1 -1
- package/build-module/components/convert-to-group-buttons/use-convert-to-group-button-props.js +22 -36
- package/build-module/components/convert-to-group-buttons/use-convert-to-group-button-props.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +3 -2
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/iframe/index.js +15 -8
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/inner-blocks/index.js +2 -1
- package/build-module/components/inner-blocks/index.js.map +1 -1
- package/build-module/components/inner-blocks/index.native.js +7 -6
- package/build-module/components/inner-blocks/index.native.js.map +1 -1
- package/build-module/components/inner-blocks/use-nested-settings-update.js +13 -5
- package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build-module/components/inserter/index.js +3 -7
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/inserter/quick-inserter.js +2 -4
- package/build-module/components/inserter/quick-inserter.js.map +1 -1
- package/build-module/components/inserter/search-results.js +16 -6
- package/build-module/components/inserter/search-results.js.map +1 -1
- package/build-module/components/list-view/appender.js +6 -2
- package/build-module/components/list-view/appender.js.map +1 -1
- package/build-module/components/list-view/block-contents.js +4 -2
- package/build-module/components/list-view/block-contents.js.map +1 -1
- package/build-module/components/list-view/block.js +20 -25
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/branch.js +1 -3
- package/build-module/components/list-view/branch.js.map +1 -1
- package/build-module/components/list-view/index.js +15 -8
- package/build-module/components/list-view/index.js.map +1 -1
- package/build-module/components/list-view/use-list-view-client-ids.js +26 -3
- package/build-module/components/list-view/use-list-view-client-ids.js.map +1 -1
- package/build-module/components/publish-date-time-picker/index.js +0 -2
- package/build-module/components/publish-date-time-picker/index.js.map +1 -1
- package/build-module/components/url-input/index.js +3 -0
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/components/use-block-drop-zone/index.js +25 -16
- package/build-module/components/use-block-drop-zone/index.js.map +1 -1
- package/build-module/components/use-resize-canvas/index.js +8 -1
- package/build-module/components/use-resize-canvas/index.js.map +1 -1
- package/build-module/components/writing-flow/use-arrow-nav.js +13 -7
- package/build-module/components/writing-flow/use-arrow-nav.js.map +1 -1
- package/build-module/hooks/align.js +3 -6
- package/build-module/hooks/align.js.map +1 -1
- package/build-module/hooks/behaviors.js +97 -0
- package/build-module/hooks/behaviors.js.map +1 -0
- package/build-module/hooks/dimensions.js +0 -28
- package/build-module/hooks/dimensions.js.map +1 -1
- package/build-module/hooks/duotone.js +3 -6
- package/build-module/hooks/duotone.js.map +1 -1
- package/build-module/hooks/index.js +1 -0
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/layout.js +7 -9
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/private-apis.js +3 -5
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/private-actions.js +42 -0
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-selectors.js +79 -0
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +34 -1
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +26 -17
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/order-inserter-block-items.js +32 -0
- package/build-module/utils/order-inserter-block-items.js.map +1 -0
- package/build-style/content-rtl.css +32 -13
- package/build-style/content.css +32 -13
- package/build-style/default-editor-styles-rtl.css +1 -1
- package/build-style/default-editor-styles.css +1 -1
- package/build-style/style-rtl.css +19 -64
- package/build-style/style.css +20 -64
- package/package.json +32 -31
- package/src/autocompleters/block.js +15 -7
- package/src/components/block-breadcrumb/index.js +11 -3
- package/src/components/block-editing-mode/index.js +71 -0
- package/src/components/block-list/block-list-block-context.js +6 -0
- package/src/components/block-list/block.js +38 -56
- package/src/components/block-list/block.native.js +30 -41
- package/src/components/block-list/content.scss +5 -5
- package/src/components/block-list/index.native.js +164 -153
- package/src/components/block-list/test/index.native.js +2 -2
- package/src/components/block-list/use-block-props/index.js +1 -1
- package/src/components/block-list/use-in-between-inserter.js +7 -3
- package/src/components/block-list-appender/index.js +22 -4
- package/src/components/block-mobile-toolbar/block-actions-menu.native.js +23 -0
- package/src/components/block-mover/style.scss +1 -0
- package/src/components/block-styles/preview-panel.js +1 -3
- package/src/components/block-switcher/block-transformations-menu.js +12 -0
- package/src/components/block-switcher/block-variation-transformations.js +115 -0
- package/src/components/block-switcher/index.js +38 -5
- package/src/components/block-switcher/pattern-transformations-menu.js +5 -5
- package/src/components/block-switcher/style.scss +6 -5
- package/src/components/block-toolbar/index.js +10 -11
- package/src/components/block-tools/block-contextual-toolbar.js +4 -5
- package/src/components/block-tools/insertion-point.js +23 -9
- package/src/components/button-block-appender/content.scss +22 -0
- package/src/components/convert-to-group-buttons/index.js +9 -2
- package/src/components/convert-to-group-buttons/index.native.js +79 -1
- package/src/components/convert-to-group-buttons/use-convert-to-group-button-props.js +32 -38
- package/src/components/global-styles/dimensions-panel.js +3 -2
- package/src/components/global-styles/style.scss +3 -0
- package/src/components/iframe/index.js +22 -12
- package/src/components/inner-blocks/README.md +5 -0
- package/src/components/inner-blocks/index.js +2 -0
- package/src/components/inner-blocks/index.native.js +16 -6
- package/src/components/inner-blocks/use-nested-settings-update.js +20 -3
- package/src/components/inserter/index.js +1 -9
- package/src/components/inserter/quick-inserter.js +0 -2
- package/src/components/inserter/search-results.js +32 -6
- package/src/components/list-view/appender.js +3 -2
- package/src/components/list-view/block-contents.js +8 -2
- package/src/components/list-view/block.js +29 -35
- package/src/components/list-view/branch.js +1 -7
- package/src/components/list-view/index.js +17 -4
- package/src/components/list-view/style.scss +2 -5
- package/src/components/list-view/use-list-view-client-ids.js +21 -4
- package/src/components/publish-date-time-picker/index.js +0 -2
- package/src/components/url-input/README.md +6 -0
- package/src/components/url-input/index.js +1 -0
- package/src/components/use-block-drop-zone/index.js +31 -17
- package/src/components/use-resize-canvas/index.js +9 -1
- package/src/components/writing-flow/test/index.js +15 -0
- package/src/components/writing-flow/use-arrow-nav.js +17 -4
- package/src/hooks/align.js +3 -11
- package/src/hooks/behaviors.js +104 -0
- package/src/hooks/dimensions.js +0 -40
- package/src/hooks/duotone.js +3 -11
- package/src/hooks/index.js +1 -0
- package/src/hooks/layout.js +10 -18
- package/src/private-apis.js +2 -4
- package/src/store/private-actions.js +39 -0
- package/src/store/private-selectors.js +95 -0
- package/src/store/reducer.js +27 -0
- package/src/store/selectors.js +25 -15
- package/src/store/test/private-actions.js +32 -1
- package/src/store/test/private-selectors.js +158 -0
- package/src/store/test/reducer.js +48 -0
- package/src/style.scss +0 -3
- package/src/utils/order-inserter-block-items.js +26 -0
- package/build/components/block-list/block-list-compact.native.js +0 -75
- package/build/components/block-list/block-list-compact.native.js.map +0 -1
- package/build/components/off-canvas-editor/appender.js +0 -125
- package/build/components/off-canvas-editor/appender.js.map +0 -1
- package/build/components/off-canvas-editor/block-contents.js +0 -141
- package/build/components/off-canvas-editor/block-contents.js.map +0 -1
- package/build/components/off-canvas-editor/block-select-button.js +0 -126
- package/build/components/off-canvas-editor/block-select-button.js.map +0 -1
- package/build/components/off-canvas-editor/block.js +0 -297
- package/build/components/off-canvas-editor/block.js.map +0 -1
- package/build/components/off-canvas-editor/branch.js +0 -197
- package/build/components/off-canvas-editor/branch.js.map +0 -1
- package/build/components/off-canvas-editor/context.js +0 -19
- package/build/components/off-canvas-editor/context.js.map +0 -1
- package/build/components/off-canvas-editor/drop-indicator.js +0 -118
- package/build/components/off-canvas-editor/drop-indicator.js.map +0 -1
- package/build/components/off-canvas-editor/expander.js +0 -41
- package/build/components/off-canvas-editor/expander.js.map +0 -1
- package/build/components/off-canvas-editor/index.js +0 -236
- package/build/components/off-canvas-editor/index.js.map +0 -1
- package/build/components/off-canvas-editor/leaf-more-menu.js +0 -148
- package/build/components/off-canvas-editor/leaf-more-menu.js.map +0 -1
- package/build/components/off-canvas-editor/leaf.js +0 -60
- package/build/components/off-canvas-editor/leaf.js.map +0 -1
- package/build/components/off-canvas-editor/link-ui.js +0 -186
- package/build/components/off-canvas-editor/link-ui.js.map +0 -1
- package/build/components/off-canvas-editor/update-attributes.js +0 -108
- package/build/components/off-canvas-editor/update-attributes.js.map +0 -1
- package/build/components/off-canvas-editor/use-block-selection.js +0 -139
- package/build/components/off-canvas-editor/use-block-selection.js.map +0 -1
- package/build/components/off-canvas-editor/use-inserted-block.js +0 -58
- package/build/components/off-canvas-editor/use-inserted-block.js.map +0 -1
- package/build/components/off-canvas-editor/use-list-view-client-ids.js +0 -33
- package/build/components/off-canvas-editor/use-list-view-client-ids.js.map +0 -1
- package/build/components/off-canvas-editor/use-list-view-drop-zone.js +0 -235
- package/build/components/off-canvas-editor/use-list-view-drop-zone.js.map +0 -1
- package/build/components/off-canvas-editor/use-list-view-expand-selected-item.js +0 -60
- package/build/components/off-canvas-editor/use-list-view-expand-selected-item.js.map +0 -1
- package/build/components/off-canvas-editor/utils.js +0 -60
- package/build/components/off-canvas-editor/utils.js.map +0 -1
- package/build-module/components/block-list/block-list-compact.native.js +0 -60
- package/build-module/components/block-list/block-list-compact.native.js.map +0 -1
- package/build-module/components/off-canvas-editor/appender.js +0 -108
- package/build-module/components/off-canvas-editor/appender.js.map +0 -1
- package/build-module/components/off-canvas-editor/block-contents.js +0 -121
- package/build-module/components/off-canvas-editor/block-contents.js.map +0 -1
- package/build-module/components/off-canvas-editor/block-select-button.js +0 -107
- package/build-module/components/off-canvas-editor/block-select-button.js.map +0 -1
- package/build-module/components/off-canvas-editor/block.js +0 -273
- package/build-module/components/off-canvas-editor/block.js.map +0 -1
- package/build-module/components/off-canvas-editor/branch.js +0 -179
- package/build-module/components/off-canvas-editor/branch.js.map +0 -1
- package/build-module/components/off-canvas-editor/context.js +0 -7
- package/build-module/components/off-canvas-editor/context.js.map +0 -1
- package/build-module/components/off-canvas-editor/drop-indicator.js +0 -111
- package/build-module/components/off-canvas-editor/drop-indicator.js.map +0 -1
- package/build-module/components/off-canvas-editor/expander.js +0 -32
- package/build-module/components/off-canvas-editor/expander.js.map +0 -1
- package/build-module/components/off-canvas-editor/index.js +0 -213
- package/build-module/components/off-canvas-editor/index.js.map +0 -1
- package/build-module/components/off-canvas-editor/leaf-more-menu.js +0 -130
- package/build-module/components/off-canvas-editor/leaf-more-menu.js.map +0 -1
- package/build-module/components/off-canvas-editor/leaf.js +0 -45
- package/build-module/components/off-canvas-editor/leaf.js.map +0 -1
- package/build-module/components/off-canvas-editor/link-ui.js +0 -166
- package/build-module/components/off-canvas-editor/link-ui.js.map +0 -1
- package/build-module/components/off-canvas-editor/update-attributes.js +0 -97
- package/build-module/components/off-canvas-editor/update-attributes.js.map +0 -1
- package/build-module/components/off-canvas-editor/use-block-selection.js +0 -124
- package/build-module/components/off-canvas-editor/use-block-selection.js.map +0 -1
- package/build-module/components/off-canvas-editor/use-inserted-block.js +0 -47
- package/build-module/components/off-canvas-editor/use-inserted-block.js.map +0 -1
- package/build-module/components/off-canvas-editor/use-list-view-client-ids.js +0 -24
- package/build-module/components/off-canvas-editor/use-list-view-client-ids.js.map +0 -1
- package/build-module/components/off-canvas-editor/use-list-view-drop-zone.js +0 -220
- package/build-module/components/off-canvas-editor/use-list-view-drop-zone.js.map +0 -1
- package/build-module/components/off-canvas-editor/use-list-view-expand-selected-item.js +0 -50
- package/build-module/components/off-canvas-editor/use-list-view-expand-selected-item.js.map +0 -1
- package/build-module/components/off-canvas-editor/utils.js +0 -44
- package/build-module/components/off-canvas-editor/utils.js.map +0 -1
- package/src/components/block-list/block-list-compact.native.js +0 -63
- package/src/components/off-canvas-editor/README.md +0 -5
- package/src/components/off-canvas-editor/appender.js +0 -124
- package/src/components/off-canvas-editor/block-contents.js +0 -156
- package/src/components/off-canvas-editor/block-select-button.js +0 -128
- package/src/components/off-canvas-editor/block.js +0 -347
- package/src/components/off-canvas-editor/branch.js +0 -238
- package/src/components/off-canvas-editor/context.js +0 -8
- package/src/components/off-canvas-editor/drop-indicator.js +0 -126
- package/src/components/off-canvas-editor/expander.js +0 -26
- package/src/components/off-canvas-editor/index.js +0 -271
- package/src/components/off-canvas-editor/leaf-more-menu.js +0 -158
- package/src/components/off-canvas-editor/leaf.js +0 -52
- package/src/components/off-canvas-editor/link-ui.js +0 -167
- package/src/components/off-canvas-editor/style.scss +0 -34
- package/src/components/off-canvas-editor/test/use-inserted-block.js +0 -108
- package/src/components/off-canvas-editor/test/utils.js +0 -50
- package/src/components/off-canvas-editor/update-attributes.js +0 -99
- package/src/components/off-canvas-editor/use-block-selection.js +0 -169
- package/src/components/off-canvas-editor/use-inserted-block.js +0 -47
- package/src/components/off-canvas-editor/use-list-view-client-ids.js +0 -29
- package/src/components/off-canvas-editor/use-list-view-drop-zone.js +0 -260
- package/src/components/off-canvas-editor/use-list-view-expand-selected-item.js +0 -58
- package/src/components/off-canvas-editor/utils.js +0 -58
|
@@ -11,7 +11,6 @@ import { useSelect, useDispatch } from '@wordpress/data';
|
|
|
11
11
|
import { createBlock } from '@wordpress/blocks';
|
|
12
12
|
import {
|
|
13
13
|
KeyboardAwareFlatList,
|
|
14
|
-
ReadableContentView,
|
|
15
14
|
WIDE_ALIGNMENTS,
|
|
16
15
|
alignmentHelpers,
|
|
17
16
|
} from '@wordpress/components';
|
|
@@ -26,23 +25,16 @@ import BlockListItem from './block-list-item';
|
|
|
26
25
|
import BlockListItemCell from './block-list-item-cell';
|
|
27
26
|
import {
|
|
28
27
|
BlockListProvider,
|
|
29
|
-
BlockListConsumer,
|
|
30
28
|
DEFAULT_BLOCK_LIST_CONTEXT,
|
|
31
29
|
} from './block-list-context';
|
|
32
30
|
import { BlockDraggableWrapper } from '../block-draggable';
|
|
31
|
+
import { useEditorWrapperStyles } from '../../hooks/use-editor-wrapper-styles';
|
|
33
32
|
import { store as blockEditorStore } from '../../store';
|
|
34
33
|
|
|
35
34
|
const identity = ( x ) => x;
|
|
36
35
|
|
|
37
36
|
const stylesMemo = {};
|
|
38
|
-
const getStyles = (
|
|
39
|
-
isRootList,
|
|
40
|
-
isStackedHorizontally,
|
|
41
|
-
horizontalAlignment
|
|
42
|
-
) => {
|
|
43
|
-
if ( isRootList ) {
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
37
|
+
const getStyles = ( isStackedHorizontally, horizontalAlignment ) => {
|
|
46
38
|
const styleName = `${ isStackedHorizontally }-${ horizontalAlignment }`;
|
|
47
39
|
if ( stylesMemo[ styleName ] ) {
|
|
48
40
|
return stylesMemo[ styleName ];
|
|
@@ -74,7 +66,6 @@ export default function BlockList( {
|
|
|
74
66
|
renderAppender,
|
|
75
67
|
renderFooterAppender,
|
|
76
68
|
rootClientId,
|
|
77
|
-
title,
|
|
78
69
|
withFooter = true,
|
|
79
70
|
} ) {
|
|
80
71
|
const {
|
|
@@ -190,114 +181,6 @@ export default function BlockList( {
|
|
|
190
181
|
}
|
|
191
182
|
};
|
|
192
183
|
|
|
193
|
-
const renderList = ( extraProps = {} ) => {
|
|
194
|
-
const { parentScrollRef, onScroll } = extraProps;
|
|
195
|
-
|
|
196
|
-
const { blockToolbar, headerToolbar, floatingToolbar } = styles;
|
|
197
|
-
|
|
198
|
-
const containerStyle = {
|
|
199
|
-
flex: isRootList ? 1 : 0,
|
|
200
|
-
// We set negative margin in the parent to remove the edge spacing between parent block and child block in ineer blocks.
|
|
201
|
-
marginVertical: isRootList ? 0 : -marginVertical,
|
|
202
|
-
marginHorizontal: isRootList ? 0 : -marginHorizontal,
|
|
203
|
-
};
|
|
204
|
-
|
|
205
|
-
const isContentStretch = contentResizeMode === 'stretch';
|
|
206
|
-
const isMultiBlocks = blockClientIds.length > 1;
|
|
207
|
-
const { isWider } = alignmentHelpers;
|
|
208
|
-
const extraScrollHeight =
|
|
209
|
-
headerToolbar.height +
|
|
210
|
-
blockToolbar.height +
|
|
211
|
-
( isFloatingToolbarVisible ? floatingToolbar.height : 0 );
|
|
212
|
-
|
|
213
|
-
const scrollViewStyle = [
|
|
214
|
-
{ flex: isRootList ? 1 : 0 },
|
|
215
|
-
! isRootList && styles.overflowVisible,
|
|
216
|
-
];
|
|
217
|
-
|
|
218
|
-
return (
|
|
219
|
-
<View
|
|
220
|
-
style={ containerStyle }
|
|
221
|
-
onAccessibilityEscape={ clearSelectedBlock }
|
|
222
|
-
onLayout={ onLayout }
|
|
223
|
-
testID="block-list-wrapper"
|
|
224
|
-
>
|
|
225
|
-
<KeyboardAwareFlatList
|
|
226
|
-
{ ...( Platform.OS === 'android'
|
|
227
|
-
? { removeClippedSubviews: false }
|
|
228
|
-
: {} ) } // Disable clipping on Android to fix focus losing. See https://github.com/wordpress-mobile/gutenberg-mobile/pull/741#issuecomment-472746541
|
|
229
|
-
accessibilityLabel="block-list"
|
|
230
|
-
innerRef={ ( ref ) => {
|
|
231
|
-
scrollViewRef.current = parentScrollRef || ref;
|
|
232
|
-
} }
|
|
233
|
-
extraScrollHeight={ extraScrollHeight }
|
|
234
|
-
keyboardShouldPersistTaps="always"
|
|
235
|
-
scrollViewStyle={ scrollViewStyle }
|
|
236
|
-
extraData={ getExtraData() }
|
|
237
|
-
scrollEnabled={ isRootList }
|
|
238
|
-
contentContainerStyle={ [
|
|
239
|
-
horizontal && styles.horizontalContentContainer,
|
|
240
|
-
isWider( blockWidth, 'medium' ) &&
|
|
241
|
-
( isContentStretch && isMultiBlocks
|
|
242
|
-
? styles.horizontalContentContainerStretch
|
|
243
|
-
: styles.horizontalContentContainerCenter ),
|
|
244
|
-
] }
|
|
245
|
-
style={ getStyles(
|
|
246
|
-
isRootList,
|
|
247
|
-
isStackedHorizontally,
|
|
248
|
-
horizontalAlignment
|
|
249
|
-
) }
|
|
250
|
-
data={ blockClientIds }
|
|
251
|
-
keyExtractor={ identity }
|
|
252
|
-
listKey={
|
|
253
|
-
rootClientId ? `list-${ rootClientId }` : 'list-root'
|
|
254
|
-
}
|
|
255
|
-
renderItem={ renderItem }
|
|
256
|
-
CellRendererComponent={ BlockListItemCell }
|
|
257
|
-
shouldPreventAutomaticScroll={
|
|
258
|
-
shouldFlatListPreventAutomaticScroll
|
|
259
|
-
}
|
|
260
|
-
title={ title }
|
|
261
|
-
ListHeaderComponent={ header }
|
|
262
|
-
ListEmptyComponent={
|
|
263
|
-
! isReadOnly && (
|
|
264
|
-
<EmptyList
|
|
265
|
-
orientation={ orientation }
|
|
266
|
-
rootClientId={ rootClientId }
|
|
267
|
-
renderAppender={ renderAppender }
|
|
268
|
-
renderFooterAppender={ renderFooterAppender }
|
|
269
|
-
/>
|
|
270
|
-
)
|
|
271
|
-
}
|
|
272
|
-
ListFooterComponent={
|
|
273
|
-
<Footer
|
|
274
|
-
addBlockToEndOfPost={ addBlockToEndOfPost }
|
|
275
|
-
isReadOnly={ isReadOnly }
|
|
276
|
-
renderFooterAppender={ renderFooterAppender }
|
|
277
|
-
withFooter={ withFooter }
|
|
278
|
-
/>
|
|
279
|
-
}
|
|
280
|
-
onScroll={ onScroll }
|
|
281
|
-
/>
|
|
282
|
-
{ shouldShowInnerBlockAppender() && (
|
|
283
|
-
<View
|
|
284
|
-
style={ {
|
|
285
|
-
marginHorizontal:
|
|
286
|
-
marginHorizontal -
|
|
287
|
-
styles.innerAppender.marginLeft,
|
|
288
|
-
} }
|
|
289
|
-
>
|
|
290
|
-
<BlockListAppender
|
|
291
|
-
rootClientId={ rootClientId }
|
|
292
|
-
renderAppender={ renderAppender }
|
|
293
|
-
showSeparator
|
|
294
|
-
/>
|
|
295
|
-
</View>
|
|
296
|
-
) }
|
|
297
|
-
</View>
|
|
298
|
-
);
|
|
299
|
-
};
|
|
300
|
-
|
|
301
184
|
const renderItem = ( { item: clientId, index } ) => {
|
|
302
185
|
// Extracting the grid item properties here to avoid
|
|
303
186
|
// re-renders in the blockListItem component.
|
|
@@ -328,29 +211,159 @@ export default function BlockList( {
|
|
|
328
211
|
);
|
|
329
212
|
};
|
|
330
213
|
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
214
|
+
const { blockToolbar, headerToolbar, floatingToolbar } = styles;
|
|
215
|
+
|
|
216
|
+
const containerStyle = {
|
|
217
|
+
flex: isRootList ? 1 : 0,
|
|
218
|
+
// We set negative margin in the parent to remove the edge spacing between parent block and child block in ineer blocks.
|
|
219
|
+
marginVertical: isRootList ? 0 : -marginVertical,
|
|
220
|
+
marginHorizontal: isRootList ? 0 : -marginHorizontal,
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
const isContentStretch = contentResizeMode === 'stretch';
|
|
224
|
+
const isMultiBlocks = blockClientIds.length > 1;
|
|
225
|
+
const { isWider } = alignmentHelpers;
|
|
226
|
+
const extraScrollHeight =
|
|
227
|
+
headerToolbar.height +
|
|
228
|
+
blockToolbar.height +
|
|
229
|
+
( isFloatingToolbarVisible ? floatingToolbar.height : 0 );
|
|
230
|
+
|
|
231
|
+
return (
|
|
232
|
+
<View
|
|
233
|
+
style={ containerStyle }
|
|
234
|
+
onAccessibilityEscape={ clearSelectedBlock }
|
|
235
|
+
onLayout={ onLayout }
|
|
236
|
+
testID="block-list-wrapper"
|
|
338
237
|
>
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
238
|
+
{ isRootList ? (
|
|
239
|
+
<BlockListProvider
|
|
240
|
+
value={ {
|
|
241
|
+
...DEFAULT_BLOCK_LIST_CONTEXT,
|
|
242
|
+
scrollRef: scrollViewRef.current,
|
|
243
|
+
} }
|
|
244
|
+
>
|
|
245
|
+
<BlockDraggableWrapper isRTL={ isRTL }>
|
|
246
|
+
{ ( { onScroll } ) => (
|
|
247
|
+
<KeyboardAwareFlatList
|
|
248
|
+
{ ...( Platform.OS === 'android'
|
|
249
|
+
? { removeClippedSubviews: false }
|
|
250
|
+
: {} ) } // Disable clipping on Android to fix focus losing. See https://github.com/wordpress-mobile/gutenberg-mobile/pull/741#issuecomment-472746541
|
|
251
|
+
accessibilityLabel="block-list"
|
|
252
|
+
innerRef={ ( ref ) => {
|
|
253
|
+
scrollViewRef.current = ref;
|
|
254
|
+
} }
|
|
255
|
+
extraScrollHeight={ extraScrollHeight }
|
|
256
|
+
keyboardShouldPersistTaps="always"
|
|
257
|
+
scrollViewStyle={ { flex: 1 } }
|
|
258
|
+
extraData={ getExtraData() }
|
|
259
|
+
scrollEnabled={ isRootList }
|
|
260
|
+
contentContainerStyle={ [
|
|
261
|
+
horizontal &&
|
|
262
|
+
styles.horizontalContentContainer,
|
|
263
|
+
isWider( blockWidth, 'medium' ) &&
|
|
264
|
+
( isContentStretch && isMultiBlocks
|
|
265
|
+
? styles.horizontalContentContainerStretch
|
|
266
|
+
: styles.horizontalContentContainerCenter ),
|
|
267
|
+
] }
|
|
268
|
+
data={ blockClientIds }
|
|
269
|
+
keyExtractor={ identity }
|
|
270
|
+
renderItem={ renderItem }
|
|
271
|
+
CellRendererComponent={ BlockListItemCell }
|
|
272
|
+
shouldPreventAutomaticScroll={
|
|
273
|
+
shouldFlatListPreventAutomaticScroll
|
|
274
|
+
}
|
|
275
|
+
ListHeaderComponent={ header }
|
|
276
|
+
ListEmptyComponent={
|
|
277
|
+
! isReadOnly && (
|
|
278
|
+
<EmptyList
|
|
279
|
+
orientation={ orientation }
|
|
280
|
+
rootClientId={ rootClientId }
|
|
281
|
+
renderAppender={ renderAppender }
|
|
282
|
+
renderFooterAppender={
|
|
283
|
+
renderFooterAppender
|
|
284
|
+
}
|
|
285
|
+
/>
|
|
286
|
+
)
|
|
287
|
+
}
|
|
288
|
+
ListFooterComponent={
|
|
289
|
+
<Footer
|
|
290
|
+
addBlockToEndOfPost={
|
|
291
|
+
addBlockToEndOfPost
|
|
292
|
+
}
|
|
293
|
+
isReadOnly={ isReadOnly }
|
|
294
|
+
renderFooterAppender={
|
|
295
|
+
renderFooterAppender
|
|
296
|
+
}
|
|
297
|
+
withFooter={ withFooter }
|
|
298
|
+
/>
|
|
299
|
+
}
|
|
300
|
+
onScroll={ onScroll }
|
|
301
|
+
/>
|
|
302
|
+
) }
|
|
303
|
+
</BlockDraggableWrapper>
|
|
304
|
+
</BlockListProvider>
|
|
305
|
+
) : (
|
|
306
|
+
<>
|
|
307
|
+
{ blockClientIds.length > 0 ? (
|
|
308
|
+
<View style={ [ { flex: 0 }, styles.overflowVisible ] }>
|
|
309
|
+
<View
|
|
310
|
+
style={ [
|
|
311
|
+
...getStyles(
|
|
312
|
+
isStackedHorizontally,
|
|
313
|
+
horizontalAlignment
|
|
314
|
+
),
|
|
315
|
+
horizontal &&
|
|
316
|
+
styles.horizontalContentContainer,
|
|
317
|
+
] }
|
|
318
|
+
>
|
|
319
|
+
{ blockClientIds.map(
|
|
320
|
+
( currentClientId, index ) => {
|
|
321
|
+
return (
|
|
322
|
+
<View key={ currentClientId }>
|
|
323
|
+
{ renderItem( {
|
|
324
|
+
item: currentClientId,
|
|
325
|
+
index,
|
|
326
|
+
} ) }
|
|
327
|
+
</View>
|
|
328
|
+
);
|
|
329
|
+
}
|
|
330
|
+
) }
|
|
331
|
+
<Footer
|
|
332
|
+
addBlockToEndOfPost={ addBlockToEndOfPost }
|
|
333
|
+
isReadOnly={ isReadOnly }
|
|
334
|
+
renderFooterAppender={
|
|
335
|
+
renderFooterAppender
|
|
336
|
+
}
|
|
337
|
+
withFooter={ withFooter }
|
|
338
|
+
/>
|
|
339
|
+
</View>
|
|
340
|
+
</View>
|
|
341
|
+
) : (
|
|
342
|
+
<EmptyList
|
|
343
|
+
orientation={ orientation }
|
|
344
|
+
rootClientId={ rootClientId }
|
|
345
|
+
renderAppender={ renderAppender }
|
|
346
|
+
renderFooterAppender={ renderFooterAppender }
|
|
347
|
+
/>
|
|
348
|
+
) }
|
|
349
|
+
</>
|
|
350
|
+
) }
|
|
351
|
+
{ shouldShowInnerBlockAppender() && (
|
|
352
|
+
<View
|
|
353
|
+
style={ {
|
|
354
|
+
marginHorizontal:
|
|
355
|
+
marginHorizontal - styles.innerAppender.marginLeft,
|
|
356
|
+
} }
|
|
357
|
+
>
|
|
358
|
+
<BlockListAppender
|
|
359
|
+
rootClientId={ rootClientId }
|
|
360
|
+
renderAppender={ renderAppender }
|
|
361
|
+
showSeparator
|
|
362
|
+
/>
|
|
363
|
+
</View>
|
|
364
|
+
) }
|
|
365
|
+
</View>
|
|
351
366
|
);
|
|
352
|
-
|
|
353
|
-
return blockList;
|
|
354
367
|
}
|
|
355
368
|
|
|
356
369
|
function Footer( {
|
|
@@ -375,7 +388,7 @@ function Footer( {
|
|
|
375
388
|
</>
|
|
376
389
|
);
|
|
377
390
|
} else if ( renderFooterAppender ) {
|
|
378
|
-
return renderFooterAppender()
|
|
391
|
+
return <View>{ renderFooterAppender() }</View>;
|
|
379
392
|
}
|
|
380
393
|
|
|
381
394
|
return null;
|
|
@@ -410,24 +423,22 @@ function EmptyList( {
|
|
|
410
423
|
! blockClientIds[ insertionPoint.index ] ),
|
|
411
424
|
};
|
|
412
425
|
} );
|
|
426
|
+
const align = renderAppender ? WIDE_ALIGNMENTS.alignments.full : undefined;
|
|
427
|
+
const [ wrapperStyles ] = useEditorWrapperStyles( { align } );
|
|
413
428
|
|
|
414
429
|
if ( renderFooterAppender || renderAppender === false ) {
|
|
415
430
|
return null;
|
|
416
431
|
}
|
|
417
432
|
|
|
433
|
+
const containerStyles = [ styles.defaultAppender, wrapperStyles ];
|
|
434
|
+
|
|
418
435
|
return (
|
|
419
|
-
<View style={
|
|
420
|
-
<
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
<BlockListAppender
|
|
426
|
-
rootClientId={ rootClientId }
|
|
427
|
-
renderAppender={ renderAppender }
|
|
428
|
-
showSeparator={ shouldShowInsertionPoint }
|
|
429
|
-
/>
|
|
430
|
-
</ReadableContentView>
|
|
436
|
+
<View style={ containerStyles }>
|
|
437
|
+
<BlockListAppender
|
|
438
|
+
rootClientId={ rootClientId }
|
|
439
|
+
renderAppender={ renderAppender }
|
|
440
|
+
showSeparator={ shouldShowInsertionPoint }
|
|
441
|
+
/>
|
|
431
442
|
</View>
|
|
432
443
|
);
|
|
433
444
|
}
|
|
@@ -52,7 +52,7 @@ describe( 'BlockList', () => {
|
|
|
52
52
|
await addBlock( screen, 'Social Icons' );
|
|
53
53
|
const socialLinksBlock = await getBlock( screen, 'Social Icons' );
|
|
54
54
|
fireEvent.press( socialLinksBlock );
|
|
55
|
-
triggerBlockListLayout( socialLinksBlock );
|
|
55
|
+
await triggerBlockListLayout( socialLinksBlock );
|
|
56
56
|
|
|
57
57
|
// Act
|
|
58
58
|
fireEvent.press(
|
|
@@ -82,7 +82,7 @@ describe( 'BlockList', () => {
|
|
|
82
82
|
await initializeEditor();
|
|
83
83
|
await addBlock( screen, 'Group' );
|
|
84
84
|
const groupBlock = await getBlock( screen, 'Group' );
|
|
85
|
-
triggerBlockListLayout( groupBlock );
|
|
85
|
+
await triggerBlockListLayout( groupBlock );
|
|
86
86
|
|
|
87
87
|
// Assert
|
|
88
88
|
expect(
|
|
@@ -21,7 +21,7 @@ import warning from '@wordpress/warning';
|
|
|
21
21
|
* Internal dependencies
|
|
22
22
|
*/
|
|
23
23
|
import useMovingAnimation from '../../use-moving-animation';
|
|
24
|
-
import { BlockListBlockContext } from '../block';
|
|
24
|
+
import { BlockListBlockContext } from '../block-list-block-context';
|
|
25
25
|
import { useFocusFirstElement } from './use-focus-first-element';
|
|
26
26
|
import { useIsHovered } from './use-is-hovered';
|
|
27
27
|
import { useBlockEditContext } from '../../block-edit/context';
|
|
@@ -11,6 +11,7 @@ import { isRTL } from '@wordpress/i18n';
|
|
|
11
11
|
*/
|
|
12
12
|
import { store as blockEditorStore } from '../../store';
|
|
13
13
|
import { InsertionPointOpenRef } from '../block-tools/insertion-point';
|
|
14
|
+
import { unlock } from '../../lock-unlock';
|
|
14
15
|
|
|
15
16
|
export function useInBetweenInserter() {
|
|
16
17
|
const openRef = useContext( InsertionPointOpenRef );
|
|
@@ -29,7 +30,8 @@ export function useInBetweenInserter() {
|
|
|
29
30
|
getSelectedBlockClientIds,
|
|
30
31
|
getTemplateLock,
|
|
31
32
|
__unstableIsWithinBlockOverlay,
|
|
32
|
-
|
|
33
|
+
getBlockEditingMode,
|
|
34
|
+
} = unlock( useSelect( blockEditorStore ) );
|
|
33
35
|
const { showInsertionPoint, hideInsertionPoint } =
|
|
34
36
|
useDispatch( blockEditorStore );
|
|
35
37
|
|
|
@@ -74,8 +76,10 @@ export function useInBetweenInserter() {
|
|
|
74
76
|
rootClientId = blockElement.getAttribute( 'data-block' );
|
|
75
77
|
}
|
|
76
78
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
+
if (
|
|
80
|
+
getTemplateLock( rootClientId ) ||
|
|
81
|
+
getBlockEditingMode( rootClientId ) === 'disabled'
|
|
82
|
+
) {
|
|
79
83
|
return;
|
|
80
84
|
}
|
|
81
85
|
|
|
@@ -85,6 +85,25 @@ function BlockListAppender( {
|
|
|
85
85
|
tagName: TagName = 'div',
|
|
86
86
|
} ) {
|
|
87
87
|
const appender = useAppender( rootClientId, renderAppender );
|
|
88
|
+
const isDragOver = useSelect(
|
|
89
|
+
( select ) => {
|
|
90
|
+
const {
|
|
91
|
+
getBlockInsertionPoint,
|
|
92
|
+
isBlockInsertionPointVisible,
|
|
93
|
+
getBlockCount,
|
|
94
|
+
} = select( blockEditorStore );
|
|
95
|
+
const insertionPoint = getBlockInsertionPoint();
|
|
96
|
+
// Ideally we should also check for `isDragging` but currently it
|
|
97
|
+
// requires a lot more setup. We can revisit this once we refactor
|
|
98
|
+
// the DnD utility hooks.
|
|
99
|
+
return (
|
|
100
|
+
isBlockInsertionPointVisible() &&
|
|
101
|
+
rootClientId === insertionPoint?.rootClientId &&
|
|
102
|
+
getBlockCount( rootClientId ) === 0
|
|
103
|
+
);
|
|
104
|
+
},
|
|
105
|
+
[ rootClientId ]
|
|
106
|
+
);
|
|
88
107
|
|
|
89
108
|
if ( ! appender ) {
|
|
90
109
|
return null;
|
|
@@ -101,10 +120,9 @@ function BlockListAppender( {
|
|
|
101
120
|
//
|
|
102
121
|
// See: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus
|
|
103
122
|
tabIndex={ -1 }
|
|
104
|
-
className={ classnames(
|
|
105
|
-
'
|
|
106
|
-
|
|
107
|
-
) }
|
|
123
|
+
className={ classnames( 'block-list-appender wp-block', className, {
|
|
124
|
+
'is-drag-over': isDragOver,
|
|
125
|
+
} ) }
|
|
108
126
|
// Needed in case the whole editor is content editable (for multi
|
|
109
127
|
// selection). It fixes an edge case where ArrowDown and ArrowRight
|
|
110
128
|
// should collapse the selection to the end of that selection and
|
|
@@ -39,6 +39,10 @@ import { store as coreStore } from '@wordpress/core-data';
|
|
|
39
39
|
import { getMoversSetup } from '../block-mover/mover-description';
|
|
40
40
|
import { store as blockEditorStore } from '../../store';
|
|
41
41
|
import BlockTransformationsMenu from '../block-switcher/block-transformations-menu';
|
|
42
|
+
import {
|
|
43
|
+
useConvertToGroupButtons,
|
|
44
|
+
useConvertToGroupButtonProps,
|
|
45
|
+
} from '../convert-to-group-buttons';
|
|
42
46
|
|
|
43
47
|
const BlockActionsMenu = ( {
|
|
44
48
|
// Select.
|
|
@@ -55,6 +59,7 @@ const BlockActionsMenu = ( {
|
|
|
55
59
|
rootClientId,
|
|
56
60
|
selectedBlockClientId,
|
|
57
61
|
selectedBlockPossibleTransformations,
|
|
62
|
+
canRemove,
|
|
58
63
|
// Dispatch.
|
|
59
64
|
createSuccessNotice,
|
|
60
65
|
convertToRegularBlocks,
|
|
@@ -93,6 +98,17 @@ const BlockActionsMenu = ( {
|
|
|
93
98
|
},
|
|
94
99
|
} = getMoversSetup( isStackedHorizontally, moversOptions );
|
|
95
100
|
|
|
101
|
+
// Check if selected block is Groupable and/or Ungroupable.
|
|
102
|
+
const convertToGroupButtonProps = useConvertToGroupButtonProps( [
|
|
103
|
+
selectedBlockClientId,
|
|
104
|
+
] );
|
|
105
|
+
const { isGroupable, isUngroupable } = convertToGroupButtonProps;
|
|
106
|
+
const showConvertToGroupButton =
|
|
107
|
+
( isGroupable || isUngroupable ) && canRemove;
|
|
108
|
+
const convertToGroupButtons = useConvertToGroupButtons( {
|
|
109
|
+
...convertToGroupButtonProps,
|
|
110
|
+
} );
|
|
111
|
+
|
|
96
112
|
const allOptions = {
|
|
97
113
|
settings: {
|
|
98
114
|
id: 'settingsOption',
|
|
@@ -229,6 +245,10 @@ const BlockActionsMenu = ( {
|
|
|
229
245
|
canDuplicate && allOptions.cutButton,
|
|
230
246
|
canDuplicate && isPasteEnabled && allOptions.pasteButton,
|
|
231
247
|
canDuplicate && allOptions.duplicateButton,
|
|
248
|
+
showConvertToGroupButton && isGroupable && convertToGroupButtons.group,
|
|
249
|
+
showConvertToGroupButton &&
|
|
250
|
+
isUngroupable &&
|
|
251
|
+
convertToGroupButtons.ungroup,
|
|
232
252
|
isReusableBlockType &&
|
|
233
253
|
innerBlockCount > 0 &&
|
|
234
254
|
allOptions.convertToRegularBlocks,
|
|
@@ -327,6 +347,7 @@ export default compose(
|
|
|
327
347
|
getSelectedBlockClientIds,
|
|
328
348
|
canInsertBlockType,
|
|
329
349
|
getTemplateLock,
|
|
350
|
+
canRemoveBlock,
|
|
330
351
|
} = select( blockEditorStore );
|
|
331
352
|
const block = getBlock( clientId );
|
|
332
353
|
const blockName = getBlockName( clientId );
|
|
@@ -363,6 +384,7 @@ export default compose(
|
|
|
363
384
|
const selectedBlockPossibleTransformations = selectedBlock
|
|
364
385
|
? getBlockTransformItems( selectedBlock, rootClientId )
|
|
365
386
|
: EMPTY_BLOCK_LIST;
|
|
387
|
+
const canRemove = canRemoveBlock( selectedBlockClientId );
|
|
366
388
|
|
|
367
389
|
const isReusableBlockType = block ? isReusableBlock( block ) : false;
|
|
368
390
|
const reusableBlock = isReusableBlockType
|
|
@@ -388,6 +410,7 @@ export default compose(
|
|
|
388
410
|
rootClientId,
|
|
389
411
|
selectedBlockClientId,
|
|
390
412
|
selectedBlockPossibleTransformations,
|
|
413
|
+
canRemove,
|
|
391
414
|
};
|
|
392
415
|
} ),
|
|
393
416
|
withDispatch(
|
|
@@ -33,7 +33,5 @@ export default function BlockStylesPreviewPanel( {
|
|
|
33
33
|
};
|
|
34
34
|
}, [ genericPreviewBlock, styleClassName ] );
|
|
35
35
|
|
|
36
|
-
return
|
|
37
|
-
<InserterPreviewPanel item={ previewBlocks } isStylePreview={ true } />
|
|
38
|
-
);
|
|
36
|
+
return <InserterPreviewPanel item={ previewBlocks } />;
|
|
39
37
|
}
|
|
@@ -14,6 +14,7 @@ import { useState, useMemo } from '@wordpress/element';
|
|
|
14
14
|
*/
|
|
15
15
|
import BlockIcon from '../block-icon';
|
|
16
16
|
import PreviewBlockPopover from './preview-block-popover';
|
|
17
|
+
import BlockVariationTransformations from './block-variation-transformations';
|
|
17
18
|
|
|
18
19
|
/**
|
|
19
20
|
* Helper hook to group transformations to display them in a specific order in the UI.
|
|
@@ -65,7 +66,9 @@ function useGroupedTransforms( possibleBlockTransformations ) {
|
|
|
65
66
|
const BlockTransformationsMenu = ( {
|
|
66
67
|
className,
|
|
67
68
|
possibleBlockTransformations,
|
|
69
|
+
possibleBlockVariationTransformations,
|
|
68
70
|
onSelect,
|
|
71
|
+
onSelectVariation,
|
|
69
72
|
blocks,
|
|
70
73
|
} ) => {
|
|
71
74
|
const [ hoveredTransformItemName, setHoveredTransformItemName ] =
|
|
@@ -95,6 +98,15 @@ const BlockTransformationsMenu = ( {
|
|
|
95
98
|
) }
|
|
96
99
|
/>
|
|
97
100
|
) }
|
|
101
|
+
{ !! possibleBlockVariationTransformations?.length && (
|
|
102
|
+
<BlockVariationTransformations
|
|
103
|
+
transformations={
|
|
104
|
+
possibleBlockVariationTransformations
|
|
105
|
+
}
|
|
106
|
+
blocks={ blocks }
|
|
107
|
+
onSelect={ onSelectVariation }
|
|
108
|
+
/>
|
|
109
|
+
) }
|
|
98
110
|
{ priorityTextTransformations.map( ( item ) => (
|
|
99
111
|
<BlockTranformationItem
|
|
100
112
|
key={ item.name }
|