@wordpress/block-library 7.3.9 → 7.3.12
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/avatar/hooks.js +2 -2
- package/build/avatar/hooks.js.map +1 -1
- package/build/columns/index.js +3 -1
- package/build/columns/index.js.map +1 -1
- package/build/comment-author-name/edit.js +3 -3
- package/build/comment-author-name/edit.js.map +1 -1
- package/build/comment-author-name/index.js +0 -4
- package/build/comment-author-name/index.js.map +1 -1
- package/build/comment-date/edit.js +4 -4
- package/build/comment-date/edit.js.map +1 -1
- package/build/comment-date/index.js +0 -4
- package/build/comment-date/index.js.map +1 -1
- package/build/comment-edit-link/index.js +0 -4
- package/build/comment-edit-link/index.js.map +1 -1
- package/build/comment-reply-link/index.js +0 -4
- package/build/comment-reply-link/index.js.map +1 -1
- package/build/comments-query-loop/edit.js +10 -2
- package/build/comments-query-loop/edit.js.map +1 -1
- package/build/gallery/gap-styles.js +14 -4
- package/build/gallery/gap-styles.js.map +1 -1
- package/build/image/edit.js +5 -56
- package/build/image/edit.js.map +1 -1
- package/build/image/image.js +4 -15
- package/build/image/image.js.map +1 -1
- package/build/latest-posts/edit.js +30 -4
- package/build/latest-posts/edit.js.map +1 -1
- package/build/media-text/edit.js +0 -1
- package/build/media-text/edit.js.map +1 -1
- package/build/navigation/edit/index.js +81 -80
- package/build/navigation/edit/index.js.map +1 -1
- package/build/post-comments/edit.js +12 -33
- package/build/post-comments/edit.js.map +1 -1
- package/build/post-comments-form/edit.js +48 -25
- package/build/post-comments-form/edit.js.map +1 -1
- package/build/post-comments-form/form.js +48 -0
- package/build/post-comments-form/form.js.map +1 -0
- package/build-module/avatar/hooks.js +2 -2
- package/build-module/avatar/hooks.js.map +1 -1
- package/build-module/columns/index.js +3 -1
- package/build-module/columns/index.js.map +1 -1
- package/build-module/comment-author-name/edit.js +3 -3
- package/build-module/comment-author-name/edit.js.map +1 -1
- package/build-module/comment-author-name/index.js +0 -4
- package/build-module/comment-author-name/index.js.map +1 -1
- package/build-module/comment-date/edit.js +4 -4
- package/build-module/comment-date/edit.js.map +1 -1
- package/build-module/comment-date/index.js +0 -4
- package/build-module/comment-date/index.js.map +1 -1
- package/build-module/comment-edit-link/index.js +0 -4
- package/build-module/comment-edit-link/index.js.map +1 -1
- package/build-module/comment-reply-link/index.js +0 -4
- package/build-module/comment-reply-link/index.js.map +1 -1
- package/build-module/comments-query-loop/edit.js +10 -2
- package/build-module/comments-query-loop/edit.js.map +1 -1
- package/build-module/gallery/gap-styles.js +14 -4
- package/build-module/gallery/gap-styles.js.map +1 -1
- package/build-module/image/edit.js +4 -52
- package/build-module/image/edit.js.map +1 -1
- package/build-module/image/image.js +5 -16
- package/build-module/image/image.js.map +1 -1
- package/build-module/latest-posts/edit.js +29 -5
- package/build-module/latest-posts/edit.js.map +1 -1
- package/build-module/media-text/edit.js +0 -1
- package/build-module/media-text/edit.js.map +1 -1
- package/build-module/navigation/edit/index.js +81 -80
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/post-comments/edit.js +12 -34
- package/build-module/post-comments/edit.js.map +1 -1
- package/build-module/post-comments-form/edit.js +49 -28
- package/build-module/post-comments-form/edit.js.map +1 -1
- package/build-module/post-comments-form/form.js +39 -0
- package/build-module/post-comments-form/form.js.map +1 -0
- package/build-style/editor-rtl.css +3 -0
- package/build-style/editor.css +3 -0
- package/build-style/navigation/style-rtl.css +3 -0
- package/build-style/navigation/style.css +3 -0
- package/build-style/post-comments/style-rtl.css +15 -0
- package/build-style/post-comments/style.css +15 -0
- package/build-style/post-comments-form/editor-rtl.css +3 -0
- package/build-style/post-comments-form/editor.css +3 -0
- package/build-style/style-rtl.css +18 -0
- package/build-style/style.css +18 -0
- package/package.json +7 -7
- package/src/avatar/hooks.js +9 -6
- package/src/columns/block.json +3 -1
- package/src/comment-author-name/block.json +0 -4
- package/src/comment-author-name/edit.js +3 -12
- package/src/comment-date/block.json +0 -4
- package/src/comment-date/edit.js +10 -14
- package/src/comment-date/index.php +0 -3
- package/src/comment-edit-link/block.json +0 -4
- package/src/comment-reply-link/block.json +0 -4
- package/src/comments-query-loop/edit.js +24 -4
- package/src/cover/index.php +9 -6
- package/src/gallery/gap-styles.js +21 -6
- package/src/gallery/index.php +24 -4
- package/src/image/edit.js +0 -44
- package/src/image/image.js +3 -14
- package/src/latest-posts/edit.js +27 -2
- package/src/media-text/edit.js +0 -1
- package/src/navigation/edit/index.js +140 -143
- package/src/navigation/style.scss +3 -0
- package/src/post-comments/edit.js +13 -42
- package/src/post-comments/style.scss +18 -0
- package/src/post-comments-form/edit.js +68 -59
- package/src/post-comments-form/editor.scss +4 -0
- package/src/post-comments-form/form.js +43 -0
- package/src/post-template/index.php +15 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/post-comments-form/form.js"],"names":["__","__experimentalUseDisabled","useDisabled","useInstanceId","CommentsForm","disabledFormRef","instanceId"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SACCC,yBAAyB,IAAIC,WAD9B,EAECC,aAFD,QAGO,oBAHP;;AAKA,MAAMC,YAAY,GAAG,MAAM;AAC1B,QAAMC,eAAe,GAAGH,WAAW,EAAnC;AACA,QAAMI,UAAU,GAAGH,aAAa,CAAEC,YAAF,CAAhC;AAEA,SACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC;AAAI,IAAA,SAAS,EAAC;AAAd,KAAsCJ,EAAE,CAAE,eAAF,CAAxC,CADD,EAEC;AAAM,IAAA,UAAU,MAAhB;AAAiB,IAAA,SAAS,EAAC,cAA3B;AAA0C,IAAA,GAAG,EAAGK;AAAhD,KACC,yBACC;AAAO,IAAA,OAAO,EAAI,WAAWC,UAAY;AAAzC,KACGN,EAAE,CAAE,SAAF,CADL,CADD,EAIC;AACC,IAAA,EAAE,EAAI,WAAWM,UAAY,EAD9B;AAEC,IAAA,IAAI,EAAC,SAFN;AAGC,IAAA,IAAI,EAAC,IAHN;AAIC,IAAA,IAAI,EAAC;AAJN,IAJD,CADD,EAYC;AAAG,IAAA,SAAS,EAAC;AAAb,KACC;AACC,IAAA,IAAI,EAAC,QADN;AAEC,IAAA,IAAI,EAAC,QAFN;AAGC,IAAA,SAAS,EAAC,8BAHX;AAIC,IAAA,KAAK,EAAGN,EAAE,CAAE,cAAF,CAJX;AAKC,IAAA,KAAK,EAAGA,EAAE,CAAE,cAAF;AALX,IADD,CAZD,CAFD,CADD;AA2BA,CA/BD;;AAiCA,eAAeI,YAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\t__experimentalUseDisabled as useDisabled,\n\tuseInstanceId,\n} from '@wordpress/compose';\n\nconst CommentsForm = () => {\n\tconst disabledFormRef = useDisabled();\n\tconst instanceId = useInstanceId( CommentsForm );\n\n\treturn (\n\t\t<div className=\"comment-respond\">\n\t\t\t<h3 className=\"comment-reply-title\">{ __( 'Leave a Reply' ) }</h3>\n\t\t\t<form noValidate className=\"comment-form\" ref={ disabledFormRef }>\n\t\t\t\t<p>\n\t\t\t\t\t<label htmlFor={ `comment-${ instanceId }` }>\n\t\t\t\t\t\t{ __( 'Comment' ) }\n\t\t\t\t\t</label>\n\t\t\t\t\t<textarea\n\t\t\t\t\t\tid={ `comment-${ instanceId }` }\n\t\t\t\t\t\tname=\"comment\"\n\t\t\t\t\t\tcols=\"45\"\n\t\t\t\t\t\trows=\"8\"\n\t\t\t\t\t/>\n\t\t\t\t</p>\n\t\t\t\t<p className=\"form-submit wp-block-button\">\n\t\t\t\t\t<input\n\t\t\t\t\t\tname=\"submit\"\n\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\tclassName=\"submit wp-block-button__link\"\n\t\t\t\t\t\tlabel={ __( 'Post Comment' ) }\n\t\t\t\t\t\tvalue={ __( 'Post Comment' ) }\n\t\t\t\t\t/>\n\t\t\t\t</p>\n\t\t\t</form>\n\t\t</div>\n\t);\n};\n\nexport default CommentsForm;\n"]}
|
|
@@ -2701,6 +2701,9 @@ div[data-type="core/post-featured-image"] img {
|
|
|
2701
2701
|
.wp-block-post-comments-form * {
|
|
2702
2702
|
pointer-events: none;
|
|
2703
2703
|
}
|
|
2704
|
+
.wp-block-post-comments-form *.block-editor-warning * {
|
|
2705
|
+
pointer-events: auto;
|
|
2706
|
+
}
|
|
2704
2707
|
|
|
2705
2708
|
:root .editor-styles-wrapper {
|
|
2706
2709
|
/*
|
package/build-style/editor.css
CHANGED
|
@@ -2712,6 +2712,9 @@ div[data-type="core/post-featured-image"] img {
|
|
|
2712
2712
|
.wp-block-post-comments-form * {
|
|
2713
2713
|
pointer-events: none;
|
|
2714
2714
|
}
|
|
2715
|
+
.wp-block-post-comments-form *.block-editor-warning * {
|
|
2716
|
+
pointer-events: auto;
|
|
2717
|
+
}
|
|
2715
2718
|
|
|
2716
2719
|
:root .editor-styles-wrapper {
|
|
2717
2720
|
/*
|
|
@@ -74,6 +74,21 @@
|
|
|
74
74
|
/**
|
|
75
75
|
* Reset the WP Admin page styles for Gutenberg-like pages.
|
|
76
76
|
*/
|
|
77
|
+
.wp-block-post-comments {
|
|
78
|
+
/* utility classes */
|
|
79
|
+
/* end utility classes */
|
|
80
|
+
}
|
|
81
|
+
.wp-block-post-comments .alignleft {
|
|
82
|
+
float: right;
|
|
83
|
+
}
|
|
84
|
+
.wp-block-post-comments .alignright {
|
|
85
|
+
float: left;
|
|
86
|
+
}
|
|
87
|
+
.wp-block-post-comments .navigation::after {
|
|
88
|
+
content: "";
|
|
89
|
+
display: table;
|
|
90
|
+
clear: both;
|
|
91
|
+
}
|
|
77
92
|
.wp-block-post-comments .commentlist {
|
|
78
93
|
clear: both;
|
|
79
94
|
list-style: none;
|
|
@@ -74,6 +74,21 @@
|
|
|
74
74
|
/**
|
|
75
75
|
* Reset the WP Admin page styles for Gutenberg-like pages.
|
|
76
76
|
*/
|
|
77
|
+
.wp-block-post-comments {
|
|
78
|
+
/* utility classes */
|
|
79
|
+
/* end utility classes */
|
|
80
|
+
}
|
|
81
|
+
.wp-block-post-comments .alignleft {
|
|
82
|
+
float: left;
|
|
83
|
+
}
|
|
84
|
+
.wp-block-post-comments .alignright {
|
|
85
|
+
float: right;
|
|
86
|
+
}
|
|
87
|
+
.wp-block-post-comments .navigation::after {
|
|
88
|
+
content: "";
|
|
89
|
+
display: table;
|
|
90
|
+
clear: both;
|
|
91
|
+
}
|
|
77
92
|
.wp-block-post-comments .commentlist {
|
|
78
93
|
clear: both;
|
|
79
94
|
list-style: none;
|
|
@@ -1753,6 +1753,9 @@ button.wp-block-navigation-item__content {
|
|
|
1753
1753
|
font-size: inherit;
|
|
1754
1754
|
font-family: inherit;
|
|
1755
1755
|
line-height: inherit;
|
|
1756
|
+
font-style: inherit;
|
|
1757
|
+
font-weight: inherit;
|
|
1758
|
+
text-transform: inherit;
|
|
1756
1759
|
text-align: right;
|
|
1757
1760
|
}
|
|
1758
1761
|
|
|
@@ -2101,6 +2104,21 @@ p.has-background {
|
|
|
2101
2104
|
margin: 0;
|
|
2102
2105
|
}
|
|
2103
2106
|
|
|
2107
|
+
.wp-block-post-comments {
|
|
2108
|
+
/* utility classes */
|
|
2109
|
+
/* end utility classes */
|
|
2110
|
+
}
|
|
2111
|
+
.wp-block-post-comments .alignleft {
|
|
2112
|
+
float: right;
|
|
2113
|
+
}
|
|
2114
|
+
.wp-block-post-comments .alignright {
|
|
2115
|
+
float: left;
|
|
2116
|
+
}
|
|
2117
|
+
.wp-block-post-comments .navigation::after {
|
|
2118
|
+
content: "";
|
|
2119
|
+
display: table;
|
|
2120
|
+
clear: both;
|
|
2121
|
+
}
|
|
2104
2122
|
.wp-block-post-comments .commentlist {
|
|
2105
2123
|
clear: both;
|
|
2106
2124
|
list-style: none;
|
package/build-style/style.css
CHANGED
|
@@ -1779,6 +1779,9 @@ button.wp-block-navigation-item__content {
|
|
|
1779
1779
|
font-size: inherit;
|
|
1780
1780
|
font-family: inherit;
|
|
1781
1781
|
line-height: inherit;
|
|
1782
|
+
font-style: inherit;
|
|
1783
|
+
font-weight: inherit;
|
|
1784
|
+
text-transform: inherit;
|
|
1782
1785
|
text-align: left;
|
|
1783
1786
|
}
|
|
1784
1787
|
|
|
@@ -2127,6 +2130,21 @@ p.has-background {
|
|
|
2127
2130
|
margin: 0;
|
|
2128
2131
|
}
|
|
2129
2132
|
|
|
2133
|
+
.wp-block-post-comments {
|
|
2134
|
+
/* utility classes */
|
|
2135
|
+
/* end utility classes */
|
|
2136
|
+
}
|
|
2137
|
+
.wp-block-post-comments .alignleft {
|
|
2138
|
+
float: left;
|
|
2139
|
+
}
|
|
2140
|
+
.wp-block-post-comments .alignright {
|
|
2141
|
+
float: right;
|
|
2142
|
+
}
|
|
2143
|
+
.wp-block-post-comments .navigation::after {
|
|
2144
|
+
content: "";
|
|
2145
|
+
display: table;
|
|
2146
|
+
clear: both;
|
|
2147
|
+
}
|
|
2130
2148
|
.wp-block-post-comments .commentlist {
|
|
2131
2149
|
clear: both;
|
|
2132
2150
|
list-style: none;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/block-library",
|
|
3
|
-
"version": "7.3.
|
|
3
|
+
"version": "7.3.12",
|
|
4
4
|
"description": "Block library for the WordPress editor.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -37,9 +37,9 @@
|
|
|
37
37
|
"@wordpress/api-fetch": "^6.3.1",
|
|
38
38
|
"@wordpress/autop": "^3.6.1",
|
|
39
39
|
"@wordpress/blob": "^3.6.1",
|
|
40
|
-
"@wordpress/block-editor": "^8.5.
|
|
40
|
+
"@wordpress/block-editor": "^8.5.9",
|
|
41
41
|
"@wordpress/blocks": "^11.5.3",
|
|
42
|
-
"@wordpress/components": "^19.8.
|
|
42
|
+
"@wordpress/components": "^19.8.5",
|
|
43
43
|
"@wordpress/compose": "^5.4.1",
|
|
44
44
|
"@wordpress/core-data": "^4.4.5",
|
|
45
45
|
"@wordpress/data": "^6.6.1",
|
|
@@ -50,13 +50,13 @@
|
|
|
50
50
|
"@wordpress/hooks": "^3.6.1",
|
|
51
51
|
"@wordpress/html-entities": "^3.6.1",
|
|
52
52
|
"@wordpress/i18n": "^4.6.1",
|
|
53
|
-
"@wordpress/icons": "^8.2.
|
|
53
|
+
"@wordpress/icons": "^8.2.3",
|
|
54
54
|
"@wordpress/keycodes": "^3.6.1",
|
|
55
55
|
"@wordpress/notices": "^3.6.1",
|
|
56
56
|
"@wordpress/primitives": "^3.4.1",
|
|
57
|
-
"@wordpress/reusable-blocks": "^3.4.
|
|
57
|
+
"@wordpress/reusable-blocks": "^3.4.9",
|
|
58
58
|
"@wordpress/rich-text": "^5.4.2",
|
|
59
|
-
"@wordpress/server-side-render": "^3.4.
|
|
59
|
+
"@wordpress/server-side-render": "^3.4.6",
|
|
60
60
|
"@wordpress/url": "^3.7.1",
|
|
61
61
|
"@wordpress/viewport": "^4.4.1",
|
|
62
62
|
"classnames": "^2.3.1",
|
|
@@ -74,5 +74,5 @@
|
|
|
74
74
|
"publishConfig": {
|
|
75
75
|
"access": "public"
|
|
76
76
|
},
|
|
77
|
-
"gitHead": "
|
|
77
|
+
"gitHead": "b83ec0e0f8bc80a73f7d606c7db10f0b3ec34a1c"
|
|
78
78
|
}
|
package/src/avatar/hooks.js
CHANGED
|
@@ -76,12 +76,15 @@ export function useUserAvatar( { userId, postId, postType } ) {
|
|
|
76
76
|
},
|
|
77
77
|
[ postType, postId, userId ]
|
|
78
78
|
);
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
79
|
+
|
|
80
|
+
const avatarUrls =
|
|
81
|
+
authorDetails && authorDetails?.avatar_urls
|
|
82
|
+
? Object.values( authorDetails.avatar_urls )
|
|
83
|
+
: null;
|
|
84
|
+
const sizes =
|
|
85
|
+
authorDetails && authorDetails?.avatar_urls
|
|
86
|
+
? Object.keys( authorDetails.avatar_urls )
|
|
87
|
+
: null;
|
|
85
88
|
const { minSize, maxSize } = getAvatarSizes( sizes );
|
|
86
89
|
const defaultAvatar = useDefaultAvatar();
|
|
87
90
|
return {
|
package/src/columns/block.json
CHANGED
|
@@ -41,7 +41,7 @@ export default function Edit( {
|
|
|
41
41
|
[ `has-text-align-${ textAlign }` ]: textAlign,
|
|
42
42
|
} ),
|
|
43
43
|
} );
|
|
44
|
-
|
|
44
|
+
let displayName = useSelect(
|
|
45
45
|
( select ) => {
|
|
46
46
|
const { getEntityRecord } = select( coreStore );
|
|
47
47
|
|
|
@@ -92,15 +92,7 @@ export default function Edit( {
|
|
|
92
92
|
);
|
|
93
93
|
|
|
94
94
|
if ( ! commentId || ! displayName ) {
|
|
95
|
-
|
|
96
|
-
<>
|
|
97
|
-
{ inspectorControls }
|
|
98
|
-
{ blockControls }
|
|
99
|
-
<div { ...blockProps }>
|
|
100
|
-
<p>{ _x( 'Comment Author', 'block title' ) }</p>
|
|
101
|
-
</div>
|
|
102
|
-
</>
|
|
103
|
-
);
|
|
95
|
+
displayName = _x( 'Comment Author', 'block title' );
|
|
104
96
|
}
|
|
105
97
|
|
|
106
98
|
const displayAuthor = isLink ? (
|
|
@@ -111,9 +103,8 @@ export default function Edit( {
|
|
|
111
103
|
{ displayName }
|
|
112
104
|
</a>
|
|
113
105
|
) : (
|
|
114
|
-
|
|
106
|
+
displayName
|
|
115
107
|
);
|
|
116
|
-
|
|
117
108
|
return (
|
|
118
109
|
<>
|
|
119
110
|
{ inspectorControls }
|
package/src/comment-date/edit.js
CHANGED
|
@@ -33,7 +33,7 @@ export default function Edit( {
|
|
|
33
33
|
setAttributes,
|
|
34
34
|
} ) {
|
|
35
35
|
const blockProps = useBlockProps();
|
|
36
|
-
|
|
36
|
+
let [ date ] = useEntityProp( 'root', 'comment', 'date', commentId );
|
|
37
37
|
const [ siteFormat = getDateSettings().formats.date ] = useEntityProp(
|
|
38
38
|
'root',
|
|
39
39
|
'site',
|
|
@@ -60,21 +60,17 @@ export default function Edit( {
|
|
|
60
60
|
);
|
|
61
61
|
|
|
62
62
|
if ( ! commentId || ! date ) {
|
|
63
|
-
|
|
64
|
-
<>
|
|
65
|
-
{ inspectorControls }
|
|
66
|
-
<div { ...blockProps }>
|
|
67
|
-
<p>{ _x( 'Comment Date', 'block title' ) }</p>
|
|
68
|
-
</div>
|
|
69
|
-
</>
|
|
70
|
-
);
|
|
63
|
+
date = _x( 'Comment Date', 'block title' );
|
|
71
64
|
}
|
|
72
65
|
|
|
73
|
-
let commentDate =
|
|
74
|
-
|
|
75
|
-
{ dateI18n(
|
|
76
|
-
|
|
77
|
-
|
|
66
|
+
let commentDate =
|
|
67
|
+
date instanceof Date ? (
|
|
68
|
+
<time dateTime={ dateI18n( 'c', date ) }>
|
|
69
|
+
{ dateI18n( format || siteFormat, date ) }
|
|
70
|
+
</time>
|
|
71
|
+
) : (
|
|
72
|
+
<time>{ date }</time>
|
|
73
|
+
);
|
|
78
74
|
|
|
79
75
|
if ( isLink ) {
|
|
80
76
|
commentDate = (
|
|
@@ -24,9 +24,6 @@ function render_block_core_comment_date( $attributes, $content, $block ) {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
$classes = '';
|
|
27
|
-
if ( isset( $attributes['fontSize'] ) ) {
|
|
28
|
-
$classes .= 'has-' . esc_attr( $attributes['fontSize'] ) . '-font-size';
|
|
29
|
-
}
|
|
30
27
|
|
|
31
28
|
$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classes ) );
|
|
32
29
|
$formatted_date = get_comment_date(
|
|
@@ -37,7 +37,12 @@ const TEMPLATE = [
|
|
|
37
37
|
'core/column',
|
|
38
38
|
{},
|
|
39
39
|
[
|
|
40
|
-
[
|
|
40
|
+
[
|
|
41
|
+
'core/comment-author-name',
|
|
42
|
+
{
|
|
43
|
+
fontSize: 'small',
|
|
44
|
+
},
|
|
45
|
+
],
|
|
41
46
|
[
|
|
42
47
|
'core/group',
|
|
43
48
|
{
|
|
@@ -52,12 +57,27 @@ const TEMPLATE = [
|
|
|
52
57
|
},
|
|
53
58
|
},
|
|
54
59
|
[
|
|
55
|
-
[
|
|
56
|
-
|
|
60
|
+
[
|
|
61
|
+
'core/comment-date',
|
|
62
|
+
{
|
|
63
|
+
fontSize: 'small',
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
[
|
|
67
|
+
'core/comment-edit-link',
|
|
68
|
+
{
|
|
69
|
+
fontSize: 'small',
|
|
70
|
+
},
|
|
71
|
+
],
|
|
57
72
|
],
|
|
58
73
|
],
|
|
59
74
|
[ 'core/comment-content' ],
|
|
60
|
-
[
|
|
75
|
+
[
|
|
76
|
+
'core/comment-reply-link',
|
|
77
|
+
{
|
|
78
|
+
fontSize: 'small',
|
|
79
|
+
},
|
|
80
|
+
],
|
|
61
81
|
],
|
|
62
82
|
],
|
|
63
83
|
],
|
package/src/cover/index.php
CHANGED
|
@@ -32,12 +32,15 @@ function render_block_core_cover( $attributes, $content ) {
|
|
|
32
32
|
|
|
33
33
|
$image = get_the_post_thumbnail( null, 'post-thumbnail', $attr );
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
35
|
+
/*
|
|
36
|
+
* Inserts the featured image between the (1st) cover 'background' `span` and 'inner_container' `div`,
|
|
37
|
+
* and removes eventual withespace characters between the two (typically introduced at template level)
|
|
38
|
+
*/
|
|
39
|
+
$inner_container_start = '/<div\b[^>]+wp-block-cover__inner-container[\s|"][^>]*>/U';
|
|
40
|
+
if ( 1 === preg_match( $inner_container_start, $content, $matches, PREG_OFFSET_CAPTURE ) ) {
|
|
41
|
+
$offset = $matches[0][1];
|
|
42
|
+
$content = substr( $content, 0, $offset ) . $image . substr( $content, $offset );
|
|
43
|
+
}
|
|
41
44
|
} else {
|
|
42
45
|
if ( in_the_loop() ) {
|
|
43
46
|
update_post_thumbnail_cache();
|
|
@@ -8,12 +8,27 @@ export default function GapStyles( { blockGap, clientId } ) {
|
|
|
8
8
|
const styleElement = useContext( BlockList.__unstableElementContext );
|
|
9
9
|
// --gallery-block--gutter-size is deprecated. --wp--style--gallery-gap-default should be used by themes that want to set a default
|
|
10
10
|
// gap on the gallery.
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
const fallbackValue = `var( --wp--style--gallery-gap-default, var( --gallery-block--gutter-size, var( --wp--style--block-gap, 0.5em ) ) )`;
|
|
12
|
+
let gapValue = fallbackValue;
|
|
13
|
+
let column = fallbackValue;
|
|
14
|
+
let row;
|
|
15
|
+
|
|
16
|
+
// Check for the possibility of split block gap values. See: https://github.com/WordPress/gutenberg/pull/37736
|
|
17
|
+
if ( !! blockGap ) {
|
|
18
|
+
row =
|
|
19
|
+
typeof blockGap === 'string'
|
|
20
|
+
? blockGap
|
|
21
|
+
: blockGap?.top || fallbackValue;
|
|
22
|
+
column =
|
|
23
|
+
typeof blockGap === 'string'
|
|
24
|
+
? blockGap
|
|
25
|
+
: blockGap?.left || fallbackValue;
|
|
26
|
+
gapValue = row === column ? row : `${ row } ${ column }`;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const gap = `#block-${ clientId } {
|
|
30
|
+
--wp--style--unstable-gallery-gap: ${ column };
|
|
31
|
+
gap: ${ gapValue }
|
|
17
32
|
}`;
|
|
18
33
|
|
|
19
34
|
const GapStyle = () => {
|
package/src/gallery/index.php
CHANGED
|
@@ -48,7 +48,14 @@ function block_core_gallery_render( $attributes, $content ) {
|
|
|
48
48
|
// Skip if gap value contains unsupported characters.
|
|
49
49
|
// Regex for CSS value borrowed from `safecss_filter_attr`, and used here
|
|
50
50
|
// because we only want to match against the value, not the CSS attribute.
|
|
51
|
-
|
|
51
|
+
if ( is_array( $gap ) ) {
|
|
52
|
+
foreach ( $gap as $key => $value ) {
|
|
53
|
+
$gap[ $key ] = $value && preg_match( '%[\\\(&=}]|/\*%', $value ) ? null : $value;
|
|
54
|
+
}
|
|
55
|
+
} else {
|
|
56
|
+
$gap = $gap && preg_match( '%[\\\(&=}]|/\*%', $gap ) ? null : $gap;
|
|
57
|
+
}
|
|
58
|
+
|
|
52
59
|
$class = wp_unique_id( 'wp-block-gallery-' );
|
|
53
60
|
$content = preg_replace(
|
|
54
61
|
'/' . preg_quote( 'class="', '/' ) . '/',
|
|
@@ -56,10 +63,22 @@ function block_core_gallery_render( $attributes, $content ) {
|
|
|
56
63
|
$content,
|
|
57
64
|
1
|
|
58
65
|
);
|
|
66
|
+
|
|
59
67
|
// --gallery-block--gutter-size is deprecated. --wp--style--gallery-gap-default should be used by themes that want to set a default
|
|
60
68
|
// gap on the gallery.
|
|
61
|
-
$
|
|
62
|
-
$
|
|
69
|
+
$fallback_gap = 'var( --wp--style--gallery-gap-default, var( --gallery-block--gutter-size, var( --wp--style--block-gap, 0.5em ) ) )';
|
|
70
|
+
$gap_value = $gap ? $gap : $fallback_gap;
|
|
71
|
+
$gap_column = $gap_value;
|
|
72
|
+
|
|
73
|
+
if ( is_array( $gap_value ) ) {
|
|
74
|
+
$gap_row = isset( $gap_value['top'] ) ? $gap_value['top'] : $fallback_gap;
|
|
75
|
+
$gap_column = isset( $gap_value['left'] ) ? $gap_value['left'] : $fallback_gap;
|
|
76
|
+
$gap_value = $gap_row === $gap_column ? $gap_row : $gap_row . ' ' . $gap_column;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// Set the CSS variable to the column value, and the `gap` property to the combined gap value.
|
|
80
|
+
$style = '.' . $class . '{ --wp--style--unstable-gallery-gap: ' . $gap_column . '; gap: ' . $gap_value . '}';
|
|
81
|
+
|
|
63
82
|
// Ideally styles should be loaded in the head, but blocks may be parsed
|
|
64
83
|
// after that, so loading in the footer for now.
|
|
65
84
|
// See https://core.trac.wordpress.org/ticket/53494.
|
|
@@ -67,7 +86,8 @@ function block_core_gallery_render( $attributes, $content ) {
|
|
|
67
86
|
'wp_footer',
|
|
68
87
|
function () use ( $style ) {
|
|
69
88
|
echo '<style> ' . $style . '</style>';
|
|
70
|
-
}
|
|
89
|
+
},
|
|
90
|
+
11
|
|
71
91
|
);
|
|
72
92
|
return $content;
|
|
73
93
|
}
|
package/src/image/edit.js
CHANGED
|
@@ -87,20 +87,6 @@ function hasDefaultSize( image, defaultSize ) {
|
|
|
87
87
|
);
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
/**
|
|
91
|
-
* Checks if a media attachment object has been "destroyed",
|
|
92
|
-
* that is, removed from the media library. The core Media Library
|
|
93
|
-
* adds a `destroyed` property to a deleted attachment object in the media collection.
|
|
94
|
-
*
|
|
95
|
-
* @param {number} id The attachment id.
|
|
96
|
-
*
|
|
97
|
-
* @return {boolean} Whether the image has been destroyed.
|
|
98
|
-
*/
|
|
99
|
-
export function isMediaDestroyed( id ) {
|
|
100
|
-
const attachment = wp?.media?.attachment( id ) || {};
|
|
101
|
-
return attachment.destroyed;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
90
|
export function ImageEdit( {
|
|
105
91
|
attributes,
|
|
106
92
|
setAttributes,
|
|
@@ -141,33 +127,6 @@ export function ImageEdit( {
|
|
|
141
127
|
return pick( getSettings(), [ 'imageDefaultSize', 'mediaUpload' ] );
|
|
142
128
|
}, [] );
|
|
143
129
|
|
|
144
|
-
// A callback passed to MediaUpload,
|
|
145
|
-
// fired when the media modal closes.
|
|
146
|
-
function onCloseModal() {
|
|
147
|
-
if ( isMediaDestroyed( attributes?.id ) ) {
|
|
148
|
-
setAttributes( {
|
|
149
|
-
url: undefined,
|
|
150
|
-
id: undefined,
|
|
151
|
-
} );
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
/*
|
|
156
|
-
Runs an error callback if the image does not load.
|
|
157
|
-
If the error callback is triggered, we infer that that image
|
|
158
|
-
has been deleted.
|
|
159
|
-
*/
|
|
160
|
-
function onImageError( isReplaced = false ) {
|
|
161
|
-
// If the image block was not replaced with an embed,
|
|
162
|
-
// clear the attributes and trigger the placeholder.
|
|
163
|
-
if ( ! isReplaced ) {
|
|
164
|
-
setAttributes( {
|
|
165
|
-
url: undefined,
|
|
166
|
-
id: undefined,
|
|
167
|
-
} );
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
|
|
171
130
|
function onUploadError( message ) {
|
|
172
131
|
noticeOperations.removeAllNotices();
|
|
173
132
|
noticeOperations.createErrorNotice( message );
|
|
@@ -366,8 +325,6 @@ export function ImageEdit( {
|
|
|
366
325
|
containerRef={ ref }
|
|
367
326
|
context={ context }
|
|
368
327
|
clientId={ clientId }
|
|
369
|
-
onCloseModal={ onCloseModal }
|
|
370
|
-
onImageLoadError={ onImageError }
|
|
371
328
|
/>
|
|
372
329
|
) }
|
|
373
330
|
{ ! url && (
|
|
@@ -384,7 +341,6 @@ export function ImageEdit( {
|
|
|
384
341
|
onSelectURL={ onSelectURL }
|
|
385
342
|
notices={ noticeUI }
|
|
386
343
|
onError={ onUploadError }
|
|
387
|
-
onClose={ onCloseModal }
|
|
388
344
|
accept="image/*"
|
|
389
345
|
allowedTypes={ ALLOWED_MEDIA_TYPES }
|
|
390
346
|
value={ { id, src } }
|