@wordpress/edit-post 7.11.0 → 7.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (283) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/block-manager/category.js +14 -22
  3. package/build/components/block-manager/category.js.map +1 -1
  4. package/build/components/block-manager/checklist.js +6 -13
  5. package/build/components/block-manager/checklist.js.map +1 -1
  6. package/build/components/block-manager/index.js +10 -14
  7. package/build/components/block-manager/index.js.map +1 -1
  8. package/build/components/block-settings-menu/plugin-block-settings-menu-item.js +21 -26
  9. package/build/components/block-settings-menu/plugin-block-settings-menu-item.js.map +1 -1
  10. package/build/components/device-preview/index.js +1 -1
  11. package/build/components/device-preview/index.js.map +1 -1
  12. package/build/components/editor-initialization/index.js +3 -4
  13. package/build/components/editor-initialization/index.js.map +1 -1
  14. package/build/components/header/document-title/index.js +103 -0
  15. package/build/components/header/document-title/index.js.map +1 -0
  16. package/build/components/header/fullscreen-mode-close/index.js +8 -9
  17. package/build/components/header/fullscreen-mode-close/index.js.map +1 -1
  18. package/build/components/header/header-toolbar/index.native.js +12 -13
  19. package/build/components/header/header-toolbar/index.native.js.map +1 -1
  20. package/build/components/header/index.js +7 -6
  21. package/build/components/header/index.js.map +1 -1
  22. package/build/components/header/main-dashboard-button/index.js +3 -4
  23. package/build/components/header/main-dashboard-button/index.js.map +1 -1
  24. package/build/components/header/more-menu/index.js +19 -23
  25. package/build/components/header/more-menu/index.js.map +1 -1
  26. package/build/components/header/post-publish-button-or-toggle.js +15 -16
  27. package/build/components/header/post-publish-button-or-toggle.js.map +1 -1
  28. package/build/components/header/tools-more-menu-group/index.js +7 -10
  29. package/build/components/header/tools-more-menu-group/index.js.map +1 -1
  30. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +3 -4
  31. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
  32. package/build/components/keyboard-shortcut-help-modal/index.js +44 -54
  33. package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  34. package/build/components/keyboard-shortcut-help-modal/shortcut.js +10 -12
  35. package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
  36. package/build/components/layout/actions-panel.js +5 -6
  37. package/build/components/layout/actions-panel.js.map +1 -1
  38. package/build/components/layout/index.js +3 -4
  39. package/build/components/layout/index.js.map +1 -1
  40. package/build/components/layout/index.native.js +3 -7
  41. package/build/components/layout/index.native.js.map +1 -1
  42. package/build/components/meta-boxes/index.js +9 -13
  43. package/build/components/meta-boxes/index.js.map +1 -1
  44. package/build/components/meta-boxes/meta-box-visibility.js +5 -8
  45. package/build/components/meta-boxes/meta-box-visibility.js.map +1 -1
  46. package/build/components/meta-boxes/meta-boxes-area/index.js +3 -4
  47. package/build/components/meta-boxes/meta-boxes-area/index.js.map +1 -1
  48. package/build/components/preferences-modal/meta-boxes-section.js +16 -23
  49. package/build/components/preferences-modal/meta-boxes-section.js.map +1 -1
  50. package/build/components/preferences-modal/options/enable-custom-fields.js +7 -9
  51. package/build/components/preferences-modal/options/enable-custom-fields.js.map +1 -1
  52. package/build/components/preferences-modal/options/enable-feature.js +12 -16
  53. package/build/components/preferences-modal/options/enable-feature.js.map +1 -1
  54. package/build/components/preferences-modal/options/enable-panel.js +10 -17
  55. package/build/components/preferences-modal/options/enable-panel.js.map +1 -1
  56. package/build/components/preferences-modal/options/enable-plugin-document-setting-panel.js +7 -10
  57. package/build/components/preferences-modal/options/enable-plugin-document-setting-panel.js.map +1 -1
  58. package/build/components/secondary-sidebar/list-view-sidebar.js +58 -44
  59. package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
  60. package/build/components/sidebar/discussion-panel/index.js +5 -7
  61. package/build/components/sidebar/discussion-panel/index.js.map +1 -1
  62. package/build/components/sidebar/featured-image/index.js +9 -17
  63. package/build/components/sidebar/featured-image/index.js.map +1 -1
  64. package/build/components/sidebar/page-attributes/index.js +3 -9
  65. package/build/components/sidebar/page-attributes/index.js.map +1 -1
  66. package/build/components/sidebar/plugin-document-setting-panel/index.js +20 -25
  67. package/build/components/sidebar/plugin-document-setting-panel/index.js.map +1 -1
  68. package/build/components/sidebar/plugin-post-publish-panel/index.js +12 -15
  69. package/build/components/sidebar/plugin-post-publish-panel/index.js.map +1 -1
  70. package/build/components/sidebar/plugin-post-status-info/index.js +6 -9
  71. package/build/components/sidebar/plugin-post-status-info/index.js.map +1 -1
  72. package/build/components/sidebar/plugin-pre-publish-panel/index.js +12 -15
  73. package/build/components/sidebar/plugin-pre-publish-panel/index.js.map +1 -1
  74. package/build/components/sidebar/plugin-sidebar/index.js +4 -5
  75. package/build/components/sidebar/plugin-sidebar/index.js.map +1 -1
  76. package/build/components/sidebar/post-excerpt/index.js +5 -7
  77. package/build/components/sidebar/post-excerpt/index.js.map +1 -1
  78. package/build/components/sidebar/post-schedule/index.js +16 -23
  79. package/build/components/sidebar/post-schedule/index.js.map +1 -1
  80. package/build/components/sidebar/post-status/index.js +7 -11
  81. package/build/components/sidebar/post-status/index.js.map +1 -1
  82. package/build/components/sidebar/post-taxonomies/taxonomy-panel.js +9 -15
  83. package/build/components/sidebar/post-taxonomies/taxonomy-panel.js.map +1 -1
  84. package/build/components/sidebar/post-template/create-modal.js +3 -4
  85. package/build/components/sidebar/post-template/create-modal.js.map +1 -1
  86. package/build/components/sidebar/post-template/form.js +13 -20
  87. package/build/components/sidebar/post-template/form.js.map +1 -1
  88. package/build/components/sidebar/post-template/index.js +18 -25
  89. package/build/components/sidebar/post-template/index.js.map +1 -1
  90. package/build/components/sidebar/post-url/index.js +16 -23
  91. package/build/components/sidebar/post-url/index.js.map +1 -1
  92. package/build/components/sidebar/post-visibility/index.js +26 -36
  93. package/build/components/sidebar/post-visibility/index.js.map +1 -1
  94. package/build/components/sidebar/settings-header/index.js +3 -4
  95. package/build/components/sidebar/settings-header/index.js.map +1 -1
  96. package/build/components/sidebar/template-summary/index.js +1 -1
  97. package/build/components/sidebar/template-summary/index.js.map +1 -1
  98. package/build/components/start-page-options/index.js +3 -4
  99. package/build/components/start-page-options/index.js.map +1 -1
  100. package/build/components/view-link/index.js +1 -1
  101. package/build/components/view-link/index.js.map +1 -1
  102. package/build/components/visual-editor/block-inspector-button.js +4 -5
  103. package/build/components/visual-editor/block-inspector-button.js.map +1 -1
  104. package/build/components/visual-editor/header.native.js +6 -7
  105. package/build/components/visual-editor/header.native.js.map +1 -1
  106. package/build/components/visual-editor/index.js +32 -48
  107. package/build/components/visual-editor/index.js.map +1 -1
  108. package/build/components/welcome-guide/image.js +4 -5
  109. package/build/components/welcome-guide/image.js.map +1 -1
  110. package/build/editor.js +14 -20
  111. package/build/editor.js.map +1 -1
  112. package/build/editor.native.js +3 -6
  113. package/build/editor.native.js.map +1 -1
  114. package/build/hooks/validate-multiple-use/index.js +18 -29
  115. package/build/hooks/validate-multiple-use/index.js.map +1 -1
  116. package/build/plugins/index.js +20 -23
  117. package/build/plugins/index.js.map +1 -1
  118. package/build/plugins/keyboard-shortcuts-help-menu-item/index.js +3 -4
  119. package/build/plugins/keyboard-shortcuts-help-menu-item/index.js.map +1 -1
  120. package/build/store/actions.js +60 -88
  121. package/build/store/actions.js.map +1 -1
  122. package/build/store/reducer.js +11 -43
  123. package/build/store/reducer.js.map +1 -1
  124. package/build/store/selectors.js +11 -16
  125. package/build/store/selectors.js.map +1 -1
  126. package/build-module/components/block-manager/category.js +14 -22
  127. package/build-module/components/block-manager/category.js.map +1 -1
  128. package/build-module/components/block-manager/checklist.js +6 -13
  129. package/build-module/components/block-manager/checklist.js.map +1 -1
  130. package/build-module/components/block-manager/index.js +10 -14
  131. package/build-module/components/block-manager/index.js.map +1 -1
  132. package/build-module/components/block-settings-menu/plugin-block-settings-menu-item.js +21 -26
  133. package/build-module/components/block-settings-menu/plugin-block-settings-menu-item.js.map +1 -1
  134. package/build-module/components/device-preview/index.js +1 -1
  135. package/build-module/components/device-preview/index.js.map +1 -1
  136. package/build-module/components/editor-initialization/index.js +3 -4
  137. package/build-module/components/editor-initialization/index.js.map +1 -1
  138. package/build-module/components/header/document-title/index.js +88 -0
  139. package/build-module/components/header/document-title/index.js.map +1 -0
  140. package/build-module/components/header/fullscreen-mode-close/index.js +7 -8
  141. package/build-module/components/header/fullscreen-mode-close/index.js.map +1 -1
  142. package/build-module/components/header/header-toolbar/index.native.js +12 -13
  143. package/build-module/components/header/header-toolbar/index.native.js.map +1 -1
  144. package/build-module/components/header/index.js +7 -6
  145. package/build-module/components/header/index.js.map +1 -1
  146. package/build-module/components/header/main-dashboard-button/index.js +3 -4
  147. package/build-module/components/header/main-dashboard-button/index.js.map +1 -1
  148. package/build-module/components/header/more-menu/index.js +19 -23
  149. package/build-module/components/header/more-menu/index.js.map +1 -1
  150. package/build-module/components/header/post-publish-button-or-toggle.js +15 -16
  151. package/build-module/components/header/post-publish-button-or-toggle.js.map +1 -1
  152. package/build-module/components/header/tools-more-menu-group/index.js +7 -10
  153. package/build-module/components/header/tools-more-menu-group/index.js.map +1 -1
  154. package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +3 -4
  155. package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
  156. package/build-module/components/keyboard-shortcut-help-modal/index.js +42 -52
  157. package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  158. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +10 -12
  159. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
  160. package/build-module/components/layout/actions-panel.js +5 -6
  161. package/build-module/components/layout/actions-panel.js.map +1 -1
  162. package/build-module/components/layout/index.js +3 -4
  163. package/build-module/components/layout/index.js.map +1 -1
  164. package/build-module/components/layout/index.native.js +3 -7
  165. package/build-module/components/layout/index.native.js.map +1 -1
  166. package/build-module/components/meta-boxes/index.js +9 -13
  167. package/build-module/components/meta-boxes/index.js.map +1 -1
  168. package/build-module/components/meta-boxes/meta-box-visibility.js +5 -8
  169. package/build-module/components/meta-boxes/meta-box-visibility.js.map +1 -1
  170. package/build-module/components/meta-boxes/meta-boxes-area/index.js +3 -4
  171. package/build-module/components/meta-boxes/meta-boxes-area/index.js.map +1 -1
  172. package/build-module/components/preferences-modal/meta-boxes-section.js +16 -23
  173. package/build-module/components/preferences-modal/meta-boxes-section.js.map +1 -1
  174. package/build-module/components/preferences-modal/options/enable-custom-fields.js +7 -9
  175. package/build-module/components/preferences-modal/options/enable-custom-fields.js.map +1 -1
  176. package/build-module/components/preferences-modal/options/enable-feature.js +12 -16
  177. package/build-module/components/preferences-modal/options/enable-feature.js.map +1 -1
  178. package/build-module/components/preferences-modal/options/enable-panel.js +10 -17
  179. package/build-module/components/preferences-modal/options/enable-panel.js.map +1 -1
  180. package/build-module/components/preferences-modal/options/enable-plugin-document-setting-panel.js +7 -10
  181. package/build-module/components/preferences-modal/options/enable-plugin-document-setting-panel.js.map +1 -1
  182. package/build-module/components/secondary-sidebar/list-view-sidebar.js +58 -44
  183. package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
  184. package/build-module/components/sidebar/discussion-panel/index.js +5 -7
  185. package/build-module/components/sidebar/discussion-panel/index.js.map +1 -1
  186. package/build-module/components/sidebar/featured-image/index.js +9 -17
  187. package/build-module/components/sidebar/featured-image/index.js.map +1 -1
  188. package/build-module/components/sidebar/page-attributes/index.js +3 -9
  189. package/build-module/components/sidebar/page-attributes/index.js.map +1 -1
  190. package/build-module/components/sidebar/plugin-document-setting-panel/index.js +20 -25
  191. package/build-module/components/sidebar/plugin-document-setting-panel/index.js.map +1 -1
  192. package/build-module/components/sidebar/plugin-post-publish-panel/index.js +12 -15
  193. package/build-module/components/sidebar/plugin-post-publish-panel/index.js.map +1 -1
  194. package/build-module/components/sidebar/plugin-post-status-info/index.js +6 -9
  195. package/build-module/components/sidebar/plugin-post-status-info/index.js.map +1 -1
  196. package/build-module/components/sidebar/plugin-pre-publish-panel/index.js +12 -15
  197. package/build-module/components/sidebar/plugin-pre-publish-panel/index.js.map +1 -1
  198. package/build-module/components/sidebar/plugin-sidebar/index.js +4 -5
  199. package/build-module/components/sidebar/plugin-sidebar/index.js.map +1 -1
  200. package/build-module/components/sidebar/post-excerpt/index.js +5 -7
  201. package/build-module/components/sidebar/post-excerpt/index.js.map +1 -1
  202. package/build-module/components/sidebar/post-schedule/index.js +16 -23
  203. package/build-module/components/sidebar/post-schedule/index.js.map +1 -1
  204. package/build-module/components/sidebar/post-status/index.js +7 -11
  205. package/build-module/components/sidebar/post-status/index.js.map +1 -1
  206. package/build-module/components/sidebar/post-taxonomies/taxonomy-panel.js +9 -15
  207. package/build-module/components/sidebar/post-taxonomies/taxonomy-panel.js.map +1 -1
  208. package/build-module/components/sidebar/post-template/create-modal.js +3 -4
  209. package/build-module/components/sidebar/post-template/create-modal.js.map +1 -1
  210. package/build-module/components/sidebar/post-template/form.js +13 -20
  211. package/build-module/components/sidebar/post-template/form.js.map +1 -1
  212. package/build-module/components/sidebar/post-template/index.js +18 -25
  213. package/build-module/components/sidebar/post-template/index.js.map +1 -1
  214. package/build-module/components/sidebar/post-url/index.js +16 -23
  215. package/build-module/components/sidebar/post-url/index.js.map +1 -1
  216. package/build-module/components/sidebar/post-visibility/index.js +26 -36
  217. package/build-module/components/sidebar/post-visibility/index.js.map +1 -1
  218. package/build-module/components/sidebar/settings-header/index.js +3 -4
  219. package/build-module/components/sidebar/settings-header/index.js.map +1 -1
  220. package/build-module/components/sidebar/template-summary/index.js +1 -1
  221. package/build-module/components/sidebar/template-summary/index.js.map +1 -1
  222. package/build-module/components/start-page-options/index.js +3 -4
  223. package/build-module/components/start-page-options/index.js.map +1 -1
  224. package/build-module/components/view-link/index.js +1 -1
  225. package/build-module/components/view-link/index.js.map +1 -1
  226. package/build-module/components/visual-editor/block-inspector-button.js +4 -5
  227. package/build-module/components/visual-editor/block-inspector-button.js.map +1 -1
  228. package/build-module/components/visual-editor/header.native.js +6 -7
  229. package/build-module/components/visual-editor/header.native.js.map +1 -1
  230. package/build-module/components/visual-editor/index.js +35 -49
  231. package/build-module/components/visual-editor/index.js.map +1 -1
  232. package/build-module/components/welcome-guide/image.js +4 -5
  233. package/build-module/components/welcome-guide/image.js.map +1 -1
  234. package/build-module/editor.js +14 -20
  235. package/build-module/editor.js.map +1 -1
  236. package/build-module/editor.native.js +3 -6
  237. package/build-module/editor.native.js.map +1 -1
  238. package/build-module/hooks/validate-multiple-use/index.js +18 -29
  239. package/build-module/hooks/validate-multiple-use/index.js.map +1 -1
  240. package/build-module/plugins/index.js +20 -23
  241. package/build-module/plugins/index.js.map +1 -1
  242. package/build-module/plugins/keyboard-shortcuts-help-menu-item/index.js +3 -4
  243. package/build-module/plugins/keyboard-shortcuts-help-menu-item/index.js.map +1 -1
  244. package/build-module/store/actions.js +60 -88
  245. package/build-module/store/actions.js.map +1 -1
  246. package/build-module/store/reducer.js +11 -43
  247. package/build-module/store/reducer.js.map +1 -1
  248. package/build-module/store/selectors.js +11 -16
  249. package/build-module/store/selectors.js.map +1 -1
  250. package/build-style/style-rtl.css +63 -101
  251. package/build-style/style.css +63 -101
  252. package/package.json +32 -32
  253. package/src/components/header/document-title/index.js +86 -0
  254. package/src/components/header/document-title/style.scss +61 -0
  255. package/src/components/header/header-toolbar/style.scss +0 -1
  256. package/src/components/header/index.js +4 -2
  257. package/src/components/header/style.scss +6 -0
  258. package/src/components/secondary-sidebar/list-view-sidebar.js +68 -66
  259. package/src/components/secondary-sidebar/style.scss +28 -31
  260. package/src/components/visual-editor/index.js +10 -21
  261. package/src/components/visual-editor/style.scss +0 -13
  262. package/src/style.scss +1 -1
  263. package/build/components/header/template-title/delete-template.js +0 -117
  264. package/build/components/header/template-title/delete-template.js.map +0 -1
  265. package/build/components/header/template-title/edit-template-title.js +0 -95
  266. package/build/components/header/template-title/edit-template-title.js.map +0 -1
  267. package/build/components/header/template-title/index.js +0 -124
  268. package/build/components/header/template-title/index.js.map +0 -1
  269. package/build/components/header/template-title/template-description.js +0 -55
  270. package/build/components/header/template-title/template-description.js.map +0 -1
  271. package/build-module/components/header/template-title/delete-template.js +0 -104
  272. package/build-module/components/header/template-title/delete-template.js.map +0 -1
  273. package/build-module/components/header/template-title/edit-template-title.js +0 -83
  274. package/build-module/components/header/template-title/edit-template-title.js.map +0 -1
  275. package/build-module/components/header/template-title/index.js +0 -105
  276. package/build-module/components/header/template-title/index.js.map +0 -1
  277. package/build-module/components/header/template-title/template-description.js +0 -45
  278. package/build-module/components/header/template-title/template-description.js.map +0 -1
  279. package/src/components/header/template-title/delete-template.js +0 -106
  280. package/src/components/header/template-title/edit-template-title.js +0 -78
  281. package/src/components/header/template-title/index.js +0 -115
  282. package/src/components/header/template-title/style.scss +0 -94
  283. package/src/components/header/template-title/template-description.js +0 -42
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-post/src/editor.native.js"],"names":["memize","I18nManager","GestureHandlerRootView","Component","EditorProvider","parse","serialize","store","blocksStore","withDispatch","withSelect","compose","subscribeSetFocusOnTitle","subscribeFeaturedImageIdNativeUpdated","SlotFillProvider","coreStore","Layout","editPostStore","Editor","constructor","props","arguments","galleryWithImageBlocks","window","wp","galleryBlockV2Enabled","initialHtmlModeEnabled","mode","switchEditorMode","getEditorSettings","maxSize","setTitleRef","bind","settings","hasFixedToolbar","focusMode","hiddenBlockTypes","blockTypes","isRTL","length","allowedBlockTypes","undefined","defaultAllowedBlockTypes","map","name","filter","type","includes","componentDidMount","editEntityRecord","postType","postId","subscriptionParentSetFocusOnTitle","postTitleRef","focus","focusTitleWhenAvailable","subscriptionParentFeaturedImageIdNativeUpdated","payload","featured_media","featuredImageId","undoIgnore","componentWillUnmount","remove","titleRef","render","initialEdits","post","initialHtml","editorSettings","normalizedPost","id","title","raw","initialTitle","content","status","meta","flex","select","isFeatureActive","getEditorMode","__experimentalGetPreviewDeviceType","getHiddenBlockTypes","getBlockTypes","dispatch"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,MAAP,MAAmB,QAAnB;AACA,SAASC,WAAT,QAA4B,cAA5B;AACA,SAASC,sBAAT,QAA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F,CAAP,CA4BV/B,MA5BU,CAAf","sourcesContent":["/**\n * External dependencies\n */\nimport memize from 'memize';\nimport { I18nManager } from 'react-native';\nimport { GestureHandlerRootView } from 'react-native-gesture-handler';\n\n/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\nimport { EditorProvider } from '@wordpress/editor';\nimport { parse, serialize, store as blocksStore } from '@wordpress/blocks';\nimport { withDispatch, withSelect } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\nimport {\n\tsubscribeSetFocusOnTitle,\n\tsubscribeFeaturedImageIdNativeUpdated,\n} from '@wordpress/react-native-bridge';\nimport { SlotFillProvider } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport Layout from './components/layout';\nimport { store as editPostStore } from './store';\n\nclass Editor extends Component {\n\tconstructor( props ) {\n\t\tsuper( ...arguments );\n\n\t\t// need to set this globally to avoid race with deprecations\n\t\t// defaulting to true to avoid issues with a not-yet-cached value\n\t\tconst { galleryWithImageBlocks = true } = props;\n\t\twindow.wp.galleryBlockV2Enabled = galleryWithImageBlocks;\n\n\t\tif ( props.initialHtmlModeEnabled && props.mode === 'visual' ) {\n\t\t\t// Enable html mode if the initial mode the parent wants it but we're not already in it.\n\t\t\tthis.props.switchEditorMode( 'text' );\n\t\t}\n\n\t\tthis.getEditorSettings = memize( this.getEditorSettings, {\n\t\t\tmaxSize: 1,\n\t\t} );\n\n\t\tthis.setTitleRef = this.setTitleRef.bind( this );\n\t}\n\n\tgetEditorSettings(\n\t\tsettings,\n\t\thasFixedToolbar,\n\t\tfocusMode,\n\t\thiddenBlockTypes,\n\t\tblockTypes\n\t) {\n\t\tsettings = {\n\t\t\t...settings,\n\t\t\tisRTL: I18nManager.isRTL,\n\t\t\thasFixedToolbar,\n\t\t\tfocusMode,\n\t\t};\n\n\t\t// Omit hidden block types if exists and non-empty.\n\t\tif ( hiddenBlockTypes.length > 0 ) {\n\t\t\tif ( settings.allowedBlockTypes === undefined ) {\n\t\t\t\t// If no specific flags for allowedBlockTypes are set, assume `true`\n\t\t\t\t// meaning allow all block types.\n\t\t\t\tsettings.allowedBlockTypes = true;\n\t\t\t}\n\t\t\t// Defer to passed setting for `allowedBlockTypes` if provided as\n\t\t\t// anything other than `true` (where `true` is equivalent to allow\n\t\t\t// all block types).\n\t\t\tconst defaultAllowedBlockTypes =\n\t\t\t\ttrue === settings.allowedBlockTypes\n\t\t\t\t\t? blockTypes.map( ( { name } ) => name )\n\t\t\t\t\t: settings.allowedBlockTypes || [];\n\n\t\t\tsettings.allowedBlockTypes = defaultAllowedBlockTypes.filter(\n\t\t\t\t( type ) => ! hiddenBlockTypes.includes( type )\n\t\t\t);\n\t\t}\n\n\t\treturn settings;\n\t}\n\n\tcomponentDidMount() {\n\t\tconst { editEntityRecord, postType, postId } = this.props;\n\n\t\tthis.subscriptionParentSetFocusOnTitle = subscribeSetFocusOnTitle(\n\t\t\t() => {\n\t\t\t\tif ( this.postTitleRef ) {\n\t\t\t\t\tthis.postTitleRef.focus();\n\t\t\t\t} else {\n\t\t\t\t\t// If the post title ref is not available, we postpone setting focus to when it's available.\n\t\t\t\t\tthis.focusTitleWhenAvailable = true;\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\n\t\tthis.subscriptionParentFeaturedImageIdNativeUpdated =\n\t\t\tsubscribeFeaturedImageIdNativeUpdated( ( payload ) => {\n\t\t\t\teditEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\tpostId,\n\t\t\t\t\t{ featured_media: payload.featuredImageId },\n\t\t\t\t\t{\n\t\t\t\t\t\tundoIgnore: true,\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t} );\n\t}\n\n\tcomponentWillUnmount() {\n\t\tif ( this.subscriptionParentSetFocusOnTitle ) {\n\t\t\tthis.subscriptionParentSetFocusOnTitle.remove();\n\t\t}\n\n\t\tif ( this.subscribeFeaturedImageIdNativeUpdated ) {\n\t\t\tthis.subscribeFeaturedImageIdNativeUpdated.remove();\n\t\t}\n\t}\n\n\tsetTitleRef( titleRef ) {\n\t\tif ( this.focusTitleWhenAvailable && ! this.postTitleRef ) {\n\t\t\tthis.focusTitleWhenAvailable = false;\n\t\t\ttitleRef.focus();\n\t\t}\n\n\t\tthis.postTitleRef = titleRef;\n\t}\n\n\trender() {\n\t\tconst {\n\t\t\tsettings,\n\t\t\thasFixedToolbar,\n\t\t\tfocusMode,\n\t\t\tinitialEdits,\n\t\t\thiddenBlockTypes,\n\t\t\tblockTypes,\n\t\t\tpost,\n\t\t\tpostId,\n\t\t\tpostType,\n\t\t\tfeaturedImageId,\n\t\t\tinitialHtml,\n\t\t\t...props\n\t\t} = this.props;\n\n\t\tconst editorSettings = this.getEditorSettings(\n\t\t\tsettings,\n\t\t\thasFixedToolbar,\n\t\t\tfocusMode,\n\t\t\thiddenBlockTypes,\n\t\t\tblockTypes\n\t\t);\n\n\t\tconst normalizedPost = post || {\n\t\t\tid: postId,\n\t\t\ttitle: {\n\t\t\t\traw: props.initialTitle || '',\n\t\t\t},\n\t\t\tfeatured_media: featuredImageId,\n\t\t\tcontent: {\n\t\t\t\t// Make sure the post content is in sync with gutenberg store\n\t\t\t\t// to avoid marking the post as modified when simply loaded\n\t\t\t\t// For now, let's assume: serialize( parse( html ) ) !== html.\n\t\t\t\traw: serialize( parse( initialHtml || '' ) ),\n\t\t\t},\n\t\t\ttype: postType,\n\t\t\tstatus: 'draft',\n\t\t\tmeta: [],\n\t\t};\n\n\t\treturn (\n\t\t\t<GestureHandlerRootView style={ { flex: 1 } }>\n\t\t\t\t<SlotFillProvider>\n\t\t\t\t\t<EditorProvider\n\t\t\t\t\t\tsettings={ editorSettings }\n\t\t\t\t\t\tpost={ normalizedPost }\n\t\t\t\t\t\tinitialEdits={ initialEdits }\n\t\t\t\t\t\tuseSubRegistry={ false }\n\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t>\n\t\t\t\t\t\t<Layout setTitleRef={ this.setTitleRef } />\n\t\t\t\t\t</EditorProvider>\n\t\t\t\t</SlotFillProvider>\n\t\t\t</GestureHandlerRootView>\n\t\t);\n\t}\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst {\n\t\t\tisFeatureActive,\n\t\t\tgetEditorMode,\n\t\t\t__experimentalGetPreviewDeviceType,\n\t\t\tgetHiddenBlockTypes,\n\t\t} = select( editPostStore );\n\t\tconst { getBlockTypes } = select( blocksStore );\n\n\t\treturn {\n\t\t\thasFixedToolbar:\n\t\t\t\tisFeatureActive( 'fixedToolbar' ) ||\n\t\t\t\t__experimentalGetPreviewDeviceType() !== 'Desktop',\n\t\t\tfocusMode: isFeatureActive( 'focusMode' ),\n\t\t\tmode: getEditorMode(),\n\t\t\thiddenBlockTypes: getHiddenBlockTypes(),\n\t\t\tblockTypes: getBlockTypes(),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { switchEditorMode } = dispatch( editPostStore );\n\t\tconst { editEntityRecord } = dispatch( coreStore );\n\t\treturn {\n\t\t\tswitchEditorMode,\n\t\t\teditEntityRecord,\n\t\t};\n\t} ),\n] )( Editor );\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-post/src/editor.native.js"],"names":["memize","I18nManager","GestureHandlerRootView","Component","EditorProvider","parse","serialize","store","blocksStore","withDispatch","withSelect","compose","subscribeSetFocusOnTitle","subscribeFeaturedImageIdNativeUpdated","SlotFillProvider","coreStore","Layout","editPostStore","Editor","constructor","props","arguments","galleryWithImageBlocks","window","wp","galleryBlockV2Enabled","initialHtmlModeEnabled","mode","switchEditorMode","getEditorSettings","maxSize","setTitleRef","bind","settings","hasFixedToolbar","focusMode","hiddenBlockTypes","blockTypes","isRTL","length","allowedBlockTypes","undefined","defaultAllowedBlockTypes","map","name","filter","type","includes","componentDidMount","editEntityRecord","postType","postId","subscriptionParentSetFocusOnTitle","postTitleRef","focus","focusTitleWhenAvailable","subscriptionParentFeaturedImageIdNativeUpdated","payload","featured_media","featuredImageId","undoIgnore","componentWillUnmount","remove","titleRef","render","initialEdits","post","initialHtml","editorSettings","normalizedPost","id","title","raw","initialTitle","content","status","meta","flex","select","isFeatureActive","getEditorMode","__experimentalGetPreviewDeviceType","getHiddenBlockTypes","getBlockTypes","dispatch"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,MAAP,MAAmB,QAAnB;AACA,SAASC,WAAT,QAA4B,cAA5B;AACA,SAASC,sBAAT,QAAuC,8BAAvC;AAEA;AACA;AACA;;AACA,SAASC,SAAT,QAA0B,oBAA1B;AACA,SAASC,cAAT,QAA+B,mBAA/B;AACA,SAASC,KAAT,EAAgBC,SAAhB,EAA2BC,KAAK,IAAIC,WAApC,QAAuD,mBAAvD;AACA,SAASC,YAAT,EAAuBC,UAAvB,QAAyC,iBAAzC;AACA,SAASC,OAAT,QAAwB,oBAAxB;AACA,SACCC,wBADD,EAECC,qCAFD,QAGO,gCAHP;AAIA,SAASC,gBAAT,QAAiC,uBAAjC;AACA,SAASP,KAAK,IAAIQ,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,OAAOC,MAAP,MAAmB,qBAAnB;AACA,SAAST,KAAK,IAAIU,aAAlB,QAAuC,SAAvC;;AAEA,MAAMC,MAAN,SAAqBf,SAArB,CAA+B;AAC9BgB,EAAAA,WAAW,CAAEC,KAAF,EAAU;AACpB,UAAO,GAAGC,SAAV,EADoB,CAGpB;AACA;;AACA,UAAM;AAAEC,MAAAA,sBAAsB,GAAG;AAA3B,QAAoCF,KAA1C;AACAG,IAAAA,MAAM,CAACC,EAAP,CAAUC,qBAAV,GAAkCH,sBAAlC;;AAEA,QAAKF,KAAK,CAACM,sBAAN,IAAgCN,KAAK,CAACO,IAAN,KAAe,QAApD,EAA+D;AAC9D;AACA,WAAKP,KAAL,CAAWQ,gBAAX,CAA6B,MAA7B;AACA;;AAED,SAAKC,iBAAL,GAAyB7B,MAAM,CAAE,KAAK6B,iBAAP,EAA0B;AACxDC,MAAAA,OAAO,EAAE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B1E,YAAY,CAAI2E,QAAF,IAAgB;AAC7B,QAAM;AAAExD,IAAAA;AAAF,MAAuBwD,QAAQ,CAAEnE,aAAF,CAArC;AACA,QAAM;AAAEgC,IAAAA;AAAF,MAAuBmC,QAAQ,CAAErE,SAAF,CAArC;AACA,SAAO;AACNa,IAAAA,gBADM;AAENqB,IAAAA;AAFM,GAAP;AAIA,CAPW,CApBW,CAAF,CAAP,CA4BV/B,MA5BU,CAAf","sourcesContent":["/**\n * External dependencies\n */\nimport memize from 'memize';\nimport { I18nManager } from 'react-native';\nimport { GestureHandlerRootView } from 'react-native-gesture-handler';\n\n/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\nimport { EditorProvider } from '@wordpress/editor';\nimport { parse, serialize, store as blocksStore } from '@wordpress/blocks';\nimport { withDispatch, withSelect } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\nimport {\n\tsubscribeSetFocusOnTitle,\n\tsubscribeFeaturedImageIdNativeUpdated,\n} from '@wordpress/react-native-bridge';\nimport { SlotFillProvider } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport Layout from './components/layout';\nimport { store as editPostStore } from './store';\n\nclass Editor extends Component {\n\tconstructor( props ) {\n\t\tsuper( ...arguments );\n\n\t\t// need to set this globally to avoid race with deprecations\n\t\t// defaulting to true to avoid issues with a not-yet-cached value\n\t\tconst { galleryWithImageBlocks = true } = props;\n\t\twindow.wp.galleryBlockV2Enabled = galleryWithImageBlocks;\n\n\t\tif ( props.initialHtmlModeEnabled && props.mode === 'visual' ) {\n\t\t\t// Enable html mode if the initial mode the parent wants it but we're not already in it.\n\t\t\tthis.props.switchEditorMode( 'text' );\n\t\t}\n\n\t\tthis.getEditorSettings = memize( this.getEditorSettings, {\n\t\t\tmaxSize: 1,\n\t\t} );\n\n\t\tthis.setTitleRef = this.setTitleRef.bind( this );\n\t}\n\n\tgetEditorSettings(\n\t\tsettings,\n\t\thasFixedToolbar,\n\t\tfocusMode,\n\t\thiddenBlockTypes,\n\t\tblockTypes\n\t) {\n\t\tsettings = {\n\t\t\t...settings,\n\t\t\tisRTL: I18nManager.isRTL,\n\t\t\thasFixedToolbar,\n\t\t\tfocusMode,\n\t\t};\n\n\t\t// Omit hidden block types if exists and non-empty.\n\t\tif ( hiddenBlockTypes.length > 0 ) {\n\t\t\tif ( settings.allowedBlockTypes === undefined ) {\n\t\t\t\t// If no specific flags for allowedBlockTypes are set, assume `true`\n\t\t\t\t// meaning allow all block types.\n\t\t\t\tsettings.allowedBlockTypes = true;\n\t\t\t}\n\t\t\t// Defer to passed setting for `allowedBlockTypes` if provided as\n\t\t\t// anything other than `true` (where `true` is equivalent to allow\n\t\t\t// all block types).\n\t\t\tconst defaultAllowedBlockTypes =\n\t\t\t\ttrue === settings.allowedBlockTypes\n\t\t\t\t\t? blockTypes.map( ( { name } ) => name )\n\t\t\t\t\t: settings.allowedBlockTypes || [];\n\n\t\t\tsettings.allowedBlockTypes = defaultAllowedBlockTypes.filter(\n\t\t\t\t( type ) => ! hiddenBlockTypes.includes( type )\n\t\t\t);\n\t\t}\n\n\t\treturn settings;\n\t}\n\n\tcomponentDidMount() {\n\t\tconst { editEntityRecord, postType, postId } = this.props;\n\n\t\tthis.subscriptionParentSetFocusOnTitle = subscribeSetFocusOnTitle(\n\t\t\t() => {\n\t\t\t\tif ( this.postTitleRef ) {\n\t\t\t\t\tthis.postTitleRef.focus();\n\t\t\t\t} else {\n\t\t\t\t\t// If the post title ref is not available, we postpone setting focus to when it's available.\n\t\t\t\t\tthis.focusTitleWhenAvailable = true;\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\n\t\tthis.subscriptionParentFeaturedImageIdNativeUpdated =\n\t\t\tsubscribeFeaturedImageIdNativeUpdated( ( payload ) => {\n\t\t\t\teditEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\tpostId,\n\t\t\t\t\t{ featured_media: payload.featuredImageId },\n\t\t\t\t\t{\n\t\t\t\t\t\tundoIgnore: true,\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t} );\n\t}\n\n\tcomponentWillUnmount() {\n\t\tif ( this.subscriptionParentSetFocusOnTitle ) {\n\t\t\tthis.subscriptionParentSetFocusOnTitle.remove();\n\t\t}\n\n\t\tif ( this.subscribeFeaturedImageIdNativeUpdated ) {\n\t\t\tthis.subscribeFeaturedImageIdNativeUpdated.remove();\n\t\t}\n\t}\n\n\tsetTitleRef( titleRef ) {\n\t\tif ( this.focusTitleWhenAvailable && ! this.postTitleRef ) {\n\t\t\tthis.focusTitleWhenAvailable = false;\n\t\t\ttitleRef.focus();\n\t\t}\n\n\t\tthis.postTitleRef = titleRef;\n\t}\n\n\trender() {\n\t\tconst {\n\t\t\tsettings,\n\t\t\thasFixedToolbar,\n\t\t\tfocusMode,\n\t\t\tinitialEdits,\n\t\t\thiddenBlockTypes,\n\t\t\tblockTypes,\n\t\t\tpost,\n\t\t\tpostId,\n\t\t\tpostType,\n\t\t\tfeaturedImageId,\n\t\t\tinitialHtml,\n\t\t\t...props\n\t\t} = this.props;\n\n\t\tconst editorSettings = this.getEditorSettings(\n\t\t\tsettings,\n\t\t\thasFixedToolbar,\n\t\t\tfocusMode,\n\t\t\thiddenBlockTypes,\n\t\t\tblockTypes\n\t\t);\n\n\t\tconst normalizedPost = post || {\n\t\t\tid: postId,\n\t\t\ttitle: {\n\t\t\t\traw: props.initialTitle || '',\n\t\t\t},\n\t\t\tfeatured_media: featuredImageId,\n\t\t\tcontent: {\n\t\t\t\t// Make sure the post content is in sync with gutenberg store\n\t\t\t\t// to avoid marking the post as modified when simply loaded\n\t\t\t\t// For now, let's assume: serialize( parse( html ) ) !== html.\n\t\t\t\traw: serialize( parse( initialHtml || '' ) ),\n\t\t\t},\n\t\t\ttype: postType,\n\t\t\tstatus: 'draft',\n\t\t\tmeta: [],\n\t\t};\n\n\t\treturn (\n\t\t\t<GestureHandlerRootView style={ { flex: 1 } }>\n\t\t\t\t<SlotFillProvider>\n\t\t\t\t\t<EditorProvider\n\t\t\t\t\t\tsettings={ editorSettings }\n\t\t\t\t\t\tpost={ normalizedPost }\n\t\t\t\t\t\tinitialEdits={ initialEdits }\n\t\t\t\t\t\tuseSubRegistry={ false }\n\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t>\n\t\t\t\t\t\t<Layout setTitleRef={ this.setTitleRef } />\n\t\t\t\t\t</EditorProvider>\n\t\t\t\t</SlotFillProvider>\n\t\t\t</GestureHandlerRootView>\n\t\t);\n\t}\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst {\n\t\t\tisFeatureActive,\n\t\t\tgetEditorMode,\n\t\t\t__experimentalGetPreviewDeviceType,\n\t\t\tgetHiddenBlockTypes,\n\t\t} = select( editPostStore );\n\t\tconst { getBlockTypes } = select( blocksStore );\n\n\t\treturn {\n\t\t\thasFixedToolbar:\n\t\t\t\tisFeatureActive( 'fixedToolbar' ) ||\n\t\t\t\t__experimentalGetPreviewDeviceType() !== 'Desktop',\n\t\t\tfocusMode: isFeatureActive( 'focusMode' ),\n\t\t\tmode: getEditorMode(),\n\t\t\thiddenBlockTypes: getHiddenBlockTypes(),\n\t\t\tblockTypes: getBlockTypes(),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { switchEditorMode } = dispatch( editPostStore );\n\t\tconst { editEntityRecord } = dispatch( coreStore );\n\t\treturn {\n\t\t\tswitchEditorMode,\n\t\t\teditEntityRecord,\n\t\t};\n\t} ),\n] )( Editor );\n"]}
@@ -34,32 +34,24 @@ withSelect((select, block) => {
34
34
 
35
35
 
36
36
  const blocks = select(blockEditorStore).getBlocks();
37
- const firstOfSameType = blocks.find(_ref => {
38
- let {
39
- name
40
- } = _ref;
41
- return block.name === name;
42
- });
37
+ const firstOfSameType = blocks.find(({
38
+ name
39
+ }) => block.name === name);
43
40
  const isInvalid = firstOfSameType && firstOfSameType.clientId !== block.clientId;
44
41
  return {
45
42
  originalBlockClientId: isInvalid && firstOfSameType.clientId
46
43
  };
47
- }), withDispatch((dispatch, _ref2) => {
48
- let {
49
- originalBlockClientId
50
- } = _ref2;
51
- return {
52
- selectFirst: () => dispatch(blockEditorStore).selectBlock(originalBlockClientId)
53
- };
54
- }));
44
+ }), withDispatch((dispatch, {
45
+ originalBlockClientId
46
+ }) => ({
47
+ selectFirst: () => dispatch(blockEditorStore).selectBlock(originalBlockClientId)
48
+ })));
55
49
  const withMultipleValidation = createHigherOrderComponent(BlockEdit => {
56
- return enhance(_ref3 => {
57
- let {
58
- originalBlockClientId,
59
- selectFirst,
60
- ...props
61
- } = _ref3;
62
-
50
+ return enhance(({
51
+ originalBlockClientId,
52
+ selectFirst,
53
+ ...props
54
+ }) => {
63
55
  if (!originalBlockClientId) {
64
56
  return createElement(BlockEdit, props);
65
57
  }
@@ -88,7 +80,7 @@ const withMultipleValidation = createHigherOrderComponent(BlockEdit => {
88
80
  variant: "secondary",
89
81
  onClick: () => props.onReplace(createBlock(outboundType.name, props.attributes))
90
82
  }, __('Transform into:'), " ", outboundType.title)]
91
- }, createElement("strong", null, blockType === null || blockType === void 0 ? void 0 : blockType.title, ": "), __('This block can only be used once.'))];
83
+ }, createElement("strong", null, blockType?.title, ": "), __('This block can only be used once.'))];
92
84
  });
93
85
  }, 'withMultipleValidation');
94
86
  /**
@@ -102,13 +94,10 @@ const withMultipleValidation = createHigherOrderComponent(BlockEdit => {
102
94
 
103
95
  function getOutboundType(blockName) {
104
96
  // Grab the first outbound transform.
105
- const transform = findTransform(getBlockTransforms('to', blockName), _ref4 => {
106
- let {
107
- type,
108
- blocks
109
- } = _ref4;
110
- return type === 'block' && blocks.length === 1;
111
- } // What about when .length > 1?
97
+ const transform = findTransform(getBlockTransforms('to', blockName), ({
98
+ type,
99
+ blocks
100
+ }) => type === 'block' && blocks.length === 1 // What about when .length > 1?
112
101
  );
113
102
 
114
103
  if (!transform) {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-post/src/hooks/validate-multiple-use/index.js"],"names":["createBlock","findTransform","getBlockTransforms","getBlockType","hasBlockSupport","Button","withSelect","withDispatch","Warning","store","blockEditorStore","addFilter","__","compose","createHigherOrderComponent","enhance","select","block","multiple","name","blocks","getBlocks","firstOfSameType","find","isInvalid","clientId","originalBlockClientId","dispatch","selectFirst","selectBlock","withMultipleValidation","BlockEdit","props","blockType","outboundType","getOutboundType","minHeight","onReplace","attributes","title","blockName","transform","type","length"],"mappings":";;;AAAA;AACA;AACA;AACA,SACCA,WADD,EAECC,aAFD,EAGCC,kBAHD,EAICC,YAJD,EAKCC,eALD,QAMO,mBANP;AAOA,SAASC,MAAT,QAAuB,uBAAvB;AACA,SAASC,UAAT,EAAqBC,YAArB,QAAyC,iBAAzC;AACA,SAASC,OAAT,EAAkBC,KAAK,IAAIC,gBAA3B,QAAmD,yBAAnD;AACA,SAASC,SAAT,QAA0B,kBAA1B;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,OAAT,EAAkBC,0BAAlB,QAAoD,oBAApD;AAEA,MAAMC,OAAO,GAAGF,OAAO;AACtB;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACCP,UAAU,CAAE,CAAEU,MAAF,EAAUC,KAAV,KAAqB;AAChC,QAAMC,QAAQ,GAAGd,eAAe,CAAEa,KAAK,CAACE,IAAR,EAAc,UAAd,EAA0B,IAA1B,CAAhC,CADgC,CAGhC;AACA;;AACA,MAAKD,QAAL,EAAgB;AACf,WAAO,EAAP;AACA,GAP+B,CAShC;AACA;;;AACA,QAAME,MAAM,GAAGJ,MAAM,CAAEN,gBAAF,CAAN,CAA2BW,SAA3B,EAAf;AACA,QAAMC,eAAe,GAAGF,MAAM,CAACG,IAAP,CACvB;AAAA,QAAE;AAAEJ,MAAAA;AAAF,KAAF;AAAA,WAAgBF,KAAK,CAACE,IAAN,KAAeA,IAA/B;AAAA,GADuB,CAAxB;AAGA,QAAMK,SAAS,GACdF,eAAe,IAAIA,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thasBlockSupport,\n} from '@wordpress/blocks';\nimport { Button } from '@wordpress/components';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { Warning, store as blockEditorStore } from '@wordpress/block-editor';\nimport { addFilter } from '@wordpress/hooks';\nimport { __ } from '@wordpress/i18n';\nimport { compose, createHigherOrderComponent } from '@wordpress/compose';\n\nconst enhance = compose(\n\t/**\n\t * For blocks whose block type doesn't support `multiple`, provides the\n\t * wrapped component with `originalBlockClientId` -- a reference to the\n\t * first block of the same type in the content -- if and only if that\n\t * \"original\" block is not the current one. Thus, an inexisting\n\t * `originalBlockClientId` prop signals that the block is valid.\n\t *\n\t * @param {WPComponent} WrappedBlockEdit A filtered BlockEdit instance.\n\t *\n\t * @return {WPComponent} Enhanced component with merged state data props.\n\t */\n\twithSelect( ( select, block ) => {\n\t\tconst multiple = hasBlockSupport( block.name, 'multiple', true );\n\n\t\t// For block types with `multiple` support, there is no \"original\n\t\t// block\" to be found in the content, as the block itself is valid.\n\t\tif ( multiple ) {\n\t\t\treturn {};\n\t\t}\n\n\t\t// Otherwise, only pass `originalBlockClientId` if it refers to a different\n\t\t// block from the current one.\n\t\tconst blocks = select( blockEditorStore ).getBlocks();\n\t\tconst firstOfSameType = blocks.find(\n\t\t\t( { name } ) => block.name === name\n\t\t);\n\t\tconst isInvalid =\n\t\t\tfirstOfSameType && firstOfSameType.clientId !== block.clientId;\n\t\treturn {\n\t\t\toriginalBlockClientId: isInvalid && firstOfSameType.clientId,\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch, { originalBlockClientId } ) => ( {\n\t\tselectFirst: () =>\n\t\t\tdispatch( blockEditorStore ).selectBlock( originalBlockClientId ),\n\t} ) )\n);\n\nconst withMultipleValidation = createHigherOrderComponent( ( BlockEdit ) => {\n\treturn enhance( ( { originalBlockClientId, selectFirst, ...props } ) => {\n\t\tif ( ! originalBlockClientId ) {\n\t\t\treturn <BlockEdit { ...props } />;\n\t\t}\n\n\t\tconst blockType = getBlockType( props.name );\n\t\tconst outboundType = getOutboundType( props.name );\n\n\t\treturn [\n\t\t\t<div key=\"invalid-preview\" style={ { minHeight: '60px' } }>\n\t\t\t\t<BlockEdit key=\"block-edit\" { ...props } />\n\t\t\t</div>,\n\t\t\t<Warning\n\t\t\t\tkey=\"multiple-use-warning\"\n\t\t\t\tactions={ [\n\t\t\t\t\t<Button\n\t\t\t\t\t\tkey=\"find-original\"\n\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\tonClick={ selectFirst }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Find original' ) }\n\t\t\t\t\t</Button>,\n\t\t\t\t\t<Button\n\t\t\t\t\t\tkey=\"remove\"\n\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\tonClick={ () => props.onReplace( [] ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Remove' ) }\n\t\t\t\t\t</Button>,\n\t\t\t\t\toutboundType && (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tkey=\"transform\"\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\tprops.onReplace(\n\t\t\t\t\t\t\t\t\tcreateBlock(\n\t\t\t\t\t\t\t\t\t\toutboundType.name,\n\t\t\t\t\t\t\t\t\t\tprops.attributes\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Transform into:' ) } { outboundType.title }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t),\n\t\t\t\t] }\n\t\t\t>\n\t\t\t\t<strong>{ blockType?.title }: </strong>\n\t\t\t\t{ __( 'This block can only be used once.' ) }\n\t\t\t</Warning>,\n\t\t];\n\t} );\n}, 'withMultipleValidation' );\n\n/**\n * Given a base block name, returns the default block type to which to offer\n * transforms.\n *\n * @param {string} blockName Base block name.\n *\n * @return {?Object} The chosen default block type.\n */\nfunction getOutboundType( blockName ) {\n\t// Grab the first outbound transform.\n\tconst transform = findTransform(\n\t\tgetBlockTransforms( 'to', blockName ),\n\t\t( { type, blocks } ) => type === 'block' && blocks.length === 1 // What about when .length > 1?\n\t);\n\n\tif ( ! transform ) {\n\t\treturn null;\n\t}\n\n\treturn getBlockType( transform.blocks[ 0 ] );\n}\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/edit-post/validate-multiple-use/with-multiple-validation',\n\twithMultipleValidation\n);\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-post/src/hooks/validate-multiple-use/index.js"],"names":["createBlock","findTransform","getBlockTransforms","getBlockType","hasBlockSupport","Button","withSelect","withDispatch","Warning","store","blockEditorStore","addFilter","__","compose","createHigherOrderComponent","enhance","select","block","multiple","name","blocks","getBlocks","firstOfSameType","find","isInvalid","clientId","originalBlockClientId","dispatch","selectFirst","selectBlock","withMultipleValidation","BlockEdit","props","blockType","outboundType","getOutboundType","minHeight","onReplace","attributes","title","blockName","transform","type","length"],"mappings":";;;AAAA;AACA;AACA;AACA,SACCA,WADD,EAECC,aAFD,EAGCC,kBAHD,EAICC,YAJD,EAKCC,eALD,QAMO,mBANP;AAOA,SAASC,MAAT,QAAuB,uBAAvB;AACA,SAASC,UAAT,EAAqBC,YAArB,QAAyC,iBAAzC;AACA,SAASC,OAAT,EAAkBC,KAAK,IAAIC,gBAA3B,QAAmD,yBAAnD;AACA,SAASC,SAAT,QAA0B,kBAA1B;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,OAAT,EAAkBC,0BAAlB,QAAoD,oBAApD;AAEA,MAAMC,OAAO,GAAGF,OAAO;AACtB;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACCP,UAAU,CAAE,CAAEU,MAAF,EAAUC,KAAV,KAAqB;AAChC,QAAMC,QAAQ,GAAGd,eAAe,CAAEa,KAAK,CAACE,IAAR,EAAc,UAAd,EAA0B,IAA1B,CAAhC,CADgC,CAGhC;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ED,SAAOtC,YAAY,CAAEsC,SAAS,CAACrB,MAAV,CAAkB,CAAlB,CAAF,CAAnB;AACA;;AAEDT,SAAS,CACR,kBADQ,EAER,+DAFQ,EAGRmB,sBAHQ,CAAT","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tcreateBlock,\n\tfindTransform,\n\tgetBlockTransforms,\n\tgetBlockType,\n\thasBlockSupport,\n} from '@wordpress/blocks';\nimport { Button } from '@wordpress/components';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { Warning, store as blockEditorStore } from '@wordpress/block-editor';\nimport { addFilter } from '@wordpress/hooks';\nimport { __ } from '@wordpress/i18n';\nimport { compose, createHigherOrderComponent } from '@wordpress/compose';\n\nconst enhance = compose(\n\t/**\n\t * For blocks whose block type doesn't support `multiple`, provides the\n\t * wrapped component with `originalBlockClientId` -- a reference to the\n\t * first block of the same type in the content -- if and only if that\n\t * \"original\" block is not the current one. Thus, an inexisting\n\t * `originalBlockClientId` prop signals that the block is valid.\n\t *\n\t * @param {WPComponent} WrappedBlockEdit A filtered BlockEdit instance.\n\t *\n\t * @return {WPComponent} Enhanced component with merged state data props.\n\t */\n\twithSelect( ( select, block ) => {\n\t\tconst multiple = hasBlockSupport( block.name, 'multiple', true );\n\n\t\t// For block types with `multiple` support, there is no \"original\n\t\t// block\" to be found in the content, as the block itself is valid.\n\t\tif ( multiple ) {\n\t\t\treturn {};\n\t\t}\n\n\t\t// Otherwise, only pass `originalBlockClientId` if it refers to a different\n\t\t// block from the current one.\n\t\tconst blocks = select( blockEditorStore ).getBlocks();\n\t\tconst firstOfSameType = blocks.find(\n\t\t\t( { name } ) => block.name === name\n\t\t);\n\t\tconst isInvalid =\n\t\t\tfirstOfSameType && firstOfSameType.clientId !== block.clientId;\n\t\treturn {\n\t\t\toriginalBlockClientId: isInvalid && firstOfSameType.clientId,\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch, { originalBlockClientId } ) => ( {\n\t\tselectFirst: () =>\n\t\t\tdispatch( blockEditorStore ).selectBlock( originalBlockClientId ),\n\t} ) )\n);\n\nconst withMultipleValidation = createHigherOrderComponent( ( BlockEdit ) => {\n\treturn enhance( ( { originalBlockClientId, selectFirst, ...props } ) => {\n\t\tif ( ! originalBlockClientId ) {\n\t\t\treturn <BlockEdit { ...props } />;\n\t\t}\n\n\t\tconst blockType = getBlockType( props.name );\n\t\tconst outboundType = getOutboundType( props.name );\n\n\t\treturn [\n\t\t\t<div key=\"invalid-preview\" style={ { minHeight: '60px' } }>\n\t\t\t\t<BlockEdit key=\"block-edit\" { ...props } />\n\t\t\t</div>,\n\t\t\t<Warning\n\t\t\t\tkey=\"multiple-use-warning\"\n\t\t\t\tactions={ [\n\t\t\t\t\t<Button\n\t\t\t\t\t\tkey=\"find-original\"\n\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\tonClick={ selectFirst }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Find original' ) }\n\t\t\t\t\t</Button>,\n\t\t\t\t\t<Button\n\t\t\t\t\t\tkey=\"remove\"\n\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\tonClick={ () => props.onReplace( [] ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Remove' ) }\n\t\t\t\t\t</Button>,\n\t\t\t\t\toutboundType && (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tkey=\"transform\"\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\tprops.onReplace(\n\t\t\t\t\t\t\t\t\tcreateBlock(\n\t\t\t\t\t\t\t\t\t\toutboundType.name,\n\t\t\t\t\t\t\t\t\t\tprops.attributes\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Transform into:' ) } { outboundType.title }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t),\n\t\t\t\t] }\n\t\t\t>\n\t\t\t\t<strong>{ blockType?.title }: </strong>\n\t\t\t\t{ __( 'This block can only be used once.' ) }\n\t\t\t</Warning>,\n\t\t];\n\t} );\n}, 'withMultipleValidation' );\n\n/**\n * Given a base block name, returns the default block type to which to offer\n * transforms.\n *\n * @param {string} blockName Base block name.\n *\n * @return {?Object} The chosen default block type.\n */\nfunction getOutboundType( blockName ) {\n\t// Grab the first outbound transform.\n\tconst transform = findTransform(\n\t\tgetBlockTransforms( 'to', blockName ),\n\t\t( { type, blocks } ) => type === 'block' && blocks.length === 1 // What about when .length > 1?\n\t);\n\n\tif ( ! transform ) {\n\t\treturn null;\n\t}\n\n\treturn getBlockType( transform.blocks[ 0 ] );\n}\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/edit-post/validate-multiple-use/with-multiple-validation',\n\twithMultipleValidation\n);\n"]}
@@ -18,29 +18,26 @@ import ToolsMoreMenuGroup from '../components/header/tools-more-menu-group';
18
18
  import WelcomeGuideMenuItem from './welcome-guide-menu-item';
19
19
  registerPlugin('edit-post', {
20
20
  render() {
21
- return createElement(Fragment, null, createElement(ToolsMoreMenuGroup, null, _ref => {
22
- let {
23
- onClose
24
- } = _ref;
25
- return createElement(Fragment, null, createElement(MenuItem, {
26
- role: "menuitem",
27
- href: addQueryArgs('edit.php', {
28
- post_type: 'wp_block'
29
- })
30
- }, __('Manage Reusable blocks')), createElement(KeyboardShortcutsHelpMenuItem, {
31
- onSelect: onClose
32
- }), createElement(WelcomeGuideMenuItem, null), createElement(CopyContentMenuItem, null), createElement(MenuItem, {
33
- role: "menuitem",
34
- icon: external,
35
- href: __('https://wordpress.org/documentation/article/wordpress-block-editor/'),
36
- target: "_blank",
37
- rel: "noopener noreferrer"
38
- }, __('Help'), createElement(VisuallyHidden, {
39
- as: "span"
40
- },
41
- /* translators: accessibility text */
42
- __('(opens in a new tab)'))));
43
- }));
21
+ return createElement(Fragment, null, createElement(ToolsMoreMenuGroup, null, ({
22
+ onClose
23
+ }) => createElement(Fragment, null, createElement(MenuItem, {
24
+ role: "menuitem",
25
+ href: addQueryArgs('edit.php', {
26
+ post_type: 'wp_block'
27
+ })
28
+ }, __('Manage Reusable blocks')), createElement(KeyboardShortcutsHelpMenuItem, {
29
+ onSelect: onClose
30
+ }), createElement(WelcomeGuideMenuItem, null), createElement(CopyContentMenuItem, null), createElement(MenuItem, {
31
+ role: "menuitem",
32
+ icon: external,
33
+ href: __('https://wordpress.org/documentation/article/wordpress-block-editor/'),
34
+ target: "_blank",
35
+ rel: "noopener noreferrer"
36
+ }, __('Help'), createElement(VisuallyHidden, {
37
+ as: "span"
38
+ },
39
+ /* translators: accessibility text */
40
+ __('(opens in a new tab)'))))));
44
41
  }
45
42
 
46
43
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-post/src/plugins/index.js"],"names":["MenuItem","VisuallyHidden","external","__","registerPlugin","addQueryArgs","CopyContentMenuItem","KeyboardShortcutsHelpMenuItem","ToolsMoreMenuGroup","WelcomeGuideMenuItem","render","onClose","post_type"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,QAAT,EAAmBC,cAAnB,QAAyC,uBAAzC;AACA,SAASC,QAAT,QAAyB,kBAAzB;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,cAAT,QAA+B,oBAA/B;AACA,SAASC,YAAT,QAA6B,gBAA7B;AAEA;AACA;AACA;;AACA,OAAOC,mBAAP,MAAgC,0BAAhC;AACA,OAAOC,6BAAP,MAA0C,qCAA1C;AACA,OAAOC,kBAAP,MAA+B,4CAA/B;AACA,OAAOC,oBAAP,MAAiC,2BAAjC;AAEAL,cAAc,CAAE,WAAF,EAAe;AAC5BM,EAAAA,MAAM,GAAG;AACR,WACC,8BACC,cAAC,kBAAD,QACG;AAAA,UAAE;AAAEC,QAAAA;AAAF,OAAF;AAAA,aACD,8BACC,cAAC,QAAD;AACC,QAAA,IAAI,EAAC,UADN;AAEC,QAAA,IAAI,EAAGN,YAAY,CAAE,UAAF,EAAc;AAChCO,UAAAA,SAAS,EAAE;AADqB,SAAd;AAFpB,SAMGT,EAAE,CAAE,wBAAF,CANL,CADD,EASC,cAAC,6BAAD;AACC,QAAA,QAAQ,EAAGQ;AADZ,QATD,EAYC,cAAC,oBAAD,OAZD,EAaC,cAAC,mBAAD,OAbD,EAcC,cAAC,QAAD;AACC,QAAA,IAAI,EAAC,UADN;AAEC,QAAA,IAAI,EAAGT,QAFR;AAGC,QAAA,IAAI,EAAGC,EAAE,CACR,qEADQ,CAHV;AAMC,QAAA,MAAM,EAAC,QANR;AAOC,QAAA,GAAG,EAAC;AAPL,SASGA,EAAE,CAAE,MAAF,CATL,EAUC,cAAC,cAAD;AAAgB,QAAA,EAAE,EAAC;AAAnB;AAEE;AACAA,MAAAA,EAAE,CAAE,sBAAF,CAHJ,CAVD,CAdD,CADC;AAAA,KADH,CADD,CADD;AAwCA;;AA1C2B,CAAf,CAAd","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { MenuItem, VisuallyHidden } from '@wordpress/components';\nimport { external } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\nimport { registerPlugin } from '@wordpress/plugins';\nimport { addQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport CopyContentMenuItem from './copy-content-menu-item';\nimport KeyboardShortcutsHelpMenuItem from './keyboard-shortcuts-help-menu-item';\nimport ToolsMoreMenuGroup from '../components/header/tools-more-menu-group';\nimport WelcomeGuideMenuItem from './welcome-guide-menu-item';\n\nregisterPlugin( 'edit-post', {\n\trender() {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<ToolsMoreMenuGroup>\n\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\trole=\"menuitem\"\n\t\t\t\t\t\t\t\thref={ addQueryArgs( 'edit.php', {\n\t\t\t\t\t\t\t\t\tpost_type: 'wp_block',\n\t\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Manage Reusable blocks' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t<KeyboardShortcutsHelpMenuItem\n\t\t\t\t\t\t\t\tonSelect={ onClose }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<WelcomeGuideMenuItem />\n\t\t\t\t\t\t\t<CopyContentMenuItem />\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\trole=\"menuitem\"\n\t\t\t\t\t\t\t\ticon={ external }\n\t\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t\t'https://wordpress.org/documentation/article/wordpress-block-editor/'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Help' ) }\n\t\t\t\t\t\t\t\t<VisuallyHidden as=\"span\">\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t/* translators: accessibility text */\n\t\t\t\t\t\t\t\t\t\t__( '(opens in a new tab)' )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t</ToolsMoreMenuGroup>\n\t\t\t</>\n\t\t);\n\t},\n} );\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-post/src/plugins/index.js"],"names":["MenuItem","VisuallyHidden","external","__","registerPlugin","addQueryArgs","CopyContentMenuItem","KeyboardShortcutsHelpMenuItem","ToolsMoreMenuGroup","WelcomeGuideMenuItem","render","onClose","post_type"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,QAAT,EAAmBC,cAAnB,QAAyC,uBAAzC;AACA,SAASC,QAAT,QAAyB,kBAAzB;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,cAAT,QAA+B,oBAA/B;AACA,SAASC,YAAT,QAA6B,gBAA7B;AAEA;AACA;AACA;;AACA,OAAOC,mBAAP,MAAgC,0BAAhC;AACA,OAAOC,6BAAP,MAA0C,qCAA1C;AACA,OAAOC,kBAAP,MAA+B,4CAA/B;AACA,OAAOC,oBAAP,MAAiC,2BAAjC;AAEAL,cAAc,CAAE,WAAF,EAAe;AAC5BM,EAAAA,MAAM,GAAG;AACR,WACC,8BACC,cAAC,kBAAD,QACG,CAAE;AAAEC,MAAAA;AAAF,KAAF,KACD,8BACC,cAAC,QAAD;AACC,MAAA,IAAI,EAAC,UADN;AAEC,MAAA,IAAI,EAAGN,YAAY,CAAE,UAAF,EAAc;AAChCO,QAAAA,SAAS,EAAE;AADqB,OAAd;AAFpB,OAMGT,EAAE,CAAE,wBAAF,CANL,CADD,EASC,cAAC,6BAAD;AACC,MAAA,QAAQ,EAAGQ;AADZ,MATD,EAYC,cAAC,oBAAD,OAZD,EAaC,cAAC,mBAAD,OAbD,EAcC,cAAC,QAAD;AACC,MAAA,IAAI,EAAC,UADN;AAEC,MAAA,IAAI,EAAGT,QAFR;AAGC,MAAA,IAAI,EAAGC,EAAE,CACR,qEADQ,CAHV;AAMC,MAAA,MAAM,EAAC,QANR;AAOC,MAAA,GAAG,EAAC;AAPL,OASGA,EAAE,CAAE,MAAF,CATL,EAUC,cAAC,cAAD;AAAgB,MAAA,EAAE,EAAC;AAAnB;AAEE;AACAA,IAAAA,EAAE,CAAE,sBAAF,CAHJ,CAVD,CAdD,CAFF,CADD,CADD;AAwCA;;AA1C2B,CAAf,CAAd","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { MenuItem, VisuallyHidden } from '@wordpress/components';\nimport { external } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\nimport { registerPlugin } from '@wordpress/plugins';\nimport { addQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport CopyContentMenuItem from './copy-content-menu-item';\nimport KeyboardShortcutsHelpMenuItem from './keyboard-shortcuts-help-menu-item';\nimport ToolsMoreMenuGroup from '../components/header/tools-more-menu-group';\nimport WelcomeGuideMenuItem from './welcome-guide-menu-item';\n\nregisterPlugin( 'edit-post', {\n\trender() {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<ToolsMoreMenuGroup>\n\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\trole=\"menuitem\"\n\t\t\t\t\t\t\t\thref={ addQueryArgs( 'edit.php', {\n\t\t\t\t\t\t\t\t\tpost_type: 'wp_block',\n\t\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Manage Reusable blocks' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t<KeyboardShortcutsHelpMenuItem\n\t\t\t\t\t\t\t\tonSelect={ onClose }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<WelcomeGuideMenuItem />\n\t\t\t\t\t\t\t<CopyContentMenuItem />\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\trole=\"menuitem\"\n\t\t\t\t\t\t\t\ticon={ external }\n\t\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t\t'https://wordpress.org/documentation/article/wordpress-block-editor/'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Help' ) }\n\t\t\t\t\t\t\t\t<VisuallyHidden as=\"span\">\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t/* translators: accessibility text */\n\t\t\t\t\t\t\t\t\t\t__( '(opens in a new tab)' )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t</ToolsMoreMenuGroup>\n\t\t\t</>\n\t\t);\n\t},\n} );\n"]}
@@ -12,10 +12,9 @@ import { displayShortcut } from '@wordpress/keycodes';
12
12
  */
13
13
 
14
14
  import { store as editPostStore } from '../../store';
15
- export function KeyboardShortcutsHelpMenuItem(_ref) {
16
- let {
17
- openModal
18
- } = _ref;
15
+ export function KeyboardShortcutsHelpMenuItem({
16
+ openModal
17
+ }) {
19
18
  return createElement(MenuItem, {
20
19
  onClick: () => {
21
20
  openModal('edit-post/keyboard-shortcut-help');
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-post/src/plugins/keyboard-shortcuts-help-menu-item/index.js"],"names":["MenuItem","withDispatch","__","displayShortcut","store","editPostStore","KeyboardShortcutsHelpMenuItem","openModal","access","dispatch"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,QAAT,QAAyB,uBAAzB;AACA,SAASC,YAAT,QAA6B,iBAA7B;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,eAAT,QAAgC,qBAAhC;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,aAAvC;AAEA,OAAO,SAASC,6BAAT,OAAwD;AAAA,MAAhB;AAAEC,IAAAA;AAAF,GAAgB;AAC9D,SACC,cAAC,QAAD;AACC,IAAA,OAAO,EAAG,MAAM;AACfA,MAAAA,SAAS,CAAE,kCAAF,CAAT;AACA,KAHF;AAIC,IAAA,QAAQ,EAAGJ,eAAe,CAACK,MAAhB,CAAwB,GAAxB;AAJZ,KAMGN,EAAE,CAAE,oBAAF,CANL,CADD;AAUA;AAED,eAAeD,YAAY,CAAIQ,QAAF,IAAgB;AAC5C,QAAM;AAAEF,IAAAA;AAAF,MAAgBE,QAAQ,CAAEJ,aAAF,CAA9B;AAEA,SAAO;AACNE,IAAAA;AADM,GAAP;AAGA,CAN0B,CAAZ,CAMVD,6BANU,CAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { MenuItem } from '@wordpress/components';\nimport { withDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { displayShortcut } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../store';\n\nexport function KeyboardShortcutsHelpMenuItem( { openModal } ) {\n\treturn (\n\t\t<MenuItem\n\t\t\tonClick={ () => {\n\t\t\t\topenModal( 'edit-post/keyboard-shortcut-help' );\n\t\t\t} }\n\t\t\tshortcut={ displayShortcut.access( 'h' ) }\n\t\t>\n\t\t\t{ __( 'Keyboard shortcuts' ) }\n\t\t</MenuItem>\n\t);\n}\n\nexport default withDispatch( ( dispatch ) => {\n\tconst { openModal } = dispatch( editPostStore );\n\n\treturn {\n\t\topenModal,\n\t};\n} )( KeyboardShortcutsHelpMenuItem );\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-post/src/plugins/keyboard-shortcuts-help-menu-item/index.js"],"names":["MenuItem","withDispatch","__","displayShortcut","store","editPostStore","KeyboardShortcutsHelpMenuItem","openModal","access","dispatch"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,QAAT,QAAyB,uBAAzB;AACA,SAASC,YAAT,QAA6B,iBAA7B;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,eAAT,QAAgC,qBAAhC;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,aAAvC;AAEA,OAAO,SAASC,6BAAT,CAAwC;AAAEC,EAAAA;AAAF,CAAxC,EAAwD;AAC9D,SACC,cAAC,QAAD;AACC,IAAA,OAAO,EAAG,MAAM;AACfA,MAAAA,SAAS,CAAE,kCAAF,CAAT;AACA,KAHF;AAIC,IAAA,QAAQ,EAAGJ,eAAe,CAACK,MAAhB,CAAwB,GAAxB;AAJZ,KAMGN,EAAE,CAAE,oBAAF,CANL,CADD;AAUA;AAED,eAAeD,YAAY,CAAIQ,QAAF,IAAgB;AAC5C,QAAM;AAAEF,IAAAA;AAAF,MAAgBE,QAAQ,CAAEJ,aAAF,CAA9B;AAEA,SAAO;AACNE,IAAAA;AADM,GAAP;AAGA,CAN0B,CAAZ,CAMVD,6BANU,CAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { MenuItem } from '@wordpress/components';\nimport { withDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { displayShortcut } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../store';\n\nexport function KeyboardShortcutsHelpMenuItem( { openModal } ) {\n\treturn (\n\t\t<MenuItem\n\t\t\tonClick={ () => {\n\t\t\t\topenModal( 'edit-post/keyboard-shortcut-help' );\n\t\t\t} }\n\t\t\tshortcut={ displayShortcut.access( 'h' ) }\n\t\t>\n\t\t\t{ __( 'Keyboard shortcuts' ) }\n\t\t</MenuItem>\n\t);\n}\n\nexport default withDispatch( ( dispatch ) => {\n\tconst { openModal } = dispatch( editPostStore );\n\n\treturn {\n\t\topenModal,\n\t};\n} )( KeyboardShortcutsHelpMenuItem );\n"]}
@@ -22,22 +22,16 @@ import { store as editPostStore } from '.';
22
22
  * @param {?string} name Sidebar name to be opened.
23
23
  */
24
24
 
25
- export const openGeneralSidebar = name => _ref => {
26
- let {
27
- registry
28
- } = _ref;
29
- return registry.dispatch(interfaceStore).enableComplementaryArea(editPostStore.name, name);
30
- };
25
+ export const openGeneralSidebar = name => ({
26
+ registry
27
+ }) => registry.dispatch(interfaceStore).enableComplementaryArea(editPostStore.name, name);
31
28
  /**
32
29
  * Returns an action object signalling that the user closed the sidebar.
33
30
  */
34
31
 
35
- export const closeGeneralSidebar = () => _ref2 => {
36
- let {
37
- registry
38
- } = _ref2;
39
- return registry.dispatch(interfaceStore).disableComplementaryArea(editPostStore.name);
40
- };
32
+ export const closeGeneralSidebar = () => ({
33
+ registry
34
+ }) => registry.dispatch(interfaceStore).disableComplementaryArea(editPostStore.name);
41
35
  /**
42
36
  * Returns an action object used in signalling that the user opened a modal.
43
37
  *
@@ -106,14 +100,13 @@ export function togglePublishSidebar() {
106
100
  * @return {Object} Action object.
107
101
  */
108
102
 
109
- export const toggleEditorPanelEnabled = panelName => _ref3 => {
103
+ export const toggleEditorPanelEnabled = panelName => ({
104
+ registry
105
+ }) => {
110
106
  var _registry$select$get;
111
107
 
112
- let {
113
- registry
114
- } = _ref3;
115
108
  const inactivePanels = (_registry$select$get = registry.select(preferencesStore).get('core/edit-post', 'inactivePanels')) !== null && _registry$select$get !== void 0 ? _registry$select$get : [];
116
- const isPanelInactive = !!(inactivePanels !== null && inactivePanels !== void 0 && inactivePanels.includes(panelName)); // If the panel is inactive, remove it to enable it, else add it to
109
+ const isPanelInactive = !!inactivePanels?.includes(panelName); // If the panel is inactive, remove it to enable it, else add it to
117
110
  // make it inactive.
118
111
 
119
112
  let updatedInactivePanels;
@@ -132,14 +125,13 @@ export const toggleEditorPanelEnabled = panelName => _ref3 => {
132
125
  * @param {string} panelName A string that identifies the panel to open or close.
133
126
  */
134
127
 
135
- export const toggleEditorPanelOpened = panelName => _ref4 => {
128
+ export const toggleEditorPanelOpened = panelName => ({
129
+ registry
130
+ }) => {
136
131
  var _registry$select$get2;
137
132
 
138
- let {
139
- registry
140
- } = _ref4;
141
133
  const openPanels = (_registry$select$get2 = registry.select(preferencesStore).get('core/edit-post', 'openPanels')) !== null && _registry$select$get2 !== void 0 ? _registry$select$get2 : [];
142
- const isPanelOpen = !!(openPanels !== null && openPanels !== void 0 && openPanels.includes(panelName)); // If the panel is open, remove it to close it, else add it to
134
+ const isPanelOpen = !!openPanels?.includes(panelName); // If the panel is open, remove it to close it, else add it to
143
135
  // make it open.
144
136
 
145
137
  let updatedOpenPanels;
@@ -172,22 +164,18 @@ export function removeEditorPanel(panelName) {
172
164
  * @param {string} feature Feature name.
173
165
  */
174
166
 
175
- export const toggleFeature = feature => _ref5 => {
176
- let {
177
- registry
178
- } = _ref5;
179
- return registry.dispatch(preferencesStore).toggle('core/edit-post', feature);
180
- };
167
+ export const toggleFeature = feature => ({
168
+ registry
169
+ }) => registry.dispatch(preferencesStore).toggle('core/edit-post', feature);
181
170
  /**
182
171
  * Triggers an action used to switch editor mode.
183
172
  *
184
173
  * @param {string} mode The editor mode.
185
174
  */
186
175
 
187
- export const switchEditorMode = mode => _ref6 => {
188
- let {
189
- registry
190
- } = _ref6;
176
+ export const switchEditorMode = mode => ({
177
+ registry
178
+ }) => {
191
179
  registry.dispatch(preferencesStore).set('core/edit-post', 'editorMode', mode); // Unselect blocks when we switch to the code editor.
192
180
 
193
181
  if (mode !== 'visual') {
@@ -203,10 +191,9 @@ export const switchEditorMode = mode => _ref6 => {
203
191
  * @param {string} pluginName Plugin name.
204
192
  */
205
193
 
206
- export const togglePinnedPluginItem = pluginName => _ref7 => {
207
- let {
208
- registry
209
- } = _ref7;
194
+ export const togglePinnedPluginItem = pluginName => ({
195
+ registry
196
+ }) => {
210
197
  const isPinned = registry.select(interfaceStore).isItemPinned('core/edit-post', pluginName);
211
198
  registry.dispatch(interfaceStore)[isPinned ? 'unpinItem' : 'pinItem']('core/edit-post', pluginName);
212
199
  };
@@ -217,13 +204,11 @@ export const togglePinnedPluginItem = pluginName => _ref7 => {
217
204
  * @param {?string} blockStyle Name of the style that should be auto applied. If undefined, the "auto apply" setting of the block is removed.
218
205
  */
219
206
 
220
- export const updatePreferredStyleVariations = (blockName, blockStyle) => _ref8 => {
207
+ export const updatePreferredStyleVariations = (blockName, blockStyle) => ({
208
+ registry
209
+ }) => {
221
210
  var _registry$select$get3;
222
211
 
223
- let {
224
- registry
225
- } = _ref8;
226
-
227
212
  if (!blockName) {
228
213
  return;
229
214
  }
@@ -248,12 +233,11 @@ export const updatePreferredStyleVariations = (blockName, blockStyle) => _ref8 =
248
233
  * @param {string[]} blockNames Names of block types to show.
249
234
  */
250
235
 
251
- export const showBlockTypes = blockNames => _ref9 => {
236
+ export const showBlockTypes = blockNames => ({
237
+ registry
238
+ }) => {
252
239
  var _registry$select$get4;
253
240
 
254
- let {
255
- registry
256
- } = _ref9;
257
241
  const existingBlockNames = (_registry$select$get4 = registry.select(preferencesStore).get('core/edit-post', 'hiddenBlockTypes')) !== null && _registry$select$get4 !== void 0 ? _registry$select$get4 : [];
258
242
  const newBlockNames = existingBlockNames.filter(type => !(Array.isArray(blockNames) ? blockNames : [blockNames]).includes(type));
259
243
  registry.dispatch(preferencesStore).set('core/edit-post', 'hiddenBlockTypes', newBlockNames);
@@ -264,12 +248,11 @@ export const showBlockTypes = blockNames => _ref9 => {
264
248
  * @param {string[]} blockNames Names of block types to hide.
265
249
  */
266
250
 
267
- export const hideBlockTypes = blockNames => _ref10 => {
251
+ export const hideBlockTypes = blockNames => ({
252
+ registry
253
+ }) => {
268
254
  var _registry$select$get5;
269
255
 
270
- let {
271
- registry
272
- } = _ref10;
273
256
  const existingBlockNames = (_registry$select$get5 = registry.select(preferencesStore).get('core/edit-post', 'hiddenBlockTypes')) !== null && _registry$select$get5 !== void 0 ? _registry$select$get5 : [];
274
257
  const mergedBlockNames = new Set([...existingBlockNames, ...(Array.isArray(blockNames) ? blockNames : [blockNames])]);
275
258
  registry.dispatch(preferencesStore).set('core/edit-post', 'hiddenBlockTypes', [...mergedBlockNames]);
@@ -290,12 +273,11 @@ export function setAvailableMetaBoxesPerLocation(metaBoxesPerLocation) {
290
273
  * Update a metabox.
291
274
  */
292
275
 
293
- export const requestMetaBoxUpdates = () => async _ref11 => {
294
- let {
295
- registry,
296
- select,
297
- dispatch
298
- } = _ref11;
276
+ export const requestMetaBoxUpdates = () => async ({
277
+ registry,
278
+ select,
279
+ dispatch
280
+ }) => {
299
281
  dispatch({
300
282
  type: 'REQUEST_META_BOX_UPDATES'
301
283
  }); // Saves the wp_editor fields.
@@ -320,10 +302,7 @@ export const requestMetaBoxUpdates = () => async _ref11 => {
320
302
 
321
303
  return memo;
322
304
  }, new window.FormData());
323
- additionalData.forEach(_ref12 => {
324
- let [key, value] = _ref12;
325
- return formData.append(key, value);
326
- });
305
+ additionalData.forEach(([key, value]) => formData.append(key, value));
327
306
 
328
307
  try {
329
308
  // Save the metaboxes.
@@ -425,24 +404,20 @@ export function setIsEditingTemplate(value) {
425
404
  * @param {boolean} newTemplate Is new template.
426
405
  */
427
406
 
428
- export const __unstableSwitchToTemplateMode = function () {
429
- let newTemplate = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
430
- return _ref13 => {
431
- let {
432
- registry,
433
- select,
434
- dispatch
435
- } = _ref13;
436
- dispatch(setIsEditingTemplate(true));
437
- const isWelcomeGuideActive = select.isFeatureActive('welcomeGuideTemplate');
438
-
439
- if (!isWelcomeGuideActive) {
440
- const message = newTemplate ? __("Custom template created. You're in template mode now.") : __('Editing template. Changes made here affect all posts and pages that use the template.');
441
- registry.dispatch(noticesStore).createSuccessNotice(message, {
442
- type: 'snackbar'
443
- });
444
- }
445
- };
407
+ export const __unstableSwitchToTemplateMode = (newTemplate = false) => ({
408
+ registry,
409
+ select,
410
+ dispatch
411
+ }) => {
412
+ dispatch(setIsEditingTemplate(true));
413
+ const isWelcomeGuideActive = select.isFeatureActive('welcomeGuideTemplate');
414
+
415
+ if (!isWelcomeGuideActive) {
416
+ const message = newTemplate ? __("Custom template created. You're in template mode now.") : __('Editing template. Changes made here affect all posts and pages that use the template.');
417
+ registry.dispatch(noticesStore).createSuccessNotice(message, {
418
+ type: 'snackbar'
419
+ });
420
+ }
446
421
  };
447
422
  /**
448
423
  * Create a block based template.
@@ -450,10 +425,9 @@ export const __unstableSwitchToTemplateMode = function () {
450
425
  * @param {Object?} template Template to create and assign.
451
426
  */
452
427
 
453
- export const __unstableCreateTemplate = template => async _ref14 => {
454
- let {
455
- registry
456
- } = _ref14;
428
+ export const __unstableCreateTemplate = template => async ({
429
+ registry
430
+ }) => {
457
431
  const savedTemplate = await registry.dispatch(coreStore).saveEntityRecord('postType', 'wp_template', template);
458
432
  const post = registry.select(editorStore).getCurrentPost();
459
433
  registry.dispatch(coreStore).editEntityRecord('postType', post.type, post.id, {
@@ -465,13 +439,11 @@ let metaBoxesInitialized = false;
465
439
  * Initializes WordPress `postboxes` script and the logic for saving meta boxes.
466
440
  */
467
441
 
468
- export const initializeMetaBoxes = () => _ref15 => {
469
- let {
470
- registry,
471
- select,
472
- dispatch
473
- } = _ref15;
474
-
442
+ export const initializeMetaBoxes = () => ({
443
+ registry,
444
+ select,
445
+ dispatch
446
+ }) => {
475
447
  const isEditorReady = registry.select(editorStore).__unstableIsEditorReady();
476
448
 
477
449
  if (!isEditorReady) {