@wordpress/editor 13.32.0 → 13.34.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 (733) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.md +355 -20
  3. package/build/bindings/index.js.map +1 -1
  4. package/build/bindings/pattern-overrides.js.map +1 -1
  5. package/build/bindings/post-meta.js +12 -30
  6. package/build/bindings/post-meta.js.map +1 -1
  7. package/build/components/autocompleters/index.js.map +1 -1
  8. package/build/components/autocompleters/user.js.map +1 -1
  9. package/build/components/autosave-monitor/index.js +24 -11
  10. package/build/components/autosave-monitor/index.js.map +1 -1
  11. package/build/components/block-manager/category.js.map +1 -1
  12. package/build/components/block-manager/checklist.js.map +1 -1
  13. package/build/components/block-manager/index.js.map +1 -1
  14. package/build/components/block-removal-warnings/index.js.map +1 -1
  15. package/build/components/block-settings-menu/plugin-block-settings-menu-item.js.map +1 -1
  16. package/build/components/character-count/index.js +5 -0
  17. package/build/components/character-count/index.js.map +1 -1
  18. package/build/components/collapsible-block-toolbar/index.js +73 -0
  19. package/build/components/collapsible-block-toolbar/index.js.map +1 -0
  20. package/build/components/commands/index.js +19 -0
  21. package/build/components/commands/index.js.map +1 -1
  22. package/build/components/commands/index.native.js.map +1 -1
  23. package/build/components/deprecated.js.map +1 -1
  24. package/build/components/deprecated.native.js.map +1 -1
  25. package/build/components/document-bar/index.js.map +1 -1
  26. package/build/components/document-outline/check.js +8 -0
  27. package/build/components/document-outline/check.js.map +1 -1
  28. package/build/components/document-outline/index.js +11 -0
  29. package/build/components/document-outline/index.js.map +1 -1
  30. package/build/components/document-outline/item.js.map +1 -1
  31. package/build/components/document-tools/index.js +1 -8
  32. package/build/components/document-tools/index.js.map +1 -1
  33. package/build/components/editor-canvas/edit-template-blocks-notification.js +13 -2
  34. package/build/components/editor-canvas/edit-template-blocks-notification.js.map +1 -1
  35. package/build/components/editor-canvas/index.js +2 -2
  36. package/build/components/editor-canvas/index.js.map +1 -1
  37. package/build/components/editor-help/add-blocks.native.js.map +1 -1
  38. package/build/components/editor-help/customize-blocks.native.js.map +1 -1
  39. package/build/components/editor-help/help-detail-navigation-screen.native.js.map +1 -1
  40. package/build/components/editor-help/help-get-support-button.native.js.map +1 -1
  41. package/build/components/editor-help/help-section-title.native.js.map +1 -1
  42. package/build/components/editor-help/help-topic-row.native.js.map +1 -1
  43. package/build/components/editor-help/icon-move-blocks.native.js.map +1 -1
  44. package/build/components/editor-help/index.native.js.map +1 -1
  45. package/build/components/editor-help/intro-to-blocks.native.js.map +1 -1
  46. package/build/components/editor-help/move-blocks.native.js.map +1 -1
  47. package/build/components/editor-help/remove-blocks.native.js.map +1 -1
  48. package/build/components/editor-help/view-sections.native.js.map +1 -1
  49. package/build/components/editor-history/redo.js +11 -0
  50. package/build/components/editor-history/redo.js.map +1 -1
  51. package/build/components/editor-history/undo.js +11 -0
  52. package/build/components/editor-history/undo.js.map +1 -1
  53. package/build/components/editor-notices/index.js.map +1 -1
  54. package/build/components/editor-snackbars/index.js +6 -0
  55. package/build/components/editor-snackbars/index.js.map +1 -1
  56. package/build/components/entities-saved-states/entity-record-item.js.map +1 -1
  57. package/build/components/entities-saved-states/entity-type-list.js.map +1 -1
  58. package/build/components/entities-saved-states/hooks/use-is-dirty.js.map +1 -1
  59. package/build/components/entities-saved-states/index.js.map +1 -1
  60. package/build/components/error-boundary/index.js.map +1 -1
  61. package/build/components/error-boundary/index.native.js.map +1 -1
  62. package/build/components/global-keyboard-shortcuts/index.js +31 -0
  63. package/build/components/global-keyboard-shortcuts/index.js.map +1 -1
  64. package/build/components/global-keyboard-shortcuts/register-shortcuts.js +52 -0
  65. package/build/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
  66. package/build/components/index.js +33 -1
  67. package/build/components/index.js.map +1 -1
  68. package/build/components/index.native.js.map +1 -1
  69. package/build/components/inserter-sidebar/index.js +1 -4
  70. package/build/components/inserter-sidebar/index.js.map +1 -1
  71. package/build/components/keyboard-shortcut-help-modal/config.js +82 -0
  72. package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -0
  73. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +49 -0
  74. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -0
  75. package/build/components/keyboard-shortcut-help-modal/index.js +126 -0
  76. package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -0
  77. package/build/components/keyboard-shortcut-help-modal/shortcut.js +55 -0
  78. package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -0
  79. package/build/components/list-view-sidebar/index.js +1 -1
  80. package/build/components/list-view-sidebar/index.js.map +1 -1
  81. package/build/components/list-view-sidebar/list-view-outline.js.map +1 -1
  82. package/build/components/local-autosave-monitor/index.js.map +1 -1
  83. package/build/components/media-categories/index.js.map +1 -1
  84. package/build/components/mode-switcher/index.js.map +1 -1
  85. package/build/components/more-menu/copy-content-menu-item.js +59 -0
  86. package/build/components/more-menu/copy-content-menu-item.js.map +1 -0
  87. package/build/components/more-menu/index.js +119 -0
  88. package/build/components/more-menu/index.js.map +1 -0
  89. package/build/components/more-menu/tools-more-menu-group.js +23 -0
  90. package/build/components/more-menu/tools-more-menu-group.js.map +1 -0
  91. package/build/components/more-menu/view-more-menu-group.js +24 -0
  92. package/build/components/more-menu/view-more-menu-group.js.map +1 -0
  93. package/build/components/offline-status/index.native.js.map +1 -1
  94. package/build/components/page-attributes/check.js +8 -0
  95. package/build/components/page-attributes/check.js.map +1 -1
  96. package/build/components/page-attributes/order.js +7 -0
  97. package/build/components/page-attributes/order.js.map +1 -1
  98. package/build/components/page-attributes/panel.js +14 -8
  99. package/build/components/page-attributes/panel.js.map +1 -1
  100. package/build/components/page-attributes/parent.js +7 -0
  101. package/build/components/page-attributes/parent.js.map +1 -1
  102. package/build/components/pattern-overrides-panel/index.js.map +1 -1
  103. package/build/components/plugin-document-setting-panel/index.js.map +1 -1
  104. package/build/components/plugin-more-menu-item/index.js +78 -0
  105. package/build/components/plugin-more-menu-item/index.js.map +1 -0
  106. package/build/components/plugin-post-publish-panel/index.js +1 -1
  107. package/build/components/plugin-post-publish-panel/index.js.map +1 -1
  108. package/build/components/plugin-post-status-info/index.js +73 -0
  109. package/build/components/plugin-post-status-info/index.js.map +1 -0
  110. package/build/components/plugin-pre-publish-panel/index.js +1 -1
  111. package/build/components/plugin-pre-publish-panel/index.js.map +1 -1
  112. package/build/components/plugin-sidebar/index.js +108 -0
  113. package/build/components/plugin-sidebar/index.js.map +1 -0
  114. package/build/components/plugin-sidebar-more-menu-item/index.js +71 -0
  115. package/build/components/plugin-sidebar-more-menu-item/index.js.map +1 -0
  116. package/build/components/post-actions/actions.js +316 -20
  117. package/build/components/post-actions/actions.js.map +1 -1
  118. package/build/components/post-actions/index.js +160 -0
  119. package/build/components/post-actions/index.js.map +1 -0
  120. package/build/components/post-author/check.js +9 -0
  121. package/build/components/post-author/check.js.map +1 -1
  122. package/build/components/post-author/combobox.js.map +1 -1
  123. package/build/components/post-author/constants.js.map +1 -1
  124. package/build/components/post-author/hook.js.map +1 -1
  125. package/build/components/post-author/index.js +6 -0
  126. package/build/components/post-author/index.js.map +1 -1
  127. package/build/components/post-author/panel.js +5 -0
  128. package/build/components/post-author/panel.js.map +1 -1
  129. package/build/components/post-author/select.js.map +1 -1
  130. package/build/components/post-card-panel/index.js +14 -15
  131. package/build/components/post-card-panel/index.js.map +1 -1
  132. package/build/components/post-comments/index.js.map +1 -1
  133. package/build/components/post-content-information/index.js +72 -0
  134. package/build/components/post-content-information/index.js.map +1 -0
  135. package/build/components/post-discussion/panel.js +9 -7
  136. package/build/components/post-discussion/panel.js.map +1 -1
  137. package/build/components/post-excerpt/check.js +7 -18
  138. package/build/components/post-excerpt/check.js.map +1 -1
  139. package/build/components/post-excerpt/index.js +52 -12
  140. package/build/components/post-excerpt/index.js.map +1 -1
  141. package/build/components/post-excerpt/panel.js +118 -7
  142. package/build/components/post-excerpt/panel.js.map +1 -1
  143. package/build/components/post-excerpt/plugin.js +2 -2
  144. package/build/components/post-excerpt/plugin.js.map +1 -1
  145. package/build/components/post-featured-image/check.js.map +1 -1
  146. package/build/components/post-featured-image/index.js +1 -1
  147. package/build/components/post-featured-image/index.js.map +1 -1
  148. package/build/components/post-featured-image/panel.js.map +1 -1
  149. package/build/components/post-format/check.js.map +1 -1
  150. package/build/components/post-format/index.js.map +1 -1
  151. package/build/components/post-last-edited-panel/index.js +33 -0
  152. package/build/components/post-last-edited-panel/index.js.map +1 -0
  153. package/build/components/post-last-revision/check.js.map +1 -1
  154. package/build/components/post-last-revision/index.js.map +1 -1
  155. package/build/components/post-last-revision/panel.js.map +1 -1
  156. package/build/components/post-locked-modal/index.js.map +1 -1
  157. package/build/components/post-panel-row/index.js.map +1 -1
  158. package/build/components/post-pending-status/check.js.map +1 -1
  159. package/build/components/post-pending-status/index.js.map +1 -1
  160. package/build/components/post-pingbacks/index.js.map +1 -1
  161. package/build/components/post-preview-button/index.js.map +1 -1
  162. package/build/components/post-publish-button/index.js +31 -31
  163. package/build/components/post-publish-button/index.js.map +1 -1
  164. package/build/components/post-publish-button/label.js +51 -43
  165. package/build/components/post-publish-button/label.js.map +1 -1
  166. package/build/components/post-publish-button/post-publish-button-or-toggle.js +100 -0
  167. package/build/components/post-publish-button/post-publish-button-or-toggle.js.map +1 -0
  168. package/build/components/post-publish-panel/index.js.map +1 -1
  169. package/build/components/post-publish-panel/maybe-category-panel.js.map +1 -1
  170. package/build/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
  171. package/build/components/post-publish-panel/maybe-tags-panel.js.map +1 -1
  172. package/build/components/post-publish-panel/maybe-upload-media.js.map +1 -1
  173. package/build/components/post-publish-panel/postpublish.js.map +1 -1
  174. package/build/components/post-publish-panel/prepublish.js.map +1 -1
  175. package/build/components/post-saved-state/index.js +10 -6
  176. package/build/components/post-saved-state/index.js.map +1 -1
  177. package/build/components/post-schedule/check.js.map +1 -1
  178. package/build/components/post-schedule/index.js.map +1 -1
  179. package/build/components/post-schedule/label.js.map +1 -1
  180. package/build/components/post-schedule/panel.js +9 -1
  181. package/build/components/post-schedule/panel.js.map +1 -1
  182. package/build/components/post-slug/check.js.map +1 -1
  183. package/build/components/post-slug/index.js +43 -68
  184. package/build/components/post-slug/index.js.map +1 -1
  185. package/build/components/post-status/index.js +239 -0
  186. package/build/components/post-status/index.js.map +1 -0
  187. package/build/components/post-sticky/check.js.map +1 -1
  188. package/build/components/post-sticky/index.js.map +1 -1
  189. package/build/components/post-switch-to-draft-button/index.js +6 -1
  190. package/build/components/post-switch-to-draft-button/index.js.map +1 -1
  191. package/build/components/post-sync-status/index.js.map +1 -1
  192. package/build/components/post-taxonomies/check.js.map +1 -1
  193. package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
  194. package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
  195. package/build/components/post-taxonomies/index.js.map +1 -1
  196. package/build/components/post-taxonomies/most-used-terms.js.map +1 -1
  197. package/build/components/post-taxonomies/panel.js.map +1 -1
  198. package/build/components/post-template/block-theme.js +8 -4
  199. package/build/components/post-template/block-theme.js.map +1 -1
  200. package/build/components/post-template/classic-theme.js +0 -1
  201. package/build/components/post-template/classic-theme.js.map +1 -1
  202. package/build/components/post-template/create-new-template-modal.js.map +1 -1
  203. package/build/components/post-template/create-new-template.js.map +1 -1
  204. package/build/components/post-template/hooks.js.map +1 -1
  205. package/build/components/post-template/panel.js.map +1 -1
  206. package/build/components/post-template/reset-default-template.js.map +1 -1
  207. package/build/components/post-template/swap-template-button.js +2 -5
  208. package/build/components/post-template/swap-template-button.js.map +1 -1
  209. package/build/components/post-text-editor/index.js.map +1 -1
  210. package/build/components/post-title/constants.js.map +1 -1
  211. package/build/components/post-title/index.js.map +1 -1
  212. package/build/components/post-title/index.native.js.map +1 -1
  213. package/build/components/post-title/post-title-raw.js.map +1 -1
  214. package/build/components/post-title/use-post-title-focus.js.map +1 -1
  215. package/build/components/post-title/use-post-title.js.map +1 -1
  216. package/build/components/post-trash/check.js +23 -25
  217. package/build/components/post-trash/check.js.map +1 -1
  218. package/build/components/post-trash/index.js +2 -1
  219. package/build/components/post-trash/index.js.map +1 -1
  220. package/build/components/post-type-support-check/index.js.map +1 -1
  221. package/build/components/post-url/check.js.map +1 -1
  222. package/build/components/post-url/index.js +45 -19
  223. package/build/components/post-url/index.js.map +1 -1
  224. package/build/components/post-url/label.js.map +1 -1
  225. package/build/components/post-url/panel.js +15 -8
  226. package/build/components/post-url/panel.js.map +1 -1
  227. package/build/components/post-view-link/index.js.map +1 -1
  228. package/build/components/post-visibility/check.js.map +1 -1
  229. package/build/components/post-visibility/index.js +2 -1
  230. package/build/components/post-visibility/index.js.map +1 -1
  231. package/build/components/post-visibility/label.js.map +1 -1
  232. package/build/components/post-visibility/utils.js.map +1 -1
  233. package/build/components/preferences-modal/enable-panel.js.map +1 -1
  234. package/build/components/preferences-modal/enable-plugin-document-setting-panel.js.map +1 -1
  235. package/build/components/preferences-modal/enable-publish-sidebar.js +34 -0
  236. package/build/components/preferences-modal/enable-publish-sidebar.js.map +1 -0
  237. package/build/components/preferences-modal/index.js +26 -18
  238. package/build/components/preferences-modal/index.js.map +1 -1
  239. package/build/components/preview-dropdown/index.js +3 -1
  240. package/build/components/preview-dropdown/index.js.map +1 -1
  241. package/build/components/provider/disable-non-page-content-blocks.js +23 -16
  242. package/build/components/provider/disable-non-page-content-blocks.js.map +1 -1
  243. package/build/components/provider/index.js +4 -2
  244. package/build/components/provider/index.js.map +1 -1
  245. package/build/components/provider/index.native.js +6 -1
  246. package/build/components/provider/index.native.js.map +1 -1
  247. package/build/components/provider/navigation-block-editing-mode.js.map +1 -1
  248. package/build/components/provider/use-auto-switch-editor-sidebars.js +52 -0
  249. package/build/components/provider/use-auto-switch-editor-sidebars.js.map +1 -0
  250. package/build/components/provider/use-block-editor-settings.js +64 -43
  251. package/build/components/provider/use-block-editor-settings.js.map +1 -1
  252. package/build/components/provider/use-block-editor-settings.native.js.map +1 -1
  253. package/build/components/provider/use-hide-blocks-from-inserter.js.map +1 -1
  254. package/build/components/provider/with-registry-provider.js +1 -0
  255. package/build/components/provider/with-registry-provider.js.map +1 -1
  256. package/build/components/save-publish-panels/index.js +89 -0
  257. package/build/components/save-publish-panels/index.js.map +1 -0
  258. package/build/components/start-page-options/index.js +143 -0
  259. package/build/components/start-page-options/index.js.map +1 -0
  260. package/build/components/table-of-contents/index.js.map +1 -1
  261. package/build/components/table-of-contents/panel.js.map +1 -1
  262. package/build/components/template-areas/index.js.map +1 -1
  263. package/build/components/template-validation-notice/index.js +23 -29
  264. package/build/components/template-validation-notice/index.js.map +1 -1
  265. package/build/components/theme-support-check/index.js +10 -16
  266. package/build/components/theme-support-check/index.js.map +1 -1
  267. package/build/components/time-to-read/index.js.map +1 -1
  268. package/build/components/unsaved-changes-warning/index.js.map +1 -1
  269. package/build/components/word-count/index.js.map +1 -1
  270. package/build/hooks/custom-sources-backwards-compatibility.js.map +1 -1
  271. package/build/hooks/default-autocompleters.js.map +1 -1
  272. package/build/hooks/index.js.map +1 -1
  273. package/build/hooks/index.native.js.map +1 -1
  274. package/build/hooks/pattern-overrides.js +22 -10
  275. package/build/hooks/pattern-overrides.js.map +1 -1
  276. package/build/hooks/use-select-nearest-editable-block.js.map +1 -1
  277. package/build/index.js.map +1 -1
  278. package/build/index.native.js.map +1 -1
  279. package/build/lock-unlock.js.map +1 -1
  280. package/build/private-apis.js +38 -3
  281. package/build/private-apis.js.map +1 -1
  282. package/build/store/actions.js.map +1 -1
  283. package/build/store/actions.native.js.map +1 -1
  284. package/build/store/constants.js +8 -1
  285. package/build/store/constants.js.map +1 -1
  286. package/build/store/defaults.js.map +1 -1
  287. package/build/store/index.js +1 -1
  288. package/build/store/index.js.map +1 -1
  289. package/build/store/local-autosave.js.map +1 -1
  290. package/build/store/private-actions.js +177 -4
  291. package/build/store/private-actions.js.map +1 -1
  292. package/build/store/private-selectors.js +1 -7
  293. package/build/store/private-selectors.js.map +1 -1
  294. package/build/store/reducer.js.map +1 -1
  295. package/build/store/reducer.native.js.map +1 -1
  296. package/build/store/selectors.js +8 -11
  297. package/build/store/selectors.js.map +1 -1
  298. package/build/store/selectors.native.js.map +1 -1
  299. package/build/store/utils/get-filtered-template-parts.js.map +1 -1
  300. package/build/store/utils/is-template-revertable.js +28 -0
  301. package/build/store/utils/is-template-revertable.js.map +1 -0
  302. package/build/store/utils/notice-builder.js.map +1 -1
  303. package/build/utils/get-template-part-icon.js.map +1 -1
  304. package/build/utils/index.js.map +1 -1
  305. package/build/utils/index.native.js.map +1 -1
  306. package/build/utils/media-upload/index.js.map +1 -1
  307. package/build/utils/media-upload/index.native.js.map +1 -1
  308. package/build/utils/terms.js.map +1 -1
  309. package/build/utils/url.js.map +1 -1
  310. package/build-module/bindings/index.js.map +1 -1
  311. package/build-module/bindings/pattern-overrides.js.map +1 -1
  312. package/build-module/bindings/post-meta.js +14 -31
  313. package/build-module/bindings/post-meta.js.map +1 -1
  314. package/build-module/components/autocompleters/index.js.map +1 -1
  315. package/build-module/components/autocompleters/user.js.map +1 -1
  316. package/build-module/components/autosave-monitor/index.js +24 -12
  317. package/build-module/components/autosave-monitor/index.js.map +1 -1
  318. package/build-module/components/block-manager/category.js.map +1 -1
  319. package/build-module/components/block-manager/checklist.js.map +1 -1
  320. package/build-module/components/block-manager/index.js.map +1 -1
  321. package/build-module/components/block-removal-warnings/index.js.map +1 -1
  322. package/build-module/components/block-settings-menu/plugin-block-settings-menu-item.js.map +1 -1
  323. package/build-module/components/character-count/index.js +6 -0
  324. package/build-module/components/character-count/index.js.map +1 -1
  325. package/build-module/components/collapsible-block-toolbar/index.js +65 -0
  326. package/build-module/components/collapsible-block-toolbar/index.js.map +1 -0
  327. package/build-module/components/commands/index.js +20 -1
  328. package/build-module/components/commands/index.js.map +1 -1
  329. package/build-module/components/commands/index.native.js.map +1 -1
  330. package/build-module/components/deprecated.js.map +1 -1
  331. package/build-module/components/deprecated.native.js.map +1 -1
  332. package/build-module/components/document-bar/index.js.map +1 -1
  333. package/build-module/components/document-outline/check.js +9 -0
  334. package/build-module/components/document-outline/check.js.map +1 -1
  335. package/build-module/components/document-outline/index.js +11 -0
  336. package/build-module/components/document-outline/index.js.map +1 -1
  337. package/build-module/components/document-outline/item.js.map +1 -1
  338. package/build-module/components/document-tools/index.js +2 -9
  339. package/build-module/components/document-tools/index.js.map +1 -1
  340. package/build-module/components/editor-canvas/edit-template-blocks-notification.js +13 -2
  341. package/build-module/components/editor-canvas/edit-template-blocks-notification.js.map +1 -1
  342. package/build-module/components/editor-canvas/index.js +2 -2
  343. package/build-module/components/editor-canvas/index.js.map +1 -1
  344. package/build-module/components/editor-help/add-blocks.native.js.map +1 -1
  345. package/build-module/components/editor-help/customize-blocks.native.js.map +1 -1
  346. package/build-module/components/editor-help/help-detail-navigation-screen.native.js.map +1 -1
  347. package/build-module/components/editor-help/help-get-support-button.native.js.map +1 -1
  348. package/build-module/components/editor-help/help-section-title.native.js.map +1 -1
  349. package/build-module/components/editor-help/help-topic-row.native.js.map +1 -1
  350. package/build-module/components/editor-help/icon-move-blocks.native.js.map +1 -1
  351. package/build-module/components/editor-help/index.native.js.map +1 -1
  352. package/build-module/components/editor-help/intro-to-blocks.native.js.map +1 -1
  353. package/build-module/components/editor-help/move-blocks.native.js.map +1 -1
  354. package/build-module/components/editor-help/remove-blocks.native.js.map +1 -1
  355. package/build-module/components/editor-help/view-sections.native.js.map +1 -1
  356. package/build-module/components/editor-history/redo.js +11 -0
  357. package/build-module/components/editor-history/redo.js.map +1 -1
  358. package/build-module/components/editor-history/undo.js +11 -0
  359. package/build-module/components/editor-history/undo.js.map +1 -1
  360. package/build-module/components/editor-notices/index.js.map +1 -1
  361. package/build-module/components/editor-snackbars/index.js +6 -0
  362. package/build-module/components/editor-snackbars/index.js.map +1 -1
  363. package/build-module/components/entities-saved-states/entity-record-item.js.map +1 -1
  364. package/build-module/components/entities-saved-states/entity-type-list.js.map +1 -1
  365. package/build-module/components/entities-saved-states/hooks/use-is-dirty.js.map +1 -1
  366. package/build-module/components/entities-saved-states/index.js.map +1 -1
  367. package/build-module/components/error-boundary/index.js.map +1 -1
  368. package/build-module/components/error-boundary/index.native.js.map +1 -1
  369. package/build-module/components/global-keyboard-shortcuts/index.js +32 -0
  370. package/build-module/components/global-keyboard-shortcuts/index.js.map +1 -1
  371. package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js +53 -0
  372. package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
  373. package/build-module/components/index.js +4 -0
  374. package/build-module/components/index.js.map +1 -1
  375. package/build-module/components/index.native.js.map +1 -1
  376. package/build-module/components/inserter-sidebar/index.js +2 -5
  377. package/build-module/components/inserter-sidebar/index.js.map +1 -1
  378. package/build-module/components/keyboard-shortcut-help-modal/config.js +75 -0
  379. package/build-module/components/keyboard-shortcut-help-modal/config.js.map +1 -0
  380. package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +41 -0
  381. package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -0
  382. package/build-module/components/keyboard-shortcut-help-modal/index.js +118 -0
  383. package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -0
  384. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +48 -0
  385. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -0
  386. package/build-module/components/list-view-sidebar/index.js +1 -1
  387. package/build-module/components/list-view-sidebar/index.js.map +1 -1
  388. package/build-module/components/list-view-sidebar/list-view-outline.js.map +1 -1
  389. package/build-module/components/local-autosave-monitor/index.js.map +1 -1
  390. package/build-module/components/media-categories/index.js.map +1 -1
  391. package/build-module/components/mode-switcher/index.js.map +1 -1
  392. package/build-module/components/more-menu/copy-content-menu-item.js +52 -0
  393. package/build-module/components/more-menu/copy-content-menu-item.js.map +1 -0
  394. package/build-module/components/more-menu/index.js +111 -0
  395. package/build-module/components/more-menu/index.js.map +1 -0
  396. package/build-module/components/more-menu/tools-more-menu-group.js +16 -0
  397. package/build-module/components/more-menu/tools-more-menu-group.js.map +1 -0
  398. package/build-module/components/more-menu/view-more-menu-group.js +17 -0
  399. package/build-module/components/more-menu/view-more-menu-group.js.map +1 -0
  400. package/build-module/components/offline-status/index.native.js.map +1 -1
  401. package/build-module/components/page-attributes/check.js +9 -0
  402. package/build-module/components/page-attributes/check.js.map +1 -1
  403. package/build-module/components/page-attributes/order.js +7 -0
  404. package/build-module/components/page-attributes/order.js.map +1 -1
  405. package/build-module/components/page-attributes/panel.js +13 -6
  406. package/build-module/components/page-attributes/panel.js.map +1 -1
  407. package/build-module/components/page-attributes/parent.js +7 -0
  408. package/build-module/components/page-attributes/parent.js.map +1 -1
  409. package/build-module/components/pattern-overrides-panel/index.js.map +1 -1
  410. package/build-module/components/plugin-document-setting-panel/index.js.map +1 -1
  411. package/build-module/components/plugin-more-menu-item/index.js +73 -0
  412. package/build-module/components/plugin-more-menu-item/index.js.map +1 -0
  413. package/build-module/components/plugin-post-publish-panel/index.js +1 -1
  414. package/build-module/components/plugin-post-publish-panel/index.js.map +1 -1
  415. package/build-module/components/plugin-post-status-info/index.js +66 -0
  416. package/build-module/components/plugin-post-status-info/index.js.map +1 -0
  417. package/build-module/components/plugin-pre-publish-panel/index.js +1 -1
  418. package/build-module/components/plugin-pre-publish-panel/index.js.map +1 -1
  419. package/build-module/components/plugin-sidebar/index.js +102 -0
  420. package/build-module/components/plugin-sidebar/index.js.map +1 -0
  421. package/build-module/components/plugin-sidebar-more-menu-item/index.js +65 -0
  422. package/build-module/components/plugin-sidebar-more-menu-item/index.js.map +1 -0
  423. package/build-module/components/post-actions/actions.js +317 -19
  424. package/build-module/components/post-actions/actions.js.map +1 -1
  425. package/build-module/components/post-actions/index.js +153 -0
  426. package/build-module/components/post-actions/index.js.map +1 -0
  427. package/build-module/components/post-author/check.js +10 -0
  428. package/build-module/components/post-author/check.js.map +1 -1
  429. package/build-module/components/post-author/combobox.js.map +1 -1
  430. package/build-module/components/post-author/constants.js.map +1 -1
  431. package/build-module/components/post-author/hook.js.map +1 -1
  432. package/build-module/components/post-author/index.js +6 -0
  433. package/build-module/components/post-author/index.js.map +1 -1
  434. package/build-module/components/post-author/panel.js +6 -0
  435. package/build-module/components/post-author/panel.js.map +1 -1
  436. package/build-module/components/post-author/select.js.map +1 -1
  437. package/build-module/components/post-card-panel/index.js +16 -17
  438. package/build-module/components/post-card-panel/index.js.map +1 -1
  439. package/build-module/components/post-comments/index.js.map +1 -1
  440. package/build-module/components/post-content-information/index.js +66 -0
  441. package/build-module/components/post-content-information/index.js.map +1 -0
  442. package/build-module/components/post-discussion/panel.js +8 -6
  443. package/build-module/components/post-discussion/panel.js.map +1 -1
  444. package/build-module/components/post-excerpt/check.js +8 -18
  445. package/build-module/components/post-excerpt/check.js.map +1 -1
  446. package/build-module/components/post-excerpt/index.js +52 -11
  447. package/build-module/components/post-excerpt/index.js.map +1 -1
  448. package/build-module/components/post-excerpt/panel.js +118 -8
  449. package/build-module/components/post-excerpt/panel.js.map +1 -1
  450. package/build-module/components/post-excerpt/plugin.js +2 -2
  451. package/build-module/components/post-excerpt/plugin.js.map +1 -1
  452. package/build-module/components/post-featured-image/check.js.map +1 -1
  453. package/build-module/components/post-featured-image/index.js +1 -1
  454. package/build-module/components/post-featured-image/index.js.map +1 -1
  455. package/build-module/components/post-featured-image/panel.js.map +1 -1
  456. package/build-module/components/post-format/check.js.map +1 -1
  457. package/build-module/components/post-format/index.js.map +1 -1
  458. package/build-module/components/post-last-edited-panel/index.js +26 -0
  459. package/build-module/components/post-last-edited-panel/index.js.map +1 -0
  460. package/build-module/components/post-last-revision/check.js.map +1 -1
  461. package/build-module/components/post-last-revision/index.js.map +1 -1
  462. package/build-module/components/post-last-revision/panel.js.map +1 -1
  463. package/build-module/components/post-locked-modal/index.js.map +1 -1
  464. package/build-module/components/post-panel-row/index.js.map +1 -1
  465. package/build-module/components/post-pending-status/check.js.map +1 -1
  466. package/build-module/components/post-pending-status/index.js.map +1 -1
  467. package/build-module/components/post-pingbacks/index.js.map +1 -1
  468. package/build-module/components/post-preview-button/index.js.map +1 -1
  469. package/build-module/components/post-publish-button/index.js +31 -31
  470. package/build-module/components/post-publish-button/index.js.map +1 -1
  471. package/build-module/components/post-publish-button/label.js +51 -42
  472. package/build-module/components/post-publish-button/label.js.map +1 -1
  473. package/build-module/components/post-publish-button/post-publish-button-or-toggle.js +91 -0
  474. package/build-module/components/post-publish-button/post-publish-button-or-toggle.js.map +1 -0
  475. package/build-module/components/post-publish-panel/index.js.map +1 -1
  476. package/build-module/components/post-publish-panel/maybe-category-panel.js.map +1 -1
  477. package/build-module/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
  478. package/build-module/components/post-publish-panel/maybe-tags-panel.js.map +1 -1
  479. package/build-module/components/post-publish-panel/maybe-upload-media.js.map +1 -1
  480. package/build-module/components/post-publish-panel/postpublish.js.map +1 -1
  481. package/build-module/components/post-publish-panel/prepublish.js.map +1 -1
  482. package/build-module/components/post-saved-state/index.js +10 -6
  483. package/build-module/components/post-saved-state/index.js.map +1 -1
  484. package/build-module/components/post-schedule/check.js.map +1 -1
  485. package/build-module/components/post-schedule/index.js.map +1 -1
  486. package/build-module/components/post-schedule/label.js.map +1 -1
  487. package/build-module/components/post-schedule/panel.js +9 -1
  488. package/build-module/components/post-schedule/panel.js.map +1 -1
  489. package/build-module/components/post-slug/check.js.map +1 -1
  490. package/build-module/components/post-slug/index.js +44 -68
  491. package/build-module/components/post-slug/index.js.map +1 -1
  492. package/build-module/components/post-status/index.js +231 -0
  493. package/build-module/components/post-status/index.js.map +1 -0
  494. package/build-module/components/post-sticky/check.js.map +1 -1
  495. package/build-module/components/post-sticky/index.js.map +1 -1
  496. package/build-module/components/post-switch-to-draft-button/index.js +7 -1
  497. package/build-module/components/post-switch-to-draft-button/index.js.map +1 -1
  498. package/build-module/components/post-sync-status/index.js.map +1 -1
  499. package/build-module/components/post-taxonomies/check.js.map +1 -1
  500. package/build-module/components/post-taxonomies/flat-term-selector.js.map +1 -1
  501. package/build-module/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
  502. package/build-module/components/post-taxonomies/index.js.map +1 -1
  503. package/build-module/components/post-taxonomies/most-used-terms.js.map +1 -1
  504. package/build-module/components/post-taxonomies/panel.js.map +1 -1
  505. package/build-module/components/post-template/block-theme.js +9 -5
  506. package/build-module/components/post-template/block-theme.js.map +1 -1
  507. package/build-module/components/post-template/classic-theme.js +0 -1
  508. package/build-module/components/post-template/classic-theme.js.map +1 -1
  509. package/build-module/components/post-template/create-new-template-modal.js.map +1 -1
  510. package/build-module/components/post-template/create-new-template.js.map +1 -1
  511. package/build-module/components/post-template/hooks.js.map +1 -1
  512. package/build-module/components/post-template/panel.js.map +1 -1
  513. package/build-module/components/post-template/reset-default-template.js.map +1 -1
  514. package/build-module/components/post-template/swap-template-button.js +3 -6
  515. package/build-module/components/post-template/swap-template-button.js.map +1 -1
  516. package/build-module/components/post-text-editor/index.js.map +1 -1
  517. package/build-module/components/post-title/constants.js.map +1 -1
  518. package/build-module/components/post-title/index.js.map +1 -1
  519. package/build-module/components/post-title/index.native.js.map +1 -1
  520. package/build-module/components/post-title/post-title-raw.js.map +1 -1
  521. package/build-module/components/post-title/use-post-title-focus.js.map +1 -1
  522. package/build-module/components/post-title/use-post-title.js.map +1 -1
  523. package/build-module/components/post-trash/check.js +24 -26
  524. package/build-module/components/post-trash/check.js.map +1 -1
  525. package/build-module/components/post-trash/index.js +2 -1
  526. package/build-module/components/post-trash/index.js.map +1 -1
  527. package/build-module/components/post-type-support-check/index.js.map +1 -1
  528. package/build-module/components/post-url/check.js.map +1 -1
  529. package/build-module/components/post-url/index.js +47 -21
  530. package/build-module/components/post-url/index.js.map +1 -1
  531. package/build-module/components/post-url/label.js.map +1 -1
  532. package/build-module/components/post-url/panel.js +15 -8
  533. package/build-module/components/post-url/panel.js.map +1 -1
  534. package/build-module/components/post-view-link/index.js.map +1 -1
  535. package/build-module/components/post-visibility/check.js.map +1 -1
  536. package/build-module/components/post-visibility/index.js +2 -1
  537. package/build-module/components/post-visibility/index.js.map +1 -1
  538. package/build-module/components/post-visibility/label.js.map +1 -1
  539. package/build-module/components/post-visibility/utils.js.map +1 -1
  540. package/build-module/components/preferences-modal/enable-panel.js.map +1 -1
  541. package/build-module/components/preferences-modal/enable-plugin-document-setting-panel.js.map +1 -1
  542. package/build-module/components/preferences-modal/enable-publish-sidebar.js +27 -0
  543. package/build-module/components/preferences-modal/enable-publish-sidebar.js.map +1 -0
  544. package/build-module/components/preferences-modal/index.js +26 -18
  545. package/build-module/components/preferences-modal/index.js.map +1 -1
  546. package/build-module/components/preview-dropdown/index.js +3 -1
  547. package/build-module/components/preview-dropdown/index.js.map +1 -1
  548. package/build-module/components/provider/disable-non-page-content-blocks.js +24 -17
  549. package/build-module/components/provider/disable-non-page-content-blocks.js.map +1 -1
  550. package/build-module/components/provider/index.js +5 -3
  551. package/build-module/components/provider/index.js.map +1 -1
  552. package/build-module/components/provider/index.native.js.map +1 -1
  553. package/build-module/components/provider/navigation-block-editing-mode.js.map +1 -1
  554. package/build-module/components/provider/use-auto-switch-editor-sidebars.js +46 -0
  555. package/build-module/components/provider/use-auto-switch-editor-sidebars.js.map +1 -0
  556. package/build-module/components/provider/use-block-editor-settings.js +66 -45
  557. package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
  558. package/build-module/components/provider/use-block-editor-settings.native.js.map +1 -1
  559. package/build-module/components/provider/use-hide-blocks-from-inserter.js.map +1 -1
  560. package/build-module/components/provider/with-registry-provider.js +1 -0
  561. package/build-module/components/provider/with-registry-provider.js.map +1 -1
  562. package/build-module/components/save-publish-panels/index.js +80 -0
  563. package/build-module/components/save-publish-panels/index.js.map +1 -0
  564. package/build-module/components/start-page-options/index.js +136 -0
  565. package/build-module/components/start-page-options/index.js.map +1 -0
  566. package/build-module/components/table-of-contents/index.js.map +1 -1
  567. package/build-module/components/table-of-contents/panel.js.map +1 -1
  568. package/build-module/components/template-areas/index.js.map +1 -1
  569. package/build-module/components/template-validation-notice/index.js +25 -31
  570. package/build-module/components/template-validation-notice/index.js.map +1 -1
  571. package/build-module/components/theme-support-check/index.js +11 -16
  572. package/build-module/components/theme-support-check/index.js.map +1 -1
  573. package/build-module/components/time-to-read/index.js.map +1 -1
  574. package/build-module/components/unsaved-changes-warning/index.js.map +1 -1
  575. package/build-module/components/word-count/index.js.map +1 -1
  576. package/build-module/hooks/custom-sources-backwards-compatibility.js.map +1 -1
  577. package/build-module/hooks/default-autocompleters.js.map +1 -1
  578. package/build-module/hooks/index.js.map +1 -1
  579. package/build-module/hooks/index.native.js.map +1 -1
  580. package/build-module/hooks/pattern-overrides.js +22 -10
  581. package/build-module/hooks/pattern-overrides.js.map +1 -1
  582. package/build-module/hooks/use-select-nearest-editable-block.js.map +1 -1
  583. package/build-module/index.js.map +1 -1
  584. package/build-module/index.native.js.map +1 -1
  585. package/build-module/lock-unlock.js.map +1 -1
  586. package/build-module/private-apis.js +36 -3
  587. package/build-module/private-apis.js.map +1 -1
  588. package/build-module/store/actions.js.map +1 -1
  589. package/build-module/store/actions.native.js.map +1 -1
  590. package/build-module/store/constants.js +7 -0
  591. package/build-module/store/constants.js.map +1 -1
  592. package/build-module/store/defaults.js.map +1 -1
  593. package/build-module/store/index.js.map +1 -1
  594. package/build-module/store/local-autosave.js.map +1 -1
  595. package/build-module/store/private-actions.js +174 -4
  596. package/build-module/store/private-actions.js.map +1 -1
  597. package/build-module/store/private-selectors.js +1 -6
  598. package/build-module/store/private-selectors.js.map +1 -1
  599. package/build-module/store/reducer.js.map +1 -1
  600. package/build-module/store/reducer.native.js.map +1 -1
  601. package/build-module/store/selectors.js +4 -7
  602. package/build-module/store/selectors.js.map +1 -1
  603. package/build-module/store/selectors.native.js.map +1 -1
  604. package/build-module/store/utils/get-filtered-template-parts.js.map +1 -1
  605. package/build-module/store/utils/is-template-revertable.js +22 -0
  606. package/build-module/store/utils/is-template-revertable.js.map +1 -0
  607. package/build-module/store/utils/notice-builder.js.map +1 -1
  608. package/build-module/utils/get-template-part-icon.js.map +1 -1
  609. package/build-module/utils/index.js.map +1 -1
  610. package/build-module/utils/index.native.js.map +1 -1
  611. package/build-module/utils/media-upload/index.js.map +1 -1
  612. package/build-module/utils/media-upload/index.native.js.map +1 -1
  613. package/build-module/utils/terms.js.map +1 -1
  614. package/build-module/utils/url.js.map +1 -1
  615. package/build-style/style-rtl.css +703 -53
  616. package/build-style/style.css +703 -53
  617. package/package.json +35 -35
  618. package/src/bindings/post-meta.js +11 -27
  619. package/src/components/autosave-monitor/index.js +23 -11
  620. package/src/components/character-count/index.js +5 -0
  621. package/src/components/collapsible-block-toolbar/index.js +77 -0
  622. package/src/components/collapsible-block-toolbar/style.scss +80 -0
  623. package/src/components/commands/index.js +20 -1
  624. package/src/components/document-outline/check.js +8 -0
  625. package/src/components/document-outline/index.js +10 -0
  626. package/src/components/document-tools/index.js +16 -19
  627. package/src/components/editor-canvas/edit-template-blocks-notification.js +16 -2
  628. package/src/components/editor-canvas/index.js +4 -4
  629. package/src/components/editor-history/redo.js +10 -0
  630. package/src/components/editor-history/undo.js +10 -0
  631. package/src/components/editor-snackbars/index.js +5 -0
  632. package/src/components/entities-saved-states/style.scss +7 -0
  633. package/src/components/error-boundary/style.native.scss +1 -1
  634. package/src/components/global-keyboard-shortcuts/index.js +32 -0
  635. package/src/components/global-keyboard-shortcuts/register-shortcuts.js +61 -0
  636. package/src/components/index.js +4 -0
  637. package/src/components/inserter-sidebar/index.js +2 -5
  638. package/src/components/keyboard-shortcut-help-modal/config.js +62 -0
  639. package/src/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +43 -0
  640. package/src/components/keyboard-shortcut-help-modal/index.js +160 -0
  641. package/src/components/keyboard-shortcut-help-modal/shortcut.js +67 -0
  642. package/src/components/keyboard-shortcut-help-modal/style.scss +61 -0
  643. package/src/components/list-view-sidebar/index.js +1 -1
  644. package/src/components/list-view-sidebar/style.scss +2 -2
  645. package/src/components/more-menu/copy-content-menu-item.js +51 -0
  646. package/src/components/more-menu/index.js +158 -0
  647. package/src/components/more-menu/tools-more-menu-group.js +11 -0
  648. package/src/components/more-menu/view-more-menu-group.js +13 -0
  649. package/src/components/page-attributes/check.js +8 -0
  650. package/src/components/page-attributes/order.js +6 -0
  651. package/src/components/page-attributes/panel.js +21 -17
  652. package/src/components/page-attributes/parent.js +6 -0
  653. package/src/components/plugin-more-menu-item/index.js +73 -0
  654. package/src/components/plugin-post-publish-panel/index.js +1 -1
  655. package/src/components/plugin-post-status-info/index.js +63 -0
  656. package/src/components/plugin-pre-publish-panel/index.js +1 -1
  657. package/src/components/plugin-sidebar/index.js +98 -0
  658. package/src/components/plugin-sidebar-more-menu-item/index.js +64 -0
  659. package/src/components/post-actions/actions.js +413 -18
  660. package/src/components/post-actions/index.js +190 -0
  661. package/src/components/post-actions/style.scss +3 -0
  662. package/src/components/post-author/check.js +9 -0
  663. package/src/components/post-author/index.js +5 -0
  664. package/src/components/post-author/panel.js +5 -0
  665. package/src/components/post-card-panel/index.js +28 -23
  666. package/src/components/post-card-panel/style.scss +2 -6
  667. package/src/components/post-content-information/index.js +83 -0
  668. package/src/components/post-content-information/style.scss +6 -0
  669. package/src/components/post-discussion/panel.js +24 -20
  670. package/src/components/post-excerpt/check.js +8 -18
  671. package/src/components/post-excerpt/index.js +66 -15
  672. package/src/components/post-excerpt/panel.js +196 -19
  673. package/src/components/post-excerpt/plugin.js +2 -2
  674. package/src/components/post-excerpt/style.scss +24 -0
  675. package/src/components/post-featured-image/index.js +1 -1
  676. package/src/components/post-featured-image/style.scss +2 -8
  677. package/src/components/post-last-edited-panel/index.js +35 -0
  678. package/src/components/post-last-edited-panel/style.scss +6 -0
  679. package/src/components/post-panel-row/style.scss +3 -3
  680. package/src/components/post-publish-button/index.js +23 -36
  681. package/src/components/post-publish-button/label.js +54 -39
  682. package/src/components/post-publish-button/post-publish-button-or-toggle.js +102 -0
  683. package/src/components/post-publish-button/test/index.js +15 -26
  684. package/src/components/post-publish-button/test/label.js +44 -21
  685. package/src/components/post-publish-button/test/post-publish-button-or-toggle.js +63 -0
  686. package/src/components/post-publish-panel/style.scss +43 -0
  687. package/src/components/post-publish-panel/test/__snapshots__/index.js.snap +225 -75
  688. package/src/components/post-saved-state/index.js +13 -6
  689. package/src/components/post-saved-state/test/index.js +4 -0
  690. package/src/components/post-schedule/panel.js +23 -1
  691. package/src/components/post-schedule/style.scss +2 -4
  692. package/src/components/post-slug/index.js +50 -68
  693. package/src/components/post-slug/test/index.js +29 -6
  694. package/src/components/post-status/index.js +318 -0
  695. package/src/components/post-status/style.scss +74 -0
  696. package/src/components/post-switch-to-draft-button/index.js +5 -0
  697. package/src/components/post-template/block-theme.js +33 -24
  698. package/src/components/post-template/classic-theme.js +0 -1
  699. package/src/components/post-template/swap-template-button.js +3 -6
  700. package/src/components/post-text-editor/style.scss +1 -1
  701. package/src/components/post-title/style.scss +1 -1
  702. package/src/components/post-trash/check.js +19 -19
  703. package/src/components/post-trash/index.js +1 -0
  704. package/src/components/post-url/index.js +132 -101
  705. package/src/components/post-url/panel.js +21 -8
  706. package/src/components/post-url/style.scss +8 -6
  707. package/src/components/post-visibility/index.js +1 -0
  708. package/src/components/preferences-modal/enable-publish-sidebar.js +28 -0
  709. package/src/components/preferences-modal/index.js +40 -22
  710. package/src/components/preview-dropdown/index.js +3 -1
  711. package/src/components/provider/disable-non-page-content-blocks.js +23 -21
  712. package/src/components/provider/index.js +17 -8
  713. package/src/components/provider/use-auto-switch-editor-sidebars.js +49 -0
  714. package/src/components/provider/use-block-editor-settings.js +59 -33
  715. package/src/components/provider/with-registry-provider.js +1 -0
  716. package/src/components/save-publish-panels/index.js +96 -0
  717. package/src/components/save-publish-panels/style.scss +36 -0
  718. package/src/components/start-page-options/index.js +140 -0
  719. package/src/components/start-page-options/style.scss +26 -0
  720. package/src/components/template-validation-notice/index.js +48 -50
  721. package/src/components/theme-support-check/index.js +9 -16
  722. package/src/components/theme-support-check/test/index.js +44 -43
  723. package/src/hooks/pattern-overrides.js +25 -14
  724. package/src/private-apis.js +33 -2
  725. package/src/store/constants.js +7 -0
  726. package/src/store/private-actions.js +269 -4
  727. package/src/store/private-selectors.js +1 -6
  728. package/src/store/selectors.js +4 -7
  729. package/src/store/utils/is-template-revertable.js +23 -0
  730. package/src/style.scss +10 -2
  731. package/src/components/post-publish-button/style.scss +0 -8
  732. package/src/components/provider/test/disable-non-page-content-blocks.js +0 -111
  733. package/src/components/template-validation-notice/style.scss +0 -9
@@ -1,9 +1,4 @@
1
1
  import { createElement, Fragment } from "react";
2
- /**
3
- * External dependencies
4
- */
5
- import classnames from 'classnames';
6
-
7
2
  /**
8
3
  * WordPress dependencies
9
4
  */
@@ -11,7 +6,6 @@ import { Button } from '@wordpress/components';
11
6
  import { Component, createRef } from '@wordpress/element';
12
7
  import { withSelect, withDispatch } from '@wordpress/data';
13
8
  import { compose } from '@wordpress/compose';
14
- import { __ } from '@wordpress/i18n';
15
9
 
16
10
  /**
17
11
  * Internal dependencies
@@ -101,34 +95,41 @@ export class PostPublishButton extends Component {
101
95
  isSaving,
102
96
  isAutoSaving,
103
97
  isToggle,
104
- onSave,
105
- onStatusChange,
98
+ savePostStatus,
106
99
  onSubmit = noop,
107
100
  onToggle,
108
101
  visibility,
109
102
  hasNonPostEntityChanges,
110
- isSavingNonPostEntityChanges
103
+ isSavingNonPostEntityChanges,
104
+ postStatus,
105
+ postStatusHasChanged
111
106
  } = this.props;
112
107
  const isButtonDisabled = (isSaving || !isSaveable || isPostSavingLocked || !isPublishable && !forceIsDirty) && (!hasNonPostEntityChanges || isSavingNonPostEntityChanges);
113
108
  const isToggleDisabled = (isPublished || isSaving || !isSaveable || !isPublishable && !forceIsDirty) && (!hasNonPostEntityChanges || isSavingNonPostEntityChanges);
114
- let publishStatus;
115
- if (!hasPublishAction) {
109
+
110
+ // If the new status has not changed explicitely, we derive it from
111
+ // other factors, like having a publish action, etc.. We need to preserve
112
+ // this because it affects when to show the pre and post publish panels.
113
+ // If it has changed though explicitely, we need to respect that.
114
+ let publishStatus = 'publish';
115
+ if (postStatusHasChanged) {
116
+ publishStatus = postStatus;
117
+ } else if (!hasPublishAction) {
116
118
  publishStatus = 'pending';
117
119
  } else if (visibility === 'private') {
118
120
  publishStatus = 'private';
119
121
  } else if (isBeingScheduled) {
120
122
  publishStatus = 'future';
121
- } else {
122
- publishStatus = 'publish';
123
123
  }
124
124
  const onClickButton = () => {
125
125
  if (isButtonDisabled) {
126
126
  return;
127
127
  }
128
128
  onSubmit();
129
- onStatusChange(publishStatus);
130
- onSave();
129
+ savePostStatus(publishStatus);
131
130
  };
131
+
132
+ // Callback to open the publish panel.
132
133
  const onClickToggle = () => {
133
134
  if (isToggleDisabled) {
134
135
  return;
@@ -151,20 +152,13 @@ export class PostPublishButton extends Component {
151
152
  size: 'compact',
152
153
  onClick: this.createOnClick(onClickToggle)
153
154
  };
154
- const toggleChildren = isBeingScheduled ? __('Schedule…') : __('Publish');
155
- const buttonChildren = createElement(PublishButtonLabel, {
156
- hasNonPostEntityChanges: hasNonPostEntityChanges
157
- });
158
155
  const componentProps = isToggle ? toggleProps : buttonProps;
159
- const componentChildren = isToggle ? toggleChildren : buttonChildren;
160
156
  return createElement(Fragment, null, createElement(Button, {
161
157
  ref: this.buttonNode,
162
158
  ...componentProps,
163
- className: classnames(componentProps.className, 'editor-post-publish-button__button', {
164
- 'has-changes-dot': hasNonPostEntityChanges
165
- }),
159
+ className: `${componentProps.className} editor-post-publish-button__button`,
166
160
  size: "compact"
167
- }, componentChildren));
161
+ }, createElement(PublishButtonLabel, null)));
168
162
  }
169
163
  }
170
164
  export default compose([withSelect(select => {
@@ -182,7 +176,9 @@ export default compose([withSelect(select => {
182
176
  getCurrentPostType,
183
177
  getCurrentPostId,
184
178
  hasNonPostEntityChanges,
185
- isSavingNonPostEntityChanges
179
+ isSavingNonPostEntityChanges,
180
+ getEditedPostAttribute,
181
+ getPostEdits
186
182
  } = select(editorStore);
187
183
  return {
188
184
  isSaving: isSavingPost(),
@@ -196,6 +192,8 @@ export default compose([withSelect(select => {
196
192
  hasPublishAction: (_getCurrentPost$_link = getCurrentPost()._links?.['wp:action-publish']) !== null && _getCurrentPost$_link !== void 0 ? _getCurrentPost$_link : false,
197
193
  postType: getCurrentPostType(),
198
194
  postId: getCurrentPostId(),
195
+ postStatus: getEditedPostAttribute('status'),
196
+ postStatusHasChanged: getPostEdits()?.status,
199
197
  hasNonPostEntityChanges: hasNonPostEntityChanges(),
200
198
  isSavingNonPostEntityChanges: isSavingNonPostEntityChanges()
201
199
  };
@@ -205,12 +203,14 @@ export default compose([withSelect(select => {
205
203
  savePost
206
204
  } = dispatch(editorStore);
207
205
  return {
208
- onStatusChange: status => editPost({
209
- status
210
- }, {
211
- undoIgnore: true
212
- }),
213
- onSave: savePost
206
+ savePostStatus: status => {
207
+ editPost({
208
+ status
209
+ }, {
210
+ undoIgnore: true
211
+ });
212
+ savePost();
213
+ }
214
214
  };
215
215
  })])(PostPublishButton);
216
216
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["classnames","Button","Component","createRef","withSelect","withDispatch","compose","__","PublishButtonLabel","store","editorStore","noop","PostPublishButton","constructor","props","buttonNode","createOnClick","bind","closeEntitiesSavedStates","state","entitiesSavedStatesCallback","componentDidMount","focusOnMount","timeoutID","setTimeout","current","focus","componentWillUnmount","clearTimeout","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","onSave","onStatusChange","onSubmit","onToggle","visibility","isSavingNonPostEntityChanges","isButtonDisabled","isToggleDisabled","publishStatus","onClickButton","onClickToggle","buttonProps","className","isBusy","variant","onClick","toggleProps","size","toggleChildren","buttonChildren","createElement","componentProps","componentChildren","Fragment","ref","select","_getCurrentPost$_link","isSavingPost","isAutosavingPost","isEditedPostBeingScheduled","getEditedPostVisibility","isCurrentPostPublished","isEditedPostSaveable","isEditedPostPublishable","getCurrentPost","getCurrentPostType","getCurrentPostId","_links","dispatch","editPost","savePost","status","undoIgnore"],"sources":["@wordpress/editor/src/components/post-publish-button/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { Button } from '@wordpress/components';\nimport { Component, createRef } from '@wordpress/element';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\nimport { __ } from '@wordpress/i18n';\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\t\tthis.buttonNode = createRef();\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\tcomponentDidMount() {\n\t\tif ( this.props.focusOnMount ) {\n\t\t\t// This timeout is necessary to make sure the `useEffect` hook of\n\t\t\t// `useFocusReturn` gets the correct element (the button that opens the\n\t\t\t// PostPublishPanel) otherwise it will get this button.\n\t\t\tthis.timeoutID = setTimeout( () => {\n\t\t\t\tthis.buttonNode.current.focus();\n\t\t\t}, 0 );\n\t\t}\n\t}\n\n\tcomponentWillUnmount() {\n\t\tclearTimeout( this.timeoutID );\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\tonSave,\n\t\t\tonStatusChange,\n\t\t\tonSubmit = noop,\n\t\t\tonToggle,\n\t\t\tvisibility,\n\t\t\thasNonPostEntityChanges,\n\t\t\tisSavingNonPostEntityChanges,\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\tlet publishStatus;\n\t\tif ( ! 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} else {\n\t\t\tpublishStatus = 'publish';\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\tonStatusChange( publishStatus );\n\t\t\tonSave();\n\t\t};\n\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\n\t\tconst toggleChildren = isBeingScheduled\n\t\t\t? __( 'Schedule…' )\n\t\t\t: __( 'Publish' );\n\t\tconst buttonChildren = (\n\t\t\t<PublishButtonLabel\n\t\t\t\thasNonPostEntityChanges={ hasNonPostEntityChanges }\n\t\t\t/>\n\t\t);\n\n\t\tconst componentProps = isToggle ? toggleProps : buttonProps;\n\t\tconst componentChildren = isToggle ? toggleChildren : buttonChildren;\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<Button\n\t\t\t\t\tref={ this.buttonNode }\n\t\t\t\t\t{ ...componentProps }\n\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\tcomponentProps.className,\n\t\t\t\t\t\t'editor-post-publish-button__button',\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'has-changes-dot': hasNonPostEntityChanges,\n\t\t\t\t\t\t}\n\t\t\t\t\t) }\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t>\n\t\t\t\t\t{ componentChildren }\n\t\t\t\t</Button>\n\t\t\t</>\n\t\t);\n\t}\n}\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} = 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\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\tonStatusChange: ( status ) =>\n\t\t\t\teditPost( { status }, { undoIgnore: true } ),\n\t\t\tonSave: savePost,\n\t\t};\n\t} ),\n] )( PostPublishButton );\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,SAAS,EAAEC,SAAS,QAAQ,oBAAoB;AACzD,SAASC,UAAU,EAAEC,YAAY,QAAQ,iBAAiB;AAC1D,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;AACA,OAAOC,kBAAkB,MAAM,SAAS;AACxC,SAASC,KAAK,IAAIC,WAAW,QAAQ,aAAa;AAElD,MAAMC,IAAI,GAAGA,CAAA,KAAM,CAAC,CAAC;AAErB,OAAO,MAAMC,iBAAiB,SAASV,SAAS,CAAC;EAChDW,WAAWA,CAAEC,KAAK,EAAG;IACpB,KAAK,CAAEA,KAAM,CAAC;IACd,IAAI,CAACC,UAAU,GAAGZ,SAAS,CAAC,CAAC;IAE7B,IAAI,CAACa,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;EAEAC,iBA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AkB,CAAC"}
1
+ {"version":3,"names":["Button","Component","createRef","withSelect","withDispatch","compose","PublishButtonLabel","store","editorStore","noop","PostPublishButton","constructor","props","buttonNode","createOnClick","bind","closeEntitiesSavedStates","state","entitiesSavedStatesCallback","componentDidMount","focusOnMount","timeoutID","setTimeout","current","focus","componentWillUnmount","clearTimeout","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","createElement","Fragment","ref","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, createRef } 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\t\tthis.buttonNode = createRef();\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\tcomponentDidMount() {\n\t\tif ( this.props.focusOnMount ) {\n\t\t\t// This timeout is necessary to make sure the `useEffect` hook of\n\t\t\t// `useFocusReturn` gets the correct element (the button that opens the\n\t\t\t// PostPublishPanel) otherwise it will get this button.\n\t\t\tthis.timeoutID = setTimeout( () => {\n\t\t\t\tthis.buttonNode.current.focus();\n\t\t\t}, 0 );\n\t\t}\n\t}\n\n\tcomponentWillUnmount() {\n\t\tclearTimeout( this.timeoutID );\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\tref={ this.buttonNode }\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\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,EAAEC,SAAS,QAAQ,oBAAoB;AACzD,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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AA4B,EAAEA,4BAA4B,CAAC;EAC5D,CAAC;AACF,CAAE,CAAC,EACHpD,YAAY,CAAIuF,QAAQ,IAAM;EAC7B,MAAM;IAAEC,QAAQ;IAAEC;EAAS,CAAC,GAAGF,QAAQ,CAAEnF,WAAY,CAAC;EACtD,OAAO;IACN4C,cAAc,EAAIsC,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,CAAEnF,iBAAkB,CAAC","ignoreList":[]}
@@ -2,60 +2,69 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { __ } from '@wordpress/i18n';
5
- import { compose } from '@wordpress/compose';
6
- import { withSelect } from '@wordpress/data';
5
+ import { useSelect } from '@wordpress/data';
6
+ import { useViewportMatch } from '@wordpress/compose';
7
7
 
8
8
  /**
9
9
  * Internal dependencies
10
10
  */
11
11
  import { store as editorStore } from '../../store';
12
- export function PublishButtonLabel({
13
- isPublished,
14
- isBeingScheduled,
15
- isSaving,
16
- isPublishing,
17
- hasPublishAction,
18
- isAutosaving,
19
- hasNonPostEntityChanges
20
- }) {
12
+ export default function PublishButtonLabel() {
13
+ const isSmallerThanMediumViewport = useViewportMatch('medium', '<');
14
+ const {
15
+ isPublished,
16
+ isBeingScheduled,
17
+ isSaving,
18
+ isPublishing,
19
+ hasPublishAction,
20
+ isAutosaving,
21
+ hasNonPostEntityChanges,
22
+ postStatusHasChanged,
23
+ postStatus
24
+ } = useSelect(select => {
25
+ var _getCurrentPost$_link;
26
+ const {
27
+ isCurrentPostPublished,
28
+ isEditedPostBeingScheduled,
29
+ isSavingPost,
30
+ isPublishingPost,
31
+ getCurrentPost,
32
+ getCurrentPostType,
33
+ isAutosavingPost,
34
+ getPostEdits,
35
+ getEditedPostAttribute
36
+ } = select(editorStore);
37
+ return {
38
+ isPublished: isCurrentPostPublished(),
39
+ isBeingScheduled: isEditedPostBeingScheduled(),
40
+ isSaving: isSavingPost(),
41
+ isPublishing: isPublishingPost(),
42
+ hasPublishAction: (_getCurrentPost$_link = getCurrentPost()._links?.['wp:action-publish']) !== null && _getCurrentPost$_link !== void 0 ? _getCurrentPost$_link : false,
43
+ postType: getCurrentPostType(),
44
+ isAutosaving: isAutosavingPost(),
45
+ hasNonPostEntityChanges: select(editorStore).hasNonPostEntityChanges(),
46
+ postStatusHasChanged: !!getPostEdits()?.status,
47
+ postStatus: getEditedPostAttribute('status')
48
+ };
49
+ }, []);
21
50
  if (isPublishing) {
22
51
  /* translators: button label text should, if possible, be under 16 characters. */
23
52
  return __('Publishing…');
24
- } else if (isPublished && isSaving && !isAutosaving) {
25
- /* translators: button label text should, if possible, be under 16 characters. */
26
- return __('Updating…');
27
- } else if (isBeingScheduled && isSaving && !isAutosaving) {
53
+ } else if ((isPublished || isBeingScheduled) && isSaving && !isAutosaving) {
28
54
  /* translators: button label text should, if possible, be under 16 characters. */
29
- return __('Scheduling…');
55
+ return __('Saving…');
30
56
  }
31
57
  if (!hasPublishAction) {
32
- return hasNonPostEntityChanges ? __('Submit for Review…') : __('Submit for Review');
33
- } else if (isPublished) {
34
- return hasNonPostEntityChanges ? __('Update…') : __('Update');
35
- } else if (isBeingScheduled) {
36
- return hasNonPostEntityChanges ? __('Schedule…') : __('Schedule');
58
+ // TODO: this is because "Submit for review" string is too long in some languages.
59
+ // @see https://github.com/WordPress/gutenberg/issues/10475
60
+ return isSmallerThanMediumViewport ? __('Publish') : __('Submit for Review');
61
+ }
62
+ if (hasNonPostEntityChanges || isPublished || postStatusHasChanged && !['future', 'publish'].includes(postStatus) || !postStatusHasChanged && postStatus === 'future') {
63
+ return __('Save');
64
+ }
65
+ if (isBeingScheduled) {
66
+ return __('Schedule');
37
67
  }
38
68
  return __('Publish');
39
69
  }
40
- export default compose([withSelect(select => {
41
- var _getCurrentPost$_link;
42
- const {
43
- isCurrentPostPublished,
44
- isEditedPostBeingScheduled,
45
- isSavingPost,
46
- isPublishingPost,
47
- getCurrentPost,
48
- getCurrentPostType,
49
- isAutosavingPost
50
- } = select(editorStore);
51
- return {
52
- isPublished: isCurrentPostPublished(),
53
- isBeingScheduled: isEditedPostBeingScheduled(),
54
- isSaving: isSavingPost(),
55
- isPublishing: isPublishingPost(),
56
- hasPublishAction: (_getCurrentPost$_link = getCurrentPost()._links?.['wp:action-publish']) !== null && _getCurrentPost$_link !== void 0 ? _getCurrentPost$_link : false,
57
- postType: getCurrentPostType(),
58
- isAutosaving: isAutosavingPost()
59
- };
60
- })])(PublishButtonLabel);
61
70
  //# sourceMappingURL=label.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["__","compose","withSelect","store","editorStore","PublishButtonLabel","isPublished","isBeingScheduled","isSaving","isPublishing","hasPublishAction","isAutosaving","hasNonPostEntityChanges","select","_getCurrentPost$_link","isCurrentPostPublished","isEditedPostBeingScheduled","isSavingPost","isPublishingPost","getCurrentPost","getCurrentPostType","isAutosavingPost","_links","postType"],"sources":["@wordpress/editor/src/components/post-publish-button/label.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { compose } from '@wordpress/compose';\nimport { withSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport function PublishButtonLabel( {\n\tisPublished,\n\tisBeingScheduled,\n\tisSaving,\n\tisPublishing,\n\thasPublishAction,\n\tisAutosaving,\n\thasNonPostEntityChanges,\n} ) {\n\tif ( isPublishing ) {\n\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\treturn __( 'Publishing…' );\n\t} else if ( isPublished && isSaving && ! isAutosaving ) {\n\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\treturn __( 'Updating…' );\n\t} else if ( isBeingScheduled && isSaving && ! isAutosaving ) {\n\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\treturn __( 'Scheduling…' );\n\t}\n\n\tif ( ! hasPublishAction ) {\n\t\treturn hasNonPostEntityChanges\n\t\t\t? __( 'Submit for Review…' )\n\t\t\t: __( 'Submit for Review' );\n\t} else if ( isPublished ) {\n\t\treturn hasNonPostEntityChanges ? __( 'Update…' ) : __( 'Update' );\n\t} else if ( isBeingScheduled ) {\n\t\treturn hasNonPostEntityChanges ? __( 'Schedule…' ) : __( 'Schedule' );\n\t}\n\n\treturn __( 'Publish' );\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst {\n\t\t\tisCurrentPostPublished,\n\t\t\tisEditedPostBeingScheduled,\n\t\t\tisSavingPost,\n\t\t\tisPublishingPost,\n\t\t\tgetCurrentPost,\n\t\t\tgetCurrentPostType,\n\t\t\tisAutosavingPost,\n\t\t} = select( editorStore );\n\t\treturn {\n\t\t\tisPublished: isCurrentPostPublished(),\n\t\t\tisBeingScheduled: isEditedPostBeingScheduled(),\n\t\t\tisSaving: isSavingPost(),\n\t\t\tisPublishing: isPublishingPost(),\n\t\t\thasPublishAction:\n\t\t\t\tgetCurrentPost()._links?.[ 'wp:action-publish' ] ?? false,\n\t\t\tpostType: getCurrentPostType(),\n\t\t\tisAutosaving: isAutosavingPost(),\n\t\t};\n\t} ),\n] )( PublishButtonLabel );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,UAAU,QAAQ,iBAAiB;;AAE5C;AACA;AACA;AACA,SAASC,KAAK,IAAIC,WAAW,QAAQ,aAAa;AAElD,OAAO,SAASC,kBAAkBA,CAAE;EACnCC,WAAW;EACXC,gBAAgB;EAChBC,QAAQ;EACRC,YAAY;EACZC,gBAAgB;EAChBC,YAAY;EACZC;AACD,CAAC,EAAG;EACH,IAAKH,YAAY,EAAG;IACnB;IACA,OAAOT,EAAE,CAAE,aAAc,CAAC;EAC3B,CAAC,MAAM,IAAKM,WAAW,IAAIE,QAAQ,IAAI,CAAEG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,CAAC,CACF,CAAC,CAAEhB,kBAAmB,CAAC"}
1
+ {"version":3,"names":["__","useSelect","useViewportMatch","store","editorStore","PublishButtonLabel","isSmallerThanMediumViewport","isPublished","isBeingScheduled","isSaving","isPublishing","hasPublishAction","isAutosaving","hasNonPostEntityChanges","postStatusHasChanged","postStatus","select","_getCurrentPost$_link","isCurrentPostPublished","isEditedPostBeingScheduled","isSavingPost","isPublishingPost","getCurrentPost","getCurrentPostType","isAutosavingPost","getPostEdits","getEditedPostAttribute","_links","postType","status","includes"],"sources":["@wordpress/editor/src/components/post-publish-button/label.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport default function PublishButtonLabel() {\n\tconst isSmallerThanMediumViewport = useViewportMatch( 'medium', '<' );\n\tconst {\n\t\tisPublished,\n\t\tisBeingScheduled,\n\t\tisSaving,\n\t\tisPublishing,\n\t\thasPublishAction,\n\t\tisAutosaving,\n\t\thasNonPostEntityChanges,\n\t\tpostStatusHasChanged,\n\t\tpostStatus,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tisCurrentPostPublished,\n\t\t\tisEditedPostBeingScheduled,\n\t\t\tisSavingPost,\n\t\t\tisPublishingPost,\n\t\t\tgetCurrentPost,\n\t\t\tgetCurrentPostType,\n\t\t\tisAutosavingPost,\n\t\t\tgetPostEdits,\n\t\t\tgetEditedPostAttribute,\n\t\t} = select( editorStore );\n\t\treturn {\n\t\t\tisPublished: isCurrentPostPublished(),\n\t\t\tisBeingScheduled: isEditedPostBeingScheduled(),\n\t\t\tisSaving: isSavingPost(),\n\t\t\tisPublishing: isPublishingPost(),\n\t\t\thasPublishAction:\n\t\t\t\tgetCurrentPost()._links?.[ 'wp:action-publish' ] ?? false,\n\t\t\tpostType: getCurrentPostType(),\n\t\t\tisAutosaving: isAutosavingPost(),\n\t\t\thasNonPostEntityChanges:\n\t\t\t\tselect( editorStore ).hasNonPostEntityChanges(),\n\t\t\tpostStatusHasChanged: !! getPostEdits()?.status,\n\t\t\tpostStatus: getEditedPostAttribute( 'status' ),\n\t\t};\n\t}, [] );\n\tif ( isPublishing ) {\n\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\treturn __( 'Publishing…' );\n\t} else if (\n\t\t( isPublished || isBeingScheduled ) &&\n\t\tisSaving &&\n\t\t! isAutosaving\n\t) {\n\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\treturn __( 'Saving…' );\n\t}\n\tif ( ! hasPublishAction ) {\n\t\t// TODO: this is because \"Submit for review\" string is too long in some languages.\n\t\t// @see https://github.com/WordPress/gutenberg/issues/10475\n\t\treturn isSmallerThanMediumViewport\n\t\t\t? __( 'Publish' )\n\t\t\t: __( 'Submit for Review' );\n\t}\n\tif (\n\t\thasNonPostEntityChanges ||\n\t\tisPublished ||\n\t\t( postStatusHasChanged &&\n\t\t\t! [ 'future', 'publish' ].includes( postStatus ) ) ||\n\t\t( ! postStatusHasChanged && postStatus === 'future' )\n\t) {\n\t\treturn __( 'Save' );\n\t}\n\tif ( isBeingScheduled ) {\n\t\treturn __( 'Schedule' );\n\t}\n\treturn __( 'Publish' );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,gBAAgB,QAAQ,oBAAoB;;AAErD;AACA;AACA;AACA,SAASC,KAAK,IAAIC,WAAW,QAAQ,aAAa;AAElD,eAAe,SAASC,kBAAkBA,CAAA,EAAG;EAC5C,MAAMC,2BAA2B,GAAGJ,gBAAgB,CAAE,QAAQ,EAAE,GAAI,CAAC;EACrE,MAAM;IACLK,WAAW;IACXC,gBAAgB;IAChBC,QAAQ;IACRC,YAAY;IACZC,gBAAgB;IAChBC,YAAY;IACZC,uBAAuB;IACvBC,oBAAoB;IAC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,WAAW,IACTO,oBAAoB,IACrB,CAAE,CAAE,QAAQ,EAAE,SAAS,CAAE,CAACgB,QAAQ,CAAEf,UAAW,CAAG,IACjD,CAAED,oBAAoB,IAAIC,UAAU,KAAK,QAAU,EACpD;IACD,OAAOf,EAAE,CAAE,MAAO,CAAC;EACpB;EACA,IAAKQ,gBAAgB,EAAG;IACvB,OAAOR,EAAE,CAAE,UAAW,CAAC;EACxB;EACA,OAAOA,EAAE,CAAE,SAAU,CAAC;AACvB","ignoreList":[]}
@@ -0,0 +1,91 @@
1
+ import { createElement } from "react";
2
+ /**
3
+ * WordPress dependencies
4
+ */
5
+ import { useViewportMatch, compose } from '@wordpress/compose';
6
+ import { withDispatch, withSelect } from '@wordpress/data';
7
+
8
+ /**
9
+ * Internal dependencies
10
+ */
11
+ import PostPublishButton from './index';
12
+ import { store as editorStore } from '../../store';
13
+ export function PostPublishButtonOrToggle({
14
+ forceIsDirty,
15
+ hasPublishAction,
16
+ isBeingScheduled,
17
+ isPending,
18
+ isPublished,
19
+ isPublishSidebarEnabled,
20
+ isPublishSidebarOpened,
21
+ isScheduled,
22
+ togglePublishSidebar,
23
+ setEntitiesSavedStatesCallback,
24
+ postStatusHasChanged,
25
+ postStatus
26
+ }) {
27
+ const IS_TOGGLE = 'toggle';
28
+ const IS_BUTTON = 'button';
29
+ const isSmallerThanMediumViewport = useViewportMatch('medium', '<');
30
+ let component;
31
+
32
+ /**
33
+ * Conditions to show a BUTTON (publish directly) or a TOGGLE (open publish sidebar):
34
+ *
35
+ * 1) We want to show a BUTTON when the post status is at the _final stage_
36
+ * for a particular role (see https://wordpress.org/documentation/article/post-status/):
37
+ *
38
+ * - is published
39
+ * - post status has changed explicitely to something different than 'future' or 'publish'
40
+ * - is scheduled to be published
41
+ * - is pending and can't be published (but only for viewports >= medium).
42
+ * Originally, we considered showing a button for pending posts that couldn't be published
43
+ * (for example, for an author with the contributor role). Some languages can have
44
+ * long translations for "Submit for review", so given the lack of UI real estate available
45
+ * we decided to take into account the viewport in that case.
46
+ * See: https://github.com/WordPress/gutenberg/issues/10475
47
+ *
48
+ * 2) Then, in small viewports, we'll show a TOGGLE.
49
+ *
50
+ * 3) Finally, we'll use the publish sidebar status to decide:
51
+ *
52
+ * - if it is enabled, we show a TOGGLE
53
+ * - if it is disabled, we show a BUTTON
54
+ */
55
+ if (isPublished || postStatusHasChanged && !['future', 'publish'].includes(postStatus) || isScheduled && isBeingScheduled || isPending && !hasPublishAction && !isSmallerThanMediumViewport) {
56
+ component = IS_BUTTON;
57
+ } else if (isSmallerThanMediumViewport || isPublishSidebarEnabled) {
58
+ component = IS_TOGGLE;
59
+ } else {
60
+ component = IS_BUTTON;
61
+ }
62
+ return createElement(PostPublishButton, {
63
+ forceIsDirty: forceIsDirty,
64
+ isOpen: isPublishSidebarOpened,
65
+ isToggle: component === IS_TOGGLE,
66
+ onToggle: togglePublishSidebar,
67
+ setEntitiesSavedStatesCallback: setEntitiesSavedStatesCallback
68
+ });
69
+ }
70
+ export default compose(withSelect(select => {
71
+ var _select$getCurrentPos;
72
+ return {
73
+ hasPublishAction: (_select$getCurrentPos = select(editorStore).getCurrentPost()?._links?.['wp:action-publish']) !== null && _select$getCurrentPos !== void 0 ? _select$getCurrentPos : false,
74
+ isBeingScheduled: select(editorStore).isEditedPostBeingScheduled(),
75
+ isPending: select(editorStore).isCurrentPostPending(),
76
+ isPublished: select(editorStore).isCurrentPostPublished(),
77
+ isPublishSidebarEnabled: select(editorStore).isPublishSidebarEnabled(),
78
+ isPublishSidebarOpened: select(editorStore).isPublishSidebarOpened(),
79
+ isScheduled: select(editorStore).isCurrentPostScheduled(),
80
+ postStatus: select(editorStore).getEditedPostAttribute('status'),
81
+ postStatusHasChanged: select(editorStore).getPostEdits()?.status
82
+ };
83
+ }), withDispatch(dispatch => {
84
+ const {
85
+ togglePublishSidebar
86
+ } = dispatch(editorStore);
87
+ return {
88
+ togglePublishSidebar
89
+ };
90
+ }))(PostPublishButtonOrToggle);
91
+ //# sourceMappingURL=post-publish-button-or-toggle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useViewportMatch","compose","withDispatch","withSelect","PostPublishButton","store","editorStore","PostPublishButtonOrToggle","forceIsDirty","hasPublishAction","isBeingScheduled","isPending","isPublished","isPublishSidebarEnabled","isPublishSidebarOpened","isScheduled","togglePublishSidebar","setEntitiesSavedStatesCallback","postStatusHasChanged","postStatus","IS_TOGGLE","IS_BUTTON","isSmallerThanMediumViewport","component","includes","createElement","isOpen","isToggle","onToggle","select","_select$getCurrentPos","getCurrentPost","_links","isEditedPostBeingScheduled","isCurrentPostPending","isCurrentPostPublished","isCurrentPostScheduled","getEditedPostAttribute","getPostEdits","status","dispatch"],"sources":["@wordpress/editor/src/components/post-publish-button/post-publish-button-or-toggle.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useViewportMatch, compose } from '@wordpress/compose';\nimport { withDispatch, withSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport PostPublishButton from './index';\nimport { store as editorStore } from '../../store';\n\nexport function PostPublishButtonOrToggle( {\n\tforceIsDirty,\n\thasPublishAction,\n\tisBeingScheduled,\n\tisPending,\n\tisPublished,\n\tisPublishSidebarEnabled,\n\tisPublishSidebarOpened,\n\tisScheduled,\n\ttogglePublishSidebar,\n\tsetEntitiesSavedStatesCallback,\n\tpostStatusHasChanged,\n\tpostStatus,\n} ) {\n\tconst IS_TOGGLE = 'toggle';\n\tconst IS_BUTTON = 'button';\n\tconst isSmallerThanMediumViewport = useViewportMatch( 'medium', '<' );\n\tlet component;\n\n\t/**\n\t * Conditions to show a BUTTON (publish directly) or a TOGGLE (open publish sidebar):\n\t *\n\t * 1) We want to show a BUTTON when the post status is at the _final stage_\n\t * for a particular role (see https://wordpress.org/documentation/article/post-status/):\n\t *\n\t * - is published\n\t * - post status has changed explicitely to something different than 'future' or 'publish'\n\t * - is scheduled to be published\n\t * - is pending and can't be published (but only for viewports >= medium).\n\t * \t Originally, we considered showing a button for pending posts that couldn't be published\n\t * \t (for example, for an author with the contributor role). Some languages can have\n\t * \t long translations for \"Submit for review\", so given the lack of UI real estate available\n\t * \t we decided to take into account the viewport in that case.\n\t * \t See: https://github.com/WordPress/gutenberg/issues/10475\n\t *\n\t * 2) Then, in small viewports, we'll show a TOGGLE.\n\t *\n\t * 3) Finally, we'll use the publish sidebar status to decide:\n\t *\n\t * - if it is enabled, we show a TOGGLE\n\t * - if it is disabled, we show a BUTTON\n\t */\n\tif (\n\t\tisPublished ||\n\t\t( postStatusHasChanged &&\n\t\t\t! [ 'future', 'publish' ].includes( postStatus ) ) ||\n\t\t( isScheduled && isBeingScheduled ) ||\n\t\t( isPending && ! hasPublishAction && ! isSmallerThanMediumViewport )\n\t) {\n\t\tcomponent = IS_BUTTON;\n\t} else if ( isSmallerThanMediumViewport || isPublishSidebarEnabled ) {\n\t\tcomponent = IS_TOGGLE;\n\t} else {\n\t\tcomponent = IS_BUTTON;\n\t}\n\n\treturn (\n\t\t<PostPublishButton\n\t\t\tforceIsDirty={ forceIsDirty }\n\t\t\tisOpen={ isPublishSidebarOpened }\n\t\t\tisToggle={ component === IS_TOGGLE }\n\t\t\tonToggle={ togglePublishSidebar }\n\t\t\tsetEntitiesSavedStatesCallback={ setEntitiesSavedStatesCallback }\n\t\t/>\n\t);\n}\n\nexport default compose(\n\twithSelect( ( select ) => ( {\n\t\thasPublishAction:\n\t\t\tselect( editorStore ).getCurrentPost()?._links?.[\n\t\t\t\t'wp:action-publish'\n\t\t\t] ?? false,\n\t\tisBeingScheduled: select( editorStore ).isEditedPostBeingScheduled(),\n\t\tisPending: select( editorStore ).isCurrentPostPending(),\n\t\tisPublished: select( editorStore ).isCurrentPostPublished(),\n\t\tisPublishSidebarEnabled:\n\t\t\tselect( editorStore ).isPublishSidebarEnabled(),\n\t\tisPublishSidebarOpened: select( editorStore ).isPublishSidebarOpened(),\n\t\tisScheduled: select( editorStore ).isCurrentPostScheduled(),\n\t\tpostStatus: select( editorStore ).getEditedPostAttribute( 'status' ),\n\t\tpostStatusHasChanged: select( editorStore ).getPostEdits()?.status,\n\t} ) ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { togglePublishSidebar } = dispatch( editorStore );\n\t\treturn {\n\t\t\ttogglePublishSidebar,\n\t\t};\n\t} )\n)( PostPublishButtonOrToggle );\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,gBAAgB,EAAEC,OAAO,QAAQ,oBAAoB;AAC9D,SAASC,YAAY,EAAEC,UAAU,QAAQ,iBAAiB;;AAE1D;AACA;AACA;AACA,OAAOC,iBAAiB,MAAM,SAAS;AACvC,SAASC,KAAK,IAAIC,WAAW,QAAQ,aAAa;AAElD,OAAO,SAASC,yBAAyBA,CAAE;EAC1CC,YAAY;EACZC,gBAAgB;EAChBC,gBAAgB;EAChBC,SAAS;EACTC,WAAW;EACXC,uBAAuB;EACvBC,sBAAsB;EACtBC,WAAW;EACXC,oBAAoB;EACpBC,8BAA8B;EAC9BC,oBAAoB;EACpBC;AACD,CAAC,EAAG;EACH,MAAMC,SAAS,GAAG,QAAQ;EAC1B,MAAMC,SAAS,GAAG,QAAQ;EAC1B,MAAMC,2BAA2B,GAAGtB,gBAAgB,CAAE,QAAQ,EAAE,GAAI,CAAC;EACrE,IAAIuB,SAAS;;EAEb;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACC,IACCX,WAAW,IACTM,oBAAoB,IACrB,CAAE,CAAE,QAAQ,EAAE,SAAS,CAAE,CAACM,QAAQ,CAAEL,UAAW,CAAG,IACjDJ,WAAW,IAAIL,gBAAkB,IACjCC,SAAS,IAAI,CAAEF,gBAAgB,IAAI,CAAEa,2BAA6B,EACnE;IACDC,SAAS,GAAGF,SAAS;EACtB,CAAC,MAAM,IAAKC,2BAA2B,IAAIT,uBAAuB,EAAG;IACpEU,SAAS,GAAGH,SAAS;EACtB,CAAC,MAAM;IACNG,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,QAAQ,CAAElC,WAAY,CAAC;EACxD,OAAO;IACNU;EACD,CAAC;AACF,CAAE,CACH,CAAC,CAAET,yBAA0B,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["__","Component","Button","Spinner","CheckboxControl","withFocusReturn","withConstrainedTabbing","withSelect","withDispatch","compose","closeSmall","store","coreStore","PostPublishButton","PostPublishPanelPrepublish","PostPublishPanelPostpublish","editorStore","PostPublishPanel","constructor","arguments","onSubmit","bind","componentDidUpdate","prevProps","isPublished","props","isSaving","isDirty","onClose","hasPublishAction","isPostTypeViewable","render","forceIsDirty","isBeingScheduled","isPublishSidebarEnabled","isScheduled","isSavingNonPostEntityChanges","onTogglePublishSidebar","PostPublishExtension","PrePublishExtension","additionalProps","propsForPanel","isPublishedOrScheduled","isPrePublish","isPostPublish","createElement","className","onClick","icon","label","Fragment","focusOnMount","disabled","variant","__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 } 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}\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\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-publish-button\">\n\t\t\t\t\t\t\t\t<PostPublishButton\n\t\t\t\t\t\t\t\t\tfocusOnMount\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\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\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>\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</>\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\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,QAAQ,oBAAoB;AAC9C,SACCC,MAAM,EACNC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AA4B,CAAC,CAAC;IAC5DD,WAAW,EAAE4B,sBAAsB,CAAC;EACrC,CAAC;AACF,CAAE,CAAC,EACHvD,YAAY,CAAE,CAAE+D,QAAQ,EAAE;EAAErC;AAAwB,CAAC,KAAM;EAC1D,MAAM;IAAEsC,qBAAqB;IAAEC;EAAqB,CAAC,GACpDF,QAAQ,CAAEvD,WAAY,CAAC;EACxB,OAAO;IACNqB,sBAAsB,EAAEA,CAAA,KAAM;MAC7B,IAAKH,uBAAuB,EAAG;QAC9BsC,qBAAqB,CAAC,CAAC;MACxB,CAAC,MAAM;QACNC,oBAAoB,CAAC,CAAC;MACvB;IACD;EACD,CAAC;AACF,CAAE,CAAC,EACHpE,eAAe,EACfC,sBAAsB,CACrB,CAAC,CAAEW,gBAAiB,CAAC"}
1
+ {"version":3,"names":["__","Component","Button","Spinner","CheckboxControl","withFocusReturn","withConstrainedTabbing","withSelect","withDispatch","compose","closeSmall","store","coreStore","PostPublishButton","PostPublishPanelPrepublish","PostPublishPanelPostpublish","editorStore","PostPublishPanel","constructor","arguments","onSubmit","bind","componentDidUpdate","prevProps","isPublished","props","isSaving","isDirty","onClose","hasPublishAction","isPostTypeViewable","render","forceIsDirty","isBeingScheduled","isPublishSidebarEnabled","isScheduled","isSavingNonPostEntityChanges","onTogglePublishSidebar","PostPublishExtension","PrePublishExtension","additionalProps","propsForPanel","isPublishedOrScheduled","isPrePublish","isPostPublish","createElement","className","onClick","icon","label","Fragment","focusOnMount","disabled","variant","__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 } 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}\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\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-publish-button\">\n\t\t\t\t\t\t\t\t<PostPublishButton\n\t\t\t\t\t\t\t\t\tfocusOnMount\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\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\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>\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</>\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\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,QAAQ,oBAAoB;AAC9C,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;AAElD,OAAO,MAAMC,gBAAgB,SAAShB,SAAS,CAAC;EAC/CiB,WAAWA,CAAA,EAAG;IACb,KAAK,CAAE,GAAGC,SAAU,CAAC;IACrB,IAAI,CAACC,QAAQ,GAAG,IAAI,CAACA,QAAQ,CAACC,IAAI,CAAE,IAAK,CAAC;EAC3C;EAEAC,kBAAkBA,CAAEC,SAAS,EAAG;IAC/B;IACA;IACA,IACCA,SAAS,CAACC,WAAW,IACrB,CAAE,IAAI,CAACC,KAAK,CAACC,QAAQ,IACrB,IAAI,CAACD,KAAK,CAACE,OAAO,EACjB;MACD,IAAI,CAACF,KAAK,CAACG,OAAO,CAAC,CAAC;IACrB;EACD;EAEAR,QAAQA,CAAA,EAAG;IACV,MAAM;MAAEQ,OAAO;MA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AAX,qBAAA,cAAAA,qBAAA,GAAI,KAAK;IAC1D5B,kBAAkB,EAAEsC,QAAQ,EAAEE,QAAQ;IACtCrC,gBAAgB,EAAE+B,0BAA0B,CAAC,CAAC;IAC9CrC,OAAO,EAAEsC,iBAAiB,CAAC,CAAC;IAC5BzC,WAAW,EAAEsC,sBAAsB,CAAC,CAAC;IACrC5B,uBAAuB,EAAEA,uBAAuB,CAAC,CAAC;IAClDR,QAAQ,EAAEyC,YAAY,CAAC,CAAC,IAAI,CAAED,gBAAgB,CAAC,CAAC;IAChD9B,4BAA4B,EAAEA,4BAA4B,CAAC,CAAC;IAC5DD,WAAW,EAAE4B,sBAAsB,CAAC;EACrC,CAAC;AACF,CAAE,CAAC,EACHvD,YAAY,CAAE,CAAE+D,QAAQ,EAAE;EAAErC;AAAwB,CAAC,KAAM;EAC1D,MAAM;IAAEsC,qBAAqB;IAAEC;EAAqB,CAAC,GACpDF,QAAQ,CAAEvD,WAAY,CAAC;EACxB,OAAO;IACNqB,sBAAsB,EAAEA,CAAA,KAAM;MAC7B,IAAKH,uBAAuB,EAAG;QAC9BsC,qBAAqB,CAAC,CAAC;MACxB,CAAC,MAAM;QACNC,oBAAoB,CAAC,CAAC;MACvB;IACD;EACD,CAAC;AACF,CAAE,CAAC,EACHpE,eAAe,EACfC,sBAAsB,CACrB,CAAC,CAAEW,gBAAiB,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["__","useSelect","PanelBody","store","coreStore","useState","useEffect","HierarchicalTermSelector","editorStore","MaybeCategoryPanel","hasNoCategory","select","postType","getCurrentPostType","canUser","getEntityRecord","getTaxonomy","categoriesTaxonomy","defaultCategoryId","default_category","undefined","defaultCategory","postTypeSupportsCategories","types","some","type","categories","getEditedPostAttribute","rest_base","length","id","shouldShowPanel","setShouldShowPanel","panelBodyTitle","createElement","className","key","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', 'settings' )\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;AAElD,SAASC,kBAAkBA,CAAA,EAAG;EAC7B,MAAMC,aAAa,GAAGT,SAAS,CAAIU,MAAM,IAAM;IAC9C,MAAMC,QAAQ,GAAGD,MAAM,CAAEH,WAAY,CAAC,CAACK,kBAAkB,CAAC,CAAC;IAC3D,MAAM;MAAEC,OAAO;MAAEC,eAAe;MAAEC;IAAY,CAAC,GAAGL,MAAM,CAAEP,SAAU,CAAC;IACrE,MAAMa,kBAAkB,GAAGD,WAAW,CAAE,UAAW,CAAC;IACpD,MAAME,iBAAiB,GAAGJ,OAAO,CAAE,MAAM,EAAE,UAAW,CAAC,GACpDC,eAAe,CAAE,MAAM,EAAE,MAAO,CAAC,EAAEI,gBAAgB,GACnDC,SAAS;IAC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I,EAAC;EAAU,CAAE,CACjC,CAAC;AAEd;AAEA,eAAe9B,kBAAkB"}
1
+ {"version":3,"names":["__","useSelect","PanelBody","store","coreStore","useState","useEffect","HierarchicalTermSelector","editorStore","MaybeCategoryPanel","hasNoCategory","select","postType","getCurrentPostType","canUser","getEntityRecord","getTaxonomy","categoriesTaxonomy","defaultCategoryId","default_category","undefined","defaultCategory","postTypeSupportsCategories","types","some","type","categories","getEditedPostAttribute","rest_base","length","id","shouldShowPanel","setShouldShowPanel","panelBodyTitle","createElement","className","key","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', 'settings' )\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;AAElD,SAASC,kBAAkBA,CAAA,EAAG;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aAAa,CAAG,CAAC;EAEtB,IAAK,CAAEqB,eAAe,EAAG;IACxB,OAAO,IAAI;EACZ;EAEA,MAAME,cAAc,GAAG,CACtBjC,EAAE,CAAE,aAAc,CAAC,EACnBkC,aAAA;IAAMC,SAAS,EAAC,iCAAiC;IAACC,GAAG,EAAC;EAAO,GAC1DpC,EAAE,CAAE,mBAAoB,CACrB,CAAC,CACP;EAED,OACCkC,aAAA,CAAChC,SAAS;IAACmC,WAAW,EAAG,KAAO;IAACC,KAAK,EAAGL;EAAgB,GACxDC,aAAA,YACGlC,EAAE,CACH,oHACD,CACE,CAAC,EACJkC,aAAA,CAAC3B,wBAAwB;IAACgC,IAAI,EAAC;EAAU,CAAE,CACjC,CAAC;AAEd;AAEA,eAAe9B,kBAAkB","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["Button","PanelBody","useDispatch","useSelect","__","sprintf","store","coreStore","POST_FORMATS","editorStore","getSuggestion","supportedFormats","suggestedPostFormat","formats","filter","format","includes","id","find","PostFormatSuggestion","suggestionText","onUpdatePostFormat","createElement","variant","onClick","PostFormatPanel","currentPostFormat","suggestion","select","_select$getThemeSuppo","getEditedPostAttribute","getSuggestedPostFormat","getThemeSupports","editPost","panelBodyTitle","className","key","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\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>\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sBAAsB,CAAE,QAAS,CAAC;MACrDH,UAAU,EAAEjB,aAAa,CACxBC,gBAAgB,EAChBoB,sBAAsB,CAAC,CACxB;IACD,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,MAAM;IAAEE;EAAS,CAAC,GAAG/B,WAAW,CAAEO,WAAY,CAAC;EAE/C,MAAMY,kBAAkB,GAAKN,MAAM,IAAMkB,QAAQ,CAAE;IAAElB;EAAO,CAAE,CAAC;EAE/D,MAAMmB,cAAc,GAAG,CACtB9B,EAAE,CAAE,aAAc,CAAC,EACnBkB,aAAA;IAAMa,SAAS,EAAC,iCAAiC;IAACC,GAAG,EAAC;EAAO,GAC1DhC,EAAE,CAAE,mBAAoB,CACrB,CAAC,CACP;EAED,IAAK,CAAEuB,UAAU,IAAIA,UAAU,CAACV,EAAE,KAAKS,iBAAiB,EAAG;IAC1D,OAAO,IAAI;EACZ;EAEA,OACCJ,aAAA,CAACrB,SAAS;IAACoC,WAAW,EAAG,KAAO;IAACC,KAAK,EAAGJ;EAAgB,GACxDZ,aAAA,YACGlB,EAAE,CACH,+IACD,CACE,CAAC,EACJkB,aAAA,YACCA,aAAA,CAACH,oBAAoB;IACpBE,kBAAkB,EAAGA,kBAAoB;IACzCT,mBAAmB,EAAGe,UAAU,CAACV,EAAI;IACrCG,cAAc,EAAGf,OAAO,EACvB;IACAD,EAAE,CAAE,0BAA2B,CAAC,EAChCuB,UAAU,CAACY,OACZ;EAAG,CACH,CACC,CACO,CAAC;AAEd"}
1
+ {"version":3,"names":["Button","PanelBody","useDispatch","useSelect","__","sprintf","store","coreStore","POST_FORMATS","editorStore","getSuggestion","supportedFormats","suggestedPostFormat","formats","filter","format","includes","id","find","PostFormatSuggestion","suggestionText","onUpdatePostFormat","createElement","variant","onClick","PostFormatPanel","currentPostFormat","suggestion","select","_select$getThemeSuppo","getEditedPostAttribute","getSuggestedPostFormat","getThemeSupports","editPost","panelBodyTitle","className","key","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\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;AAElD,MAAMC,aAAa,GAAGA,CAAEC,gBAAgB,EAAEC,mBAAmB,KAAM;EAClE,MAAMC,OAAO,GAAGL,YAAY,CAACM,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,mBAAoB,CAAC;AACvE,CAAC;AAED,MAAMO,oBAAoB,GAAGA,CAAE;EAC9BP,mBAAmB;EACnBQ,cAAc;EACdC;AACD,CAAC,KACAC,aAAA,CAACtB,MAAM;EACNuB,OAAO,EAAC,MAAM;EACdC,OAAO,EAAGA,CAAA,KAAMH,kBAAkB,CAAET,mBAAoB;AAAG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rCG,cAAc,EAAGf,OAAO,EACvB;IACAD,EAAE,CAAE,0BAA2B,CAAC,EAChCuB,UAAU,CAACY,OACZ;EAAG,CACH,CACC,CACO,CAAC;AAEd","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["__","useState","useSelect","PanelBody","store","coreStore","FlatTermSelector","editorStore","TagsPanel","panelBodyTitle","createElement","className","key","initialOpen","title","slug","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' } />\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;AAElD,MAAMC,SAAS,GAAGA,CAAA,KAAM;EACvB,MAAMC,cAAc,GAAG,CACtBT,EAAE,CAAE,aAAc,CAAC,EACnBU,aAAA;IAAMC,SAAS,EAAC,iCAAiC;IAACC,GAAG,EAAC;EAAO,GAC1DZ,EAAE,CAAE,UAAW,CACZ,CAAC,CACP;EAED,OACCU,aAAA,CAACP,SAAS;IAACU,WAAW,EAAG,KAAO;IAACC,KAAK,EAAGL;EAAgB,GACxDC,aAAA,YACGV,EAAE,CACH,wHACD,CACE,CAAC,EACJU,aAAA,CAACJ,gBAAgB;IAACS,IAAI,EAAG;EAAY,CAAE,CAC7B,CAAC;AAEd,CAAC;AAED,MAAMC,cAAc,GAAGA,CAAA,KAAM;EAC5B,MAAM;IAAEC,OAAO;IAAEC;EAAoB,CAAC,GAAGhB,SAAS,CAAIiB,MAAM,IAAM;IACjE,MAAMC,QAAQ,GAAGD,MAAM,CAAEZ,WAAY,CAAC,CAACc,kBAAkB,CAAC,CAAC;IAC3D,MAAMC,YAAY,GAAGH,MAAM,CAAEd,SAAU,CAAC,CAACkB,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,CAAEZ,WAAY,CAAC,CAACuB,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,GAAGhC,QAAQ,CAAEgB,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,OAAOvB,aAAA,CAACF,SAAS,MAAE,CAAC;EACrB;EAEA,OAAO,IAAI;AACZ,CAAC;AAED,eAAeQ,cAAc"}
1
+ {"version":3,"names":["__","useState","useSelect","PanelBody","store","coreStore","FlatTermSelector","editorStore","TagsPanel","panelBodyTitle","createElement","className","key","initialOpen","title","slug","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' } />\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;AAElD,MAAMC,SAAS,GAAGA,CAAA,KAAM;EACvB,MAAMC,cAAc,GAAG,CACtBT,EAAE,CAAE,aAAc,CAAC,EACnBU,aAAA;IAAMC,SAAS,EAAC,iCAAiC;IAACC,GAAG,EAAC;EAAO,GAC1DZ,EAAE,CAAE,UAAW,CACZ,CAAC,CACP;EAED,OACCU,aAAA,CAACP,SAAS;IAACU,WAAW,EAAG,KAAO;IAACC,KAAK,EAAGL;EAAgB,GACxDC,aAAA,YACGV,EAAE,CACH,wHACD,CACE,CAAC,EACJU,aAAA,CAACJ,gBAAgB;IAACS,IAAI,EAAG;EAAY,CAAE,CAC7B,CAAC;AAEd,CAAC;AAED,MAAMC,cAAc,GAAGA,CAAA,KAAM;EAC5B,MAAM;IAAEC,OAAO;IAAEC;EAAoB,CAAC,GAAGhB,SAAS,CAAIiB,MAAM,IAAM;IACjE,MAAMC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