@wordpress/block-editor 11.7.0 → 12.0.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 +8 -0
- package/README.md +56 -57
- package/build/components/block-info-slot-fill/index.js +47 -0
- package/build/components/block-info-slot-fill/index.js.map +1 -0
- package/build/components/block-inspector/index.js +4 -2
- package/build/components/block-inspector/index.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-settings-menu/block-settings-dropdown.js +1 -10
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-toolbar/index.js +2 -1
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-tools/block-contextual-toolbar.js +83 -9
- package/build/components/block-tools/block-contextual-toolbar.js.map +1 -1
- package/build/components/block-tools/selected-block-popover.js +11 -28
- package/build/components/block-tools/selected-block-popover.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 +4 -3
- package/build/components/editor-styles/index.js.map +1 -1
- package/build/components/font-sizes/fluid-utils.js +21 -14
- package/build/components/font-sizes/fluid-utils.js.map +1 -1
- package/build/components/global-styles/border-panel.js +15 -59
- package/build/components/global-styles/border-panel.js.map +1 -1
- package/build/components/global-styles/color-panel.js +12 -12
- package/build/components/global-styles/color-panel.js.map +1 -1
- package/build/components/global-styles/color-panel.native.js +174 -0
- package/build/components/global-styles/color-panel.native.js.map +1 -0
- package/build/components/global-styles/dimensions-panel.js +21 -20
- 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 +215 -0
- package/build/components/global-styles/filters-panel.js.map +1 -0
- package/build/components/global-styles/get-block-css-selector.js +1 -12
- package/build/components/global-styles/get-block-css-selector.js.map +1 -1
- package/build/components/global-styles/hooks.js +7 -0
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/index.js +28 -0
- package/build/components/global-styles/index.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +9 -9
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +100 -82
- package/build/components/global-styles/use-global-styles-output.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/use-dimension-handler.js +5 -3
- package/build/components/image-size-control/use-dimension-handler.js.map +1 -1
- package/build/components/index.js +23 -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/inserter/block-types-tab.js +12 -7
- package/build/components/inserter/block-types-tab.js.map +1 -1
- package/build/components/inserter/index.js +2 -1
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/inspector-controls/groups.js +2 -0
- package/build/components/inspector-controls/groups.js.map +1 -1
- package/build/components/inspector-controls-tabs/styles-tab.js +2 -0
- package/build/components/inspector-controls-tabs/styles-tab.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/list-view/block-select-button.js +7 -2
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/list-view/block.js +13 -21
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/drop-indicator.js +37 -10
- package/build/components/list-view/drop-indicator.js.map +1 -1
- package/build/components/list-view/index.js +31 -7
- package/build/components/list-view/index.js.map +1 -1
- package/build/components/list-view/leaf.js +2 -1
- package/build/components/list-view/leaf.js.map +1 -1
- package/build/components/list-view/use-block-selection.js +1 -1
- package/build/components/list-view/use-block-selection.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 +5 -5
- package/build/components/media-replace-flow/index.js.map +1 -1
- package/build/components/navigable-toolbar/index.js +12 -4
- package/build/components/navigable-toolbar/index.js.map +1 -1
- package/build/components/off-canvas-editor/appender.js +2 -7
- package/build/components/off-canvas-editor/appender.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/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/hooks/anchor.js +1 -1
- package/build/hooks/anchor.js.map +1 -1
- package/build/hooks/border.js +1 -1
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/duotone.js +121 -70
- 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/utils.js +22 -7
- package/build/hooks/utils.js.map +1 -1
- package/build/layouts/utils.js +3 -2
- package/build/layouts/utils.js.map +1 -1
- package/build/private-apis.js +13 -1
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +8 -1
- package/build/store/actions.js.map +1 -1
- package/build/utils/object.js +6 -6
- package/build/utils/object.js.map +1 -1
- package/build/utils/transform-styles/index.js +2 -2
- package/build/utils/transform-styles/index.js.map +1 -1
- package/build/utils/use-should-contextual-toolbar-show.js +68 -0
- package/build/utils/use-should-contextual-toolbar-show.js.map +1 -0
- package/build-module/components/block-info-slot-fill/index.js +34 -0
- package/build-module/components/block-info-slot-fill/index.js.map +1 -0
- package/build-module/components/block-inspector/index.js +3 -2
- package/build-module/components/block-inspector/index.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-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/block-toolbar/index.js +2 -1
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-tools/block-contextual-toolbar.js +79 -9
- package/build-module/components/block-tools/block-contextual-toolbar.js.map +1 -1
- package/build-module/components/block-tools/selected-block-popover.js +10 -27
- package/build-module/components/block-tools/selected-block-popover.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 +4 -3
- package/build-module/components/editor-styles/index.js.map +1 -1
- package/build-module/components/font-sizes/fluid-utils.js +21 -14
- package/build-module/components/font-sizes/fluid-utils.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +15 -59
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/color-panel.js +13 -13
- package/build-module/components/global-styles/color-panel.js.map +1 -1
- package/build-module/components/global-styles/color-panel.native.js +150 -0
- package/build-module/components/global-styles/color-panel.native.js.map +1 -0
- package/build-module/components/global-styles/dimensions-panel.js +22 -21
- 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 +201 -0
- package/build-module/components/global-styles/filters-panel.js.map +1 -0
- package/build-module/components/global-styles/get-block-css-selector.js +1 -12
- package/build-module/components/global-styles/get-block-css-selector.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +7 -0
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/index.js +2 -0
- package/build-module/components/global-styles/index.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +10 -10
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +101 -83
- package/build-module/components/global-styles/use-global-styles-output.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/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/inserter/block-types-tab.js +12 -6
- package/build-module/components/inserter/block-types-tab.js.map +1 -1
- package/build-module/components/inserter/index.js +2 -1
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/inspector-controls/groups.js +2 -0
- package/build-module/components/inspector-controls/groups.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/styles-tab.js +2 -0
- package/build-module/components/inspector-controls-tabs/styles-tab.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/list-view/block-select-button.js +7 -2
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/list-view/block.js +15 -22
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/drop-indicator.js +36 -10
- package/build-module/components/list-view/drop-indicator.js.map +1 -1
- package/build-module/components/list-view/index.js +31 -8
- package/build-module/components/list-view/index.js.map +1 -1
- package/build-module/components/list-view/leaf.js +2 -1
- package/build-module/components/list-view/leaf.js.map +1 -1
- package/build-module/components/list-view/use-block-selection.js +1 -1
- package/build-module/components/list-view/use-block-selection.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 +5 -5
- package/build-module/components/media-replace-flow/index.js.map +1 -1
- package/build-module/components/navigable-toolbar/index.js +12 -4
- package/build-module/components/navigable-toolbar/index.js.map +1 -1
- package/build-module/components/off-canvas-editor/appender.js +1 -5
- package/build-module/components/off-canvas-editor/appender.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/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/hooks/anchor.js +1 -1
- package/build-module/hooks/anchor.js.map +1 -1
- package/build-module/hooks/border.js +1 -1
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/duotone.js +118 -71
- 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/utils.js +24 -9
- package/build-module/hooks/utils.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 +9 -1
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/actions.js +8 -1
- package/build-module/store/actions.js.map +1 -1
- package/build-module/utils/object.js +5 -5
- package/build-module/utils/object.js.map +1 -1
- package/build-module/utils/transform-styles/index.js +2 -2
- package/build-module/utils/transform-styles/index.js.map +1 -1
- package/build-module/utils/use-should-contextual-toolbar-show.js +56 -0
- package/build-module/utils/use-should-contextual-toolbar-show.js.map +1 -0
- package/build-style/content-rtl.css +9 -6
- package/build-style/content.css +9 -6
- package/build-style/style-rtl.css +272 -54
- package/build-style/style.css +272 -54
- package/package.json +32 -32
- package/src/components/block-info-slot-fill/index.js +24 -0
- package/src/components/block-inspector/index.js +3 -0
- package/src/components/block-inspector/style.scss +6 -4
- package/src/components/block-list/content.scss +16 -15
- 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-mobile-toolbar/test/block-actions-menu.native.js +9 -9
- package/src/components/block-mover/style.scss +10 -4
- package/src/components/block-mover/test/index.native.js +4 -4
- package/src/components/block-popover/inbetween.js +2 -13
- package/src/components/block-settings-menu/block-settings-dropdown.js +2 -12
- package/src/components/block-toolbar/index.js +4 -3
- package/src/components/block-toolbar/style.scss +56 -33
- package/src/components/block-tools/block-contextual-toolbar.js +94 -11
- package/src/components/block-tools/selected-block-popover.js +11 -44
- package/src/components/block-tools/style.scss +157 -3
- package/src/components/caption/index.native.js +0 -1
- package/src/components/date-format-picker/index.js +1 -1
- package/src/components/editor-styles/index.js +9 -5
- package/src/components/font-sizes/fluid-utils.js +31 -14
- package/src/components/font-sizes/test/fluid-utils.js +5 -16
- package/src/components/global-styles/README.md +129 -16
- package/src/components/global-styles/border-panel.js +13 -61
- package/src/components/global-styles/color-panel.js +13 -13
- package/src/components/global-styles/color-panel.native.js +207 -0
- package/src/components/global-styles/dimensions-panel.js +47 -20
- package/src/components/global-styles/effects-panel.js +228 -0
- package/src/components/global-styles/filters-panel.js +230 -0
- package/src/components/global-styles/get-block-css-selector.js +0 -11
- package/src/components/global-styles/hooks.js +10 -0
- package/src/components/global-styles/index.js +2 -0
- package/src/components/global-styles/style.scss +43 -0
- package/src/components/global-styles/test/typography-utils.js +63 -22
- package/src/components/global-styles/test/use-global-styles-output.js +130 -8
- package/src/components/global-styles/typography-panel.js +37 -11
- package/src/components/global-styles/use-global-styles-output.js +88 -72
- package/src/components/iframe/index.js +1 -1
- package/src/components/image-size-control/use-dimension-handler.js +4 -3
- package/src/components/index.js +5 -1
- package/src/components/inserter/block-patterns-tab.js +3 -1
- package/src/components/inserter/block-types-tab.js +9 -6
- package/src/components/inserter/index.js +1 -1
- package/src/components/inspector-controls/groups.js +2 -0
- package/src/components/inspector-controls-tabs/styles-tab.js +1 -0
- package/src/components/inspector-controls-tabs/utils.js +4 -3
- package/src/components/list-view/README.md +2 -0
- package/src/components/list-view/block-select-button.js +6 -1
- package/src/components/list-view/block.js +24 -31
- package/src/components/list-view/drop-indicator.js +67 -22
- package/src/components/list-view/index.js +26 -3
- package/src/components/list-view/leaf.js +1 -0
- package/src/components/list-view/style.scss +18 -4
- package/src/components/list-view/test/use-list-view-drop-zone.js +188 -0
- package/src/components/list-view/use-block-selection.js +1 -1
- 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/README.md +3 -2
- package/src/components/media-replace-flow/index.js +4 -5
- package/src/components/navigable-toolbar/index.js +12 -3
- package/src/components/off-canvas-editor/appender.js +1 -4
- 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/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/url-popover/test/__snapshots__/index.js.snap +3 -3
- package/src/hooks/anchor.js +1 -1
- package/src/hooks/border.js +1 -1
- package/src/hooks/duotone.js +162 -99
- package/src/hooks/margin.js +31 -26
- package/src/hooks/padding.js +24 -18
- package/src/hooks/test/anchor.js +113 -0
- package/src/hooks/test/color.js +0 -9
- package/src/hooks/test/use-typography-props.js +2 -2
- package/src/hooks/test/utils.js +20 -101
- package/src/hooks/utils.js +23 -6
- package/src/layouts/utils.js +2 -2
- package/src/private-apis.js +8 -0
- package/src/store/actions.js +8 -1
- package/src/style.scss +1 -0
- package/src/utils/object.js +5 -5
- package/src/utils/test/object.js +53 -15
- package/src/utils/transform-styles/index.js +2 -2
- package/src/utils/use-should-contextual-toolbar-show.js +75 -0
- package/tsconfig.json +1 -0
- 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.native.js +0 -77
- package/build/hooks/color-panel.native.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.native.js +0 -62
- package/build-module/hooks/color-panel.native.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
- package/src/hooks/color-panel.native.js +0 -63
|
@@ -9,6 +9,7 @@ import { get, isEmpty, kebabCase, set } from 'lodash';
|
|
|
9
9
|
import {
|
|
10
10
|
__EXPERIMENTAL_STYLE_PROPERTY as STYLE_PROPERTY,
|
|
11
11
|
__EXPERIMENTAL_ELEMENTS as ELEMENTS,
|
|
12
|
+
getBlockSupport,
|
|
12
13
|
getBlockTypes,
|
|
13
14
|
store as blocksStore,
|
|
14
15
|
} from '@wordpress/blocks';
|
|
@@ -324,7 +325,7 @@ export function getStylesDeclarations(
|
|
|
324
325
|
return declarations;
|
|
325
326
|
}
|
|
326
327
|
|
|
327
|
-
if (
|
|
328
|
+
if ( properties && typeof styleValue !== 'string' ) {
|
|
328
329
|
Object.entries( properties ).forEach( ( entry ) => {
|
|
329
330
|
const [ name, prop ] = entry;
|
|
330
331
|
|
|
@@ -381,7 +382,7 @@ export function getStylesDeclarations(
|
|
|
381
382
|
ruleValue = get( tree, refPath );
|
|
382
383
|
// Presence of another ref indicates a reference to another dynamic value.
|
|
383
384
|
// Pointing to another dynamic value is not supported.
|
|
384
|
-
if ( ! ruleValue ||
|
|
385
|
+
if ( ! ruleValue || ruleValue?.ref ) {
|
|
385
386
|
return;
|
|
386
387
|
}
|
|
387
388
|
}
|
|
@@ -483,10 +484,10 @@ export function getLayoutStyles( {
|
|
|
483
484
|
} else {
|
|
484
485
|
combinedSelector =
|
|
485
486
|
selector === ROOT_BLOCK_SELECTOR
|
|
486
|
-
?
|
|
487
|
+
? `:where(${ selector } .${ className })${
|
|
487
488
|
spacingStyle?.selector || ''
|
|
488
489
|
}`
|
|
489
|
-
: `${ selector }-${ className }${
|
|
490
|
+
: `${ selector }-${ className }${
|
|
490
491
|
spacingStyle?.selector || ''
|
|
491
492
|
}`;
|
|
492
493
|
}
|
|
@@ -550,6 +551,33 @@ export function getLayoutStyles( {
|
|
|
550
551
|
return ruleset;
|
|
551
552
|
}
|
|
552
553
|
|
|
554
|
+
const STYLE_KEYS = [
|
|
555
|
+
'border',
|
|
556
|
+
'color',
|
|
557
|
+
'dimensions',
|
|
558
|
+
'spacing',
|
|
559
|
+
'typography',
|
|
560
|
+
'filter',
|
|
561
|
+
'outline',
|
|
562
|
+
'shadow',
|
|
563
|
+
];
|
|
564
|
+
|
|
565
|
+
function pickStyleKeys( treeToPickFrom ) {
|
|
566
|
+
if ( ! treeToPickFrom ) {
|
|
567
|
+
return {};
|
|
568
|
+
}
|
|
569
|
+
const entries = Object.entries( treeToPickFrom );
|
|
570
|
+
const pickedEntries = entries.filter( ( [ key ] ) =>
|
|
571
|
+
STYLE_KEYS.includes( key )
|
|
572
|
+
);
|
|
573
|
+
// clone the style objects so that `getFeatureDeclarations` can remove consumed keys from it
|
|
574
|
+
const clonedEntries = pickedEntries.map( ( [ key, style ] ) => [
|
|
575
|
+
key,
|
|
576
|
+
JSON.parse( JSON.stringify( style ) ),
|
|
577
|
+
] );
|
|
578
|
+
return Object.fromEntries( clonedEntries );
|
|
579
|
+
}
|
|
580
|
+
|
|
553
581
|
export const getNodesWithStyles = ( tree, blockSelectors ) => {
|
|
554
582
|
const nodes = [];
|
|
555
583
|
|
|
@@ -557,25 +585,9 @@ export const getNodesWithStyles = ( tree, blockSelectors ) => {
|
|
|
557
585
|
return nodes;
|
|
558
586
|
}
|
|
559
587
|
|
|
560
|
-
const pickStyleKeys = ( treeToPickFrom ) =>
|
|
561
|
-
Object.fromEntries(
|
|
562
|
-
Object.entries( treeToPickFrom ?? {} ).filter( ( [ key ] ) =>
|
|
563
|
-
[
|
|
564
|
-
'border',
|
|
565
|
-
'color',
|
|
566
|
-
'dimensions',
|
|
567
|
-
'spacing',
|
|
568
|
-
'typography',
|
|
569
|
-
'filter',
|
|
570
|
-
'outline',
|
|
571
|
-
'shadow',
|
|
572
|
-
].includes( key )
|
|
573
|
-
)
|
|
574
|
-
);
|
|
575
|
-
|
|
576
588
|
// Top-level.
|
|
577
589
|
const styles = pickStyleKeys( tree.styles );
|
|
578
|
-
if (
|
|
590
|
+
if ( styles ) {
|
|
579
591
|
nodes.push( {
|
|
580
592
|
styles,
|
|
581
593
|
selector: ROOT_BLOCK_SELECTOR,
|
|
@@ -583,7 +595,7 @@ export const getNodesWithStyles = ( tree, blockSelectors ) => {
|
|
|
583
595
|
}
|
|
584
596
|
|
|
585
597
|
Object.entries( ELEMENTS ).forEach( ( [ name, selector ] ) => {
|
|
586
|
-
if (
|
|
598
|
+
if ( tree.styles?.elements?.[ name ] ) {
|
|
587
599
|
nodes.push( {
|
|
588
600
|
styles: tree.styles?.elements?.[ name ],
|
|
589
601
|
selector,
|
|
@@ -605,10 +617,7 @@ export const getNodesWithStyles = ( tree, blockSelectors ) => {
|
|
|
605
617
|
} );
|
|
606
618
|
blockStyles.variations = variations;
|
|
607
619
|
}
|
|
608
|
-
if (
|
|
609
|
-
!! blockStyles &&
|
|
610
|
-
!! blockSelectors?.[ blockName ]?.selector
|
|
611
|
-
) {
|
|
620
|
+
if ( blockStyles && blockSelectors?.[ blockName ]?.selector ) {
|
|
612
621
|
nodes.push( {
|
|
613
622
|
duotoneSelector:
|
|
614
623
|
blockSelectors[ blockName ].duotoneSelector,
|
|
@@ -616,7 +625,7 @@ export const getNodesWithStyles = ( tree, blockSelectors ) => {
|
|
|
616
625
|
blockSelectors[ blockName ].fallbackGapValue,
|
|
617
626
|
hasLayoutSupport:
|
|
618
627
|
blockSelectors[ blockName ].hasLayoutSupport,
|
|
619
|
-
selector: blockSelectors[ blockName ]
|
|
628
|
+
selector: blockSelectors[ blockName ].selector,
|
|
620
629
|
styles: blockStyles,
|
|
621
630
|
featureSelectors:
|
|
622
631
|
blockSelectors[ blockName ].featureSelectors,
|
|
@@ -628,9 +637,9 @@ export const getNodesWithStyles = ( tree, blockSelectors ) => {
|
|
|
628
637
|
Object.entries( node?.elements ?? {} ).forEach(
|
|
629
638
|
( [ elementName, value ] ) => {
|
|
630
639
|
if (
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
640
|
+
value &&
|
|
641
|
+
blockSelectors?.[ blockName ] &&
|
|
642
|
+
ELEMENTS[ elementName ]
|
|
634
643
|
) {
|
|
635
644
|
nodes.push( {
|
|
636
645
|
styles: value,
|
|
@@ -676,7 +685,7 @@ export const getNodesWithSettings = ( tree, blockSelectors ) => {
|
|
|
676
685
|
// Top-level.
|
|
677
686
|
const presets = pickPresets( tree.settings );
|
|
678
687
|
const custom = tree.settings?.custom;
|
|
679
|
-
if ( ! isEmpty( presets ) ||
|
|
688
|
+
if ( ! isEmpty( presets ) || custom ) {
|
|
680
689
|
nodes.push( {
|
|
681
690
|
presets,
|
|
682
691
|
custom,
|
|
@@ -689,7 +698,7 @@ export const getNodesWithSettings = ( tree, blockSelectors ) => {
|
|
|
689
698
|
( [ blockName, node ] ) => {
|
|
690
699
|
const blockPresets = pickPresets( node );
|
|
691
700
|
const blockCustom = node.custom;
|
|
692
|
-
if ( ! isEmpty( blockPresets ) ||
|
|
701
|
+
if ( ! isEmpty( blockPresets ) || blockCustom ) {
|
|
693
702
|
nodes.push( {
|
|
694
703
|
presets: blockPresets,
|
|
695
704
|
custom: blockCustom,
|
|
@@ -713,7 +722,7 @@ export const toCustomProperties = ( tree, blockSelectors ) => {
|
|
|
713
722
|
}
|
|
714
723
|
|
|
715
724
|
if ( declarations.length > 0 ) {
|
|
716
|
-
ruleset
|
|
725
|
+
ruleset += `${ selector }{${ declarations.join( ';' ) };}`;
|
|
717
726
|
}
|
|
718
727
|
} );
|
|
719
728
|
|
|
@@ -786,9 +795,9 @@ export const toStyles = (
|
|
|
786
795
|
|
|
787
796
|
Object.entries( featureDeclarations ).forEach(
|
|
788
797
|
( [ cssSelector, declarations ] ) => {
|
|
789
|
-
if (
|
|
798
|
+
if ( declarations.length ) {
|
|
790
799
|
const rules = declarations.join( ';' );
|
|
791
|
-
ruleset
|
|
800
|
+
ruleset += `${ cssSelector }{${ rules };}`;
|
|
792
801
|
}
|
|
793
802
|
}
|
|
794
803
|
);
|
|
@@ -797,20 +806,20 @@ export const toStyles = (
|
|
|
797
806
|
if ( styleVariationSelectors ) {
|
|
798
807
|
Object.entries( styleVariationSelectors ).forEach(
|
|
799
808
|
( [ styleVariationName, styleVariationSelector ] ) => {
|
|
800
|
-
|
|
809
|
+
const styleVariations =
|
|
810
|
+
styles?.variations?.[ styleVariationName ];
|
|
811
|
+
if ( styleVariations ) {
|
|
801
812
|
// If the block uses any custom selectors for block support, add those first.
|
|
802
813
|
if ( featureSelectors ) {
|
|
803
814
|
const featureDeclarations =
|
|
804
815
|
getFeatureDeclarations(
|
|
805
816
|
featureSelectors,
|
|
806
|
-
|
|
807
|
-
styleVariationName
|
|
808
|
-
]
|
|
817
|
+
styleVariations
|
|
809
818
|
);
|
|
810
819
|
|
|
811
820
|
Object.entries( featureDeclarations ).forEach(
|
|
812
821
|
( [ baseSelector, declarations ] ) => {
|
|
813
|
-
if (
|
|
822
|
+
if ( declarations.length ) {
|
|
814
823
|
const cssSelector =
|
|
815
824
|
concatFeatureVariationSelectorString(
|
|
816
825
|
baseSelector,
|
|
@@ -818,9 +827,7 @@ export const toStyles = (
|
|
|
818
827
|
);
|
|
819
828
|
const rules =
|
|
820
829
|
declarations.join( ';' );
|
|
821
|
-
ruleset
|
|
822
|
-
ruleset +
|
|
823
|
-
`${ cssSelector }{${ rules }}`;
|
|
830
|
+
ruleset += `${ cssSelector }{${ rules };}`;
|
|
824
831
|
}
|
|
825
832
|
}
|
|
826
833
|
);
|
|
@@ -829,40 +836,34 @@ export const toStyles = (
|
|
|
829
836
|
// Otherwise add regular selectors.
|
|
830
837
|
const styleVariationDeclarations =
|
|
831
838
|
getStylesDeclarations(
|
|
832
|
-
|
|
839
|
+
styleVariations,
|
|
833
840
|
styleVariationSelector,
|
|
834
841
|
useRootPaddingAlign,
|
|
835
842
|
tree
|
|
836
843
|
);
|
|
837
|
-
if (
|
|
838
|
-
ruleset
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
';'
|
|
842
|
-
) }}`;
|
|
844
|
+
if ( styleVariationDeclarations.length ) {
|
|
845
|
+
ruleset += `${ styleVariationSelector }{${ styleVariationDeclarations.join(
|
|
846
|
+
';'
|
|
847
|
+
) };}`;
|
|
843
848
|
}
|
|
844
849
|
}
|
|
845
850
|
}
|
|
846
851
|
);
|
|
847
852
|
}
|
|
848
853
|
|
|
849
|
-
|
|
850
|
-
if ( styles?.filter ) {
|
|
851
|
-
duotoneStyles.filter = styles.filter;
|
|
852
|
-
delete styles.filter;
|
|
853
|
-
}
|
|
854
|
-
|
|
855
|
-
// Process duotone styles (they use color.__experimentalDuotone selector).
|
|
854
|
+
// Process duotone styles.
|
|
856
855
|
if ( duotoneSelector ) {
|
|
856
|
+
const duotoneStyles = {};
|
|
857
|
+
if ( styles?.filter ) {
|
|
858
|
+
duotoneStyles.filter = styles.filter;
|
|
859
|
+
delete styles.filter;
|
|
860
|
+
}
|
|
857
861
|
const duotoneDeclarations =
|
|
858
862
|
getStylesDeclarations( duotoneStyles );
|
|
859
|
-
if ( duotoneDeclarations.length
|
|
860
|
-
ruleset
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
selector,
|
|
864
|
-
duotoneSelector
|
|
865
|
-
) }{${ duotoneDeclarations.join( ';' ) };}`;
|
|
863
|
+
if ( duotoneDeclarations.length ) {
|
|
864
|
+
ruleset += `${ duotoneSelector }{${ duotoneDeclarations.join(
|
|
865
|
+
';'
|
|
866
|
+
) };}`;
|
|
866
867
|
}
|
|
867
868
|
}
|
|
868
869
|
|
|
@@ -889,8 +890,7 @@ export const toStyles = (
|
|
|
889
890
|
tree
|
|
890
891
|
);
|
|
891
892
|
if ( declarations?.length ) {
|
|
892
|
-
ruleset
|
|
893
|
-
ruleset + `${ selector }{${ declarations.join( ';' ) };}`;
|
|
893
|
+
ruleset += `${ selector }{${ declarations.join( ';' ) };}`;
|
|
894
894
|
}
|
|
895
895
|
|
|
896
896
|
// Check for pseudo selector in `styles` and handle separately.
|
|
@@ -924,7 +924,7 @@ export const toStyles = (
|
|
|
924
924
|
';'
|
|
925
925
|
) };}`;
|
|
926
926
|
|
|
927
|
-
ruleset
|
|
927
|
+
ruleset += pseudoRule;
|
|
928
928
|
}
|
|
929
929
|
);
|
|
930
930
|
}
|
|
@@ -948,10 +948,13 @@ export const toStyles = (
|
|
|
948
948
|
getGapCSSValue( tree?.styles?.spacing?.blockGap ) || '0.5em';
|
|
949
949
|
ruleset =
|
|
950
950
|
ruleset +
|
|
951
|
-
|
|
951
|
+
`:where(.wp-site-blocks) > * { margin-block-start: ${ gapValue }; margin-block-end: 0; }`;
|
|
952
|
+
ruleset =
|
|
953
|
+
ruleset +
|
|
954
|
+
':where(.wp-site-blocks) > :first-child:first-child { margin-block-start: 0; }';
|
|
952
955
|
ruleset =
|
|
953
956
|
ruleset +
|
|
954
|
-
|
|
957
|
+
':where(.wp-site-blocks) > :last-child:last-child { margin-block-end: 0; }';
|
|
955
958
|
}
|
|
956
959
|
|
|
957
960
|
nodesWithSettings.forEach( ( { selector, presets } ) => {
|
|
@@ -962,7 +965,7 @@ export const toStyles = (
|
|
|
962
965
|
|
|
963
966
|
const classes = getPresetsClasses( selector, presets );
|
|
964
967
|
if ( ! isEmpty( classes ) ) {
|
|
965
|
-
ruleset
|
|
968
|
+
ruleset += classes;
|
|
966
969
|
}
|
|
967
970
|
} );
|
|
968
971
|
|
|
@@ -1002,11 +1005,24 @@ export const getBlockSelectors = ( blockTypes, getBlockStyles ) => {
|
|
|
1002
1005
|
const result = {};
|
|
1003
1006
|
blockTypes.forEach( ( blockType ) => {
|
|
1004
1007
|
const name = blockType.name;
|
|
1005
|
-
const selector = getBlockCSSSelector( blockType
|
|
1006
|
-
|
|
1008
|
+
const selector = getBlockCSSSelector( blockType );
|
|
1009
|
+
let duotoneSelector = getBlockCSSSelector(
|
|
1007
1010
|
blockType,
|
|
1008
1011
|
'filter.duotone'
|
|
1009
1012
|
);
|
|
1013
|
+
|
|
1014
|
+
// Keep backwards compatibility for support.color.__experimentalDuotone.
|
|
1015
|
+
if ( ! duotoneSelector ) {
|
|
1016
|
+
const rootSelector = getBlockCSSSelector( blockType );
|
|
1017
|
+
const duotoneSupport = getBlockSupport(
|
|
1018
|
+
blockType,
|
|
1019
|
+
'color.__experimentalDuotone',
|
|
1020
|
+
false
|
|
1021
|
+
);
|
|
1022
|
+
duotoneSelector =
|
|
1023
|
+
duotoneSupport && scopeSelector( rootSelector, duotoneSupport );
|
|
1024
|
+
}
|
|
1025
|
+
|
|
1010
1026
|
const hasLayoutSupport = !! blockType?.supports?.__experimentalLayout;
|
|
1011
1027
|
const fallbackGapValue =
|
|
1012
1028
|
blockType?.supports?.spacing?.blockGap?.__experimentalDefault;
|
|
@@ -47,13 +47,14 @@ export default function useDimensionHandler(
|
|
|
47
47
|
}, [ customWidth, customHeight ] );
|
|
48
48
|
|
|
49
49
|
const updateDimension = ( dimension, value ) => {
|
|
50
|
+
const parsedValue = value === '' ? undefined : parseInt( value, 10 );
|
|
50
51
|
if ( dimension === 'width' ) {
|
|
51
|
-
setCurrentWidth(
|
|
52
|
+
setCurrentWidth( parsedValue );
|
|
52
53
|
} else {
|
|
53
|
-
setCurrentHeight(
|
|
54
|
+
setCurrentHeight( parsedValue );
|
|
54
55
|
}
|
|
55
56
|
onChange( {
|
|
56
|
-
[ dimension ]:
|
|
57
|
+
[ dimension ]: parsedValue,
|
|
57
58
|
} );
|
|
58
59
|
};
|
|
59
60
|
|
package/src/components/index.js
CHANGED
|
@@ -92,7 +92,11 @@ export { default as URLPopover } from './url-popover';
|
|
|
92
92
|
export { __experimentalImageURLInputUI } from './url-popover/image-url-input-ui';
|
|
93
93
|
export { default as withColorContext } from './color-palette/with-color-context';
|
|
94
94
|
export { default as __experimentalSpacingSizesControl } from './spacing-sizes-control';
|
|
95
|
-
|
|
95
|
+
export {
|
|
96
|
+
getSpacingPresetCssVar,
|
|
97
|
+
isValueSpacingPreset,
|
|
98
|
+
getCustomValueFromPreset,
|
|
99
|
+
} from './spacing-sizes-control/utils';
|
|
96
100
|
/*
|
|
97
101
|
* Content Related Components
|
|
98
102
|
*/
|
|
@@ -28,6 +28,8 @@ import BlockPatternList from '../block-patterns-list';
|
|
|
28
28
|
import PatternsExplorerModal from './block-patterns-explorer/explorer';
|
|
29
29
|
import MobileTabNavigation from './mobile-tab-navigation';
|
|
30
30
|
|
|
31
|
+
const noop = () => {};
|
|
32
|
+
|
|
31
33
|
// Preferred order of pattern categories. Any other categories should
|
|
32
34
|
// be at the bottom without any re-ordering.
|
|
33
35
|
const patternCategoriesOrder = [
|
|
@@ -134,7 +136,7 @@ export function BlockPatternsCategoryDialog( {
|
|
|
134
136
|
export function BlockPatternsCategoryPanel( {
|
|
135
137
|
rootClientId,
|
|
136
138
|
onInsert,
|
|
137
|
-
onHover,
|
|
139
|
+
onHover = noop,
|
|
138
140
|
category,
|
|
139
141
|
showTitlesAsTooltip,
|
|
140
142
|
} ) {
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { groupBy } from 'lodash';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
@@ -59,7 +54,15 @@ export function BlockTypesTab( {
|
|
|
59
54
|
itemList.filter(
|
|
60
55
|
( item ) => item.category && item.category !== 'reusable'
|
|
61
56
|
),
|
|
62
|
-
( itemList ) =>
|
|
57
|
+
( itemList ) =>
|
|
58
|
+
itemList.reduce( ( acc, item ) => {
|
|
59
|
+
const { category } = item;
|
|
60
|
+
if ( ! acc[ category ] ) {
|
|
61
|
+
acc[ category ] = [];
|
|
62
|
+
}
|
|
63
|
+
acc[ category ].push( item );
|
|
64
|
+
return acc;
|
|
65
|
+
}, {} )
|
|
63
66
|
)( items );
|
|
64
67
|
}, [ items ] );
|
|
65
68
|
|
|
@@ -214,7 +214,7 @@ class PrivateInserter extends Component {
|
|
|
214
214
|
'block-editor-inserter__popover',
|
|
215
215
|
{ 'is-quick': isQuick }
|
|
216
216
|
) }
|
|
217
|
-
popoverProps={ { position } }
|
|
217
|
+
popoverProps={ { position, shift: true } }
|
|
218
218
|
onToggle={ this.onToggle }
|
|
219
219
|
expandOnMobile
|
|
220
220
|
headerTitle={ __( 'Add a block' ) }
|
|
@@ -7,6 +7,7 @@ const InspectorControlsDefault = createSlotFill( 'InspectorControls' );
|
|
|
7
7
|
const InspectorControlsAdvanced = createSlotFill( 'InspectorAdvancedControls' );
|
|
8
8
|
const InspectorControlsBorder = createSlotFill( 'InspectorControlsBorder' );
|
|
9
9
|
const InspectorControlsColor = createSlotFill( 'InspectorControlsColor' );
|
|
10
|
+
const InspectorControlsFilter = createSlotFill( 'InspectorControlsFilter' );
|
|
10
11
|
const InspectorControlsDimensions = createSlotFill(
|
|
11
12
|
'InspectorControlsDimensions'
|
|
12
13
|
);
|
|
@@ -22,6 +23,7 @@ const groups = {
|
|
|
22
23
|
advanced: InspectorControlsAdvanced,
|
|
23
24
|
border: InspectorControlsBorder,
|
|
24
25
|
color: InspectorControlsColor,
|
|
26
|
+
filter: InspectorControlsFilter,
|
|
25
27
|
dimensions: InspectorControlsDimensions,
|
|
26
28
|
list: InspectorControlsListView,
|
|
27
29
|
settings: InspectorControlsDefault, // Alias for default.
|
|
@@ -32,6 +32,7 @@ const StylesTab = ( { blockName, clientId, hasBlockStyles } ) => {
|
|
|
32
32
|
label={ __( 'Color' ) }
|
|
33
33
|
className="color-block-support-panel__inner-wrapper"
|
|
34
34
|
/>
|
|
35
|
+
<InspectorControls.Slot group="filter" />
|
|
35
36
|
<InspectorControls.Slot
|
|
36
37
|
group="typography"
|
|
37
38
|
label={ __( 'Typography' ) }
|
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { cog, styles, listView } from '@wordpress/icons';
|
|
5
|
+
import { __ } from '@wordpress/i18n';
|
|
5
6
|
|
|
6
7
|
export const TAB_SETTINGS = {
|
|
7
8
|
name: 'settings',
|
|
8
|
-
title: 'Settings',
|
|
9
|
+
title: __( 'Settings' ),
|
|
9
10
|
value: 'settings',
|
|
10
11
|
icon: cog,
|
|
11
12
|
className: 'block-editor-block-inspector__tab-item',
|
|
@@ -13,7 +14,7 @@ export const TAB_SETTINGS = {
|
|
|
13
14
|
|
|
14
15
|
export const TAB_STYLES = {
|
|
15
16
|
name: 'styles',
|
|
16
|
-
title: 'Styles',
|
|
17
|
+
title: __( 'Styles' ),
|
|
17
18
|
value: 'styles',
|
|
18
19
|
icon: styles,
|
|
19
20
|
className: 'block-editor-block-inspector__tab-item',
|
|
@@ -21,7 +22,7 @@ export const TAB_STYLES = {
|
|
|
21
22
|
|
|
22
23
|
export const TAB_LIST_VIEW = {
|
|
23
24
|
name: 'list',
|
|
24
|
-
title: 'List View',
|
|
25
|
+
title: __( 'List View' ),
|
|
25
26
|
value: 'list-view',
|
|
26
27
|
icon: listView,
|
|
27
28
|
className: 'block-editor-block-inspector__tab-item',
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
The ListView component provides an overview of the hierarchical structure of all blocks in the editor. The blocks are presented vertically one below the other.
|
|
4
4
|
|
|
5
|
+
By providing the `rootClientId` prop you can restrict the blocks that are shown to only children of the block with that client id.
|
|
6
|
+
|
|
5
7
|
Blocks that have child blocks (such as group or column blocks) are presented with the parent at the top and the nested children below.
|
|
6
8
|
|
|
7
9
|
In addition to presenting the structure of the blocks in the editor, the ListView component lets users navigate to each block by clicking on its line in the hierarchy tree. Multiple blocks at the same level of nesting can be selected by holding down the `SHIFT` key and clicking blocks within the list.
|
|
@@ -35,6 +35,9 @@ function ListViewBlockSelectButton(
|
|
|
35
35
|
onDragStart,
|
|
36
36
|
onDragEnd,
|
|
37
37
|
draggable,
|
|
38
|
+
isExpanded,
|
|
39
|
+
ariaLabel,
|
|
40
|
+
ariaDescribedBy,
|
|
38
41
|
},
|
|
39
42
|
ref
|
|
40
43
|
) {
|
|
@@ -76,7 +79,9 @@ function ListViewBlockSelectButton(
|
|
|
76
79
|
onDragEnd={ onDragEnd }
|
|
77
80
|
draggable={ draggable }
|
|
78
81
|
href={ `#block-${ clientId }` }
|
|
79
|
-
aria-
|
|
82
|
+
aria-label={ ariaLabel }
|
|
83
|
+
aria-describedby={ ariaDescribedBy }
|
|
84
|
+
aria-expanded={ isExpanded }
|
|
80
85
|
>
|
|
81
86
|
<ListViewExpander onClick={ onToggleExpanded } />
|
|
82
87
|
<BlockIcon icon={ blockInformation?.icon } showColors />
|
|
@@ -53,7 +53,6 @@ function ListViewBlock( {
|
|
|
53
53
|
path,
|
|
54
54
|
isExpanded,
|
|
55
55
|
selectedClientIds,
|
|
56
|
-
preventAnnouncement,
|
|
57
56
|
isSyncedBranch,
|
|
58
57
|
} ) {
|
|
59
58
|
const cellRef = useRef( null );
|
|
@@ -90,6 +89,7 @@ function ListViewBlock( {
|
|
|
90
89
|
const { toggleBlockHighlight } = useDispatch( blockEditorStore );
|
|
91
90
|
|
|
92
91
|
const blockInformation = useBlockDisplayInformation( clientId );
|
|
92
|
+
const blockTitle = blockInformation?.title || __( 'Untitled' );
|
|
93
93
|
const blockName = useSelect(
|
|
94
94
|
( select ) => select( blockEditorStore ).getBlockName( clientId ),
|
|
95
95
|
[ clientId ]
|
|
@@ -111,31 +111,27 @@ function ListViewBlock( {
|
|
|
111
111
|
level
|
|
112
112
|
);
|
|
113
113
|
|
|
114
|
-
|
|
115
|
-
if ( blockInformation ) {
|
|
116
|
-
blockAriaLabel = isLocked
|
|
117
|
-
? sprintf(
|
|
118
|
-
// translators: %s: The title of the block. This string indicates a link to select the locked block.
|
|
119
|
-
__( '%s link (locked)' ),
|
|
120
|
-
blockInformation.title
|
|
121
|
-
)
|
|
122
|
-
: sprintf(
|
|
123
|
-
// translators: %s: The title of the block. This string indicates a link to select the block.
|
|
124
|
-
__( '%s link' ),
|
|
125
|
-
blockInformation.title
|
|
126
|
-
);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
const settingsAriaLabel = blockInformation
|
|
114
|
+
const blockAriaLabel = isLocked
|
|
130
115
|
? sprintf(
|
|
131
|
-
// translators: %s: The title of the block.
|
|
132
|
-
__( '
|
|
133
|
-
|
|
116
|
+
// translators: %s: The title of the block. This string indicates a link to select the locked block.
|
|
117
|
+
__( '%s (locked)' ),
|
|
118
|
+
blockTitle
|
|
134
119
|
)
|
|
135
|
-
:
|
|
120
|
+
: blockTitle;
|
|
121
|
+
|
|
122
|
+
const settingsAriaLabel = sprintf(
|
|
123
|
+
// translators: %s: The title of the block.
|
|
124
|
+
__( 'Options for %s' ),
|
|
125
|
+
blockTitle
|
|
126
|
+
);
|
|
136
127
|
|
|
137
|
-
const {
|
|
138
|
-
|
|
128
|
+
const {
|
|
129
|
+
isTreeGridMounted,
|
|
130
|
+
expand,
|
|
131
|
+
collapse,
|
|
132
|
+
BlockSettingsMenu,
|
|
133
|
+
listViewInstanceId,
|
|
134
|
+
} = useListViewContext();
|
|
139
135
|
|
|
140
136
|
const hasSiblings = siblingBlockCount > 0;
|
|
141
137
|
const hasRenderedMovers = showBlockMovers && hasSiblings;
|
|
@@ -246,20 +242,16 @@ function ListViewBlock( {
|
|
|
246
242
|
position={ position }
|
|
247
243
|
rowCount={ rowCount }
|
|
248
244
|
path={ path }
|
|
249
|
-
id={ `list-view-block-${ clientId }` }
|
|
245
|
+
id={ `list-view-${ listViewInstanceId }-block-${ clientId }` }
|
|
250
246
|
data-block={ clientId }
|
|
251
|
-
|
|
252
|
-
aria-selected={ !! isSelected || forceSelectionContentLock }
|
|
247
|
+
data-expanded={ canExpand ? isExpanded : undefined }
|
|
253
248
|
ref={ rowRef }
|
|
254
249
|
>
|
|
255
250
|
<TreeGridCell
|
|
256
251
|
className="block-editor-list-view-block__contents-cell"
|
|
257
252
|
colSpan={ colSpan }
|
|
258
253
|
ref={ cellRef }
|
|
259
|
-
aria-label={ blockAriaLabel }
|
|
260
254
|
aria-selected={ !! isSelected || forceSelectionContentLock }
|
|
261
|
-
aria-expanded={ canExpand ? isExpanded : undefined }
|
|
262
|
-
aria-describedby={ descriptionId }
|
|
263
255
|
>
|
|
264
256
|
{ ( { ref, tabIndex, onFocus } ) => (
|
|
265
257
|
<div className="block-editor-list-view-block__contents-container">
|
|
@@ -276,9 +268,10 @@ function ListViewBlock( {
|
|
|
276
268
|
currentlyEditingBlockInCanvas ? 0 : tabIndex
|
|
277
269
|
}
|
|
278
270
|
onFocus={ onFocus }
|
|
279
|
-
isExpanded={ isExpanded }
|
|
271
|
+
isExpanded={ canExpand ? isExpanded : undefined }
|
|
280
272
|
selectedClientIds={ selectedClientIds }
|
|
281
|
-
|
|
273
|
+
ariaLabel={ blockAriaLabel }
|
|
274
|
+
ariaDescribedBy={ descriptionId }
|
|
282
275
|
/>
|
|
283
276
|
<div
|
|
284
277
|
className="block-editor-list-view-block-select-button__description"
|