@lexical/react 0.14.5 → 0.16.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 (310) hide show
  1. package/LexicalAutoEmbedPlugin.dev.js +15 -11
  2. package/LexicalAutoEmbedPlugin.dev.mjs +5 -2
  3. package/LexicalAutoEmbedPlugin.js +2 -0
  4. package/LexicalAutoEmbedPlugin.mjs +2 -0
  5. package/LexicalAutoEmbedPlugin.node.mjs +2 -0
  6. package/LexicalAutoEmbedPlugin.prod.js +6 -5
  7. package/LexicalAutoEmbedPlugin.prod.mjs +3 -1
  8. package/LexicalAutoFocusPlugin.dev.js +3 -0
  9. package/LexicalAutoFocusPlugin.dev.mjs +3 -0
  10. package/LexicalAutoFocusPlugin.js +2 -0
  11. package/LexicalAutoFocusPlugin.mjs +2 -0
  12. package/LexicalAutoFocusPlugin.node.mjs +2 -0
  13. package/LexicalAutoFocusPlugin.prod.js +2 -0
  14. package/LexicalAutoFocusPlugin.prod.mjs +2 -0
  15. package/LexicalAutoLinkPlugin.dev.js +9 -4
  16. package/LexicalAutoLinkPlugin.dev.mjs +10 -5
  17. package/LexicalAutoLinkPlugin.js +2 -0
  18. package/LexicalAutoLinkPlugin.mjs +2 -0
  19. package/LexicalAutoLinkPlugin.node.mjs +2 -0
  20. package/LexicalAutoLinkPlugin.prod.js +12 -10
  21. package/LexicalAutoLinkPlugin.prod.mjs +3 -1
  22. package/LexicalBlockWithAlignableContents.dev.js +14 -9
  23. package/LexicalBlockWithAlignableContents.dev.mjs +11 -7
  24. package/LexicalBlockWithAlignableContents.js +2 -0
  25. package/LexicalBlockWithAlignableContents.mjs +2 -0
  26. package/LexicalBlockWithAlignableContents.node.mjs +2 -0
  27. package/LexicalBlockWithAlignableContents.prod.js +6 -4
  28. package/LexicalBlockWithAlignableContents.prod.mjs +3 -1
  29. package/LexicalCharacterLimitPlugin.dev.js +17 -12
  30. package/LexicalCharacterLimitPlugin.dev.mjs +12 -8
  31. package/LexicalCharacterLimitPlugin.js +2 -0
  32. package/LexicalCharacterLimitPlugin.mjs +2 -0
  33. package/LexicalCharacterLimitPlugin.node.mjs +2 -0
  34. package/LexicalCharacterLimitPlugin.prod.js +11 -9
  35. package/LexicalCharacterLimitPlugin.prod.mjs +3 -1
  36. package/LexicalCheckListPlugin.dev.js +5 -0
  37. package/LexicalCheckListPlugin.dev.mjs +5 -0
  38. package/LexicalCheckListPlugin.js +2 -0
  39. package/LexicalCheckListPlugin.mjs +2 -0
  40. package/LexicalCheckListPlugin.node.mjs +2 -0
  41. package/LexicalCheckListPlugin.prod.js +4 -2
  42. package/LexicalCheckListPlugin.prod.mjs +3 -1
  43. package/LexicalClearEditorPlugin.dev.js +9 -2
  44. package/LexicalClearEditorPlugin.dev.mjs +11 -4
  45. package/LexicalClearEditorPlugin.js +2 -0
  46. package/LexicalClearEditorPlugin.mjs +2 -0
  47. package/LexicalClearEditorPlugin.node.mjs +2 -0
  48. package/LexicalClearEditorPlugin.prod.js +3 -1
  49. package/LexicalClearEditorPlugin.prod.mjs +3 -1
  50. package/LexicalClickableLinkPlugin.d.ts +3 -1
  51. package/LexicalClickableLinkPlugin.dev.js +17 -15
  52. package/LexicalClickableLinkPlugin.dev.mjs +16 -15
  53. package/LexicalClickableLinkPlugin.js +2 -0
  54. package/LexicalClickableLinkPlugin.js.flow +3 -1
  55. package/LexicalClickableLinkPlugin.mjs +3 -0
  56. package/LexicalClickableLinkPlugin.node.mjs +3 -0
  57. package/LexicalClickableLinkPlugin.prod.js +6 -4
  58. package/LexicalClickableLinkPlugin.prod.mjs +3 -1
  59. package/LexicalCollaborationContext.dev.js +3 -0
  60. package/LexicalCollaborationContext.dev.mjs +3 -0
  61. package/LexicalCollaborationContext.js +2 -0
  62. package/LexicalCollaborationContext.mjs +2 -0
  63. package/LexicalCollaborationContext.node.mjs +2 -0
  64. package/LexicalCollaborationContext.prod.js +2 -0
  65. package/LexicalCollaborationContext.prod.mjs +2 -0
  66. package/LexicalCollaborationPlugin.dev.js +20 -2
  67. package/LexicalCollaborationPlugin.dev.mjs +6 -1
  68. package/LexicalCollaborationPlugin.js +2 -0
  69. package/LexicalCollaborationPlugin.mjs +2 -0
  70. package/LexicalCollaborationPlugin.node.mjs +2 -0
  71. package/LexicalCollaborationPlugin.prod.js +12 -10
  72. package/LexicalCollaborationPlugin.prod.mjs +3 -1
  73. package/LexicalComposer.dev.js +17 -8
  74. package/LexicalComposer.dev.mjs +16 -8
  75. package/LexicalComposer.js +2 -0
  76. package/LexicalComposer.mjs +2 -0
  77. package/LexicalComposer.node.mjs +2 -0
  78. package/LexicalComposer.prod.js +5 -4
  79. package/LexicalComposer.prod.mjs +3 -1
  80. package/LexicalComposerContext.dev.js +3 -0
  81. package/LexicalComposerContext.dev.mjs +3 -0
  82. package/LexicalComposerContext.js +2 -0
  83. package/LexicalComposerContext.mjs +2 -0
  84. package/LexicalComposerContext.node.mjs +2 -0
  85. package/LexicalComposerContext.prod.js +4 -2
  86. package/LexicalComposerContext.prod.mjs +3 -1
  87. package/LexicalContentEditable.dev.js +24 -23
  88. package/LexicalContentEditable.dev.mjs +22 -22
  89. package/LexicalContentEditable.js +2 -0
  90. package/LexicalContentEditable.mjs +2 -0
  91. package/LexicalContentEditable.node.mjs +2 -0
  92. package/LexicalContentEditable.prod.js +5 -3
  93. package/LexicalContentEditable.prod.mjs +3 -1
  94. package/LexicalContextMenuPlugin.dev.js +29 -7
  95. package/LexicalContextMenuPlugin.dev.mjs +17 -8
  96. package/LexicalContextMenuPlugin.js +2 -0
  97. package/LexicalContextMenuPlugin.js.flow +12 -0
  98. package/LexicalContextMenuPlugin.mjs +2 -0
  99. package/LexicalContextMenuPlugin.node.mjs +2 -0
  100. package/LexicalContextMenuPlugin.prod.js +18 -16
  101. package/LexicalContextMenuPlugin.prod.mjs +3 -1
  102. package/LexicalDecoratorBlockNode.d.ts +1 -0
  103. package/LexicalDecoratorBlockNode.dev.js +6 -0
  104. package/LexicalDecoratorBlockNode.dev.mjs +6 -0
  105. package/LexicalDecoratorBlockNode.js +2 -0
  106. package/LexicalDecoratorBlockNode.mjs +2 -0
  107. package/LexicalDecoratorBlockNode.node.mjs +2 -0
  108. package/LexicalDecoratorBlockNode.prod.js +3 -1
  109. package/LexicalDecoratorBlockNode.prod.mjs +3 -1
  110. package/LexicalEditorRefPlugin.dev.js +17 -1
  111. package/LexicalEditorRefPlugin.dev.mjs +3 -0
  112. package/LexicalEditorRefPlugin.js +2 -0
  113. package/LexicalEditorRefPlugin.js.flow +19 -0
  114. package/LexicalEditorRefPlugin.mjs +2 -0
  115. package/LexicalEditorRefPlugin.node.mjs +2 -0
  116. package/LexicalEditorRefPlugin.prod.js +3 -1
  117. package/LexicalEditorRefPlugin.prod.mjs +2 -0
  118. package/LexicalErrorBoundary.d.ts +3 -1
  119. package/LexicalErrorBoundary.dev.js +30 -10
  120. package/LexicalErrorBoundary.dev.mjs +13 -7
  121. package/LexicalErrorBoundary.js +2 -0
  122. package/LexicalErrorBoundary.js.flow +4 -1
  123. package/LexicalErrorBoundary.mjs +3 -0
  124. package/LexicalErrorBoundary.node.mjs +3 -0
  125. package/LexicalErrorBoundary.prod.js +6 -4
  126. package/LexicalErrorBoundary.prod.mjs +3 -1
  127. package/LexicalHashtagPlugin.dev.js +5 -2
  128. package/LexicalHashtagPlugin.dev.mjs +5 -2
  129. package/LexicalHashtagPlugin.js +2 -0
  130. package/LexicalHashtagPlugin.mjs +2 -0
  131. package/LexicalHashtagPlugin.node.mjs +2 -0
  132. package/LexicalHashtagPlugin.prod.js +2 -0
  133. package/LexicalHashtagPlugin.prod.mjs +2 -0
  134. package/LexicalHistoryPlugin.dev.js +4 -0
  135. package/LexicalHistoryPlugin.dev.mjs +4 -0
  136. package/LexicalHistoryPlugin.js +2 -0
  137. package/LexicalHistoryPlugin.mjs +2 -0
  138. package/LexicalHistoryPlugin.node.mjs +2 -0
  139. package/LexicalHistoryPlugin.prod.js +2 -0
  140. package/LexicalHistoryPlugin.prod.mjs +2 -0
  141. package/LexicalHorizontalRuleNode.d.ts +2 -2
  142. package/LexicalHorizontalRuleNode.dev.js +23 -12
  143. package/LexicalHorizontalRuleNode.dev.mjs +21 -11
  144. package/LexicalHorizontalRuleNode.js +2 -0
  145. package/LexicalHorizontalRuleNode.mjs +2 -0
  146. package/LexicalHorizontalRuleNode.node.mjs +2 -0
  147. package/LexicalHorizontalRuleNode.prod.js +7 -5
  148. package/LexicalHorizontalRuleNode.prod.mjs +3 -1
  149. package/LexicalHorizontalRulePlugin.dev.js +3 -0
  150. package/LexicalHorizontalRulePlugin.dev.mjs +3 -0
  151. package/LexicalHorizontalRulePlugin.js +2 -0
  152. package/LexicalHorizontalRulePlugin.mjs +2 -0
  153. package/LexicalHorizontalRulePlugin.node.mjs +2 -0
  154. package/LexicalHorizontalRulePlugin.prod.js +2 -0
  155. package/LexicalHorizontalRulePlugin.prod.mjs +2 -0
  156. package/LexicalLinkPlugin.dev.js +6 -3
  157. package/LexicalLinkPlugin.dev.mjs +7 -4
  158. package/LexicalLinkPlugin.js +2 -0
  159. package/LexicalLinkPlugin.mjs +2 -0
  160. package/LexicalLinkPlugin.node.mjs +2 -0
  161. package/LexicalLinkPlugin.prod.js +3 -1
  162. package/LexicalLinkPlugin.prod.mjs +3 -1
  163. package/LexicalListPlugin.dev.js +4 -0
  164. package/LexicalListPlugin.dev.mjs +4 -0
  165. package/LexicalListPlugin.js +2 -0
  166. package/LexicalListPlugin.mjs +2 -0
  167. package/LexicalListPlugin.node.mjs +2 -0
  168. package/LexicalListPlugin.prod.js +2 -0
  169. package/LexicalListPlugin.prod.mjs +2 -0
  170. package/LexicalMarkdownShortcutPlugin.dev.js +3 -0
  171. package/LexicalMarkdownShortcutPlugin.dev.mjs +3 -0
  172. package/LexicalMarkdownShortcutPlugin.js +2 -0
  173. package/LexicalMarkdownShortcutPlugin.mjs +2 -0
  174. package/LexicalMarkdownShortcutPlugin.node.mjs +2 -0
  175. package/LexicalMarkdownShortcutPlugin.prod.js +2 -0
  176. package/LexicalMarkdownShortcutPlugin.prod.mjs +2 -0
  177. package/LexicalNestedComposer.dev.js +14 -9
  178. package/LexicalNestedComposer.dev.mjs +8 -4
  179. package/LexicalNestedComposer.js +2 -0
  180. package/LexicalNestedComposer.mjs +2 -0
  181. package/LexicalNestedComposer.node.mjs +2 -0
  182. package/LexicalNestedComposer.prod.js +7 -5
  183. package/LexicalNestedComposer.prod.mjs +3 -1
  184. package/LexicalNodeEventPlugin.dev.js +3 -0
  185. package/LexicalNodeEventPlugin.dev.mjs +3 -0
  186. package/LexicalNodeEventPlugin.js +2 -0
  187. package/LexicalNodeEventPlugin.js.flow +12 -0
  188. package/LexicalNodeEventPlugin.mjs +2 -0
  189. package/LexicalNodeEventPlugin.node.mjs +2 -0
  190. package/LexicalNodeEventPlugin.prod.js +2 -0
  191. package/LexicalNodeEventPlugin.prod.mjs +2 -0
  192. package/LexicalNodeMenuPlugin.dev.js +30 -8
  193. package/LexicalNodeMenuPlugin.dev.mjs +17 -8
  194. package/LexicalNodeMenuPlugin.js +2 -0
  195. package/LexicalNodeMenuPlugin.mjs +2 -0
  196. package/LexicalNodeMenuPlugin.node.mjs +2 -0
  197. package/LexicalNodeMenuPlugin.prod.js +17 -15
  198. package/LexicalNodeMenuPlugin.prod.mjs +3 -1
  199. package/LexicalOnChangePlugin.dev.js +9 -2
  200. package/LexicalOnChangePlugin.dev.mjs +11 -4
  201. package/LexicalOnChangePlugin.js +2 -0
  202. package/LexicalOnChangePlugin.mjs +2 -0
  203. package/LexicalOnChangePlugin.node.mjs +2 -0
  204. package/LexicalOnChangePlugin.prod.js +3 -1
  205. package/LexicalOnChangePlugin.prod.mjs +3 -1
  206. package/LexicalPlainTextPlugin.dev.js +34 -19
  207. package/LexicalPlainTextPlugin.dev.mjs +31 -17
  208. package/LexicalPlainTextPlugin.js +2 -0
  209. package/LexicalPlainTextPlugin.js.flow +1 -1
  210. package/LexicalPlainTextPlugin.mjs +2 -0
  211. package/LexicalPlainTextPlugin.node.mjs +2 -0
  212. package/LexicalPlainTextPlugin.prod.js +6 -4
  213. package/LexicalPlainTextPlugin.prod.mjs +3 -1
  214. package/LexicalRichTextPlugin.dev.js +34 -19
  215. package/LexicalRichTextPlugin.dev.mjs +31 -17
  216. package/LexicalRichTextPlugin.js +2 -0
  217. package/LexicalRichTextPlugin.js.flow +1 -1
  218. package/LexicalRichTextPlugin.mjs +2 -0
  219. package/LexicalRichTextPlugin.node.mjs +2 -0
  220. package/LexicalRichTextPlugin.prod.js +6 -4
  221. package/LexicalRichTextPlugin.prod.mjs +3 -1
  222. package/LexicalTabIndentationPlugin.dev.js +5 -2
  223. package/LexicalTabIndentationPlugin.dev.mjs +5 -2
  224. package/LexicalTabIndentationPlugin.js +2 -0
  225. package/LexicalTabIndentationPlugin.mjs +2 -0
  226. package/LexicalTabIndentationPlugin.node.mjs +2 -0
  227. package/LexicalTabIndentationPlugin.prod.js +2 -0
  228. package/LexicalTabIndentationPlugin.prod.mjs +2 -0
  229. package/LexicalTableOfContents.d.ts +6 -13
  230. package/LexicalTableOfContents.dev.js +57 -10
  231. package/LexicalTableOfContents.dev.mjs +58 -11
  232. package/LexicalTableOfContents.js +2 -0
  233. package/LexicalTableOfContents.js.flow +3 -7
  234. package/LexicalTableOfContents.mjs +2 -0
  235. package/LexicalTableOfContents.node.mjs +2 -0
  236. package/LexicalTableOfContents.prod.js +6 -4
  237. package/LexicalTableOfContents.prod.mjs +3 -1
  238. package/LexicalTableOfContentsPlugin.d.ts +20 -0
  239. package/LexicalTableOfContentsPlugin.dev.js +198 -0
  240. package/LexicalTableOfContentsPlugin.dev.mjs +196 -0
  241. package/LexicalTableOfContentsPlugin.js +11 -0
  242. package/LexicalTableOfContentsPlugin.js.flow +18 -0
  243. package/LexicalTableOfContentsPlugin.mjs +12 -0
  244. package/LexicalTableOfContentsPlugin.node.mjs +10 -0
  245. package/LexicalTableOfContentsPlugin.prod.js +12 -0
  246. package/LexicalTableOfContentsPlugin.prod.mjs +9 -0
  247. package/LexicalTablePlugin.dev.js +28 -2
  248. package/LexicalTablePlugin.dev.mjs +31 -5
  249. package/LexicalTablePlugin.js +2 -0
  250. package/LexicalTablePlugin.mjs +2 -0
  251. package/LexicalTablePlugin.node.mjs +2 -0
  252. package/LexicalTablePlugin.prod.js +9 -5
  253. package/LexicalTablePlugin.prod.mjs +3 -1
  254. package/LexicalTreeView.d.ts +3 -1
  255. package/LexicalTreeView.dev.js +22 -4
  256. package/LexicalTreeView.dev.mjs +8 -3
  257. package/LexicalTreeView.js +2 -0
  258. package/LexicalTreeView.js.flow +2 -0
  259. package/LexicalTreeView.mjs +2 -0
  260. package/LexicalTreeView.node.mjs +2 -0
  261. package/LexicalTreeView.prod.js +5 -3
  262. package/LexicalTreeView.prod.mjs +3 -1
  263. package/LexicalTypeaheadMenuPlugin.dev.js +30 -8
  264. package/LexicalTypeaheadMenuPlugin.dev.mjs +17 -8
  265. package/LexicalTypeaheadMenuPlugin.js +2 -0
  266. package/LexicalTypeaheadMenuPlugin.mjs +2 -0
  267. package/LexicalTypeaheadMenuPlugin.node.mjs +2 -0
  268. package/LexicalTypeaheadMenuPlugin.prod.js +21 -19
  269. package/LexicalTypeaheadMenuPlugin.prod.mjs +3 -1
  270. package/package.json +50 -20
  271. package/shared/useCharacterLimit.d.ts +1 -1
  272. package/useLexicalEditable.d.ts +11 -1
  273. package/useLexicalEditable.dev.js +22 -3
  274. package/useLexicalEditable.dev.mjs +23 -5
  275. package/useLexicalEditable.js +2 -0
  276. package/useLexicalEditable.js.flow +4 -1
  277. package/useLexicalEditable.mjs +4 -1
  278. package/useLexicalEditable.node.mjs +4 -1
  279. package/useLexicalEditable.prod.js +4 -2
  280. package/useLexicalEditable.prod.mjs +3 -1
  281. package/useLexicalIsTextContentEmpty.dev.js +9 -2
  282. package/useLexicalIsTextContentEmpty.dev.mjs +11 -4
  283. package/useLexicalIsTextContentEmpty.js +2 -0
  284. package/useLexicalIsTextContentEmpty.mjs +2 -0
  285. package/useLexicalIsTextContentEmpty.node.mjs +2 -0
  286. package/useLexicalIsTextContentEmpty.prod.js +3 -1
  287. package/useLexicalIsTextContentEmpty.prod.mjs +3 -1
  288. package/useLexicalNodeSelection.dev.js +3 -0
  289. package/useLexicalNodeSelection.dev.mjs +4 -1
  290. package/useLexicalNodeSelection.js +2 -0
  291. package/useLexicalNodeSelection.mjs +2 -0
  292. package/useLexicalNodeSelection.node.mjs +2 -0
  293. package/useLexicalNodeSelection.prod.js +2 -0
  294. package/useLexicalNodeSelection.prod.mjs +3 -1
  295. package/useLexicalSubscription.d.ts +4 -1
  296. package/useLexicalSubscription.dev.js +12 -3
  297. package/useLexicalSubscription.dev.mjs +13 -5
  298. package/useLexicalSubscription.js +2 -0
  299. package/useLexicalSubscription.js.flow +4 -1
  300. package/useLexicalSubscription.mjs +4 -1
  301. package/useLexicalSubscription.node.mjs +4 -1
  302. package/useLexicalSubscription.prod.js +4 -2
  303. package/useLexicalSubscription.prod.mjs +3 -1
  304. package/useLexicalTextEntity.dev.js +3 -0
  305. package/useLexicalTextEntity.dev.mjs +3 -0
  306. package/useLexicalTextEntity.js +2 -0
  307. package/useLexicalTextEntity.mjs +2 -0
  308. package/useLexicalTextEntity.node.mjs +2 -0
  309. package/useLexicalTextEntity.prod.js +2 -0
  310. package/useLexicalTextEntity.prod.mjs +2 -0
@@ -3,13 +3,15 @@
3
3
  *
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
  */
8
+
7
9
  import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
8
10
  import { useLexicalNodeSelection } from '@lexical/react/useLexicalNodeSelection';
9
- import { mergeRegister } from '@lexical/utils';
11
+ import { addClassNamesToElement, mergeRegister, removeClassNamesFromElement } from '@lexical/utils';
10
12
  import { createCommand, DecoratorNode, $applyNodeReplacement, $isNodeSelection, $getSelection, $getNodeByKey, CLICK_COMMAND, COMMAND_PRIORITY_LOW, KEY_DELETE_COMMAND, KEY_BACKSPACE_COMMAND } from 'lexical';
11
- import * as React from 'react';
12
13
  import { useCallback, useEffect } from 'react';
14
+ import { jsx } from 'react/jsx-runtime';
13
15
 
14
16
  /**
15
17
  * Copyright (c) Meta Platforms, Inc. and affiliates.
@@ -18,13 +20,14 @@ import { useCallback, useEffect } from 'react';
18
20
  * LICENSE file in the root directory of this source tree.
19
21
  *
20
22
  */
23
+
21
24
  const INSERT_HORIZONTAL_RULE_COMMAND = createCommand('INSERT_HORIZONTAL_RULE_COMMAND');
22
25
  function HorizontalRuleComponent({
23
26
  nodeKey
24
27
  }) {
25
28
  const [editor] = useLexicalComposerContext();
26
29
  const [isSelected, setSelected, clearSelection] = useLexicalNodeSelection(nodeKey);
27
- const onDelete = useCallback(event => {
30
+ const $onDelete = useCallback(event => {
28
31
  if (isSelected && $isNodeSelection($getSelection())) {
29
32
  event.preventDefault();
30
33
  const node = $getNodeByKey(nodeKey);
@@ -46,12 +49,17 @@ function HorizontalRuleComponent({
46
49
  return true;
47
50
  }
48
51
  return false;
49
- }, COMMAND_PRIORITY_LOW), editor.registerCommand(KEY_DELETE_COMMAND, onDelete, COMMAND_PRIORITY_LOW), editor.registerCommand(KEY_BACKSPACE_COMMAND, onDelete, COMMAND_PRIORITY_LOW));
50
- }, [clearSelection, editor, isSelected, nodeKey, onDelete, setSelected]);
52
+ }, COMMAND_PRIORITY_LOW), editor.registerCommand(KEY_DELETE_COMMAND, $onDelete, COMMAND_PRIORITY_LOW), editor.registerCommand(KEY_BACKSPACE_COMMAND, $onDelete, COMMAND_PRIORITY_LOW));
53
+ }, [clearSelection, editor, isSelected, nodeKey, $onDelete, setSelected]);
51
54
  useEffect(() => {
52
55
  const hrElem = editor.getElementByKey(nodeKey);
56
+ const isSelectedClassName = 'selected';
53
57
  if (hrElem !== null) {
54
- hrElem.className = isSelected ? 'selected' : '';
58
+ if (isSelected) {
59
+ addClassNamesToElement(hrElem, isSelectedClassName);
60
+ } else {
61
+ removeClassNamesFromElement(hrElem, isSelectedClassName);
62
+ }
55
63
  }
56
64
  }, [editor, isSelected, nodeKey]);
57
65
  return null;
@@ -69,7 +77,7 @@ class HorizontalRuleNode extends DecoratorNode {
69
77
  static importDOM() {
70
78
  return {
71
79
  hr: () => ({
72
- conversion: convertHorizontalRuleElement,
80
+ conversion: $convertHorizontalRuleElement,
73
81
  priority: 0
74
82
  })
75
83
  };
@@ -85,8 +93,10 @@ class HorizontalRuleNode extends DecoratorNode {
85
93
  element: document.createElement('hr')
86
94
  };
87
95
  }
88
- createDOM() {
89
- return document.createElement('hr');
96
+ createDOM(config) {
97
+ const element = document.createElement('hr');
98
+ addClassNamesToElement(element, config.theme.hr);
99
+ return element;
90
100
  }
91
101
  getTextContent() {
92
102
  return '\n';
@@ -98,12 +108,12 @@ class HorizontalRuleNode extends DecoratorNode {
98
108
  return false;
99
109
  }
100
110
  decorate() {
101
- return /*#__PURE__*/React.createElement(HorizontalRuleComponent, {
111
+ return /*#__PURE__*/jsx(HorizontalRuleComponent, {
102
112
  nodeKey: this.__key
103
113
  });
104
114
  }
105
115
  }
106
- function convertHorizontalRuleElement() {
116
+ function $convertHorizontalRuleElement() {
107
117
  return {
108
118
  node: $createHorizontalRuleNode()
109
119
  };
@@ -3,7 +3,9 @@
3
3
  *
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
  */
8
+
7
9
  'use strict'
8
10
  const LexicalHorizontalRuleNode = process.env.NODE_ENV === 'development' ? require('./LexicalHorizontalRuleNode.dev.js') : require('./LexicalHorizontalRuleNode.prod.js');
9
11
  module.exports = LexicalHorizontalRuleNode;
@@ -3,7 +3,9 @@
3
3
  *
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
  */
8
+
7
9
  import * as modDev from './LexicalHorizontalRuleNode.dev.mjs';
8
10
  import * as modProd from './LexicalHorizontalRuleNode.prod.mjs';
9
11
  const mod = process.env.NODE_ENV === 'development' ? modDev : modProd;
@@ -3,7 +3,9 @@
3
3
  *
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
  */
8
+
7
9
  const mod = await (process.env.NODE_ENV === 'development' ? import('./LexicalHorizontalRuleNode.dev.mjs') : import('./LexicalHorizontalRuleNode.prod.mjs'));
8
10
  export const $createHorizontalRuleNode = mod.$createHorizontalRuleNode;
9
11
  export const $isHorizontalRuleNode = mod.$isHorizontalRuleNode;
@@ -3,9 +3,11 @@
3
3
  *
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
  */
7
- 'use strict';var a=require("@lexical/react/LexicalComposerContext"),f=require("@lexical/react/useLexicalNodeSelection"),g=require("@lexical/utils"),k=require("lexical"),n=require("react");let p=k.createCommand("INSERT_HORIZONTAL_RULE_COMMAND");
8
- function q({nodeKey:b}){let [d]=a.useLexicalComposerContext(),[e,l,m]=f.useLexicalNodeSelection(b),h=n.useCallback(c=>e&&k.$isNodeSelection(k.$getSelection())&&(c.preventDefault(),c=k.$getNodeByKey(b),r(c))?(c.remove(),!0):!1,[e,b]);n.useEffect(()=>g.mergeRegister(d.registerCommand(k.CLICK_COMMAND,c=>{let v=d.getElementByKey(b);return c.target===v?(c.shiftKey||m(),l(!e),!0):!1},k.COMMAND_PRIORITY_LOW),d.registerCommand(k.KEY_DELETE_COMMAND,h,k.COMMAND_PRIORITY_LOW),d.registerCommand(k.KEY_BACKSPACE_COMMAND,
9
- h,k.COMMAND_PRIORITY_LOW)),[m,d,e,b,h,l]);n.useEffect(()=>{let c=d.getElementByKey(b);null!==c&&(c.className=e?"selected":"")},[d,e,b]);return null}
10
- class t extends k.DecoratorNode{static getType(){return"horizontalrule"}static clone(b){return new t(b.__key)}static importJSON(){return u()}static importDOM(){return{hr:()=>({conversion:w,priority:0})}}exportJSON(){return{type:"horizontalrule",version:1}}exportDOM(){return{element:document.createElement("hr")}}createDOM(){return document.createElement("hr")}getTextContent(){return"\n"}isInline(){return!1}updateDOM(){return!1}decorate(){return n.createElement(q,{nodeKey:this.__key})}}
11
- function w(){return{node:u()}}function u(){return k.$applyNodeReplacement(new t)}function r(b){return b instanceof t}exports.$createHorizontalRuleNode=u;exports.$isHorizontalRuleNode=r;exports.HorizontalRuleNode=t;exports.INSERT_HORIZONTAL_RULE_COMMAND=p
8
+
9
+ 'use strict';var b=require("@lexical/react/LexicalComposerContext"),f=require("@lexical/react/useLexicalNodeSelection"),g=require("@lexical/utils"),h=require("lexical"),l=require("react"),p=require("react/jsx-runtime");let q=h.createCommand("INSERT_HORIZONTAL_RULE_COMMAND");
10
+ function r({nodeKey:a}){let [d]=b.useLexicalComposerContext(),[e,m,n]=f.useLexicalNodeSelection(a),k=l.useCallback(c=>e&&h.$isNodeSelection(h.$getSelection())&&(c.preventDefault(),c=h.$getNodeByKey(a),t(c))?(c.remove(),!0):!1,[e,a]);l.useEffect(()=>g.mergeRegister(d.registerCommand(h.CLICK_COMMAND,c=>{let w=d.getElementByKey(a);return c.target===w?(c.shiftKey||n(),m(!e),!0):!1},h.COMMAND_PRIORITY_LOW),d.registerCommand(h.KEY_DELETE_COMMAND,k,h.COMMAND_PRIORITY_LOW),d.registerCommand(h.KEY_BACKSPACE_COMMAND,
11
+ k,h.COMMAND_PRIORITY_LOW)),[n,d,e,a,k,m]);l.useEffect(()=>{let c=d.getElementByKey(a);null!==c&&(e?g.addClassNamesToElement(c,"selected"):g.removeClassNamesFromElement(c,"selected"))},[d,e,a]);return null}
12
+ class u extends h.DecoratorNode{static getType(){return"horizontalrule"}static clone(a){return new u(a.__key)}static importJSON(){return v()}static importDOM(){return{hr:()=>({conversion:x,priority:0})}}exportJSON(){return{type:"horizontalrule",version:1}}exportDOM(){return{element:document.createElement("hr")}}createDOM(a){let d=document.createElement("hr");g.addClassNamesToElement(d,a.theme.hr);return d}getTextContent(){return"\n"}isInline(){return!1}updateDOM(){return!1}decorate(){return p.jsx(r,
13
+ {nodeKey:this.__key})}}function x(){return{node:v()}}function v(){return h.$applyNodeReplacement(new u)}function t(a){return a instanceof u}exports.$createHorizontalRuleNode=v;exports.$isHorizontalRuleNode=t;exports.HorizontalRuleNode=u;exports.INSERT_HORIZONTAL_RULE_COMMAND=q
@@ -3,5 +3,7 @@
3
3
  *
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
  */
7
- import{useLexicalComposerContext as e}from"@lexical/react/LexicalComposerContext";import{useLexicalNodeSelection as t}from"@lexical/react/useLexicalNodeSelection";import{mergeRegister as r}from"@lexical/utils";import{createCommand as n,DecoratorNode as o,$applyNodeReplacement as i,$isNodeSelection as c,$getSelection as a,$getNodeByKey as l,CLICK_COMMAND as u,COMMAND_PRIORITY_LOW as m,KEY_DELETE_COMMAND as s,KEY_BACKSPACE_COMMAND as p}from"lexical";import*as f from"react";import{useCallback as d,useEffect as x}from"react";const y=n("INSERT_HORIZONTAL_RULE_COMMAND");function O({nodeKey:n}){const[o]=e(),[i,f,y]=t(n),O=d((e=>{if(i&&c(a())){e.preventDefault();const t=l(n);if(E(t))return t.remove(),!0}return!1}),[i,n]);return x((()=>r(o.registerCommand(u,(e=>{const t=o.getElementByKey(n);return e.target===t&&(e.shiftKey||y(),f(!i),!0)}),m),o.registerCommand(s,O,m),o.registerCommand(p,O,m))),[y,o,i,n,O,f]),x((()=>{const e=o.getElementByKey(n);null!==e&&(e.className=i?"selected":"")}),[o,i,n]),null}class g extends o{static getType(){return"horizontalrule"}static clone(e){return new g(e.__key)}static importJSON(e){return C()}static importDOM(){return{hr:()=>({conversion:h,priority:0})}}exportJSON(){return{type:"horizontalrule",version:1}}exportDOM(){return{element:document.createElement("hr")}}createDOM(){return document.createElement("hr")}getTextContent(){return"\n"}isInline(){return!1}updateDOM(){return!1}decorate(){return f.createElement(O,{nodeKey:this.__key})}}function h(){return{node:C()}}function C(){return i(new g)}function E(e){return e instanceof g}export{C as $createHorizontalRuleNode,E as $isHorizontalRuleNode,g as HorizontalRuleNode,y as INSERT_HORIZONTAL_RULE_COMMAND};
8
+
9
+ import{useLexicalComposerContext as e}from"@lexical/react/LexicalComposerContext";import{useLexicalNodeSelection as t}from"@lexical/react/useLexicalNodeSelection";import{addClassNamesToElement as r,mergeRegister as n,removeClassNamesFromElement as o}from"@lexical/utils";import{createCommand as i,DecoratorNode as c,$applyNodeReplacement as u,$isNodeSelection as m,$getSelection as l,$getNodeByKey as a,CLICK_COMMAND as s,COMMAND_PRIORITY_LOW as p,KEY_DELETE_COMMAND as f,KEY_BACKSPACE_COMMAND as d}from"lexical";import{useCallback as x,useEffect as y}from"react";import{jsx as h}from"react/jsx-runtime";const O=i("INSERT_HORIZONTAL_RULE_COMMAND");function g({nodeKey:i}){const[c]=e(),[u,h,O]=t(i),g=x((e=>{if(u&&m(l())){e.preventDefault();const t=a(i);if(E(t))return t.remove(),!0}return!1}),[u,i]);return y((()=>n(c.registerCommand(s,(e=>{const t=c.getElementByKey(i);return e.target===t&&(e.shiftKey||O(),h(!u),!0)}),p),c.registerCommand(f,g,p),c.registerCommand(d,g,p))),[O,c,u,i,g,h]),y((()=>{const e=c.getElementByKey(i),t="selected";null!==e&&(u?r(e,t):o(e,t))}),[c,u,i]),null}class C extends c{static getType(){return"horizontalrule"}static clone(e){return new C(e.__key)}static importJSON(e){return D()}static importDOM(){return{hr:()=>({conversion:_,priority:0})}}exportJSON(){return{type:"horizontalrule",version:1}}exportDOM(){return{element:document.createElement("hr")}}createDOM(e){const t=document.createElement("hr");return r(t,e.theme.hr),t}getTextContent(){return"\n"}isInline(){return!1}updateDOM(){return!1}decorate(){return h(g,{nodeKey:this.__key})}}function _(){return{node:D()}}function D(){return u(new C)}function E(e){return e instanceof C}export{D as $createHorizontalRuleNode,E as $isHorizontalRuleNode,C as HorizontalRuleNode,O as INSERT_HORIZONTAL_RULE_COMMAND};
@@ -3,7 +3,9 @@
3
3
  *
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
  */
8
+
7
9
  'use strict';
8
10
 
9
11
  var LexicalComposerContext = require('@lexical/react/LexicalComposerContext');
@@ -19,6 +21,7 @@ var react = require('react');
19
21
  * LICENSE file in the root directory of this source tree.
20
22
  *
21
23
  */
24
+
22
25
  function HorizontalRulePlugin() {
23
26
  const [editor] = LexicalComposerContext.useLexicalComposerContext();
24
27
  react.useEffect(() => {
@@ -3,7 +3,9 @@
3
3
  *
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
  */
8
+
7
9
  import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
8
10
  import { INSERT_HORIZONTAL_RULE_COMMAND, $createHorizontalRuleNode } from '@lexical/react/LexicalHorizontalRuleNode';
9
11
  import { $insertNodeToNearestRoot } from '@lexical/utils';
@@ -17,6 +19,7 @@ import { useEffect } from 'react';
17
19
  * LICENSE file in the root directory of this source tree.
18
20
  *
19
21
  */
22
+
20
23
  function HorizontalRulePlugin() {
21
24
  const [editor] = useLexicalComposerContext();
22
25
  useEffect(() => {
@@ -3,7 +3,9 @@
3
3
  *
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
  */
8
+
7
9
  'use strict'
8
10
  const LexicalHorizontalRulePlugin = process.env.NODE_ENV === 'development' ? require('./LexicalHorizontalRulePlugin.dev.js') : require('./LexicalHorizontalRulePlugin.prod.js');
9
11
  module.exports = LexicalHorizontalRulePlugin;
@@ -3,7 +3,9 @@
3
3
  *
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
  */
8
+
7
9
  import * as modDev from './LexicalHorizontalRulePlugin.dev.mjs';
8
10
  import * as modProd from './LexicalHorizontalRulePlugin.prod.mjs';
9
11
  const mod = process.env.NODE_ENV === 'development' ? modDev : modProd;
@@ -3,6 +3,8 @@
3
3
  *
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
  */
8
+
7
9
  const mod = await (process.env.NODE_ENV === 'development' ? import('./LexicalHorizontalRulePlugin.dev.mjs') : import('./LexicalHorizontalRulePlugin.prod.mjs'));
8
10
  export const HorizontalRulePlugin = mod.HorizontalRulePlugin;
@@ -3,6 +3,8 @@
3
3
  *
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
  */
8
+
7
9
  'use strict';var b=require("@lexical/react/LexicalComposerContext"),c=require("@lexical/react/LexicalHorizontalRuleNode"),e=require("@lexical/utils"),f=require("lexical"),g=require("react");
8
10
  exports.HorizontalRulePlugin=function(){let [d]=b.useLexicalComposerContext();g.useEffect(()=>d.registerCommand(c.INSERT_HORIZONTAL_RULE_COMMAND,()=>{var a=f.$getSelection();if(!f.$isRangeSelection(a))return!1;null!==a.focus.getNode()&&(a=c.$createHorizontalRuleNode(),e.$insertNodeToNearestRoot(a));return!0},f.COMMAND_PRIORITY_EDITOR),[d]);return null}
@@ -3,5 +3,7 @@
3
3
  *
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
  */
8
+
7
9
  import{useLexicalComposerContext as o}from"@lexical/react/LexicalComposerContext";import{INSERT_HORIZONTAL_RULE_COMMAND as r,$createHorizontalRuleNode as t}from"@lexical/react/LexicalHorizontalRuleNode";import{$insertNodeToNearestRoot as e}from"@lexical/utils";import{$getSelection as i,$isRangeSelection as l,COMMAND_PRIORITY_EDITOR as c}from"lexical";import{useEffect as m}from"react";function n(){const[n]=o();return m((()=>n.registerCommand(r,(o=>{const r=i();if(!l(r))return!1;if(null!==r.focus.getNode()){const o=t();e(o)}return!0}),c)),[n]),null}export{n as HorizontalRulePlugin};
@@ -3,7 +3,9 @@
3
3
  *
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
  */
8
+
7
9
  'use strict';
8
10
 
9
11
  var link = require('@lexical/link');
@@ -19,6 +21,7 @@ var react = require('react');
19
21
  * LICENSE file in the root directory of this source tree.
20
22
  *
21
23
  */
24
+
22
25
  function LinkPlugin({
23
26
  validateUrl
24
27
  }) {
@@ -29,11 +32,11 @@ function LinkPlugin({
29
32
  }
30
33
  return utils.mergeRegister(editor.registerCommand(link.TOGGLE_LINK_COMMAND, payload => {
31
34
  if (payload === null) {
32
- link.toggleLink(payload);
35
+ link.$toggleLink(payload);
33
36
  return true;
34
37
  } else if (typeof payload === 'string') {
35
38
  if (validateUrl === undefined || validateUrl(payload)) {
36
- link.toggleLink(payload);
39
+ link.$toggleLink(payload);
37
40
  return true;
38
41
  }
39
42
  return false;
@@ -44,7 +47,7 @@ function LinkPlugin({
44
47
  rel,
45
48
  title
46
49
  } = payload;
47
- link.toggleLink(url, {
50
+ link.$toggleLink(url, {
48
51
  rel,
49
52
  target,
50
53
  title
@@ -3,8 +3,10 @@
3
3
  *
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
  */
7
- import { LinkNode, TOGGLE_LINK_COMMAND, toggleLink } from '@lexical/link';
8
+
9
+ import { LinkNode, TOGGLE_LINK_COMMAND, $toggleLink } from '@lexical/link';
8
10
  import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
9
11
  import { mergeRegister, objectKlassEquals } from '@lexical/utils';
10
12
  import { COMMAND_PRIORITY_LOW, PASTE_COMMAND, $getSelection, $isRangeSelection, $isElementNode } from 'lexical';
@@ -17,6 +19,7 @@ import { useEffect } from 'react';
17
19
  * LICENSE file in the root directory of this source tree.
18
20
  *
19
21
  */
22
+
20
23
  function LinkPlugin({
21
24
  validateUrl
22
25
  }) {
@@ -27,11 +30,11 @@ function LinkPlugin({
27
30
  }
28
31
  return mergeRegister(editor.registerCommand(TOGGLE_LINK_COMMAND, payload => {
29
32
  if (payload === null) {
30
- toggleLink(payload);
33
+ $toggleLink(payload);
31
34
  return true;
32
35
  } else if (typeof payload === 'string') {
33
36
  if (validateUrl === undefined || validateUrl(payload)) {
34
- toggleLink(payload);
37
+ $toggleLink(payload);
35
38
  return true;
36
39
  }
37
40
  return false;
@@ -42,7 +45,7 @@ function LinkPlugin({
42
45
  rel,
43
46
  title
44
47
  } = payload;
45
- toggleLink(url, {
48
+ $toggleLink(url, {
46
49
  rel,
47
50
  target,
48
51
  title
@@ -3,7 +3,9 @@
3
3
  *
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
  */
8
+
7
9
  'use strict'
8
10
  const LexicalLinkPlugin = process.env.NODE_ENV === 'development' ? require('./LexicalLinkPlugin.dev.js') : require('./LexicalLinkPlugin.prod.js');
9
11
  module.exports = LexicalLinkPlugin;
@@ -3,7 +3,9 @@
3
3
  *
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
  */
8
+
7
9
  import * as modDev from './LexicalLinkPlugin.dev.mjs';
8
10
  import * as modProd from './LexicalLinkPlugin.prod.mjs';
9
11
  const mod = process.env.NODE_ENV === 'development' ? modDev : modProd;
@@ -3,6 +3,8 @@
3
3
  *
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
  */
8
+
7
9
  const mod = await (process.env.NODE_ENV === 'development' ? import('./LexicalLinkPlugin.dev.mjs') : import('./LexicalLinkPlugin.prod.mjs'));
8
10
  export const LinkPlugin = mod.LinkPlugin;
@@ -3,7 +3,9 @@
3
3
  *
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
  */
8
+
7
9
  'use strict';var b=require("@lexical/link"),c=require("@lexical/react/LexicalComposerContext"),k=require("@lexical/utils"),l=require("lexical"),m=require("react");
8
- exports.LinkPlugin=function({validateUrl:d}){let [e]=c.useLexicalComposerContext();m.useEffect(()=>{if(!e.hasNodes([b.LinkNode]))throw Error("LinkPlugin: LinkNode not registered on editor");return k.mergeRegister(e.registerCommand(b.TOGGLE_LINK_COMMAND,a=>{if(null===a)return b.toggleLink(a),!0;if("string"===typeof a)return void 0===d||d(a)?(b.toggleLink(a),!0):!1;let {url:f,target:g,rel:h,title:n}=a;b.toggleLink(f,{rel:h,target:g,title:n});return!0},l.COMMAND_PRIORITY_LOW),void 0!==d?e.registerCommand(l.PASTE_COMMAND,
10
+ exports.LinkPlugin=function({validateUrl:d}){let [e]=c.useLexicalComposerContext();m.useEffect(()=>{if(!e.hasNodes([b.LinkNode]))throw Error("LinkPlugin: LinkNode not registered on editor");return k.mergeRegister(e.registerCommand(b.TOGGLE_LINK_COMMAND,a=>{if(null===a)return b.$toggleLink(a),!0;if("string"===typeof a)return void 0===d||d(a)?(b.$toggleLink(a),!0):!1;let {url:f,target:g,rel:h,title:n}=a;b.$toggleLink(f,{rel:h,target:g,title:n});return!0},l.COMMAND_PRIORITY_LOW),void 0!==d?e.registerCommand(l.PASTE_COMMAND,
9
11
  a=>{let f=l.$getSelection();if(!l.$isRangeSelection(f)||f.isCollapsed()||!k.objectKlassEquals(a,ClipboardEvent)||null===a.clipboardData)return!1;let g=a.clipboardData.getData("text");return d(g)?f.getNodes().some(h=>l.$isElementNode(h))?!1:(e.dispatchCommand(b.TOGGLE_LINK_COMMAND,g),a.preventDefault(),!0):!1},l.COMMAND_PRIORITY_LOW):()=>{})},[e,d]);return null}
@@ -3,5 +3,7 @@
3
3
  *
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
  */
7
- import{LinkNode as t,TOGGLE_LINK_COMMAND as r,toggleLink as e}from"@lexical/link";import{useLexicalComposerContext as o}from"@lexical/react/LexicalComposerContext";import{mergeRegister as i,objectKlassEquals as n}from"@lexical/utils";import{COMMAND_PRIORITY_LOW as l,PASTE_COMMAND as a,$getSelection as m,$isRangeSelection as s,$isElementNode as c}from"lexical";import{useEffect as d}from"react";function u({validateUrl:u}){const[p]=o();return d((()=>{if(!p.hasNodes([t]))throw new Error("LinkPlugin: LinkNode not registered on editor");return i(p.registerCommand(r,(t=>{if(null===t)return e(t),!0;if("string"==typeof t)return!(void 0!==u&&!u(t))&&(e(t),!0);{const{url:r,target:o,rel:i,title:n}=t;return e(r,{rel:i,target:o,title:n}),!0}}),l),void 0!==u?p.registerCommand(a,(t=>{const e=m();if(!s(e)||e.isCollapsed()||!n(t,ClipboardEvent))return!1;const o=t;if(null===o.clipboardData)return!1;const i=o.clipboardData.getData("text");return!!u(i)&&(!e.getNodes().some((t=>c(t)))&&(p.dispatchCommand(r,i),t.preventDefault(),!0))}),l):()=>{})}),[p,u]),null}export{u as LinkPlugin};
8
+
9
+ import{LinkNode as t,TOGGLE_LINK_COMMAND as r,$toggleLink as e}from"@lexical/link";import{useLexicalComposerContext as o}from"@lexical/react/LexicalComposerContext";import{mergeRegister as i,objectKlassEquals as n}from"@lexical/utils";import{COMMAND_PRIORITY_LOW as l,PASTE_COMMAND as a,$getSelection as m,$isRangeSelection as s,$isElementNode as c}from"lexical";import{useEffect as d}from"react";function u({validateUrl:u}){const[p]=o();return d((()=>{if(!p.hasNodes([t]))throw new Error("LinkPlugin: LinkNode not registered on editor");return i(p.registerCommand(r,(t=>{if(null===t)return e(t),!0;if("string"==typeof t)return!(void 0!==u&&!u(t))&&(e(t),!0);{const{url:r,target:o,rel:i,title:n}=t;return e(r,{rel:i,target:o,title:n}),!0}}),l),void 0!==u?p.registerCommand(a,(t=>{const e=m();if(!s(e)||e.isCollapsed()||!n(t,ClipboardEvent))return!1;const o=t;if(null===o.clipboardData)return!1;const i=o.clipboardData.getData("text");return!!u(i)&&(!e.getNodes().some((t=>c(t)))&&(p.dispatchCommand(r,i),t.preventDefault(),!0))}),l):()=>{})}),[p,u]),null}export{u as LinkPlugin};
@@ -3,7 +3,9 @@
3
3
  *
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
  */
8
+
7
9
  'use strict';
8
10
 
9
11
  var list = require('@lexical/list');
@@ -19,6 +21,7 @@ var lexical = require('lexical');
19
21
  * LICENSE file in the root directory of this source tree.
20
22
  *
21
23
  */
24
+
22
25
  function useList(editor) {
23
26
  react.useEffect(() => {
24
27
  return utils.mergeRegister(editor.registerCommand(list.INSERT_ORDERED_LIST_COMMAND, () => {
@@ -47,6 +50,7 @@ function useList(editor) {
47
50
  * LICENSE file in the root directory of this source tree.
48
51
  *
49
52
  */
53
+
50
54
  function ListPlugin() {
51
55
  const [editor] = LexicalComposerContext.useLexicalComposerContext();
52
56
  react.useEffect(() => {
@@ -3,7 +3,9 @@
3
3
  *
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
  */
8
+
7
9
  import { INSERT_ORDERED_LIST_COMMAND, insertList, INSERT_UNORDERED_LIST_COMMAND, REMOVE_LIST_COMMAND, removeList, $handleListInsertParagraph, ListNode, ListItemNode } from '@lexical/list';
8
10
  import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
9
11
  import { useEffect } from 'react';
@@ -17,6 +19,7 @@ import { COMMAND_PRIORITY_LOW, INSERT_PARAGRAPH_COMMAND } from 'lexical';
17
19
  * LICENSE file in the root directory of this source tree.
18
20
  *
19
21
  */
22
+
20
23
  function useList(editor) {
21
24
  useEffect(() => {
22
25
  return mergeRegister(editor.registerCommand(INSERT_ORDERED_LIST_COMMAND, () => {
@@ -45,6 +48,7 @@ function useList(editor) {
45
48
  * LICENSE file in the root directory of this source tree.
46
49
  *
47
50
  */
51
+
48
52
  function ListPlugin() {
49
53
  const [editor] = useLexicalComposerContext();
50
54
  useEffect(() => {
@@ -3,7 +3,9 @@
3
3
  *
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
  */
8
+
7
9
  'use strict'
8
10
  const LexicalListPlugin = process.env.NODE_ENV === 'development' ? require('./LexicalListPlugin.dev.js') : require('./LexicalListPlugin.prod.js');
9
11
  module.exports = LexicalListPlugin;
@@ -3,7 +3,9 @@
3
3
  *
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
  */
8
+
7
9
  import * as modDev from './LexicalListPlugin.dev.mjs';
8
10
  import * as modProd from './LexicalListPlugin.prod.mjs';
9
11
  const mod = process.env.NODE_ENV === 'development' ? modDev : modProd;
@@ -3,6 +3,8 @@
3
3
  *
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
  */
8
+
7
9
  const mod = await (process.env.NODE_ENV === 'development' ? import('./LexicalListPlugin.dev.mjs') : import('./LexicalListPlugin.prod.mjs'));
8
10
  export const ListPlugin = mod.ListPlugin;
@@ -3,7 +3,9 @@
3
3
  *
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
  */
8
+
7
9
  'use strict';var b=require("@lexical/list"),c=require("@lexical/react/LexicalComposerContext"),d=require("react"),e=require("@lexical/utils"),f=require("lexical");
8
10
  function g(a){d.useEffect(()=>e.mergeRegister(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,()=>{b.removeList(a);return!0},f.COMMAND_PRIORITY_LOW),a.registerCommand(f.INSERT_PARAGRAPH_COMMAND,()=>b.$handleListInsertParagraph()?!0:!1,f.COMMAND_PRIORITY_LOW)),[a])}
9
11
  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}
@@ -3,5 +3,7 @@
3
3
  *
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
  */
8
+
7
9
  import{INSERT_ORDERED_LIST_COMMAND as r,insertList as e,INSERT_UNORDERED_LIST_COMMAND as o,REMOVE_LIST_COMMAND as t,removeList as i,$handleListInsertParagraph as m,ListNode as n,ListItemNode as l}from"@lexical/list";import{useLexicalComposerContext as s}from"@lexical/react/LexicalComposerContext";import{useEffect as a}from"react";import{mergeRegister as c}from"@lexical/utils";import{COMMAND_PRIORITY_LOW as d,INSERT_PARAGRAPH_COMMAND as f}from"lexical";function u(){const[u]=s();return a((()=>{if(!u.hasNodes([n,l]))throw new Error("ListPlugin: ListNode and/or ListItemNode not registered on editor")}),[u]),function(n){a((()=>c(n.registerCommand(r,(()=>(e(n,"number"),!0)),d),n.registerCommand(o,(()=>(e(n,"bullet"),!0)),d),n.registerCommand(t,(()=>(i(n),!0)),d),n.registerCommand(f,(()=>!!m()),d))),[n])}(u),null}export{u as ListPlugin};
@@ -3,7 +3,9 @@
3
3
  *
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
  */
8
+
7
9
  'use strict';
8
10
 
9
11
  var markdown = require('@lexical/markdown');
@@ -18,6 +20,7 @@ var react = require('react');
18
20
  * LICENSE file in the root directory of this source tree.
19
21
  *
20
22
  */
23
+
21
24
  const HR = {
22
25
  dependencies: [LexicalHorizontalRuleNode.HorizontalRuleNode],
23
26
  export: node => {
@@ -3,7 +3,9 @@
3
3
  *
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
  */
8
+
7
9
  import { TRANSFORMERS, registerMarkdownShortcuts } from '@lexical/markdown';
8
10
  import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
9
11
  import { HorizontalRuleNode, $isHorizontalRuleNode, $createHorizontalRuleNode } from '@lexical/react/LexicalHorizontalRuleNode';
@@ -16,6 +18,7 @@ import { useEffect } from 'react';
16
18
  * LICENSE file in the root directory of this source tree.
17
19
  *
18
20
  */
21
+
19
22
  const HR = {
20
23
  dependencies: [HorizontalRuleNode],
21
24
  export: node => {
@@ -3,7 +3,9 @@
3
3
  *
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
  */
8
+
7
9
  'use strict'
8
10
  const LexicalMarkdownShortcutPlugin = process.env.NODE_ENV === 'development' ? require('./LexicalMarkdownShortcutPlugin.dev.js') : require('./LexicalMarkdownShortcutPlugin.prod.js');
9
11
  module.exports = LexicalMarkdownShortcutPlugin;
@@ -3,7 +3,9 @@
3
3
  *
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
  */
8
+
7
9
  import * as modDev from './LexicalMarkdownShortcutPlugin.dev.mjs';
8
10
  import * as modProd from './LexicalMarkdownShortcutPlugin.prod.mjs';
9
11
  const mod = process.env.NODE_ENV === 'development' ? modDev : modProd;
@@ -3,7 +3,9 @@
3
3
  *
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
  */
8
+
7
9
  const mod = await (process.env.NODE_ENV === 'development' ? import('./LexicalMarkdownShortcutPlugin.dev.mjs') : import('./LexicalMarkdownShortcutPlugin.prod.mjs'));
8
10
  export const DEFAULT_TRANSFORMERS = mod.DEFAULT_TRANSFORMERS;
9
11
  export const MarkdownShortcutPlugin = mod.MarkdownShortcutPlugin;
@@ -3,6 +3,8 @@
3
3
  *
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
  */
8
+
7
9
  'use strict';var c=require("@lexical/markdown"),d=require("@lexical/react/LexicalComposerContext"),e=require("@lexical/react/LexicalHorizontalRuleNode"),f=require("react");let g=[{dependencies:[e.HorizontalRuleNode],export:a=>e.$isHorizontalRuleNode(a)?"***":null,regExp:/^(---|\*\*\*|___)\s?$/,replace:(a,b,k,h)=>{b=e.$createHorizontalRuleNode();h||null!=a.getNextSibling()?a.replace(b):a.insertBefore(b);b.selectNext()},type:"element"},...c.TRANSFORMERS];exports.DEFAULT_TRANSFORMERS=g;
8
10
  exports.MarkdownShortcutPlugin=function({transformers:a=g}){let [b]=d.useLexicalComposerContext();f.useEffect(()=>c.registerMarkdownShortcuts(b,a),[b,a]);return null}
@@ -3,5 +3,7 @@
3
3
  *
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
  */
8
+
7
9
  import{TRANSFORMERS as e,registerMarkdownShortcuts as r}from"@lexical/markdown";import{useLexicalComposerContext as t}from"@lexical/react/LexicalComposerContext";import{HorizontalRuleNode as o,$isHorizontalRuleNode as l,$createHorizontalRuleNode as n}from"@lexical/react/LexicalHorizontalRuleNode";import{useEffect as c}from"react";const i=[{dependencies:[o],export:e=>l(e)?"***":null,regExp:/^(---|\*\*\*|___)\s?$/,replace:(e,r,t,o)=>{const l=n();o||null!=e.getNextSibling()?e.replace(l):e.insertBefore(l),l.selectNext()},type:"element"},...e];function a({transformers:e=i}){const[o]=t();return c((()=>r(o,e)),[o,e]),null}export{i as DEFAULT_TRANSFORMERS,a as MarkdownShortcutPlugin};