🚀 Big News:Socket Has Acquired Secure Annex.Learn More
Socket
Book a DemoSign in
Socket

grapesjs-component-code-editor

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grapesjs-component-code-editor - npm Package Compare versions

Comparing version
1.0.13
to
1.0.16
+2
-2
dist/grapesjs-component-code-editor.min.js

@@ -1,3 +0,3 @@

/*! grapesjs-component-code-editor - 1.0.13 */
!function(e,t){'object'==typeof exports&&'object'==typeof module?module.exports=t():'function'==typeof define&&define.amd?define([],t):'object'==typeof exports?exports["grapesjs-component-code-editor"]=t():e["grapesjs-component-code-editor"]=t()}(window,(function(){return function(e){var t={};function n(i){if(t[i])return t[i].exports;var r=t[i]={i:i,l:!1,exports:{}};return e[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){'undefined'!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:'Module'}),Object.defineProperty(e,'__esModule',{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&'object'==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,'default',{enumerable:!0,value:e}),2&t&&'string'!=typeof e)for(var r in e)n.d(i,r,function(t){return e[t]}.bind(null,r));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,'a',t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=3)}([function(e,t){e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}},function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},function(e,t){function n(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}e.exports=function(e,t,i){return t&&n(e.prototype,t),i&&n(e,i),e}},function(e,t,n){"use strict";n.r(t);var i=n(0),r=n.n(i),o=n(1),s=n.n(o),c=n(2),a=n.n(c),l='undefined'!=typeof window?window:null,u=null===l,d=u?void 0:l.document,h=function(){return!1},p=u?'calc':['','-webkit-','-moz-','-o-'].filter((function(e){var t=d.createElement('div');return t.style.cssText="width:"+e+"calc(9px)",!!t.style.length})).shift()+"calc",f=function(e){return'string'==typeof e||e instanceof String},v=function(e){if(f(e)){var t=d.querySelector(e);if(!t)throw new Error("Selector "+e+" did not match a DOM element");return t}return e},m=function(e,t,n){var i=e[t];return void 0!==i?i:n},g=function(e,t,n,i){if(t){if('end'===i)return 0;if('center'===i)return e/2}else if(n){if('start'===i)return 0;if('center'===i)return e/2}return e},y=function(e,t){var n=d.createElement('div');return n.className="gutter gutter-"+t,n},b=function(e,t,n){var i={};return f(t)?i[e]=t:i[e]=p+"("+t+"% - "+n+"px)",i},E=function(e,t){var n;return(n={})[e]=t+"px",n},C=function(e,t){if(void 0===t&&(t={}),u)return{};var n,i,r,o,s,c,a=e;Array.from&&(a=Array.from(a));var p=v(a[0]).parentNode,f=getComputedStyle?getComputedStyle(p):null,C=f?f.flexDirection:null,O=m(t,'sizes')||a.map((function(){return 100/a.length})),S=m(t,'minSize',100),w=Array.isArray(S)?S:a.map((function(){return S})),P=m(t,'expandToMin',!1),j=m(t,'gutterSize',10),z=m(t,'gutterAlign','center'),x=m(t,'snapOffset',30),k=m(t,'dragInterval',1),T=m(t,'direction',"horizontal"),L=m(t,'cursor',"horizontal"===T?'col-resize':'row-resize'),_=m(t,'gutter',y),D=m(t,'elementStyle',b),R=m(t,'gutterStyle',E);function M(e,t,i,r){var o=D(n,t,i,r);Object.keys(o).forEach((function(t){e.style[t]=o[t]}))}function B(){return c.map((function(e){return e.size}))}function A(e){return'touches'in e?e.touches[0][i]:e[i]}function H(e){var t=c[this.a],n=c[this.b],i=t.size+n.size;t.size=e/this.size*i,n.size=i-e/this.size*i,M(t.element,t.size,this._b,t.i),M(n.element,n.size,this._c,n.i)}function U(e){var n,i=c[this.a],r=c[this.b];this.dragging&&(n=A(e)-this.start+(this._b-this.dragOffset),k>1&&(n=Math.round(n/k)*k),n<=i.minSize+x+this._b?n=i.minSize+this._b:n>=this.size-(r.minSize+x+this._c)&&(n=this.size-(r.minSize+this._c)),H.call(this,n),m(t,'onDrag',h)(B()))}function I(){var e=c[this.a].element,t=c[this.b].element,i=e.getBoundingClientRect(),s=t.getBoundingClientRect();this.size=i[n]+s[n]+this._b+this._c,this.start=i[r],this.end=i[o]}function V(e){var t=function(e){if(!getComputedStyle)return null;var t=getComputedStyle(e);if(!t)return null;var n=e[s];return 0===n?null:n-="horizontal"===T?parseFloat(t.paddingLeft)+parseFloat(t.paddingRight):parseFloat(t.paddingTop)+parseFloat(t.paddingBottom)}(p);if(null===t)return e;if(w.reduce((function(e,t){return e+t}),0)>t)return e;var n=0,i=[],r=e.map((function(r,o){var s=t*r/100,c=g(j,0===o,o===e.length-1,z),a=w[o]+c;return s<a?(n+=a-s,i.push(0),a):(i.push(s-a),s)}));return 0===n?e:r.map((function(e,r){var o=e;if(n>0&&i[r]-n>0){var s=Math.min(n,i[r]-n);n-=s,o=e-s}return o/t*100}))}function $(){var e=c[this.a].element,n=c[this.b].element;this.dragging&&m(t,'onDragEnd',h)(B()),this.dragging=!1,l.removeEventListener('mouseup',this.stop),l.removeEventListener('touchend',this.stop),l.removeEventListener('touchcancel',this.stop),l.removeEventListener('mousemove',this.move),l.removeEventListener('touchmove',this.move),this.stop=null,this.move=null,e.removeEventListener('selectstart',h),e.removeEventListener('dragstart',h),n.removeEventListener('selectstart',h),n.removeEventListener('dragstart',h),e.style.userSelect='',e.style.webkitUserSelect='',e.style.MozUserSelect='',e.style.pointerEvents='',n.style.userSelect='',n.style.webkitUserSelect='',n.style.MozUserSelect='',n.style.pointerEvents='',this.gutter.style.cursor='',this.parent.style.cursor='',d.body.style.cursor=''}function W(e){if(!('button'in e)||0===e.button){var n=c[this.a].element,i=c[this.b].element;this.dragging||m(t,'onDragStart',h)(B()),e.preventDefault(),this.dragging=!0,this.move=U.bind(this),this.stop=$.bind(this),l.addEventListener('mouseup',this.stop),l.addEventListener('touchend',this.stop),l.addEventListener('touchcancel',this.stop),l.addEventListener('mousemove',this.move),l.addEventListener('touchmove',this.move),n.addEventListener('selectstart',h),n.addEventListener('dragstart',h),i.addEventListener('selectstart',h),i.addEventListener('dragstart',h),n.style.userSelect='none',n.style.webkitUserSelect='none',n.style.MozUserSelect='none',n.style.pointerEvents='none',i.style.userSelect='none',i.style.webkitUserSelect='none',i.style.MozUserSelect='none',i.style.pointerEvents='none',this.gutter.style.cursor=L,this.parent.style.cursor=L,d.body.style.cursor=L,I.call(this),this.dragOffset=A(e)-this.end}}"horizontal"===T?(n='width',i='clientX',r='left',o='right',s='clientWidth'):'vertical'===T&&(n='height',i='clientY',r='top',o='bottom',s='clientHeight'),O=V(O);var F=[];function N(e){var t=e.i===F.length,n=t?F[e.i-1]:F[e.i];I.call(n);var i=t?n.size-e.minSize-n._c:e.minSize+n._b;H.call(n,i)}return(c=a.map((function(e,t){var i,r={element:v(e),size:O[t],minSize:w[t],i:t};if(t>0&&((i={a:t-1,b:t,dragging:!1,direction:T,parent:p})._b=g(j,t-1==0,!1,z),i._c=g(j,!1,t===a.length-1,z),'row-reverse'===C||'column-reverse'===C)){var o=i.a;i.a=i.b,i.b=o}if(t>0){var s=_(t,T,r.element);!function(e,t,i){var r=R(n,t,i);Object.keys(r).forEach((function(t){e.style[t]=r[t]}))}(s,j,t),i._a=W.bind(i),s.addEventListener('mousedown',i._a),s.addEventListener('touchstart',i._a),p.insertBefore(s,r.element),i.gutter=s}return M(r.element,r.size,g(j,0===t,t===a.length-1,z),t),t>0&&F.push(i),r}))).forEach((function(e){var t=e.element.getBoundingClientRect()[n];t<e.minSize&&(P?N(e):e.minSize=t)})),{setSizes:function(e){var t=V(e);t.forEach((function(e,n){if(n>0){var i=F[n-1],r=c[i.a],o=c[i.b];r.size=t[n-1],o.size=e,M(r.element,r.size,i._b,r.i),M(o.element,o.size,i._c,o.i)}}))},getSizes:B,collapse:function(e){N(c[e])},destroy:function(e,t){F.forEach((function(i){if(!0!==t?i.parent.removeChild(i.gutter):(i.gutter.removeEventListener('mousedown',i._a),i.gutter.removeEventListener('touchstart',i._a)),!0!==e){var r=D(n,i.a.size,i._b);Object.keys(r).forEach((function(e){c[i.a].element.style[e]='',c[i.b].element.style[e]=''}))}}))},parent:p,pairs:F}};function O(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}var S=function(){function e(t,n){s()(this,e),this.editor=t,this.$=t.$,this.pfx=t.getConfig('stylePrefix'),this.opts=n,this.canvas=this.findWithinEditor(".".concat(this.pfx,"cv-canvas")),this.panelViews=n.appendTo?this.$(n.appendTo):this.findWithinEditor(".".concat(this.pfx,"pn-").concat(n.panelId)),this.isShowing=!0}return a()(e,[{key:"findPanel",value:function(){var e=this.editor.Panels,t=this.opts.panelId;return e.getPanel(t)||e.addPanel({id:t})}},{key:"findWithinEditor",value:function(e){return this.$(e,this.editor.getEl())}},{key:"buildCodeEditor",value:function(e){var t=this.editor,n=this.opts;return t.CodeManager.createViewer(function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?O(Object(n),!0).forEach((function(t){r()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):O(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({codeName:'html'===e?'htmlmixed':'css',theme:'hopscotch',readOnly:0,autoBeautify:1,autoCloseTags:1,autoCloseBrackets:1,styleActiveLine:1,smartIndent:1},n.codeViewOptions))}},{key:"buildSection",value:function(e,t){var n=this.$,i=this.pfx,r=this.opts,o=n('<section></section>'),s='html'===e?r.htmlBtnText:r.cssBtnText,c=r.cleanCssBtn&&'css'===e?"<button class=\"cp-delete-".concat(e," ").concat(i,"btn-prim\">").concat(r.cleanCssBtnText,"</button>"):'';o.append(n("\n <div class=\"codepanel-separator\">\n <div class=\"codepanel-label\">".concat(e,"</div>\n <div class=\"cp-btn-container\">\n ").concat(c,"\n <button class=\"cp-apply-").concat(e," ").concat(i,"btn-prim\">").concat(s,"</button>\n </div>\n </div>")));var a=t.getElement();return a.style.height='calc(100% - 30px)',o.append(a),this.codePanel.append(o),o.get(0)}},{key:"buildCodePanel",value:function(){var e=this,t=this.$,n=this.editor,i=this.opts.panelId?this.findPanel():0;this.codePanel=t('<div></div>'),this.codePanel.addClass('code-panel'),this.htmlCodeEditor=this.buildCodeEditor('html'),this.cssCodeEditor=this.buildCodeEditor('css');var r=[this.buildSection('html',this.htmlCodeEditor),this.buildSection('css',this.cssCodeEditor)];i&&!this.opts.appendTo&&i.set('appendContent',this.codePanel).trigger('change:appendContent'),this.opts.appendTo&&t(this.opts.appendTo).append(this.codePanel),this.updateEditorContents(),this.codePanel.find('.cp-apply-html').on('click',this.updateHtml.bind(this)),this.codePanel.find('.cp-apply-css').on('click',this.updateCss.bind(this)),this.opts.cleanCssBtn&&this.codePanel.find('.cp-delete-css').on('click',this.deleteSelectedCss.bind(this)),C(r,{direction:'vertical',sizes:[50,50],minSize:100,gutterSize:1,onDragEnd:this.refreshEditors.bind(this)}),n.on('component:update',(function(t){return e.updateEditorContents()}))}},{key:"showCodePanel",value:function(){this.isShowing=!0,this.updateEditorContents(),this.codePanel.css('display','block'),setTimeout(this.refreshEditors.bind(this),320),this.panelViews.css('width',this.opts.openState.pn),this.canvas.css('width',this.opts.openState.cv)}},{key:"hideCodePanel",value:function(){this.codePanel&&this.codePanel.css('display','none'),this.panelViews.css('width',this.opts.closedState.pn),this.canvas.css('width',this.opts.closedState.cv),this.isShowing=!1}},{key:"refreshEditors",value:function(){this.htmlCodeEditor.refresh(),this.cssCodeEditor.refresh()}},{key:"updateHtml",value:function(){var e=this.editor,t=this.component,n=this.htmlCodeEditor.getContent().trim();if(n&&n!==this.previousHtmlCode){this.previousHtmlCode=n;var i='';this.cssCodeEditor.getContent().split(/(?<=}\n)/g).forEach((function(e){/^#/.test(e)&&(i+=e)})),n+="<style>".concat(i,"</style>"),e.select(t.replaceWith(n))}}},{key:"updateCss",value:function(){var e=this.cssCodeEditor.getContent().trim();e&&e!==this.previousCssCode&&(this.parseRemove(e),this.previousCssCode=e,this.editor.Components.addComponent("<style>".concat(e,"</style>")))}},{key:"deleteSelectedCss",value:function(){var e=this;this.cssCodeEditor.editor.getSelections().forEach((function(t){return e.parseRemove(t)})),this.cssCodeEditor.editor.deleteH()}},{key:"parseRemove",value:function(e){var t=this,n=this.editor,i=n.CssComposer,r=i.getAll();n.Parser.parseCss(e).forEach((function(e){var n={singleAtRule:e.singleAtRule,atRuleType:e.atRuleType,mediaText:e.mediaText,state:e.state};e.selectors.length&&e.selectors.forEach((function(e){t.removeSelector(e,r,i,n)})),e.selectorsAdd&&e.selectorsAdd.split(', ').forEach((function(e){t.removeSelector(e,r,i,n)}))}))}},{key:"removeSelector",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},r=i.singleAtRule,o=i.atRuleType,s=i.mediaText,c=i.state,a=t.filter((function(t){return o&&s?function(e){return e.get('atRuleType')==o&&e.get('mediaText')==s}:o&&r?function(e){return e.get('atRuleType')==o&&e.get('singleAtRule')==r}:c?t==n.getRule("".concat(e,":").concat(c)):t==n.getRule(e)}));t.remove(a)}},{key:"updateEditorContents",value:function(){this.isShowing&&(this.component=this.editor.getSelected(),this.component&&(this.htmlCodeEditor.setContent(this.getComponentHtml(this.component)),this.cssCodeEditor.setContent(this.editor.CodeManager.getCode(this.component,'css',{cssc:this.editor.CssComposer}))))}},{key:"getComponentHtml",value:function(e){var t=this.pfx,n=this.opts,i='',r=e.getEl();!n.clearData&&r.classList.remove("".concat(t,"selected"));var o=n.clearData?e.toHTML():'wrapper'===r.id?r.innerHTML:r.outerHTML;!n.clearData&&r.classList.add("".concat(t,"selected")),i+=o;var s=n.editJs?e.getScriptString():'';return i+=s?"<script>".concat(s,"<\/script>"):''}}]),e}();function w(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function P(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?w(Object(n),!0).forEach((function(t){r()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):w(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var j=function(e,t){var n=e.Commands,i=null;n.add("open-code",{run:function(e){!i&&(i=new S(e,t))&&i.buildCodePanel(),i.showCodePanel()},stop:function(e){i&&i.hideCodePanel()}}),n.add("code-editor-object",(function(e,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new S(e,P(P({},i),t))})),n.add("code-editor-constructor",(function(){return S}))};function z(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function x(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?z(Object(n),!0).forEach((function(t){r()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):z(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}t.default=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=x(x({},{panelId:'views-container',appendTo:'',openState:{cv:'65%',pn:'35%'},closedState:{cv:'85%',pn:'15%'},editJs:!1,clearData:!1,codeViewOptions:{},cleanCssBtn:!0,htmlBtnText:'Apply',cssBtnText:'Apply',cleanCssBtnText:'Delete'}),t);j(e,n)}}])}));
/*! grapesjs-component-code-editor - 1.0.16 */
!function(e,t){'object'==typeof exports&&'object'==typeof module?module.exports=t():'function'==typeof define&&define.amd?define([],t):'object'==typeof exports?exports["grapesjs-component-code-editor"]=t():e["grapesjs-component-code-editor"]=t()}(window,(function(){return function(e){var t={};function n(i){if(t[i])return t[i].exports;var r=t[i]={i:i,l:!1,exports:{}};return e[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){'undefined'!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:'Module'}),Object.defineProperty(e,'__esModule',{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&'object'==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,'default',{enumerable:!0,value:e}),2&t&&'string'!=typeof e)for(var r in e)n.d(i,r,function(t){return e[t]}.bind(null,r));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,'a',t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=3)}([function(e,t){e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}},function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},function(e,t){function n(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}e.exports=function(e,t,i){return t&&n(e.prototype,t),i&&n(e,i),e}},function(e,t,n){"use strict";n.r(t);var i=n(0),r=n.n(i),o=n(1),s=n.n(o),c=n(2),a=n.n(c),l='undefined'!=typeof window?window:null,u=null===l,d=u?void 0:l.document,h=function(){return!1},p=u?'calc':['','-webkit-','-moz-','-o-'].filter((function(e){var t=d.createElement('div');return t.style.cssText="width:"+e+"calc(9px)",!!t.style.length})).shift()+"calc",f=function(e){return'string'==typeof e||e instanceof String},v=function(e){if(f(e)){var t=d.querySelector(e);if(!t)throw new Error("Selector "+e+" did not match a DOM element");return t}return e},m=function(e,t,n){var i=e[t];return void 0!==i?i:n},g=function(e,t,n,i){if(t){if('end'===i)return 0;if('center'===i)return e/2}else if(n){if('start'===i)return 0;if('center'===i)return e/2}return e},y=function(e,t){var n=d.createElement('div');return n.className="gutter gutter-"+t,n},b=function(e,t,n){var i={};return f(t)?i[e]=t:i[e]=p+"("+t+"% - "+n+"px)",i},E=function(e,t){var n;return(n={})[e]=t+"px",n},C=function(e,t){if(void 0===t&&(t={}),u)return{};var n,i,r,o,s,c,a=e;Array.from&&(a=Array.from(a));var p=v(a[0]).parentNode,f=getComputedStyle?getComputedStyle(p):null,C=f?f.flexDirection:null,O=m(t,'sizes')||a.map((function(){return 100/a.length})),S=m(t,'minSize',100),w=Array.isArray(S)?S:a.map((function(){return S})),P=m(t,'expandToMin',!1),j=m(t,'gutterSize',10),z=m(t,'gutterAlign','center'),x=m(t,'snapOffset',30),k=m(t,'dragInterval',1),T=m(t,'direction',"horizontal"),L=m(t,'cursor',"horizontal"===T?'col-resize':'row-resize'),_=m(t,'gutter',y),D=m(t,'elementStyle',b),R=m(t,'gutterStyle',E);function M(e,t,i,r){var o=D(n,t,i,r);Object.keys(o).forEach((function(t){e.style[t]=o[t]}))}function B(){return c.map((function(e){return e.size}))}function A(e){return'touches'in e?e.touches[0][i]:e[i]}function H(e){var t=c[this.a],n=c[this.b],i=t.size+n.size;t.size=e/this.size*i,n.size=i-e/this.size*i,M(t.element,t.size,this._b,t.i),M(n.element,n.size,this._c,n.i)}function U(e){var n,i=c[this.a],r=c[this.b];this.dragging&&(n=A(e)-this.start+(this._b-this.dragOffset),k>1&&(n=Math.round(n/k)*k),n<=i.minSize+x+this._b?n=i.minSize+this._b:n>=this.size-(r.minSize+x+this._c)&&(n=this.size-(r.minSize+this._c)),H.call(this,n),m(t,'onDrag',h)(B()))}function W(){var e=c[this.a].element,t=c[this.b].element,i=e.getBoundingClientRect(),s=t.getBoundingClientRect();this.size=i[n]+s[n]+this._b+this._c,this.start=i[r],this.end=i[o]}function I(e){var t=function(e){if(!getComputedStyle)return null;var t=getComputedStyle(e);if(!t)return null;var n=e[s];return 0===n?null:n-="horizontal"===T?parseFloat(t.paddingLeft)+parseFloat(t.paddingRight):parseFloat(t.paddingTop)+parseFloat(t.paddingBottom)}(p);if(null===t)return e;if(w.reduce((function(e,t){return e+t}),0)>t)return e;var n=0,i=[],r=e.map((function(r,o){var s=t*r/100,c=g(j,0===o,o===e.length-1,z),a=w[o]+c;return s<a?(n+=a-s,i.push(0),a):(i.push(s-a),s)}));return 0===n?e:r.map((function(e,r){var o=e;if(n>0&&i[r]-n>0){var s=Math.min(n,i[r]-n);n-=s,o=e-s}return o/t*100}))}function V(){var e=c[this.a].element,n=c[this.b].element;this.dragging&&m(t,'onDragEnd',h)(B()),this.dragging=!1,l.removeEventListener('mouseup',this.stop),l.removeEventListener('touchend',this.stop),l.removeEventListener('touchcancel',this.stop),l.removeEventListener('mousemove',this.move),l.removeEventListener('touchmove',this.move),this.stop=null,this.move=null,e.removeEventListener('selectstart',h),e.removeEventListener('dragstart',h),n.removeEventListener('selectstart',h),n.removeEventListener('dragstart',h),e.style.userSelect='',e.style.webkitUserSelect='',e.style.MozUserSelect='',e.style.pointerEvents='',n.style.userSelect='',n.style.webkitUserSelect='',n.style.MozUserSelect='',n.style.pointerEvents='',this.gutter.style.cursor='',this.parent.style.cursor='',d.body.style.cursor=''}function $(e){if(!('button'in e)||0===e.button){var n=c[this.a].element,i=c[this.b].element;this.dragging||m(t,'onDragStart',h)(B()),e.preventDefault(),this.dragging=!0,this.move=U.bind(this),this.stop=V.bind(this),l.addEventListener('mouseup',this.stop),l.addEventListener('touchend',this.stop),l.addEventListener('touchcancel',this.stop),l.addEventListener('mousemove',this.move),l.addEventListener('touchmove',this.move),n.addEventListener('selectstart',h),n.addEventListener('dragstart',h),i.addEventListener('selectstart',h),i.addEventListener('dragstart',h),n.style.userSelect='none',n.style.webkitUserSelect='none',n.style.MozUserSelect='none',n.style.pointerEvents='none',i.style.userSelect='none',i.style.webkitUserSelect='none',i.style.MozUserSelect='none',i.style.pointerEvents='none',this.gutter.style.cursor=L,this.parent.style.cursor=L,d.body.style.cursor=L,W.call(this),this.dragOffset=A(e)-this.end}}"horizontal"===T?(n='width',i='clientX',r='left',o='right',s='clientWidth'):'vertical'===T&&(n='height',i='clientY',r='top',o='bottom',s='clientHeight'),O=I(O);var F=[];function N(e){var t=e.i===F.length,n=t?F[e.i-1]:F[e.i];W.call(n);var i=t?n.size-e.minSize-n._c:e.minSize+n._b;H.call(n,i)}return(c=a.map((function(e,t){var i,r={element:v(e),size:O[t],minSize:w[t],i:t};if(t>0&&((i={a:t-1,b:t,dragging:!1,direction:T,parent:p})._b=g(j,t-1==0,!1,z),i._c=g(j,!1,t===a.length-1,z),'row-reverse'===C||'column-reverse'===C)){var o=i.a;i.a=i.b,i.b=o}if(t>0){var s=_(t,T,r.element);!function(e,t,i){var r=R(n,t,i);Object.keys(r).forEach((function(t){e.style[t]=r[t]}))}(s,j,t),i._a=$.bind(i),s.addEventListener('mousedown',i._a),s.addEventListener('touchstart',i._a),p.insertBefore(s,r.element),i.gutter=s}return M(r.element,r.size,g(j,0===t,t===a.length-1,z),t),t>0&&F.push(i),r}))).forEach((function(e){var t=e.element.getBoundingClientRect()[n];t<e.minSize&&(P?N(e):e.minSize=t)})),{setSizes:function(e){var t=I(e);t.forEach((function(e,n){if(n>0){var i=F[n-1],r=c[i.a],o=c[i.b];r.size=t[n-1],o.size=e,M(r.element,r.size,i._b,r.i),M(o.element,o.size,i._c,o.i)}}))},getSizes:B,collapse:function(e){N(c[e])},destroy:function(e,t){F.forEach((function(i){if(!0!==t?i.parent.removeChild(i.gutter):(i.gutter.removeEventListener('mousedown',i._a),i.gutter.removeEventListener('touchstart',i._a)),!0!==e){var r=D(n,i.a.size,i._b);Object.keys(r).forEach((function(e){c[i.a].element.style[e]='',c[i.b].element.style[e]=''}))}}))},parent:p,pairs:F}};function O(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}var S=function(){function e(t,n){s()(this,e),this.editor=t,this.$=t.$,this.pfx=t.getConfig('stylePrefix'),this.opts=n,this.canvas=this.findWithinEditor(".".concat(this.pfx,"cv-canvas")),this.panelViews=n.appendTo?this.$(n.appendTo):this.findWithinEditor(".".concat(this.pfx,"pn-").concat(n.panelId)),this.isShowing=!0}return a()(e,[{key:"findPanel",value:function(){var e=this.editor.Panels,t=this.opts.panelId;return e.getPanel(t)||e.addPanel({id:t})}},{key:"findWithinEditor",value:function(e){return this.$(e,this.editor.getEl())}},{key:"buildCodeEditor",value:function(e){var t=this.editor,n=this.opts;return t.CodeManager.createViewer(function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?O(Object(n),!0).forEach((function(t){r()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):O(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({codeName:'html'===e?'htmlmixed':'css',theme:'hopscotch',readOnly:0,autoBeautify:1,autoCloseTags:1,autoCloseBrackets:1,styleActiveLine:1,smartIndent:1},n.codeViewOptions))}},{key:"buildSection",value:function(e,t){var n=this.$,i=this.pfx,r=this.opts,o=n('<section></section>'),s='html'===e?r.htmlBtnText:r.cssBtnText,c=r.cleanCssBtn&&'css'===e?"<button class=\"cp-delete-".concat(e," ").concat(i,"btn-prim\">").concat(r.cleanCssBtnText,"</button>"):'';o.append(n("\n <div class=\"codepanel-separator\">\n <div class=\"codepanel-label\">".concat(e,"</div>\n <div class=\"cp-btn-container\">\n ").concat(c,"\n <button class=\"cp-apply-").concat(e," ").concat(i,"btn-prim\">").concat(s,"</button>\n </div>\n </div>")));var a=t.getElement();return a.style.height='calc(100% - 30px)',o.append(a),this.codePanel.append(o),o.get(0)}},{key:"buildCodePanel",value:function(){var e=this,t=this.$,n=this.editor,i=this.opts.panelId?this.findPanel():0;this.codePanel=t('<div></div>'),this.codePanel.addClass('code-panel'),this.htmlCodeEditor=this.buildCodeEditor('html'),this.cssCodeEditor=this.buildCodeEditor('css');var r=[this.buildSection('html',this.htmlCodeEditor),this.buildSection('css',this.cssCodeEditor)];i&&!this.opts.appendTo&&i.set('appendContent',this.codePanel).trigger('change:appendContent'),this.opts.appendTo&&t(this.opts.appendTo).append(this.codePanel),this.updateEditorContents(),this.codePanel.find('.cp-apply-html').on('click',this.updateHtml.bind(this)),this.codePanel.find('.cp-apply-css').on('click',this.updateCss.bind(this)),this.opts.cleanCssBtn&&this.codePanel.find('.cp-delete-css').on('click',this.deleteSelectedCss.bind(this)),C(r,{direction:'vertical',sizes:[50,50],minSize:100,gutterSize:1,onDragEnd:this.refreshEditors.bind(this)}),n.on('component:update',(function(t){return e.updateEditorContents()}))}},{key:"showCodePanel",value:function(){this.isShowing=!0,this.updateEditorContents(),this.codePanel.css('display','block'),setTimeout(this.refreshEditors.bind(this),320),this.opts.preserveWidth||(this.panelViews.css('width',this.opts.openState.pn),this.canvas.css('width',this.opts.openState.cv))}},{key:"hideCodePanel",value:function(){this.codePanel&&this.codePanel.css('display','none'),this.isShowing=!1,this.opts.preserveWidth||(this.panelViews.css('width',this.opts.closedState.pn),this.canvas.css('width',this.opts.closedState.cv))}},{key:"refreshEditors",value:function(){this.htmlCodeEditor.refresh(),this.cssCodeEditor.refresh()}},{key:"updateHtml",value:function(){var e=this.editor,t=this.component,n=this.htmlCodeEditor.getContent().trim();if(n&&n!==this.previousHtmlCode){this.previousHtmlCode=n;var i='';this.cssCodeEditor.getContent().split(/(?<=}\n)/g).forEach((function(e){/^#/.test(e)&&(i+=e)})),n+="<style>".concat(i,"</style>"),e.select(t.replaceWith(n))}}},{key:"updateCss",value:function(){var e=this.cssCodeEditor.getContent().trim();e&&e!==this.previousCssCode&&(this.parseRemove(e),this.previousCssCode=e,this.editor.Components.addComponent("<style>".concat(e,"</style>")))}},{key:"deleteSelectedCss",value:function(){var e=this;this.cssCodeEditor.editor.getSelections().forEach((function(t){return e.parseRemove(t)})),this.cssCodeEditor.editor.deleteH()}},{key:"parseRemove",value:function(e){var t=this,n=this.editor,i=n.CssComposer,r=i.getAll();n.Parser.parseCss(e).forEach((function(e){var n={singleAtRule:e.singleAtRule,atRuleType:e.atRuleType,mediaText:e.mediaText,state:e.state};e.selectors.length&&e.selectors.forEach((function(e){t.removeSelector(e,r,i,n)})),e.selectorsAdd&&e.selectorsAdd.split(', ').forEach((function(e){t.removeSelector(e,r,i,n)}))}))}},{key:"removeSelector",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},r=i.singleAtRule,o=i.atRuleType,s=i.mediaText,c=i.state,a=t.filter((function(t){return o&&s?function(e){return e.get('atRuleType')==o&&e.get('mediaText')==s}:o&&r?function(e){return e.get('atRuleType')==o&&e.get('singleAtRule')==r}:c?t==n.getRule("".concat(e,":").concat(c)):t==n.getRule(e)}));t.remove(a)}},{key:"updateEditorContents",value:function(){this.isShowing&&(this.component=this.editor.getSelected(),this.component&&(this.htmlCodeEditor.setContent(this.getComponentHtml(this.component)),this.cssCodeEditor.setContent(this.editor.CodeManager.getCode(this.component,'css',{cssc:this.editor.CssComposer}))))}},{key:"getComponentHtml",value:function(e){var t=this.pfx,n=this.opts,i='',r=e.getEl();!n.clearData&&r.classList.remove("".concat(t,"selected"));var o=n.clearData?e.toHTML():'wrapper'===r.id?r.innerHTML:r.outerHTML;!n.clearData&&r.classList.add("".concat(t,"selected")),i+=o;var s=n.editJs?e.getScriptString():'';return i+=s?"<script>".concat(s,"<\/script>"):''}}]),e}();function w(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function P(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?w(Object(n),!0).forEach((function(t){r()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):w(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var j=function(e,t){var n=e.Commands,i=null;n.add("open-code",{run:function(e){!i&&(i=new S(e,t))&&i.buildCodePanel(),i.showCodePanel()},stop:function(e){i&&i.hideCodePanel()}}),n.add("code-editor-object",(function(e,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new S(e,P(P({},i),t))})),n.add("code-editor-constructor",(function(){return S}))};function z(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function x(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?z(Object(n),!0).forEach((function(t){r()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):z(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}t.default=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=x(x({},{panelId:'views-container',appendTo:'',openState:{cv:'65%',pn:'35%'},closedState:{cv:'85%',pn:'15%'},codeViewOptions:{},preserveWidth:!1,editJs:!1,clearData:!1,cleanCssBtn:!0,htmlBtnText:'Apply',cssBtnText:'Apply',cleanCssBtnText:'Delete'}),t);j(e,n)}}])}));
//# sourceMappingURL=grapesjs-component-code-editor.min.js.map

@@ -1,1 +0,1 @@

{"version":3,"sources":["webpack://grapesjs-component-code-editor/webpack/universalModuleDefinition","webpack://grapesjs-component-code-editor/webpack/bootstrap","webpack://grapesjs-component-code-editor/./node_modules/@babel/runtime/helpers/defineProperty.js","webpack://grapesjs-component-code-editor/./node_modules/@babel/runtime/helpers/classCallCheck.js","webpack://grapesjs-component-code-editor/./node_modules/@babel/runtime/helpers/createClass.js","webpack://grapesjs-component-code-editor/./node_modules/split.js/dist/split.es.js","webpack://grapesjs-component-code-editor/./src/code-editor/index.js","webpack://grapesjs-component-code-editor/./src/commands.js","webpack://grapesjs-component-code-editor/./src/consts.js","webpack://grapesjs-component-code-editor/./src/index.js"],"names":["root","factory","exports","module","define","amd","window","installedModules","__webpack_require__","moduleId","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","obj","configurable","writable","instance","Constructor","TypeError","_defineProperties","target","props","length","descriptor","protoProps","staticProps","global","ssr","undefined","document","NOOP","calc","filter","prefix","el","createElement","style","cssText","shift","isString","v","String","elementOrSelector","ele","querySelector","Error","getOption","options","propName","def","getGutterSize","gutterSize","isFirst","isLast","gutterAlign","defaultGutterFn","gutterDirection","gut","className","defaultElementStyleFn","dim","size","gutSize","defaultGutterStyleFn","idsOption","dimension","clientAxis","position","positionEnd","clientSize","elements","ids","Array","from","parent","parentNode","parentStyle","getComputedStyle","parentFlexDirection","flexDirection","sizes","map","minSize","minSizes","isArray","expandToMin","snapOffset","dragInterval","direction","cursor","gutter","elementStyle","gutterStyle","setElementSize","keys","forEach","prop","getSizes","element","getMousePosition","e","touches","adjust","offset","a","this","b","percentage","drag","dragging","start","dragOffset","Math","round","calculateSizes","aBounds","bBounds","end","trimToMin","sizesToTrim","parentSize","computedStyle","parseFloat","paddingLeft","paddingRight","paddingTop","paddingBottom","innerSize","reduce","excessPixels","toSpare","pixelSizes","pixelSize","elementGutterSize","elementMinSize","push","newPixelSize","takenPixels","min","stopDragging","stop","move","userSelect","webkitUserSelect","MozUserSelect","pointerEvents","body","startDragging","button","preventDefault","pairs","adjustToMin","pair","id","temp","gutterElement","setGutterSize","insertBefore","computedSize","setSizes","newSizes","trimmed","newSize","collapse","destroy","preserveStyles","preserveGutter","removeChild","CodeEditor","editor","opts","$","pfx","getConfig","canvas","findWithinEditor","panelViews","appendTo","panelId","isShowing","pn","Panels","getPanel","addPanel","selector","getEl","type","CodeManager","createViewer","codeName","theme","readOnly","autoBeautify","autoCloseTags","autoCloseBrackets","styleActiveLine","smartIndent","codeViewOptions","codeViewer","section","btnText","htmlBtnText","cssBtnText","cleanCssBtn","cleanCssBtnText","append","codeViewerEl","getElement","height","codePanel","panel","findPanel","addClass","htmlCodeEditor","buildCodeEditor","cssCodeEditor","sections","buildSection","set","trigger","updateEditorContents","find","on","updateHtml","updateCss","deleteSelectedCss","Split","onDragEnd","refreshEditors","model","css","setTimeout","openState","cv","closedState","refresh","component","htmlCode","getContent","trim","previousHtmlCode","idStyles","split","rule","test","select","replaceWith","cssCode","previousCssCode","parseRemove","Components","addComponent","getSelections","selection","deleteH","removeCss","cssc","CssComposer","allRules","getAll","Parser","parseCss","config","singleAtRule","atRuleType","mediaText","state","selectors","removeSelector","selectorsAdd","toRemove","getRule","remove","getSelected","setContent","getComponentHtml","getCode","result","componentEl","clearData","classList","html","toHTML","innerHTML","outerHTML","add","js","editJs","getScriptString","cm","Commands","codeEditor","run","buildCodePanel","showCodePanel","hideCodePanel","sender","commands"],"mappings":";CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,I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,GACpB,IAAMuH,EAAKxH,EAAOyH,SACdC,EAAa,KAEjBF,EAAGJ,ICNW,YDMM,CAChBO,IAAK,SAAA3H,IACA0H,IAAeA,EAAa,IAAI3H,EAAWC,EAAQC,KAAUyH,EAAWE,iBACzEF,EAAWG,iBAEf1J,KAAM,SAAA6B,GACF0H,GAAcA,EAAWI,mBAIjCN,EAAGJ,ICfS,sBDeM,SAACpH,EAAQ+H,GAAyB,IAAjBzP,EAAiB,uDAAP,GACzC,OAAO,IAAIyH,EAAWC,EAAf,OAA4B1H,GAAY2H,OAGnDuH,EAAGJ,IClBa,2BDkBM,WAClB,OAAOrH,M,ikBEpBA,mBAACC,GAAsB,IAAdC,EAAc,uDAAP,GACrB3H,EAAU,OACT,CAECmI,QAAS,kBAETD,SAAU,GAEVuD,UAAW,CACPC,GAAI,MACJrD,GAAI,OAGRsD,YAAa,CACTD,GAAI,MACJrD,GAAI,OAGR2G,QAAQ,EAERR,WAAW,EAEXlF,gBAAiB,GAEjBM,aAAa,EAEbF,YAAa,QAEbC,WAAY,QAEZE,gBAAiB,WAElBlC,GAIP+H,EAAShI,EAAQ1H","file":"grapesjs-component-code-editor.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"grapesjs-component-code-editor\"] = factory();\n\telse\n\t\troot[\"grapesjs-component-code-editor\"] = factory();\n})(window, function() {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 3);\n","function _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nmodule.exports = _defineProperty;","function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nmodule.exports = _classCallCheck;","function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}\n\nmodule.exports = _createClass;","// The programming goals of Split.js are to deliver readable, understandable and\n// maintainable code, while at the same time manually optimizing for tiny minified file size,\n// browser compatibility without additional requirements\n// and very few assumptions about the user's page layout.\nvar global = typeof window !== 'undefined' ? window : null;\nvar ssr = global === null;\nvar document = !ssr ? global.document : undefined;\n\n// Save a couple long function names that are used frequently.\n// This optimization saves around 400 bytes.\nvar addEventListener = 'addEventListener';\nvar removeEventListener = 'removeEventListener';\nvar getBoundingClientRect = 'getBoundingClientRect';\nvar gutterStartDragging = '_a';\nvar aGutterSize = '_b';\nvar bGutterSize = '_c';\nvar HORIZONTAL = 'horizontal';\nvar NOOP = function () { return false; };\n\n// Helper function determines which prefixes of CSS calc we need.\n// We only need to do this once on startup, when this anonymous function is called.\n//\n// Tests -webkit, -moz and -o prefixes. Modified from StackOverflow:\n// http://stackoverflow.com/questions/16625140/js-feature-detection-to-detect-the-usage-of-webkit-calc-over-calc/16625167#16625167\nvar calc = ssr\n ? 'calc'\n : ((['', '-webkit-', '-moz-', '-o-']\n .filter(function (prefix) {\n var el = document.createElement('div');\n el.style.cssText = \"width:\" + prefix + \"calc(9px)\";\n\n return !!el.style.length\n })\n .shift()) + \"calc\");\n\n// Helper function checks if its argument is a string-like type\nvar isString = function (v) { return typeof v === 'string' || v instanceof String; };\n\n// Helper function allows elements and string selectors to be used\n// interchangeably. In either case an element is returned. This allows us to\n// do `Split([elem1, elem2])` as well as `Split(['#id1', '#id2'])`.\nvar elementOrSelector = function (el) {\n if (isString(el)) {\n var ele = document.querySelector(el);\n if (!ele) {\n throw new Error((\"Selector \" + el + \" did not match a DOM element\"))\n }\n return ele\n }\n\n return el\n};\n\n// Helper function gets a property from the properties object, with a default fallback\nvar getOption = function (options, propName, def) {\n var value = options[propName];\n if (value !== undefined) {\n return value\n }\n return def\n};\n\nvar getGutterSize = function (gutterSize, isFirst, isLast, gutterAlign) {\n if (isFirst) {\n if (gutterAlign === 'end') {\n return 0\n }\n if (gutterAlign === 'center') {\n return gutterSize / 2\n }\n } else if (isLast) {\n if (gutterAlign === 'start') {\n return 0\n }\n if (gutterAlign === 'center') {\n return gutterSize / 2\n }\n }\n\n return gutterSize\n};\n\n// Default options\nvar defaultGutterFn = function (i, gutterDirection) {\n var gut = document.createElement('div');\n gut.className = \"gutter gutter-\" + gutterDirection;\n return gut\n};\n\nvar defaultElementStyleFn = function (dim, size, gutSize) {\n var style = {};\n\n if (!isString(size)) {\n style[dim] = calc + \"(\" + size + \"% - \" + gutSize + \"px)\";\n } else {\n style[dim] = size;\n }\n\n return style\n};\n\nvar defaultGutterStyleFn = function (dim, gutSize) {\n var obj;\n\n return (( obj = {}, obj[dim] = (gutSize + \"px\"), obj ));\n};\n\n// The main function to initialize a split. Split.js thinks about each pair\n// of elements as an independant pair. Dragging the gutter between two elements\n// only changes the dimensions of elements in that pair. This is key to understanding\n// how the following functions operate, since each function is bound to a pair.\n//\n// A pair object is shaped like this:\n//\n// {\n// a: DOM element,\n// b: DOM element,\n// aMin: Number,\n// bMin: Number,\n// dragging: Boolean,\n// parent: DOM element,\n// direction: 'horizontal' | 'vertical'\n// }\n//\n// The basic sequence:\n//\n// 1. Set defaults to something sane. `options` doesn't have to be passed at all.\n// 2. Initialize a bunch of strings based on the direction we're splitting.\n// A lot of the behavior in the rest of the library is paramatized down to\n// rely on CSS strings and classes.\n// 3. Define the dragging helper functions, and a few helpers to go with them.\n// 4. Loop through the elements while pairing them off. Every pair gets an\n// `pair` object and a gutter.\n// 5. Actually size the pair elements, insert gutters and attach event listeners.\nvar Split = function (idsOption, options) {\n if ( options === void 0 ) options = {};\n\n if (ssr) { return {} }\n\n var ids = idsOption;\n var dimension;\n var clientAxis;\n var position;\n var positionEnd;\n var clientSize;\n var elements;\n\n // Allow HTMLCollection to be used as an argument when supported\n if (Array.from) {\n ids = Array.from(ids);\n }\n\n // All DOM elements in the split should have a common parent. We can grab\n // the first elements parent and hope users read the docs because the\n // behavior will be whacky otherwise.\n var firstElement = elementOrSelector(ids[0]);\n var parent = firstElement.parentNode;\n var parentStyle = getComputedStyle ? getComputedStyle(parent) : null;\n var parentFlexDirection = parentStyle ? parentStyle.flexDirection : null;\n\n // Set default options.sizes to equal percentages of the parent element.\n var sizes = getOption(options, 'sizes') || ids.map(function () { return 100 / ids.length; });\n\n // Standardize minSize to an array if it isn't already. This allows minSize\n // to be passed as a number.\n var minSize = getOption(options, 'minSize', 100);\n var minSizes = Array.isArray(minSize) ? minSize : ids.map(function () { return minSize; });\n\n // Get other options\n var expandToMin = getOption(options, 'expandToMin', false);\n var gutterSize = getOption(options, 'gutterSize', 10);\n var gutterAlign = getOption(options, 'gutterAlign', 'center');\n var snapOffset = getOption(options, 'snapOffset', 30);\n var dragInterval = getOption(options, 'dragInterval', 1);\n var direction = getOption(options, 'direction', HORIZONTAL);\n var cursor = getOption(\n options,\n 'cursor',\n direction === HORIZONTAL ? 'col-resize' : 'row-resize'\n );\n var gutter = getOption(options, 'gutter', defaultGutterFn);\n var elementStyle = getOption(\n options,\n 'elementStyle',\n defaultElementStyleFn\n );\n var gutterStyle = getOption(options, 'gutterStyle', defaultGutterStyleFn);\n\n // 2. Initialize a bunch of strings based on the direction we're splitting.\n // A lot of the behavior in the rest of the library is paramatized down to\n // rely on CSS strings and classes.\n if (direction === HORIZONTAL) {\n dimension = 'width';\n clientAxis = 'clientX';\n position = 'left';\n positionEnd = 'right';\n clientSize = 'clientWidth';\n } else if (direction === 'vertical') {\n dimension = 'height';\n clientAxis = 'clientY';\n position = 'top';\n positionEnd = 'bottom';\n clientSize = 'clientHeight';\n }\n\n // 3. Define the dragging helper functions, and a few helpers to go with them.\n // Each helper is bound to a pair object that contains its metadata. This\n // also makes it easy to store references to listeners that that will be\n // added and removed.\n //\n // Even though there are no other functions contained in them, aliasing\n // this to self saves 50 bytes or so since it's used so frequently.\n //\n // The pair object saves metadata like dragging state, position and\n // event listener references.\n\n function setElementSize(el, size, gutSize, i) {\n // Split.js allows setting sizes via numbers (ideally), or if you must,\n // by string, like '300px'. This is less than ideal, because it breaks\n // the fluid layout that `calc(% - px)` provides. You're on your own if you do that,\n // make sure you calculate the gutter size by hand.\n var style = elementStyle(dimension, size, gutSize, i);\n\n Object.keys(style).forEach(function (prop) {\n // eslint-disable-next-line no-param-reassign\n el.style[prop] = style[prop];\n });\n }\n\n function setGutterSize(gutterElement, gutSize, i) {\n var style = gutterStyle(dimension, gutSize, i);\n\n Object.keys(style).forEach(function (prop) {\n // eslint-disable-next-line no-param-reassign\n gutterElement.style[prop] = style[prop];\n });\n }\n\n function getSizes() {\n return elements.map(function (element) { return element.size; })\n }\n\n // Supports touch events, but not multitouch, so only the first\n // finger `touches[0]` is counted.\n function getMousePosition(e) {\n if ('touches' in e) { return e.touches[0][clientAxis] }\n return e[clientAxis]\n }\n\n // Actually adjust the size of elements `a` and `b` to `offset` while dragging.\n // calc is used to allow calc(percentage + gutterpx) on the whole split instance,\n // which allows the viewport to be resized without additional logic.\n // Element a's size is the same as offset. b's size is total size - a size.\n // Both sizes are calculated from the initial parent percentage,\n // then the gutter size is subtracted.\n function adjust(offset) {\n var a = elements[this.a];\n var b = elements[this.b];\n var percentage = a.size + b.size;\n\n a.size = (offset / this.size) * percentage;\n b.size = percentage - (offset / this.size) * percentage;\n\n setElementSize(a.element, a.size, this[aGutterSize], a.i);\n setElementSize(b.element, b.size, this[bGutterSize], b.i);\n }\n\n // drag, where all the magic happens. The logic is really quite simple:\n //\n // 1. Ignore if the pair is not dragging.\n // 2. Get the offset of the event.\n // 3. Snap offset to min if within snappable range (within min + snapOffset).\n // 4. Actually adjust each element in the pair to offset.\n //\n // ---------------------------------------------------------------------\n // | | <- a.minSize || b.minSize -> | |\n // | | | <- this.snapOffset || this.snapOffset -> | | |\n // | | | || | | |\n // | | | || | | |\n // ---------------------------------------------------------------------\n // | <- this.start this.size -> |\n function drag(e) {\n var offset;\n var a = elements[this.a];\n var b = elements[this.b];\n\n if (!this.dragging) { return }\n\n // Get the offset of the event from the first side of the\n // pair `this.start`. Then offset by the initial position of the\n // mouse compared to the gutter size.\n offset =\n getMousePosition(e) -\n this.start +\n (this[aGutterSize] - this.dragOffset);\n\n if (dragInterval > 1) {\n offset = Math.round(offset / dragInterval) * dragInterval;\n }\n\n // If within snapOffset of min or max, set offset to min or max.\n // snapOffset buffers a.minSize and b.minSize, so logic is opposite for both.\n // Include the appropriate gutter sizes to prevent overflows.\n if (offset <= a.minSize + snapOffset + this[aGutterSize]) {\n offset = a.minSize + this[aGutterSize];\n } else if (\n offset >=\n this.size - (b.minSize + snapOffset + this[bGutterSize])\n ) {\n offset = this.size - (b.minSize + this[bGutterSize]);\n }\n\n // Actually adjust the size.\n adjust.call(this, offset);\n\n // Call the drag callback continously. Don't do anything too intensive\n // in this callback.\n getOption(options, 'onDrag', NOOP)(getSizes());\n }\n\n // Cache some important sizes when drag starts, so we don't have to do that\n // continously:\n //\n // `size`: The total size of the pair. First + second + first gutter + second gutter.\n // `start`: The leading side of the first element.\n //\n // ------------------------------------------------\n // | aGutterSize -> ||| |\n // | ||| |\n // | ||| |\n // | ||| <- bGutterSize |\n // ------------------------------------------------\n // | <- start size -> |\n function calculateSizes() {\n // Figure out the parent size minus padding.\n var a = elements[this.a].element;\n var b = elements[this.b].element;\n\n var aBounds = a[getBoundingClientRect]();\n var bBounds = b[getBoundingClientRect]();\n\n this.size =\n aBounds[dimension] +\n bBounds[dimension] +\n this[aGutterSize] +\n this[bGutterSize];\n this.start = aBounds[position];\n this.end = aBounds[positionEnd];\n }\n\n function innerSize(element) {\n // Return nothing if getComputedStyle is not supported (< IE9)\n // Or if parent element has no layout yet\n if (!getComputedStyle) { return null }\n\n var computedStyle = getComputedStyle(element);\n\n if (!computedStyle) { return null }\n\n var size = element[clientSize];\n\n if (size === 0) { return null }\n\n if (direction === HORIZONTAL) {\n size -=\n parseFloat(computedStyle.paddingLeft) +\n parseFloat(computedStyle.paddingRight);\n } else {\n size -=\n parseFloat(computedStyle.paddingTop) +\n parseFloat(computedStyle.paddingBottom);\n }\n\n return size\n }\n\n // When specifying percentage sizes that are less than the computed\n // size of the element minus the gutter, the lesser percentages must be increased\n // (and decreased from the other elements) to make space for the pixels\n // subtracted by the gutters.\n function trimToMin(sizesToTrim) {\n // Try to get inner size of parent element.\n // If it's no supported, return original sizes.\n var parentSize = innerSize(parent);\n if (parentSize === null) {\n return sizesToTrim\n }\n\n if (minSizes.reduce(function (a, b) { return a + b; }, 0) > parentSize) {\n return sizesToTrim\n }\n\n // Keep track of the excess pixels, the amount of pixels over the desired percentage\n // Also keep track of the elements with pixels to spare, to decrease after if needed\n var excessPixels = 0;\n var toSpare = [];\n\n var pixelSizes = sizesToTrim.map(function (size, i) {\n // Convert requested percentages to pixel sizes\n var pixelSize = (parentSize * size) / 100;\n var elementGutterSize = getGutterSize(\n gutterSize,\n i === 0,\n i === sizesToTrim.length - 1,\n gutterAlign\n );\n var elementMinSize = minSizes[i] + elementGutterSize;\n\n // If element is too smal, increase excess pixels by the difference\n // and mark that it has no pixels to spare\n if (pixelSize < elementMinSize) {\n excessPixels += elementMinSize - pixelSize;\n toSpare.push(0);\n return elementMinSize\n }\n\n // Otherwise, mark the pixels it has to spare and return it's original size\n toSpare.push(pixelSize - elementMinSize);\n return pixelSize\n });\n\n // If nothing was adjusted, return the original sizes\n if (excessPixels === 0) {\n return sizesToTrim\n }\n\n return pixelSizes.map(function (pixelSize, i) {\n var newPixelSize = pixelSize;\n\n // While there's still pixels to take, and there's enough pixels to spare,\n // take as many as possible up to the total excess pixels\n if (excessPixels > 0 && toSpare[i] - excessPixels > 0) {\n var takenPixels = Math.min(\n excessPixels,\n toSpare[i] - excessPixels\n );\n\n // Subtract the amount taken for the next iteration\n excessPixels -= takenPixels;\n newPixelSize = pixelSize - takenPixels;\n }\n\n // Return the pixel size adjusted as a percentage\n return (newPixelSize / parentSize) * 100\n })\n }\n\n // stopDragging is very similar to startDragging in reverse.\n function stopDragging() {\n var self = this;\n var a = elements[self.a].element;\n var b = elements[self.b].element;\n\n if (self.dragging) {\n getOption(options, 'onDragEnd', NOOP)(getSizes());\n }\n\n self.dragging = false;\n\n // Remove the stored event listeners. This is why we store them.\n global[removeEventListener]('mouseup', self.stop);\n global[removeEventListener]('touchend', self.stop);\n global[removeEventListener]('touchcancel', self.stop);\n global[removeEventListener]('mousemove', self.move);\n global[removeEventListener]('touchmove', self.move);\n\n // Clear bound function references\n self.stop = null;\n self.move = null;\n\n a[removeEventListener]('selectstart', NOOP);\n a[removeEventListener]('dragstart', NOOP);\n b[removeEventListener]('selectstart', NOOP);\n b[removeEventListener]('dragstart', NOOP);\n\n a.style.userSelect = '';\n a.style.webkitUserSelect = '';\n a.style.MozUserSelect = '';\n a.style.pointerEvents = '';\n\n b.style.userSelect = '';\n b.style.webkitUserSelect = '';\n b.style.MozUserSelect = '';\n b.style.pointerEvents = '';\n\n self.gutter.style.cursor = '';\n self.parent.style.cursor = '';\n document.body.style.cursor = '';\n }\n\n // startDragging calls `calculateSizes` to store the inital size in the pair object.\n // It also adds event listeners for mouse/touch events,\n // and prevents selection while dragging so avoid the selecting text.\n function startDragging(e) {\n // Right-clicking can't start dragging.\n if ('button' in e && e.button !== 0) {\n return\n }\n\n // Alias frequently used variables to save space. 200 bytes.\n var self = this;\n var a = elements[self.a].element;\n var b = elements[self.b].element;\n\n // Call the onDragStart callback.\n if (!self.dragging) {\n getOption(options, 'onDragStart', NOOP)(getSizes());\n }\n\n // Don't actually drag the element. We emulate that in the drag function.\n e.preventDefault();\n\n // Set the dragging property of the pair object.\n self.dragging = true;\n\n // Create two event listeners bound to the same pair object and store\n // them in the pair object.\n self.move = drag.bind(self);\n self.stop = stopDragging.bind(self);\n\n // All the binding. `window` gets the stop events in case we drag out of the elements.\n global[addEventListener]('mouseup', self.stop);\n global[addEventListener]('touchend', self.stop);\n global[addEventListener]('touchcancel', self.stop);\n global[addEventListener]('mousemove', self.move);\n global[addEventListener]('touchmove', self.move);\n\n // Disable selection. Disable!\n a[addEventListener]('selectstart', NOOP);\n a[addEventListener]('dragstart', NOOP);\n b[addEventListener]('selectstart', NOOP);\n b[addEventListener]('dragstart', NOOP);\n\n a.style.userSelect = 'none';\n a.style.webkitUserSelect = 'none';\n a.style.MozUserSelect = 'none';\n a.style.pointerEvents = 'none';\n\n b.style.userSelect = 'none';\n b.style.webkitUserSelect = 'none';\n b.style.MozUserSelect = 'none';\n b.style.pointerEvents = 'none';\n\n // Set the cursor at multiple levels\n self.gutter.style.cursor = cursor;\n self.parent.style.cursor = cursor;\n document.body.style.cursor = cursor;\n\n // Cache the initial sizes of the pair.\n calculateSizes.call(self);\n\n // Determine the position of the mouse compared to the gutter\n self.dragOffset = getMousePosition(e) - self.end;\n }\n\n // adjust sizes to ensure percentage is within min size and gutter.\n sizes = trimToMin(sizes);\n\n // 5. Create pair and element objects. Each pair has an index reference to\n // elements `a` and `b` of the pair (first and second elements).\n // Loop through the elements while pairing them off. Every pair gets a\n // `pair` object and a gutter.\n //\n // Basic logic:\n //\n // - Starting with the second element `i > 0`, create `pair` objects with\n // `a = i - 1` and `b = i`\n // - Set gutter sizes based on the _pair_ being first/last. The first and last\n // pair have gutterSize / 2, since they only have one half gutter, and not two.\n // - Create gutter elements and add event listeners.\n // - Set the size of the elements, minus the gutter sizes.\n //\n // -----------------------------------------------------------------------\n // | i=0 | i=1 | i=2 | i=3 |\n // | | | | |\n // | pair 0 pair 1 pair 2 |\n // | | | | |\n // -----------------------------------------------------------------------\n var pairs = [];\n elements = ids.map(function (id, i) {\n // Create the element object.\n var element = {\n element: elementOrSelector(id),\n size: sizes[i],\n minSize: minSizes[i],\n i: i,\n };\n\n var pair;\n\n if (i > 0) {\n // Create the pair object with its metadata.\n pair = {\n a: i - 1,\n b: i,\n dragging: false,\n direction: direction,\n parent: parent,\n };\n\n pair[aGutterSize] = getGutterSize(\n gutterSize,\n i - 1 === 0,\n false,\n gutterAlign\n );\n pair[bGutterSize] = getGutterSize(\n gutterSize,\n false,\n i === ids.length - 1,\n gutterAlign\n );\n\n // if the parent has a reverse flex-direction, switch the pair elements.\n if (\n parentFlexDirection === 'row-reverse' ||\n parentFlexDirection === 'column-reverse'\n ) {\n var temp = pair.a;\n pair.a = pair.b;\n pair.b = temp;\n }\n }\n\n // Determine the size of the current element. IE8 is supported by\n // staticly assigning sizes without draggable gutters. Assigns a string\n // to `size`.\n //\n // Create gutter elements for each pair.\n if (i > 0) {\n var gutterElement = gutter(i, direction, element.element);\n setGutterSize(gutterElement, gutterSize, i);\n\n // Save bound event listener for removal later\n pair[gutterStartDragging] = startDragging.bind(pair);\n\n // Attach bound event listener\n gutterElement[addEventListener](\n 'mousedown',\n pair[gutterStartDragging]\n );\n gutterElement[addEventListener](\n 'touchstart',\n pair[gutterStartDragging]\n );\n\n parent.insertBefore(gutterElement, element.element);\n\n pair.gutter = gutterElement;\n }\n\n setElementSize(\n element.element,\n element.size,\n getGutterSize(\n gutterSize,\n i === 0,\n i === ids.length - 1,\n gutterAlign\n ),\n i\n );\n\n // After the first iteration, and we have a pair object, append it to the\n // list of pairs.\n if (i > 0) {\n pairs.push(pair);\n }\n\n return element\n });\n\n function adjustToMin(element) {\n var isLast = element.i === pairs.length;\n var pair = isLast ? pairs[element.i - 1] : pairs[element.i];\n\n calculateSizes.call(pair);\n\n var size = isLast\n ? pair.size - element.minSize - pair[bGutterSize]\n : element.minSize + pair[aGutterSize];\n\n adjust.call(pair, size);\n }\n\n elements.forEach(function (element) {\n var computedSize = element.element[getBoundingClientRect]()[dimension];\n\n if (computedSize < element.minSize) {\n if (expandToMin) {\n adjustToMin(element);\n } else {\n // eslint-disable-next-line no-param-reassign\n element.minSize = computedSize;\n }\n }\n });\n\n function setSizes(newSizes) {\n var trimmed = trimToMin(newSizes);\n trimmed.forEach(function (newSize, i) {\n if (i > 0) {\n var pair = pairs[i - 1];\n\n var a = elements[pair.a];\n var b = elements[pair.b];\n\n a.size = trimmed[i - 1];\n b.size = newSize;\n\n setElementSize(a.element, a.size, pair[aGutterSize], a.i);\n setElementSize(b.element, b.size, pair[bGutterSize], b.i);\n }\n });\n }\n\n function destroy(preserveStyles, preserveGutter) {\n pairs.forEach(function (pair) {\n if (preserveGutter !== true) {\n pair.parent.removeChild(pair.gutter);\n } else {\n pair.gutter[removeEventListener](\n 'mousedown',\n pair[gutterStartDragging]\n );\n pair.gutter[removeEventListener](\n 'touchstart',\n pair[gutterStartDragging]\n );\n }\n\n if (preserveStyles !== true) {\n var style = elementStyle(\n dimension,\n pair.a.size,\n pair[aGutterSize]\n );\n\n Object.keys(style).forEach(function (prop) {\n elements[pair.a].element.style[prop] = '';\n elements[pair.b].element.style[prop] = '';\n });\n }\n });\n }\n\n return {\n setSizes: setSizes,\n getSizes: getSizes,\n collapse: function collapse(i) {\n adjustToMin(elements[i]);\n },\n destroy: destroy,\n parent: parent,\n pairs: pairs,\n }\n};\n\nexport default Split;\n","//Original work Copyright (c) 2018, Duarte Henriques, https://github.com/portablemind/grapesjs-code-editor\r\n//Modified work Copyright (c) 2020, Brendon Ngirazi, \r\n//All rights reserved.\r\n\r\nimport Split from 'split.js';\r\n\r\nexport class CodeEditor {\r\n constructor(editor, opts) {\r\n this.editor = editor;\r\n this.$ = editor.$;\r\n this.pfx = editor.getConfig('stylePrefix');\r\n this.opts = opts;\r\n this.canvas = this.findWithinEditor(`.${this.pfx}cv-canvas`);\r\n this.panelViews = opts.appendTo ? this.$(opts.appendTo) :\r\n this.findWithinEditor(`.${this.pfx}pn-${opts.panelId}`);\r\n this.isShowing = true;\r\n }\r\n\r\n findPanel() {\r\n const pn = this.editor.Panels;\r\n const id = this.opts.panelId;\r\n const panel = pn.getPanel(id) || pn.addPanel({ id });\r\n return panel;\r\n }\r\n\r\n findWithinEditor(selector) {\r\n return this.$(selector, this.editor.getEl());\r\n }\r\n\r\n buildCodeEditor(type) {\r\n const { editor, opts } = this;\r\n\r\n return editor.CodeManager.createViewer({\r\n codeName: type === 'html' ? 'htmlmixed' : 'css',\r\n theme: 'hopscotch',\r\n readOnly: 0,\r\n autoBeautify: 1,\r\n autoCloseTags: 1,\r\n autoCloseBrackets: 1,\r\n styleActiveLine: 1,\r\n smartIndent: 1,\r\n ...opts.codeViewOptions\r\n });\r\n }\r\n\r\n buildSection(type, codeViewer) {\r\n const { $, pfx, opts } = this;\r\n const section = $('<section></section>');\r\n const btnText = type === 'html' ? opts.htmlBtnText : opts.cssBtnText;\r\n const cleanCssBtn = (opts.cleanCssBtn && type === 'css') ?\r\n `<button class=\"cp-delete-${type} ${pfx}btn-prim\">${opts.cleanCssBtnText}</button>` : '';\r\n section.append($(`\r\n <div class=\"codepanel-separator\">\r\n <div class=\"codepanel-label\">${type}</div>\r\n <div class=\"cp-btn-container\">\r\n ${cleanCssBtn}\r\n <button class=\"cp-apply-${type} ${pfx}btn-prim\">${btnText}</button>\r\n </div>\r\n </div>`));\r\n const codeViewerEl = codeViewer.getElement();\r\n codeViewerEl.style.height = 'calc(100% - 30px)';\r\n section.append(codeViewerEl);\r\n this.codePanel.append(section);\r\n return section.get(0);\r\n }\r\n\r\n buildCodePanel() {\r\n const { $, editor } = this;\r\n const panel = this.opts.panelId ? this.findPanel() : 0;\r\n this.codePanel = $('<div></div>');\r\n this.codePanel.addClass('code-panel');\r\n\r\n this.htmlCodeEditor = this.buildCodeEditor('html');\r\n this.cssCodeEditor = this.buildCodeEditor('css');\r\n\r\n const sections = [this.buildSection('html', this.htmlCodeEditor),\r\n this.buildSection('css', this.cssCodeEditor)\r\n ];\r\n\r\n panel && !this.opts.appendTo &&\r\n panel.set('appendContent', this.codePanel).trigger('change:appendContent');\r\n this.opts.appendTo && $(this.opts.appendTo).append(this.codePanel);\r\n this.updateEditorContents();\r\n\r\n this.codePanel.find('.cp-apply-html')\r\n .on('click', this.updateHtml.bind(this));\r\n\r\n this.codePanel.find('.cp-apply-css')\r\n .on('click', this.updateCss.bind(this));\r\n\r\n this.opts.cleanCssBtn && this.codePanel.find('.cp-delete-css')\r\n .on('click', this.deleteSelectedCss.bind(this));\r\n\r\n Split(sections, {\r\n direction: 'vertical',\r\n sizes: [50, 50],\r\n minSize: 100,\r\n gutterSize: 1,\r\n onDragEnd: this.refreshEditors.bind(this),\r\n });\r\n\r\n editor.on('component:update', model => this.updateEditorContents());\r\n }\r\n\r\n showCodePanel() {\r\n this.isShowing = true;\r\n this.updateEditorContents();\r\n this.codePanel.css('display', 'block');\r\n // make sure editor is aware of width change after the 300ms effect ends\r\n setTimeout(this.refreshEditors.bind(this), 320);\r\n this.panelViews.css('width', this.opts.openState.pn);\r\n this.canvas.css('width', this.opts.openState.cv);\r\n }\r\n\r\n hideCodePanel() {\r\n if (this.codePanel) this.codePanel.css('display', 'none');\r\n this.panelViews.css('width', this.opts.closedState.pn);\r\n this.canvas.css('width', this.opts.closedState.cv);\r\n this.isShowing = false;\r\n }\r\n\r\n refreshEditors() {\r\n this.htmlCodeEditor.refresh();\r\n this.cssCodeEditor.refresh();\r\n }\r\n\r\n updateHtml() {\r\n const { editor, component } = this;\r\n let htmlCode = this.htmlCodeEditor.getContent().trim();\r\n if (!htmlCode || htmlCode === this.previousHtmlCode) return;\r\n this.previousHtmlCode = htmlCode;\r\n\r\n let idStyles = '';\r\n this.cssCodeEditor\r\n .getContent()\r\n .split(/(?<=}\\n)/g)\r\n .forEach(rule => {\r\n if (/^#/.test(rule))\r\n idStyles += rule;\r\n });\r\n\r\n htmlCode += `<style>${idStyles}</style>`;\r\n\r\n editor.select(component.replaceWith(htmlCode));\r\n }\r\n\r\n updateCss() {\r\n const cssCode = this.cssCodeEditor.getContent().trim();\r\n if (!cssCode || cssCode === this.previousCssCode) return;\r\n this.parseRemove(cssCode);\r\n this.previousCssCode = cssCode;\r\n this.editor.Components.addComponent(`<style>${cssCode}</style>`);\r\n }\r\n\r\n deleteSelectedCss() {\r\n const selections = this.cssCodeEditor.editor.getSelections();\r\n selections.forEach(selection => this.parseRemove(selection));\r\n this.cssCodeEditor.editor.deleteH();\r\n }\r\n\r\n parseRemove(removeCss) {\r\n const { editor } = this;\r\n const cssc = editor.CssComposer\r\n const allRules = cssc.getAll();\r\n editor.Parser.parseCss(removeCss).forEach(p => {\r\n const config = {\r\n singleAtRule: p.singleAtRule,\r\n atRuleType: p.atRuleType,\r\n mediaText: p.mediaText,\r\n state: p.state\r\n };\r\n p.selectors.length &&\r\n p.selectors.forEach(selector => {\r\n this.removeSelector(selector, allRules, cssc, config);\r\n });\r\n p.selectorsAdd &&\r\n p.selectorsAdd.split(', ').forEach(selector => {\r\n this.removeSelector(selector, allRules, cssc, config);\r\n });\r\n });\r\n }\r\n\r\n removeSelector(rule, allRules, cssc, opts = {}) {\r\n const { singleAtRule, atRuleType, mediaText, state } = opts;\r\n const toRemove = allRules.filter(r => {\r\n if (atRuleType && mediaText)\r\n return r => r.get('atRuleType') == atRuleType && r.get('mediaText') == mediaText;\r\n else if (atRuleType && singleAtRule)\r\n return r => r.get('atRuleType') == atRuleType && r.get('singleAtRule') == singleAtRule;\r\n else if (state)\r\n return r == cssc.getRule(`${rule}:${state}`);\r\n return r == cssc.getRule(rule);\r\n });\r\n allRules.remove(toRemove);\r\n }\r\n\r\n updateEditorContents() {\r\n if (!this.isShowing) return;\r\n\r\n this.component = this.editor.getSelected();\r\n if (this.component) {\r\n this.htmlCodeEditor.setContent(this.getComponentHtml(this.component));\r\n this.cssCodeEditor.setContent(this.editor.CodeManager.getCode(this.component, 'css', {\r\n cssc: this.editor.CssComposer\r\n }));\r\n }\r\n }\r\n\r\n getComponentHtml(component) {\r\n const { pfx, opts } = this;\r\n let result = '';\r\n const componentEl = component.getEl();\r\n\r\n !opts.clearData && componentEl.classList.remove(`${pfx}selected`);\r\n const html = opts.clearData ? component.toHTML() :\r\n (componentEl.id === 'wrapper' ? componentEl.innerHTML : componentEl.outerHTML);\r\n !opts.clearData && componentEl.classList.add(`${pfx}selected`);\r\n result += html;\r\n\r\n const js = opts.editJs ? component.getScriptString() : '';\r\n result += js ? `<script>${js}</script>` : '';\r\n\r\n return result;\r\n }\r\n}","import { CodeEditor } from './code-editor';\r\nimport { openCodeStr, getObject, getConstuctor } from './consts';\r\n\r\nexport default (editor, opts) => {\r\n const cm = editor.Commands;\r\n let codeEditor = null;\r\n\r\n cm.add(openCodeStr, {\r\n run: editor => {\r\n !codeEditor && (codeEditor = new CodeEditor(editor, opts)) && codeEditor.buildCodePanel();\r\n codeEditor.showCodePanel();\r\n },\r\n stop: editor => {\r\n codeEditor && codeEditor.hideCodePanel();\r\n },\r\n });\r\n\r\n cm.add(getObject, (editor, sender, options = {}) => {\r\n return new CodeEditor(editor, { ...options, ...opts });\r\n });\r\n\r\n cm.add(getConstuctor, () => {\r\n return CodeEditor;\r\n });\r\n}","export const\r\n openCodeStr = 'open-code',\r\n getObject = 'code-editor-object',\r\n getConstuctor = 'code-editor-constructor';","import commands from './commands';\r\n\r\nexport default (editor, opts = {}) => {\r\n const options = {\r\n ...{\r\n //Panel to append the code editor\r\n panelId: 'views-container',\r\n //Append to element instead of views-container\r\n appendTo: '',\r\n //State when open\r\n openState: {\r\n cv: '65%',\r\n pn: '35%'\r\n },\r\n //State when closed\r\n closedState: {\r\n cv: '85%',\r\n pn: '15%'\r\n },\r\n //Allow editing of javascript, set allowScripts to true for this to work\r\n editJs: false,\r\n //Remove component data eg data-gjs-type=\"...\"\r\n clearData: false,\r\n //Code viewer options\r\n codeViewOptions: {},\r\n //Used to remove css from the Selector Manager\r\n cleanCssBtn: true,\r\n //Save HTML button text\r\n htmlBtnText: 'Apply',\r\n //Save CSS button text\r\n cssBtnText: 'Apply',\r\n //Clean CSS button text\r\n cleanCssBtnText: 'Delete'\r\n },\r\n ...opts\r\n };\r\n\r\n // Load commands\r\n commands(editor, options);\r\n};"],"sourceRoot":""}
{"version":3,"sources":["webpack://grapesjs-component-code-editor/webpack/universalModuleDefinition","webpack://grapesjs-component-code-editor/webpack/bootstrap","webpack://grapesjs-component-code-editor/./node_modules/@babel/runtime/helpers/defineProperty.js","webpack://grapesjs-component-code-editor/./node_modules/@babel/runtime/helpers/classCallCheck.js","webpack://grapesjs-component-code-editor/./node_modules/@babel/runtime/helpers/createClass.js","webpack://grapesjs-component-code-editor/./node_modules/split.js/dist/split.es.js","webpack://grapesjs-component-code-editor/./src/code-editor/index.js","webpack://grapesjs-component-code-editor/./src/commands.js","webpack://grapesjs-component-code-editor/./src/consts.js","webpack://grapesjs-component-code-editor/./src/index.js"],"names":["root","factory","exports","module","define","amd","window","installedModules","__webpack_require__","moduleId","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","obj","configurable","writable","instance","Constructor","TypeError","_defineProperties","target","props","length","descriptor","protoProps","staticProps","global","ssr","undefined","document","NOOP","calc","filter","prefix","el","createElement","style","cssText","shift","isString","v","String","elementOrSelector","ele","querySelector","Error","getOption","options","propName","def","getGutterSize","gutterSize","isFirst","isLast","gutterAlign","defaultGutterFn","gutterDirection","gut","className","defaultElementStyleFn","dim","size","gutSize","defaultGutterStyleFn","idsOption","dimension","clientAxis","position","positionEnd","clientSize","elements","ids","Array","from","parent","parentNode","parentStyle","getComputedStyle","parentFlexDirection","flexDirection","sizes","map","minSize","minSizes","isArray","expandToMin","snapOffset","dragInterval","direction","cursor","gutter","elementStyle","gutterStyle","setElementSize","keys","forEach","prop","getSizes","element","getMousePosition","e","touches","adjust","offset","a","this","b","percentage","drag","dragging","start","dragOffset","Math","round","calculateSizes","aBounds","bBounds","end","trimToMin","sizesToTrim","parentSize","computedStyle","parseFloat","paddingLeft","paddingRight","paddingTop","paddingBottom","innerSize","reduce","excessPixels","toSpare","pixelSizes","pixelSize","elementGutterSize","elementMinSize","push","newPixelSize","takenPixels","min","stopDragging","stop","move","userSelect","webkitUserSelect","MozUserSelect","pointerEvents","body","startDragging","button","preventDefault","pairs","adjustToMin","pair","id","temp","gutterElement","setGutterSize","insertBefore","computedSize","setSizes","newSizes","trimmed","newSize","collapse","destroy","preserveStyles","preserveGutter","removeChild","CodeEditor","editor","opts","$","pfx","getConfig","canvas","findWithinEditor","panelViews","appendTo","panelId","isShowing","pn","Panels","getPanel","addPanel","selector","getEl","type","CodeManager","createViewer","codeName","theme","readOnly","autoBeautify","autoCloseTags","autoCloseBrackets","styleActiveLine","smartIndent","codeViewOptions","codeViewer","section","btnText","htmlBtnText","cssBtnText","cleanCssBtn","cleanCssBtnText","append","codeViewerEl","getElement","height","codePanel","panel","findPanel","addClass","htmlCodeEditor","buildCodeEditor","cssCodeEditor","sections","buildSection","set","trigger","updateEditorContents","find","on","updateHtml","updateCss","deleteSelectedCss","Split","onDragEnd","refreshEditors","model","css","setTimeout","preserveWidth","openState","cv","closedState","refresh","component","htmlCode","getContent","trim","previousHtmlCode","idStyles","split","rule","test","select","replaceWith","cssCode","previousCssCode","parseRemove","Components","addComponent","getSelections","selection","deleteH","removeCss","cssc","CssComposer","allRules","getAll","Parser","parseCss","config","singleAtRule","atRuleType","mediaText","state","selectors","removeSelector","selectorsAdd","toRemove","getRule","remove","getSelected","setContent","getComponentHtml","getCode","result","componentEl","clearData","classList","html","toHTML","innerHTML","outerHTML","add","js","editJs","getScriptString","cm","Commands","codeEditor","run","buildCodePanel","showCodePanel","hideCodePanel","sender","commands"],"mappings":";CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,GAAIH,GACe,iBAAZC,QACdA,QAAQ,kCAAoCD,IAE5CD,EAAK,kCAAoCC,IAR3C,CASGK,QAAQ,WACX,O,YCTE,IAAIC,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUP,QAGnC,IAAIC,EAASI,EAAiBE,GAAY,CACzCC,EAAGD,EACHE,GAAG,EACHT,QAAS,IAUV,OANAU,EAAQH,GAAUI,KAAKV,EAAOD,QAASC,EAAQA,EAAOD,QAASM,GAG/DL,EAAOQ,GAAI,EAGJR,EAAOD,QA0Df,OArDAM,EAAoBM,EAAIF,EAGxBJ,EAAoBO,EAAIR,EAGxBC,EAAoBQ,EAAI,SAASd,EAASe,EAAMC,GAC3CV,EAAoBW,EAAEjB,EAASe,IAClCG,OAAOC,eAAenB,EAASe,EAAM,CAAEK,YAAY,EAAMC,IAAKL,KAKhEV,EAAoBgB,EAAI,SAAStB,GACX,oBAAXuB,QAA0BA,OAAOC,aAC1CN,OAAOC,eAAenB,EAASuB,OAAOC,YAAa,CAAEC,MAAO,WAE7DP,OAAOC,eAAenB,EAAS,aAAc,CAAEyB,OAAO,KAQvDnB,EAAoBoB,EAAI,SAASD,EAAOE,GAEvC,GADU,EAAPA,IAAUF,EAAQnB,EAAoBmB,IAC/B,EAAPE,EAAU,OAAOF,EACpB,GAAW,EAAPE,GAA8B,iBAAVF,GAAsBA,GAASA,EAAMG,WAAY,OAAOH,EAChF,IAAII,EAAKX,OAAOY,OAAO,MAGvB,GAFAxB,EAAoBgB,EAAEO,GACtBX,OAAOC,eAAeU,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AAU8C,SAChB,YAAnBJ,EAAY9H,GAAmB8H,EAAYK,UAAYL,EAAYM,WACvEnH,EAAK8G,WAAaD,EAAYE,UAAUK,IAAtB,UAA6BlH,EAA7B,aACnB0G,GAAUI,EAEV,IAAMK,EAAKrH,EAAKsH,OAASnD,EAAUoD,kBAAoB,GAGvD,OAFAX,GAAUS,EAAK,WAAH,OAAcA,EAAd,cAA8B,OA1NlD,K,ikBCHe,eAACtH,EAAQC,GACpB,IAAMwH,EAAKzH,EAAO0H,SACdC,EAAa,KAEjBF,EAAGJ,ICNW,YDMM,CAChBO,IAAK,SAAA5H,IACA2H,IAAeA,EAAa,IAAI5H,EAAWC,EAAQC,KAAU0H,EAAWE,iBACzEF,EAAWG,iBAEf3J,KAAM,SAAA6B,GACF2H,GAAcA,EAAWI,mBAIjCN,EAAGJ,ICfS,sBDeM,SAACrH,EAAQgI,GAAyB,IAAjB1P,EAAiB,uDAAP,GACzC,OAAO,IAAIyH,EAAWC,EAAf,OAA4B1H,GAAY2H,OAGnDwH,EAAGJ,IClBa,2BDkBM,WAClB,OAAOtH,M,ikBEpBA,mBAACC,GAAsB,IAAdC,EAAc,uDAAP,GACrB3H,EAAU,OACT,CAECmI,QAAS,kBAETD,SAAU,GAEVwD,UAAW,CACPC,GAAI,MACJtD,GAAI,OAGRuD,YAAa,CACTD,GAAI,MACJtD,GAAI,OAGRiB,gBAAiB,GAEjBmC,eAAe,EAEfwD,QAAQ,EAERR,WAAW,EAEX7E,aAAa,EAEbF,YAAa,QAEbC,WAAY,QAEZE,gBAAiB,WAElBlC,GAIPgI,EAASjI,EAAQ1H","file":"grapesjs-component-code-editor.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"grapesjs-component-code-editor\"] = factory();\n\telse\n\t\troot[\"grapesjs-component-code-editor\"] = factory();\n})(window, function() {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 3);\n","function _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nmodule.exports = _defineProperty;","function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nmodule.exports = _classCallCheck;","function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}\n\nmodule.exports = _createClass;","// The programming goals of Split.js are to deliver readable, understandable and\n// maintainable code, while at the same time manually optimizing for tiny minified file size,\n// browser compatibility without additional requirements\n// and very few assumptions about the user's page layout.\nvar global = typeof window !== 'undefined' ? window : null;\nvar ssr = global === null;\nvar document = !ssr ? global.document : undefined;\n\n// Save a couple long function names that are used frequently.\n// This optimization saves around 400 bytes.\nvar addEventListener = 'addEventListener';\nvar removeEventListener = 'removeEventListener';\nvar getBoundingClientRect = 'getBoundingClientRect';\nvar gutterStartDragging = '_a';\nvar aGutterSize = '_b';\nvar bGutterSize = '_c';\nvar HORIZONTAL = 'horizontal';\nvar NOOP = function () { return false; };\n\n// Helper function determines which prefixes of CSS calc we need.\n// We only need to do this once on startup, when this anonymous function is called.\n//\n// Tests -webkit, -moz and -o prefixes. Modified from StackOverflow:\n// http://stackoverflow.com/questions/16625140/js-feature-detection-to-detect-the-usage-of-webkit-calc-over-calc/16625167#16625167\nvar calc = ssr\n ? 'calc'\n : ((['', '-webkit-', '-moz-', '-o-']\n .filter(function (prefix) {\n var el = document.createElement('div');\n el.style.cssText = \"width:\" + prefix + \"calc(9px)\";\n\n return !!el.style.length\n })\n .shift()) + \"calc\");\n\n// Helper function checks if its argument is a string-like type\nvar isString = function (v) { return typeof v === 'string' || v instanceof String; };\n\n// Helper function allows elements and string selectors to be used\n// interchangeably. In either case an element is returned. This allows us to\n// do `Split([elem1, elem2])` as well as `Split(['#id1', '#id2'])`.\nvar elementOrSelector = function (el) {\n if (isString(el)) {\n var ele = document.querySelector(el);\n if (!ele) {\n throw new Error((\"Selector \" + el + \" did not match a DOM element\"))\n }\n return ele\n }\n\n return el\n};\n\n// Helper function gets a property from the properties object, with a default fallback\nvar getOption = function (options, propName, def) {\n var value = options[propName];\n if (value !== undefined) {\n return value\n }\n return def\n};\n\nvar getGutterSize = function (gutterSize, isFirst, isLast, gutterAlign) {\n if (isFirst) {\n if (gutterAlign === 'end') {\n return 0\n }\n if (gutterAlign === 'center') {\n return gutterSize / 2\n }\n } else if (isLast) {\n if (gutterAlign === 'start') {\n return 0\n }\n if (gutterAlign === 'center') {\n return gutterSize / 2\n }\n }\n\n return gutterSize\n};\n\n// Default options\nvar defaultGutterFn = function (i, gutterDirection) {\n var gut = document.createElement('div');\n gut.className = \"gutter gutter-\" + gutterDirection;\n return gut\n};\n\nvar defaultElementStyleFn = function (dim, size, gutSize) {\n var style = {};\n\n if (!isString(size)) {\n style[dim] = calc + \"(\" + size + \"% - \" + gutSize + \"px)\";\n } else {\n style[dim] = size;\n }\n\n return style\n};\n\nvar defaultGutterStyleFn = function (dim, gutSize) {\n var obj;\n\n return (( obj = {}, obj[dim] = (gutSize + \"px\"), obj ));\n};\n\n// The main function to initialize a split. Split.js thinks about each pair\n// of elements as an independant pair. Dragging the gutter between two elements\n// only changes the dimensions of elements in that pair. This is key to understanding\n// how the following functions operate, since each function is bound to a pair.\n//\n// A pair object is shaped like this:\n//\n// {\n// a: DOM element,\n// b: DOM element,\n// aMin: Number,\n// bMin: Number,\n// dragging: Boolean,\n// parent: DOM element,\n// direction: 'horizontal' | 'vertical'\n// }\n//\n// The basic sequence:\n//\n// 1. Set defaults to something sane. `options` doesn't have to be passed at all.\n// 2. Initialize a bunch of strings based on the direction we're splitting.\n// A lot of the behavior in the rest of the library is paramatized down to\n// rely on CSS strings and classes.\n// 3. Define the dragging helper functions, and a few helpers to go with them.\n// 4. Loop through the elements while pairing them off. Every pair gets an\n// `pair` object and a gutter.\n// 5. Actually size the pair elements, insert gutters and attach event listeners.\nvar Split = function (idsOption, options) {\n if ( options === void 0 ) options = {};\n\n if (ssr) { return {} }\n\n var ids = idsOption;\n var dimension;\n var clientAxis;\n var position;\n var positionEnd;\n var clientSize;\n var elements;\n\n // Allow HTMLCollection to be used as an argument when supported\n if (Array.from) {\n ids = Array.from(ids);\n }\n\n // All DOM elements in the split should have a common parent. We can grab\n // the first elements parent and hope users read the docs because the\n // behavior will be whacky otherwise.\n var firstElement = elementOrSelector(ids[0]);\n var parent = firstElement.parentNode;\n var parentStyle = getComputedStyle ? getComputedStyle(parent) : null;\n var parentFlexDirection = parentStyle ? parentStyle.flexDirection : null;\n\n // Set default options.sizes to equal percentages of the parent element.\n var sizes = getOption(options, 'sizes') || ids.map(function () { return 100 / ids.length; });\n\n // Standardize minSize to an array if it isn't already. This allows minSize\n // to be passed as a number.\n var minSize = getOption(options, 'minSize', 100);\n var minSizes = Array.isArray(minSize) ? minSize : ids.map(function () { return minSize; });\n\n // Get other options\n var expandToMin = getOption(options, 'expandToMin', false);\n var gutterSize = getOption(options, 'gutterSize', 10);\n var gutterAlign = getOption(options, 'gutterAlign', 'center');\n var snapOffset = getOption(options, 'snapOffset', 30);\n var dragInterval = getOption(options, 'dragInterval', 1);\n var direction = getOption(options, 'direction', HORIZONTAL);\n var cursor = getOption(\n options,\n 'cursor',\n direction === HORIZONTAL ? 'col-resize' : 'row-resize'\n );\n var gutter = getOption(options, 'gutter', defaultGutterFn);\n var elementStyle = getOption(\n options,\n 'elementStyle',\n defaultElementStyleFn\n );\n var gutterStyle = getOption(options, 'gutterStyle', defaultGutterStyleFn);\n\n // 2. Initialize a bunch of strings based on the direction we're splitting.\n // A lot of the behavior in the rest of the library is paramatized down to\n // rely on CSS strings and classes.\n if (direction === HORIZONTAL) {\n dimension = 'width';\n clientAxis = 'clientX';\n position = 'left';\n positionEnd = 'right';\n clientSize = 'clientWidth';\n } else if (direction === 'vertical') {\n dimension = 'height';\n clientAxis = 'clientY';\n position = 'top';\n positionEnd = 'bottom';\n clientSize = 'clientHeight';\n }\n\n // 3. Define the dragging helper functions, and a few helpers to go with them.\n // Each helper is bound to a pair object that contains its metadata. This\n // also makes it easy to store references to listeners that that will be\n // added and removed.\n //\n // Even though there are no other functions contained in them, aliasing\n // this to self saves 50 bytes or so since it's used so frequently.\n //\n // The pair object saves metadata like dragging state, position and\n // event listener references.\n\n function setElementSize(el, size, gutSize, i) {\n // Split.js allows setting sizes via numbers (ideally), or if you must,\n // by string, like '300px'. This is less than ideal, because it breaks\n // the fluid layout that `calc(% - px)` provides. You're on your own if you do that,\n // make sure you calculate the gutter size by hand.\n var style = elementStyle(dimension, size, gutSize, i);\n\n Object.keys(style).forEach(function (prop) {\n // eslint-disable-next-line no-param-reassign\n el.style[prop] = style[prop];\n });\n }\n\n function setGutterSize(gutterElement, gutSize, i) {\n var style = gutterStyle(dimension, gutSize, i);\n\n Object.keys(style).forEach(function (prop) {\n // eslint-disable-next-line no-param-reassign\n gutterElement.style[prop] = style[prop];\n });\n }\n\n function getSizes() {\n return elements.map(function (element) { return element.size; })\n }\n\n // Supports touch events, but not multitouch, so only the first\n // finger `touches[0]` is counted.\n function getMousePosition(e) {\n if ('touches' in e) { return e.touches[0][clientAxis] }\n return e[clientAxis]\n }\n\n // Actually adjust the size of elements `a` and `b` to `offset` while dragging.\n // calc is used to allow calc(percentage + gutterpx) on the whole split instance,\n // which allows the viewport to be resized without additional logic.\n // Element a's size is the same as offset. b's size is total size - a size.\n // Both sizes are calculated from the initial parent percentage,\n // then the gutter size is subtracted.\n function adjust(offset) {\n var a = elements[this.a];\n var b = elements[this.b];\n var percentage = a.size + b.size;\n\n a.size = (offset / this.size) * percentage;\n b.size = percentage - (offset / this.size) * percentage;\n\n setElementSize(a.element, a.size, this[aGutterSize], a.i);\n setElementSize(b.element, b.size, this[bGutterSize], b.i);\n }\n\n // drag, where all the magic happens. The logic is really quite simple:\n //\n // 1. Ignore if the pair is not dragging.\n // 2. Get the offset of the event.\n // 3. Snap offset to min if within snappable range (within min + snapOffset).\n // 4. Actually adjust each element in the pair to offset.\n //\n // ---------------------------------------------------------------------\n // | | <- a.minSize || b.minSize -> | |\n // | | | <- this.snapOffset || this.snapOffset -> | | |\n // | | | || | | |\n // | | | || | | |\n // ---------------------------------------------------------------------\n // | <- this.start this.size -> |\n function drag(e) {\n var offset;\n var a = elements[this.a];\n var b = elements[this.b];\n\n if (!this.dragging) { return }\n\n // Get the offset of the event from the first side of the\n // pair `this.start`. Then offset by the initial position of the\n // mouse compared to the gutter size.\n offset =\n getMousePosition(e) -\n this.start +\n (this[aGutterSize] - this.dragOffset);\n\n if (dragInterval > 1) {\n offset = Math.round(offset / dragInterval) * dragInterval;\n }\n\n // If within snapOffset of min or max, set offset to min or max.\n // snapOffset buffers a.minSize and b.minSize, so logic is opposite for both.\n // Include the appropriate gutter sizes to prevent overflows.\n if (offset <= a.minSize + snapOffset + this[aGutterSize]) {\n offset = a.minSize + this[aGutterSize];\n } else if (\n offset >=\n this.size - (b.minSize + snapOffset + this[bGutterSize])\n ) {\n offset = this.size - (b.minSize + this[bGutterSize]);\n }\n\n // Actually adjust the size.\n adjust.call(this, offset);\n\n // Call the drag callback continously. Don't do anything too intensive\n // in this callback.\n getOption(options, 'onDrag', NOOP)(getSizes());\n }\n\n // Cache some important sizes when drag starts, so we don't have to do that\n // continously:\n //\n // `size`: The total size of the pair. First + second + first gutter + second gutter.\n // `start`: The leading side of the first element.\n //\n // ------------------------------------------------\n // | aGutterSize -> ||| |\n // | ||| |\n // | ||| |\n // | ||| <- bGutterSize |\n // ------------------------------------------------\n // | <- start size -> |\n function calculateSizes() {\n // Figure out the parent size minus padding.\n var a = elements[this.a].element;\n var b = elements[this.b].element;\n\n var aBounds = a[getBoundingClientRect]();\n var bBounds = b[getBoundingClientRect]();\n\n this.size =\n aBounds[dimension] +\n bBounds[dimension] +\n this[aGutterSize] +\n this[bGutterSize];\n this.start = aBounds[position];\n this.end = aBounds[positionEnd];\n }\n\n function innerSize(element) {\n // Return nothing if getComputedStyle is not supported (< IE9)\n // Or if parent element has no layout yet\n if (!getComputedStyle) { return null }\n\n var computedStyle = getComputedStyle(element);\n\n if (!computedStyle) { return null }\n\n var size = element[clientSize];\n\n if (size === 0) { return null }\n\n if (direction === HORIZONTAL) {\n size -=\n parseFloat(computedStyle.paddingLeft) +\n parseFloat(computedStyle.paddingRight);\n } else {\n size -=\n parseFloat(computedStyle.paddingTop) +\n parseFloat(computedStyle.paddingBottom);\n }\n\n return size\n }\n\n // When specifying percentage sizes that are less than the computed\n // size of the element minus the gutter, the lesser percentages must be increased\n // (and decreased from the other elements) to make space for the pixels\n // subtracted by the gutters.\n function trimToMin(sizesToTrim) {\n // Try to get inner size of parent element.\n // If it's no supported, return original sizes.\n var parentSize = innerSize(parent);\n if (parentSize === null) {\n return sizesToTrim\n }\n\n if (minSizes.reduce(function (a, b) { return a + b; }, 0) > parentSize) {\n return sizesToTrim\n }\n\n // Keep track of the excess pixels, the amount of pixels over the desired percentage\n // Also keep track of the elements with pixels to spare, to decrease after if needed\n var excessPixels = 0;\n var toSpare = [];\n\n var pixelSizes = sizesToTrim.map(function (size, i) {\n // Convert requested percentages to pixel sizes\n var pixelSize = (parentSize * size) / 100;\n var elementGutterSize = getGutterSize(\n gutterSize,\n i === 0,\n i === sizesToTrim.length - 1,\n gutterAlign\n );\n var elementMinSize = minSizes[i] + elementGutterSize;\n\n // If element is too smal, increase excess pixels by the difference\n // and mark that it has no pixels to spare\n if (pixelSize < elementMinSize) {\n excessPixels += elementMinSize - pixelSize;\n toSpare.push(0);\n return elementMinSize\n }\n\n // Otherwise, mark the pixels it has to spare and return it's original size\n toSpare.push(pixelSize - elementMinSize);\n return pixelSize\n });\n\n // If nothing was adjusted, return the original sizes\n if (excessPixels === 0) {\n return sizesToTrim\n }\n\n return pixelSizes.map(function (pixelSize, i) {\n var newPixelSize = pixelSize;\n\n // While there's still pixels to take, and there's enough pixels to spare,\n // take as many as possible up to the total excess pixels\n if (excessPixels > 0 && toSpare[i] - excessPixels > 0) {\n var takenPixels = Math.min(\n excessPixels,\n toSpare[i] - excessPixels\n );\n\n // Subtract the amount taken for the next iteration\n excessPixels -= takenPixels;\n newPixelSize = pixelSize - takenPixels;\n }\n\n // Return the pixel size adjusted as a percentage\n return (newPixelSize / parentSize) * 100\n })\n }\n\n // stopDragging is very similar to startDragging in reverse.\n function stopDragging() {\n var self = this;\n var a = elements[self.a].element;\n var b = elements[self.b].element;\n\n if (self.dragging) {\n getOption(options, 'onDragEnd', NOOP)(getSizes());\n }\n\n self.dragging = false;\n\n // Remove the stored event listeners. This is why we store them.\n global[removeEventListener]('mouseup', self.stop);\n global[removeEventListener]('touchend', self.stop);\n global[removeEventListener]('touchcancel', self.stop);\n global[removeEventListener]('mousemove', self.move);\n global[removeEventListener]('touchmove', self.move);\n\n // Clear bound function references\n self.stop = null;\n self.move = null;\n\n a[removeEventListener]('selectstart', NOOP);\n a[removeEventListener]('dragstart', NOOP);\n b[removeEventListener]('selectstart', NOOP);\n b[removeEventListener]('dragstart', NOOP);\n\n a.style.userSelect = '';\n a.style.webkitUserSelect = '';\n a.style.MozUserSelect = '';\n a.style.pointerEvents = '';\n\n b.style.userSelect = '';\n b.style.webkitUserSelect = '';\n b.style.MozUserSelect = '';\n b.style.pointerEvents = '';\n\n self.gutter.style.cursor = '';\n self.parent.style.cursor = '';\n document.body.style.cursor = '';\n }\n\n // startDragging calls `calculateSizes` to store the inital size in the pair object.\n // It also adds event listeners for mouse/touch events,\n // and prevents selection while dragging so avoid the selecting text.\n function startDragging(e) {\n // Right-clicking can't start dragging.\n if ('button' in e && e.button !== 0) {\n return\n }\n\n // Alias frequently used variables to save space. 200 bytes.\n var self = this;\n var a = elements[self.a].element;\n var b = elements[self.b].element;\n\n // Call the onDragStart callback.\n if (!self.dragging) {\n getOption(options, 'onDragStart', NOOP)(getSizes());\n }\n\n // Don't actually drag the element. We emulate that in the drag function.\n e.preventDefault();\n\n // Set the dragging property of the pair object.\n self.dragging = true;\n\n // Create two event listeners bound to the same pair object and store\n // them in the pair object.\n self.move = drag.bind(self);\n self.stop = stopDragging.bind(self);\n\n // All the binding. `window` gets the stop events in case we drag out of the elements.\n global[addEventListener]('mouseup', self.stop);\n global[addEventListener]('touchend', self.stop);\n global[addEventListener]('touchcancel', self.stop);\n global[addEventListener]('mousemove', self.move);\n global[addEventListener]('touchmove', self.move);\n\n // Disable selection. Disable!\n a[addEventListener]('selectstart', NOOP);\n a[addEventListener]('dragstart', NOOP);\n b[addEventListener]('selectstart', NOOP);\n b[addEventListener]('dragstart', NOOP);\n\n a.style.userSelect = 'none';\n a.style.webkitUserSelect = 'none';\n a.style.MozUserSelect = 'none';\n a.style.pointerEvents = 'none';\n\n b.style.userSelect = 'none';\n b.style.webkitUserSelect = 'none';\n b.style.MozUserSelect = 'none';\n b.style.pointerEvents = 'none';\n\n // Set the cursor at multiple levels\n self.gutter.style.cursor = cursor;\n self.parent.style.cursor = cursor;\n document.body.style.cursor = cursor;\n\n // Cache the initial sizes of the pair.\n calculateSizes.call(self);\n\n // Determine the position of the mouse compared to the gutter\n self.dragOffset = getMousePosition(e) - self.end;\n }\n\n // adjust sizes to ensure percentage is within min size and gutter.\n sizes = trimToMin(sizes);\n\n // 5. Create pair and element objects. Each pair has an index reference to\n // elements `a` and `b` of the pair (first and second elements).\n // Loop through the elements while pairing them off. Every pair gets a\n // `pair` object and a gutter.\n //\n // Basic logic:\n //\n // - Starting with the second element `i > 0`, create `pair` objects with\n // `a = i - 1` and `b = i`\n // - Set gutter sizes based on the _pair_ being first/last. The first and last\n // pair have gutterSize / 2, since they only have one half gutter, and not two.\n // - Create gutter elements and add event listeners.\n // - Set the size of the elements, minus the gutter sizes.\n //\n // -----------------------------------------------------------------------\n // | i=0 | i=1 | i=2 | i=3 |\n // | | | | |\n // | pair 0 pair 1 pair 2 |\n // | | | | |\n // -----------------------------------------------------------------------\n var pairs = [];\n elements = ids.map(function (id, i) {\n // Create the element object.\n var element = {\n element: elementOrSelector(id),\n size: sizes[i],\n minSize: minSizes[i],\n i: i,\n };\n\n var pair;\n\n if (i > 0) {\n // Create the pair object with its metadata.\n pair = {\n a: i - 1,\n b: i,\n dragging: false,\n direction: direction,\n parent: parent,\n };\n\n pair[aGutterSize] = getGutterSize(\n gutterSize,\n i - 1 === 0,\n false,\n gutterAlign\n );\n pair[bGutterSize] = getGutterSize(\n gutterSize,\n false,\n i === ids.length - 1,\n gutterAlign\n );\n\n // if the parent has a reverse flex-direction, switch the pair elements.\n if (\n parentFlexDirection === 'row-reverse' ||\n parentFlexDirection === 'column-reverse'\n ) {\n var temp = pair.a;\n pair.a = pair.b;\n pair.b = temp;\n }\n }\n\n // Determine the size of the current element. IE8 is supported by\n // staticly assigning sizes without draggable gutters. Assigns a string\n // to `size`.\n //\n // Create gutter elements for each pair.\n if (i > 0) {\n var gutterElement = gutter(i, direction, element.element);\n setGutterSize(gutterElement, gutterSize, i);\n\n // Save bound event listener for removal later\n pair[gutterStartDragging] = startDragging.bind(pair);\n\n // Attach bound event listener\n gutterElement[addEventListener](\n 'mousedown',\n pair[gutterStartDragging]\n );\n gutterElement[addEventListener](\n 'touchstart',\n pair[gutterStartDragging]\n );\n\n parent.insertBefore(gutterElement, element.element);\n\n pair.gutter = gutterElement;\n }\n\n setElementSize(\n element.element,\n element.size,\n getGutterSize(\n gutterSize,\n i === 0,\n i === ids.length - 1,\n gutterAlign\n ),\n i\n );\n\n // After the first iteration, and we have a pair object, append it to the\n // list of pairs.\n if (i > 0) {\n pairs.push(pair);\n }\n\n return element\n });\n\n function adjustToMin(element) {\n var isLast = element.i === pairs.length;\n var pair = isLast ? pairs[element.i - 1] : pairs[element.i];\n\n calculateSizes.call(pair);\n\n var size = isLast\n ? pair.size - element.minSize - pair[bGutterSize]\n : element.minSize + pair[aGutterSize];\n\n adjust.call(pair, size);\n }\n\n elements.forEach(function (element) {\n var computedSize = element.element[getBoundingClientRect]()[dimension];\n\n if (computedSize < element.minSize) {\n if (expandToMin) {\n adjustToMin(element);\n } else {\n // eslint-disable-next-line no-param-reassign\n element.minSize = computedSize;\n }\n }\n });\n\n function setSizes(newSizes) {\n var trimmed = trimToMin(newSizes);\n trimmed.forEach(function (newSize, i) {\n if (i > 0) {\n var pair = pairs[i - 1];\n\n var a = elements[pair.a];\n var b = elements[pair.b];\n\n a.size = trimmed[i - 1];\n b.size = newSize;\n\n setElementSize(a.element, a.size, pair[aGutterSize], a.i);\n setElementSize(b.element, b.size, pair[bGutterSize], b.i);\n }\n });\n }\n\n function destroy(preserveStyles, preserveGutter) {\n pairs.forEach(function (pair) {\n if (preserveGutter !== true) {\n pair.parent.removeChild(pair.gutter);\n } else {\n pair.gutter[removeEventListener](\n 'mousedown',\n pair[gutterStartDragging]\n );\n pair.gutter[removeEventListener](\n 'touchstart',\n pair[gutterStartDragging]\n );\n }\n\n if (preserveStyles !== true) {\n var style = elementStyle(\n dimension,\n pair.a.size,\n pair[aGutterSize]\n );\n\n Object.keys(style).forEach(function (prop) {\n elements[pair.a].element.style[prop] = '';\n elements[pair.b].element.style[prop] = '';\n });\n }\n });\n }\n\n return {\n setSizes: setSizes,\n getSizes: getSizes,\n collapse: function collapse(i) {\n adjustToMin(elements[i]);\n },\n destroy: destroy,\n parent: parent,\n pairs: pairs,\n }\n};\n\nexport default Split;\n","//Original work Copyright (c) 2018, Duarte Henriques, https://github.com/portablemind/grapesjs-code-editor\r\n//Modified work Copyright (c) 2020, Brendon Ngirazi,\r\n//All rights reserved.\r\n\r\nimport Split from 'split.js';\r\n\r\nexport class CodeEditor {\r\n constructor(editor, opts) {\r\n this.editor = editor;\r\n this.$ = editor.$;\r\n this.pfx = editor.getConfig('stylePrefix');\r\n this.opts = opts;\r\n this.canvas = this.findWithinEditor(`.${this.pfx}cv-canvas`);\r\n this.panelViews = opts.appendTo ? this.$(opts.appendTo) :\r\n this.findWithinEditor(`.${this.pfx}pn-${opts.panelId}`);\r\n this.isShowing = true;\r\n }\r\n\r\n findPanel() {\r\n const pn = this.editor.Panels;\r\n const id = this.opts.panelId;\r\n const panel = pn.getPanel(id) || pn.addPanel({ id });\r\n return panel;\r\n }\r\n\r\n findWithinEditor(selector) {\r\n return this.$(selector, this.editor.getEl());\r\n }\r\n\r\n buildCodeEditor(type) {\r\n const { editor, opts } = this;\r\n\r\n return editor.CodeManager.createViewer({\r\n codeName: type === 'html' ? 'htmlmixed' : 'css',\r\n theme: 'hopscotch',\r\n readOnly: 0,\r\n autoBeautify: 1,\r\n autoCloseTags: 1,\r\n autoCloseBrackets: 1,\r\n styleActiveLine: 1,\r\n smartIndent: 1,\r\n ...opts.codeViewOptions\r\n });\r\n }\r\n\r\n buildSection(type, codeViewer) {\r\n const { $, pfx, opts } = this;\r\n const section = $('<section></section>');\r\n const btnText = type === 'html' ? opts.htmlBtnText : opts.cssBtnText;\r\n const cleanCssBtn = (opts.cleanCssBtn && type === 'css') ?\r\n `<button class=\"cp-delete-${type} ${pfx}btn-prim\">${opts.cleanCssBtnText}</button>` : '';\r\n section.append($(`\r\n <div class=\"codepanel-separator\">\r\n <div class=\"codepanel-label\">${type}</div>\r\n <div class=\"cp-btn-container\">\r\n ${cleanCssBtn}\r\n <button class=\"cp-apply-${type} ${pfx}btn-prim\">${btnText}</button>\r\n </div>\r\n </div>`));\r\n const codeViewerEl = codeViewer.getElement();\r\n codeViewerEl.style.height = 'calc(100% - 30px)';\r\n section.append(codeViewerEl);\r\n this.codePanel.append(section);\r\n return section.get(0);\r\n }\r\n\r\n buildCodePanel() {\r\n const { $, editor } = this;\r\n const panel = this.opts.panelId ? this.findPanel() : 0;\r\n this.codePanel = $('<div></div>');\r\n this.codePanel.addClass('code-panel');\r\n\r\n this.htmlCodeEditor = this.buildCodeEditor('html');\r\n this.cssCodeEditor = this.buildCodeEditor('css');\r\n\r\n const sections = [this.buildSection('html', this.htmlCodeEditor), this.buildSection('css', this.cssCodeEditor)];\r\n\r\n panel && !this.opts.appendTo &&\r\n panel.set('appendContent', this.codePanel).trigger('change:appendContent');\r\n this.opts.appendTo && $(this.opts.appendTo).append(this.codePanel);\r\n this.updateEditorContents();\r\n\r\n this.codePanel.find('.cp-apply-html')\r\n .on('click', this.updateHtml.bind(this));\r\n\r\n this.codePanel.find('.cp-apply-css')\r\n .on('click', this.updateCss.bind(this));\r\n\r\n this.opts.cleanCssBtn && this.codePanel.find('.cp-delete-css')\r\n .on('click', this.deleteSelectedCss.bind(this));\r\n\r\n Split(sections, {\r\n direction: 'vertical',\r\n sizes: [50, 50],\r\n minSize: 100,\r\n gutterSize: 1,\r\n onDragEnd: this.refreshEditors.bind(this),\r\n });\r\n\r\n editor.on('component:update', model => this.updateEditorContents());\r\n }\r\n\r\n showCodePanel() {\r\n this.isShowing = true;\r\n this.updateEditorContents();\r\n this.codePanel.css('display', 'block');\r\n // make sure editor is aware of width change after the 300ms effect ends\r\n setTimeout(this.refreshEditors.bind(this), 320);\r\n\r\n if (this.opts.preserveWidth) return;\r\n\r\n this.panelViews.css('width', this.opts.openState.pn);\r\n this.canvas.css('width', this.opts.openState.cv);\r\n }\r\n\r\n hideCodePanel() {\r\n if (this.codePanel) this.codePanel.css('display', 'none');\r\n this.isShowing = false;\r\n\r\n if (this.opts.preserveWidth) return;\r\n\r\n this.panelViews.css('width', this.opts.closedState.pn);\r\n this.canvas.css('width', this.opts.closedState.cv);\r\n }\r\n\r\n refreshEditors() {\r\n this.htmlCodeEditor.refresh();\r\n this.cssCodeEditor.refresh();\r\n }\r\n\r\n updateHtml() {\r\n const { editor, component } = this;\r\n let htmlCode = this.htmlCodeEditor.getContent().trim();\r\n if (!htmlCode || htmlCode === this.previousHtmlCode) return;\r\n this.previousHtmlCode = htmlCode;\r\n\r\n let idStyles = '';\r\n this.cssCodeEditor\r\n .getContent()\r\n .split(/(?<=}\\n)/g)\r\n .forEach(rule => {\r\n if (/^#/.test(rule))\r\n idStyles += rule;\r\n });\r\n\r\n htmlCode += `<style>${idStyles}</style>`;\r\n\r\n editor.select(component.replaceWith(htmlCode));\r\n }\r\n\r\n updateCss() {\r\n const cssCode = this.cssCodeEditor.getContent().trim();\r\n if (!cssCode || cssCode === this.previousCssCode) return;\r\n this.parseRemove(cssCode);\r\n this.previousCssCode = cssCode;\r\n this.editor.Components.addComponent(`<style>${cssCode}</style>`);\r\n }\r\n\r\n deleteSelectedCss() {\r\n const selections = this.cssCodeEditor.editor.getSelections();\r\n selections.forEach(selection => this.parseRemove(selection));\r\n this.cssCodeEditor.editor.deleteH();\r\n }\r\n\r\n parseRemove(removeCss) {\r\n const { editor } = this;\r\n const cssc = editor.CssComposer\r\n const allRules = cssc.getAll();\r\n editor.Parser.parseCss(removeCss).forEach(p => {\r\n const config = {\r\n singleAtRule: p.singleAtRule,\r\n atRuleType: p.atRuleType,\r\n mediaText: p.mediaText,\r\n state: p.state\r\n };\r\n p.selectors.length &&\r\n p.selectors.forEach(selector => {\r\n this.removeSelector(selector, allRules, cssc, config);\r\n });\r\n p.selectorsAdd &&\r\n p.selectorsAdd.split(', ').forEach(selector => {\r\n this.removeSelector(selector, allRules, cssc, config);\r\n });\r\n });\r\n }\r\n\r\n removeSelector(rule, allRules, cssc, opts = {}) {\r\n const { singleAtRule, atRuleType, mediaText, state } = opts;\r\n const toRemove = allRules.filter(r => {\r\n if (atRuleType && mediaText)\r\n return r => r.get('atRuleType') == atRuleType && r.get('mediaText') == mediaText;\r\n else if (atRuleType && singleAtRule)\r\n return r => r.get('atRuleType') == atRuleType && r.get('singleAtRule') == singleAtRule;\r\n else if (state)\r\n return r == cssc.getRule(`${rule}:${state}`);\r\n return r == cssc.getRule(rule);\r\n });\r\n allRules.remove(toRemove);\r\n }\r\n\r\n updateEditorContents() {\r\n if (!this.isShowing) return;\r\n\r\n this.component = this.editor.getSelected();\r\n if (this.component) {\r\n this.htmlCodeEditor.setContent(this.getComponentHtml(this.component));\r\n this.cssCodeEditor.setContent(this.editor.CodeManager.getCode(this.component, 'css', {\r\n cssc: this.editor.CssComposer\r\n }));\r\n }\r\n }\r\n\r\n getComponentHtml(component) {\r\n const { pfx, opts } = this;\r\n let result = '';\r\n const componentEl = component.getEl();\r\n\r\n !opts.clearData && componentEl.classList.remove(`${pfx}selected`);\r\n const html = opts.clearData ? component.toHTML() :\r\n (componentEl.id === 'wrapper' ? componentEl.innerHTML : componentEl.outerHTML);\r\n !opts.clearData && componentEl.classList.add(`${pfx}selected`);\r\n result += html;\r\n\r\n const js = opts.editJs ? component.getScriptString() : '';\r\n result += js ? `<script>${js}</script>` : '';\r\n\r\n return result;\r\n }\r\n}\r\n","import { CodeEditor } from './code-editor';\r\nimport { openCodeStr, getObject, getConstuctor } from './consts';\r\n\r\nexport default (editor, opts) => {\r\n const cm = editor.Commands;\r\n let codeEditor = null;\r\n\r\n cm.add(openCodeStr, {\r\n run: editor => {\r\n !codeEditor && (codeEditor = new CodeEditor(editor, opts)) && codeEditor.buildCodePanel();\r\n codeEditor.showCodePanel();\r\n },\r\n stop: editor => {\r\n codeEditor && codeEditor.hideCodePanel();\r\n },\r\n });\r\n\r\n cm.add(getObject, (editor, sender, options = {}) => {\r\n return new CodeEditor(editor, { ...options, ...opts });\r\n });\r\n\r\n cm.add(getConstuctor, () => {\r\n return CodeEditor;\r\n });\r\n}","export const\r\n openCodeStr = 'open-code',\r\n getObject = 'code-editor-object',\r\n getConstuctor = 'code-editor-constructor';","import commands from './commands';\r\n\r\nexport default (editor, opts = {}) => {\r\n const options = {\r\n ...{\r\n //Panel to append the code editor\r\n panelId: 'views-container',\r\n //Append to element instead of views-container\r\n appendTo: '',\r\n //State when open\r\n openState: {\r\n cv: '65%',\r\n pn: '35%'\r\n },\r\n //State when closed\r\n closedState: {\r\n cv: '85%',\r\n pn: '15%'\r\n },\r\n //Code viewer options\r\n codeViewOptions: {},\r\n //Stop resizing openState and closedState\r\n preserveWidth: false,\r\n //Allow editing of javascript, set allowScripts to true for this to work\r\n editJs: false,\r\n //Remove component data eg data-gjs-type=\"...\"\r\n clearData: false,\r\n //Used to remove css from the Selector Manager\r\n cleanCssBtn: true,\r\n //Save HTML button text\r\n htmlBtnText: 'Apply',\r\n //Save CSS button text\r\n cssBtnText: 'Apply',\r\n //Clean CSS button text\r\n cleanCssBtnText: 'Delete'\r\n },\r\n ...opts\r\n };\r\n\r\n // Load commands\r\n commands(editor, options);\r\n};\r\n"],"sourceRoot":""}
{
"name": "grapesjs-component-code-editor",
"version": "1.0.13",
"version": "1.0.16",
"description": "Grapesjs Component Code Editor",

@@ -5,0 +5,0 @@ "main": "dist/grapesjs-component-code-editor.min.js",

+20
-13

@@ -77,15 +77,16 @@ # Grapesjs Component Code Editor

| Option | Description | Default |
|-|-|-
| `panelId` | Id of panel to append code editor | `views-container` |
| `appendTo` | Append code editor to an element not `views-container` | ` ` |
| `openState` | Determine width of views panel and canvas in the open state | `{...}` |
| `openState` | Determine width of views panel and canvas in the open state | `{...}` |
| `clearData` | Remove all `gjs-data` attributes from the component | `false` |
| `codeViewOptions` | Code view/editor options | `{}` |
| `editJs` | Lets you edit component scripts `allowScripts` must be set to true | `false` |
| `cleanCssBtn` | /Used to remove css from the Selector Manager | `true` |
| `htmlBtnText` | Save HTML button text | `Apply` |
| `cssBtnText` | Save CSS button text | `Apply` |
| `cleanCssBtnText` | Clean HTML button text | `Delete` |
| Option name | Default value | Description |
| ----------- | ------------- | ----------- |
| `panelId` | `views-container` | Id of panel to append code editor. |
| `appendTo` | `.gjs-pn-views-container` | Append code editor to an element not `views-container` (class or id). |
| `openState` | `{ pn: '35%', cv: '65%' }` | Determine width of views panel (`pn`) and canvas (`cv`) in the open state. |
| `closedtate` | `{ pn: '15%', cv: '85%' }` | Determine width of views panel (`pn`) and canvas (`cv`) in the closed state. |
| `codeViewOptions` | `{}` | Code view/editor options. ([more info](https://github.com/artf/grapesjs/issues/324)) |
| `preserveWidth` | `false` | Stop resizing `openState` and `closedState`. Preserve views panel and canvas sizes. |
| `clearData` | `false` | Remove all `gjs-data` attributes from the component. |
| `editJs` | `false` | Lets you edit component scripts `allowScripts` must be set to true. |
| `cleanCssBtn` | `true` | Used to remove css from the Selector Manager. |
| `htmlBtnText` | `Apply` | Save HTML button text. |
| `cssBtnText` | `Apply` | Save CSS button text. |
| `cleanCssBtnText` | `Delete` | Clean HTML button text. |

@@ -186,2 +187,8 @@ >Tip-[grapesjs-script-editor](https://github.com/Ju99ernaut/grapesjs-script-editor) is better suited for editing scripts instead of using `editJs`, reason being `editJs` will inject scripts as separate components onto the canvas which often interferes with the main editor. [grapesjs-script-editor](https://github.com/Ju99ernaut/grapesjs-script-editor) avoids this by injecting scripts directly into a component therefore avoiding the use of `allowScripts`.

Build css
```sh
$ npm run build:css
```
Start the dev server

@@ -188,0 +195,0 @@

//Original work Copyright (c) 2018, Duarte Henriques, https://github.com/portablemind/grapesjs-code-editor
//Modified work Copyright (c) 2020, Brendon Ngirazi,
//Modified work Copyright (c) 2020, Brendon Ngirazi,
//All rights reserved.

@@ -76,5 +76,3 @@

const sections = [this.buildSection('html', this.htmlCodeEditor),
this.buildSection('css', this.cssCodeEditor)
];
const sections = [this.buildSection('html', this.htmlCodeEditor), this.buildSection('css', this.cssCodeEditor)];

@@ -112,2 +110,5 @@ panel && !this.opts.appendTo &&

setTimeout(this.refreshEditors.bind(this), 320);
if (this.opts.preserveWidth) return;
this.panelViews.css('width', this.opts.openState.pn);

@@ -119,5 +120,8 @@ this.canvas.css('width', this.opts.openState.cv);

if (this.codePanel) this.codePanel.css('display', 'none');
this.isShowing = false;
if (this.opts.preserveWidth) return;
this.panelViews.css('width', this.opts.closedState.pn);
this.canvas.css('width', this.opts.closedState.cv);
this.isShowing = false;
}

@@ -228,2 +232,2 @@

}
}
}

@@ -20,2 +20,6 @@ import commands from './commands';

},
//Code viewer options
codeViewOptions: {},
//Stop resizing openState and closedState
preserveWidth: false,
//Allow editing of javascript, set allowScripts to true for this to work

@@ -25,4 +29,2 @@ editJs: false,

clearData: false,
//Code viewer options
codeViewOptions: {},
//Used to remove css from the Selector Manager

@@ -42,2 +44,2 @@ cleanCssBtn: true,

commands(editor, options);
};
};