@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
|
@@ -16,6 +16,7 @@ import { dateI18n, getSettings as getDateSettings } from '@wordpress/date';
|
|
|
16
16
|
* Internal dependencies
|
|
17
17
|
*/
|
|
18
18
|
import isTemplateRevertable from './utils/is-template-revertable';
|
|
19
|
+
import { buildRevisionsPageQuery } from './private-selectors';
|
|
19
20
|
export * from '../dataviews/store/private-actions';
|
|
20
21
|
|
|
21
22
|
/**
|
|
@@ -602,6 +603,52 @@ export function setCurrentRevisionId( revisionId ) {
|
|
|
602
603
|
};
|
|
603
604
|
}
|
|
604
605
|
|
|
606
|
+
/**
|
|
607
|
+
* Set the current revisions page number and select the newest
|
|
608
|
+
* revision on that page once it loads.
|
|
609
|
+
*
|
|
610
|
+
* @param {number} page The page number.
|
|
611
|
+
*/
|
|
612
|
+
export const setRevisionPage =
|
|
613
|
+
( page ) =>
|
|
614
|
+
async ( { dispatch, select, registry } ) => {
|
|
615
|
+
const postType = select.getCurrentPostType();
|
|
616
|
+
const postId = select.getCurrentPostId();
|
|
617
|
+
const entityConfig = registry
|
|
618
|
+
.select( coreStore )
|
|
619
|
+
.getEntityConfig( 'postType', postType );
|
|
620
|
+
const revisionKey = entityConfig?.revisionKey || 'id';
|
|
621
|
+
|
|
622
|
+
const revisions = await registry
|
|
623
|
+
.resolveSelect( coreStore )
|
|
624
|
+
.getRevisions(
|
|
625
|
+
'postType',
|
|
626
|
+
postType,
|
|
627
|
+
postId,
|
|
628
|
+
buildRevisionsPageQuery( revisionKey, page )
|
|
629
|
+
);
|
|
630
|
+
|
|
631
|
+
registry.batch( () => {
|
|
632
|
+
dispatch( { type: 'SET_REVISION_PAGE', page } );
|
|
633
|
+
if ( revisions?.length ) {
|
|
634
|
+
dispatch.setCurrentRevisionId( revisions[ 0 ][ revisionKey ] );
|
|
635
|
+
}
|
|
636
|
+
} );
|
|
637
|
+
};
|
|
638
|
+
|
|
639
|
+
/**
|
|
640
|
+
* Set whether the revision diff highlighting is shown.
|
|
641
|
+
*
|
|
642
|
+
* @param {boolean} showDiff Whether to show diff highlighting.
|
|
643
|
+
* @return {Object} Action object.
|
|
644
|
+
*/
|
|
645
|
+
export function setShowRevisionDiff( showDiff ) {
|
|
646
|
+
return {
|
|
647
|
+
type: 'SET_SHOW_REVISION_DIFF',
|
|
648
|
+
showDiff,
|
|
649
|
+
};
|
|
650
|
+
}
|
|
651
|
+
|
|
605
652
|
/**
|
|
606
653
|
* Restore a revision by replacing the current content with the revision's content
|
|
607
654
|
* and auto-saving.
|
|
@@ -614,10 +661,32 @@ export const restoreRevision =
|
|
|
614
661
|
const postType = select.getCurrentPostType();
|
|
615
662
|
const postId = select.getCurrentPostId();
|
|
616
663
|
|
|
617
|
-
const
|
|
664
|
+
const entityConfig = registry
|
|
618
665
|
.select( coreStore )
|
|
666
|
+
.getEntityConfig( 'postType', postType );
|
|
667
|
+
const revisionKey = entityConfig?.revisionKey || 'id';
|
|
668
|
+
|
|
669
|
+
// Use resolveSelect to ensure the revision is fetched if not yet
|
|
670
|
+
// in the store. The _fields parameter matches the query used by
|
|
671
|
+
// getRevisions so the result is served from cache without an
|
|
672
|
+
// extra API call.
|
|
673
|
+
const revision = await registry
|
|
674
|
+
.resolveSelect( coreStore )
|
|
619
675
|
.getRevision( 'postType', postType, postId, revisionId, {
|
|
620
676
|
context: 'edit',
|
|
677
|
+
_fields: [
|
|
678
|
+
...new Set( [
|
|
679
|
+
'id',
|
|
680
|
+
'date',
|
|
681
|
+
'modified',
|
|
682
|
+
'author',
|
|
683
|
+
'meta',
|
|
684
|
+
'title.raw',
|
|
685
|
+
'excerpt.raw',
|
|
686
|
+
'content.raw',
|
|
687
|
+
revisionKey,
|
|
688
|
+
] ),
|
|
689
|
+
].join(),
|
|
621
690
|
} );
|
|
622
691
|
|
|
623
692
|
if ( ! revision ) {
|
|
@@ -21,13 +21,19 @@ import { store as preferencesStore } from '@wordpress/preferences';
|
|
|
21
21
|
/**
|
|
22
22
|
* Internal dependencies
|
|
23
23
|
*/
|
|
24
|
-
import {
|
|
24
|
+
import {
|
|
25
|
+
getRenderingMode,
|
|
26
|
+
getCurrentPost,
|
|
27
|
+
getCurrentPostType,
|
|
28
|
+
getCurrentPostRevisionsCount,
|
|
29
|
+
} from './selectors';
|
|
25
30
|
import {
|
|
26
31
|
getEntityActions as _getEntityActions,
|
|
27
32
|
getEntityFields as _getEntityFields,
|
|
28
33
|
isEntityReady as _isEntityReady,
|
|
29
34
|
} from '../dataviews/store/private-selectors';
|
|
30
35
|
import { getTemplatePartIcon } from '../utils';
|
|
36
|
+
import { unlock } from '../lock-unlock';
|
|
31
37
|
|
|
32
38
|
const EMPTY_INSERTION_POINT = {
|
|
33
39
|
rootClientId: undefined,
|
|
@@ -55,14 +61,36 @@ export const getInserter = createRegistrySelector( ( select ) =>
|
|
|
55
61
|
}
|
|
56
62
|
|
|
57
63
|
if ( getRenderingMode( state ) === 'template-locked' ) {
|
|
64
|
+
const {
|
|
65
|
+
getBlocksByName,
|
|
66
|
+
getSelectedBlockClientId,
|
|
67
|
+
getBlockParents,
|
|
68
|
+
getBlockOrder,
|
|
69
|
+
} = select( blockEditorStore );
|
|
58
70
|
const [ postContentClientId ] =
|
|
59
|
-
|
|
60
|
-
'core/post-content'
|
|
61
|
-
);
|
|
71
|
+
getBlocksByName( 'core/post-content' );
|
|
62
72
|
if ( postContentClientId ) {
|
|
73
|
+
const selectedBlockClientId = getSelectedBlockClientId();
|
|
74
|
+
|
|
75
|
+
// If a block inside Post Content is selected,
|
|
76
|
+
// let the inserter use its default logic for determining the
|
|
77
|
+
// insertion position by returning an empty insertion point.
|
|
78
|
+
if (
|
|
79
|
+
selectedBlockClientId &&
|
|
80
|
+
selectedBlockClientId !== postContentClientId &&
|
|
81
|
+
getBlockParents( selectedBlockClientId ).includes(
|
|
82
|
+
postContentClientId
|
|
83
|
+
)
|
|
84
|
+
) {
|
|
85
|
+
return EMPTY_INSERTION_POINT;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// Otherwise (no selection, or Post Content itself
|
|
89
|
+
// is selected), insert at the end of Post Content.
|
|
63
90
|
return {
|
|
64
91
|
rootClientId: postContentClientId,
|
|
65
|
-
insertionIndex:
|
|
92
|
+
insertionIndex:
|
|
93
|
+
getBlockOrder( postContentClientId ).length,
|
|
66
94
|
filterValue: undefined,
|
|
67
95
|
};
|
|
68
96
|
}
|
|
@@ -71,14 +99,26 @@ export const getInserter = createRegistrySelector( ( select ) =>
|
|
|
71
99
|
return EMPTY_INSERTION_POINT;
|
|
72
100
|
},
|
|
73
101
|
( state ) => {
|
|
102
|
+
const {
|
|
103
|
+
getBlocksByName,
|
|
104
|
+
getSelectedBlockClientId,
|
|
105
|
+
getBlockParents,
|
|
106
|
+
getBlockOrder,
|
|
107
|
+
} = select( blockEditorStore );
|
|
74
108
|
const [ postContentClientId ] =
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
);
|
|
109
|
+
getBlocksByName( 'core/post-content' );
|
|
110
|
+
const selectedBlockClientId = getSelectedBlockClientId();
|
|
78
111
|
return [
|
|
79
112
|
state.blockInserterPanel,
|
|
80
113
|
getRenderingMode( state ),
|
|
81
114
|
postContentClientId,
|
|
115
|
+
selectedBlockClientId,
|
|
116
|
+
selectedBlockClientId
|
|
117
|
+
? getBlockParents( selectedBlockClientId )
|
|
118
|
+
: undefined,
|
|
119
|
+
postContentClientId
|
|
120
|
+
? getBlockOrder( postContentClientId ).length
|
|
121
|
+
: undefined,
|
|
82
122
|
];
|
|
83
123
|
}
|
|
84
124
|
)
|
|
@@ -216,7 +256,18 @@ export const getPostBlocksByName = createRegistrySelector( ( select ) =>
|
|
|
216
256
|
} )
|
|
217
257
|
);
|
|
218
258
|
},
|
|
219
|
-
(
|
|
259
|
+
( state, blockNames ) => {
|
|
260
|
+
blockNames = Array.isArray( blockNames )
|
|
261
|
+
? blockNames
|
|
262
|
+
: [ blockNames ];
|
|
263
|
+
const { getBlocksByName, getBlockParents } =
|
|
264
|
+
select( blockEditorStore );
|
|
265
|
+
const clientIds = getBlocksByName( blockNames );
|
|
266
|
+
const parentsOfClientIds = clientIds.map( ( id ) =>
|
|
267
|
+
getBlockParents( id )
|
|
268
|
+
);
|
|
269
|
+
return [ clientIds, ...parentsOfClientIds ];
|
|
270
|
+
}
|
|
220
271
|
)
|
|
221
272
|
);
|
|
222
273
|
|
|
@@ -301,6 +352,85 @@ export function getCanvasMinHeight( state ) {
|
|
|
301
352
|
return state.canvasMinHeight;
|
|
302
353
|
}
|
|
303
354
|
|
|
355
|
+
/**
|
|
356
|
+
* Returns the current revisions page number.
|
|
357
|
+
*
|
|
358
|
+
* @param {Object} state Global application state.
|
|
359
|
+
* @return {number} The page number.
|
|
360
|
+
*/
|
|
361
|
+
export function getRevisionPage( state ) {
|
|
362
|
+
return state.revisionPage;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
/**
|
|
366
|
+
* Builds the query object for fetching a page of revisions.
|
|
367
|
+
*
|
|
368
|
+
* @param {string} revisionKey The entity's revision key.
|
|
369
|
+
* @param {number} page The 1-based page number (page 1 = newest).
|
|
370
|
+
* @return {Object} Query object for getRevisions.
|
|
371
|
+
*/
|
|
372
|
+
export function buildRevisionsPageQuery( revisionKey, page ) {
|
|
373
|
+
return {
|
|
374
|
+
per_page: REVISIONS_PER_PAGE,
|
|
375
|
+
page,
|
|
376
|
+
context: 'edit',
|
|
377
|
+
orderby: 'date',
|
|
378
|
+
order: 'desc',
|
|
379
|
+
_fields: [
|
|
380
|
+
...new Set( [
|
|
381
|
+
'id',
|
|
382
|
+
'date',
|
|
383
|
+
'modified',
|
|
384
|
+
'author',
|
|
385
|
+
'meta',
|
|
386
|
+
'title.raw',
|
|
387
|
+
'excerpt.raw',
|
|
388
|
+
'content.raw',
|
|
389
|
+
revisionKey,
|
|
390
|
+
] ),
|
|
391
|
+
].join(),
|
|
392
|
+
};
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
const REVISIONS_PER_PAGE = 100;
|
|
396
|
+
|
|
397
|
+
export function getRevisionsPerPage() {
|
|
398
|
+
return REVISIONS_PER_PAGE;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
/**
|
|
402
|
+
* Returns revisions for the given page number.
|
|
403
|
+
*
|
|
404
|
+
* @param {Object} state Global application state.
|
|
405
|
+
* @param {number} page The 1-based page number (page 1 = newest).
|
|
406
|
+
* @return {Array|null} The revisions array, or null if not yet loaded.
|
|
407
|
+
*/
|
|
408
|
+
export const getPageRevisions = createRegistrySelector(
|
|
409
|
+
( select ) => ( state, page ) => {
|
|
410
|
+
if ( ! page ) {
|
|
411
|
+
return null;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
const { type: postType, id: postId } = getCurrentPost( state );
|
|
415
|
+
if ( ! postType || ! postId ) {
|
|
416
|
+
return null;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
const entityConfig = select( coreStore ).getEntityConfig(
|
|
420
|
+
'postType',
|
|
421
|
+
postType
|
|
422
|
+
);
|
|
423
|
+
const revisionKey = entityConfig?.revisionKey || 'id';
|
|
424
|
+
|
|
425
|
+
return select( coreStore ).getRevisions(
|
|
426
|
+
'postType',
|
|
427
|
+
postType,
|
|
428
|
+
postId,
|
|
429
|
+
buildRevisionsPageQuery( revisionKey, page )
|
|
430
|
+
);
|
|
431
|
+
}
|
|
432
|
+
);
|
|
433
|
+
|
|
304
434
|
/**
|
|
305
435
|
* Returns whether the editor is in revisions preview mode.
|
|
306
436
|
*
|
|
@@ -311,6 +441,16 @@ export function isRevisionsMode( state ) {
|
|
|
311
441
|
return state.revisionId !== null;
|
|
312
442
|
}
|
|
313
443
|
|
|
444
|
+
/**
|
|
445
|
+
* Returns whether the revision diff highlighting is shown.
|
|
446
|
+
*
|
|
447
|
+
* @param {Object} state Global application state.
|
|
448
|
+
* @return {boolean} Whether revision diff is being shown.
|
|
449
|
+
*/
|
|
450
|
+
export function isShowingRevisionDiff( state ) {
|
|
451
|
+
return state.showRevisionDiff;
|
|
452
|
+
}
|
|
453
|
+
|
|
314
454
|
/**
|
|
315
455
|
* Returns the current revision ID in revisions mode.
|
|
316
456
|
*
|
|
@@ -334,29 +474,29 @@ export const getCurrentRevision = createRegistrySelector(
|
|
|
334
474
|
return undefined;
|
|
335
475
|
}
|
|
336
476
|
|
|
477
|
+
const page = getRevisionPage( state );
|
|
478
|
+
if ( ! page ) {
|
|
479
|
+
return null;
|
|
480
|
+
}
|
|
481
|
+
|
|
337
482
|
const { type: postType, id: postId } = getCurrentPost( state );
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
// received revisions from the collection API call to avoid unnecessary
|
|
344
|
-
// API calls.
|
|
483
|
+
const entityConfig = select( coreStore ).getEntityConfig(
|
|
484
|
+
'postType',
|
|
485
|
+
postType
|
|
486
|
+
);
|
|
487
|
+
const revisionKey = entityConfig?.revisionKey || 'id';
|
|
345
488
|
const revisions = select( coreStore ).getRevisions(
|
|
346
489
|
'postType',
|
|
347
490
|
postType,
|
|
348
491
|
postId,
|
|
349
|
-
|
|
492
|
+
buildRevisionsPageQuery( revisionKey, page )
|
|
350
493
|
);
|
|
351
494
|
if ( ! revisions ) {
|
|
352
495
|
return null;
|
|
353
496
|
}
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
postType
|
|
497
|
+
return (
|
|
498
|
+
revisions.find( ( r ) => r[ revisionKey ] === revisionId ) ?? null
|
|
357
499
|
);
|
|
358
|
-
const revKey = entityConfig?.revisionKey || 'id';
|
|
359
|
-
return revisions.find( ( r ) => r[ revKey ] === revisionId ) ?? null;
|
|
360
500
|
}
|
|
361
501
|
);
|
|
362
502
|
|
|
@@ -396,37 +536,75 @@ export const getPreviousRevision = createRegistrySelector(
|
|
|
396
536
|
return undefined;
|
|
397
537
|
}
|
|
398
538
|
|
|
539
|
+
const page = getRevisionPage( state );
|
|
540
|
+
if ( ! page ) {
|
|
541
|
+
return null;
|
|
542
|
+
}
|
|
543
|
+
|
|
399
544
|
const { type: postType, id: postId } = getCurrentPost( state );
|
|
545
|
+
const entityConfig = select( coreStore ).getEntityConfig(
|
|
546
|
+
'postType',
|
|
547
|
+
postType
|
|
548
|
+
);
|
|
549
|
+
const revisionKey = entityConfig?.revisionKey || 'id';
|
|
550
|
+
const query = buildRevisionsPageQuery( revisionKey, page );
|
|
400
551
|
const revisions = select( coreStore ).getRevisions(
|
|
401
552
|
'postType',
|
|
402
553
|
postType,
|
|
403
554
|
postId,
|
|
404
|
-
|
|
555
|
+
query
|
|
405
556
|
);
|
|
406
557
|
if ( ! revisions ) {
|
|
407
558
|
return null;
|
|
408
559
|
}
|
|
409
560
|
|
|
410
|
-
// Sort by date ascending (oldest first).
|
|
411
|
-
const sortedRevisions = [ ...revisions ].sort(
|
|
412
|
-
( a, b ) => new Date( a.date ) - new Date( b.date )
|
|
413
|
-
);
|
|
414
|
-
|
|
415
561
|
// Find current revision index.
|
|
416
|
-
const
|
|
417
|
-
|
|
418
|
-
postType
|
|
419
|
-
);
|
|
420
|
-
const revKey = entityConfig?.revisionKey || 'id';
|
|
421
|
-
const currentIndex = sortedRevisions.findIndex(
|
|
422
|
-
( r ) => r[ revKey ] === currentRevisionId
|
|
562
|
+
const currentIndex = revisions.findIndex(
|
|
563
|
+
( r ) => r[ revisionKey ] === currentRevisionId
|
|
423
564
|
);
|
|
424
565
|
|
|
425
566
|
// Return the previous revision (older one) if it exists.
|
|
426
|
-
if ( currentIndex
|
|
427
|
-
return
|
|
567
|
+
if ( currentIndex >= 0 && currentIndex < revisions.length - 1 ) {
|
|
568
|
+
return revisions[ currentIndex + 1 ];
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
// At page boundary: fetch the first revision from the next page.
|
|
572
|
+
const totalRevisions = getCurrentPostRevisionsCount( state );
|
|
573
|
+
const totalPages = Math.ceil( totalRevisions / query.per_page ) || 1;
|
|
574
|
+
if ( currentIndex === revisions.length - 1 && page < totalPages ) {
|
|
575
|
+
const nextPageRevisions = select( coreStore ).getRevisions(
|
|
576
|
+
'postType',
|
|
577
|
+
postType,
|
|
578
|
+
postId,
|
|
579
|
+
buildRevisionsPageQuery( revisionKey, page + 1 )
|
|
580
|
+
);
|
|
581
|
+
return nextPageRevisions?.[ 0 ] ?? null;
|
|
428
582
|
}
|
|
429
583
|
|
|
430
584
|
return null;
|
|
431
585
|
}
|
|
432
586
|
);
|
|
587
|
+
|
|
588
|
+
/**
|
|
589
|
+
* Returns whether the collaboration is enabled for the current post.
|
|
590
|
+
*
|
|
591
|
+
* @return {boolean} Whether collaboration is enabled.
|
|
592
|
+
*/
|
|
593
|
+
export const isCollaborationEnabledForCurrentPost = createRegistrySelector(
|
|
594
|
+
( select ) => ( state ) => {
|
|
595
|
+
// Return early, if collaboration is not supported.
|
|
596
|
+
if ( ! unlock( select( coreStore ) ).isCollaborationSupported() ) {
|
|
597
|
+
return false;
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
const currentPostType = getCurrentPostType( state );
|
|
601
|
+
const entityConfig = select( coreStore ).getEntityConfig(
|
|
602
|
+
'postType',
|
|
603
|
+
currentPostType
|
|
604
|
+
);
|
|
605
|
+
|
|
606
|
+
return Boolean(
|
|
607
|
+
entityConfig?.syncConfig && window._wpCollaborationEnabled
|
|
608
|
+
);
|
|
609
|
+
}
|
|
610
|
+
);
|
package/src/store/reducer.js
CHANGED
|
@@ -449,6 +449,45 @@ export function revisionId( state = null, action ) {
|
|
|
449
449
|
return state;
|
|
450
450
|
}
|
|
451
451
|
|
|
452
|
+
/**
|
|
453
|
+
* Reducer for the current revisions page number.
|
|
454
|
+
*
|
|
455
|
+
* @param {number} state Current page number.
|
|
456
|
+
* @param {Object} action Dispatched action.
|
|
457
|
+
* @return {number} Updated state.
|
|
458
|
+
*/
|
|
459
|
+
export function revisionPage( state = 1, action ) {
|
|
460
|
+
switch ( action.type ) {
|
|
461
|
+
case 'SET_REVISION_PAGE':
|
|
462
|
+
return action.page;
|
|
463
|
+
case 'SET_CURRENT_REVISION_ID':
|
|
464
|
+
if ( ! action.revisionId ) {
|
|
465
|
+
return 1;
|
|
466
|
+
}
|
|
467
|
+
return state;
|
|
468
|
+
}
|
|
469
|
+
return state;
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
/**
|
|
473
|
+
* Reducer for whether the revision diff is shown.
|
|
474
|
+
* Resets to true when entering/exiting revisions mode.
|
|
475
|
+
*
|
|
476
|
+
* @param {boolean} state Current state.
|
|
477
|
+
* @param {Object} action Dispatched action.
|
|
478
|
+
* @return {boolean} Updated state.
|
|
479
|
+
*/
|
|
480
|
+
export function showRevisionDiff( state = true, action ) {
|
|
481
|
+
switch ( action.type ) {
|
|
482
|
+
case 'SET_SHOW_REVISION_DIFF':
|
|
483
|
+
return action.showDiff;
|
|
484
|
+
case 'SET_CURRENT_REVISION_ID':
|
|
485
|
+
// Reset during the exit.
|
|
486
|
+
return ! action.revisionId ? true : state;
|
|
487
|
+
}
|
|
488
|
+
return state;
|
|
489
|
+
}
|
|
490
|
+
|
|
452
491
|
/**
|
|
453
492
|
* Reducer returning the currently selected note and its options.
|
|
454
493
|
*
|
|
@@ -487,6 +526,8 @@ export default combineReducers( {
|
|
|
487
526
|
showStylebook,
|
|
488
527
|
canvasMinHeight,
|
|
489
528
|
revisionId,
|
|
529
|
+
revisionPage,
|
|
530
|
+
showRevisionDiff,
|
|
490
531
|
selectedNote,
|
|
491
532
|
dataviews: dataviewsReducer,
|
|
492
533
|
} );
|
package/src/store/selectors.js
CHANGED
|
@@ -1879,22 +1879,3 @@ export const getPostTypeLabel = createRegistrySelector(
|
|
|
1879
1879
|
export function isPublishSidebarOpened( state ) {
|
|
1880
1880
|
return state.publishSidebarActive;
|
|
1881
1881
|
}
|
|
1882
|
-
|
|
1883
|
-
/**
|
|
1884
|
-
* Returns whether the collaboration is enabled for the current post.
|
|
1885
|
-
*
|
|
1886
|
-
* @return {boolean} Whether collaboration is enabled.
|
|
1887
|
-
*/
|
|
1888
|
-
export const isCollaborationEnabledForCurrentPost = createRegistrySelector(
|
|
1889
|
-
( select ) => ( state ) => {
|
|
1890
|
-
const currentPostType = getCurrentPostType( state );
|
|
1891
|
-
const entityConfig = select( coreStore ).getEntityConfig(
|
|
1892
|
-
'postType',
|
|
1893
|
-
currentPostType
|
|
1894
|
-
);
|
|
1895
|
-
|
|
1896
|
-
return Boolean(
|
|
1897
|
-
entityConfig?.syncConfig && window._wpCollaborationEnabled
|
|
1898
|
-
);
|
|
1899
|
-
}
|
|
1900
|
-
);
|
package/src/style.scss
CHANGED
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
@use "@wordpress/media-editor/build-style/style.css" as *;
|
|
6
6
|
@use "./components/autocompleters/style.scss" as *;
|
|
7
7
|
@use "./components/collab-sidebar/style.scss" as *;
|
|
8
|
+
@use "./components/collaborators-presence/avatar/styles.scss" as *;
|
|
9
|
+
@use "./components/collaborators-presence/avatar-group/styles.scss" as *;
|
|
8
10
|
@use "./components/collapsible-block-toolbar/style.scss" as *;
|
|
9
11
|
@use "./components/block-visibility/style.scss" as *;
|
|
10
12
|
@use "./components/blog-title/style.scss" as *;
|
|
@@ -36,13 +38,14 @@
|
|
|
36
38
|
@use "./components/post-panel-section/style.scss" as *;
|
|
37
39
|
@use "./components/post-publish-panel/style.scss" as *;
|
|
38
40
|
@use "./components/post-revisions-preview/style.scss" as *;
|
|
41
|
+
@use "./components/revision-diff-panel/style.scss" as *;
|
|
39
42
|
@use "./components/post-saved-state/style.scss" as *;
|
|
40
43
|
@use "./components/post-schedule/style.scss" as *;
|
|
41
44
|
@use "./components/post-status/style.scss" as *;
|
|
42
45
|
@use "./components/post-sticky/style.scss" as *;
|
|
43
46
|
@use "./components/post-sync-status/style.scss" as *;
|
|
44
47
|
@use "./components/post-taxonomies/style.scss" as *;
|
|
45
|
-
@use "./components/sync-connection-modal/style.scss" as *;
|
|
48
|
+
@use "./components/sync-connection-error-modal/style.scss" as *;
|
|
46
49
|
@use "./components/post-template/style.scss" as *;
|
|
47
50
|
@use "./components/post-text-editor/style.scss" as *;
|
|
48
51
|
@use "./components/post-title/style.scss" as *;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import apiFetch from '@wordpress/api-fetch';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import mediaFinalize from '..';
|
|
10
|
+
|
|
11
|
+
jest.mock( '@wordpress/api-fetch', () => jest.fn() );
|
|
12
|
+
|
|
13
|
+
describe( 'mediaFinalize', () => {
|
|
14
|
+
beforeEach( () => {
|
|
15
|
+
jest.clearAllMocks();
|
|
16
|
+
} );
|
|
17
|
+
|
|
18
|
+
it( 'should call the finalize endpoint with the correct path and method', async () => {
|
|
19
|
+
apiFetch.mockResolvedValue( {} );
|
|
20
|
+
|
|
21
|
+
await mediaFinalize( 123 );
|
|
22
|
+
|
|
23
|
+
expect( apiFetch ).toHaveBeenCalledWith( {
|
|
24
|
+
path: '/wp/v2/media/123/finalize',
|
|
25
|
+
method: 'POST',
|
|
26
|
+
} );
|
|
27
|
+
} );
|
|
28
|
+
|
|
29
|
+
it( 'should propagate errors from apiFetch', async () => {
|
|
30
|
+
apiFetch.mockRejectedValue( new Error( 'Network error' ) );
|
|
31
|
+
|
|
32
|
+
await expect( mediaFinalize( 456 ) ).rejects.toThrow( 'Network error' );
|
|
33
|
+
} );
|
|
34
|
+
} );
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { dispatch } from '@wordpress/data';
|
|
5
|
+
import { store as coreDataStore } from '@wordpress/core-data';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Invalidates core-data entity records for uploaded attachments so that
|
|
9
|
+
* blocks re-fetch updated data (e.g. `media_details.sizes` after
|
|
10
|
+
* thumbnails have been generated via client-side media processing).
|
|
11
|
+
*
|
|
12
|
+
* @param {Object[]} attachments Array of attachment objects from the upload queue.
|
|
13
|
+
*/
|
|
14
|
+
export default function mediaUploadOnSuccess( attachments ) {
|
|
15
|
+
const { invalidateResolution } = dispatch( coreDataStore );
|
|
16
|
+
for ( const attachment of attachments ) {
|
|
17
|
+
if ( attachment.id ) {
|
|
18
|
+
// Invalidate with and without the query argument, since
|
|
19
|
+
// resolution keys must exactly match the args used by
|
|
20
|
+
// each consumer's getEntityRecord() call.
|
|
21
|
+
invalidateResolution( 'getEntityRecord', [
|
|
22
|
+
'postType',
|
|
23
|
+
'attachment',
|
|
24
|
+
attachment.id,
|
|
25
|
+
{ context: 'view' },
|
|
26
|
+
] );
|
|
27
|
+
invalidateResolution( 'getEntityRecord', [
|
|
28
|
+
'postType',
|
|
29
|
+
'attachment',
|
|
30
|
+
attachment.id,
|
|
31
|
+
] );
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { type ConnectionError } from '@wordpress/core-data';
|
|
5
|
+
import { __ } from '@wordpress/i18n';
|
|
6
|
+
|
|
7
|
+
// These error codes are defined in the sync package:
|
|
8
|
+
// packages/sync/src/errors.ts
|
|
9
|
+
export const AUTHENTICATION_FAILED = 'authentication-failed';
|
|
10
|
+
export const CONNECTION_EXPIRED = 'connection-expired';
|
|
11
|
+
export const CONNECTION_LIMIT_EXCEEDED = 'connection-limit-exceeded';
|
|
12
|
+
export const DOCUMENT_SIZE_LIMIT_EXCEEDED = 'document-size-limit-exceeded';
|
|
13
|
+
export const UNKNOWN_ERROR = 'unknown-error';
|
|
14
|
+
|
|
15
|
+
interface ConnectionErrorMessages {
|
|
16
|
+
description: string;
|
|
17
|
+
title: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Default error messages for known error codes.
|
|
22
|
+
*/
|
|
23
|
+
const ERROR_MESSAGES: Record< string, ConnectionErrorMessages > = {
|
|
24
|
+
[ AUTHENTICATION_FAILED ]: {
|
|
25
|
+
title: __( 'Unable to connect' ),
|
|
26
|
+
description: __(
|
|
27
|
+
"Real-time collaboration couldn't verify your permissions. " +
|
|
28
|
+
'Check that you have access to edit this post or contact your site administrator.'
|
|
29
|
+
),
|
|
30
|
+
},
|
|
31
|
+
[ CONNECTION_EXPIRED ]: {
|
|
32
|
+
title: __( 'Connection expired' ),
|
|
33
|
+
description: __(
|
|
34
|
+
'Your connection to real-time collaboration has timed out. ' +
|
|
35
|
+
'Editing is paused to prevent conflicts with other editors.'
|
|
36
|
+
),
|
|
37
|
+
},
|
|
38
|
+
[ CONNECTION_LIMIT_EXCEEDED ]: {
|
|
39
|
+
title: __( 'Too many editors connected' ),
|
|
40
|
+
description: __(
|
|
41
|
+
'Real-time collaboration has reached its connection limit. ' +
|
|
42
|
+
'Try again later or contact your site administrator.'
|
|
43
|
+
),
|
|
44
|
+
},
|
|
45
|
+
// DOCUMENT_SIZE_LIMIT_EXCEEDED is not included here because it results in
|
|
46
|
+
// collaboration being disabled entirely.
|
|
47
|
+
[ UNKNOWN_ERROR ]: {
|
|
48
|
+
title: __( 'Connection lost' ),
|
|
49
|
+
description: __(
|
|
50
|
+
'The connection to real-time collaboration was interrupted. ' +
|
|
51
|
+
'Editing is paused to prevent conflicts with other editors.'
|
|
52
|
+
),
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Get user-facing title and description from a sync connection error.
|
|
58
|
+
*
|
|
59
|
+
* Provides default messages based on error.code.
|
|
60
|
+
*
|
|
61
|
+
* @param error - Connection error.
|
|
62
|
+
* @return Object with title, description, and canRetry flag.
|
|
63
|
+
*/
|
|
64
|
+
export function getSyncErrorMessages(
|
|
65
|
+
error?: ConnectionError
|
|
66
|
+
): ConnectionErrorMessages {
|
|
67
|
+
if ( error?.code && ERROR_MESSAGES[ error?.code ] ) {
|
|
68
|
+
return ERROR_MESSAGES[ error.code ];
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return ERROR_MESSAGES[ UNKNOWN_ERROR ];
|
|
72
|
+
}
|