@creaditor/newsletter-starterkit
Version:
Creaditor Newsletter Editor - Starterkit for creating beautiful email newsletters
1 lines • 5.19 kB
JavaScript
;(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[6234],{46234:(e,t,n)=>{n.r(t),n.d(t,{default:()=>x});const a={en:{key:"English",value:"en"},he:{key:"Hebrew",value:"he"},ar:{key:"Arabic",value:"ar"}},o=Object.keys(a).map((e=>a[e])),s=e=>{const{component:t,commands:n,helpers:s,template:i}=e,l=t.parent("col");return{select:e=>{let{changeTab:t,tab:n}=e;"design"!==n.text&&t("design")},tabs:e=>{const t=[{text:"image",selected:!0},{text:"design"},{text:"link"},{text:"settings"}];return t.forEach((t=>t.selected=t.text===e)),t},layout:e=>{let{tab:s,changeTab:i,tabs:r}=e;return[{type:"info",text:"image_micro_copy",active:()=>"image"===s.text},{type:"input",title:"address",active:()=>"image"===s.text,value:t.props.address,onChange:e=>{const t=e.target.value,a={link:{href:`https://www.google.com/maps/place/${t}`}};n.execCommand("address",t),n.execCommand("onClick",a)}},{type:"divider",active:()=>"image"===s.text},{type:"dropdown",title:"type",active:()=>"image"===s.text,selected:a[t.props.lang]?.value,value:a[t.props.lang]?.value,onChange:e=>{const t=e.target.value;n.execCommand("lang",t)},items:o},{type:"divider",active:()=>"image"===s.text},{type:"checkbox",title:"fullWidthOnMobile",checked:!!t.props.isFullWidthOnMobile,active:()=>"image"===s.text,onChange:e=>{const t=e.target.checked;n.execCommand("isFullWidthOnMobile",t)}},{type:"divider"},{type:"slider",title:"size",min:100,max:1e3,active:()=>"design"===s.text,value:parseInt(t.props.style.width),onInput:e=>{const t=e.target.value;n.execCommand("style",{width:t+"px",height:"auto"})}},{type:"divider",active:()=>"design"===s.text},{type:"justifyContent",value:l?.props.justify,active:()=>"design"===s.text,onChange:e=>{const t=e.target.value;n.execCommand("justify",t,{find:"col"})}},{type:"justifyContent",title:"alignItems",active:()=>"design"===s.text,value:l?.props.alignItems,onChange:e=>{const t=e.target.value;n.execCommand("alignItems",t,{find:"col"})}},{type:"linkpicker",href:t.props.onClick?.link?.href,protocol:t.props.onClick?.link?.protocol,target:t.props.onClick?.link?.target,active:()=>"link"===s.text,onChange:e=>{const t={link:e.target.value};n.execCommand("onClick",t)}}]}}};var i=n(46245);const l=()=>({set:(e,t,n)=>{switch(t){case"style":if("object"==typeof n)return e[t]=(0,i.Z)(e[t],n),!0;case"src":case"isFullWidthOnMobile":case"isOpenWithModal":case"isCircle":case"onClick":case"lang":case"onClick":case"address":return e[t]=n,!0}}});var r=n(46062),c=n.n(r),p=n(32877),d=n.n(p),m=n(96793),h=n.n(m),g=n(17892),u=n.n(g),y=n(11173),C=n.n(y),v=n(76113),A={};A.setAttributes=u(),A.insert=h().bind(null,"head"),A.domAPI=d(),A.insertStyleElement=C();c()(v.Z,A);const k=v.Z&&v.Z.locals?v.Z.locals:void 0,x=()=>({name:"map",create:e=>{const{createElement:t,compose:n,helpers:a}=e,o=document.createElement("div");o.classList.add(k.root);const i=document.createElement("img");i.style.maxWidth="100%",i.loading="lazy",o.append(i);const r=t({name:"map",id:n.id,template:o,atomElement:i,resize:e=>{let{width:t,height:n}=e;r.commands.execCommand("style",{width:t+"px"}),i.style.height="auto"},render:()=>{const e=i.getBoundingClientRect().width||parseInt(n.props.style.width);i.width=e,i.height="auto";const t=function(e,t){let{width:n,height:a,lang:o}=t;const s=encodeURIComponent(e);return`https://maps.googleapis.com/maps/api/staticmap?size=${parseInt(n)}x${parseInt(a)}&maptype=roadmap&markers=size:mid%7Ccolor:red%7C${s}&key=AIzaSyBkb9j_nB9VRLWePOW-2vswJkgNsOI-hyo&language=${o}`}(n.props.address,{width:e,height:e,lang:n.props.lang});i.src=t;for(const e in n.props.style)if(Object.hasOwnProperty.call(n.props.style,e)){const t=n.props.style[e];i.style[e]=t}},defaultProps:{style:{height:"200px",width:"400px"},address:"תל אביב"},draggable:{group:"element"},droppable:{group:"element"},resizeable:()=>o,handleBar:!0,validator:l({template:o,helpers:a}),schema:n.schema,onSelect:e=>{o.classList.add(e)},onDeselect:e=>{o.classList.remove(e)},elementProps:n,remove:()=>{o.remove()},createEditor:s});return r}})},76113:(e,t,n)=>{n.d(t,{Z:()=>l});var a=n(40272),o=n.n(a),s=n(82609),i=n.n(s)()(o());i.push([e.id,".ucMT51dBMFFTCzL0soUN {\n position: relative;\n }\n .hjlq5SM_wuDOG3IpPIYH {\n display: none;\n width: 100%;\n height: 100%;\n left: 0;\n top: 0;\n position: absolute;\n background-color: var(--primary);\n opacity: 0.6;\n }\n \n .ucMT51dBMFFTCzL0soUN:hover .hjlq5SM_wuDOG3IpPIYH {\n display: block;\n }\n ","",{version:3,sources:["webpack://./../map-editor-component-newsletter/lib/style.module.css"],names:[],mappings:"AAAA;IACI,kBAAkB;EACpB;EACA;IACE,aAAa;IACb,WAAW;IACX,YAAY;IACZ,OAAO;IACP,MAAM;IACN,kBAAkB;IAClB,gCAAgC;IAChC,YAAY;EACd;;EAEA;IACE,cAAc;EAChB",sourcesContent:[".root {\n position: relative;\n }\n .cover {\n display: none;\n width: 100%;\n height: 100%;\n left: 0;\n top: 0;\n position: absolute;\n background-color: var(--primary);\n opacity: 0.6;\n }\n \n .root:hover .cover {\n display: block;\n }\n "],sourceRoot:""}]),i.locals={root:"ucMT51dBMFFTCzL0soUN",cover:"hjlq5SM_wuDOG3IpPIYH"};const l=i}}]);