@wordpress/editor 14.9.0 → 14.10.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 (338) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/bindings/api.js +0 -29
  3. package/build/bindings/api.js.map +1 -1
  4. package/build/components/autocompleters/user.js.map +1 -1
  5. package/build/components/block-manager/index.js +2 -2
  6. package/build/components/block-manager/index.js.map +1 -1
  7. package/build/components/commands/index.js.map +1 -1
  8. package/build/components/create-template-part-modal/index.js.map +1 -1
  9. package/build/components/create-template-part-modal/utils.js.map +1 -1
  10. package/build/components/document-outline/index.js.map +1 -1
  11. package/build/components/document-outline/item.js.map +1 -1
  12. package/build/components/document-tools/index.js +1 -1
  13. package/build/components/document-tools/index.js.map +1 -1
  14. package/build/components/editor-interface/index.js +1 -12
  15. package/build/components/editor-interface/index.js.map +1 -1
  16. package/build/components/entities-saved-states/index.js +1 -1
  17. package/build/components/entities-saved-states/index.js.map +1 -1
  18. package/build/components/media-categories/index.js.map +1 -1
  19. package/build/components/page-attributes/parent.js +1 -1
  20. package/build/components/page-attributes/parent.js.map +1 -1
  21. package/build/components/plugin-document-setting-panel/index.js.map +1 -1
  22. package/build/components/post-actions/index.js.map +1 -1
  23. package/build/components/post-content-information/index.js +1 -1
  24. package/build/components/post-content-information/index.js.map +1 -1
  25. package/build/components/post-featured-image/index.js.map +1 -1
  26. package/build/components/post-format/index.js +1 -1
  27. package/build/components/post-format/index.js.map +1 -1
  28. package/build/components/post-last-revision/index.js +1 -1
  29. package/build/components/post-last-revision/index.js.map +1 -1
  30. package/build/components/post-locked-modal/index.js +2 -2
  31. package/build/components/post-locked-modal/index.js.map +1 -1
  32. package/build/components/post-preview-button/index.js +1 -1
  33. package/build/components/post-preview-button/index.js.map +1 -1
  34. package/build/components/post-publish-button/index.js.map +1 -1
  35. package/build/components/post-publish-panel/maybe-post-format-panel.js +1 -1
  36. package/build/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
  37. package/build/components/post-publish-panel/maybe-upload-media.js +1 -0
  38. package/build/components/post-publish-panel/maybe-upload-media.js.map +1 -1
  39. package/build/components/post-publish-panel/media-util.js +1 -0
  40. package/build/components/post-publish-panel/media-util.js.map +1 -1
  41. package/build/components/post-publish-panel/postpublish.js +1 -1
  42. package/build/components/post-publish-panel/postpublish.js.map +1 -1
  43. package/build/components/post-schedule/label.js.map +1 -1
  44. package/build/components/post-taxonomies/flat-term-selector.js +4 -4
  45. package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
  46. package/build/components/post-taxonomies/hierarchical-term-selector.js +3 -2
  47. package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
  48. package/build/components/post-taxonomies/index.js +1 -1
  49. package/build/components/post-taxonomies/index.js.map +1 -1
  50. package/build/components/post-taxonomies/panel.js.map +1 -1
  51. package/build/components/post-template/classic-theme.js +2 -4
  52. package/build/components/post-template/classic-theme.js.map +1 -1
  53. package/build/components/post-text-editor/index.js.map +1 -1
  54. package/build/components/post-title/index.js +15 -19
  55. package/build/components/post-title/index.js.map +1 -1
  56. package/build/components/post-title/index.native.js +2 -2
  57. package/build/components/post-title/index.native.js.map +1 -1
  58. package/build/components/post-url/index.js +76 -63
  59. package/build/components/post-url/index.js.map +1 -1
  60. package/build/components/post-url/panel.js +46 -26
  61. package/build/components/post-url/panel.js.map +1 -1
  62. package/build/components/post-visibility/index.js.map +1 -1
  63. package/build/components/preferences-modal/index.js.map +1 -1
  64. package/build/components/preview-dropdown/index.js.map +1 -1
  65. package/build/components/provider/index.js +1 -1
  66. package/build/components/provider/index.js.map +1 -1
  67. package/build/components/resizable-editor/resize-handle.js.map +1 -1
  68. package/build/components/time-to-read/index.js +1 -1
  69. package/build/components/time-to-read/index.js.map +1 -1
  70. package/build/components/visual-editor/edit-template-blocks-notification.js +4 -1
  71. package/build/components/visual-editor/edit-template-blocks-notification.js.map +1 -1
  72. package/build/components/visual-editor/index.js +4 -3
  73. package/build/components/visual-editor/index.js.map +1 -1
  74. package/build/components/visual-editor/use-select-nearest-editable-block.js.map +1 -1
  75. package/build/dataviews/actions/duplicate-template-part.js +1 -1
  76. package/build/dataviews/actions/duplicate-template-part.js.map +1 -1
  77. package/build/private-apis.js +0 -1
  78. package/build/private-apis.js.map +1 -1
  79. package/build/store/actions.js +26 -1
  80. package/build/store/actions.js.map +1 -1
  81. package/build/store/constants.js +1 -0
  82. package/build/store/constants.js.map +1 -1
  83. package/build/store/local-autosave.js.map +1 -1
  84. package/build/store/private-actions.js +7 -6
  85. package/build/store/private-actions.js.map +1 -1
  86. package/build/store/selectors.js +21 -0
  87. package/build/store/selectors.js.map +1 -1
  88. package/build/utils/media-upload/index.js.map +1 -1
  89. package/build-module/bindings/api.js +1 -29
  90. package/build-module/bindings/api.js.map +1 -1
  91. package/build-module/components/autocompleters/user.js +1 -3
  92. package/build-module/components/autocompleters/user.js.map +1 -1
  93. package/build-module/components/block-manager/category.js +1 -2
  94. package/build-module/components/block-manager/category.js.map +1 -1
  95. package/build-module/components/block-manager/checklist.js +1 -2
  96. package/build-module/components/block-manager/checklist.js.map +1 -1
  97. package/build-module/components/block-manager/index.js +3 -4
  98. package/build-module/components/block-manager/index.js.map +1 -1
  99. package/build-module/components/block-settings-menu/content-only-settings-menu.js +1 -3
  100. package/build-module/components/block-settings-menu/content-only-settings-menu.js.map +1 -1
  101. package/build-module/components/blog-title/index.js +1 -3
  102. package/build-module/components/blog-title/index.js.map +1 -1
  103. package/build-module/components/collapsible-block-toolbar/index.js +1 -3
  104. package/build-module/components/collapsible-block-toolbar/index.js.map +1 -1
  105. package/build-module/components/commands/index.js.map +1 -1
  106. package/build-module/components/create-template-part-modal/index.js +1 -2
  107. package/build-module/components/create-template-part-modal/index.js.map +1 -1
  108. package/build-module/components/create-template-part-modal/utils.js.map +1 -1
  109. package/build-module/components/document-bar/index.js +1 -2
  110. package/build-module/components/document-bar/index.js.map +1 -1
  111. package/build-module/components/document-outline/index.js +1 -2
  112. package/build-module/components/document-outline/index.js.map +1 -1
  113. package/build-module/components/document-outline/item.js +1 -2
  114. package/build-module/components/document-outline/item.js.map +1 -1
  115. package/build-module/components/document-tools/index.js +2 -4
  116. package/build-module/components/document-tools/index.js.map +1 -1
  117. package/build-module/components/editor/index.js +1 -3
  118. package/build-module/components/editor/index.js.map +1 -1
  119. package/build-module/components/editor-help/add-blocks.native.js +1 -3
  120. package/build-module/components/editor-help/add-blocks.native.js.map +1 -1
  121. package/build-module/components/editor-help/customize-blocks.native.js +1 -3
  122. package/build-module/components/editor-help/customize-blocks.native.js.map +1 -1
  123. package/build-module/components/editor-help/help-detail-navigation-screen.native.js +1 -2
  124. package/build-module/components/editor-help/help-detail-navigation-screen.native.js.map +1 -1
  125. package/build-module/components/editor-help/index.native.js +1 -3
  126. package/build-module/components/editor-help/index.native.js.map +1 -1
  127. package/build-module/components/editor-help/intro-to-blocks.native.js +1 -3
  128. package/build-module/components/editor-help/intro-to-blocks.native.js.map +1 -1
  129. package/build-module/components/editor-help/move-blocks.native.js +1 -3
  130. package/build-module/components/editor-help/move-blocks.native.js.map +1 -1
  131. package/build-module/components/editor-help/remove-blocks.native.js +1 -3
  132. package/build-module/components/editor-help/remove-blocks.native.js.map +1 -1
  133. package/build-module/components/editor-help/view-sections.native.js +1 -2
  134. package/build-module/components/editor-help/view-sections.native.js.map +1 -1
  135. package/build-module/components/editor-interface/index.js +2 -15
  136. package/build-module/components/editor-interface/index.js.map +1 -1
  137. package/build-module/components/editor-notices/index.js +1 -3
  138. package/build-module/components/editor-notices/index.js.map +1 -1
  139. package/build-module/components/entities-saved-states/entity-record-item.js +1 -3
  140. package/build-module/components/entities-saved-states/entity-record-item.js.map +1 -1
  141. package/build-module/components/entities-saved-states/entity-type-list.js +1 -2
  142. package/build-module/components/entities-saved-states/entity-type-list.js.map +1 -1
  143. package/build-module/components/entities-saved-states/index.js +2 -3
  144. package/build-module/components/entities-saved-states/index.js.map +1 -1
  145. package/build-module/components/error-boundary/index.native.js +1 -2
  146. package/build-module/components/error-boundary/index.native.js.map +1 -1
  147. package/build-module/components/header/index.js +1 -2
  148. package/build-module/components/header/index.js.map +1 -1
  149. package/build-module/components/keyboard-shortcut-help-modal/index.js +1 -2
  150. package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  151. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +1 -3
  152. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
  153. package/build-module/components/list-view-sidebar/list-view-outline.js +1 -3
  154. package/build-module/components/list-view-sidebar/list-view-outline.js.map +1 -1
  155. package/build-module/components/media-categories/index.js.map +1 -1
  156. package/build-module/components/more-menu/index.js +1 -3
  157. package/build-module/components/more-menu/index.js.map +1 -1
  158. package/build-module/components/offline-status/index.native.js +1 -2
  159. package/build-module/components/offline-status/index.native.js.map +1 -1
  160. package/build-module/components/page-attributes/parent.js +2 -3
  161. package/build-module/components/page-attributes/parent.js.map +1 -1
  162. package/build-module/components/plugin-document-setting-panel/index.js +1 -3
  163. package/build-module/components/plugin-document-setting-panel/index.js.map +1 -1
  164. package/build-module/components/post-actions/index.js +1 -3
  165. package/build-module/components/post-actions/index.js.map +1 -1
  166. package/build-module/components/post-author/panel.js +1 -2
  167. package/build-module/components/post-author/panel.js.map +1 -1
  168. package/build-module/components/post-card-panel/index.js +1 -2
  169. package/build-module/components/post-card-panel/index.js.map +1 -1
  170. package/build-module/components/post-content-information/index.js +1 -1
  171. package/build-module/components/post-content-information/index.js.map +1 -1
  172. package/build-module/components/post-discussion/panel.js +1 -2
  173. package/build-module/components/post-discussion/panel.js.map +1 -1
  174. package/build-module/components/post-excerpt/panel.js +1 -3
  175. package/build-module/components/post-excerpt/panel.js.map +1 -1
  176. package/build-module/components/post-featured-image/index.js +1 -2
  177. package/build-module/components/post-featured-image/index.js.map +1 -1
  178. package/build-module/components/post-format/index.js +2 -3
  179. package/build-module/components/post-format/index.js.map +1 -1
  180. package/build-module/components/post-format/panel.js +1 -2
  181. package/build-module/components/post-format/panel.js.map +1 -1
  182. package/build-module/components/post-last-revision/index.js +1 -1
  183. package/build-module/components/post-last-revision/index.js.map +1 -1
  184. package/build-module/components/post-locked-modal/index.js +3 -5
  185. package/build-module/components/post-locked-modal/index.js.map +1 -1
  186. package/build-module/components/post-panel-row/index.js +1 -2
  187. package/build-module/components/post-panel-row/index.js.map +1 -1
  188. package/build-module/components/post-preview-button/index.js +2 -4
  189. package/build-module/components/post-preview-button/index.js.map +1 -1
  190. package/build-module/components/post-publish-button/index.js +1 -2
  191. package/build-module/components/post-publish-button/index.js.map +1 -1
  192. package/build-module/components/post-publish-panel/index.js +1 -3
  193. package/build-module/components/post-publish-panel/index.js.map +1 -1
  194. package/build-module/components/post-publish-panel/maybe-category-panel.js +1 -2
  195. package/build-module/components/post-publish-panel/maybe-category-panel.js.map +1 -1
  196. package/build-module/components/post-publish-panel/maybe-post-format-panel.js +2 -3
  197. package/build-module/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
  198. package/build-module/components/post-publish-panel/maybe-tags-panel.js +1 -2
  199. package/build-module/components/post-publish-panel/maybe-tags-panel.js.map +1 -1
  200. package/build-module/components/post-publish-panel/maybe-upload-media.js +2 -2
  201. package/build-module/components/post-publish-panel/maybe-upload-media.js.map +1 -1
  202. package/build-module/components/post-publish-panel/media-util.js +1 -0
  203. package/build-module/components/post-publish-panel/media-util.js.map +1 -1
  204. package/build-module/components/post-publish-panel/postpublish.js +2 -4
  205. package/build-module/components/post-publish-panel/postpublish.js.map +1 -1
  206. package/build-module/components/post-publish-panel/prepublish.js +1 -3
  207. package/build-module/components/post-publish-panel/prepublish.js.map +1 -1
  208. package/build-module/components/post-saved-state/index.js +1 -2
  209. package/build-module/components/post-saved-state/index.js.map +1 -1
  210. package/build-module/components/post-schedule/label.js.map +1 -1
  211. package/build-module/components/post-status/index.js +1 -3
  212. package/build-module/components/post-status/index.js.map +1 -1
  213. package/build-module/components/post-switch-to-draft-button/index.js +1 -3
  214. package/build-module/components/post-switch-to-draft-button/index.js.map +1 -1
  215. package/build-module/components/post-taxonomies/flat-term-selector.js +5 -7
  216. package/build-module/components/post-taxonomies/flat-term-selector.js.map +1 -1
  217. package/build-module/components/post-taxonomies/hierarchical-term-selector.js +4 -4
  218. package/build-module/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
  219. package/build-module/components/post-taxonomies/index.js +1 -1
  220. package/build-module/components/post-taxonomies/index.js.map +1 -1
  221. package/build-module/components/post-taxonomies/most-used-terms.js +1 -2
  222. package/build-module/components/post-taxonomies/most-used-terms.js.map +1 -1
  223. package/build-module/components/post-taxonomies/panel.js.map +1 -1
  224. package/build-module/components/post-template/block-theme.js +1 -3
  225. package/build-module/components/post-template/block-theme.js.map +1 -1
  226. package/build-module/components/post-template/classic-theme.js +3 -6
  227. package/build-module/components/post-template/classic-theme.js.map +1 -1
  228. package/build-module/components/post-template/create-new-template-modal.js +1 -2
  229. package/build-module/components/post-template/create-new-template-modal.js.map +1 -1
  230. package/build-module/components/post-template/create-new-template.js +1 -3
  231. package/build-module/components/post-template/create-new-template.js.map +1 -1
  232. package/build-module/components/post-template/swap-template-button.js +1 -3
  233. package/build-module/components/post-template/swap-template-button.js.map +1 -1
  234. package/build-module/components/post-text-editor/index.js +1 -3
  235. package/build-module/components/post-text-editor/index.js.map +1 -1
  236. package/build-module/components/post-title/index.js +15 -19
  237. package/build-module/components/post-title/index.js.map +1 -1
  238. package/build-module/components/post-title/index.native.js +2 -2
  239. package/build-module/components/post-title/index.native.js.map +1 -1
  240. package/build-module/components/post-trash/index.js +1 -2
  241. package/build-module/components/post-trash/index.js.map +1 -1
  242. package/build-module/components/post-url/index.js +78 -66
  243. package/build-module/components/post-url/index.js.map +1 -1
  244. package/build-module/components/post-url/panel.js +48 -28
  245. package/build-module/components/post-url/panel.js.map +1 -1
  246. package/build-module/components/post-visibility/index.js +1 -2
  247. package/build-module/components/post-visibility/index.js.map +1 -1
  248. package/build-module/components/posts-per-page/index.js +1 -3
  249. package/build-module/components/posts-per-page/index.js.map +1 -1
  250. package/build-module/components/preferences-modal/index.js +1 -3
  251. package/build-module/components/preferences-modal/index.js.map +1 -1
  252. package/build-module/components/preview-dropdown/index.js +1 -3
  253. package/build-module/components/preview-dropdown/index.js.map +1 -1
  254. package/build-module/components/provider/index.js +2 -4
  255. package/build-module/components/provider/index.js.map +1 -1
  256. package/build-module/components/provider/index.native.js +1 -3
  257. package/build-module/components/provider/index.native.js.map +1 -1
  258. package/build-module/components/resizable-editor/resize-handle.js +1 -3
  259. package/build-module/components/resizable-editor/resize-handle.js.map +1 -1
  260. package/build-module/components/save-publish-panels/index.js +1 -3
  261. package/build-module/components/save-publish-panels/index.js.map +1 -1
  262. package/build-module/components/sidebar/header.js +1 -2
  263. package/build-module/components/sidebar/header.js.map +1 -1
  264. package/build-module/components/sidebar/index.js +1 -2
  265. package/build-module/components/sidebar/index.js.map +1 -1
  266. package/build-module/components/sidebar/post-summary.js +1 -3
  267. package/build-module/components/sidebar/post-summary.js.map +1 -1
  268. package/build-module/components/site-discussion/index.js +1 -3
  269. package/build-module/components/site-discussion/index.js.map +1 -1
  270. package/build-module/components/start-template-options/index.js +1 -2
  271. package/build-module/components/start-template-options/index.js.map +1 -1
  272. package/build-module/components/table-of-contents/panel.js +1 -3
  273. package/build-module/components/table-of-contents/panel.js.map +1 -1
  274. package/build-module/components/template-part-menu-items/convert-to-template-part.js +1 -3
  275. package/build-module/components/template-part-menu-items/convert-to-template-part.js.map +1 -1
  276. package/build-module/components/template-validation-notice/index.js +1 -3
  277. package/build-module/components/template-validation-notice/index.js.map +1 -1
  278. package/build-module/components/text-editor/index.js +1 -2
  279. package/build-module/components/text-editor/index.js.map +1 -1
  280. package/build-module/components/time-to-read/index.js +1 -1
  281. package/build-module/components/time-to-read/index.js.map +1 -1
  282. package/build-module/components/visual-editor/edit-template-blocks-notification.js +4 -1
  283. package/build-module/components/visual-editor/edit-template-blocks-notification.js.map +1 -1
  284. package/build-module/components/visual-editor/index.js +5 -6
  285. package/build-module/components/visual-editor/index.js.map +1 -1
  286. package/build-module/components/visual-editor/use-select-nearest-editable-block.js.map +1 -1
  287. package/build-module/dataviews/actions/duplicate-template-part.js +1 -1
  288. package/build-module/dataviews/actions/duplicate-template-part.js.map +1 -1
  289. package/build-module/hooks/pattern-overrides.js +1 -3
  290. package/build-module/hooks/pattern-overrides.js.map +1 -1
  291. package/build-module/private-apis.js +1 -2
  292. package/build-module/private-apis.js.map +1 -1
  293. package/build-module/store/actions.js +26 -1
  294. package/build-module/store/actions.js.map +1 -1
  295. package/build-module/store/constants.js +1 -0
  296. package/build-module/store/constants.js.map +1 -1
  297. package/build-module/store/local-autosave.js.map +1 -1
  298. package/build-module/store/private-actions.js +7 -6
  299. package/build-module/store/private-actions.js.map +1 -1
  300. package/build-module/store/selectors.js +21 -0
  301. package/build-module/store/selectors.js.map +1 -1
  302. package/build-module/utils/media-upload/index.js.map +1 -1
  303. package/build-style/style-rtl.css +20 -5
  304. package/build-style/style.css +20 -5
  305. package/build-types/bindings/api.d.ts +0 -13
  306. package/build-types/bindings/api.d.ts.map +1 -1
  307. package/build-types/components/editor-interface/index.d.ts +1 -2
  308. package/build-types/components/editor-interface/index.d.ts.map +1 -1
  309. package/build-types/components/post-taxonomies/hierarchical-term-selector.d.ts.map +1 -1
  310. package/build-types/components/post-template/classic-theme.d.ts.map +1 -1
  311. package/build-types/components/post-url/index.d.ts.map +1 -1
  312. package/build-types/components/post-url/panel.d.ts.map +1 -1
  313. package/build-types/components/provider/index.d.ts.map +1 -1
  314. package/build-types/components/visual-editor/edit-template-blocks-notification.d.ts.map +1 -1
  315. package/build-types/components/visual-editor/index.d.ts.map +1 -1
  316. package/build-types/private-apis.d.ts.map +1 -1
  317. package/build-types/store/actions.d.ts +1 -4
  318. package/build-types/store/actions.d.ts.map +1 -1
  319. package/build-types/store/selectors.d.ts +21 -0
  320. package/build-types/store/selectors.d.ts.map +1 -1
  321. package/package.json +38 -38
  322. package/src/bindings/api.js +1 -32
  323. package/src/components/document-tools/index.js +1 -1
  324. package/src/components/editor-interface/index.js +0 -15
  325. package/src/components/header/style.scss +1 -0
  326. package/src/components/post-saved-state/test/__snapshots__/index.js.snap +1 -1
  327. package/src/components/post-taxonomies/hierarchical-term-selector.js +1 -0
  328. package/src/components/post-template/classic-theme.js +1 -2
  329. package/src/components/post-url/index.js +67 -55
  330. package/src/components/post-url/panel.js +57 -33
  331. package/src/components/post-url/style.scss +21 -3
  332. package/src/components/provider/index.js +1 -0
  333. package/src/components/visual-editor/edit-template-blocks-notification.js +5 -1
  334. package/src/components/visual-editor/index.js +3 -1
  335. package/src/private-apis.js +1 -5
  336. package/src/store/actions.js +28 -1
  337. package/src/store/selectors.js +21 -0
  338. package/tsconfig.tsbuildinfo +1 -1
@@ -1 +1 @@
1
- {"version":3,"names":["__","sprintf","Modal","Button","ExternalLink","__experimentalHStack","HStack","useSelect","useDispatch","addQueryArgs","useEffect","createInterpolateElement","addAction","removeAction","useInstanceId","store","coreStore","editorStore","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","PostLockedModal","instanceId","hookName","autosave","updatePostLock","isLocked","isTakeover","user","postId","postLockUtils","activePostLock","postType","previewLink","select","isPostLocked","isPostLockTakeover","getPostLockUser","getCurrentPostId","getActivePostLock","getEditedPostAttribute","getEditedPostPreviewLink","getEditorSettings","getPostType","sendPostLock","data","lock","post_id","receivePostLock","received","lock_error","name","avatar","avatar_src_2x","new_lock","releasePostLock","window","FormData","append","unlockNonce","navigator","sendBeacon","ajaxUrl","xhr","XMLHttpRequest","open","send","addEventListener","removeEventListener","userDisplayName","userAvatar","unlockUrl","lockKey","post","action","_wpnonce","nonce","allPostsUrl","post_type","slug","allPostsLabel","title","focusOnMount","shouldCloseOnClickOutside","shouldCloseOnEsc","isDismissible","className","size","children","alignment","spacing","src","alt","width","height","strong","PreviewLink","href","justify","__next40pxDefaultSize","variant"],"sources":["@wordpress/editor/src/components/post-locked-modal/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tModal,\n\tButton,\n\tExternalLink,\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { addQueryArgs } from '@wordpress/url';\nimport { useEffect, createInterpolateElement } from '@wordpress/element';\nimport { addAction, removeAction } from '@wordpress/hooks';\nimport { useInstanceId } from '@wordpress/compose';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\n/**\n * A modal component that is displayed when a post is locked for editing by another user.\n * The modal provides information about the lock status and options to take over or exit the editor.\n *\n * @return {JSX.Element|null} The rendered PostLockedModal component.\n */\nexport default function PostLockedModal() {\n\tconst instanceId = useInstanceId( PostLockedModal );\n\tconst hookName = 'core/editor/post-locked-modal-' + instanceId;\n\tconst { autosave, updatePostLock } = useDispatch( editorStore );\n\tconst {\n\t\tisLocked,\n\t\tisTakeover,\n\t\tuser,\n\t\tpostId,\n\t\tpostLockUtils,\n\t\tactivePostLock,\n\t\tpostType,\n\t\tpreviewLink,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tisPostLocked,\n\t\t\tisPostLockTakeover,\n\t\t\tgetPostLockUser,\n\t\t\tgetCurrentPostId,\n\t\t\tgetActivePostLock,\n\t\t\tgetEditedPostAttribute,\n\t\t\tgetEditedPostPreviewLink,\n\t\t\tgetEditorSettings,\n\t\t} = select( editorStore );\n\t\tconst { getPostType } = select( coreStore );\n\t\treturn {\n\t\t\tisLocked: isPostLocked(),\n\t\t\tisTakeover: isPostLockTakeover(),\n\t\t\tuser: getPostLockUser(),\n\t\t\tpostId: getCurrentPostId(),\n\t\t\tpostLockUtils: getEditorSettings().postLockUtils,\n\t\t\tactivePostLock: getActivePostLock(),\n\t\t\tpostType: getPostType( getEditedPostAttribute( 'type' ) ),\n\t\t\tpreviewLink: getEditedPostPreviewLink(),\n\t\t};\n\t}, [] );\n\n\tuseEffect( () => {\n\t\t/**\n\t\t * Keep the lock refreshed.\n\t\t *\n\t\t * When the user does not send a heartbeat in a heartbeat-tick\n\t\t * the user is no longer editing and another user can start editing.\n\t\t *\n\t\t * @param {Object} data Data to send in the heartbeat request.\n\t\t */\n\t\tfunction sendPostLock( data ) {\n\t\t\tif ( isLocked ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tdata[ 'wp-refresh-post-lock' ] = {\n\t\t\t\tlock: activePostLock,\n\t\t\t\tpost_id: postId,\n\t\t\t};\n\t\t}\n\n\t\t/**\n\t\t * Refresh post locks: update the lock string or show the dialog if somebody has taken over editing.\n\t\t *\n\t\t * @param {Object} data Data received in the heartbeat request\n\t\t */\n\t\tfunction receivePostLock( data ) {\n\t\t\tif ( ! data[ 'wp-refresh-post-lock' ] ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst received = data[ 'wp-refresh-post-lock' ];\n\t\t\tif ( received.lock_error ) {\n\t\t\t\t// Auto save and display the takeover modal.\n\t\t\t\tautosave();\n\t\t\t\tupdatePostLock( {\n\t\t\t\t\tisLocked: true,\n\t\t\t\t\tisTakeover: true,\n\t\t\t\t\tuser: {\n\t\t\t\t\t\tname: received.lock_error.name,\n\t\t\t\t\t\tavatar: received.lock_error.avatar_src_2x,\n\t\t\t\t\t},\n\t\t\t\t} );\n\t\t\t} else if ( received.new_lock ) {\n\t\t\t\tupdatePostLock( {\n\t\t\t\t\tisLocked: false,\n\t\t\t\t\tactivePostLock: received.new_lock,\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\n\t\t/**\n\t\t * Unlock the post before the window is exited.\n\t\t */\n\t\tfunction releasePostLock() {\n\t\t\tif ( isLocked || ! activePostLock ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst data = new window.FormData();\n\t\t\tdata.append( 'action', 'wp-remove-post-lock' );\n\t\t\tdata.append( '_wpnonce', postLockUtils.unlockNonce );\n\t\t\tdata.append( 'post_ID', postId );\n\t\t\tdata.append( 'active_post_lock', activePostLock );\n\n\t\t\tif ( window.navigator.sendBeacon ) {\n\t\t\t\twindow.navigator.sendBeacon( postLockUtils.ajaxUrl, data );\n\t\t\t} else {\n\t\t\t\tconst xhr = new window.XMLHttpRequest();\n\t\t\t\txhr.open( 'POST', postLockUtils.ajaxUrl, false );\n\t\t\t\txhr.send( data );\n\t\t\t}\n\t\t}\n\n\t\t// Details on these events on the Heartbeat API docs\n\t\t// https://developer.wordpress.org/plugins/javascript/heartbeat-api/\n\t\taddAction( 'heartbeat.send', hookName, sendPostLock );\n\t\taddAction( 'heartbeat.tick', hookName, receivePostLock );\n\t\twindow.addEventListener( 'beforeunload', releasePostLock );\n\n\t\treturn () => {\n\t\t\tremoveAction( 'heartbeat.send', hookName );\n\t\t\tremoveAction( 'heartbeat.tick', hookName );\n\t\t\twindow.removeEventListener( 'beforeunload', releasePostLock );\n\t\t};\n\t}, [] );\n\n\tif ( ! isLocked ) {\n\t\treturn null;\n\t}\n\n\tconst userDisplayName = user.name;\n\tconst userAvatar = user.avatar;\n\n\tconst unlockUrl = addQueryArgs( 'post.php', {\n\t\t'get-post-lock': '1',\n\t\tlockKey: true,\n\t\tpost: postId,\n\t\taction: 'edit',\n\t\t_wpnonce: postLockUtils.nonce,\n\t} );\n\tconst allPostsUrl = addQueryArgs( 'edit.php', {\n\t\tpost_type: postType?.slug,\n\t} );\n\tconst allPostsLabel = __( 'Exit editor' );\n\treturn (\n\t\t<Modal\n\t\t\ttitle={\n\t\t\t\tisTakeover\n\t\t\t\t\t? __( 'Someone else has taken over this post' )\n\t\t\t\t\t: __( 'This post is already being edited' )\n\t\t\t}\n\t\t\tfocusOnMount\n\t\t\tshouldCloseOnClickOutside={ false }\n\t\t\tshouldCloseOnEsc={ false }\n\t\t\tisDismissible={ false }\n\t\t\t// Do not remove this class, as this class is used by third party plugins.\n\t\t\tclassName=\"editor-post-locked-modal\"\n\t\t\tsize=\"medium\"\n\t\t>\n\t\t\t<HStack alignment=\"top\" spacing={ 6 }>\n\t\t\t\t{ !! userAvatar && (\n\t\t\t\t\t<img\n\t\t\t\t\t\tsrc={ userAvatar }\n\t\t\t\t\t\talt={ __( 'Avatar' ) }\n\t\t\t\t\t\tclassName=\"editor-post-locked-modal__avatar\"\n\t\t\t\t\t\twidth={ 64 }\n\t\t\t\t\t\theight={ 64 }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t<div>\n\t\t\t\t\t{ !! isTakeover && (\n\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\t\t\t\tuserDisplayName\n\t\t\t\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t\t\t\t/* translators: %s: user's display name */\n\t\t\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t\t\t'<strong>%s</strong> now has editing control of this post (<PreviewLink />). Don’t worry, your changes up to this moment have been saved.'\n\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\tuserDisplayName\n\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t\t\t'Another user now has editing control of this post (<PreviewLink />). Don’t worry, your changes up to this moment have been saved.'\n\t\t\t\t\t\t\t\t\t ),\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tstrong: <strong />,\n\t\t\t\t\t\t\t\t\tPreviewLink: (\n\t\t\t\t\t\t\t\t\t\t<ExternalLink href={ previewLink }>\n\t\t\t\t\t\t\t\t\t\t\t{ __( 'preview' ) }\n\t\t\t\t\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</p>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! isTakeover && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\t\t\t\t\tuserDisplayName\n\t\t\t\t\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t\t\t\t\t/* translators: %s: user's display name */\n\t\t\t\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'<strong>%s</strong> is currently working on this post (<PreviewLink />), which means you cannot make changes, unless you take over.'\n\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t\tuserDisplayName\n\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t\t\t\t'Another user is currently working on this post (<PreviewLink />), which means you cannot make changes, unless you take over.'\n\t\t\t\t\t\t\t\t\t\t ),\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tstrong: <strong />,\n\t\t\t\t\t\t\t\t\t\tPreviewLink: (\n\t\t\t\t\t\t\t\t\t\t\t<ExternalLink href={ previewLink }>\n\t\t\t\t\t\t\t\t\t\t\t\t{ __( 'preview' ) }\n\t\t\t\t\t\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t'If you take over, the other user will lose editing control to the post, but their changes will be saved.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\n\t\t\t\t\t<HStack\n\t\t\t\t\t\tclassName=\"editor-post-locked-modal__buttons\"\n\t\t\t\t\t\tjustify=\"flex-end\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ ! isTakeover && (\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\t\thref={ unlockUrl }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Take over' ) }\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\thref={ allPostsUrl }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ allPostsLabel }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</HStack>\n\t\t\t\t</div>\n\t\t\t</HStack>\n\t\t</Modal>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SACCC,KAAK,EACLC,MAAM,EACNC,YAAY,EACZC,oBAAoB,IAAIC,MAAM,QACxB,uBAAuB;AAC9B,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,SAAS,EAAEC,wBAAwB,QAAQ,oBAAoB;AACxE,SAASC,SAAS,EAAEC,YAAY,QAAQ,kBAAkB;AAC1D,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;;AAEzD;AACA;AACA;AACA,SAASD,KAAK,IAAIE,WAAW,QAAQ,aAAa;;AAElD;AACA;AACA;AACA;AACA;AACA;AALA,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,QAAA,IAAAC,SAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAMA,eAAe,SAASC,eAAeA,CAAA,EAAG;EACzC,MAAMC,UAAU,GAAGX,aAAa,CAAEU,eAAgB,CAAC;EACnD,MAAME,QAAQ,GAAG,gCAAgC,GAAGD,UAAU;EAC9D,MAAM;IAAEE,QAAQ;IAAEC;EAAe,CAAC,GAAGpB,WAAW,CAAES,WAAY,CAAC;EAC/D,MAAM;IACLY,QAAQ;IACRC,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UAAU;UAAAV,QAAA,GAEhB,CAAE7D,UAAU,iBACbX,IAAA,CAAChB,MAAM;YACNmG,qBAAqB;YACrBC,OAAO,EAAC,UAAU;YAClBH,IAAI,EAAG1B,SAAW;YAAAiB,QAAA,EAEhB3F,EAAE,CAAE,WAAY;UAAC,CACZ,CACR,eACDmB,IAAA,CAAChB,MAAM;YACNmG,qBAAqB;YACrBC,OAAO,EAAC,SAAS;YACjBH,IAAI,EAAGpB,WAAa;YAAAW,QAAA,EAElBR;UAAa,CACR,CAAC;QAAA,CACF,CAAC;MAAA,CACL,CAAC;IAAA,CACC;EAAC,CACH,CAAC;AAEV","ignoreList":[]}
1
+ {"version":3,"names":["__","sprintf","Modal","Button","ExternalLink","__experimentalHStack","HStack","useSelect","useDispatch","addQueryArgs","useEffect","createInterpolateElement","addAction","removeAction","useInstanceId","store","coreStore","editorStore","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","PostLockedModal","instanceId","hookName","autosave","updatePostLock","isLocked","isTakeover","user","postId","postLockUtils","activePostLock","postType","previewLink","select","isPostLocked","isPostLockTakeover","getPostLockUser","getCurrentPostId","getActivePostLock","getEditedPostAttribute","getEditedPostPreviewLink","getEditorSettings","getPostType","sendPostLock","data","lock","post_id","receivePostLock","received","lock_error","name","avatar","avatar_src_2x","new_lock","releasePostLock","window","FormData","append","unlockNonce","navigator","sendBeacon","ajaxUrl","xhr","XMLHttpRequest","open","send","addEventListener","removeEventListener","userDisplayName","userAvatar","unlockUrl","lockKey","post","action","_wpnonce","nonce","allPostsUrl","post_type","slug","allPostsLabel","title","focusOnMount","shouldCloseOnClickOutside","shouldCloseOnEsc","isDismissible","className","size","children","alignment","spacing","src","alt","width","height","strong","PreviewLink","href","justify","__next40pxDefaultSize","variant"],"sources":["@wordpress/editor/src/components/post-locked-modal/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tModal,\n\tButton,\n\tExternalLink,\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { addQueryArgs } from '@wordpress/url';\nimport { useEffect, createInterpolateElement } from '@wordpress/element';\nimport { addAction, removeAction } from '@wordpress/hooks';\nimport { useInstanceId } from '@wordpress/compose';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\n/**\n * A modal component that is displayed when a post is locked for editing by another user.\n * The modal provides information about the lock status and options to take over or exit the editor.\n *\n * @return {JSX.Element|null} The rendered PostLockedModal component.\n */\nexport default function PostLockedModal() {\n\tconst instanceId = useInstanceId( PostLockedModal );\n\tconst hookName = 'core/editor/post-locked-modal-' + instanceId;\n\tconst { autosave, updatePostLock } = useDispatch( editorStore );\n\tconst {\n\t\tisLocked,\n\t\tisTakeover,\n\t\tuser,\n\t\tpostId,\n\t\tpostLockUtils,\n\t\tactivePostLock,\n\t\tpostType,\n\t\tpreviewLink,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tisPostLocked,\n\t\t\tisPostLockTakeover,\n\t\t\tgetPostLockUser,\n\t\t\tgetCurrentPostId,\n\t\t\tgetActivePostLock,\n\t\t\tgetEditedPostAttribute,\n\t\t\tgetEditedPostPreviewLink,\n\t\t\tgetEditorSettings,\n\t\t} = select( editorStore );\n\t\tconst { getPostType } = select( coreStore );\n\t\treturn {\n\t\t\tisLocked: isPostLocked(),\n\t\t\tisTakeover: isPostLockTakeover(),\n\t\t\tuser: getPostLockUser(),\n\t\t\tpostId: getCurrentPostId(),\n\t\t\tpostLockUtils: getEditorSettings().postLockUtils,\n\t\t\tactivePostLock: getActivePostLock(),\n\t\t\tpostType: getPostType( getEditedPostAttribute( 'type' ) ),\n\t\t\tpreviewLink: getEditedPostPreviewLink(),\n\t\t};\n\t}, [] );\n\n\tuseEffect( () => {\n\t\t/**\n\t\t * Keep the lock refreshed.\n\t\t *\n\t\t * When the user does not send a heartbeat in a heartbeat-tick\n\t\t * the user is no longer editing and another user can start editing.\n\t\t *\n\t\t * @param {Object} data Data to send in the heartbeat request.\n\t\t */\n\t\tfunction sendPostLock( data ) {\n\t\t\tif ( isLocked ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tdata[ 'wp-refresh-post-lock' ] = {\n\t\t\t\tlock: activePostLock,\n\t\t\t\tpost_id: postId,\n\t\t\t};\n\t\t}\n\n\t\t/**\n\t\t * Refresh post locks: update the lock string or show the dialog if somebody has taken over editing.\n\t\t *\n\t\t * @param {Object} data Data received in the heartbeat request\n\t\t */\n\t\tfunction receivePostLock( data ) {\n\t\t\tif ( ! data[ 'wp-refresh-post-lock' ] ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst received = data[ 'wp-refresh-post-lock' ];\n\t\t\tif ( received.lock_error ) {\n\t\t\t\t// Auto save and display the takeover modal.\n\t\t\t\tautosave();\n\t\t\t\tupdatePostLock( {\n\t\t\t\t\tisLocked: true,\n\t\t\t\t\tisTakeover: true,\n\t\t\t\t\tuser: {\n\t\t\t\t\t\tname: received.lock_error.name,\n\t\t\t\t\t\tavatar: received.lock_error.avatar_src_2x,\n\t\t\t\t\t},\n\t\t\t\t} );\n\t\t\t} else if ( received.new_lock ) {\n\t\t\t\tupdatePostLock( {\n\t\t\t\t\tisLocked: false,\n\t\t\t\t\tactivePostLock: received.new_lock,\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\n\t\t/**\n\t\t * Unlock the post before the window is exited.\n\t\t */\n\t\tfunction releasePostLock() {\n\t\t\tif ( isLocked || ! activePostLock ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst data = new window.FormData();\n\t\t\tdata.append( 'action', 'wp-remove-post-lock' );\n\t\t\tdata.append( '_wpnonce', postLockUtils.unlockNonce );\n\t\t\tdata.append( 'post_ID', postId );\n\t\t\tdata.append( 'active_post_lock', activePostLock );\n\n\t\t\tif ( window.navigator.sendBeacon ) {\n\t\t\t\twindow.navigator.sendBeacon( postLockUtils.ajaxUrl, data );\n\t\t\t} else {\n\t\t\t\tconst xhr = new window.XMLHttpRequest();\n\t\t\t\txhr.open( 'POST', postLockUtils.ajaxUrl, false );\n\t\t\t\txhr.send( data );\n\t\t\t}\n\t\t}\n\n\t\t// Details on these events on the Heartbeat API docs\n\t\t// https://developer.wordpress.org/plugins/javascript/heartbeat-api/\n\t\taddAction( 'heartbeat.send', hookName, sendPostLock );\n\t\taddAction( 'heartbeat.tick', hookName, receivePostLock );\n\t\twindow.addEventListener( 'beforeunload', releasePostLock );\n\n\t\treturn () => {\n\t\t\tremoveAction( 'heartbeat.send', hookName );\n\t\t\tremoveAction( 'heartbeat.tick', hookName );\n\t\t\twindow.removeEventListener( 'beforeunload', releasePostLock );\n\t\t};\n\t}, [] );\n\n\tif ( ! isLocked ) {\n\t\treturn null;\n\t}\n\n\tconst userDisplayName = user.name;\n\tconst userAvatar = user.avatar;\n\n\tconst unlockUrl = addQueryArgs( 'post.php', {\n\t\t'get-post-lock': '1',\n\t\tlockKey: true,\n\t\tpost: postId,\n\t\taction: 'edit',\n\t\t_wpnonce: postLockUtils.nonce,\n\t} );\n\tconst allPostsUrl = addQueryArgs( 'edit.php', {\n\t\tpost_type: postType?.slug,\n\t} );\n\tconst allPostsLabel = __( 'Exit editor' );\n\treturn (\n\t\t<Modal\n\t\t\ttitle={\n\t\t\t\tisTakeover\n\t\t\t\t\t? __( 'Someone else has taken over this post' )\n\t\t\t\t\t: __( 'This post is already being edited' )\n\t\t\t}\n\t\t\tfocusOnMount\n\t\t\tshouldCloseOnClickOutside={ false }\n\t\t\tshouldCloseOnEsc={ false }\n\t\t\tisDismissible={ false }\n\t\t\t// Do not remove this class, as this class is used by third party plugins.\n\t\t\tclassName=\"editor-post-locked-modal\"\n\t\t\tsize=\"medium\"\n\t\t>\n\t\t\t<HStack alignment=\"top\" spacing={ 6 }>\n\t\t\t\t{ !! userAvatar && (\n\t\t\t\t\t<img\n\t\t\t\t\t\tsrc={ userAvatar }\n\t\t\t\t\t\talt={ __( 'Avatar' ) }\n\t\t\t\t\t\tclassName=\"editor-post-locked-modal__avatar\"\n\t\t\t\t\t\twidth={ 64 }\n\t\t\t\t\t\theight={ 64 }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t<div>\n\t\t\t\t\t{ !! isTakeover && (\n\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\t\t\t\tuserDisplayName\n\t\t\t\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t\t\t\t/* translators: %s: user's display name */\n\t\t\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t\t\t'<strong>%s</strong> now has editing control of this post (<PreviewLink />). Don’t worry, your changes up to this moment have been saved.'\n\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\tuserDisplayName\n\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t\t\t'Another user now has editing control of this post (<PreviewLink />). Don’t worry, your changes up to this moment have been saved.'\n\t\t\t\t\t\t\t\t\t ),\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tstrong: <strong />,\n\t\t\t\t\t\t\t\t\tPreviewLink: (\n\t\t\t\t\t\t\t\t\t\t<ExternalLink href={ previewLink }>\n\t\t\t\t\t\t\t\t\t\t\t{ __( 'preview' ) }\n\t\t\t\t\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</p>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! isTakeover && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\t\t\t\t\tuserDisplayName\n\t\t\t\t\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t\t\t\t\t/* translators: %s: user's display name */\n\t\t\t\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'<strong>%s</strong> is currently working on this post (<PreviewLink />), which means you cannot make changes, unless you take over.'\n\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t\tuserDisplayName\n\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t\t\t\t'Another user is currently working on this post (<PreviewLink />), which means you cannot make changes, unless you take over.'\n\t\t\t\t\t\t\t\t\t\t ),\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tstrong: <strong />,\n\t\t\t\t\t\t\t\t\t\tPreviewLink: (\n\t\t\t\t\t\t\t\t\t\t\t<ExternalLink href={ previewLink }>\n\t\t\t\t\t\t\t\t\t\t\t\t{ __( 'preview' ) }\n\t\t\t\t\t\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t'If you take over, the other user will lose editing control to the post, but their changes will be saved.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\n\t\t\t\t\t<HStack\n\t\t\t\t\t\tclassName=\"editor-post-locked-modal__buttons\"\n\t\t\t\t\t\tjustify=\"flex-end\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ ! isTakeover && (\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\t\thref={ unlockUrl }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Take over' ) }\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\thref={ allPostsUrl }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ allPostsLabel }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</HStack>\n\t\t\t\t</div>\n\t\t\t</HStack>\n\t\t</Modal>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SACCC,KAAK,EACLC,MAAM,EACNC,YAAY,EACZC,oBAAoB,IAAIC,MAAM,QACxB,uBAAuB;AAC9B,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,SAAS,EAAEC,wBAAwB,QAAQ,oBAAoB;AACxE,SAASC,SAAS,EAAEC,YAAY,QAAQ,kBAAkB;AAC1D,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;;AAEzD;AACA;AACA;AACA,SAASD,KAAK,IAAIE,WAAW,QAAQ,aAAa;;AAElD;AACA;AACA;AACA;AACA;AACA;AALA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA,EAAAC,IAAA,IAAAC,KAAA;AAMA,eAAe,SAASC,eAAeA,CAAA,EAAG;EACzC,MAAMC,UAAU,GAAGX,aAAa,CAAEU,eAAgB,CAAC;EACnD,MAAME,QAAQ,GAAG,gCAAgC,GAAGD,UAAU;EAC9D,MAAM;IAAEE,QAAQ;IAAEC;EAAe,CAAC,GAAGpB,WAAW,CAAES,WAAY,CAAC;EAC/D,MAAM;IACLY,QAAQ;IACRC,UAAU;IACVC,IAAI;IACJC,MAAM;IACNC,aAAa;IACbC,cAAc;IACdC,QAAQ;IACRC;EACD,CAAC,GAAG7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OAAO,EAAC,UAAU;YAClBH,IAAI,EAAG1B,SAAW;YAAAiB,QAAA,EAEhB3F,EAAE,CAAE,WAAY;UAAC,CACZ,CACR,eACDmB,IAAA,CAAChB,MAAM;YACNmG,qBAAqB;YACrBC,OAAO,EAAC,SAAS;YACjBH,IAAI,EAAGpB,WAAa;YAAAW,QAAA,EAElBR;UAAa,CACR,CAAC;QAAA,CACF,CAAC;MAAA,CACL,CAAC;IAAA,CACC;EAAC,CACH,CAAC;AAEV","ignoreList":[]}
@@ -8,8 +8,7 @@ import clsx from 'clsx';
8
8
  */
9
9
  import { __experimentalHStack as HStack } from '@wordpress/components';
10
10
  import { forwardRef } from '@wordpress/element';
11
- import { jsx as _jsx } from "react/jsx-runtime";
12
- import { jsxs as _jsxs } from "react/jsx-runtime";
11
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
12
  const PostPanelRow = forwardRef(({
14
13
  className,
15
14
  label,
@@ -1 +1 @@
1
- {"version":3,"names":["clsx","__experimentalHStack","HStack","forwardRef","jsx","_jsx","jsxs","_jsxs","PostPanelRow","className","label","children","ref"],"sources":["@wordpress/editor/src/components/post-panel-row/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __experimentalHStack as HStack } from '@wordpress/components';\nimport { forwardRef } from '@wordpress/element';\n\nconst PostPanelRow = forwardRef( ( { className, label, children }, ref ) => {\n\treturn (\n\t\t<HStack\n\t\t\tclassName={ clsx( 'editor-post-panel__row', className ) }\n\t\t\tref={ ref }\n\t\t>\n\t\t\t{ label && (\n\t\t\t\t<div className=\"editor-post-panel__row-label\">{ label }</div>\n\t\t\t) }\n\t\t\t<div className=\"editor-post-panel__row-control\">{ children }</div>\n\t\t</HStack>\n\t);\n} );\n\nexport default PostPanelRow;\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,oBAAoB,IAAIC,MAAM,QAAQ,uBAAuB;AACtE,SAASC,UAAU,QAAQ,oBAAoB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAEhD,MAAMC,YAAY,GAAGL,UAAU,CAAE,CAAE;EAAEM,SAAS;EAAEC,KAAK;EAAEC;AAAS,CAAC,EAAEC,GAAG,KAAM;EAC3E,oBACCL,KAAA,CAACL,MAAM;IACNO,SAAS,EAAGT,IAAI,CAAE,wBAAwB,EAAES,SAAU,CAAG;IACzDG,GAAG,EAAGA,GAAK;IAAAD,QAAA,GAETD,KAAK,iBACNL,IAAA;MAAKI,SAAS,EAAC,8BAA8B;MAAAE,QAAA,EAAGD;IAAK,CAAO,CAC5D,eACDL,IAAA;MAAKI,SAAS,EAAC,gCAAgC;MAAAE,QAAA,EAAGA;IAAQ,CAAO,CAAC;EAAA,CAC3D,CAAC;AAEX,CAAE,CAAC;AAEH,eAAeH,YAAY","ignoreList":[]}
1
+ {"version":3,"names":["clsx","__experimentalHStack","HStack","forwardRef","jsx","_jsx","jsxs","_jsxs","PostPanelRow","className","label","children","ref"],"sources":["@wordpress/editor/src/components/post-panel-row/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __experimentalHStack as HStack } from '@wordpress/components';\nimport { forwardRef } from '@wordpress/element';\n\nconst PostPanelRow = forwardRef( ( { className, label, children }, ref ) => {\n\treturn (\n\t\t<HStack\n\t\t\tclassName={ clsx( 'editor-post-panel__row', className ) }\n\t\t\tref={ ref }\n\t\t>\n\t\t\t{ label && (\n\t\t\t\t<div className=\"editor-post-panel__row-label\">{ label }</div>\n\t\t\t) }\n\t\t\t<div className=\"editor-post-panel__row-control\">{ children }</div>\n\t\t</HStack>\n\t);\n} );\n\nexport default PostPanelRow;\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,oBAAoB,IAAIC,MAAM,QAAQ,uBAAuB;AACtE,SAASC,UAAU,QAAQ,oBAAoB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAEhD,MAAMC,YAAY,GAAGL,UAAU,CAAE,CAAE;EAAEM,SAAS;EAAEC,KAAK;EAAEC;AAAS,CAAC,EAAEC,GAAG,KAAM;EAC3E,oBACCL,KAAA,CAACL,MAAM;IACNO,SAAS,EAAGT,IAAI,CAAE,wBAAwB,EAAES,SAAU,CAAG;IACzDG,GAAG,EAAGA,GAAK;IAAAD,QAAA,GAETD,KAAK,iBACNL,IAAA;MAAKI,SAAS,EAAC,8BAA8B;MAAAE,QAAA,EAAGD;IAAK,CAAO,CAC5D,eACDL,IAAA;MAAKI,SAAS,EAAC,gCAAgC;MAAAE,QAAA,EAAGA;IAAQ,CAAO,CAAC;EAAA,CAC3D,CAAC;AAEX,CAAE,CAAC;AAEH,eAAeH,YAAY","ignoreList":[]}
@@ -12,11 +12,9 @@ import { store as coreStore } from '@wordpress/core-data';
12
12
  * Internal dependencies
13
13
  */
14
14
  import { store as editorStore } from '../../store';
15
- import { jsx as _jsx } from "react/jsx-runtime";
16
- import { jsxs as _jsxs } from "react/jsx-runtime";
17
- import { Fragment as _Fragment } from "react/jsx-runtime";
15
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
18
16
  function writeInterstitialMessage(targetDocument) {
19
- let markup = renderToString( /*#__PURE__*/_jsxs("div", {
17
+ let markup = renderToString(/*#__PURE__*/_jsxs("div", {
20
18
  className: "editor-post-preview-button__interstitial-message",
21
19
  children: [/*#__PURE__*/_jsxs(SVG, {
22
20
  xmlns: "http://www.w3.org/2000/svg",
@@ -1 +1 @@
1
- {"version":3,"names":["renderToString","Button","Path","SVG","VisuallyHidden","__","_x","useSelect","useDispatch","applyFilters","store","coreStore","editorStore","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","writeInterstitialMessage","targetDocument","markup","className","children","xmlns","viewBox","d","fill","write","title","close","PostPreviewButton","textContent","forceIsAutosaveable","role","onPreview","postId","currentPostLink","previewLink","isSaveable","isViewable","select","_postType$viewable","editor","core","postType","getPostType","getCurrentPostType","getCurrentPostId","getCurrentPostAttribute","getEditedPostPreviewLink","isEditedPostSaveable","viewable","__unstableSaveForPreview","targetId","openPreviewWindow","event","preventDefault","previewWindow","window","open","focus","document","link","location","href","variant","undefined","target","accessibleWhenDisabled","disabled","onClick","size","as"],"sources":["@wordpress/editor/src/components/post-preview-button/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { renderToString } from '@wordpress/element';\nimport { Button, Path, SVG, VisuallyHidden } from '@wordpress/components';\nimport { __, _x } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { applyFilters } from '@wordpress/hooks';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nfunction writeInterstitialMessage( targetDocument ) {\n\tlet markup = renderToString(\n\t\t<div className=\"editor-post-preview-button__interstitial-message\">\n\t\t\t<SVG xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 96 96\">\n\t\t\t\t<Path\n\t\t\t\t\tclassName=\"outer\"\n\t\t\t\t\td=\"M48 12c19.9 0 36 16.1 36 36S67.9 84 48 84 12 67.9 12 48s16.1-36 36-36\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t/>\n\t\t\t\t<Path\n\t\t\t\t\tclassName=\"inner\"\n\t\t\t\t\td=\"M69.5 46.4c0-3.9-1.4-6.7-2.6-8.8-1.6-2.6-3.1-4.9-3.1-7.5 0-2.9 2.2-5.7 5.4-5.7h.4C63.9 19.2 56.4 16 48 16c-11.2 0-21 5.7-26.7 14.4h2.1c3.3 0 8.5-.4 8.5-.4 1.7-.1 1.9 2.4.2 2.6 0 0-1.7.2-3.7.3L40 67.5l7-20.9L42 33c-1.7-.1-3.3-.3-3.3-.3-1.7-.1-1.5-2.7.2-2.6 0 0 5.3.4 8.4.4 3.3 0 8.5-.4 8.5-.4 1.7-.1 1.9 2.4.2 2.6 0 0-1.7.2-3.7.3l11.5 34.3 3.3-10.4c1.6-4.5 2.4-7.8 2.4-10.5zM16.1 48c0 12.6 7.3 23.5 18 28.7L18.8 35c-1.7 4-2.7 8.4-2.7 13zm32.5 2.8L39 78.6c2.9.8 5.9 1.3 9 1.3 3.7 0 7.3-.6 10.6-1.8-.1-.1-.2-.3-.2-.4l-9.8-26.9zM76.2 36c0 3.2-.6 6.9-2.4 11.4L64 75.6c9.5-5.5 15.9-15.8 15.9-27.6 0-5.5-1.4-10.8-3.9-15.3.1 1 .2 2.1.2 3.3z\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t/>\n\t\t\t</SVG>\n\t\t\t<p>{ __( 'Generating preview…' ) }</p>\n\t\t</div>\n\t);\n\n\tmarkup += `\n\t\t<style>\n\t\t\tbody {\n\t\t\t\tmargin: 0;\n\t\t\t}\n\t\t\t.editor-post-preview-button__interstitial-message {\n\t\t\t\tdisplay: flex;\n\t\t\t\tflex-direction: column;\n\t\t\t\talign-items: center;\n\t\t\t\tjustify-content: center;\n\t\t\t\theight: 100vh;\n\t\t\t\twidth: 100vw;\n\t\t\t}\n\t\t\t@-webkit-keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t@-moz-keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t@-o-keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t@keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t.editor-post-preview-button__interstitial-message svg {\n\t\t\t\twidth: 192px;\n\t\t\t\theight: 192px;\n\t\t\t\tstroke: #555d66;\n\t\t\t\tstroke-width: 0.75;\n\t\t\t}\n\t\t\t.editor-post-preview-button__interstitial-message svg .outer,\n\t\t\t.editor-post-preview-button__interstitial-message svg .inner {\n\t\t\t\tstroke-dasharray: 280;\n\t\t\t\tstroke-dashoffset: 280;\n\t\t\t\t-webkit-animation: paint 1.5s ease infinite alternate;\n\t\t\t\t-moz-animation: paint 1.5s ease infinite alternate;\n\t\t\t\t-o-animation: paint 1.5s ease infinite alternate;\n\t\t\t\tanimation: paint 1.5s ease infinite alternate;\n\t\t\t}\n\t\t\tp {\n\t\t\t\ttext-align: center;\n\t\t\t\tfont-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Oxygen-Sans, Ubuntu, Cantarell, \"Helvetica Neue\", sans-serif;\n\t\t\t}\n\t\t</style>\n\t`;\n\n\t/**\n\t * Filters the interstitial message shown when generating previews.\n\t *\n\t * @param {string} markup The preview interstitial markup.\n\t */\n\tmarkup = applyFilters( 'editor.PostPreview.interstitialMarkup', markup );\n\n\ttargetDocument.write( markup );\n\ttargetDocument.title = __( 'Generating preview…' );\n\ttargetDocument.close();\n}\n\n/**\n * Renders a button that opens a new window or tab for the preview,\n * writes the interstitial message to this window, and then navigates\n * to the actual preview link. The button is not rendered if the post\n * is not viewable and disabled if the post is not saveable.\n *\n * @param {Object} props The component props.\n * @param {string} props.className The class name for the button.\n * @param {string} props.textContent The text content for the button.\n * @param {boolean} props.forceIsAutosaveable Whether to force autosave.\n * @param {string} props.role The role attribute for the button.\n * @param {Function} props.onPreview The callback function for preview event.\n *\n * @return {JSX.Element|null} The rendered button component.\n */\nexport default function PostPreviewButton( {\n\tclassName,\n\ttextContent,\n\tforceIsAutosaveable,\n\trole,\n\tonPreview,\n} ) {\n\tconst { postId, currentPostLink, previewLink, isSaveable, isViewable } =\n\t\tuseSelect( ( select ) => {\n\t\t\tconst editor = select( editorStore );\n\t\t\tconst core = select( coreStore );\n\n\t\t\tconst postType = core.getPostType(\n\t\t\t\teditor.getCurrentPostType( 'type' )\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\tpostId: editor.getCurrentPostId(),\n\t\t\t\tcurrentPostLink: editor.getCurrentPostAttribute( 'link' ),\n\t\t\t\tpreviewLink: editor.getEditedPostPreviewLink(),\n\t\t\t\tisSaveable: editor.isEditedPostSaveable(),\n\t\t\t\tisViewable: postType?.viewable ?? false,\n\t\t\t};\n\t\t}, [] );\n\n\tconst { __unstableSaveForPreview } = useDispatch( editorStore );\n\n\tif ( ! isViewable ) {\n\t\treturn null;\n\t}\n\n\tconst targetId = `wp-preview-${ postId }`;\n\n\tconst openPreviewWindow = async ( event ) => {\n\t\t// Our Preview button has its 'href' and 'target' set correctly for a11y\n\t\t// purposes. Unfortunately, though, we can't rely on the default 'click'\n\t\t// handler since sometimes it incorrectly opens a new tab instead of reusing\n\t\t// the existing one.\n\t\t// https://github.com/WordPress/gutenberg/pull/8330\n\t\tevent.preventDefault();\n\n\t\t// Open up a Preview tab if needed. This is where we'll show the preview.\n\t\tconst previewWindow = window.open( '', targetId );\n\n\t\t// Focus the Preview tab. This might not do anything, depending on the browser's\n\t\t// and user's preferences.\n\t\t// https://html.spec.whatwg.org/multipage/interaction.html#dom-window-focus\n\t\tpreviewWindow.focus();\n\n\t\twriteInterstitialMessage( previewWindow.document );\n\n\t\tconst link = await __unstableSaveForPreview( { forceIsAutosaveable } );\n\n\t\tpreviewWindow.location = link;\n\n\t\tonPreview?.();\n\t};\n\n\t// Link to the `?preview=true` URL if we have it, since this lets us see\n\t// changes that were autosaved since the post was last published. Otherwise,\n\t// just link to the post's URL.\n\tconst href = previewLink || currentPostLink;\n\n\treturn (\n\t\t<Button\n\t\t\tvariant={ ! className ? 'tertiary' : undefined }\n\t\t\tclassName={ className || 'editor-post-preview' }\n\t\t\thref={ href }\n\t\t\ttarget={ targetId }\n\t\t\taccessibleWhenDisabled\n\t\t\tdisabled={ ! isSaveable }\n\t\t\tonClick={ openPreviewWindow }\n\t\t\trole={ role }\n\t\t\tsize=\"compact\"\n\t\t>\n\t\t\t{ textContent || (\n\t\t\t\t<>\n\t\t\t\t\t{ _x( 'Preview', 'imperative verb' ) }\n\t\t\t\t\t<VisuallyHidden as=\"span\">\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t/* translators: accessibility text */\n\t\t\t\t\t\t\t__( '(opens in a new tab)' )\n\t\t\t\t\t\t}\n\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t</>\n\t\t\t) }\n\t\t</Button>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,cAAc,QAAQ,oBAAoB;AACnD,SAASC,MAAM,EAAEC,IAAI,EAAEC,GAAG,EAAEC,cAAc,QAAQ,uBAAuB;AACzE,SAASC,EAAE,EAAEC,EAAE,QAAQ,iBAAiB;AACxC,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,YAAY,QAAQ,kBAAkB;AAC/C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;;AAEzD;AACA;AACA;AACA,SAASD,KAAK,IAAIE,WAAW,QAAQ,aAAa;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAAA,SAAAC,QAAA,IAAAC,SAAA;AAEnD,SAASC,wBAAwBA,CAAEC,cAAc,EAAG;EACnD,IAAIC,MAAM,GAAGrB,cAAc,eAC1BgB,KAAA;IAAKM,SAAS,EAAC,kDAAkD;IAAAC,QAAA,gBAChEP,KAAA,CAACb,GAAG;MAACqB,KAAK,EAAC,4BAA4B;MAACC,OAAO,EAAC,WAAW;MAAAF,QAAA,gBAC1DT,IAAA,CAACZ,IAAI;QACJoB,SAAS,EAAC,OAAO;QACjBI,CAAC,EAAC,uEAAuE;QACzEC,IAAI,EAAC;MAAM,CACX,CAAC,eACFb,IAAA,CAACZ,IAAI;QACJoB,SAAS,EAAC,OAAO;QACjBI,CAAC,EAAC,0nBAA0nB;QAC5nBC,IAAI,EAAC;M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BgC,OAAO,EAAGhB,iBAAmB;IAC7BrB,IAAI,EAAGA,IAAM;IACbsC,IAAI,EAAC,SAAS;IAAAjD,QAAA,EAEZS,WAAW,iBACZhB,KAAA,CAAAE,SAAA;MAAAK,QAAA,GACGjB,EAAE,CAAE,SAAS,EAAE,iBAAkB,CAAC,eACpCQ,IAAA,CAACV,cAAc;QAACqE,EAAE,EAAC,MAAM;QAAAlD,QAAA,EAEvB;QACAlB,EAAE,CAAE,sBAAuB;MAAC,CAEd,CAAC;IAAA,CAChB;EACF,CACM,CAAC;AAEX","ignoreList":[]}
1
+ {"version":3,"names":["renderToString","Button","Path","SVG","VisuallyHidden","__","_x","useSelect","useDispatch","applyFilters","store","coreStore","editorStore","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","writeInterstitialMessage","targetDocument","markup","className","children","xmlns","viewBox","d","fill","write","title","close","PostPreviewButton","textContent","forceIsAutosaveable","role","onPreview","postId","currentPostLink","previewLink","isSaveable","isViewable","select","_postType$viewable","editor","core","postType","getPostType","getCurrentPostType","getCurrentPostId","getCurrentPostAttribute","getEditedPostPreviewLink","isEditedPostSaveable","viewable","__unstableSaveForPreview","targetId","openPreviewWindow","event","preventDefault","previewWindow","window","open","focus","document","link","location","href","variant","undefined","target","accessibleWhenDisabled","disabled","onClick","size","as"],"sources":["@wordpress/editor/src/components/post-preview-button/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { renderToString } from '@wordpress/element';\nimport { Button, Path, SVG, VisuallyHidden } from '@wordpress/components';\nimport { __, _x } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { applyFilters } from '@wordpress/hooks';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nfunction writeInterstitialMessage( targetDocument ) {\n\tlet markup = renderToString(\n\t\t<div className=\"editor-post-preview-button__interstitial-message\">\n\t\t\t<SVG xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 96 96\">\n\t\t\t\t<Path\n\t\t\t\t\tclassName=\"outer\"\n\t\t\t\t\td=\"M48 12c19.9 0 36 16.1 36 36S67.9 84 48 84 12 67.9 12 48s16.1-36 36-36\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t/>\n\t\t\t\t<Path\n\t\t\t\t\tclassName=\"inner\"\n\t\t\t\t\td=\"M69.5 46.4c0-3.9-1.4-6.7-2.6-8.8-1.6-2.6-3.1-4.9-3.1-7.5 0-2.9 2.2-5.7 5.4-5.7h.4C63.9 19.2 56.4 16 48 16c-11.2 0-21 5.7-26.7 14.4h2.1c3.3 0 8.5-.4 8.5-.4 1.7-.1 1.9 2.4.2 2.6 0 0-1.7.2-3.7.3L40 67.5l7-20.9L42 33c-1.7-.1-3.3-.3-3.3-.3-1.7-.1-1.5-2.7.2-2.6 0 0 5.3.4 8.4.4 3.3 0 8.5-.4 8.5-.4 1.7-.1 1.9 2.4.2 2.6 0 0-1.7.2-3.7.3l11.5 34.3 3.3-10.4c1.6-4.5 2.4-7.8 2.4-10.5zM16.1 48c0 12.6 7.3 23.5 18 28.7L18.8 35c-1.7 4-2.7 8.4-2.7 13zm32.5 2.8L39 78.6c2.9.8 5.9 1.3 9 1.3 3.7 0 7.3-.6 10.6-1.8-.1-.1-.2-.3-.2-.4l-9.8-26.9zM76.2 36c0 3.2-.6 6.9-2.4 11.4L64 75.6c9.5-5.5 15.9-15.8 15.9-27.6 0-5.5-1.4-10.8-3.9-15.3.1 1 .2 2.1.2 3.3z\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t/>\n\t\t\t</SVG>\n\t\t\t<p>{ __( 'Generating preview…' ) }</p>\n\t\t</div>\n\t);\n\n\tmarkup += `\n\t\t<style>\n\t\t\tbody {\n\t\t\t\tmargin: 0;\n\t\t\t}\n\t\t\t.editor-post-preview-button__interstitial-message {\n\t\t\t\tdisplay: flex;\n\t\t\t\tflex-direction: column;\n\t\t\t\talign-items: center;\n\t\t\t\tjustify-content: center;\n\t\t\t\theight: 100vh;\n\t\t\t\twidth: 100vw;\n\t\t\t}\n\t\t\t@-webkit-keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t@-moz-keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t@-o-keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t@keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t.editor-post-preview-button__interstitial-message svg {\n\t\t\t\twidth: 192px;\n\t\t\t\theight: 192px;\n\t\t\t\tstroke: #555d66;\n\t\t\t\tstroke-width: 0.75;\n\t\t\t}\n\t\t\t.editor-post-preview-button__interstitial-message svg .outer,\n\t\t\t.editor-post-preview-button__interstitial-message svg .inner {\n\t\t\t\tstroke-dasharray: 280;\n\t\t\t\tstroke-dashoffset: 280;\n\t\t\t\t-webkit-animation: paint 1.5s ease infinite alternate;\n\t\t\t\t-moz-animation: paint 1.5s ease infinite alternate;\n\t\t\t\t-o-animation: paint 1.5s ease infinite alternate;\n\t\t\t\tanimation: paint 1.5s ease infinite alternate;\n\t\t\t}\n\t\t\tp {\n\t\t\t\ttext-align: center;\n\t\t\t\tfont-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Oxygen-Sans, Ubuntu, Cantarell, \"Helvetica Neue\", sans-serif;\n\t\t\t}\n\t\t</style>\n\t`;\n\n\t/**\n\t * Filters the interstitial message shown when generating previews.\n\t *\n\t * @param {string} markup The preview interstitial markup.\n\t */\n\tmarkup = applyFilters( 'editor.PostPreview.interstitialMarkup', markup );\n\n\ttargetDocument.write( markup );\n\ttargetDocument.title = __( 'Generating preview…' );\n\ttargetDocument.close();\n}\n\n/**\n * Renders a button that opens a new window or tab for the preview,\n * writes the interstitial message to this window, and then navigates\n * to the actual preview link. The button is not rendered if the post\n * is not viewable and disabled if the post is not saveable.\n *\n * @param {Object} props The component props.\n * @param {string} props.className The class name for the button.\n * @param {string} props.textContent The text content for the button.\n * @param {boolean} props.forceIsAutosaveable Whether to force autosave.\n * @param {string} props.role The role attribute for the button.\n * @param {Function} props.onPreview The callback function for preview event.\n *\n * @return {JSX.Element|null} The rendered button component.\n */\nexport default function PostPreviewButton( {\n\tclassName,\n\ttextContent,\n\tforceIsAutosaveable,\n\trole,\n\tonPreview,\n} ) {\n\tconst { postId, currentPostLink, previewLink, isSaveable, isViewable } =\n\t\tuseSelect( ( select ) => {\n\t\t\tconst editor = select( editorStore );\n\t\t\tconst core = select( coreStore );\n\n\t\t\tconst postType = core.getPostType(\n\t\t\t\teditor.getCurrentPostType( 'type' )\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\tpostId: editor.getCurrentPostId(),\n\t\t\t\tcurrentPostLink: editor.getCurrentPostAttribute( 'link' ),\n\t\t\t\tpreviewLink: editor.getEditedPostPreviewLink(),\n\t\t\t\tisSaveable: editor.isEditedPostSaveable(),\n\t\t\t\tisViewable: postType?.viewable ?? false,\n\t\t\t};\n\t\t}, [] );\n\n\tconst { __unstableSaveForPreview } = useDispatch( editorStore );\n\n\tif ( ! isViewable ) {\n\t\treturn null;\n\t}\n\n\tconst targetId = `wp-preview-${ postId }`;\n\n\tconst openPreviewWindow = async ( event ) => {\n\t\t// Our Preview button has its 'href' and 'target' set correctly for a11y\n\t\t// purposes. Unfortunately, though, we can't rely on the default 'click'\n\t\t// handler since sometimes it incorrectly opens a new tab instead of reusing\n\t\t// the existing one.\n\t\t// https://github.com/WordPress/gutenberg/pull/8330\n\t\tevent.preventDefault();\n\n\t\t// Open up a Preview tab if needed. This is where we'll show the preview.\n\t\tconst previewWindow = window.open( '', targetId );\n\n\t\t// Focus the Preview tab. This might not do anything, depending on the browser's\n\t\t// and user's preferences.\n\t\t// https://html.spec.whatwg.org/multipage/interaction.html#dom-window-focus\n\t\tpreviewWindow.focus();\n\n\t\twriteInterstitialMessage( previewWindow.document );\n\n\t\tconst link = await __unstableSaveForPreview( { forceIsAutosaveable } );\n\n\t\tpreviewWindow.location = link;\n\n\t\tonPreview?.();\n\t};\n\n\t// Link to the `?preview=true` URL if we have it, since this lets us see\n\t// changes that were autosaved since the post was last published. Otherwise,\n\t// just link to the post's URL.\n\tconst href = previewLink || currentPostLink;\n\n\treturn (\n\t\t<Button\n\t\t\tvariant={ ! className ? 'tertiary' : undefined }\n\t\t\tclassName={ className || 'editor-post-preview' }\n\t\t\thref={ href }\n\t\t\ttarget={ targetId }\n\t\t\taccessibleWhenDisabled\n\t\t\tdisabled={ ! isSaveable }\n\t\t\tonClick={ openPreviewWindow }\n\t\t\trole={ role }\n\t\t\tsize=\"compact\"\n\t\t>\n\t\t\t{ textContent || (\n\t\t\t\t<>\n\t\t\t\t\t{ _x( 'Preview', 'imperative verb' ) }\n\t\t\t\t\t<VisuallyHidden as=\"span\">\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t/* translators: accessibility text */\n\t\t\t\t\t\t\t__( '(opens in a new tab)' )\n\t\t\t\t\t\t}\n\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t</>\n\t\t\t) }\n\t\t</Button>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,cAAc,QAAQ,oBAAoB;AACnD,SAASC,MAAM,EAAEC,IAAI,EAAEC,GAAG,EAAEC,cAAc,QAAQ,uBAAuB;AACzE,SAASC,EAAE,EAAEC,EAAE,QAAQ,iBAAiB;AACxC,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,YAAY,QAAQ,kBAAkB;AAC/C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;;AAEzD;AACA;AACA;AACA,SAASD,KAAK,IAAIE,WAAW,QAAQ,aAAa;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAA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CAAEuC,aAAa,CAACI,QAAS,CAAC;IAElD,MAAMC,IAAI,GAAG,MAAMV,wBAAwB,CAAE;MAAEpB;IAAoB,CAAE,CAAC;IAEtEyB,aAAa,CAACM,QAAQ,GAAGD,IAAI;IAE7B5B,SAAS,GAAG,CAAC;EACd,CAAC;;EAED;EACA;EACA;EACA,MAAM8B,IAAI,GAAG3B,WAAW,IAAID,eAAe;EAE3C,oBACCvB,IAAA,CAACb,MAAM;IACNiE,OAAO,EAAG,CAAE5C,SAAS,GAAG,UAAU,GAAG6C,SAAW;IAChD7C,SAAS,EAAGA,SAAS,IAAI,qBAAuB;IAChD2C,IAAI,EAAGA,IAAM;IACbG,MAAM,EAAGd,QAAU;IACnBe,sBAAsB;IACtBC,QAAQ,EAAG,CAAE/B,UAAY;IACzBgC,OAAO,EAAGhB,iBAAmB;IAC7BrB,IAAI,EAAGA,IAAM;IACbsC,IAAI,EAAC,SAAS;IAAAjD,QAAA,EAEZS,WAAW,iBACZhB,KAAA,CAAAE,SAAA;MAAAK,QAAA,GACGjB,EAAE,CAAE,SAAS,EAAE,iBAAkB,CAAC,eACpCQ,IAAA,CAACV,cAAc;QAACqE,EAAE,EAAC,MAAM;QAAAlD,QAAA,EAEvB;QACAlB,EAAE,CAAE,sBAAuB;MAAC,CAEd,CAAC;IAAA,CAChB;EACF,CACM,CAAC;AAEX","ignoreList":[]}
@@ -11,8 +11,7 @@ import { compose } from '@wordpress/compose';
11
11
  */
12
12
  import PublishButtonLabel from './label';
13
13
  import { store as editorStore } from '../../store';
14
- import { jsx as _jsx } from "react/jsx-runtime";
15
- import { Fragment as _Fragment } from "react/jsx-runtime";
14
+ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
16
15
  const noop = () => {};
17
16
  export class PostPublishButton extends Component {
18
17
  constructor(props) {
@@ -1 +1 @@
1
- {"version":3,"names":["Button","Component","withSelect","withDispatch","compose","PublishButtonLabel","store","editorStore","jsx","_jsx","Fragment","_Fragment","noop","PostPublishButton","constructor","props","createOnClick","bind","closeEntitiesSavedStates","state","entitiesSavedStatesCallback","callback","args","hasNonPostEntityChanges","setEntitiesSavedStatesCallback","setState","savedEntities","postType","postId","some","elt","kind","name","key","render","forceIsDirty","hasPublishAction","isBeingScheduled","isOpen","isPostSavingLocked","isPublishable","isPublished","isSaveable","isSaving","isAutoSaving","isToggle","savePostStatus","onSubmit","onToggle","visibility","isSavingNonPostEntityChanges","postStatus","postStatusHasChanged","isButtonDisabled","isToggleDisabled","publishStatus","onClickButton","onClickToggle","buttonProps","className","isBusy","variant","onClick","toggleProps","size","componentProps","children","select","_getCurrentPost$_link","isSavingPost","isAutosavingPost","isEditedPostBeingScheduled","getEditedPostVisibility","isCurrentPostPublished","isEditedPostSaveable","isEditedPostPublishable","getCurrentPost","getCurrentPostType","getCurrentPostId","getEditedPostAttribute","getPostEdits","_links","status","dispatch","editPost","savePost","undoIgnore"],"sources":["@wordpress/editor/src/components/post-publish-button/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Button } from '@wordpress/components';\nimport { Component } from '@wordpress/element';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport PublishButtonLabel from './label';\nimport { store as editorStore } from '../../store';\n\nconst noop = () => {};\n\nexport class PostPublishButton extends Component {\n\tconstructor( props ) {\n\t\tsuper( props );\n\n\t\tthis.createOnClick = this.createOnClick.bind( this );\n\t\tthis.closeEntitiesSavedStates =\n\t\t\tthis.closeEntitiesSavedStates.bind( this );\n\n\t\tthis.state = {\n\t\t\tentitiesSavedStatesCallback: false,\n\t\t};\n\t}\n\n\tcreateOnClick( callback ) {\n\t\treturn ( ...args ) => {\n\t\t\tconst { hasNonPostEntityChanges, setEntitiesSavedStatesCallback } =\n\t\t\t\tthis.props;\n\t\t\t// If a post with non-post entities is published, but the user\n\t\t\t// elects to not save changes to the non-post entities, those\n\t\t\t// entities will still be dirty when the Publish button is clicked.\n\t\t\t// We also need to check that the `setEntitiesSavedStatesCallback`\n\t\t\t// prop was passed. See https://github.com/WordPress/gutenberg/pull/37383\n\t\t\tif ( hasNonPostEntityChanges && setEntitiesSavedStatesCallback ) {\n\t\t\t\t// The modal for multiple entity saving will open,\n\t\t\t\t// hold the callback for saving/publishing the post\n\t\t\t\t// so that we can call it if the post entity is checked.\n\t\t\t\tthis.setState( {\n\t\t\t\t\tentitiesSavedStatesCallback: () => callback( ...args ),\n\t\t\t\t} );\n\n\t\t\t\t// Open the save panel by setting its callback.\n\t\t\t\t// To set a function on the useState hook, we must set it\n\t\t\t\t// with another function (() => myFunction). Passing the\n\t\t\t\t// function on its own will cause an error when called.\n\t\t\t\tsetEntitiesSavedStatesCallback(\n\t\t\t\t\t() => this.closeEntitiesSavedStates\n\t\t\t\t);\n\t\t\t\treturn noop;\n\t\t\t}\n\n\t\t\treturn callback( ...args );\n\t\t};\n\t}\n\n\tcloseEntitiesSavedStates( savedEntities ) {\n\t\tconst { postType, postId } = this.props;\n\t\tconst { entitiesSavedStatesCallback } = this.state;\n\t\tthis.setState( { entitiesSavedStatesCallback: false }, () => {\n\t\t\tif (\n\t\t\t\tsavedEntities &&\n\t\t\t\tsavedEntities.some(\n\t\t\t\t\t( elt ) =>\n\t\t\t\t\t\telt.kind === 'postType' &&\n\t\t\t\t\t\telt.name === postType &&\n\t\t\t\t\t\telt.key === postId\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\t// The post entity was checked, call the held callback from `createOnClick`.\n\t\t\t\tentitiesSavedStatesCallback();\n\t\t\t}\n\t\t} );\n\t}\n\n\trender() {\n\t\tconst {\n\t\t\tforceIsDirty,\n\t\t\thasPublishAction,\n\t\t\tisBeingScheduled,\n\t\t\tisOpen,\n\t\t\tisPostSavingLocked,\n\t\t\tisPublishable,\n\t\t\tisPublished,\n\t\t\tisSaveable,\n\t\t\tisSaving,\n\t\t\tisAutoSaving,\n\t\t\tisToggle,\n\t\t\tsavePostStatus,\n\t\t\tonSubmit = noop,\n\t\t\tonToggle,\n\t\t\tvisibility,\n\t\t\thasNonPostEntityChanges,\n\t\t\tisSavingNonPostEntityChanges,\n\t\t\tpostStatus,\n\t\t\tpostStatusHasChanged,\n\t\t} = this.props;\n\n\t\tconst isButtonDisabled =\n\t\t\t( isSaving ||\n\t\t\t\t! isSaveable ||\n\t\t\t\tisPostSavingLocked ||\n\t\t\t\t( ! isPublishable && ! forceIsDirty ) ) &&\n\t\t\t( ! hasNonPostEntityChanges || isSavingNonPostEntityChanges );\n\n\t\tconst isToggleDisabled =\n\t\t\t( isPublished ||\n\t\t\t\tisSaving ||\n\t\t\t\t! isSaveable ||\n\t\t\t\t( ! isPublishable && ! forceIsDirty ) ) &&\n\t\t\t( ! hasNonPostEntityChanges || isSavingNonPostEntityChanges );\n\n\t\t// If the new status has not changed explicitely, we derive it from\n\t\t// other factors, like having a publish action, etc.. We need to preserve\n\t\t// this because it affects when to show the pre and post publish panels.\n\t\t// If it has changed though explicitely, we need to respect that.\n\t\tlet publishStatus = 'publish';\n\t\tif ( postStatusHasChanged ) {\n\t\t\tpublishStatus = postStatus;\n\t\t} else if ( ! hasPublishAction ) {\n\t\t\tpublishStatus = 'pending';\n\t\t} else if ( visibility === 'private' ) {\n\t\t\tpublishStatus = 'private';\n\t\t} else if ( isBeingScheduled ) {\n\t\t\tpublishStatus = 'future';\n\t\t}\n\n\t\tconst onClickButton = () => {\n\t\t\tif ( isButtonDisabled ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tonSubmit();\n\t\t\tsavePostStatus( publishStatus );\n\t\t};\n\n\t\t// Callback to open the publish panel.\n\t\tconst onClickToggle = () => {\n\t\t\tif ( isToggleDisabled ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tonToggle();\n\t\t};\n\n\t\tconst buttonProps = {\n\t\t\t'aria-disabled': isButtonDisabled,\n\t\t\tclassName: 'editor-post-publish-button',\n\t\t\tisBusy: ! isAutoSaving && isSaving,\n\t\t\tvariant: 'primary',\n\t\t\tonClick: this.createOnClick( onClickButton ),\n\t\t};\n\n\t\tconst toggleProps = {\n\t\t\t'aria-disabled': isToggleDisabled,\n\t\t\t'aria-expanded': isOpen,\n\t\t\tclassName: 'editor-post-publish-panel__toggle',\n\t\t\tisBusy: isSaving && isPublished,\n\t\t\tvariant: 'primary',\n\t\t\tsize: 'compact',\n\t\t\tonClick: this.createOnClick( onClickToggle ),\n\t\t};\n\t\tconst componentProps = isToggle ? toggleProps : buttonProps;\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<Button\n\t\t\t\t\t{ ...componentProps }\n\t\t\t\t\tclassName={ `${ componentProps.className } editor-post-publish-button__button` }\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t>\n\t\t\t\t\t<PublishButtonLabel />\n\t\t\t\t</Button>\n\t\t\t</>\n\t\t);\n\t}\n}\n\n/**\n * Renders the publish button.\n */\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst {\n\t\t\tisSavingPost,\n\t\t\tisAutosavingPost,\n\t\t\tisEditedPostBeingScheduled,\n\t\t\tgetEditedPostVisibility,\n\t\t\tisCurrentPostPublished,\n\t\t\tisEditedPostSaveable,\n\t\t\tisEditedPostPublishable,\n\t\t\tisPostSavingLocked,\n\t\t\tgetCurrentPost,\n\t\t\tgetCurrentPostType,\n\t\t\tgetCurrentPostId,\n\t\t\thasNonPostEntityChanges,\n\t\t\tisSavingNonPostEntityChanges,\n\t\t\tgetEditedPostAttribute,\n\t\t\tgetPostEdits,\n\t\t} = select( editorStore );\n\t\treturn {\n\t\t\tisSaving: isSavingPost(),\n\t\t\tisAutoSaving: isAutosavingPost(),\n\t\t\tisBeingScheduled: isEditedPostBeingScheduled(),\n\t\t\tvisibility: getEditedPostVisibility(),\n\t\t\tisSaveable: isEditedPostSaveable(),\n\t\t\tisPostSavingLocked: isPostSavingLocked(),\n\t\t\tisPublishable: isEditedPostPublishable(),\n\t\t\tisPublished: isCurrentPostPublished(),\n\t\t\thasPublishAction:\n\t\t\t\tgetCurrentPost()._links?.[ 'wp:action-publish' ] ?? false,\n\t\t\tpostType: getCurrentPostType(),\n\t\t\tpostId: getCurrentPostId(),\n\t\t\tpostStatus: getEditedPostAttribute( 'status' ),\n\t\t\tpostStatusHasChanged: getPostEdits()?.status,\n\t\t\thasNonPostEntityChanges: hasNonPostEntityChanges(),\n\t\t\tisSavingNonPostEntityChanges: isSavingNonPostEntityChanges(),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { editPost, savePost } = dispatch( editorStore );\n\t\treturn {\n\t\t\tsavePostStatus: ( status ) => {\n\t\t\t\teditPost( { status }, { undoIgnore: true } );\n\t\t\t\tsavePost();\n\t\t\t},\n\t\t};\n\t} ),\n] )( PostPublishButton );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,SAAS,QAAQ,oBAAoB;AAC9C,SAASC,UAAU,EAAEC,YAAY,QAAQ,iBAAiB;AAC1D,SAASC,OAAO,QAAQ,oBAAoB;;AAE5C;AACA;AACA;AACA,OAAOC,kBAAkB,MAAM,SAAS;AACxC,SAASC,KAAK,IAAIC,WAAW,QAAQ,aAAa;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,QAAA,IAAAC,SAAA;AAEnD,MAAMC,IAAI,GAAGA,CAAA,KAAM,CAAC,CAAC;AAErB,OAAO,MAAMC,iBAAiB,SAASZ,SAAS,CAAC;EAChDa,WAAWA,CAAEC,KAAK,EAAG;IACpB,KAAK,CAAEA,KAAM,CAAC;IAEd,IAAI,CAACC,aAAa,GAAG,IAAI,CAACA,aAAa,CAACC,IAAI,CAAE,IAAK,CAAC;IACpD,IAAI,CAACC,wBAAwB,GAC5B,IAAI,CAACA,wBAAwB,CAACD,IAAI,CAAE,IAAK,CAAC;IAE3C,IAAI,CAACE,KAAK,GAAG;MACZC,2BAA2B,EAAE;IAC9B,CAAC;EACF;EAEAJ,aAAaA,CAAEK,QAAQ,EAAG;IACzB,O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IACxClC,WAAW,EAAEgC,sBAAsB,CAAC,CAAC;IACrCrC,gBAAgB,GAAAgC,qBAAA,GACfQ,cAAc,CAAC,CAAC,CAACK,MAAM,GAAI,mBAAmB,CAAE,cAAAb,qBAAA,cAAAA,qBAAA,GAAI,KAAK;IAC1DzC,QAAQ,EAAEkD,kBAAkB,CAAC,CAAC;IAC9BjD,MAAM,EAAEkD,gBAAgB,CAAC,CAAC;IAC1B3B,UAAU,EAAE4B,sBAAsB,CAAE,QAAS,CAAC;IAC9C3B,oBAAoB,EAAE4B,YAAY,CAAC,CAAC,EAAEE,MAAM;IAC5C3D,uBAAuB,EAAEA,uBAAuB,CAAC,CAAC;IAClD2B,4BAA4B,EAAEA,4BAA4B,CAAC;EAC5D,CAAC;AACF,CAAE,CAAC,EACH/C,YAAY,CAAIgF,QAAQ,IAAM;EAC7B,MAAM;IAAEC,QAAQ;IAAEC;EAAS,CAAC,GAAGF,QAAQ,CAAE5E,WAAY,CAAC;EACtD,OAAO;IACNuC,cAAc,EAAIoC,MAAM,IAAM;MAC7BE,QAAQ,CAAE;QAAEF;MAAO,CAAC,EAAE;QAAEI,UAAU,EAAE;MAAK,CAAE,CAAC;MAC5CD,QAAQ,CAAC,CAAC;IACX;EACD,CAAC;AACF,CAAE,CAAC,CACF,CAAC,CAAExE,iBAAkB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["Button","Component","withSelect","withDispatch","compose","PublishButtonLabel","store","editorStore","jsx","_jsx","Fragment","_Fragment","noop","PostPublishButton","constructor","props","createOnClick","bind","closeEntitiesSavedStates","state","entitiesSavedStatesCallback","callback","args","hasNonPostEntityChanges","setEntitiesSavedStatesCallback","setState","savedEntities","postType","postId","some","elt","kind","name","key","render","forceIsDirty","hasPublishAction","isBeingScheduled","isOpen","isPostSavingLocked","isPublishable","isPublished","isSaveable","isSaving","isAutoSaving","isToggle","savePostStatus","onSubmit","onToggle","visibility","isSavingNonPostEntityChanges","postStatus","postStatusHasChanged","isButtonDisabled","isToggleDisabled","publishStatus","onClickButton","onClickToggle","buttonProps","className","isBusy","variant","onClick","toggleProps","size","componentProps","children","select","_getCurrentPost$_link","isSavingPost","isAutosavingPost","isEditedPostBeingScheduled","getEditedPostVisibility","isCurrentPostPublished","isEditedPostSaveable","isEditedPostPublishable","getCurrentPost","getCurrentPostType","getCurrentPostId","getEditedPostAttribute","getPostEdits","_links","status","dispatch","editPost","savePost","undoIgnore"],"sources":["@wordpress/editor/src/components/post-publish-button/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Button } from '@wordpress/components';\nimport { Component } from '@wordpress/element';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport PublishButtonLabel from './label';\nimport { store as editorStore } from '../../store';\n\nconst noop = () => {};\n\nexport class PostPublishButton extends Component {\n\tconstructor( props ) {\n\t\tsuper( props );\n\n\t\tthis.createOnClick = this.createOnClick.bind( this );\n\t\tthis.closeEntitiesSavedStates =\n\t\t\tthis.closeEntitiesSavedStates.bind( this );\n\n\t\tthis.state = {\n\t\t\tentitiesSavedStatesCallback: false,\n\t\t};\n\t}\n\n\tcreateOnClick( callback ) {\n\t\treturn ( ...args ) => {\n\t\t\tconst { hasNonPostEntityChanges, setEntitiesSavedStatesCallback } =\n\t\t\t\tthis.props;\n\t\t\t// If a post with non-post entities is published, but the user\n\t\t\t// elects to not save changes to the non-post entities, those\n\t\t\t// entities will still be dirty when the Publish button is clicked.\n\t\t\t// We also need to check that the `setEntitiesSavedStatesCallback`\n\t\t\t// prop was passed. See https://github.com/WordPress/gutenberg/pull/37383\n\t\t\tif ( hasNonPostEntityChanges && setEntitiesSavedStatesCallback ) {\n\t\t\t\t// The modal for multiple entity saving will open,\n\t\t\t\t// hold the callback for saving/publishing the post\n\t\t\t\t// so that we can call it if the post entity is checked.\n\t\t\t\tthis.setState( {\n\t\t\t\t\tentitiesSavedStatesCallback: () => callback( ...args ),\n\t\t\t\t} );\n\n\t\t\t\t// Open the save panel by setting its callback.\n\t\t\t\t// To set a function on the useState hook, we must set it\n\t\t\t\t// with another function (() => myFunction). Passing the\n\t\t\t\t// function on its own will cause an error when called.\n\t\t\t\tsetEntitiesSavedStatesCallback(\n\t\t\t\t\t() => this.closeEntitiesSavedStates\n\t\t\t\t);\n\t\t\t\treturn noop;\n\t\t\t}\n\n\t\t\treturn callback( ...args );\n\t\t};\n\t}\n\n\tcloseEntitiesSavedStates( savedEntities ) {\n\t\tconst { postType, postId } = this.props;\n\t\tconst { entitiesSavedStatesCallback } = this.state;\n\t\tthis.setState( { entitiesSavedStatesCallback: false }, () => {\n\t\t\tif (\n\t\t\t\tsavedEntities &&\n\t\t\t\tsavedEntities.some(\n\t\t\t\t\t( elt ) =>\n\t\t\t\t\t\telt.kind === 'postType' &&\n\t\t\t\t\t\telt.name === postType &&\n\t\t\t\t\t\telt.key === postId\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\t// The post entity was checked, call the held callback from `createOnClick`.\n\t\t\t\tentitiesSavedStatesCallback();\n\t\t\t}\n\t\t} );\n\t}\n\n\trender() {\n\t\tconst {\n\t\t\tforceIsDirty,\n\t\t\thasPublishAction,\n\t\t\tisBeingScheduled,\n\t\t\tisOpen,\n\t\t\tisPostSavingLocked,\n\t\t\tisPublishable,\n\t\t\tisPublished,\n\t\t\tisSaveable,\n\t\t\tisSaving,\n\t\t\tisAutoSaving,\n\t\t\tisToggle,\n\t\t\tsavePostStatus,\n\t\t\tonSubmit = noop,\n\t\t\tonToggle,\n\t\t\tvisibility,\n\t\t\thasNonPostEntityChanges,\n\t\t\tisSavingNonPostEntityChanges,\n\t\t\tpostStatus,\n\t\t\tpostStatusHasChanged,\n\t\t} = this.props;\n\n\t\tconst isButtonDisabled =\n\t\t\t( isSaving ||\n\t\t\t\t! isSaveable ||\n\t\t\t\tisPostSavingLocked ||\n\t\t\t\t( ! isPublishable && ! forceIsDirty ) ) &&\n\t\t\t( ! hasNonPostEntityChanges || isSavingNonPostEntityChanges );\n\n\t\tconst isToggleDisabled =\n\t\t\t( isPublished ||\n\t\t\t\tisSaving ||\n\t\t\t\t! isSaveable ||\n\t\t\t\t( ! isPublishable && ! forceIsDirty ) ) &&\n\t\t\t( ! hasNonPostEntityChanges || isSavingNonPostEntityChanges );\n\n\t\t// If the new status has not changed explicitely, we derive it from\n\t\t// other factors, like having a publish action, etc.. We need to preserve\n\t\t// this because it affects when to show the pre and post publish panels.\n\t\t// If it has changed though explicitely, we need to respect that.\n\t\tlet publishStatus = 'publish';\n\t\tif ( postStatusHasChanged ) {\n\t\t\tpublishStatus = postStatus;\n\t\t} else if ( ! hasPublishAction ) {\n\t\t\tpublishStatus = 'pending';\n\t\t} else if ( visibility === 'private' ) {\n\t\t\tpublishStatus = 'private';\n\t\t} else if ( isBeingScheduled ) {\n\t\t\tpublishStatus = 'future';\n\t\t}\n\n\t\tconst onClickButton = () => {\n\t\t\tif ( isButtonDisabled ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tonSubmit();\n\t\t\tsavePostStatus( publishStatus );\n\t\t};\n\n\t\t// Callback to open the publish panel.\n\t\tconst onClickToggle = () => {\n\t\t\tif ( isToggleDisabled ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tonToggle();\n\t\t};\n\n\t\tconst buttonProps = {\n\t\t\t'aria-disabled': isButtonDisabled,\n\t\t\tclassName: 'editor-post-publish-button',\n\t\t\tisBusy: ! isAutoSaving && isSaving,\n\t\t\tvariant: 'primary',\n\t\t\tonClick: this.createOnClick( onClickButton ),\n\t\t};\n\n\t\tconst toggleProps = {\n\t\t\t'aria-disabled': isToggleDisabled,\n\t\t\t'aria-expanded': isOpen,\n\t\t\tclassName: 'editor-post-publish-panel__toggle',\n\t\t\tisBusy: isSaving && isPublished,\n\t\t\tvariant: 'primary',\n\t\t\tsize: 'compact',\n\t\t\tonClick: this.createOnClick( onClickToggle ),\n\t\t};\n\t\tconst componentProps = isToggle ? toggleProps : buttonProps;\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<Button\n\t\t\t\t\t{ ...componentProps }\n\t\t\t\t\tclassName={ `${ componentProps.className } editor-post-publish-button__button` }\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t>\n\t\t\t\t\t<PublishButtonLabel />\n\t\t\t\t</Button>\n\t\t\t</>\n\t\t);\n\t}\n}\n\n/**\n * Renders the publish button.\n */\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst {\n\t\t\tisSavingPost,\n\t\t\tisAutosavingPost,\n\t\t\tisEditedPostBeingScheduled,\n\t\t\tgetEditedPostVisibility,\n\t\t\tisCurrentPostPublished,\n\t\t\tisEditedPostSaveable,\n\t\t\tisEditedPostPublishable,\n\t\t\tisPostSavingLocked,\n\t\t\tgetCurrentPost,\n\t\t\tgetCurrentPostType,\n\t\t\tgetCurrentPostId,\n\t\t\thasNonPostEntityChanges,\n\t\t\tisSavingNonPostEntityChanges,\n\t\t\tgetEditedPostAttribute,\n\t\t\tgetPostEdits,\n\t\t} = select( editorStore );\n\t\treturn {\n\t\t\tisSaving: isSavingPost(),\n\t\t\tisAutoSaving: isAutosavingPost(),\n\t\t\tisBeingScheduled: isEditedPostBeingScheduled(),\n\t\t\tvisibility: getEditedPostVisibility(),\n\t\t\tisSaveable: isEditedPostSaveable(),\n\t\t\tisPostSavingLocked: isPostSavingLocked(),\n\t\t\tisPublishable: isEditedPostPublishable(),\n\t\t\tisPublished: isCurrentPostPublished(),\n\t\t\thasPublishAction:\n\t\t\t\tgetCurrentPost()._links?.[ 'wp:action-publish' ] ?? false,\n\t\t\tpostType: getCurrentPostType(),\n\t\t\tpostId: getCurrentPostId(),\n\t\t\tpostStatus: getEditedPostAttribute( 'status' ),\n\t\t\tpostStatusHasChanged: getPostEdits()?.status,\n\t\t\thasNonPostEntityChanges: hasNonPostEntityChanges(),\n\t\t\tisSavingNonPostEntityChanges: isSavingNonPostEntityChanges(),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { editPost, savePost } = dispatch( editorStore );\n\t\treturn {\n\t\t\tsavePostStatus: ( status ) => {\n\t\t\t\teditPost( { status }, { undoIgnore: true } );\n\t\t\t\tsavePost();\n\t\t\t},\n\t\t};\n\t} ),\n] )( PostPublishButton );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,SAAS,QAAQ,oBAAoB;AAC9C,SAASC,UAAU,EAAEC,YAAY,QAAQ,iBAAiB;AAC1D,SAASC,OAAO,QAAQ,oBAAoB;;AAE5C;AACA;AACA;AACA,OAAOC,kBAAkB,MAAM,SAAS;AACxC,SAASC,KAAK,IAAIC,WAAW,QAAQ,aAAa;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA;AAEnD,MAAMC,IAAI,GAAGA,CAAA,KAAM,CAAC,CAAC;AAErB,OAAO,MAAMC,iBAAiB,SAASZ,SAAS,CAAC;EAChDa,WAAWA,CAAEC,KAAK,EAAG;IACpB,KAAK,CAAEA,KAAM,CAAC;IAEd,IAAI,CAACC,aAAa,GAAG,IAAI,CAACA,aAAa,CAACC,IAAI,CAAE,IAAK,CAAC;IACpD,IAAI,CAACC,wBAAwB,GAC5B,IAAI,CAACA,wBAAwB,CAACD,IAAI,CAAE,IAAK,CAAC;IAE3C,IAAI,CAACE,KAAK,GAAG;MACZC,2BAA2B,EAAE;IAC9B,CAAC;EACF;EAEAJ,aAAaA,CAAEK,QAAQ,EAAG;IACzB,OAAO,CAAE,GAAGC,IAAI,KAAM;MACrB,MAAM;QAAEC,uBAAuB;QAAEC;MAA+B,CAAC,GAChE,IAAI,CAACT,KAAK;MACX;MACA;MACA;MACA;MACA;MACA,IAAKQ,uBAAuB,IAAIC,8BAA8B,EAAG;QAChE;QACA;QACA;QACA,IAAI,CAACC,QAAQ,CAAE;UACdL,2BAA2B,EAAEA,CAAA,KAAMC,QAAQ,CAAE,GAAGC,IAAK;QACtD,CAAE,CAAC;;QAEH;Q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AAS,CAAC;IAC9C3B,oBAAoB,EAAE4B,YAAY,CAAC,CAAC,EAAEE,MAAM;IAC5C3D,uBAAuB,EAAEA,uBAAuB,CAAC,CAAC;IAClD2B,4BAA4B,EAAEA,4BAA4B,CAAC;EAC5D,CAAC;AACF,CAAE,CAAC,EACH/C,YAAY,CAAIgF,QAAQ,IAAM;EAC7B,MAAM;IAAEC,QAAQ;IAAEC;EAAS,CAAC,GAAGF,QAAQ,CAAE5E,WAAY,CAAC;EACtD,OAAO;IACNuC,cAAc,EAAIoC,MAAM,IAAM;MAC7BE,QAAQ,CAAE;QAAEF;MAAO,CAAC,EAAE;QAAEI,UAAU,EAAE;MAAK,CAAE,CAAC;MAC5CD,QAAQ,CAAC,CAAC;IACX;EACD,CAAC;AACF,CAAE,CAAC,CACF,CAAC,CAAExE,iBAAkB,CAAC","ignoreList":[]}
@@ -16,9 +16,7 @@ import PostPublishButton from '../post-publish-button';
16
16
  import PostPublishPanelPrepublish from './prepublish';
17
17
  import PostPublishPanelPostpublish from './postpublish';
18
18
  import { store as editorStore } from '../../store';
19
- import { jsx as _jsx } from "react/jsx-runtime";
20
- import { Fragment as _Fragment } from "react/jsx-runtime";
21
- import { jsxs as _jsxs } from "react/jsx-runtime";
19
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
22
20
  export class PostPublishPanel extends Component {
23
21
  constructor() {
24
22
  super(...arguments);
@@ -1 +1 @@
1
- {"version":3,"names":["__","Component","createRef","Button","Spinner","CheckboxControl","withFocusReturn","withConstrainedTabbing","withSelect","withDispatch","compose","closeSmall","store","coreStore","PostPublishButton","PostPublishPanelPrepublish","PostPublishPanelPostpublish","editorStore","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","PostPublishPanel","constructor","arguments","onSubmit","bind","cancelButtonNode","componentDidMount","timeoutID","setTimeout","current","focus","componentWillUnmount","clearTimeout","componentDidUpdate","prevProps","isPublished","props","isSaving","isDirty","onClose","hasPublishAction","isPostTypeViewable","render","forceIsDirty","isBeingScheduled","isPublishSidebarEnabled","isScheduled","isSavingNonPostEntityChanges","onTogglePublishSidebar","PostPublishExtension","PrePublishExtension","additionalProps","propsForPanel","isPublishedOrScheduled","isPrePublish","isPostPublish","className","children","size","onClick","icon","label","ref","accessibleWhenDisabled","disabled","variant","focusOnMount","__nextHasNoMarginBottom","checked","onChange","select","_getCurrentPost$_link","getPostType","getCurrentPost","getEditedPostAttribute","isCurrentPostPublished","isCurrentPostScheduled","isEditedPostBeingScheduled","isEditedPostDirty","isAutosavingPost","isSavingPost","postType","_links","viewable","dispatch","disablePublishSidebar","enablePublishSidebar"],"sources":["@wordpress/editor/src/components/post-publish-panel/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Component, createRef } from '@wordpress/element';\nimport {\n\tButton,\n\tSpinner,\n\tCheckboxControl,\n\twithFocusReturn,\n\twithConstrainedTabbing,\n} from '@wordpress/components';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\nimport { closeSmall } from '@wordpress/icons';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport PostPublishButton from '../post-publish-button';\nimport PostPublishPanelPrepublish from './prepublish';\nimport PostPublishPanelPostpublish from './postpublish';\nimport { store as editorStore } from '../../store';\n\nexport class PostPublishPanel extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\t\tthis.onSubmit = this.onSubmit.bind( this );\n\t\tthis.cancelButtonNode = createRef();\n\t}\n\n\tcomponentDidMount() {\n\t\t// This timeout is necessary to make sure the `useEffect` hook of\n\t\t// `useFocusReturn` gets the correct element (the button that opens the\n\t\t// PostPublishPanel) otherwise it will get this button.\n\t\tthis.timeoutID = setTimeout( () => {\n\t\t\tthis.cancelButtonNode.current.focus();\n\t\t}, 0 );\n\t}\n\n\tcomponentWillUnmount() {\n\t\tclearTimeout( this.timeoutID );\n\t}\n\n\tcomponentDidUpdate( prevProps ) {\n\t\t// Automatically collapse the publish sidebar when a post\n\t\t// is published and the user makes an edit.\n\t\tif (\n\t\t\tprevProps.isPublished &&\n\t\t\t! this.props.isSaving &&\n\t\t\tthis.props.isDirty\n\t\t) {\n\t\t\tthis.props.onClose();\n\t\t}\n\t}\n\n\tonSubmit() {\n\t\tconst { onClose, hasPublishAction, isPostTypeViewable } = this.props;\n\t\tif ( ! hasPublishAction || ! isPostTypeViewable ) {\n\t\t\tonClose();\n\t\t}\n\t}\n\n\trender() {\n\t\tconst {\n\t\t\tforceIsDirty,\n\t\t\tisBeingScheduled,\n\t\t\tisPublished,\n\t\t\tisPublishSidebarEnabled,\n\t\t\tisScheduled,\n\t\t\tisSaving,\n\t\t\tisSavingNonPostEntityChanges,\n\t\t\tonClose,\n\t\t\tonTogglePublishSidebar,\n\t\t\tPostPublishExtension,\n\t\t\tPrePublishExtension,\n\t\t\t...additionalProps\n\t\t} = this.props;\n\t\tconst {\n\t\t\thasPublishAction,\n\t\t\tisDirty,\n\t\t\tisPostTypeViewable,\n\t\t\t...propsForPanel\n\t\t} = additionalProps;\n\t\tconst isPublishedOrScheduled =\n\t\t\tisPublished || ( isScheduled && isBeingScheduled );\n\t\tconst isPrePublish = ! isPublishedOrScheduled && ! isSaving;\n\t\tconst isPostPublish = isPublishedOrScheduled && ! isSaving;\n\t\treturn (\n\t\t\t<div className=\"editor-post-publish-panel\" { ...propsForPanel }>\n\t\t\t\t<div className=\"editor-post-publish-panel__header\">\n\t\t\t\t\t{ isPostPublish ? (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\tonClick={ onClose }\n\t\t\t\t\t\t\ticon={ closeSmall }\n\t\t\t\t\t\t\tlabel={ __( 'Close panel' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<div className=\"editor-post-publish-panel__header-cancel-button\">\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tref={ this.cancelButtonNode }\n\t\t\t\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\t\t\t\tdisabled={ isSavingNonPostEntityChanges }\n\t\t\t\t\t\t\t\t\tonClick={ onClose }\n\t\t\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<div className=\"editor-post-publish-panel__header-publish-button\">\n\t\t\t\t\t\t\t\t<PostPublishButton\n\t\t\t\t\t\t\t\t\tonSubmit={ this.onSubmit }\n\t\t\t\t\t\t\t\t\tforceIsDirty={ forceIsDirty }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t\t<div className=\"editor-post-publish-panel__content\">\n\t\t\t\t\t{ isPrePublish && (\n\t\t\t\t\t\t<PostPublishPanelPrepublish>\n\t\t\t\t\t\t\t{ PrePublishExtension && <PrePublishExtension /> }\n\t\t\t\t\t\t</PostPublishPanelPrepublish>\n\t\t\t\t\t) }\n\t\t\t\t\t{ isPostPublish && (\n\t\t\t\t\t\t<PostPublishPanelPostpublish focusOnMount>\n\t\t\t\t\t\t\t{ PostPublishExtension && <PostPublishExtension /> }\n\t\t\t\t\t\t</PostPublishPanelPostpublish>\n\t\t\t\t\t) }\n\t\t\t\t\t{ isSaving && <Spinner /> }\n\t\t\t\t</div>\n\t\t\t\t<div className=\"editor-post-publish-panel__footer\">\n\t\t\t\t\t<CheckboxControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Always show pre-publish checks.' ) }\n\t\t\t\t\t\tchecked={ isPublishSidebarEnabled }\n\t\t\t\t\t\tonChange={ onTogglePublishSidebar }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t);\n\t}\n}\n\n/**\n * Renders a panel for publishing a post.\n */\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst { getPostType } = select( coreStore );\n\t\tconst {\n\t\t\tgetCurrentPost,\n\t\t\tgetEditedPostAttribute,\n\t\t\tisCurrentPostPublished,\n\t\t\tisCurrentPostScheduled,\n\t\t\tisEditedPostBeingScheduled,\n\t\t\tisEditedPostDirty,\n\t\t\tisAutosavingPost,\n\t\t\tisSavingPost,\n\t\t\tisSavingNonPostEntityChanges,\n\t\t} = select( editorStore );\n\t\tconst { isPublishSidebarEnabled } = select( editorStore );\n\t\tconst postType = getPostType( getEditedPostAttribute( 'type' ) );\n\n\t\treturn {\n\t\t\thasPublishAction:\n\t\t\t\tgetCurrentPost()._links?.[ 'wp:action-publish' ] ?? false,\n\t\t\tisPostTypeViewable: postType?.viewable,\n\t\t\tisBeingScheduled: isEditedPostBeingScheduled(),\n\t\t\tisDirty: isEditedPostDirty(),\n\t\t\tisPublished: isCurrentPostPublished(),\n\t\t\tisPublishSidebarEnabled: isPublishSidebarEnabled(),\n\t\t\tisSaving: isSavingPost() && ! isAutosavingPost(),\n\t\t\tisSavingNonPostEntityChanges: isSavingNonPostEntityChanges(),\n\t\t\tisScheduled: isCurrentPostScheduled(),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch, { isPublishSidebarEnabled } ) => {\n\t\tconst { disablePublishSidebar, enablePublishSidebar } =\n\t\t\tdispatch( editorStore );\n\t\treturn {\n\t\t\tonTogglePublishSidebar: () => {\n\t\t\t\tif ( isPublishSidebarEnabled ) {\n\t\t\t\t\tdisablePublishSidebar();\n\t\t\t\t} else {\n\t\t\t\t\tenablePublishSidebar();\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t} ),\n\twithFocusReturn,\n\twithConstrainedTabbing,\n] )( PostPublishPanel );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAA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AC,CAAC;MACvB;IACD;EACD,CAAC;AACF,CAAE,CAAC,EACHpF,eAAe,EACfC,sBAAsB,CACrB,CAAC,CAAEiB,gBAAiB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["__","Component","createRef","Button","Spinner","CheckboxControl","withFocusReturn","withConstrainedTabbing","withSelect","withDispatch","compose","closeSmall","store","coreStore","PostPublishButton","PostPublishPanelPrepublish","PostPublishPanelPostpublish","editorStore","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","PostPublishPanel","constructor","arguments","onSubmit","bind","cancelButtonNode","componentDidMount","timeoutID","setTimeout","current","focus","componentWillUnmount","clearTimeout","componentDidUpdate","prevProps","isPublished","props","isSaving","isDirty","onClose","hasPublishAction","isPostTypeViewable","render","forceIsDirty","isBeingScheduled","isPublishSidebarEnabled","isScheduled","isSavingNonPostEntityChanges","onTogglePublishSidebar","PostPublishExtension","PrePublishExtension","additionalProps","propsForPanel","isPublishedOrScheduled","isPrePublish","isPostPublish","className","children","size","onClick","icon","label","ref","accessibleWhenDisabled","disabled","variant","focusOnMount","__nextHasNoMarginBottom","checked","onChange","select","_getCurrentPost$_link","getPostType","getCurrentPost","getEditedPostAttribute","isCurrentPostPublished","isCurrentPostScheduled","isEditedPostBeingScheduled","isEditedPostDirty","isAutosavingPost","isSavingPost","postType","_links","viewable","dispatch","disablePublishSidebar","enablePublishSidebar"],"sources":["@wordpress/editor/src/components/post-publish-panel/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Component, createRef } from '@wordpress/element';\nimport {\n\tButton,\n\tSpinner,\n\tCheckboxControl,\n\twithFocusReturn,\n\twithConstrainedTabbing,\n} from '@wordpress/components';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\nimport { closeSmall } from '@wordpress/icons';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport PostPublishButton from '../post-publish-button';\nimport PostPublishPanelPrepublish from './prepublish';\nimport PostPublishPanelPostpublish from './postpublish';\nimport { store as editorStore } from '../../store';\n\nexport class PostPublishPanel extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\t\tthis.onSubmit = this.onSubmit.bind( this );\n\t\tthis.cancelButtonNode = createRef();\n\t}\n\n\tcomponentDidMount() {\n\t\t// This timeout is necessary to make sure the `useEffect` hook of\n\t\t// `useFocusReturn` gets the correct element (the button that opens the\n\t\t// PostPublishPanel) otherwise it will get this button.\n\t\tthis.timeoutID = setTimeout( () => {\n\t\t\tthis.cancelButtonNode.current.focus();\n\t\t}, 0 );\n\t}\n\n\tcomponentWillUnmount() {\n\t\tclearTimeout( this.timeoutID );\n\t}\n\n\tcomponentDidUpdate( prevProps ) {\n\t\t// Automatically collapse the publish sidebar when a post\n\t\t// is published and the user makes an edit.\n\t\tif (\n\t\t\tprevProps.isPublished &&\n\t\t\t! this.props.isSaving &&\n\t\t\tthis.props.isDirty\n\t\t) {\n\t\t\tthis.props.onClose();\n\t\t}\n\t}\n\n\tonSubmit() {\n\t\tconst { onClose, hasPublishAction, isPostTypeViewable } = this.props;\n\t\tif ( ! hasPublishAction || ! isPostTypeViewable ) {\n\t\t\tonClose();\n\t\t}\n\t}\n\n\trender() {\n\t\tconst {\n\t\t\tforceIsDirty,\n\t\t\tisBeingScheduled,\n\t\t\tisPublished,\n\t\t\tisPublishSidebarEnabled,\n\t\t\tisScheduled,\n\t\t\tisSaving,\n\t\t\tisSavingNonPostEntityChanges,\n\t\t\tonClose,\n\t\t\tonTogglePublishSidebar,\n\t\t\tPostPublishExtension,\n\t\t\tPrePublishExtension,\n\t\t\t...additionalProps\n\t\t} = this.props;\n\t\tconst {\n\t\t\thasPublishAction,\n\t\t\tisDirty,\n\t\t\tisPostTypeViewable,\n\t\t\t...propsForPanel\n\t\t} = additionalProps;\n\t\tconst isPublishedOrScheduled =\n\t\t\tisPublished || ( isScheduled && isBeingScheduled );\n\t\tconst isPrePublish = ! isPublishedOrScheduled && ! isSaving;\n\t\tconst isPostPublish = isPublishedOrScheduled && ! isSaving;\n\t\treturn (\n\t\t\t<div className=\"editor-post-publish-panel\" { ...propsForPanel }>\n\t\t\t\t<div className=\"editor-post-publish-panel__header\">\n\t\t\t\t\t{ isPostPublish ? (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\tonClick={ onClose }\n\t\t\t\t\t\t\ticon={ closeSmall }\n\t\t\t\t\t\t\tlabel={ __( 'Close panel' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<div className=\"editor-post-publish-panel__header-cancel-button\">\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tref={ this.cancelButtonNode }\n\t\t\t\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\t\t\t\tdisabled={ isSavingNonPostEntityChanges }\n\t\t\t\t\t\t\t\t\tonClick={ onClose }\n\t\t\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<div className=\"editor-post-publish-panel__header-publish-button\">\n\t\t\t\t\t\t\t\t<PostPublishButton\n\t\t\t\t\t\t\t\t\tonSubmit={ this.onSubmit }\n\t\t\t\t\t\t\t\t\tforceIsDirty={ forceIsDirty }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t\t<div className=\"editor-post-publish-panel__content\">\n\t\t\t\t\t{ isPrePublish && (\n\t\t\t\t\t\t<PostPublishPanelPrepublish>\n\t\t\t\t\t\t\t{ PrePublishExtension && <PrePublishExtension /> }\n\t\t\t\t\t\t</PostPublishPanelPrepublish>\n\t\t\t\t\t) }\n\t\t\t\t\t{ isPostPublish && (\n\t\t\t\t\t\t<PostPublishPanelPostpublish focusOnMount>\n\t\t\t\t\t\t\t{ PostPublishExtension && <PostPublishExtension /> }\n\t\t\t\t\t\t</PostPublishPanelPostpublish>\n\t\t\t\t\t) }\n\t\t\t\t\t{ isSaving && <Spinner /> }\n\t\t\t\t</div>\n\t\t\t\t<div className=\"editor-post-publish-panel__footer\">\n\t\t\t\t\t<CheckboxControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Always show pre-publish checks.' ) }\n\t\t\t\t\t\tchecked={ isPublishSidebarEnabled }\n\t\t\t\t\t\tonChange={ onTogglePublishSidebar }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t);\n\t}\n}\n\n/**\n * Renders a panel for publishing a post.\n */\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst { getPostType } = select( coreStore );\n\t\tconst {\n\t\t\tgetCurrentPost,\n\t\t\tgetEditedPostAttribute,\n\t\t\tisCurrentPostPublished,\n\t\t\tisCurrentPostScheduled,\n\t\t\tisEditedPostBeingScheduled,\n\t\t\tisEditedPostDirty,\n\t\t\tisAutosavingPost,\n\t\t\tisSavingPost,\n\t\t\tisSavingNonPostEntityChanges,\n\t\t} = select( editorStore );\n\t\tconst { isPublishSidebarEnabled } = select( editorStore );\n\t\tconst postType = getPostType( getEditedPostAttribute( 'type' ) );\n\n\t\treturn {\n\t\t\thasPublishAction:\n\t\t\t\tgetCurrentPost()._links?.[ 'wp:action-publish' ] ?? false,\n\t\t\tisPostTypeViewable: postType?.viewable,\n\t\t\tisBeingScheduled: isEditedPostBeingScheduled(),\n\t\t\tisDirty: isEditedPostDirty(),\n\t\t\tisPublished: isCurrentPostPublished(),\n\t\t\tisPublishSidebarEnabled: isPublishSidebarEnabled(),\n\t\t\tisSaving: isSavingPost() && ! isAutosavingPost(),\n\t\t\tisSavingNonPostEntityChanges: isSavingNonPostEntityChanges(),\n\t\t\tisScheduled: isCurrentPostScheduled(),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch, { isPublishSidebarEnabled } ) => {\n\t\tconst { disablePublishSidebar, enablePublishSidebar } =\n\t\t\tdispatch( editorStore );\n\t\treturn {\n\t\t\tonTogglePublishSidebar: () => {\n\t\t\t\tif ( isPublishSidebarEnabled ) {\n\t\t\t\t\tdisablePublishSidebar();\n\t\t\t\t} else {\n\t\t\t\t\tenablePublishSidebar();\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t} ),\n\twithFocusReturn,\n\twithConstrainedTabbing,\n] )( PostPublishPanel );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,SAAS,EAAEC,SAAS,QAAQ,oBAAoB;AACzD,SACCC,MAAM,EACNC,OAAO,EACPC,eAAe,EACfC,eAAe,EACfC,sBAAsB,QAChB,uBAAuB;AAC9B,SAASC,UAAU,EAAEC,YAAY,QAAQ,iBAAiB;AAC1D,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,UAAU,QAAQ,kBAAkB;AAC7C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;;AAEzD;AACA;AACA;AACA,OAAOC,iBAAiB,MAAM,wBAAwB;AACtD,OAAOC,0BAA0B,MAAM,cAAc;AACrD,OAAOC,2BAA2B,MAAM,eAAe;AACvD,SAASJ,KAAK,IAAIK,WAAW,QAAQ,aAAa;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA,EAAAC,IAAA,IAAAC,KAAA;AAEnD,OAAO,MAAMC,gBAAgB,SAASvB,SAAS,CAAC;EAC/CwB,WAAWA,CAAA,EAAG;IACb,KAAK,CAAE,GAAGC,SAAU,CAAC;IACrB,IAAI,CAACC,QAAQ,GAAG,IAAI,CAACA,QAAQ,CAACC,IAAI,CAAE,IAAK,CAAC;IAC1C,IAAI,C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C,CAAC,IAAI,CAAED,gBAAgB,CAAC,CAAC;IAChDhC,4BAA4B,EAAEA,4BAA4B,CAAC,CAAC;IAC5DD,WAAW,EAAE8B,sBAAsB,CAAC;EACrC,CAAC;AACF,CAAE,CAAC,EACHvE,YAAY,CAAE,CAAE+E,QAAQ,EAAE;EAAEvC;AAAwB,CAAC,KAAM;EAC1D,MAAM;IAAEwC,qBAAqB;IAAEC;EAAqB,CAAC,GACpDF,QAAQ,CAAEvE,WAAY,CAAC;EACxB,OAAO;IACNmC,sBAAsB,EAAEA,CAAA,KAAM;MAC7B,IAAKH,uBAAuB,EAAG;QAC9BwC,qBAAqB,CAAC,CAAC;MACxB,CAAC,MAAM;QACNC,oBAAoB,CAAC,CAAC;MACvB;IACD;EACD,CAAC;AACF,CAAE,CAAC,EACHpF,eAAe,EACfC,sBAAsB,CACrB,CAAC,CAAEiB,gBAAiB,CAAC","ignoreList":[]}
@@ -12,8 +12,7 @@ import { useState, useEffect } from '@wordpress/element';
12
12
  */
13
13
  import HierarchicalTermSelector from '../post-taxonomies/hierarchical-term-selector';
14
14
  import { store as editorStore } from '../../store';
15
- import { jsx as _jsx } from "react/jsx-runtime";
16
- import { jsxs as _jsxs } from "react/jsx-runtime";
15
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
17
16
  function MaybeCategoryPanel() {
18
17
  const hasNoCategory = useSelect(select => {
19
18
  const postType = select(editorStore).getCurrentPostType();
@@ -1 +1 @@
1
- {"version":3,"names":["__","useSelect","PanelBody","store","coreStore","useState","useEffect","HierarchicalTermSelector","editorStore","jsx","_jsx","jsxs","_jsxs","MaybeCategoryPanel","hasNoCategory","select","postType","getCurrentPostType","canUser","getEntityRecord","getTaxonomy","categoriesTaxonomy","defaultCategoryId","kind","name","default_category","undefined","defaultCategory","postTypeSupportsCategories","types","some","type","categories","getEditedPostAttribute","rest_base","length","id","shouldShowPanel","setShouldShowPanel","panelBodyTitle","className","children","initialOpen","title","slug"],"sources":["@wordpress/editor/src/components/post-publish-panel/maybe-category-panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { PanelBody } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useState, useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport HierarchicalTermSelector from '../post-taxonomies/hierarchical-term-selector';\nimport { store as editorStore } from '../../store';\n\nfunction MaybeCategoryPanel() {\n\tconst hasNoCategory = useSelect( ( select ) => {\n\t\tconst postType = select( editorStore ).getCurrentPostType();\n\t\tconst { canUser, getEntityRecord, getTaxonomy } = select( coreStore );\n\t\tconst categoriesTaxonomy = getTaxonomy( 'category' );\n\t\tconst defaultCategoryId = canUser( 'read', {\n\t\t\tkind: 'root',\n\t\t\tname: 'site',\n\t\t} )\n\t\t\t? getEntityRecord( 'root', 'site' )?.default_category\n\t\t\t: undefined;\n\t\tconst defaultCategory = defaultCategoryId\n\t\t\t? getEntityRecord( 'taxonomy', 'category', defaultCategoryId )\n\t\t\t: undefined;\n\t\tconst postTypeSupportsCategories =\n\t\t\tcategoriesTaxonomy &&\n\t\t\tcategoriesTaxonomy.types.some( ( type ) => type === postType );\n\t\tconst categories =\n\t\t\tcategoriesTaxonomy &&\n\t\t\tselect( editorStore ).getEditedPostAttribute(\n\t\t\t\tcategoriesTaxonomy.rest_base\n\t\t\t);\n\n\t\t// This boolean should return true if everything is loaded\n\t\t// ( categoriesTaxonomy, defaultCategory )\n\t\t// and the post has not been assigned a category different than \"uncategorized\".\n\t\treturn (\n\t\t\t!! categoriesTaxonomy &&\n\t\t\t!! defaultCategory &&\n\t\t\tpostTypeSupportsCategories &&\n\t\t\t( categories?.length === 0 ||\n\t\t\t\t( categories?.length === 1 &&\n\t\t\t\t\tdefaultCategory?.id === categories[ 0 ] ) )\n\t\t);\n\t}, [] );\n\tconst [ shouldShowPanel, setShouldShowPanel ] = useState( false );\n\tuseEffect( () => {\n\t\t// We use state to avoid hiding the panel if the user edits the categories\n\t\t// and adds one within the panel itself (while visible).\n\t\tif ( hasNoCategory ) {\n\t\t\tsetShouldShowPanel( true );\n\t\t}\n\t}, [ hasNoCategory ] );\n\n\tif ( ! shouldShowPanel ) {\n\t\treturn null;\n\t}\n\n\tconst panelBodyTitle = [\n\t\t__( 'Suggestion:' ),\n\t\t<span className=\"editor-post-publish-panel__link\" key=\"label\">\n\t\t\t{ __( 'Assign a category' ) }\n\t\t</span>,\n\t];\n\n\treturn (\n\t\t<PanelBody initialOpen={ false } title={ panelBodyTitle }>\n\t\t\t<p>\n\t\t\t\t{ __(\n\t\t\t\t\t'Categories provide a helpful way to group related posts together and to quickly tell readers what a post is about.'\n\t\t\t\t) }\n\t\t\t</p>\n\t\t\t<HierarchicalTermSelector slug=\"category\" />\n\t\t</PanelBody>\n\t);\n}\n\nexport default MaybeCategoryPanel;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,SAAS,QAAQ,uBAAuB;AACjD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,QAAQ,EAAEC,SAAS,QAAQ,oBAAoB;;AAExD;AACA;AACA;AACA,OAAOC,wBAAwB,MAAM,+CAA+C;AACpF,SAASJ,KAAK,IAAIK,WAAW,QAAQ,aAAa;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAEnD,SAASC,kBAAkBA,CAAA,EAAG;EAC7B,MAAMC,aAAa,GAAGb,SAAS,CAAIc,MAAM,IAAM;IAC9C,MAAMC,QAAQ,GAAGD,MAAM,CAAEP,WAAY,CAAC,CAACS,kBAAkB,CAAC,CAAC;IAC3D,MAAM;MAAEC,OAAO;MAAEC,eAAe;MAAEC;IAAY,CAAC,GAAGL,MAAM,CAAEX,SAAU,CAAC;IACrE,MAAMiB,kBAAkB,GAAGD,WAAW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E,mBAAoB;EAAC,GAD0B,OAEhD,CAAC,CACP;EAED,oBACCY,KAAA,CAACV,SAAS;IAACwC,WAAW,EAAG,KAAO;IAACC,KAAK,EAAGJ,cAAgB;IAAAE,QAAA,gBACxD/B,IAAA;MAAA+B,QAAA,EACGzC,EAAE,CACH,oHACD;IAAC,CACC,CAAC,eACJU,IAAA,CAACH,wBAAwB;MAACqC,IAAI,EAAC;IAAU,CAAE,CAAC;EAAA,CAClC,CAAC;AAEd;AAEA,eAAe/B,kBAAkB","ignoreList":[]}
1
+ {"version":3,"names":["__","useSelect","PanelBody","store","coreStore","useState","useEffect","HierarchicalTermSelector","editorStore","jsx","_jsx","jsxs","_jsxs","MaybeCategoryPanel","hasNoCategory","select","postType","getCurrentPostType","canUser","getEntityRecord","getTaxonomy","categoriesTaxonomy","defaultCategoryId","kind","name","default_category","undefined","defaultCategory","postTypeSupportsCategories","types","some","type","categories","getEditedPostAttribute","rest_base","length","id","shouldShowPanel","setShouldShowPanel","panelBodyTitle","className","children","initialOpen","title","slug"],"sources":["@wordpress/editor/src/components/post-publish-panel/maybe-category-panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { PanelBody } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useState, useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport HierarchicalTermSelector from '../post-taxonomies/hierarchical-term-selector';\nimport { store as editorStore } from '../../store';\n\nfunction MaybeCategoryPanel() {\n\tconst hasNoCategory = useSelect( ( select ) => {\n\t\tconst postType = select( editorStore ).getCurrentPostType();\n\t\tconst { canUser, getEntityRecord, getTaxonomy } = select( coreStore );\n\t\tconst categoriesTaxonomy = getTaxonomy( 'category' );\n\t\tconst defaultCategoryId = canUser( 'read', {\n\t\t\tkind: 'root',\n\t\t\tname: 'site',\n\t\t} )\n\t\t\t? getEntityRecord( 'root', 'site' )?.default_category\n\t\t\t: undefined;\n\t\tconst defaultCategory = defaultCategoryId\n\t\t\t? getEntityRecord( 'taxonomy', 'category', defaultCategoryId )\n\t\t\t: undefined;\n\t\tconst postTypeSupportsCategories =\n\t\t\tcategoriesTaxonomy &&\n\t\t\tcategoriesTaxonomy.types.some( ( type ) => type === postType );\n\t\tconst categories =\n\t\t\tcategoriesTaxonomy &&\n\t\t\tselect( editorStore ).getEditedPostAttribute(\n\t\t\t\tcategoriesTaxonomy.rest_base\n\t\t\t);\n\n\t\t// This boolean should return true if everything is loaded\n\t\t// ( categoriesTaxonomy, defaultCategory )\n\t\t// and the post has not been assigned a category different than \"uncategorized\".\n\t\treturn (\n\t\t\t!! categoriesTaxonomy &&\n\t\t\t!! defaultCategory &&\n\t\t\tpostTypeSupportsCategories &&\n\t\t\t( categories?.length === 0 ||\n\t\t\t\t( categories?.length === 1 &&\n\t\t\t\t\tdefaultCategory?.id === categories[ 0 ] ) )\n\t\t);\n\t}, [] );\n\tconst [ shouldShowPanel, setShouldShowPanel ] = useState( false );\n\tuseEffect( () => {\n\t\t// We use state to avoid hiding the panel if the user edits the categories\n\t\t// and adds one within the panel itself (while visible).\n\t\tif ( hasNoCategory ) {\n\t\t\tsetShouldShowPanel( true );\n\t\t}\n\t}, [ hasNoCategory ] );\n\n\tif ( ! shouldShowPanel ) {\n\t\treturn null;\n\t}\n\n\tconst panelBodyTitle = [\n\t\t__( 'Suggestion:' ),\n\t\t<span className=\"editor-post-publish-panel__link\" key=\"label\">\n\t\t\t{ __( 'Assign a category' ) }\n\t\t</span>,\n\t];\n\n\treturn (\n\t\t<PanelBody initialOpen={ false } title={ panelBodyTitle }>\n\t\t\t<p>\n\t\t\t\t{ __(\n\t\t\t\t\t'Categories provide a helpful way to group related posts together and to quickly tell readers what a post is about.'\n\t\t\t\t) }\n\t\t\t</p>\n\t\t\t<HierarchicalTermSelector slug=\"category\" />\n\t\t</PanelBody>\n\t);\n}\n\nexport default MaybeCategoryPanel;\n"],"mappings":"AAAA;AACA;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ACC,CAAC,CAAEb,kBAAkB,IACrB,CAAC,CAAEM,eAAe,IAClBC,0BAA0B,KACxBI,UAAU,EAAEG,MAAM,KAAK,CAAC,IACvBH,UAAU,EAAEG,MAAM,KAAK,CAAC,IACzBR,eAAe,EAAES,EAAE,KAAKJ,UAAU,CAAE,CAAC,CAAI,CAAE;EAE/C,CAAC,EAAE,EAAG,CAAC;EACP,MAAM,CAAEK,eAAe,EAAEC,kBAAkB,CAAE,GAAGjC,QAAQ,CAAE,KAAM,CAAC;EACjEC,SAAS,CAAE,MAAM;IAChB;IACA;IACA,IAAKQ,aAAa,EAAG;MACpBwB,kBAAkB,CAAE,IAAK,CAAC;IAC3B;EACD,CAAC,EAAE,CAAExB,aAAa,CAAG,CAAC;EAEtB,IAAK,CAAEuB,eAAe,EAAG;IACxB,OAAO,IAAI;EACZ;EAEA,MAAME,cAAc,GAAG,CACtBvC,EAAE,CAAE,aAAc,CAAC,eACnBU,IAAA;IAAM8B,SAAS,EAAC,iCAAiC;IAAAC,QAAA,EAC9CzC,EAAE,CAAE,mBAAoB;EAAC,GAD0B,OAEhD,CAAC,CACP;EAED,oBACCY,KAAA,CAACV,SAAS;IAACwC,WAAW,EAAG,KAAO;IAACC,KAAK,EAAGJ,cAAgB;IAAAE,QAAA,gBACxD/B,IAAA;MAAA+B,QAAA,EACGzC,EAAE,CACH,oHACD;IAAC,CACC,CAAC,eACJU,IAAA,CAACH,wBAAwB;MAACqC,IAAI,EAAC;IAAU,CAAE,CAAC;EAAA,CAClC,CAAC;AAEd;AAEA,eAAe/B,kBAAkB","ignoreList":[]}
@@ -11,8 +11,7 @@ import { store as coreStore } from '@wordpress/core-data';
11
11
  */
12
12
  import { POST_FORMATS } from '../post-format';
13
13
  import { store as editorStore } from '../../store';
14
- import { jsx as _jsx } from "react/jsx-runtime";
15
- import { jsxs as _jsxs } from "react/jsx-runtime";
14
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
16
15
  const getSuggestion = (supportedFormats, suggestedPostFormat) => {
17
16
  const formats = POST_FORMATS.filter(format => supportedFormats?.includes(format.id));
18
17
  return formats.find(format => format.id === suggestedPostFormat);
@@ -65,7 +64,7 @@ export default function PostFormatPanel() {
65
64
  children: /*#__PURE__*/_jsx(PostFormatSuggestion, {
66
65
  onUpdatePostFormat: onUpdatePostFormat,
67
66
  suggestedPostFormat: suggestion.id,
68
- suggestionText: sprintf( /* translators: %s: post format */
67
+ suggestionText: sprintf(/* translators: %s: post format */
69
68
  __('Apply the "%1$s" format.'), suggestion.caption)
70
69
  })
71
70
  })]
@@ -1 +1 @@
1
- {"version":3,"names":["Button","PanelBody","useDispatch","useSelect","__","sprintf","store","coreStore","POST_FORMATS","editorStore","jsx","_jsx","jsxs","_jsxs","getSuggestion","supportedFormats","suggestedPostFormat","formats","filter","format","includes","id","find","PostFormatSuggestion","suggestionText","onUpdatePostFormat","__next40pxDefaultSize","variant","onClick","children","PostFormatPanel","currentPostFormat","suggestion","select","_select$getThemeSuppo","getEditedPostAttribute","getSuggestedPostFormat","getThemeSupports","editPost","panelBodyTitle","className","initialOpen","title","caption"],"sources":["@wordpress/editor/src/components/post-publish-panel/maybe-post-format-panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Button, PanelBody } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { POST_FORMATS } from '../post-format';\nimport { store as editorStore } from '../../store';\n\nconst getSuggestion = ( supportedFormats, suggestedPostFormat ) => {\n\tconst formats = POST_FORMATS.filter( ( format ) =>\n\t\tsupportedFormats?.includes( format.id )\n\t);\n\treturn formats.find( ( format ) => format.id === suggestedPostFormat );\n};\n\nconst PostFormatSuggestion = ( {\n\tsuggestedPostFormat,\n\tsuggestionText,\n\tonUpdatePostFormat,\n} ) => (\n\t<Button\n\t\t__next40pxDefaultSize\n\t\tvariant=\"link\"\n\t\tonClick={ () => onUpdatePostFormat( suggestedPostFormat ) }\n\t>\n\t\t{ suggestionText }\n\t</Button>\n);\n\nexport default function PostFormatPanel() {\n\tconst { currentPostFormat, suggestion } = useSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute, getSuggestedPostFormat } =\n\t\t\tselect( editorStore );\n\t\tconst supportedFormats =\n\t\t\tselect( coreStore ).getThemeSupports().formats ?? [];\n\t\treturn {\n\t\t\tcurrentPostFormat: getEditedPostAttribute( 'format' ),\n\t\t\tsuggestion: getSuggestion(\n\t\t\t\tsupportedFormats,\n\t\t\t\tgetSuggestedPostFormat()\n\t\t\t),\n\t\t};\n\t}, [] );\n\n\tconst { editPost } = useDispatch( editorStore );\n\n\tconst onUpdatePostFormat = ( format ) => editPost( { format } );\n\n\tconst panelBodyTitle = [\n\t\t__( 'Suggestion:' ),\n\t\t<span className=\"editor-post-publish-panel__link\" key=\"label\">\n\t\t\t{ __( 'Use a post format' ) }\n\t\t</span>,\n\t];\n\n\tif ( ! suggestion || suggestion.id === currentPostFormat ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PanelBody initialOpen={ false } title={ panelBodyTitle }>\n\t\t\t<p>\n\t\t\t\t{ __(\n\t\t\t\t\t'Your theme uses post formats to highlight different kinds of content, like images or videos. Apply a post format to see this special styling.'\n\t\t\t\t) }\n\t\t\t</p>\n\t\t\t<p>\n\t\t\t\t<PostFormatSuggestion\n\t\t\t\t\tonUpdatePostFormat={ onUpdatePostFormat }\n\t\t\t\t\tsuggestedPostFormat={ suggestion.id }\n\t\t\t\t\tsuggestionText={ sprintf(\n\t\t\t\t\t\t/* translators: %s: post format */\n\t\t\t\t\t\t__( 'Apply the \"%1$s\" format.' ),\n\t\t\t\t\t\tsuggestion.caption\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</p>\n\t\t</PanelBody>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,MAAM,EAAEC,SAAS,QAAQ,uBAAuB;A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NH,iBAAiB,EAAEI,sBAAsB,CAAE,QAAS,CAAC;MACrDH,UAAU,EAAElB,aAAa,CACxBC,gBAAgB,EAChBqB,sBAAsB,CAAC,CACxB;IACD,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,MAAM;IAAEE;EAAS,CAAC,GAAGpC,WAAW,CAAEO,WAAY,CAAC;EAE/C,MAAMgB,kBAAkB,GAAKN,MAAM,IAAMmB,QAAQ,CAAE;IAAEnB;EAAO,CAAE,CAAC;EAE/D,MAAMoB,cAAc,GAAG,CACtBnC,EAAE,CAAE,aAAc,CAAC,eACnBO,IAAA;IAAM6B,SAAS,EAAC,iCAAiC;IAAAX,QAAA,EAC9CzB,EAAE,CAAE,mBAAoB;EAAC,GAD0B,OAEhD,CAAC,CACP;EAED,IAAK,CAAE4B,UAAU,IAAIA,UAAU,CAACX,EAAE,KAAKU,iBAAiB,EAAG;IAC1D,OAAO,IAAI;EACZ;EAEA,oBACClB,KAAA,CAACZ,SAAS;IAACwC,WAAW,EAAG,KAAO;IAACC,KAAK,EAAGH,cAAgB;IAAAV,QAAA,gBACxDlB,IAAA;MAAAkB,QAAA,EACGzB,EAAE,CACH,+IACD;IAAC,CACC,CAAC,eACJO,IAAA;MAAAkB,QAAA,eACClB,IAAA,CAACY,oBAAoB;QACpBE,kBAAkB,EAAGA,kBAAoB;QACzCT,mBAAmB,EAAGgB,UAAU,CAACX,EAAI;QACrCG,cAAc,EAAGnB,OAAO,EACvB;QACAD,EAAE,CAAE,0BAA2B,CAAC,EAChC4B,UAAU,CAACW,OACZ;MAAG,CACH;IAAC,CACA,CAAC;EAAA,CACM,CAAC;AAEd","ignoreList":[]}
1
+ {"version":3,"names":["Button","PanelBody","useDispatch","useSelect","__","sprintf","store","coreStore","POST_FORMATS","editorStore","jsx","_jsx","jsxs","_jsxs","getSuggestion","supportedFormats","suggestedPostFormat","formats","filter","format","includes","id","find","PostFormatSuggestion","suggestionText","onUpdatePostFormat","__next40pxDefaultSize","variant","onClick","children","PostFormatPanel","currentPostFormat","suggestion","select","_select$getThemeSuppo","getEditedPostAttribute","getSuggestedPostFormat","getThemeSupports","editPost","panelBodyTitle","className","initialOpen","title","caption"],"sources":["@wordpress/editor/src/components/post-publish-panel/maybe-post-format-panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Button, PanelBody } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { POST_FORMATS } from '../post-format';\nimport { store as editorStore } from '../../store';\n\nconst getSuggestion = ( supportedFormats, suggestedPostFormat ) => {\n\tconst formats = POST_FORMATS.filter( ( format ) =>\n\t\tsupportedFormats?.includes( format.id )\n\t);\n\treturn formats.find( ( format ) => format.id === suggestedPostFormat );\n};\n\nconst PostFormatSuggestion = ( {\n\tsuggestedPostFormat,\n\tsuggestionText,\n\tonUpdatePostFormat,\n} ) => (\n\t<Button\n\t\t__next40pxDefaultSize\n\t\tvariant=\"link\"\n\t\tonClick={ () => onUpdatePostFormat( suggestedPostFormat ) }\n\t>\n\t\t{ suggestionText }\n\t</Button>\n);\n\nexport default function PostFormatPanel() {\n\tconst { currentPostFormat, suggestion } = useSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute, getSuggestedPostFormat } =\n\t\t\tselect( editorStore );\n\t\tconst supportedFormats =\n\t\t\tselect( coreStore ).getThemeSupports().formats ?? [];\n\t\treturn {\n\t\t\tcurrentPostFormat: getEditedPostAttribute( 'format' ),\n\t\t\tsuggestion: getSuggestion(\n\t\t\t\tsupportedFormats,\n\t\t\t\tgetSuggestedPostFormat()\n\t\t\t),\n\t\t};\n\t}, [] );\n\n\tconst { editPost } = useDispatch( editorStore );\n\n\tconst onUpdatePostFormat = ( format ) => editPost( { format } );\n\n\tconst panelBodyTitle = [\n\t\t__( 'Suggestion:' ),\n\t\t<span className=\"editor-post-publish-panel__link\" key=\"label\">\n\t\t\t{ __( 'Use a post format' ) }\n\t\t</span>,\n\t];\n\n\tif ( ! suggestion || suggestion.id === currentPostFormat ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PanelBody initialOpen={ false } title={ panelBodyTitle }>\n\t\t\t<p>\n\t\t\t\t{ __(\n\t\t\t\t\t'Your theme uses post formats to highlight different kinds of content, like images or videos. Apply a post format to see this special styling.'\n\t\t\t\t) }\n\t\t\t</p>\n\t\t\t<p>\n\t\t\t\t<PostFormatSuggestion\n\t\t\t\t\tonUpdatePostFormat={ onUpdatePostFormat }\n\t\t\t\t\tsuggestedPostFormat={ suggestion.id }\n\t\t\t\t\tsuggestionText={ sprintf(\n\t\t\t\t\t\t/* translators: %s: post format */\n\t\t\t\t\t\t__( 'Apply the \"%1$s\" format.' ),\n\t\t\t\t\t\tsuggestion.caption\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</p>\n\t\t</PanelBody>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,MAAM,EAAEC,SAAS,QAAQ,uBAAuB;AACzD,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;;AAEzD;AACA;AACA;AACA,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,SAASF,KAAK,IAAIG,WAAW,QAAQ,aAAa;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAEnD,MAAMC,aAAa,GAAGA,CAAEC,gBAAgB,EAAEC,mBAAmB,KAAM;EAClE,MAAMC,OAAO,GAAGT,YAAY,CAACU,MAAM,CAAIC,MAAM,IAC5CJ,gBAAgB,EAAEK,QAAQ,CAAED,MAAM,CAACE,EAAG,CACvC,CAAC;EACD,OAAOJ,OAAO,CAACK,IAAI,CAAIH,MAAM,IAAMA,MAAM,CAACE,EAAE,KAAKL,mBA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;EACZ;EAEA,oBACClB,KAAA,CAACZ,SAAS;IAACwC,WAAW,EAAG,KAAO;IAACC,KAAK,EAAGH,cAAgB;IAAAV,QAAA,gBACxDlB,IAAA;MAAAkB,QAAA,EACGzB,EAAE,CACH,+IACD;IAAC,CACC,CAAC,eACJO,IAAA;MAAAkB,QAAA,eACClB,IAAA,CAACY,oBAAoB;QACpBE,kBAAkB,EAAGA,kBAAoB;QACzCT,mBAAmB,EAAGgB,UAAU,CAACX,EAAI;QACrCG,cAAc,EAAGnB,OAAO,CACvB;QACAD,EAAE,CAAE,0BAA2B,CAAC,EAChC4B,UAAU,CAACW,OACZ;MAAG,CACH;IAAC,CACA,CAAC;EAAA,CACM,CAAC;AAEd","ignoreList":[]}
@@ -12,8 +12,7 @@ import { store as coreStore } from '@wordpress/core-data';
12
12
  */
13
13
  import FlatTermSelector from '../post-taxonomies/flat-term-selector';
14
14
  import { store as editorStore } from '../../store';
15
- import { jsx as _jsx } from "react/jsx-runtime";
16
- import { jsxs as _jsxs } from "react/jsx-runtime";
15
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
17
16
  const TagsPanel = () => {
18
17
  const panelBodyTitle = [__('Suggestion:'), /*#__PURE__*/_jsx("span", {
19
18
  className: "editor-post-publish-panel__link",
@@ -1 +1 @@
1
- {"version":3,"names":["__","useState","useSelect","PanelBody","store","coreStore","FlatTermSelector","editorStore","jsx","_jsx","jsxs","_jsxs","TagsPanel","panelBodyTitle","className","children","initialOpen","title","slug","__nextHasNoMarginBottom","MaybeTagsPanel","hasTags","isPostTypeSupported","select","postType","getCurrentPostType","tagsTaxonomy","getTaxonomy","_isPostTypeSupported","types","includes","areTagsFetched","undefined","tags","getEditedPostAttribute","rest_base","length","hadTagsWhenOpeningThePanel"],"sources":["@wordpress/editor/src/components/post-publish-panel/maybe-tags-panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { PanelBody } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport FlatTermSelector from '../post-taxonomies/flat-term-selector';\nimport { store as editorStore } from '../../store';\n\nconst TagsPanel = () => {\n\tconst panelBodyTitle = [\n\t\t__( 'Suggestion:' ),\n\t\t<span className=\"editor-post-publish-panel__link\" key=\"label\">\n\t\t\t{ __( 'Add tags' ) }\n\t\t</span>,\n\t];\n\n\treturn (\n\t\t<PanelBody initialOpen={ false } title={ panelBodyTitle }>\n\t\t\t<p>\n\t\t\t\t{ __(\n\t\t\t\t\t'Tags help users and search engines navigate your site and find your content. Add a few keywords to describe your post.'\n\t\t\t\t) }\n\t\t\t</p>\n\t\t\t<FlatTermSelector slug=\"post_tag\" __nextHasNoMarginBottom />\n\t\t</PanelBody>\n\t);\n};\n\nconst MaybeTagsPanel = () => {\n\tconst { hasTags, isPostTypeSupported } = useSelect( ( select ) => {\n\t\tconst postType = select( editorStore ).getCurrentPostType();\n\t\tconst tagsTaxonomy = select( coreStore ).getTaxonomy( 'post_tag' );\n\t\tconst _isPostTypeSupported = tagsTaxonomy?.types?.includes( postType );\n\t\tconst areTagsFetched = tagsTaxonomy !== undefined;\n\t\tconst tags =\n\t\t\ttagsTaxonomy &&\n\t\t\tselect( editorStore ).getEditedPostAttribute(\n\t\t\t\ttagsTaxonomy.rest_base\n\t\t\t);\n\t\treturn {\n\t\t\thasTags: !! tags?.length,\n\t\t\tisPostTypeSupported: areTagsFetched && _isPostTypeSupported,\n\t\t};\n\t}, [] );\n\tconst [ hadTagsWhenOpeningThePanel ] = useState( hasTags );\n\n\tif ( ! isPostTypeSupported ) {\n\t\treturn null;\n\t}\n\n\t/*\n\t * We only want to show the tag panel if the post didn't have\n\t * any tags when the user hit the Publish button.\n\t *\n\t * We can't use the prop.hasTags because it'll change to true\n\t * if the user adds a new tag within the pre-publish panel.\n\t * This would force a re-render and a new prop.hasTags check,\n\t * hiding this panel and keeping the user from adding\n\t * more than one tag.\n\t */\n\tif ( ! hadTagsWhenOpeningThePanel ) {\n\t\treturn <TagsPanel />;\n\t}\n\n\treturn null;\n};\n\nexport default MaybeTagsPanel;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,SAAS,QAAQ,uBAAuB;AACjD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;;AAEzD;AACA;AACA;AACA,OAAOC,gBAAgB,MAAM,uCAAuC;AACpE,SAASF,KAAK,IAAIG,WAAW,QAAQ,aAAa;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAEnD,MAAMC,SAAS,GAAGA,CAAA,KAAM;EACvB,MAAMC,cAAc,GAAG,CACtBb,EAAE,CAAE,aAAc,CAAC,eACnBS,IAAA;IAAMK,SAAS,EAAC,iCAAiC;IAAAC,QAAA,EAC9Cf,EAAE,CAAE,UAAW;EAAC,GADmC,OAEhD,CAAC,CACP;EAED,oBACCW,KAAA,CAACR,SAAS;IAACa,WAAW,EAAG,KAAO;IAACC,KAAK,EAAGJ,cAAgB;IAAAE,QAAA,gBACxDN,IAAA;MAAAM,QAAA,EACGf,EAAE,CACH,wHACD;IAAC,CACC,CAAC,eACJS,IAAA,CAACH,gBAAgB;MAACY,IAAI,EAAC,UAAU;MAACC,uBAAuB;IAAA,CAAE,CAAC;EAAA,CAClD,CAAC;AAEd,CAAC;AAED,MAAMC,cAAc,GAAGA,CAAA,KAAM;EAC5B,MAAM;IAAEC,OAAO;IAAEC;EAAoB,CAAC,GAAGpB,SAAS,CAAIqB,MAAM,IAAM;IACjE,MAAMC,QAAQ,GAAGD,MAAM,CAAEhB,WAAY,CAAC,CAACkB,kBAAkB,CAAC,CAAC;IAC3D,MAAMC,YAAY,GAAGH,MAAM,CAAElB,SAAU,CAAC,CAACsB,WAAW,CAAE,UAAW,CAAC;IAClE,MAAMC,oBAAoB,GAAGF,YAAY,EAAEG,KAAK,EAAEC,QAAQ,CAAEN,QAAS,CAAC;IACtE,MAAMO,cAAc,GAAGL,YAAY,KAAKM,SAAS;IACjD,MAAMC,IAAI,GACTP,YAAY,IACZH,MAAM,CAAEhB,WAAY,CAAC,CAAC2B,sBAAsB,CAC3CR,YAAY,CAACS,SACd,CAAC;IACF,OAAO;MACNd,OAAO,EAAE,CAAC,CAAEY,IAAI,EAAEG,MAAM;MACxBd,mBAAmB,EAAES,cAAc,IAAIH;IACxC,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EACP,MAAM,CAAES,0BAA0B,CAAE,GAAGpC,QAAQ,CAAEoB,OAAQ,CAAC;EAE1D,IAAK,CAAEC,mBAAmB,EAAG;IAC5B,OAAO,IAAI;EACZ;;EAEA;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACC,IAAK,CAAEe,0BAA0B,EAAG;IACnC,oBAAO5B,IAAA,CAACG,SAAS,IAAE,CAAC;EACrB;EAEA,OAAO,IAAI;AACZ,CAAC;AAED,eAAeQ,cAAc","ignoreList":[]}
1
+ {"version":3,"names":["__","useState","useSelect","PanelBody","store","coreStore","FlatTermSelector","editorStore","jsx","_jsx","jsxs","_jsxs","TagsPanel","panelBodyTitle","className","children","initialOpen","title","slug","__nextHasNoMarginBottom","MaybeTagsPanel","hasTags","isPostTypeSupported","select","postType","getCurrentPostType","tagsTaxonomy","getTaxonomy","_isPostTypeSupported","types","includes","areTagsFetched","undefined","tags","getEditedPostAttribute","rest_base","length","hadTagsWhenOpeningThePanel"],"sources":["@wordpress/editor/src/components/post-publish-panel/maybe-tags-panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { PanelBody } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport FlatTermSelector from '../post-taxonomies/flat-term-selector';\nimport { store as editorStore } from '../../store';\n\nconst TagsPanel = () => {\n\tconst panelBodyTitle = [\n\t\t__( 'Suggestion:' ),\n\t\t<span className=\"editor-post-publish-panel__link\" key=\"label\">\n\t\t\t{ __( 'Add tags' ) }\n\t\t</span>,\n\t];\n\n\treturn (\n\t\t<PanelBody initialOpen={ false } title={ panelBodyTitle }>\n\t\t\t<p>\n\t\t\t\t{ __(\n\t\t\t\t\t'Tags help users and search engines navigate your site and find your content. Add a few keywords to describe your post.'\n\t\t\t\t) }\n\t\t\t</p>\n\t\t\t<FlatTermSelector slug=\"post_tag\" __nextHasNoMarginBottom />\n\t\t</PanelBody>\n\t);\n};\n\nconst MaybeTagsPanel = () => {\n\tconst { hasTags, isPostTypeSupported } = useSelect( ( select ) => {\n\t\tconst postType = select( editorStore ).getCurrentPostType();\n\t\tconst tagsTaxonomy = select( coreStore ).getTaxonomy( 'post_tag' );\n\t\tconst _isPostTypeSupported = tagsTaxonomy?.types?.includes( postType );\n\t\tconst areTagsFetched = tagsTaxonomy !== undefined;\n\t\tconst tags =\n\t\t\ttagsTaxonomy &&\n\t\t\tselect( editorStore ).getEditedPostAttribute(\n\t\t\t\ttagsTaxonomy.rest_base\n\t\t\t);\n\t\treturn {\n\t\t\thasTags: !! tags?.length,\n\t\t\tisPostTypeSupported: areTagsFetched && _isPostTypeSupported,\n\t\t};\n\t}, [] );\n\tconst [ hadTagsWhenOpeningThePanel ] = useState( hasTags );\n\n\tif ( ! isPostTypeSupported ) {\n\t\treturn null;\n\t}\n\n\t/*\n\t * We only want to show the tag panel if the post didn't have\n\t * any tags when the user hit the Publish button.\n\t *\n\t * We can't use the prop.hasTags because it'll change to true\n\t * if the user adds a new tag within the pre-publish panel.\n\t * This would force a re-render and a new prop.hasTags check,\n\t * hiding this panel and keeping the user from adding\n\t * more than one tag.\n\t */\n\tif ( ! hadTagsWhenOpeningThePanel ) {\n\t\treturn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,KAAK,EAAEC,QAAQ,CAAEN,QAAS,CAAC;IACtE,MAAMO,cAAc,GAAGL,YAAY,KAAKM,SAAS;IACjD,MAAMC,IAAI,GACTP,YAAY,IACZH,MAAM,CAAEhB,WAAY,CAAC,CAAC2B,sBAAsB,CAC3CR,YAAY,CAACS,SACd,CAAC;IACF,OAAO;MACNd,OAAO,EAAE,CAAC,CAAEY,IAAI,EAAEG,MAAM;MACxBd,mBAAmB,EAAES,cAAc,IAAIH;IACxC,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EACP,MAAM,CAAES,0BAA0B,CAAE,GAAGpC,QAAQ,CAAEoB,OAAQ,CAAC;EAE1D,IAAK,CAAEC,mBAAmB,EAAG;IAC5B,OAAO,IAAI;EACZ;;EAEA;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACC,IAAK,CAAEe,0BAA0B,EAAG;IACnC,oBAAO5B,IAAA,CAACG,SAAS,IAAE,CAAC;EACrB;EAEA,OAAO,IAAI;AACZ,CAAC;AAED,eAAeQ,cAAc","ignoreList":[]}
@@ -1,3 +1,4 @@
1
+ /* wp:polyfill */
1
2
  /**
2
3
  * WordPress dependencies
3
4
  */
@@ -12,8 +13,7 @@ import { isBlobURL } from '@wordpress/blob';
12
13
  * Internal dependencies
13
14
  */
14
15
  import { fetchMedia } from './media-util';
15
- import { jsx as _jsx } from "react/jsx-runtime";
16
- import { jsxs as _jsxs } from "react/jsx-runtime";
16
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
17
17
  function flattenBlocks(blocks) {
18
18
  const result = [];
19
19
  blocks.forEach(block => {
@@ -1 +1 @@
1
- {"version":3,"names":["PanelBody","Button","Spinner","__unstableMotion","motion","__unstableAnimatePresence","AnimatePresence","useSelect","useDispatch","__","store","blockEditorStore","useState","isBlobURL","fetchMedia","jsx","_jsx","jsxs","_jsxs","flattenBlocks","blocks","result","forEach","block","push","innerBlocks","hasExternalMedia","name","attributes","url","id","mediaUrl","mediaId","undefined","getMediaInfo","alt","mediaAlt","Image","clientId","selectBlock","img","tabIndex","role","onClick","onKeyDown","event","key","preventDefault","src","animate","opacity","exit","scale","style","width","height","objectFit","borderRadius","cursor","whileHover","MaybeUploadMediaPanel","isUploading","setIsUploading","isAnimating","setIsAnimating","hadUploadError","setHadUploadError","editorBlocks","mediaUpload","select","getBlocks","getSettings","blocksWithExternalMedia","filter","updateBlockAttributes","length","panelBodyTitle","className","children","updateBlockWithUploadedMedia","media","uploadImages","mediaUrls","Set","map","uploadPromises","Object","fromEntries","entries","filePromise","uploadPromise","then","blob","Promise","resolve","reject","filesList","onFileChange","onError","allSettled","catch","finally","initialOpen","title","display","flexWrap","gap","onExitComplete","size","variant"],"sources":["@wordpress/editor/src/components/post-publish-panel/maybe-upload-media.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tPanelBody,\n\tButton,\n\tSpinner,\n\t__unstableMotion as motion,\n\t__unstableAnimatePresence as AnimatePresence,\n} from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { useState } from '@wordpress/element';\nimport { isBlobURL } from '@wordpress/blob';\n\n/**\n * Internal dependencies\n */\nimport { fetchMedia } from './media-util';\n\nfunction flattenBlocks( blocks ) {\n\tconst result = [];\n\n\tblocks.forEach( ( block ) => {\n\t\tresult.push( block );\n\t\tresult.push( ...flattenBlocks( block.innerBlocks ) );\n\t} );\n\n\treturn result;\n}\n\n/**\n * Determine whether a block has external media.\n *\n * Different blocks use different attribute names (and potentially\n * different logic as well) in determining whether the media is\n * present, and whether it's external.\n *\n * @param {{name: string, attributes: Object}} block The block.\n * @return {boolean?} Whether the block has external media\n */\nfunction hasExternalMedia( block ) {\n\tif ( block.name === 'core/image' || block.name === 'core/cover' ) {\n\t\treturn block.attributes.url && ! block.attributes.id;\n\t}\n\n\tif ( block.name === 'core/media-text' ) {\n\t\treturn block.attributes.mediaUrl && ! block.attributes.mediaId;\n\t}\n\n\treturn undefined;\n}\n\n/**\n * Retrieve media info from a block.\n *\n * Different blocks use different attribute names, so we need this\n * function to normalize things into a consistent naming scheme.\n *\n * @param {{name: string, attributes: Object}} block The block.\n * @return {{url: ?string, alt: ?string, id: ?number}} The media info for the block.\n */\nfunction getMediaInfo( block ) {\n\tif ( block.name === 'core/image' || block.name === 'core/cover' ) {\n\t\tconst { url, alt, id } = block.attributes;\n\t\treturn { url, alt, id };\n\t}\n\n\tif ( block.name === 'core/media-text' ) {\n\t\tconst { mediaUrl: url, mediaAlt: alt, mediaId: id } = block.attributes;\n\t\treturn { url, alt, id };\n\t}\n\n\treturn {};\n}\n\n// Image component to represent a single image in the upload dialog.\nfunction Image( { clientId, alt, url } ) {\n\tconst { selectBlock } = useDispatch( blockEditorStore );\n\treturn (\n\t\t<motion.img\n\t\t\ttabIndex={ 0 }\n\t\t\trole=\"button\"\n\t\t\taria-label={ __( 'Select image block.' ) }\n\t\t\tonClick={ () => {\n\t\t\t\tselectBlock( clientId );\n\t\t\t} }\n\t\t\tonKeyDown={ ( event ) => {\n\t\t\t\tif ( event.key === 'Enter' || event.key === ' ' ) {\n\t\t\t\t\tselectBlock( clientId );\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t}\n\t\t\t} }\n\t\t\tkey={ clientId }\n\t\t\talt={ alt }\n\t\t\tsrc={ url }\n\t\t\tanimate={ { opacity: 1 } }\n\t\t\texit={ { opacity: 0, scale: 0 } }\n\t\t\tstyle={ {\n\t\t\t\twidth: '32px',\n\t\t\t\theight: '32px',\n\t\t\t\tobjectFit: 'cover',\n\t\t\t\tborderRadius: '2px',\n\t\t\t\tcursor: 'pointer',\n\t\t\t} }\n\t\t\twhileHover={ { scale: 1.08 } }\n\t\t/>\n\t);\n}\n\nexport default function MaybeUploadMediaPanel() {\n\tconst [ isUploading, setIsUploading ] = useState( false );\n\tconst [ isAnimating, setIsAnimating ] = useState( false );\n\tconst [ hadUploadError, setHadUploadError ] = useState( false );\n\tconst { editorBlocks, mediaUpload } = useSelect(\n\t\t( select ) => ( {\n\t\t\teditorBlocks: select( blockEditorStore ).getBlocks(),\n\t\t\tmediaUpload: select( blockEditorStore ).getSettings().mediaUpload,\n\t\t} ),\n\t\t[]\n\t);\n\n\t// Get a list of blocks with external media.\n\tconst blocksWithExternalMedia = flattenBlocks( editorBlocks ).filter(\n\t\t( block ) => hasExternalMedia( block )\n\t);\n\tconst { updateBlockAttributes } = useDispatch( blockEditorStore );\n\n\tif ( ! mediaUpload || ! blocksWithExternalMedia.length ) {\n\t\treturn null;\n\t}\n\n\tconst panelBodyTitle = [\n\t\t__( 'Suggestion:' ),\n\t\t<span className=\"editor-post-publish-panel__link\" key=\"label\">\n\t\t\t{ __( 'External media' ) }\n\t\t</span>,\n\t];\n\n\t/**\n\t * Update an individual block to point to newly-added library media.\n\t *\n\t * Different blocks use different attribute names, so we need this\n\t * function to ensure we modify the correct attributes for each type.\n\t *\n\t * @param {{name: string, attributes: Object}} block The block.\n\t * @param {{id: number, url: string}} media Media library file info.\n\t */\n\tfunction updateBlockWithUploadedMedia( block, media ) {\n\t\tif ( block.name === 'core/image' || block.name === 'core/cover' ) {\n\t\t\tupdateBlockAttributes( block.clientId, {\n\t\t\t\tid: media.id,\n\t\t\t\turl: media.url,\n\t\t\t} );\n\t\t}\n\n\t\tif ( block.name === 'core/media-text' ) {\n\t\t\tupdateBlockAttributes( block.clientId, {\n\t\t\t\tmediaId: media.id,\n\t\t\t\tmediaUrl: media.url,\n\t\t\t} );\n\t\t}\n\t}\n\n\t// Handle fetching and uploading all external media in the post.\n\tfunction uploadImages() {\n\t\tsetIsUploading( true );\n\t\tsetHadUploadError( false );\n\n\t\t// Multiple blocks can be using the same URL, so we\n\t\t// should ensure we only fetch and upload each of them once.\n\t\tconst mediaUrls = new Set(\n\t\t\tblocksWithExternalMedia.map( ( block ) => {\n\t\t\t\tconst { url } = getMediaInfo( block );\n\t\t\t\treturn url;\n\t\t\t} )\n\t\t);\n\n\t\t// Create an upload promise for each URL, that we can wait for in all\n\t\t// blocks that make use of that media.\n\t\tconst uploadPromises = Object.fromEntries(\n\t\t\tObject.entries( fetchMedia( [ ...mediaUrls ] ) ).map(\n\t\t\t\t( [ url, filePromise ] ) => {\n\t\t\t\t\tconst uploadPromise = filePromise.then(\n\t\t\t\t\t\t( blob ) =>\n\t\t\t\t\t\t\tnew Promise( ( resolve, reject ) => {\n\t\t\t\t\t\t\t\tmediaUpload( {\n\t\t\t\t\t\t\t\t\tfilesList: [ blob ],\n\t\t\t\t\t\t\t\t\tonFileChange: ( [ media ] ) => {\n\t\t\t\t\t\t\t\t\t\tif ( isBlobURL( media.url ) ) {\n\t\t\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\tresolve( media );\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tonError() {\n\t\t\t\t\t\t\t\t\t\treject();\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t);\n\n\t\t\t\t\treturn [ url, uploadPromise ];\n\t\t\t\t}\n\t\t\t)\n\t\t);\n\n\t\t// Wait for all blocks to be updated with library media.\n\t\tPromise.allSettled(\n\t\t\tblocksWithExternalMedia.map( ( block ) => {\n\t\t\t\tconst { url } = getMediaInfo( block );\n\n\t\t\t\treturn uploadPromises[ url ]\n\t\t\t\t\t.then( ( media ) =>\n\t\t\t\t\t\tupdateBlockWithUploadedMedia( block, media )\n\t\t\t\t\t)\n\t\t\t\t\t.then( () => setIsAnimating( true ) )\n\t\t\t\t\t.catch( () => setHadUploadError( true ) );\n\t\t\t} )\n\t\t).finally( () => {\n\t\t\tsetIsUploading( false );\n\t\t} );\n\t}\n\n\treturn (\n\t\t<PanelBody initialOpen title={ panelBodyTitle }>\n\t\t\t<p>\n\t\t\t\t{ __(\n\t\t\t\t\t'Upload external images to the Media Library. Images from different domains may load slowly, display incorrectly, or be removed unexpectedly.'\n\t\t\t\t) }\n\t\t\t</p>\n\t\t\t<div\n\t\t\t\tstyle={ {\n\t\t\t\t\tdisplay: 'inline-flex',\n\t\t\t\t\tflexWrap: 'wrap',\n\t\t\t\t\tgap: '8px',\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<AnimatePresence\n\t\t\t\t\tonExitComplete={ () => setIsAnimating( false ) }\n\t\t\t\t>\n\t\t\t\t\t{ blocksWithExternalMedia.map( ( block ) => {\n\t\t\t\t\t\tconst { url, alt } = getMediaInfo( block );\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<Image\n\t\t\t\t\t\t\t\tkey={ block.clientId }\n\t\t\t\t\t\t\t\tclientId={ block.clientId }\n\t\t\t\t\t\t\t\turl={ url }\n\t\t\t\t\t\t\t\talt={ alt }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t);\n\t\t\t\t\t} ) }\n\t\t\t\t</AnimatePresence>\n\t\t\t\t{ isUploading || isAnimating ? (\n\t\t\t\t\t<Spinner />\n\t\t\t\t) : (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\tonClick={ uploadImages }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Upload' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t\t{ hadUploadError && <p>{ __( 'Upload failed, try again.' ) }</p> }\n\t\t</PanelBody>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,SAAS,EACTC,MAAM,EACNC,OAAO,EACPC,gBAAgB,IAAIC,MAAM,EAC1BC,yBAAyB,IAAIC,eAAe,QACtC,uBAAuB;AAC9B,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,yBAAyB;AACnE,SA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ACXM,GAAG,EAAGA;UAAK,GAHLZ,KAAK,CAACe,QAIZ,CAAC;QAEJ,CAAE;MAAC,CACa,CAAC,EAChBuB,WAAW,IAAIE,WAAW,gBAC3B/C,IAAA,CAACd,OAAO,IAAE,CAAC,gBAEXc,IAAA,CAACf,MAAM;QACN2G,IAAI,EAAC,SAAS;QACdC,OAAO,EAAC,SAAS;QACjBlE,OAAO,EAAGsC,YAAc;QAAAH,QAAA,EAEtBrE,EAAE,CAAE,QAAS;MAAC,CACT,CACR;IAAA,CACG,CAAC,EACJwD,cAAc,iBAAIjD,IAAA;MAAA8D,QAAA,EAAKrE,EAAE,CAAE,2BAA4B;IAAC,CAAK,CAAC;EAAA,CACtD,CAAC;AAEd","ignoreList":[]}
1
+ {"version":3,"names":["PanelBody","Button","Spinner","__unstableMotion","motion","__unstableAnimatePresence","AnimatePresence","useSelect","useDispatch","__","store","blockEditorStore","useState","isBlobURL","fetchMedia","jsx","_jsx","jsxs","_jsxs","flattenBlocks","blocks","result","forEach","block","push","innerBlocks","hasExternalMedia","name","attributes","url","id","mediaUrl","mediaId","undefined","getMediaInfo","alt","mediaAlt","Image","clientId","selectBlock","img","tabIndex","role","onClick","onKeyDown","event","key","preventDefault","src","animate","opacity","exit","scale","style","width","height","objectFit","borderRadius","cursor","whileHover","MaybeUploadMediaPanel","isUploading","setIsUploading","isAnimating","setIsAnimating","hadUploadError","setHadUploadError","editorBlocks","mediaUpload","select","getBlocks","getSettings","blocksWithExternalMedia","filter","updateBlockAttributes","length","panelBodyTitle","className","children","updateBlockWithUploadedMedia","media","uploadImages","mediaUrls","Set","map","uploadPromises","Object","fromEntries","entries","filePromise","uploadPromise","then","blob","Promise","resolve","reject","filesList","onFileChange","onError","allSettled","catch","finally","initialOpen","title","display","flexWrap","gap","onExitComplete","size","variant"],"sources":["@wordpress/editor/src/components/post-publish-panel/maybe-upload-media.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tPanelBody,\n\tButton,\n\tSpinner,\n\t__unstableMotion as motion,\n\t__unstableAnimatePresence as AnimatePresence,\n} from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { useState } from '@wordpress/element';\nimport { isBlobURL } from '@wordpress/blob';\n\n/**\n * Internal dependencies\n */\nimport { fetchMedia } from './media-util';\n\nfunction flattenBlocks( blocks ) {\n\tconst result = [];\n\n\tblocks.forEach( ( block ) => {\n\t\tresult.push( block );\n\t\tresult.push( ...flattenBlocks( block.innerBlocks ) );\n\t} );\n\n\treturn result;\n}\n\n/**\n * Determine whether a block has external media.\n *\n * Different blocks use different attribute names (and potentially\n * different logic as well) in determining whether the media is\n * present, and whether it's external.\n *\n * @param {{name: string, attributes: Object}} block The block.\n * @return {boolean?} Whether the block has external media\n */\nfunction hasExternalMedia( block ) {\n\tif ( block.name === 'core/image' || block.name === 'core/cover' ) {\n\t\treturn block.attributes.url && ! block.attributes.id;\n\t}\n\n\tif ( block.name === 'core/media-text' ) {\n\t\treturn block.attributes.mediaUrl && ! block.attributes.mediaId;\n\t}\n\n\treturn undefined;\n}\n\n/**\n * Retrieve media info from a block.\n *\n * Different blocks use different attribute names, so we need this\n * function to normalize things into a consistent naming scheme.\n *\n * @param {{name: string, attributes: Object}} block The block.\n * @return {{url: ?string, alt: ?string, id: ?number}} The media info for the block.\n */\nfunction getMediaInfo( block ) {\n\tif ( block.name === 'core/image' || block.name === 'core/cover' ) {\n\t\tconst { url, alt, id } = block.attributes;\n\t\treturn { url, alt, id };\n\t}\n\n\tif ( block.name === 'core/media-text' ) {\n\t\tconst { mediaUrl: url, mediaAlt: alt, mediaId: id } = block.attributes;\n\t\treturn { url, alt, id };\n\t}\n\n\treturn {};\n}\n\n// Image component to represent a single image in the upload dialog.\nfunction Image( { clientId, alt, url } ) {\n\tconst { selectBlock } = useDispatch( blockEditorStore );\n\treturn (\n\t\t<motion.img\n\t\t\ttabIndex={ 0 }\n\t\t\trole=\"button\"\n\t\t\taria-label={ __( 'Select image block.' ) }\n\t\t\tonClick={ () => {\n\t\t\t\tselectBlock( clientId );\n\t\t\t} }\n\t\t\tonKeyDown={ ( event ) => {\n\t\t\t\tif ( event.key === 'Enter' || event.key === ' ' ) {\n\t\t\t\t\tselectBlock( clientId );\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t}\n\t\t\t} }\n\t\t\tkey={ clientId }\n\t\t\talt={ alt }\n\t\t\tsrc={ url }\n\t\t\tanimate={ { opacity: 1 } }\n\t\t\texit={ { opacity: 0, scale: 0 } }\n\t\t\tstyle={ {\n\t\t\t\twidth: '32px',\n\t\t\t\theight: '32px',\n\t\t\t\tobjectFit: 'cover',\n\t\t\t\tborderRadius: '2px',\n\t\t\t\tcursor: 'pointer',\n\t\t\t} }\n\t\t\twhileHover={ { scale: 1.08 } }\n\t\t/>\n\t);\n}\n\nexport default function MaybeUploadMediaPanel() {\n\tconst [ isUploading, setIsUploading ] = useState( false );\n\tconst [ isAnimating, setIsAnimating ] = useState( false );\n\tconst [ hadUploadError, setHadUploadError ] = useState( false );\n\tconst { editorBlocks, mediaUpload } = useSelect(\n\t\t( select ) => ( {\n\t\t\teditorBlocks: select( blockEditorStore ).getBlocks(),\n\t\t\tmediaUpload: select( blockEditorStore ).getSettings().mediaUpload,\n\t\t} ),\n\t\t[]\n\t);\n\n\t// Get a list of blocks with external media.\n\tconst blocksWithExternalMedia = flattenBlocks( editorBlocks ).filter(\n\t\t( block ) => hasExternalMedia( block )\n\t);\n\tconst { updateBlockAttributes } = useDispatch( blockEditorStore );\n\n\tif ( ! mediaUpload || ! blocksWithExternalMedia.length ) {\n\t\treturn null;\n\t}\n\n\tconst panelBodyTitle = [\n\t\t__( 'Suggestion:' ),\n\t\t<span className=\"editor-post-publish-panel__link\" key=\"label\">\n\t\t\t{ __( 'External media' ) }\n\t\t</span>,\n\t];\n\n\t/**\n\t * Update an individual block to point to newly-added library media.\n\t *\n\t * Different blocks use different attribute names, so we need this\n\t * function to ensure we modify the correct attributes for each type.\n\t *\n\t * @param {{name: string, attributes: Object}} block The block.\n\t * @param {{id: number, url: string}} media Media library file info.\n\t */\n\tfunction updateBlockWithUploadedMedia( block, media ) {\n\t\tif ( block.name === 'core/image' || block.name === 'core/cover' ) {\n\t\t\tupdateBlockAttributes( block.clientId, {\n\t\t\t\tid: media.id,\n\t\t\t\turl: media.url,\n\t\t\t} );\n\t\t}\n\n\t\tif ( block.name === 'core/media-text' ) {\n\t\t\tupdateBlockAttributes( block.clientId, {\n\t\t\t\tmediaId: media.id,\n\t\t\t\tmediaUrl: media.url,\n\t\t\t} );\n\t\t}\n\t}\n\n\t// Handle fetching and uploading all external media in the post.\n\tfunction uploadImages() {\n\t\tsetIsUploading( true );\n\t\tsetHadUploadError( false );\n\n\t\t// Multiple blocks can be using the same URL, so we\n\t\t// should ensure we only fetch and upload each of them once.\n\t\tconst mediaUrls = new Set(\n\t\t\tblocksWithExternalMedia.map( ( block ) => {\n\t\t\t\tconst { url } = getMediaInfo( block );\n\t\t\t\treturn url;\n\t\t\t} )\n\t\t);\n\n\t\t// Create an upload promise for each URL, that we can wait for in all\n\t\t// blocks that make use of that media.\n\t\tconst uploadPromises = Object.fromEntries(\n\t\t\tObject.entries( fetchMedia( [ ...mediaUrls ] ) ).map(\n\t\t\t\t( [ url, filePromise ] ) => {\n\t\t\t\t\tconst uploadPromise = filePromise.then(\n\t\t\t\t\t\t( blob ) =>\n\t\t\t\t\t\t\tnew Promise( ( resolve, reject ) => {\n\t\t\t\t\t\t\t\tmediaUpload( {\n\t\t\t\t\t\t\t\t\tfilesList: [ blob ],\n\t\t\t\t\t\t\t\t\tonFileChange: ( [ media ] ) => {\n\t\t\t\t\t\t\t\t\t\tif ( isBlobURL( media.url ) ) {\n\t\t\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\tresolve( media );\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tonError() {\n\t\t\t\t\t\t\t\t\t\treject();\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t);\n\n\t\t\t\t\treturn [ url, uploadPromise ];\n\t\t\t\t}\n\t\t\t)\n\t\t);\n\n\t\t// Wait for all blocks to be updated with library media.\n\t\tPromise.allSettled(\n\t\t\tblocksWithExternalMedia.map( ( block ) => {\n\t\t\t\tconst { url } = getMediaInfo( block );\n\n\t\t\t\treturn uploadPromises[ url ]\n\t\t\t\t\t.then( ( media ) =>\n\t\t\t\t\t\tupdateBlockWithUploadedMedia( block, media )\n\t\t\t\t\t)\n\t\t\t\t\t.then( () => setIsAnimating( true ) )\n\t\t\t\t\t.catch( () => setHadUploadError( true ) );\n\t\t\t} )\n\t\t).finally( () => {\n\t\t\tsetIsUploading( false );\n\t\t} );\n\t}\n\n\treturn (\n\t\t<PanelBody initialOpen title={ panelBodyTitle }>\n\t\t\t<p>\n\t\t\t\t{ __(\n\t\t\t\t\t'Upload external images to the Media Library. Images from different domains may load slowly, display incorrectly, or be removed unexpectedly.'\n\t\t\t\t) }\n\t\t\t</p>\n\t\t\t<div\n\t\t\t\tstyle={ {\n\t\t\t\t\tdisplay: 'inline-flex',\n\t\t\t\t\tflexWrap: 'wrap',\n\t\t\t\t\tgap: '8px',\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<AnimatePresence\n\t\t\t\t\tonExitComplete={ () => setIsAnimating( false ) }\n\t\t\t\t>\n\t\t\t\t\t{ blocksWithExternalMedia.map( ( block ) => {\n\t\t\t\t\t\tconst { url, alt } = getMediaInfo( block );\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<Image\n\t\t\t\t\t\t\t\tkey={ block.clientId }\n\t\t\t\t\t\t\t\tclientId={ block.clientId }\n\t\t\t\t\t\t\t\turl={ url }\n\t\t\t\t\t\t\t\talt={ alt }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t);\n\t\t\t\t\t} ) }\n\t\t\t\t</AnimatePresence>\n\t\t\t\t{ isUploading || isAnimating ? (\n\t\t\t\t\t<Spinner />\n\t\t\t\t) : (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\tonClick={ uploadImages }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Upload' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t\t{ hadUploadError && <p>{ __( 'Upload failed, try again.' ) }</p> }\n\t\t</PanelBody>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SACCA,SAAS,EACTC,MAAM,EACNC,OAAO,EACPC,gBAAgB,IAAIC,MAAM,EAC1BC,yBAAyB,IAAIC,eAAe,QACtC,uBAAuB;AAC9B,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,yBAAyB;AACnE,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,SAAS,QAAQ,iBAAiB;;AAE3C;AACA;AACA;AACA,SAASC,UAAU,QAAQ,cAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAE1C,SAASC,aAAaA,CAAEC,MAAM,EAAG;EAChC,MAAMC,MAAM,GAAG,EAAE;EAEjBD,MAAM,CAACE,OAAO,CAAIC,KAAK,IAAM;IAC5BF,MAAM,CAACG,IAAI,CAAED,KAAM,CAAC;IACpBF,MAAM,CAACG,IAAI,CAAE,GAAGL,aAAa,CAAEI,KAAK,CAACE,WAAY,CAAE,CAAC;EACrD,CAAE,CAAC;EAEH,OAAOJ,MAAM;AACd;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASK,gBAAgBA,CAAEH,KAAK,EAAG;EAClC,IA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