diff --git a/lib/client/edit.js b/lib/client/edit.js index ee84e58c..9b776470 100644 --- a/lib/client/edit.js +++ b/lib/client/edit.js @@ -44,6 +44,8 @@ var CloudCmd, Util, DOM, CloudFunc, ace, DiffProto, diff_match_patch, Zip; Ace.moveCursorTo(0, 0); }; + Key.unsetBind(); + if (!Loading) { Images.showLoad(); @@ -105,19 +107,24 @@ var CloudCmd, Util, DOM, CloudFunc, ace, DiffProto, diff_match_patch, Zip; } }); - if (isStr) { - Ace.setValue(value); + + Util.ifExec(isStr, function() { + var UndoManager = ace.require("ace/undomanager").UndoManager; + + Ace.setValue(Value); CloudCmd.View.show(Element, focus); - Key.unsetBind(); - } else + + Session.setUndoManager(new UndoManager()); + }, function(callback) { Info.getData(function(data) { Value = data; - Ace.setValue(data); - CloudCmd.View.show(Element, focus); if (isJS && Session.getUseWorker()) setJsHintConfig(); + + callback(); }); + }); } };