@wordpress/block-editor 8.5.7 → 9.1.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 +5 -74
- package/build/components/block-content-overlay/index.js.map +1 -1
- package/build/components/block-draggable/draggable-chip.native.js +64 -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 +484 -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 +29 -6
- package/build/components/block-list/block.native.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-lock/modal.js +34 -4
- package/build/components/block-lock/modal.js.map +1 -1
- package/build/components/block-lock/toolbar.js +2 -1
- package/build/components/block-lock/toolbar.js.map +1 -1
- package/build/components/block-lock/use-block-lock.js +4 -1
- package/build/components/block-lock/use-block-lock.js.map +1 -1
- package/build/components/block-mobile-toolbar/index.native.js +9 -3
- package/build/components/block-mobile-toolbar/index.native.js.map +1 -1
- package/build/components/block-mover/button.js +4 -4
- package/build/components/block-mover/button.js.map +1 -1
- package/build/components/block-mover/index.js +39 -65
- package/build/components/block-mover/index.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 +191 -0
- package/build/components/block-popover/inbetween.js.map +1 -0
- package/build/components/block-popover/index.js +85 -0
- package/build/components/block-popover/index.js.map +1 -0
- package/build/components/{block-tools → block-popover}/use-popover-scroll.js +4 -1
- package/build/components/block-popover/use-popover-scroll.js.map +1 -0
- package/build/components/block-preview/index.js +1 -1
- package/build/components/block-preview/index.js.map +1 -1
- package/build/components/block-styles/index.js +1 -10
- package/build/components/block-styles/index.js.map +1 -1
- package/build/components/block-tools/back-compat.js +2 -2
- package/build/components/block-tools/back-compat.js.map +1 -1
- package/build/components/block-tools/block-selection-button.js +4 -2
- package/build/components/block-tools/block-selection-button.js.map +1 -1
- package/build/components/block-tools/index.js +5 -5
- package/build/components/block-tools/index.js.map +1 -1
- package/build/components/block-tools/insertion-point.js +14 -121
- package/build/components/block-tools/insertion-point.js.map +1 -1
- package/build/components/block-tools/selected-block-popover.js +216 -0
- package/build/components/block-tools/selected-block-popover.js.map +1 -0
- 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 +149 -44
- package/build/components/colors-gradients/dropdown.js.map +1 -1
- package/build/components/duotone-control/index.js +5 -1
- package/build/components/duotone-control/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 +5 -23
- package/build/components/index.js.map +1 -1
- package/build/components/inserter/index.native.js +31 -9
- package/build/components/inserter/index.native.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/navigable-toolbar/index.js +12 -2
- package/build/components/navigable-toolbar/index.js.map +1 -1
- 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 +1 -6
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/index.native.js +0 -4
- 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-display-information/index.js +3 -1
- package/build/components/use-block-display-information/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/hooks/anchor.js.map +1 -1
- package/build/hooks/border.js +463 -44
- 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/dimensions.js +2 -2
- package/build/hooks/dimensions.js.map +1 -1
- package/build/hooks/index.js +3 -1
- 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/hooks/use-border-props.js +22 -32
- package/build/hooks/use-border-props.js.map +1 -1
- package/build/store/actions.js +14 -2
- 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 +0 -26
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +47 -15
- 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 +4 -70
- package/build-module/components/block-content-overlay/index.js.map +1 -1
- package/build-module/components/block-draggable/draggable-chip.native.js +50 -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 +449 -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 +28 -6
- package/build-module/components/block-list/block.native.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-lock/modal.js +34 -5
- package/build-module/components/block-lock/modal.js.map +1 -1
- package/build-module/components/block-lock/toolbar.js +2 -1
- package/build-module/components/block-lock/toolbar.js.map +1 -1
- package/build-module/components/block-lock/use-block-lock.js +4 -1
- package/build-module/components/block-lock/use-block-lock.js.map +1 -1
- package/build-module/components/block-mobile-toolbar/index.native.js +8 -3
- package/build-module/components/block-mobile-toolbar/index.native.js.map +1 -1
- package/build-module/components/block-mover/button.js +5 -5
- package/build-module/components/block-mover/button.js.map +1 -1
- package/build-module/components/block-mover/index.js +38 -63
- package/build-module/components/block-mover/index.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 +173 -0
- package/build-module/components/block-popover/inbetween.js.map +1 -0
- package/build-module/components/block-popover/index.js +72 -0
- package/build-module/components/block-popover/index.js.map +1 -0
- package/build-module/components/{block-tools → block-popover}/use-popover-scroll.js +3 -1
- package/build-module/components/block-popover/use-popover-scroll.js.map +1 -0
- 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-styles/index.js +1 -9
- package/build-module/components/block-styles/index.js.map +1 -1
- package/build-module/components/block-tools/back-compat.js +1 -1
- package/build-module/components/block-tools/back-compat.js.map +1 -1
- package/build-module/components/block-tools/block-selection-button.js +3 -2
- package/build-module/components/block-tools/block-selection-button.js.map +1 -1
- package/build-module/components/block-tools/index.js +3 -3
- package/build-module/components/block-tools/index.js.map +1 -1
- package/build-module/components/block-tools/insertion-point.js +16 -121
- package/build-module/components/block-tools/insertion-point.js.map +1 -1
- package/build-module/components/block-tools/selected-block-popover.js +199 -0
- package/build-module/components/block-tools/selected-block-popover.js.map +1 -0
- 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 +151 -46
- package/build-module/components/colors-gradients/dropdown.js.map +1 -1
- package/build-module/components/duotone-control/index.js +4 -1
- package/build-module/components/duotone-control/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 +1 -3
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/inserter/index.native.js +32 -11
- package/build-module/components/inserter/index.native.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/navigable-toolbar/index.js +12 -2
- package/build-module/components/navigable-toolbar/index.js.map +1 -1
- 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 +1 -5
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/index.native.js +0 -4
- 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-display-information/index.js +3 -1
- package/build-module/components/use-block-display-information/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/hooks/anchor.js.map +1 -1
- package/build-module/hooks/border.js +453 -44
- 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/dimensions.js +5 -5
- package/build-module/hooks/dimensions.js.map +1 -1
- package/build-module/hooks/index.js +2 -1
- 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/hooks/use-border-props.js +21 -30
- package/build-module/hooks/use-border-props.js.map +1 -1
- package/build-module/store/actions.js +14 -2
- 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 +0 -24
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +44 -15
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +148 -410
- package/build-style/style.css +148 -410
- package/package.json +28 -28
- 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 +9 -79
- package/src/components/block-content-overlay/style.scss +2 -11
- 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 +458 -0
- package/src/components/block-draggable/style.native.scss +19 -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 +38 -8
- 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-lock/modal.js +42 -3
- package/src/components/block-lock/toolbar.js +2 -2
- package/src/components/block-lock/use-block-lock.js +4 -1
- package/src/components/block-mobile-toolbar/index.native.js +8 -1
- package/src/components/block-mover/button.js +5 -7
- package/src/components/block-mover/index.js +37 -60
- package/src/components/block-mover/index.native.js +22 -6
- package/src/components/block-mover/stories/index.js +110 -0
- package/src/components/block-mover/style.scss +48 -138
- package/src/components/block-mover/test/__snapshots__/index.native.js.snap +6 -0
- package/src/components/block-navigation/dropdown.js +12 -8
- package/src/components/block-popover/README.md +41 -0
- package/src/components/block-popover/inbetween.js +188 -0
- package/src/components/block-popover/index.js +75 -0
- package/src/components/block-popover/style.scss +28 -0
- package/src/components/{block-tools → block-popover}/use-popover-scroll.js +3 -1
- package/src/components/block-preview/index.js +1 -4
- package/src/components/block-styles/index.js +1 -12
- package/src/components/block-switcher/style.scss +2 -43
- package/src/components/block-toolbar/style.scss +0 -12
- package/src/components/block-tools/back-compat.js +1 -1
- package/src/components/block-tools/block-selection-button.js +3 -1
- package/src/components/block-tools/index.js +6 -4
- package/src/components/block-tools/insertion-point.js +19 -152
- package/src/components/block-tools/{block-popover.js → selected-block-popover.js} +24 -151
- package/src/components/block-tools/style.scss +12 -135
- package/src/components/border-radius-control/input-controls.js +16 -8
- package/src/components/border-radius-control/style.scss +7 -3
- 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 +156 -62
- package/src/components/colors-gradients/style.scss +51 -23
- package/src/components/default-block-appender/style.scss +1 -2
- package/src/components/duotone-control/index.js +8 -1
- package/src/components/duotone-control/style.scss +1 -7
- package/src/components/gradients/README.md +29 -0
- 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 +1 -3
- package/src/components/inserter/index.native.js +60 -25
- package/src/components/inserter/style.native.scss +25 -3
- 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/navigable-toolbar/README.md +16 -0
- package/src/components/navigable-toolbar/index.js +12 -2
- package/src/components/preview-options/style.scss +0 -4
- package/src/components/rich-text/format-toolbar-container.js +0 -1
- package/src/components/rich-text/index.js +1 -3
- package/src/components/rich-text/index.native.js +0 -4
- package/src/components/rich-text/style.scss +2 -8
- package/src/components/url-input/index.js +9 -4
- package/src/components/use-block-display-information/index.js +2 -0
- 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/hooks/anchor.js +1 -1
- package/src/hooks/border.js +429 -72
- package/src/hooks/color-panel.js +13 -9
- package/src/hooks/color.scss +0 -62
- package/src/hooks/dimensions.js +44 -38
- package/src/hooks/index.js +2 -1
- 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/hooks/use-border-props.js +15 -32
- package/src/store/actions.js +14 -2
- package/src/store/defaults.js +0 -1
- package/src/store/reducer.js +0 -21
- package/src/store/selectors.js +46 -15
- package/src/store/test/actions.js +0 -18
- package/src/store/test/reducer.js +0 -19
- package/src/store/test/selectors.js +17 -19
- package/src/style.scss +2 -3
- package/tsconfig.tsbuildinfo +1 -1
- package/build/components/block-mobile-toolbar/index.js +0 -42
- package/build/components/block-mobile-toolbar/index.js.map +0 -1
- package/build/components/block-tools/block-popover.js +0 -327
- package/build/components/block-tools/block-popover.js.map +0 -1
- package/build/components/block-tools/use-popover-scroll.js.map +0 -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-gradients/tools-panel-color-dropdown.js +0 -89
- package/build/components/colors-gradients/tools-panel-color-dropdown.js.map +0 -1
- package/build/components/list-view/appender.js +0 -93
- package/build/components/list-view/appender.js.map +0 -1
- package/build/components/list-view/list-item.js +0 -62
- package/build/components/list-view/list-item.js.map +0 -1
- package/build/components/rich-text/use-caret-in-format.js +0 -43
- package/build/components/rich-text/use-caret-in-format.js.map +0 -1
- package/build/hooks/border-color.js +0 -302
- package/build/hooks/border-color.js.map +0 -1
- package/build/hooks/border-style.js +0 -96
- package/build/hooks/border-style.js.map +0 -1
- package/build/hooks/border-width.js +0 -162
- package/build/hooks/border-width.js.map +0 -1
- package/build-module/components/block-mobile-toolbar/index.js +0 -31
- package/build-module/components/block-mobile-toolbar/index.js.map +0 -1
- package/build-module/components/block-tools/block-popover.js +0 -306
- package/build-module/components/block-tools/block-popover.js.map +0 -1
- package/build-module/components/block-tools/use-popover-scroll.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-gradients/tools-panel-color-dropdown.js +0 -75
- package/build-module/components/colors-gradients/tools-panel-color-dropdown.js.map +0 -1
- package/build-module/components/list-view/appender.js +0 -76
- package/build-module/components/list-view/appender.js.map +0 -1
- package/build-module/components/list-view/list-item.js +0 -47
- package/build-module/components/list-view/list-item.js.map +0 -1
- package/build-module/components/rich-text/use-caret-in-format.js +0 -33
- package/build-module/components/rich-text/use-caret-in-format.js.map +0 -1
- package/build-module/hooks/border-color.js +0 -276
- package/build-module/hooks/border-color.js.map +0 -1
- package/build-module/hooks/border-style.js +0 -78
- package/build-module/hooks/border-style.js.map +0 -1
- package/build-module/hooks/border-width.js +0 -143
- package/build-module/hooks/border-width.js.map +0 -1
- package/src/components/block-alignment-matrix-control/style.scss +0 -10
- package/src/components/block-mobile-toolbar/index.js +0 -24
- package/src/components/block-mobile-toolbar/style.scss +0 -29
- package/src/components/border-style-control/index.js +0 -47
- package/src/components/border-style-control/style.scss +0 -18
- package/src/components/colors-gradients/tools-panel-color-dropdown.js +0 -85
- package/src/components/list-view/appender.js +0 -82
- package/src/components/list-view/list-item.js +0 -59
- package/src/components/rich-text/use-caret-in-format.js +0 -28
- package/src/hooks/border-color.js +0 -315
- package/src/hooks/border-style.js +0 -64
- package/src/hooks/border-width.js +0 -139
|
@@ -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;
|
|
@@ -13,7 +13,8 @@ import {
|
|
|
13
13
|
} from '@wordpress/components';
|
|
14
14
|
import { lock as lockIcon, unlock as unlockIcon } from '@wordpress/icons';
|
|
15
15
|
import { useInstanceId } from '@wordpress/compose';
|
|
16
|
-
import { useDispatch } from '@wordpress/data';
|
|
16
|
+
import { useDispatch, useSelect } from '@wordpress/data';
|
|
17
|
+
import { isReusableBlock, getBlockType } from '@wordpress/blocks';
|
|
17
18
|
|
|
18
19
|
/**
|
|
19
20
|
* Internal dependencies
|
|
@@ -24,7 +25,18 @@ import { store as blockEditorStore } from '../../store';
|
|
|
24
25
|
|
|
25
26
|
export default function BlockLockModal( { clientId, onClose } ) {
|
|
26
27
|
const [ lock, setLock ] = useState( { move: false, remove: false } );
|
|
27
|
-
const { canMove, canRemove } = useBlockLock( clientId );
|
|
28
|
+
const { canEdit, canMove, canRemove } = useBlockLock( clientId );
|
|
29
|
+
const { isReusable } = useSelect(
|
|
30
|
+
( select ) => {
|
|
31
|
+
const { getBlockName } = select( blockEditorStore );
|
|
32
|
+
const blockName = getBlockName( clientId );
|
|
33
|
+
|
|
34
|
+
return {
|
|
35
|
+
isReusable: isReusableBlock( getBlockType( blockName ) ),
|
|
36
|
+
};
|
|
37
|
+
},
|
|
38
|
+
[ clientId ]
|
|
39
|
+
);
|
|
28
40
|
const { updateBlockAttributes } = useDispatch( blockEditorStore );
|
|
29
41
|
const blockInformation = useBlockDisplayInformation( clientId );
|
|
30
42
|
const instanceId = useInstanceId(
|
|
@@ -36,8 +48,9 @@ export default function BlockLockModal( { clientId, onClose } ) {
|
|
|
36
48
|
setLock( {
|
|
37
49
|
move: ! canMove,
|
|
38
50
|
remove: ! canRemove,
|
|
51
|
+
...( isReusable ? { edit: ! canEdit } : {} ),
|
|
39
52
|
} );
|
|
40
|
-
}, [ canMove, canRemove ] );
|
|
53
|
+
}, [ canEdit, canMove, canRemove, isReusable ] );
|
|
41
54
|
|
|
42
55
|
const isAllChecked = Object.values( lock ).every( Boolean );
|
|
43
56
|
const isMixed = Object.values( lock ).some( Boolean ) && ! isAllChecked;
|
|
@@ -81,10 +94,36 @@ export default function BlockLockModal( { clientId, onClose } ) {
|
|
|
81
94
|
setLock( {
|
|
82
95
|
move: newValue,
|
|
83
96
|
remove: newValue,
|
|
97
|
+
...( isReusable ? { edit: newValue } : {} ),
|
|
84
98
|
} )
|
|
85
99
|
}
|
|
86
100
|
/>
|
|
87
101
|
<ul className="block-editor-block-lock-modal__checklist">
|
|
102
|
+
{ isReusable && (
|
|
103
|
+
<li className="block-editor-block-lock-modal__checklist-item">
|
|
104
|
+
<CheckboxControl
|
|
105
|
+
label={
|
|
106
|
+
<>
|
|
107
|
+
{ __( 'Restrict editing' ) }
|
|
108
|
+
<Icon
|
|
109
|
+
icon={
|
|
110
|
+
lock.edit
|
|
111
|
+
? lockIcon
|
|
112
|
+
: unlockIcon
|
|
113
|
+
}
|
|
114
|
+
/>
|
|
115
|
+
</>
|
|
116
|
+
}
|
|
117
|
+
checked={ !! lock.edit }
|
|
118
|
+
onChange={ ( edit ) =>
|
|
119
|
+
setLock( ( prevLock ) => ( {
|
|
120
|
+
...prevLock,
|
|
121
|
+
edit,
|
|
122
|
+
} ) )
|
|
123
|
+
}
|
|
124
|
+
/>
|
|
125
|
+
</li>
|
|
126
|
+
) }
|
|
88
127
|
<li className="block-editor-block-lock-modal__checklist-item">
|
|
89
128
|
<CheckboxControl
|
|
90
129
|
label={
|
|
@@ -15,7 +15,7 @@ import useBlockDisplayInformation from '../use-block-display-information';
|
|
|
15
15
|
|
|
16
16
|
export default function BlockLockToolbar( { clientId } ) {
|
|
17
17
|
const blockInformation = useBlockDisplayInformation( clientId );
|
|
18
|
-
const { canMove, canRemove, canLock } = useBlockLock( clientId );
|
|
18
|
+
const { canEdit, canMove, canRemove, canLock } = useBlockLock( clientId );
|
|
19
19
|
|
|
20
20
|
const [ isModalOpen, toggleModal ] = useReducer(
|
|
21
21
|
( isActive ) => ! isActive,
|
|
@@ -26,7 +26,7 @@ export default function BlockLockToolbar( { clientId } ) {
|
|
|
26
26
|
return null;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
if ( canMove && canRemove ) {
|
|
29
|
+
if ( canEdit && canMove && canRemove ) {
|
|
30
30
|
return null;
|
|
31
31
|
}
|
|
32
32
|
|
|
@@ -19,6 +19,7 @@ export default function useBlockLock( clientId ) {
|
|
|
19
19
|
return useSelect(
|
|
20
20
|
( select ) => {
|
|
21
21
|
const {
|
|
22
|
+
canEditBlock,
|
|
22
23
|
canMoveBlock,
|
|
23
24
|
canRemoveBlock,
|
|
24
25
|
canLockBlockType,
|
|
@@ -27,14 +28,16 @@ export default function useBlockLock( clientId ) {
|
|
|
27
28
|
} = select( blockEditorStore );
|
|
28
29
|
const rootClientId = getBlockRootClientId( clientId );
|
|
29
30
|
|
|
31
|
+
const canEdit = canEditBlock( clientId );
|
|
30
32
|
const canMove = canMoveBlock( clientId, rootClientId );
|
|
31
33
|
const canRemove = canRemoveBlock( clientId, rootClientId );
|
|
32
34
|
|
|
33
35
|
return {
|
|
36
|
+
canEdit,
|
|
34
37
|
canMove,
|
|
35
38
|
canRemove,
|
|
36
39
|
canLock: canLockBlockType( getBlockName( clientId ) ),
|
|
37
|
-
isLocked: ! canMove || ! canRemove,
|
|
40
|
+
isLocked: ! canEdit || ! canMove || ! canRemove,
|
|
38
41
|
};
|
|
39
42
|
},
|
|
40
43
|
[ clientId ]
|
|
@@ -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,12 @@ const BlockMobileToolbar = ( {
|
|
|
73
75
|
/>
|
|
74
76
|
) }
|
|
75
77
|
|
|
76
|
-
<
|
|
78
|
+
<BlockDraggable
|
|
79
|
+
clientId={ clientId }
|
|
80
|
+
draggingClientId={ draggingClientId }
|
|
81
|
+
>
|
|
82
|
+
{ () => <View style={ styles.spacer } /> }
|
|
83
|
+
</BlockDraggable>
|
|
77
84
|
|
|
78
85
|
<BlockSettingsButton.Slot>
|
|
79
86
|
{ /* Render only one settings icon even if we have more than one fill - need for hooks with controls. */ }
|
|
@@ -8,7 +8,7 @@ import { castArray, first, last } from 'lodash';
|
|
|
8
8
|
* WordPress dependencies
|
|
9
9
|
*/
|
|
10
10
|
import { getBlockType } from '@wordpress/blocks';
|
|
11
|
-
import { Button } from '@wordpress/components';
|
|
11
|
+
import { Button, VisuallyHidden } from '@wordpress/components';
|
|
12
12
|
import { useInstanceId } from '@wordpress/compose';
|
|
13
13
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
14
14
|
import { forwardRef } from '@wordpress/element';
|
|
@@ -139,12 +139,10 @@ const BlockMoverButton = forwardRef(
|
|
|
139
139
|
aria-describedby={ descriptionId }
|
|
140
140
|
{ ...props }
|
|
141
141
|
onClick={ isDisabled ? null : onClick }
|
|
142
|
-
|
|
142
|
+
disabled={ isDisabled }
|
|
143
|
+
__experimentalIsFocusable
|
|
143
144
|
/>
|
|
144
|
-
<
|
|
145
|
-
id={ descriptionId }
|
|
146
|
-
className="block-editor-block-mover-button__description"
|
|
147
|
-
>
|
|
145
|
+
<VisuallyHidden id={ descriptionId }>
|
|
148
146
|
{ getBlockMoverDescription(
|
|
149
147
|
blocksCount,
|
|
150
148
|
blockType && blockType.title,
|
|
@@ -154,7 +152,7 @@ const BlockMoverButton = forwardRef(
|
|
|
154
152
|
direction === 'up' ? -1 : 1,
|
|
155
153
|
orientation
|
|
156
154
|
) }
|
|
157
|
-
</
|
|
155
|
+
</VisuallyHidden>
|
|
158
156
|
</>
|
|
159
157
|
);
|
|
160
158
|
}
|