@wordpress/block-editor 8.0.12-next.33ec3857e2.0 → 8.0.12
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/README.md +0 -4
- package/build/components/block-caption/index.native.js +3 -14
- package/build/components/block-caption/index.native.js.map +1 -1
- package/build/components/block-inspector/index.js +33 -12
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list/block.js +1 -1
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/block.native.js +2 -3
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-list/use-block-props/index.js +1 -3
- package/build/components/block-list/use-block-props/index.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-list-appender/index.js +11 -3
- package/build/components/block-list-appender/index.js.map +1 -1
- package/build/components/block-mobile-toolbar/block-actions-menu.native.js +2 -2
- package/build/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
- package/build/components/block-mover/button.js +2 -2
- package/build/components/block-mover/button.js.map +1 -1
- package/build/components/block-mover/index.js +2 -2
- package/build/components/block-mover/index.js.map +1 -1
- package/build/components/block-mover/index.native.js +2 -2
- package/build/components/block-mover/index.native.js.map +1 -1
- package/build/components/block-preview/auto.js +2 -10
- package/build/components/block-preview/auto.js.map +1 -1
- package/build/components/block-settings/container.native.js +1 -2
- package/build/components/block-settings/container.native.js.map +1 -1
- package/build/components/block-styles/index.js +134 -110
- package/build/components/block-styles/index.js.map +1 -1
- package/build/components/block-styles/utils.js +0 -39
- package/build/components/block-styles/utils.js.map +1 -1
- package/build/components/block-switcher/block-styles-menu.js +23 -3
- package/build/components/block-switcher/block-styles-menu.js.map +1 -1
- package/build/components/block-tools/back-compat.js +1 -2
- package/build/components/block-tools/back-compat.js.map +1 -1
- package/build/components/block-tools/block-selection-button.js +3 -3
- package/build/components/block-tools/block-selection-button.js.map +1 -1
- package/build/components/block-tools/insertion-point.js +1 -11
- package/build/components/block-tools/insertion-point.js.map +1 -1
- package/build/components/button-block-appender/index.js +1 -2
- package/build/components/button-block-appender/index.js.map +1 -1
- package/build/components/colors-gradients/panel-color-gradient-settings.js +10 -51
- package/build/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
- package/build/components/default-block-appender/index.js +19 -16
- package/build/components/default-block-appender/index.js.map +1 -1
- package/build/components/default-style-picker/index.js +3 -18
- package/build/components/default-style-picker/index.js.map +1 -1
- package/build/components/iframe/index.js +4 -3
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/index.js +9 -9
- package/build/components/index.js.map +1 -1
- package/build/components/inner-blocks/default-block-appender.js +4 -2
- package/build/components/inner-blocks/default-block-appender.js.map +1 -1
- package/build/components/inserter/hooks/use-insertion-point.js +2 -2
- package/build/components/inserter/hooks/use-insertion-point.js.map +1 -1
- package/build/components/inserter/index.js +2 -2
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/inserter/index.native.js +3 -3
- package/build/components/inserter/index.native.js.map +1 -1
- package/build/components/inserter/quick-inserter.js +1 -1
- package/build/components/inserter/quick-inserter.js.map +1 -1
- package/build/components/inserter/tabs.native.js +4 -7
- package/build/components/inserter/tabs.native.js.map +1 -1
- package/build/components/inspector-controls/block-support-slot-container.js +1 -2
- package/build/components/inspector-controls/block-support-slot-container.js.map +1 -1
- package/build/components/inspector-controls/block-support-tools-panel.js +50 -22
- package/build/components/inspector-controls/block-support-tools-panel.js.map +1 -1
- package/build/components/inspector-controls/fill.native.js +5 -3
- package/build/components/inspector-controls/fill.native.js.map +1 -1
- package/build/components/inspector-controls/groups.js +0 -2
- package/build/components/inspector-controls/groups.js.map +1 -1
- package/build/components/inspector-controls/slot.js +3 -1
- package/build/components/inspector-controls/slot.js.map +1 -1
- package/build/components/letter-spacing-control/index.js +6 -6
- package/build/components/letter-spacing-control/index.js.map +1 -1
- package/build/components/list-view/block-select-button.js +3 -23
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/list-view/use-list-view-drop-zone.js +1 -1
- package/build/components/list-view/use-list-view-drop-zone.js.map +1 -1
- package/build/components/media-placeholder/index.js +0 -2
- package/build/components/media-placeholder/index.js.map +1 -1
- package/build/components/media-replace-flow/index.js +0 -2
- package/build/components/media-replace-flow/index.js.map +1 -1
- package/build/components/provider/use-block-sync.js +37 -10
- package/build/components/provider/use-block-sync.js.map +1 -1
- package/build/components/rich-text/file-paste-handler.js +1 -1
- package/build/components/rich-text/file-paste-handler.js.map +1 -1
- package/build/components/rich-text/use-input-rules.js +1 -3
- package/build/components/rich-text/use-input-rules.js.map +1 -1
- package/build/components/selection-scroll-into-view/index.js +1 -2
- package/build/components/selection-scroll-into-view/index.js.map +1 -1
- package/build/components/use-canvas-click-redirect/index.js +66 -0
- package/build/components/use-canvas-click-redirect/index.js.map +1 -0
- package/build/components/use-on-block-drop/index.js +4 -8
- package/build/components/use-on-block-drop/index.js.map +1 -1
- package/build/components/use-setting/index.js +7 -0
- package/build/components/use-setting/index.js.map +1 -1
- package/build/components/writing-flow/use-multi-selection.js +1 -3
- package/build/components/writing-flow/use-multi-selection.js.map +1 -1
- package/build/hooks/border-color.js +5 -63
- package/build/hooks/border-color.js.map +1 -1
- package/build/hooks/border-radius.js +0 -47
- package/build/hooks/border-radius.js.map +1 -1
- package/build/hooks/border-style.js +0 -41
- package/build/hooks/border-style.js.map +1 -1
- package/build/hooks/border-width.js +31 -70
- package/build/hooks/border-width.js.map +1 -1
- package/build/hooks/border.js +11 -81
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/letter-spacing.js +1 -1
- package/build/hooks/letter-spacing.js.map +1 -1
- package/build/hooks/typography.js +1 -1
- package/build/hooks/typography.js.map +1 -1
- package/build/layouts/flex.js +3 -27
- package/build/layouts/flex.js.map +1 -1
- package/build/store/actions.js +5 -4
- package/build/store/actions.js.map +1 -1
- package/build/store/defaults.js +1 -5
- package/build/store/defaults.js.map +1 -1
- package/build/store/reducer.js +24 -1
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +9 -27
- package/build/store/selectors.js.map +1 -1
- package/build/utils/get-paste-event-data.js +1 -1
- package/build/utils/get-paste-event-data.js.map +1 -1
- package/build/utils/parse-css-unit-to-px.js +1 -1
- package/build/utils/parse-css-unit-to-px.js.map +1 -1
- package/build-module/components/block-caption/index.native.js +3 -13
- package/build-module/components/block-caption/index.native.js.map +1 -1
- package/build-module/components/block-inspector/index.js +33 -12
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list/block.js +1 -1
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/block.native.js +2 -3
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-list/use-block-props/index.js +1 -3
- package/build-module/components/block-list/use-block-props/index.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-list-appender/index.js +10 -3
- package/build-module/components/block-list-appender/index.js.map +1 -1
- package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js +2 -2
- package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
- package/build-module/components/block-mover/button.js +2 -2
- package/build-module/components/block-mover/button.js.map +1 -1
- package/build-module/components/block-mover/index.js +2 -2
- package/build-module/components/block-mover/index.js.map +1 -1
- package/build-module/components/block-mover/index.native.js +2 -2
- package/build-module/components/block-mover/index.native.js.map +1 -1
- package/build-module/components/block-preview/auto.js +2 -10
- package/build-module/components/block-preview/auto.js.map +1 -1
- package/build-module/components/block-settings/container.native.js +1 -2
- package/build-module/components/block-settings/container.native.js.map +1 -1
- package/build-module/components/block-styles/index.js +133 -112
- package/build-module/components/block-styles/index.js.map +1 -1
- package/build-module/components/block-styles/utils.js +0 -34
- package/build-module/components/block-styles/utils.js.map +1 -1
- package/build-module/components/block-switcher/block-styles-menu.js +21 -3
- package/build-module/components/block-switcher/block-styles-menu.js.map +1 -1
- package/build-module/components/block-tools/back-compat.js +1 -2
- package/build-module/components/block-tools/back-compat.js.map +1 -1
- package/build-module/components/block-tools/block-selection-button.js +3 -3
- package/build-module/components/block-tools/block-selection-button.js.map +1 -1
- package/build-module/components/block-tools/insertion-point.js +1 -11
- package/build-module/components/block-tools/insertion-point.js.map +1 -1
- package/build-module/components/button-block-appender/index.js +1 -2
- package/build-module/components/button-block-appender/index.js.map +1 -1
- package/build-module/components/colors-gradients/panel-color-gradient-settings.js +13 -54
- package/build-module/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
- package/build-module/components/default-block-appender/index.js +18 -15
- package/build-module/components/default-block-appender/index.js.map +1 -1
- package/build-module/components/default-style-picker/index.js +3 -17
- package/build-module/components/default-style-picker/index.js.map +1 -1
- package/build-module/components/iframe/index.js +4 -3
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/index.js +1 -1
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/inner-blocks/default-block-appender.js +4 -2
- package/build-module/components/inner-blocks/default-block-appender.js.map +1 -1
- package/build-module/components/inserter/hooks/use-insertion-point.js +2 -2
- package/build-module/components/inserter/hooks/use-insertion-point.js.map +1 -1
- package/build-module/components/inserter/index.js +2 -2
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/inserter/index.native.js +4 -4
- package/build-module/components/inserter/index.native.js.map +1 -1
- package/build-module/components/inserter/quick-inserter.js +1 -1
- package/build-module/components/inserter/quick-inserter.js.map +1 -1
- package/build-module/components/inserter/tabs.native.js +4 -7
- package/build-module/components/inserter/tabs.native.js.map +1 -1
- package/build-module/components/inspector-controls/block-support-slot-container.js +1 -2
- package/build-module/components/inspector-controls/block-support-slot-container.js.map +1 -1
- package/build-module/components/inspector-controls/block-support-tools-panel.js +50 -22
- package/build-module/components/inspector-controls/block-support-tools-panel.js.map +1 -1
- package/build-module/components/inspector-controls/fill.native.js +5 -3
- package/build-module/components/inspector-controls/fill.native.js.map +1 -1
- package/build-module/components/inspector-controls/groups.js +0 -2
- package/build-module/components/inspector-controls/groups.js.map +1 -1
- package/build-module/components/inspector-controls/slot.js +3 -1
- package/build-module/components/inspector-controls/slot.js.map +1 -1
- package/build-module/components/letter-spacing-control/index.js +6 -6
- package/build-module/components/letter-spacing-control/index.js.map +1 -1
- package/build-module/components/list-view/block-select-button.js +3 -22
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/list-view/use-list-view-drop-zone.js +1 -1
- package/build-module/components/list-view/use-list-view-drop-zone.js.map +1 -1
- package/build-module/components/media-placeholder/index.js +0 -2
- package/build-module/components/media-placeholder/index.js.map +1 -1
- package/build-module/components/media-replace-flow/index.js +0 -2
- package/build-module/components/media-replace-flow/index.js.map +1 -1
- package/build-module/components/provider/use-block-sync.js +41 -14
- package/build-module/components/provider/use-block-sync.js.map +1 -1
- package/build-module/components/rich-text/file-paste-handler.js +1 -1
- package/build-module/components/rich-text/file-paste-handler.js.map +1 -1
- package/build-module/components/rich-text/use-input-rules.js +1 -2
- package/build-module/components/rich-text/use-input-rules.js.map +1 -1
- package/build-module/components/selection-scroll-into-view/index.js +1 -2
- package/build-module/components/selection-scroll-into-view/index.js.map +1 -1
- package/build-module/components/use-canvas-click-redirect/index.js +54 -0
- package/build-module/components/use-canvas-click-redirect/index.js.map +1 -0
- package/build-module/components/use-on-block-drop/index.js +4 -8
- package/build-module/components/use-on-block-drop/index.js.map +1 -1
- package/build-module/components/use-setting/index.js +7 -0
- package/build-module/components/use-setting/index.js.map +1 -1
- package/build-module/components/writing-flow/use-multi-selection.js +4 -3
- package/build-module/components/writing-flow/use-multi-selection.js.map +1 -1
- package/build-module/hooks/border-color.js +7 -61
- package/build-module/hooks/border-color.js.map +1 -1
- package/build-module/hooks/border-radius.js +0 -42
- package/build-module/hooks/border-radius.js.map +1 -1
- package/build-module/hooks/border-style.js +0 -36
- package/build-module/hooks/border-style.js.map +1 -1
- package/build-module/hooks/border-width.js +32 -66
- package/build-module/hooks/border-width.js.map +1 -1
- package/build-module/hooks/border.js +12 -80
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/letter-spacing.js +1 -1
- package/build-module/hooks/letter-spacing.js.map +1 -1
- package/build-module/hooks/typography.js +1 -1
- package/build-module/hooks/typography.js.map +1 -1
- package/build-module/layouts/flex.js +3 -27
- package/build-module/layouts/flex.js.map +1 -1
- package/build-module/store/actions.js +5 -4
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/defaults.js +1 -5
- package/build-module/store/defaults.js.map +1 -1
- package/build-module/store/reducer.js +24 -1
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +9 -26
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/get-paste-event-data.js +1 -1
- package/build-module/utils/get-paste-event-data.js.map +1 -1
- package/build-module/utils/parse-css-unit-to-px.js +1 -1
- package/build-module/utils/parse-css-unit-to-px.js.map +1 -1
- package/build-style/style-rtl.css +180 -212
- package/build-style/style.css +180 -212
- package/package.json +27 -27
- package/src/components/block-caption/index.native.js +4 -22
- package/src/components/block-inspector/index.js +32 -13
- package/src/components/block-list/block.js +1 -1
- package/src/components/block-list/block.native.js +2 -2
- package/src/components/block-list/use-block-props/index.js +1 -3
- package/src/components/block-list/use-in-between-inserter.js +1 -1
- package/src/components/block-list-appender/index.js +21 -5
- package/src/components/block-mobile-toolbar/block-actions-menu.native.js +2 -5
- package/src/components/block-mover/button.js +2 -6
- package/src/components/block-mover/index.js +2 -5
- package/src/components/block-mover/index.native.js +2 -5
- package/src/components/block-preview/auto.js +2 -7
- package/src/components/block-settings/container.native.js +0 -1
- package/src/components/block-styles/index.js +145 -125
- package/src/components/block-styles/style.scss +51 -59
- package/src/components/block-styles/test/{utils.js → index.js} +1 -60
- package/src/components/block-styles/utils.js +0 -39
- package/src/components/block-switcher/block-styles-menu.js +38 -3
- package/src/components/block-tools/back-compat.js +0 -1
- package/src/components/block-tools/block-selection-button.js +3 -9
- package/src/components/block-tools/insertion-point.js +1 -10
- package/src/components/border-style-control/style.scss +1 -0
- package/src/components/button-block-appender/index.js +0 -1
- package/src/components/colors-gradients/panel-color-gradient-settings.js +19 -75
- package/src/components/colors-gradients/style.scss +5 -42
- package/src/components/default-block-appender/index.js +24 -17
- package/src/components/default-block-appender/style.scss +0 -4
- package/src/components/default-block-appender/test/__snapshots__/index.js.snap +24 -12
- package/src/components/default-block-appender/test/index.js +14 -4
- package/src/components/default-style-picker/index.js +6 -18
- package/src/components/iframe/index.js +3 -6
- package/src/components/index.js +1 -1
- package/src/components/inner-blocks/README.md +0 -2
- package/src/components/inner-blocks/default-block-appender.js +7 -2
- package/src/components/inserter/hooks/use-insertion-point.js +2 -9
- package/src/components/inserter/index.js +2 -2
- package/src/components/inserter/index.native.js +4 -7
- package/src/components/inserter/quick-inserter.js +1 -1
- package/src/components/inserter/tabs.native.js +4 -5
- package/src/components/inspector-controls/block-support-slot-container.js +1 -3
- package/src/components/inspector-controls/block-support-tools-panel.js +57 -21
- package/src/components/inspector-controls/fill.native.js +3 -4
- package/src/components/inspector-controls/groups.js +0 -2
- package/src/components/inspector-controls/slot.js +7 -2
- package/src/components/letter-spacing-control/index.js +6 -6
- package/src/components/link-control/README.md +1 -1
- package/src/components/link-control/test/index.js +0 -2
- package/src/components/list-view/block-select-button.js +1 -20
- package/src/components/list-view/use-list-view-drop-zone.js +1 -1
- package/src/components/media-placeholder/index.js +0 -2
- package/src/components/media-replace-flow/index.js +0 -2
- package/src/components/provider/use-block-sync.js +45 -11
- package/src/components/rich-text/file-paste-handler.js +1 -3
- package/src/components/rich-text/use-input-rules.js +1 -2
- package/src/components/selection-scroll-into-view/index.js +0 -1
- package/src/components/url-input/README.md +0 -5
- package/src/components/use-canvas-click-redirect/index.js +57 -0
- package/src/components/use-on-block-drop/index.js +4 -11
- package/src/components/use-setting/index.js +9 -0
- package/src/components/writing-flow/use-multi-selection.js +9 -12
- package/src/hooks/border-color.js +3 -55
- package/src/hooks/border-radius.js +0 -32
- package/src/hooks/border-style.js +0 -26
- package/src/hooks/border-width.js +32 -56
- package/src/hooks/border.js +20 -115
- package/src/hooks/border.scss +17 -3
- package/src/hooks/letter-spacing.js +1 -1
- package/src/hooks/typography.js +1 -1
- package/src/layouts/flex.js +4 -25
- package/src/store/actions.js +5 -5
- package/src/store/defaults.js +0 -2
- package/src/store/reducer.js +23 -1
- package/src/store/selectors.js +9 -39
- package/src/store/test/reducer.js +35 -0
- package/src/store/test/selectors.js +1 -1
- package/src/style.scss +3 -4
- package/src/utils/get-paste-event-data.js +1 -1
- package/src/utils/parse-css-unit-to-px.js +1 -1
- package/src/utils/test/parse-css-unit-to-px.js +0 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/build/components/block-styles/menu-items.js +0 -63
- package/build/components/block-styles/menu-items.js.map +0 -1
- package/build/components/block-styles/preview-panel.js +0 -45
- package/build/components/block-styles/preview-panel.js.map +0 -1
- package/build/components/block-styles/use-styles-for-block.js +0 -119
- package/build/components/block-styles/use-styles-for-block.js.map +0 -1
- package/build/components/rich-text/prevent-event-discovery.js +0 -33
- package/build/components/rich-text/prevent-event-discovery.js.map +0 -1
- package/build/components/use-display-block-controls/index.native.js +0 -45
- package/build/components/use-display-block-controls/index.native.js.map +0 -1
- package/build-module/components/block-styles/menu-items.js +0 -50
- package/build-module/components/block-styles/menu-items.js.map +0 -1
- package/build-module/components/block-styles/preview-panel.js +0 -35
- package/build-module/components/block-styles/preview-panel.js.map +0 -1
- package/build-module/components/block-styles/use-styles-for-block.js +0 -107
- package/build-module/components/block-styles/use-styles-for-block.js.map +0 -1
- package/build-module/components/rich-text/prevent-event-discovery.js +0 -25
- package/build-module/components/rich-text/prevent-event-discovery.js.map +0 -1
- package/build-module/components/use-display-block-controls/index.native.js +0 -34
- package/build-module/components/use-display-block-controls/index.native.js.map +0 -1
- package/src/components/block-styles/menu-items.js +0 -49
- package/src/components/block-styles/preview-panel.js +0 -36
- package/src/components/block-styles/use-styles-for-block.js +0 -99
- package/src/components/rich-text/prevent-event-discovery.js +0 -23
- package/src/components/use-display-block-controls/index.native.js +0 -38
- package/src/components/writing-flow/test/use-multi-selection.js +0 -36
- package/src/hooks/dimensions.scss +0 -5
|
@@ -147,11 +147,6 @@ _Optional._ If this property is added, a label will be generated using label pro
|
|
|
147
147
|
|
|
148
148
|
_Optional._ Adds and optional class to the parent `div` that wraps the URLInput field and popover
|
|
149
149
|
|
|
150
|
-
### `placeholder: String`
|
|
151
|
-
|
|
152
|
-
_Optional._ Placeholder text to show when the field is empty, similar to the
|
|
153
|
-
[`input` and `textarea` attribute of the same name](https://developer.mozilla.org/en-US/docs/Learn/HTML/Forms/HTML5_updates#The_placeholder_attribute).
|
|
154
|
-
|
|
155
150
|
### `disableSuggestions: Boolean`
|
|
156
151
|
|
|
157
152
|
_Optional._ Provides additional control over whether suggestions are disabled.
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { overEvery, findLast } from 'lodash';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* WordPress dependencies
|
|
8
|
+
*/
|
|
9
|
+
import { useRefEffect } from '@wordpress/compose';
|
|
10
|
+
import { focus, isTextField, placeCaretAtHorizontalEdge } from '@wordpress/dom';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Given an element, returns true if the element is a tabbable text field, or
|
|
14
|
+
* false otherwise.
|
|
15
|
+
*
|
|
16
|
+
* @param {Element} element Element to test.
|
|
17
|
+
*
|
|
18
|
+
* @return {boolean} Whether element is a tabbable text field.
|
|
19
|
+
*/
|
|
20
|
+
const isTabbableTextField = overEvery( [
|
|
21
|
+
isTextField,
|
|
22
|
+
focus.tabbable.isTabbableIndex,
|
|
23
|
+
] );
|
|
24
|
+
|
|
25
|
+
export function useCanvasClickRedirect() {
|
|
26
|
+
return useRefEffect( ( node ) => {
|
|
27
|
+
function onMouseDown( event ) {
|
|
28
|
+
// Only handle clicks on the canvas, not the content.
|
|
29
|
+
if ( event.target !== node ) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const focusableNodes = focus.focusable.find( node );
|
|
34
|
+
const target = findLast( focusableNodes, isTabbableTextField );
|
|
35
|
+
|
|
36
|
+
if ( ! target ) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const { bottom } = target.getBoundingClientRect();
|
|
41
|
+
|
|
42
|
+
// Ensure the click is below the last block.
|
|
43
|
+
if ( event.clientY < bottom ) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
placeCaretAtHorizontalEdge( target, true );
|
|
48
|
+
event.preventDefault();
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
node.addEventListener( 'mousedown', onMouseDown );
|
|
52
|
+
|
|
53
|
+
return () => {
|
|
54
|
+
node.addEventListener( 'mousedown', onMouseDown );
|
|
55
|
+
};
|
|
56
|
+
}, [] );
|
|
57
|
+
}
|
|
@@ -95,10 +95,7 @@ export function onBlockDrop(
|
|
|
95
95
|
|
|
96
96
|
// If the user is moving a block
|
|
97
97
|
if ( dropType === 'block' ) {
|
|
98
|
-
const sourceBlockIndex = getBlockIndex(
|
|
99
|
-
sourceClientIds[ 0 ],
|
|
100
|
-
sourceRootClientId
|
|
101
|
-
);
|
|
98
|
+
const sourceBlockIndex = getBlockIndex( sourceClientIds[ 0 ] );
|
|
102
99
|
|
|
103
100
|
// If the user is dropping to the same position, return early.
|
|
104
101
|
if (
|
|
@@ -259,14 +256,10 @@ export default function useOnBlockDrop( targetRootClientId, targetBlockIndex ) {
|
|
|
259
256
|
const files = getFilesFromDataTransfer( event.dataTransfer );
|
|
260
257
|
const html = event.dataTransfer.getData( 'text/html' );
|
|
261
258
|
|
|
262
|
-
|
|
263
|
-
* From Windows Chrome 96, the `event.dataTransfer` returns both file object and HTML.
|
|
264
|
-
* The order of the checks is important to recognise the HTML drop.
|
|
265
|
-
*/
|
|
266
|
-
if ( html ) {
|
|
267
|
-
_onHTMLDrop( html );
|
|
268
|
-
} else if ( files.length ) {
|
|
259
|
+
if ( files.length ) {
|
|
269
260
|
_onFilesDrop( files );
|
|
261
|
+
} else if ( html ) {
|
|
262
|
+
_onHTMLDrop( html );
|
|
270
263
|
} else {
|
|
271
264
|
_onDrop( event );
|
|
272
265
|
}
|
|
@@ -15,6 +15,8 @@ import { __EXPERIMENTAL_PATHS_WITH_MERGE as PATHS_WITH_MERGE } from '@wordpress/
|
|
|
15
15
|
import { useBlockEditContext } from '../block-edit';
|
|
16
16
|
import { store as blockEditorStore } from '../../store';
|
|
17
17
|
|
|
18
|
+
const blockedPaths = [ 'color', 'border', 'typography', 'spacing' ];
|
|
19
|
+
|
|
18
20
|
const deprecatedFlags = {
|
|
19
21
|
'color.palette': ( settings ) =>
|
|
20
22
|
settings.colors === undefined ? undefined : settings.colors,
|
|
@@ -104,6 +106,13 @@ export default function useSetting( path ) {
|
|
|
104
106
|
|
|
105
107
|
const setting = useSelect(
|
|
106
108
|
( select ) => {
|
|
109
|
+
if ( blockedPaths.includes( path ) ) {
|
|
110
|
+
// eslint-disable-next-line no-console
|
|
111
|
+
console.warn(
|
|
112
|
+
'Top level useSetting paths are disabled. Please use a subpath to query the information needed.'
|
|
113
|
+
);
|
|
114
|
+
return undefined;
|
|
115
|
+
}
|
|
107
116
|
const settings = select( blockEditorStore ).getSettings();
|
|
108
117
|
|
|
109
118
|
// 1 - Use __experimental features, if available.
|
|
@@ -15,19 +15,16 @@ import { useSelect } from '@wordpress/data';
|
|
|
15
15
|
import { store as blockEditorStore } from '../../store';
|
|
16
16
|
import { __unstableUseBlockRef as useBlockRef } from '../block-list/use-block-props/use-block-refs';
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
Array.from(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
node.setAttribute( 'contenteditable', true );
|
|
27
|
-
} else {
|
|
28
|
-
node.removeAttribute( 'contenteditable' );
|
|
18
|
+
function toggleRichText( container, toggle ) {
|
|
19
|
+
Array.from( container.querySelectorAll( '.rich-text' ) ).forEach(
|
|
20
|
+
( node ) => {
|
|
21
|
+
if ( toggle ) {
|
|
22
|
+
node.setAttribute( 'contenteditable', true );
|
|
23
|
+
} else {
|
|
24
|
+
node.removeAttribute( 'contenteditable' );
|
|
25
|
+
}
|
|
29
26
|
}
|
|
30
|
-
|
|
27
|
+
);
|
|
31
28
|
}
|
|
32
29
|
|
|
33
30
|
/**
|
|
@@ -9,7 +9,7 @@ import classnames from 'classnames';
|
|
|
9
9
|
import { addFilter } from '@wordpress/hooks';
|
|
10
10
|
import { __ } from '@wordpress/i18n';
|
|
11
11
|
import { createHigherOrderComponent } from '@wordpress/compose';
|
|
12
|
-
import {
|
|
12
|
+
import { useState } from '@wordpress/element';
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Internal dependencies
|
|
@@ -22,11 +22,7 @@ import {
|
|
|
22
22
|
getColorObjectByAttributeValues,
|
|
23
23
|
} from '../components/colors';
|
|
24
24
|
import useSetting from '../components/use-setting';
|
|
25
|
-
import {
|
|
26
|
-
hasBorderSupport,
|
|
27
|
-
removeBorderAttribute,
|
|
28
|
-
shouldSkipSerialization,
|
|
29
|
-
} from './border';
|
|
25
|
+
import { hasBorderSupport, shouldSkipSerialization } from './border';
|
|
30
26
|
import { cleanEmptyObject } from './utils';
|
|
31
27
|
|
|
32
28
|
// Defining empty array here instead of inline avoids unnecessary re-renders of
|
|
@@ -56,30 +52,15 @@ export function BorderColorEdit( props ) {
|
|
|
56
52
|
( colors, origin ) => colors.concat( origin.colors ),
|
|
57
53
|
[]
|
|
58
54
|
);
|
|
59
|
-
const { color: customBorderColor } = style?.border || {};
|
|
60
55
|
const [ colorValue, setColorValue ] = useState(
|
|
61
56
|
() =>
|
|
62
57
|
getColorObjectByAttributeValues(
|
|
63
58
|
availableColors,
|
|
64
59
|
borderColor,
|
|
65
|
-
|
|
60
|
+
style?.border?.color
|
|
66
61
|
)?.color
|
|
67
62
|
);
|
|
68
63
|
|
|
69
|
-
// Detect changes in the color attributes and update the colorValue to keep the
|
|
70
|
-
// UI in sync. This is necessary for situations when border controls interact with
|
|
71
|
-
// eachother: eg, setting the border width to zero causes the color and style
|
|
72
|
-
// selections to be cleared.
|
|
73
|
-
useEffect( () => {
|
|
74
|
-
setColorValue(
|
|
75
|
-
getColorObjectByAttributeValues(
|
|
76
|
-
availableColors,
|
|
77
|
-
borderColor,
|
|
78
|
-
customBorderColor
|
|
79
|
-
)?.color
|
|
80
|
-
);
|
|
81
|
-
}, [ borderColor, customBorderColor, availableColors ] );
|
|
82
|
-
|
|
83
64
|
const onChangeColor = ( value ) => {
|
|
84
65
|
setColorValue( value );
|
|
85
66
|
|
|
@@ -117,39 +98,6 @@ export function BorderColorEdit( props ) {
|
|
|
117
98
|
);
|
|
118
99
|
}
|
|
119
100
|
|
|
120
|
-
/**
|
|
121
|
-
* Checks if there is a current value in the border color block support
|
|
122
|
-
* attributes.
|
|
123
|
-
*
|
|
124
|
-
* @param {Object} props Block props.
|
|
125
|
-
* @return {boolean} Whether or not the block has a border color value set.
|
|
126
|
-
*/
|
|
127
|
-
export function hasBorderColorValue( props ) {
|
|
128
|
-
const {
|
|
129
|
-
attributes: { borderColor, style },
|
|
130
|
-
} = props;
|
|
131
|
-
|
|
132
|
-
return !! borderColor || !! style?.border?.color;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
* Resets the border color block support attributes. This can be used when
|
|
137
|
-
* disabling the border color support controls for a block via a progressive
|
|
138
|
-
* discovery panel.
|
|
139
|
-
*
|
|
140
|
-
* @param {Object} props Block props.
|
|
141
|
-
* @param {Object} props.attributes Block's attributes.
|
|
142
|
-
* @param {Object} props.setAttributes Function to set block's attributes.
|
|
143
|
-
*/
|
|
144
|
-
export function resetBorderColor( { attributes = {}, setAttributes } ) {
|
|
145
|
-
const { style } = attributes;
|
|
146
|
-
|
|
147
|
-
setAttributes( {
|
|
148
|
-
borderColor: undefined,
|
|
149
|
-
style: removeBorderAttribute( style, 'color' ),
|
|
150
|
-
} );
|
|
151
|
-
}
|
|
152
|
-
|
|
153
101
|
/**
|
|
154
102
|
* Filters registered block settings, extending attributes to include
|
|
155
103
|
* `borderColor` if needed.
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import BorderRadiusControl from '../components/border-radius-control';
|
|
5
5
|
import { cleanEmptyObject } from './utils';
|
|
6
|
-
import { removeBorderAttribute } from './border';
|
|
7
6
|
|
|
8
7
|
/**
|
|
9
8
|
* Inspector control panel containing the border radius related configuration.
|
|
@@ -41,34 +40,3 @@ export function BorderRadiusEdit( props ) {
|
|
|
41
40
|
/>
|
|
42
41
|
);
|
|
43
42
|
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Checks if there is a current value in the border radius block support
|
|
47
|
-
* attributes.
|
|
48
|
-
*
|
|
49
|
-
* @param {Object} props Block props.
|
|
50
|
-
* @return {boolean} Whether or not the block has a border radius value set.
|
|
51
|
-
*/
|
|
52
|
-
export function hasBorderRadiusValue( props ) {
|
|
53
|
-
const borderRadius = props.attributes.style?.border?.radius;
|
|
54
|
-
|
|
55
|
-
if ( typeof borderRadius === 'object' ) {
|
|
56
|
-
return Object.entries( borderRadius ).some( Boolean );
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
return !! borderRadius;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Resets the border radius block support attributes. This can be used when
|
|
64
|
-
* disabling the border radius support controls for a block via a progressive
|
|
65
|
-
* discovery panel.
|
|
66
|
-
*
|
|
67
|
-
* @param {Object} props Block props.
|
|
68
|
-
* @param {Object} props.attributes Block's attributes.
|
|
69
|
-
* @param {Object} props.setAttributes Function to set block's attributes.
|
|
70
|
-
*/
|
|
71
|
-
export function resetBorderRadius( { attributes = {}, setAttributes } ) {
|
|
72
|
-
const { style } = attributes;
|
|
73
|
-
setAttributes( { style: removeBorderAttribute( style, 'radius' ) } );
|
|
74
|
-
}
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import BorderStyleControl from '../components/border-style-control';
|
|
5
5
|
import { cleanEmptyObject } from './utils';
|
|
6
|
-
import { removeBorderAttribute } from './border';
|
|
7
6
|
|
|
8
7
|
/**
|
|
9
8
|
* Inspector control for configuring border style property.
|
|
@@ -37,28 +36,3 @@ export const BorderStyleEdit = ( props ) => {
|
|
|
37
36
|
/>
|
|
38
37
|
);
|
|
39
38
|
};
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Checks if there is a current value in the border style block support
|
|
43
|
-
* attributes.
|
|
44
|
-
*
|
|
45
|
-
* @param {Object} props Block props.
|
|
46
|
-
* @return {boolean} Whether or not the block has a border style value set.
|
|
47
|
-
*/
|
|
48
|
-
export function hasBorderStyleValue( props ) {
|
|
49
|
-
return !! props.attributes.style?.border?.style;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Resets the border style block support attribute. This can be used when
|
|
54
|
-
* disabling the border style support control for a block via a progressive
|
|
55
|
-
* discovery panel.
|
|
56
|
-
*
|
|
57
|
-
* @param {Object} props Block props.
|
|
58
|
-
* @param {Object} props.attributes Block's attributes.
|
|
59
|
-
* @param {Object} props.setAttributes Function to set block's attributes.
|
|
60
|
-
*/
|
|
61
|
-
export function resetBorderStyle( { attributes = {}, setAttributes } ) {
|
|
62
|
-
const { style } = attributes;
|
|
63
|
-
setAttributes( { style: removeBorderAttribute( style, 'style' ) } );
|
|
64
|
-
}
|
|
@@ -5,14 +5,13 @@ import {
|
|
|
5
5
|
__experimentalUnitControl as UnitControl,
|
|
6
6
|
__experimentalUseCustomUnits as useCustomUnits,
|
|
7
7
|
} from '@wordpress/components';
|
|
8
|
-
import { useState } from '@wordpress/element';
|
|
8
|
+
import { useEffect, useState } from '@wordpress/element';
|
|
9
9
|
import { __ } from '@wordpress/i18n';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Internal dependencies
|
|
13
13
|
*/
|
|
14
14
|
import { cleanEmptyObject } from './utils';
|
|
15
|
-
import { removeBorderAttribute } from './border';
|
|
16
15
|
import useSetting from '../components/use-setting';
|
|
17
16
|
|
|
18
17
|
const MIN_BORDER_WIDTH = 0;
|
|
@@ -32,12 +31,25 @@ export const BorderWidthEdit = ( props ) => {
|
|
|
32
31
|
|
|
33
32
|
const { width, color: customBorderColor, style: borderStyle } =
|
|
34
33
|
style?.border || {};
|
|
35
|
-
|
|
36
|
-
// Used to temporarily track previous border color & style selections to be
|
|
37
|
-
// able to restore them when border width changes from zero value.
|
|
38
34
|
const [ styleSelection, setStyleSelection ] = useState();
|
|
39
35
|
const [ colorSelection, setColorSelection ] = useState();
|
|
40
|
-
|
|
36
|
+
|
|
37
|
+
// Temporarily track previous border color & style selections to be able to
|
|
38
|
+
// restore them when border width changes from zero value.
|
|
39
|
+
useEffect( () => {
|
|
40
|
+
if ( borderStyle !== 'none' ) {
|
|
41
|
+
setStyleSelection( borderStyle );
|
|
42
|
+
}
|
|
43
|
+
}, [ borderStyle ] );
|
|
44
|
+
|
|
45
|
+
useEffect( () => {
|
|
46
|
+
if ( borderColor || customBorderColor ) {
|
|
47
|
+
setColorSelection( {
|
|
48
|
+
name: !! borderColor ? borderColor : undefined,
|
|
49
|
+
color: !! customBorderColor ? customBorderColor : undefined,
|
|
50
|
+
} );
|
|
51
|
+
}
|
|
52
|
+
}, [ borderColor, customBorderColor ] );
|
|
41
53
|
|
|
42
54
|
const onChange = ( newWidth ) => {
|
|
43
55
|
let newStyle = {
|
|
@@ -52,39 +64,28 @@ export const BorderWidthEdit = ( props ) => {
|
|
|
52
64
|
let borderPaletteColor = borderColor;
|
|
53
65
|
|
|
54
66
|
const hasZeroWidth = parseFloat( newWidth ) === 0;
|
|
55
|
-
const hadPreviousZeroWidth = parseFloat( width ) === 0;
|
|
56
67
|
|
|
57
68
|
// Setting the border width explicitly to zero will also set the
|
|
58
69
|
// border style to `none` and clear border color attributes.
|
|
59
|
-
if ( hasZeroWidth
|
|
60
|
-
// Before clearing color and style selections, keep track of
|
|
61
|
-
// the current selections so they can be restored when the width
|
|
62
|
-
// changes to a non-zero value.
|
|
63
|
-
setColorSelection( borderColor );
|
|
64
|
-
setCustomColorSelection( customBorderColor );
|
|
65
|
-
setStyleSelection( borderStyle );
|
|
66
|
-
|
|
67
|
-
// Clear style and color attributes.
|
|
70
|
+
if ( hasZeroWidth ) {
|
|
68
71
|
borderPaletteColor = undefined;
|
|
69
72
|
newStyle.border.color = undefined;
|
|
70
73
|
newStyle.border.style = 'none';
|
|
71
74
|
}
|
|
72
75
|
|
|
73
|
-
if
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
newStyle.border.color = customColorSelection;
|
|
87
|
-
}
|
|
76
|
+
// Restore previous border style selection if width is now not zero and
|
|
77
|
+
// border style was 'none'. This is to support changes to the UI which
|
|
78
|
+
// change the border style UI to a segmented control without a "none"
|
|
79
|
+
// option.
|
|
80
|
+
if ( ! hasZeroWidth && borderStyle === 'none' ) {
|
|
81
|
+
newStyle.border.style = styleSelection;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// Restore previous border color selection if width is no longer zero
|
|
85
|
+
// and current border color is undefined.
|
|
86
|
+
if ( ! hasZeroWidth && borderColor === undefined ) {
|
|
87
|
+
borderPaletteColor = colorSelection?.name;
|
|
88
|
+
newStyle.border.color = colorSelection?.color;
|
|
88
89
|
}
|
|
89
90
|
|
|
90
91
|
// If width was reset, clean out undefined styles.
|
|
@@ -112,28 +113,3 @@ export const BorderWidthEdit = ( props ) => {
|
|
|
112
113
|
/>
|
|
113
114
|
);
|
|
114
115
|
};
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* Checks if there is a current value in the border width block support
|
|
118
|
-
* attributes.
|
|
119
|
-
*
|
|
120
|
-
* @param {Object} props Block props.
|
|
121
|
-
* @return {boolean} Whether or not the block has a border width value set.
|
|
122
|
-
*/
|
|
123
|
-
export function hasBorderWidthValue( props ) {
|
|
124
|
-
return !! props.attributes.style?.border?.width;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* Resets the border width block support attribute. This can be used when
|
|
129
|
-
* disabling the border width support control for a block via a progressive
|
|
130
|
-
* discovery panel.
|
|
131
|
-
*
|
|
132
|
-
* @param {Object} props Block props.
|
|
133
|
-
* @param {Object} props.attributes Block's attributes.
|
|
134
|
-
* @param {Object} props.setAttributes Function to set block's attributes.
|
|
135
|
-
*/
|
|
136
|
-
export function resetBorderWidth( { attributes = {}, setAttributes } ) {
|
|
137
|
-
const { style } = attributes;
|
|
138
|
-
setAttributes( { style: removeBorderAttribute( style, 'width' ) } );
|
|
139
|
-
}
|
package/src/hooks/border.js
CHANGED
|
@@ -2,41 +2,23 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { getBlockSupport } from '@wordpress/blocks';
|
|
5
|
-
import {
|
|
5
|
+
import { PanelBody } from '@wordpress/components';
|
|
6
6
|
import { Platform } from '@wordpress/element';
|
|
7
7
|
import { __ } from '@wordpress/i18n';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Internal dependencies
|
|
11
11
|
*/
|
|
12
|
-
import {
|
|
13
|
-
BorderColorEdit,
|
|
14
|
-
hasBorderColorValue,
|
|
15
|
-
resetBorderColor,
|
|
16
|
-
} from './border-color';
|
|
17
|
-
import {
|
|
18
|
-
BorderRadiusEdit,
|
|
19
|
-
hasBorderRadiusValue,
|
|
20
|
-
resetBorderRadius,
|
|
21
|
-
} from './border-radius';
|
|
22
|
-
import {
|
|
23
|
-
BorderStyleEdit,
|
|
24
|
-
hasBorderStyleValue,
|
|
25
|
-
resetBorderStyle,
|
|
26
|
-
} from './border-style';
|
|
27
|
-
import {
|
|
28
|
-
BorderWidthEdit,
|
|
29
|
-
hasBorderWidthValue,
|
|
30
|
-
resetBorderWidth,
|
|
31
|
-
} from './border-width';
|
|
32
12
|
import InspectorControls from '../components/inspector-controls';
|
|
33
13
|
import useSetting from '../components/use-setting';
|
|
34
|
-
import {
|
|
14
|
+
import { BorderColorEdit } from './border-color';
|
|
15
|
+
import { BorderRadiusEdit } from './border-radius';
|
|
16
|
+
import { BorderStyleEdit } from './border-style';
|
|
17
|
+
import { BorderWidthEdit } from './border-width';
|
|
35
18
|
|
|
36
19
|
export const BORDER_SUPPORT_KEY = '__experimentalBorder';
|
|
37
20
|
|
|
38
21
|
export function BorderPanel( props ) {
|
|
39
|
-
const { clientId } = props;
|
|
40
22
|
const isDisabled = useIsBorderDisabled( props );
|
|
41
23
|
const isSupported = hasBorderSupport( props.name );
|
|
42
24
|
|
|
@@ -57,80 +39,22 @@ export function BorderPanel( props ) {
|
|
|
57
39
|
return null;
|
|
58
40
|
}
|
|
59
41
|
|
|
60
|
-
const defaultBorderControls = getBlockSupport( props.name, [
|
|
61
|
-
BORDER_SUPPORT_KEY,
|
|
62
|
-
'__experimentalDefaultControls',
|
|
63
|
-
] );
|
|
64
|
-
|
|
65
|
-
const createResetAllFilter = (
|
|
66
|
-
borderAttribute,
|
|
67
|
-
topLevelAttributes = {}
|
|
68
|
-
) => ( newAttributes ) => ( {
|
|
69
|
-
...newAttributes,
|
|
70
|
-
...topLevelAttributes,
|
|
71
|
-
style: {
|
|
72
|
-
...newAttributes.style,
|
|
73
|
-
border: {
|
|
74
|
-
...newAttributes.style?.border,
|
|
75
|
-
[ borderAttribute ]: undefined,
|
|
76
|
-
},
|
|
77
|
-
},
|
|
78
|
-
} );
|
|
79
|
-
|
|
80
42
|
return (
|
|
81
|
-
<InspectorControls
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
<ToolsPanelItem
|
|
97
|
-
className="single-column"
|
|
98
|
-
hasValue={ () => hasBorderStyleValue( props ) }
|
|
99
|
-
label={ __( 'Style' ) }
|
|
100
|
-
onDeselect={ () => resetBorderStyle( props ) }
|
|
101
|
-
isShownByDefault={ defaultBorderControls?.style }
|
|
102
|
-
resetAllFilter={ createResetAllFilter( 'style' ) }
|
|
103
|
-
panelId={ clientId }
|
|
104
|
-
>
|
|
105
|
-
<BorderStyleEdit { ...props } />
|
|
106
|
-
</ToolsPanelItem>
|
|
107
|
-
) }
|
|
108
|
-
{ isColorSupported && (
|
|
109
|
-
<ToolsPanelItem
|
|
110
|
-
hasValue={ () => hasBorderColorValue( props ) }
|
|
111
|
-
label={ __( 'Color' ) }
|
|
112
|
-
onDeselect={ () => resetBorderColor( props ) }
|
|
113
|
-
isShownByDefault={ defaultBorderControls?.color }
|
|
114
|
-
resetAllFilter={ createResetAllFilter( 'color', {
|
|
115
|
-
borderColor: undefined,
|
|
116
|
-
} ) }
|
|
117
|
-
panelId={ clientId }
|
|
118
|
-
>
|
|
119
|
-
<BorderColorEdit { ...props } />
|
|
120
|
-
</ToolsPanelItem>
|
|
121
|
-
) }
|
|
122
|
-
{ isRadiusSupported && (
|
|
123
|
-
<ToolsPanelItem
|
|
124
|
-
hasValue={ () => hasBorderRadiusValue( props ) }
|
|
125
|
-
label={ __( 'Radius' ) }
|
|
126
|
-
onDeselect={ () => resetBorderRadius( props ) }
|
|
127
|
-
isShownByDefault={ defaultBorderControls?.radius }
|
|
128
|
-
resetAllFilter={ createResetAllFilter( 'radius' ) }
|
|
129
|
-
panelId={ clientId }
|
|
130
|
-
>
|
|
131
|
-
<BorderRadiusEdit { ...props } />
|
|
132
|
-
</ToolsPanelItem>
|
|
133
|
-
) }
|
|
43
|
+
<InspectorControls>
|
|
44
|
+
<PanelBody
|
|
45
|
+
className="block-editor-hooks__border-controls"
|
|
46
|
+
title={ __( 'Border' ) }
|
|
47
|
+
initialOpen={ false }
|
|
48
|
+
>
|
|
49
|
+
{ ( isWidthSupported || isStyleSupported ) && (
|
|
50
|
+
<div className="block-editor-hooks__border-controls-row">
|
|
51
|
+
{ isWidthSupported && <BorderWidthEdit { ...props } /> }
|
|
52
|
+
{ isStyleSupported && <BorderStyleEdit { ...props } /> }
|
|
53
|
+
</div>
|
|
54
|
+
) }
|
|
55
|
+
{ isColorSupported && <BorderColorEdit { ...props } /> }
|
|
56
|
+
{ isRadiusSupported && <BorderRadiusEdit { ...props } /> }
|
|
57
|
+
</PanelBody>
|
|
134
58
|
</InspectorControls>
|
|
135
59
|
);
|
|
136
60
|
}
|
|
@@ -194,22 +118,3 @@ const useIsBorderDisabled = () => {
|
|
|
194
118
|
|
|
195
119
|
return configs.every( Boolean );
|
|
196
120
|
};
|
|
197
|
-
|
|
198
|
-
/**
|
|
199
|
-
* Returns a new style object where the specified border attribute has been
|
|
200
|
-
* removed.
|
|
201
|
-
*
|
|
202
|
-
* @param {Object} style Styles from block attributes.
|
|
203
|
-
* @param {string} attribute The border style attribute to clear.
|
|
204
|
-
*
|
|
205
|
-
* @return {Object} Style object with the specified attribute removed.
|
|
206
|
-
*/
|
|
207
|
-
export function removeBorderAttribute( style, attribute ) {
|
|
208
|
-
return cleanEmptyObject( {
|
|
209
|
-
...style,
|
|
210
|
-
border: {
|
|
211
|
-
...style?.border,
|
|
212
|
-
[ attribute ]: undefined,
|
|
213
|
-
},
|
|
214
|
-
} );
|
|
215
|
-
}
|
package/src/hooks/border.scss
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
|
-
.
|
|
2
|
-
.
|
|
3
|
-
|
|
1
|
+
.block-editor-hooks__border-controls {
|
|
2
|
+
.block-editor-hooks__border-controls-row {
|
|
3
|
+
display: flex;
|
|
4
|
+
justify-content: space-between;
|
|
5
|
+
|
|
6
|
+
> * {
|
|
7
|
+
width: calc(50% - #{ $grid-unit-10 });
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.components-unit-control-wrapper {
|
|
12
|
+
margin-bottom: $grid-unit-30;
|
|
13
|
+
|
|
14
|
+
&:last-child {
|
|
15
|
+
margin-bottom: $grid-unit-10;
|
|
16
|
+
}
|
|
4
17
|
}
|
|
5
18
|
}
|
|
19
|
+
|
package/src/hooks/typography.js
CHANGED
|
@@ -218,7 +218,7 @@ export function TypographyPanel( props ) {
|
|
|
218
218
|
<ToolsPanelItem
|
|
219
219
|
className="single-column"
|
|
220
220
|
hasValue={ () => hasLetterSpacingValue( props ) }
|
|
221
|
-
label={ __( 'Letter
|
|
221
|
+
label={ __( 'Letter-spacing' ) }
|
|
222
222
|
onDeselect={ () => resetLetterSpacing( props ) }
|
|
223
223
|
isShownByDefault={ defaultControls?.letterSpacing }
|
|
224
224
|
resetAllFilter={ createResetAllFilter( 'letterSpacing' ) }
|