@wordpress/editor 13.16.0 → 13.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/build/components/autocompleters/index.js +0 -2
- package/build/components/autocompleters/index.js.map +1 -1
- package/build/components/autocompleters/user.js +2 -9
- package/build/components/autocompleters/user.js.map +1 -1
- package/build/components/autosave-monitor/index.js +0 -24
- package/build/components/autosave-monitor/index.js.map +1 -1
- package/build/components/character-count/index.js +1 -4
- package/build/components/character-count/index.js.map +1 -1
- package/build/components/deprecated.js +1 -11
- package/build/components/deprecated.js.map +1 -1
- package/build/components/deprecated.native.js +0 -1
- package/build/components/deprecated.native.js.map +1 -1
- package/build/components/document-outline/check.js +1 -7
- package/build/components/document-outline/check.js.map +1 -1
- package/build/components/document-outline/index.js +7 -24
- package/build/components/document-outline/index.js.map +1 -1
- package/build/components/document-outline/item.js +1 -5
- package/build/components/document-outline/item.js.map +1 -1
- package/build/components/editor-help/add-blocks.native.js +1 -8
- package/build/components/editor-help/add-blocks.native.js.map +1 -1
- package/build/components/editor-help/customize-blocks.native.js +1 -8
- package/build/components/editor-help/customize-blocks.native.js.map +1 -1
- package/build/components/editor-help/help-detail-navigation-screen.native.js +5 -13
- package/build/components/editor-help/help-detail-navigation-screen.native.js.map +1 -1
- package/build/components/editor-help/help-get-support-button.native.js +1 -7
- package/build/components/editor-help/help-get-support-button.native.js.map +1 -1
- package/build/components/editor-help/help-section-title.native.js +1 -7
- package/build/components/editor-help/help-section-title.native.js.map +1 -1
- package/build/components/editor-help/help-topic-row.native.js +1 -8
- package/build/components/editor-help/help-topic-row.native.js.map +1 -1
- package/build/components/editor-help/icon-move-blocks.native.js +0 -4
- package/build/components/editor-help/icon-move-blocks.native.js.map +1 -1
- package/build/components/editor-help/index.native.js +8 -29
- package/build/components/editor-help/index.native.js.map +1 -1
- package/build/components/editor-help/intro-to-blocks.native.js +1 -9
- package/build/components/editor-help/intro-to-blocks.native.js.map +1 -1
- package/build/components/editor-help/move-blocks.native.js +1 -8
- package/build/components/editor-help/move-blocks.native.js.map +1 -1
- package/build/components/editor-help/remove-blocks.native.js +1 -8
- package/build/components/editor-help/remove-blocks.native.js.map +1 -1
- package/build/components/editor-help/view-sections.native.js +1 -12
- package/build/components/editor-help/view-sections.native.js.map +1 -1
- package/build/components/editor-history/redo.js +6 -14
- package/build/components/editor-history/redo.js.map +1 -1
- package/build/components/editor-history/undo.js +6 -14
- package/build/components/editor-history/undo.js.map +1 -1
- package/build/components/editor-notices/index.js +1 -10
- package/build/components/editor-notices/index.js.map +1 -1
- package/build/components/editor-snackbars/index.js +1 -5
- package/build/components/editor-snackbars/index.js.map +1 -1
- package/build/components/entities-saved-states/entity-record-item.js +3 -10
- package/build/components/entities-saved-states/entity-record-item.js.map +1 -1
- package/build/components/entities-saved-states/entity-type-list.js +3 -15
- package/build/components/entities-saved-states/entity-type-list.js.map +1 -1
- package/build/components/entities-saved-states/hooks/use-is-dirty.js +5 -14
- package/build/components/entities-saved-states/hooks/use-is-dirty.js.map +1 -1
- package/build/components/entities-saved-states/index.js +8 -27
- package/build/components/entities-saved-states/index.js.map +1 -1
- package/build/components/error-boundary/index.js +1 -18
- package/build/components/error-boundary/index.js.map +1 -1
- package/build/components/global-keyboard-shortcuts/index.js +5 -9
- package/build/components/global-keyboard-shortcuts/index.js.map +1 -1
- package/build/components/global-keyboard-shortcuts/register-shortcuts.js +1 -8
- package/build/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
- package/build/components/index.js +4 -76
- package/build/components/index.js.map +1 -1
- package/build/components/index.native.js +0 -9
- package/build/components/index.native.js.map +1 -1
- package/build/components/local-autosave-monitor/index.js +6 -31
- package/build/components/local-autosave-monitor/index.js.map +1 -1
- package/build/components/media-categories/index.js +30 -45
- package/build/components/media-categories/index.js.map +1 -1
- package/build/components/page-attributes/check.js +3 -7
- package/build/components/page-attributes/check.js.map +1 -1
- package/build/components/page-attributes/order.js +17 -42
- package/build/components/page-attributes/order.js.map +1 -1
- package/build/components/page-attributes/parent.js +8 -34
- package/build/components/page-attributes/parent.js.map +1 -1
- package/build/components/post-author/check.js +1 -11
- package/build/components/post-author/check.js.map +1 -1
- package/build/components/post-author/combobox.js +7 -23
- package/build/components/post-author/combobox.js.map +1 -1
- package/build/components/post-author/constants.js +0 -1
- package/build/components/post-author/constants.js.map +1 -1
- package/build/components/post-author/index.js +1 -12
- package/build/components/post-author/index.js.map +1 -1
- package/build/components/post-author/select.js +1 -12
- package/build/components/post-author/select.js.map +1 -1
- package/build/components/post-comments/index.js +1 -10
- package/build/components/post-comments/index.js.map +1 -1
- package/build/components/post-excerpt/check.js +6 -8
- package/build/components/post-excerpt/check.js.map +1 -1
- package/build/components/post-excerpt/index.js +1 -7
- package/build/components/post-excerpt/index.js.map +1 -1
- package/build/components/post-featured-image/check.js +6 -9
- package/build/components/post-featured-image/check.js.map +1 -1
- package/build/components/post-featured-image/index.js +13 -42
- package/build/components/post-featured-image/index.js.map +1 -1
- package/build/components/post-format/check.js +9 -18
- package/build/components/post-format/check.js.map +1 -1
- package/build/components/post-format/index.js +2 -20
- package/build/components/post-format/index.js.map +1 -1
- package/build/components/post-last-revision/check.js +15 -22
- package/build/components/post-last-revision/check.js.map +1 -1
- package/build/components/post-last-revision/index.js +17 -28
- package/build/components/post-last-revision/index.js.map +1 -1
- package/build/components/post-locked-modal/index.js +8 -28
- package/build/components/post-locked-modal/index.js.map +1 -1
- package/build/components/post-pending-status/check.js +16 -24
- package/build/components/post-pending-status/check.js.map +1 -1
- package/build/components/post-pending-status/index.js +10 -28
- package/build/components/post-pending-status/index.js.map +1 -1
- package/build/components/post-pingbacks/index.js +1 -10
- package/build/components/post-pingbacks/index.js.map +1 -1
- package/build/components/post-preview-button/index.js +11 -22
- package/build/components/post-preview-button/index.js.map +1 -1
- package/build/components/post-publish-button/index.js +6 -32
- package/build/components/post-publish-button/index.js.map +1 -1
- package/build/components/post-publish-button/label.js +1 -10
- package/build/components/post-publish-button/label.js.map +1 -1
- package/build/components/post-publish-panel/index.js +1 -22
- package/build/components/post-publish-panel/index.js.map +1 -1
- package/build/components/post-publish-panel/maybe-category-panel.js +4 -14
- package/build/components/post-publish-panel/maybe-category-panel.js.map +1 -1
- package/build/components/post-publish-panel/maybe-post-format-panel.js +2 -18
- package/build/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
- package/build/components/post-publish-panel/maybe-tags-panel.js +2 -17
- package/build/components/post-publish-panel/maybe-tags-panel.js.map +1 -1
- package/build/components/post-publish-panel/maybe-upload-media.js +1 -18
- package/build/components/post-publish-panel/maybe-upload-media.js.map +1 -1
- package/build/components/post-publish-panel/postpublish.js +3 -27
- package/build/components/post-publish-panel/postpublish.js.map +1 -1
- package/build/components/post-publish-panel/prepublish.js +1 -26
- package/build/components/post-publish-panel/prepublish.js.map +1 -1
- package/build/components/post-saved-state/index.js +12 -29
- package/build/components/post-saved-state/index.js.map +1 -1
- package/build/components/post-schedule/check.js +1 -8
- package/build/components/post-schedule/check.js.map +1 -1
- package/build/components/post-schedule/index.js +7 -13
- package/build/components/post-schedule/index.js.map +1 -1
- package/build/components/post-schedule/label.js +18 -29
- package/build/components/post-schedule/label.js.map +1 -1
- package/build/components/post-slug/check.js +1 -4
- package/build/components/post-slug/check.js.map +1 -1
- package/build/components/post-slug/index.js +1 -19
- package/build/components/post-slug/index.js.map +1 -1
- package/build/components/post-sticky/check.js +1 -8
- package/build/components/post-sticky/check.js.map +1 -1
- package/build/components/post-sticky/index.js +1 -12
- package/build/components/post-sticky/index.js.map +1 -1
- package/build/components/post-switch-to-draft-button/index.js +1 -14
- package/build/components/post-switch-to-draft-button/index.js.map +1 -1
- package/build/components/post-sync-status/index.js +5 -18
- package/build/components/post-sync-status/index.js.map +1 -1
- package/build/components/post-taxonomies/check.js +1 -9
- package/build/components/post-taxonomies/check.js.map +1 -1
- package/build/components/post-taxonomies/flat-term-selector.js +15 -50
- package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
- package/build/components/post-taxonomies/hierarchical-term-selector.js +27 -79
- package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
- package/build/components/post-taxonomies/index.js +3 -13
- package/build/components/post-taxonomies/index.js.map +1 -1
- package/build/components/post-taxonomies/most-used-terms.js +1 -9
- package/build/components/post-taxonomies/most-used-terms.js.map +1 -1
- package/build/components/post-template/index.js +1 -11
- package/build/components/post-template/index.js.map +1 -1
- package/build/components/post-text-editor/index.js +3 -17
- package/build/components/post-text-editor/index.js.map +1 -1
- package/build/components/post-title/index.js +14 -46
- package/build/components/post-title/index.js.map +1 -1
- package/build/components/post-title/index.native.js +7 -44
- package/build/components/post-title/index.native.js.map +1 -1
- package/build/components/post-trash/check.js +1 -7
- package/build/components/post-trash/check.js.map +1 -1
- package/build/components/post-trash/index.js +1 -8
- package/build/components/post-trash/index.js.map +1 -1
- package/build/components/post-type-support-check/index.js +0 -9
- package/build/components/post-type-support-check/index.js.map +1 -1
- package/build/components/post-url/check.js +1 -12
- package/build/components/post-url/check.js.map +1 -1
- package/build/components/post-url/index.js +3 -15
- package/build/components/post-url/index.js.map +1 -1
- package/build/components/post-url/label.js +1 -5
- package/build/components/post-url/label.js.map +1 -1
- package/build/components/post-visibility/check.js +1 -7
- package/build/components/post-visibility/check.js.map +1 -1
- package/build/components/post-visibility/index.js +1 -17
- package/build/components/post-visibility/index.js.map +1 -1
- package/build/components/post-visibility/label.js +1 -5
- package/build/components/post-visibility/label.js.map +1 -1
- package/build/components/post-visibility/utils.js +1 -2
- package/build/components/post-visibility/utils.js.map +1 -1
- package/build/components/provider/index.js +13 -27
- package/build/components/provider/index.js.map +1 -1
- package/build/components/provider/index.native.js +18 -70
- package/build/components/provider/index.native.js.map +1 -1
- package/build/components/provider/use-block-editor-settings.js +9 -20
- package/build/components/provider/use-block-editor-settings.js.map +1 -1
- package/build/components/provider/use-block-editor-settings.native.js +5 -11
- package/build/components/provider/use-block-editor-settings.native.js.map +1 -1
- package/build/components/provider/with-registry-provider.js +5 -12
- package/build/components/provider/with-registry-provider.js.map +1 -1
- package/build/components/table-of-contents/index.js +4 -14
- package/build/components/table-of-contents/index.js.map +1 -1
- package/build/components/table-of-contents/panel.js +1 -13
- package/build/components/table-of-contents/panel.js.map +1 -1
- package/build/components/template-validation-notice/index.js +3 -12
- package/build/components/template-validation-notice/index.js.map +1 -1
- package/build/components/theme-support-check/index.js +3 -12
- package/build/components/theme-support-check/index.js.map +1 -1
- package/build/components/time-to-read/index.js +2 -10
- package/build/components/time-to-read/index.js.map +1 -1
- package/build/components/unsaved-changes-warning/index.js +21 -35
- package/build/components/unsaved-changes-warning/index.js.map +1 -1
- package/build/components/word-count/index.js +2 -7
- package/build/components/word-count/index.js.map +1 -1
- package/build/hooks/custom-sources-backwards-compatibility.js +7 -18
- package/build/hooks/custom-sources-backwards-compatibility.js.map +1 -1
- package/build/hooks/default-autocompleters.js +3 -4
- package/build/hooks/default-autocompleters.js.map +1 -1
- package/build/hooks/index.js +0 -1
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/index.native.js.map +1 -1
- package/build/index.js +0 -9
- package/build/index.js.map +1 -1
- package/build/index.native.js +0 -11
- package/build/index.native.js.map +1 -1
- package/build/lock-unlock.js +1 -2
- package/build/lock-unlock.js.map +1 -1
- package/build/private-apis.js +1 -4
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +60 -129
- package/build/store/actions.js.map +1 -1
- package/build/store/actions.native.js +1 -8
- package/build/store/actions.native.js.map +1 -1
- package/build/store/constants.js +1 -2
- package/build/store/constants.js.map +1 -1
- package/build/store/defaults.js +2 -3
- package/build/store/defaults.js.map +1 -1
- package/build/store/index.js +3 -11
- package/build/store/index.js.map +1 -1
- package/build/store/local-autosave.js +0 -4
- package/build/store/local-autosave.js.map +1 -1
- package/build/store/reducer.js +19 -49
- package/build/store/reducer.js.map +1 -1
- package/build/store/reducer.native.js +3 -17
- package/build/store/reducer.native.js.map +1 -1
- package/build/store/selectors.js +169 -295
- package/build/store/selectors.js.map +1 -1
- package/build/store/selectors.native.js +4 -11
- package/build/store/selectors.native.js.map +1 -1
- package/build/store/utils/notice-builder.js +13 -24
- package/build/store/utils/notice-builder.js.map +1 -1
- package/build/utils/get-template-part-icon.js +0 -3
- package/build/utils/get-template-part-icon.js.map +1 -1
- package/build/utils/index.js +0 -4
- package/build/utils/index.js.map +1 -1
- package/build/utils/index.native.js +0 -2
- package/build/utils/index.native.js.map +1 -1
- package/build/utils/media-upload/index.js +2 -6
- package/build/utils/media-upload/index.js.map +1 -1
- package/build/utils/media-upload/index.native.js +0 -1
- package/build/utils/media-upload/index.native.js.map +1 -1
- package/build/utils/terms.js +8 -18
- package/build/utils/terms.js.map +1 -1
- package/build/utils/url.js +0 -4
- package/build/utils/url.js.map +1 -1
- package/build-module/components/autocompleters/index.js.map +1 -1
- package/build-module/components/autocompleters/user.js +2 -5
- package/build-module/components/autocompleters/user.js.map +1 -1
- package/build-module/components/autosave-monitor/index.js +2 -17
- package/build-module/components/autosave-monitor/index.js.map +1 -1
- package/build-module/components/character-count/index.js +1 -1
- package/build-module/components/character-count/index.js.map +1 -1
- package/build-module/components/deprecated.js +0 -4
- package/build-module/components/deprecated.js.map +1 -1
- package/build-module/components/deprecated.native.js +0 -1
- package/build-module/components/deprecated.native.js.map +1 -1
- package/build-module/components/document-outline/check.js +0 -4
- package/build-module/components/document-outline/check.js.map +1 -1
- package/build-module/components/document-outline/index.js +9 -13
- package/build-module/components/document-outline/index.js.map +1 -1
- package/build-module/components/document-outline/item.js +0 -3
- package/build-module/components/document-outline/item.js.map +1 -1
- package/build-module/components/editor-help/add-blocks.native.js +2 -5
- package/build-module/components/editor-help/add-blocks.native.js.map +1 -1
- package/build-module/components/editor-help/customize-blocks.native.js +2 -5
- package/build-module/components/editor-help/customize-blocks.native.js.map +1 -1
- package/build-module/components/editor-help/help-detail-navigation-screen.native.js +6 -8
- package/build-module/components/editor-help/help-detail-navigation-screen.native.js.map +1 -1
- package/build-module/components/editor-help/help-get-support-button.native.js +2 -5
- package/build-module/components/editor-help/help-get-support-button.native.js.map +1 -1
- package/build-module/components/editor-help/help-section-title.native.js +2 -5
- package/build-module/components/editor-help/help-section-title.native.js.map +1 -1
- package/build-module/components/editor-help/help-topic-row.native.js +1 -6
- package/build-module/components/editor-help/help-topic-row.native.js.map +1 -1
- package/build-module/components/editor-help/icon-move-blocks.native.js +0 -1
- package/build-module/components/editor-help/icon-move-blocks.native.js.map +1 -1
- package/build-module/components/editor-help/index.native.js +9 -9
- package/build-module/components/editor-help/index.native.js.map +1 -1
- package/build-module/components/editor-help/intro-to-blocks.native.js +2 -5
- package/build-module/components/editor-help/intro-to-blocks.native.js.map +1 -1
- package/build-module/components/editor-help/move-blocks.native.js +2 -5
- package/build-module/components/editor-help/move-blocks.native.js.map +1 -1
- package/build-module/components/editor-help/remove-blocks.native.js +2 -5
- package/build-module/components/editor-help/remove-blocks.native.js.map +1 -1
- package/build-module/components/editor-help/view-sections.native.js +2 -4
- package/build-module/components/editor-help/view-sections.native.js.map +1 -1
- package/build-module/components/editor-history/redo.js +6 -8
- package/build-module/components/editor-history/redo.js.map +1 -1
- package/build-module/components/editor-history/undo.js +6 -8
- package/build-module/components/editor-history/undo.js.map +1 -1
- package/build-module/components/editor-notices/index.js +1 -2
- package/build-module/components/editor-notices/index.js.map +1 -1
- package/build-module/components/editor-snackbars/index.js +0 -1
- package/build-module/components/editor-snackbars/index.js.map +1 -1
- package/build-module/components/entities-saved-states/entity-record-item.js +3 -4
- package/build-module/components/entities-saved-states/entity-record-item.js.map +1 -1
- package/build-module/components/entities-saved-states/entity-type-list.js +3 -10
- package/build-module/components/entities-saved-states/entity-type-list.js.map +1 -1
- package/build-module/components/entities-saved-states/hooks/use-is-dirty.js +4 -7
- package/build-module/components/entities-saved-states/hooks/use-is-dirty.js.map +1 -1
- package/build-module/components/entities-saved-states/index.js +8 -16
- package/build-module/components/entities-saved-states/index.js.map +1 -1
- package/build-module/components/error-boundary/index.js +1 -12
- package/build-module/components/error-boundary/index.js.map +1 -1
- package/build-module/components/global-keyboard-shortcuts/index.js +5 -6
- package/build-module/components/global-keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js +0 -3
- package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
- package/build-module/components/index.js +6 -3
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/index.native.js +4 -2
- package/build-module/components/index.native.js.map +1 -1
- package/build-module/components/local-autosave-monitor/index.js +6 -21
- package/build-module/components/local-autosave-monitor/index.js.map +1 -1
- package/build-module/components/media-categories/index.js +31 -41
- package/build-module/components/media-categories/index.js.map +1 -1
- package/build-module/components/page-attributes/check.js +3 -3
- package/build-module/components/page-attributes/check.js.map +1 -1
- package/build-module/components/page-attributes/order.js +17 -31
- package/build-module/components/page-attributes/order.js.map +1 -1
- package/build-module/components/page-attributes/parent.js +9 -23
- package/build-module/components/page-attributes/parent.js.map +1 -1
- package/build-module/components/post-author/check.js +1 -5
- package/build-module/components/post-author/check.js.map +1 -1
- package/build-module/components/post-author/combobox.js +7 -16
- package/build-module/components/post-author/combobox.js.map +1 -1
- package/build-module/components/post-author/constants.js +0 -1
- package/build-module/components/post-author/constants.js.map +1 -1
- package/build-module/components/post-author/index.js +1 -6
- package/build-module/components/post-author/index.js.map +1 -1
- package/build-module/components/post-author/select.js +1 -6
- package/build-module/components/post-author/select.js.map +1 -1
- package/build-module/components/post-comments/index.js +1 -7
- package/build-module/components/post-comments/index.js.map +1 -1
- package/build-module/components/post-excerpt/check.js +5 -6
- package/build-module/components/post-excerpt/check.js.map +1 -1
- package/build-module/components/post-excerpt/index.js +1 -4
- package/build-module/components/post-excerpt/index.js.map +1 -1
- package/build-module/components/post-featured-image/check.js +5 -6
- package/build-module/components/post-featured-image/check.js.map +1 -1
- package/build-module/components/post-featured-image/index.js +13 -31
- package/build-module/components/post-featured-image/index.js.map +1 -1
- package/build-module/components/post-format/check.js +10 -15
- package/build-module/components/post-format/check.js.map +1 -1
- package/build-module/components/post-format/index.js +4 -12
- package/build-module/components/post-format/index.js.map +1 -1
- package/build-module/components/post-last-revision/check.js +17 -17
- package/build-module/components/post-last-revision/check.js.map +1 -1
- package/build-module/components/post-last-revision/index.js +18 -21
- package/build-module/components/post-last-revision/index.js.map +1 -1
- package/build-module/components/post-locked-modal/index.js +8 -22
- package/build-module/components/post-locked-modal/index.js.map +1 -1
- package/build-module/components/post-pending-status/check.js +17 -20
- package/build-module/components/post-pending-status/check.js.map +1 -1
- package/build-module/components/post-pending-status/index.js +11 -20
- package/build-module/components/post-pending-status/index.js.map +1 -1
- package/build-module/components/post-pingbacks/index.js +1 -7
- package/build-module/components/post-pingbacks/index.js.map +1 -1
- package/build-module/components/post-preview-button/index.js +11 -17
- package/build-module/components/post-preview-button/index.js.map +1 -1
- package/build-module/components/post-publish-button/index.js +7 -23
- package/build-module/components/post-publish-button/index.js.map +1 -1
- package/build-module/components/post-publish-button/label.js +1 -4
- package/build-module/components/post-publish-button/label.js.map +1 -1
- package/build-module/components/post-publish-panel/index.js +1 -8
- package/build-module/components/post-publish-panel/index.js.map +1 -1
- package/build-module/components/post-publish-panel/maybe-category-panel.js +4 -8
- package/build-module/components/post-publish-panel/maybe-category-panel.js.map +1 -1
- package/build-module/components/post-publish-panel/maybe-post-format-panel.js +2 -12
- package/build-module/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
- package/build-module/components/post-publish-panel/maybe-tags-panel.js +2 -9
- package/build-module/components/post-publish-panel/maybe-tags-panel.js.map +1 -1
- package/build-module/components/post-publish-panel/maybe-upload-media.js +1 -12
- package/build-module/components/post-publish-panel/maybe-upload-media.js.map +1 -1
- package/build-module/components/post-publish-panel/postpublish.js +3 -16
- package/build-module/components/post-publish-panel/postpublish.js.map +1 -1
- package/build-module/components/post-publish-panel/prepublish.js +1 -10
- package/build-module/components/post-publish-panel/prepublish.js.map +1 -1
- package/build-module/components/post-saved-state/index.js +15 -23
- package/build-module/components/post-saved-state/index.js.map +1 -1
- package/build-module/components/post-schedule/check.js +1 -3
- package/build-module/components/post-schedule/check.js.map +1 -1
- package/build-module/components/post-schedule/index.js +8 -8
- package/build-module/components/post-schedule/index.js.map +1 -1
- package/build-module/components/post-schedule/label.js +18 -22
- package/build-module/components/post-schedule/label.js.map +1 -1
- package/build-module/components/post-slug/check.js +0 -1
- package/build-module/components/post-slug/check.js.map +1 -1
- package/build-module/components/post-slug/index.js +1 -8
- package/build-module/components/post-slug/index.js.map +1 -1
- package/build-module/components/post-sticky/check.js +1 -3
- package/build-module/components/post-sticky/check.js.map +1 -1
- package/build-module/components/post-sticky/index.js +1 -3
- package/build-module/components/post-sticky/index.js.map +1 -1
- package/build-module/components/post-switch-to-draft-button/index.js +1 -9
- package/build-module/components/post-switch-to-draft-button/index.js.map +1 -1
- package/build-module/components/post-sync-status/index.js +5 -11
- package/build-module/components/post-sync-status/index.js.map +1 -1
- package/build-module/components/post-taxonomies/check.js +1 -3
- package/build-module/components/post-taxonomies/check.js.map +1 -1
- package/build-module/components/post-taxonomies/flat-term-selector.js +17 -39
- package/build-module/components/post-taxonomies/flat-term-selector.js.map +1 -1
- package/build-module/components/post-taxonomies/hierarchical-term-selector.js +29 -66
- package/build-module/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
- package/build-module/components/post-taxonomies/index.js +3 -5
- package/build-module/components/post-taxonomies/index.js.map +1 -1
- package/build-module/components/post-taxonomies/most-used-terms.js +1 -4
- package/build-module/components/post-taxonomies/most-used-terms.js.map +1 -1
- package/build-module/components/post-template/index.js +1 -5
- package/build-module/components/post-template/index.js.map +1 -1
- package/build-module/components/post-text-editor/index.js +4 -9
- package/build-module/components/post-text-editor/index.js.map +1 -1
- package/build-module/components/post-title/index.js +17 -35
- package/build-module/components/post-title/index.js.map +1 -1
- package/build-module/components/post-title/index.native.js +8 -33
- package/build-module/components/post-title/index.native.js.map +1 -1
- package/build-module/components/post-trash/check.js +1 -4
- package/build-module/components/post-trash/check.js.map +1 -1
- package/build-module/components/post-trash/index.js +1 -4
- package/build-module/components/post-trash/index.js.map +1 -1
- package/build-module/components/post-type-support-check/index.js +3 -6
- package/build-module/components/post-type-support-check/index.js.map +1 -1
- package/build-module/components/post-url/check.js +1 -9
- package/build-module/components/post-url/check.js.map +1 -1
- package/build-module/components/post-url/index.js +3 -8
- package/build-module/components/post-url/index.js.map +1 -1
- package/build-module/components/post-url/label.js +1 -1
- package/build-module/components/post-url/label.js.map +1 -1
- package/build-module/components/post-visibility/check.js +1 -2
- package/build-module/components/post-visibility/check.js.map +1 -1
- package/build-module/components/post-visibility/index.js +1 -10
- package/build-module/components/post-visibility/index.js.map +1 -1
- package/build-module/components/post-visibility/label.js +1 -1
- package/build-module/components/post-visibility/label.js.map +1 -1
- package/build-module/components/post-visibility/utils.js.map +1 -1
- package/build-module/components/provider/index.js +13 -14
- package/build-module/components/provider/index.js.map +1 -1
- package/build-module/components/provider/index.native.js +21 -52
- package/build-module/components/provider/index.native.js.map +1 -1
- package/build-module/components/provider/use-block-editor-settings.js +9 -12
- package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
- package/build-module/components/provider/use-block-editor-settings.native.js +5 -5
- package/build-module/components/provider/use-block-editor-settings.native.js.map +1 -1
- package/build-module/components/provider/with-registry-provider.js +5 -8
- package/build-module/components/provider/with-registry-provider.js.map +1 -1
- package/build-module/components/table-of-contents/index.js +4 -7
- package/build-module/components/table-of-contents/index.js.map +1 -1
- package/build-module/components/table-of-contents/panel.js +1 -5
- package/build-module/components/table-of-contents/panel.js.map +1 -1
- package/build-module/components/template-validation-notice/index.js +2 -6
- package/build-module/components/template-validation-notice/index.js.map +1 -1
- package/build-module/components/theme-support-check/index.js +3 -7
- package/build-module/components/theme-support-check/index.js.map +1 -1
- package/build-module/components/time-to-read/index.js +4 -7
- package/build-module/components/time-to-read/index.js.map +1 -1
- package/build-module/components/unsaved-changes-warning/index.js +22 -31
- package/build-module/components/unsaved-changes-warning/index.js.map +1 -1
- package/build-module/components/word-count/index.js +2 -4
- package/build-module/components/word-count/index.js.map +1 -1
- package/build-module/hooks/custom-sources-backwards-compatibility.js +9 -15
- package/build-module/hooks/custom-sources-backwards-compatibility.js.map +1 -1
- package/build-module/hooks/default-autocompleters.js +3 -4
- package/build-module/hooks/default-autocompleters.js.map +1 -1
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/index.native.js.map +1 -1
- package/build-module/index.js +1 -1
- package/build-module/index.js.map +1 -1
- package/build-module/index.native.js +1 -1
- package/build-module/index.native.js.map +1 -1
- package/build-module/lock-unlock.js.map +1 -1
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/actions.js +62 -84
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/actions.native.js +2 -2
- package/build-module/store/actions.native.js.map +1 -1
- package/build-module/store/constants.js +1 -1
- package/build-module/store/constants.js.map +1 -1
- package/build-module/store/defaults.js +3 -2
- package/build-module/store/defaults.js.map +1 -1
- package/build-module/store/index.js +5 -4
- package/build-module/store/index.js.map +1 -1
- package/build-module/store/local-autosave.js +0 -1
- package/build-module/store/local-autosave.js.map +1 -1
- package/build-module/store/reducer.js +21 -33
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/reducer.native.js +4 -10
- package/build-module/store/reducer.native.js.map +1 -1
- package/build-module/store/selectors.js +172 -222
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/store/selectors.native.js +6 -8
- package/build-module/store/selectors.native.js.map +1 -1
- package/build-module/store/utils/notice-builder.js +15 -21
- package/build-module/store/utils/notice-builder.js.map +1 -1
- package/build-module/utils/get-template-part-icon.js +0 -2
- package/build-module/utils/get-template-part-icon.js.map +1 -1
- package/build-module/utils/index.js.map +1 -1
- package/build-module/utils/index.native.js.map +1 -1
- package/build-module/utils/media-upload/index.js +2 -4
- package/build-module/utils/media-upload/index.js.map +1 -1
- package/build-module/utils/media-upload/index.native.js.map +1 -1
- package/build-module/utils/terms.js +9 -11
- package/build-module/utils/terms.js.map +1 -1
- package/build-module/utils/url.js +1 -1
- package/build-module/utils/url.js.map +1 -1
- package/build-style/style-rtl.css +10 -17
- package/build-style/style.css +10 -17
- package/package.json +32 -31
- package/src/components/editor-help/index.native.js +1 -1
- package/src/components/editor-help/style.scss +5 -0
- package/src/components/page-attributes/order.js +15 -23
- package/src/components/page-attributes/test/order.js +46 -15
- package/src/components/post-excerpt/check.js +6 -2
- package/src/components/post-featured-image/check.js +4 -2
- package/src/components/post-format/check.js +16 -11
- package/src/components/post-last-revision/check.js +12 -14
- package/src/components/post-last-revision/index.js +12 -10
- package/src/components/post-last-revision/test/check.js +28 -16
- package/src/components/post-pending-status/check.js +13 -19
- package/src/components/post-pending-status/index.js +9 -14
- package/src/components/post-pending-status/test/check.js +32 -10
- package/src/components/post-publish-panel/style.scss +12 -25
- package/src/components/post-sync-status/style.scss +4 -1
- package/src/components/post-type-support-check/index.js +1 -1
- package/src/components/post-type-support-check/test/index.js +1 -1
- package/src/components/provider/index.js +3 -2
- package/src/components/unsaved-changes-warning/index.js +22 -27
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
4
|
import createSelector from 'rememo';
|
|
5
|
+
|
|
5
6
|
/**
|
|
6
7
|
* WordPress dependencies
|
|
7
8
|
*/
|
|
8
|
-
|
|
9
9
|
import { getFreeformContentHandlerName, getDefaultBlockName, __unstableSerializeAndClean, parse } from '@wordpress/blocks';
|
|
10
10
|
import { isInTheFuture, getDate } from '@wordpress/date';
|
|
11
11
|
import { addQueryArgs, cleanForSlug } from '@wordpress/url';
|
|
@@ -16,13 +16,14 @@ import { layout } from '@wordpress/icons';
|
|
|
16
16
|
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
17
17
|
import { store as coreStore } from '@wordpress/core-data';
|
|
18
18
|
import { store as preferencesStore } from '@wordpress/preferences';
|
|
19
|
+
|
|
19
20
|
/**
|
|
20
21
|
* Internal dependencies
|
|
21
22
|
*/
|
|
22
|
-
|
|
23
23
|
import { EDIT_MERGE_PROPERTIES, PERMALINK_POSTNAME_REGEX, ONE_MINUTE_IN_MS, AUTOSAVE_PROPERTIES } from './constants';
|
|
24
24
|
import { getPostRawValue } from './reducer';
|
|
25
25
|
import { getTemplatePartIcon } from '../utils/get-template-part-icon';
|
|
26
|
+
|
|
26
27
|
/**
|
|
27
28
|
* Shared reference to an empty object for cases where it is important to avoid
|
|
28
29
|
* returning a new object reference on every invocation, as in a connected or
|
|
@@ -30,8 +31,8 @@ import { getTemplatePartIcon } from '../utils/get-template-part-icon';
|
|
|
30
31
|
* This should be used as a last resort, since the normalized data should be
|
|
31
32
|
* maintained by the reducer result in state.
|
|
32
33
|
*/
|
|
33
|
-
|
|
34
34
|
const EMPTY_OBJECT = {};
|
|
35
|
+
|
|
35
36
|
/**
|
|
36
37
|
* Returns true if any past editor history snapshots exist, or false otherwise.
|
|
37
38
|
*
|
|
@@ -39,10 +40,10 @@ const EMPTY_OBJECT = {};
|
|
|
39
40
|
*
|
|
40
41
|
* @return {boolean} Whether undo history exists.
|
|
41
42
|
*/
|
|
42
|
-
|
|
43
43
|
export const hasEditorUndo = createRegistrySelector(select => () => {
|
|
44
44
|
return select(coreStore).hasUndo();
|
|
45
45
|
});
|
|
46
|
+
|
|
46
47
|
/**
|
|
47
48
|
* Returns true if any future editor history snapshots exist, or false
|
|
48
49
|
* otherwise.
|
|
@@ -51,10 +52,10 @@ export const hasEditorUndo = createRegistrySelector(select => () => {
|
|
|
51
52
|
*
|
|
52
53
|
* @return {boolean} Whether redo history exists.
|
|
53
54
|
*/
|
|
54
|
-
|
|
55
55
|
export const hasEditorRedo = createRegistrySelector(select => () => {
|
|
56
56
|
return select(coreStore).hasRedo();
|
|
57
57
|
});
|
|
58
|
+
|
|
58
59
|
/**
|
|
59
60
|
* Returns true if the currently edited post is yet to be saved, or false if
|
|
60
61
|
* the post has been saved.
|
|
@@ -63,10 +64,10 @@ export const hasEditorRedo = createRegistrySelector(select => () => {
|
|
|
63
64
|
*
|
|
64
65
|
* @return {boolean} Whether the post is new.
|
|
65
66
|
*/
|
|
66
|
-
|
|
67
67
|
export function isEditedPostNew(state) {
|
|
68
68
|
return getCurrentPost(state).status === 'auto-draft';
|
|
69
69
|
}
|
|
70
|
+
|
|
70
71
|
/**
|
|
71
72
|
* Returns true if content includes unsaved changes, or false otherwise.
|
|
72
73
|
*
|
|
@@ -74,11 +75,11 @@ export function isEditedPostNew(state) {
|
|
|
74
75
|
*
|
|
75
76
|
* @return {boolean} Whether content includes unsaved changes.
|
|
76
77
|
*/
|
|
77
|
-
|
|
78
78
|
export function hasChangedContent(state) {
|
|
79
79
|
const edits = getPostEdits(state);
|
|
80
80
|
return 'content' in edits;
|
|
81
81
|
}
|
|
82
|
+
|
|
82
83
|
/**
|
|
83
84
|
* Returns true if there are unsaved values for the current edit session, or
|
|
84
85
|
* false if the editing state matches the saved or new post.
|
|
@@ -87,20 +88,18 @@ export function hasChangedContent(state) {
|
|
|
87
88
|
*
|
|
88
89
|
* @return {boolean} Whether unsaved values exist.
|
|
89
90
|
*/
|
|
90
|
-
|
|
91
91
|
export const isEditedPostDirty = createRegistrySelector(select => state => {
|
|
92
92
|
// Edits should contain only fields which differ from the saved post (reset
|
|
93
93
|
// at initial load and save complete). Thus, a non-empty edits state can be
|
|
94
94
|
// inferred to contain unsaved values.
|
|
95
95
|
const postType = getCurrentPostType(state);
|
|
96
96
|
const postId = getCurrentPostId(state);
|
|
97
|
-
|
|
98
97
|
if (select(coreStore).hasEditsForEntityRecord('postType', postType, postId)) {
|
|
99
98
|
return true;
|
|
100
99
|
}
|
|
101
|
-
|
|
102
100
|
return false;
|
|
103
101
|
});
|
|
102
|
+
|
|
104
103
|
/**
|
|
105
104
|
* Returns true if there are unsaved edits for entities other than
|
|
106
105
|
* the editor's post, and false otherwise.
|
|
@@ -109,16 +108,15 @@ export const isEditedPostDirty = createRegistrySelector(select => state => {
|
|
|
109
108
|
*
|
|
110
109
|
* @return {boolean} Whether there are edits or not.
|
|
111
110
|
*/
|
|
112
|
-
|
|
113
111
|
export const hasNonPostEntityChanges = createRegistrySelector(select => state => {
|
|
114
112
|
const dirtyEntityRecords = select(coreStore).__experimentalGetDirtyEntityRecords();
|
|
115
|
-
|
|
116
113
|
const {
|
|
117
114
|
type,
|
|
118
115
|
id
|
|
119
116
|
} = getCurrentPost(state);
|
|
120
117
|
return dirtyEntityRecords.some(entityRecord => entityRecord.kind !== 'postType' || entityRecord.name !== type || entityRecord.key !== id);
|
|
121
118
|
});
|
|
119
|
+
|
|
122
120
|
/**
|
|
123
121
|
* Returns true if there are no unsaved values for the current edit session and
|
|
124
122
|
* if the currently edited post is new (has never been saved before).
|
|
@@ -127,10 +125,10 @@ export const hasNonPostEntityChanges = createRegistrySelector(select => state =>
|
|
|
127
125
|
*
|
|
128
126
|
* @return {boolean} Whether new post and unsaved values exist.
|
|
129
127
|
*/
|
|
130
|
-
|
|
131
128
|
export function isCleanNewPost(state) {
|
|
132
129
|
return !isEditedPostDirty(state) && isEditedPostNew(state);
|
|
133
130
|
}
|
|
131
|
+
|
|
134
132
|
/**
|
|
135
133
|
* Returns the post currently being edited in its last known saved state, not
|
|
136
134
|
* including unsaved edits. Returns an object containing relevant default post
|
|
@@ -140,21 +138,20 @@ export function isCleanNewPost(state) {
|
|
|
140
138
|
*
|
|
141
139
|
* @return {Object} Post object.
|
|
142
140
|
*/
|
|
143
|
-
|
|
144
141
|
export const getCurrentPost = createRegistrySelector(select => state => {
|
|
145
142
|
const postId = getCurrentPostId(state);
|
|
146
143
|
const postType = getCurrentPostType(state);
|
|
147
144
|
const post = select(coreStore).getRawEntityRecord('postType', postType, postId);
|
|
148
|
-
|
|
149
145
|
if (post) {
|
|
150
146
|
return post;
|
|
151
|
-
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// This exists for compatibility with the previous selector behavior
|
|
152
150
|
// which would guarantee an object return based on the editor reducer's
|
|
153
151
|
// default empty object state.
|
|
154
|
-
|
|
155
|
-
|
|
156
152
|
return EMPTY_OBJECT;
|
|
157
153
|
});
|
|
154
|
+
|
|
158
155
|
/**
|
|
159
156
|
* Returns the post type of the post currently being edited.
|
|
160
157
|
*
|
|
@@ -162,10 +159,10 @@ export const getCurrentPost = createRegistrySelector(select => state => {
|
|
|
162
159
|
*
|
|
163
160
|
* @return {string} Post type.
|
|
164
161
|
*/
|
|
165
|
-
|
|
166
162
|
export function getCurrentPostType(state) {
|
|
167
163
|
return state.postType;
|
|
168
164
|
}
|
|
165
|
+
|
|
169
166
|
/**
|
|
170
167
|
* Returns the ID of the post currently being edited, or null if the post has
|
|
171
168
|
* not yet been saved.
|
|
@@ -174,10 +171,10 @@ export function getCurrentPostType(state) {
|
|
|
174
171
|
*
|
|
175
172
|
* @return {?number} ID of current post.
|
|
176
173
|
*/
|
|
177
|
-
|
|
178
174
|
export function getCurrentPostId(state) {
|
|
179
175
|
return state.postId;
|
|
180
176
|
}
|
|
177
|
+
|
|
181
178
|
/**
|
|
182
179
|
* Returns the number of revisions of the post currently being edited.
|
|
183
180
|
*
|
|
@@ -185,12 +182,11 @@ export function getCurrentPostId(state) {
|
|
|
185
182
|
*
|
|
186
183
|
* @return {number} Number of revisions.
|
|
187
184
|
*/
|
|
188
|
-
|
|
189
185
|
export function getCurrentPostRevisionsCount(state) {
|
|
190
186
|
var _getCurrentPost$_link;
|
|
191
|
-
|
|
192
187
|
return (_getCurrentPost$_link = getCurrentPost(state)._links?.['version-history']?.[0]?.count) !== null && _getCurrentPost$_link !== void 0 ? _getCurrentPost$_link : 0;
|
|
193
188
|
}
|
|
189
|
+
|
|
194
190
|
/**
|
|
195
191
|
* Returns the last revision ID of the post currently being edited,
|
|
196
192
|
* or null if the post has no revisions.
|
|
@@ -199,12 +195,11 @@ export function getCurrentPostRevisionsCount(state) {
|
|
|
199
195
|
*
|
|
200
196
|
* @return {?number} ID of the last revision.
|
|
201
197
|
*/
|
|
202
|
-
|
|
203
198
|
export function getCurrentPostLastRevisionId(state) {
|
|
204
199
|
var _getCurrentPost$_link2;
|
|
205
|
-
|
|
206
200
|
return (_getCurrentPost$_link2 = getCurrentPost(state)._links?.['predecessor-version']?.[0]?.id) !== null && _getCurrentPost$_link2 !== void 0 ? _getCurrentPost$_link2 : null;
|
|
207
201
|
}
|
|
202
|
+
|
|
208
203
|
/**
|
|
209
204
|
* Returns any post values which have been changed in the editor but not yet
|
|
210
205
|
* been saved.
|
|
@@ -213,12 +208,12 @@ export function getCurrentPostLastRevisionId(state) {
|
|
|
213
208
|
*
|
|
214
209
|
* @return {Object} Object of key value pairs comprising unsaved edits.
|
|
215
210
|
*/
|
|
216
|
-
|
|
217
211
|
export const getPostEdits = createRegistrySelector(select => state => {
|
|
218
212
|
const postType = getCurrentPostType(state);
|
|
219
213
|
const postId = getCurrentPostId(state);
|
|
220
214
|
return select(coreStore).getEntityRecordEdits('postType', postType, postId) || EMPTY_OBJECT;
|
|
221
215
|
});
|
|
216
|
+
|
|
222
217
|
/**
|
|
223
218
|
* Returns an attribute value of the saved post.
|
|
224
219
|
*
|
|
@@ -227,25 +222,21 @@ export const getPostEdits = createRegistrySelector(select => state => {
|
|
|
227
222
|
*
|
|
228
223
|
* @return {*} Post attribute value.
|
|
229
224
|
*/
|
|
230
|
-
|
|
231
225
|
export function getCurrentPostAttribute(state, attributeName) {
|
|
232
226
|
switch (attributeName) {
|
|
233
227
|
case 'type':
|
|
234
228
|
return getCurrentPostType(state);
|
|
235
|
-
|
|
236
229
|
case 'id':
|
|
237
230
|
return getCurrentPostId(state);
|
|
238
|
-
|
|
239
231
|
default:
|
|
240
232
|
const post = getCurrentPost(state);
|
|
241
|
-
|
|
242
233
|
if (!post.hasOwnProperty(attributeName)) {
|
|
243
234
|
break;
|
|
244
235
|
}
|
|
245
|
-
|
|
246
236
|
return getPostRawValue(post[attributeName]);
|
|
247
237
|
}
|
|
248
238
|
}
|
|
239
|
+
|
|
249
240
|
/**
|
|
250
241
|
* Returns a single attribute of the post being edited, preferring the unsaved
|
|
251
242
|
* edit if one exists, but merging with the attribute value for the last known
|
|
@@ -256,18 +247,17 @@ export function getCurrentPostAttribute(state, attributeName) {
|
|
|
256
247
|
*
|
|
257
248
|
* @return {*} Post attribute value.
|
|
258
249
|
*/
|
|
259
|
-
|
|
260
250
|
const getNestedEditedPostProperty = (state, attributeName) => {
|
|
261
251
|
const edits = getPostEdits(state);
|
|
262
|
-
|
|
263
252
|
if (!edits.hasOwnProperty(attributeName)) {
|
|
264
253
|
return getCurrentPostAttribute(state, attributeName);
|
|
265
254
|
}
|
|
266
|
-
|
|
267
|
-
|
|
255
|
+
return {
|
|
256
|
+
...getCurrentPostAttribute(state, attributeName),
|
|
268
257
|
...edits[attributeName]
|
|
269
258
|
};
|
|
270
259
|
};
|
|
260
|
+
|
|
271
261
|
/**
|
|
272
262
|
* Returns a single attribute of the post being edited, preferring the unsaved
|
|
273
263
|
* edit if one exists, but falling back to the attribute for the last known
|
|
@@ -278,30 +268,27 @@ const getNestedEditedPostProperty = (state, attributeName) => {
|
|
|
278
268
|
*
|
|
279
269
|
* @return {*} Post attribute value.
|
|
280
270
|
*/
|
|
281
|
-
|
|
282
|
-
|
|
283
271
|
export function getEditedPostAttribute(state, attributeName) {
|
|
284
272
|
// Special cases.
|
|
285
273
|
switch (attributeName) {
|
|
286
274
|
case 'content':
|
|
287
275
|
return getEditedPostContent(state);
|
|
288
|
-
}
|
|
289
|
-
|
|
276
|
+
}
|
|
290
277
|
|
|
278
|
+
// Fall back to saved post value if not edited.
|
|
291
279
|
const edits = getPostEdits(state);
|
|
292
|
-
|
|
293
280
|
if (!edits.hasOwnProperty(attributeName)) {
|
|
294
281
|
return getCurrentPostAttribute(state, attributeName);
|
|
295
|
-
}
|
|
296
|
-
// and thus must be merged with the current post attribute.
|
|
297
|
-
|
|
282
|
+
}
|
|
298
283
|
|
|
284
|
+
// Merge properties are objects which contain only the patch edit in state,
|
|
285
|
+
// and thus must be merged with the current post attribute.
|
|
299
286
|
if (EDIT_MERGE_PROPERTIES.has(attributeName)) {
|
|
300
287
|
return getNestedEditedPostProperty(state, attributeName);
|
|
301
288
|
}
|
|
302
|
-
|
|
303
289
|
return edits[attributeName];
|
|
304
290
|
}
|
|
291
|
+
|
|
305
292
|
/**
|
|
306
293
|
* Returns an attribute value of the current autosave revision for a post, or
|
|
307
294
|
* null if there is no autosave for the post.
|
|
@@ -315,21 +302,19 @@ export function getEditedPostAttribute(state, attributeName) {
|
|
|
315
302
|
*
|
|
316
303
|
* @return {*} Autosave attribute value.
|
|
317
304
|
*/
|
|
318
|
-
|
|
319
305
|
export const getAutosaveAttribute = createRegistrySelector(select => (state, attributeName) => {
|
|
320
306
|
if (!AUTOSAVE_PROPERTIES.includes(attributeName) && attributeName !== 'preview_link') {
|
|
321
307
|
return;
|
|
322
308
|
}
|
|
323
|
-
|
|
324
309
|
const postType = getCurrentPostType(state);
|
|
325
310
|
const postId = getCurrentPostId(state);
|
|
326
311
|
const currentUserId = select(coreStore).getCurrentUser()?.id;
|
|
327
312
|
const autosave = select(coreStore).getAutosave(postType, postId, currentUserId);
|
|
328
|
-
|
|
329
313
|
if (autosave) {
|
|
330
314
|
return getPostRawValue(autosave[attributeName]);
|
|
331
315
|
}
|
|
332
316
|
});
|
|
317
|
+
|
|
333
318
|
/**
|
|
334
319
|
* Returns the current visibility of the post being edited, preferring the
|
|
335
320
|
* unsaved value if different than the saved post. The return value is one of
|
|
@@ -339,22 +324,18 @@ export const getAutosaveAttribute = createRegistrySelector(select => (state, att
|
|
|
339
324
|
*
|
|
340
325
|
* @return {string} Post visibility.
|
|
341
326
|
*/
|
|
342
|
-
|
|
343
327
|
export function getEditedPostVisibility(state) {
|
|
344
328
|
const status = getEditedPostAttribute(state, 'status');
|
|
345
|
-
|
|
346
329
|
if (status === 'private') {
|
|
347
330
|
return 'private';
|
|
348
331
|
}
|
|
349
|
-
|
|
350
332
|
const password = getEditedPostAttribute(state, 'password');
|
|
351
|
-
|
|
352
333
|
if (password) {
|
|
353
334
|
return 'password';
|
|
354
335
|
}
|
|
355
|
-
|
|
356
336
|
return 'public';
|
|
357
337
|
}
|
|
338
|
+
|
|
358
339
|
/**
|
|
359
340
|
* Returns true if post is pending review.
|
|
360
341
|
*
|
|
@@ -362,10 +343,10 @@ export function getEditedPostVisibility(state) {
|
|
|
362
343
|
*
|
|
363
344
|
* @return {boolean} Whether current post is pending review.
|
|
364
345
|
*/
|
|
365
|
-
|
|
366
346
|
export function isCurrentPostPending(state) {
|
|
367
347
|
return getCurrentPost(state).status === 'pending';
|
|
368
348
|
}
|
|
349
|
+
|
|
369
350
|
/**
|
|
370
351
|
* Return true if the current post has already been published.
|
|
371
352
|
*
|
|
@@ -374,11 +355,11 @@ export function isCurrentPostPending(state) {
|
|
|
374
355
|
*
|
|
375
356
|
* @return {boolean} Whether the post has been published.
|
|
376
357
|
*/
|
|
377
|
-
|
|
378
358
|
export function isCurrentPostPublished(state, currentPost) {
|
|
379
359
|
const post = currentPost || getCurrentPost(state);
|
|
380
360
|
return ['publish', 'private'].indexOf(post.status) !== -1 || post.status === 'future' && !isInTheFuture(new Date(Number(getDate(post.date)) - ONE_MINUTE_IN_MS));
|
|
381
361
|
}
|
|
362
|
+
|
|
382
363
|
/**
|
|
383
364
|
* Returns true if post is already scheduled.
|
|
384
365
|
*
|
|
@@ -386,10 +367,10 @@ export function isCurrentPostPublished(state, currentPost) {
|
|
|
386
367
|
*
|
|
387
368
|
* @return {boolean} Whether current post is scheduled to be posted.
|
|
388
369
|
*/
|
|
389
|
-
|
|
390
370
|
export function isCurrentPostScheduled(state) {
|
|
391
371
|
return getCurrentPost(state).status === 'future' && !isCurrentPostPublished(state);
|
|
392
372
|
}
|
|
373
|
+
|
|
393
374
|
/**
|
|
394
375
|
* Return true if the post being edited can be published.
|
|
395
376
|
*
|
|
@@ -397,15 +378,17 @@ export function isCurrentPostScheduled(state) {
|
|
|
397
378
|
*
|
|
398
379
|
* @return {boolean} Whether the post can been published.
|
|
399
380
|
*/
|
|
400
|
-
|
|
401
381
|
export function isEditedPostPublishable(state) {
|
|
402
|
-
const post = getCurrentPost(state);
|
|
382
|
+
const post = getCurrentPost(state);
|
|
383
|
+
|
|
384
|
+
// TODO: Post being publishable should be superset of condition of post
|
|
403
385
|
// being saveable. Currently this restriction is imposed at UI.
|
|
404
386
|
//
|
|
405
387
|
// See: <PostPublishButton /> (`isButtonEnabled` assigned by `isSaveable`).
|
|
406
388
|
|
|
407
389
|
return isEditedPostDirty(state) || ['publish', 'private', 'future'].indexOf(post.status) === -1;
|
|
408
390
|
}
|
|
391
|
+
|
|
409
392
|
/**
|
|
410
393
|
* Returns true if the post can be saved, or false otherwise. A post must
|
|
411
394
|
* contain a title, an excerpt, or non-empty content to be valid for save.
|
|
@@ -414,11 +397,12 @@ export function isEditedPostPublishable(state) {
|
|
|
414
397
|
*
|
|
415
398
|
* @return {boolean} Whether the post can be saved.
|
|
416
399
|
*/
|
|
417
|
-
|
|
418
400
|
export function isEditedPostSaveable(state) {
|
|
419
401
|
if (isSavingPost(state)) {
|
|
420
402
|
return false;
|
|
421
|
-
}
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
// TODO: Post should not be saveable if not dirty. Cannot be added here at
|
|
422
406
|
// this time since posts where meta boxes are present can be saved even if
|
|
423
407
|
// the post is not dirty. Currently this restriction is imposed at UI, but
|
|
424
408
|
// should be moved here.
|
|
@@ -428,9 +412,9 @@ export function isEditedPostSaveable(state) {
|
|
|
428
412
|
// See: <PostPublishButton /> (`forceIsDirty` prop)
|
|
429
413
|
// See: https://github.com/WordPress/gutenberg/pull/4184.
|
|
430
414
|
|
|
431
|
-
|
|
432
415
|
return !!getEditedPostAttribute(state, 'title') || !!getEditedPostAttribute(state, 'excerpt') || !isEditedPostEmpty(state) || Platform.OS === 'native';
|
|
433
416
|
}
|
|
417
|
+
|
|
434
418
|
/**
|
|
435
419
|
* Returns true if the edited post has content. A post has content if it has at
|
|
436
420
|
* least one saveable block or otherwise has a non-empty content property
|
|
@@ -440,7 +424,6 @@ export function isEditedPostSaveable(state) {
|
|
|
440
424
|
*
|
|
441
425
|
* @return {boolean} Whether post has content.
|
|
442
426
|
*/
|
|
443
|
-
|
|
444
427
|
export const isEditedPostEmpty = createRegistrySelector(select => state => {
|
|
445
428
|
// While the condition of truthy content string is sufficient to determine
|
|
446
429
|
// emptiness, testing saveable blocks length is a trivial operation. Since
|
|
@@ -451,23 +434,22 @@ export const isEditedPostEmpty = createRegistrySelector(select => state => {
|
|
|
451
434
|
const postId = getCurrentPostId(state);
|
|
452
435
|
const postType = getCurrentPostType(state);
|
|
453
436
|
const record = select(coreStore).getEditedEntityRecord('postType', postType, postId);
|
|
454
|
-
|
|
455
437
|
if (typeof record.content !== 'function') {
|
|
456
438
|
return !record.content;
|
|
457
439
|
}
|
|
458
|
-
|
|
459
440
|
const blocks = getEditedPostAttribute(state, 'blocks');
|
|
460
|
-
|
|
461
441
|
if (blocks.length === 0) {
|
|
462
442
|
return true;
|
|
463
|
-
}
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
// Pierce the abstraction of the serializer in knowing that blocks are
|
|
464
446
|
// joined with newlines such that even if every individual block
|
|
465
447
|
// produces an empty save result, the serialized content is non-empty.
|
|
466
|
-
|
|
467
|
-
|
|
468
448
|
if (blocks.length > 1) {
|
|
469
449
|
return false;
|
|
470
|
-
}
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
// There are two conditions under which the optimization cannot be
|
|
471
453
|
// assumed, and a fallthrough to getEditedPostContent must occur:
|
|
472
454
|
//
|
|
473
455
|
// 1. getBlocksForSerialization has special treatment in omitting a
|
|
@@ -478,16 +460,13 @@ export const isEditedPostEmpty = createRegistrySelector(select => state => {
|
|
|
478
460
|
//
|
|
479
461
|
// For all other content, the single block is assumed to make a post
|
|
480
462
|
// non-empty, if only by virtue of its own comment delimiters.
|
|
481
|
-
|
|
482
|
-
|
|
483
463
|
const blockName = blocks[0].name;
|
|
484
|
-
|
|
485
464
|
if (blockName !== getDefaultBlockName() && blockName !== getFreeformContentHandlerName()) {
|
|
486
465
|
return false;
|
|
487
466
|
}
|
|
488
|
-
|
|
489
467
|
return !getEditedPostContent(state);
|
|
490
468
|
});
|
|
469
|
+
|
|
491
470
|
/**
|
|
492
471
|
* Returns true if the post can be autosaved, or false otherwise.
|
|
493
472
|
*
|
|
@@ -496,49 +475,50 @@ export const isEditedPostEmpty = createRegistrySelector(select => state => {
|
|
|
496
475
|
*
|
|
497
476
|
* @return {boolean} Whether the post can be autosaved.
|
|
498
477
|
*/
|
|
499
|
-
|
|
500
478
|
export const isEditedPostAutosaveable = createRegistrySelector(select => state => {
|
|
501
479
|
// A post must contain a title, an excerpt, or non-empty content to be valid for autosaving.
|
|
502
480
|
if (!isEditedPostSaveable(state)) {
|
|
503
481
|
return false;
|
|
504
|
-
}
|
|
505
|
-
|
|
482
|
+
}
|
|
506
483
|
|
|
484
|
+
// A post is not autosavable when there is a post autosave lock.
|
|
507
485
|
if (isPostAutosavingLocked(state)) {
|
|
508
486
|
return false;
|
|
509
487
|
}
|
|
510
|
-
|
|
511
488
|
const postType = getCurrentPostType(state);
|
|
512
489
|
const postId = getCurrentPostId(state);
|
|
513
490
|
const hasFetchedAutosave = select(coreStore).hasFetchedAutosaves(postType, postId);
|
|
514
|
-
const currentUserId = select(coreStore).getCurrentUser()?.id;
|
|
491
|
+
const currentUserId = select(coreStore).getCurrentUser()?.id;
|
|
492
|
+
|
|
493
|
+
// Disable reason - this line causes the side-effect of fetching the autosave
|
|
515
494
|
// via a resolver, moving below the return would result in the autosave never
|
|
516
495
|
// being fetched.
|
|
517
496
|
// eslint-disable-next-line @wordpress/no-unused-vars-before-return
|
|
497
|
+
const autosave = select(coreStore).getAutosave(postType, postId, currentUserId);
|
|
518
498
|
|
|
519
|
-
|
|
499
|
+
// If any existing autosaves have not yet been fetched, this function is
|
|
520
500
|
// unable to determine if the post is autosaveable, so return false.
|
|
521
|
-
|
|
522
501
|
if (!hasFetchedAutosave) {
|
|
523
502
|
return false;
|
|
524
|
-
}
|
|
525
|
-
|
|
503
|
+
}
|
|
526
504
|
|
|
505
|
+
// If we don't already have an autosave, the post is autosaveable.
|
|
527
506
|
if (!autosave) {
|
|
528
507
|
return true;
|
|
529
|
-
}
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
// To avoid an expensive content serialization, use the content dirtiness
|
|
530
511
|
// flag in place of content field comparison against the known autosave.
|
|
531
512
|
// This is not strictly accurate, and relies on a tolerance toward autosave
|
|
532
513
|
// request failures for unnecessary saves.
|
|
533
|
-
|
|
534
|
-
|
|
535
514
|
if (hasChangedContent(state)) {
|
|
536
515
|
return true;
|
|
537
|
-
}
|
|
538
|
-
|
|
516
|
+
}
|
|
539
517
|
|
|
518
|
+
// If title, excerpt, or meta have changed, the post is autosaveable.
|
|
540
519
|
return ['title', 'excerpt', 'meta'].some(field => getPostRawValue(autosave[field]) !== getEditedPostAttribute(state, field));
|
|
541
520
|
});
|
|
521
|
+
|
|
542
522
|
/**
|
|
543
523
|
* Return true if the post being edited is being scheduled. Preferring the
|
|
544
524
|
* unsaved status values.
|
|
@@ -547,13 +527,13 @@ export const isEditedPostAutosaveable = createRegistrySelector(select => state =
|
|
|
547
527
|
*
|
|
548
528
|
* @return {boolean} Whether the post has been published.
|
|
549
529
|
*/
|
|
550
|
-
|
|
551
530
|
export function isEditedPostBeingScheduled(state) {
|
|
552
|
-
const date = getEditedPostAttribute(state, 'date');
|
|
553
|
-
|
|
531
|
+
const date = getEditedPostAttribute(state, 'date');
|
|
532
|
+
// Offset the date by one minute (network latency).
|
|
554
533
|
const checkedDate = new Date(Number(getDate(date)) - ONE_MINUTE_IN_MS);
|
|
555
534
|
return isInTheFuture(checkedDate);
|
|
556
535
|
}
|
|
536
|
+
|
|
557
537
|
/**
|
|
558
538
|
* Returns whether the current post should be considered to have a "floating"
|
|
559
539
|
* date (i.e. that it would publish "Immediately" rather than at a set time).
|
|
@@ -567,22 +547,21 @@ export function isEditedPostBeingScheduled(state) {
|
|
|
567
547
|
*
|
|
568
548
|
* @return {boolean} Whether the edited post has a floating date value.
|
|
569
549
|
*/
|
|
570
|
-
|
|
571
550
|
export function isEditedPostDateFloating(state) {
|
|
572
551
|
const date = getEditedPostAttribute(state, 'date');
|
|
573
|
-
const modified = getEditedPostAttribute(state, 'modified');
|
|
552
|
+
const modified = getEditedPostAttribute(state, 'modified');
|
|
553
|
+
|
|
554
|
+
// This should be the status of the persisted post
|
|
574
555
|
// It shouldn't use the "edited" status otherwise it breaks the
|
|
575
556
|
// inferred post data floating status
|
|
576
557
|
// See https://github.com/WordPress/gutenberg/issues/28083.
|
|
577
|
-
|
|
578
558
|
const status = getCurrentPost(state).status;
|
|
579
|
-
|
|
580
559
|
if (status === 'draft' || status === 'auto-draft' || status === 'pending') {
|
|
581
560
|
return date === modified || date === null;
|
|
582
561
|
}
|
|
583
|
-
|
|
584
562
|
return false;
|
|
585
563
|
}
|
|
564
|
+
|
|
586
565
|
/**
|
|
587
566
|
* Returns true if the post is currently being deleted, or false otherwise.
|
|
588
567
|
*
|
|
@@ -590,10 +569,10 @@ export function isEditedPostDateFloating(state) {
|
|
|
590
569
|
*
|
|
591
570
|
* @return {boolean} Whether post is being deleted.
|
|
592
571
|
*/
|
|
593
|
-
|
|
594
572
|
export function isDeletingPost(state) {
|
|
595
573
|
return !!state.deleting.pending;
|
|
596
574
|
}
|
|
575
|
+
|
|
597
576
|
/**
|
|
598
577
|
* Returns true if the post is currently being saved, or false otherwise.
|
|
599
578
|
*
|
|
@@ -601,10 +580,10 @@ export function isDeletingPost(state) {
|
|
|
601
580
|
*
|
|
602
581
|
* @return {boolean} Whether post is being saved.
|
|
603
582
|
*/
|
|
604
|
-
|
|
605
583
|
export function isSavingPost(state) {
|
|
606
584
|
return !!state.saving.pending;
|
|
607
585
|
}
|
|
586
|
+
|
|
608
587
|
/**
|
|
609
588
|
* Returns true if non-post entities are currently being saved, or false otherwise.
|
|
610
589
|
*
|
|
@@ -612,16 +591,15 @@ export function isSavingPost(state) {
|
|
|
612
591
|
*
|
|
613
592
|
* @return {boolean} Whether non-post entities are being saved.
|
|
614
593
|
*/
|
|
615
|
-
|
|
616
594
|
export const isSavingNonPostEntityChanges = createRegistrySelector(select => state => {
|
|
617
595
|
const entitiesBeingSaved = select(coreStore).__experimentalGetEntitiesBeingSaved();
|
|
618
|
-
|
|
619
596
|
const {
|
|
620
597
|
type,
|
|
621
598
|
id
|
|
622
599
|
} = getCurrentPost(state);
|
|
623
600
|
return entitiesBeingSaved.some(entityRecord => entityRecord.kind !== 'postType' || entityRecord.name !== type || entityRecord.key !== id);
|
|
624
601
|
});
|
|
602
|
+
|
|
625
603
|
/**
|
|
626
604
|
* Returns true if a previous post save was attempted successfully, or false
|
|
627
605
|
* otherwise.
|
|
@@ -630,12 +608,12 @@ export const isSavingNonPostEntityChanges = createRegistrySelector(select => sta
|
|
|
630
608
|
*
|
|
631
609
|
* @return {boolean} Whether the post was saved successfully.
|
|
632
610
|
*/
|
|
633
|
-
|
|
634
611
|
export const didPostSaveRequestSucceed = createRegistrySelector(select => state => {
|
|
635
612
|
const postType = getCurrentPostType(state);
|
|
636
613
|
const postId = getCurrentPostId(state);
|
|
637
614
|
return !select(coreStore).getLastEntitySaveError('postType', postType, postId);
|
|
638
615
|
});
|
|
616
|
+
|
|
639
617
|
/**
|
|
640
618
|
* Returns true if a previous post save was attempted but failed, or false
|
|
641
619
|
* otherwise.
|
|
@@ -644,12 +622,12 @@ export const didPostSaveRequestSucceed = createRegistrySelector(select => state
|
|
|
644
622
|
*
|
|
645
623
|
* @return {boolean} Whether the post save failed.
|
|
646
624
|
*/
|
|
647
|
-
|
|
648
625
|
export const didPostSaveRequestFail = createRegistrySelector(select => state => {
|
|
649
626
|
const postType = getCurrentPostType(state);
|
|
650
627
|
const postId = getCurrentPostId(state);
|
|
651
628
|
return !!select(coreStore).getLastEntitySaveError('postType', postType, postId);
|
|
652
629
|
});
|
|
630
|
+
|
|
653
631
|
/**
|
|
654
632
|
* Returns true if the post is autosaving, or false otherwise.
|
|
655
633
|
*
|
|
@@ -657,10 +635,10 @@ export const didPostSaveRequestFail = createRegistrySelector(select => state =>
|
|
|
657
635
|
*
|
|
658
636
|
* @return {boolean} Whether the post is autosaving.
|
|
659
637
|
*/
|
|
660
|
-
|
|
661
638
|
export function isAutosavingPost(state) {
|
|
662
639
|
return isSavingPost(state) && Boolean(state.saving.options?.isAutosave);
|
|
663
640
|
}
|
|
641
|
+
|
|
664
642
|
/**
|
|
665
643
|
* Returns true if the post is being previewed, or false otherwise.
|
|
666
644
|
*
|
|
@@ -668,10 +646,10 @@ export function isAutosavingPost(state) {
|
|
|
668
646
|
*
|
|
669
647
|
* @return {boolean} Whether the post is being previewed.
|
|
670
648
|
*/
|
|
671
|
-
|
|
672
649
|
export function isPreviewingPost(state) {
|
|
673
650
|
return isSavingPost(state) && Boolean(state.saving.options?.isPreview);
|
|
674
651
|
}
|
|
652
|
+
|
|
675
653
|
/**
|
|
676
654
|
* Returns the post preview link
|
|
677
655
|
*
|
|
@@ -679,38 +657,33 @@ export function isPreviewingPost(state) {
|
|
|
679
657
|
*
|
|
680
658
|
* @return {string | undefined} Preview Link.
|
|
681
659
|
*/
|
|
682
|
-
|
|
683
660
|
export function getEditedPostPreviewLink(state) {
|
|
684
661
|
if (state.saving.pending || isSavingPost(state)) {
|
|
685
662
|
return;
|
|
686
663
|
}
|
|
687
|
-
|
|
688
|
-
|
|
664
|
+
let previewLink = getAutosaveAttribute(state, 'preview_link');
|
|
665
|
+
// Fix for issue: https://github.com/WordPress/gutenberg/issues/33616
|
|
689
666
|
// If the post is draft, ignore the preview link from the autosave record,
|
|
690
667
|
// because the preview could be a stale autosave if the post was switched from
|
|
691
668
|
// published to draft.
|
|
692
669
|
// See: https://github.com/WordPress/gutenberg/pull/37952.
|
|
693
|
-
|
|
694
670
|
if (!previewLink || 'draft' === getCurrentPost(state).status) {
|
|
695
671
|
previewLink = getEditedPostAttribute(state, 'link');
|
|
696
|
-
|
|
697
672
|
if (previewLink) {
|
|
698
673
|
previewLink = addQueryArgs(previewLink, {
|
|
699
674
|
preview: true
|
|
700
675
|
});
|
|
701
676
|
}
|
|
702
677
|
}
|
|
703
|
-
|
|
704
678
|
const featuredImageId = getEditedPostAttribute(state, 'featured_media');
|
|
705
|
-
|
|
706
679
|
if (previewLink && featuredImageId) {
|
|
707
680
|
return addQueryArgs(previewLink, {
|
|
708
681
|
_thumbnail_id: featuredImageId
|
|
709
682
|
});
|
|
710
683
|
}
|
|
711
|
-
|
|
712
684
|
return previewLink;
|
|
713
685
|
}
|
|
686
|
+
|
|
714
687
|
/**
|
|
715
688
|
* Returns a suggested post format for the current post, inferred only if there
|
|
716
689
|
* is a single block within the post and it is of a type known to match a
|
|
@@ -720,55 +693,49 @@ export function getEditedPostPreviewLink(state) {
|
|
|
720
693
|
*
|
|
721
694
|
* @return {?string} Suggested post format.
|
|
722
695
|
*/
|
|
723
|
-
|
|
724
696
|
export function getSuggestedPostFormat(state) {
|
|
725
697
|
const blocks = getEditorBlocks(state);
|
|
726
698
|
if (blocks.length > 2) return null;
|
|
727
|
-
let name;
|
|
699
|
+
let name;
|
|
700
|
+
// If there is only one block in the content of the post grab its name
|
|
728
701
|
// so we can derive a suitable post format from it.
|
|
729
|
-
|
|
730
702
|
if (blocks.length === 1) {
|
|
731
|
-
name = blocks[0].name;
|
|
732
|
-
|
|
703
|
+
name = blocks[0].name;
|
|
704
|
+
// Check for core/embed `video` and `audio` eligible suggestions.
|
|
733
705
|
if (name === 'core/embed') {
|
|
734
706
|
const provider = blocks[0].attributes?.providerNameSlug;
|
|
735
|
-
|
|
736
707
|
if (['youtube', 'vimeo'].includes(provider)) {
|
|
737
708
|
name = 'core/video';
|
|
738
709
|
} else if (['spotify', 'soundcloud'].includes(provider)) {
|
|
739
710
|
name = 'core/audio';
|
|
740
711
|
}
|
|
741
712
|
}
|
|
742
|
-
}
|
|
743
|
-
// grab the name of the first one to also suggest a post format from it.
|
|
744
|
-
|
|
713
|
+
}
|
|
745
714
|
|
|
715
|
+
// If there are two blocks in the content and the last one is a text blocks
|
|
716
|
+
// grab the name of the first one to also suggest a post format from it.
|
|
746
717
|
if (blocks.length === 2 && blocks[1].name === 'core/paragraph') {
|
|
747
718
|
name = blocks[0].name;
|
|
748
|
-
}
|
|
749
|
-
|
|
719
|
+
}
|
|
750
720
|
|
|
721
|
+
// We only convert to default post formats in core.
|
|
751
722
|
switch (name) {
|
|
752
723
|
case 'core/image':
|
|
753
724
|
return 'image';
|
|
754
|
-
|
|
755
725
|
case 'core/quote':
|
|
756
726
|
case 'core/pullquote':
|
|
757
727
|
return 'quote';
|
|
758
|
-
|
|
759
728
|
case 'core/gallery':
|
|
760
729
|
return 'gallery';
|
|
761
|
-
|
|
762
730
|
case 'core/video':
|
|
763
731
|
return 'video';
|
|
764
|
-
|
|
765
732
|
case 'core/audio':
|
|
766
733
|
return 'audio';
|
|
767
|
-
|
|
768
734
|
default:
|
|
769
735
|
return null;
|
|
770
736
|
}
|
|
771
737
|
}
|
|
738
|
+
|
|
772
739
|
/**
|
|
773
740
|
* Returns the content of the post being edited.
|
|
774
741
|
*
|
|
@@ -776,12 +743,10 @@ export function getSuggestedPostFormat(state) {
|
|
|
776
743
|
*
|
|
777
744
|
* @return {string} Post content.
|
|
778
745
|
*/
|
|
779
|
-
|
|
780
746
|
export const getEditedPostContent = createRegistrySelector(select => state => {
|
|
781
747
|
const postId = getCurrentPostId(state);
|
|
782
748
|
const postType = getCurrentPostType(state);
|
|
783
749
|
const record = select(coreStore).getEditedEntityRecord('postType', postType, postId);
|
|
784
|
-
|
|
785
750
|
if (record) {
|
|
786
751
|
if (typeof record.content === 'function') {
|
|
787
752
|
return record.content(record);
|
|
@@ -791,9 +756,9 @@ export const getEditedPostContent = createRegistrySelector(select => state => {
|
|
|
791
756
|
return record.content;
|
|
792
757
|
}
|
|
793
758
|
}
|
|
794
|
-
|
|
795
759
|
return '';
|
|
796
760
|
});
|
|
761
|
+
|
|
797
762
|
/**
|
|
798
763
|
* Returns true if the post is being published, or false otherwise.
|
|
799
764
|
*
|
|
@@ -801,10 +766,10 @@ export const getEditedPostContent = createRegistrySelector(select => state => {
|
|
|
801
766
|
*
|
|
802
767
|
* @return {boolean} Whether post is being published.
|
|
803
768
|
*/
|
|
804
|
-
|
|
805
769
|
export function isPublishingPost(state) {
|
|
806
770
|
return isSavingPost(state) && !isCurrentPostPublished(state) && getEditedPostAttribute(state, 'status') === 'publish';
|
|
807
771
|
}
|
|
772
|
+
|
|
808
773
|
/**
|
|
809
774
|
* Returns whether the permalink is editable or not.
|
|
810
775
|
*
|
|
@@ -812,11 +777,11 @@ export function isPublishingPost(state) {
|
|
|
812
777
|
*
|
|
813
778
|
* @return {boolean} Whether or not the permalink is editable.
|
|
814
779
|
*/
|
|
815
|
-
|
|
816
780
|
export function isPermalinkEditable(state) {
|
|
817
781
|
const permalinkTemplate = getEditedPostAttribute(state, 'permalink_template');
|
|
818
782
|
return PERMALINK_POSTNAME_REGEX.test(permalinkTemplate);
|
|
819
783
|
}
|
|
784
|
+
|
|
820
785
|
/**
|
|
821
786
|
* Returns the permalink for the post.
|
|
822
787
|
*
|
|
@@ -824,26 +789,22 @@ export function isPermalinkEditable(state) {
|
|
|
824
789
|
*
|
|
825
790
|
* @return {?string} The permalink, or null if the post is not viewable.
|
|
826
791
|
*/
|
|
827
|
-
|
|
828
792
|
export function getPermalink(state) {
|
|
829
793
|
const permalinkParts = getPermalinkParts(state);
|
|
830
|
-
|
|
831
794
|
if (!permalinkParts) {
|
|
832
795
|
return null;
|
|
833
796
|
}
|
|
834
|
-
|
|
835
797
|
const {
|
|
836
798
|
prefix,
|
|
837
799
|
postName,
|
|
838
800
|
suffix
|
|
839
801
|
} = permalinkParts;
|
|
840
|
-
|
|
841
802
|
if (isPermalinkEditable(state)) {
|
|
842
803
|
return prefix + postName + suffix;
|
|
843
804
|
}
|
|
844
|
-
|
|
845
805
|
return prefix;
|
|
846
806
|
}
|
|
807
|
+
|
|
847
808
|
/**
|
|
848
809
|
* Returns the slug for the post being edited, preferring a manually edited
|
|
849
810
|
* value if one exists, then a sanitized version of the current post title, and
|
|
@@ -853,10 +814,10 @@ export function getPermalink(state) {
|
|
|
853
814
|
*
|
|
854
815
|
* @return {string} The current slug to be displayed in the editor
|
|
855
816
|
*/
|
|
856
|
-
|
|
857
817
|
export function getEditedPostSlug(state) {
|
|
858
818
|
return getEditedPostAttribute(state, 'slug') || cleanForSlug(getEditedPostAttribute(state, 'title')) || getCurrentPostId(state);
|
|
859
819
|
}
|
|
820
|
+
|
|
860
821
|
/**
|
|
861
822
|
* Returns the permalink for a post, split into it's three parts: the prefix,
|
|
862
823
|
* the postName, and the suffix.
|
|
@@ -866,14 +827,11 @@ export function getEditedPostSlug(state) {
|
|
|
866
827
|
* @return {Object} An object containing the prefix, postName, and suffix for
|
|
867
828
|
* the permalink, or null if the post is not viewable.
|
|
868
829
|
*/
|
|
869
|
-
|
|
870
830
|
export function getPermalinkParts(state) {
|
|
871
831
|
const permalinkTemplate = getEditedPostAttribute(state, 'permalink_template');
|
|
872
|
-
|
|
873
832
|
if (!permalinkTemplate) {
|
|
874
833
|
return null;
|
|
875
834
|
}
|
|
876
|
-
|
|
877
835
|
const postName = getEditedPostAttribute(state, 'slug') || getEditedPostAttribute(state, 'generated_slug');
|
|
878
836
|
const [prefix, suffix] = permalinkTemplate.split(PERMALINK_POSTNAME_REGEX);
|
|
879
837
|
return {
|
|
@@ -882,6 +840,7 @@ export function getPermalinkParts(state) {
|
|
|
882
840
|
suffix
|
|
883
841
|
};
|
|
884
842
|
}
|
|
843
|
+
|
|
885
844
|
/**
|
|
886
845
|
* Returns whether the post is locked.
|
|
887
846
|
*
|
|
@@ -889,10 +848,10 @@ export function getPermalinkParts(state) {
|
|
|
889
848
|
*
|
|
890
849
|
* @return {boolean} Is locked.
|
|
891
850
|
*/
|
|
892
|
-
|
|
893
851
|
export function isPostLocked(state) {
|
|
894
852
|
return state.postLock.isLocked;
|
|
895
853
|
}
|
|
854
|
+
|
|
896
855
|
/**
|
|
897
856
|
* Returns whether post saving is locked.
|
|
898
857
|
*
|
|
@@ -900,10 +859,10 @@ export function isPostLocked(state) {
|
|
|
900
859
|
*
|
|
901
860
|
* @return {boolean} Is locked.
|
|
902
861
|
*/
|
|
903
|
-
|
|
904
862
|
export function isPostSavingLocked(state) {
|
|
905
863
|
return Object.keys(state.postSavingLock).length > 0;
|
|
906
864
|
}
|
|
865
|
+
|
|
907
866
|
/**
|
|
908
867
|
* Returns whether post autosaving is locked.
|
|
909
868
|
*
|
|
@@ -911,10 +870,10 @@ export function isPostSavingLocked(state) {
|
|
|
911
870
|
*
|
|
912
871
|
* @return {boolean} Is locked.
|
|
913
872
|
*/
|
|
914
|
-
|
|
915
873
|
export function isPostAutosavingLocked(state) {
|
|
916
874
|
return Object.keys(state.postAutosavingLock).length > 0;
|
|
917
875
|
}
|
|
876
|
+
|
|
918
877
|
/**
|
|
919
878
|
* Returns whether the edition of the post has been taken over.
|
|
920
879
|
*
|
|
@@ -922,10 +881,10 @@ export function isPostAutosavingLocked(state) {
|
|
|
922
881
|
*
|
|
923
882
|
* @return {boolean} Is post lock takeover.
|
|
924
883
|
*/
|
|
925
|
-
|
|
926
884
|
export function isPostLockTakeover(state) {
|
|
927
885
|
return state.postLock.isTakeover;
|
|
928
886
|
}
|
|
887
|
+
|
|
929
888
|
/**
|
|
930
889
|
* Returns details about the post lock user.
|
|
931
890
|
*
|
|
@@ -933,10 +892,10 @@ export function isPostLockTakeover(state) {
|
|
|
933
892
|
*
|
|
934
893
|
* @return {Object} A user object.
|
|
935
894
|
*/
|
|
936
|
-
|
|
937
895
|
export function getPostLockUser(state) {
|
|
938
896
|
return state.postLock.user;
|
|
939
897
|
}
|
|
898
|
+
|
|
940
899
|
/**
|
|
941
900
|
* Returns the active post lock.
|
|
942
901
|
*
|
|
@@ -944,10 +903,10 @@ export function getPostLockUser(state) {
|
|
|
944
903
|
*
|
|
945
904
|
* @return {Object} The lock object.
|
|
946
905
|
*/
|
|
947
|
-
|
|
948
906
|
export function getActivePostLock(state) {
|
|
949
907
|
return state.postLock.activePostLock;
|
|
950
908
|
}
|
|
909
|
+
|
|
951
910
|
/**
|
|
952
911
|
* Returns whether or not the user has the unfiltered_html capability.
|
|
953
912
|
*
|
|
@@ -955,28 +914,28 @@ export function getActivePostLock(state) {
|
|
|
955
914
|
*
|
|
956
915
|
* @return {boolean} Whether the user can or can't post unfiltered HTML.
|
|
957
916
|
*/
|
|
958
|
-
|
|
959
917
|
export function canUserUseUnfilteredHTML(state) {
|
|
960
918
|
return Boolean(getCurrentPost(state)._links?.hasOwnProperty('wp:action-unfiltered-html'));
|
|
961
919
|
}
|
|
920
|
+
|
|
962
921
|
/**
|
|
963
922
|
* Returns whether the pre-publish panel should be shown
|
|
964
923
|
* or skipped when the user clicks the "publish" button.
|
|
965
924
|
*
|
|
966
925
|
* @return {boolean} Whether the pre-publish panel should be shown or not.
|
|
967
926
|
*/
|
|
968
|
-
|
|
969
927
|
export const isPublishSidebarEnabled = createRegistrySelector(select => () => !!select(preferencesStore).get('core/edit-post', 'isPublishSidebarEnabled'));
|
|
928
|
+
|
|
970
929
|
/**
|
|
971
930
|
* Return the current block list.
|
|
972
931
|
*
|
|
973
932
|
* @param {Object} state
|
|
974
933
|
* @return {Array} Block list.
|
|
975
934
|
*/
|
|
976
|
-
|
|
977
935
|
export const getEditorBlocks = createSelector(state => {
|
|
978
936
|
return getEditedPostAttribute(state, 'blocks') || parse(getEditedPostContent(state));
|
|
979
937
|
}, state => [getEditedPostAttribute(state, 'blocks'), getEditedPostContent(state)]);
|
|
938
|
+
|
|
980
939
|
/**
|
|
981
940
|
* A block selection object.
|
|
982
941
|
*
|
|
@@ -996,7 +955,6 @@ export const getEditorBlocks = createSelector(state => {
|
|
|
996
955
|
*
|
|
997
956
|
* @deprecated since Gutenberg 10.0.0.
|
|
998
957
|
*/
|
|
999
|
-
|
|
1000
958
|
export function getEditorSelectionStart(state) {
|
|
1001
959
|
deprecated("select('core/editor').getEditorSelectionStart", {
|
|
1002
960
|
since: '5.8',
|
|
@@ -1004,6 +962,7 @@ export function getEditorSelectionStart(state) {
|
|
|
1004
962
|
});
|
|
1005
963
|
return getEditedPostAttribute(state, 'selection')?.selectionStart;
|
|
1006
964
|
}
|
|
965
|
+
|
|
1007
966
|
/**
|
|
1008
967
|
* Returns the current selection end.
|
|
1009
968
|
*
|
|
@@ -1012,7 +971,6 @@ export function getEditorSelectionStart(state) {
|
|
|
1012
971
|
*
|
|
1013
972
|
* @deprecated since Gutenberg 10.0.0.
|
|
1014
973
|
*/
|
|
1015
|
-
|
|
1016
974
|
export function getEditorSelectionEnd(state) {
|
|
1017
975
|
deprecated("select('core/editor').getEditorSelectionStart", {
|
|
1018
976
|
since: '5.8',
|
|
@@ -1020,26 +978,27 @@ export function getEditorSelectionEnd(state) {
|
|
|
1020
978
|
});
|
|
1021
979
|
return getEditedPostAttribute(state, 'selection')?.selectionEnd;
|
|
1022
980
|
}
|
|
981
|
+
|
|
1023
982
|
/**
|
|
1024
983
|
* Returns the current selection.
|
|
1025
984
|
*
|
|
1026
985
|
* @param {Object} state
|
|
1027
986
|
* @return {WPBlockSelection} The selection end.
|
|
1028
987
|
*/
|
|
1029
|
-
|
|
1030
988
|
export function getEditorSelection(state) {
|
|
1031
989
|
return getEditedPostAttribute(state, 'selection');
|
|
1032
990
|
}
|
|
991
|
+
|
|
1033
992
|
/**
|
|
1034
993
|
* Is the editor ready
|
|
1035
994
|
*
|
|
1036
995
|
* @param {Object} state
|
|
1037
996
|
* @return {boolean} is Ready.
|
|
1038
997
|
*/
|
|
1039
|
-
|
|
1040
998
|
export function __unstableIsEditorReady(state) {
|
|
1041
999
|
return state.isReady;
|
|
1042
1000
|
}
|
|
1001
|
+
|
|
1043
1002
|
/**
|
|
1044
1003
|
* Returns the post editor settings.
|
|
1045
1004
|
*
|
|
@@ -1047,10 +1006,10 @@ export function __unstableIsEditorReady(state) {
|
|
|
1047
1006
|
*
|
|
1048
1007
|
* @return {Object} The editor settings object.
|
|
1049
1008
|
*/
|
|
1050
|
-
|
|
1051
1009
|
export function getEditorSettings(state) {
|
|
1052
1010
|
return state.editorSettings;
|
|
1053
1011
|
}
|
|
1012
|
+
|
|
1054
1013
|
/*
|
|
1055
1014
|
* Backward compatibility
|
|
1056
1015
|
*/
|
|
@@ -1061,7 +1020,6 @@ export function getEditorSettings(state) {
|
|
|
1061
1020
|
*
|
|
1062
1021
|
* @deprecated since Gutenberg 9.7.0.
|
|
1063
1022
|
*/
|
|
1064
|
-
|
|
1065
1023
|
export function getStateBeforeOptimisticTransaction() {
|
|
1066
1024
|
deprecated("select('core/editor').getStateBeforeOptimisticTransaction", {
|
|
1067
1025
|
since: '5.7',
|
|
@@ -1075,7 +1033,6 @@ export function getStateBeforeOptimisticTransaction() {
|
|
|
1075
1033
|
*
|
|
1076
1034
|
* @deprecated since Gutenberg 9.7.0.
|
|
1077
1035
|
*/
|
|
1078
|
-
|
|
1079
1036
|
export function inSomeHistory() {
|
|
1080
1037
|
deprecated("select('core/editor').inSomeHistory", {
|
|
1081
1038
|
since: '5.7',
|
|
@@ -1083,7 +1040,6 @@ export function inSomeHistory() {
|
|
|
1083
1040
|
});
|
|
1084
1041
|
return false;
|
|
1085
1042
|
}
|
|
1086
|
-
|
|
1087
1043
|
function getBlockEditorSelector(name) {
|
|
1088
1044
|
return createRegistrySelector(select => (state, ...args) => {
|
|
1089
1045
|
deprecated("`wp.data.select( 'core/editor' )." + name + '`', {
|
|
@@ -1094,262 +1050,262 @@ function getBlockEditorSelector(name) {
|
|
|
1094
1050
|
return select(blockEditorStore)[name](...args);
|
|
1095
1051
|
});
|
|
1096
1052
|
}
|
|
1053
|
+
|
|
1097
1054
|
/**
|
|
1098
1055
|
* @see getBlockName in core/block-editor store.
|
|
1099
1056
|
*/
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
1057
|
export const getBlockName = getBlockEditorSelector('getBlockName');
|
|
1058
|
+
|
|
1103
1059
|
/**
|
|
1104
1060
|
* @see isBlockValid in core/block-editor store.
|
|
1105
1061
|
*/
|
|
1106
|
-
|
|
1107
1062
|
export const isBlockValid = getBlockEditorSelector('isBlockValid');
|
|
1063
|
+
|
|
1108
1064
|
/**
|
|
1109
1065
|
* @see getBlockAttributes in core/block-editor store.
|
|
1110
1066
|
*/
|
|
1111
|
-
|
|
1112
1067
|
export const getBlockAttributes = getBlockEditorSelector('getBlockAttributes');
|
|
1068
|
+
|
|
1113
1069
|
/**
|
|
1114
1070
|
* @see getBlock in core/block-editor store.
|
|
1115
1071
|
*/
|
|
1116
|
-
|
|
1117
1072
|
export const getBlock = getBlockEditorSelector('getBlock');
|
|
1073
|
+
|
|
1118
1074
|
/**
|
|
1119
1075
|
* @see getBlocks in core/block-editor store.
|
|
1120
1076
|
*/
|
|
1121
|
-
|
|
1122
1077
|
export const getBlocks = getBlockEditorSelector('getBlocks');
|
|
1078
|
+
|
|
1123
1079
|
/**
|
|
1124
1080
|
* @see getClientIdsOfDescendants in core/block-editor store.
|
|
1125
1081
|
*/
|
|
1126
|
-
|
|
1127
1082
|
export const getClientIdsOfDescendants = getBlockEditorSelector('getClientIdsOfDescendants');
|
|
1083
|
+
|
|
1128
1084
|
/**
|
|
1129
1085
|
* @see getClientIdsWithDescendants in core/block-editor store.
|
|
1130
1086
|
*/
|
|
1131
|
-
|
|
1132
1087
|
export const getClientIdsWithDescendants = getBlockEditorSelector('getClientIdsWithDescendants');
|
|
1088
|
+
|
|
1133
1089
|
/**
|
|
1134
1090
|
* @see getGlobalBlockCount in core/block-editor store.
|
|
1135
1091
|
*/
|
|
1136
|
-
|
|
1137
1092
|
export const getGlobalBlockCount = getBlockEditorSelector('getGlobalBlockCount');
|
|
1093
|
+
|
|
1138
1094
|
/**
|
|
1139
1095
|
* @see getBlocksByClientId in core/block-editor store.
|
|
1140
1096
|
*/
|
|
1141
|
-
|
|
1142
1097
|
export const getBlocksByClientId = getBlockEditorSelector('getBlocksByClientId');
|
|
1098
|
+
|
|
1143
1099
|
/**
|
|
1144
1100
|
* @see getBlockCount in core/block-editor store.
|
|
1145
1101
|
*/
|
|
1146
|
-
|
|
1147
1102
|
export const getBlockCount = getBlockEditorSelector('getBlockCount');
|
|
1103
|
+
|
|
1148
1104
|
/**
|
|
1149
1105
|
* @see getBlockSelectionStart in core/block-editor store.
|
|
1150
1106
|
*/
|
|
1151
|
-
|
|
1152
1107
|
export const getBlockSelectionStart = getBlockEditorSelector('getBlockSelectionStart');
|
|
1108
|
+
|
|
1153
1109
|
/**
|
|
1154
1110
|
* @see getBlockSelectionEnd in core/block-editor store.
|
|
1155
1111
|
*/
|
|
1156
|
-
|
|
1157
1112
|
export const getBlockSelectionEnd = getBlockEditorSelector('getBlockSelectionEnd');
|
|
1113
|
+
|
|
1158
1114
|
/**
|
|
1159
1115
|
* @see getSelectedBlockCount in core/block-editor store.
|
|
1160
1116
|
*/
|
|
1161
|
-
|
|
1162
1117
|
export const getSelectedBlockCount = getBlockEditorSelector('getSelectedBlockCount');
|
|
1118
|
+
|
|
1163
1119
|
/**
|
|
1164
1120
|
* @see hasSelectedBlock in core/block-editor store.
|
|
1165
1121
|
*/
|
|
1166
|
-
|
|
1167
1122
|
export const hasSelectedBlock = getBlockEditorSelector('hasSelectedBlock');
|
|
1123
|
+
|
|
1168
1124
|
/**
|
|
1169
1125
|
* @see getSelectedBlockClientId in core/block-editor store.
|
|
1170
1126
|
*/
|
|
1171
|
-
|
|
1172
1127
|
export const getSelectedBlockClientId = getBlockEditorSelector('getSelectedBlockClientId');
|
|
1128
|
+
|
|
1173
1129
|
/**
|
|
1174
1130
|
* @see getSelectedBlock in core/block-editor store.
|
|
1175
1131
|
*/
|
|
1176
|
-
|
|
1177
1132
|
export const getSelectedBlock = getBlockEditorSelector('getSelectedBlock');
|
|
1133
|
+
|
|
1178
1134
|
/**
|
|
1179
1135
|
* @see getBlockRootClientId in core/block-editor store.
|
|
1180
1136
|
*/
|
|
1181
|
-
|
|
1182
1137
|
export const getBlockRootClientId = getBlockEditorSelector('getBlockRootClientId');
|
|
1138
|
+
|
|
1183
1139
|
/**
|
|
1184
1140
|
* @see getBlockHierarchyRootClientId in core/block-editor store.
|
|
1185
1141
|
*/
|
|
1186
|
-
|
|
1187
1142
|
export const getBlockHierarchyRootClientId = getBlockEditorSelector('getBlockHierarchyRootClientId');
|
|
1143
|
+
|
|
1188
1144
|
/**
|
|
1189
1145
|
* @see getAdjacentBlockClientId in core/block-editor store.
|
|
1190
1146
|
*/
|
|
1191
|
-
|
|
1192
1147
|
export const getAdjacentBlockClientId = getBlockEditorSelector('getAdjacentBlockClientId');
|
|
1148
|
+
|
|
1193
1149
|
/**
|
|
1194
1150
|
* @see getPreviousBlockClientId in core/block-editor store.
|
|
1195
1151
|
*/
|
|
1196
|
-
|
|
1197
1152
|
export const getPreviousBlockClientId = getBlockEditorSelector('getPreviousBlockClientId');
|
|
1153
|
+
|
|
1198
1154
|
/**
|
|
1199
1155
|
* @see getNextBlockClientId in core/block-editor store.
|
|
1200
1156
|
*/
|
|
1201
|
-
|
|
1202
1157
|
export const getNextBlockClientId = getBlockEditorSelector('getNextBlockClientId');
|
|
1158
|
+
|
|
1203
1159
|
/**
|
|
1204
1160
|
* @see getSelectedBlocksInitialCaretPosition in core/block-editor store.
|
|
1205
1161
|
*/
|
|
1206
|
-
|
|
1207
1162
|
export const getSelectedBlocksInitialCaretPosition = getBlockEditorSelector('getSelectedBlocksInitialCaretPosition');
|
|
1163
|
+
|
|
1208
1164
|
/**
|
|
1209
1165
|
* @see getMultiSelectedBlockClientIds in core/block-editor store.
|
|
1210
1166
|
*/
|
|
1211
|
-
|
|
1212
1167
|
export const getMultiSelectedBlockClientIds = getBlockEditorSelector('getMultiSelectedBlockClientIds');
|
|
1168
|
+
|
|
1213
1169
|
/**
|
|
1214
1170
|
* @see getMultiSelectedBlocks in core/block-editor store.
|
|
1215
1171
|
*/
|
|
1216
|
-
|
|
1217
1172
|
export const getMultiSelectedBlocks = getBlockEditorSelector('getMultiSelectedBlocks');
|
|
1173
|
+
|
|
1218
1174
|
/**
|
|
1219
1175
|
* @see getFirstMultiSelectedBlockClientId in core/block-editor store.
|
|
1220
1176
|
*/
|
|
1221
|
-
|
|
1222
1177
|
export const getFirstMultiSelectedBlockClientId = getBlockEditorSelector('getFirstMultiSelectedBlockClientId');
|
|
1178
|
+
|
|
1223
1179
|
/**
|
|
1224
1180
|
* @see getLastMultiSelectedBlockClientId in core/block-editor store.
|
|
1225
1181
|
*/
|
|
1226
|
-
|
|
1227
1182
|
export const getLastMultiSelectedBlockClientId = getBlockEditorSelector('getLastMultiSelectedBlockClientId');
|
|
1183
|
+
|
|
1228
1184
|
/**
|
|
1229
1185
|
* @see isFirstMultiSelectedBlock in core/block-editor store.
|
|
1230
1186
|
*/
|
|
1231
|
-
|
|
1232
1187
|
export const isFirstMultiSelectedBlock = getBlockEditorSelector('isFirstMultiSelectedBlock');
|
|
1188
|
+
|
|
1233
1189
|
/**
|
|
1234
1190
|
* @see isBlockMultiSelected in core/block-editor store.
|
|
1235
1191
|
*/
|
|
1236
|
-
|
|
1237
1192
|
export const isBlockMultiSelected = getBlockEditorSelector('isBlockMultiSelected');
|
|
1193
|
+
|
|
1238
1194
|
/**
|
|
1239
1195
|
* @see isAncestorMultiSelected in core/block-editor store.
|
|
1240
1196
|
*/
|
|
1241
|
-
|
|
1242
1197
|
export const isAncestorMultiSelected = getBlockEditorSelector('isAncestorMultiSelected');
|
|
1198
|
+
|
|
1243
1199
|
/**
|
|
1244
1200
|
* @see getMultiSelectedBlocksStartClientId in core/block-editor store.
|
|
1245
1201
|
*/
|
|
1246
|
-
|
|
1247
1202
|
export const getMultiSelectedBlocksStartClientId = getBlockEditorSelector('getMultiSelectedBlocksStartClientId');
|
|
1203
|
+
|
|
1248
1204
|
/**
|
|
1249
1205
|
* @see getMultiSelectedBlocksEndClientId in core/block-editor store.
|
|
1250
1206
|
*/
|
|
1251
|
-
|
|
1252
1207
|
export const getMultiSelectedBlocksEndClientId = getBlockEditorSelector('getMultiSelectedBlocksEndClientId');
|
|
1208
|
+
|
|
1253
1209
|
/**
|
|
1254
1210
|
* @see getBlockOrder in core/block-editor store.
|
|
1255
1211
|
*/
|
|
1256
|
-
|
|
1257
1212
|
export const getBlockOrder = getBlockEditorSelector('getBlockOrder');
|
|
1213
|
+
|
|
1258
1214
|
/**
|
|
1259
1215
|
* @see getBlockIndex in core/block-editor store.
|
|
1260
1216
|
*/
|
|
1261
|
-
|
|
1262
1217
|
export const getBlockIndex = getBlockEditorSelector('getBlockIndex');
|
|
1218
|
+
|
|
1263
1219
|
/**
|
|
1264
1220
|
* @see isBlockSelected in core/block-editor store.
|
|
1265
1221
|
*/
|
|
1266
|
-
|
|
1267
1222
|
export const isBlockSelected = getBlockEditorSelector('isBlockSelected');
|
|
1223
|
+
|
|
1268
1224
|
/**
|
|
1269
1225
|
* @see hasSelectedInnerBlock in core/block-editor store.
|
|
1270
1226
|
*/
|
|
1271
|
-
|
|
1272
1227
|
export const hasSelectedInnerBlock = getBlockEditorSelector('hasSelectedInnerBlock');
|
|
1228
|
+
|
|
1273
1229
|
/**
|
|
1274
1230
|
* @see isBlockWithinSelection in core/block-editor store.
|
|
1275
1231
|
*/
|
|
1276
|
-
|
|
1277
1232
|
export const isBlockWithinSelection = getBlockEditorSelector('isBlockWithinSelection');
|
|
1233
|
+
|
|
1278
1234
|
/**
|
|
1279
1235
|
* @see hasMultiSelection in core/block-editor store.
|
|
1280
1236
|
*/
|
|
1281
|
-
|
|
1282
1237
|
export const hasMultiSelection = getBlockEditorSelector('hasMultiSelection');
|
|
1238
|
+
|
|
1283
1239
|
/**
|
|
1284
1240
|
* @see isMultiSelecting in core/block-editor store.
|
|
1285
1241
|
*/
|
|
1286
|
-
|
|
1287
1242
|
export const isMultiSelecting = getBlockEditorSelector('isMultiSelecting');
|
|
1243
|
+
|
|
1288
1244
|
/**
|
|
1289
1245
|
* @see isSelectionEnabled in core/block-editor store.
|
|
1290
1246
|
*/
|
|
1291
|
-
|
|
1292
1247
|
export const isSelectionEnabled = getBlockEditorSelector('isSelectionEnabled');
|
|
1248
|
+
|
|
1293
1249
|
/**
|
|
1294
1250
|
* @see getBlockMode in core/block-editor store.
|
|
1295
1251
|
*/
|
|
1296
|
-
|
|
1297
1252
|
export const getBlockMode = getBlockEditorSelector('getBlockMode');
|
|
1253
|
+
|
|
1298
1254
|
/**
|
|
1299
1255
|
* @see isTyping in core/block-editor store.
|
|
1300
1256
|
*/
|
|
1301
|
-
|
|
1302
1257
|
export const isTyping = getBlockEditorSelector('isTyping');
|
|
1258
|
+
|
|
1303
1259
|
/**
|
|
1304
1260
|
* @see isCaretWithinFormattedText in core/block-editor store.
|
|
1305
1261
|
*/
|
|
1306
|
-
|
|
1307
1262
|
export const isCaretWithinFormattedText = getBlockEditorSelector('isCaretWithinFormattedText');
|
|
1263
|
+
|
|
1308
1264
|
/**
|
|
1309
1265
|
* @see getBlockInsertionPoint in core/block-editor store.
|
|
1310
1266
|
*/
|
|
1311
|
-
|
|
1312
1267
|
export const getBlockInsertionPoint = getBlockEditorSelector('getBlockInsertionPoint');
|
|
1268
|
+
|
|
1313
1269
|
/**
|
|
1314
1270
|
* @see isBlockInsertionPointVisible in core/block-editor store.
|
|
1315
1271
|
*/
|
|
1316
|
-
|
|
1317
1272
|
export const isBlockInsertionPointVisible = getBlockEditorSelector('isBlockInsertionPointVisible');
|
|
1273
|
+
|
|
1318
1274
|
/**
|
|
1319
1275
|
* @see isValidTemplate in core/block-editor store.
|
|
1320
1276
|
*/
|
|
1321
|
-
|
|
1322
1277
|
export const isValidTemplate = getBlockEditorSelector('isValidTemplate');
|
|
1278
|
+
|
|
1323
1279
|
/**
|
|
1324
1280
|
* @see getTemplate in core/block-editor store.
|
|
1325
1281
|
*/
|
|
1326
|
-
|
|
1327
1282
|
export const getTemplate = getBlockEditorSelector('getTemplate');
|
|
1283
|
+
|
|
1328
1284
|
/**
|
|
1329
1285
|
* @see getTemplateLock in core/block-editor store.
|
|
1330
1286
|
*/
|
|
1331
|
-
|
|
1332
1287
|
export const getTemplateLock = getBlockEditorSelector('getTemplateLock');
|
|
1288
|
+
|
|
1333
1289
|
/**
|
|
1334
1290
|
* @see canInsertBlockType in core/block-editor store.
|
|
1335
1291
|
*/
|
|
1336
|
-
|
|
1337
1292
|
export const canInsertBlockType = getBlockEditorSelector('canInsertBlockType');
|
|
1293
|
+
|
|
1338
1294
|
/**
|
|
1339
1295
|
* @see getInserterItems in core/block-editor store.
|
|
1340
1296
|
*/
|
|
1341
|
-
|
|
1342
1297
|
export const getInserterItems = getBlockEditorSelector('getInserterItems');
|
|
1298
|
+
|
|
1343
1299
|
/**
|
|
1344
1300
|
* @see hasInserterItems in core/block-editor store.
|
|
1345
1301
|
*/
|
|
1346
|
-
|
|
1347
1302
|
export const hasInserterItems = getBlockEditorSelector('hasInserterItems');
|
|
1303
|
+
|
|
1348
1304
|
/**
|
|
1349
1305
|
* @see getBlockListSettings in core/block-editor store.
|
|
1350
1306
|
*/
|
|
1351
|
-
|
|
1352
1307
|
export const getBlockListSettings = getBlockEditorSelector('getBlockListSettings');
|
|
1308
|
+
|
|
1353
1309
|
/**
|
|
1354
1310
|
* Returns the default template types.
|
|
1355
1311
|
*
|
|
@@ -1357,10 +1313,10 @@ export const getBlockListSettings = getBlockEditorSelector('getBlockListSettings
|
|
|
1357
1313
|
*
|
|
1358
1314
|
* @return {Object} The template types.
|
|
1359
1315
|
*/
|
|
1360
|
-
|
|
1361
1316
|
export function __experimentalGetDefaultTemplateTypes(state) {
|
|
1362
1317
|
return getEditorSettings(state)?.defaultTemplateTypes;
|
|
1363
1318
|
}
|
|
1319
|
+
|
|
1364
1320
|
/**
|
|
1365
1321
|
* Returns the default template part areas.
|
|
1366
1322
|
*
|
|
@@ -1368,15 +1324,16 @@ export function __experimentalGetDefaultTemplateTypes(state) {
|
|
|
1368
1324
|
*
|
|
1369
1325
|
* @return {Array} The template part areas.
|
|
1370
1326
|
*/
|
|
1371
|
-
|
|
1372
1327
|
export const __experimentalGetDefaultTemplatePartAreas = createSelector(state => {
|
|
1373
1328
|
const areas = getEditorSettings(state)?.defaultTemplatePartAreas || [];
|
|
1374
1329
|
return areas?.map(item => {
|
|
1375
|
-
return {
|
|
1330
|
+
return {
|
|
1331
|
+
...item,
|
|
1376
1332
|
icon: getTemplatePartIcon(item.icon)
|
|
1377
1333
|
};
|
|
1378
1334
|
});
|
|
1379
1335
|
}, state => [getEditorSettings(state)?.defaultTemplatePartAreas]);
|
|
1336
|
+
|
|
1380
1337
|
/**
|
|
1381
1338
|
* Returns a default template type searched by slug.
|
|
1382
1339
|
*
|
|
@@ -1385,18 +1342,15 @@ export const __experimentalGetDefaultTemplatePartAreas = createSelector(state =>
|
|
|
1385
1342
|
*
|
|
1386
1343
|
* @return {Object} The template type.
|
|
1387
1344
|
*/
|
|
1388
|
-
|
|
1389
1345
|
export const __experimentalGetDefaultTemplateType = createSelector((state, slug) => {
|
|
1390
1346
|
var _Object$values$find;
|
|
1391
|
-
|
|
1392
1347
|
const templateTypes = __experimentalGetDefaultTemplateTypes(state);
|
|
1393
|
-
|
|
1394
1348
|
if (!templateTypes) {
|
|
1395
1349
|
return EMPTY_OBJECT;
|
|
1396
1350
|
}
|
|
1397
|
-
|
|
1398
1351
|
return (_Object$values$find = Object.values(templateTypes).find(type => type.slug === slug)) !== null && _Object$values$find !== void 0 ? _Object$values$find : EMPTY_OBJECT;
|
|
1399
1352
|
}, (state, slug) => [__experimentalGetDefaultTemplateTypes(state), slug]);
|
|
1353
|
+
|
|
1400
1354
|
/**
|
|
1401
1355
|
* Given a template entity, return information about it which is ready to be
|
|
1402
1356
|
* rendered, such as the title, description, and icon.
|
|
@@ -1405,24 +1359,20 @@ export const __experimentalGetDefaultTemplateType = createSelector((state, slug)
|
|
|
1405
1359
|
* @param {Object} template The template for which we need information.
|
|
1406
1360
|
* @return {Object} Information about the template, including title, description, and icon.
|
|
1407
1361
|
*/
|
|
1408
|
-
|
|
1409
1362
|
export function __experimentalGetTemplateInfo(state, template) {
|
|
1410
1363
|
if (!template) {
|
|
1411
1364
|
return EMPTY_OBJECT;
|
|
1412
1365
|
}
|
|
1413
|
-
|
|
1414
1366
|
const {
|
|
1415
1367
|
description,
|
|
1416
1368
|
slug,
|
|
1417
1369
|
title,
|
|
1418
1370
|
area
|
|
1419
1371
|
} = template;
|
|
1420
|
-
|
|
1421
1372
|
const {
|
|
1422
1373
|
title: defaultTitle,
|
|
1423
1374
|
description: defaultDescription
|
|
1424
1375
|
} = __experimentalGetDefaultTemplateType(state, slug);
|
|
1425
|
-
|
|
1426
1376
|
const templateTitle = typeof title === 'string' ? title : title?.rendered;
|
|
1427
1377
|
const templateDescription = typeof description === 'string' ? description : description?.raw;
|
|
1428
1378
|
const templateIcon = __experimentalGetDefaultTemplatePartAreas(state).find(item => area === item.area)?.icon || layout;
|
|
@@ -1432,6 +1382,7 @@ export function __experimentalGetTemplateInfo(state, template) {
|
|
|
1432
1382
|
icon: templateIcon
|
|
1433
1383
|
};
|
|
1434
1384
|
}
|
|
1385
|
+
|
|
1435
1386
|
/**
|
|
1436
1387
|
* Returns a post type label depending on the current post.
|
|
1437
1388
|
*
|
|
@@ -1439,12 +1390,11 @@ export function __experimentalGetTemplateInfo(state, template) {
|
|
|
1439
1390
|
*
|
|
1440
1391
|
* @return {string|undefined} The post type label if available, otherwise undefined.
|
|
1441
1392
|
*/
|
|
1442
|
-
|
|
1443
1393
|
export const getPostTypeLabel = createRegistrySelector(select => state => {
|
|
1444
1394
|
const currentPostType = getCurrentPostType(state);
|
|
1445
|
-
const postType = select(coreStore).getPostType(currentPostType);
|
|
1395
|
+
const postType = select(coreStore).getPostType(currentPostType);
|
|
1396
|
+
// Disable reason: Post type labels object is shaped like this.
|
|
1446
1397
|
// eslint-disable-next-line camelcase
|
|
1447
|
-
|
|
1448
1398
|
return postType?.labels?.singular_name;
|
|
1449
1399
|
});
|
|
1450
1400
|
//# sourceMappingURL=selectors.js.map
|