@lexical/react 0.35.1-nightly.20250924.0 → 0.36.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.
Files changed (154) hide show
  1. package/ExtensionComponent.d.ts +42 -0
  2. package/LexicalAutoEmbedPlugin.dev.js +2 -0
  3. package/LexicalAutoEmbedPlugin.dev.mjs +2 -0
  4. package/LexicalAutoEmbedPlugin.prod.js +1 -1
  5. package/LexicalAutoEmbedPlugin.prod.mjs +1 -1
  6. package/LexicalAutoLinkPlugin.d.ts +2 -17
  7. package/LexicalAutoLinkPlugin.dev.js +7 -309
  8. package/LexicalAutoLinkPlugin.dev.mjs +9 -310
  9. package/LexicalAutoLinkPlugin.js.flow +4 -18
  10. package/LexicalAutoLinkPlugin.prod.js +1 -1
  11. package/LexicalAutoLinkPlugin.prod.mjs +1 -1
  12. package/LexicalClearEditorPlugin.dev.js +2 -23
  13. package/LexicalClearEditorPlugin.dev.mjs +2 -23
  14. package/LexicalClearEditorPlugin.prod.js +1 -1
  15. package/LexicalClearEditorPlugin.prod.mjs +1 -1
  16. package/LexicalClickableLinkPlugin.dev.js +5 -70
  17. package/LexicalClickableLinkPlugin.dev.mjs +6 -71
  18. package/LexicalClickableLinkPlugin.prod.js +1 -1
  19. package/LexicalClickableLinkPlugin.prod.mjs +1 -1
  20. package/LexicalCollaborationContext.prod.js +1 -1
  21. package/LexicalCollaborationContext.prod.mjs +1 -1
  22. package/LexicalCollaborationPlugin.dev.mjs +2 -2
  23. package/LexicalCollaborationPlugin.prod.mjs +1 -1
  24. package/LexicalContentEditable.dev.js +2 -3
  25. package/LexicalContentEditable.dev.mjs +2 -3
  26. package/LexicalContentEditable.prod.js +1 -1
  27. package/LexicalContentEditable.prod.mjs +1 -1
  28. package/LexicalContextMenuPlugin.dev.js +2 -0
  29. package/LexicalContextMenuPlugin.dev.mjs +4 -2
  30. package/LexicalContextMenuPlugin.prod.js +1 -1
  31. package/LexicalContextMenuPlugin.prod.mjs +1 -1
  32. package/LexicalDecoratorBlockNode.dev.js +1 -0
  33. package/LexicalDecoratorBlockNode.dev.mjs +1 -0
  34. package/LexicalDecoratorBlockNode.js.flow +7 -0
  35. package/LexicalDecoratorBlockNode.prod.js +1 -1
  36. package/LexicalDecoratorBlockNode.prod.mjs +1 -1
  37. package/LexicalDraggableBlockPlugin.dev.js +6 -0
  38. package/LexicalDraggableBlockPlugin.dev.mjs +6 -0
  39. package/LexicalDraggableBlockPlugin.prod.js +1 -1
  40. package/LexicalDraggableBlockPlugin.prod.mjs +1 -1
  41. package/LexicalExtensionComponent.dev.js +53 -0
  42. package/LexicalExtensionComponent.dev.mjs +51 -0
  43. package/LexicalExtensionComponent.js +11 -0
  44. package/LexicalExtensionComponent.js.flow +12 -0
  45. package/LexicalExtensionComponent.mjs +12 -0
  46. package/LexicalExtensionComponent.node.mjs +10 -0
  47. package/LexicalExtensionComponent.prod.js +9 -0
  48. package/LexicalExtensionComponent.prod.mjs +9 -0
  49. package/LexicalExtensionComposer.d.ts +69 -0
  50. package/LexicalExtensionComposer.dev.js +105 -0
  51. package/LexicalExtensionComposer.dev.mjs +103 -0
  52. package/LexicalExtensionComposer.js +11 -0
  53. package/LexicalExtensionComposer.js.flow +20 -0
  54. package/LexicalExtensionComposer.mjs +12 -0
  55. package/LexicalExtensionComposer.node.mjs +10 -0
  56. package/LexicalExtensionComposer.prod.js +9 -0
  57. package/LexicalExtensionComposer.prod.mjs +9 -0
  58. package/LexicalHashtagPlugin.dev.js +1 -136
  59. package/LexicalHashtagPlugin.dev.mjs +3 -138
  60. package/LexicalHashtagPlugin.prod.js +1 -1
  61. package/LexicalHashtagPlugin.prod.mjs +1 -1
  62. package/LexicalHorizontalRuleNode.d.ts +10 -11
  63. package/LexicalHorizontalRuleNode.dev.js +12 -26
  64. package/LexicalHorizontalRuleNode.dev.mjs +14 -27
  65. package/LexicalHorizontalRuleNode.js.flow +2 -3
  66. package/LexicalHorizontalRuleNode.prod.js +1 -1
  67. package/LexicalHorizontalRuleNode.prod.mjs +1 -1
  68. package/LexicalLinkPlugin.d.ts +1 -1
  69. package/LexicalLinkPlugin.dev.js +7 -52
  70. package/LexicalLinkPlugin.dev.mjs +8 -53
  71. package/LexicalLinkPlugin.prod.js +1 -1
  72. package/LexicalLinkPlugin.prod.mjs +1 -1
  73. package/LexicalListPlugin.js.flow +5 -0
  74. package/LexicalMarkdownShortcutPlugin.dev.mjs +1 -1
  75. package/LexicalMarkdownShortcutPlugin.prod.mjs +1 -1
  76. package/LexicalNestedComposer.js.flow +10 -6
  77. package/LexicalNodeContextMenuPlugin.dev.js +10 -0
  78. package/LexicalNodeContextMenuPlugin.dev.mjs +11 -1
  79. package/LexicalNodeContextMenuPlugin.prod.js +1 -1
  80. package/LexicalNodeContextMenuPlugin.prod.mjs +1 -1
  81. package/LexicalNodeMenuPlugin.dev.js +2 -0
  82. package/LexicalNodeMenuPlugin.dev.mjs +4 -2
  83. package/LexicalNodeMenuPlugin.prod.js +1 -1
  84. package/LexicalNodeMenuPlugin.prod.mjs +1 -1
  85. package/LexicalPlainTextPlugin.d.ts +1 -1
  86. package/LexicalPlainTextPlugin.dev.js +85 -30
  87. package/LexicalPlainTextPlugin.dev.mjs +85 -30
  88. package/LexicalPlainTextPlugin.prod.js +1 -1
  89. package/LexicalPlainTextPlugin.prod.mjs +1 -1
  90. package/LexicalReactExtension.dev.js +187 -0
  91. package/LexicalReactExtension.dev.mjs +184 -0
  92. package/LexicalReactExtension.js +11 -0
  93. package/LexicalReactExtension.js.flow +68 -0
  94. package/LexicalReactExtension.mjs +13 -0
  95. package/LexicalReactExtension.node.mjs +11 -0
  96. package/LexicalReactExtension.prod.js +9 -0
  97. package/LexicalReactExtension.prod.mjs +9 -0
  98. package/LexicalReactPluginHostExtension.dev.js +189 -0
  99. package/LexicalReactPluginHostExtension.dev.mjs +181 -0
  100. package/LexicalReactPluginHostExtension.js +11 -0
  101. package/LexicalReactPluginHostExtension.js.flow +84 -0
  102. package/LexicalReactPluginHostExtension.mjs +18 -0
  103. package/LexicalReactPluginHostExtension.node.mjs +16 -0
  104. package/LexicalReactPluginHostExtension.prod.js +9 -0
  105. package/LexicalReactPluginHostExtension.prod.mjs +9 -0
  106. package/LexicalReactProviderExtension.dev.js +33 -0
  107. package/LexicalReactProviderExtension.dev.mjs +31 -0
  108. package/LexicalReactProviderExtension.js +11 -0
  109. package/LexicalReactProviderExtension.js.flow +12 -0
  110. package/LexicalReactProviderExtension.mjs +12 -0
  111. package/LexicalReactProviderExtension.node.mjs +10 -0
  112. package/LexicalReactProviderExtension.prod.js +9 -0
  113. package/LexicalReactProviderExtension.prod.mjs +9 -0
  114. package/LexicalRichTextPlugin.d.ts +1 -1
  115. package/LexicalRichTextPlugin.dev.js +85 -30
  116. package/LexicalRichTextPlugin.dev.mjs +85 -30
  117. package/LexicalRichTextPlugin.prod.js +1 -1
  118. package/LexicalRichTextPlugin.prod.mjs +1 -1
  119. package/LexicalTabIndentationPlugin.d.ts +2 -2
  120. package/LexicalTabIndentationPlugin.dev.js +3 -57
  121. package/LexicalTabIndentationPlugin.dev.mjs +3 -56
  122. package/LexicalTabIndentationPlugin.prod.js +1 -1
  123. package/LexicalTabIndentationPlugin.prod.mjs +1 -1
  124. package/LexicalTreeViewExtension.dev.js +57 -0
  125. package/LexicalTreeViewExtension.dev.mjs +54 -0
  126. package/LexicalTreeViewExtension.js +11 -0
  127. package/LexicalTreeViewExtension.js.flow +12 -0
  128. package/LexicalTreeViewExtension.mjs +13 -0
  129. package/LexicalTreeViewExtension.node.mjs +11 -0
  130. package/LexicalTreeViewExtension.prod.js +9 -0
  131. package/LexicalTreeViewExtension.prod.mjs +9 -0
  132. package/LexicalTypeaheadMenuPlugin.dev.js +2 -0
  133. package/LexicalTypeaheadMenuPlugin.dev.mjs +4 -2
  134. package/LexicalTypeaheadMenuPlugin.prod.js +1 -1
  135. package/LexicalTypeaheadMenuPlugin.prod.mjs +1 -1
  136. package/ReactExtension.d.ts +41 -0
  137. package/ReactPluginHostExtension.d.ts +56 -0
  138. package/ReactProviderExtension.d.ts +9 -0
  139. package/TreeViewExtension.d.ts +18 -0
  140. package/package.json +228 -17
  141. package/shared/LegacyDecorators.d.ts +23 -0
  142. package/shared/buildEditorComponent.d.ts +11 -0
  143. package/shared/mergeRefs.d.ts +2 -1
  144. package/shared/types.d.ts +89 -0
  145. package/shared/useReactDecorators.d.ts +12 -0
  146. package/useExtensionComponent.d.ts +10 -0
  147. package/useLexicalExtensionComponent.dev.js +37 -0
  148. package/useLexicalExtensionComponent.dev.mjs +34 -0
  149. package/useLexicalExtensionComponent.js +11 -0
  150. package/useLexicalExtensionComponent.js.flow +12 -0
  151. package/useLexicalExtensionComponent.mjs +13 -0
  152. package/useLexicalExtensionComponent.node.mjs +11 -0
  153. package/useLexicalExtensionComponent.prod.js +9 -0
  154. package/useLexicalExtensionComponent.prod.mjs +9 -0
@@ -8,11 +8,13 @@
8
8
 
9
9
  import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
10
10
  import { useLexicalEditable } from '@lexical/react/useLexicalEditable';
11
- import { $canShowPlaceholderCurry } from '@lexical/text';
12
- import { mergeRegister } from '@lexical/utils';
11
+ import { LexicalBuilder } from '@lexical/extension';
12
+ import { ReactProviderExtension } from '@lexical/react/ReactProviderExtension';
13
13
  import { useLayoutEffect, useEffect, useState, useMemo, Suspense } from 'react';
14
14
  import { flushSync, createPortal } from 'react-dom';
15
15
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
16
+ import { $canShowPlaceholderCurry } from '@lexical/text';
17
+ import { mergeRegister } from '@lexical/utils';
16
18
  import { registerDragonSupport } from '@lexical/dragon';
17
19
  import { registerRichText } from '@lexical/rich-text';
18
20
 
@@ -24,7 +26,11 @@ import { registerRichText } from '@lexical/rich-text';
24
26
  *
25
27
  */
26
28
 
27
- const CAN_USE_DOM = typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined';
29
+ // Do not require this module directly! Use normal `invariant` calls.
30
+
31
+ function formatDevErrorMessage(message) {
32
+ throw new Error(message);
33
+ }
28
34
 
29
35
  /**
30
36
  * Copyright (c) Meta Platforms, Inc. and affiliates.
@@ -34,11 +40,7 @@ const CAN_USE_DOM = typeof window !== 'undefined' && typeof window.document !==
34
40
  *
35
41
  */
36
42
 
37
-
38
- // This workaround is no longer necessary in React 19,
39
- // but we currently support React >=17.x
40
- // https://github.com/facebook/react/pull/26395
41
- const useLayoutEffectImpl = CAN_USE_DOM ? useLayoutEffect : useEffect;
43
+ const CAN_USE_DOM = typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined';
42
44
 
43
45
  /**
44
46
  * Copyright (c) Meta Platforms, Inc. and affiliates.
@@ -48,26 +50,11 @@ const useLayoutEffectImpl = CAN_USE_DOM ? useLayoutEffect : useEffect;
48
50
  *
49
51
  */
50
52
 
51
- function canShowPlaceholderFromCurrentEditorState(editor) {
52
- const currentCanShowPlaceholder = editor.getEditorState().read($canShowPlaceholderCurry(editor.isComposing()));
53
- return currentCanShowPlaceholder;
54
- }
55
- function useCanShowPlaceholder(editor) {
56
- const [canShowPlaceholder, setCanShowPlaceholder] = useState(() => canShowPlaceholderFromCurrentEditorState(editor));
57
- useLayoutEffectImpl(() => {
58
- function resetCanShowPlaceholder() {
59
- const currentCanShowPlaceholder = canShowPlaceholderFromCurrentEditorState(editor);
60
- setCanShowPlaceholder(currentCanShowPlaceholder);
61
- }
62
- resetCanShowPlaceholder();
63
- return mergeRegister(editor.registerUpdateListener(() => {
64
- resetCanShowPlaceholder();
65
- }), editor.registerEditableListener(() => {
66
- resetCanShowPlaceholder();
67
- }));
68
- }, [editor]);
69
- return canShowPlaceholder;
70
- }
53
+
54
+ // This workaround is no longer necessary in React 19,
55
+ // but we currently support React >=17.x
56
+ // https://github.com/facebook/react/pull/26395
57
+ const useLayoutEffectImpl = CAN_USE_DOM ? useLayoutEffect : useEffect;
71
58
 
72
59
  /**
73
60
  * Copyright (c) Meta Platforms, Inc. and affiliates.
@@ -117,6 +104,72 @@ function useDecorators(editor, ErrorBoundary) {
117
104
  }, [ErrorBoundary, decorators, editor]);
118
105
  }
119
106
 
107
+ function isUsingReactExtension(editor) {
108
+ const builder = LexicalBuilder.maybeFromEditor(editor);
109
+ if (builder && builder.hasExtensionByName(ReactProviderExtension.name)) {
110
+ for (const name of ['@lexical/plain-text', '@lexical/rich-text']) {
111
+ if (!!builder.hasExtensionByName(name)) {
112
+ formatDevErrorMessage(`LexicalBuilder: @lexical/react legacy text plugins conflict with the ${name} extension. Remove the legacy <RichTextPlugin/> or <PlainTextPlugin/> component.`);
113
+ }
114
+ }
115
+ return true;
116
+ }
117
+ return false;
118
+ }
119
+ function Decorators({
120
+ editor,
121
+ ErrorBoundary
122
+ }) {
123
+ return useDecorators(editor, ErrorBoundary);
124
+ }
125
+
126
+ /**
127
+ * @internal
128
+ *
129
+ * When using @lexical/extension, the ReactProvider is expected to handle
130
+ * rendering decorators. This component allows RichTextPlugin and
131
+ * PlainTextPlugin to be used in extension projects that have not yet
132
+ * migrated to use RichTextExtension or PlainTextExtension.
133
+ **/
134
+ function LegacyDecorators({
135
+ editor,
136
+ ErrorBoundary
137
+ }) {
138
+ return isUsingReactExtension(editor) ? null : /*#__PURE__*/jsx(Decorators, {
139
+ editor: editor,
140
+ ErrorBoundary: ErrorBoundary
141
+ });
142
+ }
143
+
144
+ /**
145
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
146
+ *
147
+ * This source code is licensed under the MIT license found in the
148
+ * LICENSE file in the root directory of this source tree.
149
+ *
150
+ */
151
+
152
+ function canShowPlaceholderFromCurrentEditorState(editor) {
153
+ const currentCanShowPlaceholder = editor.getEditorState().read($canShowPlaceholderCurry(editor.isComposing()));
154
+ return currentCanShowPlaceholder;
155
+ }
156
+ function useCanShowPlaceholder(editor) {
157
+ const [canShowPlaceholder, setCanShowPlaceholder] = useState(() => canShowPlaceholderFromCurrentEditorState(editor));
158
+ useLayoutEffectImpl(() => {
159
+ function resetCanShowPlaceholder() {
160
+ const currentCanShowPlaceholder = canShowPlaceholderFromCurrentEditorState(editor);
161
+ setCanShowPlaceholder(currentCanShowPlaceholder);
162
+ }
163
+ resetCanShowPlaceholder();
164
+ return mergeRegister(editor.registerUpdateListener(() => {
165
+ resetCanShowPlaceholder();
166
+ }), editor.registerEditableListener(() => {
167
+ resetCanShowPlaceholder();
168
+ }));
169
+ }, [editor]);
170
+ return canShowPlaceholder;
171
+ }
172
+
120
173
  /**
121
174
  * Copyright (c) Meta Platforms, Inc. and affiliates.
122
175
  *
@@ -149,12 +202,14 @@ function RichTextPlugin({
149
202
  ErrorBoundary
150
203
  }) {
151
204
  const [editor] = useLexicalComposerContext();
152
- const decorators = useDecorators(editor, ErrorBoundary);
153
205
  useRichTextSetup(editor);
154
206
  return /*#__PURE__*/jsxs(Fragment, {
155
207
  children: [contentEditable, /*#__PURE__*/jsx(Placeholder, {
156
208
  content: placeholder
157
- }), decorators]
209
+ }), /*#__PURE__*/jsx(LegacyDecorators, {
210
+ editor: editor,
211
+ ErrorBoundary: ErrorBoundary
212
+ })]
158
213
  });
159
214
  }
160
215
 
@@ -6,4 +6,4 @@
6
6
  *
7
7
  */
8
8
 
9
- "use strict";var e=require("@lexical/react/LexicalComposerContext"),t=require("@lexical/react/useLexicalEditable"),r=require("@lexical/text"),n=require("@lexical/utils"),o=require("react"),i=require("react-dom"),c=require("react/jsx-runtime"),u=require("@lexical/dragon"),s=require("@lexical/rich-text");const l="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?o.useLayoutEffect:o.useEffect;function a(e){return e.getEditorState().read(r.$canShowPlaceholderCurry(e.isComposing()))}function d({content:r}){const[i]=e.useLexicalComposerContext(),c=function(e){const[t,r]=o.useState((()=>a(e)));return l((()=>{function t(){const t=a(e);r(t)}return t(),n.mergeRegister(e.registerUpdateListener((()=>{t()})),e.registerEditableListener((()=>{t()})))}),[e]),t}(i),u=t.useLexicalEditable();return c?"function"==typeof r?r(u):r:null}exports.RichTextPlugin=function({contentEditable:t,placeholder:r=null,ErrorBoundary:a}){const[x]=e.useLexicalComposerContext(),f=function(e,t){const[r,n]=o.useState((()=>e.getDecorators()));return l((()=>e.registerDecoratorListener((e=>{i.flushSync((()=>{n(e)}))}))),[e]),o.useEffect((()=>{n(e.getDecorators())}),[e]),o.useMemo((()=>{const n=[],u=Object.keys(r);for(let s=0;s<u.length;s++){const l=u[s],a=c.jsx(t,{onError:t=>e._onError(t),children:c.jsx(o.Suspense,{fallback:null,children:r[l]})}),d=e.getElementByKey(l);null!==d&&n.push(i.createPortal(a,d,l))}return n}),[t,r,e])}(x,a);return function(e){l((()=>n.mergeRegister(s.registerRichText(e),u.registerDragonSupport(e))),[e])}(x),c.jsxs(c.Fragment,{children:[t,c.jsx(d,{content:r}),f]})};
9
+ "use strict";var e=require("@lexical/react/LexicalComposerContext"),r=require("@lexical/react/useLexicalEditable"),t=require("@lexical/extension"),n=require("@lexical/react/ReactProviderExtension"),o=require("react"),i=require("react-dom"),c=require("react/jsx-runtime"),a=require("@lexical/text"),s=require("@lexical/utils"),u=require("@lexical/dragon"),l=require("@lexical/rich-text");function d(e,...r){const t=new URL("https://lexical.dev/docs/error"),n=new URLSearchParams;n.append("code",e);for(const e of r)n.append("v",e);throw t.search=n.toString(),Error(`Minified Lexical error #${e}; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const x="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?o.useLayoutEffect:o.useEffect;function f({editor:e,ErrorBoundary:r}){return function(e,r){const[t,n]=o.useState((()=>e.getDecorators()));return x((()=>e.registerDecoratorListener((e=>{i.flushSync((()=>{n(e)}))}))),[e]),o.useEffect((()=>{n(e.getDecorators())}),[e]),o.useMemo((()=>{const n=[],a=Object.keys(t);for(let s=0;s<a.length;s++){const u=a[s],l=c.jsx(r,{onError:r=>e._onError(r),children:c.jsx(o.Suspense,{fallback:null,children:t[u]})}),d=e.getElementByKey(u);null!==d&&n.push(i.createPortal(l,d,u))}return n}),[r,t,e])}(e,r)}function g({editor:e,ErrorBoundary:r}){return function(e){const r=t.LexicalBuilder.maybeFromEditor(e);if(r&&r.hasExtensionByName(n.ReactProviderExtension.name)){for(const e of["@lexical/plain-text","@lexical/rich-text"])r.hasExtensionByName(e)&&d(320,e);return!0}return!1}(e)?null:c.jsx(f,{editor:e,ErrorBoundary:r})}function m(e){return e.getEditorState().read(a.$canShowPlaceholderCurry(e.isComposing()))}function E({content:t}){const[n]=e.useLexicalComposerContext(),i=function(e){const[r,t]=o.useState((()=>m(e)));return x((()=>{function r(){const r=m(e);t(r)}return r(),s.mergeRegister(e.registerUpdateListener((()=>{r()})),e.registerEditableListener((()=>{r()})))}),[e]),r}(n),c=r.useLexicalEditable();return i?"function"==typeof t?t(c):t:null}exports.RichTextPlugin=function({contentEditable:r,placeholder:t=null,ErrorBoundary:n}){const[o]=e.useLexicalComposerContext();return function(e){x((()=>s.mergeRegister(l.registerRichText(e),u.registerDragonSupport(e))),[e])}(o),c.jsxs(c.Fragment,{children:[r,c.jsx(E,{content:t}),c.jsx(g,{editor:o,ErrorBoundary:n})]})};
@@ -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{$canShowPlaceholderCurry as r}from"@lexical/text";import{mergeRegister as o}from"@lexical/utils";import{useLayoutEffect as n,useEffect as i,useState as c,useMemo as l,Suspense as a}from"react";import{flushSync as u,createPortal as m}from"react-dom";import{jsx as s,jsxs as d,Fragment as f}from"react/jsx-runtime";import{registerDragonSupport as p}from"@lexical/dragon";import{registerRichText as x}from"@lexical/rich-text";const g="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?n:i;function E(t){return t.getEditorState().read(r(t.isComposing()))}function h({contentEditable:e,placeholder:r=null,ErrorBoundary:n}){const[E]=t(),h=function(t,e){const[r,o]=c((()=>t.getDecorators()));return g((()=>t.registerDecoratorListener((t=>{u((()=>{o(t)}))}))),[t]),i((()=>{o(t.getDecorators())}),[t]),l((()=>{const o=[],n=Object.keys(r);for(let i=0;i<n.length;i++){const c=n[i],l=s(e,{onError:e=>t._onError(e),children:s(a,{fallback:null,children:r[c]})}),u=t.getElementByKey(c);null!==u&&o.push(m(l,u,c))}return o}),[e,r,t])}(E,n);return function(t){g((()=>o(x(t),p(t))),[t])}(E),d(f,{children:[e,s(w,{content:r}),h]})}function w({content:r}){const[n]=t(),i=function(t){const[e,r]=c((()=>E(t)));return g((()=>{function e(){const e=E(t);r(e)}return e(),o(t.registerUpdateListener((()=>{e()})),t.registerEditableListener((()=>{e()})))}),[t]),e}(n),l=e();return i?"function"==typeof r?r(l):r:null}export{h as RichTextPlugin};
9
+ import{useLexicalComposerContext as r}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as e}from"@lexical/react/useLexicalEditable";import{LexicalBuilder as t}from"@lexical/extension";import{ReactProviderExtension as o}from"@lexical/react/ReactProviderExtension";import{useLayoutEffect as n,useEffect as i,useState as c,useMemo as a,Suspense as l}from"react";import{flushSync as s,createPortal as u}from"react-dom";import{jsx as d,jsxs as f,Fragment as m}from"react/jsx-runtime";import{$canShowPlaceholderCurry as p}from"@lexical/text";import{mergeRegister as x}from"@lexical/utils";import{registerDragonSupport as E}from"@lexical/dragon";import{registerRichText as h}from"@lexical/rich-text";function g(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.`)}const y="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?n:i;function w({editor:r,ErrorBoundary:e}){return function(r,e){const[t,o]=c((()=>r.getDecorators()));return y((()=>r.registerDecoratorListener((r=>{s((()=>{o(r)}))}))),[r]),i((()=>{o(r.getDecorators())}),[r]),a((()=>{const o=[],n=Object.keys(t);for(let i=0;i<n.length;i++){const c=n[i],a=d(e,{onError:e=>r._onError(e),children:d(l,{fallback:null,children:t[c]})}),s=r.getElementByKey(c);null!==s&&o.push(u(a,s,c))}return o}),[e,t,r])}(r,e)}function v({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)&&g(320,r);return!0}return!1}(r)?null:d(w,{editor:r,ErrorBoundary:e})}function B(r){return r.getEditorState().read(p(r.isComposing()))}function L({contentEditable:e,placeholder:t=null,ErrorBoundary:o}){const[n]=r();return function(r){y((()=>x(h(r),E(r))),[r])}(n),f(m,{children:[e,d(b,{content:t}),d(v,{editor:n,ErrorBoundary:o})]})}function b({content:t}){const[o]=r(),n=function(r){const[e,t]=c((()=>B(r)));return y((()=>{function e(){const e=B(r);t(e)}return e(),x(r.registerUpdateListener((()=>{e()})),r.registerEditableListener((()=>{e()})))}),[r]),e}(o),i=e();return n?"function"==typeof t?t(i):t:null}export{L as RichTextPlugin};
@@ -5,8 +5,8 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
- import type { LexicalEditor } from 'lexical';
9
- export declare function registerTabIndentation(editor: LexicalEditor, maxIndent?: number): () => void;
8
+ import { registerTabIndentation } from '@lexical/extension';
9
+ export { registerTabIndentation };
10
10
  /**
11
11
  * This plugin adds the ability to indent content using the tab key. Generally, we don't
12
12
  * recommend using this plugin as it could negatively affect accessibility for keyboard
@@ -8,9 +8,8 @@
8
8
 
9
9
  'use strict';
10
10
 
11
+ var extension = require('@lexical/extension');
11
12
  var LexicalComposerContext = require('@lexical/react/LexicalComposerContext');
12
- var utils = require('@lexical/utils');
13
- var lexical = require('lexical');
14
13
  var react = require('react');
15
14
 
16
15
  /**
@@ -21,59 +20,6 @@ var react = require('react');
21
20
  *
22
21
  */
23
22
 
24
- function $indentOverTab(selection) {
25
- // const handled = new Set();
26
- const nodes = selection.getNodes();
27
- const canIndentBlockNodes = utils.$filter(nodes, node => {
28
- if (lexical.$isBlockElementNode(node) && node.canIndent()) {
29
- return node;
30
- }
31
- return null;
32
- });
33
- // 1. If selection spans across canIndent block nodes: indent
34
- if (canIndentBlockNodes.length > 0) {
35
- return true;
36
- }
37
- // 2. If first (anchor/focus) is at block start: indent
38
- const anchor = selection.anchor;
39
- const focus = selection.focus;
40
- const first = focus.isBefore(anchor) ? focus : anchor;
41
- const firstNode = first.getNode();
42
- const firstBlock = utils.$getNearestBlockElementAncestorOrThrow(firstNode);
43
- if (firstBlock.canIndent()) {
44
- const firstBlockKey = firstBlock.getKey();
45
- let selectionAtStart = lexical.$createRangeSelection();
46
- selectionAtStart.anchor.set(firstBlockKey, 0, 'element');
47
- selectionAtStart.focus.set(firstBlockKey, 0, 'element');
48
- selectionAtStart = lexical.$normalizeSelection__EXPERIMENTAL(selectionAtStart);
49
- if (selectionAtStart.anchor.is(first)) {
50
- return true;
51
- }
52
- }
53
- // 3. Else: tab
54
- return false;
55
- }
56
- function registerTabIndentation(editor, maxIndent) {
57
- return utils.mergeRegister(editor.registerCommand(lexical.KEY_TAB_COMMAND, event => {
58
- const selection = lexical.$getSelection();
59
- if (!lexical.$isRangeSelection(selection)) {
60
- return false;
61
- }
62
- event.preventDefault();
63
- const command = $indentOverTab(selection) ? event.shiftKey ? lexical.OUTDENT_CONTENT_COMMAND : lexical.INDENT_CONTENT_COMMAND : lexical.INSERT_TAB_COMMAND;
64
- return editor.dispatchCommand(command, undefined);
65
- }, lexical.COMMAND_PRIORITY_EDITOR), editor.registerCommand(lexical.INDENT_CONTENT_COMMAND, () => {
66
- if (maxIndent == null) {
67
- return false;
68
- }
69
- const selection = lexical.$getSelection();
70
- if (!lexical.$isRangeSelection(selection)) {
71
- return false;
72
- }
73
- const indents = selection.getNodes().map(node => utils.$getNearestBlockElementAncestorOrThrow(node).getIndent());
74
- return Math.max(...indents) + 1 >= maxIndent;
75
- }, lexical.COMMAND_PRIORITY_CRITICAL));
76
- }
77
23
 
78
24
  /**
79
25
  * This plugin adds the ability to indent content using the tab key. Generally, we don't
@@ -85,10 +31,10 @@ function TabIndentationPlugin({
85
31
  }) {
86
32
  const [editor] = LexicalComposerContext.useLexicalComposerContext();
87
33
  react.useEffect(() => {
88
- return registerTabIndentation(editor, maxIndent);
34
+ return extension.registerTabIndentation(editor, maxIndent);
89
35
  }, [editor, maxIndent]);
90
36
  return null;
91
37
  }
92
38
 
39
+ exports.registerTabIndentation = extension.registerTabIndentation;
93
40
  exports.TabIndentationPlugin = TabIndentationPlugin;
94
- exports.registerTabIndentation = registerTabIndentation;
@@ -6,9 +6,9 @@
6
6
  *
7
7
  */
8
8
 
9
+ import { registerTabIndentation } from '@lexical/extension';
10
+ export { registerTabIndentation } from '@lexical/extension';
9
11
  import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
10
- import { mergeRegister, $getNearestBlockElementAncestorOrThrow, $filter } from '@lexical/utils';
11
- import { KEY_TAB_COMMAND, $getSelection, $isRangeSelection, OUTDENT_CONTENT_COMMAND, INDENT_CONTENT_COMMAND, INSERT_TAB_COMMAND, COMMAND_PRIORITY_EDITOR, COMMAND_PRIORITY_CRITICAL, $isBlockElementNode, $createRangeSelection, $normalizeSelection__EXPERIMENTAL } from 'lexical';
12
12
  import { useEffect } from 'react';
13
13
 
14
14
  /**
@@ -19,59 +19,6 @@ import { useEffect } from 'react';
19
19
  *
20
20
  */
21
21
 
22
- function $indentOverTab(selection) {
23
- // const handled = new Set();
24
- const nodes = selection.getNodes();
25
- const canIndentBlockNodes = $filter(nodes, node => {
26
- if ($isBlockElementNode(node) && node.canIndent()) {
27
- return node;
28
- }
29
- return null;
30
- });
31
- // 1. If selection spans across canIndent block nodes: indent
32
- if (canIndentBlockNodes.length > 0) {
33
- return true;
34
- }
35
- // 2. If first (anchor/focus) is at block start: indent
36
- const anchor = selection.anchor;
37
- const focus = selection.focus;
38
- const first = focus.isBefore(anchor) ? focus : anchor;
39
- const firstNode = first.getNode();
40
- const firstBlock = $getNearestBlockElementAncestorOrThrow(firstNode);
41
- if (firstBlock.canIndent()) {
42
- const firstBlockKey = firstBlock.getKey();
43
- let selectionAtStart = $createRangeSelection();
44
- selectionAtStart.anchor.set(firstBlockKey, 0, 'element');
45
- selectionAtStart.focus.set(firstBlockKey, 0, 'element');
46
- selectionAtStart = $normalizeSelection__EXPERIMENTAL(selectionAtStart);
47
- if (selectionAtStart.anchor.is(first)) {
48
- return true;
49
- }
50
- }
51
- // 3. Else: tab
52
- return false;
53
- }
54
- function registerTabIndentation(editor, maxIndent) {
55
- return mergeRegister(editor.registerCommand(KEY_TAB_COMMAND, event => {
56
- const selection = $getSelection();
57
- if (!$isRangeSelection(selection)) {
58
- return false;
59
- }
60
- event.preventDefault();
61
- const command = $indentOverTab(selection) ? event.shiftKey ? OUTDENT_CONTENT_COMMAND : INDENT_CONTENT_COMMAND : INSERT_TAB_COMMAND;
62
- return editor.dispatchCommand(command, undefined);
63
- }, COMMAND_PRIORITY_EDITOR), editor.registerCommand(INDENT_CONTENT_COMMAND, () => {
64
- if (maxIndent == null) {
65
- return false;
66
- }
67
- const selection = $getSelection();
68
- if (!$isRangeSelection(selection)) {
69
- return false;
70
- }
71
- const indents = selection.getNodes().map(node => $getNearestBlockElementAncestorOrThrow(node).getIndent());
72
- return Math.max(...indents) + 1 >= maxIndent;
73
- }, COMMAND_PRIORITY_CRITICAL));
74
- }
75
22
 
76
23
  /**
77
24
  * This plugin adds the ability to indent content using the tab key. Generally, we don't
@@ -88,4 +35,4 @@ function TabIndentationPlugin({
88
35
  return null;
89
36
  }
90
37
 
91
- export { TabIndentationPlugin, registerTabIndentation };
38
+ export { TabIndentationPlugin };
@@ -6,4 +6,4 @@
6
6
  *
7
7
  */
8
8
 
9
- "use strict";var e=require("@lexical/react/LexicalComposerContext"),t=require("@lexical/utils"),n=require("lexical"),r=require("react");function o(e,r){return t.mergeRegister(e.registerCommand(n.KEY_TAB_COMMAND,(r=>{const o=n.$getSelection();if(!n.$isRangeSelection(o))return!1;r.preventDefault();const i=function(e){const r=e.getNodes();if(t.$filter(r,(e=>n.$isBlockElementNode(e)&&e.canIndent()?e:null)).length>0)return!0;const o=e.anchor,i=e.focus,c=i.isBefore(o)?i:o,s=c.getNode(),l=t.$getNearestBlockElementAncestorOrThrow(s);if(l.canIndent()){const e=l.getKey();let t=n.$createRangeSelection();if(t.anchor.set(e,0,"element"),t.focus.set(e,0,"element"),t=n.$normalizeSelection__EXPERIMENTAL(t),t.anchor.is(c))return!0}return!1}(o)?r.shiftKey?n.OUTDENT_CONTENT_COMMAND:n.INDENT_CONTENT_COMMAND:n.INSERT_TAB_COMMAND;return e.dispatchCommand(i,void 0)}),n.COMMAND_PRIORITY_EDITOR),e.registerCommand(n.INDENT_CONTENT_COMMAND,(()=>{if(null==r)return!1;const e=n.$getSelection();if(!n.$isRangeSelection(e))return!1;const o=e.getNodes().map((e=>t.$getNearestBlockElementAncestorOrThrow(e).getIndent()));return Math.max(...o)+1>=r}),n.COMMAND_PRIORITY_CRITICAL))}exports.TabIndentationPlugin=function({maxIndent:t}){const[n]=e.useLexicalComposerContext();return r.useEffect((()=>o(n,t)),[n,t]),null},exports.registerTabIndentation=o;
9
+ "use strict";var e=require("@lexical/extension"),t=require("@lexical/react/LexicalComposerContext"),n=require("react");exports.registerTabIndentation=e.registerTabIndentation,exports.TabIndentationPlugin=function({maxIndent:r}){const[i]=t.useLexicalComposerContext();return n.useEffect((()=>e.registerTabIndentation(i,r)),[i,r]),null};
@@ -6,4 +6,4 @@
6
6
  *
7
7
  */
8
8
 
9
- import{useLexicalComposerContext as t}from"@lexical/react/LexicalComposerContext";import{mergeRegister as e,$getNearestBlockElementAncestorOrThrow as n,$filter as r}from"@lexical/utils";import{KEY_TAB_COMMAND as o,$getSelection as c,$isRangeSelection as i,OUTDENT_CONTENT_COMMAND as s,INDENT_CONTENT_COMMAND as a,INSERT_TAB_COMMAND as m,COMMAND_PRIORITY_EDITOR as u,COMMAND_PRIORITY_CRITICAL as l,$isBlockElementNode as f,$createRangeSelection as d,$normalizeSelection__EXPERIMENTAL as p}from"lexical";import{useEffect as g}from"react";function x(t,g){return e(t.registerCommand(o,(e=>{const o=c();if(!i(o))return!1;e.preventDefault();const u=function(t){const e=t.getNodes();if(r(e,(t=>f(t)&&t.canIndent()?t:null)).length>0)return!0;const o=t.anchor,c=t.focus,i=c.isBefore(o)?c:o,s=i.getNode(),a=n(s);if(a.canIndent()){const t=a.getKey();let e=d();if(e.anchor.set(t,0,"element"),e.focus.set(t,0,"element"),e=p(e),e.anchor.is(i))return!0}return!1}(o)?e.shiftKey?s:a:m;return t.dispatchCommand(u,void 0)}),u),t.registerCommand(a,(()=>{if(null==g)return!1;const t=c();if(!i(t))return!1;const e=t.getNodes().map((t=>n(t).getIndent()));return Math.max(...e)+1>=g}),l))}function h({maxIndent:e}){const[n]=t();return g((()=>x(n,e)),[n,e]),null}export{h as TabIndentationPlugin,x as registerTabIndentation};
9
+ import{registerTabIndentation as e}from"@lexical/extension";export{registerTabIndentation}from"@lexical/extension";import{useLexicalComposerContext as t}from"@lexical/react/LexicalComposerContext";import{useEffect as o}from"react";function r({maxIndent:r}){const[n]=t();return o((()=>e(n,r)),[n,r]),null}export{r as TabIndentationPlugin};
@@ -0,0 +1,57 @@
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
+
9
+ 'use strict';
10
+
11
+ var LexicalComposerContext = require('@lexical/react/LexicalComposerContext');
12
+ var LexicalTreeView = require('@lexical/react/LexicalTreeView');
13
+ var ReactExtension = require('@lexical/react/ReactExtension');
14
+ var useExtensionComponent = require('@lexical/react/useExtensionComponent');
15
+ var lexical = require('lexical');
16
+ var jsxRuntime = require('react/jsx-runtime');
17
+
18
+ /**
19
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
20
+ *
21
+ * This source code is licensed under the MIT license found in the
22
+ * LICENSE file in the root directory of this source tree.
23
+ *
24
+ */
25
+
26
+ function TreeViewExtensionComponent(props) {
27
+ const [editor] = LexicalComposerContext.useLexicalComposerContext();
28
+ return /*#__PURE__*/jsxRuntime.jsx(LexicalTreeView.TreeView, {
29
+ editor: editor,
30
+ ...useExtensionComponent.useExtensionDependency(TreeViewExtension).config,
31
+ ...props
32
+ });
33
+ }
34
+ const config = {
35
+ timeTravelButtonClassName: 'debug-timetravel-button',
36
+ timeTravelPanelButtonClassName: 'debug-timetravel-panel-button',
37
+ timeTravelPanelClassName: 'debug-timetravel-panel',
38
+ timeTravelPanelSliderClassName: 'debug-timetravel-panel-slider',
39
+ treeTypeButtonClassName: 'debug-treetype-button',
40
+ viewClassName: 'tree-view-output'
41
+ };
42
+
43
+ /**
44
+ * Provides a configured TreeView debugging tool (React dependent)
45
+ * as an output component with configurable class names.
46
+ */
47
+ const TreeViewExtension = lexical.defineExtension({
48
+ build: () => ({
49
+ Component: TreeViewExtensionComponent
50
+ }),
51
+ config,
52
+ dependencies: [ReactExtension.ReactExtension],
53
+ name: '@lexical/react/TreeView'
54
+ });
55
+
56
+ exports.TreeViewExtension = TreeViewExtension;
57
+ exports.TreeViewExtensionComponent = TreeViewExtensionComponent;
@@ -0,0 +1,54 @@
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
+
9
+ import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
10
+ import { TreeView } from '@lexical/react/LexicalTreeView';
11
+ import { ReactExtension } from '@lexical/react/ReactExtension';
12
+ import { useExtensionDependency } from '@lexical/react/useExtensionComponent';
13
+ import { defineExtension } from 'lexical';
14
+ import { jsx } from 'react/jsx-runtime';
15
+
16
+ /**
17
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
18
+ *
19
+ * This source code is licensed under the MIT license found in the
20
+ * LICENSE file in the root directory of this source tree.
21
+ *
22
+ */
23
+
24
+ function TreeViewExtensionComponent(props) {
25
+ const [editor] = useLexicalComposerContext();
26
+ return /*#__PURE__*/jsx(TreeView, {
27
+ editor: editor,
28
+ ...useExtensionDependency(TreeViewExtension).config,
29
+ ...props
30
+ });
31
+ }
32
+ const config = {
33
+ timeTravelButtonClassName: 'debug-timetravel-button',
34
+ timeTravelPanelButtonClassName: 'debug-timetravel-panel-button',
35
+ timeTravelPanelClassName: 'debug-timetravel-panel',
36
+ timeTravelPanelSliderClassName: 'debug-timetravel-panel-slider',
37
+ treeTypeButtonClassName: 'debug-treetype-button',
38
+ viewClassName: 'tree-view-output'
39
+ };
40
+
41
+ /**
42
+ * Provides a configured TreeView debugging tool (React dependent)
43
+ * as an output component with configurable class names.
44
+ */
45
+ const TreeViewExtension = defineExtension({
46
+ build: () => ({
47
+ Component: TreeViewExtensionComponent
48
+ }),
49
+ config,
50
+ dependencies: [ReactExtension],
51
+ name: '@lexical/react/TreeView'
52
+ });
53
+
54
+ export { TreeViewExtension, TreeViewExtensionComponent };
@@ -0,0 +1,11 @@
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
+
9
+ 'use strict'
10
+ const LexicalTreeViewExtension = process.env.NODE_ENV !== 'production' ? require('./LexicalTreeViewExtension.dev.js') : require('./LexicalTreeViewExtension.prod.js');
11
+ module.exports = LexicalTreeViewExtension;
@@ -0,0 +1,12 @@
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
+ * @flow strict
8
+ */
9
+
10
+ /**
11
+ * LexicalTreeViewExtension
12
+ */
@@ -0,0 +1,13 @@
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
+
9
+ import * as modDev from './LexicalTreeViewExtension.dev.mjs';
10
+ import * as modProd from './LexicalTreeViewExtension.prod.mjs';
11
+ const mod = process.env.NODE_ENV !== 'production' ? modDev : modProd;
12
+ export const TreeViewExtension = mod.TreeViewExtension;
13
+ export const TreeViewExtensionComponent = mod.TreeViewExtensionComponent;
@@ -0,0 +1,11 @@
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
+
9
+ const mod = await (process.env.NODE_ENV !== 'production' ? import('./LexicalTreeViewExtension.dev.mjs') : import('./LexicalTreeViewExtension.prod.mjs'));
10
+ export const TreeViewExtension = mod.TreeViewExtension;
11
+ export const TreeViewExtensionComponent = mod.TreeViewExtensionComponent;
@@ -0,0 +1,9 @@
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
+
9
+ "use strict";var e=require("@lexical/react/LexicalComposerContext"),t=require("@lexical/react/LexicalTreeView"),i=require("@lexical/react/ReactExtension"),n=require("@lexical/react/useExtensionComponent"),r=require("lexical"),a=require("react/jsx-runtime");function l(i){const[r]=e.useLexicalComposerContext();return a.jsx(t.TreeView,{editor:r,...n.useExtensionDependency(o).config,...i})}const o=r.defineExtension({build:()=>({Component:l}),config:{timeTravelButtonClassName:"debug-timetravel-button",timeTravelPanelButtonClassName:"debug-timetravel-panel-button",timeTravelPanelClassName:"debug-timetravel-panel",timeTravelPanelSliderClassName:"debug-timetravel-panel-slider",treeTypeButtonClassName:"debug-treetype-button",viewClassName:"tree-view-output"},dependencies:[i.ReactExtension],name:"@lexical/react/TreeView"});exports.TreeViewExtension=o,exports.TreeViewExtensionComponent=l;
@@ -0,0 +1,9 @@
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
+
9
+ import{useLexicalComposerContext as e}from"@lexical/react/LexicalComposerContext";import{TreeView as t}from"@lexical/react/LexicalTreeView";import{ReactExtension as a}from"@lexical/react/ReactExtension";import{useExtensionDependency as r}from"@lexical/react/useExtensionComponent";import{defineExtension as i}from"lexical";import{jsx as l}from"react/jsx-runtime";function o(a){const[i]=e();return l(t,{editor:i,...r(n).config,...a})}const n=i({build:()=>({Component:o}),config:{timeTravelButtonClassName:"debug-timetravel-button",timeTravelPanelButtonClassName:"debug-timetravel-panel-button",timeTravelPanelClassName:"debug-timetravel-panel",timeTravelPanelSliderClassName:"debug-timetravel-panel-slider",treeTypeButtonClassName:"debug-treetype-button",viewClassName:"tree-view-output"},dependencies:[a],name:"@lexical/react/TreeView"});export{n as TreeViewExtension,o as TreeViewExtensionComponent};
@@ -68,6 +68,8 @@ const useLayoutEffectImpl = CAN_USE_DOM ? React.useLayoutEffect : React.useEffec
68
68
  */
69
69
 
70
70
  class MenuOption {
71
+ key;
72
+ ref;
71
73
  constructor(key) {
72
74
  this.key = key;
73
75
  this.ref = {
@@ -7,8 +7,8 @@
7
7
  */
8
8
 
9
9
  import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
10
- import { createCommand, KEY_ARROW_DOWN_COMMAND, KEY_ARROW_UP_COMMAND, KEY_ESCAPE_COMMAND, KEY_TAB_COMMAND, KEY_ENTER_COMMAND, COMMAND_PRIORITY_LOW, $getSelection, $isRangeSelection, getDOMSelection, $isTextNode } from 'lexical';
11
- import React, { useLayoutEffect, useEffect, useState, useCallback, useMemo, useRef } from 'react';
10
+ import { createCommand, COMMAND_PRIORITY_LOW, KEY_ARROW_DOWN_COMMAND, KEY_ARROW_UP_COMMAND, KEY_ESCAPE_COMMAND, KEY_TAB_COMMAND, KEY_ENTER_COMMAND, $getSelection, $isRangeSelection, $isTextNode, getDOMSelection } from 'lexical';
11
+ import React, { useLayoutEffect, useEffect, useRef, useCallback, useState, useMemo } from 'react';
12
12
  import { mergeRegister } from '@lexical/utils';
13
13
  import { jsx } from 'react/jsx-runtime';
14
14
 
@@ -66,6 +66,8 @@ const useLayoutEffectImpl = CAN_USE_DOM ? useLayoutEffect : useEffect;
66
66
  */
67
67
 
68
68
  class MenuOption {
69
+ key;
70
+ ref;
69
71
  constructor(key) {
70
72
  this.key = key;
71
73
  this.ref = {