@wordpress/block-editor 12.0.0 → 12.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/README.md +1 -1
- package/build/components/block-controls/slot.js +12 -4
- package/build/components/block-controls/slot.js.map +1 -1
- package/build/components/block-controls/slot.native.js +10 -1
- package/build/components/block-controls/slot.native.js.map +1 -1
- package/build/components/block-draggable/index.js +11 -7
- package/build/components/block-draggable/index.js.map +1 -1
- package/build/components/block-draggable/use-scroll-when-dragging.js +2 -2
- package/build/components/block-draggable/use-scroll-when-dragging.js.map +1 -1
- package/build/components/block-list/block-invalid-warning.native.js +15 -7
- package/build/components/block-list/block-invalid-warning.native.js.map +1 -1
- package/build/components/block-list/block-list-item-cell.native.js +15 -2
- package/build/components/block-list/block-list-item-cell.native.js.map +1 -1
- package/build/components/block-list/block-list-item.native.js +158 -195
- package/build/components/block-list/block-list-item.native.js.map +1 -1
- package/build/components/block-list/block-outline.native.js +57 -0
- package/build/components/block-list/block-outline.native.js.map +1 -0
- package/build/components/block-list/block.native.js +343 -299
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-list/index.native.js +202 -298
- package/build/components/block-list/index.native.js.map +1 -1
- package/build/components/block-list/insertion-point.native.js +4 -2
- package/build/components/block-list/insertion-point.native.js.map +1 -1
- package/build/components/block-mobile-toolbar/block-actions-menu.native.js +1 -1
- package/build/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +8 -10
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-settings-menu-controls/index.js +15 -4
- package/build/components/block-settings-menu-controls/index.js.map +1 -1
- package/build/components/block-tools/block-contextual-toolbar.js +17 -62
- package/build/components/block-tools/block-contextual-toolbar.js.map +1 -1
- package/build/components/block-tools/selected-block-popover.js +3 -8
- package/build/components/block-tools/selected-block-popover.js.map +1 -1
- package/build/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +3 -2
- package/build/components/colors-gradients/use-multiple-origin-colors-and-gradients.js.map +1 -1
- package/build/components/global-styles/advanced-panel.js +86 -0
- package/build/components/global-styles/advanced-panel.js.map +1 -0
- package/build/components/global-styles/color-panel.js +4 -1
- package/build/components/global-styles/color-panel.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +6 -6
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/hooks.js +1 -2
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/index.js +24 -0
- package/build/components/global-styles/index.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +1 -1
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +27 -4
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js +30 -0
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/image-editor/use-save-image.js +24 -8
- package/build/components/image-editor/use-save-image.js.map +1 -1
- package/build/components/inserter-draggable-blocks/index.js +5 -0
- package/build/components/inserter-draggable-blocks/index.js.map +1 -1
- package/build/components/inspector-controls/fill.js +1 -1
- package/build/components/inspector-controls/fill.js.map +1 -1
- package/build/components/inspector-controls/fill.native.js +1 -1
- package/build/components/inspector-controls/fill.native.js.map +1 -1
- package/build/components/inspector-controls/slot.js +3 -6
- package/build/components/inspector-controls/slot.js.map +1 -1
- package/build/components/inspector-controls/slot.native.js +1 -1
- package/build/components/inspector-controls/slot.native.js.map +1 -1
- package/build/components/line-height-control/index.js +7 -2
- package/build/components/line-height-control/index.js.map +1 -1
- package/build/components/link-control/use-internal-input-value.js +9 -8
- package/build/components/link-control/use-internal-input-value.js.map +1 -1
- package/build/components/list-view/block-contents.js +7 -2
- package/build/components/list-view/block-contents.js.map +1 -1
- package/build/components/list-view/block-select-button.js +2 -1
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/list-view/block.js +4 -4
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/index.js +32 -18
- package/build/components/list-view/index.js.map +1 -1
- package/build/components/list-view/use-list-view-drop-zone.js +163 -11
- package/build/components/list-view/use-list-view-drop-zone.js.map +1 -1
- package/build/components/media-placeholder/index.js +68 -7
- package/build/components/media-placeholder/index.js.map +1 -1
- package/build/components/multi-selection-inspector/index.js +2 -2
- package/build/components/multi-selection-inspector/index.js.map +1 -1
- package/build/components/off-canvas-editor/leaf-more-menu.js +3 -1
- package/build/components/off-canvas-editor/leaf-more-menu.js.map +1 -1
- package/build/components/preview-options/index.js +6 -1
- package/build/components/preview-options/index.js.map +1 -1
- package/build/components/spacing-sizes-control/spacing-input-control.js +1 -1
- package/build/components/spacing-sizes-control/spacing-input-control.js.map +1 -1
- package/build/components/url-input/index.js +1 -2
- package/build/components/url-input/index.js.map +1 -1
- package/build/hooks/align.js +1 -1
- package/build/hooks/align.js.map +1 -1
- package/build/hooks/border.js +1 -1
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/color.js +1 -1
- package/build/hooks/color.js.map +1 -1
- package/build/hooks/content-lock-ui.js +8 -12
- package/build/hooks/content-lock-ui.js.map +1 -1
- package/build/hooks/duotone.js +1 -1
- package/build/hooks/duotone.js.map +1 -1
- package/build/hooks/index.native.js +8 -0
- package/build/hooks/index.native.js.map +1 -1
- package/build/hooks/layout.js +2 -2
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/position.js +1 -1
- package/build/hooks/position.js.map +1 -1
- package/build/hooks/style.js +1 -1
- package/build/hooks/style.js.map +1 -1
- package/build/hooks/use-editor-wrapper-styles.native.js +255 -0
- package/build/hooks/use-editor-wrapper-styles.native.js.map +1 -0
- package/build/hooks/use-typography-props.js +14 -10
- package/build/hooks/use-typography-props.js.map +1 -1
- package/build/index.native.js +31 -0
- package/build/index.native.js.map +1 -0
- package/build/utils/use-should-contextual-toolbar-show.js +16 -12
- package/build/utils/use-should-contextual-toolbar-show.js.map +1 -1
- package/build-module/components/block-controls/slot.js +11 -4
- package/build-module/components/block-controls/slot.js.map +1 -1
- package/build-module/components/block-controls/slot.native.js +9 -1
- package/build-module/components/block-controls/slot.native.js.map +1 -1
- package/build-module/components/block-draggable/index.js +10 -6
- package/build-module/components/block-draggable/index.js.map +1 -1
- package/build-module/components/block-draggable/use-scroll-when-dragging.js +2 -2
- package/build-module/components/block-draggable/use-scroll-when-dragging.js.map +1 -1
- package/build-module/components/block-list/block-invalid-warning.native.js +16 -8
- package/build-module/components/block-list/block-invalid-warning.native.js.map +1 -1
- package/build-module/components/block-list/block-list-item-cell.native.js +13 -2
- package/build-module/components/block-list/block-list-item-cell.native.js.map +1 -1
- package/build-module/components/block-list/block-list-item.native.js +160 -190
- package/build-module/components/block-list/block-list-item.native.js.map +1 -1
- package/build-module/components/block-list/block-outline.native.js +44 -0
- package/build-module/components/block-list/block-outline.native.js.map +1 -0
- package/build-module/components/block-list/block.native.js +341 -298
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-list/index.native.js +203 -293
- package/build-module/components/block-list/index.native.js.map +1 -1
- package/build-module/components/block-list/insertion-point.native.js +4 -2
- package/build-module/components/block-list/insertion-point.native.js.map +1 -1
- package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js +1 -1
- package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +8 -9
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-settings-menu-controls/index.js +13 -5
- package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
- package/build-module/components/block-tools/block-contextual-toolbar.js +18 -62
- package/build-module/components/block-tools/block-contextual-toolbar.js.map +1 -1
- package/build-module/components/block-tools/selected-block-popover.js +3 -7
- package/build-module/components/block-tools/selected-block-popover.js.map +1 -1
- package/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +3 -2
- package/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js.map +1 -1
- package/build-module/components/global-styles/advanced-panel.js +74 -0
- package/build-module/components/global-styles/advanced-panel.js.map +1 -0
- package/build-module/components/global-styles/color-panel.js +5 -2
- package/build-module/components/global-styles/color-panel.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +6 -6
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +1 -2
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/index.js +3 -1
- package/build-module/components/global-styles/index.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +1 -1
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +25 -4
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js +25 -0
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/image-editor/use-save-image.js +24 -8
- package/build-module/components/image-editor/use-save-image.js.map +1 -1
- package/build-module/components/inserter-draggable-blocks/index.js +4 -0
- package/build-module/components/inserter-draggable-blocks/index.js.map +1 -1
- package/build-module/components/inspector-controls/fill.js +1 -1
- package/build-module/components/inspector-controls/fill.js.map +1 -1
- package/build-module/components/inspector-controls/fill.native.js +1 -1
- package/build-module/components/inspector-controls/fill.native.js.map +1 -1
- package/build-module/components/inspector-controls/slot.js +4 -7
- package/build-module/components/inspector-controls/slot.js.map +1 -1
- package/build-module/components/inspector-controls/slot.native.js +1 -1
- package/build-module/components/inspector-controls/slot.native.js.map +1 -1
- package/build-module/components/line-height-control/index.js +7 -2
- package/build-module/components/line-height-control/index.js.map +1 -1
- package/build-module/components/link-control/use-internal-input-value.js +9 -8
- package/build-module/components/link-control/use-internal-input-value.js.map +1 -1
- package/build-module/components/list-view/block-contents.js +7 -3
- package/build-module/components/list-view/block-contents.js.map +1 -1
- package/build-module/components/list-view/block-select-button.js +2 -1
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/list-view/block.js +4 -4
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/index.js +32 -18
- package/build-module/components/list-view/index.js.map +1 -1
- package/build-module/components/list-view/use-list-view-drop-zone.js +160 -11
- package/build-module/components/list-view/use-list-view-drop-zone.js.map +1 -1
- package/build-module/components/media-placeholder/index.js +66 -7
- package/build-module/components/media-placeholder/index.js.map +1 -1
- package/build-module/components/multi-selection-inspector/index.js +2 -2
- package/build-module/components/multi-selection-inspector/index.js.map +1 -1
- package/build-module/components/off-canvas-editor/leaf-more-menu.js +3 -1
- package/build-module/components/off-canvas-editor/leaf-more-menu.js.map +1 -1
- package/build-module/components/preview-options/index.js +7 -2
- package/build-module/components/preview-options/index.js.map +1 -1
- package/build-module/components/spacing-sizes-control/spacing-input-control.js +1 -1
- package/build-module/components/spacing-sizes-control/spacing-input-control.js.map +1 -1
- package/build-module/components/url-input/index.js +1 -2
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/hooks/align.js +1 -1
- package/build-module/hooks/align.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/color.js +1 -1
- package/build-module/hooks/color.js.map +1 -1
- package/build-module/hooks/content-lock-ui.js +8 -11
- package/build-module/hooks/content-lock-ui.js.map +1 -1
- package/build-module/hooks/duotone.js +1 -1
- package/build-module/hooks/duotone.js.map +1 -1
- package/build-module/hooks/index.native.js +1 -0
- package/build-module/hooks/index.native.js.map +1 -1
- package/build-module/hooks/layout.js +2 -2
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/hooks/position.js +1 -1
- package/build-module/hooks/position.js.map +1 -1
- package/build-module/hooks/style.js +1 -1
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/hooks/use-editor-wrapper-styles.native.js +242 -0
- package/build-module/hooks/use-editor-wrapper-styles.native.js.map +1 -0
- package/build-module/hooks/use-typography-props.js +14 -10
- package/build-module/hooks/use-typography-props.js.map +1 -1
- package/build-module/index.native.js +6 -0
- package/build-module/index.native.js.map +1 -0
- package/build-module/utils/use-should-contextual-toolbar-show.js +16 -12
- package/build-module/utils/use-should-contextual-toolbar-show.js.map +1 -1
- package/build-style/content-rtl.css +0 -1
- package/build-style/content.css +0 -1
- package/build-style/style-rtl.css +37 -13
- package/build-style/style.css +37 -13
- package/package.json +31 -31
- package/src/components/block-breadcrumb/style.scss +2 -1
- package/src/components/block-controls/slot.js +8 -4
- package/src/components/block-controls/slot.native.js +6 -1
- package/src/components/block-draggable/index.js +10 -6
- package/src/components/block-draggable/use-scroll-when-dragging.js +8 -2
- package/src/components/block-list/block-invalid-warning.native.js +17 -9
- package/src/components/block-list/block-list-item-cell.native.js +10 -1
- package/src/components/block-list/block-list-item.native.js +180 -208
- package/src/components/block-list/block-outline.native.js +58 -0
- package/src/components/block-list/block.native.js +564 -523
- package/src/components/block-list/content.scss +0 -1
- package/src/components/block-list/index.native.js +229 -298
- package/src/components/block-list/insertion-point.native.js +2 -2
- package/src/components/block-list/test/block-invalid-warning.native.js +48 -0
- package/src/components/block-list/test/index.native.js +205 -0
- package/src/components/block-mobile-toolbar/block-actions-menu.native.js +3 -1
- package/src/components/block-pattern-setup/style.scss +1 -4
- package/src/components/block-patterns-list/style.scss +1 -4
- package/src/components/block-settings-menu/block-settings-dropdown.js +10 -17
- package/src/components/block-settings-menu-controls/index.js +24 -4
- package/src/components/block-styles/style.scss +4 -4
- package/src/components/block-tools/block-contextual-toolbar.js +28 -62
- package/src/components/block-tools/selected-block-popover.js +3 -5
- package/src/components/block-tools/style.scss +8 -0
- package/src/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +16 -2
- package/src/components/global-styles/advanced-panel.js +82 -0
- package/src/components/global-styles/color-panel.js +6 -1
- package/src/components/global-styles/dimensions-panel.js +6 -6
- package/src/components/global-styles/hooks.js +1 -5
- package/src/components/global-styles/index.js +6 -1
- package/src/components/global-styles/style.scss +14 -0
- package/src/components/global-styles/test/utils.js +57 -1
- package/src/components/global-styles/typography-panel.js +1 -1
- package/src/components/global-styles/use-global-styles-output.js +21 -3
- package/src/components/global-styles/utils.js +27 -0
- package/src/components/image-editor/use-save-image.js +20 -9
- package/src/components/inserter-draggable-blocks/index.js +4 -0
- package/src/components/inspector-controls/fill.js +1 -1
- package/src/components/inspector-controls/fill.native.js +1 -1
- package/src/components/inspector-controls/slot.js +4 -9
- package/src/components/inspector-controls/slot.native.js +1 -1
- package/src/components/line-height-control/index.js +7 -2
- package/src/components/line-height-control/stories/index.js +1 -1
- package/src/components/link-control/test/index.js +42 -0
- package/src/components/link-control/use-internal-input-value.js +8 -7
- package/src/components/list-view/block-contents.js +26 -20
- package/src/components/list-view/block-select-button.js +5 -1
- package/src/components/list-view/block.js +5 -2
- package/src/components/list-view/index.js +26 -14
- package/src/components/list-view/style.scss +5 -2
- package/src/components/list-view/test/use-list-view-drop-zone.js +88 -12
- package/src/components/list-view/use-list-view-drop-zone.js +194 -11
- package/src/components/media-placeholder/index.js +74 -1
- package/src/components/multi-selection-inspector/index.js +2 -2
- package/src/components/off-canvas-editor/leaf-more-menu.js +2 -1
- package/src/components/preview-options/index.js +9 -2
- package/src/components/spacing-sizes-control/spacing-input-control.js +1 -0
- package/src/components/url-input/index.js +1 -2
- package/src/hooks/align.js +2 -1
- package/src/hooks/border.js +2 -1
- package/src/hooks/color.js +2 -1
- package/src/hooks/content-lock-ui.js +3 -15
- package/src/hooks/duotone.js +1 -0
- package/src/hooks/index.native.js +1 -0
- package/src/hooks/layout.js +4 -2
- package/src/hooks/position.js +2 -1
- package/src/hooks/style.js +2 -1
- package/src/hooks/test/use-editor-wrapper-styles.native.js +282 -0
- package/src/hooks/test/use-typography-props.js +47 -2
- package/src/hooks/use-editor-wrapper-styles.native.js +250 -0
- package/src/hooks/use-editor-wrapper-styles.native.scss +11 -0
- package/src/hooks/use-typography-props.js +10 -11
- package/src/index.native.js +6 -0
- package/src/utils/use-should-contextual-toolbar-show.js +19 -9
- package/tsconfig.json +1 -0
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import {
|
|
5
|
+
TextareaControl,
|
|
6
|
+
Tooltip,
|
|
7
|
+
__experimentalVStack as VStack,
|
|
8
|
+
} from '@wordpress/components';
|
|
9
|
+
import { useState } from '@wordpress/element';
|
|
10
|
+
import { __ } from '@wordpress/i18n';
|
|
11
|
+
import { Icon, info } from '@wordpress/icons';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Internal dependencies
|
|
15
|
+
*/
|
|
16
|
+
import { default as transformStyles } from '../../utils/transform-styles';
|
|
17
|
+
|
|
18
|
+
export default function AdvancedPanel( {
|
|
19
|
+
value,
|
|
20
|
+
onChange,
|
|
21
|
+
inheritedValue = value,
|
|
22
|
+
} ) {
|
|
23
|
+
// Custom CSS
|
|
24
|
+
const [ cssError, setCSSError ] = useState( null );
|
|
25
|
+
const customCSS = inheritedValue?.css;
|
|
26
|
+
function handleOnChange( newValue ) {
|
|
27
|
+
onChange( {
|
|
28
|
+
...value,
|
|
29
|
+
css: newValue,
|
|
30
|
+
} );
|
|
31
|
+
if ( cssError ) {
|
|
32
|
+
const [ transformed ] = transformStyles(
|
|
33
|
+
[ { css: value } ],
|
|
34
|
+
'.editor-styles-wrapper'
|
|
35
|
+
);
|
|
36
|
+
if ( transformed ) {
|
|
37
|
+
setCSSError( null );
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
function handleOnBlur( event ) {
|
|
42
|
+
if ( ! event?.target?.value ) {
|
|
43
|
+
setCSSError( null );
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const [ transformed ] = transformStyles(
|
|
48
|
+
[ { css: event.target.value } ],
|
|
49
|
+
'.editor-styles-wrapper'
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
setCSSError(
|
|
53
|
+
transformed === null
|
|
54
|
+
? __( 'There is an error with your CSS structure.' )
|
|
55
|
+
: null
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<VStack spacing={ 3 }>
|
|
61
|
+
<TextareaControl
|
|
62
|
+
label={ __( 'Additional CSS' ) }
|
|
63
|
+
__nextHasNoMarginBottom
|
|
64
|
+
value={ customCSS }
|
|
65
|
+
onChange={ ( newValue ) => handleOnChange( newValue ) }
|
|
66
|
+
onBlur={ handleOnBlur }
|
|
67
|
+
className="block-editor-global-styles-advanced-panel__custom-css-input"
|
|
68
|
+
spellCheck={ false }
|
|
69
|
+
/>
|
|
70
|
+
{ cssError && (
|
|
71
|
+
<Tooltip text={ cssError }>
|
|
72
|
+
<div className="block-editor-global-styles-advanced-panel__custom-css-validation-wrapper">
|
|
73
|
+
<Icon
|
|
74
|
+
icon={ info }
|
|
75
|
+
className="block-editor-global-styles-advanced-panel__custom-css-validation-icon"
|
|
76
|
+
/>
|
|
77
|
+
</div>
|
|
78
|
+
</Tooltip>
|
|
79
|
+
) }
|
|
80
|
+
</VStack>
|
|
81
|
+
);
|
|
82
|
+
}
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
Button,
|
|
21
21
|
} from '@wordpress/components';
|
|
22
22
|
import { useCallback } from '@wordpress/element';
|
|
23
|
-
import { __ } from '@wordpress/i18n';
|
|
23
|
+
import { __, sprintf } from '@wordpress/i18n';
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
26
|
* Internal dependencies
|
|
@@ -230,6 +230,11 @@ function ColorPanelDropdown( {
|
|
|
230
230
|
{ 'is-open': isOpen }
|
|
231
231
|
),
|
|
232
232
|
'aria-expanded': isOpen,
|
|
233
|
+
'aria-label': sprintf(
|
|
234
|
+
/* translators: %s is the type of color property, e.g., "background" */
|
|
235
|
+
__( 'Color %s styles' ),
|
|
236
|
+
label
|
|
237
|
+
),
|
|
233
238
|
};
|
|
234
239
|
|
|
235
240
|
return (
|
|
@@ -184,12 +184,12 @@ function DimensionsToolsPanel( {
|
|
|
184
184
|
}
|
|
185
185
|
|
|
186
186
|
const DEFAULT_CONTROLS = {
|
|
187
|
-
contentSize:
|
|
188
|
-
wideSize:
|
|
189
|
-
padding:
|
|
190
|
-
margin:
|
|
191
|
-
blockGap:
|
|
192
|
-
minHeight:
|
|
187
|
+
contentSize: true,
|
|
188
|
+
wideSize: true,
|
|
189
|
+
padding: true,
|
|
190
|
+
margin: true,
|
|
191
|
+
blockGap: true,
|
|
192
|
+
minHeight: true,
|
|
193
193
|
childLayout: true,
|
|
194
194
|
};
|
|
195
195
|
|
|
@@ -181,11 +181,7 @@ export function useGlobalStyle(
|
|
|
181
181
|
let rawResult, result;
|
|
182
182
|
switch ( source ) {
|
|
183
183
|
case 'all':
|
|
184
|
-
rawResult =
|
|
185
|
-
// The styles.css path is allowed to be empty, so don't revert to base if undefined.
|
|
186
|
-
finalPath === 'styles.css'
|
|
187
|
-
? get( userConfig, finalPath )
|
|
188
|
-
: get( mergedConfig, finalPath );
|
|
184
|
+
rawResult = get( mergedConfig, finalPath );
|
|
189
185
|
result = shouldDecodeEncode
|
|
190
186
|
? getValueFromVariable( mergedConfig, blockName, rawResult )
|
|
191
187
|
: rawResult;
|
|
@@ -5,7 +5,10 @@ export {
|
|
|
5
5
|
useSettingsForBlockElement,
|
|
6
6
|
} from './hooks';
|
|
7
7
|
export { getBlockCSSSelector } from './get-block-css-selector';
|
|
8
|
-
export {
|
|
8
|
+
export {
|
|
9
|
+
useGlobalStylesOutput,
|
|
10
|
+
useGlobalStylesOutputWithConfig,
|
|
11
|
+
} from './use-global-styles-output';
|
|
9
12
|
export { GlobalStylesContext } from './context';
|
|
10
13
|
export {
|
|
11
14
|
default as TypographyPanel,
|
|
@@ -19,3 +22,5 @@ export { default as BorderPanel, useHasBorderPanel } from './border-panel';
|
|
|
19
22
|
export { default as ColorPanel, useHasColorPanel } from './color-panel';
|
|
20
23
|
export { default as EffectsPanel, useHasEffectsPanel } from './effects-panel';
|
|
21
24
|
export { default as FiltersPanel, useHasFiltersPanel } from './filters-panel';
|
|
25
|
+
export { default as AdvancedPanel } from './advanced-panel';
|
|
26
|
+
export { areGlobalStyleConfigsEqual } from './utils';
|
|
@@ -41,3 +41,17 @@
|
|
|
41
41
|
height: 24px;
|
|
42
42
|
width: 24px;
|
|
43
43
|
}
|
|
44
|
+
|
|
45
|
+
.block-editor-global-styles-advanced-panel__custom-css-input textarea {
|
|
46
|
+
font-family: $editor_html_font;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.block-editor-global-styles-advanced-panel__custom-css-validation-wrapper {
|
|
50
|
+
position: absolute;
|
|
51
|
+
bottom: $grid-unit-20;
|
|
52
|
+
right: $grid-unit * 3;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.block-editor-global-styles-advanced-panel__custom-css-validation-icon {
|
|
56
|
+
fill: $alert-red;
|
|
57
|
+
}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Internal dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
areGlobalStyleConfigsEqual,
|
|
6
|
+
getPresetVariableFromValue,
|
|
7
|
+
getValueFromVariable,
|
|
8
|
+
} from '../utils';
|
|
5
9
|
|
|
6
10
|
describe( 'editor utils', () => {
|
|
7
11
|
const themeJson = {
|
|
@@ -203,4 +207,56 @@ describe( 'editor utils', () => {
|
|
|
203
207
|
} );
|
|
204
208
|
} );
|
|
205
209
|
} );
|
|
210
|
+
|
|
211
|
+
describe( 'areGlobalStyleConfigsEqual', () => {
|
|
212
|
+
test.each( [
|
|
213
|
+
{ original: null, variation: null, expected: true },
|
|
214
|
+
{ original: {}, variation: {}, expected: true },
|
|
215
|
+
{ original: {}, variation: undefined, expected: false },
|
|
216
|
+
{
|
|
217
|
+
original: {
|
|
218
|
+
styles: {
|
|
219
|
+
color: { text: 'var(--wp--preset--color--red)' },
|
|
220
|
+
},
|
|
221
|
+
},
|
|
222
|
+
variation: {
|
|
223
|
+
styles: {
|
|
224
|
+
color: { text: 'var(--wp--preset--color--blue)' },
|
|
225
|
+
},
|
|
226
|
+
},
|
|
227
|
+
expected: false,
|
|
228
|
+
},
|
|
229
|
+
{ original: {}, variation: undefined, expected: false },
|
|
230
|
+
{
|
|
231
|
+
original: {
|
|
232
|
+
styles: {
|
|
233
|
+
color: { text: 'var(--wp--preset--color--red)' },
|
|
234
|
+
},
|
|
235
|
+
settings: {
|
|
236
|
+
typography: {
|
|
237
|
+
fontSize: true,
|
|
238
|
+
},
|
|
239
|
+
},
|
|
240
|
+
},
|
|
241
|
+
variation: {
|
|
242
|
+
styles: {
|
|
243
|
+
color: { text: 'var(--wp--preset--color--red)' },
|
|
244
|
+
},
|
|
245
|
+
settings: {
|
|
246
|
+
typography: {
|
|
247
|
+
fontSize: true,
|
|
248
|
+
},
|
|
249
|
+
},
|
|
250
|
+
},
|
|
251
|
+
expected: true,
|
|
252
|
+
},
|
|
253
|
+
] )(
|
|
254
|
+
'.areGlobalStyleConfigsEqual( $original, $variation )',
|
|
255
|
+
( { original, variation, expected } ) => {
|
|
256
|
+
expect(
|
|
257
|
+
areGlobalStyleConfigsEqual( original, variation )
|
|
258
|
+
).toBe( expected );
|
|
259
|
+
}
|
|
260
|
+
);
|
|
261
|
+
} );
|
|
206
262
|
} );
|
|
@@ -238,7 +238,7 @@ export default function TypographyPanel( {
|
|
|
238
238
|
)
|
|
239
239
|
);
|
|
240
240
|
};
|
|
241
|
-
const hasLineHeight = () =>
|
|
241
|
+
const hasLineHeight = () => value?.typography?.lineHeight !== undefined;
|
|
242
242
|
const resetLineHeight = () => setLineHeight( undefined );
|
|
243
243
|
|
|
244
244
|
// Letter Spacing
|
|
@@ -1106,9 +1106,17 @@ const processCSSNesting = ( css, blockSelector ) => {
|
|
|
1106
1106
|
return processedCSS;
|
|
1107
1107
|
};
|
|
1108
1108
|
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1109
|
+
/**
|
|
1110
|
+
* Returns the global styles output using a global styles configuration.
|
|
1111
|
+
* If wishing to generate global styles and settings based on the
|
|
1112
|
+
* global styles config loaded in the editor context, use `useGlobalStylesOutput()`.
|
|
1113
|
+
* The use case for a custom config is to generate bespoke styles
|
|
1114
|
+
* and settings for previews, or other out-of-editor experiences.
|
|
1115
|
+
*
|
|
1116
|
+
* @param {Object} mergedConfig Global styles configuration.
|
|
1117
|
+
* @return {Array} Array of stylesheets and settings.
|
|
1118
|
+
*/
|
|
1119
|
+
export function useGlobalStylesOutputWithConfig( mergedConfig = {} ) {
|
|
1112
1120
|
const [ blockGap ] = useGlobalSetting( 'spacing.blockGap' );
|
|
1113
1121
|
const hasBlockGapSupport = blockGap !== null;
|
|
1114
1122
|
const hasFallbackGapSupport = ! hasBlockGapSupport; // This setting isn't useful yet: it exists as a placeholder for a future explicit fallback styles support.
|
|
@@ -1190,3 +1198,13 @@ export function useGlobalStylesOutput() {
|
|
|
1190
1198
|
disableLayoutStyles,
|
|
1191
1199
|
] );
|
|
1192
1200
|
}
|
|
1201
|
+
|
|
1202
|
+
/**
|
|
1203
|
+
* Returns the global styles output based on the current state of global styles config loaded in the editor context.
|
|
1204
|
+
*
|
|
1205
|
+
* @return {Array} Array of stylesheets and settings.
|
|
1206
|
+
*/
|
|
1207
|
+
export function useGlobalStylesOutput() {
|
|
1208
|
+
const { merged: mergedConfig } = useContext( GlobalStylesContext );
|
|
1209
|
+
return useGlobalStylesOutputWithConfig( mergedConfig );
|
|
1210
|
+
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { get } from 'lodash';
|
|
5
|
+
import fastDeepEqual from 'fast-deep-equal/es6';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Internal dependencies
|
|
@@ -376,3 +377,29 @@ export function scopeSelector( scope, selector ) {
|
|
|
376
377
|
|
|
377
378
|
return selectorsScoped.join( ', ' );
|
|
378
379
|
}
|
|
380
|
+
|
|
381
|
+
/**
|
|
382
|
+
* Compares global style variations according to their styles and settings properties.
|
|
383
|
+
*
|
|
384
|
+
* @example
|
|
385
|
+
* ```js
|
|
386
|
+
* const globalStyles = { styles: { typography: { fontSize: '10px' } }, settings: {} };
|
|
387
|
+
* const variation = { styles: { typography: { fontSize: '10000px' } }, settings: {} };
|
|
388
|
+
* const isEqual = areGlobalStyleConfigsEqual( globalStyles, variation );
|
|
389
|
+
* // false
|
|
390
|
+
* ```
|
|
391
|
+
*
|
|
392
|
+
* @param {Object} original A global styles object.
|
|
393
|
+
* @param {Object} variation A global styles object.
|
|
394
|
+
*
|
|
395
|
+
* @return {boolean} Whether `original` and `variation` match.
|
|
396
|
+
*/
|
|
397
|
+
export function areGlobalStyleConfigsEqual( original, variation ) {
|
|
398
|
+
if ( typeof original !== 'object' || typeof variation !== 'object' ) {
|
|
399
|
+
return original === variation;
|
|
400
|
+
}
|
|
401
|
+
return (
|
|
402
|
+
fastDeepEqual( original?.styles, variation?.styles ) &&
|
|
403
|
+
fastDeepEqual( original?.settings, variation?.settings )
|
|
404
|
+
);
|
|
405
|
+
}
|
|
@@ -32,24 +32,35 @@ export default function useSaveImage( {
|
|
|
32
32
|
const apply = useCallback( () => {
|
|
33
33
|
setIsInProgress( true );
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
const modifiers = [];
|
|
36
|
+
|
|
37
|
+
if ( rotation > 0 ) {
|
|
38
|
+
modifiers.push( {
|
|
39
|
+
type: 'rotate',
|
|
40
|
+
args: {
|
|
41
|
+
angle: rotation,
|
|
42
|
+
},
|
|
43
|
+
} );
|
|
44
|
+
}
|
|
36
45
|
|
|
37
46
|
// The crop script may return some very small, sub-pixel values when the image was not cropped.
|
|
38
47
|
// Crop only when the new size has changed by more than 0.1%.
|
|
39
48
|
if ( crop.width < 99.9 || crop.height < 99.9 ) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
49
|
+
modifiers.push( {
|
|
50
|
+
type: 'crop',
|
|
51
|
+
args: {
|
|
52
|
+
left: crop.x,
|
|
53
|
+
top: crop.y,
|
|
54
|
+
width: crop.width,
|
|
55
|
+
height: crop.height,
|
|
56
|
+
},
|
|
57
|
+
} );
|
|
45
58
|
}
|
|
46
59
|
|
|
47
|
-
attrs.src = url;
|
|
48
|
-
|
|
49
60
|
apiFetch( {
|
|
50
61
|
path: `/wp/v2/media/${ id }/edit`,
|
|
51
62
|
method: 'POST',
|
|
52
|
-
data:
|
|
63
|
+
data: { src: url, modifiers },
|
|
53
64
|
} )
|
|
54
65
|
.then( ( response ) => {
|
|
55
66
|
onSaveImage( {
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { Draggable } from '@wordpress/components';
|
|
5
|
+
import { serialize } from '@wordpress/blocks';
|
|
5
6
|
/**
|
|
6
7
|
* Internal dependencies
|
|
7
8
|
*/
|
|
@@ -23,6 +24,9 @@ const InserterDraggableBlocks = ( {
|
|
|
23
24
|
<Draggable
|
|
24
25
|
__experimentalTransferDataType="wp-blocks"
|
|
25
26
|
transferData={ transferData }
|
|
27
|
+
onDragStart={ ( event ) => {
|
|
28
|
+
event.dataTransfer.setData( 'text/html', serialize( blocks ) );
|
|
29
|
+
} }
|
|
26
30
|
__experimentalDragComponent={
|
|
27
31
|
<BlockDraggableChip
|
|
28
32
|
count={ blocks.length }
|
|
@@ -41,7 +41,7 @@ export default function InspectorControlsFill( {
|
|
|
41
41
|
const isDisplayed = useDisplayBlockControls();
|
|
42
42
|
const Fill = groups[ group ]?.Fill;
|
|
43
43
|
if ( ! Fill ) {
|
|
44
|
-
warning( `Unknown
|
|
44
|
+
warning( `Unknown InspectorControls group "${ group }" provided.` );
|
|
45
45
|
return null;
|
|
46
46
|
}
|
|
47
47
|
if ( ! isDisplayed ) {
|
|
@@ -39,7 +39,7 @@ export default function InspectorControlsFill( {
|
|
|
39
39
|
|
|
40
40
|
const Fill = groups[ group ]?.Fill;
|
|
41
41
|
if ( ! Fill ) {
|
|
42
|
-
warning( `Unknown
|
|
42
|
+
warning( `Unknown InspectorControls group "${ group }" provided.` );
|
|
43
43
|
return null;
|
|
44
44
|
}
|
|
45
45
|
if ( ! isDisplayed ) {
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
5
|
-
__experimentalUseSlot as useSlot,
|
|
6
|
-
__experimentalUseSlotFills as useSlotFills,
|
|
7
|
-
} from '@wordpress/components';
|
|
4
|
+
import { __experimentalUseSlotFills as useSlotFills } from '@wordpress/components';
|
|
8
5
|
import warning from '@wordpress/warning';
|
|
9
6
|
import deprecated from '@wordpress/deprecated';
|
|
10
7
|
|
|
@@ -33,15 +30,13 @@ export default function InspectorControlsSlot( {
|
|
|
33
30
|
group = __experimentalGroup;
|
|
34
31
|
}
|
|
35
32
|
const Slot = groups[ group ]?.Slot;
|
|
36
|
-
const slot = useSlot( Slot?.__unstableName );
|
|
37
33
|
const fills = useSlotFills( Slot?.__unstableName );
|
|
38
|
-
if ( ! Slot
|
|
39
|
-
warning( `Unknown
|
|
34
|
+
if ( ! Slot ) {
|
|
35
|
+
warning( `Unknown InspectorControls group "${ group }" provided.` );
|
|
40
36
|
return null;
|
|
41
37
|
}
|
|
42
38
|
|
|
43
|
-
|
|
44
|
-
if ( ! hasFills ) {
|
|
39
|
+
if ( ! fills?.length ) {
|
|
45
40
|
return null;
|
|
46
41
|
}
|
|
47
42
|
|
|
@@ -27,7 +27,7 @@ export default function InspectorControlsSlot( {
|
|
|
27
27
|
}
|
|
28
28
|
const Slot = groups[ group ]?.Slot;
|
|
29
29
|
if ( ! Slot ) {
|
|
30
|
-
warning( `Unknown
|
|
30
|
+
warning( `Unknown InspectorControls group "${ group }" provided.` );
|
|
31
31
|
return null;
|
|
32
32
|
}
|
|
33
33
|
|
|
@@ -85,12 +85,17 @@ const LineHeightControl = ( {
|
|
|
85
85
|
: { marginBottom: 24 };
|
|
86
86
|
|
|
87
87
|
const handleOnChange = ( nextValue, { event } ) => {
|
|
88
|
+
if ( nextValue === '' ) {
|
|
89
|
+
onChange();
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
|
|
88
93
|
if ( event.type === 'click' ) {
|
|
89
|
-
onChange( adjustNextValue( nextValue
|
|
94
|
+
onChange( adjustNextValue( `${ nextValue }`, false ) );
|
|
90
95
|
return;
|
|
91
96
|
}
|
|
92
97
|
|
|
93
|
-
onChange( nextValue );
|
|
98
|
+
onChange( `${ nextValue }` );
|
|
94
99
|
};
|
|
95
100
|
|
|
96
101
|
return (
|
|
@@ -23,7 +23,7 @@ const Template = ( props ) => {
|
|
|
23
23
|
export const Default = Template.bind( {} );
|
|
24
24
|
Default.args = {
|
|
25
25
|
__nextHasNoMarginBottom: true,
|
|
26
|
-
__unstableInputWidth: '
|
|
26
|
+
__unstableInputWidth: '100px',
|
|
27
27
|
};
|
|
28
28
|
|
|
29
29
|
export const UnconstrainedWidth = Template.bind( {} );
|
|
@@ -2235,6 +2235,48 @@ describe( 'Controlling link title text', () => {
|
|
|
2235
2235
|
screen.queryByRole( 'textbox', { name: 'Text' } )
|
|
2236
2236
|
).not.toBeInTheDocument();
|
|
2237
2237
|
} );
|
|
2238
|
+
|
|
2239
|
+
it( 'should reset state on value change', async () => {
|
|
2240
|
+
const user = userEvent.setup();
|
|
2241
|
+
const textValue = 'My new text value';
|
|
2242
|
+
const mockOnChange = jest.fn();
|
|
2243
|
+
|
|
2244
|
+
const { rerender } = render(
|
|
2245
|
+
<LinkControl
|
|
2246
|
+
value={ selectedLink }
|
|
2247
|
+
forceIsEditingLink
|
|
2248
|
+
hasTextControl
|
|
2249
|
+
onChange={ mockOnChange }
|
|
2250
|
+
/>
|
|
2251
|
+
);
|
|
2252
|
+
|
|
2253
|
+
await toggleSettingsDrawer( user );
|
|
2254
|
+
|
|
2255
|
+
const textInput = screen.queryByRole( 'textbox', { name: 'Text' } );
|
|
2256
|
+
|
|
2257
|
+
expect( textInput ).toBeVisible();
|
|
2258
|
+
|
|
2259
|
+
await user.clear( textInput );
|
|
2260
|
+
await user.keyboard( textValue );
|
|
2261
|
+
|
|
2262
|
+
// Was originally title: 'Hello Page', but we've changed it.
|
|
2263
|
+
rerender(
|
|
2264
|
+
<LinkControl
|
|
2265
|
+
value={ {
|
|
2266
|
+
...selectedLink,
|
|
2267
|
+
title: 'Something else',
|
|
2268
|
+
} }
|
|
2269
|
+
forceIsEditingLink
|
|
2270
|
+
hasTextControl
|
|
2271
|
+
onChange={ mockOnChange }
|
|
2272
|
+
/>
|
|
2273
|
+
);
|
|
2274
|
+
|
|
2275
|
+
// The text input should not be showing as the form is submitted.
|
|
2276
|
+
expect( screen.queryByRole( 'textbox', { name: 'Text' } ) ).toHaveValue(
|
|
2277
|
+
'Something else'
|
|
2278
|
+
);
|
|
2279
|
+
} );
|
|
2238
2280
|
} );
|
|
2239
2281
|
|
|
2240
2282
|
async function toggleSettingsDrawer( user ) {
|
|
@@ -8,14 +8,15 @@ export default function useInternalInputValue( value ) {
|
|
|
8
8
|
value || ''
|
|
9
9
|
);
|
|
10
10
|
|
|
11
|
+
// If the value prop changes, update the internal state.
|
|
11
12
|
useEffect( () => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
13
|
+
setInternalInputValue( ( prevValue ) => {
|
|
14
|
+
if ( value && value !== prevValue ) {
|
|
15
|
+
return value;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return prevValue;
|
|
19
|
+
} );
|
|
19
20
|
}, [ value ] );
|
|
20
21
|
|
|
21
22
|
return [ internalInputValue, setInternalInputValue ];
|
|
@@ -15,6 +15,7 @@ import { forwardRef } from '@wordpress/element';
|
|
|
15
15
|
import ListViewBlockSelectButton from './block-select-button';
|
|
16
16
|
import BlockDraggable from '../block-draggable';
|
|
17
17
|
import { store as blockEditorStore } from '../../store';
|
|
18
|
+
import { useListViewContext } from './context';
|
|
18
19
|
|
|
19
20
|
const ListViewBlockContents = forwardRef(
|
|
20
21
|
(
|
|
@@ -46,6 +47,8 @@ const ListViewBlockContents = forwardRef(
|
|
|
46
47
|
[ clientId ]
|
|
47
48
|
);
|
|
48
49
|
|
|
50
|
+
const { renderAdditionalBlockUI } = useListViewContext();
|
|
51
|
+
|
|
49
52
|
const isBlockMoveTarget =
|
|
50
53
|
blockMovingClientId && selectedBlockInBlockEditor === clientId;
|
|
51
54
|
|
|
@@ -62,26 +65,29 @@ const ListViewBlockContents = forwardRef(
|
|
|
62
65
|
: [ clientId ];
|
|
63
66
|
|
|
64
67
|
return (
|
|
65
|
-
|
|
66
|
-
{
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
68
|
+
<>
|
|
69
|
+
{ renderAdditionalBlockUI && renderAdditionalBlockUI( block ) }
|
|
70
|
+
<BlockDraggable clientIds={ draggableClientIds }>
|
|
71
|
+
{ ( { draggable, onDragStart, onDragEnd } ) => (
|
|
72
|
+
<ListViewBlockSelectButton
|
|
73
|
+
ref={ ref }
|
|
74
|
+
className={ className }
|
|
75
|
+
block={ block }
|
|
76
|
+
onClick={ onClick }
|
|
77
|
+
onToggleExpanded={ onToggleExpanded }
|
|
78
|
+
isSelected={ isSelected }
|
|
79
|
+
position={ position }
|
|
80
|
+
siblingBlockCount={ siblingBlockCount }
|
|
81
|
+
level={ level }
|
|
82
|
+
draggable={ draggable }
|
|
83
|
+
onDragStart={ onDragStart }
|
|
84
|
+
onDragEnd={ onDragEnd }
|
|
85
|
+
isExpanded={ isExpanded }
|
|
86
|
+
{ ...props }
|
|
87
|
+
/>
|
|
88
|
+
) }
|
|
89
|
+
</BlockDraggable>
|
|
90
|
+
</>
|
|
85
91
|
);
|
|
86
92
|
}
|
|
87
93
|
);
|
|
@@ -84,7 +84,11 @@ function ListViewBlockSelectButton(
|
|
|
84
84
|
aria-expanded={ isExpanded }
|
|
85
85
|
>
|
|
86
86
|
<ListViewExpander onClick={ onToggleExpanded } />
|
|
87
|
-
<BlockIcon
|
|
87
|
+
<BlockIcon
|
|
88
|
+
icon={ blockInformation?.icon }
|
|
89
|
+
showColors
|
|
90
|
+
context="list-view"
|
|
91
|
+
/>
|
|
88
92
|
<HStack
|
|
89
93
|
alignment="center"
|
|
90
94
|
className="block-editor-list-view-block-select-button__label-wrapper"
|
|
@@ -40,7 +40,7 @@ import useBlockDisplayInformation from '../use-block-display-information';
|
|
|
40
40
|
import { useBlockLock } from '../block-lock';
|
|
41
41
|
|
|
42
42
|
function ListViewBlock( {
|
|
43
|
-
block,
|
|
43
|
+
block: { clientId },
|
|
44
44
|
isDragged,
|
|
45
45
|
isSelected,
|
|
46
46
|
isBranchSelected,
|
|
@@ -58,7 +58,6 @@ function ListViewBlock( {
|
|
|
58
58
|
const cellRef = useRef( null );
|
|
59
59
|
const rowRef = useRef( null );
|
|
60
60
|
const [ isHovered, setIsHovered ] = useState( false );
|
|
61
|
-
const { clientId } = block;
|
|
62
61
|
|
|
63
62
|
const { isLocked, isContentLocked, canEdit } = useBlockLock( clientId );
|
|
64
63
|
const forceSelectionContentLock = useSelect(
|
|
@@ -90,6 +89,10 @@ function ListViewBlock( {
|
|
|
90
89
|
|
|
91
90
|
const blockInformation = useBlockDisplayInformation( clientId );
|
|
92
91
|
const blockTitle = blockInformation?.title || __( 'Untitled' );
|
|
92
|
+
const block = useSelect(
|
|
93
|
+
( select ) => select( blockEditorStore ).getBlock( clientId ),
|
|
94
|
+
[ clientId ]
|
|
95
|
+
);
|
|
93
96
|
const blockName = useSelect(
|
|
94
97
|
( select ) => select( blockEditorStore ).getBlockName( clientId ),
|
|
95
98
|
[ clientId ]
|