@wordpress/editor 14.48.1 → 14.49.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/README.md +5 -13
- package/build/bindings/pattern-overrides.cjs +1 -1
- package/build/bindings/pattern-overrides.cjs.map +2 -2
- package/build/components/autosave-monitor/index.cjs +40 -83
- package/build/components/autosave-monitor/index.cjs.map +3 -3
- package/build/components/collab-sidebar/note-byline.cjs +1 -1
- package/build/components/collab-sidebar/note-byline.cjs.map +2 -2
- package/build/components/collab-sidebar/note.cjs +49 -17
- package/build/components/collab-sidebar/note.cjs.map +3 -3
- package/build/components/collab-sidebar/notes.cjs.map +1 -1
- package/build/components/collab-sidebar/utils.cjs +1 -1
- package/build/components/collab-sidebar/utils.cjs.map +2 -2
- package/build/components/collaborators-overlay/avatar-iframe-styles.cjs.map +1 -1
- package/build/components/collaborators-overlay/collaborator-styles.cjs.map +1 -1
- package/build/components/collaborators-overlay/compute-selection.cjs.map +1 -1
- package/build/components/collaborators-overlay/overlay-iframe-styles.cjs +1 -1
- package/build/components/collaborators-overlay/overlay-iframe-styles.cjs.map +1 -1
- package/build/components/collaborators-overlay/use-block-highlighting.cjs.map +1 -1
- package/build/components/collaborators-presence/avatar/component.cjs.map +2 -2
- package/build/components/collaborators-presence/avatar/use-image-loading-status.cjs.map +1 -1
- package/build/components/document-bar/index.cjs +7 -5
- package/build/components/document-bar/index.cjs.map +2 -2
- package/build/components/global-keyboard-shortcuts/index.cjs +3 -2
- package/build/components/global-keyboard-shortcuts/index.cjs.map +2 -2
- package/build/components/global-styles-sidebar/welcome-guide.cjs +3 -3
- package/build/components/global-styles-sidebar/welcome-guide.cjs.map +1 -1
- package/build/components/local-autosave-monitor/index.cjs +14 -15
- package/build/components/local-autosave-monitor/index.cjs.map +2 -2
- package/build/components/page-attributes/parent.cjs +1 -1
- package/build/components/page-attributes/parent.cjs.map +2 -2
- package/build/components/post-card-panel/index.cjs +1 -1
- package/build/components/post-card-panel/index.cjs.map +2 -2
- package/build/components/post-excerpt/panel.cjs +1 -1
- package/build/components/post-excerpt/panel.cjs.map +2 -2
- package/build/components/post-locked-modal/index.cjs +3 -3
- package/build/components/post-locked-modal/index.cjs.map +1 -1
- package/build/components/post-preview-button/index.cjs +2 -2
- package/build/components/post-preview-button/index.cjs.map +2 -2
- package/build/components/post-publish-button/index.cjs +4 -3
- package/build/components/post-publish-button/index.cjs.map +2 -2
- package/build/components/post-publish-button/label.cjs +2 -2
- package/build/components/post-publish-button/label.cjs.map +2 -2
- package/build/components/post-publish-panel/index.cjs.map +1 -1
- package/build/components/post-publish-panel/postpublish.cjs +1 -2
- package/build/components/post-publish-panel/postpublish.cjs.map +2 -2
- package/build/components/post-revisions-preview/block-diff.cjs.map +1 -1
- package/build/components/post-revisions-preview/diff-markers.cjs.map +2 -2
- package/build/components/post-revisions-preview/revisions-slider.cjs +1 -1
- package/build/components/post-revisions-preview/revisions-slider.cjs.map +2 -2
- package/build/components/post-revisions-timeline/index.cjs +173 -0
- package/build/components/post-revisions-timeline/index.cjs.map +7 -0
- package/build/components/post-saved-state/index.cjs +17 -26
- package/build/components/post-saved-state/index.cjs.map +2 -2
- package/build/components/post-schedule/label.cjs +5 -5
- package/build/components/post-schedule/label.cjs.map +1 -1
- package/build/components/post-status/index.cjs +0 -1
- package/build/components/post-status/index.cjs.map +2 -2
- package/build/components/post-taxonomies/flat-term-selector.cjs +2 -1
- package/build/components/post-taxonomies/flat-term-selector.cjs.map +3 -3
- package/build/components/post-taxonomies/hierarchical-term-selector.cjs +1 -2
- package/build/components/post-taxonomies/hierarchical-term-selector.cjs.map +2 -2
- package/build/components/post-template/create-new-template-modal.cjs +0 -1
- package/build/components/post-template/create-new-template-modal.cjs.map +2 -2
- package/build/components/post-text-editor/index.cjs +51 -0
- package/build/components/post-text-editor/index.cjs.map +2 -2
- package/build/components/post-text-editor/utils.cjs +150 -0
- package/build/components/post-text-editor/utils.cjs.map +7 -0
- package/build/components/post-url/index.cjs +1 -1
- package/build/components/post-url/index.cjs.map +2 -2
- package/build/components/post-view-link/index.cjs +1 -1
- package/build/components/post-view-link/index.cjs.map +2 -2
- package/build/components/post-visibility/index.cjs +0 -1
- package/build/components/post-visibility/index.cjs.map +2 -2
- package/build/components/provider/disable-non-page-content-blocks.cjs +23 -3
- package/build/components/provider/disable-non-page-content-blocks.cjs.map +2 -2
- package/build/components/provider/index.cjs +1 -1
- package/build/components/provider/index.cjs.map +2 -2
- package/build/components/provider/navigation-block-editing-mode.cjs +9 -2
- package/build/components/provider/navigation-block-editing-mode.cjs.map +2 -2
- package/build/components/provider/use-block-editor-settings.cjs +2 -1
- package/build/components/provider/use-block-editor-settings.cjs.map +2 -2
- package/build/components/resizable-editor/resize-handle.cjs.map +2 -2
- package/build/components/revision-diff-panel/index.cjs +7 -2
- package/build/components/revision-diff-panel/index.cjs.map +2 -2
- package/build/components/revision-fields-diff/index.cjs +6 -2
- package/build/components/revision-fields-diff/index.cjs.map +2 -2
- package/build/components/sidebar/dataform-post-summary.cjs +189 -29
- package/build/components/sidebar/dataform-post-summary.cjs.map +3 -3
- package/build/components/sidebar/index.cjs +1 -11
- package/build/components/sidebar/index.cjs.map +3 -3
- package/build/components/sidebar/post-revision-summary.cjs +11 -17
- package/build/components/sidebar/post-revision-summary.cjs.map +3 -3
- package/build/components/sidebar/post-summary.cjs +8 -6
- package/build/components/sidebar/post-summary.cjs.map +3 -3
- package/build/components/style-book/examples.cjs +1 -1
- package/build/components/style-book/examples.cjs.map +1 -1
- package/build/components/style-book/index.cjs +1 -1
- package/build/components/style-book/index.cjs.map +2 -2
- package/build/components/sync-connection-error-modal/index.cjs +3 -3
- package/build/components/sync-connection-error-modal/index.cjs.map +1 -1
- package/build/components/template-actions-panel/block-theme-content.cjs.map +2 -2
- package/build/components/template-actions-panel/index.cjs +0 -9
- package/build/components/template-actions-panel/index.cjs.map +3 -3
- package/build/components/template-validation-notice/index.cjs +1 -1
- package/build/components/template-validation-notice/index.cjs.map +1 -1
- package/build/components/upload-progress-snackbar/index.cjs +3 -3
- package/build/components/upload-progress-snackbar/index.cjs.map +2 -2
- package/build/components/upload-progress-snackbar/tracker.cjs.map +1 -1
- package/build/components/visual-editor/edit-template-blocks-notification.cjs +1 -1
- package/build/components/visual-editor/edit-template-blocks-notification.cjs.map +1 -1
- package/build/{components/revision-author-panel → dataviews/fields/revisions}/index.cjs +18 -26
- package/build/dataviews/fields/revisions/index.cjs.map +7 -0
- package/build/dataviews/fields/revisions/revisions-view.cjs +74 -0
- package/build/dataviews/fields/revisions/revisions-view.cjs.map +7 -0
- package/build/dataviews/store/private-actions.cjs +17 -5
- package/build/dataviews/store/private-actions.cjs.map +3 -3
- package/build/hooks/push-changes-to-global-styles/index.cjs +1 -1
- package/build/hooks/push-changes-to-global-styles/index.cjs.map +1 -1
- package/build/store/actions.cjs +1 -1
- package/build/store/actions.cjs.map +2 -2
- package/build/store/private-actions.cjs +2 -2
- package/build/store/private-actions.cjs.map +2 -2
- package/build/store/private-selectors.cjs +6 -1
- package/build/store/private-selectors.cjs.map +2 -2
- package/build/utils/media-upload/index.cjs.map +1 -1
- package/build/utils/set-nested-value.cjs.map +1 -1
- package/build-module/bindings/pattern-overrides.mjs +1 -1
- package/build-module/bindings/pattern-overrides.mjs.map +2 -2
- package/build-module/components/autosave-monitor/index.mjs +42 -81
- package/build-module/components/autosave-monitor/index.mjs.map +2 -2
- package/build-module/components/collab-sidebar/note-byline.mjs +1 -1
- package/build-module/components/collab-sidebar/note-byline.mjs.map +2 -2
- package/build-module/components/collab-sidebar/note.mjs +50 -18
- package/build-module/components/collab-sidebar/note.mjs.map +2 -2
- package/build-module/components/collab-sidebar/notes.mjs.map +1 -1
- package/build-module/components/collab-sidebar/utils.mjs +1 -1
- package/build-module/components/collab-sidebar/utils.mjs.map +2 -2
- package/build-module/components/collaborators-overlay/avatar-iframe-styles.mjs.map +1 -1
- package/build-module/components/collaborators-overlay/collaborator-styles.mjs.map +1 -1
- package/build-module/components/collaborators-overlay/compute-selection.mjs.map +1 -1
- package/build-module/components/collaborators-overlay/overlay-iframe-styles.mjs +1 -1
- package/build-module/components/collaborators-overlay/overlay-iframe-styles.mjs.map +1 -1
- package/build-module/components/collaborators-overlay/use-block-highlighting.mjs.map +1 -1
- package/build-module/components/collaborators-presence/avatar/component.mjs.map +2 -2
- package/build-module/components/collaborators-presence/avatar/use-image-loading-status.mjs.map +1 -1
- package/build-module/components/document-bar/index.mjs +7 -5
- package/build-module/components/document-bar/index.mjs.map +2 -2
- package/build-module/components/global-keyboard-shortcuts/index.mjs +3 -2
- package/build-module/components/global-keyboard-shortcuts/index.mjs.map +2 -2
- package/build-module/components/global-styles-sidebar/welcome-guide.mjs +3 -3
- package/build-module/components/global-styles-sidebar/welcome-guide.mjs.map +1 -1
- package/build-module/components/local-autosave-monitor/index.mjs +15 -16
- package/build-module/components/local-autosave-monitor/index.mjs.map +2 -2
- package/build-module/components/page-attributes/parent.mjs +1 -1
- package/build-module/components/page-attributes/parent.mjs.map +2 -2
- package/build-module/components/post-card-panel/index.mjs +1 -1
- package/build-module/components/post-card-panel/index.mjs.map +2 -2
- package/build-module/components/post-excerpt/panel.mjs +1 -1
- package/build-module/components/post-excerpt/panel.mjs.map +2 -2
- package/build-module/components/post-locked-modal/index.mjs +3 -3
- package/build-module/components/post-locked-modal/index.mjs.map +1 -1
- package/build-module/components/post-preview-button/index.mjs +2 -2
- package/build-module/components/post-preview-button/index.mjs.map +2 -2
- package/build-module/components/post-publish-button/index.mjs +4 -3
- package/build-module/components/post-publish-button/index.mjs.map +2 -2
- package/build-module/components/post-publish-button/label.mjs +2 -2
- package/build-module/components/post-publish-button/label.mjs.map +2 -2
- package/build-module/components/post-publish-panel/index.mjs.map +1 -1
- package/build-module/components/post-publish-panel/postpublish.mjs +1 -2
- package/build-module/components/post-publish-panel/postpublish.mjs.map +2 -2
- package/build-module/components/post-revisions-preview/block-diff.mjs.map +1 -1
- package/build-module/components/post-revisions-preview/diff-markers.mjs.map +2 -2
- package/build-module/components/post-revisions-preview/revisions-slider.mjs +1 -1
- package/build-module/components/post-revisions-preview/revisions-slider.mjs.map +2 -2
- package/build-module/components/post-revisions-timeline/index.mjs +152 -0
- package/build-module/components/post-revisions-timeline/index.mjs.map +7 -0
- package/build-module/components/post-saved-state/index.mjs +17 -26
- package/build-module/components/post-saved-state/index.mjs.map +2 -2
- package/build-module/components/post-schedule/label.mjs +5 -5
- package/build-module/components/post-schedule/label.mjs.map +1 -1
- package/build-module/components/post-status/index.mjs +0 -1
- package/build-module/components/post-status/index.mjs.map +2 -2
- package/build-module/components/post-taxonomies/flat-term-selector.mjs +3 -6
- package/build-module/components/post-taxonomies/flat-term-selector.mjs.map +2 -2
- package/build-module/components/post-taxonomies/hierarchical-term-selector.mjs +1 -2
- package/build-module/components/post-taxonomies/hierarchical-term-selector.mjs.map +2 -2
- package/build-module/components/post-template/create-new-template-modal.mjs +0 -1
- package/build-module/components/post-template/create-new-template-modal.mjs.map +2 -2
- package/build-module/components/post-text-editor/index.mjs +51 -0
- package/build-module/components/post-text-editor/index.mjs.map +2 -2
- package/build-module/components/post-text-editor/utils.mjs +123 -0
- package/build-module/components/post-text-editor/utils.mjs.map +7 -0
- package/build-module/components/post-url/index.mjs +1 -1
- package/build-module/components/post-url/index.mjs.map +2 -2
- package/build-module/components/post-view-link/index.mjs +1 -1
- package/build-module/components/post-view-link/index.mjs.map +2 -2
- package/build-module/components/post-visibility/index.mjs +0 -1
- package/build-module/components/post-visibility/index.mjs.map +2 -2
- package/build-module/components/provider/disable-non-page-content-blocks.mjs +23 -3
- package/build-module/components/provider/disable-non-page-content-blocks.mjs.map +2 -2
- package/build-module/components/provider/index.mjs +1 -1
- package/build-module/components/provider/index.mjs.map +2 -2
- package/build-module/components/provider/navigation-block-editing-mode.mjs +10 -3
- package/build-module/components/provider/navigation-block-editing-mode.mjs.map +2 -2
- package/build-module/components/provider/use-block-editor-settings.mjs +2 -1
- package/build-module/components/provider/use-block-editor-settings.mjs.map +2 -2
- package/build-module/components/resizable-editor/resize-handle.mjs.map +2 -2
- package/build-module/components/revision-diff-panel/index.mjs +7 -2
- package/build-module/components/revision-diff-panel/index.mjs.map +2 -2
- package/build-module/components/revision-fields-diff/index.mjs +6 -2
- package/build-module/components/revision-fields-diff/index.mjs.map +2 -2
- package/build-module/components/sidebar/dataform-post-summary.mjs +190 -30
- package/build-module/components/sidebar/dataform-post-summary.mjs.map +2 -2
- package/build-module/components/sidebar/index.mjs +1 -11
- package/build-module/components/sidebar/index.mjs.map +2 -2
- package/build-module/components/sidebar/post-revision-summary.mjs +11 -17
- package/build-module/components/sidebar/post-revision-summary.mjs.map +2 -2
- package/build-module/components/sidebar/post-summary.mjs +8 -6
- package/build-module/components/sidebar/post-summary.mjs.map +2 -2
- package/build-module/components/style-book/examples.mjs +1 -1
- package/build-module/components/style-book/examples.mjs.map +1 -1
- package/build-module/components/style-book/index.mjs +1 -1
- package/build-module/components/style-book/index.mjs.map +2 -2
- package/build-module/components/sync-connection-error-modal/index.mjs +3 -3
- package/build-module/components/sync-connection-error-modal/index.mjs.map +1 -1
- package/build-module/components/template-actions-panel/block-theme-content.mjs.map +2 -2
- package/build-module/components/template-actions-panel/index.mjs +0 -9
- package/build-module/components/template-actions-panel/index.mjs.map +2 -2
- package/build-module/components/template-validation-notice/index.mjs +1 -1
- package/build-module/components/template-validation-notice/index.mjs.map +1 -1
- package/build-module/components/upload-progress-snackbar/index.mjs +3 -3
- package/build-module/components/upload-progress-snackbar/index.mjs.map +2 -2
- package/build-module/components/upload-progress-snackbar/tracker.mjs.map +1 -1
- package/build-module/components/visual-editor/edit-template-blocks-notification.mjs +1 -1
- package/build-module/components/visual-editor/edit-template-blocks-notification.mjs.map +1 -1
- package/build-module/dataviews/fields/revisions/index.mjs +20 -0
- package/build-module/dataviews/fields/revisions/index.mjs.map +7 -0
- package/build-module/dataviews/fields/revisions/revisions-view.mjs +53 -0
- package/build-module/dataviews/fields/revisions/revisions-view.mjs.map +7 -0
- package/build-module/dataviews/store/private-actions.mjs +28 -8
- package/build-module/dataviews/store/private-actions.mjs.map +2 -2
- package/build-module/hooks/push-changes-to-global-styles/index.mjs +1 -1
- package/build-module/hooks/push-changes-to-global-styles/index.mjs.map +1 -1
- package/build-module/store/actions.mjs +1 -1
- package/build-module/store/actions.mjs.map +2 -2
- package/build-module/store/private-actions.mjs +2 -2
- package/build-module/store/private-actions.mjs.map +2 -2
- package/build-module/store/private-selectors.mjs +7 -1
- package/build-module/store/private-selectors.mjs.map +2 -2
- package/build-module/utils/media-upload/index.mjs.map +1 -1
- package/build-module/utils/set-nested-value.mjs.map +1 -1
- package/build-style/style-rtl.css +298 -238
- package/build-style/style.css +298 -238
- package/build-types/components/autosave-monitor/index.d.ts +11 -29
- package/build-types/components/autosave-monitor/index.d.ts.map +1 -1
- package/build-types/components/collab-sidebar/note-byline.d.ts +0 -3
- package/build-types/components/collab-sidebar/note-byline.d.ts.map +1 -1
- package/build-types/components/collab-sidebar/note.d.ts.map +1 -1
- package/build-types/components/collaborators-presence/avatar/component.d.ts.map +1 -1
- package/build-types/components/document-bar/index.d.ts +2 -2
- package/build-types/components/document-bar/index.d.ts.map +1 -1
- package/build-types/components/global-keyboard-shortcuts/index.d.ts.map +1 -1
- package/build-types/components/local-autosave-monitor/index.d.ts.map +1 -1
- package/build-types/components/post-publish-button/index.d.ts.map +1 -1
- package/build-types/components/post-publish-panel/postpublish.d.ts.map +1 -1
- package/build-types/components/post-revisions-preview/diff-markers.d.ts.map +1 -1
- package/build-types/components/post-revisions-timeline/index.d.ts +2 -0
- package/build-types/components/post-revisions-timeline/index.d.ts.map +1 -0
- package/build-types/components/post-saved-state/index.d.ts.map +1 -1
- package/build-types/components/post-status/index.d.ts.map +1 -1
- package/build-types/components/post-taxonomies/flat-term-selector.d.ts.map +1 -1
- package/build-types/components/post-taxonomies/hierarchical-term-selector.d.ts.map +1 -1
- package/build-types/components/post-template/create-new-template-modal.d.ts.map +1 -1
- package/build-types/components/post-text-editor/index.d.ts +1 -1
- package/build-types/components/post-text-editor/index.d.ts.map +1 -1
- package/build-types/components/post-visibility/index.d.ts.map +1 -1
- package/build-types/components/provider/disable-non-page-content-blocks.d.ts.map +1 -1
- package/build-types/components/provider/index.d.ts.map +1 -1
- package/build-types/components/provider/navigation-block-editing-mode.d.ts.map +1 -1
- package/build-types/components/provider/use-block-editor-settings.d.ts.map +1 -1
- package/build-types/components/resizable-editor/resize-handle.d.ts.map +1 -1
- package/build-types/components/revision-diff-panel/index.d.ts +3 -1
- package/build-types/components/revision-diff-panel/index.d.ts.map +1 -1
- package/build-types/components/revision-fields-diff/index.d.ts.map +1 -1
- package/build-types/components/sidebar/dataform-post-summary.d.ts.map +1 -1
- package/build-types/components/sidebar/index.d.ts.map +1 -1
- package/build-types/components/sidebar/post-revision-summary.d.ts.map +1 -1
- package/build-types/components/sidebar/post-summary.d.ts.map +1 -1
- package/build-types/components/template-actions-panel/block-theme-content.d.ts.map +1 -1
- package/build-types/components/template-actions-panel/index.d.ts.map +1 -1
- package/build-types/dataviews/fields/revisions/index.d.ts +8 -0
- package/build-types/dataviews/fields/revisions/index.d.ts.map +1 -0
- package/build-types/dataviews/fields/revisions/revisions-view.d.ts +2 -0
- package/build-types/dataviews/fields/revisions/revisions-view.d.ts.map +1 -0
- package/build-types/dataviews/store/private-actions.d.ts.map +1 -1
- package/build-types/store/private-selectors.d.ts +1 -1
- package/build-types/store/private-selectors.d.ts.map +1 -1
- package/build-types/store/selectors.d.ts +1 -1
- package/build-types/store/selectors.d.ts.map +1 -1
- package/build-types/utils/get-template-part-icon.d.ts.map +1 -1
- package/package.json +53 -47
- package/src/bindings/pattern-overrides.js +1 -1
- package/src/bindings/test/pattern-overrides.js +65 -0
- package/src/components/autosave-monitor/index.js +69 -104
- package/src/components/autosave-monitor/test/index.js +137 -122
- package/src/components/collab-sidebar/note-byline.js +0 -1
- package/src/components/collab-sidebar/note.js +64 -29
- package/src/components/collab-sidebar/style.scss +20 -0
- package/src/components/collaborators-presence/avatar/component.tsx +0 -1
- package/src/components/collaborators-presence/avatar/test/index.tsx +0 -1
- package/src/components/document-bar/index.js +8 -3
- package/src/components/document-bar/style.scss +4 -2
- package/src/components/global-keyboard-shortcuts/index.js +2 -1
- package/src/components/local-autosave-monitor/index.js +23 -21
- package/src/components/plugin-post-publish-panel/test/__snapshots__/index.js.snap +1 -0
- package/src/components/post-card-panel/index.js +1 -1
- package/src/components/post-publish-button/index.js +6 -3
- package/src/components/post-publish-button/test/index.js +13 -0
- package/src/components/post-publish-panel/postpublish.js +0 -1
- package/src/components/post-publish-panel/test/__snapshots__/index.js.snap +7 -2
- package/src/components/post-revisions-preview/diff-markers.js +0 -1
- package/src/components/post-revisions-timeline/index.js +186 -0
- package/src/components/post-revisions-timeline/style.scss +43 -0
- package/src/components/post-saved-state/index.js +23 -26
- package/src/components/post-saved-state/test/__snapshots__/index.js.snap +1 -0
- package/src/components/post-saved-state/test/index.js +18 -0
- package/src/components/post-status/index.js +0 -1
- package/src/components/post-taxonomies/flat-term-selector.js +4 -7
- package/src/components/post-taxonomies/hierarchical-term-selector.js +0 -1
- package/src/components/post-template/create-new-template-modal.js +0 -1
- package/src/components/post-text-editor/index.js +65 -0
- package/src/components/post-text-editor/test/utils.js +210 -0
- package/src/components/post-text-editor/utils.js +204 -0
- package/src/components/post-type-support-check/test/index.js +11 -0
- package/src/components/post-url/index.js +1 -1
- package/src/components/post-view-link/index.js +1 -1
- package/src/components/post-view-link/test/index.js +71 -0
- package/src/components/post-visibility/index.js +0 -1
- package/src/components/provider/disable-non-page-content-blocks.js +23 -6
- package/src/components/provider/index.js +2 -1
- package/src/components/provider/navigation-block-editing-mode.js +10 -4
- package/src/components/provider/use-block-editor-settings.js +3 -1
- package/src/components/resizable-editor/resize-handle.js +0 -1
- package/src/components/revision-diff-panel/index.js +8 -2
- package/src/components/revision-fields-diff/index.js +12 -1
- package/src/components/sidebar/dataform-post-summary.js +291 -36
- package/src/components/sidebar/index.js +2 -12
- package/src/components/sidebar/post-revision-summary.js +8 -15
- package/src/components/sidebar/post-summary.js +12 -10
- package/src/components/style-book/index.js +1 -1
- package/src/components/template-actions-panel/block-theme-content.js +0 -1
- package/src/components/template-actions-panel/index.js +0 -15
- package/src/dataviews/fields/revisions/index.tsx +28 -0
- package/src/dataviews/fields/revisions/revisions-view.tsx +59 -0
- package/src/dataviews/store/private-actions.ts +35 -7
- package/src/store/private-actions.js +2 -2
- package/src/store/private-selectors.js +11 -1
- package/src/store/test/actions.js +2 -2
- package/src/store/test/private-selectors.js +69 -0
- package/src/style.scss +1 -1
- package/build/components/post-revisions-panel/index.cjs +0 -173
- package/build/components/post-revisions-panel/index.cjs.map +0 -7
- package/build/components/revision-author-panel/index.cjs.map +0 -7
- package/build/components/revision-created-panel/index.cjs +0 -47
- package/build/components/revision-created-panel/index.cjs.map +0 -7
- package/build-module/components/post-revisions-panel/index.mjs +0 -148
- package/build-module/components/post-revisions-panel/index.mjs.map +0 -7
- package/build-module/components/revision-author-panel/index.mjs +0 -28
- package/build-module/components/revision-author-panel/index.mjs.map +0 -7
- package/build-module/components/revision-created-panel/index.mjs +0 -26
- package/build-module/components/revision-created-panel/index.mjs.map +0 -7
- package/build-types/components/collab-sidebar/add-comment.d.ts +0 -6
- package/build-types/components/collab-sidebar/add-comment.d.ts.map +0 -1
- package/build-types/components/collab-sidebar/comment-author-info.d.ts +0 -8
- package/build-types/components/collab-sidebar/comment-author-info.d.ts.map +0 -1
- package/build-types/components/collab-sidebar/comment-form.d.ts +0 -9
- package/build-types/components/collab-sidebar/comment-form.d.ts.map +0 -1
- package/build-types/components/collab-sidebar/comment-indicator-toolbar.d.ts +0 -6
- package/build-types/components/collab-sidebar/comment-indicator-toolbar.d.ts.map +0 -1
- package/build-types/components/collab-sidebar/comment-menu-item.d.ts +0 -6
- package/build-types/components/collab-sidebar/comment-menu-item.d.ts.map +0 -1
- package/build-types/components/collab-sidebar/comments.d.ts +0 -10
- package/build-types/components/collab-sidebar/comments.d.ts.map +0 -1
- package/build-types/components/global-styles-provider/index.d.ts +0 -16
- package/build-types/components/global-styles-provider/index.d.ts.map +0 -1
- package/build-types/components/media/index.d.ts +0 -3
- package/build-types/components/media/index.d.ts.map +0 -1
- package/build-types/components/media/metadata-panel.d.ts +0 -12
- package/build-types/components/media/metadata-panel.d.ts.map +0 -1
- package/build-types/components/media/preview.d.ts +0 -9
- package/build-types/components/media/preview.d.ts.map +0 -1
- package/build-types/components/post-revisions-panel/index.d.ts +0 -2
- package/build-types/components/post-revisions-panel/index.d.ts.map +0 -1
- package/build-types/components/revision-author-panel/index.d.ts +0 -2
- package/build-types/components/revision-author-panel/index.d.ts.map +0 -1
- package/build-types/components/revision-created-panel/index.d.ts +0 -2
- package/build-types/components/revision-created-panel/index.d.ts.map +0 -1
- package/src/components/editor-help/images/add-dark.png +0 -0
- package/src/components/editor-help/images/add-dark@2x.png +0 -0
- package/src/components/editor-help/images/add-dark@3x.png +0 -0
- package/src/components/editor-help/images/add-light.png +0 -0
- package/src/components/editor-help/images/add-light@2x.png +0 -0
- package/src/components/editor-help/images/add-light@3x.png +0 -0
- package/src/components/editor-help/images/block-layout-collage.png +0 -0
- package/src/components/editor-help/images/block-layout-collage@2x.png +0 -0
- package/src/components/editor-help/images/block-layout-collage@3x.png +0 -0
- package/src/components/editor-help/images/build-layouts-dark.png +0 -0
- package/src/components/editor-help/images/build-layouts-dark@2x.png +0 -0
- package/src/components/editor-help/images/build-layouts-dark@3x.png +0 -0
- package/src/components/editor-help/images/build-layouts-light.png +0 -0
- package/src/components/editor-help/images/build-layouts-light@2x.png +0 -0
- package/src/components/editor-help/images/build-layouts-light@3x.png +0 -0
- package/src/components/editor-help/images/drag-and-drop-dark.png +0 -0
- package/src/components/editor-help/images/drag-and-drop-dark@2x.png +0 -0
- package/src/components/editor-help/images/drag-and-drop-dark@3x.png +0 -0
- package/src/components/editor-help/images/drag-and-drop-light.png +0 -0
- package/src/components/editor-help/images/drag-and-drop-light@2x.png +0 -0
- package/src/components/editor-help/images/drag-and-drop-light@3x.png +0 -0
- package/src/components/editor-help/images/edit-media-dark.png +0 -0
- package/src/components/editor-help/images/edit-media-dark@2x.png +0 -0
- package/src/components/editor-help/images/edit-media-dark@3x.png +0 -0
- package/src/components/editor-help/images/edit-media-light.png +0 -0
- package/src/components/editor-help/images/edit-media-light@2x.png +0 -0
- package/src/components/editor-help/images/edit-media-light@3x.png +0 -0
- package/src/components/editor-help/images/embed-media-dark.png +0 -0
- package/src/components/editor-help/images/embed-media-dark@2x.png +0 -0
- package/src/components/editor-help/images/embed-media-dark@3x.png +0 -0
- package/src/components/editor-help/images/embed-media-light.png +0 -0
- package/src/components/editor-help/images/embed-media-light@2x.png +0 -0
- package/src/components/editor-help/images/embed-media-light@3x.png +0 -0
- package/src/components/editor-help/images/move-dark.png +0 -0
- package/src/components/editor-help/images/move-dark@2x.png +0 -0
- package/src/components/editor-help/images/move-dark@3x.png +0 -0
- package/src/components/editor-help/images/move-light.png +0 -0
- package/src/components/editor-help/images/move-light@2x.png +0 -0
- package/src/components/editor-help/images/move-light@3x.png +0 -0
- package/src/components/editor-help/images/options-dark.png +0 -0
- package/src/components/editor-help/images/options-dark@2x.png +0 -0
- package/src/components/editor-help/images/options-dark@3x.png +0 -0
- package/src/components/editor-help/images/options-light.png +0 -0
- package/src/components/editor-help/images/options-light@2x.png +0 -0
- package/src/components/editor-help/images/options-light@3x.png +0 -0
- package/src/components/editor-help/images/rich-text-dark.png +0 -0
- package/src/components/editor-help/images/rich-text-dark@2x.png +0 -0
- package/src/components/editor-help/images/rich-text-dark@3x.png +0 -0
- package/src/components/editor-help/images/rich-text-light.png +0 -0
- package/src/components/editor-help/images/rich-text-light@2x.png +0 -0
- package/src/components/editor-help/images/rich-text-light@3x.png +0 -0
- package/src/components/editor-help/images/settings-dark.png +0 -0
- package/src/components/editor-help/images/settings-dark@2x.png +0 -0
- package/src/components/editor-help/images/settings-dark@3x.png +0 -0
- package/src/components/editor-help/images/settings-light.png +0 -0
- package/src/components/editor-help/images/settings-light@2x.png +0 -0
- package/src/components/editor-help/images/settings-light@3x.png +0 -0
- package/src/components/editor-help/style.scss +0 -123
- package/src/components/post-revisions-panel/index.js +0 -161
- package/src/components/post-revisions-panel/style.scss +0 -16
- package/src/components/revision-author-panel/index.js +0 -36
- package/src/components/revision-created-panel/index.js +0 -36
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
|
-
import { useDispatch, useSelect } from '@wordpress/data';
|
|
5
|
+
import { useDispatch, useSelect, useRegistry } from '@wordpress/data';
|
|
6
6
|
import { store as coreDataStore } from '@wordpress/core-data';
|
|
7
7
|
import { DataForm } from '@wordpress/dataviews';
|
|
8
|
-
import {
|
|
8
|
+
import { Stack } from '@wordpress/ui';
|
|
9
9
|
import { useMemo } from '@wordpress/element';
|
|
10
10
|
import { useViewConfig } from '@wordpress/views';
|
|
11
11
|
|
|
@@ -18,22 +18,190 @@ import { store as editorStore } from '../../store';
|
|
|
18
18
|
import PostTrash from '../post-trash';
|
|
19
19
|
import usePostFields from '../post-fields';
|
|
20
20
|
import { usePostTemplatePanelMode } from '../post-template/hooks';
|
|
21
|
+
import revisionsField from '../../dataviews/fields/revisions';
|
|
21
22
|
|
|
22
23
|
const EMPTY_FORM = { layout: { type: 'panel' }, fields: [] };
|
|
24
|
+
const VIEW_CONFIG_FIELDS = [ 'form' ];
|
|
23
25
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
/**
|
|
27
|
+
* Bridges the legacy editor-panel visibility controls onto the DataForm summary,
|
|
28
|
+
* returning the form with the hidden fields removed. The new inspector has no
|
|
29
|
+
* concept of the Preferences → Panels switches or of `removeEditorPanel`, so we
|
|
30
|
+
* reproduce their effect on the form.
|
|
31
|
+
*
|
|
32
|
+
* @param {Object} form The DataForm summary form configuration.
|
|
33
|
+
* @return {Object} The form with the hidden fields removed.
|
|
34
|
+
*/
|
|
35
|
+
function useInspectorPanelVisibility( form ) {
|
|
36
|
+
const {
|
|
37
|
+
isPostStatusRemoved,
|
|
38
|
+
featuredImageEnabled,
|
|
39
|
+
excerptEnabled,
|
|
40
|
+
discussionEnabled,
|
|
41
|
+
pageAttributesEnabled,
|
|
42
|
+
} = useSelect( ( select ) => {
|
|
43
|
+
const { isEditorPanelRemoved, isEditorPanelEnabled } =
|
|
44
|
+
select( editorStore );
|
|
27
45
|
return {
|
|
28
|
-
|
|
29
|
-
|
|
46
|
+
isPostStatusRemoved: isEditorPanelRemoved( 'post-status' ),
|
|
47
|
+
featuredImageEnabled: isEditorPanelEnabled( 'featured-image' ),
|
|
48
|
+
excerptEnabled: isEditorPanelEnabled( 'post-excerpt' ),
|
|
49
|
+
discussionEnabled: isEditorPanelEnabled( 'discussion-panel' ),
|
|
50
|
+
pageAttributesEnabled: isEditorPanelEnabled( 'page-attributes' ),
|
|
30
51
|
};
|
|
31
52
|
}, [] );
|
|
53
|
+
|
|
54
|
+
const visibleForm = useMemo( () => {
|
|
55
|
+
if ( ! form.fields?.length ) {
|
|
56
|
+
return form;
|
|
57
|
+
}
|
|
58
|
+
// `featured_media`/`excerpt` are their own top-level panels and
|
|
59
|
+
// `post-content-info` is always shown, so they survive. Everything else
|
|
60
|
+
// belongs to the `post-status` summary panel: `discussion`/`parent` honor
|
|
61
|
+
// their own switch, but every one of them is hidden while the `post-status`
|
|
62
|
+
// panel is removed.
|
|
63
|
+
const visibilityById = {
|
|
64
|
+
featured_media: featuredImageEnabled,
|
|
65
|
+
excerpt: excerptEnabled,
|
|
66
|
+
'post-content-info': true,
|
|
67
|
+
discussion: discussionEnabled && ! isPostStatusRemoved,
|
|
68
|
+
parent: pageAttributesEnabled && ! isPostStatusRemoved,
|
|
69
|
+
};
|
|
70
|
+
const isFieldVisible = ( id ) =>
|
|
71
|
+
id in visibilityById ? visibilityById[ id ] : ! isPostStatusRemoved;
|
|
72
|
+
// Recurse into `children` so a panel-tied field is dropped wherever it
|
|
73
|
+
// sits in the form: the PHP view-config filter can nest such a field
|
|
74
|
+
// inside another field's group.
|
|
75
|
+
const filterFields = ( fields ) =>
|
|
76
|
+
fields.reduce( ( acc, field ) => {
|
|
77
|
+
const id = typeof field === 'string' ? field : field.id;
|
|
78
|
+
if ( ! isFieldVisible( id ) ) {
|
|
79
|
+
return acc;
|
|
80
|
+
}
|
|
81
|
+
if (
|
|
82
|
+
typeof field !== 'string' &&
|
|
83
|
+
Array.isArray( field.children )
|
|
84
|
+
) {
|
|
85
|
+
const children = filterFields( field.children );
|
|
86
|
+
// A group whose children were all removed would render as
|
|
87
|
+
// an empty panel, so drop it too.
|
|
88
|
+
if ( ! children.length ) {
|
|
89
|
+
return acc;
|
|
90
|
+
}
|
|
91
|
+
acc.push( { ...field, children } );
|
|
92
|
+
return acc;
|
|
93
|
+
}
|
|
94
|
+
acc.push( field );
|
|
95
|
+
return acc;
|
|
96
|
+
}, [] );
|
|
97
|
+
return { ...form, fields: filterFields( form.fields ) };
|
|
98
|
+
}, [
|
|
99
|
+
form,
|
|
100
|
+
isPostStatusRemoved,
|
|
101
|
+
featuredImageEnabled,
|
|
102
|
+
excerptEnabled,
|
|
103
|
+
discussionEnabled,
|
|
104
|
+
pageAttributesEnabled,
|
|
105
|
+
] );
|
|
106
|
+
|
|
107
|
+
return visibleForm;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// Some post types expose summary fields that edit entities other than the one
|
|
111
|
+
// being edited. Keyed by the post type that needs them, the related records are
|
|
112
|
+
// merged into the form data under a `${ kind }_${ name }` namespace key so that
|
|
113
|
+
// a single DataForm can read and write all of them, and edits to those keys are
|
|
114
|
+
// routed back to their entity.
|
|
115
|
+
//
|
|
116
|
+
// The fields themselves are namespace-agnostic: they read and write a plain
|
|
117
|
+
// record. The `fields` list ties each one to the entity it edits, and this
|
|
118
|
+
// component overrides their `getValue`/`setValue`/`render` to operate on the
|
|
119
|
+
// namespaced record, plus their `isVisible` to only show where that record is
|
|
120
|
+
// present (e.g. the `home`/`index` template summary).
|
|
121
|
+
//
|
|
122
|
+
// Currently only `wp_template` uses this: `posts_per_page` and
|
|
123
|
+
// `default_comment_status` target `root/site`, and `posts_page_title` targets
|
|
124
|
+
// the posts page (the `page` assigned as `page_for_posts`).
|
|
125
|
+
const ENTITIES = {
|
|
126
|
+
wp_template: {
|
|
127
|
+
root_site: {
|
|
128
|
+
kind: 'root',
|
|
129
|
+
name: 'site',
|
|
130
|
+
fields: [ 'posts_per_page', 'default_comment_status' ],
|
|
131
|
+
isVisible: ( item ) =>
|
|
132
|
+
[ 'home', 'index' ].includes( item.slug ?? '' ),
|
|
133
|
+
},
|
|
134
|
+
posttype_page: {
|
|
135
|
+
kind: 'postType',
|
|
136
|
+
name: 'page',
|
|
137
|
+
getId: ( select ) =>
|
|
138
|
+
select( coreDataStore ).getEditedEntityRecord( 'root', 'site' )
|
|
139
|
+
?.page_for_posts,
|
|
140
|
+
fields: [ 'posts_page_title' ],
|
|
141
|
+
isVisible: ( item ) =>
|
|
142
|
+
[ 'home', 'index' ].includes( item.slug ?? '' ),
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
// Rebinds a namespace-agnostic field to the namespaced record it edits. Every
|
|
148
|
+
// field callback that receives the form `item` is redirected to the
|
|
149
|
+
// `item[ namespace ]` sub-record so the field operates on its own entity:
|
|
150
|
+
// `getValue`/`setValue`/`render` here, and the rest indirectly because they all
|
|
151
|
+
// funnel through the (remapped) `getValue` (default `render`, `getValueFormatted`
|
|
152
|
+
// and `isValid` range/`custom` validation). Edits are wrapped back under the
|
|
153
|
+
// namespace key. The caller-supplied `isVisible` encodes entity-specific
|
|
154
|
+
// conditions (e.g. only for `home`/`index` templates); the generic guard
|
|
155
|
+
// `!! item[ namespace ]` ensures the field is hidden when the sub-record
|
|
156
|
+
// hasn't been fetched.
|
|
157
|
+
function bindFieldToNamespace( field, namespace, isVisible = () => true ) {
|
|
158
|
+
const subItem = ( item ) => item?.[ namespace ] ?? {};
|
|
159
|
+
return {
|
|
160
|
+
...field,
|
|
161
|
+
getValue: ( { item } ) =>
|
|
162
|
+
field.getValue
|
|
163
|
+
? field.getValue( { item: subItem( item ) } )
|
|
164
|
+
: subItem( item )[ field.id ],
|
|
165
|
+
setValue: ( { item, value } ) => ( {
|
|
166
|
+
[ namespace ]: field.setValue( { item: subItem( item ), value } ),
|
|
167
|
+
} ),
|
|
168
|
+
render: field.render
|
|
169
|
+
? ( props ) =>
|
|
170
|
+
field.render( { ...props, item: subItem( props.item ) } )
|
|
171
|
+
: undefined,
|
|
172
|
+
isVisible: ( item ) => isVisible( item ) && !! item[ namespace ],
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export default function DataFormPostSummary( { onActionPerformed } ) {
|
|
177
|
+
const { postType, postId, isPostStatusRemoved, availableTemplates } =
|
|
178
|
+
useSelect( ( select ) => {
|
|
179
|
+
const {
|
|
180
|
+
getCurrentPostType,
|
|
181
|
+
getCurrentPostId,
|
|
182
|
+
isEditorPanelRemoved,
|
|
183
|
+
getEditorSettings,
|
|
184
|
+
} = select( editorStore );
|
|
185
|
+
const _availableTemplates = select(
|
|
186
|
+
coreDataStore
|
|
187
|
+
).getCurrentTheme()?.is_block_theme
|
|
188
|
+
? null
|
|
189
|
+
: getEditorSettings().availableTemplates ?? null;
|
|
190
|
+
return {
|
|
191
|
+
postType: getCurrentPostType(),
|
|
192
|
+
postId: getCurrentPostId(),
|
|
193
|
+
isPostStatusRemoved: isEditorPanelRemoved( 'post-status' ),
|
|
194
|
+
availableTemplates: _availableTemplates,
|
|
195
|
+
};
|
|
196
|
+
}, [] );
|
|
32
197
|
const { form: formConfig } = useViewConfig( {
|
|
33
198
|
kind: 'postType',
|
|
34
199
|
name: postType,
|
|
200
|
+
fields: VIEW_CONFIG_FIELDS,
|
|
35
201
|
} );
|
|
36
|
-
|
|
202
|
+
// Bridge the legacy editor-panel visibility (Preferences → Panels and
|
|
203
|
+
// programmatic panel removal) onto the form by dropping hidden fields.
|
|
204
|
+
const form = useInspectorPanelVisibility( formConfig ?? EMPTY_FORM );
|
|
37
205
|
const record = useSelect(
|
|
38
206
|
( select ) => {
|
|
39
207
|
if ( ! postType || ! postId ) {
|
|
@@ -50,33 +218,82 @@ export default function DataFormPostSummary( { onActionPerformed } ) {
|
|
|
50
218
|
|
|
51
219
|
const templatePanelMode = usePostTemplatePanelMode();
|
|
52
220
|
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
return (
|
|
58
|
-
select( editorStore ).getEditorSettings().availableTemplates ?? {}
|
|
59
|
-
);
|
|
60
|
-
}, [] );
|
|
221
|
+
const entityRecords = useSelect(
|
|
222
|
+
( select ) => {
|
|
223
|
+
const { getEditedEntityRecord, canUser } = select( coreDataStore );
|
|
61
224
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
225
|
+
const records = {};
|
|
226
|
+
|
|
227
|
+
// Other entities the current post type needs merged into its form.
|
|
228
|
+
for ( const [ namespace, entity ] of Object.entries(
|
|
229
|
+
ENTITIES[ postType ] ?? {}
|
|
230
|
+
) ) {
|
|
231
|
+
if (
|
|
232
|
+
! canUser( 'read', {
|
|
233
|
+
kind: entity.kind,
|
|
234
|
+
name: entity.name,
|
|
235
|
+
} )
|
|
236
|
+
) {
|
|
237
|
+
continue;
|
|
238
|
+
}
|
|
239
|
+
const id = entity.getId ? entity.getId( select ) : undefined;
|
|
240
|
+
// Entities resolved through another record need a valid id.
|
|
241
|
+
if ( entity.getId && ! id ) {
|
|
242
|
+
continue;
|
|
243
|
+
}
|
|
244
|
+
records[ namespace ] = getEditedEntityRecord(
|
|
245
|
+
entity.kind,
|
|
246
|
+
entity.name,
|
|
247
|
+
id
|
|
248
|
+
);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
return records;
|
|
252
|
+
},
|
|
253
|
+
[ postType ]
|
|
254
|
+
);
|
|
255
|
+
|
|
256
|
+
// Merge the supplementary data onto the record.
|
|
257
|
+
const data = useMemo( () => {
|
|
258
|
+
if ( ! record ) {
|
|
65
259
|
return record;
|
|
66
260
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
available_templates
|
|
70
|
-
}
|
|
71
|
-
|
|
261
|
+
const extra = { ...entityRecords };
|
|
262
|
+
if ( availableTemplates && Object.keys( availableTemplates ).length ) {
|
|
263
|
+
extra.available_templates = availableTemplates;
|
|
264
|
+
}
|
|
265
|
+
return { ...record, ...extra };
|
|
266
|
+
}, [ record, entityRecords, availableTemplates ] );
|
|
72
267
|
|
|
73
268
|
const { editEntityRecord } = useDispatch( coreDataStore );
|
|
269
|
+
const registry = useRegistry();
|
|
270
|
+
|
|
271
|
+
// Map of namespaced field id to the namespace key its entity is merged under.
|
|
272
|
+
const fieldNamespaces = useMemo( () => {
|
|
273
|
+
const map = {};
|
|
274
|
+
for ( const [ namespace, entity ] of Object.entries(
|
|
275
|
+
ENTITIES[ postType ] ?? {}
|
|
276
|
+
) ) {
|
|
277
|
+
for ( const id of entity.fields ?? [] ) {
|
|
278
|
+
map[ id ] = namespace;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
return map;
|
|
282
|
+
}, [ postType ] );
|
|
74
283
|
|
|
75
284
|
const _fields = usePostFields( { postType } );
|
|
76
285
|
const fields = useMemo(
|
|
77
286
|
() =>
|
|
78
287
|
_fields
|
|
79
288
|
?.map( ( field ) => {
|
|
289
|
+
const namespace = fieldNamespaces[ field.id ];
|
|
290
|
+
if ( namespace ) {
|
|
291
|
+
return bindFieldToNamespace(
|
|
292
|
+
field,
|
|
293
|
+
namespace,
|
|
294
|
+
ENTITIES[ postType ]?.[ namespace ]?.isVisible
|
|
295
|
+
);
|
|
296
|
+
}
|
|
80
297
|
if ( field.id === 'status' ) {
|
|
81
298
|
return {
|
|
82
299
|
...field,
|
|
@@ -107,41 +324,79 @@ export default function DataFormPostSummary( { onActionPerformed } ) {
|
|
|
107
324
|
}
|
|
108
325
|
return field;
|
|
109
326
|
} )
|
|
110
|
-
.filter( Boolean )
|
|
111
|
-
|
|
327
|
+
.filter( Boolean )
|
|
328
|
+
// Editor-only field, injected here rather than registered
|
|
329
|
+
// so it never leaks into the site editor list / quick-edit fields.
|
|
330
|
+
.concat( revisionsField ),
|
|
331
|
+
[
|
|
332
|
+
_fields,
|
|
333
|
+
templatePanelMode,
|
|
334
|
+
availableTemplates,
|
|
335
|
+
fieldNamespaces,
|
|
336
|
+
postType,
|
|
337
|
+
]
|
|
112
338
|
);
|
|
113
339
|
|
|
114
340
|
const onChange = ( edits ) => {
|
|
341
|
+
// Route edits that target another entity (merged in under a namespace)
|
|
342
|
+
// back to that entity; collect the rest for the post being edited.
|
|
343
|
+
const entities = ENTITIES[ postType ] ?? {};
|
|
344
|
+
const baseEdits = {};
|
|
345
|
+
for ( const [ key, value ] of Object.entries( edits ) ) {
|
|
346
|
+
const entity = entities[ key ];
|
|
347
|
+
if ( entity ) {
|
|
348
|
+
// Resolve the id the same way it was resolved to read the
|
|
349
|
+
// record, so the save targets the right entity regardless of
|
|
350
|
+
// its key field (`undefined` for the `root/site` singleton).
|
|
351
|
+
const id = entity.getId
|
|
352
|
+
? entity.getId( registry.select )
|
|
353
|
+
: undefined;
|
|
354
|
+
editEntityRecord( entity.kind, entity.name, id, value );
|
|
355
|
+
} else {
|
|
356
|
+
baseEdits[ key ] = value;
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
if ( ! Object.keys( baseEdits ).length ) {
|
|
361
|
+
return;
|
|
362
|
+
}
|
|
363
|
+
|
|
115
364
|
if (
|
|
116
|
-
|
|
117
|
-
|
|
365
|
+
baseEdits.status &&
|
|
366
|
+
baseEdits.status !== 'future' &&
|
|
118
367
|
record?.status === 'future' &&
|
|
119
368
|
new Date( record.date ) > new Date()
|
|
120
369
|
) {
|
|
121
|
-
|
|
370
|
+
baseEdits.date = null;
|
|
122
371
|
}
|
|
123
|
-
if (
|
|
124
|
-
|
|
372
|
+
if (
|
|
373
|
+
baseEdits.status &&
|
|
374
|
+
baseEdits.status === 'private' &&
|
|
375
|
+
record?.password
|
|
376
|
+
) {
|
|
377
|
+
baseEdits.password = '';
|
|
125
378
|
}
|
|
126
379
|
|
|
127
|
-
editEntityRecord( 'postType', postType, postId,
|
|
380
|
+
editEntityRecord( 'postType', postType, postId, baseEdits );
|
|
128
381
|
};
|
|
129
382
|
return (
|
|
130
383
|
<PostPanelSection className="editor-post-summary">
|
|
131
|
-
<
|
|
384
|
+
<Stack direction="column" gap="lg">
|
|
132
385
|
<PostCardPanel
|
|
133
386
|
postType={ postType }
|
|
134
387
|
postId={ postId }
|
|
135
388
|
onActionPerformed={ onActionPerformed }
|
|
136
389
|
/>
|
|
137
390
|
<DataForm
|
|
138
|
-
data={
|
|
391
|
+
data={ data }
|
|
139
392
|
fields={ fields }
|
|
140
393
|
form={ form }
|
|
141
394
|
onChange={ onChange }
|
|
142
395
|
/>
|
|
143
|
-
|
|
144
|
-
|
|
396
|
+
{ ! isPostStatusRemoved && (
|
|
397
|
+
<PostTrash onActionPerformed={ onActionPerformed } />
|
|
398
|
+
) }
|
|
399
|
+
</Stack>
|
|
145
400
|
</PostPanelSection>
|
|
146
401
|
);
|
|
147
402
|
}
|
|
@@ -27,7 +27,6 @@ import SidebarHeader from './header';
|
|
|
27
27
|
import TemplateActionsPanel from '../template-actions-panel';
|
|
28
28
|
import TemplateContentPanel from '../template-content-panel';
|
|
29
29
|
import TemplatePartContentPanel from '../template-part-content-panel';
|
|
30
|
-
import PostRevisionsPanel from '../post-revisions-panel';
|
|
31
30
|
import RevisionBlockDiffPanel from '../revision-block-diff';
|
|
32
31
|
import useAutoSwitchEditorSidebars from '../provider/use-auto-switch-editor-sidebars';
|
|
33
32
|
import { sidebars } from './constants';
|
|
@@ -96,17 +95,8 @@ const SidebarContent = ( {
|
|
|
96
95
|
<PluginDocumentSettingPanel.Slot />
|
|
97
96
|
<TemplateContentPanel />
|
|
98
97
|
{ window?.__experimentalDataFormInspector &&
|
|
99
|
-
[
|
|
100
|
-
|
|
101
|
-
'page',
|
|
102
|
-
'wp_template',
|
|
103
|
-
'wp_template_part',
|
|
104
|
-
'wp_block',
|
|
105
|
-
].includes( postType ) && (
|
|
106
|
-
<>
|
|
107
|
-
<TemplateActionsPanel />
|
|
108
|
-
<PostRevisionsPanel />
|
|
109
|
-
</>
|
|
98
|
+
[ 'page', 'post' ].includes( postType ) && (
|
|
99
|
+
<TemplateActionsPanel />
|
|
110
100
|
) }
|
|
111
101
|
<TemplatePartContentPanel />
|
|
112
102
|
<PostTransformPanel />
|
|
@@ -14,22 +14,19 @@ import { addQueryArgs } from '@wordpress/url';
|
|
|
14
14
|
*/
|
|
15
15
|
import { store as editorStore } from '../../store';
|
|
16
16
|
import { unlock } from '../../lock-unlock';
|
|
17
|
-
import
|
|
18
|
-
import RevisionCreatedPanel from '../revision-created-panel';
|
|
19
|
-
import { PostContentInformationUI } from '../post-content-information';
|
|
20
|
-
import RevisionFieldsDiffPanel from '../revision-fields-diff';
|
|
17
|
+
import PostRevisionsTimeline from '../post-revisions-timeline';
|
|
21
18
|
import PostPanelSection from '../post-panel-section';
|
|
22
19
|
import PostCardPanel from '../post-card-panel';
|
|
20
|
+
import RevisionFieldsDiffPanel from '../revision-fields-diff';
|
|
23
21
|
|
|
24
22
|
export default function PostRevisionSummary() {
|
|
25
|
-
const { revisionId, postId
|
|
26
|
-
const { getCurrentRevisionId,
|
|
27
|
-
|
|
28
|
-
|
|
23
|
+
const { revisionId, postId } = useSelect( ( select ) => {
|
|
24
|
+
const { getCurrentRevisionId, getCurrentPostId } = unlock(
|
|
25
|
+
select( editorStore )
|
|
26
|
+
);
|
|
29
27
|
return {
|
|
30
|
-
revisionId:
|
|
28
|
+
revisionId: getCurrentRevisionId(),
|
|
31
29
|
postId: getCurrentPostId(),
|
|
32
|
-
postContent: _revisionId && getCurrentRevision()?.content?.raw,
|
|
33
30
|
};
|
|
34
31
|
}, [] );
|
|
35
32
|
if ( ! revisionId ) {
|
|
@@ -40,10 +37,6 @@ export default function PostRevisionSummary() {
|
|
|
40
37
|
<PostPanelSection className="editor-post-summary">
|
|
41
38
|
<VStack spacing={ 4 }>
|
|
42
39
|
<PostCardPanel postId={ postId } hideActions />
|
|
43
|
-
<VStack spacing={ 1 }>
|
|
44
|
-
<PostContentInformationUI postContent={ postContent } />
|
|
45
|
-
<RevisionCreatedPanel />
|
|
46
|
-
</VStack>
|
|
47
40
|
<ExternalLink
|
|
48
41
|
href={ addQueryArgs( 'revision.php', {
|
|
49
42
|
revision: revisionId,
|
|
@@ -51,10 +44,10 @@ export default function PostRevisionSummary() {
|
|
|
51
44
|
>
|
|
52
45
|
{ __( 'Open classic revisions screen' ) }
|
|
53
46
|
</ExternalLink>
|
|
54
|
-
<RevisionAuthorPanel />
|
|
55
47
|
</VStack>
|
|
56
48
|
</PostPanelSection>
|
|
57
49
|
<RevisionFieldsDiffPanel />
|
|
50
|
+
<PostRevisionsTimeline />
|
|
58
51
|
</>
|
|
59
52
|
);
|
|
60
53
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { Stack } from '@wordpress/ui';
|
|
5
5
|
import { useSelect } from '@wordpress/data';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -43,7 +43,9 @@ export default function PostSummary( { onActionPerformed } ) {
|
|
|
43
43
|
);
|
|
44
44
|
if (
|
|
45
45
|
window?.__experimentalDataFormInspector &&
|
|
46
|
-
[ 'page', 'post' ].includes(
|
|
46
|
+
[ 'page', 'post', 'wp_template', 'wp_template_part' ].includes(
|
|
47
|
+
postType
|
|
48
|
+
)
|
|
47
49
|
) {
|
|
48
50
|
return <DataFormPostSummary onActionPerformed={ onActionPerformed } />;
|
|
49
51
|
}
|
|
@@ -73,7 +75,7 @@ function ClassicPostSummary( { onActionPerformed } ) {
|
|
|
73
75
|
<PluginPostStatusInfo.Slot>
|
|
74
76
|
{ ( fills ) => (
|
|
75
77
|
<>
|
|
76
|
-
<
|
|
78
|
+
<Stack direction="column" gap="lg">
|
|
77
79
|
<PostCardPanel
|
|
78
80
|
postType={ postType }
|
|
79
81
|
postId={ postId }
|
|
@@ -81,13 +83,13 @@ function ClassicPostSummary( { onActionPerformed } ) {
|
|
|
81
83
|
/>
|
|
82
84
|
<PostFeaturedImagePanel withPanelBody={ false } />
|
|
83
85
|
<PostExcerptPanel />
|
|
84
|
-
<
|
|
86
|
+
<Stack direction="column" gap="xs">
|
|
85
87
|
<PostContentInformation />
|
|
86
88
|
<PostLastEditedPanel />
|
|
87
|
-
</
|
|
89
|
+
</Stack>
|
|
88
90
|
{ ! isRemovedPostStatusPanel && (
|
|
89
|
-
<
|
|
90
|
-
<
|
|
91
|
+
<Stack direction="column" gap="lg">
|
|
92
|
+
<Stack direction="column" gap="xs">
|
|
91
93
|
<PostStatusPanel />
|
|
92
94
|
<PostSchedulePanel />
|
|
93
95
|
<PostURLPanel />
|
|
@@ -102,13 +104,13 @@ function ClassicPostSummary( { onActionPerformed } ) {
|
|
|
102
104
|
<SiteDiscussion />
|
|
103
105
|
<PostFormatPanel />
|
|
104
106
|
{ fills }
|
|
105
|
-
</
|
|
107
|
+
</Stack>
|
|
106
108
|
<PostTrash
|
|
107
109
|
onActionPerformed={ onActionPerformed }
|
|
108
110
|
/>
|
|
109
|
-
</
|
|
111
|
+
</Stack>
|
|
110
112
|
) }
|
|
111
|
-
</
|
|
113
|
+
</Stack>
|
|
112
114
|
</>
|
|
113
115
|
) }
|
|
114
116
|
</PluginPostStatusInfo.Slot>
|
|
@@ -500,7 +500,7 @@ export const StyleBookPreview = ( {
|
|
|
500
500
|
return { examples: examplesForSinglePageUse };
|
|
501
501
|
}
|
|
502
502
|
|
|
503
|
-
if ( blockVariation ) {
|
|
503
|
+
if ( blockVariation && filteredExamples?.examples?.length ) {
|
|
504
504
|
return {
|
|
505
505
|
examples: applyBlockVariationsToExamples(
|
|
506
506
|
filteredExamples.examples,
|
|
@@ -20,7 +20,6 @@ import { decodeEntities } from '@wordpress/html-entities';
|
|
|
20
20
|
import { ENTER, SPACE } from '@wordpress/keycodes';
|
|
21
21
|
import { store as noticesStore } from '@wordpress/notices';
|
|
22
22
|
import { store as preferencesStore } from '@wordpress/preferences';
|
|
23
|
-
// eslint-disable-next-line @wordpress/use-recommended-components -- `Tooltip` is not yet on the recommended `@wordpress/ui` allow-list; landing as a migration step ahead of the wider rollout.
|
|
24
23
|
import { Tooltip } from '@wordpress/ui';
|
|
25
24
|
|
|
26
25
|
/**
|
|
@@ -1,27 +1,12 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { useSelect } from '@wordpress/data';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* Internal dependencies
|
|
8
3
|
*/
|
|
9
|
-
import { store as editorStore } from '../../store';
|
|
10
4
|
import { usePostTemplatePanelMode } from '../post-template/hooks';
|
|
11
5
|
import BlockThemeContent from './block-theme-content';
|
|
12
6
|
import ClassicThemeContent from './classic-theme-content';
|
|
13
7
|
|
|
14
8
|
export default function TemplateActionsPanel() {
|
|
15
|
-
const postType = useSelect(
|
|
16
|
-
( select ) => select( editorStore ).getCurrentPostType(),
|
|
17
|
-
[]
|
|
18
|
-
);
|
|
19
9
|
const mode = usePostTemplatePanelMode();
|
|
20
|
-
// This check is because the experiment is gated for these post
|
|
21
|
-
// types for now. Later we should use `postType.viewable`.
|
|
22
|
-
if ( ! [ 'page', 'post' ].includes( postType ) ) {
|
|
23
|
-
return null;
|
|
24
|
-
}
|
|
25
10
|
if ( mode === 'classic' ) {
|
|
26
11
|
return <ClassicThemeContent />;
|
|
27
12
|
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import type { Field } from '@wordpress/dataviews';
|
|
5
|
+
import type { BasePost } from '@wordpress/fields';
|
|
6
|
+
import { __ } from '@wordpress/i18n';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Internal dependencies
|
|
10
|
+
*/
|
|
11
|
+
import RevisionsView from './revisions-view';
|
|
12
|
+
|
|
13
|
+
const revisionsField: Field< BasePost > = {
|
|
14
|
+
id: 'revisions',
|
|
15
|
+
label: __( 'Revisions' ),
|
|
16
|
+
readOnly: true,
|
|
17
|
+
enableSorting: false,
|
|
18
|
+
render: RevisionsView,
|
|
19
|
+
isVisible: ( item ) => {
|
|
20
|
+
const revisionsCount =
|
|
21
|
+
item._links?.[ 'version-history' ]?.[ 0 ]?.count ?? 0;
|
|
22
|
+
const lastRevisionId =
|
|
23
|
+
item._links?.[ 'predecessor-version' ]?.[ 0 ]?.id ?? null;
|
|
24
|
+
return !! lastRevisionId && revisionsCount >= 2;
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export default revisionsField;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { Button } from '@wordpress/components';
|
|
5
|
+
import { useDispatch, useSelect } from '@wordpress/data';
|
|
6
|
+
import { _n, sprintf } from '@wordpress/i18n';
|
|
7
|
+
import { addQueryArgs } from '@wordpress/url';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Internal dependencies
|
|
11
|
+
*/
|
|
12
|
+
// @ts-ignore
|
|
13
|
+
import { store as editorStore } from '../../../store';
|
|
14
|
+
import { unlock } from '../../../lock-unlock';
|
|
15
|
+
|
|
16
|
+
export default function RevisionsView() {
|
|
17
|
+
const { lastRevisionId, revisionsCount, disableVisualRevisions } =
|
|
18
|
+
useSelect( ( select ) => {
|
|
19
|
+
const {
|
|
20
|
+
getCurrentPostLastRevisionId,
|
|
21
|
+
getCurrentPostRevisionsCount,
|
|
22
|
+
getEditorSettings,
|
|
23
|
+
// @ts-ignore
|
|
24
|
+
} = select( editorStore );
|
|
25
|
+
return {
|
|
26
|
+
lastRevisionId: getCurrentPostLastRevisionId(),
|
|
27
|
+
revisionsCount: getCurrentPostRevisionsCount(),
|
|
28
|
+
disableVisualRevisions:
|
|
29
|
+
// @ts-ignore
|
|
30
|
+
!! getEditorSettings().disableVisualRevisions,
|
|
31
|
+
};
|
|
32
|
+
}, [] );
|
|
33
|
+
const { setCurrentRevisionId } = unlock( useDispatch( editorStore ) );
|
|
34
|
+
|
|
35
|
+
const buttonProps = disableVisualRevisions
|
|
36
|
+
? {
|
|
37
|
+
href: addQueryArgs( 'revision.php', {
|
|
38
|
+
revision: lastRevisionId,
|
|
39
|
+
} ),
|
|
40
|
+
}
|
|
41
|
+
: { onClick: () => setCurrentRevisionId( lastRevisionId ) };
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<Button
|
|
45
|
+
{ ...buttonProps }
|
|
46
|
+
variant="link"
|
|
47
|
+
text={ String( revisionsCount ) }
|
|
48
|
+
aria-label={ sprintf(
|
|
49
|
+
/* translators: %d: number of revisions. */
|
|
50
|
+
_n(
|
|
51
|
+
'Open revisions screen: %d revision',
|
|
52
|
+
'Open revisions screen: %d revisions',
|
|
53
|
+
revisionsCount
|
|
54
|
+
),
|
|
55
|
+
revisionsCount
|
|
56
|
+
) }
|
|
57
|
+
/>
|
|
58
|
+
);
|
|
59
|
+
}
|