@wordpress/block-editor 14.2.0 → 14.2.1-next.5368f64a9.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/build/components/block-breadcrumb/index.js +4 -10
- package/build/components/block-breadcrumb/index.js.map +1 -1
- package/build/components/block-compare/block-view.js +2 -4
- package/build/components/block-compare/block-view.js.map +1 -1
- package/build/components/block-edit/multiple-usage-warning.js +4 -8
- package/build/components/block-edit/multiple-usage-warning.js.map +1 -1
- package/build/components/block-inspector/index.js +0 -2
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list/block-invalid-warning.js +2 -4
- package/build/components/block-list/block-invalid-warning.js.map +1 -1
- package/build/components/block-list/index.js +14 -3
- package/build/components/block-list/index.js.map +1 -1
- package/build/components/block-list/use-block-props/use-zoom-out-mode-exit.js +7 -0
- package/build/components/block-list/use-block-props/use-zoom-out-mode-exit.js.map +1 -1
- package/build/components/block-list/zoom-out-separator.js +98 -0
- package/build/components/block-list/zoom-out-separator.js.map +1 -0
- package/build/components/block-mover/button.js +2 -4
- package/build/components/block-mover/button.js.map +1 -1
- package/build/components/block-mover/index.js +2 -4
- package/build/components/block-mover/index.js.map +1 -1
- package/build/components/block-pattern-setup/index.js +2 -7
- package/build/components/block-pattern-setup/index.js.map +1 -1
- package/build/components/block-patterns-list/index.js +2 -7
- package/build/components/block-patterns-list/index.js.map +1 -1
- package/build/components/block-switcher/index.js +8 -2
- package/build/components/block-switcher/index.js.map +1 -1
- package/build/components/block-switcher/pattern-transformations-menu.js +2 -7
- package/build/components/block-switcher/pattern-transformations-menu.js.map +1 -1
- package/build/components/block-toolbar/index.js +10 -4
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-tools/index.js +1 -1
- package/build/components/block-tools/index.js.map +1 -1
- package/build/components/block-tools/zoom-out-mode-inserters.js +3 -12
- package/build/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
- package/build/components/block-tools/zoom-out-toolbar.js +13 -3
- package/build/components/block-tools/zoom-out-toolbar.js.map +1 -1
- package/build/components/button-block-appender/index.js +7 -21
- package/build/components/button-block-appender/index.js.map +1 -1
- package/build/components/global-styles/shadow-panel-components.js +2 -11
- package/build/components/global-styles/shadow-panel-components.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/inserter/block-patterns-tab/pattern-category-previews.js +23 -13
- package/build/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
- package/build/components/inserter/index.js +4 -11
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/inserter/media-tab/media-list.js +1 -5
- package/build/components/inserter/media-tab/media-list.js.map +1 -1
- package/build/components/inserter/media-tab/media-preview.js +1 -5
- package/build/components/inserter/media-tab/media-preview.js.map +1 -1
- package/build/components/inserter/quick-inserter.js +0 -4
- package/build/components/inserter/quick-inserter.js.map +1 -1
- package/build/components/inserter-listbox/index.js +2 -8
- package/build/components/inserter-listbox/index.js.map +1 -1
- package/build/components/inserter-listbox/item.js +2 -10
- package/build/components/inserter-listbox/item.js.map +1 -1
- package/build/components/inserter-listbox/row.js +1 -9
- package/build/components/inserter-listbox/row.js.map +1 -1
- package/build/components/list-view/index.js +3 -7
- package/build/components/list-view/index.js.map +1 -1
- package/build/components/media-placeholder/index.js +4 -4
- package/build/components/media-placeholder/index.js.map +1 -1
- package/build/components/use-block-drop-zone/index.js +27 -1
- package/build/components/use-block-drop-zone/index.js.map +1 -1
- package/build/hooks/layout.js +0 -1
- package/build/hooks/layout.js.map +1 -1
- package/build/layouts/constrained.js +5 -6
- package/build/layouts/constrained.js.map +1 -1
- package/build/layouts/grid.js +19 -16
- package/build/layouts/grid.js.map +1 -1
- package/build/private-apis.js +0 -2
- package/build/private-apis.js.map +1 -1
- package/build/store/private-selectors.js +3 -3
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +0 -2
- package/build/store/reducer.js.map +1 -1
- package/build-module/components/block-breadcrumb/index.js +4 -10
- package/build-module/components/block-breadcrumb/index.js.map +1 -1
- package/build-module/components/block-compare/block-view.js +2 -4
- package/build-module/components/block-compare/block-view.js.map +1 -1
- package/build-module/components/block-edit/multiple-usage-warning.js +4 -8
- package/build-module/components/block-edit/multiple-usage-warning.js.map +1 -1
- package/build-module/components/block-inspector/index.js +0 -2
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list/block-invalid-warning.js +2 -4
- package/build-module/components/block-list/block-invalid-warning.js.map +1 -1
- package/build-module/components/block-list/index.js +14 -3
- package/build-module/components/block-list/index.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-zoom-out-mode-exit.js +8 -1
- package/build-module/components/block-list/use-block-props/use-zoom-out-mode-exit.js.map +1 -1
- package/build-module/components/block-list/zoom-out-separator.js +90 -0
- package/build-module/components/block-list/zoom-out-separator.js.map +1 -0
- package/build-module/components/block-mover/button.js +2 -4
- package/build-module/components/block-mover/button.js.map +1 -1
- package/build-module/components/block-mover/index.js +2 -4
- package/build-module/components/block-mover/index.js.map +1 -1
- package/build-module/components/block-pattern-setup/index.js +2 -7
- package/build-module/components/block-pattern-setup/index.js.map +1 -1
- package/build-module/components/block-patterns-list/index.js +2 -7
- package/build-module/components/block-patterns-list/index.js.map +1 -1
- package/build-module/components/block-switcher/index.js +8 -2
- package/build-module/components/block-switcher/index.js.map +1 -1
- package/build-module/components/block-switcher/pattern-transformations-menu.js +2 -7
- package/build-module/components/block-switcher/pattern-transformations-menu.js.map +1 -1
- package/build-module/components/block-toolbar/index.js +10 -4
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-tools/index.js +1 -1
- package/build-module/components/block-tools/index.js.map +1 -1
- package/build-module/components/block-tools/zoom-out-mode-inserters.js +3 -13
- package/build-module/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
- package/build-module/components/block-tools/zoom-out-toolbar.js +13 -3
- package/build-module/components/block-tools/zoom-out-toolbar.js.map +1 -1
- package/build-module/components/button-block-appender/index.js +8 -23
- package/build-module/components/button-block-appender/index.js.map +1 -1
- package/build-module/components/global-styles/shadow-panel-components.js +2 -11
- package/build-module/components/global-styles/shadow-panel-components.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/inserter/block-patterns-tab/pattern-category-previews.js +23 -13
- package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
- package/build-module/components/inserter/index.js +4 -11
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-list.js +1 -5
- package/build-module/components/inserter/media-tab/media-list.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-preview.js +2 -6
- package/build-module/components/inserter/media-tab/media-preview.js.map +1 -1
- package/build-module/components/inserter/quick-inserter.js +1 -5
- package/build-module/components/inserter/quick-inserter.js.map +1 -1
- package/build-module/components/inserter-listbox/index.js +1 -5
- package/build-module/components/inserter-listbox/index.js.map +1 -1
- package/build-module/components/inserter-listbox/item.js +3 -11
- package/build-module/components/inserter-listbox/item.js.map +1 -1
- package/build-module/components/inserter-listbox/row.js +2 -10
- package/build-module/components/inserter-listbox/row.js.map +1 -1
- package/build-module/components/list-view/index.js +3 -7
- package/build-module/components/list-view/index.js.map +1 -1
- package/build-module/components/media-placeholder/index.js +4 -4
- package/build-module/components/media-placeholder/index.js.map +1 -1
- package/build-module/components/use-block-drop-zone/index.js +27 -1
- package/build-module/components/use-block-drop-zone/index.js.map +1 -1
- package/build-module/hooks/layout.js +0 -1
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/layouts/constrained.js +7 -8
- package/build-module/layouts/constrained.js.map +1 -1
- package/build-module/layouts/grid.js +21 -18
- package/build-module/layouts/grid.js.map +1 -1
- package/build-module/private-apis.js +0 -2
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/private-selectors.js +3 -3
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +0 -2
- package/build-module/store/reducer.js.map +1 -1
- package/build-style/content-rtl.css +17 -0
- package/build-style/content.css +17 -0
- package/build-style/style-rtl.css +13 -73
- package/build-style/style.css +13 -73
- package/package.json +32 -32
- package/src/components/block-breadcrumb/index.js +2 -6
- package/src/components/block-breadcrumb/style.scss +1 -30
- package/src/components/block-compare/block-view.js +1 -2
- package/src/components/block-compare/test/__snapshots__/block-view.js.snap +1 -1
- package/src/components/block-edit/multiple-usage-warning.js +2 -4
- package/src/components/block-inspector/index.js +0 -1
- package/src/components/block-inspector/style.scss +2 -4
- package/src/components/block-list/block-invalid-warning.js +1 -2
- package/src/components/block-list/content.scss +21 -0
- package/src/components/block-list/index.js +59 -38
- package/src/components/block-list/use-block-props/use-zoom-out-mode-exit.js +13 -1
- package/src/components/block-list/zoom-out-separator.js +110 -0
- package/src/components/block-mover/button.js +1 -2
- package/src/components/block-mover/index.js +1 -2
- package/src/components/block-pattern-setup/index.js +3 -11
- package/src/components/block-patterns-list/index.js +3 -8
- package/src/components/block-switcher/index.js +19 -3
- package/src/components/block-switcher/pattern-transformations-menu.js +3 -8
- package/src/components/block-switcher/style.scss +0 -24
- package/src/components/block-toolbar/index.js +10 -3
- package/src/components/block-toolbar/style.scss +4 -1
- package/src/components/block-tools/index.js +1 -1
- package/src/components/block-tools/zoom-out-mode-inserters.js +0 -12
- package/src/components/block-tools/zoom-out-toolbar.js +11 -0
- package/src/components/button-block-appender/index.js +16 -25
- package/src/components/global-styles/shadow-panel-components.js +2 -10
- package/src/components/iframe/get-compatibility-styles.js +6 -1
- package/src/components/inserter/block-patterns-tab/pattern-category-previews.js +32 -15
- package/src/components/inserter/index.js +4 -10
- package/src/components/inserter/media-tab/media-list.js +1 -4
- package/src/components/inserter/media-tab/media-preview.js +3 -6
- package/src/components/inserter/quick-inserter.js +1 -4
- package/src/components/inserter/style.scss +4 -0
- package/src/components/inserter-listbox/index.js +1 -4
- package/src/components/inserter-listbox/item.js +3 -13
- package/src/components/inserter-listbox/row.js +2 -9
- package/src/components/list-view/index.js +3 -8
- package/src/components/media-placeholder/README.md +2 -2
- package/src/components/media-placeholder/index.js +7 -4
- package/src/components/use-block-drop-zone/index.js +33 -1
- package/src/hooks/layout.js +0 -1
- package/src/hooks/layout.scss +6 -20
- package/src/layouts/constrained.js +9 -7
- package/src/layouts/grid.js +29 -22
- package/src/private-apis.js +0 -2
- package/src/store/private-selectors.js +6 -3
- package/src/store/reducer.js +0 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { useDispatch } from '@wordpress/data';
|
|
4
|
+
import { useSelect, useDispatch } from '@wordpress/data';
|
|
5
5
|
import { useRefEffect } from '@wordpress/compose';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -16,6 +16,10 @@ import { unlock } from '../../../lock-unlock';
|
|
|
16
16
|
* @param {string} clientId Block client ID.
|
|
17
17
|
*/
|
|
18
18
|
export function useZoomOutModeExit( { editorMode } ) {
|
|
19
|
+
const getSettings = useSelect(
|
|
20
|
+
( select ) => select( blockEditorStore ).getSettings
|
|
21
|
+
);
|
|
22
|
+
|
|
19
23
|
const { __unstableSetEditorMode } = unlock(
|
|
20
24
|
useDispatch( blockEditorStore )
|
|
21
25
|
);
|
|
@@ -29,6 +33,14 @@ export function useZoomOutModeExit( { editorMode } ) {
|
|
|
29
33
|
function onDoubleClick( event ) {
|
|
30
34
|
if ( ! event.defaultPrevented ) {
|
|
31
35
|
event.preventDefault();
|
|
36
|
+
|
|
37
|
+
const { __experimentalSetIsInserterOpened } = getSettings();
|
|
38
|
+
|
|
39
|
+
if (
|
|
40
|
+
typeof __experimentalSetIsInserterOpened === 'function'
|
|
41
|
+
) {
|
|
42
|
+
__experimentalSetIsInserterOpened( false );
|
|
43
|
+
}
|
|
32
44
|
__unstableSetEditorMode( 'edit' );
|
|
33
45
|
}
|
|
34
46
|
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import clsx from 'clsx';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* WordPress dependencies
|
|
8
|
+
*/
|
|
9
|
+
import {
|
|
10
|
+
__unstableMotion as motion,
|
|
11
|
+
__unstableAnimatePresence as AnimatePresence,
|
|
12
|
+
} from '@wordpress/components';
|
|
13
|
+
import { useReducedMotion } from '@wordpress/compose';
|
|
14
|
+
import { useSelect } from '@wordpress/data';
|
|
15
|
+
import { useState } from '@wordpress/element';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Internal dependencies
|
|
19
|
+
*/
|
|
20
|
+
import { store as blockEditorStore } from '../../store';
|
|
21
|
+
import { unlock } from '../../lock-unlock';
|
|
22
|
+
|
|
23
|
+
export function ZoomOutSeparator( {
|
|
24
|
+
clientId,
|
|
25
|
+
rootClientId = '',
|
|
26
|
+
position = 'top',
|
|
27
|
+
} ) {
|
|
28
|
+
const [ isDraggedOver, setIsDraggedOver ] = useState( false );
|
|
29
|
+
const {
|
|
30
|
+
sectionRootClientId,
|
|
31
|
+
sectionClientIds,
|
|
32
|
+
blockInsertionPoint,
|
|
33
|
+
blockInsertionPointVisible,
|
|
34
|
+
} = useSelect( ( select ) => {
|
|
35
|
+
const {
|
|
36
|
+
getBlockInsertionPoint,
|
|
37
|
+
getBlockOrder,
|
|
38
|
+
isBlockInsertionPointVisible,
|
|
39
|
+
getSectionRootClientId,
|
|
40
|
+
} = unlock( select( blockEditorStore ) );
|
|
41
|
+
|
|
42
|
+
const root = getSectionRootClientId();
|
|
43
|
+
const sectionRootClientIds = getBlockOrder( root );
|
|
44
|
+
return {
|
|
45
|
+
sectionRootClientId: root,
|
|
46
|
+
sectionClientIds: sectionRootClientIds,
|
|
47
|
+
blockOrder: getBlockOrder( root ),
|
|
48
|
+
blockInsertionPoint: getBlockInsertionPoint(),
|
|
49
|
+
blockInsertionPointVisible: isBlockInsertionPointVisible(),
|
|
50
|
+
};
|
|
51
|
+
}, [] );
|
|
52
|
+
|
|
53
|
+
const isReducedMotion = useReducedMotion();
|
|
54
|
+
|
|
55
|
+
if ( ! clientId ) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
let isVisible = false;
|
|
60
|
+
|
|
61
|
+
const isSectionBlock =
|
|
62
|
+
rootClientId === sectionRootClientId &&
|
|
63
|
+
sectionClientIds &&
|
|
64
|
+
sectionClientIds.includes( clientId );
|
|
65
|
+
|
|
66
|
+
if ( ! isSectionBlock ) {
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if ( position === 'top' ) {
|
|
71
|
+
isVisible =
|
|
72
|
+
blockInsertionPointVisible &&
|
|
73
|
+
blockInsertionPoint.index === 0 &&
|
|
74
|
+
clientId === sectionClientIds[ blockInsertionPoint.index ];
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if ( position === 'bottom' ) {
|
|
78
|
+
isVisible =
|
|
79
|
+
blockInsertionPointVisible &&
|
|
80
|
+
clientId === sectionClientIds[ blockInsertionPoint.index - 1 ];
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return (
|
|
84
|
+
<AnimatePresence>
|
|
85
|
+
{ isVisible && (
|
|
86
|
+
<motion.div
|
|
87
|
+
as="button"
|
|
88
|
+
layout={ ! isReducedMotion }
|
|
89
|
+
initial={ { height: 0 } }
|
|
90
|
+
animate={ { height: '120px' } }
|
|
91
|
+
exit={ { height: 0 } }
|
|
92
|
+
transition={ {
|
|
93
|
+
type: 'tween',
|
|
94
|
+
duration: 0.2,
|
|
95
|
+
ease: [ 0.6, 0, 0.4, 1 ],
|
|
96
|
+
} }
|
|
97
|
+
className={ clsx(
|
|
98
|
+
'block-editor-block-list__zoom-out-separator',
|
|
99
|
+
{
|
|
100
|
+
'is-dragged-over': isDraggedOver,
|
|
101
|
+
}
|
|
102
|
+
) }
|
|
103
|
+
data-is-insertion-point="true"
|
|
104
|
+
onDragOver={ () => setIsDraggedOver( true ) }
|
|
105
|
+
onDragLeave={ () => setIsDraggedOver( false ) }
|
|
106
|
+
></motion.div>
|
|
107
|
+
) }
|
|
108
|
+
</AnimatePresence>
|
|
109
|
+
);
|
|
110
|
+
}
|
|
@@ -129,8 +129,7 @@ const BlockMoverButton = forwardRef(
|
|
|
129
129
|
return (
|
|
130
130
|
<>
|
|
131
131
|
<Button
|
|
132
|
-
|
|
133
|
-
__next40pxDefaultSize={ false }
|
|
132
|
+
__next40pxDefaultSize
|
|
134
133
|
ref={ ref }
|
|
135
134
|
className={ clsx(
|
|
136
135
|
'block-editor-block-mover-button',
|
|
@@ -87,8 +87,7 @@ function BlockMover( {
|
|
|
87
87
|
<BlockDraggable clientIds={ clientIds } fadeWhenDisabled>
|
|
88
88
|
{ ( draggableProps ) => (
|
|
89
89
|
<Button
|
|
90
|
-
|
|
91
|
-
__next40pxDefaultSize={ false }
|
|
90
|
+
__next40pxDefaultSize
|
|
92
91
|
icon={ dragHandle }
|
|
93
92
|
className="block-editor-block-mover__drag-handle"
|
|
94
93
|
label={ __( 'Drag' ) }
|
|
@@ -3,10 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { useDispatch } from '@wordpress/data';
|
|
5
5
|
import { cloneBlock } from '@wordpress/blocks';
|
|
6
|
-
import {
|
|
7
|
-
VisuallyHidden,
|
|
8
|
-
privateApis as componentsPrivateApis,
|
|
9
|
-
} from '@wordpress/components';
|
|
6
|
+
import { Composite, VisuallyHidden } from '@wordpress/components';
|
|
10
7
|
|
|
11
8
|
import { useState } from '@wordpress/element';
|
|
12
9
|
import { useInstanceId } from '@wordpress/compose';
|
|
@@ -20,11 +17,6 @@ import BlockPreview from '../block-preview';
|
|
|
20
17
|
import SetupToolbar from './setup-toolbar';
|
|
21
18
|
import usePatternsSetup from './use-patterns-setup';
|
|
22
19
|
import { VIEWMODES } from './constants';
|
|
23
|
-
import { unlock } from '../../lock-unlock';
|
|
24
|
-
|
|
25
|
-
const { CompositeV2: Composite, CompositeItemV2: CompositeItem } = unlock(
|
|
26
|
-
componentsPrivateApis
|
|
27
|
-
);
|
|
28
20
|
|
|
29
21
|
const SetupContent = ( {
|
|
30
22
|
viewMode,
|
|
@@ -88,7 +80,7 @@ function BlockPattern( { pattern, onSelect, showTitles } ) {
|
|
|
88
80
|
);
|
|
89
81
|
return (
|
|
90
82
|
<div className={ `${ baseClassName }__list-item` }>
|
|
91
|
-
<
|
|
83
|
+
<Composite.Item
|
|
92
84
|
render={
|
|
93
85
|
<div
|
|
94
86
|
aria-describedby={
|
|
@@ -116,7 +108,7 @@ function BlockPattern( { pattern, onSelect, showTitles } ) {
|
|
|
116
108
|
{ description }
|
|
117
109
|
</VisuallyHidden>
|
|
118
110
|
) }
|
|
119
|
-
</
|
|
111
|
+
</Composite.Item>
|
|
120
112
|
</div>
|
|
121
113
|
);
|
|
122
114
|
}
|
|
@@ -9,9 +9,9 @@ import clsx from 'clsx';
|
|
|
9
9
|
import { cloneBlock } from '@wordpress/blocks';
|
|
10
10
|
import { useEffect, useState, forwardRef, useMemo } from '@wordpress/element';
|
|
11
11
|
import {
|
|
12
|
+
Composite,
|
|
12
13
|
VisuallyHidden,
|
|
13
14
|
Tooltip,
|
|
14
|
-
privateApis as componentsPrivateApis,
|
|
15
15
|
__experimentalHStack as HStack,
|
|
16
16
|
} from '@wordpress/components';
|
|
17
17
|
import { useInstanceId } from '@wordpress/compose';
|
|
@@ -21,16 +21,11 @@ import { Icon, symbol } from '@wordpress/icons';
|
|
|
21
21
|
/**
|
|
22
22
|
* Internal dependencies
|
|
23
23
|
*/
|
|
24
|
-
import { unlock } from '../../lock-unlock';
|
|
25
24
|
import BlockPreview from '../block-preview';
|
|
26
25
|
import InserterDraggableBlocks from '../inserter-draggable-blocks';
|
|
27
26
|
import BlockPatternsPaging from '../block-patterns-paging';
|
|
28
27
|
import { INSERTER_PATTERN_TYPES } from '../inserter/block-patterns-tab/utils';
|
|
29
28
|
|
|
30
|
-
const { CompositeV2: Composite, CompositeItemV2: CompositeItem } = unlock(
|
|
31
|
-
componentsPrivateApis
|
|
32
|
-
);
|
|
33
|
-
|
|
34
29
|
const WithToolTip = ( { showTooltip, title, children } ) => {
|
|
35
30
|
if ( showTooltip ) {
|
|
36
31
|
return <Tooltip text={ title }>{ children }</Tooltip>;
|
|
@@ -105,7 +100,7 @@ function BlockPattern( {
|
|
|
105
100
|
}
|
|
106
101
|
title={ pattern.title }
|
|
107
102
|
>
|
|
108
|
-
<
|
|
103
|
+
<Composite.Item
|
|
109
104
|
render={
|
|
110
105
|
<div
|
|
111
106
|
role="option"
|
|
@@ -174,7 +169,7 @@ function BlockPattern( {
|
|
|
174
169
|
{ pattern.description }
|
|
175
170
|
</VisuallyHidden>
|
|
176
171
|
) }
|
|
177
|
-
</
|
|
172
|
+
</Composite.Item>
|
|
178
173
|
</WithToolTip>
|
|
179
174
|
</div>
|
|
180
175
|
) }
|
|
@@ -198,6 +198,7 @@ const BlockIndicator = ( { icon, showTitle, blockTitle } ) => (
|
|
|
198
198
|
|
|
199
199
|
export const BlockSwitcher = ( { clientIds, disabled, isUsingBindings } ) => {
|
|
200
200
|
const {
|
|
201
|
+
hasContentOnlyLocking,
|
|
201
202
|
canRemove,
|
|
202
203
|
hasBlockStyles,
|
|
203
204
|
icon,
|
|
@@ -206,8 +207,12 @@ export const BlockSwitcher = ( { clientIds, disabled, isUsingBindings } ) => {
|
|
|
206
207
|
isTemplate,
|
|
207
208
|
} = useSelect(
|
|
208
209
|
( select ) => {
|
|
209
|
-
const {
|
|
210
|
-
|
|
210
|
+
const {
|
|
211
|
+
getTemplateLock,
|
|
212
|
+
getBlocksByClientId,
|
|
213
|
+
getBlockAttributes,
|
|
214
|
+
canRemoveBlocks,
|
|
215
|
+
} = select( blockEditorStore );
|
|
211
216
|
const { getBlockStyles, getBlockType, getActiveBlockVariation } =
|
|
212
217
|
select( blocksStore );
|
|
213
218
|
const _blocks = getBlocksByClientId( clientIds );
|
|
@@ -219,6 +224,7 @@ export const BlockSwitcher = ( { clientIds, disabled, isUsingBindings } ) => {
|
|
|
219
224
|
const blockType = getBlockType( firstBlockName );
|
|
220
225
|
|
|
221
226
|
let _icon;
|
|
227
|
+
let _hasTemplateLock;
|
|
222
228
|
if ( _isSingleBlockSelected ) {
|
|
223
229
|
const match = getActiveBlockVariation(
|
|
224
230
|
firstBlockName,
|
|
@@ -226,9 +232,14 @@ export const BlockSwitcher = ( { clientIds, disabled, isUsingBindings } ) => {
|
|
|
226
232
|
);
|
|
227
233
|
// Take into account active block variations.
|
|
228
234
|
_icon = match?.icon || blockType.icon;
|
|
235
|
+
_hasTemplateLock =
|
|
236
|
+
getTemplateLock( clientIds[ 0 ] ) === 'contentOnly';
|
|
229
237
|
} else {
|
|
230
238
|
const isSelectionOfSameType =
|
|
231
239
|
new Set( _blocks.map( ( { name } ) => name ) ).size === 1;
|
|
240
|
+
_hasTemplateLock = clientIds.some(
|
|
241
|
+
( id ) => getTemplateLock( id ) === 'contentOnly'
|
|
242
|
+
);
|
|
232
243
|
// When selection consists of blocks of multiple types, display an
|
|
233
244
|
// appropriate icon to communicate the non-uniformity.
|
|
234
245
|
_icon = isSelectionOfSameType ? blockType.icon : copy;
|
|
@@ -244,6 +255,7 @@ export const BlockSwitcher = ( { clientIds, disabled, isUsingBindings } ) => {
|
|
|
244
255
|
_isSingleBlockSelected && isReusableBlock( _blocks[ 0 ] ),
|
|
245
256
|
isTemplate:
|
|
246
257
|
_isSingleBlockSelected && isTemplatePart( _blocks[ 0 ] ),
|
|
258
|
+
hasContentOnlyLocking: _hasTemplateLock,
|
|
247
259
|
};
|
|
248
260
|
},
|
|
249
261
|
[ clientIds ]
|
|
@@ -252,6 +264,7 @@ export const BlockSwitcher = ( { clientIds, disabled, isUsingBindings } ) => {
|
|
|
252
264
|
clientId: clientIds?.[ 0 ],
|
|
253
265
|
maximumLength: 35,
|
|
254
266
|
} );
|
|
267
|
+
|
|
255
268
|
if ( invalidBlocks ) {
|
|
256
269
|
return null;
|
|
257
270
|
}
|
|
@@ -261,7 +274,10 @@ export const BlockSwitcher = ( { clientIds, disabled, isUsingBindings } ) => {
|
|
|
261
274
|
? blockTitle
|
|
262
275
|
: __( 'Multiple blocks selected' );
|
|
263
276
|
|
|
264
|
-
const hideDropdown =
|
|
277
|
+
const hideDropdown =
|
|
278
|
+
disabled ||
|
|
279
|
+
( ! hasBlockStyles && ! canRemove ) ||
|
|
280
|
+
hasContentOnlyLocking;
|
|
265
281
|
|
|
266
282
|
if ( hideDropdown ) {
|
|
267
283
|
return (
|
|
@@ -7,11 +7,11 @@ import { useInstanceId, useViewportMatch } from '@wordpress/compose';
|
|
|
7
7
|
import { chevronRight } from '@wordpress/icons';
|
|
8
8
|
|
|
9
9
|
import {
|
|
10
|
+
Composite,
|
|
10
11
|
MenuGroup,
|
|
11
12
|
MenuItem,
|
|
12
13
|
Popover,
|
|
13
14
|
VisuallyHidden,
|
|
14
|
-
privateApis as componentsPrivateApis,
|
|
15
15
|
} from '@wordpress/components';
|
|
16
16
|
|
|
17
17
|
/**
|
|
@@ -19,11 +19,6 @@ import {
|
|
|
19
19
|
*/
|
|
20
20
|
import BlockPreview from '../block-preview';
|
|
21
21
|
import useTransformedPatterns from './use-transformed-patterns';
|
|
22
|
-
import { unlock } from '../../lock-unlock';
|
|
23
|
-
|
|
24
|
-
const { CompositeV2: Composite, CompositeItemV2: CompositeItem } = unlock(
|
|
25
|
-
componentsPrivateApis
|
|
26
|
-
);
|
|
27
22
|
|
|
28
23
|
function PatternTransformationsMenu( {
|
|
29
24
|
blocks,
|
|
@@ -107,7 +102,7 @@ function BlockPattern( { pattern, onSelect } ) {
|
|
|
107
102
|
);
|
|
108
103
|
return (
|
|
109
104
|
<div className={ `${ baseClassName }-list__list-item` }>
|
|
110
|
-
<
|
|
105
|
+
<Composite.Item
|
|
111
106
|
render={
|
|
112
107
|
<div
|
|
113
108
|
role="option"
|
|
@@ -127,7 +122,7 @@ function BlockPattern( { pattern, onSelect } ) {
|
|
|
127
122
|
<div className={ `${ baseClassName }-list__item-title` }>
|
|
128
123
|
{ pattern.title }
|
|
129
124
|
</div>
|
|
130
|
-
</
|
|
125
|
+
</Composite.Item>
|
|
131
126
|
{ !! pattern.description && (
|
|
132
127
|
<VisuallyHidden id={ descriptionId }>
|
|
133
128
|
{ pattern.description }
|
|
@@ -55,30 +55,6 @@
|
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
// Style this the same as the block buttons in the library.
|
|
59
|
-
// Needs specificity to override the icon button.
|
|
60
|
-
.block-editor-block-toolbar .components-toolbar-group .components-button.block-editor-block-switcher__no-switcher-icon.has-icon.has-icon,
|
|
61
|
-
.block-editor-block-toolbar .components-toolbar .components-button.block-editor-block-switcher__no-switcher-icon.has-icon.has-icon,
|
|
62
|
-
.block-editor-block-toolbar .components-toolbar-group .components-button.block-editor-block-switcher__toggle.has-icon.has-icon,
|
|
63
|
-
.block-editor-block-toolbar .components-toolbar .components-button.block-editor-block-switcher__toggle.has-icon.has-icon {
|
|
64
|
-
.block-editor-block-icon {
|
|
65
|
-
height: 100%;
|
|
66
|
-
position: relative;
|
|
67
|
-
margin: 0 auto;
|
|
68
|
-
display: flex;
|
|
69
|
-
align-items: center;
|
|
70
|
-
min-width: 100%;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
// Position the focus style correctly.
|
|
74
|
-
&::before {
|
|
75
|
-
top: $grid-unit-10;
|
|
76
|
-
right: $grid-unit-10;
|
|
77
|
-
bottom: $grid-unit-10;
|
|
78
|
-
left: $grid-unit-10;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
58
|
.components-popover.block-editor-block-switcher__popover .components-popover__content {
|
|
83
59
|
min-width: 300px;
|
|
84
60
|
}
|
|
@@ -66,6 +66,7 @@ export function PrivateBlockToolbar( {
|
|
|
66
66
|
showParentSelector,
|
|
67
67
|
isUsingBindings,
|
|
68
68
|
hasParentPattern,
|
|
69
|
+
hasContentOnlyLocking,
|
|
69
70
|
} = useSelect( ( select ) => {
|
|
70
71
|
const {
|
|
71
72
|
getBlockName,
|
|
@@ -76,6 +77,7 @@ export function PrivateBlockToolbar( {
|
|
|
76
77
|
getBlockEditingMode,
|
|
77
78
|
getBlockAttributes,
|
|
78
79
|
getBlockParentsByBlockName,
|
|
80
|
+
getTemplateLock,
|
|
79
81
|
} = select( blockEditorStore );
|
|
80
82
|
const selectedBlockClientIds = getSelectedBlockClientIds();
|
|
81
83
|
const selectedBlockClientId = selectedBlockClientIds[ 0 ];
|
|
@@ -103,6 +105,10 @@ export function PrivateBlockToolbar( {
|
|
|
103
105
|
.length > 0
|
|
104
106
|
);
|
|
105
107
|
|
|
108
|
+
// If one or more selected blocks are locked, do not show the BlockGroupToolbar.
|
|
109
|
+
const _hasTemplateLock = selectedBlockClientIds.some(
|
|
110
|
+
( id ) => getTemplateLock( id ) === 'contentOnly'
|
|
111
|
+
);
|
|
106
112
|
return {
|
|
107
113
|
blockClientId: selectedBlockClientId,
|
|
108
114
|
blockClientIds: selectedBlockClientIds,
|
|
@@ -123,6 +129,7 @@ export function PrivateBlockToolbar( {
|
|
|
123
129
|
_isDefaultEditingMode,
|
|
124
130
|
isUsingBindings: _isUsingBindings,
|
|
125
131
|
hasParentPattern: _hasParentPattern,
|
|
132
|
+
hasContentOnlyLocking: _hasTemplateLock,
|
|
126
133
|
};
|
|
127
134
|
}, [] );
|
|
128
135
|
|
|
@@ -205,9 +212,9 @@ export function PrivateBlockToolbar( {
|
|
|
205
212
|
</ToolbarGroup>
|
|
206
213
|
</div>
|
|
207
214
|
) }
|
|
208
|
-
{
|
|
209
|
-
|
|
210
|
-
|
|
215
|
+
{ ! hasContentOnlyLocking &&
|
|
216
|
+
shouldShowVisualToolbar &&
|
|
217
|
+
isMultiToolbar && <BlockGroupToolbar /> }
|
|
211
218
|
{ shouldShowVisualToolbar && (
|
|
212
219
|
<>
|
|
213
220
|
<BlockControls.Slot
|
|
@@ -70,10 +70,13 @@
|
|
|
70
70
|
// Raise the specificity.
|
|
71
71
|
&.components-accessible-toolbar {
|
|
72
72
|
border: none;
|
|
73
|
-
border-bottom: $border-width solid $gray-200;
|
|
74
73
|
border-radius: 0;
|
|
75
74
|
}
|
|
76
75
|
|
|
76
|
+
&.is-unstyled {
|
|
77
|
+
box-shadow: 0 $border-width 0 0 rgba($color: #000, $alpha: 0.133); // 0.133 = $gray-200 but with alpha.
|
|
78
|
+
}
|
|
79
|
+
|
|
77
80
|
.block-editor-block-toolbar {
|
|
78
81
|
overflow: auto;
|
|
79
82
|
overflow-y: hidden;
|
|
@@ -202,7 +202,7 @@ export default function BlockTools( {
|
|
|
202
202
|
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
203
203
|
<div { ...props } onKeyDown={ onKeyDown }>
|
|
204
204
|
<InsertionPointOpenRef.Provider value={ useRef( false ) }>
|
|
205
|
-
{ ! isTyping && (
|
|
205
|
+
{ ! isTyping && ! isZoomOutMode && (
|
|
206
206
|
<InsertionPoint
|
|
207
207
|
__unstableContentRef={ __unstableContentRef }
|
|
208
208
|
/>
|
|
@@ -88,18 +88,6 @@ function ZoomOutModeInserters() {
|
|
|
88
88
|
previousClientId={ previousClientId }
|
|
89
89
|
nextClientId={ nextClientId }
|
|
90
90
|
>
|
|
91
|
-
{ shouldRenderInsertionPoint && (
|
|
92
|
-
<div
|
|
93
|
-
style={ {
|
|
94
|
-
borderRadius: '0',
|
|
95
|
-
height: '12px',
|
|
96
|
-
opacity: 1,
|
|
97
|
-
transform: 'translateY(-50%)',
|
|
98
|
-
width: '100%',
|
|
99
|
-
} }
|
|
100
|
-
className="block-editor-block-list__insertion-point-indicator"
|
|
101
|
-
/>
|
|
102
|
-
) }
|
|
103
91
|
{ ! shouldRenderInsertionPoint && (
|
|
104
92
|
<ZoomOutModeInserterButton
|
|
105
93
|
isVisible={ isSelected || isHovered }
|
|
@@ -31,7 +31,12 @@ export default function ZoomOutToolbar( { clientId, __unstableContentRef } ) {
|
|
|
31
31
|
getPreviousBlockClientId,
|
|
32
32
|
canRemoveBlock,
|
|
33
33
|
canMoveBlock,
|
|
34
|
+
getSettings,
|
|
34
35
|
} = select( blockEditorStore );
|
|
36
|
+
|
|
37
|
+
const { __experimentalSetIsInserterOpened: setIsInserterOpened } =
|
|
38
|
+
getSettings();
|
|
39
|
+
|
|
35
40
|
const { getBlockType } = select( blocksStore );
|
|
36
41
|
const { name } = getBlock( clientId );
|
|
37
42
|
const blockType = getBlockType( name );
|
|
@@ -63,6 +68,7 @@ export default function ZoomOutToolbar( { clientId, __unstableContentRef } ) {
|
|
|
63
68
|
isPrevBlockTemplatePart,
|
|
64
69
|
canRemove: canRemoveBlock( clientId ),
|
|
65
70
|
canMove: canMoveBlock( clientId ),
|
|
71
|
+
setIsInserterOpened,
|
|
66
72
|
};
|
|
67
73
|
},
|
|
68
74
|
[ clientId ]
|
|
@@ -75,6 +81,7 @@ export default function ZoomOutToolbar( { clientId, __unstableContentRef } ) {
|
|
|
75
81
|
isPrevBlockTemplatePart,
|
|
76
82
|
canRemove,
|
|
77
83
|
canMove,
|
|
84
|
+
setIsInserterOpened,
|
|
78
85
|
} = selected;
|
|
79
86
|
|
|
80
87
|
const { removeBlock, __unstableSetEditorMode } =
|
|
@@ -132,6 +139,10 @@ export default function ZoomOutToolbar( { clientId, __unstableContentRef } ) {
|
|
|
132
139
|
icon={ edit }
|
|
133
140
|
label={ __( 'Edit' ) }
|
|
134
141
|
onClick={ () => {
|
|
142
|
+
// Setting may be undefined.
|
|
143
|
+
if ( typeof setIsInserterOpened === 'function' ) {
|
|
144
|
+
setIsInserterOpened( false );
|
|
145
|
+
}
|
|
135
146
|
__unstableSetEditorMode( 'edit' );
|
|
136
147
|
__unstableContentRef.current?.focus();
|
|
137
148
|
} }
|
|
@@ -6,7 +6,7 @@ import clsx from 'clsx';
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
|
-
import { Button
|
|
9
|
+
import { Button } from '@wordpress/components';
|
|
10
10
|
import { forwardRef, useRef } from '@wordpress/element';
|
|
11
11
|
import { _x, sprintf } from '@wordpress/i18n';
|
|
12
12
|
import { Icon, plus } from '@wordpress/icons';
|
|
@@ -43,22 +43,22 @@ function ButtonBlockAppender(
|
|
|
43
43
|
blockTitle,
|
|
44
44
|
hasSingleBlockType,
|
|
45
45
|
} ) => {
|
|
46
|
-
let label;
|
|
47
|
-
if ( hasSingleBlockType ) {
|
|
48
|
-
label = sprintf(
|
|
49
|
-
// translators: %s: the name of the block when there is only one
|
|
50
|
-
_x( 'Add %s', 'directly add the only allowed block' ),
|
|
51
|
-
blockTitle
|
|
52
|
-
);
|
|
53
|
-
} else {
|
|
54
|
-
label = _x(
|
|
55
|
-
'Add block',
|
|
56
|
-
'Generic label for block inserter button'
|
|
57
|
-
);
|
|
58
|
-
}
|
|
59
46
|
const isToggleButton = ! hasSingleBlockType;
|
|
47
|
+
const label = hasSingleBlockType
|
|
48
|
+
? sprintf(
|
|
49
|
+
// translators: %s: the name of the block when there is only one
|
|
50
|
+
_x(
|
|
51
|
+
'Add %s',
|
|
52
|
+
'directly add the only allowed block'
|
|
53
|
+
),
|
|
54
|
+
blockTitle
|
|
55
|
+
)
|
|
56
|
+
: _x(
|
|
57
|
+
'Add block',
|
|
58
|
+
'Generic label for block inserter button'
|
|
59
|
+
);
|
|
60
60
|
|
|
61
|
-
|
|
61
|
+
return (
|
|
62
62
|
<Button
|
|
63
63
|
// TODO: Switch to `true` (40px size) if possible
|
|
64
64
|
__next40pxDefaultSize={ false }
|
|
@@ -76,20 +76,11 @@ function ButtonBlockAppender(
|
|
|
76
76
|
// eslint-disable-next-line no-restricted-syntax
|
|
77
77
|
disabled={ disabled }
|
|
78
78
|
label={ label }
|
|
79
|
+
showTooltip
|
|
79
80
|
>
|
|
80
|
-
{ ! hasSingleBlockType && (
|
|
81
|
-
<VisuallyHidden as="span">{ label }</VisuallyHidden>
|
|
82
|
-
) }
|
|
83
81
|
<Icon icon={ plus } />
|
|
84
82
|
</Button>
|
|
85
83
|
);
|
|
86
|
-
|
|
87
|
-
if ( isToggleButton || hasSingleBlockType ) {
|
|
88
|
-
inserterButton = (
|
|
89
|
-
<Tooltip text={ label }>{ inserterButton }</Tooltip>
|
|
90
|
-
);
|
|
91
|
-
}
|
|
92
|
-
return inserterButton;
|
|
93
84
|
} }
|
|
94
85
|
isAppender
|
|
95
86
|
/>
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
Button,
|
|
11
11
|
FlexItem,
|
|
12
12
|
Dropdown,
|
|
13
|
-
|
|
13
|
+
Composite,
|
|
14
14
|
} from '@wordpress/components';
|
|
15
15
|
import { useMemo } from '@wordpress/element';
|
|
16
16
|
import { shadow as shadowIcon, Icon, check } from '@wordpress/icons';
|
|
@@ -20,11 +20,6 @@ import { shadow as shadowIcon, Icon, check } from '@wordpress/icons';
|
|
|
20
20
|
*/
|
|
21
21
|
import clsx from 'clsx';
|
|
22
22
|
|
|
23
|
-
/**
|
|
24
|
-
* Internal dependencies
|
|
25
|
-
*/
|
|
26
|
-
import { unlock } from '../../lock-unlock';
|
|
27
|
-
|
|
28
23
|
/**
|
|
29
24
|
* Shared reference to an empty array for cases where it is important to avoid
|
|
30
25
|
* returning a new array reference on every invocation.
|
|
@@ -32,9 +27,6 @@ import { unlock } from '../../lock-unlock';
|
|
|
32
27
|
* @type {Array}
|
|
33
28
|
*/
|
|
34
29
|
const EMPTY_ARRAY = [];
|
|
35
|
-
const { CompositeItemV2: CompositeItem, CompositeV2: Composite } = unlock(
|
|
36
|
-
componentsPrivateApis
|
|
37
|
-
);
|
|
38
30
|
|
|
39
31
|
export function ShadowPopoverContainer( { shadow, onShadowChange, settings } ) {
|
|
40
32
|
const shadows = useShadowPresets( settings );
|
|
@@ -88,7 +80,7 @@ export function ShadowPresets( { presets, activeShadow, onSelect } ) {
|
|
|
88
80
|
|
|
89
81
|
export function ShadowIndicator( { type, label, isActive, onSelect, shadow } ) {
|
|
90
82
|
return (
|
|
91
|
-
<
|
|
83
|
+
<Composite.Item
|
|
92
84
|
role="option"
|
|
93
85
|
aria-label={ label }
|
|
94
86
|
aria-selected={ isActive }
|
|
@@ -40,7 +40,12 @@ export function getCompatibilityStyles() {
|
|
|
40
40
|
// Don't try to add the reset styles, which were removed as a dependency
|
|
41
41
|
// from `edit-blocks` for the iframe since we don't need to reset admin
|
|
42
42
|
// styles.
|
|
43
|
-
if (
|
|
43
|
+
if (
|
|
44
|
+
[
|
|
45
|
+
'wp-reset-editor-styles-css',
|
|
46
|
+
'wp-reset-editor-styles-rtl-css',
|
|
47
|
+
].includes( ownerNode.id )
|
|
48
|
+
) {
|
|
44
49
|
return accumulator;
|
|
45
50
|
}
|
|
46
51
|
|