@payloadcms/richtext-lexical 3.0.0-beta.95 → 3.0.0-beta.97
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/exports/client/Field-MPDY6IHA.js +2 -0
- package/dist/exports/client/Field-MPDY6IHA.js.map +7 -0
- package/dist/exports/client/{RelationshipComponent-EZORSGUZ.js → RelationshipComponent-CPYVT3XN.js} +2 -2
- package/dist/exports/client/bundled.css +1 -1
- package/dist/exports/client/{chunk-TD7O23AB.js → chunk-BR57XNHD.js} +2 -2
- package/dist/exports/client/{chunk-TD7O23AB.js.map → chunk-BR57XNHD.js.map} +1 -1
- package/dist/exports/client/{chunk-UJDWBQ2K.js → chunk-EPEFKP5H.js} +2 -2
- package/dist/exports/client/{chunk-UJDWBQ2K.js.map → chunk-EPEFKP5H.js.map} +1 -1
- package/dist/exports/client/chunk-GK7ZKYHL.js +2 -0
- package/dist/exports/client/chunk-GK7ZKYHL.js.map +7 -0
- package/dist/exports/client/{chunk-OLSILJA6.js → chunk-MFAXC4ZA.js} +2 -2
- package/dist/exports/client/{chunk-OLSILJA6.js.map → chunk-MFAXC4ZA.js.map} +2 -2
- package/dist/exports/client/{chunk-V2LKLT2F.js → chunk-PECDZEZY.js} +3 -3
- package/dist/exports/client/{chunk-V2LKLT2F.js.map → chunk-PECDZEZY.js.map} +3 -3
- package/dist/exports/client/{chunk-YL453UOS.js → chunk-XIBMVIFW.js} +2 -2
- package/dist/exports/client/{chunk-YL453UOS.js.map → chunk-XIBMVIFW.js.map} +1 -1
- package/dist/exports/client/{component-2YLEVOFH.js → component-3EGTURAI.js} +2 -2
- package/dist/exports/client/{component-2YLEVOFH.js.map → component-3EGTURAI.js.map} +1 -1
- package/dist/exports/client/{component-7RAP75FW.js → component-BRCRMQID.js} +2 -2
- package/dist/exports/client/{component-7RAP75FW.js.map → component-BRCRMQID.js.map} +1 -1
- package/dist/exports/client/{component-LLWMZU6K.js → component-GAX6BHKZ.js} +2 -2
- package/dist/exports/client/{componentInline-YSHGRL2J.js → componentInline-RETIC4OV.js} +2 -2
- package/dist/exports/client/index.d.ts +2 -2
- package/dist/exports/client/index.d.ts.map +1 -1
- package/dist/exports/client/index.js +5 -5
- package/dist/exports/client/index.js.map +4 -4
- package/dist/features/blocks/client/component/index.js.map +1 -1
- package/dist/features/blocks/client/plugin/index.js.map +1 -1
- package/dist/features/blocks/server/index.d.ts.map +1 -1
- package/dist/features/blocks/server/index.js +27 -25
- package/dist/features/blocks/server/index.js.map +1 -1
- package/dist/features/blocks/server/nodes/BlocksNode.d.ts +1 -1
- package/dist/features/blocks/server/nodes/BlocksNode.d.ts.map +1 -1
- package/dist/features/blocks/server/nodes/BlocksNode.js.map +1 -1
- package/dist/features/blocks/server/nodes/InlineBlocksNode.d.ts +1 -1
- package/dist/features/blocks/server/nodes/InlineBlocksNode.d.ts.map +1 -1
- package/dist/features/blocks/server/nodes/InlineBlocksNode.js.map +1 -1
- package/dist/features/converters/html/converter/index.d.ts +5 -5
- package/dist/features/converters/html/converter/index.d.ts.map +1 -1
- package/dist/features/converters/html/converter/index.js.map +1 -1
- package/dist/features/converters/html/converter/types.d.ts +1 -1
- package/dist/features/converters/html/converter/types.d.ts.map +1 -1
- package/dist/features/converters/html/converter/types.js.map +1 -1
- package/dist/features/converters/html/field/index.d.ts.map +1 -1
- package/dist/features/converters/html/field/index.js +3 -1
- package/dist/features/converters/html/field/index.js.map +1 -1
- package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.js +1 -1
- package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.js.map +1 -1
- package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.js.map +1 -1
- package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.d.ts +1 -1
- package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.d.ts.map +1 -1
- package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.js.map +1 -1
- package/dist/features/experimental_table/client/plugins/TablePlugin/index.js.map +1 -1
- package/dist/features/experimental_table/client/utils/debounce.js +4 -4
- package/dist/features/experimental_table/client/utils/debounce.js.map +1 -1
- package/dist/features/experimental_table/client/utils/useDebounce.js.map +1 -1
- package/dist/features/experimental_table/server/index.d.ts.map +1 -1
- package/dist/features/experimental_table/server/index.js +3 -1
- package/dist/features/experimental_table/server/index.js.map +1 -1
- package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.d.ts.map +1 -1
- package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.js +1 -1
- package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.js.map +1 -1
- package/dist/features/link/client/index.js +1 -1
- package/dist/features/link/client/index.js.map +1 -1
- package/dist/features/link/client/plugins/autoLink/index.d.ts.map +1 -1
- package/dist/features/link/client/plugins/autoLink/index.js +3 -1
- package/dist/features/link/client/plugins/autoLink/index.js.map +1 -1
- package/dist/features/link/client/plugins/floatingLinkEditor/index.d.ts.map +1 -1
- package/dist/features/link/client/plugins/floatingLinkEditor/index.js.map +1 -1
- package/dist/features/link/nodes/LinkNode.d.ts.map +1 -1
- package/dist/features/link/nodes/LinkNode.js +2 -2
- package/dist/features/link/nodes/LinkNode.js.map +1 -1
- package/dist/features/link/server/index.d.ts.map +1 -1
- package/dist/features/link/server/index.js +2 -0
- package/dist/features/link/server/index.js.map +1 -1
- package/dist/features/relationship/client/nodes/RelationshipNode.d.ts +1 -1
- package/dist/features/relationship/client/nodes/RelationshipNode.d.ts.map +1 -1
- package/dist/features/relationship/client/nodes/RelationshipNode.js.map +1 -1
- package/dist/features/relationship/server/nodes/RelationshipNode.d.ts +1 -1
- package/dist/features/relationship/server/nodes/RelationshipNode.d.ts.map +1 -1
- package/dist/features/relationship/server/nodes/RelationshipNode.js.map +1 -1
- package/dist/features/toolbars/fixed/client/Toolbar/index.js +1 -1
- package/dist/features/toolbars/fixed/client/Toolbar/index.js.map +1 -1
- package/dist/features/toolbars/inline/client/Toolbar/index.js +1 -1
- package/dist/features/toolbars/inline/client/Toolbar/index.js.map +1 -1
- package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.d.ts +2 -2
- package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.d.ts.map +1 -1
- package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js +10 -4
- package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js.map +1 -1
- package/dist/features/toolbars/shared/ToolbarDropdown/index.d.ts +2 -2
- package/dist/features/toolbars/shared/ToolbarDropdown/index.d.ts.map +1 -1
- package/dist/features/toolbars/shared/ToolbarDropdown/index.js +6 -6
- package/dist/features/toolbars/shared/ToolbarDropdown/index.js.map +1 -1
- package/dist/features/typesClient.d.ts +6 -6
- package/dist/features/typesClient.d.ts.map +1 -1
- package/dist/features/typesClient.js.map +1 -1
- package/dist/features/typesServer.d.ts +9 -8
- package/dist/features/typesServer.d.ts.map +1 -1
- package/dist/features/typesServer.js.map +1 -1
- package/dist/features/upload/client/component/index.js.map +1 -1
- package/dist/features/upload/client/nodes/UploadNode.d.ts.map +1 -1
- package/dist/features/upload/client/nodes/UploadNode.js +1 -1
- package/dist/features/upload/client/nodes/UploadNode.js.map +1 -1
- package/dist/features/upload/server/feature.server.d.ts.map +1 -1
- package/dist/features/upload/server/feature.server.js +5 -1
- package/dist/features/upload/server/feature.server.js.map +1 -1
- package/dist/field/Field.js +1 -1
- package/dist/field/Field.js.map +1 -1
- package/dist/field/bundled.css +1 -1
- package/dist/field/index.js +1 -1
- package/dist/field/index.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -5
- package/dist/index.js.map +1 -1
- package/dist/lexical/LexicalEditor.d.ts.map +1 -1
- package/dist/lexical/LexicalEditor.js +5 -5
- package/dist/lexical/LexicalEditor.js.map +1 -1
- package/dist/lexical/LexicalProvider.js +1 -1
- package/dist/lexical/LexicalProvider.js.map +1 -1
- package/dist/lexical/config/client/EditorConfigProvider.d.ts +1 -1
- package/dist/lexical/config/client/EditorConfigProvider.d.ts.map +1 -1
- package/dist/lexical/config/client/EditorConfigProvider.js +1 -1
- package/dist/lexical/config/client/EditorConfigProvider.js.map +1 -1
- package/dist/lexical/config/client/sanitize.js +1 -1
- package/dist/lexical/config/client/sanitize.js.map +1 -1
- package/dist/lexical/config/server/loader.d.ts +2 -1
- package/dist/lexical/config/server/loader.d.ts.map +1 -1
- package/dist/lexical/config/server/loader.js +2 -0
- package/dist/lexical/config/server/loader.js.map +1 -1
- package/dist/lexical/config/server/sanitize.d.ts +1 -1
- package/dist/lexical/config/server/sanitize.d.ts.map +1 -1
- package/dist/lexical/config/server/sanitize.js +2 -1
- package/dist/lexical/config/server/sanitize.js.map +1 -1
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.d.ts +3 -3
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.d.ts.map +1 -1
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js +5 -3
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js.map +1 -1
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.d.ts +1 -1
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.d.ts.map +1 -1
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.js.map +1 -1
- package/dist/lexical/plugins/SlashMenu/index.d.ts.map +1 -1
- package/dist/lexical/plugins/SlashMenu/index.js +1 -1
- package/dist/lexical/plugins/SlashMenu/index.js.map +1 -1
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js.map +1 -1
- package/dist/lexical/plugins/handles/utils/doesLineHeightAffectElement.d.ts.map +1 -1
- package/dist/lexical/plugins/handles/utils/doesLineHeightAffectElement.js +3 -1
- package/dist/lexical/plugins/handles/utils/doesLineHeightAffectElement.js.map +1 -1
- package/dist/lexical/plugins/handles/utils/getNodeCloseToPoint.js.map +1 -1
- package/dist/lexical/utils/nodeFormat.d.ts +2 -2
- package/dist/lexical/utils/nodeFormat.d.ts.map +1 -1
- package/dist/lexical/utils/nodeFormat.js.map +1 -1
- package/dist/lexical/utils/rect.d.ts.map +1 -1
- package/dist/lexical/utils/rect.js.map +1 -1
- package/dist/lexical/utils/url.d.ts.map +1 -1
- package/dist/lexical/utils/url.js +18 -6
- package/dist/lexical/utils/url.js.map +1 -1
- package/dist/types.d.ts +2 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/utilities/createServerFeature.d.ts +1 -0
- package/dist/utilities/createServerFeature.d.ts.map +1 -1
- package/dist/utilities/createServerFeature.js +2 -0
- package/dist/utilities/createServerFeature.js.map +1 -1
- package/dist/utilities/fieldsDrawer/DrawerContent.js.map +1 -1
- package/dist/validate/index.js +1 -1
- package/dist/validate/index.js.map +1 -1
- package/dist/validate/validateNodes.d.ts +2 -2
- package/dist/validate/validateNodes.d.ts.map +1 -1
- package/dist/validate/validateNodes.js +2 -2
- package/dist/validate/validateNodes.js.map +1 -1
- package/package.json +8 -6
- package/dist/exports/client/Field-SUWHJ4HF.js +0 -2
- package/dist/exports/client/Field-SUWHJ4HF.js.map +0 -7
- package/dist/exports/client/chunk-YSI2QILQ.js +0 -2
- package/dist/exports/client/chunk-YSI2QILQ.js.map +0 -7
- /package/dist/exports/client/{RelationshipComponent-EZORSGUZ.js.map → RelationshipComponent-CPYVT3XN.js.map} +0 -0
- /package/dist/exports/client/{component-LLWMZU6K.js.map → component-GAX6BHKZ.js.map} +0 -0
- /package/dist/exports/client/{componentInline-YSHGRL2J.js.map → componentInline-RETIC4OV.js.map} +0 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";import{a as ue,b as z,c as I,e as pe,f as ge,g as he,h as ye}from"./chunk-GK7ZKYHL.js";import{a as fe,b as T}from"./chunk-MFAXC4ZA.js";import{jsx as j,jsxs as me}from"react/jsx-runtime";import{FieldDescription as Yt,FieldError as Ut,FieldLabel as Vt,useField as qt,useFieldProps as Jt,withCondition as Qt}from"@payloadcms/ui";import{useCallback as Xt}from"react";import{ErrorBoundary as Zt}from"react-error-boundary";import{jsx as A}from"react/jsx-runtime";import{LexicalComposer as Wt}from"@lexical/react/LexicalComposer.js";import*as qe from"react";import{useMemo as Ve}from"react";import{c as Bt}from"react/compiler-runtime";import{jsx as P,jsxs as J}from"react/jsx-runtime";import{useLexicalComposerContext as Mt}from"@lexical/react/LexicalComposerContext.js";import{LexicalErrorBoundary as It}from"@lexical/react/LexicalErrorBoundary.js";import{HistoryPlugin as At}from"@lexical/react/LexicalHistoryPlugin.js";import{OnChangePlugin as Ft}from"@lexical/react/LexicalOnChangePlugin.js";import{RichTextPlugin as Dt}from"@lexical/react/LexicalRichTextPlugin.js";import{TabIndentationPlugin as Ot}from"@lexical/react/LexicalTabIndentationPlugin.js";import{BLUR_COMMAND as _t,COMMAND_PRIORITY_LOW as Ge,FOCUS_COMMAND as Ht}from"lexical";import*as U from"react";import{useEffect as We,useState as Ye}from"react";import{jsx as xe}from"react/jsx-runtime";import"react";var _=({anchorElem:t,clientProps:e,plugin:o})=>o.position==="floatingAnchorElem"?o.Component&&xe(o.Component,{anchorElem:t,clientProps:e}):o.Component&&xe(o.Component,{clientProps:e});import{jsx as ce}from"react/jsx-runtime";import{useLexicalComposerContext as nt}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as rt}from"lexical";import*as Ne from"react";import{useCallback as it,useEffect as Ce,useRef as st,useState as lt}from"react";import{createPortal as at}from"react-dom";var K=(t,e,o,l,r=50,m=25)=>{let p=0;if(t&&!t.contains(l)){let{bottom:a,left:u,right:g,top:E}=t.getBoundingClientRect(),d=E+window.scrollY,s=a+window.scrollY;if(o<d-m||o>s+m||e<u-r||e>g+r)return-1;(e<u||e>g)&&(p=e<u?e-u:e-g)}return p};import{$getNodeByKey as Z}from"lexical";function G(t){let e=t.getBoundingClientRect(),o=getComputedStyle(t).getPropertyValue("transform");if(!o||o==="none")return e;let l=o.split(",").pop();return e.y=e.y-Number(l.replace(")","")),e}function X(t){let e=(u,g)=>u?parseFloat(window.getComputedStyle(u)[g]):0,{marginBottom:o,marginTop:l}=window.getComputedStyle(t),r=e(t.previousElementSibling,"marginBottom"),m=e(t.nextElementSibling,"marginTop"),p=Math.max(parseFloat(l),r);return{marginBottom:Math.max(parseFloat(o),m),marginTop:p}}import{$getRoot as Xe}from"lexical";function H(t){return t.getEditorState().read(()=>Xe().getChildrenKeys())}var Ze=1,et=-1,Ee=0,L={props:null,result:null};function tt(t,e,o=20){let l=t.x-e.x,r=t.y-e.y;return l*l+r*r<=o*o}function W(t){let{anchorElem:e,cache_threshold:o=20,editor:l,fuzzy:r=!1,horizontalOffset:m=0,point:{x:p,y:a},startIndex:u=0,useEdgeAsDefault:g=!1,verbose:E=!1}=t;if(o>0&&L.props&&L.result&&L.props.fuzzy===t.fuzzy&&L.props.horizontalOffset===t.horizontalOffset&&L.props.useEdgeAsDefault===t.useEdgeAsDefault&&tt(L.props.point,t.point,o))return L.result;let d=e.getBoundingClientRect(),s=H(l),n={blockElem:null,blockNode:null,distance:1/0,foundAtIndex:-1,isFoundNodeEmptyParagraph:!1};return l.getEditorState().read(()=>{if(g){let[c,f]=[l.getElementByKey(s[0]),l.getElementByKey(s[s.length-1])],[i,x]=[G(c),G(f)];if(i&&x&&(a<i.top?(n.blockElem=c,n.distance=i.top-a,n.blockNode=Z(s[0]),n.foundAtIndex=0):a>x.bottom&&(n.distance=a-x.bottom,n.blockNode=Z(s[s.length-1]),n.blockElem=f,n.foundAtIndex=s.length-1),n?.blockElem))return{blockElem:null,isFoundNodeEmptyParagraph:!1}}let y=u,h=Ee;for(;y>=0&&y<s.length;){let c=s[y],f=l.getElementByKey(c);if(f===null)break;let i=new I(p+m,a),x=ye.fromDOMRect(G(f)),{marginBottom:b,marginTop:C}=X(f),w=x.generateNewRect({bottom:x.bottom+b,left:d.left,right:d.right,top:x.top-C}),{distance:R,isOnBottomSide:N,isOnTopSide:F}=w.distanceFromPoint(i);if(R===0){n.blockElem=f,n.blockNode=Z(c),n.foundAtIndex=y,n.distance=R,n.blockNode&&n.blockNode.getType()==="paragraph"&&n.blockNode.getTextContent()===""&&(!r&&!t.returnEmptyParagraphs&&(n.blockElem=null,n.blockNode=null),n.isFoundNodeEmptyParagraph=!0);break}else r&&R<n.distance&&(n.blockElem=f,n.blockNode=Z(c),n.distance=R,n.foundAtIndex=y);h===Ee&&(F?h=et:N?h=Ze:h=1/0),y+=h}}),L.props=t,L.result={blockElem:n.blockElem,blockNode:n.blockNode,foundAtIndex:n.foundAtIndex,isFoundNodeEmptyParagraph:n.isFoundNodeEmptyParagraph},{blockElem:n.blockElem,blockNode:n.blockNode,foundAtIndex:n.foundAtIndex,isFoundNodeEmptyParagraph:n.isFoundNodeEmptyParagraph}}function ee(t,e){return!!t.closest(`.${e}`)}var ot=["IMG","INPUT","TEXTAREA","SELECT","BUTTON","VIDEO","OBJECT","EMBED","IFRAME","HR"];function be(t){if(!t||ot.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,l=0){if(!t){e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)";return}let r=t.getBoundingClientRect(),m=window.getComputedStyle(t),p=e.getBoundingClientRect(),a=o.getBoundingClientRect(),u;if(["lexical-block","lexical-upload","lexical-relationship"].some(d=>t.firstElementChild?.classList.contains(d)))u=r.top+8-a.top;else{let d=be(t)?parseInt(m.lineHeight,10):0;u=r.top+(d-p.height)/2-a.top}let E=l;e.style.opacity="1",e.style.transform=`translate(${E}px, ${u}px)`}var ct="add-block-menu",oe=1/0;function dt(t){return t===0?1/0:oe>=0&&oe<t?oe:Math.floor(t/2)}function mt(t,e,o){let l=e.parentElement,{editorConfig:r}=T(),m=r?.admin?.hideGutter?-24:12,p=st(null),[a,u]=lt(null);Ce(()=>{function E(d){let s=d.target;if(!z(s))return;let n=K(l,d.pageX,d.pageY,s);if(n===-1){u(null);return}if(ee(s,ct))return;let y=H(t),{blockElem:h,blockNode:c,foundAtIndex:f}=W({anchorElem:e,cache_threshold:0,editor:t,horizontalOffset:-n,point:new I(d.x,d.y),returnEmptyParagraphs:!0,startIndex:dt(y.length),useEdgeAsDefault:!1});oe=f,h&&(a?.node!==c||a?.elem!==h)&&u({elem:h,node:c})}return document?.addEventListener("mousemove",E),()=>{document?.removeEventListener("mousemove",E)}},[l,e,t,a]),Ce(()=>{p.current&&a?.node&&te(a?.elem,p.current,e,m)},[e,a,m]);let g=it(E=>{let d=a;d?.node&&(t.update(()=>{let s=!0;if((d.node.getType()!=="paragraph"||d.node.getTextContent()!=="")&&(s=!1),!s){let n=rt();d.node.insertAfter(n),setTimeout(()=>{d={elem:t.getElementByKey(n.getKey()),node:n},u(d)},0)}}),setTimeout(()=>{t.update(()=>{t.focus(),d.node&&"select"in d.node&&typeof d.node.select=="function"&&d.node.select()})},1),setTimeout(()=>{t.dispatchCommand(ge,{node:d.node})},2),E.stopPropagation(),E.preventDefault())},[t,a]);return at(ce(Ne.Fragment,{children:ce("button",{className:"icon add-block-menu",onClick:E=>{g(E)},ref:p,type:"button",children:ce("div",{className:o?"icon":""})})}),e)}function Pe({anchorElem:t=document.body}){let[e]=nt();return mt(e,t,e._editable)}import{jsx as ne,jsxs as ft}from"react/jsx-runtime";import{useLexicalComposerContext as pt}from"@lexical/react/LexicalComposerContext.js";import{eventFiles as Re}from"@lexical/rich-text";import{$getNearestNodeFromDOMNode as Te,$getNodeByKey as gt}from"lexical";import*as Me from"react";import{useEffect as de,useRef as re,useState as Se}from"react";import{createPortal as ht}from"react-dom";var we=0,ut=-24;var $=0;function ke(t,e,o,l,r,m,p,a,u,g=!1){let{height:E,top:d}=l.getBoundingClientRect(),{top:s,width:n}=p.getBoundingClientRect(),{marginBottom:y,marginTop:h}=X(l),c=d,f=m>=d+E/2+window.scrollY,i=!1;if(r?.elem)if(l!==r?.elem)(f&&r?.elem&&r?.elem===l.nextElementSibling||!f&&r?.elem&&r?.elem===l.previousElementSibling)&&($++,$<200&&(i=!0));else{$++;let w=r?.boundingBox?.y,R=l.getBoundingClientRect().y;(f===r?.isBelow&&w===R||$<200)&&(i=!1)}if(i)return{isBelow:f,willStayInSamePosition:i};g?c+=E/2:f?c+=E+y/2:c-=h/2;let x=0;g||(f?x=-we:x=we);let b=c-s+x,C=ut-e;return o.style.width=`calc(${n}px - ${t})`,o.style.opacity=".8",o.style.transform=`translate(${C}px, calc(${b}px - 2px))`,r.elem.style.opacity="",r?.elem===l?f?r.elem.style.marginTop="":r.elem.style.marginBottom="":(r.elem.style.marginBottom="",r.elem.style.marginTop=""),$=0,{isBelow:f,willStayInSamePosition:i}}var yt="draggable-block-menu",ve="application/x-lexical-drag-block",q=1/0;function Le(t){return t===0?1/0:q>=0&&q<t?q:Math.floor(t/2)}function xt(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 Et(t,e,o){let l=e.parentElement,r=re(null),m=re(null),p=re(null),a=re(!1),[u,g]=Se(null),[E,d]=Se(null),{editorConfig:s}=T(),n=s?.admin?.hideGutter?-44:-8;de(()=>{function c(f){let i=f.target;if(!z(i))return;let x=K(l,f.pageX,f.pageY,i);if(x===-1){g(null);return}if(ee(i,yt))return;let b=H(t),{blockElem:C,foundAtIndex:w,isFoundNodeEmptyParagraph:R}=W({anchorElem:e,cache_threshold:0,editor:t,horizontalOffset:-x,point:new I(f.x,f.y),startIndex:Le(b.length),useEdgeAsDefault:!1,verbose:!1});q=w,!(!C&&!R)&&u!==C&&g(C)}return document?.addEventListener("mousemove",c),()=>{document?.removeEventListener("mousemove",c)}},[l,e,t,u]),de(()=>{r.current&&te(u,r.current,e,n)},[e,u,n]),de(()=>{function c(i){if(!a.current)return!1;let[x]=Re(i);if(x)return!1;let{pageY:b,target:C}=i;if(!z(C))return!1;let w=K(l,i.pageX,i.pageY,C,100,50),R=H(t),{blockElem:N,foundAtIndex:F,isFoundNodeEmptyParagraph:D}=W({anchorElem:e,editor:t,fuzzy:!0,horizontalOffset:-w,point:new I(i.x,i.y),startIndex:Le(R.length),useEdgeAsDefault:!0,verbose:!0});q=F;let S=m.current;if(N===null||S===null)return!1;if(u!==N){let{isBelow:v,willStayInSamePosition:V}=ke(s?.admin?.hideGutter?"0px":"3rem",n+(s?.admin?.hideGutter?r?.current?.getBoundingClientRect()?.width??0:-(r?.current?.getBoundingClientRect()?.width??0)),S,N,E,b,e,i,p,D);i.preventDefault(),V||d({boundingBox:N.getBoundingClientRect(),elem:N,isBelow:v})}else Be(S,E?.elem),d({boundingBox:N.getBoundingClientRect(),elem:N,isBelow:!1});return!0}function f(i){if(!a.current)return!1;let[x]=Re(i);if(x)return!1;let{dataTransfer:b,pageY:C,target:w}=i,R=b?.getData(ve)||"";return t.update(()=>{let N=gt(R);if(!N||!z(w))return!1;let F=K(l,i.pageX,i.pageY,w,100,50),{blockElem:D,isFoundNodeEmptyParagraph:S}=W({anchorElem:e,editor:t,fuzzy:!0,horizontalOffset:-F,point:new I(i.x,i.y),useEdgeAsDefault:!0});if(!D)return!1;let v=Te(D);if(!v)return!1;if(v===N)return!0;let{height:V,top:se}=G(D),ae=C>=se+V/2+window.scrollY;S?(v.insertBefore(N),v.remove()):ae?v.insertAfter(N):v.insertBefore(N),u!==null&&g(null),document.querySelectorAll(".lexical-block-highlighter").forEach(M=>{M.remove()});let O=t.getElementByKey(N.getKey());setTimeout(()=>{let M=O.getBoundingClientRect(),k=document.createElement("div");k.className="lexical-block-highlighter",k.style.backgroundColor="var(--theme-elevation-1000",k.style.transition="opacity 0.5s ease-in-out",k.style.zIndex="1",k.style.pointerEvents="none",k.style.boxSizing="border-box",k.style.borderRadius="4px",k.style.position="absolute",document.body.appendChild(k),k.style.opacity="0.1",k.style.height=`${M.height+8}px`,k.style.width=`${M.width+8}px`,k.style.top=`${M.top+window.scrollY-4}px`,k.style.left=`${M.left-4}px`,setTimeout(()=>{k.style.opacity="0",setTimeout(()=>{k.remove()},500)},1e3)},120)}),!0}return document.addEventListener("dragover",c),document.addEventListener("drop",f),()=>{document.removeEventListener("dragover",c),document.removeEventListener("drop",f)}},[l,n,e,t,E,u,s?.admin?.hideGutter]);function y(c){let f=c.dataTransfer;if(!f||!u)return;xt(f,u);let i="";t.update(()=>{let x=Te(u);x&&(i=x.getKey())}),a.current=!0,f.setData(ve,i)}function h(){a.current=!1,Be(m.current,E?.elem)}return ht(ft(Me.Fragment,{children:[ne("div",{className:"icon draggable-block-menu",draggable:!0,onDragEnd:h,onDragStart:y,ref:r,children:ne("div",{className:o?"icon":""})}),ne("div",{className:"draggable-block-target-line",ref:m}),ne("div",{className:"debug-highlight",ref:p})]}),e)}function Ie({anchorElem:t=document.body}){let[e]=pt();return Et(e,t,e._editable)}import{c as bt}from"react/compiler-runtime";import{jsx as Ct}from"react/jsx-runtime";import{MarkdownShortcutPlugin as Nt}from"@lexical/react/LexicalMarkdownShortcutPlugin.js";import"react";var Ae=()=>{let t=bt(2),{editorConfig:e}=T(),o;return t[0]!==e.features.markdownTransformers?(o=Ct(Nt,{transformers:e.features.markdownTransformers}),t[0]=e.features.markdownTransformers,t[1]=o):o=t[1],o};import{jsx as Y,jsxs as Oe}from"react/jsx-runtime";import{useLexicalComposerContext as wt}from"@lexical/react/LexicalComposerContext.js";import{useFieldProps as _e,useTranslation as He}from"@payloadcms/ui";import{useCallback as De,useMemo as kt,useState as Rt}from"react";import"react";import*as $e from"react-dom";import{c as Pt}from"react/compiler-runtime";import"react";function Fe(t,e){let o=Pt(4),{maxLength:l,minLength:r}=e,m=l===void 0?75:l,p=r===void 0?1:r,a;return o[0]!==t||o[1]!==m||o[2]!==p?(a=u=>{let{query:g}=u,E="[^"+t+pe+"\\s]",s=new RegExp("(^|\\s|\\()(["+t+"]((?:"+E+"){0,"+m+"}))$").exec(g);if(s!==null){let n=s[1],y=s[3];if(y.length>=p)return{leadOffset:s.index+n.length,matchingString:y,replaceableString:s[2]}}return null},o[0]=t,o[1]=m,o[2]=p,o[3]=a):a=o[3],a}var B="slash-menu-popup";function Tt({isSelected:t,item:e,onClick:o,onMouseEnter:l}){let{field:{richTextComponentMap:r}}=T(),{schemaPath:m}=_e(),{i18n:p}=He(),a=`${B}__item ${B}__item-${e.key}`;t&&(a+=` ${B}__item--selected`);let u=e.key;return e.label&&(u=typeof e.label=="function"?e.label({i18n:p,richTextComponentMap:r,schemaPath:m}):e.label),u.length>25&&(u=u.substring(0,25)+"..."),Oe("button",{"aria-selected":t,className:a,id:B+"__item-"+e.key,onClick:o,onMouseEnter:l,ref:g=>{e.ref={current:g}},role:"option",tabIndex:-1,type:"button",children:[e?.Icon&&Y(e.Icon,{}),Y("span",{className:`${B}__item-text`,children:u})]},e.key)}function je({anchorElem:t=document.body}){let[e]=wt(),[o,l]=Rt(null),{editorConfig:r}=T(),{i18n:m}=He(),{field:{richTextComponentMap:p}}=T(),{schemaPath:a}=_e(),u=Fe("/",{minLength:0}),g=De(()=>{let s=[];for(let n of r.features.slashMenu.dynamicGroups){let y=n({editor:e,queryString:o});s=s.concat(y)}return s},[e,o,r?.features]),E=kt(()=>{let s=[];for(let n of r?.features.slashMenu.groups??[])s.push(n);if(o){s=s.map(y=>{let h=y.items.filter(c=>{let f=c.key;return c.label&&(f=typeof c.label=="function"?c.label({i18n:m,richTextComponentMap:p,schemaPath:a}):c.label),new RegExp(o,"gi").exec(f)?!0:c.keywords!=null?c.keywords.some(i=>new RegExp(o,"gi").exec(i)):!1});return h.length?{...y,items:h}:null}),s=s.filter(y=>y!=null);let n=g();for(let y of n){let h=s.find(c=>c.key===y.key);h?s=s.filter(c=>c.key!==y.key):h={...y,items:[]},h?.items?.length&&(h.items=h.items.concat(h.items)),s.push(h)}}return s},[g,o,r?.features,m]),d=De((s,n,y,h)=>{n&&e.update(()=>{n.remove()}),s.onSelect({editor:e,queryString:h}),y()},[e]);return Y(he,{anchorElem:t,groups:E,menuRenderFn:(s,{selectedItemKey:n,selectItemAndCleanUp:y,setSelectedItemKey:h})=>s.current&&E.length?$e.createPortal(Y("div",{className:B,children:E.map(c=>{let f=c.key;return c.label&&(f=typeof c.label=="function"?c.label({i18n:m,richTextComponentMap:p,schemaPath:a}):c.label),Oe("div",{className:`${B}__group ${B}__group-${c.key}`,children:[Y("div",{className:`${B}__group-title`,children:f}),c.items.map((i,x)=>Y(Tt,{index:x,isSelected:n===i.key,item:i,onClick:()=>{h(i.key),y(i)},onMouseEnter:()=>{h(i.key)}},i.key))]},c.key)})}),s.current):null,onQueryChange:l,onSelectItem:d,triggerFn:u})}import{c as St}from"react/compiler-runtime";import{jsx as ze}from"react/jsx-runtime";import{ContentEditable as vt}from"@lexical/react/LexicalContentEditable.js";import{useTranslation as Lt}from"@payloadcms/ui";import"react";function Ke(t){let e=St(3),{className:o}=t,{t:l}=Lt(),r;return e[0]!==l||e[1]!==o?(r=ze(vt,{"aria-placeholder":l("lexical:general:placeholder"),className:o??"ContentEditable__root",placeholder:ze("p",{className:"editor-placeholder",children:l("lexical:general:placeholder")})}),e[0]=l,e[1]=o,e[2]=r):r=e[2],r}var Ue=t=>{let e=Bt(22),{editorConfig:o,editorContainerRef:l,onChange:r}=t,m=T(),[p]=Mt(),[a,u]=Ye(null),g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g=i=>{i!==null&&u(i)},e[0]=g):g=e[0];let E=g,d,s;e[1]!==m||e[2]!==p?(d=()=>{if(!m?.uuid){console.error("Lexical Editor must be used within an EditorConfigProvider");return}m?.parentEditor?.uuid&&m.parentEditor?.registerChild(m.uuid,m);let i=()=>{m.focusEditor(m)},x=()=>{m.blurEditor(m)},b=p.registerCommand(Ht,()=>(i(),!0),Ge),C=p.registerCommand(_t,()=>(x(),!0),Ge);return()=>{b(),C(),m.parentEditor?.unregisterChild?.(m.uuid)}},s=[p,m],e[1]=m,e[2]=p,e[3]=d,e[4]=s):(d=e[3],s=e[4]),We(d,s);let[n,y]=Ye(!1),h,c;e[5]!==n?(h=()=>{let i=()=>{let x=window.matchMedia("(max-width: 768px)").matches;x!==n&&y(x)};return i(),window.addEventListener("resize",i),()=>{window.removeEventListener("resize",i)}},c=[n],e[5]=n,e[6]=h,e[7]=c):(h=e[6],c=e[7]),We(h,c);let f;if(e[8]!==o.features||e[9]!==r||e[10]!==a||e[11]!==n||e[12]!==p||e[13]!==l){let i;e[15]!==r?(i=(b,C,w)=>{(!w.has("focus")||w.size>1)&&r?.(b,C,w)},e[15]=r,e[16]=i):i=e[16];let x;e[17]!==a||e[18]!==n||e[19]!==p||e[20]!==o?(x=a&&J(U.Fragment,{children:[!n&&p.isEditable()&&J(U.Fragment,{children:[P(Ie,{anchorElem:a}),P(Pe,{anchorElem:a})]}),o.features.plugins.map(b=>{if(b.position==="floatingAnchorElem"&&!(b.desktopOnly===!0&&n))return P(_,{anchorElem:a,clientProps:b.clientProps,plugin:b},b.key)}),p.isEditable()&&P(U.Fragment,{children:P(je,{anchorElem:a})})]}),e[17]=a,e[18]=n,e[19]=p,e[20]=o,e[21]=x):x=e[21],f=J(U.Fragment,{children:[o.features.plugins.map($t),J("div",{className:"editor-container",ref:l,children:[o.features.plugins.map(jt),P(Dt,{contentEditable:P("div",{className:"editor-scroller",children:P("div",{className:"editor",ref:E,children:P(Ke,{})})}),ErrorBoundary:It}),P(Ft,{ignoreSelectionChange:!0,onChange:i}),x,p.isEditable()&&J(U.Fragment,{children:[P(At,{}),o?.features?.markdownTransformers?.length>0&&P(Ae,{})]}),P(Ot,{}),o.features.plugins.map(zt),o.features.plugins.map(Kt)]}),o.features.plugins.map(Gt)]}),e[8]=o.features,e[9]=r,e[10]=a,e[11]=n,e[12]=p,e[13]=l,e[14]=f}else f=e[14];return f};function $t(t){if(t.position==="aboveContainer")return P(_,{clientProps:t.clientProps,plugin:t},t.key)}function jt(t){if(t.position==="top")return P(_,{clientProps:t.clientProps,plugin:t},t.key)}function zt(t){if(t.position==="normal")return P(_,{clientProps:t.clientProps,plugin:t},t.key)}function Kt(t){if(t.position==="bottom")return P(_,{clientProps:t.clientProps,plugin:t},t.key)}function Gt(t){if(t.position==="belowContainer")return P(_,{clientProps:t.clientProps,plugin:t},t.key)}var Je=({children:t,providers:e})=>{if(!e?.length)return t;let o=e[0];return e.length>1?A(o,{children:A(Je,{providers:e.slice(1),children:t})}):A(o,{children:t})},Qe=t=>{let{editorConfig:e,field:o,onChange:l,path:r,readOnly:m,value:p}=t,a=T(),u=qe.useRef(null),g=Ve(()=>{let d=p;return e?.features?.hooks?.load?.length&&e.features.hooks.load.forEach(s=>{d=s({incomingEditorState:d})}),d},[e,p]),E=Ve(()=>{if(g&&typeof g!="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(g));if(g&&Array.isArray(g)&&!("root"in g))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/beta/lexical/migration#migration-via-migration-script-recommended");if(g&&"jsonContent"in g)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/beta/lexical/migration#migrating-from-payload-plugin-lexical");return{editable:m!==!0,editorState:g!=null?JSON.stringify(g):void 0,namespace:e.lexical.namespace,nodes:[...ue({editorConfig:e})],onError:d=>{throw d},theme:e.lexical.theme}},[e,g,m]);return E?A(Wt,{initialConfig:E,children:A(fe,{editorConfig:e,editorContainerRef:u,field:o,parentContext:a,children:A(Je,{providers:e.features.providers,children:A(Ue,{editorConfig:e,editorContainerRef:u,onChange:l})})})},r):A("p",{children:"Loading..."})};import"./bundled.css";var ie="rich-text-lexical",eo=t=>{let{descriptionProps:e,editorConfig:o,errorProps:l,field:{name:r,_path:m,admin:{className:p,components:{Description:a,Error:u,Label:g},readOnly:E,style:d,width:s}={},label:n,required:y},field:h,labelProps:c,readOnly:f,validate:i}=t,x=f||E,b=Xt((Q,O)=>{if(typeof i=="function")return i(Q,{...O,props:t,required:y})},[i,y]),{path:C,readOnly:w}=Jt(),R=qt({path:C??m??r,validate:b}),{formInitializing:N,formProcessing:F,initialValue:D,path:S,setValue:v,showError:V,value:se}=R,le=x||w||F||N,ae=[ie,"field-type",p,V&&"error",le&&`${ie}--read-only`,o?.admin?.hideGutter!==!0?`${ie}--show-gutter`:null].filter(Boolean).join(" ");return me("div",{className:ae,style:{...d,width:s},children:[j(Ut,{CustomError:u,field:h,path:S,...l||{},alignCaret:"left"}),j(Vt,{field:h,Label:g,label:n,required:y,...c||{}}),me("div",{className:`${ie}__wrap`,children:[j(Zt,{fallbackRender:to,onReset:()=>{},children:j(Qe,{editorConfig:o,field:h,onChange:Q=>{let O=Q.toJSON();o?.features?.hooks?.save?.length&&o.features.hooks.save.forEach(M=>{O=M({incomingEditorState:O})}),v(O)},path:S,readOnly:le,value:se},JSON.stringify({initialValue:D,path:S}))}),j(Yt,{Description:a,field:h,...e||{}})]})]},S)};function to({error:t}){return me("div",{className:"errorBoundary",role:"alert",children:[j("p",{children:"Something went wrong:"}),j("pre",{style:{color:"red"},children:t.message})]})}var ar=Qt(eo);export{ar as RichText};
|
|
2
|
+
//# sourceMappingURL=Field-MPDY6IHA.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/ui/ContentEditable.tsx"],
|
|
4
|
+
"sourcesContent": ["'use client'\nimport type { SerializedEditorState } from 'lexical'\n\nimport {\n FieldDescription,\n FieldError,\n FieldLabel,\n useField,\n useFieldProps,\n withCondition,\n} from '@payloadcms/ui'\nimport React, { useCallback } 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 { LexicalProvider } from '../lexical/LexicalProvider.js'\nimport './bundled.css'\nimport './index.scss'\nimport '../lexical/theme/EditorTheme.scss'\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 descriptionProps,\n editorConfig,\n errorProps,\n field: {\n name,\n _path: pathFromProps,\n admin: {\n className,\n components: { Description, Error, Label },\n readOnly: readOnlyFromAdmin,\n style,\n width,\n } = {},\n label,\n required,\n },\n field,\n labelProps,\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 const readOnlyFromProps = readOnlyFromTopLevelProps || readOnlyFromAdmin\n\n const memoizedValidate = useCallback(\n (value, validationOptions) => {\n if (typeof validate === 'function') {\n return validate(value, { ...validationOptions, props, required })\n }\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 const { path: pathFromContext, readOnly: readOnlyFromContext } = useFieldProps()\n\n const fieldType = useField<SerializedEditorState>({\n path: pathFromContext ?? pathFromProps ?? name,\n validate: memoizedValidate,\n })\n\n const { formInitializing, formProcessing, initialValue, path, setValue, showError, value } =\n fieldType\n\n const disabled = readOnlyFromProps || readOnlyFromContext || 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 return (\n <div\n className={classes}\n key={path}\n style={{\n ...style,\n width,\n }}\n >\n <FieldError\n CustomError={Error}\n field={field}\n path={path}\n {...(errorProps || {})}\n alignCaret=\"left\"\n />\n <FieldLabel\n field={field}\n Label={Label}\n label={label}\n required={required}\n {...(labelProps || {})}\n />\n <div className={`${baseClass}__wrap`}>\n <ErrorBoundary fallbackRender={fallbackRender} onReset={() => {}}>\n <LexicalProvider\n editorConfig={editorConfig}\n field={field}\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={(editorState) => {\n let serializedEditorState = editorState.toJSON()\n\n // Transform state through save hooks\n if (editorConfig?.features?.hooks?.save?.length) {\n editorConfig.features.hooks.save.forEach((hook) => {\n serializedEditorState = hook({ incomingEditorState: serializedEditorState })\n })\n }\n\n setValue(serializedEditorState)\n }}\n path={path}\n readOnly={disabled}\n value={value}\n />\n </ErrorBoundary>\n <FieldDescription Description={Description} field={field} {...(descriptionProps || {})} />\n </div>\n </div>\n )\n}\n\nfunction fallbackRender({ error }): React.ReactElement {\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'\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 editorConfig: SanitizedClientEditorConfig\n field: LexicalRichTextFieldProps['field']\n onChange: (editorState: EditorState, editor: LexicalEditor, tags: Set<string>) => void\n path: string\n readOnly: boolean\n value: SerializedEditorState\n}\n\nconst NestProviders = ({ children, providers }) => {\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 { editorConfig, field, onChange, path, readOnly, value } = props\n\n const parentContext = useEditorConfigContext()\n\n const editorContainerRef = React.useRef<HTMLDivElement>(null)\n\n const processedValue = useMemo(() => {\n let processed = value\n if (editorConfig?.features?.hooks?.load?.length) {\n editorConfig.features.hooks.load.forEach((hook) => {\n processed = hook({ incomingEditorState: processed })\n })\n }\n return processed\n }, [editorConfig, value])\n\n // useMemo for the initialConfig that depends on readOnly and processedValue\n const initialConfig = useMemo<InitialConfigType>(() => {\n if (processedValue && typeof processedValue !== '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(processedValue),\n )\n }\n\n if (processedValue && Array.isArray(processedValue) && !('root' in processedValue)) {\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/beta/lexical/migration#migration-via-migration-script-recommended',\n )\n }\n\n if (processedValue && 'jsonContent' in processedValue) {\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/beta/lexical/migration#migrating-from-payload-plugin-lexical',\n )\n }\n\n return {\n editable: readOnly !== true,\n editorState: processedValue != null ? JSON.stringify(processedValue) : 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 }, [editorConfig, processedValue, readOnly])\n\n if (!initialConfig) {\n return <p>Loading...</p>\n }\n\n return (\n <LexicalComposer initialConfig={initialConfig} key={path}>\n <EditorConfigProvider\n editorConfig={editorConfig}\n editorContainerRef={editorContainerRef}\n field={field}\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 { TabIndentationPlugin } from '@lexical/react/LexicalTabIndentationPlugin.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 { LexicalContentEditable } from './ui/ContentEditable.js'\n\nexport const LexicalEditor: React.FC<\n {\n editorContainerRef: React.RefObject<HTMLDivElement>\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}>\n <LexicalContentEditable />\n </div>\n </div>\n }\n ErrorBoundary={LexicalErrorBoundary}\n />\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\n <TabIndentationPlugin />\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') {\n return (\n plugin.Component && <plugin.Component anchorElem={anchorElem} clientProps={clientProps} />\n )\n }\n\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 { type JSX, 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 (hoveredElement?.node !== blockNode || hoveredElement?.elem !== _emptyBlockElem) {\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) => {\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 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 verbose = 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 const [firstNodeRect, lastNodeRect] = [\n getBoundingClientRectWithoutTransform(firstNode),\n getBoundingClientRectWithoutTransform(lastNode),\n ]\n\n if (firstNodeRect && lastNodeRect) {\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)\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 {\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\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 hideTargetLine(targetLineRef.current, lastTargetBlock?.elem)\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'\nimport { highlightElemOriginalPosition } from './highlightElemOriginalPosition.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 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 animationTimer = 0\n return {\n isBelow,\n willStayInSamePosition,\n }\n}\n", "'use client'\n\nimport { MarkdownShortcutPlugin as LexicalMarkdownShortcutPlugin } from '@lexical/react/LexicalMarkdownShortcutPlugin.js'\nimport * as React from 'react'\n\nimport { useEditorConfigContext } from '../../config/client/EditorConfigProvider.js'\n\nexport const MarkdownShortcutPlugin: React.FC = () => {\n const { editorConfig } = useEditorConfigContext()\n\n return <LexicalMarkdownShortcutPlugin transformers={editorConfig.features.markdownTransformers} />\n}\n", "'use client'\nimport type { TextNode } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { useFieldProps, 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}: {\n index: number\n isSelected: boolean\n item: SlashMenuItemInternal\n onClick: () => void\n onMouseEnter: () => void\n}) {\n const {\n field: { richTextComponentMap },\n } = useEditorConfigContext()\n const { schemaPath } = useFieldProps()\n\n const { i18n } = useTranslation()\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({ i18n, richTextComponentMap, 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={(element) => {\n item.ref = { current: element }\n }}\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()\n const {\n field: { richTextComponentMap },\n } = useEditorConfigContext()\n const { schemaPath } = useFieldProps()\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 const dynamicGroupWithItems = dynamicItem({\n editor,\n queryString,\n })\n groupWithItems = groupWithItems.concat(dynamicGroupWithItems)\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 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({ i18n, richTextComponentMap, 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 }, [getDynamicItems, queryString, editorConfig?.features, i18n])\n\n const onSelectItem = useCallback(\n (\n selectedItem: SlashMenuItemType,\n nodeToRemove: null | TextNode,\n closeMenu: () => void,\n matchingString: string,\n ) => {\n if (nodeToRemove) {\n editor.update(() => {\n nodeToRemove.remove()\n })\n }\n selectedItem.onSelect({ editor, queryString: matchingString })\n\n closeMenu()\n },\n [editor],\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) {\n groupTitle =\n typeof group.label === 'function'\n ? group.label({ i18n, richTextComponentMap, 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 />\n ))}\n </div>\n )\n })}\n </div>,\n anchorElementRef.current,\n )\n : null\n }\n onQueryChange={setQueryString}\n onSelectItem={onSelectItem}\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 { 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": "uMAGA,OACEA,oBAAAA,GACAC,cAAAA,GACAC,cAAAA,GACAC,YAAAA,GACAC,iBAAAA,GACAC,iBAAAA,OACK,iBACP,OAAgBC,eAAAA,OAAmB,QACnC,OAASC,iBAAAA,OAAqB,+DCR9B,OAASC,mBAAAA,OAAuB,oCAChC,UAAYC,OAAW,QACvB,OAASC,WAAAA,OAAe,QCNxB,OAAAC,KAAAC,OAAA,2EACA,OAASC,6BAAAA,OAAiC,2CAC1C,OAASC,wBAAAA,OAA4B,yCACrC,OAASC,iBAAAA,OAAqB,yCAC9B,OAASC,kBAAAA,OAAs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AAA,CAAIpC,UAAW,GAAGX,EAAA,mBACjBgD,EAACK,GAAA,CAAcC,eAAgBA,GAAgBC,QAASA,IAAA,CAAO,WAC7DP,EAACQ,GAAA,CACCpD,aAAcA,EACdE,MAAOA,EAEPmD,SAAWC,GAAA,CACT,IAAIC,EAAwBD,EAAYE,OAAM,EAG1CxD,GAAcyD,UAAUC,OAAOC,MAAMC,QACvC5D,EAAayD,SAASC,MAAMC,KAAKE,QAASC,GAAA,CACxCP,EAAwBO,EAAK,CAAEC,oBAAqBR,CAAsB,CAAA,CAC5E,CAAA,EAGFpB,EAASoB,CAAA,CACX,EACA7B,KAAMA,EACNd,SAAUyB,GACVb,MAAOA,IAfFwC,KAAKC,UAAU,CAAE/B,aAAAA,EAAcR,KAAAA,CAAK,CAAA,CAAA,IAkB7CkB,EAACsB,GAAA,CAAiBzD,YAAaA,EAAaP,MAAOA,EAAQ,GAAIH,GAAoB,CAAC,SA3CjF2B,CAAA,CA+CX,EAEA,SAASwB,GAAe,CAAEiB,MAAAA,CAAK,EAAE,CAG/B,OACExB,GAAC,MAAA,CAAIpC,UAAU,gBAAgB6D,KAAK,kBAClCxB,EAAC,IAAA,UAAE,0BACHA,EAAC,MAAA,CAAI9B,MAAO,CAAEuD,MAAO,KAAM,WAAIF,EAAMG,YAG3C,CAEO,IAAMC,GAAqCC,GAAc3E,EAAA",
|
|
6
|
+
"names": ["FieldDescription", "FieldError", "FieldLabel", "useField", "useFieldProps", "withCondition", "useCallback", "ErrorBoundary", "LexicalComposer", "React", "useMemo", "c", "_c", "useLexicalComposerContext", "LexicalErrorBoundary", "HistoryPlugin", "OnChangePlugin", "RichTextPlugin", "TabIndentationPlugin", "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", "verbose", "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", "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", "useLexicalComposerContext", "_editable", "c", "_c", "MarkdownShortcutPlugin", "LexicalMarkdownShortcutPlugin", "MarkdownShortcutPlugin", "$", "_c", "editorConfig", "useEditorConfigContext", "t0", "features", "markdownTransformers", "_jsx", "LexicalMarkdownShortcutPlugin", "transformers", "useLexicalComposerContext", "useFieldProps", "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", "field", "richTextComponentMap", "useEditorConfigContext", "schemaPath", "useFieldProps", "i18n", "useTranslation", "className", "key", "title", "label", "length", "substring", "_jsxs", "id", "ref", "element", "current", "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", "onSelectItem", "selectedItem", "nodeToRemove", "closeMenu", "matchingString", "update", "remove", "onSelect", "LexicalTypeaheadMenuPlugin", "menuRenderFn", "anchorElementRef", "selectedItemKey", "selectItemAndCleanUp", "setSelectedItemKey", "createPortal", "groupTitle", "oi", "index", "onQueryChange", "triggerFn", "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", "_jsxs", "Fragment", "children", "isEditable", "_jsx", "DraggableBlockPlugin", "anchorElem", "AddBlockHandlePlugin", "plugins", "map", "plugin_1", "plugin", "position", "desktopOnly", "EditorPlugin", "clientProps", "key", "SlashMenuPlugin", "_temp", "className", "ref", "_temp2", "RichTextPlugin", "contentEditable", "LexicalContentEditable", "OnChangePlugin", "ignoreSelectionChange", "HistoryPlugin", "markdownTransformers", "length", "MarkdownShortcutPlugin", "TabIndentationPlugin", "_temp3", "_temp4", "_temp5", "plugin_0", "plugin_2", "plugin_3", "plugin_4", "NestProviders", "children", "providers", "length", "Component", "_jsx", "slice", "LexicalProvider", "props", "editorConfig", "field", "onChange", "path", "readOnly", "value", "parentContext", "useEditorConfigContext", "editorContainerRef", "useRef", "processedValue", "useMemo", "processed", "features", "hooks", "load", "forEach", "hook", "incomingEditorState", "initialConfig", "Error", "JSON", "stringify", "Array", "isArray", "editable", "editorState", "undefined", "namespace", "lexical", "nodes", "getEnabledNodes", "onError", "error", "theme", "LexicalComposer", "EditorConfigProvider", "LexicalEditorComponent", "baseClass", "RichTextComponent", "props", "descriptionProps", "editorConfig", "errorProps", "field", "name", "_path", "pathFromProps", "admin", "className", "components", "Description", "Error", "Label", "readOnly", "readOnlyFromAdmin", "style", "width", "label", "required", "labelProps", "readOnlyFromTopLevelProps", "validate", "readOnlyFromProps", "memoizedValidate", "useCallback", "value", "validationOptions", "path", "pathFromContext", "readOnlyFromContext", "useFieldProps", "fieldType", "useField", "formInitializing", "formProcessing", "initialValue", "setValue", "showError", "disabled", "classes", "hideGutter", "filter", "Boolean", "join", "_jsxs", "_jsx", "FieldError", "CustomError", "alignCaret", "FieldLabel", "ErrorBoundary", "fallbackRender", "onReset", "LexicalProvider", "onChange", "editorState", "serializedEditorState", "toJSON", "features", "hooks", "save", "length", "forEach", "hook", "incomingEditorState", "JSON", "stringify", "FieldDescription", "error", "role", "color", "message", "RichText", "withCondition"]
|
|
7
|
+
}
|
package/dist/exports/client/{RelationshipComponent-EZORSGUZ.js → RelationshipComponent-CPYVT3XN.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";import{a as S,d as x}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=RelationshipComponent-
|
|
1
|
+
"use client";import{a as S,d as x}from"./chunk-EPEFKP5H.js";import{b as E}from"./chunk-MFAXC4ZA.js";import{jsx as i,jsxs as C}from"react/jsx-runtime";import{useLexicalComposerContext as W}from"@lexical/react/LexicalComposerContext.js";import{useLexicalNodeSelection as Y}from"@lexical/react/useLexicalNodeSelection.js";import{mergeRegister as H}from"@lexical/utils";import{getTranslation as U}from"@payloadcms/translations";import{Button as w,useConfig as q,useDocumentDrawer as z,usePayloadAPI as F,useTranslation as G}from"@payloadcms/ui";import{$getNodeByKey as A,$getSelection as J,$isNodeSelection as Q,CLICK_COMMAND as V,COMMAND_PRIORITY_LOW as h,KEY_BACKSPACE_COMMAND as X,KEY_DELETE_COMMAND as Z}from"lexical";import ee,{useCallback as _,useEffect as te,useReducer as oe,useRef as ne,useState as se}from"react";var t="lexical-relationship",T={depth:0},ie=d=>{let{data:{relationTo:y,value:l},nodeKey:n}=d;if(typeof l=="object")throw new Error("Relationship value should be a string or number. The Lexical Relationship component should not receive the populated value object.");let u=ne(null),[o]=W(),[s,r,m]=Y(n),{field:g}=E(),{config:{collections:M,routes:{api:O},serverURL:B}}=q(),[a,le]=se(()=>M.find(e=>e.slug===y)),{i18n:I,t:p}=G(),[R,L]=oe(e=>e+1,0),[{data:v},{setParams:b}]=F(`${B}${O}/${a.slug}/${l}`,{initialParams:T}),[j,K,{closeDrawer:N}]=z({id:l,collectionSlug:a.slug}),P=_(()=>{o.update(()=>{A(n).remove()})},[o,n]),k=ee.useCallback(({doc:e})=>{b({...T,cacheBust:R}),N(),L()},[R,b,N]),f=_(e=>{if(s&&Q(J())){e.preventDefault();let $=A(n);if(x($))return $.remove(),!0}return!1},[s,n]),D=_(e=>{let c=e;return c.target===u.current||u.current?.contains(c.target)?(c.shiftKey?r(!s):s||(m(),r(!0)),!0):!1},[s,r,m]);return te(()=>H(o.registerCommand(V,D,h),o.registerCommand(Z,f,h),o.registerCommand(X,f,h)),[m,o,s,n,f,r,D]),C("div",{className:[t,s&&`${t}--selected`].filter(Boolean).join(" "),contentEditable:!1,ref:u,children:[C("div",{className:`${t}__wrap`,children:[i("p",{className:`${t}__label`,children:p("fields:labelRelationship",{label:U(a.labels.singular,I)})}),i(K,{className:`${t}__doc-drawer-toggler`,children:i("p",{className:`${t}__title`,children:v?v[a?.admin?.useAsTitle||"id"]:l})})]}),o.isEditable()&&C("div",{className:`${t}__actions`,children:[i(w,{buttonStyle:"icon-label",className:`${t}__swapButton`,disabled:g?.admin?.readOnly,el:"div",icon:"swap",onClick:()=>{o.dispatchCommand(S,{replace:{nodeKey:n}})},round:!0,tooltip:p("fields:swapRelationship")}),i(w,{buttonStyle:"icon-label",className:`${t}__removeButton`,disabled:g?.admin?.readOnly,icon:"x",onClick:e=>{e.preventDefault(),P()},round:!0,tooltip:p("fields:removeRelationship")})]}),!!l&&i(j,{onSave:k})]})},ge=d=>i(ie,{...d});export{ge as RelationshipComponent};
|
|
2
|
+
//# sourceMappingURL=RelationshipComponent-CPYVT3XN.js.map
|