@wordpress/block-library 7.3.0 → 7.4.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/archives/edit.js +1 -1
- package/build/archives/edit.js.map +1 -1
- package/build/audio/edit.js +2 -2
- 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/categories/edit.js +8 -3
- package/build/categories/edit.js.map +1 -1
- package/build/categories/index.js +4 -0
- package/build/categories/index.js.map +1 -1
- package/build/column/index.js +10 -0
- package/build/column/index.js.map +1 -1
- package/build/comment-template/edit.js +3 -1
- package/build/comment-template/edit.js.map +1 -1
- package/build/comment-template/hooks.js +14 -4
- package/build/comment-template/hooks.js.map +1 -1
- package/build/comments-pagination/edit.js +18 -1
- package/build/comments-pagination/edit.js.map +1 -1
- package/build/comments-query-loop/edit.js +1 -1
- package/build/comments-query-loop/edit.js.map +1 -1
- package/build/comments-title/edit.js +149 -0
- package/build/comments-title/edit.js.map +1 -0
- package/build/comments-title/index.js +101 -0
- package/build/comments-title/index.js.map +1 -0
- package/build/cover/transforms.js +33 -32
- package/build/cover/transforms.js.map +1 -1
- package/build/embed/edit.js +12 -18
- package/build/embed/edit.js.map +1 -1
- package/build/embed/edit.native.js +1 -7
- package/build/embed/edit.native.js.map +1 -1
- package/build/embed/util.js +29 -4
- package/build/embed/util.js.map +1 -1
- package/build/file/inspector.js +2 -4
- package/build/file/inspector.js.map +1 -1
- package/build/gallery/edit.js +1 -1
- package/build/gallery/edit.js.map +1 -1
- package/build/gallery/v1/edit.js +1 -1
- package/build/gallery/v1/edit.js.map +1 -1
- package/build/html/edit.js +2 -2
- package/build/html/edit.js.map +1 -1
- package/build/image/edit.js +4 -6
- package/build/image/edit.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 +1 -1
- package/build/image/image.js.map +1 -1
- package/build/index.js +5 -3
- package/build/index.js.map +1 -1
- package/build/index.native.js +14 -3
- package/build/index.native.js.map +1 -1
- package/build/latest-comments/edit.js +1 -1
- package/build/latest-comments/edit.js.map +1 -1
- package/build/list/index.js +13 -2
- package/build/list/index.js.map +1 -1
- package/build/loginout/edit.js +1 -1
- package/build/loginout/edit.js.map +1 -1
- package/build/media-text/edit.js +1 -2
- package/build/media-text/edit.js.map +1 -1
- package/build/media-text/edit.native.js +1 -1
- package/build/media-text/edit.native.js.map +1 -1
- package/build/navigation/edit/index.js +17 -1
- package/build/navigation/edit/index.js.map +1 -1
- package/build/navigation/edit/navigation-menu-selector.js +7 -2
- package/build/navigation/edit/navigation-menu-selector.js.map +1 -1
- package/build/navigation/edit/unsaved-inner-blocks.js +5 -4
- package/build/navigation/edit/unsaved-inner-blocks.js.map +1 -1
- package/build/navigation/index.js +1 -1
- package/build/navigation/view-modal.js +37 -0
- package/build/navigation/view-modal.js.map +1 -0
- package/build/navigation/view.js +1 -34
- package/build/navigation/view.js.map +1 -1
- package/build/paragraph/edit.native.js +6 -2
- package/build/paragraph/edit.native.js.map +1 -1
- package/build/post-author/edit.js +1 -1
- package/build/post-author/edit.js.map +1 -1
- package/build/post-comments/index.js +4 -3
- package/build/post-comments/index.js.map +1 -1
- package/build/post-excerpt/edit.js +1 -1
- package/build/post-excerpt/edit.js.map +1 -1
- package/build/post-featured-image/edit.js +19 -7
- package/build/post-featured-image/edit.js.map +1 -1
- package/build/query/edit/index.js +84 -22
- package/build/query/edit/index.js.map +1 -1
- package/build/query/edit/query-placeholder.js +7 -14
- package/build/query/edit/query-placeholder.js.map +1 -1
- package/build/query/edit/query-toolbar.js +6 -1
- package/build/query/edit/query-toolbar.js.map +1 -1
- package/build/quote/index.js +19 -2
- package/build/quote/index.js.map +1 -1
- package/build/quote/v2/edit.js +11 -3
- package/build/quote/v2/edit.js.map +1 -1
- package/build/rss/edit.js +1 -1
- package/build/rss/edit.js.map +1 -1
- package/build/search/edit.js +11 -9
- package/build/search/edit.js.map +1 -1
- package/build/spacer/constants.js +9 -0
- package/build/spacer/constants.js.map +1 -0
- package/build/spacer/controls.js +3 -3
- package/build/spacer/controls.js.map +1 -1
- package/build/spacer/controls.native.js +2 -2
- package/build/spacer/controls.native.js.map +1 -1
- package/build/spacer/edit.js +5 -6
- package/build/spacer/edit.js.map +1 -1
- package/build/table/edit.js +8 -2
- package/build/table/edit.js.map +1 -1
- package/build/tag-cloud/edit.js +1 -1
- package/build/tag-cloud/edit.js.map +1 -1
- package/build/video/edit.js +1 -1
- 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-module/archives/edit.js +1 -1
- package/build-module/archives/edit.js.map +1 -1
- package/build-module/audio/edit.js +2 -2
- package/build-module/audio/edit.js.map +1 -1
- package/build-module/audio/edit.native.js +1 -1
- package/build-module/audio/edit.native.js.map +1 -1
- package/build-module/categories/edit.js +8 -3
- package/build-module/categories/edit.js.map +1 -1
- package/build-module/categories/index.js +4 -0
- package/build-module/categories/index.js.map +1 -1
- package/build-module/column/index.js +10 -0
- package/build-module/column/index.js.map +1 -1
- package/build-module/comment-template/edit.js +3 -1
- package/build-module/comment-template/edit.js.map +1 -1
- package/build-module/comment-template/hooks.js +14 -4
- package/build-module/comment-template/hooks.js.map +1 -1
- package/build-module/comments-pagination/edit.js +19 -2
- package/build-module/comments-pagination/edit.js.map +1 -1
- package/build-module/comments-query-loop/edit.js +1 -1
- package/build-module/comments-query-loop/edit.js.map +1 -1
- package/build-module/comments-title/edit.js +133 -0
- package/build-module/comments-title/edit.js.map +1 -0
- package/build-module/comments-title/index.js +88 -0
- package/build-module/comments-title/index.js.map +1 -0
- package/build-module/cover/transforms.js +33 -32
- package/build-module/cover/transforms.js.map +1 -1
- package/build-module/embed/edit.js +13 -19
- package/build-module/embed/edit.js.map +1 -1
- package/build-module/embed/edit.native.js +2 -8
- package/build-module/embed/edit.native.js.map +1 -1
- package/build-module/embed/util.js +25 -3
- package/build-module/embed/util.js.map +1 -1
- package/build-module/file/inspector.js +2 -4
- package/build-module/file/inspector.js.map +1 -1
- package/build-module/gallery/edit.js +1 -1
- package/build-module/gallery/edit.js.map +1 -1
- package/build-module/gallery/v1/edit.js +1 -1
- package/build-module/gallery/v1/edit.js.map +1 -1
- package/build-module/html/edit.js +2 -2
- package/build-module/html/edit.js.map +1 -1
- package/build-module/image/edit.js +4 -6
- package/build-module/image/edit.js.map +1 -1
- package/build-module/image/edit.native.js +1 -1
- package/build-module/image/edit.native.js.map +1 -1
- package/build-module/image/image.js +1 -1
- package/build-module/image/image.js.map +1 -1
- package/build-module/index.js +4 -3
- package/build-module/index.js.map +1 -1
- package/build-module/index.native.js +14 -3
- package/build-module/index.native.js.map +1 -1
- package/build-module/latest-comments/edit.js +1 -1
- package/build-module/latest-comments/edit.js.map +1 -1
- package/build-module/list/index.js +9 -3
- package/build-module/list/index.js.map +1 -1
- package/build-module/loginout/edit.js +1 -1
- package/build-module/loginout/edit.js.map +1 -1
- package/build-module/media-text/edit.js +1 -2
- package/build-module/media-text/edit.js.map +1 -1
- package/build-module/media-text/edit.native.js +1 -1
- package/build-module/media-text/edit.native.js.map +1 -1
- package/build-module/navigation/edit/index.js +17 -1
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/navigation/edit/navigation-menu-selector.js +6 -2
- package/build-module/navigation/edit/navigation-menu-selector.js.map +1 -1
- package/build-module/navigation/edit/unsaved-inner-blocks.js +5 -4
- package/build-module/navigation/edit/unsaved-inner-blocks.js.map +1 -1
- package/build-module/navigation/index.js +1 -1
- package/build-module/navigation/view-modal.js +32 -0
- package/build-module/navigation/view-modal.js.map +1 -0
- package/build-module/navigation/view.js +1 -30
- package/build-module/navigation/view.js.map +1 -1
- package/build-module/paragraph/edit.native.js +6 -2
- package/build-module/paragraph/edit.native.js.map +1 -1
- package/build-module/post-author/edit.js +1 -1
- package/build-module/post-author/edit.js.map +1 -1
- package/build-module/post-comments/index.js +4 -3
- package/build-module/post-comments/index.js.map +1 -1
- package/build-module/post-excerpt/edit.js +1 -1
- package/build-module/post-excerpt/edit.js.map +1 -1
- package/build-module/post-featured-image/edit.js +19 -7
- package/build-module/post-featured-image/edit.js.map +1 -1
- package/build-module/query/edit/index.js +87 -26
- package/build-module/query/edit/index.js.map +1 -1
- package/build-module/query/edit/query-placeholder.js +8 -15
- package/build-module/query/edit/query-placeholder.js.map +1 -1
- package/build-module/query/edit/query-toolbar.js +6 -1
- package/build-module/query/edit/query-toolbar.js.map +1 -1
- package/build-module/quote/index.js +10 -4
- package/build-module/quote/index.js.map +1 -1
- package/build-module/quote/v2/edit.js +10 -3
- package/build-module/quote/v2/edit.js.map +1 -1
- package/build-module/rss/edit.js +1 -1
- package/build-module/rss/edit.js.map +1 -1
- package/build-module/search/edit.js +11 -9
- package/build-module/search/edit.js.map +1 -1
- package/build-module/spacer/constants.js +2 -0
- package/build-module/spacer/constants.js.map +1 -0
- package/build-module/spacer/controls.js +2 -2
- package/build-module/spacer/controls.js.map +1 -1
- package/build-module/spacer/controls.native.js +1 -1
- package/build-module/spacer/controls.native.js.map +1 -1
- package/build-module/spacer/edit.js +1 -1
- package/build-module/spacer/edit.js.map +1 -1
- package/build-module/table/edit.js +9 -3
- package/build-module/table/edit.js.map +1 -1
- package/build-module/tag-cloud/edit.js +1 -1
- package/build-module/tag-cloud/edit.js.map +1 -1
- package/build-module/video/edit.js +1 -1
- package/build-module/video/edit.js.map +1 -1
- package/build-module/video/edit.native.js +1 -1
- package/build-module/video/edit.native.js.map +1 -1
- package/build-style/comments-title/editor-rtl.css +79 -0
- package/build-style/comments-title/editor.css +79 -0
- package/build-style/common-rtl.css +32 -0
- package/build-style/common.css +32 -0
- package/build-style/editor-rtl.css +51 -0
- package/build-style/editor.css +51 -0
- package/build-style/post-comments-form/style-rtl.css +9 -0
- package/build-style/post-comments-form/style.css +9 -0
- package/build-style/query/editor-rtl.css +39 -0
- package/build-style/query/editor.css +39 -0
- package/build-style/style-rtl.css +79 -0
- package/build-style/style.css +79 -0
- package/build-style/table/editor-rtl.css +8 -0
- package/build-style/table/editor.css +8 -0
- package/build-style/table/style-rtl.css +38 -0
- package/build-style/table/style.css +38 -0
- package/package.json +28 -28
- package/src/archives/edit.js +1 -1
- package/src/audio/edit.js +2 -2
- package/src/audio/edit.native.js +1 -1
- package/src/categories/block.json +4 -0
- package/src/categories/edit.js +8 -2
- package/src/categories/index.php +1 -0
- package/src/column/block.json +10 -0
- package/src/comment-template/edit.js +5 -2
- package/src/comment-template/hooks.js +15 -2
- package/src/comment-template/index.php +23 -2
- package/src/comments-pagination/edit.js +23 -0
- package/src/comments-query-loop/edit.js +1 -0
- package/src/comments-title/block.json +70 -0
- package/src/comments-title/edit.js +197 -0
- package/src/comments-title/editor.scss +4 -0
- package/src/comments-title/index.js +18 -0
- package/src/comments-title/index.php +68 -0
- package/src/common.scss +24 -1
- package/src/cover/transforms.js +51 -28
- package/src/editor.scss +1 -0
- package/src/embed/edit.js +19 -24
- package/src/embed/edit.native.js +9 -14
- package/src/embed/util.js +34 -2
- package/src/file/inspector.js +1 -3
- package/src/gallery/edit.js +1 -1
- package/src/gallery/v1/edit.js +1 -1
- package/src/html/edit.js +2 -2
- package/src/image/edit.js +2 -4
- package/src/image/edit.native.js +1 -1
- package/src/image/image.js +1 -1
- package/src/index.js +7 -1
- package/src/index.native.js +12 -2
- package/src/latest-comments/edit.js +1 -1
- package/src/list/index.js +7 -3
- package/src/loginout/edit.js +1 -1
- package/src/media-text/edit.js +1 -2
- package/src/media-text/edit.native.js +1 -1
- package/src/navigation/block.json +1 -1
- package/src/navigation/edit/index.js +24 -0
- package/src/navigation/edit/navigation-menu-selector.js +15 -9
- package/src/navigation/edit/unsaved-inner-blocks.js +5 -4
- package/src/navigation/index.php +5 -0
- package/src/navigation/view-modal.js +36 -0
- package/src/navigation/view.js +0 -35
- package/src/paragraph/edit.native.js +13 -1
- package/src/post-author/edit.js +1 -1
- package/src/post-comments/block.json +4 -3
- package/src/post-comments-form/index.php +12 -4
- package/src/post-comments-form/style.scss +11 -0
- package/src/post-excerpt/edit.js +1 -1
- package/src/post-featured-image/edit.js +24 -12
- package/src/query/edit/index.js +125 -26
- package/src/query/edit/query-placeholder.js +3 -13
- package/src/query/edit/query-toolbar.js +6 -0
- package/src/query/editor.scss +38 -0
- package/src/quote/index.js +8 -4
- package/src/quote/v2/edit.js +3 -0
- package/src/rss/edit.js +1 -1
- package/src/search/edit.js +13 -7
- package/src/search/index.php +84 -33
- package/src/spacer/constants.js +1 -0
- package/src/spacer/controls.js +2 -2
- package/src/spacer/controls.native.js +1 -1
- package/src/spacer/edit.js +1 -2
- package/src/table/edit.js +11 -2
- package/src/table/editor.scss +13 -0
- package/src/table/style.scss +52 -0
- package/src/tag-cloud/edit.js +1 -1
- package/src/video/edit.js +1 -1
- package/src/video/edit.native.js +1 -1
package/src/index.js
CHANGED
|
@@ -35,6 +35,7 @@ import * as commentsQueryLoop from './comments-query-loop';
|
|
|
35
35
|
import * as commentsPagination from './comments-pagination';
|
|
36
36
|
import * as commentsPaginationNext from './comments-pagination-next';
|
|
37
37
|
import * as commentsPaginationNumbers from './comments-pagination-numbers';
|
|
38
|
+
import * as commentsTitle from './comments-title';
|
|
38
39
|
import * as cover from './cover';
|
|
39
40
|
import * as embed from './embed';
|
|
40
41
|
import * as file from './file';
|
|
@@ -138,7 +139,6 @@ export const __experimentalGetCoreBlocks = () => [
|
|
|
138
139
|
heading,
|
|
139
140
|
gallery,
|
|
140
141
|
list,
|
|
141
|
-
listItem,
|
|
142
142
|
quote,
|
|
143
143
|
|
|
144
144
|
// Register all remaining core blocks.
|
|
@@ -213,11 +213,13 @@ export const __experimentalGetCoreBlocks = () => [
|
|
|
213
213
|
commentEditLink,
|
|
214
214
|
commentReplyLink,
|
|
215
215
|
commentTemplate,
|
|
216
|
+
commentsTitle,
|
|
216
217
|
commentsQueryLoop,
|
|
217
218
|
commentsPagination,
|
|
218
219
|
commentsPaginationNext,
|
|
219
220
|
commentsPaginationNumbers,
|
|
220
221
|
commentsPaginationPrevious,
|
|
222
|
+
|
|
221
223
|
postComments,
|
|
222
224
|
homeLink,
|
|
223
225
|
logInOut,
|
|
@@ -268,6 +270,10 @@ export const __experimentalRegisterExperimentalCoreBlocks = process.env
|
|
|
268
270
|
[
|
|
269
271
|
// Experimental blocks.
|
|
270
272
|
postAuthorName,
|
|
273
|
+
...( window.__experimentalEnableListBlockV2
|
|
274
|
+
? [ listItem ]
|
|
275
|
+
: [] ),
|
|
276
|
+
|
|
271
277
|
// Full Site Editing blocks.
|
|
272
278
|
...( enableFSEBlocks
|
|
273
279
|
? [
|
package/src/index.native.js
CHANGED
|
@@ -179,6 +179,14 @@ const devOnly = ( block ) => ( !! __DEV__ ? block : null );
|
|
|
179
179
|
const iOSOnly = ( block ) =>
|
|
180
180
|
Platform.OS === 'ios' ? block : devOnly( block );
|
|
181
181
|
|
|
182
|
+
// To be removed once Quote V2 is released on the web editor.
|
|
183
|
+
function quoteCheck( quoteBlock, blocksFlags ) {
|
|
184
|
+
if ( blocksFlags?.__experimentalEnableQuoteBlockV2 ) {
|
|
185
|
+
quoteBlock.settings = quoteBlock?.settingsV2;
|
|
186
|
+
}
|
|
187
|
+
return quoteBlock;
|
|
188
|
+
}
|
|
189
|
+
|
|
182
190
|
// Hide the Classic block and SocialLink block
|
|
183
191
|
addFilter(
|
|
184
192
|
'blocks.registerBlockType',
|
|
@@ -230,8 +238,10 @@ addFilter(
|
|
|
230
238
|
*
|
|
231
239
|
* registerCoreBlocks();
|
|
232
240
|
* ```
|
|
241
|
+
* @param {Object} [blocksFlags] Experimental flags
|
|
242
|
+
*
|
|
233
243
|
*/
|
|
234
|
-
export const registerCoreBlocks = () => {
|
|
244
|
+
export const registerCoreBlocks = ( blocksFlags ) => {
|
|
235
245
|
// When adding new blocks to this list please also consider updating /src/block-support/supported-blocks.json in the Gutenberg-Mobile repo
|
|
236
246
|
[
|
|
237
247
|
paragraph,
|
|
@@ -244,7 +254,7 @@ export const registerCoreBlocks = () => {
|
|
|
244
254
|
nextpage,
|
|
245
255
|
separator,
|
|
246
256
|
list,
|
|
247
|
-
quote,
|
|
257
|
+
quoteCheck( quote, blocksFlags ),
|
|
248
258
|
mediaText,
|
|
249
259
|
preformatted,
|
|
250
260
|
gallery,
|
|
@@ -35,7 +35,7 @@ export default function LatestComments( { attributes, setAttributes } ) {
|
|
|
35
35
|
return (
|
|
36
36
|
<div { ...useBlockProps() }>
|
|
37
37
|
<InspectorControls>
|
|
38
|
-
<PanelBody title={ __( '
|
|
38
|
+
<PanelBody title={ __( 'Settings' ) }>
|
|
39
39
|
<ToggleControl
|
|
40
40
|
label={ __( 'Display avatar' ) }
|
|
41
41
|
checked={ displayAvatar }
|
package/src/list/index.js
CHANGED
|
@@ -43,6 +43,10 @@ const settingsV1 = {
|
|
|
43
43
|
deprecated,
|
|
44
44
|
};
|
|
45
45
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
let settings = settingsV1;
|
|
47
|
+
if ( process.env.IS_GUTENBERG_PLUGIN ) {
|
|
48
|
+
settings = window?.__experimentalEnableListBlockV2
|
|
49
|
+
? settingsV2
|
|
50
|
+
: settingsV1;
|
|
51
|
+
}
|
|
52
|
+
export { settings };
|
package/src/loginout/edit.js
CHANGED
|
@@ -11,7 +11,7 @@ export default function LoginOutEdit( { attributes, setAttributes } ) {
|
|
|
11
11
|
return (
|
|
12
12
|
<>
|
|
13
13
|
<InspectorControls>
|
|
14
|
-
<PanelBody title={ __( '
|
|
14
|
+
<PanelBody title={ __( 'Settings' ) }>
|
|
15
15
|
<ToggleControl
|
|
16
16
|
label={ __( 'Display login as form' ) }
|
|
17
17
|
checked={ displayLoginAsForm }
|
package/src/media-text/edit.js
CHANGED
|
@@ -46,7 +46,6 @@ const TEMPLATE = [
|
|
|
46
46
|
[
|
|
47
47
|
'core/paragraph',
|
|
48
48
|
{
|
|
49
|
-
fontSize: 'large',
|
|
50
49
|
placeholder: _x( 'Content…', 'content placeholder' ),
|
|
51
50
|
},
|
|
52
51
|
],
|
|
@@ -238,7 +237,7 @@ function MediaTextEdit( { attributes, isSelected, setAttributes } ) {
|
|
|
238
237
|
};
|
|
239
238
|
|
|
240
239
|
const mediaTextGeneralSettings = (
|
|
241
|
-
<PanelBody title={ __( '
|
|
240
|
+
<PanelBody title={ __( 'Settings' ) }>
|
|
242
241
|
<ToggleControl
|
|
243
242
|
label={ __( 'Stack on mobile' ) }
|
|
244
243
|
checked={ isStackedOnMobile }
|
|
@@ -186,7 +186,7 @@ class MediaTextEdit extends Component {
|
|
|
186
186
|
|
|
187
187
|
return (
|
|
188
188
|
<InspectorControls>
|
|
189
|
-
<PanelBody title={ __( '
|
|
189
|
+
<PanelBody title={ __( 'Settings' ) }>
|
|
190
190
|
<ToggleControl
|
|
191
191
|
label={ __( 'Crop image to fill entire column' ) }
|
|
192
192
|
checked={ imageFill }
|
|
@@ -523,6 +523,11 @@ function Navigation( {
|
|
|
523
523
|
ref,
|
|
524
524
|
] );
|
|
525
525
|
|
|
526
|
+
const navigationSelectorRef = useRef();
|
|
527
|
+
const [
|
|
528
|
+
shouldFocusNavigationSelector,
|
|
529
|
+
setShouldFocusNavigationSelector,
|
|
530
|
+
] = useState( false );
|
|
526
531
|
const handleSelectNavigation = useCallback(
|
|
527
532
|
( navPostOrClassicMenu ) => {
|
|
528
533
|
if ( ! navPostOrClassicMenu ) {
|
|
@@ -538,10 +543,28 @@ function Navigation( {
|
|
|
538
543
|
} else {
|
|
539
544
|
handleUpdateMenu( navPostOrClassicMenu.id );
|
|
540
545
|
}
|
|
546
|
+
setShouldFocusNavigationSelector( true );
|
|
541
547
|
},
|
|
542
548
|
[ convert, handleUpdateMenu ]
|
|
543
549
|
);
|
|
544
550
|
|
|
551
|
+
// Focus support after menu selection.
|
|
552
|
+
useEffect( () => {
|
|
553
|
+
if (
|
|
554
|
+
isDraftNavigationMenu ||
|
|
555
|
+
! isEntityAvailable ||
|
|
556
|
+
! shouldFocusNavigationSelector
|
|
557
|
+
) {
|
|
558
|
+
return;
|
|
559
|
+
}
|
|
560
|
+
navigationSelectorRef?.current?.focus();
|
|
561
|
+
setShouldFocusNavigationSelector( false );
|
|
562
|
+
}, [
|
|
563
|
+
isDraftNavigationMenu,
|
|
564
|
+
isEntityAvailable,
|
|
565
|
+
shouldFocusNavigationSelector,
|
|
566
|
+
] );
|
|
567
|
+
|
|
545
568
|
const resetToEmptyBlock = useCallback( () => {
|
|
546
569
|
registry.batch( () => {
|
|
547
570
|
if ( navigationArea ) {
|
|
@@ -663,6 +686,7 @@ function Navigation( {
|
|
|
663
686
|
{ ! isDraftNavigationMenu && isEntityAvailable && (
|
|
664
687
|
<ToolbarGroup className="wp-block-navigation__toolbar-menu-selector">
|
|
665
688
|
<NavigationMenuSelector
|
|
689
|
+
ref={ navigationSelectorRef }
|
|
666
690
|
currentMenuId={ ref }
|
|
667
691
|
clientId={ clientId }
|
|
668
692
|
onSelect={ handleSelectNavigation }
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
import { __, sprintf } from '@wordpress/i18n';
|
|
11
11
|
import { decodeEntities } from '@wordpress/html-entities';
|
|
12
12
|
import { addQueryArgs } from '@wordpress/url';
|
|
13
|
-
import { useCallback, useMemo } from '@wordpress/element';
|
|
13
|
+
import { forwardRef, useCallback, useMemo } from '@wordpress/element';
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* Internal dependencies
|
|
@@ -18,14 +18,17 @@ import { useCallback, useMemo } from '@wordpress/element';
|
|
|
18
18
|
import useNavigationMenu from '../use-navigation-menu';
|
|
19
19
|
import useNavigationEntities from '../use-navigation-entities';
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
21
|
+
function NavigationMenuSelector(
|
|
22
|
+
{
|
|
23
|
+
currentMenuId,
|
|
24
|
+
onSelect,
|
|
25
|
+
onCreateNew,
|
|
26
|
+
showManageActions = false,
|
|
27
|
+
actionLabel,
|
|
28
|
+
toggleProps = {},
|
|
29
|
+
},
|
|
30
|
+
forwardedRef
|
|
31
|
+
) {
|
|
29
32
|
/* translators: %s: The name of a menu. */
|
|
30
33
|
const createActionLabel = __( "Create from '%s'" );
|
|
31
34
|
|
|
@@ -92,6 +95,7 @@ export default function NavigationMenuSelector( {
|
|
|
92
95
|
|
|
93
96
|
return (
|
|
94
97
|
<ToolbarDropdownMenu
|
|
98
|
+
ref={ forwardedRef }
|
|
95
99
|
label={ __( 'Select Menu' ) }
|
|
96
100
|
text={ __( 'Select Menu' ) }
|
|
97
101
|
icon={ null }
|
|
@@ -152,3 +156,5 @@ export default function NavigationMenuSelector( {
|
|
|
152
156
|
</ToolbarDropdownMenu>
|
|
153
157
|
);
|
|
154
158
|
}
|
|
159
|
+
|
|
160
|
+
export default forwardRef( NavigationMenuSelector );
|
|
@@ -123,7 +123,7 @@ export default function UnsavedInnerBlocks( {
|
|
|
123
123
|
);
|
|
124
124
|
|
|
125
125
|
// Automatically save the uncontrolled blocks.
|
|
126
|
-
useEffect(
|
|
126
|
+
useEffect( () => {
|
|
127
127
|
// The block will be disabled when used in a BlockPreview.
|
|
128
128
|
// In this case avoid automatic creation of a wp_navigation post.
|
|
129
129
|
// Otherwise the user will be spammed with lots of menus!
|
|
@@ -150,9 +150,10 @@ export default function UnsavedInnerBlocks( {
|
|
|
150
150
|
}
|
|
151
151
|
|
|
152
152
|
savingLock.current = true;
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
153
|
+
createNavigationMenu( null, blocks ).then( ( menu ) => {
|
|
154
|
+
onSave( menu );
|
|
155
|
+
savingLock.current = false;
|
|
156
|
+
} );
|
|
156
157
|
}, [
|
|
157
158
|
isDisabled,
|
|
158
159
|
isSaving,
|
package/src/navigation/index.php
CHANGED
|
@@ -396,6 +396,11 @@ function render_block_core_navigation( $attributes, $content, $block ) {
|
|
|
396
396
|
wp_enqueue_script( 'wp-block-navigation-view' );
|
|
397
397
|
}
|
|
398
398
|
|
|
399
|
+
$should_load_modal_view_script = isset( $attributes['overlayMenu'] ) && 'never' !== $attributes['overlayMenu'];
|
|
400
|
+
if ( $should_load_modal_view_script ) {
|
|
401
|
+
wp_enqueue_script( 'wp-block-navigation-view-modal' );
|
|
402
|
+
}
|
|
403
|
+
|
|
399
404
|
$inner_blocks = $block->inner_blocks;
|
|
400
405
|
|
|
401
406
|
// Ensure that blocks saved with the legacy ref attribute name (navigationMenuId) continue to render.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import MicroModal from 'micromodal';
|
|
5
|
+
|
|
6
|
+
// Responsive navigation toggle.
|
|
7
|
+
function navigationToggleModal( modal ) {
|
|
8
|
+
const dialogContainer = modal.querySelector(
|
|
9
|
+
`.wp-block-navigation__responsive-dialog`
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
const isHidden = 'true' === modal.getAttribute( 'aria-hidden' );
|
|
13
|
+
|
|
14
|
+
modal.classList.toggle( 'has-modal-open', ! isHidden );
|
|
15
|
+
dialogContainer.toggleAttribute( 'aria-modal', ! isHidden );
|
|
16
|
+
|
|
17
|
+
if ( isHidden ) {
|
|
18
|
+
dialogContainer.removeAttribute( 'role' );
|
|
19
|
+
dialogContainer.removeAttribute( 'aria-modal' );
|
|
20
|
+
} else {
|
|
21
|
+
dialogContainer.setAttribute( 'role', 'dialog' );
|
|
22
|
+
dialogContainer.setAttribute( 'aria-modal', 'true' );
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Add a class to indicate the modal is open.
|
|
26
|
+
const htmlElement = document.documentElement;
|
|
27
|
+
htmlElement.classList.toggle( 'has-modal-open' );
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
window.addEventListener( 'load', () => {
|
|
31
|
+
MicroModal.init( {
|
|
32
|
+
onShow: navigationToggleModal,
|
|
33
|
+
onClose: navigationToggleModal,
|
|
34
|
+
openClass: 'is-menu-open',
|
|
35
|
+
} );
|
|
36
|
+
} );
|
package/src/navigation/view.js
CHANGED
|
@@ -1,32 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import MicroModal from 'micromodal';
|
|
5
|
-
|
|
6
|
-
// Responsive navigation toggle.
|
|
7
|
-
function navigationToggleModal( modal ) {
|
|
8
|
-
const dialogContainer = modal.querySelector(
|
|
9
|
-
`.wp-block-navigation__responsive-dialog`
|
|
10
|
-
);
|
|
11
|
-
|
|
12
|
-
const isHidden = 'true' === modal.getAttribute( 'aria-hidden' );
|
|
13
|
-
|
|
14
|
-
modal.classList.toggle( 'has-modal-open', ! isHidden );
|
|
15
|
-
dialogContainer.toggleAttribute( 'aria-modal', ! isHidden );
|
|
16
|
-
|
|
17
|
-
if ( isHidden ) {
|
|
18
|
-
dialogContainer.removeAttribute( 'role' );
|
|
19
|
-
dialogContainer.removeAttribute( 'aria-modal' );
|
|
20
|
-
} else {
|
|
21
|
-
dialogContainer.setAttribute( 'role', 'dialog' );
|
|
22
|
-
dialogContainer.setAttribute( 'aria-modal', 'true' );
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
// Add a class to indicate the modal is open.
|
|
26
|
-
const htmlElement = document.documentElement;
|
|
27
|
-
htmlElement.classList.toggle( 'has-modal-open' );
|
|
28
|
-
}
|
|
29
|
-
|
|
30
1
|
// Open on click functionality.
|
|
31
2
|
function closeSubmenus( element ) {
|
|
32
3
|
element
|
|
@@ -65,12 +36,6 @@ function toggleSubmenuOnClick( event ) {
|
|
|
65
36
|
// Necessary for some themes such as TT1 Blocks, where
|
|
66
37
|
// scripts could be loaded before the body.
|
|
67
38
|
window.addEventListener( 'load', () => {
|
|
68
|
-
MicroModal.init( {
|
|
69
|
-
onShow: navigationToggleModal,
|
|
70
|
-
onClose: navigationToggleModal,
|
|
71
|
-
openClass: 'is-menu-open',
|
|
72
|
-
} );
|
|
73
|
-
|
|
74
39
|
const submenuButtons = document.querySelectorAll(
|
|
75
40
|
'.wp-block-navigation-submenu__toggle'
|
|
76
41
|
);
|
|
@@ -14,6 +14,8 @@ import { useSelect } from '@wordpress/data';
|
|
|
14
14
|
|
|
15
15
|
const name = 'core/paragraph';
|
|
16
16
|
|
|
17
|
+
const allowedParentBlockAlignments = [ 'left', 'center', 'right' ];
|
|
18
|
+
|
|
17
19
|
function ParagraphBlock( {
|
|
18
20
|
attributes,
|
|
19
21
|
mergeBlocks,
|
|
@@ -21,6 +23,7 @@ function ParagraphBlock( {
|
|
|
21
23
|
setAttributes,
|
|
22
24
|
style,
|
|
23
25
|
clientId,
|
|
26
|
+
parentBlockAlignment,
|
|
24
27
|
} ) {
|
|
25
28
|
const isRTL = useSelect( ( select ) => {
|
|
26
29
|
return !! select( blockEditorStore ).getSettings().isRTL;
|
|
@@ -40,6 +43,15 @@ function ParagraphBlock( {
|
|
|
40
43
|
const onAlignmentChange = useCallback( ( nextAlign ) => {
|
|
41
44
|
setAttributes( { align: nextAlign } );
|
|
42
45
|
}, [] );
|
|
46
|
+
|
|
47
|
+
const parentTextAlignment = allowedParentBlockAlignments.includes(
|
|
48
|
+
parentBlockAlignment
|
|
49
|
+
)
|
|
50
|
+
? parentBlockAlignment
|
|
51
|
+
: undefined;
|
|
52
|
+
|
|
53
|
+
const textAlignment = align || parentTextAlignment;
|
|
54
|
+
|
|
43
55
|
return (
|
|
44
56
|
<>
|
|
45
57
|
<BlockControls group="block">
|
|
@@ -82,7 +94,7 @@ function ParagraphBlock( {
|
|
|
82
94
|
onReplace={ onReplace }
|
|
83
95
|
onRemove={ onReplace ? () => onReplace( [] ) : undefined }
|
|
84
96
|
placeholder={ placeholder || __( 'Start writing…' ) }
|
|
85
|
-
textAlign={
|
|
97
|
+
textAlign={ textAlignment }
|
|
86
98
|
__unstableEmbedURLOnPaste
|
|
87
99
|
/>
|
|
88
100
|
</>
|
package/src/post-author/edit.js
CHANGED
|
@@ -69,7 +69,7 @@ function PostAuthorEdit( {
|
|
|
69
69
|
return (
|
|
70
70
|
<>
|
|
71
71
|
<InspectorControls>
|
|
72
|
-
<PanelBody title={ __( '
|
|
72
|
+
<PanelBody title={ __( 'Settings' ) }>
|
|
73
73
|
{ ! isDescendentOfQueryLoop && !! authors?.length && (
|
|
74
74
|
<SelectControl
|
|
75
75
|
label={ __( 'Author' ) }
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
"$schema": "https://schemas.wp.org/trunk/block.json",
|
|
3
3
|
"apiVersion": 2,
|
|
4
4
|
"name": "core/post-comments",
|
|
5
|
-
"title": "Post Comments",
|
|
5
|
+
"title": "Post Comments (deprecated)",
|
|
6
6
|
"category": "theme",
|
|
7
|
-
"description": "
|
|
7
|
+
"description": "This block is deprecated. Please use the Comments Query Loop block instead.",
|
|
8
8
|
"textdomain": "default",
|
|
9
9
|
"attributes": {
|
|
10
10
|
"textAlign": {
|
|
@@ -33,7 +33,8 @@
|
|
|
33
33
|
"background": true,
|
|
34
34
|
"text": true
|
|
35
35
|
}
|
|
36
|
-
}
|
|
36
|
+
},
|
|
37
|
+
"inserter": false
|
|
37
38
|
},
|
|
38
39
|
"style": [
|
|
39
40
|
"wp-block-post-comments",
|
|
@@ -18,20 +18,28 @@ function render_block_core_post_comments_form( $attributes, $content, $block ) {
|
|
|
18
18
|
return '';
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
$classes = '';
|
|
21
|
+
$classes = 'comment-respond'; // See comment further below.
|
|
22
22
|
if ( isset( $attributes['textAlign'] ) ) {
|
|
23
23
|
$classes .= 'has-text-align-' . $attributes['textAlign'];
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classes ) );
|
|
27
|
+
|
|
26
28
|
ob_start();
|
|
27
29
|
comment_form( array(), $block->context['postId'] );
|
|
28
|
-
$form
|
|
29
|
-
|
|
30
|
+
$form = ob_get_clean();
|
|
31
|
+
|
|
32
|
+
// We use the outermost wrapping `<div />` returned by `comment_form()`
|
|
33
|
+
// which is identified by its default classname `comment-respond` to inject
|
|
34
|
+
// our wrapper attributes. This way, it is guaranteed that all styling applied
|
|
35
|
+
// to the block is carried along when the comment form is moved to the location
|
|
36
|
+
// of the 'Reply' link that the user clicked by Core's `comment-reply.js` script.
|
|
37
|
+
$form = str_replace( 'class="comment-respond"', $wrapper_attributes, $form );
|
|
30
38
|
|
|
31
39
|
// Enqueue the comment-reply script.
|
|
32
40
|
wp_enqueue_script( 'comment-reply' );
|
|
33
41
|
|
|
34
|
-
return
|
|
42
|
+
return $form;
|
|
35
43
|
}
|
|
36
44
|
|
|
37
45
|
/**
|
|
@@ -67,4 +67,15 @@
|
|
|
67
67
|
margin-top: 0.35em;
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
|
+
|
|
71
|
+
.comment-reply-title {
|
|
72
|
+
align-items: baseline;
|
|
73
|
+
display: flex;
|
|
74
|
+
justify-content: space-between;
|
|
75
|
+
margin-bottom: 0;
|
|
76
|
+
|
|
77
|
+
:where(small) {
|
|
78
|
+
font-size: var(--wp--preset--font-size--medium, smaller);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
70
81
|
}
|
package/src/post-excerpt/edit.js
CHANGED
|
@@ -114,7 +114,7 @@ export default function PostExcerptEditor( {
|
|
|
114
114
|
/>
|
|
115
115
|
</BlockControls>
|
|
116
116
|
<InspectorControls>
|
|
117
|
-
<PanelBody title={ __( '
|
|
117
|
+
<PanelBody title={ __( 'Settings' ) }>
|
|
118
118
|
<ToggleControl
|
|
119
119
|
label={ __( 'Show link on new line' ) }
|
|
120
120
|
checked={ showMoreOnNewLine }
|
|
@@ -57,22 +57,30 @@ function PostFeaturedImageDisplay( {
|
|
|
57
57
|
clientId,
|
|
58
58
|
attributes,
|
|
59
59
|
setAttributes,
|
|
60
|
-
context: { postId, postType, queryId },
|
|
60
|
+
context: { postId, postType: postTypeSlug, queryId },
|
|
61
61
|
} ) {
|
|
62
62
|
const isDescendentOfQueryLoop = Number.isFinite( queryId );
|
|
63
63
|
const { isLink, height, width, scale, sizeSlug } = attributes;
|
|
64
64
|
const [ featuredImage, setFeaturedImage ] = useEntityProp(
|
|
65
65
|
'postType',
|
|
66
|
-
|
|
66
|
+
postTypeSlug,
|
|
67
67
|
'featured_media',
|
|
68
68
|
postId
|
|
69
69
|
);
|
|
70
70
|
|
|
71
|
-
const media = useSelect(
|
|
72
|
-
( select ) =>
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
71
|
+
const { media, postType } = useSelect(
|
|
72
|
+
( select ) => {
|
|
73
|
+
const { getMedia, getPostType } = select( coreStore );
|
|
74
|
+
return {
|
|
75
|
+
media:
|
|
76
|
+
featuredImage &&
|
|
77
|
+
getMedia( featuredImage, {
|
|
78
|
+
context: 'view',
|
|
79
|
+
} ),
|
|
80
|
+
postType: postTypeSlug && getPostType( postTypeSlug ),
|
|
81
|
+
};
|
|
82
|
+
},
|
|
83
|
+
[ featuredImage, postTypeSlug ]
|
|
76
84
|
);
|
|
77
85
|
const mediaUrl = getMediaSourceUrlBySizeSlug( media, sizeSlug );
|
|
78
86
|
|
|
@@ -124,11 +132,15 @@ function PostFeaturedImageDisplay( {
|
|
|
124
132
|
<InspectorControls>
|
|
125
133
|
<PanelBody title={ __( 'Link settings' ) }>
|
|
126
134
|
<ToggleControl
|
|
127
|
-
label={
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
135
|
+
label={
|
|
136
|
+
postType?.labels.singular_name
|
|
137
|
+
? sprintf(
|
|
138
|
+
// translators: %s: Name of the post type e.g: "post".
|
|
139
|
+
__( 'Link to %s' ),
|
|
140
|
+
postType.labels.singular_name.toLowerCase()
|
|
141
|
+
)
|
|
142
|
+
: __( 'Link to post' )
|
|
143
|
+
}
|
|
132
144
|
onChange={ () => setAttributes( { isLink: ! isLink } ) }
|
|
133
145
|
checked={ isLink }
|
|
134
146
|
/>
|