@lexical/react 0.8.0 → 0.9.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/LexicalAutoEmbedPlugin.d.ts +1 -0
- package/LexicalAutoEmbedPlugin.dev.js +11 -0
- package/LexicalAutoFocusPlugin.dev.js +1 -0
- package/LexicalAutoLinkPlugin.d.ts +1 -0
- package/LexicalAutoLinkPlugin.dev.js +57 -11
- package/LexicalAutoLinkPlugin.prod.js +7 -6
- package/LexicalBlockWithAlignableContents.dev.js +13 -2
- package/LexicalBlockWithAlignableContents.prod.js +4 -4
- package/LexicalCharacterLimitPlugin.d.ts +1 -0
- package/LexicalCharacterLimitPlugin.dev.js +46 -7
- package/LexicalCheckListPlugin.dev.js +50 -12
- package/LexicalCheckListPlugin.prod.js +1 -1
- package/LexicalClearEditorPlugin.d.ts +1 -0
- package/LexicalClearEditorPlugin.dev.js +1 -1
- package/LexicalCollaborationContext.dev.js +3 -0
- package/LexicalCollaborationPlugin.d.ts +3 -2
- package/LexicalCollaborationPlugin.dev.js +35 -6
- package/LexicalComposer.d.ts +1 -0
- package/LexicalComposer.dev.js +10 -6
- package/LexicalComposerContext.dev.js +6 -0
- package/LexicalContentEditable.dev.js +0 -1
- package/LexicalContentEditable.js.flow +1 -0
- package/LexicalDecoratorBlockNode.d.ts +1 -0
- package/LexicalDecoratorBlockNode.dev.js +5 -0
- package/LexicalErrorBoundary.d.ts +1 -0
- package/LexicalHashtagPlugin.d.ts +1 -0
- package/LexicalHashtagPlugin.dev.js +43 -73
- package/LexicalHorizontalRuleNode.d.ts +1 -0
- package/LexicalHorizontalRuleNode.dev.js +22 -0
- package/LexicalHorizontalRulePlugin.dev.js +4 -0
- package/LexicalLinkPlugin.dev.js +10 -4
- package/LexicalListPlugin.dev.js +2 -0
- package/LexicalMarkdownShortcutPlugin.dev.js +2 -2
- package/LexicalNestedComposer.dev.js +12 -6
- package/LexicalNestedComposer.prod.js +2 -2
- package/LexicalNodeEventPlugin.dev.js +3 -5
- package/LexicalOnChangePlugin.dev.js +1 -1
- package/LexicalPlainTextPlugin.d.ts +1 -0
- package/LexicalPlainTextPlugin.dev.js +12 -8
- package/LexicalRichTextPlugin.d.ts +1 -0
- package/LexicalRichTextPlugin.dev.js +12 -8
- package/LexicalTabIndentationPlugin.dev.js +3 -1
- package/{LexicalTableOfContents__EXPERIMENTAL.d.ts → LexicalTableOfContents.d.ts} +1 -0
- package/{LexicalTableOfContents__EXPERIMENTAL.dev.js → LexicalTableOfContents.dev.js} +33 -5
- package/{DEPRECATED_useLexical.js → LexicalTableOfContents.js} +2 -2
- package/LexicalTablePlugin.d.ts +1 -0
- package/LexicalTablePlugin.dev.js +19 -5
- package/LexicalTreeView.d.ts +1 -0
- package/LexicalTreeView.dev.js +113 -21
- package/LexicalTreeView.prod.js +16 -15
- package/LexicalTypeaheadMenuPlugin.dev.js +123 -17
- package/LexicalTypeaheadMenuPlugin.prod.js +18 -18
- package/package.json +19 -19
- package/shared/useYjsCollaboration.d.ts +3 -4
- package/useLexicalEditable.dev.js +5 -1
- package/useLexicalIsTextContentEmpty.dev.js +0 -1
- package/useLexicalNodeSelection.dev.js +7 -0
- package/useLexicalSubscription.dev.js +3 -1
- package/DEPRECATED_useLexical.d.ts +0 -18
- package/DEPRECATED_useLexical.dev.js +0 -104
- package/DEPRECATED_useLexical.js.flow +0 -25
- package/DEPRECATED_useLexical.prod.js +0 -8
- package/DEPRECATED_useLexicalCanShowPlaceholder.d.ts +0 -9
- package/DEPRECATED_useLexicalCanShowPlaceholder.dev.js +0 -72
- package/DEPRECATED_useLexicalCanShowPlaceholder.js +0 -9
- package/DEPRECATED_useLexicalCanShowPlaceholder.js.flow +0 -15
- package/DEPRECATED_useLexicalCanShowPlaceholder.prod.js +0 -8
- package/DEPRECATED_useLexicalCharacterLimit.d.ts +0 -8
- package/DEPRECATED_useLexicalCharacterLimit.dev.js +0 -213
- package/DEPRECATED_useLexicalCharacterLimit.js +0 -9
- package/DEPRECATED_useLexicalCharacterLimit.js.flow +0 -31
- package/DEPRECATED_useLexicalCharacterLimit.prod.js +0 -13
- package/DEPRECATED_useLexicalEditor.d.ts +0 -9
- package/DEPRECATED_useLexicalEditor.dev.js +0 -87
- package/DEPRECATED_useLexicalEditor.js +0 -9
- package/DEPRECATED_useLexicalEditor.prod.js +0 -8
- package/DEPRECATED_useLexicalHistory.d.ts +0 -12
- package/DEPRECATED_useLexicalHistory.dev.js +0 -38
- package/DEPRECATED_useLexicalHistory.js +0 -9
- package/DEPRECATED_useLexicalHistory.js.flow +0 -34
- package/DEPRECATED_useLexicalHistory.prod.js +0 -7
- package/DEPRECATED_useLexicalPlainText.d.ts +0 -10
- package/DEPRECATED_useLexicalPlainText.dev.js +0 -88
- package/DEPRECATED_useLexicalPlainText.js +0 -9
- package/DEPRECATED_useLexicalPlainText.js.flow +0 -17
- package/DEPRECATED_useLexicalPlainText.prod.js +0 -8
- package/DEPRECATED_useLexicalRichText.d.ts +0 -10
- package/DEPRECATED_useLexicalRichText.dev.js +0 -88
- package/DEPRECATED_useLexicalRichText.js +0 -9
- package/DEPRECATED_useLexicalRichText.js.flow +0 -17
- package/DEPRECATED_useLexicalRichText.prod.js +0 -8
- package/LexicalTableOfContents__EXPERIMENTAL.js +0 -9
- /package/{LexicalTableOfContents__EXPERIMENTAL.js.flow → LexicalTableOfContents.js.flow} +0 -0
- /package/{LexicalTableOfContents__EXPERIMENTAL.prod.js → LexicalTableOfContents.prod.js} +0 -0
|
@@ -1,31 +0,0 @@
|
|
|
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
|
-
* @format
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import type {LexicalEditor, LexicalNode} from 'lexical';
|
|
12
|
-
import type {OverflowNode} from '@lexical/overflow';
|
|
13
|
-
|
|
14
|
-
type OptionalProps = {
|
|
15
|
-
strlen?: (input: string) => number,
|
|
16
|
-
remainingCharacters?: (characters: number) => void,
|
|
17
|
-
};
|
|
18
|
-
declare export function useCharacterLimit(
|
|
19
|
-
editor: LexicalEditor,
|
|
20
|
-
maxCharacters: number,
|
|
21
|
-
optional: OptionalProps,
|
|
22
|
-
): void;
|
|
23
|
-
declare function findOffset(
|
|
24
|
-
text: string,
|
|
25
|
-
maxCharacters: number,
|
|
26
|
-
strlen: (input: string) => number,
|
|
27
|
-
): number;
|
|
28
|
-
declare function $wrapOverflowedNodes(offset: number): void;
|
|
29
|
-
declare function $wrapNode(node: LexicalNode): OverflowNode;
|
|
30
|
-
declare function $unwrapNode(node: OverflowNode): LexicalNode | null;
|
|
31
|
-
declare export function mergePrevious(overflowNode: OverflowNode): void;
|
|
@@ -1,13 +0,0 @@
|
|
|
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
|
-
'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
|
-
exports.mergePrevious=D;
|
|
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; visit https://lexical.dev/docs/error?code=57 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=
|
|
12
|
-
n}),a.registerUpdateListener(({dirtyLeaves:n})=>{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)?
|
|
13
|
-
l.select():x.$isTextNode(u)?u.select():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])}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
import type { LexicalEditor } from 'lexical';
|
|
9
|
-
export declare function useLexicalEditor(editor: LexicalEditor): [(rootElement: null | HTMLElement) => void, boolean];
|
|
@@ -1,87 +0,0 @@
|
|
|
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
|
-
'use strict';
|
|
8
|
-
|
|
9
|
-
var react = require('react');
|
|
10
|
-
var text = require('@lexical/text');
|
|
11
|
-
var utils = require('@lexical/utils');
|
|
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
|
-
|
|
21
|
-
const CAN_USE_DOM = typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined';
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
25
|
-
*
|
|
26
|
-
* This source code is licensed under the MIT license found in the
|
|
27
|
-
* LICENSE file in the root directory of this source tree.
|
|
28
|
-
*
|
|
29
|
-
*/
|
|
30
|
-
const useLayoutEffectImpl = CAN_USE_DOM ? react.useLayoutEffect : react.useEffect;
|
|
31
|
-
var useLayoutEffect = useLayoutEffectImpl;
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
35
|
-
*
|
|
36
|
-
* This source code is licensed under the MIT license found in the
|
|
37
|
-
* LICENSE file in the root directory of this source tree.
|
|
38
|
-
*
|
|
39
|
-
*/
|
|
40
|
-
function canShowPlaceholderFromCurrentEditorState(editor) {
|
|
41
|
-
const currentCanShowPlaceholder = editor.getEditorState().read(text.$canShowPlaceholderCurry(editor.isComposing()));
|
|
42
|
-
return currentCanShowPlaceholder;
|
|
43
|
-
}
|
|
44
|
-
function useCanShowPlaceholder(editor) {
|
|
45
|
-
const [canShowPlaceholder, setCanShowPlaceholder] = react.useState(() => canShowPlaceholderFromCurrentEditorState(editor));
|
|
46
|
-
useLayoutEffect(() => {
|
|
47
|
-
function resetCanShowPlaceholder() {
|
|
48
|
-
const currentCanShowPlaceholder = canShowPlaceholderFromCurrentEditorState(editor);
|
|
49
|
-
setCanShowPlaceholder(currentCanShowPlaceholder);
|
|
50
|
-
}
|
|
51
|
-
resetCanShowPlaceholder();
|
|
52
|
-
return utils.mergeRegister(editor.registerUpdateListener(() => {
|
|
53
|
-
resetCanShowPlaceholder();
|
|
54
|
-
}), editor.registerEditableListener(() => {
|
|
55
|
-
resetCanShowPlaceholder();
|
|
56
|
-
}));
|
|
57
|
-
}, [editor]);
|
|
58
|
-
return canShowPlaceholder;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
63
|
-
*
|
|
64
|
-
* This source code is licensed under the MIT license found in the
|
|
65
|
-
* LICENSE file in the root directory of this source tree.
|
|
66
|
-
*
|
|
67
|
-
*/
|
|
68
|
-
function useLexicalCanShowPlaceholder(editor) {
|
|
69
|
-
return useCanShowPlaceholder(editor);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
74
|
-
*
|
|
75
|
-
* This source code is licensed under the MIT license found in the
|
|
76
|
-
* LICENSE file in the root directory of this source tree.
|
|
77
|
-
*
|
|
78
|
-
*/
|
|
79
|
-
function useLexicalEditor(editor) {
|
|
80
|
-
const showPlaceholder = useLexicalCanShowPlaceholder(editor);
|
|
81
|
-
const rootElementRef = react.useCallback(rootElement => {
|
|
82
|
-
editor.setRootElement(rootElement);
|
|
83
|
-
}, [editor]);
|
|
84
|
-
return [rootElementRef, showPlaceholder];
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
exports.useLexicalEditor = useLexicalEditor;
|
|
@@ -1,9 +0,0 @@
|
|
|
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
|
-
'use strict'
|
|
8
|
-
const DEPRECATED_useLexicalEditor = process.env.NODE_ENV === 'development' ? require('./DEPRECATED_useLexicalEditor.dev.js') : require('./DEPRECATED_useLexicalEditor.prod.js')
|
|
9
|
-
module.exports = DEPRECATED_useLexicalEditor;
|
|
@@ -1,8 +0,0 @@
|
|
|
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
|
-
'use strict';var b=require("react"),f=require("@lexical/text"),g=require("@lexical/utils"),h="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement?b.useLayoutEffect:b.useEffect;function k(a){return a.getEditorState().read(f.$canShowPlaceholderCurry(a.isComposing()))}
|
|
8
|
-
function l(a){let [c,d]=b.useState(()=>k(a));h(()=>{function e(){let m=k(a);d(m)}e();return g.mergeRegister(a.registerUpdateListener(()=>{e()}),a.registerEditableListener(()=>{e()}))},[a]);return c}exports.useLexicalEditor=function(a){let c=l(a);return[b.useCallback(d=>{a.setRootElement(d)},[a]),c]}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
import type { HistoryState } from '@lexical/history';
|
|
9
|
-
import type { LexicalEditor } from 'lexical';
|
|
10
|
-
export { createEmptyHistoryState } from '@lexical/history';
|
|
11
|
-
export type { HistoryState };
|
|
12
|
-
export declare function useLexicalHistory(editor: LexicalEditor, externalHistoryState?: HistoryState, delay?: number): void;
|
|
@@ -1,38 +0,0 @@
|
|
|
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
|
-
'use strict';
|
|
8
|
-
|
|
9
|
-
var history = require('@lexical/history');
|
|
10
|
-
var react = require('react');
|
|
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
|
-
function useHistory(editor, externalHistoryState, delay = 1000) {
|
|
20
|
-
const historyState = react.useMemo(() => externalHistoryState || history.createEmptyHistoryState(), [externalHistoryState]);
|
|
21
|
-
react.useEffect(() => {
|
|
22
|
-
return history.registerHistory(editor, historyState, delay);
|
|
23
|
-
}, [delay, editor, historyState]);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
28
|
-
*
|
|
29
|
-
* This source code is licensed under the MIT license found in the
|
|
30
|
-
* LICENSE file in the root directory of this source tree.
|
|
31
|
-
*
|
|
32
|
-
*/
|
|
33
|
-
function useLexicalHistory(editor, externalHistoryState, delay = 1000) {
|
|
34
|
-
return useHistory(editor, externalHistoryState, delay);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
exports.createEmptyHistoryState = history.createEmptyHistoryState;
|
|
38
|
-
exports.useLexicalHistory = useLexicalHistory;
|
|
@@ -1,9 +0,0 @@
|
|
|
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
|
-
'use strict'
|
|
8
|
-
const DEPRECATED_useLexicalHistory = process.env.NODE_ENV === 'development' ? require('./DEPRECATED_useLexicalHistory.dev.js') : require('./DEPRECATED_useLexicalHistory.prod.js')
|
|
9
|
-
module.exports = DEPRECATED_useLexicalHistory;
|
|
@@ -1,34 +0,0 @@
|
|
|
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
|
-
* @format
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import type {
|
|
12
|
-
EditorState,
|
|
13
|
-
GridSelection,
|
|
14
|
-
LexicalEditor,
|
|
15
|
-
NodeSelection,
|
|
16
|
-
RangeSelection,
|
|
17
|
-
} from 'lexical';
|
|
18
|
-
|
|
19
|
-
type HistoryStateEntry = {
|
|
20
|
-
editor: LexicalEditor,
|
|
21
|
-
editorState: EditorState,
|
|
22
|
-
undoSelection?: RangeSelection | NodeSelection | GridSelection | null,
|
|
23
|
-
};
|
|
24
|
-
export type HistoryState = {
|
|
25
|
-
current: null | HistoryStateEntry,
|
|
26
|
-
redoStack: Array<HistoryStateEntry>,
|
|
27
|
-
undoStack: Array<HistoryStateEntry>,
|
|
28
|
-
};
|
|
29
|
-
declare export function useLexicalHistory(
|
|
30
|
-
editor: LexicalEditor,
|
|
31
|
-
externalHistoryState?: HistoryState,
|
|
32
|
-
delay?: number,
|
|
33
|
-
): () => void;
|
|
34
|
-
declare export function createEmptyHistoryState(): HistoryState;
|
|
@@ -1,7 +0,0 @@
|
|
|
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
|
-
'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)}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
import type { HistoryState } from './DEPRECATED_useLexicalHistory';
|
|
9
|
-
import type { LexicalEditor } from 'lexical';
|
|
10
|
-
export declare function useLexicalPlainText(editor: LexicalEditor, externalHistoryState?: HistoryState): void;
|
|
@@ -1,88 +0,0 @@
|
|
|
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
|
-
'use strict';
|
|
8
|
-
|
|
9
|
-
var history = require('@lexical/history');
|
|
10
|
-
var react = require('react');
|
|
11
|
-
var dragon = require('@lexical/dragon');
|
|
12
|
-
var plainText = require('@lexical/plain-text');
|
|
13
|
-
var utils = require('@lexical/utils');
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
17
|
-
*
|
|
18
|
-
* This source code is licensed under the MIT license found in the
|
|
19
|
-
* LICENSE file in the root directory of this source tree.
|
|
20
|
-
*
|
|
21
|
-
*/
|
|
22
|
-
function useHistory(editor, externalHistoryState, delay = 1000) {
|
|
23
|
-
const historyState = react.useMemo(() => externalHistoryState || history.createEmptyHistoryState(), [externalHistoryState]);
|
|
24
|
-
react.useEffect(() => {
|
|
25
|
-
return history.registerHistory(editor, historyState, delay);
|
|
26
|
-
}, [delay, editor, historyState]);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
31
|
-
*
|
|
32
|
-
* This source code is licensed under the MIT license found in the
|
|
33
|
-
* LICENSE file in the root directory of this source tree.
|
|
34
|
-
*
|
|
35
|
-
*/
|
|
36
|
-
function useLexicalHistory(editor, externalHistoryState, delay = 1000) {
|
|
37
|
-
return useHistory(editor, externalHistoryState, delay);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
42
|
-
*
|
|
43
|
-
* This source code is licensed under the MIT license found in the
|
|
44
|
-
* LICENSE file in the root directory of this source tree.
|
|
45
|
-
*
|
|
46
|
-
*/
|
|
47
|
-
|
|
48
|
-
const CAN_USE_DOM = typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined';
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
52
|
-
*
|
|
53
|
-
* This source code is licensed under the MIT license found in the
|
|
54
|
-
* LICENSE file in the root directory of this source tree.
|
|
55
|
-
*
|
|
56
|
-
*/
|
|
57
|
-
const useLayoutEffectImpl = CAN_USE_DOM ? react.useLayoutEffect : react.useEffect;
|
|
58
|
-
var useLayoutEffect = useLayoutEffectImpl;
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
62
|
-
*
|
|
63
|
-
* This source code is licensed under the MIT license found in the
|
|
64
|
-
* LICENSE file in the root directory of this source tree.
|
|
65
|
-
*
|
|
66
|
-
*/
|
|
67
|
-
function usePlainTextSetup(editor) {
|
|
68
|
-
useLayoutEffect(() => {
|
|
69
|
-
return utils.mergeRegister(plainText.registerPlainText(editor), dragon.registerDragonSupport(editor));
|
|
70
|
-
|
|
71
|
-
// We only do this for init
|
|
72
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
73
|
-
}, [editor]);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
78
|
-
*
|
|
79
|
-
* This source code is licensed under the MIT license found in the
|
|
80
|
-
* LICENSE file in the root directory of this source tree.
|
|
81
|
-
*
|
|
82
|
-
*/
|
|
83
|
-
function useLexicalPlainText(editor, externalHistoryState) {
|
|
84
|
-
usePlainTextSetup(editor);
|
|
85
|
-
useLexicalHistory(editor, externalHistoryState);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
exports.useLexicalPlainText = useLexicalPlainText;
|
|
@@ -1,9 +0,0 @@
|
|
|
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
|
-
'use strict'
|
|
8
|
-
const DEPRECATED_useLexicalPlainText = process.env.NODE_ENV === 'development' ? require('./DEPRECATED_useLexicalPlainText.dev.js') : require('./DEPRECATED_useLexicalPlainText.prod.js')
|
|
9
|
-
module.exports = DEPRECATED_useLexicalPlainText;
|
|
@@ -1,17 +0,0 @@
|
|
|
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
|
-
* @format
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import type {HistoryState} from '@lexical/react/DEPRECATED_useLexicalHistory';
|
|
12
|
-
import type {EditorState, LexicalEditor} from 'lexical';
|
|
13
|
-
|
|
14
|
-
declare export function useLexicalPlainText(
|
|
15
|
-
editor: LexicalEditor,
|
|
16
|
-
externalHistoryState?: HistoryState,
|
|
17
|
-
): void;
|
|
@@ -1,8 +0,0 @@
|
|
|
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
|
-
'use strict';var history=require("@lexical/history"),c=require("react"),f=require("@lexical/dragon"),g=require("@lexical/plain-text"),h=require("@lexical/utils");function k(a,b,d=1E3){let e=c.useMemo(()=>b||history.createEmptyHistoryState(),[b]);c.useEffect(()=>history.registerHistory(a,e,d),[d,a,e])}function l(a,b,d=1E3){return k(a,b,d)}var m="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement?c.useLayoutEffect:c.useEffect;
|
|
8
|
-
function n(a){m(()=>h.mergeRegister(g.registerPlainText(a),f.registerDragonSupport(a)),[a])}exports.useLexicalPlainText=function(a,b){n(a);l(a,b)}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
import type { HistoryState } from './DEPRECATED_useLexicalHistory';
|
|
9
|
-
import type { LexicalEditor } from 'lexical';
|
|
10
|
-
export declare function useLexicalRichText(editor: LexicalEditor, externalHistoryState?: HistoryState): void;
|
|
@@ -1,88 +0,0 @@
|
|
|
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
|
-
'use strict';
|
|
8
|
-
|
|
9
|
-
var history = require('@lexical/history');
|
|
10
|
-
var react = require('react');
|
|
11
|
-
var dragon = require('@lexical/dragon');
|
|
12
|
-
var richText = require('@lexical/rich-text');
|
|
13
|
-
var utils = require('@lexical/utils');
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
17
|
-
*
|
|
18
|
-
* This source code is licensed under the MIT license found in the
|
|
19
|
-
* LICENSE file in the root directory of this source tree.
|
|
20
|
-
*
|
|
21
|
-
*/
|
|
22
|
-
function useHistory(editor, externalHistoryState, delay = 1000) {
|
|
23
|
-
const historyState = react.useMemo(() => externalHistoryState || history.createEmptyHistoryState(), [externalHistoryState]);
|
|
24
|
-
react.useEffect(() => {
|
|
25
|
-
return history.registerHistory(editor, historyState, delay);
|
|
26
|
-
}, [delay, editor, historyState]);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
31
|
-
*
|
|
32
|
-
* This source code is licensed under the MIT license found in the
|
|
33
|
-
* LICENSE file in the root directory of this source tree.
|
|
34
|
-
*
|
|
35
|
-
*/
|
|
36
|
-
function useLexicalHistory(editor, externalHistoryState, delay = 1000) {
|
|
37
|
-
return useHistory(editor, externalHistoryState, delay);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
42
|
-
*
|
|
43
|
-
* This source code is licensed under the MIT license found in the
|
|
44
|
-
* LICENSE file in the root directory of this source tree.
|
|
45
|
-
*
|
|
46
|
-
*/
|
|
47
|
-
|
|
48
|
-
const CAN_USE_DOM = typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined';
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
52
|
-
*
|
|
53
|
-
* This source code is licensed under the MIT license found in the
|
|
54
|
-
* LICENSE file in the root directory of this source tree.
|
|
55
|
-
*
|
|
56
|
-
*/
|
|
57
|
-
const useLayoutEffectImpl = CAN_USE_DOM ? react.useLayoutEffect : react.useEffect;
|
|
58
|
-
var useLayoutEffect = useLayoutEffectImpl;
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
62
|
-
*
|
|
63
|
-
* This source code is licensed under the MIT license found in the
|
|
64
|
-
* LICENSE file in the root directory of this source tree.
|
|
65
|
-
*
|
|
66
|
-
*/
|
|
67
|
-
function useRichTextSetup(editor) {
|
|
68
|
-
useLayoutEffect(() => {
|
|
69
|
-
return utils.mergeRegister(richText.registerRichText(editor), dragon.registerDragonSupport(editor));
|
|
70
|
-
|
|
71
|
-
// We only do this for init
|
|
72
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
73
|
-
}, [editor]);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
78
|
-
*
|
|
79
|
-
* This source code is licensed under the MIT license found in the
|
|
80
|
-
* LICENSE file in the root directory of this source tree.
|
|
81
|
-
*
|
|
82
|
-
*/
|
|
83
|
-
function useLexicalRichText(editor, externalHistoryState) {
|
|
84
|
-
useRichTextSetup(editor);
|
|
85
|
-
useLexicalHistory(editor, externalHistoryState);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
exports.useLexicalRichText = useLexicalRichText;
|
|
@@ -1,9 +0,0 @@
|
|
|
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
|
-
'use strict'
|
|
8
|
-
const DEPRECATED_useLexicalRichText = process.env.NODE_ENV === 'development' ? require('./DEPRECATED_useLexicalRichText.dev.js') : require('./DEPRECATED_useLexicalRichText.prod.js')
|
|
9
|
-
module.exports = DEPRECATED_useLexicalRichText;
|
|
@@ -1,17 +0,0 @@
|
|
|
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
|
-
* @format
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import type {HistoryState} from '@lexical/react/DEPRECATED_useLexicalHistory';
|
|
12
|
-
import type {EditorState, LexicalEditor} from 'lexical';
|
|
13
|
-
|
|
14
|
-
declare export function useLexicalRichText(
|
|
15
|
-
editor: LexicalEditor,
|
|
16
|
-
externalHistoryState?: HistoryState,
|
|
17
|
-
): void;
|
|
@@ -1,8 +0,0 @@
|
|
|
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
|
-
'use strict';var history=require("@lexical/history"),c=require("react"),f=require("@lexical/dragon"),g=require("@lexical/rich-text"),h=require("@lexical/utils");function k(a,b,d=1E3){let e=c.useMemo(()=>b||history.createEmptyHistoryState(),[b]);c.useEffect(()=>history.registerHistory(a,e,d),[d,a,e])}function l(a,b,d=1E3){return k(a,b,d)}var m="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement?c.useLayoutEffect:c.useEffect;
|
|
8
|
-
function n(a){m(()=>h.mergeRegister(g.registerRichText(a),f.registerDragonSupport(a)),[a])}exports.useLexicalRichText=function(a,b){n(a);l(a,b)}
|
|
@@ -1,9 +0,0 @@
|
|
|
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
|
-
'use strict'
|
|
8
|
-
const LexicalTableOfContents__EXPERIMENTAL = process.env.NODE_ENV === 'development' ? require('./LexicalTableOfContents__EXPERIMENTAL.dev.js') : require('./LexicalTableOfContents__EXPERIMENTAL.prod.js')
|
|
9
|
-
module.exports = LexicalTableOfContents__EXPERIMENTAL;
|
|
File without changes
|
|
File without changes
|