@creaditor/newsletter-starterkit 1.0.58 → 1.0.60
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/2765.creaditor.bundle.js +1 -1
- package/dist/2765.creaditor.bundle.js.gz +0 -0
- package/dist/3503.creaditor.bundle.js +1 -0
- package/dist/3503.creaditor.bundle.js.gz +0 -0
- package/dist/3521.creaditor.bundle.js +1 -1
- package/dist/3521.creaditor.bundle.js.gz +0 -0
- package/dist/380.creaditor.bundle.js +7 -5
- package/dist/380.creaditor.bundle.js.gz +0 -0
- package/dist/3847.creaditor.bundle.js +41 -25
- package/dist/3847.creaditor.bundle.js.gz +0 -0
- package/dist/5909.creaditor.bundle.js +63 -21
- package/dist/5909.creaditor.bundle.js.gz +0 -0
- package/dist/763.creaditor.bundle.js +15 -1
- package/dist/763.creaditor.bundle.js.gz +0 -0
- package/dist/8299.creaditor.bundle.js +431 -0
- package/dist/8299.creaditor.bundle.js.gz +0 -0
- package/dist/8547.creaditor.bundle.js +2 -2
- package/dist/8547.creaditor.bundle.js.gz +0 -0
- package/dist/creaditor.bundle.js +1529 -850
- package/dist/creaditor.bundle.js.gz +0 -0
- package/dist/service-worker.js +1 -1
- package/dist/service-worker.js.gz +0 -0
- package/package.json +1 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
"use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[5909],{65909(e,t,i){i.r(t),i.d(t,{NextButton:()=>u});var
|
|
1
|
+
"use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[5909],{65909(e,t,i){i.r(t),i.d(t,{NextButton:()=>g,PUBLISH_ERROR_EVENT:()=>f,PUBLISH_EVENT:()=>u});var s=i(59929),o=i(86319),r=i(93432),n=i(90090),a=i(86959),l=i(15604);const c=`${(0,a.Ay)()?"http://127.0.0.1:8000":"https://studio.creaditor.ai"}/api/seo-generate`;const d=s.qy`
|
|
2
2
|
<svg viewBox="0 0 24 24" fill="currentColor" width="16" height="16" aria-hidden="true">
|
|
3
3
|
<path
|
|
4
4
|
d="M19 9l1.25-2.75L23 5l-2.75-1.25L19 1l-1.25 2.75L15 5l2.75 1.25L19 9zm-7.5.5L9 4 6.5 9.5 1 12l5.5 2.5L9 20l2.5-5.5L17 12l-5.5-2.5zM19 15l-1.25 2.75L15 19l2.75 1.25L19 23l1.25-2.75L23 19l-2.75-1.25L19 15z"
|
|
5
5
|
/>
|
|
6
6
|
</svg>
|
|
7
|
-
`;class
|
|
7
|
+
`;class h extends s.WF{constructor(){super(),this.resolver=null,this.dismiss=()=>{this.isConnected&&this.remove()},this.onCancel=()=>{this.loading||(this.settle(null),this.dismiss())},this.onKeywordKeydown=e=>{"Enter"===e.key||","===e.key?(e.preventDefault(),this.commitDraftKeyword()):"Backspace"===e.key&&""===this.keywordDraft&&this.keywordList.length&&(this.keywordList=this.keywordList.slice(0,-1))},this.generateField=async e=>{if(this.loading||this.generatingField)return;const t=function(){const e=document.getElementById("main-page-wrapper");return(e?.innerText||"").trim()}();if(t){this.generatingField=e;try{const i="rtl"===this.direction?"he":"en",s=await this.requestSeo(e,t,i);if("keywords"===e){const e=(Array.isArray(s)?s:String(s).split(",")).map(e=>e.trim()).filter(Boolean),t=[...this.keywordList];for(const i of e)t.includes(i)||t.push(i);this.keywordList=t}else"title"===e?this.title=String(s).slice(0,100):this.description=String(s).slice(0,255)}catch(e){console.error("[seo-generate] failed:",e),this.snackbar(this.t("seo_generate_failed","Couldn't generate. Please try again."))}finally{this.generatingField=""}}else this.snackbar(this.t("seo_generate_empty","Add some content to the page first."))},this.onPublish=()=>{this.loading||(this.commitDraftKeyword(),this.loading=!0,this.settle({seo:{title:this.title.trim(),description:this.description.trim(),keywords:[...this.keywordList]},busy:e=>{this.isConnected&&(this.loading=e)},done:this.dismiss}))},this.loading=!1,this.title="",this.description="",this.keywordList=[],this.keywordDraft="",this.keywordsFocused=!1,this.generatingField=""}static open(){const e=document.createElement("cdtr-publish-seo"),t=o.M.get("app","seo")||{};return e.title=t.title||"",e.description=t.description||"",e.keywordList=(Array.isArray(t.keywords)?t.keywords:String(t.keywords||"").split(",")).map(e=>String(e).trim()).filter(Boolean),document.body.appendChild(e),e.waitForChoice()}waitForChoice(){return new Promise(e=>{this.resolver=e})}t(e,t){return o.M.get("lang",e)||t}get direction(){const e=o.M.get("theme");return e?.direction||"rtl"}settle(e){this.resolver&&(this.resolver(e),this.resolver=null)}commitDraftKeyword(){const e=this.keywordDraft.split(",").map(e=>e.trim()).filter(Boolean);if(!e.length)return;const t=[...this.keywordList];for(const i of e)t.includes(i)||t.push(i);this.keywordList=t,this.keywordDraft=""}removeKeyword(e){this.keywordList=this.keywordList.filter((t,i)=>i!==e)}snackbar(e){const t=o.M.get("commands");t?.snackbar?.(e)}async requestSeo(e,t,i){const s=async s=>{const o=await async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const t=l.Ay;if("function"==typeof t.studioTokenProvider)try{const i=await t.studioTokenProvider({forceRefresh:e});if("string"==typeof i&&i.length>0)return i}catch{}return"string"==typeof t.studioToken&&t.studioToken.length>0?t.studioToken:null}(s),r={"Content-Type":"application/json",Accept:"application/json"};return o&&(r.Authorization=`Bearer ${o}`),fetch(c,{method:"POST",headers:r,body:JSON.stringify({content:t,field:e,language:i})})};let o=await s(!1);if(401===o.status&&(o=await s(!0)),!o.ok)throw new Error(`HTTP ${o.status}`);const r=await o.json();if(!r.ok||void 0===r.value)throw new Error("bad response");return r.value}magicButton(e){const t=this.generatingField===e;return s.qy`
|
|
8
8
|
<button
|
|
9
9
|
class="magic"
|
|
10
10
|
type="button"
|
|
@@ -13,13 +13,15 @@
|
|
|
13
13
|
?disabled=${this.loading||!!this.generatingField}
|
|
14
14
|
@click=${()=>this.generateField(e)}
|
|
15
15
|
>
|
|
16
|
-
${t?
|
|
16
|
+
${t?s.qy`<span class="mini-spinner"></span>`:d}
|
|
17
17
|
</button>
|
|
18
|
-
`}render(){const e=this.direction;return
|
|
18
|
+
`}render(){const e=this.direction;return s.qy`
|
|
19
19
|
<div class="backdrop" @click=${this.onCancel}></div>
|
|
20
20
|
<div class="card" dir=${e}>
|
|
21
21
|
<h2 class="heading">${this.t("ready_to_publish","Ready to publish")}</h2>
|
|
22
|
-
<p class="subheading"
|
|
22
|
+
<p class="subheading">
|
|
23
|
+
${this.loading?this.t("publishing_your_site","Publishing your site…"):this.t("lets_set_some_seo","Let's set some SEO")}
|
|
24
|
+
</p>
|
|
23
25
|
|
|
24
26
|
<div class="field">
|
|
25
27
|
<div class="label-row">
|
|
@@ -29,6 +31,7 @@
|
|
|
29
31
|
<input
|
|
30
32
|
type="text"
|
|
31
33
|
maxlength=${100}
|
|
34
|
+
?disabled=${this.loading}
|
|
32
35
|
.value=${this.title}
|
|
33
36
|
placeholder=${this.t("seo_title_placeholder","Page name as it will appear in search engines")}
|
|
34
37
|
@input=${e=>this.title=e.target.value}
|
|
@@ -43,6 +46,7 @@
|
|
|
43
46
|
</div>
|
|
44
47
|
<textarea
|
|
45
48
|
maxlength=${255}
|
|
49
|
+
?disabled=${this.loading}
|
|
46
50
|
.value=${this.description}
|
|
47
51
|
placeholder=${this.t("seo_description_placeholder","This description will appear below the site title in search engines")}
|
|
48
52
|
@input=${e=>this.description=e.target.value}
|
|
@@ -59,7 +63,7 @@
|
|
|
59
63
|
class="chips ${this.keywordsFocused?"focused":""}"
|
|
60
64
|
@click=${e=>{const t=e.currentTarget.querySelector("input");t?.focus()}}
|
|
61
65
|
>
|
|
62
|
-
${this.keywordList.map((e,t)=>
|
|
66
|
+
${this.keywordList.map((e,t)=>s.qy`
|
|
63
67
|
<span class="chip">
|
|
64
68
|
${e}
|
|
65
69
|
<button
|
|
@@ -73,6 +77,7 @@
|
|
|
73
77
|
`)}
|
|
74
78
|
<input
|
|
75
79
|
type="text"
|
|
80
|
+
?disabled=${this.loading}
|
|
76
81
|
.value=${this.keywordDraft}
|
|
77
82
|
placeholder=${this.keywordList.length?"":this.t("seo_keywords_placeholder","For example: gift,woman,gift for woman")}
|
|
78
83
|
@input=${e=>this.keywordDraft=e.target.value}
|
|
@@ -85,14 +90,14 @@
|
|
|
85
90
|
|
|
86
91
|
<div class="actions">
|
|
87
92
|
<button class="publish" ?disabled=${this.loading} @click=${this.onPublish}>
|
|
88
|
-
${this.loading?
|
|
93
|
+
${this.loading?s.qy`<span class="spinner"></span>`:this.t("publish","Publish")}
|
|
89
94
|
</button>
|
|
90
95
|
<button class="cancel" ?disabled=${this.loading} @click=${this.onCancel}>
|
|
91
96
|
${this.t("cancel","Cancel")}
|
|
92
97
|
</button>
|
|
93
98
|
</div>
|
|
94
99
|
</div>
|
|
95
|
-
`}}
|
|
100
|
+
`}}h.styles=s.AH`
|
|
96
101
|
:host {
|
|
97
102
|
position: fixed;
|
|
98
103
|
inset: 0;
|
|
@@ -338,22 +343,31 @@
|
|
|
338
343
|
@keyframes spin {
|
|
339
344
|
to { transform: rotate(360deg); }
|
|
340
345
|
}
|
|
341
|
-
`,
|
|
346
|
+
`,h.properties={loading:{type:Boolean},title:{type:String},description:{type:String},keywordList:{type:Array},keywordDraft:{type:String},keywordsFocused:{type:Boolean},generatingField:{type:String}},customElements.define("cdtr-publish-seo",h);class p extends s.WF{constructor(){super(),this.raf=0,this.dismissTimer=null,this.onKeyDown=e=>{"Escape"===e.key&&this.dismiss()},this.dismiss=()=>{this.isConnected&&this.remove()},this.copyLink=async()=>{if(this.url)try{await navigator.clipboard.writeText(this.url),this.copied=!0,setTimeout(()=>this.copied=!1,2e3)}catch{}},this.message="",this.sub="",this.url="",this.seoTitle="",this.seoDescription="",this.copied=!1}connectedCallback(){super.connectedCallback(),document.addEventListener("keydown",this.onKeyDown)}firstUpdated(){this.launchConfetti(),this.dismissTimer=setTimeout(()=>this.dismiss(),6500)}disconnectedCallback(){super.disconnectedCallback(),cancelAnimationFrame(this.raf),this.dismissTimer&&clearTimeout(this.dismissTimer),document.removeEventListener("keydown",this.onKeyDown)}t(e,t){return o.M.get("lang",e)||t}get direction(){const e=o.M.get("theme");return e?.direction||"rtl"}get host(){return this.url?this.url.replace(/^https?:\/\//,"").replace(/\/+$/,""):""}launchConfetti(){const e=this.renderRoot.querySelector("canvas");if(!e)return;const t=e.getContext("2d");if(!t)return;const i=window.devicePixelRatio||1,s=window.innerWidth,o=window.innerHeight;e.width=s*i,e.height=o*i,t.scale(i,i);const r=["#e94560","#1a1a2e","#f6c945","#2ec7a9","#4d7cfe","#ffffff"],n=s/2,a=.42*o,l=Math.min(220,Math.round(s/6)),c=Array.from({length:l},(e,t)=>{const i=2*Math.PI*t/l+t%3*.4,s=4+t%9;return{x:n,y:a,vx:Math.cos(i)*s,vy:Math.sin(i)*s-3,size:5+t%5,color:r[t%r.length],rot:t,vrot:(t%2?1:-1)*(.1+t%5*.03),life:1}}),d=performance.now(),h=e=>{const i=e-d;t.clearRect(0,0,s,o);let r=!1;for(const e of c)e.vy+=.16,e.x+=e.vx,e.y+=e.vy,e.rot+=e.vrot,i>2600*.55&&(e.life=Math.max(0,e.life-.02)),e.life>0&&e.y<o+40&&(r=!0),t.save(),t.globalAlpha=e.life,t.translate(e.x,e.y),t.rotate(e.rot),t.fillStyle=e.color,t.fillRect(-e.size/2,-e.size/2,e.size,.6*e.size),t.restore();r&&i<3e3?this.raf=requestAnimationFrame(h):t.clearRect(0,0,s,o)};this.raf=requestAnimationFrame(h)}renderPreview(){const e=this.host;if(!e)return s.s6;const t=(this.seoTitle||"").trim()||(this.seoDescription?"":e),i=(this.seoDescription||"").trim(),o=(t||e).charAt(0);return s.qy`
|
|
342
347
|
<div class="preview">
|
|
343
348
|
<p class="preview-caption">${this.t("search_preview_label","How your page will look on Google")}</p>
|
|
344
349
|
<div class="result-head">
|
|
345
|
-
<span class="favicon">${
|
|
350
|
+
<span class="favicon">${o}</span>
|
|
346
351
|
<div class="result-url">
|
|
347
352
|
<div class="result-host">${e.split("/")[0]}</div>
|
|
348
353
|
<div class="result-crumb">${e}</div>
|
|
349
354
|
</div>
|
|
350
355
|
</div>
|
|
351
|
-
${t?
|
|
352
|
-
${i?
|
|
356
|
+
${t?s.qy`<p class="result-title">${t}</p>`:s.s6}
|
|
357
|
+
${i?s.qy`<p class="result-desc">${i}</p>`:s.s6}
|
|
353
358
|
</div>
|
|
354
|
-
`}render(){const e=this.direction,t=this.copied?
|
|
359
|
+
`}render(){const e=this.direction,t=this.copied?s.qy`<svg viewBox="0 0 24 24" fill="none"><path d="M5 13l4 4L19 7" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round" /></svg>`:s.qy`<svg viewBox="0 0 24 24" fill="none"><rect x="9" y="9" width="11" height="11" rx="2" stroke="currentColor" stroke-width="2" /><path d="M5 15V5a2 2 0 0 1 2-2h10" stroke="currentColor" stroke-width="2" stroke-linecap="round" /></svg>`;return s.qy`
|
|
355
360
|
<canvas @click=${this.dismiss}></canvas>
|
|
356
361
|
<div class="card" dir=${e}>
|
|
362
|
+
<button
|
|
363
|
+
class="close"
|
|
364
|
+
type="button"
|
|
365
|
+
aria-label=${this.t("close","Close")}
|
|
366
|
+
title=${this.t("close","Close")}
|
|
367
|
+
@click=${this.dismiss}
|
|
368
|
+
>
|
|
369
|
+
<svg viewBox="0 0 24 24" fill="none"><path d="M6 6l12 12M18 6L6 18" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" /></svg>
|
|
370
|
+
</button>
|
|
357
371
|
<div class="check">
|
|
358
372
|
<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
359
373
|
<path d="M5 13l4 4L19 7" stroke="#fff" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" />
|
|
@@ -364,7 +378,7 @@
|
|
|
364
378
|
|
|
365
379
|
${this.renderPreview()}
|
|
366
380
|
|
|
367
|
-
${this.url?
|
|
381
|
+
${this.url?s.qy`
|
|
368
382
|
<div class="actions">
|
|
369
383
|
<a class="view" href=${this.url} target="_blank" rel="noopener">
|
|
370
384
|
<svg viewBox="0 0 24 24" fill="none"><path d="M14 4h6v6M20 4l-9 9M18 13v5a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h5" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" /></svg>
|
|
@@ -375,9 +389,9 @@
|
|
|
375
389
|
${this.copied?this.t("link_copied","Link copied"):this.t("copy_link","Copy link")}
|
|
376
390
|
</button>
|
|
377
391
|
</div>
|
|
378
|
-
`:
|
|
392
|
+
`:s.s6}
|
|
379
393
|
</div>
|
|
380
|
-
`}}
|
|
394
|
+
`}}p.styles=s.AH`
|
|
381
395
|
:host {
|
|
382
396
|
position: fixed;
|
|
383
397
|
inset: 0;
|
|
@@ -415,6 +429,34 @@
|
|
|
415
429
|
transform: translate(-50%, -50%) scale(1);
|
|
416
430
|
}
|
|
417
431
|
}
|
|
432
|
+
/* Manual dismiss. The card also auto-closes, but the confetti + preview
|
|
433
|
+
invite lingering — the user needs a way out on their own terms.
|
|
434
|
+
inset-inline-end so it lands top-left in the RTL card, top-right in LTR. */
|
|
435
|
+
.close {
|
|
436
|
+
position: absolute;
|
|
437
|
+
top: 12px;
|
|
438
|
+
inset-inline-end: 12px;
|
|
439
|
+
width: 32px;
|
|
440
|
+
height: 32px;
|
|
441
|
+
display: flex;
|
|
442
|
+
align-items: center;
|
|
443
|
+
justify-content: center;
|
|
444
|
+
padding: 0;
|
|
445
|
+
border: none;
|
|
446
|
+
border-radius: 50%;
|
|
447
|
+
background: transparent;
|
|
448
|
+
color: #a7abb5;
|
|
449
|
+
cursor: pointer;
|
|
450
|
+
transition: background 0.15s ease, color 0.15s ease;
|
|
451
|
+
}
|
|
452
|
+
.close:hover {
|
|
453
|
+
background: #f1f2f6;
|
|
454
|
+
color: #1a1a2e;
|
|
455
|
+
}
|
|
456
|
+
.close svg {
|
|
457
|
+
width: 16px;
|
|
458
|
+
height: 16px;
|
|
459
|
+
}
|
|
418
460
|
.check {
|
|
419
461
|
width: 68px;
|
|
420
462
|
height: 68px;
|
|
@@ -582,21 +624,21 @@
|
|
|
582
624
|
width: 15px;
|
|
583
625
|
height: 15px;
|
|
584
626
|
}
|
|
585
|
-
`,
|
|
627
|
+
`,p.properties={message:{type:String},sub:{type:String},url:{type:String},seoTitle:{type:String},seoDescription:{type:String},copied:{type:Boolean}},customElements.define("cdtr-publish-success",p);const u="creaditor:publish",f="creaditor:publish-error";class g extends s.WF{constructor(){super(),this.channel="",this.isLoading=!1,this.isLocked=!1,this.lockTimer=null}connectedCallback(){super.connectedCallback(),this.onNextStep||(this.onNextStep=o.M.get("config","onNextStep")),this.onPublish||(this.onPublish=o.M.get("config","onPublish")),this.channel||(this.channel=o.M.get("config","channel")||"")}disconnectedCallback(){super.disconnectedCallback(),this.clearTimers()}clearTimers(){this.lockTimer&&(clearTimeout(this.lockTimer),this.lockTimer=null)}async handleClick(){if(this.isLocked||this.isLoading)return;const e=!!o.M.get("config","access"),t="web"===this.channel,i=e&&t;let s=null;if(t&&(s=await h.open(),!s))return;const a=s?s.seo:null;this.isLoading=!0,this.isLocked=!0,this.lockTimer=setTimeout(()=>{this.clearTimers(),this.isLoading=!1,this.isLocked=!1},1e4);try{if(t&&s){let e=!1;try{i&&a&&(await(0,n.YE)({seo:a}),await(0,n.bK)({})),"function"==typeof this.onPublish?e=await this.runHostPublish(this.onPublish,a,i,s):"function"==typeof this.onNextStep&&await this.onNextStep({toHTML:r.FE,toJSON:r.U2,seo:a??void 0})}finally{s.done()}return void(e||(this.emitPublished(i,a),this.celebratePublish(a)))}"function"==typeof this.onNextStep&&await this.onNextStep({toHTML:r.FE,toJSON:r.U2}),this.emitPublished(i,a)}catch(e){console.error("Error in publish/onNextStep:",e),this.emitPublishError(i,a,e),this.snackbar(o.M.get("lang","publishError")||"Publish failed")}finally{this.clearTimers(),this.isLoading=!1,this.isLocked=!1}}runHostPublish(e,t,i,s){return new Promise(a=>{let l=!1;const c=(e,r,n)=>{l||(l=!0,clearTimeout(d),s.done(),e?(this.celebratePublish(t),this.emitPublished(i,t)):(this.snackbar(n||o.M.get("lang","publishError")||"Publish failed"),this.emitPublishError(i,t,r)),a(!0))},d=setTimeout(()=>{l||(console.warn("config.onPublish never signalled completion — finishing the publish without it. Call success() or error() (or return a promise) so the modal can come down."),l=!0,s.done(),a(!1))},6e4),h={title:t.title,description:t.description,keywords:t.keywords},p={loading:function(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return s.busy(e)},success:()=>c(!0),confetti:()=>c(!0),error:e=>c(!1,new Error(e||"host publish failed"),e),commands:{patchSite:e=>(0,n.YE)(e??{}),publishSite:e=>(0,n.bK)(e??{}),toHTML:r.FE,toJSON:r.U2}};let u;try{u=e(h,p)}catch(e){return console.error("Error in config.onPublish:",e),void c(!1,e)}u&&"function"==typeof u.then&&Promise.resolve(u).then(()=>c(!0),e=>{console.error("Error in config.onPublish:",e),c(!1,e)})})}snackbar(e){const t=o.M.get("commands");t?.snackbar?.(e)}siteUrl(){const e=o.M.get("app","domains"),t=e?.[0]?.name;if(t)return/^https?:\/\//.test(t)?t:`https://${t}`}emitPublished(e,t){const i={channel:this.channel,selfPublish:e,seo:t??void 0,url:this.siteUrl(),toHTML:r.FE,toJSON:r.U2};window.dispatchEvent(new CustomEvent(u,{detail:i}))}emitPublishError(e,t,i){const s={channel:this.channel,selfPublish:e,seo:t??void 0,error:i};window.dispatchEvent(new CustomEvent(f,{detail:s}))}celebratePublish(e){const t=document.createElement("cdtr-publish-success");e&&(t.seoTitle=e.title,t.seoDescription=e.description);const i=this.siteUrl();i&&(t.url=i),document.body.appendChild(t)}render(){const e=!!o.M.get("config","access");if(!(this.onNextStep||"function"==typeof this.onPublish||"web"===this.channel&&e))return null;const t="web"===this.channel?"publish":"next";return s.qy`
|
|
586
628
|
<paper-button
|
|
587
629
|
@click=${this.handleClick}
|
|
588
630
|
class="next-button"
|
|
589
631
|
?disabled=${this.isLocked}
|
|
590
632
|
>
|
|
591
|
-
${this.isLoading?
|
|
633
|
+
${this.isLoading?s.qy`
|
|
592
634
|
<div class="loading-spinner"></div>
|
|
593
|
-
`:
|
|
635
|
+
`:s.qy`
|
|
594
636
|
<div class="button-content ${this.isLoading?"loading":""}">
|
|
595
637
|
<lang-text text=${t}></lang-text>
|
|
596
638
|
</div>
|
|
597
639
|
`}
|
|
598
640
|
</paper-button>
|
|
599
|
-
`}}
|
|
641
|
+
`}}g.styles=s.AH`
|
|
600
642
|
:host {
|
|
601
643
|
display: block;
|
|
602
644
|
}
|
|
@@ -648,4 +690,4 @@
|
|
|
648
690
|
}
|
|
649
691
|
|
|
650
692
|
|
|
651
|
-
`,
|
|
693
|
+
`,g.properties={onNextStep:{type:Function},onPublish:{type:Function},channel:{type:String},isLoading:{type:Boolean},isLocked:{type:Boolean},lockTimer:{type:Number}},customElements.define("cdtr-next-button",g)}}]);
|
|
Binary file
|
|
@@ -31,4 +31,18 @@
|
|
|
31
31
|
`)}
|
|
32
32
|
</div>
|
|
33
33
|
</cdtr-editor-container>
|
|
34
|
-
`}}];return[{type:"heading",level:6,text:"text",active:()=>"style"===a.text},{type:"input",title:"whatTheBtnSays",mergeTags:!0,emoji:!0,active:()=>"style"===a.text,value:t.props.text||"",onInput:e=>{const t=e.target.value;n.execCommand("text",t)}},{type:"heading",level:6,text:"colors",active:()=>"style"===a.text},{type:"colorSwatchGroup",active:()=>"style"===a.text,columns:2,items:[{title:"button_background",allowGradient:!0,value:t.props.style.background||"#000000",onChange:e=>{const r=e.target.value;if(!r.includes("gradient(")){const e=(0,o.w)(t.props.style.color,r);n.execCommand("style",{color:e})}n.execCommand("style",{background:r,backgroundColor:null})}},{title:"font_color",value:t.props.style.color||"#ffffff",onChange:e=>{const t=e.target.value;n.execCommand("style",{color:t})}}]},{type:"heading",level:6,text:"typography",active:()=>"style"===a.text},{type:"typography",active:()=>"style"===a.text,bold:700===t.props.style.fontWeight,italic:"italic"===t.props.style.fontStyle,underline:"underline"===t.props.style.textDecoration,onChange:e=>{switch(e){case"bold":const e=700===t.props.style.fontWeight?400:700;n.execCommand("style",{fontWeight:e});break;case"italic":const o="italic"===t.props.style.fontStyle?"normal":"italic";n.execCommand("style",{fontStyle:o});break;case"underline":const r="underline"===t.props.style.textDecoration?"none":"underline";n.execCommand("style",{textDecoration:r})}}},{type:"fontFamily",active:()=>"style"===a.text,value:t.props.style.fontFamily,weight:"web"===r.M.get("config","channel"),weightValue:t.props.style.fontWeight,onChange:e=>{const t=e.target.value;n.execCommand("style",{fontFamily:t})},onWeightChange:e=>{n.execCommand("style",{fontWeight:e.detail.value})}},{type:"slider",title:"fontSize",step:1,min:8,max:50,active:()=>"style"===a.text,value:parseInt(t.props.style.fontSize)||14,onInput:e=>{const t=e.target.value;n.execCommand("style",{fontSize:t+"px",height:"auto"})}},{type:"heading",level:6,text:"dimensions",active:()=>"style"===a.text},{type:"slider",title:"width",min:10,max:500,active:()=>"style"===a.text,value:parseInt(t.props.style.width),onInput:e=>{const t=e.target.value;n.execCommand("style",{width:t+"px",minWidth:null})}},{type:"heading",level:6,text:"border_design",active:()=>"style"===a.text},{type:"slider",title:"radius",min:0,max:100,active:()=>"style"===a.text,value:parseInt(t.props.style.borderRadius),onInput:e=>{const t=e.target.value;n.execCommand("style",{borderRadius:t+"px"})}},{type:"borderpicker",title:"border",active:()=>"style"===a.text,value:t.props.style.border,onChange:e=>{const t=e.target.value;n.execCommand("style",{border:t})}},{type:"slider",title:"borderWidth",active:()=>"style"===a.text,value:t.props.style.borderWidth,onInput:e=>{const t=e.target.value;n.execCommand("style",{borderWidth:t+"px"})}},{type:"colorpicker",title:"borderColor",active:()=>"style"===a.text,value:t.props.style.borderColor,onChange:e=>{const t=e.target.value;n.execCommand("style",{borderColor:t})}},{type:"heading",level:6,text:"shadow",active:()=>"style"===a.text},{type:"boxShadow",active:()=>"style"===a.text,value:t.props.style.boxShadow,onChange:e=>{n.execCommand("style",{boxShadow:e})}},{type:"heading",level:6,text:"link",active:()=>"interactions"===a.text},{type:"linkpicker",href:t.props.onClick?.link,protocol:t.props.onClick?.link?.protocol,target:t.props.onClick?.link?.target,autofocus:!0,active:()=>"interactions"===a.text,onChange:e=>{const t={link:e.target.value};n.execCommand("onClick",t)}},{type:"heading",level:6,text:"open_modal",active:()=>"interactions"===a.text&&"web"===r.M.get("config","channel")},{type:"info",text:c.length?"modal_pick_hint":"modal_none_hint",active:()=>"interactions"===a.text&&"web"===r.M.get("config","channel")},{type:"dropdown",title:"modal_block",active:()=>"interactions"===a.text&&"web"===r.M.get("config","channel"),value:u,selected:p,items:d,onChange:e=>{n.execCommand("modalBlockId",e.target.value)}},{type:"heading",level:6,text:"icons",active:()=>"style"===a.text},{type:"checkbox",title:"hasIcon",useIconsApi:!0,checked:!!t.props.hasIcon,active:()=>"style"===a.text,onChange:e=>{const t=e.target.checked;n.execCommand("hasIcon",t),n.execCommand("iconDirection","left")}},{type:"dropdown",active:()=>"style"===a.text&&!0===t.props.hasIcon,title:"iconDirection",value:t.props.iconDirection,onChange:e=>{const t=e.target.value;n.execCommand("iconDirection",t)},items:[{value:"left",label:"left"},{value:"right",label:"right"}]},{type:"slider",title:"size",min:10,max:100,active:()=>"style"===a.text&&!0===t.props.hasIcon,value:t.props.iconSize||16,onInput:e=>{const t=e.target.value;n.execCommand("iconSize",t)}},{type:"icons",active:()=>"style"===a.text&&!0===t.props.hasIcon,selectedIcon:t.props.iconUrl,onChange:e=>{const t=e.detail;n.execCommand("iconUrl",t.src)}},{type:"heading",level:6,text:"spacing",active:()=>"style"===a.text},{type:"spacingPicker",active:()=>"style"===a.text,hasLeft:!1,hasRight:!1,value:{top:parseInt(t.props.style.paddingTop)||0,bottom:parseInt(t.props.style.paddingBottom)||0,left:parseInt(t.props.style.paddingLeft)||0,right:parseInt(t.props.style.paddingRight)||0},onChange:e=>{e.target.value;const t=e.target.topValue,o=e.target.bottomValue,r=e.target.leftValue,l=e.target.rightValue;n.execCommand("style",{paddingTop:t+"px",paddingBottom:o+"px",paddingLeft:r+"px",paddingRight:l+"px",padding:null})}},...g]}}}},i=e=>{let{helpers:t,editor:n,getFocused:o}=e;return{set:(e,r,l)=>{switch(r){case"style":return e[r]=t.deepMerge(e[r],l),!0;case"text":return e.text=l,o()||n.chain().setContent(l).run(),!0;case"ripple":case"rippleColor":case"scaleOnHover":case"hasIcon":case"iconUrl":case"iconSize":case"iconDirection":case"modalBlockId":return e[r]=l,!0;case"onClick":if(l.link)return e[r]=l,!0}}}};var s=n(72591),c=n.n(s),d=n(88639),p=n.n(d),u=n(88128),g=n.n(u),m=n(30855),b=n.n(m),h=n(93051),y=n.n(h),x=n(49536),A={};A.setAttributes=b(),A.insert=g().bind(null,"head"),A.domAPI=p(),A.insertStyleElement=y();c()(x.A,A);const f=x.A&&x.A.locals?x.A.locals:void 0;var C=n(81318),v=n(1366);const w=C.bP.create({name:"paragraph",priority:1e3,addOptions:()=>({HTMLAttributes:{}}),group:"block",content:"inline*",parseHTML:()=>[{tag:"p"}],renderHTML({HTMLAttributes:e}){return["p",(0,C.KV)(this.options.HTMLAttributes,e),0]},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}});var k=n(85194),E=n(28396);const B=C.YY.create({addKeyboardShortcuts:()=>({Enter:()=>!0})});const S=()=>{const e="button";return{name:e,create:t=>{const{createElement:n,compose:o,helpers:r}=t,{arrayToString:l,mergeDiff:s}=r;let c=!1;const d=document.createElement("div"),p=document.createElement("div"),{editor:u}=function(e){let{content:t,element:n}=e;return{element:n,editor:new C.KE({element:n,extensions:[v.A,w,E.A,k.Ay,B],content:t})}}({content:o.props.text,element:p});d.appendChild(p);return u.view.dom.setAttribute("dir","auto"),u.on("update",e=>{let{editor:t}=e;const n=t.getText();o.editor.store().updateComponent(o,"text",n)}),u.on("focus",e=>{let{event:t,editor:n}=e;c=!0}),u.on("blur",e=>{let{event:t,editor:n}=e;c=!1}),d.className=f.button,n({name:e,id:o.id,template:d,commands:{insertContent:e=>{u.commands.insertContent(e),u.chain().focus()}},defaultProps:{style:{height:"auto",width:"200px",padding:"10px",borderRadius:"5px",fontFamily:"Arial",fontSize:"16px"},text:"button"},render:()=>{try{o.props.style.display="",o.props.style.direction=""}catch(e){console.error(e)}s(d,{style:o.props.style}),d.style.height="auto";const e=o.props.hasIcon,t=o.props.iconUrl,n=o.props.iconDirection,r=o.props.iconSize,l="icon_in_button";let a=d.querySelector(`.${l}`)||document.createElement("img");e&&t?(a.className=l,a.src=t,a.style.width=(r||16)+"px",a.style.height=(r||16)+"px",a.style.marginRight="8px",a.style.marginLeft="8px","left"===n?d.insertBefore(a,d.firstChild):d.appendChild(a)):a.remove()},draggable:{group:"element"},droppable:{group:"element"},resizeable:()=>d,handleBar:!0,validator:i({template:d,helpers:r,editor:u,getFocused:function(){return c}}),schema:o.schema,onSelect:e=>{d.classList.add(e)},onDeselect:e=>{d.classList.remove(e)},elementProps:o,destroy:()=>{u.destroy()},remove:()=>{d.remove()},createEditor:a})}}}},49536(e,t,n){n.d(t,{A:()=>i});var o=n(82001),r=n.n(o),l=n(40935),a=n.n(l)()(r());a.push([e.id,".BEr8unIfy4OEGYhlHclN {\n cursor: text !important;\n}\n.BEr8unIfy4OEGYhlHclN {\n min-width: 30px;\n display: flex;\n justify-content: center;\n align-items: center;\n text-align: center;\n padding:10px;\n}\n.BEr8unIfy4OEGYhlHclN p {\n margin: 0;\n line-height: 1;\n}\n.cI3RTMAdk9qoZ8mu9Sm9 {\n width: 100%;\n}\n.VSumPf0Ui7b1pl8cMATP {\n position: absolute;\n z-index: 9;\n width: 3px;\n height: 90%;\n background: var(--resizer-color);\n border-radius: 20px;\n}\n.Vo2Ewnq6ekWFdNMjxBIB {\n left: -8px;\n cursor: w-resize;\n}\n.WLZC84sb1rfaRnHCDyj8 {\n left: calc(100% + 5px);\n cursor: e-resize;\n}\n\n.BEr8unIfy4OEGYhlHclN .VSumPf0Ui7b1pl8cMATP {\n display: none;\n}\n.BEr8unIfy4OEGYhlHclN.Qh20ei1Fa8QUbGinFFbw .VSumPf0Ui7b1pl8cMATP {\n display: block;\n}\n/* .handle{\n display: none;\n}\n.button.selected .handle{\n display: block;\n} */\n","",{version:3,sources:["webpack://./../web-editors/button-editor-component/lib/style.module.css"],names:[],mappings:"AAAA;EACE,uBAAuB;AAOzB;AARA;EAEE,eAAe;EACf,aAAa;EACb,uBAAuB;EACvB,mBAAmB;EACnB,kBAAkB;EAClB,YAAY;AACd;AACA;EACE,SAAS;EACT,cAAc;AAChB;AACA;EACE,WAAW;AACb;AACA;EACE,kBAAkB;EAClB,UAAU;EACV,UAAU;EACV,WAAW;EACX,gCAAgC;EAChC,mBAAmB;AACrB;AACA;EACE,UAAU;EACV,gBAAgB;AAClB;AACA;EACE,sBAAsB;EACtB,gBAAgB;AAClB;;AAEA;EACE,aAAa;AACf;AACA;EACE,cAAc;AAChB;AACA;;;;;GAKG",sourcesContent:[".button {\n cursor: text !important;\n min-width: 30px;\n display: flex;\n justify-content: center;\n align-items: center;\n text-align: center;\n padding:10px;\n}\n.button p {\n margin: 0;\n line-height: 1;\n}\n.contentEditable {\n width: 100%;\n}\n.margin {\n position: absolute;\n z-index: 9;\n width: 3px;\n height: 90%;\n background: var(--resizer-color);\n border-radius: 20px;\n}\n.marginLeft {\n left: -8px;\n cursor: w-resize;\n}\n.marginRight {\n left: calc(100% + 5px);\n cursor: e-resize;\n}\n\n.button .margin {\n display: none;\n}\n.button.selected .margin {\n display: block;\n}\n/* .handle{\n display: none;\n}\n.button.selected .handle{\n display: block;\n} */\n"],sourceRoot:""}]),a.locals={button:"BEr8unIfy4OEGYhlHclN",contentEditable:"cI3RTMAdk9qoZ8mu9Sm9",margin:"VSumPf0Ui7b1pl8cMATP",marginLeft:"Vo2Ewnq6ekWFdNMjxBIB",marginRight:"WLZC84sb1rfaRnHCDyj8",selected:"Qh20ei1Fa8QUbGinFFbw"};const i=a}}]);
|
|
34
|
+
`}}];return[{type:"heading",level:6,text:"text",active:()=>"style"===a.text},{type:"input",title:"whatTheBtnSays",mergeTags:!0,emoji:!0,active:()=>"style"===a.text,value:t.props.text||"",onInput:e=>{const t=e.target.value;n.execCommand("text",t)}},{type:"custom",active:()=>"style"===a.text,node:()=>l.qy`
|
|
35
|
+
<cdtr-editor-container pt="0">
|
|
36
|
+
<div style="padding:0 16px;">
|
|
37
|
+
<button
|
|
38
|
+
type="button"
|
|
39
|
+
@click=${()=>i("interactions")}
|
|
40
|
+
style="background:none;border:none;padding:0;cursor:pointer;font-size:11px;line-height:1.4;text-decoration:underline;color:var(--color-primary, #6366f1);"
|
|
41
|
+
>
|
|
42
|
+
<lang-text
|
|
43
|
+
text="${t.props.onClick?.link?"edit_link":"add_link"}"
|
|
44
|
+
></lang-text>
|
|
45
|
+
</button>
|
|
46
|
+
</div>
|
|
47
|
+
</cdtr-editor-container>
|
|
48
|
+
`},{type:"heading",level:6,text:"colors",active:()=>"style"===a.text},{type:"colorSwatchGroup",active:()=>"style"===a.text,columns:2,items:[{title:"button_background",allowGradient:!0,value:t.props.style.background||"#000000",onChange:e=>{const r=e.target.value;if(!r.includes("gradient(")){const e=(0,o.w)(t.props.style.color,r);n.execCommand("style",{color:e})}n.execCommand("style",{background:r,backgroundColor:null})}},{title:"font_color",value:t.props.style.color||"#ffffff",onChange:e=>{const t=e.target.value;n.execCommand("style",{color:t})}}]},{type:"heading",level:6,text:"typography",active:()=>"style"===a.text},{type:"typography",active:()=>"style"===a.text,bold:700===t.props.style.fontWeight,italic:"italic"===t.props.style.fontStyle,underline:"underline"===t.props.style.textDecoration,onChange:e=>{switch(e){case"bold":const e=700===t.props.style.fontWeight?400:700;n.execCommand("style",{fontWeight:e});break;case"italic":const o="italic"===t.props.style.fontStyle?"normal":"italic";n.execCommand("style",{fontStyle:o});break;case"underline":const r="underline"===t.props.style.textDecoration?"none":"underline";n.execCommand("style",{textDecoration:r})}}},{type:"fontFamily",active:()=>"style"===a.text,value:t.props.style.fontFamily,weight:"web"===r.M.get("config","channel"),weightValue:t.props.style.fontWeight,onChange:e=>{const t=e.target.value;n.execCommand("style",{fontFamily:t})},onWeightChange:e=>{n.execCommand("style",{fontWeight:e.detail.value})}},{type:"slider",title:"fontSize",step:1,min:8,max:50,active:()=>"style"===a.text,value:parseInt(t.props.style.fontSize)||14,onInput:e=>{const t=e.target.value;n.execCommand("style",{fontSize:t+"px"})}},{type:"heading",level:6,text:"dimensions",active:()=>"style"===a.text},{type:"slider",title:"width",min:10,max:500,active:()=>"style"===a.text,value:parseInt(t.props.style.width),onInput:e=>{const t=e.target.value;n.execCommand("style",{width:t+"px",minWidth:null})}},{type:"slider",title:"height",min:20,max:300,active:()=>"style"===a.text,value:parseInt(t.props.style.height)||(()=>{const e=document.querySelector(`[data-id="${t.id}"]`);return e&&Math.round(e.getBoundingClientRect().height)||40})(),sizes:[{name:r.M.get("lang","auto")||"auto",value:"auto"}],onInput:e=>{const t=e.target.value;n.execCommand("style",{height:"auto"===t?"auto":parseInt(t)+"px"})}},{type:"heading",level:6,text:"border_design",active:()=>"style"===a.text},{type:"slider",title:"radius",min:0,max:100,active:()=>"style"===a.text,value:parseInt(t.props.style.borderRadius),onInput:e=>{const t=e.target.value;n.execCommand("style",{borderRadius:t+"px"})}},{type:"borderpicker",title:"border",active:()=>"style"===a.text,value:t.props.style.border,onChange:e=>{const t=e.target.value;n.execCommand("style",{border:t})}},{type:"slider",title:"borderWidth",active:()=>"style"===a.text,value:t.props.style.borderWidth,onInput:e=>{const t=e.target.value;n.execCommand("style",{borderWidth:t+"px"})}},{type:"colorpicker",title:"borderColor",active:()=>"style"===a.text,value:t.props.style.borderColor,onChange:e=>{const t=e.target.value;n.execCommand("style",{borderColor:t})}},{type:"heading",level:6,text:"shadow",active:()=>"style"===a.text},{type:"boxShadow",active:()=>"style"===a.text,value:t.props.style.boxShadow,onChange:e=>{n.execCommand("style",{boxShadow:e})}},{type:"heading",level:6,text:"link",active:()=>"interactions"===a.text},{type:"linkpicker",href:t.props.onClick?.link,protocol:t.props.onClick?.link?.protocol,target:t.props.onClick?.link?.target,autofocus:!0,active:()=>"interactions"===a.text,onChange:e=>{const t={link:e.target.value};n.execCommand("onClick",t)}},{type:"heading",level:6,text:"open_modal",active:()=>"interactions"===a.text&&"web"===r.M.get("config","channel")},{type:"info",text:c.length?"modal_pick_hint":"modal_none_hint",active:()=>"interactions"===a.text&&"web"===r.M.get("config","channel")},{type:"dropdown",title:"modal_block",active:()=>"interactions"===a.text&&"web"===r.M.get("config","channel"),value:u,selected:p,items:d,onChange:e=>{n.execCommand("modalBlockId",e.target.value)}},{type:"heading",level:6,text:"icons",active:()=>"style"===a.text},{type:"checkbox",title:"hasIcon",useIconsApi:!0,checked:!!t.props.hasIcon,active:()=>"style"===a.text,onChange:e=>{const t=e.target.checked;n.execCommand("hasIcon",t),n.execCommand("iconDirection","left")}},{type:"dropdown",active:()=>"style"===a.text&&!0===t.props.hasIcon,title:"iconDirection",value:t.props.iconDirection,onChange:e=>{const t=e.target.value;n.execCommand("iconDirection",t)},items:[{value:"left",label:"left"},{value:"right",label:"right"}]},{type:"slider",title:"size",min:10,max:100,active:()=>"style"===a.text&&!0===t.props.hasIcon,value:t.props.iconSize||16,onInput:e=>{const t=e.target.value;n.execCommand("iconSize",t)}},{type:"icons",active:()=>"style"===a.text&&!0===t.props.hasIcon,selectedIcon:t.props.iconUrl,onChange:e=>{const t=e.detail;n.execCommand("iconUrl",t.src)}},{type:"heading",level:6,text:"spacing",active:()=>"style"===a.text},{type:"spacingPicker",active:()=>"style"===a.text,hasLeft:!1,hasRight:!1,value:{top:parseInt(t.props.style.paddingTop)||0,bottom:parseInt(t.props.style.paddingBottom)||0,left:parseInt(t.props.style.paddingLeft)||0,right:parseInt(t.props.style.paddingRight)||0},onChange:e=>{e.target.value;const t=e.target.topValue,o=e.target.bottomValue,r=e.target.leftValue,l=e.target.rightValue;n.execCommand("style",{paddingTop:t+"px",paddingBottom:o+"px",paddingLeft:r+"px",paddingRight:l+"px",padding:null})}},...g]}}}},i=e=>{let{helpers:t,editor:n,getFocused:o}=e;return{set:(e,r,l)=>{switch(r){case"style":return e[r]=t.deepMerge(e[r],l),!0;case"text":return e.text=l,o()||n.chain().setContent(l).run(),!0;case"ripple":case"rippleColor":case"scaleOnHover":case"hasIcon":case"iconUrl":case"iconSize":case"iconDirection":case"modalBlockId":return e[r]=l,!0;case"onClick":if(l.link)return e[r]=l,!0}}}};var s=n(72591),c=n.n(s),d=n(88639),p=n.n(d),u=n(88128),g=n.n(u),m=n(30855),y=n.n(m),h=n(93051),x=n.n(h),b=n(49536),A={};A.setAttributes=y(),A.insert=g().bind(null,"head"),A.domAPI=p(),A.insertStyleElement=x();c()(b.A,A);const f=b.A&&b.A.locals?b.A.locals:void 0;var C=n(81318),v=n(1366);const w=C.bP.create({name:"paragraph",priority:1e3,addOptions:()=>({HTMLAttributes:{}}),group:"block",content:"inline*",parseHTML:()=>[{tag:"p"}],renderHTML({HTMLAttributes:e}){return["p",(0,C.KV)(this.options.HTMLAttributes,e),0]},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}});var k=n(85194),E=n(28396);const B=C.YY.create({addKeyboardShortcuts:()=>({Enter:()=>!0})});const S=()=>{const e="button";return{name:e,create:t=>{const{createElement:n,compose:o,helpers:r}=t,{arrayToString:l,mergeDiff:s}=r;let c=!1;const d=document.createElement("div"),p=document.createElement("div"),{editor:u}=function(e){let{content:t,element:n}=e;return{element:n,editor:new C.KE({element:n,extensions:[v.A,w,E.A,k.Ay,B],content:t})}}({content:o.props.text,element:p});d.appendChild(p);u.view.dom.setAttribute("dir","auto");const g=()=>{let e="";try{e=u.getText()||""}catch(t){e=""}d.setAttribute("dir",function(e){if(!e)return null;for(const t of String(e)){if(/[\u0590-\u05FF\u0600-\u07BF\u0860-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFF]/.test(t))return"rtl";if(/\p{L}/u.test(t))return"ltr"}return null}(e)||"ltr")};return g(),u.on("update",e=>{let{editor:t}=e;const n=t.getText();g(),o.editor.store().updateComponent(o,"text",n)}),u.on("focus",e=>{let{event:t,editor:n}=e;c=!0}),u.on("blur",e=>{let{event:t,editor:n}=e;c=!1}),d.className=f.button,n({name:e,id:o.id,template:d,commands:{insertContent:e=>{u.commands.insertContent(e),u.chain().focus()}},defaultProps:{style:{height:"auto",width:"200px",padding:"10px",borderRadius:"5px",fontFamily:"Arial",fontSize:"16px"},text:"button"},render:()=>{try{o.props.style.display="",o.props.style.direction=""}catch(e){console.error(e)}s(d,{style:o.props.style});const e=o.props.hasIcon,t=o.props.iconUrl,n=o.props.iconDirection,r=o.props.iconSize,l="icon_in_button";g();let a=d.querySelector(`.${l}`)||document.createElement("img");e&&t?(a.className=l,a.src=t,a.style.width=(r||16)+"px",a.style.height=(r||16)+"px",a.style.marginRight="8px",a.style.marginLeft="8px","right"===n?d.appendChild(a):d.insertBefore(a,d.firstChild)):a.remove()},draggable:{group:"element"},droppable:{group:"element"},resizeable:()=>d,resizeAxis:"xy",handleBar:!0,validator:i({template:d,helpers:r,editor:u,getFocused:function(){return c}}),schema:o.schema,onSelect:e=>{d.classList.add(e)},onDeselect:e=>{d.classList.remove(e)},elementProps:o,destroy:()=>{u.destroy()},remove:()=>{d.remove()},createEditor:a})}}}},49536(e,t,n){n.d(t,{A:()=>i});var o=n(82001),r=n.n(o),l=n(40935),a=n.n(l)()(r());a.push([e.id,".BEr8unIfy4OEGYhlHclN {\n cursor: text !important;\n}\n.BEr8unIfy4OEGYhlHclN {\n min-width: 30px;\n display: flex;\n justify-content: center;\n align-items: center;\n text-align: center;\n padding:10px;\n}\n.BEr8unIfy4OEGYhlHclN p {\n margin: 0;\n line-height: 1;\n}\n.cI3RTMAdk9qoZ8mu9Sm9 {\n width: 100%;\n}\n.VSumPf0Ui7b1pl8cMATP {\n position: absolute;\n z-index: 9;\n width: 3px;\n height: 90%;\n background: var(--resizer-color);\n border-radius: 20px;\n}\n.Vo2Ewnq6ekWFdNMjxBIB {\n left: -8px;\n cursor: w-resize;\n}\n.WLZC84sb1rfaRnHCDyj8 {\n left: calc(100% + 5px);\n cursor: e-resize;\n}\n\n.BEr8unIfy4OEGYhlHclN .VSumPf0Ui7b1pl8cMATP {\n display: none;\n}\n.BEr8unIfy4OEGYhlHclN.Qh20ei1Fa8QUbGinFFbw .VSumPf0Ui7b1pl8cMATP {\n display: block;\n}\n/* .handle{\n display: none;\n}\n.button.selected .handle{\n display: block;\n} */\n","",{version:3,sources:["webpack://./../web-editors/button-editor-component/lib/style.module.css"],names:[],mappings:"AAAA;EACE,uBAAuB;AAOzB;AARA;EAEE,eAAe;EACf,aAAa;EACb,uBAAuB;EACvB,mBAAmB;EACnB,kBAAkB;EAClB,YAAY;AACd;AACA;EACE,SAAS;EACT,cAAc;AAChB;AACA;EACE,WAAW;AACb;AACA;EACE,kBAAkB;EAClB,UAAU;EACV,UAAU;EACV,WAAW;EACX,gCAAgC;EAChC,mBAAmB;AACrB;AACA;EACE,UAAU;EACV,gBAAgB;AAClB;AACA;EACE,sBAAsB;EACtB,gBAAgB;AAClB;;AAEA;EACE,aAAa;AACf;AACA;EACE,cAAc;AAChB;AACA;;;;;GAKG",sourcesContent:[".button {\n cursor: text !important;\n min-width: 30px;\n display: flex;\n justify-content: center;\n align-items: center;\n text-align: center;\n padding:10px;\n}\n.button p {\n margin: 0;\n line-height: 1;\n}\n.contentEditable {\n width: 100%;\n}\n.margin {\n position: absolute;\n z-index: 9;\n width: 3px;\n height: 90%;\n background: var(--resizer-color);\n border-radius: 20px;\n}\n.marginLeft {\n left: -8px;\n cursor: w-resize;\n}\n.marginRight {\n left: calc(100% + 5px);\n cursor: e-resize;\n}\n\n.button .margin {\n display: none;\n}\n.button.selected .margin {\n display: block;\n}\n/* .handle{\n display: none;\n}\n.button.selected .handle{\n display: block;\n} */\n"],sourceRoot:""}]),a.locals={button:"BEr8unIfy4OEGYhlHclN",contentEditable:"cI3RTMAdk9qoZ8mu9Sm9",margin:"VSumPf0Ui7b1pl8cMATP",marginLeft:"Vo2Ewnq6ekWFdNMjxBIB",marginRight:"WLZC84sb1rfaRnHCDyj8",selected:"Qh20ei1Fa8QUbGinFFbw"};const i=a}}]);
|
|
Binary file
|