@wordpress/block-editor 11.6.0 → 11.8.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 +6 -0
- package/README.md +46 -55
- package/build/components/block-list/block-html.js +1 -3
- package/build/components/block-list/block-html.js.map +1 -1
- package/build/components/block-list/block.native.js +4 -3
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-list/index.native.js +11 -21
- package/build/components/block-list/index.native.js.map +1 -1
- package/build/components/block-list/use-in-between-inserter.js +3 -1
- package/build/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build/components/block-popover/inbetween.js +2 -9
- package/build/components/block-popover/inbetween.js.map +1 -1
- package/build/components/block-preview/auto.js +6 -23
- package/build/components/block-preview/auto.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +1 -10
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/caption/index.native.js +0 -1
- package/build/components/caption/index.native.js.map +1 -1
- package/build/components/date-format-picker/index.js +1 -1
- package/build/components/date-format-picker/index.js.map +1 -1
- package/build/components/editor-styles/index.js +20 -2
- package/build/components/editor-styles/index.js.map +1 -1
- package/build/components/global-styles/border-panel.js +15 -29
- package/build/components/global-styles/border-panel.js.map +1 -1
- package/build/components/global-styles/color-panel.js +583 -0
- package/build/components/global-styles/color-panel.js.map +1 -0
- package/build/components/global-styles/dimensions-panel.js +23 -44
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/effects-panel.js +244 -0
- package/build/components/global-styles/effects-panel.js.map +1 -0
- package/build/components/global-styles/filters-panel.js +151 -0
- package/build/components/global-styles/filters-panel.js.map +1 -0
- package/build/components/global-styles/get-block-css-selector.js +118 -0
- package/build/components/global-styles/get-block-css-selector.js.map +1 -0
- package/build/components/global-styles/hooks.js +60 -1
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/index.js +46 -2
- package/build/components/global-styles/index.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +9 -35
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +173 -91
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js +2 -1
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/iframe/index.js +1 -1
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/image-size-control/index.js +8 -5
- package/build/components/image-size-control/index.js.map +1 -1
- package/build/components/image-size-control/use-dimension-handler.js +5 -3
- package/build/components/image-size-control/use-dimension-handler.js.map +1 -1
- package/build/components/index.js +16 -0
- package/build/components/index.js.map +1 -1
- package/build/components/inserter/block-patterns-tab.js +4 -2
- package/build/components/inserter/block-patterns-tab.js.map +1 -1
- package/build/components/inspector-controls-tabs/position-controls-panel.js +43 -7
- package/build/components/inspector-controls-tabs/position-controls-panel.js.map +1 -1
- package/build/components/inspector-controls-tabs/utils.js +5 -3
- package/build/components/inspector-controls-tabs/utils.js.map +1 -1
- package/build/components/line-height-control/index.js +15 -1
- package/build/components/line-height-control/index.js.map +1 -1
- package/build/components/list-view/appender.js +105 -0
- package/build/components/list-view/appender.js.map +1 -0
- package/build/components/list-view/block.js +6 -5
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/branch.js +25 -5
- package/build/components/list-view/branch.js.map +1 -1
- package/build/components/list-view/index.js +56 -14
- package/build/components/list-view/index.js.map +1 -1
- package/build/components/list-view/use-list-view-client-ids.js +7 -3
- package/build/components/list-view/use-list-view-client-ids.js.map +1 -1
- package/build/components/list-view/use-list-view-drop-zone.js +8 -2
- package/build/components/list-view/use-list-view-drop-zone.js.map +1 -1
- package/build/components/media-replace-flow/index.js +13 -4
- package/build/components/media-replace-flow/index.js.map +1 -1
- package/build/components/off-canvas-editor/block-contents.js +6 -1
- package/build/components/off-canvas-editor/block-contents.js.map +1 -1
- package/build/components/off-canvas-editor/index.js +17 -14
- package/build/components/off-canvas-editor/index.js.map +1 -1
- package/build/components/resizable-box-popover/index.js +38 -0
- package/build/components/resizable-box-popover/index.js.map +1 -0
- package/build/components/rich-text/format-edit.js +2 -30
- package/build/components/rich-text/format-edit.js.map +1 -1
- package/build/components/rich-text/index.js +0 -1
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/index.native.js +7 -11
- package/build/components/rich-text/index.native.js.map +1 -1
- package/build/components/spacing-sizes-control/spacing-input-control.js +8 -0
- package/build/components/spacing-sizes-control/spacing-input-control.js.map +1 -1
- package/build/components/writing-flow/use-input.js +4 -8
- package/build/components/writing-flow/use-input.js.map +1 -1
- package/build/hooks/anchor.js +1 -1
- package/build/hooks/anchor.js.map +1 -1
- package/build/hooks/border.js +1 -2
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/color.js +92 -229
- package/build/hooks/color.js.map +1 -1
- package/build/hooks/content-lock-ui.js +4 -2
- package/build/hooks/content-lock-ui.js.map +1 -1
- package/build/hooks/{color-panel.js → contrast-checker.js} +11 -49
- package/build/hooks/contrast-checker.js.map +1 -0
- package/build/hooks/dimensions.js +0 -1
- package/build/hooks/dimensions.js.map +1 -1
- package/build/hooks/duotone.js +92 -64
- package/build/hooks/duotone.js.map +1 -1
- package/build/hooks/margin.js +27 -17
- package/build/hooks/margin.js.map +1 -1
- package/build/hooks/padding.js +19 -9
- package/build/hooks/padding.js.map +1 -1
- package/build/hooks/position.js +2 -2
- package/build/hooks/position.js.map +1 -1
- package/build/hooks/style.js +23 -26
- package/build/hooks/style.js.map +1 -1
- package/build/hooks/typography.js +0 -1
- package/build/hooks/typography.js.map +1 -1
- package/build/hooks/utils.js +28 -76
- package/build/hooks/utils.js.map +1 -1
- package/build/layouts/grid.js +165 -0
- package/build/layouts/grid.js.map +1 -0
- package/build/layouts/index.js +3 -1
- package/build/layouts/index.js.map +1 -1
- package/build/layouts/utils.js +3 -2
- package/build/layouts/utils.js.map +1 -1
- package/build/private-apis.js +7 -1
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +1 -1
- package/build/store/actions.js.map +1 -1
- package/build/utils/object.js +76 -0
- package/build/utils/object.js.map +1 -0
- package/build-module/components/block-list/block-html.js +1 -3
- package/build-module/components/block-list/block-html.js.map +1 -1
- package/build-module/components/block-list/block.native.js +4 -3
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-list/index.native.js +11 -19
- package/build-module/components/block-list/index.native.js.map +1 -1
- package/build-module/components/block-list/use-in-between-inserter.js +2 -1
- package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build-module/components/block-popover/inbetween.js +2 -9
- package/build-module/components/block-popover/inbetween.js.map +1 -1
- package/build-module/components/block-preview/auto.js +6 -22
- package/build-module/components/block-preview/auto.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +1 -9
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/caption/index.native.js +0 -1
- package/build-module/components/caption/index.native.js.map +1 -1
- package/build-module/components/date-format-picker/index.js +1 -1
- package/build-module/components/date-format-picker/index.js.map +1 -1
- package/build-module/components/editor-styles/index.js +19 -2
- package/build-module/components/editor-styles/index.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +15 -29
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/color-panel.js +554 -0
- package/build-module/components/global-styles/color-panel.js.map +1 -0
- package/build-module/components/global-styles/dimensions-panel.js +22 -44
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/effects-panel.js +228 -0
- package/build-module/components/global-styles/effects-panel.js.map +1 -0
- package/build-module/components/global-styles/filters-panel.js +139 -0
- package/build-module/components/global-styles/filters-panel.js.map +1 -0
- package/build-module/components/global-styles/get-block-css-selector.js +109 -0
- package/build-module/components/global-styles/get-block-css-selector.js.map +1 -0
- package/build-module/components/global-styles/hooks.js +58 -1
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/index.js +5 -1
- package/build-module/components/global-styles/index.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +8 -35
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +175 -93
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js +2 -1
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/iframe/index.js +1 -1
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/image-size-control/index.js +8 -5
- package/build-module/components/image-size-control/index.js.map +1 -1
- package/build-module/components/image-size-control/use-dimension-handler.js +5 -3
- package/build-module/components/image-size-control/use-dimension-handler.js.map +1 -1
- package/build-module/components/index.js +1 -0
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab.js +5 -2
- package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/position-controls-panel.js +42 -7
- package/build-module/components/inspector-controls-tabs/position-controls-panel.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/utils.js +4 -3
- package/build-module/components/inspector-controls-tabs/utils.js.map +1 -1
- package/build-module/components/line-height-control/index.js +15 -1
- package/build-module/components/line-height-control/index.js.map +1 -1
- package/build-module/components/list-view/appender.js +88 -0
- package/build-module/components/list-view/appender.js.map +1 -0
- package/build-module/components/list-view/block.js +6 -4
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/branch.js +22 -5
- package/build-module/components/list-view/branch.js.map +1 -1
- package/build-module/components/list-view/index.js +50 -13
- package/build-module/components/list-view/index.js.map +1 -1
- package/build-module/components/list-view/use-list-view-client-ids.js +7 -3
- package/build-module/components/list-view/use-list-view-client-ids.js.map +1 -1
- package/build-module/components/list-view/use-list-view-drop-zone.js +8 -4
- package/build-module/components/list-view/use-list-view-drop-zone.js.map +1 -1
- package/build-module/components/media-replace-flow/index.js +12 -4
- package/build-module/components/media-replace-flow/index.js.map +1 -1
- package/build-module/components/off-canvas-editor/block-contents.js +5 -1
- package/build-module/components/off-canvas-editor/block-contents.js.map +1 -1
- package/build-module/components/off-canvas-editor/index.js +17 -14
- package/build-module/components/off-canvas-editor/index.js.map +1 -1
- package/build-module/components/resizable-box-popover/index.js +26 -0
- package/build-module/components/resizable-box-popover/index.js.map +1 -0
- package/build-module/components/rich-text/format-edit.js +3 -31
- package/build-module/components/rich-text/format-edit.js.map +1 -1
- package/build-module/components/rich-text/index.js +0 -1
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/index.native.js +7 -10
- package/build-module/components/rich-text/index.native.js.map +1 -1
- package/build-module/components/spacing-sizes-control/spacing-input-control.js +7 -0
- package/build-module/components/spacing-sizes-control/spacing-input-control.js.map +1 -1
- package/build-module/components/writing-flow/use-input.js +4 -8
- package/build-module/components/writing-flow/use-input.js.map +1 -1
- package/build-module/hooks/anchor.js +1 -1
- package/build-module/hooks/anchor.js.map +1 -1
- package/build-module/hooks/border.js +1 -2
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/color.js +90 -232
- package/build-module/hooks/color.js.map +1 -1
- package/build-module/hooks/content-lock-ui.js +4 -2
- package/build-module/hooks/content-lock-ui.js.map +1 -1
- package/build-module/hooks/{color-panel.js → contrast-checker.js} +10 -44
- package/build-module/hooks/contrast-checker.js.map +1 -0
- package/build-module/hooks/dimensions.js +0 -1
- package/build-module/hooks/dimensions.js.map +1 -1
- package/build-module/hooks/duotone.js +91 -65
- package/build-module/hooks/duotone.js.map +1 -1
- package/build-module/hooks/margin.js +29 -18
- package/build-module/hooks/margin.js.map +1 -1
- package/build-module/hooks/padding.js +21 -10
- package/build-module/hooks/padding.js.map +1 -1
- package/build-module/hooks/position.js +3 -3
- package/build-module/hooks/position.js.map +1 -1
- package/build-module/hooks/style.js +23 -26
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/hooks/typography.js +0 -1
- package/build-module/hooks/typography.js.map +1 -1
- package/build-module/hooks/utils.js +27 -74
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/layouts/grid.js +151 -0
- package/build-module/layouts/grid.js.map +1 -0
- package/build-module/layouts/index.js +2 -1
- package/build-module/layouts/index.js.map +1 -1
- package/build-module/layouts/utils.js +3 -2
- package/build-module/layouts/utils.js.map +1 -1
- package/build-module/private-apis.js +5 -1
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/actions.js +1 -1
- package/build-module/store/actions.js.map +1 -1
- package/build-module/utils/object.js +69 -0
- package/build-module/utils/object.js.map +1 -0
- package/build-style/style-rtl.css +77 -16
- package/build-style/style.css +77 -16
- package/package.json +31 -31
- package/src/components/block-draggable/content.scss +1 -1
- package/src/components/block-inspector/style.scss +6 -4
- package/src/components/block-list/block-html.js +1 -1
- package/src/components/block-list/block.native.js +3 -2
- package/src/components/block-list/index.native.js +19 -38
- package/src/components/block-list/use-in-between-inserter.js +4 -1
- package/src/components/block-popover/inbetween.js +2 -13
- package/src/components/block-preview/auto.js +2 -17
- package/src/components/block-settings-menu/block-settings-dropdown.js +2 -12
- package/src/components/caption/index.native.js +0 -1
- package/src/components/colors-gradients/style.scss +8 -8
- package/src/components/date-format-picker/index.js +1 -1
- package/src/components/editor-styles/index.js +29 -1
- package/src/components/global-styles/README.md +129 -16
- package/src/components/global-styles/border-panel.js +13 -32
- package/src/components/global-styles/color-panel.js +706 -0
- package/src/components/global-styles/dimensions-panel.js +43 -55
- package/src/components/global-styles/effects-panel.js +228 -0
- package/src/components/global-styles/filters-panel.js +157 -0
- package/src/components/global-styles/get-block-css-selector.js +118 -0
- package/src/components/global-styles/hooks.js +90 -0
- package/src/components/global-styles/index.js +4 -1
- package/src/components/global-styles/style.scss +42 -0
- package/src/components/global-styles/test/use-global-styles-output.js +34 -5
- package/src/components/global-styles/typography-panel.js +26 -51
- package/src/components/global-styles/use-global-styles-output.js +188 -89
- package/src/components/global-styles/utils.js +3 -0
- package/src/components/iframe/index.js +1 -1
- package/src/components/image-size-control/index.js +4 -3
- package/src/components/image-size-control/test/index.js +2 -2
- package/src/components/image-size-control/use-dimension-handler.js +4 -3
- package/src/components/index.js +4 -1
- package/src/components/inner-blocks/README.md +1 -1
- package/src/components/inserter/block-patterns-tab.js +3 -1
- package/src/components/inspector-controls-tabs/position-controls-panel.js +40 -9
- package/src/components/inspector-controls-tabs/utils.js +4 -3
- package/src/components/line-height-control/index.js +10 -1
- package/src/components/list-view/README.md +2 -0
- package/src/components/list-view/appender.js +101 -0
- package/src/components/list-view/block.js +6 -4
- package/src/components/list-view/branch.js +30 -1
- package/src/components/list-view/index.js +60 -11
- package/src/components/list-view/style.scss +22 -1
- package/src/components/list-view/test/use-list-view-drop-zone.js +188 -0
- package/src/components/list-view/use-list-view-client-ids.js +5 -3
- package/src/components/list-view/use-list-view-drop-zone.js +9 -3
- package/src/components/media-replace-flow/index.js +36 -24
- package/src/components/media-replace-flow/style.scss +5 -2
- package/src/components/off-canvas-editor/block-contents.js +4 -0
- package/src/components/off-canvas-editor/index.js +15 -11
- package/src/components/resizable-box-popover/index.js +27 -0
- package/src/components/rich-text/format-edit.js +2 -32
- package/src/components/rich-text/index.js +0 -1
- package/src/components/rich-text/index.native.js +2 -5
- package/src/components/spacing-sizes-control/spacing-input-control.js +10 -0
- package/src/components/spacing-sizes-control/style.scss +7 -7
- package/src/components/writing-flow/use-input.js +4 -5
- package/src/hooks/anchor.js +1 -1
- package/src/hooks/border.js +1 -2
- package/src/hooks/color.js +120 -296
- package/src/hooks/content-lock-ui.js +6 -2
- package/src/hooks/{color-panel.js → contrast-checker.js} +10 -46
- package/src/hooks/dimensions.js +0 -1
- package/src/hooks/duotone.js +121 -76
- package/src/hooks/margin.js +31 -26
- package/src/hooks/padding.js +24 -18
- package/src/hooks/position.js +3 -3
- package/src/hooks/style.js +29 -28
- package/src/hooks/test/utils.js +0 -104
- package/src/hooks/typography.js +0 -1
- package/src/hooks/utils.js +31 -74
- package/src/layouts/grid.js +172 -0
- package/src/layouts/index.js +2 -1
- package/src/layouts/test/grid.js +21 -0
- package/src/layouts/utils.js +2 -2
- package/src/private-apis.js +4 -0
- package/src/store/actions.js +1 -1
- package/src/style.scss +1 -0
- package/src/utils/object.js +69 -0
- package/src/utils/test/object.js +145 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/build/components/rich-text/use-native-props.js +0 -11
- package/build/components/rich-text/use-native-props.js.map +0 -1
- package/build/components/rich-text/use-native-props.native.js +0 -24
- package/build/components/rich-text/use-native-props.native.js.map +0 -1
- package/build/hooks/color-panel.js.map +0 -1
- package/build-module/components/rich-text/use-native-props.js +0 -4
- package/build-module/components/rich-text/use-native-props.js.map +0 -1
- package/build-module/components/rich-text/use-native-props.native.js +0 -15
- package/build-module/components/rich-text/use-native-props.native.js.map +0 -1
- package/build-module/hooks/color-panel.js.map +0 -1
- package/src/components/rich-text/use-native-props.js +0 -3
- package/src/components/rich-text/use-native-props.native.js +0 -17
|
@@ -12,7 +12,6 @@ import { Disabled } from '@wordpress/components';
|
|
|
12
12
|
import BlockList from '../block-list';
|
|
13
13
|
import Iframe from '../iframe';
|
|
14
14
|
import EditorStyles from '../editor-styles';
|
|
15
|
-
import { __unstablePresetDuotoneFilter as PresetDuotoneFilter } from '../../components/duotone';
|
|
16
15
|
import { store } from '../../store';
|
|
17
16
|
|
|
18
17
|
// This is used to avoid rendering the block list if the sizes change.
|
|
@@ -32,11 +31,10 @@ function ScaledBlockPreview( {
|
|
|
32
31
|
|
|
33
32
|
const [ contentResizeListener, { height: contentHeight } ] =
|
|
34
33
|
useResizeObserver();
|
|
35
|
-
const { styles
|
|
34
|
+
const { styles } = useSelect( ( select ) => {
|
|
36
35
|
const settings = select( store ).getSettings();
|
|
37
36
|
return {
|
|
38
37
|
styles: settings.styles,
|
|
39
|
-
duotone: settings.__experimentalFeatures?.color?.duotone,
|
|
40
38
|
};
|
|
41
39
|
}, [] );
|
|
42
40
|
|
|
@@ -56,10 +54,6 @@ function ScaledBlockPreview( {
|
|
|
56
54
|
return styles;
|
|
57
55
|
}, [ styles, additionalStyles ] );
|
|
58
56
|
|
|
59
|
-
const svgFilters = useMemo( () => {
|
|
60
|
-
return [ ...( duotone?.default ?? [] ), ...( duotone?.theme ?? [] ) ];
|
|
61
|
-
}, [ duotone ] );
|
|
62
|
-
|
|
63
57
|
// Initialize on render instead of module top level, to avoid circular dependency issues.
|
|
64
58
|
MemoizedBlockList = MemoizedBlockList || pure( BlockList );
|
|
65
59
|
|
|
@@ -76,7 +70,6 @@ function ScaledBlockPreview( {
|
|
|
76
70
|
} }
|
|
77
71
|
>
|
|
78
72
|
<Iframe
|
|
79
|
-
head={ <EditorStyles styles={ editorStyles } /> }
|
|
80
73
|
contentRef={ useRefEffect( ( bodyElement ) => {
|
|
81
74
|
const {
|
|
82
75
|
ownerDocument: { documentElement },
|
|
@@ -108,16 +101,8 @@ function ScaledBlockPreview( {
|
|
|
108
101
|
: minHeight,
|
|
109
102
|
} }
|
|
110
103
|
>
|
|
104
|
+
<EditorStyles styles={ editorStyles } />
|
|
111
105
|
{ contentResizeListener }
|
|
112
|
-
{
|
|
113
|
-
/* Filters need to be rendered before children to avoid Safari rendering issues. */
|
|
114
|
-
svgFilters.map( ( preset ) => (
|
|
115
|
-
<PresetDuotoneFilter
|
|
116
|
-
preset={ preset }
|
|
117
|
-
key={ preset.slug }
|
|
118
|
-
/>
|
|
119
|
-
) )
|
|
120
|
-
}
|
|
121
106
|
<MemoizedBlockList renderAppender={ false } />
|
|
122
107
|
</Iframe>
|
|
123
108
|
</Disabled>
|
|
@@ -29,7 +29,6 @@ import BlockHTMLConvertButton from './block-html-convert-button';
|
|
|
29
29
|
import __unstableBlockSettingsMenuFirstItem from './block-settings-menu-first-item';
|
|
30
30
|
import BlockSettingsMenuControls from '../block-settings-menu-controls';
|
|
31
31
|
import { store as blockEditorStore } from '../../store';
|
|
32
|
-
import useBlockDisplayTitle from '../block-title/use-block-display-title';
|
|
33
32
|
import { useShowMoversGestures } from '../block-toolbar/utils';
|
|
34
33
|
|
|
35
34
|
const noop = () => {};
|
|
@@ -138,11 +137,6 @@ export function BlockSettingsDropdown( {
|
|
|
138
137
|
[ __experimentalSelectBlock ]
|
|
139
138
|
);
|
|
140
139
|
|
|
141
|
-
const blockTitle = useBlockDisplayTitle( {
|
|
142
|
-
clientId: firstBlockClientId,
|
|
143
|
-
maximumLength: 25,
|
|
144
|
-
} );
|
|
145
|
-
|
|
146
140
|
const updateSelectionAfterRemove = useCallback(
|
|
147
141
|
__experimentalSelectBlock
|
|
148
142
|
? () => {
|
|
@@ -173,12 +167,8 @@ export function BlockSettingsDropdown( {
|
|
|
173
167
|
]
|
|
174
168
|
);
|
|
175
169
|
|
|
176
|
-
const
|
|
177
|
-
|
|
178
|
-
__( 'Remove %s' ),
|
|
179
|
-
blockTitle
|
|
180
|
-
);
|
|
181
|
-
const removeBlockLabel = count === 1 ? label : __( 'Remove blocks' );
|
|
170
|
+
const removeBlockLabel =
|
|
171
|
+
count === 1 ? __( 'Delete' ) : __( 'Delete blocks' );
|
|
182
172
|
|
|
183
173
|
// Allows highlighting the parent block outline when focusing or hovering
|
|
184
174
|
// the parent block selector within the child.
|
|
@@ -73,20 +73,20 @@ $swatch-gap: 12px;
|
|
|
73
73
|
max-width: 100%;
|
|
74
74
|
|
|
75
75
|
// Border styles.
|
|
76
|
-
border-left: 1px solid
|
|
77
|
-
border-right: 1px solid
|
|
78
|
-
border-bottom: 1px solid
|
|
76
|
+
border-left: 1px solid $gray-300;
|
|
77
|
+
border-right: 1px solid $gray-300;
|
|
78
|
+
border-bottom: 1px solid $gray-300;
|
|
79
79
|
|
|
80
80
|
&.first {
|
|
81
81
|
margin-top: $grid-unit-30;
|
|
82
|
-
border-top-left-radius:
|
|
83
|
-
border-top-right-radius:
|
|
84
|
-
border-top: 1px solid
|
|
82
|
+
border-top-left-radius: $radius-block-ui;
|
|
83
|
+
border-top-right-radius: $radius-block-ui;
|
|
84
|
+
border-top: 1px solid $gray-300;
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
&.last {
|
|
88
|
-
border-bottom-left-radius:
|
|
89
|
-
border-bottom-right-radius:
|
|
88
|
+
border-bottom-left-radius: $radius-block-ui;
|
|
89
|
+
border-bottom-right-radius: $radius-block-ui;
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
> div,
|
|
@@ -142,7 +142,7 @@ function NonDefaultControls( { format, onChange } ) {
|
|
|
142
142
|
Link: (
|
|
143
143
|
<ExternalLink
|
|
144
144
|
href={ __(
|
|
145
|
-
'https://wordpress.org/
|
|
145
|
+
'https://wordpress.org/documentation/article/customize-date-and-time-format/'
|
|
146
146
|
) }
|
|
147
147
|
/>
|
|
148
148
|
),
|
|
@@ -8,6 +8,7 @@ import a11yPlugin from 'colord/plugins/a11y';
|
|
|
8
8
|
/**
|
|
9
9
|
* WordPress dependencies
|
|
10
10
|
*/
|
|
11
|
+
import { SVG } from '@wordpress/components';
|
|
11
12
|
import { useCallback, useMemo } from '@wordpress/element';
|
|
12
13
|
|
|
13
14
|
/**
|
|
@@ -68,7 +69,20 @@ function useDarkThemeBodyClassName( styles ) {
|
|
|
68
69
|
|
|
69
70
|
export default function EditorStyles( { styles } ) {
|
|
70
71
|
const transformedStyles = useMemo(
|
|
71
|
-
() =>
|
|
72
|
+
() =>
|
|
73
|
+
transformStyles(
|
|
74
|
+
styles.filter( ( style ) => style?.css ),
|
|
75
|
+
EDITOR_STYLES_SELECTOR
|
|
76
|
+
),
|
|
77
|
+
[ styles ]
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
const transformedSvgs = useMemo(
|
|
81
|
+
() =>
|
|
82
|
+
styles
|
|
83
|
+
.filter( ( style ) => style.__unstableType === 'svgs' )
|
|
84
|
+
.map( ( style ) => style.assets )
|
|
85
|
+
.join( '' ),
|
|
72
86
|
[ styles ]
|
|
73
87
|
);
|
|
74
88
|
|
|
@@ -80,6 +94,20 @@ export default function EditorStyles( { styles } ) {
|
|
|
80
94
|
{ transformedStyles.map( ( css, index ) => (
|
|
81
95
|
<style key={ index }>{ css }</style>
|
|
82
96
|
) ) }
|
|
97
|
+
<SVG
|
|
98
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
99
|
+
viewBox="0 0 0 0"
|
|
100
|
+
width="0"
|
|
101
|
+
height="0"
|
|
102
|
+
role="none"
|
|
103
|
+
style={ {
|
|
104
|
+
visibility: 'hidden',
|
|
105
|
+
position: 'absolute',
|
|
106
|
+
left: '-9999px',
|
|
107
|
+
overflow: 'hidden',
|
|
108
|
+
} }
|
|
109
|
+
dangerouslySetInnerHTML={ { __html: transformedSvgs } }
|
|
110
|
+
/>
|
|
83
111
|
</>
|
|
84
112
|
);
|
|
85
113
|
}
|
|
@@ -14,9 +14,7 @@ import { useGlobalStylesReset } from '@wordpress/block-editor';
|
|
|
14
14
|
function MyComponent() {
|
|
15
15
|
const [ canReset, reset ] = useGlobalStylesReset();
|
|
16
16
|
|
|
17
|
-
return canReset
|
|
18
|
-
? <Button onClick={ () => reset() }>Reset</Button>
|
|
19
|
-
: null;
|
|
17
|
+
return canReset ? <Button onClick={ () => reset() }>Reset</Button> : null;
|
|
20
18
|
}
|
|
21
19
|
```
|
|
22
20
|
|
|
@@ -25,17 +23,25 @@ function MyComponent() {
|
|
|
25
23
|
A React hook used to retrieve the styles array and settings to provide for block editor instances based on the current global styles.
|
|
26
24
|
|
|
27
25
|
```js
|
|
28
|
-
import {
|
|
26
|
+
import {
|
|
27
|
+
useGlobalStylesOutput,
|
|
28
|
+
BlockEditorProvider,
|
|
29
|
+
BlockList,
|
|
30
|
+
} from '@wordpress/block-editor';
|
|
29
31
|
|
|
30
32
|
function MyComponent() {
|
|
31
33
|
const [ styles, settings ] = useGlobalStylesOutput();
|
|
32
34
|
|
|
33
|
-
return
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
return (
|
|
36
|
+
<BlockEditorProvider
|
|
37
|
+
settings={ {
|
|
38
|
+
styles,
|
|
39
|
+
__experimentalFeatures: settings,
|
|
40
|
+
} }
|
|
41
|
+
>
|
|
42
|
+
<BlockList />
|
|
43
|
+
</BlockEditorProvider>
|
|
44
|
+
);
|
|
39
45
|
}
|
|
40
46
|
```
|
|
41
47
|
|
|
@@ -48,12 +54,16 @@ import { useGlobalStyle } from '@wordpress/block-editor';
|
|
|
48
54
|
|
|
49
55
|
function MyComponent() {
|
|
50
56
|
// Text color for the site root.
|
|
51
|
-
const [ color, setColor ] = useGlobalStyle( 'color.text' );
|
|
57
|
+
const [ color, setColor ] = useGlobalStyle( 'color.text' );
|
|
52
58
|
|
|
53
59
|
// The user modified color for the core paragraph block.
|
|
54
|
-
const [ pColor, setPColor ] = useGlobalStyle(
|
|
60
|
+
const [ pColor, setPColor ] = useGlobalStyle(
|
|
61
|
+
'color.text',
|
|
62
|
+
'core/paragraph',
|
|
63
|
+
'user'
|
|
64
|
+
);
|
|
55
65
|
|
|
56
|
-
return
|
|
66
|
+
return 'Something';
|
|
57
67
|
}
|
|
58
68
|
```
|
|
59
69
|
|
|
@@ -66,12 +76,115 @@ import { useGlobalSetting } from '@wordpress/block-editor';
|
|
|
66
76
|
|
|
67
77
|
function MyComponent() {
|
|
68
78
|
// The theme color palette.
|
|
69
|
-
const [ colorPalette, setColorPalette ] = useGlobalSetting(
|
|
79
|
+
const [ colorPalette, setColorPalette ] = useGlobalSetting(
|
|
80
|
+
'color.palette.theme'
|
|
81
|
+
);
|
|
70
82
|
|
|
71
83
|
// The theme color palette for the paragraph block, ignoring user changes.
|
|
72
84
|
// If the palette is not defined for the paragraph block, the root one is returned.
|
|
73
|
-
const [ pColor, setPColor ] = useGlobalSetting(
|
|
85
|
+
const [ pColor, setPColor ] = useGlobalSetting(
|
|
86
|
+
'color.palette.theme',
|
|
87
|
+
'core/paragraph',
|
|
88
|
+
'base'
|
|
89
|
+
);
|
|
74
90
|
|
|
75
|
-
return
|
|
91
|
+
return 'Something';
|
|
76
92
|
}
|
|
77
93
|
```
|
|
94
|
+
|
|
95
|
+
## UI Components
|
|
96
|
+
|
|
97
|
+
The global styles folder also offers a set of reusable UI components. These components follow a strict set of guidelines:
|
|
98
|
+
|
|
99
|
+
- They are independent of any context or any store dependency. They only rely on the props passed to them.
|
|
100
|
+
- They receive a similar set of props:
|
|
101
|
+
|
|
102
|
+
- `value`: The value is a style object that maps closely the format used in `theme.json` and is also very close to the format of the `style` attributes for blocks. There are some differences with the block attributes due to the iteration process and the fact that we need to maintain compatibility with the existing blocks even if they predate the introduction of Global Styles and these UI components. An example value for a style object is:
|
|
103
|
+
|
|
104
|
+
```js
|
|
105
|
+
{
|
|
106
|
+
color: {
|
|
107
|
+
text: 'var:preset|color|blue',
|
|
108
|
+
background: '#FF0000',
|
|
109
|
+
},
|
|
110
|
+
typography: {
|
|
111
|
+
fontFamily: 'var:preset|font-family|base',
|
|
112
|
+
fontSize: '10px',
|
|
113
|
+
lineHeight: 1.5,
|
|
114
|
+
},
|
|
115
|
+
spacing: {
|
|
116
|
+
padding: 'var:preset|spacing|medium',
|
|
117
|
+
},
|
|
118
|
+
elements: {
|
|
119
|
+
link: {
|
|
120
|
+
color: {
|
|
121
|
+
text: 'var:preset|color|green',
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
}
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
- `onChange`: A callback that receives the new value and is called when the user changes the value of the UI component.
|
|
129
|
+
- `inheritedValue`: The inherited value is a style object that represents the combined value of the style inherited from the parent context in addition to the style applied to the current context. The format is the same as the `value` prop.
|
|
130
|
+
- `settings`: The settings are the theme.json settings. They are used to provide the UI components with the necessary information to render the UI. An example value for the settings is:
|
|
131
|
+
|
|
132
|
+
```js
|
|
133
|
+
{
|
|
134
|
+
color: {
|
|
135
|
+
palette: {
|
|
136
|
+
custom: [
|
|
137
|
+
{
|
|
138
|
+
slug: 'black',
|
|
139
|
+
color: '#000000',
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
slug: 'white',
|
|
143
|
+
color: '#FFFFFF',
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
slug: 'blue',
|
|
147
|
+
color: '#0000FF',
|
|
148
|
+
},
|
|
149
|
+
]
|
|
150
|
+
},
|
|
151
|
+
gradients: {
|
|
152
|
+
custom: [
|
|
153
|
+
{
|
|
154
|
+
slug: 'gradient-1',
|
|
155
|
+
gradient: 'linear-gradient(135deg,rgba(6,147,227,1) 0%,rgb(155,81,224) 100%)',
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
slug: 'gradient-2',
|
|
159
|
+
gradient: 'linear-gradient(135deg,rgba(6,147,227,1) 0%,rgb(155,81,224) 100%)',
|
|
160
|
+
},
|
|
161
|
+
]
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
typography: {
|
|
165
|
+
fontSizes: [
|
|
166
|
+
{
|
|
167
|
+
slug: 'small',
|
|
168
|
+
size: '12px',
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
slug: 'medium',
|
|
172
|
+
size: '16px',
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
slug: 'large',
|
|
176
|
+
size: '24px',
|
|
177
|
+
},
|
|
178
|
+
],
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
```
|
|
182
|
+
- `defaultControls`: The default controls are the controls that are used by default to render the UI. They are used to provide the UI components with the necessary information to render the UI. An example value for the default controls for the `ColorPanel` component is:
|
|
183
|
+
|
|
184
|
+
```js
|
|
185
|
+
{
|
|
186
|
+
background: true,
|
|
187
|
+
text: true,
|
|
188
|
+
link: true,
|
|
189
|
+
},
|
|
190
|
+
```
|
|
@@ -186,39 +186,20 @@ export default function BorderPanel( {
|
|
|
186
186
|
const onBorderChange = ( newBorder ) => {
|
|
187
187
|
// Ensure we have a visible border style when a border width or
|
|
188
188
|
// color is being selected.
|
|
189
|
-
const
|
|
189
|
+
const updatedBorder = applyAllFallbackStyles( newBorder );
|
|
190
190
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
? {
|
|
204
|
-
top: newBorderWithStyle,
|
|
205
|
-
right: newBorderWithStyle,
|
|
206
|
-
bottom: newBorderWithStyle,
|
|
207
|
-
left: newBorderWithStyle,
|
|
208
|
-
}
|
|
209
|
-
: {
|
|
210
|
-
color: null,
|
|
211
|
-
style: null,
|
|
212
|
-
width: null,
|
|
213
|
-
...newBorderWithStyle,
|
|
214
|
-
};
|
|
215
|
-
|
|
216
|
-
[ 'top', 'right', 'bottom', 'left' ].forEach( ( side ) => {
|
|
217
|
-
updatedBorder[ side ] = {
|
|
218
|
-
...updatedBorder[ side ],
|
|
219
|
-
color: encodeColorValue( updatedBorder[ side ]?.color ),
|
|
220
|
-
};
|
|
221
|
-
} );
|
|
191
|
+
if ( hasSplitBorders( updatedBorder ) ) {
|
|
192
|
+
[ 'top', 'right', 'bottom', 'left' ].forEach( ( side ) => {
|
|
193
|
+
if ( updatedBorder[ side ] ) {
|
|
194
|
+
updatedBorder[ side ] = {
|
|
195
|
+
...updatedBorder[ side ],
|
|
196
|
+
color: encodeColorValue( updatedBorder[ side ]?.color ),
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
} );
|
|
200
|
+
} else if ( updatedBorder ) {
|
|
201
|
+
updatedBorder.color = encodeColorValue( updatedBorder.color );
|
|
202
|
+
}
|
|
222
203
|
|
|
223
204
|
// As radius is maintained separately to color, style, and width
|
|
224
205
|
// maintain its value. Undefined values here will be cleaned when
|