Fix an issue with the cursor sometimes disappearing when a patch was received

Update CodeMirror to the latest version (5.13.2)
This commit is contained in:
Yann Flory
2016-04-11 15:47:40 +02:00
parent 713c90242b
commit c2e0dded3a
486 changed files with 41342 additions and 1824 deletions

View File

@@ -309,7 +309,6 @@ define([
var incomingPatch = function () {
if (isErrorState || initializing) { return; }
var textAreaVal = $(textArea).val();
console.log($(textArea).val());
userDocBeforePatch = userDocBeforePatch || textAreaVal;
if (userDocBeforePatch !== textAreaVal) {
//error(false, "userDocBeforePatch !== textAreaVal");
@@ -346,7 +345,8 @@ define([
}
$(textArea).val(newValue);
userDocBeforePatch = newValue;
cmEditor.setValue(newValue);
cmEditor.setCursor({line:0, ch:0});
try { cmEditor.setValue(newValue); } catch (err) { console.error(err); }
if(newCursor) {
cmEditor.setCursor(newCursor);
}