@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.
Files changed (208) hide show
  1. package/build/cover/edit.js +9 -3
  2. package/build/cover/edit.js.map +1 -1
  3. package/build/gallery/deprecated.js +314 -26
  4. package/build/gallery/deprecated.js.map +1 -1
  5. package/build/gallery/edit-wrapper.js +10 -27
  6. package/build/gallery/edit-wrapper.js.map +1 -1
  7. package/build/gallery/edit.js +11 -13
  8. package/build/gallery/edit.js.map +1 -1
  9. package/build/gallery/save.js +3 -3
  10. package/build/gallery/save.js.map +1 -1
  11. package/build/gallery/shared.js +24 -0
  12. package/build/gallery/shared.js.map +1 -1
  13. package/build/gallery/transforms.js +8 -22
  14. package/build/gallery/transforms.js.map +1 -1
  15. package/build/gallery/use-mobile-warning.js +1 -1
  16. package/build/gallery/use-mobile-warning.js.map +1 -1
  17. package/build/gallery/v1/edit.js +2 -21
  18. package/build/gallery/v1/edit.js.map +1 -1
  19. package/build/index.js +3 -2
  20. package/build/index.js.map +1 -1
  21. package/build/navigation/deprecated.js +127 -19
  22. package/build/navigation/deprecated.js.map +1 -1
  23. package/build/navigation/edit/index.js +46 -31
  24. package/build/navigation/edit/index.js.map +1 -1
  25. package/build/navigation/edit/inner-blocks.js +0 -4
  26. package/build/navigation/edit/inner-blocks.js.map +1 -1
  27. package/build/navigation/edit/navigation-menu-selector.js +2 -2
  28. package/build/navigation/edit/navigation-menu-selector.js.map +1 -1
  29. package/build/navigation/edit/placeholder/index.js +16 -48
  30. package/build/navigation/edit/placeholder/index.js.map +1 -1
  31. package/build/navigation/edit/unsaved-inner-blocks.js +4 -35
  32. package/build/navigation/edit/unsaved-inner-blocks.js.map +1 -1
  33. package/build/navigation/edit/use-create-navigation-menu.js +50 -0
  34. package/build/navigation/edit/use-create-navigation-menu.js.map +1 -0
  35. package/build/navigation/edit/use-generate-default-navigation-title.js +73 -0
  36. package/build/navigation/edit/use-generate-default-navigation-title.js.map +1 -0
  37. package/build/navigation/index.js +1 -1
  38. package/build/navigation/save.js +2 -2
  39. package/build/navigation/save.js.map +1 -1
  40. package/build/navigation/use-navigation-menu.js +19 -8
  41. package/build/navigation/use-navigation-menu.js.map +1 -1
  42. package/build/navigation-submenu/edit.js +4 -0
  43. package/build/navigation-submenu/edit.js.map +1 -1
  44. package/build/pattern/index.js +1 -1
  45. package/build/post-featured-image/edit.js +2 -3
  46. package/build/post-featured-image/edit.js.map +1 -1
  47. package/build/post-terms/index.js +1 -1
  48. package/build/post-title/edit.js +2 -2
  49. package/build/post-title/edit.js.map +1 -1
  50. package/build/query-pagination/index.js +1 -1
  51. package/build/query-pagination-next/index.js +2 -2
  52. package/build/query-pagination-numbers/index.js +1 -1
  53. package/build/query-pagination-previous/index.js +2 -2
  54. package/build/query-title/index.js +1 -1
  55. package/build/separator/separator-settings.js +1 -0
  56. package/build/separator/separator-settings.js.map +1 -1
  57. package/build/site-logo/index.js +1 -1
  58. package/build/site-tagline/index.js +1 -1
  59. package/build/site-title/index.js +1 -1
  60. package/build/social-links/edit.js +1 -0
  61. package/build/social-links/edit.js.map +1 -1
  62. package/build/template-part/edit/placeholder/index.js +1 -1
  63. package/build/template-part/edit/placeholder/index.js.map +1 -1
  64. package/build/template-part/index.js +2 -1
  65. package/build/template-part/index.js.map +1 -1
  66. package/build-module/cover/edit.js +9 -3
  67. package/build-module/cover/edit.js.map +1 -1
  68. package/build-module/gallery/deprecated.js +309 -27
  69. package/build-module/gallery/deprecated.js.map +1 -1
  70. package/build-module/gallery/edit-wrapper.js +7 -27
  71. package/build-module/gallery/edit-wrapper.js.map +1 -1
  72. package/build-module/gallery/edit.js +11 -13
  73. package/build-module/gallery/edit.js.map +1 -1
  74. package/build-module/gallery/save.js +2 -3
  75. package/build-module/gallery/save.js.map +1 -1
  76. package/build-module/gallery/shared.js +22 -0
  77. package/build-module/gallery/shared.js.map +1 -1
  78. package/build-module/gallery/transforms.js +9 -21
  79. package/build-module/gallery/transforms.js.map +1 -1
  80. package/build-module/gallery/use-mobile-warning.js +1 -1
  81. package/build-module/gallery/use-mobile-warning.js.map +1 -1
  82. package/build-module/gallery/v1/edit.js +4 -22
  83. package/build-module/gallery/v1/edit.js.map +1 -1
  84. package/build-module/index.js +3 -2
  85. package/build-module/index.js.map +1 -1
  86. package/build-module/navigation/deprecated.js +127 -19
  87. package/build-module/navigation/deprecated.js.map +1 -1
  88. package/build-module/navigation/edit/index.js +47 -31
  89. package/build-module/navigation/edit/index.js.map +1 -1
  90. package/build-module/navigation/edit/inner-blocks.js +0 -4
  91. package/build-module/navigation/edit/inner-blocks.js.map +1 -1
  92. package/build-module/navigation/edit/navigation-menu-selector.js +2 -2
  93. package/build-module/navigation/edit/navigation-menu-selector.js.map +1 -1
  94. package/build-module/navigation/edit/placeholder/index.js +15 -45
  95. package/build-module/navigation/edit/placeholder/index.js.map +1 -1
  96. package/build-module/navigation/edit/unsaved-inner-blocks.js +6 -35
  97. package/build-module/navigation/edit/unsaved-inner-blocks.js.map +1 -1
  98. package/build-module/navigation/edit/use-create-navigation-menu.js +36 -0
  99. package/build-module/navigation/edit/use-create-navigation-menu.js.map +1 -0
  100. package/build-module/navigation/edit/use-generate-default-navigation-title.js +57 -0
  101. package/build-module/navigation/edit/use-generate-default-navigation-title.js.map +1 -0
  102. package/build-module/navigation/index.js +1 -1
  103. package/build-module/navigation/save.js +2 -2
  104. package/build-module/navigation/save.js.map +1 -1
  105. package/build-module/navigation/use-navigation-menu.js +19 -8
  106. package/build-module/navigation/use-navigation-menu.js.map +1 -1
  107. package/build-module/navigation-submenu/edit.js +4 -0
  108. package/build-module/navigation-submenu/edit.js.map +1 -1
  109. package/build-module/pattern/index.js +1 -1
  110. package/build-module/post-featured-image/edit.js +2 -3
  111. package/build-module/post-featured-image/edit.js.map +1 -1
  112. package/build-module/post-terms/index.js +1 -1
  113. package/build-module/post-title/edit.js +2 -2
  114. package/build-module/post-title/edit.js.map +1 -1
  115. package/build-module/query-pagination/index.js +1 -1
  116. package/build-module/query-pagination-next/index.js +2 -2
  117. package/build-module/query-pagination-numbers/index.js +1 -1
  118. package/build-module/query-pagination-previous/index.js +2 -2
  119. package/build-module/query-title/index.js +1 -1
  120. package/build-module/separator/separator-settings.js +1 -0
  121. package/build-module/separator/separator-settings.js.map +1 -1
  122. package/build-module/site-logo/index.js +1 -1
  123. package/build-module/site-tagline/index.js +1 -1
  124. package/build-module/site-title/index.js +1 -1
  125. package/build-module/social-links/edit.js +1 -0
  126. package/build-module/social-links/edit.js.map +1 -1
  127. package/build-module/template-part/edit/placeholder/index.js +2 -2
  128. package/build-module/template-part/edit/placeholder/index.js.map +1 -1
  129. package/build-module/template-part/index.js +2 -1
  130. package/build-module/template-part/index.js.map +1 -1
  131. package/build-style/columns/editor-rtl.css +1 -1
  132. package/build-style/columns/editor.css +1 -1
  133. package/build-style/editor-rtl.css +6 -5
  134. package/build-style/editor.css +6 -5
  135. package/build-style/gallery/editor-rtl.css +1 -0
  136. package/build-style/gallery/editor.css +1 -0
  137. package/build-style/navigation/style-rtl.css +5 -1
  138. package/build-style/navigation/style.css +5 -1
  139. package/build-style/post-featured-image/editor-rtl.css +2 -2
  140. package/build-style/post-featured-image/editor.css +2 -2
  141. package/build-style/site-logo/editor-rtl.css +2 -2
  142. package/build-style/site-logo/editor.css +2 -2
  143. package/build-style/style-rtl.css +5 -1
  144. package/build-style/style.css +5 -1
  145. package/package.json +9 -9
  146. package/src/calendar/index.php +2 -2
  147. package/src/columns/editor.scss +3 -2
  148. package/src/cover/edit.js +9 -1
  149. package/src/gallery/deprecated.js +831 -559
  150. package/src/gallery/edit-wrapper.js +7 -27
  151. package/src/gallery/edit.js +11 -13
  152. package/src/gallery/editor.scss +1 -0
  153. package/src/gallery/save.js +2 -1
  154. package/src/gallery/shared.js +24 -0
  155. package/src/gallery/transforms.js +9 -27
  156. package/src/gallery/use-mobile-warning.js +1 -1
  157. package/src/gallery/v1/edit.js +1 -28
  158. package/src/index.js +27 -25
  159. package/src/navigation/block.json +1 -1
  160. package/src/navigation/deprecated.js +115 -13
  161. package/src/navigation/edit/index.js +44 -36
  162. package/src/navigation/edit/inner-blocks.js +0 -5
  163. package/src/navigation/edit/navigation-menu-selector.js +2 -2
  164. package/src/navigation/edit/placeholder/index.js +16 -62
  165. package/src/navigation/edit/unsaved-inner-blocks.js +6 -57
  166. package/src/navigation/edit/use-create-navigation-menu.js +39 -0
  167. package/src/navigation/edit/use-generate-default-navigation-title.js +79 -0
  168. package/src/navigation/index.php +263 -26
  169. package/src/navigation/save.js +2 -2
  170. package/src/navigation/style.scss +5 -1
  171. package/src/navigation/use-navigation-menu.js +20 -9
  172. package/src/navigation-submenu/edit.js +6 -0
  173. package/src/navigation-submenu/index.php +30 -45
  174. package/src/page-list/index.php +10 -9
  175. package/src/pattern/block.json +1 -1
  176. package/src/post-featured-image/edit.js +2 -5
  177. package/src/post-featured-image/editor.scss +2 -2
  178. package/src/post-terms/block.json +1 -1
  179. package/src/post-title/edit.js +2 -2
  180. package/src/query-pagination/block.json +1 -1
  181. package/src/query-pagination-next/block.json +2 -2
  182. package/src/query-pagination-numbers/block.json +1 -1
  183. package/src/query-pagination-previous/block.json +2 -2
  184. package/src/query-title/block.json +1 -1
  185. package/src/separator/separator-settings.js +1 -0
  186. package/src/site-logo/block.json +1 -1
  187. package/src/site-logo/editor.scss +2 -2
  188. package/src/site-tagline/block.json +1 -1
  189. package/src/site-title/block.json +1 -1
  190. package/src/social-links/edit.js +1 -0
  191. package/src/template-part/block.json +2 -1
  192. package/src/template-part/edit/placeholder/index.js +2 -2
  193. package/src/template-part/index.php +38 -1
  194. package/build/gallery/v1/update-gallery-modal.js +0 -114
  195. package/build/gallery/v1/update-gallery-modal.js.map +0 -1
  196. package/build/navigation/edit/navigation-menu-name-modal.js +0 -55
  197. package/build/navigation/edit/navigation-menu-name-modal.js.map +0 -1
  198. package/build/navigation/edit/navigation-menu-publish-button.js +0 -53
  199. package/build/navigation/edit/navigation-menu-publish-button.js.map +0 -1
  200. package/build-module/gallery/v1/update-gallery-modal.js +0 -97
  201. package/build-module/gallery/v1/update-gallery-modal.js.map +0 -1
  202. package/build-module/navigation/edit/navigation-menu-name-modal.js +0 -47
  203. package/build-module/navigation/edit/navigation-menu-name-modal.js.map +0 -1
  204. package/build-module/navigation/edit/navigation-menu-publish-button.js +0 -40
  205. package/build-module/navigation/edit/navigation-menu-publish-button.js.map +0 -1
  206. package/src/gallery/v1/update-gallery-modal.js +0 -97
  207. package/src/navigation/edit/navigation-menu-name-modal.js +0 -69
  208. 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.3;
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.3;
96
+ opacity: 0.4;
97
97
  }
98
98
 
99
99
  // Show default placeholder height when not resized.
@@ -2,7 +2,7 @@
2
2
  "apiVersion": 2,
3
3
  "name": "core/post-terms",
4
4
  "title": "Post Terms",
5
- "category": "design",
5
+ "category": "theme",
6
6
  "description": "Post terms.",
7
7
  "textdomain": "default",
8
8
  "attributes": {
@@ -62,7 +62,7 @@ export default function PostTitleEdit( {
62
62
  />
63
63
  ) : (
64
64
  <TagName { ...blockProps }>
65
- <RawHTML key="html">{ fullTitle.rendered }</RawHTML>
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.rendered }</RawHTML>
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",
4
- "title": "Query Pagination",
4
+ "title": "Pagination",
5
5
  "category": "design",
6
6
  "parent": [ "core/query" ],
7
7
  "description": "Displays a paginated navigation to next/previous set of posts, when applicable.",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "apiVersion": 2,
3
3
  "name": "core/query-pagination-next",
4
- "title": "Query Pagination Next",
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
- "link": true
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-numbers",
4
- "title": "Query Pagination Numbers",
4
+ "title": "Page Numbers",
5
5
  "category": "design",
6
6
  "parent": [ "core/query-pagination" ],
7
7
  "description": "Displays a list of page numbers for pagination",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "apiVersion": 2,
3
3
  "name": "core/query-pagination-previous",
4
- "title": "Query Pagination Previous",
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
- "link": true
20
+ "text": false
21
21
  },
22
22
  "typography": {
23
23
  "fontSize": true,
@@ -2,7 +2,7 @@
2
2
  "apiVersion": 2,
3
3
  "name": "core/query-title",
4
4
  "title": "Query Title",
5
- "category": "design",
5
+ "category": "theme",
6
6
  "description": "Display the query title.",
7
7
  "textdomain": "default",
8
8
  "attributes": {
@@ -8,6 +8,7 @@ const SeparatorSettings = ( { color, setColor } ) => (
8
8
  <InspectorControls>
9
9
  <PanelColorSettings
10
10
  __experimentalHasMultipleOrigins
11
+ __experimentalIsRenderedInSidebar
11
12
  title={ __( 'Color' ) }
12
13
  colorSettings={ [
13
14
  {
@@ -2,7 +2,7 @@
2
2
  "apiVersion": 2,
3
3
  "name": "core/site-logo",
4
4
  "title": "Site Logo",
5
- "category": "layout",
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.3;
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.3;
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": "design",
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": "design",
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": {
@@ -167,6 +167,7 @@ export function SocialLinksEdit( props ) {
167
167
  </PanelBody>
168
168
  <PanelColorSettings
169
169
  __experimentalHasMultipleOrigins
170
+ __experimentalIsRenderedInSidebar
170
171
  title={ __( 'Color' ) }
171
172
  colorSettings={ [
172
173
  {
@@ -29,7 +29,8 @@
29
29
  "spacing": {
30
30
  "padding": true
31
31
  },
32
- "__experimentalLayout": true
32
+ "__experimentalLayout": true,
33
+ "reusable": false
33
34
  },
34
35
  "editorStyle": "wp-block-template-part-editor"
35
36
  }
@@ -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: 'template-part',
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
- $template_part_file_path = get_theme_file_path( '/block-template-parts/' . $attributes['slug'] . '.html' );
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"]}
@@ -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,IAAI,GAAGL,sBAAP;AACA;;AACD;AACCK,QAAAA,IAAI,GAAGN,qBAAP;AACA;AATF;;AAWA,UAAMY,WAAW,GAAGF,MAAM,CAACG,GAAP,CAAcC,KAAF,IAC/BlB,WAAW,CAAE,YAAF,EAAgB;AAC1BmB,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;AAI1BP,MAAAA,OAAO,EAAEG,KAAK,CAACH,OAJW;AAK1BQ,MAAAA,eAAe,EAAEb;AALS,KAAhB,CADQ,CAApB;AAUAD,IAAAA,aAAa,CACZF,QADY,EAEZP,WAAW,CACV,cADU,EAEV;AAAEY,MAAAA,QAAF;AAAYC,MAAAA,MAAM,EAAEH,IAApB;AAA0BK,MAAAA;AAA1B,KAFU,EAGVC,WAHU,CAFC,CAAb;AAQA,GAvC4B;AAAA,CAAtB;AAyCP,eAAe,SAASQ,kBAAT,QAAqD;AAAA,MAAxB;AAAEC,IAAAA,OAAF;AAAWlB,IAAAA;AAAX,GAAwB;AACnE,QAAM;AAAEC,IAAAA;AAAF,MAAeT,SAAS,CAAEG,gBAAF,CAA9B;AACA,QAAM;AAAEO,IAAAA;AAAF,MAAoBX,WAAW,CAAEI,gBAAF,CAArC;AACA,SACC,cAAC,KAAD;AACC,IAAA,UAAU,EAAGL,EAAE,CAAE,OAAF,CADhB;AAEC,IAAA,cAAc,EAAG4B,OAFlB;AAGC,IAAA,KAAK,EAAG5B,EAAE,CAAE,gBAAF,CAHX;AAIC,IAAA,SAAS,EAAG,+BAJb;AAKC,IAAA,IAAI,EAAG;AACN6B,MAAAA,WAAW,EAAE;AADP;AALR,KASC;AAAG,IAAA,EAAE,EAAG;AAAR,KACG7B,EAAE,CACH,gKADG,CADL,CATD,EAeC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,cAAC,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"]}