@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
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import classnames from 'classnames';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* WordPress dependencies
|
|
8
|
-
*/
|
|
9
|
-
import { useSelect } from '@wordpress/data';
|
|
10
|
-
import { forwardRef, useEffect, useState } from '@wordpress/element';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Internal dependencies
|
|
14
|
-
*/
|
|
15
|
-
import { unlock } from '../../lock-unlock';
|
|
16
|
-
import ListViewBlockSelectButton from './block-select-button';
|
|
17
|
-
import BlockDraggable from '../block-draggable';
|
|
18
|
-
import { store as blockEditorStore } from '../../store';
|
|
19
|
-
import { updateAttributes } from './update-attributes';
|
|
20
|
-
import { LinkUI } from './link-ui';
|
|
21
|
-
import { useInsertedBlock } from './use-inserted-block';
|
|
22
|
-
import { useListViewContext } from './context';
|
|
23
|
-
|
|
24
|
-
const BLOCKS_WITH_LINK_UI_SUPPORT = [
|
|
25
|
-
'core/navigation-link',
|
|
26
|
-
'core/navigation-submenu',
|
|
27
|
-
];
|
|
28
|
-
|
|
29
|
-
const ListViewBlockContents = forwardRef(
|
|
30
|
-
(
|
|
31
|
-
{
|
|
32
|
-
onClick,
|
|
33
|
-
onToggleExpanded,
|
|
34
|
-
block,
|
|
35
|
-
isSelected,
|
|
36
|
-
position,
|
|
37
|
-
siblingBlockCount,
|
|
38
|
-
level,
|
|
39
|
-
isExpanded,
|
|
40
|
-
selectedClientIds,
|
|
41
|
-
...props
|
|
42
|
-
},
|
|
43
|
-
ref
|
|
44
|
-
) => {
|
|
45
|
-
const { clientId } = block;
|
|
46
|
-
const [ isLinkUIOpen, setIsLinkUIOpen ] = useState();
|
|
47
|
-
const {
|
|
48
|
-
blockMovingClientId,
|
|
49
|
-
selectedBlockInBlockEditor,
|
|
50
|
-
lastInsertedBlockClientId,
|
|
51
|
-
} = useSelect(
|
|
52
|
-
( select ) => {
|
|
53
|
-
const {
|
|
54
|
-
hasBlockMovingClientId,
|
|
55
|
-
getSelectedBlockClientId,
|
|
56
|
-
getLastInsertedBlocksClientIds,
|
|
57
|
-
} = unlock( select( blockEditorStore ) );
|
|
58
|
-
const lastInsertedBlocksClientIds =
|
|
59
|
-
getLastInsertedBlocksClientIds();
|
|
60
|
-
return {
|
|
61
|
-
blockMovingClientId: hasBlockMovingClientId(),
|
|
62
|
-
selectedBlockInBlockEditor: getSelectedBlockClientId(),
|
|
63
|
-
lastInsertedBlockClientId:
|
|
64
|
-
lastInsertedBlocksClientIds &&
|
|
65
|
-
lastInsertedBlocksClientIds[ 0 ],
|
|
66
|
-
};
|
|
67
|
-
},
|
|
68
|
-
[ clientId ]
|
|
69
|
-
);
|
|
70
|
-
|
|
71
|
-
const {
|
|
72
|
-
insertedBlockAttributes,
|
|
73
|
-
insertedBlockName,
|
|
74
|
-
setInsertedBlockAttributes,
|
|
75
|
-
} = useInsertedBlock( lastInsertedBlockClientId );
|
|
76
|
-
|
|
77
|
-
const hasExistingLinkValue = insertedBlockAttributes?.url;
|
|
78
|
-
|
|
79
|
-
useEffect( () => {
|
|
80
|
-
if (
|
|
81
|
-
clientId === lastInsertedBlockClientId &&
|
|
82
|
-
BLOCKS_WITH_LINK_UI_SUPPORT?.includes( insertedBlockName ) &&
|
|
83
|
-
! hasExistingLinkValue // don't re-show the Link UI if the block already has a link value.
|
|
84
|
-
) {
|
|
85
|
-
setIsLinkUIOpen( true );
|
|
86
|
-
}
|
|
87
|
-
}, [
|
|
88
|
-
lastInsertedBlockClientId,
|
|
89
|
-
clientId,
|
|
90
|
-
insertedBlockName,
|
|
91
|
-
hasExistingLinkValue,
|
|
92
|
-
] );
|
|
93
|
-
|
|
94
|
-
const { renderAdditionalBlockUI } = useListViewContext();
|
|
95
|
-
|
|
96
|
-
const isBlockMoveTarget =
|
|
97
|
-
blockMovingClientId && selectedBlockInBlockEditor === clientId;
|
|
98
|
-
|
|
99
|
-
const className = classnames( 'block-editor-list-view-block-contents', {
|
|
100
|
-
'is-dropping-before': isBlockMoveTarget,
|
|
101
|
-
} );
|
|
102
|
-
|
|
103
|
-
// Only include all selected blocks if the currently clicked on block
|
|
104
|
-
// is one of the selected blocks. This ensures that if a user attempts
|
|
105
|
-
// to drag a block that isn't part of the selection, they're still able
|
|
106
|
-
// to drag it and rearrange its position.
|
|
107
|
-
const draggableClientIds = selectedClientIds.includes( clientId )
|
|
108
|
-
? selectedClientIds
|
|
109
|
-
: [ clientId ];
|
|
110
|
-
|
|
111
|
-
return (
|
|
112
|
-
<>
|
|
113
|
-
{ renderAdditionalBlockUI && renderAdditionalBlockUI( block ) }
|
|
114
|
-
{ isLinkUIOpen && (
|
|
115
|
-
<LinkUI
|
|
116
|
-
clientId={ lastInsertedBlockClientId }
|
|
117
|
-
link={ insertedBlockAttributes }
|
|
118
|
-
onClose={ () => setIsLinkUIOpen( false ) }
|
|
119
|
-
hasCreateSuggestion={ false }
|
|
120
|
-
onChange={ ( updatedValue ) => {
|
|
121
|
-
updateAttributes(
|
|
122
|
-
updatedValue,
|
|
123
|
-
setInsertedBlockAttributes,
|
|
124
|
-
insertedBlockAttributes
|
|
125
|
-
);
|
|
126
|
-
setIsLinkUIOpen( false );
|
|
127
|
-
} }
|
|
128
|
-
onCancel={ () => setIsLinkUIOpen( false ) }
|
|
129
|
-
/>
|
|
130
|
-
) }
|
|
131
|
-
<BlockDraggable clientIds={ draggableClientIds }>
|
|
132
|
-
{ ( { draggable, onDragStart, onDragEnd } ) => (
|
|
133
|
-
<ListViewBlockSelectButton
|
|
134
|
-
ref={ ref }
|
|
135
|
-
className={ className }
|
|
136
|
-
block={ block }
|
|
137
|
-
onClick={ onClick }
|
|
138
|
-
onToggleExpanded={ onToggleExpanded }
|
|
139
|
-
isSelected={ isSelected }
|
|
140
|
-
position={ position }
|
|
141
|
-
siblingBlockCount={ siblingBlockCount }
|
|
142
|
-
level={ level }
|
|
143
|
-
draggable={ draggable }
|
|
144
|
-
onDragStart={ onDragStart }
|
|
145
|
-
onDragEnd={ onDragEnd }
|
|
146
|
-
isExpanded={ isExpanded }
|
|
147
|
-
{ ...props }
|
|
148
|
-
/>
|
|
149
|
-
) }
|
|
150
|
-
</BlockDraggable>
|
|
151
|
-
</>
|
|
152
|
-
);
|
|
153
|
-
}
|
|
154
|
-
);
|
|
155
|
-
|
|
156
|
-
export default ListViewBlockContents;
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import classnames from 'classnames';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* WordPress dependencies
|
|
8
|
-
*/
|
|
9
|
-
import {
|
|
10
|
-
Button,
|
|
11
|
-
__experimentalHStack as HStack,
|
|
12
|
-
__experimentalTruncate as Truncate,
|
|
13
|
-
} from '@wordpress/components';
|
|
14
|
-
import { forwardRef } from '@wordpress/element';
|
|
15
|
-
import { Icon, lockSmall as lock } from '@wordpress/icons';
|
|
16
|
-
import { SPACE, ENTER } from '@wordpress/keycodes';
|
|
17
|
-
import { sprintf, __ } from '@wordpress/i18n';
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Internal dependencies
|
|
21
|
-
*/
|
|
22
|
-
import BlockIcon from '../block-icon';
|
|
23
|
-
import useBlockDisplayInformation from '../use-block-display-information';
|
|
24
|
-
import useBlockDisplayTitle from '../block-title/use-block-display-title';
|
|
25
|
-
import ListViewExpander from './expander';
|
|
26
|
-
import { useBlockLock } from '../block-lock';
|
|
27
|
-
|
|
28
|
-
function ListViewBlockSelectButton(
|
|
29
|
-
{
|
|
30
|
-
className,
|
|
31
|
-
block,
|
|
32
|
-
onClick,
|
|
33
|
-
onToggleExpanded,
|
|
34
|
-
tabIndex,
|
|
35
|
-
onFocus,
|
|
36
|
-
onDragStart,
|
|
37
|
-
onDragEnd,
|
|
38
|
-
draggable,
|
|
39
|
-
},
|
|
40
|
-
ref
|
|
41
|
-
) {
|
|
42
|
-
const { clientId } = block;
|
|
43
|
-
const blockInformation = useBlockDisplayInformation( clientId );
|
|
44
|
-
const blockTitle = useBlockDisplayTitle( {
|
|
45
|
-
clientId,
|
|
46
|
-
context: 'list-view',
|
|
47
|
-
} );
|
|
48
|
-
const { isLocked } = useBlockLock( clientId );
|
|
49
|
-
|
|
50
|
-
// The `href` attribute triggers the browser's native HTML drag operations.
|
|
51
|
-
// When the link is dragged, the element's outerHTML is set in DataTransfer object as text/html.
|
|
52
|
-
// We need to clear any HTML drag data to prevent `pasteHandler` from firing
|
|
53
|
-
// inside the `useOnBlockDrop` hook.
|
|
54
|
-
const onDragStartHandler = ( event ) => {
|
|
55
|
-
event.dataTransfer.clearData();
|
|
56
|
-
onDragStart?.( event );
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
function onKeyDownHandler( event ) {
|
|
60
|
-
if ( event.keyCode === ENTER || event.keyCode === SPACE ) {
|
|
61
|
-
onClick( event );
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
const editAriaLabel = blockInformation
|
|
66
|
-
? sprintf(
|
|
67
|
-
// translators: %s: The title of the block.
|
|
68
|
-
__( 'Edit %s block' ),
|
|
69
|
-
blockInformation.title
|
|
70
|
-
)
|
|
71
|
-
: __( 'Edit' );
|
|
72
|
-
|
|
73
|
-
return (
|
|
74
|
-
<>
|
|
75
|
-
<Button
|
|
76
|
-
className={ classnames(
|
|
77
|
-
'block-editor-list-view-block-select-button',
|
|
78
|
-
className
|
|
79
|
-
) }
|
|
80
|
-
onClick={ onClick }
|
|
81
|
-
onKeyDown={ onKeyDownHandler }
|
|
82
|
-
ref={ ref }
|
|
83
|
-
tabIndex={ tabIndex }
|
|
84
|
-
onFocus={ onFocus }
|
|
85
|
-
onDragStart={ onDragStartHandler }
|
|
86
|
-
onDragEnd={ onDragEnd }
|
|
87
|
-
draggable={ draggable }
|
|
88
|
-
href={ `#block-${ clientId }` }
|
|
89
|
-
aria-hidden={ true }
|
|
90
|
-
title={ editAriaLabel }
|
|
91
|
-
>
|
|
92
|
-
<ListViewExpander onClick={ onToggleExpanded } />
|
|
93
|
-
<BlockIcon
|
|
94
|
-
icon={ blockInformation?.icon }
|
|
95
|
-
showColors
|
|
96
|
-
context="list-view"
|
|
97
|
-
/>
|
|
98
|
-
<HStack
|
|
99
|
-
alignment="center"
|
|
100
|
-
className="block-editor-list-view-block-select-button__label-wrapper"
|
|
101
|
-
justify="flex-start"
|
|
102
|
-
spacing={ 1 }
|
|
103
|
-
>
|
|
104
|
-
<span className="block-editor-list-view-block-select-button__title">
|
|
105
|
-
<Truncate ellipsizeMode="auto">{ blockTitle }</Truncate>
|
|
106
|
-
</span>
|
|
107
|
-
{ blockInformation?.anchor && (
|
|
108
|
-
<span className="block-editor-list-view-block-select-button__anchor-wrapper">
|
|
109
|
-
<Truncate
|
|
110
|
-
className="block-editor-list-view-block-select-button__anchor"
|
|
111
|
-
ellipsizeMode="auto"
|
|
112
|
-
>
|
|
113
|
-
{ blockInformation.anchor }
|
|
114
|
-
</Truncate>
|
|
115
|
-
</span>
|
|
116
|
-
) }
|
|
117
|
-
{ isLocked && (
|
|
118
|
-
<span className="block-editor-list-view-block-select-button__lock">
|
|
119
|
-
<Icon icon={ lock } />
|
|
120
|
-
</span>
|
|
121
|
-
) }
|
|
122
|
-
</HStack>
|
|
123
|
-
</Button>
|
|
124
|
-
</>
|
|
125
|
-
);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
export default forwardRef( ListViewBlockSelectButton );
|
|
@@ -1,347 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import classnames from 'classnames';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* WordPress dependencies
|
|
8
|
-
*/
|
|
9
|
-
import { hasBlockSupport } from '@wordpress/blocks';
|
|
10
|
-
import {
|
|
11
|
-
__experimentalTreeGridCell as TreeGridCell,
|
|
12
|
-
__experimentalTreeGridItem as TreeGridItem,
|
|
13
|
-
} from '@wordpress/components';
|
|
14
|
-
import { useInstanceId } from '@wordpress/compose';
|
|
15
|
-
import { moreVertical } from '@wordpress/icons';
|
|
16
|
-
import {
|
|
17
|
-
useState,
|
|
18
|
-
useRef,
|
|
19
|
-
useEffect,
|
|
20
|
-
useCallback,
|
|
21
|
-
memo,
|
|
22
|
-
} from '@wordpress/element';
|
|
23
|
-
import { useDispatch, useSelect } from '@wordpress/data';
|
|
24
|
-
import { sprintf, __ } from '@wordpress/i18n';
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Internal dependencies
|
|
28
|
-
*/
|
|
29
|
-
import ListViewLeaf from './leaf';
|
|
30
|
-
import {
|
|
31
|
-
BlockMoverUpButton,
|
|
32
|
-
BlockMoverDownButton,
|
|
33
|
-
} from '../block-mover/button';
|
|
34
|
-
import ListViewBlockContents from './block-contents';
|
|
35
|
-
import BlockSettingsDropdown from '../block-settings-menu/block-settings-dropdown';
|
|
36
|
-
import { useListViewContext } from './context';
|
|
37
|
-
import { getBlockPositionDescription } from './utils';
|
|
38
|
-
import { store as blockEditorStore } from '../../store';
|
|
39
|
-
import useBlockDisplayInformation from '../use-block-display-information';
|
|
40
|
-
import { useBlockLock } from '../block-lock';
|
|
41
|
-
|
|
42
|
-
function ListViewBlock( {
|
|
43
|
-
block: { clientId },
|
|
44
|
-
isDragged,
|
|
45
|
-
isSelected,
|
|
46
|
-
isBranchSelected,
|
|
47
|
-
selectBlock,
|
|
48
|
-
position,
|
|
49
|
-
level,
|
|
50
|
-
rowCount,
|
|
51
|
-
siblingBlockCount,
|
|
52
|
-
showBlockMovers,
|
|
53
|
-
path,
|
|
54
|
-
isExpanded,
|
|
55
|
-
selectedClientIds,
|
|
56
|
-
preventAnnouncement,
|
|
57
|
-
} ) {
|
|
58
|
-
const cellRef = useRef( null );
|
|
59
|
-
const [ isHovered, setIsHovered ] = useState( false );
|
|
60
|
-
|
|
61
|
-
const { isLocked, isContentLocked } = useBlockLock( clientId );
|
|
62
|
-
const forceSelectionContentLock = useSelect(
|
|
63
|
-
( select ) => {
|
|
64
|
-
if ( isSelected ) {
|
|
65
|
-
return false;
|
|
66
|
-
}
|
|
67
|
-
if ( ! isContentLocked ) {
|
|
68
|
-
return false;
|
|
69
|
-
}
|
|
70
|
-
return select( blockEditorStore ).hasSelectedInnerBlock(
|
|
71
|
-
clientId,
|
|
72
|
-
true
|
|
73
|
-
);
|
|
74
|
-
},
|
|
75
|
-
[ isContentLocked, clientId, isSelected ]
|
|
76
|
-
);
|
|
77
|
-
|
|
78
|
-
const isFirstSelectedBlock =
|
|
79
|
-
forceSelectionContentLock ||
|
|
80
|
-
( isSelected && selectedClientIds[ 0 ] === clientId );
|
|
81
|
-
const isLastSelectedBlock =
|
|
82
|
-
forceSelectionContentLock ||
|
|
83
|
-
( isSelected &&
|
|
84
|
-
selectedClientIds[ selectedClientIds.length - 1 ] === clientId );
|
|
85
|
-
|
|
86
|
-
const { toggleBlockHighlight } = useDispatch( blockEditorStore );
|
|
87
|
-
|
|
88
|
-
const blockInformation = useBlockDisplayInformation( clientId );
|
|
89
|
-
const block = useSelect(
|
|
90
|
-
( select ) => select( blockEditorStore ).getBlock( clientId ),
|
|
91
|
-
[ clientId ]
|
|
92
|
-
);
|
|
93
|
-
|
|
94
|
-
// If ListView has experimental features related to the Persistent List View,
|
|
95
|
-
// only focus the selected list item on mount; otherwise the list would always
|
|
96
|
-
// try to steal the focus from the editor canvas.
|
|
97
|
-
useEffect( () => {
|
|
98
|
-
if ( ! isTreeGridMounted && isSelected ) {
|
|
99
|
-
cellRef.current.focus();
|
|
100
|
-
}
|
|
101
|
-
}, [] );
|
|
102
|
-
|
|
103
|
-
const onMouseEnter = useCallback( () => {
|
|
104
|
-
setIsHovered( true );
|
|
105
|
-
toggleBlockHighlight( clientId, true );
|
|
106
|
-
}, [ clientId, setIsHovered, toggleBlockHighlight ] );
|
|
107
|
-
const onMouseLeave = useCallback( () => {
|
|
108
|
-
setIsHovered( false );
|
|
109
|
-
toggleBlockHighlight( clientId, false );
|
|
110
|
-
}, [ clientId, setIsHovered, toggleBlockHighlight ] );
|
|
111
|
-
|
|
112
|
-
const selectEditorBlock = useCallback(
|
|
113
|
-
( event ) => {
|
|
114
|
-
selectBlock( event, clientId );
|
|
115
|
-
event.preventDefault();
|
|
116
|
-
},
|
|
117
|
-
[ clientId, selectBlock ]
|
|
118
|
-
);
|
|
119
|
-
|
|
120
|
-
const updateSelection = useCallback(
|
|
121
|
-
( newClientId ) => {
|
|
122
|
-
selectBlock( undefined, newClientId );
|
|
123
|
-
},
|
|
124
|
-
[ selectBlock ]
|
|
125
|
-
);
|
|
126
|
-
|
|
127
|
-
const { isTreeGridMounted, expand, collapse, LeafMoreMenu } =
|
|
128
|
-
useListViewContext();
|
|
129
|
-
|
|
130
|
-
const toggleExpanded = useCallback(
|
|
131
|
-
( event ) => {
|
|
132
|
-
// Prevent shift+click from opening link in a new window when toggling.
|
|
133
|
-
event.preventDefault();
|
|
134
|
-
event.stopPropagation();
|
|
135
|
-
if ( isExpanded === true ) {
|
|
136
|
-
collapse( clientId );
|
|
137
|
-
} else if ( isExpanded === false ) {
|
|
138
|
-
expand( clientId );
|
|
139
|
-
}
|
|
140
|
-
},
|
|
141
|
-
[ clientId, expand, collapse, isExpanded ]
|
|
142
|
-
);
|
|
143
|
-
|
|
144
|
-
const instanceId = useInstanceId( ListViewBlock );
|
|
145
|
-
|
|
146
|
-
if ( ! block ) {
|
|
147
|
-
return null;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
// When a block hides its toolbar it also hides the block settings menu,
|
|
151
|
-
// since that menu is part of the toolbar in the editor canvas.
|
|
152
|
-
// List View respects this by also hiding the block settings menu.
|
|
153
|
-
const showBlockActions =
|
|
154
|
-
!! block &&
|
|
155
|
-
hasBlockSupport( block.name, '__experimentalToolbar', true );
|
|
156
|
-
|
|
157
|
-
const descriptionId = `list-view-block-select-button__${ instanceId }`;
|
|
158
|
-
const blockPositionDescription = getBlockPositionDescription(
|
|
159
|
-
position,
|
|
160
|
-
siblingBlockCount,
|
|
161
|
-
level
|
|
162
|
-
);
|
|
163
|
-
|
|
164
|
-
let blockAriaLabel = __( 'Link' );
|
|
165
|
-
if ( blockInformation ) {
|
|
166
|
-
blockAriaLabel = isLocked
|
|
167
|
-
? sprintf(
|
|
168
|
-
// translators: %s: The title of the block. This string indicates a link to select the locked block.
|
|
169
|
-
__( '%s link (locked)' ),
|
|
170
|
-
blockInformation.title
|
|
171
|
-
)
|
|
172
|
-
: sprintf(
|
|
173
|
-
// translators: %s: The title of the block. This string indicates a link to select the block.
|
|
174
|
-
__( '%s link' ),
|
|
175
|
-
blockInformation.title
|
|
176
|
-
);
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
const settingsAriaLabel = blockInformation
|
|
180
|
-
? sprintf(
|
|
181
|
-
// translators: %s: The title of the block.
|
|
182
|
-
__( 'Options for %s block' ),
|
|
183
|
-
blockInformation.title
|
|
184
|
-
)
|
|
185
|
-
: __( 'Options' );
|
|
186
|
-
|
|
187
|
-
const hasSiblings = siblingBlockCount > 0;
|
|
188
|
-
const hasRenderedMovers = showBlockMovers && hasSiblings;
|
|
189
|
-
const moverCellClassName = classnames(
|
|
190
|
-
'block-editor-list-view-block__mover-cell',
|
|
191
|
-
{ 'is-visible': isHovered || isSelected }
|
|
192
|
-
);
|
|
193
|
-
|
|
194
|
-
const listViewBlockSettingsClassName = classnames(
|
|
195
|
-
'block-editor-list-view-block__menu-cell',
|
|
196
|
-
{ 'is-visible': isHovered || isFirstSelectedBlock }
|
|
197
|
-
);
|
|
198
|
-
|
|
199
|
-
let colSpan;
|
|
200
|
-
if ( hasRenderedMovers ) {
|
|
201
|
-
colSpan = 1;
|
|
202
|
-
} else if ( ! showBlockActions ) {
|
|
203
|
-
colSpan = 2;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
const classes = classnames( {
|
|
207
|
-
'is-selected': isSelected || forceSelectionContentLock,
|
|
208
|
-
'is-first-selected': isFirstSelectedBlock,
|
|
209
|
-
'is-last-selected': isLastSelectedBlock,
|
|
210
|
-
'is-branch-selected': isBranchSelected,
|
|
211
|
-
'is-dragging': isDragged,
|
|
212
|
-
'has-single-cell': ! showBlockActions,
|
|
213
|
-
} );
|
|
214
|
-
|
|
215
|
-
// Only include all selected blocks if the currently clicked on block
|
|
216
|
-
// is one of the selected blocks. This ensures that if a user attempts
|
|
217
|
-
// to alter a block that isn't part of the selection, they're still able
|
|
218
|
-
// to do so.
|
|
219
|
-
const dropdownClientIds = selectedClientIds.includes( clientId )
|
|
220
|
-
? selectedClientIds
|
|
221
|
-
: [ clientId ];
|
|
222
|
-
|
|
223
|
-
const MoreMenuComponent = LeafMoreMenu
|
|
224
|
-
? LeafMoreMenu
|
|
225
|
-
: BlockSettingsDropdown;
|
|
226
|
-
|
|
227
|
-
return (
|
|
228
|
-
<ListViewLeaf
|
|
229
|
-
className={ classes }
|
|
230
|
-
onMouseEnter={ onMouseEnter }
|
|
231
|
-
onMouseLeave={ onMouseLeave }
|
|
232
|
-
onFocus={ onMouseEnter }
|
|
233
|
-
onBlur={ onMouseLeave }
|
|
234
|
-
level={ level }
|
|
235
|
-
position={ position }
|
|
236
|
-
rowCount={ rowCount }
|
|
237
|
-
path={ path }
|
|
238
|
-
id={ `list-view-block-${ clientId }` }
|
|
239
|
-
data-block={ clientId }
|
|
240
|
-
isExpanded={ isContentLocked ? undefined : isExpanded }
|
|
241
|
-
aria-selected={ !! isSelected || forceSelectionContentLock }
|
|
242
|
-
>
|
|
243
|
-
<TreeGridCell
|
|
244
|
-
className="block-editor-list-view-block__contents-cell"
|
|
245
|
-
colSpan={ colSpan }
|
|
246
|
-
ref={ cellRef }
|
|
247
|
-
aria-label={ blockAriaLabel }
|
|
248
|
-
aria-selected={ !! isSelected || forceSelectionContentLock }
|
|
249
|
-
aria-expanded={ isContentLocked ? undefined : isExpanded }
|
|
250
|
-
aria-describedby={ descriptionId }
|
|
251
|
-
>
|
|
252
|
-
{ ( { ref, tabIndex, onFocus } ) => (
|
|
253
|
-
<div className="block-editor-list-view-block__contents-container">
|
|
254
|
-
<ListViewBlockContents
|
|
255
|
-
block={ block }
|
|
256
|
-
onClick={ selectEditorBlock }
|
|
257
|
-
onToggleExpanded={ toggleExpanded }
|
|
258
|
-
isSelected={ isSelected }
|
|
259
|
-
position={ position }
|
|
260
|
-
siblingBlockCount={ siblingBlockCount }
|
|
261
|
-
level={ level }
|
|
262
|
-
ref={ ref }
|
|
263
|
-
tabIndex={ tabIndex }
|
|
264
|
-
onFocus={ onFocus }
|
|
265
|
-
isExpanded={ isExpanded }
|
|
266
|
-
selectedClientIds={ selectedClientIds }
|
|
267
|
-
preventAnnouncement={ preventAnnouncement }
|
|
268
|
-
/>
|
|
269
|
-
<div
|
|
270
|
-
className="block-editor-list-view-block-select-button__description"
|
|
271
|
-
id={ descriptionId }
|
|
272
|
-
>
|
|
273
|
-
{ blockPositionDescription }
|
|
274
|
-
</div>
|
|
275
|
-
</div>
|
|
276
|
-
) }
|
|
277
|
-
</TreeGridCell>
|
|
278
|
-
{ hasRenderedMovers && (
|
|
279
|
-
<>
|
|
280
|
-
<TreeGridCell
|
|
281
|
-
className={ moverCellClassName }
|
|
282
|
-
withoutGridItem
|
|
283
|
-
>
|
|
284
|
-
<TreeGridItem>
|
|
285
|
-
{ ( { ref, tabIndex, onFocus } ) => (
|
|
286
|
-
<BlockMoverUpButton
|
|
287
|
-
orientation="vertical"
|
|
288
|
-
clientIds={ [ clientId ] }
|
|
289
|
-
ref={ ref }
|
|
290
|
-
tabIndex={ tabIndex }
|
|
291
|
-
onFocus={ onFocus }
|
|
292
|
-
/>
|
|
293
|
-
) }
|
|
294
|
-
</TreeGridItem>
|
|
295
|
-
<TreeGridItem>
|
|
296
|
-
{ ( { ref, tabIndex, onFocus } ) => (
|
|
297
|
-
<BlockMoverDownButton
|
|
298
|
-
orientation="vertical"
|
|
299
|
-
clientIds={ [ clientId ] }
|
|
300
|
-
ref={ ref }
|
|
301
|
-
tabIndex={ tabIndex }
|
|
302
|
-
onFocus={ onFocus }
|
|
303
|
-
/>
|
|
304
|
-
) }
|
|
305
|
-
</TreeGridItem>
|
|
306
|
-
</TreeGridCell>
|
|
307
|
-
</>
|
|
308
|
-
) }
|
|
309
|
-
|
|
310
|
-
{ showBlockActions && (
|
|
311
|
-
<>
|
|
312
|
-
<TreeGridCell
|
|
313
|
-
className={ listViewBlockSettingsClassName }
|
|
314
|
-
aria-selected={
|
|
315
|
-
!! isSelected || forceSelectionContentLock
|
|
316
|
-
}
|
|
317
|
-
>
|
|
318
|
-
{ ( { ref, tabIndex, onFocus } ) => (
|
|
319
|
-
<>
|
|
320
|
-
<MoreMenuComponent
|
|
321
|
-
clientIds={ dropdownClientIds }
|
|
322
|
-
block={ block }
|
|
323
|
-
clientId={ clientId }
|
|
324
|
-
icon={ moreVertical }
|
|
325
|
-
label={ settingsAriaLabel }
|
|
326
|
-
toggleProps={ {
|
|
327
|
-
ref,
|
|
328
|
-
className:
|
|
329
|
-
'block-editor-list-view-block__menu',
|
|
330
|
-
tabIndex,
|
|
331
|
-
onFocus,
|
|
332
|
-
} }
|
|
333
|
-
disableOpenOnArrowDown
|
|
334
|
-
__experimentalSelectBlock={
|
|
335
|
-
updateSelection
|
|
336
|
-
}
|
|
337
|
-
/>
|
|
338
|
-
</>
|
|
339
|
-
) }
|
|
340
|
-
</TreeGridCell>
|
|
341
|
-
</>
|
|
342
|
-
) }
|
|
343
|
-
</ListViewLeaf>
|
|
344
|
-
);
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
export default memo( ListViewBlock );
|