@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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/block-editor",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "9.1.0",
|
|
4
4
|
"description": "Generic block editor.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -33,32 +33,32 @@
|
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@babel/runtime": "^7.16.0",
|
|
35
35
|
"@react-spring/web": "^9.2.4",
|
|
36
|
-
"@wordpress/a11y": "^3.
|
|
37
|
-
"@wordpress/api-fetch": "^6.
|
|
38
|
-
"@wordpress/blob": "^3.
|
|
39
|
-
"@wordpress/blocks": "^11.
|
|
40
|
-
"@wordpress/components": "^19.
|
|
41
|
-
"@wordpress/compose": "^5.
|
|
42
|
-
"@wordpress/data": "^6.
|
|
43
|
-
"@wordpress/date": "^4.
|
|
44
|
-
"@wordpress/deprecated": "^3.
|
|
45
|
-
"@wordpress/dom": "^3.
|
|
46
|
-
"@wordpress/element": "^4.
|
|
47
|
-
"@wordpress/hooks": "^3.
|
|
48
|
-
"@wordpress/html-entities": "^3.
|
|
49
|
-
"@wordpress/i18n": "^4.
|
|
50
|
-
"@wordpress/icons": "^
|
|
51
|
-
"@wordpress/is-shallow-equal": "^4.
|
|
52
|
-
"@wordpress/keyboard-shortcuts": "^3.
|
|
53
|
-
"@wordpress/keycodes": "^3.
|
|
54
|
-
"@wordpress/notices": "^3.
|
|
55
|
-
"@wordpress/rich-text": "^5.
|
|
56
|
-
"@wordpress/shortcode": "^3.
|
|
57
|
-
"@wordpress/style-engine": "^0.
|
|
58
|
-
"@wordpress/token-list": "^2.
|
|
59
|
-
"@wordpress/url": "^3.
|
|
60
|
-
"@wordpress/warning": "^2.
|
|
61
|
-
"@wordpress/wordcount": "^3.
|
|
36
|
+
"@wordpress/a11y": "^3.9.0",
|
|
37
|
+
"@wordpress/api-fetch": "^6.6.0",
|
|
38
|
+
"@wordpress/blob": "^3.9.0",
|
|
39
|
+
"@wordpress/blocks": "^11.8.0",
|
|
40
|
+
"@wordpress/components": "^19.11.0",
|
|
41
|
+
"@wordpress/compose": "^5.7.0",
|
|
42
|
+
"@wordpress/data": "^6.9.0",
|
|
43
|
+
"@wordpress/date": "^4.9.0",
|
|
44
|
+
"@wordpress/deprecated": "^3.9.0",
|
|
45
|
+
"@wordpress/dom": "^3.9.0",
|
|
46
|
+
"@wordpress/element": "^4.7.0",
|
|
47
|
+
"@wordpress/hooks": "^3.9.0",
|
|
48
|
+
"@wordpress/html-entities": "^3.9.0",
|
|
49
|
+
"@wordpress/i18n": "^4.9.0",
|
|
50
|
+
"@wordpress/icons": "^9.0.0",
|
|
51
|
+
"@wordpress/is-shallow-equal": "^4.9.0",
|
|
52
|
+
"@wordpress/keyboard-shortcuts": "^3.7.0",
|
|
53
|
+
"@wordpress/keycodes": "^3.9.0",
|
|
54
|
+
"@wordpress/notices": "^3.9.0",
|
|
55
|
+
"@wordpress/rich-text": "^5.7.0",
|
|
56
|
+
"@wordpress/shortcode": "^3.9.0",
|
|
57
|
+
"@wordpress/style-engine": "^0.8.0",
|
|
58
|
+
"@wordpress/token-list": "^2.9.0",
|
|
59
|
+
"@wordpress/url": "^3.10.0",
|
|
60
|
+
"@wordpress/warning": "^2.9.0",
|
|
61
|
+
"@wordpress/wordcount": "^3.9.0",
|
|
62
62
|
"classnames": "^2.3.1",
|
|
63
63
|
"colord": "^2.7.0",
|
|
64
64
|
"diff": "^4.0.2",
|
|
@@ -77,5 +77,5 @@
|
|
|
77
77
|
"publishConfig": {
|
|
78
78
|
"access": "public"
|
|
79
79
|
},
|
|
80
|
-
"gitHead": "
|
|
80
|
+
"gitHead": "198fa129cf1af8dc615918987ea6795cd40ab7df"
|
|
81
81
|
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { __, _x } from '@wordpress/i18n';
|
|
5
|
+
import {
|
|
6
|
+
alignNone,
|
|
7
|
+
positionCenter,
|
|
8
|
+
positionLeft,
|
|
9
|
+
positionRight,
|
|
10
|
+
stretchFullWidth,
|
|
11
|
+
stretchWide,
|
|
12
|
+
} from '@wordpress/icons';
|
|
13
|
+
|
|
14
|
+
export const BLOCK_ALIGNMENTS_CONTROLS = {
|
|
15
|
+
none: {
|
|
16
|
+
icon: alignNone,
|
|
17
|
+
title: _x( 'None', 'Alignment option' ),
|
|
18
|
+
},
|
|
19
|
+
left: {
|
|
20
|
+
icon: positionLeft,
|
|
21
|
+
title: __( 'Align left' ),
|
|
22
|
+
},
|
|
23
|
+
center: {
|
|
24
|
+
icon: positionCenter,
|
|
25
|
+
title: __( 'Align center' ),
|
|
26
|
+
},
|
|
27
|
+
right: {
|
|
28
|
+
icon: positionRight,
|
|
29
|
+
title: __( 'Align right' ),
|
|
30
|
+
},
|
|
31
|
+
wide: {
|
|
32
|
+
icon: stretchWide,
|
|
33
|
+
title: __( 'Wide width' ),
|
|
34
|
+
},
|
|
35
|
+
full: {
|
|
36
|
+
icon: stretchFullWidth,
|
|
37
|
+
title: __( 'Full width' ),
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export const DEFAULT_CONTROL = 'none';
|
|
42
|
+
|
|
43
|
+
export const POPOVER_PROPS = {
|
|
44
|
+
isAlternate: true,
|
|
45
|
+
};
|
|
@@ -6,60 +6,23 @@ import classNames from 'classnames';
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
|
-
import { __
|
|
9
|
+
import { __ } from '@wordpress/i18n';
|
|
10
10
|
import {
|
|
11
11
|
ToolbarDropdownMenu,
|
|
12
12
|
ToolbarGroup,
|
|
13
13
|
MenuGroup,
|
|
14
14
|
MenuItem,
|
|
15
15
|
} from '@wordpress/components';
|
|
16
|
-
import {
|
|
17
|
-
alignNone,
|
|
18
|
-
positionCenter,
|
|
19
|
-
positionLeft,
|
|
20
|
-
positionRight,
|
|
21
|
-
stretchFullWidth,
|
|
22
|
-
stretchWide,
|
|
23
|
-
} from '@wordpress/icons';
|
|
24
|
-
import { Platform } from '@wordpress/element';
|
|
25
16
|
|
|
26
17
|
/**
|
|
27
18
|
* Internal dependencies
|
|
28
19
|
*/
|
|
29
20
|
import useAvailableAlignments from './use-available-alignments';
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
},
|
|
36
|
-
left: {
|
|
37
|
-
icon: positionLeft,
|
|
38
|
-
title: __( 'Align left' ),
|
|
39
|
-
},
|
|
40
|
-
center: {
|
|
41
|
-
icon: positionCenter,
|
|
42
|
-
title: __( 'Align center' ),
|
|
43
|
-
},
|
|
44
|
-
right: {
|
|
45
|
-
icon: positionRight,
|
|
46
|
-
title: __( 'Align right' ),
|
|
47
|
-
},
|
|
48
|
-
wide: {
|
|
49
|
-
icon: stretchWide,
|
|
50
|
-
title: __( 'Wide width' ),
|
|
51
|
-
},
|
|
52
|
-
full: {
|
|
53
|
-
icon: stretchFullWidth,
|
|
54
|
-
title: __( 'Full width' ),
|
|
55
|
-
},
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
const DEFAULT_CONTROL = 'none';
|
|
59
|
-
|
|
60
|
-
const POPOVER_PROPS = {
|
|
61
|
-
isAlternate: true,
|
|
62
|
-
};
|
|
21
|
+
import {
|
|
22
|
+
BLOCK_ALIGNMENTS_CONTROLS,
|
|
23
|
+
DEFAULT_CONTROL,
|
|
24
|
+
POPOVER_PROPS,
|
|
25
|
+
} from './constants';
|
|
63
26
|
|
|
64
27
|
function BlockAlignmentUI( {
|
|
65
28
|
value,
|
|
@@ -92,72 +55,69 @@ function BlockAlignmentUI( {
|
|
|
92
55
|
label: __( 'Align' ),
|
|
93
56
|
toggleProps: { describedBy: __( 'Change alignment' ) },
|
|
94
57
|
};
|
|
95
|
-
const extraProps =
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
);
|
|
159
|
-
},
|
|
160
|
-
};
|
|
58
|
+
const extraProps = isToolbar
|
|
59
|
+
? {
|
|
60
|
+
isCollapsed,
|
|
61
|
+
controls: enabledControls.map( ( { name: controlName } ) => {
|
|
62
|
+
return {
|
|
63
|
+
...BLOCK_ALIGNMENTS_CONTROLS[ controlName ],
|
|
64
|
+
isActive:
|
|
65
|
+
value === controlName ||
|
|
66
|
+
( ! value && controlName === 'none' ),
|
|
67
|
+
role: isCollapsed ? 'menuitemradio' : undefined,
|
|
68
|
+
onClick: () => onChangeAlignment( controlName ),
|
|
69
|
+
};
|
|
70
|
+
} ),
|
|
71
|
+
}
|
|
72
|
+
: {
|
|
73
|
+
children: ( { onClose } ) => {
|
|
74
|
+
return (
|
|
75
|
+
<>
|
|
76
|
+
<MenuGroup className="block-editor-block-alignment-control__menu-group">
|
|
77
|
+
{ enabledControls.map(
|
|
78
|
+
( { name: controlName, info } ) => {
|
|
79
|
+
const {
|
|
80
|
+
icon,
|
|
81
|
+
title,
|
|
82
|
+
} = BLOCK_ALIGNMENTS_CONTROLS[
|
|
83
|
+
controlName
|
|
84
|
+
];
|
|
85
|
+
// If no value is provided, mark as selected the `none` option.
|
|
86
|
+
const isSelected =
|
|
87
|
+
controlName === value ||
|
|
88
|
+
( ! value &&
|
|
89
|
+
controlName === 'none' );
|
|
90
|
+
return (
|
|
91
|
+
<MenuItem
|
|
92
|
+
key={ controlName }
|
|
93
|
+
icon={ icon }
|
|
94
|
+
iconPosition="left"
|
|
95
|
+
className={ classNames(
|
|
96
|
+
'components-dropdown-menu__menu-item',
|
|
97
|
+
{
|
|
98
|
+
'is-active': isSelected,
|
|
99
|
+
}
|
|
100
|
+
) }
|
|
101
|
+
isSelected={ isSelected }
|
|
102
|
+
onClick={ () => {
|
|
103
|
+
onChangeAlignment(
|
|
104
|
+
controlName
|
|
105
|
+
);
|
|
106
|
+
onClose();
|
|
107
|
+
} }
|
|
108
|
+
role="menuitemradio"
|
|
109
|
+
info={ info }
|
|
110
|
+
>
|
|
111
|
+
{ title }
|
|
112
|
+
</MenuItem>
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
) }
|
|
116
|
+
</MenuGroup>
|
|
117
|
+
</>
|
|
118
|
+
);
|
|
119
|
+
},
|
|
120
|
+
};
|
|
161
121
|
|
|
162
122
|
return <UIComponent { ...commonProps } { ...extraProps } />;
|
|
163
123
|
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
5
|
+
import {
|
|
6
|
+
ToolbarDropdownMenu,
|
|
7
|
+
ToolbarGroup,
|
|
8
|
+
BottomSheetSelectControl,
|
|
9
|
+
} from '@wordpress/components';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Internal dependencies
|
|
13
|
+
*/
|
|
14
|
+
import useAvailableAlignments from './use-available-alignments';
|
|
15
|
+
import {
|
|
16
|
+
BLOCK_ALIGNMENTS_CONTROLS,
|
|
17
|
+
DEFAULT_CONTROL,
|
|
18
|
+
POPOVER_PROPS,
|
|
19
|
+
} from './constants';
|
|
20
|
+
|
|
21
|
+
function BlockAlignmentUI( {
|
|
22
|
+
value,
|
|
23
|
+
onChange,
|
|
24
|
+
controls,
|
|
25
|
+
isToolbar,
|
|
26
|
+
isCollapsed = true,
|
|
27
|
+
isBottomSheetControl = false,
|
|
28
|
+
} ) {
|
|
29
|
+
const enabledControls = useAvailableAlignments( controls );
|
|
30
|
+
const hasEnabledControls = !! enabledControls.length;
|
|
31
|
+
|
|
32
|
+
if ( ! hasEnabledControls ) {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function onChangeAlignment( align ) {
|
|
37
|
+
onChange( [ value, 'none' ].includes( align ) ? undefined : align );
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const activeAlignmentControl = BLOCK_ALIGNMENTS_CONTROLS[ value ];
|
|
41
|
+
const defaultAlignmentControl =
|
|
42
|
+
BLOCK_ALIGNMENTS_CONTROLS[ DEFAULT_CONTROL ];
|
|
43
|
+
|
|
44
|
+
const toolbarUIComponent = isToolbar ? ToolbarGroup : ToolbarDropdownMenu;
|
|
45
|
+
const UIComponent = isBottomSheetControl
|
|
46
|
+
? BottomSheetSelectControl
|
|
47
|
+
: toolbarUIComponent;
|
|
48
|
+
|
|
49
|
+
const commonProps = {
|
|
50
|
+
label: __( 'Align' ),
|
|
51
|
+
};
|
|
52
|
+
const extraProps = isBottomSheetControl
|
|
53
|
+
? {
|
|
54
|
+
options: enabledControls.map( ( { name: controlName } ) => {
|
|
55
|
+
const control = BLOCK_ALIGNMENTS_CONTROLS[ controlName ];
|
|
56
|
+
return {
|
|
57
|
+
value: controlName,
|
|
58
|
+
label: control.title,
|
|
59
|
+
icon: control.icon,
|
|
60
|
+
};
|
|
61
|
+
} ),
|
|
62
|
+
value: activeAlignmentControl ? value : 'none',
|
|
63
|
+
onChange: ( align ) => onChangeAlignment( align ),
|
|
64
|
+
}
|
|
65
|
+
: {
|
|
66
|
+
icon: activeAlignmentControl
|
|
67
|
+
? activeAlignmentControl.icon
|
|
68
|
+
: defaultAlignmentControl.icon,
|
|
69
|
+
isCollapsed: isToolbar ? isCollapsed : undefined,
|
|
70
|
+
controls: enabledControls.map( ( { name: controlName } ) => {
|
|
71
|
+
return {
|
|
72
|
+
...BLOCK_ALIGNMENTS_CONTROLS[ controlName ],
|
|
73
|
+
isActive:
|
|
74
|
+
value === controlName ||
|
|
75
|
+
( ! value && controlName === 'none' ),
|
|
76
|
+
onClick: () => onChangeAlignment( controlName ),
|
|
77
|
+
};
|
|
78
|
+
} ),
|
|
79
|
+
popoverProps: POPOVER_PROPS,
|
|
80
|
+
toggleProps: { describedBy: __( 'Change alignment' ) },
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
return <UIComponent { ...commonProps } { ...extraProps } />;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export default BlockAlignmentUI;
|
|
@@ -22,15 +22,11 @@ function BlockAlignmentMatrixControl( props ) {
|
|
|
22
22
|
} = props;
|
|
23
23
|
|
|
24
24
|
const icon = <AlignmentMatrixControl.Icon value={ value } />;
|
|
25
|
-
const className = 'block-editor-block-alignment-matrix-control';
|
|
26
|
-
const popoverClassName = `${ className }__popover`;
|
|
27
|
-
const isAlternate = true;
|
|
28
25
|
|
|
29
26
|
return (
|
|
30
27
|
<Dropdown
|
|
31
28
|
position="bottom right"
|
|
32
|
-
|
|
33
|
-
popoverProps={ { className: popoverClassName, isAlternate } }
|
|
29
|
+
popoverProps={ { isAlternate: true } }
|
|
34
30
|
renderToggle={ ( { onToggle, isOpen } ) => {
|
|
35
31
|
const openOnArrowDown = ( event ) => {
|
|
36
32
|
if ( ! isOpen && event.keyCode === DOWN ) {
|
|
@@ -2,97 +2,27 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { useSelect } from '@wordpress/data';
|
|
5
|
-
import { useState, useEffect } from '@wordpress/element';
|
|
6
5
|
|
|
7
6
|
/**
|
|
8
7
|
* Internal dependencies
|
|
9
8
|
*/
|
|
10
9
|
import { store as blockEditorStore } from '../../store';
|
|
11
10
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
*/
|
|
15
|
-
import classnames from 'classnames';
|
|
16
|
-
|
|
17
|
-
export default function BlockContentOverlay( {
|
|
18
|
-
clientId,
|
|
19
|
-
tagName: TagName = 'div',
|
|
20
|
-
wrapperProps,
|
|
21
|
-
className,
|
|
22
|
-
} ) {
|
|
23
|
-
const baseClassName = 'block-editor-block-content-overlay';
|
|
24
|
-
const [ isOverlayActive, setIsOverlayActive ] = useState( true );
|
|
25
|
-
const [ isHovered, setIsHovered ] = useState( false );
|
|
26
|
-
|
|
27
|
-
const {
|
|
28
|
-
isParentSelected,
|
|
29
|
-
hasChildSelected,
|
|
30
|
-
isDraggingBlocks,
|
|
31
|
-
isParentHighlighted,
|
|
32
|
-
} = useSelect(
|
|
11
|
+
export default function useBlockOverlayActive( clientId ) {
|
|
12
|
+
return useSelect(
|
|
33
13
|
( select ) => {
|
|
34
14
|
const {
|
|
35
15
|
isBlockSelected,
|
|
36
16
|
hasSelectedInnerBlock,
|
|
37
|
-
|
|
38
|
-
isBlockHighlighted,
|
|
17
|
+
canEditBlock,
|
|
39
18
|
} = select( blockEditorStore );
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
! canEditBlock( clientId ) ||
|
|
22
|
+
( ! isBlockSelected( clientId ) &&
|
|
23
|
+
! hasSelectedInnerBlock( clientId, true ) )
|
|
24
|
+
);
|
|
46
25
|
},
|
|
47
26
|
[ clientId ]
|
|
48
27
|
);
|
|
49
|
-
|
|
50
|
-
const classes = classnames(
|
|
51
|
-
baseClassName,
|
|
52
|
-
wrapperProps?.className,
|
|
53
|
-
className,
|
|
54
|
-
{
|
|
55
|
-
'overlay-active': isOverlayActive,
|
|
56
|
-
'parent-highlighted': isParentHighlighted,
|
|
57
|
-
'is-dragging-blocks': isDraggingBlocks,
|
|
58
|
-
}
|
|
59
|
-
);
|
|
60
|
-
|
|
61
|
-
useEffect( () => {
|
|
62
|
-
// Reenable when blocks are not in use.
|
|
63
|
-
if ( ! isParentSelected && ! hasChildSelected && ! isOverlayActive ) {
|
|
64
|
-
setIsOverlayActive( true );
|
|
65
|
-
}
|
|
66
|
-
// Disable if parent selected by another means (such as list view).
|
|
67
|
-
// We check hover to ensure the overlay click interaction is not taking place.
|
|
68
|
-
// Trying to click the overlay will select the parent block via its 'focusin'
|
|
69
|
-
// listener on the wrapper, so if the block is selected while hovered we will
|
|
70
|
-
// let the mouseup disable the overlay instead.
|
|
71
|
-
if ( isParentSelected && ! isHovered && isOverlayActive ) {
|
|
72
|
-
setIsOverlayActive( false );
|
|
73
|
-
}
|
|
74
|
-
// Ensure overlay is disabled if a child block is selected.
|
|
75
|
-
if ( hasChildSelected && isOverlayActive ) {
|
|
76
|
-
setIsOverlayActive( false );
|
|
77
|
-
}
|
|
78
|
-
}, [ isParentSelected, hasChildSelected, isOverlayActive, isHovered ] );
|
|
79
|
-
|
|
80
|
-
// Disabled because the overlay div doesn't actually have a role or functionality
|
|
81
|
-
// as far as the a11y is concerned. We're just catching the first click so that
|
|
82
|
-
// the block can be selected without interacting with its contents.
|
|
83
|
-
/* eslint-disable jsx-a11y/no-static-element-interactions */
|
|
84
|
-
return (
|
|
85
|
-
<TagName
|
|
86
|
-
{ ...wrapperProps }
|
|
87
|
-
className={ classes }
|
|
88
|
-
onMouseEnter={ () => setIsHovered( true ) }
|
|
89
|
-
onMouseLeave={ () => setIsHovered( false ) }
|
|
90
|
-
onMouseUp={
|
|
91
|
-
isOverlayActive ? () => setIsOverlayActive( false ) : undefined
|
|
92
|
-
}
|
|
93
|
-
>
|
|
94
|
-
{ wrapperProps?.children }
|
|
95
|
-
</TagName>
|
|
96
|
-
);
|
|
97
28
|
}
|
|
98
|
-
/* eslint-enable jsx-a11y/no-static-element-interactions */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
.block-editor-block-content-overlay {
|
|
2
|
-
|
|
2
|
+
&::before {
|
|
3
3
|
content: "";
|
|
4
4
|
position: absolute;
|
|
5
5
|
top: 0;
|
|
@@ -12,17 +12,8 @@
|
|
|
12
12
|
z-index: z-index(".block-editor-block-content-overlay__overlay");
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
&:hover:not(.is-dragging-blocks)
|
|
16
|
-
&.parent-highlighted.overlay-active::before {
|
|
15
|
+
&:hover:not(.is-dragging-blocks)::before {
|
|
17
16
|
background: rgba(var(--wp-admin-theme-color--rgb), 0.1);
|
|
18
17
|
box-shadow: 0 0 0 $border-width var(--wp-admin-theme-color) inset;
|
|
19
18
|
}
|
|
20
|
-
|
|
21
|
-
&.overlay-active:not(.is-dragging-blocks) * {
|
|
22
|
-
pointer-events: none;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
&.is-dragging-blocks {
|
|
26
|
-
box-shadow: 0 0 0 $border-width var(--wp-admin-theme-color);
|
|
27
|
-
}
|
|
28
19
|
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { View } from 'react-native';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* WordPress dependencies
|
|
8
|
+
*/
|
|
9
|
+
import { dragHandle } from '@wordpress/icons';
|
|
10
|
+
import { usePreferredColorSchemeStyle } from '@wordpress/compose';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Internal dependencies
|
|
14
|
+
*/
|
|
15
|
+
import BlockIcon from '../block-icon';
|
|
16
|
+
import styles from './style.scss';
|
|
17
|
+
|
|
18
|
+
const shadowStyle = {
|
|
19
|
+
shadowColor: '#000',
|
|
20
|
+
shadowOffset: {
|
|
21
|
+
width: 0,
|
|
22
|
+
height: 2,
|
|
23
|
+
},
|
|
24
|
+
shadowOpacity: 0.25,
|
|
25
|
+
shadowRadius: 3.84,
|
|
26
|
+
|
|
27
|
+
elevation: 5,
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Block draggable chip component
|
|
32
|
+
*
|
|
33
|
+
* @param {Object} props Component props.
|
|
34
|
+
* @param {Object} [props.icon] Block icon.
|
|
35
|
+
* @return {JSX.Element} Chip component.
|
|
36
|
+
*/
|
|
37
|
+
export default function BlockDraggableChip( { icon } ) {
|
|
38
|
+
const containerStyle = usePreferredColorSchemeStyle(
|
|
39
|
+
styles[ 'draggable-chip__container' ],
|
|
40
|
+
styles[ 'draggable-chip__container--dark' ]
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<View style={ [ containerStyle, shadowStyle ] }>
|
|
45
|
+
<BlockIcon icon={ dragHandle } />
|
|
46
|
+
{ icon && <BlockIcon icon={ icon } /> }
|
|
47
|
+
</View>
|
|
48
|
+
);
|
|
49
|
+
}
|