@wordpress/editor 13.11.0 → 13.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (369) 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 +3 -4
  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 +4 -5
  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 +19 -24
  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-notices/index.js +12 -19
  25. package/build/components/editor-notices/index.js.map +1 -1
  26. package/build/components/editor-snackbars/index.js +3 -6
  27. package/build/components/editor-snackbars/index.js.map +1 -1
  28. package/build/components/entities-saved-states/entity-record-item.js +7 -10
  29. package/build/components/entities-saved-states/entity-record-item.js.map +1 -1
  30. package/build/components/entities-saved-states/entity-type-list.js +6 -7
  31. package/build/components/entities-saved-states/entity-type-list.js.map +1 -1
  32. package/build/components/entities-saved-states/hooks/use-is-dirty.js +84 -0
  33. package/build/components/entities-saved-states/hooks/use-is-dirty.js.map +1 -0
  34. package/build/components/entities-saved-states/index.js +38 -110
  35. package/build/components/entities-saved-states/index.js.map +1 -1
  36. package/build/components/error-boundary/index.js +4 -5
  37. package/build/components/error-boundary/index.js.map +1 -1
  38. package/build/components/global-keyboard-shortcuts/save-shortcut.js +3 -4
  39. package/build/components/global-keyboard-shortcuts/save-shortcut.js.map +1 -1
  40. package/build/components/index.js +9 -0
  41. package/build/components/index.js.map +1 -1
  42. package/build/components/media-categories/index.js +25 -42
  43. package/build/components/media-categories/index.js.map +1 -1
  44. package/build/components/page-attributes/check.js +4 -7
  45. package/build/components/page-attributes/check.js.map +1 -1
  46. package/build/components/page-attributes/order.js +5 -8
  47. package/build/components/page-attributes/order.js.map +1 -1
  48. package/build/components/page-attributes/parent.js +5 -12
  49. package/build/components/page-attributes/parent.js.map +1 -1
  50. package/build/components/post-author/check.js +6 -7
  51. package/build/components/post-author/check.js.map +1 -1
  52. package/build/components/post-author/combobox.js +3 -6
  53. package/build/components/post-author/combobox.js.map +1 -1
  54. package/build/components/post-author/index.js +1 -1
  55. package/build/components/post-author/index.js.map +1 -1
  56. package/build/components/post-comments/index.js +4 -6
  57. package/build/components/post-comments/index.js.map +1 -1
  58. package/build/components/post-excerpt/index.js +4 -5
  59. package/build/components/post-excerpt/index.js.map +1 -1
  60. package/build/components/post-featured-image/index.js +56 -69
  61. package/build/components/post-featured-image/index.js.map +1 -1
  62. package/build/components/post-format/check.js +4 -5
  63. package/build/components/post-format/check.js.map +1 -1
  64. package/build/components/post-format/index.js +1 -1
  65. package/build/components/post-format/index.js.map +1 -1
  66. package/build/components/post-last-revision/check.js +5 -7
  67. package/build/components/post-last-revision/check.js.map +1 -1
  68. package/build/components/post-last-revision/index.js +4 -5
  69. package/build/components/post-last-revision/index.js.map +1 -1
  70. package/build/components/post-locked-modal/index.js +1 -1
  71. package/build/components/post-locked-modal/index.js.map +1 -1
  72. package/build/components/post-pending-status/check.js +7 -9
  73. package/build/components/post-pending-status/check.js.map +1 -1
  74. package/build/components/post-pending-status/index.js +4 -6
  75. package/build/components/post-pending-status/index.js.map +1 -1
  76. package/build/components/post-pingbacks/index.js +4 -6
  77. package/build/components/post-pingbacks/index.js.map +1 -1
  78. package/build/components/post-preview-button/index.js +8 -12
  79. package/build/components/post-preview-button/index.js.map +1 -1
  80. package/build/components/post-publish-button/index.js +6 -13
  81. package/build/components/post-publish-button/index.js.map +1 -1
  82. package/build/components/post-publish-button/label.js +14 -17
  83. package/build/components/post-publish-button/label.js.map +1 -1
  84. package/build/components/post-publish-panel/index.js +6 -7
  85. package/build/components/post-publish-panel/index.js.map +1 -1
  86. package/build/components/post-publish-panel/maybe-category-panel.js +2 -4
  87. package/build/components/post-publish-panel/maybe-category-panel.js.map +1 -1
  88. package/build/components/post-publish-panel/maybe-post-format-panel.js +9 -12
  89. package/build/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
  90. package/build/components/post-publish-panel/maybe-tags-panel.js +4 -7
  91. package/build/components/post-publish-panel/maybe-tags-panel.js.map +1 -1
  92. package/build/components/post-publish-panel/postpublish.js +8 -11
  93. package/build/components/post-publish-panel/postpublish.js.map +1 -1
  94. package/build/components/post-publish-panel/prepublish.js +5 -6
  95. package/build/components/post-publish-panel/prepublish.js.map +1 -1
  96. package/build/components/post-saved-state/index.js +13 -8
  97. package/build/components/post-saved-state/index.js.map +1 -1
  98. package/build/components/post-schedule/check.js +6 -8
  99. package/build/components/post-schedule/check.js.map +1 -1
  100. package/build/components/post-schedule/index.js +8 -12
  101. package/build/components/post-schedule/index.js.map +1 -1
  102. package/build/components/post-schedule/label.js +7 -10
  103. package/build/components/post-schedule/label.js.map +1 -1
  104. package/build/components/post-slug/check.js +3 -4
  105. package/build/components/post-slug/check.js.map +1 -1
  106. package/build/components/post-slug/index.js +5 -6
  107. package/build/components/post-slug/index.js.map +1 -1
  108. package/build/components/post-sticky/check.js +7 -9
  109. package/build/components/post-sticky/check.js.map +1 -1
  110. package/build/components/post-sticky/index.js +4 -5
  111. package/build/components/post-sticky/index.js.map +1 -1
  112. package/build/components/post-switch-to-draft-button/index.js +6 -7
  113. package/build/components/post-switch-to-draft-button/index.js.map +1 -1
  114. package/build/components/post-taxonomies/check.js +6 -7
  115. package/build/components/post-taxonomies/check.js.map +1 -1
  116. package/build/components/post-taxonomies/flat-term-selector.js +12 -13
  117. package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
  118. package/build/components/post-taxonomies/hierarchical-term-selector.js +13 -14
  119. package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
  120. package/build/components/post-taxonomies/index.js +6 -11
  121. package/build/components/post-taxonomies/index.js.map +1 -1
  122. package/build/components/post-taxonomies/most-used-terms.js +5 -6
  123. package/build/components/post-taxonomies/most-used-terms.js.map +1 -1
  124. package/build/components/post-template/index.js +6 -9
  125. package/build/components/post-template/index.js.map +1 -1
  126. package/build/components/post-title/index.js +2 -6
  127. package/build/components/post-title/index.js.map +1 -1
  128. package/build/components/post-title/index.native.js +8 -11
  129. package/build/components/post-title/index.native.js.map +1 -1
  130. package/build/components/post-trash/check.js +7 -9
  131. package/build/components/post-trash/check.js.map +1 -1
  132. package/build/components/post-type-support-check/index.js +5 -6
  133. package/build/components/post-type-support-check/index.js.map +1 -1
  134. package/build/components/post-url/check.js +4 -5
  135. package/build/components/post-url/check.js.map +1 -1
  136. package/build/components/post-url/index.js +8 -9
  137. package/build/components/post-url/index.js.map +1 -1
  138. package/build/components/post-visibility/check.js +6 -7
  139. package/build/components/post-visibility/check.js.map +1 -1
  140. package/build/components/post-visibility/index.js +10 -12
  141. package/build/components/post-visibility/index.js.map +1 -1
  142. package/build/components/post-visibility/label.js +1 -3
  143. package/build/components/post-visibility/label.js.map +1 -1
  144. package/build/components/provider/index.js +9 -10
  145. package/build/components/provider/index.js.map +1 -1
  146. package/build/components/provider/index.native.js +14 -20
  147. package/build/components/provider/index.native.js.map +1 -1
  148. package/build/components/provider/use-block-editor-settings.js +5 -9
  149. package/build/components/provider/use-block-editor-settings.js.map +1 -1
  150. package/build/components/provider/use-block-editor-settings.native.js +1 -3
  151. package/build/components/provider/use-block-editor-settings.native.js.map +1 -1
  152. package/build/components/table-of-contents/index.js +26 -33
  153. package/build/components/table-of-contents/index.js.map +1 -1
  154. package/build/components/table-of-contents/panel.js +4 -5
  155. package/build/components/table-of-contents/panel.js.map +1 -1
  156. package/build/components/template-validation-notice/index.js +4 -6
  157. package/build/components/template-validation-notice/index.js.map +1 -1
  158. package/build/components/theme-support-check/index.js +7 -8
  159. package/build/components/theme-support-check/index.js.map +1 -1
  160. package/build/hooks/custom-sources-backwards-compatibility.js +16 -35
  161. package/build/hooks/custom-sources-backwards-compatibility.js.map +1 -1
  162. package/build/hooks/default-autocompleters.js +1 -2
  163. package/build/hooks/default-autocompleters.js.map +1 -1
  164. package/build/private-apis.js +4 -1
  165. package/build/private-apis.js.map +1 -1
  166. package/build/store/actions.js +147 -179
  167. package/build/store/actions.js.map +1 -1
  168. package/build/store/actions.native.js +1 -2
  169. package/build/store/actions.native.js.map +1 -1
  170. package/build/store/reducer.js +14 -44
  171. package/build/store/reducer.js.map +1 -1
  172. package/build/store/reducer.native.js +3 -12
  173. package/build/store/reducer.native.js.map +1 -1
  174. package/build/store/selectors.js +23 -54
  175. package/build/store/selectors.js.map +1 -1
  176. package/build/store/utils/notice-builder.js +3 -3
  177. package/build/store/utils/notice-builder.js.map +1 -1
  178. package/build/utils/media-upload/index.js +11 -15
  179. package/build/utils/media-upload/index.js.map +1 -1
  180. package/build/utils/terms.js +3 -6
  181. package/build/utils/terms.js.map +1 -1
  182. package/build-module/components/autosave-monitor/index.js +1 -2
  183. package/build-module/components/autosave-monitor/index.js.map +1 -1
  184. package/build-module/components/deprecated.js +3 -4
  185. package/build-module/components/deprecated.js.map +1 -1
  186. package/build-module/components/document-outline/check.js +4 -5
  187. package/build-module/components/document-outline/check.js.map +1 -1
  188. package/build-module/components/document-outline/index.js +12 -16
  189. package/build-module/components/document-outline/index.js.map +1 -1
  190. package/build-module/components/document-outline/item.js +22 -25
  191. package/build-module/components/document-outline/item.js.map +1 -1
  192. package/build-module/components/editor-help/help-detail-navigation-screen.native.js +4 -5
  193. package/build-module/components/editor-help/help-detail-navigation-screen.native.js.map +1 -1
  194. package/build-module/components/editor-help/help-get-support-button.native.js +4 -5
  195. package/build-module/components/editor-help/help-get-support-button.native.js.map +1 -1
  196. package/build-module/components/editor-help/help-section-title.native.js +3 -4
  197. package/build-module/components/editor-help/help-section-title.native.js.map +1 -1
  198. package/build-module/components/editor-help/help-topic-row.native.js +6 -7
  199. package/build-module/components/editor-help/help-topic-row.native.js.map +1 -1
  200. package/build-module/components/editor-help/index.native.js +19 -23
  201. package/build-module/components/editor-help/index.native.js.map +1 -1
  202. package/build-module/components/editor-help/view-sections.native.js +16 -20
  203. package/build-module/components/editor-help/view-sections.native.js.map +1 -1
  204. package/build-module/components/editor-notices/index.js +12 -19
  205. package/build-module/components/editor-notices/index.js.map +1 -1
  206. package/build-module/components/editor-snackbars/index.js +3 -6
  207. package/build-module/components/editor-snackbars/index.js.map +1 -1
  208. package/build-module/components/entities-saved-states/entity-record-item.js +7 -10
  209. package/build-module/components/entities-saved-states/entity-record-item.js.map +1 -1
  210. package/build-module/components/entities-saved-states/entity-type-list.js +6 -7
  211. package/build-module/components/entities-saved-states/entity-type-list.js.map +1 -1
  212. package/build-module/components/entities-saved-states/hooks/use-is-dirty.js +70 -0
  213. package/build-module/components/entities-saved-states/hooks/use-is-dirty.js.map +1 -0
  214. package/build-module/components/entities-saved-states/index.js +39 -113
  215. package/build-module/components/entities-saved-states/index.js.map +1 -1
  216. package/build-module/components/error-boundary/index.js +4 -5
  217. package/build-module/components/error-boundary/index.js.map +1 -1
  218. package/build-module/components/global-keyboard-shortcuts/save-shortcut.js +3 -4
  219. package/build-module/components/global-keyboard-shortcuts/save-shortcut.js.map +1 -1
  220. package/build-module/components/index.js +1 -0
  221. package/build-module/components/index.js.map +1 -1
  222. package/build-module/components/media-categories/index.js +25 -42
  223. package/build-module/components/media-categories/index.js.map +1 -1
  224. package/build-module/components/page-attributes/check.js +4 -7
  225. package/build-module/components/page-attributes/check.js.map +1 -1
  226. package/build-module/components/page-attributes/order.js +5 -8
  227. package/build-module/components/page-attributes/order.js.map +1 -1
  228. package/build-module/components/page-attributes/parent.js +5 -12
  229. package/build-module/components/page-attributes/parent.js.map +1 -1
  230. package/build-module/components/post-author/check.js +6 -7
  231. package/build-module/components/post-author/check.js.map +1 -1
  232. package/build-module/components/post-author/combobox.js +3 -6
  233. package/build-module/components/post-author/combobox.js.map +1 -1
  234. package/build-module/components/post-author/index.js +1 -1
  235. package/build-module/components/post-author/index.js.map +1 -1
  236. package/build-module/components/post-comments/index.js +4 -6
  237. package/build-module/components/post-comments/index.js.map +1 -1
  238. package/build-module/components/post-excerpt/index.js +4 -5
  239. package/build-module/components/post-excerpt/index.js.map +1 -1
  240. package/build-module/components/post-featured-image/index.js +56 -69
  241. package/build-module/components/post-featured-image/index.js.map +1 -1
  242. package/build-module/components/post-format/check.js +4 -5
  243. package/build-module/components/post-format/check.js.map +1 -1
  244. package/build-module/components/post-format/index.js +1 -1
  245. package/build-module/components/post-format/index.js.map +1 -1
  246. package/build-module/components/post-last-revision/check.js +5 -7
  247. package/build-module/components/post-last-revision/check.js.map +1 -1
  248. package/build-module/components/post-last-revision/index.js +4 -5
  249. package/build-module/components/post-last-revision/index.js.map +1 -1
  250. package/build-module/components/post-locked-modal/index.js +1 -1
  251. package/build-module/components/post-locked-modal/index.js.map +1 -1
  252. package/build-module/components/post-pending-status/check.js +7 -9
  253. package/build-module/components/post-pending-status/check.js.map +1 -1
  254. package/build-module/components/post-pending-status/index.js +4 -6
  255. package/build-module/components/post-pending-status/index.js.map +1 -1
  256. package/build-module/components/post-pingbacks/index.js +4 -6
  257. package/build-module/components/post-pingbacks/index.js.map +1 -1
  258. package/build-module/components/post-preview-button/index.js +8 -12
  259. package/build-module/components/post-preview-button/index.js.map +1 -1
  260. package/build-module/components/post-publish-button/index.js +6 -13
  261. package/build-module/components/post-publish-button/index.js.map +1 -1
  262. package/build-module/components/post-publish-button/label.js +14 -17
  263. package/build-module/components/post-publish-button/label.js.map +1 -1
  264. package/build-module/components/post-publish-panel/index.js +6 -7
  265. package/build-module/components/post-publish-panel/index.js.map +1 -1
  266. package/build-module/components/post-publish-panel/maybe-category-panel.js +2 -4
  267. package/build-module/components/post-publish-panel/maybe-category-panel.js.map +1 -1
  268. package/build-module/components/post-publish-panel/maybe-post-format-panel.js +9 -12
  269. package/build-module/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
  270. package/build-module/components/post-publish-panel/maybe-tags-panel.js +4 -7
  271. package/build-module/components/post-publish-panel/maybe-tags-panel.js.map +1 -1
  272. package/build-module/components/post-publish-panel/postpublish.js +8 -11
  273. package/build-module/components/post-publish-panel/postpublish.js.map +1 -1
  274. package/build-module/components/post-publish-panel/prepublish.js +5 -6
  275. package/build-module/components/post-publish-panel/prepublish.js.map +1 -1
  276. package/build-module/components/post-saved-state/index.js +13 -8
  277. package/build-module/components/post-saved-state/index.js.map +1 -1
  278. package/build-module/components/post-schedule/check.js +6 -8
  279. package/build-module/components/post-schedule/check.js.map +1 -1
  280. package/build-module/components/post-schedule/index.js +8 -12
  281. package/build-module/components/post-schedule/index.js.map +1 -1
  282. package/build-module/components/post-schedule/label.js +7 -10
  283. package/build-module/components/post-schedule/label.js.map +1 -1
  284. package/build-module/components/post-slug/check.js +3 -4
  285. package/build-module/components/post-slug/check.js.map +1 -1
  286. package/build-module/components/post-slug/index.js +5 -6
  287. package/build-module/components/post-slug/index.js.map +1 -1
  288. package/build-module/components/post-sticky/check.js +7 -9
  289. package/build-module/components/post-sticky/check.js.map +1 -1
  290. package/build-module/components/post-sticky/index.js +4 -5
  291. package/build-module/components/post-sticky/index.js.map +1 -1
  292. package/build-module/components/post-switch-to-draft-button/index.js +6 -7
  293. package/build-module/components/post-switch-to-draft-button/index.js.map +1 -1
  294. package/build-module/components/post-taxonomies/check.js +6 -7
  295. package/build-module/components/post-taxonomies/check.js.map +1 -1
  296. package/build-module/components/post-taxonomies/flat-term-selector.js +12 -13
  297. package/build-module/components/post-taxonomies/flat-term-selector.js.map +1 -1
  298. package/build-module/components/post-taxonomies/hierarchical-term-selector.js +13 -14
  299. package/build-module/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
  300. package/build-module/components/post-taxonomies/index.js +6 -11
  301. package/build-module/components/post-taxonomies/index.js.map +1 -1
  302. package/build-module/components/post-taxonomies/most-used-terms.js +5 -6
  303. package/build-module/components/post-taxonomies/most-used-terms.js.map +1 -1
  304. package/build-module/components/post-template/index.js +6 -9
  305. package/build-module/components/post-template/index.js.map +1 -1
  306. package/build-module/components/post-title/index.js +2 -6
  307. package/build-module/components/post-title/index.js.map +1 -1
  308. package/build-module/components/post-title/index.native.js +8 -11
  309. package/build-module/components/post-title/index.native.js.map +1 -1
  310. package/build-module/components/post-trash/check.js +7 -9
  311. package/build-module/components/post-trash/check.js.map +1 -1
  312. package/build-module/components/post-type-support-check/index.js +5 -6
  313. package/build-module/components/post-type-support-check/index.js.map +1 -1
  314. package/build-module/components/post-url/check.js +4 -5
  315. package/build-module/components/post-url/check.js.map +1 -1
  316. package/build-module/components/post-url/index.js +8 -9
  317. package/build-module/components/post-url/index.js.map +1 -1
  318. package/build-module/components/post-visibility/check.js +6 -7
  319. package/build-module/components/post-visibility/check.js.map +1 -1
  320. package/build-module/components/post-visibility/index.js +10 -12
  321. package/build-module/components/post-visibility/index.js.map +1 -1
  322. package/build-module/components/post-visibility/label.js +1 -3
  323. package/build-module/components/post-visibility/label.js.map +1 -1
  324. package/build-module/components/provider/index.js +9 -10
  325. package/build-module/components/provider/index.js.map +1 -1
  326. package/build-module/components/provider/index.native.js +14 -20
  327. package/build-module/components/provider/index.native.js.map +1 -1
  328. package/build-module/components/provider/use-block-editor-settings.js +5 -9
  329. package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
  330. package/build-module/components/provider/use-block-editor-settings.native.js +1 -3
  331. package/build-module/components/provider/use-block-editor-settings.native.js.map +1 -1
  332. package/build-module/components/table-of-contents/index.js +26 -33
  333. package/build-module/components/table-of-contents/index.js.map +1 -1
  334. package/build-module/components/table-of-contents/panel.js +4 -5
  335. package/build-module/components/table-of-contents/panel.js.map +1 -1
  336. package/build-module/components/template-validation-notice/index.js +4 -6
  337. package/build-module/components/template-validation-notice/index.js.map +1 -1
  338. package/build-module/components/theme-support-check/index.js +7 -8
  339. package/build-module/components/theme-support-check/index.js.map +1 -1
  340. package/build-module/hooks/custom-sources-backwards-compatibility.js +16 -35
  341. package/build-module/hooks/custom-sources-backwards-compatibility.js.map +1 -1
  342. package/build-module/hooks/default-autocompleters.js +1 -2
  343. package/build-module/hooks/default-autocompleters.js.map +1 -1
  344. package/build-module/private-apis.js +3 -1
  345. package/build-module/private-apis.js.map +1 -1
  346. package/build-module/store/actions.js +147 -179
  347. package/build-module/store/actions.js.map +1 -1
  348. package/build-module/store/actions.native.js +1 -2
  349. package/build-module/store/actions.native.js.map +1 -1
  350. package/build-module/store/reducer.js +14 -44
  351. package/build-module/store/reducer.js.map +1 -1
  352. package/build-module/store/reducer.native.js +3 -12
  353. package/build-module/store/reducer.native.js.map +1 -1
  354. package/build-module/store/selectors.js +21 -54
  355. package/build-module/store/selectors.js.map +1 -1
  356. package/build-module/store/utils/notice-builder.js +3 -3
  357. package/build-module/store/utils/notice-builder.js.map +1 -1
  358. package/build-module/utils/media-upload/index.js +11 -15
  359. package/build-module/utils/media-upload/index.js.map +1 -1
  360. package/build-module/utils/terms.js +3 -6
  361. package/build-module/utils/terms.js.map +1 -1
  362. package/package.json +30 -30
  363. package/src/components/entities-saved-states/hooks/use-is-dirty.js +85 -0
  364. package/src/components/entities-saved-states/index.js +25 -106
  365. package/src/components/entities-saved-states/test/use-is-dirty.js +94 -0
  366. package/src/components/index.js +1 -0
  367. package/src/components/post-saved-state/index.js +6 -0
  368. package/src/components/post-title/index.js +2 -1
  369. package/src/private-apis.js +2 -0
@@ -14,21 +14,19 @@ import { usePreferredColorScheme, usePreferredColorSchemeStyle } from '@wordpres
14
14
  */
15
15
 
16
16
  import styles from './style.scss';
17
- export const HelpDetailBodyText = _ref => {
18
- let {
19
- text
20
- } = _ref;
17
+ export const HelpDetailBodyText = ({
18
+ text
19
+ }) => {
21
20
  const bodyStyle = usePreferredColorSchemeStyle(styles.helpDetailBody, styles.helpDetailBodyDark);
22
21
  return createElement(Text, {
23
22
  selectable: true,
24
23
  style: bodyStyle
25
24
  }, text);
26
25
  };
27
- export const HelpDetailSectionHeadingText = _ref2 => {
28
- let {
29
- text,
30
- badge
31
- } = _ref2;
26
+ export const HelpDetailSectionHeadingText = ({
27
+ text,
28
+ badge
29
+ }) => {
32
30
  const headingTextStyle = usePreferredColorSchemeStyle(styles.helpDetailSectionHeadingText, styles.helpDetailSectionHeadingTextDark);
33
31
  return createElement(View, {
34
32
  style: styles.helpDetailSectionHeading
@@ -40,13 +38,12 @@ export const HelpDetailSectionHeadingText = _ref2 => {
40
38
  style: headingTextStyle
41
39
  }, text));
42
40
  };
43
- export const HelpDetailImage = _ref3 => {
44
- let {
45
- accessible,
46
- accessibilityLabel,
47
- source,
48
- sourceDarkMode
49
- } = _ref3;
41
+ export const HelpDetailImage = ({
42
+ accessible,
43
+ accessibilityLabel,
44
+ source,
45
+ sourceDarkMode
46
+ }) => {
50
47
  const imageStyle = usePreferredColorSchemeStyle(styles.helpDetailImage, styles.helpDetailImageDark);
51
48
  const darkModeEnabled = usePreferredColorScheme() === 'dark';
52
49
  return createElement(Image, {
@@ -57,10 +54,9 @@ export const HelpDetailImage = _ref3 => {
57
54
  });
58
55
  };
59
56
 
60
- const HelpDetailBadge = _ref4 => {
61
- let {
62
- text
63
- } = _ref4;
57
+ const HelpDetailBadge = ({
58
+ text
59
+ }) => {
64
60
  return createElement(View, {
65
61
  style: styles.helpDetailBadgeContainer
66
62
  }, createElement(Text, {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/editor-help/view-sections.native.js"],"names":["Text","Image","View","usePreferredColorScheme","usePreferredColorSchemeStyle","styles","HelpDetailBodyText","text","bodyStyle","helpDetailBody","helpDetailBodyDark","HelpDetailSectionHeadingText","badge","headingTextStyle","helpDetailSectionHeadingText","helpDetailSectionHeadingTextDark","helpDetailSectionHeading","HelpDetailImage","accessible","accessibilityLabel","source","sourceDarkMode","imageStyle","helpDetailImage","helpDetailImageDark","darkModeEnabled","HelpDetailBadge","helpDetailBadgeContainer","helpDetailBadgeText"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,IAAT,EAAeC,KAAf,EAAsBC,IAAtB,QAAkC,cAAlC;AAEA;AACA;AACA;;AACA,SACCC,uBADD,EAECC,4BAFD,QAGO,oBAHP;AAKA;AACA;AACA;;AACA,OAAOC,MAAP,MAAmB,cAAnB;AAEA,OAAO,MAAMC,kBAAkB,GAAG,QAAgB;AAAA,MAAd;AAAEC,IAAAA;AAAF,GAAc;AACjD,QAAMC,SAAS,GAAGJ,4BAA4B,CAC7CC,MAAM,CAACI,cADsC,EAE7CJ,MAAM,CAACK,kBAFsC,CAA9C;AAIA,SACC,cAAC,IAAD;AAAM,IAAA,UAAU,MAAhB;AAAiB,IAAA,KAAK,EAAGF;AAAzB,KACGD,IADH,CADD;AAKA,CAVM;AAYP,OAAO,MAAMI,4BAA4B,GAAG,SAAuB;AAAA,MAArB;AAAEJ,IAAAA,IAAF;AAAQK,IAAAA;AAAR,GAAqB;AAClE,QAAMC,gBAAgB,GAAGT,4BAA4B,CACpDC,MAAM,CAACS,4BAD6C,EAEpDT,MAAM,CAACU,gCAF6C,CAArD;AAIA,SACC,cAAC,IAAD;AAAM,IAAA,KAAK,EAAGV,MAAM,CAACW;AAArB,KACGJ,KAAK,IAAI,cAAC,eAAD;AAAiB,IAAA,IAAI,EAAGA;AAAxB,IADZ,EAEC,cAAC,IAAD;AACC,IAAA,iBAAiB,EAAC,QADnB;AAEC,IAAA,UAAU,MAFX;AAGC,IAAA,KAAK,EAAGC;AAHT,KAKGN,IALH,CAFD,CADD;AAYA,CAjBM;AAmBP,OAAO,MAAMU,eAAe,GAAG,SAKxB;AAAA,MAL0B;AAChCC,IAAAA,UADgC;AAEhCC,IAAAA,kBAFgC;AAGhCC,IAAAA,MAHgC;AAIhCC,IAAAA;AAJgC,GAK1B;AACN,QAAMC,UAAU,GAAGlB,4BAA4B,CAC9CC,MAAM,CAACkB,eADuC,EAE9ClB,MAAM,CAACmB,mBAFuC,CAA/C;AAIA,QAAMC,eAAe,GAAGtB,uBAAuB,OAAO,MAAtD;AACA,SACC,cAAC,KAAD;AACC,IAAA,UAAU,EAAGe,UADd;AAEC,IAAA,kBAAkB,EAAGC,kBAFtB;AAGC,IAAA,MAAM,EACLM,eAAe,IAAIJ,cAAnB,GAAoCA,cAApC,GAAqDD,MAJvD;AAMC,IAAA,KAAK,EAAGE;AANT,IADD;AAUA,CArBM;;AAuBP,MAAMI,eAAe,GAAG,SAAgB;AAAA,MAAd;AAAEnB,IAAAA;AAAF,GAAc;AACvC,SACC,cAAC,IAAD;AAAM,IAAA,KAAK,EAAGF,MAAM,CAACsB;AAArB,KACC,cAAC,IAAD;AAAM,IAAA,KAAK,EAAGtB,MAAM,CAACuB;AAArB,KAA6CrB,IAA7C,CADD,CADD;AAKA,CAND","sourcesContent":["/**\n * External dependencies\n */\nimport { Text, Image, View } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tusePreferredColorScheme,\n\tusePreferredColorSchemeStyle,\n} from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\n\nexport const HelpDetailBodyText = ( { text } ) => {\n\tconst bodyStyle = usePreferredColorSchemeStyle(\n\t\tstyles.helpDetailBody,\n\t\tstyles.helpDetailBodyDark\n\t);\n\treturn (\n\t\t<Text selectable style={ bodyStyle }>\n\t\t\t{ text }\n\t\t</Text>\n\t);\n};\n\nexport const HelpDetailSectionHeadingText = ( { text, badge } ) => {\n\tconst headingTextStyle = usePreferredColorSchemeStyle(\n\t\tstyles.helpDetailSectionHeadingText,\n\t\tstyles.helpDetailSectionHeadingTextDark\n\t);\n\treturn (\n\t\t<View style={ styles.helpDetailSectionHeading }>\n\t\t\t{ badge && <HelpDetailBadge text={ badge } /> }\n\t\t\t<Text\n\t\t\t\taccessibilityRole=\"header\"\n\t\t\t\tselectable\n\t\t\t\tstyle={ headingTextStyle }\n\t\t\t>\n\t\t\t\t{ text }\n\t\t\t</Text>\n\t\t</View>\n\t);\n};\n\nexport const HelpDetailImage = ( {\n\taccessible,\n\taccessibilityLabel,\n\tsource,\n\tsourceDarkMode,\n} ) => {\n\tconst imageStyle = usePreferredColorSchemeStyle(\n\t\tstyles.helpDetailImage,\n\t\tstyles.helpDetailImageDark\n\t);\n\tconst darkModeEnabled = usePreferredColorScheme() === 'dark';\n\treturn (\n\t\t<Image\n\t\t\taccessible={ accessible }\n\t\t\taccessibilityLabel={ accessibilityLabel }\n\t\t\tsource={\n\t\t\t\tdarkModeEnabled && sourceDarkMode ? sourceDarkMode : source\n\t\t\t}\n\t\t\tstyle={ imageStyle }\n\t\t/>\n\t);\n};\n\nconst HelpDetailBadge = ( { text } ) => {\n\treturn (\n\t\t<View style={ styles.helpDetailBadgeContainer }>\n\t\t\t<Text style={ styles.helpDetailBadgeText }>{ text }</Text>\n\t\t</View>\n\t);\n};\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/editor-help/view-sections.native.js"],"names":["Text","Image","View","usePreferredColorScheme","usePreferredColorSchemeStyle","styles","HelpDetailBodyText","text","bodyStyle","helpDetailBody","helpDetailBodyDark","HelpDetailSectionHeadingText","badge","headingTextStyle","helpDetailSectionHeadingText","helpDetailSectionHeadingTextDark","helpDetailSectionHeading","HelpDetailImage","accessible","accessibilityLabel","source","sourceDarkMode","imageStyle","helpDetailImage","helpDetailImageDark","darkModeEnabled","HelpDetailBadge","helpDetailBadgeContainer","helpDetailBadgeText"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,IAAT,EAAeC,KAAf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e,UADd;AAEC,IAAA,kBAAkB,EAAGC,kBAFtB;AAGC,IAAA,MAAM,EACLM,eAAe,IAAIJ,cAAnB,GAAoCA,cAApC,GAAqDD,MAJvD;AAMC,IAAA,KAAK,EAAGE;AANT,IADD;AAUA,CArBM;;AAuBP,MAAMI,eAAe,GAAG,CAAE;AAAEnB,EAAAA;AAAF,CAAF,KAAgB;AACvC,SACC,cAAC,IAAD;AAAM,IAAA,KAAK,EAAGF,MAAM,CAACsB;AAArB,KACC,cAAC,IAAD;AAAM,IAAA,KAAK,EAAGtB,MAAM,CAACuB;AAArB,KAA6CrB,IAA7C,CADD,CADD;AAKA,CAND","sourcesContent":["/**\n * External dependencies\n */\nimport { Text, Image, View } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tusePreferredColorScheme,\n\tusePreferredColorSchemeStyle,\n} from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\n\nexport const HelpDetailBodyText = ( { text } ) => {\n\tconst bodyStyle = usePreferredColorSchemeStyle(\n\t\tstyles.helpDetailBody,\n\t\tstyles.helpDetailBodyDark\n\t);\n\treturn (\n\t\t<Text selectable style={ bodyStyle }>\n\t\t\t{ text }\n\t\t</Text>\n\t);\n};\n\nexport const HelpDetailSectionHeadingText = ( { text, badge } ) => {\n\tconst headingTextStyle = usePreferredColorSchemeStyle(\n\t\tstyles.helpDetailSectionHeadingText,\n\t\tstyles.helpDetailSectionHeadingTextDark\n\t);\n\treturn (\n\t\t<View style={ styles.helpDetailSectionHeading }>\n\t\t\t{ badge && <HelpDetailBadge text={ badge } /> }\n\t\t\t<Text\n\t\t\t\taccessibilityRole=\"header\"\n\t\t\t\tselectable\n\t\t\t\tstyle={ headingTextStyle }\n\t\t\t>\n\t\t\t\t{ text }\n\t\t\t</Text>\n\t\t</View>\n\t);\n};\n\nexport const HelpDetailImage = ( {\n\taccessible,\n\taccessibilityLabel,\n\tsource,\n\tsourceDarkMode,\n} ) => {\n\tconst imageStyle = usePreferredColorSchemeStyle(\n\t\tstyles.helpDetailImage,\n\t\tstyles.helpDetailImageDark\n\t);\n\tconst darkModeEnabled = usePreferredColorScheme() === 'dark';\n\treturn (\n\t\t<Image\n\t\t\taccessible={ accessible }\n\t\t\taccessibilityLabel={ accessibilityLabel }\n\t\t\tsource={\n\t\t\t\tdarkModeEnabled && sourceDarkMode ? sourceDarkMode : source\n\t\t\t}\n\t\t\tstyle={ imageStyle }\n\t\t/>\n\t);\n};\n\nconst HelpDetailBadge = ( { text } ) => {\n\treturn (\n\t\t<View style={ styles.helpDetailBadgeContainer }>\n\t\t\t<Text style={ styles.helpDetailBadgeText }>{ text }</Text>\n\t\t</View>\n\t);\n};\n"]}
@@ -12,25 +12,18 @@ import { store as noticesStore } from '@wordpress/notices';
12
12
  */
13
13
 
14
14
  import TemplateValidationNotice from '../template-validation-notice';
15
- export function EditorNotices(_ref) {
16
- let {
17
- notices,
18
- onRemove
19
- } = _ref;
20
- const dismissibleNotices = notices.filter(_ref2 => {
21
- let {
22
- isDismissible,
23
- type
24
- } = _ref2;
25
- return isDismissible && type === 'default';
26
- });
27
- const nonDismissibleNotices = notices.filter(_ref3 => {
28
- let {
29
- isDismissible,
30
- type
31
- } = _ref3;
32
- return !isDismissible && type === 'default';
33
- });
15
+ export function EditorNotices({
16
+ notices,
17
+ onRemove
18
+ }) {
19
+ const dismissibleNotices = notices.filter(({
20
+ isDismissible,
21
+ type
22
+ }) => isDismissible && type === 'default');
23
+ const nonDismissibleNotices = notices.filter(({
24
+ isDismissible,
25
+ type
26
+ }) => !isDismissible && type === 'default');
34
27
  return createElement(Fragment, null, createElement(NoticeList, {
35
28
  notices: nonDismissibleNotices,
36
29
  className: "components-editor-notices__pinned"
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/editor-notices/index.js"],"names":["NoticeList","withSelect","withDispatch","compose","store","noticesStore","TemplateValidationNotice","EditorNotices","notices","onRemove","dismissibleNotices","filter","isDismissible","type","nonDismissibleNotices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AlB,CAAF,CAJW,CAAF,CAAP,CAOVX,aAPU,CAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { NoticeList } from '@wordpress/components';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport TemplateValidationNotice from '../template-validation-notice';\n\nexport function EditorNotices( { notices, onRemove } ) {\n\tconst dismissibleNotices = notices.filter(\n\t\t( { isDismissible, type } ) => isDismissible && type === 'default'\n\t);\n\tconst nonDismissibleNotices = notices.filter(\n\t\t( { isDismissible, type } ) => ! isDismissible && type === 'default'\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t<NoticeList\n\t\t\t\tnotices={ nonDismissibleNotices }\n\t\t\t\tclassName=\"components-editor-notices__pinned\"\n\t\t\t/>\n\t\t\t<NoticeList\n\t\t\t\tnotices={ dismissibleNotices }\n\t\t\t\tclassName=\"components-editor-notices__dismissible\"\n\t\t\t\tonRemove={ onRemove }\n\t\t\t>\n\t\t\t\t<TemplateValidationNotice />\n\t\t\t</NoticeList>\n\t\t</>\n\t);\n}\n\nexport default compose( [\n\twithSelect( ( select ) => ( {\n\t\tnotices: select( noticesStore ).getNotices(),\n\t} ) ),\n\twithDispatch( ( dispatch ) => ( {\n\t\tonRemove: dispatch( noticesStore ).removeNotice,\n\t} ) ),\n] )( EditorNotices );\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/editor-notices/index.js"],"names":["NoticeList","withSelect","withDispatch","compose","store","noticesStore","TemplateValidationNotice","EditorNotices","notices","onRemove","dismissibleNotices","filter","isDismissible","type","nonDismissibleNotices","select","getNotices","dispatch","removeNotice"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,UAAT,QAA2B,uBAA3B;AACA,SAASC,UAAT,EAAqBC,YAArB,QAAyC,iBAAzC;AACA,SAASC,OAAT,QAAwB,oBAAxB;AACA,SAASC,KAAK,IAAIC,YAAlB,QAAsC,oBAAtC;AAEA;AACA;AACA;;AACA,OAAOC,wBAAP,MAAqC,+BAArC;AAEA,OAAO,SAASC,aAAT,CAAwB;AAAEC,EAAAA,OAAF;AAAWC,EAAAA;AAAX,CAAxB,EAAgD;AACtD,QAAMC,kBAAkB,GAAGF,OAAO,CAACG,MAAR,CAC1B,CAAE;AAAEC,IAAAA,aAAF;AAAiBC,IAAAA;AAAjB,GAAF,KAA+BD,aAAa,IAAIC,IAAI,KAAK,SAD/B,CAA3B;AAGA,QAAMC,qBAAqB,GAAGN,OAAO,CAACG,MAAR,CAC7B,CAAE;AAAEC,IAAAA,aAAF;AAAiBC,IAAAA;AAAjB,GAAF,KAA+B,CAAED,aAAF,IAAmBC,IAAI,KAAK,SAD9B,CAA9B;AAIA,SACC,8BACC,cAAC,UAAD;AACC,IAAA,OAAO,EAAGC,qBADX;AAEC,IAAA,SAAS,EAAC;AAFX,IADD,EAKC,cAAC,UAAD;AACC,IAAA,OAAO,EAAGJ,kBADX;AAEC,IAAA,SAAS,EAAC,wCAFX;AAGC,IAAA,QAAQ,EAAGD;AAHZ,KAKC,cAAC,wBAAD,OALD,CALD,CADD;AAeA;AAED,eAAeN,OAAO,CAAE,CACvBF,UAAU,CAAIc,MAAF,KAAgB;AAC3BP,EAAAA,OAAO,EAAEO,MAAM,CAAEV,YAAF,CAAN,CAAuBW,UAAvB;AADkB,CAAhB,CAAF,CADa,EAIvBd,YAAY,CAAIe,QAAF,KAAkB;AAC/BR,EAAAA,QAAQ,EAAEQ,QAAQ,CAAEZ,YAAF,CAAR,CAAyBa;AADJ,CAAlB,CAAF,CAJW,CAAF,CAAP,CAOVX,aAPU,CAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { NoticeList } from '@wordpress/components';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport TemplateValidationNotice from '../template-validation-notice';\n\nexport function EditorNotices( { notices, onRemove } ) {\n\tconst dismissibleNotices = notices.filter(\n\t\t( { isDismissible, type } ) => isDismissible && type === 'default'\n\t);\n\tconst nonDismissibleNotices = notices.filter(\n\t\t( { isDismissible, type } ) => ! isDismissible && type === 'default'\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t<NoticeList\n\t\t\t\tnotices={ nonDismissibleNotices }\n\t\t\t\tclassName=\"components-editor-notices__pinned\"\n\t\t\t/>\n\t\t\t<NoticeList\n\t\t\t\tnotices={ dismissibleNotices }\n\t\t\t\tclassName=\"components-editor-notices__dismissible\"\n\t\t\t\tonRemove={ onRemove }\n\t\t\t>\n\t\t\t\t<TemplateValidationNotice />\n\t\t\t</NoticeList>\n\t\t</>\n\t);\n}\n\nexport default compose( [\n\twithSelect( ( select ) => ( {\n\t\tnotices: select( noticesStore ).getNotices(),\n\t} ) ),\n\twithDispatch( ( dispatch ) => ( {\n\t\tonRemove: dispatch( noticesStore ).removeNotice,\n\t} ) ),\n] )( EditorNotices );\n"]}
@@ -11,12 +11,9 @@ export default function EditorSnackbars() {
11
11
  const {
12
12
  removeNotice
13
13
  } = useDispatch(noticesStore);
14
- const snackbarNotices = notices.filter(_ref => {
15
- let {
16
- type
17
- } = _ref;
18
- return type === 'snackbar';
19
- });
14
+ const snackbarNotices = notices.filter(({
15
+ type
16
+ }) => type === 'snackbar');
20
17
  return createElement(SnackbarList, {
21
18
  notices: snackbarNotices,
22
19
  className: "components-editor-notices__snackbar",
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/editor-snackbars/index.js"],"names":["SnackbarList","useSelect","useDispatch","store","noticesStore","EditorSnackbars","notices","select","getNotices","removeNotice","snackbarNotices","filter","type"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,YAAT,QAA6B,uBAA7B;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,KAAK,IAAIC,YAAlB,QAAsC,oBAAtC;AAEA,eAAe,SAASC,eAAT,GAA2B;AACzC,QAAMC,OAAO,GAAGL,SAAS,CACtBM,MAAF,IAAcA,MAAM,CAAEH,YAAF,CAAN,CAAuBI,UAAvB,EADU,EAExB,EAFwB,CAAzB;AAIA,QAAM;AAAEC,IAAAA;AAAF,MAAmBP,WAAW,CAAEE,YAAF,CAApC;AACA,QAAMM,eAAe,GAAGJ,OAAO,CAACK,MAAR,CACvB;AAAA,QAAE;AAAEC,MAAAA;AAAF,KAAF;AAAA,WAAgBA,IAAI,KAAK,UAAzB;AAAA,GADuB,CAAxB;AAIA,SACC,cAAC,YAAD;AACC,IAAA,OAAO,EAAGF,eADX;AAEC,IAAA,SAAS,EAAC,qCAFX;AAGC,IAAA,QAAQ,EAAGD;AAHZ,IADD;AAOA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { SnackbarList } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as noticesStore } from '@wordpress/notices';\n\nexport default function EditorSnackbars() {\n\tconst notices = useSelect(\n\t\t( select ) => select( noticesStore ).getNotices(),\n\t\t[]\n\t);\n\tconst { removeNotice } = useDispatch( noticesStore );\n\tconst snackbarNotices = notices.filter(\n\t\t( { type } ) => type === 'snackbar'\n\t);\n\n\treturn (\n\t\t<SnackbarList\n\t\t\tnotices={ snackbarNotices }\n\t\t\tclassName=\"components-editor-notices__snackbar\"\n\t\t\tonRemove={ removeNotice }\n\t\t/>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/editor-snackbars/index.js"],"names":["SnackbarList","useSelect","useDispatch","store","noticesStore","EditorSnackbars","notices","select","getNotices","removeNotice","snackbarNotices","filter","type"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,YAAT,QAA6B,uBAA7B;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,KAAK,IAAIC,YAAlB,QAAsC,oBAAtC;AAEA,eAAe,SAASC,eAAT,GAA2B;AACzC,QAAMC,OAAO,GAAGL,SAAS,CACtBM,MAAF,IAAcA,MAAM,CAAEH,YAAF,CAAN,CAAuBI,UAAvB,EADU,EAExB,EAFwB,CAAzB;AAIA,QAAM;AAAEC,IAAAA;AAAF,MAAmBP,WAAW,CAAEE,YAAF,CAApC;AACA,QAAMM,eAAe,GAAGJ,OAAO,CAACK,MAAR,CACvB,CAAE;AAAEC,IAAAA;AAAF,GAAF,KAAgBA,IAAI,KAAK,UADF,CAAxB;AAIA,SACC,cAAC,YAAD;AACC,IAAA,OAAO,EAAGF,eADX;AAEC,IAAA,SAAS,EAAC,qCAFX;AAGC,IAAA,QAAQ,EAAGD;AAHZ,IADD;AAOA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { SnackbarList } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as noticesStore } from '@wordpress/notices';\n\nexport default function EditorSnackbars() {\n\tconst notices = useSelect(\n\t\t( select ) => select( noticesStore ).getNotices(),\n\t\t[]\n\t);\n\tconst { removeNotice } = useDispatch( noticesStore );\n\tconst snackbarNotices = notices.filter(\n\t\t( { type } ) => type === 'snackbar'\n\t);\n\n\treturn (\n\t\t<SnackbarList\n\t\t\tnotices={ snackbarNotices }\n\t\t\tclassName=\"components-editor-notices__snackbar\"\n\t\t\tonRemove={ removeNotice }\n\t\t/>\n\t);\n}\n"]}
@@ -15,13 +15,12 @@ import { decodeEntities } from '@wordpress/html-entities';
15
15
  */
16
16
 
17
17
  import { store as editorStore } from '../../store';
18
- export default function EntityRecordItem(_ref) {
19
- let {
20
- record,
21
- checked,
22
- onChange,
23
- closePanel
24
- } = _ref;
18
+ export default function EntityRecordItem({
19
+ record,
20
+ checked,
21
+ onChange,
22
+ closePanel
23
+ }) {
25
24
  const {
26
25
  name,
27
26
  kind,
@@ -29,14 +28,12 @@ export default function EntityRecordItem(_ref) {
29
28
  key
30
29
  } = record;
31
30
  const parentBlockId = useSelect(select => {
32
- var _blocks$;
33
-
34
31
  // Get entity's blocks.
35
32
  const {
36
33
  blocks = []
37
34
  } = select(coreStore).getEditedEntityRecord(kind, name, key); // Get parents of the entity's first block.
38
35
 
39
- const parents = select(blockEditorStore).getBlockParents((_blocks$ = blocks[0]) === null || _blocks$ === void 0 ? void 0 : _blocks$.clientId); // Return closest parent block's clientId.
36
+ const parents = select(blockEditorStore).getBlockParents(blocks[0]?.clientId); // Return closest parent block's clientId.
40
37
 
41
38
  return parents[parents.length - 1];
42
39
  }, []); // Handle templates that might use default descriptive titles.
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/entities-saved-states/entity-record-item.js"],"names":["CheckboxControl","Button","PanelRow","__","useSelect","useDispatch","useCallback","store","blockEditorStore","coreStore","decodeEntities","editorStore","EntityRecordItem","record","checked","onChange","closePanel","name","kind","title","key","parentBlockId","select","blocks","getEditedEntityRecord","parents","getBlockParents","clientId","length","entityRecordTitle","template","__experimentalGetTemplateInfo","isSelected","selectedBlockId","getSelectedBlockClientId","isSelectedText","selectBlock","selectParentBlock","selectAndDismiss"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,eAAT,EAA0BC,MAA1B,EAAkCC,QAAlC,QAAkD,uBAAlD;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,WAAT,QAA4B,oBAA5B;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,yBAA1C;AACA,SAASD,KAAK,IAAIE,SAAlB,QAAmC,sBAAnC;AACA,SAASC,cAAT,QAA+B,0BAA/B;AAEA;AACA;AACA;;AACA,SAASH,KAAK,IAAII,WAAlB,QAAqC,aAArC;AAEA,eAAe,SAASC,gBAAT,OAKX;AAAA,MALsC;AACzCC,IAAAA,MADyC;AAEzCC,IAAAA,OAFyC;AAGzCC,IAAAA,QAHyC;AAIzCC,IAAAA;AAJyC,GAKtC;AACH,QAAM;AAAEC,IAAAA,IAAF;AAAQC,IAAAA,IAAR;AAAcC,IAAAA,KAAd;AAAqBC,IAAAA;AA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ACA,QAAM;AAAEiC,IAAAA;AAAF,MAAkB/B,WAAW,CAAEG,gBAAF,CAAnC;AACA,QAAM6B,iBAAiB,GAAG/B,WAAW,CACpC,MAAM8B,WAAW,CAAEf,aAAF,CADmB,EAEpC,CAAEA,aAAF,CAFoC,CAArC;AAIA,QAAMiB,gBAAgB,GAAGhC,WAAW,CAAE,MAAM;AAC3C8B,IAAAA,WAAW,CAAEf,aAAF,CAAX;AACAL,IAAAA,UAAU;AACV,GAHmC,EAGjC,CAAEK,aAAF,CAHiC,CAApC;AAKA,SACC,cAAC,QAAD,QACC,cAAC,eAAD;AACC,IAAA,uBAAuB,MADxB;AAEC,IAAA,KAAK,EACJ,8BACGX,cAAc,CAAEmB,iBAAF,CAAd,IACD1B,EAAE,CAAE,UAAF,CAFJ,CAHF;AAQC,IAAA,OAAO,EAAGW,OARX;AASC,IAAA,QAAQ,EAAGC;AATZ,IADD,EAYGM,aAAa,GACd,8BACC,cAAC,MAAD;AACC,IAAA,OAAO,EAAGgB,iBADX;AAEC,IAAA,SAAS,EAAC,oCAFX;AAGC,IAAA,QAAQ,EAAGL;AAHZ,KAKGG,cALH,CADD,EAQC,cAAC,MAAD;AACC,IAAA,OAAO,EAAGG,gBADX;AAEC,IAAA,SAAS,EAAC,0CAFX;AAGC,IAAA,QAAQ,EAAGN;AAHZ,KAKGG,cALH,CARD,CADc,GAiBX,IA7BL,CADD;AAiCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { CheckboxControl, Button, PanelRow } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useCallback } from '@wordpress/element';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport default function EntityRecordItem( {\n\trecord,\n\tchecked,\n\tonChange,\n\tclosePanel,\n} ) {\n\tconst { name, kind, title, key } = record;\n\tconst parentBlockId = useSelect( ( select ) => {\n\t\t// Get entity's blocks.\n\t\tconst { blocks = [] } = select( coreStore ).getEditedEntityRecord(\n\t\t\tkind,\n\t\t\tname,\n\t\t\tkey\n\t\t);\n\t\t// Get parents of the entity's first block.\n\t\tconst parents = select( blockEditorStore ).getBlockParents(\n\t\t\tblocks[ 0 ]?.clientId\n\t\t);\n\t\t// Return closest parent block's clientId.\n\t\treturn parents[ parents.length - 1 ];\n\t}, [] );\n\n\t// Handle templates that might use default descriptive titles.\n\tconst entityRecordTitle = useSelect(\n\t\t( select ) => {\n\t\t\tif ( 'postType' !== kind || 'wp_template' !== name ) {\n\t\t\t\treturn title;\n\t\t\t}\n\n\t\t\tconst template = select( coreStore ).getEditedEntityRecord(\n\t\t\t\tkind,\n\t\t\t\tname,\n\t\t\t\tkey\n\t\t\t);\n\t\t\treturn select( editorStore ).__experimentalGetTemplateInfo(\n\t\t\t\ttemplate\n\t\t\t).title;\n\t\t},\n\t\t[ name, kind, title, key ]\n\t);\n\n\tconst isSelected = useSelect(\n\t\t( select ) => {\n\t\t\tconst selectedBlockId =\n\t\t\t\tselect( blockEditorStore ).getSelectedBlockClientId();\n\t\t\treturn selectedBlockId === parentBlockId;\n\t\t},\n\t\t[ parentBlockId ]\n\t);\n\tconst isSelectedText = isSelected ? __( 'Selected' ) : __( 'Select' );\n\tconst { selectBlock } = useDispatch( blockEditorStore );\n\tconst selectParentBlock = useCallback(\n\t\t() => selectBlock( parentBlockId ),\n\t\t[ parentBlockId ]\n\t);\n\tconst selectAndDismiss = useCallback( () => {\n\t\tselectBlock( parentBlockId );\n\t\tclosePanel();\n\t}, [ parentBlockId ] );\n\n\treturn (\n\t\t<PanelRow>\n\t\t\t<CheckboxControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tlabel={\n\t\t\t\t\t<strong>\n\t\t\t\t\t\t{ decodeEntities( entityRecordTitle ) ||\n\t\t\t\t\t\t\t__( 'Untitled' ) }\n\t\t\t\t\t</strong>\n\t\t\t\t}\n\t\t\t\tchecked={ checked }\n\t\t\t\tonChange={ onChange }\n\t\t\t/>\n\t\t\t{ parentBlockId ? (\n\t\t\t\t<>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tonClick={ selectParentBlock }\n\t\t\t\t\t\tclassName=\"entities-saved-states__find-entity\"\n\t\t\t\t\t\tdisabled={ isSelected }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ isSelectedText }\n\t\t\t\t\t</Button>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tonClick={ selectAndDismiss }\n\t\t\t\t\t\tclassName=\"entities-saved-states__find-entity-small\"\n\t\t\t\t\t\tdisabled={ isSelected }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ isSelectedText }\n\t\t\t\t\t</Button>\n\t\t\t\t</>\n\t\t\t) : null }\n\t\t</PanelRow>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/entities-saved-states/entity-record-item.js"],"names":["CheckboxControl","Button","PanelRow","__","useSelect","useDispatch","useCallback","store","blockEditorStore","coreStore","decodeEntities","editorStore","EntityRecordItem","record","checked","onChange","closePanel","name","kind","title","key","parentBlockId","select","blocks","getEditedEntityRecord","parents","getBlockParents","clientId","length","entityRecordTitle","template","__experimentalGetTemplateInfo","isSelected","selectedBlockId","getSelectedBlockClientId","isSelectedText","selectBlock","selectParentBlock","selectAndDismiss"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,eAAT,EAA0BC,MAA1B,EAAkCC,QAAlC,QAAkD,uBAAlD;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,WAAT,QAA4B,oBAA5B;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,yBAA1C;AACA,SAASD,KAAK,IAAIE,SAAlB,QAAmC,sBAAnC;AACA,SAASC,cAAT,QAA+B,0BAA/B;AAEA;AACA;AACA;;AACA,SAAS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MW,eAAe,GACpBX,MAAM,CAAEd,gBAAF,CAAN,CAA2B0B,wBAA3B,EADD;AAEA,WAAOD,eAAe,KAAKZ,aAA3B;AACA,GAL0B,EAM3B,CAAEA,aAAF,CAN2B,CAA5B;AAQA,QAAMc,cAAc,GAAGH,UAAU,GAAG7B,EAAE,CAAE,UAAF,CAAL,GAAsBA,EAAE,CAAE,QAAF,CAAzD;AACA,QAAM;AAAEiC,IAAAA;AAAF,MAAkB/B,WAAW,CAAEG,gBAAF,CAAnC;AACA,QAAM6B,iBAAiB,GAAG/B,WAAW,CACpC,MAAM8B,WAAW,CAAEf,aAAF,CADmB,EAEpC,CAAEA,aAAF,CAFoC,CAArC;AAIA,QAAMiB,gBAAgB,GAAGhC,WAAW,CAAE,MAAM;AAC3C8B,IAAAA,WAAW,CAAEf,aAAF,CAAX;AACAL,IAAAA,UAAU;AACV,GAHmC,EAGjC,CAAEK,aAAF,CAHiC,CAApC;AAKA,SACC,cAAC,QAAD,QACC,cAAC,eAAD;AACC,IAAA,uBAAuB,MADxB;AAEC,IAAA,KAAK,EACJ,8BACGX,cAAc,CAAEmB,iBAAF,CAAd,IACD1B,EAAE,CAAE,UAAF,CAFJ,CAHF;AAQC,IAAA,OAAO,EAAGW,OARX;AASC,IAAA,QAAQ,EAAGC;AATZ,IADD,EAYGM,aAAa,GACd,8BACC,cAAC,MAAD;AACC,IAAA,OAAO,EAAGgB,iBADX;AAEC,IAAA,SAAS,EAAC,oCAFX;AAGC,IAAA,QAAQ,EAAGL;AAHZ,KAKGG,cALH,CADD,EAQC,cAAC,MAAD;AACC,IAAA,OAAO,EAAGG,gBADX;AAEC,IAAA,SAAS,EAAC,0CAFX;AAGC,IAAA,QAAQ,EAAGN;AAHZ,KAKGG,cALH,CARD,CADc,GAiBX,IA7BL,CADD;AAiCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { CheckboxControl, Button, PanelRow } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useCallback } from '@wordpress/element';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport default function EntityRecordItem( {\n\trecord,\n\tchecked,\n\tonChange,\n\tclosePanel,\n} ) {\n\tconst { name, kind, title, key } = record;\n\tconst parentBlockId = useSelect( ( select ) => {\n\t\t// Get entity's blocks.\n\t\tconst { blocks = [] } = select( coreStore ).getEditedEntityRecord(\n\t\t\tkind,\n\t\t\tname,\n\t\t\tkey\n\t\t);\n\t\t// Get parents of the entity's first block.\n\t\tconst parents = select( blockEditorStore ).getBlockParents(\n\t\t\tblocks[ 0 ]?.clientId\n\t\t);\n\t\t// Return closest parent block's clientId.\n\t\treturn parents[ parents.length - 1 ];\n\t}, [] );\n\n\t// Handle templates that might use default descriptive titles.\n\tconst entityRecordTitle = useSelect(\n\t\t( select ) => {\n\t\t\tif ( 'postType' !== kind || 'wp_template' !== name ) {\n\t\t\t\treturn title;\n\t\t\t}\n\n\t\t\tconst template = select( coreStore ).getEditedEntityRecord(\n\t\t\t\tkind,\n\t\t\t\tname,\n\t\t\t\tkey\n\t\t\t);\n\t\t\treturn select( editorStore ).__experimentalGetTemplateInfo(\n\t\t\t\ttemplate\n\t\t\t).title;\n\t\t},\n\t\t[ name, kind, title, key ]\n\t);\n\n\tconst isSelected = useSelect(\n\t\t( select ) => {\n\t\t\tconst selectedBlockId =\n\t\t\t\tselect( blockEditorStore ).getSelectedBlockClientId();\n\t\t\treturn selectedBlockId === parentBlockId;\n\t\t},\n\t\t[ parentBlockId ]\n\t);\n\tconst isSelectedText = isSelected ? __( 'Selected' ) : __( 'Select' );\n\tconst { selectBlock } = useDispatch( blockEditorStore );\n\tconst selectParentBlock = useCallback(\n\t\t() => selectBlock( parentBlockId ),\n\t\t[ parentBlockId ]\n\t);\n\tconst selectAndDismiss = useCallback( () => {\n\t\tselectBlock( parentBlockId );\n\t\tclosePanel();\n\t}, [ parentBlockId ] );\n\n\treturn (\n\t\t<PanelRow>\n\t\t\t<CheckboxControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tlabel={\n\t\t\t\t\t<strong>\n\t\t\t\t\t\t{ decodeEntities( entityRecordTitle ) ||\n\t\t\t\t\t\t\t__( 'Untitled' ) }\n\t\t\t\t\t</strong>\n\t\t\t\t}\n\t\t\t\tchecked={ checked }\n\t\t\t\tonChange={ onChange }\n\t\t\t/>\n\t\t\t{ parentBlockId ? (\n\t\t\t\t<>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tonClick={ selectParentBlock }\n\t\t\t\t\t\tclassName=\"entities-saved-states__find-entity\"\n\t\t\t\t\t\tdisabled={ isSelected }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ isSelectedText }\n\t\t\t\t\t</Button>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tonClick={ selectAndDismiss }\n\t\t\t\t\t\tclassName=\"entities-saved-states__find-entity-small\"\n\t\t\t\t\t\tdisabled={ isSelected }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ isSelectedText }\n\t\t\t\t\t</Button>\n\t\t\t\t</>\n\t\t\t) : null }\n\t\t</PanelRow>\n\t);\n}\n"]}
@@ -27,13 +27,12 @@ function getEntityDescription(entity, count) {
27
27
  }
28
28
  }
29
29
 
30
- export default function EntityTypeList(_ref) {
31
- let {
32
- list,
33
- unselectedEntities,
34
- setUnselectedEntities,
35
- closePanel
36
- } = _ref;
30
+ export default function EntityTypeList({
31
+ list,
32
+ unselectedEntities,
33
+ setUnselectedEntities,
34
+ closePanel
35
+ }) {
37
36
  const count = list.length;
38
37
  const firstRecord = list[0];
39
38
  const entityConfig = useSelect(select => select(coreStore).getEntityConfig(firstRecord.kind, firstRecord.name), [firstRecord.kind, firstRecord.name]);
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/entities-saved-states/entity-type-list.js"],"names":["__","useSelect","PanelBody","PanelRow","store","coreStore","EntityRecordItem","getEntityDescription","entity","count","EntityTypeList","list","unselectedEntities","setUnselectedEntities","closePanel","length","firstRecord","entityConfig","select","getEntityConfig","kind","name","entityLabel","label","description","map","record","key","property","some","elt","value"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,SAAT,EAAoBC,QAApB,QAAoC,uBAApC;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,OAAOC,gBAAP,MAA6B,sBAA7B;;AAEA,SAASC,oBAAT,CAA+BC,MAA/B,EAAuCC,KAAvC,EAA+C;AAC9C,UAASD,MAAT;AACC,SAAK,MAAL;AACC,aAAO,MAAMC,KAAN,GACJT,EAAE,CAAE,0CAAF,CADE,GAEJA,EAAE,CAAE,4CAAF,CAFL;;AAGD,SAAK,aAAL;AACC,aAAOA,EAAE,CACR,iEADQ,CAAT;;AAGD,SAAK,MAAL;AACA,SAAK,MAAL;AACC,aAAOA,EAAE,CAAE,0CAAF,CAAT;AAXF;AAaA;;AAED,eAAe,SAASU,cAAT,OAKX;AAAA,MALoC;AACvCC,IAAAA,IADuC;AAEvCC,IAAAA,kBAFuC;AAGvCC,IAAAA,qBAHuC;AAIvCC,IAAAA;AAJuC,GAKpC;AACH,QAAML,KAAK,GAAGE,IAAI,CAACI,MAAnB;AACA,QAAMC,WAAW,GAAGL,IAAI,CAAE,CAAF,CAAxB;AACA,QAAMM,YAAY,GAAGhB,SAAS,CAC3BiB,MAAF,IACCA,MAAM,CAAEb,SAAF,CAAN,CAAoBc,eAApB,CACCH,WAAW,CAACI,IADb,EAECJ,WAAW,CAACK,IAFb,CAF4B,EAM7B,CAAEL,WAAW,CAACI,IAAd,EAAoBJ,WAAW,CAACK,IAAhC,CAN6B,CAA9B;AAQA,QAAM;AAAEA,IAAAA;AAAF,MAAWL,WAAjB;AAEA,MAAIM,WAAW,GAAGL,YAAY,CAACM,KAA/B;;AACA,MAAKF,IAAI,KAAK,kBAAd,EAAmC;AAClCC,IAAAA,WAAW,GACV,MAAMb,KAAN,GAAcT,EAAE,CAAE,eAAF,CAAhB,GAAsCA,EAAE,CAAE,gBAAF,CADzC;AAEA,GAjBE,CAkBH;;;AACA,QAAMwB,WAAW,GAAGjB,oBAAoB,CAAEc,IAAF,EAAQZ,KAAR,CAAxC;AAEA,SACC,cAAC,SAAD;AAAW,IAAA,KAAK,EAAGa,WAAnB;AAAiC,IAAA,WAAW,EAAG;AAA/C,KACGE,WAAW,IAAI,cAAC,QAAD,QAAYA,WAAZ,CADlB,EAEGb,IAAI,CAACc,GAAL,CAAYC,MAAF,IAAc;AACzB,WACC,cAAC,gBAAD;AACC,MAAA,GAAG,EAAGA,MAAM,CAACC,GAAP,IAAcD,MAAM,CAACE,QAD5B;AAEC,MAAA,MAAM,EAAGF,MAFV;AAGC,MAAA,OAAO,EACN,CAAEd,kBAAkB,CAACiB,IAAnB,CACCC,GAAF,IACCA,GAAG,CAACV,IAAJ,KAAaM,MAAM,CAACN,IAApB,IACAU,GAAG,CAACT,IAAJ,KAAaK,MAAM,CAACL,IADpB,IAEAS,GAAG,CAACH,GAAJ,KAAYD,MAAM,CAACC,GAFnB,IAGAG,GAAG,CAACF,QAAJ,KAAiBF,MAAM,CAACE,QALxB,CAJJ;AAYC,MAAA,QAAQ,EAAKG,KAAF,IACVlB,qBAAqB,CAAEa,MAAF,EAAUK,KAAV,CAbvB;AAeC,MAAA,UAAU,EAAGjB;AAfd,MADD;AAmBA,GApBC,CAFH,CADD;AA0BA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { PanelBody, PanelRow } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport EntityRecordItem from './entity-record-item';\n\nfunction getEntityDescription( entity, count ) {\n\tswitch ( entity ) {\n\t\tcase 'site':\n\t\t\treturn 1 === count\n\t\t\t\t? __( 'This change will affect your whole site.' )\n\t\t\t\t: __( 'These changes will affect your whole site.' );\n\t\tcase 'wp_template':\n\t\t\treturn __(\n\t\t\t\t'This change will affect pages and posts that use this template.'\n\t\t\t);\n\t\tcase 'page':\n\t\tcase 'post':\n\t\t\treturn __( 'The following content has been modified.' );\n\t}\n}\n\nexport default function EntityTypeList( {\n\tlist,\n\tunselectedEntities,\n\tsetUnselectedEntities,\n\tclosePanel,\n} ) {\n\tconst count = list.length;\n\tconst firstRecord = list[ 0 ];\n\tconst entityConfig = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getEntityConfig(\n\t\t\t\tfirstRecord.kind,\n\t\t\t\tfirstRecord.name\n\t\t\t),\n\t\t[ firstRecord.kind, firstRecord.name ]\n\t);\n\tconst { name } = firstRecord;\n\n\tlet entityLabel = entityConfig.label;\n\tif ( name === 'wp_template_part' ) {\n\t\tentityLabel =\n\t\t\t1 === count ? __( 'Template Part' ) : __( 'Template Parts' );\n\t}\n\t// Set description based on type of entity.\n\tconst description = getEntityDescription( name, count );\n\n\treturn (\n\t\t<PanelBody title={ entityLabel } initialOpen={ true }>\n\t\t\t{ description && <PanelRow>{ description }</PanelRow> }\n\t\t\t{ list.map( ( record ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<EntityRecordItem\n\t\t\t\t\t\tkey={ record.key || record.property }\n\t\t\t\t\t\trecord={ record }\n\t\t\t\t\t\tchecked={\n\t\t\t\t\t\t\t! unselectedEntities.some(\n\t\t\t\t\t\t\t\t( elt ) =>\n\t\t\t\t\t\t\t\t\telt.kind === record.kind &&\n\t\t\t\t\t\t\t\t\telt.name === record.name &&\n\t\t\t\t\t\t\t\t\telt.key === record.key &&\n\t\t\t\t\t\t\t\t\telt.property === record.property\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetUnselectedEntities( record, value )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tclosePanel={ closePanel }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</PanelBody>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/entities-saved-states/entity-type-list.js"],"names":["__","useSelect","PanelBody","PanelRow","store","coreStore","EntityRecordItem","getEntityDescription","entity","count","EntityTypeList","list","unselectedEntities","setUnselectedEntities","closePanel","length","firstRecord","entityConfig","select","getEntityConfig","kind","name","entityLabel","label","description","map","record","key","property","some","elt","value"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,SAAT,EAAoBC,QAApB,QAAoC,uBAApC;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,OAAOC,gBAAP,MAA6B,sBAA7B;;AAEA,SAASC,oBAAT,CAA+BC,MAA/B,EAAuCC,KAAvC,EAA+C;AAC9C,UAASD,MAAT;AACC,SAAK,MAAL;AACC,aAAO,MAAMC,KAAN,GACJT,EAAE,CAAE,0CAAF,CADE,GAEJA,EAAE,CAAE,4CAAF,CAFL;;AAGD,SAAK,aAAL;AACC,aAAOA,EAAE,CACR,iEADQ,CAAT;;AAGD,SAAK,MAAL;AACA,SAAK,MAAL;AACC,aAAOA,EAAE,CAAE,0CAAF,CAAT;AAXF;AAaA;;AAED,eAAe,SAASU,cAAT,CAAyB;AACvCC,EAAAA,IADuC;AAEvCC,EAAAA,kBAFuC;AAGvCC,EAAAA,qBAHuC;AAIvCC,EAAAA;AAJuC,CAAzB,EAKX;AACH,QAAML,KAAK,GAAGE,IAAI,CAACI,MAAnB;AACA,QAAMC,WAAW,GAAGL,IAAI,CAAE,CAAF,CAAxB;AACA,QAAMM,YAAY,GAAGhB,SAAS,CAC3BiB,MAAF,IACCA,MAAM,CAAEb,SAAF,C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* WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { PanelBody, PanelRow } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport EntityRecordItem from './entity-record-item';\n\nfunction getEntityDescription( entity, count ) {\n\tswitch ( entity ) {\n\t\tcase 'site':\n\t\t\treturn 1 === count\n\t\t\t\t? __( 'This change will affect your whole site.' )\n\t\t\t\t: __( 'These changes will affect your whole site.' );\n\t\tcase 'wp_template':\n\t\t\treturn __(\n\t\t\t\t'This change will affect pages and posts that use this template.'\n\t\t\t);\n\t\tcase 'page':\n\t\tcase 'post':\n\t\t\treturn __( 'The following content has been modified.' );\n\t}\n}\n\nexport default function EntityTypeList( {\n\tlist,\n\tunselectedEntities,\n\tsetUnselectedEntities,\n\tclosePanel,\n} ) {\n\tconst count = list.length;\n\tconst firstRecord = list[ 0 ];\n\tconst entityConfig = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getEntityConfig(\n\t\t\t\tfirstRecord.kind,\n\t\t\t\tfirstRecord.name\n\t\t\t),\n\t\t[ firstRecord.kind, firstRecord.name ]\n\t);\n\tconst { name } = firstRecord;\n\n\tlet entityLabel = entityConfig.label;\n\tif ( name === 'wp_template_part' ) {\n\t\tentityLabel =\n\t\t\t1 === count ? __( 'Template Part' ) : __( 'Template Parts' );\n\t}\n\t// Set description based on type of entity.\n\tconst description = getEntityDescription( name, count );\n\n\treturn (\n\t\t<PanelBody title={ entityLabel } initialOpen={ true }>\n\t\t\t{ description && <PanelRow>{ description }</PanelRow> }\n\t\t\t{ list.map( ( record ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<EntityRecordItem\n\t\t\t\t\t\tkey={ record.key || record.property }\n\t\t\t\t\t\trecord={ record }\n\t\t\t\t\t\tchecked={\n\t\t\t\t\t\t\t! unselectedEntities.some(\n\t\t\t\t\t\t\t\t( elt ) =>\n\t\t\t\t\t\t\t\t\telt.kind === record.kind &&\n\t\t\t\t\t\t\t\t\telt.name === record.name &&\n\t\t\t\t\t\t\t\t\telt.key === record.key &&\n\t\t\t\t\t\t\t\t\telt.property === record.property\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetUnselectedEntities( record, value )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tclosePanel={ closePanel }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</PanelBody>\n\t);\n}\n"]}
@@ -0,0 +1,70 @@
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
+ const TRANSLATED_SITE_PROPERTIES = {
9
+ title: __('Title'),
10
+ description: __('Tagline'),
11
+ site_logo: __('Logo'),
12
+ site_icon: __('Icon'),
13
+ show_on_front: __('Show on front'),
14
+ page_on_front: __('Page on front')
15
+ };
16
+ export const useIsDirty = () => {
17
+ const {
18
+ dirtyEntityRecords
19
+ } = useSelect(select => {
20
+ const dirtyRecords = select(coreStore).__experimentalGetDirtyEntityRecords(); // Remove site object and decouple into its edited pieces.
21
+
22
+
23
+ const dirtyRecordsWithoutSite = dirtyRecords.filter(record => !(record.kind === 'root' && record.name === 'site'));
24
+ const siteEdits = select(coreStore).getEntityRecordEdits('root', 'site');
25
+ const siteEditsAsEntities = [];
26
+
27
+ for (const property in siteEdits) {
28
+ siteEditsAsEntities.push({
29
+ kind: 'root',
30
+ name: 'site',
31
+ title: TRANSLATED_SITE_PROPERTIES[property] || property,
32
+ property
33
+ });
34
+ }
35
+
36
+ const dirtyRecordsWithSiteItems = [...dirtyRecordsWithoutSite, ...siteEditsAsEntities];
37
+ return {
38
+ dirtyEntityRecords: dirtyRecordsWithSiteItems
39
+ };
40
+ }, []); // Unchecked entities to be ignored by save function.
41
+
42
+ const [unselectedEntities, _setUnselectedEntities] = useState([]);
43
+
44
+ const setUnselectedEntities = ({
45
+ kind,
46
+ name,
47
+ key,
48
+ property
49
+ }, checked) => {
50
+ if (checked) {
51
+ _setUnselectedEntities(unselectedEntities.filter(elt => elt.kind !== kind || elt.name !== name || elt.key !== key || elt.property !== property));
52
+ } else {
53
+ _setUnselectedEntities([...unselectedEntities, {
54
+ kind,
55
+ name,
56
+ key,
57
+ property
58
+ }]);
59
+ }
60
+ };
61
+
62
+ const isDirty = dirtyEntityRecords.length - unselectedEntities.length > 0;
63
+ return {
64
+ dirtyEntityRecords,
65
+ isDirty,
66
+ setUnselectedEntities,
67
+ unselectedEntities
68
+ };
69
+ };
70
+ //# sourceMappingURL=use-is-dirty.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/editor/src/components/entities-saved-states/hooks/use-is-dirty.js"],"names":["useSelect","store","coreStore","useState","__","TRANSLATED_SITE_PROPERTIES","title","description","site_logo","site_icon","show_on_front","page_on_front","useIsDirty","dirtyEntityRecords","select","dirtyRecords","__experimentalGetDirtyEntityRecords","dirtyRecordsWithoutSite","filter","record","kind","name","siteEdits","getEntityRecordEdits","siteEditsAsEntities","property","push","dirtyRecordsWithSiteItems","unselectedEntities","_setUnselectedEntities","setUnselectedEntities","key","checked","elt","isDirty","length"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,iBAA1B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SAASC,QAAT,QAAyB,oBAAzB;AACA,SAASC,EAAT,QAAmB,iBAAnB;AAEA,MAAMC,0BAA0B,GAAG;AAClCC,EAAAA,KAAK,EAAEF,EAAE,CAAE,OAAF,CADyB;AAElCG,EAAAA,WAAW,EAAEH,EAAE,CAAE,SAAF,CAFmB;AAGlCI,EAAAA,SAAS,EAAEJ,EAAE,CAAE,MAAF,CAHqB;AAIlCK,EAAAA,SAAS,EAAEL,EAAE,CAAE,MAAF,CAJ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,GAAd;AAAmBN,IAAAA;AAAnB,GAD6B,EAE7BO,OAF6B,KAGzB;AACJ,QAAKA,OAAL,EAAe;AACdH,MAAAA,sBAAsB,CACrBD,kBAAkB,CAACV,MAAnB,CACGe,GAAF,IACCA,GAAG,CAACb,IAAJ,KAAaA,IAAb,IACAa,GAAG,CAACZ,IAAJ,KAAaA,IADb,IAEAY,GAAG,CAACF,GAAJ,KAAYA,GAFZ,IAGAE,GAAG,CAACR,QAAJ,KAAiBA,QALnB,CADqB,CAAtB;AASA,KAVD,MAUO;AACNI,MAAAA,sBAAsB,CAAE,CACvB,GAAGD,kBADoB,EAEvB;AAAER,QAAAA,IAAF;AAAQC,QAAAA,IAAR;AAAcU,QAAAA,GAAd;AAAmBN,QAAAA;AAAnB,OAFuB,CAAF,CAAtB;AAIA;AACD,GApBD;;AAsBA,QAAMS,OAAO,GAAGrB,kBAAkB,CAACsB,MAAnB,GAA4BP,kBAAkB,CAACO,MAA/C,GAAwD,CAAxE;AAEA,SAAO;AACNtB,IAAAA,kBADM;AAENqB,IAAAA,OAFM;AAGNJ,IAAAA,qBAHM;AAINF,IAAAA;AAJM,GAAP;AAMA,CAnEM","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\nconst TRANSLATED_SITE_PROPERTIES = {\n\ttitle: __( 'Title' ),\n\tdescription: __( 'Tagline' ),\n\tsite_logo: __( 'Logo' ),\n\tsite_icon: __( 'Icon' ),\n\tshow_on_front: __( 'Show on front' ),\n\tpage_on_front: __( 'Page on front' ),\n};\n\nexport const useIsDirty = () => {\n\tconst { dirtyEntityRecords } = useSelect( ( select ) => {\n\t\tconst dirtyRecords =\n\t\t\tselect( coreStore ).__experimentalGetDirtyEntityRecords();\n\n\t\t// Remove site object and decouple into its edited pieces.\n\t\tconst dirtyRecordsWithoutSite = dirtyRecords.filter(\n\t\t\t( record ) => ! ( record.kind === 'root' && record.name === 'site' )\n\t\t);\n\n\t\tconst siteEdits = select( coreStore ).getEntityRecordEdits(\n\t\t\t'root',\n\t\t\t'site'\n\t\t);\n\n\t\tconst siteEditsAsEntities = [];\n\t\tfor ( const property in siteEdits ) {\n\t\t\tsiteEditsAsEntities.push( {\n\t\t\t\tkind: 'root',\n\t\t\t\tname: 'site',\n\t\t\t\ttitle: TRANSLATED_SITE_PROPERTIES[ property ] || property,\n\t\t\t\tproperty,\n\t\t\t} );\n\t\t}\n\t\tconst dirtyRecordsWithSiteItems = [\n\t\t\t...dirtyRecordsWithoutSite,\n\t\t\t...siteEditsAsEntities,\n\t\t];\n\n\t\treturn {\n\t\t\tdirtyEntityRecords: dirtyRecordsWithSiteItems,\n\t\t};\n\t}, [] );\n\n\t// Unchecked entities to be ignored by save function.\n\tconst [ unselectedEntities, _setUnselectedEntities ] = useState( [] );\n\n\tconst setUnselectedEntities = (\n\t\t{ kind, name, key, property },\n\t\tchecked\n\t) => {\n\t\tif ( checked ) {\n\t\t\t_setUnselectedEntities(\n\t\t\t\tunselectedEntities.filter(\n\t\t\t\t\t( elt ) =>\n\t\t\t\t\t\telt.kind !== kind ||\n\t\t\t\t\t\telt.name !== name ||\n\t\t\t\t\t\telt.key !== key ||\n\t\t\t\t\t\telt.property !== property\n\t\t\t\t)\n\t\t\t);\n\t\t} else {\n\t\t\t_setUnselectedEntities( [\n\t\t\t\t...unselectedEntities,\n\t\t\t\t{ kind, name, key, property },\n\t\t\t] );\n\t\t}\n\t};\n\n\tconst isDirty = dirtyEntityRecords.length - unselectedEntities.length > 0;\n\n\treturn {\n\t\tdirtyEntityRecords,\n\t\tisDirty,\n\t\tsetUnselectedEntities,\n\t\tunselectedEntities,\n\t};\n};\n"]}
@@ -5,27 +5,19 @@ import { createElement } from "@wordpress/element";
5
5
  * WordPress dependencies
6
6
  */
7
7
  import { Button, Flex, FlexItem } from '@wordpress/components';
8
- import { __, sprintf } from '@wordpress/i18n';
9
- import { useSelect, useDispatch } from '@wordpress/data';
10
- import { useState, useCallback, useRef } from '@wordpress/element';
8
+ import { __ } from '@wordpress/i18n';
9
+ import { useDispatch } from '@wordpress/data';
10
+ import { useCallback, useRef } from '@wordpress/element';
11
11
  import { store as coreStore } from '@wordpress/core-data';
12
12
  import { store as blockEditorStore } from '@wordpress/block-editor';
13
13
  import { __experimentalUseDialog as useDialog } from '@wordpress/compose';
14
14
  import { store as noticesStore } from '@wordpress/notices';
15
- import { getQueryArg } from '@wordpress/url';
16
15
  /**
17
16
  * Internal dependencies
18
17
  */
19
18
 
20
19
  import EntityTypeList from './entity-type-list';
21
- const TRANSLATED_SITE_PROPERTIES = {
22
- title: __('Title'),
23
- description: __('Tagline'),
24
- site_logo: __('Logo'),
25
- site_icon: __('Icon'),
26
- show_on_front: __('Show on front'),
27
- page_on_front: __('Page on front')
28
- };
20
+ import { useIsDirty } from './hooks/use-is-dirty';
29
21
  const PUBLISH_ON_SAVE_ENTITIES = [{
30
22
  kind: 'postType',
31
23
  name: 'wp_navigation'
@@ -35,56 +27,26 @@ function identity(values) {
35
27
  return values;
36
28
  }
37
29
 
38
- function isPreviewingTheme() {
39
- var _window;
40
-
41
- return ((_window = window) === null || _window === void 0 ? void 0 : _window.__experimentalEnableThemePreviews) && getQueryArg(window.location.href, 'theme_preview') !== undefined;
42
- }
43
-
44
- function currentlyPreviewingTheme() {
45
- if (isPreviewingTheme()) {
46
- return getQueryArg(window.location.href, 'theme_preview');
47
- }
48
-
49
- return null;
30
+ export default function EntitiesSavedStates({
31
+ close
32
+ }) {
33
+ const isDirtyProps = useIsDirty();
34
+ return createElement(EntitiesSavedStatesExtensible, _extends({
35
+ close: close
36
+ }, isDirtyProps));
50
37
  }
51
-
52
- export default function EntitiesSavedStates(_ref) {
53
- var _theme$name;
54
-
55
- let {
56
- close,
57
- onSave = identity
58
- } = _ref;
38
+ export function EntitiesSavedStatesExtensible({
39
+ additionalPrompt = undefined,
40
+ close,
41
+ onSave = identity,
42
+ saveEnabled: saveEnabledProp = undefined,
43
+ saveLabel = __('Save'),
44
+ dirtyEntityRecords,
45
+ isDirty,
46
+ setUnselectedEntities,
47
+ unselectedEntities
48
+ }) {
59
49
  const saveButtonRef = useRef();
60
- const {
61
- getTheme
62
- } = useSelect(coreStore);
63
- const theme = getTheme(currentlyPreviewingTheme());
64
- const {
65
- dirtyEntityRecords
66
- } = useSelect(select => {
67
- const dirtyRecords = select(coreStore).__experimentalGetDirtyEntityRecords(); // Remove site object and decouple into its edited pieces.
68
-
69
-
70
- const dirtyRecordsWithoutSite = dirtyRecords.filter(record => !(record.kind === 'root' && record.name === 'site'));
71
- const siteEdits = select(coreStore).getEntityRecordEdits('root', 'site');
72
- const siteEditsAsEntities = [];
73
-
74
- for (const property in siteEdits) {
75
- siteEditsAsEntities.push({
76
- kind: 'root',
77
- name: 'site',
78
- title: TRANSLATED_SITE_PROPERTIES[property] || property,
79
- property
80
- });
81
- }
82
-
83
- const dirtyRecordsWithSiteItems = [...dirtyRecordsWithoutSite, ...siteEditsAsEntities];
84
- return {
85
- dirtyEntityRecords: dirtyRecordsWithSiteItems
86
- };
87
- }, []);
88
50
  const {
89
51
  editEntityRecord,
90
52
  saveEditedEntityRecord,
@@ -118,53 +80,29 @@ export default function EntitiesSavedStates(_ref) {
118
80
  wp_template_part: templatePartSavables,
119
81
  ...contentSavables
120
82
  } = partitionedSavables;
121
- const sortedPartitionedSavables = [siteSavables, templateSavables, templatePartSavables, ...Object.values(contentSavables)].filter(Array.isArray); // Unchecked entities to be ignored by save function.
122
-
123
- const [unselectedEntities, _setUnselectedEntities] = useState([]);
83
+ const sortedPartitionedSavables = [siteSavables, templateSavables, templatePartSavables, ...Object.values(contentSavables)].filter(Array.isArray);
84
+ const saveEnabled = saveEnabledProp !== null && saveEnabledProp !== void 0 ? saveEnabledProp : isDirty;
124
85
 
125
- const setUnselectedEntities = (_ref2, checked) => {
126
- let {
86
+ const saveCheckedEntities = () => {
87
+ const saveNoticeId = 'site-editor-save-success';
88
+ removeNotice(saveNoticeId);
89
+ const entitiesToSave = dirtyEntityRecords.filter(({
127
90
  kind,
128
91
  name,
129
92
  key,
130
93
  property
131
- } = _ref2;
132
-
133
- if (checked) {
134
- _setUnselectedEntities(unselectedEntities.filter(elt => elt.kind !== kind || elt.name !== name || elt.key !== key || elt.property !== property));
135
- } else {
136
- _setUnselectedEntities([...unselectedEntities, {
137
- kind,
138
- name,
139
- key,
140
- property
141
- }]);
142
- }
143
- };
144
-
145
- const saveCheckedEntitiesAndActivate = () => {
146
- const saveNoticeId = 'site-editor-save-success';
147
- removeNotice(saveNoticeId);
148
- const entitiesToSave = dirtyEntityRecords.filter(_ref3 => {
149
- let {
150
- kind,
151
- name,
152
- key,
153
- property
154
- } = _ref3;
94
+ }) => {
155
95
  return !unselectedEntities.some(elt => elt.kind === kind && elt.name === name && elt.key === key && elt.property === property);
156
96
  });
157
97
  close(entitiesToSave);
158
98
  const siteItemsToSave = [];
159
99
  const pendingSavedRecords = [];
160
- entitiesToSave.forEach(_ref4 => {
161
- let {
162
- kind,
163
- name,
164
- key,
165
- property
166
- } = _ref4;
167
-
100
+ entitiesToSave.forEach(({
101
+ kind,
102
+ name,
103
+ key,
104
+ property
105
+ }) => {
168
106
  if ('root' === kind && 'site' === name) {
169
107
  siteItemsToSave.push(property);
170
108
  } else {
@@ -204,18 +142,6 @@ export default function EntitiesSavedStates(_ref) {
204
142
  const [saveDialogRef, saveDialogProps] = useDialog({
205
143
  onClose: () => dismissPanel()
206
144
  });
207
- const isDirty = dirtyEntityRecords.length - unselectedEntities.length > 0;
208
- const activateSaveEnabled = isPreviewingTheme() || isDirty;
209
- let activateSaveLabel;
210
-
211
- if (isPreviewingTheme() && isDirty) {
212
- activateSaveLabel = __('Activate & Save');
213
- } else if (isPreviewingTheme()) {
214
- activateSaveLabel = __('Activate');
215
- } else {
216
- activateSaveLabel = __('Save');
217
- }
218
-
219
145
  return createElement("div", _extends({
220
146
  ref: saveDialogRef
221
147
  }, saveDialogProps, {
@@ -228,17 +154,17 @@ export default function EntitiesSavedStates(_ref) {
228
154
  as: Button,
229
155
  ref: saveButtonRef,
230
156
  variant: "primary",
231
- disabled: !activateSaveEnabled,
232
- onClick: saveCheckedEntitiesAndActivate,
157
+ disabled: !saveEnabled,
158
+ onClick: saveCheckedEntities,
233
159
  className: "editor-entities-saved-states__save-button"
234
- }, activateSaveLabel), createElement(FlexItem, {
160
+ }, saveLabel), createElement(FlexItem, {
235
161
  isBlock: true,
236
162
  as: Button,
237
163
  variant: "secondary",
238
164
  onClick: dismissPanel
239
165
  }, __('Cancel'))), createElement("div", {
240
166
  className: "entities-saved-states__text-prompt"
241
- }, createElement("strong", null, __('Are you ready to save?')), isPreviewingTheme() && createElement("p", null, sprintf('Saving your changes will change your active theme to %1$s.', theme === null || theme === void 0 ? void 0 : (_theme$name = theme.name) === null || _theme$name === void 0 ? void 0 : _theme$name.rendered)), isDirty && createElement("p", null, __('The following changes have been made to your site, templates, and content.'))), sortedPartitionedSavables.map(list => {
167
+ }, createElement("strong", null, __('Are you ready to save?')), additionalPrompt, isDirty && createElement("p", null, __('The following changes have been made to your site, templates, and content.'))), sortedPartitionedSavables.map(list => {
242
168
  return createElement(EntityTypeList, {
243
169
  key: list[0].name,
244
170
  list: list,