@lexical/react 0.2.7 → 0.3.0

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 +2 -3
  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 +16 -0
  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 +9 -0
  53. package/LexicalCheckListPlugin.dev.js +7 -15
  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 +3 -20
  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 +32 -0
  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 +11 -1
  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 +4 -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 +2 -2
  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
@@ -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
  function useHistory(editor, externalHistoryState, delay = 1000) {
22
21
  const historyState = react.useMemo(() => externalHistoryState || history.createEmptyHistoryState(), [externalHistoryState]);
@@ -31,7 +30,6 @@ function useHistory(editor, externalHistoryState, delay = 1000) {
31
30
  * This source code is licensed under the MIT license found in the
32
31
  * LICENSE file in the root directory of this source tree.
33
32
  *
34
- *
35
33
  */
36
34
  function HistoryPlugin({
37
35
  externalHistoryState
@@ -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 c=require("@lexical/react/LexicalComposerContext"),d=require("@lexical/history"),g=require("react");function h(a,b,e=1E3){const f=g.useMemo(()=>b||d.createEmptyHistoryState(),[b]);g.useEffect(()=>d.registerHistory(a,f,e),[e,a,f])}exports.createEmptyHistoryState=d.createEmptyHistoryState;exports.HistoryPlugin=function({externalHistoryState:a}){const [b]=c.useLexicalComposerContext();h(b,a);return null};
7
+ 'use strict';var c=require("@lexical/react/LexicalComposerContext"),history=require("@lexical/history"),f=require("react");function g(a,b,d=1E3){let e=f.useMemo(()=>b||history.createEmptyHistoryState(),[b]);f.useEffect(()=>history.registerHistory(a,e,d),[d,a,e])}exports.createEmptyHistoryState=history.createEmptyHistoryState;exports.HistoryPlugin=function({externalHistoryState:a}){let [b]=c.useLexicalComposerContext();g(b,a);return null}
@@ -8,6 +8,7 @@
8
8
 
9
9
  import type {LexicalNode, LexicalCommand} from 'lexical';
10
10
  import {DecoratorNode} from 'lexical';
11
+
11
12
  export declare class HorizontalRuleNode extends DecoratorNode<JSX.Element | null> {
12
13
  static getType(): string;
13
14
  static clone(node: HorizontalRuleNode): HorizontalRuleNode;
@@ -21,5 +22,4 @@ export function $createHorizontalRuleNode(): HorizontalRuleNode;
21
22
  export function $isHorizontalRuleNode(
22
23
  node: LexicalNode | null | undefined,
23
24
  ): node is HorizontalRuleNode;
24
-
25
25
  export var INSERT_HORIZONTAL_RULE_COMMAND: LexicalCommand<void>;
@@ -15,7 +15,6 @@ 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
19
  const INSERT_HORIZONTAL_RULE_COMMAND = lexical.createCommand();
21
20
 
@@ -47,6 +46,17 @@ class HorizontalRuleNode extends lexical.DecoratorNode {
47
46
  };
48
47
  }
49
48
 
49
+ static importJSON(serializedNode) {
50
+ return $createHorizontalRuleNode();
51
+ }
52
+
53
+ exportJSON() {
54
+ return {
55
+ type: 'horizontalrule',
56
+ version: 1
57
+ };
58
+ }
59
+
50
60
  createDOM() {
51
61
  const div = document.createElement('div');
52
62
  div.style.display = 'contents';
@@ -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"),c=require("react");const d=b.createCommand();function e(){return c.createElement("hr",null)}
8
- class f extends b.DecoratorNode{static getType(){return"horizontalrule"}static clone(a){return new f(a.__key)}static importDOM(){return{hr:()=>({conversion:g,priority:0})}}exportDOM(){return{element:document.createElement("hr")}}createDOM(){const a=document.createElement("div");a.style.display="contents";return a}getTextContent(){return"\n"}isTopLevel(){return!0}updateDOM(){return!1}decorate(){return c.createElement(e,null)}}function g(){return{node:h()}}function h(){return new f}
9
- exports.$createHorizontalRuleNode=h;exports.$isHorizontalRuleNode=function(a){return a instanceof f};exports.HorizontalRuleNode=f;exports.INSERT_HORIZONTAL_RULE_COMMAND=d;
7
+ 'use strict';var b=require("lexical"),c=require("react");let d=b.createCommand();function e(){return c.createElement("hr",null)}
8
+ class f extends b.DecoratorNode{static getType(){return"horizontalrule"}static clone(a){return new f(a.__key)}static importDOM(){return{hr:()=>({conversion:g,priority:0})}}exportDOM(){return{element:document.createElement("hr")}}static importJSON(){return h()}exportJSON(){return{type:"horizontalrule",version:1}}createDOM(){let a=document.createElement("div");a.style.display="contents";return a}getTextContent(){return"\n"}isTopLevel(){return!0}updateDOM(){return!1}decorate(){return c.createElement(e,
9
+ null)}}function g(){return{node:h()}}function h(){return new f}exports.$createHorizontalRuleNode=h;exports.$isHorizontalRuleNode=function(a){return a instanceof f};exports.HorizontalRuleNode=f;exports.INSERT_HORIZONTAL_RULE_COMMAND=d
@@ -6,4 +6,4 @@
6
6
  *
7
7
  */
8
8
 
9
- export default function LexicalLinkPlugin(): null;
9
+ export function LinkPlugin(): null;
@@ -16,110 +16,7 @@ var react = require('react');
16
16
  *
17
17
  * This source code is licensed under the MIT license found in the
18
18
  * LICENSE file in the root directory of this source tree.
19
- *
20
- *
21
19
  */
22
-
23
- function toggleLink(url) {
24
- const selection = lexical.$getSelection();
25
-
26
- if (selection !== null) {
27
- lexical.$setSelection(selection);
28
- }
29
-
30
- const sel = lexical.$getSelection();
31
-
32
- if (sel !== null) {
33
- const nodes = sel.extract();
34
-
35
- if (url === null) {
36
- // Remove LinkNodes
37
- nodes.forEach(node => {
38
- const parent = node.getParent();
39
-
40
- if (link.$isLinkNode(parent)) {
41
- const children = parent.getChildren();
42
-
43
- for (let i = 0; i < children.length; i++) {
44
- parent.insertBefore(children[i]);
45
- }
46
-
47
- parent.remove();
48
- }
49
- });
50
- } else {
51
- // Add or merge LinkNodes
52
- if (nodes.length === 1) {
53
- const firstNode = nodes[0]; // if the first node is a LinkNode or if its
54
- // parent is a LinkNode, we update the URL.
55
-
56
- if (link.$isLinkNode(firstNode)) {
57
- firstNode.setURL(url);
58
- return;
59
- } else {
60
- const parent = firstNode.getParent();
61
-
62
- if (link.$isLinkNode(parent)) {
63
- // set parent to be the current linkNode
64
- // so that other nodes in the same parent
65
- // aren't handled separately below.
66
- parent.setURL(url);
67
- return;
68
- }
69
- }
70
- }
71
-
72
- let prevParent = null;
73
- let linkNode = null;
74
- nodes.forEach(node => {
75
- const parent = node.getParent();
76
-
77
- if (parent === linkNode || parent === null || lexical.$isElementNode(node) && !node.isInline()) {
78
- return;
79
- }
80
-
81
- if (link.$isLinkNode(parent)) {
82
- linkNode = parent;
83
- parent.setURL(url);
84
- return;
85
- }
86
-
87
- if (!parent.is(prevParent)) {
88
- prevParent = parent;
89
- linkNode = link.$createLinkNode(url);
90
-
91
- if (link.$isLinkNode(parent)) {
92
- if (node.getPreviousSibling() === null) {
93
- parent.insertBefore(linkNode);
94
- } else {
95
- parent.insertAfter(linkNode);
96
- }
97
- } else {
98
- node.insertBefore(linkNode);
99
- }
100
- }
101
-
102
- if (link.$isLinkNode(node)) {
103
- if (linkNode !== null) {
104
- const children = node.getChildren();
105
-
106
- for (let i = 0; i < children.length; i++) {
107
- linkNode.append(children[i]);
108
- }
109
- }
110
-
111
- node.remove();
112
- return;
113
- }
114
-
115
- if (linkNode !== null) {
116
- linkNode.append(node);
117
- }
118
- });
119
- }
120
- }
121
- }
122
-
123
20
  function LinkPlugin() {
124
21
  const [editor] = LexicalComposerContext.useLexicalComposerContext();
125
22
  react.useEffect(() => {
@@ -128,13 +25,12 @@ function LinkPlugin() {
128
25
  }
129
26
  }, [editor]);
130
27
  react.useEffect(() => {
131
- return editor.registerCommand(link.TOGGLE_LINK_COMMAND, payload => {
132
- const url = payload;
133
- toggleLink(url);
28
+ return editor.registerCommand(link.TOGGLE_LINK_COMMAND, url => {
29
+ link.toggleLink(url);
134
30
  return true;
135
31
  }, lexical.COMMAND_PRIORITY_EDITOR);
136
32
  }, [editor]);
137
33
  return null;
138
34
  }
139
35
 
140
- module.exports = LinkPlugin;
36
+ exports.LinkPlugin = LinkPlugin;
@@ -7,4 +7,4 @@
7
7
  * @flow strict
8
8
  */
9
9
 
10
- declare export default function LexicalLinkPlugin(): null;
10
+ declare export function LinkPlugin(): null;
@@ -4,7 +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 f=require("@lexical/link"),k=require("@lexical/react/LexicalComposerContext"),m=require("lexical"),n=require("react");
8
- function p(e){var d=m.$getSelection();null!==d&&m.$setSelection(d);d=m.$getSelection();if(null!==d)if(d=d.extract(),null===e)d.forEach(g=>{g=g.getParent();if(f.$isLinkNode(g)){const a=g.getChildren();for(let b=0;b<a.length;b++)g.insertBefore(a[b]);g.remove()}});else{if(1===d.length){var h=d[0];if(f.$isLinkNode(h)){h.setURL(e);return}h=h.getParent();if(f.$isLinkNode(h)){h.setURL(e);return}}let g=null,a=null;d.forEach(b=>{var c=b.getParent();if(c!==a&&null!==c&&(!m.$isElementNode(b)||b.isInline()))if(f.$isLinkNode(c))a=
9
- c,c.setURL(e);else if(c.is(g)||(g=c,a=f.$createLinkNode(e),f.$isLinkNode(c)?null===b.getPreviousSibling()?c.insertBefore(a):c.insertAfter(a):b.insertBefore(a)),f.$isLinkNode(b)){if(null!==a){c=b.getChildren();for(let l=0;l<c.length;l++)a.append(c[l])}b.remove()}else null!==a&&a.append(b)})}}
10
- module.exports=function(){const [e]=k.useLexicalComposerContext();n.useEffect(()=>{if(!e.hasNodes([f.LinkNode]))throw Error("LinkPlugin: LinkNode not registered on editor");},[e]);n.useEffect(()=>e.registerCommand(f.TOGGLE_LINK_COMMAND,d=>{p(d);return!0},m.COMMAND_PRIORITY_EDITOR),[e]);return null};
7
+ 'use strict';var b=require("@lexical/link"),c=require("@lexical/react/LexicalComposerContext"),d=require("lexical"),e=require("react");exports.LinkPlugin=function(){let [a]=c.useLexicalComposerContext();e.useEffect(()=>{if(!a.hasNodes([b.LinkNode]))throw Error("LinkPlugin: LinkNode not registered on editor");},[a]);e.useEffect(()=>a.registerCommand(b.TOGGLE_LINK_COMMAND,f=>{b.toggleLink(f);return!0},d.COMMAND_PRIORITY_EDITOR),[a]);return null}
@@ -6,4 +6,4 @@
6
6
  *
7
7
  */
8
8
 
9
- export default function ListPlugin(): null;
9
+ export function ListPlugin(): null;
@@ -6,19 +6,18 @@
6
6
  */
7
7
  'use strict';
8
8
 
9
- var LexicalComposerContext = require('@lexical/react/LexicalComposerContext');
10
9
  var list = require('@lexical/list');
10
+ var LexicalComposerContext = require('@lexical/react/LexicalComposerContext');
11
+ var react = require('react');
11
12
  var utils = require('@lexical/utils');
12
13
  var lexical = require('lexical');
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
  function useList(editor) {
24
23
  react.useEffect(() => {
@@ -55,12 +54,16 @@ function useList(editor) {
55
54
  * This source code is licensed under the MIT license found in the
56
55
  * LICENSE file in the root directory of this source tree.
57
56
  *
58
- *
59
57
  */
60
58
  function ListPlugin() {
61
59
  const [editor] = LexicalComposerContext.useLexicalComposerContext();
60
+ react.useEffect(() => {
61
+ if (!editor.hasNodes([list.ListNode, list.ListItemNode])) {
62
+ throw new Error('ListPlugin: ListNode and/or ListItemNode not registered on editor');
63
+ }
64
+ }, [editor]);
62
65
  useList(editor);
63
66
  return null;
64
67
  }
65
68
 
66
- module.exports = ListPlugin;
69
+ exports.ListPlugin = ListPlugin;
@@ -7,4 +7,4 @@
7
7
  * @flow strict
8
8
  */
9
9
 
10
- declare export default function ListPlugin(): null;
10
+ declare export function ListPlugin(): null;
@@ -4,6 +4,6 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- var b=require("@lexical/react/LexicalComposerContext"),c=require("@lexical/list"),d=require("@lexical/utils"),e=require("lexical"),f=require("react");
8
- function g(a){f.useEffect(()=>d.mergeRegister(a.registerCommand(e.INDENT_CONTENT_COMMAND,()=>{c.indentList();return!1},e.COMMAND_PRIORITY_LOW),a.registerCommand(e.OUTDENT_CONTENT_COMMAND,()=>{c.outdentList();return!1},e.COMMAND_PRIORITY_LOW),a.registerCommand(c.INSERT_ORDERED_LIST_COMMAND,()=>{c.insertList(a,"number");return!0},e.COMMAND_PRIORITY_LOW),a.registerCommand(c.INSERT_UNORDERED_LIST_COMMAND,()=>{c.insertList(a,"bullet");return!0},e.COMMAND_PRIORITY_LOW),a.registerCommand(c.REMOVE_LIST_COMMAND,
9
- ()=>{c.removeList(a);return!0},e.COMMAND_PRIORITY_LOW),a.registerCommand(e.INSERT_PARAGRAPH_COMMAND,()=>c.$handleListInsertParagraph()?!0:!1,e.COMMAND_PRIORITY_LOW)),[a])}module.exports=function(){const [a]=b.useLexicalComposerContext();g(a);return null};
7
+ 'use strict';var b=require("@lexical/list"),c=require("@lexical/react/LexicalComposerContext"),d=require("react"),e=require("@lexical/utils"),f=require("lexical");
8
+ function g(a){d.useEffect(()=>e.mergeRegister(a.registerCommand(f.INDENT_CONTENT_COMMAND,()=>{b.indentList();return!1},f.COMMAND_PRIORITY_LOW),a.registerCommand(f.OUTDENT_CONTENT_COMMAND,()=>{b.outdentList();return!1},f.COMMAND_PRIORITY_LOW),a.registerCommand(b.INSERT_ORDERED_LIST_COMMAND,()=>{b.insertList(a,"number");return!0},f.COMMAND_PRIORITY_LOW),a.registerCommand(b.INSERT_UNORDERED_LIST_COMMAND,()=>{b.insertList(a,"bullet");return!0},f.COMMAND_PRIORITY_LOW),a.registerCommand(b.REMOVE_LIST_COMMAND,
9
+ ()=>{b.removeList(a);return!0},f.COMMAND_PRIORITY_LOW),a.registerCommand(f.INSERT_PARAGRAPH_COMMAND,()=>b.$handleListInsertParagraph()?!0:!1,f.COMMAND_PRIORITY_LOW)),[a])}exports.ListPlugin=function(){let [a]=c.useLexicalComposerContext();d.useEffect(()=>{if(!a.hasNodes([b.ListNode,b.ListItemNode]))throw Error("ListPlugin: ListNode and/or ListItemNode not registered on editor");},[a]);g(a);return null}
@@ -6,6 +6,8 @@
6
6
  *
7
7
  */
8
8
 
9
- export default function LexicalMarkdownShortcutPlugin(arg0: {
10
- transformers: Array<Transformer>;
9
+ import type {Transformer} from '@lexical/markdown';
10
+
11
+ export function MarkdownShortcutPlugin(arg0: {
12
+ transformers?: Array<Transformer>;
11
13
  }): JSX.Element | null;
@@ -8,8 +8,8 @@
8
8
 
9
9
  var markdown = require('@lexical/markdown');
10
10
  var LexicalComposerContext = require('@lexical/react/LexicalComposerContext');
11
- var React = require('react');
12
- var lexical = require('lexical');
11
+ var LexicalHorizontalRuleNode = require('@lexical/react/LexicalHorizontalRuleNode');
12
+ var react = require('react');
13
13
 
14
14
  /**
15
15
  * Copyright (c) Meta Platforms, Inc. and affiliates.
@@ -17,90 +17,14 @@ var lexical = require('lexical');
17
17
  * This source code is licensed under the MIT license found in the
18
18
  * LICENSE file in the root directory of this source tree.
19
19
  *
20
- *
21
- */
22
- lexical.createCommand();
23
-
24
- function HorizontalRuleComponent() {
25
- return /*#__PURE__*/React.createElement("hr", null);
26
- }
27
-
28
- class HorizontalRuleNode extends lexical.DecoratorNode {
29
- static getType() {
30
- return 'horizontalrule';
31
- }
32
-
33
- static clone(node) {
34
- return new HorizontalRuleNode(node.__key);
35
- }
36
-
37
- static importDOM() {
38
- return {
39
- hr: node => ({
40
- conversion: convertHorizontalRuleElement,
41
- priority: 0
42
- })
43
- };
44
- }
45
-
46
- exportDOM() {
47
- return {
48
- element: document.createElement('hr')
49
- };
50
- }
51
-
52
- createDOM() {
53
- const div = document.createElement('div');
54
- div.style.display = 'contents';
55
- return div;
56
- }
57
-
58
- getTextContent() {
59
- return '\n';
60
- }
61
-
62
- isTopLevel() {
63
- return true;
64
- }
65
-
66
- updateDOM() {
67
- return false;
68
- }
69
-
70
- decorate() {
71
- return /*#__PURE__*/React.createElement(HorizontalRuleComponent, null);
72
- }
73
-
74
- }
75
-
76
- function convertHorizontalRuleElement() {
77
- return {
78
- node: $createHorizontalRuleNode()
79
- };
80
- }
81
-
82
- function $createHorizontalRuleNode() {
83
- return new HorizontalRuleNode();
84
- }
85
- function $isHorizontalRuleNode(node) {
86
- return node instanceof HorizontalRuleNode;
87
- }
88
-
89
- /**
90
- * Copyright (c) Meta Platforms, Inc. and affiliates.
91
- *
92
- * This source code is licensed under the MIT license found in the
93
- * LICENSE file in the root directory of this source tree.
94
- *
95
- *
96
20
  */
97
21
  const HR = {
98
22
  export: node => {
99
- return $isHorizontalRuleNode(node) ? '***' : null;
23
+ return LexicalHorizontalRuleNode.$isHorizontalRuleNode(node) ? '***' : null;
100
24
  },
101
25
  regExp: /^(---|\*\*\*|___)\s?$/,
102
26
  replace: (parentNode, _1, _2, isImport) => {
103
- const line = $createHorizontalRuleNode(); // TODO: Get rid of isImport flag
27
+ const line = LexicalHorizontalRuleNode.$createHorizontalRuleNode(); // TODO: Get rid of isImport flag
104
28
 
105
29
  if (isImport || parentNode.getNextSibling() != null) {
106
30
  parentNode.replace(line);
@@ -113,14 +37,14 @@ const HR = {
113
37
  type: 'element'
114
38
  };
115
39
  const DEFAULT_TRANSFORMERS = [HR, ...markdown.TRANSFORMERS];
116
- function LexicalMarkdownShortcutPlugin({
40
+ function MarkdownShortcutPlugin({
117
41
  transformers = DEFAULT_TRANSFORMERS
118
42
  }) {
119
43
  const [editor] = LexicalComposerContext.useLexicalComposerContext();
120
- React.useEffect(() => {
44
+ react.useEffect(() => {
121
45
  return markdown.registerMarkdownShortcuts(editor, transformers);
122
46
  }, [editor, transformers]);
123
47
  return null;
124
48
  }
125
49
 
126
- module.exports = LexicalMarkdownShortcutPlugin;
50
+ exports.MarkdownShortcutPlugin = MarkdownShortcutPlugin;
@@ -9,6 +9,6 @@
9
9
 
10
10
  import type {Transformer} from '@lexical/markdown';
11
11
 
12
- declare export default function LexicalMarkdownShortcutPlugin({
13
- transformers: Array<Transformer>,
12
+ declare export function MarkdownShortcutPlugin({
13
+ transformers?: Array<Transformer>,
14
14
  }): React$Node;
@@ -4,6 +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 c=require("@lexical/markdown"),d=require("@lexical/react/LexicalComposerContext"),e=require("react"),f=require("lexical");f.createCommand();function g(){return e.createElement("hr",null)}
8
- class h extends f.DecoratorNode{static getType(){return"horizontalrule"}static clone(a){return new h(a.__key)}static importDOM(){return{hr:()=>({conversion:k,priority:0})}}exportDOM(){return{element:document.createElement("hr")}}createDOM(){const a=document.createElement("div");a.style.display="contents";return a}getTextContent(){return"\n"}isTopLevel(){return!0}updateDOM(){return!1}decorate(){return e.createElement(g,null)}}function k(){return{node:new h}}
9
- const m=[{export:a=>a instanceof h?"***":null,regExp:/^(---|\*\*\*|___)\s?$/,replace:(a,b,n,l)=>{b=new h;l||null!=a.getNextSibling()?a.replace(b):a.insertBefore(b);b.selectNext()},type:"element"},...c.TRANSFORMERS];module.exports=function({transformers:a=m}){const [b]=d.useLexicalComposerContext();e.useEffect(()=>c.registerMarkdownShortcuts(b,a),[b,a]);return null};
7
+ 'use strict';var c=require("@lexical/markdown"),d=require("@lexical/react/LexicalComposerContext"),e=require("@lexical/react/LexicalHorizontalRuleNode"),f=require("react");let h=[{export:a=>e.$isHorizontalRuleNode(a)?"***":null,regExp:/^(---|\*\*\*|___)\s?$/,replace:(a,b,k,g)=>{b=e.$createHorizontalRuleNode();g||null!=a.getNextSibling()?a.replace(b):a.insertBefore(b);b.selectNext()},type:"element"},...c.TRANSFORMERS];
8
+ exports.MarkdownShortcutPlugin=function({transformers:a=h}){let [b]=d.useLexicalComposerContext();f.useEffect(()=>c.registerMarkdownShortcuts(b,a),[b,a]);return null}
@@ -8,8 +8,8 @@
8
8
 
9
9
  import type {LexicalEditor, EditorThemeClasses} from 'lexical';
10
10
 
11
- export default function LexicalNestedComposer(arg0: {
11
+ export function LexicalNestedComposer(arg0: {
12
12
  initialEditor: LexicalEditor;
13
13
  initialTheme?: EditorThemeClasses;
14
- children: JSX.Element | JSX.Element[] | null;
14
+ children: JSX.Element | (JSX.Element | string | null)[] | null;
15
15
  }): JSX.Element | 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
  function LexicalNestedComposer({
22
21
  initialEditor,
@@ -58,4 +57,4 @@ function LexicalNestedComposer({
58
57
  }, !isCollab || isCollabReady ? children : null);
59
58
  }
60
59
 
61
- module.exports = LexicalNestedComposer;
60
+ exports.LexicalNestedComposer = LexicalNestedComposer;
@@ -9,7 +9,7 @@
9
9
 
10
10
  import type {LexicalEditor, EditorThemeClasses, LexicalNode} from 'lexical';
11
11
 
12
- declare export default function LexicalNestedComposer({
12
+ declare export function LexicalNestedComposer({
13
13
  children: React$Node,
14
14
  initialEditor: LexicalEditor,
15
15
  initialTheme?: EditorThemeClasses,
@@ -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 c=require("@lexical/react/LexicalCollaborationPlugin"),d=require("@lexical/react/LexicalComposerContext"),h=require("react");
8
- module.exports=function({initialEditor:a,children:k,initialTheme:l}){const e=h.useContext(d.LexicalComposerContext);if(null==e)throw Error("Minified Lexical error #8; see codes.json for the full message or use the non-minified dev environment for full errors and additional helpful warnings.");const p=h.useMemo(()=>{const [g,m]=e,f=l||m.getTheme()||void 0,n=d.createLexicalComposerContext(e,f);void 0!==f&&(a._config.theme=f);a._parentEditor=g;a._nodes=g._nodes;return[a,n]},[]);var {yjsDocMap:b}=c.useCollaborationContext();
9
- const q=void 0!==b.get("main");b=b.has(a.getKey());return h.createElement(d.LexicalComposerContext.Provider,{value:p},!q||b?k:null)};
7
+ 'use strict';var c=require("@lexical/react/LexicalCollaborationPlugin"),d=require("@lexical/react/LexicalComposerContext"),h=require("react");
8
+ exports.LexicalNestedComposer=function({initialEditor:a,children:k,initialTheme:l}){let e=h.useContext(d.LexicalComposerContext);if(null==e)throw Error("Minified Lexical error #9; see codes.json for the full message or use the non-minified dev environment for full errors and additional helpful warnings.");let p=h.useMemo(()=>{const [g,m]=e,f=l||m.getTheme()||void 0,n=d.createLexicalComposerContext(e,f);void 0!==f&&(a._config.theme=f);a._parentEditor=g;a._nodes=g._nodes;return[a,n]},[]);var {yjsDocMap:b}=
9
+ c.useCollaborationContext();let q=void 0!==b.get("main");b=b.has(a.getKey());return h.createElement(d.LexicalComposerContext.Provider,{value:p},!q||b?k:null)}
@@ -7,7 +7,8 @@
7
7
  */
8
8
 
9
9
  import type {EditorState, LexicalEditor} from 'lexical';
10
- export default function OnChangePlugin(arg0: {
10
+
11
+ export function OnChangePlugin(arg0: {
11
12
  ignoreInitialChange?: boolean;
12
13
  ignoreSelectionChange?: boolean;
13
14
  onChange: (editorState: EditorState, editor: LexicalEditor) => void;
@@ -15,7 +15,6 @@ 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
19
  const CAN_USE_DOM = typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined';
21
20
 
@@ -25,7 +24,6 @@ const CAN_USE_DOM = typeof window !== 'undefined' && typeof window.document !==
25
24
  * This source code is licensed under the MIT license found in the
26
25
  * LICENSE file in the root directory of this source tree.
27
26
  *
28
- *
29
27
  */
30
28
  const useLayoutEffectImpl = CAN_USE_DOM ? react.useLayoutEffect : react.useEffect;
31
29
  var useLayoutEffect = useLayoutEffectImpl;
@@ -36,7 +34,6 @@ var useLayoutEffect = useLayoutEffectImpl;
36
34
  * This source code is licensed under the MIT license found in the
37
35
  * LICENSE file in the root directory of this source tree.
38
36
  *
39
- *
40
37
  */
41
38
  function OnChangePlugin({
42
39
  ignoreInitialChange = true,
@@ -67,4 +64,4 @@ function OnChangePlugin({
67
64
  return null;
68
65
  }
69
66
 
70
- module.exports = OnChangePlugin;
67
+ exports.OnChangePlugin = OnChangePlugin;
@@ -9,7 +9,7 @@
9
9
 
10
10
  import type {EditorState, LexicalEditor} from 'lexical';
11
11
 
12
- declare export default function OnChangePlugin({
12
+ declare export function OnChangePlugin({
13
13
  ignoreInitialChange?: boolean,
14
14
  ignoreSelectionChange?: boolean,
15
15
  onChange: (editorState: EditorState, editor: LexicalEditor) => 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 c=require("@lexical/react/LexicalComposerContext"),f=require("react"),g="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement?f.useLayoutEffect:f.useEffect;
8
- module.exports=function({ignoreInitialChange:d=!0,ignoreSelectionChange:e=!1,onChange:a}){const [b]=c.useLexicalComposerContext();g(()=>{if(a)return b.registerUpdateListener(({editorState:h,dirtyElements:k,dirtyLeaves:l,prevEditorState:m})=>{e&&0===k.size&&0===l.size||d&&m.isEmpty()||a(h,b)})},[b,d,e,a]);return null};
7
+ 'use strict';var c=require("@lexical/react/LexicalComposerContext"),f=require("react"),g="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement?f.useLayoutEffect:f.useEffect;
8
+ exports.OnChangePlugin=function({ignoreInitialChange:d=!0,ignoreSelectionChange:e=!1,onChange:a}){let [b]=c.useLexicalComposerContext();g(()=>{if(a)return b.registerUpdateListener(({editorState:h,dirtyElements:k,dirtyLeaves:l,prevEditorState:m})=>{e&&0===k.size&&0===l.size||d&&m.isEmpty()||a(h,b)})},[b,d,e,a]);return null}
@@ -7,9 +7,10 @@
7
7
  */
8
8
 
9
9
  import type {EditorState} from 'lexical';
10
+
10
11
  type InitialEditorStateType = null | string | EditorState | (() => void);
11
- export default function PlainTextPlugin(arg0: {
12
+ export function PlainTextPlugin(arg0: {
12
13
  contentEditable: JSX.Element | null;
13
14
  initialEditorState?: InitialEditorStateType;
14
- placeholder: JSX.Element | null;
15
+ placeholder: JSX.Element | string | null;
15
16
  }): JSX.Element | null;