@wordpress/editor 13.11.0 → 13.12.1

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 (416) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/autosave-monitor/index.js +1 -2
  3. package/build/components/autosave-monitor/index.js.map +1 -1
  4. package/build/components/deprecated.js +7 -9
  5. package/build/components/deprecated.js.map +1 -1
  6. package/build/components/document-outline/check.js +4 -5
  7. package/build/components/document-outline/check.js.map +1 -1
  8. package/build/components/document-outline/index.js +12 -16
  9. package/build/components/document-outline/index.js.map +1 -1
  10. package/build/components/document-outline/item.js +22 -25
  11. package/build/components/document-outline/item.js.map +1 -1
  12. package/build/components/editor-help/help-detail-navigation-screen.native.js +6 -9
  13. package/build/components/editor-help/help-detail-navigation-screen.native.js.map +1 -1
  14. package/build/components/editor-help/help-get-support-button.native.js +4 -5
  15. package/build/components/editor-help/help-get-support-button.native.js.map +1 -1
  16. package/build/components/editor-help/help-section-title.native.js +3 -4
  17. package/build/components/editor-help/help-section-title.native.js.map +1 -1
  18. package/build/components/editor-help/help-topic-row.native.js +6 -7
  19. package/build/components/editor-help/help-topic-row.native.js.map +1 -1
  20. package/build/components/editor-help/index.native.js +20 -27
  21. package/build/components/editor-help/index.native.js.map +1 -1
  22. package/build/components/editor-help/view-sections.native.js +16 -20
  23. package/build/components/editor-help/view-sections.native.js.map +1 -1
  24. package/build/components/editor-history/redo.js +2 -6
  25. package/build/components/editor-history/redo.js.map +1 -1
  26. package/build/components/editor-history/undo.js +2 -6
  27. package/build/components/editor-history/undo.js.map +1 -1
  28. package/build/components/editor-notices/index.js +12 -19
  29. package/build/components/editor-notices/index.js.map +1 -1
  30. package/build/components/editor-snackbars/index.js +3 -6
  31. package/build/components/editor-snackbars/index.js.map +1 -1
  32. package/build/components/entities-saved-states/entity-record-item.js +7 -10
  33. package/build/components/entities-saved-states/entity-record-item.js.map +1 -1
  34. package/build/components/entities-saved-states/entity-type-list.js +6 -7
  35. package/build/components/entities-saved-states/entity-type-list.js.map +1 -1
  36. package/build/components/entities-saved-states/hooks/use-is-dirty.js +86 -0
  37. package/build/components/entities-saved-states/hooks/use-is-dirty.js.map +1 -0
  38. package/build/components/entities-saved-states/index.js +43 -116
  39. package/build/components/entities-saved-states/index.js.map +1 -1
  40. package/build/components/error-boundary/index.js +4 -5
  41. package/build/components/error-boundary/index.js.map +1 -1
  42. package/build/components/global-keyboard-shortcuts/save-shortcut.js +3 -4
  43. package/build/components/global-keyboard-shortcuts/save-shortcut.js.map +1 -1
  44. package/build/components/index.js +18 -0
  45. package/build/components/index.js.map +1 -1
  46. package/build/components/media-categories/index.js +25 -42
  47. package/build/components/media-categories/index.js.map +1 -1
  48. package/build/components/page-attributes/check.js +4 -7
  49. package/build/components/page-attributes/check.js.map +1 -1
  50. package/build/components/page-attributes/order.js +7 -9
  51. package/build/components/page-attributes/order.js.map +1 -1
  52. package/build/components/page-attributes/parent.js +5 -12
  53. package/build/components/page-attributes/parent.js.map +1 -1
  54. package/build/components/post-author/check.js +6 -7
  55. package/build/components/post-author/check.js.map +1 -1
  56. package/build/components/post-author/combobox.js +3 -6
  57. package/build/components/post-author/combobox.js.map +1 -1
  58. package/build/components/post-author/index.js +1 -1
  59. package/build/components/post-author/index.js.map +1 -1
  60. package/build/components/post-comments/index.js +4 -6
  61. package/build/components/post-comments/index.js.map +1 -1
  62. package/build/components/post-excerpt/check.js +2 -4
  63. package/build/components/post-excerpt/check.js.map +1 -1
  64. package/build/components/post-excerpt/index.js +4 -5
  65. package/build/components/post-excerpt/index.js.map +1 -1
  66. package/build/components/post-featured-image/check.js +2 -4
  67. package/build/components/post-featured-image/check.js.map +1 -1
  68. package/build/components/post-featured-image/index.js +56 -69
  69. package/build/components/post-featured-image/index.js.map +1 -1
  70. package/build/components/post-format/check.js +6 -9
  71. package/build/components/post-format/check.js.map +1 -1
  72. package/build/components/post-format/index.js +1 -1
  73. package/build/components/post-format/index.js.map +1 -1
  74. package/build/components/post-last-revision/check.js +5 -7
  75. package/build/components/post-last-revision/check.js.map +1 -1
  76. package/build/components/post-last-revision/index.js +4 -5
  77. package/build/components/post-last-revision/index.js.map +1 -1
  78. package/build/components/post-locked-modal/index.js +1 -1
  79. package/build/components/post-locked-modal/index.js.map +1 -1
  80. package/build/components/post-pending-status/check.js +7 -9
  81. package/build/components/post-pending-status/check.js.map +1 -1
  82. package/build/components/post-pending-status/index.js +4 -6
  83. package/build/components/post-pending-status/index.js.map +1 -1
  84. package/build/components/post-pingbacks/index.js +4 -6
  85. package/build/components/post-pingbacks/index.js.map +1 -1
  86. package/build/components/post-preview-button/index.js +8 -12
  87. package/build/components/post-preview-button/index.js.map +1 -1
  88. package/build/components/post-publish-button/index.js +10 -19
  89. package/build/components/post-publish-button/index.js.map +1 -1
  90. package/build/components/post-publish-button/label.js +14 -17
  91. package/build/components/post-publish-button/label.js.map +1 -1
  92. package/build/components/post-publish-panel/index.js +10 -12
  93. package/build/components/post-publish-panel/index.js.map +1 -1
  94. package/build/components/post-publish-panel/maybe-category-panel.js +2 -4
  95. package/build/components/post-publish-panel/maybe-category-panel.js.map +1 -1
  96. package/build/components/post-publish-panel/maybe-post-format-panel.js +9 -12
  97. package/build/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
  98. package/build/components/post-publish-panel/maybe-tags-panel.js +4 -7
  99. package/build/components/post-publish-panel/maybe-tags-panel.js.map +1 -1
  100. package/build/components/post-publish-panel/maybe-upload-media.js +150 -0
  101. package/build/components/post-publish-panel/maybe-upload-media.js.map +1 -0
  102. package/build/components/post-publish-panel/postpublish.js +8 -11
  103. package/build/components/post-publish-panel/postpublish.js.map +1 -1
  104. package/build/components/post-publish-panel/prepublish.js +8 -7
  105. package/build/components/post-publish-panel/prepublish.js.map +1 -1
  106. package/build/components/post-saved-state/index.js +13 -8
  107. package/build/components/post-saved-state/index.js.map +1 -1
  108. package/build/components/post-schedule/check.js +6 -8
  109. package/build/components/post-schedule/check.js.map +1 -1
  110. package/build/components/post-schedule/index.js +8 -12
  111. package/build/components/post-schedule/index.js.map +1 -1
  112. package/build/components/post-schedule/label.js +7 -10
  113. package/build/components/post-schedule/label.js.map +1 -1
  114. package/build/components/post-slug/check.js +3 -4
  115. package/build/components/post-slug/check.js.map +1 -1
  116. package/build/components/post-slug/index.js +5 -6
  117. package/build/components/post-slug/index.js.map +1 -1
  118. package/build/components/post-sticky/check.js +7 -9
  119. package/build/components/post-sticky/check.js.map +1 -1
  120. package/build/components/post-sticky/index.js +4 -5
  121. package/build/components/post-sticky/index.js.map +1 -1
  122. package/build/components/post-switch-to-draft-button/index.js +6 -7
  123. package/build/components/post-switch-to-draft-button/index.js.map +1 -1
  124. package/build/components/post-sync-status/index.js +67 -0
  125. package/build/components/post-sync-status/index.js.map +1 -0
  126. package/build/components/post-taxonomies/check.js +6 -7
  127. package/build/components/post-taxonomies/check.js.map +1 -1
  128. package/build/components/post-taxonomies/flat-term-selector.js +36 -46
  129. package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
  130. package/build/components/post-taxonomies/hierarchical-term-selector.js +13 -14
  131. package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
  132. package/build/components/post-taxonomies/index.js +6 -11
  133. package/build/components/post-taxonomies/index.js.map +1 -1
  134. package/build/components/post-taxonomies/most-used-terms.js +5 -6
  135. package/build/components/post-taxonomies/most-used-terms.js.map +1 -1
  136. package/build/components/post-template/index.js +6 -9
  137. package/build/components/post-template/index.js.map +1 -1
  138. package/build/components/post-title/index.js +8 -5
  139. package/build/components/post-title/index.js.map +1 -1
  140. package/build/components/post-title/index.native.js +8 -11
  141. package/build/components/post-title/index.native.js.map +1 -1
  142. package/build/components/post-trash/check.js +7 -9
  143. package/build/components/post-trash/check.js.map +1 -1
  144. package/build/components/post-type-support-check/index.js +5 -6
  145. package/build/components/post-type-support-check/index.js.map +1 -1
  146. package/build/components/post-url/check.js +4 -5
  147. package/build/components/post-url/check.js.map +1 -1
  148. package/build/components/post-url/index.js +8 -9
  149. package/build/components/post-url/index.js.map +1 -1
  150. package/build/components/post-visibility/check.js +6 -7
  151. package/build/components/post-visibility/check.js.map +1 -1
  152. package/build/components/post-visibility/index.js +14 -19
  153. package/build/components/post-visibility/index.js.map +1 -1
  154. package/build/components/post-visibility/label.js +1 -3
  155. package/build/components/post-visibility/label.js.map +1 -1
  156. package/build/components/provider/index.js +12 -15
  157. package/build/components/provider/index.js.map +1 -1
  158. package/build/components/provider/index.native.js +19 -30
  159. package/build/components/provider/index.native.js.map +1 -1
  160. package/build/components/provider/use-block-editor-settings.js +5 -9
  161. package/build/components/provider/use-block-editor-settings.js.map +1 -1
  162. package/build/components/provider/use-block-editor-settings.native.js +1 -3
  163. package/build/components/provider/use-block-editor-settings.native.js.map +1 -1
  164. package/build/components/provider/with-registry-provider.js +4 -2
  165. package/build/components/provider/with-registry-provider.js.map +1 -1
  166. package/build/components/table-of-contents/index.js +26 -35
  167. package/build/components/table-of-contents/index.js.map +1 -1
  168. package/build/components/table-of-contents/panel.js +4 -5
  169. package/build/components/table-of-contents/panel.js.map +1 -1
  170. package/build/components/template-validation-notice/index.js +4 -6
  171. package/build/components/template-validation-notice/index.js.map +1 -1
  172. package/build/components/theme-support-check/index.js +7 -8
  173. package/build/components/theme-support-check/index.js.map +1 -1
  174. package/build/hooks/custom-sources-backwards-compatibility.js +20 -42
  175. package/build/hooks/custom-sources-backwards-compatibility.js.map +1 -1
  176. package/build/hooks/default-autocompleters.js +1 -2
  177. package/build/hooks/default-autocompleters.js.map +1 -1
  178. package/build/{lockUnlock.js → lock-unlock.js} +1 -1
  179. package/build/lock-unlock.js.map +1 -0
  180. package/build/private-apis.js +5 -2
  181. package/build/private-apis.js.map +1 -1
  182. package/build/store/actions.js +147 -179
  183. package/build/store/actions.js.map +1 -1
  184. package/build/store/actions.native.js +1 -2
  185. package/build/store/actions.native.js.map +1 -1
  186. package/build/store/reducer.js +14 -44
  187. package/build/store/reducer.js.map +1 -1
  188. package/build/store/reducer.native.js +3 -12
  189. package/build/store/reducer.native.js.map +1 -1
  190. package/build/store/selectors.js +23 -54
  191. package/build/store/selectors.js.map +1 -1
  192. package/build/store/utils/notice-builder.js +3 -3
  193. package/build/store/utils/notice-builder.js.map +1 -1
  194. package/build/utils/media-upload/index.js +11 -15
  195. package/build/utils/media-upload/index.js.map +1 -1
  196. package/build/utils/terms.js +3 -6
  197. package/build/utils/terms.js.map +1 -1
  198. package/build-module/components/autosave-monitor/index.js +1 -2
  199. package/build-module/components/autosave-monitor/index.js.map +1 -1
  200. package/build-module/components/deprecated.js +7 -8
  201. package/build-module/components/deprecated.js.map +1 -1
  202. package/build-module/components/document-outline/check.js +4 -5
  203. package/build-module/components/document-outline/check.js.map +1 -1
  204. package/build-module/components/document-outline/index.js +12 -16
  205. package/build-module/components/document-outline/index.js.map +1 -1
  206. package/build-module/components/document-outline/item.js +22 -25
  207. package/build-module/components/document-outline/item.js.map +1 -1
  208. package/build-module/components/editor-help/help-detail-navigation-screen.native.js +6 -8
  209. package/build-module/components/editor-help/help-detail-navigation-screen.native.js.map +1 -1
  210. package/build-module/components/editor-help/help-get-support-button.native.js +4 -5
  211. package/build-module/components/editor-help/help-get-support-button.native.js.map +1 -1
  212. package/build-module/components/editor-help/help-section-title.native.js +3 -4
  213. package/build-module/components/editor-help/help-section-title.native.js.map +1 -1
  214. package/build-module/components/editor-help/help-topic-row.native.js +6 -7
  215. package/build-module/components/editor-help/help-topic-row.native.js.map +1 -1
  216. package/build-module/components/editor-help/index.native.js +20 -25
  217. package/build-module/components/editor-help/index.native.js.map +1 -1
  218. package/build-module/components/editor-help/view-sections.native.js +16 -20
  219. package/build-module/components/editor-help/view-sections.native.js.map +1 -1
  220. package/build-module/components/editor-history/redo.js +2 -3
  221. package/build-module/components/editor-history/redo.js.map +1 -1
  222. package/build-module/components/editor-history/undo.js +2 -3
  223. package/build-module/components/editor-history/undo.js.map +1 -1
  224. package/build-module/components/editor-notices/index.js +12 -19
  225. package/build-module/components/editor-notices/index.js.map +1 -1
  226. package/build-module/components/editor-snackbars/index.js +3 -6
  227. package/build-module/components/editor-snackbars/index.js.map +1 -1
  228. package/build-module/components/entities-saved-states/entity-record-item.js +7 -10
  229. package/build-module/components/entities-saved-states/entity-record-item.js.map +1 -1
  230. package/build-module/components/entities-saved-states/entity-type-list.js +6 -7
  231. package/build-module/components/entities-saved-states/entity-type-list.js.map +1 -1
  232. package/build-module/components/entities-saved-states/hooks/use-is-dirty.js +72 -0
  233. package/build-module/components/entities-saved-states/hooks/use-is-dirty.js.map +1 -0
  234. package/build-module/components/entities-saved-states/index.js +44 -118
  235. package/build-module/components/entities-saved-states/index.js.map +1 -1
  236. package/build-module/components/error-boundary/index.js +4 -5
  237. package/build-module/components/error-boundary/index.js.map +1 -1
  238. package/build-module/components/global-keyboard-shortcuts/save-shortcut.js +3 -4
  239. package/build-module/components/global-keyboard-shortcuts/save-shortcut.js.map +1 -1
  240. package/build-module/components/index.js +2 -0
  241. package/build-module/components/index.js.map +1 -1
  242. package/build-module/components/media-categories/index.js +25 -42
  243. package/build-module/components/media-categories/index.js.map +1 -1
  244. package/build-module/components/page-attributes/check.js +4 -7
  245. package/build-module/components/page-attributes/check.js.map +1 -1
  246. package/build-module/components/page-attributes/order.js +7 -9
  247. package/build-module/components/page-attributes/order.js.map +1 -1
  248. package/build-module/components/page-attributes/parent.js +5 -12
  249. package/build-module/components/page-attributes/parent.js.map +1 -1
  250. package/build-module/components/post-author/check.js +6 -7
  251. package/build-module/components/post-author/check.js.map +1 -1
  252. package/build-module/components/post-author/combobox.js +3 -6
  253. package/build-module/components/post-author/combobox.js.map +1 -1
  254. package/build-module/components/post-author/index.js +1 -1
  255. package/build-module/components/post-author/index.js.map +1 -1
  256. package/build-module/components/post-comments/index.js +4 -6
  257. package/build-module/components/post-comments/index.js.map +1 -1
  258. package/build-module/components/post-excerpt/check.js +2 -3
  259. package/build-module/components/post-excerpt/check.js.map +1 -1
  260. package/build-module/components/post-excerpt/index.js +4 -5
  261. package/build-module/components/post-excerpt/index.js.map +1 -1
  262. package/build-module/components/post-featured-image/check.js +2 -3
  263. package/build-module/components/post-featured-image/check.js.map +1 -1
  264. package/build-module/components/post-featured-image/index.js +56 -69
  265. package/build-module/components/post-featured-image/index.js.map +1 -1
  266. package/build-module/components/post-format/check.js +6 -8
  267. package/build-module/components/post-format/check.js.map +1 -1
  268. package/build-module/components/post-format/index.js +1 -1
  269. package/build-module/components/post-format/index.js.map +1 -1
  270. package/build-module/components/post-last-revision/check.js +5 -7
  271. package/build-module/components/post-last-revision/check.js.map +1 -1
  272. package/build-module/components/post-last-revision/index.js +4 -5
  273. package/build-module/components/post-last-revision/index.js.map +1 -1
  274. package/build-module/components/post-locked-modal/index.js +1 -1
  275. package/build-module/components/post-locked-modal/index.js.map +1 -1
  276. package/build-module/components/post-pending-status/check.js +7 -9
  277. package/build-module/components/post-pending-status/check.js.map +1 -1
  278. package/build-module/components/post-pending-status/index.js +4 -6
  279. package/build-module/components/post-pending-status/index.js.map +1 -1
  280. package/build-module/components/post-pingbacks/index.js +4 -6
  281. package/build-module/components/post-pingbacks/index.js.map +1 -1
  282. package/build-module/components/post-preview-button/index.js +8 -12
  283. package/build-module/components/post-preview-button/index.js.map +1 -1
  284. package/build-module/components/post-publish-button/index.js +10 -18
  285. package/build-module/components/post-publish-button/index.js.map +1 -1
  286. package/build-module/components/post-publish-button/label.js +14 -17
  287. package/build-module/components/post-publish-button/label.js.map +1 -1
  288. package/build-module/components/post-publish-panel/index.js +10 -11
  289. package/build-module/components/post-publish-panel/index.js.map +1 -1
  290. package/build-module/components/post-publish-panel/maybe-category-panel.js +2 -4
  291. package/build-module/components/post-publish-panel/maybe-category-panel.js.map +1 -1
  292. package/build-module/components/post-publish-panel/maybe-post-format-panel.js +9 -12
  293. package/build-module/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
  294. package/build-module/components/post-publish-panel/maybe-tags-panel.js +4 -7
  295. package/build-module/components/post-publish-panel/maybe-tags-panel.js.map +1 -1
  296. package/build-module/components/post-publish-panel/maybe-upload-media.js +138 -0
  297. package/build-module/components/post-publish-panel/maybe-upload-media.js.map +1 -0
  298. package/build-module/components/post-publish-panel/postpublish.js +8 -11
  299. package/build-module/components/post-publish-panel/postpublish.js.map +1 -1
  300. package/build-module/components/post-publish-panel/prepublish.js +7 -7
  301. package/build-module/components/post-publish-panel/prepublish.js.map +1 -1
  302. package/build-module/components/post-saved-state/index.js +13 -8
  303. package/build-module/components/post-saved-state/index.js.map +1 -1
  304. package/build-module/components/post-schedule/check.js +6 -8
  305. package/build-module/components/post-schedule/check.js.map +1 -1
  306. package/build-module/components/post-schedule/index.js +8 -12
  307. package/build-module/components/post-schedule/index.js.map +1 -1
  308. package/build-module/components/post-schedule/label.js +7 -10
  309. package/build-module/components/post-schedule/label.js.map +1 -1
  310. package/build-module/components/post-slug/check.js +3 -4
  311. package/build-module/components/post-slug/check.js.map +1 -1
  312. package/build-module/components/post-slug/index.js +5 -6
  313. package/build-module/components/post-slug/index.js.map +1 -1
  314. package/build-module/components/post-sticky/check.js +7 -9
  315. package/build-module/components/post-sticky/check.js.map +1 -1
  316. package/build-module/components/post-sticky/index.js +4 -5
  317. package/build-module/components/post-sticky/index.js.map +1 -1
  318. package/build-module/components/post-switch-to-draft-button/index.js +6 -7
  319. package/build-module/components/post-switch-to-draft-button/index.js.map +1 -1
  320. package/build-module/components/post-sync-status/index.js +56 -0
  321. package/build-module/components/post-sync-status/index.js.map +1 -0
  322. package/build-module/components/post-taxonomies/check.js +6 -7
  323. package/build-module/components/post-taxonomies/check.js.map +1 -1
  324. package/build-module/components/post-taxonomies/flat-term-selector.js +36 -44
  325. package/build-module/components/post-taxonomies/flat-term-selector.js.map +1 -1
  326. package/build-module/components/post-taxonomies/hierarchical-term-selector.js +13 -14
  327. package/build-module/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
  328. package/build-module/components/post-taxonomies/index.js +6 -11
  329. package/build-module/components/post-taxonomies/index.js.map +1 -1
  330. package/build-module/components/post-taxonomies/most-used-terms.js +5 -6
  331. package/build-module/components/post-taxonomies/most-used-terms.js.map +1 -1
  332. package/build-module/components/post-template/index.js +6 -9
  333. package/build-module/components/post-template/index.js.map +1 -1
  334. package/build-module/components/post-title/index.js +8 -5
  335. package/build-module/components/post-title/index.js.map +1 -1
  336. package/build-module/components/post-title/index.native.js +8 -11
  337. package/build-module/components/post-title/index.native.js.map +1 -1
  338. package/build-module/components/post-trash/check.js +7 -9
  339. package/build-module/components/post-trash/check.js.map +1 -1
  340. package/build-module/components/post-type-support-check/index.js +5 -6
  341. package/build-module/components/post-type-support-check/index.js.map +1 -1
  342. package/build-module/components/post-url/check.js +4 -5
  343. package/build-module/components/post-url/check.js.map +1 -1
  344. package/build-module/components/post-url/index.js +8 -9
  345. package/build-module/components/post-url/index.js.map +1 -1
  346. package/build-module/components/post-visibility/check.js +6 -7
  347. package/build-module/components/post-visibility/check.js.map +1 -1
  348. package/build-module/components/post-visibility/index.js +14 -16
  349. package/build-module/components/post-visibility/index.js.map +1 -1
  350. package/build-module/components/post-visibility/label.js +1 -3
  351. package/build-module/components/post-visibility/label.js.map +1 -1
  352. package/build-module/components/provider/index.js +12 -14
  353. package/build-module/components/provider/index.js.map +1 -1
  354. package/build-module/components/provider/index.native.js +19 -29
  355. package/build-module/components/provider/index.native.js.map +1 -1
  356. package/build-module/components/provider/use-block-editor-settings.js +5 -9
  357. package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
  358. package/build-module/components/provider/use-block-editor-settings.native.js +1 -3
  359. package/build-module/components/provider/use-block-editor-settings.native.js.map +1 -1
  360. package/build-module/components/provider/with-registry-provider.js +4 -2
  361. package/build-module/components/provider/with-registry-provider.js.map +1 -1
  362. package/build-module/components/table-of-contents/index.js +26 -34
  363. package/build-module/components/table-of-contents/index.js.map +1 -1
  364. package/build-module/components/table-of-contents/panel.js +4 -5
  365. package/build-module/components/table-of-contents/panel.js.map +1 -1
  366. package/build-module/components/template-validation-notice/index.js +4 -6
  367. package/build-module/components/template-validation-notice/index.js.map +1 -1
  368. package/build-module/components/theme-support-check/index.js +7 -8
  369. package/build-module/components/theme-support-check/index.js.map +1 -1
  370. package/build-module/hooks/custom-sources-backwards-compatibility.js +20 -39
  371. package/build-module/hooks/custom-sources-backwards-compatibility.js.map +1 -1
  372. package/build-module/hooks/default-autocompleters.js +1 -2
  373. package/build-module/hooks/default-autocompleters.js.map +1 -1
  374. package/build-module/{lockUnlock.js → lock-unlock.js} +1 -1
  375. package/build-module/lock-unlock.js.map +1 -0
  376. package/build-module/private-apis.js +4 -2
  377. package/build-module/private-apis.js.map +1 -1
  378. package/build-module/store/actions.js +147 -179
  379. package/build-module/store/actions.js.map +1 -1
  380. package/build-module/store/actions.native.js +1 -2
  381. package/build-module/store/actions.native.js.map +1 -1
  382. package/build-module/store/reducer.js +14 -44
  383. package/build-module/store/reducer.js.map +1 -1
  384. package/build-module/store/reducer.native.js +3 -12
  385. package/build-module/store/reducer.native.js.map +1 -1
  386. package/build-module/store/selectors.js +21 -54
  387. package/build-module/store/selectors.js.map +1 -1
  388. package/build-module/store/utils/notice-builder.js +3 -3
  389. package/build-module/store/utils/notice-builder.js.map +1 -1
  390. package/build-module/utils/media-upload/index.js +11 -15
  391. package/build-module/utils/media-upload/index.js.map +1 -1
  392. package/build-module/utils/terms.js +3 -6
  393. package/build-module/utils/terms.js.map +1 -1
  394. package/build-style/style-rtl.css +15 -1
  395. package/build-style/style.css +15 -1
  396. package/package.json +30 -31
  397. package/src/components/editor-help/test/index.native.js +3 -2
  398. package/src/components/entities-saved-states/hooks/use-is-dirty.js +87 -0
  399. package/src/components/entities-saved-states/index.js +25 -106
  400. package/src/components/entities-saved-states/test/use-is-dirty.js +94 -0
  401. package/src/components/index.js +2 -0
  402. package/src/components/post-publish-panel/maybe-upload-media.js +167 -0
  403. package/src/components/post-publish-panel/prepublish.js +2 -0
  404. package/src/components/post-publish-panel/style.scss +1 -1
  405. package/src/components/post-saved-state/index.js +6 -0
  406. package/src/components/post-sync-status/index.js +55 -0
  407. package/src/components/post-sync-status/style.scss +16 -0
  408. package/src/components/post-taxonomies/flat-term-selector.js +20 -30
  409. package/src/components/post-title/index.js +4 -1
  410. package/src/components/provider/index.js +1 -1
  411. package/src/components/provider/index.native.js +2 -9
  412. package/src/private-apis.js +3 -1
  413. package/src/style.scss +1 -0
  414. package/build/lockUnlock.js.map +0 -1
  415. package/build-module/lockUnlock.js.map +0 -1
  416. /package/src/{lockUnlock.js → lock-unlock.js} +0 -0
@@ -8,17 +8,16 @@ import { store as coreStore } from '@wordpress/core-data';
8
8
  */
9
9
 
10
10
  import { store as editorStore } from '../../store';
11
- export function ThemeSupportCheck(_ref) {
12
- let {
13
- themeSupports,
14
- children,
15
- postType,
16
- supportKeys
17
- } = _ref;
11
+ export function ThemeSupportCheck({
12
+ themeSupports,
13
+ children,
14
+ postType,
15
+ supportKeys
16
+ }) {
18
17
  const isSupported = (Array.isArray(supportKeys) ? supportKeys : [supportKeys]).some(key => {
19
18
  var _themeSupports$key;
20
19
 
21
- const supported = (_themeSupports$key = themeSupports === null || themeSupports === void 0 ? void 0 : themeSupports[key]) !== null && _themeSupports$key !== void 0 ? _themeSupports$key : false; // 'post-thumbnails' can be boolean or an array of post types.
20
+ const supported = (_themeSupports$key = themeSupports?.[key]) !== null && _themeSupports$key !== void 0 ? _themeSupports$key : false; // 'post-thumbnails' can be boolean or an array of post types.
22
21
  // In the latter case, we need to verify `postType` exists
23
22
  // within `supported`. If `postType` isn't passed, then the check
24
23
  // should fail.
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/theme-support-check/index.js"],"names":["withSelect","store","coreStore","editorStore","ThemeSupportCheck","themeSupports","children","postType","supportKeys","isSupported","Array","isArray","some","key","supported","includes","select","getThemeSupports","getEditedPostAttribute"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,UAAT,QAA2B,iBAA3B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,SAASD,KAAK,IAAIE,WAAlB,QAAqC,aAArC;AAEA,OAAO,SAASC,iBAAT,OAKH;AAAA,MAL+B;AAClCC,IAAAA,aADkC;AAElCC,IAAAA,QAFkC;AAGlCC,IAAAA,QAHkC;AAIlCC,IAAAA;AAJkC,GAK/B;AACH,QAAMC,WAAW,GAAG,CACnBC,KAAK,CAACC,OAAN,CAAeH,WAAf,IAA+BA,WAA/B,GAA6C,CAAEA,WAAF,CAD1B,EAElBI,IAFkB,CAEVC,GAAF,IAAW;AAAA;;AAClB,UAAMC,SAAS,yBAAGT,aAAH,aAAGA,aAAH,uBAAGA,aAAa,CAAIQ,GAAJ,CAAhB,mEAA6B,KAA5C,CADkB,CAElB;AACA;AACA;AACA;;AACA,QAAK,sBAAsBA,GAAtB,IAA6BH,KAAK,CAACC,OAAN,CAAeG,SAAf,CAAlC,EAA+D;AAC9D,aAAOA,SAAS,CAACC,QAAV,CAAoBR,QAApB,CAAP;AACA;;AACD,WAAOO,SAAP;AACA,GAZmB,CAApB;;AAcA,MAAK,CAAEL,WAAP,EAAqB;AACpB,WAAO,IAAP;AACA;;AAED,SAAOH,QAAP;AACA;AAED,eAAeN,UAAU,CAAIgB,MAAF,IAAc;AACxC,QAAM;AAAEC,IAAAA;AAAF,MAAuBD,MAAM,CAAEd,SAAF,CAAnC;AACA,QAAM;AAAEgB,IAAAA;AAAF,MAA6BF,MAAM,CAAEb,WAAF,CAAzC;AACA,SAAO;AACNI,IAAAA,QAAQ,EAAEW,sBAAsB,CAAE,MAAF,CAD1B;AAENb,IAAAA,aAAa,EAAEY,gBAAgB;AAFzB,GAAP;AAIA,CAPwB,CAAV,CAOVb,iBAPU,CAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { withSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport function ThemeSupportCheck( {\n\tthemeSupports,\n\tchildren,\n\tpostType,\n\tsupportKeys,\n} ) {\n\tconst isSupported = (\n\t\tArray.isArray( supportKeys ) ? supportKeys : [ supportKeys ]\n\t).some( ( key ) => {\n\t\tconst supported = themeSupports?.[ key ] ?? false;\n\t\t// 'post-thumbnails' can be boolean or an array of post types.\n\t\t// In the latter case, we need to verify `postType` exists\n\t\t// within `supported`. If `postType` isn't passed, then the check\n\t\t// should fail.\n\t\tif ( 'post-thumbnails' === key && Array.isArray( supported ) ) {\n\t\t\treturn supported.includes( postType );\n\t\t}\n\t\treturn supported;\n\t} );\n\n\tif ( ! isSupported ) {\n\t\treturn null;\n\t}\n\n\treturn children;\n}\n\nexport default withSelect( ( select ) => {\n\tconst { getThemeSupports } = select( coreStore );\n\tconst { getEditedPostAttribute } = select( editorStore );\n\treturn {\n\t\tpostType: getEditedPostAttribute( 'type' ),\n\t\tthemeSupports: getThemeSupports(),\n\t};\n} )( ThemeSupportCheck );\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/theme-support-check/index.js"],"names":["withSelect","store","coreStore","editorStore","ThemeSupportCheck","themeSupports","children","postType","supportKeys","isSupported","Array","isArray","some","key","supported","includes","select","getThemeSupports","getEditedPostAttribute"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,UAAT,QAA2B,iBAA3B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,SAASD,KAAK,IAAIE,WAAlB,QAAqC,aAArC;AAEA,OAAO,SAASC,iBAAT,CAA4B;AAClCC,EAAAA,aADkC;AAElCC,EAAAA,QAFkC;AAGlCC,EAAAA,QAHkC;AAIlCC,EAAAA;AAJkC,CAA5B,EAKH;AACH,QAAMC,WAAW,GAAG,CACnBC,KAAK,CAACC,OAAN,CAAeH,WAAf,IAA+BA,WAA/B,GAA6C,CAAEA,WAAF,CAD1B,EAElBI,IAFkB,CAEVC,GAAF,IAAW;AAAA;;AAClB,UAAMC,SAAS,yBAAGT,aAAa,GAAIQ,GAAJ,CAAhB,mEAA6B,KAA5C,CADkB,CAElB;AACA;AACA;AACA;;AACA,QAAK,sBAAsBA,GAAtB,IAA6BH,KAAK,CAACC,OAAN,CAAeG,SAAf,CAAlC,EAA+D;AAC9D,aAAOA,SAAS,CAACC,QAAV,CAAoBR,QAApB,CAAP;AACA;;AACD,WAAOO,SAAP;AACA,GAZmB,CAApB;;AAcA,MAAK,CAAEL,WAAP,EAAqB;AACpB,WAAO,IAAP;AACA;;AAED,SAAOH,QAAP;AACA;AAED,eAAeN,UAAU,CAAIgB,MAAF,IAAc;AACxC,QAAM;AAAEC,IAAAA;AAAF,MAAuBD,MAAM,CAAEd,SAAF,CAAnC;AACA,QAAM;AAAEgB,IAAAA;AAAF,MAA6BF,MAAM,CAAEb,WAAF,CAAzC;AACA,SAAO;AACNI,IAAAA,QAAQ,EAAEW,sBAAsB,CAAE,MAAF,CAD1B;AAENb,IAAAA,aAAa,EAAEY,gBAAgB;AAFzB,GAAP;AAIA,CAPwB,CAAV,CAOVb,iBAPU,CAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { withSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport function ThemeSupportCheck( {\n\tthemeSupports,\n\tchildren,\n\tpostType,\n\tsupportKeys,\n} ) {\n\tconst isSupported = (\n\t\tArray.isArray( supportKeys ) ? supportKeys : [ supportKeys ]\n\t).some( ( key ) => {\n\t\tconst supported = themeSupports?.[ key ] ?? false;\n\t\t// 'post-thumbnails' can be boolean or an array of post types.\n\t\t// In the latter case, we need to verify `postType` exists\n\t\t// within `supported`. If `postType` isn't passed, then the check\n\t\t// should fail.\n\t\tif ( 'post-thumbnails' === key && Array.isArray( supported ) ) {\n\t\t\treturn supported.includes( postType );\n\t\t}\n\t\treturn supported;\n\t} );\n\n\tif ( ! isSupported ) {\n\t\treturn null;\n\t}\n\n\treturn children;\n}\n\nexport default withSelect( ( select ) => {\n\tconst { getThemeSupports } = select( coreStore );\n\tconst { getEditedPostAttribute } = select( editorStore );\n\treturn {\n\t\tpostType: getEditedPostAttribute( 'type' ),\n\t\tthemeSupports: getThemeSupports(),\n\t};\n} )( ThemeSupportCheck );\n"]}
@@ -1,4 +1,3 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
1
  import { createElement } from "@wordpress/element";
3
2
 
4
3
  /**
@@ -39,41 +38,32 @@ import { store as editorStore } from '../store';
39
38
  * @return {WPHigherOrderComponent} Higher-order component.
40
39
  */
41
40
 
42
- const createWithMetaAttributeSource = metaAttributes => createHigherOrderComponent(BlockEdit => _ref => {
43
- let {
44
- attributes,
45
- setAttributes,
46
- ...props
47
- } = _ref;
41
+ const createWithMetaAttributeSource = metaAttributes => createHigherOrderComponent(BlockEdit => ({
42
+ attributes,
43
+ setAttributes,
44
+ ...props
45
+ }) => {
48
46
  const postType = useSelect(select => select(editorStore).getCurrentPostType(), []);
49
47
  const [meta, setMeta] = useEntityProp('postType', postType, 'meta');
50
48
  const mergedAttributes = useMemo(() => ({ ...attributes,
51
- ...Object.fromEntries(Object.entries(metaAttributes).map(_ref2 => {
52
- let [attributeKey, metaKey] = _ref2;
53
- return [attributeKey, meta[metaKey]];
54
- }))
49
+ ...Object.fromEntries(Object.entries(metaAttributes).map(([attributeKey, metaKey]) => [attributeKey, meta[metaKey]]))
55
50
  }), [attributes, meta]);
56
- return createElement(BlockEdit, _extends({
51
+ return createElement(BlockEdit, {
57
52
  attributes: mergedAttributes,
58
53
  setAttributes: nextAttributes => {
59
54
  const nextMeta = Object.fromEntries(Object.entries(nextAttributes !== null && nextAttributes !== void 0 ? nextAttributes : {}).filter( // Filter to intersection of keys between the updated
60
55
  // attributes and those with an associated meta key.
61
- _ref3 => {
62
- let [key] = _ref3;
63
- return key in metaAttributes;
64
- }).map(_ref4 => {
65
- let [attributeKey, value] = _ref4;
66
- return [// Rename the keys to the expected meta key name.
67
- metaAttributes[attributeKey], value];
68
- }));
56
+ ([key]) => key in metaAttributes).map(([attributeKey, value]) => [// Rename the keys to the expected meta key name.
57
+ metaAttributes[attributeKey], value]));
69
58
 
70
59
  if (Object.entries(nextMeta).length) {
71
60
  setMeta(nextMeta);
72
61
  }
73
62
 
74
63
  setAttributes(nextAttributes);
75
- }
76
- }, props));
64
+ },
65
+ ...props
66
+ });
77
67
  }, 'withMetaAttributeSource');
78
68
  /**
79
69
  * Filters a registered block's settings to enhance a block's `edit` component
@@ -89,17 +79,11 @@ function shimAttributeSource(settings) {
89
79
  var _settings$attributes;
90
80
 
91
81
  /** @type {WPMetaAttributeMapping} */
92
- const metaAttributes = Object.fromEntries(Object.entries((_settings$attributes = settings.attributes) !== null && _settings$attributes !== void 0 ? _settings$attributes : {}).filter(_ref5 => {
93
- let [, {
94
- source
95
- }] = _ref5;
96
- return source === 'meta';
97
- }).map(_ref6 => {
98
- let [attributeKey, {
99
- meta
100
- }] = _ref6;
101
- return [attributeKey, meta];
102
- }));
82
+ const metaAttributes = Object.fromEntries(Object.entries((_settings$attributes = settings.attributes) !== null && _settings$attributes !== void 0 ? _settings$attributes : {}).filter(([, {
83
+ source
84
+ }]) => source === 'meta').map(([attributeKey, {
85
+ meta
86
+ }]) => [attributeKey, meta]));
103
87
 
104
88
  if (Object.entries(metaAttributes).length) {
105
89
  settings.edit = createWithMetaAttributeSource(metaAttributes)(settings.edit);
@@ -127,10 +111,7 @@ addFilter('blocks.registerBlockType', 'core/editor/custom-sources-backwards-comp
127
111
  // In the future, we could support updating block settings, at which point this
128
112
  // implementation could use that mechanism instead.
129
113
 
130
- globalSelect(blocksStore).getBlockTypes().map(_ref7 => {
131
- let {
132
- name
133
- } = _ref7;
134
- return globalSelect(blocksStore).getBlockType(name);
135
- }).forEach(shimAttributeSource);
114
+ globalSelect(blocksStore).getBlockTypes().map(({
115
+ name
116
+ }) => globalSelect(blocksStore).getBlockType(name)).forEach(shimAttributeSource);
136
117
  //# sourceMappingURL=custom-sources-backwards-compatibility.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/hooks/custom-sources-backwards-compatibility.js"],"names":["store","blocksStore","select","globalSelect","useSelect","useEntityProp","useMemo","createHigherOrderComponent","addFilter","editorStore","createWithMetaAttributeSource","metaAttributes","BlockEdit","attributes","setAttributes","props","postType","getCurrentPostType","meta","setMeta","mergedAttributes","Object","fromEntries","entries","map","attributeKey","metaKey","nextAttributes","nextMeta","filter","key","value","length","shimAttributeSource","settings","source","edit","getBlockTypes","name","getBlockType","forEach"],"mappings":"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","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { select as globalSelect, useSelect } from '@wordpress/data';\nimport { useEntityProp } from '@wordpress/core-data';\nimport { useMemo } from '@wordpress/element';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../store';\n\n/** @typedef {import('@wordpress/compose').WPHigherOrderComponent} WPHigherOrderComponent */\n/** @typedef {import('@wordpress/blocks').WPBlockSettings} WPBlockSettings */\n\n/**\n * Object whose keys are the names of block attributes, where each value\n * represents the meta key to which the block attribute is intended to save.\n *\n * @see https://developer.wordpress.org/reference/functions/register_meta/\n *\n * @typedef {Object<string,string>} WPMetaAttributeMapping\n */\n\n/**\n * Given a mapping of attribute names (meta source attributes) to their\n * associated meta key, returns a higher order component that overrides its\n * `attributes` and `setAttributes` props to sync any changes with the edited\n * post's meta keys.\n *\n * @param {WPMetaAttributeMapping} metaAttributes Meta attribute mapping.\n *\n * @return {WPHigherOrderComponent} Higher-order component.\n */\nconst createWithMetaAttributeSource = ( metaAttributes ) =>\n\tcreateHigherOrderComponent(\n\t\t( BlockEdit ) =>\n\t\t\t( { attributes, setAttributes, ...props } ) => {\n\t\t\t\tconst postType = useSelect(\n\t\t\t\t\t( select ) => select( editorStore ).getCurrentPostType(),\n\t\t\t\t\t[]\n\t\t\t\t);\n\t\t\t\tconst [ meta, setMeta ] = useEntityProp(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\t'meta'\n\t\t\t\t);\n\n\t\t\t\tconst mergedAttributes = useMemo(\n\t\t\t\t\t() => ( {\n\t\t\t\t\t\t...attributes,\n\t\t\t\t\t\t...Object.fromEntries(\n\t\t\t\t\t\t\tObject.entries( metaAttributes ).map(\n\t\t\t\t\t\t\t\t( [ attributeKey, metaKey ] ) => [\n\t\t\t\t\t\t\t\t\tattributeKey,\n\t\t\t\t\t\t\t\t\tmeta[ metaKey ],\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} ),\n\t\t\t\t\t[ attributes, meta ]\n\t\t\t\t);\n\n\t\t\t\treturn (\n\t\t\t\t\t<BlockEdit\n\t\t\t\t\t\tattributes={ mergedAttributes }\n\t\t\t\t\t\tsetAttributes={ ( nextAttributes ) => {\n\t\t\t\t\t\t\tconst nextMeta = Object.fromEntries(\n\t\t\t\t\t\t\t\tObject.entries( nextAttributes ?? {} )\n\t\t\t\t\t\t\t\t\t.filter(\n\t\t\t\t\t\t\t\t\t\t// Filter to intersection of keys between the updated\n\t\t\t\t\t\t\t\t\t\t// attributes and those with an associated meta key.\n\t\t\t\t\t\t\t\t\t\t( [ key ] ) => key in metaAttributes\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t.map( ( [ attributeKey, value ] ) => [\n\t\t\t\t\t\t\t\t\t\t// Rename the keys to the expected meta key name.\n\t\t\t\t\t\t\t\t\t\tmetaAttributes[ attributeKey ],\n\t\t\t\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t\t\t\t] )\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\tif ( Object.entries( nextMeta ).length ) {\n\t\t\t\t\t\t\t\tsetMeta( nextMeta );\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tsetAttributes( nextAttributes );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t},\n\t\t'withMetaAttributeSource'\n\t);\n\n/**\n * Filters a registered block's settings to enhance a block's `edit` component\n * to upgrade meta-sourced attributes to use the post's meta entity property.\n *\n * @param {WPBlockSettings} settings Registered block settings.\n *\n * @return {WPBlockSettings} Filtered block settings.\n */\nfunction shimAttributeSource( settings ) {\n\t/** @type {WPMetaAttributeMapping} */\n\tconst metaAttributes = Object.fromEntries(\n\t\tObject.entries( settings.attributes ?? {} )\n\t\t\t.filter( ( [ , { source } ] ) => source === 'meta' )\n\t\t\t.map( ( [ attributeKey, { meta } ] ) => [ attributeKey, meta ] )\n\t);\n\tif ( Object.entries( metaAttributes ).length ) {\n\t\tsettings.edit = createWithMetaAttributeSource( metaAttributes )(\n\t\t\tsettings.edit\n\t\t);\n\t}\n\n\treturn settings;\n}\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/editor/custom-sources-backwards-compatibility/shim-attribute-source',\n\tshimAttributeSource\n);\n\n// The above filter will only capture blocks registered after the filter was\n// added. There may already be blocks registered by this point, and those must\n// be updated to apply the shim.\n//\n// The following implementation achieves this, albeit with a couple caveats:\n// - Only blocks registered on the global store will be modified.\n// - The block settings are directly mutated, since there is currently no\n// mechanism to update an existing block registration. This is the reason for\n// `getBlockType` separate from `getBlockTypes`, since the latter returns a\n// _copy_ of the block registration (i.e. the mutation would not affect the\n// actual registered block settings).\n//\n// `getBlockTypes` or `getBlockType` implementation could change in the future\n// in regards to creating settings clones, but the corresponding end-to-end\n// tests for meta blocks should cover against any potential regressions.\n//\n// In the future, we could support updating block settings, at which point this\n// implementation could use that mechanism instead.\nglobalSelect( blocksStore )\n\t.getBlockTypes()\n\t.map( ( { name } ) => globalSelect( blocksStore ).getBlockType( name ) )\n\t.forEach( shimAttributeSource );\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/hooks/custom-sources-backwards-compatibility.js"],"names":["store","blocksStore","select","globalSelect","useSelect","useEntityProp","useMemo","createHigherOrderComponent","addFilter","editorStore","createWithMetaAttributeSource","metaAttributes","BlockEdit","attributes","setAttributes","props","postType","getCurrentPostType","meta","setMeta","mergedAttributes","Object","fromEntries","entries","map","attributeKey","metaKey","nextAttributes","nextMeta","filter","key","value","length","shimAttributeSource","settings","source","edit","getBlockTypes","name","getBlockType","forEach"],"mappings":"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","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { select as globalSelect, useSelect } from '@wordpress/data';\nimport { useEntityProp } from '@wordpress/core-data';\nimport { useMemo } from '@wordpress/element';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../store';\n\n/** @typedef {import('@wordpress/compose').WPHigherOrderComponent} WPHigherOrderComponent */\n/** @typedef {import('@wordpress/blocks').WPBlockSettings} WPBlockSettings */\n\n/**\n * Object whose keys are the names of block attributes, where each value\n * represents the meta key to which the block attribute is intended to save.\n *\n * @see https://developer.wordpress.org/reference/functions/register_meta/\n *\n * @typedef {Object<string,string>} WPMetaAttributeMapping\n */\n\n/**\n * Given a mapping of attribute names (meta source attributes) to their\n * associated meta key, returns a higher order component that overrides its\n * `attributes` and `setAttributes` props to sync any changes with the edited\n * post's meta keys.\n *\n * @param {WPMetaAttributeMapping} metaAttributes Meta attribute mapping.\n *\n * @return {WPHigherOrderComponent} Higher-order component.\n */\nconst createWithMetaAttributeSource = ( metaAttributes ) =>\n\tcreateHigherOrderComponent(\n\t\t( BlockEdit ) =>\n\t\t\t( { attributes, setAttributes, ...props } ) => {\n\t\t\t\tconst postType = useSelect(\n\t\t\t\t\t( select ) => select( editorStore ).getCurrentPostType(),\n\t\t\t\t\t[]\n\t\t\t\t);\n\t\t\t\tconst [ meta, setMeta ] = useEntityProp(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\t'meta'\n\t\t\t\t);\n\n\t\t\t\tconst mergedAttributes = useMemo(\n\t\t\t\t\t() => ( {\n\t\t\t\t\t\t...attributes,\n\t\t\t\t\t\t...Object.fromEntries(\n\t\t\t\t\t\t\tObject.entries( metaAttributes ).map(\n\t\t\t\t\t\t\t\t( [ attributeKey, metaKey ] ) => [\n\t\t\t\t\t\t\t\t\tattributeKey,\n\t\t\t\t\t\t\t\t\tmeta[ metaKey ],\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} ),\n\t\t\t\t\t[ attributes, meta ]\n\t\t\t\t);\n\n\t\t\t\treturn (\n\t\t\t\t\t<BlockEdit\n\t\t\t\t\t\tattributes={ mergedAttributes }\n\t\t\t\t\t\tsetAttributes={ ( nextAttributes ) => {\n\t\t\t\t\t\t\tconst nextMeta = Object.fromEntries(\n\t\t\t\t\t\t\t\tObject.entries( nextAttributes ?? {} )\n\t\t\t\t\t\t\t\t\t.filter(\n\t\t\t\t\t\t\t\t\t\t// Filter to intersection of keys between the updated\n\t\t\t\t\t\t\t\t\t\t// attributes and those with an associated meta key.\n\t\t\t\t\t\t\t\t\t\t( [ key ] ) => key in metaAttributes\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t.map( ( [ attributeKey, value ] ) => [\n\t\t\t\t\t\t\t\t\t\t// Rename the keys to the expected meta key name.\n\t\t\t\t\t\t\t\t\t\tmetaAttributes[ attributeKey ],\n\t\t\t\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t\t\t\t] )\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\tif ( Object.entries( nextMeta ).length ) {\n\t\t\t\t\t\t\t\tsetMeta( nextMeta );\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tsetAttributes( nextAttributes );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t},\n\t\t'withMetaAttributeSource'\n\t);\n\n/**\n * Filters a registered block's settings to enhance a block's `edit` component\n * to upgrade meta-sourced attributes to use the post's meta entity property.\n *\n * @param {WPBlockSettings} settings Registered block settings.\n *\n * @return {WPBlockSettings} Filtered block settings.\n */\nfunction shimAttributeSource( settings ) {\n\t/** @type {WPMetaAttributeMapping} */\n\tconst metaAttributes = Object.fromEntries(\n\t\tObject.entries( settings.attributes ?? {} )\n\t\t\t.filter( ( [ , { source } ] ) => source === 'meta' )\n\t\t\t.map( ( [ attributeKey, { meta } ] ) => [ attributeKey, meta ] )\n\t);\n\tif ( Object.entries( metaAttributes ).length ) {\n\t\tsettings.edit = createWithMetaAttributeSource( metaAttributes )(\n\t\t\tsettings.edit\n\t\t);\n\t}\n\n\treturn settings;\n}\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/editor/custom-sources-backwards-compatibility/shim-attribute-source',\n\tshimAttributeSource\n);\n\n// The above filter will only capture blocks registered after the filter was\n// added. There may already be blocks registered by this point, and those must\n// be updated to apply the shim.\n//\n// The following implementation achieves this, albeit with a couple caveats:\n// - Only blocks registered on the global store will be modified.\n// - The block settings are directly mutated, since there is currently no\n// mechanism to update an existing block registration. This is the reason for\n// `getBlockType` separate from `getBlockTypes`, since the latter returns a\n// _copy_ of the block registration (i.e. the mutation would not affect the\n// actual registered block settings).\n//\n// `getBlockTypes` or `getBlockType` implementation could change in the future\n// in regards to creating settings clones, but the corresponding end-to-end\n// tests for meta blocks should cover against any potential regressions.\n//\n// In the future, we could support updating block settings, at which point this\n// implementation could use that mechanism instead.\nglobalSelect( blocksStore )\n\t.getBlockTypes()\n\t.map( ( { name } ) => globalSelect( blocksStore ).getBlockType( name ) )\n\t.forEach( shimAttributeSource );\n"]}
@@ -8,8 +8,7 @@ import { addFilter } from '@wordpress/hooks';
8
8
 
9
9
  import { userAutocompleter } from '../components';
10
10
 
11
- function setDefaultCompleters() {
12
- let completers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
11
+ function setDefaultCompleters(completers = []) {
13
12
  // Provide copies so filters may directly modify them.
14
13
  completers.push({ ...userAutocompleter
15
14
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/hooks/default-autocompleters.js"],"names":["addFilter","userAutocompleter","setDefaultCompleters","completers","push"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,kBAA1B;AAEA;AACA;AACA;;AACA,SAASC,iBAAT,QAAkC,eAAlC;;AAEA,SAASC,oBAAT,GAAiD;AAAA,MAAlBC,UAAkB,uEAAL,EAAK;AAChD;AACAA,EAAAA,UAAU,CAACC,IAAX,CAAiB,EAAE,GAAGH;AAAL,GAAjB;AAEA,SAAOE,UAAP;AACA;;AAEDH,SAAS,CACR,gCADQ,EAER,8CAFQ,EAGRE,oBAHQ,CAAT","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport { userAutocompleter } from '../components';\n\nfunction setDefaultCompleters( completers = [] ) {\n\t// Provide copies so filters may directly modify them.\n\tcompleters.push( { ...userAutocompleter } );\n\n\treturn completers;\n}\n\naddFilter(\n\t'editor.Autocomplete.completers',\n\t'editor/autocompleters/set-default-completers',\n\tsetDefaultCompleters\n);\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/hooks/default-autocompleters.js"],"names":["addFilter","userAutocompleter","setDefaultCompleters","completers","push"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,kBAA1B;AAEA;AACA;AACA;;AACA,SAASC,iBAAT,QAAkC,eAAlC;;AAEA,SAASC,oBAAT,CAA+BC,UAAU,GAAG,EAA5C,EAAiD;AAChD;AACAA,EAAAA,UAAU,CAACC,IAAX,CAAiB,EAAE,GAAGH;AAAL,GAAjB;AAEA,SAAOE,UAAP;AACA;;AAEDH,SAAS,CACR,gCADQ,EAER,8CAFQ,EAGRE,oBAHQ,CAAT","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport { userAutocompleter } from '../components';\n\nfunction setDefaultCompleters( completers = [] ) {\n\t// Provide copies so filters may directly modify them.\n\tcompleters.push( { ...userAutocompleter } );\n\n\treturn completers;\n}\n\naddFilter(\n\t'editor.Autocomplete.completers',\n\t'editor/autocompleters/set-default-completers',\n\tsetDefaultCompleters\n);\n"]}
@@ -6,4 +6,4 @@ export const {
6
6
  lock,
7
7
  unlock
8
8
  } = __dangerousOptInToUnstableAPIsOnlyForCoreModules('I know using unstable features means my plugin or theme will inevitably break on the next WordPress release.', '@wordpress/editor');
9
- //# sourceMappingURL=lockUnlock.js.map
9
+ //# sourceMappingURL=lock-unlock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/editor/src/lock-unlock.js"],"names":["__dangerousOptInToUnstableAPIsOnlyForCoreModules","lock","unlock"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,gDAAT,QAAiE,yBAAjE;AACA,OAAO,MAAM;AAAEC,EAAAA,IAAF;AAAQC,EAAAA;AAAR,IACZF,gDAAgD,CAC/C,8GAD+C,EAE/C,mBAF+C,CAD1C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';\nexport const { lock, unlock } =\n\t__dangerousOptInToUnstableAPIsOnlyForCoreModules(\n\t\t'I know using unstable features means my plugin or theme will inevitably break on the next WordPress release.',\n\t\t'@wordpress/editor'\n\t);\n"]}
@@ -2,9 +2,11 @@
2
2
  * Internal dependencies
3
3
  */
4
4
  import { ExperimentalEditorProvider } from './components/provider';
5
- import { lock } from './lockUnlock';
5
+ import { lock } from './lock-unlock';
6
+ import { EntitiesSavedStatesExtensible } from './components/entities-saved-states';
6
7
  export const privateApis = {};
7
8
  lock(privateApis, {
8
- ExperimentalEditorProvider
9
+ ExperimentalEditorProvider,
10
+ EntitiesSavedStatesExtensible
9
11
  });
10
12
  //# sourceMappingURL=private-apis.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/private-apis.js"],"names":["ExperimentalEditorProvider","lock","privateApis"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,0BAAT,QAA2C,uBAA3C;AACA,SAASC,IAAT,QAAqB,cAArB;AAEA,OAAO,MAAMC,WAAW,GAAG,EAApB;AACPD,IAAI,CAAEC,WAAF,EAAe;AAClBF,EAAAA;AADkB,CAAf,CAAJ","sourcesContent":["/**\n * Internal dependencies\n */\nimport { ExperimentalEditorProvider } from './components/provider';\nimport { lock } from './lockUnlock';\n\nexport const privateApis = {};\nlock( privateApis, {\n\tExperimentalEditorProvider,\n} );\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/private-apis.js"],"names":["ExperimentalEditorProvider","lock","EntitiesSavedStatesExtensible","privateApis"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,0BAAT,QAA2C,uBAA3C;AACA,SAASC,IAAT,QAAqB,eAArB;AACA,SAASC,6BAAT,QAA8C,oCAA9C;AAEA,OAAO,MAAMC,WAAW,GAAG,EAApB;AACPF,IAAI,CAAEE,WAAF,EAAe;AAClBH,EAAAA,0BADkB;AAElBE,EAAAA;AAFkB,CAAf,CAAJ","sourcesContent":["/**\n * Internal dependencies\n */\nimport { ExperimentalEditorProvider } from './components/provider';\nimport { lock } from './lock-unlock';\nimport { EntitiesSavedStatesExtensible } from './components/entities-saved-states';\n\nexport const privateApis = {};\nlock( privateApis, {\n\tExperimentalEditorProvider,\n\tEntitiesSavedStatesExtensible,\n} );\n"]}
@@ -24,10 +24,9 @@ import { getNotificationArgumentsForSaveSuccess, getNotificationArgumentsForSave
24
24
  * @param {Array?} template Block Template.
25
25
  */
26
26
 
27
- export const setupEditor = (post, edits, template) => _ref => {
28
- let {
29
- dispatch
30
- } = _ref;
27
+ export const setupEditor = (post, edits, template) => ({
28
+ dispatch
29
+ }) => {
31
30
  dispatch.setupEditorState(post); // Apply a template for new posts only, if exists.
32
31
 
33
32
  const isNewPost = post.status === 'auto-draft';
@@ -51,11 +50,10 @@ export const setupEditor = (post, edits, template) => _ref => {
51
50
  });
52
51
  }
53
52
 
54
- if (edits && Object.values(edits).some(_ref2 => {
55
- var _post$key$raw, _post$key;
53
+ if (edits && Object.values(edits).some(([key, edit]) => {
54
+ var _post$key$raw;
56
55
 
57
- let [key, edit] = _ref2;
58
- return edit !== ((_post$key$raw = (_post$key = post[key]) === null || _post$key === void 0 ? void 0 : _post$key.raw) !== null && _post$key$raw !== void 0 ? _post$key$raw : post[key]);
56
+ return edit !== ((_post$key$raw = post[key]?.raw) !== null && _post$key$raw !== void 0 ? _post$key$raw : post[key]);
59
57
  })) {
60
58
  dispatch.editPost(edits);
61
59
  }
@@ -129,11 +127,10 @@ export function setupEditorState(post) {
129
127
  * @param {Object} options Options for the edit.
130
128
  */
131
129
 
132
- export const editPost = (edits, options) => _ref3 => {
133
- let {
134
- select,
135
- registry
136
- } = _ref3;
130
+ export const editPost = (edits, options) => ({
131
+ select,
132
+ registry
133
+ }) => {
137
134
  const {
138
135
  id,
139
136
  type
@@ -146,76 +143,71 @@ export const editPost = (edits, options) => _ref3 => {
146
143
  * @param {Object} options
147
144
  */
148
145
 
149
- export const savePost = function () {
150
- let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
151
- return async _ref4 => {
152
- let {
153
- select,
154
- dispatch,
155
- registry
156
- } = _ref4;
146
+ export const savePost = (options = {}) => async ({
147
+ select,
148
+ dispatch,
149
+ registry
150
+ }) => {
151
+ if (!select.isEditedPostSaveable()) {
152
+ return;
153
+ }
157
154
 
158
- if (!select.isEditedPostSaveable()) {
159
- return;
160
- }
155
+ const content = select.getEditedPostContent();
161
156
 
162
- const content = select.getEditedPostContent();
157
+ if (!options.isAutosave) {
158
+ dispatch.editPost({
159
+ content
160
+ }, {
161
+ undoIgnore: true
162
+ });
163
+ }
163
164
 
164
- if (!options.isAutosave) {
165
- dispatch.editPost({
166
- content
167
- }, {
168
- undoIgnore: true
169
- });
170
- }
165
+ const previousRecord = select.getCurrentPost();
166
+ const edits = {
167
+ id: previousRecord.id,
168
+ ...registry.select(coreStore).getEntityRecordNonTransientEdits('postType', previousRecord.type, previousRecord.id),
169
+ content
170
+ };
171
+ dispatch({
172
+ type: 'REQUEST_POST_UPDATE_START',
173
+ options
174
+ });
175
+ await registry.dispatch(coreStore).saveEntityRecord('postType', previousRecord.type, edits, options);
176
+ dispatch({
177
+ type: 'REQUEST_POST_UPDATE_FINISH',
178
+ options
179
+ });
180
+ const error = registry.select(coreStore).getLastEntitySaveError('postType', previousRecord.type, previousRecord.id);
171
181
 
172
- const previousRecord = select.getCurrentPost();
173
- const edits = {
174
- id: previousRecord.id,
175
- ...registry.select(coreStore).getEntityRecordNonTransientEdits('postType', previousRecord.type, previousRecord.id),
176
- content
177
- };
178
- dispatch({
179
- type: 'REQUEST_POST_UPDATE_START',
180
- options
182
+ if (error) {
183
+ const args = getNotificationArgumentsForSaveFail({
184
+ post: previousRecord,
185
+ edits,
186
+ error
181
187
  });
182
- await registry.dispatch(coreStore).saveEntityRecord('postType', previousRecord.type, edits, options);
183
- dispatch({
184
- type: 'REQUEST_POST_UPDATE_FINISH',
188
+
189
+ if (args.length) {
190
+ registry.dispatch(noticesStore).createErrorNotice(...args);
191
+ }
192
+ } else {
193
+ const updatedRecord = select.getCurrentPost();
194
+ const args = getNotificationArgumentsForSaveSuccess({
195
+ previousPost: previousRecord,
196
+ post: updatedRecord,
197
+ postType: await registry.resolveSelect(coreStore).getPostType(updatedRecord.type),
185
198
  options
186
199
  });
187
- const error = registry.select(coreStore).getLastEntitySaveError('postType', previousRecord.type, previousRecord.id);
188
-
189
- if (error) {
190
- const args = getNotificationArgumentsForSaveFail({
191
- post: previousRecord,
192
- edits,
193
- error
194
- });
195
-
196
- if (args.length) {
197
- registry.dispatch(noticesStore).createErrorNotice(...args);
198
- }
199
- } else {
200
- const updatedRecord = select.getCurrentPost();
201
- const args = getNotificationArgumentsForSaveSuccess({
202
- previousPost: previousRecord,
203
- post: updatedRecord,
204
- postType: await registry.resolveSelect(coreStore).getPostType(updatedRecord.type),
205
- options
206
- });
207
-
208
- if (args.length) {
209
- registry.dispatch(noticesStore).createSuccessNotice(...args);
210
- } // Make sure that any edits after saving create an undo level and are
211
- // considered for change detection.
212
-
213
-
214
- if (!options.isAutosave) {
215
- registry.dispatch(blockEditorStore).__unstableMarkLastChangeAsPersistent();
216
- }
200
+
201
+ if (args.length) {
202
+ registry.dispatch(noticesStore).createSuccessNotice(...args);
203
+ } // Make sure that any edits after saving create an undo level and are
204
+ // considered for change detection.
205
+
206
+
207
+ if (!options.isAutosave) {
208
+ registry.dispatch(blockEditorStore).__unstableMarkLastChangeAsPersistent();
217
209
  }
218
- };
210
+ }
219
211
  };
220
212
  /**
221
213
  * Action for refreshing the current post.
@@ -237,12 +229,11 @@ export function refreshPost() {
237
229
  * Action for trashing the current post in the editor.
238
230
  */
239
231
 
240
- export const trashPost = () => async _ref5 => {
241
- let {
242
- select,
243
- dispatch,
244
- registry
245
- } = _ref5;
232
+ export const trashPost = () => async ({
233
+ select,
234
+ dispatch,
235
+ registry
236
+ }) => {
246
237
  const postTypeSlug = select.getCurrentPostType();
247
238
  const postType = await registry.resolveSelect(coreStore).getPostType(postTypeSlug);
248
239
  registry.dispatch(noticesStore).removeNotice(TRASH_POST_NOTICE_ID);
@@ -280,50 +271,43 @@ export const trashPost = () => async _ref5 => {
280
271
  * @param {Object?} options Extra flags to identify the autosave.
281
272
  */
282
273
 
283
- export const autosave = function () {
284
- let {
285
- local = false,
286
- ...options
287
- } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
288
- return async _ref6 => {
289
- let {
290
- select,
291
- dispatch
292
- } = _ref6;
293
-
294
- if (local) {
295
- const post = select.getCurrentPost();
296
- const isPostNew = select.isEditedPostNew();
297
- const title = select.getEditedPostAttribute('title');
298
- const content = select.getEditedPostAttribute('content');
299
- const excerpt = select.getEditedPostAttribute('excerpt');
300
- localAutosaveSet(post.id, isPostNew, title, content, excerpt);
301
- } else {
302
- await dispatch.savePost({
303
- isAutosave: true,
304
- ...options
305
- });
306
- }
307
- };
274
+ export const autosave = ({
275
+ local = false,
276
+ ...options
277
+ } = {}) => async ({
278
+ select,
279
+ dispatch
280
+ }) => {
281
+ if (local) {
282
+ const post = select.getCurrentPost();
283
+ const isPostNew = select.isEditedPostNew();
284
+ const title = select.getEditedPostAttribute('title');
285
+ const content = select.getEditedPostAttribute('content');
286
+ const excerpt = select.getEditedPostAttribute('excerpt');
287
+ localAutosaveSet(post.id, isPostNew, title, content, excerpt);
288
+ } else {
289
+ await dispatch.savePost({
290
+ isAutosave: true,
291
+ ...options
292
+ });
293
+ }
308
294
  };
309
295
  /**
310
296
  * Action that restores last popped state in undo history.
311
297
  */
312
298
 
313
- export const redo = () => _ref7 => {
314
- let {
315
- registry
316
- } = _ref7;
299
+ export const redo = () => ({
300
+ registry
301
+ }) => {
317
302
  registry.dispatch(coreStore).redo();
318
303
  };
319
304
  /**
320
305
  * Action that pops a record from undo history and undoes the edit.
321
306
  */
322
307
 
323
- export const undo = () => _ref8 => {
324
- let {
325
- registry
326
- } = _ref8;
308
+ export const undo = () => ({
309
+ registry
310
+ }) => {
327
311
  registry.dispatch(coreStore).undo();
328
312
  };
329
313
  /**
@@ -359,20 +343,18 @@ export function updatePostLock(lock) {
359
343
  * Enable the publish sidebar.
360
344
  */
361
345
 
362
- export const enablePublishSidebar = () => _ref9 => {
363
- let {
364
- registry
365
- } = _ref9;
346
+ export const enablePublishSidebar = () => ({
347
+ registry
348
+ }) => {
366
349
  registry.dispatch(preferencesStore).set('core/edit-post', 'isPublishSidebarEnabled', true);
367
350
  };
368
351
  /**
369
352
  * Disables the publish sidebar.
370
353
  */
371
354
 
372
- export const disablePublishSidebar = () => _ref10 => {
373
- let {
374
- registry
375
- } = _ref10;
355
+ export const disablePublishSidebar = () => ({
356
+ registry
357
+ }) => {
376
358
  registry.dispatch(preferencesStore).set('core/edit-post', 'isPublishSidebarEnabled', false);
377
359
  };
378
360
  /**
@@ -492,49 +474,42 @@ export function unlockPostAutosaving(lockName) {
492
474
  * @param {?Object} options Optional options.
493
475
  */
494
476
 
495
- export const resetEditorBlocks = function (blocks) {
496
- let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
497
- return _ref11 => {
498
- let {
499
- select,
500
- dispatch,
501
- registry
502
- } = _ref11;
477
+ export const resetEditorBlocks = (blocks, options = {}) => ({
478
+ select,
479
+ dispatch,
480
+ registry
481
+ }) => {
482
+ const {
483
+ __unstableShouldCreateUndoLevel,
484
+ selection
485
+ } = options;
486
+ const edits = {
487
+ blocks,
488
+ selection
489
+ };
490
+
491
+ if (__unstableShouldCreateUndoLevel !== false) {
503
492
  const {
504
- __unstableShouldCreateUndoLevel,
505
- selection
506
- } = options;
507
- const edits = {
508
- blocks,
509
- selection
510
- };
511
-
512
- if (__unstableShouldCreateUndoLevel !== false) {
513
- const {
514
- id,
515
- type
516
- } = select.getCurrentPost();
517
- const noChange = registry.select(coreStore).getEditedEntityRecord('postType', type, id).blocks === edits.blocks;
518
-
519
- if (noChange) {
520
- registry.dispatch(coreStore).__unstableCreateUndoLevel('postType', type, id);
521
-
522
- return;
523
- } // We create a new function here on every persistent edit
524
- // to make sure the edit makes the post dirty and creates
525
- // a new undo level.
526
-
527
-
528
- edits.content = _ref12 => {
529
- let {
530
- blocks: blocksForSerialization = []
531
- } = _ref12;
532
- return __unstableSerializeAndClean(blocksForSerialization);
533
- };
534
- }
493
+ id,
494
+ type
495
+ } = select.getCurrentPost();
496
+ const noChange = registry.select(coreStore).getEditedEntityRecord('postType', type, id).blocks === edits.blocks;
535
497
 
536
- dispatch.editPost(edits);
537
- };
498
+ if (noChange) {
499
+ registry.dispatch(coreStore).__unstableCreateUndoLevel('postType', type, id);
500
+
501
+ return;
502
+ } // We create a new function here on every persistent edit
503
+ // to make sure the edit makes the post dirty and creates
504
+ // a new undo level.
505
+
506
+
507
+ edits.content = ({
508
+ blocks: blocksForSerialization = []
509
+ }) => __unstableSerializeAndClean(blocksForSerialization);
510
+ }
511
+
512
+ dispatch.editPost(edits);
538
513
  };
539
514
  /*
540
515
  * Returns an action object used in signalling that the post editor settings have been updated.
@@ -554,22 +529,15 @@ export function updateEditorSettings(settings) {
554
529
  * Backward compatibility
555
530
  */
556
531
 
557
- const getBlockEditorAction = name => function () {
558
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
559
- args[_key] = arguments[_key];
560
- }
561
-
562
- return _ref13 => {
563
- let {
564
- registry
565
- } = _ref13;
566
- deprecated("`wp.data.dispatch( 'core/editor' )." + name + '`', {
567
- since: '5.3',
568
- alternative: "`wp.data.dispatch( 'core/block-editor' )." + name + '`',
569
- version: '6.2'
570
- });
571
- registry.dispatch(blockEditorStore)[name](...args);
572
- };
532
+ const getBlockEditorAction = name => (...args) => ({
533
+ registry
534
+ }) => {
535
+ deprecated("`wp.data.dispatch( 'core/editor' )." + name + '`', {
536
+ since: '5.3',
537
+ alternative: "`wp.data.dispatch( 'core/block-editor' )." + name + '`',
538
+ version: '6.2'
539
+ });
540
+ registry.dispatch(blockEditorStore)[name](...args);
573
541
  };
574
542
  /**
575
543
  * @see resetBlocks in core/block-editor store.