@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
|
@@ -17,7 +17,7 @@ import { SAVE_POST_NOTICE_ID, TRASH_POST_NOTICE_ID } from '../constants';
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
export function getNotificationArgumentsForSaveSuccess(data) {
|
|
20
|
-
var
|
|
20
|
+
var _postType$viewable;
|
|
21
21
|
|
|
22
22
|
const {
|
|
23
23
|
previousPost,
|
|
@@ -25,7 +25,7 @@ export function getNotificationArgumentsForSaveSuccess(data) {
|
|
|
25
25
|
postType
|
|
26
26
|
} = data; // Autosaves are neither shown a notice nor redirected.
|
|
27
27
|
|
|
28
|
-
if (
|
|
28
|
+
if (data.options?.isAutosave) {
|
|
29
29
|
return [];
|
|
30
30
|
} // No notice is shown after trashing a post
|
|
31
31
|
|
|
@@ -38,7 +38,7 @@ export function getNotificationArgumentsForSaveSuccess(data) {
|
|
|
38
38
|
const isPublished = publishStatus.includes(previousPost.status);
|
|
39
39
|
const willPublish = publishStatus.includes(post.status);
|
|
40
40
|
let noticeMessage;
|
|
41
|
-
let shouldShowLink = (_postType$viewable = postType
|
|
41
|
+
let shouldShowLink = (_postType$viewable = postType?.viewable) !== null && _postType$viewable !== void 0 ? _postType$viewable : false;
|
|
42
42
|
let isDraft; // Always should a notice, which will be spoken for accessibility.
|
|
43
43
|
|
|
44
44
|
if (!isPublished && !willPublish) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/store/utils/notice-builder.js"],"names":["__","SAVE_POST_NOTICE_ID","TRASH_POST_NOTICE_ID","getNotificationArgumentsForSaveSuccess","data","previousPost","post","postType","options","isAutosave","status","publishStatus","isPublished","includes","willPublish","noticeMessage","shouldShowLink","viewable","isDraft","labels","item_reverted_to_draft","publish","item_published","private","item_published_privately","future","item_scheduled","item_updated","actions","push","label","view_item","url","link","id","type","getNotificationArgumentsForSaveFail","edits","error","code","indexOf","messages","message","test","join","getNotificationArgumentsForTrashFail"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AAEA;AACA;AACA;;AACA,SAASC,mBAAT,EAA8BC,oBAA9B,QAA0D,cAA1D;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,sCAAT,CAAiDC,IAAjD,EAAwD;AAAA;;AAC9D,QAAM;AAAEC,IAAAA,YAAF;AAAgBC,IAAAA,IAAhB;AAAsBC,IAAAA;AAAtB,MAAmCH,IAAzC,CAD8D,CAE9D;;AACA,
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/store/utils/notice-builder.js"],"names":["__","SAVE_POST_NOTICE_ID","TRASH_POST_NOTICE_ID","getNotificationArgumentsForSaveSuccess","data","previousPost","post","postType","options","isAutosave","status","publishStatus","isPublished","includes","willPublish","noticeMessage","shouldShowLink","viewable","isDraft","labels","item_reverted_to_draft","publish","item_published","private","item_published_privately","future","item_scheduled","item_updated","actions","push","label","view_item","url","link","id","type","getNotificationArgumentsForSaveFail","edits","error","code","indexOf","messages","message","test","join","getNotificationArgumentsForTrashFail"],"mappings":"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","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { SAVE_POST_NOTICE_ID, TRASH_POST_NOTICE_ID } from '../constants';\n\n/**\n * Builds the arguments for a success notification dispatch.\n *\n * @param {Object} data Incoming data to build the arguments from.\n *\n * @return {Array} Arguments for dispatch. An empty array signals no\n * notification should be sent.\n */\nexport function getNotificationArgumentsForSaveSuccess( data ) {\n\tconst { previousPost, post, postType } = data;\n\t// Autosaves are neither shown a notice nor redirected.\n\tif ( data.options?.isAutosave ) {\n\t\treturn [];\n\t}\n\n\t// No notice is shown after trashing a post\n\tif ( post.status === 'trash' && previousPost.status !== 'trash' ) {\n\t\treturn [];\n\t}\n\n\tconst publishStatus = [ 'publish', 'private', 'future' ];\n\tconst isPublished = publishStatus.includes( previousPost.status );\n\tconst willPublish = publishStatus.includes( post.status );\n\n\tlet noticeMessage;\n\tlet shouldShowLink = postType?.viewable ?? false;\n\tlet isDraft;\n\n\t// Always should a notice, which will be spoken for accessibility.\n\tif ( ! isPublished && ! willPublish ) {\n\t\t// If saving a non-published post, don't show notice.\n\t\tnoticeMessage = __( 'Draft saved.' );\n\t\tisDraft = true;\n\t} else if ( isPublished && ! willPublish ) {\n\t\t// If undoing publish status, show specific notice.\n\t\tnoticeMessage = postType.labels.item_reverted_to_draft;\n\t\tshouldShowLink = false;\n\t} else if ( ! isPublished && willPublish ) {\n\t\t// If publishing or scheduling a post, show the corresponding\n\t\t// publish message.\n\t\tnoticeMessage = {\n\t\t\tpublish: postType.labels.item_published,\n\t\t\tprivate: postType.labels.item_published_privately,\n\t\t\tfuture: postType.labels.item_scheduled,\n\t\t}[ post.status ];\n\t} else {\n\t\t// Generic fallback notice.\n\t\tnoticeMessage = postType.labels.item_updated;\n\t}\n\n\tconst actions = [];\n\tif ( shouldShowLink ) {\n\t\tactions.push( {\n\t\t\tlabel: isDraft ? __( 'View Preview' ) : postType.labels.view_item,\n\t\t\turl: post.link,\n\t\t} );\n\t}\n\treturn [\n\t\tnoticeMessage,\n\t\t{\n\t\t\tid: SAVE_POST_NOTICE_ID,\n\t\t\ttype: 'snackbar',\n\t\t\tactions,\n\t\t},\n\t];\n}\n\n/**\n * Builds the fail notification arguments for dispatch.\n *\n * @param {Object} data Incoming data to build the arguments with.\n *\n * @return {Array} Arguments for dispatch. An empty array signals no\n * notification should be sent.\n */\nexport function getNotificationArgumentsForSaveFail( data ) {\n\tconst { post, edits, error } = data;\n\tif ( error && 'rest_autosave_no_changes' === error.code ) {\n\t\t// Autosave requested a new autosave, but there were no changes. This shouldn't\n\t\t// result in an error notice for the user.\n\t\treturn [];\n\t}\n\n\tconst publishStatus = [ 'publish', 'private', 'future' ];\n\tconst isPublished = publishStatus.indexOf( post.status ) !== -1;\n\t// If the post was being published, we show the corresponding publish error message\n\t// Unless we publish an \"updating failed\" message.\n\tconst messages = {\n\t\tpublish: __( 'Publishing failed.' ),\n\t\tprivate: __( 'Publishing failed.' ),\n\t\tfuture: __( 'Scheduling failed.' ),\n\t};\n\tlet noticeMessage =\n\t\t! isPublished && publishStatus.indexOf( edits.status ) !== -1\n\t\t\t? messages[ edits.status ]\n\t\t\t: __( 'Updating failed.' );\n\n\t// Check if message string contains HTML. Notice text is currently only\n\t// supported as plaintext, and stripping the tags may muddle the meaning.\n\tif ( error.message && ! /<\\/?[^>]*>/.test( error.message ) ) {\n\t\tnoticeMessage = [ noticeMessage, error.message ].join( ' ' );\n\t}\n\treturn [\n\t\tnoticeMessage,\n\t\t{\n\t\t\tid: SAVE_POST_NOTICE_ID,\n\t\t},\n\t];\n}\n\n/**\n * Builds the trash fail notification arguments for dispatch.\n *\n * @param {Object} data\n *\n * @return {Array} Arguments for dispatch.\n */\nexport function getNotificationArgumentsForTrashFail( data ) {\n\treturn [\n\t\tdata.error.message && data.error.code !== 'unknown_error'\n\t\t\t? data.error.message\n\t\t\t: __( 'Trashing failed' ),\n\t\t{\n\t\t\tid: TRASH_POST_NOTICE_ID,\n\t\t},\n\t];\n}\n"]}
|
|
@@ -24,15 +24,14 @@ const noop = () => {};
|
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
26
|
|
|
27
|
-
export default function mediaUpload(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
} = _ref;
|
|
27
|
+
export default function mediaUpload({
|
|
28
|
+
additionalData = {},
|
|
29
|
+
allowedTypes,
|
|
30
|
+
filesList,
|
|
31
|
+
maxUploadFileSize,
|
|
32
|
+
onError = noop,
|
|
33
|
+
onFileChange
|
|
34
|
+
}) {
|
|
36
35
|
const {
|
|
37
36
|
getCurrentPostId,
|
|
38
37
|
getEditorSettings
|
|
@@ -48,12 +47,9 @@ export default function mediaUpload(_ref) {
|
|
|
48
47
|
...additionalData
|
|
49
48
|
},
|
|
50
49
|
maxUploadFileSize,
|
|
51
|
-
onError:
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
} = _ref2;
|
|
55
|
-
return onError(message);
|
|
56
|
-
},
|
|
50
|
+
onError: ({
|
|
51
|
+
message
|
|
52
|
+
}) => onError(message),
|
|
57
53
|
wpAllowedMimeTypes
|
|
58
54
|
});
|
|
59
55
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/utils/media-upload/index.js"],"names":["select","uploadMedia","store","editorStore","noop","mediaUpload","additionalData","allowedTypes","filesList","maxUploadFileSize","onError","onFileChange","getCurrentPostId","getEditorSettings","wpAllowedMimeTypes","allowedMimeTypes","post","message"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,MAAT,QAAuB,iBAAvB;AACA,SAASC,WAAT,QAA4B,wBAA5B;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,aAArC;;AAEA,MAAMC,IAAI,GAAG,MAAM,CAAE,CAArB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,eAAe,SAASC,WAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/utils/media-upload/index.js"],"names":["select","uploadMedia","store","editorStore","noop","mediaUpload","additionalData","allowedTypes","filesList","maxUploadFileSize","onError","onFileChange","getCurrentPostId","getEditorSettings","wpAllowedMimeTypes","allowedMimeTypes","post","message"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,MAAT,QAAuB,iBAAvB;AACA,SAASC,WAAT,QAA4B,wBAA5B;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,aAArC;;AAEA,MAAMC,IAAI,GAAG,MAAM,CAAE,CAArB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,eAAe,SAASC,WAAT,CAAsB;AACpCC,EAAAA,cAAc,GAAG,EADmB;AAEpCC,EAAAA,YAFoC;AAGpCC,EAAAA,SAHoC;AAIpCC,EAAAA,iBAJoC;AAKpCC,EAAAA,OAAO,GAAGN,IAL0B;AAMpCO,EAAAA;AANoC,CAAtB,EAOX;AACH,QAAM;AAAEC,IAAAA,gBAAF;AAAoBC,IAAAA;AAApB,MAA0Cb,MAAM,CAAEG,WAAF,CAAtD;AACA,QAAMW,kBAAkB,GAAGD,iBAAiB,GAAGE,gBAA/C;AACAN,EAAAA,iBAAiB,GAChBA,iBAAiB,IAAII,iBAAiB,GAAGJ,iBAD1C;AAGAR,EAAAA,WAAW,CAAE;AACZM,IAAAA,YADY;AAEZC,IAAAA,SAFY;AAGZG,IAAAA,YAHY;AAIZL,IAAAA,cAAc,EAAE;AACfU,MAAAA,IAAI,EAAEJ,gBAAgB,EADP;AAEf,SAAGN;AAFY,KAJJ;AAQZG,IAAAA,iBARY;AASZC,IAAAA,OAAO,EAAE,CAAE;AAAEO,MAAAA;AAAF,KAAF,KAAmBP,OAAO,CAAEO,OAAF,CATvB;AAUZH,IAAAA;AAVY,GAAF,CAAX;AAYA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { select } from '@wordpress/data';\nimport { uploadMedia } from '@wordpress/media-utils';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nconst noop = () => {};\n\n/**\n * Upload a media file when the file upload button is activated.\n * Wrapper around mediaUpload() that injects the current post ID.\n *\n * @param {Object} $0 Parameters object passed to the function.\n * @param {?Object} $0.additionalData Additional data to include in the request.\n * @param {string} $0.allowedTypes Array with the types of media that can be uploaded, if unset all types are allowed.\n * @param {Array} $0.filesList List of files.\n * @param {?number} $0.maxUploadFileSize Maximum upload size in bytes allowed for the site.\n * @param {Function} $0.onError Function called when an error happens.\n * @param {Function} $0.onFileChange Function called each time a file or a temporary representation of the file is available.\n */\nexport default function mediaUpload( {\n\tadditionalData = {},\n\tallowedTypes,\n\tfilesList,\n\tmaxUploadFileSize,\n\tonError = noop,\n\tonFileChange,\n} ) {\n\tconst { getCurrentPostId, getEditorSettings } = select( editorStore );\n\tconst wpAllowedMimeTypes = getEditorSettings().allowedMimeTypes;\n\tmaxUploadFileSize =\n\t\tmaxUploadFileSize || getEditorSettings().maxUploadFileSize;\n\n\tuploadMedia( {\n\t\tallowedTypes,\n\t\tfilesList,\n\t\tonFileChange,\n\t\tadditionalData: {\n\t\t\tpost: getCurrentPostId(),\n\t\t\t...additionalData,\n\t\t},\n\t\tmaxUploadFileSize,\n\t\tonError: ( { message } ) => onError( message ),\n\t\twpAllowedMimeTypes,\n\t} );\n}\n"]}
|
|
@@ -19,12 +19,9 @@ export function buildTermsTree(flatTerms) {
|
|
|
19
19
|
};
|
|
20
20
|
}); // All terms should have a `parent` because we're about to index them by it.
|
|
21
21
|
|
|
22
|
-
if (flatTermsWithParentAndChildren.some(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
} = _ref;
|
|
26
|
-
return parent === null;
|
|
27
|
-
})) {
|
|
22
|
+
if (flatTermsWithParentAndChildren.some(({
|
|
23
|
+
parent
|
|
24
|
+
}) => parent === null)) {
|
|
28
25
|
return flatTermsWithParentAndChildren;
|
|
29
26
|
}
|
|
30
27
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/utils/terms.js"],"names":["decodeEntities","buildTermsTree","flatTerms","flatTermsWithParentAndChildren","map","term","children","parent","some","termsByParent","reduce","acc","push","fillWithChildren","terms","id","length","unescapeString","arg","unescapeTerm","name","unescapeTerms"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,cAAT,QAA+B,0BAA/B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,cAAT,CAAyBC,SAAzB,EAAqC;AAC3C,QAAMC,8BAA8B,GAAGD,SAAS,CAACE,GAAV,CAAiBC,IAAF,IAAY;AACjE,WAAO;AACNC,MAAAA,QAAQ,EAAE,EADJ;AAENC,MAAAA,MAAM,EAAE,IAFF;AAGN,SAAGF;AAHG,KAAP;AAKA,GANsC,CAAvC,CAD2C,CAS3C;;AACA,MACCF,8BAA8B,CAACK,IAA/B,CAAqC
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/utils/terms.js"],"names":["decodeEntities","buildTermsTree","flatTerms","flatTermsWithParentAndChildren","map","term","children","parent","some","termsByParent","reduce","acc","push","fillWithChildren","terms","id","length","unescapeString","arg","unescapeTerm","name","unescapeTerms"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,cAAT,QAA+B,0BAA/B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,cAAT,CAAyBC,SAAzB,EAAqC;AAC3C,QAAMC,8BAA8B,GAAGD,SAAS,CAACE,GAAV,CAAiBC,IAAF,IAAY;AACjE,WAAO;AACNC,MAAAA,QAAQ,EAAE,EADJ;AAENC,MAAAA,MAAM,EAAE,IAFF;AAGN,SAAGF;AAHG,KAAP;AAKA,GANsC,CAAvC,CAD2C,CAS3C;;AACA,MACCF,8BAA8B,CAACK,IAA/B,CAAqC,CAAE;AAAED,IAAAA;AAAF,GAAF,KAAkBA,MAAM,KAAK,IAAlE,CADD,EAEE;AACD,WAAOJ,8BAAP;AACA;;AAED,QAAMM,aAAa,GAAGN,8BAA8B,CAACO,MAA/B,CACrB,CAAEC,GAAF,EAAON,IAAP,KAAiB;AAChB,UAAM;AAAEE,MAAAA;AAAF,QAAaF,IAAnB;;AACA,QAAK,CAAEM,GAAG,CAAEJ,MAAF,CAAV,EAAuB;AACtBI,MAAAA,GAAG,CAAEJ,MAAF,CAAH,GAAgB,EAAhB;AACA;;AACDI,IAAAA,GAAG,CAAEJ,MAAF,CAAH,CAAcK,IAAd,CAAoBP,IAApB;AACA,WAAOM,GAAP;AACA,GARoB,EASrB,EATqB,CAAtB;;AAYA,QAAME,gBAAgB,GAAKC,KAAF,IAAa;AACrC,WAAOA,KAAK,CAACV,GAAN,CAAaC,IAAF,IAAY;AAC7B,YAAMC,QAAQ,GAAGG,aAAa,CAAEJ,IAAI,CAACU,EAAP,CAA9B;AACA,aAAO,EACN,GAAGV,IADG;AAENC,QAAAA,QAAQ,EACPA,QAAQ,IAAIA,QAAQ,CAACU,MAArB,GACGH,gBAAgB,CAAEP,QAAF,CADnB,GAEG;AALE,OAAP;AAOA,KATM,CAAP;AAUA,GAXD;;AAaA,SAAOO,gBAAgB,CAAEJ,aAAa,CAAE,GAAF,CAAb,IAAwB,EAA1B,CAAvB;AACA;AAED,OAAO,MAAMQ,cAAc,GAAKC,GAAF,IAAW;AACxC,SAAOlB,cAAc,CAAEkB,GAAF,CAArB;AACA,CAFM;AAIP;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,YAAY,GAAKd,IAAF,IAAY;AACvC,SAAO,EACN,GAAGA,IADG;AAENe,IAAAA,IAAI,EAAEH,cAAc,CAAEZ,IAAI,CAACe,IAAP;AAFd,GAAP;AAIA,CALM;AAOP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,aAAa,GAAKP,KAAF,IAAa;AACzC,SAAO,CAAEA,KAAF,aAAEA,KAAF,cAAEA,KAAF,GAAW,EAAX,EAAgBV,GAAhB,CAAqBe,YAArB,CAAP;AACA,CAFM","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Returns terms in a tree form.\n *\n * @param {Array} flatTerms Array of terms in flat format.\n *\n * @return {Array} Array of terms in tree format.\n */\nexport function buildTermsTree( flatTerms ) {\n\tconst flatTermsWithParentAndChildren = flatTerms.map( ( term ) => {\n\t\treturn {\n\t\t\tchildren: [],\n\t\t\tparent: null,\n\t\t\t...term,\n\t\t};\n\t} );\n\n\t// All terms should have a `parent` because we're about to index them by it.\n\tif (\n\t\tflatTermsWithParentAndChildren.some( ( { parent } ) => parent === null )\n\t) {\n\t\treturn flatTermsWithParentAndChildren;\n\t}\n\n\tconst termsByParent = flatTermsWithParentAndChildren.reduce(\n\t\t( acc, term ) => {\n\t\t\tconst { parent } = term;\n\t\t\tif ( ! acc[ parent ] ) {\n\t\t\t\tacc[ parent ] = [];\n\t\t\t}\n\t\t\tacc[ parent ].push( term );\n\t\t\treturn acc;\n\t\t},\n\t\t{}\n\t);\n\n\tconst fillWithChildren = ( terms ) => {\n\t\treturn terms.map( ( term ) => {\n\t\t\tconst children = termsByParent[ term.id ];\n\t\t\treturn {\n\t\t\t\t...term,\n\t\t\t\tchildren:\n\t\t\t\t\tchildren && children.length\n\t\t\t\t\t\t? fillWithChildren( children )\n\t\t\t\t\t\t: [],\n\t\t\t};\n\t\t} );\n\t};\n\n\treturn fillWithChildren( termsByParent[ '0' ] || [] );\n}\n\nexport const unescapeString = ( arg ) => {\n\treturn decodeEntities( arg );\n};\n\n/**\n * Returns a term object with name unescaped.\n *\n * @param {Object} term The term object to unescape.\n *\n * @return {Object} Term object with name property unescaped.\n */\nexport const unescapeTerm = ( term ) => {\n\treturn {\n\t\t...term,\n\t\tname: unescapeString( term.name ),\n\t};\n};\n\n/**\n * Returns an array of term objects with names unescaped.\n * The unescape of each term is performed using the unescapeTerm function.\n *\n * @param {Object[]} terms Array of term objects to unescape.\n *\n * @return {Object[]} Array of term objects unescaped.\n */\nexport const unescapeTerms = ( terms ) => {\n\treturn ( terms ?? [] ).map( unescapeTerm );\n};\n"]}
|
|
@@ -418,7 +418,7 @@
|
|
|
418
418
|
.editor-post-publish-panel__content {
|
|
419
419
|
min-height: calc(100% - 144px);
|
|
420
420
|
}
|
|
421
|
-
.editor-post-publish-panel__content .components-spinner {
|
|
421
|
+
.editor-post-publish-panel__content > .components-spinner {
|
|
422
422
|
display: block;
|
|
423
423
|
margin: 100px auto 0;
|
|
424
424
|
}
|
|
@@ -627,6 +627,20 @@
|
|
|
627
627
|
margin-left: 0;
|
|
628
628
|
}
|
|
629
629
|
|
|
630
|
+
.edit-post-sync-status {
|
|
631
|
+
width: 100%;
|
|
632
|
+
position: relative;
|
|
633
|
+
justify-content: flex-start;
|
|
634
|
+
}
|
|
635
|
+
.edit-post-sync-status > span {
|
|
636
|
+
display: block;
|
|
637
|
+
width: 45%;
|
|
638
|
+
flex-shrink: 0;
|
|
639
|
+
}
|
|
640
|
+
.edit-post-sync-status .components-base-control {
|
|
641
|
+
padding-right: 6px;
|
|
642
|
+
}
|
|
643
|
+
|
|
630
644
|
.editor-post-taxonomies__hierarchical-terms-list {
|
|
631
645
|
max-height: 14em;
|
|
632
646
|
overflow: auto;
|
package/build-style/style.css
CHANGED
|
@@ -418,7 +418,7 @@
|
|
|
418
418
|
.editor-post-publish-panel__content {
|
|
419
419
|
min-height: calc(100% - 144px);
|
|
420
420
|
}
|
|
421
|
-
.editor-post-publish-panel__content .components-spinner {
|
|
421
|
+
.editor-post-publish-panel__content > .components-spinner {
|
|
422
422
|
display: block;
|
|
423
423
|
margin: 100px auto 0;
|
|
424
424
|
}
|
|
@@ -627,6 +627,20 @@
|
|
|
627
627
|
margin-right: 0;
|
|
628
628
|
}
|
|
629
629
|
|
|
630
|
+
.edit-post-sync-status {
|
|
631
|
+
width: 100%;
|
|
632
|
+
position: relative;
|
|
633
|
+
justify-content: flex-start;
|
|
634
|
+
}
|
|
635
|
+
.edit-post-sync-status > span {
|
|
636
|
+
display: block;
|
|
637
|
+
width: 45%;
|
|
638
|
+
flex-shrink: 0;
|
|
639
|
+
}
|
|
640
|
+
.edit-post-sync-status .components-base-control {
|
|
641
|
+
padding-left: 6px;
|
|
642
|
+
}
|
|
643
|
+
|
|
630
644
|
.editor-post-taxonomies__hierarchical-terms-list {
|
|
631
645
|
max-height: 14em;
|
|
632
646
|
overflow: auto;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/editor",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.12.1",
|
|
4
4
|
"description": "Enhanced block editor for WordPress posts.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -31,37 +31,36 @@
|
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@babel/runtime": "^7.16.0",
|
|
34
|
-
"@wordpress/a11y": "^3.
|
|
35
|
-
"@wordpress/api-fetch": "^6.
|
|
36
|
-
"@wordpress/blob": "^3.
|
|
37
|
-
"@wordpress/block-editor": "^12.
|
|
38
|
-
"@wordpress/blocks": "^12.
|
|
39
|
-
"@wordpress/components": "^25.
|
|
40
|
-
"@wordpress/compose": "^6.
|
|
41
|
-
"@wordpress/core-data": "^6.
|
|
42
|
-
"@wordpress/data": "^9.
|
|
43
|
-
"@wordpress/date": "^4.
|
|
44
|
-
"@wordpress/deprecated": "^3.
|
|
45
|
-
"@wordpress/dom": "^3.
|
|
46
|
-
"@wordpress/element": "^5.
|
|
47
|
-
"@wordpress/hooks": "^3.
|
|
48
|
-
"@wordpress/html-entities": "^3.
|
|
49
|
-
"@wordpress/i18n": "^4.
|
|
50
|
-
"@wordpress/icons": "^9.
|
|
51
|
-
"@wordpress/keyboard-shortcuts": "^4.
|
|
52
|
-
"@wordpress/keycodes": "^3.
|
|
53
|
-
"@wordpress/media-utils": "^4.
|
|
54
|
-
"@wordpress/notices": "^4.
|
|
55
|
-
"@wordpress/preferences": "^3.
|
|
56
|
-
"@wordpress/private-apis": "^0.
|
|
57
|
-
"@wordpress/reusable-blocks": "^4.
|
|
58
|
-
"@wordpress/rich-text": "^6.
|
|
59
|
-
"@wordpress/server-side-render": "^4.
|
|
60
|
-
"@wordpress/url": "^3.
|
|
61
|
-
"@wordpress/wordcount": "^3.
|
|
34
|
+
"@wordpress/a11y": "^3.35.1",
|
|
35
|
+
"@wordpress/api-fetch": "^6.32.1",
|
|
36
|
+
"@wordpress/blob": "^3.35.1",
|
|
37
|
+
"@wordpress/block-editor": "^12.3.1",
|
|
38
|
+
"@wordpress/blocks": "^12.12.1",
|
|
39
|
+
"@wordpress/components": "^25.1.1",
|
|
40
|
+
"@wordpress/compose": "^6.12.1",
|
|
41
|
+
"@wordpress/core-data": "^6.12.1",
|
|
42
|
+
"@wordpress/data": "^9.5.1",
|
|
43
|
+
"@wordpress/date": "^4.35.1",
|
|
44
|
+
"@wordpress/deprecated": "^3.35.1",
|
|
45
|
+
"@wordpress/dom": "^3.35.1",
|
|
46
|
+
"@wordpress/element": "^5.12.1",
|
|
47
|
+
"@wordpress/hooks": "^3.35.1",
|
|
48
|
+
"@wordpress/html-entities": "^3.35.1",
|
|
49
|
+
"@wordpress/i18n": "^4.35.1",
|
|
50
|
+
"@wordpress/icons": "^9.26.1",
|
|
51
|
+
"@wordpress/keyboard-shortcuts": "^4.12.1",
|
|
52
|
+
"@wordpress/keycodes": "^3.35.1",
|
|
53
|
+
"@wordpress/media-utils": "^4.26.1",
|
|
54
|
+
"@wordpress/notices": "^4.3.1",
|
|
55
|
+
"@wordpress/preferences": "^3.12.1",
|
|
56
|
+
"@wordpress/private-apis": "^0.17.1",
|
|
57
|
+
"@wordpress/reusable-blocks": "^4.12.1",
|
|
58
|
+
"@wordpress/rich-text": "^6.12.1",
|
|
59
|
+
"@wordpress/server-side-render": "^4.12.1",
|
|
60
|
+
"@wordpress/url": "^3.36.1",
|
|
61
|
+
"@wordpress/wordcount": "^3.35.1",
|
|
62
62
|
"classnames": "^2.3.1",
|
|
63
63
|
"date-fns": "^2.28.0",
|
|
64
|
-
"escape-html": "^1.0.3",
|
|
65
64
|
"memize": "^2.1.0",
|
|
66
65
|
"react-autosize-textarea": "^7.1.0",
|
|
67
66
|
"rememo": "^4.0.2",
|
|
@@ -74,5 +73,5 @@
|
|
|
74
73
|
"publishConfig": {
|
|
75
74
|
"access": "public"
|
|
76
75
|
},
|
|
77
|
-
"gitHead": "
|
|
76
|
+
"gitHead": "ce5639111c30763dbdf07f40eeb136ea6030ecf1"
|
|
78
77
|
}
|
|
@@ -35,10 +35,11 @@ it( 'navigates back from help topic detail screen', async () => {
|
|
|
35
35
|
const backButton = screen.getAllByLabelText( 'Go back' );
|
|
36
36
|
fireEvent.press( backButton[ backButton.length - 1 ] );
|
|
37
37
|
|
|
38
|
-
// Currently logs `act` warning due to https://github.com/callstack/react-native-testing-library/issues/379
|
|
39
38
|
const text =
|
|
40
39
|
'Each block has its own settings. To find them, tap on a block. Its settings will appear on the toolbar at the bottom of the screen.';
|
|
41
|
-
await waitForElementToBeRemoved( () =>
|
|
40
|
+
await waitForElementToBeRemoved( () =>
|
|
41
|
+
screen.getByText( text, { hidden: true } )
|
|
42
|
+
);
|
|
42
43
|
|
|
43
44
|
expect( screen.queryByText( text ) ).toBeNull();
|
|
44
45
|
} );
|
|
@@ -0,0 +1,87 @@
|
|
|
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
|
+
|
|
9
|
+
const TRANSLATED_SITE_PROPERTIES = {
|
|
10
|
+
title: __( 'Title' ),
|
|
11
|
+
description: __( 'Tagline' ),
|
|
12
|
+
site_logo: __( 'Logo' ),
|
|
13
|
+
site_icon: __( 'Icon' ),
|
|
14
|
+
show_on_front: __( 'Show on front' ),
|
|
15
|
+
page_on_front: __( 'Page on front' ),
|
|
16
|
+
posts_per_page: __( 'Maximum posts per page' ),
|
|
17
|
+
default_comment_status: __( 'Allow comments on new posts' ),
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const useIsDirty = () => {
|
|
21
|
+
const { dirtyEntityRecords } = useSelect( ( select ) => {
|
|
22
|
+
const dirtyRecords =
|
|
23
|
+
select( coreStore ).__experimentalGetDirtyEntityRecords();
|
|
24
|
+
|
|
25
|
+
// Remove site object and decouple into its edited pieces.
|
|
26
|
+
const dirtyRecordsWithoutSite = dirtyRecords.filter(
|
|
27
|
+
( record ) => ! ( record.kind === 'root' && record.name === 'site' )
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
const siteEdits = select( coreStore ).getEntityRecordEdits(
|
|
31
|
+
'root',
|
|
32
|
+
'site'
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
const siteEditsAsEntities = [];
|
|
36
|
+
for ( const property in siteEdits ) {
|
|
37
|
+
siteEditsAsEntities.push( {
|
|
38
|
+
kind: 'root',
|
|
39
|
+
name: 'site',
|
|
40
|
+
title: TRANSLATED_SITE_PROPERTIES[ property ] || property,
|
|
41
|
+
property,
|
|
42
|
+
} );
|
|
43
|
+
}
|
|
44
|
+
const dirtyRecordsWithSiteItems = [
|
|
45
|
+
...dirtyRecordsWithoutSite,
|
|
46
|
+
...siteEditsAsEntities,
|
|
47
|
+
];
|
|
48
|
+
|
|
49
|
+
return {
|
|
50
|
+
dirtyEntityRecords: dirtyRecordsWithSiteItems,
|
|
51
|
+
};
|
|
52
|
+
}, [] );
|
|
53
|
+
|
|
54
|
+
// Unchecked entities to be ignored by save function.
|
|
55
|
+
const [ unselectedEntities, _setUnselectedEntities ] = useState( [] );
|
|
56
|
+
|
|
57
|
+
const setUnselectedEntities = (
|
|
58
|
+
{ kind, name, key, property },
|
|
59
|
+
checked
|
|
60
|
+
) => {
|
|
61
|
+
if ( checked ) {
|
|
62
|
+
_setUnselectedEntities(
|
|
63
|
+
unselectedEntities.filter(
|
|
64
|
+
( elt ) =>
|
|
65
|
+
elt.kind !== kind ||
|
|
66
|
+
elt.name !== name ||
|
|
67
|
+
elt.key !== key ||
|
|
68
|
+
elt.property !== property
|
|
69
|
+
)
|
|
70
|
+
);
|
|
71
|
+
} else {
|
|
72
|
+
_setUnselectedEntities( [
|
|
73
|
+
...unselectedEntities,
|
|
74
|
+
{ kind, name, key, property },
|
|
75
|
+
] );
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const isDirty = dirtyEntityRecords.length - unselectedEntities.length > 0;
|
|
80
|
+
|
|
81
|
+
return {
|
|
82
|
+
dirtyEntityRecords,
|
|
83
|
+
isDirty,
|
|
84
|
+
setUnselectedEntities,
|
|
85
|
+
unselectedEntities,
|
|
86
|
+
};
|
|
87
|
+
};
|
|
@@ -2,28 +2,19 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { Button, Flex, FlexItem } from '@wordpress/components';
|
|
5
|
-
import { __
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
5
|
+
import { __ } from '@wordpress/i18n';
|
|
6
|
+
import { useDispatch } from '@wordpress/data';
|
|
7
|
+
import { useCallback, useRef } from '@wordpress/element';
|
|
8
8
|
import { store as coreStore } from '@wordpress/core-data';
|
|
9
9
|
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
10
10
|
import { __experimentalUseDialog as useDialog } from '@wordpress/compose';
|
|
11
11
|
import { store as noticesStore } from '@wordpress/notices';
|
|
12
|
-
import { getQueryArg } from '@wordpress/url';
|
|
13
12
|
|
|
14
13
|
/**
|
|
15
14
|
* Internal dependencies
|
|
16
15
|
*/
|
|
17
16
|
import EntityTypeList from './entity-type-list';
|
|
18
|
-
|
|
19
|
-
const TRANSLATED_SITE_PROPERTIES = {
|
|
20
|
-
title: __( 'Title' ),
|
|
21
|
-
description: __( 'Tagline' ),
|
|
22
|
-
site_logo: __( 'Logo' ),
|
|
23
|
-
site_icon: __( 'Icon' ),
|
|
24
|
-
show_on_front: __( 'Show on front' ),
|
|
25
|
-
page_on_front: __( 'Page on front' ),
|
|
26
|
-
};
|
|
17
|
+
import { useIsDirty } from './hooks/use-is-dirty';
|
|
27
18
|
|
|
28
19
|
const PUBLISH_ON_SAVE_ENTITIES = [
|
|
29
20
|
{
|
|
@@ -36,56 +27,26 @@ function identity( values ) {
|
|
|
36
27
|
return values;
|
|
37
28
|
}
|
|
38
29
|
|
|
39
|
-
function
|
|
30
|
+
export default function EntitiesSavedStates( { close } ) {
|
|
31
|
+
const isDirtyProps = useIsDirty();
|
|
40
32
|
return (
|
|
41
|
-
|
|
42
|
-
getQueryArg( window.location.href, 'theme_preview' ) !== undefined
|
|
33
|
+
<EntitiesSavedStatesExtensible close={ close } { ...isDirtyProps } />
|
|
43
34
|
);
|
|
44
35
|
}
|
|
45
36
|
|
|
46
|
-
function
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
37
|
+
export function EntitiesSavedStatesExtensible( {
|
|
38
|
+
additionalPrompt = undefined,
|
|
39
|
+
close,
|
|
40
|
+
onSave = identity,
|
|
41
|
+
saveEnabled: saveEnabledProp = undefined,
|
|
42
|
+
saveLabel = __( 'Save' ),
|
|
43
|
+
|
|
44
|
+
dirtyEntityRecords,
|
|
45
|
+
isDirty,
|
|
46
|
+
setUnselectedEntities,
|
|
47
|
+
unselectedEntities,
|
|
48
|
+
} ) {
|
|
54
49
|
const saveButtonRef = useRef();
|
|
55
|
-
const { getTheme } = useSelect( coreStore );
|
|
56
|
-
const theme = getTheme( currentlyPreviewingTheme() );
|
|
57
|
-
const { dirtyEntityRecords } = useSelect( ( select ) => {
|
|
58
|
-
const dirtyRecords =
|
|
59
|
-
select( coreStore ).__experimentalGetDirtyEntityRecords();
|
|
60
|
-
|
|
61
|
-
// Remove site object and decouple into its edited pieces.
|
|
62
|
-
const dirtyRecordsWithoutSite = dirtyRecords.filter(
|
|
63
|
-
( record ) => ! ( record.kind === 'root' && record.name === 'site' )
|
|
64
|
-
);
|
|
65
|
-
|
|
66
|
-
const siteEdits = select( coreStore ).getEntityRecordEdits(
|
|
67
|
-
'root',
|
|
68
|
-
'site'
|
|
69
|
-
);
|
|
70
|
-
|
|
71
|
-
const siteEditsAsEntities = [];
|
|
72
|
-
for ( const property in siteEdits ) {
|
|
73
|
-
siteEditsAsEntities.push( {
|
|
74
|
-
kind: 'root',
|
|
75
|
-
name: 'site',
|
|
76
|
-
title: TRANSLATED_SITE_PROPERTIES[ property ] || property,
|
|
77
|
-
property,
|
|
78
|
-
} );
|
|
79
|
-
}
|
|
80
|
-
const dirtyRecordsWithSiteItems = [
|
|
81
|
-
...dirtyRecordsWithoutSite,
|
|
82
|
-
...siteEditsAsEntities,
|
|
83
|
-
];
|
|
84
|
-
|
|
85
|
-
return {
|
|
86
|
-
dirtyEntityRecords: dirtyRecordsWithSiteItems,
|
|
87
|
-
};
|
|
88
|
-
}, [] );
|
|
89
50
|
const {
|
|
90
51
|
editEntityRecord,
|
|
91
52
|
saveEditedEntityRecord,
|
|
@@ -122,32 +83,9 @@ export default function EntitiesSavedStates( { close, onSave = identity } ) {
|
|
|
122
83
|
...Object.values( contentSavables ),
|
|
123
84
|
].filter( Array.isArray );
|
|
124
85
|
|
|
125
|
-
|
|
126
|
-
const [ unselectedEntities, _setUnselectedEntities ] = useState( [] );
|
|
127
|
-
|
|
128
|
-
const setUnselectedEntities = (
|
|
129
|
-
{ kind, name, key, property },
|
|
130
|
-
checked
|
|
131
|
-
) => {
|
|
132
|
-
if ( checked ) {
|
|
133
|
-
_setUnselectedEntities(
|
|
134
|
-
unselectedEntities.filter(
|
|
135
|
-
( elt ) =>
|
|
136
|
-
elt.kind !== kind ||
|
|
137
|
-
elt.name !== name ||
|
|
138
|
-
elt.key !== key ||
|
|
139
|
-
elt.property !== property
|
|
140
|
-
)
|
|
141
|
-
);
|
|
142
|
-
} else {
|
|
143
|
-
_setUnselectedEntities( [
|
|
144
|
-
...unselectedEntities,
|
|
145
|
-
{ kind, name, key, property },
|
|
146
|
-
] );
|
|
147
|
-
}
|
|
148
|
-
};
|
|
86
|
+
const saveEnabled = saveEnabledProp ?? isDirty;
|
|
149
87
|
|
|
150
|
-
const
|
|
88
|
+
const saveCheckedEntities = () => {
|
|
151
89
|
const saveNoticeId = 'site-editor-save-success';
|
|
152
90
|
removeNotice( saveNoticeId );
|
|
153
91
|
const entitiesToSave = dirtyEntityRecords.filter(
|
|
@@ -227,18 +165,6 @@ export default function EntitiesSavedStates( { close, onSave = identity } ) {
|
|
|
227
165
|
onClose: () => dismissPanel(),
|
|
228
166
|
} );
|
|
229
167
|
|
|
230
|
-
const isDirty = dirtyEntityRecords.length - unselectedEntities.length > 0;
|
|
231
|
-
const activateSaveEnabled = isPreviewingTheme() || isDirty;
|
|
232
|
-
|
|
233
|
-
let activateSaveLabel;
|
|
234
|
-
if ( isPreviewingTheme() && isDirty ) {
|
|
235
|
-
activateSaveLabel = __( 'Activate & Save' );
|
|
236
|
-
} else if ( isPreviewingTheme() ) {
|
|
237
|
-
activateSaveLabel = __( 'Activate' );
|
|
238
|
-
} else {
|
|
239
|
-
activateSaveLabel = __( 'Save' );
|
|
240
|
-
}
|
|
241
|
-
|
|
242
168
|
return (
|
|
243
169
|
<div
|
|
244
170
|
ref={ saveDialogRef }
|
|
@@ -251,11 +177,11 @@ export default function EntitiesSavedStates( { close, onSave = identity } ) {
|
|
|
251
177
|
as={ Button }
|
|
252
178
|
ref={ saveButtonRef }
|
|
253
179
|
variant="primary"
|
|
254
|
-
disabled={ !
|
|
255
|
-
onClick={
|
|
180
|
+
disabled={ ! saveEnabled }
|
|
181
|
+
onClick={ saveCheckedEntities }
|
|
256
182
|
className="editor-entities-saved-states__save-button"
|
|
257
183
|
>
|
|
258
|
-
{
|
|
184
|
+
{ saveLabel }
|
|
259
185
|
</FlexItem>
|
|
260
186
|
<FlexItem
|
|
261
187
|
isBlock
|
|
@@ -269,14 +195,7 @@ export default function EntitiesSavedStates( { close, onSave = identity } ) {
|
|
|
269
195
|
|
|
270
196
|
<div className="entities-saved-states__text-prompt">
|
|
271
197
|
<strong>{ __( 'Are you ready to save?' ) }</strong>
|
|
272
|
-
{
|
|
273
|
-
<p>
|
|
274
|
-
{ sprintf(
|
|
275
|
-
'Saving your changes will change your active theme to %1$s.',
|
|
276
|
-
theme?.name?.rendered
|
|
277
|
-
) }
|
|
278
|
-
</p>
|
|
279
|
-
) }
|
|
198
|
+
{ additionalPrompt }
|
|
280
199
|
{ isDirty && (
|
|
281
200
|
<p>
|
|
282
201
|
{ __(
|