@wordpress/block-library 8.19.2 → 8.19.4
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 +7 -0
- package/build/cover/edit/inspector-controls.js +1 -1
- package/build/cover/edit/inspector-controls.js.map +1 -1
- package/build/embed/edit.js +17 -0
- package/build/embed/edit.js.map +1 -1
- package/build/embed/edit.native.js +17 -0
- package/build/embed/edit.native.js.map +1 -1
- package/build/image/image.js +2 -2
- package/build/image/image.js.map +1 -1
- package/build/image/view.js +142 -31
- package/build/image/view.js.map +1 -1
- package/build/latest-posts/edit.js +6 -2
- package/build/latest-posts/edit.js.map +1 -1
- package/build/media-text/edit.js +1 -1
- package/build/media-text/edit.js.map +1 -1
- package/build/navigation/edit/deleted-navigation-warning.js +6 -4
- package/build/navigation/edit/deleted-navigation-warning.js.map +1 -1
- package/build/navigation/edit/index.js +3 -2
- package/build/navigation/edit/index.js.map +1 -1
- package/build/navigation/edit/inner-blocks.js +2 -1
- package/build/navigation/edit/inner-blocks.js.map +1 -1
- package/build/paragraph/edit.js +1 -1
- package/build/paragraph/edit.js.map +1 -1
- package/build/search/edit.js +12 -10
- package/build/search/edit.js.map +1 -1
- package/build-module/cover/edit/inspector-controls.js +1 -1
- package/build-module/cover/edit/inspector-controls.js.map +1 -1
- package/build-module/embed/edit.js +17 -0
- package/build-module/embed/edit.js.map +1 -1
- package/build-module/embed/edit.native.js +17 -0
- package/build-module/embed/edit.native.js.map +1 -1
- package/build-module/image/image.js +2 -2
- package/build-module/image/image.js.map +1 -1
- package/build-module/image/view.js +142 -31
- package/build-module/image/view.js.map +1 -1
- package/build-module/latest-posts/edit.js +6 -2
- package/build-module/latest-posts/edit.js.map +1 -1
- package/build-module/media-text/edit.js +1 -1
- package/build-module/media-text/edit.js.map +1 -1
- package/build-module/navigation/edit/deleted-navigation-warning.js +7 -4
- package/build-module/navigation/edit/deleted-navigation-warning.js.map +1 -1
- package/build-module/navigation/edit/index.js +3 -2
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/navigation/edit/inner-blocks.js +2 -1
- package/build-module/navigation/edit/inner-blocks.js.map +1 -1
- package/build-module/paragraph/edit.js +1 -1
- package/build-module/paragraph/edit.js.map +1 -1
- package/build-module/search/edit.js +12 -10
- package/build-module/search/edit.js.map +1 -1
- package/build-style/image/style-rtl.css +17 -6
- package/build-style/image/style.css +17 -6
- package/build-style/navigation-link/style-rtl.css +0 -1
- package/build-style/navigation-link/style.css +0 -1
- package/build-style/post-featured-image/style-rtl.css +3 -0
- package/build-style/post-featured-image/style.css +3 -0
- package/build-style/post-template/style-rtl.css +25 -0
- package/build-style/post-template/style.css +25 -0
- package/build-style/style-rtl.css +46 -7
- package/build-style/style.css +46 -7
- package/package.json +32 -32
- package/src/cover/edit/inspector-controls.js +1 -1
- package/src/embed/edit.js +15 -0
- package/src/embed/edit.native.js +15 -0
- package/src/footnotes/index.php +13 -179
- package/src/image/image.js +2 -2
- package/src/image/index.php +73 -48
- package/src/image/style.scss +23 -6
- package/src/image/view.js +151 -48
- package/src/latest-posts/edit.js +10 -2
- package/src/latest-posts/index.php +18 -8
- package/src/media-text/edit.js +1 -1
- package/src/navigation/edit/deleted-navigation-warning.js +9 -4
- package/src/navigation/edit/index.js +26 -17
- package/src/navigation/edit/inner-blocks.js +1 -0
- package/src/navigation-link/style.scss +0 -1
- package/src/paragraph/edit.js +1 -1
- package/src/post-featured-image/style.scss +4 -0
- package/src/post-template/style.scss +20 -0
- package/src/search/edit.js +16 -10
package/src/image/view.js
CHANGED
|
@@ -17,6 +17,69 @@ const focusableSelectors = [
|
|
|
17
17
|
'[tabindex]:not([tabindex^="-"])',
|
|
18
18
|
];
|
|
19
19
|
|
|
20
|
+
/*
|
|
21
|
+
* Stores a context-bound scroll handler.
|
|
22
|
+
*
|
|
23
|
+
* This callback could be defined inline inside of the store
|
|
24
|
+
* object but it's created externally to avoid confusion about
|
|
25
|
+
* how its logic is called. This logic is not referenced directly
|
|
26
|
+
* by the directives in the markup because the scroll event we
|
|
27
|
+
* need to listen to is triggered on the window; so by defining it
|
|
28
|
+
* outside of the store, we signal that the behavior here is different.
|
|
29
|
+
* If we find a compelling reason to move it to the store, feel free.
|
|
30
|
+
*
|
|
31
|
+
* @type {Function}
|
|
32
|
+
*/
|
|
33
|
+
let scrollCallback;
|
|
34
|
+
|
|
35
|
+
/*
|
|
36
|
+
* Tracks whether user is touching screen; used to
|
|
37
|
+
* differentiate behavior for touch and mouse input.
|
|
38
|
+
*
|
|
39
|
+
* @type {boolean}
|
|
40
|
+
*/
|
|
41
|
+
let isTouching = false;
|
|
42
|
+
|
|
43
|
+
/*
|
|
44
|
+
* Tracks the last time the screen was touched; used to
|
|
45
|
+
* differentiate behavior for touch and mouse input.
|
|
46
|
+
*
|
|
47
|
+
* @type {number}
|
|
48
|
+
*/
|
|
49
|
+
let lastTouchTime = 0;
|
|
50
|
+
|
|
51
|
+
/*
|
|
52
|
+
* Lightbox page-scroll handler: prevents scrolling.
|
|
53
|
+
*
|
|
54
|
+
* This handler is added to prevent scrolling behaviors that
|
|
55
|
+
* trigger content shift while the lightbox is open.
|
|
56
|
+
*
|
|
57
|
+
* It would be better to accomplish this through CSS alone, but
|
|
58
|
+
* using overflow: hidden is currently the only way to do so, and
|
|
59
|
+
* that causes the layout to shift and prevents the zoom animation
|
|
60
|
+
* from working in some cases because we're unable to account for
|
|
61
|
+
* the layout shift when doing the animation calculations. Instead,
|
|
62
|
+
* here we use JavaScript to prevent and reset the scrolling
|
|
63
|
+
* behavior. In the future, we may be able to use CSS or overflow: hidden
|
|
64
|
+
* instead to not rely on JavaScript, but this seems to be the best approach
|
|
65
|
+
* for now that provides the best visual experience.
|
|
66
|
+
*
|
|
67
|
+
* @param {Object} context Interactivity page context?
|
|
68
|
+
*/
|
|
69
|
+
function handleScroll( context ) {
|
|
70
|
+
// We can't override the scroll behavior on mobile devices
|
|
71
|
+
// because doing so breaks the pinch to zoom functionality, and we
|
|
72
|
+
// want to allow users to zoom in further on the high-res image.
|
|
73
|
+
if ( ! isTouching && Date.now() - lastTouchTime > 450 ) {
|
|
74
|
+
// We are unable to use event.preventDefault() to prevent scrolling
|
|
75
|
+
// because the scroll event can't be canceled, so we reset the position instead.
|
|
76
|
+
window.scrollTo(
|
|
77
|
+
context.core.image.scrollLeftReset,
|
|
78
|
+
context.core.image.scrollTopReset
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
20
83
|
store(
|
|
21
84
|
{
|
|
22
85
|
state: {
|
|
@@ -43,54 +106,49 @@ store(
|
|
|
43
106
|
|
|
44
107
|
context.core.image.lightboxEnabled = true;
|
|
45
108
|
setStyles( context, event );
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
109
|
+
|
|
110
|
+
context.core.image.scrollTopReset =
|
|
111
|
+
window.pageYOffset ||
|
|
112
|
+
document.documentElement.scrollTop;
|
|
113
|
+
|
|
114
|
+
// In most cases, this value will be 0, but this is included
|
|
115
|
+
// in case a user has created a page with horizontal scrolling.
|
|
116
|
+
context.core.image.scrollLeftReset =
|
|
117
|
+
window.pageXOffset ||
|
|
118
|
+
document.documentElement.scrollLeft;
|
|
119
|
+
|
|
120
|
+
// We define and bind the scroll callback here so
|
|
121
|
+
// that we can pass the context and as an argument.
|
|
122
|
+
// We may be able to change this in the future if we
|
|
123
|
+
// define the scroll callback in the store instead, but
|
|
124
|
+
// this approach seems to tbe clearest for now.
|
|
125
|
+
scrollCallback = handleScroll.bind( null, context );
|
|
126
|
+
|
|
127
|
+
// We need to add a scroll event listener to the window
|
|
128
|
+
// here because we are unable to otherwise access it via
|
|
129
|
+
// the Interactivity API directives. If we add a native way
|
|
130
|
+
// to access the window, we can remove this.
|
|
131
|
+
window.addEventListener(
|
|
132
|
+
'scroll',
|
|
133
|
+
scrollCallback,
|
|
134
|
+
false
|
|
51
135
|
);
|
|
52
136
|
},
|
|
53
|
-
hideLightbox: async ( { context
|
|
137
|
+
hideLightbox: async ( { context } ) => {
|
|
54
138
|
context.core.image.hideAnimationEnabled = true;
|
|
55
139
|
if ( context.core.image.lightboxEnabled ) {
|
|
56
|
-
//
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
} else if (
|
|
71
|
-
context.core.image.lightboxAnimation === 'zoom'
|
|
72
|
-
) {
|
|
73
|
-
// Disable scroll until the zoom animation ends.
|
|
74
|
-
// Get the current page scroll position
|
|
75
|
-
const scrollTop =
|
|
76
|
-
window.pageYOffset ||
|
|
77
|
-
document.documentElement.scrollTop;
|
|
78
|
-
const scrollLeft =
|
|
79
|
-
window.pageXOffset ||
|
|
80
|
-
document.documentElement.scrollLeft;
|
|
81
|
-
// if any scroll is attempted, set this to the previous value.
|
|
82
|
-
window.onscroll = function () {
|
|
83
|
-
window.scrollTo( scrollLeft, scrollTop );
|
|
84
|
-
};
|
|
85
|
-
// Enable scrolling after the animation finishes
|
|
86
|
-
setTimeout( function () {
|
|
87
|
-
window.onscroll = function () {};
|
|
88
|
-
}, 400 );
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
document.documentElement.classList.remove(
|
|
92
|
-
'wp-has-lightbox-open'
|
|
93
|
-
);
|
|
140
|
+
// We want to wait until the close animation is completed
|
|
141
|
+
// before allowing a user to scroll again. The duration of this
|
|
142
|
+
// animation is defined in the styles.scss and depends on if the
|
|
143
|
+
// animation is 'zoom' or 'fade', but in any case we should wait
|
|
144
|
+
// a few milliseconds longer than the duration, otherwise a user
|
|
145
|
+
// may scroll too soon and cause the animation to look sloppy.
|
|
146
|
+
setTimeout( function () {
|
|
147
|
+
window.removeEventListener(
|
|
148
|
+
'scroll',
|
|
149
|
+
scrollCallback
|
|
150
|
+
);
|
|
151
|
+
}, 450 );
|
|
94
152
|
|
|
95
153
|
context.core.image.lightboxEnabled = false;
|
|
96
154
|
context.core.image.lastFocusedElement.focus( {
|
|
@@ -139,6 +197,27 @@ store(
|
|
|
139
197
|
ref,
|
|
140
198
|
} );
|
|
141
199
|
},
|
|
200
|
+
handleTouchStart: () => {
|
|
201
|
+
isTouching = true;
|
|
202
|
+
},
|
|
203
|
+
handleTouchMove: ( { context, event } ) => {
|
|
204
|
+
// On mobile devices, we want to prevent triggering the
|
|
205
|
+
// scroll event because otherwise the page jumps around as
|
|
206
|
+
// we reset the scroll position. This also means that closing
|
|
207
|
+
// the lightbox requires that a user perform a simple tap. This
|
|
208
|
+
// may be changed in the future if we find a better alternative
|
|
209
|
+
// to override or reset the scroll position during swipe actions.
|
|
210
|
+
if ( context.core.image.lightboxEnabled ) {
|
|
211
|
+
event.preventDefault();
|
|
212
|
+
}
|
|
213
|
+
},
|
|
214
|
+
handleTouchEnd: () => {
|
|
215
|
+
// We need to wait a few milliseconds before resetting
|
|
216
|
+
// to ensure that pinch to zoom works consistently
|
|
217
|
+
// on mobile devices when the lightbox is open.
|
|
218
|
+
lastTouchTime = Date.now();
|
|
219
|
+
isTouching = false;
|
|
220
|
+
},
|
|
142
221
|
},
|
|
143
222
|
},
|
|
144
223
|
},
|
|
@@ -148,7 +227,17 @@ store(
|
|
|
148
227
|
roleAttribute: ( { context } ) => {
|
|
149
228
|
return context.core.image.lightboxEnabled
|
|
150
229
|
? 'dialog'
|
|
151
|
-
:
|
|
230
|
+
: null;
|
|
231
|
+
},
|
|
232
|
+
ariaModal: ( { context } ) => {
|
|
233
|
+
return context.core.image.lightboxEnabled
|
|
234
|
+
? 'true'
|
|
235
|
+
: null;
|
|
236
|
+
},
|
|
237
|
+
dialogLabel: ( { context } ) => {
|
|
238
|
+
return context.core.image.lightboxEnabled
|
|
239
|
+
? context.core.image.dialogLabel
|
|
240
|
+
: null;
|
|
152
241
|
},
|
|
153
242
|
lightboxObjectFit: ( { context } ) => {
|
|
154
243
|
if ( context.core.image.initialized ) {
|
|
@@ -158,7 +247,7 @@ store(
|
|
|
158
247
|
enlargedImgSrc: ( { context } ) => {
|
|
159
248
|
return context.core.image.initialized
|
|
160
249
|
? context.core.image.imageUploadedSrc
|
|
161
|
-
: '';
|
|
250
|
+
: 'data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=';
|
|
162
251
|
},
|
|
163
252
|
},
|
|
164
253
|
},
|
|
@@ -266,6 +355,13 @@ store(
|
|
|
266
355
|
}
|
|
267
356
|
);
|
|
268
357
|
|
|
358
|
+
/*
|
|
359
|
+
* Computes styles for the lightbox and adds them to the document.
|
|
360
|
+
*
|
|
361
|
+
* @function
|
|
362
|
+
* @param {Object} context - An Interactivity API context
|
|
363
|
+
* @param {Object} event - A triggering event
|
|
364
|
+
*/
|
|
269
365
|
function setStyles( context, event ) {
|
|
270
366
|
// The reference img element lies adjacent
|
|
271
367
|
// to the event target button in the DOM.
|
|
@@ -274,9 +370,9 @@ function setStyles( context, event ) {
|
|
|
274
370
|
naturalHeight,
|
|
275
371
|
offsetWidth: originalWidth,
|
|
276
372
|
offsetHeight: originalHeight,
|
|
277
|
-
} = event.target.
|
|
373
|
+
} = event.target.previousElementSibling;
|
|
278
374
|
let { x: screenPosX, y: screenPosY } =
|
|
279
|
-
event.target.
|
|
375
|
+
event.target.previousElementSibling.getBoundingClientRect();
|
|
280
376
|
|
|
281
377
|
// Natural ratio of the image clicked to open the lightbox.
|
|
282
378
|
const naturalRatio = naturalWidth / naturalHeight;
|
|
@@ -434,6 +530,13 @@ function setStyles( context, event ) {
|
|
|
434
530
|
`;
|
|
435
531
|
}
|
|
436
532
|
|
|
533
|
+
/*
|
|
534
|
+
* Debounces a function call.
|
|
535
|
+
*
|
|
536
|
+
* @function
|
|
537
|
+
* @param {Function} func - A function to be called
|
|
538
|
+
* @param {number} wait - The time to wait before calling the function
|
|
539
|
+
*/
|
|
437
540
|
function debounce( func, wait = 50 ) {
|
|
438
541
|
let timeout;
|
|
439
542
|
return () => {
|
package/src/latest-posts/edit.js
CHANGED
|
@@ -483,12 +483,17 @@ export default function LatestPostsEdit( { attributes, setAttributes } ) {
|
|
|
483
483
|
.split( ' ', excerptLength )
|
|
484
484
|
.join( ' ' ) }
|
|
485
485
|
{ createInterpolateElement(
|
|
486
|
-
|
|
487
|
-
|
|
486
|
+
sprintf(
|
|
487
|
+
/* translators: 1: The static string "Read more", 2: The post title only visible to screen readers. */
|
|
488
|
+
__( '… <a>%1$s<span>: %2$s</span></a>' ),
|
|
489
|
+
__( 'Read more' ),
|
|
490
|
+
titleTrimmed || __( '(no title)' )
|
|
491
|
+
),
|
|
488
492
|
{
|
|
489
493
|
a: (
|
|
490
494
|
// eslint-disable-next-line jsx-a11y/anchor-has-content
|
|
491
495
|
<a
|
|
496
|
+
className="wp-block-latest-posts__read-more"
|
|
492
497
|
href={ post.link }
|
|
493
498
|
rel="noopener noreferrer"
|
|
494
499
|
onClick={
|
|
@@ -496,6 +501,9 @@ export default function LatestPostsEdit( { attributes, setAttributes } ) {
|
|
|
496
501
|
}
|
|
497
502
|
/>
|
|
498
503
|
),
|
|
504
|
+
span: (
|
|
505
|
+
<span className="screen-reader-text" />
|
|
506
|
+
),
|
|
499
507
|
}
|
|
500
508
|
) }
|
|
501
509
|
</>
|
|
@@ -48,14 +48,6 @@ function render_block_core_latest_posts( $attributes ) {
|
|
|
48
48
|
$block_core_latest_posts_excerpt_length = $attributes['excerptLength'];
|
|
49
49
|
add_filter( 'excerpt_length', 'block_core_latest_posts_get_excerpt_length', 20 );
|
|
50
50
|
|
|
51
|
-
$filter_latest_posts_excerpt_more = static function ( $more ) use ( $attributes ) {
|
|
52
|
-
$use_excerpt = 'excerpt' === $attributes['displayPostContentRadio'];
|
|
53
|
-
/* translators: %1$s is a URL to a post, excerpt truncation character, default … */
|
|
54
|
-
return $use_excerpt ? sprintf( __( ' … <a href="%1$s" rel="noopener noreferrer">Read more</a>' ), esc_url( get_permalink() ) ) : $more;
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
add_filter( 'excerpt_more', $filter_latest_posts_excerpt_more );
|
|
58
|
-
|
|
59
51
|
if ( ! empty( $attributes['categories'] ) ) {
|
|
60
52
|
$args['category__in'] = array_column( $attributes['categories'], 'id' );
|
|
61
53
|
}
|
|
@@ -151,6 +143,24 @@ function render_block_core_latest_posts( $attributes ) {
|
|
|
151
143
|
|
|
152
144
|
$trimmed_excerpt = get_the_excerpt( $post );
|
|
153
145
|
|
|
146
|
+
/*
|
|
147
|
+
* Adds a "Read more" link with screen reader text.
|
|
148
|
+
* […] is the default excerpt ending from wp_trim_excerpt() in Core.
|
|
149
|
+
*/
|
|
150
|
+
if ( str_ends_with( $trimmed_excerpt, ' […]' ) ) {
|
|
151
|
+
$excerpt_length = (int) apply_filters( 'excerpt_length', $block_core_latest_posts_excerpt_length );
|
|
152
|
+
if ( $excerpt_length <= $block_core_latest_posts_excerpt_length ) {
|
|
153
|
+
$trimmed_excerpt = substr( $trimmed_excerpt, 0, -11 );
|
|
154
|
+
$trimmed_excerpt .= sprintf(
|
|
155
|
+
/* translators: 1: A URL to a post, 2: The static string "Read more", 3: The post title only visible to screen readers. */
|
|
156
|
+
__( '… <a href="%1$s" rel="noopener noreferrer">%2$s<span class="screen-reader-text">: %3$s</span></a>' ),
|
|
157
|
+
esc_url( $post_link ),
|
|
158
|
+
__( 'Read more' ),
|
|
159
|
+
esc_html( $title )
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
154
164
|
if ( post_password_required( $post ) ) {
|
|
155
165
|
$trimmed_excerpt = __( 'This content is password protected.' );
|
|
156
166
|
}
|
package/src/media-text/edit.js
CHANGED
|
@@ -244,7 +244,7 @@ function MediaTextEdit( { attributes, isSelected, setAttributes } ) {
|
|
|
244
244
|
<ToggleControl
|
|
245
245
|
__nextHasNoMarginBottom
|
|
246
246
|
label={ __( 'Crop image to fill entire column' ) }
|
|
247
|
-
checked={ imageFill }
|
|
247
|
+
checked={ !! imageFill }
|
|
248
248
|
onChange={ () =>
|
|
249
249
|
setAttributes( {
|
|
250
250
|
imageFill: ! imageFill,
|
|
@@ -4,14 +4,19 @@
|
|
|
4
4
|
import { Warning } from '@wordpress/block-editor';
|
|
5
5
|
import { Button } from '@wordpress/components';
|
|
6
6
|
import { __ } from '@wordpress/i18n';
|
|
7
|
+
import { createInterpolateElement } from '@wordpress/element';
|
|
7
8
|
|
|
8
9
|
function DeletedNavigationWarning( { onCreateNew } ) {
|
|
9
10
|
return (
|
|
10
11
|
<Warning>
|
|
11
|
-
{
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
{ createInterpolateElement(
|
|
13
|
+
__(
|
|
14
|
+
'Navigation menu has been deleted or is unavailable. <button>Create a new menu?</button>'
|
|
15
|
+
),
|
|
16
|
+
{
|
|
17
|
+
button: <Button onClick={ onCreateNew } variant="link" />,
|
|
18
|
+
}
|
|
19
|
+
) }
|
|
15
20
|
</Warning>
|
|
16
21
|
);
|
|
17
22
|
}
|
|
@@ -93,6 +93,7 @@ function Navigation( {
|
|
|
93
93
|
// navigation block settings.
|
|
94
94
|
hasSubmenuIndicatorSetting = true,
|
|
95
95
|
customPlaceholder: CustomPlaceholder = null,
|
|
96
|
+
__unstableLayoutClassNames: layoutClassNames,
|
|
96
97
|
} ) {
|
|
97
98
|
const {
|
|
98
99
|
openSubmenusOnClick,
|
|
@@ -293,23 +294,31 @@ function Navigation( {
|
|
|
293
294
|
const isResponsive = 'never' !== overlayMenu;
|
|
294
295
|
const blockProps = useBlockProps( {
|
|
295
296
|
ref: navRef,
|
|
296
|
-
className: classnames(
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
297
|
+
className: classnames(
|
|
298
|
+
className,
|
|
299
|
+
{
|
|
300
|
+
'items-justified-right': justifyContent === 'right',
|
|
301
|
+
'items-justified-space-between':
|
|
302
|
+
justifyContent === 'space-between',
|
|
303
|
+
'items-justified-left': justifyContent === 'left',
|
|
304
|
+
'items-justified-center': justifyContent === 'center',
|
|
305
|
+
'is-vertical': orientation === 'vertical',
|
|
306
|
+
'no-wrap': flexWrap === 'nowrap',
|
|
307
|
+
'is-responsive': isResponsive,
|
|
308
|
+
'has-text-color': !! textColor.color || !! textColor?.class,
|
|
309
|
+
[ getColorClassName( 'color', textColor?.slug ) ]:
|
|
310
|
+
!! textColor?.slug,
|
|
311
|
+
'has-background':
|
|
312
|
+
!! backgroundColor.color || backgroundColor.class,
|
|
313
|
+
[ getColorClassName(
|
|
314
|
+
'background-color',
|
|
315
|
+
backgroundColor?.slug
|
|
316
|
+
) ]: !! backgroundColor?.slug,
|
|
317
|
+
[ `has-text-decoration-${ textDecoration }` ]: textDecoration,
|
|
318
|
+
'block-editor-block-content-overlay': hasBlockOverlay,
|
|
319
|
+
},
|
|
320
|
+
layoutClassNames
|
|
321
|
+
),
|
|
313
322
|
style: {
|
|
314
323
|
color: ! textColor?.slug && textColor?.color,
|
|
315
324
|
backgroundColor: ! backgroundColor?.slug && backgroundColor?.color,
|
package/src/paragraph/edit.js
CHANGED
|
@@ -37,3 +37,23 @@
|
|
|
37
37
|
grid-template-columns: 1fr;
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
+
|
|
41
|
+
.wp-block-post-template-is-layout-constrained > li > .alignright,
|
|
42
|
+
.wp-block-post-template-is-layout-flow > li > .alignright {
|
|
43
|
+
float: right;
|
|
44
|
+
margin-inline-start: 2em;
|
|
45
|
+
margin-inline-end: 0;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.wp-block-post-template-is-layout-constrained > li > .alignleft,
|
|
49
|
+
.wp-block-post-template-is-layout-flow > li > .alignleft {
|
|
50
|
+
float: left;
|
|
51
|
+
margin-inline-start: 0;
|
|
52
|
+
margin-inline-end: 2em;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.wp-block-post-template-is-layout-constrained > li > .aligncenter,
|
|
56
|
+
.wp-block-post-template-is-layout-flow > li > .aligncenter {
|
|
57
|
+
margin-inline-start: auto;
|
|
58
|
+
margin-inline-end: auto;
|
|
59
|
+
}
|
package/src/search/edit.js
CHANGED
|
@@ -84,7 +84,7 @@ export default function SearchEdit( {
|
|
|
84
84
|
style,
|
|
85
85
|
} = attributes;
|
|
86
86
|
|
|
87
|
-
const
|
|
87
|
+
const wasJustInsertedIntoNavigationBlock = useSelect(
|
|
88
88
|
( select ) => {
|
|
89
89
|
const { getBlockParentsByBlockName, wasBlockJustInserted } =
|
|
90
90
|
select( blockEditorStore );
|
|
@@ -98,15 +98,21 @@ export default function SearchEdit( {
|
|
|
98
98
|
const { __unstableMarkNextChangeAsNotPersistent } =
|
|
99
99
|
useDispatch( blockEditorStore );
|
|
100
100
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
101
|
+
useEffect( () => {
|
|
102
|
+
if ( wasJustInsertedIntoNavigationBlock ) {
|
|
103
|
+
// This side-effect should not create an undo level.
|
|
104
|
+
__unstableMarkNextChangeAsNotPersistent();
|
|
105
|
+
setAttributes( {
|
|
106
|
+
showLabel: false,
|
|
107
|
+
buttonUseIcon: true,
|
|
108
|
+
buttonPosition: 'button-inside',
|
|
109
|
+
} );
|
|
110
|
+
}
|
|
111
|
+
}, [
|
|
112
|
+
__unstableMarkNextChangeAsNotPersistent,
|
|
113
|
+
wasJustInsertedIntoNavigationBlock,
|
|
114
|
+
setAttributes,
|
|
115
|
+
] );
|
|
110
116
|
|
|
111
117
|
const borderRadius = style?.border?.radius;
|
|
112
118
|
const borderProps = useBorderProps( attributes );
|