@lexical/react 0.1.16 → 0.1.17
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_useLexicalAutoFormatter.dev.js +5 -729
- package/DEPRECATED_useLexicalAutoFormatter.prod.js +1 -19
- package/DEPRECATED_useLexicalCanShowPlaceholder.dev.js +1 -1
- package/DEPRECATED_useLexicalCanShowPlaceholder.prod.js +1 -1
- package/DEPRECATED_useLexicalCharacterLimit.dev.js +9 -10
- package/DEPRECATED_useLexicalCharacterLimit.prod.js +7 -7
- package/DEPRECATED_useLexicalDecorators.dev.js +1 -1
- package/DEPRECATED_useLexicalDecorators.prod.js +1 -1
- package/DEPRECATED_useLexicalEditorEvents.dev.js +1 -1
- package/DEPRECATED_useLexicalEditorEvents.prod.js +1 -1
- package/DEPRECATED_useLexicalHistory.dev.js +5 -307
- package/DEPRECATED_useLexicalHistory.prod.js +1 -7
- package/DEPRECATED_useLexicalList.dev.js +29 -25
- package/DEPRECATED_useLexicalList.prod.js +3 -1
- package/DEPRECATED_useLexicalPlainText.dev.js +8 -662
- package/DEPRECATED_useLexicalPlainText.prod.js +2 -14
- package/DEPRECATED_useLexicalRichText.dev.js +8 -747
- package/DEPRECATED_useLexicalRichText.prod.js +2 -17
- package/LICENSE +1 -1
- package/{withSubscriptions.prod.js → LexicalAutoFocusPlugin.d.ts} +3 -1
- package/{withSubscriptions.dev.js → LexicalAutoFocusPlugin.dev.js} +10 -5
- package/LexicalAutoFocusPlugin.js +9 -0
- package/{LexicalAutoFormatterPlugin.js.flow → LexicalAutoFocusPlugin.js.flow} +1 -1
- package/LexicalAutoFocusPlugin.prod.js +7 -0
- package/LexicalAutoLinkPlugin.dev.js +12 -15
- package/LexicalAutoLinkPlugin.prod.js +6 -6
- package/LexicalAutoScrollPlugin.d.ts +13 -0
- package/LexicalAutoScrollPlugin.dev.js +82 -0
- package/LexicalAutoScrollPlugin.js +9 -0
- package/{withSubscriptions.d.ts → LexicalAutoScrollPlugin.js.flow} +5 -5
- package/LexicalAutoScrollPlugin.prod.js +8 -0
- package/LexicalCharacterLimitPlugin.dev.js +9 -10
- package/LexicalCharacterLimitPlugin.prod.js +7 -7
- package/LexicalClearEditorPlugin.dev.js +15 -19
- package/LexicalClearEditorPlugin.prod.js +1 -1
- package/LexicalCollaborationPlugin.d.ts +6 -3
- package/LexicalCollaborationPlugin.dev.js +30 -41
- package/LexicalCollaborationPlugin.js.flow +7 -4
- package/LexicalCollaborationPlugin.prod.js +10 -9
- package/LexicalComposer.d.ts +2 -2
- package/LexicalComposer.dev.js +3 -19
- package/LexicalComposer.js.flow +2 -2
- package/LexicalComposer.prod.js +2 -3
- package/LexicalContentEditable.dev.js +3 -1
- package/LexicalContentEditable.prod.js +2 -2
- package/LexicalHashtagPlugin.dev.js +20 -94
- package/LexicalHashtagPlugin.prod.js +4 -7
- package/LexicalHistoryPlugin.dev.js +5 -307
- package/LexicalHistoryPlugin.prod.js +1 -7
- package/LexicalHorizontalRuleNode.d.ts +3 -1
- package/LexicalHorizontalRuleNode.dev.js +2 -0
- package/LexicalHorizontalRuleNode.js.flow +6 -2
- package/LexicalHorizontalRuleNode.prod.js +2 -2
- package/LexicalLinkPlugin.dev.js +19 -20
- package/LexicalLinkPlugin.prod.js +4 -3
- package/LexicalListPlugin.dev.js +29 -25
- package/LexicalListPlugin.prod.js +3 -2
- package/{LexicalAutoFormatterPlugin.d.ts → LexicalMarkdownShortcutPlugin.d.ts} +1 -1
- package/LexicalMarkdownShortcutPlugin.dev.js +42 -0
- package/LexicalMarkdownShortcutPlugin.js +9 -0
- package/{withSubscriptions.js.flow → LexicalMarkdownShortcutPlugin.js.flow} +1 -4
- package/LexicalMarkdownShortcutPlugin.prod.js +7 -0
- package/LexicalNestedComposer.dev.js +20 -15
- package/LexicalNestedComposer.prod.js +3 -3
- package/LexicalOnChangePlugin.dev.js +1 -1
- package/LexicalOnChangePlugin.prod.js +1 -1
- package/LexicalPlainTextPlugin.dev.js +6 -359
- package/LexicalPlainTextPlugin.prod.js +4 -11
- package/LexicalRichTextPlugin.dev.js +6 -444
- package/LexicalRichTextPlugin.prod.js +4 -12
- package/LexicalTablePlugin.dev.js +27 -30
- package/LexicalTablePlugin.prod.js +3 -3
- package/LexicalTreeView.dev.js +1 -1
- package/LexicalTreeView.prod.js +1 -1
- package/package.json +17 -14
- package/useLexicalIsTextContentEmpty.dev.js +1 -1
- package/useLexicalIsTextContentEmpty.prod.js +1 -1
- package/useLexicalNodeSelection.dev.js +1 -1
- package/useLexicalNodeSelection.prod.js +1 -1
- package/useLexicalTextEntity.d.ts +19 -0
- package/useLexicalTextEntity.dev.js +29 -0
- package/{withSubscriptions.js → useLexicalTextEntity.js} +2 -2
- package/useLexicalTextEntity.js.flow +18 -0
- package/useLexicalTextEntity.prod.js +7 -0
- package/LexicalAutoFormatterPlugin.dev.js +0 -766
- package/LexicalAutoFormatterPlugin.js +0 -9
- package/LexicalAutoFormatterPlugin.prod.js +0 -25
package/package.json
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lexical/react",
|
|
3
|
-
"author": {
|
|
4
|
-
"name": "Dominic Gannaway",
|
|
5
|
-
"email": "dg@domgan.com"
|
|
6
|
-
},
|
|
7
3
|
"description": "This package provides Lexical components and hooks for React applications.",
|
|
8
4
|
"keywords": [
|
|
9
5
|
"react",
|
|
@@ -12,19 +8,26 @@
|
|
|
12
8
|
"rich-text"
|
|
13
9
|
],
|
|
14
10
|
"license": "MIT",
|
|
15
|
-
"version": "0.1.
|
|
11
|
+
"version": "0.1.17",
|
|
16
12
|
"dependencies": {
|
|
17
|
-
"@lexical/clipboard": "0.1.
|
|
18
|
-
"@lexical/list": "0.1.
|
|
19
|
-
"@lexical/table": "0.1.
|
|
20
|
-
"@lexical/yjs": "0.1.
|
|
21
|
-
"@lexical/hashtag": "0.1.
|
|
22
|
-
"@lexical/selection": "0.1.
|
|
23
|
-
"@lexical/utils": "0.1.
|
|
24
|
-
"@lexical/
|
|
13
|
+
"@lexical/clipboard": "0.1.17",
|
|
14
|
+
"@lexical/list": "0.1.17",
|
|
15
|
+
"@lexical/table": "0.1.17",
|
|
16
|
+
"@lexical/yjs": "0.1.17",
|
|
17
|
+
"@lexical/hashtag": "0.1.17",
|
|
18
|
+
"@lexical/selection": "0.1.17",
|
|
19
|
+
"@lexical/utils": "0.1.17",
|
|
20
|
+
"@lexical/dragon": "0.1.17",
|
|
21
|
+
"@lexical/plain-text": "0.1.17",
|
|
22
|
+
"@lexical/rich-text": "0.1.17",
|
|
23
|
+
"@lexical/code": "0.1.17",
|
|
24
|
+
"@lexical/text": "0.1.17",
|
|
25
|
+
"@lexical/link": "0.1.17",
|
|
26
|
+
"@lexical/overflow": "0.1.17",
|
|
27
|
+
"@lexical/history": "0.1.17"
|
|
25
28
|
},
|
|
26
29
|
"peerDependencies": {
|
|
27
|
-
"lexical": "0.1.
|
|
30
|
+
"lexical": "0.1.17",
|
|
28
31
|
"react": ">=17.x",
|
|
29
32
|
"react-dom": ">=17.x"
|
|
30
33
|
},
|
|
@@ -41,7 +41,7 @@ var useLayoutEffect = useLayoutEffectImpl;
|
|
|
41
41
|
function useLexicalIsTextContentEmpty(editor, trim) {
|
|
42
42
|
const [isEmpty, setIsEmpty] = react.useState(editor.getEditorState().read(text.$isRootTextContentEmptyCurry(editor.isComposing(), trim)));
|
|
43
43
|
useLayoutEffect(() => {
|
|
44
|
-
return editor.
|
|
44
|
+
return editor.registerUpdateListener(({
|
|
45
45
|
editorState
|
|
46
46
|
}) => {
|
|
47
47
|
const isComposing = editor.isComposing();
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
var b=require("@lexical/text"),e=require("react"),f="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement?e.useLayoutEffect:e.useEffect;module.exports=function(a,c){const [g,h]=e.useState(a.getEditorState().read(b.$isRootTextContentEmptyCurry(a.isComposing(),c)));f(()=>a.
|
|
7
|
+
var b=require("@lexical/text"),e=require("react"),f="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement?e.useLayoutEffect:e.useEffect;module.exports=function(a,c){const [g,h]=e.useState(a.getEditorState().read(b.$isRootTextContentEmptyCurry(a.isComposing(),c)));f(()=>a.registerUpdateListener(({editorState:d})=>{const k=a.isComposing();d=d.read(b.$isRootTextContentEmptyCurry(k,c));h(d)}),[a,c]);return g};
|
|
@@ -35,7 +35,7 @@ function useLexicalNodeSelection(key) {
|
|
|
35
35
|
const [editor] = LexicalComposerContext.useLexicalComposerContext();
|
|
36
36
|
const [isSelected, setIsSelected] = react.useState(() => isNodeSelected(editor, key));
|
|
37
37
|
react.useEffect(() => {
|
|
38
|
-
return editor.
|
|
38
|
+
return editor.registerUpdateListener(() => {
|
|
39
39
|
setIsSelected(isNodeSelected(editor, key));
|
|
40
40
|
});
|
|
41
41
|
}, [editor, key]);
|
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
var c=require("@lexical/react/LexicalComposerContext"),e=require("lexical"),h=require("react");function k(b,a){return b.getEditorState().read(()=>{const f=e.$getNodeByKey(a);return null===f?!1:f.isSelected()})}
|
|
8
|
-
module.exports=function(b){const [a]=c.useLexicalComposerContext(),[f,l]=h.useState(()=>k(a,b));h.useEffect(()=>a.
|
|
8
|
+
module.exports=function(b){const [a]=c.useLexicalComposerContext(),[f,l]=h.useState(()=>k(a,b));h.useEffect(()=>a.registerUpdateListener(()=>{l(k(a,b))}),[a,b]);const m=h.useCallback(g=>{a.update(()=>{let d=e.$getSelection();e.$isNodeSelection(d)||(d=e.$createNodeSelection(),e.$setSelection(d));g?d.add(b):d.delete(b)})},[a,b]),n=h.useCallback(()=>{a.update(()=>{const g=e.$getSelection();e.$isNodeSelection(g)&&g.clear()})},[a]);return[f,m,n]};
|
|
@@ -0,0 +1,19 @@
|
|
|
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 {TextNode} from 'lexical';
|
|
11
|
+
export type EntityMatch = {
|
|
12
|
+
end: number;
|
|
13
|
+
start: number;
|
|
14
|
+
};
|
|
15
|
+
export default function useLexicalTextEntity<N extends TextNode>(
|
|
16
|
+
getMatch: (text: string) => null | EntityMatch,
|
|
17
|
+
targetNode: Class<N>,
|
|
18
|
+
createNode: (textNode: TextNode) => N,
|
|
19
|
+
): void;
|
|
@@ -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
|
+
'use strict';
|
|
8
|
+
|
|
9
|
+
var LexicalComposerContext = require('@lexical/react/LexicalComposerContext');
|
|
10
|
+
var text = require('@lexical/text');
|
|
11
|
+
var utils = require('@lexical/utils');
|
|
12
|
+
var react = require('react');
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
16
|
+
*
|
|
17
|
+
* This source code is licensed under the MIT license found in the
|
|
18
|
+
* LICENSE file in the root directory of this source tree.
|
|
19
|
+
*
|
|
20
|
+
*
|
|
21
|
+
*/
|
|
22
|
+
function useLexicalTextEntity(getMatch, targetNode, createNode) {
|
|
23
|
+
const [editor] = LexicalComposerContext.useLexicalComposerContext();
|
|
24
|
+
react.useEffect(() => {
|
|
25
|
+
return utils.mergeRegister(...text.registerLexicalTextEntity(editor, getMatch, targetNode, createNode));
|
|
26
|
+
}, [createNode, editor, getMatch, targetNode]);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
module.exports = useLexicalTextEntity;
|
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
'use strict'
|
|
8
|
-
const
|
|
9
|
-
module.exports =
|
|
8
|
+
const useLexicalTextEntity = process.env.NODE_ENV === 'development' ? require('./useLexicalTextEntity.dev.js') : require('./useLexicalTextEntity.prod.js')
|
|
9
|
+
module.exports = useLexicalTextEntity;
|
|
@@ -0,0 +1,18 @@
|
|
|
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 {TextNode} from 'lexical';
|
|
11
|
+
|
|
12
|
+
export type EntityMatch = {end: number, start: number};
|
|
13
|
+
|
|
14
|
+
declare export default function useLexicalTextEntity<N: TextNode>(
|
|
15
|
+
getMatch: (text: string) => null | EntityMatch,
|
|
16
|
+
targetNode: Class<N>,
|
|
17
|
+
createNode: (textNode: TextNode) => N,
|
|
18
|
+
): void;
|
|
@@ -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
|
+
var e=require("@lexical/react/LexicalComposerContext"),f=require("@lexical/text"),g=require("@lexical/utils"),h=require("react");module.exports=function(a,b,c){const [d]=e.useLexicalComposerContext();h.useEffect(()=>g.mergeRegister(...f.registerLexicalTextEntity(d,a,b,c)),[c,d,a,b])};
|