@wordpress/editor 12.0.4 → 12.0.8
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.
- package/build/components/autocompleters/user.js +1 -1
- package/build/components/autosave-monitor/index.js +2 -1
- package/build/components/autosave-monitor/index.js.map +1 -1
- package/build/components/deprecated.js +6 -4
- package/build/components/deprecated.js.map +1 -1
- package/build/components/deprecated.native.js +26 -26
- package/build/components/document-outline/check.js +5 -4
- package/build/components/document-outline/check.js.map +1 -1
- package/build/components/document-outline/index.js +13 -9
- package/build/components/document-outline/index.js.map +1 -1
- package/build/components/document-outline/item.js +25 -22
- package/build/components/document-outline/item.js.map +1 -1
- package/build/components/editor-help/help-detail-navigation-screen.native.js +5 -4
- package/build/components/editor-help/help-detail-navigation-screen.native.js.map +1 -1
- package/build/components/editor-help/help-get-support-button.native.js +5 -4
- package/build/components/editor-help/help-get-support-button.native.js.map +1 -1
- package/build/components/editor-help/help-topic-row.native.js +6 -5
- package/build/components/editor-help/help-topic-row.native.js.map +1 -1
- package/build/components/editor-help/index.native.js +21 -16
- package/build/components/editor-help/index.native.js.map +1 -1
- package/build/components/editor-help/view-sections.native.js +16 -13
- package/build/components/editor-help/view-sections.native.js.map +1 -1
- package/build/components/editor-notices/index.js +5 -4
- package/build/components/editor-notices/index.js.map +1 -1
- package/build/components/entities-saved-states/entity-record-item.js +7 -6
- package/build/components/entities-saved-states/entity-record-item.js.map +1 -1
- package/build/components/entities-saved-states/entity-type-list.js +7 -6
- package/build/components/entities-saved-states/entity-type-list.js.map +1 -1
- package/build/components/entities-saved-states/index.js +31 -22
- package/build/components/entities-saved-states/index.js.map +1 -1
- package/build/components/error-boundary/index.js +5 -4
- package/build/components/error-boundary/index.js.map +1 -1
- package/build/components/global-keyboard-shortcuts/save-shortcut.js +4 -3
- package/build/components/global-keyboard-shortcuts/save-shortcut.js.map +1 -1
- package/build/components/index.js +22 -22
- package/build/components/index.native.js +4 -4
- package/build/components/page-attributes/check.js +4 -3
- package/build/components/page-attributes/check.js.map +1 -1
- package/build/components/page-attributes/order.js +5 -4
- package/build/components/page-attributes/order.js.map +1 -1
- package/build/components/page-attributes/parent.js +6 -3
- package/build/components/page-attributes/parent.js.map +1 -1
- package/build/components/post-author/check.js +4 -3
- package/build/components/post-author/check.js.map +1 -1
- package/build/components/post-author/combobox.js +6 -3
- package/build/components/post-author/combobox.js.map +1 -1
- package/build/components/post-comments/index.js +6 -4
- package/build/components/post-comments/index.js.map +1 -1
- package/build/components/post-excerpt/index.js +5 -4
- package/build/components/post-excerpt/index.js.map +1 -1
- package/build/components/post-featured-image/index.js +51 -41
- package/build/components/post-featured-image/index.js.map +1 -1
- package/build/components/post-format/check.js +5 -4
- package/build/components/post-format/check.js.map +1 -1
- package/build/components/post-format/index.js +1 -1
- package/build/components/post-last-revision/check.js +7 -5
- package/build/components/post-last-revision/check.js.map +1 -1
- package/build/components/post-last-revision/index.js +5 -4
- package/build/components/post-last-revision/index.js.map +1 -1
- package/build/components/post-pending-status/check.js +7 -5
- package/build/components/post-pending-status/check.js.map +1 -1
- package/build/components/post-pending-status/index.js +6 -4
- package/build/components/post-pending-status/index.js.map +1 -1
- package/build/components/post-pingbacks/index.js +6 -4
- package/build/components/post-pingbacks/index.js.map +1 -1
- package/build/components/post-preview-button/index.js +11 -7
- package/build/components/post-preview-button/index.js.map +1 -1
- package/build/components/post-publish-button/index.js +12 -4
- package/build/components/post-publish-button/index.js.map +1 -1
- package/build/components/post-publish-button/label.js +15 -12
- package/build/components/post-publish-button/label.js.map +1 -1
- package/build/components/post-publish-panel/index.js +4 -3
- package/build/components/post-publish-panel/index.js.map +1 -1
- package/build/components/post-publish-panel/maybe-post-format-panel.js +11 -8
- package/build/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
- package/build/components/post-publish-panel/maybe-tags-panel.js +7 -4
- package/build/components/post-publish-panel/maybe-tags-panel.js.map +1 -1
- package/build/components/post-publish-panel/postpublish.js +6 -5
- package/build/components/post-publish-panel/postpublish.js.map +1 -1
- package/build/components/post-publish-panel/prepublish.js +4 -3
- package/build/components/post-publish-panel/prepublish.js.map +1 -1
- package/build/components/post-saved-state/index.js +6 -5
- package/build/components/post-saved-state/index.js.map +1 -1
- package/build/components/post-schedule/check.js +6 -4
- package/build/components/post-schedule/check.js.map +1 -1
- package/build/components/post-schedule/index.js +15 -10
- package/build/components/post-schedule/index.js.map +1 -1
- package/build/components/post-schedule/label.js +5 -4
- package/build/components/post-schedule/label.js.map +1 -1
- package/build/components/post-slug/check.js +4 -3
- package/build/components/post-slug/check.js.map +1 -1
- package/build/components/post-slug/index.js +6 -5
- package/build/components/post-slug/index.js.map +1 -1
- package/build/components/post-sticky/check.js +7 -5
- package/build/components/post-sticky/check.js.map +1 -1
- package/build/components/post-sticky/index.js +5 -4
- package/build/components/post-sticky/index.js.map +1 -1
- package/build/components/post-switch-to-draft-button/index.js +7 -6
- package/build/components/post-switch-to-draft-button/index.js.map +1 -1
- package/build/components/post-taxonomies/check.js +6 -5
- package/build/components/post-taxonomies/check.js.map +1 -1
- package/build/components/post-taxonomies/flat-term-selector.js +4 -3
- package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
- package/build/components/post-taxonomies/hierarchical-term-selector.js +6 -5
- package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
- package/build/components/post-taxonomies/index.js +6 -5
- package/build/components/post-taxonomies/index.js.map +1 -1
- package/build/components/post-taxonomies/most-used-terms.js +5 -4
- package/build/components/post-taxonomies/most-used-terms.js.map +1 -1
- package/build/components/post-template/index.js +2 -1
- package/build/components/post-template/index.js.map +1 -1
- package/build/components/post-title/index.native.js +6 -5
- package/build/components/post-title/index.native.js.map +1 -1
- package/build/components/post-trash/check.js +8 -6
- package/build/components/post-trash/check.js.map +1 -1
- package/build/components/post-trash/index.js +8 -6
- package/build/components/post-trash/index.js.map +1 -1
- package/build/components/post-type-support-check/index.js +6 -5
- package/build/components/post-type-support-check/index.js.map +1 -1
- package/build/components/post-visibility/check.js +5 -4
- package/build/components/post-visibility/check.js.map +1 -1
- package/build/components/post-visibility/index.js +28 -24
- package/build/components/post-visibility/index.js.map +1 -1
- package/build/components/post-visibility/label.js +5 -3
- package/build/components/post-visibility/label.js.map +1 -1
- package/build/components/provider/index.js +9 -8
- package/build/components/provider/index.js.map +1 -1
- package/build/components/provider/index.native.js +17 -11
- package/build/components/provider/index.native.js.map +1 -1
- package/build/components/table-of-contents/index.js +33 -26
- package/build/components/table-of-contents/index.js.map +1 -1
- package/build/components/table-of-contents/panel.js +5 -4
- package/build/components/table-of-contents/panel.js.map +1 -1
- package/build/components/template-validation-notice/index.js +6 -4
- package/build/components/template-validation-notice/index.js.map +1 -1
- package/build/components/theme-support-check/index.js +7 -6
- package/build/components/theme-support-check/index.js.map +1 -1
- package/build/hooks/custom-sources-backwards-compatibility.js +12 -8
- package/build/hooks/custom-sources-backwards-compatibility.js.map +1 -1
- package/build/hooks/default-autocompleters.js +2 -1
- package/build/hooks/default-autocompleters.js.map +1 -1
- package/build/index.js +4 -4
- package/build/store/actions.js +51 -30
- package/build/store/actions.js.map +1 -1
- package/build/store/actions.native.js +3 -2
- package/build/store/actions.native.js.map +1 -1
- package/build/store/constants.js +1 -1
- package/build/store/controls.js +10 -9
- package/build/store/controls.js.map +1 -1
- package/build/store/defaults.js +1 -1
- package/build/store/index.js +5 -3
- package/build/store/index.js.map +1 -1
- package/build/store/reducer.js +52 -22
- package/build/store/reducer.js.map +1 -1
- package/build/store/reducer.native.js +14 -4
- package/build/store/reducer.native.js.map +1 -1
- package/build/store/selectors.js +56 -37
- package/build/store/selectors.js.map +1 -1
- package/build/store/selectors.native.js +1 -1
- package/build/store/utils/notice-builder.js +1 -1
- package/build/utils/index.js +6 -6
- package/build/utils/media-upload/index.js +15 -11
- package/build/utils/media-upload/index.js.map +1 -1
- package/build/utils/url.js +1 -1
- package/build-module/components/autosave-monitor/index.js +2 -1
- package/build-module/components/autosave-monitor/index.js.map +1 -1
- package/build-module/components/deprecated.js +4 -3
- package/build-module/components/deprecated.js.map +1 -1
- package/build-module/components/document-outline/check.js +5 -4
- package/build-module/components/document-outline/check.js.map +1 -1
- package/build-module/components/document-outline/index.js +13 -9
- package/build-module/components/document-outline/index.js.map +1 -1
- package/build-module/components/document-outline/item.js +25 -22
- package/build-module/components/document-outline/item.js.map +1 -1
- package/build-module/components/editor-help/help-detail-navigation-screen.native.js +5 -4
- package/build-module/components/editor-help/help-detail-navigation-screen.native.js.map +1 -1
- package/build-module/components/editor-help/help-get-support-button.native.js +5 -4
- package/build-module/components/editor-help/help-get-support-button.native.js.map +1 -1
- package/build-module/components/editor-help/help-topic-row.native.js +6 -5
- package/build-module/components/editor-help/help-topic-row.native.js.map +1 -1
- package/build-module/components/editor-help/index.native.js +20 -16
- package/build-module/components/editor-help/index.native.js.map +1 -1
- package/build-module/components/editor-help/view-sections.native.js +15 -12
- package/build-module/components/editor-help/view-sections.native.js.map +1 -1
- package/build-module/components/editor-notices/index.js +5 -4
- package/build-module/components/editor-notices/index.js.map +1 -1
- package/build-module/components/entities-saved-states/entity-record-item.js +7 -6
- package/build-module/components/entities-saved-states/entity-record-item.js.map +1 -1
- package/build-module/components/entities-saved-states/entity-type-list.js +7 -6
- package/build-module/components/entities-saved-states/entity-type-list.js.map +1 -1
- package/build-module/components/entities-saved-states/index.js +31 -22
- package/build-module/components/entities-saved-states/index.js.map +1 -1
- package/build-module/components/error-boundary/index.js +5 -4
- package/build-module/components/error-boundary/index.js.map +1 -1
- package/build-module/components/global-keyboard-shortcuts/save-shortcut.js +4 -3
- package/build-module/components/global-keyboard-shortcuts/save-shortcut.js.map +1 -1
- package/build-module/components/page-attributes/check.js +4 -3
- package/build-module/components/page-attributes/check.js.map +1 -1
- package/build-module/components/page-attributes/order.js +5 -4
- package/build-module/components/page-attributes/order.js.map +1 -1
- package/build-module/components/page-attributes/parent.js +5 -2
- package/build-module/components/page-attributes/parent.js.map +1 -1
- package/build-module/components/post-author/check.js +4 -3
- package/build-module/components/post-author/check.js.map +1 -1
- package/build-module/components/post-author/combobox.js +6 -3
- package/build-module/components/post-author/combobox.js.map +1 -1
- package/build-module/components/post-comments/index.js +6 -4
- package/build-module/components/post-comments/index.js.map +1 -1
- package/build-module/components/post-excerpt/index.js +5 -4
- package/build-module/components/post-excerpt/index.js.map +1 -1
- package/build-module/components/post-featured-image/index.js +51 -41
- package/build-module/components/post-featured-image/index.js.map +1 -1
- package/build-module/components/post-format/check.js +5 -4
- package/build-module/components/post-format/check.js.map +1 -1
- package/build-module/components/post-last-revision/check.js +7 -5
- package/build-module/components/post-last-revision/check.js.map +1 -1
- package/build-module/components/post-last-revision/index.js +5 -4
- package/build-module/components/post-last-revision/index.js.map +1 -1
- package/build-module/components/post-pending-status/check.js +7 -5
- package/build-module/components/post-pending-status/check.js.map +1 -1
- package/build-module/components/post-pending-status/index.js +6 -4
- package/build-module/components/post-pending-status/index.js.map +1 -1
- package/build-module/components/post-pingbacks/index.js +6 -4
- package/build-module/components/post-pingbacks/index.js.map +1 -1
- package/build-module/components/post-preview-button/index.js +11 -7
- package/build-module/components/post-preview-button/index.js.map +1 -1
- package/build-module/components/post-publish-button/index.js +12 -4
- package/build-module/components/post-publish-button/index.js.map +1 -1
- package/build-module/components/post-publish-button/label.js +15 -12
- package/build-module/components/post-publish-button/label.js.map +1 -1
- package/build-module/components/post-publish-panel/index.js +4 -3
- package/build-module/components/post-publish-panel/index.js.map +1 -1
- package/build-module/components/post-publish-panel/maybe-post-format-panel.js +11 -8
- package/build-module/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
- package/build-module/components/post-publish-panel/maybe-tags-panel.js +7 -4
- package/build-module/components/post-publish-panel/maybe-tags-panel.js.map +1 -1
- package/build-module/components/post-publish-panel/postpublish.js +6 -5
- package/build-module/components/post-publish-panel/postpublish.js.map +1 -1
- package/build-module/components/post-publish-panel/prepublish.js +4 -3
- package/build-module/components/post-publish-panel/prepublish.js.map +1 -1
- package/build-module/components/post-saved-state/index.js +6 -5
- package/build-module/components/post-saved-state/index.js.map +1 -1
- package/build-module/components/post-schedule/check.js +6 -4
- package/build-module/components/post-schedule/check.js.map +1 -1
- package/build-module/components/post-schedule/index.js +15 -10
- package/build-module/components/post-schedule/index.js.map +1 -1
- package/build-module/components/post-schedule/label.js +6 -4
- package/build-module/components/post-schedule/label.js.map +1 -1
- package/build-module/components/post-slug/check.js +4 -3
- package/build-module/components/post-slug/check.js.map +1 -1
- package/build-module/components/post-slug/index.js +6 -5
- package/build-module/components/post-slug/index.js.map +1 -1
- package/build-module/components/post-sticky/check.js +7 -5
- package/build-module/components/post-sticky/check.js.map +1 -1
- package/build-module/components/post-sticky/index.js +5 -4
- package/build-module/components/post-sticky/index.js.map +1 -1
- package/build-module/components/post-switch-to-draft-button/index.js +7 -6
- package/build-module/components/post-switch-to-draft-button/index.js.map +1 -1
- package/build-module/components/post-taxonomies/check.js +6 -5
- package/build-module/components/post-taxonomies/check.js.map +1 -1
- package/build-module/components/post-taxonomies/flat-term-selector.js +4 -3
- package/build-module/components/post-taxonomies/flat-term-selector.js.map +1 -1
- package/build-module/components/post-taxonomies/hierarchical-term-selector.js +4 -3
- package/build-module/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
- package/build-module/components/post-taxonomies/index.js +6 -5
- package/build-module/components/post-taxonomies/index.js.map +1 -1
- package/build-module/components/post-taxonomies/most-used-terms.js +5 -4
- package/build-module/components/post-taxonomies/most-used-terms.js.map +1 -1
- package/build-module/components/post-template/index.js +2 -1
- package/build-module/components/post-template/index.js.map +1 -1
- package/build-module/components/post-title/index.native.js +6 -5
- package/build-module/components/post-title/index.native.js.map +1 -1
- package/build-module/components/post-trash/check.js +8 -6
- package/build-module/components/post-trash/check.js.map +1 -1
- package/build-module/components/post-trash/index.js +8 -6
- package/build-module/components/post-trash/index.js.map +1 -1
- package/build-module/components/post-type-support-check/index.js +6 -5
- package/build-module/components/post-type-support-check/index.js.map +1 -1
- package/build-module/components/post-visibility/check.js +5 -4
- package/build-module/components/post-visibility/check.js.map +1 -1
- package/build-module/components/post-visibility/index.js +28 -24
- package/build-module/components/post-visibility/index.js.map +1 -1
- package/build-module/components/post-visibility/label.js +5 -3
- package/build-module/components/post-visibility/label.js.map +1 -1
- package/build-module/components/provider/index.js +9 -8
- package/build-module/components/provider/index.js.map +1 -1
- package/build-module/components/provider/index.native.js +13 -9
- package/build-module/components/provider/index.native.js.map +1 -1
- package/build-module/components/table-of-contents/index.js +33 -26
- package/build-module/components/table-of-contents/index.js.map +1 -1
- package/build-module/components/table-of-contents/panel.js +5 -4
- package/build-module/components/table-of-contents/panel.js.map +1 -1
- package/build-module/components/template-validation-notice/index.js +6 -4
- package/build-module/components/template-validation-notice/index.js.map +1 -1
- package/build-module/components/theme-support-check/index.js +7 -6
- package/build-module/components/theme-support-check/index.js.map +1 -1
- package/build-module/hooks/custom-sources-backwards-compatibility.js +12 -8
- package/build-module/hooks/custom-sources-backwards-compatibility.js.map +1 -1
- package/build-module/hooks/default-autocompleters.js +2 -1
- package/build-module/hooks/default-autocompleters.js.map +1 -1
- package/build-module/store/actions.js +27 -12
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/actions.native.js +2 -1
- package/build-module/store/actions.native.js.map +1 -1
- package/build-module/store/controls.js +8 -7
- package/build-module/store/controls.js.map +1 -1
- package/build-module/store/reducer.js +44 -14
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/reducer.native.js +12 -3
- package/build-module/store/reducer.native.js.map +1 -1
- package/build-module/store/selectors.js +7 -4
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/media-upload/index.js +15 -11
- package/build-module/utils/media-upload/index.js.map +1 -1
- package/package.json +31 -31
- package/src/components/entities-saved-states/index.js +8 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/components/post-featured-image/index.js"],"names":["ALLOWED_MEDIA_TYPES","DEFAULT_FEATURE_IMAGE_LABEL","DEFAULT_SET_FEATURE_IMAGE_LABEL","DEFAULT_REMOVE_FEATURE_IMAGE_LABEL","PostFeaturedImage","currentPostId","featuredImageId","onUpdateImage","onDropImage","onRemoveImage","media","postType","noticeUI","postLabel","instructions","mediaWidth","mediaHeight","mediaSourceUrl","mediaSize","id","media_details","sizes","width","height","source_url","fallbackMediaSize","alt_text","full","file","slug","featured_image","open","set_featured_image","isLoading","remove_featured_image","applyWithSelect","select","getMedia","getPostType","coreStore","getCurrentPostId","getEditedPostAttribute","editorStore","context","applyWithDispatch","dispatch","noticeOperations","editPost","image","featured_media","filesList","blockEditorStore","getSettings","mediaUpload","allowedTypes","onFileChange","onError","message","removeAllNotices","createErrorNotice","withNotices"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AAQA;;AACA;;AACA;;AAKA;;AAKA;;AACA;;AA/BA;AACA;AACA;;AAGA;AACA;AACA;;AAoBA;AACA;AACA;AAIA,MAAMA,mBAAmB,GAAG,CAAE,OAAF,CAA5B,C,CAEA;;AACA,MAAMC,2BAA2B,GAAG,cAAI,gBAAJ,CAApC;AACA,MAAMC,+BAA+B,GAAG,cAAI,oBAAJ,CAAxC;AACA,MAAMC,kCAAkC,GAAG,cAAI,cAAJ,CAA3C;;AAEA,SAASC,iBAAT,CAA4B;AAC3BC,EAAAA,aAD2B;AAE3BC,EAAAA,eAF2B;AAG3BC,EAAAA,aAH2B;AAI3BC,EAAAA,WAJ2B;AAK3BC,EAAAA,aAL2B;AAM3BC,EAAAA,KAN2B;AAO3BC,EAAAA,QAP2B;AAQ3BC,EAAAA;AAR2B,CAA5B,EASI;AAAA;;AACH,QAAMC,SAAS,GAAG,iBAAKF,QAAL,EAAe,CAAE,QAAF,CAAf,EAA6B,EAA7B,CAAlB;AACA,QAAMG,YAAY,GACjB,uCACG,cACD,kEADC,CADH,CADD;AAQA,MAAIC,UAAJ,EAAgBC,WAAhB,EAA6BC,cAA7B;;AACA,MAAKP,KAAL,EAAa;AACZ,UAAMQ,SAAS,GAAG,yBACjB,oCADiB,EAEjB,gBAF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W,uBADc,EAEdzB,eAFc,EAGdS,iBAHc,EAId,6BAAa,0BAAb,CAJc,EAKZxC,iBALY,C","sourcesContent":["/**\n * External dependencies\n */\nimport { has, get } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { applyFilters } from '@wordpress/hooks';\nimport {\n\tDropZone,\n\tButton,\n\tSpinner,\n\tResponsiveWrapper,\n\twithNotices,\n\twithFilters,\n} from '@wordpress/components';\nimport { compose } from '@wordpress/compose';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport {\n\tMediaUpload,\n\tMediaUploadCheck,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport PostFeaturedImageCheck from './check';\nimport { store as editorStore } from '../../store';\n\nconst ALLOWED_MEDIA_TYPES = [ 'image' ];\n\n// Used when labels from post type were not yet loaded or when they are not present.\nconst DEFAULT_FEATURE_IMAGE_LABEL = __( 'Featured image' );\nconst DEFAULT_SET_FEATURE_IMAGE_LABEL = __( 'Set featured image' );\nconst DEFAULT_REMOVE_FEATURE_IMAGE_LABEL = __( 'Remove image' );\n\nfunction PostFeaturedImage( {\n\tcurrentPostId,\n\tfeaturedImageId,\n\tonUpdateImage,\n\tonDropImage,\n\tonRemoveImage,\n\tmedia,\n\tpostType,\n\tnoticeUI,\n} ) {\n\tconst postLabel = get( postType, [ 'labels' ], {} );\n\tconst instructions = (\n\t\t<p>\n\t\t\t{ __(\n\t\t\t\t'To edit the featured image, you need permission to upload media.'\n\t\t\t) }\n\t\t</p>\n\t);\n\n\tlet mediaWidth, mediaHeight, mediaSourceUrl;\n\tif ( media ) {\n\t\tconst mediaSize = applyFilters(\n\t\t\t'editor.PostFeaturedImage.imageSize',\n\t\t\t'post-thumbnail',\n\t\t\tmedia.id,\n\t\t\tcurrentPostId\n\t\t);\n\t\tif ( has( media, [ 'media_details', 'sizes', mediaSize ] ) ) {\n\t\t\t// use mediaSize when available\n\t\t\tmediaWidth = media.media_details.sizes[ mediaSize ].width;\n\t\t\tmediaHeight = media.media_details.sizes[ mediaSize ].height;\n\t\t\tmediaSourceUrl = media.media_details.sizes[ mediaSize ].source_url;\n\t\t} else {\n\t\t\t// get fallbackMediaSize if mediaSize is not available\n\t\t\tconst fallbackMediaSize = applyFilters(\n\t\t\t\t'editor.PostFeaturedImage.imageSize',\n\t\t\t\t'thumbnail',\n\t\t\t\tmedia.id,\n\t\t\t\tcurrentPostId\n\t\t\t);\n\t\t\tif (\n\t\t\t\thas( media, [ 'media_details', 'sizes', fallbackMediaSize ] )\n\t\t\t) {\n\t\t\t\t// use fallbackMediaSize when mediaSize is not available\n\t\t\t\tmediaWidth =\n\t\t\t\t\tmedia.media_details.sizes[ fallbackMediaSize ].width;\n\t\t\t\tmediaHeight =\n\t\t\t\t\tmedia.media_details.sizes[ fallbackMediaSize ].height;\n\t\t\t\tmediaSourceUrl =\n\t\t\t\t\tmedia.media_details.sizes[ fallbackMediaSize ].source_url;\n\t\t\t} else {\n\t\t\t\t// use full image size when mediaFallbackSize and mediaSize are not available\n\t\t\t\tmediaWidth = media.media_details.width;\n\t\t\t\tmediaHeight = media.media_details.height;\n\t\t\t\tmediaSourceUrl = media.source_url;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn (\n\t\t<PostFeaturedImageCheck>\n\t\t\t{ noticeUI }\n\t\t\t<div className=\"editor-post-featured-image\">\n\t\t\t\t{ media && (\n\t\t\t\t\t<div\n\t\t\t\t\t\tid={ `editor-post-featured-image-${ featuredImageId }-describedby` }\n\t\t\t\t\t\tclassName=\"hidden\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ media.alt_text &&\n\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t// Translators: %s: The selected image alt text.\n\t\t\t\t\t\t\t\t__( 'Current image: %s' ),\n\t\t\t\t\t\t\t\tmedia.alt_text\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ ! media.alt_text &&\n\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t// Translators: %s: The selected image filename.\n\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t'The current image has no alternative text. The file name is: %s'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tmedia.media_details.sizes?.full?.file ||\n\t\t\t\t\t\t\t\t\tmedia.slug\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t\t<MediaUploadCheck fallback={ instructions }>\n\t\t\t\t\t<MediaUpload\n\t\t\t\t\t\ttitle={\n\t\t\t\t\t\t\tpostLabel.featured_image ||\n\t\t\t\t\t\t\tDEFAULT_FEATURE_IMAGE_LABEL\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonSelect={ onUpdateImage }\n\t\t\t\t\t\tunstableFeaturedImageFlow\n\t\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\t\t\tmodalClass=\"editor-post-featured-image__media-modal\"\n\t\t\t\t\t\trender={ ( { open } ) => (\n\t\t\t\t\t\t\t<div className=\"editor-post-featured-image__container\">\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\t\t\t! featuredImageId\n\t\t\t\t\t\t\t\t\t\t\t? 'editor-post-featured-image__toggle'\n\t\t\t\t\t\t\t\t\t\t\t: 'editor-post-featured-image__preview'\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tonClick={ open }\n\t\t\t\t\t\t\t\t\taria-label={\n\t\t\t\t\t\t\t\t\t\t! featuredImageId\n\t\t\t\t\t\t\t\t\t\t\t? null\n\t\t\t\t\t\t\t\t\t\t\t: __( 'Edit or update the image' )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\taria-describedby={\n\t\t\t\t\t\t\t\t\t\t! featuredImageId\n\t\t\t\t\t\t\t\t\t\t\t? null\n\t\t\t\t\t\t\t\t\t\t\t: `editor-post-featured-image-${ featuredImageId }-describedby`\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ !! featuredImageId && media && (\n\t\t\t\t\t\t\t\t\t\t<ResponsiveWrapper\n\t\t\t\t\t\t\t\t\t\t\tnaturalWidth={ mediaWidth }\n\t\t\t\t\t\t\t\t\t\t\tnaturalHeight={ mediaHeight }\n\t\t\t\t\t\t\t\t\t\t\tisInline\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t<img\n\t\t\t\t\t\t\t\t\t\t\t\tsrc={ mediaSourceUrl }\n\t\t\t\t\t\t\t\t\t\t\t\talt=\"\"\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t</ResponsiveWrapper>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t{ !! featuredImageId && ! media && (\n\t\t\t\t\t\t\t\t\t\t<Spinner />\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t{ ! featuredImageId &&\n\t\t\t\t\t\t\t\t\t\t( postLabel.set_featured_image ||\n\t\t\t\t\t\t\t\t\t\t\tDEFAULT_SET_FEATURE_IMAGE_LABEL ) }\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t<DropZone onFilesDrop={ onDropImage } />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tvalue={ featuredImageId }\n\t\t\t\t\t/>\n\t\t\t\t</MediaUploadCheck>\n\t\t\t\t{ !! featuredImageId && media && ! media.isLoading && (\n\t\t\t\t\t<MediaUploadCheck>\n\t\t\t\t\t\t<MediaUpload\n\t\t\t\t\t\t\ttitle={\n\t\t\t\t\t\t\t\tpostLabel.featured_image ||\n\t\t\t\t\t\t\t\tDEFAULT_FEATURE_IMAGE_LABEL\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonSelect={ onUpdateImage }\n\t\t\t\t\t\t\tunstableFeaturedImageFlow\n\t\t\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\t\t\t\tmodalClass=\"editor-post-featured-image__media-modal\"\n\t\t\t\t\t\t\trender={ ( { open } ) => (\n\t\t\t\t\t\t\t\t<Button onClick={ open } variant=\"secondary\">\n\t\t\t\t\t\t\t\t\t{ __( 'Replace Image' ) }\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</MediaUploadCheck>\n\t\t\t\t) }\n\t\t\t\t{ !! featuredImageId && (\n\t\t\t\t\t<MediaUploadCheck>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tonClick={ onRemoveImage }\n\t\t\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t\t\tisDestructive\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ postLabel.remove_featured_image ||\n\t\t\t\t\t\t\t\tDEFAULT_REMOVE_FEATURE_IMAGE_LABEL }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</MediaUploadCheck>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</PostFeaturedImageCheck>\n\t);\n}\n\nconst applyWithSelect = withSelect( ( select ) => {\n\tconst { getMedia, getPostType } = select( coreStore );\n\tconst { getCurrentPostId, getEditedPostAttribute } = select( editorStore );\n\tconst featuredImageId = getEditedPostAttribute( 'featured_media' );\n\n\treturn {\n\t\tmedia: featuredImageId\n\t\t\t? getMedia( featuredImageId, { context: 'view' } )\n\t\t\t: null,\n\t\tcurrentPostId: getCurrentPostId(),\n\t\tpostType: getPostType( getEditedPostAttribute( 'type' ) ),\n\t\tfeaturedImageId,\n\t};\n} );\n\nconst applyWithDispatch = withDispatch(\n\t( dispatch, { noticeOperations }, { select } ) => {\n\t\tconst { editPost } = dispatch( editorStore );\n\t\treturn {\n\t\t\tonUpdateImage( image ) {\n\t\t\t\teditPost( { featured_media: image.id } );\n\t\t\t},\n\t\t\tonDropImage( filesList ) {\n\t\t\t\tselect( blockEditorStore )\n\t\t\t\t\t.getSettings()\n\t\t\t\t\t.mediaUpload( {\n\t\t\t\t\t\tallowedTypes: [ 'image' ],\n\t\t\t\t\t\tfilesList,\n\t\t\t\t\t\tonFileChange( [ image ] ) {\n\t\t\t\t\t\t\teditPost( { featured_media: image.id } );\n\t\t\t\t\t\t},\n\t\t\t\t\t\tonError( message ) {\n\t\t\t\t\t\t\tnoticeOperations.removeAllNotices();\n\t\t\t\t\t\t\tnoticeOperations.createErrorNotice( message );\n\t\t\t\t\t\t},\n\t\t\t\t\t} );\n\t\t\t},\n\t\t\tonRemoveImage() {\n\t\t\t\teditPost( { featured_media: 0 } );\n\t\t\t},\n\t\t};\n\t}\n);\n\nexport default compose(\n\twithNotices,\n\tapplyWithSelect,\n\tapplyWithDispatch,\n\twithFilters( 'editor.PostFeaturedImage' )\n)( PostFeaturedImage );\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/components/post-featured-image/index.js"],"names":["ALLOWED_MEDIA_TYPES","DEFAULT_FEATURE_IMAGE_LABEL","DEFAULT_SET_FEATURE_IMAGE_LABEL","DEFAULT_REMOVE_FEATURE_IMAGE_LABEL","PostFeaturedImage","currentPostId","featuredImageId","onUpdateImage","onDropImage","onRemoveImage","media","postType","noticeUI","postLabel","instructions","mediaWidth","mediaHeight","mediaSourceUrl","mediaSize","id","media_details","sizes","width","height","source_url","fallbackMediaSize","alt_text","full","file","slug","featured_image","open","set_featured_image","isLoading","remove_featured_image","applyWithSelect","select","getMedia","getPostType","coreStore","getCurrentPostId","getEditedPostAttribute","editorStore","context","applyWithDispatch","dispatch","noticeOperations","editPost","image","featured_media","filesList","blockEditorStore","getSettings","mediaUpload","allowedTypes","onFileChange","onError","message","removeAllNotices","createErrorNotice","withNotices"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AAQA;;AACA;;AACA;;AAKA;;AA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AAQ,CAAEH,YAAF,CAA7B;AACA,SAAO;AACNnC,IAAAA,aAAa,CAAEyC,KAAF,EAAU;AACtBD,MAAAA,QAAQ,CAAE;AAAEE,QAAAA,cAAc,EAAED,KAAK,CAAC7B;AAAxB,OAAF,CAAR;AACA,KAHK;;AAINX,IAAAA,WAAW,CAAE0C,SAAF,EAAc;AACxBd,MAAAA,MAAM,CAAEe,kBAAF,CAAN,CACEC,WADF,GAEEC,WAFF,CAEe;AACbC,QAAAA,YAAY,EAAE,CAAE,OAAF,CADD;AAEbJ,QAAAA,SAFa;;AAGbK,QAAAA,YAAY,QAAc;AAAA,cAAZ,CAAEP,KAAF,CAAY;AACzBD,UAAAA,QAAQ,CAAE;AAAEE,YAAAA,cAAc,EAAED,KAAK,CAAC7B;AAAxB,WAAF,CAAR;AACA,SALY;;AAMbqC,QAAAA,OAAO,CAAEC,OAAF,EAAY;AAClBX,UAAAA,gBAAgB,CAACY,gBAAjB;AACAZ,UAAAA,gBAAgB,CAACa,iBAAjB,CAAoCF,OAApC;AACA;;AATY,OAFf;AAaA,KAlBK;;AAmBNhD,IAAAA,aAAa,GAAG;AACfsC,MAAAA,QAAQ,CAAE;AAAEE,QAAAA,cAAc,EAAE;AAAlB,OAAF,CAAR;AACA;;AArBK,GAAP;AAuBA,CA1BwB,CAA1B;;eA6Be,sBACdW,uBADc,EAEdzB,eAFc,EAGdS,iBAHc,EAId,6BAAa,0BAAb,CAJc,EAKZxC,iBALY,C","sourcesContent":["/**\n * External dependencies\n */\nimport { has, get } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { applyFilters } from '@wordpress/hooks';\nimport {\n\tDropZone,\n\tButton,\n\tSpinner,\n\tResponsiveWrapper,\n\twithNotices,\n\twithFilters,\n} from '@wordpress/components';\nimport { compose } from '@wordpress/compose';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport {\n\tMediaUpload,\n\tMediaUploadCheck,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport PostFeaturedImageCheck from './check';\nimport { store as editorStore } from '../../store';\n\nconst ALLOWED_MEDIA_TYPES = [ 'image' ];\n\n// Used when labels from post type were not yet loaded or when they are not present.\nconst DEFAULT_FEATURE_IMAGE_LABEL = __( 'Featured image' );\nconst DEFAULT_SET_FEATURE_IMAGE_LABEL = __( 'Set featured image' );\nconst DEFAULT_REMOVE_FEATURE_IMAGE_LABEL = __( 'Remove image' );\n\nfunction PostFeaturedImage( {\n\tcurrentPostId,\n\tfeaturedImageId,\n\tonUpdateImage,\n\tonDropImage,\n\tonRemoveImage,\n\tmedia,\n\tpostType,\n\tnoticeUI,\n} ) {\n\tconst postLabel = get( postType, [ 'labels' ], {} );\n\tconst instructions = (\n\t\t<p>\n\t\t\t{ __(\n\t\t\t\t'To edit the featured image, you need permission to upload media.'\n\t\t\t) }\n\t\t</p>\n\t);\n\n\tlet mediaWidth, mediaHeight, mediaSourceUrl;\n\tif ( media ) {\n\t\tconst mediaSize = applyFilters(\n\t\t\t'editor.PostFeaturedImage.imageSize',\n\t\t\t'post-thumbnail',\n\t\t\tmedia.id,\n\t\t\tcurrentPostId\n\t\t);\n\t\tif ( has( media, [ 'media_details', 'sizes', mediaSize ] ) ) {\n\t\t\t// use mediaSize when available\n\t\t\tmediaWidth = media.media_details.sizes[ mediaSize ].width;\n\t\t\tmediaHeight = media.media_details.sizes[ mediaSize ].height;\n\t\t\tmediaSourceUrl = media.media_details.sizes[ mediaSize ].source_url;\n\t\t} else {\n\t\t\t// get fallbackMediaSize if mediaSize is not available\n\t\t\tconst fallbackMediaSize = applyFilters(\n\t\t\t\t'editor.PostFeaturedImage.imageSize',\n\t\t\t\t'thumbnail',\n\t\t\t\tmedia.id,\n\t\t\t\tcurrentPostId\n\t\t\t);\n\t\t\tif (\n\t\t\t\thas( media, [ 'media_details', 'sizes', fallbackMediaSize ] )\n\t\t\t) {\n\t\t\t\t// use fallbackMediaSize when mediaSize is not available\n\t\t\t\tmediaWidth =\n\t\t\t\t\tmedia.media_details.sizes[ fallbackMediaSize ].width;\n\t\t\t\tmediaHeight =\n\t\t\t\t\tmedia.media_details.sizes[ fallbackMediaSize ].height;\n\t\t\t\tmediaSourceUrl =\n\t\t\t\t\tmedia.media_details.sizes[ fallbackMediaSize ].source_url;\n\t\t\t} else {\n\t\t\t\t// use full image size when mediaFallbackSize and mediaSize are not available\n\t\t\t\tmediaWidth = media.media_details.width;\n\t\t\t\tmediaHeight = media.media_details.height;\n\t\t\t\tmediaSourceUrl = media.source_url;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn (\n\t\t<PostFeaturedImageCheck>\n\t\t\t{ noticeUI }\n\t\t\t<div className=\"editor-post-featured-image\">\n\t\t\t\t{ media && (\n\t\t\t\t\t<div\n\t\t\t\t\t\tid={ `editor-post-featured-image-${ featuredImageId }-describedby` }\n\t\t\t\t\t\tclassName=\"hidden\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ media.alt_text &&\n\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t// Translators: %s: The selected image alt text.\n\t\t\t\t\t\t\t\t__( 'Current image: %s' ),\n\t\t\t\t\t\t\t\tmedia.alt_text\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ ! media.alt_text &&\n\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t// Translators: %s: The selected image filename.\n\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t'The current image has no alternative text. The file name is: %s'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tmedia.media_details.sizes?.full?.file ||\n\t\t\t\t\t\t\t\t\tmedia.slug\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t\t<MediaUploadCheck fallback={ instructions }>\n\t\t\t\t\t<MediaUpload\n\t\t\t\t\t\ttitle={\n\t\t\t\t\t\t\tpostLabel.featured_image ||\n\t\t\t\t\t\t\tDEFAULT_FEATURE_IMAGE_LABEL\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonSelect={ onUpdateImage }\n\t\t\t\t\t\tunstableFeaturedImageFlow\n\t\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\t\t\tmodalClass=\"editor-post-featured-image__media-modal\"\n\t\t\t\t\t\trender={ ( { open } ) => (\n\t\t\t\t\t\t\t<div className=\"editor-post-featured-image__container\">\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\t\t\t! featuredImageId\n\t\t\t\t\t\t\t\t\t\t\t? 'editor-post-featured-image__toggle'\n\t\t\t\t\t\t\t\t\t\t\t: 'editor-post-featured-image__preview'\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tonClick={ open }\n\t\t\t\t\t\t\t\t\taria-label={\n\t\t\t\t\t\t\t\t\t\t! featuredImageId\n\t\t\t\t\t\t\t\t\t\t\t? null\n\t\t\t\t\t\t\t\t\t\t\t: __( 'Edit or update the image' )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\taria-describedby={\n\t\t\t\t\t\t\t\t\t\t! featuredImageId\n\t\t\t\t\t\t\t\t\t\t\t? null\n\t\t\t\t\t\t\t\t\t\t\t: `editor-post-featured-image-${ featuredImageId }-describedby`\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ !! featuredImageId && media && (\n\t\t\t\t\t\t\t\t\t\t<ResponsiveWrapper\n\t\t\t\t\t\t\t\t\t\t\tnaturalWidth={ mediaWidth }\n\t\t\t\t\t\t\t\t\t\t\tnaturalHeight={ mediaHeight }\n\t\t\t\t\t\t\t\t\t\t\tisInline\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t<img\n\t\t\t\t\t\t\t\t\t\t\t\tsrc={ mediaSourceUrl }\n\t\t\t\t\t\t\t\t\t\t\t\talt=\"\"\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t</ResponsiveWrapper>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t{ !! featuredImageId && ! media && (\n\t\t\t\t\t\t\t\t\t\t<Spinner />\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t{ ! featuredImageId &&\n\t\t\t\t\t\t\t\t\t\t( postLabel.set_featured_image ||\n\t\t\t\t\t\t\t\t\t\t\tDEFAULT_SET_FEATURE_IMAGE_LABEL ) }\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t<DropZone onFilesDrop={ onDropImage } />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tvalue={ featuredImageId }\n\t\t\t\t\t/>\n\t\t\t\t</MediaUploadCheck>\n\t\t\t\t{ !! featuredImageId && media && ! media.isLoading && (\n\t\t\t\t\t<MediaUploadCheck>\n\t\t\t\t\t\t<MediaUpload\n\t\t\t\t\t\t\ttitle={\n\t\t\t\t\t\t\t\tpostLabel.featured_image ||\n\t\t\t\t\t\t\t\tDEFAULT_FEATURE_IMAGE_LABEL\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonSelect={ onUpdateImage }\n\t\t\t\t\t\t\tunstableFeaturedImageFlow\n\t\t\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\t\t\t\tmodalClass=\"editor-post-featured-image__media-modal\"\n\t\t\t\t\t\t\trender={ ( { open } ) => (\n\t\t\t\t\t\t\t\t<Button onClick={ open } variant=\"secondary\">\n\t\t\t\t\t\t\t\t\t{ __( 'Replace Image' ) }\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</MediaUploadCheck>\n\t\t\t\t) }\n\t\t\t\t{ !! featuredImageId && (\n\t\t\t\t\t<MediaUploadCheck>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tonClick={ onRemoveImage }\n\t\t\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t\t\tisDestructive\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ postLabel.remove_featured_image ||\n\t\t\t\t\t\t\t\tDEFAULT_REMOVE_FEATURE_IMAGE_LABEL }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</MediaUploadCheck>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</PostFeaturedImageCheck>\n\t);\n}\n\nconst applyWithSelect = withSelect( ( select ) => {\n\tconst { getMedia, getPostType } = select( coreStore );\n\tconst { getCurrentPostId, getEditedPostAttribute } = select( editorStore );\n\tconst featuredImageId = getEditedPostAttribute( 'featured_media' );\n\n\treturn {\n\t\tmedia: featuredImageId\n\t\t\t? getMedia( featuredImageId, { context: 'view' } )\n\t\t\t: null,\n\t\tcurrentPostId: getCurrentPostId(),\n\t\tpostType: getPostType( getEditedPostAttribute( 'type' ) ),\n\t\tfeaturedImageId,\n\t};\n} );\n\nconst applyWithDispatch = withDispatch(\n\t( dispatch, { noticeOperations }, { select } ) => {\n\t\tconst { editPost } = dispatch( editorStore );\n\t\treturn {\n\t\t\tonUpdateImage( image ) {\n\t\t\t\teditPost( { featured_media: image.id } );\n\t\t\t},\n\t\t\tonDropImage( filesList ) {\n\t\t\t\tselect( blockEditorStore )\n\t\t\t\t\t.getSettings()\n\t\t\t\t\t.mediaUpload( {\n\t\t\t\t\t\tallowedTypes: [ 'image' ],\n\t\t\t\t\t\tfilesList,\n\t\t\t\t\t\tonFileChange( [ image ] ) {\n\t\t\t\t\t\t\teditPost( { featured_media: image.id } );\n\t\t\t\t\t\t},\n\t\t\t\t\t\tonError( message ) {\n\t\t\t\t\t\t\tnoticeOperations.removeAllNotices();\n\t\t\t\t\t\t\tnoticeOperations.createErrorNotice( message );\n\t\t\t\t\t\t},\n\t\t\t\t\t} );\n\t\t\t},\n\t\t\tonRemoveImage() {\n\t\t\t\teditPost( { featured_media: 0 } );\n\t\t\t},\n\t\t};\n\t}\n);\n\nexport default compose(\n\twithNotices,\n\tapplyWithSelect,\n\tapplyWithDispatch,\n\twithFilters( 'editor.PostFeaturedImage' )\n)( PostFeaturedImage );\n"]}
|
|
@@ -24,10 +24,11 @@ var _store = require("../../store");
|
|
|
24
24
|
/**
|
|
25
25
|
* Internal dependencies
|
|
26
26
|
*/
|
|
27
|
-
function PostFormatCheck({
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
function PostFormatCheck(_ref) {
|
|
28
|
+
let {
|
|
29
|
+
disablePostFormats,
|
|
30
|
+
...props
|
|
31
|
+
} = _ref;
|
|
31
32
|
return !disablePostFormats && (0, _element.createElement)(_postTypeSupportCheck.default, (0, _extends2.default)({}, props, {
|
|
32
33
|
supportKeys: "post-formats"
|
|
33
34
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/components/post-format/check.js"],"names":["PostFormatCheck","disablePostFormats","props","select","editorSettings","editorStore","getEditorSettings"],"mappings":";;;;;;;;;;;;;AAGA;;AAKA;;AACA;;AATA;AACA;AACA;;AAGA;AACA;AACA;AAIA,SAASA,eAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/components/post-format/check.js"],"names":["PostFormatCheck","disablePostFormats","props","select","editorSettings","editorStore","getEditorSettings"],"mappings":";;;;;;;;;;;;;AAGA;;AAKA;;AACA;;AATA;AACA;AACA;;AAGA;AACA;AACA;AAIA,SAASA,eAAT,OAA6D;AAAA,MAAnC;AAAEC,IAAAA,kBAAF;AAAsB,OAAGC;AAAzB,GAAmC;AAC5D,SACC,CAAED,kBAAF,IACC,4BAAC,6BAAD,6BAA2BC,KAA3B;AAAmC,IAAA,WAAW,EAAC;AAA/C,KAFF;AAKA;;eAEc,sBAAcC,MAAF,IAAc;AACxC,QAAMC,cAAc,GAAGD,MAAM,CAAEE,YAAF,CAAN,CAAsBC,iBAAtB,EAAvB;AACA,SAAO;AACNL,IAAAA,kBAAkB,EAAEG,cAAc,CAACH;AAD7B,GAAP;AAGA,CALc,EAKVD,eALU,C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { withSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport PostTypeSupportCheck from '../post-type-support-check';\nimport { store as editorStore } from '../../store';\n\nfunction PostFormatCheck( { disablePostFormats, ...props } ) {\n\treturn (\n\t\t! disablePostFormats && (\n\t\t\t<PostTypeSupportCheck { ...props } supportKeys=\"post-formats\" />\n\t\t)\n\t);\n}\n\nexport default withSelect( ( select ) => {\n\tconst editorSettings = select( editorStore ).getEditorSettings();\n\treturn {\n\t\tdisablePostFormats: editorSettings.disablePostFormats,\n\t};\n} )( PostFormatCheck );\n"]}
|
|
@@ -5,8 +5,8 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.default = PostFormat;
|
|
9
8
|
exports.POST_FORMATS = void 0;
|
|
9
|
+
exports.default = PostFormat;
|
|
10
10
|
|
|
11
11
|
var _element = require("@wordpress/element");
|
|
12
12
|
|
|
@@ -23,11 +23,13 @@ var _store = require("../../store");
|
|
|
23
23
|
/**
|
|
24
24
|
* Internal dependencies
|
|
25
25
|
*/
|
|
26
|
-
function PostLastRevisionCheck({
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
function PostLastRevisionCheck(_ref) {
|
|
27
|
+
let {
|
|
28
|
+
lastRevisionId,
|
|
29
|
+
revisionsCount,
|
|
30
|
+
children
|
|
31
|
+
} = _ref;
|
|
32
|
+
|
|
31
33
|
if (!lastRevisionId || revisionsCount < 2) {
|
|
32
34
|
return null;
|
|
33
35
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/components/post-last-revision/check.js"],"names":["PostLastRevisionCheck","lastRevisionId","revisionsCount","children","select","getCurrentPostLastRevisionId","getCurrentPostRevisionsCount","editorStore"],"mappings":";;;;;;;;;;;;AAGA;;AAKA;;AACA;;AATA;AACA;AACA;;AAGA;AACA;AACA;AAIO,SAASA,qBAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/components/post-last-revision/check.js"],"names":["PostLastRevisionCheck","lastRevisionId","revisionsCount","children","select","getCurrentPostLastRevisionId","getCurrentPostRevisionsCount","editorStore"],"mappings":";;;;;;;;;;;;AAGA;;AAKA;;AACA;;AATA;AACA;AACA;;AAGA;AACA;AACA;AAIO,SAASA,qBAAT,OAIH;AAAA,MAJmC;AACtCC,IAAAA,cADsC;AAEtCC,IAAAA,cAFsC;AAGtCC,IAAAA;AAHsC,GAInC;;AACH,MAAK,CAAEF,cAAF,IAAoBC,cAAc,GAAG,CAA1C,EAA8C;AAC7C,WAAO,IAAP;AACA;;AAED,SACC,4BAAC,6BAAD;AAAsB,IAAA,WAAW,EAAC;AAAlC,KACGC,QADH,CADD;AAKA;;eAEc,sBAAcC,MAAF,IAAc;AACxC,QAAM;AACLC,IAAAA,4BADK;AAELC,IAAAA;AAFK,MAGFF,MAAM,CAAEG,YAAF,CAHV;AAIA,SAAO;AACNN,IAAAA,cAAc,EAAEI,4BAA4B,EADtC;AAENH,IAAAA,cAAc,EAAEI,4BAA4B;AAFtC,GAAP;AAIA,CATc,EASVN,qBATU,C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { withSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport PostTypeSupportCheck from '../post-type-support-check';\nimport { store as editorStore } from '../../store';\n\nexport function PostLastRevisionCheck( {\n\tlastRevisionId,\n\trevisionsCount,\n\tchildren,\n} ) {\n\tif ( ! lastRevisionId || revisionsCount < 2 ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PostTypeSupportCheck supportKeys=\"revisions\">\n\t\t\t{ children }\n\t\t</PostTypeSupportCheck>\n\t);\n}\n\nexport default withSelect( ( select ) => {\n\tconst {\n\t\tgetCurrentPostLastRevisionId,\n\t\tgetCurrentPostRevisionsCount,\n\t} = select( editorStore );\n\treturn {\n\t\tlastRevisionId: getCurrentPostLastRevisionId(),\n\t\trevisionsCount: getCurrentPostRevisionsCount(),\n\t};\n} )( PostLastRevisionCheck );\n"]}
|
|
@@ -30,10 +30,11 @@ var _store = require("../../store");
|
|
|
30
30
|
/**
|
|
31
31
|
* Internal dependencies
|
|
32
32
|
*/
|
|
33
|
-
function LastRevision({
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
function LastRevision(_ref) {
|
|
34
|
+
let {
|
|
35
|
+
lastRevisionId,
|
|
36
|
+
revisionsCount
|
|
37
|
+
} = _ref;
|
|
37
38
|
return (0, _element.createElement)(_check.default, null, (0, _element.createElement)(_components.Button, {
|
|
38
39
|
href: (0, _url.getWPAdminURL)('revision.php', {
|
|
39
40
|
revision: lastRevisionId,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/components/post-last-revision/index.js"],"names":["LastRevision","lastRevisionId","revisionsCount","revision","gutenberg","backup","select","getCurrentPostLastRevisionId","getCurrentPostRevisionsCount","editorStore"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AAbA;AACA;AACA;;AAMA;AACA;AACA;AAKA,SAASA,YAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/components/post-last-revision/index.js"],"names":["LastRevision","lastRevisionId","revisionsCount","revision","gutenberg","backup","select","getCurrentPostLastRevisionId","getCurrentPostRevisionsCount","editorStore"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AAbA;AACA;AACA;;AAMA;AACA;AACA;AAKA,SAASA,YAAT,OAA4D;AAAA,MAArC;AAAEC,IAAAA,cAAF;AAAkBC,IAAAA;AAAlB,GAAqC;AAC3D,SACC,4BAAC,cAAD,QACC,4BAAC,kBAAD;AACC,IAAA,IAAI,EAAG,wBAAe,cAAf,EAA+B;AACrCC,MAAAA,QAAQ,EAAEF,cAD2B;AAErCG,MAAAA,SAAS,EAAE;AAF0B,KAA/B,CADR;AAKC,IAAA,SAAS,EAAC,kCALX;AAMC,IAAA,IAAI,EAAGC;AANR,KAQG;AACD;AACA,gBAAI,aAAJ,EAAmB,cAAnB,EAAmCH,cAAnC,CAFC,EAGDA,cAHC,CARH,CADD,CADD;AAkBA;;eAEc,sBAAcI,MAAF,IAAc;AACxC,QAAM;AACLC,IAAAA,4BADK;AAELC,IAAAA;AAFK,MAGFF,MAAM,CAAEG,YAAF,CAHV;AAIA,SAAO;AACNR,IAAAA,cAAc,EAAEM,4BAA4B,EADtC;AAENL,IAAAA,cAAc,EAAEM,4BAA4B;AAFtC,GAAP;AAIA,CATc,EASVR,YATU,C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { sprintf, _n } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { withSelect } from '@wordpress/data';\nimport { backup } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport PostLastRevisionCheck from './check';\nimport { getWPAdminURL } from '../../utils/url';\nimport { store as editorStore } from '../../store';\n\nfunction LastRevision( { lastRevisionId, revisionsCount } ) {\n\treturn (\n\t\t<PostLastRevisionCheck>\n\t\t\t<Button\n\t\t\t\thref={ getWPAdminURL( 'revision.php', {\n\t\t\t\t\trevision: lastRevisionId,\n\t\t\t\t\tgutenberg: true,\n\t\t\t\t} ) }\n\t\t\t\tclassName=\"editor-post-last-revision__title\"\n\t\t\t\ticon={ backup }\n\t\t\t>\n\t\t\t\t{ sprintf(\n\t\t\t\t\t/* translators: %d: number of revisions */\n\t\t\t\t\t_n( '%d Revision', '%d Revisions', revisionsCount ),\n\t\t\t\t\trevisionsCount\n\t\t\t\t) }\n\t\t\t</Button>\n\t\t</PostLastRevisionCheck>\n\t);\n}\n\nexport default withSelect( ( select ) => {\n\tconst {\n\t\tgetCurrentPostLastRevisionId,\n\t\tgetCurrentPostRevisionsCount,\n\t} = select( editorStore );\n\treturn {\n\t\tlastRevisionId: getCurrentPostLastRevisionId(),\n\t\trevisionsCount: getCurrentPostRevisionsCount(),\n\t};\n} )( LastRevision );\n"]}
|
|
@@ -25,11 +25,13 @@ var _store = require("../../store");
|
|
|
25
25
|
/**
|
|
26
26
|
* Internal dependencies
|
|
27
27
|
*/
|
|
28
|
-
function PostPendingStatusCheck({
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
function PostPendingStatusCheck(_ref) {
|
|
29
|
+
let {
|
|
30
|
+
hasPublishAction,
|
|
31
|
+
isPublished,
|
|
32
|
+
children
|
|
33
|
+
} = _ref;
|
|
34
|
+
|
|
33
35
|
if (isPublished || !hasPublishAction) {
|
|
34
36
|
return null;
|
|
35
37
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/components/post-pending-status/check.js"],"names":["PostPendingStatusCheck","hasPublishAction","isPublished","children","select","isCurrentPostPublished","getCurrentPostType","getCurrentPost","editorStore","postType"],"mappings":";;;;;;;;AAGA;;AAKA;;AACA;;AAKA;;AAdA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;AAGO,SAASA,sBAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/components/post-pending-status/check.js"],"names":["PostPendingStatusCheck","hasPublishAction","isPublished","children","select","isCurrentPostPublished","getCurrentPostType","getCurrentPost","editorStore","postType"],"mappings":";;;;;;;;AAGA;;AAKA;;AACA;;AAKA;;AAdA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;AAGO,SAASA,sBAAT,OAIH;AAAA,MAJoC;AACvCC,IAAAA,gBADuC;AAEvCC,IAAAA,WAFuC;AAGvCC,IAAAA;AAHuC,GAIpC;;AACH,MAAKD,WAAW,IAAI,CAAED,gBAAtB,EAAyC;AACxC,WAAO,IAAP;AACA;;AAED,SAAOE,QAAP;AACA;;eAEc,sBACd,sBAAcC,MAAF,IAAc;AACzB,QAAM;AACLC,IAAAA,sBADK;AAELC,IAAAA,kBAFK;AAGLC,IAAAA;AAHK,MAIFH,MAAM,CAAEI,YAAF,CAJV;AAKA,SAAO;AACNP,IAAAA,gBAAgB,EAAE,iBACjBM,cAAc,EADG,EAEjB,CAAE,QAAF,EAAY,mBAAZ,CAFiB,EAGjB,KAHiB,CADZ;AAMNL,IAAAA,WAAW,EAAEG,sBAAsB,EAN7B;AAONI,IAAAA,QAAQ,EAAEH,kBAAkB;AAPtB,GAAP;AASA,CAfD,CADc,EAiBZN,sBAjBY,C","sourcesContent":["/**\n * External dependencies\n */\nimport { get } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { compose } from '@wordpress/compose';\nimport { withSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport function PostPendingStatusCheck( {\n\thasPublishAction,\n\tisPublished,\n\tchildren,\n} ) {\n\tif ( isPublished || ! hasPublishAction ) {\n\t\treturn null;\n\t}\n\n\treturn children;\n}\n\nexport default compose(\n\twithSelect( ( select ) => {\n\t\tconst {\n\t\t\tisCurrentPostPublished,\n\t\t\tgetCurrentPostType,\n\t\t\tgetCurrentPost,\n\t\t} = select( editorStore );\n\t\treturn {\n\t\t\thasPublishAction: get(\n\t\t\t\tgetCurrentPost(),\n\t\t\t\t[ '_links', 'wp:action-publish' ],\n\t\t\t\tfalse\n\t\t\t),\n\t\t\tisPublished: isCurrentPostPublished(),\n\t\t\tpostType: getCurrentPostType(),\n\t\t};\n\t} )\n)( PostPendingStatusCheck );\n"]}
|
|
@@ -29,10 +29,12 @@ var _store = require("../../store");
|
|
|
29
29
|
/**
|
|
30
30
|
* Internal dependencies
|
|
31
31
|
*/
|
|
32
|
-
function PostPendingStatus({
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
function PostPendingStatus(_ref) {
|
|
33
|
+
let {
|
|
34
|
+
status,
|
|
35
|
+
onUpdateStatus
|
|
36
|
+
} = _ref;
|
|
37
|
+
|
|
36
38
|
const togglePendingStatus = () => {
|
|
37
39
|
const updatedStatus = status === 'pending' ? 'draft' : 'pending';
|
|
38
40
|
onUpdateStatus(updatedStatus);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/components/post-pending-status/index.js"],"names":["PostPendingStatus","status","onUpdateStatus","togglePendingStatus","updatedStatus","select","editorStore","getEditedPostAttribute","dispatch","editPost"],"mappings":";;;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAZA;AACA;AACA;;AAMA;AACA;AACA;AAIO,SAASA,iBAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/components/post-pending-status/index.js"],"names":["PostPendingStatus","status","onUpdateStatus","togglePendingStatus","updatedStatus","select","editorStore","getEditedPostAttribute","dispatch","editPost"],"mappings":";;;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAZA;AACA;AACA;;AAMA;AACA;AACA;AAIO,SAASA,iBAAT,OAAyD;AAAA,MAA7B;AAAEC,IAAAA,MAAF;AAAUC,IAAAA;AAAV,GAA6B;;AAC/D,QAAMC,mBAAmB,GAAG,MAAM;AACjC,UAAMC,aAAa,GAAGH,MAAM,KAAK,SAAX,GAAuB,OAAvB,GAAiC,SAAvD;AACAC,IAAAA,cAAc,CAAEE,aAAF,CAAd;AACA,GAHD;;AAKA,SACC,4BAAC,cAAD,QACC,4BAAC,2BAAD;AACC,IAAA,KAAK,EAAG,cAAI,gBAAJ,CADT;AAEC,IAAA,OAAO,EAAGH,MAAM,KAAK,SAFtB;AAGC,IAAA,QAAQ,EAAGE;AAHZ,IADD,CADD;AASA;;eAEc,sBACd,sBAAcE,MAAF,KAAgB;AAC3BJ,EAAAA,MAAM,EAAEI,MAAM,CAAEC,YAAF,CAAN,CAAsBC,sBAAtB,CAA8C,QAA9C;AADmB,CAAhB,CAAZ,CADc,EAId,wBAAgBC,QAAF,KAAkB;AAC/BN,EAAAA,cAAc,CAAED,MAAF,EAAW;AACxBO,IAAAA,QAAQ,CAAEF,YAAF,CAAR,CAAwBG,QAAxB,CAAkC;AAAER,MAAAA;AAAF,KAAlC;AACA;;AAH8B,CAAlB,CAAd,CAJc,EASZD,iBATY,C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { CheckboxControl } from '@wordpress/components';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport PostPendingStatusCheck from './check';\nimport { store as editorStore } from '../../store';\n\nexport function PostPendingStatus( { status, onUpdateStatus } ) {\n\tconst togglePendingStatus = () => {\n\t\tconst updatedStatus = status === 'pending' ? 'draft' : 'pending';\n\t\tonUpdateStatus( updatedStatus );\n\t};\n\n\treturn (\n\t\t<PostPendingStatusCheck>\n\t\t\t<CheckboxControl\n\t\t\t\tlabel={ __( 'Pending review' ) }\n\t\t\t\tchecked={ status === 'pending' }\n\t\t\t\tonChange={ togglePendingStatus }\n\t\t\t/>\n\t\t</PostPendingStatusCheck>\n\t);\n}\n\nexport default compose(\n\twithSelect( ( select ) => ( {\n\t\tstatus: select( editorStore ).getEditedPostAttribute( 'status' ),\n\t} ) ),\n\twithDispatch( ( dispatch ) => ( {\n\t\tonUpdateStatus( status ) {\n\t\t\tdispatch( editorStore ).editPost( { status } );\n\t\t},\n\t} ) )\n)( PostPendingStatus );\n"]}
|
|
@@ -24,10 +24,12 @@ var _store = require("../../store");
|
|
|
24
24
|
/**
|
|
25
25
|
* Internal dependencies
|
|
26
26
|
*/
|
|
27
|
-
function PostPingbacks({
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
function PostPingbacks(_ref) {
|
|
28
|
+
let {
|
|
29
|
+
pingStatus = 'open',
|
|
30
|
+
...props
|
|
31
|
+
} = _ref;
|
|
32
|
+
|
|
31
33
|
const onTogglePingback = () => props.editPost({
|
|
32
34
|
ping_status: pingStatus === 'open' ? 'closed' : 'open'
|
|
33
35
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/components/post-pingbacks/index.js"],"names":["PostPingbacks","pingStatus","props","onTogglePingback","editPost","ping_status","select","editorStore","getEditedPostAttribute","dispatch"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AAKA;;AAXA;AACA;AACA;;AAMA;AACA;AACA;AAGA,SAASA,aAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/components/post-pingbacks/index.js"],"names":["PostPingbacks","pingStatus","props","onTogglePingback","editPost","ping_status","select","editorStore","getEditedPostAttribute","dispatch"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AAKA;;AAXA;AACA;AACA;;AAMA;AACA;AACA;AAGA,SAASA,aAAT,OAA4D;AAAA,MAApC;AAAEC,IAAAA,UAAU,GAAG,MAAf;AAAuB,OAAGC;AAA1B,GAAoC;;AAC3D,QAAMC,gBAAgB,GAAG,MACxBD,KAAK,CAACE,QAAN,CAAgB;AACfC,IAAAA,WAAW,EAAEJ,UAAU,KAAK,MAAf,GAAwB,QAAxB,GAAmC;AADjC,GAAhB,CADD;;AAKA,SACC,4BAAC,2BAAD;AACC,IAAA,KAAK,EAAG,cAAI,8BAAJ,CADT;AAEC,IAAA,OAAO,EAAGA,UAAU,KAAK,MAF1B;AAGC,IAAA,QAAQ,EAAGE;AAHZ,IADD;AAOA;;eAEc,sBAAS,CACvB,sBAAcG,MAAF,IAAc;AACzB,SAAO;AACNL,IAAAA,UAAU,EAAEK,MAAM,CAAEC,YAAF,CAAN,CAAsBC,sBAAtB,CACX,aADW;AADN,GAAP;AAKA,CAND,CADuB,EAQvB,wBAAgBC,QAAF,KAAkB;AAC/BL,EAAAA,QAAQ,EAAEK,QAAQ,CAAEF,YAAF,CAAR,CAAwBH;AADH,CAAlB,CAAd,CARuB,CAAT,EAWVJ,aAXU,C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { CheckboxControl } from '@wordpress/components';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nfunction PostPingbacks( { pingStatus = 'open', ...props } ) {\n\tconst onTogglePingback = () =>\n\t\tprops.editPost( {\n\t\t\tping_status: pingStatus === 'open' ? 'closed' : 'open',\n\t\t} );\n\n\treturn (\n\t\t<CheckboxControl\n\t\t\tlabel={ __( 'Allow pingbacks & trackbacks' ) }\n\t\t\tchecked={ pingStatus === 'open' }\n\t\t\tonChange={ onTogglePingback }\n\t\t/>\n\t);\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\treturn {\n\t\t\tpingStatus: select( editorStore ).getEditedPostAttribute(\n\t\t\t\t'ping_status'\n\t\t\t),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => ( {\n\t\teditPost: dispatch( editorStore ).editPost,\n\t} ) ),\n] )( PostPingbacks );\n"]}
|
|
@@ -242,10 +242,11 @@ class PostPreviewButton extends _element.Component {
|
|
|
242
242
|
|
|
243
243
|
exports.PostPreviewButton = PostPreviewButton;
|
|
244
244
|
|
|
245
|
-
var _default = (0, _compose.compose)([(0, _data.withSelect)((select, {
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
245
|
+
var _default = (0, _compose.compose)([(0, _data.withSelect)((select, _ref) => {
|
|
246
|
+
let {
|
|
247
|
+
forcePreviewLink,
|
|
248
|
+
forceIsAutosaveable
|
|
249
|
+
} = _ref;
|
|
249
250
|
const {
|
|
250
251
|
getCurrentPostId,
|
|
251
252
|
getCurrentPostAttribute,
|
|
@@ -273,9 +274,12 @@ var _default = (0, _compose.compose)([(0, _data.withSelect)((select, {
|
|
|
273
274
|
}), (0, _data.withDispatch)(dispatch => ({
|
|
274
275
|
autosave: dispatch(_store.store).autosave,
|
|
275
276
|
savePost: dispatch(_store.store).savePost
|
|
276
|
-
})), (0, _compose.ifCondition)(
|
|
277
|
-
|
|
278
|
-
|
|
277
|
+
})), (0, _compose.ifCondition)(_ref2 => {
|
|
278
|
+
let {
|
|
279
|
+
isViewable
|
|
280
|
+
} = _ref2;
|
|
281
|
+
return isViewable;
|
|
282
|
+
})])(PostPreviewButton);
|
|
279
283
|
|
|
280
284
|
exports.default = _default;
|
|
281
285
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/components/post-preview-button/index.js"],"names":["writeInterstitialMessage","targetDocument","markup","write","title","close","PostPreviewButton","Component","constructor","arguments","buttonRef","openPreviewWindow","bind","componentDidUpdate","prevProps","previewLink","props","setPreviewWindowLink","url","previewWindow","closed","location","current","focus","getWindowTarget","postId","event","preventDefault","window","open","isAutosaveable","isPostLocked","target","href","isDraft","savePost","isPreview","autosave","document","render","currentPostLink","isSaveable","role","classNames","className","undefined","textContent","select","forcePreviewLink","forceIsAutosaveable","getCurrentPostId","getCurrentPostAttribute","getEditedPostAttribute","isEditedPostSaveable","isEditedPostAutosaveable","getEditedPostPreviewLink","editorStore","getPostType","coreStore","postType","isViewable","indexOf","dispatch"],"mappings":";;;;;;;;;AASA;;AANA;;AACA;;AAMA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AApBA;AACA;AACA;;AAIA;AACA;AACA;;AASA;AACA;AACA;AAGA,SAASA,wBAAT,CAAmCC,cAAnC,EAAoD;AACnD,MAAIC,MAAM,GAAG,6BACZ;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,4BAAC,eAAD;AAAK,IAAA,KAAK,EAAC,4BAAX;AAAwC,IAAA,OAAO,EAAC;AAAhD,KACC,4BAAC,gBAAD;AACC,IAAA,SAAS,EAAC,OADX;AAEC,IAAA,CAAC,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AOLxB,IAAAA;AAPK,MAQFgB,MAAM,CAAES,YAAF,CARV;AASA,QAAM;AAAEC,IAAAA;AAAF,MAAkBV,MAAM,CAAEW,eAAF,CAA9B;AAEA,QAAM3C,WAAW,GAAGwC,wBAAwB,EAA5C;AACA,QAAMI,QAAQ,GAAGF,WAAW,CAAEL,sBAAsB,CAAE,MAAF,CAAxB,CAA5B;AAEA,SAAO;AACN3B,IAAAA,MAAM,EAAEyB,gBAAgB,EADlB;AAENV,IAAAA,eAAe,EAAEW,uBAAuB,CAAE,MAAF,CAFlC;AAGNpC,IAAAA,WAAW,EACViC,gBAAgB,KAAKH,SAArB,GAAiCG,gBAAjC,GAAoDjC,WAJ/C;AAKN0B,IAAAA,UAAU,EAAEY,oBAAoB,EAL1B;AAMNvB,IAAAA,cAAc,EAAEmB,mBAAmB,IAAIK,wBAAwB,EANzD;AAONM,IAAAA,UAAU,EAAE,iBAAKD,QAAL,EAAe,CAAE,UAAF,CAAf,EAA+B,KAA/B,CAPN;AAQNzB,IAAAA,OAAO,EACN,CAAE,OAAF,EAAW,YAAX,EAA0B2B,OAA1B,CACCT,sBAAsB,CAAE,QAAF,CADvB,MAEM,CAAC,CAXF;AAYNrB,IAAAA,YAAY,EAAEA,YAAY;AAZpB,GAAP;AAcA,CA7BD,CADuB,EA+BvB,wBAAgB+B,QAAF,KAAkB;AAC/BzB,EAAAA,QAAQ,EAAEyB,QAAQ,CAAEN,YAAF,CAAR,CAAwBnB,QADH;AAE/BF,EAAAA,QAAQ,EAAE2B,QAAQ,CAAEN,YAAF,CAAR,CAAwBrB;AAFH,CAAlB,CAAd,CA/BuB,EAmCvB,0BAAa,CAAE;AAAEyB,EAAAA;AAAF,CAAF,KAAsBA,UAAnC,CAnCuB,CAAT,EAoCVtD,iBApCU,C","sourcesContent":["/**\n * External dependencies\n */\nimport { get } from 'lodash';\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { Component, createRef, renderToString } from '@wordpress/element';\nimport { Button, Path, SVG, VisuallyHidden } from '@wordpress/components';\nimport { __, _x } from '@wordpress/i18n';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { ifCondition, compose } from '@wordpress/compose';\nimport { applyFilters } from '@wordpress/hooks';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nfunction writeInterstitialMessage( targetDocument ) {\n\tlet markup = renderToString(\n\t\t<div className=\"editor-post-preview-button__interstitial-message\">\n\t\t\t<SVG xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 96 96\">\n\t\t\t\t<Path\n\t\t\t\t\tclassName=\"outer\"\n\t\t\t\t\td=\"M48 12c19.9 0 36 16.1 36 36S67.9 84 48 84 12 67.9 12 48s16.1-36 36-36\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t/>\n\t\t\t\t<Path\n\t\t\t\t\tclassName=\"inner\"\n\t\t\t\t\td=\"M69.5 46.4c0-3.9-1.4-6.7-2.6-8.8-1.6-2.6-3.1-4.9-3.1-7.5 0-2.9 2.2-5.7 5.4-5.7h.4C63.9 19.2 56.4 16 48 16c-11.2 0-21 5.7-26.7 14.4h2.1c3.3 0 8.5-.4 8.5-.4 1.7-.1 1.9 2.4.2 2.6 0 0-1.7.2-3.7.3L40 67.5l7-20.9L42 33c-1.7-.1-3.3-.3-3.3-.3-1.7-.1-1.5-2.7.2-2.6 0 0 5.3.4 8.4.4 3.3 0 8.5-.4 8.5-.4 1.7-.1 1.9 2.4.2 2.6 0 0-1.7.2-3.7.3l11.5 34.3 3.3-10.4c1.6-4.5 2.4-7.8 2.4-10.5zM16.1 48c0 12.6 7.3 23.5 18 28.7L18.8 35c-1.7 4-2.7 8.4-2.7 13zm32.5 2.8L39 78.6c2.9.8 5.9 1.3 9 1.3 3.7 0 7.3-.6 10.6-1.8-.1-.1-.2-.3-.2-.4l-9.8-26.9zM76.2 36c0 3.2-.6 6.9-2.4 11.4L64 75.6c9.5-5.5 15.9-15.8 15.9-27.6 0-5.5-1.4-10.8-3.9-15.3.1 1 .2 2.1.2 3.3z\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t/>\n\t\t\t</SVG>\n\t\t\t<p>{ __( 'Generating preview…' ) }</p>\n\t\t</div>\n\t);\n\n\tmarkup += `\n\t\t<style>\n\t\t\tbody {\n\t\t\t\tmargin: 0;\n\t\t\t}\n\t\t\t.editor-post-preview-button__interstitial-message {\n\t\t\t\tdisplay: flex;\n\t\t\t\tflex-direction: column;\n\t\t\t\talign-items: center;\n\t\t\t\tjustify-content: center;\n\t\t\t\theight: 100vh;\n\t\t\t\twidth: 100vw;\n\t\t\t}\n\t\t\t@-webkit-keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t@-moz-keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t@-o-keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t@keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t.editor-post-preview-button__interstitial-message svg {\n\t\t\t\twidth: 192px;\n\t\t\t\theight: 192px;\n\t\t\t\tstroke: #555d66;\n\t\t\t\tstroke-width: 0.75;\n\t\t\t}\n\t\t\t.editor-post-preview-button__interstitial-message svg .outer,\n\t\t\t.editor-post-preview-button__interstitial-message svg .inner {\n\t\t\t\tstroke-dasharray: 280;\n\t\t\t\tstroke-dashoffset: 280;\n\t\t\t\t-webkit-animation: paint 1.5s ease infinite alternate;\n\t\t\t\t-moz-animation: paint 1.5s ease infinite alternate;\n\t\t\t\t-o-animation: paint 1.5s ease infinite alternate;\n\t\t\t\tanimation: paint 1.5s ease infinite alternate;\n\t\t\t}\n\t\t\tp {\n\t\t\t\ttext-align: center;\n\t\t\t\tfont-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Oxygen-Sans, Ubuntu, Cantarell, \"Helvetica Neue\", sans-serif;\n\t\t\t}\n\t\t</style>\n\t`;\n\n\t/**\n\t * Filters the interstitial message shown when generating previews.\n\t *\n\t * @param {string} markup The preview interstitial markup.\n\t */\n\tmarkup = applyFilters( 'editor.PostPreview.interstitialMarkup', markup );\n\n\ttargetDocument.write( markup );\n\ttargetDocument.title = __( 'Generating preview…' );\n\ttargetDocument.close();\n}\n\nexport class PostPreviewButton extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\n\t\tthis.buttonRef = createRef();\n\n\t\tthis.openPreviewWindow = this.openPreviewWindow.bind( this );\n\t}\n\n\tcomponentDidUpdate( prevProps ) {\n\t\tconst { previewLink } = this.props;\n\t\t// This relies on the window being responsible to unset itself when\n\t\t// navigation occurs or a new preview window is opened, to avoid\n\t\t// unintentional forceful redirects.\n\t\tif ( previewLink && ! prevProps.previewLink ) {\n\t\t\tthis.setPreviewWindowLink( previewLink );\n\t\t}\n\t}\n\n\t/**\n\t * Sets the preview window's location to the given URL, if a preview window\n\t * exists and is not closed.\n\t *\n\t * @param {string} url URL to assign as preview window location.\n\t */\n\tsetPreviewWindowLink( url ) {\n\t\tconst { previewWindow } = this;\n\n\t\tif ( previewWindow && ! previewWindow.closed ) {\n\t\t\tpreviewWindow.location = url;\n\t\t\tif ( this.buttonRef.current ) {\n\t\t\t\tthis.buttonRef.current.focus();\n\t\t\t}\n\t\t}\n\t}\n\n\tgetWindowTarget() {\n\t\tconst { postId } = this.props;\n\t\treturn `wp-preview-${ postId }`;\n\t}\n\n\topenPreviewWindow( event ) {\n\t\t// Our Preview button has its 'href' and 'target' set correctly for a11y\n\t\t// purposes. Unfortunately, though, we can't rely on the default 'click'\n\t\t// handler since sometimes it incorrectly opens a new tab instead of reusing\n\t\t// the existing one.\n\t\t// https://github.com/WordPress/gutenberg/pull/8330\n\t\tevent.preventDefault();\n\n\t\t// Open up a Preview tab if needed. This is where we'll show the preview.\n\t\tif ( ! this.previewWindow || this.previewWindow.closed ) {\n\t\t\tthis.previewWindow = window.open( '', this.getWindowTarget() );\n\t\t}\n\n\t\t// Focus the Preview tab. This might not do anything, depending on the browser's\n\t\t// and user's preferences.\n\t\t// https://html.spec.whatwg.org/multipage/interaction.html#dom-window-focus\n\t\tthis.previewWindow.focus();\n\n\t\tif (\n\t\t\t// If we don't need to autosave the post before previewing, then we simply\n\t\t\t// load the Preview URL in the Preview tab.\n\t\t\t! this.props.isAutosaveable ||\n\t\t\t// Do not save or overwrite the post, if the post is already locked.\n\t\t\tthis.props.isPostLocked\n\t\t) {\n\t\t\tthis.setPreviewWindowLink( event.target.href );\n\t\t\treturn;\n\t\t}\n\n\t\t// Request an autosave. This happens asynchronously and causes the component\n\t\t// to update when finished.\n\t\tif ( this.props.isDraft ) {\n\t\t\tthis.props.savePost( { isPreview: true } );\n\t\t} else {\n\t\t\tthis.props.autosave( { isPreview: true } );\n\t\t}\n\n\t\t// Display a 'Generating preview' message in the Preview tab while we wait for the\n\t\t// autosave to finish.\n\t\twriteInterstitialMessage( this.previewWindow.document );\n\t}\n\n\trender() {\n\t\tconst { previewLink, currentPostLink, isSaveable, role } = this.props;\n\n\t\t// Link to the `?preview=true` URL if we have it, since this lets us see\n\t\t// changes that were autosaved since the post was last published. Otherwise,\n\t\t// just link to the post's URL.\n\t\tconst href = previewLink || currentPostLink;\n\n\t\tconst classNames = classnames(\n\t\t\t{\n\t\t\t\t'editor-post-preview': ! this.props.className,\n\t\t\t},\n\t\t\tthis.props.className\n\t\t);\n\n\t\treturn (\n\t\t\t<Button\n\t\t\t\tvariant={ ! this.props.className ? 'tertiary' : undefined }\n\t\t\t\tclassName={ classNames }\n\t\t\t\thref={ href }\n\t\t\t\ttarget={ this.getWindowTarget() }\n\t\t\t\tdisabled={ ! isSaveable }\n\t\t\t\tonClick={ this.openPreviewWindow }\n\t\t\t\tref={ this.buttonRef }\n\t\t\t\trole={ role }\n\t\t\t>\n\t\t\t\t{ this.props.textContent ? (\n\t\t\t\t\tthis.props.textContent\n\t\t\t\t) : (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ _x( 'Preview', 'imperative verb' ) }\n\t\t\t\t\t\t<VisuallyHidden as=\"span\">\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t/* translators: accessibility text */\n\t\t\t\t\t\t\t\t__( '(opens in a new tab)' )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</Button>\n\t\t);\n\t}\n}\n\nexport default compose( [\n\twithSelect( ( select, { forcePreviewLink, forceIsAutosaveable } ) => {\n\t\tconst {\n\t\t\tgetCurrentPostId,\n\t\t\tgetCurrentPostAttribute,\n\t\t\tgetEditedPostAttribute,\n\t\t\tisEditedPostSaveable,\n\t\t\tisEditedPostAutosaveable,\n\t\t\tgetEditedPostPreviewLink,\n\t\t\tisPostLocked,\n\t\t} = select( editorStore );\n\t\tconst { getPostType } = select( coreStore );\n\n\t\tconst previewLink = getEditedPostPreviewLink();\n\t\tconst postType = getPostType( getEditedPostAttribute( 'type' ) );\n\n\t\treturn {\n\t\t\tpostId: getCurrentPostId(),\n\t\t\tcurrentPostLink: getCurrentPostAttribute( 'link' ),\n\t\t\tpreviewLink:\n\t\t\t\tforcePreviewLink !== undefined ? forcePreviewLink : previewLink,\n\t\t\tisSaveable: isEditedPostSaveable(),\n\t\t\tisAutosaveable: forceIsAutosaveable || isEditedPostAutosaveable(),\n\t\t\tisViewable: get( postType, [ 'viewable' ], false ),\n\t\t\tisDraft:\n\t\t\t\t[ 'draft', 'auto-draft' ].indexOf(\n\t\t\t\t\tgetEditedPostAttribute( 'status' )\n\t\t\t\t) !== -1,\n\t\t\tisPostLocked: isPostLocked(),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => ( {\n\t\tautosave: dispatch( editorStore ).autosave,\n\t\tsavePost: dispatch( editorStore ).savePost,\n\t} ) ),\n\tifCondition( ( { isViewable } ) => isViewable ),\n] )( PostPreviewButton );\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/components/post-preview-button/index.js"],"names":["writeInterstitialMessage","targetDocument","markup","write","title","close","PostPreviewButton","Component","constructor","arguments","buttonRef","openPreviewWindow","bind","componentDidUpdate","prevProps","previewLink","props","setPreviewWindowLink","url","previewWindow","closed","location","current","focus","getWindowTarget","postId","event","preventDefault","window","open","isAutosaveable","isPostLocked","target","href","isDraft","savePost","isPreview","autosave","document","render","currentPostLink","isSaveable","role","classNames","className","undefined","textContent","select","forcePreviewLink","forceIsAutosaveable","getCurrentPostId","getCurrentPostAttribute","getEditedPostAttribute","isEditedPostSaveable","isEditedPostAutosaveable","getEditedPostPreviewLink","editorStore","getPostType","coreStore","postType","isViewable","indexOf","dispatch"],"mappings":";;;;;;;;;AASA;;AANA;;AACA;;AAMA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AApBA;AACA;AACA;;AAIA;AACA;AACA;;AASA;AACA;AACA;AAGA,SAASA,wBAAT,CAAmCC,cAAnC,EAAoD;AACnD,MAAIC,MAAM,GAAG,6BACZ;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,4BAAC,eAAD;AAAK,IAAA,KAAK,EAAC,4BAAX;AAAwC,IAAA,OAAO,EAAC;AAAhD,KACC,4BAAC,gBAAD;AACC,IAAA,SAAS,EAAC,OADX;AAEC,IAAA,CAAC,EAAC,uEAFH;AAGC,IAAA,IAAI,EAAC;AAHN,IADD,EAMC,4BAAC,gBAAD;AACC,IAAA,SAAS,EAAC,OADX;AAEC,IAAA,CAAC,EAAC,0nBAFH;AAGC,IAAA,IAAI,EAAC;AAHN,IAND,CADD,EAaC,uCAAK,cAAI,qBAAJ,CAAL,CAbD,CADY,CAAb;AAkBAA,EAAAA,MAAM,IAAK;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA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V,IAAAA,eAAe,EAAEW,uBAAuB,CAAE,MAAF,CAFlC;AAGNpC,IAAAA,WAAW,EACViC,gBAAgB,KAAKH,SAArB,GAAiCG,gBAAjC,GAAoDjC,WAJ/C;AAKN0B,IAAAA,UAAU,EAAEY,oBAAoB,EAL1B;AAMNvB,IAAAA,cAAc,EAAEmB,mBAAmB,IAAIK,wBAAwB,EANzD;AAONM,IAAAA,UAAU,EAAE,iBAAKD,QAAL,EAAe,CAAE,UAAF,CAAf,EAA+B,KAA/B,CAPN;AAQNzB,IAAAA,OAAO,EACN,CAAE,OAAF,EAAW,YAAX,EAA0B2B,OAA1B,CACCT,sBAAsB,CAAE,QAAF,CADvB,MAEM,CAAC,CAXF;AAYNrB,IAAAA,YAAY,EAAEA,YAAY;AAZpB,GAAP;AAcA,CA7BD,CADuB,EA+BvB,wBAAgB+B,QAAF,KAAkB;AAC/BzB,EAAAA,QAAQ,EAAEyB,QAAQ,CAAEN,YAAF,CAAR,CAAwBnB,QADH;AAE/BF,EAAAA,QAAQ,EAAE2B,QAAQ,CAAEN,YAAF,CAAR,CAAwBrB;AAFH,CAAlB,CAAd,CA/BuB,EAmCvB,0BAAa;AAAA,MAAE;AAAEyB,IAAAA;AAAF,GAAF;AAAA,SAAsBA,UAAtB;AAAA,CAAb,CAnCuB,CAAT,EAoCVtD,iBApCU,C","sourcesContent":["/**\n * External dependencies\n */\nimport { get } from 'lodash';\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { Component, createRef, renderToString } from '@wordpress/element';\nimport { Button, Path, SVG, VisuallyHidden } from '@wordpress/components';\nimport { __, _x } from '@wordpress/i18n';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { ifCondition, compose } from '@wordpress/compose';\nimport { applyFilters } from '@wordpress/hooks';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nfunction writeInterstitialMessage( targetDocument ) {\n\tlet markup = renderToString(\n\t\t<div className=\"editor-post-preview-button__interstitial-message\">\n\t\t\t<SVG xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 96 96\">\n\t\t\t\t<Path\n\t\t\t\t\tclassName=\"outer\"\n\t\t\t\t\td=\"M48 12c19.9 0 36 16.1 36 36S67.9 84 48 84 12 67.9 12 48s16.1-36 36-36\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t/>\n\t\t\t\t<Path\n\t\t\t\t\tclassName=\"inner\"\n\t\t\t\t\td=\"M69.5 46.4c0-3.9-1.4-6.7-2.6-8.8-1.6-2.6-3.1-4.9-3.1-7.5 0-2.9 2.2-5.7 5.4-5.7h.4C63.9 19.2 56.4 16 48 16c-11.2 0-21 5.7-26.7 14.4h2.1c3.3 0 8.5-.4 8.5-.4 1.7-.1 1.9 2.4.2 2.6 0 0-1.7.2-3.7.3L40 67.5l7-20.9L42 33c-1.7-.1-3.3-.3-3.3-.3-1.7-.1-1.5-2.7.2-2.6 0 0 5.3.4 8.4.4 3.3 0 8.5-.4 8.5-.4 1.7-.1 1.9 2.4.2 2.6 0 0-1.7.2-3.7.3l11.5 34.3 3.3-10.4c1.6-4.5 2.4-7.8 2.4-10.5zM16.1 48c0 12.6 7.3 23.5 18 28.7L18.8 35c-1.7 4-2.7 8.4-2.7 13zm32.5 2.8L39 78.6c2.9.8 5.9 1.3 9 1.3 3.7 0 7.3-.6 10.6-1.8-.1-.1-.2-.3-.2-.4l-9.8-26.9zM76.2 36c0 3.2-.6 6.9-2.4 11.4L64 75.6c9.5-5.5 15.9-15.8 15.9-27.6 0-5.5-1.4-10.8-3.9-15.3.1 1 .2 2.1.2 3.3z\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t/>\n\t\t\t</SVG>\n\t\t\t<p>{ __( 'Generating preview…' ) }</p>\n\t\t</div>\n\t);\n\n\tmarkup += `\n\t\t<style>\n\t\t\tbody {\n\t\t\t\tmargin: 0;\n\t\t\t}\n\t\t\t.editor-post-preview-button__interstitial-message {\n\t\t\t\tdisplay: flex;\n\t\t\t\tflex-direction: column;\n\t\t\t\talign-items: center;\n\t\t\t\tjustify-content: center;\n\t\t\t\theight: 100vh;\n\t\t\t\twidth: 100vw;\n\t\t\t}\n\t\t\t@-webkit-keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t@-moz-keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t@-o-keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t@keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t.editor-post-preview-button__interstitial-message svg {\n\t\t\t\twidth: 192px;\n\t\t\t\theight: 192px;\n\t\t\t\tstroke: #555d66;\n\t\t\t\tstroke-width: 0.75;\n\t\t\t}\n\t\t\t.editor-post-preview-button__interstitial-message svg .outer,\n\t\t\t.editor-post-preview-button__interstitial-message svg .inner {\n\t\t\t\tstroke-dasharray: 280;\n\t\t\t\tstroke-dashoffset: 280;\n\t\t\t\t-webkit-animation: paint 1.5s ease infinite alternate;\n\t\t\t\t-moz-animation: paint 1.5s ease infinite alternate;\n\t\t\t\t-o-animation: paint 1.5s ease infinite alternate;\n\t\t\t\tanimation: paint 1.5s ease infinite alternate;\n\t\t\t}\n\t\t\tp {\n\t\t\t\ttext-align: center;\n\t\t\t\tfont-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Oxygen-Sans, Ubuntu, Cantarell, \"Helvetica Neue\", sans-serif;\n\t\t\t}\n\t\t</style>\n\t`;\n\n\t/**\n\t * Filters the interstitial message shown when generating previews.\n\t *\n\t * @param {string} markup The preview interstitial markup.\n\t */\n\tmarkup = applyFilters( 'editor.PostPreview.interstitialMarkup', markup );\n\n\ttargetDocument.write( markup );\n\ttargetDocument.title = __( 'Generating preview…' );\n\ttargetDocument.close();\n}\n\nexport class PostPreviewButton extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\n\t\tthis.buttonRef = createRef();\n\n\t\tthis.openPreviewWindow = this.openPreviewWindow.bind( this );\n\t}\n\n\tcomponentDidUpdate( prevProps ) {\n\t\tconst { previewLink } = this.props;\n\t\t// This relies on the window being responsible to unset itself when\n\t\t// navigation occurs or a new preview window is opened, to avoid\n\t\t// unintentional forceful redirects.\n\t\tif ( previewLink && ! prevProps.previewLink ) {\n\t\t\tthis.setPreviewWindowLink( previewLink );\n\t\t}\n\t}\n\n\t/**\n\t * Sets the preview window's location to the given URL, if a preview window\n\t * exists and is not closed.\n\t *\n\t * @param {string} url URL to assign as preview window location.\n\t */\n\tsetPreviewWindowLink( url ) {\n\t\tconst { previewWindow } = this;\n\n\t\tif ( previewWindow && ! previewWindow.closed ) {\n\t\t\tpreviewWindow.location = url;\n\t\t\tif ( this.buttonRef.current ) {\n\t\t\t\tthis.buttonRef.current.focus();\n\t\t\t}\n\t\t}\n\t}\n\n\tgetWindowTarget() {\n\t\tconst { postId } = this.props;\n\t\treturn `wp-preview-${ postId }`;\n\t}\n\n\topenPreviewWindow( event ) {\n\t\t// Our Preview button has its 'href' and 'target' set correctly for a11y\n\t\t// purposes. Unfortunately, though, we can't rely on the default 'click'\n\t\t// handler since sometimes it incorrectly opens a new tab instead of reusing\n\t\t// the existing one.\n\t\t// https://github.com/WordPress/gutenberg/pull/8330\n\t\tevent.preventDefault();\n\n\t\t// Open up a Preview tab if needed. This is where we'll show the preview.\n\t\tif ( ! this.previewWindow || this.previewWindow.closed ) {\n\t\t\tthis.previewWindow = window.open( '', this.getWindowTarget() );\n\t\t}\n\n\t\t// Focus the Preview tab. This might not do anything, depending on the browser's\n\t\t// and user's preferences.\n\t\t// https://html.spec.whatwg.org/multipage/interaction.html#dom-window-focus\n\t\tthis.previewWindow.focus();\n\n\t\tif (\n\t\t\t// If we don't need to autosave the post before previewing, then we simply\n\t\t\t// load the Preview URL in the Preview tab.\n\t\t\t! this.props.isAutosaveable ||\n\t\t\t// Do not save or overwrite the post, if the post is already locked.\n\t\t\tthis.props.isPostLocked\n\t\t) {\n\t\t\tthis.setPreviewWindowLink( event.target.href );\n\t\t\treturn;\n\t\t}\n\n\t\t// Request an autosave. This happens asynchronously and causes the component\n\t\t// to update when finished.\n\t\tif ( this.props.isDraft ) {\n\t\t\tthis.props.savePost( { isPreview: true } );\n\t\t} else {\n\t\t\tthis.props.autosave( { isPreview: true } );\n\t\t}\n\n\t\t// Display a 'Generating preview' message in the Preview tab while we wait for the\n\t\t// autosave to finish.\n\t\twriteInterstitialMessage( this.previewWindow.document );\n\t}\n\n\trender() {\n\t\tconst { previewLink, currentPostLink, isSaveable, role } = this.props;\n\n\t\t// Link to the `?preview=true` URL if we have it, since this lets us see\n\t\t// changes that were autosaved since the post was last published. Otherwise,\n\t\t// just link to the post's URL.\n\t\tconst href = previewLink || currentPostLink;\n\n\t\tconst classNames = classnames(\n\t\t\t{\n\t\t\t\t'editor-post-preview': ! this.props.className,\n\t\t\t},\n\t\t\tthis.props.className\n\t\t);\n\n\t\treturn (\n\t\t\t<Button\n\t\t\t\tvariant={ ! this.props.className ? 'tertiary' : undefined }\n\t\t\t\tclassName={ classNames }\n\t\t\t\thref={ href }\n\t\t\t\ttarget={ this.getWindowTarget() }\n\t\t\t\tdisabled={ ! isSaveable }\n\t\t\t\tonClick={ this.openPreviewWindow }\n\t\t\t\tref={ this.buttonRef }\n\t\t\t\trole={ role }\n\t\t\t>\n\t\t\t\t{ this.props.textContent ? (\n\t\t\t\t\tthis.props.textContent\n\t\t\t\t) : (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ _x( 'Preview', 'imperative verb' ) }\n\t\t\t\t\t\t<VisuallyHidden as=\"span\">\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t/* translators: accessibility text */\n\t\t\t\t\t\t\t\t__( '(opens in a new tab)' )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</Button>\n\t\t);\n\t}\n}\n\nexport default compose( [\n\twithSelect( ( select, { forcePreviewLink, forceIsAutosaveable } ) => {\n\t\tconst {\n\t\t\tgetCurrentPostId,\n\t\t\tgetCurrentPostAttribute,\n\t\t\tgetEditedPostAttribute,\n\t\t\tisEditedPostSaveable,\n\t\t\tisEditedPostAutosaveable,\n\t\t\tgetEditedPostPreviewLink,\n\t\t\tisPostLocked,\n\t\t} = select( editorStore );\n\t\tconst { getPostType } = select( coreStore );\n\n\t\tconst previewLink = getEditedPostPreviewLink();\n\t\tconst postType = getPostType( getEditedPostAttribute( 'type' ) );\n\n\t\treturn {\n\t\t\tpostId: getCurrentPostId(),\n\t\t\tcurrentPostLink: getCurrentPostAttribute( 'link' ),\n\t\t\tpreviewLink:\n\t\t\t\tforcePreviewLink !== undefined ? forcePreviewLink : previewLink,\n\t\t\tisSaveable: isEditedPostSaveable(),\n\t\t\tisAutosaveable: forceIsAutosaveable || isEditedPostAutosaveable(),\n\t\t\tisViewable: get( postType, [ 'viewable' ], false ),\n\t\t\tisDraft:\n\t\t\t\t[ 'draft', 'auto-draft' ].indexOf(\n\t\t\t\t\tgetEditedPostAttribute( 'status' )\n\t\t\t\t) !== -1,\n\t\t\tisPostLocked: isPostLocked(),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => ( {\n\t\tautosave: dispatch( editorStore ).autosave,\n\t\tsavePost: dispatch( editorStore ).savePost,\n\t} ) ),\n\tifCondition( ( { isViewable } ) => isViewable ),\n] )( PostPreviewButton );\n"]}
|
|
@@ -56,23 +56,31 @@ class PostPublishButton extends _element.Component {
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
createOnClick(callback) {
|
|
59
|
-
|
|
59
|
+
var _this = this;
|
|
60
|
+
|
|
61
|
+
return function () {
|
|
62
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
63
|
+
args[_key] = arguments[_key];
|
|
64
|
+
}
|
|
65
|
+
|
|
60
66
|
const {
|
|
61
67
|
hasNonPostEntityChanges
|
|
62
|
-
} =
|
|
68
|
+
} = _this.props;
|
|
63
69
|
|
|
64
70
|
if (hasNonPostEntityChanges) {
|
|
65
71
|
// The modal for multiple entity saving will open,
|
|
66
72
|
// hold the callback for saving/publishing the post
|
|
67
73
|
// so that we can call it if the post entity is checked.
|
|
68
|
-
|
|
74
|
+
_this.setState({
|
|
69
75
|
entitiesSavedStatesCallback: () => callback(...args)
|
|
70
76
|
}); // Open the save panel by setting its callback.
|
|
71
77
|
// To set a function on the useState hook, we must set it
|
|
72
78
|
// with another function (() => myFunction). Passing the
|
|
73
79
|
// function on its own will cause an error when called.
|
|
74
80
|
|
|
75
|
-
|
|
81
|
+
|
|
82
|
+
_this.props.setEntitiesSavedStatesCallback(() => _this.closeEntitiesSavedStates);
|
|
83
|
+
|
|
76
84
|
return _lodash.noop;
|
|
77
85
|
}
|
|
78
86
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/components/post-publish-button/index.js"],"names":["PostPublishButton","Component","constructor","props","buttonNode","createOnClick","bind","closeEntitiesSavedStates","state","entitiesSavedStatesCallback","componentDidMount","focusOnMount","current","focus","callback","args","hasNonPostEntityChanges","setState","setEntitiesSavedStatesCallback","noop","savedEntities","postType","postId","elt","kind","name","key","render","forceIsDirty","forceIsSaving","hasPublishAction","isBeingScheduled","isOpen","isPostSavingLocked","isPublishable","isPublished","isSaveable","isSaving","isAutoSaving","isToggle","onSave","onStatusChange","onSubmit","onToggle","visibility","isSavingNonPostEntityChanges","isButtonDisabled","isToggleDisabled","publishStatus","onClickButton","onClickToggle","buttonProps","className","isBusy","variant","onClick","toggleProps","toggleChildren","buttonChildren","componentProps","componentChildren","select","isSavingPost","isAutosavingPost","isEditedPostBeingScheduled","getEditedPostVisibility","isCurrentPostPublished","isEditedPostSaveable","isEditedPostPublishable","getCurrentPost","getCurrentPostType","getCurrentPostId","editorStore","_isAutoSaving","dispatch","editPost","savePost","status","undoIgnore"],"mappings":";;;;;;;;;AAUA;;;;AAPA;;AACA;;AAKA;;AAEA;;AACA;;AACA;;AAKA;;AACA;;AAnBA;AACA;AACA;;AAIA;AACA;AACA;;AAOA;AACA;AACA;AAIO,MAAMA,iBAAN,SAAgCC,kBAAhC,CAA0C;AAChDC,EAAAA,WAAW,CAAEC,KAAF,EAAU;AACpB,UAAOA,KAAP;AACA,SAAKC,UAAL,GAAkB,yBAAlB;AAEA,SAAKC,aAAL,GAAqB,KAAKA,aAAL,CAAmBC,IAAnB,CAAyB,IAAzB,CAArB;AACA,SAAKC,wBAAL,GAAgC,KAAKA,wBAAL,CAA8BD,IAA9B,CAC/B,IAD+B,CAAhC;AAIA,SAAKE,KAAL,GAAa;AACZC,MAAAA,2BAA2B,EAAE;AADjB,KAAb;AAGA;;AACDC,EAAAA,iBAAiB,GAAG;AACnB,QAAK,KAAKP,KAAL,CAAWQ,YAAhB,EAA+B;AAC9B,WAAKP,UAAL,CAAgBQ,OAAhB,CAAwBC,KAAxB;AACA;AACD;;AAEDR,EAAAA,aAAa,CAAES,QAAF,EAAa;AACzB,WAAO,CAAE,GAAGC,IAAL,KAAe;AACrB,YAAM;AAAEC,QAAAA;AAAF,UAA8B,KAAKb,KAAzC;;AACA,UAAKa,uBAAL,EAA+B;AAC9B;AACA;AACA;AACA,aAAKC,QAAL,CAAe;AACdR,UAAAA,2BAA2B,EAAE,MAAMK,QAAQ,CAAE,GAAGC,IAAL;AAD7B,SAAf,EAJ8B,CAO9B;AACA;AACA;AACA;;AACA,aAAKZ,KAAL,CAAWe,8BAAX,CACC,MAAM,KAAKX,wBADZ;AAGA,eAAOY,YAAP;AACA;;AAED,aAAOL,QAAQ,CAAE,GAAGC,IAAL,CAAf;AACA,KApBD;AAqBA;;AAEDR,EAAAA,wBAAwB,CAAEa,a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AAgB,EAAE,iBACjBuC,cAAc,EADG,EAEjB,CAAE,QAAF,EAAY,mBAAZ,CAFiB,EAGjB,KAHiB,CATZ;AAcNhD,IAAAA,QAAQ,EAAEiD,kBAAkB,EAdtB;AAeNhD,IAAAA,MAAM,EAAEiD,gBAAgB,EAflB;AAgBNvD,IAAAA,uBAAuB,EAAEA,uBAAuB,EAhB1C;AAiBN6B,IAAAA,4BAA4B,EAAEA,4BAA4B;AAjBpD,GAAP;AAmBA,CApCD,CADuB,EAsCvB,wBAAgB6B,QAAF,IAAgB;AAC7B,QAAM;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,MAAyBF,QAAQ,CAAEF,YAAF,CAAvC;AACA,SAAO;AACN/B,IAAAA,cAAc,EAAIoC,MAAF,IACfF,QAAQ,CAAE;AAAEE,MAAAA;AAAF,KAAF,EAAc;AAAEC,MAAAA,UAAU,EAAE;AAAd,KAAd,CAFH;AAGNtC,IAAAA,MAAM,EAAEoC;AAHF,GAAP;AAKA,CAPD,CAtCuB,CAAT,EA8CV5E,iBA9CU,C","sourcesContent":["/**\n * External dependencies\n */\nimport { noop, get, some } from 'lodash';\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { Button } from '@wordpress/components';\nimport { Component, createRef } from '@wordpress/element';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport PublishButtonLabel from './label';\nimport { store as editorStore } from '../../store';\n\nexport class PostPublishButton extends Component {\n\tconstructor( props ) {\n\t\tsuper( props );\n\t\tthis.buttonNode = createRef();\n\n\t\tthis.createOnClick = this.createOnClick.bind( this );\n\t\tthis.closeEntitiesSavedStates = this.closeEntitiesSavedStates.bind(\n\t\t\tthis\n\t\t);\n\n\t\tthis.state = {\n\t\t\tentitiesSavedStatesCallback: false,\n\t\t};\n\t}\n\tcomponentDidMount() {\n\t\tif ( this.props.focusOnMount ) {\n\t\t\tthis.buttonNode.current.focus();\n\t\t}\n\t}\n\n\tcreateOnClick( callback ) {\n\t\treturn ( ...args ) => {\n\t\t\tconst { hasNonPostEntityChanges } = this.props;\n\t\t\tif ( hasNonPostEntityChanges ) {\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\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\tthis.props.setEntitiesSavedStatesCallback(\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":["PostPublishButton","Component","constructor","props","buttonNode","createOnClick","bind","closeEntitiesSavedStates","state","entitiesSavedStatesCallback","componentDidMount","focusOnMount","current","focus","callback","args","hasNonPostEntityChanges","setState","setEntitiesSavedStatesCallback","noop","savedEntities","postType","postId","elt","kind","name","key","render","forceIsDirty","forceIsSaving","hasPublishAction","isBeingScheduled","isOpen","isPostSavingLocked","isPublishable","isPublished","isSaveable","isSaving","isAutoSaving","isToggle","onSave","onStatusChange","onSubmit","onToggle","visibility","isSavingNonPostEntityChanges","isButtonDisabled","isToggleDisabled","publishStatus","onClickButton","onClickToggle","buttonProps","className","isBusy","variant","onClick","toggleProps","toggleChildren","buttonChildren","componentProps","componentChildren","select","isSavingPost","isAutosavingPost","isEditedPostBeingScheduled","getEditedPostVisibility","isCurrentPostPublished","isEditedPostSaveable","isEditedPostPublishable","getCurrentPost","getCurrentPostType","getCurrentPostId","editorStore","_isAutoSaving","dispatch","editPost","savePost","status","undoIgnore"],"mappings":";;;;;;;;;AAUA;;;;AAPA;;AACA;;AAKA;;AAEA;;AACA;;AACA;;AAKA;;AACA;;AAnBA;AACA;AACA;;AAIA;AACA;AACA;;AAOA;AACA;AACA;AAIO,MAAMA,iBAAN,SAAgCC,kBAAhC,CAA0C;AAChDC,EAAAA,WAAW,CAAEC,KAAF,EAAU;AACpB,UAAOA,KAAP;AACA,SAAKC,UAAL,GAAkB,yBAAlB;AAEA,SAAKC,aAAL,GAAqB,KAAKA,aAAL,CAAmBC,IAAnB,CAAyB,IAAzB,CAArB;AACA,SAAKC,wBAAL,GAAgC,KAAKA,wBAAL,CAA8BD,IAA9B,CAC/B,IAD+B,CAAhC;AAIA,SAAKE,KAAL,GAAa;AACZC,MAAAA,2BAA2B,EAAE;AADjB,KAAb;AAGA;;AACDC,EAAAA,iBAAiB,GAAG;AACnB,QAAK,KAAKP,KAAL,CAAWQ,YAAhB,EAA+B;AAC9B,WAAKP,UAAL,CAAgBQ,OAAhB,CAAwBC,KAAxB;AACA;AACD;;AAEDR,EAAAA,aAAa,CAAES,QAAF,EAAa;AAAA;;AACzB,WAAO,YAAe;AAAA,wCAAVC,IAAU;AAAVA,QAAAA,IAAU;AAAA;;AACrB,YAAM;AAAEC,QAAAA;AAAF,UAA8B,KAAI,CAACb,KAAzC;;AACA,UAAKa,uBAAL,EAA+B;AAC9B;AACA;AACA;AACA,QAAA,KAAI,CAACC,QAAL,CAAe;AACdR,UAAAA,2BAA2B,EAAE,MAAMK,QAAQ,CAAE,GAAGC,IAAL;AAD7B,SAAf,EAJ8B,CAO9B;AACA;AACA;AACA;;;AACA,QAAA,KAAI,CAACZ,KAAL,CAAWe,8BAAX,CACC,MAAM,KAAI,CAACX,wBADZ;;AAGA,eAAOY,YAAP;AACA;;AAED,aAAOL,QAAQ,CA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uB,EAPhC;AAQNjC,IAAAA,WAAW,EAAE+B,sBAAsB,EAR7B;AASNpC,IAAAA,gBAAgB,EAAE,iBACjBuC,cAAc,EADG,EAEjB,CAAE,QAAF,EAAY,mBAAZ,CAFiB,EAGjB,KAHiB,CATZ;AAcNhD,IAAAA,QAAQ,EAAEiD,kBAAkB,EAdtB;AAeNhD,IAAAA,MAAM,EAAEiD,gBAAgB,EAflB;AAgBNvD,IAAAA,uBAAuB,EAAEA,uBAAuB,EAhB1C;AAiBN6B,IAAAA,4BAA4B,EAAEA,4BAA4B;AAjBpD,GAAP;AAmBA,CApCD,CADuB,EAsCvB,wBAAgB6B,QAAF,IAAgB;AAC7B,QAAM;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,MAAyBF,QAAQ,CAAEF,YAAF,CAAvC;AACA,SAAO;AACN/B,IAAAA,cAAc,EAAIoC,MAAF,IACfF,QAAQ,CAAE;AAAEE,MAAAA;AAAF,KAAF,EAAc;AAAEC,MAAAA,UAAU,EAAE;AAAd,KAAd,CAFH;AAGNtC,IAAAA,MAAM,EAAEoC;AAHF,GAAP;AAKA,CAPD,CAtCuB,CAAT,EA8CV5E,iBA9CU,C","sourcesContent":["/**\n * External dependencies\n */\nimport { noop, get, some } from 'lodash';\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { Button } from '@wordpress/components';\nimport { Component, createRef } from '@wordpress/element';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport PublishButtonLabel from './label';\nimport { store as editorStore } from '../../store';\n\nexport class PostPublishButton extends Component {\n\tconstructor( props ) {\n\t\tsuper( props );\n\t\tthis.buttonNode = createRef();\n\n\t\tthis.createOnClick = this.createOnClick.bind( this );\n\t\tthis.closeEntitiesSavedStates = this.closeEntitiesSavedStates.bind(\n\t\t\tthis\n\t\t);\n\n\t\tthis.state = {\n\t\t\tentitiesSavedStatesCallback: false,\n\t\t};\n\t}\n\tcomponentDidMount() {\n\t\tif ( this.props.focusOnMount ) {\n\t\t\tthis.buttonNode.current.focus();\n\t\t}\n\t}\n\n\tcreateOnClick( callback ) {\n\t\treturn ( ...args ) => {\n\t\t\tconst { hasNonPostEntityChanges } = this.props;\n\t\t\tif ( hasNonPostEntityChanges ) {\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\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\tthis.props.setEntitiesSavedStatesCallback(\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"]}
|
|
@@ -27,15 +27,17 @@ var _store = require("../../store");
|
|
|
27
27
|
/**
|
|
28
28
|
* Internal dependencies
|
|
29
29
|
*/
|
|
30
|
-
function PublishButtonLabel({
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
30
|
+
function PublishButtonLabel(_ref) {
|
|
31
|
+
let {
|
|
32
|
+
isPublished,
|
|
33
|
+
isBeingScheduled,
|
|
34
|
+
isSaving,
|
|
35
|
+
isPublishing,
|
|
36
|
+
hasPublishAction,
|
|
37
|
+
isAutosaving,
|
|
38
|
+
hasNonPostEntityChanges
|
|
39
|
+
} = _ref;
|
|
40
|
+
|
|
39
41
|
if (isPublishing) {
|
|
40
42
|
/* translators: button label text should, if possible, be under 16 characters. */
|
|
41
43
|
return (0, _i18n.__)('Publishing…');
|
|
@@ -58,9 +60,10 @@ function PublishButtonLabel({
|
|
|
58
60
|
return (0, _i18n.__)('Publish');
|
|
59
61
|
}
|
|
60
62
|
|
|
61
|
-
var _default = (0, _compose.compose)([(0, _data.withSelect)((select, {
|
|
62
|
-
|
|
63
|
-
|
|
63
|
+
var _default = (0, _compose.compose)([(0, _data.withSelect)((select, _ref2) => {
|
|
64
|
+
let {
|
|
65
|
+
forceIsSaving
|
|
66
|
+
} = _ref2;
|
|
64
67
|
const {
|
|
65
68
|
isCurrentPostPublished,
|
|
66
69
|
isEditedPostBeingScheduled,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/components/post-publish-button/label.js"],"names":["PublishButtonLabel","isPublished","isBeingScheduled","isSaving","isPublishing","hasPublishAction","isAutosaving","hasNonPostEntityChanges","select","forceIsSaving","isCurrentPostPublished","isEditedPostBeingScheduled","isSavingPost","isPublishingPost","getCurrentPost","getCurrentPostType","isAutosavingPost","editorStore","postType"],"mappings":";;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AAKA;;AAfA;AACA;AACA;;AAGA;AACA;AACA;;AAKA;AACA;AACA;AAGO,SAASA,kBAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/components/post-publish-button/label.js"],"names":["PublishButtonLabel","isPublished","isBeingScheduled","isSaving","isPublishing","hasPublishAction","isAutosaving","hasNonPostEntityChanges","select","forceIsSaving","isCurrentPostPublished","isEditedPostBeingScheduled","isSavingPost","isPublishingPost","getCurrentPost","getCurrentPostType","isAutosavingPost","editorStore","postType"],"mappings":";;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AAKA;;AAfA;AACA;AACA;;AAGA;AACA;AACA;;AAKA;AACA;AACA;AAGO,SAASA,kBAAT,OAQH;AAAA,MARgC;AACnCC,IAAAA,WADmC;AAEnCC,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IAAAA,YAAY,EAAES,gBAAgB,EAJxB;AAKNR,IAAAA,gBAAgB,EAAE,iBACjBS,cAAc,EADG,EAEjB,CAAE,QAAF,EAAY,mBAAZ,CAFiB,EAGjB,KAHiB,CALZ;AAUNI,IAAAA,QAAQ,EAAEH,kBAAkB,EAVtB;AAWNT,IAAAA,YAAY,EAAEU,gBAAgB;AAXxB,GAAP;AAaA,CAvBD,CADuB,CAAT,EAyBVhB,kBAzBU,C","sourcesContent":["/**\n * External dependencies\n */\nimport { get } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { compose } from '@wordpress/compose';\nimport { withSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport function PublishButtonLabel( {\n\tisPublished,\n\tisBeingScheduled,\n\tisSaving,\n\tisPublishing,\n\thasPublishAction,\n\tisAutosaving,\n\thasNonPostEntityChanges,\n} ) {\n\tif ( isPublishing ) {\n\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\treturn __( 'Publishing…' );\n\t} else if ( isPublished && isSaving && ! isAutosaving ) {\n\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\treturn __( 'Updating…' );\n\t} else if ( isBeingScheduled && isSaving && ! isAutosaving ) {\n\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\treturn __( 'Scheduling…' );\n\t}\n\n\tif ( ! hasPublishAction ) {\n\t\treturn hasNonPostEntityChanges\n\t\t\t? __( 'Submit for Review…' )\n\t\t\t: __( 'Submit for Review' );\n\t} else if ( isPublished ) {\n\t\treturn hasNonPostEntityChanges ? __( 'Update…' ) : __( 'Update' );\n\t} else if ( isBeingScheduled ) {\n\t\treturn hasNonPostEntityChanges ? __( 'Schedule…' ) : __( 'Schedule' );\n\t}\n\n\treturn __( 'Publish' );\n}\n\nexport default compose( [\n\twithSelect( ( select, { forceIsSaving } ) => {\n\t\tconst {\n\t\t\tisCurrentPostPublished,\n\t\t\tisEditedPostBeingScheduled,\n\t\t\tisSavingPost,\n\t\t\tisPublishingPost,\n\t\t\tgetCurrentPost,\n\t\t\tgetCurrentPostType,\n\t\t\tisAutosavingPost,\n\t\t} = select( editorStore );\n\t\treturn {\n\t\t\tisPublished: isCurrentPostPublished(),\n\t\t\tisBeingScheduled: isEditedPostBeingScheduled(),\n\t\t\tisSaving: forceIsSaving || isSavingPost(),\n\t\t\tisPublishing: isPublishingPost(),\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\tisAutosaving: isAutosavingPost(),\n\t\t};\n\t} ),\n] )( PublishButtonLabel );\n"]}
|
|
@@ -157,9 +157,10 @@ var _default = (0, _compose.compose)([(0, _data.withSelect)(select => {
|
|
|
157
157
|
isSavingNonPostEntityChanges: isSavingNonPostEntityChanges(),
|
|
158
158
|
isScheduled: isCurrentPostScheduled()
|
|
159
159
|
};
|
|
160
|
-
}), (0, _data.withDispatch)((dispatch, {
|
|
161
|
-
|
|
162
|
-
|
|
160
|
+
}), (0, _data.withDispatch)((dispatch, _ref) => {
|
|
161
|
+
let {
|
|
162
|
+
isPublishSidebarEnabled
|
|
163
|
+
} = _ref;
|
|
163
164
|
const {
|
|
164
165
|
disablePublishSidebar,
|
|
165
166
|
enablePublishSidebar
|