@lexical/react 0.13.1 → 0.14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (179) hide show
  1. package/LexicalAutoEmbedPlugin.dev.esm.js +131 -0
  2. package/LexicalAutoEmbedPlugin.esm.js +13 -0
  3. package/LexicalAutoEmbedPlugin.js +1 -1
  4. package/LexicalAutoEmbedPlugin.prod.esm.js +7 -0
  5. package/LexicalAutoFocusPlugin.dev.esm.js +42 -0
  6. package/LexicalAutoFocusPlugin.esm.js +10 -0
  7. package/LexicalAutoFocusPlugin.js +1 -1
  8. package/LexicalAutoFocusPlugin.prod.esm.js +7 -0
  9. package/LexicalAutoLinkPlugin.dev.esm.js +312 -0
  10. package/LexicalAutoLinkPlugin.dev.js +3 -1
  11. package/LexicalAutoLinkPlugin.esm.js +11 -0
  12. package/LexicalAutoLinkPlugin.js +1 -1
  13. package/LexicalAutoLinkPlugin.prod.esm.js +7 -0
  14. package/LexicalBlockWithAlignableContents.dev.esm.js +86 -0
  15. package/LexicalBlockWithAlignableContents.dev.js +1 -0
  16. package/LexicalBlockWithAlignableContents.esm.js +10 -0
  17. package/LexicalBlockWithAlignableContents.js +1 -1
  18. package/LexicalBlockWithAlignableContents.prod.esm.js +7 -0
  19. package/LexicalBlockWithAlignableContents.prod.js +1 -1
  20. package/LexicalCharacterLimitPlugin.d.ts +4 -1
  21. package/LexicalCharacterLimitPlugin.dev.esm.js +272 -0
  22. package/LexicalCharacterLimitPlugin.dev.js +12 -4
  23. package/LexicalCharacterLimitPlugin.esm.js +10 -0
  24. package/LexicalCharacterLimitPlugin.js +1 -1
  25. package/LexicalCharacterLimitPlugin.prod.esm.js +7 -0
  26. package/LexicalCharacterLimitPlugin.prod.js +9 -9
  27. package/LexicalCheckListPlugin.dev.esm.js +203 -0
  28. package/LexicalCheckListPlugin.esm.js +10 -0
  29. package/LexicalCheckListPlugin.js +1 -1
  30. package/LexicalCheckListPlugin.prod.esm.js +7 -0
  31. package/LexicalClearEditorPlugin.dev.esm.js +64 -0
  32. package/LexicalClearEditorPlugin.esm.js +10 -0
  33. package/LexicalClearEditorPlugin.js +1 -1
  34. package/LexicalClearEditorPlugin.prod.esm.js +7 -0
  35. package/LexicalClickableLinkPlugin.dev.esm.js +95 -0
  36. package/LexicalClickableLinkPlugin.esm.js +10 -0
  37. package/LexicalClickableLinkPlugin.js +1 -1
  38. package/LexicalClickableLinkPlugin.prod.esm.js +7 -0
  39. package/LexicalCollaborationContext.dev.esm.js +36 -0
  40. package/LexicalCollaborationContext.esm.js +11 -0
  41. package/LexicalCollaborationContext.js +1 -1
  42. package/LexicalCollaborationContext.prod.esm.js +7 -0
  43. package/LexicalCollaborationPlugin.dev.esm.js +308 -0
  44. package/LexicalCollaborationPlugin.esm.js +10 -0
  45. package/LexicalCollaborationPlugin.js +1 -1
  46. package/LexicalCollaborationPlugin.prod.esm.js +7 -0
  47. package/LexicalComposer.dev.esm.js +129 -0
  48. package/LexicalComposer.esm.js +10 -0
  49. package/LexicalComposer.js +1 -1
  50. package/LexicalComposer.prod.esm.js +7 -0
  51. package/LexicalComposerContext.dev.esm.js +42 -0
  52. package/LexicalComposerContext.esm.js +12 -0
  53. package/LexicalComposerContext.js +1 -1
  54. package/LexicalComposerContext.prod.esm.js +7 -0
  55. package/LexicalContentEditable.dev.esm.js +107 -0
  56. package/LexicalContentEditable.dev.js +5 -1
  57. package/LexicalContentEditable.esm.js +10 -0
  58. package/LexicalContentEditable.js +1 -1
  59. package/LexicalContentEditable.prod.esm.js +7 -0
  60. package/LexicalContentEditable.prod.js +3 -3
  61. package/LexicalContextMenuPlugin.dev.esm.js +455 -0
  62. package/LexicalContextMenuPlugin.dev.js +3 -1
  63. package/LexicalContextMenuPlugin.esm.js +11 -0
  64. package/LexicalContextMenuPlugin.js +1 -1
  65. package/LexicalContextMenuPlugin.prod.esm.js +7 -0
  66. package/LexicalDecoratorBlockNode.dev.esm.js +46 -0
  67. package/LexicalDecoratorBlockNode.esm.js +11 -0
  68. package/LexicalDecoratorBlockNode.js +1 -1
  69. package/LexicalDecoratorBlockNode.prod.esm.js +7 -0
  70. package/LexicalEditorRefPlugin.dev.esm.js +40 -0
  71. package/LexicalEditorRefPlugin.dev.js +10 -5
  72. package/LexicalEditorRefPlugin.esm.js +10 -0
  73. package/LexicalEditorRefPlugin.js +1 -1
  74. package/LexicalEditorRefPlugin.prod.esm.js +7 -0
  75. package/LexicalEditorRefPlugin.prod.js +1 -1
  76. package/LexicalErrorBoundary.dev.esm.js +157 -0
  77. package/LexicalErrorBoundary.esm.js +10 -0
  78. package/LexicalErrorBoundary.js +1 -1
  79. package/LexicalErrorBoundary.prod.esm.js +7 -0
  80. package/LexicalHashtagPlugin.dev.esm.js +163 -0
  81. package/LexicalHashtagPlugin.esm.js +10 -0
  82. package/LexicalHashtagPlugin.js +1 -1
  83. package/LexicalHashtagPlugin.prod.esm.js +7 -0
  84. package/LexicalHistoryPlugin.dev.esm.js +41 -0
  85. package/LexicalHistoryPlugin.esm.js +11 -0
  86. package/LexicalHistoryPlugin.js +1 -1
  87. package/LexicalHistoryPlugin.prod.esm.js +7 -0
  88. package/LexicalHorizontalRuleNode.dev.esm.js +118 -0
  89. package/LexicalHorizontalRuleNode.dev.js +1 -0
  90. package/LexicalHorizontalRuleNode.esm.js +13 -0
  91. package/LexicalHorizontalRuleNode.js +1 -1
  92. package/LexicalHorizontalRuleNode.prod.esm.js +7 -0
  93. package/LexicalHorizontalRuleNode.prod.js +1 -1
  94. package/LexicalHorizontalRulePlugin.dev.esm.js +39 -0
  95. package/LexicalHorizontalRulePlugin.esm.js +10 -0
  96. package/LexicalHorizontalRulePlugin.js +1 -1
  97. package/LexicalHorizontalRulePlugin.prod.esm.js +7 -0
  98. package/LexicalLinkPlugin.dev.esm.js +79 -0
  99. package/LexicalLinkPlugin.dev.js +6 -2
  100. package/LexicalLinkPlugin.esm.js +10 -0
  101. package/LexicalLinkPlugin.js +1 -1
  102. package/LexicalLinkPlugin.prod.esm.js +7 -0
  103. package/LexicalLinkPlugin.prod.js +1 -1
  104. package/LexicalListPlugin.dev.esm.js +59 -0
  105. package/LexicalListPlugin.esm.js +10 -0
  106. package/LexicalListPlugin.js +1 -1
  107. package/LexicalListPlugin.prod.esm.js +7 -0
  108. package/LexicalMarkdownShortcutPlugin.dev.esm.js +49 -0
  109. package/LexicalMarkdownShortcutPlugin.esm.js +11 -0
  110. package/LexicalMarkdownShortcutPlugin.js +1 -1
  111. package/LexicalMarkdownShortcutPlugin.prod.esm.js +7 -0
  112. package/LexicalNestedComposer.dev.esm.js +105 -0
  113. package/LexicalNestedComposer.esm.js +10 -0
  114. package/LexicalNestedComposer.js +1 -1
  115. package/LexicalNestedComposer.prod.esm.js +7 -0
  116. package/LexicalNodeEventPlugin.dev.esm.js +56 -0
  117. package/LexicalNodeEventPlugin.esm.js +10 -0
  118. package/LexicalNodeEventPlugin.js +1 -1
  119. package/LexicalNodeEventPlugin.prod.esm.js +7 -0
  120. package/LexicalNodeMenuPlugin.dev.esm.js +466 -0
  121. package/LexicalNodeMenuPlugin.dev.js +3 -1
  122. package/LexicalNodeMenuPlugin.esm.js +11 -0
  123. package/LexicalNodeMenuPlugin.js +1 -1
  124. package/LexicalNodeMenuPlugin.prod.esm.js +7 -0
  125. package/LexicalOnChangePlugin.dev.esm.js +62 -0
  126. package/LexicalOnChangePlugin.esm.js +10 -0
  127. package/LexicalOnChangePlugin.js +1 -1
  128. package/LexicalOnChangePlugin.prod.esm.js +7 -0
  129. package/LexicalPlainTextPlugin.dev.esm.js +161 -0
  130. package/LexicalPlainTextPlugin.esm.js +10 -0
  131. package/LexicalPlainTextPlugin.js +1 -1
  132. package/LexicalPlainTextPlugin.prod.esm.js +7 -0
  133. package/LexicalRichTextPlugin.dev.esm.js +161 -0
  134. package/LexicalRichTextPlugin.esm.js +10 -0
  135. package/LexicalRichTextPlugin.js +1 -1
  136. package/LexicalRichTextPlugin.prod.esm.js +7 -0
  137. package/LexicalTabIndentationPlugin.dev.esm.js +76 -0
  138. package/LexicalTabIndentationPlugin.esm.js +11 -0
  139. package/LexicalTabIndentationPlugin.js +1 -1
  140. package/LexicalTabIndentationPlugin.prod.esm.js +7 -0
  141. package/LexicalTableOfContents.dev.esm.js +157 -0
  142. package/LexicalTableOfContents.esm.js +10 -0
  143. package/LexicalTableOfContents.js +1 -1
  144. package/LexicalTableOfContents.prod.esm.js +7 -0
  145. package/LexicalTablePlugin.dev.esm.js +163 -0
  146. package/LexicalTablePlugin.esm.js +10 -0
  147. package/LexicalTablePlugin.js +1 -1
  148. package/LexicalTablePlugin.prod.esm.js +7 -0
  149. package/LexicalTreeView.dev.esm.js +483 -0
  150. package/LexicalTreeView.dev.js +3 -1
  151. package/LexicalTreeView.esm.js +10 -0
  152. package/LexicalTreeView.js +1 -1
  153. package/LexicalTreeView.prod.esm.js +7 -0
  154. package/LexicalTypeaheadMenuPlugin.dev.esm.js +569 -0
  155. package/LexicalTypeaheadMenuPlugin.dev.js +3 -1
  156. package/LexicalTypeaheadMenuPlugin.esm.js +16 -0
  157. package/LexicalTypeaheadMenuPlugin.js +1 -1
  158. package/LexicalTypeaheadMenuPlugin.prod.esm.js +7 -0
  159. package/package.json +583 -20
  160. package/useLexicalEditable.dev.esm.js +82 -0
  161. package/useLexicalEditable.esm.js +10 -0
  162. package/useLexicalEditable.js +1 -1
  163. package/useLexicalEditable.prod.esm.js +7 -0
  164. package/useLexicalIsTextContentEmpty.dev.esm.js +51 -0
  165. package/useLexicalIsTextContentEmpty.esm.js +10 -0
  166. package/useLexicalIsTextContentEmpty.js +1 -1
  167. package/useLexicalIsTextContentEmpty.prod.esm.js +7 -0
  168. package/useLexicalNodeSelection.dev.esm.js +69 -0
  169. package/useLexicalNodeSelection.esm.js +10 -0
  170. package/useLexicalNodeSelection.js +1 -1
  171. package/useLexicalNodeSelection.prod.esm.js +7 -0
  172. package/useLexicalSubscription.dev.esm.js +63 -0
  173. package/useLexicalSubscription.esm.js +10 -0
  174. package/useLexicalSubscription.js +1 -1
  175. package/useLexicalSubscription.prod.esm.js +7 -0
  176. package/useLexicalTextEntity.dev.esm.js +26 -0
  177. package/useLexicalTextEntity.esm.js +10 -0
  178. package/useLexicalTextEntity.js +1 -1
  179. package/useLexicalTextEntity.prod.esm.js +7 -0
@@ -0,0 +1,131 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ import { $isLinkNode, LinkNode, AutoLinkNode } from '@lexical/link';
8
+ import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
9
+ import { MenuOption, LexicalNodeMenuPlugin } from '@lexical/react/LexicalNodeMenuPlugin';
10
+ import { mergeRegister } from '@lexical/utils';
11
+ import { createCommand, $getNodeByKey, COMMAND_PRIORITY_EDITOR, $getSelection, COMMAND_PRIORITY_LOW } from 'lexical';
12
+ import * as React from 'react';
13
+ import { useState, useCallback, useEffect, useMemo } from 'react';
14
+
15
+ /**
16
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
17
+ *
18
+ * This source code is licensed under the MIT license found in the
19
+ * LICENSE file in the root directory of this source tree.
20
+ *
21
+ */
22
+ const URL_MATCHER = /((https?:\/\/(www\.)?)|(www\.))[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/;
23
+ const INSERT_EMBED_COMMAND = createCommand('INSERT_EMBED_COMMAND');
24
+ class AutoEmbedOption extends MenuOption {
25
+ constructor(title, options) {
26
+ super(title);
27
+ this.title = title;
28
+ this.onSelect = options.onSelect.bind(this);
29
+ }
30
+ }
31
+ function LexicalAutoEmbedPlugin({
32
+ embedConfigs,
33
+ onOpenEmbedModalForConfig,
34
+ getMenuOptions,
35
+ menuRenderFn,
36
+ menuCommandPriority = COMMAND_PRIORITY_LOW
37
+ }) {
38
+ const [editor] = useLexicalComposerContext();
39
+ const [nodeKey, setNodeKey] = useState(null);
40
+ const [activeEmbedConfig, setActiveEmbedConfig] = useState(null);
41
+ const reset = useCallback(() => {
42
+ setNodeKey(null);
43
+ setActiveEmbedConfig(null);
44
+ }, []);
45
+ const checkIfLinkNodeIsEmbeddable = useCallback(key => {
46
+ editor.getEditorState().read(async () => {
47
+ const linkNode = $getNodeByKey(key);
48
+ if ($isLinkNode(linkNode)) {
49
+ for (let i = 0; i < embedConfigs.length; i++) {
50
+ const embedConfig = embedConfigs[i];
51
+ const urlMatch = await Promise.resolve(embedConfig.parseUrl(linkNode.__url));
52
+ if (urlMatch != null) {
53
+ setActiveEmbedConfig(embedConfig);
54
+ setNodeKey(linkNode.getKey());
55
+ }
56
+ }
57
+ }
58
+ });
59
+ }, [editor, embedConfigs]);
60
+ useEffect(() => {
61
+ const listener = (nodeMutations, {
62
+ updateTags,
63
+ dirtyLeaves
64
+ }) => {
65
+ for (const [key, mutation] of nodeMutations) {
66
+ if (mutation === 'created' && updateTags.has('paste') && dirtyLeaves.size <= 3) {
67
+ checkIfLinkNodeIsEmbeddable(key);
68
+ } else if (key === nodeKey) {
69
+ reset();
70
+ }
71
+ }
72
+ };
73
+ return mergeRegister(...[LinkNode, AutoLinkNode].map(Klass => editor.registerMutationListener(Klass, (...args) => listener(...args))));
74
+ }, [checkIfLinkNodeIsEmbeddable, editor, embedConfigs, nodeKey, reset]);
75
+ useEffect(() => {
76
+ return editor.registerCommand(INSERT_EMBED_COMMAND, embedConfigType => {
77
+ const embedConfig = embedConfigs.find(({
78
+ type
79
+ }) => type === embedConfigType);
80
+ if (embedConfig) {
81
+ onOpenEmbedModalForConfig(embedConfig);
82
+ return true;
83
+ }
84
+ return false;
85
+ }, COMMAND_PRIORITY_EDITOR);
86
+ }, [editor, embedConfigs, onOpenEmbedModalForConfig]);
87
+ const embedLinkViaActiveEmbedConfig = useCallback(async () => {
88
+ if (activeEmbedConfig != null && nodeKey != null) {
89
+ const linkNode = editor.getEditorState().read(() => {
90
+ const node = $getNodeByKey(nodeKey);
91
+ if ($isLinkNode(node)) {
92
+ return node;
93
+ }
94
+ return null;
95
+ });
96
+ if ($isLinkNode(linkNode)) {
97
+ const result = await Promise.resolve(activeEmbedConfig.parseUrl(linkNode.__url));
98
+ if (result != null) {
99
+ editor.update(() => {
100
+ if (!$getSelection()) {
101
+ linkNode.selectEnd();
102
+ }
103
+ activeEmbedConfig.insertNode(editor, result);
104
+ if (linkNode.isAttached()) {
105
+ linkNode.remove();
106
+ }
107
+ });
108
+ }
109
+ }
110
+ }
111
+ }, [activeEmbedConfig, editor, nodeKey]);
112
+ const options = useMemo(() => {
113
+ return activeEmbedConfig != null && nodeKey != null ? getMenuOptions(activeEmbedConfig, embedLinkViaActiveEmbedConfig, reset) : [];
114
+ }, [activeEmbedConfig, embedLinkViaActiveEmbedConfig, getMenuOptions, nodeKey, reset]);
115
+ const onSelectOption = useCallback((selectedOption, targetNode, closeMenu) => {
116
+ editor.update(() => {
117
+ selectedOption.onSelect(targetNode);
118
+ closeMenu();
119
+ });
120
+ }, [editor]);
121
+ return nodeKey != null ? /*#__PURE__*/React.createElement(LexicalNodeMenuPlugin, {
122
+ nodeKey: nodeKey,
123
+ onClose: reset,
124
+ onSelectOption: onSelectOption,
125
+ options: options,
126
+ menuRenderFn: menuRenderFn,
127
+ commandPriority: menuCommandPriority
128
+ }) : null;
129
+ }
130
+
131
+ export { AutoEmbedOption, INSERT_EMBED_COMMAND, LexicalAutoEmbedPlugin, URL_MATCHER };
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ import * as modDev from './LexicalAutoEmbedPlugin.dev.esm.js';
8
+ import * as modProd from './LexicalAutoEmbedPlugin.prod.esm.js';
9
+ const mod = process.env.NODE_ENV === 'development' ? modDev : modProd;
10
+ export const AutoEmbedOption = mod.AutoEmbedOption;
11
+ export const INSERT_EMBED_COMMAND = mod.INSERT_EMBED_COMMAND;
12
+ export const LexicalAutoEmbedPlugin = mod.LexicalAutoEmbedPlugin;
13
+ export const URL_MATCHER = mod.URL_MATCHER;
@@ -5,5 +5,5 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  'use strict'
8
- const LexicalAutoEmbedPlugin = process.env.NODE_ENV === 'development' ? require('./LexicalAutoEmbedPlugin.dev.js') : require('./LexicalAutoEmbedPlugin.prod.js')
8
+ const LexicalAutoEmbedPlugin = process.env.NODE_ENV === 'development' ? require('./LexicalAutoEmbedPlugin.dev.js') : require('./LexicalAutoEmbedPlugin.prod.js');
9
9
  module.exports = LexicalAutoEmbedPlugin;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ 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()=>{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()=>{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};
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
8
+ import { useEffect } from 'react';
9
+
10
+ /**
11
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
12
+ *
13
+ * This source code is licensed under the MIT license found in the
14
+ * LICENSE file in the root directory of this source tree.
15
+ *
16
+ */
17
+ function AutoFocusPlugin({
18
+ defaultSelection
19
+ }) {
20
+ const [editor] = useLexicalComposerContext();
21
+ useEffect(() => {
22
+ editor.focus(() => {
23
+ // If we try and move selection to the same point with setBaseAndExtent, it won't
24
+ // trigger a re-focus on the element. So in the case this occurs, we'll need to correct it.
25
+ // Normally this is fine, Selection API !== Focus API, but fore the intents of the naming
26
+ // of this plugin, which should preserve focus too.
27
+ const activeElement = document.activeElement;
28
+ const rootElement = editor.getRootElement();
29
+ if (rootElement !== null && (activeElement === null || !rootElement.contains(activeElement))) {
30
+ // Note: preventScroll won't work in Webkit.
31
+ rootElement.focus({
32
+ preventScroll: true
33
+ });
34
+ }
35
+ }, {
36
+ defaultSelection
37
+ });
38
+ }, [defaultSelection, editor]);
39
+ return null;
40
+ }
41
+
42
+ export { AutoFocusPlugin };
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ import * as modDev from './LexicalAutoFocusPlugin.dev.esm.js';
8
+ import * as modProd from './LexicalAutoFocusPlugin.prod.esm.js';
9
+ const mod = process.env.NODE_ENV === 'development' ? modDev : modProd;
10
+ export const AutoFocusPlugin = mod.AutoFocusPlugin;
@@ -5,5 +5,5 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  'use strict'
8
- const LexicalAutoFocusPlugin = process.env.NODE_ENV === 'development' ? require('./LexicalAutoFocusPlugin.dev.js') : require('./LexicalAutoFocusPlugin.prod.js')
8
+ const LexicalAutoFocusPlugin = process.env.NODE_ENV === 'development' ? require('./LexicalAutoFocusPlugin.dev.js') : require('./LexicalAutoFocusPlugin.prod.js');
9
9
  module.exports = LexicalAutoFocusPlugin;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ 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};
@@ -0,0 +1,312 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ import { AutoLinkNode, $isAutoLinkNode, $isLinkNode, $createAutoLinkNode } from '@lexical/link';
8
+ import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
9
+ import { mergeRegister } from '@lexical/utils';
10
+ import { TextNode, $isTextNode, $isLineBreakNode, $isElementNode, $createTextNode, $getSelection, $isRangeSelection, $isNodeSelection } from 'lexical';
11
+ import { useEffect } from 'react';
12
+
13
+ /**
14
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
15
+ *
16
+ * This source code is licensed under the MIT license found in the
17
+ * LICENSE file in the root directory of this source tree.
18
+ *
19
+ */
20
+ function createLinkMatcherWithRegExp(regExp, urlTransformer = text => text) {
21
+ return text => {
22
+ const match = regExp.exec(text);
23
+ if (match === null) {
24
+ return null;
25
+ }
26
+ return {
27
+ index: match.index,
28
+ length: match[0].length,
29
+ text: match[0],
30
+ url: urlTransformer(match[0])
31
+ };
32
+ };
33
+ }
34
+ function findFirstMatch(text, matchers) {
35
+ for (let i = 0; i < matchers.length; i++) {
36
+ const match = matchers[i](text);
37
+ if (match) {
38
+ return match;
39
+ }
40
+ }
41
+ return null;
42
+ }
43
+ const PUNCTUATION_OR_SPACE = /[.,;\s]/;
44
+ function isSeparator(char) {
45
+ return PUNCTUATION_OR_SPACE.test(char);
46
+ }
47
+ function endsWithSeparator(textContent) {
48
+ return isSeparator(textContent[textContent.length - 1]);
49
+ }
50
+ function startsWithSeparator(textContent) {
51
+ return isSeparator(textContent[0]);
52
+ }
53
+ function isPreviousNodeValid(node) {
54
+ let previousNode = node.getPreviousSibling();
55
+ if ($isElementNode(previousNode)) {
56
+ previousNode = previousNode.getLastDescendant();
57
+ }
58
+ return previousNode === null || $isLineBreakNode(previousNode) || $isTextNode(previousNode) && endsWithSeparator(previousNode.getTextContent());
59
+ }
60
+ function isNextNodeValid(node) {
61
+ let nextNode = node.getNextSibling();
62
+ if ($isElementNode(nextNode)) {
63
+ nextNode = nextNode.getFirstDescendant();
64
+ }
65
+ return nextNode === null || $isLineBreakNode(nextNode) || $isTextNode(nextNode) && startsWithSeparator(nextNode.getTextContent());
66
+ }
67
+ function isContentAroundIsValid(matchStart, matchEnd, text, nodes) {
68
+ const contentBeforeIsValid = matchStart > 0 ? isSeparator(text[matchStart - 1]) : isPreviousNodeValid(nodes[0]);
69
+ if (!contentBeforeIsValid) {
70
+ return false;
71
+ }
72
+ const contentAfterIsValid = matchEnd < text.length ? isSeparator(text[matchEnd]) : isNextNodeValid(nodes[nodes.length - 1]);
73
+ return contentAfterIsValid;
74
+ }
75
+ function extractMatchingNodes(nodes, startIndex, endIndex) {
76
+ const unmodifiedBeforeNodes = [];
77
+ const matchingNodes = [];
78
+ const unmodifiedAfterNodes = [];
79
+ let matchingOffset = 0;
80
+ let currentOffset = 0;
81
+ const currentNodes = [...nodes];
82
+ while (currentNodes.length > 0) {
83
+ const currentNode = currentNodes[0];
84
+ const currentNodeText = currentNode.getTextContent();
85
+ const currentNodeLength = currentNodeText.length;
86
+ const currentNodeStart = currentOffset;
87
+ const currentNodeEnd = currentOffset + currentNodeLength;
88
+ if (currentNodeEnd <= startIndex) {
89
+ unmodifiedBeforeNodes.push(currentNode);
90
+ matchingOffset += currentNodeLength;
91
+ } else if (currentNodeStart >= endIndex) {
92
+ unmodifiedAfterNodes.push(currentNode);
93
+ } else {
94
+ matchingNodes.push(currentNode);
95
+ }
96
+ currentOffset += currentNodeLength;
97
+ currentNodes.shift();
98
+ }
99
+ return [matchingOffset, unmodifiedBeforeNodes, matchingNodes, unmodifiedAfterNodes];
100
+ }
101
+ function createAutoLinkNode(nodes, startIndex, endIndex, match) {
102
+ const linkNode = $createAutoLinkNode(match.url, match.attributes);
103
+ if (nodes.length === 1) {
104
+ let remainingTextNode = nodes[0];
105
+ let linkTextNode;
106
+ if (startIndex === 0) {
107
+ [linkTextNode, remainingTextNode] = remainingTextNode.splitText(endIndex);
108
+ } else {
109
+ [, linkTextNode, remainingTextNode] = remainingTextNode.splitText(startIndex, endIndex);
110
+ }
111
+ const textNode = $createTextNode(match.text);
112
+ textNode.setFormat(linkTextNode.getFormat());
113
+ textNode.setDetail(linkTextNode.getDetail());
114
+ linkNode.append(textNode);
115
+ linkTextNode.replace(linkNode);
116
+ return remainingTextNode;
117
+ } else if (nodes.length > 1) {
118
+ const firstTextNode = nodes[0];
119
+ let offset = firstTextNode.getTextContent().length;
120
+ let firstLinkTextNode;
121
+ if (startIndex === 0) {
122
+ firstLinkTextNode = firstTextNode;
123
+ } else {
124
+ [, firstLinkTextNode] = firstTextNode.splitText(startIndex);
125
+ }
126
+ const linkNodes = [];
127
+ let remainingTextNode;
128
+ for (let i = 1; i < nodes.length; i++) {
129
+ const currentNode = nodes[i];
130
+ const currentNodeText = currentNode.getTextContent();
131
+ const currentNodeLength = currentNodeText.length;
132
+ const currentNodeStart = offset;
133
+ const currentNodeEnd = offset + currentNodeLength;
134
+ if (currentNodeStart < endIndex) {
135
+ if (currentNodeEnd <= endIndex) {
136
+ linkNodes.push(currentNode);
137
+ } else {
138
+ const [linkTextNode, endNode] = currentNode.splitText(endIndex - currentNodeStart);
139
+ linkNodes.push(linkTextNode);
140
+ remainingTextNode = endNode;
141
+ }
142
+ }
143
+ offset += currentNodeLength;
144
+ }
145
+ const selection = $getSelection();
146
+ const selectedTextNode = selection ? selection.getNodes().find($isTextNode) : undefined;
147
+ const textNode = $createTextNode(firstLinkTextNode.getTextContent());
148
+ textNode.setFormat(firstLinkTextNode.getFormat());
149
+ textNode.setDetail(firstLinkTextNode.getDetail());
150
+ linkNode.append(textNode, ...linkNodes);
151
+ // it does not preserve caret position if caret was at the first text node
152
+ // so we need to restore caret position
153
+ if (selectedTextNode && selectedTextNode === firstLinkTextNode) {
154
+ if ($isRangeSelection(selection)) {
155
+ textNode.select(selection.anchor.offset, selection.focus.offset);
156
+ } else if ($isNodeSelection(selection)) {
157
+ textNode.select(0, textNode.getTextContent().length);
158
+ }
159
+ }
160
+ firstLinkTextNode.replace(linkNode);
161
+ return remainingTextNode;
162
+ }
163
+ return undefined;
164
+ }
165
+ function handleLinkCreation(nodes, matchers, onChange) {
166
+ let currentNodes = [...nodes];
167
+ const initialText = currentNodes.map(node => node.getTextContent()).join('');
168
+ let text = initialText;
169
+ let match;
170
+ let invalidMatchEnd = 0;
171
+ while ((match = findFirstMatch(text, matchers)) && match !== null) {
172
+ const matchStart = match.index;
173
+ const matchLength = match.length;
174
+ const matchEnd = matchStart + matchLength;
175
+ const isValid = isContentAroundIsValid(invalidMatchEnd + matchStart, invalidMatchEnd + matchEnd, initialText, currentNodes);
176
+ if (isValid) {
177
+ const [matchingOffset,, matchingNodes, unmodifiedAfterNodes] = extractMatchingNodes(currentNodes, invalidMatchEnd + matchStart, invalidMatchEnd + matchEnd);
178
+ const actualMatchStart = invalidMatchEnd + matchStart - matchingOffset;
179
+ const actualMatchEnd = invalidMatchEnd + matchEnd - matchingOffset;
180
+ const remainingTextNode = createAutoLinkNode(matchingNodes, actualMatchStart, actualMatchEnd, match);
181
+ currentNodes = remainingTextNode ? [remainingTextNode, ...unmodifiedAfterNodes] : unmodifiedAfterNodes;
182
+ onChange(match.url, null);
183
+ invalidMatchEnd = 0;
184
+ } else {
185
+ invalidMatchEnd += matchEnd;
186
+ }
187
+ text = text.substring(matchEnd);
188
+ }
189
+ }
190
+ function handleLinkEdit(linkNode, matchers, onChange) {
191
+ // Check children are simple text
192
+ const children = linkNode.getChildren();
193
+ const childrenLength = children.length;
194
+ for (let i = 0; i < childrenLength; i++) {
195
+ const child = children[i];
196
+ if (!$isTextNode(child) || !child.isSimpleText()) {
197
+ replaceWithChildren(linkNode);
198
+ onChange(null, linkNode.getURL());
199
+ return;
200
+ }
201
+ }
202
+
203
+ // Check text content fully matches
204
+ const text = linkNode.getTextContent();
205
+ const match = findFirstMatch(text, matchers);
206
+ if (match === null || match.text !== text) {
207
+ replaceWithChildren(linkNode);
208
+ onChange(null, linkNode.getURL());
209
+ return;
210
+ }
211
+
212
+ // Check neighbors
213
+ if (!isPreviousNodeValid(linkNode) || !isNextNodeValid(linkNode)) {
214
+ replaceWithChildren(linkNode);
215
+ onChange(null, linkNode.getURL());
216
+ return;
217
+ }
218
+ const url = linkNode.getURL();
219
+ if (url !== match.url) {
220
+ linkNode.setURL(match.url);
221
+ onChange(match.url, url);
222
+ }
223
+ if (match.attributes) {
224
+ const rel = linkNode.getRel();
225
+ if (rel !== match.attributes.rel) {
226
+ linkNode.setRel(match.attributes.rel || null);
227
+ onChange(match.attributes.rel || null, rel);
228
+ }
229
+ const target = linkNode.getTarget();
230
+ if (target !== match.attributes.target) {
231
+ linkNode.setTarget(match.attributes.target || null);
232
+ onChange(match.attributes.target || null, target);
233
+ }
234
+ }
235
+ }
236
+
237
+ // Bad neighbors are edits in neighbor nodes that make AutoLinks incompatible.
238
+ // Given the creation preconditions, these can only be simple text nodes.
239
+ function handleBadNeighbors(textNode, matchers, onChange) {
240
+ const previousSibling = textNode.getPreviousSibling();
241
+ const nextSibling = textNode.getNextSibling();
242
+ const text = textNode.getTextContent();
243
+ if ($isAutoLinkNode(previousSibling) && !startsWithSeparator(text)) {
244
+ previousSibling.append(textNode);
245
+ handleLinkEdit(previousSibling, matchers, onChange);
246
+ onChange(null, previousSibling.getURL());
247
+ }
248
+ if ($isAutoLinkNode(nextSibling) && !endsWithSeparator(text)) {
249
+ replaceWithChildren(nextSibling);
250
+ handleLinkEdit(nextSibling, matchers, onChange);
251
+ onChange(null, nextSibling.getURL());
252
+ }
253
+ }
254
+ function replaceWithChildren(node) {
255
+ const children = node.getChildren();
256
+ const childrenLength = children.length;
257
+ for (let j = childrenLength - 1; j >= 0; j--) {
258
+ node.insertAfter(children[j]);
259
+ }
260
+ node.remove();
261
+ return children.map(child => child.getLatest());
262
+ }
263
+ function getTextNodesToMatch(textNode) {
264
+ // check if next siblings are simple text nodes till a node contains a space separator
265
+ const textNodesToMatch = [textNode];
266
+ let nextSibling = textNode.getNextSibling();
267
+ while (nextSibling !== null && $isTextNode(nextSibling) && nextSibling.isSimpleText()) {
268
+ textNodesToMatch.push(nextSibling);
269
+ if (/[\s]/.test(nextSibling.getTextContent())) {
270
+ break;
271
+ }
272
+ nextSibling = nextSibling.getNextSibling();
273
+ }
274
+ return textNodesToMatch;
275
+ }
276
+ function useAutoLink(editor, matchers, onChange) {
277
+ useEffect(() => {
278
+ if (!editor.hasNodes([AutoLinkNode])) {
279
+ {
280
+ throw Error(`LexicalAutoLinkPlugin: AutoLinkNode not registered on editor`);
281
+ }
282
+ }
283
+ const onChangeWrapped = (url, prevUrl) => {
284
+ if (onChange) {
285
+ onChange(url, prevUrl);
286
+ }
287
+ };
288
+ return mergeRegister(editor.registerNodeTransform(TextNode, textNode => {
289
+ const parent = textNode.getParentOrThrow();
290
+ const previous = textNode.getPreviousSibling();
291
+ if ($isAutoLinkNode(parent)) {
292
+ handleLinkEdit(parent, matchers, onChangeWrapped);
293
+ } else if (!$isLinkNode(parent)) {
294
+ if (textNode.isSimpleText() && (startsWithSeparator(textNode.getTextContent()) || !$isAutoLinkNode(previous))) {
295
+ const textNodesToMatch = getTextNodesToMatch(textNode);
296
+ handleLinkCreation(textNodesToMatch, matchers, onChangeWrapped);
297
+ }
298
+ handleBadNeighbors(textNode, matchers, onChangeWrapped);
299
+ }
300
+ }));
301
+ }, [editor, matchers, onChange]);
302
+ }
303
+ function AutoLinkPlugin({
304
+ matchers,
305
+ onChange
306
+ }) {
307
+ const [editor] = useLexicalComposerContext();
308
+ useAutoLink(editor, matchers, onChange);
309
+ return null;
310
+ }
311
+
312
+ export { AutoLinkPlugin, createLinkMatcherWithRegExp };
@@ -22,7 +22,9 @@ var react = require('react');
22
22
  function createLinkMatcherWithRegExp(regExp, urlTransformer = text => text) {
23
23
  return text => {
24
24
  const match = regExp.exec(text);
25
- if (match === null) return null;
25
+ if (match === null) {
26
+ return null;
27
+ }
26
28
  return {
27
29
  index: match.index,
28
30
  length: match[0].length,
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ import * as modDev from './LexicalAutoLinkPlugin.dev.esm.js';
8
+ import * as modProd from './LexicalAutoLinkPlugin.prod.esm.js';
9
+ const mod = process.env.NODE_ENV === 'development' ? modDev : modProd;
10
+ export const AutoLinkPlugin = mod.AutoLinkPlugin;
11
+ export const createLinkMatcherWithRegExp = mod.createLinkMatcherWithRegExp;
@@ -5,5 +5,5 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  'use strict'
8
- const LexicalAutoLinkPlugin = process.env.NODE_ENV === 'development' ? require('./LexicalAutoLinkPlugin.dev.js') : require('./LexicalAutoLinkPlugin.prod.js')
8
+ const LexicalAutoLinkPlugin = process.env.NODE_ENV === 'development' ? require('./LexicalAutoLinkPlugin.dev.js') : require('./LexicalAutoLinkPlugin.prod.js');
9
9
  module.exports = LexicalAutoLinkPlugin;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ 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};