@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
@@ -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/media/index.js
31
+ var media_exports = {};
32
+ __export(media_exports, {
33
+ MediaMetadataPanel: () => import_metadata_panel.default,
34
+ MediaPreview: () => import_preview.default
35
+ });
36
+ module.exports = __toCommonJS(media_exports);
37
+ var import_preview = __toESM(require("./preview.cjs"));
38
+ var import_metadata_panel = __toESM(require("./metadata-panel.cjs"));
39
+ // Annotate the CommonJS export names for ESM import in node:
40
+ 0 && (module.exports = {
41
+ MediaMetadataPanel,
42
+ MediaPreview
43
+ });
44
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/media/index.js"],
4
+ "sourcesContent": ["export { default as MediaPreview } from './preview';\nexport { default as MediaMetadataPanel } from './metadata-panel';\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAwC;AACxC,4BAA8C;",
6
+ "names": []
7
+ }
@@ -0,0 +1,96 @@
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/media/metadata-panel.js
31
+ var metadata_panel_exports = {};
32
+ __export(metadata_panel_exports, {
33
+ default: () => MediaMetadataPanel
34
+ });
35
+ module.exports = __toCommonJS(metadata_panel_exports);
36
+ var import_media_editor = require("@wordpress/media-editor");
37
+ var import_data = require("@wordpress/data");
38
+ var import_element = require("@wordpress/element");
39
+ var import_core_data = require("@wordpress/core-data");
40
+ var import_store = require("../../store/index.cjs");
41
+ var import_post_fields = __toESM(require("../post-fields/index.cjs"));
42
+ var import_post_card_panel = __toESM(require("../post-card-panel/index.cjs"));
43
+ var import_post_panel_section = __toESM(require("../post-panel-section/index.cjs"));
44
+ var import_jsx_runtime = require("react/jsx-runtime");
45
+ function MediaMetadataPanel({ onActionPerformed }) {
46
+ const { media, postType, postId } = (0, import_data.useSelect)((select) => {
47
+ const _postType = select(import_store.store).getCurrentPostType();
48
+ const _postId = select(import_store.store).getCurrentPostId();
49
+ const currentPost = select(import_core_data.store).getEditedEntityRecord(
50
+ "postType",
51
+ _postType,
52
+ _postId,
53
+ {
54
+ _embed: "author,wp:attached-to"
55
+ }
56
+ );
57
+ return {
58
+ media: currentPost,
59
+ postType: _postType,
60
+ postId: _postId
61
+ };
62
+ }, []);
63
+ const { editPost } = (0, import_data.useDispatch)(import_store.store);
64
+ const fields = (0, import_post_fields.default)({ postType: "attachment" });
65
+ const settings = (0, import_element.useMemo)(
66
+ () => ({
67
+ fields
68
+ }),
69
+ [fields]
70
+ );
71
+ const handleUpdate = (updates) => {
72
+ editPost(updates);
73
+ };
74
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_post_panel_section.default, { className: "editor-media-metadata-panel", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
75
+ import_media_editor.MediaEditorProvider,
76
+ {
77
+ value: media,
78
+ settings,
79
+ onChange: handleUpdate,
80
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
81
+ import_media_editor.MediaForm,
82
+ {
83
+ header: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
84
+ import_post_card_panel.default,
85
+ {
86
+ postType,
87
+ postId,
88
+ onActionPerformed
89
+ }
90
+ )
91
+ }
92
+ )
93
+ }
94
+ ) });
95
+ }
96
+ //# sourceMappingURL=metadata-panel.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/media/metadata-panel.js"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { MediaEditorProvider, MediaForm } from '@wordpress/media-editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport usePostFields from '../post-fields';\nimport PostCardPanel from '../post-card-panel';\nimport PostPanelSection from '../post-panel-section';\n\n/**\n * Media metadata panel for the editor sidebar.\n * Displays a form for editing media properties with PostCardPanel header.\n *\n * @param {Object} props - Component props.\n * @param {Function} props.onActionPerformed - Callback when an action is performed.\n * @return {Element} The MediaMetadataPanel component.\n */\nexport default function MediaMetadataPanel( { onActionPerformed } ) {\n\tconst { media, postType, postId } = useSelect( ( select ) => {\n\t\tconst _postType = select( editorStore ).getCurrentPostType();\n\t\tconst _postId = select( editorStore ).getCurrentPostId();\n\t\tconst currentPost = select( coreStore ).getEditedEntityRecord(\n\t\t\t'postType',\n\t\t\t_postType,\n\t\t\t_postId,\n\t\t\t{\n\t\t\t\t_embed: 'author,wp:attached-to',\n\t\t\t}\n\t\t);\n\t\treturn {\n\t\t\tmedia: currentPost,\n\t\t\tpostType: _postType,\n\t\t\tpostId: _postId,\n\t\t};\n\t}, [] );\n\n\tconst { editPost } = useDispatch( editorStore );\n\tconst fields = usePostFields( { postType: 'attachment' } );\n\n\tconst settings = useMemo(\n\t\t() => ( {\n\t\t\tfields,\n\t\t} ),\n\t\t[ fields ]\n\t);\n\n\tconst handleUpdate = ( updates ) => {\n\t\teditPost( updates );\n\t};\n\n\treturn (\n\t\t<PostPanelSection className=\"editor-media-metadata-panel\">\n\t\t\t<MediaEditorProvider\n\t\t\t\tvalue={ media }\n\t\t\t\tsettings={ settings }\n\t\t\t\tonChange={ handleUpdate }\n\t\t\t>\n\t\t\t\t<MediaForm\n\t\t\t\t\theader={\n\t\t\t\t\t\t<PostCardPanel\n\t\t\t\t\t\t\tpostType={ postType }\n\t\t\t\t\t\t\tpostId={ postId }\n\t\t\t\t\t\t\tonActionPerformed={ onActionPerformed }\n\t\t\t\t\t\t/>\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</MediaEditorProvider>\n\t\t</PostPanelSection>\n\t);\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,0BAA+C;AAC/C,kBAAuC;AACvC,qBAAwB;AACxB,uBAAmC;AAKnC,mBAAqC;AACrC,yBAA0B;AAC1B,6BAA0B;AAC1B,gCAA6B;AAoDvB;AA1CS,SAAR,mBAAqC,EAAE,kBAAkB,GAAI;AACnE,QAAM,EAAE,OAAO,UAAU,OAAO,QAAI,uBAAW,CAAE,WAAY;AAC5D,UAAM,YAAY,OAAQ,aAAAA,KAAY,EAAE,mBAAmB;AAC3D,UAAM,UAAU,OAAQ,aAAAA,KAAY,EAAE,iBAAiB;AACvD,UAAM,cAAc,OAAQ,iBAAAC,KAAU,EAAE;AAAA,MACvC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,QACC,QAAQ;AAAA,MACT;AAAA,IACD;AACA,WAAO;AAAA,MACN,OAAO;AAAA,MACP,UAAU;AAAA,MACV,QAAQ;AAAA,IACT;AAAA,EACD,GAAG,CAAC,CAAE;AAEN,QAAM,EAAE,SAAS,QAAI,yBAAa,aAAAD,KAAY;AAC9C,QAAM,aAAS,mBAAAE,SAAe,EAAE,UAAU,aAAa,CAAE;AAEzD,QAAM,eAAW;AAAA,IAChB,OAAQ;AAAA,MACP;AAAA,IACD;AAAA,IACA,CAAE,MAAO;AAAA,EACV;AAEA,QAAM,eAAe,CAAE,YAAa;AACnC,aAAU,OAAQ;AAAA,EACnB;AAEA,SACC,4CAAC,0BAAAC,SAAA,EAAiB,WAAU,+BAC3B;AAAA,IAAC;AAAA;AAAA,MACA,OAAQ;AAAA,MACR;AAAA,MACA,UAAW;AAAA,MAEX;AAAA,QAAC;AAAA;AAAA,UACA,QACC;AAAA,YAAC,uBAAAC;AAAA,YAAA;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA;AAAA,UACD;AAAA;AAAA,MAEF;AAAA;AAAA,EACD,GACD;AAEF;",
6
+ "names": ["editorStore", "coreStore", "usePostFields", "PostPanelSection", "PostCardPanel"]
7
+ }
@@ -0,0 +1,39 @@
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/media/preview.js
21
+ var preview_exports = {};
22
+ __export(preview_exports, {
23
+ default: () => MediaPreview
24
+ });
25
+ module.exports = __toCommonJS(preview_exports);
26
+ var import_media_editor = require("@wordpress/media-editor");
27
+ var import_data = require("@wordpress/data");
28
+ var import_store = require("../../store/index.cjs");
29
+ var import_jsx_runtime = require("react/jsx-runtime");
30
+ function MediaPreview(props) {
31
+ const { media } = (0, import_data.useSelect)((select) => {
32
+ const currentPost = select(import_store.store).getCurrentPost();
33
+ return {
34
+ media: currentPost
35
+ };
36
+ }, []);
37
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_media_editor.MediaEditorProvider, { value: media, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_media_editor.MediaPreview, { ...props }) });
38
+ }
39
+ //# sourceMappingURL=preview.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/media/preview.js"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tMediaEditorProvider,\n\tMediaPreview as BaseMediaPreview,\n} from '@wordpress/media-editor';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\n/**\n * Media preview component for the editor.\n * Connects the base MediaPreview component to the editor store.\n *\n * @param {Object} props - Additional props to spread on MediaPreview.\n * @return {Element} The MediaPreview component.\n */\nexport default function MediaPreview( props ) {\n\tconst { media } = useSelect( ( select ) => {\n\t\tconst currentPost = select( editorStore ).getCurrentPost();\n\t\treturn {\n\t\t\tmedia: currentPost,\n\t\t};\n\t}, [] );\n\n\treturn (\n\t\t<MediaEditorProvider value={ media }>\n\t\t\t<BaseMediaPreview { ...props } />\n\t\t</MediaEditorProvider>\n\t);\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,0BAGO;AACP,kBAA0B;AAK1B,mBAAqC;AAmBlC;AAVY,SAAR,aAA+B,OAAQ;AAC7C,QAAM,EAAE,MAAM,QAAI,uBAAW,CAAE,WAAY;AAC1C,UAAM,cAAc,OAAQ,aAAAA,KAAY,EAAE,eAAe;AACzD,WAAO;AAAA,MACN,OAAO;AAAA,IACR;AAAA,EACD,GAAG,CAAC,CAAE;AAEN,SACC,4CAAC,2CAAoB,OAAQ,OAC5B,sDAAC,oBAAAC,cAAA,EAAmB,GAAG,OAAQ,GAChC;AAEF;",
6
+ "names": ["editorStore", "BaseMediaPreview"]
7
+ }
@@ -46,7 +46,7 @@ var import_tools_more_menu_group = __toESM(require("./tools-more-menu-group.cjs"
46
46
  var import_view_more_menu_group = __toESM(require("./view-more-menu-group.cjs"));
47
47
  var import_store = require("../../store/index.cjs");
48
48
  var import_jsx_runtime = require("react/jsx-runtime");
49
- function MoreMenu() {
49
+ function MoreMenu({ disabled = false }) {
50
50
  const { openModal } = (0, import_data.useDispatch)(import_interface.store);
51
51
  const { set: setPreference } = (0, import_data.useDispatch)(import_preferences.store);
52
52
  const { toggleDistractionFree } = (0, import_data.useDispatch)(import_store.store);
@@ -70,7 +70,8 @@ function MoreMenu() {
70
70
  showTooltip: !showIconLabels,
71
71
  ...showIconLabels && { variant: "tertiary" },
72
72
  tooltipPosition: "bottom",
73
- size: "compact"
73
+ size: "compact",
74
+ disabled
74
75
  },
75
76
  children: ({ onClose }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
76
77
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_components.MenuGroup, { label: (0, import_i18n._x)("View", "noun"), children: [
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/more-menu/index.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __, _x } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport { external, moreVertical } from '@wordpress/icons';\nimport {\n\tMenuGroup,\n\tMenuItem,\n\tVisuallyHidden,\n\tDropdownMenu,\n} from '@wordpress/components';\nimport {\n\tPreferenceToggleMenuItem,\n\tstore as preferencesStore,\n} from '@wordpress/preferences';\nimport { store as interfaceStore, ActionItem } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport CopyContentMenuItem from './copy-content-menu-item';\nimport ModeSwitcher from '../mode-switcher';\nimport ToolsMoreMenuGroup from './tools-more-menu-group';\nimport ViewMoreMenuGroup from './view-more-menu-group';\nimport { store as editorStore } from '../../store';\n\nexport default function MoreMenu() {\n\tconst { openModal } = useDispatch( interfaceStore );\n\tconst { set: setPreference } = useDispatch( preferencesStore );\n\tconst { toggleDistractionFree } = useDispatch( editorStore );\n\tconst showIconLabels = useSelect(\n\t\t( select ) =>\n\t\t\tselect( preferencesStore ).get( 'core', 'showIconLabels' ),\n\t\t[]\n\t);\n\n\tconst turnOffDistractionFree = () => {\n\t\tsetPreference( 'core', 'distractionFree', false );\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<DropdownMenu\n\t\t\t\ticon={ moreVertical }\n\t\t\t\tlabel={ __( 'Options' ) }\n\t\t\t\tpopoverProps={ {\n\t\t\t\t\tplacement: 'bottom-end',\n\t\t\t\t\tclassName: 'more-menu-dropdown__content',\n\t\t\t\t} }\n\t\t\t\ttoggleProps={ {\n\t\t\t\t\tshowTooltip: ! showIconLabels,\n\t\t\t\t\t...( showIconLabels && { variant: 'tertiary' } ),\n\t\t\t\t\ttooltipPosition: 'bottom',\n\t\t\t\t\tsize: 'compact',\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<MenuGroup label={ _x( 'View', 'noun' ) }>\n\t\t\t\t\t\t\t<PreferenceToggleMenuItem\n\t\t\t\t\t\t\t\tscope=\"core\"\n\t\t\t\t\t\t\t\tname=\"fixedToolbar\"\n\t\t\t\t\t\t\t\tonToggle={ turnOffDistractionFree }\n\t\t\t\t\t\t\t\tlabel={ __( 'Top toolbar' ) }\n\t\t\t\t\t\t\t\tinfo={ __(\n\t\t\t\t\t\t\t\t\t'Access all block and document tools in a single place'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tmessageActivated={ __(\n\t\t\t\t\t\t\t\t\t'Top toolbar activated.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tmessageDeactivated={ __(\n\t\t\t\t\t\t\t\t\t'Top toolbar deactivated.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<PreferenceToggleMenuItem\n\t\t\t\t\t\t\t\tscope=\"core\"\n\t\t\t\t\t\t\t\tname=\"distractionFree\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Distraction free' ) }\n\t\t\t\t\t\t\t\tinfo={ __( 'Write with calmness' ) }\n\t\t\t\t\t\t\t\thandleToggling={ false }\n\t\t\t\t\t\t\t\tonToggle={ () =>\n\t\t\t\t\t\t\t\t\ttoggleDistractionFree( {\n\t\t\t\t\t\t\t\t\t\tcreateNotice: false,\n\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tmessageActivated={ __(\n\t\t\t\t\t\t\t\t\t'Distraction free mode activated.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tmessageDeactivated={ __(\n\t\t\t\t\t\t\t\t\t'Distraction free mode deactivated.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tshortcut={ displayShortcut.primaryShift(\n\t\t\t\t\t\t\t\t\t'\\\\'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<PreferenceToggleMenuItem\n\t\t\t\t\t\t\t\tscope=\"core\"\n\t\t\t\t\t\t\t\tname=\"focusMode\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Spotlight mode' ) }\n\t\t\t\t\t\t\t\tinfo={ __( 'Focus on one block at a time' ) }\n\t\t\t\t\t\t\t\tmessageActivated={ __(\n\t\t\t\t\t\t\t\t\t'Spotlight mode activated.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tmessageDeactivated={ __(\n\t\t\t\t\t\t\t\t\t'Spotlight mode deactivated.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<ViewMoreMenuGroup.Slot fillProps={ { onClose } } />\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t<ModeSwitcher />\n\t\t\t\t\t\t<ActionItem.Slot\n\t\t\t\t\t\t\tname=\"core/plugin-more-menu\"\n\t\t\t\t\t\t\tlabel={ __( 'Panels' ) }\n\t\t\t\t\t\t\tfillProps={ { onClick: onClose } }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<MenuGroup label={ __( 'Tools' ) }>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\topenModal( 'editor/keyboard-shortcut-help' )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tshortcut={ displayShortcut.access( 'h' ) }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Keyboard shortcuts' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t<CopyContentMenuItem />\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\ticon={ external }\n\t\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t\t'https://wordpress.org/documentation/article/wordpress-block-editor/'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Help' ) }\n\t\t\t\t\t\t\t\t<VisuallyHidden as=\"span\">\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t/* translators: accessibility text */\n\t\t\t\t\t\t\t\t\t\t__( '(opens in a new tab)' )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t<ToolsMoreMenuGroup.Slot\n\t\t\t\t\t\t\t\tfillProps={ { onClose } }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\topenModal( 'editor/preferences' )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Preferences' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</DropdownMenu>\n\t\t</>\n\t);\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAuB;AACvB,kBAAuC;AACvC,sBAAgC;AAChC,mBAAuC;AACvC,wBAKO;AACP,yBAGO;AACP,uBAAoD;AAKpD,oCAAgC;AAChC,2BAAyB;AACzB,mCAA+B;AAC/B,kCAA8B;AAC9B,mBAAqC;AAiChC;AA/BU,S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QAAQ;AAAA;AAAA,UACvB;AAAA,WACD;AAAA,QACA,4CAAC,+BACA;AAAA,UAAC;AAAA;AAAA,YACA,SAAU,MACT,UAAW,oBAAqB;AAAA,YAG/B,8BAAI,aAAc;AAAA;AAAA,QACrB,GACD;AAAA,SACD;AAAA;AAAA,EAEF,GACD;AAEF;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __, _x } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport { external, moreVertical } from '@wordpress/icons';\nimport {\n\tMenuGroup,\n\tMenuItem,\n\tVisuallyHidden,\n\tDropdownMenu,\n} from '@wordpress/components';\nimport {\n\tPreferenceToggleMenuItem,\n\tstore as preferencesStore,\n} from '@wordpress/preferences';\nimport { store as interfaceStore, ActionItem } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport CopyContentMenuItem from './copy-content-menu-item';\nimport ModeSwitcher from '../mode-switcher';\nimport ToolsMoreMenuGroup from './tools-more-menu-group';\nimport ViewMoreMenuGroup from './view-more-menu-group';\nimport { store as editorStore } from '../../store';\n\nexport default function MoreMenu( { disabled = false } ) {\n\tconst { openModal } = useDispatch( interfaceStore );\n\tconst { set: setPreference } = useDispatch( preferencesStore );\n\tconst { toggleDistractionFree } = useDispatch( editorStore );\n\tconst showIconLabels = useSelect(\n\t\t( select ) =>\n\t\t\tselect( preferencesStore ).get( 'core', 'showIconLabels' ),\n\t\t[]\n\t);\n\n\tconst turnOffDistractionFree = () => {\n\t\tsetPreference( 'core', 'distractionFree', false );\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<DropdownMenu\n\t\t\t\ticon={ moreVertical }\n\t\t\t\tlabel={ __( 'Options' ) }\n\t\t\t\tpopoverProps={ {\n\t\t\t\t\tplacement: 'bottom-end',\n\t\t\t\t\tclassName: 'more-menu-dropdown__content',\n\t\t\t\t} }\n\t\t\t\ttoggleProps={ {\n\t\t\t\t\tshowTooltip: ! showIconLabels,\n\t\t\t\t\t...( showIconLabels && { variant: 'tertiary' } ),\n\t\t\t\t\ttooltipPosition: 'bottom',\n\t\t\t\t\tsize: 'compact',\n\t\t\t\t\tdisabled,\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<MenuGroup label={ _x( 'View', 'noun' ) }>\n\t\t\t\t\t\t\t<PreferenceToggleMenuItem\n\t\t\t\t\t\t\t\tscope=\"core\"\n\t\t\t\t\t\t\t\tname=\"fixedToolbar\"\n\t\t\t\t\t\t\t\tonToggle={ turnOffDistractionFree }\n\t\t\t\t\t\t\t\tlabel={ __( 'Top toolbar' ) }\n\t\t\t\t\t\t\t\tinfo={ __(\n\t\t\t\t\t\t\t\t\t'Access all block and document tools in a single place'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tmessageActivated={ __(\n\t\t\t\t\t\t\t\t\t'Top toolbar activated.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tmessageDeactivated={ __(\n\t\t\t\t\t\t\t\t\t'Top toolbar deactivated.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<PreferenceToggleMenuItem\n\t\t\t\t\t\t\t\tscope=\"core\"\n\t\t\t\t\t\t\t\tname=\"distractionFree\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Distraction free' ) }\n\t\t\t\t\t\t\t\tinfo={ __( 'Write with calmness' ) }\n\t\t\t\t\t\t\t\thandleToggling={ false }\n\t\t\t\t\t\t\t\tonToggle={ () =>\n\t\t\t\t\t\t\t\t\ttoggleDistractionFree( {\n\t\t\t\t\t\t\t\t\t\tcreateNotice: false,\n\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tmessageActivated={ __(\n\t\t\t\t\t\t\t\t\t'Distraction free mode activated.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tmessageDeactivated={ __(\n\t\t\t\t\t\t\t\t\t'Distraction free mode deactivated.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tshortcut={ displayShortcut.primaryShift(\n\t\t\t\t\t\t\t\t\t'\\\\'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<PreferenceToggleMenuItem\n\t\t\t\t\t\t\t\tscope=\"core\"\n\t\t\t\t\t\t\t\tname=\"focusMode\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Spotlight mode' ) }\n\t\t\t\t\t\t\t\tinfo={ __( 'Focus on one block at a time' ) }\n\t\t\t\t\t\t\t\tmessageActivated={ __(\n\t\t\t\t\t\t\t\t\t'Spotlight mode activated.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tmessageDeactivated={ __(\n\t\t\t\t\t\t\t\t\t'Spotlight mode deactivated.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<ViewMoreMenuGroup.Slot fillProps={ { onClose } } />\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t<ModeSwitcher />\n\t\t\t\t\t\t<ActionItem.Slot\n\t\t\t\t\t\t\tname=\"core/plugin-more-menu\"\n\t\t\t\t\t\t\tlabel={ __( 'Panels' ) }\n\t\t\t\t\t\t\tfillProps={ { onClick: onClose } }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<MenuGroup label={ __( 'Tools' ) }>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\topenModal( 'editor/keyboard-shortcut-help' )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tshortcut={ displayShortcut.access( 'h' ) }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Keyboard shortcuts' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t<CopyContentMenuItem />\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\ticon={ external }\n\t\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t\t'https://wordpress.org/documentation/article/wordpress-block-editor/'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Help' ) }\n\t\t\t\t\t\t\t\t<VisuallyHidden as=\"span\">\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t/* translators: accessibility text */\n\t\t\t\t\t\t\t\t\t\t__( '(opens in a new tab)' )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t<ToolsMoreMenuGroup.Slot\n\t\t\t\t\t\t\t\tfillProps={ { onClose } }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\topenModal( 'editor/preferences' )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Preferences' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</DropdownMenu>\n\t\t</>\n\t);\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAuB;AACvB,kBAAuC;AACvC,sBAAgC;AAChC,mBAAuC;AACvC,wBAKO;AACP,yBAGO;AACP,uBAAoD;AAKpD,oCAAgC;AAChC,2BAAyB;AACzB,mCA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;AAAA,UACD;AAAA,UACA;AAAA,YAAC,6BAAAC,QAAmB;AAAA,YAAnB;AAAA,cACA,WAAY,EAAE,QAAQ;AAAA;AAAA,UACvB;AAAA,WACD;AAAA,QACA,4CAAC,+BACA;AAAA,UAAC;AAAA;AAAA,YACA,SAAU,MACT,UAAW,oBAAqB;AAAA,YAG/B,8BAAI,aAAc;AAAA;AAAA,QACrB,GACD;AAAA,SACD;AAAA;AAAA,EAEF,GACD;AAEF;",
6
6
  "names": ["interfaceStore", "preferencesStore", "editorStore", "ViewMoreMenuGroup", "ModeSwitcher", "CopyContentMenuItem", "ToolsMoreMenuGroup"]
7
7
  }
@@ -34,6 +34,7 @@ __export(post_card_panel_exports, {
34
34
  });
35
35
  module.exports = __toCommonJS(post_card_panel_exports);
36
36
  var import_components = require("@wordpress/components");
37
+ var import_icons = require("@wordpress/icons");
37
38
  var import_core_data = require("@wordpress/core-data");
38
39
  var import_data = require("@wordpress/data");
39
40
  var import_element = require("@wordpress/element");
@@ -56,11 +57,29 @@ function PostCardPanel({
56
57
  () => Array.isArray(postId) ? postId : [postId],
57
58
  [postId]
58
59
  );
59
- const { postTitle, icon, labels } = (0, import_data.useSelect)(
60
+ const { postTitle, icon, labels, isRevision } = (0, import_data.useSelect)(
60
61
  (select) => {
61
62
  const { getEditedEntityRecord, getCurrentTheme, getPostType } = select(import_core_data.store);
62
- const { getPostIcon } = (0, import_lock_unlock.unlock)(select(import_store.store));
63
+ const {
64
+ getPostIcon,
65
+ getCurrentPostType,
66
+ isRevisionsMode,
67
+ getCurrentRevision
68
+ } = (0, import_lock_unlock.unlock)(select(import_store.store));
63
69
  let _title = "";
70
+ if (isRevisionsMode()) {
71
+ const parentPostType = getCurrentPostType();
72
+ const _record2 = getCurrentRevision();
73
+ _title = _record2?.title?.rendered || _record2?.title?.raw || "";
74
+ return {
75
+ postTitle: _title,
76
+ icon: getPostIcon(parentPostType, {
77
+ area: _record2?.area
78
+ }),
79
+ labels: getPostType(parentPostType)?.labels,
80
+ isRevision: true
81
+ };
82
+ }
64
83
  const _record = getEditedEntityRecord(
65
84
  "postType",
66
85
  postType,
@@ -121,14 +140,24 @@ function PostCardPanel({
121
140
  ]
122
141
  }
123
142
  ),
124
- postIds.length === 1 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
143
+ postIds.length === 1 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: isRevision ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
144
+ import_components.Button,
145
+ {
146
+ size: "small",
147
+ icon: import_icons.moreVertical,
148
+ label: (0, import_i18n.__)("Actions"),
149
+ disabled: true,
150
+ accessibleWhenDisabled: true,
151
+ className: "editor-all-actions-button"
152
+ }
153
+ ) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
125
154
  import_post_actions.default,
126
155
  {
127
156
  postType,
128
157
  postId: postIds[0],
129
158
  onActionPerformed
130
159
  }
131
- )
160
+ ) })
132
161
  ]
133
162
  }
134
163
  ),
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/post-card-panel/index.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tIcon,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\t__experimentalText as Text,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport {\n\tTEMPLATE_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n} from '../../store/constants';\nimport { unlock } from '../../lock-unlock';\nimport PostActions from '../post-actions';\nimport usePageTypeBadge from '../../utils/pageTypeBadge';\nimport { getTemplateInfo } from '../../utils/get-template-info';\nconst { Badge } = unlock( componentsPrivateApis );\n\n/**\n * Renders a title of the post type and the available quick actions available within a 3-dot dropdown.\n *\n * @param {Object} props - Component props.\n * @param {string} [props.postType] - The post type string.\n * @param {string|string[]} [props.postId] - The post id or list of post ids.\n * @param {Function} [props.onActionPerformed] - A callback function for when a quick action is performed.\n * @return {React.ReactNode} The rendered component.\n */\nexport default function PostCardPanel( {\n\tpostType,\n\tpostId,\n\tonActionPerformed,\n} ) {\n\tconst postIds = useMemo(\n\t\t() => ( Array.isArray( postId ) ? postId : [ postId ] ),\n\t\t[ postId ]\n\t);\n\tconst { postTitle, icon, labels } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedEntityRecord, getCurrentTheme, getPostType } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst { getPostIcon } = unlock( select( editorStore ) );\n\t\t\tlet _title = '';\n\t\t\tconst _record = getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\tpostIds[ 0 ]\n\t\t\t);\n\t\t\tif ( postIds.length === 1 ) {\n\t\t\t\tconst { default_template_types: templateTypes = [] } =\n\t\t\t\t\tgetCurrentTheme() ?? {};\n\n\t\t\t\tconst _templateInfo = [\n\t\t\t\t\tTEMPLATE_POST_TYPE,\n\t\t\t\t\tTEMPLATE_PART_POST_TYPE,\n\t\t\t\t].includes( postType )\n\t\t\t\t\t? getTemplateInfo( {\n\t\t\t\t\t\t\ttemplate: _record,\n\t\t\t\t\t\t\ttemplateTypes,\n\t\t\t\t\t } )\n\t\t\t\t\t: {};\n\t\t\t\t_title = _templateInfo?.title || _record?.title;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tpostTitle: _title,\n\t\t\t\ticon: getPostIcon( postType, {\n\t\t\t\t\tarea: _record?.area,\n\t\t\t\t} ),\n\t\t\t\tlabels: getPostType( postType )?.labels,\n\t\t\t};\n\t\t},\n\t\t[ postIds, postType ]\n\t);\n\n\tconst pageTypeBadge = usePageTypeBadge( postId );\n\tlet title = __( 'No title' );\n\tif ( labels?.name && postIds.length > 1 ) {\n\t\ttitle = sprintf(\n\t\t\t// translators: %1$d number of selected items %2$s: Name of the plural post type e.g: \"Posts\".\n\t\t\t__( '%1$d %2$s' ),\n\t\t\tpostIds.length,\n\t\t\tlabels?.name\n\t\t);\n\t} else if ( postTitle ) {\n\t\ttitle = stripHTML( postTitle );\n\t}\n\n\treturn (\n\t\t<VStack spacing={ 1 } className=\"editor-post-card-panel\">\n\t\t\t<HStack\n\t\t\t\tspacing={ 2 }\n\t\t\t\tclassName=\"editor-post-card-panel__header\"\n\t\t\t\talignment=\"flex-start\"\n\t\t\t>\n\t\t\t\t<Icon className=\"editor-post-card-panel__icon\" icon={ icon } />\n\t\t\t\t<Text\n\t\t\t\t\tnumberOfLines={ 2 }\n\t\t\t\t\ttruncate\n\t\t\t\t\tclassName=\"editor-post-card-panel__title\"\n\t\t\t\t\tas=\"h2\"\n\t\t\t\t>\n\t\t\t\t\t<span className=\"editor-post-card-panel__title-name\">\n\t\t\t\t\t\t{ title }\n\t\t\t\t\t</span>\n\t\t\t\t\t{ pageTypeBadge && postIds.length === 1 && (\n\t\t\t\t\t\t<Badge>{ pageTypeBadge }</Badge>\n\t\t\t\t\t) }\n\t\t\t\t</Text>\n\t\t\t\t{ postIds.length === 1 && (\n\t\t\t\t\t<PostActions\n\t\t\t\t\t\tpostType={ postType }\n\t\t\t\t\t\tpostId={ postIds[ 0 ] }\n\t\t\t\t\t\tonActionPerformed={ onActionPerformed }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</HStack>\n\t\t\t{ postIds.length > 1 && (\n\t\t\t\t<Text className=\"editor-post-card-panel__description\">\n\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t// translators: %s: Name of the plural post type e.g: \"Posts\".\n\t\t\t\t\t\t__( 'Changes will be applied to all selected %s.' ),\n\t\t\t\t\t\tlabels?.name.toLowerCase()\n\t\t\t\t\t) }\n\t\t\t\t</Text>\n\t\t\t) }\n\t\t</VStack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esContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tIcon,\n\tButton,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\t__experimentalText as Text,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { moreVertical } from '@wordpress/icons';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport {\n\tTEMPLATE_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n} from '../../store/constants';\nimport { unlock } from '../../lock-unlock';\nimport PostActions from '../post-actions';\nimport usePageTypeBadge from '../../utils/pageTypeBadge';\nimport { getTemplateInfo } from '../../utils/get-template-info';\nconst { Badge } = unlock( componentsPrivateApis );\n\n/**\n * Renders a title of the post type and the available quick actions available within a 3-dot dropdown.\n *\n * @param {Object} props - Component props.\n * @param {string} [props.postType] - The post type string.\n * @param {string|string[]} [props.postId] - The post id or list of post ids.\n * @param {Function} [props.onActionPerformed] - A callback function for when a quick action is performed.\n * @return {React.ReactNode} The rendered component.\n */\nexport default function PostCardPanel( {\n\tpostType,\n\tpostId,\n\tonActionPerformed,\n} ) {\n\tconst postIds = useMemo(\n\t\t() => ( Array.isArray( postId ) ? postId : [ postId ] ),\n\t\t[ postId ]\n\t);\n\tconst { postTitle, icon, labels, isRevision } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedEntityRecord, getCurrentTheme, getPostType } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst {\n\t\t\t\tgetPostIcon,\n\t\t\t\tgetCurrentPostType,\n\t\t\t\tisRevisionsMode,\n\t\t\t\tgetCurrentRevision,\n\t\t\t} = unlock( select( editorStore ) );\n\t\t\tlet _title = '';\n\n\t\t\t// In revisions mode, use the current revision.\n\t\t\tif ( isRevisionsMode() ) {\n\t\t\t\tconst parentPostType = getCurrentPostType();\n\t\t\t\tconst _record = getCurrentRevision();\n\t\t\t\t_title = _record?.title?.rendered || _record?.title?.raw || '';\n\t\t\t\treturn {\n\t\t\t\t\tpostTitle: _title,\n\t\t\t\t\ticon: getPostIcon( parentPostType, {\n\t\t\t\t\t\tarea: _record?.area,\n\t\t\t\t\t} ),\n\t\t\t\t\tlabels: getPostType( parentPostType )?.labels,\n\t\t\t\t\tisRevision: true,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst _record = getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\tpostIds[ 0 ]\n\t\t\t);\n\t\t\tif ( postIds.length === 1 ) {\n\t\t\t\tconst { default_template_types: templateTypes = [] } =\n\t\t\t\t\tgetCurrentTheme() ?? {};\n\n\t\t\t\tconst _templateInfo = [\n\t\t\t\t\tTEMPLATE_POST_TYPE,\n\t\t\t\t\tTEMPLATE_PART_POST_TYPE,\n\t\t\t\t].includes( postType )\n\t\t\t\t\t? getTemplateInfo( {\n\t\t\t\t\t\t\ttemplate: _record,\n\t\t\t\t\t\t\ttemplateTypes,\n\t\t\t\t\t } )\n\t\t\t\t\t: {};\n\t\t\t\t_title = _templateInfo?.title || _record?.title;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tpostTitle: _title,\n\t\t\t\ticon: getPostIcon( postType, {\n\t\t\t\t\tarea: _record?.area,\n\t\t\t\t} ),\n\t\t\t\tlabels: getPostType( postType )?.labels,\n\t\t\t};\n\t\t},\n\t\t[ postIds, postType ]\n\t);\n\n\tconst pageTypeBadge = usePageTypeBadge( postId );\n\tlet title = __( 'No title' );\n\tif ( labels?.name && postIds.length > 1 ) {\n\t\ttitle = sprintf(\n\t\t\t// translators: %1$d number of selected items %2$s: Name of the plural post type e.g: \"Posts\".\n\t\t\t__( '%1$d %2$s' ),\n\t\t\tpostIds.length,\n\t\t\tlabels?.name\n\t\t);\n\t} else if ( postTitle ) {\n\t\ttitle = stripHTML( postTitle );\n\t}\n\n\treturn (\n\t\t<VStack spacing={ 1 } className=\"editor-post-card-panel\">\n\t\t\t<HStack\n\t\t\t\tspacing={ 2 }\n\t\t\t\tclassName=\"editor-post-card-panel__header\"\n\t\t\t\talignment=\"flex-start\"\n\t\t\t>\n\t\t\t\t<Icon className=\"editor-post-card-panel__icon\" icon={ icon } />\n\t\t\t\t<Text\n\t\t\t\t\tnumberOfLines={ 2 }\n\t\t\t\t\ttruncate\n\t\t\t\t\tclassName=\"editor-post-card-panel__title\"\n\t\t\t\t\tas=\"h2\"\n\t\t\t\t>\n\t\t\t\t\t<span className=\"editor-post-card-panel__title-name\">\n\t\t\t\t\t\t{ title }\n\t\t\t\t\t</span>\n\t\t\t\t\t{ pageTypeBadge && postIds.length === 1 && (\n\t\t\t\t\t\t<Badge>{ pageTypeBadge }</Badge>\n\t\t\t\t\t) }\n\t\t\t\t</Text>\n\t\t\t\t{ postIds.length === 1 && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ isRevision ? (\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\t\t\t\tlabel={ __( 'Actions' ) }\n\t\t\t\t\t\t\t\tdisabled\n\t\t\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\t\t\tclassName=\"editor-all-actions-button\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<PostActions\n\t\t\t\t\t\t\t\tpostType={ postType }\n\t\t\t\t\t\t\t\tpostId={ postIds[ 0 ] }\n\t\t\t\t\t\t\t\tonActionPerformed={ onActionPerformed }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</HStack>\n\t\t\t{ postIds.length > 1 && (\n\t\t\t\t<Text className=\"editor-post-card-panel__description\">\n\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t// translators: %s: Name of the plural post type e.g: \"Posts\".\n\t\t\t\t\t\t__( 'Changes will be applied to all selected %s.' ),\n\t\t\t\t\t\tlabels?.name.toLowerCase()\n\t\t\t\t\t) }\n\t\t\t\t</Text>\n\t\t\t) }\n\t\t</VStack>\n\t);\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAOO;AACP,mBAA6B;AAC7B,uBAAmC;AACnC,kBAA0B;AAC1B,qBAAwB;AACxB,kBAA4B;AAC5B,iBAAiD;AAKjD,mBAAqC;AACrC,uBAGO;AACP,yBAAuB;AACvB,0BAAwB;AACxB,2BAA6B;AAC7B,+BAAgC;AAoG5B;AAnGJ,IAAM,EAAE,MAAM,QAAI,2BAAQ,kBAAAA,WAAsB;AAWjC,SAAR,cAAgC;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AACD,GAAI;AACH,QAAM,cAAU;AAAA,IACf,MAAQ,MAAM,QAAS,MAAO,IAAI,SAAS,CAAE,MAAO;AAAA,IACpD,CAAE,MAAO;AAAA,EACV;AACA,QAAM,EAAE,WAAW,MAAM,QAAQ,WAAW,QAAI;AAAA,IAC/C,CAAE,WAAY;AACb,YAAM,EAAE,uBAAuB,iBAAiB,YAAY,IAC3D,OAAQ,iBAAAC,KAAU;AACnB,YAAM;AAAA,QACL;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACD,QAAI,2BAAQ,OAAQ,aAAAC,KAAY,CAAE;AAClC,UAAI,SAAS;AAGb,UAAK,gBAAgB,GAAI;AACxB,cAAM,iBAAiB,mBAAmB;AAC1C,cAAMC,WAAU,mBAAmB;AACnC,iBAASA,UAAS,OAAO,YAAYA,UAAS,OAAO,OAAO;AAC5D,eAAO;AAAA,UACN,WAAW;AAAA,UACX,MAAM,YAAa,gBAAgB;AAAA,YAClC,MAAMA,UAAS;AAAA,UAChB,CAAE;AAAA,UACF,QAAQ,YAAa,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;AAAA,cAEH;AAAA,4DAAC,UAAK,WAAU,sCACb,iBACH;AAAA,gBACE,iBAAiB,QAAQ,WAAW,KACrC,4CAAC,SAAQ,yBAAe;AAAA;AAAA;AAAA,UAE1B;AAAA,UACE,QAAQ,WAAW,KACpB,2EACG,uBACD;AAAA,YAAC;AAAA;AAAA,cACA,MAAK;AAAA,cACL,MAAO;AAAA,cACP,WAAQ,gBAAI,SAAU;AAAA,cACtB,UAAQ;AAAA,cACR,wBAAsB;AAAA,cACtB,WAAU;AAAA;AAAA,UACX,IAEA;AAAA,YAAC,oBAAAC;AAAA,YAAA;AAAA,cACA;AAAA,cACA,QAAS,QAAS,CAAE;AAAA,cACpB;AAAA;AAAA,UACD,GAEF;AAAA;AAAA;AAAA,IAEF;AAAA,IACE,QAAQ,SAAS,KAClB,4CAAC,kBAAAD,oBAAA,EAAK,WAAU,uCACb;AAAA;AAAA,UAED,gBAAI,6CAA8C;AAAA,MAClD,QAAQ,KAAK,YAAY;AAAA,IAC1B,GACD;AAAA,KAEF;AAEF;",
6
+ "names": ["componentsPrivateApis", "coreStore", "editorStore", "_record", "usePageTypeBadge", "stripHTML", "VStack", "HStack", "Text", "PostActions"]
7
7
  }
@@ -30,12 +30,21 @@ var import_wordcount = require("@wordpress/wordcount");
30
30
  var import_element = require("@wordpress/element");
31
31
  var import_core_data = require("@wordpress/core-data");
32
32
  var import_store = require("../../store/index.cjs");
33
+ var import_lock_unlock = require("../../lock-unlock.cjs");
33
34
  var import_constants = require("../../store/constants.cjs");
34
35
  var import_jsx_runtime = require("react/jsx-runtime");
35
36
  var AVERAGE_READING_RATE = 189;
36
37
  function PostContentInformation() {
37
38
  const { postContent } = (0, import_data.useSelect)((select) => {
38
39
  const { getEditedPostAttribute, getCurrentPostType, getCurrentPostId } = select(import_store.store);
40
+ const { getCurrentRevision, isRevisionsMode } = (0, import_lock_unlock.unlock)(
41
+ select(import_store.store)
42
+ );
43
+ if (isRevisionsMode()) {
44
+ return {
45
+ postContent: getCurrentRevision()?.content?.raw
46
+ };
47
+ }
39
48
  const { canUser } = select(import_core_data.store);
40
49
  const { getEntityRecord } = select(import_core_data.store);
41
50
  const siteSettings = canUser("read", {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/post-content-information/index.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __experimentalText as Text } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { __, _x, _n, sprintf } from '@wordpress/i18n';\nimport { count as wordCount } from '@wordpress/wordcount';\nimport { useMemo } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport {\n\tTEMPLATE_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n} from '../../store/constants';\n\n// Taken from packages/editor/src/components/time-to-read/index.js.\nconst AVERAGE_READING_RATE = 189;\n\n// This component renders the wordcount and reading time for the post.\nexport default function PostContentInformation() {\n\tconst { postContent } = useSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute, getCurrentPostType, getCurrentPostId } =\n\t\t\tselect( editorStore );\n\t\tconst { canUser } = select( coreStore );\n\t\tconst { getEntityRecord } = select( coreStore );\n\t\tconst siteSettings = canUser( 'read', {\n\t\t\tkind: 'root',\n\t\t\tname: 'site',\n\t\t} )\n\t\t\t? getEntityRecord( 'root', 'site' )\n\t\t\t: undefined;\n\t\tconst postType = getCurrentPostType();\n\t\tconst _id = getCurrentPostId();\n\t\tconst isPostsPage = +_id === siteSettings?.page_for_posts;\n\t\tconst showPostContentInfo =\n\t\t\t! isPostsPage &&\n\t\t\t! [ TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE ].includes(\n\t\t\t\tpostType\n\t\t\t);\n\t\treturn {\n\t\t\tpostContent:\n\t\t\t\tshowPostContentInfo && getEditedPostAttribute( 'content' ),\n\t\t};\n\t}, [] );\n\n\t/*\n\t * translators: If your word count is based on single characters (e.g. East Asian characters),\n\t * enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'.\n\t * Do not translate into your own language.\n\t */\n\tconst wordCountType = _x( 'words', 'Word count type. Do not translate!' );\n\tconst wordsCounted = useMemo(\n\t\t() => ( postContent ? wordCount( postContent, wordCountType ) : 0 ),\n\t\t[ postContent, wordCountType ]\n\t);\n\tif ( ! wordsCounted ) {\n\t\treturn null;\n\t}\n\tconst readingTime = Math.round( wordsCounted / AVERAGE_READING_RATE );\n\tconst wordsCountText = sprintf(\n\t\t// translators: %s: the number of words in the post.\n\t\t_n( '%s word', '%s words', wordsCounted ),\n\t\twordsCounted.toLocaleString()\n\t);\n\tconst minutesText =\n\t\treadingTime <= 1\n\t\t\t? __( '1 minute' )\n\t\t\t: sprintf(\n\t\t\t\t\t/* translators: %s: the number of minutes to read the post. */\n\t\t\t\t\t_n( '%s minute', '%s minutes', readingTime ),\n\t\t\t\t\treadingTime.toLocaleString()\n\t\t\t );\n\treturn (\n\t\t<div className=\"editor-post-content-information\">\n\t\t\t<Text>\n\t\t\t\t{ sprintf(\n\t\t\t\t\t/* translators: 1: How many words a post has. 2: the number of minutes to read the post (e.g. 130 words, 2 minutes read time.) */\n\t\t\t\t\t__( '%1$s, %2$s read time.' ),\n\t\t\t\t\twordsCountText,\n\t\t\t\t\tminutesText\n\t\t\t\t) }\n\t\t\t</Text>\n\t\t</div>\n\t);\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAA2C;AAC3C,kBAA0B;AAC1B,kBAAoC;AACpC,uBAAmC;AACnC,qBAAwB;AACxB,uBAAmC;AAKnC,mBAAqC;AACrC,uBAGO;AA6DJ;AA1DH,IAAM,uBAAuB;AAGd,SAAR,yBAA0C;AAChD,QAAM,EAAE,YAAY,QAAI,uBAAW,CAAE,WAAY;AAChD,UAAM,EAAE,wBAAwB,oBAAoB,iBAAiB,IACpE,OAAQ,aAAAA,KAAY;AACrB,UAAM,EAAE,QAAQ,IAAI,OAAQ,iBAAAC,KAAU;AACtC,UAAM,EAAE,gBAAgB,IAAI,OAAQ,iBAAAA,KAAU;AAC9C,UAAM,eAAe,QAAS,QAAQ;AAAA,MACrC,MAAM;AAAA,MACN,MAAM;AAAA,IACP,CAAE,IACC,gBAAiB,QAAQ,MAAO,IAChC;AACH,UAAM,WAAW,mBAAmB;AACpC,UAAM,MAAM,iBAAiB;AAC7B,UAAM,cAAc,CAAC,QAAQ,cAAc;AAC3C,UAAM,sBACL,CAAE,eACF,CAAE,CAAE,qCAAoB,wCAAwB,EAAE;AAAA,MACjD;AAAA,IACD;AACD,WAAO;AAAA,MACN,aACC,uBAAuB,uBAAwB,SAAU;AAAA,IAC3D;AAAA,EACD,GAAG,CAAC,CAAE;AAON,QAAM,oBAAgB,gBAAI,SAAS,oCAAqC;AACxE,QAAM,mBAAe;AAAA,IACpB,MAAQ,kBAAc,iBAAAC,OAAW,aAAa,aAAc,IAAI;AAAA,IAChE,CAAE,aAAa,aAAc;AAAA,EAC9B;AACA,MAAK,CAAE,cAAe;AACrB,WAAO;AAAA,EACR;AACA,QAAM,cAAc,KAAK,MAAO,eAAe,oBAAqB;AACpE,QAAM,qBAAiB;AAAA;AAAA,QAEtB,gBAAI,WAAW,YAAY,YAAa;AAAA,IACxC,aAAa,eAAe;AAAA,EAC7B;AACA,QAAM,cACL,eAAe,QACZ,gBAAI,UAAW,QACf;AAAA;AAAA,QAEA,gBAAI,aAAa,cAAc,WAAY;AAAA,IAC3C,YAAY,eAAe;AAAA,EAC3B;AACJ,SACC,4CAAC,SAAI,WAAU,mCACd,sDAAC,kBAAAC,oBAAA,EACE;AAAA;AAAA,QAED,gBAAI,uBAAwB;AAAA,IAC5B;AAAA,IACA;AAAA,EACD,GACD,GACD;AAEF;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __experimentalText as Text } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { __, _x, _n, sprintf } from '@wordpress/i18n';\nimport { count as wordCount } from '@wordpress/wordcount';\nimport { useMemo } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport {\n\tTEMPLATE_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n} from '../../store/constants';\n\n// Taken from packages/editor/src/components/time-to-read/index.js.\nconst AVERAGE_READING_RATE = 189;\n\n// This component renders the wordcount and reading time for the post.\nexport default function PostContentInformation() {\n\tconst { postContent } = useSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute, getCurrentPostType, getCurrentPostId } =\n\t\t\tselect( editorStore );\n\t\tconst { getCurrentRevision, isRevisionsMode } = unlock(\n\t\t\tselect( editorStore )\n\t\t);\n\n\t\tif ( isRevisionsMode() ) {\n\t\t\treturn {\n\t\t\t\tpostContent: getCurrentRevision()?.content?.raw,\n\t\t\t};\n\t\t}\n\n\t\tconst { canUser } = select( coreStore );\n\t\tconst { getEntityRecord } = select( coreStore );\n\t\tconst siteSettings = canUser( 'read', {\n\t\t\tkind: 'root',\n\t\t\tname: 'site',\n\t\t} )\n\t\t\t? getEntityRecord( 'root', 'site' )\n\t\t\t: undefined;\n\t\tconst postType = getCurrentPostType();\n\t\tconst _id = getCurrentPostId();\n\t\tconst isPostsPage = +_id === siteSettings?.page_for_posts;\n\t\tconst showPostContentInfo =\n\t\t\t! isPostsPage &&\n\t\t\t! [ TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE ].includes(\n\t\t\t\tpostType\n\t\t\t);\n\t\treturn {\n\t\t\tpostContent:\n\t\t\t\tshowPostContentInfo && getEditedPostAttribute( 'content' ),\n\t\t};\n\t}, [] );\n\n\t/*\n\t * translators: If your word count is based on single characters (e.g. East Asian characters),\n\t * enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'.\n\t * Do not translate into your own language.\n\t */\n\tconst wordCountType = _x( 'words', 'Word count type. Do not translate!' );\n\tconst wordsCounted = useMemo(\n\t\t() => ( postContent ? wordCount( postContent, wordCountType ) : 0 ),\n\t\t[ postContent, wordCountType ]\n\t);\n\tif ( ! wordsCounted ) {\n\t\treturn null;\n\t}\n\tconst readingTime = Math.round( wordsCounted / AVERAGE_READING_RATE );\n\tconst wordsCountText = sprintf(\n\t\t// translators: %s: the number of words in the post.\n\t\t_n( '%s word', '%s words', wordsCounted ),\n\t\twordsCounted.toLocaleString()\n\t);\n\tconst minutesText =\n\t\treadingTime <= 1\n\t\t\t? __( '1 minute' )\n\t\t\t: sprintf(\n\t\t\t\t\t/* translators: %s: the number of minutes to read the post. */\n\t\t\t\t\t_n( '%s minute', '%s minutes', readingTime ),\n\t\t\t\t\treadingTime.toLocaleString()\n\t\t\t );\n\treturn (\n\t\t<div className=\"editor-post-content-information\">\n\t\t\t<Text>\n\t\t\t\t{ sprintf(\n\t\t\t\t\t/* translators: 1: How many words a post has. 2: the number of minutes to read the post (e.g. 130 words, 2 minutes read time.) */\n\t\t\t\t\t__( '%1$s, %2$s read time.' ),\n\t\t\t\t\twordsCountText,\n\t\t\t\t\tminutesText\n\t\t\t\t) }\n\t\t\t</Text>\n\t\t</div>\n\t);\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAA2C;AAC3C,kBAA0B;AAC1B,kBAAoC;AACpC,uBAAmC;AACnC,qBAAwB;AACxB,uBAAmC;AAKnC,mBAAqC;AACrC,yBAAuB;AACvB,uBAGO;AAuEJ;AApEH,IAAM,uBAAuB;AAGd,SAAR,yBAA0C;AAChD,QAAM,EAAE,YAAY,QAAI,uBAAW,CAAE,WAAY;AAChD,UAAM,EAAE,wBAAwB,oBAAoB,iBAAiB,IACpE,OAAQ,aAAAA,KAAY;AACrB,UAAM,EAAE,oBAAoB,gBAAgB,QAAI;AAAA,MAC/C,OAAQ,aAAAA,KAAY;AAAA,IACrB;A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["editorStore", "coreStore", "wordCount", "Text"]
7
7
  }
@@ -34,14 +34,13 @@ function PostLastEditedPanel() {
34
34
  (select) => select(import_store.store).getEditedPostAttribute("modified"),
35
35
  []
36
36
  );
37
- const lastEditedText = modified && (0, import_i18n.sprintf)(
37
+ if (!modified) {
38
+ return null;
39
+ }
40
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "editor-post-last-edited-panel", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.__experimentalText, { children: (0, import_i18n.sprintf)(
38
41
  // translators: %s: Human-readable time difference, e.g. "2 days ago".
39
42
  (0, import_i18n.__)("Last edited %s."),
40
43
  (0, import_date.humanTimeDiff)(modified)
41
- );
42
- if (!lastEditedText) {
43
- return null;
44
- }
45
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "editor-post-last-edited-panel", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.__experimentalText, { children: lastEditedText }) });
44
+ ) }) });
46
45
  }
47
46
  //# sourceMappingURL=index.cjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/post-last-edited-panel/index.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __experimentalText as Text } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { humanTimeDiff } from '@wordpress/date';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport default function PostLastEditedPanel() {\n\tconst modified = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).getEditedPostAttribute( 'modified' ),\n\t\t[]\n\t);\n\tconst lastEditedText =\n\t\tmodified &&\n\t\tsprintf(\n\t\t\t// translators: %s: Human-readable time difference, e.g. \"2 days ago\".\n\t\t\t__( 'Last edited %s.' ),\n\t\t\thumanTimeDiff( modified )\n\t\t);\n\tif ( ! lastEditedText ) {\n\t\treturn null;\n\t}\n\treturn (\n\t\t<div className=\"editor-post-last-edited-panel\">\n\t\t\t<Text>{ lastEditedText }</Text>\n\t\t</div>\n\t);\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAA2C;AAC3C,kBAA0B;AAC1B,kBAA4B;AAC5B,kBAA8B;AAK9B,mBAAqC;AAoBlC;AAlBY,SAAR,sBAAuC;AAC7C,QAAM,eAAW;AAAA,IAChB,CAAE,WACD,OAAQ,aAAAA,KAAY,EAAE,uBAAwB,UAAW;AAAA,IAC1D,CAAC;AAAA,EACF;AACA,QAAM,iBACL,gBACA;AAAA;AAAA,QAEC,gBAAI,iBAAkB;AAAA,QACtB,2BAAe,QAAS;AAAA,EACzB;AACD,MAAK,CAAE,gBAAiB;AACvB,WAAO;AAAA,EACR;AACA,SACC,4CAAC,SAAI,WAAU,iCACd,sDAAC,kBAAAC,oBAAA,EAAO,0BAAgB,GACzB;AAEF;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __experimentalText as Text } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { humanTimeDiff } from '@wordpress/date';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport default function PostLastEditedPanel() {\n\tconst modified = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).getEditedPostAttribute( 'modified' ),\n\t\t[]\n\t);\n\tif ( ! modified ) {\n\t\treturn null;\n\t}\n\treturn (\n\t\t<div className=\"editor-post-last-edited-panel\">\n\t\t\t<Text>\n\t\t\t\t{ sprintf(\n\t\t\t\t\t// translators: %s: Human-readable time difference, e.g. \"2 days ago\".\n\t\t\t\t\t__( 'Last edited %s.' ),\n\t\t\t\t\thumanTimeDiff( modified )\n\t\t\t\t) }\n\t\t\t</Text>\n\t\t</div>\n\t);\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAA2C;AAC3C,kBAA0B;AAC1B,kBAA4B;AAC5B,kBAA8B;AAK9B,mBAAqC;AAalC;AAXY,SAAR,sBAAuC;AAC7C,QAAM,eAAW;AAAA,IAChB,CAAE,WACD,OAAQ,aAAAA,KAAY,EAAE,uBAAwB,UAAW;AAAA,IAC1D,CAAC;AAAA,EACF;AACA,MAAK,CAAE,UAAW;AACjB,WAAO;AAAA,EACR;AACA,SACC,4CAAC,SAAI,WAAU,iCACd,sDAAC,kBAAAC,oBAAA,EACE;AAAA;AAAA,QAED,gBAAI,iBAAkB;AAAA,QACtB,2BAAe,QAAS;AAAA,EACzB,GACD,GACD;AAEF;",
6
6
  "names": ["editorStore", "Text"]
7
7
  }
@@ -38,10 +38,10 @@ var import_i18n = require("@wordpress/i18n");
38
38
  var import_components = require("@wordpress/components");
39
39
  var import_data = require("@wordpress/data");
40
40
  var import_icons = require("@wordpress/icons");
41
- var import_url = require("@wordpress/url");
42
41
  var import_check = __toESM(require("./check.cjs"));
43
42
  var import_post_panel_row = __toESM(require("../post-panel-row/index.cjs"));
44
43
  var import_store = require("../../store/index.cjs");
44
+ var import_lock_unlock = require("../../lock-unlock.cjs");
45
45
  var import_jsx_runtime = require("react/jsx-runtime");
46
46
  function usePostLastRevisionInfo() {
47
47
  return (0, import_data.useSelect)((select) => {
@@ -54,13 +54,12 @@ function usePostLastRevisionInfo() {
54
54
  }
55
55
  function PostLastRevision() {
56
56
  const { lastRevisionId, revisionsCount } = usePostLastRevisionInfo();
57
+ const { setCurrentRevisionId } = (0, import_lock_unlock.unlock)((0, import_data.useDispatch)(import_store.store));
57
58
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_check.default, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
58
59
  import_components.Button,
59
60
  {
60
61
  __next40pxDefaultSize: true,
61
- href: (0, import_url.addQueryArgs)("revision.php", {
62
- revision: lastRevisionId
63
- }),
62
+ onClick: () => setCurrentRevisionId(lastRevisionId),
64
63
  className: "editor-post-last-revision__title",
65
64
  icon: import_icons.backup,
66
65
  iconPosition: "right",
@@ -74,12 +73,11 @@ function PostLastRevision() {
74
73
  }
75
74
  function PrivatePostLastRevision() {
76
75
  const { lastRevisionId, revisionsCount } = usePostLastRevisionInfo();
76
+ const { setCurrentRevisionId } = (0, import_lock_unlock.unlock)((0, import_data.useDispatch)(import_store.store));
77
77
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_check.default, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_post_panel_row.default, { label: (0, import_i18n.__)("Revisions"), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
78
78
  import_components.Button,
79
79
  {
80
- href: (0, import_url.addQueryArgs)("revision.php", {
81
- revision: lastRevisionId
82
- }),
80
+ onClick: () => setCurrentRevisionId(lastRevisionId),
83
81
  className: "editor-private-post-last-revision__button",
84
82
  text: revisionsCount,
85
83
  variant: "tertiary",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/post-last-revision/index.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { sprintf, __ } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { backup } from '@wordpress/icons';\nimport { addQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport PostLastRevisionCheck from './check';\nimport PostPanelRow from '../post-panel-row';\nimport { store as editorStore } from '../../store';\n\nfunction usePostLastRevisionInfo() {\n\treturn useSelect( ( select ) => {\n\t\tconst { getCurrentPostLastRevisionId, getCurrentPostRevisionsCount } =\n\t\t\tselect( editorStore );\n\t\treturn {\n\t\t\tlastRevisionId: getCurrentPostLastRevisionId(),\n\t\t\trevisionsCount: getCurrentPostRevisionsCount(),\n\t\t};\n\t}, [] );\n}\n\n/**\n * Renders the component for displaying the last revision of a post.\n *\n * @return {React.ReactNode} The rendered component.\n */\nfunction PostLastRevision() {\n\tconst { lastRevisionId, revisionsCount } = usePostLastRevisionInfo();\n\n\treturn (\n\t\t<PostLastRevisionCheck>\n\t\t\t<Button\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\thref={ addQueryArgs( 'revision.php', {\n\t\t\t\t\trevision: lastRevisionId,\n\t\t\t\t} ) }\n\t\t\t\tclassName=\"editor-post-last-revision__title\"\n\t\t\t\ticon={ backup }\n\t\t\t\ticonPosition=\"right\"\n\t\t\t\ttext={ sprintf(\n\t\t\t\t\t/* translators: %s: number of revisions. */\n\t\t\t\t\t__( 'Revisions (%s)' ),\n\t\t\t\t\trevisionsCount\n\t\t\t\t) }\n\t\t\t/>\n\t\t</PostLastRevisionCheck>\n\t);\n}\n\nexport function PrivatePostLastRevision() {\n\tconst { lastRevisionId, revisionsCount } = usePostLastRevisionInfo();\n\treturn (\n\t\t<PostLastRevisionCheck>\n\t\t\t<PostPanelRow label={ __( 'Revisions' ) }>\n\t\t\t\t<Button\n\t\t\t\t\thref={ addQueryArgs( 'revision.php', {\n\t\t\t\t\t\trevision: lastRevisionId,\n\t\t\t\t\t} ) }\n\t\t\t\t\tclassName=\"editor-private-post-last-revision__button\"\n\t\t\t\t\ttext={ revisionsCount }\n\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t/>\n\t\t\t</PostPanelRow>\n\t\t</PostLastRevisionCheck>\n\t);\n}\n\nexport default PostLastRevision;\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAA4B;AAC5B,wBAAuB;AACvB,kBAA0B;AAC1B,mBAAuB;AACvB,iBAA6B;AAK7B,mBAAkC;AAClC,4BAAyB;AACzB,mBAAqC;AAuBlC;AArBH,SAAS,0BAA0B;AAClC,aAAO,uBAAW,CAAE,WAAY;AAC/B,UAAM,EAAE,8BAA8B,6BAA6B,IAClE,OAAQ,aAAAA,KAAY;AACrB,WAAO;AAAA,MACN,gBAAgB,6BAA6B;AAAA,MAC7C,gBAAgB,6BAA6B;AAAA,IAC9C;AAAA,EACD,GAAG,CAAC,CAAE;AACP;AAOA,SAAS,mBAAmB;AAC3B,QAAM,EAAE,gBAAgB,eAAe,IAAI,wBAAwB;AAEnE,SACC,4CAAC,aAAAC,SAAA,EACA;AAAA,IAAC;AAAA;AAAA,MACA,uBAAqB;AAAA,MACrB,UAAO,yBAAc,gBAAgB;AAAA,QACpC,UAAU;AAAA,MACX,CAAE;AAAA,MACF,WAAU;AAAA,MACV,MAAO;AAAA,MACP,cAAa;AAAA,MACb,UAAO;AAAA;AAAA,YAEN,gBAAI,gBAAiB;AAAA,QACrB;AAAA,MACD;AAAA;AAAA,EACD,GACD;AAEF;AAEO,SAAS,0BAA0B;AACzC,QAAM,EAAE,gBAAgB,eAAe,IAAI,wBAAwB;AACnE,SACC,4CAAC,aAAAA,SAAA,EACA,sDAAC,sBAAAC,SAAA,EAAa,WAAQ,gBAAI,WAAY,GACrC;AAAA,IAAC;AAAA;AAAA,MACA,UAAO,yBAAc,gBAAgB;AAAA,QACpC,UAAU;AAAA,MACX,CAAE;AAAA,MACF,WAAU;AAAA,MACV,MAAO;AAAA,MACP,SAAQ;AAAA,MACR,MAAK;AAAA;AAAA,EACN,GACD,GACD;AAEF;AAEA,IAAO,6BAAQ;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { sprintf, __ } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { backup } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport PostLastRevisionCheck from './check';\nimport PostPanelRow from '../post-panel-row';\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nfunction usePostLastRevisionInfo() {\n\treturn useSelect( ( select ) => {\n\t\tconst { getCurrentPostLastRevisionId, getCurrentPostRevisionsCount } =\n\t\t\tselect( editorStore );\n\t\treturn {\n\t\t\tlastRevisionId: getCurrentPostLastRevisionId(),\n\t\t\trevisionsCount: getCurrentPostRevisionsCount(),\n\t\t};\n\t}, [] );\n}\n\n/**\n * Renders the component for displaying the last revision of a post.\n *\n * @return {React.ReactNode} The rendered component.\n */\nfunction PostLastRevision() {\n\tconst { lastRevisionId, revisionsCount } = usePostLastRevisionInfo();\n\tconst { setCurrentRevisionId } = unlock( useDispatch( editorStore ) );\n\n\treturn (\n\t\t<PostLastRevisionCheck>\n\t\t\t<Button\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tonClick={ () => setCurrentRevisionId( lastRevisionId ) }\n\t\t\t\tclassName=\"editor-post-last-revision__title\"\n\t\t\t\ticon={ backup }\n\t\t\t\ticonPosition=\"right\"\n\t\t\t\ttext={ sprintf(\n\t\t\t\t\t/* translators: %s: number of revisions. */\n\t\t\t\t\t__( 'Revisions (%s)' ),\n\t\t\t\t\trevisionsCount\n\t\t\t\t) }\n\t\t\t/>\n\t\t</PostLastRevisionCheck>\n\t);\n}\n\nexport function PrivatePostLastRevision() {\n\tconst { lastRevisionId, revisionsCount } = usePostLastRevisionInfo();\n\tconst { setCurrentRevisionId } = unlock( useDispatch( editorStore ) );\n\n\treturn (\n\t\t<PostLastRevisionCheck>\n\t\t\t<PostPanelRow label={ __( 'Revisions' ) }>\n\t\t\t\t<Button\n\t\t\t\t\tonClick={ () => setCurrentRevisionId( lastRevisionId ) }\n\t\t\t\t\tclassName=\"editor-private-post-last-revision__button\"\n\t\t\t\t\ttext={ revisionsCount }\n\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t/>\n\t\t\t</PostPanelRow>\n\t\t</PostLastRevisionCheck>\n\t);\n}\n\nexport default PostLastRevision;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAA4B;AAC5B,wBAAuB;AACvB,kBAAuC;AACvC,mBAAuB;AAKvB,mBAAkC;AAClC,4BAAyB;AACzB,mBAAqC;AACrC,yBAAuB;AAwBpB;AAtBH,SAAS,0BAA0B;AAClC,aAAO,uBAAW,CAAE,WAAY;AAC/B,UAAM,EAAE,8BAA8B,6BAA6B,IAClE,OAAQ,aAAAA,KAAY;AACrB,WAAO;AAAA,MACN,gBAAgB,6BAA6B;AAAA,MAC7C,gBAAgB,6BAA6B;AAAA,IAC9C;AAAA,EACD,GAAG,CAAC,CAAE;AACP;AAOA,SAAS,mBAAmB;AAC3B,QAAM,EAAE,gBAAgB,eAAe,IAAI,wBAAwB;AACnE,QAAM,EAAE,qBAAqB,QAAI,+BAAQ,yBAAa,aAAAA,KAAY,CAAE;AAEpE,SACC,4CAAC,aAAAC,SAAA,EACA;AAAA,IAAC;AAAA;AAAA,MACA,uBAAqB;AAAA,MACrB,SAAU,MAAM,qBAAsB,cAAe;AAAA,MACrD,WAAU;AAAA,MACV,MAAO;AAAA,MACP,cAAa;AAAA,MACb,UAAO;AAAA;AAAA,YAEN,gBAAI,gBAAiB;AAAA,QACrB;AAAA,MACD;AAAA;AAAA,EACD,GACD;AAEF;AAEO,SAAS,0BAA0B;AACzC,QAAM,EAAE,gBAAgB,eAAe,IAAI,wBAAwB;AACnE,QAAM,EAAE,qBAAqB,QAAI,+BAAQ,yBAAa,aAAAD,KAAY,CAAE;AAEpE,SACC,4CAAC,aAAAC,SAAA,EACA,sDAAC,sBAAAC,SAAA,EAAa,WAAQ,gBAAI,WAAY,GACrC;AAAA,IAAC;AAAA;AAAA,MACA,SAAU,MAAM,qBAAsB,cAAe;AAAA,MACrD,WAAU;AAAA,MACV,MAAO;AAAA,MACP,SAAQ;AAAA,MACR,MAAK;AAAA;AAAA,EACN,GACD,GACD;AAEF;AAEA,IAAO,6BAAQ;",
6
6
  "names": ["editorStore", "PostLastRevisionCheck", "PostPanelRow"]
7
7
  }
@@ -27,6 +27,7 @@ var import_i18n = require("@wordpress/i18n");
27
27
  var import_data = require("@wordpress/data");
28
28
  var import_compose = require("@wordpress/compose");
29
29
  var import_store = require("../../store/index.cjs");
30
+ var import_constants = require("../../store/constants.cjs");
30
31
  function PublishButtonLabel() {
31
32
  const isSmallerThanMediumViewport = (0, import_compose.useViewportMatch)("medium", "<");
32
33
  const {
@@ -38,7 +39,8 @@ function PublishButtonLabel() {
38
39
  isAutosaving,
39
40
  hasNonPostEntityChanges,
40
41
  postStatusHasChanged,
41
- postStatus
42
+ postStatus,
43
+ postType
42
44
  } = (0, import_data.useSelect)((select) => {
43
45
  const {
44
46
  isCurrentPostPublished,
@@ -70,6 +72,9 @@ function PublishButtonLabel() {
70
72
  return (0, import_i18n.__)("Saving\u2026");
71
73
  }
72
74
  if (!hasPublishAction) {
75
+ if (postType === import_constants.ATTACHMENT_POST_TYPE && window?.__experimentalMediaEditor) {
76
+ return (0, import_i18n.__)("Save");
77
+ }
73
78
  return isSmallerThanMediumViewport ? (0, import_i18n.__)("Publish") : (0, import_i18n.__)("Submit for Review");
74
79
  }
75
80
  if (hasNonPostEntityChanges || isPublished || postStatusHasChanged && !["future", "publish"].includes(postStatus) || !postStatusHasChanged && postStatus === "future") {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/post-publish-button/label.js"],
4
- "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\n/**\n * Renders the label for the publish button.\n *\n * @return {string} The label for the publish button.\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\u2026' );\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\u2026' );\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 ) {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CAAE,wBAAwB,eAAe,UAC1C;AACD,eAAO,gBAAI,MAAO;AAAA,EACnB;AACA,MAAK,kBAAmB;AACvB,eAAO,gBAAI,UAAW;AAAA,EACvB;AACA,aAAO,gBAAI,SAAU;AACtB;",
4
+ "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';\nimport { ATTACHMENT_POST_TYPE } from '../../store/constants';\n\n/**\n * Renders the label for the publish button.\n *\n * @return {string} The label for the publish button.\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\tpostType,\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\u2026' );\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\u2026' );\n\t}\n\tif ( ! hasPublishAction ) {\n\t\t// For attachments, always show \"Save\" since they don't have a publish workflow\n\t\tif (\n\t\t\tpostType === ATTACHMENT_POST_TYPE &&\n\t\t\twindow?.__experimentalMediaEditor\n\t\t) {\n\t\t\treturn __( 'Save' );\n\t\t}\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"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AACnB,kBAA0B;AAC1B,qBAAiC;AAKjC,mBAAqC;AACrC,uBAAqC;AAOtB,SAAR,qBAAsC;AAC5C,QAAM,kCAA8B,iCAAkB,UAAU,GAAI;AACpE,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,UAAM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