@wordpress/block-library 7.14.1 → 7.15.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/avatar/index.js +1 -1
- package/build/block/edit.native.js +1 -1
- package/build/block/edit.native.js.map +1 -1
- package/build/buttons/edit.native.js +1 -3
- package/build/buttons/edit.native.js.map +1 -1
- package/build/calendar/index.js +9 -0
- package/build/calendar/index.js.map +1 -1
- package/build/code/index.js +1 -1
- package/build/code/index.js.map +1 -1
- package/build/comments/edit/comments-legacy.js +1 -1
- package/build/comments/edit/comments-legacy.js.map +1 -1
- package/build/comments-pagination-next/index.js +1 -1
- package/build/comments-pagination-numbers/index.js +1 -1
- package/build/comments-pagination-previous/index.js +1 -1
- package/build/comments-title/edit.js +1 -1
- package/build/comments-title/edit.js.map +1 -1
- package/build/cover/edit/use-cover-is-dark.js +10 -7
- package/build/cover/edit/use-cover-is-dark.js.map +1 -1
- package/build/cover/index.js +9 -2
- package/build/cover/index.js.map +1 -1
- package/build/embed/deprecated.js +12 -6
- package/build/embed/deprecated.js.map +1 -1
- package/build/embed/index.js +12 -6
- package/build/embed/index.js.map +1 -1
- package/build/embed/transforms.js +12 -6
- package/build/embed/transforms.js.map +1 -1
- package/build/embed/util.js +12 -6
- package/build/embed/util.js.map +1 -1
- package/build/embed/variations.js +1 -1
- package/build/embed/variations.js.map +1 -1
- package/build/freeform/edit.js +5 -8
- package/build/freeform/edit.js.map +1 -1
- package/build/gallery/deprecated.js +4 -4
- package/build/gallery/deprecated.js.map +1 -1
- package/build/list-item/edit.js +2 -1
- package/build/list-item/edit.js.map +1 -1
- package/build/missing/edit.js +9 -2
- package/build/missing/edit.js.map +1 -1
- package/build/more/edit.js +1 -1
- package/build/more/edit.js.map +1 -1
- package/build/navigation/menu-items-to-blocks.js +16 -6
- package/build/navigation/menu-items-to-blocks.js.map +1 -1
- package/build/post-excerpt/edit.js +1 -1
- package/build/post-excerpt/edit.js.map +1 -1
- package/build/post-navigation-link/edit.js +35 -4
- package/build/post-navigation-link/edit.js.map +1 -1
- package/build/post-navigation-link/index.js +6 -1
- package/build/post-navigation-link/index.js.map +1 -1
- package/build/post-template/edit.js +13 -28
- package/build/post-template/edit.js.map +1 -1
- package/build/query/edit/inspector-controls/index.js +4 -8
- package/build/query/edit/inspector-controls/index.js.map +1 -1
- package/build/query/edit/inspector-controls/sticky-control.js +1 -1
- package/build/query/edit/inspector-controls/sticky-control.js.map +1 -1
- package/build/query/edit/query-placeholder.js +2 -2
- package/build/query/edit/query-placeholder.js.map +1 -1
- package/build/query-title/edit.js +1 -1
- package/build/query-title/edit.js.map +1 -1
- package/build/quote/transforms.js +2 -2
- package/build/quote/transforms.js.map +1 -1
- package/build/read-more/edit.js +1 -1
- package/build/read-more/edit.js.map +1 -1
- package/build/site-tagline/index.js +1 -1
- package/build/social-links/edit.native.js +1 -0
- package/build/social-links/edit.native.js.map +1 -1
- package/build/template-part/edit/index.js +2 -2
- package/build/template-part/edit/index.js.map +1 -1
- package/build-module/avatar/index.js +1 -1
- package/build-module/block/edit.native.js +1 -1
- package/build-module/block/edit.native.js.map +1 -1
- package/build-module/buttons/edit.native.js +1 -2
- package/build-module/buttons/edit.native.js.map +1 -1
- package/build-module/calendar/index.js +9 -0
- package/build-module/calendar/index.js.map +1 -1
- package/build-module/code/index.js +1 -1
- package/build-module/code/index.js.map +1 -1
- package/build-module/comments/edit/comments-legacy.js +1 -1
- package/build-module/comments/edit/comments-legacy.js.map +1 -1
- package/build-module/comments-pagination-next/index.js +1 -1
- package/build-module/comments-pagination-numbers/index.js +1 -1
- package/build-module/comments-pagination-previous/index.js +1 -1
- package/build-module/comments-title/edit.js +1 -1
- package/build-module/comments-title/edit.js.map +1 -1
- package/build-module/cover/edit/use-cover-is-dark.js +9 -4
- package/build-module/cover/edit/use-cover-is-dark.js.map +1 -1
- package/build-module/cover/index.js +9 -2
- package/build-module/cover/index.js.map +1 -1
- package/build-module/embed/deprecated.js +12 -6
- package/build-module/embed/deprecated.js.map +1 -1
- package/build-module/embed/index.js +12 -6
- package/build-module/embed/index.js.map +1 -1
- package/build-module/embed/transforms.js +12 -6
- package/build-module/embed/transforms.js.map +1 -1
- package/build-module/embed/util.js +12 -6
- package/build-module/embed/util.js.map +1 -1
- package/build-module/embed/variations.js +1 -1
- package/build-module/embed/variations.js.map +1 -1
- package/build-module/freeform/edit.js +3 -6
- package/build-module/freeform/edit.js.map +1 -1
- package/build-module/gallery/deprecated.js +4 -4
- package/build-module/gallery/deprecated.js.map +1 -1
- package/build-module/list-item/edit.js +2 -1
- package/build-module/list-item/edit.js.map +1 -1
- package/build-module/missing/edit.js +11 -4
- package/build-module/missing/edit.js.map +1 -1
- package/build-module/more/edit.js +1 -1
- package/build-module/more/edit.js.map +1 -1
- package/build-module/navigation/menu-items-to-blocks.js +16 -6
- package/build-module/navigation/menu-items-to-blocks.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-navigation-link/edit.js +37 -6
- package/build-module/post-navigation-link/edit.js.map +1 -1
- package/build-module/post-navigation-link/index.js +6 -1
- package/build-module/post-navigation-link/index.js.map +1 -1
- package/build-module/post-template/edit.js +14 -29
- package/build-module/post-template/edit.js.map +1 -1
- package/build-module/query/edit/inspector-controls/index.js +2 -6
- package/build-module/query/edit/inspector-controls/index.js.map +1 -1
- package/build-module/query/edit/inspector-controls/sticky-control.js +1 -1
- package/build-module/query/edit/inspector-controls/sticky-control.js.map +1 -1
- package/build-module/query/edit/query-placeholder.js +2 -2
- package/build-module/query/edit/query-placeholder.js.map +1 -1
- package/build-module/query-title/edit.js +1 -1
- package/build-module/query-title/edit.js.map +1 -1
- package/build-module/quote/transforms.js +2 -2
- package/build-module/quote/transforms.js.map +1 -1
- package/build-module/read-more/edit.js +1 -1
- package/build-module/read-more/edit.js.map +1 -1
- package/build-module/site-tagline/index.js +1 -1
- package/build-module/social-links/edit.native.js +1 -0
- package/build-module/social-links/edit.native.js.map +1 -1
- package/build-module/template-part/edit/index.js +3 -3
- package/build-module/template-part/edit/index.js.map +1 -1
- package/build-style/calendar/style-rtl.css +21 -12
- package/build-style/calendar/style.css +21 -12
- package/build-style/post-navigation-link/style-rtl.css +90 -0
- package/build-style/post-navigation-link/style.css +90 -0
- package/build-style/style-rtl.css +36 -12
- package/build-style/style.css +36 -12
- package/package.json +29 -29
- package/src/avatar/block.json +1 -1
- package/src/block/edit.native.js +1 -1
- package/src/buttons/edit.native.js +1 -2
- package/src/buttons/test/__snapshots__/edit.native.js.snap +28 -0
- package/src/buttons/test/edit.native.js +170 -0
- package/src/calendar/block.json +9 -0
- package/src/calendar/index.php +22 -1
- package/src/calendar/style.scss +28 -15
- package/src/code/index.js +1 -1
- package/src/columns/test/__snapshots__/edit.native.js.snap +219 -0
- package/src/columns/test/edit.native.js +432 -0
- package/src/comments/edit/comments-legacy.js +1 -1
- package/src/comments-pagination-next/block.json +1 -1
- package/src/comments-pagination-numbers/block.json +1 -1
- package/src/comments-pagination-previous/block.json +1 -1
- package/src/comments-title/edit.js +1 -1
- package/src/cover/edit/use-cover-is-dark.js +11 -7
- package/src/cover/index.js +8 -1
- package/src/cover/test/__snapshots__/edit.native.js.snap +64 -0
- package/src/cover/test/edit.native.js +136 -4
- package/src/embed/block.json +12 -6
- package/src/embed/test/index.native.js +1 -2
- package/src/embed/variations.js +1 -1
- package/src/freeform/edit.js +12 -10
- package/src/gallery/deprecated.js +4 -4
- package/src/group/test/__snapshots__/edit.native.js.snap +19 -0
- package/src/group/test/edit.native.js +102 -0
- package/src/list-item/edit.js +1 -0
- package/src/missing/edit.js +15 -4
- package/src/more/edit.js +1 -1
- package/src/navigation/menu-items-to-blocks.js +39 -22
- package/src/navigation/test/menu-items-to-blocks.js +6 -0
- package/src/post-excerpt/edit.js +1 -1
- package/src/post-featured-image/index.php +11 -18
- package/src/post-navigation-link/block.json +6 -1
- package/src/post-navigation-link/edit.js +64 -3
- package/src/post-navigation-link/index.php +23 -0
- package/src/post-navigation-link/style.scss +23 -0
- package/src/post-template/edit.js +14 -23
- package/src/query/edit/inspector-controls/index.js +2 -6
- package/src/query/edit/inspector-controls/sticky-control.js +1 -1
- package/src/query/edit/query-placeholder.js +4 -1
- package/src/query-title/edit.js +1 -1
- package/src/quote/transforms.js +1 -1
- package/src/read-more/edit.js +1 -1
- package/src/site-tagline/block.json +1 -1
- package/src/social-links/edit.native.js +7 -1
- package/src/social-links/test/__snapshots__/edit.native.js.snap +57 -0
- package/src/social-links/test/edit.native.js +199 -0
- package/src/style.scss +1 -0
- package/src/template-part/edit/index.js +60 -58
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import {
|
|
5
|
+
addBlock,
|
|
6
|
+
fireEvent,
|
|
7
|
+
getEditorHtml,
|
|
8
|
+
initializeEditor,
|
|
9
|
+
within,
|
|
10
|
+
getBlock,
|
|
11
|
+
waitFor,
|
|
12
|
+
} from 'test/helpers';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* WordPress dependencies
|
|
16
|
+
*/
|
|
17
|
+
import { getBlockTypes, unregisterBlockType } from '@wordpress/blocks';
|
|
18
|
+
import { registerCoreBlocks } from '@wordpress/block-library';
|
|
19
|
+
|
|
20
|
+
beforeAll( () => {
|
|
21
|
+
// Register all core blocks
|
|
22
|
+
registerCoreBlocks();
|
|
23
|
+
} );
|
|
24
|
+
|
|
25
|
+
afterAll( () => {
|
|
26
|
+
// Clean up registered blocks
|
|
27
|
+
getBlockTypes().forEach( ( block ) => {
|
|
28
|
+
unregisterBlockType( block.name );
|
|
29
|
+
} );
|
|
30
|
+
} );
|
|
31
|
+
|
|
32
|
+
describe( 'Social links block', () => {
|
|
33
|
+
it( 'inserts block with the default icons and the WordPress link set as active', async () => {
|
|
34
|
+
const screen = await initializeEditor();
|
|
35
|
+
|
|
36
|
+
// Add block
|
|
37
|
+
await addBlock( screen, 'Social Icons' );
|
|
38
|
+
|
|
39
|
+
// Get block
|
|
40
|
+
const socialLinksBlock = await getBlock( screen, 'Social Icons' );
|
|
41
|
+
|
|
42
|
+
// Trigger inner blocks layout
|
|
43
|
+
const innerBlockListWrapper = await waitFor( () =>
|
|
44
|
+
within( socialLinksBlock ).getByTestId( 'block-list-wrapper' )
|
|
45
|
+
);
|
|
46
|
+
fireEvent( innerBlockListWrapper, 'layout', {
|
|
47
|
+
nativeEvent: {
|
|
48
|
+
layout: {
|
|
49
|
+
width: 300,
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
} );
|
|
53
|
+
|
|
54
|
+
// Check the WordPress icon has a URL set (active)
|
|
55
|
+
const firstLinkBlock = await getBlock( screen, 'Social Icon' );
|
|
56
|
+
fireEvent.press( firstLinkBlock );
|
|
57
|
+
const firstLink = within( socialLinksBlock ).getByAccessibilityHint(
|
|
58
|
+
/WordPress has URL set/
|
|
59
|
+
);
|
|
60
|
+
expect( firstLink ).toBeVisible();
|
|
61
|
+
|
|
62
|
+
expect( getEditorHtml() ).toMatchSnapshot();
|
|
63
|
+
} );
|
|
64
|
+
|
|
65
|
+
it( 'shows active links correctly when not selected', async () => {
|
|
66
|
+
const screen = await initializeEditor();
|
|
67
|
+
|
|
68
|
+
// Add Social Icons block
|
|
69
|
+
await addBlock( screen, 'Social Icons' );
|
|
70
|
+
|
|
71
|
+
// Get block
|
|
72
|
+
const socialLinksBlock = await getBlock( screen, 'Social Icons' );
|
|
73
|
+
|
|
74
|
+
// Trigger inner blocks layout
|
|
75
|
+
const innerBlockListWrapper = await waitFor( () =>
|
|
76
|
+
within( socialLinksBlock ).getByTestId( 'block-list-wrapper' )
|
|
77
|
+
);
|
|
78
|
+
fireEvent( innerBlockListWrapper, 'layout', {
|
|
79
|
+
nativeEvent: {
|
|
80
|
+
layout: {
|
|
81
|
+
width: 300,
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
} );
|
|
85
|
+
|
|
86
|
+
// Add Paragraph block
|
|
87
|
+
await addBlock( screen, 'Paragraph' );
|
|
88
|
+
|
|
89
|
+
// Check there's only one active social link
|
|
90
|
+
const socialLinks =
|
|
91
|
+
within( socialLinksBlock ).getAllByA11yLabel( / social icon/ );
|
|
92
|
+
expect( socialLinks.length ).toBe( 1 );
|
|
93
|
+
|
|
94
|
+
// Check the WordPress link is shown when unselected
|
|
95
|
+
const firstLinkBlock = await getBlock( screen, 'Social Icon' );
|
|
96
|
+
fireEvent.press( firstLinkBlock );
|
|
97
|
+
const firstLink = within( socialLinksBlock ).getByAccessibilityHint(
|
|
98
|
+
/WordPress has URL set/
|
|
99
|
+
);
|
|
100
|
+
expect( firstLink ).toBeVisible();
|
|
101
|
+
|
|
102
|
+
expect( getEditorHtml() ).toMatchSnapshot();
|
|
103
|
+
} );
|
|
104
|
+
|
|
105
|
+
it( 'shows the social links bottom sheet when tapping on the inline appender', async () => {
|
|
106
|
+
const screen = await initializeEditor();
|
|
107
|
+
const { getByTestId, getByText } = screen;
|
|
108
|
+
|
|
109
|
+
// Add block
|
|
110
|
+
await addBlock( screen, 'Social Icons' );
|
|
111
|
+
|
|
112
|
+
// Get block
|
|
113
|
+
const socialLinksBlock = await getBlock( screen, 'Social Icons' );
|
|
114
|
+
fireEvent.press( socialLinksBlock );
|
|
115
|
+
|
|
116
|
+
// Trigger inner blocks layout
|
|
117
|
+
const innerBlockListWrapper = await waitFor( () =>
|
|
118
|
+
within( socialLinksBlock ).getByTestId( 'block-list-wrapper' )
|
|
119
|
+
);
|
|
120
|
+
fireEvent( innerBlockListWrapper, 'layout', {
|
|
121
|
+
nativeEvent: {
|
|
122
|
+
layout: {
|
|
123
|
+
width: 300,
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
} );
|
|
127
|
+
|
|
128
|
+
// Open the links bottom sheet
|
|
129
|
+
const appenderButton =
|
|
130
|
+
within( socialLinksBlock ).getByTestId( 'appender-button' );
|
|
131
|
+
fireEvent.press( appenderButton );
|
|
132
|
+
|
|
133
|
+
// Find a social link in the inserter
|
|
134
|
+
const blockList = getByTestId( 'InserterUI-Blocks' );
|
|
135
|
+
|
|
136
|
+
// onScroll event used to force the FlatList to render all items
|
|
137
|
+
fireEvent.scroll( blockList, {
|
|
138
|
+
nativeEvent: {
|
|
139
|
+
contentOffset: { y: 0, x: 0 },
|
|
140
|
+
contentSize: { width: 100, height: 100 },
|
|
141
|
+
layoutMeasurement: { width: 100, height: 100 },
|
|
142
|
+
},
|
|
143
|
+
} );
|
|
144
|
+
|
|
145
|
+
// Add the Amazon link
|
|
146
|
+
const amazonBlock = await waitFor( () => getByText( 'Amazon' ) );
|
|
147
|
+
expect( amazonBlock ).toBeVisible();
|
|
148
|
+
|
|
149
|
+
fireEvent.press( amazonBlock );
|
|
150
|
+
|
|
151
|
+
expect( getEditorHtml() ).toMatchSnapshot();
|
|
152
|
+
} );
|
|
153
|
+
|
|
154
|
+
it( 'shows the ghost placeholder when no icon is active', async () => {
|
|
155
|
+
const screen = await initializeEditor();
|
|
156
|
+
const { getByA11yLabel } = screen;
|
|
157
|
+
|
|
158
|
+
// Add block
|
|
159
|
+
await addBlock( screen, 'Social Icons' );
|
|
160
|
+
|
|
161
|
+
// Get block
|
|
162
|
+
const socialLinksBlock = await getBlock( screen, 'Social Icons' );
|
|
163
|
+
|
|
164
|
+
// Trigger inner blocks layout
|
|
165
|
+
const innerBlockListWrapper = await waitFor( () =>
|
|
166
|
+
within( socialLinksBlock ).getByTestId( 'block-list-wrapper' )
|
|
167
|
+
);
|
|
168
|
+
fireEvent( innerBlockListWrapper, 'layout', {
|
|
169
|
+
nativeEvent: {
|
|
170
|
+
layout: {
|
|
171
|
+
width: 300,
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
} );
|
|
175
|
+
|
|
176
|
+
// Get the first social link
|
|
177
|
+
const firstLinkBlock = await getBlock( screen, 'Social Icon' );
|
|
178
|
+
fireEvent.press( firstLinkBlock );
|
|
179
|
+
|
|
180
|
+
// Open block actions menu
|
|
181
|
+
const blockActionsButton = getByA11yLabel( /Open Block Actions Menu/ );
|
|
182
|
+
fireEvent.press( blockActionsButton );
|
|
183
|
+
|
|
184
|
+
// Delete the social link
|
|
185
|
+
const deleteButton = getByA11yLabel( /Remove block/ );
|
|
186
|
+
fireEvent.press( deleteButton );
|
|
187
|
+
|
|
188
|
+
// Add Paragraph block
|
|
189
|
+
await addBlock( screen, 'Paragraph' );
|
|
190
|
+
|
|
191
|
+
// Check the ghost placeholders are visible
|
|
192
|
+
const socialLinks = within( socialLinksBlock ).getAllByTestId(
|
|
193
|
+
'social-links-placeholder'
|
|
194
|
+
);
|
|
195
|
+
expect( socialLinks.length ).toBe( 3 );
|
|
196
|
+
|
|
197
|
+
expect( getEditorHtml() ).toMatchSnapshot();
|
|
198
|
+
} );
|
|
199
|
+
} );
|
package/src/style.scss
CHANGED
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
@import "./post-date/style.scss";
|
|
31
31
|
@import "./post-excerpt/style.scss";
|
|
32
32
|
@import "./post-featured-image/style.scss";
|
|
33
|
+
@import "./post-navigation-link/style.scss";
|
|
33
34
|
@import "./post-terms/style.scss";
|
|
34
35
|
@import "./post-title/style.scss";
|
|
35
36
|
@import "./preformatted/style.scss";
|
|
@@ -133,64 +133,66 @@ export default function TemplatePartEdit( {
|
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
return (
|
|
136
|
-
|
|
137
|
-
<
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
{ isPlaceholder && (
|
|
145
|
-
<TagName { ...blockProps }>
|
|
146
|
-
<TemplatePartPlaceholder
|
|
147
|
-
area={ attributes.area }
|
|
148
|
-
templatePartId={ templatePartId }
|
|
149
|
-
clientId={ clientId }
|
|
150
|
-
setAttributes={ setAttributes }
|
|
151
|
-
onOpenSelectionModal={ () =>
|
|
152
|
-
setIsTemplatePartSelectionOpen( true )
|
|
153
|
-
}
|
|
154
|
-
/>
|
|
155
|
-
</TagName>
|
|
156
|
-
) }
|
|
157
|
-
{ canReplace && (
|
|
158
|
-
<BlockSettingsMenuControls>
|
|
159
|
-
{ () => (
|
|
160
|
-
<MenuItem
|
|
161
|
-
onClick={ () => {
|
|
162
|
-
setIsTemplatePartSelectionOpen( true );
|
|
163
|
-
} }
|
|
164
|
-
>
|
|
165
|
-
{ createInterpolateElement(
|
|
166
|
-
__( 'Replace <BlockTitle />' ),
|
|
167
|
-
{
|
|
168
|
-
BlockTitle: (
|
|
169
|
-
<BlockTitle
|
|
170
|
-
clientId={ clientId }
|
|
171
|
-
maximumLength={ 25 }
|
|
172
|
-
/>
|
|
173
|
-
),
|
|
174
|
-
}
|
|
175
|
-
) }
|
|
176
|
-
</MenuItem>
|
|
177
|
-
) }
|
|
178
|
-
</BlockSettingsMenuControls>
|
|
179
|
-
) }
|
|
180
|
-
{ isEntityAvailable && (
|
|
181
|
-
<TemplatePartInnerBlocks
|
|
182
|
-
tagName={ TagName }
|
|
183
|
-
blockProps={ blockProps }
|
|
184
|
-
postId={ templatePartId }
|
|
185
|
-
hasInnerBlocks={ innerBlocks.length > 0 }
|
|
186
|
-
layout={ layout }
|
|
136
|
+
<>
|
|
137
|
+
<RecursionProvider uniqueId={ templatePartId }>
|
|
138
|
+
<TemplatePartAdvancedControls
|
|
139
|
+
tagName={ tagName }
|
|
140
|
+
setAttributes={ setAttributes }
|
|
141
|
+
isEntityAvailable={ isEntityAvailable }
|
|
142
|
+
templatePartId={ templatePartId }
|
|
143
|
+
defaultWrapper={ areaObject.tagName }
|
|
187
144
|
/>
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
145
|
+
{ isPlaceholder && (
|
|
146
|
+
<TagName { ...blockProps }>
|
|
147
|
+
<TemplatePartPlaceholder
|
|
148
|
+
area={ attributes.area }
|
|
149
|
+
templatePartId={ templatePartId }
|
|
150
|
+
clientId={ clientId }
|
|
151
|
+
setAttributes={ setAttributes }
|
|
152
|
+
onOpenSelectionModal={ () =>
|
|
153
|
+
setIsTemplatePartSelectionOpen( true )
|
|
154
|
+
}
|
|
155
|
+
/>
|
|
156
|
+
</TagName>
|
|
157
|
+
) }
|
|
158
|
+
{ canReplace && (
|
|
159
|
+
<BlockSettingsMenuControls>
|
|
160
|
+
{ () => (
|
|
161
|
+
<MenuItem
|
|
162
|
+
onClick={ () => {
|
|
163
|
+
setIsTemplatePartSelectionOpen( true );
|
|
164
|
+
} }
|
|
165
|
+
>
|
|
166
|
+
{ createInterpolateElement(
|
|
167
|
+
__( 'Replace <BlockTitle />' ),
|
|
168
|
+
{
|
|
169
|
+
BlockTitle: (
|
|
170
|
+
<BlockTitle
|
|
171
|
+
clientId={ clientId }
|
|
172
|
+
maximumLength={ 25 }
|
|
173
|
+
/>
|
|
174
|
+
),
|
|
175
|
+
}
|
|
176
|
+
) }
|
|
177
|
+
</MenuItem>
|
|
178
|
+
) }
|
|
179
|
+
</BlockSettingsMenuControls>
|
|
180
|
+
) }
|
|
181
|
+
{ isEntityAvailable && (
|
|
182
|
+
<TemplatePartInnerBlocks
|
|
183
|
+
tagName={ TagName }
|
|
184
|
+
blockProps={ blockProps }
|
|
185
|
+
postId={ templatePartId }
|
|
186
|
+
hasInnerBlocks={ innerBlocks.length > 0 }
|
|
187
|
+
layout={ layout }
|
|
188
|
+
/>
|
|
189
|
+
) }
|
|
190
|
+
{ ! isPlaceholder && ! isResolved && (
|
|
191
|
+
<TagName { ...blockProps }>
|
|
192
|
+
<Spinner />
|
|
193
|
+
</TagName>
|
|
194
|
+
) }
|
|
195
|
+
</RecursionProvider>
|
|
194
196
|
{ isTemplatePartSelectionOpen && (
|
|
195
197
|
<Modal
|
|
196
198
|
overlayClassName="block-editor-template-part__selection-modal"
|
|
@@ -215,6 +217,6 @@ export default function TemplatePartEdit( {
|
|
|
215
217
|
/>
|
|
216
218
|
</Modal>
|
|
217
219
|
) }
|
|
218
|
-
|
|
220
|
+
</>
|
|
219
221
|
);
|
|
220
222
|
}
|