@lexical/react 0.2.8 → 0.3.1

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.
Files changed (135) hide show
  1. package/DEPRECATED_useLexical.dev.js +55 -4
  2. package/DEPRECATED_useLexical.js.flow +23 -0
  3. package/DEPRECATED_useLexical.prod.js +3 -1
  4. package/DEPRECATED_useLexicalAutoFormatter.dev.js +1 -2
  5. package/DEPRECATED_useLexicalAutoFormatter.js.flow +12 -0
  6. package/DEPRECATED_useLexicalAutoFormatter.prod.js +1 -1
  7. package/DEPRECATED_useLexicalCanShowPlaceholder.dev.js +6 -8
  8. package/DEPRECATED_useLexicalCanShowPlaceholder.js.flow +12 -0
  9. package/DEPRECATED_useLexicalCanShowPlaceholder.prod.js +2 -1
  10. package/DEPRECATED_useLexicalCharacterLimit.dev.js +5 -3
  11. package/DEPRECATED_useLexicalCharacterLimit.js.flow +28 -0
  12. package/DEPRECATED_useLexicalCharacterLimit.prod.js +6 -6
  13. package/DEPRECATED_useLexicalDecorators.dev.js +7 -5
  14. package/DEPRECATED_useLexicalDecorators.js.flow +14 -0
  15. package/DEPRECATED_useLexicalDecorators.prod.js +2 -2
  16. package/DEPRECATED_useLexicalEditor.dev.js +55 -3
  17. package/DEPRECATED_useLexicalEditor.prod.js +2 -1
  18. package/DEPRECATED_useLexicalEditorEvents.dev.js +1 -5
  19. package/DEPRECATED_useLexicalEditorEvents.js.flow +19 -0
  20. package/DEPRECATED_useLexicalEditorEvents.prod.js +2 -2
  21. package/DEPRECATED_useLexicalHistory.dev.js +0 -2
  22. package/DEPRECATED_useLexicalHistory.js.flow +31 -0
  23. package/DEPRECATED_useLexicalHistory.prod.js +1 -1
  24. package/DEPRECATED_useLexicalList.dev.js +3 -5
  25. package/DEPRECATED_useLexicalList.js.flow +10 -0
  26. package/DEPRECATED_useLexicalList.prod.js +2 -2
  27. package/DEPRECATED_useLexicalPlainText.dev.js +1 -7
  28. package/DEPRECATED_useLexicalPlainText.js.flow +15 -0
  29. package/DEPRECATED_useLexicalPlainText.prod.js +2 -2
  30. package/DEPRECATED_useLexicalRichText.dev.js +1 -7
  31. package/DEPRECATED_useLexicalRichText.js.flow +15 -0
  32. package/DEPRECATED_useLexicalRichText.prod.js +2 -2
  33. package/LexicalAutoFocusPlugin.d.ts +1 -1
  34. package/LexicalAutoFocusPlugin.dev.js +17 -4
  35. package/LexicalAutoFocusPlugin.js.flow +1 -1
  36. package/LexicalAutoFocusPlugin.prod.js +1 -1
  37. package/LexicalAutoLinkPlugin.d.ts +1 -1
  38. package/LexicalAutoLinkPlugin.dev.js +4 -5
  39. package/LexicalAutoLinkPlugin.js.flow +2 -1
  40. package/LexicalAutoLinkPlugin.prod.js +5 -5
  41. package/LexicalAutoScrollPlugin.d.ts +1 -1
  42. package/LexicalAutoScrollPlugin.dev.js +2 -5
  43. package/LexicalAutoScrollPlugin.js.flow +1 -3
  44. package/LexicalAutoScrollPlugin.prod.js +2 -2
  45. package/LexicalBlockWithAlignableContents.d.ts +1 -3
  46. package/LexicalBlockWithAlignableContents.dev.js +7 -9
  47. package/LexicalBlockWithAlignableContents.prod.js +4 -4
  48. package/LexicalCharacterLimitPlugin.d.ts +1 -1
  49. package/LexicalCharacterLimitPlugin.dev.js +6 -5
  50. package/LexicalCharacterLimitPlugin.js.flow +1 -1
  51. package/LexicalCharacterLimitPlugin.prod.js +8 -8
  52. package/LexicalCheckListPlugin.d.ts +1 -1
  53. package/LexicalCheckListPlugin.dev.js +9 -17
  54. package/LexicalCheckListPlugin.js.flow +1 -1
  55. package/LexicalCheckListPlugin.prod.js +7 -7
  56. package/LexicalClearEditorPlugin.d.ts +2 -6
  57. package/LexicalClearEditorPlugin.dev.js +2 -5
  58. package/LexicalClearEditorPlugin.js.flow +1 -1
  59. package/LexicalClearEditorPlugin.prod.js +2 -2
  60. package/LexicalCollaborationPlugin.d.ts +1 -0
  61. package/LexicalCollaborationPlugin.dev.js +9 -5
  62. package/LexicalCollaborationPlugin.prod.js +9 -9
  63. package/LexicalComposer.d.ts +2 -2
  64. package/LexicalComposer.dev.js +1 -6
  65. package/LexicalComposer.js.flow +1 -1
  66. package/LexicalComposer.prod.js +2 -2
  67. package/LexicalComposerContext.dev.js +0 -1
  68. package/LexicalComposerContext.prod.js +1 -1
  69. package/LexicalContentEditable.d.ts +2 -5
  70. package/LexicalContentEditable.dev.js +5 -7
  71. package/LexicalContentEditable.js.flow +1 -3
  72. package/LexicalContentEditable.prod.js +3 -3
  73. package/LexicalDecoratorBlockNode.d.ts +11 -2
  74. package/LexicalDecoratorBlockNode.dev.js +8 -1
  75. package/LexicalDecoratorBlockNode.prod.js +1 -1
  76. package/LexicalHashtagPlugin.d.ts +1 -1
  77. package/LexicalHashtagPlugin.dev.js +2 -3
  78. package/LexicalHashtagPlugin.js.flow +1 -1
  79. package/LexicalHashtagPlugin.prod.js +3 -3
  80. package/LexicalHistoryPlugin.d.ts +1 -0
  81. package/LexicalHistoryPlugin.dev.js +0 -2
  82. package/LexicalHistoryPlugin.prod.js +1 -1
  83. package/LexicalHorizontalRuleNode.d.ts +1 -1
  84. package/LexicalHorizontalRuleNode.dev.js +5 -17
  85. package/LexicalHorizontalRuleNode.prod.js +3 -3
  86. package/LexicalLinkPlugin.d.ts +1 -1
  87. package/LexicalLinkPlugin.dev.js +3 -107
  88. package/LexicalLinkPlugin.js.flow +1 -1
  89. package/LexicalLinkPlugin.prod.js +1 -4
  90. package/LexicalListPlugin.d.ts +1 -1
  91. package/LexicalListPlugin.dev.js +9 -6
  92. package/LexicalListPlugin.js.flow +1 -1
  93. package/LexicalListPlugin.prod.js +3 -3
  94. package/LexicalMarkdownShortcutPlugin.d.ts +2 -2
  95. package/LexicalMarkdownShortcutPlugin.dev.js +7 -83
  96. package/LexicalMarkdownShortcutPlugin.js.flow +2 -2
  97. package/LexicalMarkdownShortcutPlugin.prod.js +2 -3
  98. package/LexicalNestedComposer.d.ts +1 -1
  99. package/LexicalNestedComposer.dev.js +1 -2
  100. package/LexicalNestedComposer.js.flow +1 -1
  101. package/LexicalNestedComposer.prod.js +3 -3
  102. package/LexicalOnChangePlugin.d.ts +2 -1
  103. package/LexicalOnChangePlugin.dev.js +1 -4
  104. package/LexicalOnChangePlugin.js.flow +1 -1
  105. package/LexicalOnChangePlugin.prod.js +2 -2
  106. package/LexicalPlainTextPlugin.d.ts +3 -2
  107. package/LexicalPlainTextPlugin.dev.js +12 -10
  108. package/LexicalPlainTextPlugin.js.flow +1 -1
  109. package/LexicalPlainTextPlugin.prod.js +4 -4
  110. package/LexicalRichTextPlugin.d.ts +3 -2
  111. package/LexicalRichTextPlugin.dev.js +12 -10
  112. package/LexicalRichTextPlugin.js.flow +1 -1
  113. package/LexicalRichTextPlugin.prod.js +4 -4
  114. package/LexicalTablePlugin.d.ts +1 -1
  115. package/LexicalTablePlugin.dev.js +7 -8
  116. package/LexicalTablePlugin.js.flow +1 -1
  117. package/LexicalTablePlugin.prod.js +4 -4
  118. package/LexicalTreeView.d.ts +2 -1
  119. package/LexicalTreeView.dev.js +4 -5
  120. package/LexicalTreeView.js.flow +1 -1
  121. package/LexicalTreeView.prod.js +11 -11
  122. package/README.md +10 -6
  123. package/package.json +19 -19
  124. package/useLexicalIsTextContentEmpty.d.ts +2 -1
  125. package/useLexicalIsTextContentEmpty.dev.js +2 -5
  126. package/useLexicalIsTextContentEmpty.js.flow +1 -1
  127. package/useLexicalIsTextContentEmpty.prod.js +1 -1
  128. package/useLexicalNodeSelection.d.ts +2 -1
  129. package/useLexicalNodeSelection.dev.js +1 -2
  130. package/useLexicalNodeSelection.js.flow +1 -1
  131. package/useLexicalNodeSelection.prod.js +2 -2
  132. package/useLexicalTextEntity.d.ts +2 -1
  133. package/useLexicalTextEntity.dev.js +1 -2
  134. package/useLexicalTextEntity.js.flow +1 -1
  135. package/useLexicalTextEntity.prod.js +1 -1
@@ -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/list"),c=require("@lexical/utils"),d=require("lexical"),e=require("react");
7
+ 'use strict';var b=require("@lexical/list"),c=require("@lexical/utils"),d=require("lexical"),e=require("react");
8
8
  function f(a){e.useEffect(()=>c.mergeRegister(a.registerCommand(d.INDENT_CONTENT_COMMAND,()=>{b.indentList();return!1},d.COMMAND_PRIORITY_LOW),a.registerCommand(d.OUTDENT_CONTENT_COMMAND,()=>{b.outdentList();return!1},d.COMMAND_PRIORITY_LOW),a.registerCommand(b.INSERT_ORDERED_LIST_COMMAND,()=>{b.insertList(a,"number");return!0},d.COMMAND_PRIORITY_LOW),a.registerCommand(b.INSERT_UNORDERED_LIST_COMMAND,()=>{b.insertList(a,"bullet");return!0},d.COMMAND_PRIORITY_LOW),a.registerCommand(b.REMOVE_LIST_COMMAND,
9
- ()=>{b.removeList(a);return!0},d.COMMAND_PRIORITY_LOW),a.registerCommand(d.INSERT_PARAGRAPH_COMMAND,()=>b.$handleListInsertParagraph()?!0:!1,d.COMMAND_PRIORITY_LOW)),[a])}module.exports=function(a){f(a)};
9
+ ()=>{b.removeList(a);return!0},d.COMMAND_PRIORITY_LOW),a.registerCommand(d.INSERT_PARAGRAPH_COMMAND,()=>b.$handleListInsertParagraph()?!0:!1,d.COMMAND_PRIORITY_LOW)),[a])}exports.useLexicalList=function(a){f(a)}
@@ -18,7 +18,6 @@ var utils = require('@lexical/utils');
18
18
  * This source code is licensed under the MIT license found in the
19
19
  * LICENSE file in the root directory of this source tree.
20
20
  *
21
- *
22
21
  */
23
22
  function useHistory(editor, externalHistoryState, delay = 1000) {
24
23
  const historyState = react.useMemo(() => externalHistoryState || history.createEmptyHistoryState(), [externalHistoryState]);
@@ -33,7 +32,6 @@ function useHistory(editor, externalHistoryState, delay = 1000) {
33
32
  * This source code is licensed under the MIT license found in the
34
33
  * LICENSE file in the root directory of this source tree.
35
34
  *
36
- *
37
35
  */
38
36
  function useLexicalHistory(editor, externalHistoryState, delay = 1000) {
39
37
  return useHistory(editor, externalHistoryState, delay);
@@ -45,7 +43,6 @@ function useLexicalHistory(editor, externalHistoryState, delay = 1000) {
45
43
  * This source code is licensed under the MIT license found in the
46
44
  * LICENSE file in the root directory of this source tree.
47
45
  *
48
- *
49
46
  */
50
47
  const CAN_USE_DOM = typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined';
51
48
 
@@ -55,7 +52,6 @@ const CAN_USE_DOM = typeof window !== 'undefined' && typeof window.document !==
55
52
  * This source code is licensed under the MIT license found in the
56
53
  * LICENSE file in the root directory of this source tree.
57
54
  *
58
- *
59
55
  */
60
56
  const useLayoutEffectImpl = CAN_USE_DOM ? react.useLayoutEffect : react.useEffect;
61
57
  var useLayoutEffect = useLayoutEffectImpl;
@@ -66,7 +62,6 @@ var useLayoutEffect = useLayoutEffectImpl;
66
62
  * This source code is licensed under the MIT license found in the
67
63
  * LICENSE file in the root directory of this source tree.
68
64
  *
69
- *
70
65
  */
71
66
  function usePlainTextSetup(editor, initialEditorState) {
72
67
  useLayoutEffect(() => {
@@ -81,11 +76,10 @@ function usePlainTextSetup(editor, initialEditorState) {
81
76
  * This source code is licensed under the MIT license found in the
82
77
  * LICENSE file in the root directory of this source tree.
83
78
  *
84
- *
85
79
  */
86
80
  function useLexicalPlainText(editor, externalHistoryState, initialEditorState) {
87
81
  usePlainTextSetup(editor, initialEditorState);
88
82
  useLexicalHistory(editor, externalHistoryState);
89
83
  }
90
84
 
91
- module.exports = useLexicalPlainText;
85
+ exports.useLexicalPlainText = useLexicalPlainText;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * (c) Meta Platforms, Inc. and affiliates. Confidential and proprietary.
3
+ *
4
+ * @flow strict
5
+ * @format
6
+ */
7
+
8
+ import type {HistoryState} from '@lexical/react/DEPRECATED_useLexicalHistory';
9
+ import type {EditorState, LexicalEditor} from 'lexical';
10
+
11
+ declare export function useLexicalPlainText(
12
+ editor: LexicalEditor,
13
+ externalHistoryState?: HistoryState,
14
+ initialEditorState?: null | string | EditorState | (() => void),
15
+ ): void;
@@ -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 d=require("@lexical/history"),e=require("react"),g=require("@lexical/dragon"),h=require("@lexical/plain-text"),k=require("@lexical/utils");function l(a,b,c=1E3){const f=e.useMemo(()=>b||d.createEmptyHistoryState(),[b]);e.useEffect(()=>d.registerHistory(a,f,c),[c,a,f])}function m(a,b,c=1E3){return l(a,b,c)}var n="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement?e.useLayoutEffect:e.useEffect;
8
- function p(a,b){n(()=>k.mergeRegister(h.registerPlainText(a,b),g.registerDragonSupport(a)),[a])}module.exports=function(a,b,c){p(a,c);m(a,b)};
7
+ 'use strict';var history=require("@lexical/history"),d=require("react"),f=require("@lexical/dragon"),g=require("@lexical/plain-text"),h=require("@lexical/utils");function k(a,b,c=1E3){let e=d.useMemo(()=>b||history.createEmptyHistoryState(),[b]);d.useEffect(()=>history.registerHistory(a,e,c),[c,a,e])}function l(a,b,c=1E3){return k(a,b,c)}var m="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement?d.useLayoutEffect:d.useEffect;
8
+ function n(a,b){m(()=>h.mergeRegister(g.registerPlainText(a,b),f.registerDragonSupport(a)),[a])}exports.useLexicalPlainText=function(a,b,c){n(a,c);l(a,b)}
@@ -18,7 +18,6 @@ var utils = require('@lexical/utils');
18
18
  * This source code is licensed under the MIT license found in the
19
19
  * LICENSE file in the root directory of this source tree.
20
20
  *
21
- *
22
21
  */
23
22
  function useHistory(editor, externalHistoryState, delay = 1000) {
24
23
  const historyState = react.useMemo(() => externalHistoryState || history.createEmptyHistoryState(), [externalHistoryState]);
@@ -33,7 +32,6 @@ function useHistory(editor, externalHistoryState, delay = 1000) {
33
32
  * This source code is licensed under the MIT license found in the
34
33
  * LICENSE file in the root directory of this source tree.
35
34
  *
36
- *
37
35
  */
38
36
  function useLexicalHistory(editor, externalHistoryState, delay = 1000) {
39
37
  return useHistory(editor, externalHistoryState, delay);
@@ -45,7 +43,6 @@ function useLexicalHistory(editor, externalHistoryState, delay = 1000) {
45
43
  * This source code is licensed under the MIT license found in the
46
44
  * LICENSE file in the root directory of this source tree.
47
45
  *
48
- *
49
46
  */
50
47
  const CAN_USE_DOM = typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined';
51
48
 
@@ -55,7 +52,6 @@ const CAN_USE_DOM = typeof window !== 'undefined' && typeof window.document !==
55
52
  * This source code is licensed under the MIT license found in the
56
53
  * LICENSE file in the root directory of this source tree.
57
54
  *
58
- *
59
55
  */
60
56
  const useLayoutEffectImpl = CAN_USE_DOM ? react.useLayoutEffect : react.useEffect;
61
57
  var useLayoutEffect = useLayoutEffectImpl;
@@ -66,7 +62,6 @@ var useLayoutEffect = useLayoutEffectImpl;
66
62
  * This source code is licensed under the MIT license found in the
67
63
  * LICENSE file in the root directory of this source tree.
68
64
  *
69
- *
70
65
  */
71
66
  function useRichTextSetup(editor, initialEditorState) {
72
67
  useLayoutEffect(() => {
@@ -81,11 +76,10 @@ function useRichTextSetup(editor, initialEditorState) {
81
76
  * This source code is licensed under the MIT license found in the
82
77
  * LICENSE file in the root directory of this source tree.
83
78
  *
84
- *
85
79
  */
86
80
  function useLexicalRichText(editor, externalHistoryState, initialEditorState) {
87
81
  useRichTextSetup(editor, initialEditorState);
88
82
  useLexicalHistory(editor, externalHistoryState);
89
83
  }
90
84
 
91
- module.exports = useLexicalRichText;
85
+ exports.useLexicalRichText = useLexicalRichText;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * (c) Meta Platforms, Inc. and affiliates. Confidential and proprietary.
3
+ *
4
+ * @flow strict
5
+ * @format
6
+ */
7
+
8
+ import type {HistoryState} from '@lexical/react/DEPRECATED_useLexicalHistory';
9
+ import type {EditorState, LexicalEditor} from 'lexical';
10
+
11
+ declare export function useLexicalRichText(
12
+ editor: LexicalEditor,
13
+ externalHistoryState?: HistoryState,
14
+ initialEditorState?: null | string | EditorState | (() => void),
15
+ ): void;
@@ -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 d=require("@lexical/history"),e=require("react"),g=require("@lexical/dragon"),h=require("@lexical/rich-text"),k=require("@lexical/utils");function l(a,b,c=1E3){const f=e.useMemo(()=>b||d.createEmptyHistoryState(),[b]);e.useEffect(()=>d.registerHistory(a,f,c),[c,a,f])}function m(a,b,c=1E3){return l(a,b,c)}var n="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement?e.useLayoutEffect:e.useEffect;
8
- function p(a,b){n(()=>k.mergeRegister(h.registerRichText(a,b),g.registerDragonSupport(a)),[a])}module.exports=function(a,b,c){p(a,c);m(a,b)};
7
+ 'use strict';var history=require("@lexical/history"),d=require("react"),f=require("@lexical/dragon"),g=require("@lexical/rich-text"),h=require("@lexical/utils");function k(a,b,c=1E3){let e=d.useMemo(()=>b||history.createEmptyHistoryState(),[b]);d.useEffect(()=>history.registerHistory(a,e,c),[c,a,e])}function l(a,b,c=1E3){return k(a,b,c)}var m="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement?d.useLayoutEffect:d.useEffect;
8
+ function n(a,b){m(()=>h.mergeRegister(g.registerRichText(a,b),f.registerDragonSupport(a)),[a])}exports.useLexicalRichText=function(a,b,c){n(a,c);l(a,b)}
@@ -6,4 +6,4 @@
6
6
  *
7
7
  */
8
8
 
9
- export default function LexicalAutoFocusPlugin(): null;
9
+ export function AutoFocusPlugin(): null;
@@ -15,14 +15,27 @@ var react = require('react');
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
17
  *
18
- *
19
18
  */
20
- function LexicalAutoFocusPlugin() {
19
+ function AutoFocusPlugin() {
21
20
  const [editor] = LexicalComposerContext.useLexicalComposerContext();
22
21
  react.useEffect(() => {
23
- editor.focus();
22
+ editor.focus(() => {
23
+ // If we try and move selection to the same point with setBaseAndExtent, it won't
24
+ // trigger a re-focus on the element. So in the case this occurs, we'll need to correct it.
25
+ // Normally this is fine, Selection API !== Focus API, but fore the intents of the naming
26
+ // of this plugin, which should preserve focus too.
27
+ const activeElement = document.activeElement;
28
+ const rootElement = editor.getRootElement();
29
+
30
+ if (rootElement !== null || activeElement === null || !rootElement.contains(activeElement)) {
31
+ // Note: preventScroll won't work in Webkit.
32
+ rootElement.focus({
33
+ preventScroll: true
34
+ });
35
+ }
36
+ });
24
37
  }, [editor]);
25
38
  return null;
26
39
  }
27
40
 
28
- module.exports = LexicalAutoFocusPlugin;
41
+ exports.AutoFocusPlugin = AutoFocusPlugin;
@@ -7,4 +7,4 @@
7
7
  * @flow strict
8
8
  */
9
9
 
10
- declare export default function LexicalAutoFocusPlugin(): null;
10
+ declare export function AutoFocusPlugin(): null;
@@ -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/react/LexicalComposerContext"),c=require("react");module.exports=function(){const [a]=b.useLexicalComposerContext();c.useEffect(()=>{a.focus()},[a]);return null};
7
+ 'use strict';var d=require("@lexical/react/LexicalComposerContext"),e=require("react");exports.AutoFocusPlugin=function(){let [a]=d.useLexicalComposerContext();e.useEffect(()=>{a.focus(()=>{let c=document.activeElement,b=a.getRootElement();null===b&&null!==c&&b.contains(c)||b.focus({preventScroll:!0})})},[a]);return null}
@@ -14,7 +14,7 @@ type LinkMatcherResult = {
14
14
  index: number;
15
15
  };
16
16
  export type LinkMatcher = (text: string) => LinkMatcherResult | null;
17
- export default function LexicalAutoLinkPlugin(props: {
17
+ export function AutoLinkPlugin(props: {
18
18
  matchers: Array<LinkMatcher>;
19
19
  onChange?: ChangeHandler;
20
20
  }): JSX.Element | null;
@@ -13,12 +13,11 @@ var lexical = require('lexical');
13
13
  var react = require('react');
14
14
 
15
15
  /**
16
- * Copyright (c) Facebook, Inc. and its affiliates.
16
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
17
17
  *
18
18
  * This source code is licensed under the MIT license found in the
19
19
  * LICENSE file in the root directory of this source tree.
20
20
  *
21
- *
22
21
  */
23
22
 
24
23
  function findFirstMatch(text, matchers) {
@@ -188,9 +187,9 @@ function useAutoLink(editor, matchers, onChange) {
188
187
  }
189
188
  }
190
189
 
191
- const onChangeWrapped = (...args) => {
190
+ const onChangeWrapped = (url, prevUrl) => {
192
191
  if (onChange) {
193
- onChange(...args);
192
+ onChange(url, prevUrl);
194
193
  }
195
194
  };
196
195
 
@@ -221,4 +220,4 @@ function AutoLinkPlugin({
221
220
  return null;
222
221
  }
223
222
 
224
- module.exports = AutoLinkPlugin;
223
+ exports.AutoLinkPlugin = AutoLinkPlugin;
@@ -15,9 +15,10 @@ type LinkMatcherResult = {
15
15
  length: number,
16
16
  index: number,
17
17
  };
18
+
18
19
  export type LinkMatcher = (text: string) => LinkMatcherResult | null;
19
20
 
20
- declare export default function LexicalAutoLinkPlugin(props: {
21
+ declare export function AutoLinkPlugin(props: {
21
22
  matchers: Array<LinkMatcher>,
22
23
  onChange?: ChangeHandler,
23
24
  }): React$Node;
@@ -4,9 +4,9 @@
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 h=require("@lexical/link"),k=require("@lexical/react/LexicalComposerContext"),p=require("@lexical/utils"),v=require("lexical"),w=require("react");function x(a,b){for(let c=0;c<b.length;c++){const d=b[c](a);if(d)return d}return null}function y(a){a=a.getPreviousSibling();v.$isElementNode(a)&&(a=a.getLastDescendant());return null===a||v.$isLineBreakNode(a)||v.$isTextNode(a)&&a.getTextContent().endsWith(" ")}
7
+ 'use strict';var h=require("@lexical/link"),l=require("@lexical/react/LexicalComposerContext"),p=require("@lexical/utils"),v=require("lexical"),w=require("react");function x(a,c){for(let b=0;b<c.length;b++){let e=c[b](a);if(e)return e}return null}function y(a){a=a.getPreviousSibling();v.$isElementNode(a)&&(a=a.getLastDescendant());return null===a||v.$isLineBreakNode(a)||v.$isTextNode(a)&&a.getTextContent().endsWith(" ")}
8
8
  function A(a){a=a.getNextSibling();v.$isElementNode(a)&&(a=a.getFirstDescendant());return null===a||v.$isLineBreakNode(a)||v.$isTextNode(a)&&a.getTextContent().startsWith(" ")}
9
- function B(a,b,c){var d=a.getChildren();const e=d.length;for(let g=0;g<e;g++){const f=d[g];if(!v.$isTextNode(f)||!f.isSimpleText()){C(a);c(null,a.getURL());return}}d=a.getTextContent();b=x(d,b);null===b||b.text!==d?(C(a),c(null,a.getURL())):y(a)&&A(a)?(d=a.getURL(),null!==b&&d!==b.url&&(a.setURL(b.url),c(b.url,d))):(C(a),c(null,a.getURL()))}function C(a){const b=a.getChildren();var c=b.length;for(--c;0<=c;c--)a.insertAfter(b[c]);a.remove();return b.map(d=>d.getLatest())}
10
- function D(a,b,c){w.useEffect(()=>{if(!a.hasNodes([h.AutoLinkNode]))throw Error("Minified Lexical error #5; see codes.json for the full message or use the non-minified dev environment for full errors and additional helpful warnings.");const d=(...e)=>{c&&c(...e)};return p.mergeRegister(a.registerNodeTransform(v.TextNode,e=>{var g=e.getParentOrThrow();if(h.$isAutoLinkNode(g))B(g,b,d);else if(!h.$isLinkNode(g)){if(e.isSimpleText()){g=e.getTextContent();const E=g.length;let u=g,z=0,t=e;for(var f;(f=
11
- x(u,b))&&null!==f;){var l=f.index,n=z+l;const q=f.length;var r=void 0;r=0<n?" "===g[n-1]:y(e);n=n+q<E?" "===g[n+q]:A(e);if(r&&n){var m=void 0;0===l?[m,t]=t.splitText(q):[,m,t]=t.splitText(l,l+q);r=h.$createAutoLinkNode(f.url);r.append(v.$createTextNode(f.text));m.replace(r);d(f.url,null)}l+=q;u=u.substring(l);z+=l}}f=e.getPreviousSibling();m=e.getNextSibling();e=e.getTextContent();h.$isAutoLinkNode(f)&&!e.startsWith(" ")&&(C(f),d(null,f.getURL()));h.$isAutoLinkNode(m)&&!e.endsWith(" ")&&(C(m),d(null,
12
- m.getURL()))}}),a.registerNodeTransform(h.AutoLinkNode,e=>{B(e,b,d)}))},[a,b,c])}module.exports=function({matchers:a,onChange:b}){const [c]=k.useLexicalComposerContext();D(c,a,b);return null};
9
+ function B(a,c,b){var e=a.getChildren();let d=e.length;for(let f=0;f<d;f++){let g=e[f];if(!v.$isTextNode(g)||!g.isSimpleText()){C(a);b(null,a.getURL());return}}e=a.getTextContent();c=x(e,c);null===c||c.text!==e?(C(a),b(null,a.getURL())):y(a)&&A(a)?(e=a.getURL(),null!==c&&e!==c.url&&(a.setURL(c.url),b(c.url,e))):(C(a),b(null,a.getURL()))}function C(a){let c=a.getChildren();var b=c.length;for(--b;0<=b;b--)a.insertAfter(c[b]);a.remove();return c.map(e=>e.getLatest())}
10
+ function D(a,c,b){w.useEffect(()=>{if(!a.hasNodes([h.AutoLinkNode]))throw Error("Minified Lexical error #7; see codes.json for the full message or use the non-minified dev environment for full errors and additional helpful warnings.");let e=(d,f)=>{b&&b(d,f)};return p.mergeRegister(a.registerNodeTransform(v.TextNode,d=>{var f=d.getParentOrThrow();if(h.$isAutoLinkNode(f))B(f,c,e);else if(!h.$isLinkNode(f)){if(d.isSimpleText()){f=d.getTextContent();let E=f.length,u=f,z=0,t=d;for(var g;(g=x(u,c))&&null!==
11
+ g;){var m=g.index,n=z+m;let q=g.length;var r=void 0;r=0<n?" "===f[n-1]:y(d);n=n+q<E?" "===f[n+q]:A(d);if(r&&n){var k=void 0;0===m?[k,t]=t.splitText(q):[,k,t]=t.splitText(m,m+q);r=h.$createAutoLinkNode(g.url);r.append(v.$createTextNode(g.text));k.replace(r);b&&b(g.url,null)}m+=q;u=u.substring(m);z+=m}}k=d.getPreviousSibling();g=d.getNextSibling();d=d.getTextContent();h.$isAutoLinkNode(k)&&!d.startsWith(" ")&&(C(k),k=k.getURL(),b&&b(null,k));h.$isAutoLinkNode(g)&&!d.endsWith(" ")&&(C(g),d=g.getURL(),
12
+ b&&b(null,d))}}),a.registerNodeTransform(h.AutoLinkNode,d=>{B(d,c,e)}))},[a,c,b])}exports.AutoLinkPlugin=function({matchers:a,onChange:c}){let [b]=l.useLexicalComposerContext();D(b,a,c);return null}
@@ -9,4 +9,4 @@
9
9
  type Props = Readonly<{
10
10
  scrollRef: {current: HTMLElement | null};
11
11
  }>;
12
- export default function LexicalAutoScrollPlugin(props: Props): null;
12
+ export function AutoScrollPlugin(props: Props): null;
@@ -16,7 +16,6 @@ var react = require('react');
16
16
  * This source code is licensed under the MIT license found in the
17
17
  * LICENSE file in the root directory of this source tree.
18
18
  *
19
- *
20
19
  */
21
20
  const CAN_USE_DOM = typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined';
22
21
 
@@ -26,7 +25,6 @@ const CAN_USE_DOM = typeof window !== 'undefined' && typeof window.document !==
26
25
  * This source code is licensed under the MIT license found in the
27
26
  * LICENSE file in the root directory of this source tree.
28
27
  *
29
- *
30
28
  */
31
29
  const useLayoutEffectImpl = CAN_USE_DOM ? react.useLayoutEffect : react.useEffect;
32
30
  var useLayoutEffect = useLayoutEffectImpl;
@@ -37,9 +35,8 @@ var useLayoutEffect = useLayoutEffectImpl;
37
35
  * This source code is licensed under the MIT license found in the
38
36
  * LICENSE file in the root directory of this source tree.
39
37
  *
40
- *
41
38
  */
42
- function LexicalAutoScrollPlugin({
39
+ function AutoScrollPlugin({
43
40
  scrollRef
44
41
  }) {
45
42
  const [editor] = LexicalComposerContext.useLexicalComposerContext();
@@ -79,4 +76,4 @@ function LexicalAutoScrollPlugin({
79
76
  return null;
80
77
  }
81
78
 
82
- module.exports = LexicalAutoScrollPlugin;
79
+ exports.AutoScrollPlugin = AutoScrollPlugin;
@@ -9,6 +9,4 @@
9
9
  type Props = $ReadOnly<{
10
10
  scrollRef: {current: HTMLElement | null},
11
11
  }>;
12
- declare export default function LexicalAutoScrollPlugin(
13
- props: Props,
14
- ): React$Node;
12
+ declare export function AutoScrollPlugin(props: Props): React$Node;
@@ -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 e=require("@lexical/react/LexicalComposerContext"),f=require("lexical"),h=require("react"),k="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement?h.useLayoutEffect:h.useEffect;
8
- module.exports=function({scrollRef:g}){const [d]=e.useLexicalComposerContext();k(()=>d.registerUpdateListener(({tags:a,editorState:c})=>{var b=g.current;null!==b&&a.has("scroll-into-view")&&(a=c.read(()=>f.$getSelection()),f.$isRangeSelection(a)&&a.isCollapsed()&&(a=d.getElementByKey(a.anchor.key),null!==a&&(b=b.getBoundingClientRect(),c=a.getBoundingClientRect(),c.bottom>b.bottom?a.scrollIntoView(!1):c.top<b.top&&a.scrollIntoView())))}),[d,g]);return null};
7
+ 'use strict';var e=require("@lexical/react/LexicalComposerContext"),f=require("lexical"),h=require("react"),k="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement?h.useLayoutEffect:h.useEffect;
8
+ exports.AutoScrollPlugin=function({scrollRef:g}){let [d]=e.useLexicalComposerContext();k(()=>d.registerUpdateListener(({tags:a,editorState:c})=>{var b=g.current;null!==b&&a.has("scroll-into-view")&&(a=c.read(()=>f.$getSelection()),f.$isRangeSelection(a)&&a.isCollapsed()&&(a=d.getElementByKey(a.anchor.key),null!==a&&(b=b.getBoundingClientRect(),c=a.getBoundingClientRect(),c.bottom>b.bottom?a.scrollIntoView(!1):c.top<b.top&&a.scrollIntoView())))}),[d,g]);return null}
@@ -4,7 +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
- * @flow strict
8
7
  */
9
8
 
10
9
  import type {ElementFormatType, NodeKey} from 'lexical';
@@ -14,5 +13,4 @@ type Props = Readonly<{
14
13
  format: ElementFormatType | null;
15
14
  nodeKey: NodeKey;
16
15
  }>;
17
-
18
- declare function BlockWithAlignableContents(Props): JSX.Element;
16
+ declare function BlockWithAlignableContents(arg0: Props): JSX.Element;
@@ -19,7 +19,6 @@ var React = require('react');
19
19
  * This source code is licensed under the MIT license found in the
20
20
  * LICENSE file in the root directory of this source tree.
21
21
  *
22
- *
23
22
  */
24
23
  function BlockWithAlignableContents({
25
24
  children,
@@ -27,7 +26,7 @@ function BlockWithAlignableContents({
27
26
  nodeKey
28
27
  }) {
29
28
  const [editor] = LexicalComposerContext.useLexicalComposerContext();
30
- const [isSelected, setSelected, clearSelection] = useLexicalNodeSelection(nodeKey);
29
+ const [isSelected, setSelected, clearSelection] = useLexicalNodeSelection.useLexicalNodeSelection(nodeKey);
31
30
  const ref = React.useRef();
32
31
  const onDelete = React.useCallback(payload => {
33
32
  if (isSelected && lexical.$isNodeSelection(lexical.$getSelection())) {
@@ -47,7 +46,7 @@ function BlockWithAlignableContents({
47
46
  return false;
48
47
  }, [editor, isSelected, nodeKey, setSelected]);
49
48
  React.useEffect(() => {
50
- return utils.mergeRegister(editor.registerCommand(lexical.FORMAT_ELEMENT_COMMAND, payload => {
49
+ return utils.mergeRegister(editor.registerCommand(lexical.FORMAT_ELEMENT_COMMAND, formatType => {
51
50
  if (isSelected) {
52
51
  const selection = lexical.$getSelection();
53
52
 
@@ -55,17 +54,17 @@ function BlockWithAlignableContents({
55
54
  const node = lexical.$getNodeByKey(nodeKey);
56
55
 
57
56
  if (LexicalDecoratorBlockNode.$isDecoratorBlockNode(node)) {
58
- node.setFormat(payload);
57
+ node.setFormat(formatType);
59
58
  }
60
59
  } else if (lexical.$isRangeSelection(selection)) {
61
60
  const nodes = selection.getNodes();
62
61
 
63
62
  for (const node of nodes) {
64
63
  if (LexicalDecoratorBlockNode.$isDecoratorBlockNode(node)) {
65
- node.setFormat(payload);
64
+ node.setFormat(formatType);
66
65
  } else {
67
66
  const element = utils.$getNearestBlockElementAncestorOrThrow(node);
68
- element.setFormat(payload);
67
+ element.setFormat(formatType);
69
68
  }
70
69
  }
71
70
  }
@@ -74,8 +73,7 @@ function BlockWithAlignableContents({
74
73
  }
75
74
 
76
75
  return false;
77
- }, lexical.COMMAND_PRIORITY_LOW), editor.registerCommand(lexical.CLICK_COMMAND, payload => {
78
- const event = payload;
76
+ }, lexical.COMMAND_PRIORITY_LOW), editor.registerCommand(lexical.CLICK_COMMAND, event => {
79
77
  event.preventDefault();
80
78
 
81
79
  if (event.target === ref.current) {
@@ -94,7 +92,7 @@ function BlockWithAlignableContents({
94
92
  className: `embed-block${isSelected ? ' focused' : ''}`,
95
93
  ref: ref,
96
94
  style: {
97
- textAlign: format
95
+ textAlign: format ? format : null
98
96
  }
99
97
  }, children);
100
98
  }
@@ -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
- var a=require("@lexical/react/LexicalComposerContext"),h=require("@lexical/react/LexicalDecoratorBlockNode"),m=require("@lexical/react/useLexicalNodeSelection"),n=require("@lexical/utils"),r=require("lexical"),t=require("react");
8
- exports.BlockWithAlignableContents=function({children:u,format:v,nodeKey:g}){const [d]=a.useLexicalComposerContext(),[e,k,p]=m(g),q=t.useRef(),l=t.useCallback(b=>{e&&r.$isNodeSelection(r.$getSelection())&&(b.preventDefault(),d.update(()=>{const c=r.$getNodeByKey(g);r.$isDecoratorNode(c)&&c.isTopLevel()&&c.remove();k(!1)}));return!1},[d,e,g,k]);t.useEffect(()=>n.mergeRegister(d.registerCommand(r.FORMAT_ELEMENT_COMMAND,b=>{if(e){var c=r.$getSelection();if(r.$isNodeSelection(c)){var f=r.$getNodeByKey(g);
9
- h.$isDecoratorBlockNode(f)&&f.setFormat(b)}else if(r.$isRangeSelection(c)){c=c.getNodes();for(f of c)h.$isDecoratorBlockNode(f)?f.setFormat(b):n.$getNearestBlockElementAncestorOrThrow(f).setFormat(b)}return!0}return!1},r.COMMAND_PRIORITY_LOW),d.registerCommand(r.CLICK_COMMAND,b=>{b.preventDefault();return b.target===q.current?(b.shiftKey||p(),k(!e),!0):!1},r.COMMAND_PRIORITY_LOW),d.registerCommand(r.KEY_DELETE_COMMAND,l,r.COMMAND_PRIORITY_LOW),d.registerCommand(r.KEY_BACKSPACE_COMMAND,l,r.COMMAND_PRIORITY_LOW)),
10
- [p,d,e,g,l,k]);return t.createElement("div",{className:`embed-block${e?" focused":""}`,ref:q,style:{textAlign:v}},u)};
7
+ 'use strict';var a=require("@lexical/react/LexicalComposerContext"),h=require("@lexical/react/LexicalDecoratorBlockNode"),m=require("@lexical/react/useLexicalNodeSelection"),n=require("@lexical/utils"),t=require("lexical"),u=require("react");
8
+ exports.BlockWithAlignableContents=function({children:v,format:p,nodeKey:g}){let [d]=a.useLexicalComposerContext(),[e,k,q]=m.useLexicalNodeSelection(g),r=u.useRef(),l=u.useCallback(b=>{e&&t.$isNodeSelection(t.$getSelection())&&(b.preventDefault(),d.update(()=>{const c=t.$getNodeByKey(g);t.$isDecoratorNode(c)&&c.isTopLevel()&&c.remove();k(!1)}));return!1},[d,e,g,k]);u.useEffect(()=>n.mergeRegister(d.registerCommand(t.FORMAT_ELEMENT_COMMAND,b=>{if(e){var c=t.$getSelection();if(t.$isNodeSelection(c)){var f=
9
+ t.$getNodeByKey(g);h.$isDecoratorBlockNode(f)&&f.setFormat(b)}else if(t.$isRangeSelection(c)){c=c.getNodes();for(f of c)h.$isDecoratorBlockNode(f)?f.setFormat(b):n.$getNearestBlockElementAncestorOrThrow(f).setFormat(b)}return!0}return!1},t.COMMAND_PRIORITY_LOW),d.registerCommand(t.CLICK_COMMAND,b=>{b.preventDefault();return b.target===r.current?(b.shiftKey||q(),k(!e),!0):!1},t.COMMAND_PRIORITY_LOW),d.registerCommand(t.KEY_DELETE_COMMAND,l,t.COMMAND_PRIORITY_LOW),d.registerCommand(t.KEY_BACKSPACE_COMMAND,
10
+ l,t.COMMAND_PRIORITY_LOW)),[q,d,e,g,l,k]);return u.createElement("div",{className:`embed-block${e?" focused":""}`,ref:r,style:{textAlign:p?p:null}},v)}
@@ -6,6 +6,6 @@
6
6
  *
7
7
  */
8
8
 
9
- export default function LexicalCharacterLimitPlugin(props: {
9
+ export function CharacterLimitPlugin(props: {
10
10
  charset: 'UTF-8' | 'UTF-16';
11
11
  }): JSX.Element | null;
@@ -19,13 +19,14 @@ var lexical = require('lexical');
19
19
  * This source code is licensed under the MIT license found in the
20
20
  * LICENSE file in the root directory of this source tree.
21
21
  *
22
- *
23
22
  */
24
23
  function useCharacterLimit(editor, maxCharacters, optional = Object.freeze({})) {
25
24
  const {
26
25
  strlen = input => input.length,
27
26
  // UTF-16
28
- remainingCharacters = characters => {}
27
+ remainingCharacters = () => {
28
+ return;
29
+ }
29
30
  } = optional;
30
31
  React.useEffect(() => {
31
32
  if (!editor.hasNodes([overflow.OverflowNode])) {
@@ -35,7 +36,7 @@ function useCharacterLimit(editor, maxCharacters, optional = Object.freeze({}))
35
36
  }
36
37
  }, [editor]);
37
38
  React.useEffect(() => {
38
- let text$1 = editor.getEditorState().read(text.$rootTextContentCurry);
39
+ let text$1 = editor.getEditorState().read(text.$rootTextContent);
39
40
  let lastComputedTextLength = 0;
40
41
  return utils.mergeRegister(editor.registerTextContentListener(currentText => {
41
42
  text$1 = currentText;
@@ -69,6 +70,7 @@ function useCharacterLimit(editor, maxCharacters, optional = Object.freeze({}))
69
70
  }
70
71
 
71
72
  function findOffset(text, maxCharacters, strlen) {
73
+ // @ts-ignore This is due to be added in a later version of TS
72
74
  const Segmenter = Intl.Segmenter;
73
75
  let offsetUtf16 = 0;
74
76
  let offset = 0;
@@ -246,7 +248,6 @@ function mergePrevious(overflowNode) {
246
248
  * This source code is licensed under the MIT license found in the
247
249
  * LICENSE file in the root directory of this source tree.
248
250
  *
249
- *
250
251
  */
251
252
  const CHARACTER_LIMIT = 5;
252
253
  let textEncoderInstance = null;
@@ -298,4 +299,4 @@ function CharacterLimitPlugin({
298
299
  }, remainingCharacters);
299
300
  }
300
301
 
301
- module.exports = CharacterLimitPlugin;
302
+ exports.CharacterLimitPlugin = CharacterLimitPlugin;
@@ -7,6 +7,6 @@
7
7
  * @flow strict
8
8
  */
9
9
 
10
- declare export default function LexicalCharacterLimitPlugin(props: {
10
+ declare export function CharacterLimitPlugin(props: {
11
11
  charset: 'UTF-8' | 'UTF-16',
12
12
  }): React$Node;
@@ -4,11 +4,11 @@
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 m=require("@lexical/react/LexicalComposerContext"),u=require("react"),v=require("@lexical/overflow"),z=require("@lexical/text"),A=require("@lexical/utils"),C=require("lexical");
8
- function D(b,c,n=Object.freeze({})){const {strlen:g=d=>d.length,remainingCharacters:q=()=>{}}=n;u.useEffect(()=>{if(!b.hasNodes([v.OverflowNode]))throw Error("Minified Lexical error #49; see codes.json for the full message or use the non-minified dev environment for full errors and additional helpful warnings.");},[b]);u.useEffect(()=>{let d=b.getEditorState().read(z.$rootTextContentCurry),e=0;return A.mergeRegister(b.registerTextContentListener(p=>{d=p}),b.registerUpdateListener(({dirtyLeaves:p})=>
9
- {var w=b.isComposing();p=0<p.size;if(!w&&p){w=g(d);p=w>c||null!==e&&e>c;q(c-w);if(null===e||p){const r=F(d,c,g);b.update(()=>{const B=A.$dfs(),J=B.length;let x=0;for(let y=0;y<J;y+=1){var {node:a}=B[y];if(v.$isOverflowNode(a)){var f=x;if(x+a.getTextContentSize()<=r){var h=a.getParent();f=a.getPreviousSibling();var k=a.getNextSibling();G(a);a=C.$getSelection();!C.$isRangeSelection(a)||a.anchor.getNode().isAttached()&&a.focus.getNode().isAttached()||(C.$isTextNode(f)?f.select():C.$isTextNode(k)?k.select():
10
- null!==h&&h.select())}else f<r&&(h=a.getFirstDescendant(),k=null!==h?h.getTextContentSize():0,f+=k,h=C.$isTextNode(h)&&h.isSimpleText(),f=f<=r,(h||f)&&G(a))}else if(C.$isLeafNode(a)&&(f=x,x+=a.getTextContentSize(),x>r&&!v.$isOverflowNode(a.getParent())&&(h=C.$getSelection(),f<r&&C.$isTextNode(a)&&a.isSimpleText()?([,a]=a.splitText(r-f),a=H(a)):a=H(a),null!==h&&C.$setSelection(h),f=a.getPreviousSibling(),v.$isOverflowNode(f)))){k=a.getFirstChild();var t=f.getChildren();h=t.length;if(null===k)a.append(...t);
11
- else for(var l=0;l<h;l++)k.insertBefore(t[l]);l=C.$getSelection();if(C.$isRangeSelection(l)){k=l.anchor;t=k.getNode();l=l.focus;const E=k.getNode();t.is(f)?k.set(a.getKey(),k.offset,"element"):t.is(a)&&k.set(a.getKey(),h+k.offset,"element");E.is(f)?l.set(a.getKey(),l.offset,"element"):E.is(a)&&l.set(a.getKey(),h+l.offset,"element")}f.remove()}}},{tag:"history-merge"})}e=w}}))},[b,c,q,g])}
12
- function F(b,c,n){var g=Intl.Segmenter;let q=0;var d=0;if("function"===typeof g){b=(new g).segment(b);for(var {segment:e}of b){d+=n(e);if(d>c)break;q+=e.length}}else for(e=Array.from(b),b=e.length,g=0;g<b;g++){const p=e[g];d+=n(p);if(d>c)break;q+=p.length}return q}function H(b){const c=v.$createOverflowNode();b.insertBefore(c);c.append(b);return c}function G(b){const c=b.getChildren(),n=c.length;for(let g=0;g<n;g++)b.insertBefore(c[g]);b.remove();return 0<n?c[n-1]:null}let I=null;
13
- module.exports=function({charset:b="UTF-16"}){const [c]=m.useLexicalComposerContext(),[n,g]=u.useState(0),q=u.useMemo(()=>({remainingCharacters:g,strlen:d=>{if("UTF-8"===b){if(void 0===window.TextEncoder)var e=null;else null===I&&(I=new window.TextEncoder),e=I;null===e?(e=encodeURIComponent(d).match(/%[89ABab]/g),d=d.length+(e?e.length:0)):d=e.encode(d).length;return d}if("UTF-16"===b)return d.length;throw Error("Unrecognized charset");}}),[b]);D(c,5,q);return u.createElement("span",{className:`characters-limit ${0>
14
- n?"characters-limit-exceeded":""}`},n)};
7
+ 'use strict';var m=require("@lexical/react/LexicalComposerContext"),u=require("react"),v=require("@lexical/overflow"),z=require("@lexical/text"),A=require("@lexical/utils"),C=require("lexical");
8
+ function D(b,c,n=Object.freeze({})){let {strlen:g=d=>d.length,remainingCharacters:q=()=>{}}=n;u.useEffect(()=>{if(!b.hasNodes([v.OverflowNode]))throw Error("Minified Lexical error #57; see codes.json for the full message or use the non-minified dev environment for full errors and additional helpful warnings.");},[b]);u.useEffect(()=>{let d=b.getEditorState().read(z.$rootTextContent),e=0;return A.mergeRegister(b.registerTextContentListener(p=>{d=p}),b.registerUpdateListener(({dirtyLeaves:p})=>{var w=
9
+ b.isComposing();p=0<p.size;if(!w&&p){w=g(d);p=w>c||null!==e&&e>c;q(c-w);if(null===e||p){let r=F(d,c,g);b.update(()=>{let B=A.$dfs(),J=B.length,x=0;for(let y=0;y<J;y+=1){var {node:a}=B[y];if(v.$isOverflowNode(a)){var f=x;if(x+a.getTextContentSize()<=r){var h=a.getParent();f=a.getPreviousSibling();var k=a.getNextSibling();G(a);a=C.$getSelection();!C.$isRangeSelection(a)||a.anchor.getNode().isAttached()&&a.focus.getNode().isAttached()||(C.$isTextNode(f)?f.select():C.$isTextNode(k)?k.select():null!==
10
+ h&&h.select())}else f<r&&(h=a.getFirstDescendant(),k=null!==h?h.getTextContentSize():0,f+=k,h=C.$isTextNode(h)&&h.isSimpleText(),f=f<=r,(h||f)&&G(a))}else if(C.$isLeafNode(a)&&(f=x,x+=a.getTextContentSize(),x>r&&!v.$isOverflowNode(a.getParent())&&(h=C.$getSelection(),f<r&&C.$isTextNode(a)&&a.isSimpleText()?([,a]=a.splitText(r-f),a=H(a)):a=H(a),null!==h&&C.$setSelection(h),f=a.getPreviousSibling(),v.$isOverflowNode(f)))){k=a.getFirstChild();var t=f.getChildren();h=t.length;if(null===k)a.append(...t);
11
+ else for(var l=0;l<h;l++)k.insertBefore(t[l]);l=C.$getSelection();if(C.$isRangeSelection(l)){k=l.anchor;t=k.getNode();l=l.focus;let E=k.getNode();t.is(f)?k.set(a.getKey(),k.offset,"element"):t.is(a)&&k.set(a.getKey(),h+k.offset,"element");E.is(f)?l.set(a.getKey(),l.offset,"element"):E.is(a)&&l.set(a.getKey(),h+l.offset,"element")}f.remove()}}},{tag:"history-merge"})}e=w}}))},[b,c,q,g])}
12
+ function F(b,c,n){var g=Intl.Segmenter;let q=0;var d=0;if("function"===typeof g){b=(new g).segment(b);for(var {segment:e}of b){d+=n(e);if(d>c)break;q+=e.length}}else for(e=Array.from(b),b=e.length,g=0;g<b;g++){let p=e[g];d+=n(p);if(d>c)break;q+=p.length}return q}function H(b){let c=v.$createOverflowNode();b.insertBefore(c);c.append(b);return c}function G(b){let c=b.getChildren(),n=c.length;for(let g=0;g<n;g++)b.insertBefore(c[g]);b.remove();return 0<n?c[n-1]:null}let I=null;
13
+ exports.CharacterLimitPlugin=function({charset:b="UTF-16"}){let [c]=m.useLexicalComposerContext(),[n,g]=u.useState(0),q=u.useMemo(()=>({remainingCharacters:g,strlen:d=>{if("UTF-8"===b){if(void 0===window.TextEncoder)var e=null;else null===I&&(I=new window.TextEncoder),e=I;null===e?(e=encodeURIComponent(d).match(/%[89ABab]/g),d=d.length+(e?e.length:0)):d=e.encode(d).length;return d}if("UTF-16"===b)return d.length;throw Error("Unrecognized charset");}}),[b]);D(c,5,q);return u.createElement("span",{className:`characters-limit ${0>
14
+ n?"characters-limit-exceeded":""}`},n)}
@@ -6,4 +6,4 @@
6
6
  *
7
7
  */
8
8
 
9
- export default function LexicalCheckListPlugin(): null;
9
+ export function CheckListPlugin(): null;