Skip to content

Commit

Permalink
patch yjs to get latest features
Browse files Browse the repository at this point in the history
  • Loading branch information
milomg committed Feb 5, 2025
1 parent 73ea5aa commit 762eccb
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 4 deletions.
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,10 @@
"vue-tsc": "^2.2.0",
"wasm-pack": "^0.13.1"
},
"packageManager": "[email protected]"
"packageManager": "[email protected]",
"pnpm": {
"patchedDependencies": {
"y-codemirror.next": "patches/y-codemirror.next.patch"
}
}
}
32 changes: 32 additions & 0 deletions patches/y-codemirror.next.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
diff --git a/dist/src/index.d.ts b/dist/src/index.d.ts
index c6fd0be505aea237910a171ef878506597a27702..a4a7f2f44b4b796e7f4fbc33876179801ec8d7fc 100644
--- a/dist/src/index.d.ts
+++ b/dist/src/index.d.ts
@@ -7,7 +7,8 @@ import { yRemoteSelectionsTheme } from "./y-remote-selections.js";
import { ySync } from "./y-sync.js";
import { ySyncFacet } from "./y-sync.js";
import { YSyncConfig } from "./y-sync.js";
+import { ySyncAnnotation } from "./y-sync.js";
import { yUndoManagerKeymap } from "./y-undomanager.js";
import * as Y from "yjs";
import * as cmState from "@codemirror/state";
-export { YRange, yRemoteSelections, yRemoteSelectionsTheme, ySync, ySyncFacet, YSyncConfig, yUndoManagerKeymap };
+export { YRange, yRemoteSelections, yRemoteSelectionsTheme, ySync, ySyncFacet, YSyncConfig, ySyncAnnotation, yUndoManagerKeymap };
diff --git a/src/index.js b/src/index.js
index b6fc948ff6b6813f1df66318d727cdccae65f0bf..3444ff75c8a0ff39e8c184fe1f57d31a7554fe7e 100644
--- a/src/index.js
+++ b/src/index.js
@@ -4,11 +4,11 @@ import * as cmView from '@codemirror/view'
import * as cmState from '@codemirror/state' // eslint-disable-line

import { YRange } from './y-range.js'
-import { ySync, ySyncFacet, YSyncConfig } from './y-sync.js'
+import { ySync, ySyncFacet, YSyncConfig, ySyncAnnotation } from './y-sync.js'
import { yRemoteSelections, yRemoteSelectionsTheme } from './y-remote-selections.js'
import { yUndoManager, yUndoManagerFacet, YUndoManagerConfig, undo, redo, yUndoManagerKeymap } from './y-undomanager.js'

-export { YRange, yRemoteSelections, yRemoteSelectionsTheme, ySync, ySyncFacet, YSyncConfig, yUndoManagerKeymap }
+export { YRange, yRemoteSelections, yRemoteSelectionsTheme, ySync, ySyncFacet, YSyncConfig, ySyncAnnotation, yUndoManagerKeymap }

/**
* @param {Y.Text} ytext
9 changes: 7 additions & 2 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion src/utils/lezer-mips/collab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { createState, EditorTab, Tabs } from '../tabs'
import { tabsState } from '../../state/state'
import { markRaw } from 'vue'
import { ChangeSpec, Compartment, Extension } from '@codemirror/state'
import { yCollab } from 'y-codemirror.next'
import { yCollab, ySync, ySyncAnnotation } from 'y-codemirror.next'
import { EditorView, ViewPlugin } from '@codemirror/view'
import { diff } from 'fast-myers-diff'

Expand Down Expand Up @@ -47,6 +47,7 @@ const syncPlugin = (ytext: Y.Text) =>
queueMicrotask(() => {
view.dispatch({
changes: changes,
annotations: [ySyncAnnotation.of(view.plugin(ySync)!.conf)],
})
})
}
Expand Down

0 comments on commit 762eccb

Please sign in to comment.