@wordpress/block-editor 14.16.0 → 14.17.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/components/background-image-control/index.js +18 -10
- package/build/components/background-image-control/index.js.map +1 -1
- package/build/components/block-list/block.js +4 -2
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/use-block-props/use-firefox-draggable-compatibility.js +14 -11
- package/build/components/block-list/use-block-props/use-firefox-draggable-compatibility.js.map +1 -1
- package/build/components/block-tools/use-show-block-tools.js +3 -2
- package/build/components/block-tools/use-show-block-tools.js.map +1 -1
- package/build/components/inserter/media-tab/media-preview.js +1 -7
- package/build/components/inserter/media-tab/media-preview.js.map +1 -1
- package/build/components/link-control/index.js +2 -0
- package/build/components/link-control/index.js.map +1 -1
- package/build/hooks/spacing-visualizer.js +14 -8
- package/build/hooks/spacing-visualizer.js.map +1 -1
- package/build-module/components/background-image-control/index.js +19 -11
- package/build-module/components/background-image-control/index.js.map +1 -1
- package/build-module/components/block-list/block.js +4 -2
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-firefox-draggable-compatibility.js +14 -11
- package/build-module/components/block-list/use-block-props/use-firefox-draggable-compatibility.js.map +1 -1
- package/build-module/components/block-tools/use-show-block-tools.js +3 -2
- package/build-module/components/block-tools/use-show-block-tools.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-preview.js +1 -7
- package/build-module/components/inserter/media-tab/media-preview.js.map +1 -1
- package/build-module/components/link-control/index.js +4 -1
- package/build-module/components/link-control/index.js.map +1 -1
- package/build-module/hooks/spacing-visualizer.js +15 -9
- package/build-module/hooks/spacing-visualizer.js.map +1 -1
- package/package.json +34 -34
- package/src/components/background-image-control/index.js +22 -7
- package/src/components/block-list/block.js +6 -2
- package/src/components/block-list/use-block-props/use-firefox-draggable-compatibility.js +14 -11
- package/src/components/block-tools/use-show-block-tools.js +2 -0
- package/src/components/inserter/media-tab/media-preview.js +1 -8
- package/src/components/link-control/index.js +6 -1
- package/src/hooks/spacing-visualizer.js +14 -17
|
@@ -36,7 +36,6 @@ import { getBlockAndPreviewFromMedia } from './utils';
|
|
|
36
36
|
import { store as blockEditorStore } from '../../../store';
|
|
37
37
|
|
|
38
38
|
const ALLOWED_MEDIA_TYPES = [ 'image' ];
|
|
39
|
-
const MAXIMUM_TITLE_LENGTH = 25;
|
|
40
39
|
const MEDIA_OPTIONS_POPOVER_PROPS = {
|
|
41
40
|
position: 'bottom left',
|
|
42
41
|
className:
|
|
@@ -239,12 +238,6 @@ export function MediaPreview( { media, onClick, category } ) {
|
|
|
239
238
|
? media.title
|
|
240
239
|
: media.title?.rendered || __( 'no title' );
|
|
241
240
|
|
|
242
|
-
let truncatedTitle;
|
|
243
|
-
if ( title.length > MAXIMUM_TITLE_LENGTH ) {
|
|
244
|
-
const omission = '...';
|
|
245
|
-
truncatedTitle =
|
|
246
|
-
title.slice( 0, MAXIMUM_TITLE_LENGTH - omission.length ) + omission;
|
|
247
|
-
}
|
|
248
241
|
const onMouseEnter = useCallback( () => setIsHovered( true ), [] );
|
|
249
242
|
const onMouseLeave = useCallback( () => setIsHovered( false ), [] );
|
|
250
243
|
return (
|
|
@@ -268,7 +261,7 @@ export function MediaPreview( { media, onClick, category } ) {
|
|
|
268
261
|
onMouseEnter={ onMouseEnter }
|
|
269
262
|
onMouseLeave={ onMouseLeave }
|
|
270
263
|
>
|
|
271
|
-
<Tooltip text={
|
|
264
|
+
<Tooltip text={ title }>
|
|
272
265
|
<Composite.Item
|
|
273
266
|
render={
|
|
274
267
|
<div
|
|
@@ -501,7 +501,7 @@ function LinkControl( {
|
|
|
501
501
|
LinkControl.ViewerFill = ViewerFill;
|
|
502
502
|
LinkControl.DEFAULT_LINK_SETTINGS = DEFAULT_LINK_SETTINGS;
|
|
503
503
|
|
|
504
|
-
|
|
504
|
+
const DeprecatedExperimentalLinkControl = ( props ) => {
|
|
505
505
|
deprecated( 'wp.blockEditor.__experimentalLinkControl', {
|
|
506
506
|
since: '6.8',
|
|
507
507
|
alternative: 'wp.blockEditor.LinkControl',
|
|
@@ -510,4 +510,9 @@ export const DeprecatedExperimentalLinkControl = ( props ) => {
|
|
|
510
510
|
return <LinkControl { ...props } />;
|
|
511
511
|
};
|
|
512
512
|
|
|
513
|
+
DeprecatedExperimentalLinkControl.ViewerFill = LinkControl.ViewerFill;
|
|
514
|
+
DeprecatedExperimentalLinkControl.DEFAULT_LINK_SETTINGS =
|
|
515
|
+
LinkControl.DEFAULT_LINK_SETTINGS;
|
|
516
|
+
|
|
517
|
+
export { DeprecatedExperimentalLinkControl };
|
|
513
518
|
export default LinkControl;
|
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
5
|
-
useState,
|
|
6
|
-
useRef,
|
|
7
|
-
useLayoutEffect,
|
|
8
|
-
useEffect,
|
|
9
|
-
useReducer,
|
|
10
|
-
} from '@wordpress/element';
|
|
4
|
+
import { useState, useRef, useEffect, useReducer } from '@wordpress/element';
|
|
11
5
|
import isShallowEqual from '@wordpress/is-shallow-equal';
|
|
12
6
|
|
|
13
7
|
/**
|
|
@@ -22,19 +16,22 @@ function SpacingVisualizer( { clientId, value, computeStyle, forceShow } ) {
|
|
|
22
16
|
computeStyle( blockElement )
|
|
23
17
|
);
|
|
24
18
|
|
|
25
|
-
|
|
19
|
+
// It's not sufficient to read the block’s computed style when `value` changes because
|
|
20
|
+
// the effect would run before the block’s style has updated. Thus observing mutations
|
|
21
|
+
// to the block’s attributes is used to trigger updates to the visualizer’s styles.
|
|
22
|
+
useEffect( () => {
|
|
26
23
|
if ( ! blockElement ) {
|
|
27
24
|
return;
|
|
28
25
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}, [ blockElement
|
|
26
|
+
const observer = new window.MutationObserver( updateStyle );
|
|
27
|
+
observer.observe( blockElement, {
|
|
28
|
+
attributes: true,
|
|
29
|
+
attributeFilter: [ 'style', 'class' ],
|
|
30
|
+
} );
|
|
31
|
+
return () => {
|
|
32
|
+
observer.disconnect();
|
|
33
|
+
};
|
|
34
|
+
}, [ blockElement ] );
|
|
38
35
|
|
|
39
36
|
const previousValueRef = useRef( value );
|
|
40
37
|
const [ isActive, setIsActive ] = useState( false );
|