@wordpress/block-library 9.35.0 → 9.35.1-next.dc3f6d3c1.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/build/audio/index.js +26 -0
- package/build/audio/index.js.map +2 -2
- package/build/breadcrumbs/edit.js +1 -1
- package/build/breadcrumbs/edit.js.map +2 -2
- package/build/button/index.js +22 -0
- package/build/button/index.js.map +2 -2
- package/build/code/index.js +12 -0
- package/build/code/index.js.map +2 -2
- package/build/cover/index.js +22 -0
- package/build/cover/index.js.map +2 -2
- package/build/details/index.js +12 -0
- package/build/details/index.js.map +2 -2
- package/build/file/index.js +33 -0
- package/build/file/index.js.map +2 -2
- package/build/heading/index.js +12 -0
- package/build/heading/index.js.map +2 -2
- package/build/html/modal.js +126 -144
- package/build/html/modal.js.map +2 -2
- package/build/image/index.js +46 -0
- package/build/image/index.js.map +2 -2
- package/build/list-item/index.js +13 -0
- package/build/list-item/index.js.map +2 -2
- package/build/media-text/index.js +28 -0
- package/build/media-text/index.js.map +2 -2
- package/build/more/index.js +13 -0
- package/build/more/index.js.map +2 -2
- package/build/navigation/block.json +2 -2
- package/build/navigation-link/block.json +2 -1
- package/build/navigation-link/edit.js +6 -0
- package/build/navigation-link/edit.js.map +2 -2
- package/build/navigation-link/index.js +22 -0
- package/build/navigation-link/index.js.map +2 -2
- package/build/navigation-link/shared/controls.js +15 -19
- package/build/navigation-link/shared/controls.js.map +2 -2
- package/build/navigation-link/shared/index.js +4 -0
- package/build/navigation-link/shared/index.js.map +2 -2
- package/build/navigation-link/shared/use-entity-binding.js +3 -2
- package/build/navigation-link/shared/use-entity-binding.js.map +2 -2
- package/build/navigation-submenu/block.json +2 -1
- package/build/navigation-submenu/index.js +22 -0
- package/build/navigation-submenu/index.js.map +2 -2
- package/build/paragraph/index.js +12 -0
- package/build/paragraph/index.js.map +2 -2
- package/build/post-comments-count/edit.js +1 -2
- package/build/post-comments-count/edit.js.map +2 -2
- package/build/post-comments-link/edit.js +10 -7
- package/build/post-comments-link/edit.js.map +2 -2
- package/build/preformatted/index.js +12 -0
- package/build/preformatted/index.js.map +2 -2
- package/build/pullquote/block.json +3 -2
- package/build/pullquote/index.js +20 -0
- package/build/pullquote/index.js.map +2 -2
- package/build/pullquote/transforms.js +0 -31
- package/build/pullquote/transforms.js.map +2 -2
- package/build/quote/transforms.js +0 -20
- package/build/quote/transforms.js.map +2 -2
- package/build/search/index.js +28 -0
- package/build/search/index.js.map +2 -2
- package/build/social-link/index.js +22 -0
- package/build/social-link/index.js.map +2 -2
- package/build/social-links/edit.js +1 -1
- package/build/social-links/edit.js.map +1 -1
- package/build/tabs/view.js +17 -4
- package/build/tabs/view.js.map +2 -2
- package/build/verse/index.js +12 -0
- package/build/verse/index.js.map +2 -2
- package/build/video/index.js +27 -0
- package/build/video/index.js.map +2 -2
- package/build-module/audio/index.js +26 -0
- package/build-module/audio/index.js.map +2 -2
- package/build-module/breadcrumbs/edit.js +1 -1
- package/build-module/breadcrumbs/edit.js.map +2 -2
- package/build-module/button/index.js +22 -0
- package/build-module/button/index.js.map +2 -2
- package/build-module/code/index.js +12 -0
- package/build-module/code/index.js.map +2 -2
- package/build-module/cover/index.js +22 -0
- package/build-module/cover/index.js.map +2 -2
- package/build-module/details/index.js +12 -0
- package/build-module/details/index.js.map +2 -2
- package/build-module/file/index.js +34 -1
- package/build-module/file/index.js.map +2 -2
- package/build-module/heading/index.js +12 -0
- package/build-module/heading/index.js.map +2 -2
- package/build-module/html/modal.js +127 -145
- package/build-module/html/modal.js.map +2 -2
- package/build-module/image/index.js +46 -0
- package/build-module/image/index.js.map +2 -2
- package/build-module/list-item/index.js +13 -0
- package/build-module/list-item/index.js.map +2 -2
- package/build-module/media-text/index.js +28 -0
- package/build-module/media-text/index.js.map +2 -2
- package/build-module/more/index.js +13 -0
- package/build-module/more/index.js.map +2 -2
- package/build-module/navigation/block.json +2 -2
- package/build-module/navigation-link/block.json +2 -1
- package/build-module/navigation-link/edit.js +20 -4
- package/build-module/navigation-link/edit.js.map +2 -2
- package/build-module/navigation-link/index.js +23 -1
- package/build-module/navigation-link/index.js.map +2 -2
- package/build-module/navigation-link/shared/controls.js +12 -18
- package/build-module/navigation-link/shared/controls.js.map +2 -2
- package/build-module/navigation-link/shared/index.js +3 -1
- package/build-module/navigation-link/shared/index.js.map +2 -2
- package/build-module/navigation-link/shared/use-entity-binding.js +3 -2
- package/build-module/navigation-link/shared/use-entity-binding.js.map +2 -2
- package/build-module/navigation-submenu/block.json +2 -1
- package/build-module/navigation-submenu/index.js +23 -1
- package/build-module/navigation-submenu/index.js.map +2 -2
- package/build-module/paragraph/index.js +12 -0
- package/build-module/paragraph/index.js.map +2 -2
- package/build-module/post-comments-count/edit.js +1 -3
- package/build-module/post-comments-count/edit.js.map +2 -2
- package/build-module/post-comments-link/edit.js +10 -8
- package/build-module/post-comments-link/edit.js.map +2 -2
- package/build-module/preformatted/index.js +12 -0
- package/build-module/preformatted/index.js.map +2 -2
- package/build-module/pullquote/block.json +3 -2
- package/build-module/pullquote/index.js +20 -0
- package/build-module/pullquote/index.js.map +2 -2
- package/build-module/pullquote/transforms.js +0 -31
- package/build-module/pullquote/transforms.js.map +2 -2
- package/build-module/quote/transforms.js +0 -20
- package/build-module/quote/transforms.js.map +2 -2
- package/build-module/search/index.js +28 -0
- package/build-module/search/index.js.map +2 -2
- package/build-module/social-link/index.js +22 -0
- package/build-module/social-link/index.js.map +2 -2
- package/build-module/social-links/edit.js +1 -1
- package/build-module/social-links/edit.js.map +1 -1
- package/build-module/tabs/view.js +17 -4
- package/build-module/tabs/view.js.map +2 -2
- package/build-module/verse/index.js +12 -0
- package/build-module/verse/index.js.map +2 -2
- package/build-module/video/index.js +27 -0
- package/build-module/video/index.js.map +2 -2
- package/package.json +37 -37
- package/src/audio/index.js +27 -0
- package/src/breadcrumbs/edit.js +4 -2
- package/src/breadcrumbs/index.php +112 -30
- package/src/button/index.js +23 -0
- package/src/code/index.js +13 -0
- package/src/cover/index.js +23 -0
- package/src/details/index.js +13 -0
- package/src/file/index.js +35 -1
- package/src/heading/index.js +13 -0
- package/src/heading/test/__snapshots__/transforms.native.js.snap +0 -6
- package/src/heading/test/transforms.native.js +1 -5
- package/src/html/modal.js +8 -28
- package/src/image/index.js +47 -0
- package/src/list-item/index.js +14 -0
- package/src/media-text/index.js +29 -0
- package/src/more/index.js +14 -0
- package/src/navigation/block.json +2 -2
- package/src/navigation-link/block.json +2 -1
- package/src/navigation-link/edit.js +27 -4
- package/src/navigation-link/index.js +24 -1
- package/src/navigation-link/shared/controls.js +13 -17
- package/src/navigation-link/shared/index.js +1 -1
- package/src/navigation-link/shared/use-entity-binding.js +5 -2
- package/src/navigation-submenu/block.json +2 -1
- package/src/navigation-submenu/index.js +24 -1
- package/src/paragraph/index.js +13 -0
- package/src/paragraph/test/__snapshots__/transforms.native.js.snap +0 -6
- package/src/paragraph/test/transforms.native.js +0 -1
- package/src/post-comments-count/edit.js +1 -9
- package/src/post-comments-link/edit.js +8 -18
- package/src/preformatted/index.js +13 -0
- package/src/pullquote/block.json +3 -2
- package/src/pullquote/index.js +21 -0
- package/src/pullquote/test/__snapshots__/transforms.native.js.snap +5 -5
- package/src/pullquote/test/transforms.native.js +1 -1
- package/src/pullquote/transforms.js +0 -31
- package/src/quote/test/__snapshots__/transforms.native.js.snap +0 -6
- package/src/quote/test/transforms.native.js +1 -5
- package/src/quote/transforms.js +0 -25
- package/src/search/index.js +29 -0
- package/src/social-link/index.js +23 -0
- package/src/social-links/edit.js +1 -1
- package/src/tabs/view.js +19 -4
- package/src/utils/transformation-categories.native.js +0 -1
- package/src/verse/index.js +13 -0
- package/src/video/index.js +28 -0
- package/src/pullquote/test/edit.native.js +0 -73
|
@@ -9,7 +9,6 @@ import clsx from 'clsx';
|
|
|
9
9
|
import {
|
|
10
10
|
AlignmentControl,
|
|
11
11
|
BlockControls,
|
|
12
|
-
Warning,
|
|
13
12
|
useBlockProps,
|
|
14
13
|
} from '@wordpress/block-editor';
|
|
15
14
|
import { useState, useEffect } from '@wordpress/element';
|
|
@@ -59,18 +58,6 @@ function PostCommentsLinkEdit( { context, attributes, setAttributes } ) {
|
|
|
59
58
|
[ postType, postId ]
|
|
60
59
|
);
|
|
61
60
|
|
|
62
|
-
if ( ! post ) {
|
|
63
|
-
return (
|
|
64
|
-
<div { ...blockProps }>
|
|
65
|
-
<Warning>
|
|
66
|
-
{ __( 'Post Comments Link block: post not found.' ) }
|
|
67
|
-
</Warning>
|
|
68
|
-
</div>
|
|
69
|
-
);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
const { link } = post;
|
|
73
|
-
|
|
74
61
|
let commentsText;
|
|
75
62
|
if ( commentsCount !== undefined ) {
|
|
76
63
|
const commentsNumber = parseInt( commentsCount );
|
|
@@ -98,17 +85,20 @@ function PostCommentsLinkEdit( { context, attributes, setAttributes } ) {
|
|
|
98
85
|
</BlockControls>
|
|
99
86
|
|
|
100
87
|
<div { ...blockProps }>
|
|
101
|
-
{ link && commentsText !== undefined ? (
|
|
88
|
+
{ post?.link && commentsText !== undefined ? (
|
|
102
89
|
<a
|
|
103
|
-
href={ link + '#comments' }
|
|
90
|
+
href={ post?.link + '#comments' }
|
|
104
91
|
onClick={ ( event ) => event.preventDefault() }
|
|
105
92
|
>
|
|
106
93
|
{ commentsText }
|
|
107
94
|
</a>
|
|
108
95
|
) : (
|
|
109
|
-
<
|
|
110
|
-
|
|
111
|
-
|
|
96
|
+
<a
|
|
97
|
+
href="#post-comments-link-pseudo-link"
|
|
98
|
+
onClick={ ( event ) => event.preventDefault() }
|
|
99
|
+
>
|
|
100
|
+
{ __( 'No comments' ) }
|
|
101
|
+
</a>
|
|
112
102
|
) }
|
|
113
103
|
</div>
|
|
114
104
|
</>
|
|
@@ -39,4 +39,17 @@ export const settings = {
|
|
|
39
39
|
},
|
|
40
40
|
};
|
|
41
41
|
|
|
42
|
+
if ( window.__experimentalContentOnlyPatternInsertion ) {
|
|
43
|
+
settings.fields = [
|
|
44
|
+
{
|
|
45
|
+
label: __( 'Content' ),
|
|
46
|
+
type: 'RichText',
|
|
47
|
+
shownByDefault: true,
|
|
48
|
+
mapping: {
|
|
49
|
+
value: 'content',
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
];
|
|
53
|
+
}
|
|
54
|
+
|
|
42
55
|
export const init = () => initBlock( { name, metadata, settings } );
|
package/src/pullquote/block.json
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
"$schema": "https://schemas.wp.org/trunk/block.json",
|
|
3
3
|
"apiVersion": 3,
|
|
4
4
|
"name": "core/pullquote",
|
|
5
|
-
"title": "Pullquote",
|
|
5
|
+
"title": "Pullquote (deprecated)",
|
|
6
6
|
"category": "text",
|
|
7
|
-
"description": "
|
|
7
|
+
"description": "This block is deprecated. Please use the Quote block instead.",
|
|
8
8
|
"textdomain": "default",
|
|
9
9
|
"attributes": {
|
|
10
10
|
"value": {
|
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
"minHeight": false
|
|
49
49
|
}
|
|
50
50
|
},
|
|
51
|
+
"inserter": false,
|
|
51
52
|
"spacing": {
|
|
52
53
|
"margin": true,
|
|
53
54
|
"padding": true
|
package/src/pullquote/index.js
CHANGED
|
@@ -36,4 +36,25 @@ export const settings = {
|
|
|
36
36
|
deprecated,
|
|
37
37
|
};
|
|
38
38
|
|
|
39
|
+
if ( window.__experimentalContentOnlyPatternInsertion ) {
|
|
40
|
+
settings.fields = [
|
|
41
|
+
{
|
|
42
|
+
label: __( 'Content' ),
|
|
43
|
+
type: 'RichText',
|
|
44
|
+
shownByDefault: true,
|
|
45
|
+
mapping: {
|
|
46
|
+
value: 'value',
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
label: __( 'Citation' ),
|
|
51
|
+
type: 'RichText',
|
|
52
|
+
shownByDefault: false,
|
|
53
|
+
mapping: {
|
|
54
|
+
value: 'citation',
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
];
|
|
58
|
+
}
|
|
59
|
+
|
|
39
60
|
export const init = () => initBlock( { name, metadata, settings } );
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`Pullquote block transforms to Columns block 1`] = `
|
|
3
|
+
exports[`Pullquote \\(deprecated\\) block transforms to Columns block 1`] = `
|
|
4
4
|
"<!-- wp:columns -->
|
|
5
5
|
<div class="wp-block-columns"><!-- wp:column {"width":"100%"} -->
|
|
6
6
|
<div class="wp-block-column" style="flex-basis:100%"><!-- wp:pullquote -->
|
|
@@ -10,7 +10,7 @@ exports[`Pullquote block transforms to Columns block 1`] = `
|
|
|
10
10
|
<!-- /wp:columns -->"
|
|
11
11
|
`;
|
|
12
12
|
|
|
13
|
-
exports[`Pullquote block transforms to Group block 1`] = `
|
|
13
|
+
exports[`Pullquote \\(deprecated\\) block transforms to Group block 1`] = `
|
|
14
14
|
"<!-- wp:group {"layout":{"type":"constrained"}} -->
|
|
15
15
|
<div class="wp-block-group"><!-- wp:pullquote -->
|
|
16
16
|
<figure class="wp-block-pullquote"><blockquote><p>One of the hardest things to do in technology is disrupt yourself.</p><cite>Matt Mullenweg</cite></blockquote></figure>
|
|
@@ -18,7 +18,7 @@ exports[`Pullquote block transforms to Group block 1`] = `
|
|
|
18
18
|
<!-- /wp:group -->"
|
|
19
19
|
`;
|
|
20
20
|
|
|
21
|
-
exports[`Pullquote block transforms to Heading block 1`] = `
|
|
21
|
+
exports[`Pullquote \\(deprecated\\) block transforms to Heading block 1`] = `
|
|
22
22
|
"<!-- wp:heading -->
|
|
23
23
|
<h2 class="wp-block-heading">One of the hardest things to do in technology is disrupt yourself.</h2>
|
|
24
24
|
<!-- /wp:heading -->
|
|
@@ -28,7 +28,7 @@ exports[`Pullquote block transforms to Heading block 1`] = `
|
|
|
28
28
|
<!-- /wp:heading -->"
|
|
29
29
|
`;
|
|
30
30
|
|
|
31
|
-
exports[`Pullquote block transforms to Paragraph block 1`] = `
|
|
31
|
+
exports[`Pullquote \\(deprecated\\) block transforms to Paragraph block 1`] = `
|
|
32
32
|
"<!-- wp:paragraph -->
|
|
33
33
|
<p>One of the hardest things to do in technology is disrupt yourself.</p>
|
|
34
34
|
<!-- /wp:paragraph -->
|
|
@@ -38,7 +38,7 @@ exports[`Pullquote block transforms to Paragraph block 1`] = `
|
|
|
38
38
|
<!-- /wp:paragraph -->"
|
|
39
39
|
`;
|
|
40
40
|
|
|
41
|
-
exports[`Pullquote block transforms to Quote block 1`] = `
|
|
41
|
+
exports[`Pullquote \\(deprecated\\) block transforms to Quote block 1`] = `
|
|
42
42
|
"<!-- wp:quote -->
|
|
43
43
|
<blockquote class="wp-block-quote"><!-- wp:paragraph -->
|
|
44
44
|
<p>One of the hardest things to do in technology is disrupt yourself.</p>
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
getBlockTransformOptions,
|
|
10
10
|
} from 'test/helpers';
|
|
11
11
|
|
|
12
|
-
const block = 'Pullquote';
|
|
12
|
+
const block = 'Pullquote \\(deprecated\\)';
|
|
13
13
|
const initialHtml = `
|
|
14
14
|
<!-- wp:pullquote -->
|
|
15
15
|
<figure class="wp-block-pullquote"><blockquote><p>One of the hardest things to do in technology is disrupt yourself.</p><cite>Matt Mullenweg</cite></blockquote></figure>
|
|
@@ -2,39 +2,8 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { createBlock } from '@wordpress/blocks';
|
|
5
|
-
import { create, join, toHTMLString } from '@wordpress/rich-text';
|
|
6
5
|
|
|
7
6
|
const transforms = {
|
|
8
|
-
from: [
|
|
9
|
-
{
|
|
10
|
-
type: 'block',
|
|
11
|
-
isMultiBlock: true,
|
|
12
|
-
blocks: [ 'core/paragraph' ],
|
|
13
|
-
transform: ( attributes ) => {
|
|
14
|
-
return createBlock( 'core/pullquote', {
|
|
15
|
-
value: toHTMLString( {
|
|
16
|
-
value: join(
|
|
17
|
-
attributes.map( ( { content } ) =>
|
|
18
|
-
create( { html: content } )
|
|
19
|
-
),
|
|
20
|
-
'\n'
|
|
21
|
-
),
|
|
22
|
-
} ),
|
|
23
|
-
anchor: attributes.anchor,
|
|
24
|
-
} );
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
type: 'block',
|
|
29
|
-
blocks: [ 'core/heading' ],
|
|
30
|
-
transform: ( { content, anchor } ) => {
|
|
31
|
-
return createBlock( 'core/pullquote', {
|
|
32
|
-
value: content,
|
|
33
|
-
anchor,
|
|
34
|
-
} );
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
],
|
|
38
7
|
to: [
|
|
39
8
|
{
|
|
40
9
|
type: 'block',
|
|
@@ -32,12 +32,6 @@ exports[`Quote block transforms to Paragraph block 1`] = `
|
|
|
32
32
|
<!-- /wp:paragraph -->"
|
|
33
33
|
`;
|
|
34
34
|
|
|
35
|
-
exports[`Quote block transforms to Pullquote block 1`] = `
|
|
36
|
-
"<!-- wp:pullquote -->
|
|
37
|
-
<figure class="wp-block-pullquote"><blockquote><p>"This will make running your own blog a viable alternative again."</p><cite>— <a href="https://twitter.com/azumbrunnen_/status/1019347243084800005">Adrian Zumbrunnen</a></cite></blockquote></figure>
|
|
38
|
-
<!-- /wp:pullquote -->"
|
|
39
|
-
`;
|
|
40
|
-
|
|
41
35
|
exports[`Quote block transforms ungroups block 1`] = `
|
|
42
36
|
"<!-- wp:paragraph -->
|
|
43
37
|
<p>"This will make running your own blog a viable alternative again."</p>
|
|
@@ -21,11 +21,7 @@ const initialHtml = `
|
|
|
21
21
|
<!-- /wp:quote -->`;
|
|
22
22
|
|
|
23
23
|
const transformsWithInnerBlocks = [ 'Columns', 'Group' ];
|
|
24
|
-
const blockTransforms = [
|
|
25
|
-
'Pullquote',
|
|
26
|
-
'Paragraph',
|
|
27
|
-
...transformsWithInnerBlocks,
|
|
28
|
-
];
|
|
24
|
+
const blockTransforms = [ 'Paragraph', ...transformsWithInnerBlocks ];
|
|
29
25
|
|
|
30
26
|
setupCoreBlocks();
|
|
31
27
|
|
package/src/quote/transforms.js
CHANGED
|
@@ -94,31 +94,6 @@ const transforms = {
|
|
|
94
94
|
},
|
|
95
95
|
],
|
|
96
96
|
to: [
|
|
97
|
-
{
|
|
98
|
-
type: 'block',
|
|
99
|
-
blocks: [ 'core/pullquote' ],
|
|
100
|
-
isMatch: ( {}, block ) => {
|
|
101
|
-
return block.innerBlocks.every(
|
|
102
|
-
( { name } ) => name === 'core/paragraph'
|
|
103
|
-
);
|
|
104
|
-
},
|
|
105
|
-
transform: (
|
|
106
|
-
{ align, citation, anchor, fontSize, style },
|
|
107
|
-
innerBlocks
|
|
108
|
-
) => {
|
|
109
|
-
const value = innerBlocks
|
|
110
|
-
.map( ( { attributes } ) => `${ attributes.content }` )
|
|
111
|
-
.join( '<br>' );
|
|
112
|
-
return createBlock( 'core/pullquote', {
|
|
113
|
-
value,
|
|
114
|
-
align,
|
|
115
|
-
citation,
|
|
116
|
-
anchor,
|
|
117
|
-
fontSize,
|
|
118
|
-
style,
|
|
119
|
-
} );
|
|
120
|
-
},
|
|
121
|
-
},
|
|
122
97
|
{
|
|
123
98
|
type: 'block',
|
|
124
99
|
blocks: [ 'core/paragraph' ],
|
package/src/search/index.js
CHANGED
|
@@ -26,4 +26,33 @@ export const settings = {
|
|
|
26
26
|
edit,
|
|
27
27
|
};
|
|
28
28
|
|
|
29
|
+
if ( window.__experimentalContentOnlyPatternInsertion ) {
|
|
30
|
+
settings.fields = [
|
|
31
|
+
{
|
|
32
|
+
label: __( 'Label' ),
|
|
33
|
+
type: 'RichText',
|
|
34
|
+
shownByDefault: true,
|
|
35
|
+
mapping: {
|
|
36
|
+
value: 'label',
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
label: __( 'Button text' ),
|
|
41
|
+
type: 'RichText',
|
|
42
|
+
shownByDefault: false,
|
|
43
|
+
mapping: {
|
|
44
|
+
value: 'buttonText',
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
label: __( 'Placeholder' ),
|
|
49
|
+
type: 'RichText',
|
|
50
|
+
shownByDefault: false,
|
|
51
|
+
mapping: {
|
|
52
|
+
value: 'placeholder',
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
];
|
|
56
|
+
}
|
|
57
|
+
|
|
29
58
|
export const init = () => initBlock( { name, metadata, settings } );
|
package/src/social-link/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
4
5
|
import { share as icon } from '@wordpress/icons';
|
|
5
6
|
|
|
6
7
|
/**
|
|
@@ -21,4 +22,26 @@ export const settings = {
|
|
|
21
22
|
variations,
|
|
22
23
|
};
|
|
23
24
|
|
|
25
|
+
if ( window.__experimentalContentOnlyPatternInsertion ) {
|
|
26
|
+
settings.fields = [
|
|
27
|
+
{
|
|
28
|
+
label: __( 'Link' ),
|
|
29
|
+
type: 'Link',
|
|
30
|
+
shownByDefault: true,
|
|
31
|
+
mapping: {
|
|
32
|
+
href: 'url',
|
|
33
|
+
rel: 'rel',
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
label: __( 'Label' ),
|
|
38
|
+
type: 'RichText',
|
|
39
|
+
shownByDefault: false,
|
|
40
|
+
mapping: {
|
|
41
|
+
value: 'label',
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
];
|
|
45
|
+
}
|
|
46
|
+
|
|
24
47
|
export const init = () => initBlock( { name, metadata, settings } );
|
package/src/social-links/edit.js
CHANGED
|
@@ -183,7 +183,7 @@ export function SocialLinksEdit( props ) {
|
|
|
183
183
|
<SelectControl
|
|
184
184
|
__next40pxDefaultSize
|
|
185
185
|
__nextHasNoMarginBottom
|
|
186
|
-
label={ __( 'Icon
|
|
186
|
+
label={ __( 'Icon size' ) }
|
|
187
187
|
onChange={ ( newSize ) => {
|
|
188
188
|
setAttributes( {
|
|
189
189
|
size: newSize === '' ? undefined : newSize,
|
package/src/tabs/view.js
CHANGED
|
@@ -9,8 +9,25 @@ import {
|
|
|
9
9
|
} from '@wordpress/interactivity';
|
|
10
10
|
|
|
11
11
|
function createReadOnlyProxy( obj ) {
|
|
12
|
+
const arrayMutationMethods = new Set( [
|
|
13
|
+
'push',
|
|
14
|
+
'pop',
|
|
15
|
+
'shift',
|
|
16
|
+
'unshift',
|
|
17
|
+
'splice',
|
|
18
|
+
'sort',
|
|
19
|
+
'reverse',
|
|
20
|
+
'copyWithin',
|
|
21
|
+
'fill',
|
|
22
|
+
] );
|
|
23
|
+
|
|
12
24
|
return new Proxy( obj, {
|
|
13
25
|
get( target, prop ) {
|
|
26
|
+
// If accessing an array mutation method, return a no-op function.
|
|
27
|
+
if ( Array.isArray( target ) && arrayMutationMethods.has( prop ) ) {
|
|
28
|
+
return () => {};
|
|
29
|
+
}
|
|
30
|
+
|
|
14
31
|
const value = target[ prop ];
|
|
15
32
|
if ( typeof value === 'object' && value !== null ) {
|
|
16
33
|
return createReadOnlyProxy( value );
|
|
@@ -186,21 +203,19 @@ store( 'core/tabs', {
|
|
|
186
203
|
/**
|
|
187
204
|
* Gets the index of the active tab element whether it
|
|
188
205
|
* is a tab label or tab panel.
|
|
189
|
-
* Public API for third-party access.
|
|
190
206
|
*
|
|
191
207
|
* @type {number|null}
|
|
192
208
|
*/
|
|
193
209
|
get tabIndex() {
|
|
194
|
-
return
|
|
210
|
+
return privateState.tabIndex;
|
|
195
211
|
},
|
|
196
212
|
/**
|
|
197
213
|
* Whether the tab panel or tab label is the active tab.
|
|
198
|
-
* Public API for third-party access.
|
|
199
214
|
*
|
|
200
215
|
* @type {boolean}
|
|
201
216
|
*/
|
|
202
217
|
get isActiveTab() {
|
|
203
|
-
return
|
|
218
|
+
return privateState.isActiveTab;
|
|
204
219
|
},
|
|
205
220
|
},
|
|
206
221
|
actions: {
|
package/src/verse/index.js
CHANGED
|
@@ -41,4 +41,17 @@ export const settings = {
|
|
|
41
41
|
save,
|
|
42
42
|
};
|
|
43
43
|
|
|
44
|
+
if ( window.__experimentalContentOnlyPatternInsertion ) {
|
|
45
|
+
settings.fields = [
|
|
46
|
+
{
|
|
47
|
+
label: __( 'Content' ),
|
|
48
|
+
type: 'RichText',
|
|
49
|
+
shownByDefault: true,
|
|
50
|
+
mapping: {
|
|
51
|
+
value: 'content',
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
];
|
|
55
|
+
}
|
|
56
|
+
|
|
44
57
|
export const init = () => initBlock( { name, metadata, settings } );
|
package/src/video/index.js
CHANGED
|
@@ -33,4 +33,32 @@ export const settings = {
|
|
|
33
33
|
save,
|
|
34
34
|
};
|
|
35
35
|
|
|
36
|
+
if ( window.__experimentalContentOnlyPatternInsertion ) {
|
|
37
|
+
settings.fields = [
|
|
38
|
+
{
|
|
39
|
+
label: __( 'Video' ),
|
|
40
|
+
type: 'Media',
|
|
41
|
+
shownByDefault: true,
|
|
42
|
+
mapping: {
|
|
43
|
+
id: 'id',
|
|
44
|
+
src: 'src',
|
|
45
|
+
caption: 'caption',
|
|
46
|
+
poster: 'poster',
|
|
47
|
+
},
|
|
48
|
+
args: {
|
|
49
|
+
allowedTypes: [ 'video' ],
|
|
50
|
+
multiple: false,
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
label: __( 'Caption' ),
|
|
55
|
+
type: 'RichText',
|
|
56
|
+
shownByDefault: false,
|
|
57
|
+
mapping: {
|
|
58
|
+
value: 'caption',
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
];
|
|
62
|
+
}
|
|
63
|
+
|
|
36
64
|
export const init = () => initBlock( { name, metadata, settings } );
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import {
|
|
5
|
-
addBlock,
|
|
6
|
-
getBlock,
|
|
7
|
-
initializeEditor,
|
|
8
|
-
selectRangeInRichText,
|
|
9
|
-
setupCoreBlocks,
|
|
10
|
-
getEditorHtml,
|
|
11
|
-
fireEvent,
|
|
12
|
-
within,
|
|
13
|
-
waitFor,
|
|
14
|
-
typeInRichText,
|
|
15
|
-
} from 'test/helpers';
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* WordPress dependencies
|
|
19
|
-
*/
|
|
20
|
-
import { ENTER } from '@wordpress/keycodes';
|
|
21
|
-
|
|
22
|
-
setupCoreBlocks();
|
|
23
|
-
|
|
24
|
-
describe( 'Pullquote', () => {
|
|
25
|
-
it( 'should produce expected markup for multiline text', async () => {
|
|
26
|
-
// Arrange
|
|
27
|
-
const screen = await initializeEditor();
|
|
28
|
-
await addBlock( screen, 'Pullquote' );
|
|
29
|
-
// Await inner blocks to be rendered
|
|
30
|
-
const citationBlock = await waitFor( () =>
|
|
31
|
-
screen.getByPlaceholderText( 'Add citation' )
|
|
32
|
-
);
|
|
33
|
-
|
|
34
|
-
// Act
|
|
35
|
-
const pullquoteBlock = getBlock( screen, 'Pullquote' );
|
|
36
|
-
fireEvent.press( pullquoteBlock );
|
|
37
|
-
const pullquoteTextInput =
|
|
38
|
-
within( pullquoteBlock ).getByPlaceholderText( 'Add quote' );
|
|
39
|
-
typeInRichText( pullquoteTextInput, 'A great statement.' );
|
|
40
|
-
fireEvent( pullquoteTextInput, 'onKeyDown', {
|
|
41
|
-
nativeEvent: {},
|
|
42
|
-
preventDefault() {},
|
|
43
|
-
keyCode: ENTER,
|
|
44
|
-
} );
|
|
45
|
-
typeInRichText( pullquoteTextInput, 'Again' );
|
|
46
|
-
|
|
47
|
-
const citationTextInput =
|
|
48
|
-
within( citationBlock ).getByPlaceholderText( 'Add citation' );
|
|
49
|
-
typeInRichText( citationTextInput, 'A person' );
|
|
50
|
-
fireEvent( citationTextInput, 'onKeyDown', {
|
|
51
|
-
nativeEvent: {},
|
|
52
|
-
preventDefault() {},
|
|
53
|
-
keyCode: ENTER,
|
|
54
|
-
} );
|
|
55
|
-
selectRangeInRichText( citationTextInput, 2 );
|
|
56
|
-
fireEvent( citationTextInput, 'onKeyDown', {
|
|
57
|
-
nativeEvent: {},
|
|
58
|
-
preventDefault() {},
|
|
59
|
-
keyCode: ENTER,
|
|
60
|
-
} );
|
|
61
|
-
|
|
62
|
-
// Assert
|
|
63
|
-
expect( getEditorHtml() ).toMatchInlineSnapshot( `
|
|
64
|
-
"<!-- wp:pullquote -->
|
|
65
|
-
<figure class="wp-block-pullquote"><blockquote><p>A great statement.<br>Again</p><cite>A <br>person</cite></blockquote></figure>
|
|
66
|
-
<!-- /wp:pullquote -->
|
|
67
|
-
|
|
68
|
-
<!-- wp:paragraph -->
|
|
69
|
-
<p></p>
|
|
70
|
-
<!-- /wp:paragraph -->"
|
|
71
|
-
` );
|
|
72
|
-
} );
|
|
73
|
-
} );
|