@wordpress/block-library 6.0.9 → 6.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cover/edit.js +8 -3
- package/build/cover/edit.js.map +1 -1
- package/build/gallery/edit.js +1 -1
- package/build/gallery/edit.js.map +1 -1
- package/build/gallery/v1/update-gallery-modal.js +1 -1
- package/build/gallery/v1/update-gallery-modal.js.map +1 -1
- package/build/index.js +3 -2
- package/build/index.js.map +1 -1
- package/build/navigation/deprecated.js +118 -12
- package/build/navigation/deprecated.js.map +1 -1
- package/build/navigation/edit/index.js +45 -31
- package/build/navigation/edit/index.js.map +1 -1
- package/build/navigation/edit/navigation-menu-selector.js +2 -2
- package/build/navigation/edit/navigation-menu-selector.js.map +1 -1
- package/build/navigation/edit/placeholder/index.js +16 -48
- package/build/navigation/edit/placeholder/index.js.map +1 -1
- package/build/navigation/edit/unsaved-inner-blocks.js +4 -35
- package/build/navigation/edit/unsaved-inner-blocks.js.map +1 -1
- package/build/navigation/edit/use-create-navigation-menu.js +50 -0
- package/build/navigation/edit/use-create-navigation-menu.js.map +1 -0
- package/build/navigation/edit/use-generate-default-navigation-title.js +73 -0
- package/build/navigation/edit/use-generate-default-navigation-title.js.map +1 -0
- package/build/navigation/index.js +1 -1
- package/build/navigation/save.js +2 -2
- package/build/navigation/save.js.map +1 -1
- package/build/navigation/use-navigation-menu.js +19 -8
- package/build/navigation/use-navigation-menu.js.map +1 -1
- package/build/pattern/index.js +1 -1
- package/build/post-featured-image/edit.js +2 -3
- package/build/post-featured-image/edit.js.map +1 -1
- package/build/post-terms/index.js +1 -1
- package/build/post-title/edit.js +2 -2
- package/build/post-title/edit.js.map +1 -1
- package/build/query-title/index.js +1 -1
- package/build/site-logo/index.js +1 -1
- package/build/site-tagline/index.js +1 -1
- package/build/site-title/index.js +1 -1
- package/build/template-part/edit/placeholder/index.js +1 -1
- package/build/template-part/edit/placeholder/index.js.map +1 -1
- package/build/template-part/index.js +2 -1
- package/build/template-part/index.js.map +1 -1
- package/build-module/cover/edit.js +8 -3
- package/build-module/cover/edit.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/update-gallery-modal.js +1 -1
- package/build-module/gallery/v1/update-gallery-modal.js.map +1 -1
- package/build-module/index.js +3 -2
- package/build-module/index.js.map +1 -1
- package/build-module/navigation/deprecated.js +118 -12
- package/build-module/navigation/deprecated.js.map +1 -1
- package/build-module/navigation/edit/index.js +46 -31
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/navigation/edit/navigation-menu-selector.js +2 -2
- package/build-module/navigation/edit/navigation-menu-selector.js.map +1 -1
- package/build-module/navigation/edit/placeholder/index.js +15 -45
- package/build-module/navigation/edit/placeholder/index.js.map +1 -1
- package/build-module/navigation/edit/unsaved-inner-blocks.js +6 -35
- package/build-module/navigation/edit/unsaved-inner-blocks.js.map +1 -1
- package/build-module/navigation/edit/use-create-navigation-menu.js +36 -0
- package/build-module/navigation/edit/use-create-navigation-menu.js.map +1 -0
- package/build-module/navigation/edit/use-generate-default-navigation-title.js +57 -0
- package/build-module/navigation/edit/use-generate-default-navigation-title.js.map +1 -0
- package/build-module/navigation/index.js +1 -1
- package/build-module/navigation/save.js +2 -2
- package/build-module/navigation/save.js.map +1 -1
- package/build-module/navigation/use-navigation-menu.js +19 -8
- package/build-module/navigation/use-navigation-menu.js.map +1 -1
- package/build-module/pattern/index.js +1 -1
- package/build-module/post-featured-image/edit.js +2 -3
- package/build-module/post-featured-image/edit.js.map +1 -1
- package/build-module/post-terms/index.js +1 -1
- package/build-module/post-title/edit.js +2 -2
- package/build-module/post-title/edit.js.map +1 -1
- package/build-module/query-title/index.js +1 -1
- package/build-module/site-logo/index.js +1 -1
- package/build-module/site-tagline/index.js +1 -1
- package/build-module/site-title/index.js +1 -1
- package/build-module/template-part/edit/placeholder/index.js +2 -2
- package/build-module/template-part/edit/placeholder/index.js.map +1 -1
- package/build-module/template-part/index.js +2 -1
- package/build-module/template-part/index.js.map +1 -1
- package/build-style/editor-rtl.css +5 -4
- package/build-style/editor.css +5 -4
- package/build-style/gallery/editor-rtl.css +1 -0
- package/build-style/gallery/editor.css +1 -0
- package/build-style/post-featured-image/editor-rtl.css +2 -2
- package/build-style/post-featured-image/editor.css +2 -2
- package/build-style/site-logo/editor-rtl.css +2 -2
- package/build-style/site-logo/editor.css +2 -2
- package/package.json +8 -8
- package/src/calendar/index.php +2 -2
- package/src/cover/edit.js +8 -1
- package/src/gallery/edit.js +1 -1
- package/src/gallery/editor.scss +1 -0
- package/src/gallery/v1/update-gallery-modal.js +1 -1
- package/src/index.js +27 -25
- package/src/navigation/block.json +1 -1
- package/src/navigation/deprecated.js +105 -4
- package/src/navigation/edit/index.js +43 -36
- package/src/navigation/edit/navigation-menu-selector.js +2 -2
- package/src/navigation/edit/placeholder/index.js +16 -62
- package/src/navigation/edit/unsaved-inner-blocks.js +6 -57
- package/src/navigation/edit/use-create-navigation-menu.js +39 -0
- package/src/navigation/edit/use-generate-default-navigation-title.js +79 -0
- package/src/navigation/index.php +128 -14
- package/src/navigation/save.js +2 -2
- package/src/navigation/use-navigation-menu.js +20 -9
- package/src/page-list/index.php +5 -0
- package/src/pattern/block.json +1 -1
- package/src/post-featured-image/edit.js +2 -5
- package/src/post-featured-image/editor.scss +2 -2
- package/src/post-terms/block.json +1 -1
- package/src/post-title/edit.js +2 -2
- package/src/query-title/block.json +1 -1
- package/src/site-logo/block.json +1 -1
- package/src/site-logo/editor.scss +2 -2
- package/src/site-tagline/block.json +1 -1
- package/src/site-title/block.json +1 -1
- package/src/template-part/block.json +2 -1
- package/src/template-part/edit/placeholder/index.js +2 -2
- package/src/template-part/index.php +2 -1
- package/build/navigation/edit/navigation-menu-name-modal.js +0 -55
- package/build/navigation/edit/navigation-menu-name-modal.js.map +0 -1
- package/build/navigation/edit/navigation-menu-publish-button.js +0 -53
- package/build/navigation/edit/navigation-menu-publish-button.js.map +0 -1
- package/build-module/navigation/edit/navigation-menu-name-modal.js +0 -47
- package/build-module/navigation/edit/navigation-menu-name-modal.js.map +0 -1
- package/build-module/navigation/edit/navigation-menu-publish-button.js +0 -40
- package/build-module/navigation/edit/navigation-menu-publish-button.js.map +0 -1
- package/src/navigation/edit/navigation-menu-name-modal.js +0 -69
- package/src/navigation/edit/navigation-menu-publish-button.js +0 -57
package/src/navigation/index.php
CHANGED
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
* Build an array with CSS classes and inline styles defining the colors
|
|
10
10
|
* which will be applied to the navigation markup in the front-end.
|
|
11
11
|
*
|
|
12
|
-
* @param
|
|
12
|
+
* @param array $attributes Navigation block attributes.
|
|
13
|
+
*
|
|
13
14
|
* @return array Colors CSS classes and inline styles.
|
|
14
15
|
*/
|
|
15
16
|
function block_core_navigation_build_css_colors( $attributes ) {
|
|
@@ -99,7 +100,8 @@ function block_core_navigation_build_css_colors( $attributes ) {
|
|
|
99
100
|
* Build an array with CSS classes and inline styles defining the font sizes
|
|
100
101
|
* which will be applied to the navigation markup in the front-end.
|
|
101
102
|
*
|
|
102
|
-
* @param
|
|
103
|
+
* @param array $attributes Navigation block attributes.
|
|
104
|
+
*
|
|
103
105
|
* @return array Font size CSS classes and inline styles.
|
|
104
106
|
*/
|
|
105
107
|
function block_core_navigation_build_css_font_sizes( $attributes ) {
|
|
@@ -132,6 +134,100 @@ function block_core_navigation_render_submenu_icon() {
|
|
|
132
134
|
return '<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12" fill="none" role="img" aria-hidden="true" focusable="false"><path d="M1.50002 4L6.00002 8L10.5 4" stroke-width="1.5"></path></svg>';
|
|
133
135
|
}
|
|
134
136
|
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Finds the first non-empty `wp_navigation` Post.
|
|
140
|
+
*
|
|
141
|
+
* @return WP_Post|null the first non-empty Navigation or null.
|
|
142
|
+
*/
|
|
143
|
+
function block_core_navigation_get_first_non_empty_navigation() {
|
|
144
|
+
// Order and orderby args set to mirror those in `wp_get_nav_menus`
|
|
145
|
+
// see:
|
|
146
|
+
// - https://github.com/WordPress/wordpress-develop/blob/ba943e113d3b31b121f77a2d30aebe14b047c69d/src/wp-includes/nav-menu.php#L613-L619.
|
|
147
|
+
// - https://developer.wordpress.org/reference/classes/wp_query/#order-orderby-parameters.
|
|
148
|
+
$navigation_posts = get_posts(
|
|
149
|
+
array(
|
|
150
|
+
'post_type' => 'wp_navigation',
|
|
151
|
+
'order' => 'ASC',
|
|
152
|
+
'orderby' => 'name',
|
|
153
|
+
'posts_per_page' => 1, // only the first post.
|
|
154
|
+
's' => '<!-- wp:', // look for block indicators to ensure we only include non-empty Navigations.
|
|
155
|
+
)
|
|
156
|
+
);
|
|
157
|
+
return count( $navigation_posts ) ? $navigation_posts[0] : null;
|
|
158
|
+
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Filter out empty "null" blocks from the block list.
|
|
163
|
+
* 'parse_blocks' includes a null block with '\n\n' as the content when
|
|
164
|
+
* it encounters whitespace. This is not a bug but rather how the parser
|
|
165
|
+
* is designed.
|
|
166
|
+
*
|
|
167
|
+
* @param array $parsed_blocks the parsed blocks to be normalized.
|
|
168
|
+
* @return array the normalized parsed blocks.
|
|
169
|
+
*/
|
|
170
|
+
function block_core_navigation_filter_out_empty_blocks( $parsed_blocks ) {
|
|
171
|
+
$filtered = array_filter(
|
|
172
|
+
$parsed_blocks,
|
|
173
|
+
function( $block ) {
|
|
174
|
+
return isset( $block['blockName'] );
|
|
175
|
+
}
|
|
176
|
+
);
|
|
177
|
+
|
|
178
|
+
// Reset keys.
|
|
179
|
+
return array_values( $filtered );
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Retrieves the appropriate fallback to be used on the front of the
|
|
184
|
+
* site when there is no menu assigned to the Nav block.
|
|
185
|
+
*
|
|
186
|
+
* This aims to mirror how the fallback mechanic for wp_nav_menu works.
|
|
187
|
+
* See https://developer.wordpress.org/reference/functions/wp_nav_menu/#more-information.
|
|
188
|
+
*
|
|
189
|
+
* @return array the array of blocks to be used as a fallback.
|
|
190
|
+
*/
|
|
191
|
+
function block_core_navigation_get_fallback_blocks() {
|
|
192
|
+
$page_list_fallback = array(
|
|
193
|
+
array(
|
|
194
|
+
'blockName' => 'core/page-list',
|
|
195
|
+
'attrs' => array(
|
|
196
|
+
'__unstableMaxPages' => 4,
|
|
197
|
+
),
|
|
198
|
+
),
|
|
199
|
+
);
|
|
200
|
+
|
|
201
|
+
$registry = WP_Block_Type_Registry::get_instance();
|
|
202
|
+
|
|
203
|
+
// If `core/page-list` is not registered then return empty blocks.
|
|
204
|
+
$fallback_blocks = $registry->is_registered( 'core/page-list' ) ? $page_list_fallback : array();
|
|
205
|
+
|
|
206
|
+
// Default to a list of Pages.
|
|
207
|
+
|
|
208
|
+
$navigation_post = block_core_navigation_get_first_non_empty_navigation();
|
|
209
|
+
|
|
210
|
+
// Prefer using the first non-empty Navigation as fallback if available.
|
|
211
|
+
if ( $navigation_post ) {
|
|
212
|
+
$maybe_fallback = block_core_navigation_filter_out_empty_blocks( parse_blocks( $navigation_post->post_content ) );
|
|
213
|
+
|
|
214
|
+
// Normalizing blocks may result in an empty array of blocks if they were all `null` blocks.
|
|
215
|
+
// In this case default to the (Page List) fallback.
|
|
216
|
+
$fallback_blocks = ! empty( $maybe_fallback ) ? $maybe_fallback : $fallback_blocks;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Filters the fallback experience for the Navigation block.
|
|
221
|
+
*
|
|
222
|
+
* Returning a falsey value will opt out of the fallback and cause the block not to render.
|
|
223
|
+
* To customise the blocks provided return an array of blocks - these should be valid
|
|
224
|
+
* children of the `core/navigation` block.
|
|
225
|
+
*
|
|
226
|
+
* @param array[] default fallback blocks provided by the default block mechanic.
|
|
227
|
+
*/
|
|
228
|
+
return apply_filters( 'block_core_navigation_render_fallback', $fallback_blocks );
|
|
229
|
+
}
|
|
230
|
+
|
|
135
231
|
/**
|
|
136
232
|
* Renders the `core/navigation` block on server.
|
|
137
233
|
*
|
|
@@ -142,6 +238,11 @@ function block_core_navigation_render_submenu_icon() {
|
|
|
142
238
|
* @return string Returns the post content with the legacy widget added.
|
|
143
239
|
*/
|
|
144
240
|
function render_block_core_navigation( $attributes, $content, $block ) {
|
|
241
|
+
|
|
242
|
+
// Flag used to indicate whether the rendered output is considered to be
|
|
243
|
+
// a fallback (i.e. the block has no menu associated with it).
|
|
244
|
+
$is_fallback = false;
|
|
245
|
+
|
|
145
246
|
/**
|
|
146
247
|
* Deprecated:
|
|
147
248
|
* The rgbTextColor and rgbBackgroundColor attributes
|
|
@@ -187,13 +288,17 @@ function render_block_core_navigation( $attributes, $content, $block ) {
|
|
|
187
288
|
$area = $block->context['navigationArea'];
|
|
188
289
|
$mapping = get_option( 'wp_navigation_areas', array() );
|
|
189
290
|
if ( ! empty( $mapping[ $area ] ) ) {
|
|
190
|
-
$attributes['
|
|
291
|
+
$attributes['ref'] = $mapping[ $area ];
|
|
191
292
|
}
|
|
192
293
|
}
|
|
193
294
|
|
|
194
|
-
//
|
|
295
|
+
// Ensure that blocks saved with the legacy ref attribute name (navigationMenuId) continue to render.
|
|
195
296
|
if ( array_key_exists( 'navigationMenuId', $attributes ) ) {
|
|
196
|
-
$
|
|
297
|
+
$attributes['ref'] = $attributes['navigationMenuId'];
|
|
298
|
+
}
|
|
299
|
+
// Load inner blocks from the navigation post.
|
|
300
|
+
if ( array_key_exists( 'ref', $attributes ) ) {
|
|
301
|
+
$navigation_post = get_post( $attributes['ref'] );
|
|
197
302
|
if ( ! isset( $navigation_post ) ) {
|
|
198
303
|
return '';
|
|
199
304
|
}
|
|
@@ -202,20 +307,26 @@ function render_block_core_navigation( $attributes, $content, $block ) {
|
|
|
202
307
|
|
|
203
308
|
// 'parse_blocks' includes a null block with '\n\n' as the content when
|
|
204
309
|
// it encounters whitespace. This code strips it.
|
|
205
|
-
$compacted_blocks =
|
|
206
|
-
$parsed_blocks,
|
|
207
|
-
function( $block ) {
|
|
208
|
-
return isset( $block['blockName'] );
|
|
209
|
-
}
|
|
210
|
-
);
|
|
310
|
+
$compacted_blocks = block_core_navigation_filter_out_empty_blocks( $parsed_blocks );
|
|
211
311
|
|
|
212
312
|
// TODO - this uses the full navigation block attributes for the
|
|
213
313
|
// context which could be refined.
|
|
214
314
|
$inner_blocks = new WP_Block_List( $compacted_blocks, $attributes );
|
|
215
315
|
}
|
|
216
316
|
|
|
317
|
+
// If there are no inner blocks then fallback to rendering an appropriate fallback.
|
|
217
318
|
if ( empty( $inner_blocks ) ) {
|
|
218
|
-
|
|
319
|
+
$is_fallback = true; // indicate we are rendering the fallback.
|
|
320
|
+
|
|
321
|
+
$fallback_blocks = block_core_navigation_get_fallback_blocks();
|
|
322
|
+
|
|
323
|
+
// Fallback my have been filtered so do basic test for validity.
|
|
324
|
+
if ( empty( $fallback_blocks ) || ! is_array( $fallback_blocks ) ) {
|
|
325
|
+
return '';
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
$inner_blocks = new WP_Block_List( $fallback_blocks, $attributes );
|
|
329
|
+
|
|
219
330
|
}
|
|
220
331
|
|
|
221
332
|
// Restore legacy classnames for submenu positioning.
|
|
@@ -234,7 +345,8 @@ function render_block_core_navigation( $attributes, $content, $block ) {
|
|
|
234
345
|
$colors['css_classes'],
|
|
235
346
|
$font_sizes['css_classes'],
|
|
236
347
|
$is_responsive_menu ? array( 'is-responsive' ) : array(),
|
|
237
|
-
$layout_class ? array( $layout_class ) : array()
|
|
348
|
+
$layout_class ? array( $layout_class ) : array(),
|
|
349
|
+
$is_fallback ? array( 'is-fallback' ) : array()
|
|
238
350
|
);
|
|
239
351
|
|
|
240
352
|
$inner_blocks_html = '';
|
|
@@ -323,8 +435,8 @@ function render_block_core_navigation( $attributes, $content, $block ) {
|
|
|
323
435
|
/**
|
|
324
436
|
* Register the navigation block.
|
|
325
437
|
*
|
|
326
|
-
* @uses render_block_core_navigation()
|
|
327
438
|
* @throws WP_Error An WP_Error exception parsing the block definition.
|
|
439
|
+
* @uses render_block_core_navigation()
|
|
328
440
|
*/
|
|
329
441
|
function register_block_core_navigation() {
|
|
330
442
|
register_block_type_from_metadata(
|
|
@@ -341,6 +453,7 @@ add_action( 'init', 'register_block_core_navigation' );
|
|
|
341
453
|
* Filter that changes the parsed attribute values of navigation blocks contain typographic presets to contain the values directly.
|
|
342
454
|
*
|
|
343
455
|
* @param array $parsed_block The block being rendered.
|
|
456
|
+
*
|
|
344
457
|
* @return array The block being rendered without typographic presets.
|
|
345
458
|
*/
|
|
346
459
|
function block_core_navigation_typographic_presets_backcompatibility( $parsed_block ) {
|
|
@@ -364,6 +477,7 @@ function block_core_navigation_typographic_presets_backcompatibility( $parsed_bl
|
|
|
364
477
|
}
|
|
365
478
|
}
|
|
366
479
|
}
|
|
480
|
+
|
|
367
481
|
return $parsed_block;
|
|
368
482
|
}
|
|
369
483
|
|
package/src/navigation/save.js
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
import { InnerBlocks } from '@wordpress/block-editor';
|
|
5
5
|
|
|
6
6
|
export default function save( { attributes } ) {
|
|
7
|
-
if ( attributes.
|
|
8
|
-
// Avoid rendering inner blocks when a
|
|
7
|
+
if ( attributes.ref ) {
|
|
8
|
+
// Avoid rendering inner blocks when a ref is defined.
|
|
9
9
|
// When this id is defined the inner blocks are loaded from the
|
|
10
10
|
// `wp_navigation` entity rather than the hard-coded block html.
|
|
11
11
|
return;
|
|
@@ -4,10 +4,11 @@
|
|
|
4
4
|
import { store as coreStore } from '@wordpress/core-data';
|
|
5
5
|
import { useSelect } from '@wordpress/data';
|
|
6
6
|
|
|
7
|
-
export default function useNavigationMenu(
|
|
7
|
+
export default function useNavigationMenu( ref ) {
|
|
8
8
|
return useSelect(
|
|
9
9
|
( select ) => {
|
|
10
10
|
const {
|
|
11
|
+
getEntityRecord,
|
|
11
12
|
getEditedEntityRecord,
|
|
12
13
|
getEntityRecords,
|
|
13
14
|
hasFinishedResolution,
|
|
@@ -16,12 +17,22 @@ export default function useNavigationMenu( navigationMenuId ) {
|
|
|
16
17
|
const navigationMenuSingleArgs = [
|
|
17
18
|
'postType',
|
|
18
19
|
'wp_navigation',
|
|
19
|
-
|
|
20
|
+
ref,
|
|
20
21
|
];
|
|
21
|
-
const
|
|
22
|
+
const rawNavigationMenu = ref
|
|
23
|
+
? getEntityRecord( ...navigationMenuSingleArgs )
|
|
24
|
+
: null;
|
|
25
|
+
let navigationMenu = ref
|
|
22
26
|
? getEditedEntityRecord( ...navigationMenuSingleArgs )
|
|
23
27
|
: null;
|
|
24
|
-
|
|
28
|
+
|
|
29
|
+
// getEditedEntityRecord will return the post regardless of status.
|
|
30
|
+
// Therefore if the found post is not published then we should ignore it.
|
|
31
|
+
if ( navigationMenu?.status !== 'publish' ) {
|
|
32
|
+
navigationMenu = null;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const hasResolvedNavigationMenu = ref
|
|
25
36
|
? hasFinishedResolution(
|
|
26
37
|
'getEditedEntityRecord',
|
|
27
38
|
navigationMenuSingleArgs
|
|
@@ -31,21 +42,21 @@ export default function useNavigationMenu( navigationMenuId ) {
|
|
|
31
42
|
const navigationMenuMultipleArgs = [
|
|
32
43
|
'postType',
|
|
33
44
|
'wp_navigation',
|
|
34
|
-
{ per_page: -1 },
|
|
45
|
+
{ per_page: -1, status: 'publish' },
|
|
35
46
|
];
|
|
36
47
|
const navigationMenus = getEntityRecords(
|
|
37
48
|
...navigationMenuMultipleArgs
|
|
38
49
|
);
|
|
39
50
|
|
|
40
|
-
const canSwitchNavigationMenu =
|
|
51
|
+
const canSwitchNavigationMenu = ref
|
|
41
52
|
? navigationMenus?.length > 1
|
|
42
53
|
: navigationMenus?.length > 0;
|
|
43
54
|
|
|
44
55
|
return {
|
|
45
56
|
isNavigationMenuResolved: hasResolvedNavigationMenu,
|
|
46
57
|
isNavigationMenuMissing:
|
|
47
|
-
!
|
|
48
|
-
( hasResolvedNavigationMenu && !
|
|
58
|
+
! ref ||
|
|
59
|
+
( hasResolvedNavigationMenu && ! rawNavigationMenu ),
|
|
49
60
|
canSwitchNavigationMenu,
|
|
50
61
|
hasResolvedNavigationMenus: hasFinishedResolution(
|
|
51
62
|
'getEntityRecords',
|
|
@@ -55,6 +66,6 @@ export default function useNavigationMenu( navigationMenuId ) {
|
|
|
55
66
|
navigationMenus,
|
|
56
67
|
};
|
|
57
68
|
},
|
|
58
|
-
[
|
|
69
|
+
[ ref ]
|
|
59
70
|
);
|
|
60
71
|
}
|
package/src/page-list/index.php
CHANGED
|
@@ -293,6 +293,11 @@ function render_block_core_page_list( $attributes, $content, $block ) {
|
|
|
293
293
|
|
|
294
294
|
$nested_pages = block_core_page_list_nest_pages( $top_level_pages, $pages_with_children );
|
|
295
295
|
|
|
296
|
+
// Limit the number of items to be visually displayed.
|
|
297
|
+
if ( ! empty( $attributes['__unstableMaxPages'] ) ) {
|
|
298
|
+
$nested_pages = array_slice( $nested_pages, 0, $attributes['__unstableMaxPages'] );
|
|
299
|
+
}
|
|
300
|
+
|
|
296
301
|
$is_navigation_child = array_key_exists( 'showSubmenuIcon', $block->context );
|
|
297
302
|
|
|
298
303
|
$open_submenus_on_click = array_key_exists( 'openSubmenusOnClick', $block->context ) ? $block->context['openSubmenusOnClick'] : false;
|
package/src/pattern/block.json
CHANGED
|
@@ -32,12 +32,9 @@ const placeholderIllustration = (
|
|
|
32
32
|
fill="none"
|
|
33
33
|
xmlns="http://www.w3.org/2000/svg"
|
|
34
34
|
viewBox="0 0 60 60"
|
|
35
|
-
preserveAspectRatio="
|
|
35
|
+
preserveAspectRatio="none"
|
|
36
36
|
>
|
|
37
|
-
<Path
|
|
38
|
-
vectorEffect="non-scaling-stroke"
|
|
39
|
-
d="m61 32.622-13.555-9.137-15.888 9.859a5 5 0 0 1-5.386-.073l-9.095-5.989L1 37.5"
|
|
40
|
-
/>
|
|
37
|
+
<Path vectorEffect="non-scaling-stroke" d="M60 60 0 0" />
|
|
41
38
|
</SVG>
|
|
42
39
|
);
|
|
43
40
|
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
bottom: 0;
|
|
49
49
|
left: 0;
|
|
50
50
|
border: $border-width dashed currentColor;
|
|
51
|
-
opacity: 0.
|
|
51
|
+
opacity: 0.4;
|
|
52
52
|
pointer-events: none;
|
|
53
53
|
|
|
54
54
|
// Inherit border radius from style variations.
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
height: 100%;
|
|
94
94
|
stroke: currentColor;
|
|
95
95
|
stroke-dasharray: 3;
|
|
96
|
-
opacity: 0.
|
|
96
|
+
opacity: 0.4;
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
// Show default placeholder height when not resized.
|
package/src/post-title/edit.js
CHANGED
|
@@ -62,7 +62,7 @@ export default function PostTitleEdit( {
|
|
|
62
62
|
/>
|
|
63
63
|
) : (
|
|
64
64
|
<TagName { ...blockProps }>
|
|
65
|
-
<RawHTML key="html">{ fullTitle
|
|
65
|
+
<RawHTML key="html">{ fullTitle?.rendered }</RawHTML>
|
|
66
66
|
</TagName>
|
|
67
67
|
);
|
|
68
68
|
}
|
|
@@ -92,7 +92,7 @@ export default function PostTitleEdit( {
|
|
|
92
92
|
rel={ rel }
|
|
93
93
|
onClick={ ( event ) => event.preventDefault() }
|
|
94
94
|
>
|
|
95
|
-
<RawHTML key="html">{ fullTitle
|
|
95
|
+
<RawHTML key="html">{ fullTitle?.rendered }</RawHTML>
|
|
96
96
|
</a>
|
|
97
97
|
</TagName>
|
|
98
98
|
);
|
package/src/site-logo/block.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"apiVersion": 2,
|
|
3
3
|
"name": "core/site-logo",
|
|
4
4
|
"title": "Site Logo",
|
|
5
|
-
"category": "
|
|
5
|
+
"category": "theme",
|
|
6
6
|
"description": "Display a graphic to represent this site. Update the block, and the changes apply everywhere it’s used. This is different than the site icon, which is the smaller image visible in your dashboard, browser tabs, etc used to help others recognize this site.",
|
|
7
7
|
"textdomain": "default",
|
|
8
8
|
"attributes": {
|
|
@@ -110,7 +110,7 @@
|
|
|
110
110
|
bottom: 0;
|
|
111
111
|
left: 0;
|
|
112
112
|
border: $border-width dashed currentColor;
|
|
113
|
-
opacity: 0.
|
|
113
|
+
opacity: 0.4;
|
|
114
114
|
pointer-events: none;
|
|
115
115
|
|
|
116
116
|
// Inherit border radius from style variations.
|
|
@@ -155,7 +155,7 @@
|
|
|
155
155
|
height: 100%;
|
|
156
156
|
stroke: currentColor;
|
|
157
157
|
stroke-dasharray: 3;
|
|
158
|
-
opacity: 0.
|
|
158
|
+
opacity: 0.4;
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
161
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"apiVersion": 2,
|
|
3
3
|
"name": "core/site-tagline",
|
|
4
4
|
"title": "Site Tagline",
|
|
5
|
-
"category": "
|
|
5
|
+
"category": "theme",
|
|
6
6
|
"description": "Describe in a few words what the website is about. The tagline can be used in search results or when sharing on social networks even if it's not displayed in the theme design.",
|
|
7
7
|
"keywords": [ "description" ],
|
|
8
8
|
"textdomain": "default",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"apiVersion": 2,
|
|
3
3
|
"name": "core/site-title",
|
|
4
4
|
"title": "Site Title",
|
|
5
|
-
"category": "
|
|
5
|
+
"category": "theme",
|
|
6
6
|
"description": "Displays the name of this site. Update the block, and the changes apply everywhere it’s used. This will also appear in the browser title bar and in search results.",
|
|
7
7
|
"textdomain": "default",
|
|
8
8
|
"attributes": {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { find } from 'lodash';
|
|
4
|
+
import { find, kebabCase } from 'lodash';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
@@ -65,7 +65,7 @@ export default function TemplatePartPlaceholder( {
|
|
|
65
65
|
// block attributes.
|
|
66
66
|
const record = {
|
|
67
67
|
title,
|
|
68
|
-
slug:
|
|
68
|
+
slug: kebabCase( title ),
|
|
69
69
|
content: serialize( startingBlocks ),
|
|
70
70
|
// `area` is filterable on the server and defaults to `UNCATEGORIZED`
|
|
71
71
|
// if provided value is not allowed.
|
|
@@ -53,7 +53,8 @@ function render_block_core_template_part( $attributes ) {
|
|
|
53
53
|
} else {
|
|
54
54
|
// Else, if the template part was provided by the active theme,
|
|
55
55
|
// render the corresponding file content.
|
|
56
|
-
$
|
|
56
|
+
$theme_folders = get_block_theme_folders();
|
|
57
|
+
$template_part_file_path = get_theme_file_path( '/' . $theme_folders['wp_template_part'] . '/' . $attributes['slug'] . '.html' );
|
|
57
58
|
if ( 0 === validate_file( $attributes['slug'] ) && file_exists( $template_part_file_path ) ) {
|
|
58
59
|
$content = file_get_contents( $template_part_file_path );
|
|
59
60
|
$content = is_string( $content ) && '' !== $content
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = NavigationMenuNameModal;
|
|
7
|
-
|
|
8
|
-
var _element = require("@wordpress/element");
|
|
9
|
-
|
|
10
|
-
var _components = require("@wordpress/components");
|
|
11
|
-
|
|
12
|
-
var _i18n = require("@wordpress/i18n");
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* WordPress dependencies
|
|
16
|
-
*/
|
|
17
|
-
function NavigationMenuNameModal(_ref) {
|
|
18
|
-
let {
|
|
19
|
-
title,
|
|
20
|
-
finishButtonText = (0, _i18n.__)('Create'),
|
|
21
|
-
onFinish,
|
|
22
|
-
onRequestClose,
|
|
23
|
-
value = ''
|
|
24
|
-
} = _ref;
|
|
25
|
-
const [name, setName] = (0, _element.useState)(value);
|
|
26
|
-
return (0, _element.createElement)(_components.Modal, {
|
|
27
|
-
title: title,
|
|
28
|
-
closeLabel: (0, _i18n.__)('Cancel'),
|
|
29
|
-
onRequestClose: onRequestClose,
|
|
30
|
-
overlayClassName: "wp-block-template-part__placeholder-create-new__title-form"
|
|
31
|
-
}, (0, _element.createElement)("form", {
|
|
32
|
-
onSubmit: event => {
|
|
33
|
-
event.preventDefault();
|
|
34
|
-
onFinish(name);
|
|
35
|
-
}
|
|
36
|
-
}, (0, _element.createElement)(_components.TextControl, {
|
|
37
|
-
label: (0, _i18n.__)('Name'),
|
|
38
|
-
value: name,
|
|
39
|
-
onChange: setName
|
|
40
|
-
}), (0, _element.createElement)(_components.Flex, {
|
|
41
|
-
className: "wp-block-template-part__placeholder-create-new__title-form-actions",
|
|
42
|
-
justify: "flex-end"
|
|
43
|
-
}, (0, _element.createElement)(_components.FlexItem, null, (0, _element.createElement)(_components.Button, {
|
|
44
|
-
variant: "secondary",
|
|
45
|
-
onClick: () => {
|
|
46
|
-
onRequestClose();
|
|
47
|
-
}
|
|
48
|
-
}, (0, _i18n.__)('Cancel'))), (0, _element.createElement)(_components.FlexItem, null, (0, _element.createElement)(_components.Button, {
|
|
49
|
-
variant: "primary",
|
|
50
|
-
type: "submit",
|
|
51
|
-
disabled: !name.length,
|
|
52
|
-
"aria-disabled": !name.length
|
|
53
|
-
}, finishButtonText)))));
|
|
54
|
-
}
|
|
55
|
-
//# sourceMappingURL=navigation-menu-name-modal.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/navigation/edit/navigation-menu-name-modal.js"],"names":["NavigationMenuNameModal","title","finishButtonText","onFinish","onRequestClose","value","name","setName","event","preventDefault","length"],"mappings":";;;;;;;AAUA;;AAPA;;AAQA;;AAXA;AACA;AACA;AAWe,SAASA,uBAAT,OAMX;AAAA,MAN6C;AAChDC,IAAAA,KADgD;AAEhDC,IAAAA,gBAAgB,GAAG,cAAI,QAAJ,CAF6B;AAGhDC,IAAAA,QAHgD;AAIhDC,IAAAA,cAJgD;AAKhDC,IAAAA,KAAK,GAAG;AALwC,GAM7C;AACH,QAAM,CAAEC,IAAF,EAAQC,OAAR,IAAoB,uBAAUF,KAAV,CAA1B;AAEA,SACC,4BAAC,iBAAD;AACC,IAAA,KAAK,EAAGJ,KADT;AAEC,IAAA,UAAU,EAAG,cAAI,QAAJ,CAFd;AAGC,IAAA,cAAc,EAAGG,cAHlB;AAIC,IAAA,gBAAgB,EAAC;AAJlB,KAMC;AACC,IAAA,QAAQ,EAAKI,KAAF,IAAa;AACvBA,MAAAA,KAAK,CAACC,cAAN;AACAN,MAAAA,QAAQ,CAAEG,IAAF,CAAR;AACA;AAJF,KAMC,4BAAC,uBAAD;AACC,IAAA,KAAK,EAAG,cAAI,MAAJ,CADT;AAEC,IAAA,KAAK,EAAGA,IAFT;AAGC,IAAA,QAAQ,EAAGC;AAHZ,IAND,EAWC,4BAAC,gBAAD;AACC,IAAA,SAAS,EAAC,oEADX;AAEC,IAAA,OAAO,EAAC;AAFT,KAIC,4BAAC,oBAAD,QACC,4BAAC,kBAAD;AACC,IAAA,OAAO,EAAC,WADT;AAEC,IAAA,OAAO,EAAG,MAAM;AACfH,MAAAA,cAAc;AACd;AAJF,KAMG,cAAI,QAAJ,CANH,CADD,CAJD,EAcC,4BAAC,oBAAD,QACC,4BAAC,kBAAD;AACC,IAAA,OAAO,EAAC,SADT;AAEC,IAAA,IAAI,EAAC,QAFN;AAGC,IAAA,QAAQ,EAAG,CAAEE,IAAI,CAACI,MAHnB;AAIC,qBAAgB,CAAEJ,IAAI,CAACI;AAJxB,KAMGR,gBANH,CADD,CAdD,CAXD,CAND,CADD;AA8CA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tFlex,\n\tFlexItem,\n\tModal,\n\tTextControl,\n} from '@wordpress/components';\nimport { useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\nexport default function NavigationMenuNameModal( {\n\ttitle,\n\tfinishButtonText = __( 'Create' ),\n\tonFinish,\n\tonRequestClose,\n\tvalue = '',\n} ) {\n\tconst [ name, setName ] = useState( value );\n\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ title }\n\t\t\tcloseLabel={ __( 'Cancel' ) }\n\t\t\tonRequestClose={ onRequestClose }\n\t\t\toverlayClassName=\"wp-block-template-part__placeholder-create-new__title-form\"\n\t\t>\n\t\t\t<form\n\t\t\t\tonSubmit={ ( event ) => {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tonFinish( name );\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<TextControl\n\t\t\t\t\tlabel={ __( 'Name' ) }\n\t\t\t\t\tvalue={ name }\n\t\t\t\t\tonChange={ setName }\n\t\t\t\t/>\n\t\t\t\t<Flex\n\t\t\t\t\tclassName=\"wp-block-template-part__placeholder-create-new__title-form-actions\"\n\t\t\t\t\tjustify=\"flex-end\"\n\t\t\t\t>\n\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tonRequestClose();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</FlexItem>\n\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t\tdisabled={ ! name.length }\n\t\t\t\t\t\t\taria-disabled={ ! name.length }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ finishButtonText }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</FlexItem>\n\t\t\t\t</Flex>\n\t\t\t</form>\n\t\t</Modal>\n\t);\n}\n"]}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.default = NavigationMenuPublishButton;
|
|
9
|
-
|
|
10
|
-
var _element = require("@wordpress/element");
|
|
11
|
-
|
|
12
|
-
var _components = require("@wordpress/components");
|
|
13
|
-
|
|
14
|
-
var _coreData = require("@wordpress/core-data");
|
|
15
|
-
|
|
16
|
-
var _data = require("@wordpress/data");
|
|
17
|
-
|
|
18
|
-
var _i18n = require("@wordpress/i18n");
|
|
19
|
-
|
|
20
|
-
var _navigationMenuNameModal = _interopRequireDefault(require("./navigation-menu-name-modal"));
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* WordPress dependencies
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Internal dependencies
|
|
28
|
-
*/
|
|
29
|
-
function NavigationMenuPublishButton() {
|
|
30
|
-
const [isNameModalVisible, setIsNameModalVisible] = (0, _element.useState)(false);
|
|
31
|
-
const id = (0, _coreData.useEntityId)('postType', 'wp_navigation');
|
|
32
|
-
const [navigationMenuTitle] = (0, _coreData.useEntityProp)('postType', 'wp_navigation', 'title');
|
|
33
|
-
const {
|
|
34
|
-
editEntityRecord,
|
|
35
|
-
saveEditedEntityRecord
|
|
36
|
-
} = (0, _data.useDispatch)(_coreData.store);
|
|
37
|
-
return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_components.ToolbarButton, {
|
|
38
|
-
onClick: () => setIsNameModalVisible(true)
|
|
39
|
-
}, (0, _i18n.__)('Save as')), isNameModalVisible && (0, _element.createElement)(_navigationMenuNameModal.default, {
|
|
40
|
-
title: (0, _i18n.__)('Save your new navigation menu'),
|
|
41
|
-
value: navigationMenuTitle,
|
|
42
|
-
onRequestClose: () => setIsNameModalVisible(false),
|
|
43
|
-
finishButtonText: (0, _i18n.__)('Save'),
|
|
44
|
-
onFinish: updatedTitle => {
|
|
45
|
-
editEntityRecord('postType', 'wp_navigation', id, {
|
|
46
|
-
title: updatedTitle,
|
|
47
|
-
status: 'publish'
|
|
48
|
-
});
|
|
49
|
-
saveEditedEntityRecord('postType', 'wp_navigation', id);
|
|
50
|
-
}
|
|
51
|
-
}));
|
|
52
|
-
}
|
|
53
|
-
//# sourceMappingURL=navigation-menu-publish-button.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/navigation/edit/navigation-menu-publish-button.js"],"names":["NavigationMenuPublishButton","isNameModalVisible","setIsNameModalVisible","id","navigationMenuTitle","editEntityRecord","saveEditedEntityRecord","coreStore","updatedTitle","title","status"],"mappings":";;;;;;;;;AAUA;;AAPA;;AACA;;AAKA;;AAEA;;AAKA;;AAhBA;AACA;AACA;;AAWA;AACA;AACA;AAGe,SAASA,2BAAT,GAAuC;AACrD,QAAM,CAAEC,kBAAF,EAAsBC,qBAAtB,IAAgD,uBAAU,KAAV,CAAtD;AACA,QAAMC,EAAE,GAAG,2BAAa,UAAb,EAAyB,eAAzB,CAAX;AACA,QAAM,CAAEC,mBAAF,IAA0B,6BAC/B,UAD+B,EAE/B,eAF+B,EAG/B,OAH+B,CAAhC;AAKA,QAAM;AAAEC,IAAAA,gBAAF;AAAoBC,IAAAA;AAApB,MAA+C,uBACpDC,eADoD,CAArD;AAIA,SACC,qDACC,4BAAC,yBAAD;AAAe,IAAA,OAAO,EAAG,MAAML,qBAAqB,CAAE,IAAF;AAApD,KACG,cAAI,SAAJ,CADH,CADD,EAIGD,kBAAkB,IACnB,4BAAC,gCAAD;AACC,IAAA,KAAK,EAAG,cAAI,+BAAJ,CADT;AAEC,IAAA,KAAK,EAAGG,mBAFT;AAGC,IAAA,cAAc,EAAG,MAAMF,qBAAqB,CAAE,KAAF,CAH7C;AAIC,IAAA,gBAAgB,EAAG,cAAI,MAAJ,CAJpB;AAKC,IAAA,QAAQ,EAAKM,YAAF,IAAoB;AAC9BH,MAAAA,gBAAgB,CAAE,UAAF,EAAc,eAAd,EAA+BF,EAA/B,EAAmC;AAClDM,QAAAA,KAAK,EAAED,YAD2C;AAElDE,QAAAA,MAAM,EAAE;AAF0C,OAAnC,CAAhB;AAIAJ,MAAAA,sBAAsB,CACrB,UADqB,EAErB,eAFqB,EAGrBH,EAHqB,CAAtB;AAKA;AAfF,IALF,CADD;AA0BA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { ToolbarButton } from '@wordpress/components';\nimport {\n\tuseEntityId,\n\tuseEntityProp,\n\tstore as coreStore,\n} from '@wordpress/core-data';\nimport { useDispatch } from '@wordpress/data';\nimport { useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport NavigationMenuNameModal from './navigation-menu-name-modal';\n\nexport default function NavigationMenuPublishButton() {\n\tconst [ isNameModalVisible, setIsNameModalVisible ] = useState( false );\n\tconst id = useEntityId( 'postType', 'wp_navigation' );\n\tconst [ navigationMenuTitle ] = useEntityProp(\n\t\t'postType',\n\t\t'wp_navigation',\n\t\t'title'\n\t);\n\tconst { editEntityRecord, saveEditedEntityRecord } = useDispatch(\n\t\tcoreStore\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t<ToolbarButton onClick={ () => setIsNameModalVisible( true ) }>\n\t\t\t\t{ __( 'Save as' ) }\n\t\t\t</ToolbarButton>\n\t\t\t{ isNameModalVisible && (\n\t\t\t\t<NavigationMenuNameModal\n\t\t\t\t\ttitle={ __( 'Save your new navigation menu' ) }\n\t\t\t\t\tvalue={ navigationMenuTitle }\n\t\t\t\t\tonRequestClose={ () => setIsNameModalVisible( false ) }\n\t\t\t\t\tfinishButtonText={ __( 'Save' ) }\n\t\t\t\t\tonFinish={ ( updatedTitle ) => {\n\t\t\t\t\t\teditEntityRecord( 'postType', 'wp_navigation', id, {\n\t\t\t\t\t\t\ttitle: updatedTitle,\n\t\t\t\t\t\t\tstatus: 'publish',\n\t\t\t\t\t\t} );\n\t\t\t\t\t\tsaveEditedEntityRecord(\n\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\t'wp_navigation',\n\t\t\t\t\t\t\tid\n\t\t\t\t\t\t);\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"]}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { createElement } from "@wordpress/element";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* WordPress dependencies
|
|
5
|
-
*/
|
|
6
|
-
import { Button, Flex, FlexItem, Modal, TextControl } from '@wordpress/components';
|
|
7
|
-
import { useState } from '@wordpress/element';
|
|
8
|
-
import { __ } from '@wordpress/i18n';
|
|
9
|
-
export default function NavigationMenuNameModal(_ref) {
|
|
10
|
-
let {
|
|
11
|
-
title,
|
|
12
|
-
finishButtonText = __('Create'),
|
|
13
|
-
onFinish,
|
|
14
|
-
onRequestClose,
|
|
15
|
-
value = ''
|
|
16
|
-
} = _ref;
|
|
17
|
-
const [name, setName] = useState(value);
|
|
18
|
-
return createElement(Modal, {
|
|
19
|
-
title: title,
|
|
20
|
-
closeLabel: __('Cancel'),
|
|
21
|
-
onRequestClose: onRequestClose,
|
|
22
|
-
overlayClassName: "wp-block-template-part__placeholder-create-new__title-form"
|
|
23
|
-
}, createElement("form", {
|
|
24
|
-
onSubmit: event => {
|
|
25
|
-
event.preventDefault();
|
|
26
|
-
onFinish(name);
|
|
27
|
-
}
|
|
28
|
-
}, createElement(TextControl, {
|
|
29
|
-
label: __('Name'),
|
|
30
|
-
value: name,
|
|
31
|
-
onChange: setName
|
|
32
|
-
}), createElement(Flex, {
|
|
33
|
-
className: "wp-block-template-part__placeholder-create-new__title-form-actions",
|
|
34
|
-
justify: "flex-end"
|
|
35
|
-
}, createElement(FlexItem, null, createElement(Button, {
|
|
36
|
-
variant: "secondary",
|
|
37
|
-
onClick: () => {
|
|
38
|
-
onRequestClose();
|
|
39
|
-
}
|
|
40
|
-
}, __('Cancel'))), createElement(FlexItem, null, createElement(Button, {
|
|
41
|
-
variant: "primary",
|
|
42
|
-
type: "submit",
|
|
43
|
-
disabled: !name.length,
|
|
44
|
-
"aria-disabled": !name.length
|
|
45
|
-
}, finishButtonText)))));
|
|
46
|
-
}
|
|
47
|
-
//# sourceMappingURL=navigation-menu-name-modal.js.map
|