@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
|
@@ -25,10 +25,15 @@ import { __ } from '@wordpress/i18n';
|
|
|
25
25
|
import styles from './style.scss';
|
|
26
26
|
import BlockListAppender from '../block-list-appender';
|
|
27
27
|
import BlockListItem from './block-list-item';
|
|
28
|
+
import BlockListItemCell from './block-list-item-cell';
|
|
29
|
+
import {
|
|
30
|
+
BlockListProvider,
|
|
31
|
+
BlockListConsumer,
|
|
32
|
+
DEFAULT_BLOCK_LIST_CONTEXT,
|
|
33
|
+
} from './block-list-context';
|
|
34
|
+
import { BlockDraggableWrapper } from '../block-draggable';
|
|
28
35
|
import { store as blockEditorStore } from '../../store';
|
|
29
36
|
|
|
30
|
-
const BlockListContext = createContext();
|
|
31
|
-
|
|
32
37
|
export const OnCaretVerticalPositionChange = createContext();
|
|
33
38
|
|
|
34
39
|
const stylesMemo = {};
|
|
@@ -78,6 +83,9 @@ export class BlockList extends Component {
|
|
|
78
83
|
);
|
|
79
84
|
this.renderEmptyList = this.renderEmptyList.bind( this );
|
|
80
85
|
this.getExtraData = this.getExtraData.bind( this );
|
|
86
|
+
this.getCellRendererComponent = this.getCellRendererComponent.bind(
|
|
87
|
+
this
|
|
88
|
+
);
|
|
81
89
|
|
|
82
90
|
this.onLayout = this.onLayout.bind( this );
|
|
83
91
|
|
|
@@ -154,6 +162,18 @@ export class BlockList extends Component {
|
|
|
154
162
|
return this.extraData;
|
|
155
163
|
}
|
|
156
164
|
|
|
165
|
+
getCellRendererComponent( { children, item, onLayout } ) {
|
|
166
|
+
const { rootClientId } = this.props;
|
|
167
|
+
return (
|
|
168
|
+
<BlockListItemCell
|
|
169
|
+
children={ children }
|
|
170
|
+
clientId={ item }
|
|
171
|
+
onLayout={ onLayout }
|
|
172
|
+
rootClientId={ rootClientId }
|
|
173
|
+
/>
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
|
|
157
177
|
onLayout( { nativeEvent } ) {
|
|
158
178
|
const { layout } = nativeEvent;
|
|
159
179
|
const { blockWidth } = this.state;
|
|
@@ -170,20 +190,27 @@ export class BlockList extends Component {
|
|
|
170
190
|
}
|
|
171
191
|
|
|
172
192
|
render() {
|
|
173
|
-
const { isRootList } = this.props;
|
|
193
|
+
const { isRootList, isRTL } = this.props;
|
|
174
194
|
// Use of Context to propagate the main scroll ref to its children e.g InnerBlocks.
|
|
175
195
|
const blockList = isRootList ? (
|
|
176
|
-
<
|
|
177
|
-
{
|
|
178
|
-
|
|
196
|
+
<BlockListProvider
|
|
197
|
+
value={ {
|
|
198
|
+
...DEFAULT_BLOCK_LIST_CONTEXT,
|
|
199
|
+
scrollRef: this.scrollViewRef,
|
|
200
|
+
} }
|
|
201
|
+
>
|
|
202
|
+
<BlockDraggableWrapper isRTL={ isRTL }>
|
|
203
|
+
{ ( { onScroll } ) => this.renderList( { onScroll } ) }
|
|
204
|
+
</BlockDraggableWrapper>
|
|
205
|
+
</BlockListProvider>
|
|
179
206
|
) : (
|
|
180
|
-
<
|
|
181
|
-
{ (
|
|
207
|
+
<BlockListConsumer>
|
|
208
|
+
{ ( { scrollRef } ) =>
|
|
182
209
|
this.renderList( {
|
|
183
|
-
parentScrollRef:
|
|
210
|
+
parentScrollRef: scrollRef,
|
|
184
211
|
} )
|
|
185
212
|
}
|
|
186
|
-
</
|
|
213
|
+
</BlockListConsumer>
|
|
187
214
|
);
|
|
188
215
|
|
|
189
216
|
return (
|
|
@@ -212,7 +239,7 @@ export class BlockList extends Component {
|
|
|
212
239
|
contentResizeMode,
|
|
213
240
|
blockWidth,
|
|
214
241
|
} = this.props;
|
|
215
|
-
const { parentScrollRef } = extraProps;
|
|
242
|
+
const { parentScrollRef, onScroll } = extraProps;
|
|
216
243
|
|
|
217
244
|
const {
|
|
218
245
|
blockToolbar,
|
|
@@ -279,6 +306,7 @@ export class BlockList extends Component {
|
|
|
279
306
|
data={ blockClientIds }
|
|
280
307
|
keyExtractor={ identity }
|
|
281
308
|
renderItem={ this.renderItem }
|
|
309
|
+
CellRendererComponent={ this.getCellRendererComponent }
|
|
282
310
|
shouldPreventAutomaticScroll={
|
|
283
311
|
this.shouldFlatListPreventAutomaticScroll
|
|
284
312
|
}
|
|
@@ -286,6 +314,7 @@ export class BlockList extends Component {
|
|
|
286
314
|
ListHeaderComponent={ header }
|
|
287
315
|
ListEmptyComponent={ ! isReadOnly && this.renderEmptyList }
|
|
288
316
|
ListFooterComponent={ this.renderBlockListFooter }
|
|
317
|
+
onScroll={ onScroll }
|
|
289
318
|
/>
|
|
290
319
|
{ this.shouldShowInnerBlockAppender() && (
|
|
291
320
|
<View
|
|
@@ -321,6 +350,15 @@ export class BlockList extends Component {
|
|
|
321
350
|
gridProperties,
|
|
322
351
|
} = this.props;
|
|
323
352
|
const { blockWidth } = this.state;
|
|
353
|
+
|
|
354
|
+
// Extracting the grid item properties here to avoid
|
|
355
|
+
// re-renders in the blockListItem component.
|
|
356
|
+
const isGridItem = !! gridProperties;
|
|
357
|
+
const gridItemProps = gridProperties && {
|
|
358
|
+
numOfColumns: gridProperties.numColumns,
|
|
359
|
+
tileCount: blockClientIds.length,
|
|
360
|
+
tileIndex: blockClientIds.indexOf( clientId ),
|
|
361
|
+
};
|
|
324
362
|
return (
|
|
325
363
|
<BlockListItem
|
|
326
364
|
isStackedHorizontally={ isStackedHorizontally }
|
|
@@ -337,8 +375,8 @@ export class BlockList extends Component {
|
|
|
337
375
|
this.shouldShowInnerBlockAppender
|
|
338
376
|
}
|
|
339
377
|
blockWidth={ blockWidth }
|
|
340
|
-
|
|
341
|
-
|
|
378
|
+
isGridItem={ isGridItem }
|
|
379
|
+
{ ...gridItemProps }
|
|
342
380
|
/>
|
|
343
381
|
);
|
|
344
382
|
}
|
|
@@ -401,6 +439,8 @@ export default compose( [
|
|
|
401
439
|
|
|
402
440
|
const isFloatingToolbarVisible =
|
|
403
441
|
!! selectedBlockClientId && hasRootInnerBlocks;
|
|
442
|
+
const isRTL = getSettings().isRTL;
|
|
443
|
+
|
|
404
444
|
return {
|
|
405
445
|
blockClientIds,
|
|
406
446
|
blockCount,
|
|
@@ -411,6 +451,7 @@ export default compose( [
|
|
|
411
451
|
isFloatingToolbarVisible,
|
|
412
452
|
isStackedHorizontally,
|
|
413
453
|
maxWidth,
|
|
454
|
+
isRTL,
|
|
414
455
|
};
|
|
415
456
|
}
|
|
416
457
|
),
|
|
@@ -262,12 +262,17 @@
|
|
|
262
262
|
right: $border-width;
|
|
263
263
|
bottom: $border-width;
|
|
264
264
|
box-shadow: 0 0 0 $border-width var(--wp-admin-theme-color);
|
|
265
|
-
|
|
265
|
+
// Border is outset, so subtract the width to achieve correct radius.
|
|
266
|
+
border-radius: $radius-block-ui - $border-width;
|
|
266
267
|
}
|
|
267
268
|
}
|
|
268
269
|
|
|
269
270
|
&.is-selected {
|
|
270
|
-
cursor:
|
|
271
|
+
cursor: default;
|
|
272
|
+
|
|
273
|
+
&.rich-text {
|
|
274
|
+
cursor: unset;
|
|
275
|
+
}
|
|
271
276
|
|
|
272
277
|
&::after {
|
|
273
278
|
box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); // Selected not focussed.
|
|
@@ -303,22 +308,6 @@
|
|
|
303
308
|
}
|
|
304
309
|
}
|
|
305
310
|
|
|
306
|
-
// Active entity spotlight.
|
|
307
|
-
// Disable if focus mode is active.
|
|
308
|
-
.is-root-container:not(.is-focus-mode) .block-editor-block-list__block.has-active-entity {
|
|
309
|
-
opacity: 0.5;
|
|
310
|
-
transition: opacity 0.1s linear;
|
|
311
|
-
@include reduce-motion("transition");
|
|
312
|
-
|
|
313
|
-
&.is-active-entity,
|
|
314
|
-
&.has-child-selected,
|
|
315
|
-
&:not(.has-child-selected) .block-editor-block-list__block,
|
|
316
|
-
&.is-active-entity .block-editor-block-list__block,
|
|
317
|
-
.is-active-entity .block-editor-block-list__block {
|
|
318
|
-
opacity: 1;
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
|
|
322
311
|
.wp-block[data-align="left"] > *,
|
|
323
312
|
.wp-block[data-align="right"] > *,
|
|
324
313
|
.wp-block.alignleft,
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { cloneDeep } from 'lodash';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import {
|
|
10
|
+
DEFAULT_BLOCK_LIST_CONTEXT,
|
|
11
|
+
deleteBlockLayoutByClientId,
|
|
12
|
+
} from '../block-list-context.native';
|
|
13
|
+
import {
|
|
14
|
+
BLOCKS_LAYOUTS_DATA,
|
|
15
|
+
DEEP_NESTED_ID,
|
|
16
|
+
GROUP_BLOCK_LAYOUT_DATA,
|
|
17
|
+
NESTED_WITH_INNER_BLOCKS_ID,
|
|
18
|
+
PARAGRAPH_BLOCK_LAYOUT_DATA,
|
|
19
|
+
ROOT_LEVEL_ID,
|
|
20
|
+
} from './fixtures/block-list-context.native';
|
|
21
|
+
|
|
22
|
+
describe( 'findBlockLayoutByClientId', () => {
|
|
23
|
+
it( "finds a block's layout data at root level", () => {
|
|
24
|
+
const { findBlockLayoutByClientId } = DEFAULT_BLOCK_LIST_CONTEXT;
|
|
25
|
+
const currentBlockLayouts = BLOCKS_LAYOUTS_DATA;
|
|
26
|
+
|
|
27
|
+
const blockRootLevel = findBlockLayoutByClientId(
|
|
28
|
+
currentBlockLayouts,
|
|
29
|
+
ROOT_LEVEL_ID
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
expect( blockRootLevel ).toEqual(
|
|
33
|
+
expect.objectContaining( { clientId: ROOT_LEVEL_ID } )
|
|
34
|
+
);
|
|
35
|
+
} );
|
|
36
|
+
|
|
37
|
+
it( "finds a nested block's layout data with inner blocks", () => {
|
|
38
|
+
const { findBlockLayoutByClientId } = DEFAULT_BLOCK_LIST_CONTEXT;
|
|
39
|
+
const currentBlockLayouts = BLOCKS_LAYOUTS_DATA;
|
|
40
|
+
|
|
41
|
+
const nestedBlock = findBlockLayoutByClientId(
|
|
42
|
+
currentBlockLayouts,
|
|
43
|
+
NESTED_WITH_INNER_BLOCKS_ID
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
expect( nestedBlock ).toEqual(
|
|
47
|
+
expect.objectContaining( { clientId: NESTED_WITH_INNER_BLOCKS_ID } )
|
|
48
|
+
);
|
|
49
|
+
} );
|
|
50
|
+
|
|
51
|
+
it( "finds a deep nested block's layout data", () => {
|
|
52
|
+
const { findBlockLayoutByClientId } = DEFAULT_BLOCK_LIST_CONTEXT;
|
|
53
|
+
const currentBlockLayouts = BLOCKS_LAYOUTS_DATA;
|
|
54
|
+
|
|
55
|
+
const deepNestedBlock = findBlockLayoutByClientId(
|
|
56
|
+
currentBlockLayouts,
|
|
57
|
+
DEEP_NESTED_ID
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
expect( deepNestedBlock ).toEqual(
|
|
61
|
+
expect.objectContaining( { clientId: DEEP_NESTED_ID } )
|
|
62
|
+
);
|
|
63
|
+
} );
|
|
64
|
+
} );
|
|
65
|
+
|
|
66
|
+
describe( 'deleteBlockLayoutByClientId', () => {
|
|
67
|
+
it( "deletes a block's layout data at root level", () => {
|
|
68
|
+
const { findBlockLayoutByClientId } = DEFAULT_BLOCK_LIST_CONTEXT;
|
|
69
|
+
const defaultBlockLayouts = cloneDeep( BLOCKS_LAYOUTS_DATA );
|
|
70
|
+
const currentBlockLayouts = deleteBlockLayoutByClientId(
|
|
71
|
+
defaultBlockLayouts,
|
|
72
|
+
ROOT_LEVEL_ID
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
const findDeletedBlock = findBlockLayoutByClientId(
|
|
76
|
+
currentBlockLayouts,
|
|
77
|
+
ROOT_LEVEL_ID
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
expect( findDeletedBlock ).toBeNull();
|
|
81
|
+
} );
|
|
82
|
+
|
|
83
|
+
it( "deletes a nested block's layout data with inner blocks", () => {
|
|
84
|
+
const { findBlockLayoutByClientId } = DEFAULT_BLOCK_LIST_CONTEXT;
|
|
85
|
+
const defaultBlockLayouts = cloneDeep( BLOCKS_LAYOUTS_DATA );
|
|
86
|
+
const currentBlockLayouts = deleteBlockLayoutByClientId(
|
|
87
|
+
defaultBlockLayouts,
|
|
88
|
+
NESTED_WITH_INNER_BLOCKS_ID
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
const findDeletedBlock = findBlockLayoutByClientId(
|
|
92
|
+
currentBlockLayouts,
|
|
93
|
+
NESTED_WITH_INNER_BLOCKS_ID
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
expect( findDeletedBlock ).toBeNull();
|
|
97
|
+
} );
|
|
98
|
+
|
|
99
|
+
it( "deletes a deep nested block's layout data", () => {
|
|
100
|
+
const { findBlockLayoutByClientId } = DEFAULT_BLOCK_LIST_CONTEXT;
|
|
101
|
+
const defaultBlockLayouts = cloneDeep( BLOCKS_LAYOUTS_DATA );
|
|
102
|
+
const currentBlockLayouts = deleteBlockLayoutByClientId(
|
|
103
|
+
defaultBlockLayouts,
|
|
104
|
+
DEEP_NESTED_ID
|
|
105
|
+
);
|
|
106
|
+
|
|
107
|
+
const findDeletedBlock = findBlockLayoutByClientId(
|
|
108
|
+
currentBlockLayouts,
|
|
109
|
+
DEEP_NESTED_ID
|
|
110
|
+
);
|
|
111
|
+
|
|
112
|
+
expect( findDeletedBlock ).toBeNull();
|
|
113
|
+
} );
|
|
114
|
+
} );
|
|
115
|
+
|
|
116
|
+
describe( 'updateBlocksLayouts', () => {
|
|
117
|
+
it( "adds a new block's layout data at root level with an empty object", () => {
|
|
118
|
+
const {
|
|
119
|
+
blocksLayouts,
|
|
120
|
+
findBlockLayoutByClientId,
|
|
121
|
+
updateBlocksLayouts,
|
|
122
|
+
} = DEFAULT_BLOCK_LIST_CONTEXT;
|
|
123
|
+
const currentBlockLayouts = cloneDeep( blocksLayouts );
|
|
124
|
+
const BLOCK_CLIENT_ID = PARAGRAPH_BLOCK_LAYOUT_DATA.clientId;
|
|
125
|
+
|
|
126
|
+
updateBlocksLayouts( currentBlockLayouts, PARAGRAPH_BLOCK_LAYOUT_DATA );
|
|
127
|
+
|
|
128
|
+
const findAddedBlock = findBlockLayoutByClientId(
|
|
129
|
+
currentBlockLayouts.current,
|
|
130
|
+
BLOCK_CLIENT_ID
|
|
131
|
+
);
|
|
132
|
+
|
|
133
|
+
expect( findAddedBlock ).toEqual(
|
|
134
|
+
expect.objectContaining( {
|
|
135
|
+
clientId: BLOCK_CLIENT_ID,
|
|
136
|
+
rootClientId: undefined,
|
|
137
|
+
} )
|
|
138
|
+
);
|
|
139
|
+
} );
|
|
140
|
+
|
|
141
|
+
it( "adds a new block's layout data at root level with inner blocks", () => {
|
|
142
|
+
const {
|
|
143
|
+
findBlockLayoutByClientId,
|
|
144
|
+
updateBlocksLayouts,
|
|
145
|
+
} = DEFAULT_BLOCK_LIST_CONTEXT;
|
|
146
|
+
const currentBlockLayouts = {
|
|
147
|
+
current: cloneDeep( BLOCKS_LAYOUTS_DATA ),
|
|
148
|
+
};
|
|
149
|
+
const PARENT_BLOCK_CLIENT_ID = GROUP_BLOCK_LAYOUT_DATA.clientId;
|
|
150
|
+
|
|
151
|
+
// Add parent block
|
|
152
|
+
updateBlocksLayouts( currentBlockLayouts, GROUP_BLOCK_LAYOUT_DATA );
|
|
153
|
+
|
|
154
|
+
const findAddedParentBlock = findBlockLayoutByClientId(
|
|
155
|
+
currentBlockLayouts.current,
|
|
156
|
+
PARENT_BLOCK_CLIENT_ID
|
|
157
|
+
);
|
|
158
|
+
|
|
159
|
+
expect( findAddedParentBlock ).toEqual(
|
|
160
|
+
expect.objectContaining( { clientId: PARENT_BLOCK_CLIENT_ID } )
|
|
161
|
+
);
|
|
162
|
+
|
|
163
|
+
// Add inner block to it's parent
|
|
164
|
+
updateBlocksLayouts( currentBlockLayouts, {
|
|
165
|
+
...PARAGRAPH_BLOCK_LAYOUT_DATA,
|
|
166
|
+
rootClientId: PARENT_BLOCK_CLIENT_ID,
|
|
167
|
+
} );
|
|
168
|
+
|
|
169
|
+
const findAddedInnerBlock = findBlockLayoutByClientId(
|
|
170
|
+
currentBlockLayouts.current,
|
|
171
|
+
PARAGRAPH_BLOCK_LAYOUT_DATA.clientId
|
|
172
|
+
);
|
|
173
|
+
|
|
174
|
+
expect( findAddedInnerBlock ).toEqual(
|
|
175
|
+
expect.objectContaining( {
|
|
176
|
+
clientId: PARAGRAPH_BLOCK_LAYOUT_DATA.clientId,
|
|
177
|
+
rootClientId: PARENT_BLOCK_CLIENT_ID,
|
|
178
|
+
} )
|
|
179
|
+
);
|
|
180
|
+
} );
|
|
181
|
+
|
|
182
|
+
it( "adds a new block's layout data at deep level", () => {
|
|
183
|
+
const {
|
|
184
|
+
findBlockLayoutByClientId,
|
|
185
|
+
updateBlocksLayouts,
|
|
186
|
+
} = DEFAULT_BLOCK_LIST_CONTEXT;
|
|
187
|
+
const currentBlockLayouts = {
|
|
188
|
+
current: cloneDeep( BLOCKS_LAYOUTS_DATA ),
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
// Add block layout data to it's parents inner blocks
|
|
192
|
+
updateBlocksLayouts( currentBlockLayouts, {
|
|
193
|
+
...PARAGRAPH_BLOCK_LAYOUT_DATA,
|
|
194
|
+
rootClientId: NESTED_WITH_INNER_BLOCKS_ID,
|
|
195
|
+
} );
|
|
196
|
+
|
|
197
|
+
const findAddedInnerBlock = findBlockLayoutByClientId(
|
|
198
|
+
currentBlockLayouts.current,
|
|
199
|
+
PARAGRAPH_BLOCK_LAYOUT_DATA.clientId
|
|
200
|
+
);
|
|
201
|
+
|
|
202
|
+
expect( findAddedInnerBlock ).toEqual(
|
|
203
|
+
expect.objectContaining( {
|
|
204
|
+
clientId: PARAGRAPH_BLOCK_LAYOUT_DATA.clientId,
|
|
205
|
+
rootClientId: NESTED_WITH_INNER_BLOCKS_ID,
|
|
206
|
+
} )
|
|
207
|
+
);
|
|
208
|
+
} );
|
|
209
|
+
|
|
210
|
+
it( "deletes a block's layout data at root level", () => {
|
|
211
|
+
const {
|
|
212
|
+
findBlockLayoutByClientId,
|
|
213
|
+
updateBlocksLayouts,
|
|
214
|
+
} = DEFAULT_BLOCK_LIST_CONTEXT;
|
|
215
|
+
const currentBlockLayouts = {
|
|
216
|
+
current: cloneDeep( BLOCKS_LAYOUTS_DATA ),
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
updateBlocksLayouts( currentBlockLayouts, {
|
|
220
|
+
shouldRemove: true,
|
|
221
|
+
clientId: ROOT_LEVEL_ID,
|
|
222
|
+
} );
|
|
223
|
+
|
|
224
|
+
const findDeletedBlock = findBlockLayoutByClientId(
|
|
225
|
+
currentBlockLayouts.current,
|
|
226
|
+
ROOT_LEVEL_ID
|
|
227
|
+
);
|
|
228
|
+
|
|
229
|
+
expect( findDeletedBlock ).toBeNull();
|
|
230
|
+
} );
|
|
231
|
+
|
|
232
|
+
it( "deletes a block's layout data at a deep level", () => {
|
|
233
|
+
const {
|
|
234
|
+
findBlockLayoutByClientId,
|
|
235
|
+
updateBlocksLayouts,
|
|
236
|
+
} = DEFAULT_BLOCK_LIST_CONTEXT;
|
|
237
|
+
const currentBlockLayouts = {
|
|
238
|
+
current: cloneDeep( BLOCKS_LAYOUTS_DATA ),
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
updateBlocksLayouts( currentBlockLayouts, {
|
|
242
|
+
shouldRemove: true,
|
|
243
|
+
clientId: DEEP_NESTED_ID,
|
|
244
|
+
} );
|
|
245
|
+
|
|
246
|
+
const findDeletedBlock = findBlockLayoutByClientId(
|
|
247
|
+
currentBlockLayouts.current,
|
|
248
|
+
DEEP_NESTED_ID
|
|
249
|
+
);
|
|
250
|
+
|
|
251
|
+
expect( findDeletedBlock ).toBeNull();
|
|
252
|
+
} );
|
|
253
|
+
} );
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
export const ROOT_LEVEL_ID = 'e59528f8-fb35-4ec1-aec6-5a065c236fa1';
|
|
2
|
+
export const ROOT_LEVEL_WITH_INNER_BLOCKS_ID =
|
|
3
|
+
'72a9220f-4c3d-4b00-bae1-4506513f63d8';
|
|
4
|
+
export const NESTED_WITH_INNER_BLOCKS_ID =
|
|
5
|
+
'9f3d1f1e-df85-485d-af63-dc8cb1b93cbc';
|
|
6
|
+
export const DEEP_NESTED_ID = 'abec845a-e4de-43fb-96f7-80dc3d51ad7a';
|
|
7
|
+
|
|
8
|
+
export const BLOCKS_LAYOUTS_DATA = {
|
|
9
|
+
[ ROOT_LEVEL_ID ]: {
|
|
10
|
+
clientId: ROOT_LEVEL_ID,
|
|
11
|
+
width: 390,
|
|
12
|
+
height: 54,
|
|
13
|
+
x: 0,
|
|
14
|
+
y: 83,
|
|
15
|
+
innerBlocks: {},
|
|
16
|
+
},
|
|
17
|
+
[ ROOT_LEVEL_WITH_INNER_BLOCKS_ID ]: {
|
|
18
|
+
clientId: ROOT_LEVEL_WITH_INNER_BLOCKS_ID,
|
|
19
|
+
width: 390,
|
|
20
|
+
height: 386,
|
|
21
|
+
x: 0,
|
|
22
|
+
y: 137,
|
|
23
|
+
innerBlocks: {
|
|
24
|
+
'62839858-48b0-44ed-b834-1343a1357e54': {
|
|
25
|
+
clientId: '62839858-48b0-44ed-b834-1343a1357e54',
|
|
26
|
+
rootClientId: ROOT_LEVEL_WITH_INNER_BLOCKS_ID,
|
|
27
|
+
width: 390,
|
|
28
|
+
height: 54,
|
|
29
|
+
x: 0,
|
|
30
|
+
y: 0,
|
|
31
|
+
innerBlocks: {},
|
|
32
|
+
},
|
|
33
|
+
[ NESTED_WITH_INNER_BLOCKS_ID ]: {
|
|
34
|
+
clientId: NESTED_WITH_INNER_BLOCKS_ID,
|
|
35
|
+
rootClientId: ROOT_LEVEL_WITH_INNER_BLOCKS_ID,
|
|
36
|
+
width: 390,
|
|
37
|
+
height: 332,
|
|
38
|
+
x: 0,
|
|
39
|
+
y: 54,
|
|
40
|
+
innerBlocks: {
|
|
41
|
+
'435d62a4-afa7-457c-a894-b04390d7b447': {
|
|
42
|
+
clientId: '435d62a4-afa7-457c-a894-b04390d7b447',
|
|
43
|
+
rootClientId: NESTED_WITH_INNER_BLOCKS_ID,
|
|
44
|
+
width: 358,
|
|
45
|
+
height: 54,
|
|
46
|
+
x: 0,
|
|
47
|
+
y: 0,
|
|
48
|
+
innerBlocks: {},
|
|
49
|
+
},
|
|
50
|
+
[ DEEP_NESTED_ID ]: {
|
|
51
|
+
clientId: DEEP_NESTED_ID,
|
|
52
|
+
rootClientId: NESTED_WITH_INNER_BLOCKS_ID,
|
|
53
|
+
width: 358,
|
|
54
|
+
height: 98,
|
|
55
|
+
x: 0,
|
|
56
|
+
y: 54,
|
|
57
|
+
innerBlocks: {},
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export const PARAGRAPH_BLOCK_LAYOUT_DATA = {
|
|
66
|
+
clientId: '22dda04f-4718-45b2-8cd2-36cedb9eae4d',
|
|
67
|
+
width: 390,
|
|
68
|
+
height: 98,
|
|
69
|
+
x: 0,
|
|
70
|
+
y: 83,
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export const GROUP_BLOCK_LAYOUT_DATA = {
|
|
74
|
+
clientId: 'e18249d9-ec06-4f54-b71e-6ec59be5213e',
|
|
75
|
+
width: 390,
|
|
76
|
+
height: 164,
|
|
77
|
+
x: 0,
|
|
78
|
+
y: 83,
|
|
79
|
+
};
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
__unstableGetBlockProps as getBlockProps,
|
|
13
13
|
getBlockType,
|
|
14
14
|
} from '@wordpress/blocks';
|
|
15
|
-
import { useMergeRefs } from '@wordpress/compose';
|
|
15
|
+
import { useMergeRefs, useDisabled } from '@wordpress/compose';
|
|
16
16
|
import { useSelect } from '@wordpress/data';
|
|
17
17
|
import warning from '@wordpress/warning';
|
|
18
18
|
|
|
@@ -50,14 +50,18 @@ const BLOCK_ANIMATION_THRESHOLD = 200;
|
|
|
50
50
|
* also pass any other props through this hook, and they will be merged and
|
|
51
51
|
* returned.
|
|
52
52
|
*
|
|
53
|
-
* @param {Object} props
|
|
54
|
-
*
|
|
55
|
-
* @param {Object} options
|
|
53
|
+
* @param {Object} props Optional. Props to pass to the element. Must contain
|
|
54
|
+
* the ref if one is defined.
|
|
55
|
+
* @param {Object} options Options for internal use only.
|
|
56
56
|
* @param {boolean} options.__unstableIsHtml
|
|
57
|
+
* @param {boolean} options.__unstableIsDisabled Whether the block should be disabled.
|
|
57
58
|
*
|
|
58
59
|
* @return {Object} Props to pass to the element to mark as a block.
|
|
59
60
|
*/
|
|
60
|
-
export function useBlockProps(
|
|
61
|
+
export function useBlockProps(
|
|
62
|
+
props = {},
|
|
63
|
+
{ __unstableIsHtml, __unstableIsDisabled = false } = {}
|
|
64
|
+
) {
|
|
61
65
|
const { clientId, className, wrapperProps = {}, isAligned } = useContext(
|
|
62
66
|
BlockListBlockContext
|
|
63
67
|
);
|
|
@@ -125,6 +129,7 @@ export function useBlockProps( props = {}, { __unstableIsHtml } = {} ) {
|
|
|
125
129
|
enableAnimation,
|
|
126
130
|
triggerAnimationOnChange: index,
|
|
127
131
|
} ),
|
|
132
|
+
useDisabled( { isDisabled: ! __unstableIsDisabled } ),
|
|
128
133
|
] );
|
|
129
134
|
|
|
130
135
|
const blockEditContext = useBlockEditContext();
|
|
@@ -33,12 +33,8 @@ export function useBlockClassNames( clientId ) {
|
|
|
33
33
|
getSettings,
|
|
34
34
|
hasSelectedInnerBlock,
|
|
35
35
|
isTyping,
|
|
36
|
-
__experimentalGetActiveBlockIdByBlockNames: getActiveBlockIdByBlockNames,
|
|
37
36
|
} = select( blockEditorStore );
|
|
38
|
-
const {
|
|
39
|
-
__experimentalSpotlightEntityBlocks: spotlightEntityBlocks,
|
|
40
|
-
outlineMode,
|
|
41
|
-
} = getSettings();
|
|
37
|
+
const { outlineMode } = getSettings();
|
|
42
38
|
const isDragging = isBlockBeingDragged( clientId );
|
|
43
39
|
const isSelected = isBlockSelected( clientId );
|
|
44
40
|
const name = getBlockName( clientId );
|
|
@@ -48,9 +44,6 @@ export function useBlockClassNames( clientId ) {
|
|
|
48
44
|
clientId,
|
|
49
45
|
checkDeep
|
|
50
46
|
);
|
|
51
|
-
const activeEntityBlockId = getActiveBlockIdByBlockNames(
|
|
52
|
-
spotlightEntityBlocks
|
|
53
|
-
);
|
|
54
47
|
return classnames( {
|
|
55
48
|
'is-selected': isSelected,
|
|
56
49
|
'is-highlighted': isBlockHighlighted( clientId ),
|
|
@@ -58,9 +51,6 @@ export function useBlockClassNames( clientId ) {
|
|
|
58
51
|
'is-reusable': isReusableBlock( getBlockType( name ) ),
|
|
59
52
|
'is-dragging': isDragging,
|
|
60
53
|
'has-child-selected': isAncestorOfSelectedBlock,
|
|
61
|
-
'has-active-entity': activeEntityBlockId,
|
|
62
|
-
// Determine if there is an active entity area to spotlight.
|
|
63
|
-
'is-active-entity': activeEntityBlockId === clientId,
|
|
64
54
|
'remove-outline': isSelected && outlineMode && isTyping(),
|
|
65
55
|
} );
|
|
66
56
|
},
|
|
@@ -110,7 +110,7 @@ export function useInBetweenInserter() {
|
|
|
110
110
|
// Don't show the insertion point if a parent block has an "overlay"
|
|
111
111
|
// See https://github.com/WordPress/gutenberg/pull/34012#pullrequestreview-727762337
|
|
112
112
|
const parentOverlay = element.parentElement?.closest(
|
|
113
|
-
'.block-editor-block-content-overlay
|
|
113
|
+
'.block-editor-block-content-overlay'
|
|
114
114
|
);
|
|
115
115
|
if ( parentOverlay ) {
|
|
116
116
|
return;
|
|
@@ -15,6 +15,7 @@ import { useState, useEffect } from '@wordpress/element';
|
|
|
15
15
|
*/
|
|
16
16
|
import styles from './style.scss';
|
|
17
17
|
import BlockMover from '../block-mover';
|
|
18
|
+
import BlockDraggable from '../block-draggable';
|
|
18
19
|
import BlockActionsMenu from './block-actions-menu';
|
|
19
20
|
import { BlockSettingsButton } from '../block-settings';
|
|
20
21
|
import { store as blockEditorStore } from '../../store';
|
|
@@ -33,6 +34,7 @@ const BlockMobileToolbar = ( {
|
|
|
33
34
|
blockWidth,
|
|
34
35
|
anchorNodeRef,
|
|
35
36
|
isFullWidth,
|
|
37
|
+
draggingClientId,
|
|
36
38
|
} ) => {
|
|
37
39
|
const [ fillsLength, setFillsLength ] = useState( null );
|
|
38
40
|
const [ appenderWidth, setAppenderWidth ] = useState( 0 );
|
|
@@ -73,7 +75,13 @@ const BlockMobileToolbar = ( {
|
|
|
73
75
|
/>
|
|
74
76
|
) }
|
|
75
77
|
|
|
76
|
-
<
|
|
78
|
+
<BlockDraggable
|
|
79
|
+
clientId={ clientId }
|
|
80
|
+
draggingClientId={ draggingClientId }
|
|
81
|
+
testID="draggable-trigger-mobile-toolbar"
|
|
82
|
+
>
|
|
83
|
+
{ () => <View style={ styles.spacer } /> }
|
|
84
|
+
</BlockDraggable>
|
|
77
85
|
|
|
78
86
|
<BlockSettingsButton.Slot>
|
|
79
87
|
{ /* Render only one settings icon even if we have more than one fill - need for hooks with controls. */ }
|