@wordpress/editor 12.7.0 → 12.10.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 (181) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/build/components/editor-help/help-section-title.native.js +43 -0
  3. package/build/components/editor-help/help-section-title.native.js.map +1 -0
  4. package/build/components/editor-help/help-topic-row.native.js +3 -2
  5. package/build/components/editor-help/help-topic-row.native.js.map +1 -1
  6. package/build/components/editor-help/icon-move-blocks.native.js +23 -0
  7. package/build/components/editor-help/icon-move-blocks.native.js.map +1 -0
  8. package/build/components/editor-help/index.native.js +10 -11
  9. package/build/components/editor-help/index.native.js.map +1 -1
  10. package/build/components/editor-help/move-blocks.native.js +14 -2
  11. package/build/components/editor-help/move-blocks.native.js.map +1 -1
  12. package/build/components/editor-help/view-sections.native.js +21 -5
  13. package/build/components/editor-help/view-sections.native.js.map +1 -1
  14. package/build/components/entities-saved-states/entity-record-item.js.map +1 -1
  15. package/build/components/entities-saved-states/index.js.map +1 -1
  16. package/build/components/global-keyboard-shortcuts/save-shortcut.js.map +1 -1
  17. package/build/components/local-autosave-monitor/index.js.map +1 -1
  18. package/build/components/page-attributes/parent.js.map +1 -1
  19. package/build/components/post-author/select.js.map +1 -1
  20. package/build/components/post-comments/index.js.map +1 -1
  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.map +1 -1
  30. package/build/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
  31. package/build/components/post-publish-panel/postpublish.js.map +1 -1
  32. package/build/components/post-publish-panel/prepublish.js.map +1 -1
  33. package/build/components/post-schedule/index.js +11 -18
  34. package/build/components/post-schedule/index.js.map +1 -1
  35. package/build/components/post-slug/index.js.map +1 -1
  36. package/build/components/post-sticky/index.js.map +1 -1
  37. package/build/components/post-switch-to-draft-button/index.js.map +1 -1
  38. package/build/components/post-taxonomies/flat-term-selector.js +2 -2
  39. package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
  40. package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
  41. package/build/components/post-text-editor/index.js +6 -6
  42. package/build/components/post-text-editor/index.js.map +1 -1
  43. package/build/components/post-title/index.js.map +1 -1
  44. package/build/components/post-title/index.native.js.map +1 -1
  45. package/build/components/post-trash/check.js.map +1 -1
  46. package/build/components/post-visibility/index.js +8 -11
  47. package/build/components/post-visibility/index.js.map +1 -1
  48. package/build/components/provider/index.js.map +1 -1
  49. package/build/components/provider/index.native.js +3 -1
  50. package/build/components/provider/index.native.js.map +1 -1
  51. package/build/components/provider/use-block-editor-settings.js +18 -10
  52. package/build/components/provider/use-block-editor-settings.js.map +1 -1
  53. package/build/components/template-validation-notice/index.js.map +1 -1
  54. package/build/components/theme-support-check/index.js +1 -1
  55. package/build/components/theme-support-check/index.js.map +1 -1
  56. package/build/hooks/custom-sources-backwards-compatibility.js.map +1 -1
  57. package/build/store/actions.js.map +1 -1
  58. package/build/store/selectors.js +2 -2
  59. package/build/store/selectors.js.map +1 -1
  60. package/build/utils/media-upload/index.js +4 -8
  61. package/build/utils/media-upload/index.js.map +1 -1
  62. package/build-module/components/editor-help/help-section-title.native.js +31 -0
  63. package/build-module/components/editor-help/help-section-title.native.js.map +1 -0
  64. package/build-module/components/editor-help/help-topic-row.native.js +3 -2
  65. package/build-module/components/editor-help/help-topic-row.native.js.map +1 -1
  66. package/build-module/components/editor-help/icon-move-blocks.native.js +13 -0
  67. package/build-module/components/editor-help/icon-move-blocks.native.js.map +1 -0
  68. package/build-module/components/editor-help/index.native.js +10 -12
  69. package/build-module/components/editor-help/index.native.js.map +1 -1
  70. package/build-module/components/editor-help/move-blocks.native.js +15 -3
  71. package/build-module/components/editor-help/move-blocks.native.js.map +1 -1
  72. package/build-module/components/editor-help/view-sections.native.js +22 -6
  73. package/build-module/components/editor-help/view-sections.native.js.map +1 -1
  74. package/build-module/components/entities-saved-states/entity-record-item.js.map +1 -1
  75. package/build-module/components/entities-saved-states/index.js.map +1 -1
  76. package/build-module/components/global-keyboard-shortcuts/save-shortcut.js.map +1 -1
  77. package/build-module/components/local-autosave-monitor/index.js.map +1 -1
  78. package/build-module/components/page-attributes/parent.js.map +1 -1
  79. package/build-module/components/post-author/select.js.map +1 -1
  80. package/build-module/components/post-comments/index.js.map +1 -1
  81. package/build-module/components/post-format/index.js.map +1 -1
  82. package/build-module/components/post-last-revision/check.js.map +1 -1
  83. package/build-module/components/post-last-revision/index.js.map +1 -1
  84. package/build-module/components/post-pending-status/check.js.map +1 -1
  85. package/build-module/components/post-pingbacks/index.js.map +1 -1
  86. package/build-module/components/post-publish-button/index.js +4 -1
  87. package/build-module/components/post-publish-button/index.js.map +1 -1
  88. package/build-module/components/post-publish-panel/index.js.map +1 -1
  89. package/build-module/components/post-publish-panel/maybe-category-panel.js.map +1 -1
  90. package/build-module/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
  91. package/build-module/components/post-publish-panel/postpublish.js.map +1 -1
  92. package/build-module/components/post-publish-panel/prepublish.js.map +1 -1
  93. package/build-module/components/post-schedule/index.js +12 -19
  94. package/build-module/components/post-schedule/index.js.map +1 -1
  95. package/build-module/components/post-slug/index.js.map +1 -1
  96. package/build-module/components/post-sticky/index.js.map +1 -1
  97. package/build-module/components/post-switch-to-draft-button/index.js.map +1 -1
  98. package/build-module/components/post-taxonomies/flat-term-selector.js +2 -2
  99. package/build-module/components/post-taxonomies/flat-term-selector.js.map +1 -1
  100. package/build-module/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
  101. package/build-module/components/post-text-editor/index.js +6 -6
  102. package/build-module/components/post-text-editor/index.js.map +1 -1
  103. package/build-module/components/post-title/index.js.map +1 -1
  104. package/build-module/components/post-title/index.native.js.map +1 -1
  105. package/build-module/components/post-trash/check.js.map +1 -1
  106. package/build-module/components/post-visibility/index.js +9 -12
  107. package/build-module/components/post-visibility/index.js.map +1 -1
  108. package/build-module/components/provider/index.js.map +1 -1
  109. package/build-module/components/provider/index.native.js +2 -1
  110. package/build-module/components/provider/index.native.js.map +1 -1
  111. package/build-module/components/provider/use-block-editor-settings.js +19 -11
  112. package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
  113. package/build-module/components/template-validation-notice/index.js.map +1 -1
  114. package/build-module/components/theme-support-check/index.js +2 -2
  115. package/build-module/components/theme-support-check/index.js.map +1 -1
  116. package/build-module/hooks/custom-sources-backwards-compatibility.js.map +1 -1
  117. package/build-module/store/actions.js.map +1 -1
  118. package/build-module/store/selectors.js +2 -2
  119. package/build-module/store/selectors.js.map +1 -1
  120. package/build-module/utils/media-upload/index.js +3 -5
  121. package/build-module/utils/media-upload/index.js.map +1 -1
  122. package/build-style/style-rtl.css +9 -17
  123. package/build-style/style.css +9 -17
  124. package/package.json +29 -29
  125. package/src/components/editor-help/help-section-title.native.js +29 -0
  126. package/src/components/editor-help/help-topic-row.native.js +2 -2
  127. package/src/components/editor-help/icon-move-blocks.native.js +10 -0
  128. package/src/components/editor-help/images/drag-and-drop-dark.png +0 -0
  129. package/src/components/editor-help/images/drag-and-drop-dark@2x.png +0 -0
  130. package/src/components/editor-help/images/drag-and-drop-dark@3x.png +0 -0
  131. package/src/components/editor-help/images/drag-and-drop-light.png +0 -0
  132. package/src/components/editor-help/images/drag-and-drop-light@2x.png +0 -0
  133. package/src/components/editor-help/images/drag-and-drop-light@3x.png +0 -0
  134. package/src/components/editor-help/index.native.js +26 -28
  135. package/src/components/editor-help/move-blocks.native.js +22 -2
  136. package/src/components/editor-help/style.scss +36 -4
  137. package/src/components/editor-help/test/index.native.js +1 -1
  138. package/src/components/editor-help/view-sections.native.js +23 -8
  139. package/src/components/entities-saved-states/entity-record-item.js +6 -6
  140. package/src/components/entities-saved-states/index.js +6 -9
  141. package/src/components/global-keyboard-shortcuts/save-shortcut.js +2 -3
  142. package/src/components/local-autosave-monitor/index.js +15 -20
  143. package/src/components/page-attributes/parent.js +4 -6
  144. package/src/components/post-author/select.js +2 -3
  145. package/src/components/post-comments/index.js +4 -3
  146. package/src/components/post-format/index.js +2 -3
  147. package/src/components/post-last-revision/check.js +2 -4
  148. package/src/components/post-last-revision/index.js +2 -4
  149. package/src/components/post-pending-status/check.js +2 -5
  150. package/src/components/post-pingbacks/index.js +2 -3
  151. package/src/components/post-publish-button/index.js +7 -8
  152. package/src/components/post-publish-panel/index.js +2 -3
  153. package/src/components/post-publish-panel/maybe-category-panel.js +2 -3
  154. package/src/components/post-publish-panel/maybe-post-format-panel.js +2 -3
  155. package/src/components/post-publish-panel/postpublish.js +2 -5
  156. package/src/components/post-publish-panel/prepublish.js +2 -3
  157. package/src/components/post-saved-state/style.scss +9 -0
  158. package/src/components/post-schedule/index.js +6 -13
  159. package/src/components/post-slug/index.js +2 -3
  160. package/src/components/post-slug/test/index.js +4 -4
  161. package/src/components/post-sticky/index.js +2 -3
  162. package/src/components/post-switch-to-draft-button/index.js +2 -5
  163. package/src/components/post-taxonomies/flat-term-selector.js +9 -10
  164. package/src/components/post-taxonomies/hierarchical-term-selector.js +4 -6
  165. package/src/components/post-text-editor/index.js +5 -6
  166. package/src/components/post-title/index.js +21 -31
  167. package/src/components/post-title/index.native.js +10 -16
  168. package/src/components/post-trash/check.js +2 -3
  169. package/src/components/post-visibility/index.js +9 -15
  170. package/src/components/post-visibility/style.scss +0 -17
  171. package/src/components/provider/index.js +2 -3
  172. package/src/components/provider/index.native.js +13 -11
  173. package/src/components/provider/use-block-editor-settings.js +27 -15
  174. package/src/components/table-of-contents/style.scss +1 -3
  175. package/src/components/template-validation-notice/index.js +2 -3
  176. package/src/components/theme-support-check/index.js +2 -2
  177. package/src/hooks/custom-sources-backwards-compatibility.js +45 -44
  178. package/src/store/actions.js +211 -190
  179. package/src/store/selectors.js +16 -21
  180. package/src/store/test/selectors.js +7 -8
  181. package/src/utils/media-upload/index.js +2 -5
@@ -4,7 +4,7 @@ import { createElement, Fragment } from "@wordpress/element";
4
4
  /**
5
5
  * External dependencies
6
6
  */
7
- import { noop, get, some } from 'lodash';
7
+ import { get, some } from 'lodash';
8
8
  import classnames from 'classnames';
9
9
  /**
10
10
  * WordPress dependencies
@@ -21,6 +21,9 @@ import { __ } from '@wordpress/i18n';
21
21
 
22
22
  import PublishButtonLabel from './label';
23
23
  import { store as editorStore } from '../../store';
24
+
25
+ const noop = () => {};
26
+
24
27
  export class PostPublishButton extends Component {
25
28
  constructor(props) {
26
29
  super(props);
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-publish-button/index.js"],"names":["noop","get","some","classnames","Button","Component","createRef","withSelect","withDispatch","compose","__","PublishButtonLabel","store","editorStore","PostPublishButton","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","_isAutoSaving","dispatch","editPost","savePost","status","undoIgnore"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,IAAT,EAAeC,GAA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AAEkC,aAFR;AAGNzC,IAAAA,gBAAgB,EAAEiC,0BAA0B,EAHtC;AAINpB,IAAAA,UAAU,EAAEqB,uBAAuB,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,EAAEzC,GAAG,CACpBgF,cAAc,EADM,EAEpB,CAAE,QAAF,EAAY,mBAAZ,CAFoB,EAGpB,KAHoB,CATf;AAcNhD,IAAAA,QAAQ,EAAEiD,kBAAkB,EAdtB;AAeNhD,IAAAA,MAAM,EAAEiD,gBAAgB,EAflB;AAgBNtD,IAAAA,uBAAuB,EAAEA,uBAAuB,EAhB1C;AAiBN4B,IAAAA,4BAA4B,EAAEA,4BAA4B;AAjBpD,GAAP;AAmBA,CApCS,CADa,EAsCvBjD,YAAY,CAAI6E,QAAF,IAAgB;AAC7B,QAAM;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,MAAyBF,QAAQ,CAAExE,WAAF,CAAvC;AACA,SAAO;AACNwC,IAAAA,cAAc,EAAImC,MAAF,IACfF,QAAQ,CAAE;AAAEE,MAAAA;AAAF,KAAF,EAAc;AAAEC,MAAAA,UAAU,EAAE;AAAd,KAAd,CAFH;AAGNrC,IAAAA,MAAM,EAAEmC;AAHF,GAAP;AAKA,CAPW,CAtCW,CAAF,CAAP,CA8CVzE,iBA9CU,CAAf","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":["get","some","classnames","Button","Component","createRef","withSelect","withDispatch","compose","__","PublishButtonLabel","store","editorStore","noop","PostPublishButton","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","_isAutoSaving","dispatch","editPost","savePost","status","undoIgnore"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,GAAT,EAAcC,IAAd,QAA0B,QAA1B;AACA,OAAOC,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,MAAT,QAAuB,uBAAvB;AACA,SAASC,SAAT,EAAoBC,SAApB,QAAqC,oBAArC;AACA,SAASC,UAAT,EAAqBC,YAArB,QAAyC,iBAAzC;AACA,SAASC,OAAT,QAAwB,oBAAxB;AACA,SAASC,EAAT,QAAmB,iBAAnB;AAEA;AACA;AACA;;AACA,OAAOC,kBAAP,MAA+B,SAA/B;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,aAArC;;AAEA,MAAMC,IAAI,GAAG,MAAM,CAAE,CAArB;;AAEA,OAAO,MAAMC,iBAAN,SAAgCV,SAAhC,CAA0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QAAQ,EAAEiD,kBAAkB,EAdtB;AAeNhD,IAAAA,MAAM,EAAEiD,gBAAgB,EAflB;AAgBNtD,IAAAA,uBAAuB,EAAEA,uBAAuB,EAhB1C;AAiBN4B,IAAAA,4BAA4B,EAAEA,4BAA4B;AAjBpD,GAAP;AAmBA,CApCS,CADa,EAsCvBlD,YAAY,CAAI8E,QAAF,IAAgB;AAC7B,QAAM;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,MAAyBF,QAAQ,CAAEzE,WAAF,CAAvC;AACA,SAAO;AACNyC,IAAAA,cAAc,EAAImC,MAAF,IACfF,QAAQ,CAAE;AAAEE,MAAAA;AAAF,KAAF,EAAc;AAAEC,MAAAA,UAAU,EAAE;AAAd,KAAd,CAFH;AAGNrC,IAAAA,MAAM,EAAEmC;AAHF,GAAP;AAKA,CAPW,CAtCW,CAAF,CAAP,CA8CVzE,iBA9CU,CAAf","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":["get","omit","__","Component","Button","Spinner","CheckboxControl","withFocusReturn","withConstrainedTabbing","withSelect","withDispatch","compose","closeSmall","store","coreStore","PostPublishButton","PostPublishPanelPrepublish","PostPublishPanelPostpublish","editorStore","PostPublishPanel","constructor","arguments","onSubmit","bind","componentDidUpdate","prevProps","isPublished","props","isSaving","isDirty","onClose","hasPublishAction","isPostTypeViewable","render","forceIsDirty","forceIsSaving","isBeingScheduled","isPublishSidebarEnabled","isScheduled","isSavingNonPostEntityChanges","onTogglePublishSidebar","PostPublishExtension","PrePublishExtension","additionalProps","propsForPanel","isPublishedOrScheduled","isPrePublish","isPostPublish","select","getPostType","getCurrentPost","getEditedPostAttribute","isCurrentPostPublished","isCurrentPostScheduled","isEditedPostBeingScheduled","isEditedPostDirty","isSavingPost","postType","dispatch","disablePublishSidebar","enablePublishSidebar"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,GAAT,EAAcC,IAAd,QAA0B,QAA1B;AAEA;AACA;AACA;;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,SAAT,QAA0B,oBAA1B;AACA,SACCC,MADD,EAECC,OAFD,EAGCC,eAHD,EAICC,eAJD,EAKCC,sBALD,QAMO,uBANP;AAOA,SAASC,UAAT,EAAqBC,YAArB,QAAyC,iBAAzC;AACA,SAASC,OAAT,QAAwB,oBAAxB;AACA,SAASC,UAAT,QAA2B,kBAA3B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,OAAOC,iBAAP,MAA8B,wBAA9B;AACA,OAAOC,0BAAP,MAAuC,cAAvC;AACA,OAAOC,2BAAP,MAAwC,eAAxC;AACA,SAASJ,KAAK,IAAIK,WAAlB,QAAqC,aAArC;AAEA,OAAO,MAAMC,gBAAN,SAA+BhB,SAA/B,CAAyC;AAC/CiB,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,QAAQ,GAAG;AACV,UAAM;AAAEQ,MAAAA,OAAF;AAAWC,MAAAA,gBAAX;AAA6BC,MAAAA;AAA7B,QAAo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AAkB,EAAEhC,GAAG,CAAEyD,QAAF,EAAY,CAAE,UAAF,CAAZ,EAA4B,KAA5B,CANjB;AAONrB,IAAAA,gBAAgB,EAAEkB,0BAA0B,EAPtC;AAQNzB,IAAAA,OAAO,EAAE0B,iBAAiB,EARpB;AASN7B,IAAAA,WAAW,EAAE0B,sBAAsB,EAT7B;AAUNf,IAAAA,uBAAuB,EAAEA,uBAAuB,EAV1C;AAWNT,IAAAA,QAAQ,EAAE4B,YAAY,EAXhB;AAYNjB,IAAAA,4BAA4B,EAAEA,4BAA4B,EAZpD;AAaND,IAAAA,WAAW,EAAEe,sBAAsB;AAb7B,GAAP;AAeA,CA9BS,CADa,EAgCvB3C,YAAY,CAAE,CAAEgD,QAAF,WAA6C;AAAA,MAAjC;AAAErB,IAAAA;AAAF,GAAiC;AAC1D,QAAM;AAAEsB,IAAAA,qBAAF;AAAyBC,IAAAA;AAAzB,MAAkDF,QAAQ,CAC/DxC,WAD+D,CAAhE;AAGA,SAAO;AACNsB,IAAAA,sBAAsB,EAAE,MAAM;AAC7B,UAAKH,uBAAL,EAA+B;AAC9BsB,QAAAA,qBAAqB;AACrB,OAFD,MAEO;AACNC,QAAAA,oBAAoB;AACpB;AACD;AAPK,GAAP;AASA,CAbW,CAhCW,EA8CvBrD,eA9CuB,EA+CvBC,sBA/CuB,CAAF,CAAP,CAgDVW,gBAhDU,CAAf","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":["get","omit","__","Component","Button","Spinner","CheckboxControl","withFocusReturn","withConstrainedTabbing","withSelect","withDispatch","compose","closeSmall","store","coreStore","PostPublishButton","PostPublishPanelPrepublish","PostPublishPanelPostpublish","editorStore","PostPublishPanel","constructor","arguments","onSubmit","bind","componentDidUpdate","prevProps","isPublished","props","isSaving","isDirty","onClose","hasPublishAction","isPostTypeViewable","render","forceIsDirty","forceIsSaving","isBeingScheduled","isPublishSidebarEnabled","isScheduled","isSavingNonPostEntityChanges","onTogglePublishSidebar","PostPublishExtension","PrePublishExtension","additionalProps","propsForPanel","isPublishedOrScheduled","isPrePublish","isPostPublish","select","getPostType","getCurrentPost","getEditedPostAttribute","isCurrentPostPublished","isCurrentPostScheduled","isEditedPostBeingScheduled","isEditedPostDirty","isSavingPost","postType","dispatch","disablePublishSidebar","enablePublishSidebar"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,GAAT,EAAcC,IAAd,QAA0B,QAA1B;AAEA;AACA;AACA;;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,SAAT,QAA0B,oBAA1B;AACA,SACCC,MADD,EAECC,OAFD,EAGCC,eAHD,EAICC,eAJD,EAKCC,sBALD,QAMO,uBANP;AAOA,SAASC,UAAT,EAAqBC,YAArB,QAAyC,iBAAzC;AACA,SAASC,OAAT,QAAwB,oBAAxB;AACA,SAASC,UAAT,QAA2B,kBAA3B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,OAAOC,iBAAP,MAA8B,wBAA9B;AACA,OAAOC,0BAAP,MAAuC,cAAvC;AACA,OAAOC,2BAAP,MAAwC,eAAxC;AACA,SAASJ,KAAK,IAAIK,WAAlB,QAAqC,aAArC;AAEA,OAAO,MAAMC,gBAAN,SAA+BhB,SA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6CvBrD,eA7CuB,EA8CvBC,sBA9CuB,CAAF,CAAP,CA+CVW,gBA/CU,CAAf","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"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-publish-panel/maybe-category-panel.js"],"names":["some","__","useSelect","PanelBody","store","coreStore","useState","useEffect","HierarchicalTermSelector","editorStore","MaybeCategoryPanel","hasNoCategory","select","postType","getCurrentPostType","categoriesTaxonomy","getTaxonomy","defaultCategorySlug","defaultCategory","getEntityRecords","slug","postTypeSupportsCategories","types","type","categories","getEditedPostAttribute","rest_base","length","id","shouldShowPanel","setShouldShowPanel","panelBodyTitle"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,IAAT,QAAqB,QAArB;AAEA;AACA;AACA;;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,SAAT,QAA0B,uBAA1B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SAASC,QAAT,EAAmBC,SAAnB,QAAoC,oBAApC;AAEA;AACA;AACA;;AACA,OAAOC,wBAAP,MAAqC,+CAArC;AACA,SAASJ,KAAK,IAAIK,WAAlB,QAAqC,aAArC;;AAEA,SAASC,kBAAT,GAA8B;AAC7B,QAAMC,aAAa,GAAGT,SA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CAAEnB,aAAF,CANM,CAAT;;AAQA,MAAK,CAAEkB,eAAP,EAAyB;AACxB,WAAO,IAAP;AACA;;AAED,QAAME,cAAc,GAAG,CACtB9B,EAAE,CAAE,aAAF,CADoB,EAEtB;AAAM,IAAA,SAAS,EAAC,iCAAhB;AAAkD,IAAA,GAAG,EAAC;AAAtD,KACGA,EAAE,CAAE,mBAAF,CADL,CAFsB,CAAvB;AAOA,SACC,cAAC,SAAD;AAAW,IAAA,WAAW,EAAG,KAAzB;AAAiC,IAAA,KAAK,EAAG8B;AAAzC,KACC,yBACG9B,EAAE,CACH,oHADG,CADL,CADD,EAMC,cAAC,wBAAD;AAA0B,IAAA,IAAI,EAAC;AAA/B,IAND,CADD;AAUA;;AAED,eAAeS,kBAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { some } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { PanelBody } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useState, useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport HierarchicalTermSelector from '../post-taxonomies/hierarchical-term-selector';\nimport { store as editorStore } from '../../store';\n\nfunction MaybeCategoryPanel() {\n\tconst hasNoCategory = useSelect( ( select ) => {\n\t\tconst postType = select( editorStore ).getCurrentPostType();\n\t\tconst categoriesTaxonomy = select( coreStore ).getTaxonomy(\n\t\t\t'category'\n\t\t);\n\t\tconst defaultCategorySlug = 'uncategorized';\n\t\tconst defaultCategory = select( coreStore ).getEntityRecords(\n\t\t\t'taxonomy',\n\t\t\t'category',\n\t\t\t{\n\t\t\t\tslug: defaultCategorySlug,\n\t\t\t}\n\t\t)?.[ 0 ];\n\t\tconst postTypeSupportsCategories =\n\t\t\tcategoriesTaxonomy &&\n\t\t\tsome( categoriesTaxonomy.types, ( type ) => type === postType );\n\t\tconst categories =\n\t\t\tcategoriesTaxonomy &&\n\t\t\tselect( editorStore ).getEditedPostAttribute(\n\t\t\t\tcategoriesTaxonomy.rest_base\n\t\t\t);\n\n\t\t// This boolean should return true if everything is loaded\n\t\t// ( categoriesTaxonomy, defaultCategory )\n\t\t// and the post has not been assigned a category different than \"uncategorized\".\n\t\treturn (\n\t\t\t!! categoriesTaxonomy &&\n\t\t\t!! defaultCategory &&\n\t\t\tpostTypeSupportsCategories &&\n\t\t\t( categories?.length === 0 ||\n\t\t\t\t( categories?.length === 1 &&\n\t\t\t\t\tdefaultCategory.id === categories[ 0 ] ) )\n\t\t);\n\t}, [] );\n\tconst [ shouldShowPanel, setShouldShowPanel ] = useState( false );\n\tuseEffect( () => {\n\t\t// We use state to avoid hiding the panel if the user edits the categories\n\t\t// and adds one within the panel itself (while visible).\n\t\tif ( hasNoCategory ) {\n\t\t\tsetShouldShowPanel( true );\n\t\t}\n\t}, [ hasNoCategory ] );\n\n\tif ( ! shouldShowPanel ) {\n\t\treturn null;\n\t}\n\n\tconst panelBodyTitle = [\n\t\t__( 'Suggestion:' ),\n\t\t<span className=\"editor-post-publish-panel__link\" key=\"label\">\n\t\t\t{ __( 'Assign a category' ) }\n\t\t</span>,\n\t];\n\n\treturn (\n\t\t<PanelBody initialOpen={ false } title={ panelBodyTitle }>\n\t\t\t<p>\n\t\t\t\t{ __(\n\t\t\t\t\t'Categories provide a helpful way to group related posts together and to quickly tell readers what a post is about.'\n\t\t\t\t) }\n\t\t\t</p>\n\t\t\t<HierarchicalTermSelector slug=\"category\" />\n\t\t</PanelBody>\n\t);\n}\n\nexport default MaybeCategoryPanel;\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/post-publish-panel/maybe-category-panel.js"],"names":["some","__","useSelect","PanelBody","store","coreStore","useState","useEffect","HierarchicalTermSelector","editorStore","MaybeCategoryPanel","hasNoCategory","select","postType","getCurrentPostType","categoriesTaxonomy","getTaxonomy","defaultCategorySlug","defaultCategory","getEntityRecords","slug","postTypeSupportsCategories","types","type","categories","getEditedPostAttribute","rest_base","length","id","sh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AAV,YAAAA,UAAU,CAAEG,MAAZ,MAAuB,CAAvB,IACC,CAAAH,UAAU,SAAV,IAAAA,UAAU,WAAV,YAAAA,UAAU,CAAEG,MAAZ,MAAuB,CAAvB,IACDT,eAAe,CAACU,EAAhB,KAAuBJ,UAAU,CAAE,CAAF,CALnC,CADD;AAQA,GAhC8B,EAgC5B,EAhC4B,CAA/B;AAiCA,QAAM,CAAEK,eAAF,EAAmBC,kBAAnB,IAA0CxB,QAAQ,CAAE,KAAF,CAAxD;AACAC,EAAAA,SAAS,CAAE,MAAM;AAChB;AACA;AACA,QAAKI,aAAL,EAAqB;AACpBmB,MAAAA,kBAAkB,CAAE,IAAF,CAAlB;AACA;AACD,GANQ,EAMN,CAAEnB,aAAF,CANM,CAAT;;AAQA,MAAK,CAAEkB,eAAP,EAAyB;AACxB,WAAO,IAAP;AACA;;AAED,QAAME,cAAc,GAAG,CACtB9B,EAAE,CAAE,aAAF,CADoB,EAEtB;AAAM,IAAA,SAAS,EAAC,iCAAhB;AAAkD,IAAA,GAAG,EAAC;AAAtD,KACGA,EAAE,CAAE,mBAAF,CADL,CAFsB,CAAvB;AAOA,SACC,cAAC,SAAD;AAAW,IAAA,WAAW,EAAG,KAAzB;AAAiC,IAAA,KAAK,EAAG8B;AAAzC,KACC,yBACG9B,EAAE,CACH,oHADG,CADL,CADD,EAMC,cAAC,wBAAD;AAA0B,IAAA,IAAI,EAAC;AAA/B,IAND,CADD;AAUA;;AAED,eAAeS,kBAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { some } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { PanelBody } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useState, useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport HierarchicalTermSelector from '../post-taxonomies/hierarchical-term-selector';\nimport { store as editorStore } from '../../store';\n\nfunction MaybeCategoryPanel() {\n\tconst hasNoCategory = useSelect( ( select ) => {\n\t\tconst postType = select( editorStore ).getCurrentPostType();\n\t\tconst categoriesTaxonomy =\n\t\t\tselect( coreStore ).getTaxonomy( 'category' );\n\t\tconst defaultCategorySlug = 'uncategorized';\n\t\tconst defaultCategory = select( coreStore ).getEntityRecords(\n\t\t\t'taxonomy',\n\t\t\t'category',\n\t\t\t{\n\t\t\t\tslug: defaultCategorySlug,\n\t\t\t}\n\t\t)?.[ 0 ];\n\t\tconst postTypeSupportsCategories =\n\t\t\tcategoriesTaxonomy &&\n\t\t\tsome( categoriesTaxonomy.types, ( type ) => type === postType );\n\t\tconst categories =\n\t\t\tcategoriesTaxonomy &&\n\t\t\tselect( editorStore ).getEditedPostAttribute(\n\t\t\t\tcategoriesTaxonomy.rest_base\n\t\t\t);\n\n\t\t// This boolean should return true if everything is loaded\n\t\t// ( categoriesTaxonomy, defaultCategory )\n\t\t// and the post has not been assigned a category different than \"uncategorized\".\n\t\treturn (\n\t\t\t!! categoriesTaxonomy &&\n\t\t\t!! defaultCategory &&\n\t\t\tpostTypeSupportsCategories &&\n\t\t\t( categories?.length === 0 ||\n\t\t\t\t( categories?.length === 1 &&\n\t\t\t\t\tdefaultCategory.id === categories[ 0 ] ) )\n\t\t);\n\t}, [] );\n\tconst [ shouldShowPanel, setShouldShowPanel ] = useState( false );\n\tuseEffect( () => {\n\t\t// We use state to avoid hiding the panel if the user edits the categories\n\t\t// and adds one within the panel itself (while visible).\n\t\tif ( hasNoCategory ) {\n\t\t\tsetShouldShowPanel( true );\n\t\t}\n\t}, [ hasNoCategory ] );\n\n\tif ( ! shouldShowPanel ) {\n\t\treturn null;\n\t}\n\n\tconst panelBodyTitle = [\n\t\t__( 'Suggestion:' ),\n\t\t<span className=\"editor-post-publish-panel__link\" key=\"label\">\n\t\t\t{ __( 'Assign a category' ) }\n\t\t</span>,\n\t];\n\n\treturn (\n\t\t<PanelBody initialOpen={ false } title={ panelBodyTitle }>\n\t\t\t<p>\n\t\t\t\t{ __(\n\t\t\t\t\t'Categories provide a helpful way to group related posts together and to quickly tell readers what a post is about.'\n\t\t\t\t) }\n\t\t\t</p>\n\t\t\t<HierarchicalTermSelector slug=\"category\" />\n\t\t</PanelBody>\n\t);\n}\n\nexport default MaybeCategoryPanel;\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-publish-panel/maybe-post-format-panel.js"],"names":["find","get","includes","Button","PanelBody","useDispatch","useSelect","__","sprintf","store","coreStore","POST_FORMATS","editorStore","getSuggestion","supportedFormats","suggestedPostFormat","formats","filter","format","id","PostFormatSuggestion","suggestionText","onUpdatePostFormat","PostFormatPanel","currentPostFormat","suggestion","select","getEditedPostAttribute","getSuggestedPostFormat","getThemeSupports","editPost","panelBodyTitle","caption"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,IAAT,EAAeC,GAAf,EAAoBC,QAApB,QAAoC,QAApC;AAEA;AACA;AACA;;AACA,SAASC,MAAT,EAAiBC,SAAjB,QAAkC,uBAAlC;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,SAASC,YAAT,QAA6B,gBAA7B;AACA,SAASF,KAAK,IAAIG,WAAlB,QAAqC,aAArC;;AAEA,MAAMC,aAAa,GAAG,CAAEC,gBAAF,EAAoBC,mBAApB,KAA6C;AAClE,QAAMC,OAAO,GAAGL,YAAY,CAACM,MAAb,CAAuBC,MAAF,IACpChB,QAAQ,CAAEY,gBAAF,EAAoBI,MAAM,CAACC,EAA3B,CADO,CAAhB;AAGA,SAAOnB,IAAI,CAAEgB,OAAF,EAAaE,MAAF,IAAcA,MAAM,CAACC,EAAP,KAAcJ,mBAAvC,CAAX;AACA,CALD;;AAOA,MAAMK,oBAAoB,GAAG;AAAA,MAAE;AAC9BL,IAAAA,mBAD8B;AAE9B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AAAiC,IAAA,KAAK,EAAGO;AAAzC,KACC,yBACGxB,EAAE,CACH,+IADG,CADL,CADD,EAMC,yBACC,cAAC,oBAAD;AACC,IAAA,kBAAkB,EAAGe,kBADtB;AAEC,IAAA,mBAAmB,EAAGG,UAAU,CAACN,EAFlC;AAGC,IAAA,cAAc,EAAGX,OAAO;AACvB;AACAD,IAAAA,EAAE,CAAE,0BAAF,CAFqB,EAGvBkB,UAAU,CAACO,OAHY;AAHzB,IADD,CAND,CADD;AAoBA","sourcesContent":["/**\n * External dependencies\n */\nimport { find, get, includes } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { Button, PanelBody } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { POST_FORMATS } from '../post-format';\nimport { store as editorStore } from '../../store';\n\nconst getSuggestion = ( supportedFormats, suggestedPostFormat ) => {\n\tconst formats = POST_FORMATS.filter( ( format ) =>\n\t\tincludes( supportedFormats, format.id )\n\t);\n\treturn find( formats, ( format ) => format.id === suggestedPostFormat );\n};\n\nconst PostFormatSuggestion = ( {\n\tsuggestedPostFormat,\n\tsuggestionText,\n\tonUpdatePostFormat,\n} ) => (\n\t<Button\n\t\tvariant=\"link\"\n\t\tonClick={ () => onUpdatePostFormat( suggestedPostFormat ) }\n\t>\n\t\t{ suggestionText }\n\t</Button>\n);\n\nexport default function PostFormatPanel() {\n\tconst { currentPostFormat, suggestion } = useSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute, getSuggestedPostFormat } = select(\n\t\t\teditorStore\n\t\t);\n\t\tconst supportedFormats = get(\n\t\t\tselect( coreStore ).getThemeSupports(),\n\t\t\t[ 'formats' ],\n\t\t\t[]\n\t\t);\n\t\treturn {\n\t\t\tcurrentPostFormat: getEditedPostAttribute( 'format' ),\n\t\t\tsuggestion: getSuggestion(\n\t\t\t\tsupportedFormats,\n\t\t\t\tgetSuggestedPostFormat()\n\t\t\t),\n\t\t};\n\t}, [] );\n\n\tconst { editPost } = useDispatch( editorStore );\n\n\tconst onUpdatePostFormat = ( format ) => editPost( { format } );\n\n\tconst panelBodyTitle = [\n\t\t__( 'Suggestion:' ),\n\t\t<span className=\"editor-post-publish-panel__link\" key=\"label\">\n\t\t\t{ __( 'Use a post format' ) }\n\t\t</span>,\n\t];\n\n\tif ( ! suggestion || suggestion.id === currentPostFormat ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PanelBody initialOpen={ false } title={ panelBodyTitle }>\n\t\t\t<p>\n\t\t\t\t{ __(\n\t\t\t\t\t'Your theme uses post formats to highlight different kinds of content, like images or videos. Apply a post format to see this special styling.'\n\t\t\t\t) }\n\t\t\t</p>\n\t\t\t<p>\n\t\t\t\t<PostFormatSuggestion\n\t\t\t\t\tonUpdatePostFormat={ onUpdatePostFormat }\n\t\t\t\t\tsuggestedPostFormat={ suggestion.id }\n\t\t\t\t\tsuggestionText={ sprintf(\n\t\t\t\t\t\t/* translators: %s: post format */\n\t\t\t\t\t\t__( 'Apply the \"%1$s\" format.' ),\n\t\t\t\t\t\tsuggestion.caption\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</p>\n\t\t</PanelBody>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/post-publish-panel/maybe-post-format-panel.js"],"names":["find","get","includes","Button","PanelBody","useDispatch","useSelect","__","sprintf","store","coreStore","POST_FORMATS","editorStore","getSuggestion","supportedFormats","suggestedPostFormat","formats","filter","format","id","PostFormatSuggestion","suggestionText","onUpdatePostFormat","PostFormatPanel","currentPostFormat","suggestion","select","getEditedPostAttribute","getSuggestedPostFormat","getThemeSupports","editPost","panelBodyTitle","caption"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,IAAT,EAAeC,GAAf,EAAoBC,QAApB,QAAoC,QAApC;AAEA;AACA;AACA;;AACA,SAASC,MAAT,EAAiBC,SAAjB,Q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AENF,MAAAA,UAAU,EAAEZ,aAAa,CACxBC,gBADwB,EAExBc,sBAAsB,EAFE;AAFnB,KAAP;AAOA,GAfkD,EAehD,EAfgD,CAAnD;AAiBA,QAAM;AAAEE,IAAAA;AAAF,MAAezB,WAAW,CAAEO,WAAF,CAAhC;;AAEA,QAAMU,kBAAkB,GAAKJ,MAAF,IAAcY,QAAQ,CAAE;AAAEZ,IAAAA;AAAF,GAAF,CAAjD;;AAEA,QAAMa,cAAc,GAAG,CACtBxB,EAAE,CAAE,aAAF,CADoB,EAEtB;AAAM,IAAA,SAAS,EAAC,iCAAhB;AAAkD,IAAA,GAAG,EAAC;AAAtD,KACGA,EAAE,CAAE,mBAAF,CADL,CAFsB,CAAvB;;AAOA,MAAK,CAAEkB,UAAF,IAAgBA,UAAU,CAACN,EAAX,KAAkBK,iBAAvC,EAA2D;AAC1D,WAAO,IAAP;AACA;;AAED,SACC,cAAC,SAAD;AAAW,IAAA,WAAW,EAAG,KAAzB;AAAiC,IAAA,KAAK,EAAGO;AAAzC,KACC,yBACGxB,EAAE,CACH,+IADG,CADL,CADD,EAMC,yBACC,cAAC,oBAAD;AACC,IAAA,kBAAkB,EAAGe,kBADtB;AAEC,IAAA,mBAAmB,EAAGG,UAAU,CAACN,EAFlC;AAGC,IAAA,cAAc,EAAGX,OAAO;AACvB;AACAD,IAAAA,EAAE,CAAE,0BAAF,CAFqB,EAGvBkB,UAAU,CAACO,OAHY;AAHzB,IADD,CAND,CADD;AAoBA","sourcesContent":["/**\n * External dependencies\n */\nimport { find, get, includes } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { Button, PanelBody } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { POST_FORMATS } from '../post-format';\nimport { store as editorStore } from '../../store';\n\nconst getSuggestion = ( supportedFormats, suggestedPostFormat ) => {\n\tconst formats = POST_FORMATS.filter( ( format ) =>\n\t\tincludes( supportedFormats, format.id )\n\t);\n\treturn find( formats, ( format ) => format.id === suggestedPostFormat );\n};\n\nconst PostFormatSuggestion = ( {\n\tsuggestedPostFormat,\n\tsuggestionText,\n\tonUpdatePostFormat,\n} ) => (\n\t<Button\n\t\tvariant=\"link\"\n\t\tonClick={ () => onUpdatePostFormat( suggestedPostFormat ) }\n\t>\n\t\t{ suggestionText }\n\t</Button>\n);\n\nexport default function PostFormatPanel() {\n\tconst { currentPostFormat, suggestion } = useSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute, getSuggestedPostFormat } =\n\t\t\tselect( editorStore );\n\t\tconst supportedFormats = get(\n\t\t\tselect( coreStore ).getThemeSupports(),\n\t\t\t[ 'formats' ],\n\t\t\t[]\n\t\t);\n\t\treturn {\n\t\t\tcurrentPostFormat: getEditedPostAttribute( 'format' ),\n\t\t\tsuggestion: getSuggestion(\n\t\t\t\tsupportedFormats,\n\t\t\t\tgetSuggestedPostFormat()\n\t\t\t),\n\t\t};\n\t}, [] );\n\n\tconst { editPost } = useDispatch( editorStore );\n\n\tconst onUpdatePostFormat = ( format ) => editPost( { format } );\n\n\tconst panelBodyTitle = [\n\t\t__( 'Suggestion:' ),\n\t\t<span className=\"editor-post-publish-panel__link\" key=\"label\">\n\t\t\t{ __( 'Use a post format' ) }\n\t\t</span>,\n\t];\n\n\tif ( ! suggestion || suggestion.id === currentPostFormat ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PanelBody initialOpen={ false } title={ panelBodyTitle }>\n\t\t\t<p>\n\t\t\t\t{ __(\n\t\t\t\t\t'Your theme uses post formats to highlight different kinds of content, like images or videos. Apply a post format to see this special styling.'\n\t\t\t\t) }\n\t\t\t</p>\n\t\t\t<p>\n\t\t\t\t<PostFormatSuggestion\n\t\t\t\t\tonUpdatePostFormat={ onUpdatePostFormat }\n\t\t\t\t\tsuggestedPostFormat={ suggestion.id }\n\t\t\t\t\tsuggestionText={ sprintf(\n\t\t\t\t\t\t/* translators: %s: post format */\n\t\t\t\t\t\t__( 'Apply the \"%1$s\" format.' ),\n\t\t\t\t\t\tsuggestion.caption\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</p>\n\t\t</PanelBody>\n\t);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-publish-panel/postpublish.js"],"names":["get","PanelBody","Button","TextControl","__","sprintf","Component","createRef","withSelect","addQueryArgs","safeDecodeURIComponent","decodeEntities","useCopyToClipboard","store","coreStore","PostScheduleLabel","editorStore","POSTNAME","getFuturePostUrl","post","slug","permalink_template","includes","replace","CopyButton","text","onCopy","children","ref","PostPublishPanelPostpublish","constructor","arguments","state","showCopyConfirmation","bind","onSelectInput","postLink","componentDidMount","props","focusOnMount","current","focus","componentWillUnmount","clearTimeout","dismissCopyConfirmation","setState","setTimeout","event","target","select","render","isScheduled","postType","postLabel","viewPostLabel","addNewPostLabel","link","status","addLink","post_type","type","postPublishNonLinkHeader","title","getEditedPostAttribute","getCurrentPost","isCurrentPostScheduled","getPostType"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,GAAT,QAAoB,QAApB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,EAAoBC,MAApB,EAA4BC,WAA5B,QAA+C,uBAA/C;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,SAAT,EAAoBC,SAApB,QAAqC,oBAArC;AACA,SAASC,UAAT,QAA2B,iBAA3B;AACA,SAASC,YAAT,EAAuBC,sBAAvB,QAAqD,gBAArD;AACA,SAASC,cAAT,QAA+B,0BAA/B;AACA,SAASC,kBAAT,QAAmC,oBAAnC;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,OAAOC,iBAAP,MAA8B,wBAA9B;AACA,SAASF,KAAK,IAAIG,WAAlB,QAAqC,aAArC;AAEA,MAAMC,QAAQ,GAAG,YAAjB;AAEA;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xC,QAAM;AACLc,IAAAA,sBADK;AAELC,IAAAA,cAFK;AAGLC,IAAAA;AAHK,MAIFhB,MAAM,CAAEjC,WAAF,CAJV;AAKA,QAAM;AAAEkD,IAAAA;AAAF,MAAkBjB,MAAM,CAAEnC,SAAF,CAA9B;AAEA,SAAO;AACNK,IAAAA,IAAI,EAAE6C,cAAc,EADd;AAENZ,IAAAA,QAAQ,EAAEc,WAAW,CAAEH,sBAAsB,CAAE,MAAF,CAAxB,CAFf;AAGNZ,IAAAA,WAAW,EAAEc,sBAAsB;AAH7B,GAAP;AAKA,CAbwB,CAAV,CAaVpC,2BAbU,CAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { get } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { PanelBody, Button, TextControl } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { Component, createRef } from '@wordpress/element';\nimport { withSelect } from '@wordpress/data';\nimport { addQueryArgs, safeDecodeURIComponent } from '@wordpress/url';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { useCopyToClipboard } from '@wordpress/compose';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport PostScheduleLabel from '../post-schedule/label';\nimport { store as editorStore } from '../../store';\n\nconst POSTNAME = '%postname%';\n\n/**\n * Returns URL for a future post.\n *\n * @param {Object} post Post object.\n *\n * @return {string} PostPublish URL.\n */\n\nconst getFuturePostUrl = ( post ) => {\n\tconst { slug } = post;\n\n\tif ( post.permalink_template.includes( POSTNAME ) ) {\n\t\treturn post.permalink_template.replace( POSTNAME, slug );\n\t}\n\n\treturn post.permalink_template;\n};\n\nfunction CopyButton( { text, onCopy, children } ) {\n\tconst ref = useCopyToClipboard( text, onCopy );\n\treturn (\n\t\t<Button variant=\"secondary\" ref={ ref }>\n\t\t\t{ children }\n\t\t</Button>\n\t);\n}\n\nclass PostPublishPanelPostpublish extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\t\tthis.state = {\n\t\t\tshowCopyConfirmation: false,\n\t\t};\n\t\tthis.onCopy = this.onCopy.bind( this );\n\t\tthis.onSelectInput = this.onSelectInput.bind( this );\n\t\tthis.postLink = createRef();\n\t}\n\n\tcomponentDidMount() {\n\t\tif ( this.props.focusOnMount ) {\n\t\t\tthis.postLink.current.focus();\n\t\t}\n\t}\n\n\tcomponentWillUnmount() {\n\t\tclearTimeout( this.dismissCopyConfirmation );\n\t}\n\n\tonCopy() {\n\t\tthis.setState( {\n\t\t\tshowCopyConfirmation: true,\n\t\t} );\n\n\t\tclearTimeout( this.dismissCopyConfirmation );\n\t\tthis.dismissCopyConfirmation = setTimeout( () => {\n\t\t\tthis.setState( {\n\t\t\t\tshowCopyConfirmation: false,\n\t\t\t} );\n\t\t}, 4000 );\n\t}\n\n\tonSelectInput( event ) {\n\t\tevent.target.select();\n\t}\n\n\trender() {\n\t\tconst { children, isScheduled, post, postType } = this.props;\n\t\tconst postLabel = get( postType, [ 'labels', 'singular_name' ] );\n\t\tconst viewPostLabel = get( postType, [ 'labels', 'view_item' ] );\n\t\tconst addNewPostLabel = get( postType, [ 'labels', 'add_new_item' ] );\n\t\tconst link =\n\t\t\tpost.status === 'future' ? getFuturePostUrl( post ) : post.link;\n\t\tconst addLink = addQueryArgs( 'post-new.php', {\n\t\t\tpost_type: post.type,\n\t\t} );\n\n\t\tconst postPublishNonLinkHeader = isScheduled ? (\n\t\t\t<>\n\t\t\t\t{ __( 'is now scheduled. It will go live on' ) }{ ' ' }\n\t\t\t\t<PostScheduleLabel />.\n\t\t\t</>\n\t\t) : (\n\t\t\t__( 'is now live.' )\n\t\t);\n\n\t\treturn (\n\t\t\t<div className=\"post-publish-panel__postpublish\">\n\t\t\t\t<PanelBody className=\"post-publish-panel__postpublish-header\">\n\t\t\t\t\t<a ref={ this.postLink } href={ link }>\n\t\t\t\t\t\t{ decodeEntities( post.title ) || __( '(no title)' ) }\n\t\t\t\t\t</a>{ ' ' }\n\t\t\t\t\t{ postPublishNonLinkHeader }\n\t\t\t\t</PanelBody>\n\t\t\t\t<PanelBody>\n\t\t\t\t\t<p className=\"post-publish-panel__postpublish-subheader\">\n\t\t\t\t\t\t<strong>{ __( 'What’s next?' ) }</strong>\n\t\t\t\t\t</p>\n\t\t\t\t\t<div className=\"post-publish-panel__postpublish-post-address-container\">\n\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\tclassName=\"post-publish-panel__postpublish-post-address\"\n\t\t\t\t\t\t\treadOnly\n\t\t\t\t\t\t\tlabel={ sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: post type singular name */\n\t\t\t\t\t\t\t\t__( '%s address' ),\n\t\t\t\t\t\t\t\tpostLabel\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tvalue={ safeDecodeURIComponent( link ) }\n\t\t\t\t\t\t\tonFocus={ this.onSelectInput }\n\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t<div className=\"post-publish-panel__postpublish-post-address__copy-button-wrap\">\n\t\t\t\t\t\t\t<CopyButton text={ link } onCopy={ this.onCopy }>\n\t\t\t\t\t\t\t\t{ this.state.showCopyConfirmation\n\t\t\t\t\t\t\t\t\t? __( 'Copied!' )\n\t\t\t\t\t\t\t\t\t: __( 'Copy' ) }\n\t\t\t\t\t\t\t</CopyButton>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<div className=\"post-publish-panel__postpublish-buttons\">\n\t\t\t\t\t\t{ ! isScheduled && (\n\t\t\t\t\t\t\t<Button variant=\"primary\" href={ link }>\n\t\t\t\t\t\t\t\t{ viewPostLabel }\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant={ isScheduled ? 'primary' : 'secondary' }\n\t\t\t\t\t\t\thref={ addLink }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ addNewPostLabel }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</div>\n\t\t\t\t</PanelBody>\n\t\t\t\t{ children }\n\t\t\t</div>\n\t\t);\n\t}\n}\n\nexport default withSelect( ( select ) => {\n\tconst {\n\t\tgetEditedPostAttribute,\n\t\tgetCurrentPost,\n\t\tisCurrentPostScheduled,\n\t} = select( editorStore );\n\tconst { getPostType } = select( coreStore );\n\n\treturn {\n\t\tpost: getCurrentPost(),\n\t\tpostType: getPostType( getEditedPostAttribute( 'type' ) ),\n\t\tisScheduled: isCurrentPostScheduled(),\n\t};\n} )( PostPublishPanelPostpublish );\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/post-publish-panel/postpublish.js"],"names":["get","PanelBody","Button","TextControl","__","sprintf","Component","createRef","withSelect","addQueryArgs","safeDecodeURIComponent","decodeEntities","useCopyToClipboard","store","coreStore","PostScheduleLabel","editorStore","POSTNAME","getFuturePostUrl","post","slug","permalink_template","includes","replace","CopyButton","text","onCopy","children","ref","PostPublishPanelPostpublish","constructor","arguments","state","showCopyConfirmation","bind","onSelectInput","postLink","componentDidMount","props","focusOnMount","current","focus","componentWillUnmount","clearTimeout","dismissCopyConfirmation","setState","setTimeout","event","target","select","render","isScheduled","postType","postLabel","viewPostLabel","addNewPostLabel","link","status","addLink","post_type","type","postPublishNonLinkHeader","title","getEditedPostAttribute","getCurrentPost","isCurrentPostScheduled","getPostType"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,GAAT,QAAoB,QAApB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,EAAoBC,MAApB,EAA4BC,WAA5B,QAA+C,uBAA/C;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,SAAT,EAAoBC,SAApB,QAAqC,oBAArC;AACA,SAASC,UAAT,QAA2B,iBAA3B;AACA,SAASC,YAAT,EAAuBC,sBAAvB,QAAqD,gBAArD;AACA,SAASC,cAAT,QAA+B,0BAA/B;AACA,SAASC,kBAAT,QAAmC,oBAAnC;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AA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AAI,EAAGO;AAFR,OAIGH,eAJH,CAND,CA1BD,CAPD,EA+CG5B,QA/CH,CADD;AAmDA;;AA7GkD;;AAgHpD,eAAenB,UAAU,CAAIyC,MAAF,IAAc;AACxC,QAAM;AAAEc,IAAAA,sBAAF;AAA0BC,IAAAA,cAA1B;AAA0CC,IAAAA;AAA1C,MACLhB,MAAM,CAAEjC,WAAF,CADP;AAEA,QAAM;AAAEkD,IAAAA;AAAF,MAAkBjB,MAAM,CAAEnC,SAAF,CAA9B;AAEA,SAAO;AACNK,IAAAA,IAAI,EAAE6C,cAAc,EADd;AAENZ,IAAAA,QAAQ,EAAEc,WAAW,CAAEH,sBAAsB,CAAE,MAAF,CAAxB,CAFf;AAGNZ,IAAAA,WAAW,EAAEc,sBAAsB;AAH7B,GAAP;AAKA,CAVwB,CAAV,CAUVpC,2BAVU,CAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { get } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { PanelBody, Button, TextControl } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { Component, createRef } from '@wordpress/element';\nimport { withSelect } from '@wordpress/data';\nimport { addQueryArgs, safeDecodeURIComponent } from '@wordpress/url';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { useCopyToClipboard } from '@wordpress/compose';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport PostScheduleLabel from '../post-schedule/label';\nimport { store as editorStore } from '../../store';\n\nconst POSTNAME = '%postname%';\n\n/**\n * Returns URL for a future post.\n *\n * @param {Object} post Post object.\n *\n * @return {string} PostPublish URL.\n */\n\nconst getFuturePostUrl = ( post ) => {\n\tconst { slug } = post;\n\n\tif ( post.permalink_template.includes( POSTNAME ) ) {\n\t\treturn post.permalink_template.replace( POSTNAME, slug );\n\t}\n\n\treturn post.permalink_template;\n};\n\nfunction CopyButton( { text, onCopy, children } ) {\n\tconst ref = useCopyToClipboard( text, onCopy );\n\treturn (\n\t\t<Button variant=\"secondary\" ref={ ref }>\n\t\t\t{ children }\n\t\t</Button>\n\t);\n}\n\nclass PostPublishPanelPostpublish extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\t\tthis.state = {\n\t\t\tshowCopyConfirmation: false,\n\t\t};\n\t\tthis.onCopy = this.onCopy.bind( this );\n\t\tthis.onSelectInput = this.onSelectInput.bind( this );\n\t\tthis.postLink = createRef();\n\t}\n\n\tcomponentDidMount() {\n\t\tif ( this.props.focusOnMount ) {\n\t\t\tthis.postLink.current.focus();\n\t\t}\n\t}\n\n\tcomponentWillUnmount() {\n\t\tclearTimeout( this.dismissCopyConfirmation );\n\t}\n\n\tonCopy() {\n\t\tthis.setState( {\n\t\t\tshowCopyConfirmation: true,\n\t\t} );\n\n\t\tclearTimeout( this.dismissCopyConfirmation );\n\t\tthis.dismissCopyConfirmation = setTimeout( () => {\n\t\t\tthis.setState( {\n\t\t\t\tshowCopyConfirmation: false,\n\t\t\t} );\n\t\t}, 4000 );\n\t}\n\n\tonSelectInput( event ) {\n\t\tevent.target.select();\n\t}\n\n\trender() {\n\t\tconst { children, isScheduled, post, postType } = this.props;\n\t\tconst postLabel = get( postType, [ 'labels', 'singular_name' ] );\n\t\tconst viewPostLabel = get( postType, [ 'labels', 'view_item' ] );\n\t\tconst addNewPostLabel = get( postType, [ 'labels', 'add_new_item' ] );\n\t\tconst link =\n\t\t\tpost.status === 'future' ? getFuturePostUrl( post ) : post.link;\n\t\tconst addLink = addQueryArgs( 'post-new.php', {\n\t\t\tpost_type: post.type,\n\t\t} );\n\n\t\tconst postPublishNonLinkHeader = isScheduled ? (\n\t\t\t<>\n\t\t\t\t{ __( 'is now scheduled. It will go live on' ) }{ ' ' }\n\t\t\t\t<PostScheduleLabel />.\n\t\t\t</>\n\t\t) : (\n\t\t\t__( 'is now live.' )\n\t\t);\n\n\t\treturn (\n\t\t\t<div className=\"post-publish-panel__postpublish\">\n\t\t\t\t<PanelBody className=\"post-publish-panel__postpublish-header\">\n\t\t\t\t\t<a ref={ this.postLink } href={ link }>\n\t\t\t\t\t\t{ decodeEntities( post.title ) || __( '(no title)' ) }\n\t\t\t\t\t</a>{ ' ' }\n\t\t\t\t\t{ postPublishNonLinkHeader }\n\t\t\t\t</PanelBody>\n\t\t\t\t<PanelBody>\n\t\t\t\t\t<p className=\"post-publish-panel__postpublish-subheader\">\n\t\t\t\t\t\t<strong>{ __( 'What’s next?' ) }</strong>\n\t\t\t\t\t</p>\n\t\t\t\t\t<div className=\"post-publish-panel__postpublish-post-address-container\">\n\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\tclassName=\"post-publish-panel__postpublish-post-address\"\n\t\t\t\t\t\t\treadOnly\n\t\t\t\t\t\t\tlabel={ sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: post type singular name */\n\t\t\t\t\t\t\t\t__( '%s address' ),\n\t\t\t\t\t\t\t\tpostLabel\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tvalue={ safeDecodeURIComponent( link ) }\n\t\t\t\t\t\t\tonFocus={ this.onSelectInput }\n\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t<div className=\"post-publish-panel__postpublish-post-address__copy-button-wrap\">\n\t\t\t\t\t\t\t<CopyButton text={ link } onCopy={ this.onCopy }>\n\t\t\t\t\t\t\t\t{ this.state.showCopyConfirmation\n\t\t\t\t\t\t\t\t\t? __( 'Copied!' )\n\t\t\t\t\t\t\t\t\t: __( 'Copy' ) }\n\t\t\t\t\t\t\t</CopyButton>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<div className=\"post-publish-panel__postpublish-buttons\">\n\t\t\t\t\t\t{ ! isScheduled && (\n\t\t\t\t\t\t\t<Button variant=\"primary\" href={ link }>\n\t\t\t\t\t\t\t\t{ viewPostLabel }\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant={ isScheduled ? 'primary' : 'secondary' }\n\t\t\t\t\t\t\thref={ addLink }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ addNewPostLabel }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</div>\n\t\t\t\t</PanelBody>\n\t\t\t\t{ children }\n\t\t\t</div>\n\t\t);\n\t}\n}\n\nexport default withSelect( ( select ) => {\n\tconst { getEditedPostAttribute, getCurrentPost, isCurrentPostScheduled } =\n\t\tselect( editorStore );\n\tconst { getPostType } = select( coreStore );\n\n\treturn {\n\t\tpost: getCurrentPost(),\n\t\tpostType: getPostType( getEditedPostAttribute( 'type' ) ),\n\t\tisScheduled: isCurrentPostScheduled(),\n\t};\n} )( PostPublishPanelPostpublish );\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-publish-panel/prepublish.js"],"names":["get","__","Icon","PanelBody","useSelect","wordpress","filterURLForDisplay","store","coreStore","decodeEntities","PostVisibility","PostVisibilityLabel","PostSchedule","PostScheduleLabel","MaybeTagsPanel","MaybePostFormatPanel","editorStore","MaybeCategoryPanel","PostPublishPanelPrepublish","children","isBeingScheduled","isRequestingSiteIcon","hasPublishAction","siteIconUrl","siteTitle","siteHome","select","getCurrentPost","isEditedPostBeingScheduled","getEntityRecord","isResolving","siteData","undefined","site_icon_url","name","home","siteIcon","prePublishTitle","prePublishBodyText"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,GAAT,QAAoB,QAApB;AAEA;AACA;AACA;;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,IAAT,EAAeC,SAAf,QAAgC,uBAAhC;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,SAAT,QAA0B,kBAA1B;AACA,SAASC,mBAAT,QAAoC,gBAApC;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SAASC,cAAT,QAA+B,0BAA/B;AAEA;AACA;AACA;;AACA,OAAOC,cAAP,MAA2B,oBAA3B;AACA,OAAOC,mBAAP,MA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,QAAzC,CAJD,CAFD,CALD,EAcGH,gBAAgB,IACjB,8BACC,cAAC,SAAD;AACC,IAAA,WAAW,EAAG,KADf;AAEC,IAAA,KAAK,EAAG,CACPrB,EAAE,CAAE,aAAF,CADK,EAEP;AACC,MAAA,SAAS,EAAC,iCADX;AAEC,MAAA,GAAG,EAAC;AAFL,OAIC,cAAC,mBAAD,OAJD,CAFO;AAFT,KAYC,cAAC,cAAD,OAZD,CADD,EAeC,cAAC,SAAD;AACC,IAAA,WAAW,EAAG,KADf;AAEC,IAAA,KAAK,EAAG,CACPA,EAAE,CAAE,UAAF,CADK,EAEP;AACC,MAAA,SAAS,EAAC,iCADX;AAEC,MAAA,GAAG,EAAC;AAFL,OAIC,cAAC,iBAAD,OAJD,CAFO;AAFT,KAYC,cAAC,YAAD,OAZD,CAfD,CAfF,EA8CC,cAAC,oBAAD,OA9CD,EA+CC,cAAC,cAAD,OA/CD,EAgDC,cAAC,kBAAD,OAhDD,EAiDGkB,QAjDH,CADD;AAqDA;;AAED,eAAeD,0BAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { get } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Icon, PanelBody } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { wordpress } from '@wordpress/icons';\nimport { filterURLForDisplay } from '@wordpress/url';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport PostVisibility from '../post-visibility';\nimport PostVisibilityLabel from '../post-visibility/label';\nimport PostSchedule from '../post-schedule';\nimport PostScheduleLabel from '../post-schedule/label';\nimport MaybeTagsPanel from './maybe-tags-panel';\nimport MaybePostFormatPanel from './maybe-post-format-panel';\nimport { store as editorStore } from '../../store';\nimport MaybeCategoryPanel from './maybe-category-panel';\n\nfunction PostPublishPanelPrepublish( { children } ) {\n\tconst {\n\t\tisBeingScheduled,\n\t\tisRequestingSiteIcon,\n\t\thasPublishAction,\n\t\tsiteIconUrl,\n\t\tsiteTitle,\n\t\tsiteHome,\n\t} = useSelect( ( select ) => {\n\t\tconst { getCurrentPost, isEditedPostBeingScheduled } = select(\n\t\t\teditorStore\n\t\t);\n\t\tconst { getEntityRecord, isResolving } = select( coreStore );\n\t\tconst siteData =\n\t\t\tgetEntityRecord( 'root', '__unstableBase', undefined ) || {};\n\n\t\treturn {\n\t\t\thasPublishAction: 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\tisBeingScheduled: isEditedPostBeingScheduled(),\n\t\t\tisRequestingSiteIcon: isResolving( 'getEntityRecord', [\n\t\t\t\t'root',\n\t\t\t\t'__unstableBase',\n\t\t\t\tundefined,\n\t\t\t] ),\n\t\t\tsiteIconUrl: siteData.site_icon_url,\n\t\t\tsiteTitle: siteData.name,\n\t\t\tsiteHome: siteData.home && filterURLForDisplay( siteData.home ),\n\t\t};\n\t}, [] );\n\n\tlet siteIcon = (\n\t\t<Icon className=\"components-site-icon\" size=\"36px\" icon={ wordpress } />\n\t);\n\n\tif ( siteIconUrl ) {\n\t\tsiteIcon = (\n\t\t\t<img\n\t\t\t\talt={ __( 'Site Icon' ) }\n\t\t\t\tclassName=\"components-site-icon\"\n\t\t\t\tsrc={ siteIconUrl }\n\t\t\t/>\n\t\t);\n\t}\n\n\tif ( isRequestingSiteIcon ) {\n\t\tsiteIcon = null;\n\t}\n\n\tlet prePublishTitle, prePublishBodyText;\n\n\tif ( ! hasPublishAction ) {\n\t\tprePublishTitle = __( 'Are you ready to submit for review?' );\n\t\tprePublishBodyText = __(\n\t\t\t'When you’re ready, submit your work for review, and an Editor will be able to approve it for you.'\n\t\t);\n\t} else if ( isBeingScheduled ) {\n\t\tprePublishTitle = __( 'Are you ready to schedule?' );\n\t\tprePublishBodyText = __(\n\t\t\t'Your work will be published at the specified date and time.'\n\t\t);\n\t} else {\n\t\tprePublishTitle = __( 'Are you ready to publish?' );\n\t\tprePublishBodyText = __(\n\t\t\t'Double-check your settings before publishing.'\n\t\t);\n\t}\n\n\treturn (\n\t\t<div className=\"editor-post-publish-panel__prepublish\">\n\t\t\t<div>\n\t\t\t\t<strong>{ prePublishTitle }</strong>\n\t\t\t</div>\n\t\t\t<p>{ prePublishBodyText }</p>\n\t\t\t<div className=\"components-site-card\">\n\t\t\t\t{ siteIcon }\n\t\t\t\t<div className=\"components-site-info\">\n\t\t\t\t\t<span className=\"components-site-name\">\n\t\t\t\t\t\t{ decodeEntities( siteTitle ) || __( '(Untitled)' ) }\n\t\t\t\t\t</span>\n\t\t\t\t\t<span className=\"components-site-home\">{ siteHome }</span>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t{ hasPublishAction && (\n\t\t\t\t<>\n\t\t\t\t\t<PanelBody\n\t\t\t\t\t\tinitialOpen={ false }\n\t\t\t\t\t\ttitle={ [\n\t\t\t\t\t\t\t__( 'Visibility:' ),\n\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\tclassName=\"editor-post-publish-panel__link\"\n\t\t\t\t\t\t\t\tkey=\"label\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<PostVisibilityLabel />\n\t\t\t\t\t\t\t</span>,\n\t\t\t\t\t\t] }\n\t\t\t\t\t>\n\t\t\t\t\t\t<PostVisibility />\n\t\t\t\t\t</PanelBody>\n\t\t\t\t\t<PanelBody\n\t\t\t\t\t\tinitialOpen={ false }\n\t\t\t\t\t\ttitle={ [\n\t\t\t\t\t\t\t__( 'Publish:' ),\n\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\tclassName=\"editor-post-publish-panel__link\"\n\t\t\t\t\t\t\t\tkey=\"label\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<PostScheduleLabel />\n\t\t\t\t\t\t\t</span>,\n\t\t\t\t\t\t] }\n\t\t\t\t\t>\n\t\t\t\t\t\t<PostSchedule />\n\t\t\t\t\t</PanelBody>\n\t\t\t\t</>\n\t\t\t) }\n\t\t\t<MaybePostFormatPanel />\n\t\t\t<MaybeTagsPanel />\n\t\t\t<MaybeCategoryPanel />\n\t\t\t{ children }\n\t\t</div>\n\t);\n}\n\nexport default PostPublishPanelPrepublish;\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/post-publish-panel/prepublish.js"],"names":["get","__","Icon","PanelBody","useSelect","wordpress","filterURLForDisplay","store","coreStore","decodeEntities","PostVisibility","PostVisibilityLabel","PostSchedule","PostScheduleLabel","MaybeTagsPanel","MaybePostFormatPanel","editorStore","MaybeCategoryPanel","PostPublishPanelPrepublish","children","isBeingScheduled","isRequestingSiteIcon","hasPublishAction","siteIconUrl","siteTitle","siteHome","select","getCurrentPost","isEditedPostBeingScheduled","getEntityRecord","isResolving","siteData","undefined","site_icon_url","name","home","siteIcon","prePublishTitle","prePublishBodyText"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,GAAT,QAAoB,QAApB;AAEA;AACA;AACA;;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,IAAT,EAAeC,SAAf,QAAgC,uBAAhC;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,SAAT,QAA0B,kBAA1B;AACA,SAASC,mBAAT,QAAoC,gBAApC;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SAASC,cAAT,QAA+B,0BAA/B;AAEA;AACA;AACA;;AACA,OAAOC,cAAP,MAA2B,oBAA3B;AACA,OAAOC,mBAAP,MAAgC,0BAAhC;AACA,OAAOC,YAAP,MAAyB,kBAAzB;AACA,OAAOC,iBAAP,MAA8B,wBAA9B;AACA,OAAOC,cAAP,MAA2B,oBAA3B;AACA,OAAOC,oBAAP,MAAiC,2BAAjC;AACA,SAASR,KAAK,IAAIS,WAAlB,QAAqC,aAArC;AACA,OAAOC,kBAAP,MAA+B,wBAA/B;;AAEA,SAASC,0BAAT,OAAoD;AAAA,MAAf;AAAEC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,cAAC,SAAD;AACC,IAAA,WAAW,EAAG,KADf;AAEC,IAAA,KAAK,EAAG,CACPA,EAAE,CAAE,UAAF,CADK,EAEP;AACC,MAAA,SAAS,EAAC,iCADX;AAEC,MAAA,GAAG,EAAC;AAFL,OAIC,cAAC,iBAAD,OAJD,CAFO;AAFT,KAYC,cAAC,YAAD,OAZD,CAfD,CAfF,EA8CC,cAAC,oBAAD,OA9CD,EA+CC,cAAC,cAAD,OA/CD,EAgDC,cAAC,kBAAD,OAhDD,EAiDGkB,QAjDH,CADD;AAqDA;;AAED,eAAeD,0BAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { get } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Icon, PanelBody } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { wordpress } from '@wordpress/icons';\nimport { filterURLForDisplay } from '@wordpress/url';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport PostVisibility from '../post-visibility';\nimport PostVisibilityLabel from '../post-visibility/label';\nimport PostSchedule from '../post-schedule';\nimport PostScheduleLabel from '../post-schedule/label';\nimport MaybeTagsPanel from './maybe-tags-panel';\nimport MaybePostFormatPanel from './maybe-post-format-panel';\nimport { store as editorStore } from '../../store';\nimport MaybeCategoryPanel from './maybe-category-panel';\n\nfunction PostPublishPanelPrepublish( { children } ) {\n\tconst {\n\t\tisBeingScheduled,\n\t\tisRequestingSiteIcon,\n\t\thasPublishAction,\n\t\tsiteIconUrl,\n\t\tsiteTitle,\n\t\tsiteHome,\n\t} = useSelect( ( select ) => {\n\t\tconst { getCurrentPost, isEditedPostBeingScheduled } =\n\t\t\tselect( editorStore );\n\t\tconst { getEntityRecord, isResolving } = select( coreStore );\n\t\tconst siteData =\n\t\t\tgetEntityRecord( 'root', '__unstableBase', undefined ) || {};\n\n\t\treturn {\n\t\t\thasPublishAction: 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\tisBeingScheduled: isEditedPostBeingScheduled(),\n\t\t\tisRequestingSiteIcon: isResolving( 'getEntityRecord', [\n\t\t\t\t'root',\n\t\t\t\t'__unstableBase',\n\t\t\t\tundefined,\n\t\t\t] ),\n\t\t\tsiteIconUrl: siteData.site_icon_url,\n\t\t\tsiteTitle: siteData.name,\n\t\t\tsiteHome: siteData.home && filterURLForDisplay( siteData.home ),\n\t\t};\n\t}, [] );\n\n\tlet siteIcon = (\n\t\t<Icon className=\"components-site-icon\" size=\"36px\" icon={ wordpress } />\n\t);\n\n\tif ( siteIconUrl ) {\n\t\tsiteIcon = (\n\t\t\t<img\n\t\t\t\talt={ __( 'Site Icon' ) }\n\t\t\t\tclassName=\"components-site-icon\"\n\t\t\t\tsrc={ siteIconUrl }\n\t\t\t/>\n\t\t);\n\t}\n\n\tif ( isRequestingSiteIcon ) {\n\t\tsiteIcon = null;\n\t}\n\n\tlet prePublishTitle, prePublishBodyText;\n\n\tif ( ! hasPublishAction ) {\n\t\tprePublishTitle = __( 'Are you ready to submit for review?' );\n\t\tprePublishBodyText = __(\n\t\t\t'When you’re ready, submit your work for review, and an Editor will be able to approve it for you.'\n\t\t);\n\t} else if ( isBeingScheduled ) {\n\t\tprePublishTitle = __( 'Are you ready to schedule?' );\n\t\tprePublishBodyText = __(\n\t\t\t'Your work will be published at the specified date and time.'\n\t\t);\n\t} else {\n\t\tprePublishTitle = __( 'Are you ready to publish?' );\n\t\tprePublishBodyText = __(\n\t\t\t'Double-check your settings before publishing.'\n\t\t);\n\t}\n\n\treturn (\n\t\t<div className=\"editor-post-publish-panel__prepublish\">\n\t\t\t<div>\n\t\t\t\t<strong>{ prePublishTitle }</strong>\n\t\t\t</div>\n\t\t\t<p>{ prePublishBodyText }</p>\n\t\t\t<div className=\"components-site-card\">\n\t\t\t\t{ siteIcon }\n\t\t\t\t<div className=\"components-site-info\">\n\t\t\t\t\t<span className=\"components-site-name\">\n\t\t\t\t\t\t{ decodeEntities( siteTitle ) || __( '(Untitled)' ) }\n\t\t\t\t\t</span>\n\t\t\t\t\t<span className=\"components-site-home\">{ siteHome }</span>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t{ hasPublishAction && (\n\t\t\t\t<>\n\t\t\t\t\t<PanelBody\n\t\t\t\t\t\tinitialOpen={ false }\n\t\t\t\t\t\ttitle={ [\n\t\t\t\t\t\t\t__( 'Visibility:' ),\n\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\tclassName=\"editor-post-publish-panel__link\"\n\t\t\t\t\t\t\t\tkey=\"label\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<PostVisibilityLabel />\n\t\t\t\t\t\t\t</span>,\n\t\t\t\t\t\t] }\n\t\t\t\t\t>\n\t\t\t\t\t\t<PostVisibility />\n\t\t\t\t\t</PanelBody>\n\t\t\t\t\t<PanelBody\n\t\t\t\t\t\tinitialOpen={ false }\n\t\t\t\t\t\ttitle={ [\n\t\t\t\t\t\t\t__( 'Publish:' ),\n\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\tclassName=\"editor-post-publish-panel__link\"\n\t\t\t\t\t\t\t\tkey=\"label\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<PostScheduleLabel />\n\t\t\t\t\t\t\t</span>,\n\t\t\t\t\t\t] }\n\t\t\t\t\t>\n\t\t\t\t\t\t<PostSchedule />\n\t\t\t\t\t</PanelBody>\n\t\t\t\t</>\n\t\t\t) }\n\t\t\t<MaybePostFormatPanel />\n\t\t\t<MaybeTagsPanel />\n\t\t\t<MaybeCategoryPanel />\n\t\t\t{ children }\n\t\t</div>\n\t);\n}\n\nexport default PostPublishPanelPrepublish;\n"]}
@@ -5,8 +5,8 @@ import { createElement } from "@wordpress/element";
5
5
  */
6
6
  import { __experimentalGetSettings } from '@wordpress/date';
7
7
  import { useDispatch, useSelect } from '@wordpress/data';
8
- import { DateTimePicker } from '@wordpress/components';
9
- import { useRef, useState, useMemo } from '@wordpress/element';
8
+ import { __experimentalPublishDateTimePicker as PublishDateTimePicker } from '@wordpress/block-editor';
9
+ import { useState, useMemo } from '@wordpress/element';
10
10
  import { store as coreStore } from '@wordpress/core-data';
11
11
  /**
12
12
  * Internal dependencies
@@ -21,7 +21,10 @@ function getDayOfTheMonth() {
21
21
  return new Date(d.getFullYear(), d.getMonth() + (firstDay ? 0 : 1), firstDay ? 1 : 0).toISOString();
22
22
  }
23
23
 
24
- export default function PostSchedule() {
24
+ export default function PostSchedule(_ref) {
25
+ let {
26
+ onClose
27
+ } = _ref;
25
28
  const {
26
29
  postDate,
27
30
  postType
@@ -45,19 +48,18 @@ export default function PostSchedule() {
45
48
  before: getDayOfTheMonth(previewedMonth, false),
46
49
  exclude: [select(editorStore).getCurrentPostId()]
47
50
  }), [previewedMonth, postType]);
48
- const events = useMemo(() => (eventsByPostType || []).map(_ref => {
51
+ const events = useMemo(() => (eventsByPostType || []).map(_ref2 => {
49
52
  let {
50
53
  title,
51
54
  type,
52
55
  date: eventDate
53
- } = _ref;
56
+ } = _ref2;
54
57
  return {
55
58
  title: title === null || title === void 0 ? void 0 : title.rendered,
56
59
  type,
57
60
  date: new Date(eventDate)
58
61
  };
59
62
  }), [eventsByPostType]);
60
- const ref = useRef();
61
63
 
62
64
  const settings = __experimentalGetSettings(); // To know if the current timezone is a 12 hour time with look for "a" in the time format
63
65
  // We also make sure this a is not escaped by a "/"
@@ -67,22 +69,13 @@ export default function PostSchedule() {
67
69
  .replace(/\\\\/g, '') // Replace "//" with empty strings.
68
70
  .split('').reverse().join('') // Reverse the string and test for "a" not followed by a slash.
69
71
  );
70
-
71
- function onChange(newDate) {
72
- onUpdateDate(newDate);
73
- const {
74
- ownerDocument
75
- } = ref.current;
76
- ownerDocument.activeElement.blur();
77
- }
78
-
79
- return createElement(DateTimePicker, {
80
- ref: ref,
72
+ return createElement(PublishDateTimePicker, {
81
73
  currentDate: postDate,
82
- onChange: onChange,
74
+ onChange: onUpdateDate,
83
75
  is12Hour: is12HourTime,
84
76
  events: events,
85
- onMonthPreviewed: setPreviewedMonth
77
+ onMonthPreviewed: setPreviewedMonth,
78
+ onClose: onClose
86
79
  });
87
80
  }
88
81
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-schedule/index.js"],"names":["__experimentalGetSettings","useDispatch","useSelect","DateTimePicker","useRef","useState","useMemo","store","coreStore","editorStore","getDayOfTheMonth","date","Date","firstDay","d","getFullYear","getMonth","toISOString","PostSchedule","postDate","postType","select","getEditedPostAttribute","getCurrentPostType","editPost","onUpdateDate","previewedMonth","setPreviewedMonth","eventsByPostType","getEntityRecords","status","after","before","exclude","getCurrentPostId","events","map","title","type","eventDate","rendered","ref","settings","is12HourTime","test","formats","time","toLowerCase","replace","split","reverse","join","onChange","newDate","ownerDocument","current","activeElement","blur"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,yBAAT,QAA0C,iBAA1C;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,cAAT,QAA+B,uBAA/B;AACA,SAASC,MAAT,EAAiBC,QAAjB,EAA2BC,OAA3B,QAA0C,oBAA1C;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,SAASD,KAAK,IAAIE,WAAlB,QAAqC,aAArC;;AAEA,SAASC,gBAAT,GAAgE;AAAA,MAArCC,IAAqC,uEAA9B,IAAIC,IAAJ,EAA8B;AAAA,MAAlBC,QAAkB,uEAAP,IAAO;AAC/D,QAAMC,CAAC,GAAG,IAAIF,IAAJ,CAAUD,IAAV,CAAV;AACA,SAAO,IAAIC,IAAJ,CACNE,CAAC,CAACC,WAAF,EADM,EAEND,CAAC,CAACE,QAAF,MAAiBH,QAAQ,GAAG,CAAH,GAAO,CAAhC,CAFM,EAGNA,QAAQ,GAAG,CAAH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AAA,IAAT;AAAe3B,MAAAA,IAAI,EAAE4B;AAArB,KAAF;AAAA,WAA0C;AACzCF,MAAAA,KAAK,EAAEA,KAAF,aAAEA,KAAF,uBAAEA,KAAK,CAAEG,QAD2B;AAEzCF,MAAAA,IAFyC;AAGzC3B,MAAAA,IAAI,EAAE,IAAIC,IAAJ,CAAU2B,SAAV;AAHmC,KAA1C;AAAA,GADD,CAFoB,EASrB,CAAEX,gBAAF,CATqB,CAAtB;AAYA,QAAMa,GAAG,GAAGrC,MAAM,EAAlB;;AACA,QAAMsC,QAAQ,GAAG1C,yBAAyB,EAA1C,CAzCsC,CA2CtC;AACA;;;AACA,QAAM2C,YAAY,GAAG,WAAWC,IAAX,CACpBF,QAAQ,CAACG,OAAT,CAAiBC,IAAjB,CACEC,WADF,GACgB;AADhB,GAEEC,OAFF,CAEW,OAFX,EAEoB,EAFpB,EAEyB;AAFzB,GAGEC,KAHF,CAGS,EAHT,EAIEC,OAJF,GAKEC,IALF,CAKQ,EALR,CADoB,CAMP;AANO,GAArB;;AASA,WAASC,QAAT,CAAmBC,OAAnB,EAA6B;AAC5B5B,IAAAA,YAAY,CAAE4B,OAAF,CAAZ;AACA,UAAM;AAAEC,MAAAA;AAAF,QAAoBb,GAAG,CAACc,OAA9B;AACAD,IAAAA,aAAa,CAACE,aAAd,CAA4BC,IAA5B;AACA;;AAED,SACC,cAAC,cAAD;AACC,IAAA,GAAG,EAAGhB,GADP;AAEC,IAAA,WAAW,EAAGtB,QAFf;AAGC,IAAA,QAAQ,EAAGiC,QAHZ;AAIC,IAAA,QAAQ,EAAGT,YAJZ;AAKC,IAAA,MAAM,EAAGR,MALV;AAMC,IAAA,gBAAgB,EAAGR;AANpB,IADD;AAUA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalGetSettings } from '@wordpress/date';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { DateTimePicker } from '@wordpress/components';\nimport { useRef, useState, useMemo } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nfunction getDayOfTheMonth( date = new Date(), firstDay = true ) {\n\tconst d = new Date( date );\n\treturn new Date(\n\t\td.getFullYear(),\n\t\td.getMonth() + ( firstDay ? 0 : 1 ),\n\t\tfirstDay ? 1 : 0\n\t).toISOString();\n}\n\nexport default function PostSchedule() {\n\tconst { postDate, postType } = useSelect(\n\t\t( select ) => ( {\n\t\t\tpostDate: select( editorStore ).getEditedPostAttribute( 'date' ),\n\t\t\tpostType: select( editorStore ).getCurrentPostType(),\n\t\t} ),\n\t\t[]\n\t);\n\n\tconst { editPost } = useDispatch( editorStore );\n\tconst onUpdateDate = ( date ) => editPost( { date } );\n\n\tconst [ previewedMonth, setPreviewedMonth ] = useState(\n\t\tgetDayOfTheMonth( postDate )\n\t);\n\n\t// Pick up published and schduled site posts.\n\tconst eventsByPostType = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getEntityRecords( 'postType', postType, {\n\t\t\t\tstatus: 'publish,future',\n\t\t\t\tafter: getDayOfTheMonth( previewedMonth ),\n\t\t\t\tbefore: getDayOfTheMonth( previewedMonth, false ),\n\t\t\t\texclude: [ select( editorStore ).getCurrentPostId() ],\n\t\t\t} ),\n\t\t[ previewedMonth, postType ]\n\t);\n\n\tconst events = useMemo(\n\t\t() =>\n\t\t\t( eventsByPostType || [] ).map(\n\t\t\t\t( { title, type, date: eventDate } ) => ( {\n\t\t\t\t\ttitle: title?.rendered,\n\t\t\t\t\ttype,\n\t\t\t\t\tdate: new Date( eventDate ),\n\t\t\t\t} )\n\t\t\t),\n\t\t[ eventsByPostType ]\n\t);\n\n\tconst ref = useRef();\n\tconst settings = __experimentalGetSettings();\n\n\t// To know if the current timezone is a 12 hour time with look for \"a\" in the time format\n\t// We also make sure this a is not escaped by a \"/\"\n\tconst is12HourTime = /a(?!\\\\)/i.test(\n\t\tsettings.formats.time\n\t\t\t.toLowerCase() // Test only the lower case a.\n\t\t\t.replace( /\\\\\\\\/g, '' ) // Replace \"//\" with empty strings.\n\t\t\t.split( '' )\n\t\t\t.reverse()\n\t\t\t.join( '' ) // Reverse the string and test for \"a\" not followed by a slash.\n\t);\n\n\tfunction onChange( newDate ) {\n\t\tonUpdateDate( newDate );\n\t\tconst { ownerDocument } = ref.current;\n\t\townerDocument.activeElement.blur();\n\t}\n\n\treturn (\n\t\t<DateTimePicker\n\t\t\tref={ ref }\n\t\t\tcurrentDate={ postDate }\n\t\t\tonChange={ onChange }\n\t\t\tis12Hour={ is12HourTime }\n\t\t\tevents={ events }\n\t\t\tonMonthPreviewed={ setPreviewedMonth }\n\t\t/>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/post-schedule/index.js"],"names":["__experimentalGetSettings","useDispatch","useSelect","__experimentalPublishDateTimePicker","PublishDateTimePicker","useState","useMemo","store","coreStore","editorStore","getDayOfTheMonth","date","Date","firstDay","d","getFullYear","getMonth","toISOString","PostSchedule","onClose","postDate","postType","select","getEditedPostAttribute","getCurrentPostType","editPost","onUpdateDate","previewedMonth","setPreviewedMonth","eventsByPostType","getEntityRecords","status","after","before","exclude","getCurrentPostId","events","map","title","type","eventDate","rendered","settings","is12HourTime","test","formats","time","toLowerCase","replace","split","reverse","join"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,yBAAT,QAA0C,iBAA1C;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,mCAAmC,IAAIC,qBAAhD,QAA6E,yBAA7E;AACA,SAASC,QAAT,EAAmBC,OAAnB,QAAkC,oBAAlC;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,SAASD,KAAK,IAAIE,WAAlB,QAAqC,aAArC;;AAEA,SAASC,gBAAT,GAAgE;AAAA,MAArCC,IAAqC,uEAA9B,IAAIC,IAAJ,EAA8B;AAAA,MAAlBC,QAAkB,uEAAP,IAAO;AAC/D,Q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AAF,CAAN,CAAsB0B,gBAAtB,EAAF;AAJkD,GAA5D,CAFgC,EAQjC,CAAER,cAAF,EAAkBN,QAAlB,CARiC,CAAlC;AAWA,QAAMe,MAAM,GAAG9B,OAAO,CACrB,MACC,CAAEuB,gBAAgB,IAAI,EAAtB,EAA2BQ,GAA3B,CACC;AAAA,QAAE;AAAEC,MAAAA,KAAF;AAASC,MAAAA,IAAT;AAAe5B,MAAAA,IAAI,EAAE6B;AAArB,KAAF;AAAA,WAA0C;AACzCF,MAAAA,KAAK,EAAEA,KAAF,aAAEA,KAAF,uBAAEA,KAAK,CAAEG,QAD2B;AAEzCF,MAAAA,IAFyC;AAGzC5B,MAAAA,IAAI,EAAE,IAAIC,IAAJ,CAAU4B,SAAV;AAHmC,KAA1C;AAAA,GADD,CAFoB,EASrB,CAAEX,gBAAF,CATqB,CAAtB;;AAYA,QAAMa,QAAQ,GAAG1C,yBAAyB,EAA1C,CAxCmD,CA0CnD;AACA;;;AACA,QAAM2C,YAAY,GAAG,WAAWC,IAAX,CACpBF,QAAQ,CAACG,OAAT,CAAiBC,IAAjB,CACEC,WADF,GACgB;AADhB,GAEEC,OAFF,CAEW,OAFX,EAEoB,EAFpB,EAEyB;AAFzB,GAGEC,KAHF,CAGS,EAHT,EAIEC,OAJF,GAKEC,IALF,CAKQ,EALR,CADoB,CAMP;AANO,GAArB;AASA,SACC,cAAC,qBAAD;AACC,IAAA,WAAW,EAAG/B,QADf;AAEC,IAAA,QAAQ,EAAGM,YAFZ;AAGC,IAAA,QAAQ,EAAGiB,YAHZ;AAIC,IAAA,MAAM,EAAGP,MAJV;AAKC,IAAA,gBAAgB,EAAGR,iBALpB;AAMC,IAAA,OAAO,EAAGT;AANX,IADD;AAUA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalGetSettings } from '@wordpress/date';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __experimentalPublishDateTimePicker as PublishDateTimePicker } from '@wordpress/block-editor';\nimport { useState, useMemo } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nfunction getDayOfTheMonth( date = new Date(), firstDay = true ) {\n\tconst d = new Date( date );\n\treturn new Date(\n\t\td.getFullYear(),\n\t\td.getMonth() + ( firstDay ? 0 : 1 ),\n\t\tfirstDay ? 1 : 0\n\t).toISOString();\n}\n\nexport default function PostSchedule( { onClose } ) {\n\tconst { postDate, postType } = useSelect(\n\t\t( select ) => ( {\n\t\t\tpostDate: select( editorStore ).getEditedPostAttribute( 'date' ),\n\t\t\tpostType: select( editorStore ).getCurrentPostType(),\n\t\t} ),\n\t\t[]\n\t);\n\n\tconst { editPost } = useDispatch( editorStore );\n\tconst onUpdateDate = ( date ) => editPost( { date } );\n\n\tconst [ previewedMonth, setPreviewedMonth ] = useState(\n\t\tgetDayOfTheMonth( postDate )\n\t);\n\n\t// Pick up published and schduled site posts.\n\tconst eventsByPostType = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getEntityRecords( 'postType', postType, {\n\t\t\t\tstatus: 'publish,future',\n\t\t\t\tafter: getDayOfTheMonth( previewedMonth ),\n\t\t\t\tbefore: getDayOfTheMonth( previewedMonth, false ),\n\t\t\t\texclude: [ select( editorStore ).getCurrentPostId() ],\n\t\t\t} ),\n\t\t[ previewedMonth, postType ]\n\t);\n\n\tconst events = useMemo(\n\t\t() =>\n\t\t\t( eventsByPostType || [] ).map(\n\t\t\t\t( { title, type, date: eventDate } ) => ( {\n\t\t\t\t\ttitle: title?.rendered,\n\t\t\t\t\ttype,\n\t\t\t\t\tdate: new Date( eventDate ),\n\t\t\t\t} )\n\t\t\t),\n\t\t[ eventsByPostType ]\n\t);\n\n\tconst settings = __experimentalGetSettings();\n\n\t// To know if the current timezone is a 12 hour time with look for \"a\" in the time format\n\t// We also make sure this a is not escaped by a \"/\"\n\tconst is12HourTime = /a(?!\\\\)/i.test(\n\t\tsettings.formats.time\n\t\t\t.toLowerCase() // Test only the lower case a.\n\t\t\t.replace( /\\\\\\\\/g, '' ) // Replace \"//\" with empty strings.\n\t\t\t.split( '' )\n\t\t\t.reverse()\n\t\t\t.join( '' ) // Reverse the string and test for \"a\" not followed by a slash.\n\t);\n\n\treturn (\n\t\t<PublishDateTimePicker\n\t\t\tcurrentDate={ postDate }\n\t\t\tonChange={ onUpdateDate }\n\t\t\tis12Hour={ is12HourTime }\n\t\t\tevents={ events }\n\t\t\tonMonthPreviewed={ setPreviewedMonth }\n\t\t\tonClose={ onClose }\n\t\t/>\n\t);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-slug/index.js"],"names":["withDispatch","withSelect","Component","__","withInstanceId","compose","safeDecodeURIComponent","cleanForSlug","PostSlugCheck","store","editorStore","PostSlug","constructor","postSlug","postTitle","postID","arguments","state","editedSlug","setSlug","bind","event","onUpdateSlug","props","value","target","render","instanceId","inputId","setState","select","getCurrentPost","getEditedPostAttribute","id","dispatch","editPost","slug"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,YAAT,EAAuBC,UAAvB,QAAyC,iBAAzC;AACA,SAASC,SAAT,QAA0B,oBAA1B;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,cAAT,EAAyBC,OAAzB,QAAwC,oBAAxC;AACA,SAASC,sBAAT,EAAiCC,YAAjC,QAAqD,gBAArD;AAEA;AACA;AACA;;AACA,OAAOC,aAAP,MAA0B,SAA1B;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,aAArC;AAEA,OAAO,MAAMC,QAAN,SAAuBT,SAAvB,CAAiC;AACvCU,EAAAA,WAAW,OAAoC;AAAA,QAAlC;AAAEC,MAAAA,QAAF;AAAYC,MAAAA,SAAZ;AAAuBC,MAAAA;AAAvB,KAAkC;AAC9C,UAAO,GAAGC,SAAV;AAEA,SAAKC,KAAL,GAAa;AACZC,MAAAA,UAAU,EACTZ,sBAAsB,CAAEO,QAAF,CAAtB,IACAN,Y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MAAM,CACxDpB,WADwD,CAAzD;AAIA,QAAM;AAAEuB,IAAAA;AAAF,MAASF,cAAc,EAA7B;AACA,SAAO;AACNlB,IAAAA,QAAQ,EAAEmB,sBAAsB,CAAE,MAAF,CAD1B;AAENlB,IAAAA,SAAS,EAAEkB,sBAAsB,CAAE,OAAF,CAF3B;AAGNjB,IAAAA,MAAM,EAAEkB;AAHF,GAAP;AAKA,CAXS,CADa,EAavBjC,YAAY,CAAIkC,QAAF,IAAgB;AAC7B,QAAM;AAAEC,IAAAA;AAAF,MAAeD,QAAQ,CAAExB,WAAF,CAA7B;AACA,SAAO;AACNY,IAAAA,YAAY,CAAEc,IAAF,EAAS;AACpBD,MAAAA,QAAQ,CAAE;AAAEC,QAAAA;AAAF,OAAF,CAAR;AACA;;AAHK,GAAP;AAKA,CAPW,CAbW,EAqBvBhC,cArBuB,CAAF,CAAP,CAsBVO,QAtBU,CAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { withDispatch, withSelect } from '@wordpress/data';\nimport { Component } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { withInstanceId, compose } from '@wordpress/compose';\nimport { safeDecodeURIComponent, cleanForSlug } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport PostSlugCheck from './check';\nimport { store as editorStore } from '../../store';\n\nexport class PostSlug extends Component {\n\tconstructor( { postSlug, postTitle, postID } ) {\n\t\tsuper( ...arguments );\n\n\t\tthis.state = {\n\t\t\teditedSlug:\n\t\t\t\tsafeDecodeURIComponent( postSlug ) ||\n\t\t\t\tcleanForSlug( postTitle ) ||\n\t\t\t\tpostID,\n\t\t};\n\n\t\tthis.setSlug = this.setSlug.bind( this );\n\t}\n\n\tsetSlug( event ) {\n\t\tconst { postSlug, onUpdateSlug } = this.props;\n\t\tconst { value } = event.target;\n\n\t\tconst editedSlug = cleanForSlug( value );\n\n\t\tif ( editedSlug === postSlug ) {\n\t\t\treturn;\n\t\t}\n\n\t\tonUpdateSlug( editedSlug );\n\t}\n\n\trender() {\n\t\tconst { instanceId } = this.props;\n\t\tconst { editedSlug } = this.state;\n\n\t\tconst inputId = 'editor-post-slug-' + instanceId;\n\n\t\treturn (\n\t\t\t<PostSlugCheck>\n\t\t\t\t<label htmlFor={ inputId }>{ __( 'Slug' ) }</label>\n\t\t\t\t<input\n\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\tspellCheck=\"false\"\n\t\t\t\t\ttype=\"text\"\n\t\t\t\t\tid={ inputId }\n\t\t\t\t\tvalue={ editedSlug }\n\t\t\t\t\tonChange={ ( event ) =>\n\t\t\t\t\t\tthis.setState( { editedSlug: event.target.value } )\n\t\t\t\t\t}\n\t\t\t\t\tonBlur={ this.setSlug }\n\t\t\t\t\tclassName=\"editor-post-slug__input\"\n\t\t\t\t/>\n\t\t\t</PostSlugCheck>\n\t\t);\n\t}\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst { getCurrentPost, getEditedPostAttribute } = select(\n\t\t\teditorStore\n\t\t);\n\n\t\tconst { id } = getCurrentPost();\n\t\treturn {\n\t\t\tpostSlug: getEditedPostAttribute( 'slug' ),\n\t\t\tpostTitle: getEditedPostAttribute( 'title' ),\n\t\t\tpostID: id,\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { editPost } = dispatch( editorStore );\n\t\treturn {\n\t\t\tonUpdateSlug( slug ) {\n\t\t\t\teditPost( { slug } );\n\t\t\t},\n\t\t};\n\t} ),\n\twithInstanceId,\n] )( PostSlug );\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/post-slug/index.js"],"names":["withDispatch","withSelect","Component","__","withInstanceId","compose","safeDecodeURIComponent","cleanForSlug","PostSlugCheck","store","editorStore","PostSlug","constructor","postSlug","postTitle","postID","arguments","state","editedSlug","setSlug","bind","event","onUpdateSlug","props","value","target","render","instanceId","inputId","setState","select","getCurrentPost","getEditedPostAttribute","id","dispatch","editPost","slug"],"mappings":";;AAAA;AACA;AACA;AACA,S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,MAAA,OAAO,EAAGC;AAAjB,OAA6BzB,EAAE,CAAE,MAAF,CAA/B,CADD,EAEC;AACC,MAAA,YAAY,EAAC,KADd;AAEC,MAAA,UAAU,EAAC,OAFZ;AAGC,MAAA,IAAI,EAAC,MAHN;AAIC,MAAA,EAAE,EAAGyB,OAJN;AAKC,MAAA,KAAK,EAAGV,UALT;AAMC,MAAA,QAAQ,EAAKG,KAAF,IACV,KAAKQ,QAAL,CAAe;AAAEX,QAAAA,UAAU,EAAEG,KAAK,CAACI,MAAN,CAAaD;AAA3B,OAAf,CAPF;AASC,MAAA,MAAM,EAAG,KAAKL,OATf;AAUC,MAAA,SAAS,EAAC;AAVX,MAFD,CADD;AAiBA;;AAlDsC;AAqDxC,eAAed,OAAO,CAAE,CACvBJ,UAAU,CAAI6B,MAAF,IAAc;AACzB,QAAM;AAAEC,IAAAA,cAAF;AAAkBC,IAAAA;AAAlB,MACLF,MAAM,CAAEpB,WAAF,CADP;AAGA,QAAM;AAAEuB,IAAAA;AAAF,MAASF,cAAc,EAA7B;AACA,SAAO;AACNlB,IAAAA,QAAQ,EAAEmB,sBAAsB,CAAE,MAAF,CAD1B;AAENlB,IAAAA,SAAS,EAAEkB,sBAAsB,CAAE,OAAF,CAF3B;AAGNjB,IAAAA,MAAM,EAAEkB;AAHF,GAAP;AAKA,CAVS,CADa,EAYvBjC,YAAY,CAAIkC,QAAF,IAAgB;AAC7B,QAAM;AAAEC,IAAAA;AAAF,MAAeD,QAAQ,CAAExB,WAAF,CAA7B;AACA,SAAO;AACNY,IAAAA,YAAY,CAAEc,IAAF,EAAS;AACpBD,MAAAA,QAAQ,CAAE;AAAEC,QAAAA;AAAF,OAAF,CAAR;AACA;;AAHK,GAAP;AAKA,CAPW,CAZW,EAoBvBhC,cApBuB,CAAF,CAAP,CAqBVO,QArBU,CAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { withDispatch, withSelect } from '@wordpress/data';\nimport { Component } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { withInstanceId, compose } from '@wordpress/compose';\nimport { safeDecodeURIComponent, cleanForSlug } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport PostSlugCheck from './check';\nimport { store as editorStore } from '../../store';\n\nexport class PostSlug extends Component {\n\tconstructor( { postSlug, postTitle, postID } ) {\n\t\tsuper( ...arguments );\n\n\t\tthis.state = {\n\t\t\teditedSlug:\n\t\t\t\tsafeDecodeURIComponent( postSlug ) ||\n\t\t\t\tcleanForSlug( postTitle ) ||\n\t\t\t\tpostID,\n\t\t};\n\n\t\tthis.setSlug = this.setSlug.bind( this );\n\t}\n\n\tsetSlug( event ) {\n\t\tconst { postSlug, onUpdateSlug } = this.props;\n\t\tconst { value } = event.target;\n\n\t\tconst editedSlug = cleanForSlug( value );\n\n\t\tif ( editedSlug === postSlug ) {\n\t\t\treturn;\n\t\t}\n\n\t\tonUpdateSlug( editedSlug );\n\t}\n\n\trender() {\n\t\tconst { instanceId } = this.props;\n\t\tconst { editedSlug } = this.state;\n\n\t\tconst inputId = 'editor-post-slug-' + instanceId;\n\n\t\treturn (\n\t\t\t<PostSlugCheck>\n\t\t\t\t<label htmlFor={ inputId }>{ __( 'Slug' ) }</label>\n\t\t\t\t<input\n\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\tspellCheck=\"false\"\n\t\t\t\t\ttype=\"text\"\n\t\t\t\t\tid={ inputId }\n\t\t\t\t\tvalue={ editedSlug }\n\t\t\t\t\tonChange={ ( event ) =>\n\t\t\t\t\t\tthis.setState( { editedSlug: event.target.value } )\n\t\t\t\t\t}\n\t\t\t\t\tonBlur={ this.setSlug }\n\t\t\t\t\tclassName=\"editor-post-slug__input\"\n\t\t\t\t/>\n\t\t\t</PostSlugCheck>\n\t\t);\n\t}\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst { getCurrentPost, getEditedPostAttribute } =\n\t\t\tselect( editorStore );\n\n\t\tconst { id } = getCurrentPost();\n\t\treturn {\n\t\t\tpostSlug: getEditedPostAttribute( 'slug' ),\n\t\t\tpostTitle: getEditedPostAttribute( 'title' ),\n\t\t\tpostID: id,\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { editPost } = dispatch( editorStore );\n\t\treturn {\n\t\t\tonUpdateSlug( slug ) {\n\t\t\t\teditPost( { slug } );\n\t\t\t},\n\t\t};\n\t} ),\n\twithInstanceId,\n] )( PostSlug );\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-sticky/index.js"],"names":["__","CheckboxControl","withSelect","withDispatch","compose","PostStickyCheck","store","editorStore","PostSticky","onUpdateSticky","postSticky","select","getEditedPostAttribute","dispatch","editPost","sticky"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,eAAT,QAAgC,uBAAhC;AACA,SAASC,UAAT,EAAqBC,YAArB,QAAyC,iBAAzC;AACA,SAASC,OAAT,QAAwB,oBAAxB;AAEA;AACA;AACA;;AACA,OAAOC,eAAP,MAA4B,SAA5B;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,aAArC;AAEA,OAAO,SAASC,UAAT,OAA8D;AAAA,MAAzC;AAAEC,IAAAA,cAAF;AAAkBC,IAAAA,UAAU,GAAG;AAA/B,GAAyC;AACpE,SACC,cAAC,eAAD,QACC,cAAC,eAAD;AACC,IAAA,KAAK,EAAGV,EAAE,CAAE,8BAAF,CADX;AAEC,IAAA,OAAO,EAAGU,UAFX;AAGC,IAAA,QAAQ,EAAG,MAAMD,cAAc,CAAE,CAAEC,UAAJ;AAHhC,IADD,CADD;AASA;AAED,eAAeN,OAAO,CAAE,CACvBF,UAAU,CAAIS,MAAF,IAAc;AACzB,SAAO;AACND,IAAAA,UAAU,EAAEC,MAAM,CAAEJ,WAAF,CAAN,CAAsBK,sBAAtB,CACX,QADW;AADN,GAAP;AAKA,CANS,CADa,EAQvBT,YAAY,CAAIU,QAAF,IAAgB;AAC7B,SAAO;AACNJ,IAAAA,cAAc,CAAEC,UAAF,EAAe;AAC5BG,MAAAA,QAAQ,CAAEN,WAAF,CAAR,CAAwBO,QAAxB,CAAkC;AAAEC,QAAAA,MAAM,EAAEL;AAAV,OAAlC;AACA;;AAHK,GAAP;AAKA,CANW,CARW,CAAF,CAAP,CAeVF,UAfU,CAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { CheckboxControl } from '@wordpress/components';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport PostStickyCheck from './check';\nimport { store as editorStore } from '../../store';\n\nexport function PostSticky( { onUpdateSticky, postSticky = false } ) {\n\treturn (\n\t\t<PostStickyCheck>\n\t\t\t<CheckboxControl\n\t\t\t\tlabel={ __( 'Stick to the top of the blog' ) }\n\t\t\t\tchecked={ postSticky }\n\t\t\t\tonChange={ () => onUpdateSticky( ! postSticky ) }\n\t\t\t/>\n\t\t</PostStickyCheck>\n\t);\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\treturn {\n\t\t\tpostSticky: select( editorStore ).getEditedPostAttribute(\n\t\t\t\t'sticky'\n\t\t\t),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\treturn {\n\t\t\tonUpdateSticky( postSticky ) {\n\t\t\t\tdispatch( editorStore ).editPost( { sticky: postSticky } );\n\t\t\t},\n\t\t};\n\t} ),\n] )( PostSticky );\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/post-sticky/index.js"],"names":["__","CheckboxControl","withSelect","withDispatch","compose","PostStickyCheck","store","editorStore","PostSticky","onUpdateSticky","postSticky","select","getEditedPostAttribute","dispatch","editPost","sticky"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,eAAT,QAAgC,uBAAhC;AACA,SAASC,UAAT,EAAqBC,YAArB,QAAyC,iBAAzC;AACA,SAASC,OAAT,QAAwB,oBAAxB;AAEA;AACA;AACA;;AACA,OAAOC,eAAP,MAA4B,SAA5B;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,aAArC;AAEA,OAAO,SAASC,UAAT,OAA8D;AAAA,MAAzC;AAAEC,IAAAA,cAAF;AAAkBC,IAAAA,UAAU,GAAG;AAA/B,GAAyC;AACpE,SACC,cAAC,eAAD,QACC,cAAC,eAAD;AACC,IAAA,KAAK,EAAGV,EAAE,CAAE,8BAAF,CADX;AAEC,IAAA,OAAO,EAAGU,UAFX;AAGC,IAAA,QAAQ,EAAG,MAAMD,cAAc,CAAE,CAAEC,UAAJ;AAHhC,IADD,CADD;AASA;AAED,eAAeN,OAAO,CAAE,CACvBF,UAAU,CAAIS,MAAF,IAAc;AACzB,SAAO;AACND,IAAAA,UAAU,EACTC,MAAM,CAAEJ,WAAF,CAAN,CAAsBK,sBAAtB,CAA8C,QAA9C;AAFK,GAAP;AAIA,CALS,CADa,EAOvBT,YAAY,CAAIU,QAAF,IAAgB;AAC7B,SAAO;AACNJ,IAAAA,cAAc,CAAEC,UAAF,EAAe;AAC5BG,MAAAA,QAAQ,CAAEN,WAAF,CAAR,CAAwBO,QAAxB,CAAkC;AAAEC,QAAAA,MAAM,EAAEL;AAAV,OAAlC;AACA;;AAHK,GAAP;AAKA,CANW,CAPW,CAAF,CAAP,CAcVF,UAdU,CAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { CheckboxControl } from '@wordpress/components';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport PostStickyCheck from './check';\nimport { store as editorStore } from '../../store';\n\nexport function PostSticky( { onUpdateSticky, postSticky = false } ) {\n\treturn (\n\t\t<PostStickyCheck>\n\t\t\t<CheckboxControl\n\t\t\t\tlabel={ __( 'Stick to the top of the blog' ) }\n\t\t\t\tchecked={ postSticky }\n\t\t\t\tonChange={ () => onUpdateSticky( ! postSticky ) }\n\t\t\t/>\n\t\t</PostStickyCheck>\n\t);\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\treturn {\n\t\t\tpostSticky:\n\t\t\t\tselect( editorStore ).getEditedPostAttribute( 'sticky' ),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\treturn {\n\t\t\tonUpdateSticky( postSticky ) {\n\t\t\t\tdispatch( editorStore ).editPost( { sticky: postSticky } );\n\t\t\t},\n\t\t};\n\t} ),\n] )( PostSticky );\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-switch-to-draft-button/index.js"],"names":["Button","__experimentalConfirmDialog","ConfirmDialog","__","withSelect","withDispatch","compose","useViewportMatch","useState","store","editorStore","PostSwitchToDraftButton","isSaving","isPublished","isScheduled","onClick","isMobileViewport","showConfirmDialog","setShowConfirmDialog","alertMessage","handleConfirm","select","isSavingPost","isCurrentPostPublished","isCurrentPostScheduled","dispatch","editPost","savePost","status"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,MADD,EAECC,2BAA2B,IAAIC,aAFhC,QAGO,uBAHP;AAIA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,UAAT,EAAqBC,YAArB,QAAyC,iBAAzC;AACA,SAASC,OAAT,EAAkBC,gBAAlB,QAA0C,oBAA1C;AACA,SAASC,QAAT,QAAyB,oBAAzB;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,aAArC;;AAEA,SAASC,uBAAT,OAKI;AAAA,MAL8B;AACjCC,IAAAA,QADiC;AAEjCC,IAAAA,WAFiC;AAGjCC,IAAAA,WAHiC;AAIjCC,IAAAA;AAJiC,GAK9B;AACH,QAAMC,gBAAgB,GAAGT,gBAAgB,CAAE,OAAF,EAAW,GAAX,CAAzC;AACA,QAAM,CAAEU,iBAAF,EAAqBC,oBAArB,IAA8CV,QAAQ,CAAE,KAAF,CAA5D;;AAEA,MAAK,CAAEK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,MAAyBF,QAAQ,CAAEf,WAAF,CAAvC;AACA,SAAO;AACNK,IAAAA,OAAO,EAAE,MAAM;AACdW,MAAAA,QAAQ,CAAE;AAAEE,QAAAA,MAAM,EAAE;AAAV,OAAF,CAAR;AACAD,MAAAA,QAAQ;AACR;AAJK,GAAP;AAMA,CARW,CAbW,CAAF,CAAP,CAsBVhB,uBAtBU,CAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\t__experimentalConfirmDialog as ConfirmDialog,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { compose, useViewportMatch } from '@wordpress/compose';\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nfunction PostSwitchToDraftButton( {\n\tisSaving,\n\tisPublished,\n\tisScheduled,\n\tonClick,\n} ) {\n\tconst isMobileViewport = useViewportMatch( 'small', '<' );\n\tconst [ showConfirmDialog, setShowConfirmDialog ] = useState( false );\n\n\tif ( ! isPublished && ! isScheduled ) {\n\t\treturn null;\n\t}\n\n\tlet alertMessage;\n\tif ( isPublished ) {\n\t\talertMessage = __( 'Are you sure you want to unpublish this post?' );\n\t} else if ( isScheduled ) {\n\t\talertMessage = __( 'Are you sure you want to unschedule this post?' );\n\t}\n\n\tconst handleConfirm = () => {\n\t\tsetShowConfirmDialog( false );\n\t\tonClick();\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<Button\n\t\t\t\tclassName=\"editor-post-switch-to-draft\"\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tsetShowConfirmDialog( true );\n\t\t\t\t} }\n\t\t\t\tdisabled={ isSaving }\n\t\t\t\tvariant=\"tertiary\"\n\t\t\t>\n\t\t\t\t{ isMobileViewport ? __( 'Draft' ) : __( 'Switch to draft' ) }\n\t\t\t</Button>\n\t\t\t<ConfirmDialog\n\t\t\t\tisOpen={ showConfirmDialog }\n\t\t\t\tonConfirm={ handleConfirm }\n\t\t\t\tonCancel={ () => setShowConfirmDialog( false ) }\n\t\t\t>\n\t\t\t\t{ alertMessage }\n\t\t\t</ConfirmDialog>\n\t\t</>\n\t);\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst {\n\t\t\tisSavingPost,\n\t\t\tisCurrentPostPublished,\n\t\t\tisCurrentPostScheduled,\n\t\t} = select( editorStore );\n\t\treturn {\n\t\t\tisSaving: isSavingPost(),\n\t\t\tisPublished: isCurrentPostPublished(),\n\t\t\tisScheduled: isCurrentPostScheduled(),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { editPost, savePost } = dispatch( editorStore );\n\t\treturn {\n\t\t\tonClick: () => {\n\t\t\t\teditPost( { status: 'draft' } );\n\t\t\t\tsavePost();\n\t\t\t},\n\t\t};\n\t} ),\n] )( PostSwitchToDraftButton );\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/post-switch-to-draft-button/index.js"],"names":["Button","__experimentalConfirmDialog","ConfirmDialog","__","withSelect","withDispatch","compose","useViewportMatch","useState","store","editorStore","PostSwitchToDraftButton","isSaving","isPublished","isScheduled","onClick","isMobileViewport","showConfirmDialog","setShowConfirmDialog","alertMessage","handleConfirm","select","isSavingPost","isCurrentPostPublished","isCurrentPostScheduled","dispatch","editPost","savePost","status"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,MADD,EAECC,2BAA2B,IAAIC,aAFhC,QAGO,uBAHP;AAIA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,UAAT,EAAqBC,YAArB,QAAyC,iBAAzC;AACA,SAASC,OAAT,EAAkBC,gBAAlB,QAA0C,oBAA1C;AACA,SAASC,QAAT,QAAyB,oBAAzB;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,aAArC;;AAEA,SAASC,uBAAT,OAKI;AAAA,MAL8B;AACjCC,IAAAA,QADiC;AAEjCC,IAAAA,WAFiC;AAGjCC,IAAAA,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,EADhB;AAENT,IAAAA,WAAW,EAAEU,sBAAsB,EAF7B;AAGNT,IAAAA,WAAW,EAAEU,sBAAsB;AAH7B,GAAP;AAKA,CARS,CADa,EAUvBnB,YAAY,CAAIoB,QAAF,IAAgB;AAC7B,QAAM;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,MAAyBF,QAAQ,CAAEf,WAAF,CAAvC;AACA,SAAO;AACNK,IAAAA,OAAO,EAAE,MAAM;AACdW,MAAAA,QAAQ,CAAE;AAAEE,QAAAA,MAAM,EAAE;AAAV,OAAF,CAAR;AACAD,MAAAA,QAAQ;AACR;AAJK,GAAP;AAMA,CARW,CAVW,CAAF,CAAP,CAmBVhB,uBAnBU,CAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\t__experimentalConfirmDialog as ConfirmDialog,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { compose, useViewportMatch } from '@wordpress/compose';\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nfunction PostSwitchToDraftButton( {\n\tisSaving,\n\tisPublished,\n\tisScheduled,\n\tonClick,\n} ) {\n\tconst isMobileViewport = useViewportMatch( 'small', '<' );\n\tconst [ showConfirmDialog, setShowConfirmDialog ] = useState( false );\n\n\tif ( ! isPublished && ! isScheduled ) {\n\t\treturn null;\n\t}\n\n\tlet alertMessage;\n\tif ( isPublished ) {\n\t\talertMessage = __( 'Are you sure you want to unpublish this post?' );\n\t} else if ( isScheduled ) {\n\t\talertMessage = __( 'Are you sure you want to unschedule this post?' );\n\t}\n\n\tconst handleConfirm = () => {\n\t\tsetShowConfirmDialog( false );\n\t\tonClick();\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<Button\n\t\t\t\tclassName=\"editor-post-switch-to-draft\"\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tsetShowConfirmDialog( true );\n\t\t\t\t} }\n\t\t\t\tdisabled={ isSaving }\n\t\t\t\tvariant=\"tertiary\"\n\t\t\t>\n\t\t\t\t{ isMobileViewport ? __( 'Draft' ) : __( 'Switch to draft' ) }\n\t\t\t</Button>\n\t\t\t<ConfirmDialog\n\t\t\t\tisOpen={ showConfirmDialog }\n\t\t\t\tonConfirm={ handleConfirm }\n\t\t\t\tonCancel={ () => setShowConfirmDialog( false ) }\n\t\t\t>\n\t\t\t\t{ alertMessage }\n\t\t\t</ConfirmDialog>\n\t\t</>\n\t);\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst { isSavingPost, isCurrentPostPublished, isCurrentPostScheduled } =\n\t\t\tselect( editorStore );\n\t\treturn {\n\t\t\tisSaving: isSavingPost(),\n\t\t\tisPublished: isCurrentPostPublished(),\n\t\t\tisScheduled: isCurrentPostScheduled(),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { editPost, savePost } = dispatch( editorStore );\n\t\treturn {\n\t\t\tonClick: () => {\n\t\t\t\teditPost( { status: 'draft' } );\n\t\t\t\tsavePost();\n\t\t\t},\n\t\t};\n\t} ),\n] )( PostSwitchToDraftButton );\n"]}
@@ -139,7 +139,7 @@ function FlatTermSelector(_ref) {
139
139
 
140
140
  useEffect(() => {
141
141
  if (hasResolvedTerms) {
142
- const newValues = terms.map(term => unescapeString(term.name));
142
+ const newValues = (terms !== null && terms !== void 0 ? terms : []).map(term => unescapeString(term.name));
143
143
  setValues(newValues);
144
144
  }
145
145
  }, [terms, hasResolvedTerms]);
@@ -161,7 +161,7 @@ function FlatTermSelector(_ref) {
161
161
  }
162
162
 
163
163
  function onChange(termNames) {
164
- const availableTerms = [...terms, ...(searchResults !== null && searchResults !== void 0 ? searchResults : [])];
164
+ const availableTerms = [...(terms !== null && terms !== void 0 ? terms : []), ...(searchResults !== null && searchResults !== void 0 ? searchResults : [])];
165
165
  const uniqueTerms = uniqBy(termNames, term => term.toLowerCase());
166
166
  const newTermNames = uniqueTerms.filter(termName => !find(availableTerms, term => isSameTermName(term.name, termName))); // Optimistically update term values.
167
167
  // The selector will always re-fetch terms later.