@frontify/guideline-blocks-settings 0.28.3 → 0.28.4
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/CHANGELOG.md +11 -0
- package/dist/components/RichTextEditor/serializer/nodes/button.es.js +3 -2
- package/dist/components/RichTextEditor/serializer/nodes/button.es.js.map +1 -1
- package/dist/components/RichTextEditor/serializer/nodes/checkItemNode.es.js +7 -7
- package/dist/components/RichTextEditor/serializer/nodes/checkItemNode.es.js.map +1 -1
- package/dist/components/RichTextEditor/serializer/nodes/default.es.js +27 -12
- package/dist/components/RichTextEditor/serializer/nodes/default.es.js.map +1 -1
- package/dist/components/RichTextEditor/serializer/nodes/link.es.js +4 -4
- package/dist/components/RichTextEditor/serializer/nodes/link.es.js.map +1 -1
- package/dist/components/RichTextEditor/serializer/serializeNodesToHtmlRecursive.es.js +33 -33
- package/dist/components/RichTextEditor/serializer/serializeNodesToHtmlRecursive.es.js.map +1 -1
- package/dist/index.cjs.js +10 -9
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.umd.js +5 -4
- package/dist/index.umd.js.map +1 -1
- package/package.json +10 -10
- package/src/components/RichTextEditor/serializer/nodes/button.ts +1 -0
- package/src/components/RichTextEditor/serializer/nodes/checkItemNode.ts +3 -3
- package/src/components/RichTextEditor/serializer/nodes/default.ts +27 -12
- package/src/components/RichTextEditor/serializer/nodes/link.ts +2 -2
- package/src/components/RichTextEditor/serializer/serializeNodesToHtmlRecursive.ts +4 -4
package/dist/index.umd.js
CHANGED
|
@@ -3,18 +3,19 @@ ${i.getHotkeyByPlatform("Ctrl+Shift+K")}`:"Buttons can only be set for a single
|
|
|
3
3
|
${i.getHotkeyByPlatform("Ctrl+K")}`:"Links can only be set for a single text block."),icon:a.jsx("span",{className:"tw-p-2 tw-h-8 tw-justify-center tw-items-center tw-flex",children:a.jsx(i.IconLink,{size:i.IconSize.Size16})}),classNames:i.getButtonClassNames(r),styles:{root:{width:"24px",height:"24px"}},actionHandler:"onMouseDown"})})},dr=e=>({...l.useElementProps({...e,elementToAttributes:n=>{var r,s;return{href:n.url||((s=(r=n.chosenLink)==null?void 0:r.searchResult)==null?void 0:s.link)||"",target:n.target||"_blank"}}}),onMouseOver:n=>{n.stopPropagation()}}),ur=e=>{const t=dr(e),{attributes:n,children:r}=e;return a.jsx("a",{...n,href:t.href,target:t.target,style:I[ee],children:r})};class gr extends i.MarkupElement{constructor(t=l.ELEMENT_LINK,n=ur){super(t,n)}}const ht=e=>l.createPluginFactory({...l.createLinkPlugin(),renderAfterEditable:or,options:{isUrl:xe,rangeBeforeOptions:{matchString:" ",skipInvalid:!0,afterMatch:!0},triggerFloatingLinkHotkeys:"command+k, ctrl+k",appBridge:e}})();class mt extends i.Plugin{constructor(t,n=I[ee]){super(ee,{button:cr,markupElement:new gr,...t}),this.styles={},this.styles=n,this.appBridge=t==null?void 0:t.appBridge}plugins(){return[ht(this.appBridge)]}}const hr="textstyle-custom1-plugin";class ft extends i.Plugin{constructor({styles:t=I.custom1,...n}={}){super(v.custom1,{label:"Custom 1",markupElement:new mr,...n}),this.styles={},this.styles=t}plugins(){return[fr(this.styles)]}}class mr extends i.MarkupElement{constructor(t=hr,n=yt){super(t,n)}}const yt=({element:e,attributes:t,children:n,styles:r})=>{const s=e.align;return a.jsx("p",{...t,className:i.merge([s&&i.alignmentClassnames[s],i.getColumnBreakClasses(e),"a-custom1"]),children:a.jsx("span",{style:r,children:n})})},fr=e=>l.createPluginFactory({key:v.custom1,isElement:!0,deserializeHtml:{rules:[{validClassName:v.custom1}]}})({component:t=>a.jsx(yt,{...t,styles:e})}),yr="textstyle-custom2-plugin";class wt extends i.Plugin{constructor({styles:t=I.custom2,...n}={}){super(v.custom2,{label:"Custom 2",markupElement:new wr,...n}),this.styles={},this.styles=t}plugins(){return[br(this.styles)]}}class wr extends i.MarkupElement{constructor(t=yr,n=bt){super(t,n)}}const bt=({element:e,attributes:t,children:n,styles:r})=>{const s=e.align;return a.jsx("p",{...t,className:i.merge([s&&i.alignmentClassnames[s],i.getColumnBreakClasses(e),"a-custom2"]),children:a.jsx("span",{style:r,children:n})})},br=e=>l.createPluginFactory({key:v.custom2,isElement:!0,deserializeHtml:{rules:[{validClassName:v.custom2}]}})({component:t=>a.jsx(bt,{...t,styles:e})}),vr="textstyle-custom3-plugin";class vt extends i.Plugin{constructor({styles:t=I.custom3,...n}={}){super(i.TextStyles.custom3,{label:"Custom 3",markupElement:new pr,...n}),this.styles={},this.styles=t}plugins(){return[kr(this.styles)]}}class pr extends i.MarkupElement{constructor(t=vr,n=pt){super(t,n)}}const pt=({element:e,attributes:t,children:n,styles:r})=>{const s=e.align;return a.jsx("p",{...t,className:i.merge([s&&i.alignmentClassnames[s],i.getColumnBreakClasses(e),"a-custom3"]),children:a.jsx("span",{style:r,children:n})})},kr=e=>l.createPluginFactory({key:i.TextStyles.custom3,isElement:!0,deserializeHtml:{rules:[{validClassName:i.TextStyles.custom3}]}})({component:t=>a.jsx(pt,{...t,styles:e})}),Cr="textstyle-heading1-plugin";class kt extends i.Plugin{constructor({styles:t=I.heading1,...n}={}){super(v.heading1,{label:"Heading 1",markupElement:new xr,...n}),this.styles={},this.styles=t}plugins(){return[Er(this.styles)]}}class xr extends i.MarkupElement{constructor(t=Cr,n=Ne){super(t,n)}}const Ne=({element:e,attributes:t,children:n,styles:r})=>{const s=e.align;return a.jsx("h1",{...t,className:i.merge([s&&i.alignmentClassnames[s],i.getColumnBreakClasses(e),"a-h1"]),children:a.jsx("span",{style:r,children:n})})},Er=e=>l.createPluginFactory({key:v.heading1,isElement:!0,component:Ne,deserializeHtml:{rules:[{validNodeName:["h1","H1"]}]}})({component:t=>a.jsx(Ne,{...t,styles:e})}),Sr="textstyle-heading2-plugin";class Ct extends i.Plugin{constructor({styles:t=I.heading2,...n}={}){super(v.heading2,{label:"Heading 2",markupElement:new Pr,...n}),this.styles={},this.styles=t}plugins(){return[Ir(this.styles)]}}class Pr extends i.MarkupElement{constructor(t=Sr,n=Be){super(t,n)}}const Be=({element:e,attributes:t,children:n,styles:r})=>{const s=e.align;return a.jsx("h2",{...t,className:i.merge([s&&i.alignmentClassnames[s],i.getColumnBreakClasses(e)]),children:a.jsx("span",{style:r,children:n})})},Ir=e=>l.createPluginFactory({key:v.heading2,isElement:!0,component:Be,deserializeHtml:{rules:[{validNodeName:["h2","H2"]}]}})({component:t=>a.jsx(Be,{...t,styles:e})}),Tr="textstyle-heading3-plugin";class xt extends i.Plugin{constructor({styles:t=I.heading3,...n}={}){super(v.heading3,{label:"Heading 3",markupElement:new Lr,...n}),this.styles={},this.styles=t}plugins(){return[Nr(this.styles)]}}class Lr extends i.MarkupElement{constructor(t=Tr,n=Ae){super(t,n)}}const Ae=({element:e,attributes:t,children:n,styles:r})=>{const s=e.align;return a.jsx("h3",{...t,className:i.merge([s&&i.alignmentClassnames[s],i.getColumnBreakClasses(e)]),children:a.jsx("span",{style:r,children:n})})},Nr=e=>l.createPluginFactory({key:v.heading3,isElement:!0,component:Ae,deserializeHtml:{rules:[{validNodeName:["h3","H3"]}]}})({component:t=>a.jsx(Ae,{...t,styles:e})}),Br="textstyle-heading4-plugin";class Et extends i.Plugin{constructor({styles:t=I.heading4,...n}={}){super(v.heading4,{label:"Heading 4",markupElement:new Ar,...n}),this.styles={},this.styles=t}plugins(){return[Mr(this.styles)]}}class Ar extends i.MarkupElement{constructor(t=Br,n=Me){super(t,n)}}const Me=({element:e,attributes:t,children:n,styles:r})=>{const s=e.align;return a.jsx("h4",{...t,className:i.merge([s&&i.alignmentClassnames[s],i.getColumnBreakClasses(e)]),children:a.jsx("span",{style:r,children:n})})},Mr=e=>l.createPluginFactory({key:v.heading4,isElement:!0,component:Me,deserializeHtml:{rules:[{validNodeName:["h4","H4"]}]}})({component:t=>a.jsx(Me,{...t,styles:e})}),Fr="textstyle-imageCaption-plugin";class St extends i.Plugin{constructor({styles:t=I.imageCaption,...n}={}){super(v.imageCaption,{label:"Image Caption",markupElement:new Dr,...n}),this.styles={},this.styles=t}plugins(){return[Or(this.styles)]}}class Dr extends i.MarkupElement{constructor(t=Fr,n=Fe){super(t,n)}}const Fe=({element:e,attributes:t,children:n,styles:r})=>{const s=e.align;return a.jsx("p",{...t,className:i.merge([s&&i.alignmentClassnames[s],i.getColumnBreakClasses(e),"a-image-caption"]),children:a.jsx("span",{style:r,children:n})})},Or=e=>l.createPluginFactory({key:v.imageCaption,isElement:!0,component:Fe,deserializeHtml:{rules:[{validClassName:v.imageCaption}]}})({component:t=>a.jsx(Fe,{...t,styles:e})}),$r="textstyle-imageTitle-plugin";class Pt extends i.Plugin{constructor({styles:t=I.imageTitle,...n}={}){super(v.imageTitle,{label:"Image Title",markupElement:new _r,...n}),this.styles={},this.styles=t}plugins(){return[Hr(this.styles)]}}class _r extends i.MarkupElement{constructor(t=$r,n=De){super(t,n)}}const De=({element:e,attributes:t,children:n,styles:r})=>{const s=e.align;return a.jsx("p",{...t,className:i.merge([s&&i.alignmentClassnames[s],i.getColumnBreakClasses(e),"a-image-title"]),children:a.jsx("span",{style:r,children:n})})},Hr=e=>l.createPluginFactory({key:v.imageTitle,isElement:!0,component:De,deserializeHtml:{rules:[{validClassName:v.imageTitle}]}})({component:t=>a.jsx(De,{...t,styles:e})});class It extends i.Plugin{constructor({styles:t=I.p,...n}={}){super(v.p,{markupElement:new Lt,label:"Body Text",...n}),this.styles={},this.styles=t}plugins(){return[Nt(this.styles)]}}const Tt="tw-m-0 tw-px-0 tw-py-0",we=({element:e,attributes:t,children:n,styles:r})=>{const s=e.align,o=i.merge([s&&i.alignmentClassnames[s],Tt,i.getColumnBreakClasses(e)]);return a.jsx("p",{...t,className:o,style:r,children:n})};class Lt extends i.MarkupElement{constructor(t=v.p,n=we){super(t,n)}}const Nt=e=>l.createPluginFactory({...l.createParagraphPlugin(),key:v.p,isElement:!0,component:we})({component:t=>a.jsx(we,{...t,styles:e})}),Ur="textstyle-quote-plugin";class Bt extends i.Plugin{constructor({styles:t=I.quote,...n}={}){super(v.quote,{label:"Quote",markupElement:new Vr,...n}),this.styles={},this.styles=t}plugins(){return[At(this.styles)]}}class Vr extends i.MarkupElement{constructor(t=Ur,n=be){super(t,n)}}const be=({element:e,attributes:t,children:n,styles:r})=>{const s=e.align;return a.jsx("blockquote",{...t,className:i.merge([s&&i.alignmentClassnames[s],i.getColumnBreakClasses(e),"a-quote"]),children:a.jsx("span",{style:r,children:n})})},At=e=>l.createPluginFactory({key:v.quote,isElement:!0,component:be,deserializeHtml:{rules:[{validNodeName:["blockquote","BLOCKQUOTE"]}]}})({component:t=>a.jsx(be,{...t,styles:e})}),Oe=[new kt,new Ct,new xt,new Et,new ft,new wt,new vt,new Bt,new It],re=[v.heading1,v.heading2,v.heading3,v.heading4,v.custom1,v.custom2,v.custom3,v.quote,v.p],zr=[...Oe,new St,new Pt],qr=[...re,v.imageCaption,v.imageTitle],Wr=e=>{let t=ve(e.text);t=t.replaceAll(`
|
|
4
4
|
`,"<br />");const{bold:n,italic:r,underline:s,strikethrough:o,code:u,subscript:g,superscript:c}=e;return n&&(t=`<span class="${i.BOLD_CLASSES}">${t}</span>`),r&&(t=`<span class="${i.ITALIC_CLASSES}">${t}</span>`),s&&(t=`<span class="${i.UNDERLINE_CLASSES}">${t}</span>`),o&&(t=`<span class="${i.STRIKETHROUGH_CLASSES}">${t}</span>`),u&&(t=`<span class="${i.CODE_CLASSES}">${t}</span>`),g?t=`<sub>${t}</sub>`:c&&(t=`<sup>${t}</sup>`),t},V=e=>e?Object.keys(e).reduce((t,n)=>{const r=e[n];return r?`${t}${jr(n)}: ${r}; `:t},"").trim().replaceAll('"',"'"):"",jr=e=>e.replaceAll(/([A-Z])/g,"-$1").toLowerCase(),Kr=(e,t,n,r)=>{const s=r[Le],o=e.buttonStyle??"primary",u=`button${o.charAt(0).toUpperCase()}${o.slice(1)}`,g=s[u],c=V(g);return`<a href="${e.url}"
|
|
5
5
|
target="${e.target??"_blank"}"
|
|
6
|
+
dir="auto"
|
|
6
7
|
style="${c}"
|
|
7
8
|
class="${n}"
|
|
8
9
|
onmouseenter="this.setAttribute('style', '${c} ${V(g==null?void 0:g.hover)}');"
|
|
9
10
|
onmouseleave="this.setAttribute('style', '${V(g)}');"
|
|
10
|
-
>${t}</a>`},Gr=(e,t,n,r)=>{var s;if(e.chosenLink){const{chosenLink:o}=e;return`<a class="${n}" style="${V(r[ee])}" target=${o!=null&&o.openInNewTab?"_blank":"_self"} href="${ve((s=o==null?void 0:o.searchResult)==null?void 0:s.link)}">${t}</a>`}return`<a class="${n}" style="${V(r[ee])}" target="${(e==null?void 0:e.target)??"_blank"}" href="${ve(e.url)}">${t}</a>`},Xr=(e,t,n,r)=>{const s=V(n);return e.type===v.heading1?`<h1 class="${i.merge([r,"a-h1"])}">${O(t,s)}</h1>`:e.type===v.heading2?`<h2 class="${r}">${O(t,s)}</h2>`:e.type===v.heading3?`<h3 class="${r}">${O(t,s)}</h3>`:e.type===v.heading4?`<h4 class="${r}">${O(t,s)}</h4>`:e.type===v.custom1?`<p class="${i.merge([r,"a-custom1"])}">${O(t,s)}</p>`:e.type===v.custom2?`<p class="${i.merge([r,"a-custom2"])}">${O(t,s)}</p>`:e.type===v.custom3?`<p class="${i.merge([r,"a-custom3"])}">${O(t,s)}</p>`:e.type===v.quote?`<p class="${i.merge([r,"a-quote"])}">${O(t,s)}</p>`:e.type===v.imageTitle?`<p class="${i.merge([r,"a-image-title"])}">${O(t,s)}</p>`:e.type===v.imageCaption?`<p class="${i.merge([r,"a-image-caption"])}">${O(t,s)}</p>`:`<p class="${r}">${O(t,s)}</p>`},O=(e,t)=>`<span style="${t}">${e}</span>`,Qr=(e,t,n,r)=>`<div disabled class="tw-flex tw-flex-row tw-pb-2 first-of-type:tw-ml-0 ${n}" style="margin-left:${(e.indent??0)*24}px;">
|
|
11
|
-
<div class="tw-flex tw-items-center tw-justify-center tw-select-none tw-mr-1.5">
|
|
11
|
+
>${t}</a>`},Gr=(e,t,n,r)=>{var s;if(e.chosenLink){const{chosenLink:o}=e;return`<a dir="auto" class="${n}" style="${V(r[ee])}" target=${o!=null&&o.openInNewTab?"_blank":"_self"} href="${ve((s=o==null?void 0:o.searchResult)==null?void 0:s.link)}">${t}</a>`}return`<a dir="auto" class="${n}" style="${V(r[ee])}" target="${(e==null?void 0:e.target)??"_blank"}" href="${ve(e.url)}">${t}</a>`},Xr=(e,t,n,r)=>{const s=V(n);return e.type===v.heading1?`<h1 dir="auto" class="${i.merge([r,"a-h1"])}">${O(t,s)}</h1>`:e.type===v.heading2?`<h2 dir="auto" class="${r}">${O(t,s)}</h2>`:e.type===v.heading3?`<h3 dir="auto" class="${r}">${O(t,s)}</h3>`:e.type===v.heading4?`<h4 dir="auto" class="${r}">${O(t,s)}</h4>`:e.type===v.custom1?`<p dir="auto" class="${i.merge([r,"a-custom1"])}">${O(t,s)}</p>`:e.type===v.custom2?`<p dir="auto" class="${i.merge([r,"a-custom2"])}">${O(t,s)}</p>`:e.type===v.custom3?`<p dir="auto" class="${i.merge([r,"a-custom3"])}">${O(t,s)}</p>`:e.type===v.quote?`<p dir="auto" class="${i.merge([r,"a-quote"])}">${O(t,s)}</p>`:e.type===v.imageTitle?`<p dir="auto" class="${i.merge([r,"a-image-title"])}">${O(t,s)}</p>`:e.type===v.imageCaption?`<p dir="auto" class="${i.merge([r,"a-image-caption"])}">${O(t,s)}</p>`:`<p dir="auto" class="${r}">${O(t,s)}</p>`},O=(e,t)=>`<span dir="auto" style="${t}">${e}</span>`,Qr=(e,t,n,r)=>`<div dir="auto" disabled class="tw-flex tw-flex-row tw-pb-2 first-of-type:tw-ml-0 ${n}" style="margin-left:${(e.indent??0)*24}px;">
|
|
12
|
+
<div dir="auto" class="tw-flex tw-items-center tw-justify-center tw-select-none tw-mr-1.5">
|
|
12
13
|
<input
|
|
13
14
|
class="tw-w-4 tw-h-4 tw-m-0"
|
|
14
15
|
type="checkbox"
|
|
15
16
|
${e.checked?"checked":""}
|
|
16
17
|
onclick="return false;" />
|
|
17
18
|
</div>
|
|
18
|
-
<span class="${i.merge(["tw-flex-1 tw-focus:outline-none",e.checked?"!tw-line-through":""])}" style="${V(r[e.children[0].textStyle])}">${t}</span>
|
|
19
|
-
</div>`,Yr=(e,{mentionable:t}={})=>{if(!t)return"";const n=document.createElement("div");return Vt.render(i.MentionMarkupElementNode(t)({element:e}),n),n.innerHTML},$e=(e,t)=>e.reduce((n,r)=>(r.type===t&&n++,r.children?n+$e(r.children,t):n),0),Mt=(e,t,{mappedMentionable:n,nestingCount:r={}})=>{if(l.isText(e))return Wr(e);const s=r[e.type]||$e([e],e.type);let o="";for(const g of e.children)o+=Mt(g,t,{nestingCount:{...r,[g.type]:s},mappedMentionable:n});const u=Jr[e.type];return typeof u<"u"?u({classNames:Ft(e.breakAfterColumn,e.align),children:o,rootNestingCount:s,node:e,mappedMentionable:n,styles:t}):Xr(e,o,t[e.type],Ft(e.breakAfterColumn,e.align))},Jr={[l.ELEMENT_UL]:e=>`<ul class="${i.UL_CLASSES} ${e.classNames}">${e.children}</ul>`,[l.ELEMENT_OL]:({classNames:e,children:t,node:n,rootNestingCount:r})=>{const s=Math.max(r-$e([n],l.ELEMENT_OL),0);return`<ol class="${i.getOrderedListClasses(s)} ${e}" style="${V(i.OL_STYLES)}">${t}</ol>`},[l.ELEMENT_LI]:({classNames:e,children:t,node:n,styles:r})=>`<li class="${e} ${i.LI_CLASSNAMES}" style="${V(i.getLiStyles(n,r))}">${t}</li>`,[l.ELEMENT_LIC]:({classNames:e,children:t,node:n})=>`<p class="${e} ${i.getLicElementClassNames(n)}"><span>${t}</span></p>`,[l.ELEMENT_LINK]:({node:e,children:t,classNames:n,styles:r})=>Gr(e,t,n,r),[k]:({node:e,children:t,classNames:n,styles:r})=>Kr(e,t,n,r),[i.ELEMENT_CHECK_ITEM]:({node:e,children:t,classNames:n,styles:r})=>Qr(e,t,n,r),[l.ELEMENT_MENTION]:({node:e,mappedMentionable:t})=>Yr(e,{mentionable:t})},Ft=(e,t)=>{const n="tw-break-words",r=e==="active"?"tw-break-after-column tw-break-inside-avoid-column":"",s=t?i.alignmentClassnames[t]:"";return i.merge([s,n,r])},Zr=async(e,t=1,n="normal",r=new i.PluginComposer)=>{const s=i.parseRawValue({raw:e,plugins:r}),o=r.getStyles;return Promise.resolve(Rr(s,{columns:t,columnGap:n,styles:o}))},Rr=(e,{mentionable:t,columns:n=1,columnGap:r="normal",styles:s=I}={})=>{const o=t?i.mapMentionable(t):new Map;let u="";for(let g=0,c=e.length;g<c;g++){const f=e[g];es(f)?u+="<br />":u+=Mt(f,s,{mappedMentionable:o})}return n>1?`<div style="columns:${n}; column-gap:${r};">${u}</div>`:u},es=e=>{var t;return Array.isArray(e==null?void 0:e.children)?(t=e==null?void 0:e.children)==null?void 0:t.every(n=>n.text===""):!1},ts=({value:e="",gap:t,columns:n,show:r=!0,plugins:s})=>{const[o,u]=w.useState(null);return w.useEffect(()=>{(async()=>u(await Zr(e,n,t,s)))()},[e,n,t,s]),!r||o==="<br />"?null:o!==null?a.jsx("div",{className:"tw-w-full","data-test-id":"rte-content-html",dangerouslySetInnerHTML:{__html:o}}):a.jsx("div",{className:"tw-rounded-sm tw-bg-base-alt tw-animate-pulse tw-h-full tw-min-h-[10px] tw-w-full"})},ns=({id:e="rte",isEditing:t,value:n,columns:r,gap:s,placeholder:o,plugins:u,onTextChange:g,showSerializedText:c})=>{const[f,y]=w.useState(!1),h=b=>{g&&b!==n&&g(b),y(!1)};return w.useEffect(()=>{const b=C=>(C.preventDefault(),C.returnValue="Unprocessed changes");return f&&window.addEventListener("beforeunload",b),()=>window.removeEventListener("beforeunload",b)},[f]),t?a.jsx(i.RichTextEditor,{id:e,value:n,border:!1,placeholder:o,plugins:u,onValueChanged:()=>y(!0),onTextChange:h,hideExternalFloatingModals:b=>{N.isOpen(b)&&P.reset()}}):a.jsx(ts,{value:n,columns:r,gap:s,show:c,plugins:u})},rs=e=>new i.PluginComposer().setPlugin(new i.SoftBreakPlugin,new i.TextStylePlugin({textStyles:Oe})).setPlugin([new i.BoldPlugin,new i.ItalicPlugin,new i.UnderlinePlugin,new i.StrikethroughPlugin,new mt({appBridge:e}),new gt({appBridge:e}),new i.CodePlugin],[new i.AlignLeftPlugin({validTypes:re}),new i.AlignCenterPlugin({validTypes:re}),new i.AlignRightPlugin({validTypes:re}),new i.AlignJustifyPlugin({validTypes:re}),new i.UnorderedListPlugin,new i.CheckboxListPlugin,new i.OrderedListPlugin,new i.ResetFormattingPlugin]),ss="--f-theme-settings-",as=(e,t)=>{const{blockAssets:n,updateAssetIdsFromKey:r}=W.useBlockAssets(e),s=(n==null?void 0:n[t])||[];return{onAddAttachments:async f=>{const y=s.map(h=>h.id);for(const h of f)y.push(h.id);await r(t,y)},onAttachmentDelete:async f=>{const y=s.filter(h=>h.id!==f.id).map(h=>h.id);await r(t,y)},onAttachmentReplace:async(f,y)=>{const h=s.map(b=>b.id===f.id?y.id:b.id);await r(t,h)},onAttachmentsSorted:async f=>{const y=f.map(h=>h.id);await r(t,y)},attachments:s}},is={start:["Space","Enter"],cancel:[],end:["Space","Enter","Escape"]},ls=(e=0,t=0)=>{const n=Ze(e,t);return S.useSensors(S.useSensor(S.PointerSensor),S.useSensor(S.KeyboardSensor,{coordinateGetter:n,keyboardCodes:is}))},os=e=>{const t=e!=null&&e.id?`hasBackground${e.id}`:"hasBackground",n=e!=null&&e.id?`backgroundColor${e.id}`:"backgroundColor",r=e!=null&&e.preventDefaultColor?void 0:(e==null?void 0:e.defaultColor)||Zt,s=e!=null&&e.switchLabel?e.switchLabel:void 0;return{id:t,label:"Background",type:"switch",switchLabel:s,defaultValue:!!(e!=null&&e.defaultValue),on:[{id:n,defaultValue:r,type:"colorInput"}]}},cs=e=>{const t=e!=null&&e.id?`hasBorder_${e.id}`:"hasBorder",n=e!=null&&e.id?`borderSelection_${e.id}`:"borderSelection",r=e!=null&&e.id?`borderStyle_${e.id}`:"borderStyle",s=e!=null&&e.id?`borderWidth_${e.id}`:"borderWidth",o=e!=null&&e.id?`borderColor_${e.id}`:"borderColor",u=(e==null?void 0:e.defaultColor)||Xe,g=e!=null&&e.switchLabel?e.switchLabel:void 0;return{id:t,label:"Border",type:"switch",switchLabel:g,defaultValue:!!(e!=null&&e.defaultValue),on:[{id:n,type:"multiInput",onChange:c=>m.appendUnit(c,s),layout:m.MultiInputLayout.Columns,lastItemFullWidth:!0,blocks:[{id:r,type:"dropdown",defaultValue:$.Solid,choices:[{value:$.Solid,label:$.Solid},{value:$.Dotted,label:$.Dotted},{value:$.Dashed,label:$.Dashed}]},{id:s,type:"input",defaultValue:Rt,rules:[m.numericalOrPixelRule,m.maximumNumericalOrPixelOrAutoRule(500)],placeholder:"e.g. 3px"},{id:o,type:"colorInput",defaultValue:u}]}],off:[]}},_e=(e,t=q.None)=>({id:e,type:"segmentedControls",defaultValue:t,choices:[{value:q.None,label:"None"},{value:q.Small,label:"S"},{value:q.Medium,label:"M"},{value:q.Large,label:"L"}]}),ds=e=>{const t=e!=null&&e.id?`hasRadius_${e.id}`:"hasRadius",n=e!=null&&e.id?`radiusValue_${e.id}`:"radiusValue",r=e!=null&&e.id?`radiusChoice_${e.id}`:"radiusChoice",s=(e==null?void 0:e.defaultRadius)||q.None;return{id:t,label:"Corner radius",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"Determining how rounded the corners are.",show:o=>{var u;return e!=null&&e.dependentSettingId?!!((u=o.getBlock(e.dependentSettingId))!=null&&u.value):!0},onChange:o=>m.presetCustomValue(o,r,n,(e==null?void 0:e.radiusStyleMap)||K),on:[{id:n,type:"input",placeholder:"e.g. 10px",rules:[m.numericalOrPixelRule],onChange:o=>m.appendUnit(o,n)}],off:[_e(r,s)]}},us=e=>{const t=e!=null&&e.id?`hasExtendedCustomRadius_${e.id}`:"hasExtendedCustomRadius",n=e!=null&&e.id?`extendedRadiusValue_${e.id}`:"extendedRadiusValue",r=e!=null&&e.id?`extendedRadiusChoice_${e.id}`:"extendedRadiusChoice",s=e!=null&&e.id?`extendedRadiusTopLeft_${e.id}`:"extendedRadiusTopLeft",o=e!=null&&e.id?`extendedRadiusTopRight_${e.id}`:"extendedRadiusTopRight",u=e!=null&&e.id?`extendedRadiusBottomLeft_${e.id}`:"extendedRadiusBottomLeft",g=e!=null&&e.id?`extendedRadiusBottomRight_${e.id}`:"extendedRadiusBottomRight";return{id:t,label:"Corner radius",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"Determining how rounded the corners are.",show:c=>{var f;return e!=null&&e.dependentSettingId?!!((f=c.getBlock(e.dependentSettingId))!=null&&f.value):!0},onChange:c=>{m.presetCustomValue(c,r,s,K),m.presetCustomValue(c,r,o,K),m.presetCustomValue(c,r,u,K),m.presetCustomValue(c,r,g,K)},on:[{id:n,type:"multiInput",layout:m.MultiInputLayout.Columns,blocks:[{id:s,type:"input",label:"Top Left",rules:[m.numericalOrPixelRule],onChange:c=>m.appendUnit(c,s)},{id:o,type:"input",label:"Top Right",rules:[m.numericalOrPixelRule],onChange:c=>m.appendUnit(c,o)},{id:u,type:"input",label:"Bottom Left",rules:[m.numericalOrPixelRule],onChange:c=>m.appendUnit(c,u)},{id:g,type:"input",label:"Bottom Right",rules:[m.numericalOrPixelRule],onChange:c=>m.appendUnit(c,g)}]}],off:[_e(r,e==null?void 0:e.defaultValue)]}},gs=e=>{const t=e!=null&&e.id?e.id:"hasCustomSpacing",n=e!=null&&e.dependentSettingId?e.dependentSettingId:"columns",r=e!=null&&e.spacingChoiceId?e.spacingChoiceId:"spacingChoice",s=e!=null&&e.spacingCustomId?e.spacingCustomId:"spacingCustom",o=e!=null&&e.defaultValueChoices?e.defaultValueChoices:Y.M;return{id:t,type:"switch",defaultValue:!1,switchLabel:"Custom",label:"Gutter",info:"An official nerds term for ‘gap’",onChange:u=>m.presetCustomValue(u,r,s,Ge),show:u=>{var g;return((g=u.getBlock(n))==null?void 0:g.value)!=="1"},on:[{id:s,type:"input",rules:[m.numericalOrPixelRule],onChange:u=>m.appendUnit(u,s)}],off:[{id:r,type:"slider",defaultValue:o,choices:[{value:Y.Auto,label:"Auto"},{value:Y.S,label:"S"},{value:Y.M,label:"M"},{value:Y.L,label:"L"}]}]}},He=e=>({id:e,type:"segmentedControls",defaultValue:X.None,choices:[{value:X.None,label:"None"},{value:X.Small,label:"S"},{value:X.Medium,label:"M"},{value:X.Large,label:"L"}]}),hs=e=>{const t=e!=null&&e.id?`hasCustomMarginValue_${e==null?void 0:e.id}`:"hasCustomMarginValue",n=e!=null&&e.id?`marginValue_${e==null?void 0:e.id}`:"marginValue",r=e!=null&&e.id?`marginChoice_${e==null?void 0:e.id}`:"marginChoice";return{id:t,label:"Margin",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"The spacing around UI elements to create more space",onChange:s=>m.presetCustomValue(s,r,n,(e==null?void 0:e.marginStyleMap)||R),on:[{id:n,type:"input",placeholder:oe,rules:[m.numericalOrPixelRule,m.maximumNumericalOrPixelOrAutoRule(500)],onChange:s=>m.appendUnit(s,n)}],off:[He(r)]}},ms=e=>{const t=e!=null&&e.id?`hasExtendedCustomMargin_${e==null?void 0:e.id}`:"hasExtendedCustomMargin",n=e!=null&&e.id?`extendedMarginValues_${e==null?void 0:e.id}`:"extendedMarginValues",r=e!=null&&e.id?`extendedMarginChoice_${e==null?void 0:e.id}`:"extendedMarginChoice",s=e!=null&&e.id?`extendedMarginTop_${e==null?void 0:e.id}`:"extendedMarginTop",o=e!=null&&e.id?`extendedMarginLeft_${e==null?void 0:e.id}`:"extendedMarginLeft",u=e!=null&&e.id?`extendedMarginRight_${e==null?void 0:e.id}`:"extendedMarginRight",g=e!=null&&e.id?`extendedMarginBottom_${e==null?void 0:e.id}`:"extendedMarginBottom";return{id:t,label:"Margin",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"The spacing around UI elements to create more negative space",onChange:c=>{m.presetCustomValue(c,r,s,R),m.presetCustomValue(c,r,o,R),m.presetCustomValue(c,r,u,R),m.presetCustomValue(c,r,g,R)},on:[{id:n,type:"multiInput",layout:m.MultiInputLayout.Spider,blocks:[{id:s,type:"input",label:"Top",placeholder:oe,onChange:c=>m.appendUnit(c,s),rules:[m.numericalOrPixelRule,m.maximumNumericalOrPixelOrAutoRule(500)]},{id:o,type:"input",label:"Left",placeholder:oe,onChange:c=>m.appendUnit(c,o),rules:[m.numericalOrPixelRule,m.maximumNumericalOrPixelOrAutoRule(500)]},{id:u,type:"input",label:"Right",placeholder:oe,onChange:c=>m.appendUnit(c,u),rules:[m.numericalOrPixelRule,m.maximumNumericalOrPixelOrAutoRule(500)]},{id:g,type:"input",label:"Bottom",placeholder:oe,onChange:c=>m.appendUnit(c,g),rules:[m.numericalOrPixelRule,m.maximumNumericalOrPixelOrAutoRule(500)]}]}],off:[He(r)]}},Ue=e=>({id:e,type:"segmentedControls",defaultValue:G.Small,choices:[{value:G.None,label:"None"},{value:G.Small,label:"S"},{value:G.Medium,label:"M"},{value:G.Large,label:"L"}]}),fs=e=>{const t=e!=null&&e.id?`hasCustomPaddingValue_${e==null?void 0:e.id}`:"hasCustomPaddingValue",n=e!=null&&e.id?`paddingValue_${e==null?void 0:e.id}`:"paddingValue",r=e!=null&&e.id?`paddingChoice_${e==null?void 0:e.id}`:"paddingChoice";return{id:t,label:"Padding",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"The spacing around UI elements to create more negative space",onChange:s=>m.presetCustomValue(s,r,n,(e==null?void 0:e.paddingStyleMap)||Z),on:[{id:n,type:"input",placeholder:le,rules:[m.numericalOrPixelRule,m.maximumNumericalOrPixelOrAutoRule(500)],onChange:s=>m.appendUnit(s,n)}],off:[Ue(r)]}},ys=e=>{const t=e!=null&&e.id?`hasExtendedCustomPadding_${e==null?void 0:e.id}`:"hasExtendedCustomPadding",n=e!=null&&e.id?`extendedPaddingValues_${e==null?void 0:e.id}`:"extendedPaddingValues",r=e!=null&&e.id?`extendedPaddingChoice_${e==null?void 0:e.id}`:"extendedPaddingChoice",s=e!=null&&e.id?`extendedPaddingTop_${e==null?void 0:e.id}`:"extendedPaddingTop",o=e!=null&&e.id?`extendedPaddingLeft_${e==null?void 0:e.id}`:"extendedPaddingLeft",u=e!=null&&e.id?`extendedPaddingRight_${e==null?void 0:e.id}`:"extendedPaddingRight",g=e!=null&&e.id?`extendedPaddingBottom_${e==null?void 0:e.id}`:"extendedPaddingBottom";return{id:t,label:"Padding",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"The spacing around UI elements to create more negative space",onChange:c=>{m.presetCustomValue(c,r,s,Z),m.presetCustomValue(c,r,o,Z),m.presetCustomValue(c,r,u,Z),m.presetCustomValue(c,r,g,Z)},on:[{id:n,type:"multiInput",layout:m.MultiInputLayout.Spider,blocks:[{id:s,type:"input",label:"Top",placeholder:le,onChange:c=>m.appendUnit(c,s),rules:[m.numericalOrPixelRule,m.maximumNumericalOrPixelOrAutoRule(500)]},{id:o,type:"input",label:"Left",placeholder:le,onChange:c=>m.appendUnit(c,o),rules:[m.numericalOrPixelRule,m.maximumNumericalOrPixelOrAutoRule(500)]},{id:u,type:"input",label:"Right",placeholder:le,onChange:c=>m.appendUnit(c,u),rules:[m.numericalOrPixelRule,m.maximumNumericalOrPixelOrAutoRule(500)]},{id:g,type:"input",label:"Bottom",placeholder:le,onChange:c=>m.appendUnit(c,g),rules:[m.numericalOrPixelRule,m.maximumNumericalOrPixelOrAutoRule(500)]}]}],off:[Ue(r)]}},ws=e=>{const t=Ve(e==null?void 0:e.globalControlId);return{id:e!=null&&e.id?e.id:"downloadable",type:"switch",defaultValue:!1,label:"Downloadable",show:n=>{var r;return((r=n.getBlock(t))==null?void 0:r.value)===Q.Custom}}},Ve=e=>e||"security",bs=e=>[{id:Ve(e),type:"segmentedControls",defaultValue:Q.Global,choices:[{value:Q.Global,label:"Global Settings"},{value:Q.Custom,label:"Custom"}]},{id:"globalSettingsInfo",type:"notification",footer:m.createFooter({label:"Change global settings [here].",replace:{here:{event:"general-settings.open"}}})}];var Dt=(e=>(e.Main="main",e.Basics="basics",e.Layout="layout",e.Style="style",e.Security="security",e.Targets="targets",e))(Dt||{});const vs=e=>e,ps=e=>e;d.AllTextStylePlugins=zr,d.AllTextStyles=qr,d.Attachments=ln,d.BUTTON_PLUGIN=Le,d.BlockButtonStyles=ye,d.BlockInjectButton=zt,d.BlockItemWrapper=rn,d.BlockStyles=I,d.BorderStyle=$,d.ButtonPlugin=gt,d.Custom1Plugin=ft,d.Custom2Plugin=wt,d.Custom3Plugin=vt,d.DEFAULT_DRAGGING_TOOLTIP=Ye,d.DEFAULT_DRAG_TOOLTIP=Qe,d.DownloadButton=on,d.ELEMENT_BUTTON=k,d.GutterSpacing=Y,d.Heading1Plugin=kt,d.Heading2Plugin=Ct,d.Heading3Plugin=xt,d.Heading4Plugin=Et,d.ImageCaptionPlugin=St,d.ImageTitlePlugin=Pt,d.LinkPlugin=mt,d.Margin=X,d.PARAGRAPH_CLASSES=Tt,d.Padding=G,d.ParagraphMarkupElement=Lt,d.ParagraphMarkupElementNode=we,d.ParagraphPlugin=It,d.QuoteMarkupElementNode=be,d.QuotePlugin=Bt,d.Radius=q,d.RichTextEditor=ns,d.Sections=Dt,d.Security=Q,d.THEME_PREFIX=ss,d.TextStylePluginsWithoutImage=Oe,d.TextStyles=v,d.TextStylesWithoutImage=re,d.addHttps=ge,d.borderStyleMap=Ke,d.convertToRteValue=gn,d.createButtonNode=nt,d.createButtonPlugin=ut,d.createLinkPlugin=ht,d.createParagraphPlugin=Nt,d.createQuotePlugin=At,d.customCoordinatesGetterFactory=Ze,d.defineBlock=vs,d.defineSettings=ps,d.getBackgroundColorStyles=Jt,d.getBackgroundSettings=os,d.getBorderRadiusSettings=ds,d.getBorderRadiusSlider=_e,d.getBorderSettings=cs,d.getBorderStyles=en,d.getDefaultPluginsWithLinkChooser=rs,d.getExtendedBorderRadiusSettings=us,d.getGutterSettings=gs,d.getMarginExtendedSettings=ms,d.getMarginSettings=hs,d.getMarginSlider=He,d.getPaddingExtendedSettings=ys,d.getPaddingSettings=fs,d.getPaddingSlider=Ue,d.getRadiusStyles=tn,d.getReadableColor=Qt,d.getSecurityDownloadableSetting=ws,d.getSecurityGlobalControlId=Ve,d.getSecurityGlobalControlSetting=bs,d.getUrlFromEditor=tt,d.gutterSpacingStyleMap=Ge,d.hasRichTextValue=Je,d.insertButton=rt,d.isDark=Wt,d.isDownloadable=mn,d.joinClassNames=U,d.mapAppBridgeColorPaletteToFonduePalette=Re,d.mapAppBridgeColorPalettesToFonduePalettes=fn,d.marginStyleMap=R,d.moveItemInArray=Yt,d.paddingStyleMap=Z,d.radiusStyleMap=K,d.setAlpha=Gt,d.submitFloatingButton=Pe,d.toColorObject=Xt,d.toHex8String=jt,d.toHexString=Kt,d.toRgbaString=pe,d.toShortRgba=j,d.triggerFloatingButton=ot,d.triggerFloatingButtonEdit=me,d.triggerFloatingButtonInsert=Se,d.unwrapButton=ne,d.upsertButton=st,d.upsertButtonText=Ie,d.useAttachments=as,d.useDndSensors=ls,d.withButton=dt,d.wrapButton=at,Object.keys(m).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(d,e)&&Object.defineProperty(d,e,{enumerable:!0,get:()=>m[e]})}),Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})});
|
|
19
|
+
<span dir="auto" class="${i.merge(["tw-flex-1 tw-focus:outline-none",e.checked?"!tw-line-through":""])}" style="${V(r[e.children[0].textStyle])}">${t}</span>
|
|
20
|
+
</div>`,Yr=(e,{mentionable:t}={})=>{if(!t)return"";const n=document.createElement("div");return Vt.render(i.MentionMarkupElementNode(t)({element:e}),n),n.innerHTML},$e=(e,t)=>e.reduce((n,r)=>(r.type===t&&n++,r.children?n+$e(r.children,t):n),0),Mt=(e,t,{mappedMentionable:n,nestingCount:r={}})=>{if(l.isText(e))return Wr(e);const s=r[e.type]||$e([e],e.type);let o="";for(const g of e.children)o+=Mt(g,t,{nestingCount:{...r,[g.type]:s},mappedMentionable:n});const u=Jr[e.type];return typeof u<"u"?u({classNames:Ft(e.breakAfterColumn,e.align),children:o,rootNestingCount:s,node:e,mappedMentionable:n,styles:t}):Xr(e,o,t[e.type],Ft(e.breakAfterColumn,e.align))},Jr={[l.ELEMENT_UL]:e=>`<ul dir="auto" class="${i.UL_CLASSES} ${e.classNames}">${e.children}</ul>`,[l.ELEMENT_OL]:({classNames:e,children:t,node:n,rootNestingCount:r})=>{const s=Math.max(r-$e([n],l.ELEMENT_OL),0);return`<ol dir="auto" class="${i.getOrderedListClasses(s)} ${e}" style="${V(i.OL_STYLES)}">${t}</ol>`},[l.ELEMENT_LI]:({classNames:e,children:t,node:n,styles:r})=>`<li dir="auto" class="${e} ${i.LI_CLASSNAMES}" style="${V(i.getLiStyles(n,r))}">${t}</li>`,[l.ELEMENT_LIC]:({classNames:e,children:t,node:n})=>`<p dir="auto" class="${e} ${i.getLicElementClassNames(n)}"><span>${t}</span></p>`,[l.ELEMENT_LINK]:({node:e,children:t,classNames:n,styles:r})=>Gr(e,t,n,r),[k]:({node:e,children:t,classNames:n,styles:r})=>Kr(e,t,n,r),[i.ELEMENT_CHECK_ITEM]:({node:e,children:t,classNames:n,styles:r})=>Qr(e,t,n,r),[l.ELEMENT_MENTION]:({node:e,mappedMentionable:t})=>Yr(e,{mentionable:t})},Ft=(e,t)=>{const n="tw-break-words",r=e==="active"?"tw-break-after-column tw-break-inside-avoid-column":"",s=t?i.alignmentClassnames[t]:"";return i.merge([s,n,r])},Zr=async(e,t=1,n="normal",r=new i.PluginComposer)=>{const s=i.parseRawValue({raw:e,plugins:r}),o=r.getStyles;return Promise.resolve(Rr(s,{columns:t,columnGap:n,styles:o}))},Rr=(e,{mentionable:t,columns:n=1,columnGap:r="normal",styles:s=I}={})=>{const o=t?i.mapMentionable(t):new Map;let u="";for(let g=0,c=e.length;g<c;g++){const f=e[g];es(f)?u+="<br />":u+=Mt(f,s,{mappedMentionable:o})}return n>1?`<div style="columns:${n}; column-gap:${r};">${u}</div>`:u},es=e=>{var t;return Array.isArray(e==null?void 0:e.children)?(t=e==null?void 0:e.children)==null?void 0:t.every(n=>n.text===""):!1},ts=({value:e="",gap:t,columns:n,show:r=!0,plugins:s})=>{const[o,u]=w.useState(null);return w.useEffect(()=>{(async()=>u(await Zr(e,n,t,s)))()},[e,n,t,s]),!r||o==="<br />"?null:o!==null?a.jsx("div",{className:"tw-w-full","data-test-id":"rte-content-html",dangerouslySetInnerHTML:{__html:o}}):a.jsx("div",{className:"tw-rounded-sm tw-bg-base-alt tw-animate-pulse tw-h-full tw-min-h-[10px] tw-w-full"})},ns=({id:e="rte",isEditing:t,value:n,columns:r,gap:s,placeholder:o,plugins:u,onTextChange:g,showSerializedText:c})=>{const[f,y]=w.useState(!1),h=b=>{g&&b!==n&&g(b),y(!1)};return w.useEffect(()=>{const b=C=>(C.preventDefault(),C.returnValue="Unprocessed changes");return f&&window.addEventListener("beforeunload",b),()=>window.removeEventListener("beforeunload",b)},[f]),t?a.jsx(i.RichTextEditor,{id:e,value:n,border:!1,placeholder:o,plugins:u,onValueChanged:()=>y(!0),onTextChange:h,hideExternalFloatingModals:b=>{N.isOpen(b)&&P.reset()}}):a.jsx(ts,{value:n,columns:r,gap:s,show:c,plugins:u})},rs=e=>new i.PluginComposer().setPlugin(new i.SoftBreakPlugin,new i.TextStylePlugin({textStyles:Oe})).setPlugin([new i.BoldPlugin,new i.ItalicPlugin,new i.UnderlinePlugin,new i.StrikethroughPlugin,new mt({appBridge:e}),new gt({appBridge:e}),new i.CodePlugin],[new i.AlignLeftPlugin({validTypes:re}),new i.AlignCenterPlugin({validTypes:re}),new i.AlignRightPlugin({validTypes:re}),new i.AlignJustifyPlugin({validTypes:re}),new i.UnorderedListPlugin,new i.CheckboxListPlugin,new i.OrderedListPlugin,new i.ResetFormattingPlugin]),ss="--f-theme-settings-",as=(e,t)=>{const{blockAssets:n,updateAssetIdsFromKey:r}=W.useBlockAssets(e),s=(n==null?void 0:n[t])||[];return{onAddAttachments:async f=>{const y=s.map(h=>h.id);for(const h of f)y.push(h.id);await r(t,y)},onAttachmentDelete:async f=>{const y=s.filter(h=>h.id!==f.id).map(h=>h.id);await r(t,y)},onAttachmentReplace:async(f,y)=>{const h=s.map(b=>b.id===f.id?y.id:b.id);await r(t,h)},onAttachmentsSorted:async f=>{const y=f.map(h=>h.id);await r(t,y)},attachments:s}},is={start:["Space","Enter"],cancel:[],end:["Space","Enter","Escape"]},ls=(e=0,t=0)=>{const n=Ze(e,t);return S.useSensors(S.useSensor(S.PointerSensor),S.useSensor(S.KeyboardSensor,{coordinateGetter:n,keyboardCodes:is}))},os=e=>{const t=e!=null&&e.id?`hasBackground${e.id}`:"hasBackground",n=e!=null&&e.id?`backgroundColor${e.id}`:"backgroundColor",r=e!=null&&e.preventDefaultColor?void 0:(e==null?void 0:e.defaultColor)||Zt,s=e!=null&&e.switchLabel?e.switchLabel:void 0;return{id:t,label:"Background",type:"switch",switchLabel:s,defaultValue:!!(e!=null&&e.defaultValue),on:[{id:n,defaultValue:r,type:"colorInput"}]}},cs=e=>{const t=e!=null&&e.id?`hasBorder_${e.id}`:"hasBorder",n=e!=null&&e.id?`borderSelection_${e.id}`:"borderSelection",r=e!=null&&e.id?`borderStyle_${e.id}`:"borderStyle",s=e!=null&&e.id?`borderWidth_${e.id}`:"borderWidth",o=e!=null&&e.id?`borderColor_${e.id}`:"borderColor",u=(e==null?void 0:e.defaultColor)||Xe,g=e!=null&&e.switchLabel?e.switchLabel:void 0;return{id:t,label:"Border",type:"switch",switchLabel:g,defaultValue:!!(e!=null&&e.defaultValue),on:[{id:n,type:"multiInput",onChange:c=>m.appendUnit(c,s),layout:m.MultiInputLayout.Columns,lastItemFullWidth:!0,blocks:[{id:r,type:"dropdown",defaultValue:$.Solid,choices:[{value:$.Solid,label:$.Solid},{value:$.Dotted,label:$.Dotted},{value:$.Dashed,label:$.Dashed}]},{id:s,type:"input",defaultValue:Rt,rules:[m.numericalOrPixelRule,m.maximumNumericalOrPixelOrAutoRule(500)],placeholder:"e.g. 3px"},{id:o,type:"colorInput",defaultValue:u}]}],off:[]}},_e=(e,t=q.None)=>({id:e,type:"segmentedControls",defaultValue:t,choices:[{value:q.None,label:"None"},{value:q.Small,label:"S"},{value:q.Medium,label:"M"},{value:q.Large,label:"L"}]}),ds=e=>{const t=e!=null&&e.id?`hasRadius_${e.id}`:"hasRadius",n=e!=null&&e.id?`radiusValue_${e.id}`:"radiusValue",r=e!=null&&e.id?`radiusChoice_${e.id}`:"radiusChoice",s=(e==null?void 0:e.defaultRadius)||q.None;return{id:t,label:"Corner radius",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"Determining how rounded the corners are.",show:o=>{var u;return e!=null&&e.dependentSettingId?!!((u=o.getBlock(e.dependentSettingId))!=null&&u.value):!0},onChange:o=>m.presetCustomValue(o,r,n,(e==null?void 0:e.radiusStyleMap)||K),on:[{id:n,type:"input",placeholder:"e.g. 10px",rules:[m.numericalOrPixelRule],onChange:o=>m.appendUnit(o,n)}],off:[_e(r,s)]}},us=e=>{const t=e!=null&&e.id?`hasExtendedCustomRadius_${e.id}`:"hasExtendedCustomRadius",n=e!=null&&e.id?`extendedRadiusValue_${e.id}`:"extendedRadiusValue",r=e!=null&&e.id?`extendedRadiusChoice_${e.id}`:"extendedRadiusChoice",s=e!=null&&e.id?`extendedRadiusTopLeft_${e.id}`:"extendedRadiusTopLeft",o=e!=null&&e.id?`extendedRadiusTopRight_${e.id}`:"extendedRadiusTopRight",u=e!=null&&e.id?`extendedRadiusBottomLeft_${e.id}`:"extendedRadiusBottomLeft",g=e!=null&&e.id?`extendedRadiusBottomRight_${e.id}`:"extendedRadiusBottomRight";return{id:t,label:"Corner radius",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"Determining how rounded the corners are.",show:c=>{var f;return e!=null&&e.dependentSettingId?!!((f=c.getBlock(e.dependentSettingId))!=null&&f.value):!0},onChange:c=>{m.presetCustomValue(c,r,s,K),m.presetCustomValue(c,r,o,K),m.presetCustomValue(c,r,u,K),m.presetCustomValue(c,r,g,K)},on:[{id:n,type:"multiInput",layout:m.MultiInputLayout.Columns,blocks:[{id:s,type:"input",label:"Top Left",rules:[m.numericalOrPixelRule],onChange:c=>m.appendUnit(c,s)},{id:o,type:"input",label:"Top Right",rules:[m.numericalOrPixelRule],onChange:c=>m.appendUnit(c,o)},{id:u,type:"input",label:"Bottom Left",rules:[m.numericalOrPixelRule],onChange:c=>m.appendUnit(c,u)},{id:g,type:"input",label:"Bottom Right",rules:[m.numericalOrPixelRule],onChange:c=>m.appendUnit(c,g)}]}],off:[_e(r,e==null?void 0:e.defaultValue)]}},gs=e=>{const t=e!=null&&e.id?e.id:"hasCustomSpacing",n=e!=null&&e.dependentSettingId?e.dependentSettingId:"columns",r=e!=null&&e.spacingChoiceId?e.spacingChoiceId:"spacingChoice",s=e!=null&&e.spacingCustomId?e.spacingCustomId:"spacingCustom",o=e!=null&&e.defaultValueChoices?e.defaultValueChoices:Y.M;return{id:t,type:"switch",defaultValue:!1,switchLabel:"Custom",label:"Gutter",info:"An official nerds term for ‘gap’",onChange:u=>m.presetCustomValue(u,r,s,Ge),show:u=>{var g;return((g=u.getBlock(n))==null?void 0:g.value)!=="1"},on:[{id:s,type:"input",rules:[m.numericalOrPixelRule],onChange:u=>m.appendUnit(u,s)}],off:[{id:r,type:"slider",defaultValue:o,choices:[{value:Y.Auto,label:"Auto"},{value:Y.S,label:"S"},{value:Y.M,label:"M"},{value:Y.L,label:"L"}]}]}},He=e=>({id:e,type:"segmentedControls",defaultValue:X.None,choices:[{value:X.None,label:"None"},{value:X.Small,label:"S"},{value:X.Medium,label:"M"},{value:X.Large,label:"L"}]}),hs=e=>{const t=e!=null&&e.id?`hasCustomMarginValue_${e==null?void 0:e.id}`:"hasCustomMarginValue",n=e!=null&&e.id?`marginValue_${e==null?void 0:e.id}`:"marginValue",r=e!=null&&e.id?`marginChoice_${e==null?void 0:e.id}`:"marginChoice";return{id:t,label:"Margin",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"The spacing around UI elements to create more space",onChange:s=>m.presetCustomValue(s,r,n,(e==null?void 0:e.marginStyleMap)||R),on:[{id:n,type:"input",placeholder:oe,rules:[m.numericalOrPixelRule,m.maximumNumericalOrPixelOrAutoRule(500)],onChange:s=>m.appendUnit(s,n)}],off:[He(r)]}},ms=e=>{const t=e!=null&&e.id?`hasExtendedCustomMargin_${e==null?void 0:e.id}`:"hasExtendedCustomMargin",n=e!=null&&e.id?`extendedMarginValues_${e==null?void 0:e.id}`:"extendedMarginValues",r=e!=null&&e.id?`extendedMarginChoice_${e==null?void 0:e.id}`:"extendedMarginChoice",s=e!=null&&e.id?`extendedMarginTop_${e==null?void 0:e.id}`:"extendedMarginTop",o=e!=null&&e.id?`extendedMarginLeft_${e==null?void 0:e.id}`:"extendedMarginLeft",u=e!=null&&e.id?`extendedMarginRight_${e==null?void 0:e.id}`:"extendedMarginRight",g=e!=null&&e.id?`extendedMarginBottom_${e==null?void 0:e.id}`:"extendedMarginBottom";return{id:t,label:"Margin",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"The spacing around UI elements to create more negative space",onChange:c=>{m.presetCustomValue(c,r,s,R),m.presetCustomValue(c,r,o,R),m.presetCustomValue(c,r,u,R),m.presetCustomValue(c,r,g,R)},on:[{id:n,type:"multiInput",layout:m.MultiInputLayout.Spider,blocks:[{id:s,type:"input",label:"Top",placeholder:oe,onChange:c=>m.appendUnit(c,s),rules:[m.numericalOrPixelRule,m.maximumNumericalOrPixelOrAutoRule(500)]},{id:o,type:"input",label:"Left",placeholder:oe,onChange:c=>m.appendUnit(c,o),rules:[m.numericalOrPixelRule,m.maximumNumericalOrPixelOrAutoRule(500)]},{id:u,type:"input",label:"Right",placeholder:oe,onChange:c=>m.appendUnit(c,u),rules:[m.numericalOrPixelRule,m.maximumNumericalOrPixelOrAutoRule(500)]},{id:g,type:"input",label:"Bottom",placeholder:oe,onChange:c=>m.appendUnit(c,g),rules:[m.numericalOrPixelRule,m.maximumNumericalOrPixelOrAutoRule(500)]}]}],off:[He(r)]}},Ue=e=>({id:e,type:"segmentedControls",defaultValue:G.Small,choices:[{value:G.None,label:"None"},{value:G.Small,label:"S"},{value:G.Medium,label:"M"},{value:G.Large,label:"L"}]}),fs=e=>{const t=e!=null&&e.id?`hasCustomPaddingValue_${e==null?void 0:e.id}`:"hasCustomPaddingValue",n=e!=null&&e.id?`paddingValue_${e==null?void 0:e.id}`:"paddingValue",r=e!=null&&e.id?`paddingChoice_${e==null?void 0:e.id}`:"paddingChoice";return{id:t,label:"Padding",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"The spacing around UI elements to create more negative space",onChange:s=>m.presetCustomValue(s,r,n,(e==null?void 0:e.paddingStyleMap)||Z),on:[{id:n,type:"input",placeholder:le,rules:[m.numericalOrPixelRule,m.maximumNumericalOrPixelOrAutoRule(500)],onChange:s=>m.appendUnit(s,n)}],off:[Ue(r)]}},ys=e=>{const t=e!=null&&e.id?`hasExtendedCustomPadding_${e==null?void 0:e.id}`:"hasExtendedCustomPadding",n=e!=null&&e.id?`extendedPaddingValues_${e==null?void 0:e.id}`:"extendedPaddingValues",r=e!=null&&e.id?`extendedPaddingChoice_${e==null?void 0:e.id}`:"extendedPaddingChoice",s=e!=null&&e.id?`extendedPaddingTop_${e==null?void 0:e.id}`:"extendedPaddingTop",o=e!=null&&e.id?`extendedPaddingLeft_${e==null?void 0:e.id}`:"extendedPaddingLeft",u=e!=null&&e.id?`extendedPaddingRight_${e==null?void 0:e.id}`:"extendedPaddingRight",g=e!=null&&e.id?`extendedPaddingBottom_${e==null?void 0:e.id}`:"extendedPaddingBottom";return{id:t,label:"Padding",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"The spacing around UI elements to create more negative space",onChange:c=>{m.presetCustomValue(c,r,s,Z),m.presetCustomValue(c,r,o,Z),m.presetCustomValue(c,r,u,Z),m.presetCustomValue(c,r,g,Z)},on:[{id:n,type:"multiInput",layout:m.MultiInputLayout.Spider,blocks:[{id:s,type:"input",label:"Top",placeholder:le,onChange:c=>m.appendUnit(c,s),rules:[m.numericalOrPixelRule,m.maximumNumericalOrPixelOrAutoRule(500)]},{id:o,type:"input",label:"Left",placeholder:le,onChange:c=>m.appendUnit(c,o),rules:[m.numericalOrPixelRule,m.maximumNumericalOrPixelOrAutoRule(500)]},{id:u,type:"input",label:"Right",placeholder:le,onChange:c=>m.appendUnit(c,u),rules:[m.numericalOrPixelRule,m.maximumNumericalOrPixelOrAutoRule(500)]},{id:g,type:"input",label:"Bottom",placeholder:le,onChange:c=>m.appendUnit(c,g),rules:[m.numericalOrPixelRule,m.maximumNumericalOrPixelOrAutoRule(500)]}]}],off:[Ue(r)]}},ws=e=>{const t=Ve(e==null?void 0:e.globalControlId);return{id:e!=null&&e.id?e.id:"downloadable",type:"switch",defaultValue:!1,label:"Downloadable",show:n=>{var r;return((r=n.getBlock(t))==null?void 0:r.value)===Q.Custom}}},Ve=e=>e||"security",bs=e=>[{id:Ve(e),type:"segmentedControls",defaultValue:Q.Global,choices:[{value:Q.Global,label:"Global Settings"},{value:Q.Custom,label:"Custom"}]},{id:"globalSettingsInfo",type:"notification",footer:m.createFooter({label:"Change global settings [here].",replace:{here:{event:"general-settings.open"}}})}];var Dt=(e=>(e.Main="main",e.Basics="basics",e.Layout="layout",e.Style="style",e.Security="security",e.Targets="targets",e))(Dt||{});const vs=e=>e,ps=e=>e;d.AllTextStylePlugins=zr,d.AllTextStyles=qr,d.Attachments=ln,d.BUTTON_PLUGIN=Le,d.BlockButtonStyles=ye,d.BlockInjectButton=zt,d.BlockItemWrapper=rn,d.BlockStyles=I,d.BorderStyle=$,d.ButtonPlugin=gt,d.Custom1Plugin=ft,d.Custom2Plugin=wt,d.Custom3Plugin=vt,d.DEFAULT_DRAGGING_TOOLTIP=Ye,d.DEFAULT_DRAG_TOOLTIP=Qe,d.DownloadButton=on,d.ELEMENT_BUTTON=k,d.GutterSpacing=Y,d.Heading1Plugin=kt,d.Heading2Plugin=Ct,d.Heading3Plugin=xt,d.Heading4Plugin=Et,d.ImageCaptionPlugin=St,d.ImageTitlePlugin=Pt,d.LinkPlugin=mt,d.Margin=X,d.PARAGRAPH_CLASSES=Tt,d.Padding=G,d.ParagraphMarkupElement=Lt,d.ParagraphMarkupElementNode=we,d.ParagraphPlugin=It,d.QuoteMarkupElementNode=be,d.QuotePlugin=Bt,d.Radius=q,d.RichTextEditor=ns,d.Sections=Dt,d.Security=Q,d.THEME_PREFIX=ss,d.TextStylePluginsWithoutImage=Oe,d.TextStyles=v,d.TextStylesWithoutImage=re,d.addHttps=ge,d.borderStyleMap=Ke,d.convertToRteValue=gn,d.createButtonNode=nt,d.createButtonPlugin=ut,d.createLinkPlugin=ht,d.createParagraphPlugin=Nt,d.createQuotePlugin=At,d.customCoordinatesGetterFactory=Ze,d.defineBlock=vs,d.defineSettings=ps,d.getBackgroundColorStyles=Jt,d.getBackgroundSettings=os,d.getBorderRadiusSettings=ds,d.getBorderRadiusSlider=_e,d.getBorderSettings=cs,d.getBorderStyles=en,d.getDefaultPluginsWithLinkChooser=rs,d.getExtendedBorderRadiusSettings=us,d.getGutterSettings=gs,d.getMarginExtendedSettings=ms,d.getMarginSettings=hs,d.getMarginSlider=He,d.getPaddingExtendedSettings=ys,d.getPaddingSettings=fs,d.getPaddingSlider=Ue,d.getRadiusStyles=tn,d.getReadableColor=Qt,d.getSecurityDownloadableSetting=ws,d.getSecurityGlobalControlId=Ve,d.getSecurityGlobalControlSetting=bs,d.getUrlFromEditor=tt,d.gutterSpacingStyleMap=Ge,d.hasRichTextValue=Je,d.insertButton=rt,d.isDark=Wt,d.isDownloadable=mn,d.joinClassNames=U,d.mapAppBridgeColorPaletteToFonduePalette=Re,d.mapAppBridgeColorPalettesToFonduePalettes=fn,d.marginStyleMap=R,d.moveItemInArray=Yt,d.paddingStyleMap=Z,d.radiusStyleMap=K,d.setAlpha=Gt,d.submitFloatingButton=Pe,d.toColorObject=Xt,d.toHex8String=jt,d.toHexString=Kt,d.toRgbaString=pe,d.toShortRgba=j,d.triggerFloatingButton=ot,d.triggerFloatingButtonEdit=me,d.triggerFloatingButtonInsert=Se,d.unwrapButton=ne,d.upsertButton=st,d.upsertButtonText=Ie,d.useAttachments=as,d.useDndSensors=ls,d.withButton=dt,d.wrapButton=at,Object.keys(m).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(d,e)&&Object.defineProperty(d,e,{enumerable:!0,get:()=>m[e]})}),Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})});
|
|
20
21
|
//# sourceMappingURL=index.umd.js.map
|