@wordpress/block-editor 14.21.0 → 15.0.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 +6 -0
- package/build/components/background-image-control/index.js +0 -4
- package/build/components/background-image-control/index.js.map +1 -1
- package/build/components/block-list/block-invalid-warning.native.js +1 -1
- package/build/components/block-list/block-invalid-warning.native.js.map +1 -1
- package/build/components/block-list/use-block-props/index.js +1 -3
- package/build/components/block-list/use-block-props/index.js.map +1 -1
- package/build/components/block-list/use-block-props/use-is-hovered.js +8 -25
- package/build/components/block-list/use-block-props/use-is-hovered.js.map +1 -1
- package/build/components/block-lock/modal.js +1 -0
- package/build/components/block-lock/modal.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +7 -4
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/child-layout-control/index.js +53 -34
- package/build/components/child-layout-control/index.js.map +1 -1
- package/build/components/image-size-control/index.js +1 -1
- package/build/components/image-size-control/index.js.map +1 -1
- package/build/components/link-control/search-input.js +4 -2
- package/build/components/link-control/search-input.js.map +1 -1
- package/build/components/list-view/block.js +5 -4
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/use-list-view-images.js +62 -30
- package/build/components/list-view/use-list-view-images.js.map +1 -1
- package/build/components/use-paste-styles/index.js +2 -2
- package/build/components/use-paste-styles/index.js.map +1 -1
- package/build/layouts/grid.js +2 -0
- package/build/layouts/grid.js.map +1 -1
- package/build/store/actions.js +7 -6
- package/build/store/actions.js.map +1 -1
- package/build/store/reducer.js +0 -18
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +13 -9
- package/build/store/selectors.js.map +1 -1
- package/build/utils/use-notify-copy.js +2 -2
- package/build/utils/use-notify-copy.js.map +1 -1
- package/build-module/components/background-image-control/index.js +0 -4
- package/build-module/components/background-image-control/index.js.map +1 -1
- package/build-module/components/block-list/block-invalid-warning.native.js +1 -1
- package/build-module/components/block-list/block-invalid-warning.native.js.map +1 -1
- package/build-module/components/block-list/use-block-props/index.js +1 -3
- package/build-module/components/block-list/use-block-props/index.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-is-hovered.js +8 -26
- package/build-module/components/block-list/use-block-props/use-is-hovered.js.map +1 -1
- package/build-module/components/block-lock/modal.js +1 -0
- package/build-module/components/block-lock/modal.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +7 -4
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/child-layout-control/index.js +54 -35
- package/build-module/components/child-layout-control/index.js.map +1 -1
- package/build-module/components/image-size-control/index.js +1 -1
- package/build-module/components/image-size-control/index.js.map +1 -1
- package/build-module/components/link-control/search-input.js +4 -2
- package/build-module/components/link-control/search-input.js.map +1 -1
- package/build-module/components/list-view/block.js +6 -5
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/use-list-view-images.js +62 -30
- package/build-module/components/list-view/use-list-view-images.js.map +1 -1
- package/build-module/components/use-paste-styles/index.js +2 -2
- package/build-module/components/use-paste-styles/index.js.map +1 -1
- package/build-module/layouts/grid.js +2 -0
- package/build-module/layouts/grid.js.map +1 -1
- package/build-module/store/actions.js +7 -6
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/reducer.js +0 -17
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +12 -9
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/use-notify-copy.js +2 -2
- package/build-module/utils/use-notify-copy.js.map +1 -1
- package/build-style/style-rtl.css +48 -19
- package/build-style/style.css +48 -19
- package/package.json +34 -34
- package/src/components/background-image-control/index.js +1 -8
- package/src/components/background-image-control/style.scss +3 -7
- package/src/components/block-list/block-invalid-warning.native.js +1 -1
- package/src/components/block-list/use-block-props/index.js +1 -1
- package/src/components/block-list/use-block-props/use-is-hovered.js +12 -26
- package/src/components/block-lock/modal.js +1 -0
- package/src/components/block-lock/style.scss +9 -5
- package/src/components/block-settings-menu/block-settings-dropdown.js +4 -1
- package/src/components/block-variation-transforms/style.scss +7 -0
- package/src/components/border-radius-control/style.scss +5 -0
- package/src/components/child-layout-control/index.js +66 -42
- package/src/components/colors-gradients/style.scss +5 -0
- package/src/components/image-size-control/index.js +1 -1
- package/src/components/inserter-list-item/style.scss +9 -6
- package/src/components/link-control/search-input.js +9 -2
- package/src/components/link-control/style.scss +7 -0
- package/src/components/link-control/test/index.js +44 -44
- package/src/components/list-view/block.js +9 -5
- package/src/components/list-view/use-list-view-images.js +57 -36
- package/src/components/media-replace-flow/test/index.js +1 -1
- package/src/components/spacing-sizes-control/style.scss +5 -0
- package/src/components/use-paste-styles/index.js +2 -2
- package/src/hooks/layout.scss +8 -0
- package/src/layouts/grid.js +2 -2
- package/src/store/actions.js +7 -6
- package/src/store/reducer.js +0 -18
- package/src/store/selectors.js +29 -31
- package/src/utils/use-notify-copy.js +2 -2
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -6,7 +6,6 @@ import {
|
|
|
6
6
|
__experimentalToggleGroupControlOption as ToggleGroupControlOption,
|
|
7
7
|
__experimentalUnitControl as UnitControl,
|
|
8
8
|
__experimentalInputControl as InputControl,
|
|
9
|
-
__experimentalHStack as HStack,
|
|
10
9
|
__experimentalVStack as VStack,
|
|
11
10
|
__experimentalToolsPanelItem as ToolsPanelItem,
|
|
12
11
|
__experimentalUseCustomUnits as useCustomUnits,
|
|
@@ -210,7 +209,7 @@ function GridControls( {
|
|
|
210
209
|
panelId,
|
|
211
210
|
} ) {
|
|
212
211
|
const { columnStart, rowStart, columnSpan, rowSpan } = childLayout;
|
|
213
|
-
const { columnCount
|
|
212
|
+
const { columnCount, rowCount } = parentLayout ?? {};
|
|
214
213
|
const rootClientId = useSelect( ( select ) =>
|
|
215
214
|
select( blockEditorStore ).getBlockRootClientId( panelId )
|
|
216
215
|
);
|
|
@@ -218,7 +217,7 @@ function GridControls( {
|
|
|
218
217
|
useDispatch( blockEditorStore );
|
|
219
218
|
const getNumberOfBlocksBeforeCell = useGetNumberOfBlocksBeforeCell(
|
|
220
219
|
rootClientId,
|
|
221
|
-
columnCount
|
|
220
|
+
columnCount || 3
|
|
222
221
|
);
|
|
223
222
|
const hasStartValue = () => !! columnStart || !! rowStart;
|
|
224
223
|
const hasSpanValue = () => !! columnSpan || !! rowSpan;
|
|
@@ -235,9 +234,20 @@ function GridControls( {
|
|
|
235
234
|
} );
|
|
236
235
|
};
|
|
237
236
|
|
|
237
|
+
// Calculate max column span based on current position and grid width
|
|
238
|
+
const maxColumnSpan = columnCount
|
|
239
|
+
? columnCount - ( columnStart ?? 1 ) + 1
|
|
240
|
+
: undefined;
|
|
241
|
+
|
|
242
|
+
// Calculate max row span based on current position and grid height
|
|
243
|
+
const maxRowSpan =
|
|
244
|
+
window.__experimentalEnableGridInteractivity && rowCount
|
|
245
|
+
? rowCount - ( rowStart ?? 1 ) + 1
|
|
246
|
+
: undefined;
|
|
247
|
+
|
|
238
248
|
return (
|
|
239
249
|
<>
|
|
240
|
-
<
|
|
250
|
+
<Flex
|
|
241
251
|
as={ ToolsPanelItem }
|
|
242
252
|
hasValue={ hasSpanValue }
|
|
243
253
|
label={ __( 'Grid span' ) }
|
|
@@ -245,44 +255,58 @@ function GridControls( {
|
|
|
245
255
|
isShownByDefault={ isShownByDefault }
|
|
246
256
|
panelId={ panelId }
|
|
247
257
|
>
|
|
248
|
-
<
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
258
|
+
<FlexItem style={ { width: '50%' } }>
|
|
259
|
+
<InputControl
|
|
260
|
+
size="__unstable-large"
|
|
261
|
+
label={ __( 'Column span' ) }
|
|
262
|
+
type="number"
|
|
263
|
+
onChange={ ( value ) => {
|
|
264
|
+
// Don't allow unsetting.
|
|
265
|
+
const newColumnSpan =
|
|
266
|
+
value === '' ? 1 : parseInt( value, 10 );
|
|
267
|
+
const constrainedValue = maxColumnSpan
|
|
268
|
+
? Math.min( newColumnSpan, maxColumnSpan )
|
|
269
|
+
: newColumnSpan;
|
|
270
|
+
|
|
271
|
+
onChange( {
|
|
272
|
+
columnStart,
|
|
273
|
+
rowStart,
|
|
274
|
+
rowSpan,
|
|
275
|
+
columnSpan: constrainedValue,
|
|
276
|
+
} );
|
|
277
|
+
} }
|
|
278
|
+
value={ columnSpan ?? 1 }
|
|
279
|
+
min={ 1 }
|
|
280
|
+
max={ maxColumnSpan }
|
|
281
|
+
/>
|
|
282
|
+
</FlexItem>
|
|
283
|
+
<FlexItem style={ { width: '50%' } }>
|
|
284
|
+
<InputControl
|
|
285
|
+
size="__unstable-large"
|
|
286
|
+
label={ __( 'Row span' ) }
|
|
287
|
+
type="number"
|
|
288
|
+
onChange={ ( value ) => {
|
|
289
|
+
const newRowSpan =
|
|
290
|
+
value === '' ? 1 : parseInt( value, 10 );
|
|
291
|
+
const constrainedValue = maxRowSpan
|
|
292
|
+
? Math.min( newRowSpan, maxRowSpan )
|
|
293
|
+
: newRowSpan;
|
|
294
|
+
|
|
295
|
+
onChange( {
|
|
296
|
+
columnStart,
|
|
297
|
+
rowStart,
|
|
298
|
+
columnSpan,
|
|
299
|
+
rowSpan: constrainedValue,
|
|
300
|
+
} );
|
|
301
|
+
} }
|
|
302
|
+
value={ rowSpan ?? 1 }
|
|
303
|
+
min={ 1 }
|
|
304
|
+
max={ maxRowSpan }
|
|
305
|
+
/>
|
|
306
|
+
</FlexItem>
|
|
307
|
+
</Flex>
|
|
308
|
+
|
|
309
|
+
{ window.__experimentalEnableGridInteractivity && (
|
|
286
310
|
// Use Flex with an explicit width on the FlexItem instead of HStack to
|
|
287
311
|
// work around an issue in webkit where inputs with a max attribute are
|
|
288
312
|
// sized incorrectly.
|
|
@@ -10,6 +10,11 @@ $swatch-gap: 12px;
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
.block-editor-color-gradient-control__fieldset {
|
|
13
|
+
// Reset `fieldset` browser defaults.
|
|
14
|
+
border: 0;
|
|
15
|
+
padding: 0;
|
|
16
|
+
margin: 0;
|
|
17
|
+
|
|
13
18
|
// Prevents the `fieldset` from growing beyond its parent's size
|
|
14
19
|
// in order to fit its content.
|
|
15
20
|
min-width: 0;
|
|
@@ -49,12 +49,13 @@
|
|
|
49
49
|
position: relative;
|
|
50
50
|
height: auto;
|
|
51
51
|
|
|
52
|
-
&:disabled
|
|
52
|
+
&:disabled,
|
|
53
|
+
&[aria-disabled="true"] {
|
|
53
54
|
opacity: 0.6;
|
|
54
55
|
cursor: default;
|
|
55
56
|
}
|
|
56
57
|
|
|
57
|
-
&:not(:disabled) {
|
|
58
|
+
&:not(:disabled, [aria-disabled="true"]) {
|
|
58
59
|
&:hover {
|
|
59
60
|
.block-editor-block-types-list__item-title {
|
|
60
61
|
color: var(--wp-admin-theme-color) !important;
|
|
@@ -80,10 +81,6 @@
|
|
|
80
81
|
}
|
|
81
82
|
}
|
|
82
83
|
|
|
83
|
-
&:focus {
|
|
84
|
-
box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
84
|
&.is-active {
|
|
88
85
|
color: $white;
|
|
89
86
|
background: $gray-900;
|
|
@@ -93,6 +90,12 @@
|
|
|
93
90
|
outline-offset: -2px;
|
|
94
91
|
}
|
|
95
92
|
}
|
|
93
|
+
|
|
94
|
+
&:not(:disabled) {
|
|
95
|
+
&:focus {
|
|
96
|
+
box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
96
99
|
}
|
|
97
100
|
|
|
98
101
|
.block-editor-block-types-list__item-icon {
|
|
@@ -114,16 +114,23 @@ const LinkControlSearchInput = forwardRef(
|
|
|
114
114
|
}
|
|
115
115
|
};
|
|
116
116
|
|
|
117
|
+
const _placeholder = placeholder ?? __( 'Search or type URL' );
|
|
118
|
+
|
|
119
|
+
const label =
|
|
120
|
+
hideLabelFromVision && placeholder !== ''
|
|
121
|
+
? _placeholder
|
|
122
|
+
: __( 'Link' );
|
|
123
|
+
|
|
117
124
|
return (
|
|
118
125
|
<div className="block-editor-link-control__search-input-container">
|
|
119
126
|
<URLInput
|
|
120
127
|
disableSuggestions={ currentLink?.url === value }
|
|
121
|
-
label={
|
|
128
|
+
label={ label }
|
|
122
129
|
hideLabelFromVision={ hideLabelFromVision }
|
|
123
130
|
className={ className }
|
|
124
131
|
value={ value }
|
|
125
132
|
onChange={ onInputChange }
|
|
126
|
-
placeholder={
|
|
133
|
+
placeholder={ _placeholder }
|
|
127
134
|
__experimentalRenderSuggestions={
|
|
128
135
|
showSuggestions ? handleRenderSuggestions : null
|
|
129
136
|
}
|
|
@@ -345,6 +345,13 @@ $block-editor-link-control-number-of-actions: 1;
|
|
|
345
345
|
position: relative;
|
|
346
346
|
}
|
|
347
347
|
|
|
348
|
+
.block-editor-link-control__settings {
|
|
349
|
+
// Reset `fieldset` browser defaults.
|
|
350
|
+
border: 0;
|
|
351
|
+
padding: 0;
|
|
352
|
+
margin: 0;
|
|
353
|
+
}
|
|
354
|
+
|
|
348
355
|
.block-editor-link-control__setting {
|
|
349
356
|
margin-bottom: 0;
|
|
350
357
|
flex: 1;
|
|
@@ -139,7 +139,7 @@ describe( 'Basic rendering', () => {
|
|
|
139
139
|
|
|
140
140
|
// Search Input UI.
|
|
141
141
|
const searchInput = screen.getByRole( 'combobox', {
|
|
142
|
-
name: '
|
|
142
|
+
name: 'Search or type URL',
|
|
143
143
|
} );
|
|
144
144
|
|
|
145
145
|
expect( searchInput ).toBeVisible();
|
|
@@ -150,7 +150,7 @@ describe( 'Basic rendering', () => {
|
|
|
150
150
|
|
|
151
151
|
// Search Input UI.
|
|
152
152
|
const searchInput = screen.getByRole( 'combobox', {
|
|
153
|
-
name: '
|
|
153
|
+
name: 'Search or type URL',
|
|
154
154
|
} );
|
|
155
155
|
|
|
156
156
|
expect( searchInput ).toBeVisible();
|
|
@@ -175,7 +175,7 @@ describe( 'Basic rendering', () => {
|
|
|
175
175
|
|
|
176
176
|
// Search Input UI.
|
|
177
177
|
const searchInput = screen.getByRole( 'combobox', {
|
|
178
|
-
name: '
|
|
178
|
+
name: 'Search or type URL',
|
|
179
179
|
} );
|
|
180
180
|
|
|
181
181
|
// Simulate searching for a term.
|
|
@@ -290,7 +290,7 @@ describe( 'Basic rendering', () => {
|
|
|
290
290
|
|
|
291
291
|
// Search Input UI.
|
|
292
292
|
const searchInput = screen.getByRole( 'combobox', {
|
|
293
|
-
name: '
|
|
293
|
+
name: 'Search or type URL',
|
|
294
294
|
} );
|
|
295
295
|
|
|
296
296
|
// Simulate searching for a term.
|
|
@@ -304,7 +304,7 @@ describe( 'Basic rendering', () => {
|
|
|
304
304
|
render( <LinkControl value={ { url: 'https://example.com' } } /> );
|
|
305
305
|
|
|
306
306
|
expect(
|
|
307
|
-
screen.queryByRole( 'combobox', { name: '
|
|
307
|
+
screen.queryByRole( 'combobox', { name: 'Search or type URL' } )
|
|
308
308
|
).not.toBeInTheDocument();
|
|
309
309
|
} );
|
|
310
310
|
|
|
@@ -317,7 +317,7 @@ describe( 'Basic rendering', () => {
|
|
|
317
317
|
);
|
|
318
318
|
|
|
319
319
|
expect(
|
|
320
|
-
screen.getByRole( 'combobox', { name: '
|
|
320
|
+
screen.getByRole( 'combobox', { name: 'Search or type URL' } )
|
|
321
321
|
).toBeVisible();
|
|
322
322
|
} );
|
|
323
323
|
|
|
@@ -335,7 +335,7 @@ describe( 'Basic rendering', () => {
|
|
|
335
335
|
await user.click( editButton );
|
|
336
336
|
|
|
337
337
|
expect(
|
|
338
|
-
screen.getByRole( 'combobox', { name: '
|
|
338
|
+
screen.getByRole( 'combobox', { name: 'Search or type URL' } )
|
|
339
339
|
).toBeVisible();
|
|
340
340
|
|
|
341
341
|
// If passed `forceIsEditingLink` of `false` while editing, should
|
|
@@ -348,7 +348,7 @@ describe( 'Basic rendering', () => {
|
|
|
348
348
|
);
|
|
349
349
|
|
|
350
350
|
expect(
|
|
351
|
-
screen.queryByRole( 'combobox', { name: '
|
|
351
|
+
screen.queryByRole( 'combobox', { name: 'Search or type URL' } )
|
|
352
352
|
).not.toBeInTheDocument();
|
|
353
353
|
} );
|
|
354
354
|
|
|
@@ -438,7 +438,7 @@ describe( 'Basic rendering', () => {
|
|
|
438
438
|
|
|
439
439
|
// Should revert back to editing mode.
|
|
440
440
|
expect(
|
|
441
|
-
screen.getByRole( 'combobox', { name: '
|
|
441
|
+
screen.getByRole( 'combobox', { name: 'Search or type URL' } )
|
|
442
442
|
).toBeVisible();
|
|
443
443
|
} );
|
|
444
444
|
} );
|
|
@@ -461,7 +461,7 @@ describe( 'Searching for a link', () => {
|
|
|
461
461
|
|
|
462
462
|
// Search Input UI.
|
|
463
463
|
const searchInput = screen.getByRole( 'combobox', {
|
|
464
|
-
name: '
|
|
464
|
+
name: 'Search or type URL',
|
|
465
465
|
} );
|
|
466
466
|
|
|
467
467
|
// Simulate searching for a term.
|
|
@@ -487,7 +487,7 @@ describe( 'Searching for a link', () => {
|
|
|
487
487
|
|
|
488
488
|
// Search Input UI.
|
|
489
489
|
const searchInput = screen.getByRole( 'combobox', {
|
|
490
|
-
name: '
|
|
490
|
+
name: 'Search or type URL',
|
|
491
491
|
} );
|
|
492
492
|
|
|
493
493
|
// Simulate searching for a term.
|
|
@@ -538,7 +538,7 @@ describe( 'Searching for a link', () => {
|
|
|
538
538
|
|
|
539
539
|
// Search Input UI.
|
|
540
540
|
const searchInput = screen.getByRole( 'combobox', {
|
|
541
|
-
name: '
|
|
541
|
+
name: 'Search or type URL',
|
|
542
542
|
} );
|
|
543
543
|
|
|
544
544
|
// Simulate searching for a term.
|
|
@@ -571,7 +571,7 @@ describe( 'Searching for a link', () => {
|
|
|
571
571
|
|
|
572
572
|
// Search Input UI.
|
|
573
573
|
const searchInput = screen.getByRole( 'combobox', {
|
|
574
|
-
name: '
|
|
574
|
+
name: 'Search or type URL',
|
|
575
575
|
} );
|
|
576
576
|
|
|
577
577
|
// Simulate searching for a term.
|
|
@@ -616,7 +616,7 @@ describe( 'Searching for a link', () => {
|
|
|
616
616
|
|
|
617
617
|
// Search Input UI.
|
|
618
618
|
const searchInput = screen.getByRole( 'combobox', {
|
|
619
|
-
name: '
|
|
619
|
+
name: 'Search or type URL',
|
|
620
620
|
} );
|
|
621
621
|
|
|
622
622
|
// Simulate searching for a term.
|
|
@@ -635,7 +635,7 @@ describe( 'Searching for a link', () => {
|
|
|
635
635
|
|
|
636
636
|
// Search Input UI.
|
|
637
637
|
const searchInput = screen.getByRole( 'combobox', {
|
|
638
|
-
name: '
|
|
638
|
+
name: 'Search or type URL',
|
|
639
639
|
} );
|
|
640
640
|
|
|
641
641
|
// Simulate searching for a term.
|
|
@@ -667,7 +667,7 @@ describe( 'Searching for a link', () => {
|
|
|
667
667
|
|
|
668
668
|
// Search Input UI.
|
|
669
669
|
const searchInput = screen.getByRole( 'combobox', {
|
|
670
|
-
name: '
|
|
670
|
+
name: 'Search or type URL',
|
|
671
671
|
} );
|
|
672
672
|
|
|
673
673
|
// Simulate searching for a term.
|
|
@@ -699,7 +699,7 @@ describe( 'Manual link entry', () => {
|
|
|
699
699
|
|
|
700
700
|
// Search Input UI.
|
|
701
701
|
const searchInput = screen.getByRole( 'combobox', {
|
|
702
|
-
name: '
|
|
702
|
+
name: 'Search or type URL',
|
|
703
703
|
} );
|
|
704
704
|
|
|
705
705
|
// Simulate searching for a term.
|
|
@@ -735,7 +735,7 @@ describe( 'Manual link entry', () => {
|
|
|
735
735
|
|
|
736
736
|
// Search Input UI.
|
|
737
737
|
const searchInput = screen.getByRole( 'combobox', {
|
|
738
|
-
name: '
|
|
738
|
+
name: 'Search or type URL',
|
|
739
739
|
} );
|
|
740
740
|
|
|
741
741
|
if ( searchString.length ) {
|
|
@@ -769,7 +769,7 @@ describe( 'Manual link entry', () => {
|
|
|
769
769
|
|
|
770
770
|
// Search Input UI.
|
|
771
771
|
const searchInput = screen.getByRole( 'combobox', {
|
|
772
|
-
name: '
|
|
772
|
+
name: 'Search or type URL',
|
|
773
773
|
} );
|
|
774
774
|
|
|
775
775
|
// Remove the existing link.
|
|
@@ -937,7 +937,7 @@ describe( 'Manual link entry', () => {
|
|
|
937
937
|
|
|
938
938
|
// Search Input UI.
|
|
939
939
|
const searchInput = screen.getByRole( 'combobox', {
|
|
940
|
-
name: '
|
|
940
|
+
name: 'Search or type URL',
|
|
941
941
|
} );
|
|
942
942
|
|
|
943
943
|
// Simulate searching for a term.
|
|
@@ -973,7 +973,7 @@ describe( 'Link submission', () => {
|
|
|
973
973
|
render( <LinkControlConsumer /> );
|
|
974
974
|
|
|
975
975
|
const searchInput = screen.getByRole( 'combobox', {
|
|
976
|
-
name: '
|
|
976
|
+
name: 'Search or type URL',
|
|
977
977
|
} );
|
|
978
978
|
|
|
979
979
|
const submitButton = screen.getByRole( 'button', {
|
|
@@ -1012,7 +1012,7 @@ describe( 'Link submission', () => {
|
|
|
1012
1012
|
render( <LinkControlConsumer /> );
|
|
1013
1013
|
|
|
1014
1014
|
const searchInput = screen.getByRole( 'combobox', {
|
|
1015
|
-
name: '
|
|
1015
|
+
name: 'Search or type URL',
|
|
1016
1016
|
} );
|
|
1017
1017
|
|
|
1018
1018
|
const createSubmitButton = screen.queryByRole( 'button', {
|
|
@@ -1059,9 +1059,9 @@ describe( 'Default search suggestions', () => {
|
|
|
1059
1059
|
// Verify input has no value has default suggestions should only show
|
|
1060
1060
|
// when this does not have a value.
|
|
1061
1061
|
// Search Input UI.
|
|
1062
|
-
expect(
|
|
1063
|
-
''
|
|
1064
|
-
);
|
|
1062
|
+
expect(
|
|
1063
|
+
screen.getByRole( 'combobox', { name: 'Search or type URL' } )
|
|
1064
|
+
).toHaveValue( '' );
|
|
1065
1065
|
|
|
1066
1066
|
// Ensure only called once as a guard against potential infinite
|
|
1067
1067
|
// re-render loop within `componentDidUpdate` calling `updateSuggestions`
|
|
@@ -1091,7 +1091,7 @@ describe( 'Default search suggestions', () => {
|
|
|
1091
1091
|
await user.click( currentLinkBtn );
|
|
1092
1092
|
|
|
1093
1093
|
const searchInput = screen.getByRole( 'combobox', {
|
|
1094
|
-
name: '
|
|
1094
|
+
name: 'Search or type URL',
|
|
1095
1095
|
} );
|
|
1096
1096
|
|
|
1097
1097
|
// Search input is set to the URL value.
|
|
@@ -1115,7 +1115,7 @@ describe( 'Default search suggestions', () => {
|
|
|
1115
1115
|
|
|
1116
1116
|
// Search Input UI.
|
|
1117
1117
|
const searchInput = screen.getByRole( 'combobox', {
|
|
1118
|
-
name: '
|
|
1118
|
+
name: 'Search or type URL',
|
|
1119
1119
|
} );
|
|
1120
1120
|
|
|
1121
1121
|
// Simulate searching for a term.
|
|
@@ -1155,7 +1155,7 @@ describe( 'Default search suggestions', () => {
|
|
|
1155
1155
|
render( <LinkControl showInitialSuggestions /> );
|
|
1156
1156
|
|
|
1157
1157
|
const searchInput = screen.getByRole( 'combobox', {
|
|
1158
|
-
name: '
|
|
1158
|
+
name: 'Search or type URL',
|
|
1159
1159
|
} );
|
|
1160
1160
|
|
|
1161
1161
|
const searchResultsField = screen.queryByRole( 'listbox', {
|
|
@@ -1215,7 +1215,7 @@ describe( 'Creating Entities (eg: Posts, Pages)', () => {
|
|
|
1215
1215
|
|
|
1216
1216
|
// Search Input UI.
|
|
1217
1217
|
const searchInput = screen.getByRole( 'combobox', {
|
|
1218
|
-
name: '
|
|
1218
|
+
name: 'Search or type URL',
|
|
1219
1219
|
} );
|
|
1220
1220
|
|
|
1221
1221
|
// Simulate searching for a term.
|
|
@@ -1285,7 +1285,7 @@ describe( 'Creating Entities (eg: Posts, Pages)', () => {
|
|
|
1285
1285
|
|
|
1286
1286
|
// Search Input UI.
|
|
1287
1287
|
const searchInput = screen.getByRole( 'combobox', {
|
|
1288
|
-
name: '
|
|
1288
|
+
name: 'Search or type URL',
|
|
1289
1289
|
} );
|
|
1290
1290
|
|
|
1291
1291
|
// Simulate searching for a term.
|
|
@@ -1338,7 +1338,7 @@ describe( 'Creating Entities (eg: Posts, Pages)', () => {
|
|
|
1338
1338
|
|
|
1339
1339
|
// Search Input UI.
|
|
1340
1340
|
const searchInput = screen.getByRole( 'combobox', {
|
|
1341
|
-
name: '
|
|
1341
|
+
name: 'Search or type URL',
|
|
1342
1342
|
} );
|
|
1343
1343
|
|
|
1344
1344
|
// Simulate searching for a term.
|
|
@@ -1385,7 +1385,7 @@ describe( 'Creating Entities (eg: Posts, Pages)', () => {
|
|
|
1385
1385
|
|
|
1386
1386
|
// Search Input UI.
|
|
1387
1387
|
const searchInput = screen.getByRole( 'combobox', {
|
|
1388
|
-
name: '
|
|
1388
|
+
name: 'Search or type URL',
|
|
1389
1389
|
} );
|
|
1390
1390
|
|
|
1391
1391
|
// Simulate searching for a term.
|
|
@@ -1410,7 +1410,7 @@ describe( 'Creating Entities (eg: Posts, Pages)', () => {
|
|
|
1410
1410
|
|
|
1411
1411
|
// Search Input UI.
|
|
1412
1412
|
const searchInput = screen.getByRole( 'combobox', {
|
|
1413
|
-
name: '
|
|
1413
|
+
name: 'Search or type URL',
|
|
1414
1414
|
} );
|
|
1415
1415
|
|
|
1416
1416
|
const searchResultsField = screen.queryByRole( 'listbox' );
|
|
@@ -1431,7 +1431,7 @@ describe( 'Creating Entities (eg: Posts, Pages)', () => {
|
|
|
1431
1431
|
|
|
1432
1432
|
// Search Input UI.
|
|
1433
1433
|
const searchInput = screen.getByRole( 'combobox', {
|
|
1434
|
-
name: '
|
|
1434
|
+
name: 'Search or type URL',
|
|
1435
1435
|
} );
|
|
1436
1436
|
|
|
1437
1437
|
const searchResultsField = screen.queryByRole( 'listbox' );
|
|
@@ -1455,7 +1455,7 @@ describe( 'Creating Entities (eg: Posts, Pages)', () => {
|
|
|
1455
1455
|
|
|
1456
1456
|
// Search Input UI.
|
|
1457
1457
|
const searchInput = screen.getByRole( 'combobox', {
|
|
1458
|
-
name: '
|
|
1458
|
+
name: 'Search or type URL',
|
|
1459
1459
|
} );
|
|
1460
1460
|
|
|
1461
1461
|
// Simulate searching for a term.
|
|
@@ -1490,7 +1490,7 @@ describe( 'Creating Entities (eg: Posts, Pages)', () => {
|
|
|
1490
1490
|
|
|
1491
1491
|
// Search Input UI.
|
|
1492
1492
|
searchInput = screen.getByRole( 'combobox', {
|
|
1493
|
-
name: '
|
|
1493
|
+
name: 'Search or type URL',
|
|
1494
1494
|
} );
|
|
1495
1495
|
|
|
1496
1496
|
// Simulate searching for a term.
|
|
@@ -1507,7 +1507,7 @@ describe( 'Creating Entities (eg: Posts, Pages)', () => {
|
|
|
1507
1507
|
await user.click( createButton );
|
|
1508
1508
|
|
|
1509
1509
|
searchInput = screen.getByRole( 'combobox', {
|
|
1510
|
-
name: '
|
|
1510
|
+
name: 'Search or type URL',
|
|
1511
1511
|
} );
|
|
1512
1512
|
|
|
1513
1513
|
const errorNotice = screen.getAllByText(
|
|
@@ -1586,7 +1586,7 @@ describe( 'Selecting links', () => {
|
|
|
1586
1586
|
await user.click( currentLinkBtn );
|
|
1587
1587
|
|
|
1588
1588
|
const searchInput = screen.getByRole( 'combobox', {
|
|
1589
|
-
name: '
|
|
1589
|
+
name: 'Search or type URL',
|
|
1590
1590
|
} );
|
|
1591
1591
|
currentLinkUI = screen.queryByRole( 'group', {
|
|
1592
1592
|
name: 'Manage link',
|
|
@@ -1630,7 +1630,7 @@ describe( 'Selecting links', () => {
|
|
|
1630
1630
|
|
|
1631
1631
|
// Search Input UI.
|
|
1632
1632
|
const searchInput = screen.getByRole( 'combobox', {
|
|
1633
|
-
name: '
|
|
1633
|
+
name: 'Search or type URL',
|
|
1634
1634
|
} );
|
|
1635
1635
|
|
|
1636
1636
|
// Simulate searching for a term.
|
|
@@ -1692,7 +1692,7 @@ describe( 'Selecting links', () => {
|
|
|
1692
1692
|
|
|
1693
1693
|
// Search Input UI.
|
|
1694
1694
|
const searchInput = screen.getByRole( 'combobox', {
|
|
1695
|
-
name: '
|
|
1695
|
+
name: 'Search or type URL',
|
|
1696
1696
|
} );
|
|
1697
1697
|
|
|
1698
1698
|
// Simulate searching for a term.
|
|
@@ -1783,7 +1783,7 @@ describe( 'Selecting links', () => {
|
|
|
1783
1783
|
|
|
1784
1784
|
// Search Input UI.
|
|
1785
1785
|
const searchInput = screen.getByRole( 'combobox', {
|
|
1786
|
-
name: '
|
|
1786
|
+
name: 'Search or type URL',
|
|
1787
1787
|
} );
|
|
1788
1788
|
|
|
1789
1789
|
// Step down into the search results, highlighting the first result item.
|
|
@@ -1841,7 +1841,7 @@ describe( 'Selecting links', () => {
|
|
|
1841
1841
|
|
|
1842
1842
|
// focus the search input
|
|
1843
1843
|
const searchInput = screen.getByRole( 'combobox', {
|
|
1844
|
-
name: '
|
|
1844
|
+
name: 'Search or type URL',
|
|
1845
1845
|
} );
|
|
1846
1846
|
|
|
1847
1847
|
fireEvent.focus( searchInput );
|
|
@@ -2064,7 +2064,7 @@ describe( 'Post types', () => {
|
|
|
2064
2064
|
|
|
2065
2065
|
// Search Input UI.
|
|
2066
2066
|
const searchInput = screen.getByRole( 'combobox', {
|
|
2067
|
-
name: '
|
|
2067
|
+
name: 'Search or type URL',
|
|
2068
2068
|
} );
|
|
2069
2069
|
|
|
2070
2070
|
// Simulate searching for a term.
|
|
@@ -2093,7 +2093,7 @@ describe( 'Post types', () => {
|
|
|
2093
2093
|
|
|
2094
2094
|
// Search Input UI.
|
|
2095
2095
|
const searchInput = screen.getByRole( 'combobox', {
|
|
2096
|
-
name: '
|
|
2096
|
+
name: 'Search or type URL',
|
|
2097
2097
|
} );
|
|
2098
2098
|
|
|
2099
2099
|
// Simulate searching for a term.
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
__experimentalTreeGridCell as TreeGridCell,
|
|
16
16
|
__experimentalTreeGridItem as TreeGridItem,
|
|
17
17
|
} from '@wordpress/components';
|
|
18
|
-
import { useInstanceId } from '@wordpress/compose';
|
|
18
|
+
import { useInstanceId, useDebounce } from '@wordpress/compose';
|
|
19
19
|
import { moreVertical } from '@wordpress/icons';
|
|
20
20
|
import {
|
|
21
21
|
useCallback,
|
|
@@ -97,6 +97,10 @@ function ListViewBlock( {
|
|
|
97
97
|
insertBeforeBlock,
|
|
98
98
|
setOpenedBlockSettingsMenu,
|
|
99
99
|
} = unlock( useDispatch( blockEditorStore ) );
|
|
100
|
+
const debouncedToggleBlockHighlight = useDebounce(
|
|
101
|
+
toggleBlockHighlight,
|
|
102
|
+
50
|
|
103
|
+
);
|
|
100
104
|
|
|
101
105
|
const {
|
|
102
106
|
canInsertBlockType,
|
|
@@ -363,12 +367,12 @@ function ListViewBlock( {
|
|
|
363
367
|
|
|
364
368
|
const onMouseEnter = useCallback( () => {
|
|
365
369
|
setIsHovered( true );
|
|
366
|
-
|
|
367
|
-
}, [ clientId, setIsHovered,
|
|
370
|
+
debouncedToggleBlockHighlight( clientId, true );
|
|
371
|
+
}, [ clientId, setIsHovered, debouncedToggleBlockHighlight ] );
|
|
368
372
|
const onMouseLeave = useCallback( () => {
|
|
369
373
|
setIsHovered( false );
|
|
370
|
-
|
|
371
|
-
}, [ clientId, setIsHovered,
|
|
374
|
+
debouncedToggleBlockHighlight( clientId, false );
|
|
375
|
+
}, [ clientId, setIsHovered, debouncedToggleBlockHighlight ] );
|
|
372
376
|
|
|
373
377
|
const selectEditorBlock = useCallback(
|
|
374
378
|
( event ) => {
|