@payloadcms/richtext-lexical 4.0.0-canary.2 → 4.0.0-internal.011fd46
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-VQX3RNMF.js +2 -0
- package/dist/exports/client/{Field-G5Z2HM5Y.js.map → Field-VQX3RNMF.js.map} +3 -3
- package/dist/exports/client/bundled.css +1 -1
- package/dist/exports/client/chunk-X3D4LZS7.js +2 -0
- package/dist/exports/client/chunk-X3D4LZS7.js.map +7 -0
- package/dist/exports/client/index.js +22 -20
- package/dist/exports/client/index.js.map +4 -4
- package/dist/features/blockquote/markdownTransformer.d.ts +1 -1
- package/dist/features/blockquote/markdownTransformer.d.ts.map +1 -1
- package/dist/features/blockquote/markdownTransformer.js.map +1 -1
- package/dist/features/blocks/client/markdown/getLexicalToMarkdown.d.ts +1 -1
- package/dist/features/blocks/client/markdown/getLexicalToMarkdown.d.ts.map +1 -1
- package/dist/features/blocks/client/markdown/getLexicalToMarkdown.js +1 -1
- package/dist/features/blocks/client/markdown/getLexicalToMarkdown.js.map +1 -1
- package/dist/features/blocks/client/markdown/getMarkdownToLexical.d.ts +1 -1
- package/dist/features/blocks/client/markdown/getMarkdownToLexical.d.ts.map +1 -1
- package/dist/features/blocks/client/markdown/getMarkdownToLexical.js +1 -1
- package/dist/features/blocks/client/markdown/getMarkdownToLexical.js.map +1 -1
- package/dist/features/blocks/client/markdown/markdownTransformer.d.ts +1 -2
- package/dist/features/blocks/client/markdown/markdownTransformer.d.ts.map +1 -1
- package/dist/features/blocks/client/markdown/markdownTransformer.js.map +1 -1
- package/dist/features/blocks/server/markdown/markdownTransformer.d.ts +1 -1
- package/dist/features/blocks/server/markdown/markdownTransformer.d.ts.map +1 -1
- package/dist/features/blocks/server/markdown/markdownTransformer.js.map +1 -1
- package/dist/features/converters/lexicalToMarkdown/index.d.ts.map +1 -1
- package/dist/features/converters/lexicalToMarkdown/index.js +1 -1
- package/dist/features/converters/lexicalToMarkdown/index.js.map +1 -1
- package/dist/features/converters/markdownToLexical/index.js +1 -1
- package/dist/features/converters/markdownToLexical/index.js.map +1 -1
- package/dist/features/experimental_table/markdownTransformer.d.ts +1 -1
- package/dist/features/experimental_table/markdownTransformer.d.ts.map +1 -1
- package/dist/features/experimental_table/markdownTransformer.js +1 -1
- package/dist/features/experimental_table/markdownTransformer.js.map +1 -1
- package/dist/features/format/bold/markdownTransformers.d.ts +1 -1
- package/dist/features/format/bold/markdownTransformers.d.ts.map +1 -1
- package/dist/features/format/bold/markdownTransformers.js.map +1 -1
- package/dist/features/format/inlineCode/markdownTransformers.d.ts +1 -1
- package/dist/features/format/inlineCode/markdownTransformers.d.ts.map +1 -1
- package/dist/features/format/inlineCode/markdownTransformers.js.map +1 -1
- package/dist/features/format/italic/markdownTransformers.d.ts +1 -1
- package/dist/features/format/italic/markdownTransformers.d.ts.map +1 -1
- package/dist/features/format/italic/markdownTransformers.js.map +1 -1
- package/dist/features/format/strikethrough/markdownTransformers.d.ts +1 -1
- package/dist/features/format/strikethrough/markdownTransformers.d.ts.map +1 -1
- package/dist/features/format/strikethrough/markdownTransformers.js.map +1 -1
- package/dist/features/heading/markdownTransformer.d.ts +1 -1
- package/dist/features/heading/markdownTransformer.d.ts.map +1 -1
- package/dist/features/heading/markdownTransformer.js.map +1 -1
- package/dist/features/horizontalRule/client/markdownTransformer.d.ts +1 -1
- package/dist/features/horizontalRule/client/markdownTransformer.d.ts.map +1 -1
- package/dist/features/horizontalRule/client/markdownTransformer.js.map +1 -1
- package/dist/features/horizontalRule/server/markdownTransformer.d.ts +1 -1
- package/dist/features/horizontalRule/server/markdownTransformer.d.ts.map +1 -1
- package/dist/features/horizontalRule/server/markdownTransformer.js.map +1 -1
- package/dist/features/link/markdownTransformer.d.ts +1 -1
- package/dist/features/link/markdownTransformer.d.ts.map +1 -1
- package/dist/features/link/markdownTransformer.js.map +1 -1
- package/dist/features/link/markdownTransformer.spec.js +1 -1
- package/dist/features/link/markdownTransformer.spec.js.map +1 -1
- package/dist/features/lists/checklist/markdownTransformers.d.ts +1 -1
- package/dist/features/lists/checklist/markdownTransformers.d.ts.map +1 -1
- package/dist/features/lists/checklist/markdownTransformers.js.map +1 -1
- package/dist/features/lists/orderedList/markdownTransformer.d.ts +1 -1
- package/dist/features/lists/orderedList/markdownTransformer.d.ts.map +1 -1
- package/dist/features/lists/orderedList/markdownTransformer.js.map +1 -1
- package/dist/features/lists/shared/markdown.d.ts +1 -1
- package/dist/features/lists/shared/markdown.d.ts.map +1 -1
- package/dist/features/lists/shared/markdown.js.map +1 -1
- package/dist/features/lists/unorderedList/markdownTransformer.d.ts +1 -1
- package/dist/features/lists/unorderedList/markdownTransformer.d.ts.map +1 -1
- package/dist/features/lists/unorderedList/markdownTransformer.js.map +1 -1
- package/dist/features/toolbars/shared/useToolbarStates.d.ts.map +1 -1
- package/dist/features/toolbars/shared/useToolbarStates.js +3 -1
- package/dist/features/toolbars/shared/useToolbarStates.js.map +1 -1
- package/dist/features/typesClient.d.ts +1 -1
- package/dist/features/typesClient.d.ts.map +1 -1
- package/dist/features/typesClient.js.map +1 -1
- package/dist/features/typesServer.d.ts +1 -1
- package/dist/features/typesServer.d.ts.map +1 -1
- package/dist/features/typesServer.js.map +1 -1
- package/dist/features/upload/server/markdownTransformer.d.ts +1 -1
- package/dist/features/upload/server/markdownTransformer.d.ts.map +1 -1
- package/dist/features/upload/server/markdownTransformer.js.map +1 -1
- package/dist/field/bundled.css +1 -1
- package/dist/field/index.css +3 -4
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/lexical/plugins/MarkdownShortcut/index.d.ts.map +1 -1
- package/dist/lexical/plugins/MarkdownShortcut/index.js +1 -1
- package/dist/lexical/plugins/MarkdownShortcut/index.js.map +1 -1
- package/dist/lexical/utils/markdown/createBlockNode.d.ts +1 -1
- package/dist/lexical/utils/markdown/createBlockNode.d.ts.map +1 -1
- package/dist/lexical/utils/markdown/createBlockNode.js.map +1 -1
- package/dist/lexical/utils/markdown/normalizeMarkdown.d.ts +28 -0
- package/dist/lexical/utils/markdown/normalizeMarkdown.d.ts.map +1 -0
- package/dist/lexical/utils/markdown/normalizeMarkdown.js +95 -0
- package/dist/lexical/utils/markdown/normalizeMarkdown.js.map +1 -0
- package/dist/lexical-proxy/@lexical-markdown.d.ts +40 -1
- package/dist/lexical-proxy/@lexical-markdown.d.ts.map +1 -1
- package/dist/lexical-proxy/@lexical-markdown.js +56 -1
- package/dist/lexical-proxy/@lexical-markdown.js.map +1 -1
- package/dist/lexical-proxy/@lexical-markdown.spec.js +89 -0
- package/dist/lexical-proxy/@lexical-markdown.spec.js.map +1 -0
- package/dist/utilities/fieldsDrawer/index.css +0 -4
- package/package.json +21 -25
- package/dist/exports/client/Field-G5Z2HM5Y.js +0 -2
- package/dist/exports/client/chunk-LH634DPU.js +0 -12
- package/dist/exports/client/chunk-LH634DPU.js.map +0 -7
- package/dist/lexical-proxy/@lexical-react/LexicalContextMenuPlugin.d.ts +0 -2
- package/dist/lexical-proxy/@lexical-react/LexicalContextMenuPlugin.d.ts.map +0 -1
- package/dist/lexical-proxy/@lexical-react/LexicalContextMenuPlugin.js +0 -2
- package/dist/lexical-proxy/@lexical-react/LexicalContextMenuPlugin.js.map +0 -1
- package/dist/packages/@lexical/markdown/MarkdownExport.d.ts +0 -14
- package/dist/packages/@lexical/markdown/MarkdownExport.d.ts.map +0 -1
- package/dist/packages/@lexical/markdown/MarkdownExport.js +0 -213
- package/dist/packages/@lexical/markdown/MarkdownExport.js.map +0 -1
- package/dist/packages/@lexical/markdown/MarkdownImport.d.ts +0 -19
- package/dist/packages/@lexical/markdown/MarkdownImport.d.ts.map +0 -1
- package/dist/packages/@lexical/markdown/MarkdownImport.js +0 -198
- package/dist/packages/@lexical/markdown/MarkdownImport.js.map +0 -1
- package/dist/packages/@lexical/markdown/MarkdownShortcuts.d.ts +0 -11
- package/dist/packages/@lexical/markdown/MarkdownShortcuts.d.ts.map +0 -1
- package/dist/packages/@lexical/markdown/MarkdownShortcuts.js +0 -304
- package/dist/packages/@lexical/markdown/MarkdownShortcuts.js.map +0 -1
- package/dist/packages/@lexical/markdown/MarkdownTransformers.d.ts +0 -147
- package/dist/packages/@lexical/markdown/MarkdownTransformers.d.ts.map +0 -1
- package/dist/packages/@lexical/markdown/MarkdownTransformers.js +0 -268
- package/dist/packages/@lexical/markdown/MarkdownTransformers.js.map +0 -1
- package/dist/packages/@lexical/markdown/importTextFormatTransformer.d.ts +0 -22
- package/dist/packages/@lexical/markdown/importTextFormatTransformer.d.ts.map +0 -1
- package/dist/packages/@lexical/markdown/importTextFormatTransformer.js +0 -91
- package/dist/packages/@lexical/markdown/importTextFormatTransformer.js.map +0 -1
- package/dist/packages/@lexical/markdown/importTextMatchTransformer.d.ts +0 -21
- package/dist/packages/@lexical/markdown/importTextMatchTransformer.d.ts.map +0 -1
- package/dist/packages/@lexical/markdown/importTextMatchTransformer.js +0 -54
- package/dist/packages/@lexical/markdown/importTextMatchTransformer.js.map +0 -1
- package/dist/packages/@lexical/markdown/importTextTransformers.d.ts +0 -18
- package/dist/packages/@lexical/markdown/importTextTransformers.d.ts.map +0 -1
- package/dist/packages/@lexical/markdown/importTextTransformers.js +0 -54
- package/dist/packages/@lexical/markdown/importTextTransformers.js.map +0 -1
- package/dist/packages/@lexical/markdown/index.d.ts +0 -29
- package/dist/packages/@lexical/markdown/index.d.ts.map +0 -1
- package/dist/packages/@lexical/markdown/index.js +0 -39
- package/dist/packages/@lexical/markdown/index.js.map +0 -1
- package/dist/packages/@lexical/markdown/utils.d.ts +0 -34
- package/dist/packages/@lexical/markdown/utils.d.ts.map +0 -1
- package/dist/packages/@lexical/markdown/utils.js +0 -267
- package/dist/packages/@lexical/markdown/utils.js.map +0 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var P=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";import{c as ct}from"react/compiler-runtime";import{useRef as lt}from"react";function Gt(i){let t=ct(2),e=i===void 0?500:i,o=lt(void 0),n;return t[0]!==e?(n=c=>new Promise(a=>{let s=()=>{c(),a()};"requestIdleCallback"in window?("cancelIdleCallback"in window&&o.current!==void 0&&cancelIdleCallback(o.current),o.current=requestIdleCallback(s,{timeout:e})):at().then(s)}),t[0]=e,t[1]=n):n=t[1],n}function at(){return new Promise(i=>{setTimeout(i,100),requestAnimationFrame(()=>{setTimeout(i,0)})})}import{jsx as ut}from"react/jsx-runtime";import{useControllableState as ft}from"@payloadcms/ui";import{createContext as dt,use as mt,useMemo as ht}from"react";var V=dt({currentView:"default",inheritable:!1,setCurrentView:()=>{}}),oe=i=>{let t=pt(),e=i.currentView!==void 0,o=t.inheritable&&(!!t.views||!!t.hasExplicitCurrentView),n=e||t.inheritable&&!!t.hasExplicitCurrentView,{children:r,currentView:c,inheritable:a,views:s}={children:i.children,currentView:o?t.currentView:i.currentView,inheritable:t.inheritable||i.inheritable,views:o&&t.views?t.views:i.views},[f,d]=ft(c,"default"),m=s&&f!=="default"&&!s[f]?"default":f,h=ht(()=>{let y=s?s[m]:void 0;return{currentView:m,currentViewMap:y,hasExplicitCurrentView:n,inheritable:a,isControlledByParent:o,setCurrentView:d,views:s}},[m,a,n,o,d,s]);return ut(V,{value:h,children:r})};function pt(){return mt(V)}var T=class{_x;_y;constructor(t,e){this._x=t,this._y=e}calcDeltaXTo({x:t}){return this.x-t}calcDeltaYTo({y:t}){return this.y-t}calcDistanceTo(t){return Math.sqrt(Math.pow(this.calcDeltaXTo(t),2)+Math.pow(this.calcDeltaYTo(t),2))}calcHorizontalDistanceTo(t){return Math.abs(this.calcDeltaXTo(t))}calcVerticalDistance(t){return Math.abs(this.calcDeltaYTo(t))}equals({x:t,y:e}){return this.x===t&&this.y===e}get x(){return this._x}get y(){return this._y}};function $(i){return i instanceof T}import{jsx as At}from"react/jsx-runtime";import{useLexicalComposerContext as Lt}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Bt}from"@lexical/utils";import{$getSelection as I,$isRangeSelection as N,$isTextNode as Pt,COMMAND_PRIORITY_LOW as Vt,createCommand as $t,getDOMSelection as Yt}from"lexical";import{useCallback as J,useEffect as G,useState as Wt}from"react";import*as v from"react";import{c as q}from"react/compiler-runtime";import{useLexicalComposerContext as U}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Y}from"@lexical/utils";import{$getSelection as F,$isRangeSelection as gt,$setSelection as _t,COMMAND_PRIORITY_LOW as W,COMMAND_PRIORITY_NORMAL as C,createCommand as wt,KEY_ARROW_DOWN_COMMAND as yt,KEY_ARROW_UP_COMMAND as Ot,KEY_ENTER_COMMAND as xt,KEY_ESCAPE_COMMAND as bt,KEY_TAB_COMMAND as Ct}from"lexical";import{useCallback as E,useEffect as x,useLayoutEffect as St,useMemo as Mt,useRef as Rt,useState as Dt}from"react";var Tt="slash-menu-popup",H=i=>{let t=document.getElementById("slash-menu");if(!t)return;let e=t.getBoundingClientRect();e.top+e.height>window.innerHeight&&t.scrollIntoView({block:"center"}),e.top<0&&t.scrollIntoView({block:"center"}),i.scrollIntoView({block:"nearest"})};function Et(i,t,e){let o=e;for(let n=o;n<=t.length;n++)i.substring(i.length-n)===t.substring(0,n)&&(o=n);return o}function vt(i){let t=F();if(!gt(t)||!t.isCollapsed())return;let e=t.anchor;if(e.type!=="text")return;let o=e.getNode();if(!o.isSimpleText())return;let n=e.offset,r=o.getTextContent().slice(0,n),c=i.replaceableString.length,a=Et(r,i.matchingString,c),s=n-a;if(s<0)return;let f;return s===0?[f]=o.splitText(n):[,f]=o.splitText(s,n),f}function It(i,t){let e=getComputedStyle(i),o=e.position==="absolute",n=t?/(auto|scroll|hidden)/:/(auto|scroll)/;if(e.position==="fixed")return document.body;for(let r=i;r=r.parentElement;)if(e=getComputedStyle(r),!(o&&e.position==="static")&&n.test(e.overflow+e.overflowY+e.overflowX))return r;return document.body}function X(i,t){let e=i.getBoundingClientRect(),o=t.getBoundingClientRect();return e.top>o.top&&e.top<o.bottom}function Nt(i,t,e,o){let n=q(7),[r]=U(),c,a;n[0]!==r||n[1]!==e||n[2]!==o||n[3]!==i||n[4]!==t?(c=()=>{let s=t.current;if(s!=null&&i!=null){let f=r.getRootElement(),d=f!=null?It(f,!1):document.body,m=!1,h=X(s,d),y=function(){m||(window.requestAnimationFrame(function(){e(),m=!1}),m=!0);let l=X(s,d);l!==h&&(h=l,o?.(l))},u=new ResizeObserver(e);return window.addEventListener("resize",e),document.addEventListener("scroll",y,{capture:!0,passive:!0}),u.observe(s),()=>{u.disconnect(),window.removeEventListener("resize",e),document.removeEventListener("scroll",y,!0)}}},a=[r,o,e,i,t],n[0]=r,n[1]=e,n[2]=o,n[3]=i,n[4]=t,n[5]=c,n[6]=a):(c=n[5],a=n[6]),x(c,a)}var j=wt("SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND");function z({anchorElementRef:i,close:t,editor:e,groups:o,menuRenderFn:n,resolution:r,shouldSplitNodeWithQuery:c=!1}){let[a,s]=Dt(null),f=r.match&&r.match.matchingString||"",d=E(u=>{let l=e.getRootElement();l!==null&&(l.setAttribute("aria-activedescendant",`${Tt}__item-${u.key}`),s(u.key))},[e]),m=E(()=>{if(o!==null&&f!=null){let u=o.flatMap(l=>l.items);if(u.length){let l=u[0];d(l)}}},[o,d,f]);x(()=>{m()},[f,m]);let h=E(u=>{t(),e.update(()=>{let l=r.match!=null&&c?vt(r.match):null;l&&l.remove()}),setTimeout(()=>{let l;e.read(()=>{l=F()?.clone()}),e.update(()=>{l&&_t(l)}),u.onSelect({editor:e,queryString:r.match?r.match.matchingString:""})},0)},[e,c,r.match,t]);x(()=>()=>{let u=e.getRootElement();u!==null&&u.removeAttribute("aria-activedescendant")},[e]),St(()=>{o===null?s(null):a===null&&m()},[o,a,d,m]),x(()=>Y(e.registerCommand(j,({item:u})=>u.ref&&u.ref.current!=null?(H(u.ref.current),!0):!1,W)),[e,d]),x(()=>Y(e.registerCommand(yt,u=>{let l=u;if(o!==null&&o.length&&a!==null){let g=o.flatMap(_=>_.items),p=g.findIndex(_=>_.key===a),O=p!==g.length-1?p+1:0,w=g[O];if(!w)return!1;d(w),w.ref!=null&&w.ref.current&&e.dispatchCommand(j,{index:O,item:w}),l.preventDefault(),l.stopImmediatePropagation()}return!0},C),e.registerCommand(Ot,u=>{let l=u;if(o!==null&&o.length&&a!==null){let g=o.flatMap(_=>_.items),p=g.findIndex(_=>_.key===a),O=p!==0?p-1:g.length-1,w=g[O];if(!w)return!1;d(w),w.ref!=null&&w.ref.current&&H(w.ref.current),l.preventDefault(),l.stopImmediatePropagation()}return!0},C),e.registerCommand(bt,u=>{let l=u;return l.preventDefault(),l.stopImmediatePropagation(),t(),!0},W),e.registerCommand(Ct,u=>{let l=u;if(o===null||a===null)return!1;let p=o.flatMap(O=>O.items).find(O=>O.key===a);return p?(l.preventDefault(),l.stopImmediatePropagation(),h(p),!0):!1},C),e.registerCommand(xt,u=>{if(o===null||a===null)return!1;let g=o.flatMap(p=>p.items).find(p=>p.key===a);return g?(u!==null&&(u.preventDefault(),u.stopImmediatePropagation()),h(g),!0):!1},C)),[h,t,e,o,a,d]);let y=Mt(()=>({groups:o,selectedItemKey:a,selectItemAndCleanUp:h,setSelectedItemKey:s}),[h,a,o]);return n(i,y,r.match?r.match.matchingString:"")}function kt(i,t){t!=null&&(i.className=t),i.setAttribute("aria-label","Slash menu"),i.setAttribute("role","listbox"),i.style.display="block",i.style.position="absolute"}function K(i,t,e,o){let n=q(14),[r]=U(),c;n[0]===Symbol.for("react.memo_cache_sentinel")?(c=P?document.createElement("div"):null,n[0]=c):c=n[0];let a=Rt(c),s;n[1]!==i||n[2]!==o||n[3]!==r||n[4]!==t?(s=()=>{if(a.current===null||parent===void 0)return;let u=r.getRootElement(),l=a.current,g=l.firstChild;if(u!==null&&t!==null){let{height:p,width:O}=t.getRect(),{left:w,top:_}=t.getRect(),S=_;if(_=_-(i.getBoundingClientRect().top+window.scrollY),w=w-(i.getBoundingClientRect().left+window.scrollX),l.style.left=`${w+window.scrollX}px`,l.style.height=`${p}px`,l.style.width=`${O}px`,g!==null){let M=g.getBoundingClientRect(),A=M.height,R=M.width,D=u.getBoundingClientRect(),L=document.dir==="rtl"||document.documentElement.dir==="rtl",ot=i.getBoundingClientRect(),B=Math.max(0,D.left);if(!L&&w+R>D.right)l.style.left=`${D.right-R+window.scrollX}px`;else if(L&&M.left<B){let st=B+R-ot.left;l.style.left=`${st+window.scrollX}px`}let it=S+A+32>window.innerHeight,rt=S<0;it&&!rt?l.style.top=`${_+32-A+window.scrollY-(p+24)}px`:l.style.top=`${_+window.scrollY+32}px`}l.isConnected||(kt(l,o),i.append(l)),l.setAttribute("id","slash-menu"),a.current=l,u.setAttribute("aria-controls","slash-menu")}},n[1]=i,n[2]=o,n[3]=r,n[4]=t,n[5]=s):s=n[5];let f=s,d,m;n[6]!==r||n[7]!==f||n[8]!==t?(d=()=>{let u=r.getRootElement();if(t!==null)return f(),()=>{u!==null&&u.removeAttribute("aria-controls");let l=a.current;l!==null&&l.isConnected&&(l.remove(),l.removeAttribute("id"))}},m=[r,f,t],n[6]=r,n[7]=f,n[8]=t,n[9]=d,n[10]=m):(d=n[9],m=n[10]),x(d,m);let h;return n[11]!==t||n[12]!==e?(h=u=>{t!==null&&(u||e(null))},n[11]=t,n[12]=e,n[13]=h):h=n[13],Nt(t,a,f,h),a}var ye=`\\.,\\+\\*\\?\\$\\@\\|#{}\\(\\)\\^\\-\\[\\]\\\\/!%'"~=<>_:;`;function Ht(i){let t=i.anchor;if(t.type!=="text")return null;let e=t.getNode();if(!e.isSimpleText())return null;let o=t.offset;return e.getTextContent().slice(0,o)}function Q(i,t,e){let o=Yt(e);if(o===null||!o.isCollapsed)return!1;let n=o.anchorNode,r=i,c=o.anchorOffset;if(n==null||c==null)return!1;try{t.setStart(n,r),t.setEnd(n,c>1?c:1)}catch{return!1}return!0}function Xt(i){let t;return i.getEditorState().read(()=>{let e=I();N(e)&&(t=Ht(e))}),t}function Z(i,t){return t!==0?!1:i.getEditorState().read(()=>{let e=I();if(N(e)){let r=e.anchor.getNode().getPreviousSibling();return Pt(r)&&r.isTextEntity()}return!1})}function tt(i){v.startTransition?v.startTransition(i):i()}var jt=$t("ENABLE_SLASH_MENU_COMMAND");function Oe({anchorClassName:i,anchorElem:t,groups:e,menuRenderFn:o,onClose:n,onOpen:r,onQueryChange:c,triggerFn:a}){let[s]=Lt(),[f,d]=Wt(null),m=K(t,f,d,i),h=J(()=>{d(null),n!=null&&f!==null&&n()},[n,f]),y=J(u=>{d(u),r!=null&&f===null&&r(u)},[r,f]);return G(()=>Bt(s.registerCommand(jt,({node:u})=>(s.getEditorState().read(()=>{let l={leadOffset:0,matchingString:"",replaceableString:""};if(!Z(s,l.leadOffset)&&u!==null){let g=s._window??window,p=g.document.createRange();Q(l.leadOffset,p,g)!==null&&tt(()=>y({getRect:()=>p.getBoundingClientRect(),match:l}));return}}),!0),Vt)),[s,y]),G(()=>{let u=()=>{s.getEditorState().read(()=>{let g=s._window??window,p=g.document.createRange(),O=I(),w=Xt(s);if(!N(O)||!O.isCollapsed()||w===void 0||p===null){h();return}let _=a({editor:s,query:w});if(c(_?_.matchingString:null),_!==null&&!Z(s,_.leadOffset)&&Q(_.leadOffset,p,g)!==null){tt(()=>y({getRect:()=>p.getBoundingClientRect(),match:_}));return}h()})},l=s.registerUpdateListener(u);return()=>{l()}},[s,a,c,f,h,y]),m.current===null||f===null||s===null?null:At(z,{anchorElementRef:m,close:h,editor:s,groups:e,menuRenderFn:o,resolution:f,shouldSplitNodeWithQuery:!0})}var et=class i{_bottom;_left;_right;_top;constructor(t,e,o,n){let[r,c]=e<=n?[e,n]:[n,e],[a,s]=t<=o?[t,o]:[o,t];this._top=r,this._right=s,this._left=a,this._bottom=c}static fromDOM(t){let{height:e,left:o,top:n,width:r}=t.getBoundingClientRect();return i.fromLWTH(o,r,n,e)}static fromDOMRect(t){let{height:e,left:o,top:n,width:r}=t;return i.fromLWTH(o,r,n,e)}static fromLTRB(t,e,o,n){return new i(t,e,o,n)}static fromLWTH(t,e,o,n){return new i(t,o,t+e,o+n)}static fromPoints(t,e){let{x:o,y:n}=t,{x:r,y:c}=e;return i.fromLTRB(o,n,r,c)}contains(t){if($(t)){let{x:c,y:a}=t,s=a<this._top,f=a>this._bottom,d=c<this._left,m=c>this._right;return{reason:{isOnBottomSide:f,isOnLeftSide:d,isOnRightSide:m,isOnTopSide:s},result:!s&&!f&&!d&&!m}}let{bottom:e,left:o,right:n,top:r}=t;return r>=this._top&&r<=this._bottom&&e>=this._top&&e<=this._bottom&&o>=this._left&&o<=this._right&&n>=this._left&&n<=this._right}distanceFromPoint(t){let e=this.contains(t);if(e.result)return{distance:0,isOnBottomSide:e.reason.isOnBottomSide,isOnLeftSide:e.reason.isOnLeftSide,isOnRightSide:e.reason.isOnRightSide,isOnTopSide:e.reason.isOnTopSide};let o=0,n=0;return t.x<this._left?o=this._left-t.x:t.x>this._right&&(o=t.x-this._right),t.y<this._top?n=this._top-t.y:t.y>this._bottom&&(n=t.y-this._bottom),{distance:Math.sqrt(o*o+n*n),isOnBottomSide:t.y>this._bottom,isOnLeftSide:t.x<this._left,isOnRightSide:t.x>this._right,isOnTopSide:t.y<this._top}}equals({bottom:t,left:e,right:o,top:n}){return n===this._top&&t===this._bottom&&e===this._left&&o===this._right}generateNewRect({bottom:t=this.bottom,left:e=this.left,right:o=this.right,top:n=this.top}){return new i(e,n,o,t)}intersectsWith(t){let{height:e,left:o,top:n,width:r}=t,{height:c,left:a,top:s,width:f}=this,d=o+r>=a+f?o+r:a+f,m=n+e>=s+c?n+e:s+c,h=o<=a?o:a,y=n<=s?n:s;return d-h<=r+f&&m-y<=e+c}get bottom(){return this._bottom}get height(){return Math.abs(this._bottom-this._top)}get left(){return this._left}get right(){return this._right}get top(){return this._top}get width(){return Math.abs(this._left-this._right)}};import k from"react";var b=new WeakMap;function Me(i,t){b.has(i)||b.set(i,new Map);let e=b.get(i);for(let[o,n]of Object.entries(t))if(!(!n||typeof n!="object")){if(o==="blocks"){for(let[r,c]of Object.entries(n))e.set(`block:${r}`,c);continue}if(o==="inlineBlocks"){for(let[r,c]of Object.entries(n))e.set(`inlineBlock:${r}`,c);continue}e.set(o,n)}}function Re(i){b.delete(i)}function nt(i,t,e){let o=b.get(i);if(t==="block"&&e?.__fields?.blockType){let n=e.__fields.blockType;return o?.get(`block:${n}`)}if(t==="inlineBlock"&&e?.__fields?.blockType){let n=e.__fields.blockType;return o?.get(`inlineBlock:${n}`)}return o?.get(t)}function qt({node:i,nodeType:t}){if(!("getType"in i)||i.getType()!==t)return;let e=i;if(e.prototype._originalDecorate||(e.prototype._originalDecorate=e.prototype.decorate),e.prototype._originalCreateDOM||(e.prototype._originalCreateDOM=e.prototype.createDOM),e.prototype.decorate&&!e.prototype._decorateOverridden){e.prototype._decorateOverridden=!0;let o=!!e.prototype.createDOM;e.prototype.decorate=function(n,r){let c=nt(n,t,this);if(c){if(c.Component)return c.Component({config:r,editor:n,isEditor:!0,isJSXConverter:!1,node:this});if(c.createDOM&&c.html){let s=typeof c.html=="function"?c.html({config:r,editor:n,isEditor:!0,isJSXConverter:!1,node:this}):c.html;return k.createElement("span",{dangerouslySetInnerHTML:{__html:s}})}if(c.html&&o&&!c.createDOM)return k.createElement(k.Fragment);if(t==="block"){let s=c;if(s.Block||s.Label)return e.prototype._originalDecorate.call(this,n,r,s.Block,s.Label)}else if(t==="inlineBlock"){let s=c;if(s.Block||s.Label)return e.prototype._originalDecorate.call(this,n,r,s.Block,s.Label)}}return e.prototype._originalDecorate.call(this,n,r)}}e.prototype.createDOM&&!e.prototype._createDOMOverridden&&(e.prototype._createDOMOverridden=!0,e.prototype.createDOM=function(o,n){let r=nt(n,t,this);if(r){if(r.createDOM)return r.createDOM({config:o,editor:n,node:this});if(r.html){let c=typeof r.html=="function"?r.html({config:o,editor:n,isEditor:!0,isJSXConverter:!1,node:this}):r.html,a=document.createElement("div");return a.innerHTML=c,a.firstElementChild||a}}return e.prototype._originalCreateDOM.call(this,o,n)})}function De({editorConfig:i,nodeViews:t}){let e=Ut({nodes:i.features.nodes});if(t){let o=new Set;for(let[n,r]of Object.entries(t))!r||typeof r!="object"||(n==="blocks"&&Object.keys(r).length>0?o.add("block"):n==="inlineBlocks"&&Object.keys(r).length>0?o.add("inlineBlock"):o.add(n));for(let n of e)if("getType"in n){let r=n.getType();o.has(r)&&qt({node:n,nodeType:r})}}return e}function Ut({nodes:i}){return i.map(t=>"node"in t?t.node:t)}export{P as a,Gt as b,oe as c,pt as d,T as e,$ as f,ye as g,jt as h,Oe as i,et as j,Me as k,Re as l,De as m};
|
|
2
|
+
//# sourceMappingURL=chunk-X3D4LZS7.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/lexical/utils/canUseDOM.ts", "../../../src/utilities/useRunDeprioritized.ts", "../../../src/field/RichTextViewProvider.tsx", "../../../src/lexical/utils/point.ts", "../../../src/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.tsx", "../../../src/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.tsx", "../../../src/lexical/utils/rect.ts", "../../../src/lexical/nodes/index.ts"],
|
|
4
|
+
"sourcesContent": ["'use client'\nexport const CAN_USE_DOM: boolean =\n typeof window !== 'undefined' &&\n typeof window.document !== 'undefined' &&\n typeof window.document.createElement !== 'undefined'\n", "'use client'\nimport { useCallback, useRef } from 'react'\n\n/**\n * Simple hook that lets you run any callback once the main thread is idle\n * (via `requestIdleCallback`) or when that API is missing (Safari) - after the\n * next animation frame (`interactionResponse`).\n *\n * This will help you to avoid blocking the main thread with heavy work.\n *\n * The latest invocation wins: if a new run is queued before the previous one\n * executes, the previous task is cancelled.\n *\n * Usage:\n * ```ts\n * const runDeprioritized = useRunDeprioritized();\n *\n * const onEditorChange = (state: EditorState) => {\n * runDeprioritized(() => {\n * // heavy work here …\n * });\n * };\n * ```\n *\n * @param timeout Optional timeout (ms) for `requestIdleCallback`; defaults to 500 ms.\n * @returns A `runDeprioritized(fn)` helper.\n */\n\nexport function useRunDeprioritized(timeout = 500) {\n const idleHandleRef = useRef<number>(undefined)\n\n /**\n * Schedule `fn` and resolve when it has executed.\n */\n const runDeprioritized = useCallback(\n (fn: () => void): Promise<void> => {\n return new Promise<void>((resolve) => {\n const exec = () => {\n fn()\n resolve()\n }\n\n if ('requestIdleCallback' in window) {\n // Cancel any previously queued task so only the latest runs.\n if ('cancelIdleCallback' in window && idleHandleRef.current !== undefined) {\n // Cancel earlier scheduled value updates,\n // so that a CPU-limited event loop isn't flooded with n callbacks for n keystrokes into the rich text field,\n // but that there's only ever the latest one state update\n // dispatch task, to be executed with the next idle time,\n // or the deadline of 500ms.\n cancelIdleCallback(idleHandleRef.current)\n }\n // Schedule the state update to happen the next time the browser has sufficient resources,\n // or the latest after 500ms.\n idleHandleRef.current = requestIdleCallback(exec, { timeout })\n } else {\n // Safari fallback: rAF + setTimeout shim.\n void interactionResponse().then(exec)\n }\n })\n },\n [timeout],\n )\n\n return runDeprioritized\n}\n\nfunction interactionResponse(): Promise<unknown> {\n // Taken from https://github.com/vercel-labs/await-interaction-response/tree/main/packages/await-interaction-response/src\n\n return new Promise((resolve) => {\n setTimeout(resolve, 100) // Fallback for the case where the animation frame never fires.\n requestAnimationFrame(() => {\n setTimeout(resolve, 0)\n })\n })\n}\n", "'use client'\nimport { useControllableState } from '@payloadcms/ui'\nimport React, { createContext, use, useMemo } from 'react'\n\nimport type { LexicalEditorNodeMap, LexicalEditorViewMap } from '../types/index.js'\n\n/**\n * Context for managing richtext editor view state and inheritance.\n */\ntype RichTextViewContextType = {\n /**\n * The currently active view name (e.g., 'default', 'frontend', 'debug').\n */\n currentView: string\n /**\n * The resolved node map for the current view, containing rendering overrides for each node type.\n */\n currentViewMap?: LexicalEditorNodeMap\n /**\n * True if the current view was explicitly set (via prop) by this provider or an ancestor.\n * Used to distinguish intentional view settings from automatic defaults.\n */\n hasExplicitCurrentView?: boolean\n /**\n * If true, nested richtext editors will inherit this provider's currentView and views.\n */\n inheritable?: boolean\n /**\n * True if this provider's view is controlled by an ancestor provider — either because the\n * ancestor has a views map (view-map inheritance) or an explicit `currentView` prop.\n * When true, the ViewSelector is hidden.\n */\n isControlledByParent?: boolean\n /**\n * Function to programmatically change the current view.\n */\n setCurrentView: (view: string) => void\n /**\n * Map of all available views for this editor. Each key is a view name, each value contains\n * admin config, node overrides, and lexical config for that view.\n */\n views?: LexicalEditorViewMap\n}\n\nconst RichTextViewContext = createContext<RichTextViewContextType>({\n currentView: 'default',\n inheritable: false,\n setCurrentView: () => {},\n})\n\n/**\n * Provider for managing richtext editor view state and its inheritance.\n *\n * Handles two key scenarios:\n * 1. **Explicit view setting**: Wrap with `currentView` and `inheritable={true}` to force nested editors to a specific view\n * 2. **View map inheritance**: Nested editors inherit `views` from parents, allowing view switching across the hierarchy\n *\n * When a nested editor inherits from a parent, its ViewSelector is hidden because the view is controlled by an ancestor.\n *\n * @example\n * Force all nested richtext editors to use \"frontend\" view:\n * ```tsx\n * <RichTextViewProvider currentView=\"frontend\" inheritable={true}>\n * <MyForm /> {/* All richtext fields inside will use \"frontend\" view }\n * </RichTextViewProvider>\n * ```\n */\nexport const RichTextViewProvider: React.FC<{\n children: React.ReactNode\n currentView?: string\n inheritable?: boolean\n views?: LexicalEditorViewMap\n}> = (args) => {\n const parentContext = useRichTextView()\n\n // Track if this provider explicitly sets currentView (not just using the default)\n const hasOwnExplicitView = args.currentView !== undefined\n\n const isControlledByParent =\n parentContext.inheritable &&\n (Boolean(parentContext.views) || Boolean(parentContext.hasExplicitCurrentView))\n\n // This provider has explicit currentView if it sets one OR inherits one from parent\n const hasExplicitCurrentView =\n hasOwnExplicitView ||\n (parentContext.inheritable && Boolean(parentContext.hasExplicitCurrentView))\n\n const {\n children,\n currentView: currentViewFromProps,\n inheritable,\n views,\n } = {\n children: args.children,\n currentView: isControlledByParent ? parentContext.currentView : args.currentView,\n // Propagate inheritable flag through the hierarchy\n inheritable: parentContext.inheritable || args.inheritable,\n // Only inherit views if parent has a views map\n views: isControlledByParent && parentContext.views ? parentContext.views : args.views,\n }\n\n const [currentViewRaw, setCurrentView] = useControllableState(currentViewFromProps, 'default')\n\n // Normalize currentView: if the requested view doesn't exist in this editor's\n // views map, fall back to 'default'. This ensures all consumers of useRichTextView()\n // see a consistent currentView that actually exists\n const currentView =\n views && currentViewRaw !== 'default' && !views[currentViewRaw] ? 'default' : currentViewRaw\n\n const value = useMemo(() => {\n const currentViewMap = views ? views[currentView] : undefined\n return {\n currentView,\n currentViewMap,\n hasExplicitCurrentView,\n inheritable,\n isControlledByParent,\n setCurrentView,\n views,\n }\n }, [\n currentView,\n inheritable,\n hasExplicitCurrentView,\n isControlledByParent,\n setCurrentView,\n views,\n ])\n\n return <RichTextViewContext value={value}>{children}</RichTextViewContext>\n}\n\n/**\n * Access the current richtext editor view context.\n *\n * Returns the active view name, node overrides, inheritance state, and a function to switch views.\n *\n * @example\n * ```tsx\n * function MyComponent() {\n * const { currentView, currentViewMap, isControlledByParent, setCurrentView } = useRichTextView()\n *\n * return (\n * <div>\n * <p>Active view: {currentView}</p>\n * {isControlledByParent && <p>View controlled by parent</p>}\n * {currentViewMap?.heading && <p>Custom heading renderer active</p>}\n * <button onClick={() => setCurrentView('frontend')}>Switch to frontend</button>\n * </div>\n * )\n * }\n * ```\n */\nexport function useRichTextView(): RichTextViewContextType {\n return use(RichTextViewContext)\n}\n", "'use client'\nexport class Point {\n private readonly _x: number\n\n private readonly _y: number\n\n constructor(x: number, y: number) {\n this._x = x\n this._y = y\n }\n\n public calcDeltaXTo({ x }: Point): number {\n return this.x - x\n }\n\n public calcDeltaYTo({ y }: Point): number {\n return this.y - y\n }\n\n public calcDistanceTo(point: Point): number {\n return Math.sqrt(Math.pow(this.calcDeltaXTo(point), 2) + Math.pow(this.calcDeltaYTo(point), 2))\n }\n\n public calcHorizontalDistanceTo(point: Point): number {\n return Math.abs(this.calcDeltaXTo(point))\n }\n\n public calcVerticalDistance(point: Point): number {\n return Math.abs(this.calcDeltaYTo(point))\n }\n\n public equals({ x, y }: Point): boolean {\n return this.x === x && this.y === y\n }\n\n get x(): number {\n return this._x\n }\n\n get y(): number {\n return this._y\n }\n}\n\nexport function isPoint(x: unknown): x is Point {\n return x instanceof Point\n}\n", "'use client'\nimport type { LexicalCommand, LexicalEditor, ParagraphNode, RangeSelection } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { mergeRegister } from '@lexical/utils'\nimport {\n $getSelection,\n $isRangeSelection,\n $isTextNode,\n COMMAND_PRIORITY_LOW,\n createCommand,\n getDOMSelection,\n} from 'lexical'\nimport { type JSX, useCallback, useEffect, useState } from 'react'\nimport * as React from 'react'\n\nimport type { MenuTextMatch, TriggerFn } from '../useMenuTriggerMatch.js'\nimport type { MenuRenderFn, MenuResolution } from './LexicalMenu.js'\nimport type { SlashMenuGroupInternal } from './types.js'\n\nimport { LexicalMenu, useMenuAnchorRef } from './LexicalMenu.js'\n\nexport const PUNCTUATION = '\\\\.,\\\\+\\\\*\\\\?\\\\$\\\\@\\\\|#{}\\\\(\\\\)\\\\^\\\\-\\\\[\\\\]\\\\\\\\/!%\\'\"~=<>_:;'\n\nfunction getTextUpToAnchor(selection: RangeSelection): null | string {\n const anchor = selection.anchor\n if (anchor.type !== 'text') {\n return null\n }\n const anchorNode = anchor.getNode()\n if (!anchorNode.isSimpleText()) {\n return null\n }\n const anchorOffset = anchor.offset\n return anchorNode.getTextContent().slice(0, anchorOffset)\n}\n\nfunction tryToPositionRange(leadOffset: number, range: Range, editorWindow: Window): boolean {\n const domSelection = getDOMSelection(editorWindow)\n if (domSelection === null || !domSelection.isCollapsed) {\n return false\n }\n\n const anchorNode = domSelection.anchorNode\n const startOffset = leadOffset\n const endOffset = domSelection.anchorOffset\n\n if (anchorNode == null || endOffset == null) {\n return false\n }\n\n try {\n range.setStart(anchorNode, startOffset)\n // if endOffset is 0, positioning the range for when you click the plus button to open the slash menu will fial\n range.setEnd(anchorNode, endOffset > 1 ? endOffset : 1)\n } catch (error) {\n return false\n }\n\n return true\n}\n\nfunction getQueryTextForSearch(editor: LexicalEditor): string | undefined {\n let text\n editor.getEditorState().read(() => {\n const selection = $getSelection()\n if (!$isRangeSelection(selection)) {\n return\n }\n text = getTextUpToAnchor(selection)\n })\n return text\n}\n\nfunction isSelectionOnEntityBoundary(editor: LexicalEditor, offset: number): boolean {\n if (offset !== 0) {\n return false\n }\n return editor.getEditorState().read(() => {\n const selection = $getSelection()\n if ($isRangeSelection(selection)) {\n const anchor = selection.anchor\n const anchorNode = anchor.getNode()\n const prevSibling = anchorNode.getPreviousSibling()\n return $isTextNode(prevSibling) && prevSibling.isTextEntity()\n }\n return false\n })\n}\n\nfunction startTransition(callback: () => void) {\n if (React.startTransition) {\n React.startTransition(callback)\n } else {\n callback()\n }\n}\n\nexport { useDynamicPositioning } from './LexicalMenu.js'\n\nexport type TypeaheadMenuPluginProps = {\n anchorClassName?: string\n anchorElem: HTMLElement\n groups: Array<SlashMenuGroupInternal>\n menuRenderFn: MenuRenderFn\n onClose?: () => void\n onOpen?: (resolution: MenuResolution) => void\n onQueryChange: (matchingString: null | string) => void\n triggerFn: TriggerFn\n}\n\nexport const ENABLE_SLASH_MENU_COMMAND: LexicalCommand<{\n node: ParagraphNode\n}> = createCommand('ENABLE_SLASH_MENU_COMMAND')\n\nexport function LexicalTypeaheadMenuPlugin({\n anchorClassName,\n anchorElem,\n groups,\n menuRenderFn,\n onClose,\n onOpen,\n onQueryChange,\n triggerFn,\n}: TypeaheadMenuPluginProps): JSX.Element | null {\n const [editor] = useLexicalComposerContext()\n const [resolution, setResolution] = useState<MenuResolution | null>(null)\n const anchorElementRef = useMenuAnchorRef(anchorElem, resolution, setResolution, anchorClassName)\n\n const closeTypeahead = useCallback(() => {\n setResolution(null)\n if (onClose != null && resolution !== null) {\n onClose()\n }\n }, [onClose, resolution])\n\n const openTypeahead = useCallback(\n (res: MenuResolution) => {\n setResolution(res)\n if (onOpen != null && resolution === null) {\n onOpen(res)\n }\n },\n [onOpen, resolution],\n )\n\n // This is mainly used for the AddBlockHandlePlugin, so that the slash menu can be opened from there\n useEffect(() => {\n return mergeRegister(\n editor.registerCommand(\n ENABLE_SLASH_MENU_COMMAND,\n ({ node }) => {\n editor.getEditorState().read(() => {\n const match: MenuTextMatch = {\n leadOffset: 0,\n matchingString: '',\n replaceableString: '',\n }\n if (!isSelectionOnEntityBoundary(editor, match.leadOffset)) {\n if (node !== null) {\n const editorWindow = editor._window ?? window\n const range = editorWindow.document.createRange()\n\n const isRangePositioned = tryToPositionRange(match.leadOffset, range, editorWindow)\n if (isRangePositioned !== null) {\n startTransition(() =>\n openTypeahead({\n getRect: () => {\n return range.getBoundingClientRect()\n },\n match,\n }),\n )\n }\n\n return\n }\n }\n })\n\n return true\n },\n COMMAND_PRIORITY_LOW,\n ),\n )\n }, [editor, openTypeahead])\n\n useEffect(() => {\n const updateListener = () => {\n editor.getEditorState().read(() => {\n const editorWindow = editor._window ?? window\n const range = editorWindow.document.createRange()\n const selection = $getSelection()\n const text = getQueryTextForSearch(editor)\n\n if (\n !$isRangeSelection(selection) ||\n !selection.isCollapsed() ||\n text === undefined ||\n range === null\n ) {\n closeTypeahead()\n return\n }\n\n const match = triggerFn({ editor, query: text })\n onQueryChange(match ? match.matchingString : null)\n\n if (match !== null && !isSelectionOnEntityBoundary(editor, match.leadOffset)) {\n const isRangePositioned = tryToPositionRange(match.leadOffset, range, editorWindow)\n if (isRangePositioned !== null) {\n startTransition(() =>\n openTypeahead({\n getRect: () => {\n return range.getBoundingClientRect()\n },\n match,\n }),\n )\n return\n }\n }\n closeTypeahead()\n })\n }\n\n const removeUpdateListener = editor.registerUpdateListener(updateListener)\n\n return () => {\n removeUpdateListener()\n }\n }, [editor, triggerFn, onQueryChange, resolution, closeTypeahead, openTypeahead])\n\n return anchorElementRef.current === null || resolution === null || editor === null ? null : (\n <LexicalMenu\n anchorElementRef={anchorElementRef}\n close={closeTypeahead}\n editor={editor}\n groups={groups}\n menuRenderFn={menuRenderFn}\n resolution={resolution}\n shouldSplitNodeWithQuery\n />\n )\n}\n\nexport type { MenuRenderFn, MenuResolution, MenuTextMatch, TriggerFn }\n", "'use client'\nimport type { BaseSelection, LexicalCommand, LexicalEditor, TextNode } from 'lexical'\nimport type { JSX, ReactPortal, RefObject } from 'react'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { mergeRegister } from '@lexical/utils'\nimport {\n $getSelection,\n $isRangeSelection,\n $setSelection,\n COMMAND_PRIORITY_LOW,\n COMMAND_PRIORITY_NORMAL,\n createCommand,\n KEY_ARROW_DOWN_COMMAND,\n KEY_ARROW_UP_COMMAND,\n KEY_ENTER_COMMAND,\n KEY_ESCAPE_COMMAND,\n KEY_TAB_COMMAND,\n} from 'lexical'\nimport { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react'\n\nimport type { MenuTextMatch } from '../useMenuTriggerMatch.js'\nimport type { SlashMenuGroupInternal, SlashMenuItem, SlashMenuItemInternal } from './types.js'\n\nimport { CAN_USE_DOM } from '../../../utils/canUseDOM.js'\n\nexport type MenuResolution = {\n getRect: () => DOMRect\n match?: MenuTextMatch\n}\n\nconst baseClass = 'slash-menu-popup'\n\nexport type MenuRenderFn = (\n anchorElementRef: RefObject<HTMLElement | null>,\n itemProps: {\n groups: Array<SlashMenuGroupInternal>\n selectedItemKey: null | string\n selectItemAndCleanUp: (selectedItem: SlashMenuItem) => void\n setSelectedItemKey: (itemKey: string) => void\n },\n matchingString: null | string,\n) => JSX.Element | null | ReactPortal\n\nconst scrollIntoViewIfNeeded = (target: HTMLElement) => {\n const typeaheadContainerNode = document.getElementById('slash-menu')\n if (!typeaheadContainerNode) {\n return\n }\n\n const typeaheadRect = typeaheadContainerNode.getBoundingClientRect()\n\n if (typeaheadRect.top + typeaheadRect.height > window.innerHeight) {\n typeaheadContainerNode.scrollIntoView({\n block: 'center',\n })\n }\n\n if (typeaheadRect.top < 0) {\n typeaheadContainerNode.scrollIntoView({\n block: 'center',\n })\n }\n\n target.scrollIntoView({ block: 'nearest' })\n}\n\n/**\n * Walk backwards along user input and forward through entity title to try\n * and replace more of the user's text with entity.\n */\nfunction getFullMatchOffset(documentText: string, entryText: string, offset: number) {\n let triggerOffset = offset\n for (let i = triggerOffset; i <= entryText.length; i++) {\n if (documentText.substring(documentText.length - i) === entryText.substring(0, i)) {\n triggerOffset = i\n }\n }\n return triggerOffset\n}\n\n/**\n * Split Lexical TextNode and return a new TextNode only containing matched text.\n * Common use cases include: removing the node, replacing with a new node.\n */\nfunction $splitNodeContainingQuery(match: MenuTextMatch): TextNode | undefined {\n const selection = $getSelection()\n if (!$isRangeSelection(selection) || !selection.isCollapsed()) {\n return\n }\n const anchor = selection.anchor\n if (anchor.type !== 'text') {\n return\n }\n const anchorNode = anchor.getNode()\n if (!anchorNode.isSimpleText()) {\n return\n }\n const selectionOffset = anchor.offset\n const textContent = anchorNode.getTextContent().slice(0, selectionOffset)\n const characterOffset = match.replaceableString.length\n const queryOffset = getFullMatchOffset(textContent, match.matchingString, characterOffset)\n const startOffset = selectionOffset - queryOffset\n if (startOffset < 0) {\n return\n }\n let newNode\n if (startOffset === 0) {\n ;[newNode] = anchorNode.splitText(selectionOffset)\n } else {\n ;[, newNode] = anchorNode.splitText(startOffset, selectionOffset)\n }\n\n return newNode\n}\n\n// Got from https://stackoverflow.com/a/42543908/2013580\nexport function getScrollParent(\n element: HTMLElement,\n includeHidden: boolean,\n): HTMLBodyElement | HTMLElement {\n let style = getComputedStyle(element)\n const excludeStaticParent = style.position === 'absolute'\n const overflowRegex = includeHidden ? /(auto|scroll|hidden)/ : /(auto|scroll)/\n if (style.position === 'fixed') {\n return document.body\n }\n for (let parent: HTMLElement | null = element; (parent = parent.parentElement); ) {\n style = getComputedStyle(parent)\n if (excludeStaticParent && style.position === 'static') {\n continue\n }\n if (overflowRegex.test(style.overflow + style.overflowY + style.overflowX)) {\n return parent\n }\n }\n return document.body\n}\n\nfunction isTriggerVisibleInNearestScrollContainer(\n targetElement: HTMLElement,\n containerElement: HTMLElement,\n): boolean {\n const tRect = targetElement.getBoundingClientRect()\n const cRect = containerElement.getBoundingClientRect()\n return tRect.top > cRect.top && tRect.top < cRect.bottom\n}\n\n// Reposition the menu on scroll, window resize, and element resize.\nexport function useDynamicPositioning(\n resolution: MenuResolution | null,\n targetElementRef: RefObject<HTMLElement | null>,\n onReposition: () => void,\n onVisibilityChange?: (isInView: boolean) => void,\n) {\n const [editor] = useLexicalComposerContext()\n useEffect(() => {\n const targetElement = targetElementRef.current\n if (targetElement != null && resolution != null) {\n const rootElement = editor.getRootElement()\n const rootScrollParent =\n rootElement != null ? getScrollParent(rootElement, false) : document.body\n let ticking = false\n let previousIsInView = isTriggerVisibleInNearestScrollContainer(\n targetElement,\n rootScrollParent,\n )\n const handleScroll = function () {\n if (!ticking) {\n window.requestAnimationFrame(function () {\n onReposition()\n ticking = false\n })\n ticking = true\n }\n const isInView = isTriggerVisibleInNearestScrollContainer(targetElement, rootScrollParent)\n if (isInView !== previousIsInView) {\n previousIsInView = isInView\n if (onVisibilityChange != null) {\n onVisibilityChange(isInView)\n }\n }\n }\n const resizeObserver = new ResizeObserver(onReposition)\n window.addEventListener('resize', onReposition)\n document.addEventListener('scroll', handleScroll, {\n capture: true,\n passive: true,\n })\n resizeObserver.observe(targetElement)\n return () => {\n resizeObserver.disconnect()\n window.removeEventListener('resize', onReposition)\n document.removeEventListener('scroll', handleScroll, true)\n }\n }\n }, [editor, onVisibilityChange, onReposition, resolution, targetElementRef])\n}\n\nexport const SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND: LexicalCommand<{\n index: number\n item: SlashMenuItemInternal\n}> = createCommand('SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND')\n\nexport function LexicalMenu({\n anchorElementRef,\n close,\n editor,\n // groups filtering is already handled in SlashMenu/index.tsx. Thus, groups always contains the matching items.\n groups,\n menuRenderFn,\n resolution,\n shouldSplitNodeWithQuery = false,\n}: {\n anchorElementRef: RefObject<HTMLElement | null>\n close: () => void\n editor: LexicalEditor\n groups: Array<SlashMenuGroupInternal>\n menuRenderFn: MenuRenderFn\n resolution: MenuResolution\n shouldSplitNodeWithQuery?: boolean\n}): JSX.Element | null {\n const [selectedItemKey, setSelectedItemKey] = useState<null | string>(null)\n\n const matchingString = (resolution.match && resolution.match.matchingString) || ''\n\n const updateSelectedItem = useCallback(\n (item: SlashMenuItem) => {\n const rootElem = editor.getRootElement()\n if (rootElem !== null) {\n rootElem.setAttribute('aria-activedescendant', `${baseClass}__item-${item.key}`)\n setSelectedItemKey(item.key)\n }\n },\n [editor],\n )\n\n const setSelectedItemKeyToFirstMatchingItem = useCallback(() => {\n // set selected item to the first of the matching ones\n if (groups !== null && matchingString != null) {\n // groups filtering is already handled in SlashMenu/index.tsx. Thus, groups always contains the matching items.\n const allItems = groups.flatMap((group) => group.items)\n\n if (allItems.length) {\n const firstMatchingItem = allItems[0]!\n updateSelectedItem(firstMatchingItem)\n }\n }\n }, [groups, updateSelectedItem, matchingString])\n\n useEffect(() => {\n setSelectedItemKeyToFirstMatchingItem()\n }, [matchingString, setSelectedItemKeyToFirstMatchingItem])\n\n const selectItemAndCleanUp = useCallback(\n (selectedItem: SlashMenuItem) => {\n close()\n\n editor.update(() => {\n const textNodeContainingQuery =\n resolution.match != null && shouldSplitNodeWithQuery\n ? $splitNodeContainingQuery(resolution.match)\n : null\n\n if (textNodeContainingQuery) {\n textNodeContainingQuery.remove()\n }\n })\n\n setTimeout(() => {\n // Needed in Firefox. See https://github.com/payloadcms/payload/issues/10724\n let selection: BaseSelection | undefined\n editor.read(() => {\n selection = $getSelection()?.clone()\n })\n editor.update(() => {\n if (selection) {\n $setSelection(selection)\n }\n })\n\n selectedItem.onSelect({\n editor,\n queryString: resolution.match ? resolution.match.matchingString : '',\n })\n }, 0)\n },\n [editor, shouldSplitNodeWithQuery, resolution.match, close],\n )\n\n useEffect(() => {\n return () => {\n const rootElem = editor.getRootElement()\n if (rootElem !== null) {\n rootElem.removeAttribute('aria-activedescendant')\n }\n }\n }, [editor])\n\n useLayoutEffect(() => {\n if (groups === null) {\n setSelectedItemKey(null)\n } else if (selectedItemKey === null) {\n setSelectedItemKeyToFirstMatchingItem()\n }\n }, [groups, selectedItemKey, updateSelectedItem, setSelectedItemKeyToFirstMatchingItem])\n\n useEffect(() => {\n return mergeRegister(\n editor.registerCommand(\n SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND,\n ({ item }) => {\n if (item.ref && item.ref.current != null) {\n scrollIntoViewIfNeeded(item.ref.current)\n return true\n }\n\n return false\n },\n COMMAND_PRIORITY_LOW,\n ),\n )\n }, [editor, updateSelectedItem])\n\n useEffect(() => {\n return mergeRegister(\n editor.registerCommand<KeyboardEvent>(\n KEY_ARROW_DOWN_COMMAND,\n (payload) => {\n const event = payload\n if (groups !== null && groups.length && selectedItemKey !== null) {\n const allItems = groups.flatMap((group) => group.items)\n const selectedIndex = allItems.findIndex((item) => item.key === selectedItemKey)\n\n const newSelectedIndex = selectedIndex !== allItems.length - 1 ? selectedIndex + 1 : 0\n\n const newSelectedItem = allItems[newSelectedIndex]\n if (!newSelectedItem) {\n return false\n }\n\n updateSelectedItem(newSelectedItem)\n if (newSelectedItem.ref != null && newSelectedItem.ref.current) {\n editor.dispatchCommand(SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND, {\n index: newSelectedIndex,\n item: newSelectedItem,\n })\n }\n event.preventDefault()\n event.stopImmediatePropagation()\n }\n return true\n },\n COMMAND_PRIORITY_NORMAL,\n ),\n editor.registerCommand<KeyboardEvent>(\n KEY_ARROW_UP_COMMAND,\n (payload) => {\n const event = payload\n if (groups !== null && groups.length && selectedItemKey !== null) {\n const allItems = groups.flatMap((group) => group.items)\n const selectedIndex = allItems.findIndex((item) => item.key === selectedItemKey)\n\n const newSelectedIndex = selectedIndex !== 0 ? selectedIndex - 1 : allItems.length - 1\n\n const newSelectedItem = allItems[newSelectedIndex]\n if (!newSelectedItem) {\n return false\n }\n\n updateSelectedItem(newSelectedItem)\n if (newSelectedItem.ref != null && newSelectedItem.ref.current) {\n scrollIntoViewIfNeeded(newSelectedItem.ref.current)\n }\n event.preventDefault()\n event.stopImmediatePropagation()\n }\n return true\n },\n COMMAND_PRIORITY_NORMAL,\n ),\n editor.registerCommand<KeyboardEvent>(\n KEY_ESCAPE_COMMAND,\n (payload) => {\n const event = payload\n event.preventDefault()\n event.stopImmediatePropagation()\n close()\n return true\n },\n COMMAND_PRIORITY_LOW,\n ),\n editor.registerCommand<KeyboardEvent>(\n KEY_TAB_COMMAND,\n (payload) => {\n const event = payload\n\n if (groups === null || selectedItemKey === null) {\n return false\n }\n const allItems = groups.flatMap((group) => group.items)\n const selectedItem = allItems.find((item) => item.key === selectedItemKey)\n if (!selectedItem) {\n return false\n }\n\n event.preventDefault()\n event.stopImmediatePropagation()\n selectItemAndCleanUp(selectedItem)\n return true\n },\n COMMAND_PRIORITY_NORMAL,\n ),\n editor.registerCommand(\n KEY_ENTER_COMMAND,\n (event: KeyboardEvent | null) => {\n if (groups === null || selectedItemKey === null) {\n return false\n }\n const allItems = groups.flatMap((group) => group.items)\n const selectedItem = allItems.find((item) => item.key === selectedItemKey)\n if (!selectedItem) {\n return false\n }\n\n if (event !== null) {\n event.preventDefault()\n event.stopImmediatePropagation()\n }\n selectItemAndCleanUp(selectedItem)\n return true\n },\n COMMAND_PRIORITY_NORMAL,\n ),\n )\n }, [selectItemAndCleanUp, close, editor, groups, selectedItemKey, updateSelectedItem])\n\n const listItemProps = useMemo(\n () => ({\n groups,\n selectedItemKey,\n selectItemAndCleanUp,\n setSelectedItemKey,\n }),\n [selectItemAndCleanUp, selectedItemKey, groups],\n )\n\n return menuRenderFn(\n anchorElementRef,\n listItemProps,\n resolution.match ? resolution.match.matchingString : '',\n )\n}\n\nfunction setContainerDivAttributes(containerDiv: HTMLElement, className?: string) {\n if (className != null) {\n containerDiv.className = className\n }\n containerDiv.setAttribute('aria-label', 'Slash menu')\n containerDiv.setAttribute('role', 'listbox')\n containerDiv.style.display = 'block'\n containerDiv.style.position = 'absolute'\n}\n\nexport function useMenuAnchorRef(\n anchorElem: HTMLElement,\n resolution: MenuResolution | null,\n setResolution: (r: MenuResolution | null) => void,\n className?: string,\n): RefObject<HTMLElement | null> {\n const [editor] = useLexicalComposerContext()\n const anchorElementRef = useRef<HTMLElement | null>(\n CAN_USE_DOM ? document.createElement('div') : null,\n )\n const positionMenu = useCallback(() => {\n if (anchorElementRef.current === null || parent === undefined) {\n return\n }\n const rootElement = editor.getRootElement()\n const containerDiv = anchorElementRef.current\n\n const VERTICAL_OFFSET = 32\n\n const menuEle = containerDiv.firstChild as Element\n if (rootElement !== null && resolution !== null) {\n const { height, width } = resolution.getRect()\n let { left, top } = resolution.getRect()\n\n const rawTop = top\n top -= anchorElem.getBoundingClientRect().top + window.scrollY\n left -= anchorElem.getBoundingClientRect().left + window.scrollX\n containerDiv.style.left = `${left + window.scrollX}px`\n containerDiv.style.height = `${height}px`\n containerDiv.style.width = `${width}px`\n if (menuEle !== null) {\n const menuRect = menuEle.getBoundingClientRect()\n const menuHeight = menuRect.height\n const menuWidth = menuRect.width\n\n const rootElementRect = rootElement.getBoundingClientRect()\n\n const isRTL = document.dir === 'rtl' || document.documentElement.dir === 'rtl'\n const anchorRect = anchorElem.getBoundingClientRect()\n const leftBoundary = Math.max(0, rootElementRect.left)\n\n if (!isRTL && left + menuWidth > rootElementRect.right) {\n containerDiv.style.left = `${rootElementRect.right - menuWidth + window.scrollX}px`\n } else if (isRTL && menuRect.left < leftBoundary) {\n const newLeft = leftBoundary + menuWidth - anchorRect.left\n containerDiv.style.left = `${newLeft + window.scrollX}px`\n }\n\n const wouldGoOffBottomOfScreen = rawTop + menuHeight + VERTICAL_OFFSET > window.innerHeight\n //const wouldGoOffBottomOfContainer = top + menuHeight > rootElementRect.bottom\n const wouldGoOffTopOfScreen = rawTop < 0\n\n // Position slash menu above the cursor instead of below (default) if it would otherwise go off the bottom of the screen.\n if (wouldGoOffBottomOfScreen && !wouldGoOffTopOfScreen) {\n const margin = 24\n containerDiv.style.top = `${\n top + VERTICAL_OFFSET - menuHeight + window.scrollY - (height + margin)\n }px`\n } else {\n containerDiv.style.top = `${top + window.scrollY + VERTICAL_OFFSET}px`\n }\n }\n\n if (!containerDiv.isConnected) {\n setContainerDivAttributes(containerDiv, className)\n anchorElem.append(containerDiv)\n }\n containerDiv.setAttribute('id', 'slash-menu')\n anchorElementRef.current = containerDiv\n rootElement.setAttribute('aria-controls', 'slash-menu')\n }\n }, [editor, resolution, className, anchorElem])\n\n useEffect(() => {\n const rootElement = editor.getRootElement()\n if (resolution !== null) {\n positionMenu()\n return () => {\n if (rootElement !== null) {\n rootElement.removeAttribute('aria-controls')\n }\n\n const containerDiv = anchorElementRef.current\n if (containerDiv !== null && containerDiv.isConnected) {\n containerDiv.remove()\n containerDiv.removeAttribute('id')\n }\n }\n }\n }, [editor, positionMenu, resolution])\n\n const onVisibilityChange = useCallback(\n (isInView: boolean) => {\n if (resolution !== null) {\n if (!isInView) {\n setResolution(null)\n }\n }\n },\n [resolution, setResolution],\n )\n\n useDynamicPositioning(resolution, anchorElementRef, positionMenu, onVisibilityChange)\n\n return anchorElementRef\n}\n", "'use client'\nimport { isPoint, type Point } from './point.js'\n\ninterface ContainsPointReturn {\n reason: {\n isOnBottomSide: boolean\n isOnLeftSide: boolean\n isOnRightSide: boolean\n isOnTopSide: boolean\n }\n result: boolean\n}\n\nexport class Rect {\n private readonly _bottom: number\n\n private readonly _left: number\n\n private readonly _right: number\n\n private readonly _top: number\n\n constructor(left: number, top: number, right: number, bottom: number) {\n const [physicTop, physicBottom] = top <= bottom ? [top, bottom] : [bottom, top]\n\n const [physicLeft, physicRight] = left <= right ? [left, right] : [right, left]\n\n this._top = physicTop\n this._right = physicRight\n this._left = physicLeft\n this._bottom = physicBottom\n }\n\n static fromDOM(dom: HTMLElement): Rect {\n const { height, left, top, width } = dom.getBoundingClientRect()\n return Rect.fromLWTH(left, width, top, height)\n }\n\n static fromDOMRect(domRect: DOMRect): Rect {\n const { height, left, top, width } = domRect\n return Rect.fromLWTH(left, width, top, height)\n }\n\n static fromLTRB(left: number, top: number, right: number, bottom: number): Rect {\n return new Rect(left, top, right, bottom)\n }\n\n static fromLWTH(left: number, width: number, top: number, height: number): Rect {\n return new Rect(left, top, left + width, top + height)\n }\n\n static fromPoints(startPoint: Point, endPoint: Point): Rect {\n const { x: left, y: top } = startPoint\n const { x: right, y: bottom } = endPoint\n return Rect.fromLTRB(left, top, right, bottom)\n }\n\n public contains({ x, y }: Point): ContainsPointReturn\n\n public contains({ bottom, left, right, top }: Rect): boolean\n\n public contains(target: Point | Rect): boolean | ContainsPointReturn {\n if (isPoint(target)) {\n const { x, y } = target\n\n const isOnTopSide = y < this._top\n const isOnBottomSide = y > this._bottom\n const isOnLeftSide = x < this._left\n const isOnRightSide = x > this._right\n\n const result = !isOnTopSide && !isOnBottomSide && !isOnLeftSide && !isOnRightSide\n\n return {\n reason: {\n isOnBottomSide,\n isOnLeftSide,\n isOnRightSide,\n isOnTopSide,\n },\n result,\n }\n }\n const { bottom, left, right, top } = target\n\n return (\n top >= this._top &&\n top <= this._bottom &&\n bottom >= this._top &&\n bottom <= this._bottom &&\n left >= this._left &&\n left <= this._right &&\n right >= this._left &&\n right <= this._right\n )\n }\n\n public distanceFromPoint(point: Point): {\n distance: number\n isOnBottomSide: boolean\n isOnLeftSide: boolean\n isOnRightSide: boolean\n isOnTopSide: boolean\n } {\n const containsResult = this.contains(point)\n if (containsResult.result) {\n return {\n distance: 0,\n isOnBottomSide: containsResult.reason.isOnBottomSide,\n isOnLeftSide: containsResult.reason.isOnLeftSide,\n isOnRightSide: containsResult.reason.isOnRightSide,\n isOnTopSide: containsResult.reason.isOnTopSide,\n }\n }\n\n let dx = 0 // Horizontal distance to the closest edge\n let dy = 0 // Vertical distance to the closest edge\n\n // If the point is to the left of the rectangle\n if (point.x < this._left) {\n dx = this._left - point.x\n }\n // If the point is to the right of the rectangle\n else if (point.x > this._right) {\n dx = point.x - this._right\n }\n\n // If the point is above the rectangle\n if (point.y < this._top) {\n dy = this._top - point.y\n }\n // If the point is below the rectangle\n else if (point.y > this._bottom) {\n dy = point.y - this._bottom\n }\n\n // Use the Pythagorean theorem to calculate the distance\n return {\n distance: Math.sqrt(dx * dx + dy * dy),\n isOnBottomSide: point.y > this._bottom,\n isOnLeftSide: point.x < this._left,\n isOnRightSide: point.x > this._right,\n isOnTopSide: point.y < this._top,\n }\n }\n\n public equals({ bottom, left, right, top }: Rect): boolean {\n return (\n top === this._top && bottom === this._bottom && left === this._left && right === this._right\n )\n }\n\n public generateNewRect({\n bottom = this.bottom,\n left = this.left,\n right = this.right,\n top = this.top,\n }): Rect {\n return new Rect(left, top, right, bottom)\n }\n\n public intersectsWith(rect: Rect): boolean {\n const { height: h1, left: x1, top: y1, width: w1 } = rect\n const { height: h2, left: x2, top: y2, width: w2 } = this\n const maxX = x1 + w1 >= x2 + w2 ? x1 + w1 : x2 + w2\n const maxY = y1 + h1 >= y2 + h2 ? y1 + h1 : y2 + h2\n const minX = x1 <= x2 ? x1 : x2\n const minY = y1 <= y2 ? y1 : y2\n return maxX - minX <= w1 + w2 && maxY - minY <= h1 + h2\n }\n\n get bottom(): number {\n return this._bottom\n }\n\n get height(): number {\n return Math.abs(this._bottom - this._top)\n }\n\n get left(): number {\n return this._left\n }\n\n get right(): number {\n return this._right\n }\n\n get top(): number {\n return this._top\n }\n\n get width(): number {\n return Math.abs(this._left - this._right)\n }\n}\n", "import type {\n EditorConfig,\n Klass,\n LexicalEditor,\n LexicalNode,\n LexicalNodeReplacement,\n} from 'lexical'\n\nimport React from 'react'\n\nimport type { BlockDecorateFunction } from '../../features/blocks/client/nodes/BlocksNode.js'\nimport type { InlineBlockDecorateFunction } from '../../features/blocks/client/nodes/InlineBlocksNode.js'\nimport type { NodeWithHooks } from '../../features/typesServer.js'\nimport type {\n LexicalEditorNodeMap,\n NodeMapBlockValue,\n NodeMapInlineBlockValue,\n NodeMapValue,\n} from '../../types/index.js'\nimport type { SanitizedClientEditorConfig, SanitizedServerEditorConfig } from '../config/types.js'\n\n// Store view definitions for each editor and node type\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst editorNodeViews = new WeakMap<LexicalEditor, Map<string, NodeMapValue<any>>>()\n\n/**\n * Register view definitions for an editor\n */\nexport function registerEditorNodeViews(\n editor: LexicalEditor,\n nodeViews: LexicalEditorNodeMap,\n): void {\n if (!editorNodeViews.has(editor)) {\n editorNodeViews.set(editor, new Map())\n }\n const editorViews = editorNodeViews.get(editor)!\n\n // Register each node type's view\n for (const [nodeType, value] of Object.entries(nodeViews)) {\n if (!value || typeof value !== 'object') {\n continue\n }\n\n // Handle blocks specially - store each block type with key 'block:blockType'\n if (nodeType === 'blocks') {\n for (const [blockType, viewDef] of Object.entries(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n value as Record<string, NodeMapValue<any>>,\n )) {\n editorViews.set(`block:${blockType}`, viewDef)\n }\n continue\n }\n\n // Handle inlineBlocks specially - store each block type with key 'inlineBlock:blockType'\n if (nodeType === 'inlineBlocks') {\n for (const [blockType, viewDef] of Object.entries(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n value as Record<string, NodeMapValue<any>>,\n )) {\n editorViews.set(`inlineBlock:${blockType}`, viewDef)\n }\n continue\n }\n\n // Regular node types\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n editorViews.set(nodeType, value as NodeMapValue<any>)\n }\n}\n\n/**\n * Clear all view overrides for an editor (restores default rendering)\n */\nexport function clearEditorNodeViews(editor: LexicalEditor): void {\n editorNodeViews.delete(editor)\n}\n\n/**\n * Get the view definition for a specific editor and node\n */\nfunction getEditorNodeView(\n editor: LexicalEditor,\n nodeType: string,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n node?: any,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): NodeMapValue<any> | undefined {\n const editorViews = editorNodeViews.get(editor)\n\n // For block nodes, look up by blockType\n if (nodeType === 'block' && node?.['__fields']?.blockType) {\n const blockType = node['__fields'].blockType\n return editorViews?.get(`block:${blockType}`)\n }\n\n // For inlineBlock nodes, look up by blockType\n if (nodeType === 'inlineBlock' && node?.['__fields']?.blockType) {\n const blockType = node['__fields'].blockType\n return editorViews?.get(`inlineBlock:${blockType}`)\n }\n\n // Regular node types\n return editorViews?.get(nodeType)\n}\n\n/**\n * Apply view overrides to a specific node type by modifying its prototype\n * Uses WeakMap to check per-editor at runtime\n */\nfunction applyNodeOverride({\n node,\n nodeType,\n}: {\n node: Klass<LexicalNode>\n nodeType: string\n}): void {\n if (!('getType' in node) || node.getType() !== nodeType) {\n return\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const NodeClass = node as any\n\n // Store original methods if not already stored\n if (!NodeClass.prototype._originalDecorate) {\n NodeClass.prototype._originalDecorate = NodeClass.prototype.decorate\n }\n if (!NodeClass.prototype._originalCreateDOM) {\n NodeClass.prototype._originalCreateDOM = NodeClass.prototype.createDOM\n }\n\n // Override decorate method (for DecoratorNodes)\n if (NodeClass.prototype.decorate && !NodeClass.prototype._decorateOverridden) {\n NodeClass.prototype._decorateOverridden = true\n const hasCreateDOM = !!NodeClass.prototype.createDOM\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n NodeClass.prototype.decorate = function (editor: LexicalEditor, config: EditorConfig): any {\n const viewDef = getEditorNodeView(editor, nodeType, this)\n\n if (viewDef) {\n // Priority 1: If Component is provided, use it\n if (viewDef.Component) {\n return viewDef.Component({\n config,\n editor,\n isEditor: true,\n isJSXConverter: false,\n node: this,\n })\n }\n\n // Priority 2: If custom createDOM is provided, use html in decorate\n if (viewDef.createDOM && viewDef.html) {\n const htmlContent =\n typeof viewDef.html === 'function'\n ? viewDef.html({ config, editor, isEditor: true, isJSXConverter: false, node: this })\n : viewDef.html\n return React.createElement('span', {\n dangerouslySetInnerHTML: { __html: htmlContent },\n })\n }\n\n // Priority 3: If only html is provided (no custom createDOM),\n // createDOM will handle it, so decorate returns empty fragment\n if (viewDef.html && hasCreateDOM && !viewDef.createDOM) {\n return React.createElement(React.Fragment)\n }\n\n if (nodeType === 'block') {\n const blockViewDef: NodeMapBlockValue = viewDef as NodeMapBlockValue\n if (blockViewDef.Block || blockViewDef.Label) {\n const originalDecorate: BlockDecorateFunction = NodeClass.prototype._originalDecorate\n\n // Pass Block FC to BlockContent for rendering\n // BlockContent will render with useBlockComponentContext hook (client-only)\n return originalDecorate.call(\n this,\n editor,\n config,\n blockViewDef.Block,\n blockViewDef.Label,\n )\n }\n } else if (nodeType === 'inlineBlock') {\n const blockViewDef: NodeMapInlineBlockValue = viewDef as NodeMapInlineBlockValue\n if (blockViewDef.Block || blockViewDef.Label) {\n const originalDecorate: InlineBlockDecorateFunction =\n NodeClass.prototype._originalDecorate\n\n // Pass Block FC to BlockContent for rendering\n // BlockContent will render with useBlockComponentContext hook (client-only)\n return originalDecorate.call(\n this,\n editor,\n config,\n blockViewDef.Block,\n blockViewDef.Label,\n )\n }\n }\n }\n\n const originalDecorate: BlockDecorateFunction | InlineBlockDecorateFunction =\n NodeClass.prototype._originalDecorate\n\n // Otherwise use original\n return originalDecorate.call(this, editor, config)\n }\n }\n\n // Override createDOM method (for ElementNodes)\n if (NodeClass.prototype.createDOM && !NodeClass.prototype._createDOMOverridden) {\n NodeClass.prototype._createDOMOverridden = true\n NodeClass.prototype.createDOM = function (\n config: EditorConfig,\n editor: LexicalEditor,\n ): HTMLElement {\n const viewDef = getEditorNodeView(editor, nodeType, this)\n\n if (viewDef) {\n // If createDOM is provided, use it\n if (viewDef.createDOM) {\n return viewDef.createDOM({ config, editor, node: this })\n }\n\n // If html is provided (as a function or string), create element from it\n if (viewDef.html) {\n const htmlContent =\n typeof viewDef.html === 'function'\n ? viewDef.html({ config, editor, isEditor: true, isJSXConverter: false, node: this })\n : viewDef.html\n const tempDiv = document.createElement('div')\n tempDiv.innerHTML = htmlContent\n return (tempDiv.firstElementChild as HTMLElement) || tempDiv\n }\n }\n\n // Otherwise use original\n return NodeClass.prototype._originalCreateDOM.call(this, config, editor)\n }\n }\n}\n\nexport function getEnabledNodes({\n editorConfig,\n nodeViews,\n}: {\n editorConfig: SanitizedClientEditorConfig | SanitizedServerEditorConfig\n nodeViews?: LexicalEditorNodeMap\n}): Array<Klass<LexicalNode> | LexicalNodeReplacement> {\n const nodes = getEnabledNodesFromServerNodes({\n nodes: editorConfig.features.nodes,\n })\n\n if (nodeViews) {\n // Apply node overrides by modifying prototypes (once globally)\n // The overrides check per-editor at runtime using WeakMap\n const nodeTypesToOverride = new Set<string>()\n\n for (const [key, value] of Object.entries(nodeViews)) {\n if (!value || typeof value !== 'object') {\n continue\n }\n\n // If 'blocks' key exists with content, we need to override 'block' nodes\n if (key === 'blocks' && Object.keys(value).length > 0) {\n nodeTypesToOverride.add('block')\n }\n // If 'inlineBlocks' key exists with content, we need to override 'inlineBlock' nodes\n else if (key === 'inlineBlocks' && Object.keys(value).length > 0) {\n nodeTypesToOverride.add('inlineBlock')\n }\n // Regular node types\n else {\n nodeTypesToOverride.add(key)\n }\n }\n\n for (const node of nodes) {\n if ('getType' in node) {\n const nodeType = node.getType()\n\n if (nodeTypesToOverride.has(nodeType)) {\n applyNodeOverride({ node, nodeType })\n }\n }\n }\n }\n\n return nodes\n}\n\nexport function getEnabledNodesFromServerNodes({\n nodes,\n}: {\n nodes: Array<Klass<LexicalNode> | LexicalNodeReplacement> | Array<NodeWithHooks>\n}): Array<Klass<LexicalNode> | LexicalNodeReplacement> {\n return nodes.map((node) => {\n if ('node' in node) {\n return node.node\n }\n return node\n })\n}\n"],
|
|
5
|
+
"mappings": "AACO,IAAMA,EACX,OAAOC,OAAW,KAClB,OAAOA,OAAOC,SAAa,KAC3B,OAAOD,OAAOC,SAASC,cAAkB,ICJ3C,OAAAC,KAAAC,OAAA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AUC,UAAUG,mBAAmBiB,KAAK,KAAMb,EAAQ3B,CAAA,CACnE,EAEJ,CAEO,SAAS8C,GAAgB,CAC9BC,aAAAA,EACA9C,UAAAA,CAAS,EAIV,CACC,IAAM+C,EAAQC,GAA+B,CAC3CD,MAAOD,EAAaG,SAASF,KAC/B,CAAA,EAEA,GAAI/C,EAAW,CAGb,IAAMkD,EAAsB,IAAIC,IAEhC,OAAW,CAACC,EAAK7C,CAAA,IAAUC,OAAOC,QAAQT,CAAA,EACpC,CAACO,GAAS,OAAOA,GAAU,WAK3B6C,IAAQ,UAAY5C,OAAO6C,KAAK9C,CAAA,EAAO+C,OAAS,EAClDJ,EAAoBK,IAAI,OAAA,EAGjBH,IAAQ,gBAAkB5C,OAAO6C,KAAK9C,CAAA,EAAO+C,OAAS,EAC7DJ,EAAoBK,IAAI,aAAA,EAIxBL,EAAoBK,IAAIH,CAAA,GAI5B,QAAWrC,KAAQgC,EACjB,GAAI,YAAahC,EAAM,CACrB,IAAMT,EAAWS,EAAKE,QAAO,EAEzBiC,EAAoBjD,IAAIK,CAAA,GAC1BU,GAAkB,CAAED,KAAAA,EAAMT,SAAAA,CAAS,CAAA,CAEvC,CAEJ,CAEA,OAAOyC,CACT,CAEO,SAASC,GAA+B,CAC7CD,MAAAA,CAAK,EAGN,CACC,OAAOA,EAAMS,IAAKzC,GACZ,SAAUA,EACLA,EAAKA,KAEPA,CACT,CACF",
|
|
6
|
+
"names": ["CAN_USE_DOM", "window", "document", "createElement", "c", "_c", "useRef", "useRunDeprioritized", "t0", "$", "timeout", "undefined", "idleHandleRef", "t1", "fn", "Promise", "resolve", "exec", "window", "current", "cancelIdleCallback", "requestIdleCallback", "interactionResponse", "then", "setTimeout", "requestAnimationFrame", "useControllableState", "createContext", "use", "useMemo", "RichTextViewContext", "currentView", "inheritable", "setCurrentView", "RichTextViewProvider", "args", "parentContext", "useRichTextView", "hasOwnExplicitView", "undefined", "isControlledByParent", "Boolean", "views", "hasExplicitCurrentView", "children", "currentViewFromProps", "currentViewRaw", "value", "currentViewMap", "_jsx", "Point", "_x", "_y", "constructor", "x", "y", "calcDeltaXTo", "calcDeltaYTo", "calcDistanceTo", "point", "Math", "sqrt", "pow", "calcHorizontalDistanceTo", "abs", "calcVerticalDistance", "equals", "isPoint", "useLexicalComposerContext", "mergeRegister", "$getSelection", "$isRangeSelection", "$isTextNode", "COMMAND_PRIORITY_LOW", "createCommand", "getDOMSelection", "useCallback", "useEffect", "useState", "React", "c", "_c", "useLexicalComposerContext", "mergeRegister", "$getSelection", "$isRangeSelection", "$setSelection", "COMMAND_PRIORITY_LOW", "COMMAND_PRIORITY_NORMAL", "createCommand", "KEY_ARROW_DOWN_COMMAND", "KEY_ARROW_UP_COMMAND", "KEY_ENTER_COMMAND", "KEY_ESCAPE_COMMAND", "KEY_TAB_COMMAND", "useCallback", "useEffect", "useLayoutEffect", "useMemo", "useRef", "useState", "baseClass", "scrollIntoViewIfNeeded", "target", "typeaheadContainerNode", "document", "getElementById", "typeaheadRect", "getBoundingClientRect", "top", "height", "window", "innerHeight", "scrollIntoView", "block", "getFullMatchOffset", "documentText", "entryText", "offset", "triggerOffset", "i", "length", "substring", "$splitNodeContainingQuery", "match", "selection", "$getSelection", "$isRangeSelection", "isCollapsed", "anchor", "type", "anchorNode", "getNode", "isSimpleText", "selectionOffset", "textContent", "getTextContent", "slice", "characterOffset", "replaceableString", "queryOffset", "matchingString", "startOffset", "newNode", "splitText", "getScrollParent", "element", "includeHidden", "style", "getComputedStyle", "excludeStaticParent", "position", "overflowRegex", "body", "parent1", "parentElement", "test", "overflow", "overflowY", "overflowX", "isTriggerVisibleInNearestScrollContainer", "targetElement", "containerElement", "tRect", "cRect", "bottom", "useDynamicPositioning", "resolution", "targetElementRef", "onReposition", "onVisibilityChange", "$", "_c", "editor", "useLexicalComposerContext", "t0", "t1", "current", "rootElement", "getRootElement", "rootScrollParent", "ticking", "previousIsInView", "handleScroll", "requestAnimationFrame", "isInView", "resizeObserver", "ResizeObserver", "addEventListener", "capture", "passive", "observe", "disconnect", "removeEventListener", "useEffect", "SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND", "createCommand", "LexicalMenu", "anchorElementRef", "close", "groups", "menuRenderFn", "shouldSplitNodeWithQuery", "selectedItemKey", "setSelectedItemKey", "useState", "updateSelectedItem", "useCallback", "item", "rootElem", "setAttribute", "key", "setSelectedItemKeyToFirstMatchingItem", "allItems", "flatMap", "group", "items", "firstMatchingItem", "selectItemAndCleanUp", "selectedItem", "update", "textNodeContainingQuery", "remove", "setTimeout", "read", "clone", "$setSelection", "onSelect", "queryString", "removeAttribute", "useLayoutEffect", "mergeRegister", "registerCommand", "ref", "COMMAND_PRIORITY_LOW", "KEY_ARROW_DOWN_COMMAND", "payload", "event", "selectedIndex", "findIndex", "newSelectedIndex", "newSelectedItem", "dispatchCommand", "index", "preventDefault", "stopImmediatePropagation", "COMMAND_PRIORITY_NORMAL", "KEY_ARROW_UP_COMMAND", "KEY_ESCAPE_COMMAND", "KEY_TAB_COMMAND", "find", "KEY_ENTER_COMMAND", "listItemProps", "useMemo", "setContainerDivAttributes", "containerDiv", "className", "display", "useMenuAnchorRef", "anchorElem", "setResolution", "Symbol", "for", "CAN_USE_DOM", "createElement", "useRef", "parent", "undefined", "menuEle", "firstChild", "width", "getRect", "left", "rawTop", "scrollY", "scrollX", "menuRect", "menuHeight", "menuWidth", "rootElementRect", "isRTL", "dir", "documentElement", "anchorRect", "leftBoundary", "Math", "max", "right", "newLeft", "wouldGoOffBottomOfScreen", "wouldGoOffTopOfScreen", "isConnected", "append", "positionMenu", "t2", "t3", "rootElement_0", "containerDiv_0", "t4", "PUNCTUATION", "getTextUpToAnchor", "selection", "anchor", "type", "anchorNode", "getNode", "isSimpleText", "anchorOffset", "offset", "getTextContent", "slice", "tryToPositionRange", "leadOffset", "range", "editorWindow", "domSelection", "getDOMSelection", "isCollapsed", "startOffset", "endOffset", "setStart", "setEnd", "getQueryTextForSearch", "editor", "text", "getEditorState", "read", "$getSelection", "$isRangeSelection", "isSelectionOnEntityBoundary", "prevSibling", "getPreviousSibling", "$isTextNode", "isTextEntity", "startTransition", "callback", "ENABLE_SLASH_MENU_COMMAND", "createCommand", "LexicalTypeaheadMenuPlugin", "anchorClassName", "anchorElem", "groups", "menuRenderFn", "onClose", "onOpen", "onQueryChange", "triggerFn", "useLexicalComposerContext", "resolution", "setResolution", "useState", "anchorElementRef", "useMenuAnchorRef", "closeTypeahead", "useCallback", "openTypeahead", "res", "useEffect", "mergeRegister", "registerCommand", "node", "match", "matchingString", "replaceableString", "_window", "window", "document", "createRange", "getRect", "getBoundingClientRect", "COMMAND_PRIORITY_LOW", "updateListener", "undefined", "query", "removeUpdateListener", "registerUpdateListener", "current", "_jsx", "LexicalMenu", "close", "shouldSplitNodeWithQuery", "Rect", "_bottom", "_left", "_right", "_top", "constructor", "left", "top", "right", "bottom", "physicTop", "physicBottom", "physicLeft", "physicRight", "fromDOM", "dom", "height", "width", "getBoundingClientRect", "fromLWTH", "fromDOMRect", "domRect", "fromLTRB", "fromPoints", "startPoint", "endPoint", "x", "y", "contains", "target", "isPoint", "isOnTopSide", "isOnBottomSide", "isOnLeftSide", "isOnRightSide", "reason", "result", "distanceFromPoint", "point", "containsResult", "distance", "dx", "dy", "Math", "sqrt", "equals", "generateNewRect", "intersectsWith", "rect", "h1", "x1", "y1", "w1", "h2", "x2", "y2", "w2", "maxX", "maxY", "minX", "minY", "abs", "React", "editorNodeViews", "WeakMap", "registerEditorNodeViews", "editor", "nodeViews", "has", "set", "Map", "editorViews", "get", "nodeType", "value", "Object", "entries", "blockType", "viewDef", "clearEditorNodeViews", "delete", "getEditorNodeView", "node", "applyNodeOverride", "getType", "NodeClass", "prototype", "_originalDecorate", "decorate", "_originalCreateDOM", "createDOM", "_decorateOverridden", "hasCreateDOM", "config", "Component", "isEditor", "isJSXConverter", "html", "htmlContent", "createElement", "dangerouslySetInnerHTML", "__html", "Fragment", "blockViewDef", "Block", "Label", "call", "_createDOMOverridden", "tempDiv", "document", "innerHTML", "firstElementChild", "getEnabledNodes", "editorConfig", "nodes", "getEnabledNodesFromServerNodes", "features", "nodeTypesToOverride", "Set", "key", "keys", "length", "add", "map"]
|
|
7
|
+
}
|