@wordpress/block-library 8.28.5 → 8.30.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 +4 -0
- package/build/audio/edit.js +7 -17
- package/build/audio/edit.js.map +1 -1
- package/build/audio/edit.native.js.map +1 -1
- package/build/avatar/edit.js.map +1 -1
- package/build/button/edit.js +1 -1
- package/build/button/edit.js.map +1 -1
- package/build/buttons/edit.js +1 -6
- package/build/buttons/edit.js.map +1 -1
- package/build/buttons/edit.native.js +1 -7
- package/build/buttons/edit.native.js.map +1 -1
- package/build/columns/edit.js +8 -2
- package/build/columns/edit.js.map +1 -1
- package/build/comment-author-avatar/edit.js +1 -1
- package/build/comment-author-avatar/edit.js.map +1 -1
- package/build/cover/edit/index.js.map +1 -1
- package/build/cover/edit/inspector-controls.js.map +1 -1
- package/build/cover/edit/resizable-cover-popover.js +0 -6
- package/build/cover/edit/resizable-cover-popover.js.map +1 -1
- package/build/cover/edit.native.js.map +1 -1
- package/build/details/index.js +1 -0
- package/build/details/index.js.map +1 -1
- package/build/file/deprecated.js.map +1 -1
- package/build/file/edit.js +6 -13
- package/build/file/edit.js.map +1 -1
- package/build/file/edit.native.js.map +1 -1
- package/build/file/save.js.map +1 -1
- package/build/form-input/edit.js +1 -1
- package/build/form-input/edit.js.map +1 -1
- package/build/gallery/edit.js +5 -5
- package/build/gallery/edit.js.map +1 -1
- package/build/gallery/gallery.native.js.map +1 -1
- package/build/gallery/v1/edit.js.map +1 -1
- package/build/gallery/v1/gallery.native.js.map +1 -1
- package/build/group/variations.js +12 -15
- package/build/group/variations.js.map +1 -1
- package/build/image/edit.js.map +1 -1
- package/build/image/edit.native.js.map +1 -1
- package/build/image/image.js.map +1 -1
- package/build/latest-posts/edit.native.js.map +1 -1
- package/build/list/edit.js +5 -0
- package/build/list/edit.js.map +1 -1
- package/build/list/ordered-list-settings.js +1 -1
- package/build/list/ordered-list-settings.js.map +1 -1
- package/build/list-item/edit.native.js.map +1 -1
- package/build/list-item/hooks/use-indent-list-item.js +1 -0
- package/build/list-item/hooks/use-indent-list-item.js.map +1 -1
- package/build/list-item/hooks/use-outdent-list-item.js +1 -0
- package/build/list-item/hooks/use-outdent-list-item.js.map +1 -1
- package/build/list-item/hooks/use-space.js +16 -7
- package/build/list-item/hooks/use-space.js.map +1 -1
- package/build/media-text/media-container.native.js +1 -1
- package/build/media-text/media-container.native.js.map +1 -1
- package/build/navigation/edit/index.js.map +1 -1
- package/build/navigation-link/link-ui.js.map +1 -1
- package/build/paragraph/edit.native.js.map +1 -1
- package/build/pattern/edit.js +23 -9
- package/build/pattern/edit.js.map +1 -1
- package/build/post-excerpt/edit.js.map +1 -1
- package/build/post-featured-image/dimension-controls.js.map +1 -1
- package/build/post-featured-image/edit.js.map +1 -1
- package/build/post-navigation-link/edit.js.map +1 -1
- package/build/query/edit/pattern-selection-modal.js.map +1 -1
- package/build/query/utils.js +7 -5
- package/build/query/utils.js.map +1 -1
- package/build/query-pagination-next/edit.js.map +1 -1
- package/build/query-pagination-previous/edit.js.map +1 -1
- package/build/quote/deprecated.js +111 -12
- package/build/quote/deprecated.js.map +1 -1
- package/build/quote/edit.js +5 -5
- package/build/quote/edit.js.map +1 -1
- package/build/quote/index.js +1 -1
- package/build/quote/index.js.map +1 -1
- package/build/quote/save.js +2 -2
- package/build/quote/save.js.map +1 -1
- package/build/read-more/edit.js.map +1 -1
- package/build/search/edit.js +1 -1
- package/build/search/edit.js.map +1 -1
- package/build/search/edit.native.js.map +1 -1
- package/build/site-logo/edit.js.map +1 -1
- package/build/site-title/{edit/index.js → edit.js} +1 -1
- package/build/site-title/edit.js.map +1 -0
- package/build/social-link/edit.js.map +1 -1
- package/build/social-links/edit.native.js.map +1 -1
- package/build/spacer/edit.js.map +1 -1
- package/build/table-of-contents/edit.js.map +1 -1
- package/build/template-part/edit/index.js +53 -1
- package/build/template-part/edit/index.js.map +1 -1
- package/build/template-part/edit/selection-modal.js +2 -8
- package/build/template-part/edit/selection-modal.js.map +1 -1
- package/build/template-part/edit/utils/map-template-part-to-block-pattern.js +30 -0
- package/build/template-part/edit/utils/map-template-part-to-block-pattern.js.map +1 -0
- package/build/utils/hooks.js +55 -4
- package/build/utils/hooks.js.map +1 -1
- package/build/video/edit-common-settings.js.map +1 -1
- package/build/video/edit.js +7 -16
- package/build/video/edit.js.map +1 -1
- package/build/video/edit.native.js +2 -7
- package/build/video/edit.native.js.map +1 -1
- package/build-module/audio/edit.js +10 -20
- package/build-module/audio/edit.js.map +1 -1
- package/build-module/audio/edit.native.js.map +1 -1
- package/build-module/avatar/edit.js.map +1 -1
- package/build-module/button/edit.js +1 -1
- package/build-module/button/edit.js.map +1 -1
- package/build-module/buttons/edit.js +2 -7
- package/build-module/buttons/edit.js.map +1 -1
- package/build-module/buttons/edit.native.js +1 -7
- package/build-module/buttons/edit.native.js.map +1 -1
- package/build-module/columns/edit.js +8 -2
- package/build-module/columns/edit.js.map +1 -1
- package/build-module/comment-author-avatar/edit.js +1 -1
- package/build-module/comment-author-avatar/edit.js.map +1 -1
- package/build-module/cover/edit/index.js.map +1 -1
- package/build-module/cover/edit/inspector-controls.js.map +1 -1
- package/build-module/cover/edit/resizable-cover-popover.js +1 -7
- package/build-module/cover/edit/resizable-cover-popover.js.map +1 -1
- package/build-module/cover/edit.native.js.map +1 -1
- package/build-module/details/index.js +1 -0
- package/build-module/details/index.js.map +1 -1
- package/build-module/file/deprecated.js.map +1 -1
- package/build-module/file/edit.js +7 -14
- package/build-module/file/edit.js.map +1 -1
- package/build-module/file/edit.native.js.map +1 -1
- package/build-module/file/save.js.map +1 -1
- package/build-module/form-input/edit.js +1 -1
- package/build-module/form-input/edit.js.map +1 -1
- package/build-module/gallery/edit.js +5 -5
- package/build-module/gallery/edit.js.map +1 -1
- package/build-module/gallery/gallery.native.js.map +1 -1
- package/build-module/gallery/v1/edit.js.map +1 -1
- package/build-module/gallery/v1/gallery.native.js.map +1 -1
- package/build-module/group/variations.js +12 -15
- package/build-module/group/variations.js.map +1 -1
- package/build-module/image/edit.js.map +1 -1
- package/build-module/image/edit.native.js.map +1 -1
- package/build-module/image/image.js.map +1 -1
- package/build-module/latest-posts/edit.native.js.map +1 -1
- package/build-module/list/edit.js +5 -0
- package/build-module/list/edit.js.map +1 -1
- package/build-module/list/ordered-list-settings.js +1 -1
- package/build-module/list/ordered-list-settings.js.map +1 -1
- package/build-module/list-item/edit.native.js.map +1 -1
- package/build-module/list-item/hooks/use-indent-list-item.js +1 -0
- package/build-module/list-item/hooks/use-indent-list-item.js.map +1 -1
- package/build-module/list-item/hooks/use-outdent-list-item.js +1 -0
- package/build-module/list-item/hooks/use-outdent-list-item.js.map +1 -1
- package/build-module/list-item/hooks/use-space.js +17 -8
- package/build-module/list-item/hooks/use-space.js.map +1 -1
- package/build-module/media-text/media-container.native.js +1 -1
- package/build-module/media-text/media-container.native.js.map +1 -1
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/navigation-link/link-ui.js.map +1 -1
- package/build-module/paragraph/edit.native.js.map +1 -1
- package/build-module/pattern/edit.js +24 -10
- package/build-module/pattern/edit.js.map +1 -1
- package/build-module/post-excerpt/edit.js.map +1 -1
- package/build-module/post-featured-image/dimension-controls.js.map +1 -1
- package/build-module/post-featured-image/edit.js.map +1 -1
- package/build-module/post-navigation-link/edit.js.map +1 -1
- package/build-module/query/edit/pattern-selection-modal.js.map +1 -1
- package/build-module/query/utils.js +7 -5
- package/build-module/query/utils.js.map +1 -1
- package/build-module/query-pagination-next/edit.js.map +1 -1
- package/build-module/query-pagination-previous/edit.js.map +1 -1
- package/build-module/quote/deprecated.js +112 -13
- package/build-module/quote/deprecated.js.map +1 -1
- package/build-module/quote/edit.js +5 -5
- package/build-module/quote/edit.js.map +1 -1
- package/build-module/quote/index.js +1 -1
- package/build-module/quote/index.js.map +1 -1
- package/build-module/quote/save.js +2 -2
- package/build-module/quote/save.js.map +1 -1
- package/build-module/read-more/edit.js.map +1 -1
- package/build-module/search/edit.js +1 -1
- package/build-module/search/edit.js.map +1 -1
- package/build-module/search/edit.native.js.map +1 -1
- package/build-module/site-logo/edit.js.map +1 -1
- package/build-module/site-title/{edit/index.js → edit.js} +1 -1
- package/build-module/site-title/edit.js.map +1 -0
- package/build-module/social-link/edit.js.map +1 -1
- package/build-module/social-links/edit.native.js.map +1 -1
- package/build-module/spacer/edit.js.map +1 -1
- package/build-module/table-of-contents/edit.js.map +1 -1
- package/build-module/template-part/edit/index.js +57 -5
- package/build-module/template-part/edit/index.js.map +1 -1
- package/build-module/template-part/edit/selection-modal.js +2 -8
- package/build-module/template-part/edit/selection-modal.js.map +1 -1
- package/build-module/template-part/edit/utils/map-template-part-to-block-pattern.js +24 -0
- package/build-module/template-part/edit/utils/map-template-part-to-block-pattern.js.map +1 -0
- package/build-module/utils/hooks.js +54 -3
- package/build-module/utils/hooks.js.map +1 -1
- package/build-module/video/edit-common-settings.js.map +1 -1
- package/build-module/video/edit.js +10 -19
- package/build-module/video/edit.js.map +1 -1
- package/build-module/video/edit.native.js +2 -7
- package/build-module/video/edit.native.js.map +1 -1
- package/build-style/editor-rtl.css +4 -1
- package/build-style/editor.css +4 -1
- package/build-style/group/editor-rtl.css +1 -1
- package/build-style/group/editor.css +1 -1
- package/build-style/image/editor-rtl.css +3 -0
- package/build-style/image/editor.css +3 -0
- package/package.json +34 -34
- package/src/audio/edit.js +9 -19
- package/src/audio/edit.native.js +3 -3
- package/src/avatar/edit.js +1 -1
- package/src/avatar/index.php +12 -1
- package/src/block/index.php +2 -0
- package/src/button/edit.js +2 -2
- package/src/buttons/edit.js +3 -16
- package/src/buttons/edit.native.js +2 -18
- package/src/calendar/index.php +5 -0
- package/src/columns/edit.js +9 -2
- package/src/comment-author-avatar/edit.js +1 -1
- package/src/comments/index.php +2 -0
- package/src/cover/edit/index.js +2 -2
- package/src/cover/edit/inspector-controls.js +1 -1
- package/src/cover/edit/resizable-cover-popover.js +1 -6
- package/src/cover/edit.native.js +1 -1
- package/src/details/block.json +1 -0
- package/src/file/deprecated.js +3 -3
- package/src/file/edit.js +8 -15
- package/src/file/edit.native.js +4 -4
- package/src/file/save.js +1 -1
- package/src/form-input/edit.js +1 -1
- package/src/gallery/edit.js +6 -12
- package/src/gallery/gallery.native.js +1 -1
- package/src/gallery/test/index.native.js +1 -1
- package/src/gallery/v1/edit.js +2 -2
- package/src/gallery/v1/gallery.native.js +1 -1
- package/src/group/editor.scss +1 -1
- package/src/group/variations.js +3 -6
- package/src/image/edit.js +1 -1
- package/src/image/edit.native.js +1 -1
- package/src/image/editor.scss +6 -0
- package/src/image/image.js +2 -2
- package/src/latest-posts/edit.native.js +1 -1
- package/src/list/edit.js +5 -0
- package/src/list/ordered-list-settings.js +1 -1
- package/src/list-item/edit.native.js +1 -1
- package/src/list-item/hooks/use-indent-list-item.js +2 -0
- package/src/list-item/hooks/use-outdent-list-item.js +2 -0
- package/src/list-item/hooks/use-space.js +16 -9
- package/src/media-text/media-container.native.js +5 -3
- package/src/media-text/test/edit.native.js +58 -0
- package/src/missing/test/edit-integration.native.js +2 -1
- package/src/navigation/edit/index.js +1 -1
- package/src/navigation/edit/test/navigation-menu-selector.js +3 -3
- package/src/navigation/index.php +18 -13
- package/src/navigation-link/link-ui.js +2 -2
- package/src/paragraph/edit.native.js +1 -1
- package/src/paragraph/test/edit.native.js +36 -0
- package/src/pattern/edit.js +27 -10
- package/src/post-author-biography/index.php +4 -3
- package/src/post-author-name/index.php +4 -3
- package/src/post-excerpt/edit.js +1 -1
- package/src/post-featured-image/dimension-controls.js +4 -4
- package/src/post-featured-image/edit.js +1 -1
- package/src/post-navigation-link/edit.js +1 -1
- package/src/post-template/index.php +2 -0
- package/src/query/edit/pattern-selection-modal.js +1 -1
- package/src/query/utils.js +6 -4
- package/src/query-pagination-next/edit.js +1 -1
- package/src/query-pagination-previous/edit.js +1 -1
- package/src/quote/block.json +1 -1
- package/src/quote/deprecated.js +110 -15
- package/src/quote/edit.js +5 -5
- package/src/quote/save.js +2 -2
- package/src/quote/test/__snapshots__/transforms.native.js.snap +2 -2
- package/src/read-more/edit.js +1 -1
- package/src/search/edit.js +1 -1
- package/src/search/edit.native.js +4 -4
- package/src/site-logo/edit.js +1 -1
- package/src/social-link/edit.js +1 -1
- package/src/social-links/edit.native.js +1 -1
- package/src/spacer/edit.js +1 -1
- package/src/table-of-contents/edit.js +1 -1
- package/src/template-part/edit/index.js +91 -4
- package/src/template-part/edit/selection-modal.js +4 -8
- package/src/template-part/edit/utils/map-template-part-to-block-pattern.js +23 -0
- package/src/utils/hooks.js +53 -3
- package/src/video/edit-common-settings.js +1 -1
- package/src/video/edit.js +10 -18
- package/src/video/edit.native.js +5 -8
- package/src/video/test/edit.native.js +0 -14
- package/build/site-title/edit/index.js.map +0 -1
- package/build-module/site-title/edit/index.js.map +0 -1
- /package/src/site-title/{edit/index.js → edit.js} +0 -0
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
initializeEditor,
|
|
13
13
|
render,
|
|
14
14
|
setupCoreBlocks,
|
|
15
|
+
triggerBlockListLayout,
|
|
15
16
|
waitFor,
|
|
16
17
|
within,
|
|
17
18
|
withFakeTimers,
|
|
@@ -213,6 +214,41 @@ describe( 'Paragraph block', () => {
|
|
|
213
214
|
` );
|
|
214
215
|
} );
|
|
215
216
|
|
|
217
|
+
it( 'should inherit parent alignment', async () => {
|
|
218
|
+
// Arrange
|
|
219
|
+
const screen = await initializeEditor();
|
|
220
|
+
await addBlock( screen, 'Quote' );
|
|
221
|
+
await triggerBlockListLayout( getBlock( screen, 'Quote' ) );
|
|
222
|
+
|
|
223
|
+
// Act
|
|
224
|
+
const paragraphBlock = getBlock( screen, 'Paragraph' );
|
|
225
|
+
fireEvent.press( paragraphBlock );
|
|
226
|
+
const paragraphTextInput =
|
|
227
|
+
within( paragraphBlock ).getByPlaceholderText( 'Start writing…' );
|
|
228
|
+
typeInRichText(
|
|
229
|
+
paragraphTextInput,
|
|
230
|
+
'A quick brown fox jumps over the lazy dog.'
|
|
231
|
+
);
|
|
232
|
+
fireEvent.press( screen.getByLabelText( 'Navigate Up' ) );
|
|
233
|
+
fireEvent.press( screen.getByLabelText( 'Align text' ) );
|
|
234
|
+
fireEvent.press( screen.getByLabelText( 'Align text right' ) );
|
|
235
|
+
|
|
236
|
+
// Assert
|
|
237
|
+
// This not an ideal assertion, as it relies implementation details of the
|
|
238
|
+
// component: prop names. However, the only aspect we can assert is the prop
|
|
239
|
+
// passed to Aztec, the native module controlling visual alignment. A less
|
|
240
|
+
// brittle alternative might be snapshotting, but RNTL does not yet support
|
|
241
|
+
// focused snapshots, which means the snapshot would be huge.
|
|
242
|
+
// https://github.com/facebook/react/pull/25329
|
|
243
|
+
expect(
|
|
244
|
+
screen.UNSAFE_queryAllByProps( {
|
|
245
|
+
value: '<p>A quick brown fox jumps over the lazy dog.</p>',
|
|
246
|
+
placeholder: 'Start writing…',
|
|
247
|
+
textAlign: 'right',
|
|
248
|
+
} ).length
|
|
249
|
+
).toBe( 2 ); // One for Aztec mock, one for the TextInput.
|
|
250
|
+
} );
|
|
251
|
+
|
|
216
252
|
it( 'should preserve alignment when split', async () => {
|
|
217
253
|
// Arrange
|
|
218
254
|
const screen = await initializeEditor();
|
package/src/pattern/edit.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { cloneBlock } from '@wordpress/blocks';
|
|
5
|
-
import { useSelect, useDispatch } from '@wordpress/data';
|
|
5
|
+
import { useSelect, useDispatch, useRegistry } from '@wordpress/data';
|
|
6
6
|
import { useState, useEffect } from '@wordpress/element';
|
|
7
7
|
import {
|
|
8
8
|
Warning,
|
|
@@ -18,6 +18,7 @@ import { __, sprintf } from '@wordpress/i18n';
|
|
|
18
18
|
import { useParsePatternDependencies } from './recursion-detector';
|
|
19
19
|
|
|
20
20
|
const PatternEdit = ( { attributes, clientId } ) => {
|
|
21
|
+
const registry = useRegistry();
|
|
21
22
|
const selectedPattern = useSelect(
|
|
22
23
|
( select ) =>
|
|
23
24
|
select( blockEditorStore ).__experimentalGetParsedPattern(
|
|
@@ -96,16 +97,32 @@ const PatternEdit = ( { attributes, clientId } ) => {
|
|
|
96
97
|
injectThemeAttributeInBlockTemplateContent( block )
|
|
97
98
|
)
|
|
98
99
|
);
|
|
100
|
+
// If the pattern has a single block and categories, we should add the
|
|
101
|
+
// categories of the pattern to the block's metadata.
|
|
102
|
+
if (
|
|
103
|
+
clonedBlocks.length === 1 &&
|
|
104
|
+
selectedPattern.categories?.length > 0
|
|
105
|
+
) {
|
|
106
|
+
clonedBlocks[ 0 ].attributes = {
|
|
107
|
+
...clonedBlocks[ 0 ].attributes,
|
|
108
|
+
metadata: {
|
|
109
|
+
...clonedBlocks[ 0 ].attributes.metadata,
|
|
110
|
+
categories: selectedPattern.categories,
|
|
111
|
+
},
|
|
112
|
+
};
|
|
113
|
+
}
|
|
99
114
|
const rootEditingMode = getBlockEditingMode( rootClientId );
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
115
|
+
registry.batch( () => {
|
|
116
|
+
// Temporarily set the root block to default mode to allow replacing the pattern.
|
|
117
|
+
// This could happen when the page is disabling edits of non-content blocks.
|
|
118
|
+
__unstableMarkNextChangeAsNotPersistent();
|
|
119
|
+
setBlockEditingMode( rootClientId, 'default' );
|
|
120
|
+
__unstableMarkNextChangeAsNotPersistent();
|
|
121
|
+
replaceBlocks( clientId, clonedBlocks );
|
|
122
|
+
// Restore the root block's original mode.
|
|
123
|
+
__unstableMarkNextChangeAsNotPersistent();
|
|
124
|
+
setBlockEditingMode( rootClientId, rootEditingMode );
|
|
125
|
+
} );
|
|
109
126
|
} );
|
|
110
127
|
}
|
|
111
128
|
}, [
|
|
@@ -14,11 +14,12 @@
|
|
|
14
14
|
* @return string Returns the rendered post author biography block.
|
|
15
15
|
*/
|
|
16
16
|
function render_block_core_post_author_biography( $attributes, $content, $block ) {
|
|
17
|
-
if (
|
|
18
|
-
|
|
17
|
+
if ( isset( $block->context['postId'] ) ) {
|
|
18
|
+
$author_id = get_post_field( 'post_author', $block->context['postId'] );
|
|
19
|
+
} else {
|
|
20
|
+
$author_id = get_query_var( 'author' );
|
|
19
21
|
}
|
|
20
22
|
|
|
21
|
-
$author_id = get_post_field( 'post_author', $block->context['postId'] );
|
|
22
23
|
if ( empty( $author_id ) ) {
|
|
23
24
|
return '';
|
|
24
25
|
}
|
|
@@ -14,11 +14,12 @@
|
|
|
14
14
|
* @return string Returns the rendered post author name block.
|
|
15
15
|
*/
|
|
16
16
|
function render_block_core_post_author_name( $attributes, $content, $block ) {
|
|
17
|
-
if (
|
|
18
|
-
|
|
17
|
+
if ( isset( $block->context['postId'] ) ) {
|
|
18
|
+
$author_id = get_post_field( 'post_author', $block->context['postId'] );
|
|
19
|
+
} else {
|
|
20
|
+
$author_id = get_query_var( 'author' );
|
|
19
21
|
}
|
|
20
22
|
|
|
21
|
-
$author_id = get_post_field( 'post_author', $block->context['postId'] );
|
|
22
23
|
if ( empty( $author_id ) ) {
|
|
23
24
|
return '';
|
|
24
25
|
}
|
package/src/post-excerpt/edit.js
CHANGED
|
@@ -135,7 +135,7 @@ export default function PostExcerptEditor( {
|
|
|
135
135
|
onChange={ ( newMoreText ) =>
|
|
136
136
|
setAttributes( { moreText: newMoreText } )
|
|
137
137
|
}
|
|
138
|
-
withoutInteractiveFormatting
|
|
138
|
+
withoutInteractiveFormatting
|
|
139
139
|
/>
|
|
140
140
|
);
|
|
141
141
|
const excerptClassName = classnames( 'wp-block-post-excerpt__excerpt', {
|
|
@@ -83,7 +83,7 @@ const DimensionControls = ( {
|
|
|
83
83
|
resetAllFilter={ () => ( {
|
|
84
84
|
aspectRatio: undefined,
|
|
85
85
|
} ) }
|
|
86
|
-
isShownByDefault
|
|
86
|
+
isShownByDefault
|
|
87
87
|
panelId={ clientId }
|
|
88
88
|
>
|
|
89
89
|
<SelectControl
|
|
@@ -138,7 +138,7 @@ const DimensionControls = ( {
|
|
|
138
138
|
resetAllFilter={ () => ( {
|
|
139
139
|
height: undefined,
|
|
140
140
|
} ) }
|
|
141
|
-
isShownByDefault
|
|
141
|
+
isShownByDefault
|
|
142
142
|
panelId={ clientId }
|
|
143
143
|
>
|
|
144
144
|
<UnitControl
|
|
@@ -160,7 +160,7 @@ const DimensionControls = ( {
|
|
|
160
160
|
resetAllFilter={ () => ( {
|
|
161
161
|
width: undefined,
|
|
162
162
|
} ) }
|
|
163
|
-
isShownByDefault
|
|
163
|
+
isShownByDefault
|
|
164
164
|
panelId={ clientId }
|
|
165
165
|
>
|
|
166
166
|
<UnitControl
|
|
@@ -186,7 +186,7 @@ const DimensionControls = ( {
|
|
|
186
186
|
resetAllFilter={ () => ( {
|
|
187
187
|
scale: DEFAULT_SCALE,
|
|
188
188
|
} ) }
|
|
189
|
-
isShownByDefault
|
|
189
|
+
isShownByDefault
|
|
190
190
|
panelId={ clientId }
|
|
191
191
|
>
|
|
192
192
|
<ToggleGroupControl
|
|
@@ -153,7 +153,7 @@ export default function PostFeaturedImageEdit( {
|
|
|
153
153
|
'block-editor-media-placeholder',
|
|
154
154
|
borderProps.className
|
|
155
155
|
) }
|
|
156
|
-
withIllustration
|
|
156
|
+
withIllustration
|
|
157
157
|
style={ {
|
|
158
158
|
height: !! aspectRatio && '100%',
|
|
159
159
|
width: !! aspectRatio && '100%',
|
|
@@ -207,7 +207,7 @@ export default function PostNavigationLinkEdit( {
|
|
|
207
207
|
{ isNext && displayArrow && (
|
|
208
208
|
<span
|
|
209
209
|
className={ `wp-block-post-navigation-link__arrow-next is-arrow-${ arrow }` }
|
|
210
|
-
aria-hidden
|
|
210
|
+
aria-hidden
|
|
211
211
|
>
|
|
212
212
|
{ displayArrow }
|
|
213
213
|
</span>
|
|
@@ -36,6 +36,8 @@ function block_core_post_template_uses_featured_image( $inner_blocks ) {
|
|
|
36
36
|
*
|
|
37
37
|
* @since 6.3.0 Changed render_block_context priority to `1`.
|
|
38
38
|
*
|
|
39
|
+
* @global WP_Query $wp_query WordPress Query object.
|
|
40
|
+
*
|
|
39
41
|
* @param array $attributes Block attributes.
|
|
40
42
|
* @param string $content Block default content.
|
|
41
43
|
* @param WP_Block $block Block instance.
|
|
@@ -62,7 +62,7 @@ export default function PatternSelectionModal( {
|
|
|
62
62
|
overlayClassName="block-library-query-pattern__selection-modal"
|
|
63
63
|
title={ __( 'Choose a pattern' ) }
|
|
64
64
|
onRequestClose={ () => setIsPatternSelectionModalOpen( false ) }
|
|
65
|
-
isFullScreen
|
|
65
|
+
isFullScreen
|
|
66
66
|
>
|
|
67
67
|
<div className="block-library-query-pattern__selection-content">
|
|
68
68
|
<div className="block-library-query-pattern__selection-search">
|
package/src/query/utils.js
CHANGED
|
@@ -131,16 +131,18 @@ export const useTaxonomies = ( postType ) => {
|
|
|
131
131
|
const taxonomies = useSelect(
|
|
132
132
|
( select ) => {
|
|
133
133
|
const { getTaxonomies } = select( coreStore );
|
|
134
|
-
|
|
134
|
+
return getTaxonomies( {
|
|
135
135
|
type: postType,
|
|
136
136
|
per_page: -1,
|
|
137
|
-
context: 'view',
|
|
138
137
|
} );
|
|
139
|
-
return filteredTaxonomies;
|
|
140
138
|
},
|
|
141
139
|
[ postType ]
|
|
142
140
|
);
|
|
143
|
-
return
|
|
141
|
+
return useMemo( () => {
|
|
142
|
+
return taxonomies?.filter(
|
|
143
|
+
( { visibility } ) => !! visibility?.publicly_queryable
|
|
144
|
+
);
|
|
145
|
+
}, [ taxonomies ] );
|
|
144
146
|
};
|
|
145
147
|
|
|
146
148
|
/**
|
package/src/quote/block.json
CHANGED
package/src/quote/deprecated.js
CHANGED
|
@@ -7,7 +7,7 @@ import classnames from 'classnames';
|
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
9
|
import { createBlock, parseWithAttributeSchema } from '@wordpress/blocks';
|
|
10
|
-
import { RichText, useBlockProps } from '@wordpress/block-editor';
|
|
10
|
+
import { InnerBlocks, RichText, useBlockProps } from '@wordpress/block-editor';
|
|
11
11
|
|
|
12
12
|
export const migrateToQuoteV2 = ( attributes ) => {
|
|
13
13
|
const { value, ...restAttributes } = attributes;
|
|
@@ -34,6 +34,102 @@ export const migrateToQuoteV2 = ( attributes ) => {
|
|
|
34
34
|
];
|
|
35
35
|
};
|
|
36
36
|
|
|
37
|
+
const TEXT_ALIGN_OPTIONS = [ 'left', 'right', 'center' ];
|
|
38
|
+
|
|
39
|
+
// Migrate existing text alignment settings to the renamed attribute.
|
|
40
|
+
const migrateTextAlign = ( attributes, innerBlocks ) => {
|
|
41
|
+
const { align, ...rest } = attributes;
|
|
42
|
+
// Check if there are valid alignments stored in the old attribute
|
|
43
|
+
// and assign them to the new attribute name.
|
|
44
|
+
const migratedAttributes = TEXT_ALIGN_OPTIONS.includes( align )
|
|
45
|
+
? { ...rest, textAlign: align }
|
|
46
|
+
: attributes;
|
|
47
|
+
|
|
48
|
+
return [ migratedAttributes, innerBlocks ];
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
// Migrate the v2 blocks with style === `2`;
|
|
52
|
+
const migrateLargeStyle = ( attributes, innerBlocks ) => {
|
|
53
|
+
return [
|
|
54
|
+
{
|
|
55
|
+
...attributes,
|
|
56
|
+
className: attributes.className
|
|
57
|
+
? attributes.className + ' is-style-large'
|
|
58
|
+
: 'is-style-large',
|
|
59
|
+
},
|
|
60
|
+
innerBlocks,
|
|
61
|
+
];
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
// Version before the 'align' attribute was replaced with 'textAlign'.
|
|
65
|
+
const v4 = {
|
|
66
|
+
attributes: {
|
|
67
|
+
value: {
|
|
68
|
+
type: 'string',
|
|
69
|
+
source: 'html',
|
|
70
|
+
selector: 'blockquote',
|
|
71
|
+
multiline: 'p',
|
|
72
|
+
default: '',
|
|
73
|
+
__experimentalRole: 'content',
|
|
74
|
+
},
|
|
75
|
+
citation: {
|
|
76
|
+
type: 'string',
|
|
77
|
+
source: 'html',
|
|
78
|
+
selector: 'cite',
|
|
79
|
+
default: '',
|
|
80
|
+
__experimentalRole: 'content',
|
|
81
|
+
},
|
|
82
|
+
align: {
|
|
83
|
+
type: 'string',
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
supports: {
|
|
87
|
+
anchor: true,
|
|
88
|
+
html: false,
|
|
89
|
+
__experimentalOnEnter: true,
|
|
90
|
+
__experimentalOnMerge: true,
|
|
91
|
+
typography: {
|
|
92
|
+
fontSize: true,
|
|
93
|
+
lineHeight: true,
|
|
94
|
+
__experimentalFontFamily: true,
|
|
95
|
+
__experimentalFontWeight: true,
|
|
96
|
+
__experimentalFontStyle: true,
|
|
97
|
+
__experimentalTextTransform: true,
|
|
98
|
+
__experimentalTextDecoration: true,
|
|
99
|
+
__experimentalLetterSpacing: true,
|
|
100
|
+
__experimentalDefaultControls: {
|
|
101
|
+
fontSize: true,
|
|
102
|
+
fontAppearance: true,
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
color: {
|
|
106
|
+
gradients: true,
|
|
107
|
+
heading: true,
|
|
108
|
+
link: true,
|
|
109
|
+
__experimentalDefaultControls: {
|
|
110
|
+
background: true,
|
|
111
|
+
text: true,
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
isEligible: ( { align } ) => TEXT_ALIGN_OPTIONS.includes( align ),
|
|
116
|
+
save( { attributes } ) {
|
|
117
|
+
const { align, citation } = attributes;
|
|
118
|
+
const className = classnames( {
|
|
119
|
+
[ `has-text-align-${ align }` ]: align,
|
|
120
|
+
} );
|
|
121
|
+
return (
|
|
122
|
+
<blockquote { ...useBlockProps.save( { className } ) }>
|
|
123
|
+
<InnerBlocks.Content />
|
|
124
|
+
{ ! RichText.isEmpty( citation ) && (
|
|
125
|
+
<RichText.Content tagName="cite" value={ citation } />
|
|
126
|
+
) }
|
|
127
|
+
</blockquote>
|
|
128
|
+
);
|
|
129
|
+
},
|
|
130
|
+
migrate: migrateTextAlign,
|
|
131
|
+
};
|
|
132
|
+
|
|
37
133
|
const v3 = {
|
|
38
134
|
attributes: {
|
|
39
135
|
value: {
|
|
@@ -87,7 +183,9 @@ const v3 = {
|
|
|
87
183
|
</blockquote>
|
|
88
184
|
);
|
|
89
185
|
},
|
|
90
|
-
migrate
|
|
186
|
+
migrate( attributes ) {
|
|
187
|
+
return migrateTextAlign( ...migrateToQuoteV2( attributes ) );
|
|
188
|
+
},
|
|
91
189
|
};
|
|
92
190
|
|
|
93
191
|
const v2 = {
|
|
@@ -109,7 +207,9 @@ const v2 = {
|
|
|
109
207
|
type: 'string',
|
|
110
208
|
},
|
|
111
209
|
},
|
|
112
|
-
migrate
|
|
210
|
+
migrate( attributes ) {
|
|
211
|
+
return migrateTextAlign( ...migrateToQuoteV2( attributes ) );
|
|
212
|
+
},
|
|
113
213
|
save( { attributes } ) {
|
|
114
214
|
const { align, value, citation } = attributes;
|
|
115
215
|
|
|
@@ -151,15 +251,12 @@ const v1 = {
|
|
|
151
251
|
migrate( attributes ) {
|
|
152
252
|
if ( attributes.style === 2 ) {
|
|
153
253
|
const { style, ...restAttributes } = attributes;
|
|
154
|
-
return
|
|
155
|
-
...restAttributes
|
|
156
|
-
|
|
157
|
-
? attributes.className + ' is-style-large'
|
|
158
|
-
: 'is-style-large',
|
|
159
|
-
} );
|
|
254
|
+
return migrateTextAlign(
|
|
255
|
+
...migrateLargeStyle( ...migrateToQuoteV2( restAttributes ) )
|
|
256
|
+
);
|
|
160
257
|
}
|
|
161
258
|
|
|
162
|
-
return migrateToQuoteV2( attributes );
|
|
259
|
+
return migrateTextAlign( ...migrateToQuoteV2( attributes ) );
|
|
163
260
|
},
|
|
164
261
|
|
|
165
262
|
save( { attributes } ) {
|
|
@@ -206,12 +303,10 @@ const v0 = {
|
|
|
206
303
|
migrate( attributes ) {
|
|
207
304
|
if ( ! isNaN( parseInt( attributes.style ) ) ) {
|
|
208
305
|
const { style, ...restAttributes } = attributes;
|
|
209
|
-
return migrateToQuoteV2(
|
|
210
|
-
...restAttributes,
|
|
211
|
-
} );
|
|
306
|
+
return migrateTextAlign( ...migrateToQuoteV2( restAttributes ) );
|
|
212
307
|
}
|
|
213
308
|
|
|
214
|
-
return migrateToQuoteV2( attributes );
|
|
309
|
+
return migrateTextAlign( ...migrateToQuoteV2( attributes ) );
|
|
215
310
|
},
|
|
216
311
|
|
|
217
312
|
save( { attributes } ) {
|
|
@@ -239,4 +334,4 @@ const v0 = {
|
|
|
239
334
|
*
|
|
240
335
|
* See block-deprecation.md
|
|
241
336
|
*/
|
|
242
|
-
export default [ v3, v2, v1, v0 ];
|
|
337
|
+
export default [ v4, v3, v2, v1, v0 ];
|
package/src/quote/edit.js
CHANGED
|
@@ -74,7 +74,7 @@ export default function QuoteEdit( {
|
|
|
74
74
|
className,
|
|
75
75
|
style,
|
|
76
76
|
} ) {
|
|
77
|
-
const {
|
|
77
|
+
const { textAlign, citation } = attributes;
|
|
78
78
|
|
|
79
79
|
useMigrateOnLoad( attributes, clientId );
|
|
80
80
|
|
|
@@ -86,7 +86,7 @@ export default function QuoteEdit( {
|
|
|
86
86
|
|
|
87
87
|
const blockProps = useBlockProps( {
|
|
88
88
|
className: classNames( className, {
|
|
89
|
-
[ `has-text-align-${
|
|
89
|
+
[ `has-text-align-${ textAlign }` ]: textAlign,
|
|
90
90
|
} ),
|
|
91
91
|
...( ! isWebPlatform && { style } ),
|
|
92
92
|
} );
|
|
@@ -100,9 +100,9 @@ export default function QuoteEdit( {
|
|
|
100
100
|
<>
|
|
101
101
|
<BlockControls group="block">
|
|
102
102
|
<AlignmentControl
|
|
103
|
-
value={
|
|
103
|
+
value={ textAlign }
|
|
104
104
|
onChange={ ( nextAlign ) => {
|
|
105
|
-
setAttributes( {
|
|
105
|
+
setAttributes( { textAlign: nextAlign } );
|
|
106
106
|
} }
|
|
107
107
|
/>
|
|
108
108
|
</BlockControls>
|
|
@@ -132,7 +132,7 @@ export default function QuoteEdit( {
|
|
|
132
132
|
createBlock( getDefaultBlockName() )
|
|
133
133
|
)
|
|
134
134
|
}
|
|
135
|
-
{ ...( ! isWebPlatform ? { textAlign
|
|
135
|
+
{ ...( ! isWebPlatform ? { textAlign } : {} ) }
|
|
136
136
|
/>
|
|
137
137
|
) }
|
|
138
138
|
</BlockQuotation>
|
package/src/quote/save.js
CHANGED
|
@@ -9,10 +9,10 @@ import classNames from 'classnames';
|
|
|
9
9
|
import { InnerBlocks, RichText, useBlockProps } from '@wordpress/block-editor';
|
|
10
10
|
|
|
11
11
|
export default function save( { attributes } ) {
|
|
12
|
-
const {
|
|
12
|
+
const { textAlign, citation } = attributes;
|
|
13
13
|
|
|
14
14
|
const className = classNames( {
|
|
15
|
-
[ `has-text-align-${
|
|
15
|
+
[ `has-text-align-${ textAlign }` ]: textAlign,
|
|
16
16
|
} );
|
|
17
17
|
|
|
18
18
|
return (
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
exports[`Quote block transforms to Columns block 1`] = `
|
|
4
4
|
"<!-- wp:columns -->
|
|
5
5
|
<div class="wp-block-columns"><!-- wp:column {"width":"100%"} -->
|
|
6
|
-
<div class="wp-block-column" style="flex-basis:100%"><!-- wp:quote {"
|
|
6
|
+
<div class="wp-block-column" style="flex-basis:100%"><!-- wp:quote {"textAlign":"left","className":"is-style-large"} -->
|
|
7
7
|
<blockquote class="wp-block-quote has-text-align-left is-style-large"><!-- wp:paragraph -->
|
|
8
8
|
<p>"This will make running your own blog a viable alternative again."</p>
|
|
9
9
|
<!-- /wp:paragraph --><cite>— <a href="https://twitter.com/azumbrunnen_/status/1019347243084800005">Adrian Zumbrunnen</a></cite></blockquote>
|
|
@@ -14,7 +14,7 @@ exports[`Quote block transforms to Columns block 1`] = `
|
|
|
14
14
|
|
|
15
15
|
exports[`Quote block transforms to Group block 1`] = `
|
|
16
16
|
"<!-- wp:group {"layout":{"type":"constrained"}} -->
|
|
17
|
-
<div class="wp-block-group"><!-- wp:quote {"
|
|
17
|
+
<div class="wp-block-group"><!-- wp:quote {"textAlign":"left","className":"is-style-large"} -->
|
|
18
18
|
<blockquote class="wp-block-quote has-text-align-left is-style-large"><!-- wp:paragraph -->
|
|
19
19
|
<p>"This will make running your own blog a viable alternative again."</p>
|
|
20
20
|
<!-- /wp:paragraph --><cite>— <a href="https://twitter.com/azumbrunnen_/status/1019347243084800005">Adrian Zumbrunnen</a></cite></blockquote>
|
package/src/read-more/edit.js
CHANGED
package/src/search/edit.js
CHANGED
|
@@ -400,7 +400,7 @@ export default function SearchEdit( {
|
|
|
400
400
|
</BlockControls>
|
|
401
401
|
|
|
402
402
|
<InspectorControls>
|
|
403
|
-
<PanelBody title={ __( '
|
|
403
|
+
<PanelBody title={ __( 'Settings' ) }>
|
|
404
404
|
<BaseControl
|
|
405
405
|
label={ __( 'Width' ) }
|
|
406
406
|
id={ unitControlInputId }
|
|
@@ -192,7 +192,7 @@ export default function SearchEdit( {
|
|
|
192
192
|
} );
|
|
193
193
|
} }
|
|
194
194
|
options={ BUTTON_OPTIONS }
|
|
195
|
-
hideCancelButton
|
|
195
|
+
hideCancelButton
|
|
196
196
|
/>
|
|
197
197
|
{ buttonPosition !== 'no-button' && (
|
|
198
198
|
<ToggleControl
|
|
@@ -294,7 +294,7 @@ export default function SearchEdit( {
|
|
|
294
294
|
return (
|
|
295
295
|
<View
|
|
296
296
|
style={ styles.searchInputContainer }
|
|
297
|
-
accessible
|
|
297
|
+
accessible
|
|
298
298
|
accessibilityRole="none"
|
|
299
299
|
accessibilityHint={
|
|
300
300
|
isScreenReaderEnabled
|
|
@@ -383,7 +383,7 @@ export default function SearchEdit( {
|
|
|
383
383
|
|
|
384
384
|
{ ! buttonUseIcon && (
|
|
385
385
|
<View
|
|
386
|
-
accessible
|
|
386
|
+
accessible
|
|
387
387
|
accessibilityRole="none"
|
|
388
388
|
accessibilityHint={
|
|
389
389
|
isScreenReaderEnabled
|
|
@@ -438,7 +438,7 @@ export default function SearchEdit( {
|
|
|
438
438
|
|
|
439
439
|
{ showLabel && (
|
|
440
440
|
<View
|
|
441
|
-
accessible
|
|
441
|
+
accessible
|
|
442
442
|
accessibilityRole="none"
|
|
443
443
|
accessibilityHint={
|
|
444
444
|
isScreenReaderEnabled
|
package/src/site-logo/edit.js
CHANGED
package/src/social-link/edit.js
CHANGED
|
@@ -53,7 +53,7 @@ function SocialLinksEdit( {
|
|
|
53
53
|
|
|
54
54
|
const renderFooterAppender = useRef( () => (
|
|
55
55
|
<View style={ styles.footerAppenderContainer }>
|
|
56
|
-
<InnerBlocks.ButtonBlockAppender isFloating
|
|
56
|
+
<InnerBlocks.ButtonBlockAppender isFloating />
|
|
57
57
|
</View>
|
|
58
58
|
) );
|
|
59
59
|
|
package/src/spacer/edit.js
CHANGED
|
@@ -67,7 +67,7 @@ const ResizableSpacer = ( {
|
|
|
67
67
|
onResizeStop( `${ nextVal }px` );
|
|
68
68
|
setIsResizing( false );
|
|
69
69
|
} }
|
|
70
|
-
__experimentalShowTooltip
|
|
70
|
+
__experimentalShowTooltip
|
|
71
71
|
__experimentalTooltipProps={ {
|
|
72
72
|
axis: orientation === 'horizontal' ? 'x' : 'y',
|
|
73
73
|
position: 'corner',
|