diff --git a/lib/client/edit.js b/lib/client/edit.js index d0c8814c..51e197ea 100644 --- a/lib/client/edit.js +++ b/lib/client/edit.js @@ -50,7 +50,11 @@ var CloudCmd, Util, DOM, CloudFunc, io, ace, DiffProto, diff_match_patch, Zip, M callback(); }, function(callback) { - Edit.show(callback); + var element = createElement(); + + Edit.create(element) + .show(callback); + }, callback]); } @@ -141,8 +145,7 @@ var CloudCmd, Util, DOM, CloudFunc, io, ace, DiffProto, diff_match_patch, Zip, M } this.show = function(callback) { - var element = Edit.create(), - name = Info.name, + var name = Info.name, isDir = Info.isDir; Images.show.load(); @@ -160,7 +163,7 @@ var CloudCmd, Util, DOM, CloudFunc, io, ace, DiffProto, diff_match_patch, Zip, M alert(error); } else { Edit.setValue(data); - CloudCmd.View.show(element, ConfigView); + CloudCmd.View.show(Element, ConfigView); } }); @@ -235,7 +238,7 @@ var CloudCmd, Util, DOM, CloudFunc, io, ace, DiffProto, diff_match_patch, Zip, M if (!isEqual) { is = Dialog.confirm(msg); - t + if (is) Edit.save(); } @@ -279,9 +282,7 @@ var CloudCmd, Util, DOM, CloudFunc, io, ace, DiffProto, diff_match_patch, Zip, M Session.setUseWorker(isMatch); } - this.create = function() { - var element = createElement(); - + this.create = function(element) { Element = element; Ace = ace.edit(element); Session = Ace.getSession(); @@ -343,7 +344,7 @@ var CloudCmd, Util, DOM, CloudFunc, io, ace, DiffProto, diff_match_patch, Zip, M Ace.setOptions(options); }); - return element; + return this; }; Edit.save = function() {