diff --git a/dist/index.js b/dist/index.js index 2c1a6fd..0232a19 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1,2 +1,2 @@ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("grapesjs"),require("jQuery")):"function"==typeof define&&define.amd?define("grapesjs-components-farmer",["grapesjs","jQuery"],t):"object"==typeof exports?exports["grapesjs-components-farmer"]=t(require("grapesjs"),require("jQuery")):e["grapesjs-components-farmer"]=t(e.grapesjs,e.jQuery)}(window,function(e,t){return function(e){var t={};function a(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,a),o.l=!0,o.exports}return a.m=e,a.c=t,a.d=function(e,t,n){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,t){if(1&t&&(e=a(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(a.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)a.d(n,o,function(t){return e[t]}.bind(null,o));return n},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="/",a(a.s=0)}({0:function(e,t,a){e.exports=a("tjUo")},HFWD:function(e,t,a){var n;!function(){"use strict";var o,l={name:"doT",version:"1.1.1",templateSettings:{evaluate:/\{\{([\s\S]+?(\}?)+)\}\}/g,interpolate:/\{\{=([\s\S]+?)\}\}/g,encode:/\{\{!([\s\S]+?)\}\}/g,use:/\{\{#([\s\S]+?)\}\}/g,useParams:/(^|[^\w$])def(?:\.|\[[\'\"])([\w$\.]+)(?:[\'\"]\])?\s*\:\s*([\w$\.]+|\"[^\"]+\"|\'[^\']+\'|\{[^\}]+\})/g,define:/\{\{##\s*([\w\.$]+)\s*(\:|=)([\s\S]+?)#\}\}/g,defineParams:/^\s*([\w$]+):([\s\S]+)/,conditional:/\{\{\?(\?)?\s*([\s\S]*?)\s*\}\}/g,iterate:/\{\{~\s*(?:\}\}|([\s\S]+?)\s*\:\s*([\w$]+)\s*(?:\:\s*([\w$]+))?\s*\}\})/g,varname:"it",strip:!0,append:!0,selfcontained:!1,doNotSkipEncoded:!1},template:void 0,compile:void 0,log:!0};l.encodeHTMLSource=function(e){var t={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"},a=e?/[&<>"'\/]/g:/&(?!#?\w+;)|<|>|"|'|\//g;return function(e){return e?e.toString().replace(a,function(e){return t[e]||e}):""}},o=function(){return this||(0,eval)("this")}(),e.exports?e.exports=l:void 0===(n=function(){return l}.call(t,a,t,e))||(e.exports=n);var s={append:{start:"'+(",end:")+'",startencode:"'+encodeHTML("},split:{start:"';out+=(",end:");out+='",startencode:"';out+=encodeHTML("}},c=/$^/;function r(e){return e.replace(/\\('|\\)/g,"$1").replace(/[\r\t\n]/g," ")}l.template=function(e,t,a){var n,i,p=(t=t||l.templateSettings).append?s.append:s.split,m=0,d=t.use||t.define?function e(t,a,n){return("string"==typeof a?a:a.toString()).replace(t.define||c,function(e,a,o,l){return 0===a.indexOf("def.")&&(a=a.substring(4)),a in n||(":"===o?(t.defineParams&&l.replace(t.defineParams,function(e,t,o){n[a]={arg:t,text:o}}),a in n||(n[a]=l)):new Function("def","def['"+a+"']="+l)(n)),""}).replace(t.use||c,function(a,o){t.useParams&&(o=o.replace(t.useParams,function(e,t,a,o){if(n[a]&&n[a].arg&&o){var l=(a+":"+o).replace(/'|\\/g,"_");return n.__exp=n.__exp||{},n.__exp[l]=n[a].text.replace(new RegExp("(^|[^\\w$])"+n[a].arg+"([^\\w$])","g"),"$1"+o+"$2"),t+"def.__exp['"+l+"']"}}));var l=new Function("def","return "+o)(n);return l?e(t,l,n):l})}(t,e,a||{}):e;d=("var out='"+(t.strip?d.replace(/(^|\r|\n)\t* +| +\t*(\r|\n|$)/g," ").replace(/\r|\n|\t|\/\*[\s\S]*?\*\//g,""):d).replace(/'|\\/g,"\\$&").replace(t.interpolate||c,function(e,t){return p.start+r(t)+p.end}).replace(t.encode||c,function(e,t){return n=!0,p.startencode+r(t)+p.end}).replace(t.conditional||c,function(e,t,a){return t?a?"';}else if("+r(a)+"){out+='":"';}else{out+='":a?"';if("+r(a)+"){out+='":"';}out+='"}).replace(t.iterate||c,function(e,t,a,n){return t?(m+=1,i=n||"i"+m,t=r(t),"';var arr"+m+"="+t+";if(arr"+m+"){var "+a+","+i+"=-1,l"+m+"=arr"+m+".length-1;while("+i+"\n
Settings
\n
'),m=c.find(".gjs-sm-properties");m.append(n.find(".gjs-trt-traits")),n.find(".gjs-pn-views .fa-cog").hide(),n.find(".gjs-sm-sectors").before(c),c.find(".gjs-sm-title").on("click",function(){var e=m.get(0).style,t="none"===e.display;e.display=t?"block":"none"});var d=a.getButton("views",p);d&&d.set("active",1),t.showStylesOnChange&&e.on("component:selected",function(){var t=a.getButton("views",r),n=a.getButton("views",i);n&&n.get("active")||!e.getSelected()||t&&t.set("active",1)})})}},ZjPV:function(e,t,a){"use strict";a.r(t);var n=a("xeH2"),o=a.n(n);function l(e){for(var t=1;t1&&void 0!==arguments[1]?arguments[1]:{},a=e.TraitManager,n=e.DomComponents,s=(e.BlockManager,n.getType("default")),c=(n.getType("select"),s.model),r=s.view,i=(n.getType("text"),c.prototype.defaults.traits.concat([{type:"text",name:"name_attr",label:"Name",placeholder:"Enter a field name.."},{type:"text",name:"label_attr",label:"Label",placeholder:"Enter a field label.."}])),p=i.concat([{type:"text",name:"value_attr",label:"Value",changeProp:1,placeholder:"Enter a default value.."},{type:"text",name:"placeholder_attr",label:"Placeholder",changeProp:1,placeholder:"Enter placeholder text.."},{type:"checkbox",name:"required_attr",changeProp:1,label:"Required"},{type:"text",name:"pattern_attr",changeProp:1,label:"Pattern"},{type:"number",name:"min_attr",changeProp:1,label:"Min"},{type:"number",name:"max_attr",changeProp:1,label:"Max"}]);a.addType("option_attr",{events:{onchange:"onChange"},getInputEl:function(){if(!this.inputEl){var e=document.createElement("textarea");e.value=this.target.get("option_attr"),this.inputEl=e}return this.inputEl},onValueChange:function(){this.target.set("option_attr",this.model.get("value"))}});var m=c.extend({defaults:l({},c.prototype.defaults,{draggable:!0,droppable:!0,copyable:!1,label_attr:"Label"}),toHTML:function(){var e=t.comps[this.attributes.tagName],a=this.genHtml();if(e&&e.useTag){if("innerHTML"===e.useTag)return a.html();if("innerText"===e.useTag)return this.genHtml()[0].innerText}return this.genHtml()[0].outerHTML},getTraitValues:function(){var e=l({},this.attributes);return this.get("traits").each(function(t){var a=t.get("name");e[a]=t.get("value")||e[a]}),e},myInitDefaults:function(){var e=l({},this.attributes);this.get("traits").each(function(t){var a=t.get("name");a.indexOf("_attr")>0&&t.set("value",e[a])})},ensureNameAttr:function(e){var a=this.get("traits").where({name:"name_attr"})[0];if(a){var n=e.name_attr;if(!n)return n="".concat(t.formFieldsPrefix).concat(t.formNextId++),a.set("value",n),this.set("name_attr",n),!0}return!1},genHtml:function(){if(!this.view||!this.view.el){var e=document.createElement(this.attributes.tagName);return this.generateHtml(e,this.attributes.tagName)}return this.generateHtml(this.view.el,this.attributes.tagName)},generateHtml:function(e,a){var n=o()(e||this.view.el),l=this.getTraitValues(),s=s||this.get("tagName");if(t&&t.comps&&t.comps[s]){var c=t.comps[s].template;"function"==typeof c&&(this.ensureNameAttr(l)||(n.empty(),n.html(c(l||{}))))}return n}}),d=r.extend({onRender:function(){return this.model.genHtml&&this.model.genHtml(),this}});n.addType("comp_input",{model:m.extend({defaults:l({},m.prototype.defaults,{draggable:!0,droppable:!1,copyable:!1,tagName:"comp_input",type_attr:"text",traits:p.concat({type:"select",name:"type_attr",label:"Type",options:[{name:"Text",value:"text"},{name:"Password",value:"password"},{name:"Email",value:"email"},{name:"Number",value:"number"},{name:"URL",value:"url"},{name:"Phone",value:"tel"},{name:"Date",value:"date"},{name:"Date Time",value:"datetime-local"},{name:"Range",value:"range"},{name:"Color Picker",value:"color"}]}),classes:["comp_input"].concat(t.comps.comp_input.classes)}),init:function(){this.myInitDefaults(),this.listenTo(this,"change:label_attr",this.genHtml),this.listenTo(this,"change:name_attr",this.genHtml),this.listenTo(this,"change:placeholder_attr",this.genHtml)}}),view:d}),n.addType("comp_select",{model:m.extend({defaults:l({},m.prototype.defaults,{draggable:!0,droppable:!1,copyable:!1,tagName:"comp_select",option_attr:"MN::Minnesota\nTX::Texas",label_attr:"Select",traits:[{type:"option_attr"},{type:"checkbox",name:"required_attr",changeProp:1,label:"Required"},{type:"checkbox",name:"multiple_attr",changeProp:1,label:"Multiple"}].concat(i),classes:["comp_select"].concat(t.comps.comp_select.classes)}),init:function(){this.myInitDefaults(),this.listenTo(this,"change:label_attr",this.genHtml),this.listenTo(this,"change:name_attr",this.genHtml),this.listenTo(this,"change:multiple_attr",this.genHtml),this.listenTo(this,"change:option_attr",this.genHtml)}}),view:d}),n.addType("comp_textarea",{model:m.extend({defaults:l({},c.prototype.defaults,{draggable:!0,droppable:!1,copyable:!1,tagName:"comp_textarea",label_attr:"Message",traits:[{type:"checkbox",name:"required_attr",changeProp:1,label:"Required"},{type:"text",name:"placeholder_attr",label:"Placeholder",changeProp:1,placeholder:"Enter placeholder text.."},{type:"number",name:"rows_attr",label:"Rows",changeProp:1,placeholder:"Enter field rows/line-height.."},{type:"number",name:"cols_attr",label:"Columns",changeProp:1,placeholder:"Enter field columns/width.."}].concat(i),classes:["comp_textarea"].concat(t.comps.comp_textarea.classes)}),init:function(){this.myInitDefaults(),this.listenTo(this,"change:label_attr",this.genHtml),this.listenTo(this,"change:name_attr",this.genHtml),this.listenTo(this,"change:placeholder_attr",this.genHtml),this.listenTo(this,"change:cols_attr",this.genHtml),this.listenTo(this,"change:rows_attr",this.genHtml)}}),view:d}),n.addType("comp_file",{model:m.extend({defaults:l({},c.prototype.defaults,{draggable:!0,droppable:!1,copyable:!1,tagName:"comp_file",label_attr:"Choose file...",traits:[{type:"checkbox",name:"required_attr",changeProp:1,label:"Required"},{type:"text",name:"placeholder_attr",label:"Placeholder",changeProp:1,placeholder:"Enter placeholder text.."},{type:"string",name:"accept_attr",label:"Accept",changeProp:1,placeholder:"image/jpeg, image/png, image/gif"}].concat(i),classes:["comp_file"].concat(t.comps.comp_file.classes)}),init:function(){this.myInitDefaults(),this.listenTo(this,"change:label_attr",this.genHtml),this.listenTo(this,"change:name_attr",this.genHtml),this.listenTo(this,"change:placeholder_attr",this.genHtml),this.listenTo(this,"change:accept_attr",this.genHtml)}}),view:d}),n.addType("comp_checkbox",{model:m.extend({defaults:l({},m.prototype.defaults,{draggable:!0,droppable:!1,copyable:!1,tagName:"comp_checkbox",label_attr:"I accept the terms and use",traits:[{type:"checkbox",name:"required_attr",changeProp:1,label:"Required"}].concat(i),classes:["comp_checkbox"].concat(t.comps.comp_checkbox.classes)}),init:function(){this.myInitDefaults(),this.listenTo(this,"change:label_attr",this.genHtml),this.listenTo(this,"change:name_attr",this.genHtml)}}),view:d}),n.addType("comp_hidden",{model:m.extend({defaults:l({},m.prototype.defaults,{draggable:!0,droppable:!1,copyable:!1,tagName:"comp_hidden",traits:[{type:"text",name:"name_attr",label:"Name",changeProp:1,placeholder:"Enter a field name..."}],classes:["comp_hidden"].concat(t.comps.comp_hidden.classes)}),init:function(){this.myInitDefaults(),this.listenTo(this,"change:name_attr",this.genHtml)}}),view:d}),n.addType("comp_submit",{model:m.extend({defaults:l({},m.prototype.defaults,{draggable:!0,droppable:!1,copyable:!1,tagName:"comp_submit",label_attr:"Send",traits:c.prototype.defaults.traits.concat([{type:"text",name:"label_attr",label:"Label",placeholder:"Enter a field label.."}]),classes:["comp_submit"].concat(t.comps.comp_submit.classes)}),init:function(){this.myInitDefaults(),this.listenTo(this,"change:label_attr",this.genHtml)}}),view:d}),n.addType("comp_row",{model:c.extend({defaults:l({},c.prototype.defaults,{tagName:"comp_row",draggable:!0,copyable:!1,droppable:"comp_col",classes:["comp_row"].concat(t.comps.comp_row.classes)})}),view:r}),n.addType("comp_col",{model:c.extend({defaults:l({},c.prototype.defaults,{tagName:"comp_col",draggable:"comp_row",droppable:!0,copyable:!1,classes:["comp_col"].concat(t.comps.comp_col.classes)})}),view:r}),n.addType("comp_recaptcha",{model:m.extend({defaults:l({},m.prototype.defaults,{draggable:!0,droppable:!1,copyable:!1,tagName:"comp_recaptcha",sitekey_attr:"sitekey",action_attr:"contact-us",traits:c.prototype.defaults.traits.concat([{type:"text",name:"sitekey_attr",label:"Site key",placeholder:"e.g. sitekey"},{type:"text",name:"action_attr",label:"Action",placeholder:"recaptcha action name"}]),classes:["comp_recaptcha"].concat(t.comps.comp_recaptcha.classes)}),init:function(){this.myInitDefaults(),this.listenTo(this,"change:sitekey_attr",this.genHtml)}}),view:d}),n.addType("comp_stripe",{model:m.extend({defaults:l({},m.prototype.defaults,{draggable:!0,droppable:!1,copyable:!1,tagName:"comp_stripe",traits:c.prototype.defaults.traits.concat([{type:"text",name:"publickey_attr",label:"Public key",placeholder:"e.g. stripe public key"}]),classes:["comp_stripe"].concat(t.comps.comp_recaptcha.classes)}),init:function(){this.myInitDefaults(),this.listenTo(this,"change:publickey_attr",this.genHtml)}}),view:d})}},fvyM:function(e,t,a){"use strict";function n(e){for(var t=1;t1&&void 0!==arguments[1]?arguments[1]:{},a=e.BlockManager,o=t.comps;o.blocks,o.blockCategories;t.resetBlocks&&a.getAll().reset();var l={category:t.categoryLabel};a.add("comp_col1").set(n({label:o.comp_col1.label,attributes:{class:"gjs-fonts gjs-f-b1"},content:{type:"comp_row",components:[{type:"comp_col",classes:o.comp_col1.classes.concat(o.comp_col.classes)}]}},l)),a.add("comp_col2").set(n({label:o.comp_col2.label,attributes:{class:"gjs-fonts gjs-f-b2"},content:{type:"comp_row",components:[{type:"comp_col",classes:o.comp_col2.classes.concat(o.comp_col.classes)},{type:"comp_col",classes:o.comp_col2.classes.concat(o.comp_col.classes)}]}},l)),a.add("comp_col3").set(n({label:o.comp_col3.label,attributes:{class:"gjs-fonts gjs-f-b3"},content:{type:"comp_row",components:[{type:"comp_col",classes:o.comp_col3.classes.concat(o.comp_col.classes)},{type:"comp_col",classes:o.comp_col3.classes.concat(o.comp_col.classes)},{type:"comp_col",classes:o.comp_col3.classes.concat(o.comp_col.classes)}]}},l)),a.add("comp_submit",n({label:'\n
 
\n
'.concat(o.comp_submit.label,"
\n "),content:{type:"comp_submit"}},l)),a.add("comp_input",n({label:'\n \n \n \n \n
'.concat(o.comp_input.label,"
"),content:{type:"comp_input"}},l)),a.add("comp_textarea",n({label:'\n \n \n \n \n \n \n \n
'.concat(o.comp_textarea.label,"
"),content:{type:"comp_textarea"}},l)),a.add("comp_select",n({label:'\n \n \n \n \n \n
'.concat(o.comp_select.label,"
"),content:{type:"comp_select"}},l)),a.add("comp_file",n({label:o.comp_file.label,attributes:{class:"fa fa-file"},content:{type:"comp_file"}},l)),a.add("comp_checkbox",n({label:o.comp_checkbox.label,attributes:{class:"fa fa-check-square"},content:{type:"comp_checkbox"}},l)),a.add("comp_hidden",n({label:'\n \n \n \n
'.concat(o.comp_hidden.label,"
"),content:{type:"comp_hidden"}},l)),a.add("comp_text",n({label:o.comp_text.label,attributes:{class:"gjs-fonts gjs-f-text"},content:{type:"text",content:"Insert your text here",style:{padding:"10px"},activeOnRender:1}},l)),a.add("comp_image",n({label:o.comp_image.label,attributes:{class:"gjs-fonts gjs-f-image"},content:{style:{color:"black"},type:"image",activeOnRender:1}},l)),a.add("comp_map",n({label:o.comp_map.label,attributes:{class:"fa fa-map-o"},content:{type:"map",style:{height:"350px"}}},l)),a.add("comp_recaptcha",n({label:'\n \n

\n
'.concat(o.comp_recaptcha.label,"
"),content:{type:"comp_recaptcha"}},l)),a.add("comp_stripe",n({label:o.comp_stripe.label,attributes:{class:"fa fa-cc-stripe"},content:{type:"comp_stripe"}},l))}},kYSa:function(t,a){t.exports=e},tjUo:function(e,t,a){"use strict";a.r(t);var n=a("xeH2"),o=a.n(n),l=a("HFWD"),s=a.n(l),c=a("kYSa"),r=a.n(c);function i(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}t.default=r.a.plugins.add("grapesjs-components-farmer",function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.Commands,l=(e.Panels,t.comps||{}),c={comp_input:{label:"Input",classes:"form-group",useTag:"div",template:"\n \n type=\"<%=it.type_attr%>\" class=\"form-control\" name=\"<%=it.name_attr%>\" placeholder=\"<%=it.placeholder_attr || ''%>\" <%= it.value_attr ? 'value=\"' + it.value_attr + '\"' : '' %>/>\n "},comp_select:{label:"Select",classes:"form-group",useTag:"div",template:'\n \n \n '},comp_file:{label:"File",classes:"custom-file",useTag:"div",template:"\n type=\"file\" class=\"custom-file-input\" name=\"<%=it.name_attr%>\" placeholder=\"<%=it.placeholder_attr || ''%>\" <%= it.accept_attr ? 'accept=\"' + it.accept_attr + '\"' : '' %> <%= it.value_attr ? 'value=\"' + it.value_attr + '\"' : '' %>/>\n \n "},comp_textarea:{label:"Textarea",classes:"form-group",useTag:"div",template:"\n \n \n "},comp_checkbox:{label:"Checkbox",classes:"form-check",useTag:"div",template:'\n \n '},comp_hidden:{label:"Hidden Input",useTag:"div",template:"\n type=\"hidden\" name=\"<%=it.name_attr%>\" <%= it.value_attr ? 'value=\"' + it.value_attr + '\"' : '' %>/>\n "},comp_submit:{label:"Submit Button",classes:"btn btn-primary btn-block",useTag:"button",template:"<%= it.label_attr %>"},comp_row:{label:"Row",useTag:"div",classes:"row"},comp_col:{label:"Column",useTag:"div",classes:"col"},comp_col1:{label:"1 Column",useTag:"div"},comp_col2:{label:"2 Columns",useTag:"div"},comp_col3:{label:"3 Columns",useTag:"div"},comp_text:{label:"Text"},comp_image:{label:"Image"},comp_map:{label:"Map"},comp_recaptcha:{label:"reCaptcha",classes:"form-group",template:'\n \n \" data-action=\"<%= it.action_attr || '' %>\" />\n `\n },\n 'comp_stripe': {\n label: 'Payment',\n classes: 'form-group',\n template: `\n \n
\"> 
\n `\n }\n }\n\n // provide defaults\n for(let k in default_comps) {\n const x = default_comps[k]\n const y = opts_comps[k]\n if (y) {\n for(let j in y) {\n y[j] = y[j] || x[j]\n }\n opts_comps[k] = y\n } else {\n opts_comps[k] = x\n }\n\n opts_comps[k]['classes'] = (opts_comps[k]['classes'] || '').split(' ')\n }\n\n const options = {\n formNextId: 1,\n categoryLabel: 'Basic',\n formFieldsPrefix: 'field',\n showStylesOnChange: 1,\n addResource: (url, type='script') => {\n\n const doc = editor.Canvas.getDocument()\n const head = doc.head || doc.getElementsByTagName('head')[0]\n const res = document.createElement(type)\n\n if (type === 'script') {\n res.src = url\n }\n else if (type === 'link') {\n res.rel = 'stylesheet'\n res.href = url\n }\n\n head.appendChild(res)\n }, ...opts\n }\n\n options.comps = options.comps || opts_comps\n\n const compileTemplates = () => {\n let doT = null\n\n Object.keys(options.comps).forEach(k => {\n const t = options.comps[k]\n\n if (t && typeof(t.template) === 'string') {\n if (!doT) {\n doT = doTemplate()\n }\n\n t.template = doT.template(t.template)\n }\n })\n }\n\n /** Prevent Input Default Actions **/\n const preventInputDefaults = () => {\n const el = editor.Canvas.getBody()\n const win = el.ownerWindow\n const body = $(el)\n\n body.click((e) => {\n const event = e || win.event\n const target = event.target || event.srcElement\n const tagName = (target.tagName + '').toLowerCase()\n if (tagName === 'input') {\n event.preventDefault()\n return false\n }\n })\n }\n\n editor.runCommand('prevent-default');\n\n commands.add('get-usable-html', {\n run() {\n // get the builder xml\n let html = editor.getHtml()\n\n // convert into html\n for(let k in options.comps) {\n // default tag as div unless useTag value is provided\n const tag = options.comps[k].useTag || 'div'\n html = html.replace(new RegExp('<' + k, 'g'), '<' + tag)\n html = html.replace(new RegExp('', 'g'), '')\n html = html.replace(new RegExp(` data\\-gjs\\-type\\=\\\"${k}\\\" `, 'g'), ' ')\n html = html.replace(new RegExp(' data\\-highlightable\\=\\\"1\\\" ', 'g'), ' ')\n }\n\n return html\n }\n })\n\n // Add plugins\n require('./traits').default(editor, options)\n require('./blocks').default(editor, options)\n\n if (opts.panel) {\n require('./panels').default(editor, options)\n }\n\n editor.on('load', () => {\n compileTemplates()\n\n setTimeout(() => {\n const doc = editor.Canvas.getDocument()\n const head = doc.head || doc.getElementsByTagName('head')[0]\n var css = `\nbody {\n padding: 10px;\n}\n\ncomp_recaptcha,\ncomp_row,\ncomp_col,\ncomp_hidden {\n min-height: 2rem !important;\n}\n\ncomp_row {\n display: block;\n width: 100%;\n margin-left: 15px;\n margin-right: 15px;\n}\n\ncomp_col {\n min-width: 100px;\n}\n\ncomp_hidden, comp_recaptcha, comp_stripe {\n display: block;\n width: 100%;\n min-width: 100%;\n}\n`\n\n const style = doc.createElement('style')\n\n style.type = 'text/css';\n if (style.styleSheet){\n // This is required for IE8 and below.\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(doc.createTextNode(css));\n }\n\n head.appendChild(style);\n preventInputDefaults()\n }, 10)\n })\n})\n","import doT from 'doT'\n\nexport default () => {\n doT.templateSettings = {\n evaluate: /\\<\\%([\\s\\S]+?)\\%\\>/g,\n interpolate: /\\<\\%=([\\s\\S]+?)\\%\\>/g,\n encode: /\\<\\%!([\\s\\S]+?)\\%\\>/g,\n use: /\\<\\%#([\\s\\S]+?)\\%\\>/g,\n define: /\\<\\%##\\s*([\\w\\.$]+)\\s*(\\:|=)([\\s\\S]+?)#\\%\\>/g,\n conditional: /\\<\\%\\?(\\?)?\\s*([\\s\\S]*?)\\s*\\%\\>/g,\n iterate: /\\<\\%~\\s*(?:\\%\\>|([\\s\\S]+?)\\s*\\:\\s*([\\w$]+)\\s*(?:\\:\\s*([\\w$]+))?\\s*\\%\\>)/g,\n varname: 'it',\n strip: true,\n append: true,\n selfcontained: false\n }\n\n return doT\n}\n","module.exports = __WEBPACK_EXTERNAL_MODULE_xeH2__;"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack://grapesjs-components-farmer/webpack/universalModuleDefinition","webpack://grapesjs-components-farmer/webpack/bootstrap","webpack://grapesjs-components-farmer/./node_modules/doT/doT.js","webpack://grapesjs-components-farmer/./src/consts.js","webpack://grapesjs-components-farmer/./src/panels.js","webpack://grapesjs-components-farmer/./src/traits.js","webpack://grapesjs-components-farmer/./src/blocks.js","webpack://grapesjs-components-farmer/external \"grapesjs\"","webpack://grapesjs-components-farmer/./src/index.js","webpack://grapesjs-components-farmer/./src/templating.js","webpack://grapesjs-components-farmer/external \"jQuery\""],"names":["root","factory","exports","module","require","define","amd","window","__WEBPACK_EXTERNAL_MODULE_kYSa__","__WEBPACK_EXTERNAL_MODULE_xeH2__","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","__WEBPACK_AMD_DEFINE_RESULT__","_globals","doT","version","templateSettings","evaluate","interpolate","encode","use","useParams","defineParams","conditional","iterate","varname","strip","append","selfcontained","doNotSkipEncoded","template","undefined","compile","log","encodeHTMLSource","encodeHTMLRules","&","<",">","\"","'","/","matchHTML","code","toString","replace","this","eval","startend","start","end","startencode","split","skip","unescape","tmpl","def","needhtmlencode","indv","cse","sid","str","resolveDefs","block","assign","indexOf","substring","param","v","arg","text","Function","rw","__exp","RegExp","elsecase","vname","iname","_encodeHTML","e","console","__webpack_exports__","editor","opts","cmds","Commands","pn","Panels","eConfig","getConfig","swv","expt","osm","ola","obl","ful","prv","showDevices","txtConfirm","textCleanCanvas","add","setDevice","confirm","runCommand","getPanels","reset","id","buttons","command","context","active","className","attributes","title","addPanel","on","editorEl","$","getEl","openTmBtn","getButton","set","openSm","traitsSector","traitsProps","find","hide","before","traitStyle","style","hidden","display","openBl","showStylesOnChange","openSmBtn","openLayersBtn","getSelected","arguments","length","tm","TraitManager","dc","DomComponents","defaultType","BlockManager","getType","defaultModel","model","defaultView","view","fieldTraits","defaults","traits","concat","type","label","placeholder","inputTraits","changeProp","addType","events","onchange","getInputEl","inputEl","input","document","createElement","target","onValueChange","myDefaultModel","extend","_objectSpread","draggable","droppable","copyable","label_attr","toHTML","cf","comps","tagName","rst","genHtml","useTag","html","innerText","outerHTML","getTraitValues","values","each","trait","k","myInitDefaults","ensureNameAttr","attrs","nameTrait","where","name_attr","formFieldsPrefix","formNextId","el","generateHtml","$el","$k","templateFn","empty","myDefaultView","onRender","type_attr","options","classes","comp_input","init","listenTo","option_attr","comp_select","comp_textarea","comp_file","comp_checkbox","comp_hidden","comp_submit","comp_row","comp_col","sitekey_attr","action_attr","comp_recaptcha","hidepostal_attr","bm","blocks","blockCategories","resetBlocks","getAll","allBlocks","category","categoryLabel","comp_col1","class","content","components","comp_col2","comp_col3","comp_text","padding","activeOnRender","comp_image","color","comp_map","height","comp_stripe","grapesjs","plugins","commands","opts_comps","default_comps","x","y","j","addResource","url","doc","Canvas","getDocument","head","getElementsByTagName","res","src","rel","href","appendChild","compileTemplates","keys","forEach","run","getHtml","tag","default","panel","setTimeout","win","css","styleSheet","cssText","createTextNode","getBody","ownerWindow","click","event","srcElement","toLowerCase","preventDefault"],"mappings":"CAAA,SAAAA,EAAAC,GACA,iBAAAC,SAAA,iBAAAC,OACAA,OAAAD,QAAAD,EAAAG,QAAA,YAAAA,QAAA,WACA,mBAAAC,eAAAC,IACAD,OAAA,mDAAAJ,GACA,iBAAAC,QACAA,QAAA,8BAAAD,EAAAG,QAAA,YAAAA,QAAA,WAEAJ,EAAA,8BAAAC,EAAAD,EAAA,SAAAA,EAAA,QARA,CASCO,OAAA,SAAAC,EAAAC,GACD,mBCTA,IAAAC,EAAA,GAGA,SAAAC,EAAAC,GAGA,GAAAF,EAAAE,GACA,OAAAF,EAAAE,GAAAV,QAGA,IAAAC,EAAAO,EAAAE,GAAA,CACAC,EAAAD,EACAE,GAAA,EACAZ,QAAA,IAUA,OANAa,EAAAH,GAAAI,KAAAb,EAAAD,QAAAC,IAAA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6B,OAAO,2BAAgC,KAAM,KAGvE,OAAO6G,KAKXpN,EAAQ,QAAY+S,QAAQhM,EAAQ8H,GACpC7O,EAAQ,QAAY+S,QAAQhM,EAAQ8H,GAEhC7H,EAAKgM,OACPhT,EAAQ,QAAY+S,QAAQhM,EAAQ8H,GAGtC9H,EAAOiC,GAAG,OAAQ,WAChByJ,IAEAQ,WAAW,WACT,IAhDI7E,EACA8E,EA+CEnB,EAAOhL,EAAOiL,OAAOC,cACrBC,EAAOH,EAAIG,MAAQH,EAAII,qBAAqB,QAAQ,GACtDgB,EAAG,4WA8BDrJ,EAAQiI,EAAI5F,cAAc,SAEhCrC,EAAMyB,KAAO,WACTzB,EAAMsJ,WAERtJ,EAAMsJ,WAAWC,QAAUF,EAE3BrJ,EAAM0I,YAAYT,EAAIuB,eAAeH,IAGvCjB,EAAKM,YAAY1I,GA1FbsE,EAASrH,EAAOiL,OAAOuB,UACvBL,EAAS9E,EAAGoF,YACLtK,IAAEkF,GAEVqF,MAAM,SAAC7M,GACV,IAAM8M,EAAS9M,GAAKsM,EAAIQ,MAGxB,GAAgB,YAFDA,EAAMtH,QAAUsH,EAAMC,YACb3G,QAAU,IAAI4G,cAGpC,OADAF,EAAMG,kBACC,KAkFR,4BEnRP9T,EAAAD,QAAAO","file":"/index.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"grapesjs\"), require(\"jQuery\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"grapesjs-components-farmer\", [\"grapesjs\", \"jQuery\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"grapesjs-components-farmer\"] = factory(require(\"grapesjs\"), require(\"jQuery\"));\n\telse\n\t\troot[\"grapesjs-components-farmer\"] = factory(root[\"grapesjs\"], root[\"jQuery\"]);\n})(window, function(__WEBPACK_EXTERNAL_MODULE_kYSa__, __WEBPACK_EXTERNAL_MODULE_xeH2__) {\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 = 0);\n","// doT.js\n// 2011-2014, Laura Doktorova, https://github.com/olado/doT\n// Licensed under the MIT license.\n\n(function () {\n\t\"use strict\";\n\n\tvar doT = {\n\t\tname: \"doT\",\n\t\tversion: \"1.1.1\",\n\t\ttemplateSettings: {\n\t\t\tevaluate: /\\{\\{([\\s\\S]+?(\\}?)+)\\}\\}/g,\n\t\t\tinterpolate: /\\{\\{=([\\s\\S]+?)\\}\\}/g,\n\t\t\tencode: /\\{\\{!([\\s\\S]+?)\\}\\}/g,\n\t\t\tuse: /\\{\\{#([\\s\\S]+?)\\}\\}/g,\n\t\t\tuseParams: /(^|[^\\w$])def(?:\\.|\\[[\\'\\\"])([\\w$\\.]+)(?:[\\'\\\"]\\])?\\s*\\:\\s*([\\w$\\.]+|\\\"[^\\\"]+\\\"|\\'[^\\']+\\'|\\{[^\\}]+\\})/g,\n\t\t\tdefine: /\\{\\{##\\s*([\\w\\.$]+)\\s*(\\:|=)([\\s\\S]+?)#\\}\\}/g,\n\t\t\tdefineParams:/^\\s*([\\w$]+):([\\s\\S]+)/,\n\t\t\tconditional: /\\{\\{\\?(\\?)?\\s*([\\s\\S]*?)\\s*\\}\\}/g,\n\t\t\titerate: /\\{\\{~\\s*(?:\\}\\}|([\\s\\S]+?)\\s*\\:\\s*([\\w$]+)\\s*(?:\\:\\s*([\\w$]+))?\\s*\\}\\})/g,\n\t\t\tvarname:\t\"it\",\n\t\t\tstrip:\t\ttrue,\n\t\t\tappend:\t\ttrue,\n\t\t\tselfcontained: false,\n\t\t\tdoNotSkipEncoded: false\n\t\t},\n\t\ttemplate: undefined, //fn, compile template\n\t\tcompile: undefined, //fn, for express\n\t\tlog: true\n\t}, _globals;\n\n\tdoT.encodeHTMLSource = function(doNotSkipEncoded) {\n\t\tvar encodeHTMLRules = { \"&\": \"&\", \"<\": \"<\", \">\": \">\", '\"': \""\", \"'\": \"'\", \"/\": \"/\" },\n\t\t\tmatchHTML = doNotSkipEncoded ? /[&<>\"'\\/]/g : /&(?!#?\\w+;)|<|>|\"|'|\\//g;\n\t\treturn function(code) {\n\t\t\treturn code ? code.toString().replace(matchHTML, function(m) {return encodeHTMLRules[m] || m;}) : \"\";\n\t\t};\n\t};\n\n\t_globals = (function(){ return this || (0,eval)(\"this\"); }());\n\n\t/* istanbul ignore else */\n\tif (typeof module !== \"undefined\" && module.exports) {\n\t\tmodule.exports = doT;\n\t} else if (typeof define === \"function\" && define.amd) {\n\t\tdefine(function(){return doT;});\n\t} else {\n\t\t_globals.doT = doT;\n\t}\n\n\tvar startend = {\n\t\tappend: { start: \"'+(\", end: \")+'\", startencode: \"'+encodeHTML(\" },\n\t\tsplit: { start: \"';out+=(\", end: \");out+='\", startencode: \"';out+=encodeHTML(\" }\n\t}, skip = /$^/;\n\n\tfunction resolveDefs(c, block, def) {\n\t\treturn ((typeof block === \"string\") ? block : block.toString())\n\t\t.replace(c.define || skip, function(m, code, assign, value) {\n\t\t\tif (code.indexOf(\"def.\") === 0) {\n\t\t\t\tcode = code.substring(4);\n\t\t\t}\n\t\t\tif (!(code in def)) {\n\t\t\t\tif (assign === \":\") {\n\t\t\t\t\tif (c.defineParams) value.replace(c.defineParams, function(m, param, v) {\n\t\t\t\t\t\tdef[code] = {arg: param, text: v};\n\t\t\t\t\t});\n\t\t\t\t\tif (!(code in def)) def[code]= value;\n\t\t\t\t} else {\n\t\t\t\t\tnew Function(\"def\", \"def['\"+code+\"']=\" + value)(def);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn \"\";\n\t\t})\n\t\t.replace(c.use || skip, function(m, code) {\n\t\t\tif (c.useParams) code = code.replace(c.useParams, function(m, s, d, param) {\n\t\t\t\tif (def[d] && def[d].arg && param) {\n\t\t\t\t\tvar rw = (d+\":\"+param).replace(/'|\\\\/g, \"_\");\n\t\t\t\t\tdef.__exp = def.__exp || {};\n\t\t\t\t\tdef.__exp[rw] = def[d].text.replace(new RegExp(\"(^|[^\\\\w$])\" + def[d].arg + \"([^\\\\w$])\", \"g\"), \"$1\" + param + \"$2\");\n\t\t\t\t\treturn s + \"def.__exp['\"+rw+\"']\";\n\t\t\t\t}\n\t\t\t});\n\t\t\tvar v = new Function(\"def\", \"return \" + code)(def);\n\t\t\treturn v ? resolveDefs(c, v, def) : v;\n\t\t});\n\t}\n\n\tfunction unescape(code) {\n\t\treturn code.replace(/\\\\('|\\\\)/g, \"$1\").replace(/[\\r\\t\\n]/g, \" \");\n\t}\n\n\tdoT.template = function(tmpl, c, def) {\n\t\tc = c || doT.templateSettings;\n\t\tvar cse = c.append ? startend.append : startend.split, needhtmlencode, sid = 0, indv,\n\t\t\tstr = (c.use || c.define) ? resolveDefs(c, tmpl, def || {}) : tmpl;\n\n\t\tstr = (\"var out='\" + (c.strip ? str.replace(/(^|\\r|\\n)\\t* +| +\\t*(\\r|\\n|$)/g,\" \")\n\t\t\t\t\t.replace(/\\r|\\n|\\t|\\/\\*[\\s\\S]*?\\*\\//g,\"\"): str)\n\t\t\t.replace(/'|\\\\/g, \"\\\\$&\")\n\t\t\t.replace(c.interpolate || skip, function(m, code) {\n\t\t\t\treturn cse.start + unescape(code) + cse.end;\n\t\t\t})\n\t\t\t.replace(c.encode || skip, function(m, code) {\n\t\t\t\tneedhtmlencode = true;\n\t\t\t\treturn cse.startencode + unescape(code) + cse.end;\n\t\t\t})\n\t\t\t.replace(c.conditional || skip, function(m, elsecase, code) {\n\t\t\t\treturn elsecase ?\n\t\t\t\t\t(code ? \"';}else if(\" + unescape(code) + \"){out+='\" : \"';}else{out+='\") :\n\t\t\t\t\t(code ? \"';if(\" + unescape(code) + \"){out+='\" : \"';}out+='\");\n\t\t\t})\n\t\t\t.replace(c.iterate || skip, function(m, iterate, vname, iname) {\n\t\t\t\tif (!iterate) return \"';} } out+='\";\n\t\t\t\tsid+=1; indv=iname || \"i\"+sid; iterate=unescape(iterate);\n\t\t\t\treturn \"';var arr\"+sid+\"=\"+iterate+\";if(arr\"+sid+\"){var \"+vname+\",\"+indv+\"=-1,l\"+sid+\"=arr\"+sid+\".length-1;while(\"+indv+\" {\n const cmds = editor.Commands\n const pn = editor.Panels\n const eConfig = editor.getConfig()\n const crc = 'create-comp'\n const mvc = 'move-comp'\n const swv = 'sw-visibility'\n const expt = 'export-template'\n const osm = 'open-sm'\n const otm = 'open-tm'\n const ola = 'open-layers'\n const obl = 'open-blocks'\n const ful = 'fullscreen'\n const prv = 'preview'\n\n eConfig.showDevices = 0\n\n const txtConfirm = opts.textCleanCanvas || 'Are you sure to clean the canvas?'\n\n cmds.add(cmdDeviceDesktop, e => e.setDevice('Desktop'))\n cmds.add(cmdDeviceTablet, e => e.setDevice('Tablet'))\n cmds.add(cmdDeviceMobile, e => e.setDevice('Mobile portrait'))\n cmds.add(cmdClear, e => confirm(txtConfirm) && e.runCommand('core:canvas-clear'))\n\n pn.getPanels().reset([{\n id: 'commands',\n buttons: [{}],\n },{\n id: 'options',\n buttons: [{\n id: swv,\n command: swv,\n context: swv,\n active: 1,\n className: 'fa fa-square-o',\n attributes: {\n title: 'Show Borders'\n }\n },{\n id: prv,\n context: prv,\n command: e => e.runCommand(prv),\n className: 'fa fa-eye',\n attributes: {\n title: 'Preview'\n }\n },{\n id: ful,\n command: ful,\n context: ful,\n className: 'fa fa-arrows-alt',\n attributes: {\n title: 'Fullscreen'\n }\n },{\n id: expt,\n className: 'fa fa-code',\n command: e => e.runCommand(expt),\n attributes: {\n title: 'Show code'\n }\n },{\n id: 'undo',\n className: 'fa fa-undo',\n command: e => e.runCommand('core:undo'),\n attributes: {\n title: 'Undo'\n }\n },{\n id: 'redo',\n className: 'fa fa-repeat',\n command: e => e.runCommand('core:redo'),\n attributes: {\n title: 'Redo'\n }\n },{\n id: cmdClear,\n className: 'fa fa-trash',\n command: e => e.runCommand(cmdClear),\n attributes: {\n title: 'Clear canvas'\n }\n }],\n },{\n id: 'views',\n buttons : [{\n id: osm,\n command: osm,\n className: 'fa fa-paint-brush',\n attributes: {\n title: 'Style Manager'\n }\n },{\n id: otm,\n command: otm,\n className: 'fa fa-cog',\n attributes: {\n title: 'Settings'\n }\n },{\n id: ola,\n command: ola,\n className: 'fa fa-bars',\n attributes: {\n title: 'Layers'\n }\n },{\n id: obl,\n command: obl,\n className: 'fa fa-th-large',\n active: 1,\n attributes: {\n title: 'Blocks'\n }\n }],\n }])\n\n // Add devices buttons\n const panelDevices = pn.addPanel({id: 'devices-c'})\n panelDevices.get('buttons').add([{\n id: cmdDeviceDesktop,\n command: cmdDeviceDesktop,\n className: 'fa fa-desktop',\n active: 1,\n attributes: {\n title: 'Desktop'\n }\n },{\n id: cmdDeviceTablet,\n command: cmdDeviceTablet,\n className: 'fa fa-tablet',\n attributes: {\n title: 'Tablet'\n }\n },{\n id: cmdDeviceMobile,\n command: cmdDeviceMobile,\n className: 'fa fa-mobile',\n attributes: {\n title: 'Mobile'\n }\n }])\n\n\n editor.on('load', () => {\n const pn = editor.Panels\n const editorEl = $(editor.getEl())\n\n // Load and show settings and style manager\n const openTmBtn = pn.getButton('views', 'open-tm')\n openTmBtn && openTmBtn.set('active', 1)\n const openSm = pn.getButton('views', 'open-sm')\n openSm && openSm.set('active', 1)\n\n // Add Settings Sector\n const traitsSector = $(`
\n
Settings
\n
`)\n const traitsProps = traitsSector.find('.gjs-sm-properties')\n\n // copy from settings tab into traits sector and then hide settings tab\n traitsProps.append(editorEl.find('.gjs-trt-traits'))\n editorEl.find('.gjs-pn-views .fa-cog').hide()\n editorEl.find('.gjs-sm-sectors').before(traitsSector)\n\n traitsSector.find('.gjs-sm-title').on('click', () => {\n const traitStyle = traitsProps.get(0).style\n const hidden = traitStyle.display === 'none'\n if (hidden) {\n traitStyle.display = 'block'\n } else {\n traitStyle.display = 'none'\n }\n })\n\n const openBl = pn.getButton('views', obl)\n openBl && openBl.set('active', 1)\n\n // On component change show the Style Manager\n opts.showStylesOnChange && editor.on('component:selected', () => {\n const openSmBtn = pn.getButton('views', osm)\n const openLayersBtn = pn.getButton('views', ola)\n\n // Don't switch when the Layer Manager is on or\n // there is no selected component\n if ((!openLayersBtn || !openLayersBtn.get('active')) && editor.getSelected()) {\n openSmBtn && openSmBtn.set('active', 1)\n }\n })\n })\n}\n","import $ from 'jquery'\n\nexport default (editor, opts = {}) => {\n const tm = editor.TraitManager\n const dc = editor.DomComponents\n const bm = editor.BlockManager\n\n const defaultType = dc.getType('default')\n const selectType = dc.getType('select') || defaultType\n const defaultModel = defaultType.model\n const defaultView = defaultType.view\n const textType = dc.getType('text')\n\n const fieldTraits = defaultModel.prototype.defaults.traits.concat([\n {\n type: 'text',\n name: 'name_attr',\n label: 'Name',\n placeholder: 'Enter a field name..'\n }, {\n type: 'text',\n name: 'label_attr',\n label: 'Label',\n placeholder: 'Enter a field label..'\n }\n ])\n\n const inputTraits = fieldTraits.concat([\n {\n type: 'text',\n name: 'value_attr',\n label: 'Value',\n changeProp: 1,\n placeholder: 'Enter a default value..'\n }, {\n type: 'text',\n name: 'placeholder_attr',\n label: 'Placeholder',\n changeProp: 1,\n placeholder: 'Enter placeholder text..'\n }, {\n type: 'checkbox',\n name: 'required_attr',\n changeProp: 1,\n label: 'Required'\n }, {\n type: 'text',\n name: 'pattern_attr',\n changeProp: 1,\n label: 'Pattern'\n }, {\n type: 'number',\n name: 'min_attr',\n changeProp: 1,\n label: 'Min'\n }, {\n type: 'number',\n name: 'max_attr',\n changeProp: 1,\n label: 'Max'\n }\n ])\n\n // text, password, email, number, url, tel, search, date, datetime,\n // datetime-local, month, week, time, range, or color\n // exclude: file\n const inputTypeTrait = {\n type: 'select',\n name: 'type_attr',\n label: 'Type',\n options: [\n { name: 'Text', value: 'text' },\n { name: 'Password', value: 'password' },\n { name: 'Email', value: 'email' },\n { name: 'Number', value: 'number' },\n { name: 'URL', value: 'url' },\n { name: 'Phone', value: 'tel' },\n // { name: 'Search', value: 'tel' },\n { name: 'Date', value: 'date' },\n { name: 'Date Time', value: 'datetime-local' },\n // { name: 'Month', value: 'month' },\n // { name: 'Week', value: 'week' },\n { name: 'Range', value: 'range' },\n // { name: 'Time', value: 'time' },\n { name: 'Color Picker', value: 'color' },\n ]\n }\n\n // advanced traits\n tm.addType('option_attr', {\n events:{\n 'onchange': 'onChange'\n },\n\n /**\n * Returns the input element\n * @return {HTMLElement}\n */\n getInputEl: function() {\n if (!this.inputEl) {\n var input = document.createElement('textarea')\n input.value = this.target.get('option_attr')\n this.inputEl = input\n }\n\n return this.inputEl\n },\n\n /**\n * Triggered when the value of the model is changed\n */\n onValueChange: function () {\n this.target.set('option_attr', this.model.get('value'))\n }\n })\n\n const myDefaultModel = defaultModel.extend({\n defaults: {\n ...defaultModel.prototype.defaults,\n draggable: true,\n droppable: true,\n copyable: false,\n label_attr: 'Label'\n },\n // force regenerate of HTML\n toHTML() {\n const cf = opts.comps[this.attributes.tagName]\n const rst = this.genHtml()\n if (cf && cf.useTag) {\n if (cf.useTag === 'innerHTML') {\n return rst.html()\n } else if (cf.useTag === 'innerText') {\n return this.genHtml()[0].innerText\n }\n }\n\n return this.genHtml()[0].outerHTML\n },\n getTraitValues() {\n const values = { ...this.attributes }\n this.get('traits').\n each((trait) => {\n const k = trait.get('name')\n values[k] = trait.get('value') || values[k]\n })\n\n return values\n },\n myInitDefaults() {\n const that = this\n const values = { ...that.attributes }\n that.get('traits').\n each((trait) => {\n const k = trait.get('name')\n // set defaults\n if (k.indexOf('_attr') > 0) {\n trait.set('value', values[k])\n }\n })\n },\n ensureNameAttr(attrs) {\n const model = this\n const nameTrait = model.get('traits').where({name: 'name_attr'})[0]\n\n if (nameTrait) {\n let name = attrs.name_attr\n if (!name) {\n name = `${opts.formFieldsPrefix}${opts.formNextId++}`\n nameTrait.set('value', name)\n model.set('name_attr', name)\n return true\n }\n }\n\n return false\n },\n // function to use with listener\n genHtml() {\n if (!this.view || !this.view.el) {\n const el = document.createElement(this.attributes.tagName)\n return this.generateHtml(el, this.attributes.tagName)\n }\n\n return this.generateHtml(this.view.el, this.attributes.tagName)\n },\n generateHtml(el, k) {\n const model = this\n const $el = $(el || model.view.el)\n const attrs = model.getTraitValues()\n const $k = $k || model.get('tagName')\n\n if (opts && opts.comps && opts.comps[$k]) {\n const templateFn = opts.comps[$k].template\n\n if (typeof(templateFn) === 'function') {\n if (!model.ensureNameAttr(attrs)) {\n $el.empty()\n $el.html(templateFn(attrs || {}))\n }\n }\n }\n\n return $el\n }\n })\n\n // override default view to generate html\n const myDefaultView = defaultView.extend({\n onRender() {\n if (this.model.genHtml) {\n this.model.genHtml()\n }\n\n return this\n }\n })\n\n // BEGIN: components\n dc.addType('comp_input', {\n model: myDefaultModel.extend({\n defaults: {\n ...myDefaultModel.prototype.defaults,\n draggable: true,\n droppable: false,\n copyable: false,\n tagName: 'comp_input',\n type_attr: 'text',\n traits: inputTraits.concat(inputTypeTrait),\n classes: ['comp_input'].concat(opts.comps.comp_input.classes)\n },\n init() {\n const that = this\n that.myInitDefaults()\n\n that.listenTo(that, 'change:label_attr', that.genHtml)\n that.listenTo(that, 'change:name_attr', that.genHtml)\n that.listenTo(that, 'change:placeholder_attr', that.genHtml)\n }\n }),\n view: myDefaultView\n })\n\n // Select Box\n dc.addType('comp_select', {\n model: myDefaultModel.extend({\n defaults: {\n ...myDefaultModel.prototype.defaults,\n draggable: true,\n droppable: false,\n copyable: false,\n tagName: 'comp_select',\n option_attr: 'MN::Minnesota\\nTX::Texas',\n label_attr: 'Select',\n traits: [\n {\n type: 'option_attr'\n }, {\n type: 'checkbox',\n name: 'required_attr',\n changeProp: 1,\n label: 'Required'\n }, {\n type: 'checkbox',\n name: 'multiple_attr',\n changeProp: 1,\n label: 'Multiple'\n }\n ].concat(fieldTraits),\n classes: ['comp_select'].concat(opts.comps.comp_select.classes)\n },\n init() {\n const that = this\n that.myInitDefaults()\n\n that.listenTo(that, 'change:label_attr', that.genHtml)\n that.listenTo(that, 'change:name_attr', that.genHtml)\n that.listenTo(that, 'change:multiple_attr', that.genHtml)\n that.listenTo(that, 'change:option_attr', that.genHtml)\n }\n }),\n view: myDefaultView\n })\n\n dc.addType('comp_textarea', {\n model: myDefaultModel.extend({\n defaults: {\n ...defaultModel.prototype.defaults,\n draggable: true,\n droppable: false,\n copyable: false,\n tagName: 'comp_textarea',\n label_attr: 'Message',\n traits: [\n {\n type: 'checkbox',\n name: 'required_attr',\n changeProp: 1,\n label: 'Required'\n }, {\n type: 'text',\n name: 'placeholder_attr',\n label: 'Placeholder',\n changeProp: 1,\n placeholder: 'Enter placeholder text..'\n }, {\n type: 'number',\n name: 'rows_attr',\n label: 'Rows',\n changeProp: 1,\n placeholder: 'Enter field rows/line-height..'\n }, {\n type: 'number',\n name: 'cols_attr',\n label: 'Columns',\n changeProp: 1,\n placeholder: 'Enter field columns/width..'\n },\n ].concat(fieldTraits),\n classes: ['comp_textarea'].concat(opts.comps.comp_textarea.classes)\n },\n init() {\n const that = this\n that.myInitDefaults()\n\n that.listenTo(that, 'change:label_attr', that.genHtml)\n that.listenTo(that, 'change:name_attr', that.genHtml)\n that.listenTo(that, 'change:placeholder_attr', that.genHtml)\n that.listenTo(that, 'change:cols_attr', that.genHtml)\n that.listenTo(that, 'change:rows_attr', that.genHtml)\n }\n }),\n view: myDefaultView\n })\n\n dc.addType('comp_file', {\n model: myDefaultModel.extend({\n defaults: {\n ...defaultModel.prototype.defaults,\n draggable: true,\n droppable: false,\n copyable: false,\n tagName: 'comp_file',\n label_attr: 'Choose file...',\n traits: [\n {\n type: 'checkbox',\n name: 'required_attr',\n changeProp: 1,\n label: 'Required'\n }, {\n type: 'text',\n name: 'placeholder_attr',\n label: 'Placeholder',\n changeProp: 1,\n placeholder: 'Enter placeholder text..'\n }, {\n type: 'string',\n name: 'accept_attr',\n label: 'Accept',\n changeProp: 1,\n placeholder: 'image/jpeg, image/png, image/gif'\n },\n ].concat(fieldTraits),\n classes: ['comp_file'].concat(opts.comps.comp_file.classes)\n },\n init() {\n const that = this\n that.myInitDefaults()\n\n that.listenTo(that, 'change:label_attr', that.genHtml)\n that.listenTo(that, 'change:name_attr', that.genHtml)\n that.listenTo(that, 'change:placeholder_attr', that.genHtml)\n that.listenTo(that, 'change:accept_attr', that.genHtml)\n }\n }),\n view: myDefaultView\n })\n\n dc.addType('comp_checkbox', {\n model: myDefaultModel.extend({\n defaults: {\n ...myDefaultModel.prototype.defaults,\n draggable: true,\n droppable: false,\n copyable: false,\n tagName: 'comp_checkbox',\n label_attr: 'I accept the terms and use',\n traits: [\n {\n type: 'checkbox',\n name: 'required_attr',\n changeProp: 1,\n label: 'Required'\n }\n ].concat(fieldTraits),\n classes: ['comp_checkbox'].concat(opts.comps.comp_checkbox.classes)\n },\n init() {\n const that = this\n that.myInitDefaults()\n\n that.listenTo(that, 'change:label_attr', that.genHtml)\n that.listenTo(that, 'change:name_attr', that.genHtml)\n }\n }),\n view: myDefaultView\n })\n\n dc.addType('comp_hidden', {\n model: myDefaultModel.extend({\n defaults: {\n ...myDefaultModel.prototype.defaults,\n draggable: true,\n droppable: false,\n copyable: false,\n tagName: 'comp_hidden',\n traits: [{\n type: 'text',\n name: 'name_attr',\n label: 'Name',\n changeProp: 1,\n placeholder: 'Enter a field name...'\n }],\n classes: ['comp_hidden'].concat(opts.comps.comp_hidden.classes)\n },\n init() {\n const that = this\n that.myInitDefaults()\n\n that.listenTo(that, 'change:name_attr', that.genHtml)\n }\n }),\n view: myDefaultView\n })\n\n dc.addType('comp_submit', {\n model: myDefaultModel.extend({\n defaults: {\n ...myDefaultModel.prototype.defaults,\n draggable: true,\n droppable: false,\n copyable: false,\n tagName: 'comp_submit',\n label_attr: 'Send',\n traits: defaultModel.prototype.defaults.traits.concat([\n {\n type: 'text',\n name: 'label_attr',\n label: 'Label',\n placeholder: 'Enter a field label..'\n }\n ]),\n classes: ['comp_submit'].concat(opts.comps.comp_submit.classes)\n },\n init() {\n const that = this\n that.myInitDefaults()\n\n that.listenTo(that, 'change:label_attr', that.genHtml)\n }\n }),\n view: myDefaultView\n })\n\n dc.addType('comp_row', {\n model: defaultModel.extend({\n defaults: {\n ...defaultModel.prototype.defaults,\n tagName: 'comp_row',\n // Can be dropped inside other elements\n draggable: true,\n copyable: false,\n // Can drop other elements inside it\n droppable: 'comp_col',\n classes: ['comp_row'].concat(opts.comps.comp_row.classes)\n }\n }),\n view: defaultView\n })\n\n dc.addType('comp_col', {\n model: defaultModel.extend({\n defaults: {\n ...defaultModel.prototype.defaults,\n tagName: 'comp_col',\n // Can be dropped only inside `row` elements\n draggable: 'comp_row',\n // Can drop other elements inside it\n droppable: true,\n copyable: false,\n classes: ['comp_col'].concat(opts.comps.comp_col.classes)\n }\n }),\n view: defaultView\n })\n\n dc.addType('comp_recaptcha', {\n model: myDefaultModel.extend({\n defaults: {\n ...myDefaultModel.prototype.defaults,\n draggable: true,\n droppable: false,\n copyable: false,\n tagName: 'comp_recaptcha',\n sitekey_attr: 'sitekey',\n action_attr: 'contact-us',\n traits: defaultModel.prototype.defaults.traits.concat([\n {\n type: 'text',\n name: 'sitekey_attr',\n label: 'Site key',\n placeholder: 'e.g. sitekey'\n },\n {\n type: 'text',\n name: 'action_attr',\n label: 'Action',\n placeholder: 'recaptcha action name'\n }\n ]),\n classes: ['comp_recaptcha'].concat(opts.comps.comp_recaptcha.classes)\n },\n init() {\n const that = this\n that.myInitDefaults()\n\n that.listenTo(that, 'change:sitekey_attr', that.genHtml)\n }\n }),\n view: myDefaultView\n })\n\n dc.addType('comp_stripe', {\n model: myDefaultModel.extend({\n defaults: {\n ...myDefaultModel.prototype.defaults,\n draggable: true,\n droppable: false,\n copyable: false,\n tagName: 'comp_stripe',\n hidepostal_attr: 'false',\n traits: defaultModel.prototype.defaults.traits.concat([\n {\n type: 'text',\n name: 'publickey_attr',\n label: 'Public key',\n placeholder: 'e.g. stripe public key'\n },\n {\n type: 'checkbox',\n name: 'hidepostal_attr',\n label: 'Hide postal'\n }\n ]),\n classes: ['comp_stripe'].concat(opts.comps.comp_recaptcha.classes)\n },\n init() {\n const that = this\n that.myInitDefaults()\n\n that.listenTo(that, 'change:publickey_attr', that.genHtml)\n }\n }),\n view: myDefaultView\n })\n}\n","export default (editor, opts = {}) => {\n const bm = editor.BlockManager\n const c = opts.comps\n const blocks = c.blocks\n const cats = c.blockCategories\n\n if (opts.resetBlocks) {\n bm.getAll().reset()\n }\n\n const allBlocks = {\n category: opts.categoryLabel\n }\n\n // CORE BLOCKS\n bm.add('comp_col1').set({\n label: c.comp_col1.label,\n attributes: { class: 'gjs-fonts gjs-f-b1' },\n content: {\n type: 'comp_row',\n components: [\n { type: 'comp_col', classes: c.comp_col1.classes.concat(c.comp_col.classes) }\n ]\n },\n ...allBlocks\n })\n\n bm.add('comp_col2').set({\n label: c.comp_col2.label,\n attributes: { class: 'gjs-fonts gjs-f-b2' },\n content: {\n type: 'comp_row',\n components: [\n { type: 'comp_col', classes: c.comp_col2.classes.concat(c.comp_col.classes) },\n { type: 'comp_col', classes: c.comp_col2.classes.concat(c.comp_col.classes) }\n ]\n },\n ...allBlocks\n })\n\n bm.add('comp_col3').set({\n label: c.comp_col3.label,\n attributes: { class: 'gjs-fonts gjs-f-b3' },\n content: {\n type: 'comp_row',\n components: [\n { type: 'comp_col', classes: c.comp_col3.classes.concat(c.comp_col.classes) },\n { type: 'comp_col', classes: c.comp_col3.classes.concat(c.comp_col.classes) },\n { type: 'comp_col', classes: c.comp_col3.classes.concat(c.comp_col.classes) }\n ]\n },\n ...allBlocks\n })\n\n bm.add('comp_submit', {\n label: `\n
 
\n
${c.comp_submit.label}
\n `,\n content: {\n type: 'comp_submit'\n },\n ...allBlocks\n })\n\n bm.add('comp_input', {\n label: `\n \n \n \n \n
${c.comp_input.label}
`,\n content: {\n type: 'comp_input'\n },\n ...allBlocks\n })\n\n bm.add('comp_textarea', {\n label: `\n \n \n \n \n \n \n \n
${c.comp_textarea.label}
`,\n content: {\n type: 'comp_textarea'\n },\n ...allBlocks\n })\n\n bm.add('comp_select', {\n label: `\n \n \n \n \n \n
${c.comp_select.label}
`,\n content: {\n type: 'comp_select'\n },\n ...allBlocks\n })\n\n bm.add('comp_file', {\n label: c.comp_file.label,\n attributes: { class:'fa fa-file' },\n content: {\n type: 'comp_file'\n },\n ...allBlocks\n })\n\n bm.add('comp_checkbox', {\n label: c.comp_checkbox.label,\n attributes: { class: 'fa fa-check-square' },\n content: {\n type: 'comp_checkbox'\n },\n ...allBlocks\n })\n\n bm.add('comp_hidden', {\n label: `\n \n \n \n
${c.comp_hidden.label}
`,\n content: {\n type: 'comp_hidden'\n },\n ...allBlocks\n })\n\n bm.add('comp_text', {\n label: c.comp_text.label,\n attributes: { class:'gjs-fonts gjs-f-text' },\n content: {\n type:'text',\n content: 'Insert your text here',\n style: {padding: '10px' },\n activeOnRender: 1\n },\n ...allBlocks\n })\n\n bm.add('comp_image', {\n label: c.comp_image.label,\n attributes: { class:'gjs-fonts gjs-f-image' },\n content: {\n style: {color: 'black'},\n type:'image',\n activeOnRender: 1\n },\n ...allBlocks\n })\n\n bm.add('comp_map', {\n label: c.comp_map.label,\n attributes: { class:'fa fa-map-o' },\n content: {\n type: 'map',\n style: { height: '350px' }\n },\n ...allBlocks\n })\n\n bm.add('comp_recaptcha', {\n label: `\n \n

\n
${c.comp_recaptcha.label}
`,\n content: {\n type: 'comp_recaptcha'\n },\n ...allBlocks\n })\n\n bm.add('comp_stripe', {\n label: c.comp_stripe.label,\n attributes: { class:'fa fa-cc-stripe' },\n content: {\n type: 'comp_stripe'\n },\n ...allBlocks\n })\n\n}\n","module.exports = __WEBPACK_EXTERNAL_MODULE_kYSa__;","import $ from 'jquery'\nimport doTemplate from './templating'\nimport grapesjs from 'grapesjs'\n\nexport default grapesjs.plugins.add('grapesjs-components-farmer', (editor, opts = {}) => {\n const commands = editor.Commands\n const pn = editor.Panels\n const opts_comps = opts.comps || {}\n\n const default_comps = {\n 'comp_input': {\n label: 'Input',\n classes: 'form-group',\n useTag: 'div',\n template: `\n \n type=\"<%=it.type_attr%>\" class=\"form-control\" name=\"<%=it.name_attr%>\" placeholder=\"<%=it.placeholder_attr || ''%>\" <%= it.value_attr ? 'value=\"' + it.value_attr + '\"' : '' %>/>\n `\n },\n 'comp_select': {\n label: 'Select',\n classes: 'form-group',\n useTag: 'div',\n template: `\n \n \n `\n },\n 'comp_file': {\n label: 'File',\n classes: 'custom-file',\n useTag: 'div',\n template: `\n type=\"file\" class=\"custom-file-input\" name=\"<%=it.name_attr%>\" placeholder=\"<%=it.placeholder_attr || ''%>\" <%= it.accept_attr ? 'accept=\"' + it.accept_attr + '\"' : '' %> <%= it.value_attr ? 'value=\"' + it.value_attr + '\"' : '' %>/>\n \n `\n },\n 'comp_textarea': {\n label: 'Textarea',\n classes: 'form-group',\n useTag: 'div',\n template: `\n \n \n `\n },\n 'comp_checkbox': {\n label: 'Checkbox',\n classes: 'form-check',\n useTag: 'div',\n template: `\n \n `\n },\n 'comp_hidden': {\n label: 'Hidden Input',\n useTag: 'div',\n template: `\n type=\"hidden\" name=\"<%=it.name_attr%>\" <%= it.value_attr ? 'value=\"' + it.value_attr + '\"' : '' %>/>\n `\n },\n 'comp_submit': {\n label: 'Submit Button',\n classes: 'btn btn-primary btn-block',\n useTag: 'button',\n template: '<%= it.label_attr %>'\n },\n 'comp_row': {\n label: 'Row',\n useTag: 'div',\n classes: 'row'\n },\n 'comp_col': {\n label: 'Column',\n useTag: 'div',\n classes: 'col'\n },\n 'comp_col1': {\n label: '1 Column',\n useTag: 'div',\n },\n 'comp_col2': {\n label: '2 Columns',\n useTag: 'div',\n },\n 'comp_col3': {\n label: '3 Columns',\n useTag: 'div',\n },\n 'comp_text': {\n label: 'Text'\n },\n 'comp_image': {\n label: 'Image'\n },\n 'comp_map': {\n label: 'Map'\n },\n 'comp_recaptcha': {\n label: 'reCaptcha',\n classes: 'form-group',\n template: `\n \n \" data-action=\"<%= it.action_attr || '' %>\" />\n `\n },\n 'comp_stripe': {\n label: 'Payment',\n classes: 'form-group',\n template: `\n \n
\" data-hide-postal=\"<%= it.hidepostal_attr || 'false' %>\"> 
\n `\n }\n }\n\n // provide defaults\n for(let k in default_comps) {\n const x = default_comps[k]\n const y = opts_comps[k]\n if (y) {\n for(let j in y) {\n y[j] = y[j] || x[j]\n }\n opts_comps[k] = y\n } else {\n opts_comps[k] = x\n }\n\n opts_comps[k]['classes'] = (opts_comps[k]['classes'] || '').split(' ')\n }\n\n const options = {\n formNextId: 1,\n categoryLabel: 'Basic',\n formFieldsPrefix: 'field',\n showStylesOnChange: 1,\n addResource: (url, type='script') => {\n\n const doc = editor.Canvas.getDocument()\n const head = doc.head || doc.getElementsByTagName('head')[0]\n const res = document.createElement(type)\n\n if (type === 'script') {\n res.src = url\n }\n else if (type === 'link') {\n res.rel = 'stylesheet'\n res.href = url\n }\n\n head.appendChild(res)\n }, ...opts\n }\n\n options.comps = options.comps || opts_comps\n\n const compileTemplates = () => {\n let doT = null\n\n Object.keys(options.comps).forEach(k => {\n const t = options.comps[k]\n\n if (t && typeof(t.template) === 'string') {\n if (!doT) {\n doT = doTemplate()\n }\n\n t.template = doT.template(t.template)\n }\n })\n }\n\n /** Prevent Input Default Actions **/\n const preventInputDefaults = () => {\n const el = editor.Canvas.getBody()\n const win = el.ownerWindow\n const body = $(el)\n\n body.click((e) => {\n const event = e || win.event\n const target = event.target || event.srcElement\n const tagName = (target.tagName + '').toLowerCase()\n if (tagName === 'input') {\n event.preventDefault()\n return false\n }\n })\n }\n\n editor.runCommand('prevent-default');\n\n commands.add('get-usable-html', {\n run() {\n // get the builder xml\n let html = editor.getHtml()\n\n // convert into html\n for(let k in options.comps) {\n // default tag as div unless useTag value is provided\n const tag = options.comps[k].useTag || 'div'\n html = html.replace(new RegExp('<' + k, 'g'), '<' + tag)\n html = html.replace(new RegExp('', 'g'), '')\n html = html.replace(new RegExp(` data\\-gjs\\-type\\=\\\"${k}\\\" `, 'g'), ' ')\n html = html.replace(new RegExp(' data\\-highlightable\\=\\\"1\\\" ', 'g'), ' ')\n }\n\n return html\n }\n })\n\n // Add plugins\n require('./traits').default(editor, options)\n require('./blocks').default(editor, options)\n\n if (opts.panel) {\n require('./panels').default(editor, options)\n }\n\n editor.on('load', () => {\n compileTemplates()\n\n setTimeout(() => {\n const doc = editor.Canvas.getDocument()\n const head = doc.head || doc.getElementsByTagName('head')[0]\n var css = `\nbody {\n padding: 10px;\n}\n\ncomp_recaptcha,\ncomp_row,\ncomp_col,\ncomp_hidden {\n min-height: 2rem !important;\n}\n\ncomp_row {\n display: block;\n width: 100%;\n margin-left: 15px;\n margin-right: 15px;\n}\n\ncomp_col {\n min-width: 100px;\n}\n\ncomp_hidden, comp_recaptcha, comp_stripe {\n display: block;\n width: 100%;\n min-width: 100%;\n}\n`\n\n const style = doc.createElement('style')\n\n style.type = 'text/css';\n if (style.styleSheet){\n // This is required for IE8 and below.\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(doc.createTextNode(css));\n }\n\n head.appendChild(style);\n preventInputDefaults()\n }, 10)\n })\n})\n","import doT from 'doT'\n\nexport default () => {\n doT.templateSettings = {\n evaluate: /\\<\\%([\\s\\S]+?)\\%\\>/g,\n interpolate: /\\<\\%=([\\s\\S]+?)\\%\\>/g,\n encode: /\\<\\%!([\\s\\S]+?)\\%\\>/g,\n use: /\\<\\%#([\\s\\S]+?)\\%\\>/g,\n define: /\\<\\%##\\s*([\\w\\.$]+)\\s*(\\:|=)([\\s\\S]+?)#\\%\\>/g,\n conditional: /\\<\\%\\?(\\?)?\\s*([\\s\\S]*?)\\s*\\%\\>/g,\n iterate: /\\<\\%~\\s*(?:\\%\\>|([\\s\\S]+?)\\s*\\:\\s*([\\w$]+)\\s*(?:\\:\\s*([\\w$]+))?\\s*\\%\\>)/g,\n varname: 'it',\n strip: true,\n append: true,\n selfcontained: false\n }\n\n return doT\n}\n","module.exports = __WEBPACK_EXTERNAL_MODULE_xeH2__;"],"sourceRoot":""} \ No newline at end of file diff --git a/dist/mix-manifest.json b/dist/mix-manifest.json index 6d595b7..eba08b0 100644 --- a/dist/mix-manifest.json +++ b/dist/mix-manifest.json @@ -1,4 +1,4 @@ { - "/app/index.js": "/app/index.js", - "/app/index.js.map": "/app/index.js.map" + "/index.js": "/index.js?id=0edfcd87c9f4b7b4c7a0", + "/index.js.map": "/index.js.map?id=2c8e31f43da193d562f5" }