@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
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/hooks/border-style.js"],"names":["BorderStyleControl","cleanEmptyObject","removeBorderAttribute","BorderStyleEdit","props","attributes","style","setAttributes","onChange","newBorderStyle","newStyleAttributes","border","hasBorderStyleValue","resetBorderStyle"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,kBAAP,MAA+B,oCAA/B;AACA,SAASC,gBAAT,QAAiC,SAAjC;AACA,SAASC,qBAAT,QAAsC,UAAtC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,eAAe,GAAKC,KAAF,IAAa;AAAA;;AAC3C,QAAM;AACLC,IAAAA,UAAU,EAAE;AAAEC,MAAAA;AAAF,KADP;AAELC,IAAAA;AAFK,MAGFH,KAHJ;;AAKA,QAAMI,QAAQ,GAAKC,cAAF,IAAsB;AACtC,UAAMC,kBAAkB,GAAG,EAC1B,GAAGJ,KADuB;AAE1BK,MAAAA,MAAM,EAAE,EACP,IAAGL,KAAH,aAAGA,KAAH,uBAAGA,KAAK,CAAEK,MAAV,CADO;AAEPL,QAAAA,KAAK,EAAEG;AAFA;AAFkB,KAA3B;AAQAF,IAAAA,aAAa,CAAE;AAAED,MAAAA,KAAK,EAAEL,gBAAgB,CAAES,kBAAF;AAAzB,KAAF,CAAb;AACA,GAVD;;AAYA,SACC,cAAC,kBAAD;AACC,IAAA,KAAK,EAAGJ,KAAH,aAAGA,KAAH,wCAAGA,KAAK,CAAEK,MAAV,kDAAG,cAAeL,KADxB;AAEC,IAAA,QAAQ,EAAGE;AAFZ,IADD;AAMA,CAxBM;AA0BP;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASI,mBAAT,CAA8BR,KAA9B,EAAsC;AAAA;;AAC5C,SAAO,CAAC,2BAAEA,KAAK,CAACC,UAAN,CAAiBC,KAAnB,4EAAE,sBAAwBK,MAA1B,mDAAE,uBAAgCL,KAAlC,CAAR;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASO,gBAAT,OAAgE;AAAA,MAArC;AAAER,IAAAA,UAAU,GAAG,EAAf;AAAmBE,IAAAA;AAAnB,GAAqC;AACtE,QAAM;AAAED,IAAAA;AAAF,MAAYD,UAAlB;AACAE,EAAAA,aAAa,CAAE;AAAED,IAAAA,KAAK,EAAEJ,qBAAqB,CAAEI,KAAF,EAAS,OAAT;AAA9B,GAAF,CAAb;AACA","sourcesContent":["/**\n * Internal dependencies\n */\nimport BorderStyleControl from '../components/border-style-control';\nimport { cleanEmptyObject } from './utils';\nimport { removeBorderAttribute } from './border';\n\n/**\n * Inspector control for configuring border style property.\n *\n * @param {Object} props Block properties.\n *\n * @return {WPElement} Border style edit element.\n */\nexport const BorderStyleEdit = ( props ) => {\n\tconst {\n\t\tattributes: { style },\n\t\tsetAttributes,\n\t} = props;\n\n\tconst onChange = ( newBorderStyle ) => {\n\t\tconst newStyleAttributes = {\n\t\t\t...style,\n\t\t\tborder: {\n\t\t\t\t...style?.border,\n\t\t\t\tstyle: newBorderStyle,\n\t\t\t},\n\t\t};\n\n\t\tsetAttributes( { style: cleanEmptyObject( newStyleAttributes ) } );\n\t};\n\n\treturn (\n\t\t<BorderStyleControl\n\t\t\tvalue={ style?.border?.style }\n\t\t\tonChange={ onChange }\n\t\t/>\n\t);\n};\n\n/**\n * Checks if there is a current value in the border style block support\n * attributes.\n *\n * @param {Object} props Block props.\n * @return {boolean} Whether or not the block has a border style value set.\n */\nexport function hasBorderStyleValue( props ) {\n\treturn !! props.attributes.style?.border?.style;\n}\n\n/**\n * Resets the border style block support attribute. This can be used when\n * disabling the border style support control for a block via a progressive\n * discovery panel.\n *\n * @param {Object} props Block props.\n * @param {Object} props.attributes Block's attributes.\n * @param {Object} props.setAttributes Function to set block's attributes.\n */\nexport function resetBorderStyle( { attributes = {}, setAttributes } ) {\n\tconst { style } = attributes;\n\tsetAttributes( { style: removeBorderAttribute( style, 'style' ) } );\n}\n"]}
|
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
import { createElement } from "@wordpress/element";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* WordPress dependencies
|
|
5
|
-
*/
|
|
6
|
-
import { __experimentalUnitControl as UnitControl, __experimentalUseCustomUnits as useCustomUnits } from '@wordpress/components';
|
|
7
|
-
import { useState } from '@wordpress/element';
|
|
8
|
-
import { __ } from '@wordpress/i18n';
|
|
9
|
-
/**
|
|
10
|
-
* Internal dependencies
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
import { cleanEmptyObject } from './utils';
|
|
14
|
-
import { removeBorderAttribute } from './border';
|
|
15
|
-
import useSetting from '../components/use-setting';
|
|
16
|
-
const MIN_BORDER_WIDTH = 0;
|
|
17
|
-
/**
|
|
18
|
-
* Inspector control for configuring border width property.
|
|
19
|
-
*
|
|
20
|
-
* @param {Object} props Block properties.
|
|
21
|
-
*
|
|
22
|
-
* @return {WPElement} Border width edit element.
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
export const BorderWidthEdit = props => {
|
|
26
|
-
const {
|
|
27
|
-
attributes: {
|
|
28
|
-
borderColor,
|
|
29
|
-
style
|
|
30
|
-
},
|
|
31
|
-
setAttributes
|
|
32
|
-
} = props;
|
|
33
|
-
const {
|
|
34
|
-
width,
|
|
35
|
-
color: customBorderColor,
|
|
36
|
-
style: borderStyle
|
|
37
|
-
} = (style === null || style === void 0 ? void 0 : style.border) || {}; // Used to temporarily track previous border color & style selections to be
|
|
38
|
-
// able to restore them when border width changes from zero value.
|
|
39
|
-
|
|
40
|
-
const [styleSelection, setStyleSelection] = useState();
|
|
41
|
-
const [colorSelection, setColorSelection] = useState();
|
|
42
|
-
const [customColorSelection, setCustomColorSelection] = useState();
|
|
43
|
-
|
|
44
|
-
const onChange = newWidth => {
|
|
45
|
-
let newStyle = { ...style,
|
|
46
|
-
border: { ...(style === null || style === void 0 ? void 0 : style.border),
|
|
47
|
-
width: newWidth
|
|
48
|
-
}
|
|
49
|
-
}; // Used to clear named border color attribute.
|
|
50
|
-
|
|
51
|
-
let borderPaletteColor = borderColor;
|
|
52
|
-
const hasZeroWidth = parseFloat(newWidth) === 0;
|
|
53
|
-
const hadPreviousZeroWidth = parseFloat(width) === 0; // Setting the border width explicitly to zero will also set the
|
|
54
|
-
// border style to `none` and clear border color attributes.
|
|
55
|
-
|
|
56
|
-
if (hasZeroWidth && !hadPreviousZeroWidth) {
|
|
57
|
-
// Before clearing color and style selections, keep track of
|
|
58
|
-
// the current selections so they can be restored when the width
|
|
59
|
-
// changes to a non-zero value.
|
|
60
|
-
setColorSelection(borderColor);
|
|
61
|
-
setCustomColorSelection(customBorderColor);
|
|
62
|
-
setStyleSelection(borderStyle); // Clear style and color attributes.
|
|
63
|
-
|
|
64
|
-
borderPaletteColor = undefined;
|
|
65
|
-
newStyle.border.color = undefined;
|
|
66
|
-
newStyle.border.style = 'none';
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
if (!hasZeroWidth && hadPreviousZeroWidth) {
|
|
70
|
-
// Restore previous border style selection if width is now not zero and
|
|
71
|
-
// border style was 'none'. This is to support changes to the UI which
|
|
72
|
-
// change the border style UI to a segmented control without a "none"
|
|
73
|
-
// option.
|
|
74
|
-
if (borderStyle === 'none') {
|
|
75
|
-
newStyle.border.style = styleSelection;
|
|
76
|
-
} // Restore previous border color selection if width is no longer zero
|
|
77
|
-
// and current border color is undefined.
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
if (borderColor === undefined) {
|
|
81
|
-
borderPaletteColor = colorSelection;
|
|
82
|
-
newStyle.border.color = customColorSelection;
|
|
83
|
-
}
|
|
84
|
-
} // If width was reset, clean out undefined styles.
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
if (newWidth === undefined || newWidth === '') {
|
|
88
|
-
newStyle = cleanEmptyObject(newStyle);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
setAttributes({
|
|
92
|
-
borderColor: borderPaletteColor,
|
|
93
|
-
style: newStyle
|
|
94
|
-
});
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
const units = useCustomUnits({
|
|
98
|
-
availableUnits: useSetting('spacing.units') || ['px', 'em', 'rem']
|
|
99
|
-
});
|
|
100
|
-
return createElement(UnitControl, {
|
|
101
|
-
value: width,
|
|
102
|
-
label: __('Width'),
|
|
103
|
-
min: MIN_BORDER_WIDTH,
|
|
104
|
-
onChange: onChange,
|
|
105
|
-
units: units
|
|
106
|
-
});
|
|
107
|
-
};
|
|
108
|
-
/**
|
|
109
|
-
* Checks if there is a current value in the border width block support
|
|
110
|
-
* attributes.
|
|
111
|
-
*
|
|
112
|
-
* @param {Object} props Block props.
|
|
113
|
-
* @return {boolean} Whether or not the block has a border width value set.
|
|
114
|
-
*/
|
|
115
|
-
|
|
116
|
-
export function hasBorderWidthValue(props) {
|
|
117
|
-
var _props$attributes$sty, _props$attributes$sty2;
|
|
118
|
-
|
|
119
|
-
return !!((_props$attributes$sty = props.attributes.style) !== null && _props$attributes$sty !== void 0 && (_props$attributes$sty2 = _props$attributes$sty.border) !== null && _props$attributes$sty2 !== void 0 && _props$attributes$sty2.width);
|
|
120
|
-
}
|
|
121
|
-
/**
|
|
122
|
-
* Resets the border width block support attribute. This can be used when
|
|
123
|
-
* disabling the border width support control for a block via a progressive
|
|
124
|
-
* discovery panel.
|
|
125
|
-
*
|
|
126
|
-
* @param {Object} props Block props.
|
|
127
|
-
* @param {Object} props.attributes Block's attributes.
|
|
128
|
-
* @param {Object} props.setAttributes Function to set block's attributes.
|
|
129
|
-
*/
|
|
130
|
-
|
|
131
|
-
export function resetBorderWidth(_ref) {
|
|
132
|
-
let {
|
|
133
|
-
attributes = {},
|
|
134
|
-
setAttributes
|
|
135
|
-
} = _ref;
|
|
136
|
-
const {
|
|
137
|
-
style
|
|
138
|
-
} = attributes;
|
|
139
|
-
setAttributes({
|
|
140
|
-
style: removeBorderAttribute(style, 'width')
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
//# sourceMappingURL=border-width.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/hooks/border-width.js"],"names":["__experimentalUnitControl","UnitControl","__experimentalUseCustomUnits","useCustomUnits","useState","__","cleanEmptyObject","removeBorderAttribute","useSetting","MIN_BORDER_WIDTH","BorderWidthEdit","props","attributes","borderColor","style","setAttributes","width","color","customBorderColor","borderStyle","border","styleSelection","setStyleSelection","colorSelection","setColorSelection","customColorSelection","setCustomColorSelection","onChange","newWidth","newStyle","borderPaletteColor","hasZeroWidth","parseFloat","hadPreviousZeroWidth","undefined","units","availableUnits","hasBorderWidthValue","resetBorderWidth"],"mappings":"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","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalUseCustomUnits as useCustomUnits,\n} from '@wordpress/components';\nimport { useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { cleanEmptyObject } from './utils';\nimport { removeBorderAttribute } from './border';\nimport useSetting from '../components/use-setting';\n\nconst MIN_BORDER_WIDTH = 0;\n\n/**\n * Inspector control for configuring border width property.\n *\n * @param {Object} props Block properties.\n *\n * @return {WPElement} Border width edit element.\n */\nexport const BorderWidthEdit = ( props ) => {\n\tconst {\n\t\tattributes: { borderColor, style },\n\t\tsetAttributes,\n\t} = props;\n\n\tconst { width, color: customBorderColor, style: borderStyle } =\n\t\tstyle?.border || {};\n\n\t// Used to temporarily track previous border color & style selections to be\n\t// able to restore them when border width changes from zero value.\n\tconst [ styleSelection, setStyleSelection ] = useState();\n\tconst [ colorSelection, setColorSelection ] = useState();\n\tconst [ customColorSelection, setCustomColorSelection ] = useState();\n\n\tconst onChange = ( newWidth ) => {\n\t\tlet newStyle = {\n\t\t\t...style,\n\t\t\tborder: {\n\t\t\t\t...style?.border,\n\t\t\t\twidth: newWidth,\n\t\t\t},\n\t\t};\n\n\t\t// Used to clear named border color attribute.\n\t\tlet borderPaletteColor = borderColor;\n\n\t\tconst hasZeroWidth = parseFloat( newWidth ) === 0;\n\t\tconst hadPreviousZeroWidth = parseFloat( width ) === 0;\n\n\t\t// Setting the border width explicitly to zero will also set the\n\t\t// border style to `none` and clear border color attributes.\n\t\tif ( hasZeroWidth && ! hadPreviousZeroWidth ) {\n\t\t\t// Before clearing color and style selections, keep track of\n\t\t\t// the current selections so they can be restored when the width\n\t\t\t// changes to a non-zero value.\n\t\t\tsetColorSelection( borderColor );\n\t\t\tsetCustomColorSelection( customBorderColor );\n\t\t\tsetStyleSelection( borderStyle );\n\n\t\t\t// Clear style and color attributes.\n\t\t\tborderPaletteColor = undefined;\n\t\t\tnewStyle.border.color = undefined;\n\t\t\tnewStyle.border.style = 'none';\n\t\t}\n\n\t\tif ( ! hasZeroWidth && hadPreviousZeroWidth ) {\n\t\t\t// Restore previous border style selection if width is now not zero and\n\t\t\t// border style was 'none'. This is to support changes to the UI which\n\t\t\t// change the border style UI to a segmented control without a \"none\"\n\t\t\t// option.\n\t\t\tif ( borderStyle === 'none' ) {\n\t\t\t\tnewStyle.border.style = styleSelection;\n\t\t\t}\n\n\t\t\t// Restore previous border color selection if width is no longer zero\n\t\t\t// and current border color is undefined.\n\t\t\tif ( borderColor === undefined ) {\n\t\t\t\tborderPaletteColor = colorSelection;\n\t\t\t\tnewStyle.border.color = customColorSelection;\n\t\t\t}\n\t\t}\n\n\t\t// If width was reset, clean out undefined styles.\n\t\tif ( newWidth === undefined || newWidth === '' ) {\n\t\t\tnewStyle = cleanEmptyObject( newStyle );\n\t\t}\n\n\t\tsetAttributes( {\n\t\t\tborderColor: borderPaletteColor,\n\t\t\tstyle: newStyle,\n\t\t} );\n\t};\n\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: useSetting( 'spacing.units' ) || [ 'px', 'em', 'rem' ],\n\t} );\n\n\treturn (\n\t\t<UnitControl\n\t\t\tvalue={ width }\n\t\t\tlabel={ __( 'Width' ) }\n\t\t\tmin={ MIN_BORDER_WIDTH }\n\t\t\tonChange={ onChange }\n\t\t\tunits={ units }\n\t\t/>\n\t);\n};\n\n/**\n * Checks if there is a current value in the border width block support\n * attributes.\n *\n * @param {Object} props Block props.\n * @return {boolean} Whether or not the block has a border width value set.\n */\nexport function hasBorderWidthValue( props ) {\n\treturn !! props.attributes.style?.border?.width;\n}\n\n/**\n * Resets the border width block support attribute. This can be used when\n * disabling the border width support control for a block via a progressive\n * discovery panel.\n *\n * @param {Object} props Block props.\n * @param {Object} props.attributes Block's attributes.\n * @param {Object} props.setAttributes Function to set block's attributes.\n */\nexport function resetBorderWidth( { attributes = {}, setAttributes } ) {\n\tconst { style } = attributes;\n\tsetAttributes( { style: removeBorderAttribute( style, 'width' ) } );\n}\n"]}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { useViewportMatch } from '@wordpress/compose';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Internal dependencies
|
|
8
|
-
*/
|
|
9
|
-
import BlockMover from '../block-mover';
|
|
10
|
-
|
|
11
|
-
function BlockMobileToolbar( { clientId } ) {
|
|
12
|
-
const isMobile = useViewportMatch( 'small', '<' );
|
|
13
|
-
if ( ! isMobile ) {
|
|
14
|
-
return null;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
return (
|
|
18
|
-
<div className="block-editor-block-mobile-toolbar">
|
|
19
|
-
<BlockMover clientIds={ [ clientId ] } />
|
|
20
|
-
</div>
|
|
21
|
-
);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export default BlockMobileToolbar;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
.block-editor-block-mobile-toolbar {
|
|
2
|
-
display: flex;
|
|
3
|
-
flex-direction: row;
|
|
4
|
-
border-right: $border-width solid $gray-300;
|
|
5
|
-
|
|
6
|
-
.block-editor-block-mover-button {
|
|
7
|
-
width: $button-size;
|
|
8
|
-
height: $button-size;
|
|
9
|
-
border-radius: $radius-block-ui;
|
|
10
|
-
padding: 3px;
|
|
11
|
-
margin: 0;
|
|
12
|
-
justify-content: center;
|
|
13
|
-
align-items: center;
|
|
14
|
-
|
|
15
|
-
.dashicon {
|
|
16
|
-
margin: auto;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
// Movers
|
|
21
|
-
.block-editor-block-mover {
|
|
22
|
-
display: flex;
|
|
23
|
-
margin-right: auto;
|
|
24
|
-
|
|
25
|
-
.block-editor-block-mover-button {
|
|
26
|
-
float: left;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { Button } from '@wordpress/components';
|
|
5
|
-
import { __ } from '@wordpress/i18n';
|
|
6
|
-
import { lineDashed, lineDotted, lineSolid } from '@wordpress/icons';
|
|
7
|
-
|
|
8
|
-
const BORDER_STYLES = [
|
|
9
|
-
{ label: __( 'Solid' ), icon: lineSolid, value: 'solid' },
|
|
10
|
-
{ label: __( 'Dashed' ), icon: lineDashed, value: 'dashed' },
|
|
11
|
-
{ label: __( 'Dotted' ), icon: lineDotted, value: 'dotted' },
|
|
12
|
-
];
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Control to display border style options.
|
|
16
|
-
*
|
|
17
|
-
* @param {Object} props Component props.
|
|
18
|
-
* @param {Function} props.onChange Handler for changing border style selection.
|
|
19
|
-
* @param {string} props.value Currently selected border style value.
|
|
20
|
-
*
|
|
21
|
-
* @return {WPElement} Custom border style segmented control.
|
|
22
|
-
*/
|
|
23
|
-
export default function BorderStyleControl( { onChange, value } ) {
|
|
24
|
-
return (
|
|
25
|
-
<fieldset className="components-border-style-control">
|
|
26
|
-
<legend>{ __( 'Style' ) }</legend>
|
|
27
|
-
<div className="components-border-style-control__buttons">
|
|
28
|
-
{ BORDER_STYLES.map( ( borderStyle ) => (
|
|
29
|
-
<Button
|
|
30
|
-
key={ borderStyle.value }
|
|
31
|
-
icon={ borderStyle.icon }
|
|
32
|
-
isSmall
|
|
33
|
-
isPressed={ borderStyle.value === value }
|
|
34
|
-
onClick={ () =>
|
|
35
|
-
onChange(
|
|
36
|
-
borderStyle.value === value
|
|
37
|
-
? undefined
|
|
38
|
-
: borderStyle.value
|
|
39
|
-
)
|
|
40
|
-
}
|
|
41
|
-
aria-label={ borderStyle.label }
|
|
42
|
-
/>
|
|
43
|
-
) ) }
|
|
44
|
-
</div>
|
|
45
|
-
</fieldset>
|
|
46
|
-
);
|
|
47
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
.components-border-style-control {
|
|
2
|
-
legend {
|
|
3
|
-
line-height: 1.4;
|
|
4
|
-
margin-bottom: $grid-unit-10;
|
|
5
|
-
padding: 0;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
.components-border-style-control__buttons {
|
|
9
|
-
display: inline-flex;
|
|
10
|
-
|
|
11
|
-
.components-button.has-icon {
|
|
12
|
-
min-width: 30px;
|
|
13
|
-
height: 30px;
|
|
14
|
-
padding: 3px;
|
|
15
|
-
margin-right: $grid-unit-05;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import classnames from 'classnames';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* WordPress dependencies
|
|
8
|
-
*/
|
|
9
|
-
import {
|
|
10
|
-
Button,
|
|
11
|
-
ColorIndicator,
|
|
12
|
-
Dropdown,
|
|
13
|
-
FlexItem,
|
|
14
|
-
__experimentalHStack as HStack,
|
|
15
|
-
__experimentalToolsPanelItem as ToolsPanelItem,
|
|
16
|
-
} from '@wordpress/components';
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Internal dependencies
|
|
20
|
-
*/
|
|
21
|
-
import ColorGradientControl from './control';
|
|
22
|
-
import useMultipleOriginColorsAndGradients from './use-multiple-origin-colors-and-gradients';
|
|
23
|
-
|
|
24
|
-
export default function ToolsPanelColorDropdown( {
|
|
25
|
-
settings,
|
|
26
|
-
enableAlpha,
|
|
27
|
-
...otherProps
|
|
28
|
-
} ) {
|
|
29
|
-
const colorGradientSettings = useMultipleOriginColorsAndGradients();
|
|
30
|
-
const controlSettings = {
|
|
31
|
-
...colorGradientSettings,
|
|
32
|
-
clearable: false,
|
|
33
|
-
enableAlpha,
|
|
34
|
-
label: settings.label,
|
|
35
|
-
onColorChange: settings.onColorChange,
|
|
36
|
-
onGradientChange: settings.onGradientChange,
|
|
37
|
-
colorValue: settings.colorValue,
|
|
38
|
-
gradientValue: settings.gradientValue,
|
|
39
|
-
};
|
|
40
|
-
const selectedColor = settings.gradientValue ?? settings.colorValue;
|
|
41
|
-
|
|
42
|
-
return (
|
|
43
|
-
<ToolsPanelItem
|
|
44
|
-
hasValue={ settings.hasValue }
|
|
45
|
-
label={ settings.label }
|
|
46
|
-
onDeselect={ settings.onDeselect }
|
|
47
|
-
isShownByDefault={ settings.isShownByDefault }
|
|
48
|
-
resetAllFilter={ settings.resetAllFilter }
|
|
49
|
-
{ ...otherProps }
|
|
50
|
-
className="block-editor-tools-panel-color-gradient-settings__item"
|
|
51
|
-
>
|
|
52
|
-
<Dropdown
|
|
53
|
-
className="block-editor-tools-panel-color-dropdown"
|
|
54
|
-
contentClassName="block-editor-panel-color-gradient-settings__dropdown-content"
|
|
55
|
-
renderToggle={ ( { isOpen, onToggle } ) => (
|
|
56
|
-
<Button
|
|
57
|
-
onClick={ onToggle }
|
|
58
|
-
aria-expanded={ isOpen }
|
|
59
|
-
className={ classnames(
|
|
60
|
-
'block-editor-panel-color-gradient-settings__dropdown',
|
|
61
|
-
{ 'is-open': isOpen }
|
|
62
|
-
) }
|
|
63
|
-
>
|
|
64
|
-
<HStack justify="flex-start">
|
|
65
|
-
<ColorIndicator
|
|
66
|
-
className="block-editor-panel-color-gradient-settings__color-indicator"
|
|
67
|
-
colorValue={ selectedColor }
|
|
68
|
-
/>
|
|
69
|
-
<FlexItem>{ settings.label }</FlexItem>
|
|
70
|
-
</HStack>
|
|
71
|
-
</Button>
|
|
72
|
-
) }
|
|
73
|
-
renderContent={ () => (
|
|
74
|
-
<ColorGradientControl
|
|
75
|
-
showTitle={ false }
|
|
76
|
-
__experimentalHasMultipleOrigins
|
|
77
|
-
__experimentalIsRenderedInSidebar
|
|
78
|
-
enableAlpha
|
|
79
|
-
{ ...controlSettings }
|
|
80
|
-
/>
|
|
81
|
-
) }
|
|
82
|
-
/>
|
|
83
|
-
</ToolsPanelItem>
|
|
84
|
-
);
|
|
85
|
-
}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import classnames from 'classnames';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* WordPress dependencies
|
|
8
|
-
*/
|
|
9
|
-
import { __experimentalTreeGridCell as TreeGridCell } from '@wordpress/components';
|
|
10
|
-
import { useInstanceId } from '@wordpress/compose';
|
|
11
|
-
import { __, sprintf } from '@wordpress/i18n';
|
|
12
|
-
import { useSelect } from '@wordpress/data';
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Internal dependencies
|
|
16
|
-
*/
|
|
17
|
-
import ListViewLeaf from './leaf';
|
|
18
|
-
import Inserter from '../inserter';
|
|
19
|
-
import { store as blockEditorStore } from '../../store';
|
|
20
|
-
|
|
21
|
-
export default function ListViewAppender( {
|
|
22
|
-
parentBlockClientId,
|
|
23
|
-
position,
|
|
24
|
-
level,
|
|
25
|
-
rowCount,
|
|
26
|
-
path,
|
|
27
|
-
} ) {
|
|
28
|
-
const isDragging = useSelect(
|
|
29
|
-
( select ) => {
|
|
30
|
-
const { isBlockBeingDragged, isAncestorBeingDragged } = select(
|
|
31
|
-
blockEditorStore
|
|
32
|
-
);
|
|
33
|
-
|
|
34
|
-
return (
|
|
35
|
-
isBlockBeingDragged( parentBlockClientId ) ||
|
|
36
|
-
isAncestorBeingDragged( parentBlockClientId )
|
|
37
|
-
);
|
|
38
|
-
},
|
|
39
|
-
[ parentBlockClientId ]
|
|
40
|
-
);
|
|
41
|
-
const instanceId = useInstanceId( ListViewAppender );
|
|
42
|
-
const descriptionId = `list-view-appender-row__description_${ instanceId }`;
|
|
43
|
-
|
|
44
|
-
const appenderPositionDescription = sprintf(
|
|
45
|
-
/* translators: 1: The numerical position of the block that will be inserted. 2: The level of nesting for the block that will be inserted. */
|
|
46
|
-
__( 'Add block at position %1$d, Level %2$d' ),
|
|
47
|
-
position,
|
|
48
|
-
level
|
|
49
|
-
);
|
|
50
|
-
|
|
51
|
-
return (
|
|
52
|
-
<ListViewLeaf
|
|
53
|
-
className={ classnames( { 'is-dragging': isDragging } ) }
|
|
54
|
-
level={ level }
|
|
55
|
-
position={ position }
|
|
56
|
-
rowCount={ rowCount }
|
|
57
|
-
path={ path }
|
|
58
|
-
>
|
|
59
|
-
<TreeGridCell
|
|
60
|
-
className="block-editor-list-view-appender__cell"
|
|
61
|
-
colSpan="3"
|
|
62
|
-
>
|
|
63
|
-
{ ( { ref, tabIndex, onFocus } ) => (
|
|
64
|
-
<div className="block-editor-list-view-appender__container">
|
|
65
|
-
<Inserter
|
|
66
|
-
rootClientId={ parentBlockClientId }
|
|
67
|
-
__experimentalIsQuick
|
|
68
|
-
aria-describedby={ descriptionId }
|
|
69
|
-
toggleProps={ { ref, tabIndex, onFocus } }
|
|
70
|
-
/>
|
|
71
|
-
<div
|
|
72
|
-
className="block-editor-list-view-appender__description"
|
|
73
|
-
id={ descriptionId }
|
|
74
|
-
>
|
|
75
|
-
{ appenderPositionDescription }
|
|
76
|
-
</div>
|
|
77
|
-
</div>
|
|
78
|
-
) }
|
|
79
|
-
</TreeGridCell>
|
|
80
|
-
</ListViewLeaf>
|
|
81
|
-
);
|
|
82
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import classnames from 'classnames';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* WordPress dependencies
|
|
8
|
-
*/
|
|
9
|
-
import { Button, VisuallyHidden } from '@wordpress/components';
|
|
10
|
-
import {
|
|
11
|
-
__experimentalGetBlockLabel as getBlockLabel,
|
|
12
|
-
getBlockType,
|
|
13
|
-
} from '@wordpress/blocks';
|
|
14
|
-
import { __ } from '@wordpress/i18n';
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Internal dependencies
|
|
18
|
-
*/
|
|
19
|
-
import BlockIcon from '../block-icon';
|
|
20
|
-
|
|
21
|
-
export default function ListViewListItem( {
|
|
22
|
-
block,
|
|
23
|
-
onClick,
|
|
24
|
-
isSelected,
|
|
25
|
-
wrapperComponent: WrapperComponent,
|
|
26
|
-
children,
|
|
27
|
-
} ) {
|
|
28
|
-
const blockType = getBlockType( block.name );
|
|
29
|
-
const blockLabel = blockType
|
|
30
|
-
? getBlockLabel( blockType, block.attributes )
|
|
31
|
-
: null;
|
|
32
|
-
|
|
33
|
-
return (
|
|
34
|
-
<div className="block-editor-list-view__list-item">
|
|
35
|
-
<WrapperComponent
|
|
36
|
-
className={ classnames(
|
|
37
|
-
'block-editor-list-view__list-item-button',
|
|
38
|
-
{
|
|
39
|
-
'is-selected': isSelected,
|
|
40
|
-
}
|
|
41
|
-
) }
|
|
42
|
-
onClick={ onClick }
|
|
43
|
-
>
|
|
44
|
-
<BlockIcon icon={ blockType?.icon } showColors />
|
|
45
|
-
{ children ? children : blockLabel }
|
|
46
|
-
{ isSelected && (
|
|
47
|
-
<VisuallyHidden as="span">
|
|
48
|
-
{ __( '(selected block)' ) }
|
|
49
|
-
</VisuallyHidden>
|
|
50
|
-
) }
|
|
51
|
-
</WrapperComponent>
|
|
52
|
-
</div>
|
|
53
|
-
);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
ListViewListItem.defaultProps = {
|
|
57
|
-
onClick: () => {},
|
|
58
|
-
wrapperComponent: ( props ) => <Button { ...props } />,
|
|
59
|
-
};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { useEffect } from '@wordpress/element';
|
|
5
|
-
import { useDispatch, useSelect } from '@wordpress/data';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Internal dependencies
|
|
9
|
-
*/
|
|
10
|
-
import { store as blockEditorStore } from '../../store';
|
|
11
|
-
|
|
12
|
-
export function useCaretInFormat( { value } ) {
|
|
13
|
-
const hasActiveFormats =
|
|
14
|
-
value.activeFormats && !! value.activeFormats.length;
|
|
15
|
-
const { isCaretWithinFormattedText } = useSelect( blockEditorStore );
|
|
16
|
-
const { enterFormattedText, exitFormattedText } = useDispatch(
|
|
17
|
-
blockEditorStore
|
|
18
|
-
);
|
|
19
|
-
useEffect( () => {
|
|
20
|
-
if ( hasActiveFormats ) {
|
|
21
|
-
if ( ! isCaretWithinFormattedText() ) {
|
|
22
|
-
enterFormattedText();
|
|
23
|
-
}
|
|
24
|
-
} else if ( isCaretWithinFormattedText() ) {
|
|
25
|
-
exitFormattedText();
|
|
26
|
-
}
|
|
27
|
-
}, [ hasActiveFormats ] );
|
|
28
|
-
}
|