@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
package/dist/index.global.js
CHANGED
|
@@ -10203,7 +10203,7 @@ ${err.toString()}`);
|
|
|
10203
10203
|
}
|
|
10204
10204
|
return length2;
|
|
10205
10205
|
}, 0);
|
|
10206
|
-
delta.reverse().forEach((change) => {
|
|
10206
|
+
[...delta].reverse().forEach((change) => {
|
|
10207
10207
|
var _a;
|
|
10208
10208
|
if ("attributes" in change && "retain" in change) {
|
|
10209
10209
|
const [startPathOffset, startTextOffset] = yOffsetToSlateOffsets(
|
|
@@ -10300,7 +10300,12 @@ ${err.toString()}`);
|
|
|
10300
10300
|
const childPath = [...slatePath, pathOffset];
|
|
10301
10301
|
if (Text.isText(child)) {
|
|
10302
10302
|
const lastOp = ops[ops.length - 1];
|
|
10303
|
-
|
|
10303
|
+
let currentProps = getProperties(child);
|
|
10304
|
+
if ((lastOp == null ? void 0 : lastOp.type) === "insert_node") {
|
|
10305
|
+
currentProps = lastOp.node;
|
|
10306
|
+
} else if ((lastOp == null ? void 0 : lastOp.type) === "set_node" && Path.equals(lastOp.path, childPath)) {
|
|
10307
|
+
currentProps = omitNullEntries(__spreadValues(__spreadValues({}, currentProps), lastOp.newProperties));
|
|
10308
|
+
}
|
|
10304
10309
|
let lastPath = [];
|
|
10305
10310
|
if (lastOp != null && (lastOp.type === "insert_node" || lastOp.type === "insert_text" || lastOp.type === "split_node" || lastOp.type === "set_node")) {
|
|
10306
10311
|
lastPath = lastOp.path;
|
|
@@ -10965,8 +10970,11 @@ ${err.toString()}`);
|
|
|
10965
10970
|
withOrigin(editor, origin, fn) {
|
|
10966
10971
|
const prev = YjsEditor.origin(editor);
|
|
10967
10972
|
ORIGIN.set(editor, origin);
|
|
10968
|
-
|
|
10969
|
-
|
|
10973
|
+
try {
|
|
10974
|
+
fn();
|
|
10975
|
+
} finally {
|
|
10976
|
+
ORIGIN.set(editor, prev);
|
|
10977
|
+
}
|
|
10970
10978
|
},
|
|
10971
10979
|
storePosition(editor, key, point) {
|
|
10972
10980
|
const { sharedRoot, positionStorageOrigin: locationStorageOrigin } = editor;
|
|
@@ -11137,6 +11145,10 @@ ${err.toString()}`);
|
|
|
11137
11145
|
const { onChange, isLocalOrigin } = e;
|
|
11138
11146
|
e.onChange = () => {
|
|
11139
11147
|
onChange();
|
|
11148
|
+
if (!YjsEditor.connected(e)) {
|
|
11149
|
+
LAST_SELECTION.delete(e);
|
|
11150
|
+
return;
|
|
11151
|
+
}
|
|
11140
11152
|
LAST_SELECTION.set(
|
|
11141
11153
|
e,
|
|
11142
11154
|
e.selection && slateRangeToRelativeRange(e.sharedRoot, e, e.selection)
|