From f79e1dfda02f5f632b07ec39b86fa4f3011f1e4a Mon Sep 17 00:00:00 2001 From: yflory Date: Tue, 16 Jan 2018 12:05:26 +0100 Subject: [PATCH] Fix a race condition that could wiped the content of coed and slide --- www/common/sframe-common-codemirror.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/www/common/sframe-common-codemirror.js b/www/common/sframe-common-codemirror.js index 7470d4547..ff6f817f9 100644 --- a/www/common/sframe-common-codemirror.js +++ b/www/common/sframe-common-codemirror.js @@ -141,7 +141,7 @@ define([ mode: defaultMode || "javascript", readOnly: true }); - editor.setValue(Messages.codeInitialState); + //editor.setValue(Messages.codeInitialState); editor.focus(); var setMode = exp.setMode = function (mode, cb) { @@ -311,7 +311,7 @@ define([ exp.contentUpdate = function (newContent) { - var oldDoc = canonicalize($textarea.val()); + var oldDoc = canonicalize(editor.getValue()); var remoteDoc = newContent.content; // setValueAndCursor triggers onLocal, even if we don't make any change to the content // and it may revert other changes (metadata) @@ -321,7 +321,7 @@ define([ exp.getContent = function () { editor.save(); - return { content: canonicalize($textarea.val()) }; + return { content: canonicalize(editor.getValue()) }; }; exp.mkFileManager = function (framework) {