@wordpress/editor 13.16.0 → 13.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/build/components/autocompleters/index.js +0 -2
- package/build/components/autocompleters/index.js.map +1 -1
- package/build/components/autocompleters/user.js +2 -9
- package/build/components/autocompleters/user.js.map +1 -1
- package/build/components/autosave-monitor/index.js +0 -24
- package/build/components/autosave-monitor/index.js.map +1 -1
- package/build/components/character-count/index.js +1 -4
- package/build/components/character-count/index.js.map +1 -1
- package/build/components/deprecated.js +1 -11
- package/build/components/deprecated.js.map +1 -1
- package/build/components/deprecated.native.js +0 -1
- package/build/components/deprecated.native.js.map +1 -1
- package/build/components/document-outline/check.js +1 -7
- package/build/components/document-outline/check.js.map +1 -1
- package/build/components/document-outline/index.js +7 -24
- package/build/components/document-outline/index.js.map +1 -1
- package/build/components/document-outline/item.js +1 -5
- package/build/components/document-outline/item.js.map +1 -1
- package/build/components/editor-help/add-blocks.native.js +1 -8
- package/build/components/editor-help/add-blocks.native.js.map +1 -1
- package/build/components/editor-help/customize-blocks.native.js +1 -8
- package/build/components/editor-help/customize-blocks.native.js.map +1 -1
- package/build/components/editor-help/help-detail-navigation-screen.native.js +5 -13
- 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 +1 -7
- package/build/components/editor-help/help-get-support-button.native.js.map +1 -1
- package/build/components/editor-help/help-section-title.native.js +1 -7
- package/build/components/editor-help/help-section-title.native.js.map +1 -1
- package/build/components/editor-help/help-topic-row.native.js +1 -8
- package/build/components/editor-help/help-topic-row.native.js.map +1 -1
- package/build/components/editor-help/icon-move-blocks.native.js +0 -4
- package/build/components/editor-help/icon-move-blocks.native.js.map +1 -1
- package/build/components/editor-help/index.native.js +8 -29
- package/build/components/editor-help/index.native.js.map +1 -1
- package/build/components/editor-help/intro-to-blocks.native.js +1 -9
- package/build/components/editor-help/intro-to-blocks.native.js.map +1 -1
- package/build/components/editor-help/move-blocks.native.js +1 -8
- package/build/components/editor-help/move-blocks.native.js.map +1 -1
- package/build/components/editor-help/remove-blocks.native.js +1 -8
- package/build/components/editor-help/remove-blocks.native.js.map +1 -1
- package/build/components/editor-help/view-sections.native.js +1 -12
- package/build/components/editor-help/view-sections.native.js.map +1 -1
- package/build/components/editor-history/redo.js +6 -14
- package/build/components/editor-history/redo.js.map +1 -1
- package/build/components/editor-history/undo.js +6 -14
- package/build/components/editor-history/undo.js.map +1 -1
- package/build/components/editor-notices/index.js +1 -10
- package/build/components/editor-notices/index.js.map +1 -1
- package/build/components/editor-snackbars/index.js +1 -5
- package/build/components/editor-snackbars/index.js.map +1 -1
- package/build/components/entities-saved-states/entity-record-item.js +3 -10
- package/build/components/entities-saved-states/entity-record-item.js.map +1 -1
- package/build/components/entities-saved-states/entity-type-list.js +3 -15
- package/build/components/entities-saved-states/entity-type-list.js.map +1 -1
- package/build/components/entities-saved-states/hooks/use-is-dirty.js +5 -14
- package/build/components/entities-saved-states/hooks/use-is-dirty.js.map +1 -1
- package/build/components/entities-saved-states/index.js +8 -27
- package/build/components/entities-saved-states/index.js.map +1 -1
- package/build/components/error-boundary/index.js +1 -18
- package/build/components/error-boundary/index.js.map +1 -1
- package/build/components/global-keyboard-shortcuts/index.js +5 -9
- package/build/components/global-keyboard-shortcuts/index.js.map +1 -1
- package/build/components/global-keyboard-shortcuts/register-shortcuts.js +1 -8
- package/build/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
- package/build/components/index.js +4 -76
- package/build/components/index.js.map +1 -1
- package/build/components/index.native.js +0 -9
- package/build/components/index.native.js.map +1 -1
- package/build/components/local-autosave-monitor/index.js +6 -31
- package/build/components/local-autosave-monitor/index.js.map +1 -1
- package/build/components/media-categories/index.js +30 -45
- package/build/components/media-categories/index.js.map +1 -1
- package/build/components/page-attributes/check.js +3 -7
- package/build/components/page-attributes/check.js.map +1 -1
- package/build/components/page-attributes/order.js +17 -42
- package/build/components/page-attributes/order.js.map +1 -1
- package/build/components/page-attributes/parent.js +8 -34
- package/build/components/page-attributes/parent.js.map +1 -1
- package/build/components/post-author/check.js +1 -11
- package/build/components/post-author/check.js.map +1 -1
- package/build/components/post-author/combobox.js +7 -23
- package/build/components/post-author/combobox.js.map +1 -1
- package/build/components/post-author/constants.js +0 -1
- package/build/components/post-author/constants.js.map +1 -1
- package/build/components/post-author/index.js +1 -12
- package/build/components/post-author/index.js.map +1 -1
- package/build/components/post-author/select.js +1 -12
- package/build/components/post-author/select.js.map +1 -1
- package/build/components/post-comments/index.js +1 -10
- package/build/components/post-comments/index.js.map +1 -1
- package/build/components/post-excerpt/check.js +6 -8
- package/build/components/post-excerpt/check.js.map +1 -1
- package/build/components/post-excerpt/index.js +1 -7
- package/build/components/post-excerpt/index.js.map +1 -1
- package/build/components/post-featured-image/check.js +6 -9
- package/build/components/post-featured-image/check.js.map +1 -1
- package/build/components/post-featured-image/index.js +13 -42
- package/build/components/post-featured-image/index.js.map +1 -1
- package/build/components/post-format/check.js +9 -18
- package/build/components/post-format/check.js.map +1 -1
- package/build/components/post-format/index.js +2 -20
- package/build/components/post-format/index.js.map +1 -1
- package/build/components/post-last-revision/check.js +15 -22
- package/build/components/post-last-revision/check.js.map +1 -1
- package/build/components/post-last-revision/index.js +17 -28
- package/build/components/post-last-revision/index.js.map +1 -1
- package/build/components/post-locked-modal/index.js +8 -28
- package/build/components/post-locked-modal/index.js.map +1 -1
- package/build/components/post-pending-status/check.js +16 -24
- package/build/components/post-pending-status/check.js.map +1 -1
- package/build/components/post-pending-status/index.js +10 -28
- package/build/components/post-pending-status/index.js.map +1 -1
- package/build/components/post-pingbacks/index.js +1 -10
- package/build/components/post-pingbacks/index.js.map +1 -1
- package/build/components/post-preview-button/index.js +11 -22
- package/build/components/post-preview-button/index.js.map +1 -1
- package/build/components/post-publish-button/index.js +6 -32
- package/build/components/post-publish-button/index.js.map +1 -1
- package/build/components/post-publish-button/label.js +1 -10
- package/build/components/post-publish-button/label.js.map +1 -1
- package/build/components/post-publish-panel/index.js +1 -22
- package/build/components/post-publish-panel/index.js.map +1 -1
- package/build/components/post-publish-panel/maybe-category-panel.js +4 -14
- package/build/components/post-publish-panel/maybe-category-panel.js.map +1 -1
- package/build/components/post-publish-panel/maybe-post-format-panel.js +2 -18
- package/build/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
- package/build/components/post-publish-panel/maybe-tags-panel.js +2 -17
- package/build/components/post-publish-panel/maybe-tags-panel.js.map +1 -1
- package/build/components/post-publish-panel/maybe-upload-media.js +1 -18
- package/build/components/post-publish-panel/maybe-upload-media.js.map +1 -1
- package/build/components/post-publish-panel/postpublish.js +3 -27
- package/build/components/post-publish-panel/postpublish.js.map +1 -1
- package/build/components/post-publish-panel/prepublish.js +1 -26
- package/build/components/post-publish-panel/prepublish.js.map +1 -1
- package/build/components/post-saved-state/index.js +12 -29
- package/build/components/post-saved-state/index.js.map +1 -1
- package/build/components/post-schedule/check.js +1 -8
- package/build/components/post-schedule/check.js.map +1 -1
- package/build/components/post-schedule/index.js +7 -13
- package/build/components/post-schedule/index.js.map +1 -1
- package/build/components/post-schedule/label.js +18 -29
- package/build/components/post-schedule/label.js.map +1 -1
- package/build/components/post-slug/check.js +1 -4
- package/build/components/post-slug/check.js.map +1 -1
- package/build/components/post-slug/index.js +1 -19
- package/build/components/post-slug/index.js.map +1 -1
- package/build/components/post-sticky/check.js +1 -8
- package/build/components/post-sticky/check.js.map +1 -1
- package/build/components/post-sticky/index.js +1 -12
- package/build/components/post-sticky/index.js.map +1 -1
- package/build/components/post-switch-to-draft-button/index.js +1 -14
- package/build/components/post-switch-to-draft-button/index.js.map +1 -1
- package/build/components/post-sync-status/index.js +5 -18
- package/build/components/post-sync-status/index.js.map +1 -1
- package/build/components/post-taxonomies/check.js +1 -9
- package/build/components/post-taxonomies/check.js.map +1 -1
- package/build/components/post-taxonomies/flat-term-selector.js +15 -50
- package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
- package/build/components/post-taxonomies/hierarchical-term-selector.js +27 -79
- package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
- package/build/components/post-taxonomies/index.js +3 -13
- package/build/components/post-taxonomies/index.js.map +1 -1
- package/build/components/post-taxonomies/most-used-terms.js +1 -9
- package/build/components/post-taxonomies/most-used-terms.js.map +1 -1
- package/build/components/post-template/index.js +1 -11
- package/build/components/post-template/index.js.map +1 -1
- package/build/components/post-text-editor/index.js +3 -17
- package/build/components/post-text-editor/index.js.map +1 -1
- package/build/components/post-title/index.js +14 -46
- package/build/components/post-title/index.js.map +1 -1
- package/build/components/post-title/index.native.js +7 -44
- package/build/components/post-title/index.native.js.map +1 -1
- package/build/components/post-trash/check.js +1 -7
- package/build/components/post-trash/check.js.map +1 -1
- package/build/components/post-trash/index.js +1 -8
- package/build/components/post-trash/index.js.map +1 -1
- package/build/components/post-type-support-check/index.js +0 -9
- package/build/components/post-type-support-check/index.js.map +1 -1
- package/build/components/post-url/check.js +1 -12
- package/build/components/post-url/check.js.map +1 -1
- package/build/components/post-url/index.js +3 -15
- package/build/components/post-url/index.js.map +1 -1
- package/build/components/post-url/label.js +1 -5
- package/build/components/post-url/label.js.map +1 -1
- package/build/components/post-visibility/check.js +1 -7
- package/build/components/post-visibility/check.js.map +1 -1
- package/build/components/post-visibility/index.js +1 -17
- package/build/components/post-visibility/index.js.map +1 -1
- package/build/components/post-visibility/label.js +1 -5
- package/build/components/post-visibility/label.js.map +1 -1
- package/build/components/post-visibility/utils.js +1 -2
- package/build/components/post-visibility/utils.js.map +1 -1
- package/build/components/provider/index.js +13 -27
- package/build/components/provider/index.js.map +1 -1
- package/build/components/provider/index.native.js +18 -70
- package/build/components/provider/index.native.js.map +1 -1
- package/build/components/provider/use-block-editor-settings.js +9 -20
- package/build/components/provider/use-block-editor-settings.js.map +1 -1
- package/build/components/provider/use-block-editor-settings.native.js +5 -11
- package/build/components/provider/use-block-editor-settings.native.js.map +1 -1
- package/build/components/provider/with-registry-provider.js +5 -12
- package/build/components/provider/with-registry-provider.js.map +1 -1
- package/build/components/table-of-contents/index.js +4 -14
- package/build/components/table-of-contents/index.js.map +1 -1
- package/build/components/table-of-contents/panel.js +1 -13
- package/build/components/table-of-contents/panel.js.map +1 -1
- package/build/components/template-validation-notice/index.js +3 -12
- package/build/components/template-validation-notice/index.js.map +1 -1
- package/build/components/theme-support-check/index.js +3 -12
- package/build/components/theme-support-check/index.js.map +1 -1
- package/build/components/time-to-read/index.js +2 -10
- package/build/components/time-to-read/index.js.map +1 -1
- package/build/components/unsaved-changes-warning/index.js +21 -35
- package/build/components/unsaved-changes-warning/index.js.map +1 -1
- package/build/components/word-count/index.js +2 -7
- package/build/components/word-count/index.js.map +1 -1
- package/build/hooks/custom-sources-backwards-compatibility.js +7 -18
- package/build/hooks/custom-sources-backwards-compatibility.js.map +1 -1
- package/build/hooks/default-autocompleters.js +3 -4
- package/build/hooks/default-autocompleters.js.map +1 -1
- package/build/hooks/index.js +0 -1
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/index.native.js.map +1 -1
- package/build/index.js +0 -9
- package/build/index.js.map +1 -1
- package/build/index.native.js +0 -11
- package/build/index.native.js.map +1 -1
- package/build/lock-unlock.js +1 -2
- package/build/lock-unlock.js.map +1 -1
- package/build/private-apis.js +1 -4
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +60 -129
- package/build/store/actions.js.map +1 -1
- package/build/store/actions.native.js +1 -8
- package/build/store/actions.native.js.map +1 -1
- package/build/store/constants.js +1 -2
- package/build/store/constants.js.map +1 -1
- package/build/store/defaults.js +2 -3
- package/build/store/defaults.js.map +1 -1
- package/build/store/index.js +3 -11
- package/build/store/index.js.map +1 -1
- package/build/store/local-autosave.js +0 -4
- package/build/store/local-autosave.js.map +1 -1
- package/build/store/reducer.js +19 -49
- package/build/store/reducer.js.map +1 -1
- package/build/store/reducer.native.js +3 -17
- package/build/store/reducer.native.js.map +1 -1
- package/build/store/selectors.js +169 -295
- package/build/store/selectors.js.map +1 -1
- package/build/store/selectors.native.js +4 -11
- package/build/store/selectors.native.js.map +1 -1
- package/build/store/utils/notice-builder.js +13 -24
- package/build/store/utils/notice-builder.js.map +1 -1
- package/build/utils/get-template-part-icon.js +0 -3
- package/build/utils/get-template-part-icon.js.map +1 -1
- package/build/utils/index.js +0 -4
- package/build/utils/index.js.map +1 -1
- package/build/utils/index.native.js +0 -2
- package/build/utils/index.native.js.map +1 -1
- package/build/utils/media-upload/index.js +2 -6
- package/build/utils/media-upload/index.js.map +1 -1
- package/build/utils/media-upload/index.native.js +0 -1
- package/build/utils/media-upload/index.native.js.map +1 -1
- package/build/utils/terms.js +8 -18
- package/build/utils/terms.js.map +1 -1
- package/build/utils/url.js +0 -4
- package/build/utils/url.js.map +1 -1
- package/build-module/components/autocompleters/index.js.map +1 -1
- package/build-module/components/autocompleters/user.js +2 -5
- package/build-module/components/autocompleters/user.js.map +1 -1
- package/build-module/components/autosave-monitor/index.js +2 -17
- package/build-module/components/autosave-monitor/index.js.map +1 -1
- package/build-module/components/character-count/index.js +1 -1
- package/build-module/components/character-count/index.js.map +1 -1
- package/build-module/components/deprecated.js +0 -4
- package/build-module/components/deprecated.js.map +1 -1
- package/build-module/components/deprecated.native.js +0 -1
- package/build-module/components/deprecated.native.js.map +1 -1
- package/build-module/components/document-outline/check.js +0 -4
- package/build-module/components/document-outline/check.js.map +1 -1
- package/build-module/components/document-outline/index.js +9 -13
- package/build-module/components/document-outline/index.js.map +1 -1
- package/build-module/components/document-outline/item.js +0 -3
- package/build-module/components/document-outline/item.js.map +1 -1
- package/build-module/components/editor-help/add-blocks.native.js +2 -5
- package/build-module/components/editor-help/add-blocks.native.js.map +1 -1
- package/build-module/components/editor-help/customize-blocks.native.js +2 -5
- package/build-module/components/editor-help/customize-blocks.native.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 +2 -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 +2 -5
- 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 +1 -6
- package/build-module/components/editor-help/help-topic-row.native.js.map +1 -1
- package/build-module/components/editor-help/icon-move-blocks.native.js +0 -1
- package/build-module/components/editor-help/icon-move-blocks.native.js.map +1 -1
- package/build-module/components/editor-help/index.native.js +9 -9
- package/build-module/components/editor-help/index.native.js.map +1 -1
- package/build-module/components/editor-help/intro-to-blocks.native.js +2 -5
- package/build-module/components/editor-help/intro-to-blocks.native.js.map +1 -1
- package/build-module/components/editor-help/move-blocks.native.js +2 -5
- package/build-module/components/editor-help/move-blocks.native.js.map +1 -1
- package/build-module/components/editor-help/remove-blocks.native.js +2 -5
- package/build-module/components/editor-help/remove-blocks.native.js.map +1 -1
- package/build-module/components/editor-help/view-sections.native.js +2 -4
- package/build-module/components/editor-help/view-sections.native.js.map +1 -1
- package/build-module/components/editor-history/redo.js +6 -8
- package/build-module/components/editor-history/redo.js.map +1 -1
- package/build-module/components/editor-history/undo.js +6 -8
- package/build-module/components/editor-history/undo.js.map +1 -1
- package/build-module/components/editor-notices/index.js +1 -2
- package/build-module/components/editor-notices/index.js.map +1 -1
- package/build-module/components/editor-snackbars/index.js +0 -1
- package/build-module/components/editor-snackbars/index.js.map +1 -1
- package/build-module/components/entities-saved-states/entity-record-item.js +3 -4
- 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 +3 -10
- 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 +4 -7
- package/build-module/components/entities-saved-states/hooks/use-is-dirty.js.map +1 -1
- package/build-module/components/entities-saved-states/index.js +8 -16
- package/build-module/components/entities-saved-states/index.js.map +1 -1
- package/build-module/components/error-boundary/index.js +1 -12
- package/build-module/components/error-boundary/index.js.map +1 -1
- package/build-module/components/global-keyboard-shortcuts/index.js +5 -6
- package/build-module/components/global-keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js +0 -3
- package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
- package/build-module/components/index.js +6 -3
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/index.native.js +4 -2
- package/build-module/components/index.native.js.map +1 -1
- package/build-module/components/local-autosave-monitor/index.js +6 -21
- package/build-module/components/local-autosave-monitor/index.js.map +1 -1
- package/build-module/components/media-categories/index.js +31 -41
- package/build-module/components/media-categories/index.js.map +1 -1
- package/build-module/components/page-attributes/check.js +3 -3
- package/build-module/components/page-attributes/check.js.map +1 -1
- package/build-module/components/page-attributes/order.js +17 -31
- package/build-module/components/page-attributes/order.js.map +1 -1
- package/build-module/components/page-attributes/parent.js +9 -23
- package/build-module/components/page-attributes/parent.js.map +1 -1
- package/build-module/components/post-author/check.js +1 -5
- package/build-module/components/post-author/check.js.map +1 -1
- package/build-module/components/post-author/combobox.js +7 -16
- package/build-module/components/post-author/combobox.js.map +1 -1
- package/build-module/components/post-author/constants.js +0 -1
- package/build-module/components/post-author/constants.js.map +1 -1
- package/build-module/components/post-author/index.js +1 -6
- package/build-module/components/post-author/index.js.map +1 -1
- package/build-module/components/post-author/select.js +1 -6
- package/build-module/components/post-author/select.js.map +1 -1
- package/build-module/components/post-comments/index.js +1 -7
- package/build-module/components/post-comments/index.js.map +1 -1
- package/build-module/components/post-excerpt/check.js +5 -6
- package/build-module/components/post-excerpt/check.js.map +1 -1
- package/build-module/components/post-excerpt/index.js +1 -4
- package/build-module/components/post-excerpt/index.js.map +1 -1
- package/build-module/components/post-featured-image/check.js +5 -6
- package/build-module/components/post-featured-image/check.js.map +1 -1
- package/build-module/components/post-featured-image/index.js +13 -31
- package/build-module/components/post-featured-image/index.js.map +1 -1
- package/build-module/components/post-format/check.js +10 -15
- package/build-module/components/post-format/check.js.map +1 -1
- package/build-module/components/post-format/index.js +4 -12
- package/build-module/components/post-format/index.js.map +1 -1
- package/build-module/components/post-last-revision/check.js +17 -17
- package/build-module/components/post-last-revision/check.js.map +1 -1
- package/build-module/components/post-last-revision/index.js +18 -21
- package/build-module/components/post-last-revision/index.js.map +1 -1
- package/build-module/components/post-locked-modal/index.js +8 -22
- package/build-module/components/post-locked-modal/index.js.map +1 -1
- package/build-module/components/post-pending-status/check.js +17 -20
- package/build-module/components/post-pending-status/check.js.map +1 -1
- package/build-module/components/post-pending-status/index.js +11 -20
- package/build-module/components/post-pending-status/index.js.map +1 -1
- package/build-module/components/post-pingbacks/index.js +1 -7
- package/build-module/components/post-pingbacks/index.js.map +1 -1
- package/build-module/components/post-preview-button/index.js +11 -17
- package/build-module/components/post-preview-button/index.js.map +1 -1
- package/build-module/components/post-publish-button/index.js +7 -23
- package/build-module/components/post-publish-button/index.js.map +1 -1
- package/build-module/components/post-publish-button/label.js +1 -4
- package/build-module/components/post-publish-button/label.js.map +1 -1
- package/build-module/components/post-publish-panel/index.js +1 -8
- package/build-module/components/post-publish-panel/index.js.map +1 -1
- package/build-module/components/post-publish-panel/maybe-category-panel.js +4 -8
- 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 +2 -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 +2 -9
- 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 +1 -12
- package/build-module/components/post-publish-panel/maybe-upload-media.js.map +1 -1
- package/build-module/components/post-publish-panel/postpublish.js +3 -16
- package/build-module/components/post-publish-panel/postpublish.js.map +1 -1
- package/build-module/components/post-publish-panel/prepublish.js +1 -10
- package/build-module/components/post-publish-panel/prepublish.js.map +1 -1
- package/build-module/components/post-saved-state/index.js +15 -23
- package/build-module/components/post-saved-state/index.js.map +1 -1
- package/build-module/components/post-schedule/check.js +1 -3
- package/build-module/components/post-schedule/check.js.map +1 -1
- package/build-module/components/post-schedule/index.js +8 -8
- package/build-module/components/post-schedule/index.js.map +1 -1
- package/build-module/components/post-schedule/label.js +18 -22
- package/build-module/components/post-schedule/label.js.map +1 -1
- package/build-module/components/post-slug/check.js +0 -1
- package/build-module/components/post-slug/check.js.map +1 -1
- package/build-module/components/post-slug/index.js +1 -8
- package/build-module/components/post-slug/index.js.map +1 -1
- package/build-module/components/post-sticky/check.js +1 -3
- package/build-module/components/post-sticky/check.js.map +1 -1
- package/build-module/components/post-sticky/index.js +1 -3
- package/build-module/components/post-sticky/index.js.map +1 -1
- package/build-module/components/post-switch-to-draft-button/index.js +1 -9
- package/build-module/components/post-switch-to-draft-button/index.js.map +1 -1
- package/build-module/components/post-sync-status/index.js +5 -11
- package/build-module/components/post-sync-status/index.js.map +1 -1
- package/build-module/components/post-taxonomies/check.js +1 -3
- package/build-module/components/post-taxonomies/check.js.map +1 -1
- package/build-module/components/post-taxonomies/flat-term-selector.js +17 -39
- package/build-module/components/post-taxonomies/flat-term-selector.js.map +1 -1
- package/build-module/components/post-taxonomies/hierarchical-term-selector.js +29 -66
- package/build-module/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
- package/build-module/components/post-taxonomies/index.js +3 -5
- package/build-module/components/post-taxonomies/index.js.map +1 -1
- package/build-module/components/post-taxonomies/most-used-terms.js +1 -4
- package/build-module/components/post-taxonomies/most-used-terms.js.map +1 -1
- package/build-module/components/post-template/index.js +1 -5
- package/build-module/components/post-template/index.js.map +1 -1
- package/build-module/components/post-text-editor/index.js +4 -9
- package/build-module/components/post-text-editor/index.js.map +1 -1
- package/build-module/components/post-title/index.js +17 -35
- package/build-module/components/post-title/index.js.map +1 -1
- package/build-module/components/post-title/index.native.js +8 -33
- package/build-module/components/post-title/index.native.js.map +1 -1
- package/build-module/components/post-trash/check.js +1 -4
- package/build-module/components/post-trash/check.js.map +1 -1
- package/build-module/components/post-trash/index.js +1 -4
- package/build-module/components/post-trash/index.js.map +1 -1
- package/build-module/components/post-type-support-check/index.js +3 -6
- package/build-module/components/post-type-support-check/index.js.map +1 -1
- package/build-module/components/post-url/check.js +1 -9
- package/build-module/components/post-url/check.js.map +1 -1
- package/build-module/components/post-url/index.js +3 -8
- package/build-module/components/post-url/index.js.map +1 -1
- package/build-module/components/post-url/label.js +1 -1
- package/build-module/components/post-url/label.js.map +1 -1
- package/build-module/components/post-visibility/check.js +1 -2
- package/build-module/components/post-visibility/check.js.map +1 -1
- package/build-module/components/post-visibility/index.js +1 -10
- package/build-module/components/post-visibility/index.js.map +1 -1
- package/build-module/components/post-visibility/label.js +1 -1
- package/build-module/components/post-visibility/label.js.map +1 -1
- package/build-module/components/post-visibility/utils.js.map +1 -1
- package/build-module/components/provider/index.js +13 -14
- package/build-module/components/provider/index.js.map +1 -1
- package/build-module/components/provider/index.native.js +21 -52
- package/build-module/components/provider/index.native.js.map +1 -1
- package/build-module/components/provider/use-block-editor-settings.js +9 -12
- package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
- package/build-module/components/provider/use-block-editor-settings.native.js +5 -5
- package/build-module/components/provider/use-block-editor-settings.native.js.map +1 -1
- package/build-module/components/provider/with-registry-provider.js +5 -8
- package/build-module/components/provider/with-registry-provider.js.map +1 -1
- package/build-module/components/table-of-contents/index.js +4 -7
- package/build-module/components/table-of-contents/index.js.map +1 -1
- package/build-module/components/table-of-contents/panel.js +1 -5
- package/build-module/components/table-of-contents/panel.js.map +1 -1
- package/build-module/components/template-validation-notice/index.js +2 -6
- package/build-module/components/template-validation-notice/index.js.map +1 -1
- package/build-module/components/theme-support-check/index.js +3 -7
- package/build-module/components/theme-support-check/index.js.map +1 -1
- package/build-module/components/time-to-read/index.js +4 -7
- package/build-module/components/time-to-read/index.js.map +1 -1
- package/build-module/components/unsaved-changes-warning/index.js +22 -31
- package/build-module/components/unsaved-changes-warning/index.js.map +1 -1
- package/build-module/components/word-count/index.js +2 -4
- package/build-module/components/word-count/index.js.map +1 -1
- package/build-module/hooks/custom-sources-backwards-compatibility.js +9 -15
- package/build-module/hooks/custom-sources-backwards-compatibility.js.map +1 -1
- package/build-module/hooks/default-autocompleters.js +3 -4
- package/build-module/hooks/default-autocompleters.js.map +1 -1
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/index.native.js.map +1 -1
- package/build-module/index.js +1 -1
- package/build-module/index.js.map +1 -1
- package/build-module/index.native.js +1 -1
- package/build-module/index.native.js.map +1 -1
- package/build-module/lock-unlock.js.map +1 -1
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/actions.js +62 -84
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/actions.native.js +2 -2
- package/build-module/store/actions.native.js.map +1 -1
- package/build-module/store/constants.js +1 -1
- package/build-module/store/constants.js.map +1 -1
- package/build-module/store/defaults.js +3 -2
- package/build-module/store/defaults.js.map +1 -1
- package/build-module/store/index.js +5 -4
- package/build-module/store/index.js.map +1 -1
- package/build-module/store/local-autosave.js +0 -1
- package/build-module/store/local-autosave.js.map +1 -1
- package/build-module/store/reducer.js +21 -33
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/reducer.native.js +4 -10
- package/build-module/store/reducer.native.js.map +1 -1
- package/build-module/store/selectors.js +172 -222
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/store/selectors.native.js +6 -8
- package/build-module/store/selectors.native.js.map +1 -1
- package/build-module/store/utils/notice-builder.js +15 -21
- package/build-module/store/utils/notice-builder.js.map +1 -1
- package/build-module/utils/get-template-part-icon.js +0 -2
- package/build-module/utils/get-template-part-icon.js.map +1 -1
- package/build-module/utils/index.js.map +1 -1
- package/build-module/utils/index.native.js.map +1 -1
- package/build-module/utils/media-upload/index.js +2 -4
- package/build-module/utils/media-upload/index.js.map +1 -1
- package/build-module/utils/media-upload/index.native.js.map +1 -1
- package/build-module/utils/terms.js +9 -11
- package/build-module/utils/terms.js.map +1 -1
- package/build-module/utils/url.js +1 -1
- package/build-module/utils/url.js.map +1 -1
- package/build-style/style-rtl.css +10 -17
- package/build-style/style.css +10 -17
- package/package.json +32 -31
- package/src/components/editor-help/index.native.js +1 -1
- package/src/components/editor-help/style.scss +5 -0
- package/src/components/page-attributes/order.js +15 -23
- package/src/components/page-attributes/test/order.js +46 -15
- package/src/components/post-excerpt/check.js +6 -2
- package/src/components/post-featured-image/check.js +4 -2
- package/src/components/post-format/check.js +16 -11
- package/src/components/post-last-revision/check.js +12 -14
- package/src/components/post-last-revision/index.js +12 -10
- package/src/components/post-last-revision/test/check.js +28 -16
- package/src/components/post-pending-status/check.js +13 -19
- package/src/components/post-pending-status/index.js +9 -14
- package/src/components/post-pending-status/test/check.js +32 -10
- package/src/components/post-publish-panel/style.scss +12 -25
- package/src/components/post-sync-status/style.scss +4 -1
- package/src/components/post-type-support-check/index.js +1 -1
- package/src/components/post-type-support-check/test/index.js +1 -1
- package/src/components/provider/index.js +3 -2
- package/src/components/unsaved-changes-warning/index.js +22 -27
|
@@ -5,13 +5,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.PostStickyCheck = PostStickyCheck;
|
|
7
7
|
exports.default = void 0;
|
|
8
|
-
|
|
9
8
|
var _compose = require("@wordpress/compose");
|
|
10
|
-
|
|
11
9
|
var _data = require("@wordpress/data");
|
|
12
|
-
|
|
13
10
|
var _store = require("../../store");
|
|
14
|
-
|
|
15
11
|
/**
|
|
16
12
|
* WordPress dependencies
|
|
17
13
|
*/
|
|
@@ -19,6 +15,7 @@ var _store = require("../../store");
|
|
|
19
15
|
/**
|
|
20
16
|
* Internal dependencies
|
|
21
17
|
*/
|
|
18
|
+
|
|
22
19
|
function PostStickyCheck({
|
|
23
20
|
hasStickyAction,
|
|
24
21
|
postType,
|
|
@@ -27,19 +24,15 @@ function PostStickyCheck({
|
|
|
27
24
|
if (postType !== 'post' || !hasStickyAction) {
|
|
28
25
|
return null;
|
|
29
26
|
}
|
|
30
|
-
|
|
31
27
|
return children;
|
|
32
28
|
}
|
|
33
|
-
|
|
34
29
|
var _default = (0, _compose.compose)([(0, _data.withSelect)(select => {
|
|
35
30
|
var _post$_links$wpActio;
|
|
36
|
-
|
|
37
31
|
const post = select(_store.store).getCurrentPost();
|
|
38
32
|
return {
|
|
39
33
|
hasStickyAction: (_post$_links$wpActio = post._links?.['wp:action-sticky']) !== null && _post$_links$wpActio !== void 0 ? _post$_links$wpActio : false,
|
|
40
34
|
postType: select(_store.store).getCurrentPostType()
|
|
41
35
|
};
|
|
42
36
|
})])(PostStickyCheck);
|
|
43
|
-
|
|
44
37
|
exports.default = _default;
|
|
45
38
|
//# sourceMappingURL=check.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["_compose","require","_data","_store","PostStickyCheck","hasStickyAction","postType","children","_default","compose","withSelect","select","_post$_links$wpActio","post","editorStore","getCurrentPost","_links","getCurrentPostType","exports","default"],"sources":["@wordpress/editor/src/components/post-sticky/check.js"],"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"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAKA,IAAAE,MAAA,GAAAF,OAAA;AATA;AACA;AACA;;AAIA;AACA;AACA;;AAGO,SAASG,eAAeA,CAAE;EAAEC,eAAe;EAAEC,QAAQ;EAAEC;AAAS,CAAC,EAAG;EAC1E,IAAKD,QAAQ,KAAK,MAAM,IAAI,CAAED,eAAe,EAAG;IAC/C,OAAO,IAAI;EACZ;EAEA,OAAOE,QAAQ;AAChB;AAAC,IAAAC,QAAA,GAEc,IAAAC,gBAAO,EAAE,CACvB,IAAAC,gBAAU,EAAIC,MAAM,IAAM;EAAA,IAAAC,oBAAA;EACzB,MAAMC,IAAI,GAAGF,MAAM,CAAEG,YAAY,CAAC,CAACC,cAAc,CAAC,CAAC;EACnD,OAAO;IACNV,eAAe,GAAAO,oBAAA,GAAEC,IAAI,CAACG,MAAM,GAAI,kBAAkB,CAAE,cAAAJ,oBAAA,cAAAA,oBAAA,GAAI,KAAK;IAC7DN,QAAQ,EAAEK,MAAM,CAAEG,YAAY,CAAC,CAACG,kBAAkB,CAAC;EACpD,CAAC;AACF,CAAE,CAAC,CACF,CAAC,CAAEb,eAAgB,CAAC;AAAAc,OAAA,CAAAC,OAAA,GAAAX,QAAA"}
|
|
@@ -1,27 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.PostSticky = PostSticky;
|
|
9
8
|
exports.default = void 0;
|
|
10
|
-
|
|
11
9
|
var _element = require("@wordpress/element");
|
|
12
|
-
|
|
13
10
|
var _i18n = require("@wordpress/i18n");
|
|
14
|
-
|
|
15
11
|
var _components = require("@wordpress/components");
|
|
16
|
-
|
|
17
12
|
var _data = require("@wordpress/data");
|
|
18
|
-
|
|
19
13
|
var _compose = require("@wordpress/compose");
|
|
20
|
-
|
|
21
14
|
var _check = _interopRequireDefault(require("./check"));
|
|
22
|
-
|
|
23
15
|
var _store = require("../../store");
|
|
24
|
-
|
|
25
16
|
/**
|
|
26
17
|
* WordPress dependencies
|
|
27
18
|
*/
|
|
@@ -29,6 +20,7 @@ var _store = require("../../store");
|
|
|
29
20
|
/**
|
|
30
21
|
* Internal dependencies
|
|
31
22
|
*/
|
|
23
|
+
|
|
32
24
|
function PostSticky({
|
|
33
25
|
onUpdateSticky,
|
|
34
26
|
postSticky = false
|
|
@@ -40,7 +32,6 @@ function PostSticky({
|
|
|
40
32
|
onChange: () => onUpdateSticky(!postSticky)
|
|
41
33
|
}));
|
|
42
34
|
}
|
|
43
|
-
|
|
44
35
|
var _default = (0, _compose.compose)([(0, _data.withSelect)(select => {
|
|
45
36
|
return {
|
|
46
37
|
postSticky: select(_store.store).getEditedPostAttribute('sticky')
|
|
@@ -52,9 +43,7 @@ var _default = (0, _compose.compose)([(0, _data.withSelect)(select => {
|
|
|
52
43
|
sticky: postSticky
|
|
53
44
|
});
|
|
54
45
|
}
|
|
55
|
-
|
|
56
46
|
};
|
|
57
47
|
})])(PostSticky);
|
|
58
|
-
|
|
59
48
|
exports.default = _default;
|
|
60
49
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["_i18n","require","_components","_data","_compose","_check","_interopRequireDefault","_store","PostSticky","onUpdateSticky","postSticky","_element","createElement","default","CheckboxControl","__nextHasNoMarginBottom","label","__","checked","onChange","_default","compose","withSelect","select","editorStore","getEditedPostAttribute","withDispatch","dispatch","editPost","sticky","exports"],"sources":["@wordpress/editor/src/components/post-sticky/index.js"],"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"],"mappings":";;;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAC,sBAAA,CAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AAZA;AACA;AACA;;AAMA;AACA;AACA;;AAIO,SAASO,UAAUA,CAAE;EAAEC,cAAc;EAAEC,UAAU,GAAG;AAAM,CAAC,EAAG;EACpE,OACC,IAAAC,QAAA,CAAAC,aAAA,EAACP,MAAA,CAAAQ,OAAe,QACf,IAAAF,QAAA,CAAAC,aAAA,EAACV,WAAA,CAAAY,eAAe;IACfC,uBAAuB;IACvBC,KAAK,EAAG,IAAAC,QAAE,EAAE,8BAA+B,CAAG;IAC9CC,OAAO,EAAGR,UAAY;IACtBS,QAAQ,EAAGA,CAAA,KAAMV,cAAc,CAAE,CAAEC,UAAW;EAAG,CACjD,CACe,CAAC;AAEpB;AAAC,IAAAU,QAAA,GAEc,IAAAC,gBAAO,EAAE,CACvB,IAAAC,gBAAU,EAAIC,MAAM,IAAM;EACzB,OAAO;IACNb,UAAU,EACTa,MAAM,CAAEC,YAAY,CAAC,CAACC,sBAAsB,CAAE,QAAS;EACzD,CAAC;AACF,CAAE,CAAC,EACH,IAAAC,kBAAY,EAAIC,QAAQ,IAAM;EAC7B,OAAO;IACNlB,cAAcA,CAAEC,UAAU,EAAG;MAC5BiB,QAAQ,CAAEH,YAAY,CAAC,CAACI,QAAQ,CAAE;QAAEC,MAAM,EAAEnB;MAAW,CAAE,CAAC;IAC3D;EACD,CAAC;AACF,CAAE,CAAC,CACF,CAAC,CAAEF,UAAW,CAAC;AAAAsB,OAAA,CAAAjB,OAAA,GAAAO,QAAA"}
|
|
@@ -4,19 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _element = require("@wordpress/element");
|
|
9
|
-
|
|
10
8
|
var _components = require("@wordpress/components");
|
|
11
|
-
|
|
12
9
|
var _i18n = require("@wordpress/i18n");
|
|
13
|
-
|
|
14
10
|
var _data = require("@wordpress/data");
|
|
15
|
-
|
|
16
11
|
var _compose = require("@wordpress/compose");
|
|
17
|
-
|
|
18
12
|
var _store = require("../../store");
|
|
19
|
-
|
|
20
13
|
/**
|
|
21
14
|
* WordPress dependencies
|
|
22
15
|
*/
|
|
@@ -24,6 +17,7 @@ var _store = require("../../store");
|
|
|
24
17
|
/**
|
|
25
18
|
* Internal dependencies
|
|
26
19
|
*/
|
|
20
|
+
|
|
27
21
|
function PostSwitchToDraftButton({
|
|
28
22
|
isSaving,
|
|
29
23
|
isPublished,
|
|
@@ -31,24 +25,19 @@ function PostSwitchToDraftButton({
|
|
|
31
25
|
onClick
|
|
32
26
|
}) {
|
|
33
27
|
const [showConfirmDialog, setShowConfirmDialog] = (0, _element.useState)(false);
|
|
34
|
-
|
|
35
28
|
if (!isPublished && !isScheduled) {
|
|
36
29
|
return null;
|
|
37
30
|
}
|
|
38
|
-
|
|
39
31
|
let alertMessage;
|
|
40
|
-
|
|
41
32
|
if (isPublished) {
|
|
42
33
|
alertMessage = (0, _i18n.__)('Are you sure you want to unpublish this post?');
|
|
43
34
|
} else if (isScheduled) {
|
|
44
35
|
alertMessage = (0, _i18n.__)('Are you sure you want to unschedule this post?');
|
|
45
36
|
}
|
|
46
|
-
|
|
47
37
|
const handleConfirm = () => {
|
|
48
38
|
setShowConfirmDialog(false);
|
|
49
39
|
onClick();
|
|
50
40
|
};
|
|
51
|
-
|
|
52
41
|
return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_components.Button, {
|
|
53
42
|
className: "editor-post-switch-to-draft",
|
|
54
43
|
onClick: () => {
|
|
@@ -66,7 +55,6 @@ function PostSwitchToDraftButton({
|
|
|
66
55
|
onCancel: () => setShowConfirmDialog(false)
|
|
67
56
|
}, alertMessage));
|
|
68
57
|
}
|
|
69
|
-
|
|
70
58
|
var _default = (0, _compose.compose)([(0, _data.withSelect)(select => {
|
|
71
59
|
const {
|
|
72
60
|
isSavingPost,
|
|
@@ -92,6 +80,5 @@ var _default = (0, _compose.compose)([(0, _data.withSelect)(select => {
|
|
|
92
80
|
}
|
|
93
81
|
};
|
|
94
82
|
})])(PostSwitchToDraftButton);
|
|
95
|
-
|
|
96
83
|
exports.default = _default;
|
|
97
84
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["_element","require","_components","_i18n","_data","_compose","_store","PostSwitchToDraftButton","isSaving","isPublished","isScheduled","onClick","showConfirmDialog","setShowConfirmDialog","useState","alertMessage","__","handleConfirm","createElement","Fragment","Button","className","disabled","variant","style","flexGrow","justifyContent","__experimentalConfirmDialog","isOpen","onConfirm","onCancel","_default","compose","withSelect","select","isSavingPost","isCurrentPostPublished","isCurrentPostScheduled","editorStore","withDispatch","dispatch","editPost","savePost","status","exports","default"],"sources":["@wordpress/editor/src/components/post-switch-to-draft-button/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\t__experimentalConfirmDialog as ConfirmDialog,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { compose } 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<>\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={ { flexGrow: '1', justifyContent: 'center' } }\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</>\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"],"mappings":";;;;;;AAUA,IAAAA,QAAA,GAAAC,OAAA;AAPA,IAAAC,WAAA,GAAAD,OAAA;AAIA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AAMA,IAAAK,MAAA,GAAAL,OAAA;AAfA;AACA;AACA;;AAUA;AACA;AACA;;AAGA,SAASM,uBAAuBA,CAAE;EACjCC,QAAQ;EACRC,WAAW;EACXC,WAAW;EACXC;AACD,CAAC,EAAG;EACH,MAAM,CAAEC,iBAAiB,EAAEC,oBAAoB,CAAE,GAAG,IAAAC,iBAAQ,EAAE,KAAM,CAAC;EAErE,IAAK,CAAEL,WAAW,IAAI,CAAEC,WAAW,EAAG;IACrC,OAAO,IAAI;EACZ;EAEA,IAAIK,YAAY;EAChB,IAAKN,WAAW,EAAG;IAClBM,YAAY,GAAG,IAAAC,QAAE,EAAE,+CAAgD,CAAC;EACrE,CAAC,MAAM,IAAKN,WAAW,EAAG;IACzBK,YAAY,GAAG,IAAAC,QAAE,EAAE,gDAAiD,CAAC;EACtE;EAEA,MAAMC,aAAa,GAAGA,CAAA,KAAM;IAC3BJ,oBAAoB,CAAE,KAAM,CAAC;IAC7BF,OAAO,CAAC,CAAC;EACV,CAAC;EAED,OACC,IAAAX,QAAA,CAAAkB,aAAA,EAAAlB,QAAA,CAAAmB,QAAA,QACC,IAAAnB,QAAA,CAAAkB,aAAA,EAAChB,WAAA,CAAAkB,MAAM;IACNC,SAAS,EAAC,6BAA6B;IACvCV,OAAO,EAAGA,CAAA,KAAM;MACfE,oBAAoB,CAAE,IAAK,CAAC;IAC7B,CAAG;IACHS,QAAQ,EAAGd,QAAU;IACrBe,OAAO,EAAC,WAAW;IACnBC,KAAK,EAAG;MAAEC,QAAQ,EAAE,GAAG;MAAEC,cAAc,EAAE;IAAS;EAAG,GAEnD,IAAAV,QAAE,EAAE,iBAAkB,CACjB,CAAC,EACT,IAAAhB,QAAA,CAAAkB,aAAA,EAAChB,WAAA,CAAAyB,2BAAa;IACbC,MAAM,EAAGhB,iBAAmB;IAC5BiB,SAAS,EAAGZ,aAAe;IAC3Ba,QAAQ,EAAGA,CAAA,KAAMjB,oBAAoB,CAAE,KAAM;EAAG,GAE9CE,YACY,CACd,CAAC;AAEL;AAAC,IAAAgB,QAAA,GAEc,IAAAC,gBAAO,EAAE,CACvB,IAAAC,gBAAU,EAAIC,MAAM,IAAM;EACzB,MAAM;IAAEC,YAAY;IAAEC,sBAAsB;IAAEC;EAAuB,CAAC,GACrEH,MAAM,CAAEI,YAAY,CAAC;EACtB,OAAO;IACN9B,QAAQ,EAAE2B,YAAY,CAAC,CAAC;IACxB1B,WAAW,EAAE2B,sBAAsB,CAAC,CAAC;IACrC1B,WAAW,EAAE2B,sBAAsB,CAAC;EACrC,CAAC;AACF,CAAE,CAAC,EACH,IAAAE,kBAAY,EAAIC,QAAQ,IAAM;EAC7B,MAAM;IAAEC,QAAQ;IAAEC;EAAS,CAAC,GAAGF,QAAQ,CAAEF,YAAY,CAAC;EACtD,OAAO;IACN3B,OAAO,EAAEA,CAAA,KAAM;MACd8B,QAAQ,CAAE;QAAEE,MAAM,EAAE;MAAQ,CAAE,CAAC;MAC/BD,QAAQ,CAAC,CAAC;IACX;EACD,CAAC;AACF,CAAE,CAAC,CACF,CAAC,CAAEnC,uBAAwB,CAAC;AAAAqC,OAAA,CAAAC,OAAA,GAAAd,QAAA"}
|
|
@@ -5,21 +5,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.PostSyncStatusModal = PostSyncStatusModal;
|
|
7
7
|
exports.default = PostSyncStatus;
|
|
8
|
-
|
|
9
8
|
var _element = require("@wordpress/element");
|
|
10
|
-
|
|
11
9
|
var _data = require("@wordpress/data");
|
|
12
|
-
|
|
13
10
|
var _i18n = require("@wordpress/i18n");
|
|
14
|
-
|
|
15
11
|
var _components = require("@wordpress/components");
|
|
16
|
-
|
|
17
12
|
var _blockEditor = require("@wordpress/block-editor");
|
|
18
|
-
|
|
19
13
|
var _store = require("../../store");
|
|
20
|
-
|
|
21
14
|
var _lockUnlock = require("../../lock-unlock");
|
|
22
|
-
|
|
23
15
|
/**
|
|
24
16
|
* WordPress dependencies
|
|
25
17
|
*/
|
|
@@ -27,6 +19,7 @@ var _lockUnlock = require("../../lock-unlock");
|
|
|
27
19
|
/**
|
|
28
20
|
* Internal dependencies
|
|
29
21
|
*/
|
|
22
|
+
|
|
30
23
|
function PostSyncStatus() {
|
|
31
24
|
const {
|
|
32
25
|
syncStatus,
|
|
@@ -42,18 +35,15 @@ function PostSyncStatus() {
|
|
|
42
35
|
postType: getEditedPostAttribute('type')
|
|
43
36
|
};
|
|
44
37
|
});
|
|
45
|
-
|
|
46
38
|
if (postType !== 'wp_block') {
|
|
47
39
|
return null;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
40
|
+
}
|
|
41
|
+
// When the post is first created, the top level wp_pattern_sync_status is not set so get meta value instead.
|
|
51
42
|
const currentSyncStatus = meta?.wp_pattern_sync_status === 'unsynced' ? 'unsynced' : syncStatus;
|
|
52
43
|
return (0, _element.createElement)(_components.PanelRow, {
|
|
53
44
|
className: "edit-post-sync-status"
|
|
54
45
|
}, (0, _element.createElement)("span", null, (0, _i18n.__)('Sync status')), (0, _element.createElement)("div", null, currentSyncStatus === 'unsynced' ? (0, _i18n.__)('Not synced') : (0, _i18n.__)('Fully synced')));
|
|
55
46
|
}
|
|
56
|
-
|
|
57
47
|
function PostSyncStatusModal() {
|
|
58
48
|
const {
|
|
59
49
|
editPost
|
|
@@ -76,11 +66,10 @@ function PostSyncStatusModal() {
|
|
|
76
66
|
(0, _element.useEffect)(() => {
|
|
77
67
|
if (isNewPost && postType === 'wp_block') {
|
|
78
68
|
setIsModalOpen(true);
|
|
79
|
-
}
|
|
69
|
+
}
|
|
70
|
+
// We only want the modal to open when the page is first loaded.
|
|
80
71
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
81
|
-
|
|
82
72
|
}, []);
|
|
83
|
-
|
|
84
73
|
const setSyncStatus = () => {
|
|
85
74
|
editPost({
|
|
86
75
|
meta: {
|
|
@@ -88,11 +77,9 @@ function PostSyncStatusModal() {
|
|
|
88
77
|
}
|
|
89
78
|
});
|
|
90
79
|
};
|
|
91
|
-
|
|
92
80
|
if (postType !== 'wp_block' || !isNewPost) {
|
|
93
81
|
return null;
|
|
94
82
|
}
|
|
95
|
-
|
|
96
83
|
const {
|
|
97
84
|
ReusableBlocksRenameHint
|
|
98
85
|
} = (0, _lockUnlock.unlock)(_blockEditor.privateApis);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["_element","require","_data","_i18n","_components","_blockEditor","_store","_lockUnlock","PostSyncStatus","syncStatus","postType","meta","useSelect","select","getEditedPostAttribute","editorStore","currentSyncStatus","wp_pattern_sync_status","createElement","PanelRow","className","__","PostSyncStatusModal","editPost","useDispatch","isModalOpen","setIsModalOpen","useState","syncType","setSyncType","undefined","isNewPost","isCleanNewPost","useEffect","setSyncStatus","ReusableBlocksRenameHint","unlock","blockEditorPrivateApis","Fragment","Modal","title","onRequestClose","overlayClassName","onSubmit","event","preventDefault","__experimentalVStack","spacing","ToggleControl","label","help","checked","onChange","__experimentalHStack","justify","Button","variant","type"],"sources":["@wordpress/editor/src/components/post-sync-status/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tPanelRow,\n\tModal,\n\tButton,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\tToggleControl,\n} from '@wordpress/components';\nimport { useEffect, useState } from '@wordpress/element';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nexport default function PostSyncStatus() {\n\tconst { syncStatus, postType, meta } = useSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute } = select( editorStore );\n\t\treturn {\n\t\t\tsyncStatus: getEditedPostAttribute( 'wp_pattern_sync_status' ),\n\t\t\tmeta: getEditedPostAttribute( 'meta' ),\n\t\t\tpostType: getEditedPostAttribute( 'type' ),\n\t\t};\n\t} );\n\n\tif ( postType !== 'wp_block' ) {\n\t\treturn null;\n\t}\n\t// When the post is first created, the top level wp_pattern_sync_status is not set so get meta value instead.\n\tconst currentSyncStatus =\n\t\tmeta?.wp_pattern_sync_status === 'unsynced' ? 'unsynced' : syncStatus;\n\n\treturn (\n\t\t<PanelRow className=\"edit-post-sync-status\">\n\t\t\t<span>{ __( 'Sync status' ) }</span>\n\t\t\t<div>\n\t\t\t\t{ currentSyncStatus === 'unsynced'\n\t\t\t\t\t? __( 'Not synced' )\n\t\t\t\t\t: __( 'Fully synced' ) }\n\t\t\t</div>\n\t\t</PanelRow>\n\t);\n}\n\nexport function PostSyncStatusModal() {\n\tconst { editPost } = useDispatch( editorStore );\n\tconst [ isModalOpen, setIsModalOpen ] = useState( false );\n\tconst [ syncType, setSyncType ] = useState( undefined );\n\n\tconst { postType, isNewPost } = useSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute, isCleanNewPost } =\n\t\t\tselect( editorStore );\n\t\treturn {\n\t\t\tpostType: getEditedPostAttribute( 'type' ),\n\t\t\tisNewPost: isCleanNewPost(),\n\t\t};\n\t}, [] );\n\n\tuseEffect( () => {\n\t\tif ( isNewPost && postType === 'wp_block' ) {\n\t\t\tsetIsModalOpen( true );\n\t\t}\n\t\t// We only want the modal to open when the page is first loaded.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [] );\n\n\tconst setSyncStatus = () => {\n\t\teditPost( {\n\t\t\tmeta: {\n\t\t\t\twp_pattern_sync_status: syncType,\n\t\t\t},\n\t\t} );\n\t};\n\n\tif ( postType !== 'wp_block' || ! isNewPost ) {\n\t\treturn null;\n\t}\n\tconst { ReusableBlocksRenameHint } = unlock( blockEditorPrivateApis );\n\treturn (\n\t\t<>\n\t\t\t{ isModalOpen && (\n\t\t\t\t<Modal\n\t\t\t\t\ttitle={ __( 'Set pattern sync status' ) }\n\t\t\t\t\tonRequestClose={ () => {\n\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t} }\n\t\t\t\t\toverlayClassName=\"reusable-blocks-menu-items__convert-modal\"\n\t\t\t\t>\n\t\t\t\t\t<form\n\t\t\t\t\t\tonSubmit={ ( event ) => {\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t\t\tsetSyncStatus();\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t<VStack spacing=\"5\">\n\t\t\t\t\t\t\t<ReusableBlocksRenameHint />\n\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\tlabel={ __( 'Synced' ) }\n\t\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t\t'Editing the pattern will update it anywhere it is used.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tchecked={ ! syncType }\n\t\t\t\t\t\t\t\tonChange={ () => {\n\t\t\t\t\t\t\t\t\tsetSyncType(\n\t\t\t\t\t\t\t\t\t\t! syncType ? 'unsynced' : undefined\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t\t\t\t<Button variant=\"primary\" type=\"submit\">\n\t\t\t\t\t\t\t\t\t{ __( 'Create' ) }\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t</VStack>\n\t\t\t\t\t</form>\n\t\t\t\t</Modal>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;AAaA,IAAAA,QAAA,GAAAC,OAAA;AAVA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AASA,IAAAI,YAAA,GAAAJ,OAAA;AAKA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,WAAA,GAAAN,OAAA;AApBA;AACA;AACA;;AAcA;AACA;AACA;;AAIe,SAASO,cAAcA,CAAA,EAAG;EACxC,MAAM;IAAEC,UAAU;IAAEC,QAAQ;IAAEC;EAAK,CAAC,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IAC/D,MAAM;MAAEC;IAAuB,CAAC,GAAGD,MAAM,CAAEE,YAAY,CAAC;IACxD,OAAO;MACNN,UAAU,EAAEK,sBAAsB,CAAE,wBAAyB,CAAC;MAC9DH,IAAI,EAAEG,sBAAsB,CAAE,MAAO,CAAC;MACtCJ,QAAQ,EAAEI,sBAAsB,CAAE,MAAO;IAC1C,CAAC;EACF,CAAE,CAAC;EAEH,IAAKJ,QAAQ,KAAK,UAAU,EAAG;IAC9B,OAAO,IAAI;EACZ;EACA;EACA,MAAMM,iBAAiB,GACtBL,IAAI,EAAEM,sBAAsB,KAAK,UAAU,GAAG,UAAU,GAAGR,UAAU;EAEtE,OACC,IAAAT,QAAA,CAAAkB,aAAA,EAACd,WAAA,CAAAe,QAAQ;IAACC,SAAS,EAAC;EAAuB,GAC1C,IAAApB,QAAA,CAAAkB,aAAA,gBAAQ,IAAAG,QAAE,EAAE,aAAc,CAAS,CAAC,EACpC,IAAArB,QAAA,CAAAkB,aAAA,eACGF,iBAAiB,KAAK,UAAU,GAC/B,IAAAK,QAAE,EAAE,YAAa,CAAC,GAClB,IAAAA,QAAE,EAAE,cAAe,CAClB,CACI,CAAC;AAEb;AAEO,SAASC,mBAAmBA,CAAA,EAAG;EACrC,MAAM;IAAEC;EAAS,CAAC,GAAG,IAAAC,iBAAW,EAAET,YAAY,CAAC;EAC/C,MAAM,CAAEU,WAAW,EAAEC,cAAc,CAAE,GAAG,IAAAC,iBAAQ,EAAE,KAAM,CAAC;EACzD,MAAM,CAAEC,QAAQ,EAAEC,WAAW,CAAE,GAAG,IAAAF,iBAAQ,EAAEG,SAAU,CAAC;EAEvD,MAAM;IAAEpB,QAAQ;IAAEqB;EAAU,CAAC,GAAG,IAAAnB,eAAS,EAAIC,MAAM,IAAM;IACxD,MAAM;MAAEC,sBAAsB;MAAEkB;IAAe,CAAC,GAC/CnB,MAAM,CAAEE,YAAY,CAAC;IACtB,OAAO;MACNL,QAAQ,EAAEI,sBAAsB,CAAE,MAAO,CAAC;MAC1CiB,SAAS,EAAEC,cAAc,CAAC;IAC3B,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,IAAAC,kBAAS,EAAE,MAAM;IAChB,IAAKF,SAAS,IAAIrB,QAAQ,KAAK,UAAU,EAAG;MAC3CgB,cAAc,CAAE,IAAK,CAAC;IACvB;IACA;IACA;EACD,CAAC,EAAE,EAAG,CAAC;EAEP,MAAMQ,aAAa,GAAGA,CAAA,KAAM;IAC3BX,QAAQ,CAAE;MACTZ,IAAI,EAAE;QACLM,sBAAsB,EAAEW;MACzB;IACD,CAAE,CAAC;EACJ,CAAC;EAED,IAAKlB,QAAQ,KAAK,UAAU,IAAI,CAAEqB,SAAS,EAAG;IAC7C,OAAO,IAAI;EACZ;EACA,MAAM;IAAEI;EAAyB,CAAC,GAAG,IAAAC,kBAAM,EAAEC,wBAAuB,CAAC;EACrE,OACC,IAAArC,QAAA,CAAAkB,aAAA,EAAAlB,QAAA,CAAAsC,QAAA,QACGb,WAAW,IACZ,IAAAzB,QAAA,CAAAkB,aAAA,EAACd,WAAA,CAAAmC,KAAK;IACLC,KAAK,EAAG,IAAAnB,QAAE,EAAE,yBAA0B,CAAG;IACzCoB,cAAc,EAAGA,CAAA,KAAM;MACtBf,cAAc,CAAE,KAAM,CAAC;IACxB,CAAG;IACHgB,gBAAgB,EAAC;EAA2C,GAE5D,IAAA1C,QAAA,CAAAkB,aAAA;IACCyB,QAAQ,EAAKC,KAAK,IAAM;MACvBA,KAAK,CAACC,cAAc,CAAC,CAAC;MACtBnB,cAAc,CAAE,KAAM,CAAC;MACvBQ,aAAa,CAAC,CAAC;IAChB;EAAG,GAEH,IAAAlC,QAAA,CAAAkB,aAAA,EAACd,WAAA,CAAA0C,oBAAM;IAACC,OAAO,EAAC;EAAG,GAClB,IAAA/C,QAAA,CAAAkB,aAAA,EAACiB,wBAAwB,MAAE,CAAC,EAC5B,IAAAnC,QAAA,CAAAkB,aAAA,EAACd,WAAA,CAAA4C,aAAa;IACbC,KAAK,EAAG,IAAA5B,QAAE,EAAE,QAAS,CAAG;IACxB6B,IAAI,EAAG,IAAA7B,QAAE,EACR,yDACD,CAAG;IACH8B,OAAO,EAAG,CAAEvB,QAAU;IACtBwB,QAAQ,EAAGA,CAAA,KAAM;MAChBvB,WAAW,CACV,CAAED,QAAQ,GAAG,UAAU,GAAGE,SAC3B,CAAC;IACF;EAAG,CACH,CAAC,EACF,IAAA9B,QAAA,CAAAkB,aAAA,EAACd,WAAA,CAAAiD,oBAAM;IAACC,OAAO,EAAC;EAAO,GACtB,IAAAtD,QAAA,CAAAkB,aAAA,EAACd,WAAA,CAAAmD,MAAM;IAACC,OAAO,EAAC,SAAS;IAACC,IAAI,EAAC;EAAQ,GACpC,IAAApC,QAAE,EAAE,QAAS,CACR,CACD,CACD,CACH,CACA,CAEP,CAAC;AAEL"}
|
|
@@ -5,15 +5,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.PostTaxonomiesCheck = PostTaxonomiesCheck;
|
|
7
7
|
exports.default = void 0;
|
|
8
|
-
|
|
9
8
|
var _compose = require("@wordpress/compose");
|
|
10
|
-
|
|
11
9
|
var _data = require("@wordpress/data");
|
|
12
|
-
|
|
13
10
|
var _coreData = require("@wordpress/core-data");
|
|
14
|
-
|
|
15
11
|
var _store = require("../../store");
|
|
16
|
-
|
|
17
12
|
/**
|
|
18
13
|
* WordPress dependencies
|
|
19
14
|
*/
|
|
@@ -21,20 +16,18 @@ var _store = require("../../store");
|
|
|
21
16
|
/**
|
|
22
17
|
* Internal dependencies
|
|
23
18
|
*/
|
|
19
|
+
|
|
24
20
|
function PostTaxonomiesCheck({
|
|
25
21
|
postType,
|
|
26
22
|
taxonomies,
|
|
27
23
|
children
|
|
28
24
|
}) {
|
|
29
25
|
const hasTaxonomies = taxonomies?.some(taxonomy => taxonomy.types.includes(postType));
|
|
30
|
-
|
|
31
26
|
if (!hasTaxonomies) {
|
|
32
27
|
return null;
|
|
33
28
|
}
|
|
34
|
-
|
|
35
29
|
return children;
|
|
36
30
|
}
|
|
37
|
-
|
|
38
31
|
var _default = (0, _compose.compose)([(0, _data.withSelect)(select => {
|
|
39
32
|
return {
|
|
40
33
|
postType: select(_store.store).getCurrentPostType(),
|
|
@@ -43,6 +36,5 @@ var _default = (0, _compose.compose)([(0, _data.withSelect)(select => {
|
|
|
43
36
|
})
|
|
44
37
|
};
|
|
45
38
|
})])(PostTaxonomiesCheck);
|
|
46
|
-
|
|
47
39
|
exports.default = _default;
|
|
48
40
|
//# sourceMappingURL=check.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["_compose","require","_data","_coreData","_store","PostTaxonomiesCheck","postType","taxonomies","children","hasTaxonomies","some","taxonomy","types","includes","_default","compose","withSelect","select","editorStore","getCurrentPostType","coreStore","getTaxonomies","per_page","exports","default"],"sources":["@wordpress/editor/src/components/post-taxonomies/check.js"],"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"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AAKA,IAAAG,MAAA,GAAAH,OAAA;AAVA;AACA;AACA;;AAKA;AACA;AACA;;AAGO,SAASI,mBAAmBA,CAAE;EAAEC,QAAQ;EAAEC,UAAU;EAAEC;AAAS,CAAC,EAAG;EACzE,MAAMC,aAAa,GAAGF,UAAU,EAAEG,IAAI,CAAIC,QAAQ,IACjDA,QAAQ,CAACC,KAAK,CAACC,QAAQ,CAAEP,QAAS,CACnC,CAAC;EACD,IAAK,CAAEG,aAAa,EAAG;IACtB,OAAO,IAAI;EACZ;EAEA,OAAOD,QAAQ;AAChB;AAAC,IAAAM,QAAA,GAEc,IAAAC,gBAAO,EAAE,CACvB,IAAAC,gBAAU,EAAIC,MAAM,IAAM;EACzB,OAAO;IACNX,QAAQ,EAAEW,MAAM,CAAEC,YAAY,CAAC,CAACC,kBAAkB,CAAC,CAAC;IACpDZ,UAAU,EAAEU,MAAM,CAAEG,eAAU,CAAC,CAACC,aAAa,CAAE;MAAEC,QAAQ,EAAE,CAAC;IAAE,CAAE;EACjE,CAAC;AACF,CAAE,CAAC,CACF,CAAC,CAAEjB,mBAAoB,CAAC;AAAAkB,OAAA,CAAAC,OAAA,GAAAV,QAAA"}
|
|
@@ -1,33 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.FlatTermSelector = FlatTermSelector;
|
|
9
8
|
exports.default = void 0;
|
|
10
|
-
|
|
11
9
|
var _element = require("@wordpress/element");
|
|
12
|
-
|
|
13
10
|
var _i18n = require("@wordpress/i18n");
|
|
14
|
-
|
|
15
11
|
var _components = require("@wordpress/components");
|
|
16
|
-
|
|
17
12
|
var _data = require("@wordpress/data");
|
|
18
|
-
|
|
19
13
|
var _coreData = require("@wordpress/core-data");
|
|
20
|
-
|
|
21
14
|
var _compose = require("@wordpress/compose");
|
|
22
|
-
|
|
23
15
|
var _a11y = require("@wordpress/a11y");
|
|
24
|
-
|
|
25
16
|
var _store = require("../../store");
|
|
26
|
-
|
|
27
17
|
var _terms = require("../../utils/terms");
|
|
28
|
-
|
|
29
18
|
var _mostUsedTerms = _interopRequireDefault(require("./most-used-terms"));
|
|
30
|
-
|
|
31
19
|
/**
|
|
32
20
|
* WordPress dependencies
|
|
33
21
|
*/
|
|
@@ -43,28 +31,24 @@ var _mostUsedTerms = _interopRequireDefault(require("./most-used-terms"));
|
|
|
43
31
|
* @type {Array<any>}
|
|
44
32
|
*/
|
|
45
33
|
const EMPTY_ARRAY = [];
|
|
34
|
+
|
|
46
35
|
/**
|
|
47
36
|
* Module constants
|
|
48
37
|
*/
|
|
49
|
-
|
|
50
38
|
const MAX_TERMS_SUGGESTIONS = 20;
|
|
51
39
|
const DEFAULT_QUERY = {
|
|
52
40
|
per_page: MAX_TERMS_SUGGESTIONS,
|
|
53
41
|
_fields: 'id,name',
|
|
54
42
|
context: 'view'
|
|
55
43
|
};
|
|
56
|
-
|
|
57
44
|
const isSameTermName = (termA, termB) => (0, _terms.unescapeString)(termA).toLowerCase() === (0, _terms.unescapeString)(termB).toLowerCase();
|
|
58
|
-
|
|
59
45
|
const termNamesToIds = (names, terms) => {
|
|
60
46
|
return names.map(termName => terms.find(term => isSameTermName(term.name, termName)).id);
|
|
61
47
|
};
|
|
62
|
-
|
|
63
48
|
function FlatTermSelector({
|
|
64
49
|
slug
|
|
65
50
|
}) {
|
|
66
51
|
var _taxonomy$labels$add_, _taxonomy$labels$sing2;
|
|
67
|
-
|
|
68
52
|
const [values, setValues] = (0, _element.useState)([]);
|
|
69
53
|
const [search, setSearch] = (0, _element.useState)('');
|
|
70
54
|
const debouncedSearch = (0, _compose.useDebounce)(setSearch, 500);
|
|
@@ -77,7 +61,6 @@ function FlatTermSelector({
|
|
|
77
61
|
hasResolvedTerms
|
|
78
62
|
} = (0, _data.useSelect)(select => {
|
|
79
63
|
var _post$_links, _post$_links2;
|
|
80
|
-
|
|
81
64
|
const {
|
|
82
65
|
getCurrentPost,
|
|
83
66
|
getEditedPostAttribute
|
|
@@ -88,12 +71,10 @@ function FlatTermSelector({
|
|
|
88
71
|
hasFinishedResolution
|
|
89
72
|
} = select(_coreData.store);
|
|
90
73
|
const post = getCurrentPost();
|
|
91
|
-
|
|
92
74
|
const _taxonomy = getTaxonomy(slug);
|
|
93
|
-
|
|
94
75
|
const _termIds = _taxonomy ? getEditedPostAttribute(_taxonomy.rest_base) : EMPTY_ARRAY;
|
|
95
|
-
|
|
96
|
-
|
|
76
|
+
const query = {
|
|
77
|
+
...DEFAULT_QUERY,
|
|
97
78
|
include: _termIds.join(','),
|
|
98
79
|
per_page: -1
|
|
99
80
|
};
|
|
@@ -113,14 +94,16 @@ function FlatTermSelector({
|
|
|
113
94
|
getEntityRecords
|
|
114
95
|
} = select(_coreData.store);
|
|
115
96
|
return {
|
|
116
|
-
searchResults: !!search ? getEntityRecords('taxonomy', slug, {
|
|
97
|
+
searchResults: !!search ? getEntityRecords('taxonomy', slug, {
|
|
98
|
+
...DEFAULT_QUERY,
|
|
117
99
|
search
|
|
118
100
|
}) : EMPTY_ARRAY
|
|
119
101
|
};
|
|
120
|
-
}, [search, slug]);
|
|
102
|
+
}, [search, slug]);
|
|
103
|
+
|
|
104
|
+
// Update terms state only after the selectors are resolved.
|
|
121
105
|
// We're using this to avoid terms temporarily disappearing on slow networks
|
|
122
106
|
// while core data makes REST API requests.
|
|
123
|
-
|
|
124
107
|
(0, _element.useEffect)(() => {
|
|
125
108
|
if (hasResolvedTerms) {
|
|
126
109
|
const newValues = (terms !== null && terms !== void 0 ? terms : []).map(term => (0, _terms.unescapeString)(term.name));
|
|
@@ -136,11 +119,9 @@ function FlatTermSelector({
|
|
|
136
119
|
const {
|
|
137
120
|
saveEntityRecord
|
|
138
121
|
} = (0, _data.useDispatch)(_coreData.store);
|
|
139
|
-
|
|
140
122
|
if (!hasAssignAction) {
|
|
141
123
|
return null;
|
|
142
124
|
}
|
|
143
|
-
|
|
144
125
|
async function findOrCreateTerm(term) {
|
|
145
126
|
try {
|
|
146
127
|
const newTerm = await saveEntityRecord('taxonomy', slug, term, {
|
|
@@ -151,42 +132,36 @@ function FlatTermSelector({
|
|
|
151
132
|
if (error.code !== 'term_exists') {
|
|
152
133
|
throw error;
|
|
153
134
|
}
|
|
154
|
-
|
|
155
135
|
return {
|
|
156
136
|
id: error.data.term_id,
|
|
157
137
|
name: term.name
|
|
158
138
|
};
|
|
159
139
|
}
|
|
160
140
|
}
|
|
161
|
-
|
|
162
141
|
function onUpdateTerms(newTermIds) {
|
|
163
142
|
editPost({
|
|
164
143
|
[taxonomy.rest_base]: newTermIds
|
|
165
144
|
});
|
|
166
145
|
}
|
|
167
|
-
|
|
168
146
|
function onChange(termNames) {
|
|
169
147
|
const availableTerms = [...(terms !== null && terms !== void 0 ? terms : []), ...(searchResults !== null && searchResults !== void 0 ? searchResults : [])];
|
|
170
148
|
const uniqueTerms = termNames.reduce((acc, name) => {
|
|
171
149
|
if (!acc.some(n => n.toLowerCase() === name.toLowerCase())) {
|
|
172
150
|
acc.push(name);
|
|
173
151
|
}
|
|
174
|
-
|
|
175
152
|
return acc;
|
|
176
153
|
}, []);
|
|
177
|
-
const newTermNames = uniqueTerms.filter(termName => !availableTerms.find(term => isSameTermName(term.name, termName)));
|
|
178
|
-
// The selector will always re-fetch terms later.
|
|
154
|
+
const newTermNames = uniqueTerms.filter(termName => !availableTerms.find(term => isSameTermName(term.name, termName)));
|
|
179
155
|
|
|
156
|
+
// Optimistically update term values.
|
|
157
|
+
// The selector will always re-fetch terms later.
|
|
180
158
|
setValues(uniqueTerms);
|
|
181
|
-
|
|
182
159
|
if (newTermNames.length === 0) {
|
|
183
160
|
return onUpdateTerms(termNamesToIds(uniqueTerms, availableTerms));
|
|
184
161
|
}
|
|
185
|
-
|
|
186
162
|
if (!hasCreateAction) {
|
|
187
163
|
return;
|
|
188
164
|
}
|
|
189
|
-
|
|
190
165
|
Promise.all(newTermNames.map(termName => findOrCreateTerm({
|
|
191
166
|
name: termName
|
|
192
167
|
}))).then(newTerms => {
|
|
@@ -194,33 +169,25 @@ function FlatTermSelector({
|
|
|
194
169
|
return onUpdateTerms(termNamesToIds(uniqueTerms, newAvailableTerms));
|
|
195
170
|
});
|
|
196
171
|
}
|
|
197
|
-
|
|
198
172
|
function appendTerm(newTerm) {
|
|
199
173
|
var _taxonomy$labels$sing;
|
|
200
|
-
|
|
201
174
|
if (termIds.includes(newTerm.id)) {
|
|
202
175
|
return;
|
|
203
176
|
}
|
|
204
|
-
|
|
205
177
|
const newTermIds = [...termIds, newTerm.id];
|
|
206
178
|
const defaultName = slug === 'post_tag' ? (0, _i18n.__)('Tag') : (0, _i18n.__)('Term');
|
|
207
|
-
const termAddedMessage = (0, _i18n.sprintf)(
|
|
208
|
-
/* translators: %s: term name. */
|
|
179
|
+
const termAddedMessage = (0, _i18n.sprintf)( /* translators: %s: term name. */
|
|
209
180
|
(0, _i18n._x)('%s added', 'term'), (_taxonomy$labels$sing = taxonomy?.labels?.singular_name) !== null && _taxonomy$labels$sing !== void 0 ? _taxonomy$labels$sing : defaultName);
|
|
210
181
|
(0, _a11y.speak)(termAddedMessage, 'assertive');
|
|
211
182
|
onUpdateTerms(newTermIds);
|
|
212
183
|
}
|
|
213
|
-
|
|
214
184
|
const newTermLabel = (_taxonomy$labels$add_ = taxonomy?.labels?.add_new_item) !== null && _taxonomy$labels$add_ !== void 0 ? _taxonomy$labels$add_ : slug === 'post_tag' ? (0, _i18n.__)('Add new tag') : (0, _i18n.__)('Add new Term');
|
|
215
185
|
const singularName = (_taxonomy$labels$sing2 = taxonomy?.labels?.singular_name) !== null && _taxonomy$labels$sing2 !== void 0 ? _taxonomy$labels$sing2 : slug === 'post_tag' ? (0, _i18n.__)('Tag') : (0, _i18n.__)('Term');
|
|
216
|
-
const termAddedLabel = (0, _i18n.sprintf)(
|
|
217
|
-
/* translators: %s: term name. */
|
|
186
|
+
const termAddedLabel = (0, _i18n.sprintf)( /* translators: %s: term name. */
|
|
218
187
|
(0, _i18n._x)('%s added', 'term'), singularName);
|
|
219
|
-
const termRemovedLabel = (0, _i18n.sprintf)(
|
|
220
|
-
/* translators: %s: term name. */
|
|
188
|
+
const termRemovedLabel = (0, _i18n.sprintf)( /* translators: %s: term name. */
|
|
221
189
|
(0, _i18n._x)('%s removed', 'term'), singularName);
|
|
222
|
-
const removeTermLabel = (0, _i18n.sprintf)(
|
|
223
|
-
/* translators: %s: term name. */
|
|
190
|
+
const removeTermLabel = (0, _i18n.sprintf)( /* translators: %s: term name. */
|
|
224
191
|
(0, _i18n._x)('Remove %s', 'term'), singularName);
|
|
225
192
|
return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_components.FormTokenField, {
|
|
226
193
|
value: values,
|
|
@@ -239,8 +206,6 @@ function FlatTermSelector({
|
|
|
239
206
|
onSelect: appendTerm
|
|
240
207
|
}));
|
|
241
208
|
}
|
|
242
|
-
|
|
243
209
|
var _default = (0, _components.withFilters)('editor.PostTaxonomyType')(FlatTermSelector);
|
|
244
|
-
|
|
245
210
|
exports.default = _default;
|
|
246
211
|
//# sourceMappingURL=flat-term-selector.js.map
|