@lexical/react 0.3.3 → 0.3.6
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.d.ts +18 -0
- package/DEPRECATED_useLexical.dev.js +18 -9
- package/DEPRECATED_useLexical.js.flow +4 -1
- package/DEPRECATED_useLexical.prod.js +2 -3
- package/DEPRECATED_useLexicalAutoFormatter.d.ts +9 -0
- package/DEPRECATED_useLexicalAutoFormatter.js.flow +4 -1
- package/DEPRECATED_useLexicalCanShowPlaceholder.d.ts +9 -0
- package/DEPRECATED_useLexicalCanShowPlaceholder.dev.js +18 -9
- package/DEPRECATED_useLexicalCanShowPlaceholder.js.flow +4 -1
- package/DEPRECATED_useLexicalCanShowPlaceholder.prod.js +2 -2
- package/DEPRECATED_useLexicalCharacterLimit.d.ts +8 -0
- package/DEPRECATED_useLexicalCharacterLimit.js.flow +4 -1
- package/DEPRECATED_useLexicalDecorators.d.ts +9 -0
- package/DEPRECATED_useLexicalDecorators.js.flow +4 -1
- package/DEPRECATED_useLexicalEditor.d.ts +9 -0
- package/DEPRECATED_useLexicalEditor.dev.js +18 -9
- package/DEPRECATED_useLexicalEditor.prod.js +2 -2
- package/DEPRECATED_useLexicalEditorEvents.d.ts +10 -0
- package/DEPRECATED_useLexicalEditorEvents.js.flow +4 -1
- package/DEPRECATED_useLexicalHistory.d.ts +12 -0
- package/DEPRECATED_useLexicalHistory.js.flow +4 -1
- package/DEPRECATED_useLexicalList.d.ts +9 -0
- package/DEPRECATED_useLexicalList.js.flow +4 -1
- package/DEPRECATED_useLexicalPlainText.d.ts +10 -0
- package/DEPRECATED_useLexicalPlainText.js.flow +4 -1
- package/DEPRECATED_useLexicalRichText.d.ts +10 -0
- package/DEPRECATED_useLexicalRichText.js.flow +4 -1
- package/LexicalAutoFocusPlugin.d.ts +1 -2
- package/LexicalAutoFocusPlugin.dev.js +1 -1
- package/LexicalAutoFocusPlugin.prod.js +1 -1
- package/LexicalAutoLinkPlugin.d.ts +11 -11
- package/LexicalAutoScrollPlugin.d.ts +6 -4
- package/LexicalBlockWithAlignableContents.d.ts +12 -8
- package/LexicalBlockWithAlignableContents.dev.js +6 -6
- package/LexicalBlockWithAlignableContents.js.flow +4 -0
- package/LexicalBlockWithAlignableContents.prod.js +4 -4
- package/LexicalCharacterLimitPlugin.d.ts +3 -4
- package/LexicalCheckListPlugin.d.ts +1 -2
- package/LexicalCheckListPlugin.dev.js +11 -6
- package/LexicalCheckListPlugin.prod.js +7 -7
- package/LexicalClearEditorPlugin.d.ts +4 -4
- package/LexicalCollaborationPlugin.d.ts +17 -31
- package/LexicalComposer.d.ts +16 -15
- package/LexicalComposer.dev.js +39 -1
- package/LexicalComposer.js.flow +5 -0
- package/LexicalComposer.prod.js +3 -2
- package/LexicalComposerContext.d.ts +10 -15
- package/LexicalContentEditable.d.ts +24 -23
- package/LexicalContentEditable.dev.js +3 -3
- package/LexicalContentEditable.prod.js +1 -1
- package/LexicalDecoratorBlockNode.d.ts +13 -24
- package/LexicalDecoratorBlockNode.dev.js +1 -1
- package/LexicalDecoratorBlockNode.prod.js +1 -1
- package/LexicalHashtagPlugin.d.ts +1 -2
- package/LexicalHistoryPlugin.d.ts +6 -23
- package/LexicalHorizontalRuleNode.d.ts +19 -17
- package/LexicalLinkPlugin.d.ts +1 -2
- package/LexicalLinkPlugin.dev.js +1 -0
- package/LexicalListPlugin.d.ts +1 -2
- package/LexicalMarkdownShortcutPlugin.d.ts +4 -6
- package/LexicalNestedComposer.d.ts +7 -8
- package/LexicalOnChangePlugin.d.ts +5 -7
- package/LexicalPlainTextPlugin.d.ts +6 -9
- package/LexicalPlainTextPlugin.dev.js +43 -11
- package/LexicalPlainTextPlugin.prod.js +4 -4
- package/LexicalRichTextPlugin.d.ts +6 -9
- package/LexicalRichTextPlugin.dev.js +43 -11
- package/LexicalRichTextPlugin.prod.js +4 -4
- package/LexicalTablePlugin.d.ts +1 -2
- package/LexicalTablePlugin.dev.js +1 -1
- package/LexicalTablePlugin.prod.js +3 -3
- package/LexicalTreeView.d.ts +9 -11
- package/package.json +19 -22
- package/shared/useCanShowPlaceholder.d.ts +9 -0
- package/shared/useCharacterLimit.d.ts +16 -0
- package/shared/useDecorators.d.ts +9 -0
- package/shared/useEditorEvents.d.ts +10 -0
- package/shared/useHistory.d.ts +10 -0
- package/shared/useList.d.ts +9 -0
- package/shared/usePlainTextSetup.d.ts +10 -0
- package/shared/useRichTextSetup.d.ts +10 -0
- package/shared/useYjsCollaboration.d.ts +14 -0
- package/useLexicalIsTextContentEmpty.d.ts +2 -7
- package/useLexicalNodeSelection.d.ts +2 -6
- package/useLexicalTextEntity.d.ts +3 -13
|
@@ -9,10 +9,29 @@
|
|
|
9
9
|
var LexicalComposerContext = require('@lexical/react/LexicalComposerContext');
|
|
10
10
|
var React = require('react');
|
|
11
11
|
var text = require('@lexical/text');
|
|
12
|
+
var utils = require('@lexical/utils');
|
|
12
13
|
var reactDom = require('react-dom');
|
|
13
14
|
var dragon = require('@lexical/dragon');
|
|
14
15
|
var plainText = require('@lexical/plain-text');
|
|
15
|
-
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
19
|
+
*
|
|
20
|
+
* This source code is licensed under the MIT license found in the
|
|
21
|
+
* LICENSE file in the root directory of this source tree.
|
|
22
|
+
*
|
|
23
|
+
*/
|
|
24
|
+
function warnOnlyOnce(message) {
|
|
25
|
+
|
|
26
|
+
let run = false;
|
|
27
|
+
return () => {
|
|
28
|
+
if (!run) {
|
|
29
|
+
console.warn(message);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
run = true;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
16
35
|
|
|
17
36
|
/**
|
|
18
37
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
@@ -40,18 +59,26 @@ var useLayoutEffect = useLayoutEffectImpl;
|
|
|
40
59
|
* LICENSE file in the root directory of this source tree.
|
|
41
60
|
*
|
|
42
61
|
*/
|
|
62
|
+
|
|
63
|
+
function canShowPlaceholderFromCurrentEditorState(editor) {
|
|
64
|
+
const currentCanShowPlaceholder = editor.getEditorState().read(text.$canShowPlaceholderCurry(editor.isComposing(), editor.isReadOnly()));
|
|
65
|
+
return currentCanShowPlaceholder;
|
|
66
|
+
}
|
|
67
|
+
|
|
43
68
|
function useCanShowPlaceholder(editor) {
|
|
44
|
-
const [canShowPlaceholder, setCanShowPlaceholder] = React.useState(
|
|
69
|
+
const [canShowPlaceholder, setCanShowPlaceholder] = React.useState(() => canShowPlaceholderFromCurrentEditorState(editor));
|
|
45
70
|
useLayoutEffect(() => {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
return editor.registerUpdateListener(({
|
|
49
|
-
editorState
|
|
50
|
-
}) => {
|
|
51
|
-
const isComposing = editor.isComposing();
|
|
52
|
-
currentCanShowPlaceholder = editorState.read(text.$canShowPlaceholderCurry(isComposing));
|
|
71
|
+
function resetCanShowPlaceholder() {
|
|
72
|
+
const currentCanShowPlaceholder = canShowPlaceholderFromCurrentEditorState(editor);
|
|
53
73
|
setCanShowPlaceholder(currentCanShowPlaceholder);
|
|
54
|
-
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
resetCanShowPlaceholder();
|
|
77
|
+
return utils.mergeRegister(editor.registerUpdateListener(() => {
|
|
78
|
+
resetCanShowPlaceholder();
|
|
79
|
+
}), editor.registerReadOnlyListener(() => {
|
|
80
|
+
resetCanShowPlaceholder();
|
|
81
|
+
}));
|
|
55
82
|
}, [editor]);
|
|
56
83
|
return canShowPlaceholder;
|
|
57
84
|
}
|
|
@@ -119,15 +146,20 @@ function usePlainTextSetup(editor, initialEditorState) {
|
|
|
119
146
|
* LICENSE file in the root directory of this source tree.
|
|
120
147
|
*
|
|
121
148
|
*/
|
|
149
|
+
const deprecatedInitialEditorStateWarning = warnOnlyOnce('`initialEditorState` on `PlainTextPlugin` is deprecated and will be removed soon. Use the `initialConfig.editorState` prop on the `LexicalComposer` instead.');
|
|
122
150
|
function PlainTextPlugin({
|
|
123
151
|
contentEditable,
|
|
124
152
|
placeholder,
|
|
125
153
|
initialEditorState
|
|
126
154
|
}) {
|
|
155
|
+
if (deprecatedInitialEditorStateWarning && initialEditorState !== undefined) {
|
|
156
|
+
deprecatedInitialEditorStateWarning();
|
|
157
|
+
}
|
|
158
|
+
|
|
127
159
|
const [editor] = LexicalComposerContext.useLexicalComposerContext();
|
|
128
160
|
const showPlaceholder = useCanShowPlaceholder(editor);
|
|
129
|
-
usePlainTextSetup(editor, initialEditorState);
|
|
130
161
|
const decorators = useDecorators(editor);
|
|
162
|
+
usePlainTextSetup(editor, initialEditorState);
|
|
131
163
|
return /*#__PURE__*/React.createElement(React.Fragment, null, contentEditable, showPlaceholder && placeholder, decorators);
|
|
132
164
|
}
|
|
133
165
|
|
|
@@ -4,7 +4,7 @@
|
|
|
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
|
-
'use strict';var
|
|
8
|
-
function
|
|
9
|
-
function
|
|
10
|
-
exports.PlainTextPlugin=function({contentEditable:a,placeholder:c,initialEditorState:
|
|
7
|
+
'use strict';var d=require("@lexical/react/LexicalComposerContext"),h=require("react"),l=require("@lexical/text"),m=require("@lexical/utils"),n=require("react-dom"),p=require("@lexical/dragon"),q=require("@lexical/plain-text"),r="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement?h.useLayoutEffect:h.useEffect;function t(a){return a.getEditorState().read(l.$canShowPlaceholderCurry(a.isComposing(),a.isReadOnly()))}
|
|
8
|
+
function u(a){let [c,f]=h.useState(()=>t(a));r(()=>{function b(){let g=t(a);f(g)}b();return m.mergeRegister(a.registerUpdateListener(()=>{b()}),a.registerReadOnlyListener(()=>{b()}))},[a]);return c}
|
|
9
|
+
function v(a){let [c,f]=h.useState(()=>a.getDecorators());r(()=>a.registerDecoratorListener(b=>{n.flushSync(()=>{f(b)})}),[a]);h.useEffect(()=>{f(a.getDecorators())},[a]);return h.useMemo(()=>{let b=[],g=Object.keys(c);for(let k=0;k<g.length;k++){var e=g[k];let w=c[e];e=a.getElementByKey(e);null!==e&&b.push(n.createPortal(w,e))}return b},[c,a])}function x(a,c){r(()=>m.mergeRegister(q.registerPlainText(a,c),p.registerDragonSupport(a)),[a])}
|
|
10
|
+
exports.PlainTextPlugin=function({contentEditable:a,placeholder:c,initialEditorState:f}){let [b]=d.useLexicalComposerContext(),g=u(b),e=v(b);x(b,f);return h.createElement(h.Fragment,null,a,g&&c,e)}
|
|
@@ -5,12 +5,9 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
initialEditorState?: InitialEditorStateType;
|
|
15
|
-
placeholder: JSX.Element | string | null;
|
|
16
|
-
}): JSX.Element | null;
|
|
8
|
+
import { InitialEditorStateType } from '@lexical/rich-text';
|
|
9
|
+
export declare function RichTextPlugin({ contentEditable, placeholder, initialEditorState, }: Readonly<{
|
|
10
|
+
contentEditable: JSX.Element;
|
|
11
|
+
initialEditorState?: InitialEditorStateType;
|
|
12
|
+
placeholder: JSX.Element | string;
|
|
13
|
+
}>): JSX.Element;
|
|
@@ -9,10 +9,29 @@
|
|
|
9
9
|
var LexicalComposerContext = require('@lexical/react/LexicalComposerContext');
|
|
10
10
|
var React = require('react');
|
|
11
11
|
var text = require('@lexical/text');
|
|
12
|
+
var utils = require('@lexical/utils');
|
|
12
13
|
var reactDom = require('react-dom');
|
|
13
14
|
var dragon = require('@lexical/dragon');
|
|
14
15
|
var richText = require('@lexical/rich-text');
|
|
15
|
-
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
19
|
+
*
|
|
20
|
+
* This source code is licensed under the MIT license found in the
|
|
21
|
+
* LICENSE file in the root directory of this source tree.
|
|
22
|
+
*
|
|
23
|
+
*/
|
|
24
|
+
function warnOnlyOnce(message) {
|
|
25
|
+
|
|
26
|
+
let run = false;
|
|
27
|
+
return () => {
|
|
28
|
+
if (!run) {
|
|
29
|
+
console.warn(message);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
run = true;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
16
35
|
|
|
17
36
|
/**
|
|
18
37
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
@@ -40,18 +59,26 @@ var useLayoutEffect = useLayoutEffectImpl;
|
|
|
40
59
|
* LICENSE file in the root directory of this source tree.
|
|
41
60
|
*
|
|
42
61
|
*/
|
|
62
|
+
|
|
63
|
+
function canShowPlaceholderFromCurrentEditorState(editor) {
|
|
64
|
+
const currentCanShowPlaceholder = editor.getEditorState().read(text.$canShowPlaceholderCurry(editor.isComposing(), editor.isReadOnly()));
|
|
65
|
+
return currentCanShowPlaceholder;
|
|
66
|
+
}
|
|
67
|
+
|
|
43
68
|
function useCanShowPlaceholder(editor) {
|
|
44
|
-
const [canShowPlaceholder, setCanShowPlaceholder] = React.useState(
|
|
69
|
+
const [canShowPlaceholder, setCanShowPlaceholder] = React.useState(() => canShowPlaceholderFromCurrentEditorState(editor));
|
|
45
70
|
useLayoutEffect(() => {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
return editor.registerUpdateListener(({
|
|
49
|
-
editorState
|
|
50
|
-
}) => {
|
|
51
|
-
const isComposing = editor.isComposing();
|
|
52
|
-
currentCanShowPlaceholder = editorState.read(text.$canShowPlaceholderCurry(isComposing));
|
|
71
|
+
function resetCanShowPlaceholder() {
|
|
72
|
+
const currentCanShowPlaceholder = canShowPlaceholderFromCurrentEditorState(editor);
|
|
53
73
|
setCanShowPlaceholder(currentCanShowPlaceholder);
|
|
54
|
-
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
resetCanShowPlaceholder();
|
|
77
|
+
return utils.mergeRegister(editor.registerUpdateListener(() => {
|
|
78
|
+
resetCanShowPlaceholder();
|
|
79
|
+
}), editor.registerReadOnlyListener(() => {
|
|
80
|
+
resetCanShowPlaceholder();
|
|
81
|
+
}));
|
|
55
82
|
}, [editor]);
|
|
56
83
|
return canShowPlaceholder;
|
|
57
84
|
}
|
|
@@ -119,15 +146,20 @@ function useRichTextSetup(editor, initialEditorState) {
|
|
|
119
146
|
* LICENSE file in the root directory of this source tree.
|
|
120
147
|
*
|
|
121
148
|
*/
|
|
149
|
+
const deprecatedInitialEditorStateWarning = warnOnlyOnce('`initialEditorState` on `RichTextPlugin` is deprecated and will be removed soon. Use the `initialConfig.editorState` prop on the `LexicalComposer` instead.');
|
|
122
150
|
function RichTextPlugin({
|
|
123
151
|
contentEditable,
|
|
124
152
|
placeholder,
|
|
125
153
|
initialEditorState
|
|
126
154
|
}) {
|
|
155
|
+
if (deprecatedInitialEditorStateWarning && initialEditorState !== undefined) {
|
|
156
|
+
deprecatedInitialEditorStateWarning();
|
|
157
|
+
}
|
|
158
|
+
|
|
127
159
|
const [editor] = LexicalComposerContext.useLexicalComposerContext();
|
|
128
160
|
const showPlaceholder = useCanShowPlaceholder(editor);
|
|
129
|
-
useRichTextSetup(editor, initialEditorState);
|
|
130
161
|
const decorators = useDecorators(editor);
|
|
162
|
+
useRichTextSetup(editor, initialEditorState);
|
|
131
163
|
return /*#__PURE__*/React.createElement(React.Fragment, null, contentEditable, showPlaceholder && placeholder, decorators);
|
|
132
164
|
}
|
|
133
165
|
|
|
@@ -4,7 +4,7 @@
|
|
|
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
|
-
'use strict';var
|
|
8
|
-
function
|
|
9
|
-
function
|
|
10
|
-
exports.RichTextPlugin=function({contentEditable:a,placeholder:c,initialEditorState:
|
|
7
|
+
'use strict';var d=require("@lexical/react/LexicalComposerContext"),h=require("react"),l=require("@lexical/text"),m=require("@lexical/utils"),n=require("react-dom"),p=require("@lexical/dragon"),q=require("@lexical/rich-text"),r="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement?h.useLayoutEffect:h.useEffect;function t(a){return a.getEditorState().read(l.$canShowPlaceholderCurry(a.isComposing(),a.isReadOnly()))}
|
|
8
|
+
function u(a){let [c,f]=h.useState(()=>t(a));r(()=>{function b(){let g=t(a);f(g)}b();return m.mergeRegister(a.registerUpdateListener(()=>{b()}),a.registerReadOnlyListener(()=>{b()}))},[a]);return c}
|
|
9
|
+
function v(a){let [c,f]=h.useState(()=>a.getDecorators());r(()=>a.registerDecoratorListener(b=>{n.flushSync(()=>{f(b)})}),[a]);h.useEffect(()=>{f(a.getDecorators())},[a]);return h.useMemo(()=>{let b=[],g=Object.keys(c);for(let k=0;k<g.length;k++){var e=g[k];let w=c[e];e=a.getElementByKey(e);null!==e&&b.push(n.createPortal(w,e))}return b},[c,a])}function x(a,c){r(()=>m.mergeRegister(q.registerRichText(a,c),p.registerDragonSupport(a)),[a])}
|
|
10
|
+
exports.RichTextPlugin=function({contentEditable:a,placeholder:c,initialEditorState:f}){let [b]=d.useLexicalComposerContext(),g=u(b),e=v(b);x(b,f);return h.createElement(h.Fragment,null,a,g&&c,e)}
|
package/LexicalTablePlugin.d.ts
CHANGED
|
@@ -84,7 +84,7 @@ function TablePlugin() {
|
|
|
84
84
|
} else if (mutation === 'destroyed') {
|
|
85
85
|
const tableSelection = tableSelections.get(nodeKey);
|
|
86
86
|
|
|
87
|
-
if (tableSelection) {
|
|
87
|
+
if (tableSelection !== undefined) {
|
|
88
88
|
tableSelection.removeListeners();
|
|
89
89
|
tableSelections.delete(nodeKey);
|
|
90
90
|
}
|
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
'use strict';var e=require("@lexical/react/LexicalComposerContext"),f=require("@lexical/table"),k=require("lexical"),m=require("react");
|
|
8
|
-
exports.TablePlugin=function(){let [
|
|
9
|
-
(a=f.$createTableNodeWithDimensions(Number(
|
|
10
|
-
|
|
8
|
+
exports.TablePlugin=function(){let [d]=e.useLexicalComposerContext();m.useEffect(()=>{if(!d.hasNodes([f.TableNode,f.TableCellNode,f.TableRowNode]))throw Error("Minified Lexical error #10; see codes.json for the full message or use the non-minified dev environment for full errors and additional helpful warnings.");return d.registerCommand(f.INSERT_TABLE_COMMAND,({columns:a,rows:c,includeHeaders:g})=>{var b=k.$getSelection();if(!k.$isRangeSelection(b))return!0;let h=b.focus;b=h.getNode();null!==b&&
|
|
9
|
+
(a=f.$createTableNodeWithDimensions(Number(c),Number(a),g),k.$isRootNode(b)?(c=b.getChildAtIndex(h.offset),null!==c?c.insertBefore(a):b.append(a),a.insertBefore(k.$createParagraphNode())):b.getTopLevelElementOrThrow().insertAfter(a),a.insertAfter(k.$createParagraphNode()),a.getFirstChildOrThrow().getFirstChildOrThrow().select());return!0},k.COMMAND_PRIORITY_EDITOR)},[d]);m.useEffect(()=>{let a=new Map;return d.registerMutationListener(f.TableNode,c=>{for(let [g,b]of c)"created"===b?d.update(()=>{var h=
|
|
10
|
+
d.getElementByKey(g);let l=k.$getNodeByKey(g);h&&l&&(h=f.applyTableHandlers(l,h,d),a.set(g,h))}):"destroyed"===b&&(c=a.get(g),void 0!==c&&(c.removeListeners(),a.delete(g)))})},[d]);return null}
|
package/LexicalTreeView.d.ts
CHANGED
|
@@ -5,14 +5,12 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
editor: LexicalEditor;
|
|
18
|
-
}): JSX.Element | null;
|
|
8
|
+
import type { LexicalEditor } from 'lexical';
|
|
9
|
+
export declare function TreeView({ timeTravelButtonClassName, timeTravelPanelSliderClassName, timeTravelPanelButtonClassName, viewClassName, timeTravelPanelClassName, editor, }: {
|
|
10
|
+
editor: LexicalEditor;
|
|
11
|
+
timeTravelButtonClassName: string;
|
|
12
|
+
timeTravelPanelButtonClassName: string;
|
|
13
|
+
timeTravelPanelClassName: string;
|
|
14
|
+
timeTravelPanelSliderClassName: string;
|
|
15
|
+
viewClassName: string;
|
|
16
|
+
}): JSX.Element;
|
package/package.json
CHANGED
|
@@ -8,28 +8,28 @@
|
|
|
8
8
|
"rich-text"
|
|
9
9
|
],
|
|
10
10
|
"license": "MIT",
|
|
11
|
-
"version": "0.3.
|
|
11
|
+
"version": "0.3.6",
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@lexical/clipboard": "0.3.
|
|
14
|
-
"@lexical/code": "0.3.
|
|
15
|
-
"@lexical/dragon": "0.3.
|
|
16
|
-
"@lexical/hashtag": "0.3.
|
|
17
|
-
"@lexical/history": "0.3.
|
|
18
|
-
"@lexical/link": "0.3.
|
|
19
|
-
"@lexical/list": "0.3.
|
|
20
|
-
"@lexical/mark": "0.3.
|
|
21
|
-
"@lexical/markdown": "0.3.
|
|
22
|
-
"@lexical/overflow": "0.3.
|
|
23
|
-
"@lexical/plain-text": "0.3.
|
|
24
|
-
"@lexical/rich-text": "0.3.
|
|
25
|
-
"@lexical/selection": "0.3.
|
|
26
|
-
"@lexical/table": "0.3.
|
|
27
|
-
"@lexical/text": "0.3.
|
|
28
|
-
"@lexical/utils": "0.3.
|
|
29
|
-
"@lexical/yjs": "0.3.
|
|
13
|
+
"@lexical/clipboard": "0.3.6",
|
|
14
|
+
"@lexical/code": "0.3.6",
|
|
15
|
+
"@lexical/dragon": "0.3.6",
|
|
16
|
+
"@lexical/hashtag": "0.3.6",
|
|
17
|
+
"@lexical/history": "0.3.6",
|
|
18
|
+
"@lexical/link": "0.3.6",
|
|
19
|
+
"@lexical/list": "0.3.6",
|
|
20
|
+
"@lexical/mark": "0.3.6",
|
|
21
|
+
"@lexical/markdown": "0.3.6",
|
|
22
|
+
"@lexical/overflow": "0.3.6",
|
|
23
|
+
"@lexical/plain-text": "0.3.6",
|
|
24
|
+
"@lexical/rich-text": "0.3.6",
|
|
25
|
+
"@lexical/selection": "0.3.6",
|
|
26
|
+
"@lexical/table": "0.3.6",
|
|
27
|
+
"@lexical/text": "0.3.6",
|
|
28
|
+
"@lexical/utils": "0.3.6",
|
|
29
|
+
"@lexical/yjs": "0.3.6"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
|
-
"lexical": "0.3.
|
|
32
|
+
"lexical": "0.3.6",
|
|
33
33
|
"react": ">=17.x",
|
|
34
34
|
"react-dom": ">=17.x"
|
|
35
35
|
},
|
|
@@ -37,8 +37,5 @@
|
|
|
37
37
|
"type": "git",
|
|
38
38
|
"url": "https://github.com/facebook/lexical",
|
|
39
39
|
"directory": "packages/lexical-react"
|
|
40
|
-
},
|
|
41
|
-
"devDependencies": {
|
|
42
|
-
"utility-types": "^3.10.0"
|
|
43
40
|
}
|
|
44
41
|
}
|
|
@@ -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
|
+
import type { LexicalEditor } from 'lexical';
|
|
9
|
+
export declare function useCanShowPlaceholder(editor: LexicalEditor): boolean;
|
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
import { OverflowNode } from '@lexical/overflow';
|
|
10
|
+
declare type OptionalProps = {
|
|
11
|
+
remainingCharacters?: (characters: number) => void;
|
|
12
|
+
strlen?: (input: string) => number;
|
|
13
|
+
};
|
|
14
|
+
export declare function useCharacterLimit(editor: LexicalEditor, maxCharacters: number, optional?: OptionalProps): void;
|
|
15
|
+
export declare function mergePrevious(overflowNode: OverflowNode): void;
|
|
16
|
+
export {};
|
|
@@ -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
|
+
import type { LexicalEditor } from 'lexical';
|
|
9
|
+
export declare function useDecorators(editor: LexicalEditor): Array<JSX.Element>;
|
|
@@ -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
|
+
*/
|
|
8
|
+
import type { EventHandler, LexicalEditor } from 'lexical';
|
|
9
|
+
export declare type InputEvents = Array<[string, EventHandler]>;
|
|
10
|
+
export declare function useEditorEvents(events: InputEvents, editor: LexicalEditor): void;
|
|
@@ -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
|
+
*/
|
|
8
|
+
import type { HistoryState } from '@lexical/history';
|
|
9
|
+
import type { LexicalEditor } from 'lexical';
|
|
10
|
+
export declare function useHistory(editor: LexicalEditor, externalHistoryState?: HistoryState, delay?: number): void;
|
|
@@ -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
|
+
import type { LexicalEditor } from 'lexical';
|
|
9
|
+
export declare function useList(editor: LexicalEditor): void;
|
|
@@ -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
|
+
*/
|
|
8
|
+
import type { LexicalEditor } from 'lexical';
|
|
9
|
+
import { InitialEditorStateType } from '@lexical/plain-text';
|
|
10
|
+
export declare function usePlainTextSetup(editor: LexicalEditor, initialEditorState?: InitialEditorStateType): void;
|
|
@@ -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
|
+
*/
|
|
8
|
+
import type { InitialEditorStateType } from '@lexical/rich-text';
|
|
9
|
+
import type { LexicalEditor } from 'lexical';
|
|
10
|
+
export declare function useRichTextSetup(editor: LexicalEditor, initialEditorState?: InitialEditorStateType): void;
|
|
@@ -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
|
+
*/
|
|
8
|
+
import type { Binding } from '@lexical/yjs';
|
|
9
|
+
import type { LexicalEditor } from 'lexical';
|
|
10
|
+
import type { Doc } from 'yjs';
|
|
11
|
+
import { WebsocketProvider } from 'y-websocket';
|
|
12
|
+
export declare function useYjsCollaboration(editor: LexicalEditor, id: string, provider: WebsocketProvider, docMap: Map<string, Doc>, name: string, color: string, shouldBootstrap: boolean): [JSX.Element, Binding];
|
|
13
|
+
export declare function useYjsFocusTracking(editor: LexicalEditor, provider: WebsocketProvider, name: string, color: string): void;
|
|
14
|
+
export declare function useYjsHistory(editor: LexicalEditor, binding: Binding): () => void;
|
|
@@ -5,10 +5,5 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
export function useLexicalIsTextContentEmpty(
|
|
12
|
-
editor: LexicalEditor,
|
|
13
|
-
trim?: boolean,
|
|
14
|
-
): boolean;
|
|
8
|
+
import type { LexicalEditor } from 'lexical';
|
|
9
|
+
export declare function useLexicalIsTextContentEmpty(editor: LexicalEditor, trim?: boolean): boolean;
|
|
@@ -5,9 +5,5 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
export function useLexicalNodeSelection(
|
|
12
|
-
key: NodeKey,
|
|
13
|
-
): [boolean, (arg0: boolean) => void, () => void];
|
|
8
|
+
import type { NodeKey } from 'lexical';
|
|
9
|
+
export declare function useLexicalNodeSelection(key: NodeKey): [boolean, (arg0: boolean) => void, () => void];
|
|
@@ -5,16 +5,6 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
|
-
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
export type EntityMatch = {
|
|
13
|
-
end: number;
|
|
14
|
-
start: number;
|
|
15
|
-
};
|
|
16
|
-
export function useLexicalTextEntity<N extends TextNode>(
|
|
17
|
-
getMatch: (text: string) => null | EntityMatch,
|
|
18
|
-
targetNode: Class<N>,
|
|
19
|
-
createNode: (textNode: TextNode) => N,
|
|
20
|
-
): void;
|
|
8
|
+
import type { EntityMatch } from '@lexical/text';
|
|
9
|
+
import type { Klass, TextNode } from 'lexical';
|
|
10
|
+
export declare function useLexicalTextEntity<T extends TextNode>(getMatch: (text: string) => null | EntityMatch, targetNode: Klass<T>, createNode: (textNode: TextNode) => T): void;
|