Skip to content

feat: wip on integrating y-diff #1655

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

Draft
wants to merge 1 commit into
base: switch-ydocs
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/07-collaboration/01-partykit/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const doc = new Y.Doc();
const provider = new YPartyKitProvider(
"blocknote-dev.yousefed.partykit.dev",
// Use a unique name as a "room" for your application.
"your-project-name",
"your-project-name-nick",
doc
);

Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@
"canvas",
"esbuild",
"nx"
]
],
"overrides": {
"yjs": "^14.0.0-0"
}
},
"packageManager": "[email protected]+sha512.2d92c86b7928dc8284f53494fb4201f983da65f0fb4f0d40baafa5cf628fa31dae3e5968f12466f17df7e97310e30f343a648baea1b9b350685dafafffdf5808",
"private": true,
Expand Down
4 changes: 2 additions & 2 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@
"remark-stringify": "^11.0.0",
"unified": "^11.0.5",
"uuid": "^8.3.2",
"y-prosemirror": "^1.3.4",
"y-prosemirror": "npm:@y/[email protected]",
"y-protocols": "^1.0.6",
"yjs": "^13.6.15"
"yjs": "^14.0.0-0"
},
"devDependencies": {
"@types/emoji-mart": "^3.0.14",
Expand Down
11 changes: 11 additions & 0 deletions packages/core/src/editor/BlockNoteEditor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1017,6 +1017,17 @@ export class BlockNoteEditor<
// Copy the original document to a new Yjs document
Y.applyUpdate(doc, Y.encodeStateAsUpdate(originalFragment.doc!));

const update = Y.encodeStateAsUpdate(doc);
const blob = new Blob([update], { type: "application/octet-stream" });
const url = URL.createObjectURL(blob);
const a = document.createElement("a");
a.href = url;
a.download = `${Date.now()}.update`;
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
URL.revokeObjectURL(url);

// Find the forked fragment in the new Yjs document
const forkedFragment = this.findTypeInOtherYdoc(originalFragment, doc);

Expand Down
Loading
Loading