@wordpress/editor 14.40.2-next.v.202602271551.0 → 14.40.2
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 +6 -0
- package/build/components/collab-sidebar/add-comment.cjs +0 -3
- package/build/components/collab-sidebar/add-comment.cjs.map +2 -2
- package/build/components/collab-sidebar/comments.cjs +0 -3
- package/build/components/collab-sidebar/comments.cjs.map +2 -2
- package/build/components/collab-sidebar/index.cjs +7 -4
- package/build/components/collab-sidebar/index.cjs.map +2 -2
- package/build/components/collab-sidebar/utils.cjs +13 -15
- package/build/components/collab-sidebar/utils.cjs.map +2 -2
- package/build/components/collaborators-overlay/avatar-iframe-styles.cjs +141 -0
- package/build/components/collaborators-overlay/avatar-iframe-styles.cjs.map +7 -0
- package/build/components/collaborators-overlay/collaborator-styles.cjs +38 -2
- package/build/components/collaborators-overlay/collaborator-styles.cjs.map +2 -2
- package/build/components/collaborators-overlay/compute-selection.cjs +185 -0
- package/build/components/collaborators-overlay/compute-selection.cjs.map +7 -0
- package/build/components/collaborators-overlay/cursor-dom-utils.cjs +243 -0
- package/build/components/collaborators-overlay/cursor-dom-utils.cjs.map +7 -0
- package/build/components/collaborators-overlay/cursor-registry.cjs +86 -0
- package/build/components/collaborators-overlay/cursor-registry.cjs.map +7 -0
- package/build/components/collaborators-overlay/index.cjs +7 -2
- package/build/components/collaborators-overlay/index.cjs.map +2 -2
- package/build/components/collaborators-overlay/overlay-iframe-styles.cjs +148 -0
- package/build/components/collaborators-overlay/overlay-iframe-styles.cjs.map +7 -0
- package/build/components/collaborators-overlay/overlay.cjs +141 -229
- package/build/components/collaborators-overlay/overlay.cjs.map +3 -3
- package/build/components/collaborators-overlay/timing-utils.cjs +46 -0
- package/build/components/collaborators-overlay/timing-utils.cjs.map +7 -0
- package/build/components/collaborators-overlay/use-block-highlighting.cjs +91 -42
- package/build/components/collaborators-overlay/use-block-highlighting.cjs.map +2 -2
- package/build/components/collaborators-overlay/use-debounced-recompute.cjs +49 -0
- package/build/components/collaborators-overlay/use-debounced-recompute.cjs.map +7 -0
- package/build/components/collaborators-overlay/use-render-cursors.cjs +82 -172
- package/build/components/collaborators-overlay/use-render-cursors.cjs.map +3 -3
- package/build/components/collaborators-presence/avatar/component.cjs +121 -0
- package/build/components/collaborators-presence/avatar/component.cjs.map +7 -0
- package/build/components/collaborators-presence/avatar/index.cjs +37 -0
- package/build/components/collaborators-presence/avatar/index.cjs.map +7 -0
- package/build/components/collaborators-presence/avatar/types.cjs +19 -0
- package/build/components/collaborators-presence/avatar/types.cjs.map +7 -0
- package/build/components/collaborators-presence/avatar/use-image-loading-status.cjs +44 -0
- package/build/components/collaborators-presence/avatar/use-image-loading-status.cjs.map +7 -0
- package/build/components/collaborators-presence/avatar-group/component.cjs +78 -0
- package/build/components/collaborators-presence/avatar-group/component.cjs.map +7 -0
- package/build/components/collaborators-presence/avatar-group/index.cjs +37 -0
- package/build/components/collaborators-presence/avatar-group/index.cjs.map +7 -0
- package/build/components/collaborators-presence/avatar-group/types.cjs +19 -0
- package/build/components/collaborators-presence/avatar-group/types.cjs.map +7 -0
- package/build/components/collaborators-presence/index.cjs +66 -19
- package/build/components/collaborators-presence/index.cjs.map +3 -3
- package/build/components/collaborators-presence/list.cjs +60 -38
- package/build/components/collaborators-presence/list.cjs.map +3 -3
- package/build/components/collaborators-presence/use-collaborator-notifications.cjs +149 -0
- package/build/components/collaborators-presence/use-collaborator-notifications.cjs.map +7 -0
- package/build/components/editor-interface/index.cjs +11 -6
- package/build/components/editor-interface/index.cjs.map +2 -2
- package/build/components/inserter-sidebar/index.cjs +2 -1
- package/build/components/inserter-sidebar/index.cjs.map +2 -2
- package/build/components/more-menu/copy-content-menu-item.cjs +19 -2
- package/build/components/more-menu/copy-content-menu-item.cjs.map +3 -3
- package/build/components/post-last-revision/index.cjs +27 -6
- package/build/components/post-last-revision/index.cjs.map +2 -2
- package/build/components/post-locked-modal/index.cjs +49 -17
- package/build/components/post-locked-modal/index.cjs.map +3 -3
- package/build/components/post-revisions-preview/block-diff.cjs +130 -34
- package/build/components/post-revisions-preview/block-diff.cjs.map +2 -2
- package/build/components/post-revisions-preview/diff-markers.cjs +6 -5
- package/build/components/post-revisions-preview/diff-markers.cjs.map +2 -2
- package/build/components/post-revisions-preview/revisions-canvas.cjs +16 -60
- package/build/components/post-revisions-preview/revisions-canvas.cjs.map +3 -3
- package/build/components/post-revisions-preview/revisions-slider.cjs +102 -39
- package/build/components/post-revisions-preview/revisions-slider.cjs.map +3 -3
- package/build/components/post-text-editor/index.cjs +20 -5
- package/build/components/post-text-editor/index.cjs.map +3 -3
- package/build/components/preferences-modal/index.cjs +36 -4
- package/build/components/preferences-modal/index.cjs.map +2 -2
- package/build/components/provider/disable-non-page-content-blocks.cjs +31 -28
- package/build/components/provider/disable-non-page-content-blocks.cjs.map +3 -3
- package/build/components/provider/index.cjs +17 -5
- package/build/components/provider/index.cjs.map +2 -2
- package/build/components/provider/use-block-editor-settings.cjs +20 -4
- package/build/components/provider/use-block-editor-settings.cjs.map +3 -3
- package/build/components/provider/{use-post-content-blocks.cjs → use-post-content-block-types.cjs} +8 -19
- package/build/components/provider/use-post-content-block-types.cjs.map +7 -0
- package/build/components/provider/use-revision-blocks.cjs +106 -0
- package/build/components/provider/use-revision-blocks.cjs.map +7 -0
- package/build/components/revision-block-diff/index.cjs +61 -0
- package/build/components/revision-block-diff/index.cjs.map +7 -0
- package/build/components/revision-diff-panel/index.cjs +68 -0
- package/build/components/revision-diff-panel/index.cjs.map +7 -0
- package/build/components/revision-fields-diff/index.cjs +96 -0
- package/build/components/revision-fields-diff/index.cjs.map +7 -0
- package/build/components/sidebar/header.cjs +1 -1
- package/build/components/sidebar/header.cjs.map +2 -2
- package/build/components/sidebar/index.cjs +7 -1
- package/build/components/sidebar/index.cjs.map +3 -3
- package/build/components/style-book/index.cjs +4 -3
- package/build/components/style-book/index.cjs.map +2 -2
- package/build/components/sync-connection-error-modal/index.cjs +187 -0
- package/build/components/sync-connection-error-modal/index.cjs.map +7 -0
- package/build/components/sync-connection-error-modal/use-retry-countdown.cjs +84 -0
- package/build/components/sync-connection-error-modal/use-retry-countdown.cjs.map +7 -0
- package/build/components/template-content-panel/index.cjs +35 -31
- package/build/components/template-content-panel/index.cjs.map +3 -3
- package/build/components/template-part-menu-items/convert-to-regular.cjs +54 -11
- package/build/components/template-part-menu-items/convert-to-regular.cjs.map +3 -3
- package/build/components/visual-editor/index.cjs +6 -15
- package/build/components/visual-editor/index.cjs.map +2 -2
- package/build/store/private-actions.cjs +46 -2
- package/build/store/private-actions.cjs.map +2 -2
- package/build/store/private-selectors.cjs +154 -29
- package/build/store/private-selectors.cjs.map +2 -2
- package/build/store/reducer.cjs +27 -0
- package/build/store/reducer.cjs.map +2 -2
- package/build/store/selectors.cjs +0 -14
- package/build/store/selectors.cjs.map +2 -2
- package/build/utils/media-finalize/index.cjs +43 -0
- package/build/utils/media-finalize/index.cjs.map +7 -0
- package/build/utils/media-upload/on-success.cjs +46 -0
- package/build/utils/media-upload/on-success.cjs.map +7 -0
- package/build/utils/sync-error-messages.cjs +32 -15
- package/build/utils/sync-error-messages.cjs.map +3 -3
- package/build-module/components/collab-sidebar/add-comment.mjs +0 -3
- package/build-module/components/collab-sidebar/add-comment.mjs.map +2 -2
- package/build-module/components/collab-sidebar/comments.mjs +0 -3
- package/build-module/components/collab-sidebar/comments.mjs.map +2 -2
- package/build-module/components/collab-sidebar/index.mjs +7 -4
- package/build-module/components/collab-sidebar/index.mjs.map +2 -2
- package/build-module/components/collab-sidebar/utils.mjs +13 -15
- package/build-module/components/collab-sidebar/utils.mjs.map +2 -2
- package/build-module/components/collaborators-overlay/avatar-iframe-styles.mjs +128 -0
- package/build-module/components/collaborators-overlay/avatar-iframe-styles.mjs.map +7 -0
- package/build-module/components/collaborators-overlay/collaborator-styles.mjs +25 -1
- package/build-module/components/collaborators-overlay/collaborator-styles.mjs.map +2 -2
- package/build-module/components/collaborators-overlay/compute-selection.mjs +166 -0
- package/build-module/components/collaborators-overlay/compute-selection.mjs.map +7 -0
- package/build-module/components/collaborators-overlay/cursor-dom-utils.mjs +213 -0
- package/build-module/components/collaborators-overlay/cursor-dom-utils.mjs.map +7 -0
- package/build-module/components/collaborators-overlay/cursor-registry.mjs +61 -0
- package/build-module/components/collaborators-overlay/cursor-registry.mjs.map +7 -0
- package/build-module/components/collaborators-overlay/index.mjs +7 -2
- package/build-module/components/collaborators-overlay/index.mjs.map +2 -2
- package/build-module/components/collaborators-overlay/overlay-iframe-styles.mjs +130 -0
- package/build-module/components/collaborators-overlay/overlay-iframe-styles.mjs.map +7 -0
- package/build-module/components/collaborators-overlay/overlay.mjs +132 -230
- package/build-module/components/collaborators-overlay/overlay.mjs.map +2 -2
- package/build-module/components/collaborators-overlay/timing-utils.mjs +21 -0
- package/build-module/components/collaborators-overlay/timing-utils.mjs.map +7 -0
- package/build-module/components/collaborators-overlay/use-block-highlighting.mjs +93 -45
- package/build-module/components/collaborators-overlay/use-block-highlighting.mjs.map +2 -2
- package/build-module/components/collaborators-overlay/use-debounced-recompute.mjs +24 -0
- package/build-module/components/collaborators-overlay/use-debounced-recompute.mjs.map +7 -0
- package/build-module/components/collaborators-overlay/use-render-cursors.mjs +83 -176
- package/build-module/components/collaborators-overlay/use-render-cursors.mjs.map +2 -2
- package/build-module/components/collaborators-presence/avatar/component.mjs +90 -0
- package/build-module/components/collaborators-presence/avatar/component.mjs.map +7 -0
- package/build-module/components/collaborators-presence/avatar/index.mjs +6 -0
- package/build-module/components/collaborators-presence/avatar/index.mjs.map +7 -0
- package/build-module/components/collaborators-presence/avatar/types.mjs +1 -0
- package/build-module/components/collaborators-presence/avatar/types.mjs.map +7 -0
- package/build-module/components/collaborators-presence/avatar/use-image-loading-status.mjs +19 -0
- package/build-module/components/collaborators-presence/avatar/use-image-loading-status.mjs.map +7 -0
- package/build-module/components/collaborators-presence/avatar-group/component.mjs +47 -0
- package/build-module/components/collaborators-presence/avatar-group/component.mjs.map +7 -0
- package/build-module/components/collaborators-presence/avatar-group/index.mjs +6 -0
- package/build-module/components/collaborators-presence/avatar-group/index.mjs.map +7 -0
- package/build-module/components/collaborators-presence/avatar-group/types.mjs +1 -0
- package/build-module/components/collaborators-presence/avatar-group/types.mjs.map +7 -0
- package/build-module/components/collaborators-presence/index.mjs +57 -23
- package/build-module/components/collaborators-presence/index.mjs.map +2 -2
- package/build-module/components/collaborators-presence/list.mjs +52 -44
- package/build-module/components/collaborators-presence/list.mjs.map +2 -2
- package/build-module/components/collaborators-presence/use-collaborator-notifications.mjs +126 -0
- package/build-module/components/collaborators-presence/use-collaborator-notifications.mjs.map +7 -0
- package/build-module/components/editor-interface/index.mjs +12 -7
- package/build-module/components/editor-interface/index.mjs.map +2 -2
- package/build-module/components/inserter-sidebar/index.mjs +2 -1
- package/build-module/components/inserter-sidebar/index.mjs.map +2 -2
- package/build-module/components/more-menu/copy-content-menu-item.mjs +19 -2
- package/build-module/components/more-menu/copy-content-menu-item.mjs.map +2 -2
- package/build-module/components/post-last-revision/index.mjs +27 -6
- package/build-module/components/post-last-revision/index.mjs.map +2 -2
- package/build-module/components/post-locked-modal/index.mjs +49 -17
- package/build-module/components/post-locked-modal/index.mjs.map +2 -2
- package/build-module/components/post-revisions-preview/block-diff.mjs +130 -34
- package/build-module/components/post-revisions-preview/block-diff.mjs.map +2 -2
- package/build-module/components/post-revisions-preview/diff-markers.mjs +6 -5
- package/build-module/components/post-revisions-preview/diff-markers.mjs.map +2 -2
- package/build-module/components/post-revisions-preview/revisions-canvas.mjs +18 -65
- package/build-module/components/post-revisions-preview/revisions-canvas.mjs.map +2 -2
- package/build-module/components/post-revisions-preview/revisions-slider.mjs +110 -42
- package/build-module/components/post-revisions-preview/revisions-slider.mjs.map +2 -2
- package/build-module/components/post-text-editor/index.mjs +20 -5
- package/build-module/components/post-text-editor/index.mjs.map +2 -2
- package/build-module/components/preferences-modal/index.mjs +36 -4
- package/build-module/components/preferences-modal/index.mjs.map +2 -2
- package/build-module/components/provider/disable-non-page-content-blocks.mjs +31 -28
- package/build-module/components/provider/disable-non-page-content-blocks.mjs.map +2 -2
- package/build-module/components/provider/index.mjs +17 -5
- package/build-module/components/provider/index.mjs.map +2 -2
- package/build-module/components/provider/use-block-editor-settings.mjs +20 -4
- package/build-module/components/provider/use-block-editor-settings.mjs.map +2 -2
- package/build-module/components/provider/use-post-content-block-types.mjs +23 -0
- package/build-module/components/provider/use-post-content-block-types.mjs.map +7 -0
- package/build-module/components/provider/use-revision-blocks.mjs +81 -0
- package/build-module/components/provider/use-revision-blocks.mjs.map +7 -0
- package/build-module/components/revision-block-diff/index.mjs +30 -0
- package/build-module/components/revision-block-diff/index.mjs.map +7 -0
- package/build-module/components/revision-diff-panel/index.mjs +37 -0
- package/build-module/components/revision-diff-panel/index.mjs.map +7 -0
- package/build-module/components/revision-fields-diff/index.mjs +65 -0
- package/build-module/components/revision-fields-diff/index.mjs.map +7 -0
- package/build-module/components/sidebar/header.mjs +1 -1
- package/build-module/components/sidebar/header.mjs.map +2 -2
- package/build-module/components/sidebar/index.mjs +7 -1
- package/build-module/components/sidebar/index.mjs.map +2 -2
- package/build-module/components/style-book/index.mjs +4 -3
- package/build-module/components/style-book/index.mjs.map +2 -2
- package/build-module/components/sync-connection-error-modal/index.mjs +170 -0
- package/build-module/components/sync-connection-error-modal/index.mjs.map +7 -0
- package/build-module/components/sync-connection-error-modal/use-retry-countdown.mjs +59 -0
- package/build-module/components/sync-connection-error-modal/use-retry-countdown.mjs.map +7 -0
- package/build-module/components/template-content-panel/index.mjs +25 -31
- package/build-module/components/template-content-panel/index.mjs.map +2 -2
- package/build-module/components/template-part-menu-items/convert-to-regular.mjs +60 -14
- package/build-module/components/template-part-menu-items/convert-to-regular.mjs.map +2 -2
- package/build-module/components/visual-editor/index.mjs +6 -15
- package/build-module/components/visual-editor/index.mjs.map +2 -2
- package/build-module/store/private-actions.mjs +44 -2
- package/build-module/store/private-actions.mjs.map +2 -2
- package/build-module/store/private-selectors.mjs +153 -29
- package/build-module/store/private-selectors.mjs.map +2 -2
- package/build-module/store/reducer.mjs +25 -0
- package/build-module/store/reducer.mjs.map +2 -2
- package/build-module/store/selectors.mjs +0 -13
- package/build-module/store/selectors.mjs.map +2 -2
- package/build-module/utils/media-finalize/index.mjs +12 -0
- package/build-module/utils/media-finalize/index.mjs.map +7 -0
- package/build-module/utils/media-upload/on-success.mjs +25 -0
- package/build-module/utils/media-upload/on-success.mjs.map +7 -0
- package/build-module/utils/sync-error-messages.mjs +27 -15
- package/build-module/utils/sync-error-messages.mjs.map +3 -3
- package/build-style/style-rtl.css +296 -121
- package/build-style/style.css +296 -121
- package/build-types/components/autocompleters/link.d.ts +8 -0
- package/build-types/components/autocompleters/link.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/add-comment.d.ts.map +1 -1
- package/build-types/components/collab-sidebar/add-note-menu-item.d.ts +5 -0
- package/build-types/components/collab-sidebar/add-note-menu-item.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/add-note.d.ts +6 -0
- package/build-types/components/collab-sidebar/add-note.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/board-store.d.ts +9 -0
- package/build-types/components/collab-sidebar/board-store.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/floating-container.d.ts +8 -0
- package/build-types/components/collab-sidebar/floating-container.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/index.d.ts.map +1 -1
- package/build-types/components/collab-sidebar/note-byline.d.ts +10 -0
- package/build-types/components/collab-sidebar/note-byline.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/note-card.d.ts +8 -0
- package/build-types/components/collab-sidebar/note-card.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/note-form.d.ts +7 -0
- package/build-types/components/collab-sidebar/note-form.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/note-indicator-toolbar.d.ts +5 -0
- package/build-types/components/collab-sidebar/note-indicator-toolbar.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/note-thread.d.ts +11 -0
- package/build-types/components/collab-sidebar/note-thread.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/note.d.ts +9 -0
- package/build-types/components/collab-sidebar/note.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/notes.d.ts +7 -0
- package/build-types/components/collab-sidebar/notes.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/utils.d.ts.map +1 -1
- package/build-types/components/collaborators-overlay/avatar-iframe-styles.d.ts +11 -0
- package/build-types/components/collaborators-overlay/avatar-iframe-styles.d.ts.map +1 -0
- package/build-types/components/collaborators-overlay/collaborator-styles.d.ts +17 -2
- package/build-types/components/collaborators-overlay/collaborator-styles.d.ts.map +1 -1
- package/build-types/components/collaborators-overlay/compute-selection.d.ts +24 -0
- package/build-types/components/collaborators-overlay/compute-selection.d.ts.map +1 -0
- package/build-types/components/collaborators-overlay/cursor-dom-utils.d.ts +72 -0
- package/build-types/components/collaborators-overlay/cursor-dom-utils.d.ts.map +1 -0
- package/build-types/components/collaborators-overlay/cursor-registry.d.ts +36 -0
- package/build-types/components/collaborators-overlay/cursor-registry.d.ts.map +1 -0
- package/build-types/components/collaborators-overlay/index.d.ts +7 -4
- package/build-types/components/collaborators-overlay/index.d.ts.map +1 -1
- package/build-types/components/collaborators-overlay/overlay-iframe-styles.d.ts +6 -0
- package/build-types/components/collaborators-overlay/overlay-iframe-styles.d.ts.map +1 -0
- package/build-types/components/collaborators-overlay/overlay.d.ts +4 -1
- package/build-types/components/collaborators-overlay/overlay.d.ts.map +1 -1
- package/build-types/components/collaborators-overlay/timing-utils.d.ts +11 -0
- package/build-types/components/collaborators-overlay/timing-utils.d.ts.map +1 -0
- package/build-types/components/collaborators-overlay/use-block-highlighting.d.ts +21 -5
- package/build-types/components/collaborators-overlay/use-block-highlighting.d.ts.map +1 -1
- package/build-types/components/collaborators-overlay/use-debounced-recompute.d.ts +10 -0
- package/build-types/components/collaborators-overlay/use-debounced-recompute.d.ts.map +1 -0
- package/build-types/components/collaborators-overlay/use-render-cursors.d.ts +6 -1
- package/build-types/components/collaborators-overlay/use-render-cursors.d.ts.map +1 -1
- package/build-types/components/collaborators-presence/avatar/component.d.ts +7 -0
- package/build-types/components/collaborators-presence/avatar/component.d.ts.map +1 -0
- package/build-types/components/collaborators-presence/avatar/index.d.ts +3 -0
- package/build-types/components/collaborators-presence/avatar/index.d.ts.map +1 -0
- package/build-types/components/collaborators-presence/avatar/types.d.ts +66 -0
- package/build-types/components/collaborators-presence/avatar/types.d.ts.map +1 -0
- package/build-types/components/collaborators-presence/avatar/use-image-loading-status.d.ts +17 -0
- package/build-types/components/collaborators-presence/avatar/use-image-loading-status.d.ts.map +1 -0
- package/build-types/components/collaborators-presence/avatar-group/component.d.ts +7 -0
- package/build-types/components/collaborators-presence/avatar-group/component.d.ts.map +1 -0
- package/build-types/components/collaborators-presence/avatar-group/index.d.ts +3 -0
- package/build-types/components/collaborators-presence/avatar-group/index.d.ts.map +1 -0
- package/build-types/components/collaborators-presence/avatar-group/types.d.ts +14 -0
- package/build-types/components/collaborators-presence/avatar-group/types.d.ts.map +1 -0
- package/build-types/components/collaborators-presence/index.d.ts.map +1 -1
- package/build-types/components/collaborators-presence/list.d.ts +6 -2
- package/build-types/components/collaborators-presence/list.d.ts.map +1 -1
- package/build-types/components/collaborators-presence/use-collaborator-notifications.d.ts +9 -0
- package/build-types/components/collaborators-presence/use-collaborator-notifications.d.ts.map +1 -0
- package/build-types/components/editor-interface/index.d.ts.map +1 -1
- package/build-types/components/inserter-sidebar/index.d.ts.map +1 -1
- package/build-types/components/media/media-editor-modal.d.ts +15 -0
- package/build-types/components/media/media-editor-modal.d.ts.map +1 -0
- package/build-types/components/more-menu/copy-content-menu-item.d.ts.map +1 -1
- package/build-types/components/post-last-revision/index.d.ts.map +1 -1
- package/build-types/components/post-locked-modal/index.d.ts.map +1 -1
- package/build-types/components/post-revisions-panel/index.d.ts +2 -0
- package/build-types/components/post-revisions-panel/index.d.ts.map +1 -0
- package/build-types/components/post-revisions-preview/block-diff.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-preview/revisions-canvas.d.ts +2 -5
- package/build-types/components/post-revisions-preview/revisions-canvas.d.ts.map +1 -1
- package/build-types/components/post-revisions-preview/revisions-slider.d.ts +1 -1
- package/build-types/components/post-revisions-preview/revisions-slider.d.ts.map +1 -1
- package/build-types/components/post-text-editor/index.d.ts.map +1 -1
- package/build-types/components/post-text-editor/utils.d.ts +29 -0
- package/build-types/components/post-text-editor/utils.d.ts.map +1 -0
- 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/use-block-editor-settings.d.ts.map +1 -1
- package/build-types/components/provider/use-network-reconnect.d.ts +8 -0
- package/build-types/components/provider/use-network-reconnect.d.ts.map +1 -0
- package/build-types/components/provider/use-post-content-block-types.d.ts +9 -0
- package/build-types/components/provider/use-post-content-block-types.d.ts.map +1 -0
- package/build-types/components/provider/use-revision-blocks.d.ts +10 -0
- package/build-types/components/provider/use-revision-blocks.d.ts.map +1 -0
- package/build-types/components/revision-block-diff/index.d.ts +6 -0
- package/build-types/components/revision-block-diff/index.d.ts.map +1 -0
- package/build-types/components/revision-diff-panel/index.d.ts +14 -0
- package/build-types/components/revision-diff-panel/index.d.ts.map +1 -0
- package/build-types/components/revision-fields-diff/index.d.ts +6 -0
- package/build-types/components/revision-fields-diff/index.d.ts.map +1 -0
- package/build-types/components/sidebar/dataform-post-summary.d.ts +4 -0
- package/build-types/components/sidebar/dataform-post-summary.d.ts.map +1 -0
- package/build-types/components/sidebar/index.d.ts.map +1 -1
- package/build-types/components/sidebar/post-revision-summary.d.ts +2 -0
- package/build-types/components/sidebar/post-revision-summary.d.ts.map +1 -0
- package/build-types/components/style-book/index.d.ts +2 -1
- package/build-types/components/style-book/index.d.ts.map +1 -1
- package/build-types/components/sync-connection-error-modal/index.d.ts +8 -0
- package/build-types/components/sync-connection-error-modal/index.d.ts.map +1 -0
- package/build-types/components/sync-connection-error-modal/use-retry-countdown.d.ts +11 -0
- package/build-types/components/sync-connection-error-modal/use-retry-countdown.d.ts.map +1 -0
- package/build-types/components/template-actions-panel/block-theme-content.d.ts +2 -0
- package/build-types/components/template-actions-panel/block-theme-content.d.ts.map +1 -0
- package/build-types/components/template-actions-panel/classic-theme-content.d.ts +2 -0
- package/build-types/components/template-actions-panel/classic-theme-content.d.ts.map +1 -0
- package/build-types/components/template-actions-panel/index.d.ts +2 -0
- package/build-types/components/template-actions-panel/index.d.ts.map +1 -0
- package/build-types/components/template-content-panel/index.d.ts.map +1 -1
- package/build-types/components/template-part-menu-items/convert-to-regular.d.ts.map +1 -1
- package/build-types/components/upload-progress-snackbar/index.d.ts +19 -0
- package/build-types/components/upload-progress-snackbar/index.d.ts.map +1 -0
- package/build-types/components/upload-progress-snackbar/stories/index.story.d.ts +28 -0
- package/build-types/components/upload-progress-snackbar/stories/index.story.d.ts.map +1 -0
- package/build-types/components/upload-progress-snackbar/tracker.d.ts +41 -0
- package/build-types/components/upload-progress-snackbar/tracker.d.ts.map +1 -0
- package/build-types/components/visual-editor/index.d.ts.map +1 -1
- package/build-types/store/private-actions.d.ts +12 -0
- package/build-types/store/private-actions.d.ts.map +1 -1
- package/build-types/store/private-selectors.d.ts +45 -0
- package/build-types/store/private-selectors.d.ts.map +1 -1
- package/build-types/store/reducer.d.ts +21 -0
- package/build-types/store/reducer.d.ts.map +1 -1
- package/build-types/store/selectors.d.ts +0 -10
- package/build-types/store/selectors.d.ts.map +1 -1
- package/build-types/utils/media-delete/index.d.ts +2 -0
- package/build-types/utils/media-delete/index.d.ts.map +1 -0
- package/build-types/utils/media-finalize/index.d.ts +2 -0
- package/build-types/utils/media-finalize/index.d.ts.map +1 -0
- package/build-types/utils/media-upload/on-success.d.ts +9 -0
- package/build-types/utils/media-upload/on-success.d.ts.map +1 -0
- package/build-types/utils/sync-error-messages.d.ts +17 -3
- package/build-types/utils/sync-error-messages.d.ts.map +1 -1
- package/package.json +45 -44
- package/src/components/collab-sidebar/add-comment.js +0 -4
- package/src/components/collab-sidebar/comments.js +0 -5
- package/src/components/collab-sidebar/index.js +7 -4
- package/src/components/collab-sidebar/utils.js +9 -10
- package/src/components/collaborators-overlay/avatar-iframe-styles.ts +134 -0
- package/src/components/collaborators-overlay/collaborator-styles.ts +43 -2
- package/src/components/collaborators-overlay/compute-selection.ts +315 -0
- package/src/components/collaborators-overlay/cursor-dom-utils.ts +382 -0
- package/src/components/collaborators-overlay/cursor-registry.ts +96 -0
- package/src/components/collaborators-overlay/index.tsx +12 -4
- package/src/components/collaborators-overlay/overlay-iframe-styles.ts +131 -0
- package/src/components/collaborators-overlay/overlay.tsx +145 -223
- package/src/components/collaborators-overlay/timing-utils.ts +30 -0
- package/src/components/collaborators-overlay/use-block-highlighting.ts +152 -64
- package/src/components/collaborators-overlay/use-debounced-recompute.ts +32 -0
- package/src/components/collaborators-overlay/use-render-cursors.ts +120 -282
- package/src/components/collaborators-presence/avatar/component.tsx +123 -0
- package/src/components/collaborators-presence/avatar/index.ts +2 -0
- package/src/components/collaborators-presence/avatar/styles.scss +184 -0
- package/src/components/collaborators-presence/avatar/test/index.tsx +389 -0
- package/src/components/collaborators-presence/avatar/types.ts +66 -0
- package/src/components/collaborators-presence/avatar/use-image-loading-status.ts +36 -0
- package/src/components/collaborators-presence/avatar-group/component.tsx +55 -0
- package/src/components/collaborators-presence/avatar-group/index.ts +2 -0
- package/src/components/collaborators-presence/avatar-group/styles.scss +33 -0
- package/src/components/collaborators-presence/avatar-group/test/index.tsx +139 -0
- package/src/components/collaborators-presence/avatar-group/types.ts +13 -0
- package/src/components/collaborators-presence/index.tsx +43 -12
- package/src/components/collaborators-presence/list.tsx +68 -40
- package/src/components/collaborators-presence/styles/collaborators-list.scss +26 -19
- package/src/components/collaborators-presence/styles/collaborators-presence.scss +6 -2
- package/src/components/collaborators-presence/test/use-collaborator-notifications.ts +397 -0
- package/src/components/collaborators-presence/use-collaborator-notifications.ts +203 -0
- package/src/components/document-bar/style.scss +1 -1
- package/src/components/editor-interface/index.js +13 -6
- package/src/components/inserter-sidebar/index.js +4 -1
- package/src/components/more-menu/copy-content-menu-item.js +20 -2
- package/src/components/post-last-revision/index.js +35 -6
- package/src/components/post-last-revision/style.scss +0 -3
- package/src/components/post-locked-modal/index.js +69 -25
- package/src/components/post-panel-row/style.scss +1 -0
- package/src/components/post-revisions-preview/block-diff.js +224 -61
- package/src/components/post-revisions-preview/diff-markers.js +15 -12
- package/src/components/post-revisions-preview/revisions-canvas.js +23 -86
- package/src/components/post-revisions-preview/revisions-slider.js +136 -63
- package/src/components/post-revisions-preview/style.scss +3 -3
- package/src/components/post-revisions-preview/test/block-diff.js +202 -35
- package/src/components/post-text-editor/index.js +25 -6
- package/src/components/preferences-modal/index.js +37 -7
- package/src/components/provider/disable-non-page-content-blocks.js +42 -40
- package/src/components/provider/index.js +20 -2
- package/src/components/provider/use-block-editor-settings.js +21 -1
- package/src/components/provider/use-post-content-block-types.js +30 -0
- package/src/components/provider/use-revision-blocks.js +105 -0
- package/src/components/revision-block-diff/index.js +39 -0
- package/src/components/revision-diff-panel/index.js +59 -0
- package/src/components/revision-diff-panel/style.scss +13 -0
- package/src/components/revision-fields-diff/index.js +91 -0
- package/src/components/sidebar/header.js +1 -1
- package/src/components/sidebar/index.js +4 -0
- package/src/components/style-book/index.js +4 -2
- package/src/components/sync-connection-error-modal/index.tsx +253 -0
- package/src/components/sync-connection-error-modal/style.scss +14 -0
- package/src/components/sync-connection-error-modal/use-retry-countdown.ts +93 -0
- package/src/components/template-content-panel/index.js +30 -38
- package/src/components/template-part-menu-items/convert-to-regular.js +74 -12
- package/src/components/visual-editor/index.js +6 -23
- package/src/store/private-actions.js +70 -1
- package/src/store/private-selectors.js +215 -37
- package/src/store/reducer.js +41 -0
- package/src/store/selectors.js +0 -19
- package/src/style.scss +4 -1
- package/src/utils/media-finalize/index.js +11 -0
- package/src/utils/media-finalize/test/index.js +34 -0
- package/src/utils/media-upload/on-success.js +34 -0
- package/src/utils/sync-error-messages.ts +72 -0
- package/src/utils/test/sync-error-messages.js +34 -0
- package/build/components/provider/use-post-content-blocks.cjs.map +0 -7
- package/build/components/sync-connection-modal/index.cjs +0 -130
- package/build/components/sync-connection-modal/index.cjs.map +0 -7
- package/build-module/components/provider/use-post-content-blocks.mjs +0 -34
- package/build-module/components/provider/use-post-content-blocks.mjs.map +0 -7
- package/build-module/components/sync-connection-modal/index.mjs +0 -114
- package/build-module/components/sync-connection-modal/index.mjs.map +0 -7
- package/build-types/components/provider/use-post-content-blocks.d.ts +0 -2
- package/build-types/components/provider/use-post-content-blocks.d.ts.map +0 -1
- package/build-types/components/sync-connection-modal/index.d.ts +0 -8
- package/build-types/components/sync-connection-modal/index.d.ts.map +0 -1
- package/src/components/provider/use-post-content-blocks.js +0 -42
- package/src/components/sync-connection-modal/index.js +0 -140
- package/src/components/sync-connection-modal/style.scss +0 -11
- package/src/utils/sync-error-messages.js +0 -53
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
store as blockEditorStore,
|
|
16
16
|
} from '@wordpress/block-editor';
|
|
17
17
|
import { __ } from '@wordpress/i18n';
|
|
18
|
+
import { Tooltip } from '@wordpress/components';
|
|
18
19
|
|
|
19
20
|
/**
|
|
20
21
|
* Internal dependencies
|
|
@@ -32,10 +33,10 @@ const { useBlockElementRef } = unlock( blockEditorPrivateApis );
|
|
|
32
33
|
function collectDiffBlocks( blocks ) {
|
|
33
34
|
const result = [];
|
|
34
35
|
for ( const block of blocks ) {
|
|
35
|
-
if ( block.__revisionDiffStatus ) {
|
|
36
|
+
if ( block.__revisionDiffStatus?.status ) {
|
|
36
37
|
result.push( {
|
|
37
38
|
clientId: block.clientId,
|
|
38
|
-
status: block.__revisionDiffStatus,
|
|
39
|
+
status: block.__revisionDiffStatus.status,
|
|
39
40
|
} );
|
|
40
41
|
}
|
|
41
42
|
if ( block.innerBlocks?.length ) {
|
|
@@ -97,15 +98,17 @@ function DiffMarkerButton( { clientId, status, subscribe } ) {
|
|
|
97
98
|
}
|
|
98
99
|
|
|
99
100
|
return (
|
|
100
|
-
<
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
101
|
+
<Tooltip text={ STATUS_LABELS[ status ] }>
|
|
102
|
+
<button
|
|
103
|
+
className={ `revision-diff-marker is-${ status }` }
|
|
104
|
+
style={ {
|
|
105
|
+
top: `${ position.top }%`,
|
|
106
|
+
height: `${ Math.max( position.height, 0.5 ) }%`,
|
|
107
|
+
} }
|
|
108
|
+
onClick={ () => blockRef.current?.focus() }
|
|
109
|
+
aria-label={ STATUS_LABELS[ status ] }
|
|
110
|
+
/>
|
|
111
|
+
</Tooltip>
|
|
109
112
|
);
|
|
110
113
|
}
|
|
111
114
|
|
|
@@ -145,7 +148,7 @@ export function useDiffMarkers() {
|
|
|
145
148
|
key="diff-markers"
|
|
146
149
|
className="revision-diff-markers"
|
|
147
150
|
role="navigation"
|
|
148
|
-
aria-label={ __( '
|
|
151
|
+
aria-label={ __( 'Document changes' ) }
|
|
149
152
|
>
|
|
150
153
|
{ isMounted &&
|
|
151
154
|
diffBlocks.map( ( { clientId, status } ) => (
|
|
@@ -7,13 +7,9 @@ import clsx from 'clsx';
|
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
9
|
import { Spinner } from '@wordpress/components';
|
|
10
|
-
import {
|
|
11
|
-
privateApis as blockEditorPrivateApis,
|
|
12
|
-
store as blockEditorStore,
|
|
13
|
-
} from '@wordpress/block-editor';
|
|
14
|
-
import { createBlock, parse } from '@wordpress/blocks';
|
|
10
|
+
import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
15
11
|
import { useSelect } from '@wordpress/data';
|
|
16
|
-
import { useEffect
|
|
12
|
+
import { useEffect } from '@wordpress/element';
|
|
17
13
|
import { addFilter } from '@wordpress/hooks';
|
|
18
14
|
|
|
19
15
|
/**
|
|
@@ -27,12 +23,8 @@ import {
|
|
|
27
23
|
unregisterDiffFormatTypes,
|
|
28
24
|
} from './diff-format-types';
|
|
29
25
|
import { useDiffMarkers } from './diff-markers';
|
|
30
|
-
import { preserveClientIds } from './preserve-client-ids';
|
|
31
|
-
import { diffRevisionContent } from './block-diff';
|
|
32
26
|
|
|
33
|
-
const {
|
|
34
|
-
blockEditorPrivateApis
|
|
35
|
-
);
|
|
27
|
+
const { usePrivateStyleOverride } = unlock( blockEditorPrivateApis );
|
|
36
28
|
|
|
37
29
|
// SVG filter for removed blocks: grayscale + red tint
|
|
38
30
|
const REVISION_REMOVED_FILTER_SVG = `
|
|
@@ -66,14 +58,20 @@ const REVISION_REMOVED_FILTER_SVG = `
|
|
|
66
58
|
const REVISION_DIFF_STYLES = `
|
|
67
59
|
.is-revision-added {
|
|
68
60
|
box-shadow: inset 0 0 0 9999px color-mix(in srgb, currentColor 5%, #00a32a 15%), 0 0 0 4px color-mix(in srgb, currentColor 5%, #00a32a 15%);
|
|
61
|
+
outline: 3px solid #00a32a;
|
|
62
|
+
outline-offset: 2px;
|
|
69
63
|
}
|
|
70
64
|
.is-revision-removed,
|
|
71
65
|
.revision-diff-removed {
|
|
72
66
|
text-decoration: line-through;
|
|
73
67
|
filter: url(#revision-removed-filter);
|
|
74
68
|
}
|
|
69
|
+
.is-revision-removed {
|
|
70
|
+
outline: 3px dashed #d63638;
|
|
71
|
+
outline-offset: 2px;
|
|
72
|
+
}
|
|
75
73
|
.is-revision-modified {
|
|
76
|
-
outline:
|
|
74
|
+
outline: 3px dotted #9a7000 !important;
|
|
77
75
|
outline-offset: 2px;
|
|
78
76
|
}
|
|
79
77
|
.revision-diff-added {
|
|
@@ -103,7 +101,7 @@ const REVISION_DIFF_STYLES = `
|
|
|
103
101
|
function withRevisionDiffClasses( BlockListBlock ) {
|
|
104
102
|
return ( props ) => {
|
|
105
103
|
const { block, className } = props;
|
|
106
|
-
const diffStatus = block?.__revisionDiffStatus;
|
|
104
|
+
const diffStatus = block?.__revisionDiffStatus?.status;
|
|
107
105
|
|
|
108
106
|
const enhancedClassName = clsx( className, {
|
|
109
107
|
'is-revision-added': diffStatus === 'added',
|
|
@@ -150,12 +148,11 @@ function CanvasContent( { showDiff } ) {
|
|
|
150
148
|
|
|
151
149
|
/**
|
|
152
150
|
* Canvas component that renders a post revision in read-only mode.
|
|
151
|
+
* Block preparation and settings are handled by the parent EditorProvider.
|
|
153
152
|
*
|
|
154
|
-
* @param {Object} props Component props.
|
|
155
|
-
* @param {boolean} props.showDiff Whether to show diff highlighting.
|
|
156
153
|
* @return {React.JSX.Element} The revisions canvas component.
|
|
157
154
|
*/
|
|
158
|
-
export default function RevisionsCanvas(
|
|
155
|
+
export default function RevisionsCanvas() {
|
|
159
156
|
useEffect( () => {
|
|
160
157
|
registerDiffFormatTypes();
|
|
161
158
|
return () => {
|
|
@@ -163,83 +160,23 @@ export default function RevisionsCanvas( { showDiff } ) {
|
|
|
163
160
|
};
|
|
164
161
|
}, [] );
|
|
165
162
|
|
|
166
|
-
const { revision,
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
getCurrentRevision,
|
|
170
|
-
getPreviousRevision,
|
|
171
|
-
getCurrentPostType,
|
|
172
|
-
} = unlock( select( editorStore ) );
|
|
173
|
-
return {
|
|
174
|
-
revision: getCurrentRevision(),
|
|
175
|
-
previousRevision: getPreviousRevision(),
|
|
176
|
-
postType: getCurrentPostType(),
|
|
177
|
-
blockEditorSettings: select( blockEditorStore ).getSettings(),
|
|
178
|
-
};
|
|
179
|
-
}, [] );
|
|
180
|
-
|
|
181
|
-
// Track previously rendered blocks to preserve clientIds between renders.
|
|
182
|
-
const previousBlocksRef = useRef( [] );
|
|
183
|
-
|
|
184
|
-
const blocks = useMemo( () => {
|
|
185
|
-
const currentContent = revision?.content?.raw ?? '';
|
|
186
|
-
|
|
187
|
-
let parsedBlocks;
|
|
188
|
-
if ( showDiff ) {
|
|
189
|
-
const previousContent = previousRevision?.content?.raw || '';
|
|
190
|
-
// diffRevisionContent handles both normal diffing and the case
|
|
191
|
-
// where there's no previous revision (oldest revision shows all as added).
|
|
192
|
-
parsedBlocks = diffRevisionContent(
|
|
193
|
-
currentContent,
|
|
194
|
-
previousContent
|
|
195
|
-
);
|
|
196
|
-
} else {
|
|
197
|
-
// When diff is disabled, just parse the current revision content.
|
|
198
|
-
parsedBlocks = parse( currentContent );
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
if ( postType === 'wp_navigation' ) {
|
|
202
|
-
parsedBlocks = [
|
|
203
|
-
createBlock(
|
|
204
|
-
'core/navigation',
|
|
205
|
-
{ templateLock: false },
|
|
206
|
-
parsedBlocks
|
|
207
|
-
),
|
|
208
|
-
];
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
// Preserve clientIds from previous render to prevent React unmount/remount.
|
|
212
|
-
const blocksWithStableIds = preserveClientIds(
|
|
213
|
-
parsedBlocks,
|
|
214
|
-
previousBlocksRef.current
|
|
163
|
+
const { revision, showDiff } = useSelect( ( select ) => {
|
|
164
|
+
const { getCurrentRevision, isShowingRevisionDiff } = unlock(
|
|
165
|
+
select( editorStore )
|
|
215
166
|
);
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
}, [
|
|
222
|
-
revision?.content?.raw,
|
|
223
|
-
previousRevision?.content?.raw,
|
|
224
|
-
postType,
|
|
225
|
-
showDiff,
|
|
226
|
-
] );
|
|
227
|
-
|
|
228
|
-
const settings = useMemo(
|
|
229
|
-
() => ( {
|
|
230
|
-
...blockEditorSettings,
|
|
231
|
-
isPreviewMode: true,
|
|
232
|
-
} ),
|
|
233
|
-
[ blockEditorSettings ]
|
|
234
|
-
);
|
|
167
|
+
return {
|
|
168
|
+
revision: getCurrentRevision(),
|
|
169
|
+
showDiff: isShowingRevisionDiff(),
|
|
170
|
+
};
|
|
171
|
+
}, [] );
|
|
235
172
|
|
|
236
173
|
return revision ? (
|
|
237
|
-
|
|
174
|
+
<>
|
|
238
175
|
<DiffStyleOverrides showDiff={ showDiff } />
|
|
239
176
|
<div className="editor-revisions-canvas__content">
|
|
240
177
|
<CanvasContent showDiff={ showDiff } />
|
|
241
178
|
</div>
|
|
242
|
-
|
|
179
|
+
</>
|
|
243
180
|
) : (
|
|
244
181
|
<div className="editor-revisions-canvas__loading">
|
|
245
182
|
<Spinner />
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { useMemo } from '@wordpress/element';
|
|
5
4
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
6
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
RangeControl,
|
|
7
|
+
Spinner,
|
|
8
|
+
Button,
|
|
9
|
+
__experimentalHStack as HStack,
|
|
10
|
+
} from '@wordpress/components';
|
|
7
11
|
import { store as coreStore } from '@wordpress/core-data';
|
|
8
|
-
import { __ } from '@wordpress/i18n';
|
|
12
|
+
import { __, sprintf } from '@wordpress/i18n';
|
|
9
13
|
import { dateI18n, getSettings as getDateSettings } from '@wordpress/date';
|
|
14
|
+
import { useMemo } from '@wordpress/element';
|
|
15
|
+
import { chevronLeft, chevronRight } from '@wordpress/icons';
|
|
10
16
|
|
|
11
17
|
/**
|
|
12
18
|
* Internal dependencies
|
|
@@ -15,61 +21,68 @@ import { store as editorStore } from '../../store';
|
|
|
15
21
|
import { unlock } from '../../lock-unlock';
|
|
16
22
|
|
|
17
23
|
/**
|
|
18
|
-
* Slider component for navigating revisions.
|
|
24
|
+
* Slider component for navigating revisions with pagination.
|
|
19
25
|
*
|
|
20
26
|
* @return {React.JSX.Element} The revisions slider component.
|
|
21
27
|
*/
|
|
22
28
|
function RevisionsSlider() {
|
|
23
|
-
const {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
const entityConfig = getEntityConfig( 'postType', postType );
|
|
38
|
-
const query = { per_page: -1, context: 'edit' };
|
|
39
|
-
return {
|
|
40
|
-
revisions: getRevisions( 'postType', postType, postId, query ),
|
|
41
|
-
isLoading: isResolving( 'getRevisions', [
|
|
42
|
-
'postType',
|
|
43
|
-
postType,
|
|
44
|
-
postId,
|
|
45
|
-
query,
|
|
46
|
-
] ),
|
|
47
|
-
currentRevisionId: unlock(
|
|
48
|
-
select( editorStore )
|
|
49
|
-
).getCurrentRevisionId(),
|
|
50
|
-
revisionKey: entityConfig?.revisionKey || 'id',
|
|
51
|
-
};
|
|
52
|
-
},
|
|
53
|
-
[]
|
|
54
|
-
);
|
|
29
|
+
const {
|
|
30
|
+
revisions: rawRevisions,
|
|
31
|
+
perPage,
|
|
32
|
+
currentRevisionId,
|
|
33
|
+
revisionKey,
|
|
34
|
+
revisionPage,
|
|
35
|
+
totalRevisions,
|
|
36
|
+
} = useSelect( ( select ) => {
|
|
37
|
+
const {
|
|
38
|
+
getCurrentRevisionId,
|
|
39
|
+
getRevisionPage,
|
|
40
|
+
getPageRevisions,
|
|
41
|
+
getRevisionsPerPage,
|
|
42
|
+
} = unlock( select( editorStore ) );
|
|
55
43
|
|
|
56
|
-
|
|
44
|
+
const postType = select( editorStore ).getCurrentPostType();
|
|
45
|
+
if ( ! postType ) {
|
|
46
|
+
return {};
|
|
47
|
+
}
|
|
57
48
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
?.slice()
|
|
62
|
-
.sort( ( a, b ) => new Date( a.date ) - new Date( b.date ) ) ??
|
|
63
|
-
[]
|
|
49
|
+
const entityConfig = select( coreStore ).getEntityConfig(
|
|
50
|
+
'postType',
|
|
51
|
+
postType
|
|
64
52
|
);
|
|
65
|
-
|
|
53
|
+
const _revisionKey = entityConfig?.revisionKey || 'id';
|
|
54
|
+
const _revisionPage = getRevisionPage();
|
|
66
55
|
|
|
67
|
-
|
|
56
|
+
return {
|
|
57
|
+
revisions: getPageRevisions( _revisionPage ),
|
|
58
|
+
perPage: getRevisionsPerPage(),
|
|
59
|
+
currentRevisionId: getCurrentRevisionId(),
|
|
60
|
+
revisionKey: _revisionKey,
|
|
61
|
+
revisionPage: _revisionPage,
|
|
62
|
+
totalRevisions:
|
|
63
|
+
select( editorStore ).getCurrentPostRevisionsCount(),
|
|
64
|
+
};
|
|
65
|
+
}, [] );
|
|
66
|
+
|
|
67
|
+
const { setCurrentRevisionId, setRevisionPage } = unlock(
|
|
68
|
+
useDispatch( editorStore )
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
const isLoading = ! rawRevisions;
|
|
72
|
+
const totalPages = Math.ceil( totalRevisions / perPage ) || 1;
|
|
73
|
+
|
|
74
|
+
// Reverse desc→asc so the slider reads oldest (left) → newest (right).
|
|
75
|
+
const revisions = useMemo(
|
|
76
|
+
() => rawRevisions && [ ...rawRevisions ].reverse(),
|
|
77
|
+
[ rawRevisions ]
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
const selectedIndex = revisions?.findIndex(
|
|
68
81
|
( r ) => r[ revisionKey ] === currentRevisionId
|
|
69
82
|
);
|
|
70
83
|
|
|
71
84
|
const handleSliderChange = ( index ) => {
|
|
72
|
-
const revision =
|
|
85
|
+
const revision = revisions?.[ index ];
|
|
73
86
|
if ( revision ) {
|
|
74
87
|
setCurrentRevisionId( revision[ revisionKey ] );
|
|
75
88
|
}
|
|
@@ -78,18 +91,20 @@ function RevisionsSlider() {
|
|
|
78
91
|
// Format date for tooltip.
|
|
79
92
|
const dateSettings = getDateSettings();
|
|
80
93
|
const renderTooltipContent = ( index ) => {
|
|
81
|
-
const revision =
|
|
94
|
+
const revision = revisions?.[ index ];
|
|
82
95
|
if ( ! revision ) {
|
|
83
96
|
return index;
|
|
84
97
|
}
|
|
85
98
|
return dateI18n( dateSettings.formats.datetime, revision.date );
|
|
86
99
|
};
|
|
87
100
|
|
|
88
|
-
|
|
101
|
+
const showPagination = totalPages > 1;
|
|
102
|
+
|
|
103
|
+
if ( isLoading && ! showPagination ) {
|
|
89
104
|
return <Spinner />;
|
|
90
105
|
}
|
|
91
106
|
|
|
92
|
-
if ( !
|
|
107
|
+
if ( ! isLoading && ! revisions?.length ) {
|
|
93
108
|
return (
|
|
94
109
|
<span className="editor-revisions-header__no-revisions">
|
|
95
110
|
{ __( 'No revisions found.' ) }
|
|
@@ -97,7 +112,7 @@ function RevisionsSlider() {
|
|
|
97
112
|
);
|
|
98
113
|
}
|
|
99
114
|
|
|
100
|
-
if (
|
|
115
|
+
if ( totalRevisions <= 1 ) {
|
|
101
116
|
return (
|
|
102
117
|
<span className="editor-revisions-header__no-revisions">
|
|
103
118
|
{ __( 'Only one revision found.' ) }
|
|
@@ -105,20 +120,78 @@ function RevisionsSlider() {
|
|
|
105
120
|
);
|
|
106
121
|
}
|
|
107
122
|
|
|
123
|
+
const getPageRangeLabel = ( page ) => {
|
|
124
|
+
const end = totalRevisions - ( page - 1 ) * perPage;
|
|
125
|
+
const start = Math.max( 1, end - perPage + 1 );
|
|
126
|
+
return sprintf(
|
|
127
|
+
/* translators: 1: first revision number, 2: last revision number */
|
|
128
|
+
__( 'Revisions %1$s–%2$s' ),
|
|
129
|
+
start,
|
|
130
|
+
end
|
|
131
|
+
);
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
const sliderOrSpinner =
|
|
135
|
+
isLoading || selectedIndex === -1 ? (
|
|
136
|
+
<Spinner />
|
|
137
|
+
) : (
|
|
138
|
+
<RangeControl
|
|
139
|
+
__next40pxDefaultSize
|
|
140
|
+
aria-valuetext={ renderTooltipContent( selectedIndex ) }
|
|
141
|
+
className="editor-revisions-header__slider"
|
|
142
|
+
hideLabelFromVision
|
|
143
|
+
label={ __( 'Revision' ) }
|
|
144
|
+
max={ revisions?.length - 1 }
|
|
145
|
+
min={ 0 }
|
|
146
|
+
marks
|
|
147
|
+
onChange={ handleSliderChange }
|
|
148
|
+
renderTooltipContent={ renderTooltipContent }
|
|
149
|
+
value={ selectedIndex }
|
|
150
|
+
withInputField={ false }
|
|
151
|
+
/>
|
|
152
|
+
);
|
|
153
|
+
|
|
154
|
+
if ( ! showPagination ) {
|
|
155
|
+
return sliderOrSpinner;
|
|
156
|
+
}
|
|
157
|
+
|
|
108
158
|
return (
|
|
109
|
-
<
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
159
|
+
<HStack spacing={ 2 } expanded wrap={ false }>
|
|
160
|
+
<Button
|
|
161
|
+
icon={ chevronLeft }
|
|
162
|
+
label={
|
|
163
|
+
revisionPage < totalPages
|
|
164
|
+
? getPageRangeLabel( revisionPage + 1 )
|
|
165
|
+
: __( 'No older revisions' )
|
|
166
|
+
}
|
|
167
|
+
onClick={ () => setRevisionPage( revisionPage + 1 ) }
|
|
168
|
+
disabled={ isLoading || revisionPage >= totalPages }
|
|
169
|
+
size="compact"
|
|
170
|
+
accessibleWhenDisabled
|
|
171
|
+
/>
|
|
172
|
+
<div
|
|
173
|
+
style={ {
|
|
174
|
+
flex: 1,
|
|
175
|
+
minWidth: 0,
|
|
176
|
+
display: 'flex',
|
|
177
|
+
justifyContent: 'center',
|
|
178
|
+
} }
|
|
179
|
+
>
|
|
180
|
+
{ sliderOrSpinner }
|
|
181
|
+
</div>
|
|
182
|
+
<Button
|
|
183
|
+
icon={ chevronRight }
|
|
184
|
+
label={
|
|
185
|
+
revisionPage > 1
|
|
186
|
+
? getPageRangeLabel( revisionPage - 1 )
|
|
187
|
+
: __( 'No newer revisions' )
|
|
188
|
+
}
|
|
189
|
+
onClick={ () => setRevisionPage( revisionPage - 1 ) }
|
|
190
|
+
disabled={ isLoading || revisionPage <= 1 }
|
|
191
|
+
size="compact"
|
|
192
|
+
accessibleWhenDisabled
|
|
193
|
+
/>
|
|
194
|
+
</HStack>
|
|
122
195
|
);
|
|
123
196
|
}
|
|
124
197
|
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
.revision-diff-markers {
|
|
36
36
|
position: relative;
|
|
37
37
|
flex-shrink: 0;
|
|
38
|
-
width:
|
|
38
|
+
width: max(16px, 1rem);
|
|
39
39
|
background: rgba(0, 0, 0, 0.05);
|
|
40
40
|
|
|
41
41
|
.revision-diff-marker {
|
|
@@ -52,11 +52,11 @@
|
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
&.is-removed {
|
|
55
|
-
background: #d63638;
|
|
55
|
+
background: repeating-linear-gradient(45deg, #d63638, #d63638 3px, rgba(#d63638, 0.45) 3px, rgba(#d63638, 0.45) 6px);
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
&.is-modified {
|
|
59
|
-
background: #dba617;
|
|
59
|
+
background: repeating-linear-gradient(-45deg, #dba617, #dba617 3px, rgba(#dba617, 0.45) 3px, rgba(#dba617, 0.45) 6px);
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
&:hover {
|