-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Real-time Collaboration: Add user and selection information to awareness #74728
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 25 commits
816e55c
f81ed74
6e3eb80
2836b7e
cf05627
2c1d5cf
8772cb2
979e04a
e68cfde
77cad8f
0e12107
1b19ef1
215942c
4f37149
e9cc4bc
63a11d7
71c7741
f6a7cc0
45c439d
9200272
a2f7a09
d1066e9
96c6e6a
40bba56
9fb1542
266fd2c
2d6ca82
335f32f
4e6bff0
731eea5
e8af246
daa079a
fa964ed
ec820f4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,6 +26,7 @@ import { | |
| isNumericID, | ||
| } from './utils'; | ||
| import { fetchBlockPatterns } from './fetch'; | ||
| import { subscribeToUserSelectionChanges } from './utils/crdt-user-selections'; | ||
|
|
||
| /** | ||
| * Requests authors from the REST API. | ||
|
|
@@ -192,7 +193,7 @@ export const getEntityRecord = | |
| recordWithTransients, | ||
| { | ||
| // Handle edits sourced from the sync manager. | ||
| editRecord: ( edits ) => { | ||
| editRecord: ( edits, options = {} ) => { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is to allow for |
||
| if ( ! Object.keys( edits ).length ) { | ||
| return; | ||
| } | ||
|
|
@@ -206,6 +207,7 @@ export const getEntityRecord = | |
| meta: { | ||
| undo: undefined, | ||
| }, | ||
| options, | ||
| } ); | ||
| }, | ||
| // Get the current entity record (with edits) | ||
|
|
@@ -232,6 +234,23 @@ export const getEntityRecord = | |
| key | ||
| ); | ||
| }, | ||
| // Get the current user. | ||
| getCurrentUser: async () => { | ||
| await resolveSelect.getCurrentUser(); | ||
| }, | ||
| // Subscribe to user selection changes. | ||
| subscribeToUserSelectionChanges: ( | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the new way that selection changes are subscribed to. It takes in a setter, so that the |
||
| yDoc, | ||
| setSelectionState | ||
| ) => { | ||
| subscribeToUserSelectionChanges( | ||
| kind, | ||
| name, | ||
| key, | ||
| yDoc, | ||
| setSelectionState | ||
| ); | ||
| }, | ||
| } | ||
| ); | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noticed that the NodeJs.timeout was giving me errors and realized this wasn't there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's better to use the same version of this package (
@types/node) as used in other places in the monorepo. I have fixed it in #74950