@wordpress/block-editor 12.3.6 → 12.3.7
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-draggable/index.js +6 -3
- package/build/components/block-draggable/index.js.map +1 -1
- package/build/components/inserter/reusable-block-rename-hint.js +1 -1
- package/build/components/inserter/reusable-block-rename-hint.js.map +1 -1
- package/build/components/link-control/constants.js +1 -1
- package/build/components/link-control/constants.js.map +1 -1
- package/build/components/link-control/search-create-button.js +5 -21
- package/build/components/link-control/search-create-button.js.map +1 -1
- package/build/components/link-control/search-item.js +13 -30
- package/build/components/link-control/search-item.js.map +1 -1
- package/build/components/link-control/search-results.js +2 -2
- package/build/components/link-control/search-results.js.map +1 -1
- package/build/components/use-block-display-information/index.js +7 -3
- package/build/components/use-block-display-information/index.js.map +1 -1
- package/build/hooks/margin.js +1 -1
- package/build/hooks/margin.js.map +1 -1
- package/build/hooks/padding.js +1 -1
- package/build/hooks/padding.js.map +1 -1
- package/build/store/selectors.js +1 -1
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/block-draggable/index.js +6 -3
- package/build-module/components/block-draggable/index.js.map +1 -1
- package/build-module/components/inserter/reusable-block-rename-hint.js +1 -1
- package/build-module/components/inserter/reusable-block-rename-hint.js.map +1 -1
- package/build-module/components/link-control/constants.js +1 -1
- package/build-module/components/link-control/constants.js.map +1 -1
- package/build-module/components/link-control/search-create-button.js +7 -20
- package/build-module/components/link-control/search-create-button.js.map +1 -1
- package/build-module/components/link-control/search-item.js +14 -28
- package/build-module/components/link-control/search-item.js.map +1 -1
- package/build-module/components/link-control/search-results.js +3 -3
- package/build-module/components/link-control/search-results.js.map +1 -1
- package/build-module/components/use-block-display-information/index.js +7 -3
- package/build-module/components/use-block-display-information/index.js.map +1 -1
- package/build-module/hooks/margin.js +1 -1
- package/build-module/hooks/margin.js.map +1 -1
- package/build-module/hooks/padding.js +1 -1
- package/build-module/hooks/padding.js.map +1 -1
- package/build-module/store/selectors.js +1 -1
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +20 -83
- package/build-style/style.css +20 -83
- package/package.json +4 -4
- package/src/components/block-draggable/index.js +13 -4
- package/src/components/inserter/reusable-block-rename-hint.js +1 -1
- package/src/components/link-control/constants.js +1 -1
- package/src/components/link-control/search-create-button.js +8 -26
- package/src/components/link-control/search-item.js +21 -43
- package/src/components/link-control/search-results.js +48 -46
- package/src/components/link-control/style.scss +25 -95
- package/src/components/link-control/test/index.js +6 -7
- package/src/components/use-block-display-information/index.js +12 -5
- package/src/hooks/margin.js +4 -1
- package/src/hooks/padding.js +4 -1
- package/src/store/selectors.js +1 -1
- package/src/store/test/selectors.js +1 -1
|
@@ -41,6 +41,7 @@ $preview-image-height: 140px;
|
|
|
41
41
|
// Provides positioning context for reset button. Without this then when an
|
|
42
42
|
// error notice is displayed the input's reset button is incorrectly positioned.
|
|
43
43
|
.block-editor-link-control__search-input-wrapper {
|
|
44
|
+
margin-bottom: $grid-unit-10;
|
|
44
45
|
position: relative;
|
|
45
46
|
}
|
|
46
47
|
|
|
@@ -87,36 +88,9 @@ $preview-image-height: 140px;
|
|
|
87
88
|
order: 20;
|
|
88
89
|
}
|
|
89
90
|
|
|
90
|
-
.block-editor-link-control__search-results-wrapper {
|
|
91
|
-
position: relative;
|
|
92
|
-
|
|
93
|
-
&::before,
|
|
94
|
-
&::after {
|
|
95
|
-
content: "";
|
|
96
|
-
position: absolute;
|
|
97
|
-
left: -1px;
|
|
98
|
-
right: $grid-unit-20; // avoid overlaying scrollbars
|
|
99
|
-
display: block;
|
|
100
|
-
pointer-events: none;
|
|
101
|
-
z-index: 100;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
&::before {
|
|
105
|
-
height: $grid-unit-20 * 0.5;
|
|
106
|
-
top: 0;
|
|
107
|
-
bottom: auto;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
&::after {
|
|
111
|
-
height: $grid-unit-20;
|
|
112
|
-
bottom: 0;
|
|
113
|
-
top: auto;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
91
|
.block-editor-link-control__search-results {
|
|
118
|
-
margin:
|
|
119
|
-
padding: $grid-unit-
|
|
92
|
+
margin-top: -$grid-unit-20;
|
|
93
|
+
padding: $grid-unit-10;
|
|
120
94
|
max-height: 200px;
|
|
121
95
|
overflow-y: auto; // allow results list to scroll
|
|
122
96
|
|
|
@@ -126,39 +100,35 @@ $preview-image-height: 140px;
|
|
|
126
100
|
}
|
|
127
101
|
|
|
128
102
|
.block-editor-link-control__search-item {
|
|
129
|
-
position: relative;
|
|
130
|
-
display: flex;
|
|
131
|
-
align-items: flex-start; // when link text is very long it is important this indicator remains visible and thus should be aligned top.
|
|
132
|
-
font-size: $default-font-size;
|
|
133
|
-
cursor: pointer;
|
|
134
|
-
background: $white;
|
|
135
|
-
width: 100%;
|
|
136
|
-
border: none;
|
|
137
|
-
text-align: left;
|
|
138
|
-
padding: $grid-unit-15 $grid-unit-20;
|
|
139
|
-
border-radius: 2px;
|
|
140
|
-
height: auto;
|
|
141
103
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
104
|
+
&.components-button.components-menu-item__button {
|
|
105
|
+
height: auto;
|
|
106
|
+
text-align: left;
|
|
107
|
+
}
|
|
145
108
|
|
|
146
|
-
|
|
147
|
-
|
|
109
|
+
.components-menu-item__item {
|
|
110
|
+
overflow: hidden;
|
|
111
|
+
text-overflow: ellipsis;
|
|
112
|
+
// Inline block required to preserve white space
|
|
113
|
+
// between `<mark>` elements and text nodes.
|
|
114
|
+
display: inline-block;
|
|
115
|
+
width: 100%;
|
|
116
|
+
|
|
117
|
+
mark {
|
|
118
|
+
font-weight: 600;
|
|
119
|
+
color: inherit;
|
|
120
|
+
background-color: transparent;
|
|
148
121
|
}
|
|
149
122
|
}
|
|
150
123
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
124
|
+
.components-menu-item__shortcut {
|
|
125
|
+
color: $gray-700;
|
|
126
|
+
text-transform: capitalize;
|
|
127
|
+
white-space: nowrap; // tags shouldn't go over two lines.
|
|
154
128
|
}
|
|
155
129
|
|
|
156
|
-
|
|
130
|
+
&[aria-selected] {
|
|
157
131
|
background: $gray-100;
|
|
158
|
-
|
|
159
|
-
.block-editor-link-control__search-item-type {
|
|
160
|
-
background: $white;
|
|
161
|
-
}
|
|
162
132
|
}
|
|
163
133
|
|
|
164
134
|
&.is-current {
|
|
@@ -198,7 +168,6 @@ $preview-image-height: 140px;
|
|
|
198
168
|
|
|
199
169
|
.block-editor-link-control__search-item-icon {
|
|
200
170
|
position: relative;
|
|
201
|
-
top: 0.2em;
|
|
202
171
|
margin-right: $grid-unit-10;
|
|
203
172
|
max-height: 24px;
|
|
204
173
|
flex-shrink: 0;
|
|
@@ -217,18 +186,6 @@ $preview-image-height: 140px;
|
|
|
217
186
|
max-height: 32px;
|
|
218
187
|
}
|
|
219
188
|
|
|
220
|
-
.block-editor-link-control__search-item-info,
|
|
221
|
-
.block-editor-link-control__search-item-title {
|
|
222
|
-
overflow: hidden;
|
|
223
|
-
text-overflow: ellipsis;
|
|
224
|
-
|
|
225
|
-
.components-external-link__icon {
|
|
226
|
-
position: absolute;
|
|
227
|
-
right: 0;
|
|
228
|
-
margin-top: 0;
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
|
|
232
189
|
.block-editor-link-control__search-item-title {
|
|
233
190
|
display: block;
|
|
234
191
|
margin-bottom: 0.2em;
|
|
@@ -236,7 +193,7 @@ $preview-image-height: 140px;
|
|
|
236
193
|
position: relative;
|
|
237
194
|
|
|
238
195
|
mark {
|
|
239
|
-
font-weight:
|
|
196
|
+
font-weight: 600;
|
|
240
197
|
color: inherit;
|
|
241
198
|
background-color: transparent;
|
|
242
199
|
}
|
|
@@ -250,28 +207,6 @@ $preview-image-height: 140px;
|
|
|
250
207
|
}
|
|
251
208
|
}
|
|
252
209
|
|
|
253
|
-
.block-editor-link-control__search-item-info {
|
|
254
|
-
display: block;
|
|
255
|
-
color: $gray-700;
|
|
256
|
-
font-size: 0.9em;
|
|
257
|
-
line-height: 1.3;
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
.block-editor-link-control__search-item-error-notice {
|
|
261
|
-
font-style: italic;
|
|
262
|
-
font-size: 1.1em;
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
.block-editor-link-control__search-item-type {
|
|
266
|
-
display: block;
|
|
267
|
-
padding: 3px 6px;
|
|
268
|
-
margin-left: auto;
|
|
269
|
-
font-size: 0.9em;
|
|
270
|
-
background-color: $gray-100;
|
|
271
|
-
border-radius: 2px;
|
|
272
|
-
white-space: nowrap; // tags shouldn't go over two lines.
|
|
273
|
-
}
|
|
274
|
-
|
|
275
210
|
.block-editor-link-control__search-item-description {
|
|
276
211
|
padding-top: 12px;
|
|
277
212
|
margin: 0;
|
|
@@ -411,11 +346,6 @@ $preview-image-height: 140px;
|
|
|
411
346
|
}
|
|
412
347
|
}
|
|
413
348
|
|
|
414
|
-
// Specificity override
|
|
415
|
-
.block-editor-link-control__search-results div[role="menu"] > .block-editor-link-control__search-item.block-editor-link-control__search-item {
|
|
416
|
-
padding: 10px;
|
|
417
|
-
}
|
|
418
|
-
|
|
419
349
|
.block-editor-link-control__drawer {
|
|
420
350
|
display: flex; // allow for ordering.
|
|
421
351
|
order: 30;
|
|
@@ -478,16 +478,16 @@ describe( 'Searching for a link', () => {
|
|
|
478
478
|
// The fallback URL suggestion should not be shown when input is not URL-like.
|
|
479
479
|
expect(
|
|
480
480
|
searchResultElements[ searchResultElements.length - 1 ]
|
|
481
|
-
).not.toHaveTextContent( '
|
|
481
|
+
).not.toHaveTextContent( 'Press ENTER to add this link' );
|
|
482
482
|
}
|
|
483
483
|
);
|
|
484
484
|
|
|
485
485
|
it.each( [
|
|
486
|
-
[ 'https://wordpress.org', '
|
|
487
|
-
[ 'http://wordpress.org', '
|
|
488
|
-
[ 'www.wordpress.org', '
|
|
489
|
-
[ 'wordpress.org', '
|
|
490
|
-
[ 'ftp://wordpress.org', '
|
|
486
|
+
[ 'https://wordpress.org', 'link' ],
|
|
487
|
+
[ 'http://wordpress.org', 'link' ],
|
|
488
|
+
[ 'www.wordpress.org', 'link' ],
|
|
489
|
+
[ 'wordpress.org', 'link' ],
|
|
490
|
+
[ 'ftp://wordpress.org', 'link' ],
|
|
491
491
|
[ 'mailto:hello@wordpress.org', 'mailto' ],
|
|
492
492
|
[ 'tel:123456789', 'tel' ],
|
|
493
493
|
[ '#internal', 'internal' ],
|
|
@@ -667,7 +667,6 @@ describe( 'Manual link entry', () => {
|
|
|
667
667
|
|
|
668
668
|
expect( searchResultElements ).toBeVisible();
|
|
669
669
|
expect( searchResultElements ).toHaveTextContent( searchTerm );
|
|
670
|
-
expect( searchResultElements ).toHaveTextContent( 'URL' );
|
|
671
670
|
expect( searchResultElements ).toHaveTextContent(
|
|
672
671
|
'Press ENTER to add this link'
|
|
673
672
|
);
|
|
@@ -67,8 +67,11 @@ export default function useBlockDisplayInformation( clientId ) {
|
|
|
67
67
|
return useSelect(
|
|
68
68
|
( select ) => {
|
|
69
69
|
if ( ! clientId ) return null;
|
|
70
|
-
const {
|
|
71
|
-
|
|
70
|
+
const {
|
|
71
|
+
getBlockName,
|
|
72
|
+
getBlockAttributes,
|
|
73
|
+
__experimentalGetReusableBlockTitle,
|
|
74
|
+
} = select( blockEditorStore );
|
|
72
75
|
const { getBlockType, getActiveBlockVariation } =
|
|
73
76
|
select( blocksStore );
|
|
74
77
|
const blockName = getBlockName( clientId );
|
|
@@ -76,12 +79,16 @@ export default function useBlockDisplayInformation( clientId ) {
|
|
|
76
79
|
if ( ! blockType ) return null;
|
|
77
80
|
const attributes = getBlockAttributes( clientId );
|
|
78
81
|
const match = getActiveBlockVariation( blockName, attributes );
|
|
79
|
-
const
|
|
80
|
-
|
|
82
|
+
const isReusable = isReusableBlock( blockType );
|
|
83
|
+
const resusableTitle = isReusable
|
|
84
|
+
? __experimentalGetReusableBlockTitle( attributes.ref )
|
|
85
|
+
: undefined;
|
|
86
|
+
const title = resusableTitle || blockType.title;
|
|
87
|
+
const isSynced = isReusable || isTemplatePart( blockType );
|
|
81
88
|
const positionLabel = getPositionTypeLabel( attributes );
|
|
82
89
|
const blockTypeInfo = {
|
|
83
90
|
isSynced,
|
|
84
|
-
title
|
|
91
|
+
title,
|
|
85
92
|
icon: blockType.icon,
|
|
86
93
|
description: blockType.description,
|
|
87
94
|
anchor: attributes?.anchor,
|
package/src/hooks/margin.js
CHANGED
|
@@ -23,7 +23,10 @@ export function MarginVisualizer( { clientId, attributes, forceShow } ) {
|
|
|
23
23
|
const margin = attributes?.style?.spacing?.margin;
|
|
24
24
|
|
|
25
25
|
useEffect( () => {
|
|
26
|
-
if (
|
|
26
|
+
if (
|
|
27
|
+
! blockElement ||
|
|
28
|
+
null === blockElement.ownerDocument.defaultView
|
|
29
|
+
) {
|
|
27
30
|
return;
|
|
28
31
|
}
|
|
29
32
|
|
package/src/hooks/padding.js
CHANGED
|
@@ -23,7 +23,10 @@ export function PaddingVisualizer( { clientId, attributes, forceShow } ) {
|
|
|
23
23
|
const padding = attributes?.style?.spacing?.padding;
|
|
24
24
|
|
|
25
25
|
useEffect( () => {
|
|
26
|
-
if (
|
|
26
|
+
if (
|
|
27
|
+
! blockElement ||
|
|
28
|
+
null === blockElement.ownerDocument.defaultView
|
|
29
|
+
) {
|
|
27
30
|
return;
|
|
28
31
|
}
|
|
29
32
|
|
package/src/store/selectors.js
CHANGED
|
@@ -3351,7 +3351,7 @@ describe( 'selectors', () => {
|
|
|
3351
3351
|
id: 'core/block/1',
|
|
3352
3352
|
initialAttributes: { ref: 1 },
|
|
3353
3353
|
isDisabled: false,
|
|
3354
|
-
keywords: [],
|
|
3354
|
+
keywords: [ 'reusable' ],
|
|
3355
3355
|
name: 'core/block',
|
|
3356
3356
|
syncStatus: undefined,
|
|
3357
3357
|
title: 'Reusable Block 1',
|