UNPKG

@creaditor/newsletter-starterkit

Version:

Creaditor Newsletter Editor - Starterkit for creating beautiful email newsletters

1 lines 5.72 kB
"use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[6069],{46069:(e,t,n)=>{n.r(t),n.d(t,{default:()=>x});const o=e=>{{const{component:t,commands:n,helpers:o}=e,i=t.parent("col");return{select:e=>{let{changeTab:t,tab:n}=e},tabs:e=>{const t=[{text:"video"},{text:"design"},{text:"settings"}];return t.forEach((t=>t.selected=t.selected=t.text===e)),t},layout:e=>{let{tab:o,changeTab:s,tabs:r}=e;return[{type:"input",title:"add_urlAddress_from_media_site",active:()=>"video"===o.text,value:t.props.url||"",onChange:e=>{let t=e.target.value;if(-1!==t.indexOf("youtube.com/shorts/")){const e=t.split("/");e.length>0&&(t=`https://youtu.be/${e[e.length-1]}`)}n.execCommand("url",t)}},{type:"divider",active:()=>"video"===o.text},{type:"input",title:"altText",active:()=>"video"===o.text,value:t.props.alt||"",onChange:e=>{const t=e.target.value;n.execCommand("alt",t)}},{type:"divider",active:()=>"video"===o.text},{type:"checkbox",title:"fullWidthOnMobile",checked:!!t.props.isFullWidthOnMobile,active:()=>"video"===o.text,onChange:e=>{const t=e.target.checked;n.execCommand("isFullWidthOnMobile",t)}},{type:"slider",min:10,title:"size",active:()=>"design"===o.text,max:i?.element?.offsetWidth,value:parseInt(t.props.style.width),onInput:e=>{const t=e.target.value;n.execCommand("style",{width:t+"px"})}},{type:"divider"},{type:"justifyContent",value:i?.props.justify,active:()=>"design"===o.text,onChange:e=>{const t=e.target.value;n.execCommand("justify",t,{find:"col"})}},{type:"justifyContent",title:"alignItems",active:()=>"design"===o.text,value:i?.props.alignItems,onChange:e=>{const t=e.target.value;n.execCommand("alignItems",t,{find:"col"})}},{type:"divider",active:()=>"design"===o.text}]}}}};var i=n(46245);const s=()=>({set:(e,t,n)=>{switch(t){case"url":case"alt":case"fullWidthOnMobile":return e[t]=n,!0;case"style":if("object"==typeof n)return e[t]=(0,i.Z)(e[t],n),n.height&&(e[t].height=n.height),n.width&&(e[t].width=n.width),!0}}});var r=n(46062),l=n.n(r),a=n(32877),c=n.n(a),d=n(96793),u=n.n(d),h=n(17892),p=n.n(h),m=n(11173),v=n.n(m),g=n(47934),y={};y.setAttributes=p(),y.insert=u().bind(null,"head"),y.domAPI=c(),y.insertStyleElement=v();l()(g.Z,y);const A=g.Z&&g.Z.locals?g.Z.locals:void 0;n(23691);var b=n(36351);const f="video";function w(){const e=(0,b.c)(),t="https://api.creaditor.com",n="https://multimedia.sendmsg.co.il/ShowYouTube.aspx?";return{name:f,create:i=>{function r(e,o,i){return o=parseInt(o),i=parseInt(i),new Promise(((s,r)=>{e||console.warn("video link is empty.."),-1!==e.indexOf("youtu.be")&&(e=e.replace("youtu.be/","youtube.com/watch?v=")),-1!==e.indexOf("youtube")?s(function(e,o,i){const s=function(e){if(-1!==e.indexOf("youtube.com/shorts/")){const t=e.split("/");t.length>0&&(e=`https://youtu.be/${t[t.length-1]}`)}const t=e.match(/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/);return t&&11===t[2].length?t[2]:null}(e);if(!s)throw Error();const r=`//www.youtube.com/embed/${s}`,l=r.match(/youtube\.com.*(\?v=|\/embed\/)(.{11})/).pop();return 11!==l.length?(console.error("youtube link is not valid"),null):{img:`${t}/images/video/?code=${l}&width=${o}&height=${i}&type=youtube`,href:`${n}youtube=${s}`,embeded:r,source:e}}(e,o,i)):e.indexOf("vimeo")>-1&&function(e,o,i){const s=e;return new Promise(((r,l)=>{e=e.substr(e.lastIndexOf("/")+1).replace(/\?.*/g,""),r({img:`${t}/images/video/?code=${e}&width=${o}&height=${i}&type=vimeo`,href:`${n}vimeo=${e}`,source:s})}))}(e,o,i).then((e=>{s(e)}))}))}const{createElement:l,compose:a,helpers:c}=i,{arrayToString:d,mergeDiff:u}=c,h=document.createElement("div");h.classList.add(A.root);const p=document.createElement("div");p.classList.add(A.cover);const m=document.createElement("img");return h.append(m,p),l({name:f,id:a.id,template:h,defaultProps:{height:"300px",width:"400px",style:{width:"400px",height:"300px",playing:!1,loop:!1,light:!1,controls:!0,autoPlay:!1,muted:!1,url:"https://www.youtube.com/watch?v=04Or_U9OexU"}},draggable:{group:"element"},droppable:{group:"element"},render:t=>{e.run((()=>{const e=m.getBoundingClientRect();let t,n;e.height&&(t=e.height),e.width&&(n=e.width),t=a.props.style.height||a.props.height||300,n=a.props.style.width||a.props.width||400,r(a.props.url,n,t).then((e=>{m.src=e.img}))}));const n={...a.props.style};delete n.height,u(m,{style:n}),m.width=a.props.style.width,m.style.height="auto",m.height="auto",m.style.maxWidth="100%"},atomElement:m,resizeable:()=>h,handleBar:!0,validator:s(),schema:a.schema,onSelect:e=>{m.classList.add(e)},onDeselect:e=>{m.classList.remove(e)},elementProps:a,remove:()=>{h.remove()},createEditor:o})}}}const x=()=>w()},47934:(e,t,n)=>{n.d(t,{Z:()=>l});var o=n(40272),i=n.n(o),s=n(82609),r=n.n(s)()(i());r.push([e.id,".nAQ8Pvl40Gg_tX3eNv_t {\n position: relative;\n max-width: 100%;\n}\n.rMUr_DOP3ofMhnJ40NJU {\n width: 100%;\n height: 100%;\n left: 0;\n top: 0;\n position: absolute;\n opacity: 0.6;\n}\n\n.nAQ8Pvl40Gg_tX3eNv_t:hover .rMUr_DOP3ofMhnJ40NJU {\n display: block;\n background-color: var(--primary);\n}\n","",{version:3,sources:["webpack://./../video-editor-component-newsletter/lib/style.module.css"],names:[],mappings:"AAAA;EACE,kBAAkB;EAClB,eAAe;AACjB;AACA;EACE,WAAW;EACX,YAAY;EACZ,OAAO;EACP,MAAM;EACN,kBAAkB;EAClB,YAAY;AACd;;AAEA;EACE,cAAc;EACd,gCAAgC;AAClC",sourcesContent:[".root {\n position: relative;\n max-width: 100%;\n}\n.cover {\n width: 100%;\n height: 100%;\n left: 0;\n top: 0;\n position: absolute;\n opacity: 0.6;\n}\n\n.root:hover .cover {\n display: block;\n background-color: var(--primary);\n}\n"],sourceRoot:""}]),r.locals={root:"nAQ8Pvl40Gg_tX3eNv_t",cover:"rMUr_DOP3ofMhnJ40NJU"};const l=r}}]);