@wordpress/block-editor 14.10.1 → 14.12.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 +5 -1
- package/build/components/background-image-control/index.js +0 -1
- package/build/components/background-image-control/index.js.map +1 -1
- package/build/components/block-actions/index.js +0 -3
- package/build/components/block-actions/index.js.map +1 -1
- package/build/components/block-inspector/index.js +6 -11
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list/use-block-props/use-focus-handler.js +1 -1
- package/build/components/block-list/use-block-props/use-focus-handler.js.map +1 -1
- package/build/components/block-rename/modal.js +36 -11
- package/build/components/block-rename/modal.js.map +1 -1
- package/build/components/block-rename/rename-control.js +2 -43
- package/build/components/block-rename/rename-control.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +12 -3
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-styles/preview.native.js +1 -1
- package/build/components/block-styles/preview.native.js.map +1 -1
- package/build/components/block-switcher/block-transformations-menu.js +7 -7
- package/build/components/block-switcher/block-transformations-menu.js.map +1 -1
- package/build/components/block-switcher/block-variation-transformations.js +2 -2
- package/build/components/block-switcher/block-variation-transformations.js.map +1 -1
- package/build/components/block-switcher/index.js +1 -1
- package/build/components/block-switcher/index.js.map +1 -1
- package/build/components/block-switcher/use-transformed-patterns.js +1 -1
- package/build/components/block-switcher/use-transformed-patterns.js.map +1 -1
- package/build/components/block-toolbar/index.native.js +2 -2
- package/build/components/block-toolbar/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/global-styles/filters-panel.js +2 -2
- package/build/components/global-styles/filters-panel.js.map +1 -1
- package/build/components/global-styles/image-settings-panel.js +2 -2
- package/build/components/global-styles/image-settings-panel.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +3 -3
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/grid/grid-visualizer.js +11 -19
- package/build/components/grid/grid-visualizer.js.map +1 -1
- package/build/components/grid/utils.js +6 -4
- package/build/components/grid/utils.js.map +1 -1
- package/build/components/iframe/get-compatibility-styles.js +1 -1
- package/build/components/iframe/get-compatibility-styles.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 +2 -1
- package/build/components/image-size-control/index.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/patterns-filter.js +1 -1
- package/build/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
- package/build/components/inserter/menu.js +13 -2
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/reusable-blocks-tab.native.js +1 -1
- package/build/components/inserter/reusable-blocks-tab.native.js.map +1 -1
- package/build/components/inspector-controls-tabs/position-controls-panel.js +49 -21
- package/build/components/inspector-controls-tabs/position-controls-panel.js.map +1 -1
- package/build/components/line-height-control/index.native.js +1 -1
- package/build/components/line-height-control/index.native.js.map +1 -1
- package/build/components/link-control/index.js +1 -1
- package/build/components/link-control/index.js.map +1 -1
- package/build/components/link-control/use-search-handler.js +1 -1
- package/build/components/link-control/use-search-handler.js.map +1 -1
- package/build/components/list-view/block-select-button.js +5 -2
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/media-placeholder/index.js +1 -0
- package/build/components/media-placeholder/index.js.map +1 -1
- package/build/components/observe-typing/index.js +1 -1
- package/build/components/observe-typing/index.js.map +1 -1
- package/build/components/provider/index.js +0 -2
- package/build/components/provider/index.js.map +1 -1
- package/build/components/provider/use-block-sync.js +2 -2
- package/build/components/provider/use-block-sync.js.map +1 -1
- package/build/components/rich-text/event-listeners/input-rules.js +3 -3
- package/build/components/rich-text/event-listeners/input-rules.js.map +1 -1
- package/build/components/rich-text/native/use-format-types.js +1 -1
- package/build/components/rich-text/native/use-format-types.js.map +1 -1
- package/build/components/rich-text/use-format-types.js +1 -1
- package/build/components/rich-text/use-format-types.js.map +1 -1
- package/build/components/spacing-sizes-control/index.js +44 -2
- package/build/components/spacing-sizes-control/index.js.map +1 -1
- package/build/components/spacing-sizes-control/linked-button.js +6 -9
- package/build/components/spacing-sizes-control/linked-button.js.map +1 -1
- package/build/components/spacing-sizes-control/utils.js +0 -108
- package/build/components/spacing-sizes-control/utils.js.map +1 -1
- package/build/components/tabbed-sidebar/index.js +39 -0
- package/build/components/tabbed-sidebar/index.js.map +1 -1
- package/build/components/typewriter/index.js +1 -1
- package/build/components/typewriter/index.js.map +1 -1
- package/build/components/url-popover/image-url-input-ui.js +3 -3
- package/build/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build/components/use-block-commands/index.js +1 -1
- package/build/components/use-block-commands/index.js.map +1 -1
- package/build/components/use-moving-animation/index.js +1 -1
- package/build/components/use-moving-animation/index.js.map +1 -1
- package/build/hooks/contrast-checker.js +41 -22
- package/build/hooks/contrast-checker.js.map +1 -1
- package/build/hooks/custom-class-name.js +2 -1
- package/build/hooks/custom-class-name.js.map +1 -1
- package/build/store/actions.js +1 -1
- package/build/store/actions.js.map +1 -1
- package/build/store/selectors.js +18 -7
- package/build/store/selectors.js.map +1 -1
- package/build/utils/transform-styles/index.js +1 -1
- package/build/utils/transform-styles/index.js.map +1 -1
- package/build/utils/use-notify-copy.js +19 -11
- package/build/utils/use-notify-copy.js.map +1 -1
- package/build-module/components/background-image-control/index.js +0 -1
- package/build-module/components/background-image-control/index.js.map +1 -1
- package/build-module/components/block-actions/index.js +0 -3
- package/build-module/components/block-actions/index.js.map +1 -1
- package/build-module/components/block-inspector/index.js +6 -11
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-focus-handler.js +1 -1
- package/build-module/components/block-list/use-block-props/use-focus-handler.js.map +1 -1
- package/build-module/components/block-rename/modal.js +36 -11
- package/build-module/components/block-rename/modal.js.map +1 -1
- package/build-module/components/block-rename/rename-control.js +2 -43
- package/build-module/components/block-rename/rename-control.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +12 -3
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-styles/preview.native.js +1 -1
- package/build-module/components/block-styles/preview.native.js.map +1 -1
- package/build-module/components/block-switcher/block-transformations-menu.js +7 -7
- package/build-module/components/block-switcher/block-transformations-menu.js.map +1 -1
- package/build-module/components/block-switcher/block-variation-transformations.js +2 -2
- package/build-module/components/block-switcher/block-variation-transformations.js.map +1 -1
- package/build-module/components/block-switcher/index.js +1 -1
- package/build-module/components/block-switcher/index.js.map +1 -1
- package/build-module/components/block-switcher/use-transformed-patterns.js +1 -1
- package/build-module/components/block-switcher/use-transformed-patterns.js.map +1 -1
- package/build-module/components/block-toolbar/index.native.js +2 -2
- package/build-module/components/block-toolbar/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/global-styles/filters-panel.js +2 -2
- package/build-module/components/global-styles/filters-panel.js.map +1 -1
- package/build-module/components/global-styles/image-settings-panel.js +2 -2
- package/build-module/components/global-styles/image-settings-panel.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +3 -3
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/grid/grid-visualizer.js +11 -19
- package/build-module/components/grid/grid-visualizer.js.map +1 -1
- package/build-module/components/grid/utils.js +6 -4
- package/build-module/components/grid/utils.js.map +1 -1
- package/build-module/components/iframe/get-compatibility-styles.js +1 -1
- package/build-module/components/iframe/get-compatibility-styles.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 +3 -2
- package/build-module/components/image-size-control/index.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/patterns-filter.js +1 -1
- package/build-module/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
- package/build-module/components/inserter/menu.js +13 -2
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/reusable-blocks-tab.native.js +1 -1
- package/build-module/components/inserter/reusable-blocks-tab.native.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/position-controls-panel.js +51 -23
- package/build-module/components/inspector-controls-tabs/position-controls-panel.js.map +1 -1
- package/build-module/components/line-height-control/index.native.js +1 -1
- package/build-module/components/line-height-control/index.native.js.map +1 -1
- package/build-module/components/link-control/index.js +1 -1
- package/build-module/components/link-control/index.js.map +1 -1
- package/build-module/components/link-control/use-search-handler.js +1 -1
- package/build-module/components/link-control/use-search-handler.js.map +1 -1
- package/build-module/components/list-view/block-select-button.js +6 -3
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/media-placeholder/index.js +1 -0
- package/build-module/components/media-placeholder/index.js.map +1 -1
- package/build-module/components/observe-typing/index.js +1 -1
- package/build-module/components/observe-typing/index.js.map +1 -1
- package/build-module/components/provider/index.js +0 -1
- package/build-module/components/provider/index.js.map +1 -1
- package/build-module/components/provider/use-block-sync.js +2 -2
- package/build-module/components/provider/use-block-sync.js.map +1 -1
- package/build-module/components/rich-text/event-listeners/input-rules.js +3 -3
- package/build-module/components/rich-text/event-listeners/input-rules.js.map +1 -1
- package/build-module/components/rich-text/native/use-format-types.js +1 -1
- package/build-module/components/rich-text/native/use-format-types.js.map +1 -1
- package/build-module/components/rich-text/use-format-types.js +1 -1
- package/build-module/components/rich-text/use-format-types.js.map +1 -1
- package/build-module/components/spacing-sizes-control/index.js +45 -1
- package/build-module/components/spacing-sizes-control/index.js.map +1 -1
- package/build-module/components/spacing-sizes-control/linked-button.js +7 -10
- package/build-module/components/spacing-sizes-control/linked-button.js.map +1 -1
- package/build-module/components/spacing-sizes-control/utils.js +0 -104
- package/build-module/components/spacing-sizes-control/utils.js.map +1 -1
- package/build-module/components/tabbed-sidebar/index.js +39 -0
- package/build-module/components/tabbed-sidebar/index.js.map +1 -1
- package/build-module/components/typewriter/index.js +1 -1
- package/build-module/components/typewriter/index.js.map +1 -1
- package/build-module/components/url-popover/image-url-input-ui.js +3 -3
- package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build-module/components/use-block-commands/index.js +1 -1
- package/build-module/components/use-block-commands/index.js.map +1 -1
- package/build-module/components/use-moving-animation/index.js +1 -1
- package/build-module/components/use-moving-animation/index.js.map +1 -1
- package/build-module/hooks/contrast-checker.js +42 -23
- package/build-module/hooks/contrast-checker.js.map +1 -1
- package/build-module/hooks/custom-class-name.js +2 -1
- package/build-module/hooks/custom-class-name.js.map +1 -1
- package/build-module/store/actions.js +1 -1
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/selectors.js +18 -7
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/transform-styles/index.js +1 -1
- package/build-module/utils/transform-styles/index.js.map +1 -1
- package/build-module/utils/use-notify-copy.js +19 -11
- package/build-module/utils/use-notify-copy.js.map +1 -1
- package/build-style/content-rtl.css +0 -9
- package/build-style/content.css +0 -9
- package/build-style/style-rtl.css +19 -21
- package/build-style/style.css +19 -21
- package/package.json +34 -33
- package/src/components/background-image-control/index.js +0 -1
- package/src/components/block-actions/index.js +0 -3
- package/src/components/block-icon/content.scss +1 -1
- package/src/components/{block-card → block-icon}/stories/index.story.js +16 -26
- package/src/components/block-icon/style.scss +1 -1
- package/src/components/block-inspector/index.js +7 -10
- package/src/components/block-list/use-block-props/use-focus-handler.js +1 -1
- package/src/components/block-preview/style.scss +1 -1
- package/src/components/block-rename/modal.js +40 -12
- package/src/components/block-rename/rename-control.js +1 -53
- package/src/components/block-settings-menu/block-settings-dropdown.js +16 -2
- package/src/components/block-styles/preview.native.js +1 -1
- package/src/components/block-switcher/block-transformations-menu.js +9 -9
- package/src/components/block-switcher/block-variation-transformations.js +2 -2
- package/src/components/block-switcher/index.js +1 -1
- package/src/components/block-switcher/use-transformed-patterns.js +1 -1
- package/src/components/block-toolbar/index.native.js +2 -2
- package/src/components/color-palette/test/__snapshots__/control.js.snap +1 -1
- package/src/components/colors-gradients/style.scss +1 -0
- package/src/components/colors-gradients/test/control.js +2 -2
- package/src/components/date-format-picker/index.js +1 -1
- package/src/components/duotone-control/style.scss +2 -2
- package/src/components/global-styles/filters-panel.js +4 -2
- package/src/components/global-styles/image-settings-panel.js +2 -2
- package/src/components/global-styles/test/typography-utils.js +1 -1
- package/src/components/global-styles/use-global-styles-output.js +3 -3
- package/src/components/grid/grid-visualizer.js +10 -21
- package/src/components/grid/style.scss +1 -0
- package/src/components/grid/utils.js +6 -4
- package/src/components/iframe/get-compatibility-styles.js +1 -1
- package/src/components/iframe/index.js +1 -1
- package/src/components/image-size-control/index.js +6 -2
- package/src/components/inner-blocks/README.md +1 -1
- package/src/components/inserter/block-patterns-tab/patterns-filter.js +1 -1
- package/src/components/inserter/menu.js +11 -9
- package/src/components/inserter/reusable-blocks-tab.native.js +1 -1
- package/src/components/inspector-controls-tabs/position-controls-panel.js +62 -27
- package/src/components/line-height-control/index.native.js +1 -1
- package/src/components/link-control/README.md +2 -2
- package/src/components/link-control/index.js +1 -1
- package/src/components/link-control/test/index.js +3 -3
- package/src/components/link-control/use-search-handler.js +1 -1
- package/src/components/list-view/README.md +1 -1
- package/src/components/list-view/block-select-button.js +5 -5
- package/src/components/list-view/style.scss +3 -7
- package/src/components/media-placeholder/content.scss +0 -8
- package/src/components/media-placeholder/index.js +1 -0
- package/src/components/media-placeholder/style.scss +7 -0
- package/src/components/observe-typing/index.js +1 -1
- package/src/components/provider/index.js +0 -1
- package/src/components/provider/use-block-sync.js +2 -2
- package/src/components/resolution-tool/stories/index.story.js +52 -2
- package/src/components/rich-text/README.md +1 -1
- package/src/components/rich-text/event-listeners/input-rules.js +3 -3
- package/src/components/rich-text/native/use-format-types.js +1 -1
- package/src/components/rich-text/use-format-types.js +1 -1
- package/src/components/spacing-sizes-control/README.md +93 -0
- package/src/components/spacing-sizes-control/index.js +44 -1
- package/src/components/spacing-sizes-control/linked-button.js +8 -10
- package/src/components/spacing-sizes-control/test/utils.js +0 -151
- package/src/components/spacing-sizes-control/utils.js +0 -106
- package/src/components/tabbed-sidebar/README.md +24 -13
- package/src/components/tabbed-sidebar/index.js +38 -0
- package/src/components/tabbed-sidebar/stories/index.story.js +104 -0
- package/src/components/typewriter/index.js +1 -1
- package/src/components/unit-control/README.md +1 -1
- package/src/components/unit-control/stories/index.story.js +124 -0
- package/src/components/url-popover/image-url-input-ui.js +3 -3
- package/src/components/use-block-commands/index.js +1 -1
- package/src/components/use-moving-animation/index.js +1 -1
- package/src/components/use-settings/README.md +1 -1
- package/src/components/warning/content.scss +1 -1
- package/src/components/writing-flow/test/index.js +1 -1
- package/src/hooks/color.scss +0 -7
- package/src/hooks/contrast-checker.js +64 -30
- package/src/hooks/custom-class-name.js +2 -1
- package/src/store/actions.js +1 -1
- package/src/store/selectors.js +20 -12
- package/src/store/test/private-selectors.js +1 -1
- package/src/store/test/selectors.js +3 -3
- package/src/style.scss +1 -0
- package/src/utils/test/sorting.js +1 -1
- package/src/utils/transform-styles/index.js +1 -1
- package/src/utils/use-notify-copy.js +51 -43
- package/tsconfig.json +1 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// These rules ensure the preview scales smoothly regardless of the container size.
|
|
2
2
|
.block-editor-block-preview__container {
|
|
3
|
-
// In the component, a top padding is provided as an inline style to
|
|
3
|
+
// In the component, a top padding is provided as an inline style to provide an aspect-ratio.
|
|
4
4
|
// This positioning enables the content to sit on top of that padding to fit.
|
|
5
5
|
position: relative;
|
|
6
6
|
|
|
@@ -11,24 +11,44 @@ import {
|
|
|
11
11
|
import { __, sprintf } from '@wordpress/i18n';
|
|
12
12
|
import { useState } from '@wordpress/element';
|
|
13
13
|
import { speak } from '@wordpress/a11y';
|
|
14
|
+
import { useSelect, useDispatch } from '@wordpress/data';
|
|
14
15
|
|
|
15
16
|
/**
|
|
16
17
|
* Internal dependencies
|
|
17
18
|
*/
|
|
19
|
+
import { store as blockEditorStore } from '../../store';
|
|
20
|
+
import { useBlockDisplayInformation } from '..';
|
|
18
21
|
import isEmptyString from './is-empty-string';
|
|
19
22
|
|
|
20
|
-
export default function BlockRenameModal( {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
export default function BlockRenameModal( { clientId, onClose } ) {
|
|
24
|
+
const [ editedBlockName, setEditedBlockName ] = useState();
|
|
25
|
+
|
|
26
|
+
const blockInformation = useBlockDisplayInformation( clientId );
|
|
27
|
+
const { metadata } = useSelect(
|
|
28
|
+
( select ) => {
|
|
29
|
+
const { getBlockAttributes } = select( blockEditorStore );
|
|
30
|
+
|
|
31
|
+
return {
|
|
32
|
+
metadata: getBlockAttributes( clientId )?.metadata,
|
|
33
|
+
};
|
|
34
|
+
},
|
|
35
|
+
[ clientId ]
|
|
36
|
+
);
|
|
37
|
+
const { updateBlockAttributes } = useDispatch( blockEditorStore );
|
|
38
|
+
|
|
39
|
+
const blockName = metadata?.name || '';
|
|
40
|
+
const originalBlockName = blockInformation?.title;
|
|
25
41
|
// Pattern Overrides is a WordPress-only feature but it also uses the Block Binding API.
|
|
26
42
|
// Ideally this should not be inside the block editor package, but we keep it here for simplicity.
|
|
27
|
-
hasOverridesWarning
|
|
28
|
-
|
|
29
|
-
|
|
43
|
+
const hasOverridesWarning =
|
|
44
|
+
!! blockName &&
|
|
45
|
+
!! metadata?.bindings &&
|
|
46
|
+
Object.values( metadata.bindings ).some(
|
|
47
|
+
( binding ) => binding.source === 'core/pattern-overrides'
|
|
48
|
+
);
|
|
30
49
|
|
|
31
|
-
const nameHasChanged =
|
|
50
|
+
const nameHasChanged =
|
|
51
|
+
editedBlockName !== undefined && editedBlockName !== blockName;
|
|
32
52
|
const nameIsOriginal = editedBlockName === originalBlockName;
|
|
33
53
|
const nameIsEmpty = isEmptyString( editedBlockName );
|
|
34
54
|
|
|
@@ -37,6 +57,8 @@ export default function BlockRenameModal( {
|
|
|
37
57
|
const autoSelectInputText = ( event ) => event.target.select();
|
|
38
58
|
|
|
39
59
|
const handleSubmit = () => {
|
|
60
|
+
const newName =
|
|
61
|
+
nameIsOriginal || nameIsEmpty ? undefined : editedBlockName;
|
|
40
62
|
const message =
|
|
41
63
|
nameIsOriginal || nameIsEmpty
|
|
42
64
|
? sprintf(
|
|
@@ -52,7 +74,12 @@ export default function BlockRenameModal( {
|
|
|
52
74
|
|
|
53
75
|
// Must be assertive to immediately announce change.
|
|
54
76
|
speak( message, 'assertive' );
|
|
55
|
-
|
|
77
|
+
updateBlockAttributes( [ clientId ], {
|
|
78
|
+
metadata: {
|
|
79
|
+
...metadata,
|
|
80
|
+
name: newName,
|
|
81
|
+
},
|
|
82
|
+
} );
|
|
56
83
|
|
|
57
84
|
// Immediate close avoids ability to hit save multiple times.
|
|
58
85
|
onClose();
|
|
@@ -81,7 +108,7 @@ export default function BlockRenameModal( {
|
|
|
81
108
|
<TextControl
|
|
82
109
|
__nextHasNoMarginBottom
|
|
83
110
|
__next40pxDefaultSize
|
|
84
|
-
value={ editedBlockName }
|
|
111
|
+
value={ editedBlockName ?? blockName }
|
|
85
112
|
label={ __( 'Name' ) }
|
|
86
113
|
help={
|
|
87
114
|
hasOverridesWarning
|
|
@@ -105,7 +132,8 @@ export default function BlockRenameModal( {
|
|
|
105
132
|
|
|
106
133
|
<Button
|
|
107
134
|
__next40pxDefaultSize
|
|
108
|
-
|
|
135
|
+
accessibleWhenDisabled
|
|
136
|
+
disabled={ ! isNameValid }
|
|
109
137
|
variant="primary"
|
|
110
138
|
type="submit"
|
|
111
139
|
>
|
|
@@ -2,54 +2,17 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { MenuItem } from '@wordpress/components';
|
|
5
|
-
import { useSelect, useDispatch } from '@wordpress/data';
|
|
6
5
|
import { __ } from '@wordpress/i18n';
|
|
7
6
|
import { useState } from '@wordpress/element';
|
|
8
7
|
|
|
9
8
|
/**
|
|
10
9
|
* Internal dependencies
|
|
11
10
|
*/
|
|
12
|
-
import { store as blockEditorStore } from '../../store';
|
|
13
|
-
import { useBlockDisplayInformation } from '..';
|
|
14
|
-
import isEmptyString from './is-empty-string';
|
|
15
11
|
import BlockRenameModal from './modal';
|
|
16
12
|
|
|
17
13
|
export default function BlockRenameControl( { clientId } ) {
|
|
18
14
|
const [ renamingBlock, setRenamingBlock ] = useState( false );
|
|
19
15
|
|
|
20
|
-
const { metadata } = useSelect(
|
|
21
|
-
( select ) => {
|
|
22
|
-
const { getBlockAttributes } = select( blockEditorStore );
|
|
23
|
-
|
|
24
|
-
const _metadata = getBlockAttributes( clientId )?.metadata;
|
|
25
|
-
return {
|
|
26
|
-
metadata: _metadata,
|
|
27
|
-
};
|
|
28
|
-
},
|
|
29
|
-
[ clientId ]
|
|
30
|
-
);
|
|
31
|
-
|
|
32
|
-
const { updateBlockAttributes } = useDispatch( blockEditorStore );
|
|
33
|
-
|
|
34
|
-
const customName = metadata?.name;
|
|
35
|
-
const hasPatternOverrides =
|
|
36
|
-
!! customName &&
|
|
37
|
-
!! metadata?.bindings &&
|
|
38
|
-
Object.values( metadata.bindings ).some(
|
|
39
|
-
( binding ) => binding.source === 'core/pattern-overrides'
|
|
40
|
-
);
|
|
41
|
-
|
|
42
|
-
function onChange( newName ) {
|
|
43
|
-
updateBlockAttributes( [ clientId ], {
|
|
44
|
-
metadata: {
|
|
45
|
-
...metadata,
|
|
46
|
-
name: newName,
|
|
47
|
-
},
|
|
48
|
-
} );
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
const blockInformation = useBlockDisplayInformation( clientId );
|
|
52
|
-
|
|
53
16
|
return (
|
|
54
17
|
<>
|
|
55
18
|
<MenuItem
|
|
@@ -63,23 +26,8 @@ export default function BlockRenameControl( { clientId } ) {
|
|
|
63
26
|
</MenuItem>
|
|
64
27
|
{ renamingBlock && (
|
|
65
28
|
<BlockRenameModal
|
|
66
|
-
|
|
67
|
-
originalBlockName={ blockInformation?.title }
|
|
68
|
-
hasOverridesWarning={ hasPatternOverrides }
|
|
29
|
+
clientId={ clientId }
|
|
69
30
|
onClose={ () => setRenamingBlock( false ) }
|
|
70
|
-
onSave={ ( newName ) => {
|
|
71
|
-
// If the new value is the block's original name (e.g. `Group`)
|
|
72
|
-
// or it is an empty string then assume the intent is to reset
|
|
73
|
-
// the value. Therefore reset the metadata.
|
|
74
|
-
if (
|
|
75
|
-
newName === blockInformation?.title ||
|
|
76
|
-
isEmptyString( newName )
|
|
77
|
-
) {
|
|
78
|
-
newName = undefined;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
onChange( newName );
|
|
82
|
-
} }
|
|
83
31
|
/>
|
|
84
32
|
) }
|
|
85
33
|
</>
|
|
@@ -26,17 +26,30 @@ import BlockSettingsMenuControls from '../block-settings-menu-controls';
|
|
|
26
26
|
import BlockParentSelectorMenuItem from './block-parent-selector-menu-item';
|
|
27
27
|
import { store as blockEditorStore } from '../../store';
|
|
28
28
|
import { unlock } from '../../lock-unlock';
|
|
29
|
+
import { useNotifyCopy } from '../../utils/use-notify-copy';
|
|
29
30
|
|
|
30
31
|
const POPOVER_PROPS = {
|
|
31
32
|
className: 'block-editor-block-settings-menu__popover',
|
|
32
33
|
placement: 'bottom-start',
|
|
33
34
|
};
|
|
34
35
|
|
|
35
|
-
function CopyMenuItem( {
|
|
36
|
+
function CopyMenuItem( {
|
|
37
|
+
clientIds,
|
|
38
|
+
onCopy,
|
|
39
|
+
label,
|
|
40
|
+
shortcut,
|
|
41
|
+
eventType = 'copy',
|
|
42
|
+
} ) {
|
|
36
43
|
const { getBlocksByClientId } = useSelect( blockEditorStore );
|
|
44
|
+
const notifyCopy = useNotifyCopy();
|
|
37
45
|
const ref = useCopyToClipboard(
|
|
38
46
|
() => serialize( getBlocksByClientId( clientIds ) ),
|
|
39
|
-
|
|
47
|
+
() => {
|
|
48
|
+
if ( onCopy && eventType === 'copy' ) {
|
|
49
|
+
onCopy();
|
|
50
|
+
}
|
|
51
|
+
notifyCopy( eventType, clientIds );
|
|
52
|
+
}
|
|
40
53
|
);
|
|
41
54
|
const copyMenuItemLabel = label ? label : __( 'Copy' );
|
|
42
55
|
return (
|
|
@@ -305,6 +318,7 @@ export function BlockSettingsDropdown( {
|
|
|
305
318
|
clientIds={ clientIds }
|
|
306
319
|
onCopy={ onCopy }
|
|
307
320
|
label={ __( 'Copy styles' ) }
|
|
321
|
+
eventType="copyStyles"
|
|
308
322
|
/>
|
|
309
323
|
<MenuItem onClick={ onPasteStyles }>
|
|
310
324
|
{ __( 'Paste styles' ) }
|
|
@@ -33,7 +33,7 @@ function StylePreview( { onPress, isActive, style, url } ) {
|
|
|
33
33
|
|
|
34
34
|
function onLayout() {
|
|
35
35
|
const columnsNum =
|
|
36
|
-
// To indicate scroll
|
|
36
|
+
// To indicate scroll availability, there is a need to display additional half the column.
|
|
37
37
|
Math.floor( BottomSheet.getWidth() / MAX_ITEM_WIDTH ) + HALF_COLUMN;
|
|
38
38
|
setItemWidth( BottomSheet.getWidth() / columnsNum );
|
|
39
39
|
}
|
|
@@ -27,20 +27,20 @@ import BlockVariationTransformations from './block-variation-transformations';
|
|
|
27
27
|
* @return {Record<string, Object[]>} The grouped block transformations.
|
|
28
28
|
*/
|
|
29
29
|
function useGroupedTransforms( possibleBlockTransformations ) {
|
|
30
|
-
const
|
|
30
|
+
const priorityContentTransformationBlocks = {
|
|
31
31
|
'core/paragraph': 1,
|
|
32
32
|
'core/heading': 2,
|
|
33
33
|
'core/list': 3,
|
|
34
34
|
'core/quote': 4,
|
|
35
35
|
};
|
|
36
36
|
const transformations = useMemo( () => {
|
|
37
|
-
const
|
|
38
|
-
|
|
37
|
+
const priorityTextTransformsNames = Object.keys(
|
|
38
|
+
priorityContentTransformationBlocks
|
|
39
39
|
);
|
|
40
40
|
const groupedPossibleTransforms = possibleBlockTransformations.reduce(
|
|
41
41
|
( accumulator, item ) => {
|
|
42
42
|
const { name } = item;
|
|
43
|
-
if (
|
|
43
|
+
if ( priorityTextTransformsNames.includes( name ) ) {
|
|
44
44
|
accumulator.priorityTextTransformations.push( item );
|
|
45
45
|
} else {
|
|
46
46
|
accumulator.restTransformations.push( item );
|
|
@@ -71,8 +71,8 @@ function useGroupedTransforms( possibleBlockTransformations ) {
|
|
|
71
71
|
// Order the priority text transformations.
|
|
72
72
|
transformations.priorityTextTransformations.sort(
|
|
73
73
|
( { name: currentName }, { name: nextName } ) => {
|
|
74
|
-
return
|
|
75
|
-
|
|
74
|
+
return priorityContentTransformationBlocks[ currentName ] <
|
|
75
|
+
priorityContentTransformationBlocks[ nextName ]
|
|
76
76
|
? -1
|
|
77
77
|
: 1;
|
|
78
78
|
}
|
|
@@ -125,7 +125,7 @@ const BlockTransformationsMenu = ( {
|
|
|
125
125
|
/>
|
|
126
126
|
) }
|
|
127
127
|
{ priorityTextTransformations.map( ( item ) => (
|
|
128
|
-
<
|
|
128
|
+
<BlockTransformationItem
|
|
129
129
|
key={ item.name }
|
|
130
130
|
item={ item }
|
|
131
131
|
onSelect={ onSelect }
|
|
@@ -151,7 +151,7 @@ function RestTransformationItems( {
|
|
|
151
151
|
setHoveredTransformItemName,
|
|
152
152
|
} ) {
|
|
153
153
|
return restTransformations.map( ( item ) => (
|
|
154
|
-
<
|
|
154
|
+
<BlockTransformationItem
|
|
155
155
|
key={ item.name }
|
|
156
156
|
item={ item }
|
|
157
157
|
onSelect={ onSelect }
|
|
@@ -160,7 +160,7 @@ function RestTransformationItems( {
|
|
|
160
160
|
) );
|
|
161
161
|
}
|
|
162
162
|
|
|
163
|
-
function
|
|
163
|
+
function BlockTransformationItem( {
|
|
164
164
|
item,
|
|
165
165
|
onSelect,
|
|
166
166
|
setHoveredTransformItemName,
|
|
@@ -74,7 +74,7 @@ const BlockVariationTransformations = ( {
|
|
|
74
74
|
/>
|
|
75
75
|
) }
|
|
76
76
|
{ transformations?.map( ( item ) => (
|
|
77
|
-
<
|
|
77
|
+
<BlockVariationTransformationItem
|
|
78
78
|
key={ item.name }
|
|
79
79
|
item={ item }
|
|
80
80
|
onSelect={ onSelect }
|
|
@@ -85,7 +85,7 @@ const BlockVariationTransformations = ( {
|
|
|
85
85
|
);
|
|
86
86
|
};
|
|
87
87
|
|
|
88
|
-
function
|
|
88
|
+
function BlockVariationTransformationItem( {
|
|
89
89
|
item,
|
|
90
90
|
onSelect,
|
|
91
91
|
setHoveredTransformItemName,
|
|
@@ -82,7 +82,7 @@ function BlockSwitcherDropdownMenuContents( {
|
|
|
82
82
|
);
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
|
-
// Simple block
|
|
85
|
+
// Simple block transformation based on the `Block Transforms` API.
|
|
86
86
|
function onBlockTransform( name ) {
|
|
87
87
|
const newBlocks = switchToBlockType( blocks, name );
|
|
88
88
|
replaceBlocks( clientIds, newBlocks );
|
|
@@ -72,7 +72,7 @@ export const getPatternTransformedBlocks = (
|
|
|
72
72
|
// No need to loop through other pattern's blocks.
|
|
73
73
|
break;
|
|
74
74
|
}
|
|
75
|
-
// Bail
|
|
75
|
+
// Bail early if a selected block has not been matched.
|
|
76
76
|
if ( ! isMatch ) {
|
|
77
77
|
return;
|
|
78
78
|
}
|
|
@@ -14,7 +14,7 @@ import UngroupButton from '../ungroup-button';
|
|
|
14
14
|
import { BlockSettingsButton } from '../block-settings';
|
|
15
15
|
import { store as blockEditorStore } from '../../store';
|
|
16
16
|
|
|
17
|
-
const
|
|
17
|
+
const REMOVE_EMPTY_PARENT_BLOCKS = [
|
|
18
18
|
'core/buttons',
|
|
19
19
|
'core/columns',
|
|
20
20
|
'core/social-links',
|
|
@@ -69,7 +69,7 @@ export default function BlockToolbar( { anchorNodeRef } ) {
|
|
|
69
69
|
// have inner blocks, ideally we should match the behavior as in
|
|
70
70
|
// the Web editor and show a placeholder instead of removing the parent.
|
|
71
71
|
if (
|
|
72
|
-
|
|
72
|
+
REMOVE_EMPTY_PARENT_BLOCKS.includes( parentBlockName ) &&
|
|
73
73
|
parentNumberOfInnerBlocks === 1
|
|
74
74
|
) {
|
|
75
75
|
removeBlock( rootClientId );
|
|
@@ -217,7 +217,7 @@ exports[`ColorPaletteControl matches the snapshot 1`] = `
|
|
|
217
217
|
class="components-circular-option-picker__option-wrapper"
|
|
218
218
|
>
|
|
219
219
|
<button
|
|
220
|
-
aria-label="
|
|
220
|
+
aria-label="red"
|
|
221
221
|
aria-selected="true"
|
|
222
222
|
class="components-button components-circular-option-picker__option is-next-40px-default-size"
|
|
223
223
|
data-active-item="true"
|
|
@@ -51,7 +51,7 @@ describe( 'ColorPaletteControl', () => {
|
|
|
51
51
|
).toBeInTheDocument();
|
|
52
52
|
|
|
53
53
|
// Is showing the two predefined Colors.
|
|
54
|
-
expect( screen.
|
|
54
|
+
expect( screen.getAllByRole( 'option' ) ).toHaveLength( 2 );
|
|
55
55
|
} );
|
|
56
56
|
|
|
57
57
|
it( 'renders the color picker and does not render tabs if it is only possible to select a color', async () => {
|
|
@@ -80,7 +80,7 @@ describe( 'ColorPaletteControl', () => {
|
|
|
80
80
|
).not.toBeInTheDocument();
|
|
81
81
|
|
|
82
82
|
// Is showing the two predefined Colors.
|
|
83
|
-
expect( screen.
|
|
83
|
+
expect( screen.getAllByRole( 'option' ) ).toHaveLength( 2 );
|
|
84
84
|
} );
|
|
85
85
|
|
|
86
86
|
it( 'renders the gradient picker and does not render tabs if it is only possible to select a gradient', async () => {
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
} from '@wordpress/components';
|
|
15
15
|
|
|
16
16
|
// So that we illustrate the different formats in the dropdown properly, show a date that is
|
|
17
|
-
//
|
|
17
|
+
// somewhat recent, has a day greater than 12, and a month with more than three letters.
|
|
18
18
|
const exampleDate = new Date();
|
|
19
19
|
exampleDate.setDate( 20 );
|
|
20
20
|
exampleDate.setMonth( exampleDate.getMonth() - 3 );
|
|
@@ -4,11 +4,11 @@ $swatch-size: 28px;
|
|
|
4
4
|
$swatch-gap: 12px;
|
|
5
5
|
|
|
6
6
|
$popover-width: 260px;
|
|
7
|
-
$popover-padding: $grid-unit-
|
|
7
|
+
$popover-padding: $grid-unit-10;
|
|
8
8
|
|
|
9
9
|
$swatch-columns: math.floor(math.div($popover-width + $swatch-gap - 2 * $popover-padding, $swatch-size + $swatch-gap));
|
|
10
10
|
|
|
11
|
-
.block-editor-duotone-control__popover {
|
|
11
|
+
.block-editor-duotone-control__popover.components-popover {
|
|
12
12
|
> .components-popover__content {
|
|
13
13
|
padding: $popover-padding;
|
|
14
14
|
width: $popover-width;
|
|
@@ -144,10 +144,12 @@ export default function FiltersPanel( {
|
|
|
144
144
|
const duotonePreset = duotonePalette.find( ( { colors } ) => {
|
|
145
145
|
return colors === newValue;
|
|
146
146
|
} );
|
|
147
|
-
const
|
|
147
|
+
const duotoneValue = duotonePreset
|
|
148
148
|
? `var:preset|duotone|${ duotonePreset.slug }`
|
|
149
149
|
: newValue;
|
|
150
|
-
onChange(
|
|
150
|
+
onChange(
|
|
151
|
+
setImmutably( value, [ 'filter', 'duotone' ], duotoneValue )
|
|
152
|
+
);
|
|
151
153
|
};
|
|
152
154
|
const hasDuotone = () => !! value?.filter?.duotone;
|
|
153
155
|
const resetDuotone = () => setDuotone( undefined );
|
|
@@ -61,14 +61,14 @@ export default function ImageSettingsPanel( {
|
|
|
61
61
|
// "RESET" button ONLY when the user has explicitly set a value in the
|
|
62
62
|
// Global Styles.
|
|
63
63
|
hasValue={ () => !! value?.lightbox }
|
|
64
|
-
label={ __( '
|
|
64
|
+
label={ __( 'Enlarge on click' ) }
|
|
65
65
|
onDeselect={ resetLightbox }
|
|
66
66
|
isShownByDefault
|
|
67
67
|
panelId={ panelId }
|
|
68
68
|
>
|
|
69
69
|
<ToggleControl
|
|
70
70
|
__nextHasNoMarginBottom
|
|
71
|
-
label={ __( '
|
|
71
|
+
label={ __( 'Enlarge on click' ) }
|
|
72
72
|
checked={ lightboxChecked }
|
|
73
73
|
onChange={ onChangeLightbox }
|
|
74
74
|
/>
|
|
@@ -585,7 +585,7 @@ describe( 'typography utils', () => {
|
|
|
585
585
|
'clamp(14px, 0.875rem + ((1vw - 3.2px) * 0.078), 15px)',
|
|
586
586
|
},
|
|
587
587
|
|
|
588
|
-
// Equivalent custom config PHP unit tests in `
|
|
588
|
+
// Equivalent custom config PHP unit tests in `test_should_convert_font_sizes_to_fluid_values()`.
|
|
589
589
|
{
|
|
590
590
|
message: 'should return clamp value using custom fluid config',
|
|
591
591
|
preset: {
|
|
@@ -1337,12 +1337,12 @@ export function processCSSNesting( css, blockSelector ) {
|
|
|
1337
1337
|
processedCSS += `:root :where(${ blockSelector }){${ part.trim() }}`;
|
|
1338
1338
|
} else {
|
|
1339
1339
|
// If the part contains braces, it's a nested CSS rule.
|
|
1340
|
-
const
|
|
1341
|
-
if (
|
|
1340
|
+
const splitPart = part.replace( '}', '' ).split( '{' );
|
|
1341
|
+
if ( splitPart.length !== 2 ) {
|
|
1342
1342
|
return;
|
|
1343
1343
|
}
|
|
1344
1344
|
|
|
1345
|
-
const [ nestedSelector, cssValue ] =
|
|
1345
|
+
const [ nestedSelector, cssValue ] = splitPart;
|
|
1346
1346
|
|
|
1347
1347
|
// Handle pseudo elements such as ::before, ::after, etc. Regex will also
|
|
1348
1348
|
// capture any leading combinator such as >, +, or ~, as well as spaces.
|
|
@@ -54,29 +54,18 @@ const GridVisualizerGrid = forwardRef(
|
|
|
54
54
|
const [ isDroppingAllowed, setIsDroppingAllowed ] = useState( false );
|
|
55
55
|
|
|
56
56
|
useEffect( () => {
|
|
57
|
-
const
|
|
58
|
-
for ( const element of [ gridElement, ...gridElement.children ] ) {
|
|
59
|
-
const observer = new window.ResizeObserver( () => {
|
|
60
|
-
setGridInfo( getGridInfo( gridElement ) );
|
|
61
|
-
} );
|
|
62
|
-
observer.observe( element );
|
|
63
|
-
observers.push( observer );
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
const mutationObserver = new window.MutationObserver( () => {
|
|
57
|
+
const resizeCallback = () =>
|
|
67
58
|
setGridInfo( getGridInfo( gridElement ) );
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
59
|
+
// Both border-box and content-box are observed as they may change
|
|
60
|
+
// independently. This requires two observers because a single one
|
|
61
|
+
// can’t be made to monitor both on the same element.
|
|
62
|
+
const borderBoxSpy = new window.ResizeObserver( resizeCallback );
|
|
63
|
+
borderBoxSpy.observe( gridElement, { box: 'border-box' } );
|
|
64
|
+
const contentBoxSpy = new window.ResizeObserver( resizeCallback );
|
|
65
|
+
contentBoxSpy.observe( gridElement );
|
|
76
66
|
return () => {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}
|
|
67
|
+
borderBoxSpy.disconnect();
|
|
68
|
+
contentBoxSpy.disconnect();
|
|
80
69
|
};
|
|
81
70
|
}, [ gridElement ] );
|
|
82
71
|
|
|
@@ -187,10 +187,12 @@ export function getGridInfo( gridElement ) {
|
|
|
187
187
|
gridTemplateColumns,
|
|
188
188
|
gridTemplateRows,
|
|
189
189
|
gap: getComputedCSS( gridElement, 'gap' ),
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
190
|
+
inset: `
|
|
191
|
+
calc(${ paddingTop } + ${ borderTopWidth })
|
|
192
|
+
calc(${ paddingRight } + ${ borderRightWidth })
|
|
193
|
+
calc(${ paddingBottom } + ${ borderBottomWidth })
|
|
194
|
+
calc(${ paddingLeft } + ${ borderLeftWidth })
|
|
195
|
+
`,
|
|
194
196
|
},
|
|
195
197
|
};
|
|
196
198
|
}
|
|
@@ -2,7 +2,7 @@ let compatibilityStyles = null;
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Returns a list of stylesheets that target the editor canvas. A stylesheet is
|
|
5
|
-
* considered
|
|
5
|
+
* considered targeting the editor a canvas if it contains the
|
|
6
6
|
* `editor-styles-wrapper`, `wp-block`, or `wp-block-*` class selectors.
|
|
7
7
|
*
|
|
8
8
|
* Ideally, this hook should be removed in the future and styles should be added
|
|
@@ -330,7 +330,7 @@ function Iframe( {
|
|
|
330
330
|
>
|
|
331
331
|
{ iframeDocument &&
|
|
332
332
|
createPortal(
|
|
333
|
-
// We want to prevent React events from bubbling
|
|
333
|
+
// We want to prevent React events from bubbling through the iframe
|
|
334
334
|
// we bubble these manually.
|
|
335
335
|
/* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */
|
|
336
336
|
<body
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
__experimentalToggleGroupControl as ToggleGroupControl,
|
|
9
9
|
__experimentalToggleGroupControlOption as ToggleGroupControlOption,
|
|
10
10
|
} from '@wordpress/components';
|
|
11
|
-
import { __ } from '@wordpress/i18n';
|
|
11
|
+
import { __, sprintf } from '@wordpress/i18n';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Internal dependencies
|
|
@@ -137,7 +137,11 @@ export default function ImageSizeControl( {
|
|
|
137
137
|
<ToggleGroupControlOption
|
|
138
138
|
key={ scale }
|
|
139
139
|
value={ scale }
|
|
140
|
-
label={
|
|
140
|
+
label={ sprintf(
|
|
141
|
+
/* translators: Percentage value. */
|
|
142
|
+
__( '%d%%' ),
|
|
143
|
+
scale
|
|
144
|
+
) }
|
|
141
145
|
/>
|
|
142
146
|
);
|
|
143
147
|
} ) }
|
|
@@ -125,7 +125,7 @@ Template locking of `InnerBlocks` is similar to [Custom Post Type templates lock
|
|
|
125
125
|
Template locking allows locking the `InnerBlocks` area for the current template.
|
|
126
126
|
_Options:_
|
|
127
127
|
|
|
128
|
-
- `contentOnly` — prevents all operations. Additionally, the block types that don't have content are hidden from the list view and can't gain focus within the block list. Unlike the other lock types, this is not
|
|
128
|
+
- `contentOnly` — prevents all operations. Additionally, the block types that don't have content are hidden from the list view and can't gain focus within the block list. Unlike the other lock types, this is not overridable by children.
|
|
129
129
|
- `'all'` — prevents all operations. It is not possible to insert new blocks. Move existing blocks or delete them.
|
|
130
130
|
- `'insert'` — prevents inserting or removing blocks, but allows moving existing ones.
|
|
131
131
|
- `false` — prevents locking from being applied to an `InnerBlocks` area even if a parent block contains locking. ( Boolean )
|
|
@@ -57,7 +57,7 @@ export function PatternsFilter( {
|
|
|
57
57
|
} ) {
|
|
58
58
|
// If the category is `myPatterns` then we need to set the source filter to `user`, but
|
|
59
59
|
// we do this by deriving from props rather than calling setPatternSourceFilter otherwise
|
|
60
|
-
// the user may be confused when switching to another category if the haven't
|
|
60
|
+
// the user may be confused when switching to another category if the haven't explicitly set
|
|
61
61
|
// this filter themselves.
|
|
62
62
|
const currentPatternSourceFilter =
|
|
63
63
|
category?.name === myPatternsCategory.name
|
|
@@ -54,15 +54,17 @@ function InserterMenu(
|
|
|
54
54
|
},
|
|
55
55
|
ref
|
|
56
56
|
) {
|
|
57
|
-
const isZoomOutMode = useSelect(
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
57
|
+
const { isZoomOutMode, hasSectionRootClientId } = useSelect( ( select ) => {
|
|
58
|
+
const { isZoomOut, getSectionRootClientId } = unlock(
|
|
59
|
+
select( blockEditorStore )
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
return {
|
|
63
|
+
isZoomOutMode: isZoomOut(),
|
|
64
|
+
hasSectionRootClientId: !! getSectionRootClientId(),
|
|
65
|
+
};
|
|
66
|
+
}, [] );
|
|
67
|
+
|
|
66
68
|
const [ filterValue, setFilterValue, delayedFilterValue ] =
|
|
67
69
|
useDebouncedInput( __experimentalFilterValue );
|
|
68
70
|
const [ hoveredItem, setHoveredItem ] = useState( null );
|
|
@@ -29,7 +29,7 @@ function ReusableBlocksTab( { onSelect, rootClientId, listProps } ) {
|
|
|
29
29
|
return filterInserterItems( inserterItems, { onlyReusable: true } );
|
|
30
30
|
}, [ inserterItems ] );
|
|
31
31
|
|
|
32
|
-
const sections = [ createInserterSection( { key: '
|
|
32
|
+
const sections = [ createInserterSection( { key: 'reusable', items } ) ];
|
|
33
33
|
|
|
34
34
|
return (
|
|
35
35
|
<BlockTypesList
|