diff --git a/lib/client/edit.js b/lib/client/edit.js index 7a4ec812..895290bb 100644 --- a/lib/client/edit.js +++ b/lib/client/edit.js @@ -95,8 +95,6 @@ var CloudCmd, Util, DOM, CloudFunc, MenuIO, edward; this.create = function(element) { Element = element; - edward.setPatchMaxSize(CloudFunc.MAX_FILE_SIZE); - edward.addCommand({ name : 'hide', bindKey : { win: 'Esc', mac: 'Esc' }, @@ -156,9 +154,14 @@ var CloudCmd, Util, DOM, CloudFunc, MenuIO, edward; Util.time(Name + ' load'); DOM.load.js(url, function() { + var options = { + maxSize : CloudFunc.MAX_FILE_SIZE, + prefix : CloudCmd.PREFIX + }; + Loading = false; - edward(element, function() { + edward(element, options, function() { Util.timeEnd(Name + ' load'); exec(callback); }); diff --git a/lib/client/edward.js b/lib/client/edward.js index 32026794..1438b054 100644 --- a/lib/client/edward.js +++ b/lib/client/edward.js @@ -13,18 +13,26 @@ var join, ace, load, Util, DOM, CloudCmd, Diff, io, Zip, Format, restafary; Emmet, Value, Config, + PREFIX, Element, FileName, Modelist, ElementMsg, JSHintConfig, - MAX_FILE_SIZE, - DIR = '/modules/', - Files = DOM.Files, - Storage = DOM.Storage, + DIR = '/modules/', + Files = DOM.Files, + Storage = DOM.Storage, + MAX_FILE_SIZE = 512000, - edward = function(el, callback) { + edward = function(el, options, callback) { + if (!options) { + callback = options; + } else { + MAX_FILE_SIZE = options.maxSize || 512000; + PREFIX = options.prefix || '/'; + } + Element = el || document.body; Element.addEventListener('drop', onDrop); @@ -196,12 +204,6 @@ var join, ace, load, Util, DOM, CloudCmd, Diff, io, Zip, Format, restafary; }); }; - edward.setPatchMaxSize = function(size) { - MAX_FILE_SIZE = size; - - return edward; - }; - edward.selectAll = function() { Ace.selectAll(); }; @@ -430,7 +432,7 @@ var join, ace, load, Util, DOM, CloudCmd, Diff, io, Zip, Format, restafary; } function setJsHintConfig(callback) { - var JSHINT_PATH = CloudCmd.PREFIX + '/.jshintrc', + var JSHINT_PATH = PREFIX + '/.jshintrc', func = function() { var session = edward.getSession(), worker = session.$worker;