diff --git a/dist/grapes.min.js b/dist/grapes.min.js index 61ed9eb3a..9bc5b0b39 100644 --- a/dist/grapes.min.js +++ b/dist/grapes.min.js @@ -1,3 +1,3 @@ /*! grapesjs - v0.3.10 */ -!function(a,b){"function"==typeof define&&define.amd?define([],b):"object"==typeof exports&&"object"==typeof module?module.exports=mod():a.grapesjs=a.GrapesJS=b()}(this,function(){var a,b,c;!function(d){function e(a,b){return u.call(a,b)}function f(a,b){var c,d,e,f,g,h,i,j,k,l,m,n=b&&b.split("/"),o=s.map,p=o&&o["*"]||{};if(a&&"."===a.charAt(0))if(b){for(a=a.split("/"),g=a.length-1,s.nodeIdCompat&&w.test(a[g])&&(a[g]=a[g].replace(w,"")),a=n.slice(0,n.length-1).concat(a),k=0;k0&&(a.splice(k-1,2),k-=2)}a=a.join("/")}else 0===a.indexOf("./")&&(a=a.substring(2));if((n||p)&&o){for(c=a.split("/"),k=c.length;k>0;k-=1){if(d=c.slice(0,k).join("/"),n)for(l=n.length;l>0;l-=1)if(e=o[n.slice(0,l).join("/")],e&&(e=e[d])){f=e,h=k;break}if(f)break;!i&&p&&p[d]&&(i=p[d],j=k)}!f&&i&&(f=i,h=j),f&&(c.splice(0,h,f),a=c.join("/"))}return a}function g(a,b){return function(){var c=v.call(arguments,0);return"string"!=typeof c[0]&&1===c.length&&c.push(null),n.apply(d,c.concat([a,b]))}}function h(a){return function(b){return f(b,a)}}function i(a){return function(b){q[a]=b}}function j(a){if(e(r,a)){var b=r[a];delete r[a],t[a]=!0,m.apply(d,b)}if(!e(q,a)&&!e(t,a))throw new Error("No "+a);return q[a]}function k(a){var b,c=a?a.indexOf("!"):-1;return c>-1&&(b=a.substring(0,c),a=a.substring(c+1,a.length)),[b,a]}function l(a){return function(){return s&&s.config&&s.config[a]||{}}}var m,n,o,p,q={},r={},s={},t={},u=Object.prototype.hasOwnProperty,v=[].slice,w=/\.js$/;o=function(a,b){var c,d=k(a),e=d[0];return a=d[1],e&&(e=f(e,b),c=j(e)),e?a=c&&c.normalize?c.normalize(a,h(b)):f(a,b):(a=f(a,b),d=k(a),e=d[0],a=d[1],e&&(c=j(e))),{f:e?e+"!"+a:a,n:a,pr:e,p:c}},p={require:function(a){return g(a)},exports:function(a){var b=q[a];return"undefined"!=typeof b?b:q[a]={}},module:function(a){return{id:a,uri:"",exports:q[a],config:l(a)}}},m=function(a,b,c,f){var h,k,l,m,n,s,u=[],v=typeof c;if(f=f||a,"undefined"===v||"function"===v){for(b=!b.length&&c.length?["require","exports","module"]:b,n=0;n
',attributes:{"class":"wte-fonts wte-f-b1"}},{id:"b2",label:"2 Blocks",content:'
',attributes:{"class":"wte-fonts wte-f-b2"}},{id:"b3",label:"3 Blocks",content:'
',attributes:{"class":"wte-fonts wte-f-b3"}},{id:"b4",label:"3/7 Block",content:'
',attributes:{"class":"wte-fonts wte-f-b37"}},{id:"hero",label:"Hero section",content:'
Build your templates without coding
Try it now
',attributes:{"class":"wte-fonts wte-f-hero"}},{id:"h1p",label:"Text section",content:'

Insert title here

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua

',attributes:{"class":"wte-fonts wte-f-h1p"}},{id:"3ba",label:"Badges",content:'
Adam Smith
CEO
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore ipsum dolor sit
ftln
John Black
Software Engineer
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore ipsum dolor sit
ftln
Jessica White
Web Designer
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore ipsum dolor sit
ftln
',attributes:{"class":"wte-fonts wte-f-3ba"}},{id:"text",label:"Text",attributes:{"class":"wte-fonts wte-f-text"},content:{type:"text",content:"Insert your text here",style:{padding:"10px"},activeOnRender:1}},{id:"image",label:"Image",attributes:{"class":"wte-fonts wte-f-image"},content:{type:"image",activeOnRender:1}},{id:"quo",label:"Quote",content:'
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore ipsum dolor sit
',attributes:{"class":"wte-fonts wte-f-quo"}}]},defaultCommand:"select-comp",showDevices:1,el:""};return a});var d=["backbone","backboneUndo","keymaster","Utils","StorageManager","DeviceManager","Parser","SelectorManager","ModalDialog","CodeManager","Panels","RichTextEditor","StyleManager","AssetManager","CssComposer","DomComponents","Canvas","Commands","BlockManager"];return c(d,function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s){return Backbone.Model.extend({defaults:{clipboard:null,selectedComponent:null,previousModel:null,changesCount:0,storables:[],device:""},initialize:function(a){this.config=a,this.set("Config",a),a.el&&a.fromElement&&(this.config.components=a.el.innerHTML);new p;this.loadModule(d),this.loadModule(e),this.loadModule(f),this.loadModule(g),this.loadModule(h),this.loadModule(i),this.loadModule(j),this.loadModule(k),this.loadModule(l),this.loadModule(m),this.loadModule(n),this.loadModule(o),this.loadModule(p),this.loadModule(q),this.loadModule(r),this.loadModule(s),this.initUndoManager(),this.on("change:selectedComponent",this.componentSelected,this)},loadModule:function(a){var b=this.config,c=new a,d=c.name.charAt(0).toLowerCase()+c.name.slice(1),e=b[d]||b[c.name]||{};e.pStylePrefix=b.stylePrefix||"";var f=this.get("StorageManager");if(c.storageKey&&c.store&&c.load&&f){e.stm=f;var g=this.get("storables");g.push(c),this.set("storables",g)}return e.em=this,c.init(e),c["private"]||this.set(c.name,c),c.onLoad&&c.onLoad(),this},init:function(a){this.set("Editor",a)},listenRules:function(a){this.stopListening(a,"add remove",this.listenRule),this.listenTo(a,"add remove",this.listenRule),a.each(function(a){this.listenRule(a)},this)},listenRule:function(a){this.stopListening(a,"change:style",this.ruleUpdated),this.listenTo(a,"change:style",this.ruleUpdated)},ruleUpdated:function(a,b,c){var d=this.get("changesCount")+1,e=c?c.avoidStore:0;this.set("changesCount",d);var f=this.get("StorageManager");f.isAutosave()&&dc;c++)b.pop();return b.add(a),this},getStyle:function(){return this.get("CssComposer").getRules()},getHtml:function(){var a=this.get("DomComponents"),b=this.get("CodeManager");if(a&&b){var c=a.getComponent();return b.getCode(c,"html")}},getCss:function(){var a=this.get("DomComponents"),b=this.get("CodeManager"),c=this.get("CssComposer");if(a&&b&&c){var d=a.getComponent();return b.getCode(d,"css",c)}},store:function(){var a=this.get("StorageManager"),b={};return a?(this.get("storables").forEach(function(a){var c=a.store(1);for(var d in c)b[d]=c[d]}),a.store(b),b):void 0},load:function(){var a=this.getCacheLoad(1);return this.get("storables").forEach(function(b){b.load(a)}),a},getCacheLoad:function(a){var b=a?1:0;if(this.cacheLoad&&!b)return this.cacheLoad;var c=this.get("StorageManager"),d=[];return c?(this.get("storables").forEach(function(a){var b=a.storageKey;b="function"==typeof b?b():b,keys=b instanceof Array?b:[b],keys.forEach(function(a){d.push(a)})}),this.cacheLoad=c.load(d),this.cacheLoad):{}},getDeviceModel:function(){var a=this.get("device");return this.get("DeviceManager").get(a)},runDefault:function(){var a=this.get("Commands").get(this.config.defaultCommand);a&&!this.defaultRunning&&(a.stop(this,this),a.run(this,this),this.defaultRunning=1)},stopDefault:function(){var a=this.get("Commands").get(this.config.defaultCommand);a&&(a.stop(this,this),this.defaultRunning=0)}})}),c("editor/model/Editor",function(){}),function(){function a(a){function b(b,c,d,e,f,g){for(;f>=0&&g>f;f+=a){var h=e?e[f]:f;d=c(d,b[h],h,b)}return d}return function(c,d,e,f){d=u(d,f,4);var g=!B(c)&&t.keys(c),h=(g||c).length,i=a>0?0:h-1;return arguments.length<3&&(e=c[g?g[i]:i],i+=a),b(c,d,e,g,i,h)}}function b(a){return function(b,c,d){c=v(c,d);for(var e=A(b),f=a>0?0:e-1;f>=0&&e>f;f+=a)if(c(b[f],f,b))return f;return-1}}function d(a,b,c){return function(d,e,f){var g=0,h=A(d);if("number"==typeof f)a>0?g=f>=0?f:Math.max(f+h,g):h=f>=0?Math.min(f+1,h):f+h+1;else if(c&&f&&h)return f=c(d,e),d[f]===e?f:-1;if(e!==e)return f=b(l.call(d,g,h),t.isNaN),f>=0?f+g:-1;for(f=a>0?g:h-1;f>=0&&h>f;f+=a)if(d[f]===e)return f;return-1}}function e(a,b){var c=G.length,d=a.constructor,e=t.isFunction(d)&&d.prototype||i,f="constructor";for(t.has(a,f)&&!t.contains(b,f)&&b.push(f);c--;)f=G[c],f in a&&a[f]!==e[f]&&!t.contains(b,f)&&b.push(f)}var f=this,g=f._,h=Array.prototype,i=Object.prototype,j=Function.prototype,k=h.push,l=h.slice,m=i.toString,n=i.hasOwnProperty,o=Array.isArray,p=Object.keys,q=j.bind,r=Object.create,s=function(){},t=function(a){return a instanceof t?a:this instanceof t?void(this._wrapped=a):new t(a)};"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=t),exports._=t):f._=t,t.VERSION="1.8.3";var u=function(a,b,c){if(void 0===b)return a;switch(null==c?3:c){case 1:return function(c){return a.call(b,c)};case 2:return function(c,d){return a.call(b,c,d)};case 3:return function(c,d,e){return a.call(b,c,d,e)};case 4:return function(c,d,e,f){return a.call(b,c,d,e,f)}}return function(){return a.apply(b,arguments)}},v=function(a,b,c){return null==a?t.identity:t.isFunction(a)?u(a,b,c):t.isObject(a)?t.matcher(a):t.property(a)};t.iteratee=function(a,b){return v(a,b,1/0)};var w=function(a,b){return function(c){var d=arguments.length;if(2>d||null==c)return c;for(var e=1;d>e;e++)for(var f=arguments[e],g=a(f),h=g.length,i=0;h>i;i++){var j=g[i];b&&void 0!==c[j]||(c[j]=f[j])}return c}},x=function(a){if(!t.isObject(a))return{};if(r)return r(a);s.prototype=a;var b=new s;return s.prototype=null,b},y=function(a){return function(b){return null==b?void 0:b[a]}},z=Math.pow(2,53)-1,A=y("length"),B=function(a){var b=A(a);return"number"==typeof b&&b>=0&&z>=b};t.each=t.forEach=function(a,b,c){b=u(b,c);var d,e;if(B(a))for(d=0,e=a.length;e>d;d++)b(a[d],d,a);else{var f=t.keys(a);for(d=0,e=f.length;e>d;d++)b(a[f[d]],f[d],a)}return a},t.map=t.collect=function(a,b,c){b=v(b,c);for(var d=!B(a)&&t.keys(a),e=(d||a).length,f=Array(e),g=0;e>g;g++){var h=d?d[g]:g;f[g]=b(a[h],h,a)}return f},t.reduce=t.foldl=t.inject=a(1),t.reduceRight=t.foldr=a(-1),t.find=t.detect=function(a,b,c){var d;return d=B(a)?t.findIndex(a,b,c):t.findKey(a,b,c),void 0!==d&&-1!==d?a[d]:void 0},t.filter=t.select=function(a,b,c){var d=[];return b=v(b,c),t.each(a,function(a,c,e){b(a,c,e)&&d.push(a)}),d},t.reject=function(a,b,c){return t.filter(a,t.negate(v(b)),c)},t.every=t.all=function(a,b,c){b=v(b,c);for(var d=!B(a)&&t.keys(a),e=(d||a).length,f=0;e>f;f++){var g=d?d[f]:f;if(!b(a[g],g,a))return!1}return!0},t.some=t.any=function(a,b,c){b=v(b,c);for(var d=!B(a)&&t.keys(a),e=(d||a).length,f=0;e>f;f++){var g=d?d[f]:f;if(b(a[g],g,a))return!0}return!1},t.contains=t.includes=t.include=function(a,b,c,d){return B(a)||(a=t.values(a)),("number"!=typeof c||d)&&(c=0),t.indexOf(a,b,c)>=0},t.invoke=function(a,b){var c=l.call(arguments,2),d=t.isFunction(b);return t.map(a,function(a){var e=d?b:a[b];return null==e?e:e.apply(a,c)})},t.pluck=function(a,b){return t.map(a,t.property(b))},t.where=function(a,b){return t.filter(a,t.matcher(b))},t.findWhere=function(a,b){return t.find(a,t.matcher(b))},t.max=function(a,b,c){var d,e,f=-1/0,g=-1/0;if(null==b&&null!=a){a=B(a)?a:t.values(a);for(var h=0,i=a.length;i>h;h++)d=a[h],d>f&&(f=d)}else b=v(b,c),t.each(a,function(a,c,d){e=b(a,c,d),(e>g||e===-1/0&&f===-1/0)&&(f=a,g=e)});return f},t.min=function(a,b,c){var d,e,f=1/0,g=1/0;if(null==b&&null!=a){a=B(a)?a:t.values(a);for(var h=0,i=a.length;i>h;h++)d=a[h],f>d&&(f=d)}else b=v(b,c),t.each(a,function(a,c,d){e=b(a,c,d),(g>e||1/0===e&&1/0===f)&&(f=a,g=e)});return f},t.shuffle=function(a){for(var b,c=B(a)?a:t.values(a),d=c.length,e=Array(d),f=0;d>f;f++)b=t.random(0,f),b!==f&&(e[f]=e[b]),e[b]=c[f];return e},t.sample=function(a,b,c){return null==b||c?(B(a)||(a=t.values(a)),a[t.random(a.length-1)]):t.shuffle(a).slice(0,Math.max(0,b))},t.sortBy=function(a,b,c){return b=v(b,c),t.pluck(t.map(a,function(a,c,d){return{value:a,index:c,criteria:b(a,c,d)}}).sort(function(a,b){var c=a.criteria,d=b.criteria;if(c!==d){if(c>d||void 0===c)return 1;if(d>c||void 0===d)return-1}return a.index-b.index}),"value")};var C=function(a){return function(b,c,d){var e={};return c=v(c,d),t.each(b,function(d,f){var g=c(d,f,b);a(e,d,g)}),e}};t.groupBy=C(function(a,b,c){t.has(a,c)?a[c].push(b):a[c]=[b]}),t.indexBy=C(function(a,b,c){a[c]=b}),t.countBy=C(function(a,b,c){t.has(a,c)?a[c]++:a[c]=1}),t.toArray=function(a){return a?t.isArray(a)?l.call(a):B(a)?t.map(a,t.identity):t.values(a):[]},t.size=function(a){return null==a?0:B(a)?a.length:t.keys(a).length},t.partition=function(a,b,c){b=v(b,c);var d=[],e=[];return t.each(a,function(a,c,f){(b(a,c,f)?d:e).push(a)}),[d,e]},t.first=t.head=t.take=function(a,b,c){return null==a?void 0:null==b||c?a[0]:t.initial(a,a.length-b)},t.initial=function(a,b,c){return l.call(a,0,Math.max(0,a.length-(null==b||c?1:b)))},t.last=function(a,b,c){return null==a?void 0:null==b||c?a[a.length-1]:t.rest(a,Math.max(0,a.length-b))},t.rest=t.tail=t.drop=function(a,b,c){return l.call(a,null==b||c?1:b)},t.compact=function(a){return t.filter(a,t.identity)};var D=function(a,b,c,d){for(var e=[],f=0,g=d||0,h=A(a);h>g;g++){var i=a[g];if(B(i)&&(t.isArray(i)||t.isArguments(i))){b||(i=D(i,b,c));var j=0,k=i.length;for(e.length+=k;k>j;)e[f++]=i[j++]}else c||(e[f++]=i)}return e};t.flatten=function(a,b){return D(a,b,!1)},t.without=function(a){return t.difference(a,l.call(arguments,1))},t.uniq=t.unique=function(a,b,c,d){t.isBoolean(b)||(d=c,c=b,b=!1),null!=c&&(c=v(c,d));for(var e=[],f=[],g=0,h=A(a);h>g;g++){var i=a[g],j=c?c(i,g,a):i;b?(g&&f===j||e.push(i),f=j):c?t.contains(f,j)||(f.push(j),e.push(i)):t.contains(e,i)||e.push(i)}return e},t.union=function(){return t.uniq(D(arguments,!0,!0))},t.intersection=function(a){for(var b=[],c=arguments.length,d=0,e=A(a);e>d;d++){var f=a[d];if(!t.contains(b,f)){for(var g=1;c>g&&t.contains(arguments[g],f);g++);g===c&&b.push(f)}}return b},t.difference=function(a){var b=D(arguments,!0,!0,1);return t.filter(a,function(a){return!t.contains(b,a)})},t.zip=function(){return t.unzip(arguments)},t.unzip=function(a){for(var b=a&&t.max(a,A).length||0,c=Array(b),d=0;b>d;d++)c[d]=t.pluck(a,d);return c},t.object=function(a,b){for(var c={},d=0,e=A(a);e>d;d++)b?c[a[d]]=b[d]:c[a[d][0]]=a[d][1];return c},t.findIndex=b(1),t.findLastIndex=b(-1),t.sortedIndex=function(a,b,c,d){c=v(c,d,1);for(var e=c(b),f=0,g=A(a);g>f;){var h=Math.floor((f+g)/2);c(a[h])f;f++,a+=c)e[f]=a;return e};var E=function(a,b,c,d,e){if(!(d instanceof b))return a.apply(c,e);var f=x(a.prototype),g=a.apply(f,e);return t.isObject(g)?g:f};t.bind=function(a,b){if(q&&a.bind===q)return q.apply(a,l.call(arguments,1));if(!t.isFunction(a))throw new TypeError("Bind must be called on a function");var c=l.call(arguments,2),d=function(){return E(a,d,b,this,c.concat(l.call(arguments)))};return d},t.partial=function(a){var b=l.call(arguments,1),c=function(){for(var d=0,e=b.length,f=Array(e),g=0;e>g;g++)f[g]=b[g]===t?arguments[d++]:b[g];for(;d=d)throw new Error("bindAll must be passed function names");for(b=1;d>b;b++)c=arguments[b],a[c]=t.bind(a[c],a);return a},t.memoize=function(a,b){var c=function(d){var e=c.cache,f=""+(b?b.apply(this,arguments):d);return t.has(e,f)||(e[f]=a.apply(this,arguments)),e[f]};return c.cache={},c},t.delay=function(a,b){var c=l.call(arguments,2);return setTimeout(function(){return a.apply(null,c)},b)},t.defer=t.partial(t.delay,t,1),t.throttle=function(a,b,c){var d,e,f,g=null,h=0;c||(c={});var i=function(){h=c.leading===!1?0:t.now(),g=null,f=a.apply(d,e),g||(d=e=null)};return function(){var j=t.now();h||c.leading!==!1||(h=j);var k=b-(j-h);return d=this,e=arguments,0>=k||k>b?(g&&(clearTimeout(g),g=null),h=j,f=a.apply(d,e),g||(d=e=null)):g||c.trailing===!1||(g=setTimeout(i,k)),f}},t.debounce=function(a,b,c){var d,e,f,g,h,i=function(){var j=t.now()-g;b>j&&j>=0?d=setTimeout(i,b-j):(d=null,c||(h=a.apply(f,e),d||(f=e=null)))};return function(){f=this,e=arguments,g=t.now();var j=c&&!d;return d||(d=setTimeout(i,b)),j&&(h=a.apply(f,e),f=e=null),h}},t.wrap=function(a,b){return t.partial(b,a)},t.negate=function(a){return function(){return!a.apply(this,arguments)}},t.compose=function(){var a=arguments,b=a.length-1;return function(){for(var c=b,d=a[b].apply(this,arguments);c--;)d=a[c].call(this,d);return d}},t.after=function(a,b){return function(){return--a<1?b.apply(this,arguments):void 0}},t.before=function(a,b){var c;return function(){return--a>0&&(c=b.apply(this,arguments)),1>=a&&(b=null),c}},t.once=t.partial(t.before,2);var F=!{toString:null}.propertyIsEnumerable("toString"),G=["valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"];t.keys=function(a){if(!t.isObject(a))return[];if(p)return p(a);var b=[];for(var c in a)t.has(a,c)&&b.push(c);return F&&e(a,b),b},t.allKeys=function(a){if(!t.isObject(a))return[];var b=[];for(var c in a)b.push(c);return F&&e(a,b),b},t.values=function(a){for(var b=t.keys(a),c=b.length,d=Array(c),e=0;c>e;e++)d[e]=a[b[e]];return d},t.mapObject=function(a,b,c){b=v(b,c);for(var d,e=t.keys(a),f=e.length,g={},h=0;f>h;h++)d=e[h],g[d]=b(a[d],d,a);return g},t.pairs=function(a){for(var b=t.keys(a),c=b.length,d=Array(c),e=0;c>e;e++)d[e]=[b[e],a[b[e]]];return d},t.invert=function(a){for(var b={},c=t.keys(a),d=0,e=c.length;e>d;d++)b[a[c[d]]]=c[d];return b},t.functions=t.methods=function(a){var b=[];for(var c in a)t.isFunction(a[c])&&b.push(c);return b.sort()},t.extend=w(t.allKeys),t.extendOwn=t.assign=w(t.keys),t.findKey=function(a,b,c){b=v(b,c);for(var d,e=t.keys(a),f=0,g=e.length;g>f;f++)if(d=e[f],b(a[d],d,a))return d},t.pick=function(a,b,c){var d,e,f={},g=a;if(null==g)return f;t.isFunction(b)?(e=t.allKeys(g),d=u(b,c)):(e=D(arguments,!1,!1,1),d=function(a,b,c){return b in c},g=Object(g));for(var h=0,i=e.length;i>h;h++){var j=e[h],k=g[j];d(k,j,g)&&(f[j]=k)}return f},t.omit=function(a,b,c){if(t.isFunction(b))b=t.negate(b);else{var d=t.map(D(arguments,!1,!1,1),String);b=function(a,b){return!t.contains(d,b)}}return t.pick(a,b,c)},t.defaults=w(t.allKeys,!0),t.create=function(a,b){var c=x(a);return b&&t.extendOwn(c,b),c},t.clone=function(a){return t.isObject(a)?t.isArray(a)?a.slice():t.extend({},a):a},t.tap=function(a,b){return b(a),a},t.isMatch=function(a,b){var c=t.keys(b),d=c.length;if(null==a)return!d;for(var e=Object(a),f=0;d>f;f++){var g=c[f];if(b[g]!==e[g]||!(g in e))return!1}return!0};var H=function(a,b,c,d){if(a===b)return 0!==a||1/a===1/b;if(null==a||null==b)return a===b;a instanceof t&&(a=a._wrapped),b instanceof t&&(b=b._wrapped);var e=m.call(a);if(e!==m.call(b))return!1;switch(e){case"[object RegExp]":case"[object String]":return""+a==""+b;case"[object Number]":return+a!==+a?+b!==+b:0===+a?1/+a===1/b:+a===+b;case"[object Date]":case"[object Boolean]":return+a===+b}var f="[object Array]"===e;if(!f){if("object"!=typeof a||"object"!=typeof b)return!1;var g=a.constructor,h=b.constructor;if(g!==h&&!(t.isFunction(g)&&g instanceof g&&t.isFunction(h)&&h instanceof h)&&"constructor"in a&&"constructor"in b)return!1}c=c||[],d=d||[];for(var i=c.length;i--;)if(c[i]===a)return d[i]===b;if(c.push(a),d.push(b),f){if(i=a.length,i!==b.length)return!1;for(;i--;)if(!H(a[i],b[i],c,d))return!1}else{var j,k=t.keys(a);if(i=k.length,t.keys(b).length!==i)return!1;for(;i--;)if(j=k[i],!t.has(b,j)||!H(a[j],b[j],c,d))return!1}return c.pop(),d.pop(),!0};t.isEqual=function(a,b){return H(a,b)},t.isEmpty=function(a){return null==a?!0:B(a)&&(t.isArray(a)||t.isString(a)||t.isArguments(a))?0===a.length:0===t.keys(a).length},t.isElement=function(a){return!(!a||1!==a.nodeType)},t.isArray=o||function(a){return"[object Array]"===m.call(a)},t.isObject=function(a){var b=typeof a;return"function"===b||"object"===b&&!!a},t.each(["Arguments","Function","String","Number","Date","RegExp","Error"],function(a){t["is"+a]=function(b){return m.call(b)==="[object "+a+"]"}}),t.isArguments(arguments)||(t.isArguments=function(a){return t.has(a,"callee")}),"function"!=typeof/./&&"object"!=typeof Int8Array&&(t.isFunction=function(a){return"function"==typeof a||!1}),t.isFinite=function(a){return isFinite(a)&&!isNaN(parseFloat(a))},t.isNaN=function(a){return t.isNumber(a)&&a!==+a},t.isBoolean=function(a){return a===!0||a===!1||"[object Boolean]"===m.call(a)},t.isNull=function(a){return null===a},t.isUndefined=function(a){return void 0===a},t.has=function(a,b){return null!=a&&n.call(a,b)},t.noConflict=function(){return f._=g,this},t.identity=function(a){return a},t.constant=function(a){return function(){return a}},t.noop=function(){},t.property=y,t.propertyOf=function(a){return null==a?function(){}:function(b){return a[b]}},t.matcher=t.matches=function(a){return a=t.extendOwn({},a),function(b){return t.isMatch(b,a)}},t.times=function(a,b,c){var d=Array(Math.max(0,a));b=u(b,c,1);for(var e=0;a>e;e++)d[e]=b(e);return d},t.random=function(a,b){return null==b&&(b=a,a=0),a+Math.floor(Math.random()*(b-a+1))},t.now=Date.now||function(){return(new Date).getTime()};var I={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},J=t.invert(I),K=function(a){var b=function(b){return a[b]},c="(?:"+t.keys(a).join("|")+")",d=RegExp(c),e=RegExp(c,"g");return function(a){return a=null==a?"":""+a,d.test(a)?a.replace(e,b):a}};t.escape=K(I),t.unescape=K(J),t.result=function(a,b,c){var d=null==a?void 0:a[b];return void 0===d&&(d=c),t.isFunction(d)?d.call(a):d};var L=0;t.uniqueId=function(a){var b=++L+"";return a?a+b:b},t.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var M=/(.)^/,N={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},O=/\\|'|\r|\n|\u2028|\u2029/g,P=function(a){return"\\"+N[a]};t.template=function(a,b,c){!b&&c&&(b=c),b=t.defaults({},b,t.templateSettings);var d=RegExp([(b.escape||M).source,(b.interpolate||M).source,(b.evaluate||M).source].join("|")+"|$","g"),e=0,f="__p+='";a.replace(d,function(b,c,d,g,h){return f+=a.slice(e,h).replace(O,P),e=h+b.length,c?f+="'+\n((__t=("+c+"))==null?'':_.escape(__t))+\n'":d?f+="'+\n((__t=("+d+"))==null?'':__t)+\n'":g&&(f+="';\n"+g+"\n__p+='"),b}),f+="';\n",b.variable||(f="with(obj||{}){\n"+f+"}\n"),f="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+f+"return __p;\n";try{var g=new Function(b.variable||"obj","_",f)}catch(h){throw h.source=f,h}var i=function(a){return g.call(this,a,t)},j=b.variable||"obj";return i.source="function("+j+"){\n"+f+"}",i},t.chain=function(a){var b=t(a);return b._chain=!0,b};var Q=function(a,b){return a._chain?t(b).chain():b};t.mixin=function(a){t.each(t.functions(a),function(b){var c=t[b]=a[b];t.prototype[b]=function(){var a=[this._wrapped];return k.apply(a,arguments),Q(this,c.apply(t,a))}})},t.mixin(t),t.each(["pop","push","reverse","shift","sort","splice","unshift"],function(a){var b=h[a];t.prototype[a]=function(){var c=this._wrapped;return b.apply(c,arguments),"shift"!==a&&"splice"!==a||0!==c.length||delete c[0],Q(this,c)}}),t.each(["concat","join","slice"],function(a){var b=h[a];t.prototype[a]=function(){return Q(this,b.apply(this._wrapped,arguments))}}),t.prototype.value=function(){return this._wrapped},t.prototype.valueOf=t.prototype.toJSON=t.prototype.value,t.prototype.toString=function(){return""+this._wrapped},"function"==typeof c&&c.amd&&c("underscore",[],function(){return t})}.call(this),c("jquery",[],function(){return jQuery}),function(a){var d="object"==typeof self&&self.self==self&&self||"object"==typeof global&&global.global==global&&global;if("function"==typeof c&&c.amd)c("backbone",["underscore","jquery","exports"],function(b,c,e){d.Backbone=a(d,e,b,c)});else if("undefined"!=typeof exports){var e,f=b("underscore");try{e=b("jquery")}catch(g){}a(d,exports,f,e)}else d.Backbone=a(d,{},d._,d.jQuery||d.Zepto||d.ender||d.$)}(function(a,b,c,d){var e=a.Backbone,f=Array.prototype.slice;b.VERSION="1.2.3",b.$=d,b.noConflict=function(){return a.Backbone=e,this},b.emulateHTTP=!1,b.emulateJSON=!1;var g=function(a,b,d){switch(a){case 1:return function(){return c[b](this[d])};case 2:return function(a){return c[b](this[d],a)};case 3:return function(a,e){return c[b](this[d],i(a,this),e)};case 4:return function(a,e,f){return c[b](this[d],i(a,this),e,f)};default:return function(){var a=f.call(arguments);return a.unshift(this[d]),c[b].apply(c,a)}}},h=function(a,b,d){c.each(b,function(b,e){c[e]&&(a.prototype[e]=g(b,e,d))})},i=function(a,b){return c.isFunction(a)?a:c.isObject(a)&&!b._isModel(a)?j(a):c.isString(a)?function(b){return b.get(a)}:a},j=function(a){ -var b=c.matches(a);return function(a){return b(a.attributes)}},k=b.Events={},l=/\s+/,m=function(a,b,d,e,f){var g,h=0;if(d&&"object"==typeof d){void 0!==e&&"context"in f&&void 0===f.context&&(f.context=e);for(g=c.keys(d);hd;d++)c[d]=arguments[d+1];return m(r,this._events,a,void 0,c),this};var r=function(a,b,c,d){if(a){var e=a[b],f=a.all;e&&f&&(f=f.slice()),e&&s(e,d),f&&s(f,[b].concat(d))}return a},s=function(a,b){var c,d=-1,e=a.length,f=b[0],g=b[1],h=b[2];switch(b.length){case 0:for(;++df;f++)a[f+c]=b[f];for(f=0;fe&&(e+=this.length+1);for(var f,g=[],h=[],i=[],j={},k=b.add,l=b.merge,m=b.remove,n=!1,o=this.comparator&&null==e&&b.sort!==!1,p=c.isString(this.comparator)?this.comparator:null,q=0;qa&&(a+=this.length),this.models[a]},where:function(a,b){return this[b?"find":"filter"](a)},findWhere:function(a){return this.where(a,!0)},sort:function(a){var b=this.comparator;if(!b)throw new Error("Cannot sort a set without a comparator");a||(a={});var d=b.length;return c.isFunction(b)&&(b=c.bind(b,this)),1===d||c.isString(b)?this.models=this.sortBy(b):this.models.sort(b),a.silent||this.trigger("sort",this,a),this},pluck:function(a){return c.invoke(this.models,"get",a)},fetch:function(a){a=c.extend({parse:!0},a);var b=a.success,d=this;return a.success=function(c){var e=a.reset?"reset":"set";d[e](c,a),b&&b.call(a.context,d,c,a),d.trigger("sync",d,c,a)},P(this,a),this.sync("read",this,a)},create:function(a,b){b=b?c.clone(b):{};var d=b.wait;if(a=this._prepareModel(a,b),!a)return!1;d||this.add(a,b);var e=this,f=b.success;return b.success=function(a,b,c){d&&e.add(a,c),f&&f.call(c.context,a,b,c)},a.save(null,b),a},parse:function(a,b){return a},clone:function(){return new this.constructor(this.models,{model:this.model,comparator:this.comparator})},modelId:function(a){return a[this.model.prototype.idAttribute||"id"]},_reset:function(){this.length=0,this.models=[],this._byId={}},_prepareModel:function(a,b){if(this._isModel(a))return a.collection||(a.collection=this),a;b=b?c.clone(b):{},b.collection=this;var d=new this.model(a,b);return d.validationError?(this.trigger("invalid",this,d.validationError,b),!1):d},_removeModels:function(a,b){for(var c=[],d=0;d7),this._useHashChange=this._wantsHashChange&&this._hasHashChange,this._wantsPushState=!!this.options.pushState,this._hasPushState=!(!this.history||!this.history.pushState),this._usePushState=this._wantsPushState&&this._hasPushState,this.fragment=this.getFragment(),this.root=("/"+this.root+"/").replace(L,"/"),this._wantsHashChange&&this._wantsPushState){if(!this._hasPushState&&!this.atRoot()){var b=this.root.slice(0,-1)||"/";return this.location.replace(b+"#"+this.getPath()),!0}this._hasPushState&&this.atRoot()&&this.navigate(this.getHash(),{replace:!0})}if(!this._hasHashChange&&this._wantsHashChange&&!this._usePushState){this.iframe=document.createElement("iframe"),this.iframe.src="javascript:0",this.iframe.style.display="none",this.iframe.tabIndex=-1;var d=document.body,e=d.insertBefore(this.iframe,d.firstChild).contentWindow;e.document.open(),e.document.close(),e.location.hash="#"+this.fragment}var f=window.addEventListener||function(a,b){return attachEvent("on"+a,b)};return this._usePushState?f("popstate",this.checkUrl,!1):this._useHashChange&&!this.iframe?f("hashchange",this.checkUrl,!1):this._wantsHashChange&&(this._checkUrlInterval=setInterval(this.checkUrl,this.interval)),this.options.silent?void 0:this.loadUrl()},stop:function(){var a=window.removeEventListener||function(a,b){return detachEvent("on"+a,b)};this._usePushState?a("popstate",this.checkUrl,!1):this._useHashChange&&!this.iframe&&a("hashchange",this.checkUrl,!1),this.iframe&&(document.body.removeChild(this.iframe),this.iframe=null),this._checkUrlInterval&&clearInterval(this._checkUrlInterval),J.started=!1},route:function(a,b){this.handlers.unshift({route:a,callback:b})},checkUrl:function(a){var b=this.getFragment();return b===this.fragment&&this.iframe&&(b=this.getHash(this.iframe.contentWindow)),b===this.fragment?!1:(this.iframe&&this.navigate(b),void this.loadUrl())},loadUrl:function(a){return this.matchRoot()?(a=this.fragment=this.getFragment(a),c.some(this.handlers,function(b){return b.route.test(a)?(b.callback(a),!0):void 0})):!1},navigate:function(a,b){if(!J.started)return!1;b&&b!==!0||(b={trigger:!!b}),a=this.getFragment(a||"");var c=this.root;(""===a||"?"===a.charAt(0))&&(c=c.slice(0,-1)||"/");var d=c+a;if(a=this.decodeFragment(a.replace(M,"")),this.fragment!==a){if(this.fragment=a,this._usePushState)this.history[b.replace?"replaceState":"pushState"]({},document.title,d);else{if(!this._wantsHashChange)return this.location.assign(d);if(this._updateHash(this.location,a,b.replace),this.iframe&&a!==this.getHash(this.iframe.contentWindow)){var e=this.iframe.contentWindow;b.replace||(e.document.open(),e.document.close()),this._updateHash(e.location,a,b.replace)}}return b.trigger?this.loadUrl(a):void 0}},_updateHash:function(a,b,c){if(c){var d=a.href.replace(/(javascript:|#).*$/,"");a.replace(d+"#"+b)}else a.hash="#"+b}}),b.history=new J;var N=function(a,b){var d,e=this;d=a&&c.has(a,"constructor")?a.constructor:function(){return e.apply(this,arguments)},c.extend(d,e,b);var f=function(){this.constructor=d};return f.prototype=e.prototype,d.prototype=new f,a&&c.extend(d.prototype,a),d.__super__=e.prototype,d};t.extend=v.extend=E.extend=A.extend=J.extend=N;var O=function(){throw new Error('A "url" property or function must be specified')},P=function(a,b){var c=b.error;b.error=function(d){c&&c.call(b.context,a,d,b),a.trigger("error",a,d,b)}};return b}),c("editor/view/EditorView",["backbone"],function(a){return a.View.extend({initialize:function(){this.pn=this.model.get("Panels"),this.conf=this.model.config,this.className=this.conf.stylePrefix+"editor",this.model.on("loaded",function(){this.pn.active(),this.model.runDefault()},this)},render:function(){var a=this.conf;return this.$el.empty(),this.$cont=$(a.el||"body "+a.container),a.width&&this.$cont.css("width",a.width),a.height&&this.$cont.css("height",a.height),this.$el.append(this.model.get("Canvas").render()),this.$el.append(this.pn.render()),this.$el.attr("class",this.className),this.$cont.html(this.$el),this}})}),c("editor/main",["require","./config/config","./model/Editor","./view/EditorView"],function(a){var b=function(b){var c=b||{},d=a("./config/config"),e=a("./model/Editor"),f=a("./view/EditorView");for(var g in d)g in c||(c[g]=d[g]);var h=new e(c),i=new f({model:h,config:c});return{editor:h,DomComponents:h.get("DomComponents"),CssComposer:h.get("CssComposer"),StorageManager:h.get("StorageManager"),AssetManager:h.get("AssetManager"),BlockManager:h.get("BlockManager"),SelectorManager:h.get("SelectorManager"),CodeManager:h.get("CodeManager"),Commands:h.get("Commands"),Dialog:h.get("Modal"),Panels:h.get("Panels"),StyleManager:h.get("StyleManager"),Canvas:h.get("Canvas"),UndoManager:h.get("UndoManager"),DeviceManager:h.get("DeviceManager"),Utils:h.get("Utils"),Config:h.get("Config"),init:function(){return h.init(this),this},getConfig:function(){return c},getHtml:function(){return h.getHtml()},getCss:function(){return h.getCss()},getComponents:function(){return h.get("DomComponents").getComponents()},setComponents:function(a){return h.setComponents(a),this},getStyle:function(){return h.get("CssComposer").getRules()},setStyle:function(a){return h.setStyle(a),this},getSelected:function(){return h.getSelected()},setDevice:function(a){return h.set("device",a)},getDevice:function(){return h.get("device")},runCommand:function(a,b){var c=h.get("Commands").get(a);c&&(c.run(this,this,b),this.trigger("run:"+a))},stopCommand:function(a,b){var c=h.get("Commands").get(a);c&&(c.stop(this,this,b),this.trigger("stop:"+a))},store:function(){return h.store()},load:function(){return h.load()},getContainer:function(){return c.el},on:function(a,b){return h.on(a,b)},trigger:function(a){return h.trigger(a)},getEl:function(){return i.el},getModel:function(){return h},render:function(){return i.render().el}}};return b}),c("PluginManager/config/config",[],function(){return{plugins:[]}}),c("PluginManager/main",["require","./config/config"],function(a){return function(b){var c=b||{},d=a("./config/config");for(var e in d)e in c||(c[e]=d[e]);var f={};return{add:function(a,b){return f[a]?this:(f[a]=b,this)},get:function(a){return f[a]},getAll:function(){return f}}}}),c("PluginManager",["PluginManager/main"],function(a){return a}),c("grapesjs/main",["require","./config/config","editor/main","PluginManager"],function(a){return function(b){var c=a("./config/config"),d=a("editor/main"),e=a("PluginManager"),f=new e,g=[];return{plugins:f,init:function(a){var b=a||{},e=b.container;for(var h in c)h in b||(b[h]=c[h]);if(!e)throw new Error("'container' is required");b.noticeOnUnload&&(window.onbeforeunload=function(a){return 1}),b.el=document.querySelector(e);var i=new d(b).init(),j=f.getAll();for(var k in j)if(!(b.plugins.indexOf(k)<0)){var l=b.pluginsOpts[k]||{},m=f.get(k);m(i,l)}return b.autorender&&i.render(),g.push(i),i}}}()}),b(["src/config/require-config.js"],function(){b(["grapesjs/main"],function(a){return a})}),c("main",function(){}),b("grapesjs/main")}); \ No newline at end of file +!function(a,b){"function"==typeof define&&define.amd?define([],b):"object"==typeof exports&&"object"==typeof module?module.exports=mod():a.grapesjs=a.GrapesJS=b()}(this,function(){var a,b,c;!function(d){function e(a,b){return u.call(a,b)}function f(a,b){var c,d,e,f,g,h,i,j,k,l,m,n=b&&b.split("/"),o=s.map,p=o&&o["*"]||{};if(a&&"."===a.charAt(0))if(b){for(a=a.split("/"),g=a.length-1,s.nodeIdCompat&&w.test(a[g])&&(a[g]=a[g].replace(w,"")),a=n.slice(0,n.length-1).concat(a),k=0;k0&&(a.splice(k-1,2),k-=2)}a=a.join("/")}else 0===a.indexOf("./")&&(a=a.substring(2));if((n||p)&&o){for(c=a.split("/"),k=c.length;k>0;k-=1){if(d=c.slice(0,k).join("/"),n)for(l=n.length;l>0;l-=1)if(e=o[n.slice(0,l).join("/")],e&&(e=e[d])){f=e,h=k;break}if(f)break;!i&&p&&p[d]&&(i=p[d],j=k)}!f&&i&&(f=i,h=j),f&&(c.splice(0,h,f),a=c.join("/"))}return a}function g(a,b){return function(){var c=v.call(arguments,0);return"string"!=typeof c[0]&&1===c.length&&c.push(null),n.apply(d,c.concat([a,b]))}}function h(a){return function(b){return f(b,a)}}function i(a){return function(b){q[a]=b}}function j(a){if(e(r,a)){var b=r[a];delete r[a],t[a]=!0,m.apply(d,b)}if(!e(q,a)&&!e(t,a))throw new Error("No "+a);return q[a]}function k(a){var b,c=a?a.indexOf("!"):-1;return c>-1&&(b=a.substring(0,c),a=a.substring(c+1,a.length)),[b,a]}function l(a){return function(){return s&&s.config&&s.config[a]||{}}}var m,n,o,p,q={},r={},s={},t={},u=Object.prototype.hasOwnProperty,v=[].slice,w=/\.js$/;o=function(a,b){var c,d=k(a),e=d[0];return a=d[1],e&&(e=f(e,b),c=j(e)),e?a=c&&c.normalize?c.normalize(a,h(b)):f(a,b):(a=f(a,b),d=k(a),e=d[0],a=d[1],e&&(c=j(e))),{f:e?e+"!"+a:a,n:a,pr:e,p:c}},p={require:function(a){return g(a)},exports:function(a){var b=q[a];return"undefined"!=typeof b?b:q[a]={}},module:function(a){return{id:a,uri:"",exports:q[a],config:l(a)}}},m=function(a,b,c,f){var h,k,l,m,n,s,u=[],v=typeof c;if(f=f||a,"undefined"===v||"function"===v){for(b=!b.length&&c.length?["require","exports","module"]:b,n=0;n
',attributes:{"class":"wte-fonts wte-f-b1"}},{id:"b2",label:"2 Blocks",content:'
',attributes:{"class":"wte-fonts wte-f-b2"}},{id:"b3",label:"3 Blocks",content:'
',attributes:{"class":"wte-fonts wte-f-b3"}},{id:"b4",label:"3/7 Block",content:'
',attributes:{"class":"wte-fonts wte-f-b37"}},{id:"hero",label:"Hero section",content:'
Build your templates without coding
Try it now
',attributes:{"class":"wte-fonts wte-f-hero"}},{id:"h1p",label:"Text section",content:'

Insert title here

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua

',attributes:{"class":"wte-fonts wte-f-h1p"}},{id:"3ba",label:"Badges",content:'
Adam Smith
CEO
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore ipsum dolor sit
ftln
John Black
Software Engineer
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore ipsum dolor sit
ftln
Jessica White
Web Designer
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore ipsum dolor sit
ftln
',attributes:{"class":"wte-fonts wte-f-3ba"}},{id:"text",label:"Text",attributes:{"class":"wte-fonts wte-f-text"},content:{type:"text",content:"Insert your text here",style:{padding:"10px"},activeOnRender:1}},{id:"image",label:"Image",attributes:{"class":"wte-fonts wte-f-image"},content:{type:"image",activeOnRender:1}},{id:"quo",label:"Quote",content:'
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore ipsum dolor sit
',attributes:{"class":"wte-fonts wte-f-quo"}}]},defaultCommand:"select-comp",showDevices:1,el:""};return a});var d=["backbone","backboneUndo","keymaster","Utils","StorageManager","DeviceManager","Parser","SelectorManager","ModalDialog","CodeManager","Panels","RichTextEditor","StyleManager","AssetManager","CssComposer","DomComponents","Canvas","Commands","BlockManager"];return c(d,function(){return Backbone.Model.extend({defaults:{clipboard:null,selectedComponent:null,previousModel:null,changesCount:0,storables:[],device:""},initialize:function(a){this.config=a,this.set("Config",a),a.el&&a.fromElement&&(this.config.components=a.el.innerHTML),d.forEach(function(a){["backbone","backboneUndo","keymaster"].indexOf(a)>=0||this.loadModule(a)},this),this.initUndoManager(),this.on("change:selectedComponent",this.componentSelected,this)},loadModule:function(a){var c=this.config,d=b(a),e=new d,f=e.name.charAt(0).toLowerCase()+e.name.slice(1),g=c[f]||c[e.name]||{};g.pStylePrefix=c.stylePrefix||"";var h=this.get("StorageManager");if(e.storageKey&&e.store&&e.load&&h){g.stm=h;var i=this.get("storables");i.push(e),this.set("storables",i)}return g.em=this,e.init(g),e["private"]||this.set(e.name,e),e.onLoad&&e.onLoad(),this},init:function(a){this.set("Editor",a)},listenRules:function(a){this.stopListening(a,"add remove",this.listenRule),this.listenTo(a,"add remove",this.listenRule),a.each(function(a){this.listenRule(a)},this)},listenRule:function(a){this.stopListening(a,"change:style",this.ruleUpdated),this.listenTo(a,"change:style",this.ruleUpdated)},ruleUpdated:function(a,b,c){var d=this.get("changesCount")+1,e=c?c.avoidStore:0;this.set("changesCount",d);var f=this.get("StorageManager");f.isAutosave()&&dc;c++)b.pop();return b.add(a),this},getStyle:function(){return this.get("CssComposer").getRules()},getHtml:function(){var a=this.get("DomComponents"),b=this.get("CodeManager");if(a&&b){var c=a.getComponent();return b.getCode(c,"html")}},getCss:function(){var a=this.get("DomComponents"),b=this.get("CodeManager"),c=this.get("CssComposer");if(a&&b&&c){var d=a.getComponent();return b.getCode(d,"css",c)}},store:function(){var a=this.get("StorageManager"),b={};return a?(this.get("storables").forEach(function(a){var c=a.store(1);for(var d in c)b[d]=c[d]}),a.store(b),b):void 0},load:function(){var a=this.getCacheLoad(1);return this.get("storables").forEach(function(b){b.load(a)}),a},getCacheLoad:function(a){var b=a?1:0;if(this.cacheLoad&&!b)return this.cacheLoad;var c=this.get("StorageManager"),d=[];return c?(this.get("storables").forEach(function(a){var b=a.storageKey;b="function"==typeof b?b():b,keys=b instanceof Array?b:[b],keys.forEach(function(a){d.push(a)})}),this.cacheLoad=c.load(d),this.cacheLoad):{}},getDeviceModel:function(){var a=this.get("device");return this.get("DeviceManager").get(a)},runDefault:function(){var a=this.get("Commands").get(this.config.defaultCommand);a&&!this.defaultRunning&&(a.stop(this,this),a.run(this,this),this.defaultRunning=1)},stopDefault:function(){var a=this.get("Commands").get(this.config.defaultCommand);a&&(a.stop(this,this),this.defaultRunning=0)}})}),c("editor/model/Editor",function(){}),function(){function a(a){function b(b,c,d,e,f,g){for(;f>=0&&g>f;f+=a){var h=e?e[f]:f;d=c(d,b[h],h,b)}return d}return function(c,d,e,f){d=u(d,f,4);var g=!B(c)&&t.keys(c),h=(g||c).length,i=a>0?0:h-1;return arguments.length<3&&(e=c[g?g[i]:i],i+=a),b(c,d,e,g,i,h)}}function b(a){return function(b,c,d){c=v(c,d);for(var e=A(b),f=a>0?0:e-1;f>=0&&e>f;f+=a)if(c(b[f],f,b))return f;return-1}}function d(a,b,c){return function(d,e,f){var g=0,h=A(d);if("number"==typeof f)a>0?g=f>=0?f:Math.max(f+h,g):h=f>=0?Math.min(f+1,h):f+h+1;else if(c&&f&&h)return f=c(d,e),d[f]===e?f:-1;if(e!==e)return f=b(l.call(d,g,h),t.isNaN),f>=0?f+g:-1;for(f=a>0?g:h-1;f>=0&&h>f;f+=a)if(d[f]===e)return f;return-1}}function e(a,b){var c=G.length,d=a.constructor,e=t.isFunction(d)&&d.prototype||i,f="constructor";for(t.has(a,f)&&!t.contains(b,f)&&b.push(f);c--;)f=G[c],f in a&&a[f]!==e[f]&&!t.contains(b,f)&&b.push(f)}var f=this,g=f._,h=Array.prototype,i=Object.prototype,j=Function.prototype,k=h.push,l=h.slice,m=i.toString,n=i.hasOwnProperty,o=Array.isArray,p=Object.keys,q=j.bind,r=Object.create,s=function(){},t=function(a){return a instanceof t?a:this instanceof t?void(this._wrapped=a):new t(a)};"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=t),exports._=t):f._=t,t.VERSION="1.8.3";var u=function(a,b,c){if(void 0===b)return a;switch(null==c?3:c){case 1:return function(c){return a.call(b,c)};case 2:return function(c,d){return a.call(b,c,d)};case 3:return function(c,d,e){return a.call(b,c,d,e)};case 4:return function(c,d,e,f){return a.call(b,c,d,e,f)}}return function(){return a.apply(b,arguments)}},v=function(a,b,c){return null==a?t.identity:t.isFunction(a)?u(a,b,c):t.isObject(a)?t.matcher(a):t.property(a)};t.iteratee=function(a,b){return v(a,b,1/0)};var w=function(a,b){return function(c){var d=arguments.length;if(2>d||null==c)return c;for(var e=1;d>e;e++)for(var f=arguments[e],g=a(f),h=g.length,i=0;h>i;i++){var j=g[i];b&&void 0!==c[j]||(c[j]=f[j])}return c}},x=function(a){if(!t.isObject(a))return{};if(r)return r(a);s.prototype=a;var b=new s;return s.prototype=null,b},y=function(a){return function(b){return null==b?void 0:b[a]}},z=Math.pow(2,53)-1,A=y("length"),B=function(a){var b=A(a);return"number"==typeof b&&b>=0&&z>=b};t.each=t.forEach=function(a,b,c){b=u(b,c);var d,e;if(B(a))for(d=0,e=a.length;e>d;d++)b(a[d],d,a);else{var f=t.keys(a);for(d=0,e=f.length;e>d;d++)b(a[f[d]],f[d],a)}return a},t.map=t.collect=function(a,b,c){b=v(b,c);for(var d=!B(a)&&t.keys(a),e=(d||a).length,f=Array(e),g=0;e>g;g++){var h=d?d[g]:g;f[g]=b(a[h],h,a)}return f},t.reduce=t.foldl=t.inject=a(1),t.reduceRight=t.foldr=a(-1),t.find=t.detect=function(a,b,c){var d;return d=B(a)?t.findIndex(a,b,c):t.findKey(a,b,c),void 0!==d&&-1!==d?a[d]:void 0},t.filter=t.select=function(a,b,c){var d=[];return b=v(b,c),t.each(a,function(a,c,e){b(a,c,e)&&d.push(a)}),d},t.reject=function(a,b,c){return t.filter(a,t.negate(v(b)),c)},t.every=t.all=function(a,b,c){b=v(b,c);for(var d=!B(a)&&t.keys(a),e=(d||a).length,f=0;e>f;f++){var g=d?d[f]:f;if(!b(a[g],g,a))return!1}return!0},t.some=t.any=function(a,b,c){b=v(b,c);for(var d=!B(a)&&t.keys(a),e=(d||a).length,f=0;e>f;f++){var g=d?d[f]:f;if(b(a[g],g,a))return!0}return!1},t.contains=t.includes=t.include=function(a,b,c,d){return B(a)||(a=t.values(a)),("number"!=typeof c||d)&&(c=0),t.indexOf(a,b,c)>=0},t.invoke=function(a,b){var c=l.call(arguments,2),d=t.isFunction(b);return t.map(a,function(a){var e=d?b:a[b];return null==e?e:e.apply(a,c)})},t.pluck=function(a,b){return t.map(a,t.property(b))},t.where=function(a,b){return t.filter(a,t.matcher(b))},t.findWhere=function(a,b){return t.find(a,t.matcher(b))},t.max=function(a,b,c){var d,e,f=-1/0,g=-1/0;if(null==b&&null!=a){a=B(a)?a:t.values(a);for(var h=0,i=a.length;i>h;h++)d=a[h],d>f&&(f=d)}else b=v(b,c),t.each(a,function(a,c,d){e=b(a,c,d),(e>g||e===-1/0&&f===-1/0)&&(f=a,g=e)});return f},t.min=function(a,b,c){var d,e,f=1/0,g=1/0;if(null==b&&null!=a){a=B(a)?a:t.values(a);for(var h=0,i=a.length;i>h;h++)d=a[h],f>d&&(f=d)}else b=v(b,c),t.each(a,function(a,c,d){e=b(a,c,d),(g>e||1/0===e&&1/0===f)&&(f=a,g=e)});return f},t.shuffle=function(a){for(var b,c=B(a)?a:t.values(a),d=c.length,e=Array(d),f=0;d>f;f++)b=t.random(0,f),b!==f&&(e[f]=e[b]),e[b]=c[f];return e},t.sample=function(a,b,c){return null==b||c?(B(a)||(a=t.values(a)),a[t.random(a.length-1)]):t.shuffle(a).slice(0,Math.max(0,b))},t.sortBy=function(a,b,c){return b=v(b,c),t.pluck(t.map(a,function(a,c,d){return{value:a,index:c,criteria:b(a,c,d)}}).sort(function(a,b){var c=a.criteria,d=b.criteria;if(c!==d){if(c>d||void 0===c)return 1;if(d>c||void 0===d)return-1}return a.index-b.index}),"value")};var C=function(a){return function(b,c,d){var e={};return c=v(c,d),t.each(b,function(d,f){var g=c(d,f,b);a(e,d,g)}),e}};t.groupBy=C(function(a,b,c){t.has(a,c)?a[c].push(b):a[c]=[b]}),t.indexBy=C(function(a,b,c){a[c]=b}),t.countBy=C(function(a,b,c){t.has(a,c)?a[c]++:a[c]=1}),t.toArray=function(a){return a?t.isArray(a)?l.call(a):B(a)?t.map(a,t.identity):t.values(a):[]},t.size=function(a){return null==a?0:B(a)?a.length:t.keys(a).length},t.partition=function(a,b,c){b=v(b,c);var d=[],e=[];return t.each(a,function(a,c,f){(b(a,c,f)?d:e).push(a)}),[d,e]},t.first=t.head=t.take=function(a,b,c){return null==a?void 0:null==b||c?a[0]:t.initial(a,a.length-b)},t.initial=function(a,b,c){return l.call(a,0,Math.max(0,a.length-(null==b||c?1:b)))},t.last=function(a,b,c){return null==a?void 0:null==b||c?a[a.length-1]:t.rest(a,Math.max(0,a.length-b))},t.rest=t.tail=t.drop=function(a,b,c){return l.call(a,null==b||c?1:b)},t.compact=function(a){return t.filter(a,t.identity)};var D=function(a,b,c,d){for(var e=[],f=0,g=d||0,h=A(a);h>g;g++){var i=a[g];if(B(i)&&(t.isArray(i)||t.isArguments(i))){b||(i=D(i,b,c));var j=0,k=i.length;for(e.length+=k;k>j;)e[f++]=i[j++]}else c||(e[f++]=i)}return e};t.flatten=function(a,b){return D(a,b,!1)},t.without=function(a){return t.difference(a,l.call(arguments,1))},t.uniq=t.unique=function(a,b,c,d){t.isBoolean(b)||(d=c,c=b,b=!1),null!=c&&(c=v(c,d));for(var e=[],f=[],g=0,h=A(a);h>g;g++){var i=a[g],j=c?c(i,g,a):i;b?(g&&f===j||e.push(i),f=j):c?t.contains(f,j)||(f.push(j),e.push(i)):t.contains(e,i)||e.push(i)}return e},t.union=function(){return t.uniq(D(arguments,!0,!0))},t.intersection=function(a){for(var b=[],c=arguments.length,d=0,e=A(a);e>d;d++){var f=a[d];if(!t.contains(b,f)){for(var g=1;c>g&&t.contains(arguments[g],f);g++);g===c&&b.push(f)}}return b},t.difference=function(a){var b=D(arguments,!0,!0,1);return t.filter(a,function(a){return!t.contains(b,a)})},t.zip=function(){return t.unzip(arguments)},t.unzip=function(a){for(var b=a&&t.max(a,A).length||0,c=Array(b),d=0;b>d;d++)c[d]=t.pluck(a,d);return c},t.object=function(a,b){for(var c={},d=0,e=A(a);e>d;d++)b?c[a[d]]=b[d]:c[a[d][0]]=a[d][1];return c},t.findIndex=b(1),t.findLastIndex=b(-1),t.sortedIndex=function(a,b,c,d){c=v(c,d,1);for(var e=c(b),f=0,g=A(a);g>f;){var h=Math.floor((f+g)/2);c(a[h])f;f++,a+=c)e[f]=a;return e};var E=function(a,b,c,d,e){if(!(d instanceof b))return a.apply(c,e);var f=x(a.prototype),g=a.apply(f,e);return t.isObject(g)?g:f};t.bind=function(a,b){if(q&&a.bind===q)return q.apply(a,l.call(arguments,1));if(!t.isFunction(a))throw new TypeError("Bind must be called on a function");var c=l.call(arguments,2),d=function(){return E(a,d,b,this,c.concat(l.call(arguments)))};return d},t.partial=function(a){var b=l.call(arguments,1),c=function(){for(var d=0,e=b.length,f=Array(e),g=0;e>g;g++)f[g]=b[g]===t?arguments[d++]:b[g];for(;d=d)throw new Error("bindAll must be passed function names");for(b=1;d>b;b++)c=arguments[b],a[c]=t.bind(a[c],a);return a},t.memoize=function(a,b){var c=function(d){var e=c.cache,f=""+(b?b.apply(this,arguments):d);return t.has(e,f)||(e[f]=a.apply(this,arguments)),e[f]};return c.cache={},c},t.delay=function(a,b){var c=l.call(arguments,2);return setTimeout(function(){return a.apply(null,c)},b)},t.defer=t.partial(t.delay,t,1),t.throttle=function(a,b,c){var d,e,f,g=null,h=0;c||(c={});var i=function(){h=c.leading===!1?0:t.now(),g=null,f=a.apply(d,e),g||(d=e=null)};return function(){var j=t.now();h||c.leading!==!1||(h=j);var k=b-(j-h);return d=this,e=arguments,0>=k||k>b?(g&&(clearTimeout(g),g=null),h=j,f=a.apply(d,e),g||(d=e=null)):g||c.trailing===!1||(g=setTimeout(i,k)),f}},t.debounce=function(a,b,c){var d,e,f,g,h,i=function(){var j=t.now()-g;b>j&&j>=0?d=setTimeout(i,b-j):(d=null,c||(h=a.apply(f,e),d||(f=e=null)))};return function(){f=this,e=arguments,g=t.now();var j=c&&!d;return d||(d=setTimeout(i,b)),j&&(h=a.apply(f,e),f=e=null),h}},t.wrap=function(a,b){return t.partial(b,a)},t.negate=function(a){return function(){return!a.apply(this,arguments)}},t.compose=function(){var a=arguments,b=a.length-1;return function(){for(var c=b,d=a[b].apply(this,arguments);c--;)d=a[c].call(this,d);return d}},t.after=function(a,b){return function(){return--a<1?b.apply(this,arguments):void 0}},t.before=function(a,b){var c;return function(){return--a>0&&(c=b.apply(this,arguments)),1>=a&&(b=null),c}},t.once=t.partial(t.before,2);var F=!{toString:null}.propertyIsEnumerable("toString"),G=["valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"];t.keys=function(a){if(!t.isObject(a))return[];if(p)return p(a);var b=[];for(var c in a)t.has(a,c)&&b.push(c);return F&&e(a,b),b},t.allKeys=function(a){if(!t.isObject(a))return[];var b=[];for(var c in a)b.push(c);return F&&e(a,b),b},t.values=function(a){for(var b=t.keys(a),c=b.length,d=Array(c),e=0;c>e;e++)d[e]=a[b[e]];return d},t.mapObject=function(a,b,c){b=v(b,c);for(var d,e=t.keys(a),f=e.length,g={},h=0;f>h;h++)d=e[h],g[d]=b(a[d],d,a);return g},t.pairs=function(a){for(var b=t.keys(a),c=b.length,d=Array(c),e=0;c>e;e++)d[e]=[b[e],a[b[e]]];return d},t.invert=function(a){for(var b={},c=t.keys(a),d=0,e=c.length;e>d;d++)b[a[c[d]]]=c[d];return b},t.functions=t.methods=function(a){var b=[];for(var c in a)t.isFunction(a[c])&&b.push(c);return b.sort()},t.extend=w(t.allKeys),t.extendOwn=t.assign=w(t.keys),t.findKey=function(a,b,c){b=v(b,c);for(var d,e=t.keys(a),f=0,g=e.length;g>f;f++)if(d=e[f],b(a[d],d,a))return d},t.pick=function(a,b,c){var d,e,f={},g=a;if(null==g)return f;t.isFunction(b)?(e=t.allKeys(g),d=u(b,c)):(e=D(arguments,!1,!1,1),d=function(a,b,c){return b in c},g=Object(g));for(var h=0,i=e.length;i>h;h++){var j=e[h],k=g[j];d(k,j,g)&&(f[j]=k)}return f},t.omit=function(a,b,c){if(t.isFunction(b))b=t.negate(b);else{var d=t.map(D(arguments,!1,!1,1),String);b=function(a,b){return!t.contains(d,b)}}return t.pick(a,b,c)},t.defaults=w(t.allKeys,!0),t.create=function(a,b){var c=x(a);return b&&t.extendOwn(c,b),c},t.clone=function(a){return t.isObject(a)?t.isArray(a)?a.slice():t.extend({},a):a},t.tap=function(a,b){return b(a),a},t.isMatch=function(a,b){var c=t.keys(b),d=c.length;if(null==a)return!d;for(var e=Object(a),f=0;d>f;f++){var g=c[f];if(b[g]!==e[g]||!(g in e))return!1}return!0};var H=function(a,b,c,d){if(a===b)return 0!==a||1/a===1/b;if(null==a||null==b)return a===b;a instanceof t&&(a=a._wrapped),b instanceof t&&(b=b._wrapped);var e=m.call(a);if(e!==m.call(b))return!1;switch(e){case"[object RegExp]":case"[object String]":return""+a==""+b;case"[object Number]":return+a!==+a?+b!==+b:0===+a?1/+a===1/b:+a===+b;case"[object Date]":case"[object Boolean]":return+a===+b}var f="[object Array]"===e;if(!f){if("object"!=typeof a||"object"!=typeof b)return!1;var g=a.constructor,h=b.constructor;if(g!==h&&!(t.isFunction(g)&&g instanceof g&&t.isFunction(h)&&h instanceof h)&&"constructor"in a&&"constructor"in b)return!1}c=c||[],d=d||[];for(var i=c.length;i--;)if(c[i]===a)return d[i]===b;if(c.push(a),d.push(b),f){if(i=a.length,i!==b.length)return!1;for(;i--;)if(!H(a[i],b[i],c,d))return!1}else{var j,k=t.keys(a);if(i=k.length,t.keys(b).length!==i)return!1;for(;i--;)if(j=k[i],!t.has(b,j)||!H(a[j],b[j],c,d))return!1}return c.pop(),d.pop(),!0};t.isEqual=function(a,b){return H(a,b)},t.isEmpty=function(a){return null==a?!0:B(a)&&(t.isArray(a)||t.isString(a)||t.isArguments(a))?0===a.length:0===t.keys(a).length},t.isElement=function(a){return!(!a||1!==a.nodeType)},t.isArray=o||function(a){return"[object Array]"===m.call(a)},t.isObject=function(a){var b=typeof a;return"function"===b||"object"===b&&!!a},t.each(["Arguments","Function","String","Number","Date","RegExp","Error"],function(a){t["is"+a]=function(b){return m.call(b)==="[object "+a+"]"}}),t.isArguments(arguments)||(t.isArguments=function(a){return t.has(a,"callee")}),"function"!=typeof/./&&"object"!=typeof Int8Array&&(t.isFunction=function(a){return"function"==typeof a||!1}),t.isFinite=function(a){return isFinite(a)&&!isNaN(parseFloat(a))},t.isNaN=function(a){return t.isNumber(a)&&a!==+a},t.isBoolean=function(a){return a===!0||a===!1||"[object Boolean]"===m.call(a)},t.isNull=function(a){return null===a},t.isUndefined=function(a){return void 0===a},t.has=function(a,b){return null!=a&&n.call(a,b)},t.noConflict=function(){return f._=g,this},t.identity=function(a){return a},t.constant=function(a){return function(){return a}},t.noop=function(){},t.property=y,t.propertyOf=function(a){return null==a?function(){}:function(b){return a[b]}},t.matcher=t.matches=function(a){return a=t.extendOwn({},a),function(b){return t.isMatch(b,a)}},t.times=function(a,b,c){var d=Array(Math.max(0,a));b=u(b,c,1);for(var e=0;a>e;e++)d[e]=b(e);return d},t.random=function(a,b){return null==b&&(b=a,a=0),a+Math.floor(Math.random()*(b-a+1))},t.now=Date.now||function(){return(new Date).getTime()};var I={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},J=t.invert(I),K=function(a){var b=function(b){return a[b]},c="(?:"+t.keys(a).join("|")+")",d=RegExp(c),e=RegExp(c,"g");return function(a){return a=null==a?"":""+a,d.test(a)?a.replace(e,b):a}};t.escape=K(I),t.unescape=K(J),t.result=function(a,b,c){var d=null==a?void 0:a[b];return void 0===d&&(d=c),t.isFunction(d)?d.call(a):d};var L=0;t.uniqueId=function(a){var b=++L+"";return a?a+b:b},t.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var M=/(.)^/,N={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},O=/\\|'|\r|\n|\u2028|\u2029/g,P=function(a){return"\\"+N[a]};t.template=function(a,b,c){!b&&c&&(b=c),b=t.defaults({},b,t.templateSettings);var d=RegExp([(b.escape||M).source,(b.interpolate||M).source,(b.evaluate||M).source].join("|")+"|$","g"),e=0,f="__p+='";a.replace(d,function(b,c,d,g,h){return f+=a.slice(e,h).replace(O,P),e=h+b.length,c?f+="'+\n((__t=("+c+"))==null?'':_.escape(__t))+\n'":d?f+="'+\n((__t=("+d+"))==null?'':__t)+\n'":g&&(f+="';\n"+g+"\n__p+='"),b}),f+="';\n",b.variable||(f="with(obj||{}){\n"+f+"}\n"),f="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+f+"return __p;\n";try{var g=new Function(b.variable||"obj","_",f)}catch(h){throw h.source=f,h}var i=function(a){return g.call(this,a,t)},j=b.variable||"obj";return i.source="function("+j+"){\n"+f+"}",i},t.chain=function(a){var b=t(a);return b._chain=!0,b};var Q=function(a,b){return a._chain?t(b).chain():b};t.mixin=function(a){t.each(t.functions(a),function(b){var c=t[b]=a[b];t.prototype[b]=function(){var a=[this._wrapped];return k.apply(a,arguments),Q(this,c.apply(t,a))}})},t.mixin(t),t.each(["pop","push","reverse","shift","sort","splice","unshift"],function(a){var b=h[a];t.prototype[a]=function(){var c=this._wrapped;return b.apply(c,arguments),"shift"!==a&&"splice"!==a||0!==c.length||delete c[0],Q(this,c)}}),t.each(["concat","join","slice"],function(a){var b=h[a];t.prototype[a]=function(){return Q(this,b.apply(this._wrapped,arguments))}}),t.prototype.value=function(){return this._wrapped},t.prototype.valueOf=t.prototype.toJSON=t.prototype.value,t.prototype.toString=function(){return""+this._wrapped},"function"==typeof c&&c.amd&&c("underscore",[],function(){return t})}.call(this),c("jquery",[],function(){return jQuery}),function(a){var d="object"==typeof self&&self.self==self&&self||"object"==typeof global&&global.global==global&&global;if("function"==typeof c&&c.amd)c("backbone",["underscore","jquery","exports"],function(b,c,e){d.Backbone=a(d,e,b,c)});else if("undefined"!=typeof exports){var e,f=b("underscore");try{e=b("jquery")}catch(g){}a(d,exports,f,e)}else d.Backbone=a(d,{},d._,d.jQuery||d.Zepto||d.ender||d.$)}(function(a,b,c,d){var e=a.Backbone,f=Array.prototype.slice;b.VERSION="1.2.3",b.$=d,b.noConflict=function(){return a.Backbone=e,this},b.emulateHTTP=!1,b.emulateJSON=!1;var g=function(a,b,d){switch(a){case 1:return function(){return c[b](this[d])};case 2:return function(a){return c[b](this[d],a)};case 3:return function(a,e){return c[b](this[d],i(a,this),e)};case 4:return function(a,e,f){return c[b](this[d],i(a,this),e,f)};default:return function(){var a=f.call(arguments);return a.unshift(this[d]),c[b].apply(c,a)}}},h=function(a,b,d){c.each(b,function(b,e){c[e]&&(a.prototype[e]=g(b,e,d))})},i=function(a,b){return c.isFunction(a)?a:c.isObject(a)&&!b._isModel(a)?j(a):c.isString(a)?function(b){return b.get(a)}:a},j=function(a){var b=c.matches(a);return function(a){return b(a.attributes)}},k=b.Events={},l=/\s+/,m=function(a,b,d,e,f){var g,h=0;if(d&&"object"==typeof d){void 0!==e&&"context"in f&&void 0===f.context&&(f.context=e);for(g=c.keys(d);hd;d++)c[d]=arguments[d+1];return m(r,this._events,a,void 0,c),this};var r=function(a,b,c,d){if(a){var e=a[b],f=a.all;e&&f&&(f=f.slice()),e&&s(e,d),f&&s(f,[b].concat(d))}return a},s=function(a,b){var c,d=-1,e=a.length,f=b[0],g=b[1],h=b[2];switch(b.length){case 0:for(;++df;f++)a[f+c]=b[f];for(f=0;fe&&(e+=this.length+1);for(var f,g=[],h=[],i=[],j={},k=b.add,l=b.merge,m=b.remove,n=!1,o=this.comparator&&null==e&&b.sort!==!1,p=c.isString(this.comparator)?this.comparator:null,q=0;qa&&(a+=this.length),this.models[a]},where:function(a,b){return this[b?"find":"filter"](a)},findWhere:function(a){return this.where(a,!0)},sort:function(a){var b=this.comparator;if(!b)throw new Error("Cannot sort a set without a comparator");a||(a={});var d=b.length;return c.isFunction(b)&&(b=c.bind(b,this)),1===d||c.isString(b)?this.models=this.sortBy(b):this.models.sort(b),a.silent||this.trigger("sort",this,a),this},pluck:function(a){return c.invoke(this.models,"get",a)},fetch:function(a){a=c.extend({parse:!0},a);var b=a.success,d=this;return a.success=function(c){var e=a.reset?"reset":"set";d[e](c,a),b&&b.call(a.context,d,c,a),d.trigger("sync",d,c,a)},P(this,a),this.sync("read",this,a)},create:function(a,b){b=b?c.clone(b):{};var d=b.wait;if(a=this._prepareModel(a,b),!a)return!1;d||this.add(a,b);var e=this,f=b.success;return b.success=function(a,b,c){d&&e.add(a,c),f&&f.call(c.context,a,b,c)},a.save(null,b),a},parse:function(a,b){return a},clone:function(){return new this.constructor(this.models,{model:this.model,comparator:this.comparator})},modelId:function(a){return a[this.model.prototype.idAttribute||"id"]},_reset:function(){this.length=0,this.models=[],this._byId={}},_prepareModel:function(a,b){if(this._isModel(a))return a.collection||(a.collection=this),a;b=b?c.clone(b):{},b.collection=this;var d=new this.model(a,b);return d.validationError?(this.trigger("invalid",this,d.validationError,b),!1):d},_removeModels:function(a,b){for(var c=[],d=0;d7),this._useHashChange=this._wantsHashChange&&this._hasHashChange,this._wantsPushState=!!this.options.pushState,this._hasPushState=!(!this.history||!this.history.pushState),this._usePushState=this._wantsPushState&&this._hasPushState,this.fragment=this.getFragment(),this.root=("/"+this.root+"/").replace(L,"/"),this._wantsHashChange&&this._wantsPushState){if(!this._hasPushState&&!this.atRoot()){var b=this.root.slice(0,-1)||"/";return this.location.replace(b+"#"+this.getPath()),!0}this._hasPushState&&this.atRoot()&&this.navigate(this.getHash(),{replace:!0})}if(!this._hasHashChange&&this._wantsHashChange&&!this._usePushState){this.iframe=document.createElement("iframe"),this.iframe.src="javascript:0",this.iframe.style.display="none",this.iframe.tabIndex=-1;var d=document.body,e=d.insertBefore(this.iframe,d.firstChild).contentWindow;e.document.open(),e.document.close(),e.location.hash="#"+this.fragment}var f=window.addEventListener||function(a,b){return attachEvent("on"+a,b)};return this._usePushState?f("popstate",this.checkUrl,!1):this._useHashChange&&!this.iframe?f("hashchange",this.checkUrl,!1):this._wantsHashChange&&(this._checkUrlInterval=setInterval(this.checkUrl,this.interval)),this.options.silent?void 0:this.loadUrl()},stop:function(){var a=window.removeEventListener||function(a,b){return detachEvent("on"+a,b)};this._usePushState?a("popstate",this.checkUrl,!1):this._useHashChange&&!this.iframe&&a("hashchange",this.checkUrl,!1),this.iframe&&(document.body.removeChild(this.iframe),this.iframe=null),this._checkUrlInterval&&clearInterval(this._checkUrlInterval),J.started=!1},route:function(a,b){this.handlers.unshift({route:a,callback:b})},checkUrl:function(a){var b=this.getFragment();return b===this.fragment&&this.iframe&&(b=this.getHash(this.iframe.contentWindow)),b===this.fragment?!1:(this.iframe&&this.navigate(b),void this.loadUrl())},loadUrl:function(a){return this.matchRoot()?(a=this.fragment=this.getFragment(a),c.some(this.handlers,function(b){return b.route.test(a)?(b.callback(a),!0):void 0})):!1},navigate:function(a,b){if(!J.started)return!1;b&&b!==!0||(b={trigger:!!b}),a=this.getFragment(a||"");var c=this.root;(""===a||"?"===a.charAt(0))&&(c=c.slice(0,-1)||"/");var d=c+a;if(a=this.decodeFragment(a.replace(M,"")),this.fragment!==a){if(this.fragment=a,this._usePushState)this.history[b.replace?"replaceState":"pushState"]({},document.title,d);else{if(!this._wantsHashChange)return this.location.assign(d);if(this._updateHash(this.location,a,b.replace),this.iframe&&a!==this.getHash(this.iframe.contentWindow)){var e=this.iframe.contentWindow;b.replace||(e.document.open(),e.document.close()),this._updateHash(e.location,a,b.replace)}}return b.trigger?this.loadUrl(a):void 0}},_updateHash:function(a,b,c){if(c){var d=a.href.replace(/(javascript:|#).*$/,"");a.replace(d+"#"+b)}else a.hash="#"+b}}),b.history=new J;var N=function(a,b){var d,e=this;d=a&&c.has(a,"constructor")?a.constructor:function(){return e.apply(this,arguments)},c.extend(d,e,b);var f=function(){this.constructor=d};return f.prototype=e.prototype,d.prototype=new f,a&&c.extend(d.prototype,a),d.__super__=e.prototype,d};t.extend=v.extend=E.extend=A.extend=J.extend=N;var O=function(){throw new Error('A "url" property or function must be specified')},P=function(a,b){var c=b.error;b.error=function(d){c&&c.call(b.context,a,d,b),a.trigger("error",a,d,b)}};return b}),c("editor/view/EditorView",["backbone"],function(a){return a.View.extend({initialize:function(){this.pn=this.model.get("Panels"),this.conf=this.model.config,this.className=this.conf.stylePrefix+"editor",this.model.on("loaded",function(){this.pn.active(),this.model.runDefault()},this)},render:function(){var a=this.conf;return this.$el.empty(),this.$cont=$(a.el||"body "+a.container),a.width&&this.$cont.css("width",a.width),a.height&&this.$cont.css("height",a.height),this.$el.append(this.model.get("Canvas").render()),this.$el.append(this.pn.render()),this.$el.attr("class",this.className),this.$cont.html(this.$el),this}})}),c("editor/main",["require","./config/config","./model/Editor","./view/EditorView"],function(a){var b=function(b){var c=b||{},d=a("./config/config"),e=a("./model/Editor"),f=a("./view/EditorView");for(var g in d)g in c||(c[g]=d[g]);var h=new e(c),i=new f({model:h,config:c});return{editor:h,DomComponents:h.get("DomComponents"),CssComposer:h.get("CssComposer"),StorageManager:h.get("StorageManager"),AssetManager:h.get("AssetManager"),BlockManager:h.get("BlockManager"),SelectorManager:h.get("SelectorManager"),CodeManager:h.get("CodeManager"),Commands:h.get("Commands"),Dialog:h.get("Modal"),Panels:h.get("Panels"),StyleManager:h.get("StyleManager"),Canvas:h.get("Canvas"),UndoManager:h.get("UndoManager"),DeviceManager:h.get("DeviceManager"),Utils:h.get("Utils"),Config:h.get("Config"),init:function(){return h.init(this),this},getConfig:function(){return c},getHtml:function(){return h.getHtml()},getCss:function(){return h.getCss()},getComponents:function(){return h.get("DomComponents").getComponents()},setComponents:function(a){return h.setComponents(a),this},getStyle:function(){return h.get("CssComposer").getRules()},setStyle:function(a){return h.setStyle(a),this},getSelected:function(){return h.getSelected()},setDevice:function(a){return h.set("device",a)},getDevice:function(){return h.get("device")},runCommand:function(a,b){var c=h.get("Commands").get(a);c&&(c.run(this,this,b),this.trigger("run:"+a))},stopCommand:function(a,b){var c=h.get("Commands").get(a);c&&(c.stop(this,this,b),this.trigger("stop:"+a))},store:function(){return h.store()},load:function(){return h.load()},getContainer:function(){return c.el},on:function(a,b){return h.on(a,b)},trigger:function(a){return h.trigger(a)},getEl:function(){return i.el},getModel:function(){return h},render:function(){return i.render().el}}};return b}),c("PluginManager/config/config",[],function(){return{plugins:[]}}),c("PluginManager/main",["require","./config/config"],function(a){return function(b){var c=b||{},d=a("./config/config");for(var e in d)e in c||(c[e]=d[e]);var f={};return{add:function(a,b){return f[a]?this:(f[a]=b,this)},get:function(a){return f[a]},getAll:function(){return f}}}}),c("PluginManager",["PluginManager/main"],function(a){return a}),c("grapesjs/main",["require","./config/config","editor/main","PluginManager"],function(a){return function(b){var c=a("./config/config"),d=a("editor/main"),e=a("PluginManager"),f=new e,g=[];return{plugins:f,init:function(a){var b=a||{},e=b.container;for(var h in c)h in b||(b[h]=c[h]);if(!e)throw new Error("'container' is required");b.noticeOnUnload&&(window.onbeforeunload=function(a){return 1}),b.el=document.querySelector(e);var i=new d(b).init(),j=f.getAll();for(var k in j)if(!(b.plugins.indexOf(k)<0)){var l=b.pluginsOpts[k]||{},m=f.get(k);m(i,l)}return b.autorender&&i.render(),g.push(i),i}}}()}),b(["src/config/require-config.js"],function(){b(["grapesjs/main"],function(a){return a})}),c("main",function(){}),b("grapesjs/main")}); \ No newline at end of file diff --git a/src/editor/model/Editor.js b/src/editor/model/Editor.js index 697e77668..44686377b 100644 --- a/src/editor/model/Editor.js +++ b/src/editor/model/Editor.js @@ -1,9 +1,7 @@ -var deps = ['backbone', 'backboneUndo', 'keymaster', 'Utils', 'StorageManager', 'DeviceManager', 'Parser', 'SelectorManager', +var dep = ['Utils', 'StorageManager', 'DeviceManager', 'Parser', 'SelectorManager', 'ModalDialog', 'CodeManager', 'Panels', 'RichTextEditor', 'StyleManager', 'AssetManager', 'CssComposer', 'DomComponents', 'Canvas', 'Commands', 'BlockManager']; -define(deps, function(backbone, backboneUndo, keymaster, Utils, StorageManager, DeviceManager, Parser, SelectorManager, - ModalDialog, CodeManager, Panels, RichTextEditor, StyleManager, AssetManager, CssComposer, - DomComponents, Canvas, Commands, BlockManager){ +define(['backbone', 'backboneUndo', 'keymaster'].concat(dep), function(){ return Backbone.Model.extend({ defaults: { @@ -23,33 +21,11 @@ define(deps, function(backbone, backboneUndo, keymaster, Utils, StorageManager, this.config.components = c.el.innerHTML; // Load modules - /* - deps.forEach(function(name){ + dep.forEach(function(name){ if(['backbone','backboneUndo','keymaster'].indexOf(name) >= 0) return; this.loadModule(name); }, this); - */ - - /* - var t = new DomComponents(); - this.loadModule(Utils); - this.loadModule(StorageManager); - this.loadModule(DeviceManager); - this.loadModule(Parser); - this.loadModule(SelectorManager); - this.loadModule(ModalDialog); - this.loadModule(CodeManager); - this.loadModule(Panels); - this.loadModule(RichTextEditor); - this.loadModule(StyleManager); - this.loadModule(AssetManager); - this.loadModule(CssComposer); - this.loadModule(DomComponents); - this.loadModule(Canvas); - this.loadModule(Commands); - this.loadModule(BlockManager); - */ this.initUndoManager(); // Is already called (inside components and css composer) @@ -64,7 +40,6 @@ define(deps, function(backbone, backboneUndo, keymaster, Utils, StorageManager, loadModule: function(moduleName) { var c = this.config; var M = new require(moduleName)(); - //var M = new moduleName(); var name = M.name.charAt(0).toLowerCase() + M.name.slice(1); var cfg = c[name] || c[M.name] || {}; cfg.pStylePrefix = c.stylePrefix || '';