@creaditor/newsletter-starterkit 1.0.42 → 1.0.45
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/1260.creaditor.bundle.js +234 -0
- package/dist/1260.creaditor.bundle.js.gz +0 -0
- package/dist/1565.creaditor.bundle.js +2 -2
- package/dist/1565.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/589.creaditor.bundle.js +11 -11
- package/dist/589.creaditor.bundle.js.gz +0 -0
- package/dist/creaditor.bundle.js +112 -134
- 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
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
"use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[1260],{91260(t,e,r){r.r(e),r.d(e,{BlockEditor:()=>h});var o=r(24586),i=r(59929),d=r(86319),n=r(9507),a=r(49937),s=r(83235);const c=JSON.parse('["3g2","3gp","aaf","asf","avchd","avi","drc","flv","m2v","m3u8","m4p","m4v","mkv","mng","mov","mp2","mp4","mpe","mpeg","mpg","mpv","mxf","nsv","ogg","ogv","qt","rm","rmvb","roq","svi","vob","webm","wmv","yuv"]');var p=r(9334),l=r(96374);const g=[{id:"video-background",name:"video",thumb:"https://i.ytimg.com/vi/RhlQvbvMg-0/hqdefault.jpg?sqp=-oaymwEWCKgBEF5IWvKriqkDCQgBFQAAiEIYAQ==&rs=AOn4CLCKBaHlpHj3ghOXWjB2br9kHjPg7w",group:["section-component"],type:"video",preset:{installed:!1,component:"cdtr-background-video",properties:{type:"video",url:"https://www.youtube.com/watch?v=RhlQvbvMg-0",loop:!0,volume:0,controls:0,muted:!0,playing:!0,config:{playerVars:{showinfo:0,controls:0,playsinline:0}},style:{zIndex:0,width:window.innerWidth+500,height:window.innerWidth-560,pointerEvents:"none",transform:"translate(-10%,-0%)"}}}},{id:"images-background",name:"some-images",thumb:"http://demos.creative-tim.com/paper-kit-2/assets/img/antoine-barres.jpg",group:["section-component"],type:"images",preset:{tags:[],installed:!1,type:"images",component:"cdtr-images-preset",properties:{src:"http://demos.creative-tim.com/paper-kit-2/assets/img/antoine-barres.jpg,https://images.pexels.com/photos/1408221/pexels-photo-1408221.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1",style:{backgroundAttachment:"local",backgroundPosition:"center",backgroundRepeat:"no-repeat",backgroundSize:"cover"}}}}];r.e(4217).then(r.bind(r,94217));class h extends i.WF{constructor(t){super(),(0,o.A)(this,"onChangeBakgroundExpanding",t=>{const e=t.target.checked;n.Ay.store().execCommand("expand_image_for_outlook",!e)}),(0,o.A)(this,"getInnerBlocks",()=>{const t=[],e=this.component.parent("section");return e&&e.children.forEach(e=>{const r=d.M.get("components",e);r&&"block"===r.type&&t.push(r)}),t}),this.onChangeWidth=this.onChangeWidth.bind(this),this.getInnerBlocks=this.getInnerBlocks.bind(this),this.isBackgroundImage=!1,this.backgroundVideo="",this.galleryOpened=!1,this.onChangeBakgroundExpanding=this.onChangeBakgroundExpanding.bind(this),this.tabs=[{text:"background"},{text:"design",selected:!0},{text:"settings"}],this.tabName="design",this.maxWidth=0,this.background="",this.padding={topValue:0,bottomValue:0,leftValue:0,rightValue:0},this.margin={topValue:0,bottomValue:0},this.borderStyle="solid",this.borderWidth=0,this.borderColor="#000",this.theme=d.M.get("theme"),this.connectWith=this.connectWith.bind(this),this.cmds={onchangeRadius:t=>{n.Ay.store().execCommand("style",{...t.target.json})},toggleResponsive:t=>{this.noResponsive=!t.target.checked,n.Ay.store().execCommand("noResponsive",this.noResponsive)},onChangeBorderStyle:t=>{this.borderStyle=t.target.borderStyle||"",this.borderWidth=t.target.borderWidth||1,this.borderColor=t.target.borderColor||"#000",this.borderRadius=t.target.borderRadius||0;t.target.json;n.Ay.store().execCommand("style",{borderStyle:this.borderStyle,borderColor:this.borderColor,borderTopWidth:t.target.borderTopWidth||"0px",borderBottomWidth:t.target.borderBottomWidth||"0px",borderLeftWidth:t.target.borderLeftWidth||"0px",borderRightWidth:t.target.borderRightWidth||"0px",borderTopRightRadius:parseInt(t.target.borderTopRightRadius||0)+"px",borderTopLeftRadius:parseInt(t.target.borderTopLeftRadius||0)+"px",borderBottomRightRadius:parseInt(t.target.borderBottomRightRadius||0)+"px",borderBottomLeftRadius:parseInt(t.target.borderBottomLeftRadius||0)+"px",borderRadius:null})},onRemoveBackgroundVideo:()=>{this.backgroundVideo="",this.backgroundInstance={},n.Ay.store().execCommand("background","transparent")},onChangeBackgroundVideo:t=>{const e=t.target.value;let r;if((0,s.A)(e)){const t=g.find(t=>"images"===t.type);t.preset.properties.src=e,r=t.preset}else if(function(t){const e=(/(?:\.([^.]+))?$/.exec(t.toLowerCase())??[])[1]??"";return-1!==c.findIndex(t=>t===e)}(e));else if(function(t){if(t&&t.match(/^(?:https?:\/\/)?(?:m\.|www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))((\w|-){11})(?:\S+)?$/))return!0;return!1}(e)){const t=g.find(t=>"video"===t.type);t.preset.properties.url=e,delete t.preset.properties.videoPath,r=t.preset}r&&(n.Ay.store().execCommand("background",JSON.parse(JSON.stringify(r))),n.Ay.store().execCommand("style",{background:null})),this.backgroundVideo=e},onChangeImage:t=>{const e=t.detail,r=[];Array.isArray(e)?e.forEach(t=>r.push(t.src)):r.push(e.src),this.cmds.onChangeBackgroundVideo({target:{value:r.join(",")}}),this.galleryOpened=!1},onChangeHeight:t=>{const e=t.target.value;n.Ay.store().execCommand("style",{height:e+"%"}),this.height=e},onChangeMargin:t=>{const e=t.target.value,r=t.target.direction;"all"===r?(n.Ay.store().execCommand("style",{marginTop:e+"px",marginBottom:e+"px"}),this.margin={topValue:e,bottomValue:e}):n.Ay.store().execCommand("style",{[(0,p.A)(`margin-${r.toLowerCase()}`)]:e+"px"})},onChangePadding:t=>{const e=t.target.value,r=t.target.direction,o=(0,p.A)(`padding-${r.toLowerCase()}`);"all"===r?(n.Ay.store().execCommand("style",{padding:null,"padding-top":null,"padding-bottom":null,"padding-left":null,"padding-right":null,paddingTop:e+"px",paddingBottom:e+"px",paddingLeft:e+"px",paddingRight:e+"px","padding-right":null,"padding-left":null,"padding-top":null,"padding-bottom":null}),this.padding={topValue:e,bottomValue:e,leftValue:e,rightValue:e}):(n.Ay.store().execCommand("style",{[o]:e+"px",[`padding-${r.toLowerCase()}`]:null}),this.props.style={[o]:e+"px"},this[`padding${r.toLowerCase()}`]=e)},onChangebackground(t){const e=t.target.value;this.background=e;n.Ay.components.forEach(t=>{const r=t.find("text");if(r&&!r.closest("card")){let t=r.tiptap.getAttributes("textStyle").color;if(!t){const e=r.element.querySelector("p,h1,h2,h3,h4,h5,h6");e&&(t=window.getComputedStyle(e).color)}if(t){if("transparent"===t)return;if(!t.includes("var(--")&&!e.includes("var(--")&&"transparent"!==e&&"rgba(0, 0, 0, 0)"!==e&&"rgb(0, 0, 0)"!==e){const o=(0,l.w)(t,e);r.tiptap.chain().selectAll().setColor(o).run()}}}}),n.Ay.store().execCommand("style",{background:e,backgroundColor:null});"web"!==d.M.get("config","channel")&&n.Ay.store().execCommand("background",null)}}}onChangeImageBackgroundProp(t){const e=t.detail,{key:r,value:o}=e;if(this.props.background){const t=JSON.parse(JSON.stringify(this.props.background)),e=t.properties;if(!e.style[r])throw new Error(`${r} is not a valid property`);e.style[r]=o,n.Ay.store().execCommand("background",t)}}connectedCallback(){super.connectedCallback(),this.connectWith(),n.Ay.on("update",this.connectWith)}disconnectedCallback(){super.disconnectedCallback(),n.Ay.off("update",this.connectWith)}onChangeWidth(t){let e=t.target.value;e<500&&(e=500),e>1e3&&(e=1e3);const r=this.getInnerBlocks();n.Ay.store().execCommand2({transactions:[{key:"style",value:{width:e+"px",maxWidth:"100%"}}],update:[...r]}),this.maxWidth=e}connectWith(){const t=n.Ay.components[n.Ay.components.length-1];if(this.component=t,t&&"block"===t.type){this.props=t.props;let{style:e}=this.props;e||(e={}),t.props||(t.props={}),t.props.style||(t.props.style={}),this.expand_image_for_outlook=!!t.props.expand_image_for_outlook,this.boxShadow=t.props.style.boxShadow,this.borderStyle=t.props.style.borderStyle,this.borderWidth=t.props.style.borderWidth,this.borderTopRightRadius=parseInt(t.props.style.borderTopRightRadius),this.borderTopLeftRadius=parseInt(t.props.style.borderTopLeftRadius),this.borderBottomRightRadius=parseInt(t.props.style.borderBottomRightRadius),this.borderBottomLeftRadius=parseInt(t.props.style.borderBottomLeftRadius),this.borderTopWidth=parseInt(t.props.style.borderTopWidth),this.borderBottomWidth=parseInt(t.props.style.borderBottomWidth),this.borderLeftWidth=parseInt(t.props.style.borderLeftWidth),this.borderRightWidth=parseInt(t.props.style.borderRightWidth),this.borderColor=t.props.style.borderColor;const r=t.props.background;if(this.isBackgroundImage="images"===r?.type,this.noResponsive=!!t.props.noResponsive,this.isBackgroundImage){const t=r.properties;this.backgroundAttachment=t.style.backgroundAttachment,this.backgroundPosition=t.style.backgroundPosition,this.backgroundRepeat=t.style.backgroundRepeat,this.backgroundSize=t.style.backgroundSize}this.backgroundInstance=r,this.backgroundVideo=r?.properties?.src||r?.properties?.url||"";const o=t.element,i=window.getComputedStyle(o);this.maxWidth=parseInt(i.width),this.width=parseInt(e.width,10)||this.maxWidth,this.background=e.background||e.backgroundImage||i.backgroundColor,e.backgroundImage&&(this.background=`url(${e.backgroundImage})`),this.padding={topValue:parseInt(i.paddingTop),bottomValue:parseInt(i.paddingBottom),leftValue:parseInt(i.paddingLeft),rightValue:parseInt(i.paddingRight)},this.margin={topValue:parseInt(i.marginTop),bottomValue:parseInt(i.marginBottom)}}}changeTab(t){this.tabName=t.target.value}render(){const t=d.M.get("config","channel");return i.qy`
|
|
2
|
+
<cdtr-editor-tabs .tabs=${this.tabs} @tabChanged=${this.changeTab}>
|
|
3
|
+
<div slot="content">
|
|
4
|
+
${"background"===this.tabName?i.qy` <cdtr-editor-container>
|
|
5
|
+
<cdtr-row justify="space-between">
|
|
6
|
+
<cdtr-col sm="5"
|
|
7
|
+
><paper-button
|
|
8
|
+
class="gallery"
|
|
9
|
+
raised
|
|
10
|
+
@click=${()=>this.galleryOpened=!0}
|
|
11
|
+
><lang-text
|
|
12
|
+
text="openGalleryImage"
|
|
13
|
+
></lang-text></paper-button
|
|
14
|
+
></cdtr-col>
|
|
15
|
+
<cdtr-col sm="5">
|
|
16
|
+
<paper-button
|
|
17
|
+
class="backgrounds"
|
|
18
|
+
raised
|
|
19
|
+
@click=${()=>a.A.dispatch("open_add_menu",{type:"backgrounds",disabledOptions:!0,target:n.Ay.components[0]})}
|
|
20
|
+
><lang-text
|
|
21
|
+
text="backgrounds"
|
|
22
|
+
></lang-text></paper-button
|
|
23
|
+
></cdtr-col>
|
|
24
|
+
</cdtr-row>
|
|
25
|
+
</cdtr-editor-container>
|
|
26
|
+
${this.isBackgroundImage&&"web"===t?i.qy`<cdtr-editor-container>
|
|
27
|
+
<background-editor-plugin
|
|
28
|
+
backgroundAttachment=${this.backgroundAttachment}
|
|
29
|
+
backgroundPosition=${this.backgroundPosition}
|
|
30
|
+
backgroundRepeat=${this.backgroundRepeat}
|
|
31
|
+
backgroundSize=${this.backgroundSize}
|
|
32
|
+
@change=${this.onChangeImageBackgroundProp}
|
|
33
|
+
></background-editor-plugin
|
|
34
|
+
></cdtr-editor-container>`:null}
|
|
35
|
+
<cdtr-editor-container>
|
|
36
|
+
<cdtr-row>
|
|
37
|
+
<cdtr-title
|
|
38
|
+
><lang-text
|
|
39
|
+
text="add_urlAddress_from_media_site"
|
|
40
|
+
></lang-text
|
|
41
|
+
></cdtr-title>
|
|
42
|
+
</cdtr-row>
|
|
43
|
+
<cdtr-row>
|
|
44
|
+
<cdtr-input
|
|
45
|
+
.value="${this.backgroundVideo}"
|
|
46
|
+
@input=${this.cmds.onChangeBackgroundVideo}
|
|
47
|
+
style="width:100%;direction:ltr;text-align:left;"
|
|
48
|
+
placeholder="https://"
|
|
49
|
+
></cdtr-input>
|
|
50
|
+
${"object"==typeof this.backgroundInstance&&this.backgroundInstance?.component?i.qy`<paper-button
|
|
51
|
+
style=" font-size: 13px;
|
|
52
|
+
padding: 0;
|
|
53
|
+
text-align: var(--text-align-locale);
|
|
54
|
+
direction: var(--direction-locale);
|
|
55
|
+
justify-content: flex-start;
|
|
56
|
+
color:red;
|
|
57
|
+
margin: 0;"
|
|
58
|
+
@click=${this.cmds.onRemoveBackgroundVideo}
|
|
59
|
+
><lang-text text="remove_background_movie"></lang-text
|
|
60
|
+
></paper-button>`:null}
|
|
61
|
+
</cdtr-row>
|
|
62
|
+
</cdtr-editor-container>
|
|
63
|
+
<cdtr-divider></cdtr-divider>
|
|
64
|
+
<cdtr-editor-container>
|
|
65
|
+
<cdtr-colorpicker-editor
|
|
66
|
+
.hasAlpha=${"web"===t}
|
|
67
|
+
@change=${this.cmds.onChangebackground}
|
|
68
|
+
.value=${this.background}
|
|
69
|
+
text="backgroundColor"
|
|
70
|
+
></cdtr-colorpicker-editor>
|
|
71
|
+
</cdtr-editor-container>
|
|
72
|
+
<cdtr-divider></cdtr-divider>
|
|
73
|
+
<cdtr-editor-container>
|
|
74
|
+
<cdtr-checkbox
|
|
75
|
+
@change=${t=>this.onChangeBakgroundExpanding(t)}
|
|
76
|
+
.checked=${this.expand_image_for_outlook}
|
|
77
|
+
>
|
|
78
|
+
<cdtr-title
|
|
79
|
+
><lang-text text="expand_image_for_outlook"></lang-text
|
|
80
|
+
></cdtr-title>
|
|
81
|
+
</cdtr-checkbox>
|
|
82
|
+
<h6>
|
|
83
|
+
<lang-text
|
|
84
|
+
whiteSpace="break-spaces"
|
|
85
|
+
text="expand_image_for_outlook_description"
|
|
86
|
+
></lang-text>
|
|
87
|
+
</h6>
|
|
88
|
+
</cdtr-editor-container>
|
|
89
|
+
<cdtr-divider></cdtr-divider>`:null}
|
|
90
|
+
${"design"===this.tabName?i.qy`
|
|
91
|
+
<cdtr-editor-container>
|
|
92
|
+
<cdtr-colorpicker-editor
|
|
93
|
+
.hasAlpha=${!1}
|
|
94
|
+
@change=${this.cmds.onChangebackground}
|
|
95
|
+
.value=${this.background}
|
|
96
|
+
text="backgroundColor"
|
|
97
|
+
></cdtr-colorpicker-editor>
|
|
98
|
+
</cdtr-editor-container>
|
|
99
|
+
<cdtr-editor-container>
|
|
100
|
+
<cdtr-width-editor
|
|
101
|
+
text="width"
|
|
102
|
+
unit="px"
|
|
103
|
+
max="1000"
|
|
104
|
+
min="500"
|
|
105
|
+
.value="${this.width}"
|
|
106
|
+
@input=${this.onChangeWidth}
|
|
107
|
+
.sizes=${[{name:d.M.get("lang","recommended")||"recommended",value:600,default:!0},{name:d.M.get("lang","large")||"large",value:1e3}]}
|
|
108
|
+
></cdtr-width-editor>
|
|
109
|
+
<p style="font-size:12px">
|
|
110
|
+
<lang-text whiteSpace="" text="email_600"></lang-text>
|
|
111
|
+
</p>
|
|
112
|
+
</cdtr-editor-container>
|
|
113
|
+
<cdtr-divider></cdtr-divider>
|
|
114
|
+
<cdtr-editor-container>
|
|
115
|
+
<cdtr-row justify="center">
|
|
116
|
+
<cdtr-col sm="12"
|
|
117
|
+
><cdtr-title style="display:block" class="align-lang"
|
|
118
|
+
><lang-text text="padding"></lang-text></cdtr-title
|
|
119
|
+
></cdtr-col>
|
|
120
|
+
<cdtr-col sm="6"
|
|
121
|
+
><cdtr-spacing
|
|
122
|
+
.topValue="${this.padding.topValue}"
|
|
123
|
+
.bottomValue="${this.padding.bottomValue}"
|
|
124
|
+
.leftValue="${this.padding.leftValue}"
|
|
125
|
+
.rightValue="${this.padding.rightValue}"
|
|
126
|
+
isLock=${!1}
|
|
127
|
+
max="500"
|
|
128
|
+
@input=${this.cmds.onChangePadding}
|
|
129
|
+
></cdtr-spacing
|
|
130
|
+
></cdtr-col>
|
|
131
|
+
</cdtr-row>
|
|
132
|
+
</cdtr-editor-container>
|
|
133
|
+
|
|
134
|
+
<cdtr-divider></cdtr-divider>
|
|
135
|
+
<cdtr-editor-container>
|
|
136
|
+
<cdtr-row alignItems="center" justify="space-between">
|
|
137
|
+
<cdtr-col>
|
|
138
|
+
<cdtr-title>
|
|
139
|
+
<lang-text text="no_responsive"></lang-text>
|
|
140
|
+
</cdtr-title>
|
|
141
|
+
</cdtr-col>
|
|
142
|
+
<cdtr-col sm="1">
|
|
143
|
+
<cdtr-checkbox
|
|
144
|
+
@change=${this.cmds.toggleResponsive}
|
|
145
|
+
.checked="${this.noResponsive}"
|
|
146
|
+
></cdtr-checkbox>
|
|
147
|
+
</cdtr-col>
|
|
148
|
+
</cdtr-row>
|
|
149
|
+
</cdtr-editor-container>
|
|
150
|
+
<!-- <cdtr-divider></cdtr-divider>
|
|
151
|
+
<cdtr-editor-container>
|
|
152
|
+
<cdtr-radius-editor
|
|
153
|
+
@input=${this.cmds.onchangeRadius}
|
|
154
|
+
></cdtr-radius-editor>
|
|
155
|
+
</cdtr-editor-container> -->
|
|
156
|
+
<cdtr-divider></cdtr-divider>
|
|
157
|
+
|
|
158
|
+
<cdtr-editor-container>
|
|
159
|
+
<cdtr-border-editor
|
|
160
|
+
.borderStyle=${this.borderStyle}
|
|
161
|
+
.borderWidth=${this.borderWidth}
|
|
162
|
+
.borderColor=${this.borderColor}
|
|
163
|
+
.borderTopWidth=${this.borderTopWidth}
|
|
164
|
+
.borderBottomWidth=${this.borderBottomWidth}
|
|
165
|
+
.borderLeftWidth=${this.borderLeftWidth}
|
|
166
|
+
.borderRightWidth=${this.borderRightWidth}
|
|
167
|
+
.borderTopRightRadius=${this.borderTopRightRadius}
|
|
168
|
+
.borderTopLeftRadius=${this.borderTopLeftRadius}
|
|
169
|
+
.borderBottomRightRadius=${this.borderBottomRightRadius}
|
|
170
|
+
.borderBottomLeftRadius=${this.borderBottomLeftRadius}
|
|
171
|
+
@change=${this.cmds.onChangeBorderStyle}
|
|
172
|
+
></cdtr-border-editor>
|
|
173
|
+
</cdtr-editor-container>
|
|
174
|
+
`:null}
|
|
175
|
+
|
|
176
|
+
<!-- ${"typography"===this.tabName?i.qy` <cdtr-text-editor-plugin></cdtr-text-editor-plugin> `:null} -->
|
|
177
|
+
<!-- ${"spacing"===this.tabName?i.qy`
|
|
178
|
+
<cdtr-editor-container>
|
|
179
|
+
<cdtr-row justify="center">
|
|
180
|
+
<cdtr-col sm="12"
|
|
181
|
+
><cdtr-title style="display:block" class="align-lang"
|
|
182
|
+
><lang-text text="padding"></lang-text></cdtr-title
|
|
183
|
+
></cdtr-col>
|
|
184
|
+
<cdtr-col sm="6"
|
|
185
|
+
><cdtr-spacing
|
|
186
|
+
.topValue="${this.padding.topValue}"
|
|
187
|
+
.bottomValue="${this.padding.bottomValue}"
|
|
188
|
+
.leftValue="${this.padding.leftValue}"
|
|
189
|
+
.rightValue="${this.padding.rightValue}"
|
|
190
|
+
isLock=${!1}
|
|
191
|
+
max="500"
|
|
192
|
+
@input=${this.cmds.onChangePadding}
|
|
193
|
+
></cdtr-spacing
|
|
194
|
+
></cdtr-col>
|
|
195
|
+
</cdtr-row>
|
|
196
|
+
</cdtr-editor-container>
|
|
197
|
+
<cdtr-editor-container>
|
|
198
|
+
<cdtr-row justify="center">
|
|
199
|
+
<cdtr-col sm="12"
|
|
200
|
+
><cdtr-title style="display:block" class="align-lang"
|
|
201
|
+
><lang-text text="margin"></lang-text></cdtr-title
|
|
202
|
+
></cdtr-col>
|
|
203
|
+
<cdtr-col sm="6"
|
|
204
|
+
><cdtr-spacing
|
|
205
|
+
.topValue=${this.margin.topValue}
|
|
206
|
+
.bottomValue=${this.margin.bottomValue}
|
|
207
|
+
isLock=${!1}
|
|
208
|
+
max="500"
|
|
209
|
+
.hasLeft=${!1}
|
|
210
|
+
.hasRight=${!1}
|
|
211
|
+
@input=${this.cmds.onChangeMargin}
|
|
212
|
+
></cdtr-spacing
|
|
213
|
+
></cdtr-col>
|
|
214
|
+
</cdtr-row>
|
|
215
|
+
</cdtr-editor-container>
|
|
216
|
+
`:null} -->
|
|
217
|
+
</div>
|
|
218
|
+
</cdtr-editor-tabs>
|
|
219
|
+
<cdtr-gallery
|
|
220
|
+
.multi=${!0}
|
|
221
|
+
@close=${()=>{this.galleryOpened=!1}}
|
|
222
|
+
.opened=${this.galleryOpened}
|
|
223
|
+
@file=${this.cmds.onChangeImage}
|
|
224
|
+
></cdtr-gallery>
|
|
225
|
+
`}}(0,o.A)(h,"styles",i.AH`
|
|
226
|
+
paper-button.gallery {
|
|
227
|
+
background: var(--primary);
|
|
228
|
+
color: var(--primary-text);
|
|
229
|
+
}
|
|
230
|
+
paper-button.backgrounds {
|
|
231
|
+
background: BLACK;
|
|
232
|
+
color: #fff;
|
|
233
|
+
}
|
|
234
|
+
`),(0,o.A)(h,"properties",{maxWidth:{type:Number},backgroundInstance:{type:Object},padding:{type:Object},margin:{type:Object},tabs:{type:Array},tabName:{type:String},galleryOpened:{type:Boolean},backgroundVideo:{type:String,reflect:!0},isBackgroundImage:{type:Boolean},backgroundAttachment:{type:String},backgroundPosition:{type:String},backgroundRepeat:{type:String},backgroundSize:{type:String},noResponsive:{type:Boolean},borderStyle:{type:String},borderWidth:{type:Number},borderColor:{type:String},borderTopRightRadius:{type:Number},borderTopLeftRadius:{type:Number},borderBottomRightRadius:{type:Number},borderBottomLeftRadius:{type:Number},borderTopWidth:{type:Number},borderBottomWidth:{type:Number},borderLeftWidth:{type:Number},borderRightWidth:{type:Number}}),customElements.define("block-editor",h)}}]);
|
|
Binary file
|
|
@@ -930,7 +930,7 @@ max-height: 90vh;max-width:500px;"
|
|
|
930
930
|
`:null}
|
|
931
931
|
</cdtr-row>
|
|
932
932
|
</cdtr-editor-container>
|
|
933
|
-
`;r.e(4217).then(r.bind(r,94217));r(45888);Promise.resolve().then(r.bind(r,58691));class xt extends o.WF{constructor(){super(),this.editor={},this.tabName="",this.factory=this.factory.bind(this),this.execCommandWrapper=this.execCommandWrapper.bind(this),this.connectWith=this.connectWith.bind(this),this.changeTab=this.changeTab.bind(this),this.$select=this.$select.bind(this),this.$update=this.$update.bind(this),this.handleJustifyContent=this.handleJustifyContent.bind(this),this.handleAlignItems=this.handleAlignItems.bind(this)}$select(){this.editor&&this.editor.select&&this.editor.select({changeTab:this.changeTab,tab:this.tabName}),this.connectWith("select")}$update(){this.connectWith("update")}connectedCallback(){super.connectedCallback(),d.Ay.on("update",this.$update),d.Ay.on("select",this.$select),this.connectWith("load")}disconnectedCallback(){super.disconnectedCallback(),d.Ay.off("update",this.$update),d.Ay.off("select",this.$select)}connectWith(){const t=new UIEvent(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"update",{view:window,bubbles:!0,cancelable:!0});this.dispatchEvent(t);const e=d.Ay.components.find(t=>t.type===this.type);e&&(this.component={...e},this.props=e.props,this.editor=e.createEditor(this.commandsBuilder()))}factory(t,e){if("function"==typeof t&&(t=t()),t.debug,"boolean"==typeof t.active&&!t.active)return null;if("function"==typeof t.active){if(!1===t.active())return null}
|
|
933
|
+
`;r.e(4217).then(r.bind(r,94217));r(45888);Promise.resolve().then(r.bind(r,58691));class xt extends o.WF{constructor(){super(),this.editor={},this.tabName="",this.factory=this.factory.bind(this),this.execCommandWrapper=this.execCommandWrapper.bind(this),this.connectWith=this.connectWith.bind(this),this.changeTab=this.changeTab.bind(this),this.$select=this.$select.bind(this),this.$update=this.$update.bind(this),this.handleJustifyContent=this.handleJustifyContent.bind(this),this.handleAlignItems=this.handleAlignItems.bind(this)}$select(){this.editor&&this.editor.select&&this.editor.select({changeTab:this.changeTab,tab:this.tabName}),this.connectWith("select")}$update(){this.connectWith("update")}connectedCallback(){super.connectedCallback(),d.Ay.on("update",this.$update),d.Ay.on("select",this.$select),this.connectWith("load")}disconnectedCallback(){super.disconnectedCallback(),d.Ay.off("update",this.$update),d.Ay.off("select",this.$select)}connectWith(){const t=new UIEvent(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"update",{view:window,bubbles:!0,cancelable:!0});this.dispatchEvent(t);const e=d.Ay.components.find(t=>t.type===this.type);e&&(this.component={...e},this.props=e.props,this.editor=e.createEditor(this.commandsBuilder()))}factory(t,e){if("function"==typeof t&&(t=t()),t.debug,"boolean"==typeof t.active&&!t.active)return null;if("function"==typeof t.active){if(!1===t.active())return null}const r=t.type;switch(r){case"background":return ut(t);case"datetime":return at(t);case"radius":return rt(t);case"justifyContent":case"alignItems":return tt(t,r);case"node":case"lit":case"custom":return t.node();case"button":return ot(t);case"borderpicker":return Q(t);case"linkpicker":return Y(t);case"input":return s(t);case"dropdown":return l(t);case"fontSize":return p(t);case"fontFamily":return c(t);case"mergeTags":return it(t);case"boxShadow":return C(t);case"colorpicker":return H(t);case"slider":return k(t);case"divider":return R(t);case"heading":return S(t);case"option":return V(t);case"checkbox":return q(t);case"stringListBuilder":return E(t);case"chipsInput":return B(t);case"typography":return U(t);case"icons":return o.qy`<icons-gallery
|
|
934
934
|
.selectedIcon=${t.selectedIcon}
|
|
935
935
|
.useIconsApi=${!0===t.useIconsApi}
|
|
936
936
|
.iconColor=${t.iconColor??"000000"}
|
|
@@ -946,7 +946,7 @@ max-height: 90vh;max-width:500px;"
|
|
|
946
946
|
>
|
|
947
947
|
${t.children.map(t=>this.factory(t))}
|
|
948
948
|
</cdtr-accordion-item>`;case"imagePrompt":return document.createElement("cdtr-image-prompt-builder");case"spacingPicker":return gt(t)}}execCommandWrapper(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};r.components=[this.component],d.Ay.store().execCommand(t,e,r)}commandsBuilder(){return{tab:this.tabName,helpers:{Url:j.A,deepMerge:W()},commands:{execCommand:this.execCommandWrapper,injectEditor:i.M.get("injectEditor")}}}changeTab(t){this.tabName=t,this.editor=this.component.createEditor(this.commandsBuilder())}getColElementData(t){const e=t[0]?.closest("col");return e?{colElement:e,justifyValue:e.props.justify,alignItemsValue:e.props.alignItems,colElementRect:e.element.getBoundingClientRect()}:null}shouldShowDesignControls(t,e){const r=t[0]?.element.getBoundingClientRect(),a=t[0]?.type,o=e.find(t=>t.selected)?.text;let i=("design"===o||void 0===o)&&!["root","section","block","row","col"].includes(a);const n=this.getColElementData(t);return n&&n.colElementRect.width===r.width&&(i=!1),i}handleJustifyContent(t){const e=t.target.value,r=d.Ay.getSelectedComponent(),a=r[0]?.closest("col");a&&d.Ay.store().execCommand("justify",e,{find:"col"})}handleAlignItems(t){const e=t.target.value,r=d.Ay.getSelectedComponent(),a=r[0]?.closest("col");a&&d.Ay.store().execCommand("alignItems",e,{find:"col"})}renderJustifyAlignControls(t){return t?o.qy`${tt({value:t.justifyValue,onChange:this.handleJustifyContent})}
|
|
949
|
-
${tt({value:t.alignItemsValue,title:"alignItems",onChange:this.handleAlignItems})}`:null}createRenderRoot(){return this}render(){if(!this.editor)return;const t=d.Ay.getSelectedComponent(),e=this.editor?.tabs(this.tabName),r=this.getColElementData(t),a=this.shouldShowDesignControls(t,e);return o.qy`<cdtr-editor-tabs
|
|
949
|
+
${tt({value:t.alignItemsValue,type:"alignItems",title:"alignItems",onChange:this.handleAlignItems})}`:null}createRenderRoot(){return this}render(){if(!this.editor)return;const t=d.Ay.getSelectedComponent(),e=this.editor?.tabs(this.tabName),r=this.getColElementData(t),a=this.shouldShowDesignControls(t,e);return o.qy`<cdtr-editor-tabs
|
|
950
950
|
.value=${this.tabName}
|
|
951
951
|
@tabChanged=${t=>this.changeTab(t.target.value)}
|
|
952
952
|
.tabs=${e}
|
|
Binary file
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[3521],{83521(t,e,i){i.r(e),i.d(e,{DesignFactory:()=>l});var o=i(24586),r=i(5441),n=i(59929),s=i(9507),d=i(18057),c=i(86319);i.e(8315).then(i.bind(i,68315));class l extends n.WF{constructor(){super(),this.lastEditor=null,c.M.set({injectEditor:t=>{this.injected=!0,this.lastEditor=this.editor,this.backToEditor=this.editor,this.editor=t}}),this.editor=n.qy`<cdtr-ilustration-preference
|
|
2
2
|
width="200px"
|
|
3
3
|
height="200px"
|
|
4
|
-
></cdtr-ilustration-preference>`,this.delayer=new d.A,this.connect=this.connect.bind(this),this.editors={block:{selector:"block-editor",load:()=>i.e(
|
|
4
|
+
></cdtr-ilustration-preference>`,this.delayer=new d.A,this.connect=this.connect.bind(this),this.editors={block:{selector:"block-editor",load:()=>i.e(1260).then(i.bind(i,91260)),component:null},no_editor:{selector:"cdtr-no-component",load:()=>i.e(8854).then(i.bind(i,68854)),component:null,attrs:{style:"margin:auto;display:block;max-width:150px;margin-top:30px;"}}},this.type=null,s.Ay.on("select",this.connect)}connect(t){let{editor:e}=t;if(!e)return;let i=e.type;if("string"!=typeof i)return;if(this.editor?.type===i)return;if(!this.editors[i]){const t=c.M.get("config","editor","configure","plugins");if(Array.isArray(t)){const e=t.find(t=>t.name===i);if(e&&"function"==typeof e.createEditor){this.editor=document.createElement("cdtr-editor-builder"),this.editor.type=i;const t=e.createEditor();return void(t&&(this.editor.editors=t.layout,t!==this.backToEditor&&this.lastEditor&&(this.lastEditor=null)))}}i="no_editor"}this.type=i;const o=(0,r.A)("div",null,(0,r.A)("cdtr-block-loader",null),(0,r.A)("cdtr-title",{style:"text-align:center;"},(0,r.A)("lang-text",{text:"please_wait_downloading_new_version"})));this.editors[i]&&!this.editors[i].component&&(this.editors[i].load().then(()=>{if(o.remove(),this.editors[i].attrs)for(const t in this.editors[i].attrs)if(Object.hasOwnProperty.call(this.editors[i].attrs,t)){const e=this.editors[i].attrs[t];this.editors[i].component[t]=e}}),this.editors[i].component=document.createElement(this.editors[i].selector),this.editors[i].component.appendChild(o)),this.editors[i].component&&(this.editor=this.editors[i].component)}goBack(){this.lastEditor&&(this.editor=this.lastEditor,this.lastEditor=null)}createRenderRoot(){return this}render(){return n.qy` ${this.lastEditor?n.qy` <cdtr-row justify="end">
|
|
5
5
|
<paper-button
|
|
6
6
|
@click=${this.goBack}
|
|
7
7
|
style="margin:.5rem 0;padding:0;min-width:0;direction:var(--direction-locale);"
|
|
Binary file
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
"use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[589],{589(e,t,
|
|
1
|
+
"use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[589],{589(e,t,r){r.d(t,{default:()=>F});var s=r(12106),n=r(59929);let i={};function o(e){i.selected=e}function c(e){return i.selected}const l="https://img.creaditor.ai",a=[{type:"youtube",src:`${l}/icons/serve/Logos/youtube-line.png?width=34&height=34`},{type:"whatsapp",src:`${l}/icons/serve/Logos/whatsapp-line.png?width=34&height=34`},{type:"snapchat",src:`${l}/icons/serve/Logos/snapchat-line.png?width=34&height=34`},{type:"instagram",src:`${l}/icons/serve/Logos/instagram-line.png?width=34&height=34`},{type:"telegram",src:`${l}/icons/serve/Logos/telegram-line.png?width=34&height=34`},{type:"facebook",src:`${l}/icons/serve/Logos/facebook-line.png?width=34&height=34`},{type:"vimeo",src:`${l}/icons/serve/Logos/vimeo-line.png?width=34&height=34`},{type:"x",src:`${l}/icons/serve/Logos/twitter-x-line.png?width=34&height=34`},{type:"linkedin",src:`${l}/icons/serve/Logos/linkedin-box-line.png?width=34&height=34`},{type:"tiktok",src:`${l}/icons/serve/Logos/tiktok-line.png?width=34&height=34`},{type:"reddit",src:`${l}/icons/serve/Logos/reddit-line.png?width=34&height=34`},{type:"twitch",src:`${l}/icons/serve/Logos/twitch-line.png?width=34&height=34`},{type:"messenger",src:`${l}/icons/serve/Logos/messenger-line.png?width=34&height=34`},{type:"pinterest",src:`${l}/icons/serve/Logos/pinterest-line.png?width=34&height=34`},{type:"discord",src:`${l}/icons/serve/Logos/discord-line.png?width=34&height=34`},{type:"skype",src:`${l}/icons/serve/Logos/skype-line.png?width=34&height=34`},{type:"wechat",src:`${l}/icons/serve/Logos/wechat-2-line.png?width=34&height=34`},{type:"email",src:`${l}/icons/serve/Business/mail-line.png?width=34&height=34`},{type:"phone",src:`${l}/icons/serve/Device/phone-line.png?width=34&height=34`},{type:"home",src:`${l}/icons/serve/Buildings/home-line.png?width=34&height=34`},{type:"website",src:`${l}/icons/serve/Map/globe-line.png?width=34&height=34`},{type:"link",src:`${l}/icons/serve/Editor/link.png?width=34&height=34`},{type:"contact",src:`${l}/icons/serve/Business/customer-service-2-line.png?width=34&height=34`},{type:"address",src:`${l}/icons/serve/Map/map-pin-line.png?width=34&height=34`},{type:"send",src:`${l}/icons/serve/Business/send-plane-line.png?width=34&height=34`}],d={twitter:"x","t.co":"x","x.com":"x",youtu:"youtube","youtu.be":"youtube","fb.com":"facebook","fb.me":"facebook","m.me":"messenger","wa.me":"whatsapp","t.me":"telegram","ig.me":"instagram","lnkd.in":"linkedin"};function p(e,t){if(!t||"string"!=typeof t)return;const r=t.toLowerCase().trim();if(r.startsWith("mailto:"))return"email";if(r.startsWith("tel:"))return"phone";try{const s=(r.startsWith("http")?new URL(t):new URL(`https://${t}`)).hostname.replace("www.",""),n=s.split(".")[0];for(const[e,t]of Object.entries(d))if(s.includes(e)||e===s)return t;const i=e.find(e=>{const t=e.type.toLowerCase();return s.includes(t)||t.includes(n)||n.includes(t)});return i?i.type:e.find(e=>r.includes(e.type.toLowerCase()))?.type}catch(t){return e.find(e=>r.includes(e.type.toLowerCase()))?.type}}function h(e){let t=(e||"000000").toString().trim();return t.startsWith("#")&&(t=t.slice(1)),8===t.length&&/^[0-9a-fA-F]+$/.test(t)&&(t=t.slice(0,6)),3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length?t:"000000"}function g(e,t){if(!e||!e.includes("https://img.creaditor.ai"))return e;const r=h(t);try{const t=new URL(e);return t.searchParams.set("color",r),t.toString()}catch(t){const s=e.includes("?")?"&":"?";return`${e}${s}color=${r}`}}function u(e){const t=parseInt(e,16);return[t>>16&255,t>>8&255,255&t]}function m(e){let[t,r,s]=e;const[n,i,o]=[t,r,s].map(e=>{const t=e/255;return t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4)});return.2126*n+.7152*i+.0722*o}function f(e,t){const r=m(u(e)),s=m(u(t));return(Math.max(r,s)+.05)/(Math.min(r,s)+.05)}function y(e){if(!e)return null;const t=e.trim();if("transparent"===t||"initial"===t||"inherit"===t||""===t)return null;if(t.startsWith("#"))return h(t);const r=t.match(/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*([\d.]+)\s*\)/);if(r){if(0===parseFloat(r[4]))return null;const[,e,t,s]=r;return[e,t,s].map(e=>Number(e).toString(16).padStart(2,"0")).join("")}const s=t.match(/rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/);if(s){const[,e,t,r]=s;return[e,t,r].map(e=>Number(e).toString(16).padStart(2,"0")).join("")}return null}function w(e){let t=e?.parentElement;for(;t;){const e=y(t.style?.backgroundColor||t.getAttribute?.("bgcolor")||t.getAttribute?.("data-bgcolor"));if(e)return e;const r=t.ownerDocument?.defaultView?.getComputedStyle?.(t);if(r){const e=y(r.backgroundColor);if(e)return e}t=t.parentElement}return null}function b(e,t){if(!t)return e;const r=h(e);if(!function(e){const t=m(u(e));return t<=.05||t>=.95}(r))return r;if(f(r,t)>=3)return r;const s=f("000000",t);return f("ffffff",t)>=s?"ffffff":"000000"}var v=r(24586);const x="https://img.creaditor.ai";function C(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=t.width??24,s=t.height??24;let n=t.color??"000000";n.startsWith("#")&&(n=n.slice(1));return g(`${x}/icons/serve/${encodeURIComponent(e.category)}/${encodeURIComponent(e.name)}.png?width=${r}&height=${s}`,n)}class k extends n.WF{constructor(){super(),this.searchQuery="",this.iconColor="000000",this.iconSize=34,this.selectedSrc="",this._icons=[],this._loading=!1,this._error=""}willUpdate(e){e.has("searchQuery")&&this.searchQuery?this._fetchIcons():e.has("searchQuery")&&!this.searchQuery&&(this._icons=[],this._error="")}async _fetchIcons(){const e=(this.searchQuery||"").trim();if(e){this._loading=!0,this._error="";try{const t=new URLSearchParams({q:e,limit:"20"}),r=await fetch(`${x}/icons/search?${t.toString()}`);if(!r.ok)throw new Error(r.statusText);const s=await r.json();this._icons=s.icons||[]}catch(e){this._icons=[],this._error=e.message||"Failed to load icons"}finally{this._loading=!1}}else this._icons=[]}_onSelect(e){const t=(this.iconColor||"000000").replace(/^#/,""),r=Number(this.iconSize)||34,s=C(e,{width:r,height:r,color:t});this.dispatchEvent(new CustomEvent("icon-selected",{detail:{src:s,icon:e},bubbles:!0,composed:!0}))}render(){if(!this.searchQuery?.trim())return n.qy``;if(this._loading)return n.qy`<div class="loading"><cdtr-loader></cdtr-loader></div>`;if(this._error)return n.qy`<div class="error">${this._error}</div>`;if(!this._icons.length)return n.qy``;const e=(this.iconColor||"000000").replace(/^#/,"");return n.qy`
|
|
2
2
|
|
|
3
3
|
<div class="grid">
|
|
4
|
-
${this._icons.map(t=>{const
|
|
4
|
+
${this._icons.map(t=>{const r=C(t,{width:24,height:24,color:e}),s=this.selectedSrc&&(this.selectedSrc.includes(t.name)||this.selectedSrc===r);return n.qy`
|
|
5
5
|
<button
|
|
6
6
|
type="button"
|
|
7
|
-
class="icon-wrap ${
|
|
7
|
+
class="icon-wrap ${s?"selected":""}"
|
|
8
8
|
title="${t.name}"
|
|
9
9
|
@click=${()=>this._onSelect(t)}
|
|
10
10
|
>
|
|
11
|
-
<img src="${
|
|
11
|
+
<img src="${r}" alt="${t.name}" loading="lazy" />
|
|
12
12
|
</button>
|
|
13
13
|
`})}
|
|
14
14
|
</div>
|
|
15
|
-
`}}(0,
|
|
15
|
+
`}}(0,v.A)(k,"properties",{searchQuery:{type:String},iconColor:{type:String},iconSize:{type:Number},selectedSrc:{type:String},_icons:{type:Array,state:!0},_loading:{type:Boolean,state:!0},_error:{type:String,state:!0}}),(0,v.A)(k,"styles",n.AH`
|
|
16
16
|
:host {
|
|
17
17
|
display: block;
|
|
18
18
|
font-size: 12px;
|
|
@@ -60,15 +60,15 @@
|
|
|
60
60
|
.error {
|
|
61
61
|
color: var(--error-color, #c00);
|
|
62
62
|
}
|
|
63
|
-
`),customElements.define("social-icon-suggestions",
|
|
63
|
+
`),customElements.define("social-icon-suggestions",k);var A=r(61919);const $=e=>{{const{component:t,commands:r}=e,s=()=>{let e=c();if(e||(e=t.props.items.find(e=>!e.link),!e&&t.props.items.length>0&&(e=t.props.items[0])),e){!t.props.items.find(t=>t.id===e.id)&&t.props.items.length>0&&(e=t.props.items[0])}return e};return{select:e=>{let{changeTab:t,tab:r}=e;"link"!==r&&t("link")},tabs:e=>{e||(e="link");const t=[{text:"image"},{text:"design"},{text:"link",selected:!0}];return t.forEach(t=>t.selected=t.selected=t.text===e),t},layout:e=>{let{tab:i,changeTab:o,tabs:c}=e;const l=s(),d=[{type:"node",node:()=>n.qy`<img
|
|
64
64
|
style="padding:10px;display:block;margin:auto"
|
|
65
65
|
width="52"
|
|
66
66
|
height="52"
|
|
67
|
-
src=${l?.src?
|
|
68
|
-
/>`},{type:"button",text:"delete",bgColor:"#df381d",color:"#fff",icon:"deleteBin",active:!0,onClick:e=>{const
|
|
69
|
-
.searchQuery=${
|
|
67
|
+
src=${l?.src?g(l.src,l.fgColor||l.iconColor):""}
|
|
68
|
+
/>`},{type:"button",text:"delete",bgColor:"#df381d",color:"#fff",icon:"deleteBin",active:!0,onClick:e=>{const n=s();if(!n)return;const i=[...t.props.items];if(i.length<2)return;const o=i.findIndex(e=>e.id===n.id);-1!==o&&(i.splice(o,1),r.execCommand("items",i))}},{type:"divider"},{type:"gallery",active:"image"===i.text,src:l?.src,hasPreview:!0,text:"open_gallery",justify:"flex-start",onChange:e=>{const n=s();if(!n)return;let i=e.detail;Array.isArray(i)&&(i=i[0]);const o=t.props,c=JSON.parse(JSON.stringify(o.items)),l=c.findIndex(e=>e.id===n.id);-1!==l&&(c[l].src=i.src,r.execCommand("items",c))}},{type:"custom",active:()=>{const e=l?.link?.href||l?.url,t=e?p(a,e):null;return("link"===i.text||"image"===i.text)&&!!t},node:()=>{const e=l?.link?.href||l?.url,i=e&&p(a,e)||"";return n.qy`<cdtr-editor-container><social-icon-suggestions
|
|
69
|
+
.searchQuery=${i}
|
|
70
70
|
.iconColor=${l?.fgColor||l?.iconColor||"000000"}
|
|
71
71
|
.iconSize=${parseInt(l?.style?.width,10)||34}
|
|
72
72
|
.selectedSrc=${l?.src||""}
|
|
73
|
-
@icon-selected=${e=>{const
|
|
74
|
-
></social-icon-suggestions></cdtr-editor-container>`}},{type:"divider"},{type:"linkpicker",href:l?.link||l?.url,active:()=>"link"===
|
|
73
|
+
@icon-selected=${e=>{const n=s();if(!n)return;const i=t.props,o=JSON.parse(JSON.stringify(i.items)),c=o.findIndex(e=>e.id===n.id);-1!==c&&(o[c].src=e.detail.src,r.execCommand("items",o))}}
|
|
74
|
+
></social-icon-suggestions></cdtr-editor-container>`}},{type:"divider"},{type:"linkpicker",href:l?.link||l?.url,active:()=>"link"===i.text&&!!l,onChange:e=>{const n=s();if(!n)return;const i=e.target.value,o=t.props,c=JSON.parse(JSON.stringify(o.items)),l=c.findIndex(e=>e.id===n.id);if(-1!==l){const e=c[l].fgColor||c[l].iconColor,t=function(e,t){const r=p(a,e),s=r?a.find(e=>e.type===r):null,n=s?s.src:null;return n?g(n,t):null}(i.href,e);t&&(c[l].src=t),c[l].url=i.href,c[l].link=i,r.execCommand("items",c)}}},{type:"slider",title:"size",active:"design"===i.text,value:parseInt(l?.style?.width),min:10,max:80,onInput:e=>{const s=e.target.value,n=[...t.props.items];n.forEach(e=>{e.style.width=s+"px",e.style.height=s+"px"}),r.execCommand("items",n)}},{type:"colorpicker",title:"icon_color",alpha:!1,active:()=>"design"===i.text&&!!l,value:l?.fgColor?l.fgColor.startsWith("#")?l.fgColor:"#"+l.fgColor:"#000000",onChange:e=>{const n=s();if(!n)return;let i=e.target.value;i=(0,A.A)(i).toHex(),i.startsWith("#")&&(i=i.slice(1)),8===i.length&&/^[0-9a-fA-F]+$/.test(i)&&(i=i.slice(0,6));const o=t.props,c=JSON.parse(JSON.stringify(o.items));if(!0===o.applyColorToAll)c.forEach(e=>{e.fgColor=i});else{const e=c.findIndex(e=>e.id===n.id);-1!==e&&(c[e].fgColor=i)}r.execCommand("items",c)}},{type:"checkbox",title:"color_them_all",checked:!!t.props.applyColorToAll,active:()=>"design"===i.text&&!!l,onChange:e=>{const t=!!e.target.checked;r.execCommand("applyColorToAll",t)}},{type:"divider"},{type:"slider",title:"spacing",active:"design"===i.text,value:parseFloat(t.props.style.gap),min:0,max:80,onInput:e=>{const t=e.target.value;r.execCommand("style",{gap:t+"px"})}}];return d}}}};var _=r(52144);const S=()=>({set:(e,t,r)=>{switch(t){case"style":if("object"==typeof r)return e[t]=(0,_.A)(e[t],r),!0;break;case"items":if(e[t]=r,Array.isArray(r)){const e=c(),t=r.find(t=>t.id===e?.id);t&&o(t)}return!0;case"src":const s=c();if(s&&Array.isArray(e.items)){const t=[...e.items],n=t.findIndex(e=>e.id===s.id);if(-1!==n)return t[n].src=r,e.items=t,!0}break;case"applyColorToAll":return e[t]=r,!0}}});var L=r(72591),I=r.n(L),E=r(88639),N=r.n(E),O=r(88128),T=r.n(O),J=r(30855),B=r.n(J),j=r(93051),q=r.n(j),U=r(89820),W={};W.setAttributes=B(),W.insert=T().bind(null,"head"),W.domAPI=N(),W.insertStyleElement=q();I()(U.A,W);const z=U.A&&U.A.locals?U.A.locals:void 0;var Q=r(23571),R=r(91597);const F=()=>{const e="social";return{name:e,create:t=>{let{createElement:r,compose:n,helpers:i}=t;const l=(0,R.S)(),d=document.createElement("div"),h=document.createElement("div");h.classList.add(z.root);new Q.Ay(h,{sort:!0,delay:0,delayOnTouchOnly:!1,touchStartThreshold:0,disabled:!1,store:null,animation:150,easing:"cubic-bezier(1, 0, 0, 1)",preventOnFilter:!0,draggable:".item",dataIdAttr:"data-id",ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:1,direction:"horizontal",forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,dragoverBubble:!1,removeCloneOnHide:!0,emptyInsertThreshold:5,setData:function(e,t){e.setData("Text",t.textContent)},onChoose:function(e){e.oldIndex},onUnchoose:function(e){},onStart:function(e){e.oldIndex},onEnd:function(e){const t=JSON.parse(JSON.stringify(n.props.items)),{oldIndex:r,newIndex:s}=e,[i]=t.splice(r,1);t.splice(s,0,i),n.editor.store().execCommand("items",t)},onMove:function(e,t){e.dragged,e.draggedRect,e.related,e.relatedRect,e.willInsertAfter,t.clientY},onChange:function(e){e.newIndex}});d.appendChild(h);const u=r({name:e,id:n.id,template:d,draggable:{group:"element"},droppable:{group:"element"},render:()=>{const e=n.props.items;let t=!1;const r=e.map(e=>{const r=e.url||e.link?.link||"";if(!e.src&&r){const s=p(a,r),n=s?a.find(e=>e.type===s):null;if(n)return t=!0,{...e,src:n.src}}return e});t&&setTimeout(()=>n.editor.store().execCommand("items",r),0);const l=t?r:e;for(;h.firstChild;)h.removeChild(h.firstChild);i.mergeDiff(h,{style:n.props.style});const d=c();l.forEach(e=>{const t=document.createElement("img");d?.id===e.id&&t.classList.add(z.selected),t.addEventListener("click",()=>{o(e),Array.from(h.children).forEach(e=>{e.classList.remove(z.selected)}),t.classList.add(z.selected)}),t.classList.add("item"),e.id&&t.setAttribute("data-id",e.id);let r=e.fgColor||e.iconColor;const s=w(h);s&&(r=b(r,s)),t.src=g(e.src,r),i.mergeDiff(t,{style:e.style}),h.append(t)});const u=document.createElement("paper-button");u.style.minWidth="0",u.style.padding=0,u.innerHTML="<cdtr-icon icon='add'></cdtr-icon>",h.append(u),u.addEventListener("click",()=>{setTimeout(()=>{const e=n.props.items[n.props.items.length-1],t={id:(0,s.A)(),fgColor:"",bgColor:"",style:e.style,url:"",src:"https://render.creaditor.ai/media/social-icons/broken-link-black-circle.png"},r=[...n.props.items];r.push(t),o(t),n.editor.store().execCommand("items",r)},200)})},handleBar:!0,defaultProps:{},validator:S(),schema:n.schema,onSelect:e=>{const t=c();if(t){const r=document.querySelector(`[data-id="${t.id}"]`);r?(window.___social_cdtr_item=r,r.classList.add("selected_underlined")):d.classList.add(e)}},onDeselect:e=>{c();window.___social_cdtr_item&&window.___social_cdtr_item.classList.remove("selected_underlined"),d?.classList?.remove(e)},elementProps:n,remove:()=>{d.remove()},createEditor:$});return u.app.on("update",()=>{l.run(()=>{const e=w(h);if(!e)return;const t=h.querySelectorAll("img"),r=n.props.items;t.forEach((t,s)=>{const n=r[s];if(!n)return;let i=n.fgColor||n.iconColor;i=b(i,e),t.src=g(n.src,i)})})}),u}}}},89820(e,t,r){r.d(t,{A:()=>c});var s=r(82001),n=r.n(s),i=r(40935),o=r.n(i)()(n());o.push([e.id,".Z7AEJu5h_9kumGVl3K4x{\n display: flex;\n}\n.UA2xJ_pGYNrGNLfjkExO{\n border:1px solid var(--primary);\n}","",{version:3,sources:["webpack://./../newsletter-editors/social-editor-component-newsletter/lib/style.module.css"],names:[],mappings:"AAAA;IACI,aAAa;AACjB;AACA;IACI,+BAA+B;AACnC",sourcesContent:[".root{\n display: flex;\n}\n.selected{\n border:1px solid var(--primary);\n}"],sourceRoot:""}]),o.locals={root:"Z7AEJu5h_9kumGVl3K4x",selected:"UA2xJ_pGYNrGNLfjkExO"};const c=o}}]);
|
|
Binary file
|