@slate-yjs/core 1.0.7 → 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/dist/applyToSlate/textEvent.d.ts.map +1 -1
- package/dist/index.cjs +16 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.global.js +16 -4
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +16 -4
- package/dist/index.js.map +1 -1
- package/dist/plugins/withYHistory.d.ts.map +1 -1
- package/dist/plugins/withYjs.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/applyToSlate/textEvent.ts +13 -5
- package/src/plugins/withYHistory.ts +6 -0
- package/src/plugins/withYjs.ts +5 -2
|
@@ -77,6 +77,12 @@ export function withYHistory<T extends YjsEditor>(
|
|
|
77
77
|
e.onChange = () => {
|
|
78
78
|
onChange();
|
|
79
79
|
|
|
80
|
+
// Before connect the shared root may not match the Slate tree yet.
|
|
81
|
+
if (!YjsEditor.connected(e)) {
|
|
82
|
+
LAST_SELECTION.delete(e);
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
|
|
80
86
|
LAST_SELECTION.set(
|
|
81
87
|
e,
|
|
82
88
|
e.selection && slateRangeToRelativeRange(e.sharedRoot, e, e.selection)
|
package/src/plugins/withYjs.ts
CHANGED
|
@@ -103,8 +103,11 @@ export const YjsEditor = {
|
|
|
103
103
|
withOrigin(editor: YjsEditor, origin: unknown, fn: () => void): void {
|
|
104
104
|
const prev = YjsEditor.origin(editor);
|
|
105
105
|
ORIGIN.set(editor, origin);
|
|
106
|
-
|
|
107
|
-
|
|
106
|
+
try {
|
|
107
|
+
fn();
|
|
108
|
+
} finally {
|
|
109
|
+
ORIGIN.set(editor, prev);
|
|
110
|
+
}
|
|
108
111
|
},
|
|
109
112
|
|
|
110
113
|
storePosition(editor: YjsEditor, key: string, point: Point): void {
|