@payloadcms/richtext-lexical 3.0.0-beta.128 → 3.0.0-beta.129
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";import{a as Z,b as _l,c as Tl,d as El,f as wl,h as Nl,i as kl}from"./chunk-OOBB5GCO.js";import{a as Ie,b as vt,c as bl}from"./chunk-352SHIZR.js";import{a as Re,b as At,c as Se,d as Dt,e as Ot,f as Ft}from"./chunk-ZOYGBIAN.js";import{a as ye,b as Ye,c as Xe,d as Je}from"./chunk-XCEM47RI.js";import{a as Me,b as ve,c as Ae,d as $t}from"./chunk-O4IOO4EU.js";import{a as de,b as xe,c as qe,d as De,e as Oe,f as Fe,g as Pt}from"./chunk-75T7MDBH.js";import{a as xl,b as B}from"./chunk-PDAZFJVO.js";function U(t){return{items:t,key:"basic",label:({i18n:e})=>e.t("lexical:general:slashMenuBasicGroupLabel")}}import{$isElementNode as le,$isRangeSelection as et,FORMAT_ELEMENT_COMMAND as tt}from"lexical";import{jsx as Ht,jsxs as Ll}from"react/jsx-runtime";import"react";var Bo=()=>Ll("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Ht("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Ht("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Ht("path",{d:"M5 15H15",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Bt,jsxs as Il}from"react/jsx-runtime";import"react";var jo=()=>Il("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Bt("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Bt("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Bt("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as jt,jsxs as Rl}from"react/jsx-runtime";import"react";var Qe=()=>Rl("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[jt("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),jt("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),jt("path",{d:"M2.5 15H12.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Gt,jsxs as Sl}from"react/jsx-runtime";import"react";var Go=()=>Sl("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Gt("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Gt("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Gt("path",{d:"M7.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});var y=t=>o=>{let n={clientFeatureProps:o};if(typeof t=="function")n.feature=({featureProviderMap:r,resolvedFeatures:i,unSanitizedEditorConfig:l})=>{let s=t({featureProviderMap:r,props:o,resolvedFeatures:i,unSanitizedEditorConfig:l});return s.sanitizedClientFeatureProps===null&&(s.sanitizedClientFeatureProps=o),s};else{let r={...t};r.sanitizedClientFeatureProps=o,n.feature=r}return n};var Uo=t=>({type:"dropdown",ChildComponent:Qe,items:t,key:"align",order:30});var Wo=[Uo([{ChildComponent:Qe,isActive:({selection:t})=>{if(!et(t))return!1;for(let e of t.getNodes()){if(le(e)&&e.getFormatType()==="left")continue;let o=e.getParent();if(!(le(o)&&o.getFormatType()==="left"))return!1}return!0},key:"alignLeft",label:({i18n:t})=>t.t("lexical:align:alignLeftLabel"),onSelect:({editor:t})=>{t.dispatchCommand(tt,"left")},order:1},{ChildComponent:Bo,isActive:({selection:t})=>{if(!et(t))return!1;for(let e of t.getNodes()){if(le(e)&&e.getFormatType()==="center")continue;let o=e.getParent();if(!(le(o)&&o.getFormatType()==="center"))return!1}return!0},key:"alignCenter",label:({i18n:t})=>t.t("lexical:align:alignCenterLabel"),onSelect:({editor:t})=>{t.dispatchCommand(tt,"center")},order:2},{ChildComponent:Go,isActive:({selection:t})=>{if(!et(t))return!1;for(let e of t.getNodes()){if(le(e)&&e.getFormatType()==="right")continue;let o=e.getParent();if(!(le(o)&&o.getFormatType()==="right"))return!1}return!0},key:"alignRight",label:({i18n:t})=>t.t("lexical:align:alignRightLabel"),onSelect:({editor:t})=>{t.dispatchCommand(tt,"right")},order:3},{ChildComponent:jo,isActive:({selection:t})=>{if(!et(t))return!1;for(let e of t.getNodes()){if(le(e)&&e.getFormatType()==="justify")continue;let o=e.getParent();if(!(le(o)&&o.getFormatType()==="justify"))return!1}return!0},key:"alignJustify",label:({i18n:t})=>t.t("lexical:align:alignJustifyLabel"),onSelect:({editor:t})=>{t.dispatchCommand(tt,"justify")},order:4}])],yl=y({toolbarFixed:{groups:Wo},toolbarInline:{groups:Wo}});import{$createQuoteNode as Jo,$isQuoteNode as Yo,QuoteNode as Dl}from"@lexical/rich-text";import{$setBlocksType as qo}from"@lexical/selection";import{$getSelection as Qo,$isRangeSelection as Ol}from"lexical";import{jsx as Vo}from"react/jsx-runtime";import"react";var Ut=()=>Vo("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Vo("path",{d:"M13.5353 10.5725C13.5353 9.47709 11.0456 9.99991 11.0456 7.85883C11.0456 6.46464 12.1162 5.61816 13.361 5.61816C14.805 5.61816 16 6.86298 16 8.92937C16 11.2945 14.4564 13.7841 11.1203 14.3816L10.8216 13.1368C12.888 12.4895 13.5353 11.4937 13.5353 10.5725ZM6.71369 10.5725C6.71369 9.47709 4.22407 9.99991 4.22407 7.85883C4.22407 6.46464 5.29461 5.61816 6.53942 5.61816C7.9834 5.61816 9.17842 6.86298 9.17842 8.92937C9.17842 11.2945 7.63485 13.7841 4.29876 14.3816L4 13.1368C6.06639 12.4895 6.71369 11.4937 6.71369 10.5725Z",fill:"currentColor"})});import{jsx as Ko}from"react/jsx-runtime";import"react";var $e=()=>Ko("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Ko("path",{d:"M11.708 14.5H7.79785V13.9414H8.01367C9.00391 13.9414 9.15625 13.9033 9.15625 13.6113V6.70508H8.07715C6.82031 6.70508 6.73145 7.08594 6.28711 8.67285H5.80469L5.91895 6.12109H13.5869L13.7012 8.67285H13.2188C12.7744 7.08594 12.6855 6.70508 11.4287 6.70508H10.3496V13.6113C10.3496 13.9033 10.502 13.9414 11.4922 13.9414H11.708V14.5Z",fill:"currentColor"})});var V=t=>({type:"dropdown",ChildComponent:$e,items:t,key:"text",order:25});import{$createQuoteNode as Ml,$isQuoteNode as zo,QuoteNode as vl}from"@lexical/rich-text";import{$createLineBreakNode as Al}from"lexical";var Zo={type:"element",dependencies:[vl],export:(t,e)=>{if(!zo(t))return null;let o=e(t).split(`
|
|
2
2
|
`),n=[];for(let r of o)n.push("> "+r);return n.join(`
|
|
3
|
-
`)},regExp:/^>\s/,replace:(t,e,o,n)=>{if(n){let i=t.getPreviousSibling();if(zo(i)){i.splice(i.getChildrenSize(),0,[Al(),...e]),i.select(0,0),t.remove();return}}let r=Ml();r.append(...e),t.replace(r),r.select(0,0)}};var Xo=[V([{ChildComponent:Ut,isActive:({selection:t})=>{if(!Ol(t))return!1;for(let e of t.getNodes())if(!Yo(e)&&!Yo(e.getParent()))return!1;return!0},key:"blockquote",label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Qo();qo(e,()=>Jo())})},order:20}])],Fl=y({markdownTransformers:[Zo],nodes:[Dl],slashMenu:{groups:[U([{Icon:Ut,key:"blockquote",keywords:["quote","blockquote"],label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Qo();qo(e,()=>Jo())})}}])]},toolbarFixed:{groups:Xo},toolbarInline:{groups:Xo}});import{getTranslation as nt}from"@payloadcms/translations";import{jsx as Wt,jsxs as $l}from"react/jsx-runtime";import"react";var ot=()=>$l("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Wt("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"8",y:"5"}),Wt("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"5",y:"11"}),Wt("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"11",y:"11"})]});import{jsx as er}from"react/jsx-runtime";import"react";var rt=()=>er("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:er("path",{clipRule:"evenodd",d:"M5.33333 6.5C5.11232 6.5 4.90036 6.5878 4.74408 6.74408C4.5878 6.90036 4.5 7.11232 4.5 7.33333V12.1667C4.5 12.3877 4.5878 12.5996 4.74408 12.7559C4.90036 12.9122 5.11232 13 5.33333 13H14.6667C14.8877 13 15.0996 12.9122 15.2559 12.7559C15.4122 12.5996 15.5 12.3877 15.5 12.1667V11.6667C15.5 11.3905 15.7239 11.1667 16 11.1667C16.2761 11.1667 16.5 11.3905 16.5 11.6667V12.1667C16.5 12.6529 16.3068 13.1192 15.963 13.463C15.6192 13.8068 15.1529 14 14.6667 14H5.33333C4.8471 14 4.38079 13.8068 4.03697 13.463C3.69315 13.1192 3.5 12.6529 3.5 12.1667V7.33333C3.5 6.8471 3.69315 6.38079 4.03697 6.03697C4.38079 5.69315 4.8471 5.5 5.33333 5.5H10.3333C10.6095 5.5 10.8333 5.72386 10.8333 6C10.8333 6.27614 10.6095 6.5 10.3333 6.5H5.33333ZM13 6.5C12.7239 6.5 12.5 6.27614 12.5 6C12.5 5.72386 12.7239 5.5 13 5.5H16C16.2761 5.5 16.5 5.72386 16.5 6V9C16.5 9.27614 16.2761 9.5 16 9.5C15.7239 9.5 15.5 9.27614 15.5 9V7.20711L13.3536 9.35355C13.1583 9.54882 12.8417 9.54882 12.6464 9.35355C12.4512 9.15829 12.4512 8.84171 12.6464 8.64645L14.7929 6.5H13ZM6.16699 8.33325C6.16699 8.05711 6.39085 7.83325 6.66699 7.83325H11.0003C11.2765 7.83325 11.5003 8.05711 11.5003 8.33325C11.5003 8.60939 11.2765 8.83325 11.0003 8.83325H6.66699C6.39085 8.83325 6.16699 8.60939 6.16699 8.33325ZM6.16699 10.9999C6.16699 10.7238 6.39085 10.4999 6.66699 10.4999H13.3337C13.6098 10.4999 13.8337 10.7238 13.8337 10.9999C13.8337 11.2761 13.6098 11.4999 13.3337 11.4999H6.66699C6.39085 11.4999 6.16699 11.2761 6.16699 10.9999Z",fill:"currentColor",fillRule:"evenodd"})});import{c as Pl}from"react/compiler-runtime";import{jsx as Hl}from"react/jsx-runtime";import{useLexicalComposerContext as Bl}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as jl,$wrapNodeInElement as Gl,mergeRegister as Ul}from"@lexical/utils";import{getTranslation as Wl}from"@payloadcms/translations";import{formatDrawerSlug as Vl,useEditDepth as Kl,useTranslation as zl}from"@payloadcms/ui";import{$createParagraphNode as Zl,$getNodeByKey as Yl,$getPreviousSelection as Xl,$getSelection as tr,$insertNodes as Jl,$isParagraphNode as or,$isRangeSelection as rr,$isRootOrShadowRoot as ql,COMMAND_PRIORITY_EDITOR as Vt}from"lexical";import{useEffect as Ql,useState as Kt}from"react";var nr=()=>{let t=Pl(27),[e]=Bl(),[o,n]=Kt(null),[r,i]=Kt(""),[l,s]=Kt(null),{i18n:a,t:c}=zl(),{fieldProps:u}=B(),{featureClientSchemaMap:d,schemaPath:m}=u,{uuid:f}=B(),p=Kl(),h="lexical-inlineBlocks-create-"+f,g;t[0]!==h||t[1]!==p?(g=Vl({slug:h,depth:p}),t[0]=h,t[1]=p,t[2]=g):g=t[2];let k=g,{toggleDrawer:v}=xe(k,!0),A,b;if(t[3]!==e||t[4]!==l||t[5]!==v?(A=()=>{if(!e.hasNodes([Ie]))throw new Error("BlocksPlugin: BlocksNode not registered on editor");return Ul(e.registerCommand(Re,I=>(e.update(()=>{let T=tr()||Xl();if(rr(T)){let M=vt(I);jl(M);let{focus:O}=T,D=O.getNode();or(D)&&D.getTextContentSize()===0&&D.getParentOrThrow().getChildren().filter(j=>or(j)).length>1&&D.remove()}}),!0),Vt),e.registerCommand(At,I=>{if(l){let M=Yl(l);return!M||!Ft(M)?!1:(M.setFields(I),s(null),!0)}let T=Ot(I);return Jl([T]),ql(T.getParentOrThrow())&&Gl(T,Zl).selectEnd(),!0},Vt),e.registerCommand(Se,I=>{let{fields:T,nodeKey:M}=I;if(n(T??null),s(M??null),i(T?.blockType??""),M)return v(),!0;let O;return O=null,e.getEditorState().read(()=>{let D=tr();rr(D)&&(O=D)}),O&&v(),!0},Vt))},b=[e,l,v],t[3]=e,t[4]=l,t[5]=v,t[6]=A,t[7]=b):(A=t[6],b=t[7]),Ql(A,b),!o)return null;let E=`${m}.lexical_internal_feature.blocks.lexical_inline_blocks.${o?.blockType}`,L=d.blocks[E][0],S=L.blocks[0];if(!L)return null;let w;t[8]!==S||t[9]!==a?(w=S?.labels?.singular?Wl(S?.labels?.singular,a):S?.slug,t[8]=S,t[9]=a,t[10]=w):w=t[10];let C=w,R=`lexical:blocks:inlineBlocks:${o?.id?"edit":"create"}`,N;t[11]!==C||t[12]!==c?(N=C??c("lexical:blocks:inlineBlocks:label"),t[11]=C,t[12]=c,t[13]=N):N=t[13];let _;if(t[14]!==N||t[15]!==c||t[16]!==R||t[17]!==S?.fields||t[18]!==r||t[19]!==e||t[20]!==o||t[21]!==k||t[22]!==m){let I;t[24]!==r||t[25]!==e?(I=(T,M)=>{M&&(M.blockType=r,e.dispatchCommand(At,M))},t[24]=r,t[25]=e,t[26]=I):I=t[26],_=Hl(de,{data:o,drawerSlug:k,drawerTitle:c(R,{label:N}),featureKey:"blocks",fieldMapOverride:S?.fields,handleDrawerSubmit:I,schemaPath:m,schemaPathSuffix:`lexical_blocks.${o?.blockType}.fields`}),t[14]=N,t[15]=c,t[16]=R,t[17]=S?.fields,t[18]=r,t[19]=e,t[20]=o,t[21]=k,t[22]=m,t[23]=_}else _=t[23];return _};var es=y(({props:t})=>({nodes:[Ie,Dt],plugins:[{Component:nr,position:"normal"}],sanitizedClientFeatureProps:t,slashMenu:{groups:[t.clientBlockSlugs?.length?{items:t.clientBlockSlugs.map(e=>({Icon:ot,key:"block-"+e,keywords:["block","blocks",e],label:({featureClientSchemaMap:o,i18n:n,schemaPath:r})=>{if(!o)return e;let i=`${r}.lexical_internal_feature.blocks.lexical_blocks.${e}`,a=o.blocks[i][0].blocks[0];return a?.labels?.singular?nt(a.labels.singular,n):a?.slug},onSelect:({editor:o})=>{o.dispatchCommand(Re,{blockName:"",blockType:e})}})),key:"blocks",label:({i18n:e})=>e.t("lexical:blocks:label")}:null,t.clientInlineBlockSlugs?.length?{items:t.clientInlineBlockSlugs.map(e=>({Icon:rt,key:"inlineBlocks-"+e,keywords:["inlineBlock","inline block",e],label:({featureClientSchemaMap:o,i18n:n,schemaPath:r})=>{let i=`${r}.lexical_internal_feature.blocks.lexical_inline_blocks.${e}`,a=o.blocks[i][0].blocks[0];return a?.labels?.singular?nt(a.labels.singular,n):a?.slug},onSelect:({editor:o})=>{o.dispatchCommand(Se,{fields:{blockName:"",blockType:e}})}})),key:"inlineBlocks",label:({i18n:e})=>e.t("lexical:blocks:inlineBlocks:label")}:null].filter(Boolean)},toolbarFixed:{groups:[t.clientBlockSlugs?.length?{type:"dropdown",ChildComponent:ot,items:t.clientBlockSlugs.map((e,o)=>({ChildComponent:ot,isActive:void 0,key:"block-"+e,label:({featureClientSchemaMap:n,i18n:r,schemaPath:i})=>{let l=`${i}.lexical_internal_feature.blocks.lexical_blocks.${e}`,c=n.blocks[l][0].blocks[0];return c?.labels?.singular?nt(c.labels.singular,r):c?.slug},onSelect:({editor:n})=>{n.dispatchCommand(Re,{blockName:"",blockType:e})},order:o})),key:"blocks",order:20}:null,t.clientInlineBlockSlugs?.length?{type:"dropdown",ChildComponent:rt,items:t.clientInlineBlockSlugs.map((e,o)=>({ChildComponent:rt,isActive:void 0,key:"inlineBlock-"+e,label:({featureClientSchemaMap:n,i18n:r,schemaPath:i})=>{if(!n)return e;let l=`${i}.lexical_internal_feature.blocks.lexical_inline_blocks.${e}`,c=n.blocks[l][0].blocks[0];return c?.labels?.singular?nt(c.labels.singular,r):c?.slug},onSelect:({editor:n})=>{n.dispatchCommand(Se,{fields:{blockType:e}})},order:o})),key:"inlineBlocks",order:25}:null].filter(Boolean)}}));import{c as rs}from"react/compiler-runtime";import{jsx as pe,jsxs as Yt}from"react/jsx-runtime";import{useLexicalComposerContext as ns}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as is,$createTextNode as ls,$getRoot as ss}from"lexical";import*as cr from"react";import{useCallback as me,useEffect as zt,useLayoutEffect as lr,useRef as Zt,useState as it}from"react";var ts=Z&&"documentMode"in document?document.documentMode:null,ir=Z&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),R1=Z&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),S1=Z&&"InputEvent"in window&&!ts?"getTargetRanges"in new window.InputEvent("input"):!1,y1=Z&&/Version\/[\d.].*Safari/.test(navigator.userAgent),M1=Z&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,v1=Z&&/Android/.test(navigator.userAgent),A1=Z&&/Win/.test(navigator.platform),os=Z&&/^(?=.*Chrome).*/i.test(navigator.userAgent),D1=Z&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!os;var as=t=>{let e=document.createElement("textarea");e.value=t||"",e.style.position="absolute",e.style.opacity="0",document.body?.appendChild(e),e.focus(),e.select();try{let o=document.execCommand("copy");console.log(o)}catch(o){console.error(o)}document.body?.removeChild(e)},cs=(t,e)=>{let o=document.createElement("a");o.setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(e||"")),o.setAttribute("download",t),o.style.display="none",document.body?.appendChild(o),o.click(),document.body?.removeChild(o)},us=t=>{let o=((n,r)=>{switch(n){case"click":return` await page.mouse.click(${r.x}, ${r.y});`;case"keydown":return` await page.keyboard.keydown('${r}');`;case"keyup":return` await page.keyboard.keyup('${r}');`;case"press":return` await page.keyboard.press('${r}');`;case"selectAll":return" await selectAll(page);";case"snapshot":return` await assertHTMLSnapshot(page);
|
|
3
|
+
`)},regExp:/^>\s/,replace:(t,e,o,n)=>{if(n){let i=t.getPreviousSibling();if(zo(i)){i.splice(i.getChildrenSize(),0,[Al(),...e]),i.select(0,0),t.remove();return}}let r=Ml();r.append(...e),t.replace(r),r.select(0,0)}};var Xo=[V([{ChildComponent:Ut,isActive:({selection:t})=>{if(!Ol(t))return!1;for(let e of t.getNodes())if(!Yo(e)&&!Yo(e.getParent()))return!1;return!0},key:"blockquote",label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Qo();qo(e,()=>Jo())})},order:20}])],Fl=y({markdownTransformers:[Zo],nodes:[Dl],slashMenu:{groups:[U([{Icon:Ut,key:"blockquote",keywords:["quote","blockquote"],label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Qo();qo(e,()=>Jo())})}}])]},toolbarFixed:{groups:Xo},toolbarInline:{groups:Xo}});import{getTranslation as nt}from"@payloadcms/translations";import{jsx as Wt,jsxs as $l}from"react/jsx-runtime";import"react";var ot=()=>$l("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Wt("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"8",y:"5"}),Wt("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"5",y:"11"}),Wt("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"11",y:"11"})]});import{jsx as er}from"react/jsx-runtime";import"react";var rt=()=>er("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:er("path",{clipRule:"evenodd",d:"M5.33333 6.5C5.11232 6.5 4.90036 6.5878 4.74408 6.74408C4.5878 6.90036 4.5 7.11232 4.5 7.33333V12.1667C4.5 12.3877 4.5878 12.5996 4.74408 12.7559C4.90036 12.9122 5.11232 13 5.33333 13H14.6667C14.8877 13 15.0996 12.9122 15.2559 12.7559C15.4122 12.5996 15.5 12.3877 15.5 12.1667V11.6667C15.5 11.3905 15.7239 11.1667 16 11.1667C16.2761 11.1667 16.5 11.3905 16.5 11.6667V12.1667C16.5 12.6529 16.3068 13.1192 15.963 13.463C15.6192 13.8068 15.1529 14 14.6667 14H5.33333C4.8471 14 4.38079 13.8068 4.03697 13.463C3.69315 13.1192 3.5 12.6529 3.5 12.1667V7.33333C3.5 6.8471 3.69315 6.38079 4.03697 6.03697C4.38079 5.69315 4.8471 5.5 5.33333 5.5H10.3333C10.6095 5.5 10.8333 5.72386 10.8333 6C10.8333 6.27614 10.6095 6.5 10.3333 6.5H5.33333ZM13 6.5C12.7239 6.5 12.5 6.27614 12.5 6C12.5 5.72386 12.7239 5.5 13 5.5H16C16.2761 5.5 16.5 5.72386 16.5 6V9C16.5 9.27614 16.2761 9.5 16 9.5C15.7239 9.5 15.5 9.27614 15.5 9V7.20711L13.3536 9.35355C13.1583 9.54882 12.8417 9.54882 12.6464 9.35355C12.4512 9.15829 12.4512 8.84171 12.6464 8.64645L14.7929 6.5H13ZM6.16699 8.33325C6.16699 8.05711 6.39085 7.83325 6.66699 7.83325H11.0003C11.2765 7.83325 11.5003 8.05711 11.5003 8.33325C11.5003 8.60939 11.2765 8.83325 11.0003 8.83325H6.66699C6.39085 8.83325 6.16699 8.60939 6.16699 8.33325ZM6.16699 10.9999C6.16699 10.7238 6.39085 10.4999 6.66699 10.4999H13.3337C13.6098 10.4999 13.8337 10.7238 13.8337 10.9999C13.8337 11.2761 13.6098 11.4999 13.3337 11.4999H6.66699C6.39085 11.4999 6.16699 11.2761 6.16699 10.9999Z",fill:"currentColor",fillRule:"evenodd"})});import{c as Pl}from"react/compiler-runtime";import{jsx as Hl}from"react/jsx-runtime";import{useLexicalComposerContext as Bl}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as jl,$wrapNodeInElement as Gl,mergeRegister as Ul}from"@lexical/utils";import{getTranslation as Wl}from"@payloadcms/translations";import{formatDrawerSlug as Vl,useEditDepth as Kl,useTranslation as zl}from"@payloadcms/ui";import{$createParagraphNode as Zl,$getNodeByKey as Yl,$getPreviousSelection as Xl,$getSelection as tr,$insertNodes as Jl,$isParagraphNode as or,$isRangeSelection as rr,$isRootOrShadowRoot as ql,COMMAND_PRIORITY_EDITOR as Vt}from"lexical";import{useEffect as Ql,useState as Kt}from"react";var nr=()=>{let t=Pl(27),[e]=Bl(),[o,n]=Kt(null),[r,i]=Kt(""),[l,s]=Kt(null),{i18n:a,t:c}=zl(),{fieldProps:u}=B(),{featureClientSchemaMap:d,schemaPath:m}=u,{uuid:f}=B(),p=Kl(),h="lexical-inlineBlocks-create-"+f,g;t[0]!==h||t[1]!==p?(g=Vl({slug:h,depth:p}),t[0]=h,t[1]=p,t[2]=g):g=t[2];let k=g,{toggleDrawer:v}=xe(k,!0),A,b;if(t[3]!==e||t[4]!==l||t[5]!==v?(A=()=>{if(!e.hasNodes([Ie]))throw new Error("BlocksPlugin: BlocksNode not registered on editor");return Ul(e.registerCommand(Re,I=>(e.update(()=>{let T=tr()||Xl();if(rr(T)){let M=vt(I);jl(M);let{focus:O}=T,D=O.getNode();or(D)&&D.getTextContentSize()===0&&D.getParentOrThrow().getChildren().filter(j=>or(j)).length>1&&D.remove()}}),!0),Vt),e.registerCommand(At,I=>{if(l){let M=Yl(l);return!M||!Ft(M)?!1:(M.setFields(I),s(null),!0)}let T=Ot(I);return Jl([T]),ql(T.getParentOrThrow())&&Gl(T,Zl).selectEnd(),!0},Vt),e.registerCommand(Se,I=>{let{fields:T,nodeKey:M}=I;if(n(T??null),s(M??null),i(T?.blockType??""),M)return v(),!0;let O;return O=null,e.getEditorState().read(()=>{let D=tr();rr(D)&&(O=D)}),O&&v(),!0},Vt))},b=[e,l,v],t[3]=e,t[4]=l,t[5]=v,t[6]=A,t[7]=b):(A=t[6],b=t[7]),Ql(A,b),!o)return null;let E=`${m}.lexical_internal_feature.blocks.lexical_inline_blocks.${o?.blockType}`,L=d.blocks[E][0],S=L.blocks[0];if(!L)return null;let w;t[8]!==S||t[9]!==a?(w=S?.labels?.singular?Wl(S?.labels?.singular,a):S?.slug,t[8]=S,t[9]=a,t[10]=w):w=t[10];let C=w,R=`lexical:blocks:inlineBlocks:${o?.id?"edit":"create"}`,N;t[11]!==C||t[12]!==c?(N=C??c("lexical:blocks:inlineBlocks:label"),t[11]=C,t[12]=c,t[13]=N):N=t[13];let _;if(t[14]!==N||t[15]!==c||t[16]!==R||t[17]!==S?.fields||t[18]!==r||t[19]!==e||t[20]!==o||t[21]!==k||t[22]!==m){let I;t[24]!==r||t[25]!==e?(I=(T,M)=>{M&&(M.blockType=r,e.dispatchCommand(At,M))},t[24]=r,t[25]=e,t[26]=I):I=t[26],_=Hl(de,{data:o,drawerSlug:k,drawerTitle:c(R,{label:N}),featureKey:"blocks",fieldMapOverride:S?.fields,handleDrawerSubmit:I,schemaPath:m,schemaPathSuffix:`lexical_inline_blocks.${o?.blockType}.fields`}),t[14]=N,t[15]=c,t[16]=R,t[17]=S?.fields,t[18]=r,t[19]=e,t[20]=o,t[21]=k,t[22]=m,t[23]=_}else _=t[23];return _};var es=y(({props:t})=>({nodes:[Ie,Dt],plugins:[{Component:nr,position:"normal"}],sanitizedClientFeatureProps:t,slashMenu:{groups:[t.clientBlockSlugs?.length?{items:t.clientBlockSlugs.map(e=>({Icon:ot,key:"block-"+e,keywords:["block","blocks",e],label:({featureClientSchemaMap:o,i18n:n,schemaPath:r})=>{if(!o)return e;let i=`${r}.lexical_internal_feature.blocks.lexical_blocks.${e}`,a=o.blocks[i][0].blocks[0];return a?.labels?.singular?nt(a.labels.singular,n):a?.slug},onSelect:({editor:o})=>{o.dispatchCommand(Re,{blockName:"",blockType:e})}})),key:"blocks",label:({i18n:e})=>e.t("lexical:blocks:label")}:null,t.clientInlineBlockSlugs?.length?{items:t.clientInlineBlockSlugs.map(e=>({Icon:rt,key:"inlineBlocks-"+e,keywords:["inlineBlock","inline block",e],label:({featureClientSchemaMap:o,i18n:n,schemaPath:r})=>{let i=`${r}.lexical_internal_feature.blocks.lexical_inline_blocks.${e}`,a=o.blocks[i][0].blocks[0];return a?.labels?.singular?nt(a.labels.singular,n):a?.slug},onSelect:({editor:o})=>{o.dispatchCommand(Se,{fields:{blockName:"",blockType:e}})}})),key:"inlineBlocks",label:({i18n:e})=>e.t("lexical:blocks:inlineBlocks:label")}:null].filter(Boolean)},toolbarFixed:{groups:[t.clientBlockSlugs?.length?{type:"dropdown",ChildComponent:ot,items:t.clientBlockSlugs.map((e,o)=>({ChildComponent:ot,isActive:void 0,key:"block-"+e,label:({featureClientSchemaMap:n,i18n:r,schemaPath:i})=>{let l=`${i}.lexical_internal_feature.blocks.lexical_blocks.${e}`,c=n.blocks[l][0].blocks[0];return c?.labels?.singular?nt(c.labels.singular,r):c?.slug},onSelect:({editor:n})=>{n.dispatchCommand(Re,{blockName:"",blockType:e})},order:o})),key:"blocks",order:20}:null,t.clientInlineBlockSlugs?.length?{type:"dropdown",ChildComponent:rt,items:t.clientInlineBlockSlugs.map((e,o)=>({ChildComponent:rt,isActive:void 0,key:"inlineBlock-"+e,label:({featureClientSchemaMap:n,i18n:r,schemaPath:i})=>{if(!n)return e;let l=`${i}.lexical_internal_feature.blocks.lexical_inline_blocks.${e}`,c=n.blocks[l][0].blocks[0];return c?.labels?.singular?nt(c.labels.singular,r):c?.slug},onSelect:({editor:n})=>{n.dispatchCommand(Se,{fields:{blockType:e}})},order:o})),key:"inlineBlocks",order:25}:null].filter(Boolean)}}));import{c as rs}from"react/compiler-runtime";import{jsx as pe,jsxs as Yt}from"react/jsx-runtime";import{useLexicalComposerContext as ns}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as is,$createTextNode as ls,$getRoot as ss}from"lexical";import*as cr from"react";import{useCallback as me,useEffect as zt,useLayoutEffect as lr,useRef as Zt,useState as it}from"react";var ts=Z&&"documentMode"in document?document.documentMode:null,ir=Z&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),R1=Z&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),S1=Z&&"InputEvent"in window&&!ts?"getTargetRanges"in new window.InputEvent("input"):!1,y1=Z&&/Version\/[\d.].*Safari/.test(navigator.userAgent),M1=Z&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,v1=Z&&/Android/.test(navigator.userAgent),A1=Z&&/Win/.test(navigator.platform),os=Z&&/^(?=.*Chrome).*/i.test(navigator.userAgent),D1=Z&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!os;var as=t=>{let e=document.createElement("textarea");e.value=t||"",e.style.position="absolute",e.style.opacity="0",document.body?.appendChild(e),e.focus(),e.select();try{let o=document.execCommand("copy");console.log(o)}catch(o){console.error(o)}document.body?.removeChild(e)},cs=(t,e)=>{let o=document.createElement("a");o.setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(e||"")),o.setAttribute("download",t),o.style.display="none",document.body?.appendChild(o),o.click(),document.body?.removeChild(o)},us=t=>{let o=((n,r)=>{switch(n){case"click":return` await page.mouse.click(${r.x}, ${r.y});`;case"keydown":return` await page.keyboard.keydown('${r}');`;case"keyup":return` await page.keyboard.keyup('${r}');`;case"press":return` await page.keyboard.press('${r}');`;case"selectAll":return" await selectAll(page);";case"snapshot":return` await assertHTMLSnapshot(page);
|
|
4
4
|
await assertSelection(page, {
|
|
5
5
|
anchorPath: [${r.anchorPath.toString()}],
|
|
6
6
|
anchorOffset: ${r.anchorOffset},
|