@wordpress/editor 14.38.0 → 14.39.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 (233) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/document-bar/useEditedSectionDetails.cjs +0 -3
  3. package/build/components/document-bar/useEditedSectionDetails.cjs.map +2 -2
  4. package/build/components/editor-interface/index.cjs +33 -9
  5. package/build/components/editor-interface/index.cjs.map +2 -2
  6. package/build/components/header/header-skeleton.cjs +100 -0
  7. package/build/components/header/header-skeleton.cjs.map +7 -0
  8. package/build/components/header/index.cjs +63 -106
  9. package/build/components/header/index.cjs.map +3 -3
  10. package/build/components/media/index.cjs +44 -0
  11. package/build/components/media/index.cjs.map +7 -0
  12. package/build/components/media/metadata-panel.cjs +96 -0
  13. package/build/components/media/metadata-panel.cjs.map +7 -0
  14. package/build/components/media/preview.cjs +39 -0
  15. package/build/components/media/preview.cjs.map +7 -0
  16. package/build/components/more-menu/index.cjs +3 -2
  17. package/build/components/more-menu/index.cjs.map +2 -2
  18. package/build/components/post-card-panel/index.cjs +33 -4
  19. package/build/components/post-card-panel/index.cjs.map +3 -3
  20. package/build/components/post-content-information/index.cjs +9 -0
  21. package/build/components/post-content-information/index.cjs.map +2 -2
  22. package/build/components/post-last-edited-panel/index.cjs +5 -6
  23. package/build/components/post-last-edited-panel/index.cjs.map +2 -2
  24. package/build/components/post-last-revision/index.cjs +5 -7
  25. package/build/components/post-last-revision/index.cjs.map +2 -2
  26. package/build/components/post-publish-button/label.cjs +6 -1
  27. package/build/components/post-publish-button/label.cjs.map +2 -2
  28. package/build/components/post-publish-button/post-publish-button-or-toggle.cjs +8 -3
  29. package/build/components/post-publish-button/post-publish-button-or-toggle.cjs.map +2 -2
  30. package/build/components/post-revisions-preview/index.cjs +44 -0
  31. package/build/components/post-revisions-preview/index.cjs.map +7 -0
  32. package/build/components/post-revisions-preview/revisions-canvas.cjs +82 -0
  33. package/build/components/post-revisions-preview/revisions-canvas.cjs.map +7 -0
  34. package/build/components/post-revisions-preview/revisions-header.cjs +119 -0
  35. package/build/components/post-revisions-preview/revisions-header.cjs.map +7 -0
  36. package/build/components/post-revisions-preview/revisions-slider.cjs +110 -0
  37. package/build/components/post-revisions-preview/revisions-slider.cjs.map +7 -0
  38. package/build/components/post-saved-state/index.cjs +8 -2
  39. package/build/components/post-saved-state/index.cjs.map +2 -2
  40. package/build/components/post-title/index.cjs +5 -4
  41. package/build/components/post-title/index.cjs.map +2 -2
  42. package/build/components/provider/index.cjs +19 -0
  43. package/build/components/provider/index.cjs.map +3 -3
  44. package/build/components/provider/use-block-editor-settings.cjs +2 -1
  45. package/build/components/provider/use-block-editor-settings.cjs.map +2 -2
  46. package/build/components/revision-author-panel/index.cjs +59 -0
  47. package/build/components/revision-author-panel/index.cjs.map +7 -0
  48. package/build/components/revision-created-panel/index.cjs +47 -0
  49. package/build/components/revision-created-panel/index.cjs.map +7 -0
  50. package/build/components/sidebar/header.cjs +27 -12
  51. package/build/components/sidebar/header.cjs.map +3 -3
  52. package/build/components/sidebar/index.cjs +36 -15
  53. package/build/components/sidebar/index.cjs.map +3 -3
  54. package/build/components/sidebar/post-summary.cjs +44 -19
  55. package/build/components/sidebar/post-summary.cjs.map +3 -3
  56. package/build/components/start-page-options/index.cjs +1 -1
  57. package/build/components/start-page-options/index.cjs.map +2 -2
  58. package/build/dataviews/store/private-actions.cjs +47 -26
  59. package/build/dataviews/store/private-actions.cjs.map +3 -3
  60. package/build/store/constants.cjs +3 -0
  61. package/build/store/constants.cjs.map +2 -2
  62. package/build/store/private-actions.cjs +40 -0
  63. package/build/store/private-actions.cjs.map +2 -2
  64. package/build/store/private-selectors.cjs +33 -2
  65. package/build/store/private-selectors.cjs.map +2 -2
  66. package/build/store/reducer.cjs +10 -0
  67. package/build/store/reducer.cjs.map +2 -2
  68. package/build/store/selectors.cjs +3 -0
  69. package/build/store/selectors.cjs.map +2 -2
  70. package/build/store/utils/notice-builder.cjs +4 -0
  71. package/build/store/utils/notice-builder.cjs.map +2 -2
  72. package/build-module/components/document-bar/useEditedSectionDetails.mjs +0 -3
  73. package/build-module/components/document-bar/useEditedSectionDetails.mjs.map +2 -2
  74. package/build-module/components/editor-interface/index.mjs +33 -9
  75. package/build-module/components/editor-interface/index.mjs.map +2 -2
  76. package/build-module/components/header/header-skeleton.mjs +69 -0
  77. package/build-module/components/header/header-skeleton.mjs.map +7 -0
  78. package/build-module/components/header/index.mjs +65 -107
  79. package/build-module/components/header/index.mjs.map +2 -2
  80. package/build-module/components/media/index.mjs +8 -0
  81. package/build-module/components/media/index.mjs.map +7 -0
  82. package/build-module/components/media/metadata-panel.mjs +65 -0
  83. package/build-module/components/media/metadata-panel.mjs.map +7 -0
  84. package/build-module/components/media/preview.mjs +21 -0
  85. package/build-module/components/media/preview.mjs.map +7 -0
  86. package/build-module/components/more-menu/index.mjs +3 -2
  87. package/build-module/components/more-menu/index.mjs.map +2 -2
  88. package/build-module/components/post-card-panel/index.mjs +35 -5
  89. package/build-module/components/post-card-panel/index.mjs.map +3 -3
  90. package/build-module/components/post-content-information/index.mjs +9 -0
  91. package/build-module/components/post-content-information/index.mjs.map +2 -2
  92. package/build-module/components/post-last-edited-panel/index.mjs +5 -6
  93. package/build-module/components/post-last-edited-panel/index.mjs.map +2 -2
  94. package/build-module/components/post-last-revision/index.mjs +6 -8
  95. package/build-module/components/post-last-revision/index.mjs.map +2 -2
  96. package/build-module/components/post-publish-button/label.mjs +6 -1
  97. package/build-module/components/post-publish-button/label.mjs.map +2 -2
  98. package/build-module/components/post-publish-button/post-publish-button-or-toggle.mjs +8 -3
  99. package/build-module/components/post-publish-button/post-publish-button-or-toggle.mjs.map +2 -2
  100. package/build-module/components/post-revisions-preview/index.mjs +8 -0
  101. package/build-module/components/post-revisions-preview/index.mjs.map +7 -0
  102. package/build-module/components/post-revisions-preview/revisions-canvas.mjs +54 -0
  103. package/build-module/components/post-revisions-preview/revisions-canvas.mjs.map +7 -0
  104. package/build-module/components/post-revisions-preview/revisions-header.mjs +92 -0
  105. package/build-module/components/post-revisions-preview/revisions-header.mjs.map +7 -0
  106. package/build-module/components/post-revisions-preview/revisions-slider.mjs +89 -0
  107. package/build-module/components/post-revisions-preview/revisions-slider.mjs.map +7 -0
  108. package/build-module/components/post-saved-state/index.mjs +8 -2
  109. package/build-module/components/post-saved-state/index.mjs.map +2 -2
  110. package/build-module/components/post-title/index.mjs +5 -4
  111. package/build-module/components/post-title/index.mjs.map +2 -2
  112. package/build-module/components/provider/index.mjs +19 -0
  113. package/build-module/components/provider/index.mjs.map +2 -2
  114. package/build-module/components/provider/use-block-editor-settings.mjs +2 -1
  115. package/build-module/components/provider/use-block-editor-settings.mjs.map +2 -2
  116. package/build-module/components/revision-author-panel/index.mjs +28 -0
  117. package/build-module/components/revision-author-panel/index.mjs.map +7 -0
  118. package/build-module/components/revision-created-panel/index.mjs +26 -0
  119. package/build-module/components/revision-created-panel/index.mjs.map +7 -0
  120. package/build-module/components/sidebar/header.mjs +22 -7
  121. package/build-module/components/sidebar/header.mjs.map +2 -2
  122. package/build-module/components/sidebar/index.mjs +38 -16
  123. package/build-module/components/sidebar/index.mjs.map +2 -2
  124. package/build-module/components/sidebar/post-summary.mjs +48 -20
  125. package/build-module/components/sidebar/post-summary.mjs.map +2 -2
  126. package/build-module/components/start-page-options/index.mjs +2 -1
  127. package/build-module/components/start-page-options/index.mjs.map +2 -2
  128. package/build-module/dataviews/store/private-actions.mjs +59 -27
  129. package/build-module/dataviews/store/private-actions.mjs.map +2 -2
  130. package/build-module/store/constants.mjs +2 -0
  131. package/build-module/store/constants.mjs.map +2 -2
  132. package/build-module/store/private-actions.mjs +38 -0
  133. package/build-module/store/private-actions.mjs.map +2 -2
  134. package/build-module/store/private-selectors.mjs +29 -1
  135. package/build-module/store/private-selectors.mjs.map +2 -2
  136. package/build-module/store/reducer.mjs +9 -0
  137. package/build-module/store/reducer.mjs.map +2 -2
  138. package/build-module/store/selectors.mjs +4 -0
  139. package/build-module/store/selectors.mjs.map +2 -2
  140. package/build-module/store/utils/notice-builder.mjs +4 -0
  141. package/build-module/store/utils/notice-builder.mjs.map +2 -2
  142. package/build-style/style-rtl.css +182 -16
  143. package/build-style/style.css +182 -16
  144. package/build-types/components/document-bar/useEditedSectionDetails.d.ts.map +1 -1
  145. package/build-types/components/editor-interface/index.d.ts.map +1 -1
  146. package/build-types/components/header/header-skeleton.d.ts +17 -0
  147. package/build-types/components/header/header-skeleton.d.ts.map +1 -0
  148. package/build-types/components/header/index.d.ts.map +1 -1
  149. package/build-types/components/media/index.d.ts +3 -0
  150. package/build-types/components/media/index.d.ts.map +1 -0
  151. package/build-types/components/media/metadata-panel.d.ts +12 -0
  152. package/build-types/components/media/metadata-panel.d.ts.map +1 -0
  153. package/build-types/components/media/preview.d.ts +9 -0
  154. package/build-types/components/media/preview.d.ts.map +1 -0
  155. package/build-types/components/more-menu/index.d.ts +3 -1
  156. package/build-types/components/more-menu/index.d.ts.map +1 -1
  157. package/build-types/components/post-card-panel/index.d.ts.map +1 -1
  158. package/build-types/components/post-content-information/index.d.ts.map +1 -1
  159. package/build-types/components/post-last-edited-panel/index.d.ts.map +1 -1
  160. package/build-types/components/post-last-revision/index.d.ts.map +1 -1
  161. package/build-types/components/post-publish-button/label.d.ts.map +1 -1
  162. package/build-types/components/post-publish-button/post-publish-button-or-toggle.d.ts.map +1 -1
  163. package/build-types/components/post-revisions-preview/index.d.ts +3 -0
  164. package/build-types/components/post-revisions-preview/index.d.ts.map +1 -0
  165. package/build-types/components/post-revisions-preview/revisions-canvas.d.ts +7 -0
  166. package/build-types/components/post-revisions-preview/revisions-canvas.d.ts.map +1 -0
  167. package/build-types/components/post-revisions-preview/revisions-header.d.ts +8 -0
  168. package/build-types/components/post-revisions-preview/revisions-header.d.ts.map +1 -0
  169. package/build-types/components/post-revisions-preview/revisions-slider.d.ts +8 -0
  170. package/build-types/components/post-revisions-preview/revisions-slider.d.ts.map +1 -0
  171. package/build-types/components/post-saved-state/index.d.ts.map +1 -1
  172. package/build-types/components/provider/index.d.ts.map +1 -1
  173. package/build-types/components/provider/use-block-editor-settings.d.ts.map +1 -1
  174. package/build-types/components/revision-author-panel/index.d.ts +2 -0
  175. package/build-types/components/revision-author-panel/index.d.ts.map +1 -0
  176. package/build-types/components/revision-created-panel/index.d.ts +2 -0
  177. package/build-types/components/revision-created-panel/index.d.ts.map +1 -0
  178. package/build-types/components/sidebar/index.d.ts.map +1 -1
  179. package/build-types/components/sidebar/post-summary.d.ts.map +1 -1
  180. package/build-types/components/start-page-options/index.d.ts.map +1 -1
  181. package/build-types/dataviews/store/private-actions.d.ts +1 -0
  182. package/build-types/dataviews/store/private-actions.d.ts.map +1 -1
  183. package/build-types/store/constants.d.ts +1 -0
  184. package/build-types/store/constants.d.ts.map +1 -1
  185. package/build-types/store/private-actions.d.ts +13 -0
  186. package/build-types/store/private-actions.d.ts.map +1 -1
  187. package/build-types/store/private-selectors.d.ts +25 -0
  188. package/build-types/store/private-selectors.d.ts.map +1 -1
  189. package/build-types/store/reducer.d.ts +11 -0
  190. package/build-types/store/reducer.d.ts.map +1 -1
  191. package/build-types/store/selectors.d.ts.map +1 -1
  192. package/build-types/store/utils/notice-builder.d.ts.map +1 -1
  193. package/package.json +42 -40
  194. package/src/components/document-bar/useEditedSectionDetails.js +0 -5
  195. package/src/components/editor-interface/index.js +39 -9
  196. package/src/components/header/header-skeleton.js +90 -0
  197. package/src/components/header/index.js +69 -102
  198. package/src/components/header/style.scss +4 -0
  199. package/src/components/media/index.js +2 -0
  200. package/src/components/media/metadata-panel.js +77 -0
  201. package/src/components/media/preview.js +35 -0
  202. package/src/components/more-menu/index.js +2 -1
  203. package/src/components/post-card-panel/index.js +43 -7
  204. package/src/components/post-content-information/index.js +11 -0
  205. package/src/components/post-last-edited-panel/index.js +8 -9
  206. package/src/components/post-last-revision/index.js +7 -8
  207. package/src/components/post-publish-button/label.js +9 -0
  208. package/src/components/post-publish-button/post-publish-button-or-toggle.js +13 -5
  209. package/src/components/post-revisions-preview/index.js +2 -0
  210. package/src/components/post-revisions-preview/revisions-canvas.js +73 -0
  211. package/src/components/post-revisions-preview/revisions-header.js +108 -0
  212. package/src/components/post-revisions-preview/revisions-slider.js +123 -0
  213. package/src/components/post-revisions-preview/style.scss +22 -0
  214. package/src/components/post-saved-state/index.js +8 -0
  215. package/src/components/post-title/index.js +4 -3
  216. package/src/components/provider/index.js +26 -0
  217. package/src/components/provider/use-block-editor-settings.js +2 -3
  218. package/src/components/revision-author-panel/index.js +36 -0
  219. package/src/components/revision-created-panel/index.js +36 -0
  220. package/src/components/sidebar/header.js +35 -14
  221. package/src/components/sidebar/index.js +40 -13
  222. package/src/components/sidebar/post-summary.js +45 -11
  223. package/src/components/sidebar/style.scss +7 -0
  224. package/src/components/start-page-options/index.js +2 -0
  225. package/src/dataviews/store/private-actions.ts +79 -33
  226. package/src/store/constants.ts +1 -0
  227. package/src/store/private-actions.js +70 -0
  228. package/src/store/private-selectors.js +54 -0
  229. package/src/store/reducer.js +17 -0
  230. package/src/store/selectors.js +6 -0
  231. package/src/store/test/selectors.js +7 -0
  232. package/src/store/utils/notice-builder.js +9 -0
  233. package/src/style.scss +2 -0
@@ -37,6 +37,7 @@ var import_compose = require("@wordpress/compose");
37
37
  var import_data = require("@wordpress/data");
38
38
  var import_index = __toESM(require("./index.cjs"));
39
39
  var import_store = require("../../store/index.cjs");
40
+ var import_constants = require("../../store/constants.cjs");
40
41
  var import_jsx_runtime = require("react/jsx-runtime");
41
42
  var IS_TOGGLE = "toggle";
42
43
  var IS_BUTTON = "button";
@@ -56,7 +57,8 @@ function PostPublishButtonOrToggle({
56
57
  isPublishSidebarOpened,
57
58
  isScheduled,
58
59
  postStatus,
59
- postStatusHasChanged
60
+ postStatusHasChanged,
61
+ postType
60
62
  } = (0, import_data.useSelect)((select) => {
61
63
  return {
62
64
  hasPublishAction: !!select(import_store.store).getCurrentPost()?._links?.["wp:action-publish"],
@@ -67,10 +69,13 @@ function PostPublishButtonOrToggle({
67
69
  isPublishSidebarOpened: select(import_store.store).isPublishSidebarOpened(),
68
70
  isScheduled: select(import_store.store).isCurrentPostScheduled(),
69
71
  postStatus: select(import_store.store).getEditedPostAttribute("status"),
70
- postStatusHasChanged: select(import_store.store).getPostEdits()?.status
72
+ postStatusHasChanged: select(import_store.store).getPostEdits()?.status,
73
+ postType: select(import_store.store).getCurrentPostType()
71
74
  };
72
75
  }, []);
73
- if (isPublished || postStatusHasChanged && !["future", "publish"].includes(postStatus) || isScheduled && isBeingScheduled || isPending && !hasPublishAction && !isSmallerThanMediumViewport) {
76
+ if (postType === import_constants.ATTACHMENT_POST_TYPE) {
77
+ component = IS_BUTTON;
78
+ } else if (isPublished || postStatusHasChanged && !["future", "publish"].includes(postStatus) || isScheduled && isBeingScheduled || isPending && !hasPublishAction && !isSmallerThanMediumViewport) {
74
79
  component = IS_BUTTON;
75
80
  } else if (isSmallerThanMediumViewport || isPublishSidebarEnabled) {
76
81
  component = IS_TOGGLE;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/post-publish-button/post-publish-button-or-toggle.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useViewportMatch } from '@wordpress/compose';\nimport { useDispatch, useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport PostPublishButton from './index';\nimport { store as editorStore } from '../../store';\n\nconst IS_TOGGLE = 'toggle';\nconst IS_BUTTON = 'button';\n\nexport default function PostPublishButtonOrToggle( {\n\tforceIsDirty,\n\tsetEntitiesSavedStatesCallback,\n} ) {\n\tlet component;\n\tconst isSmallerThanMediumViewport = useViewportMatch( 'medium', '<' );\n\tconst { togglePublishSidebar } = useDispatch( editorStore );\n\tconst {\n\t\thasPublishAction,\n\t\tisBeingScheduled,\n\t\tisPending,\n\t\tisPublished,\n\t\tisPublishSidebarEnabled,\n\t\tisPublishSidebarOpened,\n\t\tisScheduled,\n\t\tpostStatus,\n\t\tpostStatusHasChanged,\n\t} = useSelect( ( select ) => {\n\t\treturn {\n\t\t\thasPublishAction:\n\t\t\t\t!! select( editorStore ).getCurrentPost()?._links?.[\n\t\t\t\t\t'wp:action-publish'\n\t\t\t\t],\n\t\t\tisBeingScheduled:\n\t\t\t\tselect( editorStore ).isEditedPostBeingScheduled(),\n\t\t\tisPending: select( editorStore ).isCurrentPostPending(),\n\t\t\tisPublished: select( editorStore ).isCurrentPostPublished(),\n\t\t\tisPublishSidebarEnabled:\n\t\t\t\tselect( editorStore ).isPublishSidebarEnabled(),\n\t\t\tisPublishSidebarOpened:\n\t\t\t\tselect( editorStore ).isPublishSidebarOpened(),\n\t\t\tisScheduled: select( editorStore ).isCurrentPostScheduled(),\n\t\t\tpostStatus:\n\t\t\t\tselect( editorStore ).getEditedPostAttribute( 'status' ),\n\t\t\tpostStatusHasChanged: select( editorStore ).getPostEdits()?.status,\n\t\t};\n\t}, [] );\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 explicitly 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"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAAiC;AACjC,kBAAuC;AAKvC,mBAA8B;AAC9B,mBAAqC;AAiFnC;AA/EF,IAAM,YAAY;AAClB,IAAM,YAAY;AAEH,SAAR,0BAA4C;AAAA,EAClD;AAAA,EACA;AACD,GAAI;AACH,MAAI;AACJ,QAAM,kCAA8B,iCAAkB,UAAU,GAAI;AACpE,QAAM,EAAE,qBAAqB,QAAI,yBAAa,aAAAA,KAAY;AAC1D,QAAM;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,QAAI,uBAAW,CAAE,WAAY;AAC5B,WAAO;AAAA,MACN,kBACC,CAAC,CAAE,OAAQ,aAAAA,KAAY,EAAE,eAAe,GAAG,SAC1C,mBACD;AAAA,MACD,kBACC,OAAQ,aAAAA,KAAY,EAAE,2BAA2B;AAAA,MAClD,WAAW,OAAQ,aAAAA,KAAY,EAAE,qBAAqB;AAAA,MACtD,aAAa,OAAQ,aAAAA,KAAY,EAAE,uBAAuB;AAAA,MAC1D,yBACC,OAAQ,aAAAA,KAAY,EAAE,wBAAwB;AAAA,MAC/C,wBACC,OAAQ,aAAAA,KAAY,EAAE,uBAAuB;AAAA,MAC9C,aAAa,OAAQ,aAAAA,KAAY,EAAE,uBAAuB;AAAA,MAC1D,YACC,OAAQ,aAAAA,KAAY,EAAE,uBAAwB,QAAS;AAAA,MACxD,sBAAsB,OAAQ,aAAAA,KAAY,EAAE,aAAa,GAAG;AAAA,IAC7D;AAAA,EACD,GAAG,CAAC,CAAE;AAyBN,MACC,eACE,wBACD,CAAE,CAAE,UAAU,SAAU,EAAE,SAAU,UAAW,KAC9C,eAAe,oBACf,aAAa,CAAE,oBAAoB,CAAE,6BACtC;AACD,gBAAY;AAAA,EACb,WAAY,+BAA+B,yBAA0B;AACpE,gBAAY;AAAA,EACb,OAAO;AACN,gBAAY;AAAA,EACb;AAEA,SACC;AAAA,IAAC,aAAAC;AAAA,IAAA;AAAA,MACA;AAAA,MACA,QAAS;AAAA,MACT,UAAW,cAAc;AAAA,MACzB,UAAW;AAAA,MACX;AAAA;AAAA,EACD;AAEF;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useViewportMatch } from '@wordpress/compose';\nimport { useDispatch, useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport PostPublishButton from './index';\nimport { store as editorStore } from '../../store';\nimport { ATTACHMENT_POST_TYPE } from '../../store/constants';\n\nconst IS_TOGGLE = 'toggle';\nconst IS_BUTTON = 'button';\n\nexport default function PostPublishButtonOrToggle( {\n\tforceIsDirty,\n\tsetEntitiesSavedStatesCallback,\n} ) {\n\tlet component;\n\tconst isSmallerThanMediumViewport = useViewportMatch( 'medium', '<' );\n\tconst { togglePublishSidebar } = useDispatch( editorStore );\n\tconst {\n\t\thasPublishAction,\n\t\tisBeingScheduled,\n\t\tisPending,\n\t\tisPublished,\n\t\tisPublishSidebarEnabled,\n\t\tisPublishSidebarOpened,\n\t\tisScheduled,\n\t\tpostStatus,\n\t\tpostStatusHasChanged,\n\t\tpostType,\n\t} = useSelect( ( select ) => {\n\t\treturn {\n\t\t\thasPublishAction:\n\t\t\t\t!! select( editorStore ).getCurrentPost()?._links?.[\n\t\t\t\t\t'wp:action-publish'\n\t\t\t\t],\n\t\t\tisBeingScheduled:\n\t\t\t\tselect( editorStore ).isEditedPostBeingScheduled(),\n\t\t\tisPending: select( editorStore ).isCurrentPostPending(),\n\t\t\tisPublished: select( editorStore ).isCurrentPostPublished(),\n\t\t\tisPublishSidebarEnabled:\n\t\t\t\tselect( editorStore ).isPublishSidebarEnabled(),\n\t\t\tisPublishSidebarOpened:\n\t\t\t\tselect( editorStore ).isPublishSidebarOpened(),\n\t\t\tisScheduled: select( editorStore ).isCurrentPostScheduled(),\n\t\t\tpostStatus:\n\t\t\t\tselect( editorStore ).getEditedPostAttribute( 'status' ),\n\t\t\tpostStatusHasChanged: select( editorStore ).getPostEdits()?.status,\n\t\t\tpostType: select( editorStore ).getCurrentPostType(),\n\t\t};\n\t}, [] );\n\n\t/**\n\t * Conditions to show a BUTTON (publish directly) or a TOGGLE (open publish sidebar):\n\t *\n\t * 1) Attachments always show a BUTTON since they don't have a publish workflow\n\t * and should save directly without pre-publish checks.\n\t *\n\t * 2) 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 explicitly 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 * 3) Then, in small viewports, we'll show a TOGGLE.\n\t *\n\t * 4) 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 ( postType === ATTACHMENT_POST_TYPE ) {\n\t\tcomponent = IS_BUTTON;\n\t} else if (\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"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAAiC;AACjC,kBAAuC;AAKvC,mBAA8B;AAC9B,mBAAqC;AACrC,uBAAqC;AAwFnC;AAtFF,IAAM,YAAY;AAClB,IAAM,YAAY;AAEH,SAAR,0BAA4C;AAAA,EAClD;AAAA,EACA;AACD,GAAI;AACH,MAAI;AACJ,QAAM,kCAA8B,iCAAkB,UAAU,GAAI;AACpE,QAAM,EAAE,qBAAqB,QAAI,yBAAa,aAAAA,KAAY;AAC1D,QAAM;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,QAAI,uBAAW,CAAE,WAAY;AAC5B,WAAO;AAAA,MACN,kBACC,CAAC,CAAE,OAAQ,aAAAA,KAAY,EAAE,eAAe,GAAG,SAC1C,mBACD;AAAA,MACD,kBACC,OAAQ,aAAAA,KAAY,EAAE,2BAA2B;AAAA,MAClD,WAAW,OAAQ,aAAAA,KAAY,EAAE,qBAAqB;AAAA,MACtD,aAAa,OAAQ,aAAAA,KAAY,EAAE,uBAAuB;AAAA,MAC1D,yBACC,OAAQ,aAAAA,KAAY,EAAE,wBAAwB;AAAA,MAC/C,wBACC,OAAQ,aAAAA,KAAY,EAAE,uBAAuB;AAAA,MAC9C,aAAa,OAAQ,aAAAA,KAAY,EAAE,uBAAuB;AAAA,MAC1D,YACC,OAAQ,aAAAA,KAAY,EAAE,uBAAwB,QAAS;AAAA,MACxD,sBAAsB,OAAQ,aAAAA,KAAY,EAAE,aAAa,GAAG;AAAA,MAC5D,UAAU,OAAQ,aAAAA,KAAY,EAAE,mBAAmB;AAAA,IACpD;AAAA,EACD,GAAG,CAAC,CAAE;AA4BN,MAAK,aAAa,uCAAuB;AACxC,gBAAY;AAAA,EACb,WACC,eACE,wBACD,CAAE,CAAE,UAAU,SAAU,EAAE,SAAU,UAAW,KAC9C,eAAe,oBACf,aAAa,CAAE,oBAAoB,CAAE,6BACtC;AACD,gBAAY;AAAA,EACb,WAAY,+BAA+B,yBAA0B;AACpE,gBAAY;AAAA,EACb,OAAO;AACN,gBAAY;AAAA,EACb;AAEA,SACC;AAAA,IAAC,aAAAC;AAAA,IAAA;AAAA,MACA;AAAA,MACA,QAAS;AAAA,MACT,UAAW,cAAc;AAAA,MACzB,UAAW;AAAA,MACX;AAAA;AAAA,EACD;AAEF;",
6
6
  "names": ["editorStore", "PostPublishButton"]
7
7
  }
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // packages/editor/src/components/post-revisions-preview/index.js
31
+ var post_revisions_preview_exports = {};
32
+ __export(post_revisions_preview_exports, {
33
+ RevisionsCanvas: () => import_revisions_canvas.default,
34
+ RevisionsHeader: () => import_revisions_header.default
35
+ });
36
+ module.exports = __toCommonJS(post_revisions_preview_exports);
37
+ var import_revisions_header = __toESM(require("./revisions-header.cjs"));
38
+ var import_revisions_canvas = __toESM(require("./revisions-canvas.cjs"));
39
+ // Annotate the CommonJS export names for ESM import in node:
40
+ 0 && (module.exports = {
41
+ RevisionsCanvas,
42
+ RevisionsHeader
43
+ });
44
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/post-revisions-preview/index.js"],
4
+ "sourcesContent": ["export { default as RevisionsHeader } from './revisions-header';\nexport { default as RevisionsCanvas } from './revisions-canvas';\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,8BAA2C;AAC3C,8BAA2C;",
6
+ "names": []
7
+ }
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // packages/editor/src/components/post-revisions-preview/revisions-canvas.js
31
+ var revisions_canvas_exports = {};
32
+ __export(revisions_canvas_exports, {
33
+ default: () => RevisionsCanvas
34
+ });
35
+ module.exports = __toCommonJS(revisions_canvas_exports);
36
+ var import_components = require("@wordpress/components");
37
+ var import_block_editor = require("@wordpress/block-editor");
38
+ var import_blocks = require("@wordpress/blocks");
39
+ var import_data = require("@wordpress/data");
40
+ var import_element = require("@wordpress/element");
41
+ var import_lock_unlock = require("../../lock-unlock.cjs");
42
+ var import_store = require("../../store/index.cjs");
43
+ var import_visual_editor = __toESM(require("../visual-editor/index.cjs"));
44
+ var import_jsx_runtime = require("react/jsx-runtime");
45
+ var { ExperimentalBlockEditorProvider } = (0, import_lock_unlock.unlock)(import_block_editor.privateApis);
46
+ function RevisionsCanvas() {
47
+ const { revision, postType, blockEditorSettings } = (0, import_data.useSelect)(
48
+ (select) => {
49
+ const { getCurrentRevision, getCurrentPostType } = (0, import_lock_unlock.unlock)(
50
+ select(import_store.store)
51
+ );
52
+ return {
53
+ revision: getCurrentRevision(),
54
+ postType: getCurrentPostType(),
55
+ blockEditorSettings: select(import_block_editor.store).getSettings()
56
+ };
57
+ },
58
+ []
59
+ );
60
+ const blocks = (0, import_element.useMemo)(() => {
61
+ const parsedBlocks = (0, import_blocks.parse)(revision?.content?.raw ?? "");
62
+ if (postType === "wp_navigation") {
63
+ return [
64
+ (0, import_blocks.createBlock)(
65
+ "core/navigation",
66
+ { templateLock: false },
67
+ parsedBlocks
68
+ )
69
+ ];
70
+ }
71
+ return parsedBlocks;
72
+ }, [revision?.content?.raw, postType]);
73
+ const settings = (0, import_element.useMemo)(
74
+ () => ({
75
+ ...blockEditorSettings,
76
+ isPreviewMode: true
77
+ }),
78
+ [blockEditorSettings]
79
+ );
80
+ return revision ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ExperimentalBlockEditorProvider, { value: blocks, settings, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_visual_editor.default, {}) }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "editor-revisions-canvas__loading", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.Spinner, {}) });
81
+ }
82
+ //# sourceMappingURL=revisions-canvas.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/post-revisions-preview/revisions-canvas.js"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { Spinner } from '@wordpress/components';\nimport {\n\tprivateApis as blockEditorPrivateApis,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { createBlock, parse } from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as editorStore } from '../../store';\nimport VisualEditor from '../visual-editor';\n\nconst { ExperimentalBlockEditorProvider } = unlock( blockEditorPrivateApis );\n\n/**\n * Canvas component that renders a post revision in read-only mode.\n *\n * @return {JSX.Element} The revisions canvas component.\n */\nexport default function RevisionsCanvas() {\n\tconst { revision, postType, blockEditorSettings } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getCurrentRevision, getCurrentPostType } = unlock(\n\t\t\t\tselect( editorStore )\n\t\t\t);\n\t\t\treturn {\n\t\t\t\trevision: getCurrentRevision(),\n\t\t\t\tpostType: getCurrentPostType(),\n\t\t\t\tblockEditorSettings: select( blockEditorStore ).getSettings(),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tconst blocks = useMemo( () => {\n\t\tconst parsedBlocks = parse( revision?.content?.raw ?? '' );\n\t\tif ( postType === 'wp_navigation' ) {\n\t\t\treturn [\n\t\t\t\tcreateBlock(\n\t\t\t\t\t'core/navigation',\n\t\t\t\t\t{ templateLock: false },\n\t\t\t\t\tparsedBlocks\n\t\t\t\t),\n\t\t\t];\n\t\t}\n\t\treturn parsedBlocks;\n\t}, [ revision?.content?.raw, postType ] );\n\n\tconst settings = useMemo(\n\t\t() => ( {\n\t\t\t...blockEditorSettings,\n\t\t\tisPreviewMode: true,\n\t\t} ),\n\t\t[ blockEditorSettings ]\n\t);\n\n\treturn revision ? (\n\t\t<ExperimentalBlockEditorProvider value={ blocks } settings={ settings }>\n\t\t\t<VisualEditor />\n\t\t</ExperimentalBlockEditorProvider>\n\t) : (\n\t\t<div className=\"editor-revisions-canvas__loading\">\n\t\t\t<Spinner />\n\t\t</div>\n\t);\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAAwB;AACxB,0BAGO;AACP,oBAAmC;AACnC,kBAA0B;AAC1B,qBAAwB;AAKxB,yBAAuB;AACvB,mBAAqC;AACrC,2BAAyB;AAgDtB;AA9CH,IAAM,EAAE,gCAAgC,QAAI,2BAAQ,oBAAAA,WAAuB;AAO5D,SAAR,kBAAmC;AACzC,QAAM,EAAE,UAAU,UAAU,oBAAoB,QAAI;AAAA,IACnD,CAAE,WAAY;AACb,YAAM,EAAE,oBAAoB,mBAAmB,QAAI;AAAA,QAClD,OAAQ,aAAAC,KAAY;AAAA,MACrB;AACA,aAAO;AAAA,QACN,UAAU,mBAAmB;AAAA,QAC7B,UAAU,mBAAmB;AAAA,QAC7B,qBAAqB,OAAQ,oBAAAC,KAAiB,EAAE,YAAY;AAAA,MAC7D;AAAA,IACD;AAAA,IACA,CAAC;AAAA,EACF;AAEA,QAAM,aAAS,wBAAS,MAAM;AAC7B,UAAM,mBAAe,qBAAO,UAAU,SAAS,OAAO,EAAG;AACzD,QAAK,aAAa,iBAAkB;AACnC,aAAO;AAAA,YACN;AAAA,UACC;AAAA,UACA,EAAE,cAAc,MAAM;AAAA,UACtB;AAAA,QACD;AAAA,MACD;AAAA,IACD;AACA,WAAO;AAAA,EACR,GAAG,CAAE,UAAU,SAAS,KAAK,QAAS,CAAE;AAExC,QAAM,eAAW;AAAA,IAChB,OAAQ;AAAA,MACP,GAAG;AAAA,MACH,eAAe;AAAA,IAChB;AAAA,IACA,CAAE,mBAAoB;AAAA,EACvB;AAEA,SAAO,WACN,4CAAC,mCAAgC,OAAQ,QAAS,UACjD,sDAAC,qBAAAC,SAAA,EAAa,GACf,IAEA,4CAAC,SAAI,WAAU,oCACd,sDAAC,6BAAQ,GACV;AAEF;",
6
+ "names": ["blockEditorPrivateApis", "editorStore", "blockEditorStore", "VisualEditor"]
7
+ }
@@ -0,0 +1,119 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // packages/editor/src/components/post-revisions-preview/revisions-header.js
31
+ var revisions_header_exports = {};
32
+ __export(revisions_header_exports, {
33
+ default: () => revisions_header_default
34
+ });
35
+ module.exports = __toCommonJS(revisions_header_exports);
36
+ var import_data = require("@wordpress/data");
37
+ var import_compose = require("@wordpress/compose");
38
+ var import_components = require("@wordpress/components");
39
+ var import_preferences = require("@wordpress/preferences");
40
+ var import_interface = require("@wordpress/interface");
41
+ var import_i18n = require("@wordpress/i18n");
42
+ var import_header_skeleton = __toESM(require("../header/header-skeleton.cjs"));
43
+ var import_more_menu = __toESM(require("../more-menu/index.cjs"));
44
+ var import_post_preview_button = __toESM(require("../post-preview-button/index.cjs"));
45
+ var import_preview_dropdown = __toESM(require("../preview-dropdown/index.cjs"));
46
+ var import_revisions_slider = __toESM(require("./revisions-slider.cjs"));
47
+ var import_store = require("../../store/index.cjs");
48
+ var import_constants = require("../../store/constants.cjs");
49
+ var import_lock_unlock = require("../../lock-unlock.cjs");
50
+ var import_jsx_runtime = require("react/jsx-runtime");
51
+ function RevisionsHeader() {
52
+ const isWideViewport = (0, import_compose.useViewportMatch)("large");
53
+ const { postType, showIconLabels, currentRevisionId } = (0, import_data.useSelect)(
54
+ (select) => {
55
+ const { get: getPreference } = select(import_preferences.store);
56
+ const { getCurrentPostType } = select(import_store.store);
57
+ return {
58
+ postType: getCurrentPostType(),
59
+ showIconLabels: getPreference("core", "showIconLabels"),
60
+ currentRevisionId: (0, import_lock_unlock.unlock)(
61
+ select(import_store.store)
62
+ ).getCurrentRevisionId()
63
+ };
64
+ },
65
+ []
66
+ );
67
+ const { setCurrentRevisionId, restoreRevision } = (0, import_lock_unlock.unlock)(
68
+ (0, import_data.useDispatch)(import_store.store)
69
+ );
70
+ const disablePreviewOption = [
71
+ import_constants.NAVIGATION_POST_TYPE,
72
+ import_constants.TEMPLATE_PART_POST_TYPE,
73
+ import_constants.PATTERN_POST_TYPE
74
+ ].includes(postType);
75
+ const canRestore = !!currentRevisionId;
76
+ const handleRestore = () => {
77
+ if (currentRevisionId) {
78
+ restoreRevision(currentRevisionId);
79
+ }
80
+ };
81
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
82
+ import_header_skeleton.default,
83
+ {
84
+ className: "editor-revisions-header",
85
+ center: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_revisions_slider.default, {}),
86
+ settings: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
87
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_preview_dropdown.default, { disabled: disablePreviewOption }),
88
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_post_preview_button.default, { className: "editor-header__post-preview-button" }),
89
+ (isWideViewport || !showIconLabels) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_interface.PinnedItems.Slot, { scope: "core" }),
90
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
91
+ import_components.Button,
92
+ {
93
+ __next40pxDefaultSize: true,
94
+ variant: "secondary",
95
+ size: "compact",
96
+ onClick: () => setCurrentRevisionId(null),
97
+ children: (0, import_i18n.__)("Exit")
98
+ }
99
+ ),
100
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
101
+ import_components.Button,
102
+ {
103
+ __next40pxDefaultSize: true,
104
+ accessibleWhenDisabled: true,
105
+ variant: "primary",
106
+ size: "compact",
107
+ className: "editor-revisions-header__restore-button",
108
+ disabled: !canRestore,
109
+ onClick: handleRestore,
110
+ children: (0, import_i18n.__)("Restore")
111
+ }
112
+ ),
113
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_more_menu.default, { disabled: true })
114
+ ] })
115
+ }
116
+ );
117
+ }
118
+ var revisions_header_default = RevisionsHeader;
119
+ //# sourceMappingURL=revisions-header.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/post-revisions-preview/revisions-header.js"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { Button } from '@wordpress/components';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { PinnedItems } from '@wordpress/interface';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport HeaderSkeleton from '../header/header-skeleton';\nimport MoreMenu from '../more-menu';\nimport PostPreviewButton from '../post-preview-button';\nimport PreviewDropdown from '../preview-dropdown';\nimport RevisionsSlider from './revisions-slider';\nimport { store as editorStore } from '../../store';\nimport {\n\tTEMPLATE_PART_POST_TYPE,\n\tPATTERN_POST_TYPE,\n\tNAVIGATION_POST_TYPE,\n} from '../../store/constants';\nimport { unlock } from '../../lock-unlock';\n\n/**\n * Header component for revisions preview mode.\n *\n * @return {JSX.Element} The revisions header component.\n */\nfunction RevisionsHeader() {\n\tconst isWideViewport = useViewportMatch( 'large' );\n\tconst { postType, showIconLabels, currentRevisionId } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { get: getPreference } = select( preferencesStore );\n\t\t\tconst { getCurrentPostType } = select( editorStore );\n\n\t\t\treturn {\n\t\t\t\tpostType: getCurrentPostType(),\n\t\t\t\tshowIconLabels: getPreference( 'core', 'showIconLabels' ),\n\t\t\t\tcurrentRevisionId: unlock(\n\t\t\t\t\tselect( editorStore )\n\t\t\t\t).getCurrentRevisionId(),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tconst { setCurrentRevisionId, restoreRevision } = unlock(\n\t\tuseDispatch( editorStore )\n\t);\n\n\tconst disablePreviewOption = [\n\t\tNAVIGATION_POST_TYPE,\n\t\tTEMPLATE_PART_POST_TYPE,\n\t\tPATTERN_POST_TYPE,\n\t].includes( postType );\n\n\tconst canRestore = !! currentRevisionId;\n\n\tconst handleRestore = () => {\n\t\tif ( currentRevisionId ) {\n\t\t\trestoreRevision( currentRevisionId );\n\t\t}\n\t};\n\n\treturn (\n\t\t<HeaderSkeleton\n\t\t\tclassName=\"editor-revisions-header\"\n\t\t\tcenter={ <RevisionsSlider /> }\n\t\t\tsettings={\n\t\t\t\t<>\n\t\t\t\t\t<PreviewDropdown disabled={ disablePreviewOption } />\n\n\t\t\t\t\t<PostPreviewButton className=\"editor-header__post-preview-button\" />\n\n\t\t\t\t\t{ ( isWideViewport || ! showIconLabels ) && (\n\t\t\t\t\t\t<PinnedItems.Slot scope=\"core\" />\n\t\t\t\t\t) }\n\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\tonClick={ () => setCurrentRevisionId( null ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Exit' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\tclassName=\"editor-revisions-header__restore-button\"\n\t\t\t\t\t\tdisabled={ ! canRestore }\n\t\t\t\t\t\tonClick={ handleRestore }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Restore' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t\t<MoreMenu disabled />\n\t\t\t\t</>\n\t\t\t}\n\t\t/>\n\t);\n}\n\nexport default RevisionsHeader;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAuC;AACvC,qBAAiC;AACjC,wBAAuB;AACvB,yBAA0C;AAC1C,uBAA4B;AAC5B,kBAAmB;AAKnB,6BAA2B;AAC3B,uBAAqB;AACrB,iCAA8B;AAC9B,8BAA4B;AAC5B,8BAA4B;AAC5B,mBAAqC;AACrC,uBAIO;AACP,yBAAuB;AA8CX;AAvCZ,SAAS,kBAAkB;AAC1B,QAAM,qBAAiB,iCAAkB,OAAQ;AACjD,QAAM,EAAE,UAAU,gBAAgB,kBAAkB,QAAI;AAAA,IACvD,CAAE,WAAY;AACb,YAAM,EAAE,KAAK,cAAc,IAAI,OAAQ,mBAAAA,KAAiB;AACxD,YAAM,EAAE,mBAAmB,IAAI,OAAQ,aAAAC,KAAY;AAEnD,aAAO;AAAA,QACN,UAAU,mBAAmB;AAAA,QAC7B,gBAAgB,cAAe,QAAQ,gBAAiB;AAAA,QACxD,uBAAmB;AAAA,UAClB,OAAQ,aAAAA,KAAY;AAAA,QACrB,EAAE,qBAAqB;AAAA,MACxB;AAAA,IACD;AAAA,IACA,CAAC;AAAA,EACF;AAEA,QAAM,EAAE,sBAAsB,gBAAgB,QAAI;AAAA,QACjD,yBAAa,aAAAA,KAAY;AAAA,EAC1B;AAEA,QAAM,uBAAuB;AAAA,IAC5B;AAAA,IACA;AAAA,IACA;AAAA,EACD,EAAE,SAAU,QAAS;AAErB,QAAM,aAAa,CAAC,CAAE;AAEtB,QAAM,gBAAgB,MAAM;AAC3B,QAAK,mBAAoB;AACxB,sBAAiB,iBAAkB;AAAA,IACpC;AAAA,EACD;AAEA,SACC;AAAA,IAAC,uBAAAC;AAAA,IAAA;AAAA,MACA,WAAU;AAAA,MACV,QAAS,4CAAC,wBAAAC,SAAA,EAAgB;AAAA,MAC1B,UACC,4EACC;AAAA,oDAAC,wBAAAC,SAAA,EAAgB,UAAW,sBAAuB;AAAA,QAEnD,4CAAC,2BAAAC,SAAA,EAAkB,WAAU,sCAAqC;AAAA,SAE9D,kBAAkB,CAAE,mBACvB,4CAAC,6BAAY,MAAZ,EAAiB,OAAM,QAAO;AAAA,QAGhC;AAAA,UAAC;AAAA;AAAA,YACA,uBAAqB;AAAA,YACrB,SAAQ;AAAA,YACR,MAAK;AAAA,YACL,SAAU,MAAM,qBAAsB,IAAK;AAAA,YAEzC,8BAAI,MAAO;AAAA;AAAA,QACd;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACA,uBAAqB;AAAA,YACrB,wBAAsB;AAAA,YACtB,SAAQ;AAAA,YACR,MAAK;AAAA,YACL,WAAU;AAAA,YACV,UAAW,CAAE;AAAA,YACb,SAAU;AAAA,YAER,8BAAI,SAAU;AAAA;AAAA,QACjB;AAAA,QACA,4CAAC,iBAAAC,SAAA,EAAS,UAAQ,MAAC;AAAA,SACpB;AAAA;AAAA,EAEF;AAEF;AAEA,IAAO,2BAAQ;",
6
+ "names": ["preferencesStore", "editorStore", "HeaderSkeleton", "RevisionsSlider", "PreviewDropdown", "PostPreviewButton", "MoreMenu"]
7
+ }
@@ -0,0 +1,110 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // packages/editor/src/components/post-revisions-preview/revisions-slider.js
21
+ var revisions_slider_exports = {};
22
+ __export(revisions_slider_exports, {
23
+ default: () => revisions_slider_default
24
+ });
25
+ module.exports = __toCommonJS(revisions_slider_exports);
26
+ var import_element = require("@wordpress/element");
27
+ var import_data = require("@wordpress/data");
28
+ var import_components = require("@wordpress/components");
29
+ var import_core_data = require("@wordpress/core-data");
30
+ var import_i18n = require("@wordpress/i18n");
31
+ var import_date = require("@wordpress/date");
32
+ var import_store = require("../../store/index.cjs");
33
+ var import_lock_unlock = require("../../lock-unlock.cjs");
34
+ var import_jsx_runtime = require("react/jsx-runtime");
35
+ function RevisionsSlider() {
36
+ const { revisions, isLoading, currentRevisionId } = (0, import_data.useSelect)(
37
+ (select) => {
38
+ const { getCurrentPostId, getCurrentPostType } = select(import_store.store);
39
+ const { getRevisions, isResolving } = select(import_core_data.store);
40
+ const postId = getCurrentPostId();
41
+ const postType = getCurrentPostType();
42
+ if (!postId || !postType) {
43
+ return {};
44
+ }
45
+ const query = { per_page: -1, context: "edit" };
46
+ return {
47
+ revisions: getRevisions("postType", postType, postId, query),
48
+ isLoading: isResolving("getRevisions", [
49
+ "postType",
50
+ postType,
51
+ postId,
52
+ query
53
+ ]),
54
+ currentRevisionId: (0, import_lock_unlock.unlock)(
55
+ select(import_store.store)
56
+ ).getCurrentRevisionId()
57
+ };
58
+ },
59
+ []
60
+ );
61
+ const { setCurrentRevisionId } = (0, import_lock_unlock.unlock)((0, import_data.useDispatch)(import_store.store));
62
+ const sortedRevisions = (0, import_element.useMemo)(() => {
63
+ return revisions?.slice().sort((a, b) => new Date(a.date) - new Date(b.date)) ?? [];
64
+ }, [revisions]);
65
+ const selectedIndex = sortedRevisions.findIndex(
66
+ (r) => r.id === currentRevisionId
67
+ );
68
+ const handleSliderChange = (index) => {
69
+ const revision = sortedRevisions[index];
70
+ if (revision) {
71
+ setCurrentRevisionId(revision.id);
72
+ }
73
+ };
74
+ const dateSettings = (0, import_date.getSettings)();
75
+ const renderTooltipContent = (index) => {
76
+ const revision = sortedRevisions[index];
77
+ if (!revision) {
78
+ return index;
79
+ }
80
+ return (0, import_date.dateI18n)(dateSettings.formats.datetime, revision.date);
81
+ };
82
+ if (isLoading) {
83
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.Spinner, {});
84
+ }
85
+ if (!sortedRevisions.length) {
86
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "editor-revisions-header__no-revisions", children: (0, import_i18n.__)("No revisions found.") });
87
+ }
88
+ if (sortedRevisions.length === 1) {
89
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "editor-revisions-header__no-revisions", children: (0, import_i18n.__)("Only one revision found.") });
90
+ }
91
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
92
+ import_components.RangeControl,
93
+ {
94
+ __nextHasNoMarginBottom: true,
95
+ __next40pxDefaultSize: true,
96
+ className: "editor-revisions-header__slider",
97
+ hideLabelFromVision: true,
98
+ label: (0, import_i18n.__)("Revision"),
99
+ max: sortedRevisions.length - 1,
100
+ min: 0,
101
+ marks: true,
102
+ onChange: handleSliderChange,
103
+ renderTooltipContent,
104
+ value: selectedIndex,
105
+ withInputField: false
106
+ }
107
+ );
108
+ }
109
+ var revisions_slider_default = RevisionsSlider;
110
+ //# sourceMappingURL=revisions-slider.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/post-revisions-preview/revisions-slider.js"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { RangeControl, Spinner } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __ } from '@wordpress/i18n';\nimport { dateI18n, getSettings as getDateSettings } from '@wordpress/date';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\n/**\n * Slider component for navigating revisions.\n *\n * @return {JSX.Element} The revisions slider component.\n */\nfunction RevisionsSlider() {\n\tconst { revisions, isLoading, currentRevisionId } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getCurrentPostId, getCurrentPostType } =\n\t\t\t\tselect( editorStore );\n\t\t\tconst { getRevisions, isResolving } = select( coreStore );\n\n\t\t\tconst postId = getCurrentPostId();\n\t\t\tconst postType = getCurrentPostType();\n\n\t\t\tif ( ! postId || ! postType ) {\n\t\t\t\treturn {};\n\t\t\t}\n\n\t\t\tconst query = { per_page: -1, context: 'edit' };\n\t\t\treturn {\n\t\t\t\trevisions: getRevisions( 'postType', postType, postId, query ),\n\t\t\t\tisLoading: isResolving( 'getRevisions', [\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\tpostId,\n\t\t\t\t\tquery,\n\t\t\t\t] ),\n\t\t\t\tcurrentRevisionId: unlock(\n\t\t\t\t\tselect( editorStore )\n\t\t\t\t).getCurrentRevisionId(),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tconst { setCurrentRevisionId } = unlock( useDispatch( editorStore ) );\n\n\tconst sortedRevisions = useMemo( () => {\n\t\treturn (\n\t\t\trevisions\n\t\t\t\t?.slice()\n\t\t\t\t.sort( ( a, b ) => new Date( a.date ) - new Date( b.date ) ) ??\n\t\t\t[]\n\t\t);\n\t}, [ revisions ] );\n\n\tconst selectedIndex = sortedRevisions.findIndex(\n\t\t( r ) => r.id === currentRevisionId\n\t);\n\n\tconst handleSliderChange = ( index ) => {\n\t\tconst revision = sortedRevisions[ index ];\n\t\tif ( revision ) {\n\t\t\tsetCurrentRevisionId( revision.id );\n\t\t}\n\t};\n\n\t// Format date for tooltip.\n\tconst dateSettings = getDateSettings();\n\tconst renderTooltipContent = ( index ) => {\n\t\tconst revision = sortedRevisions[ index ];\n\t\tif ( ! revision ) {\n\t\t\treturn index;\n\t\t}\n\t\treturn dateI18n( dateSettings.formats.datetime, revision.date );\n\t};\n\n\tif ( isLoading ) {\n\t\treturn <Spinner />;\n\t}\n\n\tif ( ! sortedRevisions.length ) {\n\t\treturn (\n\t\t\t<span className=\"editor-revisions-header__no-revisions\">\n\t\t\t\t{ __( 'No revisions found.' ) }\n\t\t\t</span>\n\t\t);\n\t}\n\n\tif ( sortedRevisions.length === 1 ) {\n\t\treturn (\n\t\t\t<span className=\"editor-revisions-header__no-revisions\">\n\t\t\t\t{ __( 'Only one revision found.' ) }\n\t\t\t</span>\n\t\t);\n\t}\n\n\treturn (\n\t\t<RangeControl\n\t\t\t__nextHasNoMarginBottom\n\t\t\t__next40pxDefaultSize\n\t\t\tclassName=\"editor-revisions-header__slider\"\n\t\t\thideLabelFromVision\n\t\t\tlabel={ __( 'Revision' ) }\n\t\t\tmax={ sortedRevisions.length - 1 }\n\t\t\tmin={ 0 }\n\t\t\tmarks\n\t\t\tonChange={ handleSliderChange }\n\t\t\trenderTooltipContent={ renderTooltipContent }\n\t\t\tvalue={ selectedIndex }\n\t\t\twithInputField={ false }\n\t\t/>\n\t);\n}\n\nexport default RevisionsSlider;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAAwB;AACxB,kBAAuC;AACvC,wBAAsC;AACtC,uBAAmC;AACnC,kBAAmB;AACnB,kBAAyD;AAKzD,mBAAqC;AACrC,yBAAuB;AAuEd;AAhET,SAAS,kBAAkB;AAC1B,QAAM,EAAE,WAAW,WAAW,kBAAkB,QAAI;AAAA,IACnD,CAAE,WAAY;AACb,YAAM,EAAE,kBAAkB,mBAAmB,IAC5C,OAAQ,aAAAA,KAAY;AACrB,YAAM,EAAE,cAAc,YAAY,IAAI,OAAQ,iBAAAC,KAAU;AAExD,YAAM,SAAS,iBAAiB;AAChC,YAAM,WAAW,mBAAmB;AAEpC,UAAK,CAAE,UAAU,CAAE,UAAW;AAC7B,eAAO,CAAC;AAAA,MACT;AAEA,YAAM,QAAQ,EAAE,UAAU,IAAI,SAAS,OAAO;AAC9C,aAAO;AAAA,QACN,WAAW,aAAc,YAAY,UAAU,QAAQ,KAAM;AAAA,QAC7D,WAAW,YAAa,gBAAgB;AAAA,UACvC;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QACD,CAAE;AAAA,QACF,uBAAmB;AAAA,UAClB,OAAQ,aAAAD,KAAY;AAAA,QACrB,EAAE,qBAAqB;AAAA,MACxB;AAAA,IACD;AAAA,IACA,CAAC;AAAA,EACF;AAEA,QAAM,EAAE,qBAAqB,QAAI,+BAAQ,yBAAa,aAAAA,KAAY,CAAE;AAEpE,QAAM,sBAAkB,wBAAS,MAAM;AACtC,WACC,WACG,MAAM,EACP,KAAM,CAAE,GAAG,MAAO,IAAI,KAAM,EAAE,IAAK,IAAI,IAAI,KAAM,EAAE,IAAK,CAAE,KAC5D,CAAC;AAAA,EAEH,GAAG,CAAE,SAAU,CAAE;AAEjB,QAAM,gBAAgB,gBAAgB;AAAA,IACrC,CAAE,MAAO,EAAE,OAAO;AAAA,EACnB;AAEA,QAAM,qBAAqB,CAAE,UAAW;AACvC,UAAM,WAAW,gBAAiB,KAAM;AACxC,QAAK,UAAW;AACf,2BAAsB,SAAS,EAAG;AAAA,IACnC;AAAA,EACD;AAGA,QAAM,mBAAe,YAAAE,aAAgB;AACrC,QAAM,uBAAuB,CAAE,UAAW;AACzC,UAAM,WAAW,gBAAiB,KAAM;AACxC,QAAK,CAAE,UAAW;AACjB,aAAO;AAAA,IACR;AACA,eAAO,sBAAU,aAAa,QAAQ,UAAU,SAAS,IAAK;AAAA,EAC/D;AAEA,MAAK,WAAY;AAChB,WAAO,4CAAC,6BAAQ;AAAA,EACjB;AAEA,MAAK,CAAE,gBAAgB,QAAS;AAC/B,WACC,4CAAC,UAAK,WAAU,yCACb,8BAAI,qBAAsB,GAC7B;AAAA,EAEF;AAEA,MAAK,gBAAgB,WAAW,GAAI;AACnC,WACC,4CAAC,UAAK,WAAU,yCACb,8BAAI,0BAA2B,GAClC;AAAA,EAEF;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,yBAAuB;AAAA,MACvB,uBAAqB;AAAA,MACrB,WAAU;AAAA,MACV,qBAAmB;AAAA,MACnB,WAAQ,gBAAI,UAAW;AAAA,MACvB,KAAM,gBAAgB,SAAS;AAAA,MAC/B,KAAM;AAAA,MACN,OAAK;AAAA,MACL,UAAW;AAAA,MACX;AAAA,MACA,OAAQ;AAAA,MACR,gBAAiB;AAAA;AAAA,EAClB;AAEF;AAEA,IAAO,2BAAQ;",
6
+ "names": ["editorStore", "coreStore", "getDateSettings"]
7
+ }
@@ -44,6 +44,7 @@ var import_keycodes = require("@wordpress/keycodes");
44
44
  var import_preferences = require("@wordpress/preferences");
45
45
  var import_post_status = require("../post-status/index.cjs");
46
46
  var import_store = require("../../store/index.cjs");
47
+ var import_constants = require("../../store/constants.cjs");
47
48
  var import_jsx_runtime = require("react/jsx-runtime");
48
49
  function PostSavedState({ forceIsDirty }) {
49
50
  const [forceSavedMessage, setForceSavedMessage] = (0, import_element.useState)(false);
@@ -59,7 +60,8 @@ function PostSavedState({ forceIsDirty }) {
59
60
  hasPublishAction,
60
61
  showIconLabels,
61
62
  postStatus,
62
- postStatusHasChanged
63
+ postStatusHasChanged,
64
+ postType
63
65
  } = (0, import_data.useSelect)(
64
66
  (select) => {
65
67
  const {
@@ -86,7 +88,8 @@ function PostSavedState({ forceIsDirty }) {
86
88
  hasPublishAction: getCurrentPost()?._links?.["wp:action-publish"] ?? false,
87
89
  showIconLabels: get("core", "showIconLabels"),
88
90
  postStatus: getEditedPostAttribute("status"),
89
- postStatusHasChanged: !!getPostEdits()?.status
91
+ postStatusHasChanged: !!getPostEdits()?.status,
92
+ postType: select(import_store.store).getCurrentPostType()
90
93
  };
91
94
  },
92
95
  [forceIsDirty]
@@ -104,6 +107,9 @@ function PostSavedState({ forceIsDirty }) {
104
107
  }
105
108
  return () => clearTimeout(timeoutId);
106
109
  }, [isSaving]);
110
+ if (postType === import_constants.ATTACHMENT_POST_TYPE) {
111
+ return null;
112
+ }
107
113
  if (!hasPublishAction && isPending) {
108
114
  return null;
109
115
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/post-saved-state/index.js"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\t__unstableGetAnimateClassName as getAnimateClassName,\n\tButton,\n} from '@wordpress/components';\nimport { usePrevious, useViewportMatch } from '@wordpress/compose';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useEffect, useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { Icon, check, cloud, cloudUpload } from '@wordpress/icons';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport { STATUS_OPTIONS } from '../../components/post-status';\nimport { store as editorStore } from '../../store';\n\n/**\n * Component showing whether the post is saved or not and providing save\n * buttons.\n *\n * @param {Object} props Component props.\n * @param {?boolean} props.forceIsDirty Whether to force the post to be marked\n * as dirty.\n * @return {import('react').ComponentType} The component.\n */\nexport default function PostSavedState( { forceIsDirty } ) {\n\tconst [ forceSavedMessage, setForceSavedMessage ] = useState( false );\n\tconst isLargeViewport = useViewportMatch( 'small' );\n\n\tconst {\n\t\tisAutosaving,\n\t\tisDirty,\n\t\tisNew,\n\t\tisPublished,\n\t\tisSaveable,\n\t\tisSaving,\n\t\tisScheduled,\n\t\thasPublishAction,\n\t\tshowIconLabels,\n\t\tpostStatus,\n\t\tpostStatusHasChanged,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tisEditedPostNew,\n\t\t\t\tisCurrentPostPublished,\n\t\t\t\tisCurrentPostScheduled,\n\t\t\t\tisEditedPostDirty,\n\t\t\t\tisSavingPost,\n\t\t\t\tisEditedPostSaveable,\n\t\t\t\tgetCurrentPost,\n\t\t\t\tisAutosavingPost,\n\t\t\t\tgetEditedPostAttribute,\n\t\t\t\tgetPostEdits,\n\t\t\t} = select( editorStore );\n\t\t\tconst { get } = select( preferencesStore );\n\t\t\treturn {\n\t\t\t\tisAutosaving: isAutosavingPost(),\n\t\t\t\tisDirty: forceIsDirty || isEditedPostDirty(),\n\t\t\t\tisNew: isEditedPostNew(),\n\t\t\t\tisPublished: isCurrentPostPublished(),\n\t\t\t\tisSaving: isSavingPost(),\n\t\t\t\tisSaveable: isEditedPostSaveable(),\n\t\t\t\tisScheduled: isCurrentPostScheduled(),\n\t\t\t\thasPublishAction:\n\t\t\t\t\tgetCurrentPost()?._links?.[ 'wp:action-publish' ] ?? false,\n\t\t\t\tshowIconLabels: get( 'core', 'showIconLabels' ),\n\t\t\t\tpostStatus: getEditedPostAttribute( 'status' ),\n\t\t\t\tpostStatusHasChanged: !! getPostEdits()?.status,\n\t\t\t};\n\t\t},\n\t\t[ forceIsDirty ]\n\t);\n\tconst isPending = postStatus === 'pending';\n\tconst { savePost } = useDispatch( editorStore );\n\n\tconst wasSaving = usePrevious( isSaving );\n\n\tuseEffect( () => {\n\t\tlet timeoutId;\n\n\t\tif ( wasSaving && ! isSaving ) {\n\t\t\tsetForceSavedMessage( true );\n\t\t\ttimeoutId = setTimeout( () => {\n\t\t\t\tsetForceSavedMessage( false );\n\t\t\t}, 1000 );\n\t\t}\n\n\t\treturn () => clearTimeout( timeoutId );\n\t}, [ isSaving ] );\n\n\t// Once the post has been submitted for review this button\n\t// is not needed for the contributor role.\n\tif ( ! hasPublishAction && isPending ) {\n\t\treturn null;\n\t}\n\n\t// We shouldn't render the button if the post has not one of the following statuses: pending, draft, auto-draft.\n\t// The reason for this is that this button handles the `save as pending` and `save draft` actions.\n\t// An exception for this is when the post has a custom status and there should be a way to save changes without\n\t// having to publish. This should be handled better in the future when custom statuses have better support.\n\t// @see https://github.com/WordPress/gutenberg/issues/3144.\n\tconst isIneligibleStatus =\n\t\t! [ 'pending', 'draft', 'auto-draft' ].includes( postStatus ) &&\n\t\tSTATUS_OPTIONS.map( ( { value } ) => value ).includes( postStatus );\n\n\tif (\n\t\tisPublished ||\n\t\tisScheduled ||\n\t\tisIneligibleStatus ||\n\t\t( postStatusHasChanged &&\n\t\t\t[ 'pending', 'draft' ].includes( postStatus ) )\n\t) {\n\t\treturn null;\n\t}\n\n\t/* translators: button label text should, if possible, be under 16 characters. */\n\tconst label = isPending ? __( 'Save as pending' ) : __( 'Save draft' );\n\n\t/* translators: button label text should, if possible, be under 16 characters. */\n\tconst shortLabel = __( 'Save' );\n\n\tconst isSaved = forceSavedMessage || ( ! isNew && ! isDirty );\n\tconst isSavedState = isSaving || isSaved;\n\tconst isDisabled = isSaving || isSaved || ! isSaveable;\n\tlet text;\n\n\tif ( isSaving ) {\n\t\ttext = isAutosaving ? __( 'Autosaving' ) : __( 'Saving' );\n\t} else if ( isSaved ) {\n\t\ttext = __( 'Saved' );\n\t} else if ( isLargeViewport ) {\n\t\ttext = label;\n\t} else if ( showIconLabels ) {\n\t\ttext = shortLabel;\n\t}\n\n\t// Use common Button instance for all saved states so that focus is not\n\t// lost.\n\treturn (\n\t\t<Button\n\t\t\tclassName={\n\t\t\t\tisSaveable || isSaving\n\t\t\t\t\t? clsx( {\n\t\t\t\t\t\t\t'editor-post-save-draft': ! isSavedState,\n\t\t\t\t\t\t\t'editor-post-saved-state': isSavedState,\n\t\t\t\t\t\t\t'is-saving': isSaving,\n\t\t\t\t\t\t\t'is-autosaving': isAutosaving,\n\t\t\t\t\t\t\t'is-saved': isSaved,\n\t\t\t\t\t\t\t[ getAnimateClassName( {\n\t\t\t\t\t\t\t\ttype: 'loading',\n\t\t\t\t\t\t\t} ) ]: isSaving,\n\t\t\t\t\t } )\n\t\t\t\t\t: undefined\n\t\t\t}\n\t\t\tonClick={ isDisabled ? undefined : () => savePost() }\n\t\t\t/*\n\t\t\t * We want the tooltip to show the keyboard shortcut only when the\n\t\t\t * button does something, i.e. when it's not disabled.\n\t\t\t */\n\t\t\tshortcut={ isDisabled ? undefined : displayShortcut.primary( 's' ) }\n\t\t\tvariant=\"tertiary\"\n\t\t\tsize=\"compact\"\n\t\t\ticon={ isLargeViewport ? undefined : cloudUpload }\n\t\t\tlabel={ text || label }\n\t\t\taria-disabled={ isDisabled }\n\t\t>\n\t\t\t{ isSavedState && <Icon icon={ isSaved ? check : cloud } /> }\n\t\t\t{ text }\n\t\t</Button>\n\t);\n}\n"],
5
- "mappings": "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",
4
+ "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\t__unstableGetAnimateClassName as getAnimateClassName,\n\tButton,\n} from '@wordpress/components';\nimport { usePrevious, useViewportMatch } from '@wordpress/compose';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useEffect, useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { Icon, check, cloud, cloudUpload } from '@wordpress/icons';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport { STATUS_OPTIONS } from '../../components/post-status';\nimport { store as editorStore } from '../../store';\nimport { ATTACHMENT_POST_TYPE } from '../../store/constants';\n\n/**\n * Component showing whether the post is saved or not and providing save\n * buttons.\n *\n * @param {Object} props Component props.\n * @param {?boolean} props.forceIsDirty Whether to force the post to be marked\n * as dirty.\n * @return {import('react').ComponentType} The component.\n */\nexport default function PostSavedState( { forceIsDirty } ) {\n\tconst [ forceSavedMessage, setForceSavedMessage ] = useState( false );\n\tconst isLargeViewport = useViewportMatch( 'small' );\n\n\tconst {\n\t\tisAutosaving,\n\t\tisDirty,\n\t\tisNew,\n\t\tisPublished,\n\t\tisSaveable,\n\t\tisSaving,\n\t\tisScheduled,\n\t\thasPublishAction,\n\t\tshowIconLabels,\n\t\tpostStatus,\n\t\tpostStatusHasChanged,\n\t\tpostType,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tisEditedPostNew,\n\t\t\t\tisCurrentPostPublished,\n\t\t\t\tisCurrentPostScheduled,\n\t\t\t\tisEditedPostDirty,\n\t\t\t\tisSavingPost,\n\t\t\t\tisEditedPostSaveable,\n\t\t\t\tgetCurrentPost,\n\t\t\t\tisAutosavingPost,\n\t\t\t\tgetEditedPostAttribute,\n\t\t\t\tgetPostEdits,\n\t\t\t} = select( editorStore );\n\t\t\tconst { get } = select( preferencesStore );\n\t\t\treturn {\n\t\t\t\tisAutosaving: isAutosavingPost(),\n\t\t\t\tisDirty: forceIsDirty || isEditedPostDirty(),\n\t\t\t\tisNew: isEditedPostNew(),\n\t\t\t\tisPublished: isCurrentPostPublished(),\n\t\t\t\tisSaving: isSavingPost(),\n\t\t\t\tisSaveable: isEditedPostSaveable(),\n\t\t\t\tisScheduled: isCurrentPostScheduled(),\n\t\t\t\thasPublishAction:\n\t\t\t\t\tgetCurrentPost()?._links?.[ 'wp:action-publish' ] ?? false,\n\t\t\t\tshowIconLabels: get( 'core', 'showIconLabels' ),\n\t\t\t\tpostStatus: getEditedPostAttribute( 'status' ),\n\t\t\t\tpostStatusHasChanged: !! getPostEdits()?.status,\n\t\t\t\tpostType: select( editorStore ).getCurrentPostType(),\n\t\t\t};\n\t\t},\n\t\t[ forceIsDirty ]\n\t);\n\tconst isPending = postStatus === 'pending';\n\tconst { savePost } = useDispatch( editorStore );\n\n\tconst wasSaving = usePrevious( isSaving );\n\n\tuseEffect( () => {\n\t\tlet timeoutId;\n\n\t\tif ( wasSaving && ! isSaving ) {\n\t\t\tsetForceSavedMessage( true );\n\t\t\ttimeoutId = setTimeout( () => {\n\t\t\t\tsetForceSavedMessage( false );\n\t\t\t}, 1000 );\n\t\t}\n\n\t\treturn () => clearTimeout( timeoutId );\n\t}, [ isSaving ] );\n\n\t// Attachments don't support draft mode, so hide this button.\n\tif ( postType === ATTACHMENT_POST_TYPE ) {\n\t\treturn null;\n\t}\n\n\t// Once the post has been submitted for review this button\n\t// is not needed for the contributor role.\n\tif ( ! hasPublishAction && isPending ) {\n\t\treturn null;\n\t}\n\n\t// We shouldn't render the button if the post has not one of the following statuses: pending, draft, auto-draft.\n\t// The reason for this is that this button handles the `save as pending` and `save draft` actions.\n\t// An exception for this is when the post has a custom status and there should be a way to save changes without\n\t// having to publish. This should be handled better in the future when custom statuses have better support.\n\t// @see https://github.com/WordPress/gutenberg/issues/3144.\n\tconst isIneligibleStatus =\n\t\t! [ 'pending', 'draft', 'auto-draft' ].includes( postStatus ) &&\n\t\tSTATUS_OPTIONS.map( ( { value } ) => value ).includes( postStatus );\n\n\tif (\n\t\tisPublished ||\n\t\tisScheduled ||\n\t\tisIneligibleStatus ||\n\t\t( postStatusHasChanged &&\n\t\t\t[ 'pending', 'draft' ].includes( postStatus ) )\n\t) {\n\t\treturn null;\n\t}\n\n\t/* translators: button label text should, if possible, be under 16 characters. */\n\tconst label = isPending ? __( 'Save as pending' ) : __( 'Save draft' );\n\n\t/* translators: button label text should, if possible, be under 16 characters. */\n\tconst shortLabel = __( 'Save' );\n\n\tconst isSaved = forceSavedMessage || ( ! isNew && ! isDirty );\n\tconst isSavedState = isSaving || isSaved;\n\tconst isDisabled = isSaving || isSaved || ! isSaveable;\n\tlet text;\n\n\tif ( isSaving ) {\n\t\ttext = isAutosaving ? __( 'Autosaving' ) : __( 'Saving' );\n\t} else if ( isSaved ) {\n\t\ttext = __( 'Saved' );\n\t} else if ( isLargeViewport ) {\n\t\ttext = label;\n\t} else if ( showIconLabels ) {\n\t\ttext = shortLabel;\n\t}\n\n\t// Use common Button instance for all saved states so that focus is not\n\t// lost.\n\treturn (\n\t\t<Button\n\t\t\tclassName={\n\t\t\t\tisSaveable || isSaving\n\t\t\t\t\t? clsx( {\n\t\t\t\t\t\t\t'editor-post-save-draft': ! isSavedState,\n\t\t\t\t\t\t\t'editor-post-saved-state': isSavedState,\n\t\t\t\t\t\t\t'is-saving': isSaving,\n\t\t\t\t\t\t\t'is-autosaving': isAutosaving,\n\t\t\t\t\t\t\t'is-saved': isSaved,\n\t\t\t\t\t\t\t[ getAnimateClassName( {\n\t\t\t\t\t\t\t\ttype: 'loading',\n\t\t\t\t\t\t\t} ) ]: isSaving,\n\t\t\t\t\t } )\n\t\t\t\t\t: undefined\n\t\t\t}\n\t\t\tonClick={ isDisabled ? undefined : () => savePost() }\n\t\t\t/*\n\t\t\t * We want the tooltip to show the keyboard shortcut only when the\n\t\t\t * button does something, i.e. when it's not disabled.\n\t\t\t */\n\t\t\tshortcut={ isDisabled ? undefined : displayShortcut.primary( 's' ) }\n\t\t\tvariant=\"tertiary\"\n\t\t\tsize=\"compact\"\n\t\t\ticon={ isLargeViewport ? undefined : cloudUpload }\n\t\t\tlabel={ text || label }\n\t\t\taria-disabled={ isDisabled }\n\t\t>\n\t\t\t{ isSavedState && <Icon icon={ isSaved ? check : cloud } /> }\n\t\t\t{ text }\n\t\t</Button>\n\t);\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,wBAGO;AACP,qBAA8C;AAC9C,kBAAuC;AACvC,qBAAoC;AACpC,kBAAmB;AACnB,mBAAgD;AAChD,sBAAgC;AAChC,yBAA0C;AAK1C,yBAA+B;AAC/B,mBAAqC;AACrC,uBAAqC;AAqInC;AA1Ha,SAAR,eAAiC,EAAE,aAAa,GAAI;AAC1D,QAAM,CAAE,mBAAmB,oBAAqB,QAAI,yBAAU,KAAM;AACpE,QAAM,sBAAkB,iCAAkB,OAAQ;AAElD,QAAM;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,QAAI;AAAA,IACH,CAAE,WAAY;AACb,YAAM;AAAA,QACL;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACD,IAAI,OAAQ,aAAAA,KAAY;AACxB,YAAM,EAAE,IAAI,IAAI,OAAQ,mBAAAC,KAAiB;AACzC,aAAO;AAAA,QACN,cAAc,iBAAiB;AAAA,QAC/B,SAAS,gBAAgB,kBAAkB;AAAA,QAC3C,OAAO,gBAAgB;AAAA,QACvB,aAAa,uBAAuB;AAAA,QACpC,UAAU,aAAa;AAAA,QACvB,YAAY,qBAAqB;AAAA,QACjC,aAAa,uBAAuB;AAAA,QACpC,kBACC,eAAe,GAAG,SAAU,mBAAoB,KAAK;AAAA,QACtD,gBAAgB,IAAK,QAAQ,gBAAiB;AAAA,QAC9C,YAAY,uBAAwB,QAAS;AAAA,QAC7C,sBAAsB,CAAC,CAAE,aAAa,GAAG;AAAA,QACzC,UAAU,OAAQ,aAAAD,KAAY,EAAE,mBAAmB;AAAA,MACpD;AAAA,IACD;AAAA,IACA,CAAE,YAAa;AAAA,EAChB;AACA,QAAM,YAAY,eAAe;AACjC,QAAM,EAAE,SAAS,QAAI,yBAAa,aAAAA,KAAY;AAE9C,QAAM,gBAAY,4BAAa,QAAS;AAExC,gCAAW,MAAM;AAChB,QAAI;AAEJ,QAAK,aAAa,CAAE,UAAW;AAC9B,2BAAsB,IAAK;AAC3B,kBAAY,WAAY,MAAM;AAC7B,6BAAsB,KAAM;AAAA,MAC7B,GAAG,GAAK;AAAA,IACT;AAEA,WAAO,MAAM,aAAc,SAAU;AAAA,EACtC,GAAG,CAAE,QAAS,CAAE;AAGhB,MAAK,aAAa,uCAAuB;AACxC,WAAO;AAAA,EACR;AAIA,MAAK,CAAE,oBAAoB,WAAY;AACtC,WAAO;AAAA,EACR;AAOA,QAAM,qBACL,CAAE,CAAE,WAAW,SAAS,YAAa,EAAE,SAAU,UAAW,KAC5D,kCAAe,IAAK,CAAE,EAAE,MAAM,MAAO,KAAM,EAAE,SAAU,UAAW;AAEnE,MACC,eACA,eACA,sBACE,wBACD,CAAE,WAAW,OAAQ,EAAE,SAAU,UAAW,GAC5C;AACD,WAAO;AAAA,EACR;AAGA,QAAM,QAAQ,gBAAY,gBAAI,iBAAkB,QAAI,gBAAI,YAAa;AAGrE,QAAM,iBAAa,gBAAI,MAAO;AAE9B,QAAM,UAAU,qBAAuB,CAAE,SAAS,CAAE;AACpD,QAAM,eAAe,YAAY;AACjC,QAAM,aAAa,YAAY,WAAW,CAAE;AAC5C,MAAI;AAEJ,MAAK,UAAW;AACf,WAAO,mBAAe,gBAAI,YAAa,QAAI,gBAAI,QAAS;AAAA,EACzD,WAAY,SAAU;AACrB,eAAO,gBAAI,OAAQ;AAAA,EACpB,WAAY,iBAAkB;AAC7B,WAAO;AAAA,EACR,WAAY,gBAAiB;AAC5B,WAAO;AAAA,EACR;AAIA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,WACC,cAAc,eACX,YAAAE,SAAM;AAAA,QACN,0BAA0B,CAAE;AAAA,QAC5B,2BAA2B;AAAA,QAC3B,aAAa;AAAA,QACb,iBAAiB;AAAA,QACjB,YAAY;AAAA,QACZ,KAAE,kBAAAC,+BAAqB;AAAA,UACtB,MAAM;AAAA,QACP,CAAE,CAAE,GAAG;AAAA,MACP,CAAE,IACF;AAAA,MAEJ,SAAU,aAAa,SAAY,MAAM,SAAS;AAAA,MAKlD,UAAW,aAAa,SAAY,gCAAgB,QAAS,GAAI;AAAA,MACjE,SAAQ;AAAA,MACR,MAAK;AAAA,MACL,MAAO,kBAAkB,SAAY;AAAA,MACrC,OAAQ,QAAQ;AAAA,MAChB,iBAAgB;AAAA,MAEd;AAAA,wBAAgB,4CAAC,qBAAK,MAAO,UAAU,qBAAQ,oBAAQ;AAAA,QACvD;AAAA;AAAA;AAAA,EACH;AAEF;",
6
6
  "names": ["editorStore", "preferencesStore", "clsx", "getAnimateClassName"]
7
7
  }
@@ -54,15 +54,16 @@ var import_jsx_runtime = (
54
54
  require("react/jsx-runtime")
55
55
  );
56
56
  var PostTitle = (0, import_element.forwardRef)((_, forwardedRef) => {
57
- const { placeholder, isEditingContentOnlySection } = (0, import_data.useSelect)(
57
+ const { placeholder, isEditingContentOnlySection, isPreview } = (0, import_data.useSelect)(
58
58
  (select) => {
59
59
  const { getSettings, getEditedContentOnlySection } = (0, import_lock_unlock.unlock)(
60
60
  select(import_block_editor.store)
61
61
  );
62
- const { titlePlaceholder } = getSettings();
62
+ const { titlePlaceholder, isPreviewMode } = getSettings();
63
63
  return {
64
64
  placeholder: titlePlaceholder,
65
- isEditingContentOnlySection: !!getEditedContentOnlySection()
65
+ isEditingContentOnlySection: !!getEditedContentOnlySection(),
66
+ isPreview: isPreviewMode
66
67
  };
67
68
  },
68
69
  []
@@ -163,7 +164,7 @@ var PostTitle = (0, import_element.forwardRef)((_, forwardedRef) => {
163
164
  "h1",
164
165
  {
165
166
  ref: (0, import_compose.useMergeRefs)([richTextRef, focusRef]),
166
- contentEditable: !isEditingContentOnlySection,
167
+ contentEditable: !isEditingContentOnlySection && !isPreview,
167
168
  className,
168
169
  "aria-label": decodedPlaceholder,
169
170
  role: "textbox",