Skip to content

Commit

Permalink
Add document initialization logic
Browse files Browse the repository at this point in the history
  • Loading branch information
JongBeom Lee committed Jan 31, 2024
1 parent 77c5812 commit 3546e18
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions frontend/src/utils/yorkie/yorkieSync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ class YorkieSyncPluginValue implements cmView.PluginValue {
});
});

this._doc.update((root) => {
if (root.content) return;
root.content = new yorkie.Text();
});

this._doc.subscribe("$.content", (event) => {
if (event.type !== "remote-change") return;

Expand Down

0 comments on commit 3546e18

Please sign in to comment.