@wordpress/block-library 8.24.0 → 8.25.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 +7 -52
- package/build/audio/edit.js.map +1 -1
- package/build/audio/edit.native.js +1 -1
- package/build/audio/edit.native.js.map +1 -1
- package/build/audio/index.js +2 -2
- package/build/block/edit.js +102 -11
- package/build/block/edit.js.map +1 -1
- package/build/block/index.js +3 -2
- package/build/block/index.js.map +1 -1
- package/build/block/v1/edit.js +116 -0
- package/build/block/v1/edit.js.map +1 -0
- package/build/block/{edit.native.js → v1/edit.native.js} +2 -2
- package/build/block/v1/edit.native.js.map +1 -0
- package/build/button/index.js +2 -2
- package/build/button/save.js +1 -1
- package/build/button/save.js.map +1 -1
- package/build/code/edit.native.js +13 -14
- package/build/code/edit.native.js.map +1 -1
- package/build/code/index.js +2 -2
- package/build/code/save.js +6 -2
- package/build/code/save.js.map +1 -1
- package/build/details/index.js +2 -2
- package/build/embed/deprecated.js +2 -2
- package/build/embed/embed-preview.native.js +1 -1
- package/build/embed/embed-preview.native.js.map +1 -1
- package/build/embed/icons.js +1 -1
- package/build/embed/icons.js.map +1 -1
- package/build/embed/index.js +2 -2
- package/build/embed/transforms.js +2 -2
- package/build/embed/util.js +2 -2
- package/build/file/edit.js +1 -1
- package/build/file/edit.js.map +1 -1
- package/build/file/edit.native.js +1 -1
- package/build/file/edit.native.js.map +1 -1
- package/build/file/index.js +4 -4
- package/build/file/save.js +4 -1
- package/build/file/save.js.map +1 -1
- package/build/form-input/deprecated.js +147 -0
- package/build/form-input/deprecated.js.map +1 -0
- package/build/form-input/edit.js +1 -1
- package/build/form-input/edit.js.map +1 -1
- package/build/form-input/index.js +4 -2
- package/build/form-input/index.js.map +1 -1
- package/build/form-input/save.js +7 -9
- package/build/form-input/save.js.map +1 -1
- package/build/gallery/edit.js +2 -41
- package/build/gallery/edit.js.map +1 -1
- package/build/gallery/gallery.js +18 -24
- package/build/gallery/gallery.js.map +1 -1
- package/build/gallery/gallery.native.js +1 -1
- package/build/gallery/gallery.native.js.map +1 -1
- package/build/gallery/index.js +4 -4
- package/build/gallery/v1/gallery.native.js +1 -1
- package/build/gallery/v1/gallery.native.js.map +1 -1
- package/build/group/edit.js +6 -1
- package/build/group/edit.js.map +1 -1
- package/build/heading/index.js +3 -6
- package/build/heading/index.js.map +1 -1
- package/build/image/edit.native.js +1 -1
- package/build/image/edit.native.js.map +1 -1
- package/build/image/image.js +14 -51
- package/build/image/image.js.map +1 -1
- package/build/image/index.js +2 -2
- package/build/image/save.js +3 -1
- package/build/image/save.js.map +1 -1
- package/build/list-item/index.js +10 -3
- package/build/list-item/index.js.map +1 -1
- package/build/navigation/edit/index.js +1 -1
- package/build/navigation/edit/index.js.map +1 -1
- package/build/page-list/convert-to-links-modal.js +2 -2
- package/build/page-list/convert-to-links-modal.js.map +1 -1
- package/build/paragraph/edit.js +54 -32
- package/build/paragraph/edit.js.map +1 -1
- package/build/paragraph/index.js +2 -3
- package/build/paragraph/index.js.map +1 -1
- package/build/paragraph/transforms.js +2 -3
- package/build/paragraph/transforms.js.map +1 -1
- package/build/post-title/index.js +1 -3
- package/build/post-title/index.js.map +1 -1
- package/build/preformatted/index.js +2 -3
- package/build/preformatted/index.js.map +1 -1
- package/build/pullquote/index.js +5 -7
- package/build/pullquote/index.js.map +1 -1
- package/build/query/edit/inspector-controls/taxonomy-controls.js +2 -0
- package/build/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
- package/build/query-title/index.js +1 -3
- package/build/query-title/index.js.map +1 -1
- package/build/quote/index.js +3 -5
- package/build/quote/index.js.map +1 -1
- package/build/quote/transforms.js +7 -6
- package/build/quote/transforms.js.map +1 -1
- package/build/site-title/index.js +1 -5
- package/build/site-title/index.js.map +1 -1
- package/build/social-link/icons/gravatar.js +22 -0
- package/build/social-link/icons/gravatar.js.map +1 -0
- package/build/social-link/icons/index.js +11 -0
- package/build/social-link/icons/index.js.map +1 -1
- package/build/social-link/variations.js +7 -0
- package/build/social-link/variations.js.map +1 -1
- package/build/table/edit.js +3 -1
- package/build/table/edit.js.map +1 -1
- package/build/table/index.js +9 -10
- package/build/table/index.js.map +1 -1
- package/build/table-of-contents/edit.js +2 -2
- package/build/table-of-contents/edit.js.map +1 -1
- package/build/table-of-contents/index.js +5 -2
- package/build/table-of-contents/index.js.map +1 -1
- package/build/utils/caption.js +90 -0
- package/build/utils/caption.js.map +1 -0
- package/build/utils/remove-anchor-tag.js +2 -1
- package/build/utils/remove-anchor-tag.js.map +1 -1
- package/build/verse/index.js +3 -5
- package/build/verse/index.js.map +1 -1
- package/build/video/deprecated.js +2 -2
- package/build/video/edit.js +8 -52
- package/build/video/edit.js.map +1 -1
- package/build/video/edit.native.js +1 -1
- package/build/video/edit.native.js.map +1 -1
- package/build/video/index.js +2 -2
- package/build-module/audio/edit.js +11 -56
- package/build-module/audio/edit.js.map +1 -1
- package/build-module/audio/edit.native.js +2 -2
- package/build-module/audio/edit.native.js.map +1 -1
- package/build-module/audio/index.js +2 -2
- package/build-module/block/edit.js +104 -13
- package/build-module/block/edit.js.map +1 -1
- package/build-module/block/index.js +3 -2
- package/build-module/block/index.js.map +1 -1
- package/build-module/block/v1/edit.js +108 -0
- package/build-module/block/v1/edit.js.map +1 -0
- package/build-module/block/{edit.native.js → v1/edit.native.js} +2 -2
- package/build-module/block/v1/edit.native.js.map +1 -0
- package/build-module/button/index.js +2 -2
- package/build-module/button/save.js +1 -1
- package/build-module/button/save.js.map +1 -1
- package/build-module/code/edit.native.js +14 -16
- package/build-module/code/edit.native.js.map +1 -1
- package/build-module/code/index.js +2 -2
- package/build-module/code/save.js +6 -2
- package/build-module/code/save.js.map +1 -1
- package/build-module/details/index.js +2 -2
- package/build-module/embed/deprecated.js +2 -2
- package/build-module/embed/embed-preview.native.js +2 -2
- package/build-module/embed/embed-preview.native.js.map +1 -1
- package/build-module/embed/icons.js +1 -1
- package/build-module/embed/icons.js.map +1 -1
- package/build-module/embed/index.js +2 -2
- package/build-module/embed/transforms.js +2 -2
- package/build-module/embed/util.js +2 -2
- package/build-module/file/edit.js +1 -1
- package/build-module/file/edit.js.map +1 -1
- package/build-module/file/edit.native.js +1 -1
- package/build-module/file/edit.native.js.map +1 -1
- package/build-module/file/index.js +4 -4
- package/build-module/file/save.js +4 -1
- package/build-module/file/save.js.map +1 -1
- package/build-module/form-input/deprecated.js +138 -0
- package/build-module/form-input/deprecated.js.map +1 -0
- package/build-module/form-input/edit.js +1 -1
- package/build-module/form-input/edit.js.map +1 -1
- package/build-module/form-input/index.js +4 -2
- package/build-module/form-input/index.js.map +1 -1
- package/build-module/form-input/save.js +8 -10
- package/build-module/form-input/save.js.map +1 -1
- package/build-module/gallery/edit.js +5 -44
- package/build-module/gallery/edit.js.map +1 -1
- package/build-module/gallery/gallery.js +17 -21
- package/build-module/gallery/gallery.js.map +1 -1
- package/build-module/gallery/gallery.native.js +2 -2
- package/build-module/gallery/gallery.native.js.map +1 -1
- package/build-module/gallery/index.js +4 -4
- package/build-module/gallery/v1/gallery.native.js +2 -2
- package/build-module/gallery/v1/gallery.native.js.map +1 -1
- package/build-module/group/edit.js +6 -1
- package/build-module/group/edit.js.map +1 -1
- package/build-module/heading/index.js +3 -6
- package/build-module/heading/index.js.map +1 -1
- package/build-module/image/edit.native.js +2 -2
- package/build-module/image/edit.native.js.map +1 -1
- package/build-module/image/image.js +19 -56
- package/build-module/image/image.js.map +1 -1
- package/build-module/image/index.js +2 -2
- package/build-module/image/save.js +3 -1
- package/build-module/image/save.js.map +1 -1
- package/build-module/list-item/index.js +10 -3
- package/build-module/list-item/index.js.map +1 -1
- package/build-module/navigation/edit/index.js +2 -2
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/page-list/convert-to-links-modal.js +2 -2
- package/build-module/page-list/convert-to-links-modal.js.map +1 -1
- package/build-module/paragraph/edit.js +54 -32
- package/build-module/paragraph/edit.js.map +1 -1
- package/build-module/paragraph/index.js +2 -3
- package/build-module/paragraph/index.js.map +1 -1
- package/build-module/paragraph/transforms.js +2 -3
- package/build-module/paragraph/transforms.js.map +1 -1
- package/build-module/post-title/index.js +1 -3
- package/build-module/post-title/index.js.map +1 -1
- package/build-module/preformatted/index.js +2 -3
- package/build-module/preformatted/index.js.map +1 -1
- package/build-module/pullquote/index.js +5 -7
- package/build-module/pullquote/index.js.map +1 -1
- package/build-module/query/edit/inspector-controls/taxonomy-controls.js +2 -0
- package/build-module/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
- package/build-module/query-title/index.js +1 -3
- package/build-module/query-title/index.js.map +1 -1
- package/build-module/quote/index.js +3 -5
- package/build-module/quote/index.js.map +1 -1
- package/build-module/quote/transforms.js +7 -6
- package/build-module/quote/transforms.js.map +1 -1
- package/build-module/site-title/index.js +1 -5
- package/build-module/site-title/index.js.map +1 -1
- package/build-module/social-link/icons/gravatar.js +14 -0
- package/build-module/social-link/icons/gravatar.js.map +1 -0
- package/build-module/social-link/icons/index.js +1 -0
- package/build-module/social-link/icons/index.js.map +1 -1
- package/build-module/social-link/variations.js +8 -1
- package/build-module/social-link/variations.js.map +1 -1
- package/build-module/table/edit.js +3 -1
- package/build-module/table/edit.js.map +1 -1
- package/build-module/table/index.js +9 -10
- package/build-module/table/index.js.map +1 -1
- package/build-module/table-of-contents/edit.js +1 -1
- package/build-module/table-of-contents/edit.js.map +1 -1
- package/build-module/table-of-contents/index.js +5 -1
- package/build-module/table-of-contents/index.js.map +1 -1
- package/build-module/utils/caption.js +82 -0
- package/build-module/utils/caption.js.map +1 -0
- package/build-module/utils/remove-anchor-tag.js +2 -1
- package/build-module/utils/remove-anchor-tag.js.map +1 -1
- package/build-module/verse/index.js +3 -5
- package/build-module/verse/index.js.map +1 -1
- package/build-module/video/deprecated.js +2 -2
- package/build-module/video/edit.js +13 -57
- package/build-module/video/edit.js.map +1 -1
- package/build-module/video/edit.native.js +2 -2
- package/build-module/video/edit.native.js.map +1 -1
- package/build-module/video/index.js +2 -2
- package/build-style/editor-rtl.css +1 -11
- package/build-style/editor.css +1 -11
- package/build-style/social-links/style-rtl.css +14 -2
- package/build-style/social-links/style.css +14 -2
- package/build-style/style-rtl.css +14 -2
- package/build-style/style.css +14 -2
- package/build-style/table/editor-rtl.css +1 -11
- package/build-style/table/editor.css +1 -11
- package/package.json +32 -32
- package/src/audio/block.json +2 -2
- package/src/audio/edit.js +11 -74
- package/src/audio/edit.native.js +2 -1
- package/src/block/edit.js +143 -16
- package/src/block/index.js +3 -2
- package/src/block/index.php +48 -0
- package/src/block/v1/edit.js +163 -0
- package/src/block/{edit.native.js → v1/edit.native.js} +2 -2
- package/src/button/block.json +2 -2
- package/src/button/save.js +1 -1
- package/src/code/block.json +2 -2
- package/src/code/edit.native.js +11 -13
- package/src/code/save.js +4 -1
- package/src/code/test/edit.native.js +2 -2
- package/src/cover/test/edit.native.js +7 -1
- package/src/details/block.json +2 -2
- package/src/embed/block.json +2 -2
- package/src/embed/embed-preview.native.js +2 -1
- package/src/embed/icons.js +1 -1
- package/src/file/block.json +4 -4
- package/src/file/edit.js +1 -1
- package/src/file/edit.native.js +1 -1
- package/src/file/save.js +5 -1
- package/src/form-input/block.json +2 -2
- package/src/form-input/deprecated.js +142 -0
- package/src/form-input/edit.js +1 -1
- package/src/form-input/index.js +2 -0
- package/src/form-input/save.js +27 -24
- package/src/gallery/block.json +4 -4
- package/src/gallery/edit.js +4 -59
- package/src/gallery/gallery.js +19 -36
- package/src/gallery/gallery.native.js +6 -2
- package/src/gallery/v1/gallery.native.js +2 -1
- package/src/group/edit.js +4 -1
- package/src/heading/block.json +3 -6
- package/src/image/block.json +2 -2
- package/src/image/edit.native.js +2 -3
- package/src/image/image.js +24 -93
- package/src/image/save.js +3 -1
- package/src/list-item/block.json +10 -3
- package/src/navigation/edit/index.js +7 -2
- package/src/navigation/index.php +1 -1
- package/src/navigation-link/test/__snapshots__/hooks.js.snap +6 -3
- package/src/page-list/convert-to-links-modal.js +2 -2
- package/src/paragraph/block.json +2 -3
- package/src/paragraph/edit.js +53 -40
- package/src/post-title/block.json +1 -3
- package/src/preformatted/block.json +2 -3
- package/src/pullquote/block.json +5 -7
- package/src/query/edit/inspector-controls/taxonomy-controls.js +2 -0
- package/src/query-title/block.json +1 -3
- package/src/quote/block.json +3 -5
- package/src/quote/transforms.js +12 -11
- package/src/site-title/block.json +1 -5
- package/src/social-link/icons/gravatar.js +10 -0
- package/src/social-link/icons/index.js +1 -0
- package/src/social-link/index.php +4 -0
- package/src/social-link/socials-with-bg.scss +5 -0
- package/src/social-link/socials-without-bg.scss +4 -0
- package/src/social-link/variations.js +7 -0
- package/src/social-links/style.scss +14 -8
- package/src/table/block.json +9 -10
- package/src/table/edit.js +3 -1
- package/src/table/editor.scss +1 -14
- package/src/table-of-contents/edit.js +1 -1
- package/src/table-of-contents/index.js +5 -1
- package/src/utils/caption.js +108 -0
- package/src/utils/remove-anchor-tag.js +2 -1
- package/src/verse/block.json +3 -5
- package/src/video/block.json +2 -2
- package/src/video/edit.js +12 -74
- package/src/video/edit.native.js +2 -1
- package/build/block/edit.native.js.map +0 -1
- package/build/table-of-contents/icon.js +0 -22
- package/build/table-of-contents/icon.js.map +0 -1
- package/build-module/block/edit.native.js.map +0 -1
- package/build-module/table-of-contents/icon.js +0 -15
- package/build-module/table-of-contents/icon.js.map +0 -1
- package/src/table-of-contents/icon.js +0 -18
package/src/gallery/gallery.js
CHANGED
|
@@ -6,16 +6,15 @@ import classnames from 'classnames';
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
|
-
import {
|
|
10
|
-
RichText,
|
|
11
|
-
__experimentalGetElementClassName,
|
|
12
|
-
} from '@wordpress/block-editor';
|
|
13
9
|
import { __ } from '@wordpress/i18n';
|
|
14
|
-
import { createBlock, getDefaultBlockName } from '@wordpress/blocks';
|
|
15
10
|
import { View } from '@wordpress/primitives';
|
|
16
|
-
import { forwardRef } from '@wordpress/element';
|
|
17
11
|
|
|
18
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Internal dependencies
|
|
14
|
+
*/
|
|
15
|
+
import { Caption } from '../utils/caption';
|
|
16
|
+
|
|
17
|
+
export default function Gallery( props ) {
|
|
19
18
|
const {
|
|
20
19
|
attributes,
|
|
21
20
|
isSelected,
|
|
@@ -24,10 +23,10 @@ export const Gallery = ( props, captionRef ) => {
|
|
|
24
23
|
insertBlocksAfter,
|
|
25
24
|
blockProps,
|
|
26
25
|
__unstableLayoutClassNames: layoutClassNames,
|
|
27
|
-
|
|
26
|
+
isContentLocked,
|
|
28
27
|
} = props;
|
|
29
28
|
|
|
30
|
-
const { align, columns,
|
|
29
|
+
const { align, columns, imageCrop } = attributes;
|
|
31
30
|
|
|
32
31
|
return (
|
|
33
32
|
<figure
|
|
@@ -50,32 +49,16 @@ export const Gallery = ( props, captionRef ) => {
|
|
|
50
49
|
{ mediaPlaceholder }
|
|
51
50
|
</View>
|
|
52
51
|
) }
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
) }
|
|
64
|
-
ref={ captionRef }
|
|
65
|
-
tagName="figcaption"
|
|
66
|
-
onChange={ ( value ) =>
|
|
67
|
-
setAttributes( { caption: value } )
|
|
68
|
-
}
|
|
69
|
-
inlineToolbar
|
|
70
|
-
__unstableOnSplitAtEnd={ () =>
|
|
71
|
-
insertBlocksAfter(
|
|
72
|
-
createBlock( getDefaultBlockName() )
|
|
73
|
-
)
|
|
74
|
-
}
|
|
75
|
-
/>
|
|
76
|
-
) }
|
|
52
|
+
<Caption
|
|
53
|
+
attributes={ attributes }
|
|
54
|
+
setAttributes={ setAttributes }
|
|
55
|
+
isSelected={ isSelected }
|
|
56
|
+
insertBlocksAfter={ insertBlocksAfter }
|
|
57
|
+
showToolbarButton={ ! isContentLocked }
|
|
58
|
+
className="blocks-gallery-caption"
|
|
59
|
+
label={ __( 'Gallery caption text' ) }
|
|
60
|
+
placeholder={ __( 'Add gallery caption' ) }
|
|
61
|
+
/>
|
|
77
62
|
</figure>
|
|
78
63
|
);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export default forwardRef( Gallery );
|
|
64
|
+
}
|
|
@@ -13,7 +13,11 @@ import styles from './gallery-styles.scss';
|
|
|
13
13
|
* WordPress dependencies
|
|
14
14
|
*/
|
|
15
15
|
import { __, sprintf } from '@wordpress/i18n';
|
|
16
|
-
import {
|
|
16
|
+
import {
|
|
17
|
+
BlockCaption,
|
|
18
|
+
RichText,
|
|
19
|
+
useInnerBlocksProps,
|
|
20
|
+
} from '@wordpress/block-editor';
|
|
17
21
|
import { useState, useEffect } from '@wordpress/element';
|
|
18
22
|
import { mediaUploadSync } from '@wordpress/react-native-bridge';
|
|
19
23
|
import { WIDE_ALIGNMENTS } from '@wordpress/components';
|
|
@@ -99,7 +103,7 @@ export const Gallery = ( props ) => {
|
|
|
99
103
|
isSelected={ isCaptionSelected }
|
|
100
104
|
accessible={ true }
|
|
101
105
|
accessibilityLabelCreator={ ( caption ) =>
|
|
102
|
-
|
|
106
|
+
RichText.isEmpty( caption )
|
|
103
107
|
? /* translators: accessibility text. Empty gallery caption. */
|
|
104
108
|
|
|
105
109
|
'Gallery caption. Empty'
|
|
@@ -17,6 +17,7 @@ import Tiles from './tiles';
|
|
|
17
17
|
import { __, sprintf } from '@wordpress/i18n';
|
|
18
18
|
import {
|
|
19
19
|
BlockCaption,
|
|
20
|
+
RichText,
|
|
20
21
|
store as blockEditorStore,
|
|
21
22
|
} from '@wordpress/block-editor';
|
|
22
23
|
import { useState, useEffect } from '@wordpress/element';
|
|
@@ -141,7 +142,7 @@ export const Gallery = ( props ) => {
|
|
|
141
142
|
isSelected={ isCaptionSelected }
|
|
142
143
|
accessible={ true }
|
|
143
144
|
accessibilityLabelCreator={ ( caption ) =>
|
|
144
|
-
|
|
145
|
+
RichText.isEmpty( caption )
|
|
145
146
|
? /* translators: accessibility text. Empty gallery caption. */
|
|
146
147
|
'Gallery caption. Empty'
|
|
147
148
|
: sprintf(
|
package/src/group/edit.js
CHANGED
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
store as blockEditorStore,
|
|
11
11
|
} from '@wordpress/block-editor';
|
|
12
12
|
import { SelectControl } from '@wordpress/components';
|
|
13
|
+
import { useRef } from '@wordpress/element';
|
|
13
14
|
import { __ } from '@wordpress/i18n';
|
|
14
15
|
import { View } from '@wordpress/primitives';
|
|
15
16
|
|
|
@@ -97,7 +98,8 @@ function GroupEdit( { attributes, name, setAttributes, clientId } ) {
|
|
|
97
98
|
themeSupportsLayout || type === 'flex' || type === 'grid';
|
|
98
99
|
|
|
99
100
|
// Hooks.
|
|
100
|
-
const
|
|
101
|
+
const ref = useRef();
|
|
102
|
+
const blockProps = useBlockProps( { ref } );
|
|
101
103
|
|
|
102
104
|
const [ showPlaceholder, setShowPlaceholder ] = useShouldShowPlaceHolder( {
|
|
103
105
|
attributes,
|
|
@@ -124,6 +126,7 @@ function GroupEdit( { attributes, name, setAttributes, clientId } ) {
|
|
|
124
126
|
? blockProps
|
|
125
127
|
: { className: 'wp-block-group__inner-container' },
|
|
126
128
|
{
|
|
129
|
+
dropZoneElement: ref.current,
|
|
127
130
|
templateLock,
|
|
128
131
|
allowedBlocks,
|
|
129
132
|
renderAppender,
|
package/src/heading/block.json
CHANGED
|
@@ -12,10 +12,9 @@
|
|
|
12
12
|
"type": "string"
|
|
13
13
|
},
|
|
14
14
|
"content": {
|
|
15
|
-
"type": "
|
|
16
|
-
"source": "
|
|
15
|
+
"type": "rich-text",
|
|
16
|
+
"source": "rich-text",
|
|
17
17
|
"selector": "h1,h2,h3,h4,h5,h6",
|
|
18
|
-
"default": "",
|
|
19
18
|
"__experimentalRole": "content"
|
|
20
19
|
},
|
|
21
20
|
"level": {
|
|
@@ -57,9 +56,7 @@
|
|
|
57
56
|
"__experimentalTextDecoration": true,
|
|
58
57
|
"__experimentalWritingMode": true,
|
|
59
58
|
"__experimentalDefaultControls": {
|
|
60
|
-
"fontSize": true
|
|
61
|
-
"fontAppearance": true,
|
|
62
|
-
"textTransform": true
|
|
59
|
+
"fontSize": true
|
|
63
60
|
}
|
|
64
61
|
},
|
|
65
62
|
"__unstablePasteTextInline": true,
|
package/src/image/block.json
CHANGED
package/src/image/edit.native.js
CHANGED
|
@@ -47,6 +47,7 @@ import {
|
|
|
47
47
|
BlockStyles,
|
|
48
48
|
store as blockEditorStore,
|
|
49
49
|
blockSettingsScreens,
|
|
50
|
+
RichText,
|
|
50
51
|
} from '@wordpress/block-editor';
|
|
51
52
|
import { __, _x, sprintf } from '@wordpress/i18n';
|
|
52
53
|
import { getProtocol, hasQueryArg, isURL } from '@wordpress/url';
|
|
@@ -329,9 +330,7 @@ export class ImageEdit extends Component {
|
|
|
329
330
|
|
|
330
331
|
accessibilityLabelCreator( caption ) {
|
|
331
332
|
// Checks if caption is empty.
|
|
332
|
-
return (
|
|
333
|
-
caption === undefined ||
|
|
334
|
-
caption === null
|
|
333
|
+
return RichText.isEmpty( caption )
|
|
335
334
|
? /* translators: accessibility text. Empty image caption. */
|
|
336
335
|
'Image caption. Empty'
|
|
337
336
|
: sprintf(
|
package/src/image/image.js
CHANGED
|
@@ -15,41 +15,24 @@ import {
|
|
|
15
15
|
__experimentalToolsPanelItem as ToolsPanelItem,
|
|
16
16
|
__experimentalUseCustomUnits as useCustomUnits,
|
|
17
17
|
} from '@wordpress/components';
|
|
18
|
-
import { useViewportMatch
|
|
18
|
+
import { useViewportMatch } from '@wordpress/compose';
|
|
19
19
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
20
20
|
import {
|
|
21
21
|
BlockControls,
|
|
22
22
|
InspectorControls,
|
|
23
|
-
RichText,
|
|
24
23
|
__experimentalImageURLInputUI as ImageURLInputUI,
|
|
25
24
|
MediaReplaceFlow,
|
|
26
25
|
store as blockEditorStore,
|
|
27
26
|
useSettings,
|
|
28
27
|
__experimentalImageEditor as ImageEditor,
|
|
29
|
-
__experimentalGetElementClassName,
|
|
30
28
|
__experimentalUseBorderProps as useBorderProps,
|
|
31
29
|
privateApis as blockEditorPrivateApis,
|
|
32
30
|
} from '@wordpress/block-editor';
|
|
33
|
-
import {
|
|
34
|
-
useEffect,
|
|
35
|
-
useMemo,
|
|
36
|
-
useState,
|
|
37
|
-
useRef,
|
|
38
|
-
useCallback,
|
|
39
|
-
} from '@wordpress/element';
|
|
31
|
+
import { useEffect, useMemo, useState, useRef } from '@wordpress/element';
|
|
40
32
|
import { __, _x, sprintf, isRTL } from '@wordpress/i18n';
|
|
41
33
|
import { getFilename } from '@wordpress/url';
|
|
42
|
-
import {
|
|
43
|
-
|
|
44
|
-
getDefaultBlockName,
|
|
45
|
-
switchToBlockType,
|
|
46
|
-
} from '@wordpress/blocks';
|
|
47
|
-
import {
|
|
48
|
-
crop,
|
|
49
|
-
overlayText,
|
|
50
|
-
upload,
|
|
51
|
-
caption as captionIcon,
|
|
52
|
-
} from '@wordpress/icons';
|
|
34
|
+
import { switchToBlockType } from '@wordpress/blocks';
|
|
35
|
+
import { crop, overlayText, upload } from '@wordpress/icons';
|
|
53
36
|
import { store as noticesStore } from '@wordpress/notices';
|
|
54
37
|
import { store as coreStore } from '@wordpress/core-data';
|
|
55
38
|
|
|
@@ -60,6 +43,7 @@ import { unlock } from '../lock-unlock';
|
|
|
60
43
|
import { createUpgradedEmbedBlock } from '../embed/util';
|
|
61
44
|
import useClientWidth from './use-client-width';
|
|
62
45
|
import { isExternalImage } from './edit';
|
|
46
|
+
import { Caption } from '../utils/caption';
|
|
63
47
|
|
|
64
48
|
/**
|
|
65
49
|
* Module constants
|
|
@@ -125,7 +109,6 @@ export default function Image( {
|
|
|
125
109
|
const {
|
|
126
110
|
url = '',
|
|
127
111
|
alt,
|
|
128
|
-
caption,
|
|
129
112
|
align,
|
|
130
113
|
id,
|
|
131
114
|
href,
|
|
@@ -147,8 +130,6 @@ export default function Image( {
|
|
|
147
130
|
const numericHeight = height ? parseInt( height, 10 ) : undefined;
|
|
148
131
|
|
|
149
132
|
const imageRef = useRef();
|
|
150
|
-
const prevCaption = usePrevious( caption );
|
|
151
|
-
const [ showCaption, setShowCaption ] = useState( !! caption );
|
|
152
133
|
const { allowResize = true } = context;
|
|
153
134
|
const { getBlock } = useSelect( blockEditorStore );
|
|
154
135
|
|
|
@@ -247,24 +228,6 @@ export default function Image( {
|
|
|
247
228
|
.catch( () => {} );
|
|
248
229
|
}, [ id, url, isSelected, externalBlob, canUploadMedia ] );
|
|
249
230
|
|
|
250
|
-
// We need to show the caption when changes come from
|
|
251
|
-
// history navigation(undo/redo).
|
|
252
|
-
useEffect( () => {
|
|
253
|
-
if ( caption && ! prevCaption ) {
|
|
254
|
-
setShowCaption( true );
|
|
255
|
-
}
|
|
256
|
-
}, [ caption, prevCaption ] );
|
|
257
|
-
|
|
258
|
-
// Focus the caption when we click to add one.
|
|
259
|
-
const captionRef = useCallback(
|
|
260
|
-
( node ) => {
|
|
261
|
-
if ( node && ! caption ) {
|
|
262
|
-
node.focus();
|
|
263
|
-
}
|
|
264
|
-
},
|
|
265
|
-
[ caption ]
|
|
266
|
-
);
|
|
267
|
-
|
|
268
231
|
// Get naturalWidth and naturalHeight from image ref, and fall back to loaded natural
|
|
269
232
|
// width and height. This resolves an issue in Safari where the loaded natural
|
|
270
233
|
// width and height is otherwise lost when switching between alignments.
|
|
@@ -355,11 +318,8 @@ export default function Image( {
|
|
|
355
318
|
useEffect( () => {
|
|
356
319
|
if ( ! isSelected ) {
|
|
357
320
|
setIsEditingImage( false );
|
|
358
|
-
if ( ! caption ) {
|
|
359
|
-
setShowCaption( false );
|
|
360
|
-
}
|
|
361
321
|
}
|
|
362
|
-
}, [ isSelected
|
|
322
|
+
}, [ isSelected ] );
|
|
363
323
|
|
|
364
324
|
const canEditImage = id && naturalWidth && naturalHeight && imageEditing;
|
|
365
325
|
const allowCrop = ! multiImageSelection && canEditImage && ! isEditingImage;
|
|
@@ -420,6 +380,7 @@ export default function Image( {
|
|
|
420
380
|
|
|
421
381
|
const resetAll = () => {
|
|
422
382
|
setAttributes( {
|
|
383
|
+
alt: undefined,
|
|
423
384
|
width: undefined,
|
|
424
385
|
height: undefined,
|
|
425
386
|
scale: undefined,
|
|
@@ -439,23 +400,6 @@ export default function Image( {
|
|
|
439
400
|
const controls = (
|
|
440
401
|
<>
|
|
441
402
|
<BlockControls group="block">
|
|
442
|
-
{ hasNonContentControls && (
|
|
443
|
-
<ToolbarButton
|
|
444
|
-
onClick={ () => {
|
|
445
|
-
setShowCaption( ! showCaption );
|
|
446
|
-
if ( showCaption && caption ) {
|
|
447
|
-
setAttributes( { caption: undefined } );
|
|
448
|
-
}
|
|
449
|
-
} }
|
|
450
|
-
icon={ captionIcon }
|
|
451
|
-
isPressed={ showCaption }
|
|
452
|
-
label={
|
|
453
|
-
showCaption
|
|
454
|
-
? __( 'Remove caption' )
|
|
455
|
-
: __( 'Add caption' )
|
|
456
|
-
}
|
|
457
|
-
/>
|
|
458
|
-
) }
|
|
459
403
|
{ ! multiImageSelection && ! isEditingImage && (
|
|
460
404
|
<ImageURLInputUI
|
|
461
405
|
url={ href || '' }
|
|
@@ -513,14 +457,14 @@ export default function Image( {
|
|
|
513
457
|
<ToolsPanelItem
|
|
514
458
|
label={ __( 'Alternative text' ) }
|
|
515
459
|
isShownByDefault={ true }
|
|
516
|
-
hasValue={ () => alt
|
|
460
|
+
hasValue={ () => !! alt }
|
|
517
461
|
onDeselect={ () =>
|
|
518
462
|
setAttributes( { alt: undefined } )
|
|
519
463
|
}
|
|
520
464
|
>
|
|
521
465
|
<TextareaControl
|
|
522
466
|
label={ __( 'Alternative text' ) }
|
|
523
|
-
value={ alt }
|
|
467
|
+
value={ alt || '' }
|
|
524
468
|
onChange={ updateAlt }
|
|
525
469
|
help={
|
|
526
470
|
<>
|
|
@@ -538,11 +482,13 @@ export default function Image( {
|
|
|
538
482
|
</ToolsPanelItem>
|
|
539
483
|
) }
|
|
540
484
|
{ isResizable && dimensionsControl }
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
485
|
+
{ !! imageSizeOptions.length && (
|
|
486
|
+
<ResolutionTool
|
|
487
|
+
value={ sizeSlug }
|
|
488
|
+
onChange={ updateImage }
|
|
489
|
+
options={ imageSizeOptions }
|
|
490
|
+
/>
|
|
491
|
+
) }
|
|
546
492
|
{ showLightboxToggle && (
|
|
547
493
|
<ToolsPanelItem
|
|
548
494
|
hasValue={ () => !! lightbox }
|
|
@@ -793,29 +739,14 @@ export default function Image( {
|
|
|
793
739
|
which causes duplicated image upload. */ }
|
|
794
740
|
{ ! temporaryURL && controls }
|
|
795
741
|
{ img }
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
tagName="figcaption"
|
|
805
|
-
aria-label={ __( 'Image caption text' ) }
|
|
806
|
-
placeholder={ __( 'Add caption' ) }
|
|
807
|
-
value={ caption }
|
|
808
|
-
onChange={ ( value ) =>
|
|
809
|
-
setAttributes( { caption: value } )
|
|
810
|
-
}
|
|
811
|
-
inlineToolbar
|
|
812
|
-
__unstableOnSplitAtEnd={ () =>
|
|
813
|
-
insertBlocksAfter(
|
|
814
|
-
createBlock( getDefaultBlockName() )
|
|
815
|
-
)
|
|
816
|
-
}
|
|
817
|
-
/>
|
|
818
|
-
) }
|
|
742
|
+
<Caption
|
|
743
|
+
attributes={ attributes }
|
|
744
|
+
setAttributes={ setAttributes }
|
|
745
|
+
isSelected={ isSelected }
|
|
746
|
+
insertBlocksAfter={ insertBlocksAfter }
|
|
747
|
+
label={ __( 'Image caption text' ) }
|
|
748
|
+
showToolbarButton={ hasNonContentControls }
|
|
749
|
+
/>
|
|
819
750
|
</>
|
|
820
751
|
);
|
|
821
752
|
}
|
package/src/image/save.js
CHANGED
|
@@ -36,7 +36,9 @@ export default function save( { attributes } ) {
|
|
|
36
36
|
const borderProps = getBorderClassesAndStyles( attributes );
|
|
37
37
|
|
|
38
38
|
const classes = classnames( {
|
|
39
|
-
|
|
39
|
+
// All other align classes are handled by block supports.
|
|
40
|
+
// `{ align: 'none' }` is unique to transforms for the image block.
|
|
41
|
+
alignnone: 'none' === align,
|
|
40
42
|
[ `size-${ sizeSlug }` ]: sizeSlug,
|
|
41
43
|
'is-resized': width || height,
|
|
42
44
|
'has-custom-border':
|
package/src/list-item/block.json
CHANGED
|
@@ -12,16 +12,23 @@
|
|
|
12
12
|
"type": "string"
|
|
13
13
|
},
|
|
14
14
|
"content": {
|
|
15
|
-
"type": "
|
|
16
|
-
"source": "
|
|
15
|
+
"type": "rich-text",
|
|
16
|
+
"source": "rich-text",
|
|
17
17
|
"selector": "li",
|
|
18
|
-
"default": "",
|
|
19
18
|
"__experimentalRole": "content"
|
|
20
19
|
}
|
|
21
20
|
},
|
|
22
21
|
"supports": {
|
|
23
22
|
"className": false,
|
|
24
23
|
"__experimentalSelector": "li",
|
|
24
|
+
"spacing": {
|
|
25
|
+
"margin": true,
|
|
26
|
+
"padding": true,
|
|
27
|
+
"__experimentalDefaultControls": {
|
|
28
|
+
"margin": false,
|
|
29
|
+
"padding": false
|
|
30
|
+
}
|
|
31
|
+
},
|
|
25
32
|
"typography": {
|
|
26
33
|
"fontSize": true,
|
|
27
34
|
"lineHeight": true,
|
|
@@ -24,7 +24,6 @@ import {
|
|
|
24
24
|
getColorClassName,
|
|
25
25
|
Warning,
|
|
26
26
|
__experimentalColorGradientSettingsDropdown as ColorGradientSettingsDropdown,
|
|
27
|
-
__experimentalUseBlockOverlayActive as useBlockOverlayActive,
|
|
28
27
|
__experimentalUseMultipleOriginColorsAndGradients as useMultipleOriginColorsAndGradients,
|
|
29
28
|
useBlockEditingMode,
|
|
30
29
|
} from '@wordpress/block-editor';
|
|
@@ -290,7 +289,13 @@ function Navigation( {
|
|
|
290
289
|
|
|
291
290
|
const textDecoration = attributes.style?.typography?.textDecoration;
|
|
292
291
|
|
|
293
|
-
const hasBlockOverlay =
|
|
292
|
+
const hasBlockOverlay = useSelect(
|
|
293
|
+
( select ) =>
|
|
294
|
+
select( blockEditorStore ).__unstableHasActiveBlockOverlayActive(
|
|
295
|
+
clientId
|
|
296
|
+
),
|
|
297
|
+
[ clientId ]
|
|
298
|
+
);
|
|
294
299
|
const isResponsive = 'never' !== overlayMenu;
|
|
295
300
|
const blockProps = useBlockProps( {
|
|
296
301
|
ref: navRef,
|
package/src/navigation/index.php
CHANGED
|
@@ -75,7 +75,7 @@ if ( defined( 'IS_GUTENBERG_PLUGIN' ) && IS_GUTENBERG_PLUGIN ) {
|
|
|
75
75
|
function block_core_navigation_get_inner_blocks_from_unstable_location( $attributes ) {
|
|
76
76
|
$menu_items = block_core_navigation_get_menu_items_at_location( $attributes['__unstableLocation'] );
|
|
77
77
|
if ( empty( $menu_items ) ) {
|
|
78
|
-
return
|
|
78
|
+
return new WP_Block_List( array(), $attributes );
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
$menu_items_by_parent_id = block_core_navigation_sort_menu_items_by_parent_id( $menu_items );
|
|
@@ -30,7 +30,7 @@ exports[`hooks enhanceNavigationLinkVariations enhances variations with icon and
|
|
|
30
30
|
xmlns="http://www.w3.org/2000/svg"
|
|
31
31
|
>
|
|
32
32
|
<Path
|
|
33
|
-
d="M18
|
|
33
|
+
d="M18 5.5H6a.5.5 0 0 0-.5.5v12a.5.5 0 0 0 .5.5h12a.5.5 0 0 0 .5-.5V6a.5.5 0 0 0-.5-.5ZM6 4h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2Zm1 5h1.5v1.5H7V9Zm1.5 4.5H7V15h1.5v-1.5ZM10 9h7v1.5h-7V9Zm7 4.5h-7V15h7v-1.5Z"
|
|
34
34
|
/>
|
|
35
35
|
</SVG>,
|
|
36
36
|
"isActive": [Function],
|
|
@@ -47,7 +47,10 @@ exports[`hooks enhanceNavigationLinkVariations enhances variations with icon and
|
|
|
47
47
|
xmlns="http://www.w3.org/2000/svg"
|
|
48
48
|
>
|
|
49
49
|
<Path
|
|
50
|
-
d="
|
|
50
|
+
d="M15.5 7.5h-7V9h7V7.5Zm-7 3.5h7v1.5h-7V11Zm7 3.5h-7V16h7v-1.5Z"
|
|
51
|
+
/>
|
|
52
|
+
<Path
|
|
53
|
+
d="M17 4H7a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2ZM7 5.5h10a.5.5 0 0 1 .5.5v12a.5.5 0 0 1-.5.5H7a.5.5 0 0 1-.5-.5V6a.5.5 0 0 1 .5-.5Z"
|
|
51
54
|
/>
|
|
52
55
|
</SVG>,
|
|
53
56
|
"isActive": [Function],
|
|
@@ -83,7 +86,7 @@ exports[`hooks enhanceNavigationLinkVariations enhances variations with icon and
|
|
|
83
86
|
xmlns="http://www.w3.org/2000/svg"
|
|
84
87
|
>
|
|
85
88
|
<Path
|
|
86
|
-
d="
|
|
89
|
+
d="M4.75 4a.75.75 0 0 0-.75.75v7.826c0 .2.08.39.22.53l6.72 6.716a2.313 2.313 0 0 0 3.276-.001l5.61-5.611-.531-.53.532.528a2.315 2.315 0 0 0 0-3.264L13.104 4.22a.75.75 0 0 0-.53-.22H4.75ZM19 12.576a.815.815 0 0 1-.236.574l-5.61 5.611a.814.814 0 0 1-1.153 0L5.5 12.264V5.5h6.763l6.5 6.502a.816.816 0 0 1 .237.574ZM8.75 9.75a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z"
|
|
87
90
|
/>
|
|
88
91
|
</SVG>,
|
|
89
92
|
"isActive": [Function],
|
|
@@ -5,7 +5,7 @@ import { Button, Modal } from '@wordpress/components';
|
|
|
5
5
|
import { __ } from '@wordpress/i18n';
|
|
6
6
|
|
|
7
7
|
export const convertDescription = __(
|
|
8
|
-
|
|
8
|
+
"This navigation menu displays your website's pages. Editing it will enable you to add, delete, or reorder pages. However, new pages will no longer be added automatically."
|
|
9
9
|
);
|
|
10
10
|
|
|
11
11
|
export function ConvertToLinksModal( { onClick, onClose, disabled } ) {
|
|
@@ -30,7 +30,7 @@ export function ConvertToLinksModal( { onClick, onClose, disabled } ) {
|
|
|
30
30
|
disabled={ disabled }
|
|
31
31
|
onClick={ onClick }
|
|
32
32
|
>
|
|
33
|
-
{ __( '
|
|
33
|
+
{ __( 'Edit' ) }
|
|
34
34
|
</Button>
|
|
35
35
|
</div>
|
|
36
36
|
</Modal>
|
package/src/paragraph/block.json
CHANGED