@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
|
@@ -18,10 +18,9 @@ import { store as coreStore } from '@wordpress/core-data';
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
20
|
import { store as editorStore } from '../../store';
|
|
21
|
-
export default function PostSchedule(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
} = _ref;
|
|
21
|
+
export default function PostSchedule({
|
|
22
|
+
onClose
|
|
23
|
+
}) {
|
|
25
24
|
const {
|
|
26
25
|
postDate,
|
|
27
26
|
postType
|
|
@@ -47,14 +46,11 @@ export default function PostSchedule(_ref) {
|
|
|
47
46
|
per_page: 100,
|
|
48
47
|
_fields: 'id,date'
|
|
49
48
|
}), [previewedMonth, postType]);
|
|
50
|
-
const events = useMemo(() => (eventsByPostType || []).map(
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
date: new Date(eventDate)
|
|
56
|
-
};
|
|
57
|
-
}), [eventsByPostType]);
|
|
49
|
+
const events = useMemo(() => (eventsByPostType || []).map(({
|
|
50
|
+
date: eventDate
|
|
51
|
+
}) => ({
|
|
52
|
+
date: new Date(eventDate)
|
|
53
|
+
})), [eventsByPostType]);
|
|
58
54
|
const settings = getSettings(); // To know if the current timezone is a 12 hour time with look for "a" in the time format
|
|
59
55
|
// We also make sure this a is not escaped by a "/"
|
|
60
56
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/components/post-schedule/index.js"],"names":["parseISO","endOfMonth","startOfMonth","getSettings","useDispatch","useSelect","__experimentalPublishDateTimePicker","PublishDateTimePicker","useState","useMemo","store","coreStore","editorStore","PostSchedule","onClose","postDate","postType","select","getEditedPostAttribute","getCurrentPostType","editPost","onUpdateDate","date","previewedMonth","setPreviewedMonth","Date","eventsByPostType","getEntityRecords","status","after","toISOString","before","exclude","getCurrentPostId","per_page","_fields","events","map","eventDate","settings","is12HourTime","test","formats","time","toLowerCase","replace","split","reverse","join"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,QAAT,EAAmBC,UAAnB,EAA+BC,YAA/B,QAAmD,UAAnD;AAEA;AACA;AACA;;AACA,SAASC,WAAT,QAA4B,iBAA5B;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,mCAAmC,IAAIC,qBAAhD,QAA6E,yBAA7E;AACA,SAASC,QAAT,EAAmBC,OAAnB,QAAkC,oBAAlC;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,SAASD,KAAK,IAAIE,WAAlB,QAAqC,aAArC;AAEA,eAAe,SAASC,YAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/components/post-schedule/index.js"],"names":["parseISO","endOfMonth","startOfMonth","getSettings","useDispatch","useSelect","__experimentalPublishDateTimePicker","PublishDateTimePicker","useState","useMemo","store","coreStore","editorStore","PostSchedule","onClose","postDate","postType","select","getEditedPostAttribute","getCurrentPostType","editPost","onUpdateDate","date","previewedMonth","setPreviewedMonth","Date","eventsByPostType","getEntityRecords","status","after","toISOString","before","exclude","getCurrentPostId","per_page","_fields","events","map","eventDate","settings","is12HourTime","test","formats","time","toL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AGR;AARX,IADD;AAYA","sourcesContent":["/**\n * External dependencies\n */\nimport { parseISO, endOfMonth, startOfMonth } from 'date-fns';\n\n/**\n * WordPress dependencies\n */\nimport { getSettings } from '@wordpress/date';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __experimentalPublishDateTimePicker as PublishDateTimePicker } from '@wordpress/block-editor';\nimport { useState, useMemo } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport default function PostSchedule( { onClose } ) {\n\tconst { postDate, postType } = useSelect(\n\t\t( select ) => ( {\n\t\t\tpostDate: select( editorStore ).getEditedPostAttribute( 'date' ),\n\t\t\tpostType: select( editorStore ).getCurrentPostType(),\n\t\t} ),\n\t\t[]\n\t);\n\n\tconst { editPost } = useDispatch( editorStore );\n\tconst onUpdateDate = ( date ) => editPost( { date } );\n\n\tconst [ previewedMonth, setPreviewedMonth ] = useState(\n\t\tstartOfMonth( new Date( postDate ) )\n\t);\n\n\t// Pick up published and schduled site posts.\n\tconst eventsByPostType = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getEntityRecords( 'postType', postType, {\n\t\t\t\tstatus: 'publish,future',\n\t\t\t\tafter: startOfMonth( previewedMonth ).toISOString(),\n\t\t\t\tbefore: endOfMonth( previewedMonth ).toISOString(),\n\t\t\t\texclude: [ select( editorStore ).getCurrentPostId() ],\n\t\t\t\tper_page: 100,\n\t\t\t\t_fields: 'id,date',\n\t\t\t} ),\n\t\t[ previewedMonth, postType ]\n\t);\n\n\tconst events = useMemo(\n\t\t() =>\n\t\t\t( eventsByPostType || [] ).map( ( { date: eventDate } ) => ( {\n\t\t\t\tdate: new Date( eventDate ),\n\t\t\t} ) ),\n\t\t[ eventsByPostType ]\n\t);\n\n\tconst settings = getSettings();\n\n\t// To know if the current timezone is a 12 hour time with look for \"a\" in the time format\n\t// We also make sure this a is not escaped by a \"/\"\n\tconst is12HourTime = /a(?!\\\\)/i.test(\n\t\tsettings.formats.time\n\t\t\t.toLowerCase() // Test only the lower case a.\n\t\t\t.replace( /\\\\\\\\/g, '' ) // Replace \"//\" with empty strings.\n\t\t\t.split( '' )\n\t\t\t.reverse()\n\t\t\t.join( '' ) // Reverse the string and test for \"a\" not followed by a slash.\n\t);\n\n\treturn (\n\t\t<PublishDateTimePicker\n\t\t\tcurrentDate={ postDate }\n\t\t\tonChange={ onUpdateDate }\n\t\t\tis12Hour={ is12HourTime }\n\t\t\tevents={ events }\n\t\t\tonMonthPreviewed={ ( date ) =>\n\t\t\t\tsetPreviewedMonth( parseISO( date ) )\n\t\t\t}\n\t\t\tonClose={ onClose }\n\t\t/>\n\t);\n}\n"]}
|
|
@@ -12,10 +12,9 @@ import { store as editorStore } from '../../store';
|
|
|
12
12
|
export default function PostScheduleLabel(props) {
|
|
13
13
|
return usePostScheduleLabel(props);
|
|
14
14
|
}
|
|
15
|
-
export function usePostScheduleLabel(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
15
|
+
export function usePostScheduleLabel({
|
|
16
|
+
full = false
|
|
17
|
+
} = {}) {
|
|
19
18
|
const {
|
|
20
19
|
date,
|
|
21
20
|
isFloating
|
|
@@ -34,12 +33,10 @@ export function getFullPostScheduleLabel(dateAttribute) {
|
|
|
34
33
|
_x('F j, Y g:i\xa0a', 'post schedule full date format'), date);
|
|
35
34
|
return isRTL() ? `${timezoneAbbreviation} ${formattedDate}` : `${formattedDate} ${timezoneAbbreviation}`;
|
|
36
35
|
}
|
|
37
|
-
export function getPostScheduleLabel(dateAttribute
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
42
|
-
|
|
36
|
+
export function getPostScheduleLabel(dateAttribute, {
|
|
37
|
+
isFloating = false,
|
|
38
|
+
now = new Date()
|
|
39
|
+
} = {}) {
|
|
43
40
|
if (!dateAttribute || isFloating) {
|
|
44
41
|
return __('Immediately');
|
|
45
42
|
} // If the user timezone does not equal the site timezone then using words
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/components/post-schedule/label.js"],"names":["__","_x","sprintf","isRTL","getSettings","getDate","dateI18n","useSelect","store","editorStore","PostScheduleLabel","props","usePostScheduleLabel","full","date","isFloating","select","getEditedPostAttribute","isEditedPostDateFloating","getFullPostScheduleLabel","getPostScheduleLabel","dateAttribute","timezoneAbbreviation","getTimezoneAbbreviation","formattedDate","now","Date","isTimezoneSameAsSiteTimezone","isSameDay","tomorrow","setDate","getFullYear","timezone","abbr","isNaN","Number","symbol","offset","siteOffset","dateOffset","getTimezoneOffset","left","right","getMonth"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAT,EAAaC,EAAb,EAAiBC,OAAjB,EAA0BC,KAA1B,QAAuC,iBAAvC;AACA,SAASC,WAAT,EAAsBC,OAAtB,EAA+BC,QAA/B,QAA+C,iBAA/C;AACA,SAASC,SAAT,QAA0B,iBAA1B;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,aAArC;AAEA,eAAe,SAASC,iBAAT,CAA4BC,KAA5B,EAAoC;AAClD,SAAOC,oBAAoB,CAAED,KAAF,CAA3B;AACA;AAED,OAAO,SAASC,oBAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/components/post-schedule/label.js"],"names":["__","_x","sprintf","isRTL","getSettings","getDate","dateI18n","useSelect","store","editorStore","PostScheduleLabel","props","usePostScheduleLabel","full","date","isFloating","select","getEditedPostAttribute","isEditedPostDateFloating","getFullPostScheduleLabel","getPostScheduleLabel","dateAttribute","timezoneAbbreviation","getTimezoneAbbreviation","formattedDate","now","Date","isTimezoneSameAsSiteTimezone","isSameDay","tomorrow","setDate","getFullYear","timezone","abbr","isNaN","Number","symbol","offset","siteOffset","dateOffset","getTimezoneOffset","left","right","getMonth"],"mappings":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gCAArB,CAFY,EAGda,IAHc,CAAf;AAKA;;AAED,SAASS,uBAAT,GAAmC;AAClC,QAAM;AAAES,IAAAA;AAAF,MAAe5B,WAAW,EAAhC;;AAEA,MAAK4B,QAAQ,CAACC,IAAT,IAAiBC,KAAK,CAAEC,MAAM,CAAEH,QAAQ,CAACC,IAAX,CAAR,CAA3B,EAAyD;AACxD,WAAOD,QAAQ,CAACC,IAAhB;AACA;;AAED,QAAMG,MAAM,GAAGJ,QAAQ,CAACK,MAAT,GAAkB,CAAlB,GAAsB,EAAtB,GAA2B,GAA1C;AACA,SAAQ,MAAMD,MAAQ,GAAGJ,QAAQ,CAACK,MAAQ,EAA1C;AACA;;AAED,SAASV,4BAAT,CAAuCb,IAAvC,EAA8C;AAC7C,QAAM;AAAEkB,IAAAA;AAAF,MAAe5B,WAAW,EAAhC;AAEA,QAAMkC,UAAU,GAAGH,MAAM,CAAEH,QAAQ,CAACK,MAAX,CAAzB;AACA,QAAME,UAAU,GAAG,CAAC,CAAD,IAAOzB,IAAI,CAAC0B,iBAAL,KAA2B,EAAlC,CAAnB;AACA,SAAOF,UAAU,KAAKC,UAAtB;AACA;;AAED,SAASX,SAAT,CAAoBa,IAApB,EAA0BC,KAA1B,EAAkC;AACjC,SACCD,IAAI,CAACpC,OAAL,OAAmBqC,KAAK,CAACrC,OAAN,EAAnB,IACAoC,IAAI,CAACE,QAAL,OAAoBD,KAAK,CAACC,QAAN,EADpB,IAEAF,IAAI,CAACV,WAAL,OAAuBW,KAAK,CAACX,WAAN,EAHxB;AAKA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _x, sprintf, isRTL } from '@wordpress/i18n';\nimport { getSettings, getDate, dateI18n } from '@wordpress/date';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport default function PostScheduleLabel( props ) {\n\treturn usePostScheduleLabel( props );\n}\n\nexport function usePostScheduleLabel( { full = false } = {} ) {\n\tconst { date, isFloating } = useSelect(\n\t\t( select ) => ( {\n\t\t\tdate: select( editorStore ).getEditedPostAttribute( 'date' ),\n\t\t\tisFloating: select( editorStore ).isEditedPostDateFloating(),\n\t\t} ),\n\t\t[]\n\t);\n\n\treturn full\n\t\t? getFullPostScheduleLabel( date )\n\t\t: getPostScheduleLabel( date, { isFloating } );\n}\n\nexport function getFullPostScheduleLabel( dateAttribute ) {\n\tconst date = getDate( dateAttribute );\n\n\tconst timezoneAbbreviation = getTimezoneAbbreviation();\n\tconst formattedDate = dateI18n(\n\t\t// translators: If using a space between 'g:i' and 'a', use a non-breaking sapce.\n\t\t_x( 'F j, Y g:i\\xa0a', 'post schedule full date format' ),\n\t\tdate\n\t);\n\treturn isRTL()\n\t\t? `${ timezoneAbbreviation } ${ formattedDate }`\n\t\t: `${ formattedDate } ${ timezoneAbbreviation }`;\n}\n\nexport function getPostScheduleLabel(\n\tdateAttribute,\n\t{ isFloating = false, now = new Date() } = {}\n) {\n\tif ( ! dateAttribute || isFloating ) {\n\t\treturn __( 'Immediately' );\n\t}\n\n\t// If the user timezone does not equal the site timezone then using words\n\t// like 'tomorrow' is confusing, so show the full date.\n\tif ( ! isTimezoneSameAsSiteTimezone( now ) ) {\n\t\treturn getFullPostScheduleLabel( dateAttribute );\n\t}\n\n\tconst date = getDate( dateAttribute );\n\n\tif ( isSameDay( date, now ) ) {\n\t\treturn sprintf(\n\t\t\t// translators: %s: Time of day the post is scheduled for.\n\t\t\t__( 'Today at %s' ),\n\t\t\t// translators: If using a space between 'g:i' and 'a', use a non-breaking sapce.\n\t\t\tdateI18n( _x( 'g:i\\xa0a', 'post schedule time format' ), date )\n\t\t);\n\t}\n\n\tconst tomorrow = new Date( now );\n\ttomorrow.setDate( tomorrow.getDate() + 1 );\n\n\tif ( isSameDay( date, tomorrow ) ) {\n\t\treturn sprintf(\n\t\t\t// translators: %s: Time of day the post is scheduled for.\n\t\t\t__( 'Tomorrow at %s' ),\n\t\t\t// translators: If using a space between 'g:i' and 'a', use a non-breaking sapce.\n\t\t\tdateI18n( _x( 'g:i\\xa0a', 'post schedule time format' ), date )\n\t\t);\n\t}\n\n\tif ( date.getFullYear() === now.getFullYear() ) {\n\t\treturn dateI18n(\n\t\t\t// translators: If using a space between 'g:i' and 'a', use a non-breaking sapce.\n\t\t\t_x( 'F j g:i\\xa0a', 'post schedule date format without year' ),\n\t\t\tdate\n\t\t);\n\t}\n\n\treturn dateI18n(\n\t\t// translators: Use a non-breaking space between 'g:i' and 'a' if appropriate.\n\t\t_x( 'F j, Y g:i\\xa0a', 'post schedule full date format' ),\n\t\tdate\n\t);\n}\n\nfunction getTimezoneAbbreviation() {\n\tconst { timezone } = getSettings();\n\n\tif ( timezone.abbr && isNaN( Number( timezone.abbr ) ) ) {\n\t\treturn timezone.abbr;\n\t}\n\n\tconst symbol = timezone.offset < 0 ? '' : '+';\n\treturn `UTC${ symbol }${ timezone.offset }`;\n}\n\nfunction isTimezoneSameAsSiteTimezone( date ) {\n\tconst { timezone } = getSettings();\n\n\tconst siteOffset = Number( timezone.offset );\n\tconst dateOffset = -1 * ( date.getTimezoneOffset() / 60 );\n\treturn siteOffset === dateOffset;\n}\n\nfunction isSameDay( left, right ) {\n\treturn (\n\t\tleft.getDate() === right.getDate() &&\n\t\tleft.getMonth() === right.getMonth() &&\n\t\tleft.getFullYear() === right.getFullYear()\n\t);\n}\n"]}
|
|
@@ -4,10 +4,9 @@ import { createElement } from "@wordpress/element";
|
|
|
4
4
|
* Internal dependencies
|
|
5
5
|
*/
|
|
6
6
|
import PostTypeSupportCheck from '../post-type-support-check';
|
|
7
|
-
export default function PostSlugCheck(
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
} = _ref;
|
|
7
|
+
export default function PostSlugCheck({
|
|
8
|
+
children
|
|
9
|
+
}) {
|
|
11
10
|
return createElement(PostTypeSupportCheck, {
|
|
12
11
|
supportKeys: "slug"
|
|
13
12
|
}, children);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/components/post-slug/check.js"],"names":["PostTypeSupportCheck","PostSlugCheck","children"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,oBAAP,MAAiC,4BAAjC;AAEA,eAAe,SAASC,aAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/components/post-slug/check.js"],"names":["PostTypeSupportCheck","PostSlugCheck","children"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,oBAAP,MAAiC,4BAAjC;AAEA,eAAe,SAASC,aAAT,CAAwB;AAAEC,EAAAA;AAAF,CAAxB,EAAuC;AACrD,SACC,cAAC,oBAAD;AAAsB,IAAA,WAAW,EAAC;AAAlC,KACGA,QADH,CADD;AAKA","sourcesContent":["/**\n * Internal dependencies\n */\nimport PostTypeSupportCheck from '../post-type-support-check';\n\nexport default function PostSlugCheck( { children } ) {\n\treturn (\n\t\t<PostTypeSupportCheck supportKeys=\"slug\">\n\t\t\t{ children }\n\t\t</PostTypeSupportCheck>\n\t);\n}\n"]}
|
|
@@ -16,12 +16,11 @@ import { TextControl } from '@wordpress/components';
|
|
|
16
16
|
import PostSlugCheck from './check';
|
|
17
17
|
import { store as editorStore } from '../../store';
|
|
18
18
|
export class PostSlug extends Component {
|
|
19
|
-
constructor(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
} = _ref;
|
|
19
|
+
constructor({
|
|
20
|
+
postSlug,
|
|
21
|
+
postTitle,
|
|
22
|
+
postID
|
|
23
|
+
}) {
|
|
25
24
|
super(...arguments);
|
|
26
25
|
this.state = {
|
|
27
26
|
editedSlug: safeDecodeURIComponent(postSlug) || cleanForSlug(postTitle) || postID
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/components/post-slug/index.js"],"names":["withDispatch","withSelect","Component","__","compose","safeDecodeURIComponent","cleanForSlug","TextControl","PostSlugCheck","store","editorStore","PostSlug","constructor","postSlug","postTitle","postID","arguments","state","editedSlug","setSlug","bind","event","onUpdateSlug","props","value","target","render","slug","setState","select","getCurrentPost","getEditedPostAttribute","id","dispatch","editPost"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,YAAT,EAAuBC,UAAvB,QAAyC,iBAAzC;AACA,SAASC,SAAT,QAA0B,oBAA1B;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,OAAT,QAAwB,oBAAxB;AACA,SAASC,sBAAT,EAAiCC,YAAjC,QAAqD,gBAArD;AACA,SAASC,WAAT,QAA4B,uBAA5B;AAEA;AACA;AACA;;AACA,OAAOC,aAAP,MAA0B,SAA1B;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,aAArC;AAEA,OAAO,MAAMC,QAAN,SAAuBT,SAAvB,CAAiC;AACvCU,EAAAA,WAAW,
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/components/post-slug/index.js"],"names":["withDispatch","withSelect","Component","__","compose","safeDecodeURIComponent","cleanForSlug","TextControl","PostSlugCheck","store","editorStore","PostSlug","constructor","postSlug","postTitle","postID","arguments","state","editedSlug","setSlug","bind","event","onUpdateSlug","props","value","target","render","slug","setState","select","getCurrentPost","getEditedPostAttribute","id","dispatch","editPost"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,YAAT,EAAuBC,UAAvB,QAAyC,iBAAzC;AACA,SAASC,SAAT,QAA0B,oBAA1B;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,OAAT,QAAwB,oBAAxB;AACA,SAASC,sBAAT,EAAiCC,YAAjC,QAAqD,gBAArD;AACA,SAASC,WAAT,QAA4B,uBAA5B;AAEA;AACA;AACA;;AACA,OAAOC,aAAP,MAA0B,SAA1B;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,aAArC;AAEA,OAAO,MAAMC,QAAN,SAAuBT,SAAvB,CAAiC;AACvCU,EAAAA,WAAW,CAAE;AAAEC,IAAAA,QAAF;AAAYC,IAAAA,SAAZ;AAAuBC,IAAAA;AAAvB,GAAF,EA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F,cAAc,EAA7B;AACA,SAAO;AACNjB,IAAAA,QAAQ,EAAEkB,sBAAsB,CAAE,MAAF,CAD1B;AAENjB,IAAAA,SAAS,EAAEiB,sBAAsB,CAAE,OAAF,CAF3B;AAGNhB,IAAAA,MAAM,EAAEiB;AAHF,GAAP;AAKA,CAVS,CADa,EAYvBhC,YAAY,CAAIiC,QAAF,IAAgB;AAC7B,QAAM;AAAEC,IAAAA;AAAF,MAAeD,QAAQ,CAAEvB,WAAF,CAA7B;AACA,SAAO;AACNY,IAAAA,YAAY,CAAEK,IAAF,EAAS;AACpBO,MAAAA,QAAQ,CAAE;AAAEP,QAAAA;AAAF,OAAF,CAAR;AACA;;AAHK,GAAP;AAKA,CAPW,CAZW,CAAF,CAAP,CAoBVhB,QApBU,CAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { withDispatch, withSelect } from '@wordpress/data';\nimport { Component } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { compose } from '@wordpress/compose';\nimport { safeDecodeURIComponent, cleanForSlug } from '@wordpress/url';\nimport { TextControl } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport PostSlugCheck from './check';\nimport { store as editorStore } from '../../store';\n\nexport class PostSlug extends Component {\n\tconstructor( { postSlug, postTitle, postID } ) {\n\t\tsuper( ...arguments );\n\n\t\tthis.state = {\n\t\t\teditedSlug:\n\t\t\t\tsafeDecodeURIComponent( postSlug ) ||\n\t\t\t\tcleanForSlug( postTitle ) ||\n\t\t\t\tpostID,\n\t\t};\n\n\t\tthis.setSlug = this.setSlug.bind( this );\n\t}\n\n\tsetSlug( event ) {\n\t\tconst { postSlug, onUpdateSlug } = this.props;\n\t\tconst { value } = event.target;\n\n\t\tconst editedSlug = cleanForSlug( value );\n\n\t\tif ( editedSlug === postSlug ) {\n\t\t\treturn;\n\t\t}\n\n\t\tonUpdateSlug( editedSlug );\n\t}\n\n\trender() {\n\t\tconst { editedSlug } = this.state;\n\t\treturn (\n\t\t\t<PostSlugCheck>\n\t\t\t\t<TextControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Slug' ) }\n\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\tspellCheck=\"false\"\n\t\t\t\t\tvalue={ editedSlug }\n\t\t\t\t\tonChange={ ( slug ) =>\n\t\t\t\t\t\tthis.setState( { editedSlug: slug } )\n\t\t\t\t\t}\n\t\t\t\t\tonBlur={ this.setSlug }\n\t\t\t\t\tclassName=\"editor-post-slug\"\n\t\t\t\t/>\n\t\t\t</PostSlugCheck>\n\t\t);\n\t}\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst { getCurrentPost, getEditedPostAttribute } =\n\t\t\tselect( editorStore );\n\n\t\tconst { id } = getCurrentPost();\n\t\treturn {\n\t\t\tpostSlug: getEditedPostAttribute( 'slug' ),\n\t\t\tpostTitle: getEditedPostAttribute( 'title' ),\n\t\t\tpostID: id,\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { editPost } = dispatch( editorStore );\n\t\treturn {\n\t\t\tonUpdateSlug( slug ) {\n\t\t\t\teditPost( { slug } );\n\t\t\t},\n\t\t};\n\t} ),\n] )( PostSlug );\n"]}
|
|
@@ -8,13 +8,11 @@ import { withSelect } from '@wordpress/data';
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { store as editorStore } from '../../store';
|
|
11
|
-
export function PostStickyCheck(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
} = _ref;
|
|
17
|
-
|
|
11
|
+
export function PostStickyCheck({
|
|
12
|
+
hasStickyAction,
|
|
13
|
+
postType,
|
|
14
|
+
children
|
|
15
|
+
}) {
|
|
18
16
|
if (postType !== 'post' || !hasStickyAction) {
|
|
19
17
|
return null;
|
|
20
18
|
}
|
|
@@ -22,11 +20,11 @@ export function PostStickyCheck(_ref) {
|
|
|
22
20
|
return children;
|
|
23
21
|
}
|
|
24
22
|
export default compose([withSelect(select => {
|
|
25
|
-
var _post$_links$wpActio
|
|
23
|
+
var _post$_links$wpActio;
|
|
26
24
|
|
|
27
25
|
const post = select(editorStore).getCurrentPost();
|
|
28
26
|
return {
|
|
29
|
-
hasStickyAction: (_post$_links$wpActio =
|
|
27
|
+
hasStickyAction: (_post$_links$wpActio = post._links?.['wp:action-sticky']) !== null && _post$_links$wpActio !== void 0 ? _post$_links$wpActio : false,
|
|
30
28
|
postType: select(editorStore).getCurrentPostType()
|
|
31
29
|
};
|
|
32
30
|
})])(PostStickyCheck);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/components/post-sticky/check.js"],"names":["compose","withSelect","store","editorStore","PostStickyCheck","hasStickyAction","postType","children","select","post","getCurrentPost","_links","getCurrentPostType"],"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,eAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/components/post-sticky/check.js"],"names":["compose","withSelect","store","editorStore","PostStickyCheck","hasStickyAction","postType","children","select","post","getCurrentPost","_links","getCurrentPostType"],"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,eAAT,CAA0B;AAAEC,EAAAA,eAAF;AAAmBC,EAAAA,QAAnB;AAA6BC,EAAAA;AAA7B,CAA1B,EAAoE;AAC1E,MAAKD,QAAQ,KAAK,MAAb,IAAuB,CAAED,eAA9B,EAAgD;AAC/C,WAAO,IAAP;AACA;;AAED,SAAOE,QAAP;AACA;AAED,eAAeP,OAAO,CAAE,CACvBC,UAAU,CAAIO,MAAF,IAAc;AAAA;;AACzB,QAAMC,IAAI,GAAGD,MAAM,CAAEL,WAAF,CAAN,CAAsBO,cAAtB,EAAb;AACA,SAAO;AACNL,IAAAA,eAAe,0BAAEI,IAAI,CAACE,MAAL,GAAe,kBAAf,CAAF,uEAAyC,KADlD;AAENL,IAAAA,QAAQ,EAAEE,MAAM,CAAEL,WAAF,CAAN,CAAsBS,kBAAtB;AAFJ,GAAP;AAIA,CANS,CADa,CAAF,CAAP,CAQVR,eARU,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 PostStickyCheck( { hasStickyAction, postType, children } ) {\n\tif ( postType !== 'post' || ! hasStickyAction ) {\n\t\treturn null;\n\t}\n\n\treturn children;\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst post = select( editorStore ).getCurrentPost();\n\t\treturn {\n\t\t\thasStickyAction: post._links?.[ 'wp:action-sticky' ] ?? false,\n\t\t\tpostType: select( editorStore ).getCurrentPostType(),\n\t\t};\n\t} ),\n] )( PostStickyCheck );\n"]}
|
|
@@ -13,11 +13,10 @@ import { compose } from '@wordpress/compose';
|
|
|
13
13
|
|
|
14
14
|
import PostStickyCheck from './check';
|
|
15
15
|
import { store as editorStore } from '../../store';
|
|
16
|
-
export function PostSticky(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
} = _ref;
|
|
16
|
+
export function PostSticky({
|
|
17
|
+
onUpdateSticky,
|
|
18
|
+
postSticky = false
|
|
19
|
+
}) {
|
|
21
20
|
return createElement(PostStickyCheck, null, createElement(CheckboxControl, {
|
|
22
21
|
__nextHasNoMarginBottom: true,
|
|
23
22
|
label: __('Stick to the top of the blog'),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/components/post-sticky/index.js"],"names":["__","CheckboxControl","withSelect","withDispatch","compose","PostStickyCheck","store","editorStore","PostSticky","onUpdateSticky","postSticky","select","getEditedPostAttribute","dispatch","editPost","sticky"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,eAAT,QAAgC,uBAAhC;AACA,SAASC,UAAT,EAAqBC,YAArB,QAAyC,iBAAzC;AACA,SAASC,OAAT,QAAwB,oBAAxB;AAEA;AACA;AACA;;AACA,OAAOC,eAAP,MAA4B,SAA5B;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,aAArC;AAEA,OAAO,SAASC,UAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/components/post-sticky/index.js"],"names":["__","CheckboxControl","withSelect","withDispatch","compose","PostStickyCheck","store","editorStore","PostSticky","onUpdateSticky","postSticky","select","getEditedPostAttribute","dispatch","editPost","sticky"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,eAAT,QAAgC,uBAAhC;AACA,SAASC,UAAT,EAAqBC,YAArB,QAAyC,iBAAzC;AACA,SAASC,OAAT,QAAwB,oBAAxB;AAEA;AACA;AACA;;AACA,OAAOC,eAAP,MAA4B,SAA5B;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,aAArC;AAEA,OAAO,SAASC,UAAT,CAAqB;AAAEC,EAAAA,cAAF;AAAkBC,EAAAA,UAAU,GAAG;AAA/B,CAArB,EAA8D;AACpE,SACC,cAAC,eAAD,QACC,cAAC,eAAD;AACC,IAAA,uBAAuB,MADxB;AAEC,IAAA,KAAK,EAAGV,EAAE,CAAE,8BAAF,CAFX;AAGC,IAAA,OAAO,EAAGU,UAHX;AAIC,IAAA,QAAQ,EAAG,MAAMD,cAAc,CAAE,CAAEC,UAAJ;AAJhC,IADD,CADD;AAUA;AAED,eAAeN,OAAO,CAAE,CACvBF,UAAU,CAAIS,MAAF,IAAc;AACzB,SAAO;AACND,IAAAA,UAAU,EACTC,MAAM,CAAEJ,WAAF,CAAN,CAAsBK,sBAAtB,CAA8C,QAA9C;AAFK,GAAP;AAIA,CALS,CADa,EAOvBT,YAAY,CAAIU,QAAF,IAAgB;AAC7B,SAAO;AACNJ,IAAAA,cAAc,CAAEC,UAAF,EAAe;AAC5BG,MAAAA,QAAQ,CAAEN,WAAF,CAAR,CAAwBO,QAAxB,CAAkC;AAAEC,QAAAA,MAAM,EAAEL;AAAV,OAAlC;AACA;;AAHK,GAAP;AAKA,CANW,CAPW,CAAF,CAAP,CAcVF,UAdU,CAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { CheckboxControl } from '@wordpress/components';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport PostStickyCheck from './check';\nimport { store as editorStore } from '../../store';\n\nexport function PostSticky( { onUpdateSticky, postSticky = false } ) {\n\treturn (\n\t\t<PostStickyCheck>\n\t\t\t<CheckboxControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tlabel={ __( 'Stick to the top of the blog' ) }\n\t\t\t\tchecked={ postSticky }\n\t\t\t\tonChange={ () => onUpdateSticky( ! postSticky ) }\n\t\t\t/>\n\t\t</PostStickyCheck>\n\t);\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\treturn {\n\t\t\tpostSticky:\n\t\t\t\tselect( editorStore ).getEditedPostAttribute( 'sticky' ),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\treturn {\n\t\t\tonUpdateSticky( postSticky ) {\n\t\t\t\tdispatch( editorStore ).editPost( { sticky: postSticky } );\n\t\t\t},\n\t\t};\n\t} ),\n] )( PostSticky );\n"]}
|
|
@@ -14,13 +14,12 @@ import { useState } from '@wordpress/element';
|
|
|
14
14
|
|
|
15
15
|
import { store as editorStore } from '../../store';
|
|
16
16
|
|
|
17
|
-
function PostSwitchToDraftButton(
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
} = _ref;
|
|
17
|
+
function PostSwitchToDraftButton({
|
|
18
|
+
isSaving,
|
|
19
|
+
isPublished,
|
|
20
|
+
isScheduled,
|
|
21
|
+
onClick
|
|
22
|
+
}) {
|
|
24
23
|
const [showConfirmDialog, setShowConfirmDialog] = useState(false);
|
|
25
24
|
|
|
26
25
|
if (!isPublished && !isScheduled) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/components/post-switch-to-draft-button/index.js"],"names":["Button","FlexItem","__experimentalConfirmDialog","ConfirmDialog","__","withSelect","withDispatch","compose","useState","store","editorStore","PostSwitchToDraftButton","isSaving","isPublished","isScheduled","onClick","showConfirmDialog","setShowConfirmDialog","alertMessage","handleConfirm","width","display","select","isSavingPost","isCurrentPostPublished","isCurrentPostScheduled","dispatch","editPost","savePost","status"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,MADD,EAECC,QAFD,EAGCC,2BAA2B,IAAIC,aAHhC,QAIO,uBAJP;AAKA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,UAAT,EAAqBC,YAArB,QAAyC,iBAAzC;AACA,SAASC,OAAT,QAAwB,oBAAxB;AACA,SAASC,QAAT,QAAyB,oBAAzB;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,aAArC;;AAEA,SAASC,uBAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/components/post-switch-to-draft-button/index.js"],"names":["Button","FlexItem","__experimentalConfirmDialog","ConfirmDialog","__","withSelect","withDispatch","compose","useState","store","editorStore","PostSwitchToDraftButton","isSaving","isPublished","isScheduled","onClick","showConfirmDialog","setShowConfirmDialog","alertMessage","handleConfirm","width","display","select","isSavingPost","isCurrentPostPublished","isCurrentPostScheduled","dispatch","editPost","savePost","status"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,MADD,EAECC,QAFD,EAGCC,2BAA2B,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iBADV;AAEC,IAAA,SAAS,EAAGG,aAFb;AAGC,IAAA,QAAQ,EAAG,MAAMF,oBAAoB,CAAE,KAAF;AAHtC,KAKGC,YALH,CAZD,CADD;AAsBA;;AAED,eAAeX,OAAO,CAAE,CACvBF,UAAU,CAAIiB,MAAF,IAAc;AACzB,QAAM;AAAEC,IAAAA,YAAF;AAAgBC,IAAAA,sBAAhB;AAAwCC,IAAAA;AAAxC,MACLH,MAAM,CAAEZ,WAAF,CADP;AAEA,SAAO;AACNE,IAAAA,QAAQ,EAAEW,YAAY,EADhB;AAENV,IAAAA,WAAW,EAAEW,sBAAsB,EAF7B;AAGNV,IAAAA,WAAW,EAAEW,sBAAsB;AAH7B,GAAP;AAKA,CARS,CADa,EAUvBnB,YAAY,CAAIoB,QAAF,IAAgB;AAC7B,QAAM;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,MAAyBF,QAAQ,CAAEhB,WAAF,CAAvC;AACA,SAAO;AACNK,IAAAA,OAAO,EAAE,MAAM;AACdY,MAAAA,QAAQ,CAAE;AAAEE,QAAAA,MAAM,EAAE;AAAV,OAAF,CAAR;AACAD,MAAAA,QAAQ;AACR;AAJK,GAAP;AAMA,CARW,CAVW,CAAF,CAAP,CAmBVjB,uBAnBU,CAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tFlexItem,\n\t__experimentalConfirmDialog as ConfirmDialog,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nfunction PostSwitchToDraftButton( {\n\tisSaving,\n\tisPublished,\n\tisScheduled,\n\tonClick,\n} ) {\n\tconst [ showConfirmDialog, setShowConfirmDialog ] = useState( false );\n\n\tif ( ! isPublished && ! isScheduled ) {\n\t\treturn null;\n\t}\n\n\tlet alertMessage;\n\tif ( isPublished ) {\n\t\talertMessage = __( 'Are you sure you want to unpublish this post?' );\n\t} else if ( isScheduled ) {\n\t\talertMessage = __( 'Are you sure you want to unschedule this post?' );\n\t}\n\n\tconst handleConfirm = () => {\n\t\tsetShowConfirmDialog( false );\n\t\tonClick();\n\t};\n\n\treturn (\n\t\t<FlexItem isBlock>\n\t\t\t<Button\n\t\t\t\tclassName=\"editor-post-switch-to-draft\"\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tsetShowConfirmDialog( true );\n\t\t\t\t} }\n\t\t\t\tdisabled={ isSaving }\n\t\t\t\tvariant=\"secondary\"\n\t\t\t\tstyle={ { width: '100%', display: 'block' } }\n\t\t\t>\n\t\t\t\t{ __( 'Switch to draft' ) }\n\t\t\t</Button>\n\t\t\t<ConfirmDialog\n\t\t\t\tisOpen={ showConfirmDialog }\n\t\t\t\tonConfirm={ handleConfirm }\n\t\t\t\tonCancel={ () => setShowConfirmDialog( false ) }\n\t\t\t>\n\t\t\t\t{ alertMessage }\n\t\t\t</ConfirmDialog>\n\t\t</FlexItem>\n\t);\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst { isSavingPost, isCurrentPostPublished, isCurrentPostScheduled } =\n\t\t\tselect( editorStore );\n\t\treturn {\n\t\t\tisSaving: isSavingPost(),\n\t\t\tisPublished: isCurrentPostPublished(),\n\t\t\tisScheduled: isCurrentPostScheduled(),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { editPost, savePost } = dispatch( editorStore );\n\t\treturn {\n\t\t\tonClick: () => {\n\t\t\t\teditPost( { status: 'draft' } );\n\t\t\t\tsavePost();\n\t\t\t},\n\t\t};\n\t} ),\n] )( PostSwitchToDraftButton );\n"]}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { createElement } from "@wordpress/element";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* WordPress dependencies
|
|
5
|
+
*/
|
|
6
|
+
import { useSelect, useDispatch } from '@wordpress/data';
|
|
7
|
+
import { __ } from '@wordpress/i18n';
|
|
8
|
+
import { ToggleControl, PanelRow } from '@wordpress/components';
|
|
9
|
+
/**
|
|
10
|
+
* Internal dependencies
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { store as editorStore } from '../../store';
|
|
14
|
+
export default function PostSyncStatus() {
|
|
15
|
+
const {
|
|
16
|
+
editPost
|
|
17
|
+
} = useDispatch(editorStore);
|
|
18
|
+
const {
|
|
19
|
+
meta,
|
|
20
|
+
postType
|
|
21
|
+
} = useSelect(select => {
|
|
22
|
+
const {
|
|
23
|
+
getEditedPostAttribute
|
|
24
|
+
} = select(editorStore);
|
|
25
|
+
return {
|
|
26
|
+
meta: getEditedPostAttribute('meta'),
|
|
27
|
+
postType: getEditedPostAttribute('type')
|
|
28
|
+
};
|
|
29
|
+
}, []);
|
|
30
|
+
|
|
31
|
+
if (postType !== 'wp_block') {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const onUpdateSync = syncStatus => editPost({
|
|
36
|
+
meta: { ...meta,
|
|
37
|
+
wp_block: syncStatus === 'unsynced' ? {
|
|
38
|
+
sync_status: syncStatus
|
|
39
|
+
} : null
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
const syncStatus = meta?.wp_block?.sync_status;
|
|
44
|
+
const isFullySynced = !syncStatus;
|
|
45
|
+
return createElement(PanelRow, {
|
|
46
|
+
className: "edit-post-sync-status"
|
|
47
|
+
}, createElement("span", null, __('Syncing')), createElement(ToggleControl, {
|
|
48
|
+
__nextHasNoMarginBottom: true,
|
|
49
|
+
label: isFullySynced ? __('Fully synced') : __('Not synced'),
|
|
50
|
+
checked: isFullySynced,
|
|
51
|
+
onChange: () => {
|
|
52
|
+
onUpdateSync(syncStatus === 'unsynced' ? 'fully' : 'unsynced');
|
|
53
|
+
}
|
|
54
|
+
}));
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/components/post-sync-status/index.js"],"names":["useSelect","useDispatch","__","ToggleControl","PanelRow","store","editorStore","PostSyncStatus","editPost","meta","postType","select","getEditedPostAttribute","onUpdateSync","syncStatus","wp_block","sync_status","isFullySynced"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,aAAT,EAAwBC,QAAxB,QAAwC,uBAAxC;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,aAArC;AAEA,eAAe,SAASC,cAAT,GAA0B;AACxC,QAAM;AAAEC,IAAAA;AAAF,MAAeP,WAAW,CAAEK,WAAF,CAAhC;AACA,QAAM;AAAEG,IAAAA,IAAF;AAAQC,IAAAA;AAAR,MAAqBV,SAAS,CAAIW,MAAF,IAAc;AACnD,UAAM;AAAEC,MAAAA;AAAF,QAA6BD,MAAM,CAAEL,WAAF,CAAzC;AACA,WAAO;AACNG,MAAAA,IAAI,EAAEG,sBAAsB,CAAE,MAAF,CADtB;AAENF,MAAAA,QAAQ,EAAEE,sBAAsB,CAAE,MAAF;AAF1B,KAAP;AAIA,GANmC,EAMjC,EANiC,CAApC;;AAOA,MAAKF,QAAQ,KAAK,UAAlB,EAA+B;AAC9B,WAAO,IAAP;AACA;;AACD,QAAMG,YAAY,GAAKC,UAAF,IACpBN,QAAQ,CAAE;AACTC,IAAAA,IAAI,EAAE,EACL,GAAGA,IADE;AAELM,MAAAA,QAAQ,EACPD,UAAU,KAAK,UAAf,GACG;AAAEE,QAAAA,WAAW,EAAEF;AAAf,OADH,GAEG;AALC;AADG,GAAF,CADT;;AAUA,QAAMA,UAAU,GAAGL,IAAI,EAAEM,QAAN,EAAgBC,WAAnC;AACA,QAAMC,aAAa,GAAG,CAAEH,UAAxB;AAEA,SACC,cAAC,QAAD;AAAU,IAAA,SAAS,EAAC;AAApB,KACC,4BAAQZ,EAAE,CAAE,SAAF,CAAV,CADD,EAEC,cAAC,aAAD;AACC,IAAA,uBAAuB,MADxB;AAEC,IAAA,KAAK,EACJe,aAAa,GAAGf,EAAE,CAAE,cAAF,CAAL,GAA0BA,EAAE,CAAE,YAAF,CAH3C;AAKC,IAAA,OAAO,EAAGe,aALX;AAMC,IAAA,QAAQ,EAAG,MAAM;AAChBJ,MAAAA,YAAY,CACXC,UAAU,KAAK,UAAf,GAA4B,OAA5B,GAAsC,UAD3B,CAAZ;AAGA;AAVF,IAFD,CADD;AAiBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { ToggleControl, PanelRow } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport default function PostSyncStatus() {\n\tconst { editPost } = useDispatch( editorStore );\n\tconst { meta, postType } = useSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute } = select( editorStore );\n\t\treturn {\n\t\t\tmeta: getEditedPostAttribute( 'meta' ),\n\t\t\tpostType: getEditedPostAttribute( 'type' ),\n\t\t};\n\t}, [] );\n\tif ( postType !== 'wp_block' ) {\n\t\treturn null;\n\t}\n\tconst onUpdateSync = ( syncStatus ) =>\n\t\teditPost( {\n\t\t\tmeta: {\n\t\t\t\t...meta,\n\t\t\t\twp_block:\n\t\t\t\t\tsyncStatus === 'unsynced'\n\t\t\t\t\t\t? { sync_status: syncStatus }\n\t\t\t\t\t\t: null,\n\t\t\t},\n\t\t} );\n\tconst syncStatus = meta?.wp_block?.sync_status;\n\tconst isFullySynced = ! syncStatus;\n\n\treturn (\n\t\t<PanelRow className=\"edit-post-sync-status\">\n\t\t\t<span>{ __( 'Syncing' ) }</span>\n\t\t\t<ToggleControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tlabel={\n\t\t\t\t\tisFullySynced ? __( 'Fully synced' ) : __( 'Not synced' )\n\t\t\t\t}\n\t\t\t\tchecked={ isFullySynced }\n\t\t\t\tonChange={ () => {\n\t\t\t\t\tonUpdateSync(\n\t\t\t\t\t\tsyncStatus === 'unsynced' ? 'fully' : 'unsynced'\n\t\t\t\t\t);\n\t\t\t\t} }\n\t\t\t/>\n\t\t</PanelRow>\n\t);\n}\n"]}
|
|
@@ -9,13 +9,12 @@ import { store as coreStore } from '@wordpress/core-data';
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import { store as editorStore } from '../../store';
|
|
12
|
-
export function PostTaxonomiesCheck(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const hasTaxonomies = taxonomies === null || taxonomies === void 0 ? void 0 : taxonomies.some(taxonomy => taxonomy.types.includes(postType));
|
|
12
|
+
export function PostTaxonomiesCheck({
|
|
13
|
+
postType,
|
|
14
|
+
taxonomies,
|
|
15
|
+
children
|
|
16
|
+
}) {
|
|
17
|
+
const hasTaxonomies = taxonomies?.some(taxonomy => taxonomy.types.includes(postType));
|
|
19
18
|
|
|
20
19
|
if (!hasTaxonomies) {
|
|
21
20
|
return null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/components/post-taxonomies/check.js"],"names":["compose","withSelect","store","coreStore","editorStore","PostTaxonomiesCheck","postType","taxonomies","children","hasTaxonomies","some","taxonomy","types","includes","select","getCurrentPostType","getTaxonomies","per_page"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,OAAT,QAAwB,oBAAxB;AACA,SAASC,UAAT,QAA2B,iBAA3B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,SAASD,KAAK,IAAIE,WAAlB,QAAqC,aAArC;AAEA,OAAO,SAASC,mBAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/components/post-taxonomies/check.js"],"names":["compose","withSelect","store","coreStore","editorStore","PostTaxonomiesCheck","postType","taxonomies","children","hasTaxonomies","some","taxonomy","types","includes","select","getCurrentPostType","getTaxonomies","per_page"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,OAAT,QAAwB,oBAAxB;AACA,SAASC,UAAT,QAA2B,iBAA3B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,SAASD,KAAK,IAAIE,WAAlB,QAAqC,aAArC;AAEA,OAAO,SAASC,mBAAT,CAA8B;AAAEC,EAAAA,QAAF;AAAYC,EAAAA,UAAZ;AAAwBC,EAAAA;AAAxB,CAA9B,EAAmE;AACzE,QAAMC,aAAa,GAAGF,UAAU,EAAEG,IAAZ,CAAoBC,QAAF,IACvCA,QAAQ,CAACC,KAAT,CAAeC,QAAf,CAAyBP,QAAzB,CADqB,CAAtB;;AAGA,MAAK,CAAEG,aAAP,EAAuB;AACtB,WAAO,IAAP;AACA;;AAED,SAAOD,QAAP;AACA;AAED,eAAeR,OAAO,CAAE,CACvBC,UAAU,CAAIa,MAAF,IAAc;AACzB,SAAO;AACNR,IAAAA,QAAQ,EAAEQ,MAAM,CAAEV,WAAF,CAAN,CAAsBW,kBAAtB,EADJ;AAENR,IAAAA,UAAU,EAAEO,MAAM,CAAEX,SAAF,CAAN,CAAoBa,aAApB,CAAmC;AAAEC,MAAAA,QAAQ,EAAE,CAAC;AAAb,KAAnC;AAFN,GAAP;AAIA,CALS,CADa,CAAF,CAAP,CAOVZ,mBAPU,CAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { compose } from '@wordpress/compose';\nimport { withSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport function PostTaxonomiesCheck( { postType, taxonomies, children } ) {\n\tconst hasTaxonomies = taxonomies?.some( ( taxonomy ) =>\n\t\ttaxonomy.types.includes( postType )\n\t);\n\tif ( ! hasTaxonomies ) {\n\t\treturn null;\n\t}\n\n\treturn children;\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\treturn {\n\t\t\tpostType: select( editorStore ).getCurrentPostType(),\n\t\t\ttaxonomies: select( coreStore ).getTaxonomies( { per_page: -1 } ),\n\t\t};\n\t} ),\n] )( PostTaxonomiesCheck );\n"]}
|
|
@@ -1,20 +1,14 @@
|
|
|
1
1
|
import { createElement, Fragment } from "@wordpress/element";
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* External dependencies
|
|
5
|
-
*/
|
|
6
|
-
import escapeHtml from 'escape-html';
|
|
7
3
|
/**
|
|
8
4
|
* WordPress dependencies
|
|
9
5
|
*/
|
|
10
|
-
|
|
11
6
|
import { __, _x, sprintf } from '@wordpress/i18n';
|
|
12
7
|
import { useEffect, useMemo, useState } from '@wordpress/element';
|
|
13
8
|
import { FormTokenField, withFilters } from '@wordpress/components';
|
|
14
9
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
15
10
|
import { store as coreStore } from '@wordpress/core-data';
|
|
16
11
|
import { useDebounce } from '@wordpress/compose';
|
|
17
|
-
import apiFetch from '@wordpress/api-fetch';
|
|
18
12
|
import { speak } from '@wordpress/a11y';
|
|
19
13
|
/**
|
|
20
14
|
* Internal dependencies
|
|
@@ -46,35 +40,13 @@ const isSameTermName = (termA, termB) => unescapeString(termA).toLowerCase() ===
|
|
|
46
40
|
|
|
47
41
|
const termNamesToIds = (names, terms) => {
|
|
48
42
|
return names.map(termName => terms.find(term => isSameTermName(term.name, termName)).id);
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
function findOrCreateTerm(termName, restBase, namespace) {
|
|
53
|
-
const escapedTermName = escapeHtml(termName);
|
|
54
|
-
return apiFetch({
|
|
55
|
-
path: `/${namespace}/${restBase}`,
|
|
56
|
-
method: 'POST',
|
|
57
|
-
data: {
|
|
58
|
-
name: escapedTermName
|
|
59
|
-
}
|
|
60
|
-
}).catch(error => {
|
|
61
|
-
if (error.code !== 'term_exists') {
|
|
62
|
-
return Promise.reject(error);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
return Promise.resolve({
|
|
66
|
-
id: error.data.term_id,
|
|
67
|
-
name: termName
|
|
68
|
-
});
|
|
69
|
-
}).then(unescapeTerm);
|
|
70
|
-
}
|
|
43
|
+
};
|
|
71
44
|
|
|
72
|
-
export function FlatTermSelector(
|
|
73
|
-
|
|
45
|
+
export function FlatTermSelector({
|
|
46
|
+
slug
|
|
47
|
+
}) {
|
|
48
|
+
var _taxonomy$labels$add_, _taxonomy$labels$sing2;
|
|
74
49
|
|
|
75
|
-
let {
|
|
76
|
-
slug
|
|
77
|
-
} = _ref;
|
|
78
50
|
const [values, setValues] = useState([]);
|
|
79
51
|
const [search, setSearch] = useState('');
|
|
80
52
|
const debouncedSearch = useDebounce(setSearch, 500);
|
|
@@ -86,7 +58,7 @@ export function FlatTermSelector(_ref) {
|
|
|
86
58
|
hasCreateAction,
|
|
87
59
|
hasResolvedTerms
|
|
88
60
|
} = useSelect(select => {
|
|
89
|
-
var _post$_links, _post$_links2
|
|
61
|
+
var _post$_links, _post$_links2;
|
|
90
62
|
|
|
91
63
|
const {
|
|
92
64
|
getCurrentPost,
|
|
@@ -108,8 +80,8 @@ export function FlatTermSelector(_ref) {
|
|
|
108
80
|
per_page: -1
|
|
109
81
|
};
|
|
110
82
|
return {
|
|
111
|
-
hasCreateAction: _taxonomy ? (_post$_links =
|
|
112
|
-
hasAssignAction: _taxonomy ? (_post$
|
|
83
|
+
hasCreateAction: _taxonomy ? (_post$_links = post._links?.['wp:action-create-' + _taxonomy.rest_base]) !== null && _post$_links !== void 0 ? _post$_links : false : false,
|
|
84
|
+
hasAssignAction: _taxonomy ? (_post$_links2 = post._links?.['wp:action-assign-' + _taxonomy.rest_base]) !== null && _post$_links2 !== void 0 ? _post$_links2 : false : false,
|
|
113
85
|
taxonomy: _taxonomy,
|
|
114
86
|
termIds: _termIds,
|
|
115
87
|
terms: _termIds.length ? getEntityRecords('taxonomy', slug, query) : EMPTY_ARRAY,
|
|
@@ -143,11 +115,32 @@ export function FlatTermSelector(_ref) {
|
|
|
143
115
|
const {
|
|
144
116
|
editPost
|
|
145
117
|
} = useDispatch(editorStore);
|
|
118
|
+
const {
|
|
119
|
+
saveEntityRecord
|
|
120
|
+
} = useDispatch(coreStore);
|
|
146
121
|
|
|
147
122
|
if (!hasAssignAction) {
|
|
148
123
|
return null;
|
|
149
124
|
}
|
|
150
125
|
|
|
126
|
+
async function findOrCreateTerm(term) {
|
|
127
|
+
try {
|
|
128
|
+
const newTerm = await saveEntityRecord('taxonomy', slug, term, {
|
|
129
|
+
throwOnError: true
|
|
130
|
+
});
|
|
131
|
+
return unescapeTerm(newTerm);
|
|
132
|
+
} catch (error) {
|
|
133
|
+
if (error.code !== 'term_exists') {
|
|
134
|
+
throw error;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
return {
|
|
138
|
+
id: error.data.term_id,
|
|
139
|
+
name: term.name
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
151
144
|
function onUpdateTerms(newTermIds) {
|
|
152
145
|
editPost({
|
|
153
146
|
[taxonomy.rest_base]: newTermIds
|
|
@@ -155,8 +148,6 @@ export function FlatTermSelector(_ref) {
|
|
|
155
148
|
}
|
|
156
149
|
|
|
157
150
|
function onChange(termNames) {
|
|
158
|
-
var _taxonomy$rest_namesp;
|
|
159
|
-
|
|
160
151
|
const availableTerms = [...(terms !== null && terms !== void 0 ? terms : []), ...(searchResults !== null && searchResults !== void 0 ? searchResults : [])];
|
|
161
152
|
const uniqueTerms = termNames.reduce((acc, name) => {
|
|
162
153
|
if (!acc.some(n => n.toLowerCase() === name.toLowerCase())) {
|
|
@@ -178,15 +169,16 @@ export function FlatTermSelector(_ref) {
|
|
|
178
169
|
return;
|
|
179
170
|
}
|
|
180
171
|
|
|
181
|
-
|
|
182
|
-
|
|
172
|
+
Promise.all(newTermNames.map(termName => findOrCreateTerm({
|
|
173
|
+
name: termName
|
|
174
|
+
}))).then(newTerms => {
|
|
183
175
|
const newAvailableTerms = availableTerms.concat(newTerms);
|
|
184
176
|
return onUpdateTerms(termNamesToIds(uniqueTerms, newAvailableTerms));
|
|
185
177
|
});
|
|
186
178
|
}
|
|
187
179
|
|
|
188
180
|
function appendTerm(newTerm) {
|
|
189
|
-
var _taxonomy$labels$sing
|
|
181
|
+
var _taxonomy$labels$sing;
|
|
190
182
|
|
|
191
183
|
if (termIds.includes(newTerm.id)) {
|
|
192
184
|
return;
|
|
@@ -196,13 +188,13 @@ export function FlatTermSelector(_ref) {
|
|
|
196
188
|
const defaultName = slug === 'post_tag' ? __('Tag') : __('Term');
|
|
197
189
|
const termAddedMessage = sprintf(
|
|
198
190
|
/* translators: %s: term name. */
|
|
199
|
-
_x('%s added', 'term'), (_taxonomy$labels$sing = taxonomy
|
|
191
|
+
_x('%s added', 'term'), (_taxonomy$labels$sing = taxonomy?.labels?.singular_name) !== null && _taxonomy$labels$sing !== void 0 ? _taxonomy$labels$sing : defaultName);
|
|
200
192
|
speak(termAddedMessage, 'assertive');
|
|
201
193
|
onUpdateTerms(newTermIds);
|
|
202
194
|
}
|
|
203
195
|
|
|
204
|
-
const newTermLabel = (_taxonomy$labels$add_ = taxonomy
|
|
205
|
-
const singularName = (_taxonomy$labels$sing2 = taxonomy
|
|
196
|
+
const newTermLabel = (_taxonomy$labels$add_ = taxonomy?.labels?.add_new_item) !== null && _taxonomy$labels$add_ !== void 0 ? _taxonomy$labels$add_ : slug === 'post_tag' ? __('Add new tag') : __('Add new Term');
|
|
197
|
+
const singularName = (_taxonomy$labels$sing2 = taxonomy?.labels?.singular_name) !== null && _taxonomy$labels$sing2 !== void 0 ? _taxonomy$labels$sing2 : slug === 'post_tag' ? __('Tag') : __('Term');
|
|
206
198
|
const termAddedLabel = sprintf(
|
|
207
199
|
/* translators: %s: term name. */
|
|
208
200
|
_x('%s added', 'term'), singularName);
|