@wordpress/editor 13.11.0 → 13.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/build/components/autosave-monitor/index.js +1 -2
- package/build/components/autosave-monitor/index.js.map +1 -1
- package/build/components/deprecated.js +7 -9
- 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 +6 -9
- 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 +20 -27
- 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-history/redo.js +2 -6
- package/build/components/editor-history/redo.js.map +1 -1
- package/build/components/editor-history/undo.js +2 -6
- package/build/components/editor-history/undo.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 +86 -0
- package/build/components/entities-saved-states/hooks/use-is-dirty.js.map +1 -0
- package/build/components/entities-saved-states/index.js +43 -116
- 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 +18 -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 +7 -9
- 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/check.js +2 -4
- package/build/components/post-excerpt/check.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/check.js +2 -4
- package/build/components/post-featured-image/check.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 +6 -9
- 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 +10 -19
- 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 +10 -12
- 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/maybe-upload-media.js +150 -0
- package/build/components/post-publish-panel/maybe-upload-media.js.map +1 -0
- 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 +8 -7
- 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-sync-status/index.js +67 -0
- package/build/components/post-sync-status/index.js.map +1 -0
- 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 +36 -46
- 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 +8 -5
- 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 +14 -19
- 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 +12 -15
- package/build/components/provider/index.js.map +1 -1
- package/build/components/provider/index.native.js +19 -30
- 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/provider/with-registry-provider.js +4 -2
- package/build/components/provider/with-registry-provider.js.map +1 -1
- package/build/components/table-of-contents/index.js +26 -35
- 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 +20 -42
- 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/{lockUnlock.js → lock-unlock.js} +1 -1
- package/build/lock-unlock.js.map +1 -0
- package/build/private-apis.js +5 -2
- 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 +7 -8
- 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 +6 -8
- package/build-module/components/editor-help/help-detail-navigation-screen.native.js.map +1 -1
- package/build-module/components/editor-help/help-get-support-button.native.js +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 +20 -25
- 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-history/redo.js +2 -3
- package/build-module/components/editor-history/redo.js.map +1 -1
- package/build-module/components/editor-history/undo.js +2 -3
- package/build-module/components/editor-history/undo.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 +72 -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 +44 -118
- 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 +2 -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 +7 -9
- 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/check.js +2 -3
- package/build-module/components/post-excerpt/check.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/check.js +2 -3
- package/build-module/components/post-featured-image/check.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 +6 -8
- 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 +10 -18
- 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 +10 -11
- 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/maybe-upload-media.js +138 -0
- package/build-module/components/post-publish-panel/maybe-upload-media.js.map +1 -0
- 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 +7 -7
- 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-sync-status/index.js +56 -0
- package/build-module/components/post-sync-status/index.js.map +1 -0
- 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 +36 -44
- 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 +8 -5
- 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 +14 -16
- 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 +12 -14
- package/build-module/components/provider/index.js.map +1 -1
- package/build-module/components/provider/index.native.js +19 -29
- 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/provider/with-registry-provider.js +4 -2
- package/build-module/components/provider/with-registry-provider.js.map +1 -1
- package/build-module/components/table-of-contents/index.js +26 -34
- 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 +20 -39
- 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/{lockUnlock.js → lock-unlock.js} +1 -1
- package/build-module/lock-unlock.js.map +1 -0
- package/build-module/private-apis.js +4 -2
- 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 +15 -1
- package/build-style/style.css +15 -1
- package/package.json +30 -31
- package/src/components/editor-help/test/index.native.js +3 -2
- package/src/components/entities-saved-states/hooks/use-is-dirty.js +87 -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 +2 -0
- package/src/components/post-publish-panel/maybe-upload-media.js +167 -0
- package/src/components/post-publish-panel/prepublish.js +2 -0
- package/src/components/post-publish-panel/style.scss +1 -1
- package/src/components/post-saved-state/index.js +6 -0
- package/src/components/post-sync-status/index.js +55 -0
- package/src/components/post-sync-status/style.scss +16 -0
- package/src/components/post-taxonomies/flat-term-selector.js +20 -30
- package/src/components/post-title/index.js +4 -1
- package/src/components/provider/index.js +1 -1
- package/src/components/provider/index.native.js +2 -9
- package/src/private-apis.js +3 -1
- package/src/style.scss +1 -0
- package/build/lockUnlock.js.map +0 -1
- package/build-module/lockUnlock.js.map +0 -1
- /package/src/{lockUnlock.js → lock-unlock.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/components/entities-saved-states/entity-type-list.js"],"names":["__","useSelect","PanelBody","PanelRow","store","coreStore","EntityRecordItem","getEntityDescription","entity","count","EntityTypeList","list","unselectedEntities","setUnselectedEntities","closePanel","length","firstRecord","entityConfig","select","getEntityConfig","kind","name","entityLabel","label","description","map","record","key","property","some","elt","value"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,SAAT,EAAoBC,QAApB,QAAoC,uBAApC;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,OAAOC,gBAAP,MAA6B,sBAA7B;;AAEA,SAASC,oBAAT,CAA+BC,MAA/B,EAAuCC,KAAvC,EAA+C;AAC9C,UAASD,MAAT;AACC,SAAK,MAAL;AACC,aAAO,MAAMC,KAAN,GACJT,EAAE,CAAE,0CAAF,CADE,GAEJA,EAAE,CAAE,4CAAF,CAFL;;AAGD,SAAK,aAAL;AACC,aAAOA,EAAE,CACR,iEADQ,CAAT;;AAGD,SAAK,MAAL;AACA,SAAK,MAAL;AACC,aAAOA,EAAE,CAAE,0CAAF,CAAT;AAXF;AAaA;;AAED,eAAe,SAASU,cAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/components/entities-saved-states/entity-type-list.js"],"names":["__","useSelect","PanelBody","PanelRow","store","coreStore","EntityRecordItem","getEntityDescription","entity","count","EntityTypeList","list","unselectedEntities","setUnselectedEntities","closePanel","length","firstRecord","entityConfig","select","getEntityConfig","kind","name","entityLabel","label","description","map","record","key","property","some","elt","value"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,SAAT,EAAoBC,QAApB,QAAoC,uBAApC;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,OAAOC,gBAAP,MAA6B,sBAA7B;;AAEA,SAASC,oBAAT,CAA+BC,MAA/B,EAAuCC,KAAvC,EAA+C;AAC9C,UAASD,MAAT;AACC,SAAK,MAAL;AACC,aAAO,MAAMC,KAAN,GACJT,EAAE,CAAE,0CAAF,CADE,GAEJA,EAAE,CAAE,4CAAF,CAFL;;AAGD,SAAK,aAAL;AACC,aAAOA,EAAE,CACR,iEADQ,CAAT;;AAGD,SAAK,MAAL;AACA,SAAK,MAAL;AACC,aAAOA,EAAE,CAAE,0CAAF,CAAT;AAXF;AAaA;;AAED,eAAe,SAASU,cAAT,CAAyB;AACvCC,EAAAA,IADuC;AAEvCC,EAAAA,kBAFuC;AAGvCC,EAAAA,qBAHuC;AAIvCC,EAAAA;AAJuC,CAAzB,EAKX;AACH,QAAML,KAAK,GAAGE,IAAI,CAACI,MAAnB;AACA,QAAMC,WAAW,GAAGL,IAAI,CAAE,CAAF,CAAxB;AACA,QAAMM,YAAY,GAAGhB,SAAS,CAC3BiB,MAAF,IACCA,MAAM,CAAEb,SAAF,CAAN,CAAoBc,eAApB,C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__ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { PanelBody, PanelRow } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport EntityRecordItem from './entity-record-item';\n\nfunction getEntityDescription( entity, count ) {\n\tswitch ( entity ) {\n\t\tcase 'site':\n\t\t\treturn 1 === count\n\t\t\t\t? __( 'This change will affect your whole site.' )\n\t\t\t\t: __( 'These changes will affect your whole site.' );\n\t\tcase 'wp_template':\n\t\t\treturn __(\n\t\t\t\t'This change will affect pages and posts that use this template.'\n\t\t\t);\n\t\tcase 'page':\n\t\tcase 'post':\n\t\t\treturn __( 'The following content has been modified.' );\n\t}\n}\n\nexport default function EntityTypeList( {\n\tlist,\n\tunselectedEntities,\n\tsetUnselectedEntities,\n\tclosePanel,\n} ) {\n\tconst count = list.length;\n\tconst firstRecord = list[ 0 ];\n\tconst entityConfig = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getEntityConfig(\n\t\t\t\tfirstRecord.kind,\n\t\t\t\tfirstRecord.name\n\t\t\t),\n\t\t[ firstRecord.kind, firstRecord.name ]\n\t);\n\tconst { name } = firstRecord;\n\n\tlet entityLabel = entityConfig.label;\n\tif ( name === 'wp_template_part' ) {\n\t\tentityLabel =\n\t\t\t1 === count ? __( 'Template Part' ) : __( 'Template Parts' );\n\t}\n\t// Set description based on type of entity.\n\tconst description = getEntityDescription( name, count );\n\n\treturn (\n\t\t<PanelBody title={ entityLabel } initialOpen={ true }>\n\t\t\t{ description && <PanelRow>{ description }</PanelRow> }\n\t\t\t{ list.map( ( record ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<EntityRecordItem\n\t\t\t\t\t\tkey={ record.key || record.property }\n\t\t\t\t\t\trecord={ record }\n\t\t\t\t\t\tchecked={\n\t\t\t\t\t\t\t! unselectedEntities.some(\n\t\t\t\t\t\t\t\t( elt ) =>\n\t\t\t\t\t\t\t\t\telt.kind === record.kind &&\n\t\t\t\t\t\t\t\t\telt.name === record.name &&\n\t\t\t\t\t\t\t\t\telt.key === record.key &&\n\t\t\t\t\t\t\t\t\telt.property === record.property\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetUnselectedEntities( record, value )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tclosePanel={ closePanel }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</PanelBody>\n\t);\n}\n"]}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useSelect } from '@wordpress/data';
|
|
5
|
+
import { store as coreStore } from '@wordpress/core-data';
|
|
6
|
+
import { useState } from '@wordpress/element';
|
|
7
|
+
import { __ } from '@wordpress/i18n';
|
|
8
|
+
const TRANSLATED_SITE_PROPERTIES = {
|
|
9
|
+
title: __('Title'),
|
|
10
|
+
description: __('Tagline'),
|
|
11
|
+
site_logo: __('Logo'),
|
|
12
|
+
site_icon: __('Icon'),
|
|
13
|
+
show_on_front: __('Show on front'),
|
|
14
|
+
page_on_front: __('Page on front'),
|
|
15
|
+
posts_per_page: __('Maximum posts per page'),
|
|
16
|
+
default_comment_status: __('Allow comments on new posts')
|
|
17
|
+
};
|
|
18
|
+
export const useIsDirty = () => {
|
|
19
|
+
const {
|
|
20
|
+
dirtyEntityRecords
|
|
21
|
+
} = useSelect(select => {
|
|
22
|
+
const dirtyRecords = select(coreStore).__experimentalGetDirtyEntityRecords(); // Remove site object and decouple into its edited pieces.
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
const dirtyRecordsWithoutSite = dirtyRecords.filter(record => !(record.kind === 'root' && record.name === 'site'));
|
|
26
|
+
const siteEdits = select(coreStore).getEntityRecordEdits('root', 'site');
|
|
27
|
+
const siteEditsAsEntities = [];
|
|
28
|
+
|
|
29
|
+
for (const property in siteEdits) {
|
|
30
|
+
siteEditsAsEntities.push({
|
|
31
|
+
kind: 'root',
|
|
32
|
+
name: 'site',
|
|
33
|
+
title: TRANSLATED_SITE_PROPERTIES[property] || property,
|
|
34
|
+
property
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const dirtyRecordsWithSiteItems = [...dirtyRecordsWithoutSite, ...siteEditsAsEntities];
|
|
39
|
+
return {
|
|
40
|
+
dirtyEntityRecords: dirtyRecordsWithSiteItems
|
|
41
|
+
};
|
|
42
|
+
}, []); // Unchecked entities to be ignored by save function.
|
|
43
|
+
|
|
44
|
+
const [unselectedEntities, _setUnselectedEntities] = useState([]);
|
|
45
|
+
|
|
46
|
+
const setUnselectedEntities = ({
|
|
47
|
+
kind,
|
|
48
|
+
name,
|
|
49
|
+
key,
|
|
50
|
+
property
|
|
51
|
+
}, checked) => {
|
|
52
|
+
if (checked) {
|
|
53
|
+
_setUnselectedEntities(unselectedEntities.filter(elt => elt.kind !== kind || elt.name !== name || elt.key !== key || elt.property !== property));
|
|
54
|
+
} else {
|
|
55
|
+
_setUnselectedEntities([...unselectedEntities, {
|
|
56
|
+
kind,
|
|
57
|
+
name,
|
|
58
|
+
key,
|
|
59
|
+
property
|
|
60
|
+
}]);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const isDirty = dirtyEntityRecords.length - unselectedEntities.length > 0;
|
|
65
|
+
return {
|
|
66
|
+
dirtyEntityRecords,
|
|
67
|
+
isDirty,
|
|
68
|
+
setUnselectedEntities,
|
|
69
|
+
unselectedEntities
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
//# sourceMappingURL=use-is-dirty.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/components/entities-saved-states/hooks/use-is-dirty.js"],"names":["useSelect","store","coreStore","useState","__","TRANSLATED_SITE_PROPERTIES","title","description","site_logo","site_icon","show_on_front","page_on_front","posts_per_page","default_comment_status","useIsDirty","dirtyEntityRecords","select","dirtyRecords","__experimentalGetDirtyEntityRecords","dirtyRecordsWithoutSite","filter","record","kind","name","siteEdits","getEntityRecordEdits","siteEditsAsEntities","property","push","dirtyRecordsWithSiteItems","unselectedEntities","_setUnselectedEntities","setUnselectedEntities","key","checked","elt","isDirty","length"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,iBAA1B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SAASC,QAAT,QAAyB,oBAAzB;AACA,SAASC,EAAT,QAAmB,iBAAnB;AAEA,MAAMC,0BAA0B,GAAG;AAClCC,EAAAA,KAAK,EAAEF,EAAE,CAAE,OAAF,CADyB;AAElCG,EAAAA,WAAW,EAAEH,EAAE,CAAE,SAAF,CAFmB;AAGlCI,EAAAA,SAAS,EAAEJ,EAAE,CAAE,MAAF,CAHqB;AAIlCK,EAAAA,SAAS,EAAEL,EAAE,CAAE,MAAF,CAJqB;AAKlCM,EAAAA,aAAa,EAAEN,EAAE,CAAE,eAAF,CALiB;AAMlCO,EAAAA,aAAa,EAAEP,EAAE,CAAE,eAAF,CANiB;AAOlCQ,EAAAA,cAAc,EAAER,EAAE,CAAE,wBAAF,CAPgB;AAQlCS,EAAAA,sBAAsB,EAAET,EAAE,CAAE,6BAAF;AARQ,CAAnC;AAWA,OAAO,MAAMU,UAAU,GAAG,MAAM;AAC/B,QAAM;AAAEC,IAAAA;AAAF,MAAyBf,SAAS,CAAIgB,MAAF,IAAc;AACvD,UAAMC,YAAY,GACjBD,MAAM,CAAEd,SAAF,CAAN,CAAoBgB,mCAApB,EADD,CADuD,CAIvD;;;AACA,UAAMC,uBAAuB,GAAGF,YAAY,CAACG,MAAb,CAC7BC,MAAF,IAAc,EAAIA,MAAM,CAACC,IAAP,KAAgB,MAAhB,IAA0BD,MAAM,CAACE,IAAP,KAAgB,MAA9C,CADiB,CAAhC;AAIA,UAAMC,SAAS,GAAGR,MAAM,CAAEd,SAAF,CAAN,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AAMS,OAAO,GAAGrB,kBAAkB,CAACsB,MAAnB,GAA4BP,kBAAkB,CAACO,MAA/C,GAAwD,CAAxE;AAEA,SAAO;AACNtB,IAAAA,kBADM;AAENqB,IAAAA,OAFM;AAGNJ,IAAAA,qBAHM;AAINF,IAAAA;AAJM,GAAP;AAMA,CAnEM","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\nconst TRANSLATED_SITE_PROPERTIES = {\n\ttitle: __( 'Title' ),\n\tdescription: __( 'Tagline' ),\n\tsite_logo: __( 'Logo' ),\n\tsite_icon: __( 'Icon' ),\n\tshow_on_front: __( 'Show on front' ),\n\tpage_on_front: __( 'Page on front' ),\n\tposts_per_page: __( 'Maximum posts per page' ),\n\tdefault_comment_status: __( 'Allow comments on new posts' ),\n};\n\nexport const useIsDirty = () => {\n\tconst { dirtyEntityRecords } = useSelect( ( select ) => {\n\t\tconst dirtyRecords =\n\t\t\tselect( coreStore ).__experimentalGetDirtyEntityRecords();\n\n\t\t// Remove site object and decouple into its edited pieces.\n\t\tconst dirtyRecordsWithoutSite = dirtyRecords.filter(\n\t\t\t( record ) => ! ( record.kind === 'root' && record.name === 'site' )\n\t\t);\n\n\t\tconst siteEdits = select( coreStore ).getEntityRecordEdits(\n\t\t\t'root',\n\t\t\t'site'\n\t\t);\n\n\t\tconst siteEditsAsEntities = [];\n\t\tfor ( const property in siteEdits ) {\n\t\t\tsiteEditsAsEntities.push( {\n\t\t\t\tkind: 'root',\n\t\t\t\tname: 'site',\n\t\t\t\ttitle: TRANSLATED_SITE_PROPERTIES[ property ] || property,\n\t\t\t\tproperty,\n\t\t\t} );\n\t\t}\n\t\tconst dirtyRecordsWithSiteItems = [\n\t\t\t...dirtyRecordsWithoutSite,\n\t\t\t...siteEditsAsEntities,\n\t\t];\n\n\t\treturn {\n\t\t\tdirtyEntityRecords: dirtyRecordsWithSiteItems,\n\t\t};\n\t}, [] );\n\n\t// Unchecked entities to be ignored by save function.\n\tconst [ unselectedEntities, _setUnselectedEntities ] = useState( [] );\n\n\tconst setUnselectedEntities = (\n\t\t{ kind, name, key, property },\n\t\tchecked\n\t) => {\n\t\tif ( checked ) {\n\t\t\t_setUnselectedEntities(\n\t\t\t\tunselectedEntities.filter(\n\t\t\t\t\t( elt ) =>\n\t\t\t\t\t\telt.kind !== kind ||\n\t\t\t\t\t\telt.name !== name ||\n\t\t\t\t\t\telt.key !== key ||\n\t\t\t\t\t\telt.property !== property\n\t\t\t\t)\n\t\t\t);\n\t\t} else {\n\t\t\t_setUnselectedEntities( [\n\t\t\t\t...unselectedEntities,\n\t\t\t\t{ kind, name, key, property },\n\t\t\t] );\n\t\t}\n\t};\n\n\tconst isDirty = dirtyEntityRecords.length - unselectedEntities.length > 0;\n\n\treturn {\n\t\tdirtyEntityRecords,\n\t\tisDirty,\n\t\tsetUnselectedEntities,\n\t\tunselectedEntities,\n\t};\n};\n"]}
|
|
@@ -1,31 +1,22 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
1
|
import { createElement } from "@wordpress/element";
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
4
|
* WordPress dependencies
|
|
6
5
|
*/
|
|
7
6
|
import { Button, Flex, FlexItem } from '@wordpress/components';
|
|
8
|
-
import { __
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
7
|
+
import { __ } from '@wordpress/i18n';
|
|
8
|
+
import { useDispatch } from '@wordpress/data';
|
|
9
|
+
import { useCallback, useRef } from '@wordpress/element';
|
|
11
10
|
import { store as coreStore } from '@wordpress/core-data';
|
|
12
11
|
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
13
12
|
import { __experimentalUseDialog as useDialog } from '@wordpress/compose';
|
|
14
13
|
import { store as noticesStore } from '@wordpress/notices';
|
|
15
|
-
import { getQueryArg } from '@wordpress/url';
|
|
16
14
|
/**
|
|
17
15
|
* Internal dependencies
|
|
18
16
|
*/
|
|
19
17
|
|
|
20
18
|
import EntityTypeList from './entity-type-list';
|
|
21
|
-
|
|
22
|
-
title: __('Title'),
|
|
23
|
-
description: __('Tagline'),
|
|
24
|
-
site_logo: __('Logo'),
|
|
25
|
-
site_icon: __('Icon'),
|
|
26
|
-
show_on_front: __('Show on front'),
|
|
27
|
-
page_on_front: __('Page on front')
|
|
28
|
-
};
|
|
19
|
+
import { useIsDirty } from './hooks/use-is-dirty';
|
|
29
20
|
const PUBLISH_ON_SAVE_ENTITIES = [{
|
|
30
21
|
kind: 'postType',
|
|
31
22
|
name: 'wp_navigation'
|
|
@@ -35,56 +26,27 @@ function identity(values) {
|
|
|
35
26
|
return values;
|
|
36
27
|
}
|
|
37
28
|
|
|
38
|
-
function
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
return getQueryArg(window.location.href, 'theme_preview');
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
return null;
|
|
29
|
+
export default function EntitiesSavedStates({
|
|
30
|
+
close
|
|
31
|
+
}) {
|
|
32
|
+
const isDirtyProps = useIsDirty();
|
|
33
|
+
return createElement(EntitiesSavedStatesExtensible, {
|
|
34
|
+
close: close,
|
|
35
|
+
...isDirtyProps
|
|
36
|
+
});
|
|
50
37
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
38
|
+
export function EntitiesSavedStatesExtensible({
|
|
39
|
+
additionalPrompt = undefined,
|
|
40
|
+
close,
|
|
41
|
+
onSave = identity,
|
|
42
|
+
saveEnabled: saveEnabledProp = undefined,
|
|
43
|
+
saveLabel = __('Save'),
|
|
44
|
+
dirtyEntityRecords,
|
|
45
|
+
isDirty,
|
|
46
|
+
setUnselectedEntities,
|
|
47
|
+
unselectedEntities
|
|
48
|
+
}) {
|
|
59
49
|
const saveButtonRef = useRef();
|
|
60
|
-
const {
|
|
61
|
-
getTheme
|
|
62
|
-
} = useSelect(coreStore);
|
|
63
|
-
const theme = getTheme(currentlyPreviewingTheme());
|
|
64
|
-
const {
|
|
65
|
-
dirtyEntityRecords
|
|
66
|
-
} = useSelect(select => {
|
|
67
|
-
const dirtyRecords = select(coreStore).__experimentalGetDirtyEntityRecords(); // Remove site object and decouple into its edited pieces.
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
const dirtyRecordsWithoutSite = dirtyRecords.filter(record => !(record.kind === 'root' && record.name === 'site'));
|
|
71
|
-
const siteEdits = select(coreStore).getEntityRecordEdits('root', 'site');
|
|
72
|
-
const siteEditsAsEntities = [];
|
|
73
|
-
|
|
74
|
-
for (const property in siteEdits) {
|
|
75
|
-
siteEditsAsEntities.push({
|
|
76
|
-
kind: 'root',
|
|
77
|
-
name: 'site',
|
|
78
|
-
title: TRANSLATED_SITE_PROPERTIES[property] || property,
|
|
79
|
-
property
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
const dirtyRecordsWithSiteItems = [...dirtyRecordsWithoutSite, ...siteEditsAsEntities];
|
|
84
|
-
return {
|
|
85
|
-
dirtyEntityRecords: dirtyRecordsWithSiteItems
|
|
86
|
-
};
|
|
87
|
-
}, []);
|
|
88
50
|
const {
|
|
89
51
|
editEntityRecord,
|
|
90
52
|
saveEditedEntityRecord,
|
|
@@ -118,53 +80,29 @@ export default function EntitiesSavedStates(_ref) {
|
|
|
118
80
|
wp_template_part: templatePartSavables,
|
|
119
81
|
...contentSavables
|
|
120
82
|
} = partitionedSavables;
|
|
121
|
-
const sortedPartitionedSavables = [siteSavables, templateSavables, templatePartSavables, ...Object.values(contentSavables)].filter(Array.isArray);
|
|
122
|
-
|
|
123
|
-
const [unselectedEntities, _setUnselectedEntities] = useState([]);
|
|
83
|
+
const sortedPartitionedSavables = [siteSavables, templateSavables, templatePartSavables, ...Object.values(contentSavables)].filter(Array.isArray);
|
|
84
|
+
const saveEnabled = saveEnabledProp !== null && saveEnabledProp !== void 0 ? saveEnabledProp : isDirty;
|
|
124
85
|
|
|
125
|
-
const
|
|
126
|
-
|
|
86
|
+
const saveCheckedEntities = () => {
|
|
87
|
+
const saveNoticeId = 'site-editor-save-success';
|
|
88
|
+
removeNotice(saveNoticeId);
|
|
89
|
+
const entitiesToSave = dirtyEntityRecords.filter(({
|
|
127
90
|
kind,
|
|
128
91
|
name,
|
|
129
92
|
key,
|
|
130
93
|
property
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
if (checked) {
|
|
134
|
-
_setUnselectedEntities(unselectedEntities.filter(elt => elt.kind !== kind || elt.name !== name || elt.key !== key || elt.property !== property));
|
|
135
|
-
} else {
|
|
136
|
-
_setUnselectedEntities([...unselectedEntities, {
|
|
137
|
-
kind,
|
|
138
|
-
name,
|
|
139
|
-
key,
|
|
140
|
-
property
|
|
141
|
-
}]);
|
|
142
|
-
}
|
|
143
|
-
};
|
|
144
|
-
|
|
145
|
-
const saveCheckedEntitiesAndActivate = () => {
|
|
146
|
-
const saveNoticeId = 'site-editor-save-success';
|
|
147
|
-
removeNotice(saveNoticeId);
|
|
148
|
-
const entitiesToSave = dirtyEntityRecords.filter(_ref3 => {
|
|
149
|
-
let {
|
|
150
|
-
kind,
|
|
151
|
-
name,
|
|
152
|
-
key,
|
|
153
|
-
property
|
|
154
|
-
} = _ref3;
|
|
94
|
+
}) => {
|
|
155
95
|
return !unselectedEntities.some(elt => elt.kind === kind && elt.name === name && elt.key === key && elt.property === property);
|
|
156
96
|
});
|
|
157
97
|
close(entitiesToSave);
|
|
158
98
|
const siteItemsToSave = [];
|
|
159
99
|
const pendingSavedRecords = [];
|
|
160
|
-
entitiesToSave.forEach(
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
} = _ref4;
|
|
167
|
-
|
|
100
|
+
entitiesToSave.forEach(({
|
|
101
|
+
kind,
|
|
102
|
+
name,
|
|
103
|
+
key,
|
|
104
|
+
property
|
|
105
|
+
}) => {
|
|
168
106
|
if ('root' === kind && 'site' === name) {
|
|
169
107
|
siteItemsToSave.push(property);
|
|
170
108
|
} else {
|
|
@@ -204,23 +142,11 @@ export default function EntitiesSavedStates(_ref) {
|
|
|
204
142
|
const [saveDialogRef, saveDialogProps] = useDialog({
|
|
205
143
|
onClose: () => dismissPanel()
|
|
206
144
|
});
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
if (isPreviewingTheme() && isDirty) {
|
|
212
|
-
activateSaveLabel = __('Activate & Save');
|
|
213
|
-
} else if (isPreviewingTheme()) {
|
|
214
|
-
activateSaveLabel = __('Activate');
|
|
215
|
-
} else {
|
|
216
|
-
activateSaveLabel = __('Save');
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
return createElement("div", _extends({
|
|
220
|
-
ref: saveDialogRef
|
|
221
|
-
}, saveDialogProps, {
|
|
145
|
+
return createElement("div", {
|
|
146
|
+
ref: saveDialogRef,
|
|
147
|
+
...saveDialogProps,
|
|
222
148
|
className: "entities-saved-states__panel"
|
|
223
|
-
}
|
|
149
|
+
}, createElement(Flex, {
|
|
224
150
|
className: "entities-saved-states__panel-header",
|
|
225
151
|
gap: 2
|
|
226
152
|
}, createElement(FlexItem, {
|
|
@@ -228,17 +154,17 @@ export default function EntitiesSavedStates(_ref) {
|
|
|
228
154
|
as: Button,
|
|
229
155
|
ref: saveButtonRef,
|
|
230
156
|
variant: "primary",
|
|
231
|
-
disabled: !
|
|
232
|
-
onClick:
|
|
157
|
+
disabled: !saveEnabled,
|
|
158
|
+
onClick: saveCheckedEntities,
|
|
233
159
|
className: "editor-entities-saved-states__save-button"
|
|
234
|
-
},
|
|
160
|
+
}, saveLabel), createElement(FlexItem, {
|
|
235
161
|
isBlock: true,
|
|
236
162
|
as: Button,
|
|
237
163
|
variant: "secondary",
|
|
238
164
|
onClick: dismissPanel
|
|
239
165
|
}, __('Cancel'))), createElement("div", {
|
|
240
166
|
className: "entities-saved-states__text-prompt"
|
|
241
|
-
}, createElement("strong", null, __('Are you ready to save?')),
|
|
167
|
+
}, createElement("strong", null, __('Are you ready to save?')), additionalPrompt, isDirty && createElement("p", null, __('The following changes have been made to your site, templates, and content.'))), sortedPartitionedSavables.map(list => {
|
|
242
168
|
return createElement(EntityTypeList, {
|
|
243
169
|
key: list[0].name,
|
|
244
170
|
list: list,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/components/entities-saved-states/index.js"],"names":["Button","Flex","FlexItem","__","sprintf","useSelect","useDispatch","useState","useCallback","useRef","store","coreStore","blockEditorStore","__experimentalUseDialog","useDialog","noticesStore","getQueryArg","EntityTypeList","TRANSLATED_SITE_PROPERTIES","title","description","site_logo","site_icon","show_on_front","page_on_front","PUBLISH_ON_SAVE_ENTITIES","kind","name","identity","values","isPreviewingTheme","window","__experimentalEnableThemePreviews","location","href","undefined","currentlyPreviewingTheme","EntitiesSavedStates","close","onSave","saveButtonRef","getTheme","theme","dirtyEntityRecords","select","dirtyRecords","__experimentalGetDirtyEntityRecords","dirtyRecordsWithoutSite","filter","record","siteEdits","getEntityRecordEdits","siteEditsAsEntities","property","push","dirtyRecordsWithSiteItems","editEntityRecord","saveEditedEntityRecord","__experimentalSaveSpecifiedEntityEdits","saveSpecifiedEntityEdits","__unstableMarkLastChangeAsPersistent","createSuccessNotice","createErrorNotice","removeNotice","partitionedSavables","reduce","acc","site","siteSavables","wp_template","templateSavables","wp_template_part","templatePartSavables","contentSavables","sortedPartitionedSavables","Object","Array","isArray","unselectedEntities","_setUnselectedEntities","setUnselectedEntities","checked","key","elt","saveCheckedEntitiesAndActivate","saveNoticeId","entitiesToSave","some","siteItemsToSave","pendingSavedRecords","forEach","typeToPublish","status","length","Promise","all","then","value","type","id","catch","error","dismissPanel","saveDialogRef","saveDialogProps","onClose","isDirty","activateSaveEnabled","activateSa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D;AACC,IAAA,OAAO,MADR;AAEC,IAAA,EAAE,EAAGxG,MAFN;AAGC,IAAA,GAAG,EAAGwC,aAHP;AAIC,IAAA,OAAO,EAAC,SAJT;AAKC,IAAA,QAAQ,EAAG,CAAEmE,mBALd;AAMC,IAAA,OAAO,EAAGvB,8BANX;AAOC,IAAA,SAAS,EAAC;AAPX,KASGwB,iBATH,CADD,EAYC,cAAC,QAAD;AACC,IAAA,OAAO,MADR;AAEC,IAAA,EAAE,EAAG5G,MAFN;AAGC,IAAA,OAAO,EAAC,WAHT;AAIC,IAAA,OAAO,EAAGsG;AAJX,KAMGnG,EAAE,CAAE,QAAF,CANL,CAZD,CALD,EA2BC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,8BAAUA,EAAE,CAAE,wBAAF,CAAZ,CADD,EAEG2B,iBAAiB,MAClB,yBACG1B,OAAO,CACR,6DADQ,EAERsC,KAFQ,aAERA,KAFQ,sCAERA,KAAK,CAAEf,IAFC,gDAER,YAAakF,QAFL,CADV,CAHF,EAUGH,OAAO,IACR,yBACGvG,EAAE,CACH,4EADG,CADL,CAXF,CA3BD,EA8CGuE,yBAAyB,CAACoC,GAA1B,CAAiCC,IAAF,IAAY;AAC5C,WACC,cAAC,cAAD;AACC,MAAA,GAAG,EAAGA,IAAI,CAAE,CAAF,CAAJ,CAAUpF,IADjB;AAEC,MAAA,IAAI,EAAGoF,IAFR;AAGC,MAAA,UAAU,EAAGT,YAHd;AAIC,MAAA,kBAAkB,EAAGxB,kBAJtB;AAKC,MAAA,qBAAqB,EAAGE;AALzB,MADD;AASA,GAVC,CA9CH,CADD;AA4DA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Button, Flex, FlexItem } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useState, useCallback, useRef } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { __experimentalUseDialog as useDialog } from '@wordpress/compose';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { getQueryArg } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport EntityTypeList from './entity-type-list';\n\nconst TRANSLATED_SITE_PROPERTIES = {\n\ttitle: __( 'Title' ),\n\tdescription: __( 'Tagline' ),\n\tsite_logo: __( 'Logo' ),\n\tsite_icon: __( 'Icon' ),\n\tshow_on_front: __( 'Show on front' ),\n\tpage_on_front: __( 'Page on front' ),\n};\n\nconst PUBLISH_ON_SAVE_ENTITIES = [\n\t{\n\t\tkind: 'postType',\n\t\tname: 'wp_navigation',\n\t},\n];\n\nfunction identity( values ) {\n\treturn values;\n}\n\nfunction isPreviewingTheme() {\n\treturn (\n\t\twindow?.__experimentalEnableThemePreviews &&\n\t\tgetQueryArg( window.location.href, 'theme_preview' ) !== undefined\n\t);\n}\n\nfunction currentlyPreviewingTheme() {\n\tif ( isPreviewingTheme() ) {\n\t\treturn getQueryArg( window.location.href, 'theme_preview' );\n\t}\n\treturn null;\n}\n\nexport default function EntitiesSavedStates( { close, onSave = identity } ) {\n\tconst saveButtonRef = useRef();\n\tconst { getTheme } = useSelect( coreStore );\n\tconst theme = getTheme( currentlyPreviewingTheme() );\n\tconst { dirtyEntityRecords } = useSelect( ( select ) => {\n\t\tconst dirtyRecords =\n\t\t\tselect( coreStore ).__experimentalGetDirtyEntityRecords();\n\n\t\t// Remove site object and decouple into its edited pieces.\n\t\tconst dirtyRecordsWithoutSite = dirtyRecords.filter(\n\t\t\t( record ) => ! ( record.kind === 'root' && record.name === 'site' )\n\t\t);\n\n\t\tconst siteEdits = select( coreStore ).getEntityRecordEdits(\n\t\t\t'root',\n\t\t\t'site'\n\t\t);\n\n\t\tconst siteEditsAsEntities = [];\n\t\tfor ( const property in siteEdits ) {\n\t\t\tsiteEditsAsEntities.push( {\n\t\t\t\tkind: 'root',\n\t\t\t\tname: 'site',\n\t\t\t\ttitle: TRANSLATED_SITE_PROPERTIES[ property ] || property,\n\t\t\t\tproperty,\n\t\t\t} );\n\t\t}\n\t\tconst dirtyRecordsWithSiteItems = [\n\t\t\t...dirtyRecordsWithoutSite,\n\t\t\t...siteEditsAsEntities,\n\t\t];\n\n\t\treturn {\n\t\t\tdirtyEntityRecords: dirtyRecordsWithSiteItems,\n\t\t};\n\t}, [] );\n\tconst {\n\t\teditEntityRecord,\n\t\tsaveEditedEntityRecord,\n\t\t__experimentalSaveSpecifiedEntityEdits: saveSpecifiedEntityEdits,\n\t} = useDispatch( coreStore );\n\n\tconst { __unstableMarkLastChangeAsPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\n\tconst { createSuccessNotice, createErrorNotice, removeNotice } =\n\t\tuseDispatch( noticesStore );\n\n\t// To group entities by type.\n\tconst partitionedSavables = dirtyEntityRecords.reduce( ( acc, record ) => {\n\t\tconst { name } = record;\n\t\tif ( ! acc[ name ] ) {\n\t\t\tacc[ name ] = [];\n\t\t}\n\t\tacc[ name ].push( record );\n\t\treturn acc;\n\t}, {} );\n\n\t// Sort entity groups.\n\tconst {\n\t\tsite: siteSavables,\n\t\twp_template: templateSavables,\n\t\twp_template_part: templatePartSavables,\n\t\t...contentSavables\n\t} = partitionedSavables;\n\tconst sortedPartitionedSavables = [\n\t\tsiteSavables,\n\t\ttemplateSavables,\n\t\ttemplatePartSavables,\n\t\t...Object.values( contentSavables ),\n\t].filter( Array.isArray );\n\n\t// Unchecked entities to be ignored by save function.\n\tconst [ unselectedEntities, _setUnselectedEntities ] = useState( [] );\n\n\tconst setUnselectedEntities = (\n\t\t{ kind, name, key, property },\n\t\tchecked\n\t) => {\n\t\tif ( checked ) {\n\t\t\t_setUnselectedEntities(\n\t\t\t\tunselectedEntities.filter(\n\t\t\t\t\t( elt ) =>\n\t\t\t\t\t\telt.kind !== kind ||\n\t\t\t\t\t\telt.name !== name ||\n\t\t\t\t\t\telt.key !== key ||\n\t\t\t\t\t\telt.property !== property\n\t\t\t\t)\n\t\t\t);\n\t\t} else {\n\t\t\t_setUnselectedEntities( [\n\t\t\t\t...unselectedEntities,\n\t\t\t\t{ kind, name, key, property },\n\t\t\t] );\n\t\t}\n\t};\n\n\tconst saveCheckedEntitiesAndActivate = () => {\n\t\tconst saveNoticeId = 'site-editor-save-success';\n\t\tremoveNotice( saveNoticeId );\n\t\tconst entitiesToSave = dirtyEntityRecords.filter(\n\t\t\t( { kind, name, key, property } ) => {\n\t\t\t\treturn ! unselectedEntities.some(\n\t\t\t\t\t( elt ) =>\n\t\t\t\t\t\telt.kind === kind &&\n\t\t\t\t\t\telt.name === name &&\n\t\t\t\t\t\telt.key === key &&\n\t\t\t\t\t\telt.property === property\n\t\t\t\t);\n\t\t\t}\n\t\t);\n\n\t\tclose( entitiesToSave );\n\n\t\tconst siteItemsToSave = [];\n\t\tconst pendingSavedRecords = [];\n\t\tentitiesToSave.forEach( ( { kind, name, key, property } ) => {\n\t\t\tif ( 'root' === kind && 'site' === name ) {\n\t\t\t\tsiteItemsToSave.push( property );\n\t\t\t} else {\n\t\t\t\tif (\n\t\t\t\t\tPUBLISH_ON_SAVE_ENTITIES.some(\n\t\t\t\t\t\t( typeToPublish ) =>\n\t\t\t\t\t\t\ttypeToPublish.kind === kind &&\n\t\t\t\t\t\t\ttypeToPublish.name === name\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\teditEntityRecord( kind, name, key, { status: 'publish' } );\n\t\t\t\t}\n\n\t\t\t\tpendingSavedRecords.push(\n\t\t\t\t\tsaveEditedEntityRecord( kind, name, key )\n\t\t\t\t);\n\t\t\t}\n\t\t} );\n\t\tif ( siteItemsToSave.length ) {\n\t\t\tpendingSavedRecords.push(\n\t\t\t\tsaveSpecifiedEntityEdits(\n\t\t\t\t\t'root',\n\t\t\t\t\t'site',\n\t\t\t\t\tundefined,\n\t\t\t\t\tsiteItemsToSave\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\n\t\t__unstableMarkLastChangeAsPersistent();\n\n\t\tPromise.all( pendingSavedRecords )\n\t\t\t.then( ( values ) => {\n\t\t\t\treturn onSave( values );\n\t\t\t} )\n\t\t\t.then( ( values ) => {\n\t\t\t\tif (\n\t\t\t\t\tvalues.some( ( value ) => typeof value === 'undefined' )\n\t\t\t\t) {\n\t\t\t\t\tcreateErrorNotice( __( 'Saving failed.' ) );\n\t\t\t\t} else {\n\t\t\t\t\tcreateSuccessNotice( __( 'Site updated.' ), {\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\tid: saveNoticeId,\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t} )\n\t\t\t.catch( ( error ) =>\n\t\t\t\tcreateErrorNotice( `${ __( 'Saving failed.' ) } ${ error }` )\n\t\t\t);\n\t};\n\n\t// Explicitly define this with no argument passed. Using `close` on\n\t// its own will use the event object in place of the expected saved entities.\n\tconst dismissPanel = useCallback( () => close(), [ close ] );\n\n\tconst [ saveDialogRef, saveDialogProps ] = useDialog( {\n\t\tonClose: () => dismissPanel(),\n\t} );\n\n\tconst isDirty = dirtyEntityRecords.length - unselectedEntities.length > 0;\n\tconst activateSaveEnabled = isPreviewingTheme() || isDirty;\n\n\tlet activateSaveLabel;\n\tif ( isPreviewingTheme() && isDirty ) {\n\t\tactivateSaveLabel = __( 'Activate & Save' );\n\t} else if ( isPreviewingTheme() ) {\n\t\tactivateSaveLabel = __( 'Activate' );\n\t} else {\n\t\tactivateSaveLabel = __( 'Save' );\n\t}\n\n\treturn (\n\t\t<div\n\t\t\tref={ saveDialogRef }\n\t\t\t{ ...saveDialogProps }\n\t\t\tclassName=\"entities-saved-states__panel\"\n\t\t>\n\t\t\t<Flex className=\"entities-saved-states__panel-header\" gap={ 2 }>\n\t\t\t\t<FlexItem\n\t\t\t\t\tisBlock\n\t\t\t\t\tas={ Button }\n\t\t\t\t\tref={ saveButtonRef }\n\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\tdisabled={ ! activateSaveEnabled }\n\t\t\t\t\tonClick={ saveCheckedEntitiesAndActivate }\n\t\t\t\t\tclassName=\"editor-entities-saved-states__save-button\"\n\t\t\t\t>\n\t\t\t\t\t{ activateSaveLabel }\n\t\t\t\t</FlexItem>\n\t\t\t\t<FlexItem\n\t\t\t\t\tisBlock\n\t\t\t\t\tas={ Button }\n\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\tonClick={ dismissPanel }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t</FlexItem>\n\t\t\t</Flex>\n\n\t\t\t<div className=\"entities-saved-states__text-prompt\">\n\t\t\t\t<strong>{ __( 'Are you ready to save?' ) }</strong>\n\t\t\t\t{ isPreviewingTheme() && (\n\t\t\t\t\t<p>\n\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t'Saving your changes will change your active theme to %1$s.',\n\t\t\t\t\t\t\ttheme?.name?.rendered\n\t\t\t\t\t\t) }\n\t\t\t\t\t</p>\n\t\t\t\t) }\n\t\t\t\t{ isDirty && (\n\t\t\t\t\t<p>\n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'The following changes have been made to your site, templates, and content.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t</p>\n\t\t\t\t) }\n\t\t\t</div>\n\n\t\t\t{ sortedPartitionedSavables.map( ( list ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<EntityTypeList\n\t\t\t\t\t\tkey={ list[ 0 ].name }\n\t\t\t\t\t\tlist={ list }\n\t\t\t\t\t\tclosePanel={ dismissPanel }\n\t\t\t\t\t\tunselectedEntities={ unselectedEntities }\n\t\t\t\t\t\tsetUnselectedEntities={ setUnselectedEntities }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</div>\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/components/entities-saved-states/index.js"],"names":["Button","Flex","FlexItem","__","useDispatch","useCallback","useRef","store","coreStore","blockEditorStore","__experimentalUseDialog","useDialog","noticesStore","EntityTypeList","useIsDirty","PUBLISH_ON_SAVE_ENTITIES","kind","name","identity","values","EntitiesSavedStates","close","isDirtyProps","EntitiesSavedStatesExtensible","additionalPrompt","undefined","onSave","saveEnabled","saveEnabledProp","saveLabel","dirtyEntityRecords","isDirty","setUnselectedEntities","unselectedEntities","saveButtonRef","editEntityRecord","saveEditedEntityRecord","__experimentalSaveSpecifiedEntityEdits","saveSpecifiedEntityEdits","__unstableMarkLastChangeAsPersistent","createSuccessNotice","createErrorNotice","removeNotice","partitionedSavables","reduce","acc","record","push","site","siteSavables","wp_template","templateSavables","wp_template_part","templatePartSavables","contentSavables","sortedPartitionedSavables","Object","filter","Array","isArray","saveCheckedEntities","saveNoticeId","entitiesToSave","key","property","some","elt","siteItemsToSave","pendingSavedRecords","forEach","typeToPublish","status","length","Promise","all","then","value","type","id","catch","error","dismissPanel","saveDialogRef","saveDialogProps","onClose","map","list"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,MAAT,EAAiBC,IAAjB,EAAuBC,QAAvB,QAAuC,uBAAvC;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,WAAT,QAA4B,iBAA5B;AACA,SAASC,WAAT,EAAsBC,MAAtB,QAAoC,oBAApC;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SAASD,KAAK,IAAIE,gBAAlB,QAA0C,yBAA1C;AACA,SAASC,uBAAuB,IAAIC,SAApC,QAAqD,oBAArD;AACA,SAASJ,KAAK,IAAIK,YAAlB,QAAsC,oBAAtC;AAEA;AACA;AACA;;AACA,OAAOC,cAAP,MAA2B,oBAA3B;AACA,SAASC,UAAT,QAA2B,sBAA3B;AAEA,MAAMC,wBAAwB,GAAG,CAChC;AACCC,EAAAA,IAAI,EAAE,UADP;AAECC,EAAAA,IAAI,EAAE;AAFP,CADgC,CAAjC;;AAOA,SAASC,QAAT,CAAmBC,MAAnB,EAA4B;AAC3B,SAAOA,MAAP;AACA;;AAED,eAAe,SAASC,mBAAT,CAA8B;AAAEC,EAAAA;AAAF,C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YAHd;AAIC,MAAA,kBAAkB,EAAGhD,kBAJtB;AAKC,MAAA,qBAAqB,EAAGD;AALzB,MADD;AASA,GAVC,CAvCH,CADD;AAqDA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Button, Flex, FlexItem } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useDispatch } from '@wordpress/data';\nimport { useCallback, useRef } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { __experimentalUseDialog as useDialog } from '@wordpress/compose';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport EntityTypeList from './entity-type-list';\nimport { useIsDirty } from './hooks/use-is-dirty';\n\nconst PUBLISH_ON_SAVE_ENTITIES = [\n\t{\n\t\tkind: 'postType',\n\t\tname: 'wp_navigation',\n\t},\n];\n\nfunction identity( values ) {\n\treturn values;\n}\n\nexport default function EntitiesSavedStates( { close } ) {\n\tconst isDirtyProps = useIsDirty();\n\treturn (\n\t\t<EntitiesSavedStatesExtensible close={ close } { ...isDirtyProps } />\n\t);\n}\n\nexport function EntitiesSavedStatesExtensible( {\n\tadditionalPrompt = undefined,\n\tclose,\n\tonSave = identity,\n\tsaveEnabled: saveEnabledProp = undefined,\n\tsaveLabel = __( 'Save' ),\n\n\tdirtyEntityRecords,\n\tisDirty,\n\tsetUnselectedEntities,\n\tunselectedEntities,\n} ) {\n\tconst saveButtonRef = useRef();\n\tconst {\n\t\teditEntityRecord,\n\t\tsaveEditedEntityRecord,\n\t\t__experimentalSaveSpecifiedEntityEdits: saveSpecifiedEntityEdits,\n\t} = useDispatch( coreStore );\n\n\tconst { __unstableMarkLastChangeAsPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\n\tconst { createSuccessNotice, createErrorNotice, removeNotice } =\n\t\tuseDispatch( noticesStore );\n\n\t// To group entities by type.\n\tconst partitionedSavables = dirtyEntityRecords.reduce( ( acc, record ) => {\n\t\tconst { name } = record;\n\t\tif ( ! acc[ name ] ) {\n\t\t\tacc[ name ] = [];\n\t\t}\n\t\tacc[ name ].push( record );\n\t\treturn acc;\n\t}, {} );\n\n\t// Sort entity groups.\n\tconst {\n\t\tsite: siteSavables,\n\t\twp_template: templateSavables,\n\t\twp_template_part: templatePartSavables,\n\t\t...contentSavables\n\t} = partitionedSavables;\n\tconst sortedPartitionedSavables = [\n\t\tsiteSavables,\n\t\ttemplateSavables,\n\t\ttemplatePartSavables,\n\t\t...Object.values( contentSavables ),\n\t].filter( Array.isArray );\n\n\tconst saveEnabled = saveEnabledProp ?? isDirty;\n\n\tconst saveCheckedEntities = () => {\n\t\tconst saveNoticeId = 'site-editor-save-success';\n\t\tremoveNotice( saveNoticeId );\n\t\tconst entitiesToSave = dirtyEntityRecords.filter(\n\t\t\t( { kind, name, key, property } ) => {\n\t\t\t\treturn ! unselectedEntities.some(\n\t\t\t\t\t( elt ) =>\n\t\t\t\t\t\telt.kind === kind &&\n\t\t\t\t\t\telt.name === name &&\n\t\t\t\t\t\telt.key === key &&\n\t\t\t\t\t\telt.property === property\n\t\t\t\t);\n\t\t\t}\n\t\t);\n\n\t\tclose( entitiesToSave );\n\n\t\tconst siteItemsToSave = [];\n\t\tconst pendingSavedRecords = [];\n\t\tentitiesToSave.forEach( ( { kind, name, key, property } ) => {\n\t\t\tif ( 'root' === kind && 'site' === name ) {\n\t\t\t\tsiteItemsToSave.push( property );\n\t\t\t} else {\n\t\t\t\tif (\n\t\t\t\t\tPUBLISH_ON_SAVE_ENTITIES.some(\n\t\t\t\t\t\t( typeToPublish ) =>\n\t\t\t\t\t\t\ttypeToPublish.kind === kind &&\n\t\t\t\t\t\t\ttypeToPublish.name === name\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\teditEntityRecord( kind, name, key, { status: 'publish' } );\n\t\t\t\t}\n\n\t\t\t\tpendingSavedRecords.push(\n\t\t\t\t\tsaveEditedEntityRecord( kind, name, key )\n\t\t\t\t);\n\t\t\t}\n\t\t} );\n\t\tif ( siteItemsToSave.length ) {\n\t\t\tpendingSavedRecords.push(\n\t\t\t\tsaveSpecifiedEntityEdits(\n\t\t\t\t\t'root',\n\t\t\t\t\t'site',\n\t\t\t\t\tundefined,\n\t\t\t\t\tsiteItemsToSave\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\n\t\t__unstableMarkLastChangeAsPersistent();\n\n\t\tPromise.all( pendingSavedRecords )\n\t\t\t.then( ( values ) => {\n\t\t\t\treturn onSave( values );\n\t\t\t} )\n\t\t\t.then( ( values ) => {\n\t\t\t\tif (\n\t\t\t\t\tvalues.some( ( value ) => typeof value === 'undefined' )\n\t\t\t\t) {\n\t\t\t\t\tcreateErrorNotice( __( 'Saving failed.' ) );\n\t\t\t\t} else {\n\t\t\t\t\tcreateSuccessNotice( __( 'Site updated.' ), {\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\tid: saveNoticeId,\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t} )\n\t\t\t.catch( ( error ) =>\n\t\t\t\tcreateErrorNotice( `${ __( 'Saving failed.' ) } ${ error }` )\n\t\t\t);\n\t};\n\n\t// Explicitly define this with no argument passed. Using `close` on\n\t// its own will use the event object in place of the expected saved entities.\n\tconst dismissPanel = useCallback( () => close(), [ close ] );\n\n\tconst [ saveDialogRef, saveDialogProps ] = useDialog( {\n\t\tonClose: () => dismissPanel(),\n\t} );\n\n\treturn (\n\t\t<div\n\t\t\tref={ saveDialogRef }\n\t\t\t{ ...saveDialogProps }\n\t\t\tclassName=\"entities-saved-states__panel\"\n\t\t>\n\t\t\t<Flex className=\"entities-saved-states__panel-header\" gap={ 2 }>\n\t\t\t\t<FlexItem\n\t\t\t\t\tisBlock\n\t\t\t\t\tas={ Button }\n\t\t\t\t\tref={ saveButtonRef }\n\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\tdisabled={ ! saveEnabled }\n\t\t\t\t\tonClick={ saveCheckedEntities }\n\t\t\t\t\tclassName=\"editor-entities-saved-states__save-button\"\n\t\t\t\t>\n\t\t\t\t\t{ saveLabel }\n\t\t\t\t</FlexItem>\n\t\t\t\t<FlexItem\n\t\t\t\t\tisBlock\n\t\t\t\t\tas={ Button }\n\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\tonClick={ dismissPanel }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t</FlexItem>\n\t\t\t</Flex>\n\n\t\t\t<div className=\"entities-saved-states__text-prompt\">\n\t\t\t\t<strong>{ __( 'Are you ready to save?' ) }</strong>\n\t\t\t\t{ additionalPrompt }\n\t\t\t\t{ isDirty && (\n\t\t\t\t\t<p>\n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'The following changes have been made to your site, templates, and content.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t</p>\n\t\t\t\t) }\n\t\t\t</div>\n\n\t\t\t{ sortedPartitionedSavables.map( ( list ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<EntityTypeList\n\t\t\t\t\t\tkey={ list[ 0 ].name }\n\t\t\t\t\t\tlist={ list }\n\t\t\t\t\t\tclosePanel={ dismissPanel }\n\t\t\t\t\t\tunselectedEntities={ unselectedEntities }\n\t\t\t\t\t\tsetUnselectedEntities={ setUnselectedEntities }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</div>\n\t);\n}\n"]}
|
|
@@ -28,11 +28,10 @@ function getContent() {
|
|
|
28
28
|
} catch (error) {}
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
function CopyButton(
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
} = _ref;
|
|
31
|
+
function CopyButton({
|
|
32
|
+
text,
|
|
33
|
+
children
|
|
34
|
+
}) {
|
|
36
35
|
const ref = useCopyToClipboard(text);
|
|
37
36
|
return createElement(Button, {
|
|
38
37
|
variant: "secondary",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/components/error-boundary/index.js"],"names":["Component","__","Button","select","Warning","useCopyToClipboard","doAction","store","editorStore","getContent","getEditedPostContent","error","CopyButton","text","children","ref","ErrorBoundary","constructor","arguments","state","componentDidCatch","getDerivedStateFromError","render","props","actions","stack"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,oBAA1B;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,MAAT,QAAuB,uBAAvB;AACA,SAASC,MAAT,QAAuB,iBAAvB;AACA,SAASC,OAAT,QAAwB,yBAAxB;AACA,SAASC,kBAAT,QAAmC,oBAAnC;AACA,SAASC,QAAT,QAAyB,kBAAzB;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,aAArC;;AAEA,SAASC,UAAT,GAAsB;AACrB,MAAI;AACH;AACA;AACA;AACA;AACA;AACA;AACA,WAAON,MAAM,CAAEK,WAAF,CAAN,CAAsBE,oBAAtB,EAAP;AACA,GARD,CAQE,OAAQC,KAAR,EAAgB,CAAE;AACpB;;AAED,SAASC,UAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/components/error-boundary/index.js"],"names":["Component","__","Button","select","Warning","useCopyToClipboard","doAction","store","editorStore","getContent","getEditedPostContent","error","CopyButton","text","children","ref","ErrorBoundary","constructor","arguments","state","componentDidCatch","getDerivedStateFromError","render","props","actions","stack"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,oBAA1B;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,MAAT,QAAuB,uBAAvB;AACA,SAASC,MAAT,QAAuB,iBAAvB;AACA,SAASC,OAAT,QAAwB,yBAAxB;AACA,SAASC,kBAAT,QAAmC,oBAAnC;AACA,SAASC,QAAT,QAAyB,kBAAzB;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,aAArC;;AAEA,SAASC,UAAT,GAAsB;AACrB,MAAI;AACH;AACA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O,EAAGuB;AAArD,OACGvB,EAAE,CAAE,iDAAF,CADL,CADD;AAKA;;AArCoC;;AAwCtC,eAAee,aAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { select } from '@wordpress/data';\nimport { Warning } from '@wordpress/block-editor';\nimport { useCopyToClipboard } from '@wordpress/compose';\nimport { doAction } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nfunction getContent() {\n\ttry {\n\t\t// While `select` in a component is generally discouraged, it is\n\t\t// used here because it (a) reduces the chance of data loss in the\n\t\t// case of additional errors by performing a direct retrieval and\n\t\t// (b) avoids the performance cost associated with unnecessary\n\t\t// content serialization throughout the lifetime of a non-erroring\n\t\t// application.\n\t\treturn select( editorStore ).getEditedPostContent();\n\t} catch ( error ) {}\n}\n\nfunction CopyButton( { text, children } ) {\n\tconst ref = useCopyToClipboard( text );\n\treturn (\n\t\t<Button variant=\"secondary\" ref={ ref }>\n\t\t\t{ children }\n\t\t</Button>\n\t);\n}\n\nclass ErrorBoundary extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\n\t\tthis.state = {\n\t\t\terror: null,\n\t\t};\n\t}\n\n\tcomponentDidCatch( error ) {\n\t\tdoAction( 'editor.ErrorBoundary.errorLogged', error );\n\t}\n\n\tstatic getDerivedStateFromError( error ) {\n\t\treturn { error };\n\t}\n\n\trender() {\n\t\tconst { error } = this.state;\n\t\tif ( ! error ) {\n\t\t\treturn this.props.children;\n\t\t}\n\n\t\tconst actions = [\n\t\t\t<CopyButton key=\"copy-post\" text={ getContent }>\n\t\t\t\t{ __( 'Copy Post Text' ) }\n\t\t\t</CopyButton>,\n\t\t\t<CopyButton key=\"copy-error\" text={ error.stack }>\n\t\t\t\t{ __( 'Copy Error' ) }\n\t\t\t</CopyButton>,\n\t\t];\n\n\t\treturn (\n\t\t\t<Warning className=\"editor-error-boundary\" actions={ actions }>\n\t\t\t\t{ __( 'The editor has encountered an unexpected error.' ) }\n\t\t\t</Warning>\n\t\t);\n\t}\n}\n\nexport default ErrorBoundary;\n"]}
|
|
@@ -10,10 +10,9 @@ import { parse } from '@wordpress/blocks';
|
|
|
10
10
|
|
|
11
11
|
import { store as editorStore } from '../../store';
|
|
12
12
|
|
|
13
|
-
function SaveShortcut(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
} = _ref;
|
|
13
|
+
function SaveShortcut({
|
|
14
|
+
resetBlocksOnSave
|
|
15
|
+
}) {
|
|
17
16
|
const {
|
|
18
17
|
resetEditorBlocks,
|
|
19
18
|
savePost
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/components/global-keyboard-shortcuts/save-shortcut.js"],"names":["useShortcut","useDispatch","useSelect","parse","store","editorStore","SaveShortcut","resetBlocksOnSave","resetEditorBlocks","savePost","isEditedPostDirty","getPostEdits","isPostSavingLocked","event","preventDefault","postEdits","content","blocks"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAT,QAA4B,+BAA5B;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,KAAT,QAAsB,mBAAtB;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,aAArC;;AAEA,SAASC,YAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/components/global-keyboard-shortcuts/save-shortcut.js"],"names":["useShortcut","useDispatch","useSelect","parse","store","editorStore","SaveShortcut","resetBlocksOnSave","resetEditorBlocks","savePost","isEditedPostDirty","getPostEdits","isPostSavingLocked","event","preventDefault","postEdits","content","blocks"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAT,QAA4B,+BAA5B;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,KAAT,QAAsB,mBAAtB;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,aAArC;;AAEA,SAASC,YAAT,CAAuB;AAAEC,EAAAA;AAAF,CAAvB,EAA+C;AAC9C,QAAM;AAAEC,IAAAA,iBAAF;AAAqBC,IAAAA;AAArB,MAAkCR,WAAW,CAAEI,WAAF,CAAnD;AACA,QAAM;AAAEK,IAAAA,iBAAF;AAAqBC,IAAAA,YAArB;AAAmCC,IAAAA;AAAnC,MACLV,SAAS,CAAEG,WAAF,CADV;AAGAL,EAAAA,WAAW,CAAE,kBAAF,EAAwBa,KAAF,IAAa;AAC7CA,IAAAA,KAAK,CAACC,cAAN;AAEA;AACF;AACA;;AACE,QAAKF,kBAAkB,EAAvB,EAA4B;AAC3B;AACA,KAR4C,CAU7C;AACA;AACA;AACA;AACA;;;AACA,QAAK,CAAEF,iBAAiB,EAAxB,EAA6B;AAC5B;AACA,KAjB4C,CAmB7C;AACA;AACA;AACA;;;AACA,QAAKH,iBAAL,EAAyB;AACxB,YAAMQ,SAAS,GAAGJ,YAAY,EAA9B;;AACA,UAAKI,SAAS,CAACC,OAAV,IAAqB,OAAOD,SAAS,CAACC,OAAjB,KAA6B,QAAvD,EAAkE;AACjE,cAAMC,MAAM,GAAGd,KAAK,CAAEY,SAAS,CAACC,OAAZ,CAApB;AACAR,QAAAA,iBAAiB,CAAES,MAAF,CAAjB;AACA;AACD;;AAEDR,IAAAA,QAAQ;AACR,GAhCU,CAAX;AAkCA,SAAO,IAAP;AACA;;AAED,eAAeH,YAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useShortcut } from '@wordpress/keyboard-shortcuts';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { parse } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nfunction SaveShortcut( { resetBlocksOnSave } ) {\n\tconst { resetEditorBlocks, savePost } = useDispatch( editorStore );\n\tconst { isEditedPostDirty, getPostEdits, isPostSavingLocked } =\n\t\tuseSelect( editorStore );\n\n\tuseShortcut( 'core/editor/save', ( event ) => {\n\t\tevent.preventDefault();\n\n\t\t/**\n\t\t * Do not save the post if post saving is locked.\n\t\t */\n\t\tif ( isPostSavingLocked() ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// TODO: This should be handled in the `savePost` effect in\n\t\t// considering `isSaveable`. See note on `isEditedPostSaveable`\n\t\t// selector about dirtiness and meta-boxes.\n\t\t//\n\t\t// See: `isEditedPostSaveable`\n\t\tif ( ! isEditedPostDirty() ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// The text editor requires that editor blocks are updated for a\n\t\t// save to work correctly. Usually this happens when the textarea\n\t\t// for the code editors blurs, but the shortcut can be used without\n\t\t// blurring the textarea.\n\t\tif ( resetBlocksOnSave ) {\n\t\t\tconst postEdits = getPostEdits();\n\t\t\tif ( postEdits.content && typeof postEdits.content === 'string' ) {\n\t\t\t\tconst blocks = parse( postEdits.content );\n\t\t\t\tresetEditorBlocks( blocks );\n\t\t\t}\n\t\t}\n\n\t\tsavePost();\n\t} );\n\n\treturn null;\n}\n\nexport default SaveShortcut;\n"]}
|
|
@@ -12,6 +12,7 @@ export { default as EditorHistoryUndo } from './editor-history/undo';
|
|
|
12
12
|
export { default as EditorNotices } from './editor-notices';
|
|
13
13
|
export { default as EditorSnackbars } from './editor-snackbars';
|
|
14
14
|
export { default as EntitiesSavedStates } from './entities-saved-states';
|
|
15
|
+
export { useIsDirty as useEntitiesSavedStatesIsDirty } from './entities-saved-states/hooks/use-is-dirty';
|
|
15
16
|
export { default as ErrorBoundary } from './error-boundary';
|
|
16
17
|
export { default as LocalAutosaveMonitor } from './local-autosave-monitor';
|
|
17
18
|
export { default as PageAttributesCheck } from './page-attributes/check';
|
|
@@ -46,6 +47,7 @@ export { default as PostSlugCheck } from './post-slug/check';
|
|
|
46
47
|
export { default as PostSticky } from './post-sticky';
|
|
47
48
|
export { default as PostStickyCheck } from './post-sticky/check';
|
|
48
49
|
export { default as PostSwitchToDraftButton } from './post-switch-to-draft-button';
|
|
50
|
+
export { default as PostSyncStatus } from './post-sync-status';
|
|
49
51
|
export { default as PostTaxonomies } from './post-taxonomies';
|
|
50
52
|
export { FlatTermSelector as PostTaxonomiesFlatTermSelector } from './post-taxonomies/flat-term-selector';
|
|
51
53
|
export { HierarchicalTermSelector as PostTaxonomiesHierarchicalTermSelector } from './post-taxonomies/hierarchical-term-selector';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/components/index.js"],"names":["default","AutosaveMonitor","DocumentOutline","DocumentOutlineCheck","VisualEditorGlobalKeyboardShortcuts","TextEditorGlobalKeyboardShortcuts","EditorKeyboardShortcutsRegister","EditorHistoryRedo","EditorHistoryUndo","EditorNotices","EditorSnackbars","EntitiesSavedStates","ErrorBoundary","LocalAutosaveMonitor","PageAttributesCheck","PageAttributesOrder","PageAttributesParent","PageTemplate","PostAuthor","PostAuthorCheck","PostComments","PostExcerpt","PostExcerptCheck","PostFeaturedImage","PostFeaturedImageCheck","PostFormat","PostFormatCheck","PostLastRevision","PostLastRevisionCheck","PostLockedModal","PostPendingStatus","PostPendingStatusCheck","PostPingbacks","PostPreviewButton","PostPublishButton","PostPublishButtonLabel","PostPublishPanel","PostSavedState","PostSchedule","PostScheduleCheck","PostScheduleLabel","usePostScheduleLabel","PostSlug","PostSlugCheck","PostSticky","PostStickyCheck","PostSwitchToDraftButton","PostTaxonomies","FlatTermSelector","PostTaxonomiesFlatTermSelector","HierarchicalTermSelector","PostTaxonomiesHierarchicalTermSelector","PostTaxonomiesCheck","PostTextEditor","PostTitle","PostTrash","PostTrashCheck","PostTypeSupportCheck","PostURL","PostURLCheck","PostURLLabel","usePostURLLabel","PostVisibility","PostVisibilityLabel","usePostVisibilityLabel","PostVisibilityCheck","TableOfContents","ThemeSupportCheck","UnsavedChangesWarning","WordCount","TimeToRead","CharacterCount","EditorProvider"],"mappings":"AAAA;AACA,cAAc,kBAAd,C,CAEA;;AACA,SAASA,OAAO,IAAIC,eAApB,QAA2C,oBAA3C;AACA,SAASD,OAAO,IAAIE,eAApB,QAA2C,oBAA3C;AACA,SAASF,OAAO,IAAIG,oBAApB,QAAgD,0BAAhD;AACA,SAASH,OAAO,IAAII,mCAApB,QAA+D,qDAA/D;AACA,SAASJ,OAAO,IAAIK,iCAApB,QAA6D,mDAA7D;AACA,SAASL,OAAO,IAAIM,+BAApB,QAA2D,gDAA3D;AACA,SAASN,OAAO,IAAIO,iBAApB,QAA6C,uBAA7C;AACA,SAASP,OAAO,IAAIQ,iBAApB,QAA6C,uBAA7C;AACA,SAASR,OAAO,IAAIS,aAApB,QAAyC,kBAAzC;AACA,SAAST,OAAO,IAAIU,eAApB,QAA2C,oBAA3C;AACA,SAASV,OAAO,IAAIW,mBAApB,QAA+C,yBAA/C;AACA,
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/components/index.js"],"names":["default","AutosaveMonitor","DocumentOutline","DocumentOutlineCheck","VisualEditorGlobalKeyboardShortcuts","TextEditorGlobalKeyboardShortcuts","EditorKeyboardShortcutsRegister","EditorHistoryRedo","EditorHistoryUndo","EditorNotices","EditorSnackbars","EntitiesSavedStates","useIsDirty","useEntitiesSavedStatesIsDirty","ErrorBoundary","LocalAutosaveMonitor","PageAttributesCheck","PageAttributesOrder","PageAttributesParent","PageTemplate","PostAuthor","PostAuthorCheck","PostComments","PostExcerpt","PostExcerptCheck","PostFeaturedImage","PostFeaturedImageCheck","PostFormat","PostFormatCheck","PostLastRevision","PostLastRevisionCheck","PostLockedModal","PostPendingStatus","PostPendingStatusCheck","PostPingbacks","PostPreviewButton","PostPublishButton","PostPublishButtonLabel","PostPublishPanel","PostSavedState","PostSchedule","PostScheduleCheck","PostScheduleLabel","usePostScheduleLabel","PostSlug","PostSlugCheck","PostSticky","PostStickyCheck","PostSwitchToDraftButton","PostSyncStatus","PostTaxonomies","FlatTermSelector","PostTaxonomiesFlatTermSelector","HierarchicalTermSelector","PostTaxonomiesHierarchicalTermSelector","PostTaxonomiesCheck","PostTextEditor","PostTitle","PostTrash","PostTrashCheck","PostTypeSupportCheck","PostURL","PostURLCheck","PostURLLabel","usePostURLLabel","PostVisibility","PostVisibilityLabel","usePostVisibilityLabel","PostVisibilityCheck","TableOfContents","ThemeSupportCheck","UnsavedChangesWarning","WordCount","TimeToRead","CharacterCount","EditorProvider"],"mappings":"AAAA;AACA,cAAc,kBAAd,C,CAEA;;AACA,SAASA,OAAO,IAAIC,eAApB,QAA2C,oBAA3C;AACA,SAASD,OAAO,IAAIE,eAApB,QAA2C,oBAA3C;AACA,SAASF,OAAO,IAAIG,oBAApB,QAAgD,0BAAhD;AACA,SAASH,OAAO,IAAII,mCAApB,QAA+D,qDAA/D;AACA,SAASJ,OAAO,IAAIK,iCAApB,QAA6D,mDAA7D;AACA,SAASL,OAAO,IAAIM,+BAApB,QAA2D,gDAA3D;AACA,SAASN,OAAO,IAAIO,iBAApB,QAA6C,uBAA7C;AACA,SAASP,OAAO,IAAIQ,iBAApB,QAA6C,uBAA7C;AACA,SAASR,OAAO,IAAIS,aAApB,QAAyC,kBAAzC;AACA,SAAST,OAAO,IAAIU,eAApB,QAA2C,oBAA3C;AACA,SAASV,OAAO,IAAIW,mBAApB,QAA+C,yBAA/C;AACA,SAASC,UAAU,IAAIC,6BAAvB,QAA4D,4CAA5D;AACA,SAASb,OAAO,IAAIc,aAApB,QAAyC,kBAAzC;AACA,SAASd,OAAO,IAAIe,oBAApB,QAAgD,0BAAhD;AACA,SAASf,OAAO,IAAIgB,mBAApB,QAA+C,yBAA/C;AACA,SAAShB,OAAO,IAAIiB,mBAApB,QAA+C,yBAA/C;AACA,SAASjB,OAAO,IAAIkB,oBAApB,QAAgD,0BAAhD;AACA,SAASlB,OAAO,IAAImB,YAApB,QAAwC,iBAAxC;AACA,SAASnB,OAAO,IAAIoB,UAApB,QAAsC,eAAtC;AACA,SAASpB,OAAO,IAAIqB,eAApB,QAA2C,qBAA3C;AACA,SAASrB,OAAO,IAAIsB,YAApB,QAAwC,iBAAxC;AACA,SAAStB,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SAAShD,OAAO,IAAIiD,cAApB,QAA0C,oBAA1C;AACA,SAASjD,OAAO,IAAIkD,cAApB,QAA0C,mBAA1C;AACA,SAASC,gBAAgB,IAAIC,8BAA7B,QAAmE,sCAAnE;AACA,SAASC,wBAAwB,IAAIC,sCAArC,QAAmF,8CAAnF;AACA,SAAStD,OAAO,IAAIuD,mBAApB,QAA+C,yBAA/C;AACA,SAASvD,OAAO,IAAIwD,cAApB,QAA0C,oBAA1C;AACA,SAASxD,OAAO,IAAIyD,SAApB,QAAqC,cAArC;AACA,SAASzD,OAAO,IAAI0D,SAApB,QAAqC,cAArC;AACA,SAAS1D,OAAO,IAAI2D,cAApB,QAA0C,oBAA1C;AACA,SAAS3D,OAAO,IAAI4D,oBAApB,QAAgD,2BAAhD;AACA,SAAS5D,OAAO,IAAI6D,OAApB,QAAmC,YAAnC;AACA,SAAS7D,OAAO,IAAI8D,YAApB,QAAwC,kBAAxC;AACA,SAAS9D,OAAO,IAAI+D,YAApB,EAAkCC,eAAlC,QAAyD,kBAAzD;AACA,SAAShE,OAAO,IAAIiE,cAApB,QAA0C,mBAA1C;AACA,SACCjE,OAAO,IAAIkE,mBADZ,EAECC,sBAFD,QAGO,yBAHP;AAIA,SAASnE,OAAO,IAAIoE,mBAApB,QAA+C,yBAA/C;AACA,SAASpE,OAAO,IAAIqE,eAApB,QAA2C,qBAA3C;AACA,SAASrE,OAAO,IAAIsE,iBAApB,QAA6C,uBAA7C;AACA,SAAStE,OAAO,IAAIuE,qBAApB,QAAiD,2BAAjD;AACA,SAASvE,OAAO,IAAIwE,SAApB,QAAqC,cAArC;AACA,SAASxE,OAAO,IAAIyE,UAApB,QAAsC,gBAAtC;AACA,SAASzE,OAAO,IAAI0E,cAApB,QAA0C,mBAA1C,C,CAEA;;AACA,SAAS1E,OAAO,IAAI2E,cAApB,QAA0C,YAA1C;AAEA,cAAc,cAAd","sourcesContent":["// Block Creation Components.\nexport * from './autocompleters';\n\n// Post Related Components.\nexport { default as AutosaveMonitor } from './autosave-monitor';\nexport { default as DocumentOutline } from './document-outline';\nexport { default as DocumentOutlineCheck } from './document-outline/check';\nexport { default as VisualEditorGlobalKeyboardShortcuts } from './global-keyboard-shortcuts/visual-editor-shortcuts';\nexport { default as TextEditorGlobalKeyboardShortcuts } from './global-keyboard-shortcuts/text-editor-shortcuts';\nexport { default as EditorKeyboardShortcutsRegister } from './global-keyboard-shortcuts/register-shortcuts';\nexport { default as EditorHistoryRedo } from './editor-history/redo';\nexport { default as EditorHistoryUndo } from './editor-history/undo';\nexport { default as EditorNotices } from './editor-notices';\nexport { default as EditorSnackbars } from './editor-snackbars';\nexport { default as EntitiesSavedStates } from './entities-saved-states';\nexport { useIsDirty as useEntitiesSavedStatesIsDirty } from './entities-saved-states/hooks/use-is-dirty';\nexport { default as ErrorBoundary } from './error-boundary';\nexport { default as LocalAutosaveMonitor } from './local-autosave-monitor';\nexport { default as PageAttributesCheck } from './page-attributes/check';\nexport { default as PageAttributesOrder } from './page-attributes/order';\nexport { default as PageAttributesParent } from './page-attributes/parent';\nexport { default as PageTemplate } from './post-template';\nexport { default as PostAuthor } from './post-author';\nexport { default as PostAuthorCheck } from './post-author/check';\nexport { default as PostComments } from './post-comments';\nexport { default as PostExcerpt } from './post-excerpt';\nexport { default as PostExcerptCheck } from './post-excerpt/check';\nexport { default as PostFeaturedImage } from './post-featured-image';\nexport { default as PostFeaturedImageCheck } from './post-featured-image/check';\nexport { default as PostFormat } from './post-format';\nexport { default as PostFormatCheck } from './post-format/check';\nexport { default as PostLastRevision } from './post-last-revision';\nexport { default as PostLastRevisionCheck } from './post-last-revision/check';\nexport { default as PostLockedModal } from './post-locked-modal';\nexport { default as PostPendingStatus } from './post-pending-status';\nexport { default as PostPendingStatusCheck } from './post-pending-status/check';\nexport { default as PostPingbacks } from './post-pingbacks';\nexport { default as PostPreviewButton } from './post-preview-button';\nexport { default as PostPublishButton } from './post-publish-button';\nexport { default as PostPublishButtonLabel } from './post-publish-button/label';\nexport { default as PostPublishPanel } from './post-publish-panel';\nexport { default as PostSavedState } from './post-saved-state';\nexport { default as PostSchedule } from './post-schedule';\nexport { default as PostScheduleCheck } from './post-schedule/check';\nexport {\n\tdefault as PostScheduleLabel,\n\tusePostScheduleLabel,\n} from './post-schedule/label';\nexport { default as PostSlug } from './post-slug';\nexport { default as PostSlugCheck } from './post-slug/check';\nexport { default as PostSticky } from './post-sticky';\nexport { default as PostStickyCheck } from './post-sticky/check';\nexport { default as PostSwitchToDraftButton } from './post-switch-to-draft-button';\nexport { default as PostSyncStatus } from './post-sync-status';\nexport { default as PostTaxonomies } from './post-taxonomies';\nexport { FlatTermSelector as PostTaxonomiesFlatTermSelector } from './post-taxonomies/flat-term-selector';\nexport { HierarchicalTermSelector as PostTaxonomiesHierarchicalTermSelector } from './post-taxonomies/hierarchical-term-selector';\nexport { default as PostTaxonomiesCheck } from './post-taxonomies/check';\nexport { default as PostTextEditor } from './post-text-editor';\nexport { default as PostTitle } from './post-title';\nexport { default as PostTrash } from './post-trash';\nexport { default as PostTrashCheck } from './post-trash/check';\nexport { default as PostTypeSupportCheck } from './post-type-support-check';\nexport { default as PostURL } from './post-url';\nexport { default as PostURLCheck } from './post-url/check';\nexport { default as PostURLLabel, usePostURLLabel } from './post-url/label';\nexport { default as PostVisibility } from './post-visibility';\nexport {\n\tdefault as PostVisibilityLabel,\n\tusePostVisibilityLabel,\n} from './post-visibility/label';\nexport { default as PostVisibilityCheck } from './post-visibility/check';\nexport { default as TableOfContents } from './table-of-contents';\nexport { default as ThemeSupportCheck } from './theme-support-check';\nexport { default as UnsavedChangesWarning } from './unsaved-changes-warning';\nexport { default as WordCount } from './word-count';\nexport { default as TimeToRead } from './time-to-read';\nexport { default as CharacterCount } from './character-count';\n\n// State Related Components.\nexport { default as EditorProvider } from './provider';\n\nexport * from './deprecated';\n"]}
|