@payloadcms/richtext-lexical 3.7.0 → 3.7.1-canary.6b01088

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.
@@ -0,0 +1,2 @@
1
+ "use client";import{c as fe,g as j,h as B,j as pe,k as ge,l as he,m as ye,n as xe}from"./chunk-XOABLBHB.js";import{a as de,b as R}from"./chunk-CUIBIFW2.js";import{jsx as F,jsxs as se}from"react/jsx-runtime";import{FieldDescription as eo,FieldError as to,FieldLabel as oo,RenderCustomComponent as Ze,useEditDepth as no,useField as ro}from"@payloadcms/ui";import{mergeFieldStyles as io}from"@payloadcms/ui/shared";import{useCallback as et,useMemo as so}from"react";import{ErrorBoundary as lo}from"react-error-boundary";import"./bundled.css";import{jsx as A}from"react/jsx-runtime";import{LexicalComposer as Xt}from"@lexical/react/LexicalComposer.js";import*as Je from"react";import{useMemo as Zt}from"react";import{c as $t}from"react/compiler-runtime";import{jsx as w,jsxs as q}from"react/jsx-runtime";import{useLexicalComposerContext as Ht}from"@lexical/react/LexicalComposerContext.js";import{LexicalErrorBoundary as jt}from"@lexical/react/LexicalErrorBoundary.js";import{HistoryPlugin as zt}from"@lexical/react/LexicalHistoryPlugin.js";import{OnChangePlugin as Kt}from"@lexical/react/LexicalOnChangePlugin.js";import{RichTextPlugin as Gt}from"@lexical/react/LexicalRichTextPlugin.js";import{BLUR_COMMAND as Wt,COMMAND_PRIORITY_LOW as Ye,FOCUS_COMMAND as Yt}from"lexical";import*as Y from"react";import{useEffect as Ue,useState as Ve}from"react";import{jsx as Ee}from"react/jsx-runtime";import"react";var O=({anchorElem:t,clientProps:e,plugin:o})=>o.position==="floatingAnchorElem"&&t?o.Component&&Ee(o.Component,{anchorElem:t,clientProps:e}):o.Component&&Ee(o.Component,{clientProps:e});import{jsx as ce}from"react/jsx-runtime";import{useLexicalComposerContext as st}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as lt}from"lexical";import*as Pe from"react";import{useCallback as at,useEffect as Ne,useRef as ct,useState as mt}from"react";import{createPortal as ut}from"react-dom";var z=(t,e,o,n,r=50,m=25)=>{let l=0;if(t&&!t.contains(n)){let{bottom:a,left:d,right:g,top:y}=t.getBoundingClientRect(),s=y+window.scrollY,i=a+window.scrollY;if(o<s-m||o>i+m||e<d-r||e>g+r)return-1;(e<d||e>g)&&(l=e<d?e-d:e-g)}return l};import{$getNodeByKey as Z}from"lexical";function K(t){let e=t.getBoundingClientRect(),o=getComputedStyle(t).getPropertyValue("transform");if(!o||o==="none")return e;let n=o.split(",").pop();return e.y=e.y-Number(n?.replace(")","")),e}function X(t){let e=(d,g)=>d?parseFloat(window.getComputedStyle(d)[g]):0,{marginBottom:o,marginTop:n}=window.getComputedStyle(t),r=e(t.previousElementSibling,"marginBottom"),m=e(t.nextElementSibling,"marginTop"),l=Math.max(parseFloat(n),r);return{marginBottom:Math.max(parseFloat(o),m),marginTop:l}}import{$getRoot as tt}from"lexical";function _(t){return t.getEditorState().read(()=>tt().getChildrenKeys())}var ot=1,nt=-1,be=0,v={props:null,result:null};function rt(t,e,o=20){let n=t.x-e.x,r=t.y-e.y;return n*n+r*r<=o*o}function G(t){let{anchorElem:e,cache_threshold:o=20,editor:n,fuzzy:r=!1,horizontalOffset:m=0,point:{x:l,y:a},startIndex:d=0,useEdgeAsDefault:g=!1}=t;if(o>0&&v.props&&v.result&&v.props.fuzzy===t.fuzzy&&v.props.horizontalOffset===t.horizontalOffset&&v.props.useEdgeAsDefault===t.useEdgeAsDefault&&rt(v.props.point,t.point,o))return v.result;let y=e.getBoundingClientRect(),s=_(n),i={blockElem:null,blockNode:null,distance:1/0,foundAtIndex:-1,isFoundNodeEmptyParagraph:!1};return n.getEditorState().read(()=>{if(g){let[p,h]=[n.getElementByKey(s[0]),n.getElementByKey(s[s.length-1])];if(p&&h){let[f,c]=[K(p),K(h)];if(a<f.top?(i.blockElem=p,i.distance=f.top-a,i.blockNode=Z(s[0]),i.foundAtIndex=0):a>c.bottom&&(i.distance=a-c.bottom,i.blockNode=Z(s[s.length-1]),i.blockElem=h,i.foundAtIndex=s.length-1),i?.blockElem)return{blockElem:null,isFoundNodeEmptyParagraph:!1}}}let u=d,x=be;for(;u>=0&&u<s.length;){let p=s[u],h=n.getElementByKey(p);if(h===null)break;let f=new B(l+m,a),c=ye.fromDOMRect(K(h)),{marginBottom:E,marginTop:b}=X(h),N=c.generateNewRect({bottom:c.bottom+E,left:y.left,right:y.right,top:c.top-b}),{distance:C,isOnBottomSide:k,isOnTopSide:P}=N.distanceFromPoint(f);if(C===0){i.blockElem=h,i.blockNode=Z(p),i.foundAtIndex=u,i.distance=C,i.blockNode&&i.blockNode.getType()==="paragraph"&&i.blockNode.getTextContent()===""&&(!r&&!t.returnEmptyParagraphs&&(i.blockElem=null,i.blockNode=null),i.isFoundNodeEmptyParagraph=!0);break}else r&&C<i.distance&&(i.blockElem=h,i.blockNode=Z(p),i.distance=C,i.foundAtIndex=u);x===be&&(P?x=nt:k?x=ot:x=1/0),u+=x}}),v.props=t,v.result={blockElem:i.blockElem,blockNode:i.blockNode,foundAtIndex:i.foundAtIndex,isFoundNodeEmptyParagraph:i.isFoundNodeEmptyParagraph},{blockElem:i.blockElem,blockNode:i.blockNode,foundAtIndex:i.foundAtIndex,isFoundNodeEmptyParagraph:i.isFoundNodeEmptyParagraph}}function ee(t,e){return!!t.closest(`.${e}`)}var it=["IMG","INPUT","TEXTAREA","SELECT","BUTTON","VIDEO","OBJECT","EMBED","IFRAME","HR"];function Ce(t){if(!t||it.includes(t.tagName)||t.offsetHeight===0||t.offsetWidth===0)return!1;let e=window.getComputedStyle(t);return!(e.display==="table-cell"||e.position==="absolute"||e.visibility==="hidden"||e.opacity==="0")}function te(t,e,o,n=0){if(!t){e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)";return}let r=t.getBoundingClientRect(),m=window.getComputedStyle(t),l=e.getBoundingClientRect(),a=o.getBoundingClientRect(),d;if(["lexical-block","lexical-upload","lexical-relationship"].some(s=>t.firstElementChild?.classList.contains(s)))d=r.top+8-a.top;else{let s=Ce(t)?parseInt(m.lineHeight,10):0;d=r.top+(s-l.height)/2-a.top}let y=n;e.style.opacity="1",e.style.transform=`translate(${y}px, ${d}px)`}var dt="add-block-menu",oe=1/0;function ft(t){return t===0?1/0:oe>=0&&oe<t?oe:Math.floor(t/2)}function pt(t,e,o){let n=e.parentElement,{editorConfig:r}=R(),m=r?.admin?.hideGutter?-24:12,l=ct(null),[a,d]=mt(null);Ne(()=>{function y(s){let i=s.target;if(!j(i))return;let u=z(n,s.pageX,s.pageY,i);if(u===-1){d(null);return}if(ee(i,dt))return;let x=_(t),{blockElem:p,blockNode:h,foundAtIndex:f}=G({anchorElem:e,cache_threshold:0,editor:t,horizontalOffset:-u,point:new B(s.x,s.y),returnEmptyParagraphs:!0,startIndex:ft(x.length),useEdgeAsDefault:!1});oe=f,p&&h&&(a?.node!==h||a?.elem!==p)&&d({elem:p,node:h})}return document?.addEventListener("mousemove",y),()=>{document?.removeEventListener("mousemove",y)}},[n,e,t,a]),Ne(()=>{l.current&&a?.node&&te(a?.elem,l.current,e,m)},[e,a,m]);let g=at(y=>{let s=a;s?.node&&(t.update(()=>{let i=!0;if((s?.node.getType()!=="paragraph"||s.node.getTextContent()!=="")&&(i=!1),!i){let u=lt();s?.node.insertAfter(u),setTimeout(()=>{s={elem:t.getElementByKey(u.getKey()),node:u},d(s)},0)}}),setTimeout(()=>{t.update(()=>{t.focus(),s?.node&&"select"in s.node&&typeof s.node.select=="function"&&s.node.select()})},1),setTimeout(()=>{t.dispatchCommand(ge,{node:s?.node})},2),y.stopPropagation(),y.preventDefault())},[t,a]);return ut(ce(Pe.Fragment,{children:ce("button",{"aria-label":"Add block",className:"icon add-block-menu",onClick:y=>{g(y)},ref:l,type:"button",children:ce("div",{className:o?"icon":""})})}),e)}function we(t){let{anchorElem:e}=t,o=e===void 0?document.body:e,[n]=st();return pt(n,o,n._editable)}import{jsx as ne,jsxs as ht}from"react/jsx-runtime";import{useLexicalComposerContext as yt}from"@lexical/react/LexicalComposerContext.js";import{eventFiles as ke}from"@lexical/rich-text";import{$getNearestNodeFromDOMNode as Se,$getNodeByKey as xt}from"lexical";import*as Ae from"react";import{useEffect as me,useRef as re,useState as ve}from"react";import{createPortal as Et}from"react-dom";var Te=0,gt=-24;var $=0;function Re(t,e,o,n,r,m,l,a,d,g=!1){let{height:y,top:s}=n.getBoundingClientRect(),{top:i,width:u}=l.getBoundingClientRect(),{marginBottom:x,marginTop:p}=X(n),h=s,f=m>=s+y/2+window.scrollY,c=!1;if(r?.elem)if(n!==r?.elem)(f&&r?.elem&&r?.elem===n.nextElementSibling||!f&&r?.elem&&r?.elem===n.previousElementSibling)&&($++,$<200&&(c=!0));else{$++;let C=r?.boundingBox?.y,k=n.getBoundingClientRect().y;(f===r?.isBelow&&C===k||$<200)&&(c=!1)}if(c)return{isBelow:f,willStayInSamePosition:c};g?h+=y/2:f?h+=y+x/2:h-=p/2;let E=0;g||(f?E=-Te:E=Te);let b=h-i+E,N=gt-e;return o.style.width=`calc(${u}px - ${t})`,o.style.opacity=".8",o.style.transform=`translate(${N}px, calc(${b}px - 2px))`,r?.elem&&(r.elem.style.opacity="",r?.elem===n?f?r.elem.style.marginTop="":r.elem.style.marginBottom="":(r.elem.style.marginBottom="",r.elem.style.marginTop="")),$=0,{isBelow:f,willStayInSamePosition:c}}var bt="draggable-block-menu",Me="application/x-lexical-drag-block",V=1/0;function Le(t){return t===0?1/0:V>=0&&V<t?V:Math.floor(t/2)}function Ct(t,e){let{transform:o}=e.style;t.setDragImage(e,0,0),setTimeout(()=>{e.style.transform=o})}function Be(t,e){t&&(t.style.opacity="0"),e&&(e.style.opacity="",e.style.marginBottom="",e.style.marginTop="")}function Nt(t,e,o){let n=e.parentElement,r=re(null),m=re(null),l=re(null),a=re(!1),[d,g]=ve(null),[y,s]=ve(null),{editorConfig:i}=R(),u=i?.admin?.hideGutter?-44:-8;me(()=>{function h(f){let c=f.target;if(!j(c))return;let E=z(n,f.pageX,f.pageY,c);if(E===-1){g(null);return}if(ee(c,bt))return;let b=_(t),{blockElem:N,foundAtIndex:C,isFoundNodeEmptyParagraph:k}=G({anchorElem:e,cache_threshold:0,editor:t,horizontalOffset:-E,point:new B(f.x,f.y),startIndex:Le(b.length),useEdgeAsDefault:!1,verbose:!1});V=C,!(!N&&!k)&&d!==N&&g(N)}return document?.addEventListener("mousemove",h),()=>{document?.removeEventListener("mousemove",h)}},[n,e,t,d]),me(()=>{r.current&&te(d,r.current,e,u)},[e,d,u]),me(()=>{function h(c){if(!a.current)return!1;let[E]=ke(c);if(E)return!1;let{pageY:b,target:N}=c;if(!j(N))return!1;let C=z(n,c.pageX,c.pageY,N,100,50),k=_(t),{blockElem:P,foundAtIndex:H,isFoundNodeEmptyParagraph:L}=G({anchorElem:e,editor:t,fuzzy:!0,horizontalOffset:-C,point:new B(c.x,c.y),startIndex:Le(k.length),useEdgeAsDefault:!0,verbose:!0});V=H;let I=m.current;if(P===null||I===null)return!1;if(d!==P){let{isBelow:S,willStayInSamePosition:U}=Re(i?.admin?.hideGutter?"0px":"3rem",u+(i?.admin?.hideGutter?r?.current?.getBoundingClientRect()?.width??0:-(r?.current?.getBoundingClientRect()?.width??0)),I,P,y,b,e,c,l,L);c.preventDefault(),U||s({boundingBox:P.getBoundingClientRect(),elem:P,isBelow:S})}else y?.elem&&(Be(I,y.elem),s({boundingBox:P.getBoundingClientRect(),elem:P,isBelow:!1}));return!0}function f(c){if(!a.current)return!1;let[E]=ke(c);if(E)return!1;let{dataTransfer:b,pageY:N,target:C}=c,k=b?.getData(Me)||"";return t.update(()=>{let P=xt(k);if(!P||!j(C))return!1;let H=z(n,c.pageX,c.pageY,C,100,50),{blockElem:L,isFoundNodeEmptyParagraph:I}=G({anchorElem:e,editor:t,fuzzy:!0,horizontalOffset:-H,point:new B(c.x,c.y),useEdgeAsDefault:!0});if(!L)return!1;let S=Se(L);if(!S)return!1;if(S===P)return!0;let{height:U,top:J}=K(L),le=N>=J+U/2+window.scrollY;I?(S.insertBefore(P),S.remove()):le?S.insertAfter(P):S.insertBefore(P),d!==null&&g(null),document.querySelectorAll(".lexical-block-highlighter").forEach(D=>{D.remove()});let ae=t.getElementByKey(P.getKey());setTimeout(()=>{let D=ae?.getBoundingClientRect();if(!D)return;let T=document.createElement("div");T.className="lexical-block-highlighter",T.style.backgroundColor="var(--theme-elevation-1000",T.style.transition="opacity 0.5s ease-in-out",T.style.zIndex="1",T.style.pointerEvents="none",T.style.boxSizing="border-box",T.style.borderRadius="4px",T.style.position="absolute",document.body.appendChild(T),T.style.opacity="0.1",T.style.height=`${D.height+8}px`,T.style.width=`${D.width+8}px`,T.style.top=`${D.top+window.scrollY-4}px`,T.style.left=`${D.left-4}px`,setTimeout(()=>{T.style.opacity="0",setTimeout(()=>{T.remove()},500)},1e3)},120)}),!0}return document.addEventListener("dragover",h),document.addEventListener("drop",f),()=>{document.removeEventListener("dragover",h),document.removeEventListener("drop",f)}},[n,u,e,t,y,d,i?.admin?.hideGutter]);function x(h){let f=h.dataTransfer;if(!f||!d)return;Ct(f,d);let c="";t.update(()=>{let E=Se(d);E&&(c=E.getKey())}),a.current=!0,f.setData(Me,c)}function p(){a.current=!1,y?.elem&&Be(m.current,y?.elem)}return Et(ht(Ae.Fragment,{children:[ne("div",{className:"icon draggable-block-menu",draggable:!0,onDragEnd:p,onDragStart:x,ref:r,children:ne("div",{className:o?"icon":""})}),ne("div",{className:"draggable-block-target-line",ref:m}),ne("div",{className:"debug-highlight",ref:l})]}),e)}function Fe(t){let{anchorElem:e}=t,o=e===void 0?document.body:e,[n]=yt();return Nt(n,o,n._editable)}import{c as Pt}from"react/compiler-runtime";import{useLexicalComposerContext as wt}from"@lexical/react/LexicalComposerContext";import*as Ie from"react";var De=()=>{let t=Pt(4),{editorConfig:e}=R(),[o]=wt(),n,r;return t[0]!==o||t[1]!==e.features.markdownTransformers?(n=()=>fe(o,e.features.markdownTransformers??[]),r=[o,e.features.markdownTransformers],t[0]=o,t[1]=e.features.markdownTransformers,t[2]=n,t[3]=r):(n=t[2],r=t[3]),Ie.useEffect(n,r),null};import{jsx as W,jsxs as _e}from"react/jsx-runtime";import{useLexicalComposerContext as Rt}from"@lexical/react/LexicalComposerContext.js";import{useTranslation as $e}from"@payloadcms/ui";import{useCallback as kt,useMemo as St,useState as vt}from"react";import"react";import*as He from"react-dom";import{c as Tt}from"react/compiler-runtime";import"react";function Oe(t,e){let o=Tt(4),{maxLength:n,minLength:r}=e,m=n===void 0?75:n,l=r===void 0?1:r,a;return o[0]!==m||o[1]!==l||o[2]!==t?(a=d=>{let{query:g}=d,y="[^"+t+pe+"\\s]",i=new RegExp("(^|\\s|\\()(["+t+"]((?:"+y+"){0,"+m+"}))$").exec(g);if(i!==null){let u=i[1],x=i[3];if(x.length>=l)return{leadOffset:i.index+u.length,matchingString:x,replaceableString:i[2]}}return null},o[0]=m,o[1]=l,o[2]=t,o[3]=a):a=o[3],a}var M="slash-menu-popup";function Mt({isSelected:t,item:e,onClick:o,onMouseEnter:n,ref:r}){let{fieldProps:{featureClientSchemaMap:m,schemaPath:l}}=R(),{i18n:a}=$e(),d=`${M}__item ${M}__item-${e.key}`;t&&(d+=` ${M}__item--selected`);let g=e.key;return e.label&&(g=typeof e.label=="function"?e.label({featureClientSchemaMap:m,i18n:a,schemaPath:l}):e.label),g.length>25&&(g=g.substring(0,25)+"..."),_e("button",{"aria-selected":t,className:d,id:M+"__item-"+e.key,onClick:o,onMouseEnter:n,ref:r,role:"option",tabIndex:-1,type:"button",children:[e?.Icon&&W(e.Icon,{}),W("span",{className:`${M}__item-text`,children:g})]},e.key)}function je({anchorElem:t=document.body}){let[e]=Rt(),[o,n]=vt(null),{editorConfig:r}=R(),{i18n:m}=$e(),{fieldProps:{featureClientSchemaMap:l,schemaPath:a}}=R(),d=Oe("/",{minLength:0}),g=kt(()=>{let s=[];for(let i of r.features.slashMenu.dynamicGroups)if(o){let u=i({editor:e,queryString:o});s=s.concat(u)}return s},[e,o,r?.features]),y=St(()=>{let s=[];for(let i of r?.features.slashMenu.groups??[])s.push(i);if(o){s=s.map(u=>{let x=u.items.filter(p=>{let h=p.key;return p.label&&(h=typeof p.label=="function"?p.label({featureClientSchemaMap:l,i18n:m,schemaPath:a}):p.label),new RegExp(o,"gi").exec(h)?!0:p.keywords!=null?p.keywords.some(f=>new RegExp(o,"gi").exec(f)):!1});return x.length?{...u,items:x}:null}),s=s.filter(u=>u!=null);let i=g();for(let u of i){let x=s.find(p=>p.key===u.key);x?s=s.filter(p=>p.key!==u.key):x={...u,items:[]},x?.items?.length&&(x.items=x.items.concat(x.items)),s.push(x)}}return s},[o,r?.features.slashMenu.groups,g,l,m,a]);return W(he,{anchorElem:t,groups:y,menuRenderFn:(s,{selectedItemKey:i,selectItemAndCleanUp:u,setSelectedItemKey:x})=>s.current&&y.length?He.createPortal(W("div",{className:M,children:y.map(p=>{let h=p.key;return p.label&&l&&(h=typeof p.label=="function"?p.label({featureClientSchemaMap:l,i18n:m,schemaPath:a}):p.label),_e("div",{className:`${M}__group ${M}__group-${p.key}`,children:[W("div",{className:`${M}__group-title`,children:h}),p.items.map((f,c)=>W(Mt,{index:c,isSelected:i===f.key,item:f,onClick:()=>{x(f.key),u(f)},onMouseEnter:()=>{x(f.key)},ref:E=>{f.ref={current:E}}},f.key))]},p.key)})}),s.current):null,onQueryChange:n,triggerFn:d})}import{c as Lt}from"react/compiler-runtime";import{useLexicalComposerContext as Bt}from"@lexical/react/LexicalComposerContext";import{TEXT_TYPE_TO_FORMAT as ze,TextNode as At}from"lexical";import{useEffect as Ft}from"react";function Ke(t){let e=Lt(6),{features:o}=t,[n]=Bt(),r;e[0]!==n||e[1]!==o.enabledFormats?(r=()=>{let l=It(o.enabledFormats);if(l.length!==0)return n.registerNodeTransform(At,a=>{l.forEach(d=>{a.hasFormat(d)&&a.toggleFormat(d)})})},e[0]=n,e[1]=o.enabledFormats,e[2]=r):r=e[2];let m;return e[3]!==n||e[4]!==o?(m=[n,o],e[3]=n,e[4]=o,e[5]=m):m=e[5],Ft(r,m),null}function It(t){delete ze.highlight;let e=Object.keys(ze),o=new Set(t);return e.filter(n=>!o.has(n))}import{c as Dt}from"react/compiler-runtime";import{jsx as Ge}from"react/jsx-runtime";import{ContentEditable as Ot}from"@lexical/react/LexicalContentEditable.js";import{useTranslation as _t}from"@payloadcms/ui";import"react";function We(t){let e=Dt(3),{className:o}=t,{t:n}=_t(),r;return e[0]!==o||e[1]!==n?(r=Ge(Ot,{"aria-placeholder":n("lexical:general:placeholder"),className:o??"ContentEditable__root",placeholder:Ge("p",{className:"editor-placeholder",children:n("lexical:general:placeholder")})}),e[0]=o,e[1]=n,e[2]=r):r=e[2],r}var qe=t=>{let e=$t(22),{editorConfig:o,editorContainerRef:n,onChange:r}=t,m=R(),[l]=Ht(),[a,d]=Ve(null),g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g=c=>{c!==null&&d(c)},e[0]=g):g=e[0];let y=g,s,i;e[1]!==l||e[2]!==m?(s=()=>{if(!m?.uuid){console.error("Lexical Editor must be used within an EditorConfigProvider");return}m?.parentEditor?.uuid&&m.parentEditor?.registerChild(m.uuid,m);let c=()=>{m.focusEditor(m)},E=()=>{m.blurEditor(m)},b=l.registerCommand(Yt,()=>(c(),!0),Ye),N=l.registerCommand(Wt,()=>(E(),!0),Ye);return()=>{b(),N(),m.parentEditor?.unregisterChild?.(m.uuid)}},i=[l,m],e[1]=l,e[2]=m,e[3]=s,e[4]=i):(s=e[3],i=e[4]),Ue(s,i);let[u,x]=Ve(!1),p,h;e[5]!==u?(p=()=>{let c=()=>{let E=window.matchMedia("(max-width: 768px)").matches;E!==u&&x(E)};return c(),window.addEventListener("resize",c),()=>{window.removeEventListener("resize",c)}},h=[u],e[5]=u,e[6]=p,e[7]=h):(p=e[6],h=e[7]),Ue(p,h);let f;if(e[8]!==l||e[9]!==o.features||e[10]!==n||e[11]!==a||e[12]!==u||e[13]!==r){let c;e[15]!==r?(c=(b,N,C)=>{(!C.has("focus")||C.size>1)&&r?.(b,N,C)},e[15]=r,e[16]=c):c=e[16];let E;e[17]!==l||e[18]!==o.features.plugins||e[19]!==a||e[20]!==u?(E=a&&q(Y.Fragment,{children:[!u&&l.isEditable()&&q(Y.Fragment,{children:[w(Fe,{anchorElem:a}),w(we,{anchorElem:a})]}),o.features.plugins?.map(b=>{if(b.position==="floatingAnchorElem"&&!(b.desktopOnly===!0&&u))return w(O,{anchorElem:a,clientProps:b.clientProps,plugin:b},b.key)}),l.isEditable()&&w(Y.Fragment,{children:w(je,{anchorElem:a})})]}),e[17]=l,e[18]=o.features.plugins,e[19]=a,e[20]=u,e[21]=E):E=e[21],f=q(Y.Fragment,{children:[o.features.plugins?.map(Ut),q("div",{className:"editor-container",ref:n,children:[o.features.plugins?.map(Vt),w(Gt,{contentEditable:w("div",{className:"editor-scroller",children:w("div",{className:"editor",ref:y,tabIndex:-1,children:w(We,{})})}),ErrorBoundary:jt}),w(Ke,{features:o.features}),w(Kt,{ignoreSelectionChange:!0,onChange:c}),E,l.isEditable()&&q(Y.Fragment,{children:[w(zt,{}),o?.features?.markdownTransformers?.length>0&&w(De,{})]}),o.features.plugins?.map(qt),o.features.plugins?.map(Jt)]}),o.features.plugins?.map(Qt)]}),e[8]=l,e[9]=o.features,e[10]=n,e[11]=a,e[12]=u,e[13]=r,e[14]=f}else f=e[14];return f};function Ut(t){if(t.position==="aboveContainer")return w(O,{clientProps:t.clientProps,plugin:t},t.key)}function Vt(t){if(t.position==="top")return w(O,{clientProps:t.clientProps,plugin:t},t.key)}function qt(t){if(t.position==="normal")return w(O,{clientProps:t.clientProps,plugin:t},t.key)}function Jt(t){if(t.position==="bottom")return w(O,{clientProps:t.clientProps,plugin:t},t.key)}function Qt(t){if(t.position==="belowContainer")return w(O,{clientProps:t.clientProps,plugin:t},t.key)}var Qe=({children:t,providers:e})=>{if(!e?.length)return t;let o=e[0];return e.length>1?A(o,{children:A(Qe,{providers:e.slice(1),children:t})}):A(o,{children:t})},Xe=t=>{let{composerKey:e,editorConfig:o,fieldProps:n,onChange:r,readOnly:m,value:l}=t,a=R(),d=Je.useRef(null),g=Zt(()=>{if(l&&typeof l!="object")throw new Error("The value passed to the Lexical editor is not an object. This is not supported. Please remove the data from the field and start again. This is the value that was passed in: "+JSON.stringify(l));if(l&&Array.isArray(l)&&!("root"in l))throw new Error("You have tried to pass in data from the old Slate editor to the new Lexical editor. The data structure is different, thus you will have to migrate your data. We offer a one-line migration script which migrates all your rich text fields: https://payloadcms.com/docs/lexical/migration#migration-via-migration-script-recommended");if(l&&"jsonContent"in l)throw new Error("You have tried to pass in data from payload-plugin-lexical. The data structure is different, thus you will have to migrate your data. Migration guide: https://payloadcms.com/docs/lexical/migration#migrating-from-payload-plugin-lexical");return{editable:m!==!0,editorState:l!=null?JSON.stringify(l):void 0,namespace:o.lexical.namespace,nodes:xe({editorConfig:o}),onError:y=>{throw y},theme:o.lexical.theme}},[o]);return g?A(Xt,{initialConfig:g,children:A(de,{editorConfig:o,editorContainerRef:d,fieldProps:n,parentContext:a,children:A(Qe,{providers:o.features.providers,children:A(qe,{editorConfig:o,editorContainerRef:d,onChange:r})})})},e+g.editable):A("p",{children:"Loading..."})};var ie="rich-text-lexical",ao=t=>{let{editorConfig:e,field:o,field:{name:n,admin:{className:r,description:m,readOnly:l}={},label:a,localized:d,required:g},path:y,readOnly:s,validate:i}=t,u=s||l,x=y??n,p=no(),h=et((Q,ae)=>typeof i=="function"?i(Q,{...ae,required:g}):!0,[i,g]),{customComponents:{AfterInput:f,BeforeInput:c,Description:E,Error:b,Label:N}={},formInitializing:C,formProcessing:k,initialValue:P,setValue:H,showError:L,value:I}=ro({path:x,validate:h}),S=u||k||C,U=[ie,"field-type",r,L&&"error",S&&`${ie}--read-only`,e?.admin?.hideGutter!==!0?`${ie}--show-gutter`:null].filter(Boolean).join(" "),J=`${x}.${p}`,ue=et(Q=>{H(Q.toJSON())},[H]),le=so(()=>io(o),[o]);return se("div",{className:U,style:le,children:[F(Ze,{CustomComponent:b,Fallback:F(to,{path:x,showError:L})}),N||F(oo,{label:a,localized:d,required:g}),se("div",{className:`${ie}__wrap`,children:[se(lo,{fallbackRender:co,onReset:()=>{},children:[c,F(Xe,{composerKey:J,editorConfig:e,fieldProps:t,onChange:ue,readOnly:S,value:I},JSON.stringify({initialValue:P,path:x})),f]}),E,F(Ze,{CustomComponent:E,Fallback:F(eo,{description:m,path:x})})]})]},J)};function co({error:t}){return se("div",{className:"errorBoundary",role:"alert",children:[F("p",{children:"Something went wrong:"}),F("pre",{style:{color:"red"},children:t.message})]})}var Cr=ao;export{Cr as RichText};
2
+ //# sourceMappingURL=Field-G3GIPW2U.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/field/Field.tsx", "../../../src/lexical/LexicalProvider.tsx", "../../../src/lexical/LexicalEditor.tsx", "../../../src/lexical/EditorPlugin.tsx", "../../../src/lexical/plugins/handles/AddBlockHandlePlugin/index.tsx", "../../../src/lexical/plugins/handles/utils/calculateDistanceFromScrollerElem.ts", "../../../src/lexical/plugins/handles/utils/getNodeCloseToPoint.ts", "../../../src/lexical/plugins/handles/DraggableBlockPlugin/getBoundingRectWithoutTransform.ts", "../../../src/lexical/plugins/handles/utils/getCollapsedMargins.ts", "../../../src/lexical/plugins/handles/utils/getTopLevelNodeKeys.ts", "../../../src/lexical/plugins/handles/utils/isOnHandleElement.ts", "../../../src/lexical/plugins/handles/utils/doesLineHeightAffectElement.ts", "../../../src/lexical/plugins/handles/utils/setHandlePosition.ts", "../../../src/lexical/plugins/handles/DraggableBlockPlugin/index.tsx", "../../../src/lexical/plugins/handles/DraggableBlockPlugin/setTargetLine.ts", "../../../src/lexical/plugins/MarkdownShortcut/index.tsx", "../../../src/lexical/plugins/SlashMenu/index.tsx", "../../../src/lexical/plugins/SlashMenu/useMenuTriggerMatch.ts", "../../../src/lexical/plugins/TextPlugin/index.tsx", "../../../src/lexical/ui/ContentEditable.tsx"],
4
+ "sourcesContent": ["'use client'\nimport type { EditorState, SerializedEditorState } from 'lexical'\nimport type { Validate } from 'payload'\n\nimport {\n FieldDescription,\n FieldError,\n FieldLabel,\n RenderCustomComponent,\n useEditDepth,\n useField,\n} from '@payloadcms/ui'\nimport { mergeFieldStyles } from '@payloadcms/ui/shared'\nimport React, { useCallback, useMemo } from 'react'\nimport { ErrorBoundary } from 'react-error-boundary'\n\nimport type { SanitizedClientEditorConfig } from '../lexical/config/types.js'\nimport type { LexicalRichTextFieldProps } from '../types.js'\n\nimport '../lexical/theme/EditorTheme.scss'\nimport './bundled.css'\nimport './index.scss'\nimport { LexicalProvider } from '../lexical/LexicalProvider.js'\n\nconst baseClass = 'rich-text-lexical'\n\nconst RichTextComponent: React.FC<\n {\n readonly editorConfig: SanitizedClientEditorConfig // With rendered features n stuff\n } & LexicalRichTextFieldProps\n> = (props) => {\n const {\n editorConfig,\n field,\n field: {\n name,\n admin: { className, description, readOnly: readOnlyFromAdmin } = {},\n label,\n localized,\n required,\n },\n path: pathFromProps,\n readOnly: readOnlyFromTopLevelProps,\n validate, // Users can pass in client side validation if they WANT to, but it's not required anymore\n } = props\n\n const readOnlyFromProps = readOnlyFromTopLevelProps || readOnlyFromAdmin\n const path = pathFromProps ?? name\n\n const editDepth = useEditDepth()\n\n const memoizedValidate = useCallback<Validate>(\n (value, validationOptions) => {\n if (typeof validate === 'function') {\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n return validate(value, { ...validationOptions, required })\n }\n return true\n },\n // Important: do not add props to the dependencies array.\n // This would cause an infinite loop and endless re-rendering.\n // Removing props from the dependencies array fixed this issue: https://github.com/payloadcms/payload/issues/3709\n [validate, required],\n )\n\n const {\n customComponents: { AfterInput, BeforeInput, Description, Error, Label } = {},\n formInitializing,\n formProcessing,\n initialValue,\n setValue,\n showError,\n value,\n } = useField<SerializedEditorState>({\n path,\n validate: memoizedValidate,\n })\n\n const disabled = readOnlyFromProps || formProcessing || formInitializing\n\n const classes = [\n baseClass,\n 'field-type',\n className,\n showError && 'error',\n disabled && `${baseClass}--read-only`,\n editorConfig?.admin?.hideGutter !== true ? `${baseClass}--show-gutter` : null,\n ]\n .filter(Boolean)\n .join(' ')\n\n const pathWithEditDepth = `${path}.${editDepth}`\n\n const handleChange = useCallback(\n (editorState: EditorState) => {\n setValue(editorState.toJSON())\n },\n [setValue],\n )\n\n const styles = useMemo(() => mergeFieldStyles(field), [field])\n\n return (\n <div className={classes} key={pathWithEditDepth} style={styles}>\n <RenderCustomComponent\n CustomComponent={Error}\n Fallback={<FieldError path={path} showError={showError} />}\n />\n {Label || <FieldLabel label={label} localized={localized} required={required} />}\n <div className={`${baseClass}__wrap`}>\n <ErrorBoundary fallbackRender={fallbackRender} onReset={() => {}}>\n {BeforeInput}\n <LexicalProvider\n composerKey={pathWithEditDepth}\n editorConfig={editorConfig}\n fieldProps={props}\n key={JSON.stringify({ initialValue, path })} // makes sure lexical is completely re-rendered when initialValue changes, bypassing the lexical-internal value memoization. That way, external changes to the form will update the editor. More infos in PR description (https://github.com/payloadcms/payload/pull/5010)\n onChange={handleChange}\n readOnly={disabled}\n value={value}\n />\n {AfterInput}\n </ErrorBoundary>\n {Description}\n <RenderCustomComponent\n CustomComponent={Description}\n Fallback={<FieldDescription description={description} path={path} />}\n />\n </div>\n </div>\n )\n}\n\nfunction fallbackRender({ error }: { error: Error }) {\n // Call resetErrorBoundary() to reset the error boundary and retry the render.\n\n return (\n <div className=\"errorBoundary\" role=\"alert\">\n <p>Something went wrong:</p>\n <pre style={{ color: 'red' }}>{error.message}</pre>\n </div>\n )\n}\n\nexport const RichText: typeof RichTextComponent = RichTextComponent\n", "'use client'\nimport type { InitialConfigType } from '@lexical/react/LexicalComposer.js'\nimport type { EditorState, LexicalEditor, SerializedEditorState } from 'lexical'\nimport type { ClientField } from 'payload'\n\nimport { LexicalComposer } from '@lexical/react/LexicalComposer.js'\nimport * as React from 'react'\nimport { useMemo } from 'react'\n\nimport type { LexicalRichTextFieldProps } from '../types.js'\nimport type { SanitizedClientEditorConfig } from './config/types.js'\n\nimport {\n EditorConfigProvider,\n useEditorConfigContext,\n} from './config/client/EditorConfigProvider.js'\nimport { LexicalEditor as LexicalEditorComponent } from './LexicalEditor.js'\nimport { getEnabledNodes } from './nodes/index.js'\n\nexport type LexicalProviderProps = {\n composerKey: string\n editorConfig: SanitizedClientEditorConfig\n fieldProps: LexicalRichTextFieldProps\n onChange: (editorState: EditorState, editor: LexicalEditor, tags: Set<string>) => void\n readOnly: boolean\n value: SerializedEditorState\n}\n\nconst NestProviders = ({\n children,\n providers,\n}: {\n children: React.ReactNode\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n providers: any[]\n}) => {\n if (!providers?.length) {\n return children\n }\n const Component = providers[0]\n if (providers.length > 1) {\n return (\n <Component>\n <NestProviders providers={providers.slice(1)}>{children}</NestProviders>\n </Component>\n )\n }\n return <Component>{children}</Component>\n}\n\nexport const LexicalProvider: React.FC<LexicalProviderProps> = (props) => {\n const { composerKey, editorConfig, fieldProps, onChange, readOnly, value } = props\n\n const parentContext = useEditorConfigContext()\n\n const editorContainerRef = React.useRef<HTMLDivElement>(null)\n\n // useMemo for the initialConfig that depends on readOnly and value\n const initialConfig = useMemo<InitialConfigType>(() => {\n if (value && typeof value !== 'object') {\n throw new Error(\n 'The value passed to the Lexical editor is not an object. This is not supported. Please remove the data from the field and start again. This is the value that was passed in: ' +\n JSON.stringify(value),\n )\n }\n\n if (value && Array.isArray(value) && !('root' in value)) {\n throw new Error(\n 'You have tried to pass in data from the old Slate editor to the new Lexical editor. The data structure is different, thus you will have to migrate your data. We offer a one-line migration script which migrates all your rich text fields: https://payloadcms.com/docs/lexical/migration#migration-via-migration-script-recommended',\n )\n }\n\n if (value && 'jsonContent' in value) {\n throw new Error(\n 'You have tried to pass in data from payload-plugin-lexical. The data structure is different, thus you will have to migrate your data. Migration guide: https://payloadcms.com/docs/lexical/migration#migrating-from-payload-plugin-lexical',\n )\n }\n\n return {\n editable: readOnly !== true,\n editorState: value != null ? JSON.stringify(value) : undefined,\n namespace: editorConfig.lexical.namespace,\n nodes: getEnabledNodes({ editorConfig }),\n onError: (error: Error) => {\n throw error\n },\n theme: editorConfig.lexical.theme,\n }\n // Important: do not add readOnly and value to the dependencies array. This will cause the entire lexical editor to re-render if the document is saved, which will\n // cause the editor to lose focus.\n }, [editorConfig])\n\n if (!initialConfig) {\n return <p>Loading...</p>\n }\n\n // We need to add initialConfig.editable to the key to force a re-render when the readOnly prop changes.\n // Without it, there were cases where lexical editors inside drawers turn readOnly initially - a few miliseconds later they turn editable, but the editor does not re-render and stays readOnly.\n return (\n <LexicalComposer initialConfig={initialConfig} key={composerKey + initialConfig.editable}>\n <EditorConfigProvider\n editorConfig={editorConfig}\n editorContainerRef={editorContainerRef}\n fieldProps={fieldProps}\n parentContext={parentContext}\n >\n <NestProviders providers={editorConfig.features.providers}>\n <LexicalEditorComponent\n editorConfig={editorConfig}\n editorContainerRef={editorContainerRef}\n onChange={onChange}\n />\n </NestProviders>\n </EditorConfigProvider>\n </LexicalComposer>\n )\n}\n", "'use client'\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { LexicalErrorBoundary } from '@lexical/react/LexicalErrorBoundary.js'\nimport { HistoryPlugin } from '@lexical/react/LexicalHistoryPlugin.js'\nimport { OnChangePlugin } from '@lexical/react/LexicalOnChangePlugin.js'\nimport { RichTextPlugin } from '@lexical/react/LexicalRichTextPlugin.js'\nimport { BLUR_COMMAND, COMMAND_PRIORITY_LOW, FOCUS_COMMAND } from 'lexical'\nimport * as React from 'react'\nimport { useEffect, useState } from 'react'\n\nimport type { LexicalProviderProps } from './LexicalProvider.js'\n\nimport { useEditorConfigContext } from './config/client/EditorConfigProvider.js'\nimport { EditorPlugin } from './EditorPlugin.js'\nimport './LexicalEditor.scss'\nimport { AddBlockHandlePlugin } from './plugins/handles/AddBlockHandlePlugin/index.js'\nimport { DraggableBlockPlugin } from './plugins/handles/DraggableBlockPlugin/index.js'\nimport { MarkdownShortcutPlugin } from './plugins/MarkdownShortcut/index.js'\nimport { SlashMenuPlugin } from './plugins/SlashMenu/index.js'\nimport { TextPlugin } from './plugins/TextPlugin/index.js'\nimport { LexicalContentEditable } from './ui/ContentEditable.js'\n\nexport const LexicalEditor: React.FC<\n {\n editorContainerRef: React.RefObject<HTMLDivElement | null>\n } & Pick<LexicalProviderProps, 'editorConfig' | 'onChange'>\n> = (props) => {\n const { editorConfig, editorContainerRef, onChange } = props\n const editorConfigContext = useEditorConfigContext()\n const [editor] = useLexicalComposerContext()\n\n const [floatingAnchorElem, setFloatingAnchorElem] = useState<HTMLDivElement | null>(null)\n const onRef = (_floatingAnchorElem: HTMLDivElement) => {\n if (_floatingAnchorElem !== null) {\n setFloatingAnchorElem(_floatingAnchorElem)\n }\n }\n\n useEffect(() => {\n if (!editorConfigContext?.uuid) {\n console.error('Lexical Editor must be used within an EditorConfigProvider')\n return\n }\n if (editorConfigContext?.parentEditor?.uuid) {\n editorConfigContext.parentEditor?.registerChild(editorConfigContext.uuid, editorConfigContext)\n }\n\n const handleFocus = () => {\n editorConfigContext.focusEditor(editorConfigContext)\n }\n\n const handleBlur = () => {\n editorConfigContext.blurEditor(editorConfigContext)\n }\n\n const unregisterFocus = editor.registerCommand<MouseEvent>(\n FOCUS_COMMAND,\n () => {\n handleFocus()\n return true\n },\n COMMAND_PRIORITY_LOW,\n )\n\n const unregisterBlur = editor.registerCommand<MouseEvent>(\n BLUR_COMMAND,\n () => {\n handleBlur()\n return true\n },\n COMMAND_PRIORITY_LOW,\n )\n\n return () => {\n unregisterFocus()\n unregisterBlur()\n editorConfigContext.parentEditor?.unregisterChild?.(editorConfigContext.uuid)\n }\n }, [editor, editorConfigContext])\n\n const [isSmallWidthViewport, setIsSmallWidthViewport] = useState<boolean>(false)\n\n useEffect(() => {\n const updateViewPortWidth = () => {\n const isNextSmallWidthViewport = window.matchMedia('(max-width: 768px)').matches\n\n if (isNextSmallWidthViewport !== isSmallWidthViewport) {\n setIsSmallWidthViewport(isNextSmallWidthViewport)\n }\n }\n updateViewPortWidth()\n window.addEventListener('resize', updateViewPortWidth)\n\n return () => {\n window.removeEventListener('resize', updateViewPortWidth)\n }\n }, [isSmallWidthViewport])\n\n return (\n <React.Fragment>\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'aboveContainer') {\n return <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n }\n })}\n <div className=\"editor-container\" ref={editorContainerRef}>\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'top') {\n return (\n <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n )\n }\n })}\n <RichTextPlugin\n contentEditable={\n <div className=\"editor-scroller\">\n <div className=\"editor\" ref={onRef} tabIndex={-1}>\n <LexicalContentEditable />\n </div>\n </div>\n }\n ErrorBoundary={LexicalErrorBoundary}\n />\n <TextPlugin features={editorConfig.features} />\n <OnChangePlugin\n // Selection changes can be ignored here, reducing the\n // frequency that the FieldComponent and Payload receive updates.\n // Selection changes are only needed if you are saving selection state\n ignoreSelectionChange\n onChange={(editorState, editor, tags) => {\n // Ignore any onChange event triggered by focus only\n if (!tags.has('focus') || tags.size > 1) {\n if (onChange != null) {\n onChange(editorState, editor, tags)\n }\n }\n }}\n />\n {floatingAnchorElem && (\n <React.Fragment>\n {!isSmallWidthViewport && editor.isEditable() && (\n <React.Fragment>\n <DraggableBlockPlugin anchorElem={floatingAnchorElem} />\n <AddBlockHandlePlugin anchorElem={floatingAnchorElem} />\n </React.Fragment>\n )}\n {editorConfig.features.plugins?.map((plugin) => {\n if (\n plugin.position === 'floatingAnchorElem' &&\n !(plugin.desktopOnly === true && isSmallWidthViewport)\n ) {\n return (\n <EditorPlugin\n anchorElem={floatingAnchorElem}\n clientProps={plugin.clientProps}\n key={plugin.key}\n plugin={plugin}\n />\n )\n }\n })}\n {editor.isEditable() && (\n <React.Fragment>\n <SlashMenuPlugin anchorElem={floatingAnchorElem} />\n </React.Fragment>\n )}\n </React.Fragment>\n )}\n {editor.isEditable() && (\n <React.Fragment>\n <HistoryPlugin />\n {editorConfig?.features?.markdownTransformers?.length > 0 && <MarkdownShortcutPlugin />}\n </React.Fragment>\n )}\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'normal') {\n return (\n <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n )\n }\n })}\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'bottom') {\n return (\n <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n )\n }\n })}\n </div>\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'belowContainer') {\n return <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n }\n })}\n </React.Fragment>\n )\n}\n", "'use client'\nimport React from 'react'\n\nimport type { SanitizedPlugin } from '../features/typesClient.js'\n\nexport const EditorPlugin: React.FC<{\n anchorElem?: HTMLDivElement\n clientProps: unknown\n plugin: SanitizedPlugin\n}> = ({ anchorElem, clientProps, plugin }) => {\n if (plugin.position === 'floatingAnchorElem' && anchorElem) {\n return (\n plugin.Component && <plugin.Component anchorElem={anchorElem} clientProps={clientProps} />\n )\n }\n\n // @ts-expect-error - ts is not able to infer that plugin.Component is of type PluginComponent\n return plugin.Component && <plugin.Component clientProps={clientProps} />\n}\n", "'use client'\nimport type { LexicalEditor, LexicalNode, ParagraphNode } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { $createParagraphNode } from 'lexical'\nimport * as React from 'react'\nimport { useCallback, useEffect, useRef, useState } from 'react'\nimport { createPortal } from 'react-dom'\n\nimport { useEditorConfigContext } from '../../../config/client/EditorConfigProvider.js'\nimport { isHTMLElement } from '../../../utils/guard.js'\nimport { Point } from '../../../utils/point.js'\nimport { ENABLE_SLASH_MENU_COMMAND } from '../../SlashMenu/LexicalTypeaheadMenuPlugin/index.js'\nimport { calculateDistanceFromScrollerElem } from '../utils/calculateDistanceFromScrollerElem.js'\nimport { getNodeCloseToPoint } from '../utils/getNodeCloseToPoint.js'\nimport { getTopLevelNodeKeys } from '../utils/getTopLevelNodeKeys.js'\nimport { isOnHandleElement } from '../utils/isOnHandleElement.js'\nimport { setHandlePosition } from '../utils/setHandlePosition.js'\nimport './index.scss'\n\nconst ADD_BLOCK_MENU_CLASSNAME = 'add-block-menu'\n\nlet prevIndex = Infinity\n\nfunction getCurrentIndex(keysLength: number): number {\n if (keysLength === 0) {\n return Infinity\n }\n if (prevIndex >= 0 && prevIndex < keysLength) {\n return prevIndex\n }\n\n return Math.floor(keysLength / 2)\n}\n\nfunction useAddBlockHandle(\n editor: LexicalEditor,\n anchorElem: HTMLElement,\n isEditable: boolean,\n): React.ReactElement {\n const scrollerElem = anchorElem.parentElement\n\n const { editorConfig } = useEditorConfigContext()\n const blockHandleHorizontalOffset = editorConfig?.admin?.hideGutter ? -24 : 12\n\n const menuRef = useRef<HTMLButtonElement>(null)\n const [hoveredElement, setHoveredElement] = useState<{\n elem: HTMLElement\n node: LexicalNode\n } | null>(null)\n\n useEffect(() => {\n function onDocumentMouseMove(event: MouseEvent) {\n const target = event.target\n if (!isHTMLElement(target)) {\n return\n }\n\n const distanceFromScrollerElem = calculateDistanceFromScrollerElem(\n scrollerElem,\n event.pageX,\n event.pageY,\n target,\n )\n\n if (distanceFromScrollerElem === -1) {\n setHoveredElement(null)\n return\n }\n\n if (isOnHandleElement(target, ADD_BLOCK_MENU_CLASSNAME)) {\n return\n }\n const topLevelNodeKeys = getTopLevelNodeKeys(editor)\n\n const {\n blockElem: _emptyBlockElem,\n blockNode,\n foundAtIndex,\n } = getNodeCloseToPoint({\n anchorElem,\n cache_threshold: 0,\n editor,\n horizontalOffset: -distanceFromScrollerElem,\n point: new Point(event.x, event.y),\n returnEmptyParagraphs: true,\n startIndex: getCurrentIndex(topLevelNodeKeys.length),\n useEdgeAsDefault: false,\n })\n\n prevIndex = foundAtIndex\n\n if (!_emptyBlockElem) {\n return\n }\n if (\n blockNode &&\n (hoveredElement?.node !== blockNode || hoveredElement?.elem !== _emptyBlockElem)\n ) {\n setHoveredElement({\n elem: _emptyBlockElem,\n node: blockNode,\n })\n }\n }\n\n // Since the draggableBlockElem is outside the actual editor, we need to listen to the document\n // to be able to detect when the mouse is outside the editor and respect a buffer around\n // the scrollerElem to avoid the draggableBlockElem disappearing too early.\n document?.addEventListener('mousemove', onDocumentMouseMove)\n\n return () => {\n document?.removeEventListener('mousemove', onDocumentMouseMove)\n }\n }, [scrollerElem, anchorElem, editor, hoveredElement])\n\n useEffect(() => {\n if (menuRef.current && hoveredElement?.node) {\n setHandlePosition(\n hoveredElement?.elem,\n menuRef.current,\n anchorElem,\n blockHandleHorizontalOffset,\n )\n }\n }, [anchorElem, hoveredElement, blockHandleHorizontalOffset])\n\n const handleAddClick = useCallback(\n (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {\n let hoveredElementToUse = hoveredElement\n if (!hoveredElementToUse?.node) {\n return\n }\n\n // 1. Update hoveredElement.node to a new paragraph node if the hoveredElement.node is not a paragraph node\n editor.update(() => {\n // Check if blockNode is an empty text node\n let isEmptyParagraph = true\n if (\n hoveredElementToUse?.node.getType() !== 'paragraph' ||\n hoveredElementToUse.node.getTextContent() !== ''\n ) {\n isEmptyParagraph = false\n }\n\n if (!isEmptyParagraph) {\n const newParagraph = $createParagraphNode()\n hoveredElementToUse?.node.insertAfter(newParagraph)\n\n setTimeout(() => {\n hoveredElementToUse = {\n elem: editor.getElementByKey(newParagraph.getKey())!,\n node: newParagraph,\n }\n setHoveredElement(hoveredElementToUse)\n }, 0)\n }\n })\n\n // 2. Focus on the new paragraph node\n setTimeout(() => {\n editor.update(() => {\n editor.focus()\n\n if (\n hoveredElementToUse?.node &&\n 'select' in hoveredElementToUse.node &&\n typeof hoveredElementToUse.node.select === 'function'\n ) {\n hoveredElementToUse.node.select()\n }\n })\n }, 1)\n\n // Make sure this is called AFTER the focusing has been processed by the browser\n // Otherwise, this won't work\n setTimeout(() => {\n editor.dispatchCommand(ENABLE_SLASH_MENU_COMMAND, {\n node: hoveredElementToUse?.node as ParagraphNode,\n })\n }, 2)\n\n event.stopPropagation()\n event.preventDefault()\n },\n [editor, hoveredElement],\n )\n\n return createPortal(\n <React.Fragment>\n <button\n aria-label=\"Add block\"\n className=\"icon add-block-menu\"\n onClick={(event) => {\n handleAddClick(event)\n }}\n ref={menuRef}\n type=\"button\"\n >\n <div className={isEditable ? 'icon' : ''} />\n </button>\n </React.Fragment>,\n anchorElem,\n )\n}\n\nexport function AddBlockHandlePlugin({\n anchorElem = document.body,\n}: {\n anchorElem?: HTMLElement\n}): React.ReactElement {\n const [editor] = useLexicalComposerContext()\n return useAddBlockHandle(editor, anchorElem, editor._editable)\n}\n", "'use client'\n/**\n * Calculate distance between scrollerElem and target if target is not in scrollerElem\n */\nexport const calculateDistanceFromScrollerElem = (\n scrollerElem: HTMLElement | null,\n pageX: number,\n pageY: number,\n target: HTMLElement,\n horizontalBuffer: number = 50,\n verticalBuffer: number = 25,\n): number => {\n let distanceFromScrollerElem = 0\n if (scrollerElem && !scrollerElem.contains(target)) {\n const { bottom, left, right, top } = scrollerElem.getBoundingClientRect()\n\n const adjustedTop = top + window.scrollY\n const adjustedBottom = bottom + window.scrollY\n\n if (\n pageY < adjustedTop - verticalBuffer ||\n pageY > adjustedBottom + verticalBuffer ||\n pageX < left - horizontalBuffer ||\n pageX > right + horizontalBuffer\n ) {\n return -1\n }\n\n // This is used to allow the _draggableBlockElem to be found when the mouse is in the\n // buffer zone around the scrollerElem.\n if (pageX < left || pageX > right) {\n distanceFromScrollerElem = pageX < left ? pageX - left : pageX - right\n }\n }\n return distanceFromScrollerElem\n}\n", "'use client'\nimport type { LexicalEditor, LexicalNode } from 'lexical'\n\nimport { $getNodeByKey } from 'lexical'\n\nimport { Point } from '../../../utils/point.js'\nimport { Rect } from '../../../utils/rect.js'\nimport { getBoundingClientRectWithoutTransform } from '../DraggableBlockPlugin/getBoundingRectWithoutTransform.js'\nimport { getCollapsedMargins } from '../utils/getCollapsedMargins.js'\nimport { getTopLevelNodeKeys } from '../utils/getTopLevelNodeKeys.js'\n\n// Directions\nconst Downward = 1\nconst Upward = -1\nconst Indeterminate = 0\n\ntype Props = {\n anchorElem: HTMLElement\n cache_threshold?: number\n editor: LexicalEditor\n /** fuzzy makes the search not exact. If no exact match found, find the closes node instead of returning null */\n fuzzy?: boolean\n horizontalOffset?: number\n point: Point\n /**\n * By default, empty paragraphs are not returned. Set this to true to return empty paragraphs. @default false\n */\n returnEmptyParagraphs?: boolean\n /**\n * The index to start searching from. It can be a considerable performance optimization to start searching from the index of the\n * previously found node, as the node is likely to be close to the next node.\n */\n startIndex?: number\n useEdgeAsDefault?: boolean\n verbose?: boolean\n}\n\ntype Output = {\n blockElem: HTMLElement | null\n blockNode: LexicalNode | null\n foundAtIndex: number\n isFoundNodeEmptyParagraph: boolean\n}\n\nconst cache = {\n props: null as null | Props,\n result: null as null | Output,\n}\n\nfunction isPointClose(previous: Point, current: Point, threshold: number = 20): boolean {\n const dx = previous.x - current.x\n const dy = previous.y - current.y\n return dx * dx + dy * dy <= threshold * threshold\n}\n\nexport function getNodeCloseToPoint(props: Props): Output {\n const {\n anchorElem,\n cache_threshold = 20,\n editor,\n fuzzy = false,\n horizontalOffset = 0,\n point: { x, y },\n startIndex = 0,\n useEdgeAsDefault = false,\n } = props\n\n // Use cache\n if (\n cache_threshold > 0 &&\n cache.props &&\n cache.result &&\n cache.props.fuzzy === props.fuzzy &&\n cache.props.horizontalOffset === props.horizontalOffset &&\n cache.props.useEdgeAsDefault === props.useEdgeAsDefault &&\n isPointClose(cache.props.point, props.point, cache_threshold)\n ) {\n return cache.result\n }\n\n const anchorElementRect = anchorElem.getBoundingClientRect()\n const topLevelNodeKeys = getTopLevelNodeKeys(editor)\n\n const closestBlockElem: {\n blockElem: HTMLElement | null\n blockNode: LexicalNode | null\n distance: number\n foundAtIndex: number\n isFoundNodeEmptyParagraph: boolean\n } = {\n blockElem: null,\n blockNode: null,\n distance: Infinity,\n foundAtIndex: -1,\n isFoundNodeEmptyParagraph: false,\n }\n\n // Return null if matching block element is the first or last node\n editor.getEditorState().read(() => {\n if (useEdgeAsDefault) {\n const [firstNode, lastNode] = [\n editor.getElementByKey(topLevelNodeKeys[0]),\n editor.getElementByKey(topLevelNodeKeys[topLevelNodeKeys.length - 1]),\n ]\n\n if (firstNode && lastNode) {\n const [firstNodeRect, lastNodeRect] = [\n getBoundingClientRectWithoutTransform(firstNode),\n getBoundingClientRectWithoutTransform(lastNode),\n ]\n\n if (y < firstNodeRect.top) {\n closestBlockElem.blockElem = firstNode\n closestBlockElem.distance = firstNodeRect.top - y\n closestBlockElem.blockNode = $getNodeByKey(topLevelNodeKeys[0])\n closestBlockElem.foundAtIndex = 0\n } else if (y > lastNodeRect.bottom) {\n closestBlockElem.distance = y - lastNodeRect.bottom\n closestBlockElem.blockNode = $getNodeByKey(topLevelNodeKeys[topLevelNodeKeys.length - 1])\n closestBlockElem.blockElem = lastNode\n closestBlockElem.foundAtIndex = topLevelNodeKeys.length - 1\n }\n\n if (closestBlockElem?.blockElem) {\n return {\n blockElem: null,\n isFoundNodeEmptyParagraph: false,\n } as Output\n }\n }\n }\n\n // Find matching block element\n let index = startIndex\n let direction = Indeterminate\n\n while (index >= 0 && index < topLevelNodeKeys.length) {\n const key = topLevelNodeKeys[index]\n const elem = editor.getElementByKey(key)\n if (elem === null) {\n break\n }\n const point = new Point(x + horizontalOffset, y)\n //const domRect = Rect.fromDOM(elem)\n // Do not consider transform of blocks when calculating distance\n const domRect = Rect.fromDOMRect(getBoundingClientRectWithoutTransform(elem))\n\n const { marginBottom, marginTop } = getCollapsedMargins(elem)\n\n const rect = domRect.generateNewRect({\n bottom: domRect.bottom + marginBottom,\n left: anchorElementRect.left,\n right: anchorElementRect.right,\n top: domRect.top - marginTop,\n })\n\n const { distance, isOnBottomSide, isOnTopSide } = rect.distanceFromPoint(point)\n\n if (distance === 0) {\n closestBlockElem.blockElem = elem\n closestBlockElem.blockNode = $getNodeByKey(key)\n closestBlockElem.foundAtIndex = index\n closestBlockElem.distance = distance\n\n // Check if blockNode is an empty text node\n if (\n closestBlockElem.blockNode &&\n closestBlockElem.blockNode.getType() === 'paragraph' &&\n closestBlockElem.blockNode.getTextContent() === ''\n ) {\n if (!fuzzy && !props.returnEmptyParagraphs) {\n closestBlockElem.blockElem = null\n closestBlockElem.blockNode = null\n }\n\n closestBlockElem.isFoundNodeEmptyParagraph = true\n }\n break\n } else if (fuzzy) {\n if (distance < closestBlockElem.distance) {\n closestBlockElem.blockElem = elem\n closestBlockElem.blockNode = $getNodeByKey(key)\n closestBlockElem.distance = distance\n closestBlockElem.foundAtIndex = index\n }\n }\n\n if (direction === Indeterminate) {\n if (isOnTopSide) {\n direction = Upward\n } else if (isOnBottomSide) {\n direction = Downward\n } else {\n // stop search block element\n direction = Infinity\n }\n }\n\n index += direction\n }\n })\n\n // Store in cache before returning\n cache.props = props\n cache.result = {\n blockElem: closestBlockElem.blockElem,\n blockNode: closestBlockElem.blockNode,\n foundAtIndex: closestBlockElem.foundAtIndex,\n isFoundNodeEmptyParagraph: closestBlockElem.isFoundNodeEmptyParagraph,\n }\n\n return {\n blockElem: closestBlockElem.blockElem,\n blockNode: closestBlockElem.blockNode,\n foundAtIndex: closestBlockElem.foundAtIndex,\n isFoundNodeEmptyParagraph: closestBlockElem.isFoundNodeEmptyParagraph,\n }\n}\n", "'use client'\nexport function getBoundingClientRectWithoutTransform(elem: HTMLElement): DOMRect {\n const rect = elem.getBoundingClientRect()\n\n // Extract the translation value from the transform style\n const transformValue = getComputedStyle(elem).getPropertyValue('transform')\n if (!transformValue || transformValue === 'none') {\n return rect\n }\n\n const lastNumberOfTransformValue = transformValue.split(',').pop()\n rect.y = rect.y - Number(lastNumberOfTransformValue?.replace(')', ''))\n\n // Return the original bounding rect if no translation is applied\n return rect\n}\n", "'use client'\nexport function getCollapsedMargins(elem: HTMLElement): {\n marginBottom: number\n marginTop: number\n} {\n const getMargin = (element: Element | null, margin: 'marginBottom' | 'marginTop'): number =>\n element ? parseFloat(window.getComputedStyle(element)[margin]) : 0\n\n const { marginBottom, marginTop } = window.getComputedStyle(elem)\n const prevElemSiblingMarginBottom = getMargin(elem.previousElementSibling, 'marginBottom')\n const nextElemSiblingMarginTop = getMargin(elem.nextElementSibling, 'marginTop')\n const collapsedTopMargin = Math.max(parseFloat(marginTop), prevElemSiblingMarginBottom)\n const collapsedBottomMargin = Math.max(parseFloat(marginBottom), nextElemSiblingMarginTop)\n\n return { marginBottom: collapsedBottomMargin, marginTop: collapsedTopMargin }\n}\n", "'use client'\nimport type { LexicalEditor } from 'lexical'\n\nimport { $getRoot } from 'lexical'\n\nexport function getTopLevelNodeKeys(editor: LexicalEditor): string[] {\n return editor.getEditorState().read(() => $getRoot().getChildrenKeys())\n}\n", "'use client'\nexport function isOnHandleElement(element: HTMLElement, handleElementClassName: string): boolean {\n return !!element.closest(`.${handleElementClassName}`)\n}\n", "'use client'\nconst replacedElements = [\n 'IMG',\n 'INPUT',\n 'TEXTAREA',\n 'SELECT',\n 'BUTTON',\n 'VIDEO',\n 'OBJECT',\n 'EMBED',\n 'IFRAME',\n 'HR',\n]\n\n/**\n * From ChatGPT, only that verified it works for HR elements.\n *\n * HTML Elements can have CSS lineHeight applied to them, but it doesn't always affect the visual layout.\n * This function checks if the line-height property has an effect on the element's layout.\n * @param htmlElem\n */\nexport function doesLineHeightAffectElement(htmlElem: HTMLElement) {\n if (!htmlElem) {\n return false\n }\n\n // Check for replaced elements, elements that typically don't support line-height adjustments,\n // and elements without visible content\n\n if (\n replacedElements.includes(htmlElem.tagName) ||\n htmlElem.offsetHeight === 0 ||\n htmlElem.offsetWidth === 0\n ) {\n return false\n }\n\n // Check for specific CSS properties that negate line-height's visual effects\n const style = window.getComputedStyle(htmlElem)\n if (\n style.display === 'table-cell' ||\n style.position === 'absolute' ||\n style.visibility === 'hidden' ||\n style.opacity === '0'\n ) {\n return false\n }\n\n // This is a basic check, and there can be more complex scenarios where line-height doesn't have an effect.\n return true\n}\n", "'use client'\nimport { doesLineHeightAffectElement } from './doesLineHeightAffectElement.js'\n\nexport function setHandlePosition(\n targetElem: HTMLElement | null,\n handleElem: HTMLElement,\n anchorElem: HTMLElement,\n leftOffset: number = 0, // SPACE\n) {\n if (!targetElem) {\n handleElem.style.opacity = '0'\n handleElem.style.transform = 'translate(-10000px, -10000px)'\n return\n }\n\n const targetRect = targetElem.getBoundingClientRect()\n const targetStyle = window.getComputedStyle(targetElem)\n const floatingElemRect = handleElem.getBoundingClientRect()\n const anchorElementRect = anchorElem.getBoundingClientRect()\n\n let top: number\n\n const isBlockStyle = ['lexical-block', 'lexical-upload', 'lexical-relationship'].some((classes) =>\n targetElem.firstElementChild?.classList.contains(classes),\n )\n\n if (!isBlockStyle) {\n // No need to let line height affect the re-positioning of the floating element if line height has no\n // visual effect on the element. Otherwise, the floating element will be positioned incorrectly.\n const actualLineHeight = doesLineHeightAffectElement(targetElem)\n ? parseInt(targetStyle.lineHeight, 10)\n : 0\n\n top = targetRect.top + (actualLineHeight - floatingElemRect.height) / 2 - anchorElementRect.top\n } else {\n top = targetRect.top + 8 - anchorElementRect.top\n }\n\n const left = leftOffset\n\n handleElem.style.opacity = '1'\n handleElem.style.transform = `translate(${left}px, ${top}px)`\n}\n", "'use client'\nimport type { LexicalEditor } from 'lexical'\nimport type { DragEvent as ReactDragEvent } from 'react'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { eventFiles } from '@lexical/rich-text'\nimport { $getNearestNodeFromDOMNode, $getNodeByKey } from 'lexical'\nimport * as React from 'react'\nimport { useEffect, useRef, useState } from 'react'\nimport { createPortal } from 'react-dom'\n\nimport { useEditorConfigContext } from '../../../config/client/EditorConfigProvider.js'\nimport { isHTMLElement } from '../../../utils/guard.js'\nimport { Point } from '../../../utils/point.js'\nimport { calculateDistanceFromScrollerElem } from '../utils/calculateDistanceFromScrollerElem.js'\nimport { getNodeCloseToPoint } from '../utils/getNodeCloseToPoint.js'\nimport { getTopLevelNodeKeys } from '../utils/getTopLevelNodeKeys.js'\nimport { isOnHandleElement } from '../utils/isOnHandleElement.js'\nimport { setHandlePosition } from '../utils/setHandlePosition.js'\nimport { getBoundingClientRectWithoutTransform } from './getBoundingRectWithoutTransform.js'\nimport './index.scss'\nimport { setTargetLine } from './setTargetLine.js'\n\nconst DRAGGABLE_BLOCK_MENU_CLASSNAME = 'draggable-block-menu'\nconst DRAG_DATA_FORMAT = 'application/x-lexical-drag-block'\n\nlet prevIndex = Infinity\n\nfunction getCurrentIndex(keysLength: number): number {\n if (keysLength === 0) {\n return Infinity\n }\n if (prevIndex >= 0 && prevIndex < keysLength) {\n return prevIndex\n }\n\n return Math.floor(keysLength / 2)\n}\n\nfunction setDragImage(dataTransfer: DataTransfer, draggableBlockElem: HTMLElement) {\n const { transform } = draggableBlockElem.style\n\n // Remove dragImage borders\n dataTransfer.setDragImage(draggableBlockElem, 0, 0)\n\n setTimeout(() => {\n draggableBlockElem.style.transform = transform\n })\n}\n\nfunction hideTargetLine(\n targetLineElem: HTMLElement | null,\n lastTargetBlockElem: HTMLElement | null,\n) {\n if (targetLineElem) {\n targetLineElem.style.opacity = '0'\n }\n if (lastTargetBlockElem) {\n lastTargetBlockElem.style.opacity = ''\n // Delete marginBottom and marginTop values we set\n lastTargetBlockElem.style.marginBottom = ''\n lastTargetBlockElem.style.marginTop = ''\n //lastTargetBlock.style.border = 'none'\n }\n}\n\nfunction useDraggableBlockMenu(\n editor: LexicalEditor,\n anchorElem: HTMLElement,\n isEditable: boolean,\n): React.ReactElement {\n const scrollerElem = anchorElem.parentElement\n\n const menuRef = useRef<HTMLDivElement>(null)\n const targetLineRef = useRef<HTMLDivElement>(null)\n const debugHighlightRef = useRef<HTMLDivElement>(null)\n const isDraggingBlockRef = useRef<boolean>(false)\n const [draggableBlockElem, setDraggableBlockElem] = useState<HTMLElement | null>(null)\n const [lastTargetBlock, setLastTargetBlock] = useState<{\n boundingBox?: DOMRect\n elem: HTMLElement | null\n isBelow: boolean\n } | null>(null)\n\n const { editorConfig } = useEditorConfigContext()\n\n const blockHandleHorizontalOffset = editorConfig?.admin?.hideGutter ? -44 : -8\n\n useEffect(() => {\n /**\n * Handles positioning of the drag handle\n */\n function onDocumentMouseMove(event: MouseEvent) {\n const target = event.target\n if (!isHTMLElement(target)) {\n return\n }\n\n const distanceFromScrollerElem = calculateDistanceFromScrollerElem(\n scrollerElem,\n event.pageX,\n event.pageY,\n target,\n )\n if (distanceFromScrollerElem === -1) {\n setDraggableBlockElem(null)\n return\n }\n\n if (isOnHandleElement(target, DRAGGABLE_BLOCK_MENU_CLASSNAME)) {\n return\n }\n\n const topLevelNodeKeys = getTopLevelNodeKeys(editor)\n\n const {\n blockElem: _draggableBlockElem,\n foundAtIndex,\n isFoundNodeEmptyParagraph,\n } = getNodeCloseToPoint({\n anchorElem,\n cache_threshold: 0,\n editor,\n horizontalOffset: -distanceFromScrollerElem,\n point: new Point(event.x, event.y),\n startIndex: getCurrentIndex(topLevelNodeKeys.length),\n useEdgeAsDefault: false,\n verbose: false,\n })\n\n prevIndex = foundAtIndex\n\n //if (DEBUG && _draggableBlockElem) {\n //targetBlockElem.style.border = '3px solid red'\n // highlightElemOriginalPosition(debugHighlightRef, _draggableBlockElem, anchorElem)\n //}\n\n if (!_draggableBlockElem && !isFoundNodeEmptyParagraph) {\n return\n }\n\n if (draggableBlockElem !== _draggableBlockElem) {\n setDraggableBlockElem(_draggableBlockElem)\n }\n }\n\n // Since the draggableBlockElem is outside the actual editor, we need to listen to the document\n // to be able to detect when the mouse is outside the editor and respect a buffer around\n // the scrollerElem to avoid the draggableBlockElem disappearing too early.\n document?.addEventListener('mousemove', onDocumentMouseMove)\n\n return () => {\n document?.removeEventListener('mousemove', onDocumentMouseMove)\n }\n }, [scrollerElem, anchorElem, editor, draggableBlockElem])\n\n useEffect(() => {\n if (menuRef.current) {\n setHandlePosition(\n draggableBlockElem,\n menuRef.current,\n anchorElem,\n blockHandleHorizontalOffset,\n )\n }\n }, [anchorElem, draggableBlockElem, blockHandleHorizontalOffset])\n\n useEffect(() => {\n function onDragover(event: DragEvent): boolean {\n if (!isDraggingBlockRef.current) {\n return false\n }\n const [isFileTransfer] = eventFiles(event)\n if (isFileTransfer) {\n return false\n }\n\n const { pageY, target } = event\n if (!isHTMLElement(target)) {\n return false\n }\n\n const distanceFromScrollerElem = calculateDistanceFromScrollerElem(\n scrollerElem,\n event.pageX,\n event.pageY,\n target,\n 100,\n 50,\n )\n\n const topLevelNodeKeys = getTopLevelNodeKeys(editor)\n\n const {\n blockElem: targetBlockElem,\n foundAtIndex,\n isFoundNodeEmptyParagraph,\n } = getNodeCloseToPoint({\n anchorElem,\n editor,\n fuzzy: true,\n horizontalOffset: -distanceFromScrollerElem,\n point: new Point(event.x, event.y),\n startIndex: getCurrentIndex(topLevelNodeKeys.length),\n useEdgeAsDefault: true,\n verbose: true,\n })\n\n prevIndex = foundAtIndex\n\n const targetLineElem = targetLineRef.current\n // targetBlockElem === null shouldn't happen\n if (targetBlockElem === null || targetLineElem === null) {\n return false\n }\n\n if (draggableBlockElem !== targetBlockElem) {\n const { isBelow, willStayInSamePosition } = setTargetLine(\n editorConfig?.admin?.hideGutter ? '0px' : '3rem',\n blockHandleHorizontalOffset +\n (editorConfig?.admin?.hideGutter\n ? (menuRef?.current?.getBoundingClientRect()?.width ?? 0)\n : -(menuRef?.current?.getBoundingClientRect()?.width ?? 0)),\n targetLineElem,\n targetBlockElem,\n lastTargetBlock!,\n pageY,\n anchorElem,\n event,\n debugHighlightRef,\n isFoundNodeEmptyParagraph,\n )\n\n // Prevent default event to be able to trigger onDrop events\n // Calling preventDefault() adds the green plus icon to the cursor,\n // indicating that the drop is allowed.\n event.preventDefault()\n\n if (!willStayInSamePosition) {\n setLastTargetBlock({\n boundingBox: targetBlockElem.getBoundingClientRect(),\n elem: targetBlockElem,\n isBelow,\n })\n }\n } else if (lastTargetBlock?.elem) {\n hideTargetLine(targetLineElem, lastTargetBlock.elem)\n setLastTargetBlock({\n boundingBox: targetBlockElem.getBoundingClientRect(),\n elem: targetBlockElem,\n isBelow: false,\n })\n }\n\n return true\n }\n\n function onDrop(event: DragEvent): boolean {\n if (!isDraggingBlockRef.current) {\n return false\n }\n const [isFileTransfer] = eventFiles(event)\n if (isFileTransfer) {\n return false\n }\n const { dataTransfer, pageY, target } = event\n const dragData = dataTransfer?.getData(DRAG_DATA_FORMAT) || ''\n\n editor.update(() => {\n const draggedNode = $getNodeByKey(dragData)\n if (!draggedNode) {\n return false\n }\n if (!isHTMLElement(target)) {\n return false\n }\n const distanceFromScrollerElem = calculateDistanceFromScrollerElem(\n scrollerElem,\n event.pageX,\n event.pageY,\n target,\n 100,\n 50,\n )\n\n const { blockElem: targetBlockElem, isFoundNodeEmptyParagraph } = getNodeCloseToPoint({\n anchorElem,\n editor,\n fuzzy: true,\n horizontalOffset: -distanceFromScrollerElem,\n point: new Point(event.x, event.y),\n useEdgeAsDefault: true,\n })\n\n if (!targetBlockElem) {\n return false\n }\n const targetNode = $getNearestNodeFromDOMNode(targetBlockElem)\n if (!targetNode) {\n return false\n }\n if (targetNode === draggedNode) {\n return true\n }\n\n const { height: targetBlockElemHeight, top: targetBlockElemTop } =\n getBoundingClientRectWithoutTransform(targetBlockElem)\n\n const mouseY = pageY\n const isBelow = mouseY >= targetBlockElemTop + targetBlockElemHeight / 2 + window.scrollY\n\n if (!isFoundNodeEmptyParagraph) {\n if (isBelow) {\n // below targetBlockElem\n targetNode.insertAfter(draggedNode)\n } else {\n // above targetBlockElem\n targetNode.insertBefore(draggedNode)\n }\n } else {\n //\n targetNode.insertBefore(draggedNode)\n targetNode.remove()\n }\n\n /*\n if (pageY >= targetBlockElemTop + targetBlockElemHeight / 2) {\n targetNode.insertAfter(draggedNode)\n } else {\n targetNode.insertBefore(draggedNode)\n }*/\n if (draggableBlockElem !== null) {\n setDraggableBlockElem(null)\n }\n\n // find all previous elements with lexical-block-highlighter class and remove them\n const allPrevHighlighters = document.querySelectorAll('.lexical-block-highlighter')\n allPrevHighlighters.forEach((highlighter) => {\n highlighter.remove()\n })\n\n const newInsertedElem = editor.getElementByKey(draggedNode.getKey())\n setTimeout(() => {\n // add new temp html element to newInsertedElem with the same height and width and the class block-selected\n // to highlight the new inserted element\n const newInsertedElemRect = newInsertedElem?.getBoundingClientRect()\n if (!newInsertedElemRect) {\n return\n }\n const highlightElem = document.createElement('div')\n highlightElem.className = 'lexical-block-highlighter'\n\n highlightElem.style.backgroundColor = 'var(--theme-elevation-1000'\n highlightElem.style.transition = 'opacity 0.5s ease-in-out'\n highlightElem.style.zIndex = '1'\n highlightElem.style.pointerEvents = 'none'\n highlightElem.style.boxSizing = 'border-box'\n highlightElem.style.borderRadius = '4px'\n highlightElem.style.position = 'absolute'\n document.body.appendChild(highlightElem)\n\n highlightElem.style.opacity = '0.1'\n\n highlightElem.style.height = `${newInsertedElemRect.height + 8}px`\n highlightElem.style.width = `${newInsertedElemRect.width + 8}px`\n highlightElem.style.top = `${newInsertedElemRect.top + window.scrollY - 4}px`\n highlightElem.style.left = `${newInsertedElemRect.left - 4}px`\n\n setTimeout(() => {\n highlightElem.style.opacity = '0'\n setTimeout(() => {\n highlightElem.remove()\n }, 500)\n }, 1000)\n }, 120)\n })\n\n return true\n }\n\n // register onDragover event listeners:\n document.addEventListener('dragover', onDragover)\n // register onDrop event listeners:\n document.addEventListener('drop', onDrop)\n\n return () => {\n document.removeEventListener('dragover', onDragover)\n document.removeEventListener('drop', onDrop)\n }\n }, [\n scrollerElem,\n blockHandleHorizontalOffset,\n anchorElem,\n editor,\n lastTargetBlock,\n draggableBlockElem,\n editorConfig?.admin?.hideGutter,\n ])\n\n function onDragStart(event: ReactDragEvent<HTMLDivElement>): void {\n const dataTransfer = event.dataTransfer\n if (!dataTransfer || !draggableBlockElem) {\n return\n }\n setDragImage(dataTransfer, draggableBlockElem)\n let nodeKey = ''\n editor.update(() => {\n const node = $getNearestNodeFromDOMNode(draggableBlockElem)\n if (node) {\n nodeKey = node.getKey()\n }\n })\n isDraggingBlockRef.current = true\n dataTransfer.setData(DRAG_DATA_FORMAT, nodeKey)\n }\n\n function onDragEnd(): void {\n isDraggingBlockRef.current = false\n if (lastTargetBlock?.elem) {\n hideTargetLine(targetLineRef.current, lastTargetBlock?.elem)\n }\n }\n\n return createPortal(\n <React.Fragment>\n <div\n className=\"icon draggable-block-menu\"\n draggable\n onDragEnd={onDragEnd}\n onDragStart={onDragStart}\n ref={menuRef}\n >\n <div className={isEditable ? 'icon' : ''} />\n </div>\n <div className=\"draggable-block-target-line\" ref={targetLineRef} />\n <div className=\"debug-highlight\" ref={debugHighlightRef} />\n </React.Fragment>,\n anchorElem,\n )\n}\n\nexport function DraggableBlockPlugin({\n anchorElem = document.body,\n}: {\n anchorElem?: HTMLElement\n}): React.ReactElement {\n const [editor] = useLexicalComposerContext()\n return useDraggableBlockMenu(editor, anchorElem, editor._editable)\n}\n", "'use client'\nimport { getCollapsedMargins } from '../utils/getCollapsedMargins.js'\nconst TARGET_LINE_HALF_HEIGHT = 0\nconst TEXT_BOX_HORIZONTAL_PADDING = -24\nconst DEBUG = false\n\nlet animationTimer = 0\n\nexport function setTargetLine(\n offsetWidth: string,\n offsetLeft: number,\n targetLineElem: HTMLElement,\n targetBlockElem: HTMLElement,\n lastTargetBlock: {\n boundingBox?: DOMRect\n elem: HTMLElement | null\n isBelow: boolean\n },\n mouseY: number,\n anchorElem: HTMLElement,\n event: DragEvent,\n debugHighlightRef: React.RefObject<HTMLDivElement | null>,\n isFoundNodeEmptyParagraph: boolean = false,\n) {\n const { height: targetBlockElemHeight, top: targetBlockElemTop } =\n targetBlockElem.getBoundingClientRect() // used to be getBoundingClientRectWithoutTransform. Not sure what's better, but the normal getBoundingClientRect seems to work fine\n const { top: anchorTop, width: anchorWidth } = anchorElem.getBoundingClientRect()\n\n const { marginBottom, marginTop } = getCollapsedMargins(targetBlockElem)\n let lineTop = targetBlockElemTop\n\n const isBelow = mouseY >= targetBlockElemTop + targetBlockElemHeight / 2 + window.scrollY\n\n let willStayInSamePosition = false\n\n /**\n * Do not run any transform or changes if the actual new line position would be the same (even if it's now inserted BEFORE rather than AFTER - position would still be the same)\n * This prevents unnecessary flickering.\n *\n * We still need to let it run even if the position (IGNORING the transform) would not change, as the transform animation is not finished yet. This is what animationTimer does. Otherwise, the positioning will be inaccurate\n */\n if (lastTargetBlock?.elem) {\n if (targetBlockElem !== lastTargetBlock?.elem) {\n if (\n isBelow &&\n lastTargetBlock?.elem &&\n lastTargetBlock?.elem === targetBlockElem.nextElementSibling\n ) {\n animationTimer++\n\n if (animationTimer < 200) {\n willStayInSamePosition = true\n }\n } else if (\n !isBelow &&\n lastTargetBlock?.elem &&\n lastTargetBlock?.elem === targetBlockElem.previousElementSibling\n ) {\n animationTimer++\n if (animationTimer < 200) {\n willStayInSamePosition = true\n }\n }\n } else {\n animationTimer++\n\n const lastBoundingBoxPosition = lastTargetBlock?.boundingBox?.y\n const currentBoundingBoxPosition = targetBlockElem.getBoundingClientRect().y\n\n if (\n (isBelow === lastTargetBlock?.isBelow &&\n lastBoundingBoxPosition === currentBoundingBoxPosition) ||\n animationTimer < 200\n ) {\n willStayInSamePosition = false\n }\n }\n }\n if (willStayInSamePosition) {\n return {\n isBelow,\n willStayInSamePosition,\n }\n }\n\n /**\n * Paragraphs need no isBelow/above handling,\n */\n if (!isFoundNodeEmptyParagraph) {\n //if (!isFoundNodeEmptyParagraph) {\n if (isBelow) {\n // below targetBlockElem\n lineTop += targetBlockElemHeight + marginBottom / 2\n } else {\n // above targetBlockElem\n lineTop -= marginTop / 2\n }\n } else {\n lineTop += targetBlockElemHeight / 2\n }\n\n let targetElemTranslate2 = 0\n\n if (!isFoundNodeEmptyParagraph) {\n if (isBelow) {\n targetElemTranslate2 = -TARGET_LINE_HALF_HEIGHT\n } else {\n targetElemTranslate2 = TARGET_LINE_HALF_HEIGHT\n }\n }\n\n const top = lineTop - anchorTop + targetElemTranslate2\n\n const left = TEXT_BOX_HORIZONTAL_PADDING - offsetLeft\n\n targetLineElem.style.width = `calc(${anchorWidth}px - ${offsetWidth})`\n targetLineElem.style.opacity = '.8'\n\n // if (DEBUG) {\n // //targetBlockElem.style.border = '3px solid red'\n // highlightElemOriginalPosition(debugHighlightRef, targetBlockElem, anchorElem)\n // }\n\n targetLineElem.style.transform = `translate(${left}px, calc(${top}px - ${'2px'}))`\n\n /**\n * Properly reset previous targetBlockElem styles\n */\n if (lastTargetBlock?.elem) {\n lastTargetBlock.elem.style.opacity = ''\n\n if (lastTargetBlock?.elem === targetBlockElem) {\n if (isBelow) {\n lastTargetBlock.elem.style.marginTop = ''\n } else {\n lastTargetBlock.elem.style.marginBottom = ''\n }\n } else {\n lastTargetBlock.elem.style.marginBottom = ''\n lastTargetBlock.elem.style.marginTop = ''\n }\n }\n\n animationTimer = 0\n return {\n isBelow,\n willStayInSamePosition,\n }\n}\n", "'use client'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport * as React from 'react'\n\nimport { registerMarkdownShortcuts } from '../../../packages/@lexical/markdown/MarkdownShortcuts.js'\nimport { useEditorConfigContext } from '../../config/client/EditorConfigProvider.js'\n\nexport const MarkdownShortcutPlugin: React.FC = () => {\n const { editorConfig } = useEditorConfigContext()\n const [editor] = useLexicalComposerContext()\n\n React.useEffect(() => {\n return registerMarkdownShortcuts(editor, editorConfig.features.markdownTransformers ?? [])\n }, [editor, editorConfig.features.markdownTransformers])\n\n return null\n}\n", "'use client'\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { useTranslation } from '@payloadcms/ui'\nimport { useCallback, useMemo, useState } from 'react'\nimport * as React from 'react'\nimport * as ReactDOM from 'react-dom'\n\nimport type {\n SlashMenuGroup,\n SlashMenuGroupInternal,\n SlashMenuItemInternal,\n SlashMenuItem as SlashMenuItemType,\n} from './LexicalTypeaheadMenuPlugin/types.js'\n\nimport { useEditorConfigContext } from '../../config/client/EditorConfigProvider.js'\nimport './index.scss'\nimport { LexicalTypeaheadMenuPlugin } from './LexicalTypeaheadMenuPlugin/index.js'\nimport { useMenuTriggerMatch } from './useMenuTriggerMatch.js'\n\nconst baseClass = 'slash-menu-popup'\n\nfunction SlashMenuItem({\n isSelected,\n item,\n onClick,\n onMouseEnter,\n ref,\n}: {\n index: number\n isSelected: boolean\n item: SlashMenuItemInternal\n onClick: () => void\n onMouseEnter: () => void\n ref?: React.Ref<HTMLButtonElement>\n}) {\n const {\n fieldProps: { featureClientSchemaMap, schemaPath },\n } = useEditorConfigContext()\n\n const { i18n } = useTranslation<{}, string>()\n\n let className = `${baseClass}__item ${baseClass}__item-${item.key}`\n if (isSelected) {\n className += ` ${baseClass}__item--selected`\n }\n\n let title = item.key\n if (item.label) {\n title =\n typeof item.label === 'function'\n ? item.label({ featureClientSchemaMap, i18n, schemaPath })\n : item.label\n }\n // Crop title to max. 25 characters\n if (title.length > 25) {\n title = title.substring(0, 25) + '...'\n }\n\n return (\n <button\n aria-selected={isSelected}\n className={className}\n id={baseClass + '__item-' + item.key}\n key={item.key}\n onClick={onClick}\n onMouseEnter={onMouseEnter}\n ref={ref}\n role=\"option\"\n tabIndex={-1}\n type=\"button\"\n >\n {item?.Icon && <item.Icon />}\n\n <span className={`${baseClass}__item-text`}>{title}</span>\n </button>\n )\n}\n\nexport function SlashMenuPlugin({\n anchorElem = document.body,\n}: {\n anchorElem?: HTMLElement\n}): React.ReactElement {\n const [editor] = useLexicalComposerContext()\n const [queryString, setQueryString] = useState<null | string>(null)\n const { editorConfig } = useEditorConfigContext()\n const { i18n } = useTranslation<{}, string>()\n const {\n fieldProps: { featureClientSchemaMap, schemaPath },\n } = useEditorConfigContext()\n\n const checkForTriggerMatch = useMenuTriggerMatch('/', {\n minLength: 0,\n })\n\n const getDynamicItems = useCallback(() => {\n let groupWithItems: Array<SlashMenuGroup> = []\n\n for (const dynamicItem of editorConfig.features.slashMenu.dynamicGroups) {\n if (queryString) {\n const dynamicGroupWithItems = dynamicItem({\n editor,\n queryString,\n })\n groupWithItems = groupWithItems.concat(dynamicGroupWithItems)\n }\n }\n\n return groupWithItems\n }, [editor, queryString, editorConfig?.features])\n\n const groups: SlashMenuGroup[] = useMemo(() => {\n let groupsWithItems: SlashMenuGroup[] = []\n for (const groupWithItem of editorConfig?.features.slashMenu.groups ?? []) {\n groupsWithItems.push(groupWithItem)\n }\n\n if (queryString) {\n // Filter current groups first\n // @ts-expect-error - TODO: fix this\n groupsWithItems = groupsWithItems.map((group) => {\n const filteredItems = group.items.filter((item) => {\n let itemTitle = item.key\n if (item.label) {\n itemTitle =\n typeof item.label === 'function'\n ? item.label({ featureClientSchemaMap, i18n, schemaPath })\n : item.label\n }\n\n if (new RegExp(queryString, 'gi').exec(itemTitle)) {\n return true\n }\n if (item.keywords != null) {\n return item.keywords.some((keyword) => new RegExp(queryString, 'gi').exec(keyword))\n }\n return false\n })\n if (filteredItems.length) {\n return {\n ...group,\n items: filteredItems,\n }\n }\n return null\n })\n\n groupsWithItems = groupsWithItems.filter((group) => group != null)\n\n // Now add dynamic groups\n const dynamicItemGroups = getDynamicItems()\n\n // merge dynamic items into groups\n for (const dynamicGroup of dynamicItemGroups) {\n // 1. find the group with the same name or create new one\n let group = groupsWithItems.find((group) => group.key === dynamicGroup.key)\n if (!group) {\n group = {\n ...dynamicGroup,\n items: [],\n }\n } else {\n groupsWithItems = groupsWithItems.filter((group) => group.key !== dynamicGroup.key)\n }\n\n // 2. Add items to group items array and add to sanitized.slashMenu.groupsWithItems\n if (group?.items?.length) {\n group.items = group.items.concat(group.items)\n }\n groupsWithItems.push(group)\n }\n }\n\n return groupsWithItems\n }, [\n queryString,\n editorConfig?.features.slashMenu.groups,\n getDynamicItems,\n featureClientSchemaMap,\n i18n,\n schemaPath,\n ])\n\n return (\n <LexicalTypeaheadMenuPlugin\n anchorElem={anchorElem}\n groups={groups as SlashMenuGroupInternal[]}\n menuRenderFn={(\n anchorElementRef,\n { selectedItemKey, selectItemAndCleanUp, setSelectedItemKey },\n ) =>\n anchorElementRef.current && groups.length\n ? ReactDOM.createPortal(\n <div className={baseClass}>\n {groups.map((group) => {\n let groupTitle = group.key\n if (group.label && featureClientSchemaMap) {\n groupTitle =\n typeof group.label === 'function'\n ? group.label({ featureClientSchemaMap, i18n, schemaPath })\n : group.label\n }\n\n return (\n <div\n className={`${baseClass}__group ${baseClass}__group-${group.key}`}\n key={group.key}\n >\n <div className={`${baseClass}__group-title`}>{groupTitle}</div>\n {group.items.map((item, oi: number) => (\n <SlashMenuItem\n index={oi}\n isSelected={selectedItemKey === item.key}\n item={item as SlashMenuItemInternal}\n key={item.key}\n onClick={() => {\n setSelectedItemKey(item.key)\n selectItemAndCleanUp(item)\n }}\n onMouseEnter={() => {\n setSelectedItemKey(item.key)\n }}\n ref={(el) => {\n ;(item as SlashMenuItemInternal).ref = { current: el }\n }}\n />\n ))}\n </div>\n )\n })}\n </div>,\n anchorElementRef.current,\n )\n : null\n }\n onQueryChange={setQueryString}\n triggerFn={checkForTriggerMatch}\n />\n )\n}\n", "'use client'\nimport type { LexicalEditor } from 'lexical'\n\nimport { useCallback } from 'react'\n\nimport { PUNCTUATION } from './LexicalTypeaheadMenuPlugin/index.js'\n\nexport type TriggerFn = ({\n editor,\n query,\n}: {\n editor: LexicalEditor\n /** The query string is the POTENTIAL trigger AND the text after the trigger text. */\n query: string\n}) => MenuTextMatch | null\n\nexport type MenuTextMatch = {\n leadOffset: number\n matchingString: string\n replaceableString: string\n}\n\n/**\n * Returns a function which checks if the trigger (e.g. '/') is present in the query and, if so, returns the matching string (text after the trigger)\n */\nexport function useMenuTriggerMatch(\n /**\n * Text which triggers the menu. Everything after this text will be used as the query.\n */\n trigger: string,\n { maxLength = 75, minLength = 1 }: { maxLength?: number; minLength?: number },\n): TriggerFn {\n return useCallback(\n ({ query }) => {\n const validChars = '[^' + trigger + PUNCTUATION + '\\\\s]'\n const TypeaheadTriggerRegex = new RegExp(\n '(^|\\\\s|\\\\()(' +\n '[' +\n trigger +\n ']' +\n '((?:' +\n validChars +\n '){0,' +\n maxLength +\n '})' +\n ')$',\n )\n const match = TypeaheadTriggerRegex.exec(query)\n if (match !== null) {\n const maybeLeadingWhitespace = match[1]\n\n /**\n * matchingString is only the text AFTER the trigger text. (So everything after the /)\n */\n const matchingString = match[3]\n\n if (matchingString.length >= minLength) {\n return {\n leadOffset: match.index + maybeLeadingWhitespace.length,\n matchingString,\n replaceableString: match[2], // replaceableString is the trigger text + the matching string\n }\n }\n }\n return null\n },\n [maxLength, minLength, trigger],\n )\n}\n", "'use client'\nimport type { TextFormatType } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { TEXT_TYPE_TO_FORMAT, TextNode } from 'lexical'\nimport { type SanitizedClientFeatures } from 'packages/richtext-lexical/src/features/typesClient.js'\nimport { useEffect } from 'react'\n\nexport function TextPlugin({ features }: { features: SanitizedClientFeatures }) {\n const [editor] = useLexicalComposerContext()\n\n useEffect(() => {\n const disabledFormats = getDisabledFormats(features.enabledFormats as TextFormatType[])\n if (disabledFormats.length === 0) {\n return\n }\n // Ideally override the TextNode with our own TextNode (changing its setFormat or toggleFormat methods),\n // would be more performant. If we find a noticeable perf regression we can switch to that option.\n // Overriding the FORMAT_TEXT_COMMAND and PASTE_COMMAND commands is not an option I considered because\n // there might be other forms of mutation that we might not be considering. For example:\n // browser extensions or Payload/Lexical plugins that have their own commands.\n return editor.registerNodeTransform(TextNode, (textNode) => {\n disabledFormats.forEach((disabledFormat) => {\n if (textNode.hasFormat(disabledFormat)) {\n textNode.toggleFormat(disabledFormat)\n }\n })\n })\n }, [editor, features])\n\n return null\n}\n\nfunction getDisabledFormats(enabledFormats: TextFormatType[]): TextFormatType[] {\n // not sure why Lexical added highlight as TextNode format.\n // see https://github.com/facebook/lexical/pull/3583\n // We are going to implement it in other way to support multiple colors\n delete TEXT_TYPE_TO_FORMAT.highlight\n const allFormats = Object.keys(TEXT_TYPE_TO_FORMAT) as TextFormatType[]\n const enabledSet = new Set(enabledFormats)\n\n return allFormats.filter((format) => !enabledSet.has(format))\n}\n", "'use client'\nimport type { JSX } from 'react'\n\nimport { ContentEditable } from '@lexical/react/LexicalContentEditable.js'\nimport { useTranslation } from '@payloadcms/ui'\nimport * as React from 'react'\n\nimport './ContentEditable.scss'\n\nexport function LexicalContentEditable({ className }: { className?: string }): JSX.Element {\n const { t } = useTranslation<{}, string>()\n\n return (\n <ContentEditable\n aria-placeholder={t('lexical:general:placeholder')}\n className={className ?? 'ContentEditable__root'}\n placeholder={<p className=\"editor-placeholder\">{t('lexical:general:placeholder')}</p>}\n />\n )\n}\n"],
5
+ "mappings": "+MAIA,OACEA,oBAAAA,GACAC,cAAAA,GACAC,cAAAA,GACAC,yBAAAA,GACAC,gBAAAA,GACAC,YAAAA,OACK,iBACP,OAASC,oBAAAA,OAAwB,wBACjC,OAAgBC,eAAAA,GAAaC,WAAAA,OAAe,QAC5C,OAASC,iBAAAA,OAAqB,uBAM9B,MAAO,wDCfP,OAASC,mBAAAA,OAAuB,oCAChC,UAAYC,OAAW,QACvB,OAASC,WAAAA,OAAe,QCPxB,OAAAC,KAAAC,OAAA,2EACA,OAASC,6BAAAA,OAAiC,2CAC1C,OAASC,wBAAAA,OAA4B,yCACrC,OAASC,iBAAAA,OAAqB,yCAC9B,OAASC,kBAAAA,OAAsB,0CAC/B,OAASC,kBAAAA,OAAsB,0CAC/B,OAASC,gBAAAA,GAAcC,wBAAAA,GAAsBC,iBAAAA,OAAqB,UAClE,UAAYC,MAAW,QACvB,OAASC,aAAAA,GAAWC,YAAAA,OAAgB,iDCPpC,MAAkB,QAIX,IAAMC,EAIRA,CAAC,CAAEC,WAAAA,EAAYC,YAAAA,EAAaC,OAAAA,CAAM,IACjCA,EAAOC,WAAa,sBAAwBH,EAE5CE,EAAOE,WAAaC,GAACH,EAAOE,UAAS,CAACJ,WAAYA,EAAYC,YAAaA,IAKxEC,EAAOE,WAAaC,GAACH,EAAO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A,CAAiB3D,YAAaA,EAAaM,KAAMA,WAvBpC6B,CAAA,CA4BlC,EAEA,SAASgB,GAAe,CAAES,MAAAA,CAAK,EAAoB,CAGjD,OACElB,GAAC,MAAA,CAAI3C,UAAU,gBAAgB8D,KAAK,kBAClCjB,EAAC,IAAA,UAAE,0BACHA,EAAC,MAAA,CAAID,MAAO,CAAEmB,MAAO,KAAM,WAAIF,EAAMG,YAG3C,CAEO,IAAMC,GAAqCvE",
6
+ "names": ["FieldDescription", "FieldError", "FieldLabel", "RenderCustomComponent", "useEditDepth", "useField", "mergeFieldStyles", "useCallback", "useMemo", "ErrorBoundary", "LexicalComposer", "React", "useMemo", "c", "_c", "useLexicalComposerContext", "LexicalErrorBoundary", "HistoryPlugin", "OnChangePlugin", "RichTextPlugin", "BLUR_COMMAND", "COMMAND_PRIORITY_LOW", "FOCUS_COMMAND", "React", "useEffect", "useState", "EditorPlugin", "anchorElem", "clientProps", "plugin", "position", "Component", "_jsx", "useLexicalComposerContext", "$createParagraphNode", "React", "useCallback", "useEffect", "useRef", "useState", "createPortal", "calculateDistanceFromScrollerElem", "scrollerElem", "pageX", "pageY", "target", "horizontalBuffer", "verticalBuffer", "distanceFromScrollerElem", "contains", "bottom", "left", "right", "top", "getBoundingClientRect", "adjustedTop", "window", "scrollY", "adjustedBottom", "$getNodeByKey", "getBoundingClientRectWithoutTransform", "elem", "rect", "getBoundingClientRect", "transformValue", "getComputedStyle", "getPropertyValue", "lastNumberOfTransformValue", "split", "pop", "y", "Number", "replace", "getCollapsedMargins", "elem", "getMargin", "element", "margin", "parseFloat", "window", "getComputedStyle", "marginBottom", "marginTop", "prevElemSiblingMarginBottom", "previousElementSibling", "nextElemSiblingMarginTop", "nextElementSibling", "collapsedTopMargin", "Math", "max", "$getRoot", "getTopLevelNodeKeys", "editor", "getEditorState", "read", "getChildrenKeys", "Downward", "Upward", "Indeterminate", "cache", "props", "result", "isPointClose", "previous", "current", "threshold", "dx", "x", "dy", "y", "getNodeCloseToPoint", "anchorElem", "cache_threshold", "editor", "fuzzy", "horizontalOffset", "point", "startIndex", "useEdgeAsDefault", "anchorElementRect", "getBoundingClientRect", "topLevelNodeKeys", "getTopLevelNodeKeys", "closestBlockElem", "blockElem", "blockNode", "distance", "Infinity", "foundAtIndex", "isFoundNodeEmptyParagraph", "getEditorState", "read", "firstNode", "lastNode", "getElementByKey", "length", "firstNodeRect", "lastNodeRect", "getBoundingClientRectWithoutTransform", "top", "$getNodeByKey", "bottom", "index", "direction", "key", "elem", "Point", "domRect", "Rect", "fromDOMRect", "marginBottom", "marginTop", "getCollapsedMargins", "rect", "generateNewRect", "left", "right", "isOnBottomSide", "isOnTopSide", "distanceFromPoint", "getType", "getTextContent", "returnEmptyParagraphs", "isOnHandleElement", "element", "handleElementClassName", "closest", "replacedElements", "doesLineHeightAffectElement", "htmlElem", "includes", "tagName", "offsetHeight", "offsetWidth", "style", "window", "getComputedStyle", "display", "position", "visibility", "opacity", "setHandlePosition", "targetElem", "handleElem", "anchorElem", "leftOffset", "style", "opacity", "transform", "targetRect", "getBoundingClientRect", "targetStyle", "window", "getComputedStyle", "floatingElemRect", "anchorElementRect", "top", "some", "classes", "firstElementChild", "classList", "contains", "actualLineHeight", "doesLineHeightAffectElement", "parseInt", "lineHeight", "height", "left", "ADD_BLOCK_MENU_CLASSNAME", "prevIndex", "Infinity", "getCurrentIndex", "keysLength", "Math", "floor", "useAddBlockHandle", "editor", "anchorElem", "isEditable", "scrollerElem", "parentElement", "editorConfig", "useEditorConfigContext", "blockHandleHorizontalOffset", "admin", "hideGutter", "menuRef", "useRef", "hoveredElement", "setHoveredElement", "useState", "useEffect", "onDocumentMouseMove", "event", "target", "isHTMLElement", "distanceFromScrollerElem", "calculateDistanceFromScrollerElem", "pageX", "pageY", "isOnHandleElement", "topLevelNodeKeys", "getTopLevelNodeKeys", "blockElem", "_emptyBlockElem", "blockNode", "foundAtIndex", "getNodeCloseToPoint", "cache_threshold", "horizontalOffset", "point", "Point", "x", "y", "returnEmptyParagraphs", "startIndex", "length", "useEdgeAsDefault", "node", "elem", "document", "addEventListener", "removeEventListener", "current", "setHandlePosition", "handleAddClick", "useCallback", "hoveredElementToUse", "update", "isEmptyParagraph", "getType", "getTextContent", "newParagraph", "$createParagraphNode", "insertAfter", "setTimeout", "getElementByKey", "getKey", "focus", "select", "dispatchCommand", "ENABLE_SLASH_MENU_COMMAND", "stopPropagation", "preventDefault", "createPortal", "_jsx", "Fragment", "className", "onClick", "ref", "type", "AddBlockHandlePlugin", "t0", "t1", "undefined", "body", "useLexicalComposerContext", "_editable", "useLexicalComposerContext", "eventFiles", "$getNearestNodeFromDOMNode", "$getNodeByKey", "React", "useEffect", "useRef", "useState", "createPortal", "TARGET_LINE_HALF_HEIGHT", "TEXT_BOX_HORIZONTAL_PADDING", "animationTimer", "setTargetLine", "offsetWidth", "offsetLeft", "targetLineElem", "targetBlockElem", "lastTargetBlock", "mouseY", "anchorElem", "event", "debugHighlightRef", "isFoundNodeEmptyParagraph", "height", "targetBlockElemHeight", "top", "targetBlockElemTop", "getBoundingClientRect", "anchorTop", "width", "anchorWidth", "marginBottom", "marginTop", "getCollapsedMargins", "lineTop", "isBelow", "window", "scrollY", "willStayInSamePosition", "elem", "nextElementSibling", "previousElementSibling", "lastBoundingBoxPosition", "boundingBox", "y", "currentBoundingBoxPosition", "targetElemTranslate2", "TARGET_LINE_HALF_HEIGHT", "left", "TEXT_BOX_HORIZONTAL_PADDING", "style", "opacity", "transform", "DRAGGABLE_BLOCK_MENU_CLASSNAME", "DRAG_DATA_FORMAT", "prevIndex", "Infinity", "getCurrentIndex", "keysLength", "Math", "floor", "setDragImage", "dataTransfer", "draggableBlockElem", "transform", "style", "setTimeout", "hideTargetLine", "targetLineElem", "lastTargetBlockElem", "opacity", "marginBottom", "marginTop", "useDraggableBlockMenu", "editor", "anchorElem", "isEditable", "scrollerElem", "parentElement", "menuRef", "useRef", "targetLineRef", "debugHighlightRef", "isDraggingBlockRef", "setDraggableBlockElem", "useState", "lastTargetBlock", "setLastTargetBlock", "editorConfig", "useEditorConfigContext", "blockHandleHorizontalOffset", "admin", "hideGutter", "useEffect", "onDocumentMouseMove", "event", "target", "isHTMLElement", "distanceFromScrollerElem", "calculateDistanceFromScrollerElem", "pageX", "pageY", "isOnHandleElement", "topLevelNodeKeys", "getTopLevelNodeKeys", "blockElem", "_draggableBlockElem", "foundAtIndex", "isFoundNodeEmptyParagraph", "getNodeCloseToPoint", "cache_threshold", "horizontalOffset", "point", "Point", "x", "y", "startIndex", "length", "useEdgeAsDefault", "verbose", "document", "addEventListener", "removeEventListener", "current", "setHandlePosition", "onDragover", "isFileTransfer", "eventFiles", "targetBlockElem", "fuzzy", "isBelow", "willStayInSamePosition", "setTargetLine", "getBoundingClientRect", "width", "preventDefault", "boundingBox", "elem", "onDrop", "dragData", "getData", "update", "draggedNode", "$getNodeByKey", "targetNode", "$getNearestNodeFromDOMNode", "height", "targetBlockElemHeight", "top", "targetBlockElemTop", "getBoundingClientRectWithoutTransform", "window", "scrollY", "insertBefore", "remove", "insertAfter", "querySelectorAll", "forEach", "highlighter", "newInsertedElem", "getElementByKey", "getKey", "newInsertedElemRect", "highlightElem", "createElement", "className", "backgroundColor", "transition", "zIndex", "pointerEvents", "boxSizing", "borderRadius", "position", "body", "appendChild", "left", "onDragStart", "nodeKey", "node", "setData", "onDragEnd", "createPortal", "_jsxs", "Fragment", "_jsx", "draggable", "ref", "DraggableBlockPlugin", "t0", "t1", "undefined", "useLexicalComposerContext", "_editable", "c", "_c", "useLexicalComposerContext", "React", "MarkdownShortcutPlugin", "$", "_c", "editorConfig", "useEditorConfigContext", "editor", "useLexicalComposerContext", "t0", "t1", "features", "markdownTransformers", "registerMarkdownShortcuts", "useEffect", "useLexicalComposerContext", "useTranslation", "useCallback", "useMemo", "useState", "ReactDOM", "c", "_c", "useMenuTriggerMatch", "trigger", "t0", "$", "_c", "maxLength", "t1", "minLength", "t2", "undefined", "t3", "t4", "query", "validChars", "PUNCTUATION", "match", "RegExp", "exec", "maybeLeadingWhitespace", "matchingString", "length", "leadOffset", "index", "replaceableString", "baseClass", "SlashMenuItem", "isSelected", "item", "onClick", "onMouseEnter", "ref", "fieldProps", "featureClientSchemaMap", "schemaPath", "useEditorConfigContext", "i18n", "useTranslation", "className", "key", "title", "label", "length", "substring", "_jsxs", "id", "role", "tabIndex", "type", "Icon", "_jsx", "SlashMenuPlugin", "anchorElem", "document", "body", "editor", "useLexicalComposerContext", "queryString", "setQueryString", "useState", "editorConfig", "checkForTriggerMatch", "useMenuTriggerMatch", "minLength", "getDynamicItems", "useCallback", "groupWithItems", "dynamicItem", "features", "slashMenu", "dynamicGroups", "dynamicGroupWithItems", "concat", "groups", "useMemo", "groupsWithItems", "groupWithItem", "push", "map", "group", "filteredItems", "items", "filter", "itemTitle", "RegExp", "exec", "keywords", "some", "keyword", "dynamicItemGroups", "dynamicGroup", "find", "LexicalTypeaheadMenuPlugin", "menuRenderFn", "anchorElementRef", "selectedItemKey", "selectItemAndCleanUp", "setSelectedItemKey", "current", "createPortal", "groupTitle", "oi", "index", "el", "onQueryChange", "triggerFn", "c", "_c", "useLexicalComposerContext", "TEXT_TYPE_TO_FORMAT", "TextNode", "useEffect", "TextPlugin", "t0", "$", "features", "editor", "t1", "enabledFormats", "disabledFormats", "getDisabledFormats", "length", "registerNodeTransform", "textNode", "forEach", "disabledFormat", "hasFormat", "toggleFormat", "t2", "highlight", "allFormats", "Object", "keys", "enabledSet", "Set", "filter", "format", "has", "c", "_c", "ContentEditable", "useTranslation", "LexicalContentEditable", "t0", "$", "className", "t", "t1", "_jsx", "placeholder", "children", "LexicalEditor", "props", "$", "_c", "editorConfig", "editorContainerRef", "onChange", "editorConfigContext", "useEditorConfigContext", "editor", "useLexicalComposerContext", "floatingAnchorElem", "setFloatingAnchorElem", "useState", "t0", "Symbol", "for", "_floatingAnchorElem", "onRef", "t1", "t2", "uuid", "console", "error", "parentEditor", "registerChild", "handleFocus", "focusEditor", "handleBlur", "blurEditor", "unregisterFocus", "registerCommand", "FOCUS_COMMAND", "COMMAND_PRIORITY_LOW", "unregisterBlur", "BLUR_COMMAND", "unregisterChild", "useEffect", "isSmallWidthViewport", "setIsSmallWidthViewport", "t3", "t4", "updateViewPortWidth", "isNextSmallWidthViewport", "window", "matchMedia", "matches", "addEventListener", "removeEventListener", "t5", "features", "t6", "editorState", "editor_0", "tags", "has", "size", "t7", "plugins", "_jsxs", "Fragment", "children", "isEditable", "_jsx", "DraggableBlockPlugin", "anchorElem", "AddBlockHandlePlugin", "map", "plugin_1", "plugin", "position", "desktopOnly", "EditorPlugin", "clientProps", "key", "SlashMenuPlugin", "_temp", "className", "ref", "_temp2", "RichTextPlugin", "contentEditable", "tabIndex", "LexicalContentEditable", "TextPlugin", "OnChangePlugin", "ignoreSelectionChange", "HistoryPlugin", "markdownTransformers", "length", "MarkdownShortcutPlugin", "_temp3", "_temp4", "_temp5", "plugin_0", "plugin_2", "plugin_3", "plugin_4", "NestProviders", "children", "providers", "length", "Component", "_jsx", "slice", "LexicalProvider", "props", "composerKey", "editorConfig", "fieldProps", "onChange", "readOnly", "value", "parentContext", "useEditorConfigContext", "editorContainerRef", "useRef", "initialConfig", "useMemo", "Error", "JSON", "stringify", "Array", "isArray", "editable", "editorState", "undefined", "namespace", "lexical", "nodes", "getEnabledNodes", "onError", "error", "theme", "LexicalComposer", "EditorConfigProvider", "features", "LexicalEditorComponent", "baseClass", "RichTextComponent", "props", "editorConfig", "field", "name", "admin", "className", "description", "readOnly", "readOnlyFromAdmin", "label", "localized", "required", "path", "pathFromProps", "readOnlyFromTopLevelProps", "validate", "readOnlyFromProps", "editDepth", "useEditDepth", "memoizedValidate", "useCallback", "value", "validationOptions", "customComponents", "AfterInput", "BeforeInput", "Description", "Error", "Label", "formInitializing", "formProcessing", "initialValue", "setValue", "showError", "useField", "disabled", "classes", "hideGutter", "filter", "Boolean", "join", "pathWithEditDepth", "handleChange", "editorState", "toJSON", "styles", "useMemo", "mergeFieldStyles", "_jsxs", "style", "_jsx", "RenderCustomComponent", "CustomComponent", "Fallback", "FieldError", "FieldLabel", "ErrorBoundary", "fallbackRender", "onReset", "LexicalProvider", "composerKey", "fieldProps", "onChange", "JSON", "stringify", "FieldDescription", "error", "role", "color", "message", "RichText"]
7
+ }
@@ -36,7 +36,7 @@ ${e.map(Fa).join(`
36
36
  `),n=!1,r=[];for(let i=0;i<o.length;i++){let l=o[i],s=r[r.length-1];if(Np.test(l)){r.push(l);continue}if((El.test(l)&&!n||wl.test(l)&&n)&&(n=!n),El.test(l)||wl.test(l)){r.push(l);continue}if(n){r.push(l);continue}_l.test(l)||_l.test(s)||!s||Tl.test(s)||Tl.test(l)||kp.test(l)||Tp.test(l)||Ep.test(l)||wp.test(l)||Lp.test(l)||Rp.test(l)||!e||kl.test(l)||Nl.test(l)||kl.test(s)||Nl.test(s)?r.push(l):r[r.length-1]=s+" "+l.trim()}return r.join(`
37
37
  `)}function Ll(t,e=pr,o,n=!1,r=!0){let i=n?t:Ip(t,r);return fr(i,e,o)}var Sl=/^\|(.+)\|\s?$/,$p=/^(\| ?:?-*:? ?)+\|\s?$/,yl=({allTransformers:t})=>({type:"element",dependencies:[Dp,Ap,Mp],export:e=>{if(!Zo(e))return null;let o=[];for(let n of e.getChildren()){let r=[];if(!Xo(n))continue;let i=!1;for(let l of n.getChildren())Rl(l)&&(r.push(hr(t,l).replace(/\n/g,"\\n")),l.__headerState===Vt.ROW&&(i=!0));o.push(`| ${r.join(" | ")} |`),i&&o.push(`| ${r.map(l=>"---").join(" | ")} |`)}return o.join(`
38
38
  `)},regExp:Sl,replace:(e,o,n)=>{if($p.test(n[0])){let c=e.getPreviousSibling();if(!c||!Zo(c))return;let d=c.getChildren(),m=d[d.length-1];if(!m||!Xo(m))return;m.getChildren().forEach(p=>{Rl(p)&&p.setHeaderStyles(Vt.ROW,Vt.ROW)}),e.remove();return}let r=Il(n[0],t);if(r==null)return;let i=[r],l=e.getPreviousSibling(),s=r.length;for(;l&&!(!Fp(l)||l.getChildrenSize()!==1);){let c=l.getFirstChild();if(!Op(c))break;let d=Il(c.getTextContent(),t);if(d==null)break;s=Math.max(s,d.length),i.unshift(d);let m=l.getPreviousSibling();l.remove(),l=m}let a=yp();for(let c of i){let d=vp();a.append(d);for(let m=0;m<s;m++)d.append(m<c.length?c[m]:vl("",t))}let u=e.getPreviousSibling();Zo(u)&&Pp(u)===s?(u.append(...a.getChildren()),e.remove()):e.replace(a),a.selectEnd()}});function Pp(t){let e=t.getFirstChild();return Xo(e)?e.getChildrenSize():0}var vl=(t,e)=>{t=t.replace(/\\n/g,`
39
- `);let o=Sp(Vt.NO_STATUS);return Ll(t,e,o),o},Il=(t,e)=>{let o=t.match(Sl);return!o||!o[1]?null:o[1].split("|").map(n=>vl(n,e))};import{c as Hp}from"react/compiler-runtime";import{jsx as P,jsxs as xe}from"react/jsx-runtime";import{useLexicalComposerContext as Fl}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as jp}from"@lexical/react/useLexicalEditable";import{$deleteTableColumn__EXPERIMENTAL as Gp,$deleteTableRow__EXPERIMENTAL as Up,$getNodeTriplet as Wp,$getTableCellNodeFromLexicalNode as Vp,$getTableColumnIndexFromTableCellNode as Kp,$getTableNodeFromLexicalNodeOrThrow as ut,$getTableRowIndexFromTableCellNode as zp,$insertTableColumn__EXPERIMENTAL as Zp,$insertTableRow__EXPERIMENTAL as Xp,$isTableCellNode as Kt,$isTableRowNode as Dl,$isTableSelection as Zt,$unmergeCell as Yp,getTableObserverFromTableElement as Jp,TableCellHeaderStates as Ee,TableCellNode as qp}from"@lexical/table";import{useScrollInfo as Qp}from"@payloadcms/ui";import{$createParagraphNode as ef,$getRoot as tf,$getSelection as Xt,$isElementNode as of,$isParagraphNode as Ol,$isRangeSelection as qo,$isTextNode as rf}from"lexical";import*as Qo from"react";import{useCallback as ae,useEffect as ye,useRef as zt,useState as Pe}from"react";import{createPortal as $l}from"react-dom";import{jsx as Yo,jsxs as Bp}from"react/jsx-runtime";import"react";var Ml=()=>Bp("svg",{fill:"none",height:"18",viewBox:"0 0 20 20",width:"18",xmlns:"http://www.w3.org/2000/svg",children:[Yo("path",{d:"M5 11C5.55228 11 6 10.5523 6 10C6 9.44772 5.55228 9 5 9C4.44772 9 4 9.44772 4 10C4 10.5523 4.44772 11 5 11Z",fill:"currentColor"}),Yo("path",{d:"M10 11C10.5523 11 11 10.5523 11 10C11 9.44772 10.5523 9 10 9C9.44772 9 9 9.44772 9 10C9 10.5523 9.44772 11 10 11Z",fill:"currentColor"}),Yo("path",{d:"M15 11C15.5523 11 16 10.5523 16 10C16 9.44772 15.5523 9 15 9C14.4477 9 14 9.44772 14 10C14 10.5523 14.4477 11 15 11Z",fill:"currentColor"})]});function Jo(t){let e=t.getShape();return{columns:e.toX-e.fromX+1,rows:e.toY-e.fromY+1}}function nf(){let t=Xt();if(qo(t)&&!t.isCollapsed()||Zt(t)&&!t.anchor.is(t.focus)||!qo(t)&&!Zt(t))return!1;let[e]=Wp(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function Al(t){if(t.getChildrenSize()!==1)return!1;let e=t.getFirstChildOrThrow();return!(!Ol(e)||!e.isEmpty())}function lf(t){let e=t.getLastDescendant();rf(e)?e.select():of(e)?e.selectEnd():e!==null&&e.selectNext()}function sf({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:n,tableCellNode:r}){let[i]=Fl(),l=zt(null),[s,a]=Pe(r),[u,c]=Pe({columns:1,rows:1}),[d,m]=Pe(!1),[p,f]=Pe(!1),{y:h}=Qp();ye(()=>i.registerMutationListener(qp,b=>{b.get(s.getKey())==="updated"&&i.getEditorState().read(()=>{a(s.getLatest())})},{skipInitialization:!0}),[i,s]),ye(()=>{i.getEditorState().read(()=>{let b=Xt();if(Zt(b)){let T=Jo(b);c(Jo(b)),m(T.columns>1||T.rows>1)}f(nf())})},[i]),ye(()=>{let b=e.current,T=l.current,S=i.getRootElement();if(b!=null&&T!=null&&S!=null){let L=S.getBoundingClientRect(),A=b.getBoundingClientRect();T.style.opacity="1";let M=T.getBoundingClientRect(),O=5,G=A.right+O;if(G+M.width>window.innerWidth||G+M.width>L.right){let W=A.left-M.width-O;G=(W<0?O:W)+window.pageXOffset}T.style.left=`${G+window.pageXOffset}px`;let $=A.top;if($+M.height>window.innerHeight){let W=A.bottom-M.height;$=(W<0?O:W)+window.pageYOffset}T.style.top=`${$}px`}},[e,l,i,h]),ye(()=>{function b(T){l.current!=null&&e.current!=null&&!l.current.contains(T.target)&&!e.current.contains(T.target)&&n(!1)}return window.addEventListener("click",b),()=>window.removeEventListener("click",b)},[n,e]);let C=ae(()=>{i.update(()=>{if(s.isAttached()){let T=ut(s),S=i.getElementByKey(T.getKey());if(!S)throw new Error("Expected to find tableElement in DOM");let L=Jp(S);L!==null&&L.clearHighlight(),T.markDirty(),a(s.getLatest())}tf().selectStart()})},[i,s]),w=()=>{i.update(()=>{let b=Xt();if(Zt(b)){let{columns:T,rows:S}=Jo(b),L=b.getNodes(),A=null;for(let M=0;M<L.length;M++){let O=L[M];if(Kt(O))if(A===null){O.setColSpan(T).setRowSpan(S),A=O;let G=Al(O),$;G&&Ol($=O.getFirstChild())&&$.remove()}else Kt(A)&&(Al(O)||A.append(...O.getChildren()),O.remove())}A!==null&&(A.getChildrenSize()===0&&A.append(ef()),lf(A)),o()}})},v=()=>{i.update(()=>{Yp()})},D=ae(b=>{i.update(()=>{Xp(b),o()})},[i,o]),x=ae(b=>{i.update(()=>{for(let T=0;T<u.columns;T++)Zp(b);o()})},[i,o,u.columns]),E=ae(()=>{i.update(()=>{Up(),o()})},[i,o]),g=ae(()=>{i.update(()=>{ut(s).remove(),C(),o()})},[i,s,C,o]),_=ae(()=>{i.update(()=>{Gp(),o()})},[i,o]),N=ae(()=>{i.update(()=>{let b=ut(s),T=zp(s),S=b.getChildren();if(T>=S.length||T<0)throw new Error("Expected table cell to be inside of table row.");let L=S[T];if(!Dl(L))throw new Error("Expected table row");let A=s.getHeaderStyles()^Ee.ROW;L.getChildren().forEach(M=>{if(!Kt(M))throw new Error("Expected table cell");M.setHeaderStyles(A,Ee.ROW)}),C(),o()})},[i,s,C,o]),k=ae(()=>{i.update(()=>{let b=ut(s),T=Kp(s),S=b.getChildren(),L=Math.max(...S.map(M=>M.getChildren().length));if(T>=L||T<0)throw new Error("Expected table cell to be inside of table row.");let A=s.getHeaderStyles()^Ee.COLUMN;for(let M=0;M<S.length;M++){let O=S[M];if(!Dl(O))throw new Error("Expected table row");let G=O.getChildren();if(T>=G.length)continue;let $=G[T];if(!Kt($))throw new Error("Expected table cell");$.setHeaderStyles(A,Ee.COLUMN)}C(),o()})},[i,s,C,o]),R=ae(()=>{i.update(()=>{if(s.isAttached()){let b=ut(s);b&&b.setRowStriping(!b.getRowStriping())}C(),o()})},[i,s,C,o]),I=null;return t&&(d?I=P("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>w(),type:"button",children:"Merge cells"}):p&&(I=P("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>v(),type:"button",children:"Unmerge cells"}))),$l(xe("div",{className:"table-action-menu-dropdown",onClick:b=>{b.stopPropagation()},ref:l,children:[I?xe(Qo.Fragment,{children:[I,P("hr",{})]}):null,P("button",{className:"item","data-test-id":"table-row-striping",onClick:()=>R(),type:"button",children:P("span",{className:"text",children:"Toggle Row Striping"})}),P("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>D(!1),type:"button",children:xe("span",{className:"text",children:["Insert ",u.rows===1?"row":`${u.rows} rows`," above"]})}),P("button",{className:"item","data-test-id":"table-insert-row-below",onClick:()=>D(!0),type:"button",children:xe("span",{className:"text",children:["Insert ",u.rows===1?"row":`${u.rows} rows`," below"]})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-insert-column-before",onClick:()=>x(!1),type:"button",children:xe("span",{className:"text",children:["Insert ",u.columns===1?"column":`${u.columns} columns`," ","left"]})}),P("button",{className:"item","data-test-id":"table-insert-column-after",onClick:()=>x(!0),type:"button",children:xe("span",{className:"text",children:["Insert ",u.columns===1?"column":`${u.columns} columns`," ","right"]})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-delete-columns",onClick:()=>_(),type:"button",children:P("span",{className:"text",children:"Delete column"})}),P("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>E(),type:"button",children:P("span",{className:"text",children:"Delete row"})}),P("button",{className:"item","data-test-id":"table-delete",onClick:()=>g(),type:"button",children:P("span",{className:"text",children:"Delete table"})}),P("hr",{}),P("button",{className:"item",onClick:()=>N(),type:"button",children:xe("span",{className:"text",children:[(s.__headerState&Ee.ROW)===Ee.ROW?"Remove":"Add"," ","row header"]})}),P("button",{className:"item","data-test-id":"table-column-header",onClick:()=>k(),type:"button",children:xe("span",{className:"text",children:[(s.__headerState&Ee.COLUMN)===Ee.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function af({anchorElem:t,cellMerge:e}){let[o]=Fl(),n=zt(null),r=zt(null),[i,l]=Pe(!1),[s,a]=Pe(null),u=ae(()=>{let d=n.current,m=Xt(),p=window.getSelection(),f=document.activeElement;if(m==null||d==null){a(null);return}let h=o.getRootElement();if(qo(m)&&h!==null&&p!==null&&h.contains(p.anchorNode)){let C=Vp(m.anchor.getNode());if(C==null){a(null);return}if(o.getElementByKey(C.getKey())==null){a(null);return}a(C)}else f||a(null)},[o]);ye(()=>o.registerUpdateListener(()=>{o.getEditorState().read(()=>{u()})})),ye(()=>{let d=n.current;if(d!=null&&s!=null){let m=o.getElementByKey(s.getKey());if(m!=null){let p=m.getBoundingClientRect(),f=d.getBoundingClientRect(),h=t.getBoundingClientRect(),C=p.top-h.top+4,w=p.right-f.width-10-h.left;d.style.opacity="1",d.style.transform=`translate(${w}px, ${C}px)`}else d.style.opacity="0",d.style.transform="translate(-10000px, -10000px)"}},[n,s,o,t]);let c=zt(s);return ye(()=>{c.current!==s&&l(!1),c.current=s},[c,s]),P("div",{className:"table-cell-action-button-container",ref:n,children:s!=null&&xe(Qo.Fragment,{children:[P("button",{className:"table-cell-action-button",onClick:d=>{d.stopPropagation(),l(!i)},ref:r,type:"button",children:P(Ml,{})}),i&&P(sf,{cellMerge:e,contextRef:r,onClose:()=>l(!1),setIsMenuOpen:l,tableCellNode:s})]})})}var Pl=t=>{let e=Hp(3),{anchorElem:o}=t,n=jp(),r;return e[0]!==o||e[1]!==n?(r=$l(n?P(af,{anchorElem:o??document.body,cellMerge:!0}):null,o??document.body),e[0]=o,e[1]=n,e[2]=r):r=e[2],r};import{c as cf}from"react/compiler-runtime";import{jsx as Jt,jsxs as uf}from"react/jsx-runtime";import{useLexicalComposerContext as df}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as mf}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as pf,$getTableNodeFromLexicalNodeOrThrow as er,$getTableRowIndexFromTableCellNode as ff,$isTableCellNode as Bl,$isTableRowNode as hf,getDOMCellFromTarget as gf,TableNode as Cf}from"@lexical/table";import{calculateZoomLevel as Hl}from"@lexical/utils";import{$getNearestNodeFromDOMNode as tr}from"lexical";import*as Gl from"react";import{useCallback as dt,useEffect as or,useRef as Yt,useState as mt}from"react";import{createPortal as xf}from"react-dom";var bf=33,jl=92;function _f({editor:t}){let e=Yt(null),o=Yt(null),n=Yt(null),r=B(),i=Yt(null),[l,s]=mt(null),[a,u]=mt(null),[c,d]=mt(!1),[m,p]=mt(null),f=dt(()=>{u(null),e.current=null,p(null),i.current=null,n.current=null},[]),h=k=>(k.buttons&1)===1;or(()=>t.registerNodeTransform(Cf,k=>{if(k.getColWidths())return k;let R=k.getColumnCount(),I=jl;return k.setColWidths(Array(R).fill(I)),k}),[t]),or(()=>{let k=T=>{setTimeout(()=>{let S=T.target;if(m){s({x:T.clientX,y:T.clientY});return}if(d(h(T)),!(o.current&&o.current.contains(S))&&e.current!==S){e.current=S;let L=gf(S);L&&a!==L?t.update(()=>{let A=tr(L.elem);if(!A)throw new Error("TableCellResizer: Table cell node not found.");let M=er(A),O=t.getElementByKey(M.getKey());if(!O)throw new Error("TableCellResizer: Table element not found.");e.current=S,n.current=O.getBoundingClientRect(),u(L)}):L==null&&f()}},0)},R=T=>{setTimeout(()=>{d(!0)},0)},I=T=>{setTimeout(()=>{d(!1)},0)},b=t.registerRootListener((T,S)=>{S?.removeEventListener("mousemove",k),S?.removeEventListener("mousedown",R),S?.removeEventListener("mouseup",I),T?.addEventListener("mousemove",k),T?.addEventListener("mousedown",R),T?.addEventListener("mouseup",I)});return()=>{b()}},[a,m,t,f]);let C=k=>k==="bottom",w=dt(k=>{if(!a)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let R=tr(a.elem);if(!Bl(R))throw new Error("TableCellResizer: Table cell node not found.");let I=er(R),b=ff(R)+R.getRowSpan()-1,T=I.getChildren();if(b>=T.length||b<0)throw new Error("Expected table cell to be inside of table row.");let S=T[b];if(!hf(S))throw new Error("Expected table row");let L=S.getHeight();if(L===void 0){let M=S.getChildren();L=Math.min(...M.map(O=>v(O,t)??1/0))}let A=Math.max(L+k,bf);S.setHeight(A)},{tag:"skip-scroll-into-view"})},[a,t]),v=(k,R)=>R.getElementByKey(k.getKey())?.clientHeight,D=(k,R)=>{for(let I=0;I<R.length;I++)for(let b=0;b<R[I].length;b++)if(R[I][b].cell===k)return b},x=dt(k=>{if(!a)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let R=tr(a.elem);if(!Bl(R))throw new Error("TableCellResizer: Table cell node not found.");let I=er(R),[b]=pf(I,null,null),T=D(R,b);if(T===void 0)throw new Error("TableCellResizer: Table column not found.");let S=I.getColWidths();if(!S)return;let L=S[T];if(L===void 0)return;let A=[...S],M=Math.max(L+k,jl);A[T]=M,I.setColWidths(A)},{tag:"skip-scroll-into-view"})},[a,t]),E=dt(k=>{let R=I=>{if(I.preventDefault(),I.stopPropagation(),!a)throw new Error("TableCellResizer: Expected active cell.");if(i.current){let{x:b,y:T}=i.current;if(a===null)return;let S=Hl(I.target);if(C(k)){let L=(I.clientY-T)/S;w(L)}else{let L=(I.clientX-b)/S;x(L)}f(),document.removeEventListener("mouseup",R)}};return R},[a,f,x,w]),g=dt(k=>R=>{if(R.preventDefault(),R.stopPropagation(),!a)throw new Error("TableCellResizer: Expected active cell.");i.current={x:R.clientX,y:R.clientY},s(i.current),p(k),document.addEventListener("mouseup",E(k))},[a,E]),[_,N]=mt({bottom:null,left:null,right:null,top:null});return or(()=>{if(a){let{height:k,left:R,top:I,width:b}=a.elem.getBoundingClientRect(),T=Hl(a.elem),S=10,L={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${S}px`,left:`${window.scrollX+R}px`,top:`${window.scrollY+I+k-S/2}px`,width:`${b}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${k}px`,left:`${window.scrollX+R+b-S/2}px`,top:`${window.scrollY+I}px`,width:`${S}px`}},A=n.current;m&&l&&A&&(C(m)?(L[m].left=`${window.scrollX+A.left}px`,L[m].top=`${window.scrollY+l.y/T}px`,L[m].height="3px",L[m].width=`${A.width}px`):(L[m].top=`${window.scrollY+A.top}px`,L[m].left=`${window.scrollX+l.x/T}px`,L[m].width="3px",L[m].height=`${A.height}px`),L[m].backgroundColor="#adf"),N(L)}else N({bottom:null,left:null,right:null,top:null})},[a,m,l]),Jt("div",{ref:o,children:a!=null&&!c&&uf(Gl.Fragment,{children:[Jt("div",{className:`${r.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:g("right"),style:_.right||void 0}),Jt("div",{className:`${r.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:g("bottom"),style:_.bottom||void 0})]})})}var Ul=()=>{let t=cf(3),[e]=df(),o=mf(),n,r;return t[0]!==e||t[1]!==o?(r=o?xf(Jt(_f,{editor:e}),document.body):null,t[0]=e,t[1]=o,t[2]=r):r=t[2],n=r,n};import{c as If}from"react/compiler-runtime";import{jsx as rr,jsxs as Sf,Fragment as yf}from"react/jsx-runtime";import{useLexicalComposerContext as Jl}from"@lexical/react/LexicalComposerContext";import{$getTableColumnIndexFromTableCellNode as vf,$getTableRowIndexFromTableCellNode as Mf,$insertTableColumn__EXPERIMENTAL as Df,$insertTableRow__EXPERIMENTAL as Af,$isTableCellNode as Ff,$isTableNode as Kl,TableNode as Of}from"@lexical/table";import{$findMatchingParent as $f,mergeRegister as Pf}from"@lexical/utils";import{$getNearestNodeFromDOMNode as zl}from"lexical";import{useEffect as Zl,useMemo as Bf,useRef as Xl,useState as qt}from"react";import"react";import{createPortal as Hf}from"react-dom";import{c as Nf}from"react/compiler-runtime";import{useEffect as Lf,useRef as Rf}from"react";var Tf="Expected a function",Ef=Math.max,wf=Math.min;function kf(t,e,o){let n,r,i=0,l,s=!1,a=!1,u,c,d,m=!0;if(typeof t!="function")throw new TypeError(Tf);e=e||0,typeof o=="object"&&(s=!!o.leading,a="maxWait"in o,u=a?Ef(o.maxWait||0,e):u,m="trailing"in o?!!o.trailing:m);function p(g){let _=n,N=l;return n=l=void 0,i=g,c=t.apply(N,_),c}function f(g){return i=g,d=setTimeout(w,e),s?p(g):c}function h(g){let _=g-r,N=g-i,k=e-_;return a?wf(k,u-N):k}function C(g){let _=g-r,N=g-i;return r===void 0||_>=e||_<0||a&&N>=u}function w(){let g=Date.now();if(C(g))return v(g);d=setTimeout(w,h(g))}function v(g){return d=void 0,m&&n?p(g):(n=l=void 0,c)}function D(){d!==void 0&&clearTimeout(d),i=0,n=r=l=d=void 0}function x(){return d===void 0?c:v(Date.now())}function E(){let g=Date.now(),_=C(g);if(n=arguments,l=this,r=g,_){if(d===void 0)return f(r);if(a)return clearTimeout(d),d=setTimeout(w,e),p(r)}return d===void 0&&(d=setTimeout(w,e)),c}return E.cancel=D,E.flush=x,E}var Wl=kf;function Vl(t,e,o){let n=Nf(6),r=Rf(null),i,l;n[0]!==t||n[1]!==o||n[2]!==e?(i=()=>(r.current=Wl(t,e,{maxWait:o}),()=>{r.current?.cancel()}),l=[t,e,o],n[0]=t,n[1]=o,n[2]=e,n[3]=i,n[4]=l):(i=n[3],l=n[4]),Lf(i,l);let s;return n[5]===Symbol.for("react.memo_cache_sentinel")?(s=(...u)=>{let c=u;r.current&&r.current(...c)},n[5]=s):s=n[5],s}var Yl=20;function jf({anchorElem:t}){let[e]=Jl(),o=B(),[n,r]=qt(!1),[i,l]=qt(!1),[s,a]=qt(!1),[u,c]=qt({}),d=Xl(new Set),m=Xl(null),p=Vl(C=>{let{isOutside:w,tableDOMNode:v}=Gf(C,o.editorConfig?.lexical);if(w){r(!1),l(!1);return}if(!v)return;m.current=v;let D=null,x=null,E=null;if(e.update(()=>{let g=zl(v);if(Ff(g)){let _=$f(g,N=>Kl(N));if(!Kl(_))return;if(E=e.getElementByKey(_?.getKey()),E){let N=_.getChildrenSize(),k=_.getChildAtIndex(0)?.getChildrenSize(),R=Mf(g),I=vf(g);R===N-1?D=g:I===k-1&&(x=g)}}}),E){let{bottom:g,height:_,left:N,right:k,width:R,y:I}=E.getBoundingClientRect(),{left:b,y:T}=t.getBoundingClientRect();D?(l(!1),r(!0),c({height:Yl,left:N-b,top:g-T+5,width:R})):x&&(l(!0),r(!1),c({height:_,left:k-b+5,top:I-T,width:Yl}))}},50,250),f=Bf(()=>new ResizeObserver(()=>{r(!1),l(!1)}),[]);Zl(()=>{if(s)return document.addEventListener("mousemove",p),()=>{r(!1),l(!1),document.removeEventListener("mousemove",p)}},[s,p]),Zl(()=>Pf(e.registerMutationListener(Of,C=>{e.getEditorState().read(()=>{for(let[w,v]of C){let D=e.getElementByKey(w);switch(v){case"created":d.current.add(w),a(d.current.size>0),D&&f.observe(D);break;case"destroyed":d.current.delete(w),a(d.current.size>0),f.disconnect(),d.current.forEach(x=>{let E=e.getElementByKey(x);E&&f.observe(E)});break;default:break}}})},{skipInitialization:!1})),[e,f]);let h=C=>{e.update(()=>{m.current&&(zl(m.current)?.selectEnd(),C?(Af(),r(!1)):(Df(),l(!1)))})};return e?.isEditable()?Sf(yf,{children:[n&&rr("button",{className:o.editorConfig.lexical.theme.tableAddRows,onClick:()=>h(!0),style:{...u},type:"button"}),i&&rr("button",{className:o.editorConfig.lexical.theme.tableAddColumns,onClick:()=>h(!1),style:{...u},type:"button"})]}):null}function Gf(t,e){let o=t.target;if(o&&o instanceof HTMLElement){let n=o.closest(`td.${e.theme.tableCell}, th.${e.theme.tableCell}`);return{isOutside:!(n||o.closest(`button.${e.theme.tableAddRows}`)||o.closest(`button.${e.theme.tableAddColumns}`)||o.closest(`div.${e.theme.tableCellResizer}`)),tableDOMNode:n}}else return{isOutside:!0,tableDOMNode:null}}function ql(t){let e=If(2),{anchorElem:o}=t,n=o===void 0?document.body:o,[r]=Jl();if(!r?.isEditable())return null;let i;return e[0]!==n?(i=Hf(rr(jf,{anchorElem:n}),n),e[0]=n,e[1]=i):i=e[1],i}import{c as Uf}from"react/compiler-runtime";import{jsx as nr,jsxs as Wf}from"react/jsx-runtime";import{useLexicalComposerContext as Vf}from"@lexical/react/LexicalComposerContext";import{TablePlugin as Kf}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as zf,TableNode as Zf}from"@lexical/table";import{mergeRegister as Xf}from"@lexical/utils";import{formatDrawerSlug as Yf,useEditDepth as Jf}from"@payloadcms/ui";import{$getSelection as qf,$isRangeSelection as Qf,COMMAND_PRIORITY_EDITOR as e1,createCommand as t1}from"lexical";import{createContext as o1,useContext as r1,useEffect as n1,useMemo as i1,useState as l1}from"react";import*as Ql from"react";var Qt=t1("OPEN_EMBED_DRAWER_COMMAND"),es=o1({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function ts({children:t}){let[e,o]=l1({cellEditorConfig:null,cellEditorPlugins:null});return nr(es.Provider,{value:i1(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(n,r)=>{o({cellEditorConfig:n,cellEditorPlugins:r})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var os=()=>{let t=Uf(16),[e]=Vf(),o=r1(es),n=Jf(),{fieldProps:r,uuid:i}=B(),{schemaPath:l}=r,s="lexical-table-create-"+i,a;t[0]!==n||t[1]!==s?(a=Yf({slug:s,depth:n}),t[0]=n,t[1]=s,t[2]=a):a=t[2];let u=a,{toggleDrawer:c}=ce(u,!0),d;t[3]!==e||t[4]!==c?(d=()=>{if(!e.hasNodes([Zf]))throw new Error("TablePlugin: TableNode is not registered on editor");return Xf(e.registerCommand(Qt,()=>{let h;return h=null,e.getEditorState().read(()=>{let C=qf();Qf(C)&&(h=C)}),h&&c(),!0},e1))},t[3]=e,t[4]=c,t[5]=d):d=t[5];let m;t[6]!==o||t[7]!==e||t[8]!==c?(m=[o,e,c],t[6]=o,t[7]=e,t[8]=c,t[9]=m):m=t[9],n1(d,m);let p;t[10]!==e?(p=(h,C)=>{!C.columns||!C.rows||e.dispatchCommand(zf,{columns:String(C.columns),rows:String(C.rows)})},t[10]=e,t[11]=p):p=t[11];let f;return t[12]!==u||t[13]!==l||t[14]!==p?(f=Wf(Ql.Fragment,{children:[nr(He,{drawerSlug:u,drawerTitle:"Create Table",featureKey:"experimental_table",handleDrawerSubmit:p,schemaPath:l,schemaPathSuffix:"fields"}),nr(Kf,{hasCellBackgroundColor:!1,hasCellMerge:!0})]}),t[12]=u,t[13]=l,t[14]=p,t[15]=f):f=t[15],f};var u1=y({markdownTransformers:[yl],nodes:[a1,s1,c1],plugins:[{Component:os,position:"normal"},{Component:Ul,position:"normal"},{Component:Pl,position:"floatingAnchorElem"},{Component:ql,position:"floatingAnchorElem"}],providers:[ts],slashMenu:{groups:[Z([{Icon:zo,key:"table",keywords:["table"],label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(Qt,{})}}])]},toolbarFixed:{groups:[me([{ChildComponent:zo,key:"table",label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(Qt,{})}}])]}});import{$isNodeSelection as A1}from"lexical";import{jsx as ir,jsxs as d1}from"react/jsx-runtime";import"react";var lr=()=>d1("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:[ir("path",{d:"M14.6667 4H5.33333C4.59695 4 4 4.59695 4 5.33333V14.6667C4 15.403 4.59695 16 5.33333 16H14.6667C15.403 16 16 15.403 16 14.6667V5.33333C16 4.59695 15.403 4 14.6667 4Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),ir("path",{d:"M7.99984 9.33366C8.73622 9.33366 9.33317 8.73671 9.33317 8.00033C9.33317 7.26395 8.73622 6.66699 7.99984 6.66699C7.26346 6.66699 6.6665 7.26395 6.6665 8.00033C6.6665 8.73671 7.26346 9.33366 7.99984 9.33366Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),ir("path",{d:"M16 11.9995L13.9427 9.94214C13.6926 9.69218 13.3536 9.55176 13 9.55176C12.6464 9.55176 12.3074 9.69218 12.0573 9.94214L6 15.9995",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})]});import{c as _1}from"react/compiler-runtime";import{jsx as T1}from"react/jsx-runtime";import{useLexicalComposerContext as E1}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as w1,mergeRegister as k1}from"@lexical/utils";import{useConfig as N1}from"@payloadcms/ui";import{$getPreviousSelection as L1,$getSelection as R1,$isParagraphNode as ns,$isRangeSelection as I1,COMMAND_PRIORITY_EDITOR as S1,createCommand as y1}from"lexical";import{useEffect as v1}from"react";import{c as m1}from"react/compiler-runtime";import{jsx as sr}from"react/jsx-runtime";import{useLexicalComposerContext as p1}from"@lexical/react/LexicalComposerContext.js";import{$getNodeByKey as f1,COMMAND_PRIORITY_EDITOR as h1}from"lexical";import{useEffect as g1,useState as C1}from"react";var x1=({editor:t,relationTo:e,replaceNodeKey:o,value:n})=>{o?t.update(()=>{let r=f1(o);r&&r.replace(Ke({data:{fields:null,relationTo:e,value:n}}))}):t.dispatchCommand(ar,{fields:null,relationTo:e,value:n})},b1=t=>{let e=m1(13),{enabledCollectionSlugs:o}=t,[n]=p1(),[r,i]=C1(null),l;e[0]!==o?(l={collectionSlugs:o,uploads:!0},e[0]=o,e[1]=l):l=e[1];let{closeListDrawer:s,ListDrawer:a,openListDrawer:u}=lt(l),c,d;e[2]!==n||e[3]!==u?(c=()=>n.registerCommand(We,h=>(i(h?.replace?h?.replace.nodeKey:null),u(),!0),h1),d=[n,u],e[2]=n,e[3]=u,e[4]=c,e[5]=d):(c=e[4],d=e[5]),g1(c,d);let m;e[6]!==s||e[7]!==n||e[8]!==r?(m=h=>{let{collectionSlug:C,docID:w}=h;s(),x1({editor:n,relationTo:C,replaceNodeKey:r,value:w})},e[6]=s,e[7]=n,e[8]=r,e[9]=m):m=e[9];let p=m,f;return e[10]!==a||e[11]!==p?(f=sr(a,{onSelect:p}),e[10]=a,e[11]=p,e[12]=f):f=e[12],f},rs=t=>sr(bt,{...t,uploads:!0,children:sr(b1,{...t})});var ar=y1("INSERT_UPLOAD_COMMAND"),is=t=>{let e=_1(5),[o]=E1(),{config:n}=N1(),{collections:r}=n,i,l;e[0]!==o?(i=()=>{if(!o.hasNodes([Ve]))throw new Error("UploadPlugin: UploadNode not registered on editor");return k1(o.registerCommand(ar,a=>(o.update(()=>{let u=R1()||L1();if(I1(u)){let c=Ke({data:{id:a.id,fields:a.fields,relationTo:a.relationTo,value:a.value}});w1(c);let{focus:d}=u,m=d.getNode();ns(m)&&m.getTextContentSize()===0&&m.getParentOrThrow().getChildren().filter(M1).length>1&&m.remove()}}),!0),S1))},l=[o],e[0]=o,e[1]=i,e[2]=l):(i=e[1],l=e[2]),v1(i,l);let s;return e[3]!==r?(s=T1(rs,{enabledCollectionSlugs:r.map(D1)}),e[3]=r,e[4]=s):s=e[4],s};function M1(t){return ns(t)}function D1(t){let{slug:e}=t;return e}var F1=y({nodes:[Ve],plugins:[{Component:is,position:"normal"}],slashMenu:{groups:[Z([{Icon:lr,key:"upload",keywords:["upload","image","file","img","picture","photo","media"],label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(We,{replace:!1})}}])]},toolbarFixed:{groups:[me([{ChildComponent:lr,isActive:({selection:t})=>{if(!A1(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return so(e)},key:"upload",label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(We,{replace:!1})}}])]}});import{c as O1}from"react/compiler-runtime";import{jsx as ur}from"react/jsx-runtime";import{ShimmerEffect as $1}from"@payloadcms/ui";import{lazy as P1,Suspense as B1,useEffect as H1,useState as j1}from"react";var ls={block:"LexicalEditorTheme__block",blockCursor:"LexicalEditorTheme__blockCursor",characterLimit:"LexicalEditorTheme__characterLimit",code:"LexicalEditorTheme__code",codeHighlight:{atrule:"LexicalEditorTheme__tokenAttr",attr:"LexicalEditorTheme__tokenAttr",boolean:"LexicalEditorTheme__tokenProperty",builtin:"LexicalEditorTheme__tokenSelector",cdata:"LexicalEditorTheme__tokenComment",char:"LexicalEditorTheme__tokenSelector",class:"LexicalEditorTheme__tokenFunction","class-name":"LexicalEditorTheme__tokenFunction",comment:"LexicalEditorTheme__tokenComment",constant:"LexicalEditorTheme__tokenProperty",deleted:"LexicalEditorTheme__tokenProperty",doctype:"LexicalEditorTheme__tokenComment",entity:"LexicalEditorTheme__tokenOperator",function:"LexicalEditorTheme__tokenFunction",important:"LexicalEditorTheme__tokenVariable",inserted:"LexicalEditorTheme__tokenSelector",keyword:"LexicalEditorTheme__tokenAttr",namespace:"LexicalEditorTheme__tokenVariable",number:"LexicalEditorTheme__tokenProperty",operator:"LexicalEditorTheme__tokenOperator",prolog:"LexicalEditorTheme__tokenComment",property:"LexicalEditorTheme__tokenProperty",punctuation:"LexicalEditorTheme__tokenPunctuation",regex:"LexicalEditorTheme__tokenVariable",selector:"LexicalEditorTheme__tokenSelector",string:"LexicalEditorTheme__tokenSelector",symbol:"LexicalEditorTheme__tokenProperty",tag:"LexicalEditorTheme__tokenProperty",url:"LexicalEditorTheme__tokenOperator",variable:"LexicalEditorTheme__tokenVariable"},embedBlock:{base:"LexicalEditorTheme__embedBlock",focus:"LexicalEditorTheme__embedBlockFocus"},hashtag:"LexicalEditorTheme__hashtag",heading:{h1:"LexicalEditorTheme__h1",h2:"LexicalEditorTheme__h2",h3:"LexicalEditorTheme__h3",h4:"LexicalEditorTheme__h4",h5:"LexicalEditorTheme__h5",h6:"LexicalEditorTheme__h6"},hr:"LexicalEditorTheme__hr",indent:"LexicalEditorTheme__indent",inlineImage:"LexicalEditor__inline-image",link:"LexicalEditorTheme__link",list:{checklist:"LexicalEditorTheme__checklist",listitem:"LexicalEditorTheme__listItem",listitemChecked:"LexicalEditorTheme__listItemChecked",listitemUnchecked:"LexicalEditorTheme__listItemUnchecked",nested:{listitem:"LexicalEditorTheme__nestedListItem"},olDepth:["LexicalEditorTheme__ol1","LexicalEditorTheme__ol2","LexicalEditorTheme__ol3","LexicalEditorTheme__ol4","LexicalEditorTheme__ol5"],ul:"LexicalEditorTheme__ul"},ltr:"LexicalEditorTheme__ltr",mark:"LexicalEditorTheme__mark",markOverlap:"LexicalEditorTheme__markOverlap",paragraph:"LexicalEditorTheme__paragraph",quote:"LexicalEditorTheme__quote",relationship:"LexicalEditorTheme__relationship",rtl:"LexicalEditorTheme__rtl",table:"LexicalEditorTheme__table",tableAddColumns:"LexicalEditorTheme__tableAddColumns",tableAddRows:"LexicalEditorTheme__tableAddRows",tableCell:"LexicalEditorTheme__tableCell",tableCellActionButton:"LexicalEditorTheme__tableCellActionButton",tableCellActionButtonContainer:"LexicalEditorTheme__tableCellActionButtonContainer",tableCellEditing:"LexicalEditorTheme__tableCellEditing",tableCellHeader:"LexicalEditorTheme__tableCellHeader",tableCellPrimarySelected:"LexicalEditorTheme__tableCellPrimarySelected",tableCellResizer:"LexicalEditorTheme__tableCellResizer",tableCellSelected:"LexicalEditorTheme__tableCellSelected",tableCellSortedIndicator:"LexicalEditorTheme__tableCellSortedIndicator",tableResizeRuler:"LexicalEditorTheme__tableCellResizeRuler",tableRowStriping:"LexicalEditorTheme__tableRowStriping",tableSelected:"LexicalEditorTheme__tableSelected",text:{bold:"LexicalEditorTheme__textBold",code:"LexicalEditorTheme__textCode",italic:"LexicalEditorTheme__textItalic",strikethrough:"LexicalEditorTheme__textStrikethrough",subscript:"LexicalEditorTheme__textSubscript",superscript:"LexicalEditorTheme__textSuperscript",underline:"LexicalEditorTheme__textUnderline",underlineStrikethrough:"LexicalEditorTheme__textUnderlineStrikethrough"},upload:"editor-upload"};var eo={namespace:"lexical",theme:ls};function ss({featureClientSchemaMap:t,field:e,schemaPath:o,unSanitizedEditorConfig:n}){for(let s of n.features)if(!s?.clientFeatureProps?.featureKey||s?.clientFeatureProps?.order===void 0||s?.clientFeatureProps?.order===null)throw new Error("A Feature you have installed does not return the client props as clientFeatureProps. Please make sure to always return those props, even if they are null, as other important props like order and featureKey are later on injected.");n.features=n.features.sort((s,a)=>s.clientFeatureProps.order-a.clientFeatureProps.order);let r=new Map;for(let s of n.features)r.set(s.clientFeatureProps.featureKey,s);let i=new Map,l=0;for(let s of n.features){let a=typeof s.feature=="function"?s.feature({featureClientSchemaMap:t,featureProviderMap:r,field:e,resolvedFeatures:i,schemaPath:o,unSanitizedEditorConfig:n}):s.feature;a.key=s.clientFeatureProps.featureKey,a.order=l,i.set(s.clientFeatureProps.featureKey,a),l++}return i}var as=t=>{let e={enabledFeatures:[],enabledFormats:[],markdownTransformers:[],nodes:[],plugins:[],providers:[],slashMenu:{dynamicGroups:[],groups:[]},toolbarFixed:{groups:[]},toolbarInline:{groups:[]}};if(!t?.size)return e;t.forEach(o=>{if(o.providers?.length&&(e.providers=e.providers.concat(o.providers)),o.enableFormats?.length&&e.enabledFormats.push(...o.enableFormats),o.nodes?.length)for(let n of o.nodes)e.nodes.push(n);if(o.plugins?.length&&o.plugins.forEach((n,r)=>{e.plugins?.push({clientProps:o.sanitizedClientFeatureProps,Component:n.Component,key:o.key+r,position:n.position})}),o.toolbarInline?.groups?.length)for(let n of o.toolbarInline.groups){let r=e.toolbarInline.groups.find(i=>i.key===n.key);r?e.toolbarInline.groups=e.toolbarInline.groups.filter(i=>i.key!==n.key):r={...n,items:[]},n?.items?.length&&(r.items=r.items.concat(n.items)),e.toolbarInline?.groups.push(r)}if(o.toolbarFixed?.groups?.length)for(let n of o.toolbarFixed.groups){let r=e.toolbarFixed.groups.find(i=>i.key===n.key);r?e.toolbarFixed.groups=e.toolbarFixed.groups.filter(i=>i.key!==n.key):r={...n,items:[]},n?.items?.length&&(r.items=r.items.concat(n.items)),e.toolbarFixed?.groups.push(r)}if(o.slashMenu?.groups){o.slashMenu.dynamicGroups?.length&&(e.slashMenu.dynamicGroups=e.slashMenu.dynamicGroups.concat(o.slashMenu.dynamicGroups));for(let n of o.slashMenu.groups){let r=e.slashMenu.groups.find(i=>i.key===n.key);r?e.slashMenu.groups=e.slashMenu.groups.filter(i=>i.key!==n.key):r={...n,items:[]},n?.items?.length&&(r.items=r.items.concat(n.items)),e.slashMenu.groups.push(r)}}if(o.markdownTransformers?.length)for(let n of o.markdownTransformers)typeof n=="function"?e.markdownTransformers.push(n({allNodes:e.nodes,allTransformers:e.markdownTransformers})):e.markdownTransformers.push(n);e.enabledFeatures.push(o.key)}),e.toolbarInline.groups.sort((o,n)=>o.order&&n.order?o.order-n.order:o.order?-1:n.order?1:0),e.toolbarFixed.groups.sort((o,n)=>o.order&&n.order?o.order-n.order:o.order?-1:n.order?1:0);for(let o of e.toolbarInline.groups)o.items.sort((n,r)=>n.order&&r.order?n.order-r.order:n.order?-1:r.order?1:0);for(let o of e.toolbarFixed.groups)o.items.sort((n,r)=>n.order&&r.order?n.order-r.order:n.order?-1:r.order?1:0);return e};function cr(t,e,o){return{admin:o,features:as(t),lexical:e,resolvedFeatureMap:t}}var G1=P1(()=>import("./Field-FMNFWV4P.js").then(t=>({default:t.RichText}))),U1=t=>{let e=O1(14),{admin:o,clientFeatures:n,featureClientSchemaMap:r,field:i,lexicalEditorConfig:l,schemaPath:s}=t,a;e[0]!==o?(a=o===void 0?{}:o,e[0]=o,e[1]=a):a=e[1];let u=a,c=l===void 0?eo:l,[d,m]=j1(null),p,f;e[2]!==u||e[3]!==n||e[4]!==r||e[5]!==i||e[6]!==d||e[7]!==c||e[8]!==s?(p=()=>{if(d)return;let C=[];for(let[D,x]of Object.entries(n))x.clientFeatureProvider&&C.push(x.clientFeatureProvider(x.clientFeatureProps));let w=c||eo,v=ss({featureClientSchemaMap:r,field:i,schemaPath:s??i.name,unSanitizedEditorConfig:{features:C,lexical:w}});m(cr(v,w,u))},f=[c,u,d,n,r,i,s],e[2]=u,e[3]=n,e[4]=r,e[5]=i,e[6]=d,e[7]=c,e[8]=s,e[9]=p,e[10]=f):(p=e[9],f=e[10]),H1(p,f);let h;return e[11]!==d||e[12]!==t?(h=ur(B1,{fallback:ur($1,{height:"35vh"}),children:d&&ur(G1,{...t,editorConfig:d})}),e[11]=d,e[12]=t,e[13]=h):h=e[13],h};function W1(...t){return t.filter(Boolean).join(" ")}var to=new WeakMap;function cs(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function oo(t,e){let o=to.get(t);if(o===void 0){let n=new Set,r=l=>{o!==void 0&&(o.start=cs(l))},i=l=>{if(o===void 0)return;let{start:s}=o;if(s===null)return;let a=cs(l);for(let u of n)a!==null&&u([a[0]-s[0],a[1]-s[1]],l)};t.addEventListener("touchstart",r),t.addEventListener("touchend",i),o={handleTouchend:i,handleTouchstart:r,listeners:n,start:null},to.set(t,o)}return o.listeners.add(e),()=>{V1(t,e)}}function V1(t,e){let o=to.get(t);if(o===void 0)return;let{listeners:n}=o;n.delete(e),n.size===0&&(to.delete(t),t.removeEventListener("touchstart",o.handleTouchstart),t.removeEventListener("touchend",o.handleTouchend))}function K1(t,e){return oo(t,(o,n)=>{let[r,i]=o;r<0&&-r>Math.abs(i)&&e(r,n)})}function z1(t,e){return oo(t,(o,n)=>{let[r,i]=o;r>0&&r>Math.abs(i)&&e(r,n)})}function Z1(t,e){return oo(t,(o,n)=>{let[r,i]=o;i<0&&-i>Math.abs(r)&&e(r,n)})}function X1(t,e){return oo(t,(o,n)=>{let[r,i]=o;i>0&&i>Math.abs(r)&&e(r,n)})}var F={DOM_ELEMENT_TYPE:1,DOM_TEXT_TYPE:3,NO_DIRTY_NODES:0,HAS_DIRTY_NODES:1,FULL_RECONCILE:2,IS_NORMAL:0,IS_TOKEN:1,IS_SEGMENTED:2,IS_INERT:3,IS_BOLD:1,IS_ITALIC:2,IS_STRIKETHROUGH:4,IS_UNDERLINE:8,IS_CODE:16,IS_SUBSCRIPT:32,IS_SUPERSCRIPT:64,IS_HIGHLIGHT:128,IS_DIRECTIONLESS:1,IS_UNMERGEABLE:2,IS_ALIGN_LEFT:1,IS_ALIGN_CENTER:2,IS_ALIGN_RIGHT:3,IS_ALIGN_JUSTIFY:4,IS_ALIGN_START:5,IS_ALIGN_END:6},Y1=F.IS_BOLD|F.IS_ITALIC|F.IS_STRIKETHROUGH|F.IS_UNDERLINE|F.IS_CODE|F.IS_SUBSCRIPT|F.IS_SUPERSCRIPT|F.IS_HIGHLIGHT,J1="\xA0",q1=`
39
+ `);let o=Sp(Vt.NO_STATUS);return Ll(t,e,o),o},Il=(t,e)=>{let o=t.match(Sl);return!o||!o[1]?null:o[1].split("|").map(n=>vl(n,e))};import{c as Hp}from"react/compiler-runtime";import{jsx as P,jsxs as xe}from"react/jsx-runtime";import{useLexicalComposerContext as Fl}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as jp}from"@lexical/react/useLexicalEditable";import{$deleteTableColumn__EXPERIMENTAL as Gp,$deleteTableRow__EXPERIMENTAL as Up,$getNodeTriplet as Wp,$getTableCellNodeFromLexicalNode as Vp,$getTableColumnIndexFromTableCellNode as Kp,$getTableNodeFromLexicalNodeOrThrow as ut,$getTableRowIndexFromTableCellNode as zp,$insertTableColumn__EXPERIMENTAL as Zp,$insertTableRow__EXPERIMENTAL as Xp,$isTableCellNode as Kt,$isTableRowNode as Dl,$isTableSelection as Zt,$unmergeCell as Yp,getTableObserverFromTableElement as Jp,TableCellHeaderStates as Ee,TableCellNode as qp}from"@lexical/table";import{useScrollInfo as Qp}from"@payloadcms/ui";import{$createParagraphNode as ef,$getRoot as tf,$getSelection as Xt,$isElementNode as of,$isParagraphNode as Ol,$isRangeSelection as qo,$isTextNode as rf}from"lexical";import*as Qo from"react";import{useCallback as ae,useEffect as ye,useRef as zt,useState as Pe}from"react";import{createPortal as $l}from"react-dom";import{jsx as Yo,jsxs as Bp}from"react/jsx-runtime";import"react";var Ml=()=>Bp("svg",{fill:"none",height:"18",viewBox:"0 0 20 20",width:"18",xmlns:"http://www.w3.org/2000/svg",children:[Yo("path",{d:"M5 11C5.55228 11 6 10.5523 6 10C6 9.44772 5.55228 9 5 9C4.44772 9 4 9.44772 4 10C4 10.5523 4.44772 11 5 11Z",fill:"currentColor"}),Yo("path",{d:"M10 11C10.5523 11 11 10.5523 11 10C11 9.44772 10.5523 9 10 9C9.44772 9 9 9.44772 9 10C9 10.5523 9.44772 11 10 11Z",fill:"currentColor"}),Yo("path",{d:"M15 11C15.5523 11 16 10.5523 16 10C16 9.44772 15.5523 9 15 9C14.4477 9 14 9.44772 14 10C14 10.5523 14.4477 11 15 11Z",fill:"currentColor"})]});function Jo(t){let e=t.getShape();return{columns:e.toX-e.fromX+1,rows:e.toY-e.fromY+1}}function nf(){let t=Xt();if(qo(t)&&!t.isCollapsed()||Zt(t)&&!t.anchor.is(t.focus)||!qo(t)&&!Zt(t))return!1;let[e]=Wp(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function Al(t){if(t.getChildrenSize()!==1)return!1;let e=t.getFirstChildOrThrow();return!(!Ol(e)||!e.isEmpty())}function lf(t){let e=t.getLastDescendant();rf(e)?e.select():of(e)?e.selectEnd():e!==null&&e.selectNext()}function sf({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:n,tableCellNode:r}){let[i]=Fl(),l=zt(null),[s,a]=Pe(r),[u,c]=Pe({columns:1,rows:1}),[d,m]=Pe(!1),[p,f]=Pe(!1),{y:h}=Qp();ye(()=>i.registerMutationListener(qp,b=>{b.get(s.getKey())==="updated"&&i.getEditorState().read(()=>{a(s.getLatest())})},{skipInitialization:!0}),[i,s]),ye(()=>{i.getEditorState().read(()=>{let b=Xt();if(Zt(b)){let T=Jo(b);c(Jo(b)),m(T.columns>1||T.rows>1)}f(nf())})},[i]),ye(()=>{let b=e.current,T=l.current,S=i.getRootElement();if(b!=null&&T!=null&&S!=null){let L=S.getBoundingClientRect(),A=b.getBoundingClientRect();T.style.opacity="1";let M=T.getBoundingClientRect(),O=5,G=A.right+O;if(G+M.width>window.innerWidth||G+M.width>L.right){let W=A.left-M.width-O;G=(W<0?O:W)+window.pageXOffset}T.style.left=`${G+window.pageXOffset}px`;let $=A.top;if($+M.height>window.innerHeight){let W=A.bottom-M.height;$=(W<0?O:W)+window.pageYOffset}T.style.top=`${$}px`}},[e,l,i,h]),ye(()=>{function b(T){l.current!=null&&e.current!=null&&!l.current.contains(T.target)&&!e.current.contains(T.target)&&n(!1)}return window.addEventListener("click",b),()=>window.removeEventListener("click",b)},[n,e]);let C=ae(()=>{i.update(()=>{if(s.isAttached()){let T=ut(s),S=i.getElementByKey(T.getKey());if(!S)throw new Error("Expected to find tableElement in DOM");let L=Jp(S);L!==null&&L.clearHighlight(),T.markDirty(),a(s.getLatest())}tf().selectStart()})},[i,s]),w=()=>{i.update(()=>{let b=Xt();if(Zt(b)){let{columns:T,rows:S}=Jo(b),L=b.getNodes(),A=null;for(let M=0;M<L.length;M++){let O=L[M];if(Kt(O))if(A===null){O.setColSpan(T).setRowSpan(S),A=O;let G=Al(O),$;G&&Ol($=O.getFirstChild())&&$.remove()}else Kt(A)&&(Al(O)||A.append(...O.getChildren()),O.remove())}A!==null&&(A.getChildrenSize()===0&&A.append(ef()),lf(A)),o()}})},v=()=>{i.update(()=>{Yp()})},D=ae(b=>{i.update(()=>{Xp(b),o()})},[i,o]),x=ae(b=>{i.update(()=>{for(let T=0;T<u.columns;T++)Zp(b);o()})},[i,o,u.columns]),E=ae(()=>{i.update(()=>{Up(),o()})},[i,o]),g=ae(()=>{i.update(()=>{ut(s).remove(),C(),o()})},[i,s,C,o]),_=ae(()=>{i.update(()=>{Gp(),o()})},[i,o]),N=ae(()=>{i.update(()=>{let b=ut(s),T=zp(s),S=b.getChildren();if(T>=S.length||T<0)throw new Error("Expected table cell to be inside of table row.");let L=S[T];if(!Dl(L))throw new Error("Expected table row");let A=s.getHeaderStyles()^Ee.ROW;L.getChildren().forEach(M=>{if(!Kt(M))throw new Error("Expected table cell");M.setHeaderStyles(A,Ee.ROW)}),C(),o()})},[i,s,C,o]),k=ae(()=>{i.update(()=>{let b=ut(s),T=Kp(s),S=b.getChildren(),L=Math.max(...S.map(M=>M.getChildren().length));if(T>=L||T<0)throw new Error("Expected table cell to be inside of table row.");let A=s.getHeaderStyles()^Ee.COLUMN;for(let M=0;M<S.length;M++){let O=S[M];if(!Dl(O))throw new Error("Expected table row");let G=O.getChildren();if(T>=G.length)continue;let $=G[T];if(!Kt($))throw new Error("Expected table cell");$.setHeaderStyles(A,Ee.COLUMN)}C(),o()})},[i,s,C,o]),R=ae(()=>{i.update(()=>{if(s.isAttached()){let b=ut(s);b&&b.setRowStriping(!b.getRowStriping())}C(),o()})},[i,s,C,o]),I=null;return t&&(d?I=P("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>w(),type:"button",children:"Merge cells"}):p&&(I=P("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>v(),type:"button",children:"Unmerge cells"}))),$l(xe("div",{className:"table-action-menu-dropdown",onClick:b=>{b.stopPropagation()},ref:l,children:[I?xe(Qo.Fragment,{children:[I,P("hr",{})]}):null,P("button",{className:"item","data-test-id":"table-row-striping",onClick:()=>R(),type:"button",children:P("span",{className:"text",children:"Toggle Row Striping"})}),P("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>D(!1),type:"button",children:xe("span",{className:"text",children:["Insert ",u.rows===1?"row":`${u.rows} rows`," above"]})}),P("button",{className:"item","data-test-id":"table-insert-row-below",onClick:()=>D(!0),type:"button",children:xe("span",{className:"text",children:["Insert ",u.rows===1?"row":`${u.rows} rows`," below"]})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-insert-column-before",onClick:()=>x(!1),type:"button",children:xe("span",{className:"text",children:["Insert ",u.columns===1?"column":`${u.columns} columns`," ","left"]})}),P("button",{className:"item","data-test-id":"table-insert-column-after",onClick:()=>x(!0),type:"button",children:xe("span",{className:"text",children:["Insert ",u.columns===1?"column":`${u.columns} columns`," ","right"]})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-delete-columns",onClick:()=>_(),type:"button",children:P("span",{className:"text",children:"Delete column"})}),P("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>E(),type:"button",children:P("span",{className:"text",children:"Delete row"})}),P("button",{className:"item","data-test-id":"table-delete",onClick:()=>g(),type:"button",children:P("span",{className:"text",children:"Delete table"})}),P("hr",{}),P("button",{className:"item",onClick:()=>N(),type:"button",children:xe("span",{className:"text",children:[(s.__headerState&Ee.ROW)===Ee.ROW?"Remove":"Add"," ","row header"]})}),P("button",{className:"item","data-test-id":"table-column-header",onClick:()=>k(),type:"button",children:xe("span",{className:"text",children:[(s.__headerState&Ee.COLUMN)===Ee.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function af({anchorElem:t,cellMerge:e}){let[o]=Fl(),n=zt(null),r=zt(null),[i,l]=Pe(!1),[s,a]=Pe(null),u=ae(()=>{let d=n.current,m=Xt(),p=window.getSelection(),f=document.activeElement;if(m==null||d==null){a(null);return}let h=o.getRootElement();if(qo(m)&&h!==null&&p!==null&&h.contains(p.anchorNode)){let C=Vp(m.anchor.getNode());if(C==null){a(null);return}if(o.getElementByKey(C.getKey())==null){a(null);return}a(C)}else f||a(null)},[o]);ye(()=>o.registerUpdateListener(()=>{o.getEditorState().read(()=>{u()})})),ye(()=>{let d=n.current;if(d!=null&&s!=null){let m=o.getElementByKey(s.getKey());if(m!=null){let p=m.getBoundingClientRect(),f=d.getBoundingClientRect(),h=t.getBoundingClientRect(),C=p.top-h.top+4,w=p.right-f.width-10-h.left;d.style.opacity="1",d.style.transform=`translate(${w}px, ${C}px)`}else d.style.opacity="0",d.style.transform="translate(-10000px, -10000px)"}},[n,s,o,t]);let c=zt(s);return ye(()=>{c.current!==s&&l(!1),c.current=s},[c,s]),P("div",{className:"table-cell-action-button-container",ref:n,children:s!=null&&xe(Qo.Fragment,{children:[P("button",{className:"table-cell-action-button",onClick:d=>{d.stopPropagation(),l(!i)},ref:r,type:"button",children:P(Ml,{})}),i&&P(sf,{cellMerge:e,contextRef:r,onClose:()=>l(!1),setIsMenuOpen:l,tableCellNode:s})]})})}var Pl=t=>{let e=Hp(3),{anchorElem:o}=t,n=jp(),r;return e[0]!==o||e[1]!==n?(r=$l(n?P(af,{anchorElem:o??document.body,cellMerge:!0}):null,o??document.body),e[0]=o,e[1]=n,e[2]=r):r=e[2],r};import{c as cf}from"react/compiler-runtime";import{jsx as Jt,jsxs as uf}from"react/jsx-runtime";import{useLexicalComposerContext as df}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as mf}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as pf,$getTableNodeFromLexicalNodeOrThrow as er,$getTableRowIndexFromTableCellNode as ff,$isTableCellNode as Bl,$isTableRowNode as hf,getDOMCellFromTarget as gf,TableNode as Cf}from"@lexical/table";import{calculateZoomLevel as Hl}from"@lexical/utils";import{$getNearestNodeFromDOMNode as tr}from"lexical";import*as Gl from"react";import{useCallback as dt,useEffect as or,useRef as Yt,useState as mt}from"react";import{createPortal as xf}from"react-dom";var bf=33,jl=92;function _f({editor:t}){let e=Yt(null),o=Yt(null),n=Yt(null),r=B(),i=Yt(null),[l,s]=mt(null),[a,u]=mt(null),[c,d]=mt(!1),[m,p]=mt(null),f=dt(()=>{u(null),e.current=null,p(null),i.current=null,n.current=null},[]),h=k=>(k.buttons&1)===1;or(()=>t.registerNodeTransform(Cf,k=>{if(k.getColWidths())return k;let R=k.getColumnCount(),I=jl;return k.setColWidths(Array(R).fill(I)),k}),[t]),or(()=>{let k=T=>{setTimeout(()=>{let S=T.target;if(m){s({x:T.clientX,y:T.clientY});return}if(d(h(T)),!(o.current&&o.current.contains(S))&&e.current!==S){e.current=S;let L=gf(S);L&&a!==L?t.update(()=>{let A=tr(L.elem);if(!A)throw new Error("TableCellResizer: Table cell node not found.");let M=er(A),O=t.getElementByKey(M.getKey());if(!O)throw new Error("TableCellResizer: Table element not found.");e.current=S,n.current=O.getBoundingClientRect(),u(L)}):L==null&&f()}},0)},R=T=>{setTimeout(()=>{d(!0)},0)},I=T=>{setTimeout(()=>{d(!1)},0)},b=t.registerRootListener((T,S)=>{S?.removeEventListener("mousemove",k),S?.removeEventListener("mousedown",R),S?.removeEventListener("mouseup",I),T?.addEventListener("mousemove",k),T?.addEventListener("mousedown",R),T?.addEventListener("mouseup",I)});return()=>{b()}},[a,m,t,f]);let C=k=>k==="bottom",w=dt(k=>{if(!a)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let R=tr(a.elem);if(!Bl(R))throw new Error("TableCellResizer: Table cell node not found.");let I=er(R),b=ff(R)+R.getRowSpan()-1,T=I.getChildren();if(b>=T.length||b<0)throw new Error("Expected table cell to be inside of table row.");let S=T[b];if(!hf(S))throw new Error("Expected table row");let L=S.getHeight();if(L===void 0){let M=S.getChildren();L=Math.min(...M.map(O=>v(O,t)??1/0))}let A=Math.max(L+k,bf);S.setHeight(A)},{tag:"skip-scroll-into-view"})},[a,t]),v=(k,R)=>R.getElementByKey(k.getKey())?.clientHeight,D=(k,R)=>{for(let I=0;I<R.length;I++)for(let b=0;b<R[I].length;b++)if(R[I][b].cell===k)return b},x=dt(k=>{if(!a)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let R=tr(a.elem);if(!Bl(R))throw new Error("TableCellResizer: Table cell node not found.");let I=er(R),[b]=pf(I,null,null),T=D(R,b);if(T===void 0)throw new Error("TableCellResizer: Table column not found.");let S=I.getColWidths();if(!S)return;let L=S[T];if(L===void 0)return;let A=[...S],M=Math.max(L+k,jl);A[T]=M,I.setColWidths(A)},{tag:"skip-scroll-into-view"})},[a,t]),E=dt(k=>{let R=I=>{if(I.preventDefault(),I.stopPropagation(),!a)throw new Error("TableCellResizer: Expected active cell.");if(i.current){let{x:b,y:T}=i.current;if(a===null)return;let S=Hl(I.target);if(C(k)){let L=(I.clientY-T)/S;w(L)}else{let L=(I.clientX-b)/S;x(L)}f(),document.removeEventListener("mouseup",R)}};return R},[a,f,x,w]),g=dt(k=>R=>{if(R.preventDefault(),R.stopPropagation(),!a)throw new Error("TableCellResizer: Expected active cell.");i.current={x:R.clientX,y:R.clientY},s(i.current),p(k),document.addEventListener("mouseup",E(k))},[a,E]),[_,N]=mt({bottom:null,left:null,right:null,top:null});return or(()=>{if(a){let{height:k,left:R,top:I,width:b}=a.elem.getBoundingClientRect(),T=Hl(a.elem),S=10,L={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${S}px`,left:`${window.scrollX+R}px`,top:`${window.scrollY+I+k-S/2}px`,width:`${b}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${k}px`,left:`${window.scrollX+R+b-S/2}px`,top:`${window.scrollY+I}px`,width:`${S}px`}},A=n.current;m&&l&&A&&(C(m)?(L[m].left=`${window.scrollX+A.left}px`,L[m].top=`${window.scrollY+l.y/T}px`,L[m].height="3px",L[m].width=`${A.width}px`):(L[m].top=`${window.scrollY+A.top}px`,L[m].left=`${window.scrollX+l.x/T}px`,L[m].width="3px",L[m].height=`${A.height}px`),L[m].backgroundColor="#adf"),N(L)}else N({bottom:null,left:null,right:null,top:null})},[a,m,l]),Jt("div",{ref:o,children:a!=null&&!c&&uf(Gl.Fragment,{children:[Jt("div",{className:`${r.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:g("right"),style:_.right||void 0}),Jt("div",{className:`${r.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:g("bottom"),style:_.bottom||void 0})]})})}var Ul=()=>{let t=cf(3),[e]=df(),o=mf(),n,r;return t[0]!==e||t[1]!==o?(r=o?xf(Jt(_f,{editor:e}),document.body):null,t[0]=e,t[1]=o,t[2]=r):r=t[2],n=r,n};import{c as If}from"react/compiler-runtime";import{jsx as rr,jsxs as Sf,Fragment as yf}from"react/jsx-runtime";import{useLexicalComposerContext as Jl}from"@lexical/react/LexicalComposerContext";import{$getTableColumnIndexFromTableCellNode as vf,$getTableRowIndexFromTableCellNode as Mf,$insertTableColumn__EXPERIMENTAL as Df,$insertTableRow__EXPERIMENTAL as Af,$isTableCellNode as Ff,$isTableNode as Kl,TableNode as Of}from"@lexical/table";import{$findMatchingParent as $f,mergeRegister as Pf}from"@lexical/utils";import{$getNearestNodeFromDOMNode as zl}from"lexical";import{useEffect as Zl,useMemo as Bf,useRef as Xl,useState as qt}from"react";import"react";import{createPortal as Hf}from"react-dom";import{c as Nf}from"react/compiler-runtime";import{useEffect as Lf,useRef as Rf}from"react";var Tf="Expected a function",Ef=Math.max,wf=Math.min;function kf(t,e,o){let n,r,i=0,l,s=!1,a=!1,u,c,d,m=!0;if(typeof t!="function")throw new TypeError(Tf);e=e||0,typeof o=="object"&&(s=!!o.leading,a="maxWait"in o,u=a?Ef(o.maxWait||0,e):u,m="trailing"in o?!!o.trailing:m);function p(g){let _=n,N=l;return n=l=void 0,i=g,c=t.apply(N,_),c}function f(g){return i=g,d=setTimeout(w,e),s?p(g):c}function h(g){let _=g-r,N=g-i,k=e-_;return a?wf(k,u-N):k}function C(g){let _=g-r,N=g-i;return r===void 0||_>=e||_<0||a&&N>=u}function w(){let g=Date.now();if(C(g))return v(g);d=setTimeout(w,h(g))}function v(g){return d=void 0,m&&n?p(g):(n=l=void 0,c)}function D(){d!==void 0&&clearTimeout(d),i=0,n=r=l=d=void 0}function x(){return d===void 0?c:v(Date.now())}function E(){let g=Date.now(),_=C(g);if(n=arguments,l=this,r=g,_){if(d===void 0)return f(r);if(a)return clearTimeout(d),d=setTimeout(w,e),p(r)}return d===void 0&&(d=setTimeout(w,e)),c}return E.cancel=D,E.flush=x,E}var Wl=kf;function Vl(t,e,o){let n=Nf(6),r=Rf(null),i,l;n[0]!==t||n[1]!==o||n[2]!==e?(i=()=>(r.current=Wl(t,e,{maxWait:o}),()=>{r.current?.cancel()}),l=[t,e,o],n[0]=t,n[1]=o,n[2]=e,n[3]=i,n[4]=l):(i=n[3],l=n[4]),Lf(i,l);let s;return n[5]===Symbol.for("react.memo_cache_sentinel")?(s=(...u)=>{let c=u;r.current&&r.current(...c)},n[5]=s):s=n[5],s}var Yl=20;function jf({anchorElem:t}){let[e]=Jl(),o=B(),[n,r]=qt(!1),[i,l]=qt(!1),[s,a]=qt(!1),[u,c]=qt({}),d=Xl(new Set),m=Xl(null),p=Vl(C=>{let{isOutside:w,tableDOMNode:v}=Gf(C,o.editorConfig?.lexical);if(w){r(!1),l(!1);return}if(!v)return;m.current=v;let D=null,x=null,E=null;if(e.update(()=>{let g=zl(v);if(Ff(g)){let _=$f(g,N=>Kl(N));if(!Kl(_))return;if(E=e.getElementByKey(_?.getKey()),E){let N=_.getChildrenSize(),k=_.getChildAtIndex(0)?.getChildrenSize(),R=Mf(g),I=vf(g);R===N-1?D=g:I===k-1&&(x=g)}}}),E){let{bottom:g,height:_,left:N,right:k,width:R,y:I}=E.getBoundingClientRect(),{left:b,y:T}=t.getBoundingClientRect();D?(l(!1),r(!0),c({height:Yl,left:N-b,top:g-T+5,width:R})):x&&(l(!0),r(!1),c({height:_,left:k-b+5,top:I-T,width:Yl}))}},50,250),f=Bf(()=>new ResizeObserver(()=>{r(!1),l(!1)}),[]);Zl(()=>{if(s)return document.addEventListener("mousemove",p),()=>{r(!1),l(!1),document.removeEventListener("mousemove",p)}},[s,p]),Zl(()=>Pf(e.registerMutationListener(Of,C=>{e.getEditorState().read(()=>{for(let[w,v]of C){let D=e.getElementByKey(w);switch(v){case"created":d.current.add(w),a(d.current.size>0),D&&f.observe(D);break;case"destroyed":d.current.delete(w),a(d.current.size>0),f.disconnect(),d.current.forEach(x=>{let E=e.getElementByKey(x);E&&f.observe(E)});break;default:break}}})},{skipInitialization:!1})),[e,f]);let h=C=>{e.update(()=>{m.current&&(zl(m.current)?.selectEnd(),C?(Af(),r(!1)):(Df(),l(!1)))})};return e?.isEditable()?Sf(yf,{children:[n&&rr("button",{className:o.editorConfig.lexical.theme.tableAddRows,onClick:()=>h(!0),style:{...u},type:"button"}),i&&rr("button",{className:o.editorConfig.lexical.theme.tableAddColumns,onClick:()=>h(!1),style:{...u},type:"button"})]}):null}function Gf(t,e){let o=t.target;if(o&&o instanceof HTMLElement){let n=o.closest(`td.${e.theme.tableCell}, th.${e.theme.tableCell}`);return{isOutside:!(n||o.closest(`button.${e.theme.tableAddRows}`)||o.closest(`button.${e.theme.tableAddColumns}`)||o.closest(`div.${e.theme.tableCellResizer}`)),tableDOMNode:n}}else return{isOutside:!0,tableDOMNode:null}}function ql(t){let e=If(2),{anchorElem:o}=t,n=o===void 0?document.body:o,[r]=Jl();if(!r?.isEditable())return null;let i;return e[0]!==n?(i=Hf(rr(jf,{anchorElem:n}),n),e[0]=n,e[1]=i):i=e[1],i}import{c as Uf}from"react/compiler-runtime";import{jsx as nr,jsxs as Wf}from"react/jsx-runtime";import{useLexicalComposerContext as Vf}from"@lexical/react/LexicalComposerContext";import{TablePlugin as Kf}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as zf,TableNode as Zf}from"@lexical/table";import{mergeRegister as Xf}from"@lexical/utils";import{formatDrawerSlug as Yf,useEditDepth as Jf}from"@payloadcms/ui";import{$getSelection as qf,$isRangeSelection as Qf,COMMAND_PRIORITY_EDITOR as e1,createCommand as t1}from"lexical";import{createContext as o1,useContext as r1,useEffect as n1,useMemo as i1,useState as l1}from"react";import*as Ql from"react";var Qt=t1("OPEN_EMBED_DRAWER_COMMAND"),es=o1({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function ts({children:t}){let[e,o]=l1({cellEditorConfig:null,cellEditorPlugins:null});return nr(es.Provider,{value:i1(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(n,r)=>{o({cellEditorConfig:n,cellEditorPlugins:r})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var os=()=>{let t=Uf(16),[e]=Vf(),o=r1(es),n=Jf(),{fieldProps:r,uuid:i}=B(),{schemaPath:l}=r,s="lexical-table-create-"+i,a;t[0]!==n||t[1]!==s?(a=Yf({slug:s,depth:n}),t[0]=n,t[1]=s,t[2]=a):a=t[2];let u=a,{toggleDrawer:c}=ce(u,!0),d;t[3]!==e||t[4]!==c?(d=()=>{if(!e.hasNodes([Zf]))throw new Error("TablePlugin: TableNode is not registered on editor");return Xf(e.registerCommand(Qt,()=>{let h;return h=null,e.getEditorState().read(()=>{let C=qf();Qf(C)&&(h=C)}),h&&c(),!0},e1))},t[3]=e,t[4]=c,t[5]=d):d=t[5];let m;t[6]!==o||t[7]!==e||t[8]!==c?(m=[o,e,c],t[6]=o,t[7]=e,t[8]=c,t[9]=m):m=t[9],n1(d,m);let p;t[10]!==e?(p=(h,C)=>{!C.columns||!C.rows||e.dispatchCommand(zf,{columns:String(C.columns),rows:String(C.rows)})},t[10]=e,t[11]=p):p=t[11];let f;return t[12]!==u||t[13]!==l||t[14]!==p?(f=Wf(Ql.Fragment,{children:[nr(He,{drawerSlug:u,drawerTitle:"Create Table",featureKey:"experimental_table",handleDrawerSubmit:p,schemaPath:l,schemaPathSuffix:"fields"}),nr(Kf,{hasCellBackgroundColor:!1,hasCellMerge:!0})]}),t[12]=u,t[13]=l,t[14]=p,t[15]=f):f=t[15],f};var u1=y({markdownTransformers:[yl],nodes:[a1,s1,c1],plugins:[{Component:os,position:"normal"},{Component:Ul,position:"normal"},{Component:Pl,position:"floatingAnchorElem"},{Component:ql,position:"floatingAnchorElem"}],providers:[ts],slashMenu:{groups:[Z([{Icon:zo,key:"table",keywords:["table"],label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(Qt,{})}}])]},toolbarFixed:{groups:[me([{ChildComponent:zo,key:"table",label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(Qt,{})}}])]}});import{$isNodeSelection as A1}from"lexical";import{jsx as ir,jsxs as d1}from"react/jsx-runtime";import"react";var lr=()=>d1("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:[ir("path",{d:"M14.6667 4H5.33333C4.59695 4 4 4.59695 4 5.33333V14.6667C4 15.403 4.59695 16 5.33333 16H14.6667C15.403 16 16 15.403 16 14.6667V5.33333C16 4.59695 15.403 4 14.6667 4Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),ir("path",{d:"M7.99984 9.33366C8.73622 9.33366 9.33317 8.73671 9.33317 8.00033C9.33317 7.26395 8.73622 6.66699 7.99984 6.66699C7.26346 6.66699 6.6665 7.26395 6.6665 8.00033C6.6665 8.73671 7.26346 9.33366 7.99984 9.33366Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),ir("path",{d:"M16 11.9995L13.9427 9.94214C13.6926 9.69218 13.3536 9.55176 13 9.55176C12.6464 9.55176 12.3074 9.69218 12.0573 9.94214L6 15.9995",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})]});import{c as _1}from"react/compiler-runtime";import{jsx as T1}from"react/jsx-runtime";import{useLexicalComposerContext as E1}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as w1,mergeRegister as k1}from"@lexical/utils";import{useConfig as N1}from"@payloadcms/ui";import{$getPreviousSelection as L1,$getSelection as R1,$isParagraphNode as ns,$isRangeSelection as I1,COMMAND_PRIORITY_EDITOR as S1,createCommand as y1}from"lexical";import{useEffect as v1}from"react";import{c as m1}from"react/compiler-runtime";import{jsx as sr}from"react/jsx-runtime";import{useLexicalComposerContext as p1}from"@lexical/react/LexicalComposerContext.js";import{$getNodeByKey as f1,COMMAND_PRIORITY_EDITOR as h1}from"lexical";import{useEffect as g1,useState as C1}from"react";var x1=({editor:t,relationTo:e,replaceNodeKey:o,value:n})=>{o?t.update(()=>{let r=f1(o);r&&r.replace(Ke({data:{fields:null,relationTo:e,value:n}}))}):t.dispatchCommand(ar,{fields:null,relationTo:e,value:n})},b1=t=>{let e=m1(13),{enabledCollectionSlugs:o}=t,[n]=p1(),[r,i]=C1(null),l;e[0]!==o?(l={collectionSlugs:o,uploads:!0},e[0]=o,e[1]=l):l=e[1];let{closeListDrawer:s,ListDrawer:a,openListDrawer:u}=lt(l),c,d;e[2]!==n||e[3]!==u?(c=()=>n.registerCommand(We,h=>(i(h?.replace?h?.replace.nodeKey:null),u(),!0),h1),d=[n,u],e[2]=n,e[3]=u,e[4]=c,e[5]=d):(c=e[4],d=e[5]),g1(c,d);let m;e[6]!==s||e[7]!==n||e[8]!==r?(m=h=>{let{collectionSlug:C,docID:w}=h;s(),x1({editor:n,relationTo:C,replaceNodeKey:r,value:w})},e[6]=s,e[7]=n,e[8]=r,e[9]=m):m=e[9];let p=m,f;return e[10]!==a||e[11]!==p?(f=sr(a,{onSelect:p}),e[10]=a,e[11]=p,e[12]=f):f=e[12],f},rs=t=>sr(bt,{...t,uploads:!0,children:sr(b1,{...t})});var ar=y1("INSERT_UPLOAD_COMMAND"),is=t=>{let e=_1(5),[o]=E1(),{config:n}=N1(),{collections:r}=n,i,l;e[0]!==o?(i=()=>{if(!o.hasNodes([Ve]))throw new Error("UploadPlugin: UploadNode not registered on editor");return k1(o.registerCommand(ar,a=>(o.update(()=>{let u=R1()||L1();if(I1(u)){let c=Ke({data:{id:a.id,fields:a.fields,relationTo:a.relationTo,value:a.value}});w1(c);let{focus:d}=u,m=d.getNode();ns(m)&&m.getTextContentSize()===0&&m.getParentOrThrow().getChildren().filter(M1).length>1&&m.remove()}}),!0),S1))},l=[o],e[0]=o,e[1]=i,e[2]=l):(i=e[1],l=e[2]),v1(i,l);let s;return e[3]!==r?(s=T1(rs,{enabledCollectionSlugs:r.map(D1)}),e[3]=r,e[4]=s):s=e[4],s};function M1(t){return ns(t)}function D1(t){let{slug:e}=t;return e}var F1=y({nodes:[Ve],plugins:[{Component:is,position:"normal"}],slashMenu:{groups:[Z([{Icon:lr,key:"upload",keywords:["upload","image","file","img","picture","photo","media"],label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(We,{replace:!1})}}])]},toolbarFixed:{groups:[me([{ChildComponent:lr,isActive:({selection:t})=>{if(!A1(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return so(e)},key:"upload",label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(We,{replace:!1})}}])]}});import{c as O1}from"react/compiler-runtime";import{jsx as ur}from"react/jsx-runtime";import{ShimmerEffect as $1}from"@payloadcms/ui";import{lazy as P1,Suspense as B1,useEffect as H1,useState as j1}from"react";var ls={block:"LexicalEditorTheme__block",blockCursor:"LexicalEditorTheme__blockCursor",characterLimit:"LexicalEditorTheme__characterLimit",code:"LexicalEditorTheme__code",codeHighlight:{atrule:"LexicalEditorTheme__tokenAttr",attr:"LexicalEditorTheme__tokenAttr",boolean:"LexicalEditorTheme__tokenProperty",builtin:"LexicalEditorTheme__tokenSelector",cdata:"LexicalEditorTheme__tokenComment",char:"LexicalEditorTheme__tokenSelector",class:"LexicalEditorTheme__tokenFunction","class-name":"LexicalEditorTheme__tokenFunction",comment:"LexicalEditorTheme__tokenComment",constant:"LexicalEditorTheme__tokenProperty",deleted:"LexicalEditorTheme__tokenProperty",doctype:"LexicalEditorTheme__tokenComment",entity:"LexicalEditorTheme__tokenOperator",function:"LexicalEditorTheme__tokenFunction",important:"LexicalEditorTheme__tokenVariable",inserted:"LexicalEditorTheme__tokenSelector",keyword:"LexicalEditorTheme__tokenAttr",namespace:"LexicalEditorTheme__tokenVariable",number:"LexicalEditorTheme__tokenProperty",operator:"LexicalEditorTheme__tokenOperator",prolog:"LexicalEditorTheme__tokenComment",property:"LexicalEditorTheme__tokenProperty",punctuation:"LexicalEditorTheme__tokenPunctuation",regex:"LexicalEditorTheme__tokenVariable",selector:"LexicalEditorTheme__tokenSelector",string:"LexicalEditorTheme__tokenSelector",symbol:"LexicalEditorTheme__tokenProperty",tag:"LexicalEditorTheme__tokenProperty",url:"LexicalEditorTheme__tokenOperator",variable:"LexicalEditorTheme__tokenVariable"},embedBlock:{base:"LexicalEditorTheme__embedBlock",focus:"LexicalEditorTheme__embedBlockFocus"},hashtag:"LexicalEditorTheme__hashtag",heading:{h1:"LexicalEditorTheme__h1",h2:"LexicalEditorTheme__h2",h3:"LexicalEditorTheme__h3",h4:"LexicalEditorTheme__h4",h5:"LexicalEditorTheme__h5",h6:"LexicalEditorTheme__h6"},hr:"LexicalEditorTheme__hr",indent:"LexicalEditorTheme__indent",inlineImage:"LexicalEditor__inline-image",link:"LexicalEditorTheme__link",list:{checklist:"LexicalEditorTheme__checklist",listitem:"LexicalEditorTheme__listItem",listitemChecked:"LexicalEditorTheme__listItemChecked",listitemUnchecked:"LexicalEditorTheme__listItemUnchecked",nested:{listitem:"LexicalEditorTheme__nestedListItem"},olDepth:["LexicalEditorTheme__ol1","LexicalEditorTheme__ol2","LexicalEditorTheme__ol3","LexicalEditorTheme__ol4","LexicalEditorTheme__ol5"],ul:"LexicalEditorTheme__ul"},ltr:"LexicalEditorTheme__ltr",mark:"LexicalEditorTheme__mark",markOverlap:"LexicalEditorTheme__markOverlap",paragraph:"LexicalEditorTheme__paragraph",quote:"LexicalEditorTheme__quote",relationship:"LexicalEditorTheme__relationship",rtl:"LexicalEditorTheme__rtl",table:"LexicalEditorTheme__table",tableAddColumns:"LexicalEditorTheme__tableAddColumns",tableAddRows:"LexicalEditorTheme__tableAddRows",tableCell:"LexicalEditorTheme__tableCell",tableCellActionButton:"LexicalEditorTheme__tableCellActionButton",tableCellActionButtonContainer:"LexicalEditorTheme__tableCellActionButtonContainer",tableCellEditing:"LexicalEditorTheme__tableCellEditing",tableCellHeader:"LexicalEditorTheme__tableCellHeader",tableCellPrimarySelected:"LexicalEditorTheme__tableCellPrimarySelected",tableCellResizer:"LexicalEditorTheme__tableCellResizer",tableCellSelected:"LexicalEditorTheme__tableCellSelected",tableCellSortedIndicator:"LexicalEditorTheme__tableCellSortedIndicator",tableResizeRuler:"LexicalEditorTheme__tableCellResizeRuler",tableRowStriping:"LexicalEditorTheme__tableRowStriping",tableSelected:"LexicalEditorTheme__tableSelected",text:{bold:"LexicalEditorTheme__textBold",code:"LexicalEditorTheme__textCode",italic:"LexicalEditorTheme__textItalic",strikethrough:"LexicalEditorTheme__textStrikethrough",subscript:"LexicalEditorTheme__textSubscript",superscript:"LexicalEditorTheme__textSuperscript",underline:"LexicalEditorTheme__textUnderline",underlineStrikethrough:"LexicalEditorTheme__textUnderlineStrikethrough"},upload:"editor-upload"};var eo={namespace:"lexical",theme:ls};function ss({featureClientSchemaMap:t,field:e,schemaPath:o,unSanitizedEditorConfig:n}){for(let s of n.features)if(!s?.clientFeatureProps?.featureKey||s?.clientFeatureProps?.order===void 0||s?.clientFeatureProps?.order===null)throw new Error("A Feature you have installed does not return the client props as clientFeatureProps. Please make sure to always return those props, even if they are null, as other important props like order and featureKey are later on injected.");n.features=n.features.sort((s,a)=>s.clientFeatureProps.order-a.clientFeatureProps.order);let r=new Map;for(let s of n.features)r.set(s.clientFeatureProps.featureKey,s);let i=new Map,l=0;for(let s of n.features){let a=typeof s.feature=="function"?s.feature({featureClientSchemaMap:t,featureProviderMap:r,field:e,resolvedFeatures:i,schemaPath:o,unSanitizedEditorConfig:n}):s.feature;a.key=s.clientFeatureProps.featureKey,a.order=l,i.set(s.clientFeatureProps.featureKey,a),l++}return i}var as=t=>{let e={enabledFeatures:[],enabledFormats:[],markdownTransformers:[],nodes:[],plugins:[],providers:[],slashMenu:{dynamicGroups:[],groups:[]},toolbarFixed:{groups:[]},toolbarInline:{groups:[]}};if(!t?.size)return e;t.forEach(o=>{if(o.providers?.length&&(e.providers=e.providers.concat(o.providers)),o.enableFormats?.length&&e.enabledFormats.push(...o.enableFormats),o.nodes?.length)for(let n of o.nodes)e.nodes.push(n);if(o.plugins?.length&&o.plugins.forEach((n,r)=>{e.plugins?.push({clientProps:o.sanitizedClientFeatureProps,Component:n.Component,key:o.key+r,position:n.position})}),o.toolbarInline?.groups?.length)for(let n of o.toolbarInline.groups){let r=e.toolbarInline.groups.find(i=>i.key===n.key);r?e.toolbarInline.groups=e.toolbarInline.groups.filter(i=>i.key!==n.key):r={...n,items:[]},n?.items?.length&&(r.items=r.items.concat(n.items)),e.toolbarInline?.groups.push(r)}if(o.toolbarFixed?.groups?.length)for(let n of o.toolbarFixed.groups){let r=e.toolbarFixed.groups.find(i=>i.key===n.key);r?e.toolbarFixed.groups=e.toolbarFixed.groups.filter(i=>i.key!==n.key):r={...n,items:[]},n?.items?.length&&(r.items=r.items.concat(n.items)),e.toolbarFixed?.groups.push(r)}if(o.slashMenu?.groups){o.slashMenu.dynamicGroups?.length&&(e.slashMenu.dynamicGroups=e.slashMenu.dynamicGroups.concat(o.slashMenu.dynamicGroups));for(let n of o.slashMenu.groups){let r=e.slashMenu.groups.find(i=>i.key===n.key);r?e.slashMenu.groups=e.slashMenu.groups.filter(i=>i.key!==n.key):r={...n,items:[]},n?.items?.length&&(r.items=r.items.concat(n.items)),e.slashMenu.groups.push(r)}}if(o.markdownTransformers?.length)for(let n of o.markdownTransformers)typeof n=="function"?e.markdownTransformers.push(n({allNodes:e.nodes,allTransformers:e.markdownTransformers})):e.markdownTransformers.push(n);e.enabledFeatures.push(o.key)}),e.toolbarInline.groups.sort((o,n)=>o.order&&n.order?o.order-n.order:o.order?-1:n.order?1:0),e.toolbarFixed.groups.sort((o,n)=>o.order&&n.order?o.order-n.order:o.order?-1:n.order?1:0);for(let o of e.toolbarInline.groups)o.items.sort((n,r)=>n.order&&r.order?n.order-r.order:n.order?-1:r.order?1:0);for(let o of e.toolbarFixed.groups)o.items.sort((n,r)=>n.order&&r.order?n.order-r.order:n.order?-1:r.order?1:0);return e};function cr(t,e,o){return{admin:o,features:as(t),lexical:e,resolvedFeatureMap:t}}var G1=P1(()=>import("./Field-G3GIPW2U.js").then(t=>({default:t.RichText}))),U1=t=>{let e=O1(14),{admin:o,clientFeatures:n,featureClientSchemaMap:r,field:i,lexicalEditorConfig:l,schemaPath:s}=t,a;e[0]!==o?(a=o===void 0?{}:o,e[0]=o,e[1]=a):a=e[1];let u=a,c=l===void 0?eo:l,[d,m]=j1(null),p,f;e[2]!==u||e[3]!==n||e[4]!==r||e[5]!==i||e[6]!==d||e[7]!==c||e[8]!==s?(p=()=>{if(d)return;let C=[];for(let[D,x]of Object.entries(n))x.clientFeatureProvider&&C.push(x.clientFeatureProvider(x.clientFeatureProps));let w=c||eo,v=ss({featureClientSchemaMap:r,field:i,schemaPath:s??i.name,unSanitizedEditorConfig:{features:C,lexical:w}});m(cr(v,w,u))},f=[c,u,d,n,r,i,s],e[2]=u,e[3]=n,e[4]=r,e[5]=i,e[6]=d,e[7]=c,e[8]=s,e[9]=p,e[10]=f):(p=e[9],f=e[10]),H1(p,f);let h;return e[11]!==d||e[12]!==t?(h=ur(B1,{fallback:ur($1,{height:"35vh"}),children:d&&ur(G1,{...t,editorConfig:d})}),e[11]=d,e[12]=t,e[13]=h):h=e[13],h};function W1(...t){return t.filter(Boolean).join(" ")}var to=new WeakMap;function cs(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function oo(t,e){let o=to.get(t);if(o===void 0){let n=new Set,r=l=>{o!==void 0&&(o.start=cs(l))},i=l=>{if(o===void 0)return;let{start:s}=o;if(s===null)return;let a=cs(l);for(let u of n)a!==null&&u([a[0]-s[0],a[1]-s[1]],l)};t.addEventListener("touchstart",r),t.addEventListener("touchend",i),o={handleTouchend:i,handleTouchstart:r,listeners:n,start:null},to.set(t,o)}return o.listeners.add(e),()=>{V1(t,e)}}function V1(t,e){let o=to.get(t);if(o===void 0)return;let{listeners:n}=o;n.delete(e),n.size===0&&(to.delete(t),t.removeEventListener("touchstart",o.handleTouchstart),t.removeEventListener("touchend",o.handleTouchend))}function K1(t,e){return oo(t,(o,n)=>{let[r,i]=o;r<0&&-r>Math.abs(i)&&e(r,n)})}function z1(t,e){return oo(t,(o,n)=>{let[r,i]=o;r>0&&r>Math.abs(i)&&e(r,n)})}function Z1(t,e){return oo(t,(o,n)=>{let[r,i]=o;i<0&&-i>Math.abs(r)&&e(r,n)})}function X1(t,e){return oo(t,(o,n)=>{let[r,i]=o;i>0&&i>Math.abs(r)&&e(r,n)})}var F={DOM_ELEMENT_TYPE:1,DOM_TEXT_TYPE:3,NO_DIRTY_NODES:0,HAS_DIRTY_NODES:1,FULL_RECONCILE:2,IS_NORMAL:0,IS_TOKEN:1,IS_SEGMENTED:2,IS_INERT:3,IS_BOLD:1,IS_ITALIC:2,IS_STRIKETHROUGH:4,IS_UNDERLINE:8,IS_CODE:16,IS_SUBSCRIPT:32,IS_SUPERSCRIPT:64,IS_HIGHLIGHT:128,IS_DIRECTIONLESS:1,IS_UNMERGEABLE:2,IS_ALIGN_LEFT:1,IS_ALIGN_CENTER:2,IS_ALIGN_RIGHT:3,IS_ALIGN_JUSTIFY:4,IS_ALIGN_START:5,IS_ALIGN_END:6},Y1=F.IS_BOLD|F.IS_ITALIC|F.IS_STRIKETHROUGH|F.IS_UNDERLINE|F.IS_CODE|F.IS_SUBSCRIPT|F.IS_SUPERSCRIPT|F.IS_HIGHLIGHT,J1="\xA0",q1=`
40
40
 
41
41
  `,us="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",ds="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",Q1=new RegExp("^[^"+ds+"]*["+us+"]"),eh=new RegExp("^[^"+us+"]*["+ds+"]"),th={bold:F.IS_BOLD,code:F.IS_CODE,highlight:F.IS_HIGHLIGHT,italic:F.IS_ITALIC,strikethrough:F.IS_STRIKETHROUGH,subscript:F.IS_SUBSCRIPT,superscript:F.IS_SUPERSCRIPT,underline:F.IS_UNDERLINE},oh={directionless:F.IS_DIRECTIONLESS,unmergeable:F.IS_UNMERGEABLE},rh={center:F.IS_ALIGN_CENTER,end:F.IS_ALIGN_END,justify:F.IS_ALIGN_JUSTIFY,left:F.IS_ALIGN_LEFT,right:F.IS_ALIGN_RIGHT,start:F.IS_ALIGN_START},nh={[F.IS_ALIGN_CENTER]:"center",[F.IS_ALIGN_END]:"end",[F.IS_ALIGN_JUSTIFY]:"justify",[F.IS_ALIGN_LEFT]:"left",[F.IS_ALIGN_RIGHT]:"right",[F.IS_ALIGN_START]:"start"},ih={normal:F.IS_NORMAL,segmented:F.IS_SEGMENTED,token:F.IS_TOKEN},lh={[F.IS_NORMAL]:"normal",[F.IS_SEGMENTED]:"segmented",[F.IS_TOKEN]:"token"};import{c as sh}from"react/compiler-runtime";import{jsx as ah}from"react/jsx-runtime";import"react";var ch=()=>{let t=sh(2),{EditButton:e}=ue(),o;return t[0]!==e?(o=e?ah(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as uh}from"react/compiler-runtime";import{jsx as dh}from"react/jsx-runtime";import"react";var mh=()=>{let t=uh(2),{RemoveButton:e}=ue(),o;return t[0]!==e?(o=e?dh(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as ph}from"react/compiler-runtime";import{jsx as fh}from"react/jsx-runtime";import"react";var hh=()=>{let t=ph(2),{Label:e}=ue(),o;return t[0]!==e?(o=e?fh(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as gh}from"react/compiler-runtime";import{jsx as Ch}from"react/jsx-runtime";import"react";var xh=t=>{let e=gh(3),{children:o}=t,{InlineBlockContainer:n}=ue(),r;return e[0]!==n||e[1]!==o?(r=n?Ch(n,{children:o}):null,e[0]=n,e[1]=o,e[2]=r):r=e[2],r};import{c as bh}from"react/compiler-runtime";import{jsx as _h}from"react/jsx-runtime";import"react";var Th=t=>{let e=bh(6),{children:o,editButton:n,Label:r,removeButton:i}=t,{BlockCollapsible:l}=ke(),s;return e[0]!==l||e[1]!==r||e[2]!==o||e[3]!==n||e[4]!==i?(s=l?_h(l,{editButton:n,Label:r,removeButton:i,children:o}):null,e[0]=l,e[1]=r,e[2]=o,e[3]=n,e[4]=i,e[5]=s):s=e[5],s};import{c as Eh}from"react/compiler-runtime";import{jsx as wh}from"react/jsx-runtime";import"react";var kh=()=>{let t=Eh(2),{EditButton:e}=ke(),o;return t[0]!==e?(o=e?wh(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Nh}from"react/compiler-runtime";import{jsx as Lh}from"react/jsx-runtime";import"react";var Rh=()=>{let t=Nh(2),{RemoveButton:e}=ke(),o;return t[0]!==e?(o=e?Lh(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};export{Qe as $createAutoLinkNode,It as $createBlockNode,no as $createInlineBlockNode,pe as $createLinkNode,Ue as $createRelationshipNode,Ke as $createUploadNode,he as $isAutoLinkNode,Rt as $isBlockNode,io as $isInlineBlockNode,V as $isLinkNode,lo as $isRelationshipNode,so as $isUploadNode,Ns as AlignFeatureClient,fe as AutoLinkNode,Th as BlockCollapsible,kh as BlockEditButton,de as BlockNode,Rh as BlockRemoveButton,vs as BlockquoteFeatureClient,Ra as BlocksFeatureClient,Za as BoldFeatureClient,ps as CAN_USE_DOM,Sd as ChecklistFeatureClient,oh as DETAIL_TYPE_TO_DETAIL,q1 as DOUBLE_LINE_BREAK,nh as ELEMENT_FORMAT_TO_TYPE,rh as ELEMENT_TYPE_TO_FORMAT,xs as ENABLE_SLASH_MENU_COMMAND,ms as EditorConfigProvider,He as FieldsDrawer,cp as FixedToolbarFeatureClient,yc as HeadingFeatureClient,jc as HorizontalRuleFeatureClient,Y1 as IS_ALL_FORMATTING,eu as IndentFeatureClient,xh as InlineBlockContainer,ch as InlineBlockEditButton,hh as InlineBlockLabel,ro as InlineBlockNode,mh as InlineBlockRemoveButton,Qa as InlineCodeFeatureClient,_p as InlineToolbarFeatureClient,rc as ItalicFeatureClient,eh as LTR_REGEX,Jd as LexicalPluginToLexicalFeatureClient,fd as LinkFeatureClient,Q as LinkNode,J1 as NON_BREAKING_SPACE,F as NodeFormat,$d as OrderedListFeatureClient,im as ParagraphFeatureClient,gs as Point,Q1 as RTL_REGEX,bs as Rect,Om as RelationshipFeatureClient,Ge as RelationshipNode,U1 as RichTextField,rm as SlateToLexicalFeatureClient,ac as StrikethroughFeatureClient,mc as SubscriptFeatureClient,gc as SuperscriptFeatureClient,ih as TEXT_MODE_TO_TYPE,th as TEXT_TYPE_TO_FORMAT,lh as TEXT_TYPE_TO_MODE,le as TOGGLE_LINK_COMMAND,u1 as TableFeatureClient,Ba as TestRecorderFeatureClient,st as ToolbarButton,Se as ToolbarDropdown,Wa as TreeViewFeatureClient,Tc as UnderlineFeatureClient,Vd as UnorderedListFeatureClient,F1 as UploadFeatureClient,Ve as UploadNode,X1 as addSwipeDownListener,K1 as addSwipeLeftListener,z1 as addSwipeRightListener,Z1 as addSwipeUpListener,To as createBlockNode,y as createClientFeature,eo as defaultEditorLexicalConfig,Ko as getDOMRangeRect,_s as getEnabledNodes,Me as getSelectedNode,hs as isHTMLElement,Cs as isPoint,W1 as joinClasses,cr as sanitizeClientEditorConfig,as as sanitizeClientFeatures,Gt as setFloatingElemPosition,Ft as setFloatingElemPositionForLinkEditor,Z as slashMenuBasicGroupWithItems,me as toolbarAddDropdownGroupWithItems,wo as toolbarFeatureButtonsGroupWithItems,Y as toolbarFormatGroupWithItems,q as toolbarTextDropdownGroupWithItems,ke as useBlockComponentContext,B as useEditorConfigContext,ue as useInlineBlockComponentContext,fs as useLexicalDocumentDrawer,ce as useLexicalDrawer,lt as useLexicalListDrawer};
42
42
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Field.d.ts","sourceRoot":"","sources":["../../src/field/Field.tsx"],"names":[],"mappings":"AAcA,OAAO,KAA+B,MAAM,OAAO,CAAA;AAGnD,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAA;AAC7E,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAA;AAE5D,OAAO,mCAAmC,CAAA;AAC1C,OAAO,eAAe,CAAA;AACtB,OAAO,cAAc,CAAA;AAKrB,QAAA,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAC/B;IACE,QAAQ,CAAC,YAAY,EAAE,2BAA2B,CAAA;CACnD,GAAG,yBAAyB,CAsG9B,CAAA;AAaD,eAAO,MAAM,QAAQ,EAAE,OAAO,iBAAoD,CAAA"}
1
+ {"version":3,"file":"Field.d.ts","sourceRoot":"","sources":["../../src/field/Field.tsx"],"names":[],"mappings":"AAaA,OAAO,KAA+B,MAAM,OAAO,CAAA;AAGnD,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAA;AAC7E,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAA;AAE5D,OAAO,mCAAmC,CAAA;AAC1C,OAAO,eAAe,CAAA;AACtB,OAAO,cAAc,CAAA;AAKrB,QAAA,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAC/B;IACE,QAAQ,CAAC,YAAY,EAAE,2BAA2B,CAAA;CACnD,GAAG,yBAAyB,CAsG9B,CAAA;AAaD,eAAO,MAAM,QAAQ,EAAE,OAAO,iBAAqC,CAAA"}
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
 
3
3
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
- import { FieldDescription, FieldError, FieldLabel, RenderCustomComponent, useEditDepth, useField, withCondition } from '@payloadcms/ui';
4
+ import { FieldDescription, FieldError, FieldLabel, RenderCustomComponent, useEditDepth, useField } from '@payloadcms/ui';
5
5
  import { mergeFieldStyles } from '@payloadcms/ui/shared';
6
6
  import React, { useCallback, useMemo } from 'react';
7
7
  import { ErrorBoundary } from 'react-error-boundary';
@@ -125,5 +125,5 @@ function fallbackRender({
125
125
  })]
126
126
  });
127
127
  }
128
- export const RichText = withCondition(RichTextComponent);
128
+ export const RichText = RichTextComponent;
129
129
  //# sourceMappingURL=Field.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Field.js","names":["FieldDescription","FieldError","FieldLabel","RenderCustomComponent","useEditDepth","useField","withCondition","mergeFieldStyles","React","useCallback","useMemo","ErrorBoundary","LexicalProvider","baseClass","RichTextComponent","props","editorConfig","field","name","admin","className","description","readOnly","readOnlyFromAdmin","label","localized","required","path","pathFromProps","readOnlyFromTopLevelProps","validate","readOnlyFromProps","editDepth","memoizedValidate","value","validationOptions","customComponents","AfterInput","BeforeInput","Description","Error","Label","formInitializing","formProcessing","initialValue","setValue","showError","disabled","classes","hideGutter","filter","Boolean","join","pathWithEditDepth","handleChange","editorState","toJSON","styles","_jsxs","style","_jsx","CustomComponent","Fallback","fallbackRender","onReset","composerKey","fieldProps","onChange","JSON","stringify","error","role","color","message","RichText"],"sources":["../../src/field/Field.tsx"],"sourcesContent":["'use client'\nimport type { EditorState, SerializedEditorState } from 'lexical'\nimport type { Validate } from 'payload'\n\nimport {\n FieldDescription,\n FieldError,\n FieldLabel,\n RenderCustomComponent,\n useEditDepth,\n useField,\n withCondition,\n} from '@payloadcms/ui'\nimport { mergeFieldStyles } from '@payloadcms/ui/shared'\nimport React, { useCallback, useMemo } from 'react'\nimport { ErrorBoundary } from 'react-error-boundary'\n\nimport type { SanitizedClientEditorConfig } from '../lexical/config/types.js'\nimport type { LexicalRichTextFieldProps } from '../types.js'\n\nimport '../lexical/theme/EditorTheme.scss'\nimport './bundled.css'\nimport './index.scss'\nimport { LexicalProvider } from '../lexical/LexicalProvider.js'\n\nconst baseClass = 'rich-text-lexical'\n\nconst RichTextComponent: React.FC<\n {\n readonly editorConfig: SanitizedClientEditorConfig // With rendered features n stuff\n } & LexicalRichTextFieldProps\n> = (props) => {\n const {\n editorConfig,\n field,\n field: {\n name,\n admin: { className, description, readOnly: readOnlyFromAdmin } = {},\n label,\n localized,\n required,\n },\n path: pathFromProps,\n readOnly: readOnlyFromTopLevelProps,\n validate, // Users can pass in client side validation if they WANT to, but it's not required anymore\n } = props\n\n const readOnlyFromProps = readOnlyFromTopLevelProps || readOnlyFromAdmin\n const path = pathFromProps ?? name\n\n const editDepth = useEditDepth()\n\n const memoizedValidate = useCallback<Validate>(\n (value, validationOptions) => {\n if (typeof validate === 'function') {\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n return validate(value, { ...validationOptions, required })\n }\n return true\n },\n // Important: do not add props to the dependencies array.\n // This would cause an infinite loop and endless re-rendering.\n // Removing props from the dependencies array fixed this issue: https://github.com/payloadcms/payload/issues/3709\n [validate, required],\n )\n\n const {\n customComponents: { AfterInput, BeforeInput, Description, Error, Label } = {},\n formInitializing,\n formProcessing,\n initialValue,\n setValue,\n showError,\n value,\n } = useField<SerializedEditorState>({\n path,\n validate: memoizedValidate,\n })\n\n const disabled = readOnlyFromProps || formProcessing || formInitializing\n\n const classes = [\n baseClass,\n 'field-type',\n className,\n showError && 'error',\n disabled && `${baseClass}--read-only`,\n editorConfig?.admin?.hideGutter !== true ? `${baseClass}--show-gutter` : null,\n ]\n .filter(Boolean)\n .join(' ')\n\n const pathWithEditDepth = `${path}.${editDepth}`\n\n const handleChange = useCallback(\n (editorState: EditorState) => {\n setValue(editorState.toJSON())\n },\n [setValue],\n )\n\n const styles = useMemo(() => mergeFieldStyles(field), [field])\n\n return (\n <div className={classes} key={pathWithEditDepth} style={styles}>\n <RenderCustomComponent\n CustomComponent={Error}\n Fallback={<FieldError path={path} showError={showError} />}\n />\n {Label || <FieldLabel label={label} localized={localized} required={required} />}\n <div className={`${baseClass}__wrap`}>\n <ErrorBoundary fallbackRender={fallbackRender} onReset={() => {}}>\n {BeforeInput}\n <LexicalProvider\n composerKey={pathWithEditDepth}\n editorConfig={editorConfig}\n fieldProps={props}\n key={JSON.stringify({ initialValue, path })} // makes sure lexical is completely re-rendered when initialValue changes, bypassing the lexical-internal value memoization. That way, external changes to the form will update the editor. More infos in PR description (https://github.com/payloadcms/payload/pull/5010)\n onChange={handleChange}\n readOnly={disabled}\n value={value}\n />\n {AfterInput}\n </ErrorBoundary>\n {Description}\n <RenderCustomComponent\n CustomComponent={Description}\n Fallback={<FieldDescription description={description} path={path} />}\n />\n </div>\n </div>\n )\n}\n\nfunction fallbackRender({ error }: { error: Error }) {\n // Call resetErrorBoundary() to reset the error boundary and retry the render.\n\n return (\n <div className=\"errorBoundary\" role=\"alert\">\n <p>Something went wrong:</p>\n <pre style={{ color: 'red' }}>{error.message}</pre>\n </div>\n )\n}\n\nexport const RichText: typeof RichTextComponent = withCondition(RichTextComponent)\n"],"mappings":"AAAA;;;AAIA,SACEA,gBAAgB,EAChBC,UAAU,EACVC,UAAU,EACVC,qBAAqB,EACrBC,YAAY,EACZC,QAAQ,EACRC,aAAa,QACR;AACP,SAASC,gBAAgB,QAAQ;AACjC,OAAOC,KAAA,IAASC,WAAW,EAAEC,OAAO,QAAQ;AAC5C,SAASC,aAAa,QAAQ;AAM9B,OAAO;AAEP,SAASC,eAAe,QAAQ;AAEhC,MAAMC,SAAA,GAAY;AAElB,MAAMC,iBAAA,GAIDC,KAAA;EACH,MAAM;IACJC,YAAY;IACZC,KAAK;IACLA,KAAA,EAAO;MACLC,IAAI;MACJC,KAAA,EAAO;QAAEC,SAAS;QAAEC,WAAW;QAAEC,QAAA,EAAUC;MAAiB,CAAE,GAAG,CAAC,CAAC;MACnEC,KAAK;MACLC,SAAS;MACTC;IAAQ,CACT;IACDC,IAAA,EAAMC,aAAa;IACnBN,QAAA,EAAUO,yBAAyB;IACnCC;EAAQ,CACT,GAAGf,KAAA;EAEJ,MAAMgB,iBAAA,GAAoBF,yBAAA,IAA6BN,iBAAA;EACvD,MAAMI,IAAA,GAAOC,aAAA,IAAiBV,IAAA;EAE9B,MAAMc,SAAA,GAAY5B,YAAA;EAElB,MAAM6B,gBAAA,GAAmBxB,WAAA,C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sB,QAAA,eAAUF,IAAA,CAAC3D,UAAA;QAAW0B,IAAA,EAAMA,IAAA;QAAMmB,SAAA,EAAWA;;QAE9CL,KAAA,iBAASmB,IAAA,CAAC1D,UAAA;MAAWsB,KAAA,EAAOA,KAAA;MAAOC,SAAA,EAAWA,SAAA;MAAWC,QAAA,EAAUA;qBACpEgC,KAAA,CAAC;MAAItC,SAAA,EAAW,GAAGP,SAAA,QAAiB;8BAClC6C,KAAA,CAAC/C,aAAA;QAAcoD,cAAA,EAAgBA,cAAA;QAAgBC,OAAA,EAASA,CAAA,MAAO;mBAC5D1B,WAAA,E,aACDsB,IAAA,CAAChD,eAAA;UACCqD,WAAA,EAAaZ,iBAAA;UACbrC,YAAA,EAAcA,YAAA;UACdkD,UAAA,EAAYnD,KAAA;UAEZoD,QAAA,EAAUb,YAAA;UACVhC,QAAA,EAAUyB,QAAA;UACVb,KAAA,EAAOA;WAHFkC,IAAA,CAAKC,SAAS,CAAC;UAAEzB,YAAA;UAAcjB;QAAK,KAK1CU,UAAA;UAEFE,WAAA,E,aACDqB,IAAA,CAACzD,qBAAA;QACC0D,eAAA,EAAiBtB,WAAA;QACjBuB,QAAA,eAAUF,IAAA,CAAC5D,gBAAA;UAAiBqB,WAAA,EAAaA,WAAA;UAAaM,IAAA,EAAMA;;;;KAvBpC0B,iBAAA;AA4BlC;AAEA,SAASU,eAAe;EAAEO;AAAK,CAAoB;EACjD;EAEA,oBACEZ,KAAA,CAAC;IAAItC,SAAA,EAAU;IAAgBmD,IAAA,EAAK;4BAClCX,IAAA,CAAC;gBAAE;qBACHA,IAAA,CAAC;MAAID,KAAA,EAAO;QAAEa,KAAA,EAAO;MAAM;gBAAIF,KAAA,CAAMG;;;AAG3C;AAEA,OAAO,MAAMC,QAAA,GAAqCpE,aAAA,CAAcQ,iBAAA","ignoreList":[]}
1
+ {"version":3,"file":"Field.js","names":["FieldDescription","FieldError","FieldLabel","RenderCustomComponent","useEditDepth","useField","mergeFieldStyles","React","useCallback","useMemo","ErrorBoundary","LexicalProvider","baseClass","RichTextComponent","props","editorConfig","field","name","admin","className","description","readOnly","readOnlyFromAdmin","label","localized","required","path","pathFromProps","readOnlyFromTopLevelProps","validate","readOnlyFromProps","editDepth","memoizedValidate","value","validationOptions","customComponents","AfterInput","BeforeInput","Description","Error","Label","formInitializing","formProcessing","initialValue","setValue","showError","disabled","classes","hideGutter","filter","Boolean","join","pathWithEditDepth","handleChange","editorState","toJSON","styles","_jsxs","style","_jsx","CustomComponent","Fallback","fallbackRender","onReset","composerKey","fieldProps","onChange","JSON","stringify","error","role","color","message","RichText"],"sources":["../../src/field/Field.tsx"],"sourcesContent":["'use client'\nimport type { EditorState, SerializedEditorState } from 'lexical'\nimport type { Validate } from 'payload'\n\nimport {\n FieldDescription,\n FieldError,\n FieldLabel,\n RenderCustomComponent,\n useEditDepth,\n useField,\n} from '@payloadcms/ui'\nimport { mergeFieldStyles } from '@payloadcms/ui/shared'\nimport React, { useCallback, useMemo } from 'react'\nimport { ErrorBoundary } from 'react-error-boundary'\n\nimport type { SanitizedClientEditorConfig } from '../lexical/config/types.js'\nimport type { LexicalRichTextFieldProps } from '../types.js'\n\nimport '../lexical/theme/EditorTheme.scss'\nimport './bundled.css'\nimport './index.scss'\nimport { LexicalProvider } from '../lexical/LexicalProvider.js'\n\nconst baseClass = 'rich-text-lexical'\n\nconst RichTextComponent: React.FC<\n {\n readonly editorConfig: SanitizedClientEditorConfig // With rendered features n stuff\n } & LexicalRichTextFieldProps\n> = (props) => {\n const {\n editorConfig,\n field,\n field: {\n name,\n admin: { className, description, readOnly: readOnlyFromAdmin } = {},\n label,\n localized,\n required,\n },\n path: pathFromProps,\n readOnly: readOnlyFromTopLevelProps,\n validate, // Users can pass in client side validation if they WANT to, but it's not required anymore\n } = props\n\n const readOnlyFromProps = readOnlyFromTopLevelProps || readOnlyFromAdmin\n const path = pathFromProps ?? name\n\n const editDepth = useEditDepth()\n\n const memoizedValidate = useCallback<Validate>(\n (value, validationOptions) => {\n if (typeof validate === 'function') {\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n return validate(value, { ...validationOptions, required })\n }\n return true\n },\n // Important: do not add props to the dependencies array.\n // This would cause an infinite loop and endless re-rendering.\n // Removing props from the dependencies array fixed this issue: https://github.com/payloadcms/payload/issues/3709\n [validate, required],\n )\n\n const {\n customComponents: { AfterInput, BeforeInput, Description, Error, Label } = {},\n formInitializing,\n formProcessing,\n initialValue,\n setValue,\n showError,\n value,\n } = useField<SerializedEditorState>({\n path,\n validate: memoizedValidate,\n })\n\n const disabled = readOnlyFromProps || formProcessing || formInitializing\n\n const classes = [\n baseClass,\n 'field-type',\n className,\n showError && 'error',\n disabled && `${baseClass}--read-only`,\n editorConfig?.admin?.hideGutter !== true ? `${baseClass}--show-gutter` : null,\n ]\n .filter(Boolean)\n .join(' ')\n\n const pathWithEditDepth = `${path}.${editDepth}`\n\n const handleChange = useCallback(\n (editorState: EditorState) => {\n setValue(editorState.toJSON())\n },\n [setValue],\n )\n\n const styles = useMemo(() => mergeFieldStyles(field), [field])\n\n return (\n <div className={classes} key={pathWithEditDepth} style={styles}>\n <RenderCustomComponent\n CustomComponent={Error}\n Fallback={<FieldError path={path} showError={showError} />}\n />\n {Label || <FieldLabel label={label} localized={localized} required={required} />}\n <div className={`${baseClass}__wrap`}>\n <ErrorBoundary fallbackRender={fallbackRender} onReset={() => {}}>\n {BeforeInput}\n <LexicalProvider\n composerKey={pathWithEditDepth}\n editorConfig={editorConfig}\n fieldProps={props}\n key={JSON.stringify({ initialValue, path })} // makes sure lexical is completely re-rendered when initialValue changes, bypassing the lexical-internal value memoization. That way, external changes to the form will update the editor. More infos in PR description (https://github.com/payloadcms/payload/pull/5010)\n onChange={handleChange}\n readOnly={disabled}\n value={value}\n />\n {AfterInput}\n </ErrorBoundary>\n {Description}\n <RenderCustomComponent\n CustomComponent={Description}\n Fallback={<FieldDescription description={description} path={path} />}\n />\n </div>\n </div>\n )\n}\n\nfunction fallbackRender({ error }: { error: Error }) {\n // Call resetErrorBoundary() to reset the error boundary and retry the render.\n\n return (\n <div className=\"errorBoundary\" role=\"alert\">\n <p>Something went wrong:</p>\n <pre style={{ color: 'red' }}>{error.message}</pre>\n </div>\n )\n}\n\nexport const RichText: typeof RichTextComponent = RichTextComponent\n"],"mappings":"AAAA;;;AAIA,SACEA,gBAAgB,EAChBC,UAAU,EACVC,UAAU,EACVC,qBAAqB,EACrBC,YAAY,EACZC,QAAQ,QACH;AACP,SAASC,gBAAgB,QAAQ;AACjC,OAAOC,KAAA,IAASC,WAAW,EAAEC,OAAO,QAAQ;AAC5C,SAASC,aAAa,QAAQ;AAM9B,OAAO;AAEP,SAASC,eAAe,QAAQ;AAEhC,MAAMC,SAAA,GAAY;AAElB,MAAMC,iBAAA,GAIDC,KAAA;EACH,MAAM;IACJC,YAAY;IACZC,KAAK;IACLA,KAAA,EAAO;MACLC,IAAI;MACJC,KAAA,EAAO;QAAEC,SAAS;QAAEC,WAAW;QAAEC,QAAA,EAAUC;MAAiB,CAAE,GAAG,CAAC,CAAC;MACnEC,KAAK;MACLC,SAAS;MACTC;IAAQ,CACT;IACDC,IAAA,EAAMC,aAAa;IACnBN,QAAA,EAAUO,yBAAyB;IACnCC;EAAQ,CACT,GAAGf,KAAA;EAEJ,MAAMgB,iBAAA,GAAoBF,yBAAA,IAA6BN,iBAAA;EACvD,MAAMI,IAAA,GAAOC,aAAA,IAAiBV,IAAA;EAE9B,MAAMc,SAAA,GAAY3B,YAAA;EAElB,MAAM4B,gBAAA,GAAmBxB,WAAA,CACvB,CAACyB,KAAA,EAAOC,iBAAA;IACN,IAAI,OAAOL,QAAA,KAAa,YAAY;MAClC;MACA,OAAOA,QAAA,CAASI,KAAA,EAAO;QAAE,GAAGC,iBAAiB;QAAET;MAAS;IAC1D;IACA,OAAO;EACT;EACA;EACA;EACA;EACA,CAACI,QAAA,EAAUJ,QAAA,CAAS;EAGtB,MAAM;IACJU,gBAAA,EAAkB;MAAEC,UAAU;MAAEC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6C,KAAA,CAAC/C,aAAA;QAAcoD,cAAA,EAAgBA,cAAA;QAAgBC,OAAA,EAASA,CAAA,MAAO;mBAC5D1B,WAAA,E,aACDsB,IAAA,CAAChD,eAAA;UACCqD,WAAA,EAAaZ,iBAAA;UACbrC,YAAA,EAAcA,YAAA;UACdkD,UAAA,EAAYnD,KAAA;UAEZoD,QAAA,EAAUb,YAAA;UACVhC,QAAA,EAAUyB,QAAA;UACVb,KAAA,EAAOA;WAHFkC,IAAA,CAAKC,SAAS,CAAC;UAAEzB,YAAA;UAAcjB;QAAK,KAK1CU,UAAA;UAEFE,WAAA,E,aACDqB,IAAA,CAACxD,qBAAA;QACCyD,eAAA,EAAiBtB,WAAA;QACjBuB,QAAA,eAAUF,IAAA,CAAC3D,gBAAA;UAAiBoB,WAAA,EAAaA,WAAA;UAAaM,IAAA,EAAMA;;;;KAvBpC0B,iBAAA;AA4BlC;AAEA,SAASU,eAAe;EAAEO;AAAK,CAAoB;EACjD;EAEA,oBACEZ,KAAA,CAAC;IAAItC,SAAA,EAAU;IAAgBmD,IAAA,EAAK;4BAClCX,IAAA,CAAC;gBAAE;qBACHA,IAAA,CAAC;MAAID,KAAA,EAAO;QAAEa,KAAA,EAAO;MAAM;gBAAIF,KAAA,CAAMG;;;AAG3C;AAEA,OAAO,MAAMC,QAAA,GAAqC5D,iBAAA","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payloadcms/richtext-lexical",
3
- "version": "3.7.0",
3
+ "version": "3.7.1-canary.6b01088",
4
4
  "description": "The officially supported Lexical richtext adapter for Payload",
5
5
  "homepage": "https://payloadcms.com",
6
6
  "repository": {
@@ -351,8 +351,8 @@
351
351
  "react-error-boundary": "4.1.2",
352
352
  "ts-essentials": "10.0.3",
353
353
  "uuid": "10.0.0",
354
- "@payloadcms/translations": "3.7.0",
355
- "@payloadcms/ui": "3.7.0"
354
+ "@payloadcms/translations": "3.7.1-canary.6b01088",
355
+ "@payloadcms/ui": "3.7.1-canary.6b01088"
356
356
  },
357
357
  "devDependencies": {
358
358
  "@babel/cli": "7.25.9",
@@ -372,8 +372,8 @@
372
372
  "esbuild-sass-plugin": "3.3.1",
373
373
  "eslint-plugin-react-compiler": "19.0.0-beta-df7b47d-20241124",
374
374
  "swc-plugin-transform-remove-imports": "2.0.0",
375
- "@payloadcms/eslint-config": "3.0.0",
376
- "payload": "3.7.0"
375
+ "payload": "3.7.1-canary.6b01088",
376
+ "@payloadcms/eslint-config": "3.0.0"
377
377
  },
378
378
  "peerDependencies": {
379
379
  "@faceless-ui/modal": "3.0.0-beta.2",
@@ -391,8 +391,8 @@
391
391
  "lexical": "0.20.0",
392
392
  "react": "^19.0.0 || ^19.0.0-rc-65a56d0e-20241020",
393
393
  "react-dom": "^19.0.0 || ^19.0.0-rc-65a56d0e-20241020",
394
- "@payloadcms/next": "3.7.0",
395
- "payload": "3.7.0"
394
+ "@payloadcms/next": "3.7.1-canary.6b01088",
395
+ "payload": "3.7.1-canary.6b01088"
396
396
  },
397
397
  "engines": {
398
398
  "node": "^18.20.2 || >=20.9.0"
@@ -1,2 +0,0 @@
1
- "use client";import{c as fe,g as j,h as B,j as pe,k as ge,l as he,m as ye,n as xe}from"./chunk-XOABLBHB.js";import{a as de,b as R}from"./chunk-CUIBIFW2.js";import{jsx as F,jsxs as se}from"react/jsx-runtime";import{FieldDescription as eo,FieldError as to,FieldLabel as oo,RenderCustomComponent as Ze,useEditDepth as no,useField as ro,withCondition as io}from"@payloadcms/ui";import{mergeFieldStyles as so}from"@payloadcms/ui/shared";import{useCallback as et,useMemo as lo}from"react";import{ErrorBoundary as ao}from"react-error-boundary";import"./bundled.css";import{jsx as A}from"react/jsx-runtime";import{LexicalComposer as Xt}from"@lexical/react/LexicalComposer.js";import*as Je from"react";import{useMemo as Zt}from"react";import{c as $t}from"react/compiler-runtime";import{jsx as P,jsxs as q}from"react/jsx-runtime";import{useLexicalComposerContext as Ht}from"@lexical/react/LexicalComposerContext.js";import{LexicalErrorBoundary as jt}from"@lexical/react/LexicalErrorBoundary.js";import{HistoryPlugin as zt}from"@lexical/react/LexicalHistoryPlugin.js";import{OnChangePlugin as Kt}from"@lexical/react/LexicalOnChangePlugin.js";import{RichTextPlugin as Gt}from"@lexical/react/LexicalRichTextPlugin.js";import{BLUR_COMMAND as Wt,COMMAND_PRIORITY_LOW as Ye,FOCUS_COMMAND as Yt}from"lexical";import*as Y from"react";import{useEffect as Ue,useState as Ve}from"react";import{jsx as Ee}from"react/jsx-runtime";import"react";var O=({anchorElem:t,clientProps:e,plugin:o})=>o.position==="floatingAnchorElem"&&t?o.Component&&Ee(o.Component,{anchorElem:t,clientProps:e}):o.Component&&Ee(o.Component,{clientProps:e});import{jsx as ce}from"react/jsx-runtime";import{useLexicalComposerContext as st}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as lt}from"lexical";import*as we from"react";import{useCallback as at,useEffect as Ne,useRef as ct,useState as mt}from"react";import{createPortal as ut}from"react-dom";var z=(t,e,o,n,r=50,m=25)=>{let l=0;if(t&&!t.contains(n)){let{bottom:a,left:d,right:g,top:y}=t.getBoundingClientRect(),s=y+window.scrollY,i=a+window.scrollY;if(o<s-m||o>i+m||e<d-r||e>g+r)return-1;(e<d||e>g)&&(l=e<d?e-d:e-g)}return l};import{$getNodeByKey as Z}from"lexical";function K(t){let e=t.getBoundingClientRect(),o=getComputedStyle(t).getPropertyValue("transform");if(!o||o==="none")return e;let n=o.split(",").pop();return e.y=e.y-Number(n?.replace(")","")),e}function X(t){let e=(d,g)=>d?parseFloat(window.getComputedStyle(d)[g]):0,{marginBottom:o,marginTop:n}=window.getComputedStyle(t),r=e(t.previousElementSibling,"marginBottom"),m=e(t.nextElementSibling,"marginTop"),l=Math.max(parseFloat(n),r);return{marginBottom:Math.max(parseFloat(o),m),marginTop:l}}import{$getRoot as tt}from"lexical";function _(t){return t.getEditorState().read(()=>tt().getChildrenKeys())}var ot=1,nt=-1,be=0,v={props:null,result:null};function rt(t,e,o=20){let n=t.x-e.x,r=t.y-e.y;return n*n+r*r<=o*o}function G(t){let{anchorElem:e,cache_threshold:o=20,editor:n,fuzzy:r=!1,horizontalOffset:m=0,point:{x:l,y:a},startIndex:d=0,useEdgeAsDefault:g=!1}=t;if(o>0&&v.props&&v.result&&v.props.fuzzy===t.fuzzy&&v.props.horizontalOffset===t.horizontalOffset&&v.props.useEdgeAsDefault===t.useEdgeAsDefault&&rt(v.props.point,t.point,o))return v.result;let y=e.getBoundingClientRect(),s=_(n),i={blockElem:null,blockNode:null,distance:1/0,foundAtIndex:-1,isFoundNodeEmptyParagraph:!1};return n.getEditorState().read(()=>{if(g){let[p,h]=[n.getElementByKey(s[0]),n.getElementByKey(s[s.length-1])];if(p&&h){let[f,c]=[K(p),K(h)];if(a<f.top?(i.blockElem=p,i.distance=f.top-a,i.blockNode=Z(s[0]),i.foundAtIndex=0):a>c.bottom&&(i.distance=a-c.bottom,i.blockNode=Z(s[s.length-1]),i.blockElem=h,i.foundAtIndex=s.length-1),i?.blockElem)return{blockElem:null,isFoundNodeEmptyParagraph:!1}}}let u=d,x=be;for(;u>=0&&u<s.length;){let p=s[u],h=n.getElementByKey(p);if(h===null)break;let f=new B(l+m,a),c=ye.fromDOMRect(K(h)),{marginBottom:E,marginTop:b}=X(h),N=c.generateNewRect({bottom:c.bottom+E,left:y.left,right:y.right,top:c.top-b}),{distance:C,isOnBottomSide:k,isOnTopSide:w}=N.distanceFromPoint(f);if(C===0){i.blockElem=h,i.blockNode=Z(p),i.foundAtIndex=u,i.distance=C,i.blockNode&&i.blockNode.getType()==="paragraph"&&i.blockNode.getTextContent()===""&&(!r&&!t.returnEmptyParagraphs&&(i.blockElem=null,i.blockNode=null),i.isFoundNodeEmptyParagraph=!0);break}else r&&C<i.distance&&(i.blockElem=h,i.blockNode=Z(p),i.distance=C,i.foundAtIndex=u);x===be&&(w?x=nt:k?x=ot:x=1/0),u+=x}}),v.props=t,v.result={blockElem:i.blockElem,blockNode:i.blockNode,foundAtIndex:i.foundAtIndex,isFoundNodeEmptyParagraph:i.isFoundNodeEmptyParagraph},{blockElem:i.blockElem,blockNode:i.blockNode,foundAtIndex:i.foundAtIndex,isFoundNodeEmptyParagraph:i.isFoundNodeEmptyParagraph}}function ee(t,e){return!!t.closest(`.${e}`)}var it=["IMG","INPUT","TEXTAREA","SELECT","BUTTON","VIDEO","OBJECT","EMBED","IFRAME","HR"];function Ce(t){if(!t||it.includes(t.tagName)||t.offsetHeight===0||t.offsetWidth===0)return!1;let e=window.getComputedStyle(t);return!(e.display==="table-cell"||e.position==="absolute"||e.visibility==="hidden"||e.opacity==="0")}function te(t,e,o,n=0){if(!t){e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)";return}let r=t.getBoundingClientRect(),m=window.getComputedStyle(t),l=e.getBoundingClientRect(),a=o.getBoundingClientRect(),d;if(["lexical-block","lexical-upload","lexical-relationship"].some(s=>t.firstElementChild?.classList.contains(s)))d=r.top+8-a.top;else{let s=Ce(t)?parseInt(m.lineHeight,10):0;d=r.top+(s-l.height)/2-a.top}let y=n;e.style.opacity="1",e.style.transform=`translate(${y}px, ${d}px)`}var dt="add-block-menu",oe=1/0;function ft(t){return t===0?1/0:oe>=0&&oe<t?oe:Math.floor(t/2)}function pt(t,e,o){let n=e.parentElement,{editorConfig:r}=R(),m=r?.admin?.hideGutter?-24:12,l=ct(null),[a,d]=mt(null);Ne(()=>{function y(s){let i=s.target;if(!j(i))return;let u=z(n,s.pageX,s.pageY,i);if(u===-1){d(null);return}if(ee(i,dt))return;let x=_(t),{blockElem:p,blockNode:h,foundAtIndex:f}=G({anchorElem:e,cache_threshold:0,editor:t,horizontalOffset:-u,point:new B(s.x,s.y),returnEmptyParagraphs:!0,startIndex:ft(x.length),useEdgeAsDefault:!1});oe=f,p&&h&&(a?.node!==h||a?.elem!==p)&&d({elem:p,node:h})}return document?.addEventListener("mousemove",y),()=>{document?.removeEventListener("mousemove",y)}},[n,e,t,a]),Ne(()=>{l.current&&a?.node&&te(a?.elem,l.current,e,m)},[e,a,m]);let g=at(y=>{let s=a;s?.node&&(t.update(()=>{let i=!0;if((s?.node.getType()!=="paragraph"||s.node.getTextContent()!=="")&&(i=!1),!i){let u=lt();s?.node.insertAfter(u),setTimeout(()=>{s={elem:t.getElementByKey(u.getKey()),node:u},d(s)},0)}}),setTimeout(()=>{t.update(()=>{t.focus(),s?.node&&"select"in s.node&&typeof s.node.select=="function"&&s.node.select()})},1),setTimeout(()=>{t.dispatchCommand(ge,{node:s?.node})},2),y.stopPropagation(),y.preventDefault())},[t,a]);return ut(ce(we.Fragment,{children:ce("button",{"aria-label":"Add block",className:"icon add-block-menu",onClick:y=>{g(y)},ref:l,type:"button",children:ce("div",{className:o?"icon":""})})}),e)}function Pe(t){let{anchorElem:e}=t,o=e===void 0?document.body:e,[n]=st();return pt(n,o,n._editable)}import{jsx as ne,jsxs as ht}from"react/jsx-runtime";import{useLexicalComposerContext as yt}from"@lexical/react/LexicalComposerContext.js";import{eventFiles as ke}from"@lexical/rich-text";import{$getNearestNodeFromDOMNode as Se,$getNodeByKey as xt}from"lexical";import*as Ae from"react";import{useEffect as me,useRef as re,useState as ve}from"react";import{createPortal as Et}from"react-dom";var Te=0,gt=-24;var $=0;function Re(t,e,o,n,r,m,l,a,d,g=!1){let{height:y,top:s}=n.getBoundingClientRect(),{top:i,width:u}=l.getBoundingClientRect(),{marginBottom:x,marginTop:p}=X(n),h=s,f=m>=s+y/2+window.scrollY,c=!1;if(r?.elem)if(n!==r?.elem)(f&&r?.elem&&r?.elem===n.nextElementSibling||!f&&r?.elem&&r?.elem===n.previousElementSibling)&&($++,$<200&&(c=!0));else{$++;let C=r?.boundingBox?.y,k=n.getBoundingClientRect().y;(f===r?.isBelow&&C===k||$<200)&&(c=!1)}if(c)return{isBelow:f,willStayInSamePosition:c};g?h+=y/2:f?h+=y+x/2:h-=p/2;let E=0;g||(f?E=-Te:E=Te);let b=h-i+E,N=gt-e;return o.style.width=`calc(${u}px - ${t})`,o.style.opacity=".8",o.style.transform=`translate(${N}px, calc(${b}px - 2px))`,r?.elem&&(r.elem.style.opacity="",r?.elem===n?f?r.elem.style.marginTop="":r.elem.style.marginBottom="":(r.elem.style.marginBottom="",r.elem.style.marginTop="")),$=0,{isBelow:f,willStayInSamePosition:c}}var bt="draggable-block-menu",Me="application/x-lexical-drag-block",V=1/0;function Le(t){return t===0?1/0:V>=0&&V<t?V:Math.floor(t/2)}function Ct(t,e){let{transform:o}=e.style;t.setDragImage(e,0,0),setTimeout(()=>{e.style.transform=o})}function Be(t,e){t&&(t.style.opacity="0"),e&&(e.style.opacity="",e.style.marginBottom="",e.style.marginTop="")}function Nt(t,e,o){let n=e.parentElement,r=re(null),m=re(null),l=re(null),a=re(!1),[d,g]=ve(null),[y,s]=ve(null),{editorConfig:i}=R(),u=i?.admin?.hideGutter?-44:-8;me(()=>{function h(f){let c=f.target;if(!j(c))return;let E=z(n,f.pageX,f.pageY,c);if(E===-1){g(null);return}if(ee(c,bt))return;let b=_(t),{blockElem:N,foundAtIndex:C,isFoundNodeEmptyParagraph:k}=G({anchorElem:e,cache_threshold:0,editor:t,horizontalOffset:-E,point:new B(f.x,f.y),startIndex:Le(b.length),useEdgeAsDefault:!1,verbose:!1});V=C,!(!N&&!k)&&d!==N&&g(N)}return document?.addEventListener("mousemove",h),()=>{document?.removeEventListener("mousemove",h)}},[n,e,t,d]),me(()=>{r.current&&te(d,r.current,e,u)},[e,d,u]),me(()=>{function h(c){if(!a.current)return!1;let[E]=ke(c);if(E)return!1;let{pageY:b,target:N}=c;if(!j(N))return!1;let C=z(n,c.pageX,c.pageY,N,100,50),k=_(t),{blockElem:w,foundAtIndex:H,isFoundNodeEmptyParagraph:L}=G({anchorElem:e,editor:t,fuzzy:!0,horizontalOffset:-C,point:new B(c.x,c.y),startIndex:Le(k.length),useEdgeAsDefault:!0,verbose:!0});V=H;let I=m.current;if(w===null||I===null)return!1;if(d!==w){let{isBelow:S,willStayInSamePosition:U}=Re(i?.admin?.hideGutter?"0px":"3rem",u+(i?.admin?.hideGutter?r?.current?.getBoundingClientRect()?.width??0:-(r?.current?.getBoundingClientRect()?.width??0)),I,w,y,b,e,c,l,L);c.preventDefault(),U||s({boundingBox:w.getBoundingClientRect(),elem:w,isBelow:S})}else y?.elem&&(Be(I,y.elem),s({boundingBox:w.getBoundingClientRect(),elem:w,isBelow:!1}));return!0}function f(c){if(!a.current)return!1;let[E]=ke(c);if(E)return!1;let{dataTransfer:b,pageY:N,target:C}=c,k=b?.getData(Me)||"";return t.update(()=>{let w=xt(k);if(!w||!j(C))return!1;let H=z(n,c.pageX,c.pageY,C,100,50),{blockElem:L,isFoundNodeEmptyParagraph:I}=G({anchorElem:e,editor:t,fuzzy:!0,horizontalOffset:-H,point:new B(c.x,c.y),useEdgeAsDefault:!0});if(!L)return!1;let S=Se(L);if(!S)return!1;if(S===w)return!0;let{height:U,top:J}=K(L),le=N>=J+U/2+window.scrollY;I?(S.insertBefore(w),S.remove()):le?S.insertAfter(w):S.insertBefore(w),d!==null&&g(null),document.querySelectorAll(".lexical-block-highlighter").forEach(D=>{D.remove()});let ae=t.getElementByKey(w.getKey());setTimeout(()=>{let D=ae?.getBoundingClientRect();if(!D)return;let T=document.createElement("div");T.className="lexical-block-highlighter",T.style.backgroundColor="var(--theme-elevation-1000",T.style.transition="opacity 0.5s ease-in-out",T.style.zIndex="1",T.style.pointerEvents="none",T.style.boxSizing="border-box",T.style.borderRadius="4px",T.style.position="absolute",document.body.appendChild(T),T.style.opacity="0.1",T.style.height=`${D.height+8}px`,T.style.width=`${D.width+8}px`,T.style.top=`${D.top+window.scrollY-4}px`,T.style.left=`${D.left-4}px`,setTimeout(()=>{T.style.opacity="0",setTimeout(()=>{T.remove()},500)},1e3)},120)}),!0}return document.addEventListener("dragover",h),document.addEventListener("drop",f),()=>{document.removeEventListener("dragover",h),document.removeEventListener("drop",f)}},[n,u,e,t,y,d,i?.admin?.hideGutter]);function x(h){let f=h.dataTransfer;if(!f||!d)return;Ct(f,d);let c="";t.update(()=>{let E=Se(d);E&&(c=E.getKey())}),a.current=!0,f.setData(Me,c)}function p(){a.current=!1,y?.elem&&Be(m.current,y?.elem)}return Et(ht(Ae.Fragment,{children:[ne("div",{className:"icon draggable-block-menu",draggable:!0,onDragEnd:p,onDragStart:x,ref:r,children:ne("div",{className:o?"icon":""})}),ne("div",{className:"draggable-block-target-line",ref:m}),ne("div",{className:"debug-highlight",ref:l})]}),e)}function Fe(t){let{anchorElem:e}=t,o=e===void 0?document.body:e,[n]=yt();return Nt(n,o,n._editable)}import{c as wt}from"react/compiler-runtime";import{useLexicalComposerContext as Pt}from"@lexical/react/LexicalComposerContext";import*as Ie from"react";var De=()=>{let t=wt(4),{editorConfig:e}=R(),[o]=Pt(),n,r;return t[0]!==o||t[1]!==e.features.markdownTransformers?(n=()=>fe(o,e.features.markdownTransformers??[]),r=[o,e.features.markdownTransformers],t[0]=o,t[1]=e.features.markdownTransformers,t[2]=n,t[3]=r):(n=t[2],r=t[3]),Ie.useEffect(n,r),null};import{jsx as W,jsxs as _e}from"react/jsx-runtime";import{useLexicalComposerContext as Rt}from"@lexical/react/LexicalComposerContext.js";import{useTranslation as $e}from"@payloadcms/ui";import{useCallback as kt,useMemo as St,useState as vt}from"react";import"react";import*as He from"react-dom";import{c as Tt}from"react/compiler-runtime";import"react";function Oe(t,e){let o=Tt(4),{maxLength:n,minLength:r}=e,m=n===void 0?75:n,l=r===void 0?1:r,a;return o[0]!==m||o[1]!==l||o[2]!==t?(a=d=>{let{query:g}=d,y="[^"+t+pe+"\\s]",i=new RegExp("(^|\\s|\\()(["+t+"]((?:"+y+"){0,"+m+"}))$").exec(g);if(i!==null){let u=i[1],x=i[3];if(x.length>=l)return{leadOffset:i.index+u.length,matchingString:x,replaceableString:i[2]}}return null},o[0]=m,o[1]=l,o[2]=t,o[3]=a):a=o[3],a}var M="slash-menu-popup";function Mt({isSelected:t,item:e,onClick:o,onMouseEnter:n,ref:r}){let{fieldProps:{featureClientSchemaMap:m,schemaPath:l}}=R(),{i18n:a}=$e(),d=`${M}__item ${M}__item-${e.key}`;t&&(d+=` ${M}__item--selected`);let g=e.key;return e.label&&(g=typeof e.label=="function"?e.label({featureClientSchemaMap:m,i18n:a,schemaPath:l}):e.label),g.length>25&&(g=g.substring(0,25)+"..."),_e("button",{"aria-selected":t,className:d,id:M+"__item-"+e.key,onClick:o,onMouseEnter:n,ref:r,role:"option",tabIndex:-1,type:"button",children:[e?.Icon&&W(e.Icon,{}),W("span",{className:`${M}__item-text`,children:g})]},e.key)}function je({anchorElem:t=document.body}){let[e]=Rt(),[o,n]=vt(null),{editorConfig:r}=R(),{i18n:m}=$e(),{fieldProps:{featureClientSchemaMap:l,schemaPath:a}}=R(),d=Oe("/",{minLength:0}),g=kt(()=>{let s=[];for(let i of r.features.slashMenu.dynamicGroups)if(o){let u=i({editor:e,queryString:o});s=s.concat(u)}return s},[e,o,r?.features]),y=St(()=>{let s=[];for(let i of r?.features.slashMenu.groups??[])s.push(i);if(o){s=s.map(u=>{let x=u.items.filter(p=>{let h=p.key;return p.label&&(h=typeof p.label=="function"?p.label({featureClientSchemaMap:l,i18n:m,schemaPath:a}):p.label),new RegExp(o,"gi").exec(h)?!0:p.keywords!=null?p.keywords.some(f=>new RegExp(o,"gi").exec(f)):!1});return x.length?{...u,items:x}:null}),s=s.filter(u=>u!=null);let i=g();for(let u of i){let x=s.find(p=>p.key===u.key);x?s=s.filter(p=>p.key!==u.key):x={...u,items:[]},x?.items?.length&&(x.items=x.items.concat(x.items)),s.push(x)}}return s},[o,r?.features.slashMenu.groups,g,l,m,a]);return W(he,{anchorElem:t,groups:y,menuRenderFn:(s,{selectedItemKey:i,selectItemAndCleanUp:u,setSelectedItemKey:x})=>s.current&&y.length?He.createPortal(W("div",{className:M,children:y.map(p=>{let h=p.key;return p.label&&l&&(h=typeof p.label=="function"?p.label({featureClientSchemaMap:l,i18n:m,schemaPath:a}):p.label),_e("div",{className:`${M}__group ${M}__group-${p.key}`,children:[W("div",{className:`${M}__group-title`,children:h}),p.items.map((f,c)=>W(Mt,{index:c,isSelected:i===f.key,item:f,onClick:()=>{x(f.key),u(f)},onMouseEnter:()=>{x(f.key)},ref:E=>{f.ref={current:E}}},f.key))]},p.key)})}),s.current):null,onQueryChange:n,triggerFn:d})}import{c as Lt}from"react/compiler-runtime";import{useLexicalComposerContext as Bt}from"@lexical/react/LexicalComposerContext";import{TEXT_TYPE_TO_FORMAT as ze,TextNode as At}from"lexical";import{useEffect as Ft}from"react";function Ke(t){let e=Lt(6),{features:o}=t,[n]=Bt(),r;e[0]!==n||e[1]!==o.enabledFormats?(r=()=>{let l=It(o.enabledFormats);if(l.length!==0)return n.registerNodeTransform(At,a=>{l.forEach(d=>{a.hasFormat(d)&&a.toggleFormat(d)})})},e[0]=n,e[1]=o.enabledFormats,e[2]=r):r=e[2];let m;return e[3]!==n||e[4]!==o?(m=[n,o],e[3]=n,e[4]=o,e[5]=m):m=e[5],Ft(r,m),null}function It(t){delete ze.highlight;let e=Object.keys(ze),o=new Set(t);return e.filter(n=>!o.has(n))}import{c as Dt}from"react/compiler-runtime";import{jsx as Ge}from"react/jsx-runtime";import{ContentEditable as Ot}from"@lexical/react/LexicalContentEditable.js";import{useTranslation as _t}from"@payloadcms/ui";import"react";function We(t){let e=Dt(3),{className:o}=t,{t:n}=_t(),r;return e[0]!==o||e[1]!==n?(r=Ge(Ot,{"aria-placeholder":n("lexical:general:placeholder"),className:o??"ContentEditable__root",placeholder:Ge("p",{className:"editor-placeholder",children:n("lexical:general:placeholder")})}),e[0]=o,e[1]=n,e[2]=r):r=e[2],r}var qe=t=>{let e=$t(22),{editorConfig:o,editorContainerRef:n,onChange:r}=t,m=R(),[l]=Ht(),[a,d]=Ve(null),g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g=c=>{c!==null&&d(c)},e[0]=g):g=e[0];let y=g,s,i;e[1]!==l||e[2]!==m?(s=()=>{if(!m?.uuid){console.error("Lexical Editor must be used within an EditorConfigProvider");return}m?.parentEditor?.uuid&&m.parentEditor?.registerChild(m.uuid,m);let c=()=>{m.focusEditor(m)},E=()=>{m.blurEditor(m)},b=l.registerCommand(Yt,()=>(c(),!0),Ye),N=l.registerCommand(Wt,()=>(E(),!0),Ye);return()=>{b(),N(),m.parentEditor?.unregisterChild?.(m.uuid)}},i=[l,m],e[1]=l,e[2]=m,e[3]=s,e[4]=i):(s=e[3],i=e[4]),Ue(s,i);let[u,x]=Ve(!1),p,h;e[5]!==u?(p=()=>{let c=()=>{let E=window.matchMedia("(max-width: 768px)").matches;E!==u&&x(E)};return c(),window.addEventListener("resize",c),()=>{window.removeEventListener("resize",c)}},h=[u],e[5]=u,e[6]=p,e[7]=h):(p=e[6],h=e[7]),Ue(p,h);let f;if(e[8]!==l||e[9]!==o.features||e[10]!==n||e[11]!==a||e[12]!==u||e[13]!==r){let c;e[15]!==r?(c=(b,N,C)=>{(!C.has("focus")||C.size>1)&&r?.(b,N,C)},e[15]=r,e[16]=c):c=e[16];let E;e[17]!==l||e[18]!==o.features.plugins||e[19]!==a||e[20]!==u?(E=a&&q(Y.Fragment,{children:[!u&&l.isEditable()&&q(Y.Fragment,{children:[P(Fe,{anchorElem:a}),P(Pe,{anchorElem:a})]}),o.features.plugins?.map(b=>{if(b.position==="floatingAnchorElem"&&!(b.desktopOnly===!0&&u))return P(O,{anchorElem:a,clientProps:b.clientProps,plugin:b},b.key)}),l.isEditable()&&P(Y.Fragment,{children:P(je,{anchorElem:a})})]}),e[17]=l,e[18]=o.features.plugins,e[19]=a,e[20]=u,e[21]=E):E=e[21],f=q(Y.Fragment,{children:[o.features.plugins?.map(Ut),q("div",{className:"editor-container",ref:n,children:[o.features.plugins?.map(Vt),P(Gt,{contentEditable:P("div",{className:"editor-scroller",children:P("div",{className:"editor",ref:y,tabIndex:-1,children:P(We,{})})}),ErrorBoundary:jt}),P(Ke,{features:o.features}),P(Kt,{ignoreSelectionChange:!0,onChange:c}),E,l.isEditable()&&q(Y.Fragment,{children:[P(zt,{}),o?.features?.markdownTransformers?.length>0&&P(De,{})]}),o.features.plugins?.map(qt),o.features.plugins?.map(Jt)]}),o.features.plugins?.map(Qt)]}),e[8]=l,e[9]=o.features,e[10]=n,e[11]=a,e[12]=u,e[13]=r,e[14]=f}else f=e[14];return f};function Ut(t){if(t.position==="aboveContainer")return P(O,{clientProps:t.clientProps,plugin:t},t.key)}function Vt(t){if(t.position==="top")return P(O,{clientProps:t.clientProps,plugin:t},t.key)}function qt(t){if(t.position==="normal")return P(O,{clientProps:t.clientProps,plugin:t},t.key)}function Jt(t){if(t.position==="bottom")return P(O,{clientProps:t.clientProps,plugin:t},t.key)}function Qt(t){if(t.position==="belowContainer")return P(O,{clientProps:t.clientProps,plugin:t},t.key)}var Qe=({children:t,providers:e})=>{if(!e?.length)return t;let o=e[0];return e.length>1?A(o,{children:A(Qe,{providers:e.slice(1),children:t})}):A(o,{children:t})},Xe=t=>{let{composerKey:e,editorConfig:o,fieldProps:n,onChange:r,readOnly:m,value:l}=t,a=R(),d=Je.useRef(null),g=Zt(()=>{if(l&&typeof l!="object")throw new Error("The value passed to the Lexical editor is not an object. This is not supported. Please remove the data from the field and start again. This is the value that was passed in: "+JSON.stringify(l));if(l&&Array.isArray(l)&&!("root"in l))throw new Error("You have tried to pass in data from the old Slate editor to the new Lexical editor. The data structure is different, thus you will have to migrate your data. We offer a one-line migration script which migrates all your rich text fields: https://payloadcms.com/docs/lexical/migration#migration-via-migration-script-recommended");if(l&&"jsonContent"in l)throw new Error("You have tried to pass in data from payload-plugin-lexical. The data structure is different, thus you will have to migrate your data. Migration guide: https://payloadcms.com/docs/lexical/migration#migrating-from-payload-plugin-lexical");return{editable:m!==!0,editorState:l!=null?JSON.stringify(l):void 0,namespace:o.lexical.namespace,nodes:xe({editorConfig:o}),onError:y=>{throw y},theme:o.lexical.theme}},[o]);return g?A(Xt,{initialConfig:g,children:A(de,{editorConfig:o,editorContainerRef:d,fieldProps:n,parentContext:a,children:A(Qe,{providers:o.features.providers,children:A(qe,{editorConfig:o,editorContainerRef:d,onChange:r})})})},e+g.editable):A("p",{children:"Loading..."})};var ie="rich-text-lexical",co=t=>{let{editorConfig:e,field:o,field:{name:n,admin:{className:r,description:m,readOnly:l}={},label:a,localized:d,required:g},path:y,readOnly:s,validate:i}=t,u=s||l,x=y??n,p=no(),h=et((Q,ae)=>typeof i=="function"?i(Q,{...ae,required:g}):!0,[i,g]),{customComponents:{AfterInput:f,BeforeInput:c,Description:E,Error:b,Label:N}={},formInitializing:C,formProcessing:k,initialValue:w,setValue:H,showError:L,value:I}=ro({path:x,validate:h}),S=u||k||C,U=[ie,"field-type",r,L&&"error",S&&`${ie}--read-only`,e?.admin?.hideGutter!==!0?`${ie}--show-gutter`:null].filter(Boolean).join(" "),J=`${x}.${p}`,ue=et(Q=>{H(Q.toJSON())},[H]),le=lo(()=>so(o),[o]);return se("div",{className:U,style:le,children:[F(Ze,{CustomComponent:b,Fallback:F(to,{path:x,showError:L})}),N||F(oo,{label:a,localized:d,required:g}),se("div",{className:`${ie}__wrap`,children:[se(ao,{fallbackRender:mo,onReset:()=>{},children:[c,F(Xe,{composerKey:J,editorConfig:e,fieldProps:t,onChange:ue,readOnly:S,value:I},JSON.stringify({initialValue:w,path:x})),f]}),E,F(Ze,{CustomComponent:E,Fallback:F(eo,{description:m,path:x})})]})]},J)};function mo({error:t}){return se("div",{className:"errorBoundary",role:"alert",children:[F("p",{children:"Something went wrong:"}),F("pre",{style:{color:"red"},children:t.message})]})}var Nr=io(co);export{Nr as RichText};
2
- //# sourceMappingURL=Field-FMNFWV4P.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/field/Field.tsx", "../../../src/lexical/LexicalProvider.tsx", "../../../src/lexical/LexicalEditor.tsx", "../../../src/lexical/EditorPlugin.tsx", "../../../src/lexical/plugins/handles/AddBlockHandlePlugin/index.tsx", "../../../src/lexical/plugins/handles/utils/calculateDistanceFromScrollerElem.ts", "../../../src/lexical/plugins/handles/utils/getNodeCloseToPoint.ts", "../../../src/lexical/plugins/handles/DraggableBlockPlugin/getBoundingRectWithoutTransform.ts", "../../../src/lexical/plugins/handles/utils/getCollapsedMargins.ts", "../../../src/lexical/plugins/handles/utils/getTopLevelNodeKeys.ts", "../../../src/lexical/plugins/handles/utils/isOnHandleElement.ts", "../../../src/lexical/plugins/handles/utils/doesLineHeightAffectElement.ts", "../../../src/lexical/plugins/handles/utils/setHandlePosition.ts", "../../../src/lexical/plugins/handles/DraggableBlockPlugin/index.tsx", "../../../src/lexical/plugins/handles/DraggableBlockPlugin/setTargetLine.ts", "../../../src/lexical/plugins/MarkdownShortcut/index.tsx", "../../../src/lexical/plugins/SlashMenu/index.tsx", "../../../src/lexical/plugins/SlashMenu/useMenuTriggerMatch.ts", "../../../src/lexical/plugins/TextPlugin/index.tsx", "../../../src/lexical/ui/ContentEditable.tsx"],
4
- "sourcesContent": ["'use client'\nimport type { EditorState, SerializedEditorState } from 'lexical'\nimport type { Validate } from 'payload'\n\nimport {\n FieldDescription,\n FieldError,\n FieldLabel,\n RenderCustomComponent,\n useEditDepth,\n useField,\n withCondition,\n} from '@payloadcms/ui'\nimport { mergeFieldStyles } from '@payloadcms/ui/shared'\nimport React, { useCallback, useMemo } from 'react'\nimport { ErrorBoundary } from 'react-error-boundary'\n\nimport type { SanitizedClientEditorConfig } from '../lexical/config/types.js'\nimport type { LexicalRichTextFieldProps } from '../types.js'\n\nimport '../lexical/theme/EditorTheme.scss'\nimport './bundled.css'\nimport './index.scss'\nimport { LexicalProvider } from '../lexical/LexicalProvider.js'\n\nconst baseClass = 'rich-text-lexical'\n\nconst RichTextComponent: React.FC<\n {\n readonly editorConfig: SanitizedClientEditorConfig // With rendered features n stuff\n } & LexicalRichTextFieldProps\n> = (props) => {\n const {\n editorConfig,\n field,\n field: {\n name,\n admin: { className, description, readOnly: readOnlyFromAdmin } = {},\n label,\n localized,\n required,\n },\n path: pathFromProps,\n readOnly: readOnlyFromTopLevelProps,\n validate, // Users can pass in client side validation if they WANT to, but it's not required anymore\n } = props\n\n const readOnlyFromProps = readOnlyFromTopLevelProps || readOnlyFromAdmin\n const path = pathFromProps ?? name\n\n const editDepth = useEditDepth()\n\n const memoizedValidate = useCallback<Validate>(\n (value, validationOptions) => {\n if (typeof validate === 'function') {\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n return validate(value, { ...validationOptions, required })\n }\n return true\n },\n // Important: do not add props to the dependencies array.\n // This would cause an infinite loop and endless re-rendering.\n // Removing props from the dependencies array fixed this issue: https://github.com/payloadcms/payload/issues/3709\n [validate, required],\n )\n\n const {\n customComponents: { AfterInput, BeforeInput, Description, Error, Label } = {},\n formInitializing,\n formProcessing,\n initialValue,\n setValue,\n showError,\n value,\n } = useField<SerializedEditorState>({\n path,\n validate: memoizedValidate,\n })\n\n const disabled = readOnlyFromProps || formProcessing || formInitializing\n\n const classes = [\n baseClass,\n 'field-type',\n className,\n showError && 'error',\n disabled && `${baseClass}--read-only`,\n editorConfig?.admin?.hideGutter !== true ? `${baseClass}--show-gutter` : null,\n ]\n .filter(Boolean)\n .join(' ')\n\n const pathWithEditDepth = `${path}.${editDepth}`\n\n const handleChange = useCallback(\n (editorState: EditorState) => {\n setValue(editorState.toJSON())\n },\n [setValue],\n )\n\n const styles = useMemo(() => mergeFieldStyles(field), [field])\n\n return (\n <div className={classes} key={pathWithEditDepth} style={styles}>\n <RenderCustomComponent\n CustomComponent={Error}\n Fallback={<FieldError path={path} showError={showError} />}\n />\n {Label || <FieldLabel label={label} localized={localized} required={required} />}\n <div className={`${baseClass}__wrap`}>\n <ErrorBoundary fallbackRender={fallbackRender} onReset={() => {}}>\n {BeforeInput}\n <LexicalProvider\n composerKey={pathWithEditDepth}\n editorConfig={editorConfig}\n fieldProps={props}\n key={JSON.stringify({ initialValue, path })} // makes sure lexical is completely re-rendered when initialValue changes, bypassing the lexical-internal value memoization. That way, external changes to the form will update the editor. More infos in PR description (https://github.com/payloadcms/payload/pull/5010)\n onChange={handleChange}\n readOnly={disabled}\n value={value}\n />\n {AfterInput}\n </ErrorBoundary>\n {Description}\n <RenderCustomComponent\n CustomComponent={Description}\n Fallback={<FieldDescription description={description} path={path} />}\n />\n </div>\n </div>\n )\n}\n\nfunction fallbackRender({ error }: { error: Error }) {\n // Call resetErrorBoundary() to reset the error boundary and retry the render.\n\n return (\n <div className=\"errorBoundary\" role=\"alert\">\n <p>Something went wrong:</p>\n <pre style={{ color: 'red' }}>{error.message}</pre>\n </div>\n )\n}\n\nexport const RichText: typeof RichTextComponent = withCondition(RichTextComponent)\n", "'use client'\nimport type { InitialConfigType } from '@lexical/react/LexicalComposer.js'\nimport type { EditorState, LexicalEditor, SerializedEditorState } from 'lexical'\nimport type { ClientField } from 'payload'\n\nimport { LexicalComposer } from '@lexical/react/LexicalComposer.js'\nimport * as React from 'react'\nimport { useMemo } from 'react'\n\nimport type { LexicalRichTextFieldProps } from '../types.js'\nimport type { SanitizedClientEditorConfig } from './config/types.js'\n\nimport {\n EditorConfigProvider,\n useEditorConfigContext,\n} from './config/client/EditorConfigProvider.js'\nimport { LexicalEditor as LexicalEditorComponent } from './LexicalEditor.js'\nimport { getEnabledNodes } from './nodes/index.js'\n\nexport type LexicalProviderProps = {\n composerKey: string\n editorConfig: SanitizedClientEditorConfig\n fieldProps: LexicalRichTextFieldProps\n onChange: (editorState: EditorState, editor: LexicalEditor, tags: Set<string>) => void\n readOnly: boolean\n value: SerializedEditorState\n}\n\nconst NestProviders = ({\n children,\n providers,\n}: {\n children: React.ReactNode\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n providers: any[]\n}) => {\n if (!providers?.length) {\n return children\n }\n const Component = providers[0]\n if (providers.length > 1) {\n return (\n <Component>\n <NestProviders providers={providers.slice(1)}>{children}</NestProviders>\n </Component>\n )\n }\n return <Component>{children}</Component>\n}\n\nexport const LexicalProvider: React.FC<LexicalProviderProps> = (props) => {\n const { composerKey, editorConfig, fieldProps, onChange, readOnly, value } = props\n\n const parentContext = useEditorConfigContext()\n\n const editorContainerRef = React.useRef<HTMLDivElement>(null)\n\n // useMemo for the initialConfig that depends on readOnly and value\n const initialConfig = useMemo<InitialConfigType>(() => {\n if (value && typeof value !== 'object') {\n throw new Error(\n 'The value passed to the Lexical editor is not an object. This is not supported. Please remove the data from the field and start again. This is the value that was passed in: ' +\n JSON.stringify(value),\n )\n }\n\n if (value && Array.isArray(value) && !('root' in value)) {\n throw new Error(\n 'You have tried to pass in data from the old Slate editor to the new Lexical editor. The data structure is different, thus you will have to migrate your data. We offer a one-line migration script which migrates all your rich text fields: https://payloadcms.com/docs/lexical/migration#migration-via-migration-script-recommended',\n )\n }\n\n if (value && 'jsonContent' in value) {\n throw new Error(\n 'You have tried to pass in data from payload-plugin-lexical. The data structure is different, thus you will have to migrate your data. Migration guide: https://payloadcms.com/docs/lexical/migration#migrating-from-payload-plugin-lexical',\n )\n }\n\n return {\n editable: readOnly !== true,\n editorState: value != null ? JSON.stringify(value) : undefined,\n namespace: editorConfig.lexical.namespace,\n nodes: getEnabledNodes({ editorConfig }),\n onError: (error: Error) => {\n throw error\n },\n theme: editorConfig.lexical.theme,\n }\n // Important: do not add readOnly and value to the dependencies array. This will cause the entire lexical editor to re-render if the document is saved, which will\n // cause the editor to lose focus.\n }, [editorConfig])\n\n if (!initialConfig) {\n return <p>Loading...</p>\n }\n\n // We need to add initialConfig.editable to the key to force a re-render when the readOnly prop changes.\n // Without it, there were cases where lexical editors inside drawers turn readOnly initially - a few miliseconds later they turn editable, but the editor does not re-render and stays readOnly.\n return (\n <LexicalComposer initialConfig={initialConfig} key={composerKey + initialConfig.editable}>\n <EditorConfigProvider\n editorConfig={editorConfig}\n editorContainerRef={editorContainerRef}\n fieldProps={fieldProps}\n parentContext={parentContext}\n >\n <NestProviders providers={editorConfig.features.providers}>\n <LexicalEditorComponent\n editorConfig={editorConfig}\n editorContainerRef={editorContainerRef}\n onChange={onChange}\n />\n </NestProviders>\n </EditorConfigProvider>\n </LexicalComposer>\n )\n}\n", "'use client'\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { LexicalErrorBoundary } from '@lexical/react/LexicalErrorBoundary.js'\nimport { HistoryPlugin } from '@lexical/react/LexicalHistoryPlugin.js'\nimport { OnChangePlugin } from '@lexical/react/LexicalOnChangePlugin.js'\nimport { RichTextPlugin } from '@lexical/react/LexicalRichTextPlugin.js'\nimport { BLUR_COMMAND, COMMAND_PRIORITY_LOW, FOCUS_COMMAND } from 'lexical'\nimport * as React from 'react'\nimport { useEffect, useState } from 'react'\n\nimport type { LexicalProviderProps } from './LexicalProvider.js'\n\nimport { useEditorConfigContext } from './config/client/EditorConfigProvider.js'\nimport { EditorPlugin } from './EditorPlugin.js'\nimport './LexicalEditor.scss'\nimport { AddBlockHandlePlugin } from './plugins/handles/AddBlockHandlePlugin/index.js'\nimport { DraggableBlockPlugin } from './plugins/handles/DraggableBlockPlugin/index.js'\nimport { MarkdownShortcutPlugin } from './plugins/MarkdownShortcut/index.js'\nimport { SlashMenuPlugin } from './plugins/SlashMenu/index.js'\nimport { TextPlugin } from './plugins/TextPlugin/index.js'\nimport { LexicalContentEditable } from './ui/ContentEditable.js'\n\nexport const LexicalEditor: React.FC<\n {\n editorContainerRef: React.RefObject<HTMLDivElement | null>\n } & Pick<LexicalProviderProps, 'editorConfig' | 'onChange'>\n> = (props) => {\n const { editorConfig, editorContainerRef, onChange } = props\n const editorConfigContext = useEditorConfigContext()\n const [editor] = useLexicalComposerContext()\n\n const [floatingAnchorElem, setFloatingAnchorElem] = useState<HTMLDivElement | null>(null)\n const onRef = (_floatingAnchorElem: HTMLDivElement) => {\n if (_floatingAnchorElem !== null) {\n setFloatingAnchorElem(_floatingAnchorElem)\n }\n }\n\n useEffect(() => {\n if (!editorConfigContext?.uuid) {\n console.error('Lexical Editor must be used within an EditorConfigProvider')\n return\n }\n if (editorConfigContext?.parentEditor?.uuid) {\n editorConfigContext.parentEditor?.registerChild(editorConfigContext.uuid, editorConfigContext)\n }\n\n const handleFocus = () => {\n editorConfigContext.focusEditor(editorConfigContext)\n }\n\n const handleBlur = () => {\n editorConfigContext.blurEditor(editorConfigContext)\n }\n\n const unregisterFocus = editor.registerCommand<MouseEvent>(\n FOCUS_COMMAND,\n () => {\n handleFocus()\n return true\n },\n COMMAND_PRIORITY_LOW,\n )\n\n const unregisterBlur = editor.registerCommand<MouseEvent>(\n BLUR_COMMAND,\n () => {\n handleBlur()\n return true\n },\n COMMAND_PRIORITY_LOW,\n )\n\n return () => {\n unregisterFocus()\n unregisterBlur()\n editorConfigContext.parentEditor?.unregisterChild?.(editorConfigContext.uuid)\n }\n }, [editor, editorConfigContext])\n\n const [isSmallWidthViewport, setIsSmallWidthViewport] = useState<boolean>(false)\n\n useEffect(() => {\n const updateViewPortWidth = () => {\n const isNextSmallWidthViewport = window.matchMedia('(max-width: 768px)').matches\n\n if (isNextSmallWidthViewport !== isSmallWidthViewport) {\n setIsSmallWidthViewport(isNextSmallWidthViewport)\n }\n }\n updateViewPortWidth()\n window.addEventListener('resize', updateViewPortWidth)\n\n return () => {\n window.removeEventListener('resize', updateViewPortWidth)\n }\n }, [isSmallWidthViewport])\n\n return (\n <React.Fragment>\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'aboveContainer') {\n return <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n }\n })}\n <div className=\"editor-container\" ref={editorContainerRef}>\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'top') {\n return (\n <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n )\n }\n })}\n <RichTextPlugin\n contentEditable={\n <div className=\"editor-scroller\">\n <div className=\"editor\" ref={onRef} tabIndex={-1}>\n <LexicalContentEditable />\n </div>\n </div>\n }\n ErrorBoundary={LexicalErrorBoundary}\n />\n <TextPlugin features={editorConfig.features} />\n <OnChangePlugin\n // Selection changes can be ignored here, reducing the\n // frequency that the FieldComponent and Payload receive updates.\n // Selection changes are only needed if you are saving selection state\n ignoreSelectionChange\n onChange={(editorState, editor, tags) => {\n // Ignore any onChange event triggered by focus only\n if (!tags.has('focus') || tags.size > 1) {\n if (onChange != null) {\n onChange(editorState, editor, tags)\n }\n }\n }}\n />\n {floatingAnchorElem && (\n <React.Fragment>\n {!isSmallWidthViewport && editor.isEditable() && (\n <React.Fragment>\n <DraggableBlockPlugin anchorElem={floatingAnchorElem} />\n <AddBlockHandlePlugin anchorElem={floatingAnchorElem} />\n </React.Fragment>\n )}\n {editorConfig.features.plugins?.map((plugin) => {\n if (\n plugin.position === 'floatingAnchorElem' &&\n !(plugin.desktopOnly === true && isSmallWidthViewport)\n ) {\n return (\n <EditorPlugin\n anchorElem={floatingAnchorElem}\n clientProps={plugin.clientProps}\n key={plugin.key}\n plugin={plugin}\n />\n )\n }\n })}\n {editor.isEditable() && (\n <React.Fragment>\n <SlashMenuPlugin anchorElem={floatingAnchorElem} />\n </React.Fragment>\n )}\n </React.Fragment>\n )}\n {editor.isEditable() && (\n <React.Fragment>\n <HistoryPlugin />\n {editorConfig?.features?.markdownTransformers?.length > 0 && <MarkdownShortcutPlugin />}\n </React.Fragment>\n )}\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'normal') {\n return (\n <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n )\n }\n })}\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'bottom') {\n return (\n <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n )\n }\n })}\n </div>\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'belowContainer') {\n return <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n }\n })}\n </React.Fragment>\n )\n}\n", "'use client'\nimport React from 'react'\n\nimport type { SanitizedPlugin } from '../features/typesClient.js'\n\nexport const EditorPlugin: React.FC<{\n anchorElem?: HTMLDivElement\n clientProps: unknown\n plugin: SanitizedPlugin\n}> = ({ anchorElem, clientProps, plugin }) => {\n if (plugin.position === 'floatingAnchorElem' && anchorElem) {\n return (\n plugin.Component && <plugin.Component anchorElem={anchorElem} clientProps={clientProps} />\n )\n }\n\n // @ts-expect-error - ts is not able to infer that plugin.Component is of type PluginComponent\n return plugin.Component && <plugin.Component clientProps={clientProps} />\n}\n", "'use client'\nimport type { LexicalEditor, LexicalNode, ParagraphNode } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { $createParagraphNode } from 'lexical'\nimport * as React from 'react'\nimport { useCallback, useEffect, useRef, useState } from 'react'\nimport { createPortal } from 'react-dom'\n\nimport { useEditorConfigContext } from '../../../config/client/EditorConfigProvider.js'\nimport { isHTMLElement } from '../../../utils/guard.js'\nimport { Point } from '../../../utils/point.js'\nimport { ENABLE_SLASH_MENU_COMMAND } from '../../SlashMenu/LexicalTypeaheadMenuPlugin/index.js'\nimport { calculateDistanceFromScrollerElem } from '../utils/calculateDistanceFromScrollerElem.js'\nimport { getNodeCloseToPoint } from '../utils/getNodeCloseToPoint.js'\nimport { getTopLevelNodeKeys } from '../utils/getTopLevelNodeKeys.js'\nimport { isOnHandleElement } from '../utils/isOnHandleElement.js'\nimport { setHandlePosition } from '../utils/setHandlePosition.js'\nimport './index.scss'\n\nconst ADD_BLOCK_MENU_CLASSNAME = 'add-block-menu'\n\nlet prevIndex = Infinity\n\nfunction getCurrentIndex(keysLength: number): number {\n if (keysLength === 0) {\n return Infinity\n }\n if (prevIndex >= 0 && prevIndex < keysLength) {\n return prevIndex\n }\n\n return Math.floor(keysLength / 2)\n}\n\nfunction useAddBlockHandle(\n editor: LexicalEditor,\n anchorElem: HTMLElement,\n isEditable: boolean,\n): React.ReactElement {\n const scrollerElem = anchorElem.parentElement\n\n const { editorConfig } = useEditorConfigContext()\n const blockHandleHorizontalOffset = editorConfig?.admin?.hideGutter ? -24 : 12\n\n const menuRef = useRef<HTMLButtonElement>(null)\n const [hoveredElement, setHoveredElement] = useState<{\n elem: HTMLElement\n node: LexicalNode\n } | null>(null)\n\n useEffect(() => {\n function onDocumentMouseMove(event: MouseEvent) {\n const target = event.target\n if (!isHTMLElement(target)) {\n return\n }\n\n const distanceFromScrollerElem = calculateDistanceFromScrollerElem(\n scrollerElem,\n event.pageX,\n event.pageY,\n target,\n )\n\n if (distanceFromScrollerElem === -1) {\n setHoveredElement(null)\n return\n }\n\n if (isOnHandleElement(target, ADD_BLOCK_MENU_CLASSNAME)) {\n return\n }\n const topLevelNodeKeys = getTopLevelNodeKeys(editor)\n\n const {\n blockElem: _emptyBlockElem,\n blockNode,\n foundAtIndex,\n } = getNodeCloseToPoint({\n anchorElem,\n cache_threshold: 0,\n editor,\n horizontalOffset: -distanceFromScrollerElem,\n point: new Point(event.x, event.y),\n returnEmptyParagraphs: true,\n startIndex: getCurrentIndex(topLevelNodeKeys.length),\n useEdgeAsDefault: false,\n })\n\n prevIndex = foundAtIndex\n\n if (!_emptyBlockElem) {\n return\n }\n if (\n blockNode &&\n (hoveredElement?.node !== blockNode || hoveredElement?.elem !== _emptyBlockElem)\n ) {\n setHoveredElement({\n elem: _emptyBlockElem,\n node: blockNode,\n })\n }\n }\n\n // Since the draggableBlockElem is outside the actual editor, we need to listen to the document\n // to be able to detect when the mouse is outside the editor and respect a buffer around\n // the scrollerElem to avoid the draggableBlockElem disappearing too early.\n document?.addEventListener('mousemove', onDocumentMouseMove)\n\n return () => {\n document?.removeEventListener('mousemove', onDocumentMouseMove)\n }\n }, [scrollerElem, anchorElem, editor, hoveredElement])\n\n useEffect(() => {\n if (menuRef.current && hoveredElement?.node) {\n setHandlePosition(\n hoveredElement?.elem,\n menuRef.current,\n anchorElem,\n blockHandleHorizontalOffset,\n )\n }\n }, [anchorElem, hoveredElement, blockHandleHorizontalOffset])\n\n const handleAddClick = useCallback(\n (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {\n let hoveredElementToUse = hoveredElement\n if (!hoveredElementToUse?.node) {\n return\n }\n\n // 1. Update hoveredElement.node to a new paragraph node if the hoveredElement.node is not a paragraph node\n editor.update(() => {\n // Check if blockNode is an empty text node\n let isEmptyParagraph = true\n if (\n hoveredElementToUse?.node.getType() !== 'paragraph' ||\n hoveredElementToUse.node.getTextContent() !== ''\n ) {\n isEmptyParagraph = false\n }\n\n if (!isEmptyParagraph) {\n const newParagraph = $createParagraphNode()\n hoveredElementToUse?.node.insertAfter(newParagraph)\n\n setTimeout(() => {\n hoveredElementToUse = {\n elem: editor.getElementByKey(newParagraph.getKey())!,\n node: newParagraph,\n }\n setHoveredElement(hoveredElementToUse)\n }, 0)\n }\n })\n\n // 2. Focus on the new paragraph node\n setTimeout(() => {\n editor.update(() => {\n editor.focus()\n\n if (\n hoveredElementToUse?.node &&\n 'select' in hoveredElementToUse.node &&\n typeof hoveredElementToUse.node.select === 'function'\n ) {\n hoveredElementToUse.node.select()\n }\n })\n }, 1)\n\n // Make sure this is called AFTER the focusing has been processed by the browser\n // Otherwise, this won't work\n setTimeout(() => {\n editor.dispatchCommand(ENABLE_SLASH_MENU_COMMAND, {\n node: hoveredElementToUse?.node as ParagraphNode,\n })\n }, 2)\n\n event.stopPropagation()\n event.preventDefault()\n },\n [editor, hoveredElement],\n )\n\n return createPortal(\n <React.Fragment>\n <button\n aria-label=\"Add block\"\n className=\"icon add-block-menu\"\n onClick={(event) => {\n handleAddClick(event)\n }}\n ref={menuRef}\n type=\"button\"\n >\n <div className={isEditable ? 'icon' : ''} />\n </button>\n </React.Fragment>,\n anchorElem,\n )\n}\n\nexport function AddBlockHandlePlugin({\n anchorElem = document.body,\n}: {\n anchorElem?: HTMLElement\n}): React.ReactElement {\n const [editor] = useLexicalComposerContext()\n return useAddBlockHandle(editor, anchorElem, editor._editable)\n}\n", "'use client'\n/**\n * Calculate distance between scrollerElem and target if target is not in scrollerElem\n */\nexport const calculateDistanceFromScrollerElem = (\n scrollerElem: HTMLElement | null,\n pageX: number,\n pageY: number,\n target: HTMLElement,\n horizontalBuffer: number = 50,\n verticalBuffer: number = 25,\n): number => {\n let distanceFromScrollerElem = 0\n if (scrollerElem && !scrollerElem.contains(target)) {\n const { bottom, left, right, top } = scrollerElem.getBoundingClientRect()\n\n const adjustedTop = top + window.scrollY\n const adjustedBottom = bottom + window.scrollY\n\n if (\n pageY < adjustedTop - verticalBuffer ||\n pageY > adjustedBottom + verticalBuffer ||\n pageX < left - horizontalBuffer ||\n pageX > right + horizontalBuffer\n ) {\n return -1\n }\n\n // This is used to allow the _draggableBlockElem to be found when the mouse is in the\n // buffer zone around the scrollerElem.\n if (pageX < left || pageX > right) {\n distanceFromScrollerElem = pageX < left ? pageX - left : pageX - right\n }\n }\n return distanceFromScrollerElem\n}\n", "'use client'\nimport type { LexicalEditor, LexicalNode } from 'lexical'\n\nimport { $getNodeByKey } from 'lexical'\n\nimport { Point } from '../../../utils/point.js'\nimport { Rect } from '../../../utils/rect.js'\nimport { getBoundingClientRectWithoutTransform } from '../DraggableBlockPlugin/getBoundingRectWithoutTransform.js'\nimport { getCollapsedMargins } from '../utils/getCollapsedMargins.js'\nimport { getTopLevelNodeKeys } from '../utils/getTopLevelNodeKeys.js'\n\n// Directions\nconst Downward = 1\nconst Upward = -1\nconst Indeterminate = 0\n\ntype Props = {\n anchorElem: HTMLElement\n cache_threshold?: number\n editor: LexicalEditor\n /** fuzzy makes the search not exact. If no exact match found, find the closes node instead of returning null */\n fuzzy?: boolean\n horizontalOffset?: number\n point: Point\n /**\n * By default, empty paragraphs are not returned. Set this to true to return empty paragraphs. @default false\n */\n returnEmptyParagraphs?: boolean\n /**\n * The index to start searching from. It can be a considerable performance optimization to start searching from the index of the\n * previously found node, as the node is likely to be close to the next node.\n */\n startIndex?: number\n useEdgeAsDefault?: boolean\n verbose?: boolean\n}\n\ntype Output = {\n blockElem: HTMLElement | null\n blockNode: LexicalNode | null\n foundAtIndex: number\n isFoundNodeEmptyParagraph: boolean\n}\n\nconst cache = {\n props: null as null | Props,\n result: null as null | Output,\n}\n\nfunction isPointClose(previous: Point, current: Point, threshold: number = 20): boolean {\n const dx = previous.x - current.x\n const dy = previous.y - current.y\n return dx * dx + dy * dy <= threshold * threshold\n}\n\nexport function getNodeCloseToPoint(props: Props): Output {\n const {\n anchorElem,\n cache_threshold = 20,\n editor,\n fuzzy = false,\n horizontalOffset = 0,\n point: { x, y },\n startIndex = 0,\n useEdgeAsDefault = false,\n } = props\n\n // Use cache\n if (\n cache_threshold > 0 &&\n cache.props &&\n cache.result &&\n cache.props.fuzzy === props.fuzzy &&\n cache.props.horizontalOffset === props.horizontalOffset &&\n cache.props.useEdgeAsDefault === props.useEdgeAsDefault &&\n isPointClose(cache.props.point, props.point, cache_threshold)\n ) {\n return cache.result\n }\n\n const anchorElementRect = anchorElem.getBoundingClientRect()\n const topLevelNodeKeys = getTopLevelNodeKeys(editor)\n\n const closestBlockElem: {\n blockElem: HTMLElement | null\n blockNode: LexicalNode | null\n distance: number\n foundAtIndex: number\n isFoundNodeEmptyParagraph: boolean\n } = {\n blockElem: null,\n blockNode: null,\n distance: Infinity,\n foundAtIndex: -1,\n isFoundNodeEmptyParagraph: false,\n }\n\n // Return null if matching block element is the first or last node\n editor.getEditorState().read(() => {\n if (useEdgeAsDefault) {\n const [firstNode, lastNode] = [\n editor.getElementByKey(topLevelNodeKeys[0]),\n editor.getElementByKey(topLevelNodeKeys[topLevelNodeKeys.length - 1]),\n ]\n\n if (firstNode && lastNode) {\n const [firstNodeRect, lastNodeRect] = [\n getBoundingClientRectWithoutTransform(firstNode),\n getBoundingClientRectWithoutTransform(lastNode),\n ]\n\n if (y < firstNodeRect.top) {\n closestBlockElem.blockElem = firstNode\n closestBlockElem.distance = firstNodeRect.top - y\n closestBlockElem.blockNode = $getNodeByKey(topLevelNodeKeys[0])\n closestBlockElem.foundAtIndex = 0\n } else if (y > lastNodeRect.bottom) {\n closestBlockElem.distance = y - lastNodeRect.bottom\n closestBlockElem.blockNode = $getNodeByKey(topLevelNodeKeys[topLevelNodeKeys.length - 1])\n closestBlockElem.blockElem = lastNode\n closestBlockElem.foundAtIndex = topLevelNodeKeys.length - 1\n }\n\n if (closestBlockElem?.blockElem) {\n return {\n blockElem: null,\n isFoundNodeEmptyParagraph: false,\n } as Output\n }\n }\n }\n\n // Find matching block element\n let index = startIndex\n let direction = Indeterminate\n\n while (index >= 0 && index < topLevelNodeKeys.length) {\n const key = topLevelNodeKeys[index]\n const elem = editor.getElementByKey(key)\n if (elem === null) {\n break\n }\n const point = new Point(x + horizontalOffset, y)\n //const domRect = Rect.fromDOM(elem)\n // Do not consider transform of blocks when calculating distance\n const domRect = Rect.fromDOMRect(getBoundingClientRectWithoutTransform(elem))\n\n const { marginBottom, marginTop } = getCollapsedMargins(elem)\n\n const rect = domRect.generateNewRect({\n bottom: domRect.bottom + marginBottom,\n left: anchorElementRect.left,\n right: anchorElementRect.right,\n top: domRect.top - marginTop,\n })\n\n const { distance, isOnBottomSide, isOnTopSide } = rect.distanceFromPoint(point)\n\n if (distance === 0) {\n closestBlockElem.blockElem = elem\n closestBlockElem.blockNode = $getNodeByKey(key)\n closestBlockElem.foundAtIndex = index\n closestBlockElem.distance = distance\n\n // Check if blockNode is an empty text node\n if (\n closestBlockElem.blockNode &&\n closestBlockElem.blockNode.getType() === 'paragraph' &&\n closestBlockElem.blockNode.getTextContent() === ''\n ) {\n if (!fuzzy && !props.returnEmptyParagraphs) {\n closestBlockElem.blockElem = null\n closestBlockElem.blockNode = null\n }\n\n closestBlockElem.isFoundNodeEmptyParagraph = true\n }\n break\n } else if (fuzzy) {\n if (distance < closestBlockElem.distance) {\n closestBlockElem.blockElem = elem\n closestBlockElem.blockNode = $getNodeByKey(key)\n closestBlockElem.distance = distance\n closestBlockElem.foundAtIndex = index\n }\n }\n\n if (direction === Indeterminate) {\n if (isOnTopSide) {\n direction = Upward\n } else if (isOnBottomSide) {\n direction = Downward\n } else {\n // stop search block element\n direction = Infinity\n }\n }\n\n index += direction\n }\n })\n\n // Store in cache before returning\n cache.props = props\n cache.result = {\n blockElem: closestBlockElem.blockElem,\n blockNode: closestBlockElem.blockNode,\n foundAtIndex: closestBlockElem.foundAtIndex,\n isFoundNodeEmptyParagraph: closestBlockElem.isFoundNodeEmptyParagraph,\n }\n\n return {\n blockElem: closestBlockElem.blockElem,\n blockNode: closestBlockElem.blockNode,\n foundAtIndex: closestBlockElem.foundAtIndex,\n isFoundNodeEmptyParagraph: closestBlockElem.isFoundNodeEmptyParagraph,\n }\n}\n", "'use client'\nexport function getBoundingClientRectWithoutTransform(elem: HTMLElement): DOMRect {\n const rect = elem.getBoundingClientRect()\n\n // Extract the translation value from the transform style\n const transformValue = getComputedStyle(elem).getPropertyValue('transform')\n if (!transformValue || transformValue === 'none') {\n return rect\n }\n\n const lastNumberOfTransformValue = transformValue.split(',').pop()\n rect.y = rect.y - Number(lastNumberOfTransformValue?.replace(')', ''))\n\n // Return the original bounding rect if no translation is applied\n return rect\n}\n", "'use client'\nexport function getCollapsedMargins(elem: HTMLElement): {\n marginBottom: number\n marginTop: number\n} {\n const getMargin = (element: Element | null, margin: 'marginBottom' | 'marginTop'): number =>\n element ? parseFloat(window.getComputedStyle(element)[margin]) : 0\n\n const { marginBottom, marginTop } = window.getComputedStyle(elem)\n const prevElemSiblingMarginBottom = getMargin(elem.previousElementSibling, 'marginBottom')\n const nextElemSiblingMarginTop = getMargin(elem.nextElementSibling, 'marginTop')\n const collapsedTopMargin = Math.max(parseFloat(marginTop), prevElemSiblingMarginBottom)\n const collapsedBottomMargin = Math.max(parseFloat(marginBottom), nextElemSiblingMarginTop)\n\n return { marginBottom: collapsedBottomMargin, marginTop: collapsedTopMargin }\n}\n", "'use client'\nimport type { LexicalEditor } from 'lexical'\n\nimport { $getRoot } from 'lexical'\n\nexport function getTopLevelNodeKeys(editor: LexicalEditor): string[] {\n return editor.getEditorState().read(() => $getRoot().getChildrenKeys())\n}\n", "'use client'\nexport function isOnHandleElement(element: HTMLElement, handleElementClassName: string): boolean {\n return !!element.closest(`.${handleElementClassName}`)\n}\n", "'use client'\nconst replacedElements = [\n 'IMG',\n 'INPUT',\n 'TEXTAREA',\n 'SELECT',\n 'BUTTON',\n 'VIDEO',\n 'OBJECT',\n 'EMBED',\n 'IFRAME',\n 'HR',\n]\n\n/**\n * From ChatGPT, only that verified it works for HR elements.\n *\n * HTML Elements can have CSS lineHeight applied to them, but it doesn't always affect the visual layout.\n * This function checks if the line-height property has an effect on the element's layout.\n * @param htmlElem\n */\nexport function doesLineHeightAffectElement(htmlElem: HTMLElement) {\n if (!htmlElem) {\n return false\n }\n\n // Check for replaced elements, elements that typically don't support line-height adjustments,\n // and elements without visible content\n\n if (\n replacedElements.includes(htmlElem.tagName) ||\n htmlElem.offsetHeight === 0 ||\n htmlElem.offsetWidth === 0\n ) {\n return false\n }\n\n // Check for specific CSS properties that negate line-height's visual effects\n const style = window.getComputedStyle(htmlElem)\n if (\n style.display === 'table-cell' ||\n style.position === 'absolute' ||\n style.visibility === 'hidden' ||\n style.opacity === '0'\n ) {\n return false\n }\n\n // This is a basic check, and there can be more complex scenarios where line-height doesn't have an effect.\n return true\n}\n", "'use client'\nimport { doesLineHeightAffectElement } from './doesLineHeightAffectElement.js'\n\nexport function setHandlePosition(\n targetElem: HTMLElement | null,\n handleElem: HTMLElement,\n anchorElem: HTMLElement,\n leftOffset: number = 0, // SPACE\n) {\n if (!targetElem) {\n handleElem.style.opacity = '0'\n handleElem.style.transform = 'translate(-10000px, -10000px)'\n return\n }\n\n const targetRect = targetElem.getBoundingClientRect()\n const targetStyle = window.getComputedStyle(targetElem)\n const floatingElemRect = handleElem.getBoundingClientRect()\n const anchorElementRect = anchorElem.getBoundingClientRect()\n\n let top: number\n\n const isBlockStyle = ['lexical-block', 'lexical-upload', 'lexical-relationship'].some((classes) =>\n targetElem.firstElementChild?.classList.contains(classes),\n )\n\n if (!isBlockStyle) {\n // No need to let line height affect the re-positioning of the floating element if line height has no\n // visual effect on the element. Otherwise, the floating element will be positioned incorrectly.\n const actualLineHeight = doesLineHeightAffectElement(targetElem)\n ? parseInt(targetStyle.lineHeight, 10)\n : 0\n\n top = targetRect.top + (actualLineHeight - floatingElemRect.height) / 2 - anchorElementRect.top\n } else {\n top = targetRect.top + 8 - anchorElementRect.top\n }\n\n const left = leftOffset\n\n handleElem.style.opacity = '1'\n handleElem.style.transform = `translate(${left}px, ${top}px)`\n}\n", "'use client'\nimport type { LexicalEditor } from 'lexical'\nimport type { DragEvent as ReactDragEvent } from 'react'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { eventFiles } from '@lexical/rich-text'\nimport { $getNearestNodeFromDOMNode, $getNodeByKey } from 'lexical'\nimport * as React from 'react'\nimport { useEffect, useRef, useState } from 'react'\nimport { createPortal } from 'react-dom'\n\nimport { useEditorConfigContext } from '../../../config/client/EditorConfigProvider.js'\nimport { isHTMLElement } from '../../../utils/guard.js'\nimport { Point } from '../../../utils/point.js'\nimport { calculateDistanceFromScrollerElem } from '../utils/calculateDistanceFromScrollerElem.js'\nimport { getNodeCloseToPoint } from '../utils/getNodeCloseToPoint.js'\nimport { getTopLevelNodeKeys } from '../utils/getTopLevelNodeKeys.js'\nimport { isOnHandleElement } from '../utils/isOnHandleElement.js'\nimport { setHandlePosition } from '../utils/setHandlePosition.js'\nimport { getBoundingClientRectWithoutTransform } from './getBoundingRectWithoutTransform.js'\nimport './index.scss'\nimport { setTargetLine } from './setTargetLine.js'\n\nconst DRAGGABLE_BLOCK_MENU_CLASSNAME = 'draggable-block-menu'\nconst DRAG_DATA_FORMAT = 'application/x-lexical-drag-block'\n\nlet prevIndex = Infinity\n\nfunction getCurrentIndex(keysLength: number): number {\n if (keysLength === 0) {\n return Infinity\n }\n if (prevIndex >= 0 && prevIndex < keysLength) {\n return prevIndex\n }\n\n return Math.floor(keysLength / 2)\n}\n\nfunction setDragImage(dataTransfer: DataTransfer, draggableBlockElem: HTMLElement) {\n const { transform } = draggableBlockElem.style\n\n // Remove dragImage borders\n dataTransfer.setDragImage(draggableBlockElem, 0, 0)\n\n setTimeout(() => {\n draggableBlockElem.style.transform = transform\n })\n}\n\nfunction hideTargetLine(\n targetLineElem: HTMLElement | null,\n lastTargetBlockElem: HTMLElement | null,\n) {\n if (targetLineElem) {\n targetLineElem.style.opacity = '0'\n }\n if (lastTargetBlockElem) {\n lastTargetBlockElem.style.opacity = ''\n // Delete marginBottom and marginTop values we set\n lastTargetBlockElem.style.marginBottom = ''\n lastTargetBlockElem.style.marginTop = ''\n //lastTargetBlock.style.border = 'none'\n }\n}\n\nfunction useDraggableBlockMenu(\n editor: LexicalEditor,\n anchorElem: HTMLElement,\n isEditable: boolean,\n): React.ReactElement {\n const scrollerElem = anchorElem.parentElement\n\n const menuRef = useRef<HTMLDivElement>(null)\n const targetLineRef = useRef<HTMLDivElement>(null)\n const debugHighlightRef = useRef<HTMLDivElement>(null)\n const isDraggingBlockRef = useRef<boolean>(false)\n const [draggableBlockElem, setDraggableBlockElem] = useState<HTMLElement | null>(null)\n const [lastTargetBlock, setLastTargetBlock] = useState<{\n boundingBox?: DOMRect\n elem: HTMLElement | null\n isBelow: boolean\n } | null>(null)\n\n const { editorConfig } = useEditorConfigContext()\n\n const blockHandleHorizontalOffset = editorConfig?.admin?.hideGutter ? -44 : -8\n\n useEffect(() => {\n /**\n * Handles positioning of the drag handle\n */\n function onDocumentMouseMove(event: MouseEvent) {\n const target = event.target\n if (!isHTMLElement(target)) {\n return\n }\n\n const distanceFromScrollerElem = calculateDistanceFromScrollerElem(\n scrollerElem,\n event.pageX,\n event.pageY,\n target,\n )\n if (distanceFromScrollerElem === -1) {\n setDraggableBlockElem(null)\n return\n }\n\n if (isOnHandleElement(target, DRAGGABLE_BLOCK_MENU_CLASSNAME)) {\n return\n }\n\n const topLevelNodeKeys = getTopLevelNodeKeys(editor)\n\n const {\n blockElem: _draggableBlockElem,\n foundAtIndex,\n isFoundNodeEmptyParagraph,\n } = getNodeCloseToPoint({\n anchorElem,\n cache_threshold: 0,\n editor,\n horizontalOffset: -distanceFromScrollerElem,\n point: new Point(event.x, event.y),\n startIndex: getCurrentIndex(topLevelNodeKeys.length),\n useEdgeAsDefault: false,\n verbose: false,\n })\n\n prevIndex = foundAtIndex\n\n //if (DEBUG && _draggableBlockElem) {\n //targetBlockElem.style.border = '3px solid red'\n // highlightElemOriginalPosition(debugHighlightRef, _draggableBlockElem, anchorElem)\n //}\n\n if (!_draggableBlockElem && !isFoundNodeEmptyParagraph) {\n return\n }\n\n if (draggableBlockElem !== _draggableBlockElem) {\n setDraggableBlockElem(_draggableBlockElem)\n }\n }\n\n // Since the draggableBlockElem is outside the actual editor, we need to listen to the document\n // to be able to detect when the mouse is outside the editor and respect a buffer around\n // the scrollerElem to avoid the draggableBlockElem disappearing too early.\n document?.addEventListener('mousemove', onDocumentMouseMove)\n\n return () => {\n document?.removeEventListener('mousemove', onDocumentMouseMove)\n }\n }, [scrollerElem, anchorElem, editor, draggableBlockElem])\n\n useEffect(() => {\n if (menuRef.current) {\n setHandlePosition(\n draggableBlockElem,\n menuRef.current,\n anchorElem,\n blockHandleHorizontalOffset,\n )\n }\n }, [anchorElem, draggableBlockElem, blockHandleHorizontalOffset])\n\n useEffect(() => {\n function onDragover(event: DragEvent): boolean {\n if (!isDraggingBlockRef.current) {\n return false\n }\n const [isFileTransfer] = eventFiles(event)\n if (isFileTransfer) {\n return false\n }\n\n const { pageY, target } = event\n if (!isHTMLElement(target)) {\n return false\n }\n\n const distanceFromScrollerElem = calculateDistanceFromScrollerElem(\n scrollerElem,\n event.pageX,\n event.pageY,\n target,\n 100,\n 50,\n )\n\n const topLevelNodeKeys = getTopLevelNodeKeys(editor)\n\n const {\n blockElem: targetBlockElem,\n foundAtIndex,\n isFoundNodeEmptyParagraph,\n } = getNodeCloseToPoint({\n anchorElem,\n editor,\n fuzzy: true,\n horizontalOffset: -distanceFromScrollerElem,\n point: new Point(event.x, event.y),\n startIndex: getCurrentIndex(topLevelNodeKeys.length),\n useEdgeAsDefault: true,\n verbose: true,\n })\n\n prevIndex = foundAtIndex\n\n const targetLineElem = targetLineRef.current\n // targetBlockElem === null shouldn't happen\n if (targetBlockElem === null || targetLineElem === null) {\n return false\n }\n\n if (draggableBlockElem !== targetBlockElem) {\n const { isBelow, willStayInSamePosition } = setTargetLine(\n editorConfig?.admin?.hideGutter ? '0px' : '3rem',\n blockHandleHorizontalOffset +\n (editorConfig?.admin?.hideGutter\n ? (menuRef?.current?.getBoundingClientRect()?.width ?? 0)\n : -(menuRef?.current?.getBoundingClientRect()?.width ?? 0)),\n targetLineElem,\n targetBlockElem,\n lastTargetBlock!,\n pageY,\n anchorElem,\n event,\n debugHighlightRef,\n isFoundNodeEmptyParagraph,\n )\n\n // Prevent default event to be able to trigger onDrop events\n // Calling preventDefault() adds the green plus icon to the cursor,\n // indicating that the drop is allowed.\n event.preventDefault()\n\n if (!willStayInSamePosition) {\n setLastTargetBlock({\n boundingBox: targetBlockElem.getBoundingClientRect(),\n elem: targetBlockElem,\n isBelow,\n })\n }\n } else if (lastTargetBlock?.elem) {\n hideTargetLine(targetLineElem, lastTargetBlock.elem)\n setLastTargetBlock({\n boundingBox: targetBlockElem.getBoundingClientRect(),\n elem: targetBlockElem,\n isBelow: false,\n })\n }\n\n return true\n }\n\n function onDrop(event: DragEvent): boolean {\n if (!isDraggingBlockRef.current) {\n return false\n }\n const [isFileTransfer] = eventFiles(event)\n if (isFileTransfer) {\n return false\n }\n const { dataTransfer, pageY, target } = event\n const dragData = dataTransfer?.getData(DRAG_DATA_FORMAT) || ''\n\n editor.update(() => {\n const draggedNode = $getNodeByKey(dragData)\n if (!draggedNode) {\n return false\n }\n if (!isHTMLElement(target)) {\n return false\n }\n const distanceFromScrollerElem = calculateDistanceFromScrollerElem(\n scrollerElem,\n event.pageX,\n event.pageY,\n target,\n 100,\n 50,\n )\n\n const { blockElem: targetBlockElem, isFoundNodeEmptyParagraph } = getNodeCloseToPoint({\n anchorElem,\n editor,\n fuzzy: true,\n horizontalOffset: -distanceFromScrollerElem,\n point: new Point(event.x, event.y),\n useEdgeAsDefault: true,\n })\n\n if (!targetBlockElem) {\n return false\n }\n const targetNode = $getNearestNodeFromDOMNode(targetBlockElem)\n if (!targetNode) {\n return false\n }\n if (targetNode === draggedNode) {\n return true\n }\n\n const { height: targetBlockElemHeight, top: targetBlockElemTop } =\n getBoundingClientRectWithoutTransform(targetBlockElem)\n\n const mouseY = pageY\n const isBelow = mouseY >= targetBlockElemTop + targetBlockElemHeight / 2 + window.scrollY\n\n if (!isFoundNodeEmptyParagraph) {\n if (isBelow) {\n // below targetBlockElem\n targetNode.insertAfter(draggedNode)\n } else {\n // above targetBlockElem\n targetNode.insertBefore(draggedNode)\n }\n } else {\n //\n targetNode.insertBefore(draggedNode)\n targetNode.remove()\n }\n\n /*\n if (pageY >= targetBlockElemTop + targetBlockElemHeight / 2) {\n targetNode.insertAfter(draggedNode)\n } else {\n targetNode.insertBefore(draggedNode)\n }*/\n if (draggableBlockElem !== null) {\n setDraggableBlockElem(null)\n }\n\n // find all previous elements with lexical-block-highlighter class and remove them\n const allPrevHighlighters = document.querySelectorAll('.lexical-block-highlighter')\n allPrevHighlighters.forEach((highlighter) => {\n highlighter.remove()\n })\n\n const newInsertedElem = editor.getElementByKey(draggedNode.getKey())\n setTimeout(() => {\n // add new temp html element to newInsertedElem with the same height and width and the class block-selected\n // to highlight the new inserted element\n const newInsertedElemRect = newInsertedElem?.getBoundingClientRect()\n if (!newInsertedElemRect) {\n return\n }\n const highlightElem = document.createElement('div')\n highlightElem.className = 'lexical-block-highlighter'\n\n highlightElem.style.backgroundColor = 'var(--theme-elevation-1000'\n highlightElem.style.transition = 'opacity 0.5s ease-in-out'\n highlightElem.style.zIndex = '1'\n highlightElem.style.pointerEvents = 'none'\n highlightElem.style.boxSizing = 'border-box'\n highlightElem.style.borderRadius = '4px'\n highlightElem.style.position = 'absolute'\n document.body.appendChild(highlightElem)\n\n highlightElem.style.opacity = '0.1'\n\n highlightElem.style.height = `${newInsertedElemRect.height + 8}px`\n highlightElem.style.width = `${newInsertedElemRect.width + 8}px`\n highlightElem.style.top = `${newInsertedElemRect.top + window.scrollY - 4}px`\n highlightElem.style.left = `${newInsertedElemRect.left - 4}px`\n\n setTimeout(() => {\n highlightElem.style.opacity = '0'\n setTimeout(() => {\n highlightElem.remove()\n }, 500)\n }, 1000)\n }, 120)\n })\n\n return true\n }\n\n // register onDragover event listeners:\n document.addEventListener('dragover', onDragover)\n // register onDrop event listeners:\n document.addEventListener('drop', onDrop)\n\n return () => {\n document.removeEventListener('dragover', onDragover)\n document.removeEventListener('drop', onDrop)\n }\n }, [\n scrollerElem,\n blockHandleHorizontalOffset,\n anchorElem,\n editor,\n lastTargetBlock,\n draggableBlockElem,\n editorConfig?.admin?.hideGutter,\n ])\n\n function onDragStart(event: ReactDragEvent<HTMLDivElement>): void {\n const dataTransfer = event.dataTransfer\n if (!dataTransfer || !draggableBlockElem) {\n return\n }\n setDragImage(dataTransfer, draggableBlockElem)\n let nodeKey = ''\n editor.update(() => {\n const node = $getNearestNodeFromDOMNode(draggableBlockElem)\n if (node) {\n nodeKey = node.getKey()\n }\n })\n isDraggingBlockRef.current = true\n dataTransfer.setData(DRAG_DATA_FORMAT, nodeKey)\n }\n\n function onDragEnd(): void {\n isDraggingBlockRef.current = false\n if (lastTargetBlock?.elem) {\n hideTargetLine(targetLineRef.current, lastTargetBlock?.elem)\n }\n }\n\n return createPortal(\n <React.Fragment>\n <div\n className=\"icon draggable-block-menu\"\n draggable\n onDragEnd={onDragEnd}\n onDragStart={onDragStart}\n ref={menuRef}\n >\n <div className={isEditable ? 'icon' : ''} />\n </div>\n <div className=\"draggable-block-target-line\" ref={targetLineRef} />\n <div className=\"debug-highlight\" ref={debugHighlightRef} />\n </React.Fragment>,\n anchorElem,\n )\n}\n\nexport function DraggableBlockPlugin({\n anchorElem = document.body,\n}: {\n anchorElem?: HTMLElement\n}): React.ReactElement {\n const [editor] = useLexicalComposerContext()\n return useDraggableBlockMenu(editor, anchorElem, editor._editable)\n}\n", "'use client'\nimport { getCollapsedMargins } from '../utils/getCollapsedMargins.js'\nconst TARGET_LINE_HALF_HEIGHT = 0\nconst TEXT_BOX_HORIZONTAL_PADDING = -24\nconst DEBUG = false\n\nlet animationTimer = 0\n\nexport function setTargetLine(\n offsetWidth: string,\n offsetLeft: number,\n targetLineElem: HTMLElement,\n targetBlockElem: HTMLElement,\n lastTargetBlock: {\n boundingBox?: DOMRect\n elem: HTMLElement | null\n isBelow: boolean\n },\n mouseY: number,\n anchorElem: HTMLElement,\n event: DragEvent,\n debugHighlightRef: React.RefObject<HTMLDivElement | null>,\n isFoundNodeEmptyParagraph: boolean = false,\n) {\n const { height: targetBlockElemHeight, top: targetBlockElemTop } =\n targetBlockElem.getBoundingClientRect() // used to be getBoundingClientRectWithoutTransform. Not sure what's better, but the normal getBoundingClientRect seems to work fine\n const { top: anchorTop, width: anchorWidth } = anchorElem.getBoundingClientRect()\n\n const { marginBottom, marginTop } = getCollapsedMargins(targetBlockElem)\n let lineTop = targetBlockElemTop\n\n const isBelow = mouseY >= targetBlockElemTop + targetBlockElemHeight / 2 + window.scrollY\n\n let willStayInSamePosition = false\n\n /**\n * Do not run any transform or changes if the actual new line position would be the same (even if it's now inserted BEFORE rather than AFTER - position would still be the same)\n * This prevents unnecessary flickering.\n *\n * We still need to let it run even if the position (IGNORING the transform) would not change, as the transform animation is not finished yet. This is what animationTimer does. Otherwise, the positioning will be inaccurate\n */\n if (lastTargetBlock?.elem) {\n if (targetBlockElem !== lastTargetBlock?.elem) {\n if (\n isBelow &&\n lastTargetBlock?.elem &&\n lastTargetBlock?.elem === targetBlockElem.nextElementSibling\n ) {\n animationTimer++\n\n if (animationTimer < 200) {\n willStayInSamePosition = true\n }\n } else if (\n !isBelow &&\n lastTargetBlock?.elem &&\n lastTargetBlock?.elem === targetBlockElem.previousElementSibling\n ) {\n animationTimer++\n if (animationTimer < 200) {\n willStayInSamePosition = true\n }\n }\n } else {\n animationTimer++\n\n const lastBoundingBoxPosition = lastTargetBlock?.boundingBox?.y\n const currentBoundingBoxPosition = targetBlockElem.getBoundingClientRect().y\n\n if (\n (isBelow === lastTargetBlock?.isBelow &&\n lastBoundingBoxPosition === currentBoundingBoxPosition) ||\n animationTimer < 200\n ) {\n willStayInSamePosition = false\n }\n }\n }\n if (willStayInSamePosition) {\n return {\n isBelow,\n willStayInSamePosition,\n }\n }\n\n /**\n * Paragraphs need no isBelow/above handling,\n */\n if (!isFoundNodeEmptyParagraph) {\n //if (!isFoundNodeEmptyParagraph) {\n if (isBelow) {\n // below targetBlockElem\n lineTop += targetBlockElemHeight + marginBottom / 2\n } else {\n // above targetBlockElem\n lineTop -= marginTop / 2\n }\n } else {\n lineTop += targetBlockElemHeight / 2\n }\n\n let targetElemTranslate2 = 0\n\n if (!isFoundNodeEmptyParagraph) {\n if (isBelow) {\n targetElemTranslate2 = -TARGET_LINE_HALF_HEIGHT\n } else {\n targetElemTranslate2 = TARGET_LINE_HALF_HEIGHT\n }\n }\n\n const top = lineTop - anchorTop + targetElemTranslate2\n\n const left = TEXT_BOX_HORIZONTAL_PADDING - offsetLeft\n\n targetLineElem.style.width = `calc(${anchorWidth}px - ${offsetWidth})`\n targetLineElem.style.opacity = '.8'\n\n // if (DEBUG) {\n // //targetBlockElem.style.border = '3px solid red'\n // highlightElemOriginalPosition(debugHighlightRef, targetBlockElem, anchorElem)\n // }\n\n targetLineElem.style.transform = `translate(${left}px, calc(${top}px - ${'2px'}))`\n\n /**\n * Properly reset previous targetBlockElem styles\n */\n if (lastTargetBlock?.elem) {\n lastTargetBlock.elem.style.opacity = ''\n\n if (lastTargetBlock?.elem === targetBlockElem) {\n if (isBelow) {\n lastTargetBlock.elem.style.marginTop = ''\n } else {\n lastTargetBlock.elem.style.marginBottom = ''\n }\n } else {\n lastTargetBlock.elem.style.marginBottom = ''\n lastTargetBlock.elem.style.marginTop = ''\n }\n }\n\n animationTimer = 0\n return {\n isBelow,\n willStayInSamePosition,\n }\n}\n", "'use client'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport * as React from 'react'\n\nimport { registerMarkdownShortcuts } from '../../../packages/@lexical/markdown/MarkdownShortcuts.js'\nimport { useEditorConfigContext } from '../../config/client/EditorConfigProvider.js'\n\nexport const MarkdownShortcutPlugin: React.FC = () => {\n const { editorConfig } = useEditorConfigContext()\n const [editor] = useLexicalComposerContext()\n\n React.useEffect(() => {\n return registerMarkdownShortcuts(editor, editorConfig.features.markdownTransformers ?? [])\n }, [editor, editorConfig.features.markdownTransformers])\n\n return null\n}\n", "'use client'\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { useTranslation } from '@payloadcms/ui'\nimport { useCallback, useMemo, useState } from 'react'\nimport * as React from 'react'\nimport * as ReactDOM from 'react-dom'\n\nimport type {\n SlashMenuGroup,\n SlashMenuGroupInternal,\n SlashMenuItemInternal,\n SlashMenuItem as SlashMenuItemType,\n} from './LexicalTypeaheadMenuPlugin/types.js'\n\nimport { useEditorConfigContext } from '../../config/client/EditorConfigProvider.js'\nimport './index.scss'\nimport { LexicalTypeaheadMenuPlugin } from './LexicalTypeaheadMenuPlugin/index.js'\nimport { useMenuTriggerMatch } from './useMenuTriggerMatch.js'\n\nconst baseClass = 'slash-menu-popup'\n\nfunction SlashMenuItem({\n isSelected,\n item,\n onClick,\n onMouseEnter,\n ref,\n}: {\n index: number\n isSelected: boolean\n item: SlashMenuItemInternal\n onClick: () => void\n onMouseEnter: () => void\n ref?: React.Ref<HTMLButtonElement>\n}) {\n const {\n fieldProps: { featureClientSchemaMap, schemaPath },\n } = useEditorConfigContext()\n\n const { i18n } = useTranslation<{}, string>()\n\n let className = `${baseClass}__item ${baseClass}__item-${item.key}`\n if (isSelected) {\n className += ` ${baseClass}__item--selected`\n }\n\n let title = item.key\n if (item.label) {\n title =\n typeof item.label === 'function'\n ? item.label({ featureClientSchemaMap, i18n, schemaPath })\n : item.label\n }\n // Crop title to max. 25 characters\n if (title.length > 25) {\n title = title.substring(0, 25) + '...'\n }\n\n return (\n <button\n aria-selected={isSelected}\n className={className}\n id={baseClass + '__item-' + item.key}\n key={item.key}\n onClick={onClick}\n onMouseEnter={onMouseEnter}\n ref={ref}\n role=\"option\"\n tabIndex={-1}\n type=\"button\"\n >\n {item?.Icon && <item.Icon />}\n\n <span className={`${baseClass}__item-text`}>{title}</span>\n </button>\n )\n}\n\nexport function SlashMenuPlugin({\n anchorElem = document.body,\n}: {\n anchorElem?: HTMLElement\n}): React.ReactElement {\n const [editor] = useLexicalComposerContext()\n const [queryString, setQueryString] = useState<null | string>(null)\n const { editorConfig } = useEditorConfigContext()\n const { i18n } = useTranslation<{}, string>()\n const {\n fieldProps: { featureClientSchemaMap, schemaPath },\n } = useEditorConfigContext()\n\n const checkForTriggerMatch = useMenuTriggerMatch('/', {\n minLength: 0,\n })\n\n const getDynamicItems = useCallback(() => {\n let groupWithItems: Array<SlashMenuGroup> = []\n\n for (const dynamicItem of editorConfig.features.slashMenu.dynamicGroups) {\n if (queryString) {\n const dynamicGroupWithItems = dynamicItem({\n editor,\n queryString,\n })\n groupWithItems = groupWithItems.concat(dynamicGroupWithItems)\n }\n }\n\n return groupWithItems\n }, [editor, queryString, editorConfig?.features])\n\n const groups: SlashMenuGroup[] = useMemo(() => {\n let groupsWithItems: SlashMenuGroup[] = []\n for (const groupWithItem of editorConfig?.features.slashMenu.groups ?? []) {\n groupsWithItems.push(groupWithItem)\n }\n\n if (queryString) {\n // Filter current groups first\n // @ts-expect-error - TODO: fix this\n groupsWithItems = groupsWithItems.map((group) => {\n const filteredItems = group.items.filter((item) => {\n let itemTitle = item.key\n if (item.label) {\n itemTitle =\n typeof item.label === 'function'\n ? item.label({ featureClientSchemaMap, i18n, schemaPath })\n : item.label\n }\n\n if (new RegExp(queryString, 'gi').exec(itemTitle)) {\n return true\n }\n if (item.keywords != null) {\n return item.keywords.some((keyword) => new RegExp(queryString, 'gi').exec(keyword))\n }\n return false\n })\n if (filteredItems.length) {\n return {\n ...group,\n items: filteredItems,\n }\n }\n return null\n })\n\n groupsWithItems = groupsWithItems.filter((group) => group != null)\n\n // Now add dynamic groups\n const dynamicItemGroups = getDynamicItems()\n\n // merge dynamic items into groups\n for (const dynamicGroup of dynamicItemGroups) {\n // 1. find the group with the same name or create new one\n let group = groupsWithItems.find((group) => group.key === dynamicGroup.key)\n if (!group) {\n group = {\n ...dynamicGroup,\n items: [],\n }\n } else {\n groupsWithItems = groupsWithItems.filter((group) => group.key !== dynamicGroup.key)\n }\n\n // 2. Add items to group items array and add to sanitized.slashMenu.groupsWithItems\n if (group?.items?.length) {\n group.items = group.items.concat(group.items)\n }\n groupsWithItems.push(group)\n }\n }\n\n return groupsWithItems\n }, [\n queryString,\n editorConfig?.features.slashMenu.groups,\n getDynamicItems,\n featureClientSchemaMap,\n i18n,\n schemaPath,\n ])\n\n return (\n <LexicalTypeaheadMenuPlugin\n anchorElem={anchorElem}\n groups={groups as SlashMenuGroupInternal[]}\n menuRenderFn={(\n anchorElementRef,\n { selectedItemKey, selectItemAndCleanUp, setSelectedItemKey },\n ) =>\n anchorElementRef.current && groups.length\n ? ReactDOM.createPortal(\n <div className={baseClass}>\n {groups.map((group) => {\n let groupTitle = group.key\n if (group.label && featureClientSchemaMap) {\n groupTitle =\n typeof group.label === 'function'\n ? group.label({ featureClientSchemaMap, i18n, schemaPath })\n : group.label\n }\n\n return (\n <div\n className={`${baseClass}__group ${baseClass}__group-${group.key}`}\n key={group.key}\n >\n <div className={`${baseClass}__group-title`}>{groupTitle}</div>\n {group.items.map((item, oi: number) => (\n <SlashMenuItem\n index={oi}\n isSelected={selectedItemKey === item.key}\n item={item as SlashMenuItemInternal}\n key={item.key}\n onClick={() => {\n setSelectedItemKey(item.key)\n selectItemAndCleanUp(item)\n }}\n onMouseEnter={() => {\n setSelectedItemKey(item.key)\n }}\n ref={(el) => {\n ;(item as SlashMenuItemInternal).ref = { current: el }\n }}\n />\n ))}\n </div>\n )\n })}\n </div>,\n anchorElementRef.current,\n )\n : null\n }\n onQueryChange={setQueryString}\n triggerFn={checkForTriggerMatch}\n />\n )\n}\n", "'use client'\nimport type { LexicalEditor } from 'lexical'\n\nimport { useCallback } from 'react'\n\nimport { PUNCTUATION } from './LexicalTypeaheadMenuPlugin/index.js'\n\nexport type TriggerFn = ({\n editor,\n query,\n}: {\n editor: LexicalEditor\n /** The query string is the POTENTIAL trigger AND the text after the trigger text. */\n query: string\n}) => MenuTextMatch | null\n\nexport type MenuTextMatch = {\n leadOffset: number\n matchingString: string\n replaceableString: string\n}\n\n/**\n * Returns a function which checks if the trigger (e.g. '/') is present in the query and, if so, returns the matching string (text after the trigger)\n */\nexport function useMenuTriggerMatch(\n /**\n * Text which triggers the menu. Everything after this text will be used as the query.\n */\n trigger: string,\n { maxLength = 75, minLength = 1 }: { maxLength?: number; minLength?: number },\n): TriggerFn {\n return useCallback(\n ({ query }) => {\n const validChars = '[^' + trigger + PUNCTUATION + '\\\\s]'\n const TypeaheadTriggerRegex = new RegExp(\n '(^|\\\\s|\\\\()(' +\n '[' +\n trigger +\n ']' +\n '((?:' +\n validChars +\n '){0,' +\n maxLength +\n '})' +\n ')$',\n )\n const match = TypeaheadTriggerRegex.exec(query)\n if (match !== null) {\n const maybeLeadingWhitespace = match[1]\n\n /**\n * matchingString is only the text AFTER the trigger text. (So everything after the /)\n */\n const matchingString = match[3]\n\n if (matchingString.length >= minLength) {\n return {\n leadOffset: match.index + maybeLeadingWhitespace.length,\n matchingString,\n replaceableString: match[2], // replaceableString is the trigger text + the matching string\n }\n }\n }\n return null\n },\n [maxLength, minLength, trigger],\n )\n}\n", "'use client'\nimport type { TextFormatType } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { TEXT_TYPE_TO_FORMAT, TextNode } from 'lexical'\nimport { type SanitizedClientFeatures } from 'packages/richtext-lexical/src/features/typesClient.js'\nimport { useEffect } from 'react'\n\nexport function TextPlugin({ features }: { features: SanitizedClientFeatures }) {\n const [editor] = useLexicalComposerContext()\n\n useEffect(() => {\n const disabledFormats = getDisabledFormats(features.enabledFormats as TextFormatType[])\n if (disabledFormats.length === 0) {\n return\n }\n // Ideally override the TextNode with our own TextNode (changing its setFormat or toggleFormat methods),\n // would be more performant. If we find a noticeable perf regression we can switch to that option.\n // Overriding the FORMAT_TEXT_COMMAND and PASTE_COMMAND commands is not an option I considered because\n // there might be other forms of mutation that we might not be considering. For example:\n // browser extensions or Payload/Lexical plugins that have their own commands.\n return editor.registerNodeTransform(TextNode, (textNode) => {\n disabledFormats.forEach((disabledFormat) => {\n if (textNode.hasFormat(disabledFormat)) {\n textNode.toggleFormat(disabledFormat)\n }\n })\n })\n }, [editor, features])\n\n return null\n}\n\nfunction getDisabledFormats(enabledFormats: TextFormatType[]): TextFormatType[] {\n // not sure why Lexical added highlight as TextNode format.\n // see https://github.com/facebook/lexical/pull/3583\n // We are going to implement it in other way to support multiple colors\n delete TEXT_TYPE_TO_FORMAT.highlight\n const allFormats = Object.keys(TEXT_TYPE_TO_FORMAT) as TextFormatType[]\n const enabledSet = new Set(enabledFormats)\n\n return allFormats.filter((format) => !enabledSet.has(format))\n}\n", "'use client'\nimport type { JSX } from 'react'\n\nimport { ContentEditable } from '@lexical/react/LexicalContentEditable.js'\nimport { useTranslation } from '@payloadcms/ui'\nimport * as React from 'react'\n\nimport './ContentEditable.scss'\n\nexport function LexicalContentEditable({ className }: { className?: string }): JSX.Element {\n const { t } = useTranslation<{}, string>()\n\n return (\n <ContentEditable\n aria-placeholder={t('lexical:general:placeholder')}\n className={className ?? 'ContentEditable__root'}\n placeholder={<p className=\"editor-placeholder\">{t('lexical:general:placeholder')}</p>}\n />\n )\n}\n"],
5
- "mappings": "+MAIA,OACEA,oBAAAA,GACAC,cAAAA,GACAC,cAAAA,GACAC,yBAAAA,GACAC,gBAAAA,GACAC,YAAAA,GACAC,iBAAAA,OACK,iBACP,OAASC,oBAAAA,OAAwB,wBACjC,OAAgBC,eAAAA,GAAaC,WAAAA,OAAe,QAC5C,OAASC,iBAAAA,OAAqB,uBAM9B,MAAO,wDCh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,MAAA,CAAI3C,UAAW+B,EAAiCa,MAAOJ,aACtDK,EAACC,GAAA,CACCC,gBAAiBzB,EACjB0B,SAAUH,EAACI,GAAA,CAAW1C,KAAMA,EAAMqB,UAAWA,MAE9CL,GAASsB,EAACK,GAAA,CAAW9C,MAAOA,EAAOC,UAAWA,EAAWC,SAAUA,IACpEqC,GAAC,MAAA,CAAI3C,UAAW,GAAGP,EAAA,mBACjBkD,GAACQ,GAAA,CAAcC,eAAgBA,GAAgBC,QAASA,IAAA,CAAO,YAC5DjC,EACDyB,EAACS,GAAA,CACCC,YAAanB,EACbxC,aAAcA,EACd4D,WAAY7D,EAEZ8D,SAAUpB,GACVnC,SAAU4B,EACVd,MAAOA,GAHF0C,KAAKC,UAAU,CAAEjC,aAAAA,EAAcnB,KAAAA,CAAK,CAAA,CAAA,EAK1CY,CAAA,IAEFE,EACDwB,EAACC,GAAA,CACCC,gBAAiB1B,EACjB2B,SAAUH,EAACe,GAAA,CAAiB3D,YAAaA,EAAaM,KAAMA,WAvBpC6B,CAAA,CA4BlC,EAEA,SAASgB,GAAe,CAAES,MAAAA,CAAK,EAAoB,CAGjD,OACElB,GAAC,MAAA,CAAI3C,UAAU,gBAAgB8D,KAAK,kBAClCjB,EAAC,IAAA,UAAE,0BACHA,EAAC,MAAA,CAAID,MAAO,CAAEmB,MAAO,KAAM,WAAIF,EAAMG,YAG3C,CAEO,IAAMC,GAAqCC,GAAcxE,EAAA",
6
- "names": ["FieldDescription", "FieldError", "FieldLabel", "RenderCustomComponent", "useEditDepth", "useField", "withCondition", "mergeFieldStyles", "useCallback", "useMemo", "ErrorBoundary", "LexicalComposer", "React", "useMemo", "c", "_c", "useLexicalComposerContext", "LexicalErrorBoundary", "HistoryPlugin", "OnChangePlugin", "RichTextPlugin", "BLUR_COMMAND", "COMMAND_PRIORITY_LOW", "FOCUS_COMMAND", "React", "useEffect", "useState", "EditorPlugin", "anchorElem", "clientProps", "plugin", "position", "Component", "_jsx", "useLexicalComposerContext", "$createParagraphNode", "React", "useCallback", "useEffect", "useRef", "useState", "createPortal", "calculateDistanceFromScrollerElem", "scrollerElem", "pageX", "pageY", "target", "horizontalBuffer", "verticalBuffer", "distanceFromScrollerElem", "contains", "bottom", "left", "right", "top", "getBoundingClientRect", "adjustedTop", "window", "scrollY", "adjustedBottom", "$getNodeByKey", "getBoundingClientRectWithoutTransform", "elem", "rect", "getBoundingClientRect", "transformValue", "getComputedStyle", "getPropertyValue", "lastNumberOfTransformValue", "split", "pop", "y", "Number", "replace", "getCollapsedMargins", "elem", "getMargin", "element", "margin", "parseFloat", "window", "getComputedStyle", "marginBottom", "marginTop", "prevElemSiblingMarginBottom", "previousElementSibling", "nextElemSiblingMarginTop", "nextElementSibling", "collapsedTopMargin", "Math", "max", "$getRoot", "getTopLevelNodeKeys", "editor", "getEditorState", "read", "getChildrenKeys", "Downward", "Upward", "Indeterminate", "cache", "props", "result", "isPointClose", "previous", "current", "threshold", "dx", "x", "dy", "y", "getNodeCloseToPoint", "anchorElem", "cache_threshold", "editor", "fuzzy", "horizontalOffset", "point", "startIndex", "useEdgeAsDefault", "anchorElementRect", "getBoundingClientRect", "topLevelNodeKeys", "getTopLevelNodeKeys", "closestBlockElem", "blockElem", "blockNode", "distance", "Infinity", "foundAtIndex", "isFoundNodeEmptyParagraph", "getEditorState", "read", "firstNode", "lastNode", "getElementByKey", "length", "firstNodeRect", "lastNodeRect", "getBoundingClientRectWithoutTransform", "top", "$getNodeByKey", "bottom", "index", "direction", "key", "elem", "Point", "domRect", "Rect", "fromDOMRect", "marginBottom", "marginTop", "getCollapsedMargins", "rect", "generateNewRect", "left", "right", "isOnBottomSide", "isOnTopSide", "distanceFromPoint", "getType", "getTextContent", "returnEmptyParagraphs", "isOnHandleElement", "element", "handleElementClassName", "closest", "replacedElements", "doesLineHeightAffectElement", "htmlElem", "includes", "tagName", "offsetHeight", "offsetWidth", "style", "window", "getComputedStyle", "display", "position", "visibility", "opacity", "setHandlePosition", "targetElem", "handleElem", "anchorElem", "leftOffset", "style", "opacity", "transform", "targetRect", "getBoundingClientRect", "targetStyle", "window", "getComputedStyle", "floatingElemRect", "anchorElementRect", "top", "some", "classes", "firstElementChild", "classList", "contains", "actualLineHeight", "doesLineHeightAffectElement", "parseInt", "lineHeight", "height", "left", "ADD_BLOCK_MENU_CLASSNAME", "prevIndex", "Infinity", "getCurrentIndex", "keysLength", "Math", "floor", "useAddBlockHandle", "editor", "anchorElem", "isEditable", "scrollerElem", "parentElement", "editorConfig", "useEditorConfigContext", "blockHandleHorizontalOffset", "admin", "hideGutter", "menuRef", "useRef", "hoveredElement", "setHoveredElement", "useState", "useEffect", "onDocumentMouseMove", "event", "target", "isHTMLElement", "distanceFromScrollerElem", "calculateDistanceFromScrollerElem", "pageX", "pageY", "isOnHandleElement", "topLevelNodeKeys", "getTopLevelNodeKeys", "blockElem", "_emptyBlockElem", "blockNode", "foundAtIndex", "getNodeCloseToPoint", "cache_threshold", "horizontalOffset", "point", "Point", "x", "y", "returnEmptyParagraphs", "startIndex", "length", "useEdgeAsDefault", "node", "elem", "document", "addEventListener", "removeEventListener", "current", "setHandlePosition", "handleAddClick", "useCallback", "hoveredElementToUse", "update", "isEmptyParagraph", "getType", "getTextContent", "newParagraph", "$createParagraphNode", "insertAfter", "setTimeout", "getElementByKey", "getKey", "focus", "select", "dispatchCommand", "ENABLE_SLASH_MENU_COMMAND", "stopPropagation", "preventDefault", "createPortal", "_jsx", "Fragment", "className", "onClick", "ref", "type", "AddBlockHandlePlugin", "t0", "t1", "undefined", "body", "useLexicalComposerContext", "_editable", "useLexicalComposerContext", "eventFiles", "$getNearestNodeFromDOMNode", "$getNodeByKey", "React", "useEffect", "useRef", "useState", "createPortal", "TARGET_LINE_HALF_HEIGHT", "TEXT_BOX_HORIZONTAL_PADDING", "animationTimer", "setTargetLine", "offsetWidth", "offsetLeft", "targetLineElem", "targetBlockElem", "lastTargetBlock", "mouseY", "anchorElem", "event", "debugHighlightRef", "isFoundNodeEmptyParagraph", "height", "targetBlockElemHeight", "top", "targetBlockElemTop", "getBoundingClientRect", "anchorTop", "width", "anchorWidth", "marginBottom", "marginTop", "getCollapsedMargins", "lineTop", "isBelow", "window", "scrollY", "willStayInSamePosition", "elem", "nextElementSibling", "previousElementSibling", "lastBoundingBoxPosition", "boundingBox", "y", "currentBoundingBoxPosition", "targetElemTranslate2", "TARGET_LINE_HALF_HEIGHT", "left", "TEXT_BOX_HORIZONTAL_PADDING", "style", "opacity", "transform", "DRAGGABLE_BLOCK_MENU_CLASSNAME", "DRAG_DATA_FORMAT", "prevIndex", "Infinity", "getCurrentIndex", "keysLength", "Math", "floor", "setDragImage", "dataTransfer", "draggableBlockElem", "transform", "style", "setTimeout", "hideTargetLine", "targetLineElem", "lastTargetBlockElem", "opacity", "marginBottom", "marginTop", "useDraggableBlockMenu", "editor", "anchorElem", "isEditable", "scrollerElem", "parentElement", "menuRef", "useRef", "targetLineRef", "debugHighlightRef", "isDraggingBlockRef", "setDraggableBlockElem", "useState", "lastTargetBlock", "setLastTargetBlock", "editorConfig", "useEditorConfigContext", "blockHandleHorizontalOffset", "admin", "hideGutter", "useEffect", "onDocumentMouseMove", "event", "target", "isHTMLElement", "distanceFromScrollerElem", "calculateDistanceFromScrollerElem", "pageX", "pageY", "isOnHandleElement", "topLevelNodeKeys", "getTopLevelNodeKeys", "blockElem", "_draggableBlockElem", "foundAtIndex", "isFoundNodeEmptyParagraph", "getNodeCloseToPoint", "cache_threshold", "horizontalOffset", "point", "Point", "x", "y", "startIndex", "length", "useEdgeAsDefault", "verbose", "document", "addEventListener", "removeEventListener", "current", "setHandlePosition", "onDragover", "isFileTransfer", "eventFiles", "targetBlockElem", "fuzzy", "isBelow", "willStayInSamePosition", "setTargetLine", "getBoundingClientRect", "width", "preventDefault", "boundingBox", "elem", "onDrop", "dragData", "getData", "update", "draggedNode", "$getNodeByKey", "targetNode", "$getNearestNodeFromDOMNode", "height", "targetBlockElemHeight", "top", "targetBlockElemTop", "getBoundingClientRectWithoutTransform", "window", "scrollY", "insertBefore", "remove", "insertAfter", "querySelectorAll", "forEach", "highlighter", "newInsertedElem", "getElementByKey", "getKey", "newInsertedElemRect", "highlightElem", "createElement", "className", "backgroundColor", "transition", "zIndex", "pointerEvents", "boxSizing", "borderRadius", "position", "body", "appendChild", "left", "onDragStart", "nodeKey", "node", "setData", "onDragEnd", "createPortal", "_jsxs", "Fragment", "_jsx", "draggable", "ref", "DraggableBlockPlugin", "t0", "t1", "undefined", "useLexicalComposerContext", "_editable", "c", "_c", "useLexicalComposerContext", "React", "MarkdownShortcutPlugin", "$", "_c", "editorConfig", "useEditorConfigContext", "editor", "useLexicalComposerContext", "t0", "t1", "features", "markdownTransformers", "registerMarkdownShortcuts", "useEffect", "useLexicalComposerContext", "useTranslation", "useCallback", "useMemo", "useState", "ReactDOM", "c", "_c", "useMenuTriggerMatch", "trigger", "t0", "$", "_c", "maxLength", "t1", "minLength", "t2", "undefined", "t3", "t4", "query", "validChars", "PUNCTUATION", "match", "RegExp", "exec", "maybeLeadingWhitespace", "matchingString", "length", "leadOffset", "index", "replaceableString", "baseClass", "SlashMenuItem", "isSelected", "item", "onClick", "onMouseEnter", "ref", "fieldProps", "featureClientSchemaMap", "schemaPath", "useEditorConfigContext", "i18n", "useTranslation", "className", "key", "title", "label", "length", "substring", "_jsxs", "id", "role", "tabIndex", "type", "Icon", "_jsx", "SlashMenuPlugin", "anchorElem", "document", "body", "editor", "useLexicalComposerContext", "queryString", "setQueryString", "useState", "editorConfig", "checkForTriggerMatch", "useMenuTriggerMatch", "minLength", "getDynamicItems", "useCallback", "groupWithItems", "dynamicItem", "features", "slashMenu", "dynamicGroups", "dynamicGroupWithItems", "concat", "groups", "useMemo", "groupsWithItems", "groupWithItem", "push", "map", "group", "filteredItems", "items", "filter", "itemTitle", "RegExp", "exec", "keywords", "some", "keyword", "dynamicItemGroups", "dynamicGroup", "find", "LexicalTypeaheadMenuPlugin", "menuRenderFn", "anchorElementRef", "selectedItemKey", "selectItemAndCleanUp", "setSelectedItemKey", "current", "createPortal", "groupTitle", "oi", "index", "el", "onQueryChange", "triggerFn", "c", "_c", "useLexicalComposerContext", "TEXT_TYPE_TO_FORMAT", "TextNode", "useEffect", "TextPlugin", "t0", "$", "features", "editor", "t1", "enabledFormats", "disabledFormats", "getDisabledFormats", "length", "registerNodeTransform", "textNode", "forEach", "disabledFormat", "hasFormat", "toggleFormat", "t2", "highlight", "allFormats", "Object", "keys", "enabledSet", "Set", "filter", "format", "has", "c", "_c", "ContentEditable", "useTranslation", "LexicalContentEditable", "t0", "$", "className", "t", "t1", "_jsx", "placeholder", "children", "LexicalEditor", "props", "$", "_c", "editorConfig", "editorContainerRef", "onChange", "editorConfigContext", "useEditorConfigContext", "editor", "useLexicalComposerContext", "floatingAnchorElem", "setFloatingAnchorElem", "useState", "t0", "Symbol", "for", "_floatingAnchorElem", "onRef", "t1", "t2", "uuid", "console", "error", "parentEditor", "registerChild", "handleFocus", "focusEditor", "handleBlur", "blurEditor", "unregisterFocus", "registerCommand", "FOCUS_COMMAND", "COMMAND_PRIORITY_LOW", "unregisterBlur", "BLUR_COMMAND", "unregisterChild", "useEffect", "isSmallWidthViewport", "setIsSmallWidthViewport", "t3", "t4", "updateViewPortWidth", "isNextSmallWidthViewport", "window", "matchMedia", "matches", "addEventListener", "removeEventListener", "t5", "features", "t6", "editorState", "editor_0", "tags", "has", "size", "t7", "plugins", "_jsxs", "Fragment", "children", "isEditable", "_jsx", "DraggableBlockPlugin", "anchorElem", "AddBlockHandlePlugin", "map", "plugin_1", "plugin", "position", "desktopOnly", "EditorPlugin", "clientProps", "key", "SlashMenuPlugin", "_temp", "className", "ref", "_temp2", "RichTextPlugin", "contentEditable", "tabIndex", "LexicalContentEditable", "TextPlugin", "OnChangePlugin", "ignoreSelectionChange", "HistoryPlugin", "markdownTransformers", "length", "MarkdownShortcutPlugin", "_temp3", "_temp4", "_temp5", "plugin_0", "plugin_2", "plugin_3", "plugin_4", "NestProviders", "children", "providers", "length", "Component", "_jsx", "slice", "LexicalProvider", "props", "composerKey", "editorConfig", "fieldProps", "onChange", "readOnly", "value", "parentContext", "useEditorConfigContext", "editorContainerRef", "useRef", "initialConfig", "useMemo", "Error", "JSON", "stringify", "Array", "isArray", "editable", "editorState", "undefined", "namespace", "lexical", "nodes", "getEnabledNodes", "onError", "error", "theme", "LexicalComposer", "EditorConfigProvider", "features", "LexicalEditorComponent", "baseClass", "RichTextComponent", "props", "editorConfig", "field", "name", "admin", "className", "description", "readOnly", "readOnlyFromAdmin", "label", "localized", "required", "path", "pathFromProps", "readOnlyFromTopLevelProps", "validate", "readOnlyFromProps", "editDepth", "useEditDepth", "memoizedValidate", "useCallback", "value", "validationOptions", "customComponents", "AfterInput", "BeforeInput", "Description", "Error", "Label", "formInitializing", "formProcessing", "initialValue", "setValue", "showError", "useField", "disabled", "classes", "hideGutter", "filter", "Boolean", "join", "pathWithEditDepth", "handleChange", "editorState", "toJSON", "styles", "useMemo", "mergeFieldStyles", "_jsxs", "style", "_jsx", "RenderCustomComponent", "CustomComponent", "Fallback", "FieldError", "FieldLabel", "ErrorBoundary", "fallbackRender", "onReset", "LexicalProvider", "composerKey", "fieldProps", "onChange", "JSON", "stringify", "FieldDescription", "error", "role", "color", "message", "RichText", "withCondition"]
7
- }