@wordpress/editor 13.16.0 → 13.17.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/build/components/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 +20 -24
- 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 +20 -18
- 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/entities-saved-states/hooks/use-is-dirty.js +16 -20
- 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
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { createElement } from "@wordpress/element";
|
|
2
|
-
|
|
3
2
|
/**
|
|
4
3
|
* External dependencies
|
|
5
4
|
*/
|
|
6
5
|
import removeAccents from 'remove-accents';
|
|
6
|
+
|
|
7
7
|
/**
|
|
8
8
|
* WordPress dependencies
|
|
9
9
|
*/
|
|
10
|
-
|
|
11
10
|
import { __ } from '@wordpress/i18n';
|
|
12
11
|
import { ComboboxControl } from '@wordpress/components';
|
|
13
12
|
import { debounce } from '@wordpress/compose';
|
|
@@ -15,29 +14,24 @@ import { useState, useMemo } from '@wordpress/element';
|
|
|
15
14
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
16
15
|
import { decodeEntities } from '@wordpress/html-entities';
|
|
17
16
|
import { store as coreStore } from '@wordpress/core-data';
|
|
17
|
+
|
|
18
18
|
/**
|
|
19
19
|
* Internal dependencies
|
|
20
20
|
*/
|
|
21
|
-
|
|
22
21
|
import { buildTermsTree } from '../../utils/terms';
|
|
23
22
|
import { store as editorStore } from '../../store';
|
|
24
|
-
|
|
25
23
|
function getTitle(post) {
|
|
26
24
|
return post?.title?.rendered ? decodeEntities(post.title.rendered) : `#${post.id} (${__('no title')})`;
|
|
27
25
|
}
|
|
28
|
-
|
|
29
26
|
export const getItemPriority = (name, searchValue) => {
|
|
30
27
|
const normalizedName = removeAccents(name || '').toLowerCase();
|
|
31
28
|
const normalizedSearch = removeAccents(searchValue || '').toLowerCase();
|
|
32
|
-
|
|
33
29
|
if (normalizedName === normalizedSearch) {
|
|
34
30
|
return 0;
|
|
35
31
|
}
|
|
36
|
-
|
|
37
32
|
if (normalizedName.startsWith(normalizedSearch)) {
|
|
38
33
|
return normalizedName.length;
|
|
39
34
|
}
|
|
40
|
-
|
|
41
35
|
return Infinity;
|
|
42
36
|
};
|
|
43
37
|
export function PageAttributesParent() {
|
|
@@ -53,7 +47,6 @@ export function PageAttributesParent() {
|
|
|
53
47
|
postType
|
|
54
48
|
} = useSelect(select => {
|
|
55
49
|
var _pType$hierarchical;
|
|
56
|
-
|
|
57
50
|
const {
|
|
58
51
|
getPostType,
|
|
59
52
|
getEntityRecords,
|
|
@@ -75,12 +68,12 @@ export function PageAttributesParent() {
|
|
|
75
68
|
orderby: 'menu_order',
|
|
76
69
|
order: 'asc',
|
|
77
70
|
_fields: 'id,title,parent'
|
|
78
|
-
};
|
|
71
|
+
};
|
|
79
72
|
|
|
73
|
+
// Perform a search when the field is changed.
|
|
80
74
|
if (!!fieldValue) {
|
|
81
75
|
query.search = fieldValue;
|
|
82
76
|
}
|
|
83
|
-
|
|
84
77
|
return {
|
|
85
78
|
isHierarchical: postIsHierarchical,
|
|
86
79
|
parentPostId: pageId,
|
|
@@ -105,31 +98,28 @@ export function PageAttributesParent() {
|
|
|
105
98
|
});
|
|
106
99
|
return sortedNodes.flat();
|
|
107
100
|
};
|
|
108
|
-
|
|
109
101
|
let tree = pageItems.map(item => ({
|
|
110
102
|
id: item.id,
|
|
111
103
|
parent: item.parent,
|
|
112
104
|
name: getTitle(item)
|
|
113
|
-
}));
|
|
105
|
+
}));
|
|
114
106
|
|
|
107
|
+
// Only build a hierarchical tree when not searching.
|
|
115
108
|
if (!fieldValue) {
|
|
116
109
|
tree = buildTermsTree(tree);
|
|
117
110
|
}
|
|
111
|
+
const opts = getOptionsFromTree(tree);
|
|
118
112
|
|
|
119
|
-
|
|
120
|
-
|
|
113
|
+
// Ensure the current parent is in the options list.
|
|
121
114
|
const optsHasParent = opts.find(item => item.value === parentPostId);
|
|
122
|
-
|
|
123
115
|
if (parentPost && !optsHasParent) {
|
|
124
116
|
opts.unshift({
|
|
125
117
|
value: parentPostId,
|
|
126
118
|
label: getTitle(parentPost)
|
|
127
119
|
});
|
|
128
120
|
}
|
|
129
|
-
|
|
130
121
|
return opts;
|
|
131
122
|
}, [pageItems, fieldValue]);
|
|
132
|
-
|
|
133
123
|
if (!isHierarchical || !parentPageLabel) {
|
|
134
124
|
return null;
|
|
135
125
|
}
|
|
@@ -138,24 +128,20 @@ export function PageAttributesParent() {
|
|
|
138
128
|
*
|
|
139
129
|
* @param {string} inputValue The current value of the input field.
|
|
140
130
|
*/
|
|
141
|
-
|
|
142
|
-
|
|
143
131
|
const handleKeydown = inputValue => {
|
|
144
132
|
setFieldValue(inputValue);
|
|
145
133
|
};
|
|
134
|
+
|
|
146
135
|
/**
|
|
147
136
|
* Handle author selection.
|
|
148
137
|
*
|
|
149
138
|
* @param {Object} selectedPostId The selected Author.
|
|
150
139
|
*/
|
|
151
|
-
|
|
152
|
-
|
|
153
140
|
const handleChange = selectedPostId => {
|
|
154
141
|
editPost({
|
|
155
142
|
parent: selectedPostId
|
|
156
143
|
});
|
|
157
144
|
};
|
|
158
|
-
|
|
159
145
|
return createElement(ComboboxControl, {
|
|
160
146
|
__nextHasNoMarginBottom: true,
|
|
161
147
|
className: "editor-page-attributes__parent",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/components/page-attributes/parent.js"],"names":["removeAccents","__","ComboboxControl","debounce","useState","useMemo","useSelect","useDispatch","decodeEntities","store","coreStore","buildTermsTree","editorStore","getTitle","post","title","rendered","id","getItemPriority","name","searchValue","normalizedName","toLowerCase","normalizedSearch","startsWith","length","Infinity","PageAttributesParent","editPost","fieldValue","setFieldValue","isHierarchical","parentPost","parentPostId","items","postType","select","getPostType","getEntityRecords","getEntityRecord","getCurrentPostId","getEditedPostAttribute","postTypeSlug","pageId","pType","postId","postIsHierarchical","hierarchical","query","per_page","exclude","parent_exclude","orderby","order","_fields","search","parentPageLabel","labels","parent_item_colon","pageItems","parentOptions","getOptionsFromTree","tree","level","mappedNodes","map","treeNode","value","label","repeat","rawName","children","sortedNodes","sort","a","b","priorityA","priorityB","flat","item","parent","opts","optsHasParent","find","unshift","handleKeydown","inputValue","handleChange","selectedPostId"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,aAAP,MAA0B,gBAA1B;AAEA;AACA;AACA;;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,eAAT,QAAgC,uBAAhC;AACA,SAASC,QAAT,QAAyB,oBAAzB;AACA,SAASC,QAAT,EAAmBC,OAAnB,QAAkC,oBAAlC;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,cAAT,QAA+B,0BAA/B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,SAASC,cAAT,QAA+B,mBAA/B;AACA,SAASF,KAAK,IAAIG,WAAlB,QAAqC,aAArC;;AAEA,SAASC,QAAT,CAAmBC,IAAnB,EAA0B;AACzB,SAAOA,IAAI,EAAEC,KAAN,EAAaC,QAAb,GACJR,cAAc,CAAEM,IAAI,CAACC,KAAL,CAAWC,QAAb,CADV,GAEH,IAAIF,IAAI,CAACG,EAAI,KAAKhB,EAAE,CAAE,UAAF,CAAgB,GAFxC;A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,OAAd;AAIA;;AACD,WAAOiD,IAAP;AACA,GA7C4B,EA6C1B,CAAEtB,SAAF,EAAa9B,UAAb,CA7C0B,CAA7B;;AA+CA,MAAK,CAAEE,cAAF,IAAoB,CAAEyB,eAA3B,EAA6C;AAC5C,WAAO,IAAP;AACA;AACD;AACD;AACA;AACA;AACA;;;AACC,QAAM6B,aAAa,GAAKC,UAAF,IAAkB;AACvCxD,IAAAA,aAAa,CAAEwD,UAAF,CAAb;AACA,GAFD;AAIA;AACD;AACA;AACA;AACA;;;AACC,QAAMC,YAAY,GAAKC,cAAF,IAAsB;AAC1C5D,IAAAA,QAAQ,CAAE;AAAEoD,MAAAA,MAAM,EAAEQ;AAAV,KAAF,CAAR;AACA,GAFD;;AAIA,SACC,cAAC,eAAD;AACC,IAAA,uBAAuB,MADxB;AAEC,IAAA,SAAS,EAAC,gCAFX;AAGC,IAAA,KAAK,EAAGhC,eAHT;AAIC,IAAA,KAAK,EAAGvB,YAJT;AAKC,IAAA,OAAO,EAAG2B,aALX;AAMC,IAAA,mBAAmB,EAAGzD,QAAQ,CAAEkF,aAAF,EAAiB,GAAjB,CAN/B;AAOC,IAAA,QAAQ,EAAGE;AAPZ,IADD;AAWA;AAED,eAAe5D,oBAAf","sourcesContent":["/**\n * External dependencies\n */\nimport removeAccents from 'remove-accents';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { ComboboxControl } from '@wordpress/components';\nimport { debounce } from '@wordpress/compose';\nimport { useState, useMemo } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { buildTermsTree } from '../../utils/terms';\nimport { store as editorStore } from '../../store';\n\nfunction getTitle( post ) {\n\treturn post?.title?.rendered\n\t\t? decodeEntities( post.title.rendered )\n\t\t: `#${ post.id } (${ __( 'no title' ) })`;\n}\n\nexport const getItemPriority = ( name, searchValue ) => {\n\tconst normalizedName = removeAccents( name || '' ).toLowerCase();\n\tconst normalizedSearch = removeAccents( searchValue || '' ).toLowerCase();\n\tif ( normalizedName === normalizedSearch ) {\n\t\treturn 0;\n\t}\n\n\tif ( normalizedName.startsWith( normalizedSearch ) ) {\n\t\treturn normalizedName.length;\n\t}\n\n\treturn Infinity;\n};\n\nexport function PageAttributesParent() {\n\tconst { editPost } = useDispatch( editorStore );\n\tconst [ fieldValue, setFieldValue ] = useState( false );\n\tconst { isHierarchical, parentPost, parentPostId, items, postType } =\n\t\tuseSelect(\n\t\t\t( select ) => {\n\t\t\t\tconst { getPostType, getEntityRecords, getEntityRecord } =\n\t\t\t\t\tselect( coreStore );\n\t\t\t\tconst { getCurrentPostId, getEditedPostAttribute } =\n\t\t\t\t\tselect( editorStore );\n\t\t\t\tconst postTypeSlug = getEditedPostAttribute( 'type' );\n\t\t\t\tconst pageId = getEditedPostAttribute( 'parent' );\n\t\t\t\tconst pType = getPostType( postTypeSlug );\n\t\t\t\tconst postId = getCurrentPostId();\n\t\t\t\tconst postIsHierarchical = pType?.hierarchical ?? false;\n\t\t\t\tconst query = {\n\t\t\t\t\tper_page: 100,\n\t\t\t\t\texclude: postId,\n\t\t\t\t\tparent_exclude: postId,\n\t\t\t\t\torderby: 'menu_order',\n\t\t\t\t\torder: 'asc',\n\t\t\t\t\t_fields: 'id,title,parent',\n\t\t\t\t};\n\n\t\t\t\t// Perform a search when the field is changed.\n\t\t\t\tif ( !! fieldValue ) {\n\t\t\t\t\tquery.search = fieldValue;\n\t\t\t\t}\n\n\t\t\t\treturn {\n\t\t\t\t\tisHierarchical: postIsHierarchical,\n\t\t\t\t\tparentPostId: pageId,\n\t\t\t\t\tparentPost: pageId\n\t\t\t\t\t\t? getEntityRecord( 'postType', postTypeSlug, pageId )\n\t\t\t\t\t\t: null,\n\t\t\t\t\titems: postIsHierarchical\n\t\t\t\t\t\t? getEntityRecords( 'postType', postTypeSlug, query )\n\t\t\t\t\t\t: [],\n\t\t\t\t\tpostType: pType,\n\t\t\t\t};\n\t\t\t},\n\t\t\t[ fieldValue ]\n\t\t);\n\n\tconst parentPageLabel = postType?.labels?.parent_item_colon;\n\tconst pageItems = items || [];\n\n\tconst parentOptions = useMemo( () => {\n\t\tconst getOptionsFromTree = ( tree, level = 0 ) => {\n\t\t\tconst mappedNodes = tree.map( ( treeNode ) => [\n\t\t\t\t{\n\t\t\t\t\tvalue: treeNode.id,\n\t\t\t\t\tlabel:\n\t\t\t\t\t\t'— '.repeat( level ) + decodeEntities( treeNode.name ),\n\t\t\t\t\trawName: treeNode.name,\n\t\t\t\t},\n\t\t\t\t...getOptionsFromTree( treeNode.children || [], level + 1 ),\n\t\t\t] );\n\n\t\t\tconst sortedNodes = mappedNodes.sort( ( [ a ], [ b ] ) => {\n\t\t\t\tconst priorityA = getItemPriority( a.rawName, fieldValue );\n\t\t\t\tconst priorityB = getItemPriority( b.rawName, fieldValue );\n\t\t\t\treturn priorityA >= priorityB ? 1 : -1;\n\t\t\t} );\n\n\t\t\treturn sortedNodes.flat();\n\t\t};\n\n\t\tlet tree = pageItems.map( ( item ) => ( {\n\t\t\tid: item.id,\n\t\t\tparent: item.parent,\n\t\t\tname: getTitle( item ),\n\t\t} ) );\n\n\t\t// Only build a hierarchical tree when not searching.\n\t\tif ( ! fieldValue ) {\n\t\t\ttree = buildTermsTree( tree );\n\t\t}\n\n\t\tconst opts = getOptionsFromTree( tree );\n\n\t\t// Ensure the current parent is in the options list.\n\t\tconst optsHasParent = opts.find(\n\t\t\t( item ) => item.value === parentPostId\n\t\t);\n\t\tif ( parentPost && ! optsHasParent ) {\n\t\t\topts.unshift( {\n\t\t\t\tvalue: parentPostId,\n\t\t\t\tlabel: getTitle( parentPost ),\n\t\t\t} );\n\t\t}\n\t\treturn opts;\n\t}, [ pageItems, fieldValue ] );\n\n\tif ( ! isHierarchical || ! parentPageLabel ) {\n\t\treturn null;\n\t}\n\t/**\n\t * Handle user input.\n\t *\n\t * @param {string} inputValue The current value of the input field.\n\t */\n\tconst handleKeydown = ( inputValue ) => {\n\t\tsetFieldValue( inputValue );\n\t};\n\n\t/**\n\t * Handle author selection.\n\t *\n\t * @param {Object} selectedPostId The selected Author.\n\t */\n\tconst handleChange = ( selectedPostId ) => {\n\t\teditPost( { parent: selectedPostId } );\n\t};\n\n\treturn (\n\t\t<ComboboxControl\n\t\t\t__nextHasNoMarginBottom\n\t\t\tclassName=\"editor-page-attributes__parent\"\n\t\t\tlabel={ parentPageLabel }\n\t\t\tvalue={ parentPostId }\n\t\t\toptions={ parentOptions }\n\t\t\tonFilterValueChange={ debounce( handleKeydown, 300 ) }\n\t\t\tonChange={ handleChange }\n\t\t/>\n\t);\n}\n\nexport default PageAttributesParent;\n"]}
|
|
1
|
+
{"version":3,"names":["removeAccents","__","ComboboxControl","debounce","useState","useMemo","useSelect","useDispatch","decodeEntities","store","coreStore","buildTermsTree","editorStore","getTitle","post","title","rendered","id","getItemPriority","name","searchValue","normalizedName","toLowerCase","normalizedSearch","startsWith","length","Infinity","PageAttributesParent","editPost","fieldValue","setFieldValue","isHierarchical","parentPost","parentPostId","items","postType","select","_pType$hierarchical","getPostType","getEntityRecords","getEntityRecord","getCurrentPostId","getEditedPostAttribute","postTypeSlug","pageId","pType","postId","postIsHierarchical","hierarchical","query","per_page","exclude","parent_exclude","orderby","order","_fields","search","parentPageLabel","labels","parent_item_colon","pageItems","parentOptions","getOptionsFromTree","tree","level","mappedNodes","map","treeNode","value","label","repeat","rawName","children","sortedNodes","sort","a","b","priorityA","priorityB","flat","item","parent","opts","optsHasParent","find","unshift","handleKeydown","inputValue","handleChange","selectedPostId","createElement","__nextHasNoMarginBottom","className","options","onFilterValueChange","onChange"],"sources":["@wordpress/editor/src/components/page-attributes/parent.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport removeAccents from 'remove-accents';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { ComboboxControl } from '@wordpress/components';\nimport { debounce } from '@wordpress/compose';\nimport { useState, useMemo } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { buildTermsTree } from '../../utils/terms';\nimport { store as editorStore } from '../../store';\n\nfunction getTitle( post ) {\n\treturn post?.title?.rendered\n\t\t? decodeEntities( post.title.rendered )\n\t\t: `#${ post.id } (${ __( 'no title' ) })`;\n}\n\nexport const getItemPriority = ( name, searchValue ) => {\n\tconst normalizedName = removeAccents( name || '' ).toLowerCase();\n\tconst normalizedSearch = removeAccents( searchValue || '' ).toLowerCase();\n\tif ( normalizedName === normalizedSearch ) {\n\t\treturn 0;\n\t}\n\n\tif ( normalizedName.startsWith( normalizedSearch ) ) {\n\t\treturn normalizedName.length;\n\t}\n\n\treturn Infinity;\n};\n\nexport function PageAttributesParent() {\n\tconst { editPost } = useDispatch( editorStore );\n\tconst [ fieldValue, setFieldValue ] = useState( false );\n\tconst { isHierarchical, parentPost, parentPostId, items, postType } =\n\t\tuseSelect(\n\t\t\t( select ) => {\n\t\t\t\tconst { getPostType, getEntityRecords, getEntityRecord } =\n\t\t\t\t\tselect( coreStore );\n\t\t\t\tconst { getCurrentPostId, getEditedPostAttribute } =\n\t\t\t\t\tselect( editorStore );\n\t\t\t\tconst postTypeSlug = getEditedPostAttribute( 'type' );\n\t\t\t\tconst pageId = getEditedPostAttribute( 'parent' );\n\t\t\t\tconst pType = getPostType( postTypeSlug );\n\t\t\t\tconst postId = getCurrentPostId();\n\t\t\t\tconst postIsHierarchical = pType?.hierarchical ?? false;\n\t\t\t\tconst query = {\n\t\t\t\t\tper_page: 100,\n\t\t\t\t\texclude: postId,\n\t\t\t\t\tparent_exclude: postId,\n\t\t\t\t\torderby: 'menu_order',\n\t\t\t\t\torder: 'asc',\n\t\t\t\t\t_fields: 'id,title,parent',\n\t\t\t\t};\n\n\t\t\t\t// Perform a search when the field is changed.\n\t\t\t\tif ( !! fieldValue ) {\n\t\t\t\t\tquery.search = fieldValue;\n\t\t\t\t}\n\n\t\t\t\treturn {\n\t\t\t\t\tisHierarchical: postIsHierarchical,\n\t\t\t\t\tparentPostId: pageId,\n\t\t\t\t\tparentPost: pageId\n\t\t\t\t\t\t? getEntityRecord( 'postType', postTypeSlug, pageId )\n\t\t\t\t\t\t: null,\n\t\t\t\t\titems: postIsHierarchical\n\t\t\t\t\t\t? getEntityRecords( 'postType', postTypeSlug, query )\n\t\t\t\t\t\t: [],\n\t\t\t\t\tpostType: pType,\n\t\t\t\t};\n\t\t\t},\n\t\t\t[ fieldValue ]\n\t\t);\n\n\tconst parentPageLabel = postType?.labels?.parent_item_colon;\n\tconst pageItems = items || [];\n\n\tconst parentOptions = useMemo( () => {\n\t\tconst getOptionsFromTree = ( tree, level = 0 ) => {\n\t\t\tconst mappedNodes = tree.map( ( treeNode ) => [\n\t\t\t\t{\n\t\t\t\t\tvalue: treeNode.id,\n\t\t\t\t\tlabel:\n\t\t\t\t\t\t'— '.repeat( level ) + decodeEntities( treeNode.name ),\n\t\t\t\t\trawName: treeNode.name,\n\t\t\t\t},\n\t\t\t\t...getOptionsFromTree( treeNode.children || [], level + 1 ),\n\t\t\t] );\n\n\t\t\tconst sortedNodes = mappedNodes.sort( ( [ a ], [ b ] ) => {\n\t\t\t\tconst priorityA = getItemPriority( a.rawName, fieldValue );\n\t\t\t\tconst priorityB = getItemPriority( b.rawName, fieldValue );\n\t\t\t\treturn priorityA >= priorityB ? 1 : -1;\n\t\t\t} );\n\n\t\t\treturn sortedNodes.flat();\n\t\t};\n\n\t\tlet tree = pageItems.map( ( item ) => ( {\n\t\t\tid: item.id,\n\t\t\tparent: item.parent,\n\t\t\tname: getTitle( item ),\n\t\t} ) );\n\n\t\t// Only build a hierarchical tree when not searching.\n\t\tif ( ! fieldValue ) {\n\t\t\ttree = buildTermsTree( tree );\n\t\t}\n\n\t\tconst opts = getOptionsFromTree( tree );\n\n\t\t// Ensure the current parent is in the options list.\n\t\tconst optsHasParent = opts.find(\n\t\t\t( item ) => item.value === parentPostId\n\t\t);\n\t\tif ( parentPost && ! optsHasParent ) {\n\t\t\topts.unshift( {\n\t\t\t\tvalue: parentPostId,\n\t\t\t\tlabel: getTitle( parentPost ),\n\t\t\t} );\n\t\t}\n\t\treturn opts;\n\t}, [ pageItems, fieldValue ] );\n\n\tif ( ! isHierarchical || ! parentPageLabel ) {\n\t\treturn null;\n\t}\n\t/**\n\t * Handle user input.\n\t *\n\t * @param {string} inputValue The current value of the input field.\n\t */\n\tconst handleKeydown = ( inputValue ) => {\n\t\tsetFieldValue( inputValue );\n\t};\n\n\t/**\n\t * Handle author selection.\n\t *\n\t * @param {Object} selectedPostId The selected Author.\n\t */\n\tconst handleChange = ( selectedPostId ) => {\n\t\teditPost( { parent: selectedPostId } );\n\t};\n\n\treturn (\n\t\t<ComboboxControl\n\t\t\t__nextHasNoMarginBottom\n\t\t\tclassName=\"editor-page-attributes__parent\"\n\t\t\tlabel={ parentPageLabel }\n\t\t\tvalue={ parentPostId }\n\t\t\toptions={ parentOptions }\n\t\t\tonFilterValueChange={ debounce( handleKeydown, 300 ) }\n\t\t\tonChange={ handleChange }\n\t\t/>\n\t);\n}\n\nexport default PageAttributesParent;\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,aAAa,MAAM,gBAAgB;;AAE1C;AACA;AACA;AACA,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,eAAe,QAAQ,uBAAuB;AACvD,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,QAAQ,EAAEC,OAAO,QAAQ,oBAAoB;AACtD,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;;AAEzD;AACA;AACA;AACA,SAASC,cAAc,QAAQ,mBAAmB;AAClD,SAASF,KAAK,IAAIG,WAAW,QAAQ,aA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KAAK,EAAExD,QAAQ,CAAEmB,UAAW;MAC7B,CAAE,CAAC;IACJ;IACA,OAAOkD,IAAI;EACZ,CAAC,EAAE,CAAEtB,SAAS,EAAE/B,UAAU,CAAG,CAAC;EAE9B,IAAK,CAAEE,cAAc,IAAI,CAAE0B,eAAe,EAAG;IAC5C,OAAO,IAAI;EACZ;EACA;AACD;AACA;AACA;AACA;EACC,MAAM6B,aAAa,GAAKC,UAAU,IAAM;IACvCzD,aAAa,CAAEyD,UAAW,CAAC;EAC5B,CAAC;;EAED;AACD;AACA;AACA;AACA;EACC,MAAMC,YAAY,GAAKC,cAAc,IAAM;IAC1C7D,QAAQ,CAAE;MAAEqD,MAAM,EAAEQ;IAAe,CAAE,CAAC;EACvC,CAAC;EAED,OACCC,aAAA,CAACxF,eAAe;IACfyF,uBAAuB;IACvBC,SAAS,EAAC,gCAAgC;IAC1CvB,KAAK,EAAGZ,eAAiB;IACzBW,KAAK,EAAGnC,YAAc;IACtB4D,OAAO,EAAGhC,aAAe;IACzBiC,mBAAmB,EAAG3F,QAAQ,CAAEmF,aAAa,EAAE,GAAI,CAAG;IACtDS,QAAQ,EAAGP;EAAc,CACzB,CAAC;AAEJ;AAEA,eAAe7D,oBAAoB"}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { createElement } from "@wordpress/element";
|
|
2
|
-
|
|
3
2
|
/**
|
|
4
3
|
* WordPress dependencies
|
|
5
4
|
*/
|
|
6
5
|
import { useSelect } from '@wordpress/data';
|
|
7
6
|
import { store as coreStore } from '@wordpress/core-data';
|
|
7
|
+
|
|
8
8
|
/**
|
|
9
9
|
* Internal dependencies
|
|
10
10
|
*/
|
|
11
|
-
|
|
12
11
|
import PostTypeSupportCheck from '../post-type-support-check';
|
|
13
12
|
import { store as editorStore } from '../../store';
|
|
14
13
|
import { AUTHORS_QUERY } from './constants';
|
|
@@ -20,7 +19,6 @@ export default function PostAuthorCheck({
|
|
|
20
19
|
hasAuthors
|
|
21
20
|
} = useSelect(select => {
|
|
22
21
|
var _post$_links$wpActio;
|
|
23
|
-
|
|
24
22
|
const post = select(editorStore).getCurrentPost();
|
|
25
23
|
const authors = select(coreStore).getUsers(AUTHORS_QUERY);
|
|
26
24
|
return {
|
|
@@ -28,11 +26,9 @@ export default function PostAuthorCheck({
|
|
|
28
26
|
hasAuthors: authors?.length >= 1
|
|
29
27
|
};
|
|
30
28
|
}, []);
|
|
31
|
-
|
|
32
29
|
if (!hasAssignAuthorAction || !hasAuthors) {
|
|
33
30
|
return null;
|
|
34
31
|
}
|
|
35
|
-
|
|
36
32
|
return createElement(PostTypeSupportCheck, {
|
|
37
33
|
supportKeys: "author"
|
|
38
34
|
}, children);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["useSelect","store","coreStore","PostTypeSupportCheck","editorStore","AUTHORS_QUERY","PostAuthorCheck","children","hasAssignAuthorAction","hasAuthors","select","_post$_links$wpActio","post","getCurrentPost","authors","getUsers","_links","length","createElement","supportKeys"],"sources":["@wordpress/editor/src/components/post-author/check.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport PostTypeSupportCheck from '../post-type-support-check';\nimport { store as editorStore } from '../../store';\nimport { AUTHORS_QUERY } from './constants';\n\nexport default function PostAuthorCheck( { children } ) {\n\tconst { hasAssignAuthorAction, hasAuthors } = useSelect( ( select ) => {\n\t\tconst post = select( editorStore ).getCurrentPost();\n\t\tconst authors = select( coreStore ).getUsers( AUTHORS_QUERY );\n\t\treturn {\n\t\t\thasAssignAuthorAction:\n\t\t\t\tpost._links?.[ 'wp:action-assign-author' ] ?? false,\n\t\t\thasAuthors: authors?.length >= 1,\n\t\t};\n\t}, [] );\n\n\tif ( ! hasAssignAuthorAction || ! hasAuthors ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PostTypeSupportCheck supportKeys=\"author\">\n\t\t\t{ children }\n\t\t</PostTypeSupportCheck>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;;AAEzD;AACA;AACA;AACA,OAAOC,oBAAoB,MAAM,4BAA4B;AAC7D,SAASF,KAAK,IAAIG,WAAW,QAAQ,aAAa;AAClD,SAASC,aAAa,QAAQ,aAAa;AAE3C,eAAe,SAASC,eAAeA,CAAE;EAAEC;AAAS,CAAC,EAAG;EACvD,MAAM;IAAEC,qBAAqB;IAAEC;EAAW,CAAC,GAAGT,SAAS,CAAIU,MAAM,IAAM;IAAA,IAAAC,oBAAA;IACtE,MAAMC,IAAI,GAAGF,MAAM,CAAEN,WAAY,CAAC,CAACS,cAAc,CAAC,CAAC;IACnD,MAAMC,OAAO,GAAGJ,MAAM,CAAER,SAAU,CAAC,CAACa,QAAQ,CAAEV,aAAc,CAAC;IAC7D,OAAO;MACNG,qBAAqB,GAAAG,oBAAA,GACpBC,IAAI,CAACI,MAAM,GAAI,yBAAyB,CAAE,cAAAL,oBAAA,cAAAA,oBAAA,GAAI,KAAK;MACpDF,UAAU,EAAEK,OAAO,EAAEG,MAAM,IAAI;IAChC,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,IAAK,CAAET,qBAAqB,IAAI,CAAEC,UAAU,EAAG;IAC9C,OAAO,IAAI;EACZ;EAEA,OACCS,aAAA,CAACf,oBAAoB;IAACgB,WAAW,EAAC;EAAQ,GACvCZ,QACmB,CAAC;AAEzB"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { createElement } from "@wordpress/element";
|
|
2
|
-
|
|
3
2
|
/**
|
|
4
3
|
* WordPress dependencies
|
|
5
4
|
*/
|
|
@@ -10,13 +9,12 @@ import { __ } from '@wordpress/i18n';
|
|
|
10
9
|
import { ComboboxControl } from '@wordpress/components';
|
|
11
10
|
import { decodeEntities } from '@wordpress/html-entities';
|
|
12
11
|
import { store as coreStore } from '@wordpress/core-data';
|
|
12
|
+
|
|
13
13
|
/**
|
|
14
14
|
* Internal dependencies
|
|
15
15
|
*/
|
|
16
|
-
|
|
17
16
|
import { store as editorStore } from '../../store';
|
|
18
17
|
import { AUTHORS_QUERY } from './constants';
|
|
19
|
-
|
|
20
18
|
function PostAuthorCombobox() {
|
|
21
19
|
const [fieldValue, setFieldValue] = useState();
|
|
22
20
|
const {
|
|
@@ -36,13 +34,12 @@ function PostAuthorCombobox() {
|
|
|
36
34
|
const author = getUser(getEditedPostAttribute('author'), {
|
|
37
35
|
context: 'view'
|
|
38
36
|
});
|
|
39
|
-
const query = {
|
|
37
|
+
const query = {
|
|
38
|
+
...AUTHORS_QUERY
|
|
40
39
|
};
|
|
41
|
-
|
|
42
40
|
if (fieldValue) {
|
|
43
41
|
query.search = fieldValue;
|
|
44
42
|
}
|
|
45
|
-
|
|
46
43
|
return {
|
|
47
44
|
authorId: getEditedPostAttribute('author'),
|
|
48
45
|
postAuthor: author,
|
|
@@ -59,51 +56,46 @@ function PostAuthorCombobox() {
|
|
|
59
56
|
value: author.id,
|
|
60
57
|
label: decodeEntities(author.name)
|
|
61
58
|
};
|
|
62
|
-
});
|
|
59
|
+
});
|
|
63
60
|
|
|
61
|
+
// Ensure the current author is included in the dropdown list.
|
|
64
62
|
const foundAuthor = fetchedAuthors.findIndex(({
|
|
65
63
|
value
|
|
66
64
|
}) => postAuthor?.id === value);
|
|
67
|
-
|
|
68
65
|
if (foundAuthor < 0 && postAuthor) {
|
|
69
66
|
return [{
|
|
70
67
|
value: postAuthor.id,
|
|
71
68
|
label: decodeEntities(postAuthor.name)
|
|
72
69
|
}, ...fetchedAuthors];
|
|
73
70
|
}
|
|
74
|
-
|
|
75
71
|
return fetchedAuthors;
|
|
76
72
|
}, [authors, postAuthor]);
|
|
73
|
+
|
|
77
74
|
/**
|
|
78
75
|
* Handle author selection.
|
|
79
76
|
*
|
|
80
77
|
* @param {number} postAuthorId The selected Author.
|
|
81
78
|
*/
|
|
82
|
-
|
|
83
79
|
const handleSelect = postAuthorId => {
|
|
84
80
|
if (!postAuthorId) {
|
|
85
81
|
return;
|
|
86
82
|
}
|
|
87
|
-
|
|
88
83
|
editPost({
|
|
89
84
|
author: postAuthorId
|
|
90
85
|
});
|
|
91
86
|
};
|
|
87
|
+
|
|
92
88
|
/**
|
|
93
89
|
* Handle user input.
|
|
94
90
|
*
|
|
95
91
|
* @param {string} inputValue The current value of the input field.
|
|
96
92
|
*/
|
|
97
|
-
|
|
98
|
-
|
|
99
93
|
const handleKeydown = inputValue => {
|
|
100
94
|
setFieldValue(inputValue);
|
|
101
95
|
};
|
|
102
|
-
|
|
103
96
|
if (!postAuthor) {
|
|
104
97
|
return null;
|
|
105
98
|
}
|
|
106
|
-
|
|
107
99
|
return createElement(ComboboxControl, {
|
|
108
100
|
__nextHasNoMarginBottom: true,
|
|
109
101
|
label: __('Author'),
|
|
@@ -115,6 +107,5 @@ function PostAuthorCombobox() {
|
|
|
115
107
|
allowReset: false
|
|
116
108
|
});
|
|
117
109
|
}
|
|
118
|
-
|
|
119
110
|
export default PostAuthorCombobox;
|
|
120
111
|
//# sourceMappingURL=combobox.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["debounce","useState","useMemo","useSelect","useDispatch","__","ComboboxControl","decodeEntities","store","coreStore","editorStore","AUTHORS_QUERY","PostAuthorCombobox","fieldValue","setFieldValue","authorId","isLoading","authors","postAuthor","select","getUser","getUsers","isResolving","getEditedPostAttribute","author","context","query","search","editPost","authorOptions","fetchedAuthors","map","value","id","label","name","foundAuthor","findIndex","handleSelect","postAuthorId","handleKeydown","inputValue","createElement","__nextHasNoMarginBottom","options","onFilterValueChange","onChange","allowReset"],"sources":["@wordpress/editor/src/components/post-author/combobox.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { debounce } from '@wordpress/compose';\nimport { useState, useMemo } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { ComboboxControl } from '@wordpress/components';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { AUTHORS_QUERY } from './constants';\n\nfunction PostAuthorCombobox() {\n\tconst [ fieldValue, setFieldValue ] = useState();\n\n\tconst { authorId, isLoading, authors, postAuthor } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getUser, getUsers, isResolving } = select( coreStore );\n\t\t\tconst { getEditedPostAttribute } = select( editorStore );\n\t\t\tconst author = getUser( getEditedPostAttribute( 'author' ), {\n\t\t\t\tcontext: 'view',\n\t\t\t} );\n\t\t\tconst query = { ...AUTHORS_QUERY };\n\n\t\t\tif ( fieldValue ) {\n\t\t\t\tquery.search = fieldValue;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tauthorId: getEditedPostAttribute( 'author' ),\n\t\t\t\tpostAuthor: author,\n\t\t\t\tauthors: getUsers( query ),\n\t\t\t\tisLoading: isResolving( 'core', 'getUsers', [ query ] ),\n\t\t\t};\n\t\t},\n\t\t[ fieldValue ]\n\t);\n\tconst { editPost } = useDispatch( editorStore );\n\n\tconst authorOptions = useMemo( () => {\n\t\tconst fetchedAuthors = ( authors ?? [] ).map( ( author ) => {\n\t\t\treturn {\n\t\t\t\tvalue: author.id,\n\t\t\t\tlabel: decodeEntities( author.name ),\n\t\t\t};\n\t\t} );\n\n\t\t// Ensure the current author is included in the dropdown list.\n\t\tconst foundAuthor = fetchedAuthors.findIndex(\n\t\t\t( { value } ) => postAuthor?.id === value\n\t\t);\n\n\t\tif ( foundAuthor < 0 && postAuthor ) {\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\tvalue: postAuthor.id,\n\t\t\t\t\tlabel: decodeEntities( postAuthor.name ),\n\t\t\t\t},\n\t\t\t\t...fetchedAuthors,\n\t\t\t];\n\t\t}\n\n\t\treturn fetchedAuthors;\n\t}, [ authors, postAuthor ] );\n\n\t/**\n\t * Handle author selection.\n\t *\n\t * @param {number} postAuthorId The selected Author.\n\t */\n\tconst handleSelect = ( postAuthorId ) => {\n\t\tif ( ! postAuthorId ) {\n\t\t\treturn;\n\t\t}\n\t\teditPost( { author: postAuthorId } );\n\t};\n\n\t/**\n\t * Handle user input.\n\t *\n\t * @param {string} inputValue The current value of the input field.\n\t */\n\tconst handleKeydown = ( inputValue ) => {\n\t\tsetFieldValue( inputValue );\n\t};\n\n\tif ( ! postAuthor ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<ComboboxControl\n\t\t\t__nextHasNoMarginBottom\n\t\t\tlabel={ __( 'Author' ) }\n\t\t\toptions={ authorOptions }\n\t\t\tvalue={ authorId }\n\t\t\tonFilterValueChange={ debounce( handleKeydown, 300 ) }\n\t\t\tonChange={ handleSelect }\n\t\t\tisLoading={ isLoading }\n\t\t\tallowReset={ false }\n\t\t/>\n\t);\n}\n\nexport default PostAuthorCombobox;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,QAAQ,EAAEC,OAAO,QAAQ,oBAAoB;AACtD,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,eAAe,QAAQ,uBAAuB;AACvD,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;;AAEzD;AACA;AACA;AACA,SAASD,KAAK,IAAIE,WAAW,QAAQ,aAAa;AAClD,SAASC,aAAa,QAAQ,aAAa;AAE3C,SAASC,kBAAkBA,CAAA,EAAG;EAC7B,MAAM,CAAEC,UAAU,EAAEC,aAAa,CAAE,GAAGb,QAAQ,CAAC,CAAC;EAEhD,MAAM;IAAEc,QAAQ;IAAEC,SAAS;IAAEC,OAAO;IAAEC;EAAW,CAAC,GAAG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;QACCc,KAAK,EAAEd,UAAU,CAACe,EAAE;QACpBC,KAAK,EAAE3B,cAAc,CAAEW,UAAU,CAACiB,IAAK;MACxC,CAAC,EACD,GAAGL,cAAc,CACjB;IACF;IAEA,OAAOA,cAAc;EACtB,CAAC,EAAE,CAAEb,OAAO,EAAEC,UAAU,CAAG,CAAC;;EAE5B;AACD;AACA;AACA;AACA;EACC,MAAMoB,YAAY,GAAKC,YAAY,IAAM;IACxC,IAAK,CAAEA,YAAY,EAAG;MACrB;IACD;IACAX,QAAQ,CAAE;MAAEJ,MAAM,EAAEe;IAAa,CAAE,CAAC;EACrC,CAAC;;EAED;AACD;AACA;AACA;AACA;EACC,MAAMC,aAAa,GAAKC,UAAU,IAAM;IACvC3B,aAAa,CAAE2B,UAAW,CAAC;EAC5B,CAAC;EAED,IAAK,CAAEvB,UAAU,EAAG;IACnB,OAAO,IAAI;EACZ;EAEA,OACCwB,aAAA,CAACpC,eAAe;IACfqC,uBAAuB;IACvBT,KAAK,EAAG7B,EAAE,CAAE,QAAS,CAAG;IACxBuC,OAAO,EAAGf,aAAe;IACzBG,KAAK,EAAGjB,QAAU;IAClB8B,mBAAmB,EAAG7C,QAAQ,CAAEwC,aAAa,EAAE,GAAI,CAAG;IACtDM,QAAQ,EAAGR,YAAc;IACzBtB,SAAS,EAAGA,SAAW;IACvB+B,UAAU,EAAG;EAAO,CACpB,CAAC;AAEJ;AAEA,eAAenC,kBAAkB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["AUTHORS_QUERY","who","per_page","_fields","context"],"sources":["@wordpress/editor/src/components/post-author/constants.js"],"sourcesContent":["export const AUTHORS_QUERY = {\n\twho: 'authors',\n\tper_page: 50,\n\t_fields: 'id,name',\n\tcontext: 'view', // Allows non-admins to perform requests.\n};\n"],"mappings":"AAAA,OAAO,MAAMA,aAAa,GAAG;EAC5BC,GAAG,EAAE,SAAS;EACdC,QAAQ,EAAE,EAAE;EACZC,OAAO,EAAE,SAAS;EAClBC,OAAO,EAAE,MAAM,CAAE;AAClB,CAAC"}
|
|
@@ -1,31 +1,26 @@
|
|
|
1
1
|
import { createElement } from "@wordpress/element";
|
|
2
|
-
|
|
3
2
|
/**
|
|
4
3
|
* WordPress dependencies
|
|
5
4
|
*/
|
|
6
5
|
import { useSelect } from '@wordpress/data';
|
|
7
6
|
import { store as coreStore } from '@wordpress/core-data';
|
|
7
|
+
|
|
8
8
|
/**
|
|
9
9
|
* Internal dependencies
|
|
10
10
|
*/
|
|
11
|
-
|
|
12
11
|
import PostAuthorCombobox from './combobox';
|
|
13
12
|
import PostAuthorSelect from './select';
|
|
14
13
|
import { AUTHORS_QUERY } from './constants';
|
|
15
14
|
const minimumUsersForCombobox = 25;
|
|
16
|
-
|
|
17
15
|
function PostAuthor() {
|
|
18
16
|
const showCombobox = useSelect(select => {
|
|
19
17
|
const authors = select(coreStore).getUsers(AUTHORS_QUERY);
|
|
20
18
|
return authors?.length >= minimumUsersForCombobox;
|
|
21
19
|
}, []);
|
|
22
|
-
|
|
23
20
|
if (showCombobox) {
|
|
24
21
|
return createElement(PostAuthorCombobox, null);
|
|
25
22
|
}
|
|
26
|
-
|
|
27
23
|
return createElement(PostAuthorSelect, null);
|
|
28
24
|
}
|
|
29
|
-
|
|
30
25
|
export default PostAuthor;
|
|
31
26
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["useSelect","store","coreStore","PostAuthorCombobox","PostAuthorSelect","AUTHORS_QUERY","minimumUsersForCombobox","PostAuthor","showCombobox","select","authors","getUsers","length","createElement"],"sources":["@wordpress/editor/src/components/post-author/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport PostAuthorCombobox from './combobox';\nimport PostAuthorSelect from './select';\nimport { AUTHORS_QUERY } from './constants';\n\nconst minimumUsersForCombobox = 25;\n\nfunction PostAuthor() {\n\tconst showCombobox = useSelect( ( select ) => {\n\t\tconst authors = select( coreStore ).getUsers( AUTHORS_QUERY );\n\n\t\treturn authors?.length >= minimumUsersForCombobox;\n\t}, [] );\n\n\tif ( showCombobox ) {\n\t\treturn <PostAuthorCombobox />;\n\t}\n\treturn <PostAuthorSelect />;\n}\n\nexport default PostAuthor;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;;AAEzD;AACA;AACA;AACA,OAAOC,kBAAkB,MAAM,YAAY;AAC3C,OAAOC,gBAAgB,MAAM,UAAU;AACvC,SAASC,aAAa,QAAQ,aAAa;AAE3C,MAAMC,uBAAuB,GAAG,EAAE;AAElC,SAASC,UAAUA,CAAA,EAAG;EACrB,MAAMC,YAAY,GAAGR,SAAS,CAAIS,MAAM,IAAM;IAC7C,MAAMC,OAAO,GAAGD,MAAM,CAAEP,SAAU,CAAC,CAACS,QAAQ,CAAEN,aAAc,CAAC;IAE7D,OAAOK,OAAO,EAAEE,MAAM,IAAIN,uBAAuB;EAClD,CAAC,EAAE,EAAG,CAAC;EAEP,IAAKE,YAAY,EAAG;IACnB,OAAOK,aAAA,CAACV,kBAAkB,MAAE,CAAC;EAC9B;EACA,OAAOU,aAAA,CAACT,gBAAgB,MAAE,CAAC;AAC5B;AAEA,eAAeG,UAAU"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { createElement } from "@wordpress/element";
|
|
2
|
-
|
|
3
2
|
/**
|
|
4
3
|
* WordPress dependencies
|
|
5
4
|
*/
|
|
@@ -9,13 +8,12 @@ import { useSelect, useDispatch } from '@wordpress/data';
|
|
|
9
8
|
import { decodeEntities } from '@wordpress/html-entities';
|
|
10
9
|
import { SelectControl } from '@wordpress/components';
|
|
11
10
|
import { store as coreStore } from '@wordpress/core-data';
|
|
11
|
+
|
|
12
12
|
/**
|
|
13
13
|
* Internal dependencies
|
|
14
14
|
*/
|
|
15
|
-
|
|
16
15
|
import { store as editorStore } from '../../store';
|
|
17
16
|
import { AUTHORS_QUERY } from './constants';
|
|
18
|
-
|
|
19
17
|
function PostAuthorSelect() {
|
|
20
18
|
const {
|
|
21
19
|
editPost
|
|
@@ -37,14 +35,12 @@ function PostAuthorSelect() {
|
|
|
37
35
|
};
|
|
38
36
|
});
|
|
39
37
|
}, [authors]);
|
|
40
|
-
|
|
41
38
|
const setAuthorId = value => {
|
|
42
39
|
const author = Number(value);
|
|
43
40
|
editPost({
|
|
44
41
|
author
|
|
45
42
|
});
|
|
46
43
|
};
|
|
47
|
-
|
|
48
44
|
return createElement(SelectControl, {
|
|
49
45
|
__nextHasNoMarginBottom: true,
|
|
50
46
|
className: "post-author-selector",
|
|
@@ -54,6 +50,5 @@ function PostAuthorSelect() {
|
|
|
54
50
|
value: postAuthor
|
|
55
51
|
});
|
|
56
52
|
}
|
|
57
|
-
|
|
58
53
|
export default PostAuthorSelect;
|
|
59
54
|
//# sourceMappingURL=select.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["__","useMemo","useSelect","useDispatch","decodeEntities","SelectControl","store","coreStore","editorStore","AUTHORS_QUERY","PostAuthorSelect","editPost","postAuthor","authors","select","getEditedPostAttribute","getUsers","authorOptions","map","author","value","id","label","name","setAuthorId","Number","createElement","__nextHasNoMarginBottom","className","options","onChange"],"sources":["@wordpress/editor/src/components/post-author/select.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useMemo } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { SelectControl } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { AUTHORS_QUERY } from './constants';\n\nfunction PostAuthorSelect() {\n\tconst { editPost } = useDispatch( editorStore );\n\tconst { postAuthor, authors } = useSelect( ( select ) => {\n\t\treturn {\n\t\t\tpostAuthor:\n\t\t\t\tselect( editorStore ).getEditedPostAttribute( 'author' ),\n\t\t\tauthors: select( coreStore ).getUsers( AUTHORS_QUERY ),\n\t\t};\n\t}, [] );\n\n\tconst authorOptions = useMemo( () => {\n\t\treturn ( authors ?? [] ).map( ( author ) => {\n\t\t\treturn {\n\t\t\t\tvalue: author.id,\n\t\t\t\tlabel: decodeEntities( author.name ),\n\t\t\t};\n\t\t} );\n\t}, [ authors ] );\n\n\tconst setAuthorId = ( value ) => {\n\t\tconst author = Number( value );\n\t\teditPost( { author } );\n\t};\n\n\treturn (\n\t\t<SelectControl\n\t\t\t__nextHasNoMarginBottom\n\t\t\tclassName=\"post-author-selector\"\n\t\t\tlabel={ __( 'Author' ) }\n\t\t\toptions={ authorOptions }\n\t\t\tonChange={ setAuthorId }\n\t\t\tvalue={ postAuthor }\n\t\t/>\n\t);\n}\n\nexport default PostAuthorSelect;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,aAAa,QAAQ,uBAAuB;AACrD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;;AAEzD;AACA;AACA;AACA,SAASD,KAAK,IAAIE,WAAW,QAAQ,aAAa;AAClD,SAASC,aAAa,QAAQ,aAAa;AAE3C,SAASC,gBAAgBA,CAAA,EAAG;EAC3B,MAAM;IAAEC;EAAS,CAAC,GAAGR,WAAW,CAAEK,WAAY,CAAC;EAC/C,MAAM;IAAEI,UAAU;IAAEC;EAAQ,CAAC,GAAGX,SAAS,CAAIY,MAAM,IAAM;IACxD,OAAO;MACNF,UAAU,EACTE,MAAM,CAAEN,WAAY,CAAC,CAACO,sBAAsB,CAAE,QAAS,CAAC;MACzDF,OAAO,EAAEC,MAAM,CAAEP,SAAU,CAAC,CAACS,QAAQ,CAAEP,aAAc;IACtD,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,MAAMQ,aAAa,GAAGhB,OAAO,CAAE,MAAM;IACpC,OAAO,CAAEY,OAAO,aAAPA,OAAO,cAAPA,OAAO,GAAI,EAAE,EAAGK,GAAG,CAAIC,MAAM,IAAM;MAC3C,OAAO;QACNC,KAAK,EAAED,MAAM,CAACE,EAAE;QAChBC,KAAK,EAAElB,cAAc,CAAEe,MAAM,CAACI,IAAK;MACpC,CAAC;IACF,CAAE,CAAC;EACJ,CAAC,EAAE,CAAEV,OAAO,CAAG,CAAC;EAEhB,MAAMW,WAAW,GAAKJ,KAAK,IAAM;IAChC,MAAMD,MAAM,GAAGM,MAAM,CAAEL,KAAM,CAAC;IAC9BT,QAAQ,CAAE;MAAEQ;IAAO,CAAE,CAAC;EACvB,CAAC;EAED,OACCO,aAAA,CAACrB,aAAa;IACbsB,uBAAuB;IACvBC,SAAS,EAAC,sBAAsB;IAChCN,KAAK,EAAGtB,EAAE,CAAE,QAAS,CAAG;IACxB6B,OAAO,EAAGZ,aAAe;IACzBa,QAAQ,EAAGN,WAAa;IACxBJ,KAAK,EAAGR;EAAY,CACpB,CAAC;AAEJ;AAEA,eAAeF,gBAAgB"}
|
|
@@ -1,31 +1,26 @@
|
|
|
1
1
|
import { createElement } from "@wordpress/element";
|
|
2
|
-
|
|
3
2
|
/**
|
|
4
3
|
* WordPress dependencies
|
|
5
4
|
*/
|
|
6
5
|
import { __ } from '@wordpress/i18n';
|
|
7
6
|
import { CheckboxControl } from '@wordpress/components';
|
|
8
7
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
8
|
+
|
|
9
9
|
/**
|
|
10
10
|
* Internal dependencies
|
|
11
11
|
*/
|
|
12
|
-
|
|
13
12
|
import { store as editorStore } from '../../store';
|
|
14
|
-
|
|
15
13
|
function PostComments() {
|
|
16
14
|
const commentStatus = useSelect(select => {
|
|
17
15
|
var _select$getEditedPost;
|
|
18
|
-
|
|
19
16
|
return (_select$getEditedPost = select(editorStore).getEditedPostAttribute('comment_status')) !== null && _select$getEditedPost !== void 0 ? _select$getEditedPost : 'open';
|
|
20
17
|
}, []);
|
|
21
18
|
const {
|
|
22
19
|
editPost
|
|
23
20
|
} = useDispatch(editorStore);
|
|
24
|
-
|
|
25
21
|
const onToggleComments = () => editPost({
|
|
26
22
|
comment_status: commentStatus === 'open' ? 'closed' : 'open'
|
|
27
23
|
});
|
|
28
|
-
|
|
29
24
|
return createElement(CheckboxControl, {
|
|
30
25
|
__nextHasNoMarginBottom: true,
|
|
31
26
|
label: __('Allow comments'),
|
|
@@ -33,6 +28,5 @@ function PostComments() {
|
|
|
33
28
|
onChange: onToggleComments
|
|
34
29
|
});
|
|
35
30
|
}
|
|
36
|
-
|
|
37
31
|
export default PostComments;
|
|
38
32
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["__","CheckboxControl","useDispatch","useSelect","store","editorStore","PostComments","commentStatus","select","_select$getEditedPost","getEditedPostAttribute","editPost","onToggleComments","comment_status","createElement","__nextHasNoMarginBottom","label","checked","onChange"],"sources":["@wordpress/editor/src/components/post-comments/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { CheckboxControl } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nfunction PostComments() {\n\tconst commentStatus = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).getEditedPostAttribute( 'comment_status' ) ??\n\t\t\t'open',\n\t\t[]\n\t);\n\tconst { editPost } = useDispatch( editorStore );\n\tconst onToggleComments = () =>\n\t\teditPost( {\n\t\t\tcomment_status: commentStatus === 'open' ? 'closed' : 'open',\n\t\t} );\n\n\treturn (\n\t\t<CheckboxControl\n\t\t\t__nextHasNoMarginBottom\n\t\t\tlabel={ __( 'Allow comments' ) }\n\t\t\tchecked={ commentStatus === 'open' }\n\t\t\tonChange={ onToggleComments }\n\t\t/>\n\t);\n}\n\nexport default PostComments;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,eAAe,QAAQ,uBAAuB;AACvD,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;;AAExD;AACA;AACA;AACA,SAASC,KAAK,IAAIC,WAAW,QAAQ,aAAa;AAElD,SAASC,YAAYA,CAAA,EAAG;EACvB,MAAMC,aAAa,GAAGJ,SAAS,CAC5BK,MAAM;IAAA,IAAAC,qBAAA;IAAA,QAAAA,qBAAA,GACPD,MAAM,CAAEH,WAAY,CAAC,CAACK,sBAAsB,CAAE,gBAAiB,CAAC,cAAAD,qBAAA,cAAAA,qBAAA,GAChE,MAAM;EAAA,GACP,EACD,CAAC;EACD,MAAM;IAAEE;EAAS,CAAC,GAAGT,WAAW,CAAEG,WAAY,CAAC;EAC/C,MAAMO,gBAAgB,GAAGA,CAAA,KACxBD,QAAQ,CAAE;IACTE,cAAc,EAAEN,aAAa,KAAK,MAAM,GAAG,QAAQ,GAAG;EACvD,CAAE,CAAC;EAEJ,OACCO,aAAA,CAACb,eAAe;IACfc,uBAAuB;IACvBC,KAAK,EAAGhB,EAAE,CAAE,gBAAiB,CAAG;IAChCiB,OAAO,EAAGV,aAAa,KAAK,MAAQ;IACpCW,QAAQ,EAAGN;EAAkB,CAC7B,CAAC;AAEJ;AAEA,eAAeN,YAAY"}
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { createElement } from "@wordpress/element";
|
|
2
|
-
|
|
3
2
|
/**
|
|
4
3
|
* Internal dependencies
|
|
5
4
|
*/
|
|
6
5
|
import PostTypeSupportCheck from '../post-type-support-check';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
function PostExcerptCheck({
|
|
7
|
+
children
|
|
8
|
+
}) {
|
|
9
|
+
return createElement(PostTypeSupportCheck, {
|
|
10
10
|
supportKeys: "excerpt"
|
|
11
|
-
});
|
|
11
|
+
}, children);
|
|
12
12
|
}
|
|
13
|
-
|
|
14
13
|
export default PostExcerptCheck;
|
|
15
14
|
//# sourceMappingURL=check.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["PostTypeSupportCheck","PostExcerptCheck","children","createElement","supportKeys"],"sources":["@wordpress/editor/src/components/post-excerpt/check.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport PostTypeSupportCheck from '../post-type-support-check';\n\nfunction PostExcerptCheck( { children } ) {\n\treturn (\n\t\t<PostTypeSupportCheck supportKeys=\"excerpt\">\n\t\t\t{ children }\n\t\t</PostTypeSupportCheck>\n\t);\n}\n\nexport default PostExcerptCheck;\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,oBAAoB,MAAM,4BAA4B;AAE7D,SAASC,gBAAgBA,CAAE;EAAEC;AAAS,CAAC,EAAG;EACzC,OACCC,aAAA,CAACH,oBAAoB;IAACI,WAAW,EAAC;EAAS,GACxCF,QACmB,CAAC;AAEzB;AAEA,eAAeD,gBAAgB"}
|
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
import { createElement } from "@wordpress/element";
|
|
2
|
-
|
|
3
2
|
/**
|
|
4
3
|
* WordPress dependencies
|
|
5
4
|
*/
|
|
6
5
|
import { __ } from '@wordpress/i18n';
|
|
7
6
|
import { ExternalLink, TextareaControl } from '@wordpress/components';
|
|
8
7
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
8
|
+
|
|
9
9
|
/**
|
|
10
10
|
* Internal dependencies
|
|
11
11
|
*/
|
|
12
|
-
|
|
13
12
|
import { store as editorStore } from '../../store';
|
|
14
|
-
|
|
15
13
|
function PostExcerpt() {
|
|
16
14
|
const excerpt = useSelect(select => select(editorStore).getEditedPostAttribute('excerpt'), []);
|
|
17
15
|
const {
|
|
@@ -31,6 +29,5 @@ function PostExcerpt() {
|
|
|
31
29
|
href: __('https://wordpress.org/documentation/article/page-post-settings-sidebar/#excerpt')
|
|
32
30
|
}, __('Learn more about manual excerpts')));
|
|
33
31
|
}
|
|
34
|
-
|
|
35
32
|
export default PostExcerpt;
|
|
36
33
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["__","ExternalLink","TextareaControl","useDispatch","useSelect","store","editorStore","PostExcerpt","excerpt","select","getEditedPostAttribute","editPost","createElement","className","__nextHasNoMarginBottom","label","onChange","value","href"],"sources":["@wordpress/editor/src/components/post-excerpt/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { ExternalLink, TextareaControl } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nfunction PostExcerpt() {\n\tconst excerpt = useSelect(\n\t\t( select ) => select( editorStore ).getEditedPostAttribute( 'excerpt' ),\n\t\t[]\n\t);\n\tconst { editPost } = useDispatch( editorStore );\n\n\treturn (\n\t\t<div className=\"editor-post-excerpt\">\n\t\t\t<TextareaControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tlabel={ __( 'Write an excerpt (optional)' ) }\n\t\t\t\tclassName=\"editor-post-excerpt__textarea\"\n\t\t\t\tonChange={ ( value ) => editPost( { excerpt: value } ) }\n\t\t\t\tvalue={ excerpt }\n\t\t\t/>\n\t\t\t<ExternalLink\n\t\t\t\thref={ __(\n\t\t\t\t\t'https://wordpress.org/documentation/article/page-post-settings-sidebar/#excerpt'\n\t\t\t\t) }\n\t\t\t>\n\t\t\t\t{ __( 'Learn more about manual excerpts' ) }\n\t\t\t</ExternalLink>\n\t\t</div>\n\t);\n}\n\nexport default PostExcerpt;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,YAAY,EAAEC,eAAe,QAAQ,uBAAuB;AACrE,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;;AAExD;AACA;AACA;AACA,SAASC,KAAK,IAAIC,WAAW,QAAQ,aAAa;AAElD,SAASC,WAAWA,CAAA,EAAG;EACtB,MAAMC,OAAO,GAAGJ,SAAS,CACtBK,MAAM,IAAMA,MAAM,CAAEH,WAAY,CAAC,CAACI,sBAAsB,CAAE,SAAU,CAAC,EACvE,EACD,CAAC;EACD,MAAM;IAAEC;EAAS,CAAC,GAAGR,WAAW,CAAEG,WAAY,CAAC;EAE/C,OACCM,aAAA;IAAKC,SAAS,EAAC;EAAqB,GACnCD,aAAA,CAACV,eAAe;IACfY,uBAAuB;IACvBC,KAAK,EAAGf,EAAE,CAAE,6BAA8B,CAAG;IAC7Ca,SAAS,EAAC,+BAA+B;IACzCG,QAAQ,EAAKC,KAAK,IAAMN,QAAQ,CAAE;MAAEH,OAAO,EAAES;IAAM,CAAE,CAAG;IACxDA,KAAK,EAAGT;EAAS,CACjB,CAAC,EACFI,aAAA,CAACX,YAAY;IACZiB,IAAI,EAAGlB,EAAE,CACR,iFACD;EAAG,GAEDA,EAAE,CAAE,kCAAmC,CAC5B,CACV,CAAC;AAER;AAEA,eAAeO,WAAW"}
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import { createElement } from "@wordpress/element";
|
|
2
|
-
|
|
3
2
|
/**
|
|
4
3
|
* Internal dependencies
|
|
5
4
|
*/
|
|
6
5
|
import PostTypeSupportCheck from '../post-type-support-check';
|
|
7
6
|
import ThemeSupportCheck from '../theme-support-check';
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
function PostFeaturedImageCheck({
|
|
8
|
+
children
|
|
9
|
+
}) {
|
|
10
10
|
return createElement(ThemeSupportCheck, {
|
|
11
11
|
supportKeys: "post-thumbnails"
|
|
12
|
-
}, createElement(PostTypeSupportCheck, {
|
|
12
|
+
}, createElement(PostTypeSupportCheck, {
|
|
13
13
|
supportKeys: "thumbnail"
|
|
14
|
-
}));
|
|
14
|
+
}, children));
|
|
15
15
|
}
|
|
16
|
-
|
|
17
16
|
export default PostFeaturedImageCheck;
|
|
18
17
|
//# sourceMappingURL=check.js.map
|