Fix remote changes in codemirror hijacking cursor

pull/1/head
yflory 5 years ago
parent a973f907e5
commit 768dc71803

@ -62,15 +62,16 @@ define([
}); });
editor._noCursorUpdate = false; editor._noCursorUpdate = false;
editor.state.focused = true; editor.scrollTo(scroll.left, scroll.top);
if (!editor.state.focused) { return; }
if(selects[0] === selects[1]) { if(selects[0] === selects[1]) {
editor.setCursor(posToCursor(selects[0], remoteDoc)); editor.setCursor(posToCursor(selects[0], remoteDoc));
} }
else { else {
editor.setSelection(posToCursor(selects[0], remoteDoc), posToCursor(selects[1], remoteDoc)); editor.setSelection(posToCursor(selects[0], remoteDoc), posToCursor(selects[1], remoteDoc));
} }
editor.scrollTo(scroll.left, scroll.top);
}; };
module.getHeadingText = function (editor) { module.getHeadingText = function (editor) {

Loading…
Cancel
Save