@wordpress/editor 13.11.0 → 13.12.1
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/CHANGELOG.md +2 -0
- package/build/components/autosave-monitor/index.js +1 -2
- package/build/components/autosave-monitor/index.js.map +1 -1
- package/build/components/deprecated.js +7 -9
- package/build/components/deprecated.js.map +1 -1
- package/build/components/document-outline/check.js +4 -5
- package/build/components/document-outline/check.js.map +1 -1
- package/build/components/document-outline/index.js +12 -16
- package/build/components/document-outline/index.js.map +1 -1
- package/build/components/document-outline/item.js +22 -25
- package/build/components/document-outline/item.js.map +1 -1
- package/build/components/editor-help/help-detail-navigation-screen.native.js +6 -9
- 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 +4 -5
- package/build/components/editor-help/help-get-support-button.native.js.map +1 -1
- package/build/components/editor-help/help-section-title.native.js +3 -4
- package/build/components/editor-help/help-section-title.native.js.map +1 -1
- package/build/components/editor-help/help-topic-row.native.js +6 -7
- package/build/components/editor-help/help-topic-row.native.js.map +1 -1
- package/build/components/editor-help/index.native.js +20 -27
- package/build/components/editor-help/index.native.js.map +1 -1
- package/build/components/editor-help/view-sections.native.js +16 -20
- package/build/components/editor-help/view-sections.native.js.map +1 -1
- package/build/components/editor-history/redo.js +2 -6
- package/build/components/editor-history/redo.js.map +1 -1
- package/build/components/editor-history/undo.js +2 -6
- package/build/components/editor-history/undo.js.map +1 -1
- package/build/components/editor-notices/index.js +12 -19
- package/build/components/editor-notices/index.js.map +1 -1
- package/build/components/editor-snackbars/index.js +3 -6
- package/build/components/editor-snackbars/index.js.map +1 -1
- package/build/components/entities-saved-states/entity-record-item.js +7 -10
- package/build/components/entities-saved-states/entity-record-item.js.map +1 -1
- package/build/components/entities-saved-states/entity-type-list.js +6 -7
- package/build/components/entities-saved-states/entity-type-list.js.map +1 -1
- package/build/components/entities-saved-states/hooks/use-is-dirty.js +86 -0
- package/build/components/entities-saved-states/hooks/use-is-dirty.js.map +1 -0
- package/build/components/entities-saved-states/index.js +43 -116
- package/build/components/entities-saved-states/index.js.map +1 -1
- package/build/components/error-boundary/index.js +4 -5
- package/build/components/error-boundary/index.js.map +1 -1
- package/build/components/global-keyboard-shortcuts/save-shortcut.js +3 -4
- package/build/components/global-keyboard-shortcuts/save-shortcut.js.map +1 -1
- package/build/components/index.js +18 -0
- package/build/components/index.js.map +1 -1
- package/build/components/media-categories/index.js +25 -42
- package/build/components/media-categories/index.js.map +1 -1
- package/build/components/page-attributes/check.js +4 -7
- package/build/components/page-attributes/check.js.map +1 -1
- package/build/components/page-attributes/order.js +7 -9
- package/build/components/page-attributes/order.js.map +1 -1
- package/build/components/page-attributes/parent.js +5 -12
- package/build/components/page-attributes/parent.js.map +1 -1
- package/build/components/post-author/check.js +6 -7
- package/build/components/post-author/check.js.map +1 -1
- package/build/components/post-author/combobox.js +3 -6
- package/build/components/post-author/combobox.js.map +1 -1
- package/build/components/post-author/index.js +1 -1
- package/build/components/post-author/index.js.map +1 -1
- package/build/components/post-comments/index.js +4 -6
- package/build/components/post-comments/index.js.map +1 -1
- package/build/components/post-excerpt/check.js +2 -4
- package/build/components/post-excerpt/check.js.map +1 -1
- package/build/components/post-excerpt/index.js +4 -5
- package/build/components/post-excerpt/index.js.map +1 -1
- package/build/components/post-featured-image/check.js +2 -4
- package/build/components/post-featured-image/check.js.map +1 -1
- package/build/components/post-featured-image/index.js +56 -69
- package/build/components/post-featured-image/index.js.map +1 -1
- package/build/components/post-format/check.js +6 -9
- package/build/components/post-format/check.js.map +1 -1
- package/build/components/post-format/index.js +1 -1
- package/build/components/post-format/index.js.map +1 -1
- package/build/components/post-last-revision/check.js +5 -7
- package/build/components/post-last-revision/check.js.map +1 -1
- package/build/components/post-last-revision/index.js +4 -5
- package/build/components/post-last-revision/index.js.map +1 -1
- package/build/components/post-locked-modal/index.js +1 -1
- package/build/components/post-locked-modal/index.js.map +1 -1
- package/build/components/post-pending-status/check.js +7 -9
- package/build/components/post-pending-status/check.js.map +1 -1
- package/build/components/post-pending-status/index.js +4 -6
- package/build/components/post-pending-status/index.js.map +1 -1
- package/build/components/post-pingbacks/index.js +4 -6
- package/build/components/post-pingbacks/index.js.map +1 -1
- package/build/components/post-preview-button/index.js +8 -12
- package/build/components/post-preview-button/index.js.map +1 -1
- package/build/components/post-publish-button/index.js +10 -19
- package/build/components/post-publish-button/index.js.map +1 -1
- package/build/components/post-publish-button/label.js +14 -17
- package/build/components/post-publish-button/label.js.map +1 -1
- package/build/components/post-publish-panel/index.js +10 -12
- package/build/components/post-publish-panel/index.js.map +1 -1
- package/build/components/post-publish-panel/maybe-category-panel.js +2 -4
- package/build/components/post-publish-panel/maybe-category-panel.js.map +1 -1
- package/build/components/post-publish-panel/maybe-post-format-panel.js +9 -12
- package/build/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
- package/build/components/post-publish-panel/maybe-tags-panel.js +4 -7
- package/build/components/post-publish-panel/maybe-tags-panel.js.map +1 -1
- package/build/components/post-publish-panel/maybe-upload-media.js +150 -0
- package/build/components/post-publish-panel/maybe-upload-media.js.map +1 -0
- package/build/components/post-publish-panel/postpublish.js +8 -11
- package/build/components/post-publish-panel/postpublish.js.map +1 -1
- package/build/components/post-publish-panel/prepublish.js +8 -7
- package/build/components/post-publish-panel/prepublish.js.map +1 -1
- package/build/components/post-saved-state/index.js +13 -8
- package/build/components/post-saved-state/index.js.map +1 -1
- package/build/components/post-schedule/check.js +6 -8
- package/build/components/post-schedule/check.js.map +1 -1
- package/build/components/post-schedule/index.js +8 -12
- package/build/components/post-schedule/index.js.map +1 -1
- package/build/components/post-schedule/label.js +7 -10
- package/build/components/post-schedule/label.js.map +1 -1
- package/build/components/post-slug/check.js +3 -4
- package/build/components/post-slug/check.js.map +1 -1
- package/build/components/post-slug/index.js +5 -6
- package/build/components/post-slug/index.js.map +1 -1
- package/build/components/post-sticky/check.js +7 -9
- package/build/components/post-sticky/check.js.map +1 -1
- package/build/components/post-sticky/index.js +4 -5
- package/build/components/post-sticky/index.js.map +1 -1
- package/build/components/post-switch-to-draft-button/index.js +6 -7
- package/build/components/post-switch-to-draft-button/index.js.map +1 -1
- package/build/components/post-sync-status/index.js +67 -0
- package/build/components/post-sync-status/index.js.map +1 -0
- package/build/components/post-taxonomies/check.js +6 -7
- package/build/components/post-taxonomies/check.js.map +1 -1
- package/build/components/post-taxonomies/flat-term-selector.js +36 -46
- package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
- package/build/components/post-taxonomies/hierarchical-term-selector.js +13 -14
- package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
- package/build/components/post-taxonomies/index.js +6 -11
- package/build/components/post-taxonomies/index.js.map +1 -1
- package/build/components/post-taxonomies/most-used-terms.js +5 -6
- package/build/components/post-taxonomies/most-used-terms.js.map +1 -1
- package/build/components/post-template/index.js +6 -9
- package/build/components/post-template/index.js.map +1 -1
- package/build/components/post-title/index.js +8 -5
- package/build/components/post-title/index.js.map +1 -1
- package/build/components/post-title/index.native.js +8 -11
- package/build/components/post-title/index.native.js.map +1 -1
- package/build/components/post-trash/check.js +7 -9
- package/build/components/post-trash/check.js.map +1 -1
- package/build/components/post-type-support-check/index.js +5 -6
- package/build/components/post-type-support-check/index.js.map +1 -1
- package/build/components/post-url/check.js +4 -5
- package/build/components/post-url/check.js.map +1 -1
- package/build/components/post-url/index.js +8 -9
- package/build/components/post-url/index.js.map +1 -1
- package/build/components/post-visibility/check.js +6 -7
- package/build/components/post-visibility/check.js.map +1 -1
- package/build/components/post-visibility/index.js +14 -19
- package/build/components/post-visibility/index.js.map +1 -1
- package/build/components/post-visibility/label.js +1 -3
- package/build/components/post-visibility/label.js.map +1 -1
- package/build/components/provider/index.js +12 -15
- package/build/components/provider/index.js.map +1 -1
- package/build/components/provider/index.native.js +19 -30
- package/build/components/provider/index.native.js.map +1 -1
- package/build/components/provider/use-block-editor-settings.js +5 -9
- package/build/components/provider/use-block-editor-settings.js.map +1 -1
- package/build/components/provider/use-block-editor-settings.native.js +1 -3
- package/build/components/provider/use-block-editor-settings.native.js.map +1 -1
- package/build/components/provider/with-registry-provider.js +4 -2
- package/build/components/provider/with-registry-provider.js.map +1 -1
- package/build/components/table-of-contents/index.js +26 -35
- package/build/components/table-of-contents/index.js.map +1 -1
- package/build/components/table-of-contents/panel.js +4 -5
- package/build/components/table-of-contents/panel.js.map +1 -1
- package/build/components/template-validation-notice/index.js +4 -6
- package/build/components/template-validation-notice/index.js.map +1 -1
- package/build/components/theme-support-check/index.js +7 -8
- package/build/components/theme-support-check/index.js.map +1 -1
- package/build/hooks/custom-sources-backwards-compatibility.js +20 -42
- package/build/hooks/custom-sources-backwards-compatibility.js.map +1 -1
- package/build/hooks/default-autocompleters.js +1 -2
- package/build/hooks/default-autocompleters.js.map +1 -1
- package/build/{lockUnlock.js → lock-unlock.js} +1 -1
- package/build/lock-unlock.js.map +1 -0
- package/build/private-apis.js +5 -2
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +147 -179
- package/build/store/actions.js.map +1 -1
- package/build/store/actions.native.js +1 -2
- package/build/store/actions.native.js.map +1 -1
- package/build/store/reducer.js +14 -44
- package/build/store/reducer.js.map +1 -1
- package/build/store/reducer.native.js +3 -12
- package/build/store/reducer.native.js.map +1 -1
- package/build/store/selectors.js +23 -54
- package/build/store/selectors.js.map +1 -1
- package/build/store/utils/notice-builder.js +3 -3
- package/build/store/utils/notice-builder.js.map +1 -1
- package/build/utils/media-upload/index.js +11 -15
- package/build/utils/media-upload/index.js.map +1 -1
- package/build/utils/terms.js +3 -6
- package/build/utils/terms.js.map +1 -1
- package/build-module/components/autosave-monitor/index.js +1 -2
- package/build-module/components/autosave-monitor/index.js.map +1 -1
- package/build-module/components/deprecated.js +7 -8
- package/build-module/components/deprecated.js.map +1 -1
- package/build-module/components/document-outline/check.js +4 -5
- package/build-module/components/document-outline/check.js.map +1 -1
- package/build-module/components/document-outline/index.js +12 -16
- package/build-module/components/document-outline/index.js.map +1 -1
- package/build-module/components/document-outline/item.js +22 -25
- package/build-module/components/document-outline/item.js.map +1 -1
- package/build-module/components/editor-help/help-detail-navigation-screen.native.js +6 -8
- 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 +4 -5
- package/build-module/components/editor-help/help-get-support-button.native.js.map +1 -1
- package/build-module/components/editor-help/help-section-title.native.js +3 -4
- package/build-module/components/editor-help/help-section-title.native.js.map +1 -1
- package/build-module/components/editor-help/help-topic-row.native.js +6 -7
- package/build-module/components/editor-help/help-topic-row.native.js.map +1 -1
- package/build-module/components/editor-help/index.native.js +20 -25
- package/build-module/components/editor-help/index.native.js.map +1 -1
- package/build-module/components/editor-help/view-sections.native.js +16 -20
- package/build-module/components/editor-help/view-sections.native.js.map +1 -1
- package/build-module/components/editor-history/redo.js +2 -3
- package/build-module/components/editor-history/redo.js.map +1 -1
- package/build-module/components/editor-history/undo.js +2 -3
- package/build-module/components/editor-history/undo.js.map +1 -1
- package/build-module/components/editor-notices/index.js +12 -19
- package/build-module/components/editor-notices/index.js.map +1 -1
- package/build-module/components/editor-snackbars/index.js +3 -6
- package/build-module/components/editor-snackbars/index.js.map +1 -1
- package/build-module/components/entities-saved-states/entity-record-item.js +7 -10
- 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 +6 -7
- package/build-module/components/entities-saved-states/entity-type-list.js.map +1 -1
- package/build-module/components/entities-saved-states/hooks/use-is-dirty.js +72 -0
- package/build-module/components/entities-saved-states/hooks/use-is-dirty.js.map +1 -0
- package/build-module/components/entities-saved-states/index.js +44 -118
- package/build-module/components/entities-saved-states/index.js.map +1 -1
- package/build-module/components/error-boundary/index.js +4 -5
- package/build-module/components/error-boundary/index.js.map +1 -1
- package/build-module/components/global-keyboard-shortcuts/save-shortcut.js +3 -4
- package/build-module/components/global-keyboard-shortcuts/save-shortcut.js.map +1 -1
- package/build-module/components/index.js +2 -0
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/media-categories/index.js +25 -42
- package/build-module/components/media-categories/index.js.map +1 -1
- package/build-module/components/page-attributes/check.js +4 -7
- package/build-module/components/page-attributes/check.js.map +1 -1
- package/build-module/components/page-attributes/order.js +7 -9
- package/build-module/components/page-attributes/order.js.map +1 -1
- package/build-module/components/page-attributes/parent.js +5 -12
- package/build-module/components/page-attributes/parent.js.map +1 -1
- package/build-module/components/post-author/check.js +6 -7
- package/build-module/components/post-author/check.js.map +1 -1
- package/build-module/components/post-author/combobox.js +3 -6
- package/build-module/components/post-author/combobox.js.map +1 -1
- package/build-module/components/post-author/index.js +1 -1
- package/build-module/components/post-author/index.js.map +1 -1
- package/build-module/components/post-comments/index.js +4 -6
- package/build-module/components/post-comments/index.js.map +1 -1
- package/build-module/components/post-excerpt/check.js +2 -3
- package/build-module/components/post-excerpt/check.js.map +1 -1
- package/build-module/components/post-excerpt/index.js +4 -5
- package/build-module/components/post-excerpt/index.js.map +1 -1
- package/build-module/components/post-featured-image/check.js +2 -3
- package/build-module/components/post-featured-image/check.js.map +1 -1
- package/build-module/components/post-featured-image/index.js +56 -69
- package/build-module/components/post-featured-image/index.js.map +1 -1
- package/build-module/components/post-format/check.js +6 -8
- package/build-module/components/post-format/check.js.map +1 -1
- package/build-module/components/post-format/index.js +1 -1
- package/build-module/components/post-format/index.js.map +1 -1
- package/build-module/components/post-last-revision/check.js +5 -7
- package/build-module/components/post-last-revision/check.js.map +1 -1
- package/build-module/components/post-last-revision/index.js +4 -5
- package/build-module/components/post-last-revision/index.js.map +1 -1
- package/build-module/components/post-locked-modal/index.js +1 -1
- package/build-module/components/post-locked-modal/index.js.map +1 -1
- package/build-module/components/post-pending-status/check.js +7 -9
- package/build-module/components/post-pending-status/check.js.map +1 -1
- package/build-module/components/post-pending-status/index.js +4 -6
- package/build-module/components/post-pending-status/index.js.map +1 -1
- package/build-module/components/post-pingbacks/index.js +4 -6
- package/build-module/components/post-pingbacks/index.js.map +1 -1
- package/build-module/components/post-preview-button/index.js +8 -12
- package/build-module/components/post-preview-button/index.js.map +1 -1
- package/build-module/components/post-publish-button/index.js +10 -18
- package/build-module/components/post-publish-button/index.js.map +1 -1
- package/build-module/components/post-publish-button/label.js +14 -17
- package/build-module/components/post-publish-button/label.js.map +1 -1
- package/build-module/components/post-publish-panel/index.js +10 -11
- package/build-module/components/post-publish-panel/index.js.map +1 -1
- package/build-module/components/post-publish-panel/maybe-category-panel.js +2 -4
- package/build-module/components/post-publish-panel/maybe-category-panel.js.map +1 -1
- package/build-module/components/post-publish-panel/maybe-post-format-panel.js +9 -12
- 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 +4 -7
- package/build-module/components/post-publish-panel/maybe-tags-panel.js.map +1 -1
- package/build-module/components/post-publish-panel/maybe-upload-media.js +138 -0
- package/build-module/components/post-publish-panel/maybe-upload-media.js.map +1 -0
- package/build-module/components/post-publish-panel/postpublish.js +8 -11
- package/build-module/components/post-publish-panel/postpublish.js.map +1 -1
- package/build-module/components/post-publish-panel/prepublish.js +7 -7
- package/build-module/components/post-publish-panel/prepublish.js.map +1 -1
- package/build-module/components/post-saved-state/index.js +13 -8
- package/build-module/components/post-saved-state/index.js.map +1 -1
- package/build-module/components/post-schedule/check.js +6 -8
- package/build-module/components/post-schedule/check.js.map +1 -1
- package/build-module/components/post-schedule/index.js +8 -12
- package/build-module/components/post-schedule/index.js.map +1 -1
- package/build-module/components/post-schedule/label.js +7 -10
- package/build-module/components/post-schedule/label.js.map +1 -1
- package/build-module/components/post-slug/check.js +3 -4
- package/build-module/components/post-slug/check.js.map +1 -1
- package/build-module/components/post-slug/index.js +5 -6
- package/build-module/components/post-slug/index.js.map +1 -1
- package/build-module/components/post-sticky/check.js +7 -9
- package/build-module/components/post-sticky/check.js.map +1 -1
- package/build-module/components/post-sticky/index.js +4 -5
- package/build-module/components/post-sticky/index.js.map +1 -1
- package/build-module/components/post-switch-to-draft-button/index.js +6 -7
- package/build-module/components/post-switch-to-draft-button/index.js.map +1 -1
- package/build-module/components/post-sync-status/index.js +56 -0
- package/build-module/components/post-sync-status/index.js.map +1 -0
- package/build-module/components/post-taxonomies/check.js +6 -7
- package/build-module/components/post-taxonomies/check.js.map +1 -1
- package/build-module/components/post-taxonomies/flat-term-selector.js +36 -44
- package/build-module/components/post-taxonomies/flat-term-selector.js.map +1 -1
- package/build-module/components/post-taxonomies/hierarchical-term-selector.js +13 -14
- package/build-module/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
- package/build-module/components/post-taxonomies/index.js +6 -11
- package/build-module/components/post-taxonomies/index.js.map +1 -1
- package/build-module/components/post-taxonomies/most-used-terms.js +5 -6
- package/build-module/components/post-taxonomies/most-used-terms.js.map +1 -1
- package/build-module/components/post-template/index.js +6 -9
- package/build-module/components/post-template/index.js.map +1 -1
- package/build-module/components/post-title/index.js +8 -5
- package/build-module/components/post-title/index.js.map +1 -1
- package/build-module/components/post-title/index.native.js +8 -11
- package/build-module/components/post-title/index.native.js.map +1 -1
- package/build-module/components/post-trash/check.js +7 -9
- package/build-module/components/post-trash/check.js.map +1 -1
- package/build-module/components/post-type-support-check/index.js +5 -6
- package/build-module/components/post-type-support-check/index.js.map +1 -1
- package/build-module/components/post-url/check.js +4 -5
- package/build-module/components/post-url/check.js.map +1 -1
- package/build-module/components/post-url/index.js +8 -9
- package/build-module/components/post-url/index.js.map +1 -1
- package/build-module/components/post-visibility/check.js +6 -7
- package/build-module/components/post-visibility/check.js.map +1 -1
- package/build-module/components/post-visibility/index.js +14 -16
- package/build-module/components/post-visibility/index.js.map +1 -1
- package/build-module/components/post-visibility/label.js +1 -3
- package/build-module/components/post-visibility/label.js.map +1 -1
- package/build-module/components/provider/index.js +12 -14
- package/build-module/components/provider/index.js.map +1 -1
- package/build-module/components/provider/index.native.js +19 -29
- package/build-module/components/provider/index.native.js.map +1 -1
- package/build-module/components/provider/use-block-editor-settings.js +5 -9
- package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
- package/build-module/components/provider/use-block-editor-settings.native.js +1 -3
- package/build-module/components/provider/use-block-editor-settings.native.js.map +1 -1
- package/build-module/components/provider/with-registry-provider.js +4 -2
- package/build-module/components/provider/with-registry-provider.js.map +1 -1
- package/build-module/components/table-of-contents/index.js +26 -34
- package/build-module/components/table-of-contents/index.js.map +1 -1
- package/build-module/components/table-of-contents/panel.js +4 -5
- package/build-module/components/table-of-contents/panel.js.map +1 -1
- package/build-module/components/template-validation-notice/index.js +4 -6
- package/build-module/components/template-validation-notice/index.js.map +1 -1
- package/build-module/components/theme-support-check/index.js +7 -8
- package/build-module/components/theme-support-check/index.js.map +1 -1
- package/build-module/hooks/custom-sources-backwards-compatibility.js +20 -39
- package/build-module/hooks/custom-sources-backwards-compatibility.js.map +1 -1
- package/build-module/hooks/default-autocompleters.js +1 -2
- package/build-module/hooks/default-autocompleters.js.map +1 -1
- package/build-module/{lockUnlock.js → lock-unlock.js} +1 -1
- package/build-module/lock-unlock.js.map +1 -0
- package/build-module/private-apis.js +4 -2
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/actions.js +147 -179
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/actions.native.js +1 -2
- package/build-module/store/actions.native.js.map +1 -1
- package/build-module/store/reducer.js +14 -44
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/reducer.native.js +3 -12
- package/build-module/store/reducer.native.js.map +1 -1
- package/build-module/store/selectors.js +21 -54
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/store/utils/notice-builder.js +3 -3
- package/build-module/store/utils/notice-builder.js.map +1 -1
- package/build-module/utils/media-upload/index.js +11 -15
- package/build-module/utils/media-upload/index.js.map +1 -1
- package/build-module/utils/terms.js +3 -6
- package/build-module/utils/terms.js.map +1 -1
- package/build-style/style-rtl.css +15 -1
- package/build-style/style.css +15 -1
- package/package.json +30 -31
- package/src/components/editor-help/test/index.native.js +3 -2
- package/src/components/entities-saved-states/hooks/use-is-dirty.js +87 -0
- package/src/components/entities-saved-states/index.js +25 -106
- package/src/components/entities-saved-states/test/use-is-dirty.js +94 -0
- package/src/components/index.js +2 -0
- package/src/components/post-publish-panel/maybe-upload-media.js +167 -0
- package/src/components/post-publish-panel/prepublish.js +2 -0
- package/src/components/post-publish-panel/style.scss +1 -1
- package/src/components/post-saved-state/index.js +6 -0
- package/src/components/post-sync-status/index.js +55 -0
- package/src/components/post-sync-status/style.scss +16 -0
- package/src/components/post-taxonomies/flat-term-selector.js +20 -30
- package/src/components/post-title/index.js +4 -1
- package/src/components/provider/index.js +1 -1
- package/src/components/provider/index.native.js +2 -9
- package/src/private-apis.js +3 -1
- package/src/style.scss +1 -0
- package/build/lockUnlock.js.map +0 -1
- package/build-module/lockUnlock.js.map +0 -1
- /package/src/{lockUnlock.js → lock-unlock.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/components/post-pending-status/check.js"],"names":["compose","withSelect","store","editorStore","PostPendingStatusCheck","hasPublishAction","isPublished","children","select","isCurrentPostPublished","getCurrentPostType","getCurrentPost","_links","postType"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,OAAT,QAAwB,oBAAxB;AACA,SAASC,UAAT,QAA2B,iBAA3B;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,aAArC;AAEA,OAAO,SAASC,sBAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/components/post-pending-status/check.js"],"names":["compose","withSelect","store","editorStore","PostPendingStatusCheck","hasPublishAction","isPublished","children","select","isCurrentPostPublished","getCurrentPostType","getCurrentPost","_links","postType"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,OAAT,QAAwB,oBAAxB;AACA,SAASC,UAAT,QAA2B,iBAA3B;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,aAArC;AAEA,OAAO,SAASC,sBAAT,CAAiC;AACvCC,EAAAA,gBADuC;AAEvCC,EAAAA,WAFuC;AAGvCC,EAAAA;AAHuC,CAAjC,EAIH;AACH,MAAKD,WAAW,IAAI,CAAED,gBAAtB,EAAyC;AACxC,WAAO,IAAP;AACA;;AAED,SAAOE,QAAP;AACA;AAED,eAAeP,OAAO,CACrBC,UAAU,CAAIO,MAAF,IAAc;AAAA;;AACzB,QAAM;AAAEC,IAAAA,sBAAF;AAA0BC,IAAAA,kBAA1B;AAA8CC,IAAAA;AAA9C,MACLH,MAAM,CAAEL,WAAF,CADP;AAEA,SAAO;AACNE,IAAAA,gBAAgB,2BACfM,cAAc,GAAGC,MAAjB,GAA2B,mBAA3B,CADe,yEACqC,KAF/C;AAGNN,IAAAA,WAAW,EAAEG,sBAAsB,EAH7B;AAINI,IAAAA,QAAQ,EAAEH,kBAAkB;AAJtB,GAAP;AAMA,CATS,CADW,CAAP,CAWZN,sBAXY,CAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { compose } from '@wordpress/compose';\nimport { withSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport function PostPendingStatusCheck( {\n\thasPublishAction,\n\tisPublished,\n\tchildren,\n} ) {\n\tif ( isPublished || ! hasPublishAction ) {\n\t\treturn null;\n\t}\n\n\treturn children;\n}\n\nexport default compose(\n\twithSelect( ( select ) => {\n\t\tconst { isCurrentPostPublished, getCurrentPostType, getCurrentPost } =\n\t\t\tselect( editorStore );\n\t\treturn {\n\t\t\thasPublishAction:\n\t\t\t\tgetCurrentPost()._links?.[ 'wp:action-publish' ] ?? false,\n\t\t\tisPublished: isCurrentPostPublished(),\n\t\t\tpostType: getCurrentPostType(),\n\t\t};\n\t} )\n)( PostPendingStatusCheck );\n"]}
|
|
@@ -13,12 +13,10 @@ import { compose } from '@wordpress/compose';
|
|
|
13
13
|
|
|
14
14
|
import PostPendingStatusCheck from './check';
|
|
15
15
|
import { store as editorStore } from '../../store';
|
|
16
|
-
export function PostPendingStatus(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
} = _ref;
|
|
21
|
-
|
|
16
|
+
export function PostPendingStatus({
|
|
17
|
+
status,
|
|
18
|
+
onUpdateStatus
|
|
19
|
+
}) {
|
|
22
20
|
const togglePendingStatus = () => {
|
|
23
21
|
const updatedStatus = status === 'pending' ? 'draft' : 'pending';
|
|
24
22
|
onUpdateStatus(updatedStatus);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/components/post-pending-status/index.js"],"names":["__","CheckboxControl","withSelect","withDispatch","compose","PostPendingStatusCheck","store","editorStore","PostPendingStatus","status","onUpdateStatus","togglePendingStatus","updatedStatus","select","getEditedPostAttribute","dispatch","editPost"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,eAAT,QAAgC,uBAAhC;AACA,SAASC,UAAT,EAAqBC,YAArB,QAAyC,iBAAzC;AACA,SAASC,OAAT,QAAwB,oBAAxB;AAEA;AACA;AACA;;AACA,OAAOC,sBAAP,MAAmC,SAAnC;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,aAArC;AAEA,OAAO,SAASC,iBAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/components/post-pending-status/index.js"],"names":["__","CheckboxControl","withSelect","withDispatch","compose","PostPendingStatusCheck","store","editorStore","PostPendingStatus","status","onUpdateStatus","togglePendingStatus","updatedStatus","select","getEditedPostAttribute","dispatch","editPost"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,eAAT,QAAgC,uBAAhC;AACA,SAASC,UAAT,EAAqBC,YAArB,QAAyC,iBAAzC;AACA,SAASC,OAAT,QAAwB,oBAAxB;AAEA;AACA;AACA;;AACA,OAAOC,sBAAP,MAAmC,SAAnC;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,aAArC;AAEA,OAAO,SAASC,iBAAT,CAA4B;AAAEC,EAAAA,MAAF;AAAUC,EAAAA;AAAV,CAA5B,EAAyD;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,cAAC,sBAAD,QACC,cAAC,eAAD;AACC,IAAA,uBAAuB,MADxB;AAEC,IAAA,KAAK,EAAGZ,EAAE,CAAE,gBAAF,CAFX;AAGC,IAAA,OAAO,EAAGS,MAAM,KAAK,SAHtB;AAIC,IAAA,QAAQ,EAAGE;AAJZ,IADD,CADD;AAUA;AAED,eAAeP,OAAO,CACrBF,UAAU,CAAIW,MAAF,KAAgB;AAC3BJ,EAAAA,MAAM,EAAEI,MAAM,CAAEN,WAAF,CAAN,CAAsBO,sBAAtB,CAA8C,QAA9C;AADmB,CAAhB,CAAF,CADW,EAIrBX,YAAY,CAAIY,QAAF,KAAkB;AAC/BL,EAAAA,cAAc,CAAED,MAAF,EAAW;AACxBM,IAAAA,QAAQ,CAAER,WAAF,CAAR,CAAwBS,QAAxB,CAAkC;AAAEP,MAAAA;AAAF,KAAlC;AACA;;AAH8B,CAAlB,CAAF,CAJS,CAAP,CASZD,iBATY,CAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { CheckboxControl } from '@wordpress/components';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport 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\t__nextHasNoMarginBottom\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"]}
|
|
@@ -13,12 +13,10 @@ import { compose } from '@wordpress/compose';
|
|
|
13
13
|
|
|
14
14
|
import { store as editorStore } from '../../store';
|
|
15
15
|
|
|
16
|
-
function PostPingbacks(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
} = _ref;
|
|
21
|
-
|
|
16
|
+
function PostPingbacks({
|
|
17
|
+
pingStatus = 'open',
|
|
18
|
+
...props
|
|
19
|
+
}) {
|
|
22
20
|
const onTogglePingback = () => props.editPost({
|
|
23
21
|
ping_status: pingStatus === 'open' ? 'closed' : 'open'
|
|
24
22
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/components/post-pingbacks/index.js"],"names":["__","CheckboxControl","withSelect","withDispatch","compose","store","editorStore","PostPingbacks","pingStatus","props","onTogglePingback","editPost","ping_status","select","getEditedPostAttribute","dispatch"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,eAAT,QAAgC,uBAAhC;AACA,SAASC,UAAT,EAAqBC,YAArB,QAAyC,iBAAzC;AACA,SAASC,OAAT,QAAwB,oBAAxB;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,aAArC;;AAEA,SAASC,aAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/components/post-pingbacks/index.js"],"names":["__","CheckboxControl","withSelect","withDispatch","compose","store","editorStore","PostPingbacks","pingStatus","props","onTogglePingback","editPost","ping_status","select","getEditedPostAttribute","dispatch"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,eAAT,QAAgC,uBAAhC;AACA,SAASC,UAAT,EAAqBC,YAArB,QAAyC,iBAAzC;AACA,SAASC,OAAT,QAAwB,oBAAxB;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,aAArC;;AAEA,SAASC,aAAT,CAAwB;AAAEC,EAAAA,UAAU,GAAG,MAAf;AAAuB,KAAGC;AAA1B,CAAxB,EAA4D;AAC3D,QAAMC,gBAAgB,GAAG,MACxBD,KAAK,CAACE,QAAN,CAAgB;AACfC,IAAAA,WAAW,EAAEJ,UAAU,KAAK,MAAf,GAAwB,QAAxB,GAAmC;AADjC,GAAhB,CADD;;AAKA,SACC,cAAC,eAAD;AACC,IAAA,uBAAuB,MADxB;AAEC,IAAA,KAAK,EAAGR,EAAE,CAAE,8BAAF,CAFX;AAGC,IAAA,OAAO,EAAGQ,UAAU,KAAK,MAH1B;AAIC,IAAA,QAAQ,EAAGE;AAJZ,IADD;AAQA;;AAED,eAAeN,OAAO,CAAE,CACvBF,UAAU,CAAIW,MAAF,IAAc;AACzB,SAAO;AACNL,IAAAA,UAAU,EACTK,MAAM,CAAEP,WAAF,CAAN,CAAsBQ,sBAAtB,CAA8C,aAA9C;AAFK,GAAP;AAIA,CALS,CADa,EAOvBX,YAAY,CAAIY,QAAF,KAAkB;AAC/BJ,EAAAA,QAAQ,EAAEI,QAAQ,CAAET,WAAF,CAAR,CAAwBK;AADH,CAAlB,CAAF,CAPW,CAAF,CAAP,CAUVJ,aAVU,CAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { CheckboxControl } from '@wordpress/components';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { 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\t__nextHasNoMarginBottom\n\t\t\tlabel={ __( 'Allow pingbacks & trackbacks' ) }\n\t\t\tchecked={ pingStatus === 'open' }\n\t\t\tonChange={ onTogglePingback }\n\t\t/>\n\t);\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\treturn {\n\t\t\tpingStatus:\n\t\t\t\tselect( editorStore ).getEditedPostAttribute( 'ping_status' ),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => ( {\n\t\teditPost: dispatch( editorStore ).editPost,\n\t} ) ),\n] )( PostPingbacks );\n"]}
|
|
@@ -222,13 +222,12 @@ export class PostPreviewButton extends Component {
|
|
|
222
222
|
}
|
|
223
223
|
|
|
224
224
|
}
|
|
225
|
-
export default compose([withSelect((select,
|
|
225
|
+
export default compose([withSelect((select, {
|
|
226
|
+
forcePreviewLink,
|
|
227
|
+
forceIsAutosaveable
|
|
228
|
+
}) => {
|
|
226
229
|
var _postType$viewable;
|
|
227
230
|
|
|
228
|
-
let {
|
|
229
|
-
forcePreviewLink,
|
|
230
|
-
forceIsAutosaveable
|
|
231
|
-
} = _ref;
|
|
232
231
|
const {
|
|
233
232
|
getCurrentPostId,
|
|
234
233
|
getCurrentPostAttribute,
|
|
@@ -249,17 +248,14 @@ export default compose([withSelect((select, _ref) => {
|
|
|
249
248
|
previewLink: forcePreviewLink !== undefined ? forcePreviewLink : previewLink,
|
|
250
249
|
isSaveable: isEditedPostSaveable(),
|
|
251
250
|
isAutosaveable: forceIsAutosaveable || isEditedPostAutosaveable(),
|
|
252
|
-
isViewable: (_postType$viewable = postType
|
|
251
|
+
isViewable: (_postType$viewable = postType?.viewable) !== null && _postType$viewable !== void 0 ? _postType$viewable : false,
|
|
253
252
|
isDraft: ['draft', 'auto-draft'].indexOf(getEditedPostAttribute('status')) !== -1,
|
|
254
253
|
isPostLocked: isPostLocked()
|
|
255
254
|
};
|
|
256
255
|
}), withDispatch(dispatch => ({
|
|
257
256
|
autosave: dispatch(editorStore).autosave,
|
|
258
257
|
savePost: dispatch(editorStore).savePost
|
|
259
|
-
})), ifCondition(
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
} = _ref2;
|
|
263
|
-
return isViewable;
|
|
264
|
-
})])(PostPreviewButton);
|
|
258
|
+
})), ifCondition(({
|
|
259
|
+
isViewable
|
|
260
|
+
}) => isViewable)])(PostPreviewButton);
|
|
265
261
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/components/post-preview-button/index.js"],"names":["classnames","Component","createRef","renderToString","Button","Path","SVG","VisuallyHidden","__","_x","withSelect","withDispatch","ifCondition","compose","applyFilters","store","coreStore","editorStore","writeInterstitialMessage","targetDocument","markup","write","title","close","PostPreviewButton","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","getPostType","postType","isViewable","viewable","indexOf","dispatch"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,EAAoBC,SAApB,EAA+BC,cAA/B,QAAqD,oBAArD;AACA,SAASC,MAAT,EAAiBC,IAAjB,EAAuBC,GAAvB,EAA4BC,cAA5B,QAAkD,uBAAlD;AACA,SAASC,EAAT,EAAaC,EAAb,QAAuB,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,IAAAA,OAAO,EACN,CAAE,OAAF,EAAW,YAAX,EAA0B0B,OAA1B,CACCR,sBAAsB,CAAE,QAAF,CADvB,MAEM,CAAC,CAXF;AAYNrB,IAAAA,YAAY,EAAEA,YAAY;AAZpB,GAAP;AAcA,CA7BS,CADa,EA+BvBrC,YAAY,CAAImE,QAAF,KAAkB;AAC/BxB,EAAAA,QAAQ,EAAEwB,QAAQ,CAAE7D,WAAF,CAAR,CAAwBqC,QADH;AAE/BF,EAAAA,QAAQ,EAAE0B,QAAQ,CAAE7D,WAAF,CAAR,CAAwBmC;AAFH,CAAlB,CAAF,CA/BW,EAmCvBxC,WAAW,CAAE;AAAA,MAAE;AAAE+D,IAAAA;AAAF,GAAF;AAAA,SAAsBA,UAAtB;AAAA,CAAF,CAnCY,CAAF,CAAP,CAoCVnD,iBApCU,CAAf","sourcesContent":["/**\n * External dependencies\n */\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: 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":["classnames","Component","createRef","renderToString","Button","Path","SVG","VisuallyHidden","__","_x","withSelect","withDispatch","ifCondition","compose","applyFilters","store","coreStore","editorStore","writeInterstitialMessage","targetDocument","markup","write","title","close","PostPreviewButton","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","getPostType","postType","isViewable","viewable","indexOf","dispatch"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,EAAoBC,SAApB,EAA+BC,cAA/B,QAAqD,oBAArD;AACA,SAASC,MAAT,EAAiBC,IAAjB,EAAuBC,GAAvB,EAA4BC,cAA5B,QAAkD,uBAAlD;AACA,SAASC,EAAT,EAAaC,EAAb,QAAuB,iBAAvB;AACA,SAASC,UAAT,EAAqBC,YAArB,QAAyC,iBAAzC;AACA,SAASC,WAAT,EAAsBC,OAAtB,QAAqC,oBAArC;AACA,SAASC,YAAT,QAA6B,kBAA7B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,SAASD,KAAK,IAAIE,WAAlB,QAAqC,aAArC;;AAEA,SAASC,wBAAT,CAAmCC,cAAnC,EAAoD;AACnD,MAAIC,MAAM,GAAGjB,cAAc,CAC1B;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,cAAC,GAAD;AAAK,IAAA,KAAK,EAAC,4BAAX;AAAwC,IAAA,OAAO,EAAC;AAAhD,KACC,cAAC,IAAD;AACC,IAAA,SAAS,EAAC,OADX;AAEC,IAAA,CAAC,EAAC,uEAFH;AAGC,IAAA,IAAI,EAAC;AAHN,IADD,EAMC,cAAC,IAAD;AACC,IAAA,SAAS,EAAC,OADX;AAEC,IAAA,CAAC,EAAC,0nBAFH;AAGC,IAAA,IAAI,EAAC;AAHN,IAND,CADD,EAaC,yBAAKK,EAAE,CAAE,qBAAF,CAAP,CAbD,CAD0B,CAA3B;AAkBAY,EAAAA,MAAM,IAAK;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC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W,EACViC,gBAAgB,KAAKH,SAArB,GAAiCG,gBAAjC,GAAoDjC,WAJ/C;AAKN0B,IAAAA,UAAU,EAAEY,oBAAoB,EAL1B;AAMNvB,IAAAA,cAAc,EAAEmB,mBAAmB,IAAIK,wBAAwB,EANzD;AAONI,IAAAA,UAAU,wBAAED,QAAQ,EAAEE,QAAZ,mEAAwB,KAP5B;AAQNzB,IAAAA,OAAO,EACN,CAAE,OAAF,EAAW,YAAX,EAA0B0B,OAA1B,CACCR,sBAAsB,CAAE,QAAF,CADvB,MAEM,CAAC,CAXF;AAYNrB,IAAAA,YAAY,EAAEA,YAAY;AAZpB,GAAP;AAcA,CA7BS,CADa,EA+BvBrC,YAAY,CAAImE,QAAF,KAAkB;AAC/BxB,EAAAA,QAAQ,EAAEwB,QAAQ,CAAE7D,WAAF,CAAR,CAAwBqC,QADH;AAE/BF,EAAAA,QAAQ,EAAE0B,QAAQ,CAAE7D,WAAF,CAAR,CAAwBmC;AAFH,CAAlB,CAAF,CA/BW,EAmCvBxC,WAAW,CAAE,CAAE;AAAE+D,EAAAA;AAAF,CAAF,KAAsBA,UAAxB,CAnCY,CAAF,CAAP,CAoCVnD,iBApCU,CAAf","sourcesContent":["/**\n * External dependencies\n */\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: 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,4 +1,3 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
1
|
import { createElement, Fragment } from "@wordpress/element";
|
|
3
2
|
|
|
4
3
|
/**
|
|
@@ -50,17 +49,11 @@ export class PostPublishButton extends Component {
|
|
|
50
49
|
}
|
|
51
50
|
|
|
52
51
|
createOnClick(callback) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
return function () {
|
|
56
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
57
|
-
args[_key] = arguments[_key];
|
|
58
|
-
}
|
|
59
|
-
|
|
52
|
+
return (...args) => {
|
|
60
53
|
const {
|
|
61
54
|
hasNonPostEntityChanges,
|
|
62
55
|
setEntitiesSavedStatesCallback
|
|
63
|
-
} =
|
|
56
|
+
} = this.props; // If a post with non-post entities is published, but the user
|
|
64
57
|
// elects to not save changes to the non-post entities, those
|
|
65
58
|
// entities will still be dirty when the Publish button is clicked.
|
|
66
59
|
// We also need to check that the `setEntitiesSavedStatesCallback`
|
|
@@ -70,15 +63,14 @@ export class PostPublishButton extends Component {
|
|
|
70
63
|
// The modal for multiple entity saving will open,
|
|
71
64
|
// hold the callback for saving/publishing the post
|
|
72
65
|
// so that we can call it if the post entity is checked.
|
|
73
|
-
|
|
66
|
+
this.setState({
|
|
74
67
|
entitiesSavedStatesCallback: () => callback(...args)
|
|
75
68
|
}); // Open the save panel by setting its callback.
|
|
76
69
|
// To set a function on the useState hook, we must set it
|
|
77
70
|
// with another function (() => myFunction). Passing the
|
|
78
71
|
// function on its own will cause an error when called.
|
|
79
72
|
|
|
80
|
-
|
|
81
|
-
setEntitiesSavedStatesCallback(() => _this.closeEntitiesSavedStates);
|
|
73
|
+
setEntitiesSavedStatesCallback(() => this.closeEntitiesSavedStates);
|
|
82
74
|
return noop;
|
|
83
75
|
}
|
|
84
76
|
|
|
@@ -180,18 +172,18 @@ export class PostPublishButton extends Component {
|
|
|
180
172
|
});
|
|
181
173
|
const componentProps = isToggle ? toggleProps : buttonProps;
|
|
182
174
|
const componentChildren = isToggle ? toggleChildren : buttonChildren;
|
|
183
|
-
return createElement(Fragment, null, createElement(Button,
|
|
184
|
-
ref: this.buttonNode
|
|
185
|
-
|
|
175
|
+
return createElement(Fragment, null, createElement(Button, {
|
|
176
|
+
ref: this.buttonNode,
|
|
177
|
+
...componentProps,
|
|
186
178
|
className: classnames(componentProps.className, 'editor-post-publish-button__button', {
|
|
187
179
|
'has-changes-dot': hasNonPostEntityChanges
|
|
188
180
|
})
|
|
189
|
-
}
|
|
181
|
+
}, componentChildren));
|
|
190
182
|
}
|
|
191
183
|
|
|
192
184
|
}
|
|
193
185
|
export default compose([withSelect(select => {
|
|
194
|
-
var _getCurrentPost$_link
|
|
186
|
+
var _getCurrentPost$_link;
|
|
195
187
|
|
|
196
188
|
const {
|
|
197
189
|
isSavingPost,
|
|
@@ -220,7 +212,7 @@ export default compose([withSelect(select => {
|
|
|
220
212
|
isPostSavingLocked: isPostSavingLocked(),
|
|
221
213
|
isPublishable: isEditedPostPublishable(),
|
|
222
214
|
isPublished: isCurrentPostPublished(),
|
|
223
|
-
hasPublishAction: (_getCurrentPost$_link =
|
|
215
|
+
hasPublishAction: (_getCurrentPost$_link = getCurrentPost()._links?.['wp:action-publish']) !== null && _getCurrentPost$_link !== void 0 ? _getCurrentPost$_link : false,
|
|
224
216
|
postType: getCurrentPostType(),
|
|
225
217
|
postId: getCurrentPostId(),
|
|
226
218
|
hasNonPostEntityChanges: hasNonPostEntityChanges(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/components/post-publish-button/index.js"],"names":["classnames","Button","Component","createRef","withSelect","withDispatch","compose","__","PublishButtonLabel","store","editorStore","noop","PostPublishButton","constructor","props","buttonNode","createOnClick","bind","closeEntitiesSavedStates","state","entitiesSavedStatesCallback","componentDidMount","focusOnMount","timeoutID","setTimeout","current","focus","componentWillUnmount","clearTimeout","callback","args","hasNonPostEntityChanges","setEntitiesSavedStatesCallback","setState","savedEntities","postType","postId","some","elt","kind","name","key","render","forceIsDirty","forceIsSaving","hasPublishAction","isBeingScheduled","isOpen","isPostSavingLocked","isPublishable","isPublished","isSaveable","isSaving","isAutoSaving","isToggle","onSave","onStatusChange","onSubmit","onToggle","visibility","isSavingNonPostEntityChanges","isButtonDisabled","isToggleDisabled","publishStatus","onClickButton","onClickToggle","buttonProps","className","isBusy","variant","onClick","toggleProps","toggleChildren","buttonChildren","componentProps","componentChildren","select","isSavingPost","isAutosavingPost","isEditedPostBeingScheduled","getEditedPostVisibility","isCurrentPostPublished","isEditedPostSaveable","isEditedPostPublishable","getCurrentPost","getCurrentPostType","getCurrentPostId","_isAutoSaving","_links","dispatch","editPost","savePost","status","undoIgnore"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,MAAT,QAAuB,uBAAvB;AACA,SAASC,SAAT,EAAoBC,SAApB,QAAqC,oBAArC;AACA,SAASC,UAAT,EAAqBC,YAArB,QAAyC,iBAAzC;AACA,SAASC,OAAT,QAAwB,oBAAxB;AACA,SAASC,EAAT,QAAmB,iBAAnB;AAEA;AACA;AACA;;AACA,OAAOC,kBAAP,MAA+B,SAA/B;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,aAArC;;AAEA,MAAMC,IAAI,GAAG,MAAM,CAAE,CAArB;;AAEA,OAAO,MAAMC,iBAAN,SAAgCV,SAAhC,CAA0C;AAChDW,EAAAA,WAAW,CAAEC,KAAF,EAAU;AACpB,UAAOA,KAAP;AACA,SAAKC,UAAL,GAAkBZ,SAAS,EAA3B;AAEA,SAAKa,aAAL,GAAqB,KAAKA,aAAL,CAAmBC,IAAnB,CAAyB,IAAzB,CAArB;AACA,SAAKC,wBAAL,GACC,KAAKA,wBAAL,CAA8BD,IAA9B,CAAoC,IAApC,CADD;AAGA,SAAKE,KAAL,GAAa;AACZC,MAAAA,2BAA2B,EAAE;AADjB,KAAb;AAGA;;AAEDC,EAAAA,iBAAiB,GAAG;AACnB,QAAK,KAAKP,KAAL,CAAWQ,YAAhB,EAA+B;AAC9B;AACA;AACA;AACA,WAAKC,SAAL,GAAiBC,UAAU,CAAE,MAAM;AAClC,aAAKT,UAAL,CAAgBU,OAAhB,CAAwBC,KAAxB;AACA,OAF0B,EAExB,CAFwB,CAA3B;AAGA;AACD;;AAEDC,EAAAA,oBAAoB,GAAG;AACtBC,IA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EAAE;AAAd,KAAd,CAFH;AAGNtC,IAAAA,MAAM,EAAEoC;AAHF,GAAP;AAKA,CAPW,CAnCW,CAAF,CAAP,CA2CV/E,iBA3CU,CAAf","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { Button } from '@wordpress/components';\nimport { Component, createRef } from '@wordpress/element';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport PublishButtonLabel from './label';\nimport { store as editorStore } from '../../store';\n\nconst noop = () => {};\n\nexport class PostPublishButton extends Component {\n\tconstructor( props ) {\n\t\tsuper( props );\n\t\tthis.buttonNode = createRef();\n\n\t\tthis.createOnClick = this.createOnClick.bind( this );\n\t\tthis.closeEntitiesSavedStates =\n\t\t\tthis.closeEntitiesSavedStates.bind( this );\n\n\t\tthis.state = {\n\t\t\tentitiesSavedStatesCallback: false,\n\t\t};\n\t}\n\n\tcomponentDidMount() {\n\t\tif ( this.props.focusOnMount ) {\n\t\t\t// This timeout is necessary to make sure the `useEffect` hook of\n\t\t\t// `useFocusReturn` gets the correct element (the button that opens the\n\t\t\t// PostPublishPanel) otherwise it will get this button.\n\t\t\tthis.timeoutID = setTimeout( () => {\n\t\t\t\tthis.buttonNode.current.focus();\n\t\t\t}, 0 );\n\t\t}\n\t}\n\n\tcomponentWillUnmount() {\n\t\tclearTimeout( this.timeoutID );\n\t}\n\n\tcreateOnClick( callback ) {\n\t\treturn ( ...args ) => {\n\t\t\tconst { hasNonPostEntityChanges, setEntitiesSavedStatesCallback } =\n\t\t\t\tthis.props;\n\t\t\t// If a post with non-post entities is published, but the user\n\t\t\t// elects to not save changes to the non-post entities, those\n\t\t\t// entities will still be dirty when the Publish button is clicked.\n\t\t\t// We also need to check that the `setEntitiesSavedStatesCallback`\n\t\t\t// prop was passed. See https://github.com/WordPress/gutenberg/pull/37383\n\t\t\tif ( hasNonPostEntityChanges && setEntitiesSavedStatesCallback ) {\n\t\t\t\t// The modal for multiple entity saving will open,\n\t\t\t\t// hold the callback for saving/publishing the post\n\t\t\t\t// so that we can call it if the post entity is checked.\n\t\t\t\tthis.setState( {\n\t\t\t\t\tentitiesSavedStatesCallback: () => callback( ...args ),\n\t\t\t\t} );\n\n\t\t\t\t// Open the save panel by setting its callback.\n\t\t\t\t// To set a function on the useState hook, we must set it\n\t\t\t\t// with another function (() => myFunction). Passing the\n\t\t\t\t// function on its own will cause an error when called.\n\t\t\t\tsetEntitiesSavedStatesCallback(\n\t\t\t\t\t() => this.closeEntitiesSavedStates\n\t\t\t\t);\n\t\t\t\treturn noop;\n\t\t\t}\n\n\t\t\treturn callback( ...args );\n\t\t};\n\t}\n\n\tcloseEntitiesSavedStates( savedEntities ) {\n\t\tconst { postType, postId } = this.props;\n\t\tconst { entitiesSavedStatesCallback } = this.state;\n\t\tthis.setState( { entitiesSavedStatesCallback: false }, () => {\n\t\t\tif (\n\t\t\t\tsavedEntities &&\n\t\t\t\tsavedEntities.some(\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,\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:\n\t\t\t\tgetCurrentPost()._links?.[ 'wp:action-publish' ] ?? false,\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":["classnames","Button","Component","createRef","withSelect","withDispatch","compose","__","PublishButtonLabel","store","editorStore","noop","PostPublishButton","constructor","props","buttonNode","createOnClick","bind","closeEntitiesSavedStates","state","entitiesSavedStatesCallback","componentDidMount","focusOnMount","timeoutID","setTimeout","current","focus","componentWillUnmount","clearTimeout","callback","args","hasNonPostEntityChanges","setEntitiesSavedStatesCallback","setState","savedEntities","postType","postId","some","elt","kind","name","key","render","forceIsDirty","forceIsSaving","hasPublishAction","isBeingScheduled","isOpen","isPostSavingLocked","isPublishable","isPublished","isSaveable","isSaving","isAutoSaving","isToggle","onSave","onStatusChange","onSubmit","onToggle","visibility","isSavingNonPostEntityChanges","isButtonDisabled","isToggleDisabled","publishStatus","onClickButton","onClickToggle","buttonProps","className","isBusy","variant","onClick","toggleProps","toggleChildren","buttonChildren","componentProps","componentChildren","select","isSavingPost","isAutosavingPost","isEditedPostBeingScheduled","getEditedPostVisibility","isCurrentPostPublished","isEditedPostSaveable","isEditedPostPublishable","getCurrentPost","getCurrentPostType","getCurrentPostId","_isAutoSaving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ZK;AAaL6B,IAAAA;AAbK,MAcFgB,MAAM,CAAElE,WAAF,CAdV;;AAeA,QAAM6E,aAAa,GAAGT,gBAAgB,EAAtC;;AACA,SAAO;AACN1B,IAAAA,QAAQ,EAAEyB,YAAY,MAAMU,aADtB;AAENlC,IAAAA,YAAY,EAAEkC,aAFR;AAGNzC,IAAAA,gBAAgB,EAAEiC,0BAA0B,EAHtC;AAINpB,IAAAA,UAAU,EAAEqB,uBAAuB,EAJ7B;AAKN7B,IAAAA,UAAU,EAAE+B,oBAAoB,EAL1B;AAMNlC,IAAAA,kBAAkB,EAAEA,kBAAkB,EANhC;AAONC,IAAAA,aAAa,EAAEkC,uBAAuB,EAPhC;AAQNjC,IAAAA,WAAW,EAAE+B,sBAAsB,EAR7B;AASNpC,IAAAA,gBAAgB,2BACfuC,cAAc,GAAGI,MAAjB,GAA2B,mBAA3B,CADe,yEACqC,KAV/C;AAWNrD,IAAAA,QAAQ,EAAEkD,kBAAkB,EAXtB;AAYNjD,IAAAA,MAAM,EAAEkD,gBAAgB,EAZlB;AAaNvD,IAAAA,uBAAuB,EAAEA,uBAAuB,EAb1C;AAcN6B,IAAAA,4BAA4B,EAAEA,4BAA4B;AAdpD,GAAP;AAgBA,CAjCS,CADa,EAmCvBvD,YAAY,CAAIoF,QAAF,IAAgB;AAC7B,QAAM;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,MAAyBF,QAAQ,CAAE/E,WAAF,CAAvC;AACA,SAAO;AACN8C,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,CAPW,CAnCW,CAAF,CAAP,CA2CV/E,iBA3CU,CAAf","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { Button } from '@wordpress/components';\nimport { Component, createRef } from '@wordpress/element';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport PublishButtonLabel from './label';\nimport { store as editorStore } from '../../store';\n\nconst noop = () => {};\n\nexport class PostPublishButton extends Component {\n\tconstructor( props ) {\n\t\tsuper( props );\n\t\tthis.buttonNode = createRef();\n\n\t\tthis.createOnClick = this.createOnClick.bind( this );\n\t\tthis.closeEntitiesSavedStates =\n\t\t\tthis.closeEntitiesSavedStates.bind( this );\n\n\t\tthis.state = {\n\t\t\tentitiesSavedStatesCallback: false,\n\t\t};\n\t}\n\n\tcomponentDidMount() {\n\t\tif ( this.props.focusOnMount ) {\n\t\t\t// This timeout is necessary to make sure the `useEffect` hook of\n\t\t\t// `useFocusReturn` gets the correct element (the button that opens the\n\t\t\t// PostPublishPanel) otherwise it will get this button.\n\t\t\tthis.timeoutID = setTimeout( () => {\n\t\t\t\tthis.buttonNode.current.focus();\n\t\t\t}, 0 );\n\t\t}\n\t}\n\n\tcomponentWillUnmount() {\n\t\tclearTimeout( this.timeoutID );\n\t}\n\n\tcreateOnClick( callback ) {\n\t\treturn ( ...args ) => {\n\t\t\tconst { hasNonPostEntityChanges, setEntitiesSavedStatesCallback } =\n\t\t\t\tthis.props;\n\t\t\t// If a post with non-post entities is published, but the user\n\t\t\t// elects to not save changes to the non-post entities, those\n\t\t\t// entities will still be dirty when the Publish button is clicked.\n\t\t\t// We also need to check that the `setEntitiesSavedStatesCallback`\n\t\t\t// prop was passed. See https://github.com/WordPress/gutenberg/pull/37383\n\t\t\tif ( hasNonPostEntityChanges && setEntitiesSavedStatesCallback ) {\n\t\t\t\t// The modal for multiple entity saving will open,\n\t\t\t\t// hold the callback for saving/publishing the post\n\t\t\t\t// so that we can call it if the post entity is checked.\n\t\t\t\tthis.setState( {\n\t\t\t\t\tentitiesSavedStatesCallback: () => callback( ...args ),\n\t\t\t\t} );\n\n\t\t\t\t// Open the save panel by setting its callback.\n\t\t\t\t// To set a function on the useState hook, we must set it\n\t\t\t\t// with another function (() => myFunction). Passing the\n\t\t\t\t// function on its own will cause an error when called.\n\t\t\t\tsetEntitiesSavedStatesCallback(\n\t\t\t\t\t() => this.closeEntitiesSavedStates\n\t\t\t\t);\n\t\t\t\treturn noop;\n\t\t\t}\n\n\t\t\treturn callback( ...args );\n\t\t};\n\t}\n\n\tcloseEntitiesSavedStates( savedEntities ) {\n\t\tconst { postType, postId } = this.props;\n\t\tconst { entitiesSavedStatesCallback } = this.state;\n\t\tthis.setState( { entitiesSavedStatesCallback: false }, () => {\n\t\t\tif (\n\t\t\t\tsavedEntities &&\n\t\t\t\tsavedEntities.some(\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,\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:\n\t\t\t\tgetCurrentPost()._links?.[ 'wp:action-publish' ] ?? false,\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"]}
|
|
@@ -9,17 +9,15 @@ import { withSelect } from '@wordpress/data';
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import { store as editorStore } from '../../store';
|
|
12
|
-
export function PublishButtonLabel(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
} = _ref;
|
|
22
|
-
|
|
12
|
+
export function PublishButtonLabel({
|
|
13
|
+
isPublished,
|
|
14
|
+
isBeingScheduled,
|
|
15
|
+
isSaving,
|
|
16
|
+
isPublishing,
|
|
17
|
+
hasPublishAction,
|
|
18
|
+
isAutosaving,
|
|
19
|
+
hasNonPostEntityChanges
|
|
20
|
+
}) {
|
|
23
21
|
if (isPublishing) {
|
|
24
22
|
/* translators: button label text should, if possible, be under 16 characters. */
|
|
25
23
|
return __('Publishing…');
|
|
@@ -41,12 +39,11 @@ export function PublishButtonLabel(_ref) {
|
|
|
41
39
|
|
|
42
40
|
return __('Publish');
|
|
43
41
|
}
|
|
44
|
-
export default compose([withSelect((select,
|
|
45
|
-
|
|
42
|
+
export default compose([withSelect((select, {
|
|
43
|
+
forceIsSaving
|
|
44
|
+
}) => {
|
|
45
|
+
var _getCurrentPost$_link;
|
|
46
46
|
|
|
47
|
-
let {
|
|
48
|
-
forceIsSaving
|
|
49
|
-
} = _ref2;
|
|
50
47
|
const {
|
|
51
48
|
isCurrentPostPublished,
|
|
52
49
|
isEditedPostBeingScheduled,
|
|
@@ -61,7 +58,7 @@ export default compose([withSelect((select, _ref2) => {
|
|
|
61
58
|
isBeingScheduled: isEditedPostBeingScheduled(),
|
|
62
59
|
isSaving: forceIsSaving || isSavingPost(),
|
|
63
60
|
isPublishing: isPublishingPost(),
|
|
64
|
-
hasPublishAction: (_getCurrentPost$_link =
|
|
61
|
+
hasPublishAction: (_getCurrentPost$_link = getCurrentPost()._links?.['wp:action-publish']) !== null && _getCurrentPost$_link !== void 0 ? _getCurrentPost$_link : false,
|
|
65
62
|
postType: getCurrentPostType(),
|
|
66
63
|
isAutosaving: isAutosavingPost()
|
|
67
64
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/components/post-publish-button/label.js"],"names":["__","compose","withSelect","store","editorStore","PublishButtonLabel","isPublished","isBeingScheduled","isSaving","isPublishing","hasPublishAction","isAutosaving","hasNonPostEntityChanges","select","forceIsSaving","isCurrentPostPublished","isEditedPostBeingScheduled","isSavingPost","isPublishingPost","getCurrentPost","getCurrentPostType","isAutosavingPost","_links","postType"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,OAAT,QAAwB,oBAAxB;AACA,SAASC,UAAT,QAA2B,iBAA3B;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,aAArC;AAEA,OAAO,SAASC,kBAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/components/post-publish-button/label.js"],"names":["__","compose","withSelect","store","editorStore","PublishButtonLabel","isPublished","isBeingScheduled","isSaving","isPublishing","hasPublishAction","isAutosaving","hasNonPostEntityChanges","select","forceIsSaving","isCurrentPostPublished","isEditedPostBeingScheduled","isSavingPost","isPublishingPost","getCurrentPost","getCurrentPostType","isAutosavingPost","_links","postType"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,OAAT,QAAwB,oBAAxB;AACA,SA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;AAMLC,IAAAA,kBANK;AAOLC,IAAAA;AAPK,MAQFR,MAAM,CAAET,WAAF,CARV;AASA,SAAO;AACNE,IAAAA,WAAW,EAAES,sBAAsB,EAD7B;AAENR,IAAAA,gBAAgB,EAAES,0BAA0B,EAFtC;AAGNR,IAAAA,QAAQ,EAAEM,aAAa,IAAIG,YAAY,EAHjC;AAINR,IAAAA,YAAY,EAAES,gBAAgB,EAJxB;AAKNR,IAAAA,gBAAgB,2BACfS,cAAc,GAAGG,MAAjB,GAA2B,mBAA3B,CADe,yEACqC,KAN/C;AAONC,IAAAA,QAAQ,EAAEH,kBAAkB,EAPtB;AAQNT,IAAAA,YAAY,EAAEU,gBAAgB;AARxB,GAAP;AAUA,CApBS,CADa,CAAF,CAAP,CAsBVhB,kBAtBU,CAAf","sourcesContent":["/**\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:\n\t\t\t\tgetCurrentPost()._links?.[ 'wp:action-publish' ] ?? false,\n\t\t\tpostType: getCurrentPostType(),\n\t\t\tisAutosaving: isAutosavingPost(),\n\t\t};\n\t} ),\n] )( PublishButtonLabel );\n"]}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
1
|
import { createElement, Fragment } from "@wordpress/element";
|
|
3
2
|
|
|
4
3
|
/**
|
|
@@ -70,9 +69,10 @@ export class PostPublishPanel extends Component {
|
|
|
70
69
|
const isPublishedOrScheduled = isPublished || isScheduled && isBeingScheduled;
|
|
71
70
|
const isPrePublish = !isPublishedOrScheduled && !isSaving;
|
|
72
71
|
const isPostPublish = isPublishedOrScheduled && !isSaving;
|
|
73
|
-
return createElement("div",
|
|
74
|
-
className: "editor-post-publish-panel"
|
|
75
|
-
|
|
72
|
+
return createElement("div", {
|
|
73
|
+
className: "editor-post-publish-panel",
|
|
74
|
+
...propsForPanel
|
|
75
|
+
}, createElement("div", {
|
|
76
76
|
className: "editor-post-publish-panel__header"
|
|
77
77
|
}, isPostPublish ? createElement(Button, {
|
|
78
78
|
onClick: onClose,
|
|
@@ -107,7 +107,7 @@ export class PostPublishPanel extends Component {
|
|
|
107
107
|
|
|
108
108
|
}
|
|
109
109
|
export default compose([withSelect(select => {
|
|
110
|
-
var _getCurrentPost$_link
|
|
110
|
+
var _getCurrentPost$_link;
|
|
111
111
|
|
|
112
112
|
const {
|
|
113
113
|
getPostType
|
|
@@ -127,8 +127,8 @@ export default compose([withSelect(select => {
|
|
|
127
127
|
} = select(editorStore);
|
|
128
128
|
const postType = getPostType(getEditedPostAttribute('type'));
|
|
129
129
|
return {
|
|
130
|
-
hasPublishAction: (_getCurrentPost$_link =
|
|
131
|
-
isPostTypeViewable: postType
|
|
130
|
+
hasPublishAction: (_getCurrentPost$_link = getCurrentPost()._links?.['wp:action-publish']) !== null && _getCurrentPost$_link !== void 0 ? _getCurrentPost$_link : false,
|
|
131
|
+
isPostTypeViewable: postType?.viewable,
|
|
132
132
|
isBeingScheduled: isEditedPostBeingScheduled(),
|
|
133
133
|
isDirty: isEditedPostDirty(),
|
|
134
134
|
isPublished: isCurrentPostPublished(),
|
|
@@ -137,10 +137,9 @@ export default compose([withSelect(select => {
|
|
|
137
137
|
isSavingNonPostEntityChanges: isSavingNonPostEntityChanges(),
|
|
138
138
|
isScheduled: isCurrentPostScheduled()
|
|
139
139
|
};
|
|
140
|
-
}), withDispatch((dispatch,
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
} = _ref;
|
|
140
|
+
}), withDispatch((dispatch, {
|
|
141
|
+
isPublishSidebarEnabled
|
|
142
|
+
}) => {
|
|
144
143
|
const {
|
|
145
144
|
disablePublishSidebar,
|
|
146
145
|
enablePublishSidebar
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/components/post-publish-panel/index.js"],"names":["__","Component","Button","Spinner","CheckboxControl","withFocusReturn","withConstrainedTabbing","withSelect","withDispatch","compose","closeSmall","store","coreStore","PostPublishButton","PostPublishPanelPrepublish","PostPublishPanelPostpublish","editorStore","PostPublishPanel","constructor","arguments","onSubmit","bind","componentDidUpdate","prevProps","isPublished","props","isSaving","isDirty","onClose","hasPublishAction","isPostTypeViewable","render","forceIsDirty","forceIsSaving","isBeingScheduled","isPublishSidebarEnabled","isScheduled","isSavingNonPostEntityChanges","onTogglePublishSidebar","PostPublishExtension","PrePublishExtension","additionalProps","propsForPanel","isPublishedOrScheduled","isPrePublish","isPostPublish","select","getPostType","getCurrentPost","getEditedPostAttribute","isCurrentPostPublished","isCurrentPostScheduled","isEditedPostBeingScheduled","isEditedPostDirty","isSavingPost","postType","_links","viewable","dispatch","disablePublishSidebar","enablePublishSidebar"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,SAAT,QAA0B,oBAA1B;AACA,SACCC,MADD,EAECC,OAFD,EAGCC,eAHD,EAICC,eAJD,EAKCC,sBALD,QAMO,uBANP;AAOA,SAASC,UAAT,EAAqBC,YAArB,QAAyC,iBAAzC;AACA,SAASC,OAAT,QAAwB,oBAAxB;AACA,SAASC,UAAT,QAA2B,kBAA3B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,OAAOC,iBAAP,MAA8B,wBAA9B;AACA,OAAOC,0BAAP,MAAuC,cAAvC;AACA,OAAOC,2BAAP,MAAwC,eAAxC;AACA,SAASJ,KAAK,IAAIK,WAAlB,QAAqC,aAArC;AAEA,OAAO,MAAMC,gBAAN,SAA+BhB,SAA/B,CAAyC;AAC/CiB,EAAAA,WAAW,GAAG;AACb,UAAO,GAAGC,SAAV;AACA,SAAKC,QAAL,GAAgB,KAAKA,QAAL,CAAcC,IAAd,CAAoB,IAApB,CAAhB;AACA;;AAEDC,EAAAA,kBAAkB,CAAEC,SAAF,EAAc;AAC/B;AACA;AACA,QACCA,SAAS,CAACC,WAAV,IACA,CAAE,KAAKC,KAAL,CAAWC,QADb,IAEA,KAAKD,KAAL,CAAWE,OAHZ,EAIE;AACD,WAAKF,KAAL,CAAWG,OAAX;AACA;AACD;;AAEDR,EAAAA,QAAQ,G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ACfmB,cAAc,GAAGQ,MADF,2DACf,uBAA2B,mBAA3B,CADe,yEACqC,KAF/C;AAGN1B,IAAAA,kBAAkB,EAAEyB,QAAF,aAAEA,QAAF,uBAAEA,QAAQ,CAAEE,QAHxB;AAINvB,IAAAA,gBAAgB,EAAEkB,0BAA0B,EAJtC;AAKNzB,IAAAA,OAAO,EAAE0B,iBAAiB,EALpB;AAMN7B,IAAAA,WAAW,EAAE0B,sBAAsB,EAN7B;AAONf,IAAAA,uBAAuB,EAAEA,uBAAuB,EAP1C;AAQNT,IAAAA,QAAQ,EAAE4B,YAAY,EARhB;AASNjB,IAAAA,4BAA4B,EAAEA,4BAA4B,EATpD;AAUND,IAAAA,WAAW,EAAEe,sBAAsB;AAV7B,GAAP;AAYA,CA3BS,CADa,EA6BvB3C,YAAY,CAAE,CAAEkD,QAAF,WAA6C;AAAA,MAAjC;AAAEvB,IAAAA;AAAF,GAAiC;AAC1D,QAAM;AAAEwB,IAAAA,qBAAF;AAAyBC,IAAAA;AAAzB,MACLF,QAAQ,CAAE1C,WAAF,CADT;AAEA,SAAO;AACNsB,IAAAA,sBAAsB,EAAE,MAAM;AAC7B,UAAKH,uBAAL,EAA+B;AAC9BwB,QAAAA,qBAAqB;AACrB,OAFD,MAEO;AACNC,QAAAA,oBAAoB;AACpB;AACD;AAPK,GAAP;AASA,CAZW,CA7BW,EA0CvBvD,eA1CuB,EA2CvBC,sBA3CuB,CAAF,CAAP,CA4CVW,gBA5CU,CAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Component } from '@wordpress/element';\nimport {\n\tButton,\n\tSpinner,\n\tCheckboxControl,\n\twithFocusReturn,\n\twithConstrainedTabbing,\n} from '@wordpress/components';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\nimport { closeSmall } from '@wordpress/icons';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport PostPublishButton from '../post-publish-button';\nimport PostPublishPanelPrepublish from './prepublish';\nimport PostPublishPanelPostpublish from './postpublish';\nimport { store as editorStore } from '../../store';\n\nexport class PostPublishPanel extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\t\tthis.onSubmit = this.onSubmit.bind( this );\n\t}\n\n\tcomponentDidUpdate( prevProps ) {\n\t\t// Automatically collapse the publish sidebar when a post\n\t\t// is published and the user makes an edit.\n\t\tif (\n\t\t\tprevProps.isPublished &&\n\t\t\t! this.props.isSaving &&\n\t\t\tthis.props.isDirty\n\t\t) {\n\t\t\tthis.props.onClose();\n\t\t}\n\t}\n\n\tonSubmit() {\n\t\tconst { onClose, hasPublishAction, isPostTypeViewable } = this.props;\n\t\tif ( ! hasPublishAction || ! isPostTypeViewable ) {\n\t\t\tonClose();\n\t\t}\n\t}\n\n\trender() {\n\t\tconst {\n\t\t\tforceIsDirty,\n\t\t\tforceIsSaving,\n\t\t\tisBeingScheduled,\n\t\t\tisPublished,\n\t\t\tisPublishSidebarEnabled,\n\t\t\tisScheduled,\n\t\t\tisSaving,\n\t\t\tisSavingNonPostEntityChanges,\n\t\t\tonClose,\n\t\t\tonTogglePublishSidebar,\n\t\t\tPostPublishExtension,\n\t\t\tPrePublishExtension,\n\t\t\t...additionalProps\n\t\t} = this.props;\n\t\tconst {\n\t\t\thasPublishAction,\n\t\t\tisDirty,\n\t\t\tisPostTypeViewable,\n\t\t\t...propsForPanel\n\t\t} = additionalProps;\n\t\tconst isPublishedOrScheduled =\n\t\t\tisPublished || ( isScheduled && isBeingScheduled );\n\t\tconst isPrePublish = ! isPublishedOrScheduled && ! isSaving;\n\t\tconst isPostPublish = isPublishedOrScheduled && ! isSaving;\n\t\treturn (\n\t\t\t<div className=\"editor-post-publish-panel\" { ...propsForPanel }>\n\t\t\t\t<div className=\"editor-post-publish-panel__header\">\n\t\t\t\t\t{ isPostPublish ? (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tonClick={ onClose }\n\t\t\t\t\t\t\ticon={ closeSmall }\n\t\t\t\t\t\t\tlabel={ __( 'Close panel' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<div className=\"editor-post-publish-panel__header-publish-button\">\n\t\t\t\t\t\t\t\t<PostPublishButton\n\t\t\t\t\t\t\t\t\tfocusOnMount={ true }\n\t\t\t\t\t\t\t\t\tonSubmit={ this.onSubmit }\n\t\t\t\t\t\t\t\t\tforceIsDirty={ forceIsDirty }\n\t\t\t\t\t\t\t\t\tforceIsSaving={ forceIsSaving }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<div className=\"editor-post-publish-panel__header-cancel-button\">\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tdisabled={ isSavingNonPostEntityChanges }\n\t\t\t\t\t\t\t\t\tonClick={ onClose }\n\t\t\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t\t<div className=\"editor-post-publish-panel__content\">\n\t\t\t\t\t{ isPrePublish && (\n\t\t\t\t\t\t<PostPublishPanelPrepublish>\n\t\t\t\t\t\t\t{ PrePublishExtension && <PrePublishExtension /> }\n\t\t\t\t\t\t</PostPublishPanelPrepublish>\n\t\t\t\t\t) }\n\t\t\t\t\t{ isPostPublish && (\n\t\t\t\t\t\t<PostPublishPanelPostpublish focusOnMount={ true }>\n\t\t\t\t\t\t\t{ PostPublishExtension && <PostPublishExtension /> }\n\t\t\t\t\t\t</PostPublishPanelPostpublish>\n\t\t\t\t\t) }\n\t\t\t\t\t{ isSaving && <Spinner /> }\n\t\t\t\t</div>\n\t\t\t\t<div className=\"editor-post-publish-panel__footer\">\n\t\t\t\t\t<CheckboxControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Always show pre-publish checks.' ) }\n\t\t\t\t\t\tchecked={ isPublishSidebarEnabled }\n\t\t\t\t\t\tonChange={ onTogglePublishSidebar }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t);\n\t}\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst { getPostType } = select( coreStore );\n\t\tconst {\n\t\t\tgetCurrentPost,\n\t\t\tgetEditedPostAttribute,\n\t\t\tisCurrentPostPublished,\n\t\t\tisCurrentPostScheduled,\n\t\t\tisEditedPostBeingScheduled,\n\t\t\tisEditedPostDirty,\n\t\t\tisSavingPost,\n\t\t\tisSavingNonPostEntityChanges,\n\t\t} = select( editorStore );\n\t\tconst { isPublishSidebarEnabled } = select( editorStore );\n\t\tconst postType = getPostType( getEditedPostAttribute( 'type' ) );\n\n\t\treturn {\n\t\t\thasPublishAction:\n\t\t\t\tgetCurrentPost()._links?.[ 'wp:action-publish' ] ?? false,\n\t\t\tisPostTypeViewable: postType?.viewable,\n\t\t\tisBeingScheduled: isEditedPostBeingScheduled(),\n\t\t\tisDirty: isEditedPostDirty(),\n\t\t\tisPublished: isCurrentPostPublished(),\n\t\t\tisPublishSidebarEnabled: isPublishSidebarEnabled(),\n\t\t\tisSaving: isSavingPost(),\n\t\t\tisSavingNonPostEntityChanges: isSavingNonPostEntityChanges(),\n\t\t\tisScheduled: isCurrentPostScheduled(),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch, { isPublishSidebarEnabled } ) => {\n\t\tconst { disablePublishSidebar, enablePublishSidebar } =\n\t\t\tdispatch( editorStore );\n\t\treturn {\n\t\t\tonTogglePublishSidebar: () => {\n\t\t\t\tif ( isPublishSidebarEnabled ) {\n\t\t\t\t\tdisablePublishSidebar();\n\t\t\t\t} else {\n\t\t\t\t\tenablePublishSidebar();\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t} ),\n\twithFocusReturn,\n\twithConstrainedTabbing,\n] )( PostPublishPanel );\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/components/post-publish-panel/index.js"],"names":["__","Component","Button","Spinner","CheckboxControl","withFocusReturn","withConstrainedTabbing","withSelect","withDispatch","compose","closeSmall","store","coreStore","PostPublishButton","PostPublishPanelPrepublish","PostPublishPanelPostpublish","editorStore","PostPublishPanel","constructor","arguments","onSubmit","bind","componentDidUpdate","prevProps","isPublished","props","isSaving","isDirty","onClose","hasPublishAction","isPostTypeViewable","render","forceIsDirty","forceIsSaving","isBeingScheduled","isPublishSidebarEnabled","isScheduled","isSavingNonPostEntityChanges","onTogglePublishSidebar","PostPublishExtension","PrePublishExtension","additionalProps","propsForPanel","isPublishedOrScheduled","isPrePublish","isPostPublish","select","getPostType","getCurrentPost","getEditedPostAttribute","isCurrentPostPublished","isCurrentPostScheduled","isEditedPostBeingScheduled","isEditedPostDirty","isSavingPost","postType","_links","viewable","dispatch","disablePublishSidebar","enablePublishSidebar"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,SAAT,QAA0B,oBAA1B;AACA,SACCC,MADD,EAECC,OAFD,EAGCC,eAHD,EAICC,eAJD,EAKCC,sBALD,QAMO,uBANP;AAOA,SAASC,UAAT,EAAqBC,YAArB,QAAyC,iBAAzC;AACA,SAASC,OAAT,QAAwB,oBAAxB;AACA,SAASC,UAAT,QAA2B,kBAA3B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,OAAOC,iBAAP,MAA8B,wBAA9B;AACA,OAAOC,0BAAP,MAAuC,cAAvC;AACA,OAAOC,2BAAP,MAAwC,eAAxC;AACA,SAASJ,KAAK,IAAIK,WAAlB,QAAqC,aAArC;AAEA,OAAO,MAAMC,gBAAN,SAA+BhB,SAA/B,CAAyC;AAC/CiB,EAAAA,WAAW,GAAG;AACb,UAAO,GAAG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} from '@wordpress/i18n';\nimport { Component } from '@wordpress/element';\nimport {\n\tButton,\n\tSpinner,\n\tCheckboxControl,\n\twithFocusReturn,\n\twithConstrainedTabbing,\n} from '@wordpress/components';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\nimport { closeSmall } from '@wordpress/icons';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport PostPublishButton from '../post-publish-button';\nimport PostPublishPanelPrepublish from './prepublish';\nimport PostPublishPanelPostpublish from './postpublish';\nimport { store as editorStore } from '../../store';\n\nexport class PostPublishPanel extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\t\tthis.onSubmit = this.onSubmit.bind( this );\n\t}\n\n\tcomponentDidUpdate( prevProps ) {\n\t\t// Automatically collapse the publish sidebar when a post\n\t\t// is published and the user makes an edit.\n\t\tif (\n\t\t\tprevProps.isPublished &&\n\t\t\t! this.props.isSaving &&\n\t\t\tthis.props.isDirty\n\t\t) {\n\t\t\tthis.props.onClose();\n\t\t}\n\t}\n\n\tonSubmit() {\n\t\tconst { onClose, hasPublishAction, isPostTypeViewable } = this.props;\n\t\tif ( ! hasPublishAction || ! isPostTypeViewable ) {\n\t\t\tonClose();\n\t\t}\n\t}\n\n\trender() {\n\t\tconst {\n\t\t\tforceIsDirty,\n\t\t\tforceIsSaving,\n\t\t\tisBeingScheduled,\n\t\t\tisPublished,\n\t\t\tisPublishSidebarEnabled,\n\t\t\tisScheduled,\n\t\t\tisSaving,\n\t\t\tisSavingNonPostEntityChanges,\n\t\t\tonClose,\n\t\t\tonTogglePublishSidebar,\n\t\t\tPostPublishExtension,\n\t\t\tPrePublishExtension,\n\t\t\t...additionalProps\n\t\t} = this.props;\n\t\tconst {\n\t\t\thasPublishAction,\n\t\t\tisDirty,\n\t\t\tisPostTypeViewable,\n\t\t\t...propsForPanel\n\t\t} = additionalProps;\n\t\tconst isPublishedOrScheduled =\n\t\t\tisPublished || ( isScheduled && isBeingScheduled );\n\t\tconst isPrePublish = ! isPublishedOrScheduled && ! isSaving;\n\t\tconst isPostPublish = isPublishedOrScheduled && ! isSaving;\n\t\treturn (\n\t\t\t<div className=\"editor-post-publish-panel\" { ...propsForPanel }>\n\t\t\t\t<div className=\"editor-post-publish-panel__header\">\n\t\t\t\t\t{ isPostPublish ? (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tonClick={ onClose }\n\t\t\t\t\t\t\ticon={ closeSmall }\n\t\t\t\t\t\t\tlabel={ __( 'Close panel' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<div className=\"editor-post-publish-panel__header-publish-button\">\n\t\t\t\t\t\t\t\t<PostPublishButton\n\t\t\t\t\t\t\t\t\tfocusOnMount={ true }\n\t\t\t\t\t\t\t\t\tonSubmit={ this.onSubmit }\n\t\t\t\t\t\t\t\t\tforceIsDirty={ forceIsDirty }\n\t\t\t\t\t\t\t\t\tforceIsSaving={ forceIsSaving }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<div className=\"editor-post-publish-panel__header-cancel-button\">\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tdisabled={ isSavingNonPostEntityChanges }\n\t\t\t\t\t\t\t\t\tonClick={ onClose }\n\t\t\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t\t<div className=\"editor-post-publish-panel__content\">\n\t\t\t\t\t{ isPrePublish && (\n\t\t\t\t\t\t<PostPublishPanelPrepublish>\n\t\t\t\t\t\t\t{ PrePublishExtension && <PrePublishExtension /> }\n\t\t\t\t\t\t</PostPublishPanelPrepublish>\n\t\t\t\t\t) }\n\t\t\t\t\t{ isPostPublish && (\n\t\t\t\t\t\t<PostPublishPanelPostpublish focusOnMount={ true }>\n\t\t\t\t\t\t\t{ PostPublishExtension && <PostPublishExtension /> }\n\t\t\t\t\t\t</PostPublishPanelPostpublish>\n\t\t\t\t\t) }\n\t\t\t\t\t{ isSaving && <Spinner /> }\n\t\t\t\t</div>\n\t\t\t\t<div className=\"editor-post-publish-panel__footer\">\n\t\t\t\t\t<CheckboxControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Always show pre-publish checks.' ) }\n\t\t\t\t\t\tchecked={ isPublishSidebarEnabled }\n\t\t\t\t\t\tonChange={ onTogglePublishSidebar }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t);\n\t}\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst { getPostType } = select( coreStore );\n\t\tconst {\n\t\t\tgetCurrentPost,\n\t\t\tgetEditedPostAttribute,\n\t\t\tisCurrentPostPublished,\n\t\t\tisCurrentPostScheduled,\n\t\t\tisEditedPostBeingScheduled,\n\t\t\tisEditedPostDirty,\n\t\t\tisSavingPost,\n\t\t\tisSavingNonPostEntityChanges,\n\t\t} = select( editorStore );\n\t\tconst { isPublishSidebarEnabled } = select( editorStore );\n\t\tconst postType = getPostType( getEditedPostAttribute( 'type' ) );\n\n\t\treturn {\n\t\t\thasPublishAction:\n\t\t\t\tgetCurrentPost()._links?.[ 'wp:action-publish' ] ?? false,\n\t\t\tisPostTypeViewable: postType?.viewable,\n\t\t\tisBeingScheduled: isEditedPostBeingScheduled(),\n\t\t\tisDirty: isEditedPostDirty(),\n\t\t\tisPublished: isCurrentPostPublished(),\n\t\t\tisPublishSidebarEnabled: isPublishSidebarEnabled(),\n\t\t\tisSaving: isSavingPost(),\n\t\t\tisSavingNonPostEntityChanges: isSavingNonPostEntityChanges(),\n\t\t\tisScheduled: isCurrentPostScheduled(),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch, { isPublishSidebarEnabled } ) => {\n\t\tconst { disablePublishSidebar, enablePublishSidebar } =\n\t\t\tdispatch( editorStore );\n\t\treturn {\n\t\t\tonTogglePublishSidebar: () => {\n\t\t\t\tif ( isPublishSidebarEnabled ) {\n\t\t\t\t\tdisablePublishSidebar();\n\t\t\t\t} else {\n\t\t\t\t\tenablePublishSidebar();\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t} ),\n\twithFocusReturn,\n\twithConstrainedTabbing,\n] )( PostPublishPanel );\n"]}
|
|
@@ -17,8 +17,6 @@ import { store as editorStore } from '../../store';
|
|
|
17
17
|
|
|
18
18
|
function MaybeCategoryPanel() {
|
|
19
19
|
const hasNoCategory = useSelect(select => {
|
|
20
|
-
var _getEntityRecord;
|
|
21
|
-
|
|
22
20
|
const postType = select(editorStore).getCurrentPostType();
|
|
23
21
|
const {
|
|
24
22
|
canUser,
|
|
@@ -26,14 +24,14 @@ function MaybeCategoryPanel() {
|
|
|
26
24
|
getTaxonomy
|
|
27
25
|
} = select(coreStore);
|
|
28
26
|
const categoriesTaxonomy = getTaxonomy('category');
|
|
29
|
-
const defaultCategoryId = canUser('read', 'settings') ?
|
|
27
|
+
const defaultCategoryId = canUser('read', 'settings') ? getEntityRecord('root', 'site')?.default_category : undefined;
|
|
30
28
|
const defaultCategory = defaultCategoryId ? getEntityRecord('taxonomy', 'category', defaultCategoryId) : undefined;
|
|
31
29
|
const postTypeSupportsCategories = categoriesTaxonomy && categoriesTaxonomy.types.some(type => type === postType);
|
|
32
30
|
const categories = categoriesTaxonomy && select(editorStore).getEditedPostAttribute(categoriesTaxonomy.rest_base); // This boolean should return true if everything is loaded
|
|
33
31
|
// ( categoriesTaxonomy, defaultCategory )
|
|
34
32
|
// and the post has not been assigned a category different than "uncategorized".
|
|
35
33
|
|
|
36
|
-
return !!categoriesTaxonomy && !!defaultCategory && postTypeSupportsCategories && (
|
|
34
|
+
return !!categoriesTaxonomy && !!defaultCategory && postTypeSupportsCategories && (categories?.length === 0 || categories?.length === 1 && defaultCategory?.id === categories[0]);
|
|
37
35
|
}, []);
|
|
38
36
|
const [shouldShowPanel, setShouldShowPanel] = useState(false);
|
|
39
37
|
useEffect(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/components/post-publish-panel/maybe-category-panel.js"],"names":["__","useSelect","PanelBody","store","coreStore","useState","useEffect","HierarchicalTermSelector","editorStore","MaybeCategoryPanel","hasNoCategory","select","postType","getCurrentPostType","canUser","getEntityRecord","getTaxonomy","categoriesTaxonomy","defaultCategoryId","default_category","undefined","defaultCategory","postTypeSupportsCategories","types","some","type","categories","getEditedPostAttribute","rest_base","length","id","shouldShowPanel","setShouldShowPanel","panelBodyTitle"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,SAAT,QAA0B,uBAA1B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SAASC,QAAT,EAAmBC,SAAnB,QAAoC,oBAApC;AAEA;AACA;AACA;;AACA,OAAOC,wBAAP,MAAqC,+CAArC;AACA,SAASJ,KAAK,IAAIK,WAAlB,QAAqC,aAArC;;AAEA,SAASC,kBAAT,GAA8B;AAC7B,QAAMC,aAAa,GAAGT,SAAS,CAAIU,MAAF,IAAc;
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/components/post-publish-panel/maybe-category-panel.js"],"names":["__","useSelect","PanelBody","store","coreStore","useState","useEffect","HierarchicalTermSelector","editorStore","MaybeCategoryPanel","hasNoCategory","select","postType","getCurrentPostType","canUser","getEntityRecord","getTaxonomy","categoriesTaxonomy","defaultCategoryId","default_category","undefined","defaultCategory","postTypeSupportsCategories","types","some","type","categories","getEditedPostAttribute","rest_base","length","id","shouldShowPanel","setShouldShowPanel","panelBodyTitle"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QA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AEG,MAAZ,KAAuB,CAAvB,IACDR,eAAe,EAAES,EAAjB,KAAwBJ,UAAU,CAAE,CAAF,CALpC,CADD;AAQA,GA9B8B,EA8B5B,EA9B4B,CAA/B;AA+BA,QAAM,CAAEK,eAAF,EAAmBC,kBAAnB,IAA0C3B,QAAQ,CAAE,KAAF,CAAxD;AACAC,EAAAA,SAAS,CAAE,MAAM;AAChB;AACA;AACA,QAAKI,aAAL,EAAqB;AACpBsB,MAAAA,kBAAkB,CAAE,IAAF,CAAlB;AACA;AACD,GANQ,EAMN,CAAEtB,aAAF,CANM,CAAT;;AAQA,MAAK,CAAEqB,eAAP,EAAyB;AACxB,WAAO,IAAP;AACA;;AAED,QAAME,cAAc,GAAG,CACtBjC,EAAE,CAAE,aAAF,CADoB,EAEtB;AAAM,IAAA,SAAS,EAAC,iCAAhB;AAAkD,IAAA,GAAG,EAAC;AAAtD,KACGA,EAAE,CAAE,mBAAF,CADL,CAFsB,CAAvB;AAOA,SACC,cAAC,SAAD;AAAW,IAAA,WAAW,EAAG,KAAzB;AAAiC,IAAA,KAAK,EAAGiC;AAAzC,KACC,yBACGjC,EAAE,CACH,oHADG,CADL,CADD,EAMC,cAAC,wBAAD;AAA0B,IAAA,IAAI,EAAC;AAA/B,IAND,CADD;AAUA;;AAED,eAAeS,kBAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { PanelBody } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useState, useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport HierarchicalTermSelector from '../post-taxonomies/hierarchical-term-selector';\nimport { store as editorStore } from '../../store';\n\nfunction MaybeCategoryPanel() {\n\tconst hasNoCategory = useSelect( ( select ) => {\n\t\tconst postType = select( editorStore ).getCurrentPostType();\n\t\tconst { canUser, getEntityRecord, getTaxonomy } = select( coreStore );\n\t\tconst categoriesTaxonomy = getTaxonomy( 'category' );\n\t\tconst defaultCategoryId = canUser( 'read', 'settings' )\n\t\t\t? getEntityRecord( 'root', 'site' )?.default_category\n\t\t\t: undefined;\n\t\tconst defaultCategory = defaultCategoryId\n\t\t\t? getEntityRecord( 'taxonomy', 'category', defaultCategoryId )\n\t\t\t: undefined;\n\t\tconst postTypeSupportsCategories =\n\t\t\tcategoriesTaxonomy &&\n\t\t\tcategoriesTaxonomy.types.some( ( type ) => type === postType );\n\t\tconst categories =\n\t\t\tcategoriesTaxonomy &&\n\t\t\tselect( editorStore ).getEditedPostAttribute(\n\t\t\t\tcategoriesTaxonomy.rest_base\n\t\t\t);\n\n\t\t// This boolean should return true if everything is loaded\n\t\t// ( categoriesTaxonomy, defaultCategory )\n\t\t// and the post has not been assigned a category different than \"uncategorized\".\n\t\treturn (\n\t\t\t!! categoriesTaxonomy &&\n\t\t\t!! defaultCategory &&\n\t\t\tpostTypeSupportsCategories &&\n\t\t\t( categories?.length === 0 ||\n\t\t\t\t( categories?.length === 1 &&\n\t\t\t\t\tdefaultCategory?.id === categories[ 0 ] ) )\n\t\t);\n\t}, [] );\n\tconst [ shouldShowPanel, setShouldShowPanel ] = useState( false );\n\tuseEffect( () => {\n\t\t// We use state to avoid hiding the panel if the user edits the categories\n\t\t// and adds one within the panel itself (while visible).\n\t\tif ( hasNoCategory ) {\n\t\t\tsetShouldShowPanel( true );\n\t\t}\n\t}, [ hasNoCategory ] );\n\n\tif ( ! shouldShowPanel ) {\n\t\treturn null;\n\t}\n\n\tconst panelBodyTitle = [\n\t\t__( 'Suggestion:' ),\n\t\t<span className=\"editor-post-publish-panel__link\" key=\"label\">\n\t\t\t{ __( 'Assign a category' ) }\n\t\t</span>,\n\t];\n\n\treturn (\n\t\t<PanelBody initialOpen={ false } title={ panelBodyTitle }>\n\t\t\t<p>\n\t\t\t\t{ __(\n\t\t\t\t\t'Categories provide a helpful way to group related posts together and to quickly tell readers what a post is about.'\n\t\t\t\t) }\n\t\t\t</p>\n\t\t\t<HierarchicalTermSelector slug=\"category\" />\n\t\t</PanelBody>\n\t);\n}\n\nexport default MaybeCategoryPanel;\n"]}
|