@wordpress/block-editor 10.0.3 → 10.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/components/block-inspector/index.js +3 -4
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list/block.js +72 -14
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-parent-selector/index.js +2 -2
- package/build/components/block-parent-selector/index.js.map +1 -1
- package/build/components/block-popover/inbetween.js +3 -1
- package/build/components/block-popover/inbetween.js.map +1 -1
- package/build/components/block-popover/index.js +19 -16
- package/build/components/block-popover/index.js.map +1 -1
- package/build/components/image-editor/use-transform-image.js +2 -2
- package/build/components/image-editor/use-transform-image.js.map +1 -1
- package/build/components/inserter/search-items.js +2 -17
- package/build/components/inserter/search-items.js.map +1 -1
- package/build/components/spacing-sizes-control/index.js +10 -2
- package/build/components/spacing-sizes-control/index.js.map +1 -1
- package/build/components/spacing-sizes-control/spacing-input-control.js +5 -4
- package/build/components/spacing-sizes-control/spacing-input-control.js.map +1 -1
- package/build/hooks/index.js +13 -1
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/layout.js +76 -23
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/margin.js +4 -4
- package/build/hooks/margin.js.map +1 -1
- package/build/index.js +14 -0
- package/build/index.js.map +1 -1
- package/build-module/components/block-inspector/index.js +3 -4
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list/block.js +72 -14
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-parent-selector/index.js +2 -2
- package/build-module/components/block-parent-selector/index.js.map +1 -1
- package/build-module/components/block-popover/inbetween.js +3 -1
- package/build-module/components/block-popover/inbetween.js.map +1 -1
- package/build-module/components/block-popover/index.js +19 -16
- package/build-module/components/block-popover/index.js.map +1 -1
- package/build-module/components/image-editor/use-transform-image.js +2 -2
- package/build-module/components/image-editor/use-transform-image.js.map +1 -1
- package/build-module/components/inserter/search-items.js +3 -17
- package/build-module/components/inserter/search-items.js.map +1 -1
- package/build-module/components/spacing-sizes-control/index.js +10 -3
- package/build-module/components/spacing-sizes-control/index.js.map +1 -1
- package/build-module/components/spacing-sizes-control/spacing-input-control.js +6 -5
- package/build-module/components/spacing-sizes-control/spacing-input-control.js.map +1 -1
- package/build-module/hooks/index.js +1 -0
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/layout.js +73 -23
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/hooks/margin.js +4 -4
- package/build-module/hooks/margin.js.map +1 -1
- package/build-module/index.js +1 -1
- package/build-module/index.js.map +1 -1
- package/build-style/style-rtl.css +85 -125
- package/build-style/style.css +85 -125
- package/package.json +9 -10
- package/src/components/block-inspector/index.js +4 -7
- package/src/components/block-list/block.js +111 -7
- package/src/components/block-list/style.scss +85 -133
- package/src/components/block-parent-selector/index.js +2 -2
- package/src/components/block-popover/inbetween.js +1 -1
- package/src/components/block-popover/index.js +36 -21
- package/src/components/button-block-appender/style.scss +3 -1
- package/src/components/image-editor/use-transform-image.js +2 -2
- package/src/components/inserter/search-items.js +3 -15
- package/src/components/inserter/test/search-items.js +4 -0
- package/src/components/spacing-sizes-control/index.js +15 -3
- package/src/components/spacing-sizes-control/spacing-input-control.js +8 -7
- package/src/components/spacing-sizes-control/style.scss +28 -24
- package/src/hooks/index.js +1 -0
- package/src/hooks/layout.js +64 -21
- package/src/hooks/margin.js +4 -4
- package/src/index.js +2 -0
|
@@ -8,8 +8,19 @@
|
|
|
8
8
|
* Cross-Block Selection
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
+
@keyframes selection-overlay__fade-in-animation {
|
|
12
|
+
from {
|
|
13
|
+
opacity: 0;
|
|
14
|
+
}
|
|
15
|
+
to {
|
|
16
|
+
opacity: 0.4;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
11
20
|
// Note to developers refactoring this, please test navigation mode, and
|
|
12
21
|
// multi selection and hovering the block switcher to highlight the block.
|
|
22
|
+
// Also be sure to test partial selections in Safari, as it draws the
|
|
23
|
+
// selection marker with an entirely different model than Blink.
|
|
13
24
|
.block-editor-block-list__layout {
|
|
14
25
|
position: relative;
|
|
15
26
|
|
|
@@ -19,63 +30,88 @@
|
|
|
19
30
|
background: transparent;
|
|
20
31
|
}
|
|
21
32
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
33
|
+
.has-multi-selection &::selection {
|
|
34
|
+
background: transparent;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Block multi selection
|
|
38
|
+
.block-editor-block-list__block.is-multi-selected:not(.is-partially-selected) {
|
|
39
|
+
// Hide the native selection indicator, for the selection, and children.
|
|
40
|
+
&::selection,
|
|
41
|
+
& ::selection {
|
|
42
|
+
background: transparent;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Draw a spot color overlay.
|
|
27
46
|
&::after {
|
|
28
|
-
|
|
47
|
+
content: "";
|
|
29
48
|
position: absolute;
|
|
30
49
|
z-index: 1;
|
|
31
50
|
pointer-events: none;
|
|
32
|
-
content: "";
|
|
33
51
|
top: $border-width;
|
|
52
|
+
right: $border-width;
|
|
34
53
|
bottom: $border-width;
|
|
35
54
|
left: $border-width;
|
|
36
|
-
|
|
55
|
+
background: var(--wp-admin-theme-color);
|
|
56
|
+
opacity: 0.4;
|
|
37
57
|
|
|
38
|
-
//
|
|
39
|
-
|
|
40
|
-
|
|
58
|
+
// Animate.
|
|
59
|
+
animation: selection-overlay__fade-in-animation 0.1s ease-out;
|
|
60
|
+
animation-fill-mode: forwards;
|
|
61
|
+
@include reduce-motion("animation");
|
|
41
62
|
|
|
42
|
-
//
|
|
63
|
+
// Show outline in high contrast mode.
|
|
43
64
|
outline: 2px solid transparent;
|
|
44
|
-
|
|
45
|
-
// Show a lighter color for dark themes.
|
|
46
|
-
.is-dark-theme & {
|
|
47
|
-
box-shadow: 0 0 0 $border-width $dark-theme-focus;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// Provide exceptions for placeholders.
|
|
52
|
-
.components-placeholder,
|
|
53
|
-
.block-editor-block-list__block.is-multi-selected:not(.is-partially-selected) {
|
|
54
|
-
::selection {
|
|
55
|
-
background: transparent;
|
|
56
|
-
}
|
|
57
65
|
}
|
|
58
66
|
}
|
|
59
67
|
|
|
60
|
-
//
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
68
|
+
// Block highlight, and navigation mode, not focus.
|
|
69
|
+
// By not using a pseudo element, we can limit ourselves to only
|
|
70
|
+
// using ::after, leaving ::before free. Otherwise, highlight + multi-select
|
|
71
|
+
// would require the opacity-changing overlay to be on ::before.
|
|
72
|
+
.block-editor-block-list__block.is-highlighted,
|
|
73
|
+
.block-editor-block-list__block.is-highlighted ~ .is-multi-selected,
|
|
74
|
+
&.is-navigate-mode .block-editor-block-list__block.is-selected,
|
|
75
|
+
& .is-block-moving-mode.block-editor-block-list__block.has-child-selected {
|
|
76
|
+
border-radius: $radius-block-ui;
|
|
77
|
+
box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
|
|
64
78
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
outline: $border-width solid transparent;
|
|
79
|
+
// Show outline in high contrast mode.
|
|
80
|
+
outline: 2px solid transparent;
|
|
68
81
|
}
|
|
69
82
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
83
|
+
// Block focus.
|
|
84
|
+
.block-editor-block-list__block:not([contenteditable]):focus {
|
|
85
|
+
outline: none;
|
|
86
|
+
|
|
87
|
+
// We're using a pseudo element to overflow placeholder borders
|
|
88
|
+
// and any border inside the block itself.
|
|
89
|
+
&::after {
|
|
90
|
+
content: "";
|
|
91
|
+
position: absolute;
|
|
92
|
+
z-index: 1;
|
|
93
|
+
pointer-events: none;
|
|
94
|
+
top: $border-width;
|
|
95
|
+
right: $border-width;
|
|
96
|
+
bottom: $border-width;
|
|
97
|
+
left: $border-width;
|
|
98
|
+
box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
|
|
99
|
+
border-radius: $radius-block-ui - $border-width; // Border is outset, so subtract the width to achieve correct radius.
|
|
100
|
+
outline: 2px solid transparent; // This shows up in Windows High Contrast Mode.
|
|
101
|
+
|
|
102
|
+
// Show a light color for dark themes.
|
|
103
|
+
.is-dark-theme & {
|
|
104
|
+
box-shadow: 0 0 0 var(--wp-admin-border-width-focus) $dark-theme-focus;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
74
107
|
}
|
|
75
108
|
|
|
109
|
+
// Moving blocks using keyboard (Ellipsis > Move).
|
|
76
110
|
& .is-block-moving-mode.block-editor-block-list__block.is-selected {
|
|
111
|
+
box-shadow: none;
|
|
112
|
+
outline: none;
|
|
77
113
|
|
|
78
|
-
&::
|
|
114
|
+
&::after {
|
|
79
115
|
content: "";
|
|
80
116
|
position: absolute;
|
|
81
117
|
z-index: 0;
|
|
@@ -90,14 +126,10 @@
|
|
|
90
126
|
border-radius: $radius-block-ui;
|
|
91
127
|
border-top: 4px solid $gray-400;
|
|
92
128
|
}
|
|
93
|
-
|
|
94
|
-
&::after {
|
|
95
|
-
content: none;
|
|
96
|
-
}
|
|
97
129
|
}
|
|
98
130
|
|
|
99
131
|
& .is-block-moving-mode.can-insert-moving-block.block-editor-block-list__block.is-selected {
|
|
100
|
-
&::
|
|
132
|
+
&::after {
|
|
101
133
|
border-color: var(--wp-admin-theme-color);
|
|
102
134
|
}
|
|
103
135
|
}
|
|
@@ -134,29 +166,16 @@
|
|
|
134
166
|
}
|
|
135
167
|
|
|
136
168
|
.block-editor-block-list__layout .block-editor-block-list__block {
|
|
169
|
+
// With `position: static`, Safari marks a full-width selection rectangle, including margins.
|
|
170
|
+
// With `position: relative`, Safari marks an inline selection rectangle, similar to that of
|
|
171
|
+
// Blink based browsers, but it also does "crop" the marker, which can result in a small line
|
|
172
|
+
// from the preceeding paragraph showing, which is effectively the above selection bleeding in.
|
|
173
|
+
// We choose relative, as that matches the multi-selection, which is limited to the block footprint.
|
|
137
174
|
position: relative;
|
|
138
175
|
|
|
139
176
|
// Re-enable text-selection on editable blocks.
|
|
140
177
|
user-select: text;
|
|
141
178
|
|
|
142
|
-
// Hide the select style pseudo element as otherwise it gets shwon as "selected" in Safari.
|
|
143
|
-
&.is-partially-selected::after {
|
|
144
|
-
// By positioning this pseudo element outside the boundaries of the parent block,
|
|
145
|
-
// when partially selected it hides the pseudo element selection in Safari.
|
|
146
|
-
top: -0.5px;
|
|
147
|
-
right: -0.5px;
|
|
148
|
-
bottom: -0.5px;
|
|
149
|
-
left: -0.5px;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
&.is-highlighted::after,
|
|
153
|
-
&.is-highlighted ~ .is-multi-selected::after {
|
|
154
|
-
top: 0;
|
|
155
|
-
right: 0;
|
|
156
|
-
bottom: 0;
|
|
157
|
-
left: 0;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
179
|
// Break long strings of text without spaces so they don't overflow the block.
|
|
161
180
|
overflow-wrap: break-word;
|
|
162
181
|
|
|
@@ -167,7 +186,6 @@
|
|
|
167
186
|
/**
|
|
168
187
|
* Notices
|
|
169
188
|
*/
|
|
170
|
-
|
|
171
189
|
.components-placeholder .components-with-notices-ui {
|
|
172
190
|
margin: -10px 0 12px 0;
|
|
173
191
|
}
|
|
@@ -186,56 +204,6 @@
|
|
|
186
204
|
}
|
|
187
205
|
}
|
|
188
206
|
|
|
189
|
-
|
|
190
|
-
/**
|
|
191
|
-
* Block Layout
|
|
192
|
-
*/
|
|
193
|
-
|
|
194
|
-
// Navigate mode & Focused wrapper.
|
|
195
|
-
// We're using a pseudo element to overflow placeholder borders
|
|
196
|
-
// and any border inside the block itself.
|
|
197
|
-
&:not([contenteditable]):focus {
|
|
198
|
-
outline: none;
|
|
199
|
-
|
|
200
|
-
&::after {
|
|
201
|
-
position: absolute;
|
|
202
|
-
z-index: 1;
|
|
203
|
-
pointer-events: none;
|
|
204
|
-
content: "";
|
|
205
|
-
top: $border-width;
|
|
206
|
-
bottom: $border-width;
|
|
207
|
-
left: $border-width;
|
|
208
|
-
right: $border-width;
|
|
209
|
-
|
|
210
|
-
// 2px outside.
|
|
211
|
-
box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
|
|
212
|
-
border-radius: $radius-block-ui - $border-width; // Border is outset, so subtract the width to achieve correct radius.
|
|
213
|
-
outline: 2px solid transparent; // This shows up in Windows High Contrast Mode.
|
|
214
|
-
|
|
215
|
-
// Show a light color for dark themes.
|
|
216
|
-
.is-dark-theme & {
|
|
217
|
-
box-shadow: 0 0 0 var(--wp-admin-border-width-focus) $dark-theme-focus;
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
/**
|
|
223
|
-
* Block styles and alignments
|
|
224
|
-
*/
|
|
225
|
-
&::after {
|
|
226
|
-
content: "";
|
|
227
|
-
pointer-events: none;
|
|
228
|
-
position: absolute;
|
|
229
|
-
top: 0;
|
|
230
|
-
right: 0;
|
|
231
|
-
bottom: 0;
|
|
232
|
-
left: 0;
|
|
233
|
-
border-radius: $radius-block-ui;
|
|
234
|
-
box-shadow: 0 0 0 0 transparent;
|
|
235
|
-
transition: box-shadow 0.1s linear;
|
|
236
|
-
@include reduce-motion("transition");
|
|
237
|
-
}
|
|
238
|
-
|
|
239
207
|
// Warnings
|
|
240
208
|
&.has-warning {
|
|
241
209
|
min-height: $grid-unit-60;
|
|
@@ -282,7 +250,7 @@
|
|
|
282
250
|
}
|
|
283
251
|
}
|
|
284
252
|
|
|
285
|
-
// Reusable blocks parent
|
|
253
|
+
// Reusable blocks parent border.
|
|
286
254
|
&.is-reusable.has-child-selected::after {
|
|
287
255
|
box-shadow: 0 0 0 1px var(--wp-admin-theme-color);
|
|
288
256
|
}
|
|
@@ -296,16 +264,8 @@
|
|
|
296
264
|
.is-outline-mode .block-editor-block-list__block:not(.remove-outline) {
|
|
297
265
|
&.is-hovered {
|
|
298
266
|
cursor: default;
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
top: $border-width;
|
|
302
|
-
left: $border-width;
|
|
303
|
-
right: $border-width;
|
|
304
|
-
bottom: $border-width;
|
|
305
|
-
box-shadow: 0 0 0 $border-width var(--wp-admin-theme-color);
|
|
306
|
-
// Border is outset, so subtract the width to achieve correct radius.
|
|
307
|
-
border-radius: $radius-block-ui - $border-width;
|
|
308
|
-
}
|
|
267
|
+
box-shadow: inset 0 0 0 $border-width var(--wp-admin-theme-color);
|
|
268
|
+
border-radius: $radius-block-ui;
|
|
309
269
|
}
|
|
310
270
|
|
|
311
271
|
&.is-selected {
|
|
@@ -315,19 +275,11 @@
|
|
|
315
275
|
cursor: unset;
|
|
316
276
|
}
|
|
317
277
|
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
top: $border-width;
|
|
321
|
-
left: $border-width;
|
|
322
|
-
right: $border-width;
|
|
323
|
-
bottom: $border-width;
|
|
324
|
-
border-radius: $radius-block-ui - $border-width; // Border is outset, so subtract the width to achieve correct radius.
|
|
325
|
-
}
|
|
278
|
+
box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); // Selected not focussed.
|
|
279
|
+
border-radius: $radius-block-ui;
|
|
326
280
|
|
|
327
281
|
&:focus {
|
|
328
|
-
|
|
329
|
-
box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
|
|
330
|
-
}
|
|
282
|
+
box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
|
|
331
283
|
}
|
|
332
284
|
}
|
|
333
285
|
}
|
|
@@ -83,10 +83,10 @@ export default function BlockParentSelector() {
|
|
|
83
83
|
label={ sprintf(
|
|
84
84
|
/* translators: %s: Name of the block's parent. */
|
|
85
85
|
__( 'Select %s' ),
|
|
86
|
-
blockInformation
|
|
86
|
+
blockInformation?.title
|
|
87
87
|
) }
|
|
88
88
|
showTooltip
|
|
89
|
-
icon={ <BlockIcon icon={ blockInformation
|
|
89
|
+
icon={ <BlockIcon icon={ blockInformation?.icon } /> }
|
|
90
90
|
/>
|
|
91
91
|
</div>
|
|
92
92
|
);
|
|
@@ -226,7 +226,7 @@ function BlockPopoverInbetween( {
|
|
|
226
226
|
forcePopoverRecompute
|
|
227
227
|
);
|
|
228
228
|
return () => {
|
|
229
|
-
previousElement.ownerDocument.defaultView
|
|
229
|
+
previousElement.ownerDocument.defaultView?.removeEventListener(
|
|
230
230
|
'resize',
|
|
231
231
|
forcePopoverRecompute
|
|
232
232
|
);
|
|
@@ -42,24 +42,15 @@ function BlockPopover(
|
|
|
42
42
|
ref,
|
|
43
43
|
usePopoverScroll( __unstableContentRef ),
|
|
44
44
|
] );
|
|
45
|
-
const style = useMemo( () => {
|
|
46
|
-
if ( ! selectedElement || lastSelectedElement !== selectedElement ) {
|
|
47
|
-
return {};
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
return {
|
|
51
|
-
position: 'absolute',
|
|
52
|
-
width: selectedElement.offsetWidth,
|
|
53
|
-
height: selectedElement.offsetHeight,
|
|
54
|
-
};
|
|
55
|
-
}, [ selectedElement, lastSelectedElement, __unstableRefreshSize ] );
|
|
56
45
|
|
|
57
|
-
const [
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
)
|
|
46
|
+
const [
|
|
47
|
+
popoverDimensionsRecomputeCounter,
|
|
48
|
+
forceRecomputePopoverDimensions,
|
|
49
|
+
] = useReducer(
|
|
50
|
+
// Module is there to make sure that the counter doesn't overflow.
|
|
51
|
+
( s ) => ( s + 1 ) % MAX_POPOVER_RECOMPUTE_COUNTER,
|
|
52
|
+
0
|
|
53
|
+
);
|
|
63
54
|
|
|
64
55
|
// When blocks are moved up/down, they are animated to their new position by
|
|
65
56
|
// updating the `transform` property manually (i.e. without using CSS
|
|
@@ -74,7 +65,7 @@ function BlockPopover(
|
|
|
74
65
|
}
|
|
75
66
|
|
|
76
67
|
const observer = new window.MutationObserver(
|
|
77
|
-
|
|
68
|
+
forceRecomputePopoverDimensions
|
|
78
69
|
);
|
|
79
70
|
observer.observe( selectedElement, { attributes: true } );
|
|
80
71
|
|
|
@@ -83,12 +74,36 @@ function BlockPopover(
|
|
|
83
74
|
};
|
|
84
75
|
}, [ selectedElement ] );
|
|
85
76
|
|
|
77
|
+
const style = useMemo( () => {
|
|
78
|
+
if (
|
|
79
|
+
// popoverDimensionsRecomputeCounter is by definition always equal or greater
|
|
80
|
+
// than 0. This check is only there to satisfy the correctness of the
|
|
81
|
+
// exhaustive-deps rule for the `useMemo` hook.
|
|
82
|
+
popoverDimensionsRecomputeCounter < 0 ||
|
|
83
|
+
! selectedElement ||
|
|
84
|
+
lastSelectedElement !== selectedElement
|
|
85
|
+
) {
|
|
86
|
+
return {};
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return {
|
|
90
|
+
position: 'absolute',
|
|
91
|
+
width: selectedElement.offsetWidth,
|
|
92
|
+
height: selectedElement.offsetHeight,
|
|
93
|
+
};
|
|
94
|
+
}, [
|
|
95
|
+
selectedElement,
|
|
96
|
+
lastSelectedElement,
|
|
97
|
+
__unstableRefreshSize,
|
|
98
|
+
popoverDimensionsRecomputeCounter,
|
|
99
|
+
] );
|
|
100
|
+
|
|
86
101
|
const popoverAnchor = useMemo( () => {
|
|
87
102
|
if (
|
|
88
|
-
//
|
|
103
|
+
// popoverDimensionsRecomputeCounter is by definition always equal or greater
|
|
89
104
|
// than 0. This check is only there to satisfy the correctness of the
|
|
90
105
|
// exhaustive-deps rule for the `useMemo` hook.
|
|
91
|
-
|
|
106
|
+
popoverDimensionsRecomputeCounter < 0 ||
|
|
92
107
|
! selectedElement ||
|
|
93
108
|
( bottomClientId && ! lastSelectedElement )
|
|
94
109
|
) {
|
|
@@ -132,7 +147,7 @@ function BlockPopover(
|
|
|
132
147
|
bottomClientId,
|
|
133
148
|
lastSelectedElement,
|
|
134
149
|
selectedElement,
|
|
135
|
-
|
|
150
|
+
popoverDimensionsRecomputeCounter,
|
|
136
151
|
] );
|
|
137
152
|
|
|
138
153
|
if ( ! selectedElement || ( bottomClientId && ! lastSelectedElement ) ) {
|
|
@@ -35,7 +35,9 @@
|
|
|
35
35
|
// When the appender shows up in empty container blocks, such as Group and Columns, add an extra click state.
|
|
36
36
|
.block-list-appender:only-child {
|
|
37
37
|
.is-layout-constrained.block-editor-block-list__block:not(.is-selected) > &,
|
|
38
|
-
.is-layout-flow.block-editor-block-list__block:not(.is-selected) >
|
|
38
|
+
.is-layout-flow.block-editor-block-list__block:not(.is-selected) > &,
|
|
39
|
+
.is-layout-constrained.block-editor-block-list__block:not(.is-selected) > .block-editor-block-list__layout > &,
|
|
40
|
+
.is-layout-flow.block-editor-block-list__block:not(.is-selected) > .block-editor-block-list__layout > & {
|
|
39
41
|
pointer-events: none;
|
|
40
42
|
|
|
41
43
|
&::after {
|
|
@@ -41,7 +41,7 @@ function useTransformState( { url, naturalWidth, naturalHeight } ) {
|
|
|
41
41
|
if ( angle === 0 ) {
|
|
42
42
|
setEditedUrl();
|
|
43
43
|
setRotation( angle );
|
|
44
|
-
setAspect(
|
|
44
|
+
setAspect( naturalWidth / naturalHeight );
|
|
45
45
|
setPosition( {
|
|
46
46
|
x: -( position.y * naturalAspectRatio ),
|
|
47
47
|
y: position.x * naturalAspectRatio,
|
|
@@ -80,7 +80,7 @@ function useTransformState( { url, naturalWidth, naturalHeight } ) {
|
|
|
80
80
|
canvas.toBlob( ( blob ) => {
|
|
81
81
|
setEditedUrl( URL.createObjectURL( blob ) );
|
|
82
82
|
setRotation( angle );
|
|
83
|
-
setAspect(
|
|
83
|
+
setAspect( canvas.width / canvas.height );
|
|
84
84
|
setPosition( {
|
|
85
85
|
x: -( position.y * naturalAspectRatio ),
|
|
86
86
|
y: position.x * naturalAspectRatio,
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { noCase } from 'change-case';
|
|
5
4
|
import removeAccents from 'remove-accents';
|
|
6
|
-
import { find } from 'lodash';
|
|
5
|
+
import { find, words } from 'lodash';
|
|
7
6
|
|
|
8
7
|
// Default search helpers.
|
|
9
8
|
const defaultGetName = ( item ) => item.name || '';
|
|
@@ -36,17 +35,6 @@ function normalizeSearchInput( input = '' ) {
|
|
|
36
35
|
return input;
|
|
37
36
|
}
|
|
38
37
|
|
|
39
|
-
/**
|
|
40
|
-
* Extracts words from an input string.
|
|
41
|
-
*
|
|
42
|
-
* @param {string} input The input string.
|
|
43
|
-
*
|
|
44
|
-
* @return {Array} Words, extracted from the input string.
|
|
45
|
-
*/
|
|
46
|
-
function extractWords( input = '' ) {
|
|
47
|
-
return noCase( input ).split( ' ' ).filter( Boolean );
|
|
48
|
-
}
|
|
49
|
-
|
|
50
38
|
/**
|
|
51
39
|
* Converts the search term into a list of normalized terms.
|
|
52
40
|
*
|
|
@@ -55,7 +43,7 @@ function extractWords( input = '' ) {
|
|
|
55
43
|
* @return {string[]} The normalized list of search terms.
|
|
56
44
|
*/
|
|
57
45
|
export const getNormalizedSearchTerms = ( input = '' ) => {
|
|
58
|
-
return
|
|
46
|
+
return words( normalizeSearchInput( input ) );
|
|
59
47
|
};
|
|
60
48
|
|
|
61
49
|
const removeMatchingTerms = ( unmatchedTerms, unprocessedTerms ) => {
|
|
@@ -162,7 +150,7 @@ export function getItemSearchRank( item, searchTerm, config = {} ) {
|
|
|
162
150
|
category,
|
|
163
151
|
collection,
|
|
164
152
|
].join( ' ' );
|
|
165
|
-
const normalizedSearchTerms =
|
|
153
|
+
const normalizedSearchTerms = words( normalizedSearchInput );
|
|
166
154
|
const unmatchedTerms = removeMatchingTerms(
|
|
167
155
|
normalizedSearchTerms,
|
|
168
156
|
terms
|
|
@@ -42,6 +42,10 @@ describe( 'getNormalizedSearchTerms', () => {
|
|
|
42
42
|
getNormalizedSearchTerms( ' Média & Text Tag-Cloud > 123' )
|
|
43
43
|
).toEqual( [ 'media', 'text', 'tag', 'cloud', '123' ] );
|
|
44
44
|
} );
|
|
45
|
+
|
|
46
|
+
it( 'should support non-latin letters', () => {
|
|
47
|
+
expect( getNormalizedSearchTerms( 'მედია' ) ).toEqual( [ 'მედია' ] );
|
|
48
|
+
} );
|
|
45
49
|
} );
|
|
46
50
|
|
|
47
51
|
describe( 'getItemSearchRank', () => {
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import classnames from 'classnames';
|
|
5
|
+
|
|
1
6
|
/**
|
|
2
7
|
* WordPress dependencies
|
|
3
8
|
*/
|
|
4
9
|
import { useState } from '@wordpress/element';
|
|
5
10
|
import { __ } from '@wordpress/i18n';
|
|
6
|
-
import {
|
|
11
|
+
import { BaseControl } from '@wordpress/components';
|
|
7
12
|
|
|
8
13
|
/**
|
|
9
14
|
* Internal dependencies
|
|
@@ -68,8 +73,15 @@ export default function SpacingSizesControl( {
|
|
|
68
73
|
};
|
|
69
74
|
|
|
70
75
|
return (
|
|
71
|
-
<fieldset
|
|
72
|
-
|
|
76
|
+
<fieldset
|
|
77
|
+
role="region"
|
|
78
|
+
className={ classnames( 'component-spacing-sizes-control', {
|
|
79
|
+
'is-unlinked': ! isLinked,
|
|
80
|
+
} ) }
|
|
81
|
+
>
|
|
82
|
+
<BaseControl.VisualLabel as="legend">
|
|
83
|
+
{ label }
|
|
84
|
+
</BaseControl.VisualLabel>
|
|
73
85
|
{ ! hasOneSide && (
|
|
74
86
|
<LinkedButton onClick={ toggleLinked } isLinked={ isLinked } />
|
|
75
87
|
) }
|
|
@@ -9,12 +9,12 @@ import classnames from 'classnames';
|
|
|
9
9
|
import { useState, useMemo } from '@wordpress/element';
|
|
10
10
|
import { useSelect } from '@wordpress/data';
|
|
11
11
|
import {
|
|
12
|
+
BaseControl,
|
|
12
13
|
Button,
|
|
13
14
|
RangeControl,
|
|
14
15
|
CustomSelectControl,
|
|
15
16
|
__experimentalUnitControl as UnitControl,
|
|
16
17
|
__experimentalHStack as HStack,
|
|
17
|
-
__experimentalText as Text,
|
|
18
18
|
__experimentalUseCustomUnits as useCustomUnits,
|
|
19
19
|
__experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue,
|
|
20
20
|
} from '@wordpress/components';
|
|
@@ -167,21 +167,21 @@ export default function SpacingInputControl( {
|
|
|
167
167
|
<>
|
|
168
168
|
{ side !== 'all' && (
|
|
169
169
|
<HStack className="components-spacing-sizes-control__side-labels">
|
|
170
|
-
<
|
|
170
|
+
<BaseControl.VisualLabel className="components-spacing-sizes-control__side-label">
|
|
171
171
|
{ LABELS[ side ] }
|
|
172
|
-
</
|
|
172
|
+
</BaseControl.VisualLabel>
|
|
173
173
|
|
|
174
174
|
{ showHint && (
|
|
175
|
-
<
|
|
175
|
+
<BaseControl.VisualLabel className="components-spacing-sizes-control__hint-single">
|
|
176
176
|
{ currentValueHint }
|
|
177
|
-
</
|
|
177
|
+
</BaseControl.VisualLabel>
|
|
178
178
|
) }
|
|
179
179
|
</HStack>
|
|
180
180
|
) }
|
|
181
181
|
{ side === 'all' && showHint && (
|
|
182
|
-
<
|
|
182
|
+
<BaseControl.VisualLabel className="components-spacing-sizes-control__hint-all">
|
|
183
183
|
{ currentValueHint }
|
|
184
|
-
</
|
|
184
|
+
</BaseControl.VisualLabel>
|
|
185
185
|
) }
|
|
186
186
|
|
|
187
187
|
{ ! disableCustomSpacingSizes && (
|
|
@@ -256,6 +256,7 @@ export default function SpacingInputControl( {
|
|
|
256
256
|
marks={ marks }
|
|
257
257
|
label={ ariaLabel }
|
|
258
258
|
hideLabelFromVision={ true }
|
|
259
|
+
__nextHasNoMarginBottom={ true }
|
|
259
260
|
/>
|
|
260
261
|
) }
|
|
261
262
|
{ ! showRangeControl && ! showCustomValueControl && (
|