@wordpress/editor 12.9.0 → 12.12.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 (224) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/build/components/document-outline/index.js +7 -9
  3. package/build/components/document-outline/index.js.map +1 -1
  4. package/build/components/editor-help/index.native.js.map +1 -1
  5. package/build/components/entities-saved-states/entity-record-item.js.map +1 -1
  6. package/build/components/entities-saved-states/index.js.map +1 -1
  7. package/build/components/error-boundary/index.js +3 -0
  8. package/build/components/error-boundary/index.js.map +1 -1
  9. package/build/components/global-keyboard-shortcuts/save-shortcut.js.map +1 -1
  10. package/build/components/index.js +61 -9
  11. package/build/components/index.js.map +1 -1
  12. package/build/components/local-autosave-monitor/index.js +24 -19
  13. package/build/components/local-autosave-monitor/index.js.map +1 -1
  14. package/build/components/page-attributes/order.js +3 -7
  15. package/build/components/page-attributes/order.js.map +1 -1
  16. package/build/components/page-attributes/parent.js +2 -2
  17. package/build/components/page-attributes/parent.js.map +1 -1
  18. package/build/components/post-author/select.js.map +1 -1
  19. package/build/components/post-comments/index.js.map +1 -1
  20. package/build/components/post-format/index.js +5 -8
  21. package/build/components/post-format/index.js.map +1 -1
  22. package/build/components/post-last-revision/check.js.map +1 -1
  23. package/build/components/post-last-revision/index.js.map +1 -1
  24. package/build/components/post-pending-status/check.js.map +1 -1
  25. package/build/components/post-pingbacks/index.js.map +1 -1
  26. package/build/components/post-publish-button/index.js +4 -2
  27. package/build/components/post-publish-button/index.js.map +1 -1
  28. package/build/components/post-publish-panel/index.js.map +1 -1
  29. package/build/components/post-publish-panel/maybe-category-panel.js +5 -5
  30. package/build/components/post-publish-panel/maybe-category-panel.js.map +1 -1
  31. package/build/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
  32. package/build/components/post-publish-panel/postpublish.js.map +1 -1
  33. package/build/components/post-publish-panel/prepublish.js.map +1 -1
  34. package/build/components/post-schedule/label.js +93 -13
  35. package/build/components/post-schedule/label.js.map +1 -1
  36. package/build/components/post-slug/index.js +8 -13
  37. package/build/components/post-slug/index.js.map +1 -1
  38. package/build/components/post-sticky/index.js.map +1 -1
  39. package/build/components/post-switch-to-draft-button/index.js.map +1 -1
  40. package/build/components/post-taxonomies/flat-term-selector.js +8 -4
  41. package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
  42. package/build/components/post-taxonomies/hierarchical-term-selector.js +1 -0
  43. package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
  44. package/build/components/post-taxonomies/index.js +3 -1
  45. package/build/components/post-taxonomies/index.js.map +1 -1
  46. package/build/components/post-template/index.js +1 -2
  47. package/build/components/post-template/index.js.map +1 -1
  48. package/build/components/post-title/index.js.map +1 -1
  49. package/build/components/post-title/index.native.js.map +1 -1
  50. package/build/components/post-trash/check.js.map +1 -1
  51. package/build/components/post-url/check.js +54 -0
  52. package/build/components/post-url/check.js.map +1 -0
  53. package/build/components/post-url/index.js +115 -0
  54. package/build/components/post-url/index.js.map +1 -0
  55. package/build/components/post-url/label.js +30 -0
  56. package/build/components/post-url/label.js.map +1 -0
  57. package/build/components/post-visibility/index.js +10 -11
  58. package/build/components/post-visibility/index.js.map +1 -1
  59. package/build/components/post-visibility/label.js +5 -0
  60. package/build/components/post-visibility/label.js.map +1 -1
  61. package/build/components/provider/index.js.map +1 -1
  62. package/build/components/provider/index.native.js +0 -1
  63. package/build/components/provider/index.native.js.map +1 -1
  64. package/build/components/provider/use-block-editor-settings.js +3 -1
  65. package/build/components/provider/use-block-editor-settings.js.map +1 -1
  66. package/build/components/table-of-contents/panel.js +5 -1
  67. package/build/components/table-of-contents/panel.js.map +1 -1
  68. package/build/components/template-validation-notice/index.js.map +1 -1
  69. package/build/components/theme-support-check/index.js +1 -1
  70. package/build/components/theme-support-check/index.js.map +1 -1
  71. package/build/components/time-to-read/index.js +60 -0
  72. package/build/components/time-to-read/index.js.map +1 -0
  73. package/build/hooks/custom-sources-backwards-compatibility.js.map +1 -1
  74. package/build/store/actions.js +5 -1
  75. package/build/store/actions.js.map +1 -1
  76. package/build/store/reducer.js +1 -1
  77. package/build/store/reducer.js.map +1 -1
  78. package/build/store/selectors.js +2 -2
  79. package/build/store/selectors.js.map +1 -1
  80. package/build/utils/media-upload/index.js +4 -8
  81. package/build/utils/media-upload/index.js.map +1 -1
  82. package/build-module/components/document-outline/index.js +7 -8
  83. package/build-module/components/document-outline/index.js.map +1 -1
  84. package/build-module/components/editor-help/index.native.js.map +1 -1
  85. package/build-module/components/entities-saved-states/entity-record-item.js.map +1 -1
  86. package/build-module/components/entities-saved-states/index.js.map +1 -1
  87. package/build-module/components/error-boundary/index.js +2 -0
  88. package/build-module/components/error-boundary/index.js.map +1 -1
  89. package/build-module/components/global-keyboard-shortcuts/save-shortcut.js.map +1 -1
  90. package/build-module/components/index.js +7 -4
  91. package/build-module/components/index.js.map +1 -1
  92. package/build-module/components/local-autosave-monitor/index.js +24 -18
  93. package/build-module/components/local-autosave-monitor/index.js.map +1 -1
  94. package/build-module/components/page-attributes/order.js +3 -6
  95. package/build-module/components/page-attributes/order.js.map +1 -1
  96. package/build-module/components/page-attributes/parent.js +3 -3
  97. package/build-module/components/page-attributes/parent.js.map +1 -1
  98. package/build-module/components/post-author/select.js.map +1 -1
  99. package/build-module/components/post-comments/index.js.map +1 -1
  100. package/build-module/components/post-format/index.js +5 -8
  101. package/build-module/components/post-format/index.js.map +1 -1
  102. package/build-module/components/post-last-revision/check.js.map +1 -1
  103. package/build-module/components/post-last-revision/index.js.map +1 -1
  104. package/build-module/components/post-pending-status/check.js.map +1 -1
  105. package/build-module/components/post-pingbacks/index.js.map +1 -1
  106. package/build-module/components/post-publish-button/index.js +4 -1
  107. package/build-module/components/post-publish-button/index.js.map +1 -1
  108. package/build-module/components/post-publish-panel/index.js.map +1 -1
  109. package/build-module/components/post-publish-panel/maybe-category-panel.js +5 -5
  110. package/build-module/components/post-publish-panel/maybe-category-panel.js.map +1 -1
  111. package/build-module/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
  112. package/build-module/components/post-publish-panel/postpublish.js.map +1 -1
  113. package/build-module/components/post-publish-panel/prepublish.js.map +1 -1
  114. package/build-module/components/post-schedule/label.js +90 -13
  115. package/build-module/components/post-schedule/label.js.map +1 -1
  116. package/build-module/components/post-slug/index.js +8 -14
  117. package/build-module/components/post-slug/index.js.map +1 -1
  118. package/build-module/components/post-sticky/index.js.map +1 -1
  119. package/build-module/components/post-switch-to-draft-button/index.js.map +1 -1
  120. package/build-module/components/post-taxonomies/flat-term-selector.js +8 -6
  121. package/build-module/components/post-taxonomies/flat-term-selector.js.map +1 -1
  122. package/build-module/components/post-taxonomies/hierarchical-term-selector.js +1 -2
  123. package/build-module/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
  124. package/build-module/components/post-taxonomies/index.js +4 -1
  125. package/build-module/components/post-taxonomies/index.js.map +1 -1
  126. package/build-module/components/post-template/index.js +1 -2
  127. package/build-module/components/post-template/index.js.map +1 -1
  128. package/build-module/components/post-title/index.js.map +1 -1
  129. package/build-module/components/post-title/index.native.js.map +1 -1
  130. package/build-module/components/post-trash/check.js.map +1 -1
  131. package/build-module/components/post-url/check.js +44 -0
  132. package/build-module/components/post-url/check.js.map +1 -0
  133. package/build-module/components/post-url/index.js +102 -0
  134. package/build-module/components/post-url/index.js.map +1 -0
  135. package/build-module/components/post-url/label.js +18 -0
  136. package/build-module/components/post-url/label.js.map +1 -0
  137. package/build-module/components/post-visibility/index.js +12 -13
  138. package/build-module/components/post-visibility/index.js.map +1 -1
  139. package/build-module/components/post-visibility/label.js +3 -0
  140. package/build-module/components/post-visibility/label.js.map +1 -1
  141. package/build-module/components/provider/index.js.map +1 -1
  142. package/build-module/components/provider/index.native.js +0 -1
  143. package/build-module/components/provider/index.native.js.map +1 -1
  144. package/build-module/components/provider/use-block-editor-settings.js +4 -2
  145. package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
  146. package/build-module/components/table-of-contents/panel.js +4 -1
  147. package/build-module/components/table-of-contents/panel.js.map +1 -1
  148. package/build-module/components/template-validation-notice/index.js.map +1 -1
  149. package/build-module/components/theme-support-check/index.js +2 -2
  150. package/build-module/components/theme-support-check/index.js.map +1 -1
  151. package/build-module/components/time-to-read/index.js +50 -0
  152. package/build-module/components/time-to-read/index.js.map +1 -0
  153. package/build-module/hooks/custom-sources-backwards-compatibility.js.map +1 -1
  154. package/build-module/store/actions.js +5 -1
  155. package/build-module/store/actions.js.map +1 -1
  156. package/build-module/store/reducer.js +2 -2
  157. package/build-module/store/reducer.js.map +1 -1
  158. package/build-module/store/selectors.js +3 -3
  159. package/build-module/store/selectors.js.map +1 -1
  160. package/build-module/utils/media-upload/index.js +3 -5
  161. package/build-module/utils/media-upload/index.js.map +1 -1
  162. package/build-style/style-rtl.css +12 -30
  163. package/build-style/style.css +15 -29
  164. package/package.json +28 -28
  165. package/src/components/document-outline/index.js +9 -8
  166. package/src/components/editor-help/index.native.js +6 -6
  167. package/src/components/entities-saved-states/entity-record-item.js +6 -6
  168. package/src/components/entities-saved-states/index.js +6 -9
  169. package/src/components/error-boundary/index.js +3 -0
  170. package/src/components/global-keyboard-shortcuts/save-shortcut.js +2 -3
  171. package/src/components/index.js +13 -4
  172. package/src/components/local-autosave-monitor/index.js +39 -38
  173. package/src/components/page-attributes/order.js +1 -9
  174. package/src/components/page-attributes/parent.js +6 -10
  175. package/src/components/post-author/select.js +2 -3
  176. package/src/components/post-comments/index.js +4 -3
  177. package/src/components/post-format/index.js +15 -22
  178. package/src/components/post-format/style.scss +2 -17
  179. package/src/components/post-last-revision/check.js +2 -4
  180. package/src/components/post-last-revision/index.js +2 -4
  181. package/src/components/post-pending-status/check.js +2 -5
  182. package/src/components/post-pingbacks/index.js +2 -3
  183. package/src/components/post-publish-button/index.js +7 -8
  184. package/src/components/post-publish-panel/index.js +2 -3
  185. package/src/components/post-publish-panel/maybe-category-panel.js +7 -5
  186. package/src/components/post-publish-panel/maybe-post-format-panel.js +2 -3
  187. package/src/components/post-publish-panel/postpublish.js +2 -5
  188. package/src/components/post-publish-panel/prepublish.js +2 -3
  189. package/src/components/post-publish-panel/test/__snapshots__/index.js.snap +1 -1
  190. package/src/components/post-schedule/label.js +111 -17
  191. package/src/components/post-schedule/test/label.js +127 -15
  192. package/src/components/post-slug/index.js +9 -16
  193. package/src/components/post-slug/test/index.js +7 -6
  194. package/src/components/post-sticky/index.js +2 -3
  195. package/src/components/post-switch-to-draft-button/index.js +2 -5
  196. package/src/components/post-taxonomies/flat-term-selector.js +10 -13
  197. package/src/components/post-taxonomies/hierarchical-term-selector.js +5 -7
  198. package/src/components/post-taxonomies/index.js +3 -1
  199. package/src/components/post-template/index.js +1 -1
  200. package/src/components/post-title/index.js +21 -31
  201. package/src/components/post-title/index.native.js +10 -16
  202. package/src/components/post-title/style.scss +1 -1
  203. package/src/components/post-trash/check.js +2 -3
  204. package/src/components/post-url/check.js +38 -0
  205. package/src/components/post-url/index.js +122 -0
  206. package/src/components/post-url/label.js +22 -0
  207. package/src/components/post-url/style.scss +16 -0
  208. package/src/components/post-visibility/index.js +11 -17
  209. package/src/components/post-visibility/label.js +4 -0
  210. package/src/components/post-visibility/style.scss +0 -17
  211. package/src/components/provider/index.js +2 -3
  212. package/src/components/provider/index.native.js +12 -17
  213. package/src/components/provider/use-block-editor-settings.js +4 -8
  214. package/src/components/table-of-contents/panel.js +7 -2
  215. package/src/components/template-validation-notice/index.js +2 -3
  216. package/src/components/theme-support-check/index.js +2 -2
  217. package/src/components/time-to-read/index.js +59 -0
  218. package/src/hooks/custom-sources-backwards-compatibility.js +45 -44
  219. package/src/store/actions.js +213 -190
  220. package/src/store/reducer.js +2 -2
  221. package/src/store/selectors.js +17 -25
  222. package/src/store/test/selectors.js +10 -13
  223. package/src/style.scss +1 -0
  224. package/src/utils/media-upload/index.js +2 -5
@@ -9,8 +9,6 @@ exports.default = void 0;
9
9
 
10
10
  var _element = require("@wordpress/element");
11
11
 
12
- var _lodash = require("lodash");
13
-
14
12
  var _compose = require("@wordpress/compose");
15
13
 
16
14
  var _data = require("@wordpress/data");
@@ -27,10 +25,6 @@ var _localAutosave = require("../../store/local-autosave");
27
25
 
28
26
  var _store = require("../../store");
29
27
 
30
- /**
31
- * External dependencies
32
- */
33
-
34
28
  /**
35
29
  * WordPress dependencies
36
30
  */
@@ -39,29 +33,36 @@ var _store = require("../../store");
39
33
  * Internal dependencies
40
34
  */
41
35
  const requestIdleCallback = window.requestIdleCallback ? window.requestIdleCallback : window.requestAnimationFrame;
36
+ let hasStorageSupport;
37
+ let uniqueId = 0;
42
38
  /**
43
39
  * Function which returns true if the current environment supports browser
44
40
  * sessionStorage, or false otherwise. The result of this function is cached and
45
41
  * reused in subsequent invocations.
46
42
  */
47
43
 
48
- const hasSessionStorageSupport = (0, _lodash.once)(() => {
49
- try {
50
- // Private Browsing in Safari 10 and earlier will throw an error when
51
- // attempting to set into sessionStorage. The test here is intentional in
52
- // causing a thrown error as condition bailing from local autosave.
53
- window.sessionStorage.setItem('__wpEditorTestSessionStorage', '');
54
- window.sessionStorage.removeItem('__wpEditorTestSessionStorage');
55
- return true;
56
- } catch (error) {
57
- return false;
44
+ const hasSessionStorageSupport = () => {
45
+ if (typeof hasStorageSupport === 'undefined') {
46
+ try {
47
+ // Private Browsing in Safari 10 and earlier will throw an error when
48
+ // attempting to set into sessionStorage. The test here is intentional in
49
+ // causing a thrown error as condition bailing from local autosave.
50
+ window.sessionStorage.setItem('__wpEditorTestSessionStorage', '');
51
+ window.sessionStorage.removeItem('__wpEditorTestSessionStorage');
52
+ hasStorageSupport = true;
53
+ } catch (error) {
54
+ hasStorageSupport = false;
55
+ }
58
56
  }
59
- });
57
+
58
+ return hasStorageSupport;
59
+ };
60
60
  /**
61
61
  * Custom hook which manages the creation of a notice prompting the user to
62
62
  * restore a local autosave, if one exists.
63
63
  */
64
64
 
65
+
65
66
  function useAutosaveNotice() {
66
67
  const {
67
68
  postId,
@@ -125,14 +126,18 @@ function useAutosaveNotice() {
125
126
  return;
126
127
  }
127
128
 
128
- const noticeId = (0, _lodash.uniqueId)('wpEditorAutosaveRestore');
129
+ const noticeId = `wpEditorAutosaveRestore${++uniqueId}`;
129
130
  createWarningNotice((0, _i18n.__)('The backup of this post in your browser is different from the version below.'), {
130
131
  id: noticeId,
131
132
  actions: [{
132
133
  label: (0, _i18n.__)('Restore the backup'),
133
134
 
134
135
  onClick() {
135
- editPost((0, _lodash.omit)(edits, ['content']));
136
+ const {
137
+ content: editsContent,
138
+ ...editsWithoutContent
139
+ } = edits;
140
+ editPost(editsWithoutContent);
136
141
  resetEditorBlocks((0, _blocks.parse)(edits.content));
137
142
  removeNotice(noticeId);
138
143
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/local-autosave-monitor/index.js"],"names":["requestIdleCallback","window","requestAnimationFrame","hasSessionStorageSupport","sessionStorage","setItem","removeItem","error","useAutosaveNotice","postId","isEditedPostNew","hasRemoteAutosave","select","editorStore","getCurrentPostId","getEditorSettings","autosave","getEditedPostAttribute","createWarningNotice","removeNotice","noticesStore","editPost","resetEditorBlocks","localAutosave","JSON","parse","post_title","title","content","excerpt","edits","hasDifference","Object","keys","some","key","noticeId","id","actions","label","onClick","useAutosavePurge","isDirty","isAutosaving","didError","isEditedPostDirty","isAutosavingPost","didPostSaveRequestFail","lastIsDirty","lastIsAutosaving","current","wasEditedPostNew","prevPostId","LocalAutosaveMonitor","deferredAutosave","local","localAutosaveInterval"],"mappings":";;;;;;;;;AAQA;;AALA;;AAMA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAIA;;AAvBA;AACA;AACA;;AAGA;AACA;AACA;;AAQA;AACA;AACA;AAQA,MAAMA,mBAAmB,GAAGC,MAAM,CAACD,mBAAP,GACzBC,MAAM,CAACD,mBADkB,GAEzBC,MAAM,CAACC,qBAFV;AAIA;AACA;AACA;AACA;AACA;;AACA,MAAMC,wBAAwB,GAAG,kBAAM,MAAM;AAC5C,MAAI;AACH;AACA;AACA;AACAF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,MAAM;AAC3CtD,IAAAA,mBAAmB,CAAE,MAAMgB,QAAQ,CAAE;AAAEuC,MAAAA,KAAK,EAAE;AAAT,KAAF,CAAhB,CAAnB;AACA,GAFwB,EAEtB,EAFsB,CAAzB;AAGA/C,EAAAA,iBAAiB;AACjBiC,EAAAA,gBAAgB;AAEhB,QAAM;AAAEe,IAAAA;AAAF,MAA4B,qBAC/B5C,MAAF,KAAgB;AACf4C,IAAAA,qBAAqB,EAAE5C,MAAM,CAAEC,YAAF,CAAN,CAAsBE,iBAAtB,GACrByC;AAFa,GAAhB,CADiC,EAKjC,EALiC,CAAlC;AAQA,SACC,4BAAC,wBAAD;AACC,IAAA,QAAQ,EAAGA,qBADZ;AAEC,IAAA,QAAQ,EAAGF;AAFZ,IADD;AAMA;;eAEc,0BAAanD,wBAAb,EAAyCkD,oBAAzC,C","sourcesContent":["/**\n * External dependencies\n */\nimport { once, uniqueId, omit } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useCallback, useEffect, useRef } from '@wordpress/element';\nimport { ifCondition, usePrevious } from '@wordpress/compose';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { parse } from '@wordpress/blocks';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport AutosaveMonitor from '../autosave-monitor';\nimport {\n\tlocalAutosaveGet,\n\tlocalAutosaveClear,\n} from '../../store/local-autosave';\nimport { store as editorStore } from '../../store';\n\nconst requestIdleCallback = window.requestIdleCallback\n\t? window.requestIdleCallback\n\t: window.requestAnimationFrame;\n\n/**\n * Function which returns true if the current environment supports browser\n * sessionStorage, or false otherwise. The result of this function is cached and\n * reused in subsequent invocations.\n */\nconst hasSessionStorageSupport = once( () => {\n\ttry {\n\t\t// Private Browsing in Safari 10 and earlier will throw an error when\n\t\t// attempting to set into sessionStorage. The test here is intentional in\n\t\t// causing a thrown error as condition bailing from local autosave.\n\t\twindow.sessionStorage.setItem( '__wpEditorTestSessionStorage', '' );\n\t\twindow.sessionStorage.removeItem( '__wpEditorTestSessionStorage' );\n\t\treturn true;\n\t} catch ( error ) {\n\t\treturn false;\n\t}\n} );\n\n/**\n * Custom hook which manages the creation of a notice prompting the user to\n * restore a local autosave, if one exists.\n */\nfunction useAutosaveNotice() {\n\tconst { postId, isEditedPostNew, hasRemoteAutosave } = useSelect(\n\t\t( select ) => ( {\n\t\t\tpostId: select( editorStore ).getCurrentPostId(),\n\t\t\tisEditedPostNew: select( editorStore ).isEditedPostNew(),\n\t\t\thasRemoteAutosave: !! select( editorStore ).getEditorSettings()\n\t\t\t\t.autosave,\n\t\t} ),\n\t\t[]\n\t);\n\tconst { getEditedPostAttribute } = useSelect( editorStore );\n\n\tconst { createWarningNotice, removeNotice } = useDispatch( noticesStore );\n\tconst { editPost, resetEditorBlocks } = useDispatch( editorStore );\n\n\tuseEffect( () => {\n\t\tlet localAutosave = localAutosaveGet( postId, isEditedPostNew );\n\t\tif ( ! localAutosave ) {\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tlocalAutosave = JSON.parse( localAutosave );\n\t\t} catch ( error ) {\n\t\t\t// Not usable if it can't be parsed.\n\t\t\treturn;\n\t\t}\n\n\t\tconst { post_title: title, content, excerpt } = localAutosave;\n\t\tconst edits = { title, content, excerpt };\n\n\t\t{\n\t\t\t// Only display a notice if there is a difference between what has been\n\t\t\t// saved and that which is stored in sessionStorage.\n\t\t\tconst hasDifference = Object.keys( edits ).some( ( key ) => {\n\t\t\t\treturn edits[ key ] !== getEditedPostAttribute( key );\n\t\t\t} );\n\n\t\t\tif ( ! hasDifference ) {\n\t\t\t\t// If there is no difference, it can be safely ejected from storage.\n\t\t\t\tlocalAutosaveClear( postId, isEditedPostNew );\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tif ( hasRemoteAutosave ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst noticeId = uniqueId( 'wpEditorAutosaveRestore' );\n\t\tcreateWarningNotice(\n\t\t\t__(\n\t\t\t\t'The backup of this post in your browser is different from the version below.'\n\t\t\t),\n\t\t\t{\n\t\t\t\tid: noticeId,\n\t\t\t\tactions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: __( 'Restore the backup' ),\n\t\t\t\t\t\tonClick() {\n\t\t\t\t\t\t\teditPost( omit( edits, [ 'content' ] ) );\n\t\t\t\t\t\t\tresetEditorBlocks( parse( edits.content ) );\n\t\t\t\t\t\t\tremoveNotice( noticeId );\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t}\n\t\t);\n\t}, [ isEditedPostNew, postId ] );\n}\n\n/**\n * Custom hook which ejects a local autosave after a successful save occurs.\n */\nfunction useAutosavePurge() {\n\tconst {\n\t\tpostId,\n\t\tisEditedPostNew,\n\t\tisDirty,\n\t\tisAutosaving,\n\t\tdidError,\n\t} = useSelect(\n\t\t( select ) => ( {\n\t\t\tpostId: select( editorStore ).getCurrentPostId(),\n\t\t\tisEditedPostNew: select( editorStore ).isEditedPostNew(),\n\t\t\tisDirty: select( editorStore ).isEditedPostDirty(),\n\t\t\tisAutosaving: select( editorStore ).isAutosavingPost(),\n\t\t\tdidError: select( editorStore ).didPostSaveRequestFail(),\n\t\t} ),\n\t\t[]\n\t);\n\n\tconst lastIsDirty = useRef( isDirty );\n\tconst lastIsAutosaving = useRef( isAutosaving );\n\n\tuseEffect( () => {\n\t\tif (\n\t\t\t! didError &&\n\t\t\t( ( lastIsAutosaving.current && ! isAutosaving ) ||\n\t\t\t\t( lastIsDirty.current && ! isDirty ) )\n\t\t) {\n\t\t\tlocalAutosaveClear( postId, isEditedPostNew );\n\t\t}\n\n\t\tlastIsDirty.current = isDirty;\n\t\tlastIsAutosaving.current = isAutosaving;\n\t}, [ isDirty, isAutosaving, didError ] );\n\n\t// Once the isEditedPostNew changes from true to false, let's clear the auto-draft autosave.\n\tconst wasEditedPostNew = usePrevious( isEditedPostNew );\n\tconst prevPostId = usePrevious( postId );\n\tuseEffect( () => {\n\t\tif ( prevPostId === postId && wasEditedPostNew && ! isEditedPostNew ) {\n\t\t\tlocalAutosaveClear( postId, true );\n\t\t}\n\t}, [ isEditedPostNew, postId ] );\n}\n\nfunction LocalAutosaveMonitor() {\n\tconst { autosave } = useDispatch( editorStore );\n\tconst deferredAutosave = useCallback( () => {\n\t\trequestIdleCallback( () => autosave( { local: true } ) );\n\t}, [] );\n\tuseAutosaveNotice();\n\tuseAutosavePurge();\n\n\tconst { localAutosaveInterval } = useSelect(\n\t\t( select ) => ( {\n\t\t\tlocalAutosaveInterval: select( editorStore ).getEditorSettings()\n\t\t\t\t.localAutosaveInterval,\n\t\t} ),\n\t\t[]\n\t);\n\n\treturn (\n\t\t<AutosaveMonitor\n\t\t\tinterval={ localAutosaveInterval }\n\t\t\tautosave={ deferredAutosave }\n\t\t/>\n\t);\n}\n\nexport default ifCondition( hasSessionStorageSupport )( LocalAutosaveMonitor );\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/local-autosave-monitor/index.js"],"names":["requestIdleCallback","window","requestAnimationFrame","hasStorageSupport","uniqueId","hasSessionStorageSupport","sessionStorage","setItem","removeItem","error","useAutosaveNotice","postId","isEditedPostNew","hasRemoteAutosave","select","editorStore","getCurrentPostId","getEditorSettings","autosave","getEditedPostAttribute","createWarningNotice","removeNotice","noticesStore","editPost","resetEditorBlocks","localAutosave","JSON","parse","post_title","title","content","excerpt","edits","hasDifference","Object","keys","some","key","noticeId","id","actions","label","onClick","editsContent","editsWithoutContent","useAutosavePurge","isDirty","isAutosaving","didError","isEditedPostDirty","isAutosavingPost","didPostSaveRequestFail","lastIsDirty","lastIsAutosaving","current","wasEditedPostNew","prevPostId","LocalAutosaveMonitor","deferredAutosave","local","localAutosaveInterval"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAIA;;AAlBA;AACA;AACA;;AAQA;AACA;AACA;AAQA,MAAMA,mBAAmB,GAAGC,MA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,eAAb,CAAzB;AACA,QAAM4C,UAAU,GAAG,0BAAa7C,MAAb,CAAnB;AACA,0BAAW,MAAM;AAChB,QAAK6C,UAAU,KAAK7C,MAAf,IAAyB4C,gBAAzB,IAA6C,CAAE3C,eAApD,EAAsE;AACrE,6CAAoBD,MAApB,EAA4B,IAA5B;AACA;AACD,GAJD,EAIG,CAAEC,eAAF,EAAmBD,MAAnB,CAJH;AAKA;;AAED,SAAS8C,oBAAT,GAAgC;AAC/B,QAAM;AAAEvC,IAAAA;AAAF,MAAe,uBAAaH,YAAb,CAArB;AACA,QAAM2C,gBAAgB,GAAG,0BAAa,MAAM;AAC3C1D,IAAAA,mBAAmB,CAAE,MAAMkB,QAAQ,CAAE;AAAEyC,MAAAA,KAAK,EAAE;AAAT,KAAF,CAAhB,CAAnB;AACA,GAFwB,EAEtB,EAFsB,CAAzB;AAGAjD,EAAAA,iBAAiB;AACjBmC,EAAAA,gBAAgB;AAEhB,QAAM;AAAEe,IAAAA;AAAF,MAA4B,qBAC/B9C,MAAF,KAAgB;AACf8C,IAAAA,qBAAqB,EACpB9C,MAAM,CAAEC,YAAF,CAAN,CAAsBE,iBAAtB,GAA0C2C;AAF5B,GAAhB,CADiC,EAKjC,EALiC,CAAlC;AAQA,SACC,4BAAC,wBAAD;AACC,IAAA,QAAQ,EAAGA,qBADZ;AAEC,IAAA,QAAQ,EAAGF;AAFZ,IADD;AAMA;;eAEc,0BAAarD,wBAAb,EAAyCoD,oBAAzC,C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useCallback, useEffect, useRef } from '@wordpress/element';\nimport { ifCondition, usePrevious } from '@wordpress/compose';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { parse } from '@wordpress/blocks';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport AutosaveMonitor from '../autosave-monitor';\nimport {\n\tlocalAutosaveGet,\n\tlocalAutosaveClear,\n} from '../../store/local-autosave';\nimport { store as editorStore } from '../../store';\n\nconst requestIdleCallback = window.requestIdleCallback\n\t? window.requestIdleCallback\n\t: window.requestAnimationFrame;\n\nlet hasStorageSupport;\nlet uniqueId = 0;\n\n/**\n * Function which returns true if the current environment supports browser\n * sessionStorage, or false otherwise. The result of this function is cached and\n * reused in subsequent invocations.\n */\nconst hasSessionStorageSupport = () => {\n\tif ( typeof hasStorageSupport === 'undefined' ) {\n\t\ttry {\n\t\t\t// Private Browsing in Safari 10 and earlier will throw an error when\n\t\t\t// attempting to set into sessionStorage. The test here is intentional in\n\t\t\t// causing a thrown error as condition bailing from local autosave.\n\t\t\twindow.sessionStorage.setItem( '__wpEditorTestSessionStorage', '' );\n\t\t\twindow.sessionStorage.removeItem( '__wpEditorTestSessionStorage' );\n\t\t\thasStorageSupport = true;\n\t\t} catch ( error ) {\n\t\t\thasStorageSupport = false;\n\t\t}\n\t}\n\n\treturn hasStorageSupport;\n};\n\n/**\n * Custom hook which manages the creation of a notice prompting the user to\n * restore a local autosave, if one exists.\n */\nfunction useAutosaveNotice() {\n\tconst { postId, isEditedPostNew, hasRemoteAutosave } = useSelect(\n\t\t( select ) => ( {\n\t\t\tpostId: select( editorStore ).getCurrentPostId(),\n\t\t\tisEditedPostNew: select( editorStore ).isEditedPostNew(),\n\t\t\thasRemoteAutosave:\n\t\t\t\t!! select( editorStore ).getEditorSettings().autosave,\n\t\t} ),\n\t\t[]\n\t);\n\tconst { getEditedPostAttribute } = useSelect( editorStore );\n\n\tconst { createWarningNotice, removeNotice } = useDispatch( noticesStore );\n\tconst { editPost, resetEditorBlocks } = useDispatch( editorStore );\n\n\tuseEffect( () => {\n\t\tlet localAutosave = localAutosaveGet( postId, isEditedPostNew );\n\t\tif ( ! localAutosave ) {\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tlocalAutosave = JSON.parse( localAutosave );\n\t\t} catch ( error ) {\n\t\t\t// Not usable if it can't be parsed.\n\t\t\treturn;\n\t\t}\n\n\t\tconst { post_title: title, content, excerpt } = localAutosave;\n\t\tconst edits = { title, content, excerpt };\n\n\t\t{\n\t\t\t// Only display a notice if there is a difference between what has been\n\t\t\t// saved and that which is stored in sessionStorage.\n\t\t\tconst hasDifference = Object.keys( edits ).some( ( key ) => {\n\t\t\t\treturn edits[ key ] !== getEditedPostAttribute( key );\n\t\t\t} );\n\n\t\t\tif ( ! hasDifference ) {\n\t\t\t\t// If there is no difference, it can be safely ejected from storage.\n\t\t\t\tlocalAutosaveClear( postId, isEditedPostNew );\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tif ( hasRemoteAutosave ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst noticeId = `wpEditorAutosaveRestore${ ++uniqueId }`;\n\t\tcreateWarningNotice(\n\t\t\t__(\n\t\t\t\t'The backup of this post in your browser is different from the version below.'\n\t\t\t),\n\t\t\t{\n\t\t\t\tid: noticeId,\n\t\t\t\tactions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: __( 'Restore the backup' ),\n\t\t\t\t\t\tonClick() {\n\t\t\t\t\t\t\tconst {\n\t\t\t\t\t\t\t\tcontent: editsContent,\n\t\t\t\t\t\t\t\t...editsWithoutContent\n\t\t\t\t\t\t\t} = edits;\n\t\t\t\t\t\t\teditPost( editsWithoutContent );\n\t\t\t\t\t\t\tresetEditorBlocks( parse( edits.content ) );\n\t\t\t\t\t\t\tremoveNotice( noticeId );\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t}\n\t\t);\n\t}, [ isEditedPostNew, postId ] );\n}\n\n/**\n * Custom hook which ejects a local autosave after a successful save occurs.\n */\nfunction useAutosavePurge() {\n\tconst { postId, isEditedPostNew, isDirty, isAutosaving, didError } =\n\t\tuseSelect(\n\t\t\t( select ) => ( {\n\t\t\t\tpostId: select( editorStore ).getCurrentPostId(),\n\t\t\t\tisEditedPostNew: select( editorStore ).isEditedPostNew(),\n\t\t\t\tisDirty: select( editorStore ).isEditedPostDirty(),\n\t\t\t\tisAutosaving: select( editorStore ).isAutosavingPost(),\n\t\t\t\tdidError: select( editorStore ).didPostSaveRequestFail(),\n\t\t\t} ),\n\t\t\t[]\n\t\t);\n\n\tconst lastIsDirty = useRef( isDirty );\n\tconst lastIsAutosaving = useRef( isAutosaving );\n\n\tuseEffect( () => {\n\t\tif (\n\t\t\t! didError &&\n\t\t\t( ( lastIsAutosaving.current && ! isAutosaving ) ||\n\t\t\t\t( lastIsDirty.current && ! isDirty ) )\n\t\t) {\n\t\t\tlocalAutosaveClear( postId, isEditedPostNew );\n\t\t}\n\n\t\tlastIsDirty.current = isDirty;\n\t\tlastIsAutosaving.current = isAutosaving;\n\t}, [ isDirty, isAutosaving, didError ] );\n\n\t// Once the isEditedPostNew changes from true to false, let's clear the auto-draft autosave.\n\tconst wasEditedPostNew = usePrevious( isEditedPostNew );\n\tconst prevPostId = usePrevious( postId );\n\tuseEffect( () => {\n\t\tif ( prevPostId === postId && wasEditedPostNew && ! isEditedPostNew ) {\n\t\t\tlocalAutosaveClear( postId, true );\n\t\t}\n\t}, [ isEditedPostNew, postId ] );\n}\n\nfunction LocalAutosaveMonitor() {\n\tconst { autosave } = useDispatch( editorStore );\n\tconst deferredAutosave = useCallback( () => {\n\t\trequestIdleCallback( () => autosave( { local: true } ) );\n\t}, [] );\n\tuseAutosaveNotice();\n\tuseAutosavePurge();\n\n\tconst { localAutosaveInterval } = useSelect(\n\t\t( select ) => ( {\n\t\t\tlocalAutosaveInterval:\n\t\t\t\tselect( editorStore ).getEditorSettings().localAutosaveInterval,\n\t\t} ),\n\t\t[]\n\t);\n\n\treturn (\n\t\t<AutosaveMonitor\n\t\t\tinterval={ localAutosaveInterval }\n\t\t\tautosave={ deferredAutosave }\n\t\t/>\n\t);\n}\n\nexport default ifCondition( hasSessionStorageSupport )( LocalAutosaveMonitor );\n"]}
@@ -9,8 +9,6 @@ exports.default = exports.PageAttributesOrder = void 0;
9
9
 
10
10
  var _element = require("@wordpress/element");
11
11
 
12
- var _lodash = require("lodash");
13
-
14
12
  var _i18n = require("@wordpress/i18n");
15
13
 
16
14
  var _components = require("@wordpress/components");
@@ -23,10 +21,6 @@ var _postTypeSupportCheck = _interopRequireDefault(require("../post-type-support
23
21
 
24
22
  var _store = require("../../store");
25
23
 
26
- /**
27
- * External dependencies
28
- */
29
-
30
24
  /**
31
25
  * WordPress dependencies
32
26
  */
@@ -42,10 +36,12 @@ const PageAttributesOrder = _ref => {
42
36
  const [orderInput, setOrderInput] = (0, _element.useState)(null);
43
37
 
44
38
  const setUpdatedOrder = value => {
39
+ var _value$trim;
40
+
45
41
  setOrderInput(value);
46
42
  const newOrder = Number(value);
47
43
 
48
- if (Number.isInteger(newOrder) && (0, _lodash.invoke)(value, ['trim']) !== '') {
44
+ if (Number.isInteger(newOrder) && ((_value$trim = value.trim) === null || _value$trim === void 0 ? void 0 : _value$trim.call(value)) !== '') {
49
45
  onUpdateOrder(Number(value));
50
46
  }
51
47
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/page-attributes/order.js"],"names":["PageAttributesOrder","onUpdateOrder","order","orderInput","setOrderInput","setUpdatedOrder","value","newOrder","Number","isInteger","PageAttributesOrderWithChecks","props","select","editorStore","getEditedPostAttribute","dispatch","editPost","menu_order"],"mappings":";;;;;;;;;AAYA;;AATA;;AAKA;;AACA;;AACA;;AACA;;AAMA;;AACA;;AAlBA;AACA;AACA;;AAGA;AACA;AACA;;AAOA;AACA;AACA;AAIO,MAAMA,mBAAmB,GAAG,QAAoC;AAAA,MAAlC;AAAEC,IAAAA,aAAF;AAAiBC,IAAAA,KAAK,GAAG;AAAzB,GAAkC;AACtE,QAAM,CAAEC,UAAF,EAAcC,aAAd,IAAgC,uBAAU,IAAV,CAAtC;;AAEA,QAAMC,eAAe,GAAKC,KAAF,IAAa;AACpCF,IAAAA,aAAa,CAAEE,KAAF,CAAb;AACA,UAAMC,QAAQ,GAAGC,MAAM,CAAEF,KAAF,CAAvB;;AACA,QACCE,MAAM,CAACC,SAAP,CAAkBF,QAAlB,KACA,oBAAQD,KAAR,EAAe,CAAE,MAAF,CAAf,MAAgC,EAFjC,EAGE;AACDL,MAAAA,aAAa,CAAEO,MAAM,CAAEF,KAAF,CAAR,CAAb;AACA;AACD,GATD;;AAUA,QAAMA,KAAK,GAAGH,UAAU,KAAK,IAAf,GAAsBD,KAAtB,GAA8BC,UAA5C;AACA,SACC,4BAAC,uBAAD;AACC,IAAA,SAAS,EAAC,+BADX;AAEC,IAAA,IAAI,EAAC,QAFN;AAGC,IAAA,KAAK,EAAG,cAAI,OAAJ,CAHT;AAIC,IAAA,KAAK,EAAGG,KAJT;AAKC,IAAA,QAAQ,EAAGD,eALZ;AAMC,IAAA,IAAI,EAAG,CANR;AAOC,IAAA,MAAM,EAAG,MAAM;AACdD,MAAAA,aAAa,CAAE,IAAF,CAAb;AACA;AATF,IADD;AAaA,CA3BM;;;;AA6BP,SAASM,6BAAT,CAAwCC,KAAxC,EAAgD;AAC/C,SACC,4BAAC,6BAAD;AAAsB,IAAA,WAAW,EAAC;AAAlC,KACC,4BAAC,mBAAD,EAA0BA,KAA1B,CADD,CADD;AAKA;;eAEc,sBAAS,CACvB,sBAAcC,MAAF,IAAc;AACzB,SAAO;AACNV,IAAAA,KAAK,EAAEU,MAAM,CAAEC,YAAF,CAAN,CAAsBC,sBAAtB,CAA8C,YAA9C;AADD,GAAP;AAGA,CAJD,CADuB,EAMvB,wBAAgBC,QAAF,KAAkB;AAC/Bd,EAAAA,aAAa,CAAEC,KAAF,EAAU;AACtBa,IAAAA,QAAQ,CAAEF,YAAF,CAAR,CAAwBG,QAAxB,CAAkC;AACjCC,MAAAA,UAAU,EAAEf;AADqB,KAAlC;AAGA;;AAL8B,CAAlB,CAAd,CANuB,CAAT,EAaVQ,6BAbU,C","sourcesContent":["/**\n * External dependencies\n */\nimport { invoke } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { TextControl } from '@wordpress/components';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport PostTypeSupportCheck from '../post-type-support-check';\nimport { store as editorStore } from '../../store';\n\nexport const PageAttributesOrder = ( { onUpdateOrder, order = 0 } ) => {\n\tconst [ orderInput, setOrderInput ] = useState( null );\n\n\tconst setUpdatedOrder = ( value ) => {\n\t\tsetOrderInput( value );\n\t\tconst newOrder = Number( value );\n\t\tif (\n\t\t\tNumber.isInteger( newOrder ) &&\n\t\t\tinvoke( value, [ 'trim' ] ) !== ''\n\t\t) {\n\t\t\tonUpdateOrder( Number( value ) );\n\t\t}\n\t};\n\tconst value = orderInput === null ? order : orderInput;\n\treturn (\n\t\t<TextControl\n\t\t\tclassName=\"editor-page-attributes__order\"\n\t\t\ttype=\"number\"\n\t\t\tlabel={ __( 'Order' ) }\n\t\t\tvalue={ value }\n\t\t\tonChange={ setUpdatedOrder }\n\t\t\tsize={ 6 }\n\t\t\tonBlur={ () => {\n\t\t\t\tsetOrderInput( null );\n\t\t\t} }\n\t\t/>\n\t);\n};\n\nfunction PageAttributesOrderWithChecks( props ) {\n\treturn (\n\t\t<PostTypeSupportCheck supportKeys=\"page-attributes\">\n\t\t\t<PageAttributesOrder { ...props } />\n\t\t</PostTypeSupportCheck>\n\t);\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\treturn {\n\t\t\torder: select( editorStore ).getEditedPostAttribute( 'menu_order' ),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => ( {\n\t\tonUpdateOrder( order ) {\n\t\t\tdispatch( editorStore ).editPost( {\n\t\t\t\tmenu_order: order,\n\t\t\t} );\n\t\t},\n\t} ) ),\n] )( PageAttributesOrderWithChecks );\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/page-attributes/order.js"],"names":["PageAttributesOrder","onUpdateOrder","order","orderInput","setOrderInput","setUpdatedOrder","value","newOrder","Number","isInteger","trim","PageAttributesOrderWithChecks","props","select","editorStore","getEditedPostAttribute","dispatch","editPost","menu_order"],"mappings":";;;;;;;;;AAOA;;AAJA;;AACA;;AACA;;AACA;;AAMA;;AACA;;AAbA;AACA;AACA;;AAOA;AACA;AACA;AAIO,MAAMA,mBAAmB,GAAG,QAAoC;AAAA,MAAlC;AAAEC,IAAAA,aAAF;AAAiBC,IAAAA,KAAK,GAAG;AAAzB,GAAkC;AACtE,QAAM,CAAEC,UAAF,EAAcC,aAAd,IAAgC,uBAAU,IAAV,CAAtC;;AAEA,QAAMC,eAAe,GAAKC,KAAF,IAAa;AAAA;;AACpCF,IAAAA,aAAa,CAAEE,KAAF,CAAb;AACA,UAAMC,QAAQ,GAAGC,MAAM,CAAEF,KAAF,CAAvB;;AACA,QAAKE,MAAM,CAACC,SAAP,CAAkBF,QAAlB,KAAgC,gBAAAD,KAAK,CAACI,IAAN,iEAAAJ,KAAK,OAAc,EAAxD,EAA6D;AAC5DL,MAAAA,aAAa,CAAEO,MAAM,CAAEF,KAAF,CAAR,CAAb;AACA;AACD,GAND;;AAOA,QAAMA,KAAK,GAAGH,UAAU,KAAK,IAAf,GAAsBD,KAAtB,GAA8BC,UAA5C;AACA,SACC,4BAAC,uBAAD;AACC,IAAA,SAAS,EAAC,+BADX;AAEC,IAAA,IAAI,EAAC,QAFN;AAGC,IAAA,KAAK,EAAG,cAAI,OAAJ,CAHT;AAIC,IAAA,KAAK,EAAGG,KAJT;AAKC,IAAA,QAAQ,EAAGD,eALZ;AAMC,IAAA,IAAI,EAAG,CANR;AAOC,IAAA,MAAM,EAAG,MAAM;AACdD,MAAAA,aAAa,CAAE,IAAF,CAAb;AACA;AATF,IADD;AAaA,CAxBM;;;;AA0BP,SAASO,6BAAT,CAAwCC,KAAxC,EAAgD;AAC/C,SACC,4BAAC,6BAAD;AAAsB,IAAA,WAAW,EAAC;AAAlC,KACC,4BAAC,mBAAD,EAA0BA,KAA1B,CADD,CADD;AAKA;;eAEc,sBAAS,CACvB,sBAAcC,MAAF,IAAc;AACzB,SAAO;AACNX,IAAAA,KAAK,EAAEW,MAAM,CAAEC,YAAF,CAAN,CAAsBC,sBAAtB,CAA8C,YAA9C;AADD,GAAP;AAGA,CAJD,CADuB,EAMvB,wBAAgBC,QAAF,KAAkB;AAC/Bf,EAAAA,aAAa,CAAEC,KAAF,EAAU;AACtBc,IAAAA,QAAQ,CAAEF,YAAF,CAAR,CAAwBG,QAAxB,CAAkC;AACjCC,MAAAA,UAAU,EAAEhB;AADqB,KAAlC;AAGA;;AAL8B,CAAlB,CAAd,CANuB,CAAT,EAaVS,6BAbU,C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { TextControl } from '@wordpress/components';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport PostTypeSupportCheck from '../post-type-support-check';\nimport { store as editorStore } from '../../store';\n\nexport const PageAttributesOrder = ( { onUpdateOrder, order = 0 } ) => {\n\tconst [ orderInput, setOrderInput ] = useState( null );\n\n\tconst setUpdatedOrder = ( value ) => {\n\t\tsetOrderInput( value );\n\t\tconst newOrder = Number( value );\n\t\tif ( Number.isInteger( newOrder ) && value.trim?.() !== '' ) {\n\t\t\tonUpdateOrder( Number( value ) );\n\t\t}\n\t};\n\tconst value = orderInput === null ? order : orderInput;\n\treturn (\n\t\t<TextControl\n\t\t\tclassName=\"editor-page-attributes__order\"\n\t\t\ttype=\"number\"\n\t\t\tlabel={ __( 'Order' ) }\n\t\t\tvalue={ value }\n\t\t\tonChange={ setUpdatedOrder }\n\t\t\tsize={ 6 }\n\t\t\tonBlur={ () => {\n\t\t\t\tsetOrderInput( null );\n\t\t\t} }\n\t\t/>\n\t);\n};\n\nfunction PageAttributesOrderWithChecks( props ) {\n\treturn (\n\t\t<PostTypeSupportCheck supportKeys=\"page-attributes\">\n\t\t\t<PageAttributesOrder { ...props } />\n\t\t</PostTypeSupportCheck>\n\t);\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\treturn {\n\t\t\torder: select( editorStore ).getEditedPostAttribute( 'menu_order' ),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => ( {\n\t\tonUpdateOrder( order ) {\n\t\t\tdispatch( editorStore ).editPost( {\n\t\t\t\tmenu_order: order,\n\t\t\t} );\n\t\t},\n\t} ) ),\n] )( PageAttributesOrderWithChecks );\n"]}
@@ -111,7 +111,7 @@ function PageAttributesParent() {
111
111
  let level = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
112
112
  const mappedNodes = tree.map(treeNode => [{
113
113
  value: treeNode.id,
114
- label: (0, _lodash.repeat)('— ', level) + (0, _lodash.unescape)(treeNode.name),
114
+ label: '— '.repeat(level) + (0, _lodash.unescape)(treeNode.name),
115
115
  rawName: treeNode.name
116
116
  }, ...getOptionsFromTree(treeNode.children || [], level + 1)]);
117
117
  const sortedNodes = mappedNodes.sort((_ref, _ref2) => {
@@ -121,7 +121,7 @@ function PageAttributesParent() {
121
121
  const priorityB = getItemPriority(b.rawName, fieldValue);
122
122
  return priorityA >= priorityB ? 1 : -1;
123
123
  });
124
- return (0, _lodash.flatten)(sortedNodes);
124
+ return sortedNodes.flat();
125
125
  };
126
126
 
127
127
  let tree = pageItems.map(item => ({
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/page-attributes/parent.js"],"names":["getTitle","post","title","rendered","id","getItemPriority","name","searchValue","normalizedName","toLowerCase","normalizedSearch","startsWith","length","Infinity","PageAttributesParent","editPost","editorStore","fieldValue","setFieldValue","parentPost","parentPostId","items","postType","select","getPostType","getEntityRecords","getEntityRecord","coreStore","getCurrentPostId","getEditedPostAttribute","postTypeSlug","pageId","pType","postId","isHierarchical","query","per_page","exclude","parent_exclude","orderby","order","_fields","search","parentPageLabel","pageItems","parentOptions","getOptionsFromTree","tree","level","mappedNodes","map","treeNode","value","label","rawName","children","sortedNodes","sort","a","b","priorityA","priorityB","item","parent","opts","optsHasParent","unshift","handleKeydown","inputValue","handleChange","selectedPostId"],"mappings":";;;;;;;;AAkBA;;AAfA;;AAaA;;AACA;;AAEA;;AACA;;AACA;;AAKA;;AACA;;AA3BA;AACA;AACA;;AAWA;AACA;AACA;;AAQA;AACA;AACA;AAIA,SAASA,QAAT,CAAmBC,IAAnB,EAA0B;AAAA;;AACzB,SAAOA,IAAI,SAAJ,IAAAA,IAAI,WAAJ,mBAAAA,IAAI,CAAEC,KAAN,oDAAaC,QAAb,GACJ,kCAAgBF,IAAI,CAACC,KAAL,CAAWC,QAA3B,CADI,GAEH,IAAIF,IAAI,CAACG,EAAI,KAAK,cAAI,UAAJ,CAAkB,GAFxC;AAGA;;AAEM,MAAMC,eAAe,GAAG,CAAEC,IAAF,EAAQC,WAAR,KAAyB;AACvD,QAAMC,cAAc,GAAG,oBAAQF,IAAR,EAAeG,WAAf,EAAvB;AACA,QAAMC,gBAAgB,GAAG,oBAAQH,WAAR,EAAsBE,WAAtB,EAAzB;;AACA,MAAKD,cAAc,KAAKE,gBAAxB,EAA2C;AAC1C,WAAO,CAAP;AACA;;AAED,MAAKF,cAAc,CAACG,UAAf,CAA2BD,gBAA3B,CAAL,EAAqD;AACpD,WAAOF,cAAc,CAACI,MAAtB;AACA;;AAED,SAAOC,QAAP;AACA,CAZM;;;;AAcA,SAASC,oBAAT,GAAgC;AACtC,QAAM;AAAEC,IAAAA;AAAF,MAAe,uBAAaC,YAAb,CAArB;AACA,QAAM,CAAEC,UAAF,EAAcC,aAAd,IAAgC,uBAAU,KAAV,CAAtC;AACA,QAAM;AAAEC,IAAAA,UAAF;AAAcC,IAAAA,YAAd;AAA4BC,IAAAA,KAA5B;AAAmCC,IAAAA;AAAnC,MAAgD,qBACnDC,MAAF,IAAc;AACb,UAAM;AAAEC,MAAAA,WAAF;AAAeC,MAAAA,gBAAf;AAAiCC,MAAAA;AAAjC,QAAqDH,MAAM,CAChEI,eADgE,CAAjE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n\trepeat,\n\tfind,\n\tflatten,\n\tdeburr,\n} from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { ComboboxControl } from '@wordpress/components';\nimport { useState, useMemo } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { buildTermsTree } from '../../utils/terms';\nimport { store as editorStore } from '../../store';\n\nfunction getTitle( post ) {\n\treturn post?.title?.rendered\n\t\t? decodeEntities( post.title.rendered )\n\t\t: `#${ post.id } (${ __( 'no title' ) })`;\n}\n\nexport const getItemPriority = ( name, searchValue ) => {\n\tconst normalizedName = deburr( name ).toLowerCase();\n\tconst normalizedSearch = deburr( searchValue ).toLowerCase();\n\tif ( normalizedName === normalizedSearch ) {\n\t\treturn 0;\n\t}\n\n\tif ( normalizedName.startsWith( normalizedSearch ) ) {\n\t\treturn normalizedName.length;\n\t}\n\n\treturn Infinity;\n};\n\nexport function PageAttributesParent() {\n\tconst { editPost } = useDispatch( editorStore );\n\tconst [ fieldValue, setFieldValue ] = useState( false );\n\tconst { parentPost, parentPostId, items, postType } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getPostType, getEntityRecords, getEntityRecord } = select(\n\t\t\t\tcoreStore\n\t\t\t);\n\t\t\tconst { getCurrentPostId, getEditedPostAttribute } = select(\n\t\t\t\teditorStore\n\t\t\t);\n\t\t\tconst postTypeSlug = getEditedPostAttribute( 'type' );\n\t\t\tconst pageId = getEditedPostAttribute( 'parent' );\n\t\t\tconst pType = getPostType( postTypeSlug );\n\t\t\tconst postId = getCurrentPostId();\n\t\t\tconst isHierarchical = get( pType, [ 'hierarchical' ], false );\n\t\t\tconst query = {\n\t\t\t\tper_page: 100,\n\t\t\t\texclude: postId,\n\t\t\t\tparent_exclude: postId,\n\t\t\t\torderby: 'menu_order',\n\t\t\t\torder: 'asc',\n\t\t\t\t_fields: 'id,title,parent',\n\t\t\t};\n\n\t\t\t// Perform a search when the field is changed.\n\t\t\tif ( !! fieldValue ) {\n\t\t\t\tquery.search = fieldValue;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tparentPostId: pageId,\n\t\t\t\tparentPost: pageId\n\t\t\t\t\t? getEntityRecord( 'postType', postTypeSlug, pageId )\n\t\t\t\t\t: null,\n\t\t\t\titems: isHierarchical\n\t\t\t\t\t? getEntityRecords( 'postType', postTypeSlug, query )\n\t\t\t\t\t: [],\n\t\t\t\tpostType: pType,\n\t\t\t};\n\t\t},\n\t\t[ fieldValue ]\n\t);\n\n\tconst isHierarchical = get( postType, [ 'hierarchical' ], false );\n\tconst parentPageLabel = get( postType, [ 'labels', 'parent_item_colon' ] );\n\tconst pageItems = items || [];\n\n\tconst parentOptions = useMemo( () => {\n\t\tconst getOptionsFromTree = ( tree, level = 0 ) => {\n\t\t\tconst mappedNodes = tree.map( ( treeNode ) => [\n\t\t\t\t{\n\t\t\t\t\tvalue: treeNode.id,\n\t\t\t\t\tlabel:\n\t\t\t\t\t\trepeat( '— ', level ) + unescapeString( treeNode.name ),\n\t\t\t\t\trawName: treeNode.name,\n\t\t\t\t},\n\t\t\t\t...getOptionsFromTree( treeNode.children || [], level + 1 ),\n\t\t\t] );\n\n\t\t\tconst sortedNodes = mappedNodes.sort( ( [ a ], [ b ] ) => {\n\t\t\t\tconst priorityA = getItemPriority( a.rawName, fieldValue );\n\t\t\t\tconst priorityB = getItemPriority( b.rawName, fieldValue );\n\t\t\t\treturn priorityA >= priorityB ? 1 : -1;\n\t\t\t} );\n\n\t\t\treturn flatten( sortedNodes );\n\t\t};\n\n\t\tlet tree = pageItems.map( ( item ) => ( {\n\t\t\tid: item.id,\n\t\t\tparent: item.parent,\n\t\t\tname: getTitle( item ),\n\t\t} ) );\n\n\t\t// Only build a hierarchical tree when not searching.\n\t\tif ( ! fieldValue ) {\n\t\t\ttree = buildTermsTree( tree );\n\t\t}\n\n\t\tconst opts = getOptionsFromTree( tree );\n\n\t\t// Ensure the current parent is in the options list.\n\t\tconst optsHasParent = find(\n\t\t\topts,\n\t\t\t( item ) => item.value === parentPostId\n\t\t);\n\t\tif ( parentPost && ! optsHasParent ) {\n\t\t\topts.unshift( {\n\t\t\t\tvalue: parentPostId,\n\t\t\t\tlabel: getTitle( parentPost ),\n\t\t\t} );\n\t\t}\n\t\treturn opts;\n\t}, [ pageItems, fieldValue ] );\n\n\tif ( ! isHierarchical || ! parentPageLabel ) {\n\t\treturn null;\n\t}\n\t/**\n\t * Handle user input.\n\t *\n\t * @param {string} inputValue The current value of the input field.\n\t */\n\tconst handleKeydown = ( inputValue ) => {\n\t\tsetFieldValue( inputValue );\n\t};\n\n\t/**\n\t * Handle author selection.\n\t *\n\t * @param {Object} selectedPostId The selected Author.\n\t */\n\tconst handleChange = ( selectedPostId ) => {\n\t\teditPost( { parent: selectedPostId } );\n\t};\n\n\treturn (\n\t\t<ComboboxControl\n\t\t\tclassName=\"editor-page-attributes__parent\"\n\t\t\tlabel={ parentPageLabel }\n\t\t\tvalue={ parentPostId }\n\t\t\toptions={ parentOptions }\n\t\t\tonFilterValueChange={ debounce( handleKeydown, 300 ) }\n\t\t\tonChange={ handleChange }\n\t\t/>\n\t);\n}\n\nexport default PageAttributesParent;\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/page-attributes/parent.js"],"names":["getTitle","post","title","rendered","id","getItemPriority","name","searchValue","normalizedName","toLowerCase","normalizedSearch","startsWith","length","Infinity","PageAttributesParent","editPost","editorStore","fieldValue","setFieldValue","parentPost","parentPostId","items","postType","select","getPostType","getEntityRecords","getEntityRecord","coreStore","getCurrentPostId","getEditedPostAttribute","postTypeSlug","pageId","pType","postId","isHierarchical","query","per_page","exclude","parent_exclude","orderby","order","_fields","search","parentPageLabel","pageItems","parentOptions","getOptionsFromTree","tree","level","mappedNodes","map","treeNode","value","label","repeat","rawName","children","sortedNodes","sort","a","b","priorityA","priorityB","flat","item","parent","op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nB8B,MAAAA,IAAI,GAAG,2BAAgBA,IAAhB,CAAP;AACA;;AAED,UAAMmB,IAAI,GAAGpB,kBAAkB,CAAEC,IAAF,CAA/B,CAhCoC,CAkCpC;;AACA,UAAMoB,aAAa,GAAG,kBACrBD,IADqB,EAEnBF,IAAF,IAAYA,IAAI,CAACZ,KAAL,KAAehC,YAFN,CAAtB;;AAIA,QAAKD,UAAU,IAAI,CAAEgD,aAArB,EAAqC;AACpCD,MAAAA,IAAI,CAACE,OAAL,CAAc;AACbhB,QAAAA,KAAK,EAAEhC,YADM;AAEbiC,QAAAA,KAAK,EAAErD,QAAQ,CAAEmB,UAAF;AAFF,OAAd;AAIA;;AACD,WAAO+C,IAAP;AACA,GA9CqB,EA8CnB,CAAEtB,SAAF,EAAa3B,UAAb,CA9CmB,CAAtB;;AAgDA,MAAK,CAAEiB,cAAF,IAAoB,CAAES,eAA3B,EAA6C;AAC5C,WAAO,IAAP;AACA;AACD;AACD;AACA;AACA;AACA;;;AACC,QAAM0B,aAAa,GAAKC,UAAF,IAAkB;AACvCpD,IAAAA,aAAa,CAAEoD,UAAF,CAAb;AACA,GAFD;AAIA;AACD;AACA;AACA;AACA;;;AACC,QAAMC,YAAY,GAAKC,cAAF,IAAsB;AAC1CzD,IAAAA,QAAQ,CAAE;AAAEkD,MAAAA,MAAM,EAAEO;AAAV,KAAF,CAAR;AACA,GAFD;;AAIA,SACC,4BAAC,2BAAD;AACC,IAAA,SAAS,EAAC,gCADX;AAEC,IAAA,KAAK,EAAG7B,eAFT;AAGC,IAAA,KAAK,EAAGvB,YAHT;AAIC,IAAA,OAAO,EAAGyB,aAJX;AAKC,IAAA,mBAAmB,EAAG,sBAAUwB,aAAV,EAAyB,GAAzB,CALvB;AAMC,IAAA,QAAQ,EAAGE;AANZ,IADD;AAUA;;eAEczD,oB","sourcesContent":["/**\n * External dependencies\n */\nimport {\n\tget,\n\tunescape as unescapeString,\n\tdebounce,\n\tfind,\n\tdeburr,\n} from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { ComboboxControl } from '@wordpress/components';\nimport { useState, useMemo } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { buildTermsTree } from '../../utils/terms';\nimport { store as editorStore } from '../../store';\n\nfunction getTitle( post ) {\n\treturn post?.title?.rendered\n\t\t? decodeEntities( post.title.rendered )\n\t\t: `#${ post.id } (${ __( 'no title' ) })`;\n}\n\nexport const getItemPriority = ( name, searchValue ) => {\n\tconst normalizedName = deburr( name ).toLowerCase();\n\tconst normalizedSearch = deburr( searchValue ).toLowerCase();\n\tif ( normalizedName === normalizedSearch ) {\n\t\treturn 0;\n\t}\n\n\tif ( normalizedName.startsWith( normalizedSearch ) ) {\n\t\treturn normalizedName.length;\n\t}\n\n\treturn Infinity;\n};\n\nexport function PageAttributesParent() {\n\tconst { editPost } = useDispatch( editorStore );\n\tconst [ fieldValue, setFieldValue ] = useState( false );\n\tconst { parentPost, parentPostId, items, postType } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getPostType, getEntityRecords, getEntityRecord } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst { getCurrentPostId, getEditedPostAttribute } =\n\t\t\t\tselect( editorStore );\n\t\t\tconst postTypeSlug = getEditedPostAttribute( 'type' );\n\t\t\tconst pageId = getEditedPostAttribute( 'parent' );\n\t\t\tconst pType = getPostType( postTypeSlug );\n\t\t\tconst postId = getCurrentPostId();\n\t\t\tconst isHierarchical = get( pType, [ 'hierarchical' ], false );\n\t\t\tconst query = {\n\t\t\t\tper_page: 100,\n\t\t\t\texclude: postId,\n\t\t\t\tparent_exclude: postId,\n\t\t\t\torderby: 'menu_order',\n\t\t\t\torder: 'asc',\n\t\t\t\t_fields: 'id,title,parent',\n\t\t\t};\n\n\t\t\t// Perform a search when the field is changed.\n\t\t\tif ( !! fieldValue ) {\n\t\t\t\tquery.search = fieldValue;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tparentPostId: pageId,\n\t\t\t\tparentPost: pageId\n\t\t\t\t\t? getEntityRecord( 'postType', postTypeSlug, pageId )\n\t\t\t\t\t: null,\n\t\t\t\titems: isHierarchical\n\t\t\t\t\t? getEntityRecords( 'postType', postTypeSlug, query )\n\t\t\t\t\t: [],\n\t\t\t\tpostType: pType,\n\t\t\t};\n\t\t},\n\t\t[ fieldValue ]\n\t);\n\n\tconst isHierarchical = get( postType, [ 'hierarchical' ], false );\n\tconst parentPageLabel = get( postType, [ 'labels', 'parent_item_colon' ] );\n\tconst pageItems = items || [];\n\n\tconst parentOptions = useMemo( () => {\n\t\tconst getOptionsFromTree = ( tree, level = 0 ) => {\n\t\t\tconst mappedNodes = tree.map( ( treeNode ) => [\n\t\t\t\t{\n\t\t\t\t\tvalue: treeNode.id,\n\t\t\t\t\tlabel:\n\t\t\t\t\t\t'— '.repeat( level ) + unescapeString( treeNode.name ),\n\t\t\t\t\trawName: treeNode.name,\n\t\t\t\t},\n\t\t\t\t...getOptionsFromTree( treeNode.children || [], level + 1 ),\n\t\t\t] );\n\n\t\t\tconst sortedNodes = mappedNodes.sort( ( [ a ], [ b ] ) => {\n\t\t\t\tconst priorityA = getItemPriority( a.rawName, fieldValue );\n\t\t\t\tconst priorityB = getItemPriority( b.rawName, fieldValue );\n\t\t\t\treturn priorityA >= priorityB ? 1 : -1;\n\t\t\t} );\n\n\t\t\treturn sortedNodes.flat();\n\t\t};\n\n\t\tlet tree = pageItems.map( ( item ) => ( {\n\t\t\tid: item.id,\n\t\t\tparent: item.parent,\n\t\t\tname: getTitle( item ),\n\t\t} ) );\n\n\t\t// Only build a hierarchical tree when not searching.\n\t\tif ( ! fieldValue ) {\n\t\t\ttree = buildTermsTree( tree );\n\t\t}\n\n\t\tconst opts = getOptionsFromTree( tree );\n\n\t\t// Ensure the current parent is in the options list.\n\t\tconst optsHasParent = find(\n\t\t\topts,\n\t\t\t( item ) => item.value === parentPostId\n\t\t);\n\t\tif ( parentPost && ! optsHasParent ) {\n\t\t\topts.unshift( {\n\t\t\t\tvalue: parentPostId,\n\t\t\t\tlabel: getTitle( parentPost ),\n\t\t\t} );\n\t\t}\n\t\treturn opts;\n\t}, [ pageItems, fieldValue ] );\n\n\tif ( ! isHierarchical || ! parentPageLabel ) {\n\t\treturn null;\n\t}\n\t/**\n\t * Handle user input.\n\t *\n\t * @param {string} inputValue The current value of the input field.\n\t */\n\tconst handleKeydown = ( inputValue ) => {\n\t\tsetFieldValue( inputValue );\n\t};\n\n\t/**\n\t * Handle author selection.\n\t *\n\t * @param {Object} selectedPostId The selected Author.\n\t */\n\tconst handleChange = ( selectedPostId ) => {\n\t\teditPost( { parent: selectedPostId } );\n\t};\n\n\treturn (\n\t\t<ComboboxControl\n\t\t\tclassName=\"editor-page-attributes__parent\"\n\t\t\tlabel={ parentPageLabel }\n\t\t\tvalue={ parentPostId }\n\t\t\toptions={ parentOptions }\n\t\t\tonFilterValueChange={ debounce( handleKeydown, 300 ) }\n\t\t\tonChange={ handleChange }\n\t\t/>\n\t);\n}\n\nexport default PageAttributesParent;\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-author/select.js"],"names":["PostAuthorSelect","editPost","editorStore","postAuthor","authors","select","getEditedPostAttribute","coreStore","getUsers","AUTHORS_QUERY","authorOptions","map","author","value","id","label","name","setAuthorId","Number"],"mappings":";;;;;;;AAIA;;AADA;;AAEA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAdA;AACA;AACA;;AAQA;AACA;AACA;AAIA,SAASA,gBAAT,GAA4B;AAC3B,QAAM;AAAEC,IAAAA;AAAF,MAAe,uBAAaC,YAAb,CAArB;AACA,QAAM;AAAEC,IAAAA,UAAF;AAAcC,IAAAA;AAAd,MAA0B,qBAAaC,MAAF,IAAc;AACxD,WAAO;AACNF,MAAAA,UAAU,EAAEE,MAAM,CAAEH,YAAF,CAAN,CAAsBI,sBAAtB,CACX,QADW,CADN;AAINF,MAAAA,OAAO,EAAEC,MAAM,CAAEE,eAAF,CAAN,CAAoBC,QAApB,CAA8BC,wBAA9B;AAJH,KAAP;AAMA,GAP+B,EAO7B,EAP6B,CAAhC;AASA,QAAMC,aAAa,GAAG,sBAAS,MAAM;AACpC,WAAO,CAAEN,OAAF,aAAEA,OAAF,cAAEA,OAAF,GAAa,EAAb,EAAkBO,GAAlB,CAAyBC,MAAF,IAAc;AAC3C,aAAO;AACNC,QAAAA,KAAK,EAAED,MAAM,CAACE,EADR;AAENC,QAAAA,KAAK,EAAE,kCAAgBH,MAAM,CAACI,IAAvB;AAFD,OAAP;AAIA,KALM,CAAP;AAMA,GAPqB,EAOnB,CAAEZ,OAAF,CAPmB,CAAtB;;AASA,QAAMa,WAAW,GAAKJ,KAAF,IAAa;AAChC,UAAMD,MAAM,GAAGM,MAAM,CAAEL,KAAF,CAArB;AACAZ,IAAAA,QAAQ,CAAE;AAAEW,MAAAA;AAAF,KAAF,CAAR;AACA,GAHD;;AAKA,SACC,4BAAC,yBAAD;AACC,IAAA,SAAS,EAAC,sBADX;AAEC,IAAA,KAAK,EAAG,cAAI,QAAJ,CAFT;AAGC,IAAA,OAAO,EAAGF,aAHX;AAIC,IAAA,QAAQ,EAAGO,WAJZ;AAKC,IAAA,KAAK,EAAGd;AALT,IADD;AASA;;eAEcH,gB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useMemo } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { SelectControl } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { AUTHORS_QUERY } from './constants';\n\nfunction PostAuthorSelect() {\n\tconst { editPost } = useDispatch( editorStore );\n\tconst { postAuthor, authors } = useSelect( ( select ) => {\n\t\treturn {\n\t\t\tpostAuthor: select( editorStore ).getEditedPostAttribute(\n\t\t\t\t'author'\n\t\t\t),\n\t\t\tauthors: select( coreStore ).getUsers( AUTHORS_QUERY ),\n\t\t};\n\t}, [] );\n\n\tconst authorOptions = useMemo( () => {\n\t\treturn ( authors ?? [] ).map( ( author ) => {\n\t\t\treturn {\n\t\t\t\tvalue: author.id,\n\t\t\t\tlabel: decodeEntities( author.name ),\n\t\t\t};\n\t\t} );\n\t}, [ authors ] );\n\n\tconst setAuthorId = ( value ) => {\n\t\tconst author = Number( value );\n\t\teditPost( { author } );\n\t};\n\n\treturn (\n\t\t<SelectControl\n\t\t\tclassName=\"post-author-selector\"\n\t\t\tlabel={ __( 'Author' ) }\n\t\t\toptions={ authorOptions }\n\t\t\tonChange={ setAuthorId }\n\t\t\tvalue={ postAuthor }\n\t\t/>\n\t);\n}\n\nexport default PostAuthorSelect;\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/post-author/select.js"],"names":["PostAuthorSelect","editPost","editorStore","postAuthor","authors","select","getEditedPostAttribute","coreStore","getUsers","AUTHORS_QUERY","authorOptions","map","author","value","id","label","name","setAuthorId","Number"],"mappings":";;;;;;;AAIA;;AADA;;AAEA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAdA;AACA;AACA;;AAQA;AACA;AACA;AAIA,SAASA,gBAAT,GAA4B;AAC3B,QAAM;AAAEC,IAAAA;AAAF,MAAe,uBAAaC,YAAb,CAArB;AACA,QAAM;AAAEC,IAAAA,UAAF;AAAcC,IAAAA;AAAd,MAA0B,qBAAaC,MAAF,IAAc;AACxD,WAAO;AACNF,MAAAA,UAAU,EACTE,MAAM,CAAEH,YAAF,CAAN,CAAsBI,sBAAtB,CAA8C,QAA9C,CAFK;AAGNF,MAAAA,OAAO,EAAEC,MAAM,CAAEE,eAAF,CAAN,CAAoBC,QAApB,CAA8BC,wBAA9B;AAHH,KAAP;AAKA,GAN+B,EAM7B,EAN6B,CAAhC;AAQA,QAAMC,aAAa,GAAG,sBAAS,MAAM;AACpC,WAAO,CAAEN,OAAF,aAAEA,OAAF,cAAEA,OAAF,GAAa,EAAb,EAAkBO,GAAlB,CAAyBC,MAAF,IAAc;AAC3C,aAAO;AACNC,QAAAA,KAAK,EAAED,MAAM,CAACE,EADR;AAENC,QAAAA,KAAK,EAAE,kCAAgBH,MAAM,CAACI,IAAvB;AAFD,OAAP;AAIA,KALM,CAAP;AAMA,GAPqB,EAOnB,CAAEZ,OAAF,CAPmB,CAAtB;;AASA,QAAMa,WAAW,GAAKJ,KAAF,IAAa;AAChC,UAAMD,MAAM,GAAGM,MAAM,CAAEL,KAAF,CAArB;AACAZ,IAAAA,QAAQ,CAAE;AAAEW,MAAAA;AAAF,KAAF,CAAR;AACA,GAHD;;AAKA,SACC,4BAAC,yBAAD;AACC,IAAA,SAAS,EAAC,sBADX;AAEC,IAAA,KAAK,EAAG,cAAI,QAAJ,CAFT;AAGC,IAAA,OAAO,EAAGF,aAHX;AAIC,IAAA,QAAQ,EAAGO,WAJZ;AAKC,IAAA,KAAK,EAAGd;AALT,IADD;AASA;;eAEcH,gB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useMemo } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { SelectControl } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { AUTHORS_QUERY } from './constants';\n\nfunction PostAuthorSelect() {\n\tconst { editPost } = useDispatch( editorStore );\n\tconst { postAuthor, authors } = useSelect( ( select ) => {\n\t\treturn {\n\t\t\tpostAuthor:\n\t\t\t\tselect( editorStore ).getEditedPostAttribute( 'author' ),\n\t\t\tauthors: select( coreStore ).getUsers( AUTHORS_QUERY ),\n\t\t};\n\t}, [] );\n\n\tconst authorOptions = useMemo( () => {\n\t\treturn ( authors ?? [] ).map( ( author ) => {\n\t\t\treturn {\n\t\t\t\tvalue: author.id,\n\t\t\t\tlabel: decodeEntities( author.name ),\n\t\t\t};\n\t\t} );\n\t}, [ authors ] );\n\n\tconst setAuthorId = ( value ) => {\n\t\tconst author = Number( value );\n\t\teditPost( { author } );\n\t};\n\n\treturn (\n\t\t<SelectControl\n\t\t\tclassName=\"post-author-selector\"\n\t\t\tlabel={ __( 'Author' ) }\n\t\t\toptions={ authorOptions }\n\t\t\tonChange={ setAuthorId }\n\t\t\tvalue={ postAuthor }\n\t\t/>\n\t);\n}\n\nexport default PostAuthorSelect;\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-comments/index.js"],"names":["PostComments","commentStatus","props","onToggleComments","editPost","comment_status","select","editorStore","getEditedPostAttribute","dispatch"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AAKA;;AAXA;AACA;AACA;;AAMA;AACA;AACA;AAGA,SAASA,YAAT,OAA8D;AAAA,MAAvC;AAAEC,IAAAA,aAAa,GAAG,MAAlB;AAA0B,OAAGC;AAA7B,GAAuC;;AAC7D,QAAMC,gBAAgB,GAAG,MACxBD,KAAK,CAACE,QAAN,CAAgB;AACfC,IAAAA,cAAc,EAAEJ,aAAa,KAAK,MAAlB,GAA2B,QAA3B,GAAsC;AADvC,GAAhB,CADD;;AAKA,SACC,4BAAC,2BAAD;AACC,IAAA,KAAK,EAAG,cAAI,gBAAJ,CADT;AAEC,IAAA,OAAO,EAAGA,aAAa,KAAK,MAF7B;AAGC,IAAA,QAAQ,EAAGE;AAHZ,IADD;AAOA;;eAEc,sBAAS,CACvB,sBAAcG,MAAF,IAAc;AACzB,SAAO;AACNL,IAAAA,aAAa,EAAEK,MAAM,CAAEC,YAAF,CAAN,CAAsBC,sBAAtB,CACd,gBADc;AADT,GAAP;AAKA,CAND,CADuB,EAQvB,wBAAgBC,QAAF,KAAkB;AAC/BL,EAAAA,QAAQ,EAAEK,QAAQ,CAAEF,YAAF,CAAR,CAAwBH;AADH,CAAlB,CAAd,CARuB,CAAT,EAWVJ,YAXU,C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { CheckboxControl } from '@wordpress/components';\nimport { compose } from '@wordpress/compose';\nimport { withSelect, withDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nfunction PostComments( { commentStatus = 'open', ...props } ) {\n\tconst onToggleComments = () =>\n\t\tprops.editPost( {\n\t\t\tcomment_status: commentStatus === 'open' ? 'closed' : 'open',\n\t\t} );\n\n\treturn (\n\t\t<CheckboxControl\n\t\t\tlabel={ __( 'Allow comments' ) }\n\t\t\tchecked={ commentStatus === 'open' }\n\t\t\tonChange={ onToggleComments }\n\t\t/>\n\t);\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\treturn {\n\t\t\tcommentStatus: select( editorStore ).getEditedPostAttribute(\n\t\t\t\t'comment_status'\n\t\t\t),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => ( {\n\t\teditPost: dispatch( editorStore ).editPost,\n\t} ) ),\n] )( PostComments );\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/post-comments/index.js"],"names":["PostComments","commentStatus","props","onToggleComments","editPost","comment_status","select","editorStore","getEditedPostAttribute","dispatch"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AAKA;;AAXA;AACA;AACA;;AAMA;AACA;AACA;AAGA,SAASA,YAAT,OAA8D;AAAA,MAAvC;AAAEC,IAAAA,aAAa,GAAG,MAAlB;AAA0B,OAAGC;AAA7B,GAAuC;;AAC7D,QAAMC,gBAAgB,GAAG,MACxBD,KAAK,CAACE,QAAN,CAAgB;AACfC,IAAAA,cAAc,EAAEJ,aAAa,KAAK,MAAlB,GAA2B,QAA3B,GAAsC;AADvC,GAAhB,CADD;;AAKA,SACC,4BAAC,2BAAD;AACC,IAAA,KAAK,EAAG,cAAI,gBAAJ,CADT;AAEC,IAAA,OAAO,EAAGA,aAAa,KAAK,MAF7B;AAGC,IAAA,QAAQ,EAAGE;AAHZ,IADD;AAOA;;eAEc,sBAAS,CACvB,sBAAcG,MAAF,IAAc;AACzB,SAAO;AACNL,IAAAA,aAAa,EACZK,MAAM,CAAEC,YAAF,CAAN,CAAsBC,sBAAtB,CACC,gBADD;AAFK,GAAP;AAMA,CAPD,CADuB,EASvB,wBAAgBC,QAAF,KAAkB;AAC/BL,EAAAA,QAAQ,EAAEK,QAAQ,CAAEF,YAAF,CAAR,CAAwBH;AADH,CAAlB,CAAd,CATuB,CAAT,EAYVJ,YAZU,C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { CheckboxControl } from '@wordpress/components';\nimport { compose } from '@wordpress/compose';\nimport { withSelect, withDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nfunction PostComments( { commentStatus = 'open', ...props } ) {\n\tconst onToggleComments = () =>\n\t\tprops.editPost( {\n\t\t\tcomment_status: commentStatus === 'open' ? 'closed' : 'open',\n\t\t} );\n\n\treturn (\n\t\t<CheckboxControl\n\t\t\tlabel={ __( 'Allow comments' ) }\n\t\t\tchecked={ commentStatus === 'open' }\n\t\t\tonChange={ onToggleComments }\n\t\t/>\n\t);\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\treturn {\n\t\t\tcommentStatus:\n\t\t\t\tselect( editorStore ).getEditedPostAttribute(\n\t\t\t\t\t'comment_status'\n\t\t\t\t),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => ( {\n\t\teditPost: dispatch( editorStore ).editPost,\n\t} ) ),\n] )( PostComments );\n"]}
@@ -122,11 +122,8 @@ function PostFormat() {
122
122
 
123
123
  return (0, _element.createElement)(_check.default, null, (0, _element.createElement)("div", {
124
124
  className: "editor-post-format"
125
- }, (0, _element.createElement)("div", {
126
- className: "editor-post-format__content"
127
- }, (0, _element.createElement)("label", {
128
- htmlFor: postFormatSelectorId
129
- }, (0, _i18n.__)('Post Format')), (0, _element.createElement)(_components.SelectControl, {
125
+ }, (0, _element.createElement)(_components.SelectControl, {
126
+ label: (0, _i18n.__)('Post Format'),
130
127
  value: postFormat,
131
128
  onChange: format => onUpdatePostFormat(format),
132
129
  id: postFormatSelectorId,
@@ -134,13 +131,13 @@ function PostFormat() {
134
131
  label: format.caption,
135
132
  value: format.id
136
133
  }))
137
- })), suggestion && suggestion.id !== postFormat && (0, _element.createElement)("div", {
134
+ }), suggestion && suggestion.id !== postFormat && (0, _element.createElement)("p", {
138
135
  className: "editor-post-format__suggestion"
139
- }, (0, _i18n.__)('Suggestion:'), ' ', (0, _element.createElement)(_components.Button, {
136
+ }, (0, _element.createElement)(_components.Button, {
140
137
  variant: "link",
141
138
  onClick: () => onUpdatePostFormat(suggestion.id)
142
139
  }, (0, _i18n.sprintf)(
143
140
  /* translators: %s: post format */
144
- (0, _i18n.__)('Apply format: %s'), suggestion.caption)))));
141
+ (0, _i18n.__)('Apply suggested format: %s'), suggestion.caption)))));
145
142
  }
146
143
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-format/index.js"],"names":["POST_FORMATS","id","caption","sort","a","b","normalizedA","toUpperCase","normalizedB","PostFormat","instanceId","postFormatSelectorId","postFormat","suggestedFormat","supportedFormats","select","getEditedPostAttribute","getSuggestedPostFormat","editorStore","_postFormat","themeSupports","coreStore","getThemeSupports","formats","filter","format","suggestion","editPost","onUpdatePostFormat","map","label","value"],"mappings":";;;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAlBA;AACA;AACA;;AAGA;AACA;AACA;;AAOA;AACA;AACA;AAIA;AACO,MAAMA,YAAY,GAAG,CAC3B;AAAEC,EAAAA,EAAE,EAAE,OAAN;AAAeC,EAAAA,OAAO,EAAE,cAAI,OAAJ;AAAxB,CAD2B,EAE3B;AAAED,EAAAA,EAAE,EAAE,OA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AAGC,UADT;AAEC,IAAA,QAAQ,EAAKa,MAAF,IAAcG,kBAAkB,CAAEH,MAAF,CAF5C;AAGC,IAAA,EAAE,EAAGd,oBAHN;AAIC,IAAA,OAAO,EAAGY,OAAO,CAACM,GAAR,CAAeJ,MAAF,KAAgB;AACtCK,MAAAA,KAAK,EAAEL,MAAM,CAACvB,OADwB;AAEtC6B,MAAAA,KAAK,EAAEN,MAAM,CAACxB;AAFwB,KAAhB,CAAb;AAJX,IAJD,CADD,EAgBGyB,UAAU,IAAIA,UAAU,CAACzB,EAAX,KAAkBW,UAAhC,IACD;AAAK,IAAA,SAAS,EAAC;AAAf,KACG,cAAI,aAAJ,CADH,EAC0B,GAD1B,EAEC,4BAAC,kBAAD;AACC,IAAA,OAAO,EAAC,MADT;AAEC,IAAA,OAAO,EAAG,MACTgB,kBAAkB,CAAEF,UAAU,CAACzB,EAAb;AAHpB,KAMG;AACD;AACA,gBAAI,kBAAJ,CAFC,EAGDyB,UAAU,CAACxB,OAHV,CANH,CAFD,CAjBF,CADD,CADD;AAsCA","sourcesContent":["/**\n * External dependencies\n */\nimport { find, includes } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { Button, SelectControl } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useInstanceId } from '@wordpress/compose';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport PostFormatCheck from './check';\nimport { store as editorStore } from '../../store';\n\n// All WP post formats, sorted alphabetically by translated name.\nexport const POST_FORMATS = [\n\t{ id: 'aside', caption: __( 'Aside' ) },\n\t{ id: 'audio', caption: __( 'Audio' ) },\n\t{ id: 'chat', caption: __( 'Chat' ) },\n\t{ id: 'gallery', caption: __( 'Gallery' ) },\n\t{ id: 'image', caption: __( 'Image' ) },\n\t{ id: 'link', caption: __( 'Link' ) },\n\t{ id: 'quote', caption: __( 'Quote' ) },\n\t{ id: 'standard', caption: __( 'Standard' ) },\n\t{ id: 'status', caption: __( 'Status' ) },\n\t{ id: 'video', caption: __( 'Video' ) },\n].sort( ( a, b ) => {\n\tconst normalizedA = a.caption.toUpperCase();\n\tconst normalizedB = b.caption.toUpperCase();\n\n\tif ( normalizedA < normalizedB ) {\n\t\treturn -1;\n\t}\n\tif ( normalizedA > normalizedB ) {\n\t\treturn 1;\n\t}\n\treturn 0;\n} );\n\nexport default function PostFormat() {\n\tconst instanceId = useInstanceId( PostFormat );\n\tconst postFormatSelectorId = `post-format-selector-${ instanceId }`;\n\n\tconst { postFormat, suggestedFormat, supportedFormats } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedPostAttribute, getSuggestedPostFormat } = select(\n\t\t\t\teditorStore\n\t\t\t);\n\t\t\tconst _postFormat = getEditedPostAttribute( 'format' );\n\t\t\tconst themeSupports = select( coreStore ).getThemeSupports();\n\t\t\treturn {\n\t\t\t\tpostFormat: _postFormat ?? 'standard',\n\t\t\t\tsuggestedFormat: getSuggestedPostFormat(),\n\t\t\t\tsupportedFormats: themeSupports.formats,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tconst formats = POST_FORMATS.filter( ( format ) => {\n\t\t// Ensure current format is always in the set.\n\t\t// The current format may not be a format supported by the theme.\n\t\treturn (\n\t\t\tincludes( supportedFormats, format.id ) || postFormat === format.id\n\t\t);\n\t} );\n\tconst suggestion = find(\n\t\tformats,\n\t\t( format ) => format.id === suggestedFormat\n\t);\n\n\tconst { editPost } = useDispatch( editorStore );\n\n\tconst onUpdatePostFormat = ( format ) => editPost( { format } );\n\n\treturn (\n\t\t<PostFormatCheck>\n\t\t\t<div className=\"editor-post-format\">\n\t\t\t\t<div className=\"editor-post-format__content\">\n\t\t\t\t\t<label htmlFor={ postFormatSelectorId }>\n\t\t\t\t\t\t{ __( 'Post Format' ) }\n\t\t\t\t\t</label>\n\t\t\t\t\t<SelectControl\n\t\t\t\t\t\tvalue={ postFormat }\n\t\t\t\t\t\tonChange={ ( format ) => onUpdatePostFormat( format ) }\n\t\t\t\t\t\tid={ postFormatSelectorId }\n\t\t\t\t\t\toptions={ formats.map( ( format ) => ( {\n\t\t\t\t\t\t\tlabel: format.caption,\n\t\t\t\t\t\t\tvalue: format.id,\n\t\t\t\t\t\t} ) ) }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\n\t\t\t\t{ suggestion && suggestion.id !== postFormat && (\n\t\t\t\t\t<div className=\"editor-post-format__suggestion\">\n\t\t\t\t\t\t{ __( 'Suggestion:' ) }{ ' ' }\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\tonUpdatePostFormat( suggestion.id )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: post format */\n\t\t\t\t\t\t\t\t__( 'Apply format: %s' ),\n\t\t\t\t\t\t\t\tsuggestion.caption\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</PostFormatCheck>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/post-format/index.js"],"names":["POST_FORMATS","id","caption","sort","a","b","normalizedA","toUpperCase","normalizedB","PostFormat","instanceId","postFormatSelectorId","postFormat","suggestedFormat","supportedFormats","select","getEditedPostAttribute","getSuggestedPostFormat","editorStore","_postFormat","themeSupports","coreStore","getThemeSupports","formats","filter","format","suggestion","editPost","onUpdatePostFormat","map","label","value"],"mappings":";;;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAlBA;AACA;AACA;;AAGA;AACA;AACA;;AAOA;AACA;AACA;AAIA;AACO,MAAMA,YAAY,GAAG,CAC3B;AAAEC,EAAAA,EAAE,EAAE,OAAN;AAAeC,EAAAA,OAAO,EAAE,cAAI,OA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T;AAGC,IAAA,QAAQ,EAAKa,MAAF,IAAcG,kBAAkB,CAAEH,MAAF,CAH5C;AAIC,IAAA,EAAE,EAAGd,oBAJN;AAKC,IAAA,OAAO,EAAGY,OAAO,CAACM,GAAR,CAAeJ,MAAF,KAAgB;AACtCK,MAAAA,KAAK,EAAEL,MAAM,CAACvB,OADwB;AAEtC6B,MAAAA,KAAK,EAAEN,MAAM,CAACxB;AAFwB,KAAhB,CAAb;AALX,IADD,EAWGyB,UAAU,IAAIA,UAAU,CAACzB,EAAX,KAAkBW,UAAhC,IACD;AAAG,IAAA,SAAS,EAAC;AAAb,KACC,4BAAC,kBAAD;AACC,IAAA,OAAO,EAAC,MADT;AAEC,IAAA,OAAO,EAAG,MACTgB,kBAAkB,CAAEF,UAAU,CAACzB,EAAb;AAHpB,KAMG;AACD;AACA,gBAAI,4BAAJ,CAFC,EAGDyB,UAAU,CAACxB,OAHV,CANH,CADD,CAZF,CADD,CADD;AAgCA","sourcesContent":["/**\n * External dependencies\n */\nimport { find, includes } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { Button, SelectControl } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useInstanceId } from '@wordpress/compose';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport PostFormatCheck from './check';\nimport { store as editorStore } from '../../store';\n\n// All WP post formats, sorted alphabetically by translated name.\nexport const POST_FORMATS = [\n\t{ id: 'aside', caption: __( 'Aside' ) },\n\t{ id: 'audio', caption: __( 'Audio' ) },\n\t{ id: 'chat', caption: __( 'Chat' ) },\n\t{ id: 'gallery', caption: __( 'Gallery' ) },\n\t{ id: 'image', caption: __( 'Image' ) },\n\t{ id: 'link', caption: __( 'Link' ) },\n\t{ id: 'quote', caption: __( 'Quote' ) },\n\t{ id: 'standard', caption: __( 'Standard' ) },\n\t{ id: 'status', caption: __( 'Status' ) },\n\t{ id: 'video', caption: __( 'Video' ) },\n].sort( ( a, b ) => {\n\tconst normalizedA = a.caption.toUpperCase();\n\tconst normalizedB = b.caption.toUpperCase();\n\n\tif ( normalizedA < normalizedB ) {\n\t\treturn -1;\n\t}\n\tif ( normalizedA > normalizedB ) {\n\t\treturn 1;\n\t}\n\treturn 0;\n} );\n\nexport default function PostFormat() {\n\tconst instanceId = useInstanceId( PostFormat );\n\tconst postFormatSelectorId = `post-format-selector-${ instanceId }`;\n\n\tconst { postFormat, suggestedFormat, supportedFormats } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedPostAttribute, getSuggestedPostFormat } =\n\t\t\t\tselect( editorStore );\n\t\t\tconst _postFormat = getEditedPostAttribute( 'format' );\n\t\t\tconst themeSupports = select( coreStore ).getThemeSupports();\n\t\t\treturn {\n\t\t\t\tpostFormat: _postFormat ?? 'standard',\n\t\t\t\tsuggestedFormat: getSuggestedPostFormat(),\n\t\t\t\tsupportedFormats: themeSupports.formats,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tconst formats = POST_FORMATS.filter( ( format ) => {\n\t\t// Ensure current format is always in the set.\n\t\t// The current format may not be a format supported by the theme.\n\t\treturn (\n\t\t\tincludes( supportedFormats, format.id ) || postFormat === format.id\n\t\t);\n\t} );\n\tconst suggestion = find(\n\t\tformats,\n\t\t( format ) => format.id === suggestedFormat\n\t);\n\n\tconst { editPost } = useDispatch( editorStore );\n\n\tconst onUpdatePostFormat = ( format ) => editPost( { format } );\n\n\treturn (\n\t\t<PostFormatCheck>\n\t\t\t<div className=\"editor-post-format\">\n\t\t\t\t<SelectControl\n\t\t\t\t\tlabel={ __( 'Post Format' ) }\n\t\t\t\t\tvalue={ postFormat }\n\t\t\t\t\tonChange={ ( format ) => onUpdatePostFormat( format ) }\n\t\t\t\t\tid={ postFormatSelectorId }\n\t\t\t\t\toptions={ formats.map( ( format ) => ( {\n\t\t\t\t\t\tlabel: format.caption,\n\t\t\t\t\t\tvalue: format.id,\n\t\t\t\t\t} ) ) }\n\t\t\t\t/>\n\t\t\t\t{ suggestion && suggestion.id !== postFormat && (\n\t\t\t\t\t<p className=\"editor-post-format__suggestion\">\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\tonUpdatePostFormat( suggestion.id )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: post format */\n\t\t\t\t\t\t\t\t__( 'Apply suggested format: %s' ),\n\t\t\t\t\t\t\t\tsuggestion.caption\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</p>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</PostFormatCheck>\n\t);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-last-revision/check.js"],"names":["PostLastRevisionCheck","lastRevisionId","revisionsCount","children","select","getCurrentPostLastRevisionId","getCurrentPostRevisionsCount","editorStore"],"mappings":";;;;;;;;;;;;AAGA;;AAKA;;AACA;;AATA;AACA;AACA;;AAGA;AACA;AACA;AAIO,SAASA,qBAAT,OAIH;AAAA,MAJmC;AACtCC,IAAAA,cADsC;AAEtCC,IAAAA,cAFsC;AAGtCC,IAAAA;AAHsC,GAInC;;AACH,MAAK,CAAEF,cAAF,IAAoBC,cAAc,GAAG,CAA1C,EAA8C;AAC7C,WAAO,IAAP;AACA;;AAED,SACC,4BAAC,6BAAD;AAAsB,IAAA,WAAW,EAAC;AAAlC,KACGC,QADH,CADD;AAKA;;eAEc,sBAAcC,MAAF,IAAc;AACxC,QAAM;AACLC,IAAAA,4BADK;AAELC,IAAAA;AAFK,MAGFF,MAAM,CAAEG,YAAF,CAHV;AAIA,SAAO;AACNN,IAAAA,cAAc,EAAEI,4BAA4B,EADtC;AAENH,IAAAA,cAAc,EAAEI,4BAA4B;AAFtC,GAAP;AAIA,CATc,EASVN,qBATU,C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { withSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport PostTypeSupportCheck from '../post-type-support-check';\nimport { store as editorStore } from '../../store';\n\nexport function PostLastRevisionCheck( {\n\tlastRevisionId,\n\trevisionsCount,\n\tchildren,\n} ) {\n\tif ( ! lastRevisionId || revisionsCount < 2 ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PostTypeSupportCheck supportKeys=\"revisions\">\n\t\t\t{ children }\n\t\t</PostTypeSupportCheck>\n\t);\n}\n\nexport default withSelect( ( select ) => {\n\tconst {\n\t\tgetCurrentPostLastRevisionId,\n\t\tgetCurrentPostRevisionsCount,\n\t} = select( editorStore );\n\treturn {\n\t\tlastRevisionId: getCurrentPostLastRevisionId(),\n\t\trevisionsCount: getCurrentPostRevisionsCount(),\n\t};\n} )( PostLastRevisionCheck );\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/post-last-revision/check.js"],"names":["PostLastRevisionCheck","lastRevisionId","revisionsCount","children","select","getCurrentPostLastRevisionId","getCurrentPostRevisionsCount","editorStore"],"mappings":";;;;;;;;;;;;AAGA;;AAKA;;AACA;;AATA;AACA;AACA;;AAGA;AACA;AACA;AAIO,SAASA,qBAAT,OAIH;AAAA,MAJmC;AACtCC,IAAAA,cADsC;AAEtCC,IAAAA,cAFsC;AAGtCC,IAAAA;AAHsC,GAInC;;AACH,MAAK,CAAEF,cAAF,IAAoBC,cAAc,GAAG,CAA1C,EAA8C;AAC7C,WAAO,IAAP;AACA;;AAED,SACC,4BAAC,6BAAD;AAAsB,IAAA,WAAW,EAAC;AAAlC,KACGC,QADH,CADD;AAKA;;eAEc,sBAAcC,MAAF,IAAc;AACxC,QAAM;AAAEC,IAAAA,4BAAF;AAAgCC,IAAAA;AAAhC,MACLF,MAAM,CAAEG,YAAF,CADP;AAEA,SAAO;AACNN,IAAAA,cAAc,EAAEI,4BAA4B,EADtC;AAENH,IAAAA,cAAc,EAAEI,4BAA4B;AAFtC,GAAP;AAIA,CAPc,EAOVN,qBAPU,C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { withSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport PostTypeSupportCheck from '../post-type-support-check';\nimport { store as editorStore } from '../../store';\n\nexport function PostLastRevisionCheck( {\n\tlastRevisionId,\n\trevisionsCount,\n\tchildren,\n} ) {\n\tif ( ! lastRevisionId || revisionsCount < 2 ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PostTypeSupportCheck supportKeys=\"revisions\">\n\t\t\t{ children }\n\t\t</PostTypeSupportCheck>\n\t);\n}\n\nexport default withSelect( ( select ) => {\n\tconst { getCurrentPostLastRevisionId, getCurrentPostRevisionsCount } =\n\t\tselect( editorStore );\n\treturn {\n\t\tlastRevisionId: getCurrentPostLastRevisionId(),\n\t\trevisionsCount: getCurrentPostRevisionsCount(),\n\t};\n} )( PostLastRevisionCheck );\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-last-revision/index.js"],"names":["LastRevision","lastRevisionId","revisionsCount","revision","gutenberg","backup","select","getCurrentPostLastRevisionId","getCurrentPostRevisionsCount","editorStore"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAbA;AACA;AACA;;AAOA;AACA;AACA;AAIA,SAASA,YAAT,OAA4D;AAAA,MAArC;AAAEC,IAAAA,cAAF;AAAkBC,IAAAA;AAAlB,GAAqC;AAC3D,SACC,4BAAC,cAAD,QACC,4BAAC,kBAAD;AACC,IAAA,IAAI,EAAG,uBAAc,cAAd,EAA8B;AACpCC,MAAAA,QAAQ,EAAEF,cAD0B;AAEpCG,MAAAA,SAAS,EAAE;AAFyB,KAA9B,CADR;AAKC,IAAA,SAAS,EAAC,kCALX;AAMC,IAAA,IAAI,EAAGC;AANR,KAQG;AACD;AACA,gBAAI,aAAJ,EAAmB,cAAnB,EAAmCH,cAAnC,CAFC,EAGDA,cAHC,CARH,CADD,CADD;AAkBA;;eAEc,sBAAcI,MAAF,IAAc;AACxC,QAAM;AACLC,IAAAA,4BADK;AAELC,IAAAA;AAFK,MAGFF,MAAM,CAAEG,YAAF,CAHV;AAIA,SAAO;AACNR,IAAAA,cAAc,EAAEM,4BAA4B,EADtC;AAENL,IAAAA,cAAc,EAAEM,4BAA4B;AAFtC,GAAP;AAIA,CATc,EASVR,YATU,C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { sprintf, _n } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { withSelect } from '@wordpress/data';\nimport { backup } from '@wordpress/icons';\nimport { addQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport PostLastRevisionCheck from './check';\nimport { store as editorStore } from '../../store';\n\nfunction LastRevision( { lastRevisionId, revisionsCount } ) {\n\treturn (\n\t\t<PostLastRevisionCheck>\n\t\t\t<Button\n\t\t\t\thref={ addQueryArgs( 'revision.php', {\n\t\t\t\t\trevision: lastRevisionId,\n\t\t\t\t\tgutenberg: true,\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>\n\t\t\t\t{ sprintf(\n\t\t\t\t\t/* translators: %d: number of revisions */\n\t\t\t\t\t_n( '%d Revision', '%d Revisions', revisionsCount ),\n\t\t\t\t\trevisionsCount\n\t\t\t\t) }\n\t\t\t</Button>\n\t\t</PostLastRevisionCheck>\n\t);\n}\n\nexport default withSelect( ( select ) => {\n\tconst {\n\t\tgetCurrentPostLastRevisionId,\n\t\tgetCurrentPostRevisionsCount,\n\t} = select( editorStore );\n\treturn {\n\t\tlastRevisionId: getCurrentPostLastRevisionId(),\n\t\trevisionsCount: getCurrentPostRevisionsCount(),\n\t};\n} )( LastRevision );\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/post-last-revision/index.js"],"names":["LastRevision","lastRevisionId","revisionsCount","revision","gutenberg","backup","select","getCurrentPostLastRevisionId","getCurrentPostRevisionsCount","editorStore"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAbA;AACA;AACA;;AAOA;AACA;AACA;AAIA,SAASA,YAAT,OAA4D;AAAA,MAArC;AAAEC,IAAAA,cAAF;AAAkBC,IAAAA;AAAlB,GAAqC;AAC3D,SACC,4BAAC,cAAD,QACC,4BAAC,kBAAD;AACC,IAAA,IAAI,EAAG,uBAAc,cAAd,EAA8B;AACpCC,MAAAA,QAAQ,EAAEF,cAD0B;AAEpCG,MAAAA,SAAS,EAAE;AAFyB,KAA9B,CADR;AAKC,IAAA,SAAS,EAAC,kCALX;AAMC,IAAA,IAAI,EAAGC;AANR,KAQG;AACD;AACA,gBAAI,aAAJ,EAAmB,cAAnB,EAAmCH,cAAnC,CAFC,EAGDA,cAHC,CARH,CADD,CADD;AAkBA;;eAEc,sBAAcI,MAAF,IAAc;AACxC,QAAM;AAAEC,IAAAA,4BAAF;AAAgCC,IAAAA;AAAhC,MACLF,MAAM,CAAEG,YAAF,CADP;AAEA,SAAO;AACNR,IAAAA,cAAc,EAAEM,4BAA4B,EADtC;AAENL,IAAAA,cAAc,EAAEM,4BAA4B;AAFtC,GAAP;AAIA,CAPc,EAOVR,YAPU,C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { sprintf, _n } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { withSelect } from '@wordpress/data';\nimport { backup } from '@wordpress/icons';\nimport { addQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport PostLastRevisionCheck from './check';\nimport { store as editorStore } from '../../store';\n\nfunction LastRevision( { lastRevisionId, revisionsCount } ) {\n\treturn (\n\t\t<PostLastRevisionCheck>\n\t\t\t<Button\n\t\t\t\thref={ addQueryArgs( 'revision.php', {\n\t\t\t\t\trevision: lastRevisionId,\n\t\t\t\t\tgutenberg: true,\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>\n\t\t\t\t{ sprintf(\n\t\t\t\t\t/* translators: %d: number of revisions */\n\t\t\t\t\t_n( '%d Revision', '%d Revisions', revisionsCount ),\n\t\t\t\t\trevisionsCount\n\t\t\t\t) }\n\t\t\t</Button>\n\t\t</PostLastRevisionCheck>\n\t);\n}\n\nexport default withSelect( ( select ) => {\n\tconst { getCurrentPostLastRevisionId, getCurrentPostRevisionsCount } =\n\t\tselect( editorStore );\n\treturn {\n\t\tlastRevisionId: getCurrentPostLastRevisionId(),\n\t\trevisionsCount: getCurrentPostRevisionsCount(),\n\t};\n} )( LastRevision );\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-pending-status/check.js"],"names":["PostPendingStatusCheck","hasPublishAction","isPublished","children","select","isCurrentPostPublished","getCurrentPostType","getCurrentPost","editorStore","postType"],"mappings":";;;;;;;;AAGA;;AAKA;;AACA;;AAKA;;AAdA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;AAGO,SAASA,sBAAT,OAIH;AAAA,MAJoC;AACvCC,IAAAA,gBADuC;AAEvCC,IAAAA,WAFuC;AAGvCC,IAAAA;AAHuC,GAIpC;;AACH,MAAKD,WAAW,IAAI,CAAED,gBAAtB,EAAyC;AACxC,WAAO,IAAP;AACA;;AAED,SAAOE,QAAP;AACA;;eAEc,sBACd,sBAAcC,MAAF,IAAc;AACzB,QAAM;AACLC,IAAAA,sBADK;AAELC,IAAAA,kBAFK;AAGLC,IAAAA;AAHK,MAIFH,MAAM,CAAEI,YAAF,CAJV;AAKA,SAAO;AACNP,IAAAA,gBAAgB,EAAE,iBACjBM,cAAc,EADG,EAEjB,CAAE,QAAF,EAAY,mBAAZ,CAFiB,EAGjB,KAHiB,CADZ;AAMNL,IAAAA,WAAW,EAAEG,sBAAsB,EAN7B;AAONI,IAAAA,QAAQ,EAAEH,kBAAkB;AAPtB,GAAP;AASA,CAfD,CADc,EAiBZN,sBAjBY,C","sourcesContent":["/**\n * External dependencies\n */\nimport { get } from 'lodash';\n\n/**\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 PostPendingStatusCheck( {\n\thasPublishAction,\n\tisPublished,\n\tchildren,\n} ) {\n\tif ( isPublished || ! hasPublishAction ) {\n\t\treturn null;\n\t}\n\n\treturn children;\n}\n\nexport default compose(\n\twithSelect( ( select ) => {\n\t\tconst {\n\t\t\tisCurrentPostPublished,\n\t\t\tgetCurrentPostType,\n\t\t\tgetCurrentPost,\n\t\t} = select( editorStore );\n\t\treturn {\n\t\t\thasPublishAction: get(\n\t\t\t\tgetCurrentPost(),\n\t\t\t\t[ '_links', 'wp:action-publish' ],\n\t\t\t\tfalse\n\t\t\t),\n\t\t\tisPublished: isCurrentPostPublished(),\n\t\t\tpostType: getCurrentPostType(),\n\t\t};\n\t} )\n)( PostPendingStatusCheck );\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/post-pending-status/check.js"],"names":["PostPendingStatusCheck","hasPublishAction","isPublished","children","select","isCurrentPostPublished","getCurrentPostType","getCurrentPost","editorStore","postType"],"mappings":";;;;;;;;AAGA;;AAKA;;AACA;;AAKA;;AAdA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;AAGO,SAASA,sBAAT,OAIH;AAAA,MAJoC;AACvCC,IAAAA,gBADuC;AAEvCC,IAAAA,WAFuC;AAGvCC,IAAAA;AAHuC,GAIpC;;AACH,MAAKD,WAAW,IAAI,CAAED,gBAAtB,EAAyC;AACxC,WAAO,IAAP;AACA;;AAED,SAAOE,QAAP;AACA;;eAEc,sBACd,sBAAcC,MAAF,IAAc;AACzB,QAAM;AAAEC,IAAAA,sBAAF;AAA0BC,IAAAA,kBAA1B;AAA8CC,IAAAA;AAA9C,MACLH,MAAM,CAAEI,YAAF,CADP;AAEA,SAAO;AACNP,IAAAA,gBAAgB,EAAE,iBACjBM,cAAc,EADG,EAEjB,CAAE,QAAF,EAAY,mBAAZ,CAFiB,EAGjB,KAHiB,CADZ;AAMNL,IAAAA,WAAW,EAAEG,sBAAsB,EAN7B;AAONI,IAAAA,QAAQ,EAAEH,kBAAkB;AAPtB,GAAP;AASA,CAZD,CADc,EAcZN,sBAdY,C","sourcesContent":["/**\n * External dependencies\n */\nimport { get } from 'lodash';\n\n/**\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 PostPendingStatusCheck( {\n\thasPublishAction,\n\tisPublished,\n\tchildren,\n} ) {\n\tif ( isPublished || ! hasPublishAction ) {\n\t\treturn null;\n\t}\n\n\treturn children;\n}\n\nexport default compose(\n\twithSelect( ( select ) => {\n\t\tconst { isCurrentPostPublished, getCurrentPostType, getCurrentPost } =\n\t\t\tselect( editorStore );\n\t\treturn {\n\t\t\thasPublishAction: get(\n\t\t\t\tgetCurrentPost(),\n\t\t\t\t[ '_links', 'wp:action-publish' ],\n\t\t\t\tfalse\n\t\t\t),\n\t\t\tisPublished: isCurrentPostPublished(),\n\t\t\tpostType: getCurrentPostType(),\n\t\t};\n\t} )\n)( PostPendingStatusCheck );\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-pingbacks/index.js"],"names":["PostPingbacks","pingStatus","props","onTogglePingback","editPost","ping_status","select","editorStore","getEditedPostAttribute","dispatch"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AAKA;;AAXA;AACA;AACA;;AAMA;AACA;AACA;AAGA,SAASA,aAAT,OAA4D;AAAA,MAApC;AAAEC,IAAAA,UAAU,GAAG,MAAf;AAAuB,OAAGC;AAA1B,GAAoC;;AAC3D,QAAMC,gBAAgB,GAAG,MACxBD,KAAK,CAACE,QAAN,CAAgB;AACfC,IAAAA,WAAW,EAAEJ,UAAU,KAAK,MAAf,GAAwB,QAAxB,GAAmC;AADjC,GAAhB,CADD;;AAKA,SACC,4BAAC,2BAAD;AACC,IAAA,KAAK,EAAG,cAAI,8BAAJ,CADT;AAEC,IAAA,OAAO,EAAGA,UAAU,KAAK,MAF1B;AAGC,IAAA,QAAQ,EAAGE;AAHZ,IADD;AAOA;;eAEc,sBAAS,CACvB,sBAAcG,MAAF,IAAc;AACzB,SAAO;AACNL,IAAAA,UAAU,EAAEK,MAAM,CAAEC,YAAF,CAAN,CAAsBC,sBAAtB,CACX,aADW;AADN,GAAP;AAKA,CAND,CADuB,EAQvB,wBAAgBC,QAAF,KAAkB;AAC/BL,EAAAA,QAAQ,EAAEK,QAAQ,CAAEF,YAAF,CAAR,CAAwBH;AADH,CAAlB,CAAd,CARuB,CAAT,EAWVJ,aAXU,C","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 { store as editorStore } from '../../store';\n\nfunction PostPingbacks( { pingStatus = 'open', ...props } ) {\n\tconst onTogglePingback = () =>\n\t\tprops.editPost( {\n\t\t\tping_status: pingStatus === 'open' ? 'closed' : 'open',\n\t\t} );\n\n\treturn (\n\t\t<CheckboxControl\n\t\t\tlabel={ __( 'Allow pingbacks & trackbacks' ) }\n\t\t\tchecked={ pingStatus === 'open' }\n\t\t\tonChange={ onTogglePingback }\n\t\t/>\n\t);\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\treturn {\n\t\t\tpingStatus: select( editorStore ).getEditedPostAttribute(\n\t\t\t\t'ping_status'\n\t\t\t),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => ( {\n\t\teditPost: dispatch( editorStore ).editPost,\n\t} ) ),\n] )( PostPingbacks );\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/post-pingbacks/index.js"],"names":["PostPingbacks","pingStatus","props","onTogglePingback","editPost","ping_status","select","editorStore","getEditedPostAttribute","dispatch"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AAKA;;AAXA;AACA;AACA;;AAMA;AACA;AACA;AAGA,SAASA,aAAT,OAA4D;AAAA,MAApC;AAAEC,IAAAA,UAAU,GAAG,MAAf;AAAuB,OAAGC;AAA1B,GAAoC;;AAC3D,QAAMC,gBAAgB,GAAG,MACxBD,KAAK,CAACE,QAAN,CAAgB;AACfC,IAAAA,WAAW,EAAEJ,UAAU,KAAK,MAAf,GAAwB,QAAxB,GAAmC;AADjC,GAAhB,CADD;;AAKA,SACC,4BAAC,2BAAD;AACC,IAAA,KAAK,EAAG,cAAI,8BAAJ,CADT;AAEC,IAAA,OAAO,EAAGA,UAAU,KAAK,MAF1B;AAGC,IAAA,QAAQ,EAAGE;AAHZ,IADD;AAOA;;eAEc,sBAAS,CACvB,sBAAcG,MAAF,IAAc;AACzB,SAAO;AACNL,IAAAA,UAAU,EACTK,MAAM,CAAEC,YAAF,CAAN,CAAsBC,sBAAtB,CAA8C,aAA9C;AAFK,GAAP;AAIA,CALD,CADuB,EAOvB,wBAAgBC,QAAF,KAAkB;AAC/BL,EAAAA,QAAQ,EAAEK,QAAQ,CAAEF,YAAF,CAAR,CAAwBH;AADH,CAAlB,CAAd,CAPuB,CAAT,EAUVJ,aAVU,C","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 { store as editorStore } from '../../store';\n\nfunction PostPingbacks( { pingStatus = 'open', ...props } ) {\n\tconst onTogglePingback = () =>\n\t\tprops.editPost( {\n\t\t\tping_status: pingStatus === 'open' ? 'closed' : 'open',\n\t\t} );\n\n\treturn (\n\t\t<CheckboxControl\n\t\t\tlabel={ __( 'Allow pingbacks & trackbacks' ) }\n\t\t\tchecked={ pingStatus === 'open' }\n\t\t\tonChange={ onTogglePingback }\n\t\t/>\n\t);\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\treturn {\n\t\t\tpingStatus:\n\t\t\t\tselect( editorStore ).getEditedPostAttribute( 'ping_status' ),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => ( {\n\t\teditPost: dispatch( editorStore ).editPost,\n\t} ) ),\n] )( PostPingbacks );\n"]}
@@ -38,6 +38,8 @@ var _store = require("../../store");
38
38
  /**
39
39
  * Internal dependencies
40
40
  */
41
+ const noop = () => {};
42
+
41
43
  class PostPublishButton extends _element.Component {
42
44
  constructor(props) {
43
45
  super(props);
@@ -85,7 +87,7 @@ class PostPublishButton extends _element.Component {
85
87
 
86
88
 
87
89
  setEntitiesSavedStatesCallback(() => _this.closeEntitiesSavedStates);
88
- return _lodash.noop;
90
+ return noop;
89
91
  }
90
92
 
91
93
  return callback(...args);
@@ -126,7 +128,7 @@ class PostPublishButton extends _element.Component {
126
128
  isToggle,
127
129
  onSave,
128
130
  onStatusChange,
129
- onSubmit = _lodash.noop,
131
+ onSubmit = noop,
130
132
  onToggle,
131
133
  visibility,
132
134
  hasNonPostEntityChanges,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-publish-button/index.js"],"names":["PostPublishButton","Component","constructor","props","buttonNode","createOnClick","bind","closeEntitiesSavedStates","state","entitiesSavedStatesCallback","componentDidMount","focusOnMount","current","focus","callback","args","hasNonPostEntityChanges","setEntitiesSavedStatesCallback","setState","noop","savedEntities","postType","postId","elt","kind","name","key","render","forceIsDirty","forceIsSaving","hasPublishAction","isBeingScheduled","isOpen","isPostSavingLocked","isPublishable","isPublished","isSaveable","isSaving","isAutoSaving","isToggle","onSave","onStatusChange","onSubmit","onToggle","visibility","isSavingNonPostEntityChanges","isButtonDisabled","isToggleDisabled","publishStatus","onClickButton","onClickToggle","buttonProps","className","isBusy","variant","onClick","toggleProps","toggleChildren","buttonChildren","componentProps","componentChildren","select","isSavingPost","isAutosavingPost","isEditedPostBeingScheduled","getEditedPostVisibility","isCurrentPostPublished","isEditedPostSaveable","isEditedPostPublishable","getCurrentPost","getCurrentPostType","getCurrentPostId","editorStore","_isAutoSaving","dispatch","editPost","savePost","status","undoIgnore"],"mappings":";;;;;;;;;AAUA;;;;AAPA;;AACA;;AAKA;;AAEA;;AACA;;AACA;;AAKA;;AACA;;AAnBA;AACA;AACA;;AAIA;AACA;AACA;;AAOA;AACA;AACA;AAIO,MAAMA,iBAAN,SAAgCC,kBAAhC,CAA0C;AAChDC,EAAAA,WAAW,CAAEC,KAAF,EAAU;AACpB,UAAOA,KAAP;AACA,SAAKC,UAAL,GAAkB,yBAAlB;AAEA,SAAKC,aAAL,GAAqB,KAAKA,aAAL,CAAmBC,IAAnB,CAAyB,IAAzB,CAArB;AACA,SAAKC,wBAAL,GAAgC,KAAKA,wBAAL,CAA8BD,IAA9B,CAC/B,IAD+B,CAAhC;AAIA,SAAKE,KAAL,GAAa;AACZC,MAAAA,2BAA2B,EAAE;AADjB,KAAb;AAGA;;AACDC,EAAAA,iBAAiB,GAAG;AACnB,QAAK,KAAKP,KAAL,CAAWQ,YAAhB,EAA+B;AAC9B,WAAKP,UAAL,CAAgBQ,OAAhB,CAAwBC,KAAxB;AACA;AACD;;AAEDR,EAAAA,aAAa,CAAES,QAAF,EAAa;AAAA;;AACzB,WAAO,YAAe;AAAA,wCAAVC,IAAU;AAAVA,QAAAA,IAAU;AAAA;;AACrB,YAAM;AACLC,QAAAA,uBADK;AAELC,QAAAA;AAFK,UAGF,KAAI,CAACd,KAHT,CADqB,CAKrB;AACA;AACA;AACA;AACA;;AACA,UAAKa,uBAAuB,IAAIC,8BAAhC,EAAiE;AAChE;AACA;AACA;AACA,QAAA,KAAI,CAACC,QAAL,CAAe;AACdT,UAAAA,2BAA2B,EAAE,MAAMK,QAAQ,CAAE,GAAGC,IAAL;AAD7B,SAAf,E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BAAuB,EAJ7B;AAKN7B,IAAAA,UAAU,EAAE+B,oBAAoB,EAL1B;AAMNlC,IAAAA,kBAAkB,EAAEA,kBAAkB,EANhC;AAONC,IAAAA,aAAa,EAAEkC,uBAAuB,EAPhC;AAQNjC,IAAAA,WAAW,EAAE+B,sBAAsB,EAR7B;AASNpC,IAAAA,gBAAgB,EAAE,iBACjBuC,cAAc,EADG,EAEjB,CAAE,QAAF,EAAY,mBAAZ,CAFiB,EAGjB,KAHiB,CATZ;AAcNhD,IAAAA,QAAQ,EAAEiD,kBAAkB,EAdtB;AAeNhD,IAAAA,MAAM,EAAEiD,gBAAgB,EAflB;AAgBNvD,IAAAA,uBAAuB,EAAEA,uBAAuB,EAhB1C;AAiBN6B,IAAAA,4BAA4B,EAAEA,4BAA4B;AAjBpD,GAAP;AAmBA,CApCD,CADuB,EAsCvB,wBAAgB6B,QAAF,IAAgB;AAC7B,QAAM;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,MAAyBF,QAAQ,CAAEF,YAAF,CAAvC;AACA,SAAO;AACN/B,IAAAA,cAAc,EAAIoC,MAAF,IACfF,QAAQ,CAAE;AAAEE,MAAAA;AAAF,KAAF,EAAc;AAAEC,MAAAA,UAAU,EAAE;AAAd,KAAd,CAFH;AAGNtC,IAAAA,MAAM,EAAEoC;AAHF,GAAP;AAKA,CAPD,CAtCuB,CAAT,EA8CV5E,iBA9CU,C","sourcesContent":["/**\n * External dependencies\n */\nimport { noop, get, some } from 'lodash';\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { Button } from '@wordpress/components';\nimport { Component, createRef } from '@wordpress/element';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport PublishButtonLabel from './label';\nimport { store as editorStore } from '../../store';\n\nexport class PostPublishButton extends Component {\n\tconstructor( props ) {\n\t\tsuper( props );\n\t\tthis.buttonNode = createRef();\n\n\t\tthis.createOnClick = this.createOnClick.bind( this );\n\t\tthis.closeEntitiesSavedStates = this.closeEntitiesSavedStates.bind(\n\t\t\tthis\n\t\t);\n\n\t\tthis.state = {\n\t\t\tentitiesSavedStatesCallback: false,\n\t\t};\n\t}\n\tcomponentDidMount() {\n\t\tif ( this.props.focusOnMount ) {\n\t\t\tthis.buttonNode.current.focus();\n\t\t}\n\t}\n\n\tcreateOnClick( callback ) {\n\t\treturn ( ...args ) => {\n\t\t\tconst {\n\t\t\t\thasNonPostEntityChanges,\n\t\t\t\tsetEntitiesSavedStatesCallback,\n\t\t\t} = this.props;\n\t\t\t// If a post with non-post entities is published, but the user\n\t\t\t// elects to not save changes to the non-post entities, those\n\t\t\t// entities will still be dirty when the Publish button is clicked.\n\t\t\t// We also need to check that the `setEntitiesSavedStatesCallback`\n\t\t\t// prop was passed. See https://github.com/WordPress/gutenberg/pull/37383\n\t\t\tif ( hasNonPostEntityChanges && setEntitiesSavedStatesCallback ) {\n\t\t\t\t// The modal for multiple entity saving will open,\n\t\t\t\t// hold the callback for saving/publishing the post\n\t\t\t\t// so that we can call it if the post entity is checked.\n\t\t\t\tthis.setState( {\n\t\t\t\t\tentitiesSavedStatesCallback: () => callback( ...args ),\n\t\t\t\t} );\n\n\t\t\t\t// Open the save panel by setting its callback.\n\t\t\t\t// To set a function on the useState hook, we must set it\n\t\t\t\t// with another function (() => myFunction). Passing the\n\t\t\t\t// function on its own will cause an error when called.\n\t\t\t\tsetEntitiesSavedStatesCallback(\n\t\t\t\t\t() => this.closeEntitiesSavedStates\n\t\t\t\t);\n\t\t\t\treturn noop;\n\t\t\t}\n\n\t\t\treturn callback( ...args );\n\t\t};\n\t}\n\n\tcloseEntitiesSavedStates( savedEntities ) {\n\t\tconst { postType, postId } = this.props;\n\t\tconst { entitiesSavedStatesCallback } = this.state;\n\t\tthis.setState( { entitiesSavedStatesCallback: false }, () => {\n\t\t\tif (\n\t\t\t\tsavedEntities &&\n\t\t\t\tsome(\n\t\t\t\t\tsavedEntities,\n\t\t\t\t\t( elt ) =>\n\t\t\t\t\t\telt.kind === 'postType' &&\n\t\t\t\t\t\telt.name === postType &&\n\t\t\t\t\t\telt.key === postId\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\t// The post entity was checked, call the held callback from `createOnClick`.\n\t\t\t\tentitiesSavedStatesCallback();\n\t\t\t}\n\t\t} );\n\t}\n\n\trender() {\n\t\tconst {\n\t\t\tforceIsDirty,\n\t\t\tforceIsSaving,\n\t\t\thasPublishAction,\n\t\t\tisBeingScheduled,\n\t\t\tisOpen,\n\t\t\tisPostSavingLocked,\n\t\t\tisPublishable,\n\t\t\tisPublished,\n\t\t\tisSaveable,\n\t\t\tisSaving,\n\t\t\tisAutoSaving,\n\t\t\tisToggle,\n\t\t\tonSave,\n\t\t\tonStatusChange,\n\t\t\tonSubmit = noop,\n\t\t\tonToggle,\n\t\t\tvisibility,\n\t\t\thasNonPostEntityChanges,\n\t\t\tisSavingNonPostEntityChanges,\n\t\t} = this.props;\n\n\t\tconst isButtonDisabled =\n\t\t\t( isSaving ||\n\t\t\t\tforceIsSaving ||\n\t\t\t\t! isSaveable ||\n\t\t\t\tisPostSavingLocked ||\n\t\t\t\t( ! isPublishable && ! forceIsDirty ) ) &&\n\t\t\t( ! hasNonPostEntityChanges || isSavingNonPostEntityChanges );\n\n\t\tconst isToggleDisabled =\n\t\t\t( isPublished ||\n\t\t\t\tisSaving ||\n\t\t\t\tforceIsSaving ||\n\t\t\t\t! isSaveable ||\n\t\t\t\t( ! isPublishable && ! forceIsDirty ) ) &&\n\t\t\t( ! hasNonPostEntityChanges || isSavingNonPostEntityChanges );\n\n\t\tlet publishStatus;\n\t\tif ( ! hasPublishAction ) {\n\t\t\tpublishStatus = 'pending';\n\t\t} else if ( visibility === 'private' ) {\n\t\t\tpublishStatus = 'private';\n\t\t} else if ( isBeingScheduled ) {\n\t\t\tpublishStatus = 'future';\n\t\t} else {\n\t\t\tpublishStatus = 'publish';\n\t\t}\n\n\t\tconst onClickButton = () => {\n\t\t\tif ( isButtonDisabled ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tonSubmit();\n\t\t\tonStatusChange( publishStatus );\n\t\t\tonSave();\n\t\t};\n\n\t\tconst onClickToggle = () => {\n\t\t\tif ( isToggleDisabled ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tonToggle();\n\t\t};\n\n\t\tconst buttonProps = {\n\t\t\t'aria-disabled': isButtonDisabled,\n\t\t\tclassName: 'editor-post-publish-button',\n\t\t\tisBusy: ! isAutoSaving && isSaving && isPublished,\n\t\t\tvariant: 'primary',\n\t\t\tonClick: this.createOnClick( onClickButton ),\n\t\t};\n\n\t\tconst toggleProps = {\n\t\t\t'aria-disabled': isToggleDisabled,\n\t\t\t'aria-expanded': isOpen,\n\t\t\tclassName: 'editor-post-publish-panel__toggle',\n\t\t\tisBusy: isSaving && isPublished,\n\t\t\tvariant: 'primary',\n\t\t\tonClick: this.createOnClick( onClickToggle ),\n\t\t};\n\n\t\tconst toggleChildren = isBeingScheduled\n\t\t\t? __( 'Schedule…' )\n\t\t\t: __( 'Publish' );\n\t\tconst buttonChildren = (\n\t\t\t<PublishButtonLabel\n\t\t\t\tforceIsSaving={ forceIsSaving }\n\t\t\t\thasNonPostEntityChanges={ hasNonPostEntityChanges }\n\t\t\t/>\n\t\t);\n\n\t\tconst componentProps = isToggle ? toggleProps : buttonProps;\n\t\tconst componentChildren = isToggle ? toggleChildren : buttonChildren;\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<Button\n\t\t\t\t\tref={ this.buttonNode }\n\t\t\t\t\t{ ...componentProps }\n\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\tcomponentProps.className,\n\t\t\t\t\t\t'editor-post-publish-button__button',\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'has-changes-dot': hasNonPostEntityChanges,\n\t\t\t\t\t\t}\n\t\t\t\t\t) }\n\t\t\t\t>\n\t\t\t\t\t{ componentChildren }\n\t\t\t\t</Button>\n\t\t\t</>\n\t\t);\n\t}\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst {\n\t\t\tisSavingPost,\n\t\t\tisAutosavingPost,\n\t\t\tisEditedPostBeingScheduled,\n\t\t\tgetEditedPostVisibility,\n\t\t\tisCurrentPostPublished,\n\t\t\tisEditedPostSaveable,\n\t\t\tisEditedPostPublishable,\n\t\t\tisPostSavingLocked,\n\t\t\tgetCurrentPost,\n\t\t\tgetCurrentPostType,\n\t\t\tgetCurrentPostId,\n\t\t\thasNonPostEntityChanges,\n\t\t\tisSavingNonPostEntityChanges,\n\t\t} = select( editorStore );\n\t\tconst _isAutoSaving = isAutosavingPost();\n\t\treturn {\n\t\t\tisSaving: isSavingPost() || _isAutoSaving,\n\t\t\tisAutoSaving: _isAutoSaving,\n\t\t\tisBeingScheduled: isEditedPostBeingScheduled(),\n\t\t\tvisibility: getEditedPostVisibility(),\n\t\t\tisSaveable: isEditedPostSaveable(),\n\t\t\tisPostSavingLocked: isPostSavingLocked(),\n\t\t\tisPublishable: isEditedPostPublishable(),\n\t\t\tisPublished: isCurrentPostPublished(),\n\t\t\thasPublishAction: get(\n\t\t\t\tgetCurrentPost(),\n\t\t\t\t[ '_links', 'wp:action-publish' ],\n\t\t\t\tfalse\n\t\t\t),\n\t\t\tpostType: getCurrentPostType(),\n\t\t\tpostId: getCurrentPostId(),\n\t\t\thasNonPostEntityChanges: hasNonPostEntityChanges(),\n\t\t\tisSavingNonPostEntityChanges: isSavingNonPostEntityChanges(),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { editPost, savePost } = dispatch( editorStore );\n\t\treturn {\n\t\t\tonStatusChange: ( status ) =>\n\t\t\t\teditPost( { status }, { undoIgnore: true } ),\n\t\t\tonSave: savePost,\n\t\t};\n\t} ),\n] )( PostPublishButton );\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/post-publish-button/index.js"],"names":["noop","PostPublishButton","Component","constructor","props","buttonNode","createOnClick","bind","closeEntitiesSavedStates","state","entitiesSavedStatesCallback","componentDidMount","focusOnMount","current","focus","callback","args","hasNonPostEntityChanges","setEntitiesSavedStatesCallback","setState","savedEntities","postType","postId","elt","kind","name","key","render","forceIsDirty","forceIsSaving","hasPublishAction","isBeingScheduled","isOpen","isPostSavingLocked","isPublishable","isPublished","isSaveable","isSaving","isAutoSaving","isToggle","onSave","onStatusChange","onSubmit","onToggle","visibility","isSavingNonPostEntityChanges","isButtonDisabled","isToggleDisabled","publishStatus","onClickButton","onClickToggle","buttonProps","className","isBusy","variant","onClick","toggleProps","toggleChildren","buttonChildren","componentProps","componentChildren","select","isSavingPost","isAutosavingPost","isEditedPostBeingScheduled","getEditedPostVisibility","isCurrentPostPublished","isEditedPostSaveable","isEditedPostPublishable","getCurrentPost","getCurrentPostType","getCurrentPostId","editorStore","_isAutoSaving","dispatch","editPost","savePost","status","undoIgnore"],"mappings":";;;;;;;;;AAUA;;;;AAPA;;AACA;;AAKA;;AAEA;;AACA;;AACA;;AAKA;;AACA;;AAnBA;AACA;AACA;;AAIA;AACA;AACA;;AAOA;AACA;AACA;AAIA,MAAMA,IAAI,GAAG,MAAM,CAAE,CAArB;;AAEO,MAAMC,iBAAN,SAAgCC,kBAAhC,CAA0C;AAChDC,EAAAA,WAAW,CAAEC,KAAF,EAAU;AACpB,UAAOA,KAAP;AACA,SAAKC,UAAL,GAAkB,yBAAlB;AAEA,SAAKC,aAAL,GAAqB,KAAKA,aAAL,CAAmBC,IAAnB,CAAyB,IAAzB,CAArB;AACA,SAAKC,wBAAL,GACC,KAAKA,wBAAL,CAA8BD,IAA9B,CAAoC,IAApC,CADD;AAGA,SAAKE,KAAL,GAAa;AACZC,MAAAA,2BAA2B,EAAE;AADjB,KAAb;AAGA;;AACDC,EAAAA,iBAAiB,GAAG;AACnB,QAAK,KAAKP,KAAL,CAAWQ,YAAhB,EAA+B;AAC9B,WAAKP,UAAL,CAAgBQ,OAAhB,CAAwBC,KAAx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AAP;AAKA,CAPD,CAtCuB,CAAT,EA8CV3E,iBA9CU,C","sourcesContent":["/**\n * External dependencies\n */\nimport { get, some } from 'lodash';\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { Button } from '@wordpress/components';\nimport { Component, createRef } from '@wordpress/element';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport PublishButtonLabel from './label';\nimport { store as editorStore } from '../../store';\n\nconst noop = () => {};\n\nexport class PostPublishButton extends Component {\n\tconstructor( props ) {\n\t\tsuper( props );\n\t\tthis.buttonNode = createRef();\n\n\t\tthis.createOnClick = this.createOnClick.bind( this );\n\t\tthis.closeEntitiesSavedStates =\n\t\t\tthis.closeEntitiesSavedStates.bind( this );\n\n\t\tthis.state = {\n\t\t\tentitiesSavedStatesCallback: false,\n\t\t};\n\t}\n\tcomponentDidMount() {\n\t\tif ( this.props.focusOnMount ) {\n\t\t\tthis.buttonNode.current.focus();\n\t\t}\n\t}\n\n\tcreateOnClick( callback ) {\n\t\treturn ( ...args ) => {\n\t\t\tconst { hasNonPostEntityChanges, setEntitiesSavedStatesCallback } =\n\t\t\t\tthis.props;\n\t\t\t// If a post with non-post entities is published, but the user\n\t\t\t// elects to not save changes to the non-post entities, those\n\t\t\t// entities will still be dirty when the Publish button is clicked.\n\t\t\t// We also need to check that the `setEntitiesSavedStatesCallback`\n\t\t\t// prop was passed. See https://github.com/WordPress/gutenberg/pull/37383\n\t\t\tif ( hasNonPostEntityChanges && setEntitiesSavedStatesCallback ) {\n\t\t\t\t// The modal for multiple entity saving will open,\n\t\t\t\t// hold the callback for saving/publishing the post\n\t\t\t\t// so that we can call it if the post entity is checked.\n\t\t\t\tthis.setState( {\n\t\t\t\t\tentitiesSavedStatesCallback: () => callback( ...args ),\n\t\t\t\t} );\n\n\t\t\t\t// Open the save panel by setting its callback.\n\t\t\t\t// To set a function on the useState hook, we must set it\n\t\t\t\t// with another function (() => myFunction). Passing the\n\t\t\t\t// function on its own will cause an error when called.\n\t\t\t\tsetEntitiesSavedStatesCallback(\n\t\t\t\t\t() => this.closeEntitiesSavedStates\n\t\t\t\t);\n\t\t\t\treturn noop;\n\t\t\t}\n\n\t\t\treturn callback( ...args );\n\t\t};\n\t}\n\n\tcloseEntitiesSavedStates( savedEntities ) {\n\t\tconst { postType, postId } = this.props;\n\t\tconst { entitiesSavedStatesCallback } = this.state;\n\t\tthis.setState( { entitiesSavedStatesCallback: false }, () => {\n\t\t\tif (\n\t\t\t\tsavedEntities &&\n\t\t\t\tsome(\n\t\t\t\t\tsavedEntities,\n\t\t\t\t\t( elt ) =>\n\t\t\t\t\t\telt.kind === 'postType' &&\n\t\t\t\t\t\telt.name === postType &&\n\t\t\t\t\t\telt.key === postId\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\t// The post entity was checked, call the held callback from `createOnClick`.\n\t\t\t\tentitiesSavedStatesCallback();\n\t\t\t}\n\t\t} );\n\t}\n\n\trender() {\n\t\tconst {\n\t\t\tforceIsDirty,\n\t\t\tforceIsSaving,\n\t\t\thasPublishAction,\n\t\t\tisBeingScheduled,\n\t\t\tisOpen,\n\t\t\tisPostSavingLocked,\n\t\t\tisPublishable,\n\t\t\tisPublished,\n\t\t\tisSaveable,\n\t\t\tisSaving,\n\t\t\tisAutoSaving,\n\t\t\tisToggle,\n\t\t\tonSave,\n\t\t\tonStatusChange,\n\t\t\tonSubmit = noop,\n\t\t\tonToggle,\n\t\t\tvisibility,\n\t\t\thasNonPostEntityChanges,\n\t\t\tisSavingNonPostEntityChanges,\n\t\t} = this.props;\n\n\t\tconst isButtonDisabled =\n\t\t\t( isSaving ||\n\t\t\t\tforceIsSaving ||\n\t\t\t\t! isSaveable ||\n\t\t\t\tisPostSavingLocked ||\n\t\t\t\t( ! isPublishable && ! forceIsDirty ) ) &&\n\t\t\t( ! hasNonPostEntityChanges || isSavingNonPostEntityChanges );\n\n\t\tconst isToggleDisabled =\n\t\t\t( isPublished ||\n\t\t\t\tisSaving ||\n\t\t\t\tforceIsSaving ||\n\t\t\t\t! isSaveable ||\n\t\t\t\t( ! isPublishable && ! forceIsDirty ) ) &&\n\t\t\t( ! hasNonPostEntityChanges || isSavingNonPostEntityChanges );\n\n\t\tlet publishStatus;\n\t\tif ( ! hasPublishAction ) {\n\t\t\tpublishStatus = 'pending';\n\t\t} else if ( visibility === 'private' ) {\n\t\t\tpublishStatus = 'private';\n\t\t} else if ( isBeingScheduled ) {\n\t\t\tpublishStatus = 'future';\n\t\t} else {\n\t\t\tpublishStatus = 'publish';\n\t\t}\n\n\t\tconst onClickButton = () => {\n\t\t\tif ( isButtonDisabled ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tonSubmit();\n\t\t\tonStatusChange( publishStatus );\n\t\t\tonSave();\n\t\t};\n\n\t\tconst onClickToggle = () => {\n\t\t\tif ( isToggleDisabled ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tonToggle();\n\t\t};\n\n\t\tconst buttonProps = {\n\t\t\t'aria-disabled': isButtonDisabled,\n\t\t\tclassName: 'editor-post-publish-button',\n\t\t\tisBusy: ! isAutoSaving && isSaving && isPublished,\n\t\t\tvariant: 'primary',\n\t\t\tonClick: this.createOnClick( onClickButton ),\n\t\t};\n\n\t\tconst toggleProps = {\n\t\t\t'aria-disabled': isToggleDisabled,\n\t\t\t'aria-expanded': isOpen,\n\t\t\tclassName: 'editor-post-publish-panel__toggle',\n\t\t\tisBusy: isSaving && isPublished,\n\t\t\tvariant: 'primary',\n\t\t\tonClick: this.createOnClick( onClickToggle ),\n\t\t};\n\n\t\tconst toggleChildren = isBeingScheduled\n\t\t\t? __( 'Schedule…' )\n\t\t\t: __( 'Publish' );\n\t\tconst buttonChildren = (\n\t\t\t<PublishButtonLabel\n\t\t\t\tforceIsSaving={ forceIsSaving }\n\t\t\t\thasNonPostEntityChanges={ hasNonPostEntityChanges }\n\t\t\t/>\n\t\t);\n\n\t\tconst componentProps = isToggle ? toggleProps : buttonProps;\n\t\tconst componentChildren = isToggle ? toggleChildren : buttonChildren;\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<Button\n\t\t\t\t\tref={ this.buttonNode }\n\t\t\t\t\t{ ...componentProps }\n\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\tcomponentProps.className,\n\t\t\t\t\t\t'editor-post-publish-button__button',\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'has-changes-dot': hasNonPostEntityChanges,\n\t\t\t\t\t\t}\n\t\t\t\t\t) }\n\t\t\t\t>\n\t\t\t\t\t{ componentChildren }\n\t\t\t\t</Button>\n\t\t\t</>\n\t\t);\n\t}\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst {\n\t\t\tisSavingPost,\n\t\t\tisAutosavingPost,\n\t\t\tisEditedPostBeingScheduled,\n\t\t\tgetEditedPostVisibility,\n\t\t\tisCurrentPostPublished,\n\t\t\tisEditedPostSaveable,\n\t\t\tisEditedPostPublishable,\n\t\t\tisPostSavingLocked,\n\t\t\tgetCurrentPost,\n\t\t\tgetCurrentPostType,\n\t\t\tgetCurrentPostId,\n\t\t\thasNonPostEntityChanges,\n\t\t\tisSavingNonPostEntityChanges,\n\t\t} = select( editorStore );\n\t\tconst _isAutoSaving = isAutosavingPost();\n\t\treturn {\n\t\t\tisSaving: isSavingPost() || _isAutoSaving,\n\t\t\tisAutoSaving: _isAutoSaving,\n\t\t\tisBeingScheduled: isEditedPostBeingScheduled(),\n\t\t\tvisibility: getEditedPostVisibility(),\n\t\t\tisSaveable: isEditedPostSaveable(),\n\t\t\tisPostSavingLocked: isPostSavingLocked(),\n\t\t\tisPublishable: isEditedPostPublishable(),\n\t\t\tisPublished: isCurrentPostPublished(),\n\t\t\thasPublishAction: get(\n\t\t\t\tgetCurrentPost(),\n\t\t\t\t[ '_links', 'wp:action-publish' ],\n\t\t\t\tfalse\n\t\t\t),\n\t\t\tpostType: getCurrentPostType(),\n\t\t\tpostId: getCurrentPostId(),\n\t\t\thasNonPostEntityChanges: hasNonPostEntityChanges(),\n\t\t\tisSavingNonPostEntityChanges: isSavingNonPostEntityChanges(),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { editPost, savePost } = dispatch( editorStore );\n\t\treturn {\n\t\t\tonStatusChange: ( status ) =>\n\t\t\t\teditPost( { status }, { undoIgnore: true } ),\n\t\t\tonSave: savePost,\n\t\t};\n\t} ),\n] )( PostPublishButton );\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-publish-panel/index.js"],"names":["PostPublishPanel","Component","constructor","arguments","onSubmit","bind","componentDidUpdate","prevProps","isPublished","props","isSaving","isDirty","onClose","hasPublishAction","isPostTypeViewable","render","forceIsDirty","forceIsSaving","isBeingScheduled","isPublishSidebarEnabled","isScheduled","isSavingNonPostEntityChanges","onTogglePublishSidebar","PostPublishExtension","PrePublishExtension","additionalProps","propsForPanel","isPublishedOrScheduled","isPrePublish","isPostPublish","closeSmall","select","getPostType","coreStore","getCurrentPost","getEditedPostAttribute","isCurrentPostPublished","isCurrentPostScheduled","isEditedPostBeingScheduled","isEditedPostDirty","isSavingPost","editorStore","postType","dispatch","disablePublishSidebar","enablePublishSidebar","withFocusReturn","withConstrainedTabbing"],"mappings":";;;;;;;;;AASA;;;;AANA;;AAKA;;AAEA;;AAOA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AA5BA;AACA;AACA;;AAGA;AACA;AACA;;AAeA;AACA;AACA;AAMO,MAAMA,gBAAN,SAA+BC,kBAA/B,CAAyC;AAC/CC,EAAAA,WAAW,GAAG;AACb,UAAO,GAAGC,SAAV;AACA,SAAKC,QAAL,GAAgB,KAAKA,QAAL,CAAcC,IAAd,CAAoB,IAApB,CAAhB;AACA;;AAEDC,EAAAA,kBAAkB,CAAEC,SAAF,EAAc;AAC/B;AACA;AACA,QACCA,SAAS,CAACC,WAAV,IACA,CAAE,KAAKC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B,CAAE,MAAF,CAAxB,CAA5B;AAEA,SAAO;AACNtB,IAAAA,gBAAgB,EAAE,iBACjBqB,cAAc,EADG,EAEjB,CAAE,QAAF,EAAY,mBAAZ,CAFiB,EAGjB,KAHiB,CADZ;AAMNpB,IAAAA,kBAAkB,EAAE,iBAAK4B,QAAL,EAAe,CAAE,UAAF,CAAf,EAA+B,KAA/B,CANd;AAONxB,IAAAA,gBAAgB,EAAEoB,0BAA0B,EAPtC;AAQN3B,IAAAA,OAAO,EAAE4B,iBAAiB,EARpB;AASN/B,IAAAA,WAAW,EAAE4B,sBAAsB,EAT7B;AAUNjB,IAAAA,uBAAuB,EAAEA,uBAAuB,EAV1C;AAWNT,IAAAA,QAAQ,EAAE8B,YAAY,EAXhB;AAYNnB,IAAAA,4BAA4B,EAAEA,4BAA4B,EAZpD;AAaND,IAAAA,WAAW,EAAEiB,sBAAsB;AAb7B,GAAP;AAeA,CA9BD,CADuB,EAgCvB,wBAAc,CAAEM,QAAF,WAA6C;AAAA,MAAjC;AAAExB,IAAAA;AAAF,GAAiC;AAC1D,QAAM;AAAEyB,IAAAA,qBAAF;AAAyBC,IAAAA;AAAzB,MAAkDF,QAAQ,CAC/DF,YAD+D,CAAhE;AAGA,SAAO;AACNnB,IAAAA,sBAAsB,EAAE,MAAM;AAC7B,UAAKH,uBAAL,EAA+B;AAC9ByB,QAAAA,qBAAqB;AACrB,OAFD,MAEO;AACNC,QAAAA,oBAAoB;AACpB;AACD;AAPK,GAAP;AASA,CAbD,CAhCuB,EA8CvBC,2BA9CuB,EA+CvBC,kCA/CuB,CAAT,EAgDV/C,gBAhDU,C","sourcesContent":["/**\n * External dependencies\n */\nimport { get, omit } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Component } from '@wordpress/element';\nimport {\n\tButton,\n\tSpinner,\n\tCheckboxControl,\n\twithFocusReturn,\n\twithConstrainedTabbing,\n} from '@wordpress/components';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\nimport { closeSmall } from '@wordpress/icons';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport PostPublishButton from '../post-publish-button';\nimport PostPublishPanelPrepublish from './prepublish';\nimport PostPublishPanelPostpublish from './postpublish';\nimport { store as editorStore } from '../../store';\n\nexport class PostPublishPanel extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\t\tthis.onSubmit = this.onSubmit.bind( this );\n\t}\n\n\tcomponentDidUpdate( prevProps ) {\n\t\t// Automatically collapse the publish sidebar when a post\n\t\t// is published and the user makes an edit.\n\t\tif (\n\t\t\tprevProps.isPublished &&\n\t\t\t! this.props.isSaving &&\n\t\t\tthis.props.isDirty\n\t\t) {\n\t\t\tthis.props.onClose();\n\t\t}\n\t}\n\n\tonSubmit() {\n\t\tconst { onClose, hasPublishAction, isPostTypeViewable } = this.props;\n\t\tif ( ! hasPublishAction || ! isPostTypeViewable ) {\n\t\t\tonClose();\n\t\t}\n\t}\n\n\trender() {\n\t\tconst {\n\t\t\tforceIsDirty,\n\t\t\tforceIsSaving,\n\t\t\tisBeingScheduled,\n\t\t\tisPublished,\n\t\t\tisPublishSidebarEnabled,\n\t\t\tisScheduled,\n\t\t\tisSaving,\n\t\t\tisSavingNonPostEntityChanges,\n\t\t\tonClose,\n\t\t\tonTogglePublishSidebar,\n\t\t\tPostPublishExtension,\n\t\t\tPrePublishExtension,\n\t\t\t...additionalProps\n\t\t} = this.props;\n\t\tconst propsForPanel = omit( additionalProps, [\n\t\t\t'hasPublishAction',\n\t\t\t'isDirty',\n\t\t\t'isPostTypeViewable',\n\t\t] );\n\t\tconst isPublishedOrScheduled =\n\t\t\tisPublished || ( isScheduled && isBeingScheduled );\n\t\tconst isPrePublish = ! isPublishedOrScheduled && ! isSaving;\n\t\tconst isPostPublish = isPublishedOrScheduled && ! isSaving;\n\t\treturn (\n\t\t\t<div className=\"editor-post-publish-panel\" { ...propsForPanel }>\n\t\t\t\t<div className=\"editor-post-publish-panel__header\">\n\t\t\t\t\t{ isPostPublish ? (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tonClick={ onClose }\n\t\t\t\t\t\t\ticon={ closeSmall }\n\t\t\t\t\t\t\tlabel={ __( 'Close panel' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<div className=\"editor-post-publish-panel__header-publish-button\">\n\t\t\t\t\t\t\t\t<PostPublishButton\n\t\t\t\t\t\t\t\t\tfocusOnMount={ true }\n\t\t\t\t\t\t\t\t\tonSubmit={ this.onSubmit }\n\t\t\t\t\t\t\t\t\tforceIsDirty={ forceIsDirty }\n\t\t\t\t\t\t\t\t\tforceIsSaving={ forceIsSaving }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<div className=\"editor-post-publish-panel__header-cancel-button\">\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tdisabled={ isSavingNonPostEntityChanges }\n\t\t\t\t\t\t\t\t\tonClick={ onClose }\n\t\t\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t\t<div className=\"editor-post-publish-panel__content\">\n\t\t\t\t\t{ isPrePublish && (\n\t\t\t\t\t\t<PostPublishPanelPrepublish>\n\t\t\t\t\t\t\t{ PrePublishExtension && <PrePublishExtension /> }\n\t\t\t\t\t\t</PostPublishPanelPrepublish>\n\t\t\t\t\t) }\n\t\t\t\t\t{ isPostPublish && (\n\t\t\t\t\t\t<PostPublishPanelPostpublish focusOnMount={ true }>\n\t\t\t\t\t\t\t{ PostPublishExtension && <PostPublishExtension /> }\n\t\t\t\t\t\t</PostPublishPanelPostpublish>\n\t\t\t\t\t) }\n\t\t\t\t\t{ isSaving && <Spinner /> }\n\t\t\t\t</div>\n\t\t\t\t<div className=\"editor-post-publish-panel__footer\">\n\t\t\t\t\t<CheckboxControl\n\t\t\t\t\t\tlabel={ __( 'Always show pre-publish checks.' ) }\n\t\t\t\t\t\tchecked={ isPublishSidebarEnabled }\n\t\t\t\t\t\tonChange={ onTogglePublishSidebar }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t);\n\t}\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst { getPostType } = select( coreStore );\n\t\tconst {\n\t\t\tgetCurrentPost,\n\t\t\tgetEditedPostAttribute,\n\t\t\tisCurrentPostPublished,\n\t\t\tisCurrentPostScheduled,\n\t\t\tisEditedPostBeingScheduled,\n\t\t\tisEditedPostDirty,\n\t\t\tisSavingPost,\n\t\t\tisSavingNonPostEntityChanges,\n\t\t} = select( editorStore );\n\t\tconst { isPublishSidebarEnabled } = select( editorStore );\n\t\tconst postType = getPostType( getEditedPostAttribute( 'type' ) );\n\n\t\treturn {\n\t\t\thasPublishAction: get(\n\t\t\t\tgetCurrentPost(),\n\t\t\t\t[ '_links', 'wp:action-publish' ],\n\t\t\t\tfalse\n\t\t\t),\n\t\t\tisPostTypeViewable: get( postType, [ 'viewable' ], false ),\n\t\t\tisBeingScheduled: isEditedPostBeingScheduled(),\n\t\t\tisDirty: isEditedPostDirty(),\n\t\t\tisPublished: isCurrentPostPublished(),\n\t\t\tisPublishSidebarEnabled: isPublishSidebarEnabled(),\n\t\t\tisSaving: isSavingPost(),\n\t\t\tisSavingNonPostEntityChanges: isSavingNonPostEntityChanges(),\n\t\t\tisScheduled: isCurrentPostScheduled(),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch, { isPublishSidebarEnabled } ) => {\n\t\tconst { disablePublishSidebar, enablePublishSidebar } = dispatch(\n\t\t\teditorStore\n\t\t);\n\t\treturn {\n\t\t\tonTogglePublishSidebar: () => {\n\t\t\t\tif ( isPublishSidebarEnabled ) {\n\t\t\t\t\tdisablePublishSidebar();\n\t\t\t\t} else {\n\t\t\t\t\tenablePublishSidebar();\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t} ),\n\twithFocusReturn,\n\twithConstrainedTabbing,\n] )( PostPublishPanel );\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/post-publish-panel/index.js"],"names":["PostPublishPanel","Component","constructor","arguments","onSubmit","bind","componentDidUpdate","prevProps","isPublished","props","isSaving","isDirty","onClose","hasPublishAction","isPostTypeViewable","render","forceIsDirty","forceIsSaving","isBeingScheduled","isPublishSidebarEnabled","isScheduled","isSavingNonPostEntityChanges","onTogglePublishSidebar","PostPublishExtension","PrePublishExtension","additionalProps","propsForPanel","isPublishedOrScheduled","isPrePublish","isPostPublish","closeSmall","select","getPostType","coreStore","getCurrentPost","getEditedPostAttribute","isCurrentPostPublished","isCurrentPostScheduled","isEditedPostBeingScheduled","isEditedPostDirty","isSavingPost","editorStore","postType","dispatch","disablePublishSidebar","enablePublishSidebar","withFocusReturn","withConstrainedTabbing"],"mappings":";;;;;;;;;AASA;;;;AANA;;AAKA;;AAEA;;AAOA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AA5BA;AACA;AACA;;AAGA;AACA;AACA;;AAeA;AACA;AACA;AAMO,MAAMA,gBAAN,SAA+BC,kBAA/B,CAAyC;AAC/CC,EAAAA,WAAW,GAAG;AACb,UAAO,GAAGC,SAAV;AACA,SAAKC,QAAL,GAAgB,KAAKA,QAAL,CAAcC,IAAd,CAAoB,IAApB,CAAhB;AACA;;AAEDC,EAAAA,kBAAkB,CAAEC,SAAF,EAAc;AAC/B;AACA;AACA,QACCA,SAAS,CAACC,WAAV,IACA,CAAE,KAAKC,KAAL,CAAWC,QADb,IAEA,KAAKD,KAAL,CAAWE,OAHZ,EAIE;AACD,WAAKF,KAAL,CAAWG,OAAX;AACA;AACD;;AAEDR,EAAAA,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mBAAZ,CAFiB,EAGjB,KAHiB,CADZ;AAMNpB,IAAAA,kBAAkB,EAAE,iBAAK4B,QAAL,EAAe,CAAE,UAAF,CAAf,EAA+B,KAA/B,CANd;AAONxB,IAAAA,gBAAgB,EAAEoB,0BAA0B,EAPtC;AAQN3B,IAAAA,OAAO,EAAE4B,iBAAiB,EARpB;AASN/B,IAAAA,WAAW,EAAE4B,sBAAsB,EAT7B;AAUNjB,IAAAA,uBAAuB,EAAEA,uBAAuB,EAV1C;AAWNT,IAAAA,QAAQ,EAAE8B,YAAY,EAXhB;AAYNnB,IAAAA,4BAA4B,EAAEA,4BAA4B,EAZpD;AAaND,IAAAA,WAAW,EAAEiB,sBAAsB;AAb7B,GAAP;AAeA,CA9BD,CADuB,EAgCvB,wBAAc,CAAEM,QAAF,WAA6C;AAAA,MAAjC;AAAExB,IAAAA;AAAF,GAAiC;AAC1D,QAAM;AAAEyB,IAAAA,qBAAF;AAAyBC,IAAAA;AAAzB,MACLF,QAAQ,CAAEF,YAAF,CADT;AAEA,SAAO;AACNnB,IAAAA,sBAAsB,EAAE,MAAM;AAC7B,UAAKH,uBAAL,EAA+B;AAC9ByB,QAAAA,qBAAqB;AACrB,OAFD,MAEO;AACNC,QAAAA,oBAAoB;AACpB;AACD;AAPK,GAAP;AASA,CAZD,CAhCuB,EA6CvBC,2BA7CuB,EA8CvBC,kCA9CuB,CAAT,EA+CV/C,gBA/CU,C","sourcesContent":["/**\n * External dependencies\n */\nimport { get, omit } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Component } from '@wordpress/element';\nimport {\n\tButton,\n\tSpinner,\n\tCheckboxControl,\n\twithFocusReturn,\n\twithConstrainedTabbing,\n} from '@wordpress/components';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\nimport { closeSmall } from '@wordpress/icons';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport PostPublishButton from '../post-publish-button';\nimport PostPublishPanelPrepublish from './prepublish';\nimport PostPublishPanelPostpublish from './postpublish';\nimport { store as editorStore } from '../../store';\n\nexport class PostPublishPanel extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\t\tthis.onSubmit = this.onSubmit.bind( this );\n\t}\n\n\tcomponentDidUpdate( prevProps ) {\n\t\t// Automatically collapse the publish sidebar when a post\n\t\t// is published and the user makes an edit.\n\t\tif (\n\t\t\tprevProps.isPublished &&\n\t\t\t! this.props.isSaving &&\n\t\t\tthis.props.isDirty\n\t\t) {\n\t\t\tthis.props.onClose();\n\t\t}\n\t}\n\n\tonSubmit() {\n\t\tconst { onClose, hasPublishAction, isPostTypeViewable } = this.props;\n\t\tif ( ! hasPublishAction || ! isPostTypeViewable ) {\n\t\t\tonClose();\n\t\t}\n\t}\n\n\trender() {\n\t\tconst {\n\t\t\tforceIsDirty,\n\t\t\tforceIsSaving,\n\t\t\tisBeingScheduled,\n\t\t\tisPublished,\n\t\t\tisPublishSidebarEnabled,\n\t\t\tisScheduled,\n\t\t\tisSaving,\n\t\t\tisSavingNonPostEntityChanges,\n\t\t\tonClose,\n\t\t\tonTogglePublishSidebar,\n\t\t\tPostPublishExtension,\n\t\t\tPrePublishExtension,\n\t\t\t...additionalProps\n\t\t} = this.props;\n\t\tconst propsForPanel = omit( additionalProps, [\n\t\t\t'hasPublishAction',\n\t\t\t'isDirty',\n\t\t\t'isPostTypeViewable',\n\t\t] );\n\t\tconst isPublishedOrScheduled =\n\t\t\tisPublished || ( isScheduled && isBeingScheduled );\n\t\tconst isPrePublish = ! isPublishedOrScheduled && ! isSaving;\n\t\tconst isPostPublish = isPublishedOrScheduled && ! isSaving;\n\t\treturn (\n\t\t\t<div className=\"editor-post-publish-panel\" { ...propsForPanel }>\n\t\t\t\t<div className=\"editor-post-publish-panel__header\">\n\t\t\t\t\t{ isPostPublish ? (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tonClick={ onClose }\n\t\t\t\t\t\t\ticon={ closeSmall }\n\t\t\t\t\t\t\tlabel={ __( 'Close panel' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<div className=\"editor-post-publish-panel__header-publish-button\">\n\t\t\t\t\t\t\t\t<PostPublishButton\n\t\t\t\t\t\t\t\t\tfocusOnMount={ true }\n\t\t\t\t\t\t\t\t\tonSubmit={ this.onSubmit }\n\t\t\t\t\t\t\t\t\tforceIsDirty={ forceIsDirty }\n\t\t\t\t\t\t\t\t\tforceIsSaving={ forceIsSaving }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<div className=\"editor-post-publish-panel__header-cancel-button\">\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tdisabled={ isSavingNonPostEntityChanges }\n\t\t\t\t\t\t\t\t\tonClick={ onClose }\n\t\t\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t\t<div className=\"editor-post-publish-panel__content\">\n\t\t\t\t\t{ isPrePublish && (\n\t\t\t\t\t\t<PostPublishPanelPrepublish>\n\t\t\t\t\t\t\t{ PrePublishExtension && <PrePublishExtension /> }\n\t\t\t\t\t\t</PostPublishPanelPrepublish>\n\t\t\t\t\t) }\n\t\t\t\t\t{ isPostPublish && (\n\t\t\t\t\t\t<PostPublishPanelPostpublish focusOnMount={ true }>\n\t\t\t\t\t\t\t{ PostPublishExtension && <PostPublishExtension /> }\n\t\t\t\t\t\t</PostPublishPanelPostpublish>\n\t\t\t\t\t) }\n\t\t\t\t\t{ isSaving && <Spinner /> }\n\t\t\t\t</div>\n\t\t\t\t<div className=\"editor-post-publish-panel__footer\">\n\t\t\t\t\t<CheckboxControl\n\t\t\t\t\t\tlabel={ __( 'Always show pre-publish checks.' ) }\n\t\t\t\t\t\tchecked={ isPublishSidebarEnabled }\n\t\t\t\t\t\tonChange={ onTogglePublishSidebar }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t);\n\t}\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst { getPostType } = select( coreStore );\n\t\tconst {\n\t\t\tgetCurrentPost,\n\t\t\tgetEditedPostAttribute,\n\t\t\tisCurrentPostPublished,\n\t\t\tisCurrentPostScheduled,\n\t\t\tisEditedPostBeingScheduled,\n\t\t\tisEditedPostDirty,\n\t\t\tisSavingPost,\n\t\t\tisSavingNonPostEntityChanges,\n\t\t} = select( editorStore );\n\t\tconst { isPublishSidebarEnabled } = select( editorStore );\n\t\tconst postType = getPostType( getEditedPostAttribute( 'type' ) );\n\n\t\treturn {\n\t\t\thasPublishAction: get(\n\t\t\t\tgetCurrentPost(),\n\t\t\t\t[ '_links', 'wp:action-publish' ],\n\t\t\t\tfalse\n\t\t\t),\n\t\t\tisPostTypeViewable: get( postType, [ 'viewable' ], false ),\n\t\t\tisBeingScheduled: isEditedPostBeingScheduled(),\n\t\t\tisDirty: isEditedPostDirty(),\n\t\t\tisPublished: isCurrentPostPublished(),\n\t\t\tisPublishSidebarEnabled: isPublishSidebarEnabled(),\n\t\t\tisSaving: isSavingPost(),\n\t\t\tisSavingNonPostEntityChanges: isSavingNonPostEntityChanges(),\n\t\t\tisScheduled: isCurrentPostScheduled(),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch, { isPublishSidebarEnabled } ) => {\n\t\tconst { disablePublishSidebar, enablePublishSidebar } =\n\t\t\tdispatch( editorStore );\n\t\treturn {\n\t\t\tonTogglePublishSidebar: () => {\n\t\t\t\tif ( isPublishSidebarEnabled ) {\n\t\t\t\t\tdisablePublishSidebar();\n\t\t\t\t} else {\n\t\t\t\t\tenablePublishSidebar();\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t} ),\n\twithFocusReturn,\n\twithConstrainedTabbing,\n] )( PostPublishPanel );\n"]}