@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
@@ -17,7 +17,7 @@ import { SAVE_POST_NOTICE_ID, TRASH_POST_NOTICE_ID } from '../constants';
17
17
  */
18
18
 
19
19
  export function getNotificationArgumentsForSaveSuccess(data) {
20
- var _data$options, _postType$viewable;
20
+ var _postType$viewable;
21
21
 
22
22
  const {
23
23
  previousPost,
@@ -25,7 +25,7 @@ export function getNotificationArgumentsForSaveSuccess(data) {
25
25
  postType
26
26
  } = data; // Autosaves are neither shown a notice nor redirected.
27
27
 
28
- if ((_data$options = data.options) !== null && _data$options !== void 0 && _data$options.isAutosave) {
28
+ if (data.options?.isAutosave) {
29
29
  return [];
30
30
  } // No notice is shown after trashing a post
31
31
 
@@ -38,7 +38,7 @@ export function getNotificationArgumentsForSaveSuccess(data) {
38
38
  const isPublished = publishStatus.includes(previousPost.status);
39
39
  const willPublish = publishStatus.includes(post.status);
40
40
  let noticeMessage;
41
- let shouldShowLink = (_postType$viewable = postType === null || postType === void 0 ? void 0 : postType.viewable) !== null && _postType$viewable !== void 0 ? _postType$viewable : false;
41
+ let shouldShowLink = (_postType$viewable = postType?.viewable) !== null && _postType$viewable !== void 0 ? _postType$viewable : false;
42
42
  let isDraft; // Always should a notice, which will be spoken for accessibility.
43
43
 
44
44
  if (!isPublished && !willPublish) {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/store/utils/notice-builder.js"],"names":["__","SAVE_POST_NOTICE_ID","TRASH_POST_NOTICE_ID","getNotificationArgumentsForSaveSuccess","data","previousPost","post","postType","options","isAutosave","status","publishStatus","isPublished","includes","willPublish","noticeMessage","shouldShowLink","viewable","isDraft","labels","item_reverted_to_draft","publish","item_published","private","item_published_privately","future","item_scheduled","item_updated","actions","push","label","view_item","url","link","id","type","getNotificationArgumentsForSaveFail","edits","error","code","indexOf","messages","message","test","join","getNotificationArgumentsForTrashFail"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AAEA;AACA;AACA;;AACA,SAASC,mBAAT,EAA8BC,oBAA9B,QAA0D,cAA1D;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,sCAAT,CAAiDC,IAAjD,EAAwD;AAAA;;AAC9D,QAAM;AAAEC,IAAAA,YAAF;AAAgBC,IAAAA,IAAhB;AAAsBC,IAAAA;AAAtB,MAAmCH,IAAzC,CAD8D,CAE9D;;AACA,uBAAKA,IAAI,CAACI,OAAV,0CAAK,cAAcC,UAAnB,EAAgC;AAC/B,WAAO,EAAP;AACA,GAL6D,CAO9D;;;AACA,MAAKH,IAAI,CAACI,MAAL,KAAgB,OAAhB,IAA2BL,YAAY,CAACK,MAAb,KAAwB,OAAxD,EAAkE;AACjE,WAAO,EAAP;AACA;;AAED,QAAMC,aAAa,GAAG,CAAE,SAAF,EAAa,SAAb,EAAwB,QAAxB,CAAtB;AACA,QAAMC,WAAW,GAAGD,aAAa,CAACE,QAAd,CAAwBR,YAAY,CAACK,MAArC,CAApB;AACA,QAAMI,WAAW,GAAGH,aAAa,CAACE,QAAd,CAAwBP,IAAI,CAACI,MAA7B,CAApB;AAEA,MAAIK,aAAJ;AACA,MAAIC,cAAc,yBAAGT,QAAH,aAAGA,QAAH,uBAAGA,QAAQ,CAAEU,QAAb,mEAAyB,KAA3C;AACA,MAAIC,OAAJ,CAlB8D,CAoB9D;;AACA,MAAK,CAAEN,WAAF,IAAiB,CAAEE,WAAxB,EAAsC;AACrC;AACAC,IAAAA,aAAa,GAAGf,EAAE,CAAE,cAAF,CAAlB;AACAk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A,EAAE,EAAEhC;AADL,GAJM,CAAP;AAQA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { SAVE_POST_NOTICE_ID, TRASH_POST_NOTICE_ID } from '../constants';\n\n/**\n * Builds the arguments for a success notification dispatch.\n *\n * @param {Object} data Incoming data to build the arguments from.\n *\n * @return {Array} Arguments for dispatch. An empty array signals no\n * notification should be sent.\n */\nexport function getNotificationArgumentsForSaveSuccess( data ) {\n\tconst { previousPost, post, postType } = data;\n\t// Autosaves are neither shown a notice nor redirected.\n\tif ( data.options?.isAutosave ) {\n\t\treturn [];\n\t}\n\n\t// No notice is shown after trashing a post\n\tif ( post.status === 'trash' && previousPost.status !== 'trash' ) {\n\t\treturn [];\n\t}\n\n\tconst publishStatus = [ 'publish', 'private', 'future' ];\n\tconst isPublished = publishStatus.includes( previousPost.status );\n\tconst willPublish = publishStatus.includes( post.status );\n\n\tlet noticeMessage;\n\tlet shouldShowLink = postType?.viewable ?? false;\n\tlet isDraft;\n\n\t// Always should a notice, which will be spoken for accessibility.\n\tif ( ! isPublished && ! willPublish ) {\n\t\t// If saving a non-published post, don't show notice.\n\t\tnoticeMessage = __( 'Draft saved.' );\n\t\tisDraft = true;\n\t} else if ( isPublished && ! willPublish ) {\n\t\t// If undoing publish status, show specific notice.\n\t\tnoticeMessage = postType.labels.item_reverted_to_draft;\n\t\tshouldShowLink = false;\n\t} else if ( ! isPublished && willPublish ) {\n\t\t// If publishing or scheduling a post, show the corresponding\n\t\t// publish message.\n\t\tnoticeMessage = {\n\t\t\tpublish: postType.labels.item_published,\n\t\t\tprivate: postType.labels.item_published_privately,\n\t\t\tfuture: postType.labels.item_scheduled,\n\t\t}[ post.status ];\n\t} else {\n\t\t// Generic fallback notice.\n\t\tnoticeMessage = postType.labels.item_updated;\n\t}\n\n\tconst actions = [];\n\tif ( shouldShowLink ) {\n\t\tactions.push( {\n\t\t\tlabel: isDraft ? __( 'View Preview' ) : postType.labels.view_item,\n\t\t\turl: post.link,\n\t\t} );\n\t}\n\treturn [\n\t\tnoticeMessage,\n\t\t{\n\t\t\tid: SAVE_POST_NOTICE_ID,\n\t\t\ttype: 'snackbar',\n\t\t\tactions,\n\t\t},\n\t];\n}\n\n/**\n * Builds the fail notification arguments for dispatch.\n *\n * @param {Object} data Incoming data to build the arguments with.\n *\n * @return {Array} Arguments for dispatch. An empty array signals no\n * notification should be sent.\n */\nexport function getNotificationArgumentsForSaveFail( data ) {\n\tconst { post, edits, error } = data;\n\tif ( error && 'rest_autosave_no_changes' === error.code ) {\n\t\t// Autosave requested a new autosave, but there were no changes. This shouldn't\n\t\t// result in an error notice for the user.\n\t\treturn [];\n\t}\n\n\tconst publishStatus = [ 'publish', 'private', 'future' ];\n\tconst isPublished = publishStatus.indexOf( post.status ) !== -1;\n\t// If the post was being published, we show the corresponding publish error message\n\t// Unless we publish an \"updating failed\" message.\n\tconst messages = {\n\t\tpublish: __( 'Publishing failed.' ),\n\t\tprivate: __( 'Publishing failed.' ),\n\t\tfuture: __( 'Scheduling failed.' ),\n\t};\n\tlet noticeMessage =\n\t\t! isPublished && publishStatus.indexOf( edits.status ) !== -1\n\t\t\t? messages[ edits.status ]\n\t\t\t: __( 'Updating failed.' );\n\n\t// Check if message string contains HTML. Notice text is currently only\n\t// supported as plaintext, and stripping the tags may muddle the meaning.\n\tif ( error.message && ! /<\\/?[^>]*>/.test( error.message ) ) {\n\t\tnoticeMessage = [ noticeMessage, error.message ].join( ' ' );\n\t}\n\treturn [\n\t\tnoticeMessage,\n\t\t{\n\t\t\tid: SAVE_POST_NOTICE_ID,\n\t\t},\n\t];\n}\n\n/**\n * Builds the trash fail notification arguments for dispatch.\n *\n * @param {Object} data\n *\n * @return {Array} Arguments for dispatch.\n */\nexport function getNotificationArgumentsForTrashFail( data ) {\n\treturn [\n\t\tdata.error.message && data.error.code !== 'unknown_error'\n\t\t\t? data.error.message\n\t\t\t: __( 'Trashing failed' ),\n\t\t{\n\t\t\tid: TRASH_POST_NOTICE_ID,\n\t\t},\n\t];\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/store/utils/notice-builder.js"],"names":["__","SAVE_POST_NOTICE_ID","TRASH_POST_NOTICE_ID","getNotificationArgumentsForSaveSuccess","data","previousPost","post","postType","options","isAutosave","status","publishStatus","isPublished","includes","willPublish","noticeMessage","shouldShowLink","viewable","isDraft","labels","item_reverted_to_draft","publish","item_published","private","item_published_privately","future","item_scheduled","item_updated","actions","push","label","view_item","url","link","id","type","getNotificationArgumentsForSaveFail","edits","error","code","indexOf","messages","message","test","join","getNotificationArgumentsForTrashFail"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AAEA;AACA;AACA;;AACA,SAASC,mBAAT,EAA8BC,oBAA9B,QAA0D,cAA1D;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,sCAAT,CAAiDC,IAAjD,EAAwD;AAAA;;AAC9D,QAAM;AAAEC,IAAAA,YAAF;AAAgBC,IAAAA,IAAhB;AAAsBC,IAAAA;AAAtB,MAAmCH,IAAzC,CAD8D,CAE9D;;AACA,MAAKA,IAAI,CAACI,OAAL,EAAcC,UAAnB,EAAgC;AAC/B,WAAO,EAAP;AACA,GAL6D,CAO9D;;;AACA,MAAKH,IAAI,CAACI,MAAL,KAAgB,OAAhB,IAA2BL,YAAY,CAACK,MAAb,KAAwB,OAAxD,EAAkE;AACjE,WAAO,EAAP;AACA;;AAED,QAAMC,aAAa,GAAG,CAAE,SAAF,EAAa,SAAb,EAAwB,QAAxB,CAAtB;AACA,QAAMC,WAAW,GAAGD,aAAa,CAACE,QAAd,CAAwBR,YAAY,CAACK,MAArC,CAApB;AACA,QAAMI,WAAW,GAAGH,aAAa,CAACE,QAAd,CAAwBP,IAAI,CAACI,MAA7B,CAApB;AAEA,MAAIK,aAAJ;AACA,MAAIC,cAAc,yBAAGT,QAAQ,EAAEU,QAAb,mEAA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AL,CAAWI,OAAX,IAAsBtC,IAAI,CAACkC,KAAL,CAAWC,IAAX,KAAoB,eAA1C,GACGnC,IAAI,CAACkC,KAAL,CAAWI,OADd,GAEG1C,EAAE,CAAE,iBAAF,CAHC,EAIN;AACCkC,IAAAA,EAAE,EAAEhC;AADL,GAJM,CAAP;AAQA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { SAVE_POST_NOTICE_ID, TRASH_POST_NOTICE_ID } from '../constants';\n\n/**\n * Builds the arguments for a success notification dispatch.\n *\n * @param {Object} data Incoming data to build the arguments from.\n *\n * @return {Array} Arguments for dispatch. An empty array signals no\n * notification should be sent.\n */\nexport function getNotificationArgumentsForSaveSuccess( data ) {\n\tconst { previousPost, post, postType } = data;\n\t// Autosaves are neither shown a notice nor redirected.\n\tif ( data.options?.isAutosave ) {\n\t\treturn [];\n\t}\n\n\t// No notice is shown after trashing a post\n\tif ( post.status === 'trash' && previousPost.status !== 'trash' ) {\n\t\treturn [];\n\t}\n\n\tconst publishStatus = [ 'publish', 'private', 'future' ];\n\tconst isPublished = publishStatus.includes( previousPost.status );\n\tconst willPublish = publishStatus.includes( post.status );\n\n\tlet noticeMessage;\n\tlet shouldShowLink = postType?.viewable ?? false;\n\tlet isDraft;\n\n\t// Always should a notice, which will be spoken for accessibility.\n\tif ( ! isPublished && ! willPublish ) {\n\t\t// If saving a non-published post, don't show notice.\n\t\tnoticeMessage = __( 'Draft saved.' );\n\t\tisDraft = true;\n\t} else if ( isPublished && ! willPublish ) {\n\t\t// If undoing publish status, show specific notice.\n\t\tnoticeMessage = postType.labels.item_reverted_to_draft;\n\t\tshouldShowLink = false;\n\t} else if ( ! isPublished && willPublish ) {\n\t\t// If publishing or scheduling a post, show the corresponding\n\t\t// publish message.\n\t\tnoticeMessage = {\n\t\t\tpublish: postType.labels.item_published,\n\t\t\tprivate: postType.labels.item_published_privately,\n\t\t\tfuture: postType.labels.item_scheduled,\n\t\t}[ post.status ];\n\t} else {\n\t\t// Generic fallback notice.\n\t\tnoticeMessage = postType.labels.item_updated;\n\t}\n\n\tconst actions = [];\n\tif ( shouldShowLink ) {\n\t\tactions.push( {\n\t\t\tlabel: isDraft ? __( 'View Preview' ) : postType.labels.view_item,\n\t\t\turl: post.link,\n\t\t} );\n\t}\n\treturn [\n\t\tnoticeMessage,\n\t\t{\n\t\t\tid: SAVE_POST_NOTICE_ID,\n\t\t\ttype: 'snackbar',\n\t\t\tactions,\n\t\t},\n\t];\n}\n\n/**\n * Builds the fail notification arguments for dispatch.\n *\n * @param {Object} data Incoming data to build the arguments with.\n *\n * @return {Array} Arguments for dispatch. An empty array signals no\n * notification should be sent.\n */\nexport function getNotificationArgumentsForSaveFail( data ) {\n\tconst { post, edits, error } = data;\n\tif ( error && 'rest_autosave_no_changes' === error.code ) {\n\t\t// Autosave requested a new autosave, but there were no changes. This shouldn't\n\t\t// result in an error notice for the user.\n\t\treturn [];\n\t}\n\n\tconst publishStatus = [ 'publish', 'private', 'future' ];\n\tconst isPublished = publishStatus.indexOf( post.status ) !== -1;\n\t// If the post was being published, we show the corresponding publish error message\n\t// Unless we publish an \"updating failed\" message.\n\tconst messages = {\n\t\tpublish: __( 'Publishing failed.' ),\n\t\tprivate: __( 'Publishing failed.' ),\n\t\tfuture: __( 'Scheduling failed.' ),\n\t};\n\tlet noticeMessage =\n\t\t! isPublished && publishStatus.indexOf( edits.status ) !== -1\n\t\t\t? messages[ edits.status ]\n\t\t\t: __( 'Updating failed.' );\n\n\t// Check if message string contains HTML. Notice text is currently only\n\t// supported as plaintext, and stripping the tags may muddle the meaning.\n\tif ( error.message && ! /<\\/?[^>]*>/.test( error.message ) ) {\n\t\tnoticeMessage = [ noticeMessage, error.message ].join( ' ' );\n\t}\n\treturn [\n\t\tnoticeMessage,\n\t\t{\n\t\t\tid: SAVE_POST_NOTICE_ID,\n\t\t},\n\t];\n}\n\n/**\n * Builds the trash fail notification arguments for dispatch.\n *\n * @param {Object} data\n *\n * @return {Array} Arguments for dispatch.\n */\nexport function getNotificationArgumentsForTrashFail( data ) {\n\treturn [\n\t\tdata.error.message && data.error.code !== 'unknown_error'\n\t\t\t? data.error.message\n\t\t\t: __( 'Trashing failed' ),\n\t\t{\n\t\t\tid: TRASH_POST_NOTICE_ID,\n\t\t},\n\t];\n}\n"]}
@@ -24,15 +24,14 @@ const noop = () => {};
24
24
  */
25
25
 
26
26
 
27
- export default function mediaUpload(_ref) {
28
- let {
29
- additionalData = {},
30
- allowedTypes,
31
- filesList,
32
- maxUploadFileSize,
33
- onError = noop,
34
- onFileChange
35
- } = _ref;
27
+ export default function mediaUpload({
28
+ additionalData = {},
29
+ allowedTypes,
30
+ filesList,
31
+ maxUploadFileSize,
32
+ onError = noop,
33
+ onFileChange
34
+ }) {
36
35
  const {
37
36
  getCurrentPostId,
38
37
  getEditorSettings
@@ -48,12 +47,9 @@ export default function mediaUpload(_ref) {
48
47
  ...additionalData
49
48
  },
50
49
  maxUploadFileSize,
51
- onError: _ref2 => {
52
- let {
53
- message
54
- } = _ref2;
55
- return onError(message);
56
- },
50
+ onError: ({
51
+ message
52
+ }) => onError(message),
57
53
  wpAllowedMimeTypes
58
54
  });
59
55
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/utils/media-upload/index.js"],"names":["select","uploadMedia","store","editorStore","noop","mediaUpload","additionalData","allowedTypes","filesList","maxUploadFileSize","onError","onFileChange","getCurrentPostId","getEditorSettings","wpAllowedMimeTypes","allowedMimeTypes","post","message"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,MAAT,QAAuB,iBAAvB;AACA,SAASC,WAAT,QAA4B,wBAA5B;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,aAArC;;AAEA,MAAMC,IAAI,GAAG,MAAM,CAAE,CAArB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,eAAe,SAASC,WAAT,OAOX;AAAA,MAPiC;AACpCC,IAAAA,cAAc,GAAG,EADmB;AAEpCC,IAAAA,YAFoC;AAGpCC,IAAAA,SAHoC;AAIpCC,IAAAA,iBAJoC;AAKpCC,IAAAA,OAAO,GAAGN,IAL0B;AAMpCO,IAAAA;AANoC,GAOjC;AACH,QAAM;AAAEC,IAAAA,gBAAF;AAAoBC,IAAAA;AAApB,MAA0Cb,MAAM,CAAEG,WAAF,CAAtD;AACA,QAAMW,kBAAkB,GAAGD,iBAAiB,GAAGE,gBAA/C;AACAN,EAAAA,iBAAiB,GAChBA,iBAAiB,IAAII,iBAAiB,GAAGJ,iBAD1C;AAGAR,EAAAA,WAAW,CAAE;AACZM,IAAAA,YADY;AAEZC,IAAAA,SAFY;AAGZG,IAAAA,YAHY;AAIZL,IAAAA,cAAc,EAAE;AACfU,MAAAA,IAAI,EAAEJ,gBAAgB,EADP;AAEf,SAAGN;AAFY,KAJJ;AAQZG,IAAAA,iBARY;AASZC,IAAAA,OAAO,EAAE;AAAA,UAAE;AAAEO,QAAAA;AAAF,OAAF;AAAA,aAAmBP,OAAO,CAAEO,OAAF,CAA1B;AAAA,KATG;AAUZH,IAAAA;AAVY,GAAF,CAAX;AAYA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { select } from '@wordpress/data';\nimport { uploadMedia } from '@wordpress/media-utils';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nconst noop = () => {};\n\n/**\n * Upload a media file when the file upload button is activated.\n * Wrapper around mediaUpload() that injects the current post ID.\n *\n * @param {Object} $0 Parameters object passed to the function.\n * @param {?Object} $0.additionalData Additional data to include in the request.\n * @param {string} $0.allowedTypes Array with the types of media that can be uploaded, if unset all types are allowed.\n * @param {Array} $0.filesList List of files.\n * @param {?number} $0.maxUploadFileSize Maximum upload size in bytes allowed for the site.\n * @param {Function} $0.onError Function called when an error happens.\n * @param {Function} $0.onFileChange Function called each time a file or a temporary representation of the file is available.\n */\nexport default function mediaUpload( {\n\tadditionalData = {},\n\tallowedTypes,\n\tfilesList,\n\tmaxUploadFileSize,\n\tonError = noop,\n\tonFileChange,\n} ) {\n\tconst { getCurrentPostId, getEditorSettings } = select( editorStore );\n\tconst wpAllowedMimeTypes = getEditorSettings().allowedMimeTypes;\n\tmaxUploadFileSize =\n\t\tmaxUploadFileSize || getEditorSettings().maxUploadFileSize;\n\n\tuploadMedia( {\n\t\tallowedTypes,\n\t\tfilesList,\n\t\tonFileChange,\n\t\tadditionalData: {\n\t\t\tpost: getCurrentPostId(),\n\t\t\t...additionalData,\n\t\t},\n\t\tmaxUploadFileSize,\n\t\tonError: ( { message } ) => onError( message ),\n\t\twpAllowedMimeTypes,\n\t} );\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/utils/media-upload/index.js"],"names":["select","uploadMedia","store","editorStore","noop","mediaUpload","additionalData","allowedTypes","filesList","maxUploadFileSize","onError","onFileChange","getCurrentPostId","getEditorSettings","wpAllowedMimeTypes","allowedMimeTypes","post","message"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,MAAT,QAAuB,iBAAvB;AACA,SAASC,WAAT,QAA4B,wBAA5B;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,aAArC;;AAEA,MAAMC,IAAI,GAAG,MAAM,CAAE,CAArB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,eAAe,SAASC,WAAT,CAAsB;AACpCC,EAAAA,cAAc,GAAG,EADmB;AAEpCC,EAAAA,YAFoC;AAGpCC,EAAAA,SAHoC;AAIpCC,EAAAA,iBAJoC;AAKpCC,EAAAA,OAAO,GAAGN,IAL0B;AAMpCO,EAAAA;AANoC,CAAtB,EAOX;AACH,QAAM;AAAEC,IAAAA,gBAAF;AAAoBC,IAAAA;AAApB,MAA0Cb,MAAM,CAAEG,WAAF,CAAtD;AACA,QAAMW,kBAAkB,GAAGD,iBAAiB,GAAGE,gBAA/C;AACAN,EAAAA,iBAAiB,GAChBA,iBAAiB,IAAII,iBAAiB,GAAGJ,iBAD1C;AAGAR,EAAAA,WAAW,CAAE;AACZM,IAAAA,YADY;AAEZC,IAAAA,SAFY;AAGZG,IAAAA,YAHY;AAIZL,IAAAA,cAAc,EAAE;AACfU,MAAAA,IAAI,EAAEJ,gBAAgB,EADP;AAEf,SAAGN;AAFY,KAJJ;AAQZG,IAAAA,iBARY;AASZC,IAAAA,OAAO,EAAE,CAAE;AAAEO,MAAAA;AAAF,KAAF,KAAmBP,OAAO,CAAEO,OAAF,CATvB;AAUZH,IAAAA;AAVY,GAAF,CAAX;AAYA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { select } from '@wordpress/data';\nimport { uploadMedia } from '@wordpress/media-utils';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nconst noop = () => {};\n\n/**\n * Upload a media file when the file upload button is activated.\n * Wrapper around mediaUpload() that injects the current post ID.\n *\n * @param {Object} $0 Parameters object passed to the function.\n * @param {?Object} $0.additionalData Additional data to include in the request.\n * @param {string} $0.allowedTypes Array with the types of media that can be uploaded, if unset all types are allowed.\n * @param {Array} $0.filesList List of files.\n * @param {?number} $0.maxUploadFileSize Maximum upload size in bytes allowed for the site.\n * @param {Function} $0.onError Function called when an error happens.\n * @param {Function} $0.onFileChange Function called each time a file or a temporary representation of the file is available.\n */\nexport default function mediaUpload( {\n\tadditionalData = {},\n\tallowedTypes,\n\tfilesList,\n\tmaxUploadFileSize,\n\tonError = noop,\n\tonFileChange,\n} ) {\n\tconst { getCurrentPostId, getEditorSettings } = select( editorStore );\n\tconst wpAllowedMimeTypes = getEditorSettings().allowedMimeTypes;\n\tmaxUploadFileSize =\n\t\tmaxUploadFileSize || getEditorSettings().maxUploadFileSize;\n\n\tuploadMedia( {\n\t\tallowedTypes,\n\t\tfilesList,\n\t\tonFileChange,\n\t\tadditionalData: {\n\t\t\tpost: getCurrentPostId(),\n\t\t\t...additionalData,\n\t\t},\n\t\tmaxUploadFileSize,\n\t\tonError: ( { message } ) => onError( message ),\n\t\twpAllowedMimeTypes,\n\t} );\n}\n"]}
@@ -19,12 +19,9 @@ export function buildTermsTree(flatTerms) {
19
19
  };
20
20
  }); // All terms should have a `parent` because we're about to index them by it.
21
21
 
22
- if (flatTermsWithParentAndChildren.some(_ref => {
23
- let {
24
- parent
25
- } = _ref;
26
- return parent === null;
27
- })) {
22
+ if (flatTermsWithParentAndChildren.some(({
23
+ parent
24
+ }) => parent === null)) {
28
25
  return flatTermsWithParentAndChildren;
29
26
  }
30
27
 
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/utils/terms.js"],"names":["decodeEntities","buildTermsTree","flatTerms","flatTermsWithParentAndChildren","map","term","children","parent","some","termsByParent","reduce","acc","push","fillWithChildren","terms","id","length","unescapeString","arg","unescapeTerm","name","unescapeTerms"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,cAAT,QAA+B,0BAA/B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,cAAT,CAAyBC,SAAzB,EAAqC;AAC3C,QAAMC,8BAA8B,GAAGD,SAAS,CAACE,GAAV,CAAiBC,IAAF,IAAY;AACjE,WAAO;AACNC,MAAAA,QAAQ,EAAE,EADJ;AAENC,MAAAA,MAAM,EAAE,IAFF;AAGN,SAAGF;AAHG,KAAP;AAKA,GANsC,CAAvC,CAD2C,CAS3C;;AACA,MACCF,8BAA8B,CAACK,IAA/B,CAAqC;AAAA,QAAE;AAAED,MAAAA;AAAF,KAAF;AAAA,WAAkBA,MAAM,KAAK,IAA7B;AAAA,GAArC,CADD,EAEE;AACD,WAAOJ,8BAAP;AACA;;AAED,QAAMM,aAAa,GAAGN,8BAA8B,CAACO,MAA/B,CACrB,CAAEC,GAAF,EAAON,IAAP,KAAiB;AAChB,UAAM;AAAEE,MAAAA;AAAF,QAAaF,IAAnB;;AACA,QAAK,CAAEM,GAAG,CAAEJ,MAAF,CAAV,EAAuB;AACtBI,MAAAA,GAAG,CAAEJ,MAAF,CAAH,GAAgB,EAAhB;AACA;;AACDI,IAAAA,GAAG,CAAEJ,MAAF,CAAH,CAAcK,IAAd,CAAoBP,IAApB;AACA,WAAOM,GAAP;AACA,GARoB,EASrB,EATqB,CAAtB;;AAYA,QAAME,gBAAgB,GAAKC,KAAF,IAAa;AACrC,WAAOA,KAAK,CAACV,GAAN,CAAaC,IAAF,IAAY;AAC7B,YAAMC,QAAQ,GAAGG,aAAa,CAAEJ,IAAI,CAACU,EAAP,CAA9B;AACA,aAAO,EACN,GAAGV,IADG;AAENC,QAAAA,QAAQ,EACPA,QAAQ,IAAIA,QAAQ,CAACU,MAArB,GACGH,gBAAgB,CAAEP,QAAF,CADnB,GAEG;AALE,OAAP;AAOA,KATM,CAAP;AAUA,GAXD;;AAaA,SAAOO,gBAAgB,CAAEJ,aAAa,CAAE,GAAF,CAAb,IAAwB,EAA1B,CAAvB;AACA;AAED,OAAO,MAAMQ,cAAc,GAAKC,GAAF,IAAW;AACxC,SAAOlB,cAAc,CAAEkB,GAAF,CAArB;AACA,CAFM;AAIP;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,YAAY,GAAKd,IAAF,IAAY;AACvC,SAAO,EACN,GAAGA,IADG;AAENe,IAAAA,IAAI,EAAEH,cAAc,CAAEZ,IAAI,CAACe,IAAP;AAFd,GAAP;AAIA,CALM;AAOP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,aAAa,GAAKP,KAAF,IAAa;AACzC,SAAO,CAAEA,KAAF,aAAEA,KAAF,cAAEA,KAAF,GAAW,EAAX,EAAgBV,GAAhB,CAAqBe,YAArB,CAAP;AACA,CAFM","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Returns terms in a tree form.\n *\n * @param {Array} flatTerms Array of terms in flat format.\n *\n * @return {Array} Array of terms in tree format.\n */\nexport function buildTermsTree( flatTerms ) {\n\tconst flatTermsWithParentAndChildren = flatTerms.map( ( term ) => {\n\t\treturn {\n\t\t\tchildren: [],\n\t\t\tparent: null,\n\t\t\t...term,\n\t\t};\n\t} );\n\n\t// All terms should have a `parent` because we're about to index them by it.\n\tif (\n\t\tflatTermsWithParentAndChildren.some( ( { parent } ) => parent === null )\n\t) {\n\t\treturn flatTermsWithParentAndChildren;\n\t}\n\n\tconst termsByParent = flatTermsWithParentAndChildren.reduce(\n\t\t( acc, term ) => {\n\t\t\tconst { parent } = term;\n\t\t\tif ( ! acc[ parent ] ) {\n\t\t\t\tacc[ parent ] = [];\n\t\t\t}\n\t\t\tacc[ parent ].push( term );\n\t\t\treturn acc;\n\t\t},\n\t\t{}\n\t);\n\n\tconst fillWithChildren = ( terms ) => {\n\t\treturn terms.map( ( term ) => {\n\t\t\tconst children = termsByParent[ term.id ];\n\t\t\treturn {\n\t\t\t\t...term,\n\t\t\t\tchildren:\n\t\t\t\t\tchildren && children.length\n\t\t\t\t\t\t? fillWithChildren( children )\n\t\t\t\t\t\t: [],\n\t\t\t};\n\t\t} );\n\t};\n\n\treturn fillWithChildren( termsByParent[ '0' ] || [] );\n}\n\nexport const unescapeString = ( arg ) => {\n\treturn decodeEntities( arg );\n};\n\n/**\n * Returns a term object with name unescaped.\n *\n * @param {Object} term The term object to unescape.\n *\n * @return {Object} Term object with name property unescaped.\n */\nexport const unescapeTerm = ( term ) => {\n\treturn {\n\t\t...term,\n\t\tname: unescapeString( term.name ),\n\t};\n};\n\n/**\n * Returns an array of term objects with names unescaped.\n * The unescape of each term is performed using the unescapeTerm function.\n *\n * @param {Object[]} terms Array of term objects to unescape.\n *\n * @return {Object[]} Array of term objects unescaped.\n */\nexport const unescapeTerms = ( terms ) => {\n\treturn ( terms ?? [] ).map( unescapeTerm );\n};\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/utils/terms.js"],"names":["decodeEntities","buildTermsTree","flatTerms","flatTermsWithParentAndChildren","map","term","children","parent","some","termsByParent","reduce","acc","push","fillWithChildren","terms","id","length","unescapeString","arg","unescapeTerm","name","unescapeTerms"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,cAAT,QAA+B,0BAA/B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,cAAT,CAAyBC,SAAzB,EAAqC;AAC3C,QAAMC,8BAA8B,GAAGD,SAAS,CAACE,GAAV,CAAiBC,IAAF,IAAY;AACjE,WAAO;AACNC,MAAAA,QAAQ,EAAE,EADJ;AAENC,MAAAA,MAAM,EAAE,IAFF;AAGN,SAAGF;AAHG,KAAP;AAKA,GANsC,CAAvC,CAD2C,CAS3C;;AACA,MACCF,8BAA8B,CAACK,IAA/B,CAAqC,CAAE;AAAED,IAAAA;AAAF,GAAF,KAAkBA,MAAM,KAAK,IAAlE,CADD,EAEE;AACD,WAAOJ,8BAAP;AACA;;AAED,QAAMM,aAAa,GAAGN,8BAA8B,CAACO,MAA/B,CACrB,CAAEC,GAAF,EAAON,IAAP,KAAiB;AAChB,UAAM;AAAEE,MAAAA;AAAF,QAAaF,IAAnB;;AACA,QAAK,CAAEM,GAAG,CAAEJ,MAAF,CAAV,EAAuB;AACtBI,MAAAA,GAAG,CAAEJ,MAAF,CAAH,GAAgB,EAAhB;AACA;;AACDI,IAAAA,GAAG,CAAEJ,MAAF,CAAH,CAAcK,IAAd,CAAoBP,IAApB;AACA,WAAOM,GAAP;AACA,GARoB,EASrB,EATqB,CAAtB;;AAYA,QAAME,gBAAgB,GAAKC,KAAF,IAAa;AACrC,WAAOA,KAAK,CAACV,GAAN,CAAaC,IAAF,IAAY;AAC7B,YAAMC,QAAQ,GAAGG,aAAa,CAAEJ,IAAI,CAACU,EAAP,CAA9B;AACA,aAAO,EACN,GAAGV,IADG;AAENC,QAAAA,QAAQ,EACPA,QAAQ,IAAIA,QAAQ,CAACU,MAArB,GACGH,gBAAgB,CAAEP,QAAF,CADnB,GAEG;AALE,OAAP;AAOA,KATM,CAAP;AAUA,GAXD;;AAaA,SAAOO,gBAAgB,CAAEJ,aAAa,CAAE,GAAF,CAAb,IAAwB,EAA1B,CAAvB;AACA;AAED,OAAO,MAAMQ,cAAc,GAAKC,GAAF,IAAW;AACxC,SAAOlB,cAAc,CAAEkB,GAAF,CAArB;AACA,CAFM;AAIP;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,YAAY,GAAKd,IAAF,IAAY;AACvC,SAAO,EACN,GAAGA,IADG;AAENe,IAAAA,IAAI,EAAEH,cAAc,CAAEZ,IAAI,CAACe,IAAP;AAFd,GAAP;AAIA,CALM;AAOP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,aAAa,GAAKP,KAAF,IAAa;AACzC,SAAO,CAAEA,KAAF,aAAEA,KAAF,cAAEA,KAAF,GAAW,EAAX,EAAgBV,GAAhB,CAAqBe,YAArB,CAAP;AACA,CAFM","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Returns terms in a tree form.\n *\n * @param {Array} flatTerms Array of terms in flat format.\n *\n * @return {Array} Array of terms in tree format.\n */\nexport function buildTermsTree( flatTerms ) {\n\tconst flatTermsWithParentAndChildren = flatTerms.map( ( term ) => {\n\t\treturn {\n\t\t\tchildren: [],\n\t\t\tparent: null,\n\t\t\t...term,\n\t\t};\n\t} );\n\n\t// All terms should have a `parent` because we're about to index them by it.\n\tif (\n\t\tflatTermsWithParentAndChildren.some( ( { parent } ) => parent === null )\n\t) {\n\t\treturn flatTermsWithParentAndChildren;\n\t}\n\n\tconst termsByParent = flatTermsWithParentAndChildren.reduce(\n\t\t( acc, term ) => {\n\t\t\tconst { parent } = term;\n\t\t\tif ( ! acc[ parent ] ) {\n\t\t\t\tacc[ parent ] = [];\n\t\t\t}\n\t\t\tacc[ parent ].push( term );\n\t\t\treturn acc;\n\t\t},\n\t\t{}\n\t);\n\n\tconst fillWithChildren = ( terms ) => {\n\t\treturn terms.map( ( term ) => {\n\t\t\tconst children = termsByParent[ term.id ];\n\t\t\treturn {\n\t\t\t\t...term,\n\t\t\t\tchildren:\n\t\t\t\t\tchildren && children.length\n\t\t\t\t\t\t? fillWithChildren( children )\n\t\t\t\t\t\t: [],\n\t\t\t};\n\t\t} );\n\t};\n\n\treturn fillWithChildren( termsByParent[ '0' ] || [] );\n}\n\nexport const unescapeString = ( arg ) => {\n\treturn decodeEntities( arg );\n};\n\n/**\n * Returns a term object with name unescaped.\n *\n * @param {Object} term The term object to unescape.\n *\n * @return {Object} Term object with name property unescaped.\n */\nexport const unescapeTerm = ( term ) => {\n\treturn {\n\t\t...term,\n\t\tname: unescapeString( term.name ),\n\t};\n};\n\n/**\n * Returns an array of term objects with names unescaped.\n * The unescape of each term is performed using the unescapeTerm function.\n *\n * @param {Object[]} terms Array of term objects to unescape.\n *\n * @return {Object[]} Array of term objects unescaped.\n */\nexport const unescapeTerms = ( terms ) => {\n\treturn ( terms ?? [] ).map( unescapeTerm );\n};\n"]}
@@ -418,7 +418,7 @@
418
418
  .editor-post-publish-panel__content {
419
419
  min-height: calc(100% - 144px);
420
420
  }
421
- .editor-post-publish-panel__content .components-spinner {
421
+ .editor-post-publish-panel__content > .components-spinner {
422
422
  display: block;
423
423
  margin: 100px auto 0;
424
424
  }
@@ -627,6 +627,20 @@
627
627
  margin-left: 0;
628
628
  }
629
629
 
630
+ .edit-post-sync-status {
631
+ width: 100%;
632
+ position: relative;
633
+ justify-content: flex-start;
634
+ }
635
+ .edit-post-sync-status > span {
636
+ display: block;
637
+ width: 45%;
638
+ flex-shrink: 0;
639
+ }
640
+ .edit-post-sync-status .components-base-control {
641
+ padding-right: 6px;
642
+ }
643
+
630
644
  .editor-post-taxonomies__hierarchical-terms-list {
631
645
  max-height: 14em;
632
646
  overflow: auto;
@@ -418,7 +418,7 @@
418
418
  .editor-post-publish-panel__content {
419
419
  min-height: calc(100% - 144px);
420
420
  }
421
- .editor-post-publish-panel__content .components-spinner {
421
+ .editor-post-publish-panel__content > .components-spinner {
422
422
  display: block;
423
423
  margin: 100px auto 0;
424
424
  }
@@ -627,6 +627,20 @@
627
627
  margin-right: 0;
628
628
  }
629
629
 
630
+ .edit-post-sync-status {
631
+ width: 100%;
632
+ position: relative;
633
+ justify-content: flex-start;
634
+ }
635
+ .edit-post-sync-status > span {
636
+ display: block;
637
+ width: 45%;
638
+ flex-shrink: 0;
639
+ }
640
+ .edit-post-sync-status .components-base-control {
641
+ padding-left: 6px;
642
+ }
643
+
630
644
  .editor-post-taxonomies__hierarchical-terms-list {
631
645
  max-height: 14em;
632
646
  overflow: auto;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/editor",
3
- "version": "13.11.0",
3
+ "version": "13.12.1",
4
4
  "description": "Enhanced block editor for WordPress posts.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -31,37 +31,36 @@
31
31
  ],
32
32
  "dependencies": {
33
33
  "@babel/runtime": "^7.16.0",
34
- "@wordpress/a11y": "^3.34.0",
35
- "@wordpress/api-fetch": "^6.31.0",
36
- "@wordpress/blob": "^3.34.0",
37
- "@wordpress/block-editor": "^12.2.0",
38
- "@wordpress/blocks": "^12.11.0",
39
- "@wordpress/components": "^25.0.0",
40
- "@wordpress/compose": "^6.11.0",
41
- "@wordpress/core-data": "^6.11.0",
42
- "@wordpress/data": "^9.4.0",
43
- "@wordpress/date": "^4.34.0",
44
- "@wordpress/deprecated": "^3.34.0",
45
- "@wordpress/dom": "^3.34.0",
46
- "@wordpress/element": "^5.11.0",
47
- "@wordpress/hooks": "^3.34.0",
48
- "@wordpress/html-entities": "^3.34.0",
49
- "@wordpress/i18n": "^4.34.0",
50
- "@wordpress/icons": "^9.25.0",
51
- "@wordpress/keyboard-shortcuts": "^4.11.0",
52
- "@wordpress/keycodes": "^3.34.0",
53
- "@wordpress/media-utils": "^4.25.0",
54
- "@wordpress/notices": "^4.2.0",
55
- "@wordpress/preferences": "^3.11.0",
56
- "@wordpress/private-apis": "^0.16.0",
57
- "@wordpress/reusable-blocks": "^4.11.0",
58
- "@wordpress/rich-text": "^6.11.0",
59
- "@wordpress/server-side-render": "^4.11.0",
60
- "@wordpress/url": "^3.35.0",
61
- "@wordpress/wordcount": "^3.34.0",
34
+ "@wordpress/a11y": "^3.35.1",
35
+ "@wordpress/api-fetch": "^6.32.1",
36
+ "@wordpress/blob": "^3.35.1",
37
+ "@wordpress/block-editor": "^12.3.1",
38
+ "@wordpress/blocks": "^12.12.1",
39
+ "@wordpress/components": "^25.1.1",
40
+ "@wordpress/compose": "^6.12.1",
41
+ "@wordpress/core-data": "^6.12.1",
42
+ "@wordpress/data": "^9.5.1",
43
+ "@wordpress/date": "^4.35.1",
44
+ "@wordpress/deprecated": "^3.35.1",
45
+ "@wordpress/dom": "^3.35.1",
46
+ "@wordpress/element": "^5.12.1",
47
+ "@wordpress/hooks": "^3.35.1",
48
+ "@wordpress/html-entities": "^3.35.1",
49
+ "@wordpress/i18n": "^4.35.1",
50
+ "@wordpress/icons": "^9.26.1",
51
+ "@wordpress/keyboard-shortcuts": "^4.12.1",
52
+ "@wordpress/keycodes": "^3.35.1",
53
+ "@wordpress/media-utils": "^4.26.1",
54
+ "@wordpress/notices": "^4.3.1",
55
+ "@wordpress/preferences": "^3.12.1",
56
+ "@wordpress/private-apis": "^0.17.1",
57
+ "@wordpress/reusable-blocks": "^4.12.1",
58
+ "@wordpress/rich-text": "^6.12.1",
59
+ "@wordpress/server-side-render": "^4.12.1",
60
+ "@wordpress/url": "^3.36.1",
61
+ "@wordpress/wordcount": "^3.35.1",
62
62
  "classnames": "^2.3.1",
63
63
  "date-fns": "^2.28.0",
64
- "escape-html": "^1.0.3",
65
64
  "memize": "^2.1.0",
66
65
  "react-autosize-textarea": "^7.1.0",
67
66
  "rememo": "^4.0.2",
@@ -74,5 +73,5 @@
74
73
  "publishConfig": {
75
74
  "access": "public"
76
75
  },
77
- "gitHead": "c7c79cb11b677adcbf06cf5f8cfb6c5ec1699f19"
76
+ "gitHead": "ce5639111c30763dbdf07f40eeb136ea6030ecf1"
78
77
  }
@@ -35,10 +35,11 @@ it( 'navigates back from help topic detail screen', async () => {
35
35
  const backButton = screen.getAllByLabelText( 'Go back' );
36
36
  fireEvent.press( backButton[ backButton.length - 1 ] );
37
37
 
38
- // Currently logs `act` warning due to https://github.com/callstack/react-native-testing-library/issues/379
39
38
  const text =
40
39
  'Each block has its own settings. To find them, tap on a block. Its settings will appear on the toolbar at the bottom of the screen.';
41
- await waitForElementToBeRemoved( () => screen.getByText( text ) );
40
+ await waitForElementToBeRemoved( () =>
41
+ screen.getByText( text, { hidden: true } )
42
+ );
42
43
 
43
44
  expect( screen.queryByText( text ) ).toBeNull();
44
45
  } );
@@ -0,0 +1,87 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { useSelect } from '@wordpress/data';
5
+ import { store as coreStore } from '@wordpress/core-data';
6
+ import { useState } from '@wordpress/element';
7
+ import { __ } from '@wordpress/i18n';
8
+
9
+ const TRANSLATED_SITE_PROPERTIES = {
10
+ title: __( 'Title' ),
11
+ description: __( 'Tagline' ),
12
+ site_logo: __( 'Logo' ),
13
+ site_icon: __( 'Icon' ),
14
+ show_on_front: __( 'Show on front' ),
15
+ page_on_front: __( 'Page on front' ),
16
+ posts_per_page: __( 'Maximum posts per page' ),
17
+ default_comment_status: __( 'Allow comments on new posts' ),
18
+ };
19
+
20
+ export const useIsDirty = () => {
21
+ const { dirtyEntityRecords } = useSelect( ( select ) => {
22
+ const dirtyRecords =
23
+ select( coreStore ).__experimentalGetDirtyEntityRecords();
24
+
25
+ // Remove site object and decouple into its edited pieces.
26
+ const dirtyRecordsWithoutSite = dirtyRecords.filter(
27
+ ( record ) => ! ( record.kind === 'root' && record.name === 'site' )
28
+ );
29
+
30
+ const siteEdits = select( coreStore ).getEntityRecordEdits(
31
+ 'root',
32
+ 'site'
33
+ );
34
+
35
+ const siteEditsAsEntities = [];
36
+ for ( const property in siteEdits ) {
37
+ siteEditsAsEntities.push( {
38
+ kind: 'root',
39
+ name: 'site',
40
+ title: TRANSLATED_SITE_PROPERTIES[ property ] || property,
41
+ property,
42
+ } );
43
+ }
44
+ const dirtyRecordsWithSiteItems = [
45
+ ...dirtyRecordsWithoutSite,
46
+ ...siteEditsAsEntities,
47
+ ];
48
+
49
+ return {
50
+ dirtyEntityRecords: dirtyRecordsWithSiteItems,
51
+ };
52
+ }, [] );
53
+
54
+ // Unchecked entities to be ignored by save function.
55
+ const [ unselectedEntities, _setUnselectedEntities ] = useState( [] );
56
+
57
+ const setUnselectedEntities = (
58
+ { kind, name, key, property },
59
+ checked
60
+ ) => {
61
+ if ( checked ) {
62
+ _setUnselectedEntities(
63
+ unselectedEntities.filter(
64
+ ( elt ) =>
65
+ elt.kind !== kind ||
66
+ elt.name !== name ||
67
+ elt.key !== key ||
68
+ elt.property !== property
69
+ )
70
+ );
71
+ } else {
72
+ _setUnselectedEntities( [
73
+ ...unselectedEntities,
74
+ { kind, name, key, property },
75
+ ] );
76
+ }
77
+ };
78
+
79
+ const isDirty = dirtyEntityRecords.length - unselectedEntities.length > 0;
80
+
81
+ return {
82
+ dirtyEntityRecords,
83
+ isDirty,
84
+ setUnselectedEntities,
85
+ unselectedEntities,
86
+ };
87
+ };
@@ -2,28 +2,19 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { Button, Flex, FlexItem } from '@wordpress/components';
5
- import { __, sprintf } from '@wordpress/i18n';
6
- import { useSelect, useDispatch } from '@wordpress/data';
7
- import { useState, useCallback, useRef } from '@wordpress/element';
5
+ import { __ } from '@wordpress/i18n';
6
+ import { useDispatch } from '@wordpress/data';
7
+ import { useCallback, useRef } from '@wordpress/element';
8
8
  import { store as coreStore } from '@wordpress/core-data';
9
9
  import { store as blockEditorStore } from '@wordpress/block-editor';
10
10
  import { __experimentalUseDialog as useDialog } from '@wordpress/compose';
11
11
  import { store as noticesStore } from '@wordpress/notices';
12
- import { getQueryArg } from '@wordpress/url';
13
12
 
14
13
  /**
15
14
  * Internal dependencies
16
15
  */
17
16
  import EntityTypeList from './entity-type-list';
18
-
19
- const TRANSLATED_SITE_PROPERTIES = {
20
- title: __( 'Title' ),
21
- description: __( 'Tagline' ),
22
- site_logo: __( 'Logo' ),
23
- site_icon: __( 'Icon' ),
24
- show_on_front: __( 'Show on front' ),
25
- page_on_front: __( 'Page on front' ),
26
- };
17
+ import { useIsDirty } from './hooks/use-is-dirty';
27
18
 
28
19
  const PUBLISH_ON_SAVE_ENTITIES = [
29
20
  {
@@ -36,56 +27,26 @@ function identity( values ) {
36
27
  return values;
37
28
  }
38
29
 
39
- function isPreviewingTheme() {
30
+ export default function EntitiesSavedStates( { close } ) {
31
+ const isDirtyProps = useIsDirty();
40
32
  return (
41
- window?.__experimentalEnableThemePreviews &&
42
- getQueryArg( window.location.href, 'theme_preview' ) !== undefined
33
+ <EntitiesSavedStatesExtensible close={ close } { ...isDirtyProps } />
43
34
  );
44
35
  }
45
36
 
46
- function currentlyPreviewingTheme() {
47
- if ( isPreviewingTheme() ) {
48
- return getQueryArg( window.location.href, 'theme_preview' );
49
- }
50
- return null;
51
- }
52
-
53
- export default function EntitiesSavedStates( { close, onSave = identity } ) {
37
+ export function EntitiesSavedStatesExtensible( {
38
+ additionalPrompt = undefined,
39
+ close,
40
+ onSave = identity,
41
+ saveEnabled: saveEnabledProp = undefined,
42
+ saveLabel = __( 'Save' ),
43
+
44
+ dirtyEntityRecords,
45
+ isDirty,
46
+ setUnselectedEntities,
47
+ unselectedEntities,
48
+ } ) {
54
49
  const saveButtonRef = useRef();
55
- const { getTheme } = useSelect( coreStore );
56
- const theme = getTheme( currentlyPreviewingTheme() );
57
- const { dirtyEntityRecords } = useSelect( ( select ) => {
58
- const dirtyRecords =
59
- select( coreStore ).__experimentalGetDirtyEntityRecords();
60
-
61
- // Remove site object and decouple into its edited pieces.
62
- const dirtyRecordsWithoutSite = dirtyRecords.filter(
63
- ( record ) => ! ( record.kind === 'root' && record.name === 'site' )
64
- );
65
-
66
- const siteEdits = select( coreStore ).getEntityRecordEdits(
67
- 'root',
68
- 'site'
69
- );
70
-
71
- const siteEditsAsEntities = [];
72
- for ( const property in siteEdits ) {
73
- siteEditsAsEntities.push( {
74
- kind: 'root',
75
- name: 'site',
76
- title: TRANSLATED_SITE_PROPERTIES[ property ] || property,
77
- property,
78
- } );
79
- }
80
- const dirtyRecordsWithSiteItems = [
81
- ...dirtyRecordsWithoutSite,
82
- ...siteEditsAsEntities,
83
- ];
84
-
85
- return {
86
- dirtyEntityRecords: dirtyRecordsWithSiteItems,
87
- };
88
- }, [] );
89
50
  const {
90
51
  editEntityRecord,
91
52
  saveEditedEntityRecord,
@@ -122,32 +83,9 @@ export default function EntitiesSavedStates( { close, onSave = identity } ) {
122
83
  ...Object.values( contentSavables ),
123
84
  ].filter( Array.isArray );
124
85
 
125
- // Unchecked entities to be ignored by save function.
126
- const [ unselectedEntities, _setUnselectedEntities ] = useState( [] );
127
-
128
- const setUnselectedEntities = (
129
- { kind, name, key, property },
130
- checked
131
- ) => {
132
- if ( checked ) {
133
- _setUnselectedEntities(
134
- unselectedEntities.filter(
135
- ( elt ) =>
136
- elt.kind !== kind ||
137
- elt.name !== name ||
138
- elt.key !== key ||
139
- elt.property !== property
140
- )
141
- );
142
- } else {
143
- _setUnselectedEntities( [
144
- ...unselectedEntities,
145
- { kind, name, key, property },
146
- ] );
147
- }
148
- };
86
+ const saveEnabled = saveEnabledProp ?? isDirty;
149
87
 
150
- const saveCheckedEntitiesAndActivate = () => {
88
+ const saveCheckedEntities = () => {
151
89
  const saveNoticeId = 'site-editor-save-success';
152
90
  removeNotice( saveNoticeId );
153
91
  const entitiesToSave = dirtyEntityRecords.filter(
@@ -227,18 +165,6 @@ export default function EntitiesSavedStates( { close, onSave = identity } ) {
227
165
  onClose: () => dismissPanel(),
228
166
  } );
229
167
 
230
- const isDirty = dirtyEntityRecords.length - unselectedEntities.length > 0;
231
- const activateSaveEnabled = isPreviewingTheme() || isDirty;
232
-
233
- let activateSaveLabel;
234
- if ( isPreviewingTheme() && isDirty ) {
235
- activateSaveLabel = __( 'Activate & Save' );
236
- } else if ( isPreviewingTheme() ) {
237
- activateSaveLabel = __( 'Activate' );
238
- } else {
239
- activateSaveLabel = __( 'Save' );
240
- }
241
-
242
168
  return (
243
169
  <div
244
170
  ref={ saveDialogRef }
@@ -251,11 +177,11 @@ export default function EntitiesSavedStates( { close, onSave = identity } ) {
251
177
  as={ Button }
252
178
  ref={ saveButtonRef }
253
179
  variant="primary"
254
- disabled={ ! activateSaveEnabled }
255
- onClick={ saveCheckedEntitiesAndActivate }
180
+ disabled={ ! saveEnabled }
181
+ onClick={ saveCheckedEntities }
256
182
  className="editor-entities-saved-states__save-button"
257
183
  >
258
- { activateSaveLabel }
184
+ { saveLabel }
259
185
  </FlexItem>
260
186
  <FlexItem
261
187
  isBlock
@@ -269,14 +195,7 @@ export default function EntitiesSavedStates( { close, onSave = identity } ) {
269
195
 
270
196
  <div className="entities-saved-states__text-prompt">
271
197
  <strong>{ __( 'Are you ready to save?' ) }</strong>
272
- { isPreviewingTheme() && (
273
- <p>
274
- { sprintf(
275
- 'Saving your changes will change your active theme to %1$s.',
276
- theme?.name?.rendered
277
- ) }
278
- </p>
279
- ) }
198
+ { additionalPrompt }
280
199
  { isDirty && (
281
200
  <p>
282
201
  { __(