@lexical/react 0.3.7 → 0.3.10

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.
Files changed (35) hide show
  1. package/LexicalAutoEmbedPlugin.d.ts +46 -0
  2. package/LexicalAutoEmbedPlugin.dev.js +490 -0
  3. package/LexicalAutoEmbedPlugin.js +9 -0
  4. package/LexicalAutoEmbedPlugin.prod.js +21 -0
  5. package/LexicalAutoLinkPlugin.dev.js +1 -1
  6. package/LexicalAutoLinkPlugin.prod.js +2 -2
  7. package/LexicalCollaborationContext.d.ts +19 -0
  8. package/LexicalCollaborationContext.dev.js +38 -0
  9. package/LexicalCollaborationContext.js +9 -0
  10. package/LexicalCollaborationContext.js.flow +21 -0
  11. package/LexicalCollaborationContext.prod.js +8 -0
  12. package/LexicalCollaborationPlugin.d.ts +0 -10
  13. package/LexicalCollaborationPlugin.dev.js +13 -20
  14. package/LexicalCollaborationPlugin.js.flow +0 -9
  15. package/LexicalCollaborationPlugin.prod.js +9 -10
  16. package/LexicalLinkPlugin.dev.js +15 -2
  17. package/LexicalLinkPlugin.prod.js +2 -1
  18. package/LexicalNestedComposer.dev.js +11 -5
  19. package/LexicalNestedComposer.prod.js +3 -3
  20. package/LexicalOnChangePlugin.d.ts +2 -1
  21. package/LexicalOnChangePlugin.dev.js +6 -3
  22. package/LexicalOnChangePlugin.js.flow +2 -0
  23. package/LexicalOnChangePlugin.prod.js +2 -2
  24. package/LexicalTableOfContents__EXPERIMENTAL.d.ts +14 -0
  25. package/LexicalTableOfContents__EXPERIMENTAL.dev.js +144 -0
  26. package/LexicalTableOfContents__EXPERIMENTAL.js +9 -0
  27. package/LexicalTableOfContents__EXPERIMENTAL.js.flow +17 -0
  28. package/LexicalTableOfContents__EXPERIMENTAL.prod.js +10 -0
  29. package/LexicalTreeView.dev.js +43 -9
  30. package/LexicalTreeView.prod.js +13 -13
  31. package/LexicalTypeaheadMenuPlugin.d.ts +52 -0
  32. package/LexicalTypeaheadMenuPlugin.dev.js +520 -0
  33. package/LexicalTypeaheadMenuPlugin.js +9 -0
  34. package/LexicalTypeaheadMenuPlugin.prod.js +22 -0
  35. package/package.json +19 -19
@@ -6,6 +6,7 @@
6
6
  */
7
7
  'use strict';
8
8
 
9
+ var link = require('@lexical/link');
9
10
  var mark = require('@lexical/mark');
10
11
  var lexical = require('lexical');
11
12
  var React = require('react');
@@ -92,7 +93,7 @@ function TreeView({
92
93
 
93
94
  play();
94
95
  return () => {
95
- window.clearTimeout(timeoutId);
96
+ clearTimeout(timeoutId);
96
97
  };
97
98
  }
98
99
  }, [timeStampedEditorStates, isPlaying, editor, totalEditorStates]);
@@ -120,7 +121,8 @@ function TreeView({
120
121
  setTimeTravelEnabled(true);
121
122
  }
122
123
  },
123
- className: timeTravelButtonClassName
124
+ className: timeTravelButtonClassName,
125
+ type: "button"
124
126
  }, "Time Travel"), /*#__PURE__*/React.createElement("pre", {
125
127
  ref: treeElementRef
126
128
  }, content), timeTravelEnabled && /*#__PURE__*/React.createElement("div", {
@@ -129,7 +131,8 @@ function TreeView({
129
131
  className: timeTravelPanelButtonClassName,
130
132
  onClick: () => {
131
133
  setIsPlaying(!isPlaying);
132
- }
134
+ },
135
+ type: "button"
133
136
  }, isPlaying ? 'Pause' : 'Play'), /*#__PURE__*/React.createElement("input", {
134
137
  className: timeTravelPanelSliderClassName,
135
138
  ref: inputRef,
@@ -164,7 +167,8 @@ function TreeView({
164
167
  setTimeTravelEnabled(false);
165
168
  setIsPlaying(false);
166
169
  }
167
- }
170
+ },
171
+ type: "button"
168
172
  }, "Exit")));
169
173
  }
170
174
 
@@ -228,27 +232,37 @@ function visitTree(currentNode, visitor, indent = []) {
228
232
 
229
233
  function normalize(text) {
230
234
  return Object.entries(NON_SINGLE_WIDTH_CHARS_REPLACEMENT).reduce((acc, [key, value]) => acc.replace(new RegExp(key, 'g'), String(value)), text);
231
- }
235
+ } // TODO Pass via props to allow customizability
236
+
232
237
 
233
238
  function printNode(node) {
234
239
  if (lexical.$isTextNode(node)) {
235
240
  const text = node.getTextContent(true);
236
241
  const title = text.length === 0 ? '(empty)' : `"${normalize(text)}"`;
237
- const properties = printAllProperties(node);
242
+ const properties = printAllTextNodeProperties(node);
238
243
  return [title, properties.length !== 0 ? `{ ${properties} }` : null].filter(Boolean).join(' ').trim();
244
+ } else if (link.$isLinkNode(node)) {
245
+ const link = node.getURL();
246
+ const title = link.length === 0 ? '(empty)' : `"${normalize(link)}"`;
247
+ const properties = printAllLinkNodeProperties(node);
248
+ return [title, properties.length !== 0 ? `{ ${properties} }` : null].filter(Boolean).join(' ').trim();
249
+ } else {
250
+ return '';
239
251
  }
240
-
241
- return '';
242
252
  }
243
253
 
244
254
  const FORMAT_PREDICATES = [node => node.hasFormat('bold') && 'Bold', node => node.hasFormat('code') && 'Code', node => node.hasFormat('italic') && 'Italic', node => node.hasFormat('strikethrough') && 'Strikethrough', node => node.hasFormat('subscript') && 'Subscript', node => node.hasFormat('superscript') && 'Superscript', node => node.hasFormat('underline') && 'Underline'];
245
255
  const DETAIL_PREDICATES = [node => node.isDirectionless() && 'Directionless', node => node.isUnmergeable() && 'Unmergeable'];
246
256
  const MODE_PREDICATES = [node => node.isToken() && 'Token', node => node.isSegmented() && 'Segmented', node => node.isInert() && 'Inert'];
247
257
 
248
- function printAllProperties(node) {
258
+ function printAllTextNodeProperties(node) {
249
259
  return [printFormatProperties(node), printDetailProperties(node), printModeProperties(node)].filter(Boolean).join(', ');
250
260
  }
251
261
 
262
+ function printAllLinkNodeProperties(node) {
263
+ return [printTargetProperties(node), printRelProperties(node)].filter(Boolean).join(', ');
264
+ }
265
+
252
266
  function printDetailProperties(nodeOrSelection) {
253
267
  let str = DETAIL_PREDICATES.map(predicate => predicate(nodeOrSelection)).filter(Boolean).join(', ').toLocaleLowerCase();
254
268
 
@@ -279,6 +293,26 @@ function printFormatProperties(nodeOrSelection) {
279
293
  return str;
280
294
  }
281
295
 
296
+ function printTargetProperties(node) {
297
+ let str = node.getTarget(); // TODO Fix nullish on LinkNode
298
+
299
+ if (str != null) {
300
+ str = 'target: ' + str;
301
+ }
302
+
303
+ return str;
304
+ }
305
+
306
+ function printRelProperties(node) {
307
+ let str = node.getRel(); // TODO Fix nullish on LinkNode
308
+
309
+ if (str != null) {
310
+ str = 'rel: ' + str;
311
+ }
312
+
313
+ return str;
314
+ }
315
+
282
316
  function printSelectedCharsLine({
283
317
  indent,
284
318
  isSelected,
@@ -4,17 +4,17 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- 'use strict';var l=require("@lexical/mark"),p=require("lexical"),r=require("react");let D=Object.freeze({"\t":"\\t","\n":"\\n"}),E=new RegExp(Object.keys(D).join("|"),"g"),F=Object.freeze({ancestorHasNextSibling:"|",ancestorIsLastChild:" ",hasNextSibling:"\u251c",isLastChild:"\u2514",selectedChar:"^",selectedLine:">"});
8
- function G(a){let b="",c=H(a),e=a.anchor;a=a.focus;let d=e.offset,f=a.offset;b=b+`: range ${""!==c?`{ ${c} }`:""}`+`\n \u251c anchor { key: ${e.key}, offset: ${null===d?"null":d}, type: ${e.type} }`;return b+=`\n \u2514 focus { key: ${a.key}, offset: ${null===f?"null":f}, type: ${a.type} }`}
9
- function J(a){let b=" root\n";a=a.read(()=>{const c=p.$getSelection();K(p.$getRoot(),(e,d)=>{const f=`(${e.getKey()})`,g=e.getType()||"",m=e.isSelected(),v=l.$isMarkNode(e)?` id: [ ${e.getIDs().join(", ")} ] `:"";var u=b,q=m?F.selectedLine:" ",w=d.join(" ");if(p.$isTextNode(e)){var k=e.getTextContent(!0);let t=0===k.length?"(empty)":`"${L(k)}"`;k=[H(e),M(e),N(e)].filter(Boolean).join(", ");k=[t,0!==k.length?`{ ${k} }`:null].filter(Boolean).join(" ").trim()}else k="";b=u+`${q} ${w} ${f} ${g} ${v} ${k}\n`;
10
- b+=O({indent:d,isSelected:m,node:e,nodeKeyDisplay:f,selection:c,typeDisplay:g})});return null===c?": null":p.$isRangeSelection(c)?G(c):p.$isGridSelection(c)?`: grid\n \u2514 { grid: ${c.gridKey}, anchorCell: ${c.anchor.key}, focusCell: ${c.focus.key} }`:`: node\n \u2514 [${Array.from(c._nodes).join(", ")}]`});return b+"\n selection"+a}
11
- function K(a,b,c=[]){a=a.getChildren();let e=a.length;a.forEach((d,f)=>{b(d,c.concat(f===e-1?F.isLastChild:F.hasNextSibling));p.$isElementNode(d)&&K(d,b,c.concat(f===e-1?F.ancestorIsLastChild:F.ancestorHasNextSibling))})}function L(a){return Object.entries(D).reduce((b,[c,e])=>b.replace(new RegExp(c,"g"),String(e)),a)}
12
- let P=[a=>a.hasFormat("bold")&&"Bold",a=>a.hasFormat("code")&&"Code",a=>a.hasFormat("italic")&&"Italic",a=>a.hasFormat("strikethrough")&&"Strikethrough",a=>a.hasFormat("subscript")&&"Subscript",a=>a.hasFormat("superscript")&&"Superscript",a=>a.hasFormat("underline")&&"Underline"],Q=[a=>a.isDirectionless()&&"Directionless",a=>a.isUnmergeable()&&"Unmergeable"],R=[a=>a.isToken()&&"Token",a=>a.isSegmented()&&"Segmented",a=>a.isInert()&&"Inert"];
13
- function M(a){let b=Q.map(c=>c(a)).filter(Boolean).join(", ").toLocaleLowerCase();""!==b&&(b="detail: "+b);return b}function N(a){let b=R.map(c=>c(a)).filter(Boolean).join(", ").toLocaleLowerCase();""!==b&&(b="mode: "+b);return b}function H(a){let b=P.map(c=>c(a)).filter(Boolean).join(", ").toLocaleLowerCase();""!==b&&(b="format: "+b);return b}
14
- function O({indent:a,isSelected:b,node:c,nodeKeyDisplay:e,selection:d,typeDisplay:f}){if(!p.$isTextNode(c)||!p.$isRangeSelection(d)||!b||p.$isElementNode(c))return"";b=d.anchor;var g=d.focus;if(""===c.getTextContent()||b.getNode()===d.focus.getNode()&&b.offset===g.offset)return"";g=d.anchor;let m=d.focus,v=c.getTextContent(!0),u=v.length;b=d=-1;if("text"===g.type&&"text"===m.type){let k=g.getNode(),t=m.getNode();k===t&&c===k&&g.offset!==m.offset?[d,b]=g.offset<m.offset?[g.offset,m.offset]:[m.offset,
15
- g.offset]:c===k?[d,b]=k.isBefore(t)?[g.offset,u]:[0,g.offset]:c===t?[d,b]=t.isBefore(k)?[m.offset,u]:[0,m.offset]:[d,b]=[0,u]}c=(v.slice(0,d).match(E)||[]).length;g=(v.slice(d,b).match(E)||[]).length;let [q,w]=[d+c,b+c+g];if(q===w)return"";c=a[a.length-1]===F.hasNextSibling?F.ancestorHasNextSibling:F.ancestorIsLastChild;a=[...a.slice(0,a.length-1),c];c=Array(q+1).fill(" ");d=Array(w-q).fill(F.selectedChar);e=Array(e.length+(f.length+3)).fill(" ");return[F.selectedLine,a.join(" "),[...e,...c,...d].join("")].join(" ")+
7
+ 'use strict';var l=require("@lexical/link"),q=require("@lexical/mark"),t=require("lexical"),D=require("react");let E=Object.freeze({"\t":"\\t","\n":"\\n"}),F=new RegExp(Object.keys(E).join("|"),"g"),G=Object.freeze({ancestorHasNextSibling:"|",ancestorIsLastChild:" ",hasNextSibling:"\u251c",isLastChild:"\u2514",selectedChar:"^",selectedLine:">"});
8
+ function H(a){let b="",c=I(a),d=a.anchor;a=a.focus;let e=d.offset,g=a.offset;b=b+`: range ${""!==c?`{ ${c} }`:""}`+`\n \u251c anchor { key: ${d.key}, offset: ${null===e?"null":e}, type: ${d.type} }`;return b+=`\n \u2514 focus { key: ${a.key}, offset: ${null===g?"null":g}, type: ${a.type} }`}
9
+ function K(a){let b=" root\n";a=a.read(()=>{const c=t.$getSelection();L(t.$getRoot(),(d,e)=>{const g=`(${d.getKey()})`,h=d.getType()||"",n=d.isSelected(),w=q.$isMarkNode(d)?` id: [ ${d.getIDs().join(", ")} ] `:"";var v=b,r=n?G.selectedLine:" ",x=e.join(" ");if(t.$isTextNode(d)){var f=d.getTextContent(!0);var m=0===f.length?"(empty)":`"${M(f)}"`;f=[I(d),N(d),O(d)].filter(Boolean).join(", ");f=[m,0!==f.length?`{ ${f} }`:null].filter(Boolean).join(" ").trim()}else if(l.$isLinkNode(d)){f=d.getURL();f=
10
+ 0===f.length?"(empty)":`"${M(f)}"`;m=d.getTarget();null!=m&&(m="target: "+m);var y=Boolean;let u=d.getRel();null!=u&&(u="rel: "+u);m=[m,u].filter(y).join(", ");f=[f,0!==m.length?`{ ${m} }`:null].filter(Boolean).join(" ").trim()}else f="";b=v+`${r} ${x} ${g} ${h} ${w} ${f}\n`;b+=P({indent:e,isSelected:n,node:d,nodeKeyDisplay:g,selection:c,typeDisplay:h})});return null===c?": null":t.$isRangeSelection(c)?H(c):t.$isGridSelection(c)?`: grid\n \u2514 { grid: ${c.gridKey}, anchorCell: ${c.anchor.key}, focusCell: ${c.focus.key} }`:
11
+ `: node\n \u2514 [${Array.from(c._nodes).join(", ")}]`});return b+"\n selection"+a}function L(a,b,c=[]){a=a.getChildren();let d=a.length;a.forEach((e,g)=>{b(e,c.concat(g===d-1?G.isLastChild:G.hasNextSibling));t.$isElementNode(e)&&L(e,b,c.concat(g===d-1?G.ancestorIsLastChild:G.ancestorHasNextSibling))})}function M(a){return Object.entries(E).reduce((b,[c,d])=>b.replace(new RegExp(c,"g"),String(d)),a)}
12
+ let Q=[a=>a.hasFormat("bold")&&"Bold",a=>a.hasFormat("code")&&"Code",a=>a.hasFormat("italic")&&"Italic",a=>a.hasFormat("strikethrough")&&"Strikethrough",a=>a.hasFormat("subscript")&&"Subscript",a=>a.hasFormat("superscript")&&"Superscript",a=>a.hasFormat("underline")&&"Underline"],R=[a=>a.isDirectionless()&&"Directionless",a=>a.isUnmergeable()&&"Unmergeable"],S=[a=>a.isToken()&&"Token",a=>a.isSegmented()&&"Segmented",a=>a.isInert()&&"Inert"];
13
+ function N(a){let b=R.map(c=>c(a)).filter(Boolean).join(", ").toLocaleLowerCase();""!==b&&(b="detail: "+b);return b}function O(a){let b=S.map(c=>c(a)).filter(Boolean).join(", ").toLocaleLowerCase();""!==b&&(b="mode: "+b);return b}function I(a){let b=Q.map(c=>c(a)).filter(Boolean).join(", ").toLocaleLowerCase();""!==b&&(b="format: "+b);return b}
14
+ function P({indent:a,isSelected:b,node:c,nodeKeyDisplay:d,selection:e,typeDisplay:g}){if(!t.$isTextNode(c)||!t.$isRangeSelection(e)||!b||t.$isElementNode(c))return"";b=e.anchor;var h=e.focus;if(""===c.getTextContent()||b.getNode()===e.focus.getNode()&&b.offset===h.offset)return"";h=e.anchor;let n=e.focus,w=c.getTextContent(!0),v=w.length;b=e=-1;if("text"===h.type&&"text"===n.type){let f=h.getNode(),m=n.getNode();f===m&&c===f&&h.offset!==n.offset?[e,b]=h.offset<n.offset?[h.offset,n.offset]:[n.offset,
15
+ h.offset]:c===f?[e,b]=f.isBefore(m)?[h.offset,v]:[0,h.offset]:c===m?[e,b]=m.isBefore(f)?[n.offset,v]:[0,n.offset]:[e,b]=[0,v]}c=(w.slice(0,e).match(F)||[]).length;h=(w.slice(e,b).match(F)||[]).length;let [r,x]=[e+c,b+c+h];if(r===x)return"";c=a[a.length-1]===G.hasNextSibling?G.ancestorHasNextSibling:G.ancestorIsLastChild;a=[...a.slice(0,a.length-1),c];c=Array(r+1).fill(" ");e=Array(x-r).fill(G.selectedChar);d=Array(d.length+(g.length+3)).fill(" ");return[G.selectedLine,a.join(" "),[...d,...c,...e].join("")].join(" ")+
16
16
  "\n"}
17
- exports.TreeView=function({timeTravelButtonClassName:a,timeTravelPanelSliderClassName:b,timeTravelPanelButtonClassName:c,viewClassName:e,timeTravelPanelClassName:d,editor:f}){let [g,m]=r.useState([]),[v,u]=r.useState(""),[q,w]=r.useState(!1),k=r.useRef(0),t=r.useRef(null),B=r.useRef(null),[z,C]=r.useState(!1);r.useEffect(()=>{u(J(f.getEditorState()));return f.registerUpdateListener(({editorState:h})=>{let n=f._compositionKey,x=J(f.getEditorState());u([x,null!==n&&`Composition key: ${n}`].filter(Boolean).join("\n\n"));q||
18
- m(A=>[...A,[Date.now(),h]])})},[q,f]);let y=g.length;r.useEffect(()=>{if(z){let h,n=()=>{const x=k.current;x===y-1?C(!1):h=setTimeout(()=>{k.current++;const A=k.current,I=B.current;null!==I&&(I.value=String(A));f.setEditorState(g[A][1]);n()},g[x+1][0]-g[x][0])};n();return()=>{window.clearTimeout(h)}}},[g,z,f,y]);r.useEffect(()=>{let h=t.current;if(null!==h)return h.__lexicalEditor=f,()=>{h.__lexicalEditor=null}},[f]);return r.createElement("div",{className:e},!q&&2<y&&r.createElement("button",{onClick:()=>
19
- {let h=f.getRootElement();null!==h&&(h.contentEditable="false",k.current=y-1,w(!0))},className:a},"Time Travel"),r.createElement("pre",{ref:t},v),q&&r.createElement("div",{className:d},r.createElement("button",{className:c,onClick:()=>{C(!z)}},z?"Pause":"Play"),r.createElement("input",{className:b,ref:B,onChange:h=>{h=Number(h.target.value);let n=g[h];n&&(k.current=h,f.setEditorState(n[1]))},type:"range",min:"1",max:y-1}),r.createElement("button",{className:c,onClick:()=>{var h=f.getRootElement();
20
- if(null!==h){h.contentEditable="true";h=g.length-1;f.setEditorState(g[h][1]);let n=B.current;null!==n&&(n.value=String(h));w(!1);C(!1)}}},"Exit")))}
17
+ exports.TreeView=function({timeTravelButtonClassName:a,timeTravelPanelSliderClassName:b,timeTravelPanelButtonClassName:c,viewClassName:d,timeTravelPanelClassName:e,editor:g}){let [h,n]=D.useState([]),[w,v]=D.useState(""),[r,x]=D.useState(!1),f=D.useRef(0),m=D.useRef(null),y=D.useRef(null),[u,C]=D.useState(!1);D.useEffect(()=>{v(K(g.getEditorState()));return g.registerUpdateListener(({editorState:k})=>{let p=g._compositionKey,z=K(g.getEditorState());v([z,null!==p&&`Composition key: ${p}`].filter(Boolean).join("\n\n"));r||
18
+ n(B=>[...B,[Date.now(),k]])})},[r,g]);let A=h.length;D.useEffect(()=>{if(u){let k,p=()=>{const z=f.current;z===A-1?C(!1):k=setTimeout(()=>{f.current++;const B=f.current,J=y.current;null!==J&&(J.value=String(B));g.setEditorState(h[B][1]);p()},h[z+1][0]-h[z][0])};p();return()=>{clearTimeout(k)}}},[h,u,g,A]);D.useEffect(()=>{let k=m.current;if(null!==k)return k.__lexicalEditor=g,()=>{k.__lexicalEditor=null}},[g]);return D.createElement("div",{className:d},!r&&2<A&&D.createElement("button",{onClick:()=>
19
+ {let k=g.getRootElement();null!==k&&(k.contentEditable="false",f.current=A-1,x(!0))},className:a,type:"button"},"Time Travel"),D.createElement("pre",{ref:m},w),r&&D.createElement("div",{className:e},D.createElement("button",{className:c,onClick:()=>{C(!u)},type:"button"},u?"Pause":"Play"),D.createElement("input",{className:b,ref:y,onChange:k=>{k=Number(k.target.value);let p=h[k];p&&(f.current=k,g.setEditorState(p[1]))},type:"range",min:"1",max:A-1}),D.createElement("button",{className:c,onClick:()=>
20
+ {var k=g.getRootElement();if(null!==k){k.contentEditable="true";k=h.length-1;g.setEditorState(h[k][1]);let p=y.current;null!==p&&(p.value=String(k));x(!1);C(!1)}},type:"button"},"Exit")))}
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+ import { LexicalEditor, NodeKey, TextNode } from 'lexical';
9
+ import { MutableRefObject, ReactPortal } from 'react';
10
+ export declare type QueryMatch = {
11
+ leadOffset: number;
12
+ matchingString: string;
13
+ replaceableString: string;
14
+ };
15
+ export declare type Resolution = {
16
+ match: QueryMatch;
17
+ getRect: () => ClientRect;
18
+ };
19
+ export declare const PUNCTUATION = "\\.,\\+\\*\\?\\$\\@\\|#{}\\(\\)\\^\\-\\[\\]\\\\/!%'\"~=<>_:;";
20
+ export declare class TypeaheadOption {
21
+ key: string;
22
+ ref?: MutableRefObject<HTMLElement | null>;
23
+ constructor(key: string);
24
+ setRefElement(element: HTMLElement | null): void;
25
+ }
26
+ declare type MenuRenderFn<TOption extends TypeaheadOption> = (anchorElement: HTMLElement | null, itemProps: {
27
+ selectedIndex: number | null;
28
+ selectOptionAndCleanUp: (option: TOption) => void;
29
+ setHighlightedIndex: (index: number) => void;
30
+ }, matchingString: string) => ReactPortal | JSX.Element | null;
31
+ export declare function useBasicTypeaheadTriggerMatch(trigger: string, { minLength, maxLength }: {
32
+ minLength?: number;
33
+ maxLength?: number;
34
+ }): TriggerFn;
35
+ declare type TypeaheadMenuPluginArgs<TOption extends TypeaheadOption> = {
36
+ onQueryChange: (matchingString: string | null) => void;
37
+ onSelectOption: (option: TOption, textNodeContainingQuery: TextNode | null, closeMenu: () => void, matchingString: string) => void;
38
+ options: Array<TOption>;
39
+ menuRenderFn: MenuRenderFn<TOption>;
40
+ triggerFn: TriggerFn;
41
+ };
42
+ declare type TriggerFn = (text: string, editor: LexicalEditor) => QueryMatch | null;
43
+ export declare function LexicalTypeaheadMenuPlugin<TOption extends TypeaheadOption>({ options, onQueryChange, onSelectOption, menuRenderFn, triggerFn, }: TypeaheadMenuPluginArgs<TOption>): JSX.Element | null;
44
+ declare type NodeMenuPluginArgs<TOption extends TypeaheadOption> = {
45
+ onSelectOption: (option: TOption, textNodeContainingQuery: TextNode | null, closeMenu: () => void, matchingString: string) => void;
46
+ options: Array<TOption>;
47
+ nodeKey: NodeKey | null;
48
+ onClose: () => void;
49
+ menuRenderFn: MenuRenderFn<TOption>;
50
+ };
51
+ export declare function LexicalNodeMenuPlugin<TOption extends TypeaheadOption>({ options, nodeKey, onClose, onSelectOption, menuRenderFn, }: NodeMenuPluginArgs<TOption>): JSX.Element | null;
52
+ export {};