@lexical/react 0.2.8 → 0.3.1
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/DEPRECATED_useLexical.dev.js +55 -4
- package/DEPRECATED_useLexical.js.flow +23 -0
- package/DEPRECATED_useLexical.prod.js +3 -1
- package/DEPRECATED_useLexicalAutoFormatter.dev.js +1 -2
- package/DEPRECATED_useLexicalAutoFormatter.js.flow +12 -0
- package/DEPRECATED_useLexicalAutoFormatter.prod.js +1 -1
- package/DEPRECATED_useLexicalCanShowPlaceholder.dev.js +6 -8
- package/DEPRECATED_useLexicalCanShowPlaceholder.js.flow +12 -0
- package/DEPRECATED_useLexicalCanShowPlaceholder.prod.js +2 -1
- package/DEPRECATED_useLexicalCharacterLimit.dev.js +5 -3
- package/DEPRECATED_useLexicalCharacterLimit.js.flow +28 -0
- package/DEPRECATED_useLexicalCharacterLimit.prod.js +6 -6
- package/DEPRECATED_useLexicalDecorators.dev.js +7 -5
- package/DEPRECATED_useLexicalDecorators.js.flow +14 -0
- package/DEPRECATED_useLexicalDecorators.prod.js +2 -2
- package/DEPRECATED_useLexicalEditor.dev.js +55 -3
- package/DEPRECATED_useLexicalEditor.prod.js +2 -1
- package/DEPRECATED_useLexicalEditorEvents.dev.js +1 -5
- package/DEPRECATED_useLexicalEditorEvents.js.flow +19 -0
- package/DEPRECATED_useLexicalEditorEvents.prod.js +2 -2
- package/DEPRECATED_useLexicalHistory.dev.js +0 -2
- package/DEPRECATED_useLexicalHistory.js.flow +31 -0
- package/DEPRECATED_useLexicalHistory.prod.js +1 -1
- package/DEPRECATED_useLexicalList.dev.js +3 -5
- package/DEPRECATED_useLexicalList.js.flow +10 -0
- package/DEPRECATED_useLexicalList.prod.js +2 -2
- package/DEPRECATED_useLexicalPlainText.dev.js +1 -7
- package/DEPRECATED_useLexicalPlainText.js.flow +15 -0
- package/DEPRECATED_useLexicalPlainText.prod.js +2 -2
- package/DEPRECATED_useLexicalRichText.dev.js +1 -7
- package/DEPRECATED_useLexicalRichText.js.flow +15 -0
- package/DEPRECATED_useLexicalRichText.prod.js +2 -2
- package/LexicalAutoFocusPlugin.d.ts +1 -1
- package/LexicalAutoFocusPlugin.dev.js +17 -4
- package/LexicalAutoFocusPlugin.js.flow +1 -1
- package/LexicalAutoFocusPlugin.prod.js +1 -1
- package/LexicalAutoLinkPlugin.d.ts +1 -1
- package/LexicalAutoLinkPlugin.dev.js +4 -5
- package/LexicalAutoLinkPlugin.js.flow +2 -1
- package/LexicalAutoLinkPlugin.prod.js +5 -5
- package/LexicalAutoScrollPlugin.d.ts +1 -1
- package/LexicalAutoScrollPlugin.dev.js +2 -5
- package/LexicalAutoScrollPlugin.js.flow +1 -3
- package/LexicalAutoScrollPlugin.prod.js +2 -2
- package/LexicalBlockWithAlignableContents.d.ts +1 -3
- package/LexicalBlockWithAlignableContents.dev.js +7 -9
- package/LexicalBlockWithAlignableContents.prod.js +4 -4
- package/LexicalCharacterLimitPlugin.d.ts +1 -1
- package/LexicalCharacterLimitPlugin.dev.js +6 -5
- package/LexicalCharacterLimitPlugin.js.flow +1 -1
- package/LexicalCharacterLimitPlugin.prod.js +8 -8
- package/LexicalCheckListPlugin.d.ts +1 -1
- package/LexicalCheckListPlugin.dev.js +9 -17
- package/LexicalCheckListPlugin.js.flow +1 -1
- package/LexicalCheckListPlugin.prod.js +7 -7
- package/LexicalClearEditorPlugin.d.ts +2 -6
- package/LexicalClearEditorPlugin.dev.js +2 -5
- package/LexicalClearEditorPlugin.js.flow +1 -1
- package/LexicalClearEditorPlugin.prod.js +2 -2
- package/LexicalCollaborationPlugin.d.ts +1 -0
- package/LexicalCollaborationPlugin.dev.js +9 -5
- package/LexicalCollaborationPlugin.prod.js +9 -9
- package/LexicalComposer.d.ts +2 -2
- package/LexicalComposer.dev.js +1 -6
- package/LexicalComposer.js.flow +1 -1
- package/LexicalComposer.prod.js +2 -2
- package/LexicalComposerContext.dev.js +0 -1
- package/LexicalComposerContext.prod.js +1 -1
- package/LexicalContentEditable.d.ts +2 -5
- package/LexicalContentEditable.dev.js +5 -7
- package/LexicalContentEditable.js.flow +1 -3
- package/LexicalContentEditable.prod.js +3 -3
- package/LexicalDecoratorBlockNode.d.ts +11 -2
- package/LexicalDecoratorBlockNode.dev.js +8 -1
- package/LexicalDecoratorBlockNode.prod.js +1 -1
- package/LexicalHashtagPlugin.d.ts +1 -1
- package/LexicalHashtagPlugin.dev.js +2 -3
- package/LexicalHashtagPlugin.js.flow +1 -1
- package/LexicalHashtagPlugin.prod.js +3 -3
- package/LexicalHistoryPlugin.d.ts +1 -0
- package/LexicalHistoryPlugin.dev.js +0 -2
- package/LexicalHistoryPlugin.prod.js +1 -1
- package/LexicalHorizontalRuleNode.d.ts +1 -1
- package/LexicalHorizontalRuleNode.dev.js +5 -17
- package/LexicalHorizontalRuleNode.prod.js +3 -3
- package/LexicalLinkPlugin.d.ts +1 -1
- package/LexicalLinkPlugin.dev.js +3 -107
- package/LexicalLinkPlugin.js.flow +1 -1
- package/LexicalLinkPlugin.prod.js +1 -4
- package/LexicalListPlugin.d.ts +1 -1
- package/LexicalListPlugin.dev.js +9 -6
- package/LexicalListPlugin.js.flow +1 -1
- package/LexicalListPlugin.prod.js +3 -3
- package/LexicalMarkdownShortcutPlugin.d.ts +2 -2
- package/LexicalMarkdownShortcutPlugin.dev.js +7 -83
- package/LexicalMarkdownShortcutPlugin.js.flow +2 -2
- package/LexicalMarkdownShortcutPlugin.prod.js +2 -3
- package/LexicalNestedComposer.d.ts +1 -1
- package/LexicalNestedComposer.dev.js +1 -2
- package/LexicalNestedComposer.js.flow +1 -1
- package/LexicalNestedComposer.prod.js +3 -3
- package/LexicalOnChangePlugin.d.ts +2 -1
- package/LexicalOnChangePlugin.dev.js +1 -4
- package/LexicalOnChangePlugin.js.flow +1 -1
- package/LexicalOnChangePlugin.prod.js +2 -2
- package/LexicalPlainTextPlugin.d.ts +3 -2
- package/LexicalPlainTextPlugin.dev.js +12 -10
- package/LexicalPlainTextPlugin.js.flow +1 -1
- package/LexicalPlainTextPlugin.prod.js +4 -4
- package/LexicalRichTextPlugin.d.ts +3 -2
- package/LexicalRichTextPlugin.dev.js +12 -10
- package/LexicalRichTextPlugin.js.flow +1 -1
- package/LexicalRichTextPlugin.prod.js +4 -4
- package/LexicalTablePlugin.d.ts +1 -1
- package/LexicalTablePlugin.dev.js +7 -8
- package/LexicalTablePlugin.js.flow +1 -1
- package/LexicalTablePlugin.prod.js +4 -4
- package/LexicalTreeView.d.ts +2 -1
- package/LexicalTreeView.dev.js +4 -5
- package/LexicalTreeView.js.flow +1 -1
- package/LexicalTreeView.prod.js +11 -11
- package/README.md +10 -6
- package/package.json +19 -19
- package/useLexicalIsTextContentEmpty.d.ts +2 -1
- package/useLexicalIsTextContentEmpty.dev.js +2 -5
- package/useLexicalIsTextContentEmpty.js.flow +1 -1
- package/useLexicalIsTextContentEmpty.prod.js +1 -1
- package/useLexicalNodeSelection.d.ts +2 -1
- package/useLexicalNodeSelection.dev.js +1 -2
- package/useLexicalNodeSelection.js.flow +1 -1
- package/useLexicalNodeSelection.prod.js +2 -2
- package/useLexicalTextEntity.d.ts +2 -1
- package/useLexicalTextEntity.dev.js +1 -2
- package/useLexicalTextEntity.js.flow +1 -1
- package/useLexicalTextEntity.prod.js +1 -1
|
@@ -8,7 +8,60 @@
|
|
|
8
8
|
|
|
9
9
|
var lexical = require('lexical');
|
|
10
10
|
var react = require('react');
|
|
11
|
-
var
|
|
11
|
+
var text = require('@lexical/text');
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
15
|
+
*
|
|
16
|
+
* This source code is licensed under the MIT license found in the
|
|
17
|
+
* LICENSE file in the root directory of this source tree.
|
|
18
|
+
*
|
|
19
|
+
*/
|
|
20
|
+
const CAN_USE_DOM = typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined';
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
24
|
+
*
|
|
25
|
+
* This source code is licensed under the MIT license found in the
|
|
26
|
+
* LICENSE file in the root directory of this source tree.
|
|
27
|
+
*
|
|
28
|
+
*/
|
|
29
|
+
const useLayoutEffectImpl = CAN_USE_DOM ? react.useLayoutEffect : react.useEffect;
|
|
30
|
+
var useLayoutEffect = useLayoutEffectImpl;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
34
|
+
*
|
|
35
|
+
* This source code is licensed under the MIT license found in the
|
|
36
|
+
* LICENSE file in the root directory of this source tree.
|
|
37
|
+
*
|
|
38
|
+
*/
|
|
39
|
+
function useCanShowPlaceholder(editor) {
|
|
40
|
+
const [canShowPlaceholder, setCanShowPlaceholder] = react.useState(editor.getEditorState().read(text.$canShowPlaceholderCurry(editor.isComposing())));
|
|
41
|
+
useLayoutEffect(() => {
|
|
42
|
+
let currentCanShowPlaceholder = editor.getEditorState().read(text.$canShowPlaceholderCurry(editor.isComposing()));
|
|
43
|
+
setCanShowPlaceholder(currentCanShowPlaceholder);
|
|
44
|
+
return editor.registerUpdateListener(({
|
|
45
|
+
editorState
|
|
46
|
+
}) => {
|
|
47
|
+
const isComposing = editor.isComposing();
|
|
48
|
+
currentCanShowPlaceholder = editorState.read(text.$canShowPlaceholderCurry(isComposing));
|
|
49
|
+
setCanShowPlaceholder(currentCanShowPlaceholder);
|
|
50
|
+
});
|
|
51
|
+
}, [editor]);
|
|
52
|
+
return canShowPlaceholder;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
57
|
+
*
|
|
58
|
+
* This source code is licensed under the MIT license found in the
|
|
59
|
+
* LICENSE file in the root directory of this source tree.
|
|
60
|
+
*
|
|
61
|
+
*/
|
|
62
|
+
function useLexicalCanShowPlaceholder(editor) {
|
|
63
|
+
return useCanShowPlaceholder(editor);
|
|
64
|
+
}
|
|
12
65
|
|
|
13
66
|
/**
|
|
14
67
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
@@ -16,7 +69,6 @@ var useLexicalCanShowPlaceholder = require('@lexical/react/DEPRECATED_useLexical
|
|
|
16
69
|
* This source code is licensed under the MIT license found in the
|
|
17
70
|
* LICENSE file in the root directory of this source tree.
|
|
18
71
|
*
|
|
19
|
-
*
|
|
20
72
|
*/
|
|
21
73
|
function useLexicalEditor(editor) {
|
|
22
74
|
const showPlaceholder = useLexicalCanShowPlaceholder(editor);
|
|
@@ -32,7 +84,6 @@ function useLexicalEditor(editor) {
|
|
|
32
84
|
* This source code is licensed under the MIT license found in the
|
|
33
85
|
* LICENSE file in the root directory of this source tree.
|
|
34
86
|
*
|
|
35
|
-
*
|
|
36
87
|
*/
|
|
37
88
|
function useLexical(editorConfig) {
|
|
38
89
|
const editor = react.useMemo(() => lexical.createEditor(editorConfig), // Init
|
|
@@ -42,4 +93,4 @@ function useLexical(editorConfig) {
|
|
|
42
93
|
return [editor, rootElementRef, showPlaceholder];
|
|
43
94
|
}
|
|
44
95
|
|
|
45
|
-
|
|
96
|
+
exports.useLexical = useLexical;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* (c) Meta Platforms, Inc. and affiliates. Confidential and proprietary.
|
|
3
|
+
*
|
|
4
|
+
* @flow strict
|
|
5
|
+
* @format
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type {
|
|
9
|
+
EditorState,
|
|
10
|
+
EditorThemeClasses,
|
|
11
|
+
LexicalEditor,
|
|
12
|
+
LexicalNode,
|
|
13
|
+
} from 'lexical';
|
|
14
|
+
|
|
15
|
+
declare export function useLexical<EditorContext>(editorConfig?: {
|
|
16
|
+
namespace?: string,
|
|
17
|
+
onError: (error: Error) => void,
|
|
18
|
+
initialEditorState?: EditorState,
|
|
19
|
+
theme?: EditorThemeClasses,
|
|
20
|
+
context?: EditorContext,
|
|
21
|
+
nodes?: Array<Class<LexicalNode>>,
|
|
22
|
+
parentEditor?: LexicalEditor,
|
|
23
|
+
}): [LexicalEditor, (null | HTMLElement) => void, boolean];
|
|
@@ -4,4 +4,6 @@
|
|
|
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
|
-
var d=require("lexical"),
|
|
7
|
+
'use strict';var d=require("lexical"),f=require("react"),g=require("@lexical/text"),h="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement?f.useLayoutEffect:f.useEffect;
|
|
8
|
+
function k(a){let [b,c]=f.useState(a.getEditorState().read(g.$canShowPlaceholderCurry(a.isComposing())));h(()=>{let e=a.getEditorState().read(g.$canShowPlaceholderCurry(a.isComposing()));c(e);return a.registerUpdateListener(({editorState:l})=>{let m=a.isComposing();e=l.read(g.$canShowPlaceholderCurry(m));c(e)})},[a]);return b}function n(a){let b=k(a);return[f.useCallback(c=>{a.setRootElement(c)},[a]),b]}
|
|
9
|
+
exports.useLexical=function(a){let b=f.useMemo(()=>d.createEditor(a),[]),[c,e]=n(b);return[b,c,e]}
|
|
@@ -15,7 +15,6 @@ var react = require('react');
|
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
17
|
*
|
|
18
|
-
*
|
|
19
18
|
*/
|
|
20
19
|
function useLexicalAutoFormatter(editor) {
|
|
21
20
|
react.useEffect(() => {
|
|
@@ -23,4 +22,4 @@ function useLexicalAutoFormatter(editor) {
|
|
|
23
22
|
}, [editor]);
|
|
24
23
|
}
|
|
25
24
|
|
|
26
|
-
|
|
25
|
+
exports.useLexicalAutoFormatter = useLexicalAutoFormatter;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* (c) Meta Platforms, Inc. and affiliates. Confidential and proprietary.
|
|
3
|
+
*
|
|
4
|
+
* @flow strict
|
|
5
|
+
* @format
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type {LexicalEditor, TextNode} from 'lexical';
|
|
9
|
+
|
|
10
|
+
declare function updateTextNode(node: TextNode, count: number): void;
|
|
11
|
+
declare function textNodeTransform(node: TextNode): void;
|
|
12
|
+
declare export function useLexicalAutoFormatter(editor: LexicalEditor): void;
|
|
@@ -4,4 +4,4 @@
|
|
|
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
|
-
var a=require("@lexical/markdown"),c=require("react");
|
|
7
|
+
'use strict';var a=require("@lexical/markdown"),c=require("react");exports.useLexicalAutoFormatter=function(b){c.useEffect(()=>a.registerMarkdownShortcuts(b,a.TRANSFORMERS),[b])}
|
|
@@ -15,7 +15,6 @@ var react = require('react');
|
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
17
|
*
|
|
18
|
-
*
|
|
19
18
|
*/
|
|
20
19
|
const CAN_USE_DOM = typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined';
|
|
21
20
|
|
|
@@ -25,7 +24,6 @@ const CAN_USE_DOM = typeof window !== 'undefined' && typeof window.document !==
|
|
|
25
24
|
* This source code is licensed under the MIT license found in the
|
|
26
25
|
* LICENSE file in the root directory of this source tree.
|
|
27
26
|
*
|
|
28
|
-
*
|
|
29
27
|
*/
|
|
30
28
|
const useLayoutEffectImpl = CAN_USE_DOM ? react.useLayoutEffect : react.useEffect;
|
|
31
29
|
var useLayoutEffect = useLayoutEffectImpl;
|
|
@@ -36,16 +34,17 @@ var useLayoutEffect = useLayoutEffectImpl;
|
|
|
36
34
|
* This source code is licensed under the MIT license found in the
|
|
37
35
|
* LICENSE file in the root directory of this source tree.
|
|
38
36
|
*
|
|
39
|
-
*
|
|
40
37
|
*/
|
|
41
|
-
function
|
|
38
|
+
function useCanShowPlaceholder(editor) {
|
|
42
39
|
const [canShowPlaceholder, setCanShowPlaceholder] = react.useState(editor.getEditorState().read(text.$canShowPlaceholderCurry(editor.isComposing())));
|
|
43
40
|
useLayoutEffect(() => {
|
|
41
|
+
let currentCanShowPlaceholder = editor.getEditorState().read(text.$canShowPlaceholderCurry(editor.isComposing()));
|
|
42
|
+
setCanShowPlaceholder(currentCanShowPlaceholder);
|
|
44
43
|
return editor.registerUpdateListener(({
|
|
45
44
|
editorState
|
|
46
45
|
}) => {
|
|
47
46
|
const isComposing = editor.isComposing();
|
|
48
|
-
|
|
47
|
+
currentCanShowPlaceholder = editorState.read(text.$canShowPlaceholderCurry(isComposing));
|
|
49
48
|
setCanShowPlaceholder(currentCanShowPlaceholder);
|
|
50
49
|
});
|
|
51
50
|
}, [editor]);
|
|
@@ -58,10 +57,9 @@ function useLexicalCanShowPlaceholder$1(editor) {
|
|
|
58
57
|
* This source code is licensed under the MIT license found in the
|
|
59
58
|
* LICENSE file in the root directory of this source tree.
|
|
60
59
|
*
|
|
61
|
-
*
|
|
62
60
|
*/
|
|
63
61
|
function useLexicalCanShowPlaceholder(editor) {
|
|
64
|
-
return
|
|
62
|
+
return useCanShowPlaceholder(editor);
|
|
65
63
|
}
|
|
66
64
|
|
|
67
|
-
|
|
65
|
+
exports.useLexicalCanShowPlaceholder = useLexicalCanShowPlaceholder;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* (c) Meta Platforms, Inc. and affiliates. Confidential and proprietary.
|
|
3
|
+
*
|
|
4
|
+
* @flow strict
|
|
5
|
+
* @format
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type {LexicalEditor} from 'lexical';
|
|
9
|
+
|
|
10
|
+
declare export function useLexicalCanShowPlaceholder(
|
|
11
|
+
editor: LexicalEditor,
|
|
12
|
+
): boolean;
|
|
@@ -4,4 +4,5 @@
|
|
|
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
|
-
var b=require("@lexical/text"),
|
|
7
|
+
'use strict';var b=require("@lexical/text"),c=require("react"),f="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement?c.useLayoutEffect:c.useEffect;
|
|
8
|
+
function g(a){let [h,e]=c.useState(a.getEditorState().read(b.$canShowPlaceholderCurry(a.isComposing())));f(()=>{let d=a.getEditorState().read(b.$canShowPlaceholderCurry(a.isComposing()));e(d);return a.registerUpdateListener(({editorState:k})=>{let l=a.isComposing();d=k.read(b.$canShowPlaceholderCurry(l));e(d)})},[a]);return h}exports.useLexicalCanShowPlaceholder=function(a){return g(a)}
|
|
@@ -18,13 +18,14 @@ var react = require('react');
|
|
|
18
18
|
* This source code is licensed under the MIT license found in the
|
|
19
19
|
* LICENSE file in the root directory of this source tree.
|
|
20
20
|
*
|
|
21
|
-
*
|
|
22
21
|
*/
|
|
23
22
|
function useCharacterLimit(editor, maxCharacters, optional = Object.freeze({})) {
|
|
24
23
|
const {
|
|
25
24
|
strlen = input => input.length,
|
|
26
25
|
// UTF-16
|
|
27
|
-
remainingCharacters =
|
|
26
|
+
remainingCharacters = () => {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
28
29
|
} = optional;
|
|
29
30
|
react.useEffect(() => {
|
|
30
31
|
if (!editor.hasNodes([overflow.OverflowNode])) {
|
|
@@ -34,7 +35,7 @@ function useCharacterLimit(editor, maxCharacters, optional = Object.freeze({}))
|
|
|
34
35
|
}
|
|
35
36
|
}, [editor]);
|
|
36
37
|
react.useEffect(() => {
|
|
37
|
-
let text$1 = editor.getEditorState().read(text.$
|
|
38
|
+
let text$1 = editor.getEditorState().read(text.$rootTextContent);
|
|
38
39
|
let lastComputedTextLength = 0;
|
|
39
40
|
return utils.mergeRegister(editor.registerTextContentListener(currentText => {
|
|
40
41
|
text$1 = currentText;
|
|
@@ -68,6 +69,7 @@ function useCharacterLimit(editor, maxCharacters, optional = Object.freeze({}))
|
|
|
68
69
|
}
|
|
69
70
|
|
|
70
71
|
function findOffset(text, maxCharacters, strlen) {
|
|
72
|
+
// @ts-ignore This is due to be added in a later version of TS
|
|
71
73
|
const Segmenter = Intl.Segmenter;
|
|
72
74
|
let offsetUtf16 = 0;
|
|
73
75
|
let offset = 0;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* (c) Meta Platforms, Inc. and affiliates. Confidential and proprietary.
|
|
3
|
+
*
|
|
4
|
+
* @flow strict
|
|
5
|
+
* @format
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type {LexicalEditor, LexicalNode} from 'lexical';
|
|
9
|
+
import type {OverflowNode} from '@lexical/overflow';
|
|
10
|
+
|
|
11
|
+
type OptionalProps = {
|
|
12
|
+
strlen?: (input: string) => number,
|
|
13
|
+
remainingCharacters?: (characters: number) => void,
|
|
14
|
+
};
|
|
15
|
+
declare export function useCharacterLimit(
|
|
16
|
+
editor: LexicalEditor,
|
|
17
|
+
maxCharacters: number,
|
|
18
|
+
optional: OptionalProps,
|
|
19
|
+
): void;
|
|
20
|
+
declare function findOffset(
|
|
21
|
+
text: string,
|
|
22
|
+
maxCharacters: number,
|
|
23
|
+
strlen: (input: string) => number,
|
|
24
|
+
): number;
|
|
25
|
+
declare function $wrapOverflowedNodes(offset: number): void;
|
|
26
|
+
declare function $wrapNode(node: LexicalNode): OverflowNode;
|
|
27
|
+
declare function $unwrapNode(node: OverflowNode): LexicalNode | null;
|
|
28
|
+
declare export function mergePrevious(overflowNode: OverflowNode): void;
|
|
@@ -4,10 +4,10 @@
|
|
|
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
|
-
var k=require("@lexical/overflow"),q=require("@lexical/text"),w=require("@lexical/utils"),x=require("lexical"),y=require("react");function z(a,d,f){var e=Intl.Segmenter;let m=0;var c=0;if("function"===typeof e){a=(new e).segment(a);for(var {segment:g}of a){c+=f(g);if(c>d)break;m+=g.length}}else for(g=Array.from(a),a=g.length,e=0;e<a;e++){
|
|
8
|
-
function C(a){
|
|
9
|
-
function D(a){
|
|
7
|
+
'use strict';var k=require("@lexical/overflow"),q=require("@lexical/text"),w=require("@lexical/utils"),x=require("lexical"),y=require("react");function z(a,d,f){var e=Intl.Segmenter;let m=0;var c=0;if("function"===typeof e){a=(new e).segment(a);for(var {segment:g}of a){c+=f(g);if(c>d)break;m+=g.length}}else for(g=Array.from(a),a=g.length,e=0;e<a;e++){let n=g[e];c+=f(n);if(c>d)break;m+=n.length}return m}function A(a){let d=k.$createOverflowNode();a.insertBefore(d);d.append(a);return d}
|
|
8
|
+
function C(a){let d=a.getChildren(),f=d.length;for(let e=0;e<f;e++)a.insertBefore(d[e]);a.remove();return 0<f?d[f-1]:null}
|
|
9
|
+
function D(a){let d=a.getPreviousSibling();if(k.$isOverflowNode(d)){var f=a.getFirstChild(),e=d.getChildren(),m=e.length;if(null===f)a.append(...e);else for(var c=0;c<m;c++)f.insertBefore(e[c]);c=x.$getSelection();if(x.$isRangeSelection(c)){f=c.anchor;e=f.getNode();c=c.focus;let g=f.getNode();e.is(d)?f.set(a.getKey(),f.offset,"element"):e.is(a)&&f.set(a.getKey(),m+f.offset,"element");g.is(d)?c.set(a.getKey(),c.offset,"element"):g.is(a)&&c.set(a.getKey(),m+c.offset,"element")}d.remove()}}
|
|
10
10
|
exports.mergePrevious=D;
|
|
11
|
-
exports.useCharacterLimit=function(a,d,f=Object.freeze({})){
|
|
12
|
-
{var r=a.isComposing();n=0<n.size;if(!r&&n){r=e(c);n=r>d||null!==g&&g>d;m(d-r);if(null===g||n){
|
|
13
|
-
null!==h&&h.select())}else l<p&&(h=b.getFirstDescendant(),u=null!==h?h.getTextContentSize():0,l+=u,h=x.$isTextNode(h)&&h.isSimpleText(),l=l<=p,(h||l)&&C(b))}else x.$isLeafNode(b)&&(l=t,t+=b.getTextContentSize(),t>p&&!k.$isOverflowNode(b.getParent())&&(h=x.$getSelection(),l<p&&x.$isTextNode(b)&&b.isSimpleText()?([,b]=b.splitText(p-l),b=A(b)):b=A(b),null!==h&&x.$setSelection(h),D(b)))}},{tag:"history-merge"})}g=r}}))},[a,d,m,e])}
|
|
11
|
+
exports.useCharacterLimit=function(a,d,f=Object.freeze({})){let {strlen:e=c=>c.length,remainingCharacters:m=()=>{}}=f;y.useEffect(()=>{if(!a.hasNodes([k.OverflowNode]))throw Error("Minified Lexical error #57; see codes.json for the full message or use the non-minified dev environment for full errors and additional helpful warnings.");},[a]);y.useEffect(()=>{let c=a.getEditorState().read(q.$rootTextContent),g=0;return w.mergeRegister(a.registerTextContentListener(n=>{c=n}),a.registerUpdateListener(({dirtyLeaves:n})=>
|
|
12
|
+
{var r=a.isComposing();n=0<n.size;if(!r&&n){r=e(c);n=r>d||null!==g&&g>d;m(d-r);if(null===g||n){let p=z(c,d,e);a.update(()=>{let B=w.$dfs(),E=B.length,t=0;for(let v=0;v<E;v+=1){var {node:b}=B[v];if(k.$isOverflowNode(b)){var l=t;if(t+b.getTextContentSize()<=p){var h=b.getParent();l=b.getPreviousSibling();var u=b.getNextSibling();C(b);b=x.$getSelection();!x.$isRangeSelection(b)||b.anchor.getNode().isAttached()&&b.focus.getNode().isAttached()||(x.$isTextNode(l)?l.select():x.$isTextNode(u)?u.select():
|
|
13
|
+
null!==h&&h.select())}else l<p&&(h=b.getFirstDescendant(),u=null!==h?h.getTextContentSize():0,l+=u,h=x.$isTextNode(h)&&h.isSimpleText(),l=l<=p,(h||l)&&C(b))}else x.$isLeafNode(b)&&(l=t,t+=b.getTextContentSize(),t>p&&!k.$isOverflowNode(b.getParent())&&(h=x.$getSelection(),l<p&&x.$isTextNode(b)&&b.isSimpleText()?([,b]=b.splitText(p-l),b=A(b)):b=A(b),null!==h&&x.$setSelection(h),D(b)))}},{tag:"history-merge"})}g=r}}))},[a,d,m,e])}
|
|
@@ -15,7 +15,6 @@ var reactDom = require('react-dom');
|
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
17
|
*
|
|
18
|
-
*
|
|
19
18
|
*/
|
|
20
19
|
const CAN_USE_DOM = typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined';
|
|
21
20
|
|
|
@@ -25,7 +24,6 @@ const CAN_USE_DOM = typeof window !== 'undefined' && typeof window.document !==
|
|
|
25
24
|
* This source code is licensed under the MIT license found in the
|
|
26
25
|
* LICENSE file in the root directory of this source tree.
|
|
27
26
|
*
|
|
28
|
-
*
|
|
29
27
|
*/
|
|
30
28
|
const useLayoutEffectImpl = CAN_USE_DOM ? react.useLayoutEffect : react.useEffect;
|
|
31
29
|
var useLayoutEffect = useLayoutEffectImpl;
|
|
@@ -36,7 +34,6 @@ var useLayoutEffect = useLayoutEffectImpl;
|
|
|
36
34
|
* This source code is licensed under the MIT license found in the
|
|
37
35
|
* LICENSE file in the root directory of this source tree.
|
|
38
36
|
*
|
|
39
|
-
*
|
|
40
37
|
*/
|
|
41
38
|
function useDecorators(editor) {
|
|
42
39
|
const [decorators, setDecorators] = react.useState(() => editor.getDecorators()); // Subscribe to changes
|
|
@@ -47,6 +44,12 @@ function useDecorators(editor) {
|
|
|
47
44
|
setDecorators(nextDecorators);
|
|
48
45
|
});
|
|
49
46
|
});
|
|
47
|
+
}, [editor]);
|
|
48
|
+
react.useEffect(() => {
|
|
49
|
+
// If the content editable mounts before the subscription is added, then
|
|
50
|
+
// nothing will be rendered on initial pass. We can get around that by
|
|
51
|
+
// ensuring that we set the value.
|
|
52
|
+
setDecorators(editor.getDecorators());
|
|
50
53
|
}, [editor]); // Return decorators defined as React Portals
|
|
51
54
|
|
|
52
55
|
return react.useMemo(() => {
|
|
@@ -73,10 +76,9 @@ function useDecorators(editor) {
|
|
|
73
76
|
* This source code is licensed under the MIT license found in the
|
|
74
77
|
* LICENSE file in the root directory of this source tree.
|
|
75
78
|
*
|
|
76
|
-
*
|
|
77
79
|
*/
|
|
78
80
|
function useLexicalDecorators(editor) {
|
|
79
81
|
return useDecorators(editor);
|
|
80
82
|
}
|
|
81
83
|
|
|
82
|
-
|
|
84
|
+
exports.useLexicalDecorators = useLexicalDecorators;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* (c) Meta Platforms, Inc. and affiliates. Confidential and proprietary.
|
|
3
|
+
*
|
|
4
|
+
* @flow strict
|
|
5
|
+
* @format
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type {LexicalEditor} from 'lexical';
|
|
9
|
+
|
|
10
|
+
import * as React from 'react';
|
|
11
|
+
|
|
12
|
+
declare export function useLexicalDecorators(
|
|
13
|
+
editor: LexicalEditor,
|
|
14
|
+
): Array<React.Node>;
|
|
@@ -4,5 +4,5 @@
|
|
|
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
|
-
var
|
|
8
|
-
function
|
|
7
|
+
'use strict';var b=require("react"),g=require("react-dom"),l="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement?b.useLayoutEffect:b.useEffect;
|
|
8
|
+
function m(a){let [e,h]=b.useState(()=>a.getDecorators());l(()=>a.registerDecoratorListener(d=>{g.flushSync(()=>{h(d)})}),[a]);b.useEffect(()=>{h(a.getDecorators())},[a]);return b.useMemo(()=>{let d=[],k=Object.keys(e);for(let f=0;f<k.length;f++){var c=k[f];let n=e[c];c=a.getElementByKey(c);null!==c&&d.push(g.createPortal(n,c))}return d},[e,a])}exports.useLexicalDecorators=function(a){return m(a)}
|
|
@@ -6,8 +6,61 @@
|
|
|
6
6
|
*/
|
|
7
7
|
'use strict';
|
|
8
8
|
|
|
9
|
-
var useLexicalCanShowPlaceholder = require('@lexical/react/DEPRECATED_useLexicalCanShowPlaceholder');
|
|
10
9
|
var react = require('react');
|
|
10
|
+
var text = require('@lexical/text');
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the MIT license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*
|
|
18
|
+
*/
|
|
19
|
+
const CAN_USE_DOM = typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
23
|
+
*
|
|
24
|
+
* This source code is licensed under the MIT license found in the
|
|
25
|
+
* LICENSE file in the root directory of this source tree.
|
|
26
|
+
*
|
|
27
|
+
*/
|
|
28
|
+
const useLayoutEffectImpl = CAN_USE_DOM ? react.useLayoutEffect : react.useEffect;
|
|
29
|
+
var useLayoutEffect = useLayoutEffectImpl;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
33
|
+
*
|
|
34
|
+
* This source code is licensed under the MIT license found in the
|
|
35
|
+
* LICENSE file in the root directory of this source tree.
|
|
36
|
+
*
|
|
37
|
+
*/
|
|
38
|
+
function useCanShowPlaceholder(editor) {
|
|
39
|
+
const [canShowPlaceholder, setCanShowPlaceholder] = react.useState(editor.getEditorState().read(text.$canShowPlaceholderCurry(editor.isComposing())));
|
|
40
|
+
useLayoutEffect(() => {
|
|
41
|
+
let currentCanShowPlaceholder = editor.getEditorState().read(text.$canShowPlaceholderCurry(editor.isComposing()));
|
|
42
|
+
setCanShowPlaceholder(currentCanShowPlaceholder);
|
|
43
|
+
return editor.registerUpdateListener(({
|
|
44
|
+
editorState
|
|
45
|
+
}) => {
|
|
46
|
+
const isComposing = editor.isComposing();
|
|
47
|
+
currentCanShowPlaceholder = editorState.read(text.$canShowPlaceholderCurry(isComposing));
|
|
48
|
+
setCanShowPlaceholder(currentCanShowPlaceholder);
|
|
49
|
+
});
|
|
50
|
+
}, [editor]);
|
|
51
|
+
return canShowPlaceholder;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
56
|
+
*
|
|
57
|
+
* This source code is licensed under the MIT license found in the
|
|
58
|
+
* LICENSE file in the root directory of this source tree.
|
|
59
|
+
*
|
|
60
|
+
*/
|
|
61
|
+
function useLexicalCanShowPlaceholder(editor) {
|
|
62
|
+
return useCanShowPlaceholder(editor);
|
|
63
|
+
}
|
|
11
64
|
|
|
12
65
|
/**
|
|
13
66
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
@@ -15,7 +68,6 @@ var react = require('react');
|
|
|
15
68
|
* This source code is licensed under the MIT license found in the
|
|
16
69
|
* LICENSE file in the root directory of this source tree.
|
|
17
70
|
*
|
|
18
|
-
*
|
|
19
71
|
*/
|
|
20
72
|
function useLexicalEditor(editor) {
|
|
21
73
|
const showPlaceholder = useLexicalCanShowPlaceholder(editor);
|
|
@@ -25,4 +77,4 @@ function useLexicalEditor(editor) {
|
|
|
25
77
|
return [rootElementRef, showPlaceholder];
|
|
26
78
|
}
|
|
27
79
|
|
|
28
|
-
|
|
80
|
+
exports.useLexicalEditor = useLexicalEditor;
|
|
@@ -4,4 +4,5 @@
|
|
|
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
|
-
var b=require("
|
|
7
|
+
'use strict';var b=require("react"),d=require("@lexical/text"),g="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement?b.useLayoutEffect:b.useEffect;
|
|
8
|
+
function h(a){let [e,c]=b.useState(a.getEditorState().read(d.$canShowPlaceholderCurry(a.isComposing())));g(()=>{let f=a.getEditorState().read(d.$canShowPlaceholderCurry(a.isComposing()));c(f);return a.registerUpdateListener(({editorState:k})=>{let l=a.isComposing();f=k.read(d.$canShowPlaceholderCurry(l));c(f)})},[a]);return e}exports.useLexicalEditor=function(a){let e=h(a);return[b.useCallback(c=>{a.setRootElement(c)},[a]),e]}
|
|
@@ -14,7 +14,6 @@ var react = require('react');
|
|
|
14
14
|
* This source code is licensed under the MIT license found in the
|
|
15
15
|
* LICENSE file in the root directory of this source tree.
|
|
16
16
|
*
|
|
17
|
-
*
|
|
18
17
|
*/
|
|
19
18
|
const CAN_USE_DOM = typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined';
|
|
20
19
|
|
|
@@ -24,7 +23,6 @@ const CAN_USE_DOM = typeof window !== 'undefined' && typeof window.document !==
|
|
|
24
23
|
* This source code is licensed under the MIT license found in the
|
|
25
24
|
* LICENSE file in the root directory of this source tree.
|
|
26
25
|
*
|
|
27
|
-
*
|
|
28
26
|
*/
|
|
29
27
|
const useLayoutEffectImpl = CAN_USE_DOM ? react.useLayoutEffect : react.useEffect;
|
|
30
28
|
var useLayoutEffect = useLayoutEffectImpl;
|
|
@@ -35,7 +33,6 @@ var useLayoutEffect = useLayoutEffectImpl;
|
|
|
35
33
|
* This source code is licensed under the MIT license found in the
|
|
36
34
|
* LICENSE file in the root directory of this source tree.
|
|
37
35
|
*
|
|
38
|
-
*
|
|
39
36
|
*/
|
|
40
37
|
|
|
41
38
|
function getTarget(eventName, rootElement) {
|
|
@@ -87,10 +84,9 @@ function useEditorEvents(events, editor) {
|
|
|
87
84
|
* This source code is licensed under the MIT license found in the
|
|
88
85
|
* LICENSE file in the root directory of this source tree.
|
|
89
86
|
*
|
|
90
|
-
*
|
|
91
87
|
*/
|
|
92
88
|
function useLexicalEditorEvents(events, editor) {
|
|
93
89
|
useEditorEvents(events, editor);
|
|
94
90
|
}
|
|
95
91
|
|
|
96
|
-
|
|
92
|
+
exports.useLexicalEditorEvents = useLexicalEditorEvents;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* (c) Meta Platforms, Inc. and affiliates. Confidential and proprietary.
|
|
3
|
+
*
|
|
4
|
+
* @flow strict
|
|
5
|
+
* @format
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type {LexicalEditor} from 'lexical';
|
|
9
|
+
|
|
10
|
+
export type InputEvents = Array<[string, EventHandler]>;
|
|
11
|
+
declare function getTarget(
|
|
12
|
+
eventName: string,
|
|
13
|
+
rootElement: HTMLElement,
|
|
14
|
+
): EventTarget;
|
|
15
|
+
declare function isRootEditable(editor: LexicalEditor): boolean;
|
|
16
|
+
declare export function useLexicalEditorEvents(
|
|
17
|
+
events: InputEvents,
|
|
18
|
+
editor: LexicalEditor,
|
|
19
|
+
): void;
|
|
@@ -4,5 +4,5 @@
|
|
|
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
|
-
var g=require("react"),h="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement?g.useLayoutEffect:g.useEffect;function p(a,b){return"selectionchange"===a||"keyup"===a||"pointerup"===a||"pointercancel"===a?b.ownerDocument:b}
|
|
8
|
-
function q(a,b){h(()=>{
|
|
7
|
+
'use strict';var g=require("react"),h="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement?g.useLayoutEffect:g.useEffect;function p(a,b){return"selectionchange"===a||"keyup"===a||"pointerup"===a||"pointercancel"===a?b.ownerDocument:b}
|
|
8
|
+
function q(a,b){h(()=>{let k=[],l=[];for(let d=0;d<a.length;d++){let [c,e]=a[d],n=f=>{let m=b.getRootElement();null!==m&&"true"===m.contentEditable&&e(f,b)};k.push(f=>{p(c,f).addEventListener(c,n)});l.push(f=>{p(c,f).removeEventListener(c,n)})}return b.registerRootListener((d,c)=>{null!==c&&l.forEach(e=>e(c));null!==d&&k.forEach(e=>e(d))})},[b,a])}exports.useLexicalEditorEvents=function(a,b){q(a,b)}
|
|
@@ -15,7 +15,6 @@ var react = require('react');
|
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
17
|
*
|
|
18
|
-
*
|
|
19
18
|
*/
|
|
20
19
|
function useHistory(editor, externalHistoryState, delay = 1000) {
|
|
21
20
|
const historyState = react.useMemo(() => externalHistoryState || history.createEmptyHistoryState(), [externalHistoryState]);
|
|
@@ -30,7 +29,6 @@ function useHistory(editor, externalHistoryState, delay = 1000) {
|
|
|
30
29
|
* This source code is licensed under the MIT license found in the
|
|
31
30
|
* LICENSE file in the root directory of this source tree.
|
|
32
31
|
*
|
|
33
|
-
*
|
|
34
32
|
*/
|
|
35
33
|
function useLexicalHistory(editor, externalHistoryState, delay = 1000) {
|
|
36
34
|
return useHistory(editor, externalHistoryState, delay);
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* (c) Meta Platforms, Inc. and affiliates. Confidential and proprietary.
|
|
3
|
+
*
|
|
4
|
+
* @flow strict
|
|
5
|
+
* @format
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type {
|
|
9
|
+
EditorState,
|
|
10
|
+
GridSelection,
|
|
11
|
+
LexicalEditor,
|
|
12
|
+
NodeSelection,
|
|
13
|
+
RangeSelection,
|
|
14
|
+
} from 'lexical';
|
|
15
|
+
|
|
16
|
+
type HistoryStateEntry = {
|
|
17
|
+
editor: LexicalEditor,
|
|
18
|
+
editorState: EditorState,
|
|
19
|
+
undoSelection?: RangeSelection | NodeSelection | GridSelection | null,
|
|
20
|
+
};
|
|
21
|
+
export type HistoryState = {
|
|
22
|
+
current: null | HistoryStateEntry,
|
|
23
|
+
redoStack: Array<HistoryStateEntry>,
|
|
24
|
+
undoStack: Array<HistoryStateEntry>,
|
|
25
|
+
};
|
|
26
|
+
declare export function useLexicalHistory(
|
|
27
|
+
editor: LexicalEditor,
|
|
28
|
+
externalHistoryState?: HistoryState,
|
|
29
|
+
delay?: number,
|
|
30
|
+
): () => void;
|
|
31
|
+
declare export function createEmptyHistoryState(): HistoryState;
|
|
@@ -4,4 +4,4 @@
|
|
|
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
|
-
var
|
|
7
|
+
'use strict';var history=require("@lexical/history"),d=require("react");function f(a,b,c=1E3){let e=d.useMemo(()=>b||history.createEmptyHistoryState(),[b]);d.useEffect(()=>history.registerHistory(a,e,c),[c,a,e])}exports.createEmptyHistoryState=history.createEmptyHistoryState;exports.useLexicalHistory=function(a,b,c=1E3){return f(a,b,c)}
|
|
@@ -12,12 +12,11 @@ var lexical = require('lexical');
|
|
|
12
12
|
var react = require('react');
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
|
-
* Copyright (c)
|
|
15
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
16
16
|
*
|
|
17
17
|
* This source code is licensed under the MIT license found in the
|
|
18
18
|
* LICENSE file in the root directory of this source tree.
|
|
19
19
|
*
|
|
20
|
-
*
|
|
21
20
|
*/
|
|
22
21
|
function useList(editor) {
|
|
23
22
|
react.useEffect(() => {
|
|
@@ -49,15 +48,14 @@ function useList(editor) {
|
|
|
49
48
|
}
|
|
50
49
|
|
|
51
50
|
/**
|
|
52
|
-
* Copyright (c)
|
|
51
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
53
52
|
*
|
|
54
53
|
* This source code is licensed under the MIT license found in the
|
|
55
54
|
* LICENSE file in the root directory of this source tree.
|
|
56
55
|
*
|
|
57
|
-
*
|
|
58
56
|
*/
|
|
59
57
|
function useLexicalList(editor) {
|
|
60
58
|
useList(editor);
|
|
61
59
|
}
|
|
62
60
|
|
|
63
|
-
|
|
61
|
+
exports.useLexicalList = useLexicalList;
|