@lexical/react 0.13.0 → 0.14.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 (181) 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.dev.js +0 -5
  7. package/LexicalAutoFocusPlugin.esm.js +10 -0
  8. package/LexicalAutoFocusPlugin.js +1 -1
  9. package/LexicalAutoFocusPlugin.prod.esm.js +7 -0
  10. package/LexicalAutoFocusPlugin.prod.js +1 -1
  11. package/LexicalAutoLinkPlugin.dev.esm.js +312 -0
  12. package/LexicalAutoLinkPlugin.dev.js +3 -1
  13. package/LexicalAutoLinkPlugin.esm.js +11 -0
  14. package/LexicalAutoLinkPlugin.js +1 -1
  15. package/LexicalAutoLinkPlugin.prod.esm.js +7 -0
  16. package/LexicalBlockWithAlignableContents.dev.esm.js +86 -0
  17. package/LexicalBlockWithAlignableContents.dev.js +1 -0
  18. package/LexicalBlockWithAlignableContents.esm.js +10 -0
  19. package/LexicalBlockWithAlignableContents.js +1 -1
  20. package/LexicalBlockWithAlignableContents.prod.esm.js +7 -0
  21. package/LexicalBlockWithAlignableContents.prod.js +1 -1
  22. package/LexicalCharacterLimitPlugin.d.ts +4 -1
  23. package/LexicalCharacterLimitPlugin.dev.esm.js +272 -0
  24. package/LexicalCharacterLimitPlugin.dev.js +12 -4
  25. package/LexicalCharacterLimitPlugin.esm.js +10 -0
  26. package/LexicalCharacterLimitPlugin.js +1 -1
  27. package/LexicalCharacterLimitPlugin.prod.esm.js +7 -0
  28. package/LexicalCharacterLimitPlugin.prod.js +9 -9
  29. package/LexicalCheckListPlugin.dev.esm.js +203 -0
  30. package/LexicalCheckListPlugin.esm.js +10 -0
  31. package/LexicalCheckListPlugin.js +1 -1
  32. package/LexicalCheckListPlugin.prod.esm.js +7 -0
  33. package/LexicalClearEditorPlugin.dev.esm.js +64 -0
  34. package/LexicalClearEditorPlugin.esm.js +10 -0
  35. package/LexicalClearEditorPlugin.js +1 -1
  36. package/LexicalClearEditorPlugin.prod.esm.js +7 -0
  37. package/LexicalClickableLinkPlugin.dev.esm.js +95 -0
  38. package/LexicalClickableLinkPlugin.esm.js +10 -0
  39. package/LexicalClickableLinkPlugin.js +1 -1
  40. package/LexicalClickableLinkPlugin.prod.esm.js +7 -0
  41. package/LexicalCollaborationContext.dev.esm.js +36 -0
  42. package/LexicalCollaborationContext.esm.js +11 -0
  43. package/LexicalCollaborationContext.js +1 -1
  44. package/LexicalCollaborationContext.prod.esm.js +7 -0
  45. package/LexicalCollaborationPlugin.dev.esm.js +308 -0
  46. package/LexicalCollaborationPlugin.esm.js +10 -0
  47. package/LexicalCollaborationPlugin.js +1 -1
  48. package/LexicalCollaborationPlugin.prod.esm.js +7 -0
  49. package/LexicalComposer.dev.esm.js +129 -0
  50. package/LexicalComposer.esm.js +10 -0
  51. package/LexicalComposer.js +1 -1
  52. package/LexicalComposer.prod.esm.js +7 -0
  53. package/LexicalComposerContext.dev.esm.js +42 -0
  54. package/LexicalComposerContext.esm.js +12 -0
  55. package/LexicalComposerContext.js +1 -1
  56. package/LexicalComposerContext.prod.esm.js +7 -0
  57. package/LexicalContentEditable.dev.esm.js +107 -0
  58. package/LexicalContentEditable.dev.js +5 -1
  59. package/LexicalContentEditable.esm.js +10 -0
  60. package/LexicalContentEditable.js +1 -1
  61. package/LexicalContentEditable.prod.esm.js +7 -0
  62. package/LexicalContentEditable.prod.js +3 -3
  63. package/LexicalContextMenuPlugin.dev.esm.js +455 -0
  64. package/LexicalContextMenuPlugin.dev.js +3 -1
  65. package/LexicalContextMenuPlugin.esm.js +11 -0
  66. package/LexicalContextMenuPlugin.js +1 -1
  67. package/LexicalContextMenuPlugin.prod.esm.js +7 -0
  68. package/LexicalDecoratorBlockNode.dev.esm.js +46 -0
  69. package/LexicalDecoratorBlockNode.esm.js +11 -0
  70. package/LexicalDecoratorBlockNode.js +1 -1
  71. package/LexicalDecoratorBlockNode.prod.esm.js +7 -0
  72. package/LexicalEditorRefPlugin.dev.esm.js +40 -0
  73. package/LexicalEditorRefPlugin.dev.js +10 -5
  74. package/LexicalEditorRefPlugin.esm.js +10 -0
  75. package/LexicalEditorRefPlugin.js +1 -1
  76. package/LexicalEditorRefPlugin.prod.esm.js +7 -0
  77. package/LexicalEditorRefPlugin.prod.js +1 -1
  78. package/LexicalErrorBoundary.dev.esm.js +157 -0
  79. package/LexicalErrorBoundary.esm.js +10 -0
  80. package/LexicalErrorBoundary.js +1 -1
  81. package/LexicalErrorBoundary.prod.esm.js +7 -0
  82. package/LexicalHashtagPlugin.dev.esm.js +163 -0
  83. package/LexicalHashtagPlugin.esm.js +10 -0
  84. package/LexicalHashtagPlugin.js +1 -1
  85. package/LexicalHashtagPlugin.prod.esm.js +7 -0
  86. package/LexicalHistoryPlugin.dev.esm.js +41 -0
  87. package/LexicalHistoryPlugin.esm.js +11 -0
  88. package/LexicalHistoryPlugin.js +1 -1
  89. package/LexicalHistoryPlugin.prod.esm.js +7 -0
  90. package/LexicalHorizontalRuleNode.dev.esm.js +118 -0
  91. package/LexicalHorizontalRuleNode.dev.js +1 -0
  92. package/LexicalHorizontalRuleNode.esm.js +13 -0
  93. package/LexicalHorizontalRuleNode.js +1 -1
  94. package/LexicalHorizontalRuleNode.prod.esm.js +7 -0
  95. package/LexicalHorizontalRuleNode.prod.js +1 -1
  96. package/LexicalHorizontalRulePlugin.dev.esm.js +39 -0
  97. package/LexicalHorizontalRulePlugin.esm.js +10 -0
  98. package/LexicalHorizontalRulePlugin.js +1 -1
  99. package/LexicalHorizontalRulePlugin.prod.esm.js +7 -0
  100. package/LexicalLinkPlugin.dev.esm.js +79 -0
  101. package/LexicalLinkPlugin.dev.js +6 -2
  102. package/LexicalLinkPlugin.esm.js +10 -0
  103. package/LexicalLinkPlugin.js +1 -1
  104. package/LexicalLinkPlugin.prod.esm.js +7 -0
  105. package/LexicalLinkPlugin.prod.js +1 -1
  106. package/LexicalListPlugin.dev.esm.js +59 -0
  107. package/LexicalListPlugin.esm.js +10 -0
  108. package/LexicalListPlugin.js +1 -1
  109. package/LexicalListPlugin.prod.esm.js +7 -0
  110. package/LexicalMarkdownShortcutPlugin.dev.esm.js +49 -0
  111. package/LexicalMarkdownShortcutPlugin.esm.js +11 -0
  112. package/LexicalMarkdownShortcutPlugin.js +1 -1
  113. package/LexicalMarkdownShortcutPlugin.prod.esm.js +7 -0
  114. package/LexicalNestedComposer.dev.esm.js +105 -0
  115. package/LexicalNestedComposer.esm.js +10 -0
  116. package/LexicalNestedComposer.js +1 -1
  117. package/LexicalNestedComposer.prod.esm.js +7 -0
  118. package/LexicalNodeEventPlugin.dev.esm.js +56 -0
  119. package/LexicalNodeEventPlugin.esm.js +10 -0
  120. package/LexicalNodeEventPlugin.js +1 -1
  121. package/LexicalNodeEventPlugin.prod.esm.js +7 -0
  122. package/LexicalNodeMenuPlugin.dev.esm.js +466 -0
  123. package/LexicalNodeMenuPlugin.dev.js +3 -1
  124. package/LexicalNodeMenuPlugin.esm.js +11 -0
  125. package/LexicalNodeMenuPlugin.js +1 -1
  126. package/LexicalNodeMenuPlugin.prod.esm.js +7 -0
  127. package/LexicalOnChangePlugin.dev.esm.js +62 -0
  128. package/LexicalOnChangePlugin.esm.js +10 -0
  129. package/LexicalOnChangePlugin.js +1 -1
  130. package/LexicalOnChangePlugin.prod.esm.js +7 -0
  131. package/LexicalPlainTextPlugin.dev.esm.js +161 -0
  132. package/LexicalPlainTextPlugin.esm.js +10 -0
  133. package/LexicalPlainTextPlugin.js +1 -1
  134. package/LexicalPlainTextPlugin.prod.esm.js +7 -0
  135. package/LexicalRichTextPlugin.dev.esm.js +161 -0
  136. package/LexicalRichTextPlugin.esm.js +10 -0
  137. package/LexicalRichTextPlugin.js +1 -1
  138. package/LexicalRichTextPlugin.prod.esm.js +7 -0
  139. package/LexicalTabIndentationPlugin.dev.esm.js +76 -0
  140. package/LexicalTabIndentationPlugin.esm.js +11 -0
  141. package/LexicalTabIndentationPlugin.js +1 -1
  142. package/LexicalTabIndentationPlugin.prod.esm.js +7 -0
  143. package/LexicalTableOfContents.dev.esm.js +157 -0
  144. package/LexicalTableOfContents.esm.js +10 -0
  145. package/LexicalTableOfContents.js +1 -1
  146. package/LexicalTableOfContents.prod.esm.js +7 -0
  147. package/LexicalTablePlugin.dev.esm.js +163 -0
  148. package/LexicalTablePlugin.esm.js +10 -0
  149. package/LexicalTablePlugin.js +1 -1
  150. package/LexicalTablePlugin.prod.esm.js +7 -0
  151. package/LexicalTreeView.dev.esm.js +483 -0
  152. package/LexicalTreeView.dev.js +3 -1
  153. package/LexicalTreeView.esm.js +10 -0
  154. package/LexicalTreeView.js +1 -1
  155. package/LexicalTreeView.prod.esm.js +7 -0
  156. package/LexicalTypeaheadMenuPlugin.dev.esm.js +569 -0
  157. package/LexicalTypeaheadMenuPlugin.dev.js +3 -1
  158. package/LexicalTypeaheadMenuPlugin.esm.js +16 -0
  159. package/LexicalTypeaheadMenuPlugin.js +1 -1
  160. package/LexicalTypeaheadMenuPlugin.prod.esm.js +7 -0
  161. package/package.json +583 -20
  162. package/useLexicalEditable.dev.esm.js +82 -0
  163. package/useLexicalEditable.esm.js +10 -0
  164. package/useLexicalEditable.js +1 -1
  165. package/useLexicalEditable.prod.esm.js +7 -0
  166. package/useLexicalIsTextContentEmpty.dev.esm.js +51 -0
  167. package/useLexicalIsTextContentEmpty.esm.js +10 -0
  168. package/useLexicalIsTextContentEmpty.js +1 -1
  169. package/useLexicalIsTextContentEmpty.prod.esm.js +7 -0
  170. package/useLexicalNodeSelection.dev.esm.js +69 -0
  171. package/useLexicalNodeSelection.esm.js +10 -0
  172. package/useLexicalNodeSelection.js +1 -1
  173. package/useLexicalNodeSelection.prod.esm.js +7 -0
  174. package/useLexicalSubscription.dev.esm.js +63 -0
  175. package/useLexicalSubscription.esm.js +10 -0
  176. package/useLexicalSubscription.js +1 -1
  177. package/useLexicalSubscription.prod.esm.js +7 -0
  178. package/useLexicalTextEntity.dev.esm.js +26 -0
  179. package/useLexicalTextEntity.esm.js +10 -0
  180. package/useLexicalTextEntity.js +1 -1
  181. package/useLexicalTextEntity.prod.esm.js +7 -0
@@ -0,0 +1,40 @@
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 * as React 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
+
18
+ /**
19
+ *
20
+ * Use this plugin to access the editor instance outside of the
21
+ * LexicalComposer. This can help with things like buttons or other
22
+ * UI components that need to update or read EditorState but need to
23
+ * be positioned outside the LexicalComposer in the React tree.
24
+ */
25
+ function EditorRefPlugin({
26
+ editorRef
27
+ }) {
28
+ const [editor] = useLexicalComposerContext();
29
+ React.useEffect(() => {
30
+ if (typeof editorRef === 'function') {
31
+ editorRef(editor);
32
+ } else if (typeof editorRef === 'object') {
33
+ editorRef.current = editor;
34
+ }
35
+ // eslint-disable-next-line react-hooks/exhaustive-deps
36
+ }, [editor]);
37
+ return null;
38
+ }
39
+
40
+ export { EditorRefPlugin };
@@ -7,6 +7,7 @@
7
7
  'use strict';
8
8
 
9
9
  var LexicalComposerContext = require('@lexical/react/LexicalComposerContext');
10
+ var React = require('react');
10
11
 
11
12
  /**
12
13
  * Copyright (c) Meta Platforms, Inc. and affiliates.
@@ -15,6 +16,7 @@ var LexicalComposerContext = require('@lexical/react/LexicalComposerContext');
15
16
  * LICENSE file in the root directory of this source tree.
16
17
  *
17
18
  */
19
+
18
20
  /**
19
21
  *
20
22
  * Use this plugin to access the editor instance outside of the
@@ -26,11 +28,14 @@ function EditorRefPlugin({
26
28
  editorRef
27
29
  }) {
28
30
  const [editor] = LexicalComposerContext.useLexicalComposerContext();
29
- if (typeof editorRef === 'function') {
30
- editorRef(editor);
31
- } else if (typeof editorRef === 'object') {
32
- editorRef.current = editor;
33
- }
31
+ React.useEffect(() => {
32
+ if (typeof editorRef === 'function') {
33
+ editorRef(editor);
34
+ } else if (typeof editorRef === 'object') {
35
+ editorRef.current = editor;
36
+ }
37
+ // eslint-disable-next-line react-hooks/exhaustive-deps
38
+ }, [editor]);
34
39
  return null;
35
40
  }
36
41
 
@@ -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 './LexicalEditorRefPlugin.dev.esm.js';
8
+ import * as modProd from './LexicalEditorRefPlugin.prod.esm.js';
9
+ const mod = process.env.NODE_ENV === 'development' ? modDev : modProd;
10
+ export const EditorRefPlugin = mod.EditorRefPlugin;
@@ -5,5 +5,5 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  'use strict'
8
- const LexicalEditorRefPlugin = process.env.NODE_ENV === 'development' ? require('./LexicalEditorRefPlugin.dev.js') : require('./LexicalEditorRefPlugin.prod.js')
8
+ const LexicalEditorRefPlugin = process.env.NODE_ENV === 'development' ? require('./LexicalEditorRefPlugin.dev.js') : require('./LexicalEditorRefPlugin.prod.js');
9
9
  module.exports = LexicalEditorRefPlugin;
@@ -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 t}from"@lexical/react/LexicalComposerContext";import*as e from"react";function o({editorRef:o}){const[r]=t();return e.useEffect((()=>{"function"==typeof o?o(r):"object"==typeof o&&(o.current=r)}),[r]),null}export{o as EditorRefPlugin};
@@ -4,4 +4,4 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- 'use strict';var c=require("@lexical/react/LexicalComposerContext");exports.EditorRefPlugin=function({editorRef:a}){let [b]=c.useLexicalComposerContext();"function"===typeof a?a(b):"object"===typeof a&&(a.current=b);return null}
7
+ 'use strict';var c=require("@lexical/react/LexicalComposerContext"),d=require("react");exports.EditorRefPlugin=function({editorRef:a}){let [b]=c.useLexicalComposerContext();d.useEffect(()=>{"function"===typeof a?a(b):"object"===typeof a&&(a.current=b)},[b]);return null}
@@ -0,0 +1,157 @@
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 React from 'react';
8
+
9
+ function _setPrototypeOf(o, p) {
10
+ _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
11
+ o.__proto__ = p;
12
+ return o;
13
+ };
14
+ return _setPrototypeOf(o, p);
15
+ }
16
+
17
+ function _inheritsLoose(subClass, superClass) {
18
+ subClass.prototype = Object.create(superClass.prototype);
19
+ subClass.prototype.constructor = subClass;
20
+ _setPrototypeOf(subClass, superClass);
21
+ }
22
+
23
+ var changedArray = function changedArray(a, b) {
24
+ if (a === void 0) {
25
+ a = [];
26
+ }
27
+
28
+ if (b === void 0) {
29
+ b = [];
30
+ }
31
+
32
+ return a.length !== b.length || a.some(function (item, index) {
33
+ return !Object.is(item, b[index]);
34
+ });
35
+ };
36
+
37
+ var initialState = {
38
+ error: null
39
+ };
40
+
41
+ var ErrorBoundary = /*#__PURE__*/function (_React$Component) {
42
+ _inheritsLoose(ErrorBoundary, _React$Component);
43
+
44
+ function ErrorBoundary() {
45
+ var _this;
46
+
47
+ for (var _len = arguments.length, _args = new Array(_len), _key = 0; _key < _len; _key++) {
48
+ _args[_key] = arguments[_key];
49
+ }
50
+
51
+ _this = _React$Component.call.apply(_React$Component, [this].concat(_args)) || this;
52
+ _this.state = initialState;
53
+
54
+ _this.resetErrorBoundary = function () {
55
+ var _this$props;
56
+
57
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
58
+ args[_key2] = arguments[_key2];
59
+ }
60
+
61
+ _this.props.onReset == null ? void 0 : (_this$props = _this.props).onReset.apply(_this$props, args);
62
+
63
+ _this.reset();
64
+ };
65
+
66
+ return _this;
67
+ }
68
+
69
+ ErrorBoundary.getDerivedStateFromError = function getDerivedStateFromError(error) {
70
+ return {
71
+ error: error
72
+ };
73
+ };
74
+
75
+ var _proto = ErrorBoundary.prototype;
76
+
77
+ _proto.reset = function reset() {
78
+ this.setState(initialState);
79
+ };
80
+
81
+ _proto.componentDidCatch = function componentDidCatch(error, info) {
82
+ var _this$props$onError, _this$props2;
83
+
84
+ (_this$props$onError = (_this$props2 = this.props).onError) == null ? void 0 : _this$props$onError.call(_this$props2, error, info);
85
+ };
86
+
87
+ _proto.componentDidUpdate = function componentDidUpdate(prevProps, prevState) {
88
+ var error = this.state.error;
89
+ var resetKeys = this.props.resetKeys; // There's an edge case where if the thing that triggered the error
90
+ // happens to *also* be in the resetKeys array, we'd end up resetting
91
+ // the error boundary immediately. This would likely trigger a second
92
+ // error to be thrown.
93
+ // So we make sure that we don't check the resetKeys on the first call
94
+ // of cDU after the error is set
95
+
96
+ if (error !== null && prevState.error !== null && changedArray(prevProps.resetKeys, resetKeys)) {
97
+ var _this$props$onResetKe, _this$props3;
98
+
99
+ (_this$props$onResetKe = (_this$props3 = this.props).onResetKeysChange) == null ? void 0 : _this$props$onResetKe.call(_this$props3, prevProps.resetKeys, resetKeys);
100
+ this.reset();
101
+ }
102
+ };
103
+
104
+ _proto.render = function render() {
105
+ var error = this.state.error;
106
+ var _this$props4 = this.props,
107
+ fallbackRender = _this$props4.fallbackRender,
108
+ FallbackComponent = _this$props4.FallbackComponent,
109
+ fallback = _this$props4.fallback;
110
+
111
+ if (error !== null) {
112
+ var _props = {
113
+ error: error,
114
+ resetErrorBoundary: this.resetErrorBoundary
115
+ };
116
+
117
+ if ( /*#__PURE__*/React.isValidElement(fallback)) {
118
+ return fallback;
119
+ } else if (typeof fallbackRender === 'function') {
120
+ return fallbackRender(_props);
121
+ } else if (FallbackComponent) {
122
+ return /*#__PURE__*/React.createElement(FallbackComponent, _props);
123
+ } else {
124
+ throw new Error('react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop');
125
+ }
126
+ }
127
+
128
+ return this.props.children;
129
+ };
130
+
131
+ return ErrorBoundary;
132
+ }(React.Component);
133
+
134
+ /**
135
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
136
+ *
137
+ * This source code is licensed under the MIT license found in the
138
+ * LICENSE file in the root directory of this source tree.
139
+ *
140
+ */
141
+ function LexicalErrorBoundary({
142
+ children,
143
+ onError
144
+ }) {
145
+ return /*#__PURE__*/React.createElement(ErrorBoundary, {
146
+ fallback: /*#__PURE__*/React.createElement("div", {
147
+ style: {
148
+ border: '1px solid #f00',
149
+ color: '#f00',
150
+ padding: '8px'
151
+ }
152
+ }, "An error was thrown."),
153
+ onError: onError
154
+ }, children);
155
+ }
156
+
157
+ export { LexicalErrorBoundary as default };
@@ -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 './LexicalErrorBoundary.dev.esm.js';
8
+ import * as modProd from './LexicalErrorBoundary.prod.esm.js';
9
+ const mod = process.env.NODE_ENV === 'development' ? modDev : modProd;
10
+ export default mod.default;
@@ -5,5 +5,5 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  'use strict'
8
- const LexicalErrorBoundary = process.env.NODE_ENV === 'development' ? require('./LexicalErrorBoundary.dev.js') : require('./LexicalErrorBoundary.prod.js')
8
+ const LexicalErrorBoundary = process.env.NODE_ENV === 'development' ? require('./LexicalErrorBoundary.dev.js') : require('./LexicalErrorBoundary.prod.js');
9
9
  module.exports = LexicalErrorBoundary;
@@ -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*as r from"react";function e(r,t){return e=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,e){return r.__proto__=e,r},e(r,t)}var t={error:null},o=function(o){var n,a;function l(){for(var r,e=arguments.length,n=new Array(e),a=0;a<e;a++)n[a]=arguments[a];return(r=o.call.apply(o,[this].concat(n))||this).state=t,r.resetErrorBoundary=function(){for(var e,t=arguments.length,o=new Array(t),n=0;n<t;n++)o[n]=arguments[n];null==r.props.onReset||(e=r.props).onReset.apply(e,o),r.reset()},r}a=o,(n=l).prototype=Object.create(a.prototype),n.prototype.constructor=n,e(n,a),l.getDerivedStateFromError=function(r){return{error:r}};var s=l.prototype;return s.reset=function(){this.setState(t)},s.componentDidCatch=function(r,e){var t,o;null==(t=(o=this.props).onError)||t.call(o,r,e)},s.componentDidUpdate=function(r,e){var t,o,n,a,l=this.state.error,s=this.props.resetKeys;null!==l&&null!==e.error&&(void 0===(n=r.resetKeys)&&(n=[]),void 0===(a=s)&&(a=[]),n.length!==a.length||n.some((function(r,e){return!Object.is(r,a[e])})))&&(null==(t=(o=this.props).onResetKeysChange)||t.call(o,r.resetKeys,s),this.reset())},s.render=function(){var e=this.state.error,t=this.props,o=t.fallbackRender,n=t.FallbackComponent,a=t.fallback;if(null!==e){var l={error:e,resetErrorBoundary:this.resetErrorBoundary};if(r.isValidElement(a))return a;if("function"==typeof o)return o(l);if(n)return r.createElement(n,l);throw new Error("react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop")}return this.props.children},l}(r.Component);function n({children:e,onError:t}){return r.createElement(o,{fallback:r.createElement("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"}},"An error was thrown."),onError:t},e)}export{n as default};
@@ -0,0 +1,163 @@
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 { HashtagNode, $createHashtagNode } from '@lexical/hashtag';
8
+ import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
9
+ import { useLexicalTextEntity } from '@lexical/react/useLexicalTextEntity';
10
+ import { useEffect, useCallback } from 'react';
11
+
12
+ /**
13
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ *
18
+ */
19
+ function getHashtagRegexStringChars() {
20
+ // Latin accented characters
21
+ // Excludes 0xd7 from the range
22
+ // (the multiplication sign, confusable with "x").
23
+ // Also excludes 0xf7, the division sign
24
+ const latinAccents = '\xc0-\xd6' + '\xd8-\xf6' + '\xf8-\xff' + '\u0100-\u024f' + '\u0253-\u0254' + '\u0256-\u0257' + '\u0259' + '\u025b' + '\u0263' + '\u0268' + '\u026f' + '\u0272' + '\u0289' + '\u028b' + '\u02bb' + '\u0300-\u036f' + '\u1e00-\u1eff';
25
+
26
+ // Cyrillic (Russian, Ukrainian, etc.)
27
+ const nonLatinChars = '\u0400-\u04ff' +
28
+ // Cyrillic
29
+ '\u0500-\u0527' +
30
+ // Cyrillic Supplement
31
+ '\u2de0-\u2dff' +
32
+ // Cyrillic Extended A
33
+ '\ua640-\ua69f' +
34
+ // Cyrillic Extended B
35
+ '\u0591-\u05bf' +
36
+ // Hebrew
37
+ '\u05c1-\u05c2' + '\u05c4-\u05c5' + '\u05c7' + '\u05d0-\u05ea' + '\u05f0-\u05f4' + '\ufb12-\ufb28' +
38
+ // Hebrew Presentation Forms
39
+ '\ufb2a-\ufb36' + '\ufb38-\ufb3c' + '\ufb3e' + '\ufb40-\ufb41' + '\ufb43-\ufb44' + '\ufb46-\ufb4f' + '\u0610-\u061a' +
40
+ // Arabic
41
+ '\u0620-\u065f' + '\u066e-\u06d3' + '\u06d5-\u06dc' + '\u06de-\u06e8' + '\u06ea-\u06ef' + '\u06fa-\u06fc' + '\u06ff' + '\u0750-\u077f' +
42
+ // Arabic Supplement
43
+ '\u08a0' +
44
+ // Arabic Extended A
45
+ '\u08a2-\u08ac' + '\u08e4-\u08fe' + '\ufb50-\ufbb1' +
46
+ // Arabic Pres. Forms A
47
+ '\ufbd3-\ufd3d' + '\ufd50-\ufd8f' + '\ufd92-\ufdc7' + '\ufdf0-\ufdfb' + '\ufe70-\ufe74' +
48
+ // Arabic Pres. Forms B
49
+ '\ufe76-\ufefc' + '\u200c-\u200c' +
50
+ // Zero-Width Non-Joiner
51
+ '\u0e01-\u0e3a' +
52
+ // Thai
53
+ '\u0e40-\u0e4e' +
54
+ // Hangul (Korean)
55
+ '\u1100-\u11ff' +
56
+ // Hangul Jamo
57
+ '\u3130-\u3185' +
58
+ // Hangul Compatibility Jamo
59
+ '\uA960-\uA97F' +
60
+ // Hangul Jamo Extended-A
61
+ '\uAC00-\uD7AF' +
62
+ // Hangul Syllables
63
+ '\uD7B0-\uD7FF' +
64
+ // Hangul Jamo Extended-B
65
+ '\uFFA1-\uFFDC'; // Half-width Hangul
66
+
67
+ const charCode = String.fromCharCode;
68
+ const cjkChars = '\u30A1-\u30FA\u30FC-\u30FE' +
69
+ // Katakana (full-width)
70
+ '\uFF66-\uFF9F' +
71
+ // Katakana (half-width)
72
+ '\uFF10-\uFF19\uFF21-\uFF3A' + '\uFF41-\uFF5A' +
73
+ // Latin (full-width)
74
+ '\u3041-\u3096\u3099-\u309E' +
75
+ // Hiragana
76
+ '\u3400-\u4DBF' +
77
+ // Kanji (CJK Extension A)
78
+ '\u4E00-\u9FFF' +
79
+ // Kanji (Unified)
80
+ // Disabled as it breaks the Regex.
81
+ // charCode(0x20000) + '-' + charCode(0x2A6DF) + // Kanji (CJK Extension B)
82
+ charCode(0x2a700) + '-' + charCode(0x2b73f) +
83
+ // Kanji (CJK Extension C)
84
+ charCode(0x2b740) + '-' + charCode(0x2b81f) +
85
+ // Kanji (CJK Extension D)
86
+ charCode(0x2f800) + '-' + charCode(0x2fa1f) + '\u3003\u3005\u303B'; // Kanji (CJK supplement)
87
+
88
+ const otherChars = latinAccents + nonLatinChars + cjkChars;
89
+ // equivalent of \p{L}
90
+
91
+ const unicodeLetters = '\u0041-\u005A\u0061-\u007A\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6' + '\u00F8-\u0241\u0250-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EE\u037A\u0386' + '\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03CE\u03D0-\u03F5\u03F7-\u0481' + '\u048A-\u04CE\u04D0-\u04F9\u0500-\u050F\u0531-\u0556\u0559\u0561-\u0587' + '\u05D0-\u05EA\u05F0-\u05F2\u0621-\u063A\u0640-\u064A\u066E-\u066F' + '\u0671-\u06D3\u06D5\u06E5-\u06E6\u06EE-\u06EF\u06FA-\u06FC\u06FF\u0710' + '\u0712-\u072F\u074D-\u076D\u0780-\u07A5\u07B1\u0904-\u0939\u093D\u0950' + '\u0958-\u0961\u097D\u0985-\u098C\u098F-\u0990\u0993-\u09A8\u09AA-\u09B0' + '\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC-\u09DD\u09DF-\u09E1\u09F0-\u09F1' + '\u0A05-\u0A0A\u0A0F-\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32-\u0A33' + '\u0A35-\u0A36\u0A38-\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D' + '\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2-\u0AB3\u0AB5-\u0AB9\u0ABD' + '\u0AD0\u0AE0-\u0AE1\u0B05-\u0B0C\u0B0F-\u0B10\u0B13-\u0B28\u0B2A-\u0B30' + '\u0B32-\u0B33\u0B35-\u0B39\u0B3D\u0B5C-\u0B5D\u0B5F-\u0B61\u0B71\u0B83' + '\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99-\u0B9A\u0B9C\u0B9E-\u0B9F' + '\u0BA3-\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0C05-\u0C0C\u0C0E-\u0C10' + '\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C60-\u0C61\u0C85-\u0C8C' + '\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE' + '\u0CE0-\u0CE1\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D28\u0D2A-\u0D39' + '\u0D60-\u0D61\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6' + '\u0E01-\u0E30\u0E32-\u0E33\u0E40-\u0E46\u0E81-\u0E82\u0E84\u0E87-\u0E88' + '\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7' + '\u0EAA-\u0EAB\u0EAD-\u0EB0\u0EB2-\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6' + '\u0EDC-\u0EDD\u0F00\u0F40-\u0F47\u0F49-\u0F6A\u0F88-\u0F8B\u1000-\u1021' + '\u1023-\u1027\u1029-\u102A\u1050-\u1055\u10A0-\u10C5\u10D0-\u10FA\u10FC' + '\u1100-\u1159\u115F-\u11A2\u11A8-\u11F9\u1200-\u1248\u124A-\u124D' + '\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0' + '\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310' + '\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C' + '\u166F-\u1676\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711' + '\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7' + '\u17DC\u1820-\u1877\u1880-\u18A8\u1900-\u191C\u1950-\u196D\u1970-\u1974' + '\u1980-\u19A9\u19C1-\u19C7\u1A00-\u1A16\u1D00-\u1DBF\u1E00-\u1E9B' + '\u1EA0-\u1EF9\u1F00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D' + '\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC' + '\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC' + '\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u2094\u2102\u2107' + '\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D' + '\u212F-\u2131\u2133-\u2139\u213C-\u213F\u2145-\u2149\u2C00-\u2C2E' + '\u2C30-\u2C5E\u2C80-\u2CE4\u2D00-\u2D25\u2D30-\u2D65\u2D6F\u2D80-\u2D96' + '\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6' + '\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3006\u3031-\u3035' + '\u303B-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF' + '\u3105-\u312C\u3131-\u318E\u31A0-\u31B7\u31F0-\u31FF\u3400-\u4DB5' + '\u4E00-\u9FBB\uA000-\uA48C\uA800-\uA801\uA803-\uA805\uA807-\uA80A' + '\uA80C-\uA822\uAC00-\uD7A3\uF900-\uFA2D\uFA30-\uFA6A\uFA70-\uFAD9' + '\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C' + '\uFB3E\uFB40-\uFB41\uFB43-\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F' + '\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A' + '\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7' + '\uFFDA-\uFFDC';
92
+
93
+ // equivalent of \p{Mn}\p{Mc}
94
+ const unicodeAccents = '\u0300-\u036F\u0483-\u0486\u0591-\u05B9\u05BB-\u05BD\u05BF' + '\u05C1-\u05C2\u05C4-\u05C5\u05C7\u0610-\u0615\u064B-\u065E\u0670' + '\u06D6-\u06DC\u06DF-\u06E4\u06E7-\u06E8\u06EA-\u06ED\u0711\u0730-\u074A' + '\u07A6-\u07B0\u0901-\u0903\u093C\u093E-\u094D\u0951-\u0954\u0962-\u0963' + '\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7-\u09C8\u09CB-\u09CD\u09D7' + '\u09E2-\u09E3\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47-\u0A48\u0A4B-\u0A4D' + '\u0A70-\u0A71\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD' + '\u0AE2-\u0AE3\u0B01-\u0B03\u0B3C\u0B3E-\u0B43\u0B47-\u0B48\u0B4B-\u0B4D' + '\u0B56-\u0B57\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7' + '\u0C01-\u0C03\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55-\u0C56' + '\u0C82-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5-\u0CD6' + '\u0D02-\u0D03\u0D3E-\u0D43\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D82-\u0D83' + '\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2-\u0DF3\u0E31\u0E34-\u0E3A' + '\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB-\u0EBC\u0EC8-\u0ECD\u0F18-\u0F19' + '\u0F35\u0F37\u0F39\u0F3E-\u0F3F\u0F71-\u0F84\u0F86-\u0F87\u0F90-\u0F97' + '\u0F99-\u0FBC\u0FC6\u102C-\u1032\u1036-\u1039\u1056-\u1059\u135F' + '\u1712-\u1714\u1732-\u1734\u1752-\u1753\u1772-\u1773\u17B6-\u17D3\u17DD' + '\u180B-\u180D\u18A9\u1920-\u192B\u1930-\u193B\u19B0-\u19C0\u19C8-\u19C9' + '\u1A17-\u1A1B\u1DC0-\u1DC3\u20D0-\u20DC\u20E1\u20E5-\u20EB\u302A-\u302F' + '\u3099-\u309A\uA802\uA806\uA80B\uA823-\uA827\uFB1E\uFE00-\uFE0F' + '\uFE20-\uFE23';
95
+
96
+ // equivalent of \p{Dn}
97
+ const unicodeDigits = '\u0030-\u0039\u0660-\u0669\u06F0-\u06F9\u0966-\u096F\u09E6-\u09EF' + '\u0A66-\u0A6F\u0AE6-\u0AEF\u0B66-\u0B6F\u0BE6-\u0BEF\u0C66-\u0C6F' + '\u0CE6-\u0CEF\u0D66-\u0D6F\u0E50-\u0E59\u0ED0-\u0ED9\u0F20-\u0F29' + '\u1040-\u1049\u17E0-\u17E9\u1810-\u1819\u1946-\u194F\u19D0-\u19D9' + '\uFF10-\uFF19';
98
+
99
+ // An alpha char is a unicode chars including unicode marks or
100
+ // letter or char in otherChars range
101
+ const alpha = unicodeLetters + unicodeAccents + otherChars;
102
+
103
+ // A numeric character is any with the number digit property, or
104
+ // underscore. These characters can be included in hashtags, but a hashtag
105
+ // cannot have only these characters.
106
+ const numeric = unicodeDigits + '_';
107
+
108
+ // Alphanumeric char is any alpha char or a unicode char with decimal
109
+ // number property \p{Nd}
110
+ const alphanumeric = alpha + numeric;
111
+ const hashChars = '#\\uFF03'; // normal '#' or full-width '#'
112
+
113
+ return {
114
+ alpha,
115
+ alphanumeric,
116
+ hashChars
117
+ };
118
+ }
119
+ function getHashtagRegexString() {
120
+ const {
121
+ alpha,
122
+ alphanumeric,
123
+ hashChars
124
+ } = getHashtagRegexStringChars();
125
+ const hashtagAlpha = '[' + alpha + ']';
126
+ const hashtagAlphanumeric = '[' + alphanumeric + ']';
127
+ const hashtagBoundary = '^|$|[^&/' + alphanumeric + ']';
128
+ const hashCharList = '[' + hashChars + ']';
129
+
130
+ // A hashtag contains characters, numbers and underscores,
131
+ // but not all numbers.
132
+ const hashtag = '(' + hashtagBoundary + ')(' + hashCharList + ')(' + hashtagAlphanumeric + '*' + hashtagAlpha + hashtagAlphanumeric + '*)';
133
+ return hashtag;
134
+ }
135
+ const REGEX = new RegExp(getHashtagRegexString(), 'i');
136
+ function HashtagPlugin() {
137
+ const [editor] = useLexicalComposerContext();
138
+ useEffect(() => {
139
+ if (!editor.hasNodes([HashtagNode])) {
140
+ throw new Error('HashtagPlugin: HashtagNode not registered on editor');
141
+ }
142
+ }, [editor]);
143
+ const createHashtagNode = useCallback(textNode => {
144
+ return $createHashtagNode(textNode.getTextContent());
145
+ }, []);
146
+ const getHashtagMatch = useCallback(text => {
147
+ const matchArr = REGEX.exec(text);
148
+ if (matchArr === null) {
149
+ return null;
150
+ }
151
+ const hashtagLength = matchArr[3].length + 1;
152
+ const startOffset = matchArr.index + matchArr[1].length;
153
+ const endOffset = startOffset + hashtagLength;
154
+ return {
155
+ end: endOffset,
156
+ start: startOffset
157
+ };
158
+ }, []);
159
+ useLexicalTextEntity(getHashtagMatch, HashtagNode, createHashtagNode);
160
+ return null;
161
+ }
162
+
163
+ export { HashtagPlugin };
@@ -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 './LexicalHashtagPlugin.dev.esm.js';
8
+ import * as modProd from './LexicalHashtagPlugin.prod.esm.js';
9
+ const mod = process.env.NODE_ENV === 'development' ? modDev : modProd;
10
+ export const HashtagPlugin = mod.HashtagPlugin;
@@ -5,5 +5,5 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  'use strict'
8
- const LexicalHashtagPlugin = process.env.NODE_ENV === 'development' ? require('./LexicalHashtagPlugin.dev.js') : require('./LexicalHashtagPlugin.prod.js')
8
+ const LexicalHashtagPlugin = process.env.NODE_ENV === 'development' ? require('./LexicalHashtagPlugin.dev.js') : require('./LexicalHashtagPlugin.prod.js');
9
9
  module.exports = LexicalHashtagPlugin;
@@ -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{HashtagNode as t,$createHashtagNode as e}from"@lexical/hashtag";import{useLexicalComposerContext as r}from"@lexical/react/LexicalComposerContext";import{useLexicalTextEntity as n}from"@lexical/react/useLexicalTextEntity";import{useEffect as o,useCallback as a}from"react";const i=new RegExp(function(){const{alpha:t,alphanumeric:e,hashChars:r}=function(){const t=String.fromCharCode,e="A-Za-zªµºÀ-ÖØ-öø-Ɂɐ-ˁˆ-ˑˠ-ˤˮͺΆΈ-ΊΌΎ-ΡΣ-ώϐ-ϵϷ-ҁҊ-ӎӐ-ӹԀ-ԏԱ-Ֆՙա-ևא-תװ-ײء-غـ-يٮ-ٯٱ-ۓەۥ-ۦۮ-ۯۺ-ۼۿܐܒ-ܯݍ-ݭހ-ޥޱऄ-हऽॐक़-ॡॽঅ-ঌএ-ঐও-নপ-রলশ-হঽৎড়-ঢ়য়-ৡৰ-ৱਅ-ਊਏ-ਐਓ-ਨਪ-ਰਲ-ਲ਼ਵ-ਸ਼ਸ-ਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલ-ળવ-હઽૐૠ-ૡଅ-ଌଏ-ଐଓ-ନପ-ରଲ-ଳଵ-ହଽଡ଼-ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கங-சஜஞ-டண-தந-பம-ஹఅ-ఌఎ-ఐఒ-నప-ళవ-హౠ-ౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠ-ೡഅ-ഌഎ-ഐഒ-നപ-ഹൠ-ൡඅ-ඖක-නඳ-රලව-ෆก-ะา-ำเ-ๆກ-ຂຄງ-ຈຊຍດ-ທນ-ຟມ-ຣລວສ-ຫອ-ະາ-ຳຽເ-ໄໆໜ-ໝༀཀ-ཇཉ-ཪྈ-ྋက-အဣ-ဧဩ-ဪၐ-ၕႠ-Ⴥა-ჺჼᄀ-ᅙᅟ-ᆢᆨ-ᇹሀ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙶᚁ-ᚚᚠ-ᛪᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᤀ-ᤜᥐ-ᥭᥰ-ᥴᦀ-ᦩᧁ-ᧇᨀ-ᨖᴀ-ᶿḀ-ẛẠ-ỹἀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₔℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℱℳ-ℹℼ-ℿⅅ-ⅉⰀ-Ⱞⰰ-ⱞⲀ-ⳤⴀ-ⴥⴰ-ⵥⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〆〱-〵〻-〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄬㄱ-ㆎㆠ-ㆷㇰ-ㇿ㐀-䶵一-龻ꀀ-ꒌꠀ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢ가-힣豈-鶴侮-頻並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּ-סּףּ-פּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ̀-ͯ҃-֑҆-ֹֻ-ֽֿׁ-ׂׄ-ׇׅؐ-ًؕ-ٰٞۖ-ۜ۟-ۤۧ-۪ۨ-ܑۭܰ-݊ަ-ްँ-ः़ा-्॑-॔ॢ-ॣঁ-ঃ়া-ৄে-ৈো-্ৗৢ-ৣਁ-ਃ਼ਾ-ੂੇ-ੈੋ-੍ੰ-ੱઁ-ઃ઼ા-ૅે-ૉો-્ૢ-ૣଁ-ଃ଼ା-ୃେ-ୈୋ-୍ୖ-ୗஂா-ூெ-ைொ-்ௗఁ-ఃా-ౄె-ైొ-్ౕ-ౖಂ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕ-ೖം-ഃാ-ൃെ-ൈൊ-്ൗං-ඃ්ා-ුූෘ-ෟෲ-ෳัิ-ฺ็-๎ັິ-ູົ-ຼ່-ໍ༘-༹༙༵༷༾-༿ཱ-྄྆-྇ྐ-ྗྙ-ྼ࿆ာ-ဲံ-္ၖ-ၙ፟ᜒ-᜔ᜲ-᜴ᝒ-ᝓᝲ-ᝳា-៓៝᠋-᠍ᢩᤠ-ᤫᤰ-᤻ᦰ-ᧀᧈ-ᧉᨗ-ᨛ᷀-᷃⃐-⃥⃜⃡-⃫〪-゙〯-゚ꠂ꠆ꠋꠣ-ꠧﬞ︀-️︠-︣À-ÖØ-öø-ÿĀ-ɏɓ-ɔɖ-ɗəɛɣɨɯɲʉʋʻ̀-ͯḀ-ỿЀ-ӿԀ-ԧⷠ-ⷿꙀ-֑ꚟ-ֿׁ-ׂׄ-ׇׅא-תװ-״﬒-ﬨשׁ-זּטּ-לּמּנּ-סּףּ-פּצּ-ﭏؐ-ؚؠ-ٟٮ-ۓە-ۜ۞-۪ۨ-ۯۺ-ۼۿݐ-ݿࢠࢢ-ࢬࣤ-ࣾﭐ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼ‌-‌ก-ฺเ-๎ᄀ-ᇿ㄰-ㆅꥠ-꥿가-힯ힰ-퟿ᄀ-ᅵァ-ヺー-ヾヲ-゚0-9A-Za-zぁ-ゖ゙-ゞ㐀-䶿一-鿿"+t(173824)+"-"+t(177983)+t(177984)+"-"+t(178207)+t(194560)+"-"+t(195103)+"〃々〻";return{alpha:e,alphanumeric:e+"0-9٠-٩۰-۹०-९০-৯੦-੯૦-૯୦-୯௦-௯౦-౯೦-೯൦-൯๐-๙໐-໙༠-༩၀-၉០-៩᠐-᠙᥆-᥏᧐-᧙0-9_",hashChars:"#\\uFF03"}}(),n="["+e+"]";return"("+("^|$|[^&/"+e+"]")+")("+("["+r+"]")+")("+n+"*"+("["+t+"]")+n+"*)"}(),"i");function c(){const[c]=r();o((()=>{if(!c.hasNodes([t]))throw new Error("HashtagPlugin: HashtagNode not registered on editor")}),[c]);const l=a((t=>e(t.getTextContent())),[]),s=a((t=>{const e=i.exec(t);if(null===e)return null;const r=e[3].length+1,n=e.index+e[1].length;return{end:n+r,start:n}}),[]);return n(s,t,l),null}export{c as HashtagPlugin};
@@ -0,0 +1,41 @@
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 { createEmptyHistoryState, registerHistory } from '@lexical/history';
9
+ export { createEmptyHistoryState } from '@lexical/history';
10
+ import { useMemo, useEffect } from 'react';
11
+
12
+ /**
13
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ *
18
+ */
19
+ function useHistory(editor, externalHistoryState, delay = 1000) {
20
+ const historyState = useMemo(() => externalHistoryState || createEmptyHistoryState(), [externalHistoryState]);
21
+ useEffect(() => {
22
+ return registerHistory(editor, historyState, delay);
23
+ }, [delay, editor, historyState]);
24
+ }
25
+
26
+ /**
27
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
28
+ *
29
+ * This source code is licensed under the MIT license found in the
30
+ * LICENSE file in the root directory of this source tree.
31
+ *
32
+ */
33
+ function HistoryPlugin({
34
+ externalHistoryState
35
+ }) {
36
+ const [editor] = useLexicalComposerContext();
37
+ useHistory(editor, externalHistoryState);
38
+ return null;
39
+ }
40
+
41
+ export { HistoryPlugin };
@@ -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 './LexicalHistoryPlugin.dev.esm.js';
8
+ import * as modProd from './LexicalHistoryPlugin.prod.esm.js';
9
+ const mod = process.env.NODE_ENV === 'development' ? modDev : modProd;
10
+ export const HistoryPlugin = mod.HistoryPlugin;
11
+ export const createEmptyHistoryState = mod.createEmptyHistoryState;
@@ -5,5 +5,5 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  'use strict'
8
- const LexicalHistoryPlugin = process.env.NODE_ENV === 'development' ? require('./LexicalHistoryPlugin.dev.js') : require('./LexicalHistoryPlugin.prod.js')
8
+ const LexicalHistoryPlugin = process.env.NODE_ENV === 'development' ? require('./LexicalHistoryPlugin.dev.js') : require('./LexicalHistoryPlugin.prod.js');
9
9
  module.exports = LexicalHistoryPlugin;
@@ -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 t}from"@lexical/react/LexicalComposerContext";import{createEmptyHistoryState as o,registerHistory as r}from"@lexical/history";export{createEmptyHistoryState}from"@lexical/history";import{useMemo as e,useEffect as i}from"react";function c({externalHistoryState:c}){const[a]=t();return function(t,c,a=1e3){const l=e((()=>c||o()),[c]);i((()=>r(t,l,a)),[a,t,l])}(a,c),null}export{c as HistoryPlugin};