@wordpress/block-library 9.2.0 → 9.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/build/audio/edit.js +20 -8
- package/build/audio/edit.js.map +1 -1
- package/build/audio/index.js +4 -0
- package/build/audio/index.js.map +1 -1
- package/build/audio/transforms.js +1 -1
- package/build/audio/transforms.js.map +1 -1
- package/build/block/edit.js +0 -1
- package/build/block/edit.js.map +1 -1
- package/build/block/index.js +5 -1
- package/build/block/index.js.map +1 -1
- package/build/embed/embed-preview.js +4 -4
- package/build/embed/embed-preview.js.map +1 -1
- package/build/file/edit.js +14 -6
- package/build/file/edit.js.map +1 -1
- package/build/file/index.js +4 -0
- package/build/file/index.js.map +1 -1
- package/build/file/transforms.js +2 -3
- package/build/file/transforms.js.map +1 -1
- package/build/gallery/deprecated.js +6 -54
- package/build/gallery/deprecated.js.map +1 -1
- package/build/gallery/edit.js +9 -8
- package/build/gallery/edit.js.map +1 -1
- package/build/gallery/index.js +2 -2
- package/build/gallery/index.js.map +1 -1
- package/build/gallery/save.js +0 -11
- package/build/gallery/save.js.map +1 -1
- package/build/gallery/shared.js +0 -27
- package/build/gallery/shared.js.map +1 -1
- package/build/gallery/transforms.js +29 -80
- package/build/gallery/transforms.js.map +1 -1
- package/build/group/index.js +1 -0
- package/build/group/index.js.map +1 -1
- package/build/group/placeholder.js +5 -0
- package/build/group/placeholder.js.map +1 -1
- package/build/image/edit.js +13 -21
- package/build/image/edit.js.map +1 -1
- package/build/image/image.js +30 -17
- package/build/image/image.js.map +1 -1
- package/build/image/index.js +4 -0
- package/build/image/index.js.map +1 -1
- package/build/image/transforms.js +1 -1
- package/build/image/transforms.js.map +1 -1
- package/build/list-item/edit.js +1 -1
- package/build/list-item/edit.js.map +1 -1
- package/build/list-item/hooks/use-merge.js +8 -1
- package/build/list-item/hooks/use-merge.js.map +1 -1
- package/build/list-item/index.js +11 -1
- package/build/list-item/index.js.map +1 -1
- package/build/loginout/index.js +3 -0
- package/build/loginout/index.js.map +1 -1
- package/build/media-text/edit.js +3 -2
- package/build/media-text/edit.js.map +1 -1
- package/build/navigation-submenu/edit.js +1 -1
- package/build/navigation-submenu/edit.js.map +1 -1
- package/build/page-list/convert-to-links-modal.js +1 -1
- package/build/page-list/convert-to-links-modal.js.map +1 -1
- package/build/page-list/edit.js +1 -1
- package/build/page-list/edit.js.map +1 -1
- package/build/post-content/index.js +3 -0
- package/build/post-content/index.js.map +1 -1
- package/build/post-date/edit.js +3 -1
- package/build/post-date/edit.js.map +1 -1
- package/build/post-excerpt/index.js +3 -0
- package/build/post-excerpt/index.js.map +1 -1
- package/build/post-title/index.js +3 -0
- package/build/post-title/index.js.map +1 -1
- package/build/query/edit/inspector-controls/index.js +3 -2
- package/build/query/edit/inspector-controls/index.js.map +1 -1
- package/build/query/edit/query-toolbar.js +54 -61
- package/build/query/edit/query-toolbar.js.map +1 -1
- package/build/query/index.js +34 -0
- package/build/query/index.js.map +1 -1
- package/build/social-link/edit.js +27 -7
- package/build/social-link/edit.js.map +1 -1
- package/build/table/edit.js +8 -17
- package/build/table/edit.js.map +1 -1
- package/build/template-part/edit/title-modal.js +1 -1
- package/build/template-part/edit/title-modal.js.map +1 -1
- package/build/utils/hooks.js +12 -0
- package/build/utils/hooks.js.map +1 -1
- package/build/video/deprecated.js +4 -0
- package/build/video/deprecated.js.map +1 -1
- package/build/video/edit.js +17 -7
- package/build/video/edit.js.map +1 -1
- package/build/video/index.js +4 -0
- package/build/video/index.js.map +1 -1
- package/build/video/transforms.js +1 -1
- package/build/video/transforms.js.map +1 -1
- package/build-module/audio/edit.js +20 -8
- package/build-module/audio/edit.js.map +1 -1
- package/build-module/audio/index.js +4 -0
- package/build-module/audio/index.js.map +1 -1
- package/build-module/audio/transforms.js +1 -1
- package/build-module/audio/transforms.js.map +1 -1
- package/build-module/block/edit.js +0 -1
- package/build-module/block/edit.js.map +1 -1
- package/build-module/block/index.js +5 -1
- package/build-module/block/index.js.map +1 -1
- package/build-module/embed/embed-preview.js +4 -4
- package/build-module/embed/embed-preview.js.map +1 -1
- package/build-module/file/edit.js +15 -7
- package/build-module/file/edit.js.map +1 -1
- package/build-module/file/index.js +4 -0
- package/build-module/file/index.js.map +1 -1
- package/build-module/file/transforms.js +2 -3
- package/build-module/file/transforms.js.map +1 -1
- package/build-module/gallery/deprecated.js +6 -54
- package/build-module/gallery/deprecated.js.map +1 -1
- package/build-module/gallery/edit.js +10 -9
- package/build-module/gallery/edit.js.map +1 -1
- package/build-module/gallery/index.js +1 -1
- package/build-module/gallery/index.js.map +1 -1
- package/build-module/gallery/save.js +0 -11
- package/build-module/gallery/save.js.map +1 -1
- package/build-module/gallery/shared.js +0 -25
- package/build-module/gallery/shared.js.map +1 -1
- package/build-module/gallery/transforms.js +29 -80
- package/build-module/gallery/transforms.js.map +1 -1
- package/build-module/group/index.js +1 -0
- package/build-module/group/index.js.map +1 -1
- package/build-module/group/placeholder.js +5 -0
- package/build-module/group/placeholder.js.map +1 -1
- package/build-module/image/edit.js +12 -20
- package/build-module/image/edit.js.map +1 -1
- package/build-module/image/image.js +25 -12
- package/build-module/image/image.js.map +1 -1
- package/build-module/image/index.js +4 -0
- package/build-module/image/index.js.map +1 -1
- package/build-module/image/transforms.js +1 -1
- package/build-module/image/transforms.js.map +1 -1
- package/build-module/list-item/edit.js +1 -1
- package/build-module/list-item/edit.js.map +1 -1
- package/build-module/list-item/hooks/use-merge.js +8 -1
- package/build-module/list-item/hooks/use-merge.js.map +1 -1
- package/build-module/list-item/index.js +11 -1
- package/build-module/list-item/index.js.map +1 -1
- package/build-module/loginout/index.js +3 -0
- package/build-module/loginout/index.js.map +1 -1
- package/build-module/media-text/edit.js +3 -2
- package/build-module/media-text/edit.js.map +1 -1
- package/build-module/navigation-submenu/edit.js +1 -1
- package/build-module/navigation-submenu/edit.js.map +1 -1
- package/build-module/page-list/convert-to-links-modal.js +1 -1
- package/build-module/page-list/convert-to-links-modal.js.map +1 -1
- package/build-module/page-list/edit.js +1 -1
- package/build-module/page-list/edit.js.map +1 -1
- package/build-module/post-content/index.js +3 -0
- package/build-module/post-content/index.js.map +1 -1
- package/build-module/post-date/edit.js +4 -2
- package/build-module/post-date/edit.js.map +1 -1
- package/build-module/post-excerpt/index.js +3 -0
- package/build-module/post-excerpt/index.js.map +1 -1
- package/build-module/post-title/index.js +3 -0
- package/build-module/post-title/index.js.map +1 -1
- package/build-module/query/edit/inspector-controls/index.js +3 -2
- package/build-module/query/edit/inspector-controls/index.js.map +1 -1
- package/build-module/query/edit/query-toolbar.js +55 -62
- package/build-module/query/edit/query-toolbar.js.map +1 -1
- package/build-module/query/index.js +34 -0
- package/build-module/query/index.js.map +1 -1
- package/build-module/social-link/edit.js +28 -8
- package/build-module/social-link/edit.js.map +1 -1
- package/build-module/table/edit.js +9 -18
- package/build-module/table/edit.js.map +1 -1
- package/build-module/template-part/edit/title-modal.js +1 -1
- package/build-module/template-part/edit/title-modal.js.map +1 -1
- package/build-module/utils/hooks.js +11 -0
- package/build-module/utils/hooks.js.map +1 -1
- package/build-module/video/deprecated.js +4 -0
- package/build-module/video/deprecated.js.map +1 -1
- package/build-module/video/edit.js +18 -8
- package/build-module/video/edit.js.map +1 -1
- package/build-module/video/index.js +4 -0
- package/build-module/video/index.js.map +1 -1
- package/build-module/video/transforms.js +1 -1
- package/build-module/video/transforms.js.map +1 -1
- package/build-style/editor-rtl.css +3 -0
- package/build-style/editor.css +3 -0
- package/build-style/post-comments-form/style-rtl.css +11 -10
- package/build-style/post-comments-form/style.css +11 -10
- package/build-style/query/editor-rtl.css +3 -0
- package/build-style/query/editor.css +3 -0
- package/build-style/social-links/style-rtl.css +91 -91
- package/build-style/social-links/style.css +91 -91
- package/build-style/style-rtl.css +102 -101
- package/build-style/style.css +102 -101
- package/package.json +35 -35
- package/src/audio/block.json +4 -0
- package/src/audio/edit.js +19 -7
- package/src/audio/transforms.js +1 -1
- package/src/block/block.json +5 -1
- package/src/block/edit.js +0 -1
- package/src/button/index.php +14 -1
- package/src/embed/embed-preview.js +4 -6
- package/src/file/block.json +4 -0
- package/src/file/edit.js +19 -6
- package/src/file/transforms.js +1 -2
- package/src/gallery/deprecated.js +6 -55
- package/src/gallery/edit.js +13 -10
- package/src/gallery/gallery-styles.native.scss +0 -2
- package/src/gallery/index.js +1 -1
- package/src/gallery/save.js +0 -10
- package/src/gallery/shared.js +0 -28
- package/src/gallery/transforms.js +56 -99
- package/src/group/block.json +1 -0
- package/src/group/placeholder.js +7 -0
- package/src/image/block.json +4 -0
- package/src/image/edit.js +10 -19
- package/src/image/image.js +36 -14
- package/src/image/index.php +26 -5
- package/src/image/transforms.js +1 -1
- package/src/list-item/block.json +11 -1
- package/src/list-item/edit.js +1 -1
- package/src/list-item/hooks/use-merge.js +19 -5
- package/src/loginout/block.json +3 -0
- package/src/media-text/edit.js +3 -2
- package/src/navigation-submenu/edit.js +1 -1
- package/src/page-list/convert-to-links-modal.js +1 -1
- package/src/page-list/edit.js +1 -1
- package/src/post-comments-form/style.scss +15 -12
- package/src/post-content/block.json +3 -0
- package/src/post-date/edit.js +5 -1
- package/src/post-date/index.php +8 -2
- package/src/post-excerpt/block.json +3 -0
- package/src/post-title/block.json +3 -0
- package/src/query/edit/inspector-controls/index.js +3 -2
- package/src/query/edit/query-toolbar.js +60 -72
- package/src/query/editor.scss +4 -0
- package/src/query/index.js +40 -0
- package/src/social-link/edit.js +29 -3
- package/src/social-links/style.scss +2 -2
- package/src/table/edit.js +11 -24
- package/src/template-part/edit/title-modal.js +1 -1
- package/src/utils/hooks.js +14 -1
- package/src/video/block.json +4 -0
- package/src/video/edit.js +23 -8
- package/src/video/transforms.js +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/build/gallery/edit-wrapper.js +0 -37
- package/build/gallery/edit-wrapper.js.map +0 -1
- package/build/gallery/v1/constants.js +0 -10
- package/build/gallery/v1/constants.js.map +0 -1
- package/build/gallery/v1/edit.js +0 -399
- package/build/gallery/v1/edit.js.map +0 -1
- package/build/gallery/v1/gallery-button.native.js +0 -55
- package/build/gallery/v1/gallery-button.native.js.map +0 -1
- package/build/gallery/v1/gallery-image.js +0 -285
- package/build/gallery/v1/gallery-image.js.map +0 -1
- package/build/gallery/v1/gallery-image.native.js +0 -297
- package/build/gallery/v1/gallery-image.native.js.map +0 -1
- package/build/gallery/v1/gallery.js +0 -112
- package/build/gallery/v1/gallery.js.map +0 -1
- package/build/gallery/v1/gallery.native.js +0 -139
- package/build/gallery/v1/gallery.native.js.map +0 -1
- package/build/gallery/v1/save.js +0 -81
- package/build/gallery/v1/save.js.map +0 -1
- package/build/gallery/v1/shared.js +0 -17
- package/build/gallery/v1/shared.js.map +0 -1
- package/build/gallery/v1/tiles.native.js +0 -83
- package/build/gallery/v1/tiles.native.js.map +0 -1
- package/build/utils/constants.js +0 -15
- package/build/utils/constants.js.map +0 -1
- package/build-module/gallery/edit-wrapper.js +0 -31
- package/build-module/gallery/edit-wrapper.js.map +0 -1
- package/build-module/gallery/v1/constants.js +0 -4
- package/build-module/gallery/v1/constants.js.map +0 -1
- package/build-module/gallery/v1/edit.js +0 -393
- package/build-module/gallery/v1/edit.js.map +0 -1
- package/build-module/gallery/v1/gallery-button.native.js +0 -46
- package/build-module/gallery/v1/gallery-button.native.js.map +0 -1
- package/build-module/gallery/v1/gallery-image.js +0 -279
- package/build-module/gallery/v1/gallery-image.js.map +0 -1
- package/build-module/gallery/v1/gallery-image.native.js +0 -291
- package/build-module/gallery/v1/gallery-image.native.js.map +0 -1
- package/build-module/gallery/v1/gallery.js +0 -104
- package/build-module/gallery/v1/gallery.js.map +0 -1
- package/build-module/gallery/v1/gallery.native.js +0 -131
- package/build-module/gallery/v1/gallery.native.js.map +0 -1
- package/build-module/gallery/v1/save.js +0 -74
- package/build-module/gallery/v1/save.js.map +0 -1
- package/build-module/gallery/v1/shared.js +0 -10
- package/build-module/gallery/v1/shared.js.map +0 -1
- package/build-module/gallery/v1/tiles.native.js +0 -75
- package/build-module/gallery/v1/tiles.native.js.map +0 -1
- package/build-module/utils/constants.js +0 -9
- package/build-module/utils/constants.js.map +0 -1
- package/src/gallery/edit-wrapper.js +0 -27
- package/src/gallery/v1/constants.js +0 -3
- package/src/gallery/v1/edit.js +0 -450
- package/src/gallery/v1/gallery-button.native.js +0 -47
- package/src/gallery/v1/gallery-image-style.native.scss +0 -109
- package/src/gallery/v1/gallery-image.js +0 -293
- package/src/gallery/v1/gallery-image.native.js +0 -348
- package/src/gallery/v1/gallery-styles.native.scss +0 -8
- package/src/gallery/v1/gallery.js +0 -125
- package/src/gallery/v1/gallery.native.js +0 -162
- package/src/gallery/v1/save.js +0 -98
- package/src/gallery/v1/shared.js +0 -19
- package/src/gallery/v1/tiles-styles.native.scss +0 -11
- package/src/gallery/v1/tiles.native.js +0 -79
- package/src/utils/constants.js +0 -8
package/src/image/edit.js
CHANGED
|
@@ -56,17 +56,6 @@ export const pickRelevantMediaFiles = ( image, size ) => {
|
|
|
56
56
|
return imageProps;
|
|
57
57
|
};
|
|
58
58
|
|
|
59
|
-
/**
|
|
60
|
-
* Is the URL a temporary blob URL? A blob URL is one that is used temporarily
|
|
61
|
-
* while the image is being uploaded and will not have an id yet allocated.
|
|
62
|
-
*
|
|
63
|
-
* @param {number=} id The id of the image.
|
|
64
|
-
* @param {string=} url The url of the image.
|
|
65
|
-
*
|
|
66
|
-
* @return {boolean} Is the URL a Blob URL
|
|
67
|
-
*/
|
|
68
|
-
const isTemporaryImage = ( id, url ) => ! id && isBlobURL( url );
|
|
69
|
-
|
|
70
59
|
/**
|
|
71
60
|
* Is the url for the image hosted externally. An externally hosted image has no
|
|
72
61
|
* id and is not a blob url.
|
|
@@ -118,9 +107,7 @@ export function ImageEdit( {
|
|
|
118
107
|
align,
|
|
119
108
|
metadata,
|
|
120
109
|
} = attributes;
|
|
121
|
-
const [ temporaryURL, setTemporaryURL ] = useState(
|
|
122
|
-
return isTemporaryImage( id, url ) ? url : undefined;
|
|
123
|
-
} );
|
|
110
|
+
const [ temporaryURL, setTemporaryURL ] = useState( attributes.blob );
|
|
124
111
|
|
|
125
112
|
const altRef = useRef();
|
|
126
113
|
useEffect( () => {
|
|
@@ -157,8 +144,8 @@ export function ImageEdit( {
|
|
|
157
144
|
src: undefined,
|
|
158
145
|
id: undefined,
|
|
159
146
|
url: undefined,
|
|
147
|
+
blob: undefined,
|
|
160
148
|
} );
|
|
161
|
-
setTemporaryURL( undefined );
|
|
162
149
|
}
|
|
163
150
|
|
|
164
151
|
function onSelectImage( media ) {
|
|
@@ -169,7 +156,9 @@ export function ImageEdit( {
|
|
|
169
156
|
id: undefined,
|
|
170
157
|
title: undefined,
|
|
171
158
|
caption: undefined,
|
|
159
|
+
blob: undefined,
|
|
172
160
|
} );
|
|
161
|
+
setTemporaryURL();
|
|
173
162
|
|
|
174
163
|
return;
|
|
175
164
|
}
|
|
@@ -179,8 +168,6 @@ export function ImageEdit( {
|
|
|
179
168
|
return;
|
|
180
169
|
}
|
|
181
170
|
|
|
182
|
-
setTemporaryURL();
|
|
183
|
-
|
|
184
171
|
const { imageDefaultSize } = getSettings();
|
|
185
172
|
|
|
186
173
|
// Try to use the previous selected image size if its available
|
|
@@ -254,24 +241,28 @@ export function ImageEdit( {
|
|
|
254
241
|
mediaAttributes.href = href;
|
|
255
242
|
|
|
256
243
|
setAttributes( {
|
|
244
|
+
blob: undefined,
|
|
257
245
|
...mediaAttributes,
|
|
258
246
|
...additionalAttributes,
|
|
259
247
|
linkDestination,
|
|
260
248
|
} );
|
|
249
|
+
setTemporaryURL();
|
|
261
250
|
}
|
|
262
251
|
|
|
263
252
|
function onSelectURL( newURL ) {
|
|
264
253
|
if ( newURL !== url ) {
|
|
265
254
|
setAttributes( {
|
|
255
|
+
blob: undefined,
|
|
266
256
|
url: newURL,
|
|
267
257
|
id: undefined,
|
|
268
258
|
sizeSlug: getSettings().imageDefaultSize,
|
|
269
259
|
} );
|
|
260
|
+
setTemporaryURL();
|
|
270
261
|
}
|
|
271
262
|
}
|
|
272
263
|
|
|
273
264
|
useUploadMediaFromBlobURL( {
|
|
274
|
-
url,
|
|
265
|
+
url: temporaryURL,
|
|
275
266
|
allowedTypes: ALLOWED_MEDIA_TYPES,
|
|
276
267
|
onChange: onSelectImage,
|
|
277
268
|
onError: onUploadError,
|
|
@@ -292,7 +283,7 @@ export function ImageEdit( {
|
|
|
292
283
|
const shadowProps = getShadowClassesAndStyles( attributes );
|
|
293
284
|
|
|
294
285
|
const classes = clsx( className, {
|
|
295
|
-
'is-transient': temporaryURL,
|
|
286
|
+
'is-transient': !! temporaryURL,
|
|
296
287
|
'is-resized': !! width || !! height,
|
|
297
288
|
[ `size-${ sizeSlug }` ]: sizeSlug,
|
|
298
289
|
'has-custom-border':
|
package/src/image/image.js
CHANGED
|
@@ -49,7 +49,7 @@ import { Caption } from '../utils/caption';
|
|
|
49
49
|
/**
|
|
50
50
|
* Module constants
|
|
51
51
|
*/
|
|
52
|
-
import {
|
|
52
|
+
import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
|
|
53
53
|
import { MIN_SIZE, ALLOWED_MEDIA_TYPES } from './constants';
|
|
54
54
|
import { evalAspectRatio } from './utils';
|
|
55
55
|
|
|
@@ -182,8 +182,7 @@ export default function Image( {
|
|
|
182
182
|
allowResize &&
|
|
183
183
|
hasNonContentControls &&
|
|
184
184
|
! isWideAligned &&
|
|
185
|
-
isLargeViewport
|
|
186
|
-
parentLayoutType !== 'grid';
|
|
185
|
+
isLargeViewport;
|
|
187
186
|
const imageSizeOptions = imageSizes
|
|
188
187
|
.filter(
|
|
189
188
|
( { slug } ) => image?.media_details?.sizes?.[ slug ]?.source_url
|
|
@@ -373,6 +372,8 @@ export default function Image( {
|
|
|
373
372
|
const lightboxChecked =
|
|
374
373
|
!! lightbox?.enabled || ( ! lightbox && !! lightboxSetting?.enabled );
|
|
375
374
|
|
|
375
|
+
const dropdownMenuProps = useToolsPanelDropdownMenuProps();
|
|
376
|
+
|
|
376
377
|
const dimensionsControl = (
|
|
377
378
|
<DimensionsTool
|
|
378
379
|
value={ { width, height, scale, aspectRatio } }
|
|
@@ -403,6 +404,20 @@ export default function Image( {
|
|
|
403
404
|
/>
|
|
404
405
|
);
|
|
405
406
|
|
|
407
|
+
const aspectRatioControl = (
|
|
408
|
+
<DimensionsTool
|
|
409
|
+
value={ { aspectRatio } }
|
|
410
|
+
onChange={ ( { aspectRatio: newAspectRatio } ) => {
|
|
411
|
+
setAttributes( {
|
|
412
|
+
aspectRatio: newAspectRatio,
|
|
413
|
+
scale: 'cover',
|
|
414
|
+
} );
|
|
415
|
+
} }
|
|
416
|
+
defaultAspectRatio="auto"
|
|
417
|
+
tools={ [ 'aspectRatio' ] }
|
|
418
|
+
/>
|
|
419
|
+
);
|
|
420
|
+
|
|
406
421
|
const resetAll = () => {
|
|
407
422
|
setAttributes( {
|
|
408
423
|
alt: undefined,
|
|
@@ -419,9 +434,12 @@ export default function Image( {
|
|
|
419
434
|
<ToolsPanel
|
|
420
435
|
label={ __( 'Settings' ) }
|
|
421
436
|
resetAll={ resetAll }
|
|
422
|
-
dropdownMenuProps={
|
|
437
|
+
dropdownMenuProps={ dropdownMenuProps }
|
|
423
438
|
>
|
|
424
|
-
{ isResizable &&
|
|
439
|
+
{ isResizable &&
|
|
440
|
+
( parentLayoutType === 'grid'
|
|
441
|
+
? aspectRatioControl
|
|
442
|
+
: dimensionsControl ) }
|
|
425
443
|
</ToolsPanel>
|
|
426
444
|
</InspectorControls>
|
|
427
445
|
);
|
|
@@ -443,16 +461,12 @@ export default function Image( {
|
|
|
443
461
|
return {};
|
|
444
462
|
}
|
|
445
463
|
const { getBlockBindingsSource } = unlock( select( blocksStore ) );
|
|
446
|
-
const { getBlockParentsByBlockName } = unlock(
|
|
447
|
-
select( blockEditorStore )
|
|
448
|
-
);
|
|
449
464
|
const {
|
|
450
465
|
url: urlBinding,
|
|
451
466
|
alt: altBinding,
|
|
452
467
|
title: titleBinding,
|
|
453
468
|
} = metadata?.bindings || {};
|
|
454
|
-
const hasParentPattern =
|
|
455
|
-
getBlockParentsByBlockName( clientId, 'core/block' ).length > 0;
|
|
469
|
+
const hasParentPattern = !! context[ 'pattern/overrides' ];
|
|
456
470
|
const urlBindingSource = getBlockBindingsSource(
|
|
457
471
|
urlBinding?.source
|
|
458
472
|
);
|
|
@@ -508,7 +522,12 @@ export default function Image( {
|
|
|
508
522
|
: __( 'Connected to dynamic data' ),
|
|
509
523
|
};
|
|
510
524
|
},
|
|
511
|
-
[
|
|
525
|
+
[
|
|
526
|
+
arePatternOverridesEnabled,
|
|
527
|
+
context,
|
|
528
|
+
isSingleSelected,
|
|
529
|
+
metadata?.bindings,
|
|
530
|
+
]
|
|
512
531
|
);
|
|
513
532
|
|
|
514
533
|
const showUrlInput =
|
|
@@ -691,7 +710,7 @@ export default function Image( {
|
|
|
691
710
|
<ToolsPanel
|
|
692
711
|
label={ __( 'Settings' ) }
|
|
693
712
|
resetAll={ resetAll }
|
|
694
|
-
dropdownMenuProps={
|
|
713
|
+
dropdownMenuProps={ dropdownMenuProps }
|
|
695
714
|
>
|
|
696
715
|
{ isSingleSelected && (
|
|
697
716
|
<ToolsPanelItem
|
|
@@ -735,7 +754,10 @@ export default function Image( {
|
|
|
735
754
|
/>
|
|
736
755
|
</ToolsPanelItem>
|
|
737
756
|
) }
|
|
738
|
-
{ isResizable &&
|
|
757
|
+
{ isResizable &&
|
|
758
|
+
( parentLayoutType === 'grid'
|
|
759
|
+
? aspectRatioControl
|
|
760
|
+
: dimensionsControl ) }
|
|
739
761
|
{ !! imageSizeOptions.length && (
|
|
740
762
|
<ResolutionTool
|
|
741
763
|
value={ sizeSlug }
|
|
@@ -845,7 +867,7 @@ export default function Image( {
|
|
|
845
867
|
/>
|
|
846
868
|
</ImageWrapper>
|
|
847
869
|
);
|
|
848
|
-
} else if ( ! isResizable ) {
|
|
870
|
+
} else if ( ! isResizable || parentLayoutType === 'grid' ) {
|
|
849
871
|
img = (
|
|
850
872
|
<div style={ { width, height, aspectRatio } }>
|
|
851
873
|
<ImageWrapper href={ href }>{ img }</ImageWrapper>
|
package/src/image/index.php
CHANGED
|
@@ -28,12 +28,33 @@ function render_block_core_image( $attributes, $content, $block ) {
|
|
|
28
28
|
return '';
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
+
$has_id_binding = isset( $attributes['metadata']['bindings']['id'] ) && isset( $attributes['id'] );
|
|
32
|
+
|
|
33
|
+
// Ensure the `wp-image-id` classname on the image block supports block bindings.
|
|
34
|
+
if ( $has_id_binding ) {
|
|
35
|
+
// If there's a mismatch with the 'wp-image-' class and the actual id, the id was
|
|
36
|
+
// probably overridden by block bindings. Update it to the correct value.
|
|
37
|
+
// See https://github.com/WordPress/gutenberg/issues/62886 for why this is needed.
|
|
38
|
+
$id = $attributes['id'];
|
|
39
|
+
$image_classnames = $p->get_attribute( 'class' );
|
|
40
|
+
$class_with_binding_value = "wp-image-$id";
|
|
41
|
+
if ( is_string( $image_classnames ) && ! str_contains( $image_classnames, $class_with_binding_value ) ) {
|
|
42
|
+
$image_classnames = preg_replace( '/wp-image-(\d+)/', $class_with_binding_value, $image_classnames );
|
|
43
|
+
$p->set_attribute( 'class', $image_classnames );
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// For backwards compatibility, the data-id html attribute is only set for
|
|
48
|
+
// image blocks nested in a gallery. Detect if the image is in a gallery by
|
|
49
|
+
// checking the data-id attribute.
|
|
50
|
+
// See the `block_core_gallery_data_id_backcompatibility` function.
|
|
31
51
|
if ( isset( $attributes['data-id'] ) ) {
|
|
32
|
-
//
|
|
33
|
-
//
|
|
34
|
-
//
|
|
35
|
-
//
|
|
36
|
-
$
|
|
52
|
+
// If there's a binding for the `id`, the `id` attribute is used for the
|
|
53
|
+
// value, since `data-id` does not support block bindings.
|
|
54
|
+
// Else the `data-id` is used for backwards compatibility, since
|
|
55
|
+
// third parties may be filtering its value.
|
|
56
|
+
$data_id = $has_id_binding ? $attributes['id'] : $attributes['data-id'];
|
|
57
|
+
$p->set_attribute( 'data-id', $data_id );
|
|
37
58
|
}
|
|
38
59
|
|
|
39
60
|
$link_destination = isset( $attributes['linkDestination'] ) ? $attributes['linkDestination'] : 'none';
|
package/src/image/transforms.js
CHANGED
package/src/list-item/block.json
CHANGED
|
@@ -21,8 +21,15 @@
|
|
|
21
21
|
},
|
|
22
22
|
"supports": {
|
|
23
23
|
"className": false,
|
|
24
|
-
"__experimentalSelector": ".wp-block-list > li",
|
|
25
24
|
"splitting": true,
|
|
25
|
+
"color": {
|
|
26
|
+
"gradients": true,
|
|
27
|
+
"link": true,
|
|
28
|
+
"__experimentalDefaultControls": {
|
|
29
|
+
"background": true,
|
|
30
|
+
"text": true
|
|
31
|
+
}
|
|
32
|
+
},
|
|
26
33
|
"spacing": {
|
|
27
34
|
"margin": true,
|
|
28
35
|
"padding": true,
|
|
@@ -47,5 +54,8 @@
|
|
|
47
54
|
"interactivity": {
|
|
48
55
|
"clientNavigation": true
|
|
49
56
|
}
|
|
57
|
+
},
|
|
58
|
+
"selectors": {
|
|
59
|
+
"root": ".wp-block-list > li"
|
|
50
60
|
}
|
|
51
61
|
}
|
package/src/list-item/edit.js
CHANGED
|
@@ -61,7 +61,7 @@ export function IndentUI( { clientId } ) {
|
|
|
61
61
|
icon={ isRTL() ? formatIndentRTL : formatIndent }
|
|
62
62
|
title={ __( 'Indent' ) }
|
|
63
63
|
describedBy={ __( 'Indent list item' ) }
|
|
64
|
-
|
|
64
|
+
disabled={ ! canIndent }
|
|
65
65
|
onClick={ () => indentListItem() }
|
|
66
66
|
/>
|
|
67
67
|
</>
|
|
@@ -92,11 +92,25 @@ export default function useMerge( clientId, onMerge ) {
|
|
|
92
92
|
// list.
|
|
93
93
|
const [ nestedListClientId ] = getBlockOrder( clientIdB );
|
|
94
94
|
if ( nestedListClientId ) {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
95
|
+
// If we are merging with the previous list item, and the
|
|
96
|
+
// previous list item does not have nested list, move the
|
|
97
|
+
// nested list to the previous list item.
|
|
98
|
+
if (
|
|
99
|
+
getPreviousBlockClientId( clientIdB ) === clientIdA &&
|
|
100
|
+
! getBlockOrder( clientIdA ).length
|
|
101
|
+
) {
|
|
102
|
+
moveBlocksToPosition(
|
|
103
|
+
[ nestedListClientId ],
|
|
104
|
+
clientIdB,
|
|
105
|
+
clientIdA
|
|
106
|
+
);
|
|
107
|
+
} else {
|
|
108
|
+
moveBlocksToPosition(
|
|
109
|
+
getBlockOrder( nestedListClientId ),
|
|
110
|
+
nestedListClientId,
|
|
111
|
+
getBlockRootClientId( clientIdA )
|
|
112
|
+
);
|
|
113
|
+
}
|
|
100
114
|
}
|
|
101
115
|
mergeBlocks( clientIdA, clientIdB );
|
|
102
116
|
} );
|
package/src/loginout/block.json
CHANGED
package/src/media-text/edit.js
CHANGED
|
@@ -46,7 +46,7 @@ import {
|
|
|
46
46
|
TEMPLATE,
|
|
47
47
|
} from './constants';
|
|
48
48
|
import { unlock } from '../lock-unlock';
|
|
49
|
-
import {
|
|
49
|
+
import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
|
|
50
50
|
|
|
51
51
|
const { ResolutionTool } = unlock( blockEditorPrivateApis );
|
|
52
52
|
|
|
@@ -276,6 +276,7 @@ function MediaTextEdit( {
|
|
|
276
276
|
mediaSizeSlug: newMediaSizeSlug,
|
|
277
277
|
} );
|
|
278
278
|
};
|
|
279
|
+
const dropdownMenuProps = useToolsPanelDropdownMenuProps();
|
|
279
280
|
|
|
280
281
|
const mediaTextGeneralSettings = (
|
|
281
282
|
<ToolsPanel
|
|
@@ -290,7 +291,7 @@ function MediaTextEdit( {
|
|
|
290
291
|
mediaSizeSlug: undefined,
|
|
291
292
|
} );
|
|
292
293
|
} }
|
|
293
|
-
dropdownMenuProps={
|
|
294
|
+
dropdownMenuProps={ dropdownMenuProps }
|
|
294
295
|
>
|
|
295
296
|
<ToolsPanelItem
|
|
296
297
|
label={ __( 'Media width' ) }
|
|
@@ -387,7 +387,7 @@ export default function NavigationSubmenuEdit( {
|
|
|
387
387
|
title={ __( 'Convert to Link' ) }
|
|
388
388
|
onClick={ transformToLink }
|
|
389
389
|
className="wp-block-navigation__submenu__revert"
|
|
390
|
-
|
|
390
|
+
disabled={ ! canConvertToLink }
|
|
391
391
|
/>
|
|
392
392
|
</ToolbarGroup>
|
|
393
393
|
</BlockControls>
|
package/src/page-list/edit.js
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
// Allow these default styles to be overridden by global styles.
|
|
2
|
+
:where(.wp-block-post-comments-form) {
|
|
3
|
+
textarea,
|
|
4
|
+
input:not([type="submit"]) {
|
|
5
|
+
border: 1px solid $gray-600;
|
|
6
|
+
font-size: 1em;
|
|
7
|
+
font-family: inherit;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
textarea,
|
|
11
|
+
input:where(:not([type="submit"]):not([type="checkbox"])) {
|
|
12
|
+
padding: calc(0.667em + 2px); // The extra 2px is added to match outline buttons.
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
1
16
|
.wp-block-post-comments-form {
|
|
2
17
|
// This block has customizable padding, border-box makes that more predictable.
|
|
3
18
|
box-sizing: border-box;
|
|
@@ -31,18 +46,6 @@
|
|
|
31
46
|
overflow-wrap: break-word;
|
|
32
47
|
}
|
|
33
48
|
|
|
34
|
-
textarea,
|
|
35
|
-
input:not([type="submit"]) {
|
|
36
|
-
border: 1px solid $gray-600;
|
|
37
|
-
font-size: 1em;
|
|
38
|
-
font-family: inherit;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
textarea,
|
|
42
|
-
input:not([type="submit"]):not([type="checkbox"]) {
|
|
43
|
-
padding: calc(0.667em + 2px); // The extra 2px is added to match outline buttons.
|
|
44
|
-
}
|
|
45
|
-
|
|
46
49
|
.comment-form {
|
|
47
50
|
textarea,
|
|
48
51
|
// Make sure to not set display block on hidden input fields, to prevent
|
package/src/post-date/edit.js
CHANGED
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
ToggleControl,
|
|
29
29
|
PanelBody,
|
|
30
30
|
} from '@wordpress/components';
|
|
31
|
-
import { __, sprintf } from '@wordpress/i18n';
|
|
31
|
+
import { __, _x, sprintf } from '@wordpress/i18n';
|
|
32
32
|
import { edit } from '@wordpress/icons';
|
|
33
33
|
import { DOWN } from '@wordpress/keycodes';
|
|
34
34
|
import { useSelect } from '@wordpress/data';
|
|
@@ -128,6 +128,10 @@ export default function PostDateEdit( {
|
|
|
128
128
|
siteTimeFormat
|
|
129
129
|
) }
|
|
130
130
|
onClose={ onClose }
|
|
131
|
+
dateOrder={
|
|
132
|
+
/* translators: Order of day, month, and year. Available formats are 'dmy', 'mdy', and 'ymd'. */
|
|
133
|
+
_x( 'dmy', 'date order' )
|
|
134
|
+
}
|
|
131
135
|
/>
|
|
132
136
|
) }
|
|
133
137
|
renderToggle={ ( { isOpen, onToggle } ) => {
|
package/src/post-date/index.php
CHANGED
|
@@ -23,8 +23,14 @@ function render_block_core_post_date( $attributes, $content, $block ) {
|
|
|
23
23
|
$post_ID = $block->context['postId'];
|
|
24
24
|
|
|
25
25
|
if ( isset( $attributes['format'] ) && 'human-diff' === $attributes['format'] ) {
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
$post_timestamp = get_post_timestamp( $post_ID );
|
|
27
|
+
if ( $post_timestamp > time() ) {
|
|
28
|
+
// translators: %s: human-readable time difference.
|
|
29
|
+
$formatted_date = sprintf( __( '%s from now', 'gutenberg' ), human_time_diff( $post_timestamp ) );
|
|
30
|
+
} else {
|
|
31
|
+
// translators: %s: human-readable time difference.
|
|
32
|
+
$formatted_date = sprintf( __( '%s ago', 'gutenberg' ), human_time_diff( $post_timestamp ) );
|
|
33
|
+
}
|
|
28
34
|
} else {
|
|
29
35
|
$formatted_date = get_the_date( empty( $attributes['format'] ) ? '' : $attributes['format'], $post_ID );
|
|
30
36
|
}
|
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
isControlAllowed,
|
|
35
35
|
useTaxonomies,
|
|
36
36
|
} from '../../utils';
|
|
37
|
-
import {
|
|
37
|
+
import { useToolsPanelDropdownMenuProps } from '../../../utils/hooks';
|
|
38
38
|
|
|
39
39
|
const { BlockInfo } = unlock( blockEditorPrivateApis );
|
|
40
40
|
|
|
@@ -128,6 +128,7 @@ export default function QueryInspectorControls( props ) {
|
|
|
128
128
|
showAuthorControl ||
|
|
129
129
|
showSearchControl ||
|
|
130
130
|
showParentControl;
|
|
131
|
+
const dropdownMenuProps = useToolsPanelDropdownMenuProps();
|
|
131
132
|
|
|
132
133
|
return (
|
|
133
134
|
<>
|
|
@@ -223,7 +224,7 @@ export default function QueryInspectorControls( props ) {
|
|
|
223
224
|
} );
|
|
224
225
|
setQuerySearch( '' );
|
|
225
226
|
} }
|
|
226
|
-
dropdownMenuProps={
|
|
227
|
+
dropdownMenuProps={ dropdownMenuProps }
|
|
227
228
|
>
|
|
228
229
|
{ showTaxControl && (
|
|
229
230
|
<ToolsPanelItem
|