@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
|
@@ -143,7 +143,6 @@ function BlockListBlock(_ref2) {
|
|
|
143
143
|
blockType,
|
|
144
144
|
draggingClientId,
|
|
145
145
|
draggingEnabled,
|
|
146
|
-
firstToSelectId,
|
|
147
146
|
isDescendantOfParentSelected,
|
|
148
147
|
isDescendentBlockSelected,
|
|
149
148
|
isParentSelected,
|
|
@@ -156,7 +155,6 @@ function BlockListBlock(_ref2) {
|
|
|
156
155
|
getBlockHierarchyRootClientId,
|
|
157
156
|
getBlockIndex,
|
|
158
157
|
getBlockParents,
|
|
159
|
-
getLowestCommonAncestorWithSelectedBlock,
|
|
160
158
|
getSelectedBlockClientId,
|
|
161
159
|
getSettings,
|
|
162
160
|
hasSelectedInnerBlock
|
|
@@ -170,10 +168,7 @@ function BlockListBlock(_ref2) {
|
|
|
170
168
|
(selectedBlockClientId || false) && selectedBlockClientId === rootClientId;
|
|
171
169
|
const selectedParents = clientId ? parents : [];
|
|
172
170
|
const descendantOfParentSelected = selectedParents.includes(rootClientId);
|
|
173
|
-
const hasInnerBlocks = getBlockCount(clientId) > 0;
|
|
174
|
-
const commonAncestor = getLowestCommonAncestorWithSelectedBlock(clientId);
|
|
175
|
-
const commonAncestorIndex = parents.indexOf(commonAncestor) - 1;
|
|
176
|
-
const firstBlockToSelectId = commonAncestor ? parents[commonAncestorIndex] : parents[parents.length - 1]; // For blocks with inner blocks, we only enable the dragging in the nested
|
|
171
|
+
const hasInnerBlocks = getBlockCount(clientId) > 0; // For blocks with inner blocks, we only enable the dragging in the nested
|
|
177
172
|
// blocks if any of them are selected. This way we prevent the long-press
|
|
178
173
|
// gesture from being disabled for elements within the block UI.
|
|
179
174
|
|
|
@@ -187,7 +182,6 @@ function BlockListBlock(_ref2) {
|
|
|
187
182
|
blockType: currentBlockType,
|
|
188
183
|
draggingClientId: currentDraggingClientId,
|
|
189
184
|
draggingEnabled: isDraggingEnabled,
|
|
190
|
-
firstToSelectId: firstBlockToSelectId,
|
|
191
185
|
isDescendantOfParentSelected: descendantOfParentSelected,
|
|
192
186
|
isDescendentBlockSelected: descendentBlockSelected,
|
|
193
187
|
isParentSelected: parentSelected,
|
|
@@ -206,12 +200,10 @@ function BlockListBlock(_ref2) {
|
|
|
206
200
|
const fontSizes = useSetting('typography.fontSizes') || emptyArray;
|
|
207
201
|
const onRemove = useCallback(() => removeBlock(clientId), [clientId, removeBlock]);
|
|
208
202
|
const onFocus = useCallback(() => {
|
|
209
|
-
const blockId = firstToSelectId !== null && firstToSelectId !== void 0 ? firstToSelectId : clientId;
|
|
210
|
-
|
|
211
203
|
if (!isSelected) {
|
|
212
|
-
selectBlock(
|
|
204
|
+
selectBlock(clientId);
|
|
213
205
|
}
|
|
214
|
-
}, [selectBlock, clientId,
|
|
206
|
+
}, [selectBlock, clientId, isSelected]);
|
|
215
207
|
const onLayout = useCallback(_ref3 => {
|
|
216
208
|
let {
|
|
217
209
|
nativeEvent
|
|
@@ -426,22 +418,22 @@ const applyWithDispatch = withDispatch((dispatch, ownProps, registry) => {
|
|
|
426
418
|
if (blockOrder.length === 1 && isUnmodifiedBlock(getBlock(firstClientId))) {
|
|
427
419
|
removeBlock(_clientId);
|
|
428
420
|
} else {
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
421
|
+
registry.batch(() => {
|
|
422
|
+
if (canInsertBlockType(getBlockName(firstClientId), targetRootClientId)) {
|
|
423
|
+
moveBlocksToPosition([firstClientId], _clientId, targetRootClientId, getBlockIndex(_clientId));
|
|
424
|
+
} else {
|
|
425
|
+
const replacement = switchToBlockType(getBlock(firstClientId), getDefaultBlockName());
|
|
433
426
|
|
|
434
|
-
|
|
435
|
-
registry.batch(() => {
|
|
427
|
+
if (replacement && replacement.length) {
|
|
436
428
|
insertBlocks(replacement, getBlockIndex(_clientId), targetRootClientId, changeSelection);
|
|
437
429
|
removeBlock(firstClientId, false);
|
|
438
|
-
}
|
|
430
|
+
}
|
|
439
431
|
}
|
|
440
|
-
}
|
|
441
432
|
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
433
|
+
if (!getBlockOrder(_clientId).length && isUnmodifiedBlock(getBlock(_clientId))) {
|
|
434
|
+
removeBlock(_clientId, false);
|
|
435
|
+
}
|
|
436
|
+
});
|
|
445
437
|
}
|
|
446
438
|
} // For `Delete` or forward merge, we should do the exact same thing
|
|
447
439
|
// as `Backspace`, but from the other block.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/block-list/block.native.js"],"names":["Pressable","useWindowDimensions","View","useCallback","useMemo","useRef","useState","GlobalStylesContext","getMergedGlobalStyles","useMobileGlobalStylesColors","alignmentHelpers","useGlobalStyles","__experimentalGetAccessibleBlockLabel","getAccessibleBlockLabel","getBlockType","getDefaultBlockName","isUnmodifiedBlock","isUnmodifiedDefaultBlock","switchToBlockType","useDispatch","useSelect","withDispatch","withSelect","compose","ifCondition","pure","BlockEdit","BlockDraggable","BlockInvalidWarning","BlockMobileToolbar","BlockOutline","styles","store","blockEditorStore","useLayout","useSetting","emptyArray","wrapperPropsCache","WeakMap","emptyObj","getWrapperProps","value","getWrapperPropsFunction","cachedValue","get","wrapperProps","set","BlockWrapper","accessibilityLabel","align","blockWidth","children","clientId","draggingClientId","draggingEnabled","isDescendentBlockSelected","isParentSelected","isSelected","isStackedHorizontally","isTouchable","marginHorizontal","marginVertical","onDeleteBlock","onFocus","width","screenWidth","anchorNodeRef","isFullWidth","isScreenWidthEqual","isFullWidthToolbar","blockWrapperStyles","flex","blockWrapperStyle","accessible","neutralToolbar","current","BlockListBlock","attributes","blockWrapperWidth","canRemove","contentStyle","isLocked","isSelectionEnabled","isValid","name","onInsertBlocksAfter","onMerge","onReplace","parentBlockAlignment","parentWidth","rootClientId","setAttributes","toggleSelection","baseGlobalStyles","blockType","firstToSelectId","isDescendantOfParentSelected","order","select","getBlockCount","getBlockHierarchyRootClientId","getBlockIndex","getBlockParents","getLowestCommonAncestorWithSelectedBlock","getSelectedBlockClientId","getSettings","hasSelectedInnerBlock","currentBlockType","blockOrder","descendentBlockSelected","selectedBlockClientId","parents","parentSelected","selectedParents","descendantOfParentSelected","includes","hasInnerBlocks","commonAncestor","commonAncestorIndex","indexOf","firstBlockToSelectId","length","isDraggingEnabled","currentDraggingClientId","globalStylesBaseStyles","__experimentalGlobalStylesBaseStyles","removeBlock","selectBlock","initialBlockWidth","setBlockWidth","parentLayout","defaultColors","globalStyle","fontSizes","onRemove","blockId","onLayout","nativeEvent","layoutWidth","Math","floor","layout","getEditWrapperProps","mergedStyle","style","JSON","stringify","Object","fromEntries","entries","filter","key","BLOCK_STYLE_ATTRIBUTES","isFocused","undefined","keys","applyWithSelect","isBlockSelected","getBlockMode","getTemplateLock","__unstableGetBlockWithoutInnerBlocks","canRemoveBlock","canMoveBlock","block","templateLock","canMove","mode","applyWithDispatch","dispatch","ownProps","registry","updateBlockAttributes","insertBlocks","mergeBlocks","replaceBlocks","__unstableMarkLastChangeAsPersistent","moveBlocksToPosition","newAttributes","getMultiSelectedBlockClientIds","multiSelectedBlockClientIds","clientIds","onInsertBlocks","blocks","index","forward","getPreviousBlockClientId","getNextBlockClientId","getBlock","getBlockAttributes","getBlockName","getBlockOrder","getBlockRootClientId","canInsertBlockType","moveFirstItemUp","_clientId","changeSelection","targetRootClientId","firstClientId","replacement","batch","nextRootClientId","rootAttributes","previousRootAttributes","every","nextBlockClientId","previousBlockClientId","previousRootClientId","indexToSelect","initialPosition","selectionEnabled"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,EAAoBC,mBAApB,EAAyCC,IAAzC,QAAqD,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GAAgB,CAAlB,CAAR,CAF3B,EAGE;AACDsD,QAAAA,oCAAoC;AACpC;;AACDD,MAAAA,aAAa,CACZ,CAAEL,QAAQ,CAACrH,QAAX,CADY,EAEZkI,MAFY,EAGZyB,aAHY,EAIZC,eAJY,CAAb;AAMA,KAlNK;;AAmNNpH,IAAAA,eAAe,CAAEqH,gBAAF,EAAqB;AACnCrH,MAAAA,eAAe,CAAEqH,gBAAF,CAAf;AACA;;AArNK,GAAP;AAuNA,CArOqC,CAAtC;AAuOA,eAAe1L,OAAO,CACrBE,IADqB,EAErBmI,eAFqB,EAGrBW,iBAHqB,EAIrB;AACA;AACA;AACA/I,WAAW,CAAE;AAAA,MAAE;AAAE2I,IAAAA;AAAF,GAAF;AAAA,SAAiB,CAAC,CAAEA,KAApB;AAAA,CAAF,CAPU,CAAP,CAQZvF,cARY,CAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { Pressable, useWindowDimensions, View } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { useCallback, useMemo, useRef, useState } from '@wordpress/element';\nimport {\n\tGlobalStylesContext,\n\tgetMergedGlobalStyles,\n\tuseMobileGlobalStylesColors,\n\talignmentHelpers,\n\tuseGlobalStyles,\n} from '@wordpress/components';\nimport {\n\t__experimentalGetAccessibleBlockLabel as getAccessibleBlockLabel,\n\tgetBlockType,\n\tgetDefaultBlockName,\n\tisUnmodifiedBlock,\n\tisUnmodifiedDefaultBlock,\n\tswitchToBlockType,\n} from '@wordpress/blocks';\nimport {\n\tuseDispatch,\n\tuseSelect,\n\twithDispatch,\n\twithSelect,\n} from '@wordpress/data';\nimport { compose, ifCondition, pure } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport BlockEdit from '../block-edit';\nimport BlockDraggable from '../block-draggable';\nimport BlockInvalidWarning from './block-invalid-warning';\nimport BlockMobileToolbar from '../block-mobile-toolbar';\nimport BlockOutline from './block-outline';\nimport styles from './block.scss';\nimport { store as blockEditorStore } from '../../store';\nimport { useLayout } from './layout';\nimport useSetting from '../use-setting';\n\nconst emptyArray = [];\n\n// Helper function to memoize the wrapperProps since getEditWrapperProps always returns a new reference.\nconst wrapperPropsCache = new WeakMap();\nconst emptyObj = {};\nfunction getWrapperProps( value, getWrapperPropsFunction ) {\n\tif ( ! getWrapperPropsFunction ) {\n\t\treturn emptyObj;\n\t}\n\tconst cachedValue = wrapperPropsCache.get( value );\n\tif ( ! cachedValue ) {\n\t\tconst wrapperProps = getWrapperPropsFunction( value );\n\t\twrapperPropsCache.set( value, wrapperProps );\n\t\treturn wrapperProps;\n\t}\n\treturn cachedValue;\n}\n\nfunction BlockWrapper( {\n\taccessibilityLabel,\n\talign,\n\tblockWidth,\n\tchildren,\n\tclientId,\n\tdraggingClientId,\n\tdraggingEnabled,\n\tisDescendentBlockSelected,\n\tisParentSelected,\n\tisSelected,\n\tisStackedHorizontally,\n\tisTouchable,\n\tmarginHorizontal,\n\tmarginVertical,\n\tonDeleteBlock,\n\tonFocus,\n} ) {\n\tconst { width: screenWidth } = useWindowDimensions();\n\tconst anchorNodeRef = useRef();\n\tconst { isFullWidth } = alignmentHelpers;\n\tconst isScreenWidthEqual = blockWidth === screenWidth;\n\tconst isFullWidthToolbar = isFullWidth( align ) || isScreenWidthEqual;\n\tconst blockWrapperStyles = { flex: 1 };\n\tconst blockWrapperStyle = [\n\t\tblockWrapperStyles,\n\t\t{\n\t\t\tmarginVertical,\n\t\t\tmarginHorizontal,\n\t\t},\n\t];\n\tconst accessible = ! ( isSelected || isDescendentBlockSelected );\n\n\treturn (\n\t\t<Pressable\n\t\t\taccessibilityLabel={ accessibilityLabel }\n\t\t\taccessibilityRole=\"button\"\n\t\t\taccessible={ accessible }\n\t\t\tdisabled={ ! isTouchable }\n\t\t\tonPress={ onFocus }\n\t\t\tstyle={ blockWrapperStyle }\n\t\t>\n\t\t\t<BlockOutline\n\t\t\t\tisSelected={ isSelected }\n\t\t\t\tisParentSelected={ isParentSelected }\n\t\t\t\tscreenWidth={ screenWidth }\n\t\t\t/>\n\t\t\t<BlockDraggable\n\t\t\t\tclientId={ clientId }\n\t\t\t\tdraggingClientId={ draggingClientId }\n\t\t\t\tenabled={ draggingEnabled }\n\t\t\t\ttestID=\"draggable-trigger-content\"\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</BlockDraggable>\n\t\t\t<View style={ styles.neutralToolbar } ref={ anchorNodeRef }>\n\t\t\t\t{ isSelected && (\n\t\t\t\t\t<BlockMobileToolbar\n\t\t\t\t\t\tanchorNodeRef={ anchorNodeRef.current }\n\t\t\t\t\t\tblockWidth={ blockWidth }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\tdraggingClientId={ draggingClientId }\n\t\t\t\t\t\tisFullWidth={ isFullWidthToolbar }\n\t\t\t\t\t\tisStackedHorizontally={ isStackedHorizontally }\n\t\t\t\t\t\tonDelete={ onDeleteBlock }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</View>\n\t\t</Pressable>\n\t);\n}\n\nfunction BlockListBlock( {\n\tattributes,\n\tblockWidth: blockWrapperWidth,\n\tcanRemove,\n\tclientId,\n\tcontentStyle,\n\tisLocked,\n\tisSelected,\n\tisSelectionEnabled,\n\tisStackedHorizontally,\n\tisValid,\n\tmarginHorizontal,\n\tmarginVertical,\n\tname,\n\tonDeleteBlock,\n\tonInsertBlocksAfter,\n\tonMerge,\n\tonReplace,\n\tparentBlockAlignment,\n\tparentWidth,\n\trootClientId,\n\tsetAttributes,\n\ttoggleSelection,\n} ) {\n\tconst {\n\t\tbaseGlobalStyles,\n\t\tblockType,\n\t\tdraggingClientId,\n\t\tdraggingEnabled,\n\t\tfirstToSelectId,\n\t\tisDescendantOfParentSelected,\n\t\tisDescendentBlockSelected,\n\t\tisParentSelected,\n\t\torder,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockCount,\n\t\t\t\tgetBlockHierarchyRootClientId,\n\t\t\t\tgetBlockIndex,\n\t\t\t\tgetBlockParents,\n\t\t\t\tgetLowestCommonAncestorWithSelectedBlock,\n\t\t\t\tgetSelectedBlockClientId,\n\t\t\t\tgetSettings,\n\t\t\t\thasSelectedInnerBlock,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst currentBlockType = getBlockType( name || 'core/missing' );\n\t\t\tconst blockOrder = getBlockIndex( clientId );\n\t\t\tconst descendentBlockSelected = hasSelectedInnerBlock(\n\t\t\t\tclientId,\n\t\t\t\ttrue\n\t\t\t);\n\t\t\tconst selectedBlockClientId = getSelectedBlockClientId();\n\n\t\t\tconst parents = getBlockParents( clientId, true );\n\t\t\tconst parentSelected =\n\t\t\t\t// Set false as a default value to prevent re-render when it's changed from null to false.\n\t\t\t\t( selectedBlockClientId || false ) &&\n\t\t\t\tselectedBlockClientId === rootClientId;\n\n\t\t\tconst selectedParents = clientId ? parents : [];\n\t\t\tconst descendantOfParentSelected =\n\t\t\t\tselectedParents.includes( rootClientId );\n\t\t\tconst hasInnerBlocks = getBlockCount( clientId ) > 0;\n\n\t\t\tconst commonAncestor =\n\t\t\t\tgetLowestCommonAncestorWithSelectedBlock( clientId );\n\t\t\tconst commonAncestorIndex = parents.indexOf( commonAncestor ) - 1;\n\t\t\tconst firstBlockToSelectId = commonAncestor\n\t\t\t\t? parents[ commonAncestorIndex ]\n\t\t\t\t: parents[ parents.length - 1 ];\n\n\t\t\t// For blocks with inner blocks, we only enable the dragging in the nested\n\t\t\t// blocks if any of them are selected. This way we prevent the long-press\n\t\t\t// gesture from being disabled for elements within the block UI.\n\t\t\tconst isDraggingEnabled =\n\t\t\t\t! hasInnerBlocks || isSelected || ! descendentBlockSelected;\n\t\t\t// Dragging nested blocks is not supported yet. For this reason, the block to be dragged\n\t\t\t// will be the top in the hierarchy.\n\t\t\tconst currentDraggingClientId =\n\t\t\t\tgetBlockHierarchyRootClientId( clientId );\n\n\t\t\tconst globalStylesBaseStyles =\n\t\t\t\tgetSettings()?.__experimentalGlobalStylesBaseStyles;\n\n\t\t\treturn {\n\t\t\t\tbaseGlobalStyles: globalStylesBaseStyles,\n\t\t\t\tblockType: currentBlockType,\n\t\t\t\tdraggingClientId: currentDraggingClientId,\n\t\t\t\tdraggingEnabled: isDraggingEnabled,\n\t\t\t\tfirstToSelectId: firstBlockToSelectId,\n\t\t\t\tisDescendantOfParentSelected: descendantOfParentSelected,\n\t\t\t\tisDescendentBlockSelected: descendentBlockSelected,\n\t\t\t\tisParentSelected: parentSelected,\n\t\t\t\torder: blockOrder,\n\t\t\t};\n\t\t},\n\t\t[ clientId, isSelected, name, rootClientId ]\n\t);\n\tconst { removeBlock, selectBlock } = useDispatch( blockEditorStore );\n\tconst initialBlockWidth = blockWrapperWidth - 2 * marginHorizontal;\n\tconst [ blockWidth, setBlockWidth ] = useState( initialBlockWidth );\n\tconst parentLayout = useLayout() || {};\n\tconst defaultColors = useMobileGlobalStylesColors();\n\tconst globalStyle = useGlobalStyles();\n\tconst fontSizes = useSetting( 'typography.fontSizes' ) || emptyArray;\n\n\tconst onRemove = useCallback(\n\t\t() => removeBlock( clientId ),\n\t\t[ clientId, removeBlock ]\n\t);\n\tconst onFocus = useCallback( () => {\n\t\tconst blockId = firstToSelectId ?? clientId;\n\t\tif ( ! isSelected ) {\n\t\t\tselectBlock( blockId );\n\t\t}\n\t}, [ selectBlock, clientId, firstToSelectId, isSelected ] );\n\n\tconst onLayout = useCallback(\n\t\t( { nativeEvent } ) => {\n\t\t\tconst layoutWidth = Math.floor( nativeEvent.layout.width );\n\n\t\t\tif ( ! blockWidth || ! layoutWidth ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( blockWidth !== layoutWidth ) {\n\t\t\t\tsetBlockWidth( layoutWidth );\n\t\t\t}\n\t\t},\n\t\t[ blockWidth, setBlockWidth ]\n\t);\n\n\t// Block level styles.\n\tconst wrapperProps = getWrapperProps(\n\t\tattributes,\n\t\tblockType.getEditWrapperProps\n\t);\n\n\t// Inherited styles merged with block level styles.\n\tconst mergedStyle = useMemo( () => {\n\t\treturn getMergedGlobalStyles(\n\t\t\tbaseGlobalStyles,\n\t\t\tglobalStyle,\n\t\t\twrapperProps.style,\n\t\t\tattributes,\n\t\t\tdefaultColors,\n\t\t\tname,\n\t\t\tfontSizes\n\t\t);\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [\n\t\t// It is crucial to keep the dependencies array minimal to prevent unnecessary calls that could negatively impact performance.\n\t\t// JSON.stringify is used for the following purposes:\n\t\t// 1. To create a single, comparable value from the globalStyle, wrapperProps.style, and attributes objects. This allows useMemo to\n\t\t// efficiently determine if a change has occurred in any of these objects.\n\t\t// 2. To filter the attributes object, ensuring that only the relevant attributes (included in\n\t\t// GlobalStylesContext.BLOCK_STYLE_ATTRIBUTES) are considered as dependencies. This reduces the likelihood of\n\t\t// unnecessary useMemo calls when other, unrelated attributes change.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\tJSON.stringify( globalStyle ),\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\tJSON.stringify( wrapperProps.style ),\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\tJSON.stringify(\n\t\t\tObject.fromEntries(\n\t\t\t\tObject.entries( attributes ?? {} ).filter( ( [ key ] ) =>\n\t\t\t\t\tGlobalStylesContext.BLOCK_STYLE_ATTRIBUTES.includes( key )\n\t\t\t\t)\n\t\t\t)\n\t\t),\n\t] );\n\n\tconst { align } = attributes;\n\tconst isFocused = isSelected || isDescendentBlockSelected;\n\tconst isTouchable =\n\t\tisSelected ||\n\t\tisDescendantOfParentSelected ||\n\t\tisParentSelected ||\n\t\t! rootClientId;\n\n\tconst accessibilityLabel = getAccessibleBlockLabel(\n\t\tblockType,\n\t\tattributes,\n\t\torder + 1\n\t);\n\n\treturn (\n\t\t<BlockWrapper\n\t\t\taccessibilityLabel={ accessibilityLabel }\n\t\t\talign={ align }\n\t\t\tblockWidth={ blockWidth }\n\t\t\tclientId={ clientId }\n\t\t\tdraggingClientId={ draggingClientId }\n\t\t\tdraggingEnabled={ draggingEnabled }\n\t\t\tisFocused={ isFocused }\n\t\t\tisDescendentBlockSelected={ isDescendentBlockSelected }\n\t\t\tisParentSelected={ isParentSelected }\n\t\t\tisSelected={ isSelected }\n\t\t\tisStackedHorizontally={ isStackedHorizontally }\n\t\t\tisTouchable={ isTouchable }\n\t\t\tmarginHorizontal={ marginHorizontal }\n\t\t\tmarginVertical={ marginVertical }\n\t\t\tonDeleteBlock={ onDeleteBlock }\n\t\t\tonFocus={ onFocus }\n\t\t>\n\t\t\t{ () =>\n\t\t\t\t! isValid ? (\n\t\t\t\t\t<BlockInvalidWarning clientId={ clientId } />\n\t\t\t\t) : (\n\t\t\t\t\t<GlobalStylesContext.Provider value={ mergedStyle }>\n\t\t\t\t\t\t<BlockEdit\n\t\t\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\t\t\tblockWidth={ blockWidth }\n\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t\tcontentStyle={ contentStyle }\n\t\t\t\t\t\t\tinsertBlocksAfter={\n\t\t\t\t\t\t\t\tisLocked ? undefined : onInsertBlocksAfter\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\t\tisSelectionEnabled={ isSelectionEnabled }\n\t\t\t\t\t\t\tmergeBlocks={ canRemove ? onMerge : undefined }\n\t\t\t\t\t\t\tname={ name }\n\t\t\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\t\t\tonRemove={ canRemove ? onRemove : undefined }\n\t\t\t\t\t\t\tonReplace={ canRemove ? onReplace : undefined }\n\t\t\t\t\t\t\tparentBlockAlignment={ parentBlockAlignment }\n\t\t\t\t\t\t\tparentWidth={ parentWidth }\n\t\t\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\t\t\tstyle={ mergedStyle }\n\t\t\t\t\t\t\ttoggleSelection={ toggleSelection }\n\t\t\t\t\t\t\t__unstableParentLayout={\n\t\t\t\t\t\t\t\tObject.keys( parentLayout ).length\n\t\t\t\t\t\t\t\t\t? parentLayout\n\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\twrapperProps={ wrapperProps }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<View onLayout={ onLayout } />\n\t\t\t\t\t</GlobalStylesContext.Provider>\n\t\t\t\t)\n\t\t\t}\n\t\t</BlockWrapper>\n\t);\n}\n\nconst applyWithSelect = withSelect( ( select, { clientId, rootClientId } ) => {\n\tconst {\n\t\tisBlockSelected,\n\t\tgetBlockMode,\n\t\tisSelectionEnabled,\n\t\tgetTemplateLock,\n\t\t__unstableGetBlockWithoutInnerBlocks,\n\t\tcanRemoveBlock,\n\t\tcanMoveBlock,\n\t} = select( blockEditorStore );\n\tconst block = __unstableGetBlockWithoutInnerBlocks( clientId );\n\tconst isSelected = isBlockSelected( clientId );\n\tconst templateLock = getTemplateLock( rootClientId );\n\tconst canRemove = canRemoveBlock( clientId, rootClientId );\n\tconst canMove = canMoveBlock( clientId, rootClientId );\n\n\t// The fallback to `{}` is a temporary fix.\n\t// This function should never be called when a block is not present in\n\t// the state. It happens now because the order in withSelect rendering\n\t// is not correct.\n\tconst { name, attributes, isValid } = block || {};\n\n\t// Do not add new properties here, use `useSelect` instead to avoid\n\t// leaking new props to the public API (editor.BlockListBlock filter).\n\treturn {\n\t\tmode: getBlockMode( clientId ),\n\t\tisSelectionEnabled: isSelectionEnabled(),\n\t\tisLocked: !! templateLock,\n\t\tcanRemove,\n\t\tcanMove,\n\t\t// Users of the editor.BlockListBlock filter used to be able to\n\t\t// access the block prop.\n\t\t// Ideally these blocks would rely on the clientId prop only.\n\t\t// This is kept for backward compatibility reasons.\n\t\tblock,\n\t\tname,\n\t\tattributes,\n\t\tisValid,\n\t\tisSelected,\n\t};\n} );\n\nconst applyWithDispatch = withDispatch( ( dispatch, ownProps, registry ) => {\n\tconst {\n\t\tupdateBlockAttributes,\n\t\tinsertBlocks,\n\t\tmergeBlocks,\n\t\treplaceBlocks,\n\t\ttoggleSelection,\n\t\t__unstableMarkLastChangeAsPersistent,\n\t\tmoveBlocksToPosition,\n\t\tremoveBlock,\n\t} = dispatch( blockEditorStore );\n\n\t// Do not add new properties here, use `useDispatch` instead to avoid\n\t// leaking new props to the public API (editor.BlockListBlock filter).\n\treturn {\n\t\tsetAttributes( newAttributes ) {\n\t\t\tconst { getMultiSelectedBlockClientIds } =\n\t\t\t\tregistry.select( blockEditorStore );\n\t\t\tconst multiSelectedBlockClientIds =\n\t\t\t\tgetMultiSelectedBlockClientIds();\n\t\t\tconst { clientId } = ownProps;\n\t\t\tconst clientIds = multiSelectedBlockClientIds.length\n\t\t\t\t? multiSelectedBlockClientIds\n\t\t\t\t: [ clientId ];\n\n\t\t\tupdateBlockAttributes( clientIds, newAttributes );\n\t\t},\n\t\tonInsertBlocks( blocks, index ) {\n\t\t\tconst { rootClientId } = ownProps;\n\t\t\tinsertBlocks( blocks, index, rootClientId );\n\t\t},\n\t\tonInsertBlocksAfter( blocks ) {\n\t\t\tconst { clientId, rootClientId } = ownProps;\n\t\t\tconst { getBlockIndex } = registry.select( blockEditorStore );\n\t\t\tconst index = getBlockIndex( clientId );\n\t\t\tinsertBlocks( blocks, index + 1, rootClientId );\n\t\t},\n\t\tonMerge( forward ) {\n\t\t\tconst { clientId, rootClientId } = ownProps;\n\t\t\tconst {\n\t\t\t\tgetPreviousBlockClientId,\n\t\t\t\tgetNextBlockClientId,\n\t\t\t\tgetBlock,\n\t\t\t\tgetBlockAttributes,\n\t\t\t\tgetBlockName,\n\t\t\t\tgetBlockOrder,\n\t\t\t\tgetBlockIndex,\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\tcanInsertBlockType,\n\t\t\t} = registry.select( blockEditorStore );\n\n\t\t\t/**\n\t\t\t * Moves the block with clientId up one level. If the block type\n\t\t\t * cannot be inserted at the new location, it will be attempted to\n\t\t\t * convert to the default block type.\n\t\t\t *\n\t\t\t * @param {string} _clientId The block to move.\n\t\t\t * @param {boolean} changeSelection Whether to change the selection\n\t\t\t * to the moved block.\n\t\t\t */\n\t\t\tfunction moveFirstItemUp( _clientId, changeSelection = true ) {\n\t\t\t\tconst targetRootClientId = getBlockRootClientId( _clientId );\n\t\t\t\tconst blockOrder = getBlockOrder( _clientId );\n\t\t\t\tconst [ firstClientId ] = blockOrder;\n\n\t\t\t\tif (\n\t\t\t\t\tblockOrder.length === 1 &&\n\t\t\t\t\tisUnmodifiedBlock( getBlock( firstClientId ) )\n\t\t\t\t) {\n\t\t\t\t\tremoveBlock( _clientId );\n\t\t\t\t} else {\n\t\t\t\t\tif (\n\t\t\t\t\t\tcanInsertBlockType(\n\t\t\t\t\t\t\tgetBlockName( firstClientId ),\n\t\t\t\t\t\t\ttargetRootClientId\n\t\t\t\t\t\t)\n\t\t\t\t\t) {\n\t\t\t\t\t\tmoveBlocksToPosition(\n\t\t\t\t\t\t\t[ firstClientId ],\n\t\t\t\t\t\t\t_clientId,\n\t\t\t\t\t\t\ttargetRootClientId,\n\t\t\t\t\t\t\tgetBlockIndex( _clientId )\n\t\t\t\t\t\t);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst replacement = switchToBlockType(\n\t\t\t\t\t\t\tgetBlock( firstClientId ),\n\t\t\t\t\t\t\tgetDefaultBlockName()\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tif ( replacement && replacement.length ) {\n\t\t\t\t\t\t\tregistry.batch( () => {\n\t\t\t\t\t\t\t\tinsertBlocks(\n\t\t\t\t\t\t\t\t\treplacement,\n\t\t\t\t\t\t\t\t\tgetBlockIndex( _clientId ),\n\t\t\t\t\t\t\t\t\ttargetRootClientId,\n\t\t\t\t\t\t\t\t\tchangeSelection\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tremoveBlock( firstClientId, false );\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (\n\t\t\t\t\t\t! getBlockOrder( _clientId ).length &&\n\t\t\t\t\t\tisUnmodifiedBlock( getBlock( _clientId ) )\n\t\t\t\t\t) {\n\t\t\t\t\t\tremoveBlock( _clientId, false );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// For `Delete` or forward merge, we should do the exact same thing\n\t\t\t// as `Backspace`, but from the other block.\n\t\t\tif ( forward ) {\n\t\t\t\tif ( rootClientId ) {\n\t\t\t\t\tconst nextRootClientId =\n\t\t\t\t\t\tgetNextBlockClientId( rootClientId );\n\n\t\t\t\t\tif ( nextRootClientId ) {\n\t\t\t\t\t\t// If there is a block that follows with the same parent\n\t\t\t\t\t\t// block name and the same attributes, merge the inner\n\t\t\t\t\t\t// blocks.\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tgetBlockName( rootClientId ) ===\n\t\t\t\t\t\t\tgetBlockName( nextRootClientId )\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tconst rootAttributes =\n\t\t\t\t\t\t\t\tgetBlockAttributes( rootClientId );\n\t\t\t\t\t\t\tconst previousRootAttributes =\n\t\t\t\t\t\t\t\tgetBlockAttributes( nextRootClientId );\n\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tObject.keys( rootAttributes ).every(\n\t\t\t\t\t\t\t\t\t( key ) =>\n\t\t\t\t\t\t\t\t\t\trootAttributes[ key ] ===\n\t\t\t\t\t\t\t\t\t\tpreviousRootAttributes[ key ]\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tregistry.batch( () => {\n\t\t\t\t\t\t\t\t\tmoveBlocksToPosition(\n\t\t\t\t\t\t\t\t\t\tgetBlockOrder( nextRootClientId ),\n\t\t\t\t\t\t\t\t\t\tnextRootClientId,\n\t\t\t\t\t\t\t\t\t\trootClientId\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\tremoveBlock( nextRootClientId, false );\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tmergeBlocks( rootClientId, nextRootClientId );\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst nextBlockClientId = getNextBlockClientId( clientId );\n\n\t\t\t\tif ( ! nextBlockClientId ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif ( getBlockOrder( nextBlockClientId ).length ) {\n\t\t\t\t\tmoveFirstItemUp( nextBlockClientId, false );\n\t\t\t\t} else {\n\t\t\t\t\tmergeBlocks( clientId, nextBlockClientId );\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconst previousBlockClientId =\n\t\t\t\t\tgetPreviousBlockClientId( clientId );\n\n\t\t\t\tif ( previousBlockClientId ) {\n\t\t\t\t\tmergeBlocks( previousBlockClientId, clientId );\n\t\t\t\t} else if ( rootClientId ) {\n\t\t\t\t\tconst previousRootClientId =\n\t\t\t\t\t\tgetPreviousBlockClientId( rootClientId );\n\n\t\t\t\t\t// If there is a preceding block with the same parent block\n\t\t\t\t\t// name and the same attributes, merge the inner blocks.\n\t\t\t\t\tif (\n\t\t\t\t\t\tpreviousRootClientId &&\n\t\t\t\t\t\tgetBlockName( rootClientId ) ===\n\t\t\t\t\t\t\tgetBlockName( previousRootClientId )\n\t\t\t\t\t) {\n\t\t\t\t\t\tconst rootAttributes =\n\t\t\t\t\t\t\tgetBlockAttributes( rootClientId );\n\t\t\t\t\t\tconst previousRootAttributes =\n\t\t\t\t\t\t\tgetBlockAttributes( previousRootClientId );\n\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tObject.keys( rootAttributes ).every(\n\t\t\t\t\t\t\t\t( key ) =>\n\t\t\t\t\t\t\t\t\trootAttributes[ key ] ===\n\t\t\t\t\t\t\t\t\tpreviousRootAttributes[ key ]\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tregistry.batch( () => {\n\t\t\t\t\t\t\t\tmoveBlocksToPosition(\n\t\t\t\t\t\t\t\t\tgetBlockOrder( rootClientId ),\n\t\t\t\t\t\t\t\t\trootClientId,\n\t\t\t\t\t\t\t\t\tpreviousRootClientId\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tremoveBlock( rootClientId, false );\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tmoveFirstItemUp( rootClientId );\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\tonReplace( blocks, indexToSelect, initialPosition ) {\n\t\t\tif (\n\t\t\t\tblocks.length &&\n\t\t\t\t! isUnmodifiedDefaultBlock( blocks[ blocks.length - 1 ] )\n\t\t\t) {\n\t\t\t\t__unstableMarkLastChangeAsPersistent();\n\t\t\t}\n\t\t\treplaceBlocks(\n\t\t\t\t[ ownProps.clientId ],\n\t\t\t\tblocks,\n\t\t\t\tindexToSelect,\n\t\t\t\tinitialPosition\n\t\t\t);\n\t\t},\n\t\ttoggleSelection( selectionEnabled ) {\n\t\t\ttoggleSelection( selectionEnabled );\n\t\t},\n\t};\n} );\n\nexport default compose(\n\tpure,\n\tapplyWithSelect,\n\tapplyWithDispatch,\n\t// Block is sometimes not mounted at the right time, causing it be undefined\n\t// see issue for more info\n\t// https://github.com/WordPress/gutenberg/issues/17013\n\tifCondition( ( { block } ) => !! block )\n)( BlockListBlock );\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/block-list/block.native.js"],"names":["Pressable","useWindowDimensions","View","useCallback","useMemo","useRef","useState","GlobalStylesContext","getMergedGlobalStyles","useMobileGlobalStylesColors","alignmentHelpers","useGlobalStyles","__experimentalGetAccessibleBlockLabel","getAccessibleBlockLabel","getBlockType","getDefaultBlockName","isUnmodifiedBlock","isUnmodifiedDefaultBlock","switchToBlockType","useDispatch","useSelect","withDispatch","withSelect","compose","ifCondition","pure","BlockEdit","BlockDraggable","BlockInvalidWarning","BlockMobileToolbar","BlockOutline","styles","store","blockEditorStore","useLayout","useSetting","emptyArray","wrapperPropsCache","WeakMap","emptyObj","getWrapperProps","value","getWrapperPropsFunction","cachedValue","get","wrapperProps","set","BlockWrapper","accessibilityLabel","align","blockWidth","children","clientId","draggingClientId","draggingEnabled","isDescendentBlockSelected","isParentSelected","isSelected","isStackedHorizontally","isTouchable","marginHorizontal","marginVertical","onDeleteBlock","onFocus","width","screenWidth","anchorNodeRef","isFullWidth","isScreenWidthEqual","isFullWidthToolbar","blockWrapperStyles","flex","blockWrapperStyle","accessible","neutralToolbar","current","BlockListBlock","attributes","blockWrapperWidth","canRemove","contentStyle","isLocked","isSelectionEnabled","isValid","name","onInsertBlocksAfter","onMerge","onReplace","parentBlockAlignment","parentWidth","rootClientId","setAttributes","toggleSelection","baseGlobalStyles","blockType","isDescendantOfParentSelected","order","select","getBlockCount","getBlockHierarchyRootClientId","getBlockIndex","getBlockParents","getSelectedBlockClientId","getSettings","hasSelectedInnerBlock","currentBlockType","blockOrder","descendentBlockSelected","selectedBlockClientId","parents","parentSelected","selectedParents","descendantOfParentSelected","includes","hasInnerBlocks","isDraggingEnabled","currentDraggingClientId","globalStylesBaseStyles","__experimentalGlobalStylesBaseStyles","removeBlock","selectBlock","initialBlockWidth","setBlockWidth","parentLayout","defaultColors","globalStyle","fontSizes","onRemove","onLayout","nativeEvent","layoutWidth","Math","floor","layout","getEditWrapperProps","mergedStyle","style","JSON","stringify","Object","fromEntries","entries","filter","key","BLOCK_STYLE_ATTRIBUTES","isFocused","undefined","keys","length","applyWithSelect","isBlockSelected","getBlockMode","getTemplateLock","__unstableGetBlockWithoutInnerBlocks","canRemoveBlock","canMoveBlock","block","templateLock","canMove","mode","applyWithDispatch","dispatch","ownProps","registry","updateBlockAttributes","insertBlocks","mergeBlocks","replaceBlocks","__unstableMarkLastChangeAsPersistent","moveBlocksToPosition","newAttributes","getMultiSelectedBlockClientIds","multiSelectedBlockClientIds","clientIds","onInsertBlocks","blocks","index","forward","getPreviousBlockClientId","getNextBlockClientId","getBlock","getBlockAttributes","getBlockName","getBlockOrder","getBlockRootClientId","canInsertBlockType","moveFirstItemUp","_clientId","changeSelection","targetRootClientId","firstClientId","batch","replacement","nextRootClientId","rootAttributes","previousRootAttributes","every","nextBlockClientId","previousBlockClientId","previousRootClientId","indexToSelect","initialPosition","selectionEnabled"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,EAAoBC,mBAApB,EAAyCC,IAAzC,QAAqD,cAArD;AAEA;AACA;AACA;;AACA,SAASC,WAAT,EAAsBC,OAAtB,EAA+BC,MAA/B,EAAuCC,QAAvC,QAAuD,oBAAvD;AACA,SACCC,mBADD,EAECC,qBAFD,EAGCC,2BAHD,EAICC,gBAJD,EAKCC,eALD,QAMO,uBANP;AAOA,SACCC,qCAAqC,IAAIC,uBAD1C,EAECC,YAFD,EAGCC,mBAHD,EAICC,iBAJD,EAKCC,wBALD,EAMCC,iBAND,QAOO,mBAPP;AAQA,SACCC,WADD,EAECC,SAFD,EAGCC,YAHD,EAICC,UAJD,QAKO,iBALP;AAMA,SAASC,OAAT,EAAkBC,WAAlB,EAA+BC,IAA/B,QAA2C,oBAA3C;AAEA;AACA;AACA;;AACA,OAAOC,SAAP,MAAsB,eAAtB;AACA,OAAOC,cAAP,MAA2B,oBAA3B;AACA,OAAOC,mBAAP,MAAgC,yBAAhC;AACA,OAAOC,kBAAP,MAA+B,yBAA/B;AACA,OAAOC,YAAP,MAAyB,iBAAzB;AACA,OAAOC,MAAP,MAAmB,cAAnB;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,aAA1C;AACA,SAASC,SAAT,QAA0B,UAA1B;AACA,OAAOC,UAAP,MAAuB,gBAAvB;AAEA,MAAMC,UAAU,GAAG,EAAnB,C,CAEA;;AACA,MAAMC,iBAAiB,GAAG,IAAIC,OAAJ,EAA1B;AACA,MAAMC,QAAQ,GAAG,EAAjB;;AACA,S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AAa,CACZ,CAAEL,QAAQ,CAAC9G,QAAX,CADY,EAEZ2H,MAFY,EAGZyB,aAHY,EAIZC,eAJY,CAAb;AAMA,KAlNK;;AAmNN7G,IAAAA,eAAe,CAAE8G,gBAAF,EAAqB;AACnC9G,MAAAA,eAAe,CAAE8G,gBAAF,CAAf;AACA;;AArNK,GAAP;AAuNA,CArOqC,CAAtC;AAuOA,eAAenL,OAAO,CACrBE,IADqB,EAErB4H,eAFqB,EAGrBW,iBAHqB,EAIrB;AACA;AACA;AACAxI,WAAW,CAAE;AAAA,MAAE;AAAEoI,IAAAA;AAAF,GAAF;AAAA,SAAiB,CAAC,CAAEA,KAApB;AAAA,CAAF,CAPU,CAAP,CAQZhF,cARY,CAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { Pressable, useWindowDimensions, View } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { useCallback, useMemo, useRef, useState } from '@wordpress/element';\nimport {\n\tGlobalStylesContext,\n\tgetMergedGlobalStyles,\n\tuseMobileGlobalStylesColors,\n\talignmentHelpers,\n\tuseGlobalStyles,\n} from '@wordpress/components';\nimport {\n\t__experimentalGetAccessibleBlockLabel as getAccessibleBlockLabel,\n\tgetBlockType,\n\tgetDefaultBlockName,\n\tisUnmodifiedBlock,\n\tisUnmodifiedDefaultBlock,\n\tswitchToBlockType,\n} from '@wordpress/blocks';\nimport {\n\tuseDispatch,\n\tuseSelect,\n\twithDispatch,\n\twithSelect,\n} from '@wordpress/data';\nimport { compose, ifCondition, pure } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport BlockEdit from '../block-edit';\nimport BlockDraggable from '../block-draggable';\nimport BlockInvalidWarning from './block-invalid-warning';\nimport BlockMobileToolbar from '../block-mobile-toolbar';\nimport BlockOutline from './block-outline';\nimport styles from './block.scss';\nimport { store as blockEditorStore } from '../../store';\nimport { useLayout } from './layout';\nimport useSetting from '../use-setting';\n\nconst emptyArray = [];\n\n// Helper function to memoize the wrapperProps since getEditWrapperProps always returns a new reference.\nconst wrapperPropsCache = new WeakMap();\nconst emptyObj = {};\nfunction getWrapperProps( value, getWrapperPropsFunction ) {\n\tif ( ! getWrapperPropsFunction ) {\n\t\treturn emptyObj;\n\t}\n\tconst cachedValue = wrapperPropsCache.get( value );\n\tif ( ! cachedValue ) {\n\t\tconst wrapperProps = getWrapperPropsFunction( value );\n\t\twrapperPropsCache.set( value, wrapperProps );\n\t\treturn wrapperProps;\n\t}\n\treturn cachedValue;\n}\n\nfunction BlockWrapper( {\n\taccessibilityLabel,\n\talign,\n\tblockWidth,\n\tchildren,\n\tclientId,\n\tdraggingClientId,\n\tdraggingEnabled,\n\tisDescendentBlockSelected,\n\tisParentSelected,\n\tisSelected,\n\tisStackedHorizontally,\n\tisTouchable,\n\tmarginHorizontal,\n\tmarginVertical,\n\tonDeleteBlock,\n\tonFocus,\n} ) {\n\tconst { width: screenWidth } = useWindowDimensions();\n\tconst anchorNodeRef = useRef();\n\tconst { isFullWidth } = alignmentHelpers;\n\tconst isScreenWidthEqual = blockWidth === screenWidth;\n\tconst isFullWidthToolbar = isFullWidth( align ) || isScreenWidthEqual;\n\tconst blockWrapperStyles = { flex: 1 };\n\tconst blockWrapperStyle = [\n\t\tblockWrapperStyles,\n\t\t{\n\t\t\tmarginVertical,\n\t\t\tmarginHorizontal,\n\t\t},\n\t];\n\tconst accessible = ! ( isSelected || isDescendentBlockSelected );\n\n\treturn (\n\t\t<Pressable\n\t\t\taccessibilityLabel={ accessibilityLabel }\n\t\t\taccessibilityRole=\"button\"\n\t\t\taccessible={ accessible }\n\t\t\tdisabled={ ! isTouchable }\n\t\t\tonPress={ onFocus }\n\t\t\tstyle={ blockWrapperStyle }\n\t\t>\n\t\t\t<BlockOutline\n\t\t\t\tisSelected={ isSelected }\n\t\t\t\tisParentSelected={ isParentSelected }\n\t\t\t\tscreenWidth={ screenWidth }\n\t\t\t/>\n\t\t\t<BlockDraggable\n\t\t\t\tclientId={ clientId }\n\t\t\t\tdraggingClientId={ draggingClientId }\n\t\t\t\tenabled={ draggingEnabled }\n\t\t\t\ttestID=\"draggable-trigger-content\"\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</BlockDraggable>\n\t\t\t<View style={ styles.neutralToolbar } ref={ anchorNodeRef }>\n\t\t\t\t{ isSelected && (\n\t\t\t\t\t<BlockMobileToolbar\n\t\t\t\t\t\tanchorNodeRef={ anchorNodeRef.current }\n\t\t\t\t\t\tblockWidth={ blockWidth }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\tdraggingClientId={ draggingClientId }\n\t\t\t\t\t\tisFullWidth={ isFullWidthToolbar }\n\t\t\t\t\t\tisStackedHorizontally={ isStackedHorizontally }\n\t\t\t\t\t\tonDelete={ onDeleteBlock }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</View>\n\t\t</Pressable>\n\t);\n}\n\nfunction BlockListBlock( {\n\tattributes,\n\tblockWidth: blockWrapperWidth,\n\tcanRemove,\n\tclientId,\n\tcontentStyle,\n\tisLocked,\n\tisSelected,\n\tisSelectionEnabled,\n\tisStackedHorizontally,\n\tisValid,\n\tmarginHorizontal,\n\tmarginVertical,\n\tname,\n\tonDeleteBlock,\n\tonInsertBlocksAfter,\n\tonMerge,\n\tonReplace,\n\tparentBlockAlignment,\n\tparentWidth,\n\trootClientId,\n\tsetAttributes,\n\ttoggleSelection,\n} ) {\n\tconst {\n\t\tbaseGlobalStyles,\n\t\tblockType,\n\t\tdraggingClientId,\n\t\tdraggingEnabled,\n\t\tisDescendantOfParentSelected,\n\t\tisDescendentBlockSelected,\n\t\tisParentSelected,\n\t\torder,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockCount,\n\t\t\t\tgetBlockHierarchyRootClientId,\n\t\t\t\tgetBlockIndex,\n\t\t\t\tgetBlockParents,\n\t\t\t\tgetSelectedBlockClientId,\n\t\t\t\tgetSettings,\n\t\t\t\thasSelectedInnerBlock,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst currentBlockType = getBlockType( name || 'core/missing' );\n\t\t\tconst blockOrder = getBlockIndex( clientId );\n\t\t\tconst descendentBlockSelected = hasSelectedInnerBlock(\n\t\t\t\tclientId,\n\t\t\t\ttrue\n\t\t\t);\n\t\t\tconst selectedBlockClientId = getSelectedBlockClientId();\n\n\t\t\tconst parents = getBlockParents( clientId, true );\n\t\t\tconst parentSelected =\n\t\t\t\t// Set false as a default value to prevent re-render when it's changed from null to false.\n\t\t\t\t( selectedBlockClientId || false ) &&\n\t\t\t\tselectedBlockClientId === rootClientId;\n\n\t\t\tconst selectedParents = clientId ? parents : [];\n\t\t\tconst descendantOfParentSelected =\n\t\t\t\tselectedParents.includes( rootClientId );\n\t\t\tconst hasInnerBlocks = getBlockCount( clientId ) > 0;\n\n\t\t\t// For blocks with inner blocks, we only enable the dragging in the nested\n\t\t\t// blocks if any of them are selected. This way we prevent the long-press\n\t\t\t// gesture from being disabled for elements within the block UI.\n\t\t\tconst isDraggingEnabled =\n\t\t\t\t! hasInnerBlocks || isSelected || ! descendentBlockSelected;\n\t\t\t// Dragging nested blocks is not supported yet. For this reason, the block to be dragged\n\t\t\t// will be the top in the hierarchy.\n\t\t\tconst currentDraggingClientId =\n\t\t\t\tgetBlockHierarchyRootClientId( clientId );\n\n\t\t\tconst globalStylesBaseStyles =\n\t\t\t\tgetSettings()?.__experimentalGlobalStylesBaseStyles;\n\n\t\t\treturn {\n\t\t\t\tbaseGlobalStyles: globalStylesBaseStyles,\n\t\t\t\tblockType: currentBlockType,\n\t\t\t\tdraggingClientId: currentDraggingClientId,\n\t\t\t\tdraggingEnabled: isDraggingEnabled,\n\t\t\t\tisDescendantOfParentSelected: descendantOfParentSelected,\n\t\t\t\tisDescendentBlockSelected: descendentBlockSelected,\n\t\t\t\tisParentSelected: parentSelected,\n\t\t\t\torder: blockOrder,\n\t\t\t};\n\t\t},\n\t\t[ clientId, isSelected, name, rootClientId ]\n\t);\n\tconst { removeBlock, selectBlock } = useDispatch( blockEditorStore );\n\tconst initialBlockWidth = blockWrapperWidth - 2 * marginHorizontal;\n\tconst [ blockWidth, setBlockWidth ] = useState( initialBlockWidth );\n\tconst parentLayout = useLayout() || {};\n\tconst defaultColors = useMobileGlobalStylesColors();\n\tconst globalStyle = useGlobalStyles();\n\tconst fontSizes = useSetting( 'typography.fontSizes' ) || emptyArray;\n\n\tconst onRemove = useCallback(\n\t\t() => removeBlock( clientId ),\n\t\t[ clientId, removeBlock ]\n\t);\n\tconst onFocus = useCallback( () => {\n\t\tif ( ! isSelected ) {\n\t\t\tselectBlock( clientId );\n\t\t}\n\t}, [ selectBlock, clientId, isSelected ] );\n\n\tconst onLayout = useCallback(\n\t\t( { nativeEvent } ) => {\n\t\t\tconst layoutWidth = Math.floor( nativeEvent.layout.width );\n\n\t\t\tif ( ! blockWidth || ! layoutWidth ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( blockWidth !== layoutWidth ) {\n\t\t\t\tsetBlockWidth( layoutWidth );\n\t\t\t}\n\t\t},\n\t\t[ blockWidth, setBlockWidth ]\n\t);\n\n\t// Block level styles.\n\tconst wrapperProps = getWrapperProps(\n\t\tattributes,\n\t\tblockType.getEditWrapperProps\n\t);\n\n\t// Inherited styles merged with block level styles.\n\tconst mergedStyle = useMemo( () => {\n\t\treturn getMergedGlobalStyles(\n\t\t\tbaseGlobalStyles,\n\t\t\tglobalStyle,\n\t\t\twrapperProps.style,\n\t\t\tattributes,\n\t\t\tdefaultColors,\n\t\t\tname,\n\t\t\tfontSizes\n\t\t);\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [\n\t\t// It is crucial to keep the dependencies array minimal to prevent unnecessary calls that could negatively impact performance.\n\t\t// JSON.stringify is used for the following purposes:\n\t\t// 1. To create a single, comparable value from the globalStyle, wrapperProps.style, and attributes objects. This allows useMemo to\n\t\t// efficiently determine if a change has occurred in any of these objects.\n\t\t// 2. To filter the attributes object, ensuring that only the relevant attributes (included in\n\t\t// GlobalStylesContext.BLOCK_STYLE_ATTRIBUTES) are considered as dependencies. This reduces the likelihood of\n\t\t// unnecessary useMemo calls when other, unrelated attributes change.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\tJSON.stringify( globalStyle ),\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\tJSON.stringify( wrapperProps.style ),\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\tJSON.stringify(\n\t\t\tObject.fromEntries(\n\t\t\t\tObject.entries( attributes ?? {} ).filter( ( [ key ] ) =>\n\t\t\t\t\tGlobalStylesContext.BLOCK_STYLE_ATTRIBUTES.includes( key )\n\t\t\t\t)\n\t\t\t)\n\t\t),\n\t] );\n\n\tconst { align } = attributes;\n\tconst isFocused = isSelected || isDescendentBlockSelected;\n\tconst isTouchable =\n\t\tisSelected ||\n\t\tisDescendantOfParentSelected ||\n\t\tisParentSelected ||\n\t\t! rootClientId;\n\n\tconst accessibilityLabel = getAccessibleBlockLabel(\n\t\tblockType,\n\t\tattributes,\n\t\torder + 1\n\t);\n\n\treturn (\n\t\t<BlockWrapper\n\t\t\taccessibilityLabel={ accessibilityLabel }\n\t\t\talign={ align }\n\t\t\tblockWidth={ blockWidth }\n\t\t\tclientId={ clientId }\n\t\t\tdraggingClientId={ draggingClientId }\n\t\t\tdraggingEnabled={ draggingEnabled }\n\t\t\tisFocused={ isFocused }\n\t\t\tisDescendentBlockSelected={ isDescendentBlockSelected }\n\t\t\tisParentSelected={ isParentSelected }\n\t\t\tisSelected={ isSelected }\n\t\t\tisStackedHorizontally={ isStackedHorizontally }\n\t\t\tisTouchable={ isTouchable }\n\t\t\tmarginHorizontal={ marginHorizontal }\n\t\t\tmarginVertical={ marginVertical }\n\t\t\tonDeleteBlock={ onDeleteBlock }\n\t\t\tonFocus={ onFocus }\n\t\t>\n\t\t\t{ () =>\n\t\t\t\t! isValid ? (\n\t\t\t\t\t<BlockInvalidWarning clientId={ clientId } />\n\t\t\t\t) : (\n\t\t\t\t\t<GlobalStylesContext.Provider value={ mergedStyle }>\n\t\t\t\t\t\t<BlockEdit\n\t\t\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\t\t\tblockWidth={ blockWidth }\n\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t\tcontentStyle={ contentStyle }\n\t\t\t\t\t\t\tinsertBlocksAfter={\n\t\t\t\t\t\t\t\tisLocked ? undefined : onInsertBlocksAfter\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\t\tisSelectionEnabled={ isSelectionEnabled }\n\t\t\t\t\t\t\tmergeBlocks={ canRemove ? onMerge : undefined }\n\t\t\t\t\t\t\tname={ name }\n\t\t\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\t\t\tonRemove={ canRemove ? onRemove : undefined }\n\t\t\t\t\t\t\tonReplace={ canRemove ? onReplace : undefined }\n\t\t\t\t\t\t\tparentBlockAlignment={ parentBlockAlignment }\n\t\t\t\t\t\t\tparentWidth={ parentWidth }\n\t\t\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\t\t\tstyle={ mergedStyle }\n\t\t\t\t\t\t\ttoggleSelection={ toggleSelection }\n\t\t\t\t\t\t\t__unstableParentLayout={\n\t\t\t\t\t\t\t\tObject.keys( parentLayout ).length\n\t\t\t\t\t\t\t\t\t? parentLayout\n\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\twrapperProps={ wrapperProps }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<View onLayout={ onLayout } />\n\t\t\t\t\t</GlobalStylesContext.Provider>\n\t\t\t\t)\n\t\t\t}\n\t\t</BlockWrapper>\n\t);\n}\n\nconst applyWithSelect = withSelect( ( select, { clientId, rootClientId } ) => {\n\tconst {\n\t\tisBlockSelected,\n\t\tgetBlockMode,\n\t\tisSelectionEnabled,\n\t\tgetTemplateLock,\n\t\t__unstableGetBlockWithoutInnerBlocks,\n\t\tcanRemoveBlock,\n\t\tcanMoveBlock,\n\t} = select( blockEditorStore );\n\tconst block = __unstableGetBlockWithoutInnerBlocks( clientId );\n\tconst isSelected = isBlockSelected( clientId );\n\tconst templateLock = getTemplateLock( rootClientId );\n\tconst canRemove = canRemoveBlock( clientId, rootClientId );\n\tconst canMove = canMoveBlock( clientId, rootClientId );\n\n\t// The fallback to `{}` is a temporary fix.\n\t// This function should never be called when a block is not present in\n\t// the state. It happens now because the order in withSelect rendering\n\t// is not correct.\n\tconst { name, attributes, isValid } = block || {};\n\n\t// Do not add new properties here, use `useSelect` instead to avoid\n\t// leaking new props to the public API (editor.BlockListBlock filter).\n\treturn {\n\t\tmode: getBlockMode( clientId ),\n\t\tisSelectionEnabled: isSelectionEnabled(),\n\t\tisLocked: !! templateLock,\n\t\tcanRemove,\n\t\tcanMove,\n\t\t// Users of the editor.BlockListBlock filter used to be able to\n\t\t// access the block prop.\n\t\t// Ideally these blocks would rely on the clientId prop only.\n\t\t// This is kept for backward compatibility reasons.\n\t\tblock,\n\t\tname,\n\t\tattributes,\n\t\tisValid,\n\t\tisSelected,\n\t};\n} );\n\nconst applyWithDispatch = withDispatch( ( dispatch, ownProps, registry ) => {\n\tconst {\n\t\tupdateBlockAttributes,\n\t\tinsertBlocks,\n\t\tmergeBlocks,\n\t\treplaceBlocks,\n\t\ttoggleSelection,\n\t\t__unstableMarkLastChangeAsPersistent,\n\t\tmoveBlocksToPosition,\n\t\tremoveBlock,\n\t} = dispatch( blockEditorStore );\n\n\t// Do not add new properties here, use `useDispatch` instead to avoid\n\t// leaking new props to the public API (editor.BlockListBlock filter).\n\treturn {\n\t\tsetAttributes( newAttributes ) {\n\t\t\tconst { getMultiSelectedBlockClientIds } =\n\t\t\t\tregistry.select( blockEditorStore );\n\t\t\tconst multiSelectedBlockClientIds =\n\t\t\t\tgetMultiSelectedBlockClientIds();\n\t\t\tconst { clientId } = ownProps;\n\t\t\tconst clientIds = multiSelectedBlockClientIds.length\n\t\t\t\t? multiSelectedBlockClientIds\n\t\t\t\t: [ clientId ];\n\n\t\t\tupdateBlockAttributes( clientIds, newAttributes );\n\t\t},\n\t\tonInsertBlocks( blocks, index ) {\n\t\t\tconst { rootClientId } = ownProps;\n\t\t\tinsertBlocks( blocks, index, rootClientId );\n\t\t},\n\t\tonInsertBlocksAfter( blocks ) {\n\t\t\tconst { clientId, rootClientId } = ownProps;\n\t\t\tconst { getBlockIndex } = registry.select( blockEditorStore );\n\t\t\tconst index = getBlockIndex( clientId );\n\t\t\tinsertBlocks( blocks, index + 1, rootClientId );\n\t\t},\n\t\tonMerge( forward ) {\n\t\t\tconst { clientId, rootClientId } = ownProps;\n\t\t\tconst {\n\t\t\t\tgetPreviousBlockClientId,\n\t\t\t\tgetNextBlockClientId,\n\t\t\t\tgetBlock,\n\t\t\t\tgetBlockAttributes,\n\t\t\t\tgetBlockName,\n\t\t\t\tgetBlockOrder,\n\t\t\t\tgetBlockIndex,\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\tcanInsertBlockType,\n\t\t\t} = registry.select( blockEditorStore );\n\n\t\t\t/**\n\t\t\t * Moves the block with clientId up one level. If the block type\n\t\t\t * cannot be inserted at the new location, it will be attempted to\n\t\t\t * convert to the default block type.\n\t\t\t *\n\t\t\t * @param {string} _clientId The block to move.\n\t\t\t * @param {boolean} changeSelection Whether to change the selection\n\t\t\t * to the moved block.\n\t\t\t */\n\t\t\tfunction moveFirstItemUp( _clientId, changeSelection = true ) {\n\t\t\t\tconst targetRootClientId = getBlockRootClientId( _clientId );\n\t\t\t\tconst blockOrder = getBlockOrder( _clientId );\n\t\t\t\tconst [ firstClientId ] = blockOrder;\n\n\t\t\t\tif (\n\t\t\t\t\tblockOrder.length === 1 &&\n\t\t\t\t\tisUnmodifiedBlock( getBlock( firstClientId ) )\n\t\t\t\t) {\n\t\t\t\t\tremoveBlock( _clientId );\n\t\t\t\t} else {\n\t\t\t\t\tregistry.batch( () => {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tcanInsertBlockType(\n\t\t\t\t\t\t\t\tgetBlockName( firstClientId ),\n\t\t\t\t\t\t\t\ttargetRootClientId\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tmoveBlocksToPosition(\n\t\t\t\t\t\t\t\t[ firstClientId ],\n\t\t\t\t\t\t\t\t_clientId,\n\t\t\t\t\t\t\t\ttargetRootClientId,\n\t\t\t\t\t\t\t\tgetBlockIndex( _clientId )\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tconst replacement = switchToBlockType(\n\t\t\t\t\t\t\t\tgetBlock( firstClientId ),\n\t\t\t\t\t\t\t\tgetDefaultBlockName()\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\tif ( replacement && replacement.length ) {\n\t\t\t\t\t\t\t\tinsertBlocks(\n\t\t\t\t\t\t\t\t\treplacement,\n\t\t\t\t\t\t\t\t\tgetBlockIndex( _clientId ),\n\t\t\t\t\t\t\t\t\ttargetRootClientId,\n\t\t\t\t\t\t\t\t\tchangeSelection\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tremoveBlock( firstClientId, false );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t! getBlockOrder( _clientId ).length &&\n\t\t\t\t\t\t\tisUnmodifiedBlock( getBlock( _clientId ) )\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tremoveBlock( _clientId, false );\n\t\t\t\t\t\t}\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// For `Delete` or forward merge, we should do the exact same thing\n\t\t\t// as `Backspace`, but from the other block.\n\t\t\tif ( forward ) {\n\t\t\t\tif ( rootClientId ) {\n\t\t\t\t\tconst nextRootClientId =\n\t\t\t\t\t\tgetNextBlockClientId( rootClientId );\n\n\t\t\t\t\tif ( nextRootClientId ) {\n\t\t\t\t\t\t// If there is a block that follows with the same parent\n\t\t\t\t\t\t// block name and the same attributes, merge the inner\n\t\t\t\t\t\t// blocks.\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tgetBlockName( rootClientId ) ===\n\t\t\t\t\t\t\tgetBlockName( nextRootClientId )\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tconst rootAttributes =\n\t\t\t\t\t\t\t\tgetBlockAttributes( rootClientId );\n\t\t\t\t\t\t\tconst previousRootAttributes =\n\t\t\t\t\t\t\t\tgetBlockAttributes( nextRootClientId );\n\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tObject.keys( rootAttributes ).every(\n\t\t\t\t\t\t\t\t\t( key ) =>\n\t\t\t\t\t\t\t\t\t\trootAttributes[ key ] ===\n\t\t\t\t\t\t\t\t\t\tpreviousRootAttributes[ key ]\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tregistry.batch( () => {\n\t\t\t\t\t\t\t\t\tmoveBlocksToPosition(\n\t\t\t\t\t\t\t\t\t\tgetBlockOrder( nextRootClientId ),\n\t\t\t\t\t\t\t\t\t\tnextRootClientId,\n\t\t\t\t\t\t\t\t\t\trootClientId\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\tremoveBlock( nextRootClientId, false );\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tmergeBlocks( rootClientId, nextRootClientId );\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst nextBlockClientId = getNextBlockClientId( clientId );\n\n\t\t\t\tif ( ! nextBlockClientId ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif ( getBlockOrder( nextBlockClientId ).length ) {\n\t\t\t\t\tmoveFirstItemUp( nextBlockClientId, false );\n\t\t\t\t} else {\n\t\t\t\t\tmergeBlocks( clientId, nextBlockClientId );\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconst previousBlockClientId =\n\t\t\t\t\tgetPreviousBlockClientId( clientId );\n\n\t\t\t\tif ( previousBlockClientId ) {\n\t\t\t\t\tmergeBlocks( previousBlockClientId, clientId );\n\t\t\t\t} else if ( rootClientId ) {\n\t\t\t\t\tconst previousRootClientId =\n\t\t\t\t\t\tgetPreviousBlockClientId( rootClientId );\n\n\t\t\t\t\t// If there is a preceding block with the same parent block\n\t\t\t\t\t// name and the same attributes, merge the inner blocks.\n\t\t\t\t\tif (\n\t\t\t\t\t\tpreviousRootClientId &&\n\t\t\t\t\t\tgetBlockName( rootClientId ) ===\n\t\t\t\t\t\t\tgetBlockName( previousRootClientId )\n\t\t\t\t\t) {\n\t\t\t\t\t\tconst rootAttributes =\n\t\t\t\t\t\t\tgetBlockAttributes( rootClientId );\n\t\t\t\t\t\tconst previousRootAttributes =\n\t\t\t\t\t\t\tgetBlockAttributes( previousRootClientId );\n\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tObject.keys( rootAttributes ).every(\n\t\t\t\t\t\t\t\t( key ) =>\n\t\t\t\t\t\t\t\t\trootAttributes[ key ] ===\n\t\t\t\t\t\t\t\t\tpreviousRootAttributes[ key ]\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tregistry.batch( () => {\n\t\t\t\t\t\t\t\tmoveBlocksToPosition(\n\t\t\t\t\t\t\t\t\tgetBlockOrder( rootClientId ),\n\t\t\t\t\t\t\t\t\trootClientId,\n\t\t\t\t\t\t\t\t\tpreviousRootClientId\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tremoveBlock( rootClientId, false );\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tmoveFirstItemUp( rootClientId );\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\tonReplace( blocks, indexToSelect, initialPosition ) {\n\t\t\tif (\n\t\t\t\tblocks.length &&\n\t\t\t\t! isUnmodifiedDefaultBlock( blocks[ blocks.length - 1 ] )\n\t\t\t) {\n\t\t\t\t__unstableMarkLastChangeAsPersistent();\n\t\t\t}\n\t\t\treplaceBlocks(\n\t\t\t\t[ ownProps.clientId ],\n\t\t\t\tblocks,\n\t\t\t\tindexToSelect,\n\t\t\t\tinitialPosition\n\t\t\t);\n\t\t},\n\t\ttoggleSelection( selectionEnabled ) {\n\t\t\ttoggleSelection( selectionEnabled );\n\t\t},\n\t};\n} );\n\nexport default compose(\n\tpure,\n\tapplyWithSelect,\n\tapplyWithDispatch,\n\t// Block is sometimes not mounted at the right time, causing it be undefined\n\t// see issue for more info\n\t// https://github.com/WordPress/gutenberg/issues/17013\n\tifCondition( ( { block } ) => !! block )\n)( BlockListBlock );\n"]}
|
|
@@ -12,7 +12,7 @@ import { View, Platform, TouchableWithoutFeedback } from 'react-native';
|
|
|
12
12
|
import { useRef, useState } from '@wordpress/element';
|
|
13
13
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
14
14
|
import { createBlock } from '@wordpress/blocks';
|
|
15
|
-
import { KeyboardAwareFlatList,
|
|
15
|
+
import { KeyboardAwareFlatList, WIDE_ALIGNMENTS, alignmentHelpers } from '@wordpress/components';
|
|
16
16
|
import { __ } from '@wordpress/i18n';
|
|
17
17
|
/**
|
|
18
18
|
* Internal dependencies
|
|
@@ -22,19 +22,16 @@ import styles from './style.scss';
|
|
|
22
22
|
import BlockListAppender from '../block-list-appender';
|
|
23
23
|
import BlockListItem from './block-list-item';
|
|
24
24
|
import BlockListItemCell from './block-list-item-cell';
|
|
25
|
-
import { BlockListProvider,
|
|
25
|
+
import { BlockListProvider, DEFAULT_BLOCK_LIST_CONTEXT } from './block-list-context';
|
|
26
26
|
import { BlockDraggableWrapper } from '../block-draggable';
|
|
27
|
+
import { useEditorWrapperStyles } from '../../hooks/use-editor-wrapper-styles';
|
|
27
28
|
import { store as blockEditorStore } from '../../store';
|
|
28
29
|
|
|
29
30
|
const identity = x => x;
|
|
30
31
|
|
|
31
32
|
const stylesMemo = {};
|
|
32
33
|
|
|
33
|
-
const getStyles = (
|
|
34
|
-
if (isRootList) {
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
|
|
34
|
+
const getStyles = (isStackedHorizontally, horizontalAlignment) => {
|
|
38
35
|
const styleName = `${isStackedHorizontally}-${horizontalAlignment}`;
|
|
39
36
|
|
|
40
37
|
if (stylesMemo[styleName]) {
|
|
@@ -65,7 +62,6 @@ export default function BlockList(_ref) {
|
|
|
65
62
|
renderAppender,
|
|
66
63
|
renderFooterAppender,
|
|
67
64
|
rootClientId,
|
|
68
|
-
title,
|
|
69
65
|
withFooter = true
|
|
70
66
|
} = _ref;
|
|
71
67
|
const {
|
|
@@ -167,84 +163,6 @@ export default function BlockList(_ref) {
|
|
|
167
163
|
}
|
|
168
164
|
};
|
|
169
165
|
|
|
170
|
-
const renderList = function () {
|
|
171
|
-
let extraProps = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
172
|
-
const {
|
|
173
|
-
parentScrollRef,
|
|
174
|
-
onScroll
|
|
175
|
-
} = extraProps;
|
|
176
|
-
const {
|
|
177
|
-
blockToolbar,
|
|
178
|
-
headerToolbar,
|
|
179
|
-
floatingToolbar
|
|
180
|
-
} = styles;
|
|
181
|
-
const containerStyle = {
|
|
182
|
-
flex: isRootList ? 1 : 0,
|
|
183
|
-
// We set negative margin in the parent to remove the edge spacing between parent block and child block in ineer blocks.
|
|
184
|
-
marginVertical: isRootList ? 0 : -marginVertical,
|
|
185
|
-
marginHorizontal: isRootList ? 0 : -marginHorizontal
|
|
186
|
-
};
|
|
187
|
-
const isContentStretch = contentResizeMode === 'stretch';
|
|
188
|
-
const isMultiBlocks = blockClientIds.length > 1;
|
|
189
|
-
const {
|
|
190
|
-
isWider
|
|
191
|
-
} = alignmentHelpers;
|
|
192
|
-
const extraScrollHeight = headerToolbar.height + blockToolbar.height + (isFloatingToolbarVisible ? floatingToolbar.height : 0);
|
|
193
|
-
const scrollViewStyle = [{
|
|
194
|
-
flex: isRootList ? 1 : 0
|
|
195
|
-
}, !isRootList && styles.overflowVisible];
|
|
196
|
-
return createElement(View, {
|
|
197
|
-
style: containerStyle,
|
|
198
|
-
onAccessibilityEscape: clearSelectedBlock,
|
|
199
|
-
onLayout: onLayout,
|
|
200
|
-
testID: "block-list-wrapper"
|
|
201
|
-
}, createElement(KeyboardAwareFlatList, _extends({}, Platform.OS === 'android' ? {
|
|
202
|
-
removeClippedSubviews: false
|
|
203
|
-
} : {}, {
|
|
204
|
-
// Disable clipping on Android to fix focus losing. See https://github.com/wordpress-mobile/gutenberg-mobile/pull/741#issuecomment-472746541
|
|
205
|
-
accessibilityLabel: "block-list",
|
|
206
|
-
innerRef: ref => {
|
|
207
|
-
scrollViewRef.current = parentScrollRef || ref;
|
|
208
|
-
},
|
|
209
|
-
extraScrollHeight: extraScrollHeight,
|
|
210
|
-
keyboardShouldPersistTaps: "always",
|
|
211
|
-
scrollViewStyle: scrollViewStyle,
|
|
212
|
-
extraData: getExtraData(),
|
|
213
|
-
scrollEnabled: isRootList,
|
|
214
|
-
contentContainerStyle: [horizontal && styles.horizontalContentContainer, isWider(blockWidth, 'medium') && (isContentStretch && isMultiBlocks ? styles.horizontalContentContainerStretch : styles.horizontalContentContainerCenter)],
|
|
215
|
-
style: getStyles(isRootList, isStackedHorizontally, horizontalAlignment),
|
|
216
|
-
data: blockClientIds,
|
|
217
|
-
keyExtractor: identity,
|
|
218
|
-
listKey: rootClientId ? `list-${rootClientId}` : 'list-root',
|
|
219
|
-
renderItem: renderItem,
|
|
220
|
-
CellRendererComponent: BlockListItemCell,
|
|
221
|
-
shouldPreventAutomaticScroll: shouldFlatListPreventAutomaticScroll,
|
|
222
|
-
title: title,
|
|
223
|
-
ListHeaderComponent: header,
|
|
224
|
-
ListEmptyComponent: !isReadOnly && createElement(EmptyList, {
|
|
225
|
-
orientation: orientation,
|
|
226
|
-
rootClientId: rootClientId,
|
|
227
|
-
renderAppender: renderAppender,
|
|
228
|
-
renderFooterAppender: renderFooterAppender
|
|
229
|
-
}),
|
|
230
|
-
ListFooterComponent: createElement(Footer, {
|
|
231
|
-
addBlockToEndOfPost: addBlockToEndOfPost,
|
|
232
|
-
isReadOnly: isReadOnly,
|
|
233
|
-
renderFooterAppender: renderFooterAppender,
|
|
234
|
-
withFooter: withFooter
|
|
235
|
-
}),
|
|
236
|
-
onScroll: onScroll
|
|
237
|
-
})), shouldShowInnerBlockAppender() && createElement(View, {
|
|
238
|
-
style: {
|
|
239
|
-
marginHorizontal: marginHorizontal - styles.innerAppender.marginLeft
|
|
240
|
-
}
|
|
241
|
-
}, createElement(BlockListAppender, {
|
|
242
|
-
rootClientId: rootClientId,
|
|
243
|
-
renderAppender: renderAppender,
|
|
244
|
-
showSeparator: true
|
|
245
|
-
})));
|
|
246
|
-
};
|
|
247
|
-
|
|
248
166
|
const renderItem = _ref3 => {
|
|
249
167
|
let {
|
|
250
168
|
item: clientId,
|
|
@@ -274,10 +192,31 @@ export default function BlockList(_ref) {
|
|
|
274
192
|
blockWidth: blockWidth,
|
|
275
193
|
isGridItem: isGridItem
|
|
276
194
|
}, gridItemProps));
|
|
277
|
-
};
|
|
278
|
-
|
|
195
|
+
};
|
|
279
196
|
|
|
280
|
-
const
|
|
197
|
+
const {
|
|
198
|
+
blockToolbar,
|
|
199
|
+
headerToolbar,
|
|
200
|
+
floatingToolbar
|
|
201
|
+
} = styles;
|
|
202
|
+
const containerStyle = {
|
|
203
|
+
flex: isRootList ? 1 : 0,
|
|
204
|
+
// We set negative margin in the parent to remove the edge spacing between parent block and child block in ineer blocks.
|
|
205
|
+
marginVertical: isRootList ? 0 : -marginVertical,
|
|
206
|
+
marginHorizontal: isRootList ? 0 : -marginHorizontal
|
|
207
|
+
};
|
|
208
|
+
const isContentStretch = contentResizeMode === 'stretch';
|
|
209
|
+
const isMultiBlocks = blockClientIds.length > 1;
|
|
210
|
+
const {
|
|
211
|
+
isWider
|
|
212
|
+
} = alignmentHelpers;
|
|
213
|
+
const extraScrollHeight = headerToolbar.height + blockToolbar.height + (isFloatingToolbarVisible ? floatingToolbar.height : 0);
|
|
214
|
+
return createElement(View, {
|
|
215
|
+
style: containerStyle,
|
|
216
|
+
onAccessibilityEscape: clearSelectedBlock,
|
|
217
|
+
onLayout: onLayout,
|
|
218
|
+
testID: "block-list-wrapper"
|
|
219
|
+
}, isRootList ? createElement(BlockListProvider, {
|
|
281
220
|
value: { ...DEFAULT_BLOCK_LIST_CONTEXT,
|
|
282
221
|
scrollRef: scrollViewRef.current
|
|
283
222
|
}
|
|
@@ -287,27 +226,83 @@ export default function BlockList(_ref) {
|
|
|
287
226
|
let {
|
|
288
227
|
onScroll
|
|
289
228
|
} = _ref4;
|
|
290
|
-
return
|
|
291
|
-
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
229
|
+
return createElement(KeyboardAwareFlatList, _extends({}, Platform.OS === 'android' ? {
|
|
230
|
+
removeClippedSubviews: false
|
|
231
|
+
} : {}, {
|
|
232
|
+
// Disable clipping on Android to fix focus losing. See https://github.com/wordpress-mobile/gutenberg-mobile/pull/741#issuecomment-472746541
|
|
233
|
+
accessibilityLabel: "block-list",
|
|
234
|
+
innerRef: ref => {
|
|
235
|
+
scrollViewRef.current = ref;
|
|
236
|
+
},
|
|
237
|
+
extraScrollHeight: extraScrollHeight,
|
|
238
|
+
keyboardShouldPersistTaps: "always",
|
|
239
|
+
scrollViewStyle: {
|
|
240
|
+
flex: 1
|
|
241
|
+
},
|
|
242
|
+
extraData: getExtraData(),
|
|
243
|
+
scrollEnabled: isRootList,
|
|
244
|
+
contentContainerStyle: [horizontal && styles.horizontalContentContainer, isWider(blockWidth, 'medium') && (isContentStretch && isMultiBlocks ? styles.horizontalContentContainerStretch : styles.horizontalContentContainerCenter)],
|
|
245
|
+
data: blockClientIds,
|
|
246
|
+
keyExtractor: identity,
|
|
247
|
+
renderItem: renderItem,
|
|
248
|
+
CellRendererComponent: BlockListItemCell,
|
|
249
|
+
shouldPreventAutomaticScroll: shouldFlatListPreventAutomaticScroll,
|
|
250
|
+
ListHeaderComponent: header,
|
|
251
|
+
ListEmptyComponent: !isReadOnly && createElement(EmptyList, {
|
|
252
|
+
orientation: orientation,
|
|
253
|
+
rootClientId: rootClientId,
|
|
254
|
+
renderAppender: renderAppender,
|
|
255
|
+
renderFooterAppender: renderFooterAppender
|
|
256
|
+
}),
|
|
257
|
+
ListFooterComponent: createElement(Footer, {
|
|
258
|
+
addBlockToEndOfPost: addBlockToEndOfPost,
|
|
259
|
+
isReadOnly: isReadOnly,
|
|
260
|
+
renderFooterAppender: renderFooterAppender,
|
|
261
|
+
withFooter: withFooter
|
|
262
|
+
}),
|
|
263
|
+
onScroll: onScroll
|
|
264
|
+
}));
|
|
265
|
+
})) : createElement(Fragment, null, blockClientIds.length > 0 ? createElement(View, {
|
|
266
|
+
style: [{
|
|
267
|
+
flex: 0
|
|
268
|
+
}, styles.overflowVisible]
|
|
269
|
+
}, createElement(View, {
|
|
270
|
+
style: [...getStyles(isStackedHorizontally, horizontalAlignment), horizontal && styles.horizontalContentContainer]
|
|
271
|
+
}, blockClientIds.map((currentClientId, index) => {
|
|
272
|
+
return createElement(View, {
|
|
273
|
+
key: currentClientId
|
|
274
|
+
}, renderItem({
|
|
275
|
+
item: currentClientId,
|
|
276
|
+
index
|
|
277
|
+
}));
|
|
278
|
+
}), createElement(Footer, {
|
|
279
|
+
addBlockToEndOfPost: addBlockToEndOfPost,
|
|
280
|
+
isReadOnly: isReadOnly,
|
|
281
|
+
renderFooterAppender: renderFooterAppender,
|
|
282
|
+
withFooter: withFooter
|
|
283
|
+
}))) : createElement(EmptyList, {
|
|
284
|
+
orientation: orientation,
|
|
285
|
+
rootClientId: rootClientId,
|
|
286
|
+
renderAppender: renderAppender,
|
|
287
|
+
renderFooterAppender: renderFooterAppender
|
|
288
|
+
})), shouldShowInnerBlockAppender() && createElement(View, {
|
|
289
|
+
style: {
|
|
290
|
+
marginHorizontal: marginHorizontal - styles.innerAppender.marginLeft
|
|
291
|
+
}
|
|
292
|
+
}, createElement(BlockListAppender, {
|
|
293
|
+
rootClientId: rootClientId,
|
|
294
|
+
renderAppender: renderAppender,
|
|
295
|
+
showSeparator: true
|
|
296
|
+
})));
|
|
302
297
|
}
|
|
303
298
|
|
|
304
|
-
function Footer(
|
|
299
|
+
function Footer(_ref5) {
|
|
305
300
|
let {
|
|
306
301
|
addBlockToEndOfPost,
|
|
307
302
|
isReadOnly,
|
|
308
303
|
renderFooterAppender,
|
|
309
304
|
withFooter
|
|
310
|
-
} =
|
|
305
|
+
} = _ref5;
|
|
311
306
|
|
|
312
307
|
if (!isReadOnly && withFooter) {
|
|
313
308
|
return createElement(Fragment, null, createElement(TouchableWithoutFeedback, {
|
|
@@ -321,19 +316,19 @@ function Footer(_ref6) {
|
|
|
321
316
|
style: styles.blockListFooter
|
|
322
317
|
})));
|
|
323
318
|
} else if (renderFooterAppender) {
|
|
324
|
-
return renderFooterAppender();
|
|
319
|
+
return createElement(View, null, renderFooterAppender());
|
|
325
320
|
}
|
|
326
321
|
|
|
327
322
|
return null;
|
|
328
323
|
}
|
|
329
324
|
|
|
330
|
-
function EmptyList(
|
|
325
|
+
function EmptyList(_ref6) {
|
|
331
326
|
let {
|
|
332
327
|
orientation,
|
|
333
328
|
renderAppender,
|
|
334
329
|
renderFooterAppender,
|
|
335
330
|
rootClientId
|
|
336
|
-
} =
|
|
331
|
+
} = _ref6;
|
|
337
332
|
const {
|
|
338
333
|
shouldShowInsertionPoint
|
|
339
334
|
} = useSelect(select => {
|
|
@@ -352,19 +347,22 @@ function EmptyList(_ref7) {
|
|
|
352
347
|
!blockClientIds[insertionPoint.index])
|
|
353
348
|
};
|
|
354
349
|
});
|
|
350
|
+
const align = renderAppender ? WIDE_ALIGNMENTS.alignments.full : undefined;
|
|
351
|
+
const [wrapperStyles] = useEditorWrapperStyles({
|
|
352
|
+
align
|
|
353
|
+
});
|
|
355
354
|
|
|
356
355
|
if (renderFooterAppender || renderAppender === false) {
|
|
357
356
|
return null;
|
|
358
357
|
}
|
|
359
358
|
|
|
359
|
+
const containerStyles = [styles.defaultAppender, wrapperStyles];
|
|
360
360
|
return createElement(View, {
|
|
361
|
-
style:
|
|
362
|
-
}, createElement(ReadableContentView, {
|
|
363
|
-
align: renderAppender ? WIDE_ALIGNMENTS.alignments.full : undefined
|
|
361
|
+
style: containerStyles
|
|
364
362
|
}, createElement(BlockListAppender, {
|
|
365
363
|
rootClientId: rootClientId,
|
|
366
364
|
renderAppender: renderAppender,
|
|
367
365
|
showSeparator: shouldShowInsertionPoint
|
|
368
|
-
}))
|
|
366
|
+
}));
|
|
369
367
|
}
|
|
370
368
|
//# sourceMappingURL=index.native.js.map
|