@wordpress/editor 13.15.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 +4 -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 +11 -23
- 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 +10 -27
- 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 +11 -23
- 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 +10 -23
- 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 +8 -42
- 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 +61 -130
- 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 +170 -296
- 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 +12 -19
- 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 +11 -23
- 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 +12 -19
- 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 +14 -20
- 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 +11 -39
- 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 +63 -85
- 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 +173 -223
- 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-author/test/check.js +18 -12
- package/src/components/post-comments/index.js +11 -17
- package/src/components/post-excerpt/check.js +6 -2
- package/src/components/post-excerpt/index.js +10 -16
- 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-pingbacks/index.js +11 -15
- 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 +8 -10
- package/src/components/post-type-support-check/test/index.js +36 -20
- package/src/components/provider/index.js +3 -2
- package/src/components/unsaved-changes-warning/index.js +22 -27
- package/src/hooks/custom-sources-backwards-compatibility.js +1 -25
- package/src/store/actions.js +1 -1
- package/src/store/selectors.js +2 -2
- package/src/store/test/selectors.js +13 -13
|
@@ -4,10 +4,43 @@
|
|
|
4
4
|
import { render, screen } from '@testing-library/react';
|
|
5
5
|
import userEvent from '@testing-library/user-event';
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* WordPress dependencies
|
|
9
|
+
*/
|
|
10
|
+
import { useSelect, useDispatch } from '@wordpress/data';
|
|
11
|
+
|
|
7
12
|
/**
|
|
8
13
|
* Internal dependencies
|
|
9
14
|
*/
|
|
10
|
-
import
|
|
15
|
+
import PageAttributesOrder from '../order';
|
|
16
|
+
|
|
17
|
+
jest.mock( '@wordpress/data/src/components/use-select', () => jest.fn() );
|
|
18
|
+
jest.mock( '@wordpress/data/src/components/use-dispatch', () => ( {
|
|
19
|
+
useDispatch: jest.fn(),
|
|
20
|
+
} ) );
|
|
21
|
+
|
|
22
|
+
function setupDataMock( order = 0 ) {
|
|
23
|
+
useSelect.mockImplementation( ( mapSelect ) =>
|
|
24
|
+
mapSelect( () => ( {
|
|
25
|
+
getPostType: () => null,
|
|
26
|
+
getEditedPostAttribute: ( attr ) => {
|
|
27
|
+
switch ( attr ) {
|
|
28
|
+
case 'menu_order':
|
|
29
|
+
return order;
|
|
30
|
+
default:
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
} ) )
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
const editPost = jest.fn();
|
|
38
|
+
useDispatch.mockImplementation( () => ( {
|
|
39
|
+
editPost,
|
|
40
|
+
} ) );
|
|
41
|
+
|
|
42
|
+
return editPost;
|
|
43
|
+
}
|
|
11
44
|
|
|
12
45
|
describe( 'PageAttributesOrder', () => {
|
|
13
46
|
/**
|
|
@@ -22,9 +55,9 @@ describe( 'PageAttributesOrder', () => {
|
|
|
22
55
|
it( 'should reject invalid input', async () => {
|
|
23
56
|
const user = userEvent.setup();
|
|
24
57
|
|
|
25
|
-
const
|
|
58
|
+
const editPost = setupDataMock();
|
|
26
59
|
|
|
27
|
-
render( <PageAttributesOrder
|
|
60
|
+
render( <PageAttributesOrder /> );
|
|
28
61
|
|
|
29
62
|
const input = screen.getByRole( 'spinbutton', { name: 'Order' } );
|
|
30
63
|
await user.type( input, 'bad', typeOptions );
|
|
@@ -33,31 +66,29 @@ describe( 'PageAttributesOrder', () => {
|
|
|
33
66
|
await user.type( input, '+', typeOptions );
|
|
34
67
|
await user.type( input, ' ', typeOptions );
|
|
35
68
|
|
|
36
|
-
expect(
|
|
69
|
+
expect( editPost ).not.toHaveBeenCalled();
|
|
37
70
|
} );
|
|
38
71
|
|
|
39
72
|
it( 'should update with zero input', async () => {
|
|
40
73
|
const user = userEvent.setup();
|
|
41
74
|
|
|
42
|
-
const
|
|
75
|
+
const editPost = setupDataMock( 4 );
|
|
43
76
|
|
|
44
|
-
render(
|
|
45
|
-
<PageAttributesOrder order={ 4 } onUpdateOrder={ onUpdateOrder } />
|
|
46
|
-
);
|
|
77
|
+
render( <PageAttributesOrder /> );
|
|
47
78
|
|
|
48
79
|
const input = screen.getByRole( 'spinbutton', { name: 'Order' } );
|
|
49
80
|
|
|
50
81
|
await user.type( input, '0', typeOptions );
|
|
51
82
|
|
|
52
|
-
expect(
|
|
83
|
+
expect( editPost ).toHaveBeenCalledWith( { menu_order: 0 } );
|
|
53
84
|
} );
|
|
54
85
|
|
|
55
86
|
it( 'should update with valid positive input', async () => {
|
|
56
87
|
const user = userEvent.setup();
|
|
57
88
|
|
|
58
|
-
const
|
|
89
|
+
const editPost = setupDataMock();
|
|
59
90
|
|
|
60
|
-
render( <PageAttributesOrder
|
|
91
|
+
render( <PageAttributesOrder /> );
|
|
61
92
|
|
|
62
93
|
await user.type(
|
|
63
94
|
screen.getByRole( 'spinbutton', { name: 'Order' } ),
|
|
@@ -65,15 +96,15 @@ describe( 'PageAttributesOrder', () => {
|
|
|
65
96
|
typeOptions
|
|
66
97
|
);
|
|
67
98
|
|
|
68
|
-
expect(
|
|
99
|
+
expect( editPost ).toHaveBeenCalledWith( { menu_order: 4 } );
|
|
69
100
|
} );
|
|
70
101
|
|
|
71
102
|
it( 'should update with valid negative input', async () => {
|
|
72
103
|
const user = userEvent.setup();
|
|
73
104
|
|
|
74
|
-
const
|
|
105
|
+
const editPost = setupDataMock();
|
|
75
106
|
|
|
76
|
-
render( <PageAttributesOrder
|
|
107
|
+
render( <PageAttributesOrder /> );
|
|
77
108
|
|
|
78
109
|
await user.type(
|
|
79
110
|
screen.getByRole( 'spinbutton', { name: 'Order' } ),
|
|
@@ -81,6 +112,6 @@ describe( 'PageAttributesOrder', () => {
|
|
|
81
112
|
typeOptions
|
|
82
113
|
);
|
|
83
114
|
|
|
84
|
-
expect(
|
|
115
|
+
expect( editPost ).toHaveBeenCalledWith( { menu_order: -1 } );
|
|
85
116
|
} );
|
|
86
117
|
} );
|
|
@@ -19,32 +19,38 @@ jest.mock( '@wordpress/data/src/components/use-select', () => {
|
|
|
19
19
|
return mock;
|
|
20
20
|
} );
|
|
21
21
|
|
|
22
|
+
function setupUseSelectMock( hasAssignAuthorAction, hasAuthors ) {
|
|
23
|
+
useSelect.mockImplementation( ( cb ) => {
|
|
24
|
+
return cb( () => ( {
|
|
25
|
+
getPostType: () => ( { supports: { author: true } } ),
|
|
26
|
+
getEditedPostAttribute: () => {},
|
|
27
|
+
getCurrentPost: () => ( {
|
|
28
|
+
_links: {
|
|
29
|
+
'wp:action-assign-author': hasAssignAuthorAction,
|
|
30
|
+
},
|
|
31
|
+
} ),
|
|
32
|
+
getUsers: () => Array( hasAuthors ? 1 : 0 ).fill( {} ),
|
|
33
|
+
} ) );
|
|
34
|
+
} );
|
|
35
|
+
}
|
|
36
|
+
|
|
22
37
|
describe( 'PostAuthorCheck', () => {
|
|
23
38
|
it( 'should not render anything if has no authors', () => {
|
|
24
|
-
|
|
25
|
-
hasAuthors: false,
|
|
26
|
-
hasAssignAuthorAction: true,
|
|
27
|
-
} ) );
|
|
39
|
+
setupUseSelectMock( false, true );
|
|
28
40
|
|
|
29
41
|
render( <PostAuthorCheck>authors</PostAuthorCheck> );
|
|
30
42
|
expect( screen.queryByText( 'authors' ) ).not.toBeInTheDocument();
|
|
31
43
|
} );
|
|
32
44
|
|
|
33
45
|
it( "should not render anything if doesn't have author action", () => {
|
|
34
|
-
|
|
35
|
-
hasAuthors: true,
|
|
36
|
-
hasAssignAuthorAction: false,
|
|
37
|
-
} ) );
|
|
46
|
+
setupUseSelectMock( true, false );
|
|
38
47
|
|
|
39
48
|
render( <PostAuthorCheck>authors</PostAuthorCheck> );
|
|
40
49
|
expect( screen.queryByText( 'authors' ) ).not.toBeInTheDocument();
|
|
41
50
|
} );
|
|
42
51
|
|
|
43
52
|
it( 'should render control', () => {
|
|
44
|
-
|
|
45
|
-
hasAuthors: true,
|
|
46
|
-
hasAssignAuthorAction: true,
|
|
47
|
-
} ) );
|
|
53
|
+
setupUseSelectMock( true, true );
|
|
48
54
|
|
|
49
55
|
render( <PostAuthorCheck>authors</PostAuthorCheck> );
|
|
50
56
|
expect( screen.getByText( 'authors' ) ).toBeVisible();
|
|
@@ -3,17 +3,23 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
5
|
import { CheckboxControl } from '@wordpress/components';
|
|
6
|
-
import {
|
|
7
|
-
import { withSelect, withDispatch } from '@wordpress/data';
|
|
6
|
+
import { useDispatch, useSelect } from '@wordpress/data';
|
|
8
7
|
|
|
9
8
|
/**
|
|
10
9
|
* Internal dependencies
|
|
11
10
|
*/
|
|
12
11
|
import { store as editorStore } from '../../store';
|
|
13
12
|
|
|
14
|
-
function PostComments(
|
|
13
|
+
function PostComments() {
|
|
14
|
+
const commentStatus = useSelect(
|
|
15
|
+
( select ) =>
|
|
16
|
+
select( editorStore ).getEditedPostAttribute( 'comment_status' ) ??
|
|
17
|
+
'open',
|
|
18
|
+
[]
|
|
19
|
+
);
|
|
20
|
+
const { editPost } = useDispatch( editorStore );
|
|
15
21
|
const onToggleComments = () =>
|
|
16
|
-
|
|
22
|
+
editPost( {
|
|
17
23
|
comment_status: commentStatus === 'open' ? 'closed' : 'open',
|
|
18
24
|
} );
|
|
19
25
|
|
|
@@ -27,16 +33,4 @@ function PostComments( { commentStatus = 'open', ...props } ) {
|
|
|
27
33
|
);
|
|
28
34
|
}
|
|
29
35
|
|
|
30
|
-
export default
|
|
31
|
-
withSelect( ( select ) => {
|
|
32
|
-
return {
|
|
33
|
-
commentStatus:
|
|
34
|
-
select( editorStore ).getEditedPostAttribute(
|
|
35
|
-
'comment_status'
|
|
36
|
-
),
|
|
37
|
-
};
|
|
38
|
-
} ),
|
|
39
|
-
withDispatch( ( dispatch ) => ( {
|
|
40
|
-
editPost: dispatch( editorStore ).editPost,
|
|
41
|
-
} ) ),
|
|
42
|
-
] )( PostComments );
|
|
36
|
+
export default PostComments;
|
|
@@ -3,8 +3,12 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import PostTypeSupportCheck from '../post-type-support-check';
|
|
5
5
|
|
|
6
|
-
function PostExcerptCheck(
|
|
7
|
-
return
|
|
6
|
+
function PostExcerptCheck( { children } ) {
|
|
7
|
+
return (
|
|
8
|
+
<PostTypeSupportCheck supportKeys="excerpt">
|
|
9
|
+
{ children }
|
|
10
|
+
</PostTypeSupportCheck>
|
|
11
|
+
);
|
|
8
12
|
}
|
|
9
13
|
|
|
10
14
|
export default PostExcerptCheck;
|
|
@@ -3,22 +3,27 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
5
|
import { ExternalLink, TextareaControl } from '@wordpress/components';
|
|
6
|
-
import {
|
|
7
|
-
import { compose } from '@wordpress/compose';
|
|
6
|
+
import { useDispatch, useSelect } from '@wordpress/data';
|
|
8
7
|
|
|
9
8
|
/**
|
|
10
9
|
* Internal dependencies
|
|
11
10
|
*/
|
|
12
11
|
import { store as editorStore } from '../../store';
|
|
13
12
|
|
|
14
|
-
function PostExcerpt(
|
|
13
|
+
function PostExcerpt() {
|
|
14
|
+
const excerpt = useSelect(
|
|
15
|
+
( select ) => select( editorStore ).getEditedPostAttribute( 'excerpt' ),
|
|
16
|
+
[]
|
|
17
|
+
);
|
|
18
|
+
const { editPost } = useDispatch( editorStore );
|
|
19
|
+
|
|
15
20
|
return (
|
|
16
21
|
<div className="editor-post-excerpt">
|
|
17
22
|
<TextareaControl
|
|
18
23
|
__nextHasNoMarginBottom
|
|
19
24
|
label={ __( 'Write an excerpt (optional)' ) }
|
|
20
25
|
className="editor-post-excerpt__textarea"
|
|
21
|
-
onChange={ ( value ) =>
|
|
26
|
+
onChange={ ( value ) => editPost( { excerpt: value } ) }
|
|
22
27
|
value={ excerpt }
|
|
23
28
|
/>
|
|
24
29
|
<ExternalLink
|
|
@@ -32,15 +37,4 @@ function PostExcerpt( { excerpt, onUpdateExcerpt } ) {
|
|
|
32
37
|
);
|
|
33
38
|
}
|
|
34
39
|
|
|
35
|
-
export default
|
|
36
|
-
withSelect( ( select ) => {
|
|
37
|
-
return {
|
|
38
|
-
excerpt: select( editorStore ).getEditedPostAttribute( 'excerpt' ),
|
|
39
|
-
};
|
|
40
|
-
} ),
|
|
41
|
-
withDispatch( ( dispatch ) => ( {
|
|
42
|
-
onUpdateExcerpt( excerpt ) {
|
|
43
|
-
dispatch( editorStore ).editPost( { excerpt } );
|
|
44
|
-
},
|
|
45
|
-
} ) ),
|
|
46
|
-
] )( PostExcerpt );
|
|
40
|
+
export default PostExcerpt;
|
|
@@ -4,10 +4,12 @@
|
|
|
4
4
|
import PostTypeSupportCheck from '../post-type-support-check';
|
|
5
5
|
import ThemeSupportCheck from '../theme-support-check';
|
|
6
6
|
|
|
7
|
-
function PostFeaturedImageCheck(
|
|
7
|
+
function PostFeaturedImageCheck( { children } ) {
|
|
8
8
|
return (
|
|
9
9
|
<ThemeSupportCheck supportKeys="post-thumbnails">
|
|
10
|
-
<PostTypeSupportCheck
|
|
10
|
+
<PostTypeSupportCheck supportKeys="thumbnail">
|
|
11
|
+
{ children }
|
|
12
|
+
</PostTypeSupportCheck>
|
|
11
13
|
</ThemeSupportCheck>
|
|
12
14
|
);
|
|
13
15
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { useSelect } from '@wordpress/data';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Internal dependencies
|
|
@@ -9,17 +9,22 @@ import { withSelect } from '@wordpress/data';
|
|
|
9
9
|
import PostTypeSupportCheck from '../post-type-support-check';
|
|
10
10
|
import { store as editorStore } from '../../store';
|
|
11
11
|
|
|
12
|
-
function PostFormatCheck( {
|
|
12
|
+
function PostFormatCheck( { children } ) {
|
|
13
|
+
const disablePostFormats = useSelect(
|
|
14
|
+
( select ) =>
|
|
15
|
+
select( editorStore ).getEditorSettings().disablePostFormats,
|
|
16
|
+
[]
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
if ( disablePostFormats ) {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
|
|
13
23
|
return (
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
24
|
+
<PostTypeSupportCheck supportKeys="post-formats">
|
|
25
|
+
{ children }
|
|
26
|
+
</PostTypeSupportCheck>
|
|
17
27
|
);
|
|
18
28
|
}
|
|
19
29
|
|
|
20
|
-
export default
|
|
21
|
-
const editorSettings = select( editorStore ).getEditorSettings();
|
|
22
|
-
return {
|
|
23
|
-
disablePostFormats: editorSettings.disablePostFormats,
|
|
24
|
-
};
|
|
25
|
-
} )( PostFormatCheck );
|
|
30
|
+
export default PostFormatCheck;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { useSelect } from '@wordpress/data';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Internal dependencies
|
|
@@ -9,11 +9,16 @@ import { withSelect } from '@wordpress/data';
|
|
|
9
9
|
import PostTypeSupportCheck from '../post-type-support-check';
|
|
10
10
|
import { store as editorStore } from '../../store';
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
lastRevisionId,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
function PostLastRevisionCheck( { children } ) {
|
|
13
|
+
const { lastRevisionId, revisionsCount } = useSelect( ( select ) => {
|
|
14
|
+
const { getCurrentPostLastRevisionId, getCurrentPostRevisionsCount } =
|
|
15
|
+
select( editorStore );
|
|
16
|
+
return {
|
|
17
|
+
lastRevisionId: getCurrentPostLastRevisionId(),
|
|
18
|
+
revisionsCount: getCurrentPostRevisionsCount(),
|
|
19
|
+
};
|
|
20
|
+
}, [] );
|
|
21
|
+
|
|
17
22
|
if ( ! lastRevisionId || revisionsCount < 2 ) {
|
|
18
23
|
return null;
|
|
19
24
|
}
|
|
@@ -25,11 +30,4 @@ export function PostLastRevisionCheck( {
|
|
|
25
30
|
);
|
|
26
31
|
}
|
|
27
32
|
|
|
28
|
-
export default
|
|
29
|
-
const { getCurrentPostLastRevisionId, getCurrentPostRevisionsCount } =
|
|
30
|
-
select( editorStore );
|
|
31
|
-
return {
|
|
32
|
-
lastRevisionId: getCurrentPostLastRevisionId(),
|
|
33
|
-
revisionsCount: getCurrentPostRevisionsCount(),
|
|
34
|
-
};
|
|
35
|
-
} )( PostLastRevisionCheck );
|
|
33
|
+
export default PostLastRevisionCheck;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { sprintf, _n } from '@wordpress/i18n';
|
|
5
5
|
import { Button } from '@wordpress/components';
|
|
6
|
-
import {
|
|
6
|
+
import { useSelect } from '@wordpress/data';
|
|
7
7
|
import { backup } from '@wordpress/icons';
|
|
8
8
|
import { addQueryArgs } from '@wordpress/url';
|
|
9
9
|
|
|
@@ -13,7 +13,16 @@ import { addQueryArgs } from '@wordpress/url';
|
|
|
13
13
|
import PostLastRevisionCheck from './check';
|
|
14
14
|
import { store as editorStore } from '../../store';
|
|
15
15
|
|
|
16
|
-
function LastRevision(
|
|
16
|
+
function LastRevision() {
|
|
17
|
+
const { lastRevisionId, revisionsCount } = useSelect( ( select ) => {
|
|
18
|
+
const { getCurrentPostLastRevisionId, getCurrentPostRevisionsCount } =
|
|
19
|
+
select( editorStore );
|
|
20
|
+
return {
|
|
21
|
+
lastRevisionId: getCurrentPostLastRevisionId(),
|
|
22
|
+
revisionsCount: getCurrentPostRevisionsCount(),
|
|
23
|
+
};
|
|
24
|
+
}, [] );
|
|
25
|
+
|
|
17
26
|
return (
|
|
18
27
|
<PostLastRevisionCheck>
|
|
19
28
|
<Button
|
|
@@ -34,11 +43,4 @@ function LastRevision( { lastRevisionId, revisionsCount } ) {
|
|
|
34
43
|
);
|
|
35
44
|
}
|
|
36
45
|
|
|
37
|
-
export default
|
|
38
|
-
const { getCurrentPostLastRevisionId, getCurrentPostRevisionsCount } =
|
|
39
|
-
select( editorStore );
|
|
40
|
-
return {
|
|
41
|
-
lastRevisionId: getCurrentPostLastRevisionId(),
|
|
42
|
-
revisionsCount: getCurrentPostRevisionsCount(),
|
|
43
|
-
};
|
|
44
|
-
} )( LastRevision );
|
|
46
|
+
export default LastRevision;
|
|
@@ -3,38 +3,50 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { render, screen } from '@testing-library/react';
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* WordPress dependencies
|
|
8
|
+
*/
|
|
9
|
+
import { useSelect } from '@wordpress/data';
|
|
10
|
+
|
|
6
11
|
/**
|
|
7
12
|
* Internal dependencies
|
|
8
13
|
*/
|
|
9
|
-
import
|
|
14
|
+
import PostLastRevisionCheck from '../check';
|
|
15
|
+
|
|
16
|
+
jest.mock( '@wordpress/data/src/components/use-select', () => jest.fn() );
|
|
17
|
+
|
|
18
|
+
function setupDataMock( id, count ) {
|
|
19
|
+
useSelect.mockImplementation( ( mapSelect ) =>
|
|
20
|
+
mapSelect( () => ( {
|
|
21
|
+
getCurrentPostLastRevisionId: () => id,
|
|
22
|
+
getCurrentPostRevisionsCount: () => count,
|
|
23
|
+
getEditedPostAttribute: () => null,
|
|
24
|
+
getPostType: () => null,
|
|
25
|
+
} ) )
|
|
26
|
+
);
|
|
27
|
+
}
|
|
10
28
|
|
|
11
29
|
describe( 'PostLastRevisionCheck', () => {
|
|
12
30
|
it( 'should not render anything if the last revision ID is unknown', () => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
</PostLastRevisionCheck>
|
|
17
|
-
);
|
|
31
|
+
setupDataMock( null, 2 );
|
|
32
|
+
|
|
33
|
+
render( <PostLastRevisionCheck>Children</PostLastRevisionCheck> );
|
|
18
34
|
|
|
19
35
|
expect( screen.queryByText( 'Children' ) ).not.toBeInTheDocument();
|
|
20
36
|
} );
|
|
21
37
|
|
|
22
38
|
it( 'should not render anything if there is only one revision', () => {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
</PostLastRevisionCheck>
|
|
27
|
-
);
|
|
39
|
+
setupDataMock( 1, 1 );
|
|
40
|
+
|
|
41
|
+
render( <PostLastRevisionCheck>Children</PostLastRevisionCheck> );
|
|
28
42
|
|
|
29
43
|
expect( screen.queryByText( 'Children' ) ).not.toBeInTheDocument();
|
|
30
44
|
} );
|
|
31
45
|
|
|
32
46
|
it( 'should render if there are two revisions', () => {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
</PostLastRevisionCheck>
|
|
37
|
-
);
|
|
47
|
+
setupDataMock( 1, 2 );
|
|
48
|
+
|
|
49
|
+
render( <PostLastRevisionCheck>Children</PostLastRevisionCheck> );
|
|
38
50
|
|
|
39
51
|
expect( screen.getByText( 'Children' ) ).toBeVisible();
|
|
40
52
|
} );
|
|
@@ -1,19 +1,24 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
5
|
-
import { withSelect } from '@wordpress/data';
|
|
4
|
+
import { useSelect } from '@wordpress/data';
|
|
6
5
|
|
|
7
6
|
/**
|
|
8
7
|
* Internal dependencies
|
|
9
8
|
*/
|
|
10
9
|
import { store as editorStore } from '../../store';
|
|
11
10
|
|
|
12
|
-
export function PostPendingStatusCheck( {
|
|
13
|
-
hasPublishAction,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
export function PostPendingStatusCheck( { children } ) {
|
|
12
|
+
const { hasPublishAction, isPublished } = useSelect( ( select ) => {
|
|
13
|
+
const { isCurrentPostPublished, getCurrentPost } =
|
|
14
|
+
select( editorStore );
|
|
15
|
+
return {
|
|
16
|
+
hasPublishAction:
|
|
17
|
+
getCurrentPost()._links?.[ 'wp:action-publish' ] ?? false,
|
|
18
|
+
isPublished: isCurrentPostPublished(),
|
|
19
|
+
};
|
|
20
|
+
}, [] );
|
|
21
|
+
|
|
17
22
|
if ( isPublished || ! hasPublishAction ) {
|
|
18
23
|
return null;
|
|
19
24
|
}
|
|
@@ -21,15 +26,4 @@ export function PostPendingStatusCheck( {
|
|
|
21
26
|
return children;
|
|
22
27
|
}
|
|
23
28
|
|
|
24
|
-
export default
|
|
25
|
-
withSelect( ( select ) => {
|
|
26
|
-
const { isCurrentPostPublished, getCurrentPostType, getCurrentPost } =
|
|
27
|
-
select( editorStore );
|
|
28
|
-
return {
|
|
29
|
-
hasPublishAction:
|
|
30
|
-
getCurrentPost()._links?.[ 'wp:action-publish' ] ?? false,
|
|
31
|
-
isPublished: isCurrentPostPublished(),
|
|
32
|
-
postType: getCurrentPostType(),
|
|
33
|
-
};
|
|
34
|
-
} )
|
|
35
|
-
)( PostPendingStatusCheck );
|
|
29
|
+
export default PostPendingStatusCheck;
|
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
5
|
import { CheckboxControl } from '@wordpress/components';
|
|
6
|
-
import {
|
|
7
|
-
import { compose } from '@wordpress/compose';
|
|
6
|
+
import { useDispatch, useSelect } from '@wordpress/data';
|
|
8
7
|
|
|
9
8
|
/**
|
|
10
9
|
* Internal dependencies
|
|
@@ -12,10 +11,15 @@ import { compose } from '@wordpress/compose';
|
|
|
12
11
|
import PostPendingStatusCheck from './check';
|
|
13
12
|
import { store as editorStore } from '../../store';
|
|
14
13
|
|
|
15
|
-
export function PostPendingStatus(
|
|
14
|
+
export function PostPendingStatus() {
|
|
15
|
+
const status = useSelect(
|
|
16
|
+
( select ) => select( editorStore ).getEditedPostAttribute( 'status' ),
|
|
17
|
+
[]
|
|
18
|
+
);
|
|
19
|
+
const { editPost } = useDispatch( editorStore );
|
|
16
20
|
const togglePendingStatus = () => {
|
|
17
21
|
const updatedStatus = status === 'pending' ? 'draft' : 'pending';
|
|
18
|
-
|
|
22
|
+
editPost( { status: updatedStatus } );
|
|
19
23
|
};
|
|
20
24
|
|
|
21
25
|
return (
|
|
@@ -30,13 +34,4 @@ export function PostPendingStatus( { status, onUpdateStatus } ) {
|
|
|
30
34
|
);
|
|
31
35
|
}
|
|
32
36
|
|
|
33
|
-
export default
|
|
34
|
-
withSelect( ( select ) => ( {
|
|
35
|
-
status: select( editorStore ).getEditedPostAttribute( 'status' ),
|
|
36
|
-
} ) ),
|
|
37
|
-
withDispatch( ( dispatch ) => ( {
|
|
38
|
-
onUpdateStatus( status ) {
|
|
39
|
-
dispatch( editorStore ).editPost( { status } );
|
|
40
|
-
},
|
|
41
|
-
} ) )
|
|
42
|
-
)( PostPendingStatus );
|
|
37
|
+
export default PostPendingStatus;
|
|
@@ -3,27 +3,49 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { render, screen } from '@testing-library/react';
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* WordPress dependencies
|
|
8
|
+
*/
|
|
9
|
+
import { useSelect } from '@wordpress/data';
|
|
10
|
+
|
|
6
11
|
/**
|
|
7
12
|
* Internal dependencies
|
|
8
13
|
*/
|
|
9
14
|
import { PostPendingStatusCheck } from '../check';
|
|
10
15
|
|
|
16
|
+
jest.mock( '@wordpress/data/src/components/use-select', () => {
|
|
17
|
+
// This allows us to tweak the returned value on each test.
|
|
18
|
+
const mock = jest.fn();
|
|
19
|
+
return mock;
|
|
20
|
+
} );
|
|
21
|
+
|
|
22
|
+
function setupUseSelectMock( hasPublishAction ) {
|
|
23
|
+
useSelect.mockImplementation( ( cb ) => {
|
|
24
|
+
return cb( () => ( {
|
|
25
|
+
isCurrentPostPublished: () => false,
|
|
26
|
+
getCurrentPost: () => ( {
|
|
27
|
+
_links: {
|
|
28
|
+
'wp:action-publish': hasPublishAction,
|
|
29
|
+
},
|
|
30
|
+
} ),
|
|
31
|
+
} ) );
|
|
32
|
+
} );
|
|
33
|
+
}
|
|
34
|
+
|
|
11
35
|
describe( 'PostPendingStatusCheck', () => {
|
|
12
36
|
it( "should not render anything if the user doesn't have the right capabilities", () => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
);
|
|
37
|
+
setupUseSelectMock( false );
|
|
38
|
+
|
|
39
|
+
render( <PostPendingStatusCheck>status</PostPendingStatusCheck> );
|
|
40
|
+
|
|
18
41
|
expect( screen.queryByText( 'status' ) ).not.toBeInTheDocument();
|
|
19
42
|
} );
|
|
20
43
|
|
|
21
44
|
it( 'should render if the user has the correct capability', () => {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
);
|
|
45
|
+
setupUseSelectMock( true );
|
|
46
|
+
|
|
47
|
+
render( <PostPendingStatusCheck>status</PostPendingStatusCheck> );
|
|
48
|
+
|
|
27
49
|
expect( screen.getByText( 'status' ) ).toBeVisible();
|
|
28
50
|
} );
|
|
29
51
|
} );
|