@wordpress/block-library 6.0.8 → 6.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cover/edit.js +9 -3
- package/build/cover/edit.js.map +1 -1
- package/build/gallery/deprecated.js +314 -26
- package/build/gallery/deprecated.js.map +1 -1
- package/build/gallery/edit-wrapper.js +10 -27
- package/build/gallery/edit-wrapper.js.map +1 -1
- package/build/gallery/edit.js +11 -13
- package/build/gallery/edit.js.map +1 -1
- package/build/gallery/save.js +3 -3
- package/build/gallery/save.js.map +1 -1
- package/build/gallery/shared.js +24 -0
- package/build/gallery/shared.js.map +1 -1
- package/build/gallery/transforms.js +8 -22
- package/build/gallery/transforms.js.map +1 -1
- package/build/gallery/use-mobile-warning.js +1 -1
- package/build/gallery/use-mobile-warning.js.map +1 -1
- package/build/gallery/v1/edit.js +2 -21
- package/build/gallery/v1/edit.js.map +1 -1
- package/build/index.js +4 -3
- package/build/index.js.map +1 -1
- package/build/navigation/deprecated.js +127 -19
- package/build/navigation/deprecated.js.map +1 -1
- package/build/navigation/edit/index.js +46 -31
- package/build/navigation/edit/index.js.map +1 -1
- package/build/navigation/edit/inner-blocks.js +0 -4
- package/build/navigation/edit/inner-blocks.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/navigation-area/edit.js +5 -0
- package/build/navigation-area/edit.js.map +1 -1
- package/build/navigation-submenu/edit.js +4 -0
- package/build/navigation-submenu/edit.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-pagination/index.js +1 -1
- package/build/query-pagination-next/index.js +2 -2
- package/build/query-pagination-numbers/index.js +1 -1
- package/build/query-pagination-previous/index.js +2 -2
- package/build/query-title/index.js +1 -1
- package/build/separator/separator-settings.js +1 -0
- package/build/separator/separator-settings.js.map +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/social-links/edit.js +1 -0
- package/build/social-links/edit.js.map +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 +9 -3
- package/build-module/cover/edit.js.map +1 -1
- package/build-module/gallery/deprecated.js +309 -27
- package/build-module/gallery/deprecated.js.map +1 -1
- package/build-module/gallery/edit-wrapper.js +7 -27
- package/build-module/gallery/edit-wrapper.js.map +1 -1
- package/build-module/gallery/edit.js +11 -13
- package/build-module/gallery/edit.js.map +1 -1
- package/build-module/gallery/save.js +2 -3
- package/build-module/gallery/save.js.map +1 -1
- package/build-module/gallery/shared.js +22 -0
- package/build-module/gallery/shared.js.map +1 -1
- package/build-module/gallery/transforms.js +9 -21
- package/build-module/gallery/transforms.js.map +1 -1
- package/build-module/gallery/use-mobile-warning.js +1 -1
- package/build-module/gallery/use-mobile-warning.js.map +1 -1
- package/build-module/gallery/v1/edit.js +4 -22
- package/build-module/gallery/v1/edit.js.map +1 -1
- package/build-module/index.js +4 -3
- package/build-module/index.js.map +1 -1
- package/build-module/navigation/deprecated.js +127 -19
- package/build-module/navigation/deprecated.js.map +1 -1
- package/build-module/navigation/edit/index.js +47 -31
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/navigation/edit/inner-blocks.js +0 -4
- package/build-module/navigation/edit/inner-blocks.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/navigation-area/edit.js +4 -0
- package/build-module/navigation-area/edit.js.map +1 -1
- package/build-module/navigation-submenu/edit.js +4 -0
- package/build-module/navigation-submenu/edit.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-pagination/index.js +1 -1
- package/build-module/query-pagination-next/index.js +2 -2
- package/build-module/query-pagination-numbers/index.js +1 -1
- package/build-module/query-pagination-previous/index.js +2 -2
- package/build-module/query-title/index.js +1 -1
- package/build-module/separator/separator-settings.js +1 -0
- package/build-module/separator/separator-settings.js.map +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/social-links/edit.js +1 -0
- package/build-module/social-links/edit.js.map +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/columns/editor-rtl.css +1 -1
- package/build-style/columns/editor.css +1 -1
- package/build-style/editor-rtl.css +6 -5
- package/build-style/editor.css +6 -5
- package/build-style/gallery/editor-rtl.css +1 -0
- package/build-style/gallery/editor.css +1 -0
- package/build-style/navigation/style-rtl.css +12 -3
- package/build-style/navigation/style.css +12 -3
- 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/build-style/style-rtl.css +12 -3
- package/build-style/style.css +12 -3
- package/package.json +9 -9
- package/src/calendar/index.php +2 -2
- package/src/columns/editor.scss +3 -2
- package/src/cover/edit.js +9 -1
- package/src/gallery/deprecated.js +831 -559
- package/src/gallery/edit-wrapper.js +7 -27
- package/src/gallery/edit.js +11 -13
- package/src/gallery/editor.scss +1 -0
- package/src/gallery/save.js +2 -1
- package/src/gallery/shared.js +24 -0
- package/src/gallery/transforms.js +9 -27
- package/src/gallery/use-mobile-warning.js +1 -1
- package/src/gallery/v1/edit.js +1 -28
- package/src/index.js +28 -26
- package/src/navigation/block.json +1 -1
- package/src/navigation/deprecated.js +115 -13
- package/src/navigation/edit/index.js +44 -36
- package/src/navigation/edit/inner-blocks.js +0 -5
- 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 +263 -26
- package/src/navigation/save.js +2 -2
- package/src/navigation/style.scss +15 -4
- package/src/navigation/use-navigation-menu.js +20 -9
- package/src/navigation-area/edit.js +5 -0
- package/src/navigation-area/index.php +1 -0
- package/src/navigation-submenu/edit.js +6 -0
- package/src/navigation-submenu/index.php +30 -45
- package/src/page-list/index.php +14 -13
- 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-pagination/block.json +1 -1
- package/src/query-pagination-next/block.json +2 -2
- package/src/query-pagination-numbers/block.json +1 -1
- package/src/query-pagination-previous/block.json +2 -2
- package/src/query-title/block.json +1 -1
- package/src/separator/separator-settings.js +1 -0
- 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/social-links/edit.js +1 -0
- package/src/template-part/block.json +2 -1
- package/src/template-part/edit/placeholder/index.js +2 -2
- package/src/template-part/index.php +38 -1
- package/build/gallery/v1/update-gallery-modal.js +0 -114
- package/build/gallery/v1/update-gallery-modal.js.map +0 -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/gallery/v1/update-gallery-modal.js +0 -97
- package/build-module/gallery/v1/update-gallery-modal.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/gallery/v1/update-gallery-modal.js +0 -97
- package/src/navigation/edit/navigation-menu-name-modal.js +0 -69
- package/src/navigation/edit/navigation-menu-publish-button.js +0 -57
package/src/page-list/index.php
CHANGED
|
@@ -34,7 +34,7 @@ function block_core_page_list_build_css_colors( $attributes, $context ) {
|
|
|
34
34
|
|
|
35
35
|
if ( $has_named_text_color ) {
|
|
36
36
|
// Add the color class.
|
|
37
|
-
$colors['css_classes'][] = sprintf( 'has-%s-color',
|
|
37
|
+
$colors['css_classes'][] = sprintf( 'has-%s-color', _wp_to_kebab_case( $context['textColor'] ) );
|
|
38
38
|
} elseif ( $has_picked_text_color ) {
|
|
39
39
|
$colors['inline_styles'] .= sprintf( 'color: %s;', $context['customTextColor'] );
|
|
40
40
|
} elseif ( $has_custom_text_color ) {
|
|
@@ -55,7 +55,7 @@ function block_core_page_list_build_css_colors( $attributes, $context ) {
|
|
|
55
55
|
|
|
56
56
|
if ( $has_named_background_color ) {
|
|
57
57
|
// Add the background-color class.
|
|
58
|
-
$colors['css_classes'][] = sprintf( 'has-%s-background-color',
|
|
58
|
+
$colors['css_classes'][] = sprintf( 'has-%s-background-color', _wp_to_kebab_case( $context['backgroundColor'] ) );
|
|
59
59
|
} elseif ( $has_picked_background_color ) {
|
|
60
60
|
$colors['inline_styles'] .= sprintf( 'background-color: %s;', $context['customBackgroundColor'] );
|
|
61
61
|
} elseif ( $has_custom_background_color ) {
|
|
@@ -74,7 +74,7 @@ function block_core_page_list_build_css_colors( $attributes, $context ) {
|
|
|
74
74
|
|
|
75
75
|
// Give overlay colors priority, fall back to Navigation block colors, then global styles.
|
|
76
76
|
if ( $has_named_overlay_text_color ) {
|
|
77
|
-
$colors['overlay_css_classes'][] = sprintf( 'has-%s-color',
|
|
77
|
+
$colors['overlay_css_classes'][] = sprintf( 'has-%s-color', _wp_to_kebab_case( $context['overlayTextColor'] ) );
|
|
78
78
|
} elseif ( $has_picked_overlay_text_color ) {
|
|
79
79
|
$colors['overlay_inline_styles'] .= sprintf( 'color: %s;', $context['customOverlayTextColor'] );
|
|
80
80
|
}
|
|
@@ -89,7 +89,7 @@ function block_core_page_list_build_css_colors( $attributes, $context ) {
|
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
if ( $has_named_overlay_background_color ) {
|
|
92
|
-
$colors['overlay_css_classes'][] = sprintf( 'has-%s-background-color',
|
|
92
|
+
$colors['overlay_css_classes'][] = sprintf( 'has-%s-background-color', _wp_to_kebab_case( $context['overlayBackgroundColor'] ) );
|
|
93
93
|
} elseif ( $has_picked_overlay_background_color ) {
|
|
94
94
|
$colors['overlay_inline_styles'] .= sprintf( 'background-color: %s;', $context['customOverlayBackgroundColor'] );
|
|
95
95
|
}
|
|
@@ -173,24 +173,20 @@ function block_core_page_list_render_nested_page_list( $open_submenus_on_click,
|
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
175
|
|
|
176
|
+
$title = wp_kses( $page['title'], wp_kses_allowed_html( 'post' ) );
|
|
177
|
+
|
|
176
178
|
$markup .= '<li class="wp-block-pages-list__item' . $css_class . '"' . $style_attribute . '>';
|
|
177
179
|
|
|
178
180
|
if ( isset( $page['children'] ) && $is_navigation_child && $open_submenus_on_click ) {
|
|
179
|
-
$markup .= '<button class="' . $navigation_child_content_class . ' wp-block-navigation-submenu__toggle" aria-expanded="false">' .
|
|
180
|
-
$page['title'],
|
|
181
|
-
wp_kses_allowed_html( 'post' )
|
|
182
|
-
) . '<span class="wp-block-page-list__submenu-icon wp-block-navigation__submenu-icon"><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></span>' .
|
|
181
|
+
$markup .= '<button aria-label="' . $title . ' ' . __( 'submenu', 'gutenberg' ) . '" class="' . $navigation_child_content_class . ' wp-block-navigation-submenu__toggle" aria-expanded="false">' . $title . '<span class="wp-block-page-list__submenu-icon wp-block-navigation__submenu-icon"><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></span>' .
|
|
183
182
|
'</button>';
|
|
184
183
|
} else {
|
|
185
|
-
$markup .= '<a class="wp-block-pages-list__item__link' . $navigation_child_content_class . '" href="' . esc_url( $page['link'] ) . '"' . $aria_current . '>' .
|
|
186
|
-
$page['title'],
|
|
187
|
-
wp_kses_allowed_html( 'post' )
|
|
188
|
-
) . '</a>';
|
|
184
|
+
$markup .= '<a class="wp-block-pages-list__item__link' . $navigation_child_content_class . '" href="' . esc_url( $page['link'] ) . '"' . $aria_current . '>' . $title . '</a>';
|
|
189
185
|
}
|
|
190
186
|
|
|
191
187
|
if ( isset( $page['children'] ) ) {
|
|
192
188
|
if ( $is_navigation_child && $show_submenu_icons && ! $open_submenus_on_click ) {
|
|
193
|
-
$markup .= '<button class="wp-block-navigation__submenu-icon wp-block-navigation-submenu__toggle" aria-expanded="false">';
|
|
189
|
+
$markup .= '<button aria-label="' . $title . ' ' . __( 'submenu', 'gutenberg' ) . '" class="wp-block-navigation__submenu-icon wp-block-navigation-submenu__toggle" aria-expanded="false">';
|
|
194
190
|
$markup .= '<span class="wp-block-page-list__submenu-icon wp-block-navigation__submenu-icon"><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></span>';
|
|
195
191
|
$markup .= '</button>';
|
|
196
192
|
}
|
|
@@ -293,6 +289,11 @@ function render_block_core_page_list( $attributes, $content, $block ) {
|
|
|
293
289
|
|
|
294
290
|
$nested_pages = block_core_page_list_nest_pages( $top_level_pages, $pages_with_children );
|
|
295
291
|
|
|
292
|
+
// Limit the number of items to be visually displayed.
|
|
293
|
+
if ( ! empty( $attributes['__unstableMaxPages'] ) ) {
|
|
294
|
+
$nested_pages = array_slice( $nested_pages, 0, $attributes['__unstableMaxPages'] );
|
|
295
|
+
}
|
|
296
|
+
|
|
296
297
|
$is_navigation_child = array_key_exists( 'showSubmenuIcon', $block->context );
|
|
297
298
|
|
|
298
299
|
$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
|
);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"apiVersion": 2,
|
|
3
3
|
"name": "core/query-pagination-next",
|
|
4
|
-
"title": "
|
|
4
|
+
"title": "Next Page",
|
|
5
5
|
"category": "design",
|
|
6
6
|
"parent": [ "core/query-pagination" ],
|
|
7
7
|
"description": "Displays the next posts page link.",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"html": false,
|
|
18
18
|
"color": {
|
|
19
19
|
"gradients": true,
|
|
20
|
-
"
|
|
20
|
+
"text": false
|
|
21
21
|
},
|
|
22
22
|
"typography": {
|
|
23
23
|
"fontSize": true,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"apiVersion": 2,
|
|
3
3
|
"name": "core/query-pagination-previous",
|
|
4
|
-
"title": "
|
|
4
|
+
"title": "Previous Page",
|
|
5
5
|
"category": "design",
|
|
6
6
|
"parent": [ "core/query-pagination" ],
|
|
7
7
|
"description": "Displays the previous posts page link.",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"html": false,
|
|
18
18
|
"color": {
|
|
19
19
|
"gradients": true,
|
|
20
|
-
"
|
|
20
|
+
"text": false
|
|
21
21
|
},
|
|
22
22
|
"typography": {
|
|
23
23
|
"fontSize": true,
|
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": {
|
package/src/social-links/edit.js
CHANGED
|
@@ -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.
|
|
@@ -50,16 +50,53 @@ function render_block_core_template_part( $attributes ) {
|
|
|
50
50
|
if ( ! is_wp_error( $area_terms ) && false !== $area_terms ) {
|
|
51
51
|
$area = $area_terms[0]->name;
|
|
52
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* Fires when a block template part is loaded from a template post stored in the database.
|
|
55
|
+
*
|
|
56
|
+
* @since 5.9.0
|
|
57
|
+
*
|
|
58
|
+
* @param string $template_part_id The requested template part namespaced to the theme.
|
|
59
|
+
* @param array $attributes The block attributes.
|
|
60
|
+
* @param WP_Post $template_part_post The template part post object.
|
|
61
|
+
* @param string $content The template part content.
|
|
62
|
+
*/
|
|
63
|
+
do_action( 'render_block_core_template_part_post', $template_part_id, $attributes, $template_part_post, $content );
|
|
53
64
|
} else {
|
|
54
65
|
// Else, if the template part was provided by the active theme,
|
|
55
66
|
// render the corresponding file content.
|
|
56
|
-
$
|
|
67
|
+
$theme_folders = get_block_theme_folders();
|
|
68
|
+
$template_part_file_path = get_theme_file_path( '/' . $theme_folders['wp_template_part'] . '/' . $attributes['slug'] . '.html' );
|
|
57
69
|
if ( 0 === validate_file( $attributes['slug'] ) && file_exists( $template_part_file_path ) ) {
|
|
58
70
|
$content = file_get_contents( $template_part_file_path );
|
|
59
71
|
$content = is_string( $content ) && '' !== $content
|
|
60
72
|
? _inject_theme_attribute_in_block_template_content( $content )
|
|
61
73
|
: '';
|
|
62
74
|
}
|
|
75
|
+
|
|
76
|
+
if ( '' !== $content && null !== $content ) {
|
|
77
|
+
/**
|
|
78
|
+
* Fires when a block template part is loaded from a template part in the theme.
|
|
79
|
+
*
|
|
80
|
+
* @since 5.9.0
|
|
81
|
+
*
|
|
82
|
+
* @param string $template_part_id The requested template part namespaced to the theme.
|
|
83
|
+
* @param array $attributes The block attributes.
|
|
84
|
+
* @param string $template_part_file_path Absolute path to the template path.
|
|
85
|
+
* @param string $content The template part content.
|
|
86
|
+
*/
|
|
87
|
+
do_action( 'render_block_core_template_part_file', $template_part_id, $attributes, $template_part_file_path, $content );
|
|
88
|
+
} else {
|
|
89
|
+
/**
|
|
90
|
+
* Fires when a requested block template part does not exist in the database nor in the theme.
|
|
91
|
+
*
|
|
92
|
+
* @since 5.9.0
|
|
93
|
+
*
|
|
94
|
+
* @param string $template_part_id The requested template part namespaced to the theme.
|
|
95
|
+
* @param array $attributes The block attributes.
|
|
96
|
+
* @param string $template_part_file_path Absolute path to the not found template path.
|
|
97
|
+
*/
|
|
98
|
+
do_action( 'render_block_core_template_part_none', $template_part_id, $attributes, $template_part_file_path );
|
|
99
|
+
}
|
|
63
100
|
}
|
|
64
101
|
}
|
|
65
102
|
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = UpdateGalleryModal;
|
|
7
|
-
exports.updateGallery = void 0;
|
|
8
|
-
|
|
9
|
-
var _element = require("@wordpress/element");
|
|
10
|
-
|
|
11
|
-
var _components = require("@wordpress/components");
|
|
12
|
-
|
|
13
|
-
var _i18n = require("@wordpress/i18n");
|
|
14
|
-
|
|
15
|
-
var _data = require("@wordpress/data");
|
|
16
|
-
|
|
17
|
-
var _blocks = require("@wordpress/blocks");
|
|
18
|
-
|
|
19
|
-
var _blockEditor = require("@wordpress/block-editor");
|
|
20
|
-
|
|
21
|
-
var _constants = require("./constants");
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* WordPress dependencies
|
|
25
|
-
*/
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Internal dependencies
|
|
29
|
-
*/
|
|
30
|
-
const updateGallery = _ref => {
|
|
31
|
-
let {
|
|
32
|
-
clientId,
|
|
33
|
-
getBlock,
|
|
34
|
-
replaceBlocks
|
|
35
|
-
} = _ref;
|
|
36
|
-
return () => {
|
|
37
|
-
let link;
|
|
38
|
-
const {
|
|
39
|
-
attributes: {
|
|
40
|
-
sizeSlug,
|
|
41
|
-
linkTo,
|
|
42
|
-
images,
|
|
43
|
-
caption
|
|
44
|
-
}
|
|
45
|
-
} = getBlock(clientId);
|
|
46
|
-
|
|
47
|
-
switch (linkTo) {
|
|
48
|
-
case 'post':
|
|
49
|
-
link = _constants.LINK_DESTINATION_ATTACHMENT;
|
|
50
|
-
break;
|
|
51
|
-
|
|
52
|
-
case 'file':
|
|
53
|
-
link = _constants.LINK_DESTINATION_MEDIA;
|
|
54
|
-
break;
|
|
55
|
-
|
|
56
|
-
default:
|
|
57
|
-
link = _constants.LINK_DESTINATION_NONE;
|
|
58
|
-
break;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
const innerBlocks = images.map(image => (0, _blocks.createBlock)('core/image', {
|
|
62
|
-
id: parseInt(image.id, 10),
|
|
63
|
-
url: image.url,
|
|
64
|
-
alt: image.alt,
|
|
65
|
-
caption: image.caption,
|
|
66
|
-
linkDestination: link
|
|
67
|
-
}));
|
|
68
|
-
replaceBlocks(clientId, (0, _blocks.createBlock)('core/gallery', {
|
|
69
|
-
sizeSlug,
|
|
70
|
-
linkTo: link,
|
|
71
|
-
caption
|
|
72
|
-
}, innerBlocks));
|
|
73
|
-
};
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
exports.updateGallery = updateGallery;
|
|
77
|
-
|
|
78
|
-
function UpdateGalleryModal(_ref2) {
|
|
79
|
-
let {
|
|
80
|
-
onClose,
|
|
81
|
-
clientId
|
|
82
|
-
} = _ref2;
|
|
83
|
-
const {
|
|
84
|
-
getBlock
|
|
85
|
-
} = (0, _data.useSelect)(_blockEditor.store);
|
|
86
|
-
const {
|
|
87
|
-
replaceBlocks
|
|
88
|
-
} = (0, _data.useDispatch)(_blockEditor.store);
|
|
89
|
-
return (0, _element.createElement)(_components.Modal, {
|
|
90
|
-
closeLabel: (0, _i18n.__)('Close'),
|
|
91
|
-
onRequestClose: onClose,
|
|
92
|
-
title: (0, _i18n.__)('Update gallery'),
|
|
93
|
-
className: 'wp-block-update-gallery-modal',
|
|
94
|
-
aria: {
|
|
95
|
-
describedby: 'wp-block-update-gallery-modal__description'
|
|
96
|
-
}
|
|
97
|
-
}, (0, _element.createElement)("p", {
|
|
98
|
-
id: 'wp-block-update-gallery-modal__description'
|
|
99
|
-
}, (0, _i18n.__)('Updating to the new format adds the ability to use custom links or styles on individual images in the gallery, and makes it easier to add or move them around.')), (0, _element.createElement)("div", {
|
|
100
|
-
className: "wp-block-update-gallery-modal-buttons"
|
|
101
|
-
}, (0, _element.createElement)(_components.Button, {
|
|
102
|
-
isTertiary: true,
|
|
103
|
-
onClick: onClose
|
|
104
|
-
}, (0, _i18n.__)('Cancel')), (0, _element.createElement)(_components.Button, {
|
|
105
|
-
isPrimary: true,
|
|
106
|
-
onClick: updateGallery({
|
|
107
|
-
replaceBlocks,
|
|
108
|
-
getBlock,
|
|
109
|
-
clientId,
|
|
110
|
-
createBlock: _blocks.createBlock
|
|
111
|
-
})
|
|
112
|
-
}, (0, _i18n.__)('Update'))));
|
|
113
|
-
}
|
|
114
|
-
//# sourceMappingURL=update-gallery-modal.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/gallery/v1/update-gallery-modal.js"],"names":["updateGallery","clientId","getBlock","replaceBlocks","link","attributes","sizeSlug","linkTo","images","caption","LINK_DESTINATION_ATTACHMENT","LINK_DESTINATION_MEDIA","LINK_DESTINATION_NONE","innerBlocks","map","image","id","parseInt","url","alt","linkDestination","UpdateGalleryModal","onClose","blockEditorStore","describedby","createBlock"],"mappings":";;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AAZA;AACA;AACA;;AAOA;AACA;AACA;AAOO,MAAMA,aAAa,GAAG;AAAA,MAAE;AAC9BC,IAAAA,QAD8B;AAE9BC,IAAAA,QAF8B;AAG9BC,IAAAA;AAH8B,GAAF;AAAA,SAItB,MAAM;AACZ,QAAIC,IAAJ;AACA,UAAM;AACLC,MAAAA,UAAU,EAAE;AAAEC,QAAAA,QAAF;AAAYC,QAAAA,MAAZ;AAAoBC,QAAAA,MAApB;AAA4BC,QAAAA;AAA5B;AADP,QAEFP,QAAQ,CAAED,QAAF,CAFZ;;AAIA,YAASM,MAAT;AACC,WAAK,MAAL;AACCH,QAAAA,IAAI,GAAGM,sCAAP;AACA;;AACD,WAAK,MAAL;AACCN,QAAAA,IAAI,GAAGO,iCAAP;AACA;;AACD;AACCP,QAAAA,IAAI,GAAGQ,gCAAP;AACA;AATF;;AAWA,UAAMC,WAAW,GAAGL,MAAM,CAACM,GAAP,CAAcC,KAAF,IAC/B,yBAAa,YAAb,EAA2B;AAC1BC,MAAAA,EAAE,EAAEC,QAAQ,CAAEF,KAAK,CAACC,EAAR,EAAY,EAAZ,CADc;AAE1BE,MAAAA,GAAG,EAAEH,KAAK,CAACG,GAFe;AAG1BC,MAAAA,GAAG,EAAEJ,KAAK,CAACI,GAHe;AAI1BV,MAAAA,OAAO,EAAEM,KAAK,CAACN,OAJW;AAK1BW,MAAAA,eAAe,EAAEhB;AALS,KAA3B,CADmB,CAApB;AAUAD,IAAAA,aAAa,CACZF,QADY,EAEZ,yBACC,cADD,EAEC;AAAEK,MAAAA,QAAF;AAAYC,MAAAA,MAAM,EAAEH,IAApB;AAA0BK,MAAAA;AAA1B,KAFD,EAGCI,WAHD,CAFY,CAAb;AAQA,GAvC4B;AAAA,CAAtB;;;;AAyCQ,SAASQ,kBAAT,QAAqD;AAAA,MAAxB;AAAEC,IAAAA,OAAF;AAAWrB,IAAAA;AAAX,GAAwB;AACnE,QAAM;AAAEC,IAAAA;AAAF,MAAe,qBAAWqB,kBAAX,CAArB;AACA,QAAM;AAAEpB,IAAAA;AAAF,MAAoB,uBAAaoB,kBAAb,CAA1B;AACA,SACC,4BAAC,iBAAD;AACC,IAAA,UAAU,EAAG,cAAI,OAAJ,CADd;AAEC,IAAA,cAAc,EAAGD,OAFlB;AAGC,IAAA,KAAK,EAAG,cAAI,gBAAJ,CAHT;AAIC,IAAA,SAAS,EAAG,+BAJb;AAKC,IAAA,IAAI,EAAG;AACNE,MAAAA,WAAW,EAAE;AADP;AALR,KASC;AAAG,IAAA,EAAE,EAAG;AAAR,KACG,cACD,gKADC,CADH,CATD,EAeC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,4BAAC,kBAAD;AAAQ,IAAA,UAAU,MAAlB;AAAmB,IAAA,OAAO,EAAGF;AAA7B,KACG,cAAI,QAAJ,CADH,CADD,EAIC,4BAAC,kBAAD;AACC,IAAA,SAAS,MADV;AAEC,IAAA,OAAO,EAAGtB,aAAa,CAAE;AACxBG,MAAAA,aADwB;AAExBD,MAAAA,QAFwB;AAGxBD,MAAAA,QAHwB;AAIxBwB,MAAAA,WAAW,EAAXA;AAJwB,KAAF;AAFxB,KASG,cAAI,QAAJ,CATH,CAJD,CAfD,CADD;AAkCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Button, Modal } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { createBlock } from '@wordpress/blocks';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport {\n\tLINK_DESTINATION_ATTACHMENT,\n\tLINK_DESTINATION_NONE,\n\tLINK_DESTINATION_MEDIA,\n} from './constants';\n\nexport const updateGallery = ( {\n\tclientId,\n\tgetBlock,\n\treplaceBlocks,\n} ) => () => {\n\tlet link;\n\tconst {\n\t\tattributes: { sizeSlug, linkTo, images, caption },\n\t} = getBlock( clientId );\n\n\tswitch ( linkTo ) {\n\t\tcase 'post':\n\t\t\tlink = LINK_DESTINATION_ATTACHMENT;\n\t\t\tbreak;\n\t\tcase 'file':\n\t\t\tlink = LINK_DESTINATION_MEDIA;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tlink = LINK_DESTINATION_NONE;\n\t\t\tbreak;\n\t}\n\tconst innerBlocks = images.map( ( image ) =>\n\t\tcreateBlock( 'core/image', {\n\t\t\tid: parseInt( image.id, 10 ),\n\t\t\turl: image.url,\n\t\t\talt: image.alt,\n\t\t\tcaption: image.caption,\n\t\t\tlinkDestination: link,\n\t\t} )\n\t);\n\n\treplaceBlocks(\n\t\tclientId,\n\t\tcreateBlock(\n\t\t\t'core/gallery',\n\t\t\t{ sizeSlug, linkTo: link, caption },\n\t\t\tinnerBlocks\n\t\t)\n\t);\n};\n\nexport default function UpdateGalleryModal( { onClose, clientId } ) {\n\tconst { getBlock } = useSelect( blockEditorStore );\n\tconst { replaceBlocks } = useDispatch( blockEditorStore );\n\treturn (\n\t\t<Modal\n\t\t\tcloseLabel={ __( 'Close' ) }\n\t\t\tonRequestClose={ onClose }\n\t\t\ttitle={ __( 'Update gallery' ) }\n\t\t\tclassName={ 'wp-block-update-gallery-modal' }\n\t\t\taria={ {\n\t\t\t\tdescribedby: 'wp-block-update-gallery-modal__description',\n\t\t\t} }\n\t\t>\n\t\t\t<p id={ 'wp-block-update-gallery-modal__description' }>\n\t\t\t\t{ __(\n\t\t\t\t\t'Updating to the new format adds the ability to use custom links or styles on individual images in the gallery, and makes it easier to add or move them around.'\n\t\t\t\t) }\n\t\t\t</p>\n\n\t\t\t<div className=\"wp-block-update-gallery-modal-buttons\">\n\t\t\t\t<Button isTertiary onClick={ onClose }>\n\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t</Button>\n\t\t\t\t<Button\n\t\t\t\t\tisPrimary\n\t\t\t\t\tonClick={ updateGallery( {\n\t\t\t\t\t\treplaceBlocks,\n\t\t\t\t\t\tgetBlock,\n\t\t\t\t\t\tclientId,\n\t\t\t\t\t\tcreateBlock,\n\t\t\t\t\t} ) }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Update' ) }\n\t\t\t\t</Button>\n\t\t\t</div>\n\t\t</Modal>\n\t);\n}\n"]}
|
|
@@ -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"]}
|