@wordpress/block-editor 8.6.0 → 9.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 +11 -0
- package/README.md +5 -2
- package/build/components/block-alignment-control/constants.js +48 -0
- package/build/components/block-alignment-control/constants.js.map +1 -0
- package/build/components/block-alignment-control/ui.js +9 -40
- package/build/components/block-alignment-control/ui.js.map +1 -1
- package/build/components/block-alignment-control/ui.native.js +92 -0
- package/build/components/block-alignment-control/ui.native.js.map +1 -0
- package/build/components/block-alignment-matrix-control/index.js +1 -6
- package/build/components/block-alignment-matrix-control/index.js.map +1 -1
- package/build/components/block-content-overlay/index.js +4 -82
- package/build/components/block-content-overlay/index.js.map +1 -1
- package/build/components/block-draggable/draggable-chip.native.js +65 -0
- package/build/components/block-draggable/draggable-chip.native.js.map +1 -0
- package/build/components/block-draggable/dropping-insertion-point.native.js +157 -0
- package/build/components/block-draggable/dropping-insertion-point.native.js.map +1 -0
- package/build/components/block-draggable/index.native.js +488 -0
- package/build/components/block-draggable/index.native.js.map +1 -0
- package/build/components/block-draggable/use-scroll-when-dragging.native.js +130 -0
- package/build/components/block-draggable/use-scroll-when-dragging.native.js.map +1 -0
- package/build/components/block-list/block-list-context.native.js +195 -0
- package/build/components/block-list/block-list-context.native.js.map +1 -0
- package/build/components/block-list/block-list-item-cell.native.js +67 -0
- package/build/components/block-list/block-list-item-cell.native.js.map +1 -0
- package/build/components/block-list/block-list-item.native.js +12 -9
- package/build/components/block-list/block-list-item.native.js.map +1 -1
- package/build/components/block-list/block.native.js +27 -5
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-list/index.js +34 -32
- package/build/components/block-list/index.js.map +1 -1
- package/build/components/block-list/index.native.js +75 -23
- package/build/components/block-list/index.native.js.map +1 -1
- package/build/components/block-list/use-block-props/index.js +8 -4
- package/build/components/block-list/use-block-props/index.js.map +1 -1
- package/build/components/block-list/use-block-props/use-block-class-names.js +1 -7
- package/build/components/block-list/use-block-props/use-block-class-names.js.map +1 -1
- package/build/components/block-list/use-in-between-inserter.js +1 -1
- package/build/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build/components/block-mobile-toolbar/index.native.js +10 -3
- package/build/components/block-mobile-toolbar/index.native.js.map +1 -1
- package/build/components/block-mover/index.native.js +17 -4
- package/build/components/block-mover/index.native.js.map +1 -1
- package/build/components/block-navigation/dropdown.js +11 -5
- package/build/components/block-navigation/dropdown.js.map +1 -1
- package/build/components/block-popover/inbetween.js +19 -8
- package/build/components/block-popover/inbetween.js.map +1 -1
- package/build/components/block-popover/index.js +20 -16
- package/build/components/block-popover/index.js.map +1 -1
- package/build/components/block-preview/index.js +1 -1
- package/build/components/block-preview/index.js.map +1 -1
- package/build/components/block-tools/block-selection-button.js +1 -0
- package/build/components/block-tools/block-selection-button.js.map +1 -1
- package/build/components/block-tools/selected-block-popover.js +1 -29
- package/build/components/block-tools/selected-block-popover.js.map +1 -1
- package/build/components/block-variation-transforms/index.js +16 -2
- package/build/components/block-variation-transforms/index.js.map +1 -1
- package/build/components/border-radius-control/input-controls.js +10 -3
- package/build/components/border-radius-control/input-controls.js.map +1 -1
- package/build/components/color-style-selector/index.js +9 -0
- package/build/components/color-style-selector/index.js.map +1 -1
- package/build/components/colors-gradients/dropdown.js +122 -41
- package/build/components/colors-gradients/dropdown.js.map +1 -1
- package/build/components/colors-gradients/panel-color-gradient-settings.js +35 -60
- package/build/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
- package/build/components/convert-to-group-buttons/toolbar.js +22 -5
- package/build/components/convert-to-group-buttons/toolbar.js.map +1 -1
- package/build/components/iframe/index.js +51 -50
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/image-editor/use-save-image.js +3 -1
- package/build/components/image-editor/use-save-image.js.map +1 -1
- package/build/components/index.js +14 -23
- package/build/components/index.js.map +1 -1
- package/build/components/inserter/index.js +21 -7
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/inserter/index.native.js +2 -2
- package/build/components/inserter/index.native.js.map +1 -1
- package/build/components/inserter/quick-inserter.js +4 -5
- package/build/components/inserter/quick-inserter.js.map +1 -1
- package/build/components/link-control/constants.js +11 -1
- package/build/components/link-control/constants.js.map +1 -1
- package/build/components/link-control/search-results.js +4 -3
- package/build/components/link-control/search-results.js.map +1 -1
- package/build/components/link-control/use-search-handler.js +4 -4
- package/build/components/link-control/use-search-handler.js.map +1 -1
- package/build/components/list-view/block.js +15 -15
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/branch.js +9 -13
- package/build/components/list-view/branch.js.map +1 -1
- package/build/components/list-view/context.js +1 -4
- package/build/components/list-view/context.js.map +1 -1
- package/build/components/list-view/drop-indicator.js +0 -1
- package/build/components/list-view/drop-indicator.js.map +1 -1
- package/build/components/list-view/index.js +15 -32
- package/build/components/list-view/index.js.map +1 -1
- package/build/components/media-placeholder/index.js +0 -2
- package/build/components/media-placeholder/index.js.map +1 -1
- package/build/components/media-replace-flow/index.js +0 -2
- package/build/components/media-replace-flow/index.js.map +1 -1
- package/build/components/media-upload/index.native.js +10 -4
- package/build/components/media-upload/index.native.js.map +1 -1
- package/build/components/navigable-toolbar/index.js +12 -2
- package/build/components/navigable-toolbar/index.js.map +1 -1
- package/build/components/plain-text/index.native.js +62 -7
- package/build/components/plain-text/index.native.js.map +1 -1
- package/build/components/publish-date-time-picker/index.js +55 -0
- package/build/components/publish-date-time-picker/index.js.map +1 -0
- package/build/components/rich-text/format-toolbar-container.js +0 -1
- package/build/components/rich-text/format-toolbar-container.js.map +1 -1
- package/build/components/rich-text/index.js +2 -2
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/index.native.js +5 -1
- package/build/components/rich-text/index.native.js.map +1 -1
- package/build/components/url-input/index.js +11 -4
- package/build/components/url-input/index.js.map +1 -1
- package/build/components/use-block-drop-zone/index.native.js +167 -0
- package/build/components/use-block-drop-zone/index.native.js.map +1 -0
- package/build/components/use-on-block-drop/index.native.js +95 -0
- package/build/components/use-on-block-drop/index.native.js.map +1 -0
- package/build/components/use-setting/index.js +42 -18
- package/build/components/use-setting/index.js.map +1 -1
- package/build/components/warning/index.js +6 -1
- package/build/components/warning/index.js.map +1 -1
- package/build/components/writing-flow/use-click-selection.js +1 -3
- package/build/components/writing-flow/use-click-selection.js.map +1 -1
- package/build/components/writing-flow/use-input.js +15 -0
- package/build/components/writing-flow/use-input.js.map +1 -1
- package/build/components/writing-flow/use-selection-observer.js +49 -8
- package/build/components/writing-flow/use-selection-observer.js.map +1 -1
- package/build/elements/index.js +9 -0
- package/build/elements/index.js.map +1 -0
- package/build/hooks/anchor.js.map +1 -1
- package/build/hooks/border.js +2 -7
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/color-panel.js +14 -7
- package/build/hooks/color-panel.js.map +1 -1
- package/build/hooks/color.js +8 -88
- package/build/hooks/color.js.map +1 -1
- package/build/hooks/dimensions.js +16 -6
- package/build/hooks/dimensions.js.map +1 -1
- package/build/hooks/index.js +2 -0
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/margin.js +64 -12
- package/build/hooks/margin.js.map +1 -1
- package/build/hooks/padding.js +60 -12
- package/build/hooks/padding.js.map +1 -1
- package/build/hooks/settings.js +32 -0
- package/build/hooks/settings.js.map +1 -0
- package/build/hooks/style.js +14 -13
- package/build/hooks/style.js.map +1 -1
- package/build/hooks/typography.js +6 -2
- package/build/hooks/typography.js.map +1 -1
- package/build/index.js +14 -0
- package/build/index.js.map +1 -1
- package/build/layouts/flex.js +5 -2
- package/build/layouts/flex.js.map +1 -1
- package/build/store/actions.js +14 -0
- package/build/store/actions.js.map +1 -1
- package/build/store/defaults.js +0 -1
- package/build/store/defaults.js.map +1 -1
- package/build/store/reducer.js +17 -2
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +43 -13
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/block-alignment-control/constants.js +36 -0
- package/build-module/components/block-alignment-control/constants.js.map +1 -0
- package/build-module/components/block-alignment-control/ui.js +4 -35
- package/build-module/components/block-alignment-control/ui.js.map +1 -1
- package/build-module/components/block-alignment-control/ui.native.js +78 -0
- package/build-module/components/block-alignment-control/ui.native.js.map +1 -0
- package/build-module/components/block-alignment-matrix-control/index.js +1 -6
- package/build-module/components/block-alignment-matrix-control/index.js.map +1 -1
- package/build-module/components/block-content-overlay/index.js +3 -78
- package/build-module/components/block-content-overlay/index.js.map +1 -1
- package/build-module/components/block-draggable/draggable-chip.native.js +51 -0
- package/build-module/components/block-draggable/draggable-chip.native.js.map +1 -0
- package/build-module/components/block-draggable/dropping-insertion-point.native.js +137 -0
- package/build-module/components/block-draggable/dropping-insertion-point.native.js.map +1 -0
- package/build-module/components/block-draggable/index.native.js +453 -0
- package/build-module/components/block-draggable/index.native.js.map +1 -0
- package/build-module/components/block-draggable/use-scroll-when-dragging.native.js +120 -0
- package/build-module/components/block-draggable/use-scroll-when-dragging.native.js.map +1 -0
- package/build-module/components/block-list/block-list-context.native.js +179 -0
- package/build-module/components/block-list/block-list-context.native.js.map +1 -0
- package/build-module/components/block-list/block-list-item-cell.native.js +59 -0
- package/build-module/components/block-list/block-list-item-cell.native.js.map +1 -0
- package/build-module/components/block-list/block-list-item.native.js +12 -9
- package/build-module/components/block-list/block-list-item.native.js.map +1 -1
- package/build-module/components/block-list/block.native.js +26 -5
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-list/index.js +35 -33
- package/build-module/components/block-list/index.js.map +1 -1
- package/build-module/components/block-list/index.native.js +72 -23
- package/build-module/components/block-list/index.native.js.map +1 -1
- package/build-module/components/block-list/use-block-props/index.js +9 -5
- package/build-module/components/block-list/use-block-props/index.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-block-class-names.js +1 -7
- package/build-module/components/block-list/use-block-props/use-block-class-names.js.map +1 -1
- package/build-module/components/block-list/use-in-between-inserter.js +1 -1
- package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build-module/components/block-mobile-toolbar/index.native.js +9 -3
- package/build-module/components/block-mobile-toolbar/index.native.js.map +1 -1
- package/build-module/components/block-mover/index.native.js +18 -5
- package/build-module/components/block-mover/index.native.js.map +1 -1
- package/build-module/components/block-navigation/dropdown.js +10 -5
- package/build-module/components/block-navigation/dropdown.js.map +1 -1
- package/build-module/components/block-popover/inbetween.js +19 -8
- package/build-module/components/block-popover/inbetween.js.map +1 -1
- package/build-module/components/block-popover/index.js +21 -15
- package/build-module/components/block-popover/index.js.map +1 -1
- package/build-module/components/block-preview/index.js +1 -1
- package/build-module/components/block-preview/index.js.map +1 -1
- package/build-module/components/block-tools/block-selection-button.js +1 -0
- package/build-module/components/block-tools/block-selection-button.js.map +1 -1
- package/build-module/components/block-tools/selected-block-popover.js +2 -29
- package/build-module/components/block-tools/selected-block-popover.js.map +1 -1
- package/build-module/components/block-variation-transforms/index.js +13 -2
- package/build-module/components/block-variation-transforms/index.js.map +1 -1
- package/build-module/components/border-radius-control/input-controls.js +11 -4
- package/build-module/components/border-radius-control/input-controls.js.map +1 -1
- package/build-module/components/color-style-selector/index.js +6 -0
- package/build-module/components/color-style-selector/index.js.map +1 -1
- package/build-module/components/colors-gradients/dropdown.js +124 -43
- package/build-module/components/colors-gradients/dropdown.js.map +1 -1
- package/build-module/components/colors-gradients/panel-color-gradient-settings.js +36 -64
- package/build-module/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
- package/build-module/components/convert-to-group-buttons/toolbar.js +23 -6
- package/build-module/components/convert-to-group-buttons/toolbar.js.map +1 -1
- package/build-module/components/iframe/index.js +52 -51
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/image-editor/use-save-image.js +2 -1
- package/build-module/components/image-editor/use-save-image.js.map +1 -1
- package/build-module/components/index.js +2 -3
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/inserter/index.js +21 -7
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/inserter/index.native.js +2 -2
- package/build-module/components/inserter/index.native.js.map +1 -1
- package/build-module/components/inserter/quick-inserter.js +4 -5
- package/build-module/components/inserter/quick-inserter.js.map +1 -1
- package/build-module/components/link-control/constants.js +5 -0
- package/build-module/components/link-control/constants.js.map +1 -1
- package/build-module/components/link-control/search-results.js +3 -4
- package/build-module/components/link-control/search-results.js.map +1 -1
- package/build-module/components/link-control/use-search-handler.js +5 -5
- package/build-module/components/link-control/use-search-handler.js.map +1 -1
- package/build-module/components/list-view/block.js +15 -16
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/branch.js +9 -13
- package/build-module/components/list-view/branch.js.map +1 -1
- package/build-module/components/list-view/context.js +1 -4
- package/build-module/components/list-view/context.js.map +1 -1
- package/build-module/components/list-view/drop-indicator.js +0 -1
- package/build-module/components/list-view/drop-indicator.js.map +1 -1
- package/build-module/components/list-view/index.js +15 -31
- package/build-module/components/list-view/index.js.map +1 -1
- package/build-module/components/media-placeholder/index.js +0 -2
- package/build-module/components/media-placeholder/index.js.map +1 -1
- package/build-module/components/media-replace-flow/index.js +0 -2
- package/build-module/components/media-replace-flow/index.js.map +1 -1
- package/build-module/components/media-upload/index.native.js +8 -3
- package/build-module/components/media-upload/index.native.js.map +1 -1
- package/build-module/components/navigable-toolbar/index.js +12 -2
- package/build-module/components/navigable-toolbar/index.js.map +1 -1
- package/build-module/components/plain-text/index.native.js +63 -8
- package/build-module/components/plain-text/index.native.js.map +1 -1
- package/build-module/components/publish-date-time-picker/index.js +42 -0
- package/build-module/components/publish-date-time-picker/index.js.map +1 -0
- package/build-module/components/rich-text/format-toolbar-container.js +0 -1
- package/build-module/components/rich-text/format-toolbar-container.js.map +1 -1
- package/build-module/components/rich-text/index.js +2 -2
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/index.native.js +5 -1
- package/build-module/components/rich-text/index.native.js.map +1 -1
- package/build-module/components/url-input/index.js +11 -4
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/components/use-block-drop-zone/index.native.js +148 -0
- package/build-module/components/use-block-drop-zone/index.native.js.map +1 -0
- package/build-module/components/use-on-block-drop/index.native.js +83 -0
- package/build-module/components/use-on-block-drop/index.native.js.map +1 -0
- package/build-module/components/use-setting/index.js +43 -19
- package/build-module/components/use-setting/index.js.map +1 -1
- package/build-module/components/warning/index.js +6 -1
- package/build-module/components/warning/index.js.map +1 -1
- package/build-module/components/writing-flow/use-click-selection.js +1 -3
- package/build-module/components/writing-flow/use-click-selection.js.map +1 -1
- package/build-module/components/writing-flow/use-input.js +15 -0
- package/build-module/components/writing-flow/use-input.js.map +1 -1
- package/build-module/components/writing-flow/use-selection-observer.js +49 -8
- package/build-module/components/writing-flow/use-selection-observer.js.map +1 -1
- package/build-module/elements/index.js +2 -0
- package/build-module/elements/index.js.map +1 -0
- package/build-module/hooks/anchor.js.map +1 -1
- package/build-module/hooks/border.js +2 -7
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/color-panel.js +11 -6
- package/build-module/hooks/color-panel.js.map +1 -1
- package/build-module/hooks/color.js +8 -88
- package/build-module/hooks/color.js.map +1 -1
- package/build-module/hooks/dimensions.js +19 -9
- package/build-module/hooks/dimensions.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/margin.js +61 -13
- package/build-module/hooks/margin.js.map +1 -1
- package/build-module/hooks/padding.js +57 -13
- package/build-module/hooks/padding.js.map +1 -1
- package/build-module/hooks/settings.js +29 -0
- package/build-module/hooks/settings.js.map +1 -0
- package/build-module/hooks/style.js +15 -14
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/hooks/typography.js +6 -2
- package/build-module/hooks/typography.js.map +1 -1
- package/build-module/index.js +1 -0
- package/build-module/index.js.map +1 -1
- package/build-module/layouts/flex.js +4 -2
- package/build-module/layouts/flex.js.map +1 -1
- package/build-module/store/actions.js +12 -0
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/defaults.js +0 -1
- package/build-module/store/defaults.js.map +1 -1
- package/build-module/store/reducer.js +17 -2
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +37 -12
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +100 -225
- package/build-style/style.css +100 -225
- package/package.json +30 -30
- package/src/components/block-alignment-control/constants.js +45 -0
- package/src/components/block-alignment-control/ui.js +69 -109
- package/src/components/block-alignment-control/ui.native.js +86 -0
- package/src/components/block-alignment-matrix-control/index.js +1 -5
- package/src/components/block-content-overlay/index.js +8 -95
- package/src/components/block-content-overlay/style.scss +2 -12
- package/src/components/block-draggable/draggable-chip.native.js +49 -0
- package/src/components/block-draggable/dropping-insertion-point.native.js +181 -0
- package/src/components/block-draggable/dropping-insertion-point.native.scss +8 -0
- package/src/components/block-draggable/index.native.js +462 -0
- package/src/components/block-draggable/style.native.scss +19 -0
- package/src/components/block-draggable/test/__snapshots__/index.native.js.snap +73 -0
- package/src/components/block-draggable/test/helpers.native.js +183 -0
- package/src/components/block-draggable/test/index.native.js +496 -0
- package/src/components/block-draggable/use-scroll-when-dragging.native.js +135 -0
- package/src/components/block-list/block-list-context.native.js +175 -0
- package/src/components/block-list/block-list-item-cell.native.js +49 -0
- package/src/components/block-list/block-list-item.native.js +7 -11
- package/src/components/block-list/block.native.js +37 -8
- package/src/components/block-list/index.js +44 -44
- package/src/components/block-list/index.native.js +54 -13
- package/src/components/block-list/style.scss +7 -18
- package/src/components/block-list/test/block-list-context.native.js +253 -0
- package/src/components/block-list/test/fixtures/block-list-context.native.js +79 -0
- package/src/components/block-list/use-block-props/index.js +10 -5
- package/src/components/block-list/use-block-props/use-block-class-names.js +1 -11
- package/src/components/block-list/use-in-between-inserter.js +1 -1
- package/src/components/block-mobile-toolbar/index.native.js +9 -1
- package/src/components/block-mover/index.native.js +22 -6
- package/src/components/block-mover/test/__snapshots__/index.native.js.snap +10 -0
- package/src/components/block-navigation/dropdown.js +12 -8
- package/src/components/block-popover/inbetween.js +21 -8
- package/src/components/block-popover/index.js +18 -15
- package/src/components/block-popover/style.scss +4 -0
- package/src/components/block-preview/index.js +1 -4
- package/src/components/block-switcher/style.scss +2 -39
- package/src/components/block-tools/block-selection-button.js +1 -0
- package/src/components/block-tools/selected-block-popover.js +1 -36
- package/src/components/block-tools/style.scss +1 -12
- package/src/components/block-variation-transforms/index.js +6 -2
- package/src/components/border-radius-control/input-controls.js +16 -8
- package/src/components/border-radius-control/style.scss +3 -2
- package/src/components/color-palette/test/__snapshots__/control.js.snap +1 -1
- package/src/components/color-style-selector/index.js +18 -9
- package/src/components/colors-gradients/dropdown.js +130 -62
- package/src/components/colors-gradients/panel-color-gradient-settings.js +30 -76
- package/src/components/colors-gradients/style.scss +52 -50
- package/src/components/convert-to-group-buttons/toolbar.js +30 -13
- package/src/components/duotone-control/style.scss +1 -7
- package/src/components/iframe/index.js +62 -54
- package/src/components/image-editor/use-save-image.js +2 -1
- package/src/components/image-size-control/README.md +1 -1
- package/src/components/index.js +2 -3
- package/src/components/inserter/index.js +20 -0
- package/src/components/inserter/index.native.js +2 -2
- package/src/components/inserter/quick-inserter.js +3 -11
- package/src/components/inserter/style.native.scss +1 -0
- package/src/components/inserter/style.scss +2 -1
- package/src/components/link-control/constants.js +11 -0
- package/src/components/link-control/search-results.js +4 -5
- package/src/components/link-control/use-search-handler.js +11 -5
- package/src/components/list-view/block.js +24 -34
- package/src/components/list-view/branch.js +10 -20
- package/src/components/list-view/context.js +1 -4
- package/src/components/list-view/drop-indicator.js +0 -1
- package/src/components/list-view/index.js +11 -41
- package/src/components/list-view/style.scss +2 -1
- package/src/components/media-placeholder/index.js +0 -2
- package/src/components/media-replace-flow/index.js +0 -2
- package/src/components/media-upload/index.native.js +6 -2
- package/src/components/media-upload/test/index.native.js +31 -6
- package/src/components/navigable-toolbar/index.js +12 -2
- package/src/components/plain-text/index.native.js +64 -8
- package/src/components/preview-options/style.scss +0 -4
- package/src/components/publish-date-time-picker/README.md +52 -0
- package/src/components/publish-date-time-picker/index.js +50 -0
- package/src/components/publish-date-time-picker/style.scss +20 -0
- package/src/components/rich-text/format-toolbar-container.js +0 -1
- package/src/components/rich-text/index.js +3 -1
- package/src/components/rich-text/index.native.js +4 -0
- package/src/components/rich-text/style.scss +2 -8
- package/src/components/url-input/index.js +9 -4
- package/src/components/use-block-drop-zone/index.native.js +173 -0
- package/src/components/use-on-block-drop/index.native.js +119 -0
- package/src/components/use-setting/index.js +57 -21
- package/src/components/warning/index.js +47 -42
- package/src/components/warning/test/__snapshots__/index.js.snap +15 -6
- package/src/components/warning/test/index.js +1 -1
- package/src/components/writing-flow/use-click-selection.js +1 -4
- package/src/components/writing-flow/use-input.js +12 -0
- package/src/components/writing-flow/use-selection-observer.js +55 -10
- package/src/elements/index.js +1 -0
- package/src/hooks/anchor.js +1 -1
- package/src/hooks/border.js +2 -11
- package/src/hooks/border.scss +0 -48
- package/src/hooks/color-panel.js +13 -9
- package/src/hooks/color.js +5 -74
- package/src/hooks/color.scss +5 -58
- package/src/hooks/dimensions.js +55 -41
- package/src/hooks/index.js +1 -0
- package/src/hooks/margin.js +64 -15
- package/src/hooks/padding.js +60 -15
- package/src/hooks/padding.scss +12 -0
- package/src/hooks/settings.js +32 -0
- package/src/hooks/style.js +25 -39
- package/src/hooks/test/settings.js +48 -0
- package/src/hooks/typography.js +2 -0
- package/src/index.js +1 -0
- package/src/layouts/flex.js +11 -3
- package/src/store/actions.js +12 -0
- package/src/store/defaults.js +0 -1
- package/src/store/reducer.js +14 -1
- package/src/store/selectors.js +42 -12
- package/src/store/test/reducer.js +5 -0
- package/src/store/test/selectors.js +17 -0
- package/src/style.scss +2 -2
- package/tsconfig.tsbuildinfo +1 -1
- package/build/components/border-style-control/index.js +0 -60
- package/build/components/border-style-control/index.js.map +0 -1
- package/build/components/colors/color-panel.js +0 -82
- package/build/components/colors/color-panel.js.map +0 -1
- package/build/components/colors/color-panel.native.js +0 -11
- package/build/components/colors/color-panel.native.js.map +0 -1
- package/build/components/colors-gradients/tools-panel-color-dropdown.js +0 -89
- package/build/components/colors-gradients/tools-panel-color-dropdown.js.map +0 -1
- package/build-module/components/border-style-control/index.js +0 -50
- package/build-module/components/border-style-control/index.js.map +0 -1
- package/build-module/components/colors/color-panel.js +0 -70
- package/build-module/components/colors/color-panel.js.map +0 -1
- package/build-module/components/colors/color-panel.native.js +0 -4
- package/build-module/components/colors/color-panel.native.js.map +0 -1
- package/build-module/components/colors-gradients/tools-panel-color-dropdown.js +0 -75
- package/build-module/components/colors-gradients/tools-panel-color-dropdown.js.map +0 -1
- package/src/components/block-alignment-matrix-control/style.scss +0 -10
- package/src/components/border-style-control/index.js +0 -47
- package/src/components/border-style-control/style.scss +0 -18
- package/src/components/colors/color-panel.js +0 -91
- package/src/components/colors/color-panel.native.js +0 -3
- package/src/components/colors-gradients/tools-panel-color-dropdown.js +0 -85
|
@@ -35,6 +35,8 @@ var _blockMobileToolbar = _interopRequireDefault(require("../block-mobile-toolba
|
|
|
35
35
|
|
|
36
36
|
var _store = require("../../store");
|
|
37
37
|
|
|
38
|
+
var _blockDraggable = _interopRequireDefault(require("../block-draggable"));
|
|
39
|
+
|
|
38
40
|
/**
|
|
39
41
|
* External dependencies
|
|
40
42
|
*/
|
|
@@ -195,7 +197,9 @@ class BlockListBlock extends _element.Component {
|
|
|
195
197
|
marginVertical,
|
|
196
198
|
marginHorizontal,
|
|
197
199
|
isInnerBlockSelected,
|
|
198
|
-
name
|
|
200
|
+
name,
|
|
201
|
+
draggingEnabled,
|
|
202
|
+
draggingClientId
|
|
199
203
|
} = this.props;
|
|
200
204
|
|
|
201
205
|
if (!attributes || !blockType) {
|
|
@@ -240,10 +244,15 @@ class BlockListBlock extends _element.Component {
|
|
|
240
244
|
style: [_block.default.solidBorder, isFullWidth(align) && isScreenWidthWider && _block.default.borderFullWidth, isFullWidth(align) && isContainerRelated(name) && isScreenWidthWider && _block.default.containerBorderFullWidth, getStylesFromColorScheme(_block.default.solidBorderColor, _block.default.solidBorderColorDark)]
|
|
241
245
|
}), isParentSelected && (0, _element.createElement)(_reactNative.View, {
|
|
242
246
|
style: [_block.default.dashedBorder, getStylesFromColorScheme(_block.default.dashedBorderColor, _block.default.dashedBorderColorDark)]
|
|
243
|
-
}),
|
|
247
|
+
}), (0, _element.createElement)(_blockDraggable.default, {
|
|
248
|
+
clientId: clientId,
|
|
249
|
+
draggingClientId: draggingClientId,
|
|
250
|
+
enabled: draggingEnabled,
|
|
251
|
+
testID: "draggable-trigger-content"
|
|
252
|
+
}, () => isValid ? this.getBlockForType() : (0, _element.createElement)(_blockInvalidWarning.default, {
|
|
244
253
|
blockTitle: title,
|
|
245
254
|
icon: icon
|
|
246
|
-
}), (0, _element.createElement)(_reactNative.View, {
|
|
255
|
+
})), (0, _element.createElement)(_reactNative.View, {
|
|
247
256
|
style: _block.default.neutralToolbar,
|
|
248
257
|
ref: this.anchorNodeRef
|
|
249
258
|
}, isSelected && (0, _element.createElement)(_blockMobileToolbar.default, {
|
|
@@ -252,7 +261,8 @@ class BlockListBlock extends _element.Component {
|
|
|
252
261
|
isStackedHorizontally: isStackedHorizontally,
|
|
253
262
|
blockWidth: blockWidth,
|
|
254
263
|
anchorNodeRef: this.anchorNodeRef.current,
|
|
255
|
-
isFullWidth: isFullWidthToolbar
|
|
264
|
+
isFullWidth: isFullWidthToolbar,
|
|
265
|
+
draggingClientId: draggingClientId
|
|
256
266
|
})))));
|
|
257
267
|
}
|
|
258
268
|
|
|
@@ -286,13 +296,15 @@ var _default = (0, _compose.compose)([(0, _data.withSelect)((select, _ref3) => {
|
|
|
286
296
|
} = _ref3;
|
|
287
297
|
const {
|
|
288
298
|
getBlockIndex,
|
|
299
|
+
getBlockCount,
|
|
289
300
|
getSettings,
|
|
290
301
|
isBlockSelected,
|
|
291
302
|
getBlock,
|
|
292
303
|
getSelectedBlockClientId,
|
|
293
304
|
getLowestCommonAncestorWithSelectedBlock,
|
|
294
305
|
getBlockParents,
|
|
295
|
-
hasSelectedInnerBlock
|
|
306
|
+
hasSelectedInnerBlock,
|
|
307
|
+
getBlockHierarchyRootClientId
|
|
296
308
|
} = select(_store.store);
|
|
297
309
|
const order = getBlockIndex(clientId);
|
|
298
310
|
const isSelected = isBlockSelected(clientId);
|
|
@@ -318,6 +330,14 @@ var _default = (0, _compose.compose)([(0, _data.withSelect)((select, _ref3) => {
|
|
|
318
330
|
const isDescendantOfParentSelected = selectedParents.includes(parentId);
|
|
319
331
|
const isTouchable = isSelected || isDescendantOfParentSelected || isParentSelected || parentId === '';
|
|
320
332
|
const baseGlobalStyles = (_getSettings = getSettings()) === null || _getSettings === void 0 ? void 0 : _getSettings.__experimentalGlobalStylesBaseStyles;
|
|
333
|
+
const hasInnerBlocks = getBlockCount(clientId) > 0; // For blocks with inner blocks, we only enable the dragging in the nested
|
|
334
|
+
// blocks if any of them are selected. This way we prevent the long-press
|
|
335
|
+
// gesture from being disabled for elements within the block UI.
|
|
336
|
+
|
|
337
|
+
const draggingEnabled = !hasInnerBlocks || isSelected || !hasSelectedInnerBlock(clientId, true); // Dragging nested blocks is not supported yet. For this reason, the block to be dragged
|
|
338
|
+
// will be the top in the hierarchy.
|
|
339
|
+
|
|
340
|
+
const draggingClientId = getBlockHierarchyRootClientId(clientId);
|
|
321
341
|
return {
|
|
322
342
|
icon,
|
|
323
343
|
name: name || 'core/missing',
|
|
@@ -325,6 +345,8 @@ var _default = (0, _compose.compose)([(0, _data.withSelect)((select, _ref3) => {
|
|
|
325
345
|
title,
|
|
326
346
|
attributes,
|
|
327
347
|
blockType,
|
|
348
|
+
draggingClientId,
|
|
349
|
+
draggingEnabled,
|
|
328
350
|
isSelected,
|
|
329
351
|
isInnerBlockSelected,
|
|
330
352
|
isValid,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/block-list/block.native.js"],"names":["emptyArray","BlockForType","attributes","clientId","contentStyle","getBlockWidth","insertBlocksAfter","isSelected","mergeBlocks","name","onBlockFocus","onChange","onDeleteBlock","onReplace","parentWidth","parentBlockAlignment","wrapperProps","blockWidth","baseGlobalStyles","defaultColors","fontSizes","globalStyle","mergedStyle","style","JSON","stringify","GlobalStylesContext","BLOCK_STYLE_ATTRIBUTES","BlockListBlock","Component","constructor","arguments","bind","onFocus","state","props","marginHorizontal","anchorNodeRef","firstToSelectId","onSelect","blocks","onInsertBlocks","order","nativeEvent","layout","layoutWidth","Math","floor","width","setState","getBlockForType","renderBlockTitle","styles","blockTitle","render","blockType","icon","isValid","title","isDimmed","isTouchable","isStackedHorizontally","isParentSelected","getStylesFromColorScheme","marginVertical","isInnerBlockSelected","align","accessibilityLabel","isFullWidth","isContainerRelated","alignmentHelpers","accessible","screenWidth","Dimensions","get","isScreenWidthEqual","isScreenWidthWider","isFullWidthToolbar","flex","dimmed","solidBorder","borderFullWidth","containerBorderFullWidth","solidBorderColor","solidBorderColorDark","dashedBorder","dashedBorderColor","dashedBorderColorDark","neutralToolbar","current","wrapperPropsCache","WeakMap","emptyObj","getWrapperProps","value","getWrapperPropsFunction","cachedValue","set","select","getBlockIndex","getSettings","isBlockSelected","getBlock","getSelectedBlockClientId","getLowestCommonAncestorWithSelectedBlock","getBlockParents","hasSelectedInnerBlock","blockEditorStore","block","parents","parentId","selectedBlockClientId","commonAncestor","commonAncestorIndex","indexOf","length","selectedParents","isDescendantOfParentSelected","includes","__experimentalGlobalStylesBaseStyles","getEditWrapperProps","dispatch","ownProps","insertBlocks","replaceBlocks","selectBlock","updateBlockAttributes","forward","getPreviousBlockClientId","getNextBlockClientId","nextBlockClientId","previousBlockClientId","index","rootClientId","initialPosition","indexToSelect","withPreferredColorScheme"],"mappings":";;;;;;;;;AASA;;;;AANA;;AACA;;AAMA;;AAOA;;AACA;;AACA;;AAIA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AAhCA;AACA;AACA;;AAIA;AACA;AACA;;AAiBA;AACA;AACA;AAOA,MAAMA,UAAU,GAAG,EAAnB;;AACA,SAASC,YAAT,OAkBI;AAAA,MAlBmB;AACtBC,IAAAA,UADsB;AAEtBC,IAAAA,QAFsB;AAGtBC,IAAAA,YA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,QAAQ,EAAIT,UAAF,IAAkB;AAC3B4H,MAAAA,qBAAqB,CAAEJ,QAAQ,CAACvH,QAAX,EAAqBD,UAArB,CAArB;AACA,KA9BK;;AA+BNW,IAAAA,SAAS,CAAE2B,MAAF,EAAU+F,aAAV,EAA0B;AAClCX,MAAAA,aAAa,CAAE,CAAEF,QAAQ,CAACvH,QAAX,CAAF,EAAyBqC,MAAzB,EAAiC+F,aAAjC,CAAb;AACA;;AAjCK,GAAP;AAmCA,CA5CD,CA3EuB,EAwHvBC,iCAxHuB,CAAT,EAyHV5G,cAzHU,C","sourcesContent":["/**\n * External dependencies\n */\nimport { View, Text, TouchableWithoutFeedback, Dimensions } from 'react-native';\nimport { pick } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { Component, createRef, useMemo } from '@wordpress/element';\nimport {\n\tGlobalStylesContext,\n\tgetMergedGlobalStyles,\n\tuseMobileGlobalStylesColors,\n\talignmentHelpers,\n\tuseGlobalStyles,\n} from '@wordpress/components';\nimport { withDispatch, withSelect } from '@wordpress/data';\nimport { compose, withPreferredColorScheme } from '@wordpress/compose';\nimport {\n\tgetBlockType,\n\t__experimentalGetAccessibleBlockLabel as getAccessibleBlockLabel,\n} from '@wordpress/blocks';\nimport { useSetting } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport styles from './block.scss';\nimport BlockEdit from '../block-edit';\nimport BlockInvalidWarning from './block-invalid-warning';\nimport BlockMobileToolbar from '../block-mobile-toolbar';\nimport { store as blockEditorStore } from '../../store';\n\nconst emptyArray = [];\nfunction BlockForType( {\n\tattributes,\n\tclientId,\n\tcontentStyle,\n\tgetBlockWidth,\n\tinsertBlocksAfter,\n\tisSelected,\n\tmergeBlocks,\n\tname,\n\tonBlockFocus,\n\tonChange,\n\tonDeleteBlock,\n\tonReplace,\n\tparentWidth,\n\tparentBlockAlignment,\n\twrapperProps,\n\tblockWidth,\n\tbaseGlobalStyles,\n} ) {\n\tconst defaultColors = useMobileGlobalStylesColors();\n\tconst fontSizes = useSetting( 'typography.fontSizes' ) || emptyArray;\n\tconst globalStyle = useGlobalStyles();\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}, [\n\t\tdefaultColors,\n\t\tglobalStyle,\n\t\t// I couldn't simply use attributes and wrapperProps.styles as a dependency because they are almost always a new reference.\n\t\t// Thanks to the JSON.stringify we check if the value is the same instead of reference.\n\t\tJSON.stringify( wrapperProps.style ),\n\t\tJSON.stringify(\n\t\t\tpick( attributes, GlobalStylesContext.BLOCK_STYLE_ATTRIBUTES )\n\t\t),\n\t] );\n\n\treturn (\n\t\t<GlobalStylesContext.Provider value={ mergedStyle }>\n\t\t\t<BlockEdit\n\t\t\t\tname={ name }\n\t\t\t\tisSelected={ isSelected }\n\t\t\t\tattributes={ attributes }\n\t\t\t\tsetAttributes={ onChange }\n\t\t\t\tonFocus={ onBlockFocus }\n\t\t\t\tonReplace={ onReplace }\n\t\t\t\tinsertBlocksAfter={ insertBlocksAfter }\n\t\t\t\tmergeBlocks={ mergeBlocks }\n\t\t\t\t// Block level styles.\n\t\t\t\twrapperProps={ wrapperProps }\n\t\t\t\t// Inherited styles merged with block level styles.\n\t\t\t\tstyle={ mergedStyle }\n\t\t\t\tclientId={ clientId }\n\t\t\t\tparentWidth={ parentWidth }\n\t\t\t\tcontentStyle={ contentStyle }\n\t\t\t\tonDeleteBlock={ onDeleteBlock }\n\t\t\t\tblockWidth={ blockWidth }\n\t\t\t\tparentBlockAlignment={ parentBlockAlignment }\n\t\t\t/>\n\t\t\t<View onLayout={ getBlockWidth } />\n\t\t</GlobalStylesContext.Provider>\n\t);\n}\n\nclass BlockListBlock extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\n\t\tthis.insertBlocksAfter = this.insertBlocksAfter.bind( this );\n\t\tthis.onFocus = this.onFocus.bind( this );\n\t\tthis.getBlockWidth = this.getBlockWidth.bind( this );\n\n\t\tthis.state = {\n\t\t\tblockWidth: this.props.blockWidth - 2 * this.props.marginHorizontal,\n\t\t};\n\n\t\tthis.anchorNodeRef = createRef();\n\t}\n\n\tonFocus() {\n\t\tconst { firstToSelectId, isSelected, onSelect } = this.props;\n\t\tif ( ! isSelected ) {\n\t\t\tonSelect( firstToSelectId );\n\t\t}\n\t}\n\n\tinsertBlocksAfter( blocks ) {\n\t\tthis.props.onInsertBlocks( blocks, this.props.order + 1 );\n\n\t\tif ( blocks[ 0 ] ) {\n\t\t\t// Focus on the first block inserted.\n\t\t\tthis.props.onSelect( blocks[ 0 ].clientId );\n\t\t}\n\t}\n\n\tgetBlockWidth( { nativeEvent } ) {\n\t\tconst { layout } = nativeEvent;\n\t\tconst { blockWidth } = this.state;\n\t\tconst layoutWidth = Math.floor( layout.width );\n\n\t\tif ( ! blockWidth || ! layoutWidth ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( blockWidth !== layoutWidth ) {\n\t\t\tthis.setState( { blockWidth: layoutWidth } );\n\t\t}\n\t}\n\n\tgetBlockForType() {\n\t\tconst { blockWidth } = this.state;\n\t\treturn (\n\t\t\t<BlockForType\n\t\t\t\t{ ...this.props }\n\t\t\t\tonBlockFocus={ this.onFocus }\n\t\t\t\tinsertBlocksAfter={ this.insertBlocksAfter }\n\t\t\t\tgetBlockWidth={ this.getBlockWidth }\n\t\t\t\tblockWidth={ blockWidth }\n\t\t\t/>\n\t\t);\n\t}\n\n\trenderBlockTitle() {\n\t\treturn (\n\t\t\t<View style={ styles.blockTitle }>\n\t\t\t\t<Text>BlockType: { this.props.name }</Text>\n\t\t\t</View>\n\t\t);\n\t}\n\n\trender() {\n\t\tconst {\n\t\t\tattributes,\n\t\t\tblockType,\n\t\t\tclientId,\n\t\t\ticon,\n\t\t\tisSelected,\n\t\t\tisValid,\n\t\t\torder,\n\t\t\ttitle,\n\t\t\tisDimmed,\n\t\t\tisTouchable,\n\t\t\tonDeleteBlock,\n\t\t\tisStackedHorizontally,\n\t\t\tisParentSelected,\n\t\t\tgetStylesFromColorScheme,\n\t\t\tmarginVertical,\n\t\t\tmarginHorizontal,\n\t\t\tisInnerBlockSelected,\n\t\t\tname,\n\t\t} = this.props;\n\n\t\tif ( ! attributes || ! blockType ) {\n\t\t\treturn null;\n\t\t}\n\t\tconst { blockWidth } = this.state;\n\t\tconst { align } = attributes;\n\t\tconst accessibilityLabel = getAccessibleBlockLabel(\n\t\t\tblockType,\n\t\t\tattributes,\n\t\t\torder + 1\n\t\t);\n\t\tconst { isFullWidth, isContainerRelated } = alignmentHelpers;\n\t\tconst accessible = ! ( isSelected || isInnerBlockSelected );\n\t\tconst screenWidth = Math.floor( Dimensions.get( 'window' ).width );\n\t\tconst isScreenWidthEqual = blockWidth === screenWidth;\n\t\tconst isScreenWidthWider = blockWidth < screenWidth;\n\t\tconst isFullWidthToolbar = isFullWidth( align ) || isScreenWidthEqual;\n\n\t\treturn (\n\t\t\t<TouchableWithoutFeedback\n\t\t\t\tonPress={ this.onFocus }\n\t\t\t\taccessible={ accessible }\n\t\t\t\taccessibilityRole={ 'button' }\n\t\t\t>\n\t\t\t\t<View\n\t\t\t\t\tstyle={ { flex: 1 } }\n\t\t\t\t\taccessibilityLabel={ accessibilityLabel }\n\t\t\t\t>\n\t\t\t\t\t<View\n\t\t\t\t\t\tpointerEvents={ isTouchable ? 'auto' : 'box-only' }\n\t\t\t\t\t\taccessibilityLabel={ accessibilityLabel }\n\t\t\t\t\t\tstyle={ [\n\t\t\t\t\t\t\t{ marginVertical, marginHorizontal, flex: 1 },\n\t\t\t\t\t\t\tisDimmed && styles.dimmed,\n\t\t\t\t\t\t] }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ isSelected && (\n\t\t\t\t\t\t\t<View\n\t\t\t\t\t\t\t\tpointerEvents=\"box-none\"\n\t\t\t\t\t\t\t\tstyle={ [\n\t\t\t\t\t\t\t\t\tstyles.solidBorder,\n\t\t\t\t\t\t\t\t\tisFullWidth( align ) &&\n\t\t\t\t\t\t\t\t\t\tisScreenWidthWider &&\n\t\t\t\t\t\t\t\t\t\tstyles.borderFullWidth,\n\t\t\t\t\t\t\t\t\tisFullWidth( align ) &&\n\t\t\t\t\t\t\t\t\t\tisContainerRelated( name ) &&\n\t\t\t\t\t\t\t\t\t\tisScreenWidthWider &&\n\t\t\t\t\t\t\t\t\t\tstyles.containerBorderFullWidth,\n\t\t\t\t\t\t\t\t\tgetStylesFromColorScheme(\n\t\t\t\t\t\t\t\t\t\tstyles.solidBorderColor,\n\t\t\t\t\t\t\t\t\t\tstyles.solidBorderColorDark\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t] }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ isParentSelected && (\n\t\t\t\t\t\t\t<View\n\t\t\t\t\t\t\t\tstyle={ [\n\t\t\t\t\t\t\t\t\tstyles.dashedBorder,\n\t\t\t\t\t\t\t\t\tgetStylesFromColorScheme(\n\t\t\t\t\t\t\t\t\t\tstyles.dashedBorderColor,\n\t\t\t\t\t\t\t\t\t\tstyles.dashedBorderColorDark\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t] }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ isValid ? (\n\t\t\t\t\t\t\tthis.getBlockForType()\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<BlockInvalidWarning\n\t\t\t\t\t\t\t\tblockTitle={ title }\n\t\t\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<View\n\t\t\t\t\t\t\tstyle={ styles.neutralToolbar }\n\t\t\t\t\t\t\tref={ this.anchorNodeRef }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ isSelected && (\n\t\t\t\t\t\t\t\t<BlockMobileToolbar\n\t\t\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t\t\t\tonDelete={ onDeleteBlock }\n\t\t\t\t\t\t\t\t\tisStackedHorizontally={\n\t\t\t\t\t\t\t\t\t\tisStackedHorizontally\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tblockWidth={ blockWidth }\n\t\t\t\t\t\t\t\t\tanchorNodeRef={ this.anchorNodeRef.current }\n\t\t\t\t\t\t\t\t\tisFullWidth={ isFullWidthToolbar }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</View>\n\t\t\t\t\t</View>\n\t\t\t\t</View>\n\t\t\t</TouchableWithoutFeedback>\n\t\t);\n\t}\n}\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\nexport default compose( [\n\twithSelect( ( select, { clientId } ) => {\n\t\tconst {\n\t\t\tgetBlockIndex,\n\t\t\tgetSettings,\n\t\t\tisBlockSelected,\n\t\t\tgetBlock,\n\t\t\tgetSelectedBlockClientId,\n\t\t\tgetLowestCommonAncestorWithSelectedBlock,\n\t\t\tgetBlockParents,\n\t\t\thasSelectedInnerBlock,\n\t\t} = select( blockEditorStore );\n\n\t\tconst order = getBlockIndex( clientId );\n\t\tconst isSelected = isBlockSelected( clientId );\n\t\tconst isInnerBlockSelected = hasSelectedInnerBlock( clientId );\n\t\tconst block = getBlock( clientId );\n\t\tconst { name, attributes, isValid } = block || {};\n\n\t\tconst blockType = getBlockType( name || 'core/missing' );\n\t\tconst title = blockType?.title;\n\t\tconst icon = blockType?.icon;\n\n\t\tconst parents = getBlockParents( clientId, true );\n\t\tconst parentId = parents[ 0 ] || '';\n\n\t\tconst selectedBlockClientId = getSelectedBlockClientId();\n\n\t\tconst commonAncestor = getLowestCommonAncestorWithSelectedBlock(\n\t\t\tclientId\n\t\t);\n\t\tconst commonAncestorIndex = parents.indexOf( commonAncestor ) - 1;\n\t\tconst firstToSelectId = commonAncestor\n\t\t\t? parents[ commonAncestorIndex ]\n\t\t\t: parents[ parents.length - 1 ];\n\n\t\tconst isParentSelected =\n\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( selectedBlockClientId || false ) &&\n\t\t\tselectedBlockClientId === parentId;\n\n\t\tconst selectedParents = selectedBlockClientId\n\t\t\t? getBlockParents( selectedBlockClientId )\n\t\t\t: [];\n\t\tconst isDescendantOfParentSelected = selectedParents.includes(\n\t\t\tparentId\n\t\t);\n\t\tconst isTouchable =\n\t\t\tisSelected ||\n\t\t\tisDescendantOfParentSelected ||\n\t\t\tisParentSelected ||\n\t\t\tparentId === '';\n\t\tconst baseGlobalStyles = getSettings()\n\t\t\t?.__experimentalGlobalStylesBaseStyles;\n\n\t\treturn {\n\t\t\ticon,\n\t\t\tname: name || 'core/missing',\n\t\t\torder,\n\t\t\ttitle,\n\t\t\tattributes,\n\t\t\tblockType,\n\t\t\tisSelected,\n\t\t\tisInnerBlockSelected,\n\t\t\tisValid,\n\t\t\tisParentSelected,\n\t\t\tfirstToSelectId,\n\t\t\tisTouchable,\n\t\t\tbaseGlobalStyles,\n\t\t\twrapperProps: getWrapperProps(\n\t\t\t\tattributes,\n\t\t\t\tblockType.getEditWrapperProps\n\t\t\t),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch, ownProps, { select } ) => {\n\t\tconst {\n\t\t\tinsertBlocks,\n\t\t\tmergeBlocks,\n\t\t\treplaceBlocks,\n\t\t\tselectBlock,\n\t\t\tupdateBlockAttributes,\n\t\t} = dispatch( blockEditorStore );\n\n\t\treturn {\n\t\t\tmergeBlocks( forward ) {\n\t\t\t\tconst { clientId } = ownProps;\n\t\t\t\tconst {\n\t\t\t\t\tgetPreviousBlockClientId,\n\t\t\t\t\tgetNextBlockClientId,\n\t\t\t\t} = select( blockEditorStore );\n\n\t\t\t\tif ( forward ) {\n\t\t\t\t\tconst nextBlockClientId = getNextBlockClientId( clientId );\n\t\t\t\t\tif ( nextBlockClientId ) {\n\t\t\t\t\t\tmergeBlocks( clientId, nextBlockClientId );\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tconst previousBlockClientId = getPreviousBlockClientId(\n\t\t\t\t\t\tclientId\n\t\t\t\t\t);\n\t\t\t\t\tif ( previousBlockClientId ) {\n\t\t\t\t\t\tmergeBlocks( previousBlockClientId, clientId );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t\tonInsertBlocks( blocks, index ) {\n\t\t\t\tinsertBlocks( blocks, index, ownProps.rootClientId );\n\t\t\t},\n\t\t\tonSelect( clientId = ownProps.clientId, initialPosition ) {\n\t\t\t\tselectBlock( clientId, initialPosition );\n\t\t\t},\n\t\t\tonChange: ( attributes ) => {\n\t\t\t\tupdateBlockAttributes( ownProps.clientId, attributes );\n\t\t\t},\n\t\t\tonReplace( blocks, indexToSelect ) {\n\t\t\t\treplaceBlocks( [ ownProps.clientId ], blocks, indexToSelect );\n\t\t\t},\n\t\t};\n\t} ),\n\twithPreferredColorScheme,\n] )( BlockListBlock );\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/block-list/block.native.js"],"names":["emptyArray","BlockForType","attributes","clientId","contentStyle","getBlockWidth","insertBlocksAfter","isSelected","mergeBlocks","name","onBlockFocus","onChange","onDeleteBlock","onReplace","parentWidth","parentBlockAlignment","wrapperProps","blockWidth","baseGlobalStyles","defaultColors","fontSizes","globalStyle","mergedStyle","style","JSON","stringify","GlobalStylesContext","BLOCK_STYLE_ATTRIBUTES","BlockListBlock","Component","constructor","arguments","bind","onFocus","state","props","marginHorizontal","anchorNodeRef","firstToSelectId","onSelect","blocks","onInsertBlocks","order","nativeEvent","layout","layoutWidth","Math","floor","width","setState","getBlockForType","renderBlockTitle","styles","blockTitle","render","blockType","icon","isValid","title","isDimmed","isTouchable","isStackedHorizontally","isParentSelected","getStylesFromColorScheme","marginVertical","isInnerBlockSelected","draggingEnabled","draggingClientId","align","accessibilityLabel","isFullWidth","isContainerRelated","alignmentHelpers","accessible","screenWidth","Dimensions","get","isScreenWidthEqual","isScreenWidthWider","isFullWidthToolbar","flex","dimmed","solidBorder","borderFullWidth","containerBorderFullWidth","solidBorderColor","solidBorderColorDark","dashedBorder","dashedBorderColor","dashedBorderColorDark","neutralToolbar","current","wrapperPropsCache","WeakMap","emptyObj","getWrapperProps","value","getWrapperPropsFunction","cachedValue","set","select","getBlockIndex","getBlockCount","getSettings","isBlockSelected","getBlock","getSelectedBlockClientId","getLowestCommonAncestorWithSelectedBlock","getBlockParents","hasSelectedInnerBlock","getBlockHierarchyRootClientId","blockEditorStore","block","parents","parentId","selectedBlockClientId","commonAncestor","commonAncestorIndex","indexOf","length","selectedParents","isDescendantOfParentSelected","includes","__experimentalGlobalStylesBaseStyles","hasInnerBlocks","getEditWrapperProps","dispatch","ownProps","insertBlocks","replaceBlocks","selectBlock","updateBlockAttributes","forward","getPreviousBlockClientId","getNextBlockClientId","nextBlockClientId","previousBlockClientId","index","rootClientId","initialPosition","indexToSelect","withPreferredColorScheme"],"mappings":";;;;;;;;;AASA;;;;AANA;;AACA;;AAMA;;AAOA;;AACA;;AACA;;AAIA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAjCA;AACA;AACA;;AAIA;AACA;AACA;;AAiBA;AACA;AACA;AAQA,MAAMA,UAAU,GAAG,EAAnB;;AACA,SAASC,YAAT,OAkBI;AAAA,MAlBmB;AACtBC,IAAAA,UADsB;AAEtBC,IAAAA,QAFsB;AAGtBC,I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A,YAAKoI,iBAAL,EAAyB;AACxB/H,UAAAA,WAAW,CAAEL,QAAF,EAAYoI,iBAAZ,CAAX;AACA;AACD,OALD,MAKO;AACN,cAAMC,qBAAqB,GAAGH,wBAAwB,CACrDlI,QADqD,CAAtD;;AAGA,YAAKqI,qBAAL,EAA6B;AAC5BhI,UAAAA,WAAW,CAAEgI,qBAAF,EAAyBrI,QAAzB,CAAX;AACA;AACD;AACD,KArBK;;AAsBNsC,IAAAA,cAAc,CAAED,MAAF,EAAUiG,KAAV,EAAkB;AAC/BT,MAAAA,YAAY,CAAExF,MAAF,EAAUiG,KAAV,EAAiBV,QAAQ,CAACW,YAA1B,CAAZ;AACA,KAxBK;;AAyBNnG,IAAAA,QAAQ,GAAkD;AAAA,UAAhDpC,QAAgD,uEAArC4H,QAAQ,CAAC5H,QAA4B;AAAA,UAAlBwI,eAAkB;AACzDT,MAAAA,WAAW,CAAE/H,QAAF,EAAYwI,eAAZ,CAAX;AACA,KA3BK;;AA4BNhI,IAAAA,QAAQ,EAAIT,UAAF,IAAkB;AAC3BiI,MAAAA,qBAAqB,CAAEJ,QAAQ,CAAC5H,QAAX,EAAqBD,UAArB,CAArB;AACA,KA9BK;;AA+BNW,IAAAA,SAAS,CAAE2B,MAAF,EAAUoG,aAAV,EAA0B;AAClCX,MAAAA,aAAa,CAAE,CAAEF,QAAQ,CAAC5H,QAAX,CAAF,EAAyBqC,MAAzB,EAAiCoG,aAAjC,CAAb;AACA;;AAjCK,GAAP;AAmCA,CA5CD,CA3FuB,EAwIvBC,iCAxIuB,CAAT,EAyIVjH,cAzIU,C","sourcesContent":["/**\n * External dependencies\n */\nimport { View, Text, TouchableWithoutFeedback, Dimensions } from 'react-native';\nimport { pick } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { Component, createRef, useMemo } from '@wordpress/element';\nimport {\n\tGlobalStylesContext,\n\tgetMergedGlobalStyles,\n\tuseMobileGlobalStylesColors,\n\talignmentHelpers,\n\tuseGlobalStyles,\n} from '@wordpress/components';\nimport { withDispatch, withSelect } from '@wordpress/data';\nimport { compose, withPreferredColorScheme } from '@wordpress/compose';\nimport {\n\tgetBlockType,\n\t__experimentalGetAccessibleBlockLabel as getAccessibleBlockLabel,\n} from '@wordpress/blocks';\nimport { useSetting } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport styles from './block.scss';\nimport BlockEdit from '../block-edit';\nimport BlockInvalidWarning from './block-invalid-warning';\nimport BlockMobileToolbar from '../block-mobile-toolbar';\nimport { store as blockEditorStore } from '../../store';\nimport BlockDraggable from '../block-draggable';\n\nconst emptyArray = [];\nfunction BlockForType( {\n\tattributes,\n\tclientId,\n\tcontentStyle,\n\tgetBlockWidth,\n\tinsertBlocksAfter,\n\tisSelected,\n\tmergeBlocks,\n\tname,\n\tonBlockFocus,\n\tonChange,\n\tonDeleteBlock,\n\tonReplace,\n\tparentWidth,\n\tparentBlockAlignment,\n\twrapperProps,\n\tblockWidth,\n\tbaseGlobalStyles,\n} ) {\n\tconst defaultColors = useMobileGlobalStylesColors();\n\tconst fontSizes = useSetting( 'typography.fontSizes' ) || emptyArray;\n\tconst globalStyle = useGlobalStyles();\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}, [\n\t\tdefaultColors,\n\t\tglobalStyle,\n\t\t// I couldn't simply use attributes and wrapperProps.styles as a dependency because they are almost always a new reference.\n\t\t// Thanks to the JSON.stringify we check if the value is the same instead of reference.\n\t\tJSON.stringify( wrapperProps.style ),\n\t\tJSON.stringify(\n\t\t\tpick( attributes, GlobalStylesContext.BLOCK_STYLE_ATTRIBUTES )\n\t\t),\n\t] );\n\n\treturn (\n\t\t<GlobalStylesContext.Provider value={ mergedStyle }>\n\t\t\t<BlockEdit\n\t\t\t\tname={ name }\n\t\t\t\tisSelected={ isSelected }\n\t\t\t\tattributes={ attributes }\n\t\t\t\tsetAttributes={ onChange }\n\t\t\t\tonFocus={ onBlockFocus }\n\t\t\t\tonReplace={ onReplace }\n\t\t\t\tinsertBlocksAfter={ insertBlocksAfter }\n\t\t\t\tmergeBlocks={ mergeBlocks }\n\t\t\t\t// Block level styles.\n\t\t\t\twrapperProps={ wrapperProps }\n\t\t\t\t// Inherited styles merged with block level styles.\n\t\t\t\tstyle={ mergedStyle }\n\t\t\t\tclientId={ clientId }\n\t\t\t\tparentWidth={ parentWidth }\n\t\t\t\tcontentStyle={ contentStyle }\n\t\t\t\tonDeleteBlock={ onDeleteBlock }\n\t\t\t\tblockWidth={ blockWidth }\n\t\t\t\tparentBlockAlignment={ parentBlockAlignment }\n\t\t\t/>\n\t\t\t<View onLayout={ getBlockWidth } />\n\t\t</GlobalStylesContext.Provider>\n\t);\n}\n\nclass BlockListBlock extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\n\t\tthis.insertBlocksAfter = this.insertBlocksAfter.bind( this );\n\t\tthis.onFocus = this.onFocus.bind( this );\n\t\tthis.getBlockWidth = this.getBlockWidth.bind( this );\n\n\t\tthis.state = {\n\t\t\tblockWidth: this.props.blockWidth - 2 * this.props.marginHorizontal,\n\t\t};\n\n\t\tthis.anchorNodeRef = createRef();\n\t}\n\n\tonFocus() {\n\t\tconst { firstToSelectId, isSelected, onSelect } = this.props;\n\t\tif ( ! isSelected ) {\n\t\t\tonSelect( firstToSelectId );\n\t\t}\n\t}\n\n\tinsertBlocksAfter( blocks ) {\n\t\tthis.props.onInsertBlocks( blocks, this.props.order + 1 );\n\n\t\tif ( blocks[ 0 ] ) {\n\t\t\t// Focus on the first block inserted.\n\t\t\tthis.props.onSelect( blocks[ 0 ].clientId );\n\t\t}\n\t}\n\n\tgetBlockWidth( { nativeEvent } ) {\n\t\tconst { layout } = nativeEvent;\n\t\tconst { blockWidth } = this.state;\n\t\tconst layoutWidth = Math.floor( layout.width );\n\n\t\tif ( ! blockWidth || ! layoutWidth ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( blockWidth !== layoutWidth ) {\n\t\t\tthis.setState( { blockWidth: layoutWidth } );\n\t\t}\n\t}\n\n\tgetBlockForType() {\n\t\tconst { blockWidth } = this.state;\n\t\treturn (\n\t\t\t<BlockForType\n\t\t\t\t{ ...this.props }\n\t\t\t\tonBlockFocus={ this.onFocus }\n\t\t\t\tinsertBlocksAfter={ this.insertBlocksAfter }\n\t\t\t\tgetBlockWidth={ this.getBlockWidth }\n\t\t\t\tblockWidth={ blockWidth }\n\t\t\t/>\n\t\t);\n\t}\n\n\trenderBlockTitle() {\n\t\treturn (\n\t\t\t<View style={ styles.blockTitle }>\n\t\t\t\t<Text>BlockType: { this.props.name }</Text>\n\t\t\t</View>\n\t\t);\n\t}\n\n\trender() {\n\t\tconst {\n\t\t\tattributes,\n\t\t\tblockType,\n\t\t\tclientId,\n\t\t\ticon,\n\t\t\tisSelected,\n\t\t\tisValid,\n\t\t\torder,\n\t\t\ttitle,\n\t\t\tisDimmed,\n\t\t\tisTouchable,\n\t\t\tonDeleteBlock,\n\t\t\tisStackedHorizontally,\n\t\t\tisParentSelected,\n\t\t\tgetStylesFromColorScheme,\n\t\t\tmarginVertical,\n\t\t\tmarginHorizontal,\n\t\t\tisInnerBlockSelected,\n\t\t\tname,\n\t\t\tdraggingEnabled,\n\t\t\tdraggingClientId,\n\t\t} = this.props;\n\n\t\tif ( ! attributes || ! blockType ) {\n\t\t\treturn null;\n\t\t}\n\t\tconst { blockWidth } = this.state;\n\t\tconst { align } = attributes;\n\t\tconst accessibilityLabel = getAccessibleBlockLabel(\n\t\t\tblockType,\n\t\t\tattributes,\n\t\t\torder + 1\n\t\t);\n\t\tconst { isFullWidth, isContainerRelated } = alignmentHelpers;\n\t\tconst accessible = ! ( isSelected || isInnerBlockSelected );\n\t\tconst screenWidth = Math.floor( Dimensions.get( 'window' ).width );\n\t\tconst isScreenWidthEqual = blockWidth === screenWidth;\n\t\tconst isScreenWidthWider = blockWidth < screenWidth;\n\t\tconst isFullWidthToolbar = isFullWidth( align ) || isScreenWidthEqual;\n\n\t\treturn (\n\t\t\t<TouchableWithoutFeedback\n\t\t\t\tonPress={ this.onFocus }\n\t\t\t\taccessible={ accessible }\n\t\t\t\taccessibilityRole={ 'button' }\n\t\t\t>\n\t\t\t\t<View\n\t\t\t\t\tstyle={ { flex: 1 } }\n\t\t\t\t\taccessibilityLabel={ accessibilityLabel }\n\t\t\t\t>\n\t\t\t\t\t<View\n\t\t\t\t\t\tpointerEvents={ isTouchable ? 'auto' : 'box-only' }\n\t\t\t\t\t\taccessibilityLabel={ accessibilityLabel }\n\t\t\t\t\t\tstyle={ [\n\t\t\t\t\t\t\t{ marginVertical, marginHorizontal, flex: 1 },\n\t\t\t\t\t\t\tisDimmed && styles.dimmed,\n\t\t\t\t\t\t] }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ isSelected && (\n\t\t\t\t\t\t\t<View\n\t\t\t\t\t\t\t\tpointerEvents=\"box-none\"\n\t\t\t\t\t\t\t\tstyle={ [\n\t\t\t\t\t\t\t\t\tstyles.solidBorder,\n\t\t\t\t\t\t\t\t\tisFullWidth( align ) &&\n\t\t\t\t\t\t\t\t\t\tisScreenWidthWider &&\n\t\t\t\t\t\t\t\t\t\tstyles.borderFullWidth,\n\t\t\t\t\t\t\t\t\tisFullWidth( align ) &&\n\t\t\t\t\t\t\t\t\t\tisContainerRelated( name ) &&\n\t\t\t\t\t\t\t\t\t\tisScreenWidthWider &&\n\t\t\t\t\t\t\t\t\t\tstyles.containerBorderFullWidth,\n\t\t\t\t\t\t\t\t\tgetStylesFromColorScheme(\n\t\t\t\t\t\t\t\t\t\tstyles.solidBorderColor,\n\t\t\t\t\t\t\t\t\t\tstyles.solidBorderColorDark\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t] }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ isParentSelected && (\n\t\t\t\t\t\t\t<View\n\t\t\t\t\t\t\t\tstyle={ [\n\t\t\t\t\t\t\t\t\tstyles.dashedBorder,\n\t\t\t\t\t\t\t\t\tgetStylesFromColorScheme(\n\t\t\t\t\t\t\t\t\t\tstyles.dashedBorderColor,\n\t\t\t\t\t\t\t\t\t\tstyles.dashedBorderColorDark\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t] }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<BlockDraggable\n\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t\tdraggingClientId={ draggingClientId }\n\t\t\t\t\t\t\tenabled={ draggingEnabled }\n\t\t\t\t\t\t\ttestID=\"draggable-trigger-content\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ () =>\n\t\t\t\t\t\t\t\tisValid ? (\n\t\t\t\t\t\t\t\t\tthis.getBlockForType()\n\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t<BlockInvalidWarning\n\t\t\t\t\t\t\t\t\t\tblockTitle={ title }\n\t\t\t\t\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t</BlockDraggable>\n\t\t\t\t\t\t<View\n\t\t\t\t\t\t\tstyle={ styles.neutralToolbar }\n\t\t\t\t\t\t\tref={ this.anchorNodeRef }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ isSelected && (\n\t\t\t\t\t\t\t\t<BlockMobileToolbar\n\t\t\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t\t\t\tonDelete={ onDeleteBlock }\n\t\t\t\t\t\t\t\t\tisStackedHorizontally={\n\t\t\t\t\t\t\t\t\t\tisStackedHorizontally\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tblockWidth={ blockWidth }\n\t\t\t\t\t\t\t\t\tanchorNodeRef={ this.anchorNodeRef.current }\n\t\t\t\t\t\t\t\t\tisFullWidth={ isFullWidthToolbar }\n\t\t\t\t\t\t\t\t\tdraggingClientId={ draggingClientId }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</View>\n\t\t\t\t\t</View>\n\t\t\t\t</View>\n\t\t\t</TouchableWithoutFeedback>\n\t\t);\n\t}\n}\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\nexport default compose( [\n\twithSelect( ( select, { clientId } ) => {\n\t\tconst {\n\t\t\tgetBlockIndex,\n\t\t\tgetBlockCount,\n\t\t\tgetSettings,\n\t\t\tisBlockSelected,\n\t\t\tgetBlock,\n\t\t\tgetSelectedBlockClientId,\n\t\t\tgetLowestCommonAncestorWithSelectedBlock,\n\t\t\tgetBlockParents,\n\t\t\thasSelectedInnerBlock,\n\t\t\tgetBlockHierarchyRootClientId,\n\t\t} = select( blockEditorStore );\n\n\t\tconst order = getBlockIndex( clientId );\n\t\tconst isSelected = isBlockSelected( clientId );\n\t\tconst isInnerBlockSelected = hasSelectedInnerBlock( clientId );\n\t\tconst block = getBlock( clientId );\n\t\tconst { name, attributes, isValid } = block || {};\n\n\t\tconst blockType = getBlockType( name || 'core/missing' );\n\t\tconst title = blockType?.title;\n\t\tconst icon = blockType?.icon;\n\n\t\tconst parents = getBlockParents( clientId, true );\n\t\tconst parentId = parents[ 0 ] || '';\n\n\t\tconst selectedBlockClientId = getSelectedBlockClientId();\n\n\t\tconst commonAncestor = getLowestCommonAncestorWithSelectedBlock(\n\t\t\tclientId\n\t\t);\n\t\tconst commonAncestorIndex = parents.indexOf( commonAncestor ) - 1;\n\t\tconst firstToSelectId = commonAncestor\n\t\t\t? parents[ commonAncestorIndex ]\n\t\t\t: parents[ parents.length - 1 ];\n\n\t\tconst isParentSelected =\n\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( selectedBlockClientId || false ) &&\n\t\t\tselectedBlockClientId === parentId;\n\n\t\tconst selectedParents = selectedBlockClientId\n\t\t\t? getBlockParents( selectedBlockClientId )\n\t\t\t: [];\n\t\tconst isDescendantOfParentSelected = selectedParents.includes(\n\t\t\tparentId\n\t\t);\n\t\tconst isTouchable =\n\t\t\tisSelected ||\n\t\t\tisDescendantOfParentSelected ||\n\t\t\tisParentSelected ||\n\t\t\tparentId === '';\n\t\tconst baseGlobalStyles = getSettings()\n\t\t\t?.__experimentalGlobalStylesBaseStyles;\n\n\t\tconst hasInnerBlocks = getBlockCount( clientId ) > 0;\n\t\t// For blocks with inner blocks, we only enable the dragging in the nested\n\t\t// blocks if any of them are selected. This way we prevent the long-press\n\t\t// gesture from being disabled for elements within the block UI.\n\t\tconst draggingEnabled =\n\t\t\t! hasInnerBlocks ||\n\t\t\tisSelected ||\n\t\t\t! hasSelectedInnerBlock( clientId, true );\n\t\t// Dragging nested blocks is not supported yet. For this reason, the block to be dragged\n\t\t// will be the top in the hierarchy.\n\t\tconst draggingClientId = getBlockHierarchyRootClientId( clientId );\n\n\t\treturn {\n\t\t\ticon,\n\t\t\tname: name || 'core/missing',\n\t\t\torder,\n\t\t\ttitle,\n\t\t\tattributes,\n\t\t\tblockType,\n\t\t\tdraggingClientId,\n\t\t\tdraggingEnabled,\n\t\t\tisSelected,\n\t\t\tisInnerBlockSelected,\n\t\t\tisValid,\n\t\t\tisParentSelected,\n\t\t\tfirstToSelectId,\n\t\t\tisTouchable,\n\t\t\tbaseGlobalStyles,\n\t\t\twrapperProps: getWrapperProps(\n\t\t\t\tattributes,\n\t\t\t\tblockType.getEditWrapperProps\n\t\t\t),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch, ownProps, { select } ) => {\n\t\tconst {\n\t\t\tinsertBlocks,\n\t\t\tmergeBlocks,\n\t\t\treplaceBlocks,\n\t\t\tselectBlock,\n\t\t\tupdateBlockAttributes,\n\t\t} = dispatch( blockEditorStore );\n\n\t\treturn {\n\t\t\tmergeBlocks( forward ) {\n\t\t\t\tconst { clientId } = ownProps;\n\t\t\t\tconst {\n\t\t\t\t\tgetPreviousBlockClientId,\n\t\t\t\t\tgetNextBlockClientId,\n\t\t\t\t} = select( blockEditorStore );\n\n\t\t\t\tif ( forward ) {\n\t\t\t\t\tconst nextBlockClientId = getNextBlockClientId( clientId );\n\t\t\t\t\tif ( nextBlockClientId ) {\n\t\t\t\t\t\tmergeBlocks( clientId, nextBlockClientId );\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tconst previousBlockClientId = getPreviousBlockClientId(\n\t\t\t\t\t\tclientId\n\t\t\t\t\t);\n\t\t\t\t\tif ( previousBlockClientId ) {\n\t\t\t\t\t\tmergeBlocks( previousBlockClientId, clientId );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t\tonInsertBlocks( blocks, index ) {\n\t\t\t\tinsertBlocks( blocks, index, ownProps.rootClientId );\n\t\t\t},\n\t\t\tonSelect( clientId = ownProps.clientId, initialPosition ) {\n\t\t\t\tselectBlock( clientId, initialPosition );\n\t\t\t},\n\t\t\tonChange: ( attributes ) => {\n\t\t\t\tupdateBlockAttributes( ownProps.clientId, attributes );\n\t\t\t},\n\t\t\tonReplace( blocks, indexToSelect ) {\n\t\t\t\treplaceBlocks( [ ownProps.clientId ], blocks, indexToSelect );\n\t\t\t},\n\t\t};\n\t} ),\n\twithPreferredColorScheme,\n] )( BlockListBlock );\n"]}
|
|
@@ -78,6 +78,29 @@ function Root(_ref) {
|
|
|
78
78
|
isNavigationMode: _isNavigationMode()
|
|
79
79
|
};
|
|
80
80
|
}, []);
|
|
81
|
+
const {
|
|
82
|
+
setBlockVisibility
|
|
83
|
+
} = (0, _data.useDispatch)(_store.store);
|
|
84
|
+
const intersectionObserver = (0, _element.useMemo)(() => {
|
|
85
|
+
const {
|
|
86
|
+
IntersectionObserver: Observer
|
|
87
|
+
} = window;
|
|
88
|
+
|
|
89
|
+
if (!Observer) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return new Observer(entries => {
|
|
94
|
+
const updates = {};
|
|
95
|
+
|
|
96
|
+
for (const entry of entries) {
|
|
97
|
+
const clientId = entry.target.getAttribute('data-block');
|
|
98
|
+
updates[clientId] = entry.isIntersecting;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
setBlockVisibility(updates);
|
|
102
|
+
});
|
|
103
|
+
}, []);
|
|
81
104
|
const innerBlocksProps = (0, _innerBlocks.useInnerBlocksProps)({
|
|
82
105
|
ref: (0, _compose.useMergeRefs)([(0, _blockSelectionClearer.useBlockSelectionClearer)(), (0, _useInBetweenInserter.useInBetweenInserter)(), setElement]),
|
|
83
106
|
className: (0, _classnames.default)('is-root-container', className, {
|
|
@@ -88,7 +111,9 @@ function Root(_ref) {
|
|
|
88
111
|
}, settings);
|
|
89
112
|
return (0, _element.createElement)(elementContext.Provider, {
|
|
90
113
|
value: element
|
|
91
|
-
}, (0, _element.createElement)(
|
|
114
|
+
}, (0, _element.createElement)(IntersectionObserver.Provider, {
|
|
115
|
+
value: intersectionObserver
|
|
116
|
+
}, (0, _element.createElement)("div", innerBlocksProps)));
|
|
92
117
|
}
|
|
93
118
|
|
|
94
119
|
function BlockList(settings) {
|
|
@@ -108,56 +133,33 @@ function Items(_ref2) {
|
|
|
108
133
|
__experimentalAppenderTagName,
|
|
109
134
|
__experimentalLayout: layout = _layout.defaultLayout
|
|
110
135
|
} = _ref2;
|
|
111
|
-
const [intersectingBlocks, setIntersectingBlocks] = (0, _element.useState)(new Set());
|
|
112
|
-
const intersectionObserver = (0, _element.useMemo)(() => {
|
|
113
|
-
const {
|
|
114
|
-
IntersectionObserver: Observer
|
|
115
|
-
} = window;
|
|
116
|
-
|
|
117
|
-
if (!Observer) {
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
return new Observer(entries => {
|
|
122
|
-
setIntersectingBlocks(oldIntersectingBlocks => {
|
|
123
|
-
const newIntersectingBlocks = new Set(oldIntersectingBlocks);
|
|
124
|
-
|
|
125
|
-
for (const entry of entries) {
|
|
126
|
-
const clientId = entry.target.getAttribute('data-block');
|
|
127
|
-
const action = entry.isIntersecting ? 'add' : 'delete';
|
|
128
|
-
newIntersectingBlocks[action](clientId);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
return newIntersectingBlocks;
|
|
132
|
-
});
|
|
133
|
-
});
|
|
134
|
-
}, [setIntersectingBlocks]);
|
|
135
136
|
const {
|
|
136
137
|
order,
|
|
137
|
-
selectedBlocks
|
|
138
|
+
selectedBlocks,
|
|
139
|
+
visibleBlocks
|
|
138
140
|
} = (0, _data.useSelect)(select => {
|
|
139
141
|
const {
|
|
140
142
|
getBlockOrder,
|
|
141
|
-
getSelectedBlockClientIds
|
|
143
|
+
getSelectedBlockClientIds,
|
|
144
|
+
__unstableGetVisibleBlocks
|
|
142
145
|
} = select(_store.store);
|
|
143
146
|
return {
|
|
144
147
|
order: getBlockOrder(rootClientId),
|
|
145
|
-
selectedBlocks: getSelectedBlockClientIds()
|
|
148
|
+
selectedBlocks: getSelectedBlockClientIds(),
|
|
149
|
+
visibleBlocks: __unstableGetVisibleBlocks()
|
|
146
150
|
};
|
|
147
151
|
}, [rootClientId]);
|
|
148
152
|
return (0, _element.createElement)(_layout.LayoutProvider, {
|
|
149
153
|
value: layout
|
|
150
|
-
}, (0, _element.createElement)(IntersectionObserver.Provider, {
|
|
151
|
-
value: intersectionObserver
|
|
152
154
|
}, order.map(clientId => (0, _element.createElement)(_data.AsyncModeProvider, {
|
|
153
155
|
key: clientId,
|
|
154
156
|
value: // Only provide data asynchronously if the block is
|
|
155
157
|
// not visible and not selected.
|
|
156
|
-
!
|
|
158
|
+
!visibleBlocks.has(clientId) && !selectedBlocks.includes(clientId)
|
|
157
159
|
}, (0, _element.createElement)(_block.default, {
|
|
158
160
|
rootClientId: rootClientId,
|
|
159
161
|
clientId: clientId
|
|
160
|
-
})))
|
|
162
|
+
}))), order.length < 1 && placeholder, (0, _element.createElement)(_blockListAppender.default, {
|
|
161
163
|
tagName: __experimentalAppenderTagName,
|
|
162
164
|
rootClientId: rootClientId,
|
|
163
165
|
renderAppender: renderAppender
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/block-list/index.js"],"names":["elementContext","IntersectionObserver","Root","className","settings","element","setElement","isLargeViewport","isOutlineMode","isFocusMode","isNavigationMode","select","getSettings","_isNavigationMode","blockEditorStore","outlineMode","focusMode","
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/block-list/index.js"],"names":["elementContext","IntersectionObserver","Root","className","settings","element","setElement","isLargeViewport","isOutlineMode","isFocusMode","isNavigationMode","select","getSettings","_isNavigationMode","blockEditorStore","outlineMode","focusMode","setBlockVisibility","intersectionObserver","Observer","window","entries","updates","entry","clientId","target","getAttribute","isIntersecting","innerBlocksProps","ref","BlockList","DEFAULT_BLOCK_EDIT_CONTEXT","__unstableElementContext","Items","placeholder","rootClientId","renderAppender","__experimentalAppenderTagName","__experimentalLayout","layout","defaultLayout","order","selectedBlocks","visibleBlocks","getBlockOrder","getSelectedBlockClientIds","__unstableGetVisibleBlocks","map","has","includes","length","BlockListItems","props"],"mappings":";;;;;;;;;;;AAUA;;AAPA;;AAKA;;AACA;;AAMA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAxBA;AACA;AACA;;AAGA;AACA;AACA;;AAKA;AACA;AACA;AAeA,MAAMA,cAAc,G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,yBAAyB,EAFnC;AAGNF,MAAAA,aAAa,EAAEG,0BAA0B;AAHnC,KAAP;AAKA,GAZ+C,EAahD,CAAEX,YAAF,CAbgD,CAAjD;AAgBA,SACC,4BAAC,sBAAD;AAAgB,IAAA,KAAK,EAAGI;AAAxB,KACGE,KAAK,CAACM,GAAN,CAAavB,QAAF,IACZ,4BAAC,uBAAD;AACC,IAAA,GAAG,EAAGA,QADP;AAEC,IAAA,KAAK,EACJ;AACA;AACA,KAAEmB,aAAa,CAACK,GAAd,CAAmBxB,QAAnB,CAAF,IACA,CAAEkB,cAAc,CAACO,QAAf,CAAyBzB,QAAzB;AANJ,KASC,4BAAC,cAAD;AACC,IAAA,YAAY,EAAGW,YADhB;AAEC,IAAA,QAAQ,EAAGX;AAFZ,IATD,CADC,CADH,EAiBGiB,KAAK,CAACS,MAAN,GAAe,CAAf,IAAoBhB,WAjBvB,EAkBC,4BAAC,0BAAD;AACC,IAAA,OAAO,EAAGG,6BADX;AAEC,IAAA,YAAY,EAAGF,YAFhB;AAGC,IAAA,cAAc,EAAGC;AAHlB,IAlBD,CADD;AA0BA;;AAEM,SAASe,cAAT,CAAyBC,KAAzB,EAAiC;AACvC;AACA;AACA,SACC,4BAAC,uBAAD;AAAmB,IAAA,KAAK,EAAG;AAA3B,KACC,4BAAC,KAAD,EAAYA,KAAZ,CADD,CADD;AAKA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { AsyncModeProvider, useSelect, useDispatch } from '@wordpress/data';\nimport { useViewportMatch, useMergeRefs } from '@wordpress/compose';\nimport { createContext, useState, useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport BlockListBlock from './block';\nimport BlockListAppender from '../block-list-appender';\nimport { useInBetweenInserter } from './use-in-between-inserter';\nimport { store as blockEditorStore } from '../../store';\nimport { usePreParsePatterns } from '../../utils/pre-parse-patterns';\nimport { LayoutProvider, defaultLayout } from './layout';\nimport BlockToolsBackCompat from '../block-tools/back-compat';\nimport { useBlockSelectionClearer } from '../block-selection-clearer';\nimport { useInnerBlocksProps } from '../inner-blocks';\nimport {\n\tBlockEditContextProvider,\n\tDEFAULT_BLOCK_EDIT_CONTEXT,\n} from '../block-edit/context';\n\nconst elementContext = createContext();\n\nexport const IntersectionObserver = createContext();\n\nfunction Root( { className, ...settings } ) {\n\tconst [ element, setElement ] = useState();\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst { isOutlineMode, isFocusMode, isNavigationMode } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getSettings, isNavigationMode: _isNavigationMode } = select(\n\t\t\t\tblockEditorStore\n\t\t\t);\n\t\t\tconst { outlineMode, focusMode } = getSettings();\n\t\t\treturn {\n\t\t\t\tisOutlineMode: outlineMode,\n\t\t\t\tisFocusMode: focusMode,\n\t\t\t\tisNavigationMode: _isNavigationMode(),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst { setBlockVisibility } = useDispatch( blockEditorStore );\n\tconst intersectionObserver = useMemo( () => {\n\t\tconst { IntersectionObserver: Observer } = window;\n\n\t\tif ( ! Observer ) {\n\t\t\treturn;\n\t\t}\n\n\t\treturn new Observer( ( entries ) => {\n\t\t\tconst updates = {};\n\t\t\tfor ( const entry of entries ) {\n\t\t\t\tconst clientId = entry.target.getAttribute( 'data-block' );\n\t\t\t\tupdates[ clientId ] = entry.isIntersecting;\n\t\t\t}\n\t\t\tsetBlockVisibility( updates );\n\t\t} );\n\t}, [] );\n\tconst innerBlocksProps = useInnerBlocksProps(\n\t\t{\n\t\t\tref: useMergeRefs( [\n\t\t\t\tuseBlockSelectionClearer(),\n\t\t\t\tuseInBetweenInserter(),\n\t\t\t\tsetElement,\n\t\t\t] ),\n\t\t\tclassName: classnames( 'is-root-container', className, {\n\t\t\t\t'is-outline-mode': isOutlineMode,\n\t\t\t\t'is-focus-mode': isFocusMode && isLargeViewport,\n\t\t\t\t'is-navigate-mode': isNavigationMode,\n\t\t\t} ),\n\t\t},\n\t\tsettings\n\t);\n\treturn (\n\t\t<elementContext.Provider value={ element }>\n\t\t\t<IntersectionObserver.Provider value={ intersectionObserver }>\n\t\t\t\t<div { ...innerBlocksProps } />\n\t\t\t</IntersectionObserver.Provider>\n\t\t</elementContext.Provider>\n\t);\n}\n\nexport default function BlockList( settings ) {\n\tusePreParsePatterns();\n\treturn (\n\t\t<BlockToolsBackCompat>\n\t\t\t<BlockEditContextProvider value={ DEFAULT_BLOCK_EDIT_CONTEXT }>\n\t\t\t\t<Root { ...settings } />\n\t\t\t</BlockEditContextProvider>\n\t\t</BlockToolsBackCompat>\n\t);\n}\n\nBlockList.__unstableElementContext = elementContext;\n\nfunction Items( {\n\tplaceholder,\n\trootClientId,\n\trenderAppender,\n\t__experimentalAppenderTagName,\n\t__experimentalLayout: layout = defaultLayout,\n} ) {\n\tconst { order, selectedBlocks, visibleBlocks } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockOrder,\n\t\t\t\tgetSelectedBlockClientIds,\n\t\t\t\t__unstableGetVisibleBlocks,\n\t\t\t} = select( blockEditorStore );\n\t\t\treturn {\n\t\t\t\torder: getBlockOrder( rootClientId ),\n\t\t\t\tselectedBlocks: getSelectedBlockClientIds(),\n\t\t\t\tvisibleBlocks: __unstableGetVisibleBlocks(),\n\t\t\t};\n\t\t},\n\t\t[ rootClientId ]\n\t);\n\n\treturn (\n\t\t<LayoutProvider value={ layout }>\n\t\t\t{ order.map( ( clientId ) => (\n\t\t\t\t<AsyncModeProvider\n\t\t\t\t\tkey={ clientId }\n\t\t\t\t\tvalue={\n\t\t\t\t\t\t// Only provide data asynchronously if the block is\n\t\t\t\t\t\t// not visible and not selected.\n\t\t\t\t\t\t! visibleBlocks.has( clientId ) &&\n\t\t\t\t\t\t! selectedBlocks.includes( clientId )\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t<BlockListBlock\n\t\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t/>\n\t\t\t\t</AsyncModeProvider>\n\t\t\t) ) }\n\t\t\t{ order.length < 1 && placeholder }\n\t\t\t<BlockListAppender\n\t\t\t\ttagName={ __experimentalAppenderTagName }\n\t\t\t\trootClientId={ rootClientId }\n\t\t\t\trenderAppender={ renderAppender }\n\t\t\t/>\n\t\t</LayoutProvider>\n\t);\n}\n\nexport function BlockListItems( props ) {\n\t// This component needs to always be synchronous as it's the one changing\n\t// the async mode depending on the block selection.\n\treturn (\n\t\t<AsyncModeProvider value={ false }>\n\t\t\t<Items { ...props } />\n\t\t</AsyncModeProvider>\n\t);\n}\n"]}
|
|
@@ -31,6 +31,12 @@ var _blockListAppender = _interopRequireDefault(require("../block-list-appender"
|
|
|
31
31
|
|
|
32
32
|
var _blockListItem = _interopRequireDefault(require("./block-list-item"));
|
|
33
33
|
|
|
34
|
+
var _blockListItemCell = _interopRequireDefault(require("./block-list-item-cell"));
|
|
35
|
+
|
|
36
|
+
var _blockListContext = require("./block-list-context");
|
|
37
|
+
|
|
38
|
+
var _blockDraggable = require("../block-draggable");
|
|
39
|
+
|
|
34
40
|
var _store = require("../../store");
|
|
35
41
|
|
|
36
42
|
/**
|
|
@@ -44,7 +50,6 @@ var _store = require("../../store");
|
|
|
44
50
|
/**
|
|
45
51
|
* Internal dependencies
|
|
46
52
|
*/
|
|
47
|
-
const BlockListContext = (0, _element.createContext)();
|
|
48
53
|
const OnCaretVerticalPositionChange = (0, _element.createContext)();
|
|
49
54
|
exports.OnCaretVerticalPositionChange = OnCaretVerticalPositionChange;
|
|
50
55
|
const stylesMemo = {};
|
|
@@ -84,6 +89,7 @@ class BlockList extends _element.Component {
|
|
|
84
89
|
this.shouldShowInnerBlockAppender = this.shouldShowInnerBlockAppender.bind(this);
|
|
85
90
|
this.renderEmptyList = this.renderEmptyList.bind(this);
|
|
86
91
|
this.getExtraData = this.getExtraData.bind(this);
|
|
92
|
+
this.getCellRendererComponent = this.getCellRendererComponent.bind(this);
|
|
87
93
|
this.onLayout = this.onLayout.bind(this);
|
|
88
94
|
this.state = {
|
|
89
95
|
blockWidth: this.props.blockWidth || 0
|
|
@@ -150,10 +156,27 @@ class BlockList extends _element.Component {
|
|
|
150
156
|
return this.extraData;
|
|
151
157
|
}
|
|
152
158
|
|
|
153
|
-
|
|
159
|
+
getCellRendererComponent(_ref) {
|
|
154
160
|
let {
|
|
155
|
-
|
|
161
|
+
children,
|
|
162
|
+
item,
|
|
163
|
+
onLayout
|
|
156
164
|
} = _ref;
|
|
165
|
+
const {
|
|
166
|
+
rootClientId
|
|
167
|
+
} = this.props;
|
|
168
|
+
return (0, _element.createElement)(_blockListItemCell.default, {
|
|
169
|
+
children: children,
|
|
170
|
+
clientId: item,
|
|
171
|
+
onLayout: onLayout,
|
|
172
|
+
rootClientId: rootClientId
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
onLayout(_ref2) {
|
|
177
|
+
let {
|
|
178
|
+
nativeEvent
|
|
179
|
+
} = _ref2;
|
|
157
180
|
const {
|
|
158
181
|
layout
|
|
159
182
|
} = nativeEvent;
|
|
@@ -179,14 +202,31 @@ class BlockList extends _element.Component {
|
|
|
179
202
|
|
|
180
203
|
render() {
|
|
181
204
|
const {
|
|
182
|
-
isRootList
|
|
205
|
+
isRootList,
|
|
206
|
+
isRTL
|
|
183
207
|
} = this.props; // Use of Context to propagate the main scroll ref to its children e.g InnerBlocks.
|
|
184
208
|
|
|
185
|
-
const blockList = isRootList ? (0, _element.createElement)(
|
|
186
|
-
value:
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
})
|
|
209
|
+
const blockList = isRootList ? (0, _element.createElement)(_blockListContext.BlockListProvider, {
|
|
210
|
+
value: { ..._blockListContext.DEFAULT_BLOCK_LIST_CONTEXT,
|
|
211
|
+
scrollRef: this.scrollViewRef
|
|
212
|
+
}
|
|
213
|
+
}, (0, _element.createElement)(_blockDraggable.BlockDraggableWrapper, {
|
|
214
|
+
isRTL: isRTL
|
|
215
|
+
}, _ref3 => {
|
|
216
|
+
let {
|
|
217
|
+
onScroll
|
|
218
|
+
} = _ref3;
|
|
219
|
+
return this.renderList({
|
|
220
|
+
onScroll
|
|
221
|
+
});
|
|
222
|
+
})) : (0, _element.createElement)(_blockListContext.BlockListConsumer, null, _ref4 => {
|
|
223
|
+
let {
|
|
224
|
+
scrollRef
|
|
225
|
+
} = _ref4;
|
|
226
|
+
return this.renderList({
|
|
227
|
+
parentScrollRef: scrollRef
|
|
228
|
+
});
|
|
229
|
+
});
|
|
190
230
|
return (0, _element.createElement)(OnCaretVerticalPositionChange.Provider, {
|
|
191
231
|
value: this.onCaretVerticalPositionChange
|
|
192
232
|
}, blockList);
|
|
@@ -211,7 +251,8 @@ class BlockList extends _element.Component {
|
|
|
211
251
|
blockWidth
|
|
212
252
|
} = this.props;
|
|
213
253
|
const {
|
|
214
|
-
parentScrollRef
|
|
254
|
+
parentScrollRef,
|
|
255
|
+
onScroll
|
|
215
256
|
} = extraProps;
|
|
216
257
|
const {
|
|
217
258
|
blockToolbar,
|
|
@@ -257,11 +298,13 @@ class BlockList extends _element.Component {
|
|
|
257
298
|
data: blockClientIds,
|
|
258
299
|
keyExtractor: _lodash.identity,
|
|
259
300
|
renderItem: this.renderItem,
|
|
301
|
+
CellRendererComponent: this.getCellRendererComponent,
|
|
260
302
|
shouldPreventAutomaticScroll: this.shouldFlatListPreventAutomaticScroll,
|
|
261
303
|
title: title,
|
|
262
304
|
ListHeaderComponent: header,
|
|
263
305
|
ListEmptyComponent: !isReadOnly && this.renderEmptyList,
|
|
264
|
-
ListFooterComponent: this.renderBlockListFooter
|
|
306
|
+
ListFooterComponent: this.renderBlockListFooter,
|
|
307
|
+
onScroll: onScroll
|
|
265
308
|
})), this.shouldShowInnerBlockAppender() && (0, _element.createElement)(_reactNative.View, {
|
|
266
309
|
style: {
|
|
267
310
|
marginHorizontal: marginHorizontal - _style.default.innerAppender.marginLeft
|
|
@@ -273,10 +316,10 @@ class BlockList extends _element.Component {
|
|
|
273
316
|
})));
|
|
274
317
|
}
|
|
275
318
|
|
|
276
|
-
renderItem(
|
|
319
|
+
renderItem(_ref5) {
|
|
277
320
|
let {
|
|
278
321
|
item: clientId
|
|
279
|
-
} =
|
|
322
|
+
} = _ref5;
|
|
280
323
|
const {
|
|
281
324
|
contentResizeMode,
|
|
282
325
|
contentStyle,
|
|
@@ -292,8 +335,16 @@ class BlockList extends _element.Component {
|
|
|
292
335
|
} = this.props;
|
|
293
336
|
const {
|
|
294
337
|
blockWidth
|
|
295
|
-
} = this.state;
|
|
296
|
-
|
|
338
|
+
} = this.state; // Extracting the grid item properties here to avoid
|
|
339
|
+
// re-renders in the blockListItem component.
|
|
340
|
+
|
|
341
|
+
const isGridItem = !!gridProperties;
|
|
342
|
+
const gridItemProps = gridProperties && {
|
|
343
|
+
numOfColumns: gridProperties.numColumns,
|
|
344
|
+
tileCount: blockClientIds.length,
|
|
345
|
+
tileIndex: blockClientIds.indexOf(clientId)
|
|
346
|
+
};
|
|
347
|
+
return (0, _element.createElement)(_blockListItem.default, (0, _extends2.default)({
|
|
297
348
|
isStackedHorizontally: isStackedHorizontally,
|
|
298
349
|
rootClientId: rootClientId,
|
|
299
350
|
clientId: clientId,
|
|
@@ -306,9 +357,8 @@ class BlockList extends _element.Component {
|
|
|
306
357
|
onDeleteBlock: onDeleteBlock,
|
|
307
358
|
shouldShowInnerBlockAppender: this.shouldShowInnerBlockAppender,
|
|
308
359
|
blockWidth: blockWidth,
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
});
|
|
360
|
+
isGridItem: isGridItem
|
|
361
|
+
}, gridItemProps));
|
|
312
362
|
}
|
|
313
363
|
|
|
314
364
|
renderBlockListFooter() {
|
|
@@ -340,12 +390,12 @@ class BlockList extends _element.Component {
|
|
|
340
390
|
|
|
341
391
|
exports.BlockList = BlockList;
|
|
342
392
|
|
|
343
|
-
var _default = (0, _compose.compose)([(0, _data.withSelect)((select,
|
|
393
|
+
var _default = (0, _compose.compose)([(0, _data.withSelect)((select, _ref6) => {
|
|
344
394
|
let {
|
|
345
395
|
rootClientId,
|
|
346
396
|
orientation,
|
|
347
397
|
filterInnerBlocks
|
|
348
|
-
} =
|
|
398
|
+
} = _ref6;
|
|
349
399
|
const {
|
|
350
400
|
getBlockCount,
|
|
351
401
|
getBlockOrder,
|
|
@@ -368,6 +418,7 @@ var _default = (0, _compose.compose)([(0, _data.withSelect)((select, _ref3) => {
|
|
|
368
418
|
const blockCount = getBlockCount();
|
|
369
419
|
const hasRootInnerBlocks = !!blockCount;
|
|
370
420
|
const isFloatingToolbarVisible = !!selectedBlockClientId && hasRootInnerBlocks;
|
|
421
|
+
const isRTL = getSettings().isRTL;
|
|
371
422
|
return {
|
|
372
423
|
blockClientIds,
|
|
373
424
|
blockCount,
|
|
@@ -376,7 +427,8 @@ var _default = (0, _compose.compose)([(0, _data.withSelect)((select, _ref3) => {
|
|
|
376
427
|
isRootList: rootClientId === undefined,
|
|
377
428
|
isFloatingToolbarVisible,
|
|
378
429
|
isStackedHorizontally,
|
|
379
|
-
maxWidth
|
|
430
|
+
maxWidth,
|
|
431
|
+
isRTL
|
|
380
432
|
};
|
|
381
433
|
}), (0, _data.withDispatch)(dispatch => {
|
|
382
434
|
const {
|
|
@@ -419,11 +471,11 @@ class EmptyListComponent extends _element.Component {
|
|
|
419
471
|
|
|
420
472
|
}
|
|
421
473
|
|
|
422
|
-
const EmptyListComponentCompose = (0, _compose.compose)([(0, _data.withSelect)((select,
|
|
474
|
+
const EmptyListComponentCompose = (0, _compose.compose)([(0, _data.withSelect)((select, _ref7) => {
|
|
423
475
|
let {
|
|
424
476
|
rootClientId,
|
|
425
477
|
orientation
|
|
426
|
-
} =
|
|
478
|
+
} = _ref7;
|
|
427
479
|
const {
|
|
428
480
|
getBlockOrder,
|
|
429
481
|
getBlockInsertionPoint,
|