@lexical/react 0.1.4 → 0.1.8
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 +84 -0
- package/DEPRECATED_useLexical.js +9 -2
- package/DEPRECATED_useLexical.prod.js +8 -0
- package/DEPRECATED_useLexicalAutoFormatter.dev.js +642 -0
- package/DEPRECATED_useLexicalAutoFormatter.js +9 -12
- package/DEPRECATED_useLexicalAutoFormatter.prod.js +22 -0
- package/DEPRECATED_useLexicalCanShowPlaceholder.dev.js +136 -0
- package/DEPRECATED_useLexicalCanShowPlaceholder.js +9 -3
- package/DEPRECATED_useLexicalCanShowPlaceholder.prod.js +8 -0
- package/DEPRECATED_useLexicalCharacterLimit.dev.js +294 -0
- package/DEPRECATED_useLexicalCharacterLimit.js +9 -9
- package/DEPRECATED_useLexicalCharacterLimit.prod.js +14 -0
- package/DEPRECATED_useLexicalDecorators.dev.js +82 -0
- package/DEPRECATED_useLexicalDecorators.js +9 -2
- package/DEPRECATED_useLexicalDecorators.prod.js +8 -0
- package/DEPRECATED_useLexicalEditor.dev.js +52 -0
- package/DEPRECATED_useLexicalEditor.js +9 -1
- package/DEPRECATED_useLexicalEditor.prod.js +7 -0
- package/DEPRECATED_useLexicalEditorEvents.dev.js +96 -0
- package/DEPRECATED_useLexicalEditorEvents.js +9 -2
- package/DEPRECATED_useLexicalEditorEvents.prod.js +8 -0
- package/DEPRECATED_useLexicalHistory.dev.js +339 -0
- package/DEPRECATED_useLexicalHistory.js +9 -7
- package/DEPRECATED_useLexicalHistory.prod.js +13 -0
- package/DEPRECATED_useLexicalList.dev.js +64 -0
- package/DEPRECATED_useLexicalList.js +9 -12
- package/DEPRECATED_useLexicalList.prod.js +7 -0
- package/DEPRECATED_useLexicalPlainText.dev.js +755 -0
- package/DEPRECATED_useLexicalPlainText.js +9 -17
- package/DEPRECATED_useLexicalPlainText.prod.js +22 -0
- package/DEPRECATED_useLexicalRichText.dev.js +1326 -0
- package/DEPRECATED_useLexicalRichText.js +9 -30
- package/DEPRECATED_useLexicalRichText.prod.js +35 -0
- package/LexicalAutoFormatterPlugin.dev.js +645 -0
- package/LexicalAutoFormatterPlugin.js +9 -13
- package/LexicalAutoFormatterPlugin.prod.js +23 -0
- package/LexicalAutoLinkPlugin.dev.js +227 -0
- package/LexicalAutoLinkPlugin.js +9 -5
- package/LexicalAutoLinkPlugin.prod.js +12 -0
- package/LexicalBootstrapPlugin.dev.js +124 -0
- package/LexicalBootstrapPlugin.js +9 -0
- package/LexicalBootstrapPlugin.prod.js +8 -0
- package/LexicalCharacterLimitPlugin.dev.js +352 -0
- package/LexicalCharacterLimitPlugin.js +9 -10
- package/LexicalCharacterLimitPlugin.prod.js +14 -0
- package/LexicalCollaborationPlugin.dev.js +235 -0
- package/LexicalCollaborationPlugin.js +9 -8
- package/LexicalCollaborationPlugin.prod.js +14 -0
- package/LexicalComposer.dev.js +76 -0
- package/LexicalComposer.js +9 -2
- package/LexicalComposer.prod.js +9 -0
- package/LexicalComposerContext.dev.js +53 -0
- package/LexicalComposerContext.js +9 -1
- package/LexicalComposerContext.prod.js +7 -0
- package/LexicalContentEditable.dev.js +71 -0
- package/LexicalContentEditable.js +9 -3
- package/LexicalContentEditable.prod.js +9 -0
- package/LexicalHashtagPlugin.dev.js +152 -0
- package/LexicalHashtagPlugin.js +9 -4
- package/LexicalHashtagPlugin.prod.js +10 -0
- package/LexicalHistoryPlugin.dev.js +344 -0
- package/LexicalHistoryPlugin.js +9 -7
- package/LexicalHistoryPlugin.prod.js +13 -0
- package/LexicalHorizontalRulePlugin.dev.js +51 -0
- package/LexicalHorizontalRulePlugin.js +9 -1
- package/LexicalHorizontalRulePlugin.prod.js +7 -0
- package/LexicalLinkPlugin.dev.js +137 -0
- package/LexicalLinkPlugin.js +9 -3
- package/LexicalLinkPlugin.prod.js +9 -0
- package/LexicalListPlugin.dev.js +67 -0
- package/LexicalListPlugin.js +9 -12
- package/LexicalListPlugin.prod.js +8 -0
- package/LexicalNestedComposer.dev.js +60 -0
- package/LexicalNestedComposer.js +9 -1
- package/LexicalNestedComposer.prod.js +8 -0
- package/LexicalOnChangePlugin.dev.js +57 -0
- package/LexicalOnChangePlugin.js +9 -1
- package/LexicalOnChangePlugin.prod.js +7 -0
- package/LexicalPlainTextPlugin.dev.js +565 -0
- package/LexicalPlainTextPlugin.js +9 -13
- package/LexicalPlainTextPlugin.prod.js +17 -0
- package/LexicalRichTextPlugin.dev.js +1136 -0
- package/LexicalRichTextPlugin.js +9 -26
- package/LexicalRichTextPlugin.prod.js +31 -0
- package/LexicalTablePlugin.dev.js +95 -0
- package/LexicalTablePlugin.js +9 -4
- package/LexicalTablePlugin.prod.js +9 -0
- package/LexicalTreeView.dev.js +340 -0
- package/LexicalTreeView.js +9 -12
- package/LexicalTreeView.prod.js +19 -0
- package/README.md +11 -6
- package/package.json +4 -4
- package/useLexicalDecoratorMap.dev.js +83 -0
- package/useLexicalDecoratorMap.js +9 -1
- package/useLexicalDecoratorMap.prod.js +8 -0
- package/useLexicalIsTextContentEmpty.dev.js +84 -0
- package/useLexicalIsTextContentEmpty.js +9 -2
- package/useLexicalIsTextContentEmpty.prod.js +8 -0
- package/withSubscriptions.dev.js +23 -0
- package/withSubscriptions.js +9 -1
- package/withSubscriptions.prod.js +7 -0
package/LexicalListPlugin.js
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
function B(d){d.forEach(a=>{if(!C(a)){var b=a.getParent(),c=b?b.getParent():void 0,e=c?c.getParent():void 0;if(q.$isListNode(e)&&p.$isListItemNode(c)&&q.$isListNode(b)){var f=b?b.getFirstChild():void 0,h=b?b.getLastChild():void 0;if(a.is(f))c.insertBefore(a),b.isEmpty()&&c.remove();else if(a.is(h))c.insertAfter(a),b.isEmpty()&&c.remove();else{var k=b.getTag();f=p.$createListItemNode();const n=q.$createListNode(k);f.append(n);a.getPreviousSiblings().forEach(D=>n.append(D));h=p.$createListItemNode();
|
|
11
|
-
k=q.$createListNode(k);h.append(k);k.append(...a.getNextSiblings());c.insertBefore(f);c.insertAfter(h);c.replace(a)}b.getChildren().forEach(n=>n.markDirty());e.getChildren().forEach(n=>n.markDirty())}}})}
|
|
12
|
-
function E(d){l.useEffect(()=>d.addListener("command",a=>{if("indentContent"===a){if(z("indent"))return!0}else if("outdentContent"===a){if(z("outdent"))return!0}else{if("insertOrderedList"===a)return y(d,"ol"),!0;if("insertUnorderedList"===a)return y(d,"ul"),!0;if("removeList"===a)return w(d),!0}return!1},1),[d])}module.exports=function(){const [d]=g.useLexicalComposerContext();E(d);return null};
|
|
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 LexicalListPlugin = process.env.NODE_ENV === 'development' ? require('./LexicalListPlugin.dev.js') : require('./LexicalListPlugin.prod.js')
|
|
9
|
+
module.exports = LexicalListPlugin;
|
|
@@ -0,0 +1,8 @@
|
|
|
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("@lexical/react/LexicalComposerContext"),d=require("@lexical/list"),e=require("react");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}return!1},1),[a])}
|
|
8
|
+
module.exports=function(){const [a]=b.useLexicalComposerContext();f(a);return null};
|
|
@@ -0,0 +1,60 @@
|
|
|
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 LexicalComposer = require('@lexical/react/LexicalComposer');
|
|
10
|
+
var LexicalOnChangePlugin = require('@lexical/react/LexicalOnChangePlugin');
|
|
11
|
+
var React = require('react');
|
|
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
|
+
function LexicalNestedComposer({
|
|
22
|
+
initialConfig = {},
|
|
23
|
+
children
|
|
24
|
+
}) {
|
|
25
|
+
const [nestedEditor, setNestedEditor] = React.useState(null);
|
|
26
|
+
const {
|
|
27
|
+
decoratorEditor,
|
|
28
|
+
namespace,
|
|
29
|
+
theme,
|
|
30
|
+
nodes,
|
|
31
|
+
onError
|
|
32
|
+
} = initialConfig;
|
|
33
|
+
React.useEffect(() => {
|
|
34
|
+
if (!decoratorEditor.isEmpty() && nestedEditor !== null) {
|
|
35
|
+
decoratorEditor.init(nestedEditor);
|
|
36
|
+
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
37
|
+
|
|
38
|
+
}, [nestedEditor]);
|
|
39
|
+
const onChange = React.useCallback((editorState, nextNestedEditor) => {
|
|
40
|
+
if (!editorState.isEmpty()) {
|
|
41
|
+
decoratorEditor.set(nextNestedEditor);
|
|
42
|
+
} else {
|
|
43
|
+
setNestedEditor(nextNestedEditor);
|
|
44
|
+
}
|
|
45
|
+
}, // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
46
|
+
[]);
|
|
47
|
+
return /*#__PURE__*/React.createElement(LexicalComposer, {
|
|
48
|
+
initialConfig: {
|
|
49
|
+
editor: decoratorEditor.editor,
|
|
50
|
+
namespace,
|
|
51
|
+
nodes,
|
|
52
|
+
onError,
|
|
53
|
+
theme
|
|
54
|
+
}
|
|
55
|
+
}, /*#__PURE__*/React.createElement(LexicalOnChangePlugin, {
|
|
56
|
+
onChange: onChange
|
|
57
|
+
}), children);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
module.exports = LexicalNestedComposer;
|
package/LexicalNestedComposer.js
CHANGED
|
@@ -1 +1,9 @@
|
|
|
1
|
-
|
|
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 LexicalNestedComposer = process.env.NODE_ENV === 'development' ? require('./LexicalNestedComposer.dev.js') : require('./LexicalNestedComposer.prod.js')
|
|
9
|
+
module.exports = LexicalNestedComposer;
|
|
@@ -0,0 +1,8 @@
|
|
|
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 a=require("@lexical/react/LexicalComposer"),f=require("@lexical/react/LexicalOnChangePlugin"),g=require("react");
|
|
8
|
+
module.exports=function({initialConfig:c={},children:h}){const [d,k]=g.useState(null),{decoratorEditor:b,namespace:l,theme:m,nodes:n,onError:p}=c;g.useEffect(()=>{b.isEmpty()||null===d||b.init(d)},[d]);c=g.useCallback((q,e)=>{q.isEmpty()?k(e):b.set(e)},[]);return g.createElement(a,{initialConfig:{editor:b.editor,namespace:l,nodes:n,onError:p,theme:m}},g.createElement(f,{onChange:c}),h)};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
'use strict';
|
|
8
|
+
|
|
9
|
+
var LexicalComposerContext = require('@lexical/react/LexicalComposerContext');
|
|
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
|
+
*/
|
|
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
|
+
|
|
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
|
+
*/
|
|
41
|
+
function OnChangePlugin({
|
|
42
|
+
onChange
|
|
43
|
+
}) {
|
|
44
|
+
const [editor] = LexicalComposerContext.useLexicalComposerContext();
|
|
45
|
+
useLayoutEffect(() => {
|
|
46
|
+
if (onChange) {
|
|
47
|
+
return editor.addListener('update', ({
|
|
48
|
+
editorState
|
|
49
|
+
}) => {
|
|
50
|
+
onChange(editorState, editor);
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}, [editor, onChange]);
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
module.exports = OnChangePlugin;
|
package/LexicalOnChangePlugin.js
CHANGED
|
@@ -1 +1,9 @@
|
|
|
1
|
-
|
|
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 LexicalOnChangePlugin = process.env.NODE_ENV === 'development' ? require('./LexicalOnChangePlugin.dev.js') : require('./LexicalOnChangePlugin.prod.js')
|
|
9
|
+
module.exports = LexicalOnChangePlugin;
|
|
@@ -0,0 +1,7 @@
|
|
|
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 c=require("@lexical/react/LexicalComposerContext"),d=require("react"),e="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement?d.useLayoutEffect:d.useEffect;module.exports=function({onChange:a}){const [b]=c.useLexicalComposerContext();e(()=>{if(a)return b.addListener("update",({editorState:f})=>{a(f,b)})},[b,a]);return null};
|