@wordpress/editor 13.10.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 +4 -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 +42 -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 +13 -14
- 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 +6 -10
- 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 +43 -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 +13 -14
- 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 +6 -10
- 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/build-style/style-rtl.css +1 -1
- package/build-style/style.css +1 -1
- package/package.json +31 -31
- package/src/components/entities-saved-states/hooks/use-is-dirty.js +85 -0
- package/src/components/entities-saved-states/index.js +29 -107
- 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-taxonomies/flat-term-selector.js +1 -1
- package/src/components/post-title/index.js +2 -1
- package/src/components/provider/use-block-editor-settings.js +1 -0
- package/src/private-apis.js +2 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/components/theme-support-check/index.js"],"names":["ThemeSupportCheck","themeSupports","children","postType","supportKeys","isSupported","Array","isArray","some","key","supported","includes","select","getThemeSupports","coreStore","getEditedPostAttribute","editorStore"],"mappings":";;;;;;;;AAGA;;AACA;;AAKA;;AATA;AACA;AACA;;AAIA;AACA;AACA;AAGO,SAASA,iBAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/components/theme-support-check/index.js"],"names":["ThemeSupportCheck","themeSupports","children","postType","supportKeys","isSupported","Array","isArray","some","key","supported","includes","select","getThemeSupports","coreStore","getEditedPostAttribute","editorStore"],"mappings":";;;;;;;;AAGA;;AACA;;AAKA;;AATA;AACA;AACA;;AAIA;AACA;AACA;AAGO,SAASA,iBAAT,CAA4B;AAClCC,EAAAA,aADkC;AAElCC,EAAAA,QAFkC;AAGlCC,EAAAA,QAHkC;AAIlCC,EAAAA;AAJkC,CAA5B,EAKH;AACH,QAAMC,WAAW,GAAG,CACnBC,KAAK,CAACC,OAAN,CAAeH,WAAf,IAA+BA,WAA/B,GAA6C,CAAEA,WAAF,CAD1B,EAElBI,IAFkB,CAEVC,GAAF,IAAW;AAAA;;AAClB,UAAMC,SAAS,yBAAGT,aAAa,GAAIQ,GAAJ,CAAhB,mEAA6B,KAA5C,CADkB,CAElB;AACA;AACA;AACA;;AACA,QAAK,sBAAsBA,GAAtB,IAA6BH,KAAK,CAACC,OAAN,CAAeG,SAAf,CAAlC,EAA+D;AAC9D,aAAOA,SAAS,CAACC,QAAV,CAAoBR,QAApB,CAAP;AACA;;AACD,WAAOO,SAAP;AACA,GAZmB,CAApB;;AAcA,MAAK,CAAEL,WAAP,EAAqB;AACpB,WAAO,IAAP;AACA;;AAED,SAAOH,QAAP;AACA;;eAEc,sBAAcU,MAAF,IAAc;AACxC,QAAM;AAAEC,IAAAA;AAAF,MAAuBD,MAAM,CAAEE,eAAF,CAAnC;AACA,QAAM;AAAEC,IAAAA;AAAF,MAA6BH,MAAM,CAAEI,YAAF,CAAzC;AACA,SAAO;AACNb,IAAAA,QAAQ,EAAEY,sBAAsB,CAAE,MAAF,CAD1B;AAENd,IAAAA,aAAa,EAAEY,gBAAgB;AAFzB,GAAP;AAIA,CAPc,EAOVb,iBAPU,C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { withSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport function ThemeSupportCheck( {\n\tthemeSupports,\n\tchildren,\n\tpostType,\n\tsupportKeys,\n} ) {\n\tconst isSupported = (\n\t\tArray.isArray( supportKeys ) ? supportKeys : [ supportKeys ]\n\t).some( ( key ) => {\n\t\tconst supported = themeSupports?.[ key ] ?? false;\n\t\t// 'post-thumbnails' can be boolean or an array of post types.\n\t\t// In the latter case, we need to verify `postType` exists\n\t\t// within `supported`. If `postType` isn't passed, then the check\n\t\t// should fail.\n\t\tif ( 'post-thumbnails' === key && Array.isArray( supported ) ) {\n\t\t\treturn supported.includes( postType );\n\t\t}\n\t\treturn supported;\n\t} );\n\n\tif ( ! isSupported ) {\n\t\treturn null;\n\t}\n\n\treturn children;\n}\n\nexport default withSelect( ( select ) => {\n\tconst { getThemeSupports } = select( coreStore );\n\tconst { getEditedPostAttribute } = select( editorStore );\n\treturn {\n\t\tpostType: getEditedPostAttribute( 'type' ),\n\t\tthemeSupports: getThemeSupports(),\n\t};\n} )( ThemeSupportCheck );\n"]}
|
|
@@ -49,33 +49,23 @@ var _store = require("../store");
|
|
|
49
49
|
*
|
|
50
50
|
* @return {WPHigherOrderComponent} Higher-order component.
|
|
51
51
|
*/
|
|
52
|
-
const createWithMetaAttributeSource = metaAttributes => (0, _compose.createHigherOrderComponent)(BlockEdit =>
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
} = _ref;
|
|
52
|
+
const createWithMetaAttributeSource = metaAttributes => (0, _compose.createHigherOrderComponent)(BlockEdit => ({
|
|
53
|
+
attributes,
|
|
54
|
+
setAttributes,
|
|
55
|
+
...props
|
|
56
|
+
}) => {
|
|
58
57
|
const postType = (0, _data.useSelect)(select => select(_store.store).getCurrentPostType(), []);
|
|
59
58
|
const [meta, setMeta] = (0, _coreData.useEntityProp)('postType', postType, 'meta');
|
|
60
59
|
const mergedAttributes = (0, _element.useMemo)(() => ({ ...attributes,
|
|
61
|
-
...Object.fromEntries(Object.entries(metaAttributes).map(
|
|
62
|
-
let [attributeKey, metaKey] = _ref2;
|
|
63
|
-
return [attributeKey, meta[metaKey]];
|
|
64
|
-
}))
|
|
60
|
+
...Object.fromEntries(Object.entries(metaAttributes).map(([attributeKey, metaKey]) => [attributeKey, meta[metaKey]]))
|
|
65
61
|
}), [attributes, meta]);
|
|
66
62
|
return (0, _element.createElement)(BlockEdit, (0, _extends2.default)({
|
|
67
63
|
attributes: mergedAttributes,
|
|
68
64
|
setAttributes: nextAttributes => {
|
|
69
65
|
const nextMeta = Object.fromEntries(Object.entries(nextAttributes !== null && nextAttributes !== void 0 ? nextAttributes : {}).filter( // Filter to intersection of keys between the updated
|
|
70
66
|
// attributes and those with an associated meta key.
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
return key in metaAttributes;
|
|
74
|
-
}).map(_ref4 => {
|
|
75
|
-
let [attributeKey, value] = _ref4;
|
|
76
|
-
return [// Rename the keys to the expected meta key name.
|
|
77
|
-
metaAttributes[attributeKey], value];
|
|
78
|
-
}));
|
|
67
|
+
([key]) => key in metaAttributes).map(([attributeKey, value]) => [// Rename the keys to the expected meta key name.
|
|
68
|
+
metaAttributes[attributeKey], value]));
|
|
79
69
|
|
|
80
70
|
if (Object.entries(nextMeta).length) {
|
|
81
71
|
setMeta(nextMeta);
|
|
@@ -99,17 +89,11 @@ function shimAttributeSource(settings) {
|
|
|
99
89
|
var _settings$attributes;
|
|
100
90
|
|
|
101
91
|
/** @type {WPMetaAttributeMapping} */
|
|
102
|
-
const metaAttributes = Object.fromEntries(Object.entries((_settings$attributes = settings.attributes) !== null && _settings$attributes !== void 0 ? _settings$attributes : {}).filter(
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
}).map(_ref6 => {
|
|
108
|
-
let [attributeKey, {
|
|
109
|
-
meta
|
|
110
|
-
}] = _ref6;
|
|
111
|
-
return [attributeKey, meta];
|
|
112
|
-
}));
|
|
92
|
+
const metaAttributes = Object.fromEntries(Object.entries((_settings$attributes = settings.attributes) !== null && _settings$attributes !== void 0 ? _settings$attributes : {}).filter(([, {
|
|
93
|
+
source
|
|
94
|
+
}]) => source === 'meta').map(([attributeKey, {
|
|
95
|
+
meta
|
|
96
|
+
}]) => [attributeKey, meta]));
|
|
113
97
|
|
|
114
98
|
if (Object.entries(metaAttributes).length) {
|
|
115
99
|
settings.edit = createWithMetaAttributeSource(metaAttributes)(settings.edit);
|
|
@@ -137,10 +121,7 @@ function shimAttributeSource(settings) {
|
|
|
137
121
|
// In the future, we could support updating block settings, at which point this
|
|
138
122
|
// implementation could use that mechanism instead.
|
|
139
123
|
|
|
140
|
-
(0, _data.select)(_blocks.store).getBlockTypes().map(
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
} = _ref7;
|
|
144
|
-
return (0, _data.select)(_blocks.store).getBlockType(name);
|
|
145
|
-
}).forEach(shimAttributeSource);
|
|
124
|
+
(0, _data.select)(_blocks.store).getBlockTypes().map(({
|
|
125
|
+
name
|
|
126
|
+
}) => (0, _data.select)(_blocks.store).getBlockType(name)).forEach(shimAttributeSource);
|
|
146
127
|
//# sourceMappingURL=custom-sources-backwards-compatibility.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/hooks/custom-sources-backwards-compatibility.js"],"names":["createWithMetaAttributeSource","metaAttributes","BlockEdit","attributes","setAttributes","props","postType","select","editorStore","getCurrentPostType","meta","setMeta","mergedAttributes","Object","fromEntries","entries","map","attributeKey","metaKey","nextAttributes","nextMeta","filter","key","value","length","shimAttributeSource","settings","source","edit","blocksStore","getBlockTypes","name","getBlockType","forEach"],"mappings":";;;;AAMA;;;;AAHA;;AACA;;AACA;;AAEA;;AACA;;AAKA;;AAbA;AACA;AACA;;AAQA;AACA;AACA;;AAGA;;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,6BAA6B,GAAKC,cAAF,IACrC,yCACGC,SAAF,IACC,
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/hooks/custom-sources-backwards-compatibility.js"],"names":["createWithMetaAttributeSource","metaAttributes","BlockEdit","attributes","setAttributes","props","postType","select","editorStore","getCurrentPostType","meta","setMeta","mergedAttributes","Object","fromEntries","entries","map","attributeKey","metaKey","nextAttributes","nextMeta","filter","key","value","length","shimAttributeSource","settings","source","edit","blocksStore","getBlockTypes","name","getBlockType","forEach"],"mappings":";;;;AAMA;;;;AAHA;;AACA;;AACA;;AAEA;;AACA;;AAKA;;AAbA;AACA;AACA;;AAQA;AACA;AACA;;AAGA;;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,6BAA6B,GAAKC,cAAF,IACrC,yCACGC,SAAF,IACC,CAAE;AAAEC,EAAAA,UAAF;AAAcC,EAAAA,aAAd;AAA6B,KAAGC;AAAhC,CAAF,KAA+C;AAC9C,QAAMC,QAAQ,GAAG,qBACdC,MAAF,IAAcA,MAAM,CAAEC,YAAF,CAAN,CAAsBC,kBAAtB,EADE,EAEhB,EAFgB,CAAjB;AAIA,QAAM,CAAEC,IAAF,EAAQC,OAAR,IAAoB,6BACzB,UADyB,EAEzBL,QAFyB,EAGzB,MAHyB,CAA1B;AAMA,QAAMM,gBAAgB,GAAG,sBACxB,OAAQ,EACP,GAAGT,UADI;AAEP,OAAGU,MAAM,CAACC,WAAP,CACFD,MAAM,CAACE,OAAP,CAAgBd,cAAhB,EAAiCe,GAAjC,CACC,CAAE,CAAEC,YAAF,EAAgBC,OAAhB,CAAF,KAAiC,CAChCD,YADgC,EAEhCP,IAAI,CAAEQ,OAAF,CAF4B,CADlC,CADE;AAFI,GAAR,CADwB,EAYxB,CAAEf,UAAF,EAAcO,IAAd,CAZwB,CAAzB;AAeA,SACC,4BAAC,SAAD;AACC,IAAA,UAAU,EAAGE,gBADd;AAEC,IAAA,aAAa,EAAKO,cAAF,IAAsB;AACrC,YAAMC,QAAQ,GAAGP,MAAM,CAACC,WAAP,CAChBD,MAAM,CAACE,OAAP,CAAgBI,cAAhB,aAAgBA,cAAhB,cAAgBA,cAAhB,GAAkC,EAAlC,EACEE,MADF,EAEE;AACA;AACA,OAAE,CAAEC,GAAF,CAAF,KAAeA,GAAG,IAAIrB,cAJxB,EAMEe,GANF,CAMO,CAAE,CAAEC,YAAF,EAAgBM,KAAhB,CAAF,KAA+B,CACpC;AACAtB,MAAAA,cAAc,CAAEgB,YAAF,CAFsB,EAGpCM,KAHoC,CANtC,CADgB,CAAjB;;AAcA,UAAKV,MAAM,CAACE,OAAP,CAAgBK,QAAhB,EAA2BI,MAAhC,EAAyC;AACxCb,QAAAA,OAAO,CAAES,QAAF,CAAP;AACA;;AAEDhB,MAAAA,aAAa,CAAEe,cAAF,CAAb;AACA;AAtBF,KAuBMd,KAvBN,EADD;AA2BA,CAvDH,EAwDC,yBAxDD,CADD;AA4DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASoB,mBAAT,CAA8BC,QAA9B,EAAyC;AAAA;;AACxC;AACA,QAAMzB,cAAc,GAAGY,MAAM,CAACC,WAAP,CACtBD,MAAM,CAACE,OAAP,yBAAgBW,QAAQ,CAACvB,UAAzB,uEAAuC,EAAvC,EACEkB,MADF,CACU,CAAE,GAAI;AAAEM,IAAAA;AAAF,GAAJ,CAAF,KAAwBA,MAAM,KAAK,MAD7C,EAEEX,GAFF,CAEO,CAAE,CAAEC,YAAF,EAAgB;AAAEP,IAAAA;AAAF,GAAhB,CAAF,KAAkC,CAAEO,YAAF,EAAgBP,IAAhB,CAFzC,CADsB,CAAvB;;AAKA,MAAKG,MAAM,CAACE,OAAP,CAAgBd,cAAhB,EAAiCuB,MAAtC,EAA+C;AAC9CE,IAAAA,QAAQ,CAACE,IAAT,GAAgB5B,6BAA6B,CAAEC,cAAF,CAA7B,CACfyB,QAAQ,CAACE,IADM,CAAhB;AAGA;;AAED,SAAOF,QAAP;AACA;;AAED,sBACC,0BADD,EAEC,0EAFD,EAGCD,mBAHD,E,CAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,kBAAcI,aAAd,EACEC,aADF,GAEEd,GAFF,CAEO,CAAE;AAAEe,EAAAA;AAAF,CAAF,KAAgB,kBAAcF,aAAd,EAA4BG,YAA5B,CAA0CD,IAA1C,CAFvB,EAGEE,OAHF,CAGWR,mBAHX","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { select as globalSelect, useSelect } from '@wordpress/data';\nimport { useEntityProp } from '@wordpress/core-data';\nimport { useMemo } from '@wordpress/element';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../store';\n\n/** @typedef {import('@wordpress/compose').WPHigherOrderComponent} WPHigherOrderComponent */\n/** @typedef {import('@wordpress/blocks').WPBlockSettings} WPBlockSettings */\n\n/**\n * Object whose keys are the names of block attributes, where each value\n * represents the meta key to which the block attribute is intended to save.\n *\n * @see https://developer.wordpress.org/reference/functions/register_meta/\n *\n * @typedef {Object<string,string>} WPMetaAttributeMapping\n */\n\n/**\n * Given a mapping of attribute names (meta source attributes) to their\n * associated meta key, returns a higher order component that overrides its\n * `attributes` and `setAttributes` props to sync any changes with the edited\n * post's meta keys.\n *\n * @param {WPMetaAttributeMapping} metaAttributes Meta attribute mapping.\n *\n * @return {WPHigherOrderComponent} Higher-order component.\n */\nconst createWithMetaAttributeSource = ( metaAttributes ) =>\n\tcreateHigherOrderComponent(\n\t\t( BlockEdit ) =>\n\t\t\t( { attributes, setAttributes, ...props } ) => {\n\t\t\t\tconst postType = useSelect(\n\t\t\t\t\t( select ) => select( editorStore ).getCurrentPostType(),\n\t\t\t\t\t[]\n\t\t\t\t);\n\t\t\t\tconst [ meta, setMeta ] = useEntityProp(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\t'meta'\n\t\t\t\t);\n\n\t\t\t\tconst mergedAttributes = useMemo(\n\t\t\t\t\t() => ( {\n\t\t\t\t\t\t...attributes,\n\t\t\t\t\t\t...Object.fromEntries(\n\t\t\t\t\t\t\tObject.entries( metaAttributes ).map(\n\t\t\t\t\t\t\t\t( [ attributeKey, metaKey ] ) => [\n\t\t\t\t\t\t\t\t\tattributeKey,\n\t\t\t\t\t\t\t\t\tmeta[ metaKey ],\n\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t),\n\t\t\t\t\t} ),\n\t\t\t\t\t[ attributes, meta ]\n\t\t\t\t);\n\n\t\t\t\treturn (\n\t\t\t\t\t<BlockEdit\n\t\t\t\t\t\tattributes={ mergedAttributes }\n\t\t\t\t\t\tsetAttributes={ ( nextAttributes ) => {\n\t\t\t\t\t\t\tconst nextMeta = Object.fromEntries(\n\t\t\t\t\t\t\t\tObject.entries( nextAttributes ?? {} )\n\t\t\t\t\t\t\t\t\t.filter(\n\t\t\t\t\t\t\t\t\t\t// Filter to intersection of keys between the updated\n\t\t\t\t\t\t\t\t\t\t// attributes and those with an associated meta key.\n\t\t\t\t\t\t\t\t\t\t( [ key ] ) => key in metaAttributes\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t.map( ( [ attributeKey, value ] ) => [\n\t\t\t\t\t\t\t\t\t\t// Rename the keys to the expected meta key name.\n\t\t\t\t\t\t\t\t\t\tmetaAttributes[ attributeKey ],\n\t\t\t\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t\t\t\t] )\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\tif ( Object.entries( nextMeta ).length ) {\n\t\t\t\t\t\t\t\tsetMeta( nextMeta );\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tsetAttributes( nextAttributes );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t},\n\t\t'withMetaAttributeSource'\n\t);\n\n/**\n * Filters a registered block's settings to enhance a block's `edit` component\n * to upgrade meta-sourced attributes to use the post's meta entity property.\n *\n * @param {WPBlockSettings} settings Registered block settings.\n *\n * @return {WPBlockSettings} Filtered block settings.\n */\nfunction shimAttributeSource( settings ) {\n\t/** @type {WPMetaAttributeMapping} */\n\tconst metaAttributes = Object.fromEntries(\n\t\tObject.entries( settings.attributes ?? {} )\n\t\t\t.filter( ( [ , { source } ] ) => source === 'meta' )\n\t\t\t.map( ( [ attributeKey, { meta } ] ) => [ attributeKey, meta ] )\n\t);\n\tif ( Object.entries( metaAttributes ).length ) {\n\t\tsettings.edit = createWithMetaAttributeSource( metaAttributes )(\n\t\t\tsettings.edit\n\t\t);\n\t}\n\n\treturn settings;\n}\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/editor/custom-sources-backwards-compatibility/shim-attribute-source',\n\tshimAttributeSource\n);\n\n// The above filter will only capture blocks registered after the filter was\n// added. There may already be blocks registered by this point, and those must\n// be updated to apply the shim.\n//\n// The following implementation achieves this, albeit with a couple caveats:\n// - Only blocks registered on the global store will be modified.\n// - The block settings are directly mutated, since there is currently no\n// mechanism to update an existing block registration. This is the reason for\n// `getBlockType` separate from `getBlockTypes`, since the latter returns a\n// _copy_ of the block registration (i.e. the mutation would not affect the\n// actual registered block settings).\n//\n// `getBlockTypes` or `getBlockType` implementation could change in the future\n// in regards to creating settings clones, but the corresponding end-to-end\n// tests for meta blocks should cover against any potential regressions.\n//\n// In the future, we could support updating block settings, at which point this\n// implementation could use that mechanism instead.\nglobalSelect( blocksStore )\n\t.getBlockTypes()\n\t.map( ( { name } ) => globalSelect( blocksStore ).getBlockType( name ) )\n\t.forEach( shimAttributeSource );\n"]}
|
|
@@ -11,8 +11,7 @@ var _components = require("../components");
|
|
|
11
11
|
/**
|
|
12
12
|
* Internal dependencies
|
|
13
13
|
*/
|
|
14
|
-
function setDefaultCompleters() {
|
|
15
|
-
let completers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
14
|
+
function setDefaultCompleters(completers = []) {
|
|
16
15
|
// Provide copies so filters may directly modify them.
|
|
17
16
|
completers.push({ ..._components.userAutocompleter
|
|
18
17
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/hooks/default-autocompleters.js"],"names":["setDefaultCompleters","completers","push","userAutocompleter"],"mappings":";;AAGA;;AAKA;;AARA;AACA;AACA;;AAGA;AACA;AACA;AAGA,SAASA,oBAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/hooks/default-autocompleters.js"],"names":["setDefaultCompleters","completers","push","userAutocompleter"],"mappings":";;AAGA;;AAKA;;AARA;AACA;AACA;;AAGA;AACA;AACA;AAGA,SAASA,oBAAT,CAA+BC,UAAU,GAAG,EAA5C,EAAiD;AAChD;AACAA,EAAAA,UAAU,CAACC,IAAX,CAAiB,EAAE,GAAGC;AAAL,GAAjB;AAEA,SAAOF,UAAP;AACA;;AAED,sBACC,gCADD,EAEC,8CAFD,EAGCD,oBAHD","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport { userAutocompleter } from '../components';\n\nfunction setDefaultCompleters( completers = [] ) {\n\t// Provide copies so filters may directly modify them.\n\tcompleters.push( { ...userAutocompleter } );\n\n\treturn completers;\n}\n\naddFilter(\n\t'editor.Autocomplete.completers',\n\t'editor/autocompleters/set-default-completers',\n\tsetDefaultCompleters\n);\n"]}
|
package/build/private-apis.js
CHANGED
|
@@ -9,12 +9,15 @@ var _provider = require("./components/provider");
|
|
|
9
9
|
|
|
10
10
|
var _lockUnlock = require("./lockUnlock");
|
|
11
11
|
|
|
12
|
+
var _entitiesSavedStates = require("./components/entities-saved-states");
|
|
13
|
+
|
|
12
14
|
/**
|
|
13
15
|
* Internal dependencies
|
|
14
16
|
*/
|
|
15
17
|
const privateApis = {};
|
|
16
18
|
exports.privateApis = privateApis;
|
|
17
19
|
(0, _lockUnlock.lock)(privateApis, {
|
|
18
|
-
ExperimentalEditorProvider: _provider.ExperimentalEditorProvider
|
|
20
|
+
ExperimentalEditorProvider: _provider.ExperimentalEditorProvider,
|
|
21
|
+
EntitiesSavedStatesExtensible: _entitiesSavedStates.EntitiesSavedStatesExtensible
|
|
19
22
|
});
|
|
20
23
|
//# sourceMappingURL=private-apis.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/private-apis.js"],"names":["privateApis","ExperimentalEditorProvider"],"mappings":";;;;;;;AAGA;;AACA;;
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/private-apis.js"],"names":["privateApis","ExperimentalEditorProvider","EntitiesSavedStatesExtensible"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;AALA;AACA;AACA;AAKO,MAAMA,WAAW,GAAG,EAApB;;AACP,sBAAMA,WAAN,EAAmB;AAClBC,EAAAA,0BAA0B,EAA1BA,oCADkB;AAElBC,EAAAA,6BAA6B,EAA7BA;AAFkB,CAAnB","sourcesContent":["/**\n * Internal dependencies\n */\nimport { ExperimentalEditorProvider } from './components/provider';\nimport { lock } from './lockUnlock';\nimport { EntitiesSavedStatesExtensible } from './components/entities-saved-states';\n\nexport const privateApis = {};\nlock( privateApis, {\n\tExperimentalEditorProvider,\n\tEntitiesSavedStatesExtensible,\n} );\n"]}
|
package/build/store/actions.js
CHANGED
|
@@ -61,10 +61,9 @@ var _noticeBuilder = require("./utils/notice-builder");
|
|
|
61
61
|
* @param {Object} edits Initial edited attributes object.
|
|
62
62
|
* @param {Array?} template Block Template.
|
|
63
63
|
*/
|
|
64
|
-
const setupEditor = (post, edits, template) =>
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
} = _ref;
|
|
64
|
+
const setupEditor = (post, edits, template) => ({
|
|
65
|
+
dispatch
|
|
66
|
+
}) => {
|
|
68
67
|
dispatch.setupEditorState(post); // Apply a template for new posts only, if exists.
|
|
69
68
|
|
|
70
69
|
const isNewPost = post.status === 'auto-draft';
|
|
@@ -88,11 +87,10 @@ const setupEditor = (post, edits, template) => _ref => {
|
|
|
88
87
|
});
|
|
89
88
|
}
|
|
90
89
|
|
|
91
|
-
if (edits && Object.values(edits).some(
|
|
92
|
-
var _post$key$raw
|
|
90
|
+
if (edits && Object.values(edits).some(([key, edit]) => {
|
|
91
|
+
var _post$key$raw;
|
|
93
92
|
|
|
94
|
-
|
|
95
|
-
return edit !== ((_post$key$raw = (_post$key = post[key]) === null || _post$key === void 0 ? void 0 : _post$key.raw) !== null && _post$key$raw !== void 0 ? _post$key$raw : post[key]);
|
|
93
|
+
return edit !== ((_post$key$raw = post[key]?.raw) !== null && _post$key$raw !== void 0 ? _post$key$raw : post[key]);
|
|
96
94
|
})) {
|
|
97
95
|
dispatch.editPost(edits);
|
|
98
96
|
}
|
|
@@ -173,11 +171,10 @@ function setupEditorState(post) {
|
|
|
173
171
|
*/
|
|
174
172
|
|
|
175
173
|
|
|
176
|
-
const editPost = (edits, options) =>
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
} = _ref3;
|
|
174
|
+
const editPost = (edits, options) => ({
|
|
175
|
+
select,
|
|
176
|
+
registry
|
|
177
|
+
}) => {
|
|
181
178
|
const {
|
|
182
179
|
id,
|
|
183
180
|
type
|
|
@@ -193,76 +190,71 @@ const editPost = (edits, options) => _ref3 => {
|
|
|
193
190
|
|
|
194
191
|
exports.editPost = editPost;
|
|
195
192
|
|
|
196
|
-
const savePost =
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
193
|
+
const savePost = (options = {}) => async ({
|
|
194
|
+
select,
|
|
195
|
+
dispatch,
|
|
196
|
+
registry
|
|
197
|
+
}) => {
|
|
198
|
+
if (!select.isEditedPostSaveable()) {
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
204
201
|
|
|
205
|
-
|
|
206
|
-
return;
|
|
207
|
-
}
|
|
202
|
+
const content = select.getEditedPostContent();
|
|
208
203
|
|
|
209
|
-
|
|
204
|
+
if (!options.isAutosave) {
|
|
205
|
+
dispatch.editPost({
|
|
206
|
+
content
|
|
207
|
+
}, {
|
|
208
|
+
undoIgnore: true
|
|
209
|
+
});
|
|
210
|
+
}
|
|
210
211
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
212
|
+
const previousRecord = select.getCurrentPost();
|
|
213
|
+
const edits = {
|
|
214
|
+
id: previousRecord.id,
|
|
215
|
+
...registry.select(_coreData.store).getEntityRecordNonTransientEdits('postType', previousRecord.type, previousRecord.id),
|
|
216
|
+
content
|
|
217
|
+
};
|
|
218
|
+
dispatch({
|
|
219
|
+
type: 'REQUEST_POST_UPDATE_START',
|
|
220
|
+
options
|
|
221
|
+
});
|
|
222
|
+
await registry.dispatch(_coreData.store).saveEntityRecord('postType', previousRecord.type, edits, options);
|
|
223
|
+
dispatch({
|
|
224
|
+
type: 'REQUEST_POST_UPDATE_FINISH',
|
|
225
|
+
options
|
|
226
|
+
});
|
|
227
|
+
const error = registry.select(_coreData.store).getLastEntitySaveError('postType', previousRecord.type, previousRecord.id);
|
|
218
228
|
|
|
219
|
-
|
|
220
|
-
const
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
};
|
|
225
|
-
dispatch({
|
|
226
|
-
type: 'REQUEST_POST_UPDATE_START',
|
|
227
|
-
options
|
|
229
|
+
if (error) {
|
|
230
|
+
const args = (0, _noticeBuilder.getNotificationArgumentsForSaveFail)({
|
|
231
|
+
post: previousRecord,
|
|
232
|
+
edits,
|
|
233
|
+
error
|
|
228
234
|
});
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
235
|
+
|
|
236
|
+
if (args.length) {
|
|
237
|
+
registry.dispatch(_notices.store).createErrorNotice(...args);
|
|
238
|
+
}
|
|
239
|
+
} else {
|
|
240
|
+
const updatedRecord = select.getCurrentPost();
|
|
241
|
+
const args = (0, _noticeBuilder.getNotificationArgumentsForSaveSuccess)({
|
|
242
|
+
previousPost: previousRecord,
|
|
243
|
+
post: updatedRecord,
|
|
244
|
+
postType: await registry.resolveSelect(_coreData.store).getPostType(updatedRecord.type),
|
|
232
245
|
options
|
|
233
246
|
});
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
if (args.length) {
|
|
244
|
-
registry.dispatch(_notices.store).createErrorNotice(...args);
|
|
245
|
-
}
|
|
246
|
-
} else {
|
|
247
|
-
const updatedRecord = select.getCurrentPost();
|
|
248
|
-
const args = (0, _noticeBuilder.getNotificationArgumentsForSaveSuccess)({
|
|
249
|
-
previousPost: previousRecord,
|
|
250
|
-
post: updatedRecord,
|
|
251
|
-
postType: await registry.resolveSelect(_coreData.store).getPostType(updatedRecord.type),
|
|
252
|
-
options
|
|
253
|
-
});
|
|
254
|
-
|
|
255
|
-
if (args.length) {
|
|
256
|
-
registry.dispatch(_notices.store).createSuccessNotice(...args);
|
|
257
|
-
} // Make sure that any edits after saving create an undo level and are
|
|
258
|
-
// considered for change detection.
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
if (!options.isAutosave) {
|
|
262
|
-
registry.dispatch(_blockEditor.store).__unstableMarkLastChangeAsPersistent();
|
|
263
|
-
}
|
|
247
|
+
|
|
248
|
+
if (args.length) {
|
|
249
|
+
registry.dispatch(_notices.store).createSuccessNotice(...args);
|
|
250
|
+
} // Make sure that any edits after saving create an undo level and are
|
|
251
|
+
// considered for change detection.
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
if (!options.isAutosave) {
|
|
255
|
+
registry.dispatch(_blockEditor.store).__unstableMarkLastChangeAsPersistent();
|
|
264
256
|
}
|
|
265
|
-
}
|
|
257
|
+
}
|
|
266
258
|
};
|
|
267
259
|
/**
|
|
268
260
|
* Action for refreshing the current post.
|
|
@@ -288,12 +280,11 @@ function refreshPost() {
|
|
|
288
280
|
*/
|
|
289
281
|
|
|
290
282
|
|
|
291
|
-
const trashPost = () => async
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
} = _ref5;
|
|
283
|
+
const trashPost = () => async ({
|
|
284
|
+
select,
|
|
285
|
+
dispatch,
|
|
286
|
+
registry
|
|
287
|
+
}) => {
|
|
297
288
|
const postTypeSlug = select.getCurrentPostType();
|
|
298
289
|
const postType = await registry.resolveSelect(_coreData.store).getPostType(postTypeSlug);
|
|
299
290
|
registry.dispatch(_notices.store).removeNotice(_constants.TRASH_POST_NOTICE_ID);
|
|
@@ -334,31 +325,26 @@ const trashPost = () => async _ref5 => {
|
|
|
334
325
|
|
|
335
326
|
exports.trashPost = trashPost;
|
|
336
327
|
|
|
337
|
-
const autosave =
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
isAutosave: true,
|
|
358
|
-
...options
|
|
359
|
-
});
|
|
360
|
-
}
|
|
361
|
-
};
|
|
328
|
+
const autosave = ({
|
|
329
|
+
local = false,
|
|
330
|
+
...options
|
|
331
|
+
} = {}) => async ({
|
|
332
|
+
select,
|
|
333
|
+
dispatch
|
|
334
|
+
}) => {
|
|
335
|
+
if (local) {
|
|
336
|
+
const post = select.getCurrentPost();
|
|
337
|
+
const isPostNew = select.isEditedPostNew();
|
|
338
|
+
const title = select.getEditedPostAttribute('title');
|
|
339
|
+
const content = select.getEditedPostAttribute('content');
|
|
340
|
+
const excerpt = select.getEditedPostAttribute('excerpt');
|
|
341
|
+
(0, _localAutosave.localAutosaveSet)(post.id, isPostNew, title, content, excerpt);
|
|
342
|
+
} else {
|
|
343
|
+
await dispatch.savePost({
|
|
344
|
+
isAutosave: true,
|
|
345
|
+
...options
|
|
346
|
+
});
|
|
347
|
+
}
|
|
362
348
|
};
|
|
363
349
|
/**
|
|
364
350
|
* Action that restores last popped state in undo history.
|
|
@@ -367,10 +353,9 @@ const autosave = function () {
|
|
|
367
353
|
|
|
368
354
|
exports.autosave = autosave;
|
|
369
355
|
|
|
370
|
-
const redo = () =>
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
} = _ref7;
|
|
356
|
+
const redo = () => ({
|
|
357
|
+
registry
|
|
358
|
+
}) => {
|
|
374
359
|
registry.dispatch(_coreData.store).redo();
|
|
375
360
|
};
|
|
376
361
|
/**
|
|
@@ -380,10 +365,9 @@ const redo = () => _ref7 => {
|
|
|
380
365
|
|
|
381
366
|
exports.redo = redo;
|
|
382
367
|
|
|
383
|
-
const undo = () =>
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
} = _ref8;
|
|
368
|
+
const undo = () => ({
|
|
369
|
+
registry
|
|
370
|
+
}) => {
|
|
387
371
|
registry.dispatch(_coreData.store).undo();
|
|
388
372
|
};
|
|
389
373
|
/**
|
|
@@ -424,10 +408,9 @@ function updatePostLock(lock) {
|
|
|
424
408
|
*/
|
|
425
409
|
|
|
426
410
|
|
|
427
|
-
const enablePublishSidebar = () =>
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
} = _ref9;
|
|
411
|
+
const enablePublishSidebar = () => ({
|
|
412
|
+
registry
|
|
413
|
+
}) => {
|
|
431
414
|
registry.dispatch(_preferences.store).set('core/edit-post', 'isPublishSidebarEnabled', true);
|
|
432
415
|
};
|
|
433
416
|
/**
|
|
@@ -437,10 +420,9 @@ const enablePublishSidebar = () => _ref9 => {
|
|
|
437
420
|
|
|
438
421
|
exports.enablePublishSidebar = enablePublishSidebar;
|
|
439
422
|
|
|
440
|
-
const disablePublishSidebar = () =>
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
} = _ref10;
|
|
423
|
+
const disablePublishSidebar = () => ({
|
|
424
|
+
registry
|
|
425
|
+
}) => {
|
|
444
426
|
registry.dispatch(_preferences.store).set('core/edit-post', 'isPublishSidebarEnabled', false);
|
|
445
427
|
};
|
|
446
428
|
/**
|
|
@@ -567,49 +549,42 @@ function unlockPostAutosaving(lockName) {
|
|
|
567
549
|
*/
|
|
568
550
|
|
|
569
551
|
|
|
570
|
-
const resetEditorBlocks =
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
552
|
+
const resetEditorBlocks = (blocks, options = {}) => ({
|
|
553
|
+
select,
|
|
554
|
+
dispatch,
|
|
555
|
+
registry
|
|
556
|
+
}) => {
|
|
557
|
+
const {
|
|
558
|
+
__unstableShouldCreateUndoLevel,
|
|
559
|
+
selection
|
|
560
|
+
} = options;
|
|
561
|
+
const edits = {
|
|
562
|
+
blocks,
|
|
563
|
+
selection
|
|
564
|
+
};
|
|
565
|
+
|
|
566
|
+
if (__unstableShouldCreateUndoLevel !== false) {
|
|
578
567
|
const {
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
} =
|
|
582
|
-
const
|
|
583
|
-
blocks,
|
|
584
|
-
selection
|
|
585
|
-
};
|
|
586
|
-
|
|
587
|
-
if (__unstableShouldCreateUndoLevel !== false) {
|
|
588
|
-
const {
|
|
589
|
-
id,
|
|
590
|
-
type
|
|
591
|
-
} = select.getCurrentPost();
|
|
592
|
-
const noChange = registry.select(_coreData.store).getEditedEntityRecord('postType', type, id).blocks === edits.blocks;
|
|
593
|
-
|
|
594
|
-
if (noChange) {
|
|
595
|
-
registry.dispatch(_coreData.store).__unstableCreateUndoLevel('postType', type, id);
|
|
596
|
-
|
|
597
|
-
return;
|
|
598
|
-
} // We create a new function here on every persistent edit
|
|
599
|
-
// to make sure the edit makes the post dirty and creates
|
|
600
|
-
// a new undo level.
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
edits.content = _ref12 => {
|
|
604
|
-
let {
|
|
605
|
-
blocks: blocksForSerialization = []
|
|
606
|
-
} = _ref12;
|
|
607
|
-
return (0, _blocks.__unstableSerializeAndClean)(blocksForSerialization);
|
|
608
|
-
};
|
|
609
|
-
}
|
|
568
|
+
id,
|
|
569
|
+
type
|
|
570
|
+
} = select.getCurrentPost();
|
|
571
|
+
const noChange = registry.select(_coreData.store).getEditedEntityRecord('postType', type, id).blocks === edits.blocks;
|
|
610
572
|
|
|
611
|
-
|
|
612
|
-
|
|
573
|
+
if (noChange) {
|
|
574
|
+
registry.dispatch(_coreData.store).__unstableCreateUndoLevel('postType', type, id);
|
|
575
|
+
|
|
576
|
+
return;
|
|
577
|
+
} // We create a new function here on every persistent edit
|
|
578
|
+
// to make sure the edit makes the post dirty and creates
|
|
579
|
+
// a new undo level.
|
|
580
|
+
|
|
581
|
+
|
|
582
|
+
edits.content = ({
|
|
583
|
+
blocks: blocksForSerialization = []
|
|
584
|
+
}) => (0, _blocks.__unstableSerializeAndClean)(blocksForSerialization);
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
dispatch.editPost(edits);
|
|
613
588
|
};
|
|
614
589
|
/*
|
|
615
590
|
* Returns an action object used in signalling that the post editor settings have been updated.
|
|
@@ -633,22 +608,15 @@ function updateEditorSettings(settings) {
|
|
|
633
608
|
*/
|
|
634
609
|
|
|
635
610
|
|
|
636
|
-
const getBlockEditorAction = name =>
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
(0, _deprecated.default)("`wp.data.dispatch( 'core/editor' )." + name + '`', {
|
|
646
|
-
since: '5.3',
|
|
647
|
-
alternative: "`wp.data.dispatch( 'core/block-editor' )." + name + '`',
|
|
648
|
-
version: '6.2'
|
|
649
|
-
});
|
|
650
|
-
registry.dispatch(_blockEditor.store)[name](...args);
|
|
651
|
-
};
|
|
611
|
+
const getBlockEditorAction = name => (...args) => ({
|
|
612
|
+
registry
|
|
613
|
+
}) => {
|
|
614
|
+
(0, _deprecated.default)("`wp.data.dispatch( 'core/editor' )." + name + '`', {
|
|
615
|
+
since: '5.3',
|
|
616
|
+
alternative: "`wp.data.dispatch( 'core/block-editor' )." + name + '`',
|
|
617
|
+
version: '6.2'
|
|
618
|
+
});
|
|
619
|
+
registry.dispatch(_blockEditor.store)[name](...args);
|
|
652
620
|
};
|
|
653
621
|
/**
|
|
654
622
|
* @see resetBlocks in core/block-editor store.
|