@wordpress/block-editor 12.19.2 → 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/block-tools/insertion-point.js +4 -1
- package/build/components/block-tools/insertion-point.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/advanced-panel.js +5 -10
- package/build/components/global-styles/advanced-panel.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/global-styles/shadow-panel-components.js +3 -3
- package/build/components/global-styles/shadow-panel-components.js.map +1 -1
- package/build/components/inserter/media-tab/media-preview.js +1 -1
- package/build/components/inserter/media-tab/media-preview.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 +8 -5
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/use-paste-handler.js +25 -26
- package/build/components/rich-text/use-paste-handler.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/background.js +4 -2
- package/build/hooks/background.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/private-apis.js +3 -1
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +2 -30
- package/build/store/actions.js.map +1 -1
- package/build/store/index.js +0 -2
- package/build/store/index.js.map +1 -1
- package/build/store/private-keys.js +8 -0
- package/build/store/private-keys.js.map +1 -0
- package/build/store/private-selectors.js +6 -9
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +1 -9
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +7 -12
- package/build/store/selectors.js.map +1 -1
- package/build/store/utils.js +7 -2
- package/build/store/utils.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/block-tools/insertion-point.js +4 -1
- package/build-module/components/block-tools/insertion-point.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/advanced-panel.js +6 -11
- package/build-module/components/global-styles/advanced-panel.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/global-styles/shadow-panel-components.js +3 -3
- package/build-module/components/global-styles/shadow-panel-components.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-preview.js +1 -1
- package/build-module/components/inserter/media-tab/media-preview.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 +8 -5
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/use-paste-handler.js +25 -26
- package/build-module/components/rich-text/use-paste-handler.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/background.js +4 -2
- package/build-module/hooks/background.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/private-apis.js +3 -1
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/actions.js +2 -30
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/index.js +0 -2
- package/build-module/store/index.js.map +1 -1
- package/build-module/store/private-keys.js +2 -0
- package/build-module/store/private-keys.js.map +1 -0
- package/build-module/store/private-selectors.js +5 -6
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +1 -9
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +8 -13
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/store/utils.js +6 -2
- package/build-module/store/utils.js.map +1 -1
- package/build-style/style-rtl.css +12 -27
- package/build-style/style.css +12 -27
- 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/block-tools/insertion-point.js +6 -1
- 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/advanced-panel.js +6 -12
- package/src/components/global-styles/dimensions-panel.js +36 -24
- package/src/components/global-styles/shadow-panel-components.js +3 -3
- package/src/components/global-styles/style.scss +0 -10
- package/src/components/global-styles/test/use-global-styles-output.js +3 -2
- package/src/components/inserter/media-tab/media-preview.js +6 -1
- 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 +12 -6
- package/src/components/rich-text/use-paste-handler.js +26 -25
- 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/background.js +5 -2
- 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/private-apis.js +2 -0
- package/src/store/actions.js +2 -38
- package/src/store/index.js +0 -2
- package/src/store/private-keys.js +1 -0
- package/src/store/private-selectors.js +4 -7
- package/src/store/reducer.js +0 -10
- package/src/store/selectors.js +7 -15
- package/src/store/test/actions.js +0 -101
- package/src/store/utils.js +7 -2
- 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/store/resolvers.js +0 -27
- package/build/store/resolvers.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/build-module/store/resolvers.js +0 -20
- package/build-module/store/resolvers.js.map +0 -1
- package/src/components/block-settings-menu/style.scss +0 -3
- package/src/components/default-style-picker/index.js +0 -70
- package/src/store/resolvers.js +0 -17
|
@@ -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
|
|
|
@@ -81,11 +81,16 @@ function InbetweenInsertionPointPopover( {
|
|
|
81
81
|
isInserterShown: insertionPoint?.__unstableWithInserter,
|
|
82
82
|
};
|
|
83
83
|
}, [] );
|
|
84
|
+
const { getBlockEditingMode } = useSelect( blockEditorStore );
|
|
84
85
|
|
|
85
86
|
const disableMotion = useReducedMotion();
|
|
86
87
|
|
|
87
88
|
function onClick( event ) {
|
|
88
|
-
if (
|
|
89
|
+
if (
|
|
90
|
+
event.target === ref.current &&
|
|
91
|
+
nextClientId &&
|
|
92
|
+
getBlockEditingMode( nextClientId ) !== 'disabled'
|
|
93
|
+
) {
|
|
89
94
|
selectBlock( nextClientId, -1 );
|
|
90
95
|
}
|
|
91
96
|
}
|
|
@@ -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
|
);
|
|
@@ -3,12 +3,11 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import {
|
|
5
5
|
TextareaControl,
|
|
6
|
-
|
|
6
|
+
Notice,
|
|
7
7
|
__experimentalVStack as VStack,
|
|
8
8
|
} from '@wordpress/components';
|
|
9
9
|
import { useState } from '@wordpress/element';
|
|
10
10
|
import { __ } from '@wordpress/i18n';
|
|
11
|
-
import { Icon, info } from '@wordpress/icons';
|
|
12
11
|
|
|
13
12
|
/**
|
|
14
13
|
* Internal dependencies
|
|
@@ -58,6 +57,11 @@ export default function AdvancedPanel( {
|
|
|
58
57
|
|
|
59
58
|
return (
|
|
60
59
|
<VStack spacing={ 3 }>
|
|
60
|
+
{ cssError && (
|
|
61
|
+
<Notice status="error" onRemove={ () => setCSSError( null ) }>
|
|
62
|
+
{ cssError }
|
|
63
|
+
</Notice>
|
|
64
|
+
) }
|
|
61
65
|
<TextareaControl
|
|
62
66
|
label={ __( 'Additional CSS' ) }
|
|
63
67
|
__nextHasNoMarginBottom
|
|
@@ -67,16 +71,6 @@ export default function AdvancedPanel( {
|
|
|
67
71
|
className="block-editor-global-styles-advanced-panel__custom-css-input"
|
|
68
72
|
spellCheck={ false }
|
|
69
73
|
/>
|
|
70
|
-
{ cssError && (
|
|
71
|
-
<Tooltip text={ cssError }>
|
|
72
|
-
<div className="block-editor-global-styles-advanced-panel__custom-css-validation-wrapper">
|
|
73
|
-
<Icon
|
|
74
|
-
icon={ info }
|
|
75
|
-
className="block-editor-global-styles-advanced-panel__custom-css-validation-icon"
|
|
76
|
-
/>
|
|
77
|
-
</div>
|
|
78
|
-
</Tooltip>
|
|
79
|
-
) }
|
|
80
74
|
</VStack>
|
|
81
75
|
);
|
|
82
76
|
}
|
|
@@ -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
|
}
|
|
@@ -19,13 +19,13 @@ import { shadow as shadowIcon, Icon, check } from '@wordpress/icons';
|
|
|
19
19
|
import classNames from 'classnames';
|
|
20
20
|
|
|
21
21
|
export function ShadowPopoverContainer( { shadow, onShadowChange, settings } ) {
|
|
22
|
-
const defaultShadows = settings?.shadow?.presets?.default;
|
|
23
|
-
const themeShadows = settings?.shadow?.presets?.theme;
|
|
22
|
+
const defaultShadows = settings?.shadow?.presets?.default || [];
|
|
23
|
+
const themeShadows = settings?.shadow?.presets?.theme || [];
|
|
24
24
|
const defaultPresetsEnabled = settings?.shadow?.defaultPresets;
|
|
25
25
|
|
|
26
26
|
const shadows = [
|
|
27
27
|
...( defaultPresetsEnabled ? defaultShadows : [] ),
|
|
28
|
-
...
|
|
28
|
+
...themeShadows,
|
|
29
29
|
];
|
|
30
30
|
|
|
31
31
|
return (
|
|
@@ -47,13 +47,3 @@
|
|
|
47
47
|
/*rtl:ignore*/
|
|
48
48
|
direction: ltr;
|
|
49
49
|
}
|
|
50
|
-
|
|
51
|
-
.block-editor-global-styles-advanced-panel__custom-css-validation-wrapper {
|
|
52
|
-
position: absolute;
|
|
53
|
-
bottom: $grid-unit-20;
|
|
54
|
-
right: $grid-unit * 3;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
.block-editor-global-styles-advanced-panel__custom-css-validation-icon {
|
|
58
|
-
fill: $alert-red;
|
|
59
|
-
}
|
|
@@ -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
|
);
|
|
@@ -195,7 +195,12 @@ export function MediaPreview( { media, onClick, category } ) {
|
|
|
195
195
|
createSuccessNotice,
|
|
196
196
|
]
|
|
197
197
|
);
|
|
198
|
-
|
|
198
|
+
|
|
199
|
+
const title =
|
|
200
|
+
typeof media.title === 'string'
|
|
201
|
+
? media.title
|
|
202
|
+
: media.title?.rendered || __( 'no title' );
|
|
203
|
+
|
|
199
204
|
let truncatedTitle;
|
|
200
205
|
if ( title.length > MAXIMUM_TITLE_LENGTH ) {
|
|
201
206
|
const omission = '...';
|
|
@@ -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 ] );
|