@wordpress/editor 14.40.2-next.v.202602241322.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/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 +146 -236
- 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/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-header.cjs +33 -26
- package/build/components/post-revisions-preview/revisions-header.cjs.map +3 -3
- package/build/components/post-revisions-preview/revisions-slider.cjs +104 -39
- package/build/components/post-revisions-preview/revisions-slider.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 +156 -21
- 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/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 +137 -237
- 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/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-header.mjs +36 -33
- package/build-module/components/post-revisions-preview/revisions-header.mjs.map +2 -2
- package/build-module/components/post-revisions-preview/revisions-slider.mjs +112 -42
- package/build-module/components/post-revisions-preview/revisions-slider.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 +155 -21
- 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 +388 -132
- package/build-style/style.css +388 -132
- 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-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/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-header.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/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/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 -229
- 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/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-header.js +35 -37
- package/src/components/post-revisions-preview/revisions-slider.js +138 -62
- 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/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 +216 -28
- 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
|
@@ -1,210 +1,29 @@
|
|
|
1
|
-
// @ts-expect-error No exported types
|
|
2
|
-
import { useStyleOverride } from '@wordpress/block-editor';
|
|
3
|
-
import { privateApis as componentsPrivateApis } from '@wordpress/components';
|
|
4
1
|
import { useResizeObserver, useMergeRefs } from '@wordpress/compose';
|
|
5
|
-
import { useEffect, useState } from '@wordpress/element';
|
|
2
|
+
import { useCallback, useEffect, useRef, useState } from '@wordpress/element';
|
|
3
|
+
import { __ } from '@wordpress/i18n';
|
|
6
4
|
|
|
7
|
-
import
|
|
5
|
+
import Avatar from '../collaborators-presence/avatar';
|
|
6
|
+
import { AVATAR_IFRAME_STYLES } from './avatar-iframe-styles';
|
|
7
|
+
import { OVERLAY_IFRAME_STYLES } from './overlay-iframe-styles';
|
|
8
|
+
import { setDelayedInterval } from './timing-utils';
|
|
8
9
|
import { useBlockHighlighting } from './use-block-highlighting';
|
|
9
10
|
import { useRenderCursors } from './use-render-cursors';
|
|
10
|
-
import {
|
|
11
|
+
import { type CursorRegistry } from './cursor-registry';
|
|
11
12
|
|
|
12
|
-
|
|
13
|
+
// Milliseconds to wait after a change before recomputing cursor positions.
|
|
14
|
+
const RERENDER_DELAY_MS = 500;
|
|
13
15
|
|
|
14
|
-
//
|
|
15
|
-
//
|
|
16
|
-
//
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
position: absolute;
|
|
20
|
-
top: 0;
|
|
21
|
-
left: 0;
|
|
22
|
-
width: 100%;
|
|
23
|
-
height: 100%;
|
|
24
|
-
pointer-events: none;
|
|
25
|
-
z-index: 20000;
|
|
26
|
-
}
|
|
27
|
-
.block-canvas-cover .collaborators-overlay-full {
|
|
28
|
-
position: absolute;
|
|
29
|
-
top: 0;
|
|
30
|
-
left: 0;
|
|
31
|
-
width: 100%;
|
|
32
|
-
height: 100%;
|
|
33
|
-
}
|
|
34
|
-
.block-canvas-cover .collaborators-overlay-fixed {
|
|
35
|
-
position: fixed;
|
|
36
|
-
width: 100%;
|
|
37
|
-
height: 100%;
|
|
38
|
-
}
|
|
39
|
-
.collaborators-overlay-user {
|
|
40
|
-
position: absolute;
|
|
41
|
-
}
|
|
42
|
-
.collaborators-overlay-user-cursor {
|
|
43
|
-
position: absolute;
|
|
44
|
-
width: 2px;
|
|
45
|
-
border-radius: 1px;
|
|
46
|
-
outline: 1px solid #fff;
|
|
47
|
-
box-shadow: ${ ELEVATION_X_SMALL };
|
|
48
|
-
animation: collaborators-overlay-cursor-blink 1s infinite;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/* ── Avatar component (compiled from packages/components/src/avatar/styles.scss) ── */
|
|
52
|
-
.components-avatar {
|
|
53
|
-
display: inline-flex;
|
|
54
|
-
align-items: center;
|
|
55
|
-
border-radius: 9999px;
|
|
56
|
-
overflow: clip;
|
|
57
|
-
flex-shrink: 0;
|
|
58
|
-
background-color: var(--wp-components-color-accent, var(--wp-admin-theme-color, #3858e9));
|
|
59
|
-
box-shadow: 0 0 0 var(--wp-admin-border-width-focus, 2px) #fff, ${ ELEVATION_X_SMALL };
|
|
60
|
-
}
|
|
61
|
-
.components-avatar__image {
|
|
62
|
-
box-sizing: border-box;
|
|
63
|
-
position: relative;
|
|
64
|
-
width: 32px;
|
|
65
|
-
height: 32px;
|
|
66
|
-
border-radius: 9999px;
|
|
67
|
-
border: 0;
|
|
68
|
-
background-color: var(--wp-components-color-accent, var(--wp-admin-theme-color, #3858e9));
|
|
69
|
-
overflow: clip;
|
|
70
|
-
flex-shrink: 0;
|
|
71
|
-
font-size: 0;
|
|
72
|
-
color: #fff;
|
|
73
|
-
}
|
|
74
|
-
.is-small > .components-avatar__image {
|
|
75
|
-
width: 24px;
|
|
76
|
-
height: 24px;
|
|
77
|
-
}
|
|
78
|
-
.has-src > .components-avatar__image {
|
|
79
|
-
background-image: var(--components-avatar-url);
|
|
80
|
-
background-size: cover;
|
|
81
|
-
background-position: center;
|
|
82
|
-
}
|
|
83
|
-
.has-avatar-border-color > .components-avatar__image {
|
|
84
|
-
border: var(--wp-admin-border-width-focus, 2px) solid var(--components-avatar-outline-color);
|
|
85
|
-
box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus, 2px) #fff;
|
|
86
|
-
background-clip: padding-box;
|
|
87
|
-
}
|
|
88
|
-
.components-avatar:not(.has-src) > .components-avatar__image {
|
|
89
|
-
display: flex;
|
|
90
|
-
align-items: center;
|
|
91
|
-
justify-content: center;
|
|
92
|
-
font-size: 11px;
|
|
93
|
-
font-weight: 499;
|
|
94
|
-
border: 0;
|
|
95
|
-
box-shadow: none;
|
|
96
|
-
background-clip: border-box;
|
|
97
|
-
}
|
|
98
|
-
.components-avatar:not(.has-src).has-avatar-border-color > .components-avatar__image {
|
|
99
|
-
background-color: var(--components-avatar-outline-color);
|
|
100
|
-
}
|
|
101
|
-
.components-avatar__name {
|
|
102
|
-
font-size: 13px;
|
|
103
|
-
line-height: 20px;
|
|
104
|
-
color: #fff;
|
|
105
|
-
min-width: 0;
|
|
106
|
-
padding-bottom: 2px;
|
|
107
|
-
overflow: hidden;
|
|
108
|
-
opacity: 0;
|
|
109
|
-
white-space: nowrap;
|
|
110
|
-
transition: opacity 0.15s cubic-bezier(0.15, 0, 0.15, 1);
|
|
111
|
-
}
|
|
112
|
-
.components-avatar.has-badge {
|
|
113
|
-
display: inline-grid;
|
|
114
|
-
grid-template-columns: min-content 0fr;
|
|
115
|
-
column-gap: 0;
|
|
116
|
-
padding-inline-end: 0;
|
|
117
|
-
transition:
|
|
118
|
-
grid-template-columns 0.3s cubic-bezier(0.15, 0, 0.15, 1),
|
|
119
|
-
column-gap 0.3s cubic-bezier(0.15, 0, 0.15, 1),
|
|
120
|
-
padding-inline-end 0.3s cubic-bezier(0.15, 0, 0.15, 1);
|
|
121
|
-
}
|
|
122
|
-
.components-avatar.has-badge:hover {
|
|
123
|
-
grid-template-columns: min-content 1fr;
|
|
124
|
-
column-gap: 4px;
|
|
125
|
-
padding-inline-end: 8px;
|
|
126
|
-
transition-timing-function: cubic-bezier(0.85, 0, 0.85, 1);
|
|
127
|
-
}
|
|
128
|
-
.components-avatar.has-badge:hover .components-avatar__name {
|
|
129
|
-
opacity: 1;
|
|
130
|
-
transition-timing-function: cubic-bezier(0.85, 0, 0.85, 1);
|
|
131
|
-
}
|
|
132
|
-
.components-avatar.has-badge.has-avatar-border-color {
|
|
133
|
-
background-color: var(--components-avatar-outline-color);
|
|
134
|
-
}
|
|
135
|
-
/* ── end Avatar ── */
|
|
136
|
-
|
|
137
|
-
/* Overlay-specific positioning applied to the Avatar cursor label. */
|
|
138
|
-
.collaborators-overlay-user-label.components-avatar {
|
|
139
|
-
position: absolute;
|
|
140
|
-
transform: translate(-11px, -100%);
|
|
141
|
-
margin-top: -4px;
|
|
142
|
-
pointer-events: auto;
|
|
143
|
-
overflow: visible;
|
|
144
|
-
width: max-content;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
@keyframes collaborators-overlay-cursor-blink {
|
|
148
|
-
0%, 45% { opacity: 1; }
|
|
149
|
-
55%, 95% { opacity: 0; }
|
|
150
|
-
100% { opacity: 1; }
|
|
151
|
-
}
|
|
152
|
-
.collaborators-overlay-cursor-highlighted .collaborators-overlay-user-cursor {
|
|
153
|
-
animation: collaborators-overlay-cursor-highlight 0.6s ease-in-out 3;
|
|
154
|
-
}
|
|
155
|
-
.collaborators-overlay-cursor-highlighted .collaborators-overlay-user-label {
|
|
156
|
-
animation: collaborators-overlay-label-highlight 0.6s ease-in-out 3;
|
|
157
|
-
}
|
|
158
|
-
@keyframes collaborators-overlay-cursor-highlight {
|
|
159
|
-
0%, 100% {
|
|
160
|
-
transform: scale(1);
|
|
161
|
-
filter: drop-shadow(0 0 0 transparent);
|
|
162
|
-
}
|
|
163
|
-
50% {
|
|
164
|
-
transform: scale(1.2);
|
|
165
|
-
filter: drop-shadow(0 0 8px currentColor);
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
@keyframes collaborators-overlay-label-highlight {
|
|
169
|
-
0%, 100% {
|
|
170
|
-
transform: translate(-11px, -100%) scale(1);
|
|
171
|
-
filter: drop-shadow(0 0 0 transparent);
|
|
172
|
-
}
|
|
173
|
-
50% {
|
|
174
|
-
transform: translate(-11px, -100%) scale(1.1);
|
|
175
|
-
filter: drop-shadow(0 0 6px currentColor);
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
.block-editor-block-list__block.is-collaborator-selected:not(:focus)::after {
|
|
179
|
-
content: "";
|
|
180
|
-
position: absolute;
|
|
181
|
-
pointer-events: none;
|
|
182
|
-
top: 0;
|
|
183
|
-
right: 0;
|
|
184
|
-
bottom: 0;
|
|
185
|
-
left: 0;
|
|
186
|
-
outline-color: var(--collaborator-outline-color);
|
|
187
|
-
outline-style: solid;
|
|
188
|
-
outline-width: calc(var(--wp-admin-border-width-focus) / var(--wp-block-editor-iframe-zoom-out-scale, 1));
|
|
189
|
-
outline-offset: calc(-1 * var(--wp-admin-border-width-focus) / var(--wp-block-editor-iframe-zoom-out-scale, 1));
|
|
190
|
-
box-shadow: inset 0 0 0 calc(var(--wp-admin-border-width-focus, 2px) + 1px) #fff, 0 0 0 1px #fff, ${ ELEVATION_X_SMALL };
|
|
191
|
-
z-index: 1;
|
|
192
|
-
}
|
|
193
|
-
@media (prefers-reduced-motion: reduce) {
|
|
194
|
-
.components-avatar.has-badge,
|
|
195
|
-
.components-avatar__name,
|
|
196
|
-
.collaborators-overlay-user-label,
|
|
197
|
-
.collaborators-overlay-user-cursor {
|
|
198
|
-
transition: none;
|
|
199
|
-
animation: none;
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
`;
|
|
16
|
+
// Periodically recompute cursor positions to account for DOM layout
|
|
17
|
+
// changes that don't trigger awareness state updates (e.g. a collaborator
|
|
18
|
+
// applying formatting shifts text but the cursor's logical position is
|
|
19
|
+
// unchanged). Only active when remote cursors are visible.
|
|
20
|
+
const CURSOR_REDRAW_INTERVAL_MS = 10_000;
|
|
203
21
|
|
|
204
22
|
interface OverlayProps {
|
|
205
23
|
blockEditorDocument?: Document;
|
|
206
24
|
postId: number | null;
|
|
207
25
|
postType: string | null;
|
|
26
|
+
cursorRegistry?: CursorRegistry;
|
|
208
27
|
}
|
|
209
28
|
|
|
210
29
|
/**
|
|
@@ -214,18 +33,15 @@ interface OverlayProps {
|
|
|
214
33
|
* @param props.blockEditorDocument - The block editor document.
|
|
215
34
|
* @param props.postId - The ID of the post.
|
|
216
35
|
* @param props.postType - The type of the post.
|
|
36
|
+
* @param props.cursorRegistry - The shared cursor registry.
|
|
217
37
|
* @return The Overlay component.
|
|
218
38
|
*/
|
|
219
39
|
export function Overlay( {
|
|
220
40
|
blockEditorDocument,
|
|
221
41
|
postId,
|
|
222
42
|
postType,
|
|
43
|
+
cursorRegistry,
|
|
223
44
|
}: OverlayProps ) {
|
|
224
|
-
useStyleOverride( {
|
|
225
|
-
id: 'collaborators-overlay',
|
|
226
|
-
css: COLLABORATORS_OVERLAY_STYLES,
|
|
227
|
-
} );
|
|
228
|
-
|
|
229
45
|
// Use state for the overlay element so that the hook re-runs once the ref is attached.
|
|
230
46
|
const [ overlayElement, setOverlayElement ] =
|
|
231
47
|
useState< HTMLDivElement | null >( null );
|
|
@@ -234,13 +50,46 @@ export function Overlay( {
|
|
|
234
50
|
overlayElement,
|
|
235
51
|
blockEditorDocument ?? null,
|
|
236
52
|
postId ?? null,
|
|
237
|
-
postType ?? null
|
|
53
|
+
postType ?? null,
|
|
54
|
+
RERENDER_DELAY_MS
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
const { highlights, rerenderHighlightsAfterDelay } = useBlockHighlighting(
|
|
58
|
+
overlayElement,
|
|
59
|
+
blockEditorDocument ?? null,
|
|
60
|
+
postId ?? null,
|
|
61
|
+
postType ?? null,
|
|
62
|
+
RERENDER_DELAY_MS
|
|
238
63
|
);
|
|
239
64
|
|
|
240
65
|
// Detect layout changes on overlay (e.g. turning on "Show Template") and window
|
|
241
|
-
// resizes, and re-render the cursors.
|
|
242
|
-
const
|
|
243
|
-
|
|
66
|
+
// resizes, and re-render the cursors and block highlights.
|
|
67
|
+
const onResize = useCallback( () => {
|
|
68
|
+
rerenderCursorsAfterDelay();
|
|
69
|
+
rerenderHighlightsAfterDelay();
|
|
70
|
+
}, [ rerenderCursorsAfterDelay, rerenderHighlightsAfterDelay ] );
|
|
71
|
+
const resizeObserverRef = useResizeObserver( onResize );
|
|
72
|
+
|
|
73
|
+
// Trigger the initial position computation on mount.
|
|
74
|
+
useEffect( () => {
|
|
75
|
+
const cleanupCursors = rerenderCursorsAfterDelay();
|
|
76
|
+
const cleanupHighlights = rerenderHighlightsAfterDelay();
|
|
77
|
+
return () => {
|
|
78
|
+
cleanupCursors();
|
|
79
|
+
cleanupHighlights();
|
|
80
|
+
};
|
|
81
|
+
}, [ rerenderCursorsAfterDelay, rerenderHighlightsAfterDelay ] );
|
|
82
|
+
|
|
83
|
+
useEffect( () => {
|
|
84
|
+
if ( cursors.length === 0 ) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return setDelayedInterval(
|
|
89
|
+
rerenderCursorsAfterDelay,
|
|
90
|
+
CURSOR_REDRAW_INTERVAL_MS
|
|
91
|
+
);
|
|
92
|
+
}, [ cursors.length, rerenderCursorsAfterDelay ] );
|
|
244
93
|
|
|
245
94
|
// Merge the refs to use the same element for both overlay and resize observation
|
|
246
95
|
const mergedRef = useMergeRefs< HTMLDivElement | null >( [
|
|
@@ -248,42 +97,109 @@ export function Overlay( {
|
|
|
248
97
|
resizeObserverRef,
|
|
249
98
|
] );
|
|
250
99
|
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
100
|
+
// Track cursor element refs for registry registration.
|
|
101
|
+
const cursorRefsMap = useRef< Map< number, HTMLElement > >( new Map() );
|
|
102
|
+
|
|
103
|
+
// Keep the registry in sync whenever the rendered cursors change.
|
|
104
|
+
useEffect( () => {
|
|
105
|
+
if ( ! cursorRegistry ) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
const refs = cursorRefsMap.current;
|
|
109
|
+
const currentIds = new Set( cursors.map( ( c ) => c.clientId ) );
|
|
110
|
+
|
|
111
|
+
// Unregister cursors that are no longer rendered.
|
|
112
|
+
for ( const id of refs.keys() ) {
|
|
113
|
+
if ( ! currentIds.has( id ) ) {
|
|
114
|
+
cursorRegistry.unregisterCursor( id );
|
|
115
|
+
refs.delete( id );
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// Register or update cursors that are currently rendered.
|
|
120
|
+
for ( const [ id, el ] of refs.entries() ) {
|
|
121
|
+
cursorRegistry.registerCursor( id, el );
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
return () => cursorRegistry.removeAll();
|
|
125
|
+
}, [ cursors, cursorRegistry ] );
|
|
126
|
+
|
|
127
|
+
// Callback ref factory to capture each cursor's DOM element.
|
|
128
|
+
const setCursorRef = useCallback(
|
|
129
|
+
( clientId: number ) => ( el: HTMLDivElement | null ) => {
|
|
130
|
+
if ( el ) {
|
|
131
|
+
cursorRefsMap.current.set( clientId, el );
|
|
132
|
+
} else {
|
|
133
|
+
cursorRefsMap.current.delete( clientId );
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
[]
|
|
255
137
|
);
|
|
256
138
|
|
|
257
139
|
// This is a full overlay that covers the entire iframe document. Good for
|
|
258
140
|
// scrollable elements like cursor indicators.
|
|
259
141
|
return (
|
|
260
142
|
<div className="collaborators-overlay-full" ref={ mergedRef }>
|
|
143
|
+
<style>{ AVATAR_IFRAME_STYLES + OVERLAY_IFRAME_STYLES }</style>
|
|
261
144
|
{ cursors.map( ( cursor ) => (
|
|
262
|
-
<div
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
145
|
+
<div key={ cursor.clientId }>
|
|
146
|
+
{ cursor.selectionRects?.map( ( rect, index ) => (
|
|
147
|
+
<div
|
|
148
|
+
key={ `${ cursor.clientId }-sel-${ index }` }
|
|
149
|
+
className="collaborators-overlay-selection-rect"
|
|
150
|
+
style={ {
|
|
151
|
+
left: `${ rect.x }px`,
|
|
152
|
+
top: `${ rect.y }px`,
|
|
153
|
+
width: `${ rect.width }px`,
|
|
154
|
+
height: `${ rect.height }px`,
|
|
155
|
+
backgroundColor: cursor.color,
|
|
156
|
+
} }
|
|
157
|
+
/>
|
|
158
|
+
) ) }
|
|
270
159
|
<div
|
|
271
|
-
|
|
160
|
+
ref={ setCursorRef( cursor.clientId ) }
|
|
161
|
+
className="collaborators-overlay-user"
|
|
272
162
|
style={ {
|
|
273
|
-
|
|
274
|
-
|
|
163
|
+
left: `${ cursor.x }px`,
|
|
164
|
+
top: `${ cursor.y }px`,
|
|
275
165
|
} }
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
166
|
+
>
|
|
167
|
+
{ ! cursor.isMe && (
|
|
168
|
+
<div
|
|
169
|
+
className="collaborators-overlay-user-cursor"
|
|
170
|
+
style={ {
|
|
171
|
+
backgroundColor: cursor.color,
|
|
172
|
+
height: `${ cursor.height }px`,
|
|
173
|
+
} }
|
|
174
|
+
/>
|
|
175
|
+
) }
|
|
176
|
+
<Avatar
|
|
177
|
+
className="collaborators-overlay-user-label"
|
|
178
|
+
variant="badge"
|
|
179
|
+
size="small"
|
|
180
|
+
src={ cursor.avatarUrl }
|
|
181
|
+
name={ cursor.userName }
|
|
182
|
+
label={ cursor.isMe ? __( 'You' ) : undefined }
|
|
183
|
+
borderColor={ cursor.color }
|
|
184
|
+
/>
|
|
185
|
+
</div>
|
|
285
186
|
</div>
|
|
286
187
|
) ) }
|
|
188
|
+
{ highlights.map( ( highlight ) => (
|
|
189
|
+
<Avatar
|
|
190
|
+
key={ highlight.blockId }
|
|
191
|
+
className="collaborators-overlay-block-label"
|
|
192
|
+
variant="badge"
|
|
193
|
+
size="small"
|
|
194
|
+
src={ highlight.avatarUrl }
|
|
195
|
+
name={ highlight.userName }
|
|
196
|
+
borderColor={ highlight.color }
|
|
197
|
+
style={ {
|
|
198
|
+
left: `${ highlight.x }px`,
|
|
199
|
+
top: `${ highlight.y }px`,
|
|
200
|
+
} }
|
|
201
|
+
/>
|
|
202
|
+
) ) }
|
|
287
203
|
</div>
|
|
288
204
|
);
|
|
289
205
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Like setInterval but chains setTimeout calls, so the delay is measured from
|
|
3
|
+
* the end of one run to the start of the next. This prevents callbacks from
|
|
4
|
+
* stacking up when the main thread is busy.
|
|
5
|
+
*
|
|
6
|
+
* @param callback The function to call repeatedly.
|
|
7
|
+
* @param delayMs Milliseconds between runs.
|
|
8
|
+
* @return A cleanup function that stops the timer.
|
|
9
|
+
*/
|
|
10
|
+
export function setDelayedInterval( callback: () => void, delayMs: number ) {
|
|
11
|
+
let timerHandle: ReturnType< typeof setTimeout > | null = null;
|
|
12
|
+
|
|
13
|
+
const runner = () => {
|
|
14
|
+
try {
|
|
15
|
+
callback();
|
|
16
|
+
} catch ( error ) {
|
|
17
|
+
// Do nothing
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
timerHandle = setTimeout( runner, delayMs );
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
timerHandle = setTimeout( runner, delayMs );
|
|
24
|
+
|
|
25
|
+
return () => {
|
|
26
|
+
if ( timerHandle ) {
|
|
27
|
+
clearTimeout( timerHandle );
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
}
|