@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.
- package/ExtensionComponent.d.ts +42 -0
- package/LexicalAutoEmbedPlugin.dev.js +2 -0
- package/LexicalAutoEmbedPlugin.dev.mjs +2 -0
- package/LexicalAutoEmbedPlugin.prod.js +1 -1
- package/LexicalAutoEmbedPlugin.prod.mjs +1 -1
- package/LexicalAutoLinkPlugin.d.ts +2 -17
- package/LexicalAutoLinkPlugin.dev.js +7 -309
- package/LexicalAutoLinkPlugin.dev.mjs +9 -310
- package/LexicalAutoLinkPlugin.js.flow +4 -18
- package/LexicalAutoLinkPlugin.prod.js +1 -1
- package/LexicalAutoLinkPlugin.prod.mjs +1 -1
- package/LexicalClearEditorPlugin.dev.js +2 -23
- package/LexicalClearEditorPlugin.dev.mjs +2 -23
- package/LexicalClearEditorPlugin.prod.js +1 -1
- package/LexicalClearEditorPlugin.prod.mjs +1 -1
- package/LexicalClickableLinkPlugin.dev.js +5 -70
- package/LexicalClickableLinkPlugin.dev.mjs +6 -71
- package/LexicalClickableLinkPlugin.prod.js +1 -1
- package/LexicalClickableLinkPlugin.prod.mjs +1 -1
- package/LexicalCollaborationContext.prod.js +1 -1
- package/LexicalCollaborationContext.prod.mjs +1 -1
- package/LexicalCollaborationPlugin.dev.mjs +2 -2
- package/LexicalCollaborationPlugin.prod.mjs +1 -1
- package/LexicalContentEditable.dev.js +2 -3
- package/LexicalContentEditable.dev.mjs +2 -3
- package/LexicalContentEditable.prod.js +1 -1
- package/LexicalContentEditable.prod.mjs +1 -1
- package/LexicalContextMenuPlugin.dev.js +2 -0
- package/LexicalContextMenuPlugin.dev.mjs +4 -2
- package/LexicalContextMenuPlugin.prod.js +1 -1
- package/LexicalContextMenuPlugin.prod.mjs +1 -1
- package/LexicalDecoratorBlockNode.dev.js +1 -0
- package/LexicalDecoratorBlockNode.dev.mjs +1 -0
- package/LexicalDecoratorBlockNode.js.flow +7 -0
- package/LexicalDecoratorBlockNode.prod.js +1 -1
- package/LexicalDecoratorBlockNode.prod.mjs +1 -1
- package/LexicalDraggableBlockPlugin.dev.js +6 -0
- package/LexicalDraggableBlockPlugin.dev.mjs +6 -0
- package/LexicalDraggableBlockPlugin.prod.js +1 -1
- package/LexicalDraggableBlockPlugin.prod.mjs +1 -1
- package/LexicalExtensionComponent.dev.js +53 -0
- package/LexicalExtensionComponent.dev.mjs +51 -0
- package/LexicalExtensionComponent.js +11 -0
- package/LexicalExtensionComponent.js.flow +12 -0
- package/LexicalExtensionComponent.mjs +12 -0
- package/LexicalExtensionComponent.node.mjs +10 -0
- package/LexicalExtensionComponent.prod.js +9 -0
- package/LexicalExtensionComponent.prod.mjs +9 -0
- package/LexicalExtensionComposer.d.ts +69 -0
- package/LexicalExtensionComposer.dev.js +105 -0
- package/LexicalExtensionComposer.dev.mjs +103 -0
- package/LexicalExtensionComposer.js +11 -0
- package/LexicalExtensionComposer.js.flow +20 -0
- package/LexicalExtensionComposer.mjs +12 -0
- package/LexicalExtensionComposer.node.mjs +10 -0
- package/LexicalExtensionComposer.prod.js +9 -0
- package/LexicalExtensionComposer.prod.mjs +9 -0
- package/LexicalHashtagPlugin.dev.js +1 -136
- package/LexicalHashtagPlugin.dev.mjs +3 -138
- package/LexicalHashtagPlugin.prod.js +1 -1
- package/LexicalHashtagPlugin.prod.mjs +1 -1
- package/LexicalHorizontalRuleNode.d.ts +10 -11
- package/LexicalHorizontalRuleNode.dev.js +12 -26
- package/LexicalHorizontalRuleNode.dev.mjs +14 -27
- package/LexicalHorizontalRuleNode.js.flow +2 -3
- package/LexicalHorizontalRuleNode.prod.js +1 -1
- package/LexicalHorizontalRuleNode.prod.mjs +1 -1
- package/LexicalLinkPlugin.d.ts +1 -1
- package/LexicalLinkPlugin.dev.js +7 -52
- package/LexicalLinkPlugin.dev.mjs +8 -53
- package/LexicalLinkPlugin.prod.js +1 -1
- package/LexicalLinkPlugin.prod.mjs +1 -1
- package/LexicalListPlugin.js.flow +5 -0
- package/LexicalMarkdownShortcutPlugin.dev.mjs +1 -1
- package/LexicalMarkdownShortcutPlugin.prod.mjs +1 -1
- package/LexicalNestedComposer.js.flow +10 -6
- package/LexicalNodeContextMenuPlugin.dev.js +10 -0
- package/LexicalNodeContextMenuPlugin.dev.mjs +11 -1
- package/LexicalNodeContextMenuPlugin.prod.js +1 -1
- package/LexicalNodeContextMenuPlugin.prod.mjs +1 -1
- package/LexicalNodeMenuPlugin.dev.js +2 -0
- package/LexicalNodeMenuPlugin.dev.mjs +4 -2
- package/LexicalNodeMenuPlugin.prod.js +1 -1
- package/LexicalNodeMenuPlugin.prod.mjs +1 -1
- package/LexicalPlainTextPlugin.d.ts +1 -1
- package/LexicalPlainTextPlugin.dev.js +85 -30
- package/LexicalPlainTextPlugin.dev.mjs +85 -30
- package/LexicalPlainTextPlugin.prod.js +1 -1
- package/LexicalPlainTextPlugin.prod.mjs +1 -1
- package/LexicalReactExtension.dev.js +187 -0
- package/LexicalReactExtension.dev.mjs +184 -0
- package/LexicalReactExtension.js +11 -0
- package/LexicalReactExtension.js.flow +68 -0
- package/LexicalReactExtension.mjs +13 -0
- package/LexicalReactExtension.node.mjs +11 -0
- package/LexicalReactExtension.prod.js +9 -0
- package/LexicalReactExtension.prod.mjs +9 -0
- package/LexicalReactPluginHostExtension.dev.js +189 -0
- package/LexicalReactPluginHostExtension.dev.mjs +181 -0
- package/LexicalReactPluginHostExtension.js +11 -0
- package/LexicalReactPluginHostExtension.js.flow +84 -0
- package/LexicalReactPluginHostExtension.mjs +18 -0
- package/LexicalReactPluginHostExtension.node.mjs +16 -0
- package/LexicalReactPluginHostExtension.prod.js +9 -0
- package/LexicalReactPluginHostExtension.prod.mjs +9 -0
- package/LexicalReactProviderExtension.dev.js +33 -0
- package/LexicalReactProviderExtension.dev.mjs +31 -0
- package/LexicalReactProviderExtension.js +11 -0
- package/LexicalReactProviderExtension.js.flow +12 -0
- package/LexicalReactProviderExtension.mjs +12 -0
- package/LexicalReactProviderExtension.node.mjs +10 -0
- package/LexicalReactProviderExtension.prod.js +9 -0
- package/LexicalReactProviderExtension.prod.mjs +9 -0
- package/LexicalRichTextPlugin.d.ts +1 -1
- package/LexicalRichTextPlugin.dev.js +85 -30
- package/LexicalRichTextPlugin.dev.mjs +85 -30
- package/LexicalRichTextPlugin.prod.js +1 -1
- package/LexicalRichTextPlugin.prod.mjs +1 -1
- package/LexicalTabIndentationPlugin.d.ts +2 -2
- package/LexicalTabIndentationPlugin.dev.js +3 -57
- package/LexicalTabIndentationPlugin.dev.mjs +3 -56
- package/LexicalTabIndentationPlugin.prod.js +1 -1
- package/LexicalTabIndentationPlugin.prod.mjs +1 -1
- package/LexicalTreeViewExtension.dev.js +57 -0
- package/LexicalTreeViewExtension.dev.mjs +54 -0
- package/LexicalTreeViewExtension.js +11 -0
- package/LexicalTreeViewExtension.js.flow +12 -0
- package/LexicalTreeViewExtension.mjs +13 -0
- package/LexicalTreeViewExtension.node.mjs +11 -0
- package/LexicalTreeViewExtension.prod.js +9 -0
- package/LexicalTreeViewExtension.prod.mjs +9 -0
- package/LexicalTypeaheadMenuPlugin.dev.js +2 -0
- package/LexicalTypeaheadMenuPlugin.dev.mjs +4 -2
- package/LexicalTypeaheadMenuPlugin.prod.js +1 -1
- package/LexicalTypeaheadMenuPlugin.prod.mjs +1 -1
- package/ReactExtension.d.ts +41 -0
- package/ReactPluginHostExtension.d.ts +56 -0
- package/ReactProviderExtension.d.ts +9 -0
- package/TreeViewExtension.d.ts +18 -0
- package/package.json +228 -17
- package/shared/LegacyDecorators.d.ts +23 -0
- package/shared/buildEditorComponent.d.ts +11 -0
- package/shared/mergeRefs.d.ts +2 -1
- package/shared/types.d.ts +89 -0
- package/shared/useReactDecorators.d.ts +12 -0
- package/useExtensionComponent.d.ts +10 -0
- package/useLexicalExtensionComponent.dev.js +37 -0
- package/useLexicalExtensionComponent.dev.mjs +34 -0
- package/useLexicalExtensionComponent.js +11 -0
- package/useLexicalExtensionComponent.js.flow +12 -0
- package/useLexicalExtensionComponent.mjs +13 -0
- package/useLexicalExtensionComponent.node.mjs +11 -0
- package/useLexicalExtensionComponent.prod.js +9 -0
- 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 {
|
|
12
|
-
import {
|
|
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
|
-
|
|
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
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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
|
-
}),
|
|
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"),
|
|
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
|
|
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
|
|
9
|
-
export
|
|
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
|
|
38
|
+
export { TabIndentationPlugin };
|
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
"use strict";var e=require("@lexical/
|
|
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{
|
|
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};
|
|
@@ -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,
|
|
11
|
-
import React, { useLayoutEffect, useEffect,
|
|
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 = {
|