@lexical/react 0.1.9 → 0.1.12
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 +5 -44
- package/DEPRECATED_useLexical.prod.js +1 -2
- package/DEPRECATED_useLexicalAutoFormatter.dev.js +87 -41
- package/DEPRECATED_useLexicalAutoFormatter.prod.js +20 -18
- package/DEPRECATED_useLexicalCharacterLimit.dev.js +22 -19
- package/DEPRECATED_useLexicalCharacterLimit.prod.js +8 -8
- package/DEPRECATED_useLexicalEditor.dev.js +1 -25
- package/DEPRECATED_useLexicalEditor.prod.js +1 -1
- package/DEPRECATED_useLexicalHistory.dev.js +1 -1
- package/DEPRECATED_useLexicalHistory.prod.js +2 -2
- package/DEPRECATED_useLexicalList.dev.js +6 -0
- package/DEPRECATED_useLexicalList.prod.js +1 -1
- package/DEPRECATED_useLexicalPlainText.dev.js +81 -89
- package/DEPRECATED_useLexicalPlainText.prod.js +15 -16
- package/DEPRECATED_useLexicalRichText.dev.js +98 -592
- package/DEPRECATED_useLexicalRichText.prod.js +17 -29
- package/LexicalAutoFormatterPlugin.d.ts +9 -0
- package/LexicalAutoFormatterPlugin.dev.js +87 -41
- package/LexicalAutoFormatterPlugin.js.flow +10 -0
- package/LexicalAutoFormatterPlugin.prod.js +21 -19
- package/LexicalAutoLinkPlugin.d.ts +20 -0
- package/LexicalAutoLinkPlugin.js.flow +23 -0
- package/LexicalCharacterLimitPlugin.d.ts +11 -0
- package/LexicalCharacterLimitPlugin.dev.js +22 -19
- package/LexicalCharacterLimitPlugin.js.flow +12 -0
- package/LexicalCharacterLimitPlugin.prod.js +9 -8
- package/LexicalClearEditorPlugin.d.ts +14 -0
- package/LexicalClearEditorPlugin.dev.js +73 -0
- package/LexicalClearEditorPlugin.js +9 -0
- package/LexicalClearEditorPlugin.js.flow +14 -0
- package/LexicalClearEditorPlugin.prod.js +8 -0
- package/LexicalCollaborationPlugin.d.ts +49 -0
- package/LexicalCollaborationPlugin.dev.js +21 -11
- package/LexicalCollaborationPlugin.js.flow +55 -0
- package/LexicalCollaborationPlugin.prod.js +7 -7
- package/LexicalComposer.d.ts +22 -0
- package/LexicalComposer.dev.js +29 -5
- package/LexicalComposer.js.flow +24 -0
- package/LexicalComposer.prod.js +3 -3
- package/LexicalComposerContext.d.ts +24 -0
- package/LexicalComposerContext.js.flow +27 -0
- package/LexicalContentEditable.d.ts +32 -0
- package/LexicalContentEditable.dev.js +35 -8
- package/LexicalContentEditable.js.flow +35 -0
- package/LexicalContentEditable.prod.js +3 -3
- package/LexicalHashtagPlugin.d.ts +9 -0
- package/LexicalHashtagPlugin.js.flow +10 -0
- package/LexicalHistoryPlugin.d.ts +29 -0
- package/LexicalHistoryPlugin.dev.js +1 -1
- package/LexicalHistoryPlugin.js.flow +34 -0
- package/LexicalHistoryPlugin.prod.js +2 -2
- package/LexicalHorizontalRuleNode.d.ts +23 -0
- package/LexicalHorizontalRuleNode.js.flow +25 -0
- package/LexicalLinkPlugin.d.ts +9 -0
- package/LexicalLinkPlugin.js.flow +10 -0
- package/LexicalListPlugin.d.ts +9 -0
- package/LexicalListPlugin.dev.js +6 -0
- package/LexicalListPlugin.js.flow +10 -0
- package/LexicalListPlugin.prod.js +2 -2
- package/LexicalNestedComposer.d.ts +20 -0
- package/LexicalNestedComposer.js.flow +21 -0
- package/LexicalOnChangePlugin.d.ts +12 -0
- package/LexicalOnChangePlugin.js.flow +14 -0
- package/LexicalPlainTextPlugin.d.ts +15 -0
- package/LexicalPlainTextPlugin.dev.js +77 -84
- package/LexicalPlainTextPlugin.js.flow +18 -0
- package/LexicalPlainTextPlugin.prod.js +12 -12
- package/LexicalRichTextPlugin.d.ts +15 -0
- package/LexicalRichTextPlugin.dev.js +93 -586
- package/LexicalRichTextPlugin.js.flow +18 -0
- package/LexicalRichTextPlugin.prod.js +13 -25
- package/LexicalTablePlugin.d.ts +9 -0
- package/LexicalTablePlugin.dev.js +23 -1
- package/LexicalTablePlugin.js.flow +10 -0
- package/LexicalTablePlugin.prod.js +4 -3
- package/LexicalTreeView.d.ts +17 -0
- package/LexicalTreeView.dev.js +10 -2
- package/LexicalTreeView.js.flow +19 -0
- package/LexicalTreeView.prod.js +9 -8
- package/README.md +0 -1
- package/package.json +6 -5
- package/useLexicalDecoratorMap.d.ts +14 -0
- package/useLexicalDecoratorMap.js.flow +16 -0
- package/useLexicalIsTextContentEmpty.d.ts +13 -0
- package/useLexicalIsTextContentEmpty.js.flow +15 -0
- package/useLexicalNodeSelection.d.ts +12 -0
- package/useLexicalNodeSelection.dev.js +70 -0
- package/useLexicalNodeSelection.js +9 -0
- package/useLexicalNodeSelection.js.flow +14 -0
- package/useLexicalNodeSelection.prod.js +8 -0
- package/withSubscriptions.d.ts +12 -0
- package/withSubscriptions.js.flow +13 -0
- package/LexicalBootstrapPlugin.dev.js +0 -122
- package/LexicalBootstrapPlugin.js +0 -9
- package/LexicalBootstrapPlugin.prod.js +0 -8
|
@@ -9,6 +9,27 @@
|
|
|
9
9
|
var LexicalComposerContext = require('@lexical/react/LexicalComposerContext');
|
|
10
10
|
var React = require('react');
|
|
11
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
|
+
*/
|
|
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
|
+
*/
|
|
30
|
+
const useLayoutEffectImpl = CAN_USE_DOM ? React.useLayoutEffect : React.useEffect;
|
|
31
|
+
var useLayoutEffect = useLayoutEffectImpl;
|
|
32
|
+
|
|
12
33
|
/**
|
|
13
34
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
14
35
|
*
|
|
@@ -32,7 +53,6 @@ function LexicalContentEditable({
|
|
|
32
53
|
autoComplete,
|
|
33
54
|
autoCorrect,
|
|
34
55
|
className,
|
|
35
|
-
readOnly = false,
|
|
36
56
|
role = 'textbox',
|
|
37
57
|
spellCheck = true,
|
|
38
58
|
style,
|
|
@@ -40,28 +60,35 @@ function LexicalContentEditable({
|
|
|
40
60
|
testid
|
|
41
61
|
}) {
|
|
42
62
|
const [editor] = LexicalComposerContext.useLexicalComposerContext();
|
|
63
|
+
const [isReadOnly, setReadOnly] = React.useState(true);
|
|
43
64
|
const ref = React.useCallback(rootElement => {
|
|
44
65
|
editor.setRootElement(rootElement);
|
|
45
66
|
}, [editor]);
|
|
67
|
+
useLayoutEffect(() => {
|
|
68
|
+
setReadOnly(editor.isReadOnly());
|
|
69
|
+
return editor.addListener('readonly', currentIsReadOnly => {
|
|
70
|
+
setReadOnly(currentIsReadOnly);
|
|
71
|
+
});
|
|
72
|
+
}, [editor]);
|
|
46
73
|
return /*#__PURE__*/React.createElement("div", {
|
|
47
|
-
"aria-activedescendant":
|
|
48
|
-
"aria-autocomplete":
|
|
49
|
-
"aria-controls":
|
|
74
|
+
"aria-activedescendant": isReadOnly ? null : ariaActiveDescendantID,
|
|
75
|
+
"aria-autocomplete": isReadOnly ? null : ariaAutoComplete,
|
|
76
|
+
"aria-controls": isReadOnly ? null : ariaControls,
|
|
50
77
|
"aria-describedby": ariaDescribedBy,
|
|
51
|
-
"aria-expanded":
|
|
78
|
+
"aria-expanded": isReadOnly ? null : role === 'combobox' ? !!ariaExpanded : null,
|
|
52
79
|
"aria-label": ariaLabel,
|
|
53
80
|
"aria-labelledby": ariaLabelledBy,
|
|
54
81
|
"aria-multiline": ariaMultiline,
|
|
55
|
-
"aria-owns":
|
|
82
|
+
"aria-owns": isReadOnly ? null : ariaOwneeID,
|
|
56
83
|
"aria-required": ariaRequired,
|
|
57
84
|
autoCapitalize: autoCapitalize,
|
|
58
85
|
autoComplete: autoComplete,
|
|
59
86
|
autoCorrect: autoCorrect,
|
|
60
87
|
className: className,
|
|
61
|
-
contentEditable: !
|
|
88
|
+
contentEditable: !isReadOnly,
|
|
62
89
|
"data-testid": testid,
|
|
63
90
|
ref: ref,
|
|
64
|
-
role:
|
|
91
|
+
role: isReadOnly ? null : role,
|
|
65
92
|
spellCheck: spellCheck,
|
|
66
93
|
style: style,
|
|
67
94
|
tabIndex: tabIndex
|
|
@@ -0,0 +1,35 @@
|
|
|
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
|
+
export type Props = $ReadOnly<{
|
|
11
|
+
ariaActiveDescendantID?: string,
|
|
12
|
+
ariaAutoComplete?: string,
|
|
13
|
+
ariaControls?: string,
|
|
14
|
+
ariaDescribedBy?: string,
|
|
15
|
+
ariaExpanded?: boolean,
|
|
16
|
+
ariaLabel?: string,
|
|
17
|
+
ariaLabelledBy?: string,
|
|
18
|
+
ariaMultiline?: boolean,
|
|
19
|
+
ariaOwneeID?: string,
|
|
20
|
+
ariaRequired?: string,
|
|
21
|
+
autoCapitalize?: boolean,
|
|
22
|
+
autoComplete?: boolean,
|
|
23
|
+
autoCorrect?: boolean,
|
|
24
|
+
className?: string,
|
|
25
|
+
readOnly?: boolean,
|
|
26
|
+
role?: string,
|
|
27
|
+
style?: StyleSheetList,
|
|
28
|
+
spellCheck?: boolean,
|
|
29
|
+
tabIndex?: number,
|
|
30
|
+
testid?: string,
|
|
31
|
+
}>;
|
|
32
|
+
|
|
33
|
+
declare export default function LexicalContentEditable(
|
|
34
|
+
props: Props,
|
|
35
|
+
): React$Node;
|
|
@@ -4,6 +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 b=require("@lexical/react/LexicalComposerContext"),
|
|
8
|
-
module.exports=function({ariaActiveDescendantID:
|
|
9
|
-
|
|
7
|
+
var b=require("@lexical/react/LexicalComposerContext"),g=require("react"),h="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement?g.useLayoutEffect:g.useEffect;
|
|
8
|
+
module.exports=function({ariaActiveDescendantID:k,ariaAutoComplete:l,ariaControls:m,ariaDescribedBy:n,ariaExpanded:p,ariaLabel:q,ariaLabelledBy:r,ariaMultiline:t,ariaOwneeID:u,ariaRequired:v,autoCapitalize:w,autoComplete:x,autoCorrect:y,className:z,role:e="textbox",spellCheck:A=!0,style:B,tabIndex:C,testid:D}){const [c]=b.useLexicalComposerContext(),[a,f]=g.useState(!0),E=g.useCallback(d=>{c.setRootElement(d)},[c]);h(()=>{f(c.isReadOnly());return c.addListener("readonly",d=>{f(d)})},[c]);return g.createElement("div",
|
|
9
|
+
{"aria-activedescendant":a?null:k,"aria-autocomplete":a?null:l,"aria-controls":a?null:m,"aria-describedby":n,"aria-expanded":a?null:"combobox"===e?!!p:null,"aria-label":q,"aria-labelledby":r,"aria-multiline":t,"aria-owns":a?null:u,"aria-required":v,autoCapitalize:w,autoComplete:x,autoCorrect:y,className:z,contentEditable:!a,"data-testid":D,ref:E,role:a?null:e,spellCheck:A,style:B,tabIndex:C})};
|
|
@@ -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
|
+
export default function LexicalHashtagPlugin(): React.ReactNode;
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
declare export default function LexicalHashtagPlugin(): React$Node;
|
|
@@ -0,0 +1,29 @@
|
|
|
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 type {
|
|
10
|
+
EditorState,
|
|
11
|
+
GridSelection,
|
|
12
|
+
LexicalEditor,
|
|
13
|
+
NodeSelection,
|
|
14
|
+
RangeSelection,
|
|
15
|
+
} from 'lexical';
|
|
16
|
+
export 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
|
+
export function HistoryPlugin(arg0: {
|
|
27
|
+
externalHistoryState?: HistoryState;
|
|
28
|
+
}): React.ReactNode;
|
|
29
|
+
export function createEmptyHistoryState(): HistoryState;
|
|
@@ -74,7 +74,7 @@ function getChangeType(prevEditorState, nextEditorState, dirtyLeavesSet, dirtyEl
|
|
|
74
74
|
return COMPOSING_CHARACTER;
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
if (nextSelection
|
|
77
|
+
if (!lexical.$isRangeSelection(nextSelection) || !lexical.$isRangeSelection(prevSelection) || !prevSelection.isCollapsed() || !nextSelection.isCollapsed()) {
|
|
78
78
|
return OTHER;
|
|
79
79
|
}
|
|
80
80
|
|
|
@@ -0,0 +1,34 @@
|
|
|
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
|
+
import type {
|
|
11
|
+
EditorState,
|
|
12
|
+
GridSelection,
|
|
13
|
+
LexicalEditor,
|
|
14
|
+
NodeSelection,
|
|
15
|
+
RangeSelection,
|
|
16
|
+
} from 'lexical';
|
|
17
|
+
|
|
18
|
+
export type HistoryStateEntry = {
|
|
19
|
+
editor: LexicalEditor,
|
|
20
|
+
editorState: EditorState,
|
|
21
|
+
undoSelection?: RangeSelection | NodeSelection | GridSelection | null,
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export type HistoryState = {
|
|
25
|
+
current: null | HistoryStateEntry,
|
|
26
|
+
redoStack: Array<HistoryStateEntry>,
|
|
27
|
+
undoStack: Array<HistoryStateEntry>,
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
declare export function HistoryPlugin({
|
|
31
|
+
externalHistoryState?: HistoryState,
|
|
32
|
+
}): React$Node;
|
|
33
|
+
|
|
34
|
+
declare export function createEmptyHistoryState(): HistoryState;
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
var n=require("@lexical/react/LexicalComposerContext"),t=require("@lexical/react/withSubscriptions"),v=require("lexical"),w=require("react");
|
|
8
|
-
function x(b,d,l,a,h){if(null===b||0===l.size&&0===a.size)return 0;var g=d._selection,c=b._selection;if(h)return 1;if(
|
|
9
|
-
c&&!b._nodeMap.has(d.__key)&&v.$isTextNode(d)&&1===d.__text.length&&1===g.anchor.offset?2:0;d=h[0];b=b._nodeMap.get(d.__key);if(!v.$isTextNode(b)||!v.$isTextNode(d)||b.__mode!==d.__mode)return 0;b=b.__text;d=d.__text;if(b===d)return 0;g=g.anchor;c=c.anchor;if(g.key!==c.key||"text"!==g.type)return 0;g=g.offset;c=c.offset;b=d.length-b.length;return 1===b&&c===g-1?2:-1===b&&c===g+1?3:-1===b&&c===g?4:0}
|
|
8
|
+
function x(b,d,l,a,h){if(null===b||0===l.size&&0===a.size)return 0;var g=d._selection,c=b._selection;if(h)return 1;if(!(v.$isRangeSelection(g)&&v.$isRangeSelection(c)&&c.isCollapsed()&&g.isCollapsed()))return 0;var e=Array.from(l);a=Array.from(a);l=d._nodeMap;h=[];for(var f=0;f<e.length;f++){const k=l.get(e[f]);void 0!==k&&h.push(k)}for(e=0;e<a.length;e++)a[e][1]&&(f=l.get(a[e][0]),void 0===f||v.$isRootNode(f)||h.push(f));if(0===h.length)return 0;if(1<h.length)return a=d._nodeMap,d=a.get(g.anchor.key),
|
|
9
|
+
c=a.get(c.anchor.key),d&&c&&!b._nodeMap.has(d.__key)&&v.$isTextNode(d)&&1===d.__text.length&&1===g.anchor.offset?2:0;d=h[0];b=b._nodeMap.get(d.__key);if(!v.$isTextNode(b)||!v.$isTextNode(d)||b.__mode!==d.__mode)return 0;b=b.__text;d=d.__text;if(b===d)return 0;g=g.anchor;c=c.anchor;if(g.key!==c.key||"text"!==g.type)return 0;g=g.offset;c=c.offset;b=d.length-b.length;return 1===b&&c===g-1?2:-1===b&&c===g+1?3:-1===b&&c===g?4:0}
|
|
10
10
|
function y(b,d){let l=Date.now(),a=0;return(h,g,c,e,f,k)=>{const p=Date.now();if(k.has("historic"))return a=0,l=p,2;const m=x(h,g,e,f,b.isComposing()),u=(()=>{const r=k.has("history-push");if(!r&&k.has("history-merge"))return 0;if(null===h)return 1;var q=g._selection;const A=h._selection;if(!(0<e.size||0<f.size))return null===A&&null!==q?0:2;q=null===c||c.editor===b;return!1===r&&0!==m&&m===a&&p<l+d&&q?0:1})();l=p;a=m;return u}}
|
|
11
11
|
function z(b,d,l=1E3){const a=w.useMemo(()=>d||B(),[d]),h=w.useCallback(()=>{a.undoStack=[];a.redoStack=[];a.current=null},[a]);w.useEffect(()=>{const g=y(b,l);return t(b.addListener("command",c=>{switch(c){case "undo":c=a.redoStack;var e=a.undoStack;if(0!==e.length){var f=a.current;const k=e.pop();null!==f&&(c.push(f),b.execCommand("canRedo",!0));0===e.length&&b.execCommand("canUndo",!1);a.current=k;k.editor.setEditorState(k.editorState.clone(k.undoSelection),{tag:"historic"})}return!0;case "redo":return c=
|
|
12
12
|
a.redoStack,e=a.undoStack,0!==c.length&&(f=a.current,null!==f&&(e.push(f),b.execCommand("canUndo",!0)),e=c.pop(),0===c.length&&b.execCommand("canRedo",!1),a.current=e,e.editor.setEditorState(e.editorState,{tag:"historic"})),!0;case "clearEditor":return h(),!1;case "clearHistory":return h(),!0;default:return!1}},0),b.addListener("update",({editorState:c,prevEditorState:e,dirtyLeaves:f,dirtyElements:k,tags:p})=>{const m=a.current,u=a.redoStack,r=a.undoStack,q=null===m?null:m.editorState;if(null===m||
|
|
@@ -0,0 +1,23 @@
|
|
|
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 type {LexicalNode} from 'lexical';
|
|
10
|
+
import {DecoratorNode} from 'lexical';
|
|
11
|
+
export declare class HorizontalRuleNode extends DecoratorNode<React.ReactNode> {
|
|
12
|
+
getType(): string;
|
|
13
|
+
clone(node: HorizontalRuleNode): HorizontalRuleNode;
|
|
14
|
+
createDOM(): HTMLElement;
|
|
15
|
+
getTextContent(): '\n';
|
|
16
|
+
isTopLevel(): true;
|
|
17
|
+
updateDOM(): false;
|
|
18
|
+
decorate(): React.ReactNode;
|
|
19
|
+
}
|
|
20
|
+
export function $createHorizontalRuleNode(): HorizontalRuleNode;
|
|
21
|
+
export function $isHorizontalRuleNode(
|
|
22
|
+
node: LexicalNode | null | undefined,
|
|
23
|
+
): boolean;
|
|
@@ -0,0 +1,25 @@
|
|
|
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
|
+
import type {LexicalNode} from 'lexical';
|
|
11
|
+
|
|
12
|
+
import {DecoratorNode} from 'lexical';
|
|
13
|
+
|
|
14
|
+
declare export class HorizontalRuleNode extends DecoratorNode<React$Node> {
|
|
15
|
+
static getType(): string;
|
|
16
|
+
static clone(node: HorizontalRuleNode): HorizontalRuleNode;
|
|
17
|
+
createDOM(): HTMLElement;
|
|
18
|
+
getTextContent(): '\n';
|
|
19
|
+
isTopLevel(): true;
|
|
20
|
+
updateDOM(): false;
|
|
21
|
+
decorate(): React$Node;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
declare export function $createHorizontalRuleNode(): HorizontalRuleNode;
|
|
25
|
+
declare export function $isHorizontalRuleNode(node: ?LexicalNode): boolean;
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
declare export default function LexicalLinkPlugin(): null;
|
package/LexicalListPlugin.dev.js
CHANGED
|
@@ -43,6 +43,12 @@ function useList(editor) {
|
|
|
43
43
|
} else if (type === 'removeList') {
|
|
44
44
|
list.removeList(editor);
|
|
45
45
|
return true;
|
|
46
|
+
} else if (type === 'insertParagraph') {
|
|
47
|
+
const hasHandledInsertParagraph = list.$handleListInsertParagraph();
|
|
48
|
+
|
|
49
|
+
if (hasHandledInsertParagraph) {
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
46
52
|
}
|
|
47
53
|
|
|
48
54
|
return false;
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
declare export default function ListPlugin(): null;
|
|
@@ -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 b=require("@lexical/react/LexicalComposerContext"),d=require("@lexical/list"),e=require("react");
|
|
8
|
-
module.exports=function(){const [a]=b.useLexicalComposerContext();f(a);return null};
|
|
7
|
+
var b=require("@lexical/react/LexicalComposerContext"),d=require("@lexical/list"),e=require("react");
|
|
8
|
+
function f(a){e.useEffect(()=>a.addListener("command",c=>{if("indentContent"===c){if(d.indentList())return!0}else if("outdentContent"===c){if(d.outdentList())return!0}else{if("insertOrderedList"===c)return d.insertList(a,"ol"),!0;if("insertUnorderedList"===c)return d.insertList(a,"ul"),!0;if("removeList"===c)return d.removeList(a),!0;if("insertParagraph"===c&&d.$handleListInsertParagraph())return!0}return!1},1),[a])}module.exports=function(){const [a]=b.useLexicalComposerContext();f(a);return null};
|
|
@@ -0,0 +1,20 @@
|
|
|
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 {Class} from 'utility-types';
|
|
10
|
+
import type {DecoratorEditor, EditorThemeClasses, LexicalNode} from 'lexical';
|
|
11
|
+
export default function LexicalNestedComposer(arg0: {
|
|
12
|
+
initialConfig?: {
|
|
13
|
+
namespace?: string;
|
|
14
|
+
decoratorEditor: DecoratorEditor;
|
|
15
|
+
nodes?: Array<Class<LexicalNode>>;
|
|
16
|
+
theme?: EditorThemeClasses;
|
|
17
|
+
onError?: (arg0: Error) => void;
|
|
18
|
+
};
|
|
19
|
+
children?: React.ReactNode;
|
|
20
|
+
}): React.ReactNode;
|
|
@@ -0,0 +1,21 @@
|
|
|
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
|
+
import type {DecoratorEditor, EditorThemeClasses, LexicalNode} from 'lexical';
|
|
11
|
+
|
|
12
|
+
declare export default function LexicalNestedComposer({
|
|
13
|
+
initialConfig?: {
|
|
14
|
+
namespace?: string,
|
|
15
|
+
decoratorEditor: DecoratorEditor,
|
|
16
|
+
nodes?: Array<Class<LexicalNode>>,
|
|
17
|
+
theme?: EditorThemeClasses,
|
|
18
|
+
onError?: (Error) => void,
|
|
19
|
+
},
|
|
20
|
+
children?: React$Node,
|
|
21
|
+
}): React$Node;
|
|
@@ -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
|
+
*/
|
|
8
|
+
|
|
9
|
+
import type {EditorState, LexicalEditor} from 'lexical';
|
|
10
|
+
export default function OnChangePlugin(arg0: {
|
|
11
|
+
onChange: (editorState: EditorState, editor: LexicalEditor) => void;
|
|
12
|
+
}): null;
|
|
@@ -0,0 +1,14 @@
|
|
|
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
|
+
import type {EditorState, LexicalEditor} from 'lexical';
|
|
11
|
+
|
|
12
|
+
declare export default function OnChangePlugin({
|
|
13
|
+
onChange: (editorState: EditorState, editor: LexicalEditor) => void,
|
|
14
|
+
}): null;
|
|
@@ -0,0 +1,15 @@
|
|
|
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 type {EditorState} from 'lexical';
|
|
10
|
+
type InitialEditorStateType = null | string | EditorState | (() => void);
|
|
11
|
+
export default function PlainTextPlugin(arg0: {
|
|
12
|
+
contentEditable: React.ReactNode;
|
|
13
|
+
initialEditorState?: InitialEditorStateType;
|
|
14
|
+
placeholder: React.ReactNode;
|
|
15
|
+
}): React.ReactNode;
|