@seafile/sdoc-editor 2.0.88-test-0.0.1 → 2.0.88-test-0.0.3
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/dist/socket/helpers.js +18 -2
- package/package.json +1 -1
package/dist/socket/helpers.js
CHANGED
|
@@ -274,8 +274,24 @@ var syncRemoteOperations = exports.syncRemoteOperations = function syncRemoteOpe
|
|
|
274
274
|
var syncRemoteCursorLocation = exports.syncRemoteCursorLocation = function syncRemoteCursorLocation(editor, user, location, cursorData) {
|
|
275
275
|
var currentUser = editor.user;
|
|
276
276
|
if (user && user.username !== currentUser.username) {
|
|
277
|
-
|
|
278
|
-
|
|
277
|
+
var anchor = location.anchor,
|
|
278
|
+
focus = location.focus;
|
|
279
|
+
var newLocation = location;
|
|
280
|
+
if (!_slate.Point.equals(anchor, focus)) {
|
|
281
|
+
if (_slate.Point.compare(anchor, focus) === -1) {
|
|
282
|
+
newLocation = {
|
|
283
|
+
anchor: anchor,
|
|
284
|
+
focus: anchor
|
|
285
|
+
};
|
|
286
|
+
} else {
|
|
287
|
+
newLocation = {
|
|
288
|
+
anchor: focus,
|
|
289
|
+
focus: focus
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
(0, _helper.setCursor)(editor, user, newLocation, cursorData);
|
|
294
|
+
console.log(4, newLocation, cursorData, editor.cursors, editor.onCursor);
|
|
279
295
|
|
|
280
296
|
// sync cursor position
|
|
281
297
|
editor.onCursor && editor.onCursor(editor.cursors);
|