@lexical/react 0.51.0 → 0.51.1-nightly.20260921.0
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/LexicalAutoEmbedPlugin.prod.js +1 -1
- package/dist/LexicalAutoLinkPlugin.prod.js +1 -1
- package/dist/LexicalBlockWithAlignableContents.prod.js +1 -1
- package/dist/LexicalCharacterLimitPlugin.prod.js +2 -2
- package/dist/LexicalCollaborationPlugin.prod.js +1 -1
- package/dist/LexicalComposer.prod.js +1 -1
- package/dist/LexicalDraggableBlockPlugin.prod.js +1 -1
- package/dist/LexicalNodeMenuPlugin.prod.js +1 -1
- package/dist/LexicalPlainTextPlugin.prod.js +1 -1
- package/dist/LexicalReactExtension.prod.js +3 -3
- package/dist/LexicalReactPluginHostExtension.prod.js +1 -1
- package/dist/LexicalRichTextPlugin.prod.js +1 -1
- package/dist/LexicalTablePlugin.prod.js +1 -1
- package/dist/LexicalTreeView.prod.js +1 -2
- package/dist/LexicalTypeaheadMenuPlugin.prod.js +1 -1
- package/dist/LexicalTypeaheadMenuPluginUtils.prod.js +1 -1
- package/dist/useLexicalNodeSelection.prod.js +1 -1
- package/package.json +20 -20
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import{$isLinkNode as e,LinkNode as t,AutoLinkNode as n}from"@lexical/link";import{INSERT_EMBED_COMMAND as o}from"@lexical/react/LexicalAutoEmbedPluginUtils";export{AutoEmbedOption,INSERT_EMBED_COMMAND,URL_MATCHER}from"@lexical/react/LexicalAutoEmbedPluginUtils";import{useLexicalComposerContext as r}from"@lexical/react/LexicalComposerContext";import{LexicalNodeMenuPlugin as l}from"@lexical/react/LexicalNodeMenuPlugin";import{objectKlassEquals as i}from"@lexical/utils";import{$getNodeByKey as a,mergeRegister as c,PASTE_COMMAND as s,$onUpdate as u,COMMAND_PRIORITY_BEFORE_EDITOR as m,COMMAND_PRIORITY_EDITOR as d,$getSelection as p,COMMAND_PRIORITY_LOW as f,PASTE_TAG as x}from"lexical";import{useState as g,useCallback as C,useEffect as E,useMemo as b}from"react";import{jsx as M}from"react/jsx-runtime";function L({embedConfigs:L,onOpenEmbedModalForConfig:P,getMenuOptions:y,menuRenderFn:A,menuCommandPriority:R=f}){const[U]=r(),[v,D]=g(null),[O,_]=g(null),N=C(()=>{D(null),_(null)},[]),S=C(async t=>{const n=U.read("latest",function(){const n=a(t);if(e(n))return n.getURL()});if(void 0!==n)for(const e of L)
|
|
9
|
+
import{$isLinkNode as e,LinkNode as t,AutoLinkNode as n}from"@lexical/link";import{INSERT_EMBED_COMMAND as o}from"@lexical/react/LexicalAutoEmbedPluginUtils";export{AutoEmbedOption,INSERT_EMBED_COMMAND,URL_MATCHER}from"@lexical/react/LexicalAutoEmbedPluginUtils";import{useLexicalComposerContext as r}from"@lexical/react/LexicalComposerContext";import{LexicalNodeMenuPlugin as l}from"@lexical/react/LexicalNodeMenuPlugin";import{objectKlassEquals as i}from"@lexical/utils";import{$getNodeByKey as a,mergeRegister as c,PASTE_COMMAND as s,$onUpdate as u,COMMAND_PRIORITY_BEFORE_EDITOR as m,COMMAND_PRIORITY_EDITOR as d,$getSelection as p,COMMAND_PRIORITY_LOW as f,PASTE_TAG as x}from"lexical";import{useState as g,useCallback as C,useEffect as E,useMemo as b}from"react";import{jsx as M}from"react/jsx-runtime";function L({embedConfigs:L,onOpenEmbedModalForConfig:P,getMenuOptions:y,menuRenderFn:A,menuCommandPriority:R=f}){const[U]=r(),[v,D]=g(null),[O,_]=g(null),N=C(()=>{D(null),_(null)},[]),S=C(async t=>{const n=U.read("latest",function(){const n=a(t);if(e(n))return n.getURL()});if(void 0!==n)for(const e of L)null!=await Promise.resolve(e.parseUrl(n))&&(_(e),D(t))},[U,L]);E(()=>{let e=!1;const o=(t,{updateTags:n})=>{for(const[o,r]of t)"created"===r&&n.has(x)&&e?S(o):o===v&&N()};return c(U.registerCommand(s,t=>(e=i(t,ClipboardEvent)&&null!==t.clipboardData&&/^\S+$/.test(t.clipboardData.getData("text/plain")),e&&u(()=>{e=!1}),!1),m),...[t,n].map(e=>U.registerMutationListener(e,o,{skipInitialization:!0})))},[S,U,v,N]),E(()=>{if(P)return U.registerCommand(o,e=>{const t=L.find(({type:t})=>t===e);return!!t&&(P(t),!0)},d)},[U,L,P]);const F=C(async function(){if(null!=O&&null!=v){const t=U.read("latest",()=>{const t=a(v);return e(t)?t:null});if(e(t)){const e=await Promise.resolve(O.parseUrl(t.__url));null!=e&&U.update(()=>{p()||t.selectEnd(),O.insertNode(U,e),t.isAttached()&&t.remove()})}}},[O,U,v]),T=b(()=>null!=O&&null!=v?y(O,F,N):[],[O,F,y,v,N]),h=C((e,t,n)=>{U.update(()=>{e.onSelect(t),n()})},[U]);return null!=v?/*#__PURE__*/M(l,{nodeKey:v,onClose:N,onSelectOption:h,options:T,menuRenderFn:A,commandPriority:R}):null}export{L as LexicalAutoEmbedPlugin};
|
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import{AutoLinkNode as e,registerAutoLink as r}from"@lexical/link";export{createLinkMatcherWithRegExp}from"@lexical/link";import{useLexicalComposerContext as n}from"@lexical/react/LexicalComposerContext";import{useEffect as o}from"react";function t(n,t,i,a){o(()=>{n.hasNodes([e])||function(e,...r){const n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(const e of r)o.append("v",e);throw n.search=o.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(77)}),o(()=>r(n,{changeHandlers:i?[i]:[],excludeParents:a??[],matchers:t}),[n,t,i,a])}
|
|
9
|
+
import{AutoLinkNode as e,registerAutoLink as r}from"@lexical/link";export{createLinkMatcherWithRegExp}from"@lexical/link";import{useLexicalComposerContext as n}from"@lexical/react/LexicalComposerContext";import{useEffect as o}from"react";function t({matchers:t,onChange:i,excludeParents:a}){const[c]=n();return function(n,t,i,a){o(()=>{n.hasNodes([e])||function(e,...r){const n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(const e of r)o.append("v",e);throw n.search=o.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(77)}),o(()=>r(n,{changeHandlers:i?[i]:[],excludeParents:a??[],matchers:t}),[n,t,i,a])}(c,t,i,a),null}export{t as AutoLinkPlugin};
|
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import{useLexicalComposerContext as e}from"@lexical/react/LexicalComposerContext";import{$isDecoratorBlockNode as r}from"@lexical/react/LexicalDecoratorBlockNode";import{useLexicalNodeSelection as t}from"@lexical/react/useLexicalNodeSelection";import{$getNearestBlockElementAncestorOrThrow as o}from"@lexical/utils";import{mergeRegister as i,FORMAT_ELEMENT_COMMAND as l,$getSelection as c,$isNodeSelection as a,$getNodeByKey as m,$isRangeSelection as n,COMMAND_PRIORITY_LOW as s,CLICK_COMMAND as f,getComposedEventTarget as u}from"lexical";import{useRef as x,useEffect as d}from"react";import{jsx as p}from"react/jsx-runtime";function N({children:N,format:g,nodeKey:C,className:h}){const[v]=e(),[y,F,L]=t(C),j=x(null);return d(()=>i(v.registerCommand(l,e=>{if(y){const t=c();if(a(t)){const t=m(C);r(t)&&t.setFormat(e)}else if(n(t)){const i=t.getNodes();for(const t of i)
|
|
9
|
+
import{useLexicalComposerContext as e}from"@lexical/react/LexicalComposerContext";import{$isDecoratorBlockNode as r}from"@lexical/react/LexicalDecoratorBlockNode";import{useLexicalNodeSelection as t}from"@lexical/react/useLexicalNodeSelection";import{$getNearestBlockElementAncestorOrThrow as o}from"@lexical/utils";import{mergeRegister as i,FORMAT_ELEMENT_COMMAND as l,$getSelection as c,$isNodeSelection as a,$getNodeByKey as m,$isRangeSelection as n,COMMAND_PRIORITY_LOW as s,CLICK_COMMAND as f,getComposedEventTarget as u}from"lexical";import{useRef as x,useEffect as d}from"react";import{jsx as p}from"react/jsx-runtime";function N({children:N,format:g,nodeKey:C,className:h}){const[v]=e(),[y,F,L]=t(C),j=x(null);return d(()=>i(v.registerCommand(l,e=>{if(y){const t=c();if(a(t)){const t=m(C);r(t)&&t.setFormat(e)}else if(n(t)){const i=t.getNodes();for(const t of i)r(t)?t.setFormat(e):o(t).setFormat(e)}return!0}return!1},s),v.registerCommand(f,e=>u(e)===j.current&&(e.preventDefault(),e.shiftKey||L(),F(!y),!0),s)),[L,v,y,C,F]),/*#__PURE__*/p("div",{className:[h.base,y?h.focus:null].filter(Boolean).join(" "),ref:j,style:{textAlign:g||void 0},children:N})}export{N as BlockWithAlignableContents};
|
|
@@ -6,5 +6,5 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import{useLexicalComposerContext as e}from"@lexical/react/LexicalComposerContext";import{useEffect as t,useState as n,useMemo as r}from"react";import{OverflowNode as o,$isOverflowNode as i,$createOverflowNode as s}from"@lexical/overflow";import{$rootTextContent as l}from"@lexical/text";import{$dfsWithSlots as c,$unwrapNode as a}from"@lexical/utils";import{mergeRegister as f,DELETE_CHARACTER_COMMAND as g,$getSelection as m,$isRangeSelection as u,$isElementNode as d,COMMAND_PRIORITY_LOW as h,HISTORY_MERGE_TAG as p,$isLeafNode as x,$getSlotHost as C,$findMatchingParent as S,$isTextNode as v,$setSelection as w}from"lexical";import{jsx as T}from"react/jsx-runtime";function b(e
|
|
10
|
-
return T("span",{className:"characters-limit "+(e<0?"characters-limit-exceeded":""),children:e})}function
|
|
9
|
+
import{useLexicalComposerContext as e}from"@lexical/react/LexicalComposerContext";import{useEffect as t,useState as n,useMemo as r}from"react";import{OverflowNode as o,$isOverflowNode as i,$createOverflowNode as s}from"@lexical/overflow";import{$rootTextContent as l}from"@lexical/text";import{$dfsWithSlots as c,$unwrapNode as a}from"@lexical/utils";import{mergeRegister as f,DELETE_CHARACTER_COMMAND as g,$getSelection as m,$isRangeSelection as u,$isElementNode as d,COMMAND_PRIORITY_LOW as h,HISTORY_MERGE_TAG as p,$isLeafNode as x,$getSlotHost as C,$findMatchingParent as S,$isTextNode as v,$setSelection as w}from"lexical";import{jsx as T}from"react/jsx-runtime";function b(e){const t=s();return e.replace(t),t.append(e),t}function y(e){const t=e.getPreviousSibling();if(!i(t))return;const n=e.getFirstChild(),r=t.getChildren(),o=r.length;if(null===n)e.append(...r);else for(let e=0;e<o;e++)n.insertBefore(r[e]);const s=m();if(u(s)){const n=s.anchor,r=n.getNode(),i=s.focus,l=i.getNode();r.is(t)?n.set(e.getKey(),n.offset,"element"):r.is(e)&&n.set(e.getKey(),o+n.offset,"element"),l.is(t)?i.set(e.getKey(),i.offset,"element"):l.is(e)&&i.set(e.getKey(),o+i.offset,"element")}t.remove()}let N=null;function z({remainingCharacters:e}){
|
|
10
|
+
return T("span",{className:"characters-limit "+(e<0?"characters-limit-exceeded":""),children:e})}function L({charset:s="UTF-16",maxLength:T=5,renderer:L=z}){const[P]=e(),[U,E]=n(T);return function(e,n,r=Object.freeze({})){const{strlen:s=e=>e.length,remainingCharacters:T=()=>{}}=r;t(()=>{e.hasNodes([o])||function(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(57)},[e]),t(()=>{let t=e.read("latest",l),r=null;function o(){const o=s(t),l=o>n||null!==r&&r>n;if(T(n-o),null===r||l){const r=function(e,t,n){let r=0,o=0;if("function"==typeof Intl.Segmenter){const i=(new Intl.Segmenter).segment(e);for(const{segment:e}of i){const i=o+n(e);if(i>t)break;o=i,r+=e.length}}else{const i=Array.from(e),s=i.length;for(let e=0;e<s;e++){const s=i[e],l=o+n(s);if(l>t)break;o=l,r+=s.length}}return r}(t,n,s);e.update(()=>{!function(e){const t=c(),n=t.length;let r=0;for(let o=0;o<n;o+=1){const{node:n}=t[o],s=n.getPreviousSibling();d(s)&&!s.isInline()&&(r+=2);const l=x(n)&&null!==C(n),c=x(n)&&!l&&!S(n,i);if(i(n)){const t=r;if(r+n.getTextContentSize()<=e){const e=n.getParent(),t=n.getPreviousSibling(),r=n.getNextSibling();a(n);const o=m();!u(o)||o.anchor.getNode().isAttached()&&o.focus.getNode().isAttached()||(v(t)?t.select():v(r)?r.select():null!==e&&e.select())}else if(t<e){const r=n.getFirstDescendant(),o=t+(null!==r?r.getTextContentSize():0);(v(r)&&r.isSimpleText()||o<=e)&&a(n)}}else if(l)r+=n.getTextContentSize();else if(c){const t=r;if(r+=n.getTextContentSize(),r>e&&!i(n.getParent())){const r=m();let o;if(t<e&&v(n)&&n.isSimpleText()){const[,r]=n.splitText(e-t);o=b(r)}else o=b(n);null!==r&&w(r),y(o);const s=o.getNextSibling();i(s)&&y(s)}}}}(r)},{tag:p})}r=o}return o(),f(e.registerTextContentListener(e=>{t=e}),e.registerUpdateListener(({dirtyLeaves:t,dirtyElements:n})=>{const r=e.isComposing(),i=t.size>0||n.size>0;!r&&i&&o()}),e.registerCommand(g,e=>{const t=m();if(!u(t))return!1;const n=t.anchor.getNode().getParent(),r=n?n.getParent():null,o=r?r.getNextSibling():null;return t.deleteCharacter(e),r&&r.isEmpty()?r.remove():d(o)&&o.isEmpty()&&o.remove(),!0},h))},[e,n,T,s])}(P,T,r(()=>({remainingCharacters:E,strlen:e=>{if("UTF-8"===s)return function(e){const t=void 0===window.TextEncoder?null:(null===N&&(N=new window.TextEncoder),N);if(null===t){const t=encodeURIComponent(e).match(/%[89ABab]/g);return e.length+(t?t.length:0)}return t.encode(e).length}(e);if("UTF-16"===s)return e.length;throw new Error("Unrecognized charset")}}),[s])),L({remainingCharacters:U})}export{L as CharacterLimitPlugin};
|
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import{useCollaborationContext as t}from"@lexical/react/LexicalCollaborationContext";import{useLexicalComposerContext as e}from"@lexical/react/LexicalComposerContext";import{syncCursorPositions as o,syncLexicalUpdateToYjs as r,createUndoManager as n,setLocalStateFocus as s,createBindingV2__EXPERIMENTAL as i,CLEAR_DIFF_VERSIONS_COMMAND__EXPERIMENTAL as a,syncYjsStateToLexicalV2__EXPERIMENTAL as c,DIFF_VERSIONS_COMMAND__EXPERIMENTAL as l,renderSnapshot__EXPERIMENTAL as d,syncLexicalUpdateToYjsV2__EXPERIMENTAL as u,syncYjsChangesToLexical as p,initLocalState as m,TOGGLE_CONNECT_COMMAND as f,syncYjsChangesToLexicalV2__EXPERIMENTAL as g,removeCursorHighlightRule as h,CONNECTED_COMMAND as y,createYjsBinding as C}from"@lexical/yjs";import*as v from"react";import{useRef as x,useCallback as S,useEffect as E,useMemo as b,useState as D}from"react";import{SKIP_COLLAB_TAG as N,mergeRegister as j,FOCUS_COMMAND as k,COMMAND_PRIORITY_EDITOR as w,BLUR_COMMAND as _,getActiveElement as B,registerEventListeners as M,UNDO_COMMAND as P,REDO_COMMAND as H,$getRoot as L,HISTORY_MERGE_TAG as U,$createParagraphNode as F,$getSelection as R,CAN_UNDO_COMMAND as T,CAN_REDO_COMMAND as X}from"lexical";import{createPortal as z}from"react-dom";import{UndoManager as A}from"yjs";import{jsx as q,Fragment as G}from"react/jsx-runtime";const I=Symbol.for("@lexical/yjs/UndoManager");function J(t,e,
|
|
9
|
+
import{useCollaborationContext as t}from"@lexical/react/LexicalCollaborationContext";import{useLexicalComposerContext as e}from"@lexical/react/LexicalComposerContext";import{syncCursorPositions as o,syncLexicalUpdateToYjs as r,createUndoManager as n,setLocalStateFocus as s,createBindingV2__EXPERIMENTAL as i,CLEAR_DIFF_VERSIONS_COMMAND__EXPERIMENTAL as a,syncYjsStateToLexicalV2__EXPERIMENTAL as c,DIFF_VERSIONS_COMMAND__EXPERIMENTAL as l,renderSnapshot__EXPERIMENTAL as d,syncLexicalUpdateToYjsV2__EXPERIMENTAL as u,syncYjsChangesToLexical as p,initLocalState as m,TOGGLE_CONNECT_COMMAND as f,syncYjsChangesToLexicalV2__EXPERIMENTAL as g,removeCursorHighlightRule as h,CONNECTED_COMMAND as y,createYjsBinding as C}from"@lexical/yjs";import*as v from"react";import{useRef as x,useCallback as S,useEffect as E,useMemo as b,useState as D}from"react";import{SKIP_COLLAB_TAG as N,mergeRegister as j,FOCUS_COMMAND as k,COMMAND_PRIORITY_EDITOR as w,BLUR_COMMAND as _,getActiveElement as B,registerEventListeners as M,UNDO_COMMAND as P,REDO_COMMAND as H,$getRoot as L,HISTORY_MERGE_TAG as U,$createParagraphNode as F,$getSelection as R,CAN_UNDO_COMMAND as T,CAN_REDO_COMMAND as X}from"lexical";import{createPortal as z}from"react-dom";import{UndoManager as A}from"yjs";import{jsx as q,Fragment as G}from"react/jsx-runtime";const I=Symbol.for("@lexical/yjs/UndoManager");function J(t,e,o,r,n,s,i){const a=S(()=>e.connect(),[e]),c=S(()=>{try{e.disconnect()}catch(t){}},[e]);E(()=>{const l=({status:e})=>{t.dispatchCommand(y,"connected"===e)},d=t=>{t&&!1===n.current&&i&&i()},u=t.getRootElement();m(e,o,r,null!==u&&B(u)===u,s||{}),e.on("status",l),e.on("sync",d);const p=a();return()=>{!1===n.current&&(p?p.then(c):c()),e.off("sync",d),e.off("status",l)}},[t,e,o,r,n,s,i,a,c]),E(()=>t.registerCommand(f,t=>(t?(console.log("Collaboration connected!"),a()):(console.log("Collaboration disconnected!"),c()),!0),w),[a,c,t]),E(()=>{const t=()=>{try{e.awareness.setLocalState(null)}catch(t){}};return M(window,{beforeunload:t,pagehide:t})},[e])}function K(t,e,r){E(()=>{const{awareness:n}=e,s=()=>{o(t,e,{selectionHighlight:r})};return n.on("update",s),()=>{n.off("update",s)}},[t,e,r])}function O(t,e){return b(()=>/*#__PURE__*/z(/*#__PURE__*/q("div",{ref:e=>{t.cursorsContainer=e}}),e&&e.current||document.body),[t,e])}function Q(t,e,o,r,n){E(()=>j(t.registerCommand(k,()=>(s(e,o,r,!0,n||{}),!1),w),t.registerCommand(_,()=>(s(e,o,r,!1,n||{}),!1),w)),[r,t,o,e,n])}function V(t,e){E(()=>j(t.registerCommand(P,()=>(e.undo(),!0),w),t.registerCommand(H,()=>(e.redo(),!0),w))),E(()=>{const o=t;return o[I]=e,()=>{o[I]===e&&delete o[I]}},[t,e]);const o=S(()=>{e.clear()},[e]);return v.useEffect(()=>{const o=()=>{t.dispatchCommand(T,e.undoStack.length>0),t.dispatchCommand(X,e.redoStack.length>0)};return e.on("stack-item-added",o),e.on("stack-item-popped",o),e.on("stack-cleared",o),()=>{e.off("stack-item-added",o),e.off("stack-item-popped",o),e.off("stack-cleared",o)}},[t,e]),o}function W(t,e,o){t.isBootstrapping=!0;try{!function(e,o){e.update(()=>{const t=L();if(t.isEmpty())if(o)switch(typeof o){case"string":{const t=e.parseEditorState(o);e.setEditorState(t,{tag:U});break}case"object":e.setEditorState(o,{tag:U});break;case"function":e.update(()=>{L().isEmpty()&&o(e)},{tag:U})}else{const o=F();t.append(o);const r=e.getRootElement();(null!==R()||null!==r&&B(r)===r)&&o.select()}},{onUpdate:()=>{t.isBootstrapping=!1},tag:U})}(e,o)}finally{queueMicrotask(()=>{t.isBootstrapping=!1})}}function Y({id:o,providerFactory:r,shouldBootstrap:n,username:s,cursorColor:i,cursorsContainerRef:a,initialEditorState:c,excludedProperties:l,awarenessData:d,syncCursorPositionsFn:u,selectionHighlight:p,rootName:m,getXmlText:f}){const g=x(!1),h=x(null),y=x(null),v=t(s,i),{yjsDocMap:S,name:b,color:N}=v,[j]=e();tt(v,j);const[k,w]=D(),[_,B]=D();E(()=>{const t=h.current;if(null!==t&&t.id===o&&t.providerFactory===r&&t.yjsDocMap===S)return;h.current={id:o,providerFactory:r,yjsDocMap:S};const e=r(o,S),n=y.current;null!==n&&n!==e&&n.disconnect(),y.current=e,w(e),B(S.get(o))},[o,r,S]),E(()=>()=>{const t=y.current;null!==t&&(y.current=null,t.disconnect())},[]);const[M,P]=D();return E(()=>{if(!k)return;if(g.current)return;const t=_||S.get(o);if(!t)return;g.current=!0;const e=C({doc:t,docMap:S,editor:j,excludedProperties:l,getXmlText:f,id:o,rootName:m});P(e)},[j,k,o,S,_]),E(()=>{if(void 0!==M)return()=>{M.root.destroy(M)}},[M]),k&&M?/*#__PURE__*/q(Z,{awarenessData:d,binding:M,collabContext:v,color:N,cursorsContainerRef:a,editor:j,id:o,initialEditorState:c,name:b,provider:k,setDoc:B,shouldBootstrap:n,yjsDocMap:S,syncCursorPositionsFn:u,selectionHighlight:p}):/*#__PURE__*/q(G,{})}function Z({editor:t,id:e,provider:s,yjsDocMap:i,name:a,color:c,shouldBootstrap:l,cursorsContainerRef:d,initialEditorState:u,awarenessData:m,collabContext:f,binding:g,setDoc:y,syncCursorPositionsFn:C,selectionHighlight:v}){const D=function(t,e,n,s,i,a,c,l,d,u,m,f,g=o,y=!1){const C=x(!1),v=S(()=>{const{root:e}=l;c&&e.isEmpty()&&0===e._xmlText._length&&W(l,t,m)},[l,t,m,c]);return E(()=>{const{root:e}=l,o=(t,e)=>{const o=e.origin;o!==l&&p(l,n,t,o instanceof A,g)};e.getSharedType().observeDeep(o);const s=t.registerUpdateListener(({prevEditorState:t,editorState:e,dirtyLeaves:o,dirtyElements:s,normalizedNodes:i,tags:a})=>{a.has(N)||r(l,n,t,e,s,o,i,a)});return()=>{e.getSharedType().unobserveDeep(o),s()}},[l,n,t,d,s,e,g]),E(()=>{const o=o=>{!function(t,e){if(t.update(()=>{const t=L();t.clear(),t.select()},{tag:N}),null==e.cursors)return;const o=e.cursors;if(null==o)return;const r=e.cursorsContainer;if(null!=r)for(const t of o.values()){const o=t.selection;if(null!==o){null!==o.highlight&&(CSS.highlights.delete(o.highlightName),h(e,o.highlightName)),o.caret.parentNode===r&&r.removeChild(o.caret);for(const t of o.selections)t.parentNode===r&&r.removeChild(t);t.selection=null}}}(t,l),d(o),s.set(e,o),C.current=!0},r=()=>{C.current=!1};return n.on("reload",o),n.on("sync",r),()=>{n.off("reload",o),n.off("sync",r)}},[l,n,t,d,s,e]),J(t,n,i,a,C,f,v),K(l,n,y),O(l,u)}(t,e,s,i,a,c,l,g,y,d,u,m,C,v);return function(t,e){V(t,b(()=>n(e,e.root.getSharedType()),[e]))}(t,g),Q(t,s,a,c,m),D}function $({id:o,doc:r,provider:s,__shouldBootstrapUnsafe:p,username:m,cursorColor:f,cursorsContainerRef:h,excludedProperties:y,awarenessData:C,selectionHighlight:v,rootName:x,getXmlElement:k}){const _=t(m,f),{yjsDocMap:B,name:M,color:P}=_,[H]=e();tt(_,H);const L=function(t,e,o,r,n,s,p,m={}){const{awarenessData:f,excludedProperties:h,rootName:y,getXmlElement:C,selectionHighlight:v=!1,__shouldBootstrapUnsafe:x}=m,k=b(()=>({current:!1}),[]),[_]=D(()=>i(t,e,o,n,{excludedProperties:h,getXmlElement:C,rootName:y}));E(()=>(n.set(e,o),()=>{n.delete(e)}),[o,n,e]);const B=S(()=>{const{root:e}=_;x&&0===e._length&&W(_,t)},[_,t,x]),[M,P]=D();return E(()=>{j(t.registerCommand(a,()=>(P(null),c(_,r),!0),w),t.registerCommand(l,({prevSnapshot:t,snapshot:e})=>(P({prevSnapshot:t,snapshot:e}),!0),w))},[t,_,r]),E(()=>{const{root:e}=_;if(M)return void d(_,M.snapshot,M.prevSnapshot);const o=(t,e)=>{const o=e.origin;o!==_&&g(_,r,t,e,o instanceof A)};e.observeDeep(o);const n=t.registerUpdateListener(({prevEditorState:t,editorState:e,dirtyElements:o,dirtyLeaves:n,normalizedNodes:s,tags:i})=>{i.has(N)||u(_,r,t,e,o,n,s,i)});return()=>{e.unobserveDeep(o),n()}},[_,r,t,M]),J(t,r,s,p,k,f,B),K(_,r,v),_}(H,o,r,s,B,M,P,{__shouldBootstrapUnsafe:p,awarenessData:C,excludedProperties:y,getXmlElement:k,rootName:x,selectionHighlight:v});return function(t,e){V(t,b(()=>n(e,e.root),[e]))}(H,L),Q(H,s,M,P,C),O(L,h)}const tt=(t,e)=>{E(()=>(t.isCollabActive=!0,()=>{null==e._parentEditor&&(t.isCollabActive=!1)}),[t,e])};export{Y as CollaborationPlugin,$ as CollaborationPluginV2__EXPERIMENTAL};
|
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import{createLexicalComposerContext as t,LexicalComposerContext as e}from"@lexical/react/LexicalComposerContext";import{CAN_USE_DOM as
|
|
9
|
+
import{createLexicalComposerContext as t,LexicalComposerContext as e}from"@lexical/react/LexicalComposerContext";import{CAN_USE_DOM as o,createEditor as n,$getRoot as r,$createParagraphNode as i,getActiveElement as a,$getSelection as l,HISTORY_MERGE_TAG as c}from"lexical";import{useLayoutEffect as s,useEffect as m,useMemo as d}from"react";import{jsx as p}from"react/jsx-runtime";const u=o?s:m,f={tag:c};function E({initialConfig:c,children:s}){const m=d(()=>{const{theme:e,namespace:s,nodes:m,onError:d,onWarn:p,editorState:u,html:E}=c,b=t(null,e),h=n({editable:c.editable,html:E,namespace:s,nodes:m,onError:t=>d(t,h),...p?{onWarn:t=>p(t,h)}:{},theme:e});return function(t,e){if(null!==e)if(void 0===e)t.update(()=>{const e=r();if(e.isEmpty()){const n=i();e.append(n);const r=t.getRootElement(),c=o&&null!==r?a(r):null;(null!==l()||null!==c&&c===r)&&n.select()}},f);else if(null!==e)switch(typeof e){case"string":{const o=t.parseEditorState(e);t.setEditorState(o,f);break}case"object":t.setEditorState(e,f);break;case"function":t.update(()=>{r().isEmpty()&&e(t)},f)}}(h,u),[h,b]},[]);return u(()=>{const t=c.editable,[e]=m;e.setEditable(void 0===t||t)},[]),/*#__PURE__*/p(e.Provider,{value:m,children:s})}export{E as LexicalComposer};
|
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import{useLexicalComposerContext as t}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as e}from"@lexical/react/useLexicalEditable";import{eventFiles as n}from"@lexical/rich-text";import{calculateZoomLevel as o}from"@lexical/utils";import{getParentElement as r,registerEventListeners as i,mergeRegister as s,DRAGOVER_COMMAND as l,COMMAND_PRIORITY_LOW as a,DROP_COMMAND as c,COMMAND_PRIORITY_HIGH as u,IS_FIREFOX as m,registerEventListener as h,BLUR_COMMAND as f,getActiveElementDeep as g,getRootOwnerDocument as p,isHTMLElement as d,getComposedEventTarget as y,$getNodeByKey as _,$getNearestNodeFromDOMNode as x,$onUpdate as b,$getSelection as T,getActiveElement as B,$getRoot as C}from"lexical";import{useRef as R,useState as D,useCallback as w,useEffect as E}from"react";import{createPortal as M}from"react-dom";import{jsxs as S,Fragment as v,jsx as L}from"react/jsx-runtime";class O{_x;_y;constructor(t,e){this._x=t,this._y=e}get x(){return this._x}get y(){return this._y}equals({x:t,y:e}){return this.x===t&&this.y===e}calcDeltaXTo({x:t}){return this.x-t}calcDeltaYTo({y:t}){return this.y-t}calcHorizontalDistanceTo(t){return Math.abs(this.calcDeltaXTo(t))}calcVerticalDistance(t){return Math.abs(this.calcDeltaYTo(t))}calcDistanceTo(t){return Math.sqrt(Math.pow(this.calcDeltaXTo(t),2)+Math.pow(this.calcDeltaYTo(t),2))}}class I{_left;_top;_right;_bottom;constructor(t,e,n,o){const[r,i]=e<=o?[e,o]:[o,e],[s,l]=t<=n?[t,n]:[n,t];this._top=r,this._right=l,this._left=s,this._bottom=i}get top(){return this._top}get right(){return this._right}get bottom(){return this._bottom}get left(){return this._left}get width(){return Math.abs(this._left-this._right)}get height(){return Math.abs(this._bottom-this._top)}equals({top:t,left:e,bottom:n,right:o}){return t===this._top&&n===this._bottom&&e===this._left&&o===this._right}contains(t){if(t instanceof O){const{x:e,y:n}=t,o=n<this._top,r=n>this._bottom,i=e<this._left,s=e>this._right;return{reason:{isOnBottomSide:r,isOnLeftSide:i,isOnRightSide:s,isOnTopSide:o},result:!(o||r||i||s)}}{const{top:e,left:n,bottom:o,right:r}=t;return e>=this._top&&e<=this._bottom&&o>=this._top&&o<=this._bottom&&n>=this._left&&n<=this._right&&r>=this._left&&r<=this._right}}intersectsWith(t){const{left:e,top:n,width:o,height:r}=t,{left:i,top:s,width:l,height:a}=this;return(e+o>=i+l?e+o:i+l)-(e<=i?e:i)<=o+l&&(n+r>=s+a?n+r:s+a)-(n<=s?n:s)<=r+a}generateNewRect({left:t=this.left,top:e=this.top,right:n=this.right,bottom:o=this.bottom}){return new I(t,e,n,o)}static fromLTRB(t,e,n,o){return new I(t,e,n,o)}static fromLWTH(t,e,n,o){return new I(t,n,t+e,n+o)}static fromPoints(t,e){const{y:n,x:o}=t,{y:r,x:i}=e;return I.fromLTRB(o,n,i,r)}static fromDOM(t){const{top:e,width:n,left:o,height:r}=t.getBoundingClientRect();return I.fromLWTH(o,n,e,r)}}const N="application/x-lexical-drag-block";let K=Infinity;function Y(t,e){e.focus({preventScroll:!0}),t.update(()=>{const t=T();null===t||t.dirty||(t.dirty=!0)})}function H(t){const e=t.ownerDocument.defaultView,n=(t,n)=>t&&e?parseFloat(e.getComputedStyle(t)[n]):0,{marginTop:o="0",marginBottom:r="0"}=e?e.getComputedStyle(t):{},i=n(t.previousElementSibling,"marginBottom"),s=n(t.nextElementSibling,"marginTop"),l=Math.max(parseFloat(o),i);return{marginBottom:Math.max(parseFloat(r),s),marginTop:l}}function k(t,e,n,r=!1){const i=t.getBoundingClientRect(),s=function(t){return t.read("latest",()=>C().getChildrenKeys())}(e);let l=null;return e.read("latest",()=>{if(r){const[t,r]=[e.getElementByKey(s[0]),e.getElementByKey(s[s.length-1])],[i,a]=[null!=t?t.getBoundingClientRect():void 0,null!=r?r.getBoundingClientRect():void 0];if(i&&a){const e=o(t),s=o(r);if(n.y/e<i.top?l=t:n.y/s>a.bottom&&(l=r),l)return}}let t=0===(a=s.length)?Infinity:K>=0&&K<a?K:Math.floor(a/2);var a;let c=0;for(;t>=0&&t<s.length;){const r=s[t],a=e.getElementByKey(r);if(null===a)break;const u=o(a),m=new O(n.x/u,n.y/u),h=I.fromDOM(a),{marginTop:f,marginBottom:g}=H(a),p=h.generateNewRect({bottom:h.bottom+g,left:i.left,right:i.right,top:h.top-f}),{result:d,reason:{isOnTopSide:y,isOnBottomSide:_}}=p.contains(m);if(d){l=a,K=t;break}0===c&&(c=y?-1:_?1:Infinity),t+=c}}),l}function q(t,e,T,C,O,I,K,q,F){const V=r(e),W=R(!1),[X,P]=D(null),$=w(t=>{P(t),F&&F(t)},[F]);return E(()=>{if(null!=V)return i(V,{mouseleave:function(){$(null)},mousemove:function(n){const o=y(n);if(!d(o))return void $(null);if(q(o))return;const r=k(e,t,n);$(r)}})},[V,e,t,q,$]),E(()=>{const n=o(t.getRootElement(),!0);T.current&&function(t,e,n,o){if(!t)return void(e.style.display="none");const r=t.getBoundingClientRect(),i=t.ownerDocument.defaultView,s=i?i.getComputedStyle(t):null,l=e.getBoundingClientRect(),a=n.getBoundingClientRect();let c=s?parseInt(s.lineHeight,10):NaN;isNaN(c)&&(c=r.bottom-r.top);const u=(r.top+(c-(l.height||c))/2-a.top+n.scrollTop)/o;e.style.display="flex",e.style.opacity="1",e.style.transform=`translate(4px, ${u}px)`}(X,T.current,e,n)},[t,e,X,T]),E(()=>
|
|
9
|
+
import{useLexicalComposerContext as t}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as e}from"@lexical/react/useLexicalEditable";import{eventFiles as n}from"@lexical/rich-text";import{calculateZoomLevel as o}from"@lexical/utils";import{getParentElement as r,registerEventListeners as i,mergeRegister as s,DRAGOVER_COMMAND as l,COMMAND_PRIORITY_LOW as a,DROP_COMMAND as c,COMMAND_PRIORITY_HIGH as u,IS_FIREFOX as m,registerEventListener as h,BLUR_COMMAND as f,getActiveElementDeep as g,getRootOwnerDocument as p,isHTMLElement as d,getComposedEventTarget as y,$getNodeByKey as _,$getNearestNodeFromDOMNode as x,$onUpdate as b,$getSelection as T,getActiveElement as B,$getRoot as C}from"lexical";import{useRef as R,useState as D,useCallback as w,useEffect as E}from"react";import{createPortal as M}from"react-dom";import{jsxs as S,Fragment as v,jsx as L}from"react/jsx-runtime";class O{_x;_y;constructor(t,e){this._x=t,this._y=e}get x(){return this._x}get y(){return this._y}equals({x:t,y:e}){return this.x===t&&this.y===e}calcDeltaXTo({x:t}){return this.x-t}calcDeltaYTo({y:t}){return this.y-t}calcHorizontalDistanceTo(t){return Math.abs(this.calcDeltaXTo(t))}calcVerticalDistance(t){return Math.abs(this.calcDeltaYTo(t))}calcDistanceTo(t){return Math.sqrt(Math.pow(this.calcDeltaXTo(t),2)+Math.pow(this.calcDeltaYTo(t),2))}}class I{_left;_top;_right;_bottom;constructor(t,e,n,o){const[r,i]=e<=o?[e,o]:[o,e],[s,l]=t<=n?[t,n]:[n,t];this._top=r,this._right=l,this._left=s,this._bottom=i}get top(){return this._top}get right(){return this._right}get bottom(){return this._bottom}get left(){return this._left}get width(){return Math.abs(this._left-this._right)}get height(){return Math.abs(this._bottom-this._top)}equals({top:t,left:e,bottom:n,right:o}){return t===this._top&&n===this._bottom&&e===this._left&&o===this._right}contains(t){if(t instanceof O){const{x:e,y:n}=t,o=n<this._top,r=n>this._bottom,i=e<this._left,s=e>this._right;return{reason:{isOnBottomSide:r,isOnLeftSide:i,isOnRightSide:s,isOnTopSide:o},result:!(o||r||i||s)}}{const{top:e,left:n,bottom:o,right:r}=t;return e>=this._top&&e<=this._bottom&&o>=this._top&&o<=this._bottom&&n>=this._left&&n<=this._right&&r>=this._left&&r<=this._right}}intersectsWith(t){const{left:e,top:n,width:o,height:r}=t,{left:i,top:s,width:l,height:a}=this;return(e+o>=i+l?e+o:i+l)-(e<=i?e:i)<=o+l&&(n+r>=s+a?n+r:s+a)-(n<=s?n:s)<=r+a}generateNewRect({left:t=this.left,top:e=this.top,right:n=this.right,bottom:o=this.bottom}){return new I(t,e,n,o)}static fromLTRB(t,e,n,o){return new I(t,e,n,o)}static fromLWTH(t,e,n,o){return new I(t,n,t+e,n+o)}static fromPoints(t,e){const{y:n,x:o}=t,{y:r,x:i}=e;return I.fromLTRB(o,n,i,r)}static fromDOM(t){const{top:e,width:n,left:o,height:r}=t.getBoundingClientRect();return I.fromLWTH(o,n,e,r)}}const N="application/x-lexical-drag-block";let K=Infinity;function Y(t,e){e.focus({preventScroll:!0}),t.update(()=>{const t=T();null===t||t.dirty||(t.dirty=!0)})}function H(t){const e=t.ownerDocument.defaultView,n=(t,n)=>t&&e?parseFloat(e.getComputedStyle(t)[n]):0,{marginTop:o="0",marginBottom:r="0"}=e?e.getComputedStyle(t):{},i=n(t.previousElementSibling,"marginBottom"),s=n(t.nextElementSibling,"marginTop"),l=Math.max(parseFloat(o),i);return{marginBottom:Math.max(parseFloat(r),s),marginTop:l}}function k(t,e,n,r=!1){const i=t.getBoundingClientRect(),s=function(t){return t.read("latest",()=>C().getChildrenKeys())}(e);let l=null;return e.read("latest",()=>{if(r){const[t,r]=[e.getElementByKey(s[0]),e.getElementByKey(s[s.length-1])],[i,a]=[null!=t?t.getBoundingClientRect():void 0,null!=r?r.getBoundingClientRect():void 0];if(i&&a){const e=o(t),s=o(r);if(n.y/e<i.top?l=t:n.y/s>a.bottom&&(l=r),l)return}}let t=0===(a=s.length)?Infinity:K>=0&&K<a?K:Math.floor(a/2);var a;let c=0;for(;t>=0&&t<s.length;){const r=s[t],a=e.getElementByKey(r);if(null===a)break;const u=o(a),m=new O(n.x/u,n.y/u),h=I.fromDOM(a),{marginTop:f,marginBottom:g}=H(a),p=h.generateNewRect({bottom:h.bottom+g,left:i.left,right:i.right,top:h.top-f}),{result:d,reason:{isOnTopSide:y,isOnBottomSide:_}}=p.contains(m);if(d){l=a,K=t;break}0===c&&(c=y?-1:_?1:Infinity),t+=c}}),l}function q(t,e,T,C,O,I,K,q,F){const V=r(e),W=R(!1),[X,P]=D(null),$=w(t=>{P(t),F&&F(t)},[F]);return E(()=>{if(null!=V)return i(V,{mouseleave:function(){$(null)},mousemove:function(n){const o=y(n);if(!d(o))return void $(null);if(q(o))return;const r=k(e,t,n);$(r)}})},[V,e,t,q,$]),E(()=>{const n=o(t.getRootElement(),!0);T.current&&function(t,e,n,o){if(!t)return void(e.style.display="none");const r=t.getBoundingClientRect(),i=t.ownerDocument.defaultView,s=i?i.getComputedStyle(t):null,l=e.getBoundingClientRect(),a=n.getBoundingClientRect();let c=s?parseInt(s.lineHeight,10):NaN;isNaN(c)&&(c=r.bottom-r.top);const u=(r.top+(c-(l.height||c))/2-a.top+n.scrollTop)/o;e.style.display="flex",e.style.opacity="1",e.style.transform=`translate(4px, ${u}px)`}(X,T.current,e,n)},[t,e,X,T]),E(()=>s(t.registerCommand(l,r=>function(r){if(!W.current)return!1;const[i]=n(r);if(i)return!1;const s=r.pageY,l=y(r);if(!d(l))return!1;const a=k(e,t,r,!0),c=C.current;return null!==a&&null!==c&&(function(t,e,n,o){const{top:r,height:i}=e.getBoundingClientRect(),{top:s,width:l}=o.getBoundingClientRect(),{marginTop:a,marginBottom:c}=H(e);let u=r;n>=r?u+=i+c/2:u-=a/2;const m=u-s-2+o.scrollTop;t.style.transform=`translate(24px, ${m}px)`,t.style.width=l-48+"px",t.style.opacity=".4"}(c,a,s/o(l),e),r.preventDefault(),!0)}(r),a),t.registerCommand(c,r=>function(r){if(!W.current)return!1;const[i]=n(r);if(i)return!1;const{dataTransfer:s,pageY:l}=r,a=y(r),c=null!=s?s.getData(N):"",u=_(c);if(!u)return!1;if(!d(a))return!1;const h=k(e,t,r,!0);if(!h)return!1;const f=x(h);if(!f)return!1;if(f===u)return m&&t.focus(),!0;const g=h.getBoundingClientRect().top;return l/o(a)>=g?f.insertAfter(u):f.insertBefore(u),$(null),m&&b(()=>{t.focus()}),!0}(r),u)),[e,t,C,$]),E(()=>{if(m&&O)return s(t.registerRootListener(e=>{if(e)return h(e,"blur",function(n){const o=n.relatedTarget;d(o)&&q(o)&&(e&&Y(t,e),n.stopImmediatePropagation())},!0)}),t.registerCommand(f,()=>{const e=t.getRootElement(),n=g(p(e));return!!(e&&d(n)&&q(n))&&(Y(t,e),!0)},u))},[t,O,q]),/*#__PURE__*/M(/*#__PURE__*/S(v,{children:[/*#__PURE__*/L("div",{draggable:!0,onDragStart:function(e){const n=e.dataTransfer;if(!n||!X)return;!function(t,e){const{transform:n}=e.style;e.style.transform="translateZ(0)",t.setDragImage(e,0,0),setTimeout(()=>{e.style.transform=n})}(n,X);let o="";if(t.update(()=>{const t=x(X);t&&(o=t.getKey())}),W.current=!0,n.setData(N,o),m){const e=t.getRootElement();null!==e&&B(e)!==e&&Y(t,e)}},onDragEnd:function(){var e;W.current=!1,(e=C.current)&&(e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)");const n=t.getRootElement();null!==n&&B(n)!==n&&Y(t,n)},children:O&&I}),K]}),e)}function F({anchorElem:n=document.body,menuRef:o,targetLineRef:r,menuComponent:i,targetLineComponent:s,isOnMenu:l,onElementChanged:a}){const[c]=t();return q(c,n,o,r,e(),i,s,l,a)}export{F as DraggableBlockPlugin_EXPERIMENTAL};
|
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import{useLexicalComposerContext as t}from"@lexical/react/LexicalComposerContext";import{CAN_USE_DOM as e,getRootOwnerDocument as n,mergeRegister as l,COMMAND_PRIORITY_LOW as o,KEY_ARROW_DOWN_COMMAND as r,KEY_ARROW_UP_COMMAND as i,KEY_ESCAPE_COMMAND as c,KEY_TAB_COMMAND as u,KEY_ENTER_COMMAND as s,isDOMShadowRoot as a,isHTMLElement as m,getParentElement as p,getDOMShadowRoots as d,registerEventListener as f,$getSelection as g,$isRangeSelection as h,$getNodeByKey as y}from"lexical";import{useLayoutEffect as x,useEffect as b,useRef as C,useCallback as v,useState as R,useMemo as w,startTransition as E}from"react";import{SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND as I}from"@lexical/react/LexicalTypeaheadMenuPluginUtils";import{getScrollParent as S}from"@lexical/utils";import P from"react-dom";import{jsx as k,jsxs as A}from"react/jsx-runtime";export{MenuOption}from"@lexical/react/LexicalMenuOption";const O=e?x:b,D=t=>{const e=t.closest("#typeahead-menu");if(!e)return;const n=e.getBoundingClientRect();n.top+n.height>window.innerHeight&&e.scrollIntoView({block:"center"}),n.top<0&&e.scrollIntoView({block:"center"}),t.scrollIntoView({block:"nearest"})};function B(t,e){const n=t.getBoundingClientRect(),l=e.getBoundingClientRect();return n.top>=l.top-6&&n.top<=l.bottom+6}function N({index:t,isSelected:e,onClick:n,onMouseEnter:l,option:o}){let r="item";return e&&(r+=" selected"),/*#__PURE__*/A("li",{tabIndex:-1,className:r,ref:o.setRefElement,role:"option","aria-selected":e,id:"typeahead-item-"+t,onMouseEnter:l,onClick:n,children:[o.icon,/*#__PURE__*/k("span",{className:"text",children:o.title})]},o.key)}function T({close:t,editor:e,anchorElementRef:n,resolution:a,options:m,menuRenderFn:p,onSelectOption:d,shouldSplitNodeWithQuery:f=!1,commandPriority:y=o,preselectFirstItem:x=!0}){const[C,E]=R(null),S=null!==C?Math.min(m.length-1,C):null,A=a.match&&a.match.matchingString;b(()=>{x&&E(0)},[A,x]);const B=v(n=>{e.update(()=>{const e=null!=a.match&&f?function(t){const e=g();if(!h(e)||!e.isCollapsed())return null;const n=e.anchor;if("text"!==n.type)return null;const l=n.getNode();if(!l.isSimpleText())return null;const o=n.offset,r=l.getTextContent().slice(0,o),i=t.replaceableString.length,c=o-function(t,e,n){let l=n;for(let n=l;n<=e.length;n++)t.slice(-n)===e.substring(0,n)&&(l=n);return l}(r,t.matchingString,i);if(c<0)return null;let u;return 0===c?[u]=l.splitText(o):[,u]=l.splitText(c,o),u}(a.match):null;d(n,e,t,a.match?a.match.matchingString:"")})},[e,f,a.match,d,t]),T=v(t=>{const n=e.getRootElement();null!==n&&(n.setAttribute("aria-activedescendant","typeahead-item-"+t),E(t))},[e]),M=v(()=>n.current&&m.length?/*#__PURE__*/P.createPortal(/*#__PURE__*/k("div",{className:"typeahead-popover mentions-menu",children:/*#__PURE__*/k("ul",{children:m.map((t,e)=>/*#__PURE__*/k(N,{index:e,isSelected:S===e,onClick:()=>{E(e),B(t)},onMouseEnter:()=>{E(e)},option:t},t.key))})}),n.current):null,[n,m,S,B,E]);b(()=>()=>{const t=e.getRootElement();null!==t&&t.removeAttribute("aria-activedescendant")},[e]),O(()=>{null===m?E(null):null===S&&x&&T(0)},[m,S,T,x]);const $=null==p&&(null===m||!m.length);b(()=>l(e.registerCommand(I,({option:t})=>!(!t.ref||null==t.ref.current
|
|
9
|
+
import{useLexicalComposerContext as t}from"@lexical/react/LexicalComposerContext";import{CAN_USE_DOM as e,getRootOwnerDocument as n,mergeRegister as l,COMMAND_PRIORITY_LOW as o,KEY_ARROW_DOWN_COMMAND as r,KEY_ARROW_UP_COMMAND as i,KEY_ESCAPE_COMMAND as c,KEY_TAB_COMMAND as u,KEY_ENTER_COMMAND as s,isDOMShadowRoot as a,isHTMLElement as m,getParentElement as p,getDOMShadowRoots as d,registerEventListener as f,$getSelection as g,$isRangeSelection as h,$getNodeByKey as y}from"lexical";import{useLayoutEffect as x,useEffect as b,useRef as C,useCallback as v,useState as R,useMemo as w,startTransition as E}from"react";import{SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND as I}from"@lexical/react/LexicalTypeaheadMenuPluginUtils";import{getScrollParent as S}from"@lexical/utils";import P from"react-dom";import{jsx as k,jsxs as A}from"react/jsx-runtime";export{MenuOption}from"@lexical/react/LexicalMenuOption";const O=e?x:b,D=t=>{const e=t.closest("#typeahead-menu");if(!e)return;const n=e.getBoundingClientRect();n.top+n.height>window.innerHeight&&e.scrollIntoView({block:"center"}),n.top<0&&e.scrollIntoView({block:"center"}),t.scrollIntoView({block:"nearest"})};function B(t,e){const n=t.getBoundingClientRect(),l=e.getBoundingClientRect();return n.top>=l.top-6&&n.top<=l.bottom+6}function N({index:t,isSelected:e,onClick:n,onMouseEnter:l,option:o}){let r="item";return e&&(r+=" selected"),/*#__PURE__*/A("li",{tabIndex:-1,className:r,ref:o.setRefElement,role:"option","aria-selected":e,id:"typeahead-item-"+t,onMouseEnter:l,onClick:n,children:[o.icon,/*#__PURE__*/k("span",{className:"text",children:o.title})]},o.key)}function T({close:t,editor:e,anchorElementRef:n,resolution:a,options:m,menuRenderFn:p,onSelectOption:d,shouldSplitNodeWithQuery:f=!1,commandPriority:y=o,preselectFirstItem:x=!0}){const[C,E]=R(null),S=null!==C?Math.min(m.length-1,C):null,A=a.match&&a.match.matchingString;b(()=>{x&&E(0)},[A,x]);const B=v(n=>{e.update(()=>{const e=null!=a.match&&f?function(t){const e=g();if(!h(e)||!e.isCollapsed())return null;const n=e.anchor;if("text"!==n.type)return null;const l=n.getNode();if(!l.isSimpleText())return null;const o=n.offset,r=l.getTextContent().slice(0,o),i=t.replaceableString.length,c=o-function(t,e,n){let l=n;for(let n=l;n<=e.length;n++)t.slice(-n)===e.substring(0,n)&&(l=n);return l}(r,t.matchingString,i);if(c<0)return null;let u;return 0===c?[u]=l.splitText(o):[,u]=l.splitText(c,o),u}(a.match):null;d(n,e,t,a.match?a.match.matchingString:"")})},[e,f,a.match,d,t]),T=v(t=>{const n=e.getRootElement();null!==n&&(n.setAttribute("aria-activedescendant","typeahead-item-"+t),E(t))},[e]),M=v(()=>n.current&&m.length?/*#__PURE__*/P.createPortal(/*#__PURE__*/k("div",{className:"typeahead-popover mentions-menu",children:/*#__PURE__*/k("ul",{children:m.map((t,e)=>/*#__PURE__*/k(N,{index:e,isSelected:S===e,onClick:()=>{E(e),B(t)},onMouseEnter:()=>{E(e)},option:t},t.key))})}),n.current):null,[n,m,S,B,E]);b(()=>()=>{const t=e.getRootElement();null!==t&&t.removeAttribute("aria-activedescendant")},[e]),O(()=>{null===m?E(null):null===S&&x&&T(0)},[m,S,T,x]);const $=null==p&&(null===m||!m.length);b(()=>l(e.registerCommand(I,({option:t})=>!(!t.ref||null==t.ref.current||(D(t.ref.current),0)),y)),[e,T,y]),b(()=>l(e.registerCommand(r,t=>{const n=t;if($)return!1;const l=null===S?0:S!==m.length-1?S+1:0;T(l);const o=m[l];return o?(o.ref&&o.ref.current&&e.dispatchCommand(I,{index:l,option:o}),n.preventDefault(),n.stopImmediatePropagation(),!0):(T(-1),n.preventDefault(),n.stopImmediatePropagation(),!0)},y),e.registerCommand(i,t=>{const e=t;if($)return!1;const n=null===S?m.length-1:0!==S?S-1:m.length-1;T(n);const l=m[n];return l?(l.ref&&l.ref.current&&D(l.ref.current),e.preventDefault(),e.stopImmediatePropagation(),!0):(T(-1),e.preventDefault(),e.stopImmediatePropagation(),!0)},y),e.registerCommand(c,e=>{const n=e;return!$&&(n.preventDefault(),n.stopImmediatePropagation(),t(),!0)},y),e.registerCommand(u,t=>{const e=t;return null!==m&&null!==S&&null!=m[S]&&(e.preventDefault(),e.stopImmediatePropagation(),B(m[S]),!0)},y),e.registerCommand(s,t=>!(null===m||null===S||null==m[S]||t&&t.shiftKey||(null!==t&&(t.preventDefault(),t.stopImmediatePropagation()),B(m[S]),0)),y)),[B,t,e,m,$,S,T,y]);const F=w(()=>({options:m,selectOptionAndCleanUp:B,selectedIndex:S,setHighlightedIndex:E}),[B,S,m]);return null!=p?p(n,F,a.match?a.match.matchingString:""):M()}function M(t,e){null!=e&&(t.className=e),t.setAttribute("aria-label","Typeahead menu"),t.setAttribute("role","listbox"),t.style.display="block",t.style.position="absolute"}function $(t){if("static"!==t.position)return!0;const e=t.willChange;return"none"!==t.transform||"none"!==t.perspective||"none"!==t.filter||"none"!==t.backdropFilter||t.contain.includes("paint")||t.contain.includes("layout")||t.contain.includes("strict")||t.contain.includes("content")||e.includes("transform")||e.includes("perspective")||e.includes("filter")||e.includes("contain")}function F({options:r,nodeKey:i,onClose:c,onOpen:u,onSelectOption:s,menuRenderFn:g,anchorClassName:h,commandPriority:x=o,parent:w}){const[I]=t(),[P,A]=R(null),O=function(o,r,i,c,u=!0){const[s]=t(),g=c??function(t){if(!e)return;const n=t.getRootElement();if(null!==n){const t=n.getRootNode();return a(t)?t:n.ownerDocument.body}return document.body}(s),h=e?n(s.getRootElement()).createElement("div"):null,y=C(h),x=v(()=>{if(null===y.current||void 0===g)return;y.current.style.top=y.current.style.bottom;const t=s.getRootElement(),e=y.current,n=e.firstChild;if(null!==t&&null!==o){const{left:l,top:r,width:c,height:s}=o.getRect(),d=y.current.offsetHeight,f=function(t){const e=a(t)?t.host:t;for(let t=m(e)?e:null;null!==t;t=p(t)){const e=t.ownerDocument.defaultView;if(null===e)break;if($(e.getComputedStyle(t))){const e=t.getBoundingClientRect();return{left:e.left+t.clientLeft-t.scrollLeft,top:e.top+t.clientTop-t.scrollTop}}}return null}(g),h=t=>null!==f?t-f.left:t+window.pageXOffset,x=t=>null!==f?t-f.top:t+(u?window.pageYOffset:0);if(e.style.top=`${x(r+d+3)}px`,e.style.left=`${h(l)}px`,e.style.height=`${s}px`,e.style.width=`${c}px`,null!==n){n.style.top=`${r}`;const o=n.getBoundingClientRect(),i=o.height,c=o.width,u=t.getBoundingClientRect();l+c>u.right&&(e.style.left=`${h(u.right-c)}px`),(r+i>window.innerHeight||r+i>u.bottom)&&r-u.top>i+s&&(e.style.top=`${x(r-i-s)}px`)}e.isConnected||(M(e,i),g.append(e)),e.setAttribute("id","typeahead-menu"),t.setAttribute("aria-controls","typeahead-menu")}},[s,o,u,i,g]);b(()=>{const t=s.getRootElement();return null!==o&&x(),()=>{null!==t&&t.removeAttribute("aria-controls");const e=y.current;null!==e&&e.isConnected&&(e.remove(),e.removeAttribute("id"))}},[s,x,o]);const R=v(t=>{null!==o&&(t||r(null))},[o,r]);return function(e,n,o,r){const[i]=t();b(()=>{if(null!=n&&null!=e){const t=i.getRootElement(),e=null!=t?S(t,!1):document.body;let c=!1,u=B(n,e);const s=function(){c||(window.requestAnimationFrame(function(){o(),c=!1}),c=!0);const t=B(n,e);t!==u&&(u=t,null!=r&&r(t))},a=new ResizeObserver(o),m=d(t??n);return a.observe(n),l(f(window,"resize",o),f(document,"scroll",s,{capture:!0,passive:!0}),...m.map(t=>f(t,"scroll",s,{capture:!0,passive:!0})),()=>a.unobserve(n))}},[n,i,r,o,e])}(o,y.current,x,R),null!=h&&h===y.current&&(M(h,i),null!=g&&g.append(h)),y}(P,A,h,w),D=v(()=>{A(null),null!=c&&null!==P&&c()},[c,P]),N=v(t=>{A(t),null!=u&&null===P&&u(t)},[u,P]),F=v(()=>{i?I.update(()=>{const t=y(i),e=I.getElementByKey(i);null!=t&&null!=e&&null==P&&E(()=>N({getRect:()=>e.getBoundingClientRect()}))}):null==i&&null!=P&&D()},[D,I,i,N,P]);return b(()=>{F()},[F,i]),b(()=>{if(null!=i)return I.registerUpdateListener(({dirtyElements:t})=>{t.get(i)&&F()})},[I,F,i]),null===O.current||null===P||null===I?null:/*#__PURE__*/k(T,{close:D,resolution:P,editor:I,anchorElementRef:O,options:r,menuRenderFn:g,onSelectOption:s,commandPriority:x})}export{F as LexicalNodeMenuPlugin};
|
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import{useLexicalComposerContext as r}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as e}from"@lexical/react/useLexicalEditable";import{LexicalBuilder as t}from"@lexical/extension/LexicalBuilder";import{ReactProviderExtension as o}from"@lexical/react/ReactProviderExtension";import{useMemo as n,useSyncExternalStore as i,Suspense as c,useLayoutEffect as l,useEffect as a,useState as s}from"react";import{createPortal as u}from"react-dom";import{jsx as f,jsxs as m,Fragment as d}from"react/jsx-runtime";import{$canShowPlaceholderCurry as p}from"@lexical/text";import{CAN_USE_DOM as x,mergeRegister as E}from"lexical";import{registerDragonSupport as h}from"@lexical/dragon";import{registerPlainText as g}from"@lexical/plain-text";function y(r,...e){const t=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",r);for(const r of e)o.append("v",r);throw t.search=o.toString(),Error(`Minified Lexical error #${r}; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function L(r,e){const[t,o]=n(()=>[e=>r.registerDecoratorListener(e),()=>r.getDecorators()],[r]),l=i(t,o,o),a=function(r){const[e,t]=n(()=>[r.registerRootListener.bind(r),r.getRootElement.bind(r)],[r]);return i(e,t,t)}(r);return n(()=>{const t=e=>r._onError(e),o=[];for(const n in l){const i=r.getElementByKey(n);if(null!==i){const r=/*#__PURE__*/f(e,{onError:t,children:/*#__PURE__*/f(c,{fallback:null,children:l[n]})});o.push(/*#__PURE__*/u(r,i,n))}}return o},[e,l,r,a])}
|
|
9
|
+
import{useLexicalComposerContext as r}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as e}from"@lexical/react/useLexicalEditable";import{LexicalBuilder as t}from"@lexical/extension/LexicalBuilder";import{ReactProviderExtension as o}from"@lexical/react/ReactProviderExtension";import{useMemo as n,useSyncExternalStore as i,Suspense as c,useLayoutEffect as l,useEffect as a,useState as s}from"react";import{createPortal as u}from"react-dom";import{jsx as f,jsxs as m,Fragment as d}from"react/jsx-runtime";import{$canShowPlaceholderCurry as p}from"@lexical/text";import{CAN_USE_DOM as x,mergeRegister as E}from"lexical";import{registerDragonSupport as h}from"@lexical/dragon";import{registerPlainText as g}from"@lexical/plain-text";function y(r,...e){const t=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",r);for(const r of e)o.append("v",r);throw t.search=o.toString(),Error(`Minified Lexical error #${r}; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function L({editor:r,ErrorBoundary:e}){return function(r,e){const[t,o]=n(()=>[e=>r.registerDecoratorListener(e),()=>r.getDecorators()],[r]),l=i(t,o,o),a=function(r){const[e,t]=n(()=>[r.registerRootListener.bind(r),r.getRootElement.bind(r)],[r]);return i(e,t,t)}(r);return n(()=>{const t=e=>r._onError(e),o=[];for(const n in l){const i=r.getElementByKey(n);if(null!==i){const r=/*#__PURE__*/f(e,{onError:t,children:/*#__PURE__*/f(c,{fallback:null,children:l[n]})});o.push(/*#__PURE__*/u(r,i,n))}}return o},[e,l,r,a])}(r,e)}function B({editor:r,ErrorBoundary:e}){return function(r){const e=t.maybeFromEditor(r);if(e&&e.hasExtensionByName(o.name)){for(const r of["@lexical/plain-text","@lexical/rich-text"])e.hasExtensionByName(r)&&y(320,r);return!0}return!1}(r)?null:/*#__PURE__*/f(L,{editor:r,ErrorBoundary:e})}const b=x?l:a;function v(r){return r.read("latest",p(r.isComposing()))}function R({contentEditable:e,placeholder:t=null,ErrorBoundary:o}){const[n]=r();return function(r){b(()=>E(g(r),h(r)),[r])}(n),/*#__PURE__*/m(d,{children:[e,/*#__PURE__*/f(w,{content:t}),/*#__PURE__*/f(B,{editor:n,ErrorBoundary:o})]})}function w({content:t}){const[o]=r(),n=function(r){const[e,t]=s(()=>v(r));return b(()=>{function e(){const e=v(r);t(e)}return e(),E(r.registerUpdateListener(()=>{e()}),r.registerEditableListener(()=>{e()}))},[r]),e}(o),i=e();return n?"function"==typeof t?t(i):t:null}export{R as PlainTextPlugin};
|
|
@@ -6,6 +6,6 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import{ContentEditable as r}from"@lexical/react/LexicalContentEditable";import{LexicalErrorBoundary as e}from"@lexical/react/LexicalErrorBoundary";import{ReactProviderExtension as o}from"@lexical/react/ReactProviderExtension";import{shallowMergeConfig as t}from"lexical";import{LexicalComposerContext as n}from"@lexical/react/LexicalComposerContext";import{useMemo as i,useSyncExternalStore as c,Suspense as a}from"react";import{createPortal as l}from"react-dom";import{jsx as d,jsxs as s,Fragment as m}from"react/jsx-runtime";function f(
|
|
10
|
-
return s(m,{children:[r,e]})}const
|
|
11
|
-
return d(n.Provider,{value:e,children:/*#__PURE__*/s(
|
|
9
|
+
import{ContentEditable as r}from"@lexical/react/LexicalContentEditable";import{LexicalErrorBoundary as e}from"@lexical/react/LexicalErrorBoundary";import{ReactProviderExtension as o}from"@lexical/react/ReactProviderExtension";import{shallowMergeConfig as t}from"lexical";import{LexicalComposerContext as n}from"@lexical/react/LexicalComposerContext";import{useMemo as i,useSyncExternalStore as c,Suspense as a}from"react";import{createPortal as l}from"react-dom";import{jsx as d,jsxs as s,Fragment as m}from"react/jsx-runtime";function f({contentEditable:r,children:e}){
|
|
10
|
+
return s(m,{children:[r,e]})}const u={EditorChildrenComponent:f,ErrorBoundary:e,contentEditable:/*#__PURE__*/d(r,{}),decorators:[]},p={build(r,e,t){t.getPeer(o.name)||function(r,...e){const o=new URL("https://lexical.dev/docs/error"),t=new URLSearchParams;t.append("code",r);for(const r of e)t.append("v",r);throw o.search=t.toString(),Error(`Minified Lexical error #${r}; visit ${o.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(321,[...t.getDirectDependentNames()].join(" "));const m=[r,{getTheme:()=>r._config.theme}],f=function(r,e){const[o]=e,t=r.decorators.map(r=>"function"==typeof r?/*#__PURE__*/d(r,{context:e}):r);return function(m){const{EditorChildrenComponent:f=r.EditorChildrenComponent,ErrorBoundary:u=r.ErrorBoundary,contentEditable:p=r.contentEditable,children:h}=m,E=function(r,e){const[o,t]=i(()=>[e=>r.registerDecoratorListener(e),()=>r.getDecorators()],[r]),n=c(o,t,t),s=function(r){const[e,o]=i(()=>[r.registerRootListener.bind(r),r.getRootElement.bind(r)],[r]);return c(e,o,o)}(r);return i(()=>{const o=e=>r._onError(e),t=[];for(const i in n){const c=r.getElementByKey(i);if(null!==c){const r=/*#__PURE__*/d(e,{onError:o,children:/*#__PURE__*/d(a,{fallback:null,children:n[i]})});t.push(/*#__PURE__*/l(r,c,i))}}return t},[e,n,r,s])}(o,u),x=i(()=>t.map((r,e)=>/*#__PURE__*/d(u,{onError:r=>{o._onError(r)},children:/*#__PURE__*/d(a,{fallback:null,children:r})},e)),[u]);
|
|
11
|
+
return d(n.Provider,{value:e,children:/*#__PURE__*/s(f,{context:e,contentEditable:p,children:[h,x,E]})})}}(e,m);return{Component:f,context:m}},config:u,mergeConfig(r,e){const o=t(r,e);return e.decorators&&(o.decorators=e.decorators.length>0?[...r.decorators,...e.decorators]:r.decorators),o},name:"@lexical/react/React",peerDependencies:[["@lexical/react/ReactProvider"]]};export{f as DefaultEditorChildrenComponent,p as ReactExtension};
|
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import{effect as e,untracked as n,signal as o}from"@lexical/extension/signals";import{getExtensionDependencyFromEditor as t}from"@lexical/extension/getExtensionDependencyFromEditor";import{ReactExtension as r}from"@lexical/react/ReactExtension";import{ReactProviderExtension as i}from"@lexical/react/ReactProviderExtension";import{createCommand as l,mergeRegister as u,COMMAND_PRIORITY_CRITICAL as c,COMMAND_PRIORITY_EDITOR as
|
|
9
|
+
import{effect as e,untracked as n,signal as o}from"@lexical/extension/signals";import{getExtensionDependencyFromEditor as t}from"@lexical/extension/getExtensionDependencyFromEditor";import{ReactExtension as r}from"@lexical/react/ReactExtension";import{ReactProviderExtension as i}from"@lexical/react/ReactProviderExtension";import{createCommand as l,mergeRegister as u,COMMAND_PRIORITY_CRITICAL as c,COMMAND_PRIORITY_EDITOR as a}from"lexical";import{useState as s,useEffect as m,Suspense as p}from"react";import{createPortal as d}from"react-dom";import{createRoot as f}from"react-dom/client";import{jsx as g,Fragment as x}from"react/jsx-runtime";function h(e,n){const{props:o,extension:r,...i}=n,{Component:l}=t(e,r).output;v(e,{...i,element:o?/*#__PURE__*/g(l,{...o}):null})}function P(e,n){const{Component:o,props:t,...r}=n;v(e,{...r,element:t?/*#__PURE__*/g(o,{...t}):null})}function v(e,n){t(e,_).output.mountReactPlugin(n)}function R(e,n){t(e,_).output.mountReactPluginHost(n)}const C=/* @__PURE__ */l("REACT_PLUGIN_HOST_MOUNT_ROOT_COMMAND"),E=/* @__PURE__ */l("REACT_PLUGIN_HOST_MOUNT_PLUGIN_COMMAND"),_={build:(e,n,t)=>({mountReactPlugin:n=>{e.dispatchCommand(E,n)},mountReactPluginHost:n=>e.dispatchCommand(C,{root:f(n)}),mountedPluginsStore:o({plugins:new Map})}),dependencies:[i,[r,{decorators:[function({context:[n]}){const{mountedPluginsStore:o}=t(n,_).output,{ErrorBoundary:i}=t(n,r).config,l=n._onError.bind(n),[{plugins:u},c]=s(()=>o.peek());m(()=>e(()=>c(o.value)),[o]);const a=[];for(const{key:e,element:n,domNode:o}of u.values()){if(!n)continue;const t=/*#__PURE__*/g(i,{onError:l,children:/*#__PURE__*/g(p,{fallback:null,children:n})},e);a.push(o?/*#__PURE__*/d(t,o,e):t)}return a.length>0?/*#__PURE__*/g(x,{children:a}):null}]}]],name:"@lexical/react/ReactPluginHost",register(e,o,t){let i;const{mountedPluginsStore:l}=t.getOutput(),{Component:s}=t.getDependency(r).output;return u(()=>{i&&i.unmount(),n(()=>{l.value.plugins.clear()})},e.registerCommand(E,e=>(n(()=>{const{plugins:n}=l.value;n.set(e.key,e),l.value={plugins:n}}),!1),c),e.registerCommand(C,e=>(void 0!==i&&function(e,...n){const o=new URL("https://lexical.dev/docs/error"),t=new URLSearchParams;t.append("code",e);for(const e of n)t.append("v",e);throw o.search=t.toString(),Error(`Minified Lexical error #${e}; visit ${o.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(322),i=e.root,i.render(/*#__PURE__*/g(s,{contentEditable:null})),!0),a))}};export{E as REACT_PLUGIN_HOST_MOUNT_PLUGIN_COMMAND,C as REACT_PLUGIN_HOST_MOUNT_ROOT_COMMAND,_ as ReactPluginHostExtension,h as mountReactExtensionComponent,P as mountReactPluginComponent,v as mountReactPluginElement,R as mountReactPluginHost};
|
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import{useLexicalComposerContext as r}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as e}from"@lexical/react/useLexicalEditable";import{LexicalBuilder as t}from"@lexical/extension/LexicalBuilder";import{ReactProviderExtension as o}from"@lexical/react/ReactProviderExtension";import{useMemo as n,useSyncExternalStore as i,Suspense as c,useLayoutEffect as l,useEffect as a,useState as s}from"react";import{createPortal as u}from"react-dom";import{jsx as f,jsxs as m,Fragment as d}from"react/jsx-runtime";import{$canShowPlaceholderCurry as x}from"@lexical/text";import{CAN_USE_DOM as p,mergeRegister as E}from"lexical";import{registerDragonSupport as h}from"@lexical/dragon";import{registerRichText as g}from"@lexical/rich-text";function y(r,...e){const t=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",r);for(const r of e)o.append("v",r);throw t.search=o.toString(),Error(`Minified Lexical error #${r}; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function L(r,e){const[t,o]=n(()=>[e=>r.registerDecoratorListener(e),()=>r.getDecorators()],[r]),l=i(t,o,o),a=function(r){const[e,t]=n(()=>[r.registerRootListener.bind(r),r.getRootElement.bind(r)],[r]);return i(e,t,t)}(r);return n(()=>{const t=e=>r._onError(e),o=[];for(const n in l){const i=r.getElementByKey(n);if(null!==i){const r=/*#__PURE__*/f(e,{onError:t,children:/*#__PURE__*/f(c,{fallback:null,children:l[n]})});o.push(/*#__PURE__*/u(r,i,n))}}return o},[e,l,r,a])}
|
|
9
|
+
import{useLexicalComposerContext as r}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as e}from"@lexical/react/useLexicalEditable";import{LexicalBuilder as t}from"@lexical/extension/LexicalBuilder";import{ReactProviderExtension as o}from"@lexical/react/ReactProviderExtension";import{useMemo as n,useSyncExternalStore as i,Suspense as c,useLayoutEffect as l,useEffect as a,useState as s}from"react";import{createPortal as u}from"react-dom";import{jsx as f,jsxs as m,Fragment as d}from"react/jsx-runtime";import{$canShowPlaceholderCurry as x}from"@lexical/text";import{CAN_USE_DOM as p,mergeRegister as E}from"lexical";import{registerDragonSupport as h}from"@lexical/dragon";import{registerRichText as g}from"@lexical/rich-text";function y(r,...e){const t=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",r);for(const r of e)o.append("v",r);throw t.search=o.toString(),Error(`Minified Lexical error #${r}; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function L({editor:r,ErrorBoundary:e}){return function(r,e){const[t,o]=n(()=>[e=>r.registerDecoratorListener(e),()=>r.getDecorators()],[r]),l=i(t,o,o),a=function(r){const[e,t]=n(()=>[r.registerRootListener.bind(r),r.getRootElement.bind(r)],[r]);return i(e,t,t)}(r);return n(()=>{const t=e=>r._onError(e),o=[];for(const n in l){const i=r.getElementByKey(n);if(null!==i){const r=/*#__PURE__*/f(e,{onError:t,children:/*#__PURE__*/f(c,{fallback:null,children:l[n]})});o.push(/*#__PURE__*/u(r,i,n))}}return o},[e,l,r,a])}(r,e)}function B({editor:r,ErrorBoundary:e}){return function(r){const e=t.maybeFromEditor(r);if(e&&e.hasExtensionByName(o.name)){for(const r of["@lexical/plain-text","@lexical/rich-text"])e.hasExtensionByName(r)&&y(320,r);return!0}return!1}(r)?null:/*#__PURE__*/f(L,{editor:r,ErrorBoundary:e})}const b=p?l:a;function v(r){return r.read("latest",x(r.isComposing()))}function R({contentEditable:e,placeholder:t=null,ErrorBoundary:o}){const[n]=r();return function(r){b(()=>E(g(r),h(r)),[r])}(n),/*#__PURE__*/m(d,{children:[e,/*#__PURE__*/f(w,{content:t}),/*#__PURE__*/f(B,{editor:n,ErrorBoundary:o})]})}function w({content:t}){const[o]=r(),n=function(r){const[e,t]=s(()=>v(r));return b(()=>{function e(){const e=v(r);t(e)}return e(),E(r.registerUpdateListener(()=>{e()}),r.registerEditableListener(()=>{e()}))},[r]),e}(o),i=e();return n?"function"==typeof t?t(i):t:null}export{R as RichTextPlugin};
|
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import{signal as e}from"@lexical/extension/signals";import{useLexicalComposerContext as r}from"@lexical/react/LexicalComposerContext";import{$isScrollableTablesActive as o,setScrollableTablesActive as l,registerTablePlugin as t,registerTableSelectionObserver as a,registerTableCellUnmergeTransform as n,TableCellNode as s}from"@lexical/table";import{$fullReconcile as i}from"lexical";import{useEffect as c,useState as u}from"react";function m({hasCellMerge:m=!0,hasCellBackgroundColor:f=!0,hasTabHandler:p=!0,hasHorizontalScroll:d=!1,hasNestedTables:x=!1}){const[g]=r();c(()=>{o(g)!==d&&(l(g,d),g.update(i))},[g,d]);const C=function(r){const[o]=u(()=>e(r));o.peek()!==r&&(o.value=r)
|
|
9
|
+
import{signal as e}from"@lexical/extension/signals";import{useLexicalComposerContext as r}from"@lexical/react/LexicalComposerContext";import{$isScrollableTablesActive as o,setScrollableTablesActive as l,registerTablePlugin as t,registerTableSelectionObserver as a,registerTableCellUnmergeTransform as n,TableCellNode as s}from"@lexical/table";import{$fullReconcile as i}from"lexical";import{useEffect as c,useState as u}from"react";function m({hasCellMerge:m=!0,hasCellBackgroundColor:f=!0,hasTabHandler:p=!0,hasHorizontalScroll:d=!1,hasNestedTables:x=!1}){const[g]=r();c(()=>{o(g)!==d&&(l(g,d),g.update(i))},[g,d]);const C=function(r){const[o]=u(()=>e(r));return o.peek()!==r&&(o.value=r),o}(x);return c(()=>t(g,{hasNestedTables:C}),[g,C]),c(()=>a(g,p),[g,p]),c(()=>{if(!m)return n(g)},[g,m]),c(()=>{if(!f)return g.registerNodeTransform(s,e=>{null!==e.getBackgroundColor()&&e.setBackgroundColor(null)})},[g,f,m]),null}export{m as TablePlugin};
|
|
@@ -6,5 +6,4 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import{useLexicalCommandsLog as e,TreeView as t,generateContent as a}from"@lexical/devtools-core";import{CAN_USE_DOM as r,mergeRegister as l}from"lexical";import*as o from"react";import{useLayoutEffect as i,useEffect as s,useState as n}from"react";import{jsx as m}from"react/jsx-runtime";const c=r?i:s;function d({treeTypeButtonClassName:r,timeTravelButtonClassName:i,timeTravelPanelSliderClassName:d,timeTravelPanelButtonClassName:u,timeTravelPanelClassName:C,viewClassName:N,editor:f,customPrintNode:v}){const E=/*#__PURE__*/o.createRef(),[T,p]=n(f.getEditorState()),S=e(f);c(()=>(p(f.getEditorState()),l(f.registerUpdateListener(({editorState:e})=>{p(e)}),f.registerEditableListener(()=>{p(f.getEditorState())}))),[f]),s(()=>{const e=E.current;if(null!==e)return e.__lexicalEditor=f,()=>{e.__lexicalEditor=null}},[f,E]);
|
|
10
|
-
return m(t,{treeTypeButtonClassName:r,timeTravelButtonClassName:i,timeTravelPanelSliderClassName:d,timeTravelPanelButtonClassName:u,viewClassName:N,timeTravelPanelClassName:C,setEditorReadOnly:e=>{const t=f.getRootElement();null!=t&&(t.contentEditable=e?"false":"true")},editorState:T,setEditorState:e=>f.setEditorState(e),generateContent:async function(e){return a(f,S,e,v)},ref:E,commandsLog:S})}export{d as TreeView};
|
|
9
|
+
import{useLexicalCommandsLog as e,TreeView as t,generateContent as a}from"@lexical/devtools-core";import{CAN_USE_DOM as r,mergeRegister as l}from"lexical";import*as o from"react";import{useLayoutEffect as i,useEffect as s,useState as n}from"react";import{jsx as m}from"react/jsx-runtime";const c=r?i:s;function d({treeTypeButtonClassName:r,timeTravelButtonClassName:i,timeTravelPanelSliderClassName:d,timeTravelPanelButtonClassName:u,timeTravelPanelClassName:C,viewClassName:N,editor:f,customPrintNode:v}){const E=/*#__PURE__*/o.createRef(),[T,p]=n(f.getEditorState()),S=e(f);return c(()=>(p(f.getEditorState()),l(f.registerUpdateListener(({editorState:e})=>{p(e)}),f.registerEditableListener(()=>{p(f.getEditorState())}))),[f]),s(()=>{const e=E.current;if(null!==e)return e.__lexicalEditor=f,()=>{e.__lexicalEditor=null}},[f,E]),/*#__PURE__*/m(t,{treeTypeButtonClassName:r,timeTravelButtonClassName:i,timeTravelPanelSliderClassName:d,timeTravelPanelButtonClassName:u,viewClassName:N,timeTravelPanelClassName:C,setEditorReadOnly:e=>{const t=f.getRootElement();null!=t&&(t.contentEditable=e?"false":"true")},editorState:T,setEditorState:e=>f.setEditorState(e),generateContent:async function(e){return a(f,S,e,v)},ref:E,commandsLog:S})}export{d as TreeView};
|
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import{useLexicalComposerContext as t}from"@lexical/react/LexicalComposerContext";import{CAN_USE_DOM as e,getDOMShadowRoots as n,mergeRegister as l,registerEventListener as o,getRootOwnerDocument as r,COMMAND_PRIORITY_LOW as i,KEY_ARROW_DOWN_COMMAND as c,KEY_ARROW_UP_COMMAND as u,KEY_ESCAPE_COMMAND as s,KEY_TAB_COMMAND as a,KEY_ENTER_COMMAND as d,isDOMShadowRoot as p,isHTMLElement as m,getParentElement as f,$getSelection as g,$isRangeSelection as h,$isTextNode as y,getDOMSelection as x,getDOMSelectionPoints as C}from"lexical";import{useLayoutEffect as b,useEffect as v,useRef as w,useCallback as R,useState as E,useMemo as I,startTransition as S}from"react";import{SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND as O}from"@lexical/react/LexicalTypeaheadMenuPluginUtils";export{PUNCTUATION,SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND,getScrollParent,useBasicTypeaheadTriggerMatch}from"@lexical/react/LexicalTypeaheadMenuPluginUtils";import{getScrollParent as T}from"@lexical/utils";import P from"react-dom";import{jsx as N,jsxs as A}from"react/jsx-runtime";export{MenuOption}from"@lexical/react/LexicalMenuOption";const k=e?b:v,D=t=>{const e=t.closest("#typeahead-menu");if(!e)return;const n=e.getBoundingClientRect();n.top+n.height>window.innerHeight&&e.scrollIntoView({block:"center"}),n.top<0&&e.scrollIntoView({block:"center"}),t.scrollIntoView({block:"nearest"})};function M(t,e){const n=t.getBoundingClientRect(),l=e.getBoundingClientRect();return n.top>=l.top-6&&n.top<=l.bottom+6}function L(e,r,i,c){const[u]=t();v(()=>{if(null!=r&&null!=e){const t=u.getRootElement(),e=null!=t?T(t,!1):document.body;let s=!1,a=M(r,e);const d=function(){s||(window.requestAnimationFrame(function(){i(),s=!1}),s=!0);const t=M(r,e);t!==a&&(a=t,null!=c&&c(t))},p=new ResizeObserver(i),m=n(t??r);return p.observe(r),l(o(window,"resize",i),o(document,"scroll",d,{capture:!0,passive:!0}),...m.map(t=>o(t,"scroll",d,{capture:!0,passive:!0})),()=>p.unobserve(r))}},[r,u,c,i,e])}function B({index:t,isSelected:e,onClick:n,onMouseEnter:l,option:o}){let r="item";return e&&(r+=" selected"),/*#__PURE__*/A("li",{tabIndex:-1,className:r,ref:o.setRefElement,role:"option","aria-selected":e,id:"typeahead-item-"+t,onMouseEnter:l,onClick:n,children:[o.icon,/*#__PURE__*/N("span",{className:"text",children:o.title})]},o.key)}function F({close:t,editor:e,anchorElementRef:n,resolution:o,options:r,menuRenderFn:p,onSelectOption:m,shouldSplitNodeWithQuery:f=!1,commandPriority:y=i,preselectFirstItem:x=!0}){const[C,b]=E(null),w=null!==C?Math.min(r.length-1,C):null,S=o.match&&o.match.matchingString;v(()=>{x&&b(0)},[S,x]);const T=R(n=>{e.update(()=>{const e=null!=o.match&&f?function(t){const e=g();if(!h(e)||!e.isCollapsed())return null;const n=e.anchor;if("text"!==n.type)return null;const l=n.getNode();if(!l.isSimpleText())return null;const o=n.offset,r=l.getTextContent().slice(0,o),i=t.replaceableString.length,c=o-function(t,e,n){let l=n;for(let n=l;n<=e.length;n++)t.slice(-n)===e.substring(0,n)&&(l=n);return l}(r,t.matchingString,i);if(c<0)return null;let u;return 0===c?[u]=l.splitText(o):[,u]=l.splitText(c,o),u}(o.match):null;m(n,e,t,o.match?o.match.matchingString:"")})},[e,f,o.match,m,t]),A=R(t=>{const n=e.getRootElement();null!==n&&(n.setAttribute("aria-activedescendant","typeahead-item-"+t),b(t))},[e]),M=R(()=>n.current&&r.length?/*#__PURE__*/P.createPortal(/*#__PURE__*/N("div",{className:"typeahead-popover mentions-menu",children:/*#__PURE__*/N("ul",{children:r.map((t,e)=>/*#__PURE__*/N(B,{index:e,isSelected:w===e,onClick:()=>{b(e),T(t)},onMouseEnter:()=>{b(e)},option:t},t.key))})}),n.current):null,[n,r,w,T,b]);v(()=>()=>{const t=e.getRootElement();null!==t&&t.removeAttribute("aria-activedescendant")},[e]),k(()=>{null===r?b(null):null===w&&x&&A(0)},[r,w,A,x]);const L=null==p&&(null===r||!r.length);v(()=>l(e.registerCommand(O,({option:t})=>!(!t.ref||null==t.ref.current
|
|
9
|
+
import{useLexicalComposerContext as t}from"@lexical/react/LexicalComposerContext";import{CAN_USE_DOM as e,getDOMShadowRoots as n,mergeRegister as l,registerEventListener as o,getRootOwnerDocument as r,COMMAND_PRIORITY_LOW as i,KEY_ARROW_DOWN_COMMAND as c,KEY_ARROW_UP_COMMAND as u,KEY_ESCAPE_COMMAND as s,KEY_TAB_COMMAND as a,KEY_ENTER_COMMAND as d,isDOMShadowRoot as p,isHTMLElement as m,getParentElement as f,$getSelection as g,$isRangeSelection as h,$isTextNode as y,getDOMSelection as x,getDOMSelectionPoints as C}from"lexical";import{useLayoutEffect as b,useEffect as v,useRef as w,useCallback as R,useState as E,useMemo as I,startTransition as S}from"react";import{SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND as O}from"@lexical/react/LexicalTypeaheadMenuPluginUtils";export{PUNCTUATION,SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND,getScrollParent,useBasicTypeaheadTriggerMatch}from"@lexical/react/LexicalTypeaheadMenuPluginUtils";import{getScrollParent as T}from"@lexical/utils";import P from"react-dom";import{jsx as N,jsxs as A}from"react/jsx-runtime";export{MenuOption}from"@lexical/react/LexicalMenuOption";const k=e?b:v,D=t=>{const e=t.closest("#typeahead-menu");if(!e)return;const n=e.getBoundingClientRect();n.top+n.height>window.innerHeight&&e.scrollIntoView({block:"center"}),n.top<0&&e.scrollIntoView({block:"center"}),t.scrollIntoView({block:"nearest"})};function M(t,e){const n=t.getBoundingClientRect(),l=e.getBoundingClientRect();return n.top>=l.top-6&&n.top<=l.bottom+6}function L(e,r,i,c){const[u]=t();v(()=>{if(null!=r&&null!=e){const t=u.getRootElement(),e=null!=t?T(t,!1):document.body;let s=!1,a=M(r,e);const d=function(){s||(window.requestAnimationFrame(function(){i(),s=!1}),s=!0);const t=M(r,e);t!==a&&(a=t,null!=c&&c(t))},p=new ResizeObserver(i),m=n(t??r);return p.observe(r),l(o(window,"resize",i),o(document,"scroll",d,{capture:!0,passive:!0}),...m.map(t=>o(t,"scroll",d,{capture:!0,passive:!0})),()=>p.unobserve(r))}},[r,u,c,i,e])}function B({index:t,isSelected:e,onClick:n,onMouseEnter:l,option:o}){let r="item";return e&&(r+=" selected"),/*#__PURE__*/A("li",{tabIndex:-1,className:r,ref:o.setRefElement,role:"option","aria-selected":e,id:"typeahead-item-"+t,onMouseEnter:l,onClick:n,children:[o.icon,/*#__PURE__*/N("span",{className:"text",children:o.title})]},o.key)}function F({close:t,editor:e,anchorElementRef:n,resolution:o,options:r,menuRenderFn:p,onSelectOption:m,shouldSplitNodeWithQuery:f=!1,commandPriority:y=i,preselectFirstItem:x=!0}){const[C,b]=E(null),w=null!==C?Math.min(r.length-1,C):null,S=o.match&&o.match.matchingString;v(()=>{x&&b(0)},[S,x]);const T=R(n=>{e.update(()=>{const e=null!=o.match&&f?function(t){const e=g();if(!h(e)||!e.isCollapsed())return null;const n=e.anchor;if("text"!==n.type)return null;const l=n.getNode();if(!l.isSimpleText())return null;const o=n.offset,r=l.getTextContent().slice(0,o),i=t.replaceableString.length,c=o-function(t,e,n){let l=n;for(let n=l;n<=e.length;n++)t.slice(-n)===e.substring(0,n)&&(l=n);return l}(r,t.matchingString,i);if(c<0)return null;let u;return 0===c?[u]=l.splitText(o):[,u]=l.splitText(c,o),u}(o.match):null;m(n,e,t,o.match?o.match.matchingString:"")})},[e,f,o.match,m,t]),A=R(t=>{const n=e.getRootElement();null!==n&&(n.setAttribute("aria-activedescendant","typeahead-item-"+t),b(t))},[e]),M=R(()=>n.current&&r.length?/*#__PURE__*/P.createPortal(/*#__PURE__*/N("div",{className:"typeahead-popover mentions-menu",children:/*#__PURE__*/N("ul",{children:r.map((t,e)=>/*#__PURE__*/N(B,{index:e,isSelected:w===e,onClick:()=>{b(e),T(t)},onMouseEnter:()=>{b(e)},option:t},t.key))})}),n.current):null,[n,r,w,T,b]);v(()=>()=>{const t=e.getRootElement();null!==t&&t.removeAttribute("aria-activedescendant")},[e]),k(()=>{null===r?b(null):null===w&&x&&A(0)},[r,w,A,x]);const L=null==p&&(null===r||!r.length);v(()=>l(e.registerCommand(O,({option:t})=>!(!t.ref||null==t.ref.current||(D(t.ref.current),0)),y)),[e,A,y]),v(()=>l(e.registerCommand(c,t=>{const n=t;if(L)return!1;const l=null===w?0:w!==r.length-1?w+1:0;A(l);const o=r[l];return o?(o.ref&&o.ref.current&&e.dispatchCommand(O,{index:l,option:o}),n.preventDefault(),n.stopImmediatePropagation(),!0):(A(-1),n.preventDefault(),n.stopImmediatePropagation(),!0)},y),e.registerCommand(u,t=>{const e=t;if(L)return!1;const n=null===w?r.length-1:0!==w?w-1:r.length-1;A(n);const l=r[n];return l?(l.ref&&l.ref.current&&D(l.ref.current),e.preventDefault(),e.stopImmediatePropagation(),!0):(A(-1),e.preventDefault(),e.stopImmediatePropagation(),!0)},y),e.registerCommand(s,e=>{const n=e;return!L&&(n.preventDefault(),n.stopImmediatePropagation(),t(),!0)},y),e.registerCommand(a,t=>{const e=t;return null!==r&&null!==w&&null!=r[w]&&(e.preventDefault(),e.stopImmediatePropagation(),T(r[w]),!0)},y),e.registerCommand(d,t=>!(null===r||null===w||null==r[w]||t&&t.shiftKey||(null!==t&&(t.preventDefault(),t.stopImmediatePropagation()),T(r[w]),0)),y)),[T,t,e,r,L,w,A,y]);const F=I(()=>({options:r,selectOptionAndCleanUp:T,selectedIndex:w,setHighlightedIndex:b}),[T,w,r]);return null!=p?p(n,F,o.match?o.match.matchingString:""):M()}function $(t,e){null!=e&&(t.className=e),t.setAttribute("aria-label","Typeahead menu"),t.setAttribute("role","listbox"),t.style.display="block",t.style.position="absolute"}function U(t){if("static"!==t.position)return!0;const e=t.willChange;return"none"!==t.transform||"none"!==t.perspective||"none"!==t.filter||"none"!==t.backdropFilter||t.contain.includes("paint")||t.contain.includes("layout")||t.contain.includes("strict")||t.contain.includes("content")||e.includes("transform")||e.includes("perspective")||e.includes("filter")||e.includes("contain")}function _({options:n,onQueryChange:l,onSelectOption:o,onOpen:c,onClose:u,menuRenderFn:s,triggerFn:a,anchorClassName:d,commandPriority:b=i,parent:I,preselectFirstItem:O=!0,ignoreEntityBoundary:T=!1}){const[P]=t(),[A,k]=E(null),D=function(n,l,o,i,c=!0){const[u]=t(),s=i??function(t){if(!e)return;const n=t.getRootElement();if(null!==n){const t=n.getRootNode();return p(t)?t:n.ownerDocument.body}return document.body}(u),a=e?r(u.getRootElement()).createElement("div"):null,d=w(a),g=R(()=>{if(null===d.current||void 0===s)return;d.current.style.top=d.current.style.bottom;const t=u.getRootElement(),e=d.current,l=e.firstChild;if(null!==t&&null!==n){const{left:r,top:i,width:u,height:a}=n.getRect(),g=d.current.offsetHeight,h=function(t){const e=p(t)?t.host:t;for(let t=m(e)?e:null;null!==t;t=f(t)){const e=t.ownerDocument.defaultView;if(null===e)break;if(U(e.getComputedStyle(t))){const e=t.getBoundingClientRect();return{left:e.left+t.clientLeft-t.scrollLeft,top:e.top+t.clientTop-t.scrollTop}}}return null}(s),y=t=>null!==h?t-h.left:t+window.pageXOffset,x=t=>null!==h?t-h.top:t+(c?window.pageYOffset:0);if(e.style.top=`${x(i+g+3)}px`,e.style.left=`${y(r)}px`,e.style.height=`${a}px`,e.style.width=`${u}px`,null!==l){l.style.top=`${i}`;const n=l.getBoundingClientRect(),o=n.height,c=n.width,u=t.getBoundingClientRect();r+c>u.right&&(e.style.left=`${y(u.right-c)}px`),(i+o>window.innerHeight||i+o>u.bottom)&&i-u.top>o+a&&(e.style.top=`${x(i-o-a)}px`)}e.isConnected||($(e,o),s.append(e)),e.setAttribute("id","typeahead-menu"),t.setAttribute("aria-controls","typeahead-menu")}},[u,n,c,o,s]);v(()=>{const t=u.getRootElement();return null!==n&&g(),()=>{null!==t&&t.removeAttribute("aria-controls");const e=d.current;null!==e&&e.isConnected&&(e.remove(),e.removeAttribute("id"))}},[u,g,n]);const h=R(t=>{null!==n&&(t||l(null))},[n,l]);return L(n,d.current,g,h),null!=a&&a===d.current&&($(a,o),null!=s&&s.append(a)),d}(A,k,d,I),M=R(()=>{if(null===A)return;const t=()=>{k(null)};let e;try{e=u&&u()}finally{e?e.then(t,t):t()}},[u,A]),B=R(t=>{k(t),null!=c&&null===A&&c(t)},[c,A]);return v(()=>{const t=P.registerUpdateListener(()=>{P.read("latest",()=>{if(!P.isEditable())return void M();const t=()=>{P.isComposing()||M()},e=P._window||window,n=e.document.createRange(),o=g(),r=function(t){let e=null;return t.read("latest",()=>{const t=g();h(t)&&(e=function(t){const e=t.anchor;if("text"!==e.type)return null;const n=e.getNode();if(!n.isSimpleText())return null;const l=e.offset;return n.getTextContent().slice(0,l)}(t))}),e}(P);if(!h(o)||!o.isCollapsed()||null===r||null===n)return void t();const i=a(r,P);if(l(i?i.matchingString:null),null!==i&&(T||!function(t,e){return 0===e&&t.read("latest",()=>{const t=g();if(h(t)){const e=t.anchor.getNode().getPreviousSibling();return y(e)&&e.isTextEntity()}return!1})}(P,i.leadOffset))){const t=function(t,e,n,l){const o=x(n);if(null===o||!o.isCollapsed)return!1;const r=C(o,l),i=r.anchorNode,c=t,u=r.anchorOffset;if(null==i||null==u)return!1;try{e.setStart(i,c),e.setEnd(i,u)}catch(t){return!1}return!0}(i.leadOffset,n,e,P.getRootElement());if(null!==t)return void S(()=>B({getRect:()=>n.getBoundingClientRect(),match:i}))}t()})});return()=>{t()}},[P,a,l,A,M,B,T]),v(()=>P.registerEditableListener(t=>{t||M()}),[P,M]),null===A||null===P||null===D.current?null:/*#__PURE__*/N(F,{close:M,resolution:A,editor:P,anchorElementRef:D,options:n,menuRenderFn:s,shouldSplitNodeWithQuery:!0,onSelectOption:o,commandPriority:b,preselectFirstItem:O})}export{_ as LexicalTypeaheadMenuPlugin,L as useDynamicPositioning};
|
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import{getScrollParent as t}from"@lexical/utils";import{createCommand as e}from"lexical";import{useCallback as n}from"react";const r="\\.,\\+\\*\\?\\$\\@\\|#{}\\(\\)\\^\\-\\[\\]\\\\/!%'\"~=<>_:;",l=/* @__PURE__ */e("SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND"),i=t;function o(t,{minLength:e=1,maxLength:l=75,punctuation:i=r,allowWhitespace:o=!1}){return n(n=>{const r=new RegExp("(^|\\s|\\()(["+t+"]((?:
|
|
9
|
+
import{getScrollParent as t}from"@lexical/utils";import{createCommand as e}from"lexical";import{useCallback as n}from"react";const r="\\.,\\+\\*\\?\\$\\@\\|#{}\\(\\)\\^\\-\\[\\]\\\\/!%'\"~=<>_:;",l=/* @__PURE__ */e("SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND"),i=t;function o(t,{minLength:e=1,maxLength:l=75,punctuation:i=r,allowWhitespace:o=!1}){return n(n=>{const r=new RegExp("(^|\\s|\\()(["+t+"]((?:[^"+t+i+(o?"":"\\s")+"]){0,"+l+"}))$").exec(n);if(null!==r){const t=r[1],n=r[3];if(n.length>=e)return{leadOffset:r.index+t.length,matchingString:n,replaceableString:r[2]}}return null},[o,t,i,l,e])}export{r as PUNCTUATION,l as SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND,i as getScrollParent,o as useBasicTypeaheadTriggerMatch};
|
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import{useLexicalComposerContext as e}from"@lexical/react/LexicalComposerContext";import{$getSelection as t,$isNodeSelection as r,$getNodeByKey as n,$createNodeSelection as l,$setSelection as o}from"lexical";import{useState as c,useEffect as i,useCallback as a}from"react";function u(e,t){return e.read("latest",()=>{const e=n(t);return null!==e&&e.isSelected()})}function s(s){const[d]=e(),[p,f]=c(()=>u(d,s));i(()=>{let e=!0;const t=d.registerUpdateListener(()=>{e&&f(u(d,s))});return()=>{e=!1,t()}},[d,s])
|
|
9
|
+
import{useLexicalComposerContext as e}from"@lexical/react/LexicalComposerContext";import{$getSelection as t,$isNodeSelection as r,$getNodeByKey as n,$createNodeSelection as l,$setSelection as o}from"lexical";import{useState as c,useEffect as i,useCallback as a}from"react";function u(e,t){return e.read("latest",()=>{const e=n(t);return null!==e&&e.isSelected()})}function s(s){const[d]=e(),[p,f]=c(()=>u(d,s));return i(()=>{let e=!0;const t=d.registerUpdateListener(()=>{e&&f(u(d,s))});return()=>{e=!1,t()}},[d,s]),[p,a(e=>{d.update(()=>{let c=t();if(!r(c)){const t=e?null:n(s);if(null!==t&&!t.isSelected())return;c=l(),o(c)}r(c)&&(e?c.add(s):c.delete(s))})},[d,s]),a(()=>{d.update(()=>{const e=t();r(e)&&e.clear()})},[d])]}export{s as useLexicalNodeSelection};
|
package/package.json
CHANGED
|
@@ -8,28 +8,28 @@
|
|
|
8
8
|
"rich-text"
|
|
9
9
|
],
|
|
10
10
|
"license": "MIT",
|
|
11
|
-
"version": "0.51.0",
|
|
11
|
+
"version": "0.51.1-nightly.20260921.0",
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"@floating-ui/react": "^0.27.19",
|
|
14
|
-
"@lexical/a11y": "0.51.0",
|
|
15
|
-
"@lexical/devtools-core": "0.51.0",
|
|
16
|
-
"@lexical/dragon": "0.51.0",
|
|
17
|
-
"@lexical/extension": "0.51.0",
|
|
18
|
-
"@lexical/hashtag": "0.51.0",
|
|
19
|
-
"@lexical/history": "0.51.0",
|
|
20
|
-
"@lexical/internal": "0.51.0",
|
|
21
|
-
"@lexical/link": "0.51.0",
|
|
22
|
-
"@lexical/list": "0.51.0",
|
|
23
|
-
"@lexical/mark": "0.51.0",
|
|
24
|
-
"@lexical/markdown": "0.51.0",
|
|
25
|
-
"@lexical/overflow": "0.51.0",
|
|
26
|
-
"@lexical/plain-text": "0.51.0",
|
|
27
|
-
"@lexical/rich-text": "0.51.0",
|
|
28
|
-
"@lexical/table": "0.51.0",
|
|
29
|
-
"@lexical/text": "0.51.0",
|
|
30
|
-
"@lexical/utils": "0.51.0",
|
|
31
|
-
"@lexical/yjs": "0.51.0",
|
|
32
|
-
"lexical": "0.51.0"
|
|
14
|
+
"@lexical/a11y": "0.51.1-nightly.20260921.0",
|
|
15
|
+
"@lexical/devtools-core": "0.51.1-nightly.20260921.0",
|
|
16
|
+
"@lexical/dragon": "0.51.1-nightly.20260921.0",
|
|
17
|
+
"@lexical/extension": "0.51.1-nightly.20260921.0",
|
|
18
|
+
"@lexical/hashtag": "0.51.1-nightly.20260921.0",
|
|
19
|
+
"@lexical/history": "0.51.1-nightly.20260921.0",
|
|
20
|
+
"@lexical/internal": "0.51.1-nightly.20260921.0",
|
|
21
|
+
"@lexical/link": "0.51.1-nightly.20260921.0",
|
|
22
|
+
"@lexical/list": "0.51.1-nightly.20260921.0",
|
|
23
|
+
"@lexical/mark": "0.51.1-nightly.20260921.0",
|
|
24
|
+
"@lexical/markdown": "0.51.1-nightly.20260921.0",
|
|
25
|
+
"@lexical/overflow": "0.51.1-nightly.20260921.0",
|
|
26
|
+
"@lexical/plain-text": "0.51.1-nightly.20260921.0",
|
|
27
|
+
"@lexical/rich-text": "0.51.1-nightly.20260921.0",
|
|
28
|
+
"@lexical/table": "0.51.1-nightly.20260921.0",
|
|
29
|
+
"@lexical/text": "0.51.1-nightly.20260921.0",
|
|
30
|
+
"@lexical/utils": "0.51.1-nightly.20260921.0",
|
|
31
|
+
"@lexical/yjs": "0.51.1-nightly.20260921.0",
|
|
32
|
+
"lexical": "0.51.1-nightly.20260921.0"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"react": ">=18.x",
|