@lexical/react 0.14.4 → 0.15.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 (287) hide show
  1. package/LexicalAutoEmbedPlugin.dev.js +17 -1
  2. package/LexicalAutoEmbedPlugin.dev.mjs +3 -0
  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 -4
  7. package/LexicalAutoEmbedPlugin.prod.mjs +2 -0
  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 +20 -4
  23. package/LexicalBlockWithAlignableContents.dev.mjs +6 -3
  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 +2 -0
  29. package/LexicalCharacterLimitPlugin.dev.js +21 -4
  30. package/LexicalCharacterLimitPlugin.dev.mjs +7 -3
  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 +3 -0
  37. package/LexicalCheckListPlugin.dev.mjs +3 -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 +2 -0
  42. package/LexicalCheckListPlugin.prod.mjs +2 -0
  43. package/LexicalClearEditorPlugin.dev.js +5 -2
  44. package/LexicalClearEditorPlugin.dev.mjs +7 -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.dev.js +14 -13
  51. package/LexicalClickableLinkPlugin.dev.mjs +14 -13
  52. package/LexicalClickableLinkPlugin.js +2 -0
  53. package/LexicalClickableLinkPlugin.mjs +2 -0
  54. package/LexicalClickableLinkPlugin.node.mjs +2 -0
  55. package/LexicalClickableLinkPlugin.prod.js +5 -4
  56. package/LexicalClickableLinkPlugin.prod.mjs +3 -1
  57. package/LexicalCollaborationContext.dev.js +3 -0
  58. package/LexicalCollaborationContext.dev.mjs +3 -0
  59. package/LexicalCollaborationContext.js +2 -0
  60. package/LexicalCollaborationContext.mjs +2 -0
  61. package/LexicalCollaborationContext.node.mjs +2 -0
  62. package/LexicalCollaborationContext.prod.js +2 -0
  63. package/LexicalCollaborationContext.prod.mjs +2 -0
  64. package/LexicalCollaborationPlugin.dev.js +19 -2
  65. package/LexicalCollaborationPlugin.dev.mjs +4 -0
  66. package/LexicalCollaborationPlugin.js +2 -0
  67. package/LexicalCollaborationPlugin.mjs +2 -0
  68. package/LexicalCollaborationPlugin.node.mjs +2 -0
  69. package/LexicalCollaborationPlugin.prod.js +12 -10
  70. package/LexicalCollaborationPlugin.prod.mjs +2 -0
  71. package/LexicalComposer.dev.js +19 -3
  72. package/LexicalComposer.dev.mjs +7 -4
  73. package/LexicalComposer.js +2 -0
  74. package/LexicalComposer.mjs +2 -0
  75. package/LexicalComposer.node.mjs +2 -0
  76. package/LexicalComposer.prod.js +5 -3
  77. package/LexicalComposer.prod.mjs +3 -1
  78. package/LexicalComposerContext.dev.js +3 -0
  79. package/LexicalComposerContext.dev.mjs +3 -0
  80. package/LexicalComposerContext.js +2 -0
  81. package/LexicalComposerContext.mjs +2 -0
  82. package/LexicalComposerContext.node.mjs +2 -0
  83. package/LexicalComposerContext.prod.js +4 -2
  84. package/LexicalComposerContext.prod.mjs +3 -1
  85. package/LexicalContentEditable.dev.js +18 -3
  86. package/LexicalContentEditable.dev.mjs +6 -4
  87. package/LexicalContentEditable.js +2 -0
  88. package/LexicalContentEditable.mjs +2 -0
  89. package/LexicalContentEditable.node.mjs +2 -0
  90. package/LexicalContentEditable.prod.js +6 -3
  91. package/LexicalContentEditable.prod.mjs +3 -1
  92. package/LexicalContextMenuPlugin.dev.js +24 -7
  93. package/LexicalContextMenuPlugin.dev.mjs +11 -7
  94. package/LexicalContextMenuPlugin.js +2 -0
  95. package/LexicalContextMenuPlugin.js.flow +12 -0
  96. package/LexicalContextMenuPlugin.mjs +2 -0
  97. package/LexicalContextMenuPlugin.node.mjs +2 -0
  98. package/LexicalContextMenuPlugin.prod.js +18 -16
  99. package/LexicalContextMenuPlugin.prod.mjs +3 -1
  100. package/LexicalDecoratorBlockNode.d.ts +1 -0
  101. package/LexicalDecoratorBlockNode.dev.js +6 -0
  102. package/LexicalDecoratorBlockNode.dev.mjs +6 -0
  103. package/LexicalDecoratorBlockNode.js +2 -0
  104. package/LexicalDecoratorBlockNode.mjs +2 -0
  105. package/LexicalDecoratorBlockNode.node.mjs +2 -0
  106. package/LexicalDecoratorBlockNode.prod.js +3 -1
  107. package/LexicalDecoratorBlockNode.prod.mjs +3 -1
  108. package/LexicalEditorRefPlugin.dev.js +17 -1
  109. package/LexicalEditorRefPlugin.dev.mjs +3 -0
  110. package/LexicalEditorRefPlugin.js +2 -0
  111. package/LexicalEditorRefPlugin.js.flow +19 -0
  112. package/LexicalEditorRefPlugin.mjs +2 -0
  113. package/LexicalEditorRefPlugin.node.mjs +2 -0
  114. package/LexicalEditorRefPlugin.prod.js +3 -1
  115. package/LexicalEditorRefPlugin.prod.mjs +2 -0
  116. package/LexicalErrorBoundary.dev.js +21 -5
  117. package/LexicalErrorBoundary.dev.mjs +3 -0
  118. package/LexicalErrorBoundary.js +2 -0
  119. package/LexicalErrorBoundary.mjs +2 -0
  120. package/LexicalErrorBoundary.node.mjs +2 -0
  121. package/LexicalErrorBoundary.prod.js +6 -4
  122. package/LexicalErrorBoundary.prod.mjs +2 -0
  123. package/LexicalHashtagPlugin.dev.js +5 -2
  124. package/LexicalHashtagPlugin.dev.mjs +5 -2
  125. package/LexicalHashtagPlugin.js +2 -0
  126. package/LexicalHashtagPlugin.mjs +2 -0
  127. package/LexicalHashtagPlugin.node.mjs +2 -0
  128. package/LexicalHashtagPlugin.prod.js +2 -0
  129. package/LexicalHashtagPlugin.prod.mjs +2 -0
  130. package/LexicalHistoryPlugin.dev.js +4 -0
  131. package/LexicalHistoryPlugin.dev.mjs +4 -0
  132. package/LexicalHistoryPlugin.js +2 -0
  133. package/LexicalHistoryPlugin.mjs +2 -0
  134. package/LexicalHistoryPlugin.node.mjs +2 -0
  135. package/LexicalHistoryPlugin.prod.js +2 -0
  136. package/LexicalHistoryPlugin.prod.mjs +2 -0
  137. package/LexicalHorizontalRuleNode.dev.js +22 -6
  138. package/LexicalHorizontalRuleNode.dev.mjs +8 -5
  139. package/LexicalHorizontalRuleNode.js +2 -0
  140. package/LexicalHorizontalRuleNode.mjs +2 -0
  141. package/LexicalHorizontalRuleNode.node.mjs +2 -0
  142. package/LexicalHorizontalRuleNode.prod.js +7 -5
  143. package/LexicalHorizontalRuleNode.prod.mjs +2 -0
  144. package/LexicalHorizontalRulePlugin.dev.js +3 -0
  145. package/LexicalHorizontalRulePlugin.dev.mjs +3 -0
  146. package/LexicalHorizontalRulePlugin.js +2 -0
  147. package/LexicalHorizontalRulePlugin.mjs +2 -0
  148. package/LexicalHorizontalRulePlugin.node.mjs +2 -0
  149. package/LexicalHorizontalRulePlugin.prod.js +2 -0
  150. package/LexicalHorizontalRulePlugin.prod.mjs +2 -0
  151. package/LexicalLinkPlugin.dev.js +6 -3
  152. package/LexicalLinkPlugin.dev.mjs +7 -4
  153. package/LexicalLinkPlugin.js +2 -0
  154. package/LexicalLinkPlugin.mjs +2 -0
  155. package/LexicalLinkPlugin.node.mjs +2 -0
  156. package/LexicalLinkPlugin.prod.js +3 -1
  157. package/LexicalLinkPlugin.prod.mjs +3 -1
  158. package/LexicalListPlugin.dev.js +4 -0
  159. package/LexicalListPlugin.dev.mjs +4 -0
  160. package/LexicalListPlugin.js +2 -0
  161. package/LexicalListPlugin.mjs +2 -0
  162. package/LexicalListPlugin.node.mjs +2 -0
  163. package/LexicalListPlugin.prod.js +2 -0
  164. package/LexicalListPlugin.prod.mjs +2 -0
  165. package/LexicalMarkdownShortcutPlugin.dev.js +3 -0
  166. package/LexicalMarkdownShortcutPlugin.dev.mjs +3 -0
  167. package/LexicalMarkdownShortcutPlugin.js +2 -0
  168. package/LexicalMarkdownShortcutPlugin.mjs +2 -0
  169. package/LexicalMarkdownShortcutPlugin.node.mjs +2 -0
  170. package/LexicalMarkdownShortcutPlugin.prod.js +2 -0
  171. package/LexicalMarkdownShortcutPlugin.prod.mjs +2 -0
  172. package/LexicalNestedComposer.dev.js +17 -1
  173. package/LexicalNestedComposer.dev.mjs +3 -0
  174. package/LexicalNestedComposer.js +2 -0
  175. package/LexicalNestedComposer.mjs +2 -0
  176. package/LexicalNestedComposer.node.mjs +2 -0
  177. package/LexicalNestedComposer.prod.js +7 -5
  178. package/LexicalNestedComposer.prod.mjs +3 -1
  179. package/LexicalNodeEventPlugin.dev.js +3 -0
  180. package/LexicalNodeEventPlugin.dev.mjs +3 -0
  181. package/LexicalNodeEventPlugin.js +2 -0
  182. package/LexicalNodeEventPlugin.js.flow +12 -0
  183. package/LexicalNodeEventPlugin.mjs +2 -0
  184. package/LexicalNodeEventPlugin.node.mjs +2 -0
  185. package/LexicalNodeEventPlugin.prod.js +2 -0
  186. package/LexicalNodeEventPlugin.prod.mjs +2 -0
  187. package/LexicalNodeMenuPlugin.dev.js +25 -8
  188. package/LexicalNodeMenuPlugin.dev.mjs +11 -7
  189. package/LexicalNodeMenuPlugin.js +2 -0
  190. package/LexicalNodeMenuPlugin.mjs +2 -0
  191. package/LexicalNodeMenuPlugin.node.mjs +2 -0
  192. package/LexicalNodeMenuPlugin.prod.js +17 -15
  193. package/LexicalNodeMenuPlugin.prod.mjs +3 -1
  194. package/LexicalOnChangePlugin.dev.js +5 -2
  195. package/LexicalOnChangePlugin.dev.mjs +7 -4
  196. package/LexicalOnChangePlugin.js +2 -0
  197. package/LexicalOnChangePlugin.mjs +2 -0
  198. package/LexicalOnChangePlugin.node.mjs +2 -0
  199. package/LexicalOnChangePlugin.prod.js +3 -1
  200. package/LexicalOnChangePlugin.prod.mjs +3 -1
  201. package/LexicalPlainTextPlugin.dev.js +26 -7
  202. package/LexicalPlainTextPlugin.dev.mjs +13 -7
  203. package/LexicalPlainTextPlugin.js +2 -0
  204. package/LexicalPlainTextPlugin.mjs +2 -0
  205. package/LexicalPlainTextPlugin.node.mjs +2 -0
  206. package/LexicalPlainTextPlugin.prod.js +6 -4
  207. package/LexicalPlainTextPlugin.prod.mjs +3 -1
  208. package/LexicalRichTextPlugin.dev.js +26 -7
  209. package/LexicalRichTextPlugin.dev.mjs +13 -7
  210. package/LexicalRichTextPlugin.js +2 -0
  211. package/LexicalRichTextPlugin.mjs +2 -0
  212. package/LexicalRichTextPlugin.node.mjs +2 -0
  213. package/LexicalRichTextPlugin.prod.js +6 -4
  214. package/LexicalRichTextPlugin.prod.mjs +3 -1
  215. package/LexicalTabIndentationPlugin.dev.js +5 -2
  216. package/LexicalTabIndentationPlugin.dev.mjs +5 -2
  217. package/LexicalTabIndentationPlugin.js +2 -0
  218. package/LexicalTabIndentationPlugin.mjs +2 -0
  219. package/LexicalTabIndentationPlugin.node.mjs +2 -0
  220. package/LexicalTabIndentationPlugin.prod.js +2 -0
  221. package/LexicalTabIndentationPlugin.prod.mjs +2 -0
  222. package/LexicalTableOfContents.d.ts +1 -1
  223. package/LexicalTableOfContents.dev.js +47 -8
  224. package/LexicalTableOfContents.dev.mjs +48 -9
  225. package/LexicalTableOfContents.js +2 -0
  226. package/LexicalTableOfContents.mjs +2 -0
  227. package/LexicalTableOfContents.node.mjs +2 -0
  228. package/LexicalTableOfContents.prod.js +6 -4
  229. package/LexicalTableOfContents.prod.mjs +3 -1
  230. package/LexicalTablePlugin.dev.js +28 -2
  231. package/LexicalTablePlugin.dev.mjs +31 -5
  232. package/LexicalTablePlugin.js +2 -0
  233. package/LexicalTablePlugin.mjs +2 -0
  234. package/LexicalTablePlugin.node.mjs +2 -0
  235. package/LexicalTablePlugin.prod.js +9 -5
  236. package/LexicalTablePlugin.prod.mjs +3 -1
  237. package/LexicalTreeView.dev.js +18 -2
  238. package/LexicalTreeView.dev.mjs +3 -0
  239. package/LexicalTreeView.js +2 -0
  240. package/LexicalTreeView.mjs +2 -0
  241. package/LexicalTreeView.node.mjs +2 -0
  242. package/LexicalTreeView.prod.js +5 -3
  243. package/LexicalTreeView.prod.mjs +2 -0
  244. package/LexicalTypeaheadMenuPlugin.dev.js +25 -8
  245. package/LexicalTypeaheadMenuPlugin.dev.mjs +11 -7
  246. package/LexicalTypeaheadMenuPlugin.js +2 -0
  247. package/LexicalTypeaheadMenuPlugin.mjs +2 -0
  248. package/LexicalTypeaheadMenuPlugin.node.mjs +2 -0
  249. package/LexicalTypeaheadMenuPlugin.prod.js +21 -19
  250. package/LexicalTypeaheadMenuPlugin.prod.mjs +3 -1
  251. package/package.json +20 -19
  252. package/shared/useCharacterLimit.d.ts +1 -1
  253. package/useLexicalEditable.dev.js +6 -2
  254. package/useLexicalEditable.dev.mjs +8 -4
  255. package/useLexicalEditable.js +2 -0
  256. package/useLexicalEditable.mjs +2 -0
  257. package/useLexicalEditable.node.mjs +2 -0
  258. package/useLexicalEditable.prod.js +3 -1
  259. package/useLexicalEditable.prod.mjs +3 -1
  260. package/useLexicalIsTextContentEmpty.dev.js +5 -2
  261. package/useLexicalIsTextContentEmpty.dev.mjs +7 -4
  262. package/useLexicalIsTextContentEmpty.js +2 -0
  263. package/useLexicalIsTextContentEmpty.mjs +2 -0
  264. package/useLexicalIsTextContentEmpty.node.mjs +2 -0
  265. package/useLexicalIsTextContentEmpty.prod.js +3 -1
  266. package/useLexicalIsTextContentEmpty.prod.mjs +3 -1
  267. package/useLexicalNodeSelection.dev.js +3 -0
  268. package/useLexicalNodeSelection.dev.mjs +4 -1
  269. package/useLexicalNodeSelection.js +2 -0
  270. package/useLexicalNodeSelection.mjs +2 -0
  271. package/useLexicalNodeSelection.node.mjs +2 -0
  272. package/useLexicalNodeSelection.prod.js +2 -0
  273. package/useLexicalNodeSelection.prod.mjs +3 -1
  274. package/useLexicalSubscription.dev.js +5 -2
  275. package/useLexicalSubscription.dev.mjs +7 -4
  276. package/useLexicalSubscription.js +2 -0
  277. package/useLexicalSubscription.mjs +2 -0
  278. package/useLexicalSubscription.node.mjs +2 -0
  279. package/useLexicalSubscription.prod.js +3 -1
  280. package/useLexicalSubscription.prod.mjs +3 -1
  281. package/useLexicalTextEntity.dev.js +3 -0
  282. package/useLexicalTextEntity.dev.mjs +3 -0
  283. package/useLexicalTextEntity.js +2 -0
  284. package/useLexicalTextEntity.mjs +2 -0
  285. package/useLexicalTextEntity.node.mjs +2 -0
  286. package/useLexicalTextEntity.prod.js +2 -0
  287. package/useLexicalTextEntity.prod.mjs +2 -0
@@ -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');
@@ -13,6 +15,19 @@ var utils = require('@lexical/utils');
13
15
  var lexical = require('lexical');
14
16
  var React = require('react');
15
17
 
18
+ function _interopNamespaceDefault(e) {
19
+ var n = Object.create(null);
20
+ if (e) {
21
+ for (var k in e) {
22
+ n[k] = e[k];
23
+ }
24
+ }
25
+ n.default = e;
26
+ return n;
27
+ }
28
+
29
+ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
30
+
16
31
  /**
17
32
  * Copyright (c) Meta Platforms, Inc. and affiliates.
18
33
  *
@@ -20,6 +35,7 @@ var React = require('react');
20
35
  * LICENSE file in the root directory of this source tree.
21
36
  *
22
37
  */
38
+
23
39
  const URL_MATCHER = /((https?:\/\/(www\.)?)|(www\.))[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/;
24
40
  const INSERT_EMBED_COMMAND = lexical.createCommand('INSERT_EMBED_COMMAND');
25
41
  class AutoEmbedOption extends LexicalNodeMenuPlugin.MenuOption {
@@ -119,7 +135,7 @@ function LexicalAutoEmbedPlugin({
119
135
  closeMenu();
120
136
  });
121
137
  }, [editor]);
122
- return nodeKey != null ? /*#__PURE__*/React.createElement(LexicalNodeMenuPlugin.LexicalNodeMenuPlugin, {
138
+ return nodeKey != null ? /*#__PURE__*/React__namespace.createElement(LexicalNodeMenuPlugin.LexicalNodeMenuPlugin, {
123
139
  nodeKey: nodeKey,
124
140
  onClose: reset,
125
141
  onSelectOption: onSelectOption,
@@ -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 { $isLinkNode, LinkNode, AutoLinkNode } from '@lexical/link';
8
10
  import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
9
11
  import { MenuOption, LexicalNodeMenuPlugin } from '@lexical/react/LexicalNodeMenuPlugin';
@@ -19,6 +21,7 @@ import { useState, useCallback, useEffect, useMemo } from 'react';
19
21
  * LICENSE file in the root directory of this source tree.
20
22
  *
21
23
  */
24
+
22
25
  const URL_MATCHER = /((https?:\/\/(www\.)?)|(www\.))[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/;
23
26
  const INSERT_EMBED_COMMAND = createCommand('INSERT_EMBED_COMMAND');
24
27
  class AutoEmbedOption extends MenuOption {
@@ -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 LexicalAutoEmbedPlugin = process.env.NODE_ENV === 'development' ? require('./LexicalAutoEmbedPlugin.dev.js') : require('./LexicalAutoEmbedPlugin.prod.js');
9
11
  module.exports = LexicalAutoEmbedPlugin;
@@ -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 './LexicalAutoEmbedPlugin.dev.mjs';
8
10
  import * as modProd from './LexicalAutoEmbedPlugin.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('./LexicalAutoEmbedPlugin.dev.mjs') : import('./LexicalAutoEmbedPlugin.prod.mjs'));
8
10
  export const AutoEmbedOption = mod.AutoEmbedOption;
9
11
  export const INSERT_EMBED_COMMAND = mod.INSERT_EMBED_COMMAND;
@@ -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 e=require("@lexical/link"),k=require("@lexical/react/LexicalComposerContext"),l=require("@lexical/react/LexicalNodeMenuPlugin"),q=require("@lexical/utils"),r=require("lexical"),z=require("react");let A=r.createCommand("INSERT_EMBED_COMMAND");class B extends l.MenuOption{constructor(f,n){super(f);this.title=f;this.onSelect=n.onSelect.bind(this)}}exports.AutoEmbedOption=B;exports.INSERT_EMBED_COMMAND=A;
8
- exports.LexicalAutoEmbedPlugin=function({embedConfigs:f,onOpenEmbedModalForConfig:n,getMenuOptions:t,menuRenderFn:C,menuCommandPriority:D=r.COMMAND_PRIORITY_LOW}){let [c]=k.useLexicalComposerContext(),[g,u]=z.useState(null),[h,v]=z.useState(null),m=z.useCallback(()=>{u(null);v(null)},[]),w=z.useCallback(b=>{c.getEditorState().read(async function(){const a=r.$getNodeByKey(b);if(e.$isLinkNode(a))for(let d=0;d<f.length;d++){const p=f[d];null!=await Promise.resolve(p.parseUrl(a.__url))&&(v(p),u(a.getKey()))}})},
9
- [c,f]);z.useEffect(()=>{let b=(a,{updateTags:d,dirtyLeaves:p})=>{for(const [x,E]of a)"created"===E&&d.has("paste")&&3>=p.size?w(x):x===g&&m()};return q.mergeRegister(...[e.LinkNode,e.AutoLinkNode].map(a=>c.registerMutationListener(a,(...d)=>b(...d))))},[w,c,f,g,m]);z.useEffect(()=>c.registerCommand(A,b=>{let a=f.find(({type:d})=>d===b);return a?(n(a),!0):!1},r.COMMAND_PRIORITY_EDITOR),[c,f,n]);let y=z.useCallback(async function(){if(null!=h&&null!=g){const b=c.getEditorState().read(()=>{const a=r.$getNodeByKey(g);
10
- return e.$isLinkNode(a)?a:null});if(e.$isLinkNode(b)){const a=await Promise.resolve(h.parseUrl(b.__url));null!=a&&c.update(()=>{r.$getSelection()||b.selectEnd();h.insertNode(c,a);b.isAttached()&&b.remove()})}}},[h,c,g]),F=z.useMemo(()=>null!=h&&null!=g?t(h,y,m):[],[h,y,t,g,m]),G=z.useCallback((b,a,d)=>{c.update(()=>{b.onSelect(a);d()})},[c]);return null!=g?z.createElement(l.LexicalNodeMenuPlugin,{nodeKey:g,onClose:m,onSelectOption:G,options:F,menuRenderFn:C,commandPriority:D}):null};
8
+
9
+ 'use strict';var b=require("@lexical/link"),k=require("@lexical/react/LexicalComposerContext"),l=require("@lexical/react/LexicalNodeMenuPlugin"),q=require("@lexical/utils"),r=require("lexical"),t=require("react"),u=Object.create(null);if(t)for(var B in t)u[B]=t[B];u.default=t;let C=r.createCommand("INSERT_EMBED_COMMAND");class D extends l.MenuOption{constructor(f,n){super(f);this.title=f;this.onSelect=n.onSelect.bind(this)}}exports.AutoEmbedOption=D;exports.INSERT_EMBED_COMMAND=C;
10
+ exports.LexicalAutoEmbedPlugin=function({embedConfigs:f,onOpenEmbedModalForConfig:n,getMenuOptions:v,menuRenderFn:E,menuCommandPriority:F=r.COMMAND_PRIORITY_LOW}){let [d]=k.useLexicalComposerContext(),[g,w]=t.useState(null),[h,x]=t.useState(null),m=t.useCallback(()=>{w(null);x(null)},[]),y=t.useCallback(c=>{d.getEditorState().read(async function(){const a=r.$getNodeByKey(c);if(b.$isLinkNode(a))for(let e=0;e<f.length;e++){const p=f[e];null!=await Promise.resolve(p.parseUrl(a.__url))&&(x(p),w(a.getKey()))}})},
11
+ [d,f]);t.useEffect(()=>{let c=(a,{updateTags:e,dirtyLeaves:p})=>{for(const [z,G]of a)"created"===G&&e.has("paste")&&3>=p.size?y(z):z===g&&m()};return q.mergeRegister(...[b.LinkNode,b.AutoLinkNode].map(a=>d.registerMutationListener(a,(...e)=>c(...e))))},[y,d,f,g,m]);t.useEffect(()=>d.registerCommand(C,c=>{let a=f.find(({type:e})=>e===c);return a?(n(a),!0):!1},r.COMMAND_PRIORITY_EDITOR),[d,f,n]);let A=t.useCallback(async function(){if(null!=h&&null!=g){const c=d.getEditorState().read(()=>{const a=r.$getNodeByKey(g);
12
+ return b.$isLinkNode(a)?a:null});if(b.$isLinkNode(c)){const a=await Promise.resolve(h.parseUrl(c.__url));null!=a&&d.update(()=>{r.$getSelection()||c.selectEnd();h.insertNode(d,a);c.isAttached()&&c.remove()})}}},[h,d,g]),H=t.useMemo(()=>null!=h&&null!=g?v(h,A,m):[],[h,A,v,g,m]),I=t.useCallback((c,a,e)=>{d.update(()=>{c.onSelect(a);e()})},[d]);return null!=g?u.createElement(l.LexicalNodeMenuPlugin,{nodeKey:g,onClose:m,onSelectOption:I,options:H,menuRenderFn:E,commandPriority:F}):null};
11
13
  exports.URL_MATCHER=/((https?:\/\/(www\.)?)|(www\.))[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/
@@ -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{$isLinkNode as e,LinkNode as t,AutoLinkNode as n}from"@lexical/link";import{useLexicalComposerContext as o}from"@lexical/react/LexicalComposerContext";import{MenuOption as r,LexicalNodeMenuPlugin as l}from"@lexical/react/LexicalNodeMenuPlugin";import{mergeRegister as i}from"@lexical/utils";import{createCommand as s,$getNodeByKey as a,COMMAND_PRIORITY_EDITOR as c,$getSelection as u,COMMAND_PRIORITY_LOW as m}from"lexical";import*as d from"react";import{useState as p,useCallback as f,useEffect as g,useMemo as x}from"react";const w=/((https?:\/\/(www\.)?)|(www\.))[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/,y=s("INSERT_EMBED_COMMAND");class C extends r{constructor(e,t){super(e),this.title=e,this.onSelect=t.onSelect.bind(this)}}function E({embedConfigs:r,onOpenEmbedModalForConfig:s,getMenuOptions:w,menuRenderFn:C,menuCommandPriority:E=m}){const[_]=o(),[h,M]=p(null),[S,A]=p(null),P=f((()=>{M(null),A(null)}),[]),b=f((t=>{_.getEditorState().read((async function(){const n=a(t);if(e(n))for(let e=0;e<r.length;e++){const t=r[e];null!=await Promise.resolve(t.parseUrl(n.__url))&&(A(t),M(n.getKey()))}}))}),[_,r]);g((()=>i(...[t,n].map((e=>_.registerMutationListener(e,((...e)=>((e,{updateTags:t,dirtyLeaves:n})=>{for(const[o,r]of e)"created"===r&&t.has("paste")&&n.size<=3?b(o):o===h&&P()})(...e))))))),[b,_,r,h,P]),g((()=>_.registerCommand(y,(e=>{const t=r.find((({type:t})=>t===e));return!!t&&(s(t),!0)}),c)),[_,r,s]);const v=f((async function(){if(null!=S&&null!=h){const t=_.getEditorState().read((()=>{const t=a(h);return e(t)?t:null}));if(e(t)){const e=await Promise.resolve(S.parseUrl(t.__url));null!=e&&_.update((()=>{u()||t.selectEnd(),S.insertNode(_,e),t.isAttached()&&t.remove()}))}}}),[S,_,h]),z=x((()=>null!=S&&null!=h?w(S,v,P):[]),[S,v,w,h,P]),L=f(((e,t,n)=>{_.update((()=>{e.onSelect(t),n()}))}),[_]);return null!=h?d.createElement(l,{nodeKey:h,onClose:P,onSelectOption:L,options:z,menuRenderFn:C,commandPriority:E}):null}export{C as AutoEmbedOption,y as INSERT_EMBED_COMMAND,E as LexicalAutoEmbedPlugin,w as URL_MATCHER};
@@ -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');
@@ -16,6 +18,7 @@ var react = require('react');
16
18
  * LICENSE file in the root directory of this source tree.
17
19
  *
18
20
  */
21
+
19
22
  function AutoFocusPlugin({
20
23
  defaultSelection
21
24
  }) {
@@ -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 { useEffect } from 'react';
9
11
 
@@ -14,6 +16,7 @@ import { useEffect } from 'react';
14
16
  * LICENSE file in the root directory of this source tree.
15
17
  *
16
18
  */
19
+
17
20
  function AutoFocusPlugin({
18
21
  defaultSelection
19
22
  }) {
@@ -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 LexicalAutoFocusPlugin = process.env.NODE_ENV === 'development' ? require('./LexicalAutoFocusPlugin.dev.js') : require('./LexicalAutoFocusPlugin.prod.js');
9
11
  module.exports = LexicalAutoFocusPlugin;
@@ -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 './LexicalAutoFocusPlugin.dev.mjs';
8
10
  import * as modProd from './LexicalAutoFocusPlugin.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('./LexicalAutoFocusPlugin.dev.mjs') : import('./LexicalAutoFocusPlugin.prod.mjs'));
8
10
  export const AutoFocusPlugin = mod.AutoFocusPlugin;
@@ -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
  'use strict';var e=require("@lexical/react/LexicalComposerContext"),f=require("react");exports.AutoFocusPlugin=function({defaultSelection:c}){let [a]=e.useLexicalComposerContext();f.useEffect(()=>{a.focus(()=>{let d=document.activeElement,b=a.getRootElement();null===b||null!==d&&b.contains(d)||b.focus({preventScroll:!0})},{defaultSelection:c})},[c,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{useLexicalComposerContext as e}from"@lexical/react/LexicalComposerContext";import{useEffect as t}from"react";function o({defaultSelection:o}){const[l]=e();return t((()=>{l.focus((()=>{const e=document.activeElement,t=l.getRootElement();null===t||null!==e&&t.contains(e)||t.focus({preventScroll:!0})}),{defaultSelection:o})}),[o,l]),null}export{o as AutoFocusPlugin};
@@ -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 createLinkMatcherWithRegExp(regExp, urlTransformer = text => text) {
23
26
  return text => {
24
27
  const match = regExp.exec(text);
@@ -100,7 +103,7 @@ function extractMatchingNodes(nodes, startIndex, endIndex) {
100
103
  }
101
104
  return [matchingOffset, unmodifiedBeforeNodes, matchingNodes, unmodifiedAfterNodes];
102
105
  }
103
- function createAutoLinkNode(nodes, startIndex, endIndex, match) {
106
+ function $createAutoLinkNode_(nodes, startIndex, endIndex, match) {
104
107
  const linkNode = link.$createAutoLinkNode(match.url, match.attributes);
105
108
  if (nodes.length === 1) {
106
109
  let remainingTextNode = nodes[0];
@@ -113,6 +116,7 @@ function createAutoLinkNode(nodes, startIndex, endIndex, match) {
113
116
  const textNode = lexical.$createTextNode(match.text);
114
117
  textNode.setFormat(linkTextNode.getFormat());
115
118
  textNode.setDetail(linkTextNode.getDetail());
119
+ textNode.setStyle(linkTextNode.getStyle());
116
120
  linkNode.append(textNode);
117
121
  linkTextNode.replace(linkNode);
118
122
  return remainingTextNode;
@@ -149,6 +153,7 @@ function createAutoLinkNode(nodes, startIndex, endIndex, match) {
149
153
  const textNode = lexical.$createTextNode(firstLinkTextNode.getTextContent());
150
154
  textNode.setFormat(firstLinkTextNode.getFormat());
151
155
  textNode.setDetail(firstLinkTextNode.getDetail());
156
+ textNode.setStyle(firstLinkTextNode.getStyle());
152
157
  linkNode.append(textNode, ...linkNodes);
153
158
  // it does not preserve caret position if caret was at the first text node
154
159
  // so we need to restore caret position
@@ -164,7 +169,7 @@ function createAutoLinkNode(nodes, startIndex, endIndex, match) {
164
169
  }
165
170
  return undefined;
166
171
  }
167
- function handleLinkCreation(nodes, matchers, onChange) {
172
+ function $handleLinkCreation(nodes, matchers, onChange) {
168
173
  let currentNodes = [...nodes];
169
174
  const initialText = currentNodes.map(node => node.getTextContent()).join('');
170
175
  let text = initialText;
@@ -179,7 +184,7 @@ function handleLinkCreation(nodes, matchers, onChange) {
179
184
  const [matchingOffset,, matchingNodes, unmodifiedAfterNodes] = extractMatchingNodes(currentNodes, invalidMatchEnd + matchStart, invalidMatchEnd + matchEnd);
180
185
  const actualMatchStart = invalidMatchEnd + matchStart - matchingOffset;
181
186
  const actualMatchEnd = invalidMatchEnd + matchEnd - matchingOffset;
182
- const remainingTextNode = createAutoLinkNode(matchingNodes, actualMatchStart, actualMatchEnd, match);
187
+ const remainingTextNode = $createAutoLinkNode_(matchingNodes, actualMatchStart, actualMatchEnd, match);
183
188
  currentNodes = remainingTextNode ? [remainingTextNode, ...unmodifiedAfterNodes] : unmodifiedAfterNodes;
184
189
  onChange(match.url, null);
185
190
  invalidMatchEnd = 0;
@@ -295,7 +300,7 @@ function useAutoLink(editor, matchers, onChange) {
295
300
  } else if (!link.$isLinkNode(parent)) {
296
301
  if (textNode.isSimpleText() && (startsWithSeparator(textNode.getTextContent()) || !link.$isAutoLinkNode(previous))) {
297
302
  const textNodesToMatch = getTextNodesToMatch(textNode);
298
- handleLinkCreation(textNodesToMatch, matchers, onChangeWrapped);
303
+ $handleLinkCreation(textNodesToMatch, matchers, onChangeWrapped);
299
304
  }
300
305
  handleBadNeighbors(textNode, matchers, onChangeWrapped);
301
306
  }
@@ -3,11 +3,13 @@
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 { AutoLinkNode, $isAutoLinkNode, $isLinkNode, $createAutoLinkNode } from '@lexical/link';
8
10
  import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
9
11
  import { mergeRegister } from '@lexical/utils';
10
- import { TextNode, $isTextNode, $isLineBreakNode, $isElementNode, $createTextNode, $getSelection, $isRangeSelection, $isNodeSelection } from 'lexical';
12
+ import { TextNode, $isTextNode, $isElementNode, $isLineBreakNode, $createTextNode, $getSelection, $isRangeSelection, $isNodeSelection } from 'lexical';
11
13
  import { useEffect } from 'react';
12
14
 
13
15
  /**
@@ -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 createLinkMatcherWithRegExp(regExp, urlTransformer = text => text) {
21
24
  return text => {
22
25
  const match = regExp.exec(text);
@@ -98,7 +101,7 @@ function extractMatchingNodes(nodes, startIndex, endIndex) {
98
101
  }
99
102
  return [matchingOffset, unmodifiedBeforeNodes, matchingNodes, unmodifiedAfterNodes];
100
103
  }
101
- function createAutoLinkNode(nodes, startIndex, endIndex, match) {
104
+ function $createAutoLinkNode_(nodes, startIndex, endIndex, match) {
102
105
  const linkNode = $createAutoLinkNode(match.url, match.attributes);
103
106
  if (nodes.length === 1) {
104
107
  let remainingTextNode = nodes[0];
@@ -111,6 +114,7 @@ function createAutoLinkNode(nodes, startIndex, endIndex, match) {
111
114
  const textNode = $createTextNode(match.text);
112
115
  textNode.setFormat(linkTextNode.getFormat());
113
116
  textNode.setDetail(linkTextNode.getDetail());
117
+ textNode.setStyle(linkTextNode.getStyle());
114
118
  linkNode.append(textNode);
115
119
  linkTextNode.replace(linkNode);
116
120
  return remainingTextNode;
@@ -147,6 +151,7 @@ function createAutoLinkNode(nodes, startIndex, endIndex, match) {
147
151
  const textNode = $createTextNode(firstLinkTextNode.getTextContent());
148
152
  textNode.setFormat(firstLinkTextNode.getFormat());
149
153
  textNode.setDetail(firstLinkTextNode.getDetail());
154
+ textNode.setStyle(firstLinkTextNode.getStyle());
150
155
  linkNode.append(textNode, ...linkNodes);
151
156
  // it does not preserve caret position if caret was at the first text node
152
157
  // so we need to restore caret position
@@ -162,7 +167,7 @@ function createAutoLinkNode(nodes, startIndex, endIndex, match) {
162
167
  }
163
168
  return undefined;
164
169
  }
165
- function handleLinkCreation(nodes, matchers, onChange) {
170
+ function $handleLinkCreation(nodes, matchers, onChange) {
166
171
  let currentNodes = [...nodes];
167
172
  const initialText = currentNodes.map(node => node.getTextContent()).join('');
168
173
  let text = initialText;
@@ -177,7 +182,7 @@ function handleLinkCreation(nodes, matchers, onChange) {
177
182
  const [matchingOffset,, matchingNodes, unmodifiedAfterNodes] = extractMatchingNodes(currentNodes, invalidMatchEnd + matchStart, invalidMatchEnd + matchEnd);
178
183
  const actualMatchStart = invalidMatchEnd + matchStart - matchingOffset;
179
184
  const actualMatchEnd = invalidMatchEnd + matchEnd - matchingOffset;
180
- const remainingTextNode = createAutoLinkNode(matchingNodes, actualMatchStart, actualMatchEnd, match);
185
+ const remainingTextNode = $createAutoLinkNode_(matchingNodes, actualMatchStart, actualMatchEnd, match);
181
186
  currentNodes = remainingTextNode ? [remainingTextNode, ...unmodifiedAfterNodes] : unmodifiedAfterNodes;
182
187
  onChange(match.url, null);
183
188
  invalidMatchEnd = 0;
@@ -293,7 +298,7 @@ function useAutoLink(editor, matchers, onChange) {
293
298
  } else if (!$isLinkNode(parent)) {
294
299
  if (textNode.isSimpleText() && (startsWithSeparator(textNode.getTextContent()) || !$isAutoLinkNode(previous))) {
295
300
  const textNodesToMatch = getTextNodesToMatch(textNode);
296
- handleLinkCreation(textNodesToMatch, matchers, onChangeWrapped);
301
+ $handleLinkCreation(textNodesToMatch, matchers, onChangeWrapped);
297
302
  }
298
303
  handleBadNeighbors(textNode, matchers, onChangeWrapped);
299
304
  }
@@ -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 LexicalAutoLinkPlugin = process.env.NODE_ENV === 'development' ? require('./LexicalAutoLinkPlugin.dev.js') : require('./LexicalAutoLinkPlugin.prod.js');
9
11
  module.exports = LexicalAutoLinkPlugin;
@@ -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 './LexicalAutoLinkPlugin.dev.mjs';
8
10
  import * as modProd from './LexicalAutoLinkPlugin.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('./LexicalAutoLinkPlugin.dev.mjs') : import('./LexicalAutoLinkPlugin.prod.mjs'));
8
10
  export const AutoLinkPlugin = mod.AutoLinkPlugin;
9
11
  export const createLinkMatcherWithRegExp = mod.createLinkMatcherWithRegExp;
@@ -3,15 +3,17 @@
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 k=require("@lexical/link"),n=require("@lexical/react/LexicalComposerContext"),p=require("@lexical/utils"),t=require("lexical"),u=require("react");function v(a){let c=new URLSearchParams;c.append("code",a);for(let b=1;b<arguments.length;b++)c.append("v",arguments[b]);throw Error(`Minified Lexical error #${a}; visit https://lexical.dev/docs/error?${c} for the full message or `+"use the non-minified dev environment for full errors and additional helpful warnings.");}
8
- function w(a,c){for(let b=0;b<c.length;b++){let d=c[b](a);if(d)return d}return null}let x=/[.,;\s]/;function y(a){a=a.getPreviousSibling();t.$isElementNode(a)&&(a=a.getLastDescendant());var c;!(c=null===a||t.$isLineBreakNode(a))&&(c=t.$isTextNode(a))&&(a=a.getTextContent(),c=x.test(a[a.length-1]));return c}function z(a){a=a.getNextSibling();t.$isElementNode(a)&&(a=a.getFirstDescendant());return null===a||t.$isLineBreakNode(a)||t.$isTextNode(a)&&x.test(a.getTextContent()[0])}
9
- function A(a,c,b,d){return(0<a?x.test(b[a-1]):y(d[0]))?c<b.length?x.test(b[c]):z(d[d.length-1]):!1}function B(a,c,b){let d=[],h=[],e=[],f=0,g=0;for(a=[...a];0<a.length;){let l=a[0],m=l.getTextContent().length,q=g;g+m<=c?(d.push(l),f+=m):q>=b?e.push(l):h.push(l);g+=m;a.shift()}return[f,d,h,e]}
10
- function C(a,c,b,d){let h=k.$createAutoLinkNode(d.url,d.attributes);if(1===a.length){var e=a[0];0===c?[g,e]=e.splitText(b):[,g,e]=e.splitText(c,b);var f=t.$createTextNode(d.text);f.setFormat(g.getFormat());f.setDetail(g.getDetail());h.append(f);g.replace(h);return e}if(1<a.length){d=a[0];var g=d.getTextContent().length;0===c?e=d:[,e]=d.splitText(c);c=[];for(d=1;d<a.length;d++){let l=a[d],m=l.getTextContent().length,q=g,r=g+m;if(q<b)if(r<=b)c.push(l);else{let [F,G]=l.splitText(b-q);c.push(F);f=G}g+=
11
- m}a=(b=t.$getSelection())?b.getNodes().find(t.$isTextNode):void 0;g=t.$createTextNode(e.getTextContent());g.setFormat(e.getFormat());g.setDetail(e.getDetail());h.append(g,...c);a&&a===e&&(t.$isRangeSelection(b)?g.select(b.anchor.offset,b.focus.offset):t.$isNodeSelection(b)&&g.select(0,g.getTextContent().length));e.replace(h);return f}}
12
- function D(a,c,b){var d=[...a];let h=a=d.map(g=>g.getTextContent()).join(""),e,f=0;for(;(e=w(h,c))&&null!==e;){let g=e.index,l=g+e.length;if(A(f+g,f+l,a,d)){let [m,,q,r]=B(d,f+g,f+l);d=(d=C(q,f+g-m,f+l-m,e))?[d,...r]:r;b(e.url,null);f=0}else f+=l;h=h.substring(l)}}
13
- function E(a,c,b){var d=a.getChildren();let h=d.length;for(let e=0;e<h;e++){let f=d[e];if(!t.$isTextNode(f)||!f.isSimpleText()){H(a);b(null,a.getURL());return}}d=a.getTextContent();c=w(d,c);null===c||c.text!==d?(H(a),b(null,a.getURL())):y(a)&&z(a)?(d=a.getURL(),d!==c.url&&(a.setURL(c.url),b(c.url,d)),c.attributes&&(d=a.getRel(),d!==c.attributes.rel&&(a.setRel(c.attributes.rel||null),b(c.attributes.rel||null,d)),d=a.getTarget(),d!==c.attributes.target&&(a.setTarget(c.attributes.target||null),b(c.attributes.target||
14
- null,d)))):(H(a),b(null,a.getURL()))}function H(a){let c=a.getChildren();var b=c.length;for(--b;0<=b;b--)a.insertAfter(c[b]);a.remove();return c.map(d=>d.getLatest())}
15
- function I(a,c,b){u.useEffect(()=>{a.hasNodes([k.AutoLinkNode])||v(77);let d=(h,e)=>{b&&b(h,e)};return p.mergeRegister(a.registerNodeTransform(t.TextNode,h=>{var e=h.getParentOrThrow(),f=h.getPreviousSibling();if(k.$isAutoLinkNode(e))E(e,c,d);else if(!k.$isLinkNode(e)){if(h.isSimpleText()&&(x.test(h.getTextContent()[0])||!k.$isAutoLinkNode(f))){e=[h];for(f=h.getNextSibling();null!==f&&t.$isTextNode(f)&&f.isSimpleText();){e.push(f);if(/[\s]/.test(f.getTextContent()))break;f=f.getNextSibling()}D(e,
16
- c,d)}let g=h.getPreviousSibling();e=h.getNextSibling();f=h.getTextContent();k.$isAutoLinkNode(g)&&!x.test(f[0])&&(g.append(h),E(g,c,d),h=g.getURL(),b&&b(null,h));k.$isAutoLinkNode(e)&&!x.test(f[f.length-1])&&(H(e),E(e,c,d),h=e.getURL(),b&&b(null,h))}}))},[a,c,b])}exports.AutoLinkPlugin=function({matchers:a,onChange:c}){let [b]=n.useLexicalComposerContext();I(b,a,c);return null};
8
+
9
+ 'use strict';var k=require("@lexical/link"),n=require("@lexical/react/LexicalComposerContext"),p=require("@lexical/utils"),r=require("lexical"),u=require("react"),v;function w(a){let c=new URLSearchParams;c.append("code",a);for(let b=1;b<arguments.length;b++)c.append("v",arguments[b]);throw Error(`Minified Lexical error #${a}; visit https://lexical.dev/docs/error?${c} for the full message or `+"use the non-minified dev environment for full errors and additional helpful warnings.");}
10
+ v=w&&w.__esModule&&Object.prototype.hasOwnProperty.call(w,"default")?w["default"]:w;function x(a,c){for(let b=0;b<c.length;b++){let d=c[b](a);if(d)return d}return null}let y=/[.,;\s]/;function z(a){a=a.getPreviousSibling();r.$isElementNode(a)&&(a=a.getLastDescendant());var c;!(c=null===a||r.$isLineBreakNode(a))&&(c=r.$isTextNode(a))&&(a=a.getTextContent(),c=y.test(a[a.length-1]));return c}
11
+ function A(a){a=a.getNextSibling();r.$isElementNode(a)&&(a=a.getFirstDescendant());return null===a||r.$isLineBreakNode(a)||r.$isTextNode(a)&&y.test(a.getTextContent()[0])}function B(a,c,b,d){return(0<a?y.test(b[a-1]):z(d[0]))?c<b.length?y.test(b[c]):A(d[d.length-1]):!1}function C(a,c,b){let d=[],h=[],e=[],f=0,g=0;for(a=[...a];0<a.length;){let l=a[0],m=l.getTextContent().length,q=g;g+m<=c?(d.push(l),f+=m):q>=b?e.push(l):h.push(l);g+=m;a.shift()}return[f,d,h,e]}
12
+ function D(a,c,b,d){let h=k.$createAutoLinkNode(d.url,d.attributes);if(1===a.length){var e=a[0];0===c?[g,e]=e.splitText(b):[,g,e]=e.splitText(c,b);var f=r.$createTextNode(d.text);f.setFormat(g.getFormat());f.setDetail(g.getDetail());f.setStyle(g.getStyle());h.append(f);g.replace(h);return e}if(1<a.length){d=a[0];var g=d.getTextContent().length;0===c?e=d:[,e]=d.splitText(c);c=[];for(d=1;d<a.length;d++){let l=a[d],m=l.getTextContent().length,q=g,t=g+m;if(q<b)if(t<=b)c.push(l);else{let [G,H]=l.splitText(b-
13
+ q);c.push(G);f=H}g+=m}a=(b=r.$getSelection())?b.getNodes().find(r.$isTextNode):void 0;g=r.$createTextNode(e.getTextContent());g.setFormat(e.getFormat());g.setDetail(e.getDetail());g.setStyle(e.getStyle());h.append(g,...c);a&&a===e&&(r.$isRangeSelection(b)?g.select(b.anchor.offset,b.focus.offset):r.$isNodeSelection(b)&&g.select(0,g.getTextContent().length));e.replace(h);return f}}
14
+ function E(a,c,b){var d=[...a];let h=a=d.map(g=>g.getTextContent()).join(""),e,f=0;for(;(e=x(h,c))&&null!==e;){let g=e.index,l=g+e.length;if(B(f+g,f+l,a,d)){let [m,,q,t]=C(d,f+g,f+l);d=(d=D(q,f+g-m,f+l-m,e))?[d,...t]:t;b(e.url,null);f=0}else f+=l;h=h.substring(l)}}
15
+ function F(a,c,b){var d=a.getChildren();let h=d.length;for(let e=0;e<h;e++){let f=d[e];if(!r.$isTextNode(f)||!f.isSimpleText()){I(a);b(null,a.getURL());return}}d=a.getTextContent();c=x(d,c);null===c||c.text!==d?(I(a),b(null,a.getURL())):z(a)&&A(a)?(d=a.getURL(),d!==c.url&&(a.setURL(c.url),b(c.url,d)),c.attributes&&(d=a.getRel(),d!==c.attributes.rel&&(a.setRel(c.attributes.rel||null),b(c.attributes.rel||null,d)),d=a.getTarget(),d!==c.attributes.target&&(a.setTarget(c.attributes.target||null),b(c.attributes.target||
16
+ null,d)))):(I(a),b(null,a.getURL()))}function I(a){let c=a.getChildren();var b=c.length;for(--b;0<=b;b--)a.insertAfter(c[b]);a.remove();return c.map(d=>d.getLatest())}
17
+ function J(a,c,b){u.useEffect(()=>{a.hasNodes([k.AutoLinkNode])||v(77);let d=(h,e)=>{b&&b(h,e)};return p.mergeRegister(a.registerNodeTransform(r.TextNode,h=>{var e=h.getParentOrThrow(),f=h.getPreviousSibling();if(k.$isAutoLinkNode(e))F(e,c,d);else if(!k.$isLinkNode(e)){if(h.isSimpleText()&&(y.test(h.getTextContent()[0])||!k.$isAutoLinkNode(f))){e=[h];for(f=h.getNextSibling();null!==f&&r.$isTextNode(f)&&f.isSimpleText();){e.push(f);if(/[\s]/.test(f.getTextContent()))break;f=f.getNextSibling()}E(e,
18
+ c,d)}let g=h.getPreviousSibling();e=h.getNextSibling();f=h.getTextContent();k.$isAutoLinkNode(g)&&!y.test(f[0])&&(g.append(h),F(g,c,d),h=g.getURL(),b&&b(null,h));k.$isAutoLinkNode(e)&&!y.test(f[f.length-1])&&(I(e),F(e,c,d),h=e.getURL(),b&&b(null,h))}}))},[a,c,b])}exports.AutoLinkPlugin=function({matchers:a,onChange:c}){let [b]=n.useLexicalComposerContext();J(b,a,c);return null};
17
19
  exports.createLinkMatcherWithRegExp=function(a,c=b=>b){return b=>{b=a.exec(b);return null===b?null:{index:b.index,length:b[0].length,text:b[0],url:c(b[0])}}}
@@ -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{AutoLinkNode as t,$isAutoLinkNode as e,$isLinkNode as n,$createAutoLinkNode as r}from"@lexical/link";import{useLexicalComposerContext as l}from"@lexical/react/LexicalComposerContext";import{mergeRegister as o}from"@lexical/utils";import{TextNode as i,$isTextNode as s,$isLineBreakNode as u,$isElementNode as g,$createTextNode as c,$getSelection as f,$isRangeSelection as a,$isNodeSelection as x}from"lexical";import{useEffect as h}from"react";var p=function(t){const e=new URLSearchParams;e.append("code",t);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${t}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)};function d(t,e=(t=>t)){return n=>{const r=t.exec(n);return null===r?null:{index:r.index,length:r[0].length,text:r[0],url:e(r[0])}}}function m(t,e){for(let n=0;n<e.length;n++){const r=e[n](t);if(r)return r}return null}const T=/[.,;\s]/;function C(t){return T.test(t)}function b(t){return C(t[t.length-1])}function v(t){return C(t[0])}function L(t){let e=t.getPreviousSibling();return g(e)&&(e=e.getLastDescendant()),null===e||u(e)||s(e)&&b(e.getTextContent())}function S(t){let e=t.getNextSibling();return g(e)&&(e=e.getFirstDescendant()),null===e||u(e)||s(e)&&v(e.getTextContent())}function R(t,e,n,r){if(!(t>0?C(n[t-1]):L(r[0])))return!1;return e<n.length?C(n[e]):S(r[r.length-1])}function U(t,e,n){const r=[],l=[],o=[];let i=0,s=0;const u=[...t];for(;u.length>0;){const t=u[0],g=t.getTextContent().length,c=s;s+g<=e?(r.push(t),i+=g):c>=n?o.push(t):l.push(t),s+=g,u.shift()}return[i,r,l,o]}function N(t,e,n,l){const o=r(l.url,l.attributes);if(1===t.length){let r,i=t[0];0===e?[r,i]=i.splitText(n):[,r,i]=i.splitText(e,n);const s=c(l.text);return s.setFormat(r.getFormat()),s.setDetail(r.getDetail()),o.append(s),r.replace(o),i}if(t.length>1){const r=t[0];let l,i=r.getTextContent().length;0===e?l=r:[,l]=r.splitText(e);const u=[];let g;for(let e=1;e<t.length;e++){const r=t[e],l=r.getTextContent().length,o=i;if(o<n)if(i+l<=n)u.push(r);else{const[t,e]=r.splitText(n-o);u.push(t),g=e}i+=l}const h=f(),p=h?h.getNodes().find(s):void 0,d=c(l.getTextContent());return d.setFormat(l.getFormat()),d.setDetail(l.getDetail()),o.append(d,...u),p&&p===l&&(a(h)?d.select(h.anchor.offset,h.focus.offset):x(h)&&d.select(0,d.getTextContent().length)),l.replace(o),g}}function D(t,e,n){const r=t.getChildren(),l=r.length;for(let e=0;e<l;e++){const l=r[e];if(!s(l)||!l.isSimpleText())return F(t),void n(null,t.getURL())}const o=t.getTextContent(),i=m(o,e);if(null===i||i.text!==o)return F(t),void n(null,t.getURL());if(!L(t)||!S(t))return F(t),void n(null,t.getURL());const u=t.getURL();if(u!==i.url&&(t.setURL(i.url),n(i.url,u)),i.attributes){const e=t.getRel();e!==i.attributes.rel&&(t.setRel(i.attributes.rel||null),n(i.attributes.rel||null,e));const r=t.getTarget();r!==i.attributes.target&&(t.setTarget(i.attributes.target||null),n(i.attributes.target||null,r))}}function F(t){const e=t.getChildren();for(let n=e.length-1;n>=0;n--)t.insertAfter(e[n]);return t.remove(),e.map((t=>t.getLatest()))}function P(r,l,u){h((()=>{r.hasNodes([t])||p(77);const g=(t,e)=>{u&&u(t,e)};return o(r.registerNodeTransform(i,(t=>{const r=t.getParentOrThrow(),o=t.getPreviousSibling();if(e(r))D(r,l,g);else if(!n(r)){if(t.isSimpleText()&&(v(t.getTextContent())||!e(o))){const e=function(t){const e=[t];let n=t.getNextSibling();for(;null!==n&&s(n)&&n.isSimpleText()&&(e.push(n),!/[\s]/.test(n.getTextContent()));)n=n.getNextSibling();return e}(t);!function(t,e,n){let r=[...t];const l=r.map((t=>t.getTextContent())).join("");let o,i=l,s=0;for(;(o=m(i,e))&&null!==o;){const t=o.index,e=t+o.length;if(R(s+t,s+e,l,r)){const[l,,i,u]=U(r,s+t,s+e),g=N(i,s+t-l,s+e-l,o);r=g?[g,...u]:u,n(o.url,null),s=0}else s+=e;i=i.substring(e)}}(e,l,g)}!function(t,n,r){const l=t.getPreviousSibling(),o=t.getNextSibling(),i=t.getTextContent();e(l)&&!v(i)&&(l.append(t),D(l,n,r),r(null,l.getURL())),e(o)&&!b(i)&&(F(o),D(o,n,r),r(null,o.getURL()))}(t,l,g)}})))}),[r,l,u])}function w({matchers:t,onChange:e}){const[n]=l();return P(n,t,e),null}export{w as AutoLinkPlugin,d as createLinkMatcherWithRegExp};
8
+
9
+ import{AutoLinkNode as t,$isAutoLinkNode as e,$isLinkNode as n,$createAutoLinkNode as l}from"@lexical/link";import{useLexicalComposerContext as r}from"@lexical/react/LexicalComposerContext";import{mergeRegister as o}from"@lexical/utils";import{TextNode as i,$isTextNode as s,$isElementNode as u,$isLineBreakNode as g,$createTextNode as c,$getSelection as f,$isRangeSelection as a,$isNodeSelection as h}from"lexical";import{useEffect as p}from"react";function x(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var d=x((function(t){const e=new URLSearchParams;e.append("code",t);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${t}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}));function m(t,e=(t=>t)){return n=>{const l=t.exec(n);return null===l?null:{index:l.index,length:l[0].length,text:l[0],url:e(l[0])}}}function T(t,e){for(let n=0;n<e.length;n++){const l=e[n](t);if(l)return l}return null}const b=/[.,;\s]/;function C(t){return b.test(t)}function S(t){return C(t[t.length-1])}function v(t){return C(t[0])}function L(t){let e=t.getPreviousSibling();return u(e)&&(e=e.getLastDescendant()),null===e||g(e)||s(e)&&S(e.getTextContent())}function R(t){let e=t.getNextSibling();return u(e)&&(e=e.getFirstDescendant()),null===e||g(e)||s(e)&&v(e.getTextContent())}function U(t,e,n,l){if(!(t>0?C(n[t-1]):L(l[0])))return!1;return e<n.length?C(n[e]):R(l[l.length-1])}function N(t,e,n){const l=[],r=[],o=[];let i=0,s=0;const u=[...t];for(;u.length>0;){const t=u[0],g=t.getTextContent().length,c=s;s+g<=e?(l.push(t),i+=g):c>=n?o.push(t):r.push(t),s+=g,u.shift()}return[i,l,r,o]}function y(t,e,n,r){const o=l(r.url,r.attributes);if(1===t.length){let l,i=t[0];0===e?[l,i]=i.splitText(n):[,l,i]=i.splitText(e,n);const s=c(r.text);return s.setFormat(l.getFormat()),s.setDetail(l.getDetail()),s.setStyle(l.getStyle()),o.append(s),l.replace(o),i}if(t.length>1){const l=t[0];let r,i=l.getTextContent().length;0===e?r=l:[,r]=l.splitText(e);const u=[];let g;for(let e=1;e<t.length;e++){const l=t[e],r=l.getTextContent().length,o=i;if(o<n)if(i+r<=n)u.push(l);else{const[t,e]=l.splitText(n-o);u.push(t),g=e}i+=r}const p=f(),x=p?p.getNodes().find(s):void 0,d=c(r.getTextContent());return d.setFormat(r.getFormat()),d.setDetail(r.getDetail()),d.setStyle(r.getStyle()),o.append(d,...u),x&&x===r&&(a(p)?d.select(p.anchor.offset,p.focus.offset):h(p)&&d.select(0,d.getTextContent().length)),r.replace(o),g}}function D(t,e,n){const l=t.getChildren(),r=l.length;for(let e=0;e<r;e++){const r=l[e];if(!s(r)||!r.isSimpleText())return P(t),void n(null,t.getURL())}const o=t.getTextContent(),i=T(o,e);if(null===i||i.text!==o)return P(t),void n(null,t.getURL());if(!L(t)||!R(t))return P(t),void n(null,t.getURL());const u=t.getURL();if(u!==i.url&&(t.setURL(i.url),n(i.url,u)),i.attributes){const e=t.getRel();e!==i.attributes.rel&&(t.setRel(i.attributes.rel||null),n(i.attributes.rel||null,e));const l=t.getTarget();l!==i.attributes.target&&(t.setTarget(i.attributes.target||null),n(i.attributes.target||null,l))}}function P(t){const e=t.getChildren();for(let n=e.length-1;n>=0;n--)t.insertAfter(e[n]);return t.remove(),e.map((t=>t.getLatest()))}function w(l,r,u){p((()=>{l.hasNodes([t])||d(77);const g=(t,e)=>{u&&u(t,e)};return o(l.registerNodeTransform(i,(t=>{const l=t.getParentOrThrow(),o=t.getPreviousSibling();if(e(l))D(l,r,g);else if(!n(l)){if(t.isSimpleText()&&(v(t.getTextContent())||!e(o))){const e=function(t){const e=[t];let n=t.getNextSibling();for(;null!==n&&s(n)&&n.isSimpleText()&&(e.push(n),!/[\s]/.test(n.getTextContent()));)n=n.getNextSibling();return e}(t);!function(t,e,n){let l=[...t];const r=l.map((t=>t.getTextContent())).join("");let o,i=r,s=0;for(;(o=T(i,e))&&null!==o;){const t=o.index,e=t+o.length;if(U(s+t,s+e,r,l)){const[r,,i,u]=N(l,s+t,s+e),g=y(i,s+t-r,s+e-r,o);l=g?[g,...u]:u,n(o.url,null),s=0}else s+=e;i=i.substring(e)}}(e,r,g)}!function(t,n,l){const r=t.getPreviousSibling(),o=t.getNextSibling(),i=t.getTextContent();e(r)&&!v(i)&&(r.append(t),D(r,n,l),l(null,r.getURL())),e(o)&&!S(i)&&(P(o),D(o,n,l),l(null,o.getURL()))}(t,r,g)}})))}),[l,r,u])}function F({matchers:t,onChange:e}){const[n]=r();return w(n,t,e),null}export{F as AutoLinkPlugin,m as createLinkMatcherWithRegExp};
@@ -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');
@@ -13,6 +15,19 @@ var utils = require('@lexical/utils');
13
15
  var lexical = require('lexical');
14
16
  var React = require('react');
15
17
 
18
+ function _interopNamespaceDefault(e) {
19
+ var n = Object.create(null);
20
+ if (e) {
21
+ for (var k in e) {
22
+ n[k] = e[k];
23
+ }
24
+ }
25
+ n.default = e;
26
+ return n;
27
+ }
28
+
29
+ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
30
+
16
31
  /**
17
32
  * Copyright (c) Meta Platforms, Inc. and affiliates.
18
33
  *
@@ -20,6 +35,7 @@ var React = require('react');
20
35
  * LICENSE file in the root directory of this source tree.
21
36
  *
22
37
  */
38
+
23
39
  function BlockWithAlignableContents({
24
40
  children,
25
41
  format,
@@ -29,7 +45,7 @@ function BlockWithAlignableContents({
29
45
  const [editor] = LexicalComposerContext.useLexicalComposerContext();
30
46
  const [isSelected, setSelected, clearSelection] = useLexicalNodeSelection.useLexicalNodeSelection(nodeKey);
31
47
  const ref = React.useRef(null);
32
- const onDelete = React.useCallback(event => {
48
+ const $onDelete = React.useCallback(event => {
33
49
  if (isSelected && lexical.$isNodeSelection(lexical.$getSelection())) {
34
50
  event.preventDefault();
35
51
  const node = lexical.$getNodeByKey(nodeKey);
@@ -73,9 +89,9 @@ function BlockWithAlignableContents({
73
89
  return true;
74
90
  }
75
91
  return false;
76
- }, lexical.COMMAND_PRIORITY_LOW), editor.registerCommand(lexical.KEY_DELETE_COMMAND, onDelete, lexical.COMMAND_PRIORITY_LOW), editor.registerCommand(lexical.KEY_BACKSPACE_COMMAND, onDelete, lexical.COMMAND_PRIORITY_LOW));
77
- }, [clearSelection, editor, isSelected, nodeKey, onDelete, setSelected]);
78
- return /*#__PURE__*/React.createElement("div", {
92
+ }, lexical.COMMAND_PRIORITY_LOW), editor.registerCommand(lexical.KEY_DELETE_COMMAND, $onDelete, lexical.COMMAND_PRIORITY_LOW), editor.registerCommand(lexical.KEY_BACKSPACE_COMMAND, $onDelete, lexical.COMMAND_PRIORITY_LOW));
93
+ }, [clearSelection, editor, isSelected, nodeKey, $onDelete, setSelected]);
94
+ return /*#__PURE__*/React__namespace.createElement("div", {
79
95
  className: [className.base, isSelected ? className.focus : null].filter(Boolean).join(' '),
80
96
  ref: ref,
81
97
  style: {
@@ -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 { $isDecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode';
9
11
  import { useLexicalNodeSelection } from '@lexical/react/useLexicalNodeSelection';
@@ -19,6 +21,7 @@ import { useRef, useCallback, useEffect } from 'react';
19
21
  * LICENSE file in the root directory of this source tree.
20
22
  *
21
23
  */
24
+
22
25
  function BlockWithAlignableContents({
23
26
  children,
24
27
  format,
@@ -28,7 +31,7 @@ function BlockWithAlignableContents({
28
31
  const [editor] = useLexicalComposerContext();
29
32
  const [isSelected, setSelected, clearSelection] = useLexicalNodeSelection(nodeKey);
30
33
  const ref = useRef(null);
31
- const onDelete = useCallback(event => {
34
+ const $onDelete = useCallback(event => {
32
35
  if (isSelected && $isNodeSelection($getSelection())) {
33
36
  event.preventDefault();
34
37
  const node = $getNodeByKey(nodeKey);
@@ -72,8 +75,8 @@ function BlockWithAlignableContents({
72
75
  return true;
73
76
  }
74
77
  return false;
75
- }, COMMAND_PRIORITY_LOW), editor.registerCommand(KEY_DELETE_COMMAND, onDelete, COMMAND_PRIORITY_LOW), editor.registerCommand(KEY_BACKSPACE_COMMAND, onDelete, COMMAND_PRIORITY_LOW));
76
- }, [clearSelection, editor, isSelected, nodeKey, onDelete, setSelected]);
78
+ }, COMMAND_PRIORITY_LOW), editor.registerCommand(KEY_DELETE_COMMAND, $onDelete, COMMAND_PRIORITY_LOW), editor.registerCommand(KEY_BACKSPACE_COMMAND, $onDelete, COMMAND_PRIORITY_LOW));
79
+ }, [clearSelection, editor, isSelected, nodeKey, $onDelete, setSelected]);
77
80
  return /*#__PURE__*/React.createElement("div", {
78
81
  className: [className.base, isSelected ? className.focus : null].filter(Boolean).join(' '),
79
82
  ref: ref,
@@ -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 LexicalBlockWithAlignableContents = process.env.NODE_ENV === 'development' ? require('./LexicalBlockWithAlignableContents.dev.js') : require('./LexicalBlockWithAlignableContents.prod.js');
9
11
  module.exports = LexicalBlockWithAlignableContents;
@@ -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 './LexicalBlockWithAlignableContents.dev.mjs';
8
10
  import * as modProd from './LexicalBlockWithAlignableContents.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('./LexicalBlockWithAlignableContents.dev.mjs') : import('./LexicalBlockWithAlignableContents.prod.mjs'));
8
10
  export const BlockWithAlignableContents = mod.BlockWithAlignableContents;