@seafile/sdoc-editor 2.0.88-test-0.0.2 → 2.0.88-test-0.0.4

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.
@@ -274,8 +274,25 @@ 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
- (0, _helper.setCursor)(editor, user, location, cursorData);
278
- console.log(4, location, cursorData, editor.cursors, editor.onCursor);
277
+ // Get front Point as cursor
278
+ var anchor = location.anchor,
279
+ focus = location.focus;
280
+ console.log(3, _slate.Editor.start(editor, location));
281
+ var newLocation = location;
282
+ if (!_slate.Point.equals(anchor, focus)) {
283
+ if (_slate.Point.compare(anchor, focus) === -1) {
284
+ newLocation = {
285
+ anchor: anchor,
286
+ focus: anchor
287
+ };
288
+ } else {
289
+ newLocation = {
290
+ anchor: focus,
291
+ focus: focus
292
+ };
293
+ }
294
+ }
295
+ (0, _helper.setCursor)(editor, user, newLocation, cursorData);
279
296
 
280
297
  // sync cursor position
281
298
  editor.onCursor && editor.onCursor(editor.cursors);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/sdoc-editor",
3
- "version": "2.0.88-test-0.0.2",
3
+ "version": "2.0.88-test-0.0.4",
4
4
  "main": "dist/index.js",
5
5
  "scripts": {
6
6
  "test": "jest",