This repository has been archived by the owner on Feb 6, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: # Facebook CoEditing Prototype relies on syncing the state of the editor between different users so that we can propagate changes between them and hence have the document state synced between users. **How DraftEntity Works** `DraftEntity`, when creating a new entity uses incremental numbers as the key ([source](https://github.com/facebook/draft-js/blob/master/src/model/entity/DraftEntity.js#L211)) which can be a problem as two users can simultaneously create entity with the same id, say `6`, with different links thereby causing the document sync to go out of sync. **Change** - This diff changes how the keys are generated for new entities. Instead of incremental integers, we create a unique ID (using `uuid()`) and use that as the ID. - Also exposes `getAll` and `loadWith..` functions that are used in subsequent diffs to get the map of entities and share them with other users and when a new updated map is received, load `DraftEntity` with that. (these changes have been tested already end to end at the top of the stack). Reviewed By: mrkev Differential Revision: D20495349 fbshipit-source-id: b65ba740b2c570318b6a471f47bdbf571acf1d5d
- Loading branch information
1 parent
7d3d3c8
commit 13989e3
Showing
23 changed files
with
464 additions
and
403 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.