@frontify/guideline-blocks-settings 2.1.2 → 2.1.3
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/components/RichTextEditor/plugins/OrderedListPlugin/index.es.js +3 -3
- package/dist/components/RichTextEditor/plugins/OrderedListPlugin/index.es.js.map +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { OrderedListPlugin as r } from "@frontify/fondue/rte";
|
|
2
2
|
const t = [
|
|
3
3
|
{
|
|
4
|
-
counterType: "var(--f-theme-settings-list-numbered1-
|
|
4
|
+
counterType: "var(--f-theme-settings-list-numbered1-counter-type, decimal)",
|
|
5
5
|
color: "var(--f-theme-settings-list-numbered1-color, currentColor)"
|
|
6
6
|
},
|
|
7
7
|
{
|
|
8
|
-
counterType: "var(--f-theme-settings-list-numbered2-
|
|
8
|
+
counterType: "var(--f-theme-settings-list-numbered2-counter-type, lower-alpha)",
|
|
9
9
|
color: "var(--f-theme-settings-list-numbered2-color, currentColor)"
|
|
10
10
|
},
|
|
11
11
|
{
|
|
12
|
-
counterType: "var(--f-theme-settings-list-numbered3-
|
|
12
|
+
counterType: "var(--f-theme-settings-list-numbered3-counter-type, lower-roman)",
|
|
13
13
|
color: "var(--f-theme-settings-list-numbered3-color, currentColor)"
|
|
14
14
|
}
|
|
15
15
|
];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.es.js","sources":["../../../../../src/components/RichTextEditor/plugins/OrderedListPlugin/index.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { OrderedListPlugin as FondueOrderedListPlugin, type OrderedListPluginProps } from '@frontify/fondue/rte';\n\nconst DEFAULT_LIST_STYLES = [\n {\n counterType: 'var(--f-theme-settings-list-numbered1-
|
|
1
|
+
{"version":3,"file":"index.es.js","sources":["../../../../../src/components/RichTextEditor/plugins/OrderedListPlugin/index.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { OrderedListPlugin as FondueOrderedListPlugin, type OrderedListPluginProps } from '@frontify/fondue/rte';\n\nconst DEFAULT_LIST_STYLES = [\n {\n counterType: 'var(--f-theme-settings-list-numbered1-counter-type, decimal)',\n color: 'var(--f-theme-settings-list-numbered1-color, currentColor)',\n },\n {\n counterType: 'var(--f-theme-settings-list-numbered2-counter-type, lower-alpha)',\n color: 'var(--f-theme-settings-list-numbered2-color, currentColor)',\n },\n {\n counterType: 'var(--f-theme-settings-list-numbered3-counter-type, lower-roman)',\n color: 'var(--f-theme-settings-list-numbered3-color, currentColor)',\n },\n];\n\nexport class OrderedListPlugin extends FondueOrderedListPlugin {\n constructor(props?: OrderedListPluginProps) {\n super({\n listStyles: DEFAULT_LIST_STYLES,\n ...props,\n });\n }\n}\n"],"names":["DEFAULT_LIST_STYLES","OrderedListPlugin","FondueOrderedListPlugin","props"],"mappings":";AAIA,MAAMA,IAAsB;AAAA,EACxB;AAAA,IACI,aAAa;AAAA,IACb,OAAO;AAAA,EAAA;AAAA,EAEX;AAAA,IACI,aAAa;AAAA,IACb,OAAO;AAAA,EAAA;AAAA,EAEX;AAAA,IACI,aAAa;AAAA,IACb,OAAO;AAAA,EAAA;AAEf;AAEO,MAAMC,UAA0BC,EAAwB;AAAA,EAC3D,YAAYC,GAAgC;AACxC,UAAM;AAAA,MACF,YAAYH;AAAA,MACZ,GAAGG;AAAA,IAAA,CACN;AAAA,EACL;AACJ;"}
|
package/dist/index.cjs.js
CHANGED
|
@@ -6,5 +6,5 @@ ${o.getHotkeyByPlatform("Ctrl+Shift+K")}`:"Buttons can only be set for a single
|
|
|
6
6
|
${w?"tw-pl-7 ":"tw-pl-12 "}
|
|
7
7
|
${p?"tw-bg-highlight tw-text-highlight-on-highlight hover:tw-bg-highlight-hover:hover hover:tw-text-highlight-on-highlight:hover ":"hover:tw-bg-container-secondary-hover hover:tw-text-container-secondary-on-secondary-container "}`,onClick:()=>n(t.permanentLink),children:s.jsxs("div",{className:"tw-flex tw-flex-1 tw-space-x-1 tw-items-center tw-h-6",children:[w&&s.jsx("button",{type:"button",className:"tw-flex tw-items-center tw-justify-center -tw-mr-2 tw-pr-3.5 tw-pt-1.5 tw-pb-1.5 tw-pl-3.5 tw-cursor-pointer",onClick:()=>c(!a),onKeyDown:g=>g.key==="Enter"&&g.stopPropagation(),children:s.jsx("div",{className:`tw-transition-transform tw-w-0 tw-h-0 tw-font-normal tw-border-t-4 tw-border-t-transparent tw-border-b-4 tw-border-b-transparent tw-border-l-4 tw-border-l-x-strong
|
|
8
8
|
${a?"tw-rotate-90 ":""}`})}),s.jsx("span",{className:"tw-text-small",children:t.title}),s.jsx("span",{className:"tw-flex-auto tw-font-sans tw-text-x-small tw-text-right",children:"Page"})]},t.id)}),a&&d.length>0&&d.map(g=>s.jsx(Ts,{section:g,selectedUrl:e,onSelectUrl:n},g.id))]})},Is=({documentId:t,selectedUrl:e,onSelectUrl:n,itemsToExpandInitially:r,getDocumentSectionsByDocumentPageId:i,getDocumentPagesByDocumentId:a})=>{const[c,d]=u.useState([]),[l,p]=u.useState(!0),w=[...c.values()],g=!l&&w.length>0;return u.useEffect(()=>{a(t).then(f=>{const v=f.filter(S=>!!S.category).sort((S,N)=>S.category.sort===N.category.sort?S.sort-N.sort:S.category.sort-N.category.sort),x=f.filter(S=>!S.category).sort((S,N)=>S.sort-N.sort);d([...v,...x])}).finally(()=>{p(!1)})},[]),l?s.jsx(Ve,{}):g?s.jsx(s.Fragment,{children:w.map(f=>s.jsx(Ps,{page:f,selectedUrl:e,onSelectUrl:n,itemsToExpandInitially:r,getDocumentSectionsByDocumentPageId:i},f.id))}):s.jsx("div",{className:"tw-h-10 tw-flex tw-items-center tw-pr-2.5 tw-pl-7 tw-leading-5 tw-text-small tw-text-secondary",children:"This document does not contain any pages."})},Es=({document:t,selectedUrl:e,onSelectUrl:n,itemsToExpandInitially:r,getDocumentSectionsByDocumentPageId:i,getDocumentPagesByDocumentId:a})=>{const[c,d]=u.useState(t.id===r.documentId),l=t.permanentLink===e;return u.useEffect(()=>{t.id===r.documentId&&d(!0)},[r,t.id]),s.jsxs(s.Fragment,{children:[s.jsxs("button",{type:"button","data-test-id":"internal-link-selector-document-link",className:`tw-flex tw-flex-1 tw-space-x-2 tw-items-center tw-py-2 tw-pr-2.5 tw-leading-5 tw-cursor-pointer tw-w-full ${l?"tw-bg-highlight tw-text-highlight-on-highlight hover:tw-bg-highlight-hover:hover hover:tw-text-highlight-on-highlight:hover":"hover:tw-bg-container-secondary-hover hover:tw-text-container-secondary-on-secondary-container"}`,onClick:()=>n(t.permanentLink),children:[s.jsx("button",{type:"button",tabIndex:0,"data-test-id":"tree-item-toggle",className:"tw-flex tw-items-center tw-justify-center -tw-mr-2 tw-pr-3.5 tw-pt-1.5 tw-pb-1.5 tw-pl-3.5 tw-cursor-pointer",onClick:()=>d(!c),onKeyDown:p=>p.key==="Enter"&&p.stopPropagation(),children:s.jsx("div",{className:`tw-transition-transform tw-w-0 tw-h-0 tw-font-normal tw-border-t-4 tw-border-t-transparent tw-border-b-4 tw-border-b-transparent tw-border-l-4 tw-border-l-x-strong ${c?"tw-rotate-90":""}`})}),s.jsx(k.IconColorFan,{size:16}),s.jsx("span",{className:"tw-text-small",children:t.title}),s.jsx("span",{className:"tw-flex-auto tw-font-sans tw-text-x-small tw-text-right",children:"Document"})]}),c&&s.jsx(Is,{documentId:t.id,selectedUrl:e,onSelectUrl:n,itemsToExpandInitially:r,getDocumentSectionsByDocumentPageId:i,getDocumentPagesByDocumentId:a})]})},js=({selectedUrl:t,onSelectUrl:e,getAllDocuments:n,getDocumentPagesByDocumentId:r,getDocumentSectionsByDocumentPageId:i})=>{const[a,c]=u.useState(!0),[d,l]=u.useState([]),[p,w]=u.useState({documentId:void 0,pageId:void 0});u.useEffect(()=>{t&&d.length>0&&g().then(f=>{w(f)})},[d.length]),u.useEffect(()=>{n().then(f=>{l(f)}).finally(()=>{c(!1)})},[]);const g=async()=>{const f={documentId:void 0,pageId:void 0};if(d.find(x=>x.permanentLink===t))return f;for(const x of d){const S=await r(x.id);if(!!S.find(A=>A.permanentLink===t))return f.documentId=x.id,f;for(const A of S){const L=await i(A.id);if(!!ze(L).find(F=>F.permanentLink===t))return f.documentId=x.id,f.pageId=A.id,f}}return f};return a?s.jsx(Ve,{}):s.jsx(s.Fragment,{children:d.map(f=>s.jsx(Es,{document:f,selectedUrl:t,onSelectUrl:e,itemsToExpandInitially:p,getDocumentSectionsByDocumentPageId:i,getDocumentPagesByDocumentId:r},f.id))})},$e=({url:t,onUrlChange:e,buttonSize:n="medium",getAllDocuments:r,getDocumentPagesByDocumentId:i,getDocumentSectionsByDocumentPageId:a})=>{const[c,d]=u.useState(!1),[l,p]=u.useState(t),w=x=>{p(x)},g=x=>{x.key==="Enter"&&(x.preventDefault(),f())};u.useEffect(()=>{t&&!l&&p(t)},[t,l]);const f=()=>{e?.(l),d(!1)},v={onOpenAutoFocus:()=>{},showUnderlay:!0,"data-is-underlay":!0,minWidth:"800px"};return s.jsx("div",{onPointerDown:x=>{x.preventDefault()},"data-test-id":"internal-link-selector",onKeyDown:g,children:s.jsxs(h.Dialog.Root,{modal:!0,open:c,onOpenChange:d,children:[s.jsx(h.Dialog.Trigger,{asChild:!0,children:s.jsxs(h.Button,{size:n,emphasis:"default",children:[s.jsx(k.IconLink,{size:"20"}),"Internal link"]})}),s.jsxs(h.Dialog.Content,{...v,children:[s.jsx(h.Dialog.Header,{children:s.jsx(h.Dialog.Title,{children:"Select internal link"})}),s.jsx(h.Dialog.Body,{padding:"none",children:s.jsx(h.ScrollArea,{padding:"compact",children:s.jsx(js,{selectedUrl:l,onSelectUrl:w,getAllDocuments:r,getDocumentPagesByDocumentId:i,getDocumentSectionsByDocumentPageId:a})})}),s.jsxs(h.Dialog.Footer,{children:[s.jsx(h.Button,{size:n,emphasis:"default",onPress:()=>d(!1),children:"Cancel"}),s.jsx(h.Button,{size:n,disabled:!l,emphasis:"strong",onPress:()=>f(),children:"Choose"})]})]})]})})},We=({onUrlChange:t,onToggleTab:e,isValidUrlOrEmpty:n,appBridge:r,placeholder:i,newTab:a,url:c="",required:d,info:l,label:p,buttonSize:w,hideInternalLinkButton:g})=>{const f=n?n(c):st(c);return s.jsxs("div",{"data-test-id":"link-input",children:[s.jsx(H.FormControl,{label:{children:p,htmlFor:"url",required:d,tooltip:l?{content:l,position:"top"}:void 0},children:s.jsx(h.TextInput,{"data-test-id":"text-input",id:"url",value:c,onChange:v=>t?.(v.target.value),placeholder:i??"https://example.com"})}),!f&&s.jsx("div",{className:"tw-text-error tw-mt-1 tw-text-small",children:"Please enter a valid URL."}),!g&&s.jsx("div",{className:"tw-mt-3",children:s.jsx($e,{url:c,onUrlChange:t,buttonSize:w??"medium",getAllDocuments:()=>r.getAllDocuments(),getDocumentPagesByDocumentId:v=>r.getDocumentPagesByDocumentId(v),getDocumentSectionsByDocumentPageId:v=>r.getDocumentSectionsByDocumentPageId(v)})}),s.jsxs("div",{className:"tw-mt-3 tw-flex tw-items-center tw-gap-1.5",children:[s.jsx(h.Checkbox,{id:"new-tab",value:a,onChange:()=>e?.(!a)}),s.jsx(h.Label,{id:"new-tab-label",htmlFor:"new-tab",className:"tw-whitespace-nowrap",children:"Open in new tab"})]})]})},qe=({state:t,onTextChange:e,onUrlChange:n,onToggleTab:r,onCancel:i,onSave:a,isValidUrlOrEmpty:c,hasValues:d,testId:l,appBridge:p,children:w})=>s.jsxs(o.FloatingModalWrapper,{"data-test-id":l,padding:"28px",minWidth:"400px",children:[s.jsx(H.FormControl,{label:{children:"Text",htmlFor:"linkText",required:!0},children:s.jsx(h.TextInput,{id:"linkText",value:t.text,placeholder:"Link Text",onChange:g=>e(g.target.value)})}),w,s.jsx("div",{className:"tw-mt-5",children:s.jsx(We,{url:t.url,newTab:t.newTab,onUrlChange:n,onToggleTab:r,isValidUrlOrEmpty:c,appBridge:p})}),s.jsx("div",{className:"tw-mt-3",children:s.jsxs("div",{className:"tw-pt-5 tw-flex tw-gap-x-3 tw-justify-end tw-border-t tw-border-t-black-10",children:[s.jsx(h.Button,{"data-test-id":"button",onPress:i,size:"medium",emphasis:"default",children:"Cancel"}),s.jsxs(h.Button,{"data-test-id":"button",onPress:a,size:"medium",disabled:!c(t?.url)||!d,children:[s.jsx(k.IconCheckMark,{size:"20"}),"Save"]})]})})]}),Bs=t=>{const e=o.getAboveNode(t,{match:{type:T}});return Array.isArray(e)&&e[0]?.buttonStyle||"primary"},Ns={url:"",text:"",buttonStyle:"primary",newTab:!1},As=()=>{const[t,e]=u.useReducer((n,r)=>{const{type:i,payload:a}=r;switch(i){case"NEW_TAB":return{...n,newTab:!0};case"SAME_TAB":return{...n,newTab:!1};case"URL":case"TEXT":case"BUTTON_STYLE":case"INIT":return{...n,...a};default:return n}},Ns);return[t,e]},Ls=()=>{const t=o.useEditorRef(),[e,n]=As();u.useEffect(()=>{const g=Bs(t);n({type:"INIT",payload:{text:B.text()||B.url(),buttonStyle:g,newTab:!!B.newTab(),url:B.url()}})},[n,t]);const r=g=>{n({type:"TEXT",payload:{text:g}})},i=g=>{n({type:"BUTTON_STYLE",payload:{buttonStyle:g}})},a=g=>{n({type:"URL",payload:{url:g}})},c=g=>{n(g?{type:"NEW_TAB"}:{type:"SAME_TAB"})},d=()=>{E.reset()},l=g=>{if(!st(e.url)||!p)return;const f=vt(e.url);E.text(e.text),E.url(f),E.buttonStyle(e.buttonStyle),E.newTab(e.newTab),Kt(t)&&g?.preventDefault()},p=e.url!==""&&e.text!=="",{appBridge:w}=o.getPluginOptions(t,T);return o.useHotkeys("enter",l,{enableOnFormTags:["INPUT"]},[]),{state:e,onTextChange:r,onButtonStyleChange:i,onUrlChange:a,onToggleTab:c,onCancel:d,onSave:l,hasValues:p,isValidUrlOrEmpty:st,appBridge:w}},Rs=()=>{const t=Ls(),{state:e,onButtonStyleChange:n}=t;return s.jsx(qe,{...t,testId:"floating-button-insert",children:s.jsx("div",{className:"tw-pt-5",children:s.jsxs(H.FormControl,{label:{children:"Button Style",htmlFor:"buttonStyle",required:!0},children:[s.jsx(Bt,{id:"primary",styles:P.buttonPrimary,isActive:e.buttonStyle==="primary",onClick:()=>n("primary"),children:e.text||"Primary Button"}),s.jsx(Bt,{id:"secondary",styles:P.buttonSecondary,isActive:e.buttonStyle==="secondary",onClick:()=>n("secondary"),children:e.text||"Secondary Button"}),s.jsx(Bt,{id:"tertiary",styles:P.buttonTertiary,isActive:e.buttonStyle==="tertiary",onClick:()=>n("tertiary"),children:e.text||"Tertiary Button"})]})})})},Bt=({id:t,styles:e,isActive:n,onClick:r,children:i})=>{const[a,c]=u.useState(!1),d=()=>e&&e.hover&&a?{...e,...e.hover}:e;return s.jsx("button",{"data-test-id":`floating-button-insert-${t}`,onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),onClick:r,style:{...d(),marginTop:0,marginBottom:0},className:n?"tw-outline tw-outline-1 tw-outline-violet-60 tw-outline-offset-2 tw-w-fit":"tw-w-fit",children:i})},re={placement:"bottom-start",strategy:"absolute",middleware:[o.offset(12),o.flip({padding:12,fallbackPlacements:["bottom-end","top-start","top-end"]})]},Ds=()=>{const{ref:t,...e}=Os(re),{ref:n,...r}=Ms(re),i=o.useEditorRef(),a=ut(),c=a.isOpen(i.id),d=a.isEditing(),l=a.mode(),p=s.jsx(Rs,{}),w=d?p:s.jsx(ks,{});return s.jsxs(s.Fragment,{children:[c&&l==="insert"&&ft.createPortal(s.jsx("div",{"data-is-underlay":!0,ref:t,...e,style:{...e.style,...P[o.TextStyles.p]},children:p}),document.body),c&&l==="edit"&&ft.createPortal(s.jsx("div",{"data-is-underlay":!0,ref:n,...r,style:{...r.style,...P[o.TextStyles.p]},children:w}),document.body)]})},T="button",Ge="button-plugin",Ke=t=>o.createPluginFactory({key:T,isElement:!0,isInline:!0,props:({element:e})=>({nodeProps:{href:e?.url,target:e?.target}}),withOverrides:Re,renderAfterEditable:Ds,options:{isUrl:Ct,rangeBeforeOptions:{matchString:" ",skipInvalid:!0,afterMatch:!0},triggerFloatingButtonHotkeys:"command+shift+k, ctrl+shift+k",appBridge:t},then:(e,{type:n})=>({deserializeHtml:{rules:[{validNodeName:"A",validClassName:"btn"}],getNode:r=>({type:n,url:r.getAttribute("href"),target:r.getAttribute("target")||"_blank"})}})})();class Ye extends o.Plugin{styles={};appBridge;constructor({styles:e=kt,...n}){super(Ge,{button:Ss,markupElement:new Cs,...n}),this.styles=e,this.appBridge=n?.appBridge}plugins(){return[Ke(this.appBridge)]}}const Ms=t=>{const e=o.useEditorRef(),n=ut().mode(),r=ut().isOpen(e.id),i=o.useEditorVersion(),{triggerFloatingButtonHotkeys:a}=o.getPluginOptions(e,T),c=u.useCallback(()=>{const g=o.getAboveNode(e,{match:{type:o.getPluginType(e,T)}});if(g){const[,f]=g;return o.getRangeBoundingClientRect(e,{anchor:o.getStartPoint(e,f),focus:o.getEndPoint(e,f)})}return o.getDefaultBoundingClientRect()},[e]),d=r&&n==="edit",{update:l,style:p,floating:w}=Xe({open:d,getBoundingClientRect:c,...t});return u.useEffect(()=>{const g=Oe(e);if(g&&E.url(g),e.selection&&o.someNode(e,{match:{type:o.getPluginType(e,T)}})){E.show("edit",e.id),l();return}B.mode()==="edit"&&E.reset()},[e,i,l]),o.useHotkeys(a,g=>{g.preventDefault(),B.mode()==="edit"&&St(e)},{enableOnContentEditable:!0},[]),Fs(),Qe(),{style:p,ref:o.useComposedRef(w)}},Fs=()=>{const t=o.useEditorRef();o.useHotkeys("*",e=>{e.key==="Enter"&&Kt(t)&&e.preventDefault()},{enableOnFormTags:["INPUT"]},[])},Qe=()=>{const t=o.useEditorRef();o.useHotkeys("escape",()=>{if(B.mode()==="edit"){if(B.isEditing()){E.show("edit",t.id),o.focusEditor(t,t.selection??void 0);return}E.reset()}},{enableOnFormTags:["INPUT"],enableOnContentEditable:!0},[])},Os=t=>{const e=o.useEditorRef(),n=o.useFocused(),r=ut().mode(),i=ut().isOpen(e.id),{triggerFloatingButtonHotkeys:a}=o.getPluginOptions(e,T);o.useHotkeys(a,p=>{p.preventDefault(),Qt(e,{focused:n})},{enableOnContentEditable:!0},[n]);const{update:c,style:d,floating:l}=Xe({open:i&&r==="insert",getBoundingClientRect:o.getSelectionBoundingClientRect,whileElementsMounted:void 0,...t});return u.useEffect(()=>{i&&c(),E.updated(i)},[i,c]),Qe(),{style:d,ref:o.useComposedRef(l)}},_s=12,Us=-22,Hs=96,Xe=t=>o.useVirtualFloating({placement:"bottom-start",middleware:[o.offset({mainAxis:_s,alignmentAxis:Us}),o.flip({padding:Hs})],...t}),Nt="[&_.tw-break-after-column]:tw-break-after-auto [&_.tw-break-inside-avoid-column]:tw-break-inside-auto [&_.tw-break-after-column.tw-pb-5]:tw-pb-0 @md:[&_.tw-break-after-column.tw-pb-5]:!tw-pb-5 @md:[&_.tw-break-after-column]:!tw-break-after-column @md:[&_.tw-break-inside-avoid-column]:!tw-break-inside-avoid-column",zs="[&_.tw-break-after-column]:tw-break-after-auto [&_.tw-break-inside-avoid-column]:tw-break-inside-auto [&_.tw-break-after-column.tw-pb-5]:tw-pb-0 @sm:[&_.tw-break-after-column.tw-pb-5]:!tw-pb-5 @sm:[&_.tw-break-after-column]:!tw-break-after-column @sm:[&_.tw-break-inside-avoid-column]:!tw-break-inside-avoid-column",ie={1:"tw-columns-1",2:`tw-columns-1 @sm:!tw-columns-2 ${zs}`,3:`tw-columns-1 @md:!tw-columns-3 ${Nt}`,4:`tw-columns-1 @md:!tw-columns-4 ${Nt}`,5:`tw-columns-1 @md:!tw-columns-5 ${Nt}`},Je=t=>t?ie[t]||ie[1]:"",Vs=t=>{B.isOpen(t)&&E.reset()},Ze=u.memo(({isEnabled:t,value:e,columns:n,gap:r,placeholder:i,plugins:a,onTextChange:c,showSerializedText:d})=>{const l=Je(n),[p,w]=u.useState(!1),g=u.useId(),f=u.useCallback(x=>{x!==e&&c?.(x),w(!1)},[c,e]),v=u.useCallback(()=>w(!0),[]);return u.useEffect(()=>{const x=S=>{S.preventDefault(),S.returnValue="Unprocessed changes"};return p&&window.addEventListener("beforeunload",x),()=>window.removeEventListener("beforeunload",x)},[p]),t?s.jsx(o.RichTextEditor,{id:g,value:e,border:!1,placeholder:i,plugins:a,onValueChanged:v,onTextChange:f,hideExternalFloatingModals:Vs,placeholderOpacity:"high"}):s.jsx(as,{value:e,gap:r,customClass:l,show:d,plugins:a})});Ze.displayName="InternalRichTextEditor";const $s=t=>{const e=u.useRef(null),[n,r]=u.useState(!1),{isEditing:i,...a}=t,c=u.useCallback(d=>{d&&r(!0)},[]);return is({ref:e,disabled:!i,onChange:c}),u.useEffect(()=>{i||r(!1)},[i]),s.jsx("div",{"data-test-id":"rich-text-editor-container",className:"tw-block tw-w-full tw-@container",ref:e,children:s.jsx(Ze,{...a,isEnabled:i&&n})})},Ws=({editButtonProps:t,unlinkButtonProps:e})=>{const{element:n}=o.useLinkOpenButtonState(),r=n?qt(n):"";return s.jsx(o.FloatingModalWrapper,{"data-test-id":"floating-link-edit",padding:"16px",minWidth:"400px",children:s.jsxs("span",{"data-test-id":"preview-link-flyout",className:"tw-flex tw-justify-between tw-items-center tw-gap-2",children:[s.jsx("a",{"data-test-id":"floating-link-edit-url",href:r,target:"_blank",rel:"noopener noreferrer",style:P[rt],className:"tw-break-all",children:r}),s.jsxs("span",{className:"tw-flex tw-gap-2",children:[s.jsx("button",{tabIndex:0,"data-test-id":"edit-link-button",className:"tw-transition tw-cursor-pointer tw-rounded-medium hover:tw-bg-black-10 tw-p-1",...t,children:s.jsx(k.IconPen,{size:16})}),s.jsx("button",{tabIndex:0,"data-test-id":"remove-link-button",className:"tw-transition tw-cursor-pointer tw-rounded-medium hover:tw-bg-black-10 tw-p-1",...e,children:s.jsx(k.IconTrashBin,{size:16})})]})]})})},tn=(t,e)=>{const n=o.getAboveNode(t,{match:{type:o.ELEMENT_LINK}});return Array.isArray(n)?e(n[0]):""},qs=t=>tn(t,e=>e.chosenLink?.searchResult?.link||""),Gs=t=>tn(t,e=>e.url||""),Ks={url:"",text:"",newTab:!1},Ys=()=>{const[t,e]=u.useReducer((n,r)=>{const{type:i,payload:a}=r;switch(i){case"NEW_TAB":return{...n,newTab:!0};case"SAME_TAB":return{...n,newTab:!1};case"URL":case"TEXT":case"INIT":return{...n,...a};default:return n}},Ks);return[t,e]},Qs=()=>{const t=o.useEditorRef(),[e,n]=Ys();u.useEffect(()=>{const w=qs(t),g=Gs(t),f=o.floatingLinkSelectors.newTab();n({type:"INIT",payload:{text:o.floatingLinkSelectors.text()||o.floatingLinkSelectors.url(),newTab:f,url:w&&g===""?w:o.floatingLinkSelectors.url()}})},[n,t]);const r=w=>{n({type:"TEXT",payload:{text:w}})},i=w=>{n({type:"URL",payload:{url:w}})},a=w=>{n(w?{type:"NEW_TAB"}:{type:"SAME_TAB"})},c=()=>{o.floatingLinkActions.reset()},d=w=>{!st(e.url)||!l||(o.floatingLinkActions.text(e.text),o.floatingLinkActions.url(vt(e.url)),o.floatingLinkActions.newTab(e.newTab),o.submitFloatingLink(t)&&w?.preventDefault())},l=e.url!==""&&e.text!=="",{appBridge:p}=o.getPluginOptions(t,o.ELEMENT_LINK);return o.useHotkeys("enter",d,{enableOnFormTags:["INPUT"]},[]),{state:e,onTextChange:r,onUrlChange:i,onToggleTab:a,onCancel:c,onSave:d,hasValues:l,isValidUrlOrEmpty:st,appBridge:p}},Xs=()=>s.jsx(qe,{...Qs(),testId:"floating-link-insert"}),ae={placement:"bottom-start",strategy:"absolute",middleware:[o.offset(12),o.flip({padding:12,fallbackPlacements:["bottom-end","top-start","top-end"]})]},Js=()=>{const t=o.useFloatingLinkInsertState({floatingOptions:ae}),{props:e,ref:n,hidden:r}=o.useFloatingLinkInsert(t),i=o.useFloatingLinkEditState({floatingOptions:ae}),{props:a,ref:c,editButtonProps:d,unlinkButtonProps:l}=o.useFloatingLinkEdit(i);if(r)return null;const p=s.jsx(Xs,{}),w=i.isEditing?p:s.jsx(Ws,{editButtonProps:d,unlinkButtonProps:l});return s.jsxs(s.Fragment,{children:[t.isOpen&&!i.isOpen&&ft.createPortal(s.jsx("div",{"data-is-underlay":!0,ref:n,...e,style:{...e.style,...P[y.p]},children:p}),document.body),i.isOpen&&ft.createPortal(s.jsx("div",{"data-is-underlay":!0,ref:c,...a,style:{...a.style,...P[y.p]},children:w}),document.body)]})},en=u.forwardRef((t,e)=>{const n=o.useEditorRef(),r=o.useLinkToolbarButtonState(),{props:i}=o.useLinkToolbarButton(r);return s.jsx(o.ToolbarButton,{onMouseDown:a=>{a.preventDefault(),o.focusEditor(n,n.selection??n.prevSelection??void 0)},ref:e,...i,...t,children:s.jsx(o.IconStylingWrapper,{icon:s.jsx(k.IconLink,{size:16})})})});en.displayName="LinkToolbarButton";const Zs=({id:t,editorId:e})=>{const n=o.useEditorState(o.useEventPlateId(e)),r=!!o.isRangeInSameBlock(n,{at:n.selection});return s.jsx("div",{"data-plugin-id":t,children:s.jsx(en,{disabled:!r,tooltip:o.getTooltip(r?`Link
|
|
9
|
-
${o.getHotkeyByPlatform("Ctrl+K")}`:"Links can only be set for a single text block.")})})},to=t=>{const{attributes:e,children:n}=t,{styles:r}=o.useRichTextEditorContext(),i=t.element.url||t.element.chosenLink?.searchResult?.link||"",a=t.element.target||"_self";return s.jsx("a",{...e,href:i,target:a,style:r[rt],children:n})};class eo extends o.MarkupElement{constructor(e=o.ELEMENT_LINK,n=to){super(e,n)}}const nn=t=>o.createPluginFactory({...o.createLinkPlugin(),renderAfterEditable:Js,options:{isUrl:Ct,rangeBeforeOptions:{matchString:" ",skipInvalid:!0,afterMatch:!0},triggerFloatingLinkHotkeys:"meta+k, ctrl+k",keepSelectedTextOnPaste:!0,appBridge:t}})();class sn extends o.Plugin{styles={};appBridge;constructor({styles:e=P[rt],...n}){super(rt,{button:Zs,markupElement:new eo,...n}),this.styles=e,this.appBridge=n.appBridge}plugins(){return[nn(this.appBridge)]}}const no="breakAfterColumn",on="normal";class so extends o.Plugin{columns;gap;customClass;constructor(e){super("break-after-plugin",{button:o.ColumnBreakButton,...e}),this.columns=e?.columns??1,this.gap=e?.gap??on,this.customClass=Je(this.columns)}plugins(){return[o.createColumnBreakPlugin(this.columns,this.gap,this.customClass)]}}const oo="textstyle-custom1-plugin";class rn extends o.Plugin{styles={};constructor({styles:e=P.custom1,...n}={}){super(y.custom1,{label:"Custom 1",markupElement:new ro,...n}),this.styles=e}plugins(){return[io(this.styles)]}}class ro extends o.MarkupElement{constructor(e=oo,n=an){super(e,n)}}const an=({element:t,attributes:e,children:n,styles:r})=>{const i=t.align;return s.jsx("p",{...e,style:r,className:o.merge([i&&o.alignmentClassnames[i],o.getColumnBreakClasses(t)]),children:n})},io=t=>o.createPluginFactory({key:y.custom1,isElement:!0,deserializeHtml:{rules:[{validClassName:y.custom1}]}})({component:e=>s.jsx(an,{...e,styles:t})}),ao="textstyle-custom2-plugin";class ln extends o.Plugin{styles={};constructor({styles:e=P.custom2,...n}={}){super(y.custom2,{label:"Custom 2",markupElement:new lo,...n}),this.styles=e}plugins(){return[co(this.styles)]}}class lo extends o.MarkupElement{constructor(e=ao,n=cn){super(e,n)}}const cn=({element:t,attributes:e,children:n,styles:r})=>{const i=t.align;return s.jsx("p",{...e,className:o.merge([i&&o.alignmentClassnames[i],o.getColumnBreakClasses(t)]),style:r,children:n})},co=t=>o.createPluginFactory({key:y.custom2,isElement:!0,deserializeHtml:{rules:[{validClassName:y.custom2}]}})({component:e=>s.jsx(cn,{...e,styles:t})}),uo="textstyle-custom3-plugin";class dn extends o.Plugin{styles={};constructor({styles:e=P.custom3,...n}={}){super(o.TextStyles.custom3,{label:"Custom 3",markupElement:new go,...n}),this.styles=e}plugins(){return[mo(this.styles)]}}class go extends o.MarkupElement{constructor(e=uo,n=un){super(e,n)}}const un=({element:t,attributes:e,children:n,styles:r})=>{const i=t.align;return s.jsx("p",{...e,className:o.merge([i&&o.alignmentClassnames[i],o.getColumnBreakClasses(t)]),style:r,children:n})},mo=t=>o.createPluginFactory({key:o.TextStyles.custom3,isElement:!0,deserializeHtml:{rules:[{validClassName:o.TextStyles.custom3}]}})({component:e=>s.jsx(un,{...e,styles:t})}),ho="textstyle-heading1-plugin";class gn extends o.Plugin{styles={};constructor({styles:e=P.heading1,...n}={}){super(y.heading1,{label:"Heading 1",markupElement:new po,...n}),this.styles=e}plugins(){return[fo(this.styles)]}}class po extends o.MarkupElement{constructor(e=ho,n=At){super(e,n)}}const At=({element:t,attributes:e,children:n,styles:r})=>{const i=t.align;return s.jsx("h1",{...e,className:o.merge([i&&o.alignmentClassnames[i],o.getColumnBreakClasses(t)]),style:r,children:n})},fo=t=>o.createPluginFactory({key:y.heading1,isElement:!0,component:At,deserializeHtml:{rules:[{validNodeName:["h1","H1"]}]}})({component:e=>s.jsx(At,{...e,styles:t})}),wo="textstyle-heading2-plugin";class mn extends o.Plugin{styles={};constructor({styles:e=P.heading2,...n}={}){super(y.heading2,{label:"Heading 2",markupElement:new yo,...n}),this.styles=e}plugins(){return[xo(this.styles)]}}class yo extends o.MarkupElement{constructor(e=wo,n=Lt){super(e,n)}}const Lt=({element:t,attributes:e,children:n,styles:r})=>{const i=t.align;return s.jsx("h2",{...e,className:o.merge([i&&o.alignmentClassnames[i],o.getColumnBreakClasses(t)]),style:r,children:n})},xo=t=>o.createPluginFactory({key:y.heading2,isElement:!0,component:Lt,deserializeHtml:{rules:[{validNodeName:["h2","H2"]}]}})({component:e=>s.jsx(Lt,{...e,styles:t})}),bo="textstyle-heading3-plugin";class hn extends o.Plugin{styles={};constructor({styles:e=P.heading3,...n}={}){super(y.heading3,{label:"Heading 3",markupElement:new vo,...n}),this.styles=e}plugins(){return[Co(this.styles)]}}class vo extends o.MarkupElement{constructor(e=bo,n=Rt){super(e,n)}}const Rt=({element:t,attributes:e,children:n,styles:r})=>{const i=t.align;return s.jsx("h3",{...e,className:o.merge([i&&o.alignmentClassnames[i],o.getColumnBreakClasses(t)]),style:r,children:n})},Co=t=>o.createPluginFactory({key:y.heading3,isElement:!0,component:Rt,deserializeHtml:{rules:[{validNodeName:["h3","H3"]}]}})({component:e=>s.jsx(Rt,{...e,styles:t})}),So="textstyle-heading4-plugin";class pn extends o.Plugin{styles={};constructor({styles:e=P.heading4,...n}={}){super(y.heading4,{label:"Heading 4",markupElement:new ko,...n}),this.styles=e}plugins(){return[To(this.styles)]}}class ko extends o.MarkupElement{constructor(e=So,n=Dt){super(e,n)}}const Dt=({element:t,attributes:e,children:n,styles:r})=>{const i=t.align;return s.jsx("h4",{...e,className:o.merge([i&&o.alignmentClassnames[i],o.getColumnBreakClasses(t)]),style:r,children:n})},To=t=>o.createPluginFactory({key:y.heading4,isElement:!0,component:Dt,deserializeHtml:{rules:[{validNodeName:["h4","H4"]}]}})({component:e=>s.jsx(Dt,{...e,styles:t})}),Po="textstyle-imageCaption-plugin";class fn extends o.Plugin{styles={};constructor({styles:e=P.imageCaption,...n}={}){super(y.imageCaption,{label:"Image Caption",markupElement:new Io,...n}),this.styles=e}plugins(){return[Eo(this.styles)]}}class Io extends o.MarkupElement{constructor(e=Po,n=Mt){super(e,n)}}const Mt=({element:t,attributes:e,children:n,styles:r})=>{const i=t.align;return s.jsx("p",{...e,className:o.merge([i&&o.alignmentClassnames[i],o.getColumnBreakClasses(t)]),style:r,children:n})},Eo=t=>o.createPluginFactory({key:y.imageCaption,isElement:!0,component:Mt,deserializeHtml:{rules:[{validClassName:y.imageCaption}]}})({component:e=>s.jsx(Mt,{...e,styles:t})}),jo="textstyle-imageTitle-plugin";class wn extends o.Plugin{styles={};constructor({styles:e=P.imageTitle,...n}={}){super(y.imageTitle,{label:"Image Title",markupElement:new Bo,...n}),this.styles=e}plugins(){return[No(this.styles)]}}class Bo extends o.MarkupElement{constructor(e=jo,n=Ft){super(e,n)}}const Ft=({element:t,attributes:e,children:n,styles:r})=>{const i=t.align;return s.jsx("p",{...e,className:o.merge([i&&o.alignmentClassnames[i],o.getColumnBreakClasses(t)]),style:r,children:n})},No=t=>o.createPluginFactory({key:y.imageTitle,isElement:!0,component:Ft,deserializeHtml:{rules:[{validClassName:y.imageTitle}]}})({component:e=>s.jsx(Ft,{...e,styles:t})});class yn extends o.Plugin{styles={};constructor({styles:e=P.p,...n}={}){super(y.p,{markupElement:new bn,label:"Body Text",...n}),this.styles=e}plugins(){return[vn(this.styles)]}}const xn="tw-m-0 tw-px-0 tw-py-0",wt=({element:t,attributes:e,children:n,styles:r})=>{const i=t.align,a=o.merge([i&&o.alignmentClassnames[i],xn,o.getColumnBreakClasses(t)]);return s.jsx("p",{...e,className:a,style:r,children:n})};class bn extends o.MarkupElement{constructor(e=y.p,n=wt){super(e,n)}}const vn=t=>o.createPluginFactory({...o.createParagraphPlugin(),key:y.p,isElement:!0,component:wt})({component:e=>s.jsx(wt,{...e,styles:t})}),Ao="textstyle-quote-plugin";class Cn extends o.Plugin{styles={};constructor({styles:e=P.quote,...n}={}){super(y.quote,{label:"Quote",markupElement:new Lo,...n}),this.styles=e}plugins(){return[Sn(this.styles)]}}class Lo extends o.MarkupElement{constructor(e=Ao,n=yt){super(e,n)}}const yt=({element:t,attributes:e,children:n,styles:r})=>{const i=t.align;return s.jsx("blockquote",{...e,className:o.merge([i&&o.alignmentClassnames[i],o.getColumnBreakClasses(t)]),style:r,children:n})},Sn=t=>o.createPluginFactory({key:y.quote,isElement:!0,component:yt,deserializeHtml:{rules:[{validNodeName:["blockquote","BLOCKQUOTE"]}]}})({component:e=>s.jsx(yt,{...e,styles:t})}),Xt=[new gn,new mn,new hn,new pn,new rn,new ln,new dn,new Cn,new yn],nt=[y.heading1,y.heading2,y.heading3,y.heading4,y.custom1,y.custom2,y.custom3,y.quote,y.p],Ro=[...Xt,new fn,new wn],Do=[...nt,y.imageCaption,y.imageTitle],Mo=[{color:"var(--f-theme-settings-list-bullet1-color, currentColor)",shape:"var(--f-theme-settings-list-bullet1-shape, '•')",size:"var(--f-theme-settings-list-bullet1-size, 1em)"},{color:"var(--f-theme-settings-list-bullet2-color, currentColor)",shape:"var(--f-theme-settings-list-bullet2-shape, '•')",size:"var(--f-theme-settings-list-bullet2-size, 1em)"},{color:"var(--f-theme-settings-list-bullet3-color, currentColor)",shape:"var(--f-theme-settings-list-bullet3-shape, '•')",size:"var(--f-theme-settings-list-bullet3-size, 1em)"}];class kn extends o.UnorderedListPlugin{constructor(e){super({listStyles:Mo,...e})}}const Fo=[{counterType:"var(--f-theme-settings-list-numbered1-counterType, decimal)",color:"var(--f-theme-settings-list-numbered1-color, currentColor)"},{counterType:"var(--f-theme-settings-list-numbered2-counterType, lower-alpha)",color:"var(--f-theme-settings-list-numbered2-color, currentColor)"},{counterType:"var(--f-theme-settings-list-numbered3-counterType, lower-roman)",color:"var(--f-theme-settings-list-numbered3-color, currentColor)"}];class Tn extends o.OrderedListPlugin{constructor(e){super({listStyles:Fo,...e})}}const Oo=t=>new o.PluginComposer().setPlugin(new o.SoftBreakPlugin,new o.TextStylePlugin({textStyles:Xt})).setPlugin([new o.BoldPlugin,new o.ItalicPlugin,new o.UnderlinePlugin,new o.StrikethroughPlugin,new sn({appBridge:t}),new Ye({appBridge:t}),new o.CodePlugin],[new o.AlignLeftPlugin({validTypes:nt}),new o.AlignCenterPlugin({validTypes:nt}),new o.AlignRightPlugin({validTypes:nt}),new o.AlignJustifyPlugin({validTypes:nt}),new kn,new o.CheckboxListPlugin,new Tn,new o.ResetFormattingPlugin,new o.AutoformatPlugin]),_o="--f-theme-settings-",Uo=t=>{const e=t?.id?`hasBackground${t.id}`:"hasBackground",n=t?.id?`backgroundColor${t.id}`:"backgroundColor",r=t?.preventDefaultColor?void 0:t?.defaultColor||qn,i=t?.label?t.label:"Background",a=t?.switchLabel?t.switchLabel:void 0;return{id:e,label:i,type:"switch",switchLabel:a,defaultValue:!!t?.defaultValue,on:[{id:n,defaultValue:r,type:"colorInput"}]}},Ho=t=>{const e=t?.id?`hasBorder_${t.id}`:"hasBorder",n=t?.id?`borderSelection_${t.id}`:"borderSelection",r=t?.id?`borderStyle_${t.id}`:"borderStyle",i=t?.id?`borderWidth_${t.id}`:"borderWidth",a=t?.id?`borderColor_${t.id}`:"borderColor",c=t?.defaultColor||ce,d=t?.switchLabel?t.switchLabel:void 0;return{id:e,label:"Border",type:"switch",switchLabel:d,defaultValue:!!t?.defaultValue,on:[{id:n,type:"multiInput",layout:m.MultiInputLayout.Columns,lastItemFullWidth:!0,blocks:[{id:r,type:"dropdown",defaultValue:O.Solid,choices:[{value:O.Solid,label:O.Solid},{value:O.Dotted,label:O.Dotted},{value:O.Dashed,label:O.Dashed}]},{id:i,type:"input",defaultValue:Gn,rules:[m.numericalOrPixelRule,m.minimumNumericalOrPixelRule(0),m.maximumNumericalOrPixelOrAutoRule(500)],placeholder:"e.g. 3px",onChange:l=>m.appendUnit(l,i)},{id:a,type:"colorInput",defaultValue:c}]}],off:[]}},Jt=(t,e=$.None)=>({id:t,type:"segmentedControls",defaultValue:e,choices:[{value:$.None,label:"None"},{value:$.Small,label:"S"},{value:$.Medium,label:"M"},{value:$.Large,label:"L"}]}),zo=t=>{const e=t?.id?`hasRadius_${t.id}`:"hasRadius",n=t?.id?`radiusValue_${t.id}`:"radiusValue",r=t?.id?`radiusChoice_${t.id}`:"radiusChoice",i=t?.defaultRadius||$.None;return{id:e,label:"Corner radius",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"Determining how rounded the corners are.",show:a=>t?.dependentSettingId?!!a.getBlock(t.dependentSettingId)?.value:!0,onChange:a=>m.presetCustomValue(a,r,n,t?.radiusStyleMap||Q),on:[{id:n,type:"input",placeholder:"e.g. 10px",rules:[m.numericalOrPixelRule],onChange:a=>m.appendUnit(a,n)}],off:[Jt(r,i)]}},Vo=t=>{const e=t?.id?`hasExtendedCustomRadius_${t.id}`:"hasExtendedCustomRadius",n=t?.id?`extendedRadiusValue_${t.id}`:"extendedRadiusValue",r=t?.id?`extendedRadiusChoice_${t.id}`:"extendedRadiusChoice",i=t?.id?`extendedRadiusTopLeft_${t.id}`:"extendedRadiusTopLeft",a=t?.id?`extendedRadiusTopRight_${t.id}`:"extendedRadiusTopRight",c=t?.id?`extendedRadiusBottomLeft_${t.id}`:"extendedRadiusBottomLeft",d=t?.id?`extendedRadiusBottomRight_${t.id}`:"extendedRadiusBottomRight";return{id:e,label:"Corner radius",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"Determining how rounded the corners are.",show:l=>t?.dependentSettingId?!!l.getBlock(t.dependentSettingId)?.value:!0,onChange:l=>{m.presetCustomValue(l,r,i,Q),m.presetCustomValue(l,r,a,Q),m.presetCustomValue(l,r,c,Q),m.presetCustomValue(l,r,d,Q)},on:[{id:n,type:"multiInput",layout:m.MultiInputLayout.Columns,blocks:[{id:i,type:"input",label:"Top Left",rules:[m.numericalOrPixelRule],onChange:l=>m.appendUnit(l,i)},{id:a,type:"input",label:"Top Right",rules:[m.numericalOrPixelRule],onChange:l=>m.appendUnit(l,a)},{id:c,type:"input",label:"Bottom Left",rules:[m.numericalOrPixelRule],onChange:l=>m.appendUnit(l,c)},{id:d,type:"input",label:"Bottom Right",rules:[m.numericalOrPixelRule],onChange:l=>m.appendUnit(l,d)}]}],off:[Jt(r,t?.defaultValue)]}},$o=t=>{const e=t?.id?t.id:"hasCustomSpacing",n=t?.dependentSettingId?t.dependentSettingId:"columns",r=t?.spacingChoiceId?t.spacingChoiceId:"spacingChoice",i=t?.spacingCustomId?t.spacingCustomId:"spacingCustom",a=t?.defaultValueChoices?t.defaultValueChoices:Y.M;return{id:e,type:"switch",defaultValue:!1,switchLabel:"Custom",label:"Gutter",info:"An official nerds term for ‘gap’",onChange:c=>m.presetCustomValue(c,r,i,ue),show:c=>c.getBlock(n)?.value!=="1",on:[{id:i,type:"input",rules:[m.numericalOrPixelRule],onChange:c=>m.appendUnit(c,i)}],off:[{id:r,type:"slider",defaultValue:a,choices:[{value:Y.Auto,label:"Auto"},{value:Y.S,label:"S"},{value:Y.M,label:"M"},{value:Y.L,label:"L"}]}]}},Zt=t=>({id:t,type:"segmentedControls",defaultValue:K.None,choices:[{value:K.None,label:"None"},{value:K.Small,label:"S"},{value:K.Medium,label:"M"},{value:K.Large,label:"L"}]}),Wo=t=>{const e=t?.id?`hasCustomMarginValue_${t?.id}`:"hasCustomMarginValue",n=t?.id?`marginValue_${t?.id}`:"marginValue",r=t?.id?`marginChoice_${t?.id}`:"marginChoice";return{id:e,label:"Margin",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"The spacing around UI elements to create more space",onChange:i=>m.presetCustomValue(i,r,n,t?.marginStyleMap||et),on:[{id:n,type:"input",placeholder:dt,rules:[m.numericalOrPixelRule,m.maximumNumericalOrPixelOrAutoRule(500)],onChange:i=>m.appendUnit(i,n)}],off:[Zt(r)]}},qo=t=>{const e=t?.id?`hasExtendedCustomMargin_${t?.id}`:"hasExtendedCustomMargin",n=t?.id?`extendedMarginValues_${t?.id}`:"extendedMarginValues",r=t?.id?`extendedMarginChoice_${t?.id}`:"extendedMarginChoice",i=t?.id?`extendedMarginTop_${t?.id}`:"extendedMarginTop",a=t?.id?`extendedMarginLeft_${t?.id}`:"extendedMarginLeft",c=t?.id?`extendedMarginRight_${t?.id}`:"extendedMarginRight",d=t?.id?`extendedMarginBottom_${t?.id}`:"extendedMarginBottom";return{id:e,label:"Margin",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"The spacing around UI elements to create more negative space",onChange:l=>{m.presetCustomValue(l,r,i,et),m.presetCustomValue(l,r,a,et),m.presetCustomValue(l,r,c,et),m.presetCustomValue(l,r,d,et)},on:[{id:n,type:"multiInput",layout:m.MultiInputLayout.Spider,blocks:[{id:i,type:"input",label:"Top",placeholder:dt,onChange:l=>m.appendUnit(l,i),rules:[m.numericalOrPixelRule,m.maximumNumericalOrPixelOrAutoRule(500)]},{id:a,type:"input",label:"Left",placeholder:dt,onChange:l=>m.appendUnit(l,a),rules:[m.numericalOrPixelRule,m.maximumNumericalOrPixelOrAutoRule(500)]},{id:c,type:"input",label:"Right",placeholder:dt,onChange:l=>m.appendUnit(l,c),rules:[m.numericalOrPixelRule,m.maximumNumericalOrPixelOrAutoRule(500)]},{id:d,type:"input",label:"Bottom",placeholder:dt,onChange:l=>m.appendUnit(l,d),rules:[m.numericalOrPixelRule,m.maximumNumericalOrPixelOrAutoRule(500)]}]}],off:[Zt(r)]}},te=t=>({id:t,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"}]}),Go=t=>{const e=t?.id?`hasCustomPaddingValue_${t?.id}`:"hasCustomPaddingValue",n=t?.id?`paddingValue_${t?.id}`:"paddingValue",r=t?.id?`paddingChoice_${t?.id}`:"paddingChoice";return{id:e,label:"Padding",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"The spacing around UI elements to create more negative space",onChange:i=>m.presetCustomValue(i,r,n,t?.paddingStyleMap||tt),on:[{id:n,type:"input",placeholder:ct,rules:[m.numericalOrPixelRule,m.maximumNumericalOrPixelOrAutoRule(500)],onChange:i=>m.appendUnit(i,n)}],off:[te(r)]}},Ko=t=>{const e=t?.id?`hasExtendedCustomPadding_${t?.id}`:"hasExtendedCustomPadding",n=t?.id?`extendedPaddingValues_${t?.id}`:"extendedPaddingValues",r=t?.id?`extendedPaddingChoice_${t?.id}`:"extendedPaddingChoice",i=t?.id?`extendedPaddingTop_${t?.id}`:"extendedPaddingTop",a=t?.id?`extendedPaddingLeft_${t?.id}`:"extendedPaddingLeft",c=t?.id?`extendedPaddingRight_${t?.id}`:"extendedPaddingRight",d=t?.id?`extendedPaddingBottom_${t?.id}`:"extendedPaddingBottom";return{id:e,label:"Padding",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"The spacing around UI elements to create more negative space",onChange:l=>{m.presetCustomValue(l,r,i,tt),m.presetCustomValue(l,r,a,tt),m.presetCustomValue(l,r,c,tt),m.presetCustomValue(l,r,d,tt)},on:[{id:n,type:"multiInput",layout:m.MultiInputLayout.Spider,blocks:[{id:i,type:"input",label:"Top",placeholder:ct,onChange:l=>m.appendUnit(l,i),rules:[m.numericalOrPixelRule,m.maximumNumericalOrPixelOrAutoRule(500)]},{id:a,type:"input",label:"Left",placeholder:ct,onChange:l=>m.appendUnit(l,a),rules:[m.numericalOrPixelRule,m.maximumNumericalOrPixelOrAutoRule(500)]},{id:c,type:"input",label:"Right",placeholder:ct,onChange:l=>m.appendUnit(l,c),rules:[m.numericalOrPixelRule,m.maximumNumericalOrPixelOrAutoRule(500)]},{id:d,type:"input",label:"Bottom",placeholder:ct,onChange:l=>m.appendUnit(l,d),rules:[m.numericalOrPixelRule,m.maximumNumericalOrPixelOrAutoRule(500)]}]}],off:[te(r)]}},Yo=t=>{const e=ee(t?.globalControlId);return{id:t?.id?t.id:"downloadable",type:"switch",defaultValue:!1,label:"Downloadable",show:n=>n.getBlock(e)?.value===J.Custom}},ee=t=>t||"security",Qo=t=>[{id:ee(t),type:"segmentedControls",defaultValue:J.Global,choices:[{value:J.Global,label:"Global Settings"},{value:J.Custom,label:"Custom"}]},{id:"globalSettingsInfo",type:"notification",footer:m.createFooter({label:"Change global settings [here].",replace:{here:{event:"general-settings.open"}}})}];var Pn=(t=>(t.Main="main",t.Basics="basics",t.Layout="layout",t.Style="style",t.Security="security",t.Targets="targets",t))(Pn||{});const Xo=t=>t,Jo=t=>t;exports.AllTextStylePlugins=Ro;exports.AllTextStyles=Do;exports.AttachmentOperationsProvider=Qn;exports.Attachments=ve;exports.AttachmentsProvider=fe;exports.AttachmentsToolbarButton=ke;exports.BUTTON_PLUGIN=Ge;exports.BlockButtonStyles=kt;exports.BlockInjectButton=Mn;exports.BlockItemWrapper=Ne;exports.BlockStyles=P;exports.BorderStyle=O;exports.BreakAfterPlugin=so;exports.ButtonPlugin=Ye;exports.Custom1Plugin=rn;exports.Custom2Plugin=ln;exports.Custom3Plugin=dn;exports.DEFAULT_ATTACHMENTS_BUTTON_ID=Se;exports.DEFAULT_DRAGGING_TOOLTIP=Pe;exports.DEFAULT_DRAG_TOOLTIP=Te;exports.DEFAULT_MENU_BUTTON_ID=Vt;exports.DownloadButton=rs;exports.DragHandleToolbarButton=Ie;exports.DragPreviewContextProvider=ge;exports.ELEMENT_BUTTON=T;exports.FlyoutToolbarButton=Ee;exports.GAP_DEFAULT=on;exports.GutterSpacing=Y;exports.Heading1Plugin=gn;exports.Heading2Plugin=mn;exports.Heading3Plugin=hn;exports.Heading4Plugin=pn;exports.ImageCaptionPlugin=fn;exports.ImageTitlePlugin=wn;exports.KEY_ELEMENT_BREAK_AFTER_COLUMN=no;exports.LinkInput=We;exports.LinkPlugin=sn;exports.LinkSelector=$e;exports.Margin=K;exports.MenuToolbarButton=je;exports.MultiFlyoutContextProvider=me;exports.OrderedListPlugin=Tn;exports.PARAGRAPH_CLASSES=xn;exports.Padding=G;exports.ParagraphMarkupElement=bn;exports.ParagraphMarkupElementNode=wt;exports.ParagraphPlugin=yn;exports.QuoteMarkupElementNode=yt;exports.QuotePlugin=Cn;exports.Radius=$;exports.RichTextEditor=$s;exports.Sections=Pn;exports.Security=J;exports.THEME_PREFIX=_o;exports.TextStylePluginsWithoutImage=Xt;exports.TextStyles=y;exports.TextStylesWithoutImage=nt;exports.Toolbar=Be;exports.UnorderedListPlugin=kn;exports.addHttps=vt;exports.borderStyleMap=de;exports.convertToRteValue=ls;exports.createButtonNode=_e;exports.createButtonPlugin=Ke;exports.createLinkPlugin=nn;exports.createParagraphPlugin=vn;exports.createQuotePlugin=Sn;exports.customCoordinatesGetterFactory=ye;exports.defineBlock=Xo;exports.defineSettings=Jo;exports.getBackgroundColorStyles=Wn;exports.getBackgroundSettings=Uo;exports.getBorderRadiusSettings=zo;exports.getBorderRadiusSlider=Jt;exports.getBorderSettings=Ho;exports.getBorderStyles=Kn;exports.getDefaultPluginsWithLinkChooser=Oo;exports.getExtendedBorderRadiusSettings=Vo;exports.getGutterSettings=$o;exports.getLegacyUrl=ms;exports.getLinkFromEditor=ps;exports.getMarginExtendedSettings=qo;exports.getMarginSettings=Wo;exports.getMarginSlider=Zt;exports.getPaddingExtendedSettings=Ko;exports.getPaddingSettings=Go;exports.getPaddingSlider=te;exports.getRadiusStyles=Yn;exports.getReadableColor=Vn;exports.getSecurityDownloadableSetting=Yo;exports.getSecurityGlobalControlId=ee;exports.getSecurityGlobalControlSetting=Qo;exports.getUrl=hs;exports.getUrlFromEditor=Oe;exports.getUrlFromLinkOrLegacyLink=qt;exports.gutterSpacingStyleMap=ue;exports.hasRichTextValue=Ae;exports.insertButton=De;exports.isDark=On;exports.isDownloadable=cs;exports.isValidUrl=Ct;exports.isValidUrlOrEmpty=st;exports.joinClassNames=_;exports.mapAppBridgeColorPaletteToFonduePalette=Le;exports.mapAppBridgeColorPalettesToFonduePalettes=ds;exports.marginStyleMap=et;exports.moveItemInArray=$n;exports.paddingStyleMap=tt;exports.radiusStyleMap=Q;exports.relativeUrlRegex=Gt;exports.setAlpha=Hn;exports.submitFloatingButton=Kt;exports.toColorObject=zn;exports.toHex8String=_n;exports.toHexString=Un;exports.toRgbaString=Ot;exports.toShortRgba=Z;exports.triggerFloatingButton=Ue;exports.triggerFloatingButtonEdit=St;exports.triggerFloatingButtonInsert=Qt;exports.unwrapButton=ot;exports.upsertButton=Me;exports.upsertButtonText=Yt;exports.useAttachmentOperations=Ht;exports.useAttachments=pe;exports.useAttachmentsContext=we;exports.useDndSensors=ts;exports.useDragPreviewContext=it;exports.useMultiFlyoutContext=he;exports.useMultiFlyoutState=xt;exports.withAttachmentsProvider=Xn;exports.withButton=Re;exports.wrapButton=Fe;Object.keys(m).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>m[t]})});
|
|
9
|
+
${o.getHotkeyByPlatform("Ctrl+K")}`:"Links can only be set for a single text block.")})})},to=t=>{const{attributes:e,children:n}=t,{styles:r}=o.useRichTextEditorContext(),i=t.element.url||t.element.chosenLink?.searchResult?.link||"",a=t.element.target||"_self";return s.jsx("a",{...e,href:i,target:a,style:r[rt],children:n})};class eo extends o.MarkupElement{constructor(e=o.ELEMENT_LINK,n=to){super(e,n)}}const nn=t=>o.createPluginFactory({...o.createLinkPlugin(),renderAfterEditable:Js,options:{isUrl:Ct,rangeBeforeOptions:{matchString:" ",skipInvalid:!0,afterMatch:!0},triggerFloatingLinkHotkeys:"meta+k, ctrl+k",keepSelectedTextOnPaste:!0,appBridge:t}})();class sn extends o.Plugin{styles={};appBridge;constructor({styles:e=P[rt],...n}){super(rt,{button:Zs,markupElement:new eo,...n}),this.styles=e,this.appBridge=n.appBridge}plugins(){return[nn(this.appBridge)]}}const no="breakAfterColumn",on="normal";class so extends o.Plugin{columns;gap;customClass;constructor(e){super("break-after-plugin",{button:o.ColumnBreakButton,...e}),this.columns=e?.columns??1,this.gap=e?.gap??on,this.customClass=Je(this.columns)}plugins(){return[o.createColumnBreakPlugin(this.columns,this.gap,this.customClass)]}}const oo="textstyle-custom1-plugin";class rn extends o.Plugin{styles={};constructor({styles:e=P.custom1,...n}={}){super(y.custom1,{label:"Custom 1",markupElement:new ro,...n}),this.styles=e}plugins(){return[io(this.styles)]}}class ro extends o.MarkupElement{constructor(e=oo,n=an){super(e,n)}}const an=({element:t,attributes:e,children:n,styles:r})=>{const i=t.align;return s.jsx("p",{...e,style:r,className:o.merge([i&&o.alignmentClassnames[i],o.getColumnBreakClasses(t)]),children:n})},io=t=>o.createPluginFactory({key:y.custom1,isElement:!0,deserializeHtml:{rules:[{validClassName:y.custom1}]}})({component:e=>s.jsx(an,{...e,styles:t})}),ao="textstyle-custom2-plugin";class ln extends o.Plugin{styles={};constructor({styles:e=P.custom2,...n}={}){super(y.custom2,{label:"Custom 2",markupElement:new lo,...n}),this.styles=e}plugins(){return[co(this.styles)]}}class lo extends o.MarkupElement{constructor(e=ao,n=cn){super(e,n)}}const cn=({element:t,attributes:e,children:n,styles:r})=>{const i=t.align;return s.jsx("p",{...e,className:o.merge([i&&o.alignmentClassnames[i],o.getColumnBreakClasses(t)]),style:r,children:n})},co=t=>o.createPluginFactory({key:y.custom2,isElement:!0,deserializeHtml:{rules:[{validClassName:y.custom2}]}})({component:e=>s.jsx(cn,{...e,styles:t})}),uo="textstyle-custom3-plugin";class dn extends o.Plugin{styles={};constructor({styles:e=P.custom3,...n}={}){super(o.TextStyles.custom3,{label:"Custom 3",markupElement:new go,...n}),this.styles=e}plugins(){return[mo(this.styles)]}}class go extends o.MarkupElement{constructor(e=uo,n=un){super(e,n)}}const un=({element:t,attributes:e,children:n,styles:r})=>{const i=t.align;return s.jsx("p",{...e,className:o.merge([i&&o.alignmentClassnames[i],o.getColumnBreakClasses(t)]),style:r,children:n})},mo=t=>o.createPluginFactory({key:o.TextStyles.custom3,isElement:!0,deserializeHtml:{rules:[{validClassName:o.TextStyles.custom3}]}})({component:e=>s.jsx(un,{...e,styles:t})}),ho="textstyle-heading1-plugin";class gn extends o.Plugin{styles={};constructor({styles:e=P.heading1,...n}={}){super(y.heading1,{label:"Heading 1",markupElement:new po,...n}),this.styles=e}plugins(){return[fo(this.styles)]}}class po extends o.MarkupElement{constructor(e=ho,n=At){super(e,n)}}const At=({element:t,attributes:e,children:n,styles:r})=>{const i=t.align;return s.jsx("h1",{...e,className:o.merge([i&&o.alignmentClassnames[i],o.getColumnBreakClasses(t)]),style:r,children:n})},fo=t=>o.createPluginFactory({key:y.heading1,isElement:!0,component:At,deserializeHtml:{rules:[{validNodeName:["h1","H1"]}]}})({component:e=>s.jsx(At,{...e,styles:t})}),wo="textstyle-heading2-plugin";class mn extends o.Plugin{styles={};constructor({styles:e=P.heading2,...n}={}){super(y.heading2,{label:"Heading 2",markupElement:new yo,...n}),this.styles=e}plugins(){return[xo(this.styles)]}}class yo extends o.MarkupElement{constructor(e=wo,n=Lt){super(e,n)}}const Lt=({element:t,attributes:e,children:n,styles:r})=>{const i=t.align;return s.jsx("h2",{...e,className:o.merge([i&&o.alignmentClassnames[i],o.getColumnBreakClasses(t)]),style:r,children:n})},xo=t=>o.createPluginFactory({key:y.heading2,isElement:!0,component:Lt,deserializeHtml:{rules:[{validNodeName:["h2","H2"]}]}})({component:e=>s.jsx(Lt,{...e,styles:t})}),bo="textstyle-heading3-plugin";class hn extends o.Plugin{styles={};constructor({styles:e=P.heading3,...n}={}){super(y.heading3,{label:"Heading 3",markupElement:new vo,...n}),this.styles=e}plugins(){return[Co(this.styles)]}}class vo extends o.MarkupElement{constructor(e=bo,n=Rt){super(e,n)}}const Rt=({element:t,attributes:e,children:n,styles:r})=>{const i=t.align;return s.jsx("h3",{...e,className:o.merge([i&&o.alignmentClassnames[i],o.getColumnBreakClasses(t)]),style:r,children:n})},Co=t=>o.createPluginFactory({key:y.heading3,isElement:!0,component:Rt,deserializeHtml:{rules:[{validNodeName:["h3","H3"]}]}})({component:e=>s.jsx(Rt,{...e,styles:t})}),So="textstyle-heading4-plugin";class pn extends o.Plugin{styles={};constructor({styles:e=P.heading4,...n}={}){super(y.heading4,{label:"Heading 4",markupElement:new ko,...n}),this.styles=e}plugins(){return[To(this.styles)]}}class ko extends o.MarkupElement{constructor(e=So,n=Dt){super(e,n)}}const Dt=({element:t,attributes:e,children:n,styles:r})=>{const i=t.align;return s.jsx("h4",{...e,className:o.merge([i&&o.alignmentClassnames[i],o.getColumnBreakClasses(t)]),style:r,children:n})},To=t=>o.createPluginFactory({key:y.heading4,isElement:!0,component:Dt,deserializeHtml:{rules:[{validNodeName:["h4","H4"]}]}})({component:e=>s.jsx(Dt,{...e,styles:t})}),Po="textstyle-imageCaption-plugin";class fn extends o.Plugin{styles={};constructor({styles:e=P.imageCaption,...n}={}){super(y.imageCaption,{label:"Image Caption",markupElement:new Io,...n}),this.styles=e}plugins(){return[Eo(this.styles)]}}class Io extends o.MarkupElement{constructor(e=Po,n=Mt){super(e,n)}}const Mt=({element:t,attributes:e,children:n,styles:r})=>{const i=t.align;return s.jsx("p",{...e,className:o.merge([i&&o.alignmentClassnames[i],o.getColumnBreakClasses(t)]),style:r,children:n})},Eo=t=>o.createPluginFactory({key:y.imageCaption,isElement:!0,component:Mt,deserializeHtml:{rules:[{validClassName:y.imageCaption}]}})({component:e=>s.jsx(Mt,{...e,styles:t})}),jo="textstyle-imageTitle-plugin";class wn extends o.Plugin{styles={};constructor({styles:e=P.imageTitle,...n}={}){super(y.imageTitle,{label:"Image Title",markupElement:new Bo,...n}),this.styles=e}plugins(){return[No(this.styles)]}}class Bo extends o.MarkupElement{constructor(e=jo,n=Ft){super(e,n)}}const Ft=({element:t,attributes:e,children:n,styles:r})=>{const i=t.align;return s.jsx("p",{...e,className:o.merge([i&&o.alignmentClassnames[i],o.getColumnBreakClasses(t)]),style:r,children:n})},No=t=>o.createPluginFactory({key:y.imageTitle,isElement:!0,component:Ft,deserializeHtml:{rules:[{validClassName:y.imageTitle}]}})({component:e=>s.jsx(Ft,{...e,styles:t})});class yn extends o.Plugin{styles={};constructor({styles:e=P.p,...n}={}){super(y.p,{markupElement:new bn,label:"Body Text",...n}),this.styles=e}plugins(){return[vn(this.styles)]}}const xn="tw-m-0 tw-px-0 tw-py-0",wt=({element:t,attributes:e,children:n,styles:r})=>{const i=t.align,a=o.merge([i&&o.alignmentClassnames[i],xn,o.getColumnBreakClasses(t)]);return s.jsx("p",{...e,className:a,style:r,children:n})};class bn extends o.MarkupElement{constructor(e=y.p,n=wt){super(e,n)}}const vn=t=>o.createPluginFactory({...o.createParagraphPlugin(),key:y.p,isElement:!0,component:wt})({component:e=>s.jsx(wt,{...e,styles:t})}),Ao="textstyle-quote-plugin";class Cn extends o.Plugin{styles={};constructor({styles:e=P.quote,...n}={}){super(y.quote,{label:"Quote",markupElement:new Lo,...n}),this.styles=e}plugins(){return[Sn(this.styles)]}}class Lo extends o.MarkupElement{constructor(e=Ao,n=yt){super(e,n)}}const yt=({element:t,attributes:e,children:n,styles:r})=>{const i=t.align;return s.jsx("blockquote",{...e,className:o.merge([i&&o.alignmentClassnames[i],o.getColumnBreakClasses(t)]),style:r,children:n})},Sn=t=>o.createPluginFactory({key:y.quote,isElement:!0,component:yt,deserializeHtml:{rules:[{validNodeName:["blockquote","BLOCKQUOTE"]}]}})({component:e=>s.jsx(yt,{...e,styles:t})}),Xt=[new gn,new mn,new hn,new pn,new rn,new ln,new dn,new Cn,new yn],nt=[y.heading1,y.heading2,y.heading3,y.heading4,y.custom1,y.custom2,y.custom3,y.quote,y.p],Ro=[...Xt,new fn,new wn],Do=[...nt,y.imageCaption,y.imageTitle],Mo=[{color:"var(--f-theme-settings-list-bullet1-color, currentColor)",shape:"var(--f-theme-settings-list-bullet1-shape, '•')",size:"var(--f-theme-settings-list-bullet1-size, 1em)"},{color:"var(--f-theme-settings-list-bullet2-color, currentColor)",shape:"var(--f-theme-settings-list-bullet2-shape, '•')",size:"var(--f-theme-settings-list-bullet2-size, 1em)"},{color:"var(--f-theme-settings-list-bullet3-color, currentColor)",shape:"var(--f-theme-settings-list-bullet3-shape, '•')",size:"var(--f-theme-settings-list-bullet3-size, 1em)"}];class kn extends o.UnorderedListPlugin{constructor(e){super({listStyles:Mo,...e})}}const Fo=[{counterType:"var(--f-theme-settings-list-numbered1-counter-type, decimal)",color:"var(--f-theme-settings-list-numbered1-color, currentColor)"},{counterType:"var(--f-theme-settings-list-numbered2-counter-type, lower-alpha)",color:"var(--f-theme-settings-list-numbered2-color, currentColor)"},{counterType:"var(--f-theme-settings-list-numbered3-counter-type, lower-roman)",color:"var(--f-theme-settings-list-numbered3-color, currentColor)"}];class Tn extends o.OrderedListPlugin{constructor(e){super({listStyles:Fo,...e})}}const Oo=t=>new o.PluginComposer().setPlugin(new o.SoftBreakPlugin,new o.TextStylePlugin({textStyles:Xt})).setPlugin([new o.BoldPlugin,new o.ItalicPlugin,new o.UnderlinePlugin,new o.StrikethroughPlugin,new sn({appBridge:t}),new Ye({appBridge:t}),new o.CodePlugin],[new o.AlignLeftPlugin({validTypes:nt}),new o.AlignCenterPlugin({validTypes:nt}),new o.AlignRightPlugin({validTypes:nt}),new o.AlignJustifyPlugin({validTypes:nt}),new kn,new o.CheckboxListPlugin,new Tn,new o.ResetFormattingPlugin,new o.AutoformatPlugin]),_o="--f-theme-settings-",Uo=t=>{const e=t?.id?`hasBackground${t.id}`:"hasBackground",n=t?.id?`backgroundColor${t.id}`:"backgroundColor",r=t?.preventDefaultColor?void 0:t?.defaultColor||qn,i=t?.label?t.label:"Background",a=t?.switchLabel?t.switchLabel:void 0;return{id:e,label:i,type:"switch",switchLabel:a,defaultValue:!!t?.defaultValue,on:[{id:n,defaultValue:r,type:"colorInput"}]}},Ho=t=>{const e=t?.id?`hasBorder_${t.id}`:"hasBorder",n=t?.id?`borderSelection_${t.id}`:"borderSelection",r=t?.id?`borderStyle_${t.id}`:"borderStyle",i=t?.id?`borderWidth_${t.id}`:"borderWidth",a=t?.id?`borderColor_${t.id}`:"borderColor",c=t?.defaultColor||ce,d=t?.switchLabel?t.switchLabel:void 0;return{id:e,label:"Border",type:"switch",switchLabel:d,defaultValue:!!t?.defaultValue,on:[{id:n,type:"multiInput",layout:m.MultiInputLayout.Columns,lastItemFullWidth:!0,blocks:[{id:r,type:"dropdown",defaultValue:O.Solid,choices:[{value:O.Solid,label:O.Solid},{value:O.Dotted,label:O.Dotted},{value:O.Dashed,label:O.Dashed}]},{id:i,type:"input",defaultValue:Gn,rules:[m.numericalOrPixelRule,m.minimumNumericalOrPixelRule(0),m.maximumNumericalOrPixelOrAutoRule(500)],placeholder:"e.g. 3px",onChange:l=>m.appendUnit(l,i)},{id:a,type:"colorInput",defaultValue:c}]}],off:[]}},Jt=(t,e=$.None)=>({id:t,type:"segmentedControls",defaultValue:e,choices:[{value:$.None,label:"None"},{value:$.Small,label:"S"},{value:$.Medium,label:"M"},{value:$.Large,label:"L"}]}),zo=t=>{const e=t?.id?`hasRadius_${t.id}`:"hasRadius",n=t?.id?`radiusValue_${t.id}`:"radiusValue",r=t?.id?`radiusChoice_${t.id}`:"radiusChoice",i=t?.defaultRadius||$.None;return{id:e,label:"Corner radius",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"Determining how rounded the corners are.",show:a=>t?.dependentSettingId?!!a.getBlock(t.dependentSettingId)?.value:!0,onChange:a=>m.presetCustomValue(a,r,n,t?.radiusStyleMap||Q),on:[{id:n,type:"input",placeholder:"e.g. 10px",rules:[m.numericalOrPixelRule],onChange:a=>m.appendUnit(a,n)}],off:[Jt(r,i)]}},Vo=t=>{const e=t?.id?`hasExtendedCustomRadius_${t.id}`:"hasExtendedCustomRadius",n=t?.id?`extendedRadiusValue_${t.id}`:"extendedRadiusValue",r=t?.id?`extendedRadiusChoice_${t.id}`:"extendedRadiusChoice",i=t?.id?`extendedRadiusTopLeft_${t.id}`:"extendedRadiusTopLeft",a=t?.id?`extendedRadiusTopRight_${t.id}`:"extendedRadiusTopRight",c=t?.id?`extendedRadiusBottomLeft_${t.id}`:"extendedRadiusBottomLeft",d=t?.id?`extendedRadiusBottomRight_${t.id}`:"extendedRadiusBottomRight";return{id:e,label:"Corner radius",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"Determining how rounded the corners are.",show:l=>t?.dependentSettingId?!!l.getBlock(t.dependentSettingId)?.value:!0,onChange:l=>{m.presetCustomValue(l,r,i,Q),m.presetCustomValue(l,r,a,Q),m.presetCustomValue(l,r,c,Q),m.presetCustomValue(l,r,d,Q)},on:[{id:n,type:"multiInput",layout:m.MultiInputLayout.Columns,blocks:[{id:i,type:"input",label:"Top Left",rules:[m.numericalOrPixelRule],onChange:l=>m.appendUnit(l,i)},{id:a,type:"input",label:"Top Right",rules:[m.numericalOrPixelRule],onChange:l=>m.appendUnit(l,a)},{id:c,type:"input",label:"Bottom Left",rules:[m.numericalOrPixelRule],onChange:l=>m.appendUnit(l,c)},{id:d,type:"input",label:"Bottom Right",rules:[m.numericalOrPixelRule],onChange:l=>m.appendUnit(l,d)}]}],off:[Jt(r,t?.defaultValue)]}},$o=t=>{const e=t?.id?t.id:"hasCustomSpacing",n=t?.dependentSettingId?t.dependentSettingId:"columns",r=t?.spacingChoiceId?t.spacingChoiceId:"spacingChoice",i=t?.spacingCustomId?t.spacingCustomId:"spacingCustom",a=t?.defaultValueChoices?t.defaultValueChoices:Y.M;return{id:e,type:"switch",defaultValue:!1,switchLabel:"Custom",label:"Gutter",info:"An official nerds term for ‘gap’",onChange:c=>m.presetCustomValue(c,r,i,ue),show:c=>c.getBlock(n)?.value!=="1",on:[{id:i,type:"input",rules:[m.numericalOrPixelRule],onChange:c=>m.appendUnit(c,i)}],off:[{id:r,type:"slider",defaultValue:a,choices:[{value:Y.Auto,label:"Auto"},{value:Y.S,label:"S"},{value:Y.M,label:"M"},{value:Y.L,label:"L"}]}]}},Zt=t=>({id:t,type:"segmentedControls",defaultValue:K.None,choices:[{value:K.None,label:"None"},{value:K.Small,label:"S"},{value:K.Medium,label:"M"},{value:K.Large,label:"L"}]}),Wo=t=>{const e=t?.id?`hasCustomMarginValue_${t?.id}`:"hasCustomMarginValue",n=t?.id?`marginValue_${t?.id}`:"marginValue",r=t?.id?`marginChoice_${t?.id}`:"marginChoice";return{id:e,label:"Margin",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"The spacing around UI elements to create more space",onChange:i=>m.presetCustomValue(i,r,n,t?.marginStyleMap||et),on:[{id:n,type:"input",placeholder:dt,rules:[m.numericalOrPixelRule,m.maximumNumericalOrPixelOrAutoRule(500)],onChange:i=>m.appendUnit(i,n)}],off:[Zt(r)]}},qo=t=>{const e=t?.id?`hasExtendedCustomMargin_${t?.id}`:"hasExtendedCustomMargin",n=t?.id?`extendedMarginValues_${t?.id}`:"extendedMarginValues",r=t?.id?`extendedMarginChoice_${t?.id}`:"extendedMarginChoice",i=t?.id?`extendedMarginTop_${t?.id}`:"extendedMarginTop",a=t?.id?`extendedMarginLeft_${t?.id}`:"extendedMarginLeft",c=t?.id?`extendedMarginRight_${t?.id}`:"extendedMarginRight",d=t?.id?`extendedMarginBottom_${t?.id}`:"extendedMarginBottom";return{id:e,label:"Margin",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"The spacing around UI elements to create more negative space",onChange:l=>{m.presetCustomValue(l,r,i,et),m.presetCustomValue(l,r,a,et),m.presetCustomValue(l,r,c,et),m.presetCustomValue(l,r,d,et)},on:[{id:n,type:"multiInput",layout:m.MultiInputLayout.Spider,blocks:[{id:i,type:"input",label:"Top",placeholder:dt,onChange:l=>m.appendUnit(l,i),rules:[m.numericalOrPixelRule,m.maximumNumericalOrPixelOrAutoRule(500)]},{id:a,type:"input",label:"Left",placeholder:dt,onChange:l=>m.appendUnit(l,a),rules:[m.numericalOrPixelRule,m.maximumNumericalOrPixelOrAutoRule(500)]},{id:c,type:"input",label:"Right",placeholder:dt,onChange:l=>m.appendUnit(l,c),rules:[m.numericalOrPixelRule,m.maximumNumericalOrPixelOrAutoRule(500)]},{id:d,type:"input",label:"Bottom",placeholder:dt,onChange:l=>m.appendUnit(l,d),rules:[m.numericalOrPixelRule,m.maximumNumericalOrPixelOrAutoRule(500)]}]}],off:[Zt(r)]}},te=t=>({id:t,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"}]}),Go=t=>{const e=t?.id?`hasCustomPaddingValue_${t?.id}`:"hasCustomPaddingValue",n=t?.id?`paddingValue_${t?.id}`:"paddingValue",r=t?.id?`paddingChoice_${t?.id}`:"paddingChoice";return{id:e,label:"Padding",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"The spacing around UI elements to create more negative space",onChange:i=>m.presetCustomValue(i,r,n,t?.paddingStyleMap||tt),on:[{id:n,type:"input",placeholder:ct,rules:[m.numericalOrPixelRule,m.maximumNumericalOrPixelOrAutoRule(500)],onChange:i=>m.appendUnit(i,n)}],off:[te(r)]}},Ko=t=>{const e=t?.id?`hasExtendedCustomPadding_${t?.id}`:"hasExtendedCustomPadding",n=t?.id?`extendedPaddingValues_${t?.id}`:"extendedPaddingValues",r=t?.id?`extendedPaddingChoice_${t?.id}`:"extendedPaddingChoice",i=t?.id?`extendedPaddingTop_${t?.id}`:"extendedPaddingTop",a=t?.id?`extendedPaddingLeft_${t?.id}`:"extendedPaddingLeft",c=t?.id?`extendedPaddingRight_${t?.id}`:"extendedPaddingRight",d=t?.id?`extendedPaddingBottom_${t?.id}`:"extendedPaddingBottom";return{id:e,label:"Padding",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"The spacing around UI elements to create more negative space",onChange:l=>{m.presetCustomValue(l,r,i,tt),m.presetCustomValue(l,r,a,tt),m.presetCustomValue(l,r,c,tt),m.presetCustomValue(l,r,d,tt)},on:[{id:n,type:"multiInput",layout:m.MultiInputLayout.Spider,blocks:[{id:i,type:"input",label:"Top",placeholder:ct,onChange:l=>m.appendUnit(l,i),rules:[m.numericalOrPixelRule,m.maximumNumericalOrPixelOrAutoRule(500)]},{id:a,type:"input",label:"Left",placeholder:ct,onChange:l=>m.appendUnit(l,a),rules:[m.numericalOrPixelRule,m.maximumNumericalOrPixelOrAutoRule(500)]},{id:c,type:"input",label:"Right",placeholder:ct,onChange:l=>m.appendUnit(l,c),rules:[m.numericalOrPixelRule,m.maximumNumericalOrPixelOrAutoRule(500)]},{id:d,type:"input",label:"Bottom",placeholder:ct,onChange:l=>m.appendUnit(l,d),rules:[m.numericalOrPixelRule,m.maximumNumericalOrPixelOrAutoRule(500)]}]}],off:[te(r)]}},Yo=t=>{const e=ee(t?.globalControlId);return{id:t?.id?t.id:"downloadable",type:"switch",defaultValue:!1,label:"Downloadable",show:n=>n.getBlock(e)?.value===J.Custom}},ee=t=>t||"security",Qo=t=>[{id:ee(t),type:"segmentedControls",defaultValue:J.Global,choices:[{value:J.Global,label:"Global Settings"},{value:J.Custom,label:"Custom"}]},{id:"globalSettingsInfo",type:"notification",footer:m.createFooter({label:"Change global settings [here].",replace:{here:{event:"general-settings.open"}}})}];var Pn=(t=>(t.Main="main",t.Basics="basics",t.Layout="layout",t.Style="style",t.Security="security",t.Targets="targets",t))(Pn||{});const Xo=t=>t,Jo=t=>t;exports.AllTextStylePlugins=Ro;exports.AllTextStyles=Do;exports.AttachmentOperationsProvider=Qn;exports.Attachments=ve;exports.AttachmentsProvider=fe;exports.AttachmentsToolbarButton=ke;exports.BUTTON_PLUGIN=Ge;exports.BlockButtonStyles=kt;exports.BlockInjectButton=Mn;exports.BlockItemWrapper=Ne;exports.BlockStyles=P;exports.BorderStyle=O;exports.BreakAfterPlugin=so;exports.ButtonPlugin=Ye;exports.Custom1Plugin=rn;exports.Custom2Plugin=ln;exports.Custom3Plugin=dn;exports.DEFAULT_ATTACHMENTS_BUTTON_ID=Se;exports.DEFAULT_DRAGGING_TOOLTIP=Pe;exports.DEFAULT_DRAG_TOOLTIP=Te;exports.DEFAULT_MENU_BUTTON_ID=Vt;exports.DownloadButton=rs;exports.DragHandleToolbarButton=Ie;exports.DragPreviewContextProvider=ge;exports.ELEMENT_BUTTON=T;exports.FlyoutToolbarButton=Ee;exports.GAP_DEFAULT=on;exports.GutterSpacing=Y;exports.Heading1Plugin=gn;exports.Heading2Plugin=mn;exports.Heading3Plugin=hn;exports.Heading4Plugin=pn;exports.ImageCaptionPlugin=fn;exports.ImageTitlePlugin=wn;exports.KEY_ELEMENT_BREAK_AFTER_COLUMN=no;exports.LinkInput=We;exports.LinkPlugin=sn;exports.LinkSelector=$e;exports.Margin=K;exports.MenuToolbarButton=je;exports.MultiFlyoutContextProvider=me;exports.OrderedListPlugin=Tn;exports.PARAGRAPH_CLASSES=xn;exports.Padding=G;exports.ParagraphMarkupElement=bn;exports.ParagraphMarkupElementNode=wt;exports.ParagraphPlugin=yn;exports.QuoteMarkupElementNode=yt;exports.QuotePlugin=Cn;exports.Radius=$;exports.RichTextEditor=$s;exports.Sections=Pn;exports.Security=J;exports.THEME_PREFIX=_o;exports.TextStylePluginsWithoutImage=Xt;exports.TextStyles=y;exports.TextStylesWithoutImage=nt;exports.Toolbar=Be;exports.UnorderedListPlugin=kn;exports.addHttps=vt;exports.borderStyleMap=de;exports.convertToRteValue=ls;exports.createButtonNode=_e;exports.createButtonPlugin=Ke;exports.createLinkPlugin=nn;exports.createParagraphPlugin=vn;exports.createQuotePlugin=Sn;exports.customCoordinatesGetterFactory=ye;exports.defineBlock=Xo;exports.defineSettings=Jo;exports.getBackgroundColorStyles=Wn;exports.getBackgroundSettings=Uo;exports.getBorderRadiusSettings=zo;exports.getBorderRadiusSlider=Jt;exports.getBorderSettings=Ho;exports.getBorderStyles=Kn;exports.getDefaultPluginsWithLinkChooser=Oo;exports.getExtendedBorderRadiusSettings=Vo;exports.getGutterSettings=$o;exports.getLegacyUrl=ms;exports.getLinkFromEditor=ps;exports.getMarginExtendedSettings=qo;exports.getMarginSettings=Wo;exports.getMarginSlider=Zt;exports.getPaddingExtendedSettings=Ko;exports.getPaddingSettings=Go;exports.getPaddingSlider=te;exports.getRadiusStyles=Yn;exports.getReadableColor=Vn;exports.getSecurityDownloadableSetting=Yo;exports.getSecurityGlobalControlId=ee;exports.getSecurityGlobalControlSetting=Qo;exports.getUrl=hs;exports.getUrlFromEditor=Oe;exports.getUrlFromLinkOrLegacyLink=qt;exports.gutterSpacingStyleMap=ue;exports.hasRichTextValue=Ae;exports.insertButton=De;exports.isDark=On;exports.isDownloadable=cs;exports.isValidUrl=Ct;exports.isValidUrlOrEmpty=st;exports.joinClassNames=_;exports.mapAppBridgeColorPaletteToFonduePalette=Le;exports.mapAppBridgeColorPalettesToFonduePalettes=ds;exports.marginStyleMap=et;exports.moveItemInArray=$n;exports.paddingStyleMap=tt;exports.radiusStyleMap=Q;exports.relativeUrlRegex=Gt;exports.setAlpha=Hn;exports.submitFloatingButton=Kt;exports.toColorObject=zn;exports.toHex8String=_n;exports.toHexString=Un;exports.toRgbaString=Ot;exports.toShortRgba=Z;exports.triggerFloatingButton=Ue;exports.triggerFloatingButtonEdit=St;exports.triggerFloatingButtonInsert=Qt;exports.unwrapButton=ot;exports.upsertButton=Me;exports.upsertButtonText=Yt;exports.useAttachmentOperations=Ht;exports.useAttachments=pe;exports.useAttachmentsContext=we;exports.useDndSensors=ts;exports.useDragPreviewContext=it;exports.useMultiFlyoutContext=he;exports.useMultiFlyoutState=xt;exports.withAttachmentsProvider=Xn;exports.withButton=Re;exports.wrapButton=Fe;Object.keys(m).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>m[t]})});
|
|
10
10
|
//# sourceMappingURL=index.cjs.js.map
|