@wordpress/editor 13.11.0 → 13.12.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/autosave-monitor/index.js +1 -2
- package/build/components/autosave-monitor/index.js.map +1 -1
- package/build/components/deprecated.js +3 -4
- package/build/components/deprecated.js.map +1 -1
- package/build/components/document-outline/check.js +4 -5
- package/build/components/document-outline/check.js.map +1 -1
- package/build/components/document-outline/index.js +12 -16
- package/build/components/document-outline/index.js.map +1 -1
- package/build/components/document-outline/item.js +22 -25
- package/build/components/document-outline/item.js.map +1 -1
- package/build/components/editor-help/help-detail-navigation-screen.native.js +4 -5
- package/build/components/editor-help/help-detail-navigation-screen.native.js.map +1 -1
- package/build/components/editor-help/help-get-support-button.native.js +4 -5
- package/build/components/editor-help/help-get-support-button.native.js.map +1 -1
- package/build/components/editor-help/help-section-title.native.js +3 -4
- package/build/components/editor-help/help-section-title.native.js.map +1 -1
- package/build/components/editor-help/help-topic-row.native.js +6 -7
- package/build/components/editor-help/help-topic-row.native.js.map +1 -1
- package/build/components/editor-help/index.native.js +19 -24
- package/build/components/editor-help/index.native.js.map +1 -1
- package/build/components/editor-help/view-sections.native.js +16 -20
- package/build/components/editor-help/view-sections.native.js.map +1 -1
- package/build/components/editor-notices/index.js +12 -19
- package/build/components/editor-notices/index.js.map +1 -1
- package/build/components/editor-snackbars/index.js +3 -6
- package/build/components/editor-snackbars/index.js.map +1 -1
- package/build/components/entities-saved-states/entity-record-item.js +7 -10
- package/build/components/entities-saved-states/entity-record-item.js.map +1 -1
- package/build/components/entities-saved-states/entity-type-list.js +6 -7
- package/build/components/entities-saved-states/entity-type-list.js.map +1 -1
- package/build/components/entities-saved-states/hooks/use-is-dirty.js +84 -0
- package/build/components/entities-saved-states/hooks/use-is-dirty.js.map +1 -0
- package/build/components/entities-saved-states/index.js +38 -110
- package/build/components/entities-saved-states/index.js.map +1 -1
- package/build/components/error-boundary/index.js +4 -5
- package/build/components/error-boundary/index.js.map +1 -1
- package/build/components/global-keyboard-shortcuts/save-shortcut.js +3 -4
- package/build/components/global-keyboard-shortcuts/save-shortcut.js.map +1 -1
- package/build/components/index.js +9 -0
- package/build/components/index.js.map +1 -1
- package/build/components/media-categories/index.js +25 -42
- package/build/components/media-categories/index.js.map +1 -1
- package/build/components/page-attributes/check.js +4 -7
- package/build/components/page-attributes/check.js.map +1 -1
- package/build/components/page-attributes/order.js +5 -8
- package/build/components/page-attributes/order.js.map +1 -1
- package/build/components/page-attributes/parent.js +5 -12
- package/build/components/page-attributes/parent.js.map +1 -1
- package/build/components/post-author/check.js +6 -7
- package/build/components/post-author/check.js.map +1 -1
- package/build/components/post-author/combobox.js +3 -6
- package/build/components/post-author/combobox.js.map +1 -1
- package/build/components/post-author/index.js +1 -1
- package/build/components/post-author/index.js.map +1 -1
- package/build/components/post-comments/index.js +4 -6
- package/build/components/post-comments/index.js.map +1 -1
- package/build/components/post-excerpt/index.js +4 -5
- package/build/components/post-excerpt/index.js.map +1 -1
- package/build/components/post-featured-image/index.js +56 -69
- package/build/components/post-featured-image/index.js.map +1 -1
- package/build/components/post-format/check.js +4 -5
- package/build/components/post-format/check.js.map +1 -1
- package/build/components/post-format/index.js +1 -1
- package/build/components/post-format/index.js.map +1 -1
- package/build/components/post-last-revision/check.js +5 -7
- package/build/components/post-last-revision/check.js.map +1 -1
- package/build/components/post-last-revision/index.js +4 -5
- package/build/components/post-last-revision/index.js.map +1 -1
- package/build/components/post-locked-modal/index.js +1 -1
- package/build/components/post-locked-modal/index.js.map +1 -1
- package/build/components/post-pending-status/check.js +7 -9
- package/build/components/post-pending-status/check.js.map +1 -1
- package/build/components/post-pending-status/index.js +4 -6
- package/build/components/post-pending-status/index.js.map +1 -1
- package/build/components/post-pingbacks/index.js +4 -6
- package/build/components/post-pingbacks/index.js.map +1 -1
- package/build/components/post-preview-button/index.js +8 -12
- package/build/components/post-preview-button/index.js.map +1 -1
- package/build/components/post-publish-button/index.js +6 -13
- package/build/components/post-publish-button/index.js.map +1 -1
- package/build/components/post-publish-button/label.js +14 -17
- package/build/components/post-publish-button/label.js.map +1 -1
- package/build/components/post-publish-panel/index.js +6 -7
- package/build/components/post-publish-panel/index.js.map +1 -1
- package/build/components/post-publish-panel/maybe-category-panel.js +2 -4
- package/build/components/post-publish-panel/maybe-category-panel.js.map +1 -1
- package/build/components/post-publish-panel/maybe-post-format-panel.js +9 -12
- package/build/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
- package/build/components/post-publish-panel/maybe-tags-panel.js +4 -7
- package/build/components/post-publish-panel/maybe-tags-panel.js.map +1 -1
- package/build/components/post-publish-panel/postpublish.js +8 -11
- package/build/components/post-publish-panel/postpublish.js.map +1 -1
- package/build/components/post-publish-panel/prepublish.js +5 -6
- package/build/components/post-publish-panel/prepublish.js.map +1 -1
- package/build/components/post-saved-state/index.js +13 -8
- package/build/components/post-saved-state/index.js.map +1 -1
- package/build/components/post-schedule/check.js +6 -8
- package/build/components/post-schedule/check.js.map +1 -1
- package/build/components/post-schedule/index.js +8 -12
- package/build/components/post-schedule/index.js.map +1 -1
- package/build/components/post-schedule/label.js +7 -10
- package/build/components/post-schedule/label.js.map +1 -1
- package/build/components/post-slug/check.js +3 -4
- package/build/components/post-slug/check.js.map +1 -1
- package/build/components/post-slug/index.js +5 -6
- package/build/components/post-slug/index.js.map +1 -1
- package/build/components/post-sticky/check.js +7 -9
- package/build/components/post-sticky/check.js.map +1 -1
- package/build/components/post-sticky/index.js +4 -5
- package/build/components/post-sticky/index.js.map +1 -1
- package/build/components/post-switch-to-draft-button/index.js +6 -7
- package/build/components/post-switch-to-draft-button/index.js.map +1 -1
- package/build/components/post-taxonomies/check.js +6 -7
- package/build/components/post-taxonomies/check.js.map +1 -1
- package/build/components/post-taxonomies/flat-term-selector.js +12 -13
- package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
- package/build/components/post-taxonomies/hierarchical-term-selector.js +13 -14
- package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
- package/build/components/post-taxonomies/index.js +6 -11
- package/build/components/post-taxonomies/index.js.map +1 -1
- package/build/components/post-taxonomies/most-used-terms.js +5 -6
- package/build/components/post-taxonomies/most-used-terms.js.map +1 -1
- package/build/components/post-template/index.js +6 -9
- package/build/components/post-template/index.js.map +1 -1
- package/build/components/post-title/index.js +2 -6
- package/build/components/post-title/index.js.map +1 -1
- package/build/components/post-title/index.native.js +8 -11
- package/build/components/post-title/index.native.js.map +1 -1
- package/build/components/post-trash/check.js +7 -9
- package/build/components/post-trash/check.js.map +1 -1
- package/build/components/post-type-support-check/index.js +5 -6
- package/build/components/post-type-support-check/index.js.map +1 -1
- package/build/components/post-url/check.js +4 -5
- package/build/components/post-url/check.js.map +1 -1
- package/build/components/post-url/index.js +8 -9
- package/build/components/post-url/index.js.map +1 -1
- package/build/components/post-visibility/check.js +6 -7
- package/build/components/post-visibility/check.js.map +1 -1
- package/build/components/post-visibility/index.js +10 -12
- package/build/components/post-visibility/index.js.map +1 -1
- package/build/components/post-visibility/label.js +1 -3
- package/build/components/post-visibility/label.js.map +1 -1
- package/build/components/provider/index.js +9 -10
- package/build/components/provider/index.js.map +1 -1
- package/build/components/provider/index.native.js +14 -20
- package/build/components/provider/index.native.js.map +1 -1
- package/build/components/provider/use-block-editor-settings.js +5 -9
- package/build/components/provider/use-block-editor-settings.js.map +1 -1
- package/build/components/provider/use-block-editor-settings.native.js +1 -3
- package/build/components/provider/use-block-editor-settings.native.js.map +1 -1
- package/build/components/table-of-contents/index.js +26 -33
- package/build/components/table-of-contents/index.js.map +1 -1
- package/build/components/table-of-contents/panel.js +4 -5
- package/build/components/table-of-contents/panel.js.map +1 -1
- package/build/components/template-validation-notice/index.js +4 -6
- package/build/components/template-validation-notice/index.js.map +1 -1
- package/build/components/theme-support-check/index.js +7 -8
- package/build/components/theme-support-check/index.js.map +1 -1
- package/build/hooks/custom-sources-backwards-compatibility.js +16 -35
- package/build/hooks/custom-sources-backwards-compatibility.js.map +1 -1
- package/build/hooks/default-autocompleters.js +1 -2
- package/build/hooks/default-autocompleters.js.map +1 -1
- package/build/private-apis.js +4 -1
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +147 -179
- package/build/store/actions.js.map +1 -1
- package/build/store/actions.native.js +1 -2
- package/build/store/actions.native.js.map +1 -1
- package/build/store/reducer.js +14 -44
- package/build/store/reducer.js.map +1 -1
- package/build/store/reducer.native.js +3 -12
- package/build/store/reducer.native.js.map +1 -1
- package/build/store/selectors.js +23 -54
- package/build/store/selectors.js.map +1 -1
- package/build/store/utils/notice-builder.js +3 -3
- package/build/store/utils/notice-builder.js.map +1 -1
- package/build/utils/media-upload/index.js +11 -15
- package/build/utils/media-upload/index.js.map +1 -1
- package/build/utils/terms.js +3 -6
- package/build/utils/terms.js.map +1 -1
- package/build-module/components/autosave-monitor/index.js +1 -2
- package/build-module/components/autosave-monitor/index.js.map +1 -1
- package/build-module/components/deprecated.js +3 -4
- package/build-module/components/deprecated.js.map +1 -1
- package/build-module/components/document-outline/check.js +4 -5
- package/build-module/components/document-outline/check.js.map +1 -1
- package/build-module/components/document-outline/index.js +12 -16
- package/build-module/components/document-outline/index.js.map +1 -1
- package/build-module/components/document-outline/item.js +22 -25
- package/build-module/components/document-outline/item.js.map +1 -1
- package/build-module/components/editor-help/help-detail-navigation-screen.native.js +4 -5
- package/build-module/components/editor-help/help-detail-navigation-screen.native.js.map +1 -1
- package/build-module/components/editor-help/help-get-support-button.native.js +4 -5
- package/build-module/components/editor-help/help-get-support-button.native.js.map +1 -1
- package/build-module/components/editor-help/help-section-title.native.js +3 -4
- package/build-module/components/editor-help/help-section-title.native.js.map +1 -1
- package/build-module/components/editor-help/help-topic-row.native.js +6 -7
- package/build-module/components/editor-help/help-topic-row.native.js.map +1 -1
- package/build-module/components/editor-help/index.native.js +19 -23
- package/build-module/components/editor-help/index.native.js.map +1 -1
- package/build-module/components/editor-help/view-sections.native.js +16 -20
- package/build-module/components/editor-help/view-sections.native.js.map +1 -1
- package/build-module/components/editor-notices/index.js +12 -19
- package/build-module/components/editor-notices/index.js.map +1 -1
- package/build-module/components/editor-snackbars/index.js +3 -6
- package/build-module/components/editor-snackbars/index.js.map +1 -1
- package/build-module/components/entities-saved-states/entity-record-item.js +7 -10
- package/build-module/components/entities-saved-states/entity-record-item.js.map +1 -1
- package/build-module/components/entities-saved-states/entity-type-list.js +6 -7
- package/build-module/components/entities-saved-states/entity-type-list.js.map +1 -1
- package/build-module/components/entities-saved-states/hooks/use-is-dirty.js +70 -0
- package/build-module/components/entities-saved-states/hooks/use-is-dirty.js.map +1 -0
- package/build-module/components/entities-saved-states/index.js +39 -113
- package/build-module/components/entities-saved-states/index.js.map +1 -1
- package/build-module/components/error-boundary/index.js +4 -5
- package/build-module/components/error-boundary/index.js.map +1 -1
- package/build-module/components/global-keyboard-shortcuts/save-shortcut.js +3 -4
- package/build-module/components/global-keyboard-shortcuts/save-shortcut.js.map +1 -1
- package/build-module/components/index.js +1 -0
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/media-categories/index.js +25 -42
- package/build-module/components/media-categories/index.js.map +1 -1
- package/build-module/components/page-attributes/check.js +4 -7
- package/build-module/components/page-attributes/check.js.map +1 -1
- package/build-module/components/page-attributes/order.js +5 -8
- package/build-module/components/page-attributes/order.js.map +1 -1
- package/build-module/components/page-attributes/parent.js +5 -12
- package/build-module/components/page-attributes/parent.js.map +1 -1
- package/build-module/components/post-author/check.js +6 -7
- package/build-module/components/post-author/check.js.map +1 -1
- package/build-module/components/post-author/combobox.js +3 -6
- package/build-module/components/post-author/combobox.js.map +1 -1
- package/build-module/components/post-author/index.js +1 -1
- package/build-module/components/post-author/index.js.map +1 -1
- package/build-module/components/post-comments/index.js +4 -6
- package/build-module/components/post-comments/index.js.map +1 -1
- package/build-module/components/post-excerpt/index.js +4 -5
- package/build-module/components/post-excerpt/index.js.map +1 -1
- package/build-module/components/post-featured-image/index.js +56 -69
- package/build-module/components/post-featured-image/index.js.map +1 -1
- package/build-module/components/post-format/check.js +4 -5
- package/build-module/components/post-format/check.js.map +1 -1
- package/build-module/components/post-format/index.js +1 -1
- package/build-module/components/post-format/index.js.map +1 -1
- package/build-module/components/post-last-revision/check.js +5 -7
- package/build-module/components/post-last-revision/check.js.map +1 -1
- package/build-module/components/post-last-revision/index.js +4 -5
- package/build-module/components/post-last-revision/index.js.map +1 -1
- package/build-module/components/post-locked-modal/index.js +1 -1
- package/build-module/components/post-locked-modal/index.js.map +1 -1
- package/build-module/components/post-pending-status/check.js +7 -9
- package/build-module/components/post-pending-status/check.js.map +1 -1
- package/build-module/components/post-pending-status/index.js +4 -6
- package/build-module/components/post-pending-status/index.js.map +1 -1
- package/build-module/components/post-pingbacks/index.js +4 -6
- package/build-module/components/post-pingbacks/index.js.map +1 -1
- package/build-module/components/post-preview-button/index.js +8 -12
- package/build-module/components/post-preview-button/index.js.map +1 -1
- package/build-module/components/post-publish-button/index.js +6 -13
- package/build-module/components/post-publish-button/index.js.map +1 -1
- package/build-module/components/post-publish-button/label.js +14 -17
- package/build-module/components/post-publish-button/label.js.map +1 -1
- package/build-module/components/post-publish-panel/index.js +6 -7
- package/build-module/components/post-publish-panel/index.js.map +1 -1
- package/build-module/components/post-publish-panel/maybe-category-panel.js +2 -4
- package/build-module/components/post-publish-panel/maybe-category-panel.js.map +1 -1
- package/build-module/components/post-publish-panel/maybe-post-format-panel.js +9 -12
- package/build-module/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
- package/build-module/components/post-publish-panel/maybe-tags-panel.js +4 -7
- package/build-module/components/post-publish-panel/maybe-tags-panel.js.map +1 -1
- package/build-module/components/post-publish-panel/postpublish.js +8 -11
- package/build-module/components/post-publish-panel/postpublish.js.map +1 -1
- package/build-module/components/post-publish-panel/prepublish.js +5 -6
- package/build-module/components/post-publish-panel/prepublish.js.map +1 -1
- package/build-module/components/post-saved-state/index.js +13 -8
- package/build-module/components/post-saved-state/index.js.map +1 -1
- package/build-module/components/post-schedule/check.js +6 -8
- package/build-module/components/post-schedule/check.js.map +1 -1
- package/build-module/components/post-schedule/index.js +8 -12
- package/build-module/components/post-schedule/index.js.map +1 -1
- package/build-module/components/post-schedule/label.js +7 -10
- package/build-module/components/post-schedule/label.js.map +1 -1
- package/build-module/components/post-slug/check.js +3 -4
- package/build-module/components/post-slug/check.js.map +1 -1
- package/build-module/components/post-slug/index.js +5 -6
- package/build-module/components/post-slug/index.js.map +1 -1
- package/build-module/components/post-sticky/check.js +7 -9
- package/build-module/components/post-sticky/check.js.map +1 -1
- package/build-module/components/post-sticky/index.js +4 -5
- package/build-module/components/post-sticky/index.js.map +1 -1
- package/build-module/components/post-switch-to-draft-button/index.js +6 -7
- package/build-module/components/post-switch-to-draft-button/index.js.map +1 -1
- package/build-module/components/post-taxonomies/check.js +6 -7
- package/build-module/components/post-taxonomies/check.js.map +1 -1
- package/build-module/components/post-taxonomies/flat-term-selector.js +12 -13
- package/build-module/components/post-taxonomies/flat-term-selector.js.map +1 -1
- package/build-module/components/post-taxonomies/hierarchical-term-selector.js +13 -14
- package/build-module/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
- package/build-module/components/post-taxonomies/index.js +6 -11
- package/build-module/components/post-taxonomies/index.js.map +1 -1
- package/build-module/components/post-taxonomies/most-used-terms.js +5 -6
- package/build-module/components/post-taxonomies/most-used-terms.js.map +1 -1
- package/build-module/components/post-template/index.js +6 -9
- package/build-module/components/post-template/index.js.map +1 -1
- package/build-module/components/post-title/index.js +2 -6
- package/build-module/components/post-title/index.js.map +1 -1
- package/build-module/components/post-title/index.native.js +8 -11
- package/build-module/components/post-title/index.native.js.map +1 -1
- package/build-module/components/post-trash/check.js +7 -9
- package/build-module/components/post-trash/check.js.map +1 -1
- package/build-module/components/post-type-support-check/index.js +5 -6
- package/build-module/components/post-type-support-check/index.js.map +1 -1
- package/build-module/components/post-url/check.js +4 -5
- package/build-module/components/post-url/check.js.map +1 -1
- package/build-module/components/post-url/index.js +8 -9
- package/build-module/components/post-url/index.js.map +1 -1
- package/build-module/components/post-visibility/check.js +6 -7
- package/build-module/components/post-visibility/check.js.map +1 -1
- package/build-module/components/post-visibility/index.js +10 -12
- package/build-module/components/post-visibility/index.js.map +1 -1
- package/build-module/components/post-visibility/label.js +1 -3
- package/build-module/components/post-visibility/label.js.map +1 -1
- package/build-module/components/provider/index.js +9 -10
- package/build-module/components/provider/index.js.map +1 -1
- package/build-module/components/provider/index.native.js +14 -20
- package/build-module/components/provider/index.native.js.map +1 -1
- package/build-module/components/provider/use-block-editor-settings.js +5 -9
- package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
- package/build-module/components/provider/use-block-editor-settings.native.js +1 -3
- package/build-module/components/provider/use-block-editor-settings.native.js.map +1 -1
- package/build-module/components/table-of-contents/index.js +26 -33
- package/build-module/components/table-of-contents/index.js.map +1 -1
- package/build-module/components/table-of-contents/panel.js +4 -5
- package/build-module/components/table-of-contents/panel.js.map +1 -1
- package/build-module/components/template-validation-notice/index.js +4 -6
- package/build-module/components/template-validation-notice/index.js.map +1 -1
- package/build-module/components/theme-support-check/index.js +7 -8
- package/build-module/components/theme-support-check/index.js.map +1 -1
- package/build-module/hooks/custom-sources-backwards-compatibility.js +16 -35
- package/build-module/hooks/custom-sources-backwards-compatibility.js.map +1 -1
- package/build-module/hooks/default-autocompleters.js +1 -2
- package/build-module/hooks/default-autocompleters.js.map +1 -1
- package/build-module/private-apis.js +3 -1
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/actions.js +147 -179
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/actions.native.js +1 -2
- package/build-module/store/actions.native.js.map +1 -1
- package/build-module/store/reducer.js +14 -44
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/reducer.native.js +3 -12
- package/build-module/store/reducer.native.js.map +1 -1
- package/build-module/store/selectors.js +21 -54
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/store/utils/notice-builder.js +3 -3
- package/build-module/store/utils/notice-builder.js.map +1 -1
- package/build-module/utils/media-upload/index.js +11 -15
- package/build-module/utils/media-upload/index.js.map +1 -1
- package/build-module/utils/terms.js +3 -6
- package/build-module/utils/terms.js.map +1 -1
- package/package.json +30 -30
- package/src/components/entities-saved-states/hooks/use-is-dirty.js +85 -0
- package/src/components/entities-saved-states/index.js +25 -106
- package/src/components/entities-saved-states/test/use-is-dirty.js +94 -0
- package/src/components/index.js +1 -0
- package/src/components/post-saved-state/index.js +6 -0
- package/src/components/post-title/index.js +2 -1
- package/src/private-apis.js +2 -0
|
@@ -74,10 +74,7 @@ export function shouldOverwriteState(action, previousAction) {
|
|
|
74
74
|
|
|
75
75
|
return isUpdatingSamePostProperty(action, previousAction);
|
|
76
76
|
}
|
|
77
|
-
export function postId() {
|
|
78
|
-
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
79
|
-
let action = arguments.length > 1 ? arguments[1] : undefined;
|
|
80
|
-
|
|
77
|
+
export function postId(state = null, action) {
|
|
81
78
|
switch (action.type) {
|
|
82
79
|
case 'SETUP_EDITOR_STATE':
|
|
83
80
|
return action.post.id;
|
|
@@ -85,10 +82,7 @@ export function postId() {
|
|
|
85
82
|
|
|
86
83
|
return state;
|
|
87
84
|
}
|
|
88
|
-
export function postType() {
|
|
89
|
-
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
90
|
-
let action = arguments.length > 1 ? arguments[1] : undefined;
|
|
91
|
-
|
|
85
|
+
export function postType(state = null, action) {
|
|
92
86
|
switch (action.type) {
|
|
93
87
|
case 'SETUP_EDITOR_STATE':
|
|
94
88
|
return action.post.type;
|
|
@@ -105,12 +99,9 @@ export function postType() {
|
|
|
105
99
|
* @return {boolean} Updated state.
|
|
106
100
|
*/
|
|
107
101
|
|
|
108
|
-
export function template(
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
};
|
|
112
|
-
let action = arguments.length > 1 ? arguments[1] : undefined;
|
|
113
|
-
|
|
102
|
+
export function template(state = {
|
|
103
|
+
isValid: true
|
|
104
|
+
}, action) {
|
|
114
105
|
switch (action.type) {
|
|
115
106
|
case 'SET_TEMPLATE_VALIDITY':
|
|
116
107
|
return { ...state,
|
|
@@ -130,10 +121,7 @@ export function template() {
|
|
|
130
121
|
* @return {Object} Updated state.
|
|
131
122
|
*/
|
|
132
123
|
|
|
133
|
-
export function saving() {
|
|
134
|
-
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
135
|
-
let action = arguments.length > 1 ? arguments[1] : undefined;
|
|
136
|
-
|
|
124
|
+
export function saving(state = {}, action) {
|
|
137
125
|
switch (action.type) {
|
|
138
126
|
case 'REQUEST_POST_UPDATE_START':
|
|
139
127
|
case 'REQUEST_POST_UPDATE_FINISH':
|
|
@@ -154,10 +142,7 @@ export function saving() {
|
|
|
154
142
|
* @return {Object} Updated state.
|
|
155
143
|
*/
|
|
156
144
|
|
|
157
|
-
export function deleting() {
|
|
158
|
-
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
159
|
-
let action = arguments.length > 1 ? arguments[1] : undefined;
|
|
160
|
-
|
|
145
|
+
export function deleting(state = {}, action) {
|
|
161
146
|
switch (action.type) {
|
|
162
147
|
case 'REQUEST_POST_DELETE_START':
|
|
163
148
|
case 'REQUEST_POST_DELETE_FINISH':
|
|
@@ -188,12 +173,9 @@ export function deleting() {
|
|
|
188
173
|
* @return {PostLockState} Updated state.
|
|
189
174
|
*/
|
|
190
175
|
|
|
191
|
-
export function postLock(
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
};
|
|
195
|
-
let action = arguments.length > 1 ? arguments[1] : undefined;
|
|
196
|
-
|
|
176
|
+
export function postLock(state = {
|
|
177
|
+
isLocked: false
|
|
178
|
+
}, action) {
|
|
197
179
|
switch (action.type) {
|
|
198
180
|
case 'UPDATE_POST_LOCK':
|
|
199
181
|
return action.lock;
|
|
@@ -212,10 +194,7 @@ export function postLock() {
|
|
|
212
194
|
* @return {PostLockState} Updated state.
|
|
213
195
|
*/
|
|
214
196
|
|
|
215
|
-
export function postSavingLock() {
|
|
216
|
-
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
217
|
-
let action = arguments.length > 1 ? arguments[1] : undefined;
|
|
218
|
-
|
|
197
|
+
export function postSavingLock(state = {}, action) {
|
|
219
198
|
switch (action.type) {
|
|
220
199
|
case 'LOCK_POST_SAVING':
|
|
221
200
|
return { ...state,
|
|
@@ -245,10 +224,7 @@ export function postSavingLock() {
|
|
|
245
224
|
* @return {PostLockState} Updated state.
|
|
246
225
|
*/
|
|
247
226
|
|
|
248
|
-
export function postAutosavingLock() {
|
|
249
|
-
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
250
|
-
let action = arguments.length > 1 ? arguments[1] : undefined;
|
|
251
|
-
|
|
227
|
+
export function postAutosavingLock(state = {}, action) {
|
|
252
228
|
switch (action.type) {
|
|
253
229
|
case 'LOCK_POST_AUTOSAVING':
|
|
254
230
|
return { ...state,
|
|
@@ -278,10 +254,7 @@ export function postAutosavingLock() {
|
|
|
278
254
|
* @return {boolean} Updated state.
|
|
279
255
|
*/
|
|
280
256
|
|
|
281
|
-
export function isReady() {
|
|
282
|
-
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
283
|
-
let action = arguments.length > 1 ? arguments[1] : undefined;
|
|
284
|
-
|
|
257
|
+
export function isReady(state = false, action) {
|
|
285
258
|
switch (action.type) {
|
|
286
259
|
case 'SETUP_EDITOR_STATE':
|
|
287
260
|
return true;
|
|
@@ -301,10 +274,7 @@ export function isReady() {
|
|
|
301
274
|
* @return {Object} Updated state.
|
|
302
275
|
*/
|
|
303
276
|
|
|
304
|
-
export function editorSettings() {
|
|
305
|
-
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : EDITOR_SETTINGS_DEFAULTS;
|
|
306
|
-
let action = arguments.length > 1 ? arguments[1] : undefined;
|
|
307
|
-
|
|
277
|
+
export function editorSettings(state = EDITOR_SETTINGS_DEFAULTS, action) {
|
|
308
278
|
switch (action.type) {
|
|
309
279
|
case 'UPDATE_EDITOR_SETTINGS':
|
|
310
280
|
return { ...state,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/store/reducer.js"],"names":["combineReducers","EDITOR_SETTINGS_DEFAULTS","getPostRawValue","value","raw","hasSameKeys","a","b","keysA","Object","keys","sort","keysB","length","every","key","index","isUpdatingSamePostProperty","action","previousAction","type","edits","shouldOverwriteState","shouldCreateUndoLevel","postId","state","post","id","postType","template","isValid","saving","pending","options","deleting","postLock","isLocked","lock","postSavingLock","lockName","removedLockName","restState","postAutosavingLock","isReady","editorSettings","settings"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,eAAT,QAAgC,iBAAhC;AAEA;AACA;AACA;;AACA,SAASC,wBAAT,QAAyC,YAAzC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,eAAT,CAA0BC,KAA1B,EAAkC;AACxC,MAAKA,KAAK,IAAI,aAAa,OAAOA,KAA7B,IAAsC,SAASA,KAApD,EAA4D;AAC3D,WAAOA,KAAK,CAACC,GAAb;AACA;;AAED,SAAOD,KAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASE,WAAT,CAAsBC,CAAtB,EAAyBC,CAAzB,EAA6B;AACnC,QAAMC,KAAK,GAAGC,MAAM,CAACC,IAAP,CAAaJ,CAAb,EAAiBK,IAAjB,EAAd;AACA,QAAMC,KAAK,GAAGH,MAAM,CAACC,IAAP,CAAaH,CAAb,EAAiBI,IAAjB,EAAd;AACA,SACCH,KAAK,CAACK,MAAN,KAAiBD,KAAK,CAACC,MAAvB,IACAL,KAAK,CAACM,KAAN,CAAa,CAAEC,GAAF,EAAOC,KAAP,KAAkBJ,KAAK,CAAEI,KAAF,CAAL,KAAmBD,GAAlD,CAFD;AAIA;AAED;AACA;AACA;AACA;AACA;AACA;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WAAGP,MAAM,CAAC2B;AAFJ,OAAP;AAFF;;AAQA,SAAOpB,KAAP;AACA;AAED,eAAezB,eAAe,CAAE;AAC/BwB,EAAAA,MAD+B;AAE/BI,EAAAA,QAF+B;AAG/BG,EAAAA,MAH+B;AAI/BG,EAAAA,QAJ+B;AAK/BC,EAAAA,QAL+B;AAM/BN,EAAAA,QAN+B;AAO/BS,EAAAA,cAP+B;AAQ/BK,EAAAA,OAR+B;AAS/BC,EAAAA,cAT+B;AAU/BF,EAAAA;AAV+B,CAAF,CAA9B","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { EDITOR_SETTINGS_DEFAULTS } from './defaults';\n\n/**\n * Returns a post attribute value, flattening nested rendered content using its\n * raw value in place of its original object form.\n *\n * @param {*} value Original value.\n *\n * @return {*} Raw value.\n */\nexport function getPostRawValue( value ) {\n\tif ( value && 'object' === typeof value && 'raw' in value ) {\n\t\treturn value.raw;\n\t}\n\n\treturn value;\n}\n\n/**\n * Returns true if the two object arguments have the same keys, or false\n * otherwise.\n *\n * @param {Object} a First object.\n * @param {Object} b Second object.\n *\n * @return {boolean} Whether the two objects have the same keys.\n */\nexport function hasSameKeys( a, b ) {\n\tconst keysA = Object.keys( a ).sort();\n\tconst keysB = Object.keys( b ).sort();\n\treturn (\n\t\tkeysA.length === keysB.length &&\n\t\tkeysA.every( ( key, index ) => keysB[ index ] === key )\n\t);\n}\n\n/**\n * Returns true if, given the currently dispatching action and the previously\n * dispatched action, the two actions are editing the same post property, or\n * false otherwise.\n *\n * @param {Object} action Currently dispatching action.\n * @param {Object} previousAction Previously dispatched action.\n *\n * @return {boolean} Whether actions are updating the same post property.\n */\nexport function isUpdatingSamePostProperty( action, previousAction ) {\n\treturn (\n\t\taction.type === 'EDIT_POST' &&\n\t\thasSameKeys( action.edits, previousAction.edits )\n\t);\n}\n\n/**\n * Returns true if, given the currently dispatching action and the previously\n * dispatched action, the two actions are modifying the same property such that\n * undo history should be batched.\n *\n * @param {Object} action Currently dispatching action.\n * @param {Object} previousAction Previously dispatched action.\n *\n * @return {boolean} Whether to overwrite present state.\n */\nexport function shouldOverwriteState( action, previousAction ) {\n\tif ( action.type === 'RESET_EDITOR_BLOCKS' ) {\n\t\treturn ! action.shouldCreateUndoLevel;\n\t}\n\n\tif ( ! previousAction || action.type !== previousAction.type ) {\n\t\treturn false;\n\t}\n\n\treturn isUpdatingSamePostProperty( action, previousAction );\n}\n\nexport function postId( state = null, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SETUP_EDITOR_STATE':\n\t\t\treturn action.post.id;\n\t}\n\n\treturn state;\n}\n\nexport function postType( state = null, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SETUP_EDITOR_STATE':\n\t\t\treturn action.post.type;\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer returning whether the post blocks match the defined template or not.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {boolean} Updated state.\n */\nexport function template( state = { isValid: true }, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_TEMPLATE_VALIDITY':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tisValid: action.isValid,\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer returning current network request state (whether a request to\n * the WP REST API is in progress, successful, or failed).\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function saving( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'REQUEST_POST_UPDATE_START':\n\t\tcase 'REQUEST_POST_UPDATE_FINISH':\n\t\t\treturn {\n\t\t\t\tpending: action.type === 'REQUEST_POST_UPDATE_START',\n\t\t\t\toptions: action.options || {},\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer returning deleting post request state.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function deleting( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'REQUEST_POST_DELETE_START':\n\t\tcase 'REQUEST_POST_DELETE_FINISH':\n\t\t\treturn {\n\t\t\t\tpending: action.type === 'REQUEST_POST_DELETE_START',\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\n/**\n * Post Lock State.\n *\n * @typedef {Object} PostLockState\n *\n * @property {boolean} isLocked Whether the post is locked.\n * @property {?boolean} isTakeover Whether the post editing has been taken over.\n * @property {?boolean} activePostLock Active post lock value.\n * @property {?Object} user User that took over the post.\n */\n\n/**\n * Reducer returning the post lock status.\n *\n * @param {PostLockState} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {PostLockState} Updated state.\n */\nexport function postLock( state = { isLocked: false }, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'UPDATE_POST_LOCK':\n\t\t\treturn action.lock;\n\t}\n\n\treturn state;\n}\n\n/**\n * Post saving lock.\n *\n * When post saving is locked, the post cannot be published or updated.\n *\n * @param {PostLockState} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {PostLockState} Updated state.\n */\nexport function postSavingLock( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'LOCK_POST_SAVING':\n\t\t\treturn { ...state, [ action.lockName ]: true };\n\n\t\tcase 'UNLOCK_POST_SAVING': {\n\t\t\tconst { [ action.lockName ]: removedLockName, ...restState } =\n\t\t\t\tstate;\n\t\t\treturn restState;\n\t\t}\n\t}\n\treturn state;\n}\n\n/**\n * Post autosaving lock.\n *\n * When post autosaving is locked, the post will not autosave.\n *\n * @param {PostLockState} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {PostLockState} Updated state.\n */\nexport function postAutosavingLock( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'LOCK_POST_AUTOSAVING':\n\t\t\treturn { ...state, [ action.lockName ]: true };\n\n\t\tcase 'UNLOCK_POST_AUTOSAVING': {\n\t\t\tconst { [ action.lockName ]: removedLockName, ...restState } =\n\t\t\t\tstate;\n\t\t\treturn restState;\n\t\t}\n\t}\n\treturn state;\n}\n\n/**\n * Reducer returning whether the editor is ready to be rendered.\n * The editor is considered ready to be rendered once\n * the post object is loaded properly and the initial blocks parsed.\n *\n * @param {boolean} state\n * @param {Object} action\n *\n * @return {boolean} Updated state.\n */\nexport function isReady( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SETUP_EDITOR_STATE':\n\t\t\treturn true;\n\n\t\tcase 'TEAR_DOWN_EDITOR':\n\t\t\treturn false;\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer returning the post editor setting.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function editorSettings( state = EDITOR_SETTINGS_DEFAULTS, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'UPDATE_EDITOR_SETTINGS':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t...action.settings,\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\nexport default combineReducers( {\n\tpostId,\n\tpostType,\n\tsaving,\n\tdeleting,\n\tpostLock,\n\ttemplate,\n\tpostSavingLock,\n\tisReady,\n\teditorSettings,\n\tpostAutosavingLock,\n} );\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/store/reducer.js"],"names":["combineReducers","EDITOR_SETTINGS_DEFAULTS","getPostRawValue","value","raw","hasSameKeys","a","b","keysA","Object","keys","sort","keysB","length","every","key","index","isUpdatingSamePostProperty","action","previousAction","type","edits","shouldOverwriteState","shouldCreateUndoLevel","postId","state","post","id","postType","template","isValid","saving","pending","options","deleting","postLock","isLocked","lock","postSavingLock","lockName","removedLockName","restState","postAutosavingLock","isReady","editorSettings","settings"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,eAAT,QAAgC,iBAAhC;AAEA;AACA;AACA;;AACA,SAASC,wBAAT,QAAyC,YAAzC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,eAAT,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AAOgB,SAAP;AACA;AARF;;AAUA,SAAOhB,KAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASkB,OAAT,CAAkBlB,KAAK,GAAG,KAA1B,EAAiCP,MAAjC,EAA0C;AAChD,UAASA,MAAM,CAACE,IAAhB;AACC,SAAK,oBAAL;AACC,aAAO,IAAP;;AAED,SAAK,kBAAL;AACC,aAAO,KAAP;AALF;;AAQA,SAAOK,KAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASmB,cAAT,CAAyBnB,KAAK,GAAGxB,wBAAjC,EAA2DiB,MAA3D,EAAoE;AAC1E,UAASA,MAAM,CAACE,IAAhB;AACC,SAAK,wBAAL;AACC,aAAO,EACN,GAAGK,KADG;AAEN,WAAGP,MAAM,CAAC2B;AAFJ,OAAP;AAFF;;AAQA,SAAOpB,KAAP;AACA;AAED,eAAezB,eAAe,CAAE;AAC/BwB,EAAAA,MAD+B;AAE/BI,EAAAA,QAF+B;AAG/BG,EAAAA,MAH+B;AAI/BG,EAAAA,QAJ+B;AAK/BC,EAAAA,QAL+B;AAM/BN,EAAAA,QAN+B;AAO/BS,EAAAA,cAP+B;AAQ/BK,EAAAA,OAR+B;AAS/BC,EAAAA,cAT+B;AAU/BF,EAAAA;AAV+B,CAAF,CAA9B","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { EDITOR_SETTINGS_DEFAULTS } from './defaults';\n\n/**\n * Returns a post attribute value, flattening nested rendered content using its\n * raw value in place of its original object form.\n *\n * @param {*} value Original value.\n *\n * @return {*} Raw value.\n */\nexport function getPostRawValue( value ) {\n\tif ( value && 'object' === typeof value && 'raw' in value ) {\n\t\treturn value.raw;\n\t}\n\n\treturn value;\n}\n\n/**\n * Returns true if the two object arguments have the same keys, or false\n * otherwise.\n *\n * @param {Object} a First object.\n * @param {Object} b Second object.\n *\n * @return {boolean} Whether the two objects have the same keys.\n */\nexport function hasSameKeys( a, b ) {\n\tconst keysA = Object.keys( a ).sort();\n\tconst keysB = Object.keys( b ).sort();\n\treturn (\n\t\tkeysA.length === keysB.length &&\n\t\tkeysA.every( ( key, index ) => keysB[ index ] === key )\n\t);\n}\n\n/**\n * Returns true if, given the currently dispatching action and the previously\n * dispatched action, the two actions are editing the same post property, or\n * false otherwise.\n *\n * @param {Object} action Currently dispatching action.\n * @param {Object} previousAction Previously dispatched action.\n *\n * @return {boolean} Whether actions are updating the same post property.\n */\nexport function isUpdatingSamePostProperty( action, previousAction ) {\n\treturn (\n\t\taction.type === 'EDIT_POST' &&\n\t\thasSameKeys( action.edits, previousAction.edits )\n\t);\n}\n\n/**\n * Returns true if, given the currently dispatching action and the previously\n * dispatched action, the two actions are modifying the same property such that\n * undo history should be batched.\n *\n * @param {Object} action Currently dispatching action.\n * @param {Object} previousAction Previously dispatched action.\n *\n * @return {boolean} Whether to overwrite present state.\n */\nexport function shouldOverwriteState( action, previousAction ) {\n\tif ( action.type === 'RESET_EDITOR_BLOCKS' ) {\n\t\treturn ! action.shouldCreateUndoLevel;\n\t}\n\n\tif ( ! previousAction || action.type !== previousAction.type ) {\n\t\treturn false;\n\t}\n\n\treturn isUpdatingSamePostProperty( action, previousAction );\n}\n\nexport function postId( state = null, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SETUP_EDITOR_STATE':\n\t\t\treturn action.post.id;\n\t}\n\n\treturn state;\n}\n\nexport function postType( state = null, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SETUP_EDITOR_STATE':\n\t\t\treturn action.post.type;\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer returning whether the post blocks match the defined template or not.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {boolean} Updated state.\n */\nexport function template( state = { isValid: true }, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_TEMPLATE_VALIDITY':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tisValid: action.isValid,\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer returning current network request state (whether a request to\n * the WP REST API is in progress, successful, or failed).\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function saving( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'REQUEST_POST_UPDATE_START':\n\t\tcase 'REQUEST_POST_UPDATE_FINISH':\n\t\t\treturn {\n\t\t\t\tpending: action.type === 'REQUEST_POST_UPDATE_START',\n\t\t\t\toptions: action.options || {},\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer returning deleting post request state.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function deleting( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'REQUEST_POST_DELETE_START':\n\t\tcase 'REQUEST_POST_DELETE_FINISH':\n\t\t\treturn {\n\t\t\t\tpending: action.type === 'REQUEST_POST_DELETE_START',\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\n/**\n * Post Lock State.\n *\n * @typedef {Object} PostLockState\n *\n * @property {boolean} isLocked Whether the post is locked.\n * @property {?boolean} isTakeover Whether the post editing has been taken over.\n * @property {?boolean} activePostLock Active post lock value.\n * @property {?Object} user User that took over the post.\n */\n\n/**\n * Reducer returning the post lock status.\n *\n * @param {PostLockState} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {PostLockState} Updated state.\n */\nexport function postLock( state = { isLocked: false }, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'UPDATE_POST_LOCK':\n\t\t\treturn action.lock;\n\t}\n\n\treturn state;\n}\n\n/**\n * Post saving lock.\n *\n * When post saving is locked, the post cannot be published or updated.\n *\n * @param {PostLockState} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {PostLockState} Updated state.\n */\nexport function postSavingLock( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'LOCK_POST_SAVING':\n\t\t\treturn { ...state, [ action.lockName ]: true };\n\n\t\tcase 'UNLOCK_POST_SAVING': {\n\t\t\tconst { [ action.lockName ]: removedLockName, ...restState } =\n\t\t\t\tstate;\n\t\t\treturn restState;\n\t\t}\n\t}\n\treturn state;\n}\n\n/**\n * Post autosaving lock.\n *\n * When post autosaving is locked, the post will not autosave.\n *\n * @param {PostLockState} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {PostLockState} Updated state.\n */\nexport function postAutosavingLock( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'LOCK_POST_AUTOSAVING':\n\t\t\treturn { ...state, [ action.lockName ]: true };\n\n\t\tcase 'UNLOCK_POST_AUTOSAVING': {\n\t\t\tconst { [ action.lockName ]: removedLockName, ...restState } =\n\t\t\t\tstate;\n\t\t\treturn restState;\n\t\t}\n\t}\n\treturn state;\n}\n\n/**\n * Reducer returning whether the editor is ready to be rendered.\n * The editor is considered ready to be rendered once\n * the post object is loaded properly and the initial blocks parsed.\n *\n * @param {boolean} state\n * @param {Object} action\n *\n * @return {boolean} Updated state.\n */\nexport function isReady( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SETUP_EDITOR_STATE':\n\t\t\treturn true;\n\n\t\tcase 'TEAR_DOWN_EDITOR':\n\t\t\treturn false;\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer returning the post editor setting.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function editorSettings( state = EDITOR_SETTINGS_DEFAULTS, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'UPDATE_EDITOR_SETTINGS':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t...action.settings,\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\nexport default combineReducers( {\n\tpostId,\n\tpostType,\n\tsaving,\n\tdeleting,\n\tpostLock,\n\ttemplate,\n\tpostSavingLock,\n\tisReady,\n\teditorSettings,\n\tpostAutosavingLock,\n} );\n"]}
|
|
@@ -21,10 +21,7 @@ export * from './reducer.js';
|
|
|
21
21
|
*/
|
|
22
22
|
|
|
23
23
|
export const postTitle = combineReducers({
|
|
24
|
-
isSelected() {
|
|
25
|
-
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
26
|
-
let action = arguments.length > 1 ? arguments[1] : undefined;
|
|
27
|
-
|
|
24
|
+
isSelected(state = false, action) {
|
|
28
25
|
switch (action.type) {
|
|
29
26
|
case 'TOGGLE_POST_TITLE_SELECTION':
|
|
30
27
|
return action.isSelected;
|
|
@@ -43,10 +40,7 @@ export const postTitle = combineReducers({
|
|
|
43
40
|
* @return {Object} Updated state.
|
|
44
41
|
*/
|
|
45
42
|
|
|
46
|
-
export function clipboard() {
|
|
47
|
-
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
48
|
-
let action = arguments.length > 1 ? arguments[1] : undefined;
|
|
49
|
-
|
|
43
|
+
export function clipboard(state = null, action) {
|
|
50
44
|
switch (action.type) {
|
|
51
45
|
case 'UPDATE_CLIPBOARD':
|
|
52
46
|
return action.clipboard;
|
|
@@ -63,10 +57,7 @@ export function clipboard() {
|
|
|
63
57
|
* @return {Object} Updated state.
|
|
64
58
|
*/
|
|
65
59
|
|
|
66
|
-
export function notices() {
|
|
67
|
-
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
68
|
-
let action = arguments.length > 1 ? arguments[1] : undefined;
|
|
69
|
-
|
|
60
|
+
export function notices(state = [], action) {
|
|
70
61
|
switch (action.type) {
|
|
71
62
|
case 'CREATE_NOTICE':
|
|
72
63
|
return [...state, action.notice];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/store/reducer.native.js"],"names":["combineReducers","postId","postType","saving","postLock","postSavingLock","template","isReady","editorSettings","EDITOR_SETTINGS_DEFAULTS","autosaveInterval","postTitle","isSelected","state","action","type","clipboard","notices","notice","filter","id"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,eAAT,QAAgC,iBAAhC;AAEA;AACA;AACA;;AACA,SACCC,MADD,EAECC,QAFD,EAGCC,MAHD,EAICC,QAJD,EAKCC,cALD,EAMCC,QAND,EAOCC,OAPD,EAQCC,cARD,QASO,cATP;AAWA,SAASC,wBAAT,QAAyC,eAAzC;AAEAA,wBAAwB,CAACC,gBAAzB,GAA4C,CAA5C,C,CAA+C;;AAE/C,cAAc,cAAd;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,SAAS,GAAGX,eAAe,CAAE;AACzCY,EAAAA,UAAU,
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/store/reducer.native.js"],"names":["combineReducers","postId","postType","saving","postLock","postSavingLock","template","isReady","editorSettings","EDITOR_SETTINGS_DEFAULTS","autosaveInterval","postTitle","isSelected","state","action","type","clipboard","notices","notice","filter","id"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,eAAT,QAAgC,iBAAhC;AAEA;AACA;AACA;;AACA,SACCC,MADD,EAECC,QAFD,EAGCC,MAHD,EAICC,QAJD,EAKCC,cALD,EAMCC,QAND,EAOCC,OAPD,EAQCC,cARD,QASO,cATP;AAWA,SAASC,wBAAT,QAAyC,eAAzC;AAEAA,wBAAwB,CAACC,gBAAzB,GAA4C,CAA5C,C,CAA+C;;AAE/C,cAAc,cAAd;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,SAAS,GAAGX,eAAe,CAAE;AACzCY,EAAAA,UAAU,CAAEC,KAAK,GAAG,KAAV,EAAiBC,MAAjB,EAA0B;AACnC,YAASA,MAAM,CAACC,IAAhB;AACC,WAAK,6BAAL;AACC,eAAOD,MAAM,CAACF,UAAd;AAFF;;AAKA,WAAOC,KAAP;AACA;;AARwC,CAAF,CAAjC;AAWP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASG,SAAT,CAAoBH,KAAK,GAAG,IAA5B,EAAkCC,MAAlC,EAA2C;AACjD,UAASA,MAAM,CAACC,IAAhB;AACC,SAAK,kBAAL;AACC,aAAOD,MAAM,CAACE,SAAd;AAFF;;AAKA,SAAOH,KAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASI,OAAT,CAAkBJ,KAAK,GAAG,EAA1B,EAA8BC,MAA9B,EAAuC;AAC7C,UAASA,MAAM,CAACC,IAAhB;AACC,SAAK,eAAL;AACC,aAAO,CAAE,GAAGF,KAAL,EAAYC,MAAM,CAACI,MAAnB,CAAP;;AACD,SAAK,oBAAL;AACC,aAAO,EAAP;;AACD,SAAK,eAAL;AACC,aAAOL,KAAK,CAACM,MAAN,CAAgBD,MAAF,IAAcA,MAAM,CAACE,EAAP,KAAcN,MAAM,CAACM,EAAjD,CAAP;AANF;;AAQA,SAAOP,KAAP;AACA;AAED,eAAeb,eAAe,CAAE;AAC/BC,EAAAA,MAD+B;AAE/BC,EAAAA,QAF+B;AAG/BS,EAAAA,SAH+B;AAI/BR,EAAAA,MAJ+B;AAK/BC,EAAAA,QAL+B;AAM/BC,EAAAA,cAN+B;AAO/BC,EAAAA,QAP+B;AAQ/BC,EAAAA,OAR+B;AAS/BC,EAAAA,cAT+B;AAU/BQ,EAAAA,SAV+B;AAW/BC,EAAAA;AAX+B,CAAF,CAA9B","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport {\n\tpostId,\n\tpostType,\n\tsaving,\n\tpostLock,\n\tpostSavingLock,\n\ttemplate,\n\tisReady,\n\teditorSettings,\n} from './reducer.js';\n\nimport { EDITOR_SETTINGS_DEFAULTS } from './defaults.js';\n\nEDITOR_SETTINGS_DEFAULTS.autosaveInterval = 1; // This is a way to override default behavior on mobile, and make it ping the native save every second as long as something changed\n\nexport * from './reducer.js';\n\n/**\n * Reducer returning the post title state.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport const postTitle = combineReducers( {\n\tisSelected( state = false, action ) {\n\t\tswitch ( action.type ) {\n\t\t\tcase 'TOGGLE_POST_TITLE_SELECTION':\n\t\t\t\treturn action.isSelected;\n\t\t}\n\n\t\treturn state;\n\t},\n} );\n\n/**\n * Reducer returning the clipboard state.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function clipboard( state = null, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'UPDATE_CLIPBOARD':\n\t\t\treturn action.clipboard;\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer returning the notices state.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function notices( state = [], action ) {\n\tswitch ( action.type ) {\n\t\tcase 'CREATE_NOTICE':\n\t\t\treturn [ ...state, action.notice ];\n\t\tcase 'REMOVE_ALL_NOTICES':\n\t\t\treturn [];\n\t\tcase 'REMOVE_NOTICE':\n\t\t\treturn state.filter( ( notice ) => notice.id !== action.id );\n\t}\n\treturn state;\n}\n\nexport default combineReducers( {\n\tpostId,\n\tpostType,\n\tpostTitle,\n\tsaving,\n\tpostLock,\n\tpostSavingLock,\n\ttemplate,\n\tisReady,\n\teditorSettings,\n\tclipboard,\n\tnotices,\n} );\n"]}
|
|
@@ -196,9 +196,9 @@ export function getCurrentPostId(state) {
|
|
|
196
196
|
*/
|
|
197
197
|
|
|
198
198
|
export function getCurrentPostRevisionsCount(state) {
|
|
199
|
-
var _getCurrentPost$_link
|
|
199
|
+
var _getCurrentPost$_link;
|
|
200
200
|
|
|
201
|
-
return (_getCurrentPost$_link =
|
|
201
|
+
return (_getCurrentPost$_link = getCurrentPost(state)._links?.['version-history']?.[0]?.count) !== null && _getCurrentPost$_link !== void 0 ? _getCurrentPost$_link : 0;
|
|
202
202
|
}
|
|
203
203
|
/**
|
|
204
204
|
* Returns the last revision ID of the post currently being edited,
|
|
@@ -210,9 +210,9 @@ export function getCurrentPostRevisionsCount(state) {
|
|
|
210
210
|
*/
|
|
211
211
|
|
|
212
212
|
export function getCurrentPostLastRevisionId(state) {
|
|
213
|
-
var _getCurrentPost$
|
|
213
|
+
var _getCurrentPost$_link2;
|
|
214
214
|
|
|
215
|
-
return (_getCurrentPost$
|
|
215
|
+
return (_getCurrentPost$_link2 = getCurrentPost(state)._links?.['predecessor-version']?.[0]?.id) !== null && _getCurrentPost$_link2 !== void 0 ? _getCurrentPost$_link2 : null;
|
|
216
216
|
}
|
|
217
217
|
/**
|
|
218
218
|
* Returns any post values which have been changed in the editor but not yet
|
|
@@ -326,15 +326,13 @@ export function getEditedPostAttribute(state, attributeName) {
|
|
|
326
326
|
*/
|
|
327
327
|
|
|
328
328
|
export const getAutosaveAttribute = createRegistrySelector(select => (state, attributeName) => {
|
|
329
|
-
var _select$getCurrentUse;
|
|
330
|
-
|
|
331
329
|
if (!AUTOSAVE_PROPERTIES.includes(attributeName) && attributeName !== 'preview_link') {
|
|
332
330
|
return;
|
|
333
331
|
}
|
|
334
332
|
|
|
335
333
|
const postType = getCurrentPostType(state);
|
|
336
334
|
const postId = getCurrentPostId(state);
|
|
337
|
-
const currentUserId =
|
|
335
|
+
const currentUserId = select(coreStore).getCurrentUser()?.id;
|
|
338
336
|
const autosave = select(coreStore).getAutosave(postType, postId, currentUserId);
|
|
339
337
|
|
|
340
338
|
if (autosave) {
|
|
@@ -499,8 +497,6 @@ export function isEditedPostEmpty(state) {
|
|
|
499
497
|
*/
|
|
500
498
|
|
|
501
499
|
export const isEditedPostAutosaveable = createRegistrySelector(select => state => {
|
|
502
|
-
var _select$getCurrentUse2;
|
|
503
|
-
|
|
504
500
|
// A post must contain a title, an excerpt, or non-empty content to be valid for autosaving.
|
|
505
501
|
if (!isEditedPostSaveable(state)) {
|
|
506
502
|
return false;
|
|
@@ -514,7 +510,7 @@ export const isEditedPostAutosaveable = createRegistrySelector(select => state =
|
|
|
514
510
|
const postType = getCurrentPostType(state);
|
|
515
511
|
const postId = getCurrentPostId(state);
|
|
516
512
|
const hasFetchedAutosave = select(coreStore).hasFetchedAutosaves(postType, postId);
|
|
517
|
-
const currentUserId =
|
|
513
|
+
const currentUserId = select(coreStore).getCurrentUser()?.id; // Disable reason - this line causes the side-effect of fetching the autosave
|
|
518
514
|
// via a resolver, moving below the return would result in the autosave never
|
|
519
515
|
// being fetched.
|
|
520
516
|
// eslint-disable-next-line @wordpress/no-unused-vars-before-return
|
|
@@ -664,13 +660,11 @@ export const didPostSaveRequestFail = createRegistrySelector(select => state =>
|
|
|
664
660
|
*/
|
|
665
661
|
|
|
666
662
|
export function isAutosavingPost(state) {
|
|
667
|
-
var _state$saving$options;
|
|
668
|
-
|
|
669
663
|
if (!isSavingPost(state)) {
|
|
670
664
|
return false;
|
|
671
665
|
}
|
|
672
666
|
|
|
673
|
-
return Boolean(
|
|
667
|
+
return Boolean(state.saving.options?.isAutosave);
|
|
674
668
|
}
|
|
675
669
|
/**
|
|
676
670
|
* Returns true if the post is being previewed, or false otherwise.
|
|
@@ -681,13 +675,11 @@ export function isAutosavingPost(state) {
|
|
|
681
675
|
*/
|
|
682
676
|
|
|
683
677
|
export function isPreviewingPost(state) {
|
|
684
|
-
var _state$saving$options2;
|
|
685
|
-
|
|
686
678
|
if (!isSavingPost(state)) {
|
|
687
679
|
return false;
|
|
688
680
|
}
|
|
689
681
|
|
|
690
|
-
return Boolean(
|
|
682
|
+
return Boolean(state.saving.options?.isPreview);
|
|
691
683
|
}
|
|
692
684
|
/**
|
|
693
685
|
* Returns the post preview link
|
|
@@ -748,9 +740,7 @@ export function getSuggestedPostFormat(state) {
|
|
|
748
740
|
name = blocks[0].name; // Check for core/embed `video` and `audio` eligible suggestions.
|
|
749
741
|
|
|
750
742
|
if (name === 'core/embed') {
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
const provider = (_blocks$0$attributes = blocks[0].attributes) === null || _blocks$0$attributes === void 0 ? void 0 : _blocks$0$attributes.providerNameSlug;
|
|
743
|
+
const provider = blocks[0].attributes?.providerNameSlug;
|
|
754
744
|
|
|
755
745
|
if (['youtube', 'vimeo'].includes(provider)) {
|
|
756
746
|
name = 'core/video';
|
|
@@ -976,9 +966,7 @@ export function getActivePostLock(state) {
|
|
|
976
966
|
*/
|
|
977
967
|
|
|
978
968
|
export function canUserUseUnfilteredHTML(state) {
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
return Boolean((_getCurrentPost$_link9 = getCurrentPost(state)._links) === null || _getCurrentPost$_link9 === void 0 ? void 0 : _getCurrentPost$_link9.hasOwnProperty('wp:action-unfiltered-html'));
|
|
969
|
+
return Boolean(getCurrentPost(state)._links?.hasOwnProperty('wp:action-unfiltered-html'));
|
|
982
970
|
}
|
|
983
971
|
/**
|
|
984
972
|
* Returns whether the pre-publish panel should be shown
|
|
@@ -1019,13 +1007,11 @@ export function getEditorBlocks(state) {
|
|
|
1019
1007
|
*/
|
|
1020
1008
|
|
|
1021
1009
|
export function getEditorSelectionStart(state) {
|
|
1022
|
-
var _getEditedPostAttribu;
|
|
1023
|
-
|
|
1024
1010
|
deprecated("select('core/editor').getEditorSelectionStart", {
|
|
1025
1011
|
since: '5.8',
|
|
1026
1012
|
alternative: "select('core/editor').getEditorSelection"
|
|
1027
1013
|
});
|
|
1028
|
-
return
|
|
1014
|
+
return getEditedPostAttribute(state, 'selection')?.selectionStart;
|
|
1029
1015
|
}
|
|
1030
1016
|
/**
|
|
1031
1017
|
* Returns the current selection end.
|
|
@@ -1037,13 +1023,11 @@ export function getEditorSelectionStart(state) {
|
|
|
1037
1023
|
*/
|
|
1038
1024
|
|
|
1039
1025
|
export function getEditorSelectionEnd(state) {
|
|
1040
|
-
var _getEditedPostAttribu2;
|
|
1041
|
-
|
|
1042
1026
|
deprecated("select('core/editor').getEditorSelectionStart", {
|
|
1043
1027
|
since: '5.8',
|
|
1044
1028
|
alternative: "select('core/editor').getEditorSelection"
|
|
1045
1029
|
});
|
|
1046
|
-
return
|
|
1030
|
+
return getEditedPostAttribute(state, 'selection')?.selectionEnd;
|
|
1047
1031
|
}
|
|
1048
1032
|
/**
|
|
1049
1033
|
* Returns the current selection.
|
|
@@ -1110,17 +1094,12 @@ export function inSomeHistory() {
|
|
|
1110
1094
|
}
|
|
1111
1095
|
|
|
1112
1096
|
function getBlockEditorSelector(name) {
|
|
1113
|
-
return createRegistrySelector(select =>
|
|
1097
|
+
return createRegistrySelector(select => (state, ...args) => {
|
|
1114
1098
|
deprecated("`wp.data.select( 'core/editor' )." + name + '`', {
|
|
1115
1099
|
since: '5.3',
|
|
1116
1100
|
alternative: "`wp.data.select( 'core/block-editor' )." + name + '`',
|
|
1117
1101
|
version: '6.2'
|
|
1118
1102
|
});
|
|
1119
|
-
|
|
1120
|
-
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
1121
|
-
args[_key - 1] = arguments[_key];
|
|
1122
|
-
}
|
|
1123
|
-
|
|
1124
1103
|
return select(blockEditorStore)[name](...args);
|
|
1125
1104
|
});
|
|
1126
1105
|
}
|
|
@@ -1389,9 +1368,7 @@ export const getBlockListSettings = getBlockEditorSelector('getBlockListSettings
|
|
|
1389
1368
|
*/
|
|
1390
1369
|
|
|
1391
1370
|
export function __experimentalGetDefaultTemplateTypes(state) {
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
return (_getEditorSettings = getEditorSettings(state)) === null || _getEditorSettings === void 0 ? void 0 : _getEditorSettings.defaultTemplateTypes;
|
|
1371
|
+
return getEditorSettings(state)?.defaultTemplateTypes;
|
|
1395
1372
|
}
|
|
1396
1373
|
/**
|
|
1397
1374
|
* Returns the default template part areas.
|
|
@@ -1402,19 +1379,13 @@ export function __experimentalGetDefaultTemplateTypes(state) {
|
|
|
1402
1379
|
*/
|
|
1403
1380
|
|
|
1404
1381
|
export const __experimentalGetDefaultTemplatePartAreas = createSelector(state => {
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
const areas = ((_getEditorSettings2 = getEditorSettings(state)) === null || _getEditorSettings2 === void 0 ? void 0 : _getEditorSettings2.defaultTemplatePartAreas) || [];
|
|
1408
|
-
return areas === null || areas === void 0 ? void 0 : areas.map(item => {
|
|
1382
|
+
const areas = getEditorSettings(state)?.defaultTemplatePartAreas || [];
|
|
1383
|
+
return areas?.map(item => {
|
|
1409
1384
|
return { ...item,
|
|
1410
1385
|
icon: getTemplatePartIcon(item.icon)
|
|
1411
1386
|
};
|
|
1412
1387
|
});
|
|
1413
|
-
}, state =>
|
|
1414
|
-
var _getEditorSettings3;
|
|
1415
|
-
|
|
1416
|
-
return [(_getEditorSettings3 = getEditorSettings(state)) === null || _getEditorSettings3 === void 0 ? void 0 : _getEditorSettings3.defaultTemplatePartAreas];
|
|
1417
|
-
});
|
|
1388
|
+
}, state => [getEditorSettings(state)?.defaultTemplatePartAreas]);
|
|
1418
1389
|
/**
|
|
1419
1390
|
* Returns a default template type searched by slug.
|
|
1420
1391
|
*
|
|
@@ -1445,8 +1416,6 @@ export const __experimentalGetDefaultTemplateType = createSelector((state, slug)
|
|
|
1445
1416
|
*/
|
|
1446
1417
|
|
|
1447
1418
|
export function __experimentalGetTemplateInfo(state, template) {
|
|
1448
|
-
var _experimentalGetDefa;
|
|
1449
|
-
|
|
1450
1419
|
if (!template) {
|
|
1451
1420
|
return EMPTY_OBJECT;
|
|
1452
1421
|
}
|
|
@@ -1463,9 +1432,9 @@ export function __experimentalGetTemplateInfo(state, template) {
|
|
|
1463
1432
|
description: defaultDescription
|
|
1464
1433
|
} = __experimentalGetDefaultTemplateType(state, slug);
|
|
1465
1434
|
|
|
1466
|
-
const templateTitle = typeof title === 'string' ? title : title
|
|
1467
|
-
const templateDescription = typeof description === 'string' ? description : description
|
|
1468
|
-
const templateIcon =
|
|
1435
|
+
const templateTitle = typeof title === 'string' ? title : title?.rendered;
|
|
1436
|
+
const templateDescription = typeof description === 'string' ? description : description?.raw;
|
|
1437
|
+
const templateIcon = __experimentalGetDefaultTemplatePartAreas(state).find(item => area === item.area)?.icon || layout;
|
|
1469
1438
|
return {
|
|
1470
1439
|
title: templateTitle && templateTitle !== slug ? templateTitle : defaultTitle || slug,
|
|
1471
1440
|
description: templateDescription || defaultDescription,
|
|
@@ -1481,12 +1450,10 @@ export function __experimentalGetTemplateInfo(state, template) {
|
|
|
1481
1450
|
*/
|
|
1482
1451
|
|
|
1483
1452
|
export const getPostTypeLabel = createRegistrySelector(select => state => {
|
|
1484
|
-
var _postType$labels;
|
|
1485
|
-
|
|
1486
1453
|
const currentPostType = getCurrentPostType(state);
|
|
1487
1454
|
const postType = select(coreStore).getPostType(currentPostType); // Disable reason: Post type labels object is shaped like this.
|
|
1488
1455
|
// eslint-disable-next-line camelcase
|
|
1489
1456
|
|
|
1490
|
-
return postType
|
|
1457
|
+
return postType?.labels?.singular_name;
|
|
1491
1458
|
});
|
|
1492
1459
|
//# sourceMappingURL=selectors.js.map
|