@wordpress/block-editor 12.19.3 → 12.20.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 +2 -0
- package/build/components/block-canvas/index.js +2 -0
- package/build/components/block-canvas/index.js.map +1 -1
- package/build/components/block-heading-level-dropdown/index.js +14 -17
- package/build/components/block-heading-level-dropdown/index.js.map +1 -1
- package/build/components/block-inspector/index.js +0 -3
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list/index.js +9 -9
- package/build/components/block-list/index.js.map +1 -1
- package/build/components/block-preview/index.js +4 -0
- package/build/components/block-preview/index.js.map +1 -1
- package/build/components/block-settings-menu/block-parent-selector-menu-item.js +54 -0
- package/build/components/block-settings-menu/block-parent-selector-menu-item.js.map +1 -0
- package/build/components/block-settings-menu/block-settings-dropdown.js +9 -37
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/child-layout-control/index.js +37 -5
- package/build/components/child-layout-control/index.js.map +1 -1
- package/build/components/date-format-picker/index.js +0 -1
- package/build/components/date-format-picker/index.js.map +1 -1
- package/build/components/font-appearance-control/index.js +1 -2
- package/build/components/font-appearance-control/index.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +30 -19
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/inspector-controls-tabs/styles-tab.js +0 -4
- package/build/components/inspector-controls-tabs/styles-tab.js.map +1 -1
- package/build/components/observe-typing/index.js +5 -10
- package/build/components/observe-typing/index.js.map +1 -1
- package/build/components/rich-text/format-toolbar-container.js +1 -31
- package/build/components/rich-text/format-toolbar-container.js.map +1 -1
- package/build/components/rich-text/index.js +1 -2
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/skip-to-selected-block/index.js +7 -14
- package/build/components/skip-to-selected-block/index.js.map +1 -1
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js +0 -1
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build/components/url-input/index.js +5 -8
- package/build/components/url-input/index.js.map +1 -1
- package/build/hooks/layout-child.js +50 -1
- package/build/hooks/layout-child.js.map +1 -1
- package/build/hooks/position.js +0 -1
- package/build/hooks/position.js.map +1 -1
- package/build/layouts/grid.js +105 -12
- package/build/layouts/grid.js.map +1 -1
- package/build/store/actions.js +2 -30
- package/build/store/actions.js.map +1 -1
- package/build-module/components/block-canvas/index.js +2 -0
- package/build-module/components/block-canvas/index.js.map +1 -1
- package/build-module/components/block-heading-level-dropdown/index.js +14 -17
- package/build-module/components/block-heading-level-dropdown/index.js.map +1 -1
- package/build-module/components/block-inspector/index.js +1 -4
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list/index.js +9 -9
- package/build-module/components/block-list/index.js.map +1 -1
- package/build-module/components/block-preview/index.js +4 -0
- package/build-module/components/block-preview/index.js.map +1 -1
- package/build-module/components/block-settings-menu/block-parent-selector-menu-item.js +46 -0
- package/build-module/components/block-settings-menu/block-parent-selector-menu-item.js.map +1 -0
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +12 -40
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/child-layout-control/index.js +38 -6
- package/build-module/components/child-layout-control/index.js.map +1 -1
- package/build-module/components/date-format-picker/index.js +0 -1
- package/build-module/components/date-format-picker/index.js.map +1 -1
- package/build-module/components/font-appearance-control/index.js +1 -2
- package/build-module/components/font-appearance-control/index.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +30 -19
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/styles-tab.js +0 -4
- package/build-module/components/inspector-controls-tabs/styles-tab.js.map +1 -1
- package/build-module/components/observe-typing/index.js +5 -10
- package/build-module/components/observe-typing/index.js.map +1 -1
- package/build-module/components/rich-text/format-toolbar-container.js +1 -31
- package/build-module/components/rich-text/format-toolbar-container.js.map +1 -1
- package/build-module/components/rich-text/index.js +1 -2
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/skip-to-selected-block/index.js +8 -14
- package/build-module/components/skip-to-selected-block/index.js.map +1 -1
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js +0 -1
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build-module/components/url-input/index.js +5 -8
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/hooks/layout-child.js +50 -1
- package/build-module/hooks/layout-child.js.map +1 -1
- package/build-module/hooks/position.js +0 -1
- package/build-module/hooks/position.js.map +1 -1
- package/build-module/layouts/grid.js +107 -14
- package/build-module/layouts/grid.js.map +1 -1
- package/build-module/store/actions.js +2 -30
- package/build-module/store/actions.js.map +1 -1
- package/build-style/style-rtl.css +12 -17
- package/build-style/style.css +12 -17
- package/package.json +31 -32
- package/src/components/block-canvas/index.js +2 -0
- package/src/components/block-heading-level-dropdown/index.js +17 -25
- package/src/components/block-inspector/index.js +0 -11
- package/src/components/block-list/index.js +55 -55
- package/src/components/block-preview/index.js +6 -1
- package/src/components/block-settings-menu/block-parent-selector-menu-item.js +50 -0
- package/src/components/block-settings-menu/block-settings-dropdown.js +9 -50
- package/src/components/block-styles/style.scss +0 -4
- package/src/components/block-toolbar/style.scss +11 -6
- package/src/components/child-layout-control/index.js +85 -44
- package/src/components/date-format-picker/index.js +0 -1
- package/src/components/font-appearance-control/index.js +0 -1
- package/src/components/global-styles/dimensions-panel.js +36 -24
- package/src/components/global-styles/test/use-global-styles-output.js +3 -2
- package/src/components/inspector-controls-tabs/styles-tab.js +0 -7
- package/src/components/observe-typing/index.js +7 -10
- package/src/components/rich-text/format-toolbar-container.js +1 -48
- package/src/components/rich-text/index.js +0 -1
- package/src/components/skip-to-selected-block/index.js +10 -13
- package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +0 -1
- package/src/components/url-input/index.js +6 -15
- package/src/hooks/anchor.scss +1 -1
- package/src/hooks/layout-child.js +53 -1
- package/src/hooks/position.js +0 -1
- package/src/layouts/grid.js +131 -52
- package/src/layouts/test/grid.js +16 -2
- package/src/store/actions.js +2 -38
- package/src/store/test/actions.js +0 -101
- package/src/style.scss +0 -1
- package/build/components/default-style-picker/index.js +0 -70
- package/build/components/default-style-picker/index.js.map +0 -1
- package/build-module/components/default-style-picker/index.js +0 -63
- package/build-module/components/default-style-picker/index.js.map +0 -1
- package/src/components/block-settings-menu/style.scss +0 -3
- package/src/components/default-style-picker/index.js +0 -70
|
@@ -9,30 +9,24 @@ import {
|
|
|
9
9
|
import { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';
|
|
10
10
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
11
11
|
import { moreVertical } from '@wordpress/icons';
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
cloneElement,
|
|
15
|
-
useCallback,
|
|
16
|
-
useRef,
|
|
17
|
-
} from '@wordpress/element';
|
|
18
|
-
import { __, sprintf } from '@wordpress/i18n';
|
|
12
|
+
import { Children, cloneElement, useCallback } from '@wordpress/element';
|
|
13
|
+
import { __ } from '@wordpress/i18n';
|
|
19
14
|
import {
|
|
20
15
|
store as keyboardShortcutsStore,
|
|
21
16
|
__unstableUseShortcutEventMatch,
|
|
22
17
|
} from '@wordpress/keyboard-shortcuts';
|
|
23
|
-
import { pipe, useCopyToClipboard
|
|
18
|
+
import { pipe, useCopyToClipboard } from '@wordpress/compose';
|
|
24
19
|
|
|
25
20
|
/**
|
|
26
21
|
* Internal dependencies
|
|
27
22
|
*/
|
|
28
23
|
import BlockActions from '../block-actions';
|
|
29
|
-
import BlockIcon from '../block-icon';
|
|
30
24
|
import BlockHTMLConvertButton from './block-html-convert-button';
|
|
31
25
|
import __unstableBlockSettingsMenuFirstItem from './block-settings-menu-first-item';
|
|
32
26
|
import BlockSettingsMenuControls from '../block-settings-menu-controls';
|
|
27
|
+
import BlockParentSelectorMenuItem from './block-parent-selector-menu-item';
|
|
33
28
|
import { store as blockEditorStore } from '../../store';
|
|
34
29
|
import { unlock } from '../../lock-unlock';
|
|
35
|
-
import { useShowHoveredOrFocusedGestures } from '../block-toolbar/utils';
|
|
36
30
|
|
|
37
31
|
const POPOVER_PROPS = {
|
|
38
32
|
className: 'block-editor-block-settings-menu__popover',
|
|
@@ -45,38 +39,6 @@ function CopyMenuItem( { blocks, onCopy, label } ) {
|
|
|
45
39
|
return <MenuItem ref={ ref }>{ copyMenuItemLabel }</MenuItem>;
|
|
46
40
|
}
|
|
47
41
|
|
|
48
|
-
function ParentSelectorMenuItem( { parentClientId, parentBlockType } ) {
|
|
49
|
-
const isSmallViewport = useViewportMatch( 'medium', '<' );
|
|
50
|
-
const { selectBlock } = useDispatch( blockEditorStore );
|
|
51
|
-
|
|
52
|
-
// Allows highlighting the parent block outline when focusing or hovering
|
|
53
|
-
// the parent block selector within the child.
|
|
54
|
-
const menuItemRef = useRef();
|
|
55
|
-
const gesturesProps = useShowHoveredOrFocusedGestures( {
|
|
56
|
-
ref: menuItemRef,
|
|
57
|
-
highlightParent: true,
|
|
58
|
-
} );
|
|
59
|
-
|
|
60
|
-
if ( ! isSmallViewport ) {
|
|
61
|
-
return null;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
return (
|
|
65
|
-
<MenuItem
|
|
66
|
-
{ ...gesturesProps }
|
|
67
|
-
ref={ menuItemRef }
|
|
68
|
-
icon={ <BlockIcon icon={ parentBlockType.icon } /> }
|
|
69
|
-
onClick={ () => selectBlock( parentClientId ) }
|
|
70
|
-
>
|
|
71
|
-
{ sprintf(
|
|
72
|
-
/* translators: %s: Name of the block's parent. */
|
|
73
|
-
__( 'Select parent block (%s)' ),
|
|
74
|
-
parentBlockType.title
|
|
75
|
-
) }
|
|
76
|
-
</MenuItem>
|
|
77
|
-
);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
42
|
export function BlockSettingsDropdown( {
|
|
81
43
|
block,
|
|
82
44
|
clientIds,
|
|
@@ -98,6 +60,7 @@ export function BlockSettingsDropdown( {
|
|
|
98
60
|
parentBlockType,
|
|
99
61
|
previousBlockClientId,
|
|
100
62
|
selectedBlockClientIds,
|
|
63
|
+
openedBlockSettingsMenu,
|
|
101
64
|
} = useSelect(
|
|
102
65
|
( select ) => {
|
|
103
66
|
const {
|
|
@@ -107,7 +70,8 @@ export function BlockSettingsDropdown( {
|
|
|
107
70
|
getPreviousBlockClientId,
|
|
108
71
|
getSelectedBlockClientIds,
|
|
109
72
|
getBlockAttributes,
|
|
110
|
-
|
|
73
|
+
getOpenedBlockSettingsMenu,
|
|
74
|
+
} = unlock( select( blockEditorStore ) );
|
|
111
75
|
|
|
112
76
|
const { getActiveBlockVariation } = select( blocksStore );
|
|
113
77
|
|
|
@@ -129,6 +93,7 @@ export function BlockSettingsDropdown( {
|
|
|
129
93
|
previousBlockClientId:
|
|
130
94
|
getPreviousBlockClientId( firstBlockClientId ),
|
|
131
95
|
selectedBlockClientIds: getSelectedBlockClientIds(),
|
|
96
|
+
openedBlockSettingsMenu: getOpenedBlockSettingsMenu(),
|
|
132
97
|
};
|
|
133
98
|
},
|
|
134
99
|
[ firstBlockClientId ]
|
|
@@ -136,12 +101,6 @@ export function BlockSettingsDropdown( {
|
|
|
136
101
|
const { getBlockOrder, getSelectedBlockClientIds } =
|
|
137
102
|
useSelect( blockEditorStore );
|
|
138
103
|
|
|
139
|
-
const openedBlockSettingsMenu = useSelect(
|
|
140
|
-
( select ) =>
|
|
141
|
-
unlock( select( blockEditorStore ) ).getOpenedBlockSettingsMenu(),
|
|
142
|
-
[]
|
|
143
|
-
);
|
|
144
|
-
|
|
145
104
|
const { setOpenedBlockSettingsMenu } = unlock(
|
|
146
105
|
useDispatch( blockEditorStore )
|
|
147
106
|
);
|
|
@@ -314,7 +273,7 @@ export function BlockSettingsDropdown( {
|
|
|
314
273
|
/>
|
|
315
274
|
{ ! parentBlockIsSelected &&
|
|
316
275
|
!! firstParentClientId && (
|
|
317
|
-
<
|
|
276
|
+
<BlockParentSelectorMenuItem
|
|
318
277
|
parentClientId={
|
|
319
278
|
firstParentClientId
|
|
320
279
|
}
|
|
@@ -207,17 +207,18 @@
|
|
|
207
207
|
}
|
|
208
208
|
}
|
|
209
209
|
|
|
210
|
-
.block-editor-block-mover
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
@include break-small() {
|
|
210
|
+
.block-editor-block-mover {
|
|
211
|
+
.block-editor-block-mover__move-button-container {
|
|
212
|
+
width: auto;
|
|
214
213
|
position: relative;
|
|
214
|
+
}
|
|
215
215
|
|
|
216
|
-
|
|
216
|
+
&:not(.is-horizontal) .block-editor-block-mover__move-button-container::before {
|
|
217
|
+
@include break-small() {
|
|
217
218
|
content: "";
|
|
218
219
|
height: $border-width;
|
|
219
220
|
width: 100%;
|
|
220
|
-
background: $gray-
|
|
221
|
+
background: $gray-200;
|
|
221
222
|
position: absolute;
|
|
222
223
|
top: 50%;
|
|
223
224
|
left: 50%;
|
|
@@ -226,6 +227,10 @@
|
|
|
226
227
|
transform: translate(-50%, 0);
|
|
227
228
|
margin-top: -$border-width * 0.5;
|
|
228
229
|
}
|
|
230
|
+
|
|
231
|
+
@include break-medium {
|
|
232
|
+
background: $gray-900;
|
|
233
|
+
}
|
|
229
234
|
}
|
|
230
235
|
}
|
|
231
236
|
|
|
@@ -5,6 +5,8 @@ import {
|
|
|
5
5
|
__experimentalToggleGroupControl as ToggleGroupControl,
|
|
6
6
|
__experimentalToggleGroupControlOption as ToggleGroupControlOption,
|
|
7
7
|
__experimentalUnitControl as UnitControl,
|
|
8
|
+
__experimentalInputControl as InputControl,
|
|
9
|
+
__experimentalHStack as HStack,
|
|
8
10
|
} from '@wordpress/components';
|
|
9
11
|
import { __ } from '@wordpress/i18n';
|
|
10
12
|
import { useEffect } from '@wordpress/element';
|
|
@@ -38,7 +40,12 @@ export default function ChildLayoutControl( {
|
|
|
38
40
|
onChange,
|
|
39
41
|
parentLayout,
|
|
40
42
|
} ) {
|
|
41
|
-
const { selfStretch, flexSize } = childLayout;
|
|
43
|
+
const { selfStretch, flexSize, columnSpan, rowSpan } = childLayout;
|
|
44
|
+
const {
|
|
45
|
+
type: parentType,
|
|
46
|
+
default: { type: defaultParentType = 'default' } = {},
|
|
47
|
+
} = parentLayout ?? {};
|
|
48
|
+
const parentLayoutType = parentType || defaultParentType;
|
|
42
49
|
|
|
43
50
|
useEffect( () => {
|
|
44
51
|
if ( selfStretch === 'fixed' && ! flexSize ) {
|
|
@@ -51,49 +58,83 @@ export default function ChildLayoutControl( {
|
|
|
51
58
|
|
|
52
59
|
return (
|
|
53
60
|
<>
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
61
|
+
{ parentLayoutType === 'flex' && (
|
|
62
|
+
<>
|
|
63
|
+
<ToggleGroupControl
|
|
64
|
+
__nextHasNoMarginBottom
|
|
65
|
+
size={ '__unstable-large' }
|
|
66
|
+
label={ childLayoutOrientation( parentLayout ) }
|
|
67
|
+
value={ selfStretch || 'fit' }
|
|
68
|
+
help={ helpText( selfStretch, parentLayout ) }
|
|
69
|
+
onChange={ ( value ) => {
|
|
70
|
+
const newFlexSize =
|
|
71
|
+
value !== 'fixed' ? null : flexSize;
|
|
72
|
+
onChange( {
|
|
73
|
+
selfStretch: value,
|
|
74
|
+
flexSize: newFlexSize,
|
|
75
|
+
} );
|
|
76
|
+
} }
|
|
77
|
+
isBlock={ true }
|
|
78
|
+
>
|
|
79
|
+
<ToggleGroupControlOption
|
|
80
|
+
key={ 'fit' }
|
|
81
|
+
value={ 'fit' }
|
|
82
|
+
label={ __( 'Fit' ) }
|
|
83
|
+
/>
|
|
84
|
+
<ToggleGroupControlOption
|
|
85
|
+
key={ 'fill' }
|
|
86
|
+
value={ 'fill' }
|
|
87
|
+
label={ __( 'Fill' ) }
|
|
88
|
+
/>
|
|
89
|
+
<ToggleGroupControlOption
|
|
90
|
+
key={ 'fixed' }
|
|
91
|
+
value={ 'fixed' }
|
|
92
|
+
label={ __( 'Fixed' ) }
|
|
93
|
+
/>
|
|
94
|
+
</ToggleGroupControl>
|
|
95
|
+
{ selfStretch === 'fixed' && (
|
|
96
|
+
<UnitControl
|
|
97
|
+
size={ '__unstable-large' }
|
|
98
|
+
onChange={ ( value ) => {
|
|
99
|
+
onChange( {
|
|
100
|
+
selfStretch,
|
|
101
|
+
flexSize: value,
|
|
102
|
+
} );
|
|
103
|
+
} }
|
|
104
|
+
value={ flexSize }
|
|
105
|
+
/>
|
|
106
|
+
) }
|
|
107
|
+
</>
|
|
108
|
+
) }
|
|
109
|
+
{ parentLayoutType === 'grid' && (
|
|
110
|
+
<HStack>
|
|
111
|
+
<InputControl
|
|
112
|
+
size={ '__unstable-large' }
|
|
113
|
+
label={ __( 'Column Span' ) }
|
|
114
|
+
type="number"
|
|
115
|
+
onChange={ ( value ) => {
|
|
116
|
+
onChange( {
|
|
117
|
+
rowSpan,
|
|
118
|
+
columnSpan: value,
|
|
119
|
+
} );
|
|
120
|
+
} }
|
|
121
|
+
value={ columnSpan }
|
|
122
|
+
min={ 1 }
|
|
123
|
+
/>
|
|
124
|
+
<InputControl
|
|
125
|
+
size={ '__unstable-large' }
|
|
126
|
+
label={ __( 'Row Span' ) }
|
|
127
|
+
type="number"
|
|
128
|
+
onChange={ ( value ) => {
|
|
129
|
+
onChange( {
|
|
130
|
+
columnSpan,
|
|
131
|
+
rowSpan: value,
|
|
132
|
+
} );
|
|
133
|
+
} }
|
|
134
|
+
value={ rowSpan }
|
|
135
|
+
min={ 1 }
|
|
136
|
+
/>
|
|
137
|
+
</HStack>
|
|
97
138
|
) }
|
|
98
139
|
</>
|
|
99
140
|
);
|
|
@@ -92,9 +92,11 @@ function useHasChildLayout( settings ) {
|
|
|
92
92
|
} = settings?.parentLayout ?? {};
|
|
93
93
|
|
|
94
94
|
const support =
|
|
95
|
-
( defaultParentLayoutType === 'flex' ||
|
|
95
|
+
( defaultParentLayoutType === 'flex' ||
|
|
96
|
+
parentLayoutType === 'flex' ||
|
|
97
|
+
defaultParentLayoutType === 'grid' ||
|
|
98
|
+
parentLayoutType === 'grid' ) &&
|
|
96
99
|
allowSizingOnChildren;
|
|
97
|
-
|
|
98
100
|
return !! settings?.layout && support;
|
|
99
101
|
}
|
|
100
102
|
|
|
@@ -395,13 +397,19 @@ export default function DimensionsPanel( {
|
|
|
395
397
|
const showChildLayoutControl = useHasChildLayout( settings );
|
|
396
398
|
const childLayout = inheritedValue?.layout;
|
|
397
399
|
const { orientation = 'horizontal' } = settings?.parentLayout ?? {};
|
|
398
|
-
const
|
|
400
|
+
const {
|
|
401
|
+
type: parentType,
|
|
402
|
+
default: { type: defaultParentType = 'default' } = {},
|
|
403
|
+
} = settings?.parentLayout ?? {};
|
|
404
|
+
const parentLayoutType = parentType || defaultParentType;
|
|
405
|
+
const flexResetLabel =
|
|
399
406
|
orientation === 'horizontal' ? __( 'Width' ) : __( 'Height' );
|
|
407
|
+
const childLayoutResetLabel =
|
|
408
|
+
parentLayoutType === 'flex' ? flexResetLabel : __( 'Grid spans' );
|
|
400
409
|
const setChildLayout = ( newChildLayout ) => {
|
|
401
410
|
onChange( {
|
|
402
411
|
...value,
|
|
403
412
|
layout: {
|
|
404
|
-
...value?.layout,
|
|
405
413
|
...newChildLayout,
|
|
406
414
|
},
|
|
407
415
|
} );
|
|
@@ -410,6 +418,8 @@ export default function DimensionsPanel( {
|
|
|
410
418
|
setChildLayout( {
|
|
411
419
|
selfStretch: undefined,
|
|
412
420
|
flexSize: undefined,
|
|
421
|
+
columnSpan: undefined,
|
|
422
|
+
rowSpan: undefined,
|
|
413
423
|
} );
|
|
414
424
|
};
|
|
415
425
|
const hasChildLayoutValue = () => !! value?.layout;
|
|
@@ -423,6 +433,8 @@ export default function DimensionsPanel( {
|
|
|
423
433
|
wideSize: undefined,
|
|
424
434
|
selfStretch: undefined,
|
|
425
435
|
flexSize: undefined,
|
|
436
|
+
columnSpan: undefined,
|
|
437
|
+
rowSpan: undefined,
|
|
426
438
|
} ),
|
|
427
439
|
spacing: {
|
|
428
440
|
...previousValue?.spacing,
|
|
@@ -637,6 +649,26 @@ export default function DimensionsPanel( {
|
|
|
637
649
|
) }
|
|
638
650
|
</ToolsPanelItem>
|
|
639
651
|
) }
|
|
652
|
+
{ showChildLayoutControl && (
|
|
653
|
+
<VStack
|
|
654
|
+
as={ ToolsPanelItem }
|
|
655
|
+
spacing={ 2 }
|
|
656
|
+
hasValue={ hasChildLayoutValue }
|
|
657
|
+
label={ childLayoutResetLabel }
|
|
658
|
+
onDeselect={ resetChildLayoutValue }
|
|
659
|
+
isShownByDefault={
|
|
660
|
+
defaultControls.childLayout ??
|
|
661
|
+
DEFAULT_CONTROLS.childLayout
|
|
662
|
+
}
|
|
663
|
+
panelId={ panelId }
|
|
664
|
+
>
|
|
665
|
+
<ChildLayoutControl
|
|
666
|
+
value={ childLayout }
|
|
667
|
+
onChange={ setChildLayout }
|
|
668
|
+
parentLayout={ settings?.parentLayout }
|
|
669
|
+
/>
|
|
670
|
+
</VStack>
|
|
671
|
+
) }
|
|
640
672
|
{ showMinHeightControl && (
|
|
641
673
|
<ToolsPanelItem
|
|
642
674
|
hasValue={ hasMinHeightValue }
|
|
@@ -666,26 +698,6 @@ export default function DimensionsPanel( {
|
|
|
666
698
|
}
|
|
667
699
|
/>
|
|
668
700
|
) }
|
|
669
|
-
{ showChildLayoutControl && (
|
|
670
|
-
<VStack
|
|
671
|
-
as={ ToolsPanelItem }
|
|
672
|
-
spacing={ 2 }
|
|
673
|
-
hasValue={ hasChildLayoutValue }
|
|
674
|
-
label={ childLayoutOrientationLabel }
|
|
675
|
-
onDeselect={ resetChildLayoutValue }
|
|
676
|
-
isShownByDefault={
|
|
677
|
-
defaultControls.childLayout ??
|
|
678
|
-
DEFAULT_CONTROLS.childLayout
|
|
679
|
-
}
|
|
680
|
-
panelId={ panelId }
|
|
681
|
-
>
|
|
682
|
-
<ChildLayoutControl
|
|
683
|
-
value={ childLayout }
|
|
684
|
-
onChange={ setChildLayout }
|
|
685
|
-
parentLayout={ settings?.parentLayout }
|
|
686
|
-
/>
|
|
687
|
-
</VStack>
|
|
688
|
-
) }
|
|
689
701
|
</Wrapper>
|
|
690
702
|
);
|
|
691
703
|
}
|
|
@@ -169,7 +169,8 @@ describe( 'global styles renderer', () => {
|
|
|
169
169
|
},
|
|
170
170
|
},
|
|
171
171
|
},
|
|
172
|
-
selector:
|
|
172
|
+
selector:
|
|
173
|
+
'.my-heading1 a:where(:not(.wp-element-button)), .my-heading2 a:where(:not(.wp-element-button))',
|
|
173
174
|
},
|
|
174
175
|
{
|
|
175
176
|
styles: {
|
|
@@ -480,7 +481,7 @@ describe( 'global styles renderer', () => {
|
|
|
480
481
|
|
|
481
482
|
expect( toStyles( tree, blockSelectors ) ).toEqual(
|
|
482
483
|
'body {margin: 0;}body .is-layout-flow > .alignleft { float: left; margin-inline-start: 0; margin-inline-end: 2em; }body .is-layout-flow > .alignright { float: right; margin-inline-start: 2em; margin-inline-end: 0; }body .is-layout-flow > .aligncenter { margin-left: auto !important; margin-right: auto !important; }body .is-layout-constrained > .alignleft { float: left; margin-inline-start: 0; margin-inline-end: 2em; }body .is-layout-constrained > .alignright { float: right; margin-inline-start: 2em; margin-inline-end: 0; }body .is-layout-constrained > .aligncenter { margin-left: auto !important; margin-right: auto !important; }body .is-layout-constrained > :where(:not(.alignleft):not(.alignright):not(.alignfull)) { max-width: var(--wp--style--global--content-size); margin-left: auto !important; margin-right: auto !important; }body .is-layout-constrained > .alignwide { max-width: var(--wp--style--global--wide-size); }body .is-layout-flex { display:flex; }body .is-layout-flex { flex-wrap: wrap; align-items: center; }body .is-layout-flex > * { margin: 0; }body .is-layout-grid { display:grid; }body .is-layout-grid > * { margin: 0; }' +
|
|
483
|
-
'body{background-color: red;margin: 10px;padding: 10px;}a{color: blue;}a:hover{color: orange;}a:focus{color: orange;}h1{font-size: 42px;}.wp-block-group{margin-top: 10px;margin-right: 20px;margin-bottom: 30px;margin-left: 40px;padding-top: 11px;padding-right: 22px;padding-bottom: 33px;padding-left: 44px;}h1,h2,h3,h4,h5,h6{color: orange;}h1 a,h2 a,h3 a,h4 a,h5 a,h6 a{color: hotpink;}h1 a:hover,h2 a:hover,h3 a:hover,h4 a:hover,h5 a:hover,h6 a:hover{color: red;}h1 a:focus,h2 a:focus,h3 a:focus,h4 a:focus,h5 a:focus,h6 a:focus{color: red;}' +
|
|
484
|
+
'body{background-color: red;margin: 10px;padding: 10px;}a:where(:not(.wp-element-button)){color: blue;}a:where(:not(.wp-element-button)):hover{color: orange;}a:where(:not(.wp-element-button)):focus{color: orange;}h1{font-size: 42px;}.wp-block-group{margin-top: 10px;margin-right: 20px;margin-bottom: 30px;margin-left: 40px;padding-top: 11px;padding-right: 22px;padding-bottom: 33px;padding-left: 44px;}h1,h2,h3,h4,h5,h6{color: orange;}h1 a:where(:not(.wp-element-button)),h2 a:where(:not(.wp-element-button)),h3 a:where(:not(.wp-element-button)),h4 a:where(:not(.wp-element-button)),h5 a:where(:not(.wp-element-button)),h6 a:where(:not(.wp-element-button)){color: hotpink;}h1 a:where(:not(.wp-element-button)):hover,h2 a:where(:not(.wp-element-button)):hover,h3 a:where(:not(.wp-element-button)):hover,h4 a:where(:not(.wp-element-button)):hover,h5 a:where(:not(.wp-element-button)):hover,h6 a:where(:not(.wp-element-button)):hover{color: red;}h1 a:where(:not(.wp-element-button)):focus,h2 a:where(:not(.wp-element-button)):focus,h3 a:where(:not(.wp-element-button)):focus,h4 a:where(:not(.wp-element-button)):focus,h5 a:where(:not(.wp-element-button)):focus,h6 a:where(:not(.wp-element-button)):focus{color: red;}' +
|
|
484
485
|
'.wp-block-image img, .wp-block-image .wp-crop-area{border-radius: 9999px;}.wp-block-image{color: red;}.wp-site-blocks > .alignleft { float: left; margin-right: 2em; }.wp-site-blocks > .alignright { float: right; margin-left: 2em; }.wp-site-blocks > .aligncenter { justify-content: center; margin-left: auto; margin-right: auto; }' +
|
|
485
486
|
'.has-white-color{color: var(--wp--preset--color--white) !important;}.has-white-background-color{background-color: var(--wp--preset--color--white) !important;}.has-white-border-color{border-color: var(--wp--preset--color--white) !important;}.has-black-color{color: var(--wp--preset--color--black) !important;}.has-black-background-color{background-color: var(--wp--preset--color--black) !important;}.has-black-border-color{border-color: var(--wp--preset--color--black) !important;}h1.has-blue-color,h2.has-blue-color,h3.has-blue-color,h4.has-blue-color,h5.has-blue-color,h6.has-blue-color{color: var(--wp--preset--color--blue) !important;}h1.has-blue-background-color,h2.has-blue-background-color,h3.has-blue-background-color,h4.has-blue-background-color,h5.has-blue-background-color,h6.has-blue-background-color{background-color: var(--wp--preset--color--blue) !important;}h1.has-blue-border-color,h2.has-blue-border-color,h3.has-blue-border-color,h4.has-blue-border-color,h5.has-blue-border-color,h6.has-blue-border-color{border-color: var(--wp--preset--color--blue) !important;}'
|
|
486
487
|
);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { hasBlockSupport } from '@wordpress/blocks';
|
|
5
4
|
import { PanelBody } from '@wordpress/components';
|
|
6
5
|
import { __ } from '@wordpress/i18n';
|
|
7
6
|
|
|
@@ -9,7 +8,6 @@ import { __ } from '@wordpress/i18n';
|
|
|
9
8
|
* Internal dependencies
|
|
10
9
|
*/
|
|
11
10
|
import BlockStyles from '../block-styles';
|
|
12
|
-
import DefaultStylePicker from '../default-style-picker';
|
|
13
11
|
import InspectorControls from '../inspector-controls';
|
|
14
12
|
import { getBorderPanelLabel } from '../../hooks/border';
|
|
15
13
|
|
|
@@ -22,11 +20,6 @@ const StylesTab = ( { blockName, clientId, hasBlockStyles } ) => {
|
|
|
22
20
|
<div>
|
|
23
21
|
<PanelBody title={ __( 'Styles' ) }>
|
|
24
22
|
<BlockStyles clientId={ clientId } />
|
|
25
|
-
{ hasBlockSupport(
|
|
26
|
-
blockName,
|
|
27
|
-
'defaultStylePicker',
|
|
28
|
-
true
|
|
29
|
-
) && <DefaultStylePicker blockName={ blockName } /> }
|
|
30
23
|
</PanelBody>
|
|
31
24
|
</div>
|
|
32
25
|
) }
|
|
@@ -115,11 +115,10 @@ export function useMouseMoveTypingReset() {
|
|
|
115
115
|
* field, presses ESC or TAB, or moves the mouse in the document.
|
|
116
116
|
*/
|
|
117
117
|
export function useTypingObserver() {
|
|
118
|
-
const { isTyping
|
|
119
|
-
const { isTyping: _isTyping
|
|
118
|
+
const { isTyping } = useSelect( ( select ) => {
|
|
119
|
+
const { isTyping: _isTyping } = select( blockEditorStore );
|
|
120
120
|
return {
|
|
121
121
|
isTyping: _isTyping(),
|
|
122
|
-
hasInlineToolbar: getSettings().hasInlineToolbar,
|
|
123
122
|
};
|
|
124
123
|
}, [] );
|
|
125
124
|
const { startTyping, stopTyping } = useDispatch( blockEditorStore );
|
|
@@ -183,12 +182,10 @@ export function useTypingObserver() {
|
|
|
183
182
|
node.addEventListener( 'focus', stopTypingOnNonTextField );
|
|
184
183
|
node.addEventListener( 'keydown', stopTypingOnEscapeKey );
|
|
185
184
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
);
|
|
191
|
-
}
|
|
185
|
+
ownerDocument.addEventListener(
|
|
186
|
+
'selectionchange',
|
|
187
|
+
stopTypingOnSelectionUncollapse
|
|
188
|
+
);
|
|
192
189
|
|
|
193
190
|
return () => {
|
|
194
191
|
defaultView.clearTimeout( timerId );
|
|
@@ -245,7 +242,7 @@ export function useTypingObserver() {
|
|
|
245
242
|
node.removeEventListener( 'keydown', startTypingInTextField );
|
|
246
243
|
};
|
|
247
244
|
},
|
|
248
|
-
[ isTyping,
|
|
245
|
+
[ isTyping, startTyping, stopTyping ]
|
|
249
246
|
);
|
|
250
247
|
|
|
251
248
|
return useMergeRefs( [ ref1, ref2 ] );
|
|
@@ -3,13 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
5
|
import { Popover, ToolbarGroup } from '@wordpress/components';
|
|
6
|
-
import { useSelect } from '@wordpress/data';
|
|
7
|
-
import {
|
|
8
|
-
isCollapsed,
|
|
9
|
-
getActiveFormats,
|
|
10
|
-
useAnchor,
|
|
11
|
-
store as richTextStore,
|
|
12
|
-
} from '@wordpress/rich-text';
|
|
13
6
|
|
|
14
7
|
/**
|
|
15
8
|
* Internal dependencies
|
|
@@ -17,22 +10,6 @@ import {
|
|
|
17
10
|
import BlockControls from '../block-controls';
|
|
18
11
|
import FormatToolbar from './format-toolbar';
|
|
19
12
|
import NavigableToolbar from '../navigable-toolbar';
|
|
20
|
-
import { store as blockEditorStore } from '../../store';
|
|
21
|
-
|
|
22
|
-
function InlineSelectionToolbar( { editableContentElement, activeFormats } ) {
|
|
23
|
-
const lastFormat = activeFormats[ activeFormats.length - 1 ];
|
|
24
|
-
const lastFormatType = lastFormat?.type;
|
|
25
|
-
const settings = useSelect(
|
|
26
|
-
( select ) => select( richTextStore ).getFormatType( lastFormatType ),
|
|
27
|
-
[ lastFormatType ]
|
|
28
|
-
);
|
|
29
|
-
const popoverAnchor = useAnchor( {
|
|
30
|
-
editableContentElement,
|
|
31
|
-
settings,
|
|
32
|
-
} );
|
|
33
|
-
|
|
34
|
-
return <InlineToolbar popoverAnchor={ popoverAnchor } />;
|
|
35
|
-
}
|
|
36
13
|
|
|
37
14
|
function InlineToolbar( { popoverAnchor } ) {
|
|
38
15
|
return (
|
|
@@ -56,35 +33,11 @@ function InlineToolbar( { popoverAnchor } ) {
|
|
|
56
33
|
);
|
|
57
34
|
}
|
|
58
35
|
|
|
59
|
-
const FormatToolbarContainer = ( {
|
|
60
|
-
inline,
|
|
61
|
-
editableContentElement,
|
|
62
|
-
value,
|
|
63
|
-
} ) => {
|
|
64
|
-
const hasInlineToolbar = useSelect(
|
|
65
|
-
( select ) => select( blockEditorStore ).getSettings().hasInlineToolbar,
|
|
66
|
-
[]
|
|
67
|
-
);
|
|
68
|
-
|
|
36
|
+
const FormatToolbarContainer = ( { inline, editableContentElement } ) => {
|
|
69
37
|
if ( inline ) {
|
|
70
38
|
return <InlineToolbar popoverAnchor={ editableContentElement } />;
|
|
71
39
|
}
|
|
72
40
|
|
|
73
|
-
if ( hasInlineToolbar ) {
|
|
74
|
-
const activeFormats = getActiveFormats( value );
|
|
75
|
-
|
|
76
|
-
if ( isCollapsed( value ) && ! activeFormats.length ) {
|
|
77
|
-
return null;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
return (
|
|
81
|
-
<InlineSelectionToolbar
|
|
82
|
-
editableContentElement={ editableContentElement }
|
|
83
|
-
activeFormats={ activeFormats }
|
|
84
|
-
/>
|
|
85
|
-
);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
41
|
// Render regular toolbar.
|
|
89
42
|
return (
|
|
90
43
|
<BlockControls group="inline">
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { useSelect } from '@wordpress/data';
|
|
5
5
|
import { __ } from '@wordpress/i18n';
|
|
6
6
|
import { Button } from '@wordpress/components';
|
|
7
7
|
|
|
@@ -11,7 +11,14 @@ import { Button } from '@wordpress/components';
|
|
|
11
11
|
import { store as blockEditorStore } from '../../store';
|
|
12
12
|
import { __unstableUseBlockRef as useBlockRef } from '../block-list/use-block-props/use-block-refs';
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
/**
|
|
15
|
+
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/skip-to-selected-block/README.md
|
|
16
|
+
*/
|
|
17
|
+
export default function SkipToSelectedBlock() {
|
|
18
|
+
const selectedBlockClientId = useSelect(
|
|
19
|
+
( select ) => select( blockEditorStore ).getBlockSelectionStart(),
|
|
20
|
+
[]
|
|
21
|
+
);
|
|
15
22
|
const ref = useBlockRef( selectedBlockClientId );
|
|
16
23
|
const onClick = () => {
|
|
17
24
|
ref.current.focus();
|
|
@@ -26,14 +33,4 @@ const SkipToSelectedBlock = ( { selectedBlockClientId } ) => {
|
|
|
26
33
|
{ __( 'Skip to the selected block' ) }
|
|
27
34
|
</Button>
|
|
28
35
|
) : null;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/skip-to-selected-block/README.md
|
|
33
|
-
*/
|
|
34
|
-
export default withSelect( ( select ) => {
|
|
35
|
-
return {
|
|
36
|
-
selectedBlockClientId:
|
|
37
|
-
select( blockEditorStore ).getBlockSelectionStart(),
|
|
38
|
-
};
|
|
39
|
-
} )( SkipToSelectedBlock );
|
|
36
|
+
}
|
|
@@ -297,7 +297,6 @@ export default function SpacingInputControl( {
|
|
|
297
297
|
options={ options }
|
|
298
298
|
label={ ariaLabel }
|
|
299
299
|
hideLabelFromVision={ true }
|
|
300
|
-
__nextUnconstrainedWidth={ true }
|
|
301
300
|
size={ '__unstable-large' }
|
|
302
301
|
onMouseOver={ onMouseOver }
|
|
303
302
|
onMouseOut={ onMouseOut }
|