@wordpress/block-library 6.0.9 → 6.0.13
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 +3 -2
- 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-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 +3 -2
- 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-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 +5 -1
- package/build-style/navigation/style.css +5 -1
- 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 +5 -1
- package/build-style/style.css +5 -1
- 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 +27 -25
- 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 +5 -1
- package/src/navigation/use-navigation-menu.js +20 -9
- package/src/navigation-submenu/edit.js +6 -0
- package/src/navigation-submenu/index.php +30 -45
- package/src/page-list/index.php +10 -9
- 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
|
@@ -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;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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;A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press/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,97 +0,0 @@
|
|
|
1
|
-
import { createElement } from "@wordpress/element";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* WordPress dependencies
|
|
5
|
-
*/
|
|
6
|
-
import { Button, Modal } from '@wordpress/components';
|
|
7
|
-
import { __ } from '@wordpress/i18n';
|
|
8
|
-
import { useDispatch, useSelect } from '@wordpress/data';
|
|
9
|
-
import { createBlock } from '@wordpress/blocks';
|
|
10
|
-
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
11
|
-
/**
|
|
12
|
-
* Internal dependencies
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
import { LINK_DESTINATION_ATTACHMENT, LINK_DESTINATION_NONE, LINK_DESTINATION_MEDIA } from './constants';
|
|
16
|
-
export const updateGallery = _ref => {
|
|
17
|
-
let {
|
|
18
|
-
clientId,
|
|
19
|
-
getBlock,
|
|
20
|
-
replaceBlocks
|
|
21
|
-
} = _ref;
|
|
22
|
-
return () => {
|
|
23
|
-
let link;
|
|
24
|
-
const {
|
|
25
|
-
attributes: {
|
|
26
|
-
sizeSlug,
|
|
27
|
-
linkTo,
|
|
28
|
-
images,
|
|
29
|
-
caption
|
|
30
|
-
}
|
|
31
|
-
} = getBlock(clientId);
|
|
32
|
-
|
|
33
|
-
switch (linkTo) {
|
|
34
|
-
case 'post':
|
|
35
|
-
link = LINK_DESTINATION_ATTACHMENT;
|
|
36
|
-
break;
|
|
37
|
-
|
|
38
|
-
case 'file':
|
|
39
|
-
link = LINK_DESTINATION_MEDIA;
|
|
40
|
-
break;
|
|
41
|
-
|
|
42
|
-
default:
|
|
43
|
-
link = LINK_DESTINATION_NONE;
|
|
44
|
-
break;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
const innerBlocks = images.map(image => createBlock('core/image', {
|
|
48
|
-
id: parseInt(image.id, 10),
|
|
49
|
-
url: image.url,
|
|
50
|
-
alt: image.alt,
|
|
51
|
-
caption: image.caption,
|
|
52
|
-
linkDestination: link
|
|
53
|
-
}));
|
|
54
|
-
replaceBlocks(clientId, createBlock('core/gallery', {
|
|
55
|
-
sizeSlug,
|
|
56
|
-
linkTo: link,
|
|
57
|
-
caption
|
|
58
|
-
}, innerBlocks));
|
|
59
|
-
};
|
|
60
|
-
};
|
|
61
|
-
export default function UpdateGalleryModal(_ref2) {
|
|
62
|
-
let {
|
|
63
|
-
onClose,
|
|
64
|
-
clientId
|
|
65
|
-
} = _ref2;
|
|
66
|
-
const {
|
|
67
|
-
getBlock
|
|
68
|
-
} = useSelect(blockEditorStore);
|
|
69
|
-
const {
|
|
70
|
-
replaceBlocks
|
|
71
|
-
} = useDispatch(blockEditorStore);
|
|
72
|
-
return createElement(Modal, {
|
|
73
|
-
closeLabel: __('Close'),
|
|
74
|
-
onRequestClose: onClose,
|
|
75
|
-
title: __('Update gallery'),
|
|
76
|
-
className: 'wp-block-update-gallery-modal',
|
|
77
|
-
aria: {
|
|
78
|
-
describedby: 'wp-block-update-gallery-modal__description'
|
|
79
|
-
}
|
|
80
|
-
}, createElement("p", {
|
|
81
|
-
id: 'wp-block-update-gallery-modal__description'
|
|
82
|
-
}, __('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.')), createElement("div", {
|
|
83
|
-
className: "wp-block-update-gallery-modal-buttons"
|
|
84
|
-
}, createElement(Button, {
|
|
85
|
-
isTertiary: true,
|
|
86
|
-
onClick: onClose
|
|
87
|
-
}, __('Cancel')), createElement(Button, {
|
|
88
|
-
isPrimary: true,
|
|
89
|
-
onClick: updateGallery({
|
|
90
|
-
replaceBlocks,
|
|
91
|
-
getBlock,
|
|
92
|
-
clientId,
|
|
93
|
-
createBlock
|
|
94
|
-
})
|
|
95
|
-
}, __('Update'))));
|
|
96
|
-
}
|
|
97
|
-
//# sourceMappingURL=update-gallery-modal.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/gallery/v1/update-gallery-modal.js"],"names":["Button","Modal","__","useDispatch","useSelect","createBlock","store","blockEditorStore","LINK_DESTINATION_ATTACHMENT","LINK_DESTINATION_NONE","LINK_DESTINATION_MEDIA","updateGallery","clientId","getBlock","replaceBlocks","link","attributes","sizeSlug","linkTo","images","caption","innerBlocks","map","image","id","parseInt","url","alt","linkDestination","UpdateGalleryModal","onClose","describedby"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,MAAT,EAAiBC,KAAjB,QAA8B,uBAA9B;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,WAAT,QAA4B,mBAA5B;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,yBAA1C;AAEA;AACA;AACA;;AACA,SACCC,2BADD,EAECC,qBAFD,EAGCC,sBAHD,QAIO,aAJP;AAMA,OAAO,MAAMC,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,GAAGP,2BAAP;AACA;;AACD,WAAK,MAAL;AACCO,QAAAA,I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,MAAD;AAAQ,IAAA,UAAU,MAAlB;AAAmB,IAAA,OAAO,EAAG4B;AAA7B,KACG5B,EAAE,CAAE,QAAF,CADL,CADD,EAIC,cAAC,MAAD;AACC,IAAA,SAAS,MADV;AAEC,IAAA,OAAO,EAAGS,aAAa,CAAE;AACxBG,MAAAA,aADwB;AAExBD,MAAAA,QAFwB;AAGxBD,MAAAA,QAHwB;AAIxBP,MAAAA;AAJwB,KAAF;AAFxB,KASGH,EAAE,CAAE,QAAF,CATL,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"]}
|