@wordpress/editor 13.19.2 → 13.20.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 (274) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/README.md +6 -6
  3. package/build/components/autocompleters/user.js +5 -4
  4. package/build/components/autocompleters/user.js.map +1 -1
  5. package/build/components/deprecated.js +3 -2
  6. package/build/components/deprecated.js.map +1 -1
  7. package/build/components/document-outline/index.js +11 -11
  8. package/build/components/document-outline/index.js.map +1 -1
  9. package/build/components/document-outline/item.js +6 -6
  10. package/build/components/document-outline/item.js.map +1 -1
  11. package/build/components/editor-help/add-blocks.native.js +5 -5
  12. package/build/components/editor-help/add-blocks.native.js.map +1 -1
  13. package/build/components/editor-help/customize-blocks.native.js +5 -5
  14. package/build/components/editor-help/customize-blocks.native.js.map +1 -1
  15. package/build/components/editor-help/help-detail-navigation-screen.native.js +8 -7
  16. package/build/components/editor-help/help-detail-navigation-screen.native.js.map +1 -1
  17. package/build/components/editor-help/help-get-support-button.native.js +3 -3
  18. package/build/components/editor-help/help-get-support-button.native.js.map +1 -1
  19. package/build/components/editor-help/help-section-title.native.js +3 -3
  20. package/build/components/editor-help/help-section-title.native.js.map +1 -1
  21. package/build/components/editor-help/help-topic-row.native.js +3 -3
  22. package/build/components/editor-help/help-topic-row.native.js.map +1 -1
  23. package/build/components/editor-help/icon-move-blocks.native.js +3 -3
  24. package/build/components/editor-help/icon-move-blocks.native.js.map +1 -1
  25. package/build/components/editor-help/index.native.js +19 -19
  26. package/build/components/editor-help/index.native.js.map +1 -1
  27. package/build/components/editor-help/intro-to-blocks.native.js +15 -15
  28. package/build/components/editor-help/intro-to-blocks.native.js.map +1 -1
  29. package/build/components/editor-help/move-blocks.native.js +9 -9
  30. package/build/components/editor-help/move-blocks.native.js.map +1 -1
  31. package/build/components/editor-help/remove-blocks.native.js +4 -4
  32. package/build/components/editor-help/remove-blocks.native.js.map +1 -1
  33. package/build/components/editor-help/view-sections.native.js +8 -8
  34. package/build/components/editor-help/view-sections.native.js.map +1 -1
  35. package/build/components/editor-history/redo.js +3 -2
  36. package/build/components/editor-history/redo.js.map +1 -1
  37. package/build/components/editor-history/undo.js +3 -2
  38. package/build/components/editor-history/undo.js.map +1 -1
  39. package/build/components/editor-notices/index.js +4 -4
  40. package/build/components/editor-notices/index.js.map +1 -1
  41. package/build/components/editor-snackbars/index.js +2 -2
  42. package/build/components/editor-snackbars/index.js.map +1 -1
  43. package/build/components/entities-saved-states/entity-record-item.js +3 -3
  44. package/build/components/entities-saved-states/entity-record-item.js.map +1 -1
  45. package/build/components/entities-saved-states/entity-type-list.js +4 -4
  46. package/build/components/entities-saved-states/entity-type-list.js.map +1 -1
  47. package/build/components/entities-saved-states/index.js +10 -9
  48. package/build/components/entities-saved-states/index.js.map +1 -1
  49. package/build/components/error-boundary/index.js +5 -4
  50. package/build/components/error-boundary/index.js.map +1 -1
  51. package/build/components/global-keyboard-shortcuts/register-shortcuts.js +2 -1
  52. package/build/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
  53. package/build/components/local-autosave-monitor/index.js +2 -1
  54. package/build/components/local-autosave-monitor/index.js.map +1 -1
  55. package/build/components/page-attributes/order.js +5 -4
  56. package/build/components/page-attributes/order.js.map +1 -1
  57. package/build/components/page-attributes/parent.js +3 -2
  58. package/build/components/page-attributes/parent.js.map +1 -1
  59. package/build/components/post-author/check.js +2 -2
  60. package/build/components/post-author/check.js.map +1 -1
  61. package/build/components/post-author/combobox.js +3 -2
  62. package/build/components/post-author/combobox.js.map +1 -1
  63. package/build/components/post-author/index.js +3 -3
  64. package/build/components/post-author/index.js.map +1 -1
  65. package/build/components/post-author/select.js +3 -2
  66. package/build/components/post-author/select.js.map +1 -1
  67. package/build/components/post-comments/index.js +2 -2
  68. package/build/components/post-comments/index.js.map +1 -1
  69. package/build/components/post-excerpt/check.js +2 -2
  70. package/build/components/post-excerpt/check.js.map +1 -1
  71. package/build/components/post-excerpt/index.js +4 -4
  72. package/build/components/post-excerpt/index.js.map +1 -1
  73. package/build/components/post-featured-image/check.js +3 -3
  74. package/build/components/post-featured-image/check.js.map +1 -1
  75. package/build/components/post-featured-image/index.js +15 -14
  76. package/build/components/post-featured-image/index.js.map +1 -1
  77. package/build/components/post-format/check.js +2 -2
  78. package/build/components/post-format/check.js.map +1 -1
  79. package/build/components/post-format/index.js +5 -5
  80. package/build/components/post-format/index.js.map +1 -1
  81. package/build/components/post-last-revision/check.js +2 -2
  82. package/build/components/post-last-revision/check.js.map +1 -1
  83. package/build/components/post-last-revision/index.js +2 -2
  84. package/build/components/post-last-revision/index.js.map +1 -1
  85. package/build/components/post-locked-modal/index.js +14 -13
  86. package/build/components/post-locked-modal/index.js.map +1 -1
  87. package/build/components/post-pending-status/index.js +2 -2
  88. package/build/components/post-pending-status/index.js.map +1 -1
  89. package/build/components/post-pingbacks/index.js +2 -2
  90. package/build/components/post-pingbacks/index.js.map +1 -1
  91. package/build/components/post-preview-button/index.js +8 -7
  92. package/build/components/post-preview-button/index.js.map +1 -1
  93. package/build/components/post-publish-button/index.js +4 -3
  94. package/build/components/post-publish-button/index.js.map +1 -1
  95. package/build/components/post-publish-panel/index.js +13 -12
  96. package/build/components/post-publish-panel/index.js.map +1 -1
  97. package/build/components/post-publish-panel/maybe-category-panel.js +5 -4
  98. package/build/components/post-publish-panel/maybe-category-panel.js.map +1 -1
  99. package/build/components/post-publish-panel/maybe-post-format-panel.js +5 -5
  100. package/build/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
  101. package/build/components/post-publish-panel/maybe-tags-panel.js +6 -5
  102. package/build/components/post-publish-panel/maybe-tags-panel.js.map +1 -1
  103. package/build/components/post-publish-panel/maybe-upload-media.js +9 -8
  104. package/build/components/post-publish-panel/maybe-upload-media.js.map +1 -1
  105. package/build/components/post-publish-panel/postpublish.js +15 -14
  106. package/build/components/post-publish-panel/postpublish.js.map +1 -1
  107. package/build/components/post-publish-panel/prepublish.js +15 -15
  108. package/build/components/post-publish-panel/prepublish.js.map +1 -1
  109. package/build/components/post-saved-state/index.js +5 -4
  110. package/build/components/post-saved-state/index.js.map +1 -1
  111. package/build/components/post-schedule/index.js +3 -2
  112. package/build/components/post-schedule/index.js.map +1 -1
  113. package/build/components/post-slug/check.js +2 -2
  114. package/build/components/post-slug/check.js.map +1 -1
  115. package/build/components/post-slug/index.js +3 -2
  116. package/build/components/post-slug/index.js.map +1 -1
  117. package/build/components/post-sticky/check.js +12 -14
  118. package/build/components/post-sticky/check.js.map +1 -1
  119. package/build/components/post-sticky/index.js +14 -24
  120. package/build/components/post-sticky/index.js.map +1 -1
  121. package/build/components/post-switch-to-draft-button/index.js +35 -43
  122. package/build/components/post-switch-to-draft-button/index.js.map +1 -1
  123. package/build/components/post-sync-status/index.js +10 -9
  124. package/build/components/post-sync-status/index.js.map +1 -1
  125. package/build/components/post-taxonomies/flat-term-selector.js +4 -3
  126. package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
  127. package/build/components/post-taxonomies/hierarchical-term-selector.js +15 -14
  128. package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
  129. package/build/components/post-taxonomies/index.js +3 -2
  130. package/build/components/post-taxonomies/index.js.map +1 -1
  131. package/build/components/post-taxonomies/most-used-terms.js +6 -6
  132. package/build/components/post-taxonomies/most-used-terms.js.map +1 -1
  133. package/build/components/post-template/index.js +2 -2
  134. package/build/components/post-template/index.js.map +1 -1
  135. package/build/components/post-text-editor/index.js +4 -3
  136. package/build/components/post-text-editor/index.js.map +1 -1
  137. package/build/components/post-title/index.js +4 -3
  138. package/build/components/post-title/index.js.map +1 -1
  139. package/build/components/post-title/index.native.js +4 -3
  140. package/build/components/post-title/index.native.js.map +1 -1
  141. package/build/components/post-trash/index.js +14 -4
  142. package/build/components/post-trash/index.js.map +1 -1
  143. package/build/components/post-type-support-check/index.js +2 -2
  144. package/build/components/post-type-support-check/index.js.map +1 -1
  145. package/build/components/post-url/index.js +11 -10
  146. package/build/components/post-url/index.js.map +1 -1
  147. package/build/components/post-visibility/index.js +17 -16
  148. package/build/components/post-visibility/index.js.map +1 -1
  149. package/build/components/provider/index.js +7 -6
  150. package/build/components/provider/index.js.map +1 -1
  151. package/build/components/provider/index.native.js +4 -3
  152. package/build/components/provider/index.native.js.map +1 -1
  153. package/build/components/provider/with-registry-provider.js +4 -3
  154. package/build/components/provider/with-registry-provider.js.map +1 -1
  155. package/build/components/table-of-contents/index.js +5 -4
  156. package/build/components/table-of-contents/index.js.map +1 -1
  157. package/build/components/table-of-contents/panel.js +15 -15
  158. package/build/components/table-of-contents/panel.js.map +1 -1
  159. package/build/components/template-validation-notice/index.js +2 -2
  160. package/build/components/template-validation-notice/index.js.map +1 -1
  161. package/build/components/time-to-read/index.js +5 -4
  162. package/build/components/time-to-read/index.js.map +1 -1
  163. package/build/components/unsaved-changes-warning/index.js +1 -1
  164. package/build/components/unsaved-changes-warning/index.js.map +1 -1
  165. package/build/components/word-count/index.js +2 -2
  166. package/build/components/word-count/index.js.map +1 -1
  167. package/build/hooks/custom-sources-backwards-compatibility.js +3 -2
  168. package/build/hooks/custom-sources-backwards-compatibility.js.map +1 -1
  169. package/build-module/components/autocompleters/user.js +1 -1
  170. package/build-module/components/deprecated.js +1 -1
  171. package/build-module/components/document-outline/index.js +1 -1
  172. package/build-module/components/document-outline/item.js +1 -1
  173. package/build-module/components/editor-help/add-blocks.native.js +1 -1
  174. package/build-module/components/editor-help/customize-blocks.native.js +1 -1
  175. package/build-module/components/editor-help/help-detail-navigation-screen.native.js +1 -1
  176. package/build-module/components/editor-help/help-get-support-button.native.js +1 -1
  177. package/build-module/components/editor-help/help-section-title.native.js +1 -1
  178. package/build-module/components/editor-help/help-topic-row.native.js +1 -1
  179. package/build-module/components/editor-help/icon-move-blocks.native.js +1 -1
  180. package/build-module/components/editor-help/index.native.js +1 -1
  181. package/build-module/components/editor-help/intro-to-blocks.native.js +1 -1
  182. package/build-module/components/editor-help/move-blocks.native.js +1 -1
  183. package/build-module/components/editor-help/remove-blocks.native.js +1 -1
  184. package/build-module/components/editor-help/view-sections.native.js +1 -1
  185. package/build-module/components/editor-history/redo.js +1 -1
  186. package/build-module/components/editor-history/undo.js +1 -1
  187. package/build-module/components/editor-notices/index.js +1 -1
  188. package/build-module/components/editor-snackbars/index.js +1 -1
  189. package/build-module/components/entities-saved-states/entity-record-item.js +1 -1
  190. package/build-module/components/entities-saved-states/entity-type-list.js +1 -1
  191. package/build-module/components/entities-saved-states/index.js +1 -1
  192. package/build-module/components/error-boundary/index.js +1 -1
  193. package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js +1 -1
  194. package/build-module/components/local-autosave-monitor/index.js +1 -1
  195. package/build-module/components/page-attributes/order.js +1 -1
  196. package/build-module/components/page-attributes/parent.js +1 -1
  197. package/build-module/components/post-author/check.js +1 -1
  198. package/build-module/components/post-author/combobox.js +1 -1
  199. package/build-module/components/post-author/index.js +1 -1
  200. package/build-module/components/post-author/select.js +1 -1
  201. package/build-module/components/post-comments/index.js +1 -1
  202. package/build-module/components/post-excerpt/check.js +1 -1
  203. package/build-module/components/post-excerpt/index.js +1 -1
  204. package/build-module/components/post-featured-image/check.js +1 -1
  205. package/build-module/components/post-featured-image/index.js +1 -1
  206. package/build-module/components/post-format/check.js +1 -1
  207. package/build-module/components/post-format/index.js +1 -1
  208. package/build-module/components/post-last-revision/check.js +1 -1
  209. package/build-module/components/post-last-revision/index.js +1 -1
  210. package/build-module/components/post-locked-modal/index.js +1 -1
  211. package/build-module/components/post-pending-status/index.js +1 -1
  212. package/build-module/components/post-pingbacks/index.js +1 -1
  213. package/build-module/components/post-preview-button/index.js +1 -1
  214. package/build-module/components/post-publish-button/index.js +1 -1
  215. package/build-module/components/post-publish-panel/index.js +1 -1
  216. package/build-module/components/post-publish-panel/maybe-category-panel.js +1 -1
  217. package/build-module/components/post-publish-panel/maybe-post-format-panel.js +1 -1
  218. package/build-module/components/post-publish-panel/maybe-tags-panel.js +1 -1
  219. package/build-module/components/post-publish-panel/maybe-upload-media.js +1 -1
  220. package/build-module/components/post-publish-panel/postpublish.js +1 -1
  221. package/build-module/components/post-publish-panel/prepublish.js +1 -1
  222. package/build-module/components/post-saved-state/index.js +2 -2
  223. package/build-module/components/post-saved-state/index.js.map +1 -1
  224. package/build-module/components/post-schedule/index.js +1 -1
  225. package/build-module/components/post-slug/check.js +1 -1
  226. package/build-module/components/post-slug/index.js +1 -1
  227. package/build-module/components/post-sticky/check.js +13 -13
  228. package/build-module/components/post-sticky/check.js.map +1 -1
  229. package/build-module/components/post-sticky/index.js +13 -21
  230. package/build-module/components/post-sticky/index.js.map +1 -1
  231. package/build-module/components/post-switch-to-draft-button/index.js +32 -40
  232. package/build-module/components/post-switch-to-draft-button/index.js.map +1 -1
  233. package/build-module/components/post-sync-status/index.js +1 -1
  234. package/build-module/components/post-taxonomies/flat-term-selector.js +1 -1
  235. package/build-module/components/post-taxonomies/hierarchical-term-selector.js +2 -2
  236. package/build-module/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
  237. package/build-module/components/post-taxonomies/index.js +1 -1
  238. package/build-module/components/post-taxonomies/most-used-terms.js +1 -1
  239. package/build-module/components/post-template/index.js +1 -1
  240. package/build-module/components/post-text-editor/index.js +1 -1
  241. package/build-module/components/post-title/index.js +1 -1
  242. package/build-module/components/post-title/index.native.js +1 -1
  243. package/build-module/components/post-trash/index.js +15 -5
  244. package/build-module/components/post-trash/index.js.map +1 -1
  245. package/build-module/components/post-type-support-check/index.js +2 -2
  246. package/build-module/components/post-type-support-check/index.js.map +1 -1
  247. package/build-module/components/post-url/index.js +1 -1
  248. package/build-module/components/post-visibility/index.js +1 -1
  249. package/build-module/components/provider/index.js +1 -1
  250. package/build-module/components/provider/index.native.js +1 -1
  251. package/build-module/components/provider/with-registry-provider.js +1 -1
  252. package/build-module/components/table-of-contents/index.js +1 -1
  253. package/build-module/components/table-of-contents/panel.js +1 -1
  254. package/build-module/components/template-validation-notice/index.js +1 -1
  255. package/build-module/components/time-to-read/index.js +1 -1
  256. package/build-module/components/unsaved-changes-warning/index.js +1 -1
  257. package/build-module/components/unsaved-changes-warning/index.js.map +1 -1
  258. package/build-module/components/word-count/index.js +1 -1
  259. package/build-module/hooks/custom-sources-backwards-compatibility.js +1 -1
  260. package/build-style/style-rtl.css +1 -1
  261. package/build-style/style.css +1 -1
  262. package/package.json +31 -31
  263. package/src/components/post-featured-image/README.md +3 -3
  264. package/src/components/post-saved-state/index.js +1 -1
  265. package/src/components/post-sticky/check.js +10 -13
  266. package/src/components/post-sticky/index.js +10 -20
  267. package/src/components/post-sticky/test/index.js +31 -16
  268. package/src/components/post-switch-to-draft-button/index.js +20 -35
  269. package/src/components/post-taxonomies/README.md +2 -2
  270. package/src/components/post-taxonomies/hierarchical-term-selector.js +1 -1
  271. package/src/components/post-trash/index.js +34 -11
  272. package/src/components/post-type-support-check/README.md +1 -1
  273. package/src/components/post-type-support-check/index.js +2 -2
  274. package/src/components/unsaved-changes-warning/index.js +1 -1
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = void 0;
8
- var _element = require("@wordpress/element");
8
+ var _react = require("react");
9
9
  var _i18n = require("@wordpress/i18n");
10
10
  var _components = require("@wordpress/components");
11
11
  var _data = require("@wordpress/data");
@@ -60,13 +60,13 @@ function PostPublishPanelPrepublish({
60
60
  siteHome: siteData.home && (0, _url.filterURLForDisplay)(siteData.home)
61
61
  };
62
62
  }, []);
63
- let siteIcon = (0, _element.createElement)(_components.Icon, {
63
+ let siteIcon = (0, _react.createElement)(_components.Icon, {
64
64
  className: "components-site-icon",
65
65
  size: "36px",
66
66
  icon: _icons.wordpress
67
67
  });
68
68
  if (siteIconUrl) {
69
- siteIcon = (0, _element.createElement)("img", {
69
+ siteIcon = (0, _react.createElement)("img", {
70
70
  alt: (0, _i18n.__)('Site Icon'),
71
71
  className: "components-site-icon",
72
72
  src: siteIconUrl
@@ -86,29 +86,29 @@ function PostPublishPanelPrepublish({
86
86
  prePublishTitle = (0, _i18n.__)('Are you ready to publish?');
87
87
  prePublishBodyText = (0, _i18n.__)('Double-check your settings before publishing.');
88
88
  }
89
- return (0, _element.createElement)("div", {
89
+ return (0, _react.createElement)("div", {
90
90
  className: "editor-post-publish-panel__prepublish"
91
- }, (0, _element.createElement)("div", null, (0, _element.createElement)("strong", null, prePublishTitle)), (0, _element.createElement)("p", null, prePublishBodyText), (0, _element.createElement)("div", {
91
+ }, (0, _react.createElement)("div", null, (0, _react.createElement)("strong", null, prePublishTitle)), (0, _react.createElement)("p", null, prePublishBodyText), (0, _react.createElement)("div", {
92
92
  className: "components-site-card"
93
- }, siteIcon, (0, _element.createElement)("div", {
93
+ }, siteIcon, (0, _react.createElement)("div", {
94
94
  className: "components-site-info"
95
- }, (0, _element.createElement)("span", {
95
+ }, (0, _react.createElement)("span", {
96
96
  className: "components-site-name"
97
- }, (0, _htmlEntities.decodeEntities)(siteTitle) || (0, _i18n.__)('(Untitled)')), (0, _element.createElement)("span", {
97
+ }, (0, _htmlEntities.decodeEntities)(siteTitle) || (0, _i18n.__)('(Untitled)')), (0, _react.createElement)("span", {
98
98
  className: "components-site-home"
99
- }, siteHome))), (0, _element.createElement)(_maybeUploadMedia.default, null), hasPublishAction && (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_components.PanelBody, {
99
+ }, siteHome))), (0, _react.createElement)(_maybeUploadMedia.default, null), hasPublishAction && (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(_components.PanelBody, {
100
100
  initialOpen: false,
101
- title: [(0, _i18n.__)('Visibility:'), (0, _element.createElement)("span", {
101
+ title: [(0, _i18n.__)('Visibility:'), (0, _react.createElement)("span", {
102
102
  className: "editor-post-publish-panel__link",
103
103
  key: "label"
104
- }, (0, _element.createElement)(_label.default, null))]
105
- }, (0, _element.createElement)(_postVisibility.default, null)), (0, _element.createElement)(_components.PanelBody, {
104
+ }, (0, _react.createElement)(_label.default, null))]
105
+ }, (0, _react.createElement)(_postVisibility.default, null)), (0, _react.createElement)(_components.PanelBody, {
106
106
  initialOpen: false,
107
- title: [(0, _i18n.__)('Publish:'), (0, _element.createElement)("span", {
107
+ title: [(0, _i18n.__)('Publish:'), (0, _react.createElement)("span", {
108
108
  className: "editor-post-publish-panel__link",
109
109
  key: "label"
110
- }, (0, _element.createElement)(_label2.default, null))]
111
- }, (0, _element.createElement)(_postSchedule.default, null))), (0, _element.createElement)(_maybePostFormatPanel.default, null), (0, _element.createElement)(_maybeTagsPanel.default, null), (0, _element.createElement)(_maybeCategoryPanel.default, null), children);
110
+ }, (0, _react.createElement)(_label2.default, null))]
111
+ }, (0, _react.createElement)(_postSchedule.default, null))), (0, _react.createElement)(_maybePostFormatPanel.default, null), (0, _react.createElement)(_maybeTagsPanel.default, null), (0, _react.createElement)(_maybeCategoryPanel.default, null), children);
112
112
  }
113
113
  var _default = PostPublishPanelPrepublish;
114
114
  exports.default = _default;
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","_components","_data","_icons","_url","_coreData","_htmlEntities","_postVisibility","_interopRequireDefault","_label","_postSchedule","_label2","_maybeTagsPanel","_maybePostFormatPanel","_store","_maybeCategoryPanel","_maybeUploadMedia","PostPublishPanelPrepublish","children","isBeingScheduled","isRequestingSiteIcon","hasPublishAction","siteIconUrl","siteTitle","siteHome","useSelect","select","_getCurrentPost$_link","getCurrentPost","isEditedPostBeingScheduled","editorStore","getEntityRecord","isResolving","coreStore","siteData","undefined","_links","site_icon_url","name","home","filterURLForDisplay","siteIcon","_element","createElement","Icon","className","size","icon","wordpress","alt","__","src","prePublishTitle","prePublishBodyText","decodeEntities","default","Fragment","PanelBody","initialOpen","title","key","_default","exports"],"sources":["@wordpress/editor/src/components/post-publish-panel/prepublish.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Icon, PanelBody } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { wordpress } from '@wordpress/icons';\nimport { filterURLForDisplay } from '@wordpress/url';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport PostVisibility from '../post-visibility';\nimport PostVisibilityLabel from '../post-visibility/label';\nimport PostSchedule from '../post-schedule';\nimport PostScheduleLabel from '../post-schedule/label';\nimport MaybeTagsPanel from './maybe-tags-panel';\nimport MaybePostFormatPanel from './maybe-post-format-panel';\nimport { store as editorStore } from '../../store';\nimport MaybeCategoryPanel from './maybe-category-panel';\nimport MaybeUploadMedia from './maybe-upload-media';\n\nfunction PostPublishPanelPrepublish( { children } ) {\n\tconst {\n\t\tisBeingScheduled,\n\t\tisRequestingSiteIcon,\n\t\thasPublishAction,\n\t\tsiteIconUrl,\n\t\tsiteTitle,\n\t\tsiteHome,\n\t} = useSelect( ( select ) => {\n\t\tconst { getCurrentPost, isEditedPostBeingScheduled } =\n\t\t\tselect( editorStore );\n\t\tconst { getEntityRecord, isResolving } = select( coreStore );\n\t\tconst siteData =\n\t\t\tgetEntityRecord( 'root', '__unstableBase', undefined ) || {};\n\n\t\treturn {\n\t\t\thasPublishAction:\n\t\t\t\tgetCurrentPost()._links?.[ 'wp:action-publish' ] ?? false,\n\t\t\tisBeingScheduled: isEditedPostBeingScheduled(),\n\t\t\tisRequestingSiteIcon: isResolving( 'getEntityRecord', [\n\t\t\t\t'root',\n\t\t\t\t'__unstableBase',\n\t\t\t\tundefined,\n\t\t\t] ),\n\t\t\tsiteIconUrl: siteData.site_icon_url,\n\t\t\tsiteTitle: siteData.name,\n\t\t\tsiteHome: siteData.home && filterURLForDisplay( siteData.home ),\n\t\t};\n\t}, [] );\n\n\tlet siteIcon = (\n\t\t<Icon className=\"components-site-icon\" size=\"36px\" icon={ wordpress } />\n\t);\n\n\tif ( siteIconUrl ) {\n\t\tsiteIcon = (\n\t\t\t<img\n\t\t\t\talt={ __( 'Site Icon' ) }\n\t\t\t\tclassName=\"components-site-icon\"\n\t\t\t\tsrc={ siteIconUrl }\n\t\t\t/>\n\t\t);\n\t}\n\n\tif ( isRequestingSiteIcon ) {\n\t\tsiteIcon = null;\n\t}\n\n\tlet prePublishTitle, prePublishBodyText;\n\n\tif ( ! hasPublishAction ) {\n\t\tprePublishTitle = __( 'Are you ready to submit for review?' );\n\t\tprePublishBodyText = __(\n\t\t\t'When you’re ready, submit your work for review, and an Editor will be able to approve it for you.'\n\t\t);\n\t} else if ( isBeingScheduled ) {\n\t\tprePublishTitle = __( 'Are you ready to schedule?' );\n\t\tprePublishBodyText = __(\n\t\t\t'Your work will be published at the specified date and time.'\n\t\t);\n\t} else {\n\t\tprePublishTitle = __( 'Are you ready to publish?' );\n\t\tprePublishBodyText = __(\n\t\t\t'Double-check your settings before publishing.'\n\t\t);\n\t}\n\n\treturn (\n\t\t<div className=\"editor-post-publish-panel__prepublish\">\n\t\t\t<div>\n\t\t\t\t<strong>{ prePublishTitle }</strong>\n\t\t\t</div>\n\t\t\t<p>{ prePublishBodyText }</p>\n\t\t\t<div className=\"components-site-card\">\n\t\t\t\t{ siteIcon }\n\t\t\t\t<div className=\"components-site-info\">\n\t\t\t\t\t<span className=\"components-site-name\">\n\t\t\t\t\t\t{ decodeEntities( siteTitle ) || __( '(Untitled)' ) }\n\t\t\t\t\t</span>\n\t\t\t\t\t<span className=\"components-site-home\">{ siteHome }</span>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<MaybeUploadMedia />\n\t\t\t{ hasPublishAction && (\n\t\t\t\t<>\n\t\t\t\t\t<PanelBody\n\t\t\t\t\t\tinitialOpen={ false }\n\t\t\t\t\t\ttitle={ [\n\t\t\t\t\t\t\t__( 'Visibility:' ),\n\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\tclassName=\"editor-post-publish-panel__link\"\n\t\t\t\t\t\t\t\tkey=\"label\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<PostVisibilityLabel />\n\t\t\t\t\t\t\t</span>,\n\t\t\t\t\t\t] }\n\t\t\t\t\t>\n\t\t\t\t\t\t<PostVisibility />\n\t\t\t\t\t</PanelBody>\n\t\t\t\t\t<PanelBody\n\t\t\t\t\t\tinitialOpen={ false }\n\t\t\t\t\t\ttitle={ [\n\t\t\t\t\t\t\t__( 'Publish:' ),\n\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\tclassName=\"editor-post-publish-panel__link\"\n\t\t\t\t\t\t\t\tkey=\"label\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<PostScheduleLabel />\n\t\t\t\t\t\t\t</span>,\n\t\t\t\t\t\t] }\n\t\t\t\t\t>\n\t\t\t\t\t\t<PostSchedule />\n\t\t\t\t\t</PanelBody>\n\t\t\t\t</>\n\t\t\t) }\n\t\t\t<MaybePostFormatPanel />\n\t\t\t<MaybeTagsPanel />\n\t\t\t<MaybeCategoryPanel />\n\t\t\t{ children }\n\t\t</div>\n\t);\n}\n\nexport default PostPublishPanelPrepublish;\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,IAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AACA,IAAAM,aAAA,GAAAN,OAAA;AAKA,IAAAO,eAAA,GAAAC,sBAAA,CAAAR,OAAA;AACA,IAAAS,MAAA,GAAAD,sBAAA,CAAAR,OAAA;AACA,IAAAU,aAAA,GAAAF,sBAAA,CAAAR,OAAA;AACA,IAAAW,OAAA,GAAAH,sBAAA,CAAAR,OAAA;AACA,IAAAY,eAAA,GAAAJ,sBAAA,CAAAR,OAAA;AACA,IAAAa,qBAAA,GAAAL,sBAAA,CAAAR,OAAA;AACA,IAAAc,MAAA,GAAAd,OAAA;AACA,IAAAe,mBAAA,GAAAP,sBAAA,CAAAR,OAAA;AACA,IAAAgB,iBAAA,GAAAR,sBAAA,CAAAR,OAAA;AAtB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,QAAA"}
1
+ {"version":3,"names":["_i18n","require","_components","_data","_icons","_url","_coreData","_htmlEntities","_postVisibility","_interopRequireDefault","_label","_postSchedule","_label2","_maybeTagsPanel","_maybePostFormatPanel","_store","_maybeCategoryPanel","_maybeUploadMedia","PostPublishPanelPrepublish","children","isBeingScheduled","isRequestingSiteIcon","hasPublishAction","siteIconUrl","siteTitle","siteHome","useSelect","select","_getCurrentPost$_link","getCurrentPost","isEditedPostBeingScheduled","editorStore","getEntityRecord","isResolving","coreStore","siteData","undefined","_links","site_icon_url","name","home","filterURLForDisplay","siteIcon","_react","createElement","Icon","className","size","icon","wordpress","alt","__","src","prePublishTitle","prePublishBodyText","decodeEntities","default","Fragment","PanelBody","initialOpen","title","key","_default","exports"],"sources":["@wordpress/editor/src/components/post-publish-panel/prepublish.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Icon, PanelBody } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { wordpress } from '@wordpress/icons';\nimport { filterURLForDisplay } from '@wordpress/url';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport PostVisibility from '../post-visibility';\nimport PostVisibilityLabel from '../post-visibility/label';\nimport PostSchedule from '../post-schedule';\nimport PostScheduleLabel from '../post-schedule/label';\nimport MaybeTagsPanel from './maybe-tags-panel';\nimport MaybePostFormatPanel from './maybe-post-format-panel';\nimport { store as editorStore } from '../../store';\nimport MaybeCategoryPanel from './maybe-category-panel';\nimport MaybeUploadMedia from './maybe-upload-media';\n\nfunction PostPublishPanelPrepublish( { children } ) {\n\tconst {\n\t\tisBeingScheduled,\n\t\tisRequestingSiteIcon,\n\t\thasPublishAction,\n\t\tsiteIconUrl,\n\t\tsiteTitle,\n\t\tsiteHome,\n\t} = useSelect( ( select ) => {\n\t\tconst { getCurrentPost, isEditedPostBeingScheduled } =\n\t\t\tselect( editorStore );\n\t\tconst { getEntityRecord, isResolving } = select( coreStore );\n\t\tconst siteData =\n\t\t\tgetEntityRecord( 'root', '__unstableBase', undefined ) || {};\n\n\t\treturn {\n\t\t\thasPublishAction:\n\t\t\t\tgetCurrentPost()._links?.[ 'wp:action-publish' ] ?? false,\n\t\t\tisBeingScheduled: isEditedPostBeingScheduled(),\n\t\t\tisRequestingSiteIcon: isResolving( 'getEntityRecord', [\n\t\t\t\t'root',\n\t\t\t\t'__unstableBase',\n\t\t\t\tundefined,\n\t\t\t] ),\n\t\t\tsiteIconUrl: siteData.site_icon_url,\n\t\t\tsiteTitle: siteData.name,\n\t\t\tsiteHome: siteData.home && filterURLForDisplay( siteData.home ),\n\t\t};\n\t}, [] );\n\n\tlet siteIcon = (\n\t\t<Icon className=\"components-site-icon\" size=\"36px\" icon={ wordpress } />\n\t);\n\n\tif ( siteIconUrl ) {\n\t\tsiteIcon = (\n\t\t\t<img\n\t\t\t\talt={ __( 'Site Icon' ) }\n\t\t\t\tclassName=\"components-site-icon\"\n\t\t\t\tsrc={ siteIconUrl }\n\t\t\t/>\n\t\t);\n\t}\n\n\tif ( isRequestingSiteIcon ) {\n\t\tsiteIcon = null;\n\t}\n\n\tlet prePublishTitle, prePublishBodyText;\n\n\tif ( ! hasPublishAction ) {\n\t\tprePublishTitle = __( 'Are you ready to submit for review?' );\n\t\tprePublishBodyText = __(\n\t\t\t'When you’re ready, submit your work for review, and an Editor will be able to approve it for you.'\n\t\t);\n\t} else if ( isBeingScheduled ) {\n\t\tprePublishTitle = __( 'Are you ready to schedule?' );\n\t\tprePublishBodyText = __(\n\t\t\t'Your work will be published at the specified date and time.'\n\t\t);\n\t} else {\n\t\tprePublishTitle = __( 'Are you ready to publish?' );\n\t\tprePublishBodyText = __(\n\t\t\t'Double-check your settings before publishing.'\n\t\t);\n\t}\n\n\treturn (\n\t\t<div className=\"editor-post-publish-panel__prepublish\">\n\t\t\t<div>\n\t\t\t\t<strong>{ prePublishTitle }</strong>\n\t\t\t</div>\n\t\t\t<p>{ prePublishBodyText }</p>\n\t\t\t<div className=\"components-site-card\">\n\t\t\t\t{ siteIcon }\n\t\t\t\t<div className=\"components-site-info\">\n\t\t\t\t\t<span className=\"components-site-name\">\n\t\t\t\t\t\t{ decodeEntities( siteTitle ) || __( '(Untitled)' ) }\n\t\t\t\t\t</span>\n\t\t\t\t\t<span className=\"components-site-home\">{ siteHome }</span>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<MaybeUploadMedia />\n\t\t\t{ hasPublishAction && (\n\t\t\t\t<>\n\t\t\t\t\t<PanelBody\n\t\t\t\t\t\tinitialOpen={ false }\n\t\t\t\t\t\ttitle={ [\n\t\t\t\t\t\t\t__( 'Visibility:' ),\n\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\tclassName=\"editor-post-publish-panel__link\"\n\t\t\t\t\t\t\t\tkey=\"label\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<PostVisibilityLabel />\n\t\t\t\t\t\t\t</span>,\n\t\t\t\t\t\t] }\n\t\t\t\t\t>\n\t\t\t\t\t\t<PostVisibility />\n\t\t\t\t\t</PanelBody>\n\t\t\t\t\t<PanelBody\n\t\t\t\t\t\tinitialOpen={ false }\n\t\t\t\t\t\ttitle={ [\n\t\t\t\t\t\t\t__( 'Publish:' ),\n\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\tclassName=\"editor-post-publish-panel__link\"\n\t\t\t\t\t\t\t\tkey=\"label\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<PostScheduleLabel />\n\t\t\t\t\t\t\t</span>,\n\t\t\t\t\t\t] }\n\t\t\t\t\t>\n\t\t\t\t\t\t<PostSchedule />\n\t\t\t\t\t</PanelBody>\n\t\t\t\t</>\n\t\t\t) }\n\t\t\t<MaybePostFormatPanel />\n\t\t\t<MaybeTagsPanel />\n\t\t\t<MaybeCategoryPanel />\n\t\t\t{ children }\n\t\t</div>\n\t);\n}\n\nexport default PostPublishPanelP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,SAAS;IACTC,WAAW,EAAG,KAAO;IACrBC,KAAK,EAAG,CACP,IAAAT,QAAE,EAAE,UAAW,CAAC,EAChB,IAAAR,MAAA,CAAAC,aAAA;MACCE,SAAS,EAAC,iCAAiC;MAC3Ce,GAAG,EAAC;IAAO,GAEX,IAAAlB,MAAA,CAAAC,aAAA,EAAChC,OAAA,CAAA4C,OAAiB,MAAE,CACf,CAAC;EACL,GAEH,IAAAb,MAAA,CAAAC,aAAA,EAACjC,aAAA,CAAA6C,OAAY,MAAE,CACL,CACV,CACF,EACD,IAAAb,MAAA,CAAAC,aAAA,EAAC9B,qBAAA,CAAA0C,OAAoB,MAAE,CAAC,EACxB,IAAAb,MAAA,CAAAC,aAAA,EAAC/B,eAAA,CAAA2C,OAAc,MAAE,CAAC,EAClB,IAAAb,MAAA,CAAAC,aAAA,EAAC5B,mBAAA,CAAAwC,OAAkB,MAAE,CAAC,EACpBrC,QACE,CAAC;AAER;AAAC,IAAA2C,QAAA,GAEc5C,0BAA0B;AAAA6C,OAAA,CAAAP,OAAA,GAAAM,QAAA"}
@@ -5,11 +5,12 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = PostSavedState;
8
- var _element = require("@wordpress/element");
8
+ var _react = require("react");
9
9
  var _classnames = _interopRequireDefault(require("classnames"));
10
10
  var _components = require("@wordpress/components");
11
11
  var _compose = require("@wordpress/compose");
12
12
  var _data = require("@wordpress/data");
13
+ var _element = require("@wordpress/element");
13
14
  var _i18n = require("@wordpress/i18n");
14
15
  var _icons = require("@wordpress/icons");
15
16
  var _keycodes = require("@wordpress/keycodes");
@@ -34,7 +35,7 @@ var _store = require("../../store");
34
35
  * @param {?boolean} props.forceIsDirty Whether to force the post to be marked
35
36
  * as dirty.
36
37
  * @param {?boolean} props.showIconLabels Whether interface buttons show labels instead of icons
37
- * @return {import('@wordpress/element').WPComponent} The component.
38
+ * @return {import('react').ComponentType} The component.
38
39
  */
39
40
  function PostSavedState({
40
41
  forceIsDirty,
@@ -122,7 +123,7 @@ function PostSavedState({
122
123
 
123
124
  // Use common Button instance for all saved states so that focus is not
124
125
  // lost.
125
- return (0, _element.createElement)(_components.Button, {
126
+ return (0, _react.createElement)(_components.Button, {
126
127
  className: isSaveable || isSaving ? (0, _classnames.default)({
127
128
  'editor-post-save-draft': !isSavedState,
128
129
  'editor-post-saved-state': isSavedState,
@@ -152,7 +153,7 @@ function PostSavedState({
152
153
  ,
153
154
  label: text || label,
154
155
  "aria-disabled": isDisabled
155
- }, isSavedState && (0, _element.createElement)(_icons.Icon, {
156
+ }, isSavedState && (0, _react.createElement)(_icons.Icon, {
156
157
  icon: isSaved ? _icons.check : _icons.cloud
157
158
  }), text);
158
159
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_classnames","_interopRequireDefault","_components","_compose","_data","_i18n","_icons","_keycodes","_store","PostSavedState","forceIsDirty","showIconLabels","forceSavedMessage","setForceSavedMessage","useState","isLargeViewport","useViewportMatch","isAutosaving","isDirty","isNew","isPending","isPublished","isSaveable","isSaving","isScheduled","hasPublishAction","useSelect","select","_getCurrentPost$_link","isEditedPostNew","isCurrentPostPublished","isCurrentPostScheduled","isEditedPostDirty","isSavingPost","isEditedPostSaveable","getCurrentPost","isAutosavingPost","getEditedPostAttribute","editorStore","_links","savePost","useDispatch","wasSaving","usePrevious","useEffect","timeoutId","setTimeout","clearTimeout","label","__","shortLabel","isSaved","isSavedState","isDisabled","text","createElement","Button","className","classnames","getAnimateClassName","type","undefined","onClick","shortcut","displayShortcut","primary","showTooltip","variant","icon","cloudUpload","Icon","check","cloud"],"sources":["@wordpress/editor/src/components/post-saved-state/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\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';\n\n/**\n * Internal dependencies\n */\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 * @param {?boolean} props.showIconLabels Whether interface buttons show labels instead of icons\n * @return {import('@wordpress/element').WPComponent} The component.\n */\nexport default function PostSavedState( {\n\tforceIsDirty,\n\tshowIconLabels = false,\n} ) {\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\tisPending,\n\t\tisPublished,\n\t\tisSaveable,\n\t\tisSaving,\n\t\tisScheduled,\n\t\thasPublishAction,\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} = select( editorStore );\n\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\tisPending: 'pending' === getEditedPostAttribute( 'status' ),\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};\n\t\t},\n\t\t[ forceIsDirty ]\n\t);\n\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\tif ( isPublished || isScheduled ) {\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\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? classnames( {\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\t/*\n\t\t\t * Displaying the keyboard shortcut conditionally makes the tooltip\n\t\t\t * itself show conditionally. This would trigger a full-rerendering\n\t\t\t * of the button that we want to avoid. By setting `showTooltip`,\n\t\t\t & the tooltip is always rendered even when there's no keyboard shortcut.\n\t\t\t */\n\t\t\tshowTooltip\n\t\t\tvariant=\"tertiary\"\n\t\t\ticon={ isLargeViewport ? undefined : cloudUpload }\n\t\t\t// Make sure the aria-label has always a value, as the default `text` is undefined on small screens.\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"],"mappings":";;;;;;;AAcA,IAAAA,QAAA,GAAAC,OAAA;AAXA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AAKA,IAAAG,WAAA,GAAAH,OAAA;AAIA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AAEA,IAAAM,KAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AACA,IAAAQ,SAAA,GAAAR,OAAA;AAKA,IAAAS,MAAA,GAAAT,OAAA;AAtBA;AACA;AACA;;AAGA;AACA;AACA;;AAYA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASU,cAAcA,CAAE;EACvCC,YAAY;EACZC,cAAc,GAA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A;EACA,OACC,IAAApD,QAAA,CAAAyD,aAAA,EAACrD,WAAA,CAAAsD,MAAM;IACNC,SAAS,EACRnC,UAAU,IAAIC,QAAQ,GACnB,IAAAmC,mBAAU,EAAE;MACZ,wBAAwB,EAAE,CAAEN,YAAY;MACxC,yBAAyB,EAAEA,YAAY;MACvC,WAAW,EAAE7B,QAAQ;MACrB,eAAe,EAAEN,YAAY;MAC7B,UAAU,EAAEkC,OAAO;MACnB,CAAE,IAAAQ,yCAAmB,EAAE;QACtBC,IAAI,EAAE;MACP,CAAE,CAAC,GAAIrC;IACP,CAAE,CAAC,GACHsC,SACH;IACDC,OAAO,EAAGT,UAAU,GAAGQ,SAAS,GAAG,MAAMrB,QAAQ,CAAC;IAClD;AACH;AACA;AACA,OAHG;IAIAuB,QAAQ,EAAGV,UAAU,GAAGQ,SAAS,GAAGG,yBAAe,CAACC,OAAO,CAAE,GAAI;IACjE;AACH;AACA;AACA;AACA;AACA,OALG;IAMAC,WAAW;IACXC,OAAO,EAAC,UAAU;IAClBC,IAAI,EAAGrD,eAAe,GAAG8C,SAAS,GAAGQ;IACrC;IAAA;IACArB,KAAK,EAAGM,IAAI,IAAIN,KAAO;IACvB,iBAAgBK;EAAY,GAE1BD,YAAY,IAAI,IAAAtD,QAAA,CAAAyD,aAAA,EAACjD,MAAA,CAAAgE,IAAI;IAACF,IAAI,EAAGjB,OAAO,GAAGoB,YAAK,GAAGC;EAAO,CAAE,CAAC,EACzDlB,IACK,CAAC;AAEX"}
1
+ {"version":3,"names":["_classnames","_interopRequireDefault","require","_components","_compose","_data","_element","_i18n","_icons","_keycodes","_store","PostSavedState","forceIsDirty","showIconLabels","forceSavedMessage","setForceSavedMessage","useState","isLargeViewport","useViewportMatch","isAutosaving","isDirty","isNew","isPending","isPublished","isSaveable","isSaving","isScheduled","hasPublishAction","useSelect","select","_getCurrentPost$_link","isEditedPostNew","isCurrentPostPublished","isCurrentPostScheduled","isEditedPostDirty","isSavingPost","isEditedPostSaveable","getCurrentPost","isAutosavingPost","getEditedPostAttribute","editorStore","_links","savePost","useDispatch","wasSaving","usePrevious","useEffect","timeoutId","setTimeout","clearTimeout","label","__","shortLabel","isSaved","isSavedState","isDisabled","text","_react","createElement","Button","className","classnames","getAnimateClassName","type","undefined","onClick","shortcut","displayShortcut","primary","showTooltip","variant","icon","cloudUpload","Icon","check","cloud"],"sources":["@wordpress/editor/src/components/post-saved-state/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\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';\n\n/**\n * Internal dependencies\n */\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 * @param {?boolean} props.showIconLabels Whether interface buttons show labels instead of icons\n * @return {import('react').ComponentType} The component.\n */\nexport default function PostSavedState( {\n\tforceIsDirty,\n\tshowIconLabels = false,\n} ) {\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\tisPending,\n\t\tisPublished,\n\t\tisSaveable,\n\t\tisSaving,\n\t\tisScheduled,\n\t\thasPublishAction,\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} = select( editorStore );\n\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\tisPending: 'pending' === getEditedPostAttribute( 'status' ),\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};\n\t\t},\n\t\t[ forceIsDirty ]\n\t);\n\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\tif ( isPublished || isScheduled ) {\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\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? classnames( {\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\t/*\n\t\t\t * Displaying the keyboard shortcut conditionally makes the tooltip\n\t\t\t * itself show conditionally. This would trigger a full-rerendering\n\t\t\t * of the button that we want to avoid. By setting `showTooltip`,\n\t\t\t & the tooltip is always rendered even when there's no keyboard shortcut.\n\t\t\t */\n\t\t\tshowTooltip\n\t\t\tvariant=\"tertiary\"\n\t\t\ticon={ isLargeViewport ? undefined : cloudUpload }\n\t\t\t// Make sure the aria-label has always a value, as the default `text` is undefined on small screens.\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"],"mappings":";;;;;;;;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AG,MAAA,CAAAC,aAAA,EAAClD,MAAA,CAAAiE,IAAI;IAACF,IAAI,EAAGlB,OAAO,GAAGqB,YAAK,GAAGC;EAAO,CAAE,CAAC,EACzDnB,IACK,CAAC;AAEX"}
@@ -4,11 +4,12 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = PostSchedule;
7
- var _element = require("@wordpress/element");
7
+ var _react = require("react");
8
8
  var _dateFns = require("date-fns");
9
9
  var _date = require("@wordpress/date");
10
10
  var _data = require("@wordpress/data");
11
11
  var _blockEditor = require("@wordpress/block-editor");
12
+ var _element = require("@wordpress/element");
12
13
  var _coreData = require("@wordpress/core-data");
13
14
  var _store = require("../../store");
14
15
  /**
@@ -64,7 +65,7 @@ function PostSchedule({
64
65
  .split('').reverse().join('') // Reverse the string and test for "a" not followed by a slash.
65
66
  );
66
67
 
67
- return (0, _element.createElement)(_blockEditor.__experimentalPublishDateTimePicker, {
68
+ return (0, _react.createElement)(_blockEditor.__experimentalPublishDateTimePicker, {
68
69
  currentDate: postDate,
69
70
  onChange: onUpdateDate,
70
71
  is12Hour: is12HourTime,
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_dateFns","_date","_data","_blockEditor","_coreData","_store","PostSchedule","onClose","postDate","postType","useSelect","select","editorStore","getEditedPostAttribute","getCurrentPostType","editPost","useDispatch","onUpdateDate","date","previewedMonth","setPreviewedMonth","useState","startOfMonth","Date","eventsByPostType","coreStore","getEntityRecords","status","after","toISOString","before","endOfMonth","exclude","getCurrentPostId","per_page","_fields","events","useMemo","map","eventDate","settings","getSettings","is12HourTime","test","formats","time","toLowerCase","replace","split","reverse","join","createElement","__experimentalPublishDateTimePicker","currentDate","onChange","is12Hour","onMonthPreviewed","parseISO"],"sources":["@wordpress/editor/src/components/post-schedule/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { parseISO, endOfMonth, startOfMonth } from 'date-fns';\n\n/**\n * WordPress dependencies\n */\nimport { getSettings } from '@wordpress/date';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __experimentalPublishDateTimePicker as PublishDateTimePicker } from '@wordpress/block-editor';\nimport { useState, useMemo } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport default function PostSchedule( { onClose } ) {\n\tconst { postDate, postType } = useSelect(\n\t\t( select ) => ( {\n\t\t\tpostDate: select( editorStore ).getEditedPostAttribute( 'date' ),\n\t\t\tpostType: select( editorStore ).getCurrentPostType(),\n\t\t} ),\n\t\t[]\n\t);\n\n\tconst { editPost } = useDispatch( editorStore );\n\tconst onUpdateDate = ( date ) => editPost( { date } );\n\n\tconst [ previewedMonth, setPreviewedMonth ] = useState(\n\t\tstartOfMonth( new Date( postDate ) )\n\t);\n\n\t// Pick up published and schduled site posts.\n\tconst eventsByPostType = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getEntityRecords( 'postType', postType, {\n\t\t\t\tstatus: 'publish,future',\n\t\t\t\tafter: startOfMonth( previewedMonth ).toISOString(),\n\t\t\t\tbefore: endOfMonth( previewedMonth ).toISOString(),\n\t\t\t\texclude: [ select( editorStore ).getCurrentPostId() ],\n\t\t\t\tper_page: 100,\n\t\t\t\t_fields: 'id,date',\n\t\t\t} ),\n\t\t[ previewedMonth, postType ]\n\t);\n\n\tconst events = useMemo(\n\t\t() =>\n\t\t\t( eventsByPostType || [] ).map( ( { date: eventDate } ) => ( {\n\t\t\t\tdate: new Date( eventDate ),\n\t\t\t} ) ),\n\t\t[ eventsByPostType ]\n\t);\n\n\tconst settings = getSettings();\n\n\t// To know if the current timezone is a 12 hour time with look for \"a\" in the time format\n\t// We also make sure this a is not escaped by a \"/\"\n\tconst is12HourTime = /a(?!\\\\)/i.test(\n\t\tsettings.formats.time\n\t\t\t.toLowerCase() // Test only the lower case a.\n\t\t\t.replace( /\\\\\\\\/g, '' ) // Replace \"//\" with empty strings.\n\t\t\t.split( '' )\n\t\t\t.reverse()\n\t\t\t.join( '' ) // Reverse the string and test for \"a\" not followed by a slash.\n\t);\n\n\treturn (\n\t\t<PublishDateTimePicker\n\t\t\tcurrentDate={ postDate }\n\t\t\tonChange={ onUpdateDate }\n\t\t\tis12Hour={ is12HourTime }\n\t\t\tevents={ events }\n\t\t\tonMonthPreviewed={ ( date ) =>\n\t\t\t\tsetPreviewedMonth( parseISO( date ) )\n\t\t\t}\n\t\t\tonClose={ onClose }\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;AAWA,IAAAA,QAAA,GAAAC,OAAA;AARA,IAAAC,QAAA,GAAAD,OAAA;AAKA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AAEA,IAAAK,SAAA,GAAAL,OAAA;AAKA,IAAAM,MAAA,GAAAN,OAAA;AAjBA;AACA;AACA;;AAGA;AACA;AACA;;AAOA;AACA;AACA;;AAGe,SAASO,YAAYA,CAAE;EAAEC;AAAQ,CAAC,EAAG;EACnD,MAAM;IAAEC,QAAQ;IAAEC;EAAS,CAAC,GAAG,IAAAC,eAAS,EACrCC,MAAM,KAAQ;IACfH,QAAQ,EAAEG,MAAM,CAAEC,YAAY,CAAC,CAACC,sBAAsB,CAAE,MAAO,CAAC;IAChEJ,QAAQ,EAAEE,MAAM,CAAEC,YAAY,CAAC,CAACE,kBAAkB,CAAC;EACpD,CAAC,CAAE,EACH,EACD,CAAC;EAED,MAAM;IAAEC;EAAS,CAAC,GAAG,IAAAC,iBAAW,EAAEJ,YAAY,CAAC;EAC/C,MAAMK,YAAY,GAAKC,IAAI,IAAMH,QAAQ,CAAE;IAAEG;EAAK,CAAE,CAAC;EAErD,MAAM,CAAEC,cAAc,EAAEC,iBAAiB,CAAE,GAAG,IAAAC,iBAAQ,EACrD,IAAAC,qBAAY,EAAE,IAAIC,IAAI,CAAEf,QAAS,CAAE,CACpC,CAAC;;EAED;EACA,MAAMgB,gB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,EAAGb,YAAc;IACzBN,MAAM,EAAGA,MAAQ;IACjBoB,gBAAgB,EAAKtC,IAAI,IACxBE,iBAAiB,CAAE,IAAAqC,iBAAQ,EAAEvC,IAAK,CAAE,CACpC;IACDX,OAAO,EAAGA;EAAS,CACnB,CAAC;AAEJ"}
1
+ {"version":3,"names":["_dateFns","require","_date","_data","_blockEditor","_element","_coreData","_store","PostSchedule","onClose","postDate","postType","useSelect","select","editorStore","getEditedPostAttribute","getCurrentPostType","editPost","useDispatch","onUpdateDate","date","previewedMonth","setPreviewedMonth","useState","startOfMonth","Date","eventsByPostType","coreStore","getEntityRecords","status","after","toISOString","before","endOfMonth","exclude","getCurrentPostId","per_page","_fields","events","useMemo","map","eventDate","settings","getSettings","is12HourTime","test","formats","time","toLowerCase","replace","split","reverse","join","_react","createElement","__experimentalPublishDateTimePicker","currentDate","onChange","is12Hour","onMonthPreviewed","parseISO"],"sources":["@wordpress/editor/src/components/post-schedule/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { parseISO, endOfMonth, startOfMonth } from 'date-fns';\n\n/**\n * WordPress dependencies\n */\nimport { getSettings } from '@wordpress/date';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __experimentalPublishDateTimePicker as PublishDateTimePicker } from '@wordpress/block-editor';\nimport { useState, useMemo } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport default function PostSchedule( { onClose } ) {\n\tconst { postDate, postType } = useSelect(\n\t\t( select ) => ( {\n\t\t\tpostDate: select( editorStore ).getEditedPostAttribute( 'date' ),\n\t\t\tpostType: select( editorStore ).getCurrentPostType(),\n\t\t} ),\n\t\t[]\n\t);\n\n\tconst { editPost } = useDispatch( editorStore );\n\tconst onUpdateDate = ( date ) => editPost( { date } );\n\n\tconst [ previewedMonth, setPreviewedMonth ] = useState(\n\t\tstartOfMonth( new Date( postDate ) )\n\t);\n\n\t// Pick up published and schduled site posts.\n\tconst eventsByPostType = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getEntityRecords( 'postType', postType, {\n\t\t\t\tstatus: 'publish,future',\n\t\t\t\tafter: startOfMonth( previewedMonth ).toISOString(),\n\t\t\t\tbefore: endOfMonth( previewedMonth ).toISOString(),\n\t\t\t\texclude: [ select( editorStore ).getCurrentPostId() ],\n\t\t\t\tper_page: 100,\n\t\t\t\t_fields: 'id,date',\n\t\t\t} ),\n\t\t[ previewedMonth, postType ]\n\t);\n\n\tconst events = useMemo(\n\t\t() =>\n\t\t\t( eventsByPostType || [] ).map( ( { date: eventDate } ) => ( {\n\t\t\t\tdate: new Date( eventDate ),\n\t\t\t} ) ),\n\t\t[ eventsByPostType ]\n\t);\n\n\tconst settings = getSettings();\n\n\t// To know if the current timezone is a 12 hour time with look for \"a\" in the time format\n\t// We also make sure this a is not escaped by a \"/\"\n\tconst is12HourTime = /a(?!\\\\)/i.test(\n\t\tsettings.formats.time\n\t\t\t.toLowerCase() // Test only the lower case a.\n\t\t\t.replace( /\\\\\\\\/g, '' ) // Replace \"//\" with empty strings.\n\t\t\t.split( '' )\n\t\t\t.reverse()\n\t\t\t.join( '' ) // Reverse the string and test for \"a\" not followed by a slash.\n\t);\n\n\treturn (\n\t\t<PublishDateTimePicker\n\t\t\tcurrentDate={ postDate }\n\t\t\tonChange={ onUpdateDate }\n\t\t\tis12Hour={ is12HourTime }\n\t\t\tevents={ events }\n\t\t\tonMonthPreviewed={ ( date ) =>\n\t\t\t\tsetPreviewedMonth( parseISO( date ) )\n\t\t\t}\n\t\t\tonClose={ onClose }\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AAKA,I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AAAC,gBAAO,EACrB,MACC,CAAEb,gBAAgB,IAAI,EAAE,EAAGc,GAAG,CAAE,CAAE;IAAEpB,IAAI,EAAEqB;EAAU,CAAC,MAAQ;IAC5DrB,IAAI,EAAE,IAAIK,IAAI,CAAEgB,SAAU;EAC3B,CAAC,CAAG,CAAC,EACN,CAAEf,gBAAgB,CACnB,CAAC;EAED,MAAMgB,QAAQ,GAAG,IAAAC,iBAAW,EAAC,CAAC;;EAE9B;EACA;EACA,MAAMC,YAAY,GAAG,UAAU,CAACC,IAAI,CACnCH,QAAQ,CAACI,OAAO,CAACC,IAAI,CACnBC,WAAW,CAAC,CAAC,CAAC;EAAA,CACdC,OAAO,CAAE,OAAO,EAAE,EAAG,CAAC,CAAC;EAAA,CACvBC,KAAK,CAAE,EAAG,CAAC,CACXC,OAAO,CAAC,CAAC,CACTC,IAAI,CAAE,EAAG,CAAC,CAAC;EACd,CAAC;;EAED,OACC,IAAAC,MAAA,CAAAC,aAAA,EAAClD,YAAA,CAAAmD,mCAAqB;IACrBC,WAAW,EAAG9C,QAAU;IACxB+C,QAAQ,EAAGtC,YAAc;IACzBuC,QAAQ,EAAGd,YAAc;IACzBN,MAAM,EAAGA,MAAQ;IACjBqB,gBAAgB,EAAKvC,IAAI,IACxBE,iBAAiB,CAAE,IAAAsC,iBAAQ,EAAExC,IAAK,CAAE,CACpC;IACDX,OAAO,EAAGA;EAAS,CACnB,CAAC;AAEJ"}
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = PostSlugCheck;
8
- var _element = require("@wordpress/element");
8
+ var _react = require("react");
9
9
  var _postTypeSupportCheck = _interopRequireDefault(require("../post-type-support-check"));
10
10
  /**
11
11
  * Internal dependencies
@@ -14,7 +14,7 @@ var _postTypeSupportCheck = _interopRequireDefault(require("../post-type-support
14
14
  function PostSlugCheck({
15
15
  children
16
16
  }) {
17
- return (0, _element.createElement)(_postTypeSupportCheck.default, {
17
+ return (0, _react.createElement)(_postTypeSupportCheck.default, {
18
18
  supportKeys: "slug"
19
19
  }, children);
20
20
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_postTypeSupportCheck","_interopRequireDefault","require","PostSlugCheck","children","_element","createElement","default","supportKeys"],"sources":["@wordpress/editor/src/components/post-slug/check.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport PostTypeSupportCheck from '../post-type-support-check';\n\nexport default function PostSlugCheck( { children } ) {\n\treturn (\n\t\t<PostTypeSupportCheck supportKeys=\"slug\">\n\t\t\t{ children }\n\t\t</PostTypeSupportCheck>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,qBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAHA;AACA;AACA;;AAGe,SAASC,aAAaA,CAAE;EAAEC;AAAS,CAAC,EAAG;EACrD,OACC,IAAAC,QAAA,CAAAC,aAAA,EAACN,qBAAA,CAAAO,OAAoB;IAACC,WAAW,EAAC;EAAM,GACrCJ,QACmB,CAAC;AAEzB"}
1
+ {"version":3,"names":["_postTypeSupportCheck","_interopRequireDefault","require","PostSlugCheck","children","_react","createElement","default","supportKeys"],"sources":["@wordpress/editor/src/components/post-slug/check.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport PostTypeSupportCheck from '../post-type-support-check';\n\nexport default function PostSlugCheck( { children } ) {\n\treturn (\n\t\t<PostTypeSupportCheck supportKeys=\"slug\">\n\t\t\t{ children }\n\t\t</PostTypeSupportCheck>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,qBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAHA;AACA;AACA;;AAGe,SAASC,aAAaA,CAAE;EAAEC;AAAS,CAAC,EAAG;EACrD,OACC,IAAAC,MAAA,CAAAC,aAAA,EAACN,qBAAA,CAAAO,OAAoB;IAACC,WAAW,EAAC;EAAM,GACrCJ,QACmB,CAAC;AAEzB"}
@@ -5,8 +5,9 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = exports.PostSlug = void 0;
8
- var _element = require("@wordpress/element");
8
+ var _react = require("react");
9
9
  var _data = require("@wordpress/data");
10
+ var _element = require("@wordpress/element");
10
11
  var _i18n = require("@wordpress/i18n");
11
12
  var _compose = require("@wordpress/compose");
12
13
  var _url = require("@wordpress/url");
@@ -51,7 +52,7 @@ class PostSlug extends _element.Component {
51
52
  const {
52
53
  editedSlug
53
54
  } = this.state;
54
- return (0, _element.createElement)(_check.default, null, (0, _element.createElement)(_components.TextControl, {
55
+ return (0, _react.createElement)(_check.default, null, (0, _react.createElement)(_components.TextControl, {
55
56
  __nextHasNoMarginBottom: true,
56
57
  label: (0, _i18n.__)('Slug'),
57
58
  autoComplete: "off",
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_data","_i18n","_compose","_url","_components","_check","_interopRequireDefault","_store","PostSlug","Component","constructor","postSlug","postTitle","postID","arguments","state","editedSlug","safeDecodeURIComponent","cleanForSlug","setSlug","bind","event","onUpdateSlug","props","value","target","render","createElement","default","TextControl","__nextHasNoMarginBottom","label","__","autoComplete","spellCheck","onChange","slug","setState","onBlur","className","exports","_default","compose","withSelect","select","getCurrentPost","getEditedPostAttribute","editorStore","id","withDispatch","dispatch","editPost"],"sources":["@wordpress/editor/src/components/post-slug/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { withDispatch, withSelect } from '@wordpress/data';\nimport { Component } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { compose } from '@wordpress/compose';\nimport { safeDecodeURIComponent, cleanForSlug } from '@wordpress/url';\nimport { TextControl } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport PostSlugCheck from './check';\nimport { store as editorStore } from '../../store';\n\nexport class PostSlug extends Component {\n\tconstructor( { postSlug, postTitle, postID } ) {\n\t\tsuper( ...arguments );\n\n\t\tthis.state = {\n\t\t\teditedSlug:\n\t\t\t\tsafeDecodeURIComponent( postSlug ) ||\n\t\t\t\tcleanForSlug( postTitle ) ||\n\t\t\t\tpostID,\n\t\t};\n\n\t\tthis.setSlug = this.setSlug.bind( this );\n\t}\n\n\tsetSlug( event ) {\n\t\tconst { postSlug, onUpdateSlug } = this.props;\n\t\tconst { value } = event.target;\n\n\t\tconst editedSlug = cleanForSlug( value );\n\n\t\tif ( editedSlug === postSlug ) {\n\t\t\treturn;\n\t\t}\n\n\t\tonUpdateSlug( editedSlug );\n\t}\n\n\trender() {\n\t\tconst { editedSlug } = this.state;\n\t\treturn (\n\t\t\t<PostSlugCheck>\n\t\t\t\t<TextControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Slug' ) }\n\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\tspellCheck=\"false\"\n\t\t\t\t\tvalue={ editedSlug }\n\t\t\t\t\tonChange={ ( slug ) =>\n\t\t\t\t\t\tthis.setState( { editedSlug: slug } )\n\t\t\t\t\t}\n\t\t\t\t\tonBlur={ this.setSlug }\n\t\t\t\t\tclassName=\"editor-post-slug\"\n\t\t\t\t/>\n\t\t\t</PostSlugCheck>\n\t\t);\n\t}\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst { getCurrentPost, getEditedPostAttribute } =\n\t\t\tselect( editorStore );\n\n\t\tconst { id } = getCurrentPost();\n\t\treturn {\n\t\t\tpostSlug: getEditedPostAttribute( 'slug' ),\n\t\t\tpostTitle: getEditedPostAttribute( 'title' ),\n\t\t\tpostID: id,\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { editPost } = dispatch( editorStore );\n\t\treturn {\n\t\t\tonUpdateSlug( slug ) {\n\t\t\t\teditPost( { slug } );\n\t\t\t},\n\t\t};\n\t} ),\n] )( PostSlug );\n"],"mappings":";;;;;;;AAIA,IAAAA,QAAA,GAAAC,OAAA;AADA,IAAAC,KAAA,GAAAD,OAAA;AAEA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAA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AI,IAChB,IAAI,CAACC,QAAQ,CAAE;QAAErB,UAAU,EAAEoB;MAAK,CAAE,CACpC;MACDE,MAAM,EAAG,IAAI,CAACnB,OAAS;MACvBoB,SAAS,EAAC;IAAkB,CAC5B,CACa,CAAC;EAElB;AACD;AAACC,OAAA,CAAAhC,QAAA,GAAAA,QAAA;AAAA,IAAAiC,QAAA,GAEc,IAAAC,gBAAO,EAAE,CACvB,IAAAC,gBAAU,EAAIC,MAAM,IAAM;EACzB,MAAM;IAAEC,cAAc;IAAEC;EAAuB,CAAC,GAC/CF,MAAM,CAAEG,YAAY,CAAC;EAEtB,MAAM;IAAEC;EAAG,CAAC,GAAGH,cAAc,CAAC,CAAC;EAC/B,OAAO;IACNlC,QAAQ,EAAEmC,sBAAsB,CAAE,MAAO,CAAC;IAC1ClC,SAAS,EAAEkC,sBAAsB,CAAE,OAAQ,CAAC;IAC5CjC,MAAM,EAAEmC;EACT,CAAC;AACF,CAAE,CAAC,EACH,IAAAC,kBAAY,EAAIC,QAAQ,IAAM;EAC7B,MAAM;IAAEC;EAAS,CAAC,GAAGD,QAAQ,CAAEH,YAAY,CAAC;EAC5C,OAAO;IACNzB,YAAYA,CAAEc,IAAI,EAAG;MACpBe,QAAQ,CAAE;QAAEf;MAAK,CAAE,CAAC;IACrB;EACD,CAAC;AACF,CAAE,CAAC,CACF,CAAC,CAAE5B,QAAS,CAAC;AAAAgC,OAAA,CAAAZ,OAAA,GAAAa,QAAA"}
1
+ {"version":3,"names":["_data","require","_element","_i18n","_compose","_url","_components","_check","_interopRequireDefault","_store","PostSlug","Component","constructor","postSlug","postTitle","postID","arguments","state","editedSlug","safeDecodeURIComponent","cleanForSlug","setSlug","bind","event","onUpdateSlug","props","value","target","render","_react","createElement","default","TextControl","__nextHasNoMarginBottom","label","__","autoComplete","spellCheck","onChange","slug","setState","onBlur","className","exports","_default","compose","withSelect","select","getCurrentPost","getEditedPostAttribute","editorStore","id","withDispatch","dispatch","editPost"],"sources":["@wordpress/editor/src/components/post-slug/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { withDispatch, withSelect } from '@wordpress/data';\nimport { Component } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { compose } from '@wordpress/compose';\nimport { safeDecodeURIComponent, cleanForSlug } from '@wordpress/url';\nimport { TextControl } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport PostSlugCheck from './check';\nimport { store as editorStore } from '../../store';\n\nexport class PostSlug extends Component {\n\tconstructor( { postSlug, postTitle, postID } ) {\n\t\tsuper( ...arguments );\n\n\t\tthis.state = {\n\t\t\teditedSlug:\n\t\t\t\tsafeDecodeURIComponent( postSlug ) ||\n\t\t\t\tcleanForSlug( postTitle ) ||\n\t\t\t\tpostID,\n\t\t};\n\n\t\tthis.setSlug = this.setSlug.bind( this );\n\t}\n\n\tsetSlug( event ) {\n\t\tconst { postSlug, onUpdateSlug } = this.props;\n\t\tconst { value } = event.target;\n\n\t\tconst editedSlug = cleanForSlug( value );\n\n\t\tif ( editedSlug === postSlug ) {\n\t\t\treturn;\n\t\t}\n\n\t\tonUpdateSlug( editedSlug );\n\t}\n\n\trender() {\n\t\tconst { editedSlug } = this.state;\n\t\treturn (\n\t\t\t<PostSlugCheck>\n\t\t\t\t<TextControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Slug' ) }\n\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\tspellCheck=\"false\"\n\t\t\t\t\tvalue={ editedSlug }\n\t\t\t\t\tonChange={ ( slug ) =>\n\t\t\t\t\t\tthis.setState( { editedSlug: slug } )\n\t\t\t\t\t}\n\t\t\t\t\tonBlur={ this.setSlug }\n\t\t\t\t\tclassName=\"editor-post-slug\"\n\t\t\t\t/>\n\t\t\t</PostSlugCheck>\n\t\t);\n\t}\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst { getCurrentPost, getEditedPostAttribute } =\n\t\t\tselect( editorStore );\n\n\t\tconst { id } = getCurrentPost();\n\t\treturn {\n\t\t\tpostSlug: getEditedPostAttribute( 'slug' ),\n\t\t\tpostTitle: getEditedPostAttribute( 'title' ),\n\t\t\tpostID: id,\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { editPost } = dispatch( editorStore );\n\t\treturn {\n\t\t\tonUpdateSlug( slug ) {\n\t\t\t\teditPost( { slug } );\n\t\t\t},\n\t\t};\n\t} ),\n] )( PostSlug );\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,IAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AAKA,IAAAM,MAAA,GAAAC,sBAAA,CAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAR,OAAA;AAdA;AACA;AACA;;AAQA;AACA;AACA;;AAIO,MAAMS,QAAQ,SAASC,kBAAS,CAAC;EACvCC,WAAWA,CAAE;IAAEC,QAAQ;IAAEC,SAAS;IAAEC;EAAO,CAAC,EAAG;IAC9C,KAAK,CAAE,GAAGC,SAAU,CAAC;IAErB,IAAI,CAACC,KAAK,GAAG;MACZC,UAAU,EACT,IAAAC,2BAAsB,EAAEN,QAAS,CAAC,IAClC,IAAAO,iBAAY,EAAEN,SAAU,CAAC,IACzBC;IACF,CAAC;IAED,IAAI,CAACM,OAAO,GAAG,IAAI,CAACA,OAAO,CAACC,IAAI,CAAE,IAAK,CAAC;EACzC;EAEAD,OAAOA,CAAEE,KAAK,EAAG;IAChB,MAAM;MAAEV,QAAQ;MAAEW;IAAa,CAAC,GAAG,IAAI,CAACC,KAAK;IAC7C,MAAM;MAAEC;IAAM,CAAC,GAAGH,KAAK,CAACI,MAAM;IAE9B,MAAMT,UAAU,GAAG,IAAAE,iBAAY,EAAEM,KAAM,CAAC;IAExC,IAAKR,UAAU,KAA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CAAC;IACrB;EACD,CAAC;AACF,CAAE,CAAC,CACF,CAAC,CAAE7B,QAAS,CAAC;AAAAiC,OAAA,CAAAZ,OAAA,GAAAa,QAAA"}
@@ -3,9 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.PostStickyCheck = PostStickyCheck;
7
- exports.default = void 0;
8
- var _compose = require("@wordpress/compose");
6
+ exports.default = PostStickyCheck;
9
7
  var _data = require("@wordpress/data");
10
8
  var _store = require("../../store");
11
9
  /**
@@ -17,22 +15,22 @@ var _store = require("../../store");
17
15
  */
18
16
 
19
17
  function PostStickyCheck({
20
- hasStickyAction,
21
- postType,
22
18
  children
23
19
  }) {
20
+ const {
21
+ hasStickyAction,
22
+ postType
23
+ } = (0, _data.useSelect)(select => {
24
+ var _post$_links$wpActio;
25
+ const post = select(_store.store).getCurrentPost();
26
+ return {
27
+ hasStickyAction: (_post$_links$wpActio = post._links?.['wp:action-sticky']) !== null && _post$_links$wpActio !== void 0 ? _post$_links$wpActio : false,
28
+ postType: select(_store.store).getCurrentPostType()
29
+ };
30
+ }, []);
24
31
  if (postType !== 'post' || !hasStickyAction) {
25
32
  return null;
26
33
  }
27
34
  return children;
28
35
  }
29
- var _default = (0, _compose.compose)([(0, _data.withSelect)(select => {
30
- var _post$_links$wpActio;
31
- const post = select(_store.store).getCurrentPost();
32
- return {
33
- hasStickyAction: (_post$_links$wpActio = post._links?.['wp:action-sticky']) !== null && _post$_links$wpActio !== void 0 ? _post$_links$wpActio : false,
34
- postType: select(_store.store).getCurrentPostType()
35
- };
36
- })])(PostStickyCheck);
37
- exports.default = _default;
38
36
  //# sourceMappingURL=check.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_compose","require","_data","_store","PostStickyCheck","hasStickyAction","postType","children","_default","compose","withSelect","select","_post$_links$wpActio","post","editorStore","getCurrentPost","_links","getCurrentPostType","exports","default"],"sources":["@wordpress/editor/src/components/post-sticky/check.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { compose } from '@wordpress/compose';\nimport { withSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport function PostStickyCheck( { hasStickyAction, postType, children } ) {\n\tif ( postType !== 'post' || ! hasStickyAction ) {\n\t\treturn null;\n\t}\n\n\treturn children;\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst post = select( editorStore ).getCurrentPost();\n\t\treturn {\n\t\t\thasStickyAction: post._links?.[ 'wp:action-sticky' ] ?? false,\n\t\t\tpostType: select( editorStore ).getCurrentPostType(),\n\t\t};\n\t} ),\n] )( PostStickyCheck );\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAKA,IAAAE,MAAA,GAAAF,OAAA;AATA;AACA;AACA;;AAIA;AACA;AACA;;AAGO,SAASG,eAAeA,CAAE;EAAEC,eAAe;EAAEC,QAAQ;EAAEC;AAAS,CAAC,EAAG;EAC1E,IAAKD,QAAQ,KAAK,MAAM,IAAI,CAAED,eAAe,EAAG;IAC/C,OAAO,IAAI;EACZ;EAEA,OAAOE,QAAQ;AAChB;AAAC,IAAAC,QAAA,GAEc,IAAAC,gBAAO,EAAE,CACvB,IAAAC,gBAAU,EAAIC,MAAM,IAAM;EAAA,IAAAC,oBAAA;EACzB,MAAMC,IAAI,GAAGF,MAAM,CAAEG,YAAY,CAAC,CAACC,cAAc,CAAC,CAAC;EACnD,OAAO;IACNV,eAAe,GAAAO,oBAAA,GAAEC,IAAI,CAACG,MAAM,GAAI,kBAAkB,CAAE,cAAAJ,oBAAA,cAAAA,oBAAA,GAAI,KAAK;IAC7DN,QAAQ,EAAEK,MAAM,CAAEG,YAAY,CAAC,CAACG,kBAAkB,CAAC;EACpD,CAAC;AACF,CAAE,CAAC,CACF,CAAC,CAAEb,eAAgB,CAAC;AAAAc,OAAA,CAAAC,OAAA,GAAAX,QAAA"}
1
+ {"version":3,"names":["_data","require","_store","PostStickyCheck","children","hasStickyAction","postType","useSelect","select","_post$_links$wpActio","post","editorStore","getCurrentPost","_links","getCurrentPostType"],"sources":["@wordpress/editor/src/components/post-sticky/check.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport default function PostStickyCheck( { children } ) {\n\tconst { hasStickyAction, postType } = useSelect( ( select ) => {\n\t\tconst post = select( editorStore ).getCurrentPost();\n\t\treturn {\n\t\t\thasStickyAction: post._links?.[ 'wp:action-sticky' ] ?? false,\n\t\t\tpostType: select( editorStore ).getCurrentPostType(),\n\t\t};\n\t}, [] );\n\n\tif ( postType !== 'post' || ! hasStickyAction ) {\n\t\treturn null;\n\t}\n\n\treturn children;\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAKA,IAAAC,MAAA,GAAAD,OAAA;AARA;AACA;AACA;;AAGA;AACA;AACA;;AAGe,SAASE,eAAeA,CAAE;EAAEC;AAAS,CAAC,EAAG;EACvD,MAAM;IAAEC,eAAe;IAAEC;EAAS,CAAC,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IAAA,IAAAC,oBAAA;IAC9D,MAAMC,IAAI,GAAGF,MAAM,CAAEG,YAAY,CAAC,CAACC,cAAc,CAAC,CAAC;IACnD,OAAO;MACNP,eAAe,GAAAI,oBAAA,GAAEC,IAAI,CAACG,MAAM,GAAI,kBAAkB,CAAE,cAAAJ,oBAAA,cAAAA,oBAAA,GAAI,KAAK;MAC7DH,QAAQ,EAAEE,MAAM,CAAEG,YAAY,CAAC,CAACG,kBAAkB,CAAC;IACpD,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,IAAKR,QAAQ,KAAK,MAAM,IAAI,CAAED,eAAe,EAAG;IAC/C,OAAO,IAAI;EACZ;EAEA,OAAOD,QAAQ;AAChB"}
@@ -4,13 +4,11 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.PostSticky = PostSticky;
8
- exports.default = void 0;
9
- var _element = require("@wordpress/element");
7
+ exports.default = PostSticky;
8
+ var _react = require("react");
10
9
  var _i18n = require("@wordpress/i18n");
11
10
  var _components = require("@wordpress/components");
12
11
  var _data = require("@wordpress/data");
13
- var _compose = require("@wordpress/compose");
14
12
  var _check = _interopRequireDefault(require("./check"));
15
13
  var _store = require("../../store");
16
14
  /**
@@ -21,29 +19,21 @@ var _store = require("../../store");
21
19
  * Internal dependencies
22
20
  */
23
21
 
24
- function PostSticky({
25
- onUpdateSticky,
26
- postSticky = false
27
- }) {
28
- return (0, _element.createElement)(_check.default, null, (0, _element.createElement)(_components.CheckboxControl, {
22
+ function PostSticky() {
23
+ const postSticky = (0, _data.useSelect)(select => {
24
+ var _select$getEditedPost;
25
+ return (_select$getEditedPost = select(_store.store).getEditedPostAttribute('sticky')) !== null && _select$getEditedPost !== void 0 ? _select$getEditedPost : false;
26
+ }, []);
27
+ const {
28
+ editPost
29
+ } = (0, _data.useDispatch)(_store.store);
30
+ return (0, _react.createElement)(_check.default, null, (0, _react.createElement)(_components.CheckboxControl, {
29
31
  __nextHasNoMarginBottom: true,
30
32
  label: (0, _i18n.__)('Stick to the top of the blog'),
31
33
  checked: postSticky,
32
- onChange: () => onUpdateSticky(!postSticky)
34
+ onChange: () => editPost({
35
+ sticky: !postSticky
36
+ })
33
37
  }));
34
38
  }
35
- var _default = (0, _compose.compose)([(0, _data.withSelect)(select => {
36
- return {
37
- postSticky: select(_store.store).getEditedPostAttribute('sticky')
38
- };
39
- }), (0, _data.withDispatch)(dispatch => {
40
- return {
41
- onUpdateSticky(postSticky) {
42
- dispatch(_store.store).editPost({
43
- sticky: postSticky
44
- });
45
- }
46
- };
47
- })])(PostSticky);
48
- exports.default = _default;
49
39
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","_components","_data","_compose","_check","_interopRequireDefault","_store","PostSticky","onUpdateSticky","postSticky","_element","createElement","default","CheckboxControl","__nextHasNoMarginBottom","label","__","checked","onChange","_default","compose","withSelect","select","editorStore","getEditedPostAttribute","withDispatch","dispatch","editPost","sticky","exports"],"sources":["@wordpress/editor/src/components/post-sticky/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { CheckboxControl } from '@wordpress/components';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport PostStickyCheck from './check';\nimport { store as editorStore } from '../../store';\n\nexport function PostSticky( { onUpdateSticky, postSticky = false } ) {\n\treturn (\n\t\t<PostStickyCheck>\n\t\t\t<CheckboxControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tlabel={ __( 'Stick to the top of the blog' ) }\n\t\t\t\tchecked={ postSticky }\n\t\t\t\tonChange={ () => onUpdateSticky( ! postSticky ) }\n\t\t\t/>\n\t\t</PostStickyCheck>\n\t);\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\treturn {\n\t\t\tpostSticky:\n\t\t\t\tselect( editorStore ).getEditedPostAttribute( 'sticky' ),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\treturn {\n\t\t\tonUpdateSticky( postSticky ) {\n\t\t\t\tdispatch( editorStore ).editPost( { sticky: postSticky } );\n\t\t\t},\n\t\t};\n\t} ),\n] )( PostSticky );\n"],"mappings":";;;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAC,sBAAA,CAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AAZA;AACA;AACA;;AAMA;AACA;AACA;;AAIO,SAASO,UAAUA,CAAE;EAAEC,cAAc;EAAEC,UAAU,GAAG;AAAM,CAAC,EAAG;EACpE,OACC,IAAAC,QAAA,CAAAC,aAAA,EAACP,MAAA,CAAAQ,OAAe,QACf,IAAAF,QAAA,CAAAC,aAAA,EAACV,WAAA,CAAAY,eAAe;IACfC,uBAAuB;IACvBC,KAAK,EAAG,IAAAC,QAAE,EAAE,8BAA+B,CAAG;IAC9CC,OAAO,EAAGR,UAAY;IACtBS,QAAQ,EAAGA,CAAA,KAAMV,cAAc,CAAE,CAAEC,UAAW;EAAG,CACjD,CACe,CAAC;AAEpB;AAAC,IAAAU,QAAA,GAEc,IAAAC,gBAAO,EAAE,CACvB,IAAAC,gBAAU,EAAIC,MAAM,IAAM;EACzB,OAAO;IACNb,UAAU,EACTa,MAAM,CAAEC,YAAY,CAAC,CAACC,sBAAsB,CAAE,QAAS;EACzD,CAAC;AACF,CAAE,CAAC,EACH,IAAAC,kBAAY,EAAIC,QAAQ,IAAM;EAC7B,OAAO;IACNlB,cAAcA,CAAEC,UAAU,EAAG;MAC5BiB,QAAQ,CAAEH,YAAY,CAAC,CAACI,QAAQ,CAAE;QAAEC,MAAM,EAAEnB;MAAW,CAAE,CAAC;IAC3D;EACD,CAAC;AACF,CAAE,CAAC,CACF,CAAC,CAAEF,UAAW,CAAC;AAAAsB,OAAA,CAAAjB,OAAA,GAAAO,QAAA"}
1
+ {"version":3,"names":["_i18n","require","_components","_data","_check","_interopRequireDefault","_store","PostSticky","postSticky","useSelect","select","_select$getEditedPost","editorStore","getEditedPostAttribute","editPost","useDispatch","_react","createElement","default","CheckboxControl","__nextHasNoMarginBottom","label","__","checked","onChange","sticky"],"sources":["@wordpress/editor/src/components/post-sticky/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { CheckboxControl } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport PostStickyCheck from './check';\nimport { store as editorStore } from '../../store';\n\nexport default function PostSticky() {\n\tconst postSticky = useSelect( ( select ) => {\n\t\treturn (\n\t\t\tselect( editorStore ).getEditedPostAttribute( 'sticky' ) ?? false\n\t\t);\n\t}, [] );\n\tconst { editPost } = useDispatch( editorStore );\n\n\treturn (\n\t\t<PostStickyCheck>\n\t\t\t<CheckboxControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tlabel={ __( 'Stick to the top of the blog' ) }\n\t\t\t\tchecked={ postSticky }\n\t\t\t\tonChange={ () => editPost( { sticky: ! postSticky } ) }\n\t\t\t/>\n\t\t</PostStickyCheck>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AAKA,IAAAG,MAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAXA;AACA;AACA;;AAKA;AACA;AACA;;AAIe,SAASM,UAAUA,CAAA,EAAG;EACpC,MAAMC,UAAU,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IAAA,IAAAC,qBAAA;IAC3C,QAAAA,qBAAA,GACCD,MAAM,CAAEE,YAAY,CAAC,CAACC,sBAAsB,CAAE,QAAS,CAAC,cAAAF,qBAAA,cAAAA,qBAAA,GAAI,KAAK;EAEnE,CAAC,EAAE,EAAG,CAAC;EACP,MAAM;IAAEG;EAAS,CAAC,GAAG,IAAAC,iBAAW,EAAEH,YAAY,CAAC;EAE/C,OACC,IAAAI,MAAA,CAAAC,aAAA,EAACb,MAAA,CAAAc,OAAe,QACf,IAAAF,MAAA,CAAAC,aAAA,EAACf,WAAA,CAAAiB,eAAe;IACfC,uBAAuB;IACvBC,KAAK,EAAG,IAAAC,QAAE,EAAE,8BAA+B,CAAG;IAC9CC,OAAO,EAAGf,UAAY;IACtBgB,QAAQ,EAAGA,CAAA,KAAMV,QAAQ,CAAE;MAAEW,MAAM,EAAE,CAAEjB;IAAW,CAAE;EAAG,CACvD,CACe,CAAC;AAEpB"}
@@ -3,12 +3,12 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = void 0;
7
- var _element = require("@wordpress/element");
6
+ exports.default = PostSwitchToDraftButton;
7
+ var _react = require("react");
8
8
  var _components = require("@wordpress/components");
9
9
  var _i18n = require("@wordpress/i18n");
10
10
  var _data = require("@wordpress/data");
11
- var _compose = require("@wordpress/compose");
11
+ var _element = require("@wordpress/element");
12
12
  var _store = require("../../store");
13
13
  /**
14
14
  * WordPress dependencies
@@ -18,16 +18,29 @@ var _store = require("../../store");
18
18
  * Internal dependencies
19
19
  */
20
20
 
21
- function PostSwitchToDraftButton({
22
- isSaving,
23
- isPublished,
24
- isScheduled,
25
- onClick
26
- }) {
21
+ function PostSwitchToDraftButton() {
27
22
  const [showConfirmDialog, setShowConfirmDialog] = (0, _element.useState)(false);
28
- if (!isPublished && !isScheduled) {
29
- return null;
30
- }
23
+ const {
24
+ editPost,
25
+ savePost
26
+ } = (0, _data.useDispatch)(_store.store);
27
+ const {
28
+ isSaving,
29
+ isPublished,
30
+ isScheduled
31
+ } = (0, _data.useSelect)(select => {
32
+ const {
33
+ isSavingPost,
34
+ isCurrentPostPublished,
35
+ isCurrentPostScheduled
36
+ } = select(_store.store);
37
+ return {
38
+ isSaving: isSavingPost(),
39
+ isPublished: isCurrentPostPublished(),
40
+ isScheduled: isCurrentPostScheduled()
41
+ };
42
+ }, []);
43
+ const isDisabled = isSaving || !isPublished && !isScheduled;
31
44
  let alertMessage;
32
45
  if (isPublished) {
33
46
  alertMessage = (0, _i18n.__)('Are you sure you want to unpublish this post?');
@@ -36,49 +49,28 @@ function PostSwitchToDraftButton({
36
49
  }
37
50
  const handleConfirm = () => {
38
51
  setShowConfirmDialog(false);
39
- onClick();
52
+ editPost({
53
+ status: 'draft'
54
+ });
55
+ savePost();
40
56
  };
41
- return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_components.Button, {
57
+ return (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(_components.Button, {
42
58
  className: "editor-post-switch-to-draft",
43
59
  onClick: () => {
44
- setShowConfirmDialog(true);
60
+ if (!isDisabled) {
61
+ setShowConfirmDialog(true);
62
+ }
45
63
  },
46
- disabled: isSaving,
64
+ "aria-disabled": isDisabled,
47
65
  variant: "secondary",
48
66
  style: {
49
67
  flexGrow: '1',
50
68
  justifyContent: 'center'
51
69
  }
52
- }, (0, _i18n.__)('Switch to draft')), (0, _element.createElement)(_components.__experimentalConfirmDialog, {
70
+ }, (0, _i18n.__)('Switch to draft')), (0, _react.createElement)(_components.__experimentalConfirmDialog, {
53
71
  isOpen: showConfirmDialog,
54
72
  onConfirm: handleConfirm,
55
73
  onCancel: () => setShowConfirmDialog(false)
56
74
  }, alertMessage));
57
75
  }
58
- var _default = (0, _compose.compose)([(0, _data.withSelect)(select => {
59
- const {
60
- isSavingPost,
61
- isCurrentPostPublished,
62
- isCurrentPostScheduled
63
- } = select(_store.store);
64
- return {
65
- isSaving: isSavingPost(),
66
- isPublished: isCurrentPostPublished(),
67
- isScheduled: isCurrentPostScheduled()
68
- };
69
- }), (0, _data.withDispatch)(dispatch => {
70
- const {
71
- editPost,
72
- savePost
73
- } = dispatch(_store.store);
74
- return {
75
- onClick: () => {
76
- editPost({
77
- status: 'draft'
78
- });
79
- savePost();
80
- }
81
- };
82
- })])(PostSwitchToDraftButton);
83
- exports.default = _default;
84
76
  //# sourceMappingURL=index.js.map