From 8913daa21b49c77fc14d75441061920b57a59fca Mon Sep 17 00:00:00 2001 From: coderaiser Date: Thu, 8 Jan 2015 12:14:06 -0500 Subject: [PATCH] refactor(edit) create --- lib/client/edit.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) 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() {