@mx-space/cli 0.1.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 (190) hide show
  1. package/LICENSE +33 -0
  2. package/README.md +375 -0
  3. package/ROADMAP.md +42 -0
  4. package/bin/mxs.cjs +40 -0
  5. package/dist/Lexical.dev-DpU35QTu.mjs +10992 -0
  6. package/dist/Lexical.dev-DpU35QTu.mjs.map +1 -0
  7. package/dist/Lexical.node-gYNDt_p9.mjs +247 -0
  8. package/dist/Lexical.node-gYNDt_p9.mjs.map +1 -0
  9. package/dist/Lexical.prod-t4c3bHV3.mjs +5579 -0
  10. package/dist/Lexical.prod-t4c3bHV3.mjs.map +1 -0
  11. package/dist/LexicalClipboard.dev-CdeeWCIq.mjs +496 -0
  12. package/dist/LexicalClipboard.dev-CdeeWCIq.mjs.map +1 -0
  13. package/dist/LexicalClipboard.node-0e9GBL1g.mjs +26 -0
  14. package/dist/LexicalClipboard.node-0e9GBL1g.mjs.map +1 -0
  15. package/dist/LexicalClipboard.prod-CsCWYmV7.mjs +293 -0
  16. package/dist/LexicalClipboard.prod-CsCWYmV7.mjs.map +1 -0
  17. package/dist/LexicalCodeCore.dev-haI2cqH8.mjs +539 -0
  18. package/dist/LexicalCodeCore.dev-haI2cqH8.mjs.map +1 -0
  19. package/dist/LexicalCodeCore.prod-D_k7zuE5.mjs +383 -0
  20. package/dist/LexicalCodeCore.prod-D_k7zuE5.mjs.map +1 -0
  21. package/dist/LexicalDragon.dev-CAggdFh_.mjs +90 -0
  22. package/dist/LexicalDragon.dev-CAggdFh_.mjs.map +1 -0
  23. package/dist/LexicalDragon.node-QMR_wqJg.mjs +15 -0
  24. package/dist/LexicalDragon.node-QMR_wqJg.mjs.map +1 -0
  25. package/dist/LexicalDragon.prod-OssQhwS-.mjs +61 -0
  26. package/dist/LexicalDragon.prod-OssQhwS-.mjs.map +1 -0
  27. package/dist/LexicalExtension.dev-CtDZiMCU.mjs +1665 -0
  28. package/dist/LexicalExtension.dev-CtDZiMCU.mjs.map +1 -0
  29. package/dist/LexicalExtension.node-BM0gh8zu.mjs +51 -0
  30. package/dist/LexicalExtension.node-BM0gh8zu.mjs.map +1 -0
  31. package/dist/LexicalExtension.prod-Ug6emhEO.mjs +971 -0
  32. package/dist/LexicalExtension.prod-Ug6emhEO.mjs.map +1 -0
  33. package/dist/LexicalHeadless.dev-D4yQpl_s.mjs +45 -0
  34. package/dist/LexicalHeadless.dev-D4yQpl_s.mjs.map +1 -0
  35. package/dist/LexicalHeadless.prod-jeN65B3k.mjs +31 -0
  36. package/dist/LexicalHeadless.prod-jeN65B3k.mjs.map +1 -0
  37. package/dist/LexicalHtml.dev-BdU1_ITQ.mjs +686 -0
  38. package/dist/LexicalHtml.dev-BdU1_ITQ.mjs.map +1 -0
  39. package/dist/LexicalHtml.node-DLtAh00E.mjs +26 -0
  40. package/dist/LexicalHtml.node-DLtAh00E.mjs.map +1 -0
  41. package/dist/LexicalHtml.prod-DdLE1HHT.mjs +432 -0
  42. package/dist/LexicalHtml.prod-DdLE1HHT.mjs.map +1 -0
  43. package/dist/LexicalLink.dev-DK87Biuy.mjs +1084 -0
  44. package/dist/LexicalLink.dev-DK87Biuy.mjs.map +1 -0
  45. package/dist/LexicalLink.prod-fssuv6Sf.mjs +717 -0
  46. package/dist/LexicalLink.prod-fssuv6Sf.mjs.map +1 -0
  47. package/dist/LexicalList.dev-BJ4dr_rk.mjs +1352 -0
  48. package/dist/LexicalList.dev-BJ4dr_rk.mjs.map +1 -0
  49. package/dist/LexicalList.prod-jWBbaWfi.mjs +841 -0
  50. package/dist/LexicalList.prod-jWBbaWfi.mjs.map +1 -0
  51. package/dist/LexicalMarkdown.dev-C8e-eh6y.mjs +1207 -0
  52. package/dist/LexicalMarkdown.dev-C8e-eh6y.mjs.map +1 -0
  53. package/dist/LexicalMarkdown.prod-k73tZVb2.mjs +756 -0
  54. package/dist/LexicalMarkdown.prod-k73tZVb2.mjs.map +1 -0
  55. package/dist/LexicalRichText.dev-CrSqq3K-.mjs +645 -0
  56. package/dist/LexicalRichText.dev-CrSqq3K-.mjs.map +1 -0
  57. package/dist/LexicalRichText.node-B7k7wlQz.mjs +106 -0
  58. package/dist/LexicalRichText.node-B7k7wlQz.mjs.map +1 -0
  59. package/dist/LexicalRichText.prod-CqvyxQ9m.mjs +429 -0
  60. package/dist/LexicalRichText.prod-CqvyxQ9m.mjs.map +1 -0
  61. package/dist/LexicalSelection.dev-sNOHKHe_.mjs +725 -0
  62. package/dist/LexicalSelection.dev-sNOHKHe_.mjs.map +1 -0
  63. package/dist/LexicalSelection.node-Di7GwBCZ.mjs +38 -0
  64. package/dist/LexicalSelection.node-Di7GwBCZ.mjs.map +1 -0
  65. package/dist/LexicalSelection.prod-SWllPJop.mjs +388 -0
  66. package/dist/LexicalSelection.prod-SWllPJop.mjs.map +1 -0
  67. package/dist/LexicalTable.dev-CQkLHXJx.mjs +3262 -0
  68. package/dist/LexicalTable.dev-CQkLHXJx.mjs.map +1 -0
  69. package/dist/LexicalTable.prod-BtqCwKSi.mjs +2218 -0
  70. package/dist/LexicalTable.prod-BtqCwKSi.mjs.map +1 -0
  71. package/dist/LexicalUtils.dev-DiUpsXE8.mjs +850 -0
  72. package/dist/LexicalUtils.dev-DiUpsXE8.mjs.map +1 -0
  73. package/dist/LexicalUtils.node-CmK462d1.mjs +66 -0
  74. package/dist/LexicalUtils.node-CmK462d1.mjs.map +1 -0
  75. package/dist/LexicalUtils.prod-bWwV4GAF.mjs +377 -0
  76. package/dist/LexicalUtils.prod-bWwV4GAF.mjs.map +1 -0
  77. package/dist/auth-DIFZzoMm.mjs +211 -0
  78. package/dist/auth-DIFZzoMm.mjs.map +1 -0
  79. package/dist/bin/mxs.d.mts +927 -0
  80. package/dist/bin/mxs.mjs +3249 -0
  81. package/dist/bin/mxs.mjs.map +1 -0
  82. package/dist/chunk-hT5z_Zn9.mjs +35 -0
  83. package/dist/config-store-DIu7x0ao.mjs +121 -0
  84. package/dist/config-store-DIu7x0ao.mjs.map +1 -0
  85. package/dist/create-B2AOQL1e.mjs +24 -0
  86. package/dist/create-B2AOQL1e.mjs.map +1 -0
  87. package/dist/create-CwjGcv2n.mjs +23 -0
  88. package/dist/create-CwjGcv2n.mjs.map +1 -0
  89. package/dist/create-DT1l2hue.mjs +23 -0
  90. package/dist/create-DT1l2hue.mjs.map +1 -0
  91. package/dist/create-DjlRHPXy.mjs +23 -0
  92. package/dist/create-DjlRHPXy.mjs.map +1 -0
  93. package/dist/create-Dz6rJJSS.mjs +19 -0
  94. package/dist/create-Dz6rJJSS.mjs.map +1 -0
  95. package/dist/delete-B4dGrrus.mjs +22 -0
  96. package/dist/delete-B4dGrrus.mjs.map +1 -0
  97. package/dist/delete-BH6ZngTz.mjs +22 -0
  98. package/dist/delete-BH6ZngTz.mjs.map +1 -0
  99. package/dist/delete-BrY5zJ6S.mjs +22 -0
  100. package/dist/delete-BrY5zJ6S.mjs.map +1 -0
  101. package/dist/delete-CaG2d_xt.mjs +31 -0
  102. package/dist/delete-CaG2d_xt.mjs.map +1 -0
  103. package/dist/delete-YzRliRn8.mjs +31 -0
  104. package/dist/delete-YzRliRn8.mjs.map +1 -0
  105. package/dist/document-output-BVB8emLt.mjs +145 -0
  106. package/dist/document-output-BVB8emLt.mjs.map +1 -0
  107. package/dist/edit-Bb0Ze4w6.mjs +79 -0
  108. package/dist/edit-Bb0Ze4w6.mjs.map +1 -0
  109. package/dist/edit-BeFmC3XD.mjs +80 -0
  110. package/dist/edit-BeFmC3XD.mjs.map +1 -0
  111. package/dist/edit-DLDw_ZWX.mjs +86 -0
  112. package/dist/edit-DLDw_ZWX.mjs.map +1 -0
  113. package/dist/edit-z55ofr1S.mjs +40 -0
  114. package/dist/edit-z55ofr1S.mjs.map +1 -0
  115. package/dist/editor-xrF-j3UE.mjs +42 -0
  116. package/dist/editor-xrF-j3UE.mjs.map +1 -0
  117. package/dist/envelope-overlays-DPAlMNW1.mjs +26 -0
  118. package/dist/envelope-overlays-DPAlMNW1.mjs.map +1 -0
  119. package/dist/get-2qjq0wgG.mjs +28 -0
  120. package/dist/get-2qjq0wgG.mjs.map +1 -0
  121. package/dist/get-BGAk1Zmv.mjs +14 -0
  122. package/dist/get-BGAk1Zmv.mjs.map +1 -0
  123. package/dist/get-CRR13lgj.mjs +10 -0
  124. package/dist/get-CRR13lgj.mjs.map +1 -0
  125. package/dist/get-ClkpDBTL.mjs +13 -0
  126. package/dist/get-ClkpDBTL.mjs.map +1 -0
  127. package/dist/get-DJfUJ3sP.mjs +10 -0
  128. package/dist/get-DJfUJ3sP.mjs.map +1 -0
  129. package/dist/get-DiqaQvoS.mjs +14 -0
  130. package/dist/get-DiqaQvoS.mjs.map +1 -0
  131. package/dist/index.d.mts +338 -0
  132. package/dist/index.mjs +10 -0
  133. package/dist/list-BYzhflDg.mjs +14 -0
  134. package/dist/list-BYzhflDg.mjs.map +1 -0
  135. package/dist/list-DY-tPNG-.mjs +10 -0
  136. package/dist/list-DY-tPNG-.mjs.map +1 -0
  137. package/dist/list-DlQSkbqx.mjs +10 -0
  138. package/dist/list-DlQSkbqx.mjs.map +1 -0
  139. package/dist/list-DsrA5wIz.mjs +15 -0
  140. package/dist/list-DsrA5wIz.mjs.map +1 -0
  141. package/dist/list-Fp4nKfQb.mjs +10 -0
  142. package/dist/list-Fp4nKfQb.mjs.map +1 -0
  143. package/dist/list-s_tloiEX.mjs +10 -0
  144. package/dist/list-s_tloiEX.mjs.map +1 -0
  145. package/dist/litexml-codec-CDoRloiR.mjs +13451 -0
  146. package/dist/litexml-codec-CDoRloiR.mjs.map +1 -0
  147. package/dist/login-CLOJ-fTJ.mjs +579 -0
  148. package/dist/login-CLOJ-fTJ.mjs.map +1 -0
  149. package/dist/logout-v8ihxsim.mjs +11 -0
  150. package/dist/logout-v8ihxsim.mjs.map +1 -0
  151. package/dist/onboarding-640IldLz.mjs +888 -0
  152. package/dist/onboarding-640IldLz.mjs.map +1 -0
  153. package/dist/output-BM7aBFwt.mjs +120 -0
  154. package/dist/output-BM7aBFwt.mjs.map +1 -0
  155. package/dist/output-CTnO1lYt.d.mts +16 -0
  156. package/dist/payload-CN11pUto.mjs +547 -0
  157. package/dist/payload-CN11pUto.mjs.map +1 -0
  158. package/dist/publish-DkTYB-eK.mjs +23 -0
  159. package/dist/publish-DkTYB-eK.mjs.map +1 -0
  160. package/dist/publish-pRBfTJfe.mjs +23 -0
  161. package/dist/publish-pRBfTJfe.mjs.map +1 -0
  162. package/dist/resolve-BogJOR7R.mjs +119 -0
  163. package/dist/resolve-BogJOR7R.mjs.map +1 -0
  164. package/dist/resolve-Bp1AfBmM.mjs +26 -0
  165. package/dist/resolve-Bp1AfBmM.mjs.map +1 -0
  166. package/dist/resolve-Bw5Po9yK.mjs +16 -0
  167. package/dist/resolve-Bw5Po9yK.mjs.map +1 -0
  168. package/dist/resolve-CyjMlaoJ.mjs +23 -0
  169. package/dist/resolve-CyjMlaoJ.mjs.map +1 -0
  170. package/dist/resolve-helpers-CahPoJ0Y.mjs +30 -0
  171. package/dist/resolve-helpers-CahPoJ0Y.mjs.map +1 -0
  172. package/dist/set-BEGQz2si.mjs +43 -0
  173. package/dist/set-BEGQz2si.mjs.map +1 -0
  174. package/dist/shared-D0HVBDHI.mjs +39 -0
  175. package/dist/shared-D0HVBDHI.mjs.map +1 -0
  176. package/dist/status-LXrN9fI-.mjs +22 -0
  177. package/dist/status-LXrN9fI-.mjs.map +1 -0
  178. package/dist/update-B9ynFCdZ.mjs +30 -0
  179. package/dist/update-B9ynFCdZ.mjs.map +1 -0
  180. package/dist/update-BMZQPOvR.mjs +28 -0
  181. package/dist/update-BMZQPOvR.mjs.map +1 -0
  182. package/dist/update-BXz0l7Lz.mjs +36 -0
  183. package/dist/update-BXz0l7Lz.mjs.map +1 -0
  184. package/dist/update-Dx6AF8tf.mjs +30 -0
  185. package/dist/update-Dx6AF8tf.mjs.map +1 -0
  186. package/dist/update-q66TLS38.mjs +37 -0
  187. package/dist/update-q66TLS38.mjs.map +1 -0
  188. package/dist/whoami-CTkctOEd.mjs +22 -0
  189. package/dist/whoami-CTkctOEd.mjs.map +1 -0
  190. package/package.json +77 -0
@@ -0,0 +1,496 @@
1
+ import { i as getExtensionDependencyFromEditor, n as LexicalBuilder } from "./LexicalExtension.node-BM0gh8zu.mjs";
2
+ import { $n as safeCast, A as $getCollapsedCaretRange, D as $getChildCaret, Dt as COMMAND_PRIORITY_CRITICAL, H as $getTextPointCaret, Jn as isSelectionWithinEditor, Mn as defineExtension, Mt as COPY_COMMAND, N as $getNearestNodeFromDOMNode, Nn as getDOMSelection, O as $getChildCaretAtIndex, R as $getRoot, T as $getCaretRangeInDirection, Y as $isElementNode, ct as $isTextNode, g as $createTabNode, i as $caretRangeFromSelection, j as $getEditor, lt as $isTextPointCaret, pt as $parseSerializedNode, r as $caretFromPoint, rr as shallowMergeConfig, rt as $isRangeSelection, s as $comparePointCaretNext, vn as SELECTION_INSERT_CLIPBOARD_NODES_COMMAND, w as $getCaretRange, xt as $splitAtPointCaretNext, yt as $setSelectionFromCaretRange, z as $getSelection } from "./Lexical.node-gYNDt_p9.mjs";
3
+ import { n as $generateNodesFromDOM, t as $generateHtmlFromNodes } from "./LexicalHtml.node-DLtAh00E.mjs";
4
+ import { a as $sliceSelectedTextNodeContent, t as $addNodeStyle } from "./LexicalSelection.node-Di7GwBCZ.mjs";
5
+ import { g as objectKlassEquals } from "./LexicalUtils.node-CmK462d1.mjs";
6
+ //#region ../../node_modules/.pnpm/@lexical+clipboard@0.44.0/node_modules/@lexical/clipboard/LexicalClipboard.dev.mjs
7
+ /**
8
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
9
+ *
10
+ * This source code is licensed under the MIT license found in the
11
+ * LICENSE file in the root directory of this source tree.
12
+ *
13
+ */
14
+ /**
15
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
16
+ *
17
+ * This source code is licensed under the MIT license found in the
18
+ * LICENSE file in the root directory of this source tree.
19
+ *
20
+ */
21
+ function formatDevErrorMessage(message) {
22
+ throw new Error(message);
23
+ }
24
+ /**
25
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
26
+ *
27
+ * This source code is licensed under the MIT license found in the
28
+ * LICENSE file in the root directory of this source tree.
29
+ *
30
+ */
31
+ function caretFromPoint(x, y) {
32
+ if (typeof document.caretRangeFromPoint !== "undefined") {
33
+ const range = document.caretRangeFromPoint(x, y);
34
+ if (range === null) return null;
35
+ return {
36
+ node: range.startContainer,
37
+ offset: range.startOffset
38
+ };
39
+ } else if (document.caretPositionFromPoint !== "undefined") {
40
+ const range = document.caretPositionFromPoint(x, y);
41
+ if (range === null) return null;
42
+ return {
43
+ node: range.offsetNode,
44
+ offset: range.offset
45
+ };
46
+ } else return null;
47
+ }
48
+ /**
49
+ * Returns the *currently selected* Lexical content as an HTML string, relying on the
50
+ * logic defined in the exportDOM methods on the LexicalNode classes. Note that
51
+ * this will not return the HTML content of the entire editor (unless all the content is included
52
+ * in the current selection).
53
+ *
54
+ * @param editor - LexicalEditor instance to get HTML content from
55
+ * @param selection - The selection to use (default is $getSelection())
56
+ * @returns a string of HTML content
57
+ */
58
+ function $getHtmlContent(editor, selection = $getSelection()) {
59
+ if (selection == null) formatDevErrorMessage(`Expected valid LexicalSelection`);
60
+ if ($isRangeSelection(selection) && selection.isCollapsed() || selection.getNodes().length === 0) return "";
61
+ return $generateHtmlFromNodes(editor, selection);
62
+ }
63
+ /**
64
+ * Returns the *currently selected* Lexical content as a JSON string, relying on the
65
+ * logic defined in the exportJSON methods on the LexicalNode classes. Note that
66
+ * this will not return the JSON content of the entire editor (unless all the content is included
67
+ * in the current selection).
68
+ *
69
+ * @param editor - LexicalEditor instance to get the JSON content from
70
+ * @param selection - The selection to use (default is $getSelection())
71
+ * @returns
72
+ */
73
+ function $getLexicalContent(editor, selection = $getSelection()) {
74
+ if (selection == null) formatDevErrorMessage(`Expected valid LexicalSelection`);
75
+ if ($isRangeSelection(selection) && selection.isCollapsed() || selection.getNodes().length === 0) return null;
76
+ return JSON.stringify($generateJSONFromSelectedNodes(editor, selection));
77
+ }
78
+ /**
79
+ * Attempts to insert content of the mime-types text/plain or text/uri-list from
80
+ * the provided DataTransfer object into the editor at the provided selection.
81
+ * text/uri-list is only used if text/plain is not also provided.
82
+ *
83
+ * @param dataTransfer an object conforming to the [DataTransfer interface] (https://html.spec.whatwg.org/multipage/dnd.html#the-datatransfer-interface)
84
+ * @param selection the selection to use as the insertion point for the content in the DataTransfer object
85
+ */
86
+ function $insertDataTransferForPlainText(dataTransfer, selection) {
87
+ const text = dataTransfer.getData("text/plain") || dataTransfer.getData("text/uri-list");
88
+ if (text != null) selection.insertRawText(text);
89
+ }
90
+ /**
91
+ * Attempts to insert content of the mime-types application/x-lexical-editor, text/html,
92
+ * text/plain, or text/uri-list (in descending order of priority) from the provided DataTransfer
93
+ * object into the editor at the provided selection.
94
+ *
95
+ * @param dataTransfer an object conforming to the [DataTransfer interface] (https://html.spec.whatwg.org/multipage/dnd.html#the-datatransfer-interface)
96
+ * @param selection the selection to use as the insertion point for the content in the DataTransfer object
97
+ * @param editor the LexicalEditor the content is being inserted into.
98
+ */
99
+ function $insertDataTransferForRichText(dataTransfer, selection, editor) {
100
+ const lexicalString = dataTransfer.getData("application/x-lexical-editor");
101
+ if (lexicalString) try {
102
+ const payload = JSON.parse(lexicalString);
103
+ if (payload.namespace === editor._config.namespace && Array.isArray(payload.nodes)) return $insertGeneratedNodes(editor, $generateNodesFromSerializedNodes(payload.nodes), selection);
104
+ } catch (error) {
105
+ console.error(error);
106
+ }
107
+ const htmlString = dataTransfer.getData("text/html");
108
+ const plainString = dataTransfer.getData("text/plain");
109
+ if (htmlString && plainString !== htmlString) try {
110
+ return $insertGeneratedNodes(editor, $generateNodesFromDOM(editor, new DOMParser().parseFromString(trustHTML(htmlString), "text/html")), selection);
111
+ } catch (error) {
112
+ console.error(error);
113
+ }
114
+ const text = plainString || dataTransfer.getData("text/uri-list");
115
+ if (text != null) if ($isRangeSelection(selection)) {
116
+ const parts = text.split(/(\r?\n|\t)/);
117
+ if (parts[parts.length - 1] === "") parts.pop();
118
+ for (let i = 0; i < parts.length; i++) {
119
+ const currentSelection = $getSelection();
120
+ if ($isRangeSelection(currentSelection)) {
121
+ const part = parts[i];
122
+ if (part === "\n" || part === "\r\n") currentSelection.insertParagraph();
123
+ else if (part === " ") currentSelection.insertNodes([$createTabNode()]);
124
+ else currentSelection.insertText(part);
125
+ }
126
+ }
127
+ } else selection.insertRawText(text);
128
+ }
129
+ const LEXICAL_DRAG_MIME_TYPE = "application/x-lexical-drag";
130
+ /**
131
+ * Populate `dataTransfer` with a marker identifying the current editor as a
132
+ * drag source. Pair this with {@link $handleRichTextDrop} or
133
+ * {@link $handlePlainTextDrop} on the drop side to get cut-and-paste semantics
134
+ * for drags that end in a different editor.
135
+ *
136
+ * Only the source editor's key needs to round-trip — the source's
137
+ * RangeSelection itself is preserved on the source editor between drag start
138
+ * and drop (Lexical suppresses selectionchange during drag), so the drop
139
+ * handler reads it directly via `$getSelection()` on the resolved source
140
+ * editor.
141
+ *
142
+ * Callers typically invoke this from a DRAGSTART_COMMAND handler alongside
143
+ * {@link setLexicalClipboardDataTransfer} (so that the dragged content itself
144
+ * round-trips with full node fidelity).
145
+ */
146
+ function $writeDragSourceToDataTransfer(dataTransfer, editor) {
147
+ const marker = { editorKey: editor.getKey() };
148
+ dataTransfer.setData(LEXICAL_DRAG_MIME_TYPE, JSON.stringify(marker));
149
+ }
150
+ function isLexicalDragMarker(value) {
151
+ return value !== null && typeof value === "object" && "editorKey" in value && typeof value.editorKey === "string";
152
+ }
153
+ function readDragMarker(dataTransfer) {
154
+ const raw = dataTransfer.getData(LEXICAL_DRAG_MIME_TYPE);
155
+ if (!raw) return null;
156
+ let parsed;
157
+ try {
158
+ parsed = JSON.parse(raw);
159
+ } catch (_unused) {
160
+ return null;
161
+ }
162
+ return isLexicalDragMarker(parsed) ? parsed : null;
163
+ }
164
+ function findEditorRootByKey(key, doc) {
165
+ const elements = doc.querySelectorAll("[data-lexical-editor=\"true\"]");
166
+ for (const el of Array.from(elements)) {
167
+ const editor = el.__lexicalEditor;
168
+ if (editor && editor.getKey() === key) return el;
169
+ }
170
+ return null;
171
+ }
172
+ function $resolveDropPointCaret(event) {
173
+ const hit = caretFromPoint(event.clientX, event.clientY);
174
+ if (hit === null) return null;
175
+ const node = $getNearestNodeFromDOMNode(hit.node);
176
+ if (node === null) return null;
177
+ if ($isTextNode(node)) return $getTextPointCaret(node, "next", hit.offset);
178
+ if ($isElementNode(node)) return $getChildCaretAtIndex(node, hit.offset, "next");
179
+ const parent = node.getParent();
180
+ if (parent === null) return null;
181
+ return $getChildCaretAtIndex(parent, node.getIndexWithinParent() + 1, "next");
182
+ }
183
+ function $isDropCaretInsideSelection(dropCaret, selection) {
184
+ const { anchor: start, focus: end } = $getCaretRangeInDirection($caretRangeFromSelection(selection), "next");
185
+ return $comparePointCaretNext(start, dropCaret) < 0 && $comparePointCaretNext(dropCaret, end) < 0;
186
+ }
187
+ function $doDrop(event, editor, $insertDataTransfer) {
188
+ const dataTransfer = event.dataTransfer;
189
+ if (dataTransfer === null) return false;
190
+ const marker = readDragMarker(dataTransfer);
191
+ if (marker === null) return false;
192
+ const dropCaret = $resolveDropPointCaret(event);
193
+ if (dropCaret === null) return false;
194
+ const stableDropCaret = $splitAtPointCaretNext(dropCaret);
195
+ if (stableDropCaret === null) return false;
196
+ const isSameEditorDrag = marker.editorKey === editor.getKey();
197
+ const currentSelection = $getSelection();
198
+ if (isSameEditorDrag) {
199
+ if (!$isRangeSelection(currentSelection) || currentSelection.isCollapsed()) return false;
200
+ if ($isDropCaretInsideSelection(dropCaret, currentSelection)) {
201
+ event.preventDefault();
202
+ return true;
203
+ }
204
+ currentSelection.removeText();
205
+ }
206
+ if (!stableDropCaret.origin.isAttached()) {
207
+ event.preventDefault();
208
+ return true;
209
+ }
210
+ $insertDataTransfer(dataTransfer, $setSelectionFromCaretRange($getCollapsedCaretRange(stableDropCaret)), editor);
211
+ if (!isSameEditorDrag) {
212
+ const rootElement = editor.getRootElement();
213
+ const doc = rootElement ? rootElement.ownerDocument : null;
214
+ const sourceRoot = doc ? findEditorRootByKey(marker.editorKey, doc) : null;
215
+ if (sourceRoot !== null) sourceRoot.dispatchEvent(new InputEvent("beforeinput", {
216
+ bubbles: true,
217
+ cancelable: true,
218
+ inputType: "deleteByDrag"
219
+ }));
220
+ }
221
+ event.preventDefault();
222
+ return true;
223
+ }
224
+ /**
225
+ * Drop handler for rich-text editors. Inserts the DataTransfer payload via
226
+ * {@link $insertDataTransferForRichText} at the drop caret and, when the drag
227
+ * originated from a Lexical editor (marked via
228
+ * {@link $writeDragSourceToDataTransfer} on DRAGSTART), removes the source
229
+ * range — producing cut-and-paste semantics whether the drop is in the same
230
+ * editor or a different one on the same page.
231
+ */
232
+ function $handleRichTextDrop(event, editor) {
233
+ return $doDrop(event, editor, $insertDataTransferForRichText);
234
+ }
235
+ /**
236
+ * Drop handler for plain-text editors. Same semantics as
237
+ * {@link $handleRichTextDrop} but inserts via
238
+ * {@link $insertDataTransferForPlainText}.
239
+ */
240
+ function $handlePlainTextDrop(event, editor) {
241
+ return $doDrop(event, editor, (dataTransfer, selection) => $insertDataTransferForPlainText(dataTransfer, selection));
242
+ }
243
+ function trustHTML(html) {
244
+ if (window.trustedTypes && window.trustedTypes.createPolicy) return window.trustedTypes.createPolicy("lexical", { createHTML: (input) => input }).createHTML(html);
245
+ return html;
246
+ }
247
+ /**
248
+ * Inserts Lexical nodes into the editor using different strategies depending on
249
+ * some simple selection-based heuristics. If you're looking for a generic way to
250
+ * to insert nodes into the editor at a specific selection point, you probably want
251
+ * {@link lexical.$insertNodes}
252
+ *
253
+ * @param editor LexicalEditor instance to insert the nodes into.
254
+ * @param nodes The nodes to insert.
255
+ * @param selection The selection to insert the nodes into.
256
+ */
257
+ function $insertGeneratedNodes(editor, nodes, selection) {
258
+ if (!editor.dispatchCommand(SELECTION_INSERT_CLIPBOARD_NODES_COMMAND, {
259
+ nodes,
260
+ selection
261
+ })) {
262
+ selection.insertNodes(nodes);
263
+ $updateSelectionOnInsert(selection);
264
+ }
265
+ }
266
+ function $updateSelectionOnInsert(selection) {
267
+ if ($isRangeSelection(selection) && selection.isCollapsed()) {
268
+ const anchor = selection.anchor;
269
+ let nodeToInspect = null;
270
+ const anchorCaret = $caretFromPoint(anchor, "previous");
271
+ if (anchorCaret) if ($isTextPointCaret(anchorCaret)) nodeToInspect = anchorCaret.origin;
272
+ else {
273
+ const range = $getCaretRange(anchorCaret, $getChildCaret($getRoot(), "next").getFlipped());
274
+ for (const caret of range) if ($isTextNode(caret.origin)) {
275
+ nodeToInspect = caret.origin;
276
+ break;
277
+ } else if ($isElementNode(caret.origin) && !caret.origin.isInline()) break;
278
+ }
279
+ if (nodeToInspect && $isTextNode(nodeToInspect)) {
280
+ const newFormat = nodeToInspect.getFormat();
281
+ const newStyle = nodeToInspect.getStyle();
282
+ if (selection.format !== newFormat || selection.style !== newStyle) {
283
+ selection.format = newFormat;
284
+ selection.style = newStyle;
285
+ selection.dirty = true;
286
+ }
287
+ }
288
+ }
289
+ }
290
+ function exportNodeToJSON(node) {
291
+ const serializedNode = node.exportJSON();
292
+ const nodeClass = node.constructor;
293
+ if (serializedNode.type !== nodeClass.getType()) formatDevErrorMessage(`LexicalNode: Node ${nodeClass.name} does not implement .exportJSON().`);
294
+ if ($isElementNode(node)) {
295
+ const serializedChildren = serializedNode.children;
296
+ if (!Array.isArray(serializedChildren)) formatDevErrorMessage(`LexicalNode: Node ${nodeClass.name} is an element but .exportJSON() does not have a children array.`);
297
+ }
298
+ return serializedNode;
299
+ }
300
+ function $appendNodesToJSON(editor, selection, currentNode, targetArray = []) {
301
+ let shouldInclude = selection !== null ? currentNode.isSelected(selection) : true;
302
+ const shouldExclude = $isElementNode(currentNode) && currentNode.excludeFromCopy("html");
303
+ let target = currentNode;
304
+ if (selection !== null && $isTextNode(target)) target = $sliceSelectedTextNodeContent(selection, target, "clone");
305
+ const children = $isElementNode(target) ? target.getChildren() : [];
306
+ const serializedNode = exportNodeToJSON(target);
307
+ if ($isTextNode(target) && target.getTextContentSize() === 0) shouldInclude = false;
308
+ for (let i = 0; i < children.length; i++) {
309
+ const childNode = children[i];
310
+ const shouldIncludeChild = $appendNodesToJSON(editor, selection, childNode, serializedNode.children);
311
+ if (!shouldInclude && $isElementNode(currentNode) && shouldIncludeChild && currentNode.extractWithChild(childNode, selection, "clone")) shouldInclude = true;
312
+ }
313
+ if (shouldInclude && !shouldExclude) targetArray.push(serializedNode);
314
+ else if (Array.isArray(serializedNode.children)) for (let i = 0; i < serializedNode.children.length; i++) {
315
+ const serializedChildNode = serializedNode.children[i];
316
+ targetArray.push(serializedChildNode);
317
+ }
318
+ return shouldInclude;
319
+ }
320
+ /**
321
+ * Gets the Lexical JSON of the nodes inside the provided Selection.
322
+ *
323
+ * @param editor LexicalEditor to get the JSON content from.
324
+ * @param selection Selection to get the JSON content from.
325
+ * @returns an object with the editor namespace and a list of serializable nodes as JavaScript objects.
326
+ */
327
+ function $generateJSONFromSelectedNodes(editor, selection) {
328
+ const nodes = [];
329
+ const topLevelChildren = $getRoot().getChildren();
330
+ for (let i = 0; i < topLevelChildren.length; i++) {
331
+ const topLevelNode = topLevelChildren[i];
332
+ $appendNodesToJSON(editor, selection, topLevelNode, nodes);
333
+ }
334
+ return {
335
+ namespace: editor._config.namespace,
336
+ nodes
337
+ };
338
+ }
339
+ /**
340
+ * This method takes an array of objects conforming to the BaseSerializedNode interface and returns
341
+ * an Array containing instances of the corresponding LexicalNode classes registered on the editor.
342
+ * Normally, you'd get an Array of BaseSerialized nodes from {@link $generateJSONFromSelectedNodes}
343
+ *
344
+ * @param serializedNodes an Array of objects conforming to the BaseSerializedNode interface.
345
+ * @returns an Array of Lexical Node objects.
346
+ */
347
+ function $generateNodesFromSerializedNodes(serializedNodes) {
348
+ const nodes = [];
349
+ for (let i = 0; i < serializedNodes.length; i++) {
350
+ const serializedNode = serializedNodes[i];
351
+ const node = $parseSerializedNode(serializedNode);
352
+ if ($isTextNode(node)) $addNodeStyle(node);
353
+ nodes.push(node);
354
+ }
355
+ return nodes;
356
+ }
357
+ const EVENT_LATENCY = 50;
358
+ let clipboardEventTimeout = null;
359
+ /**
360
+ * Copies the content of the current selection to the clipboard in
361
+ * text/plain, text/html, and application/x-lexical-editor (Lexical JSON)
362
+ * formats.
363
+ *
364
+ * @param editor the LexicalEditor instance to copy content from
365
+ * @param event the native browser ClipboardEvent to add the content to.
366
+ * @returns
367
+ */
368
+ async function copyToClipboard(editor, event, data) {
369
+ if (clipboardEventTimeout !== null) return false;
370
+ if (event !== null) return new Promise((resolve, reject) => {
371
+ editor.update(() => {
372
+ resolve($copyToClipboardEvent(editor, event, data));
373
+ });
374
+ });
375
+ const rootElement = editor.getRootElement();
376
+ const editorWindow = editor._window || window;
377
+ const windowDocument = editorWindow.document;
378
+ const domSelection = getDOMSelection(editorWindow);
379
+ if (rootElement === null || domSelection === null) return false;
380
+ const element = windowDocument.createElement("span");
381
+ element.style.position = "fixed";
382
+ element.style.top = "-1000px";
383
+ element.append(windowDocument.createTextNode("#"));
384
+ rootElement.append(element);
385
+ const range = new Range();
386
+ range.setStart(element, 0);
387
+ range.setEnd(element, 1);
388
+ domSelection.removeAllRanges();
389
+ domSelection.addRange(range);
390
+ return new Promise((resolve, reject) => {
391
+ const removeListener = editor.registerCommand(COPY_COMMAND, (secondEvent) => {
392
+ if (objectKlassEquals(secondEvent, ClipboardEvent)) {
393
+ removeListener();
394
+ if (clipboardEventTimeout !== null) {
395
+ editorWindow.clearTimeout(clipboardEventTimeout);
396
+ clipboardEventTimeout = null;
397
+ }
398
+ resolve($copyToClipboardEvent(editor, secondEvent, data));
399
+ }
400
+ return true;
401
+ }, COMMAND_PRIORITY_CRITICAL);
402
+ clipboardEventTimeout = editorWindow.setTimeout(() => {
403
+ removeListener();
404
+ clipboardEventTimeout = null;
405
+ resolve(false);
406
+ }, EVENT_LATENCY);
407
+ windowDocument.execCommand("copy");
408
+ element.remove();
409
+ });
410
+ }
411
+ function $copyToClipboardEvent(editor, event, data) {
412
+ if (data === void 0) {
413
+ const domSelection = getDOMSelection(editor._window);
414
+ const selection = $getSelection();
415
+ if (!selection || selection.isCollapsed()) return false;
416
+ if (!domSelection) return false;
417
+ const anchorDOM = domSelection.anchorNode;
418
+ const focusDOM = domSelection.focusNode;
419
+ if (anchorDOM !== null && focusDOM !== null && !isSelectionWithinEditor(editor, anchorDOM, focusDOM)) return false;
420
+ data = $getClipboardDataFromSelection(selection);
421
+ }
422
+ event.preventDefault();
423
+ const clipboardData = event.clipboardData;
424
+ if (clipboardData === null) return false;
425
+ setLexicalClipboardDataTransfer(clipboardData, data);
426
+ return true;
427
+ }
428
+ const clipboardDataFunctions = [["text/html", $getHtmlContent], ["application/x-lexical-editor", $getLexicalContent]];
429
+ /**
430
+ * Serialize the content of the current selection to strings in
431
+ * text/plain, text/html, and application/x-lexical-editor (Lexical JSON)
432
+ * formats (as available).
433
+ *
434
+ * @param selection the selection to serialize (defaults to $getSelection())
435
+ * @returns LexicalClipboardData
436
+ */
437
+ function $getClipboardDataFromSelection(selection = $getSelection()) {
438
+ return $getClipboardDataWithConfigFromSelection($getExportConfig(), selection);
439
+ }
440
+ /**
441
+ * Call setData on the given clipboardData for each MIME type present
442
+ * in the given data (from {@link $getClipboardDataFromSelection})
443
+ *
444
+ * @param clipboardData the event.clipboardData to populate from data
445
+ * @param data The lexical data
446
+ */
447
+ function setLexicalClipboardDataTransfer(clipboardData, data) {
448
+ for (const [k] of clipboardDataFunctions) if (data[k] === void 0) clipboardData.setData(k, "");
449
+ for (const k in data) {
450
+ const v = data[k];
451
+ if (v !== void 0) clipboardData.setData(k, v);
452
+ }
453
+ }
454
+ function $getExportConfig() {
455
+ const editor = $getEditor();
456
+ const builder = LexicalBuilder.maybeFromEditor(editor);
457
+ if (builder && builder.hasExtensionByName(GetClipboardDataExtension.name)) return getExtensionDependencyFromEditor(editor, GetClipboardDataExtension).output;
458
+ return DEFAULT_EXPORT_MIME_TYPE;
459
+ }
460
+ const DEFAULT_EXPORT_MIME_TYPE = {
461
+ "application/x-lexical-editor": [(sel, next) => sel ? $getLexicalContent($getEditor(), sel) : next()],
462
+ "text/html": [(sel, next) => sel ? $getHtmlContent($getEditor(), sel) : next()],
463
+ "text/plain": [(sel, next) => sel ? sel.getTextContent() : next()]
464
+ };
465
+ function $getClipboardDataWithConfigFromSelection($exportMimeType, selection) {
466
+ const clipboardData = { "text/plain": "" };
467
+ for (const [k, fns] of Object.entries($exportMimeType)) {
468
+ const v = callExportMimeTypeFunctionStack(fns, selection);
469
+ if (v !== null) clipboardData[k] = v;
470
+ }
471
+ return clipboardData;
472
+ }
473
+ function callExportMimeTypeFunctionStack(fns, selection) {
474
+ const callAt = (i) => fns[i] ? fns[i](selection, callAt.bind(null, i - 1)) : null;
475
+ return callAt(fns.length - 1);
476
+ }
477
+ const GetClipboardDataExtension = defineExtension({
478
+ build(editor, config, state) {
479
+ return config.$exportMimeType;
480
+ },
481
+ config: safeCast({ $exportMimeType: DEFAULT_EXPORT_MIME_TYPE }),
482
+ mergeConfig(config, partial) {
483
+ const merged = shallowMergeConfig(config, partial);
484
+ if (partial.$exportMimeType) {
485
+ const $exportMimeType = { ...config.$exportMimeType };
486
+ for (const [k, v] of Object.entries(partial.$exportMimeType)) $exportMimeType[k] = [...$exportMimeType[k], ...v];
487
+ merged.$exportMimeType = $exportMimeType;
488
+ }
489
+ return merged;
490
+ },
491
+ name: "@lexical/clipboard/GetClipboardData"
492
+ });
493
+ //#endregion
494
+ export { $generateJSONFromSelectedNodes, $generateNodesFromSerializedNodes, $getClipboardDataFromSelection, $getHtmlContent, $getLexicalContent, $handlePlainTextDrop, $handleRichTextDrop, $insertDataTransferForPlainText, $insertDataTransferForRichText, $insertGeneratedNodes, $writeDragSourceToDataTransfer, copyToClipboard, setLexicalClipboardDataTransfer };
495
+
496
+ //# sourceMappingURL=LexicalClipboard.dev-CdeeWCIq.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LexicalClipboard.dev-CdeeWCIq.mjs","names":[],"sources":["../../../node_modules/.pnpm/@lexical+clipboard@0.44.0/node_modules/@lexical/clipboard/LexicalClipboard.dev.mjs"],"sourcesContent":["/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { LexicalBuilder, getExtensionDependencyFromEditor } from '@lexical/extension';\nimport { $generateHtmlFromNodes, $generateNodesFromDOM } from '@lexical/html';\nimport { $addNodeStyle, $sliceSelectedTextNodeContent } from '@lexical/selection';\nimport { objectKlassEquals } from '@lexical/utils';\nimport { $isRangeSelection, $getSelection, $createTabNode, SELECTION_INSERT_CLIPBOARD_NODES_COMMAND, $caretFromPoint, $isTextPointCaret, $getCaretRange, $getChildCaret, $getRoot, $isTextNode, $isElementNode, $parseSerializedNode, getDOMSelection, COPY_COMMAND, COMMAND_PRIORITY_CRITICAL, isSelectionWithinEditor, $getEditor, defineExtension, shallowMergeConfig, safeCast, $splitAtPointCaretNext, $setSelectionFromCaretRange, $getCollapsedCaretRange, $getNearestNodeFromDOMNode, $getTextPointCaret, $getChildCaretAtIndex, $getCaretRangeInDirection, $caretRangeFromSelection, $comparePointCaretNext } from 'lexical';\n\n/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\n// Do not require this module directly! Use normal `invariant` calls.\n\nfunction formatDevErrorMessage(message) {\n throw new Error(message);\n}\n\n/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nfunction caretFromPoint(x, y) {\n if (typeof document.caretRangeFromPoint !== 'undefined') {\n const range = document.caretRangeFromPoint(x, y);\n if (range === null) {\n return null;\n }\n return {\n node: range.startContainer,\n offset: range.startOffset\n };\n // @ts-ignore\n } else if (document.caretPositionFromPoint !== 'undefined') {\n // @ts-ignore FF - no types\n const range = document.caretPositionFromPoint(x, y);\n if (range === null) {\n return null;\n }\n return {\n node: range.offsetNode,\n offset: range.offset\n };\n } else {\n // Gracefully handle IE\n return null;\n }\n}\n\n/**\n * Returns the *currently selected* Lexical content as an HTML string, relying on the\n * logic defined in the exportDOM methods on the LexicalNode classes. Note that\n * this will not return the HTML content of the entire editor (unless all the content is included\n * in the current selection).\n *\n * @param editor - LexicalEditor instance to get HTML content from\n * @param selection - The selection to use (default is $getSelection())\n * @returns a string of HTML content\n */\nfunction $getHtmlContent(editor, selection = $getSelection()) {\n if (selection == null) {\n {\n formatDevErrorMessage(`Expected valid LexicalSelection`);\n }\n }\n\n // If we haven't selected anything\n if ($isRangeSelection(selection) && selection.isCollapsed() || selection.getNodes().length === 0) {\n return '';\n }\n return $generateHtmlFromNodes(editor, selection);\n}\n\n/**\n * Returns the *currently selected* Lexical content as a JSON string, relying on the\n * logic defined in the exportJSON methods on the LexicalNode classes. Note that\n * this will not return the JSON content of the entire editor (unless all the content is included\n * in the current selection).\n *\n * @param editor - LexicalEditor instance to get the JSON content from\n * @param selection - The selection to use (default is $getSelection())\n * @returns\n */\nfunction $getLexicalContent(editor, selection = $getSelection()) {\n if (selection == null) {\n {\n formatDevErrorMessage(`Expected valid LexicalSelection`);\n }\n }\n\n // If we haven't selected anything\n if ($isRangeSelection(selection) && selection.isCollapsed() || selection.getNodes().length === 0) {\n return null;\n }\n return JSON.stringify($generateJSONFromSelectedNodes(editor, selection));\n}\n\n/**\n * Attempts to insert content of the mime-types text/plain or text/uri-list from\n * the provided DataTransfer object into the editor at the provided selection.\n * text/uri-list is only used if text/plain is not also provided.\n *\n * @param dataTransfer an object conforming to the [DataTransfer interface] (https://html.spec.whatwg.org/multipage/dnd.html#the-datatransfer-interface)\n * @param selection the selection to use as the insertion point for the content in the DataTransfer object\n */\nfunction $insertDataTransferForPlainText(dataTransfer, selection) {\n const text = dataTransfer.getData('text/plain') || dataTransfer.getData('text/uri-list');\n if (text != null) {\n selection.insertRawText(text);\n }\n}\n\n/**\n * Attempts to insert content of the mime-types application/x-lexical-editor, text/html,\n * text/plain, or text/uri-list (in descending order of priority) from the provided DataTransfer\n * object into the editor at the provided selection.\n *\n * @param dataTransfer an object conforming to the [DataTransfer interface] (https://html.spec.whatwg.org/multipage/dnd.html#the-datatransfer-interface)\n * @param selection the selection to use as the insertion point for the content in the DataTransfer object\n * @param editor the LexicalEditor the content is being inserted into.\n */\nfunction $insertDataTransferForRichText(dataTransfer, selection, editor) {\n const lexicalString = dataTransfer.getData('application/x-lexical-editor');\n if (lexicalString) {\n try {\n const payload = JSON.parse(lexicalString);\n if (payload.namespace === editor._config.namespace && Array.isArray(payload.nodes)) {\n const nodes = $generateNodesFromSerializedNodes(payload.nodes);\n return $insertGeneratedNodes(editor, nodes, selection);\n }\n } catch (error) {\n console.error(error);\n }\n }\n const htmlString = dataTransfer.getData('text/html');\n const plainString = dataTransfer.getData('text/plain');\n\n // Skip HTML handling if it matches the plain text representation.\n // This avoids unnecessary processing for plain text strings created by\n // iOS Safari autocorrect, which incorrectly includes a `text/html` type.\n if (htmlString && plainString !== htmlString) {\n try {\n const parser = new DOMParser();\n const dom = parser.parseFromString(trustHTML(htmlString), 'text/html');\n const nodes = $generateNodesFromDOM(editor, dom);\n return $insertGeneratedNodes(editor, nodes, selection);\n } catch (error) {\n console.error(error);\n }\n }\n\n // Multi-line plain text in rich text mode pasted as separate paragraphs\n // instead of single paragraph with linebreaks.\n // Webkit-specific: Supports read 'text/uri-list' in clipboard.\n const text = plainString || dataTransfer.getData('text/uri-list');\n if (text != null) {\n if ($isRangeSelection(selection)) {\n const parts = text.split(/(\\r?\\n|\\t)/);\n if (parts[parts.length - 1] === '') {\n parts.pop();\n }\n for (let i = 0; i < parts.length; i++) {\n const currentSelection = $getSelection();\n if ($isRangeSelection(currentSelection)) {\n const part = parts[i];\n if (part === '\\n' || part === '\\r\\n') {\n currentSelection.insertParagraph();\n } else if (part === '\\t') {\n currentSelection.insertNodes([$createTabNode()]);\n } else {\n currentSelection.insertText(part);\n }\n }\n }\n } else {\n selection.insertRawText(text);\n }\n }\n}\nconst LEXICAL_DRAG_MIME_TYPE = 'application/x-lexical-drag';\n/**\n * Populate `dataTransfer` with a marker identifying the current editor as a\n * drag source. Pair this with {@link $handleRichTextDrop} or\n * {@link $handlePlainTextDrop} on the drop side to get cut-and-paste semantics\n * for drags that end in a different editor.\n *\n * Only the source editor's key needs to round-trip — the source's\n * RangeSelection itself is preserved on the source editor between drag start\n * and drop (Lexical suppresses selectionchange during drag), so the drop\n * handler reads it directly via `$getSelection()` on the resolved source\n * editor.\n *\n * Callers typically invoke this from a DRAGSTART_COMMAND handler alongside\n * {@link setLexicalClipboardDataTransfer} (so that the dragged content itself\n * round-trips with full node fidelity).\n */\nfunction $writeDragSourceToDataTransfer(dataTransfer, editor) {\n const marker = {\n editorKey: editor.getKey()\n };\n dataTransfer.setData(LEXICAL_DRAG_MIME_TYPE, JSON.stringify(marker));\n}\nfunction isLexicalDragMarker(value) {\n return value !== null && typeof value === 'object' && 'editorKey' in value && typeof value.editorKey === 'string';\n}\nfunction readDragMarker(dataTransfer) {\n const raw = dataTransfer.getData(LEXICAL_DRAG_MIME_TYPE);\n if (!raw) {\n return null;\n }\n let parsed;\n try {\n parsed = JSON.parse(raw);\n } catch (_unused) {\n return null;\n }\n return isLexicalDragMarker(parsed) ? parsed : null;\n}\nfunction findEditorRootByKey(key, doc) {\n const elements = doc.querySelectorAll('[data-lexical-editor=\"true\"]');\n for (const el of Array.from(elements)) {\n const editor = el.__lexicalEditor;\n if (editor && editor.getKey() === key) {\n return el;\n }\n }\n return null;\n}\nfunction $resolveDropPointCaret(event) {\n const hit = caretFromPoint(event.clientX, event.clientY);\n if (hit === null) {\n return null;\n }\n const node = $getNearestNodeFromDOMNode(hit.node);\n if (node === null) {\n return null;\n }\n if ($isTextNode(node)) {\n return $getTextPointCaret(node, 'next', hit.offset);\n }\n if ($isElementNode(node)) {\n return $getChildCaretAtIndex(node, hit.offset, 'next');\n }\n const parent = node.getParent();\n if (parent === null) {\n return null;\n }\n return $getChildCaretAtIndex(parent, node.getIndexWithinParent() + 1, 'next');\n}\nfunction $isDropCaretInsideSelection(dropCaret, selection) {\n const {\n anchor: start,\n focus: end\n } = $getCaretRangeInDirection($caretRangeFromSelection(selection), 'next');\n return $comparePointCaretNext(start, dropCaret) < 0 && $comparePointCaretNext(dropCaret, end) < 0;\n}\nfunction $doDrop(event, editor, $insertDataTransfer) {\n const dataTransfer = event.dataTransfer;\n if (dataTransfer === null) {\n return false;\n }\n\n // Drags that didn't originate in a Lexical editor (no marker) fall through\n // to the browser's native drag-and-drop flow; its beforeinput\n // insertFromDrop is already handled correctly by Lexical's existing\n // beforeinput logic.\n const marker = readDragMarker(dataTransfer);\n if (marker === null) {\n return false;\n }\n const dropCaret = $resolveDropPointCaret(event);\n if (dropCaret === null) {\n return false;\n }\n\n // Split at the drop caret so we have a stable NodeCaret boundary that\n // survives text-content mutations in its siblings.\n const stableDropCaret = $splitAtPointCaretNext(dropCaret);\n if (stableDropCaret === null) {\n return false;\n }\n const isSameEditorDrag = marker.editorKey === editor.getKey();\n const currentSelection = $getSelection();\n if (isSameEditorDrag) {\n // Same-editor drag: the destination's $getSelection() is the still-\n // selected dragged range, so Lexical's beforeinput handler would skip\n // applyDOMRange and route the insert to the source's location instead\n // of the drop point. Remove the dragged range ourselves, then insert\n // at the stable drop caret.\n if (!$isRangeSelection(currentSelection) || currentSelection.isCollapsed()) {\n return false;\n }\n if ($isDropCaretInsideSelection(dropCaret, currentSelection)) {\n event.preventDefault();\n return true;\n }\n currentSelection.removeText();\n }\n\n // If the drop caret's origin was swept away by the source removal, abort —\n // this can happen on a same-editor drag whose range covered the entire\n // text node we tried to split at.\n if (!stableDropCaret.origin.isAttached()) {\n event.preventDefault();\n return true;\n }\n const dropSelection = $setSelectionFromCaretRange($getCollapsedCaretRange(stableDropCaret));\n $insertDataTransfer(dataTransfer, dropSelection, editor);\n if (!isSameEditorDrag) {\n // Cross-editor drag. The native drag-out deletion that the browser\n // would normally fire (beforeinput deleteByDrag on the source) isn't\n // reliable when the source is a nested contenteditable of the\n // destination (e.g. an image caption inside the main editor), so we\n // dispatch it ourselves at the source editor's root. The source\n // editor's own beforeinput handler runs the deletion through its own\n // REMOVE_TEXT_COMMAND and SKIP_SELECTION_FOCUS_TAG path.\n const rootElement = editor.getRootElement();\n const doc = rootElement ? rootElement.ownerDocument : null;\n const sourceRoot = doc ? findEditorRootByKey(marker.editorKey, doc) : null;\n if (sourceRoot !== null) {\n sourceRoot.dispatchEvent(new InputEvent('beforeinput', {\n bubbles: true,\n cancelable: true,\n inputType: 'deleteByDrag'\n }));\n }\n }\n event.preventDefault();\n return true;\n}\n\n/**\n * Drop handler for rich-text editors. Inserts the DataTransfer payload via\n * {@link $insertDataTransferForRichText} at the drop caret and, when the drag\n * originated from a Lexical editor (marked via\n * {@link $writeDragSourceToDataTransfer} on DRAGSTART), removes the source\n * range — producing cut-and-paste semantics whether the drop is in the same\n * editor or a different one on the same page.\n */\nfunction $handleRichTextDrop(event, editor) {\n return $doDrop(event, editor, $insertDataTransferForRichText);\n}\n\n/**\n * Drop handler for plain-text editors. Same semantics as\n * {@link $handleRichTextDrop} but inserts via\n * {@link $insertDataTransferForPlainText}.\n */\nfunction $handlePlainTextDrop(event, editor) {\n return $doDrop(event, editor, (dataTransfer, selection) => $insertDataTransferForPlainText(dataTransfer, selection));\n}\nfunction trustHTML(html) {\n if (window.trustedTypes && window.trustedTypes.createPolicy) {\n const policy = window.trustedTypes.createPolicy('lexical', {\n createHTML: input => input\n });\n return policy.createHTML(html);\n }\n return html;\n}\n\n/**\n * Inserts Lexical nodes into the editor using different strategies depending on\n * some simple selection-based heuristics. If you're looking for a generic way to\n * to insert nodes into the editor at a specific selection point, you probably want\n * {@link lexical.$insertNodes}\n *\n * @param editor LexicalEditor instance to insert the nodes into.\n * @param nodes The nodes to insert.\n * @param selection The selection to insert the nodes into.\n */\nfunction $insertGeneratedNodes(editor, nodes, selection) {\n if (!editor.dispatchCommand(SELECTION_INSERT_CLIPBOARD_NODES_COMMAND, {\n nodes,\n selection\n })) {\n selection.insertNodes(nodes);\n $updateSelectionOnInsert(selection);\n }\n return;\n}\nfunction $updateSelectionOnInsert(selection) {\n if ($isRangeSelection(selection) && selection.isCollapsed()) {\n const anchor = selection.anchor;\n let nodeToInspect = null;\n const anchorCaret = $caretFromPoint(anchor, 'previous');\n if (anchorCaret) {\n if ($isTextPointCaret(anchorCaret)) {\n nodeToInspect = anchorCaret.origin;\n } else {\n const range = $getCaretRange(anchorCaret, $getChildCaret($getRoot(), 'next').getFlipped());\n for (const caret of range) {\n if ($isTextNode(caret.origin)) {\n nodeToInspect = caret.origin;\n break;\n } else if ($isElementNode(caret.origin) && !caret.origin.isInline()) {\n break;\n }\n }\n }\n }\n if (nodeToInspect && $isTextNode(nodeToInspect)) {\n const newFormat = nodeToInspect.getFormat();\n const newStyle = nodeToInspect.getStyle();\n if (selection.format !== newFormat || selection.style !== newStyle) {\n selection.format = newFormat;\n selection.style = newStyle;\n selection.dirty = true;\n }\n }\n }\n}\nfunction exportNodeToJSON(node) {\n const serializedNode = node.exportJSON();\n const nodeClass = node.constructor;\n if (serializedNode.type !== nodeClass.getType()) {\n {\n formatDevErrorMessage(`LexicalNode: Node ${nodeClass.name} does not implement .exportJSON().`);\n }\n }\n if ($isElementNode(node)) {\n const serializedChildren = serializedNode.children;\n if (!Array.isArray(serializedChildren)) {\n {\n formatDevErrorMessage(`LexicalNode: Node ${nodeClass.name} is an element but .exportJSON() does not have a children array.`);\n }\n }\n }\n return serializedNode;\n}\nfunction $appendNodesToJSON(editor, selection, currentNode, targetArray = []) {\n let shouldInclude = selection !== null ? currentNode.isSelected(selection) : true;\n const shouldExclude = $isElementNode(currentNode) && currentNode.excludeFromCopy('html');\n let target = currentNode;\n if (selection !== null && $isTextNode(target)) {\n target = $sliceSelectedTextNodeContent(selection, target, 'clone');\n }\n const children = $isElementNode(target) ? target.getChildren() : [];\n const serializedNode = exportNodeToJSON(target);\n if ($isTextNode(target) && target.getTextContentSize() === 0) {\n // If an uncollapsed selection ends or starts at the end of a line of specialized,\n // TextNodes, such as code tokens, we will get a 'blank' TextNode here, i.e., one\n // with text of length 0. We don't want this, it makes a confusing mess. Reset!\n shouldInclude = false;\n }\n for (let i = 0; i < children.length; i++) {\n const childNode = children[i];\n const shouldIncludeChild = $appendNodesToJSON(editor, selection, childNode, serializedNode.children);\n if (!shouldInclude && $isElementNode(currentNode) && shouldIncludeChild && currentNode.extractWithChild(childNode, selection, 'clone')) {\n shouldInclude = true;\n }\n }\n if (shouldInclude && !shouldExclude) {\n targetArray.push(serializedNode);\n } else if (Array.isArray(serializedNode.children)) {\n for (let i = 0; i < serializedNode.children.length; i++) {\n const serializedChildNode = serializedNode.children[i];\n targetArray.push(serializedChildNode);\n }\n }\n return shouldInclude;\n}\n\n// TODO why $ function with Editor instance?\n/**\n * Gets the Lexical JSON of the nodes inside the provided Selection.\n *\n * @param editor LexicalEditor to get the JSON content from.\n * @param selection Selection to get the JSON content from.\n * @returns an object with the editor namespace and a list of serializable nodes as JavaScript objects.\n */\nfunction $generateJSONFromSelectedNodes(editor, selection) {\n const nodes = [];\n const root = $getRoot();\n const topLevelChildren = root.getChildren();\n for (let i = 0; i < topLevelChildren.length; i++) {\n const topLevelNode = topLevelChildren[i];\n $appendNodesToJSON(editor, selection, topLevelNode, nodes);\n }\n return {\n namespace: editor._config.namespace,\n nodes\n };\n}\n\n/**\n * This method takes an array of objects conforming to the BaseSerializedNode interface and returns\n * an Array containing instances of the corresponding LexicalNode classes registered on the editor.\n * Normally, you'd get an Array of BaseSerialized nodes from {@link $generateJSONFromSelectedNodes}\n *\n * @param serializedNodes an Array of objects conforming to the BaseSerializedNode interface.\n * @returns an Array of Lexical Node objects.\n */\nfunction $generateNodesFromSerializedNodes(serializedNodes) {\n const nodes = [];\n for (let i = 0; i < serializedNodes.length; i++) {\n const serializedNode = serializedNodes[i];\n const node = $parseSerializedNode(serializedNode);\n if ($isTextNode(node)) {\n $addNodeStyle(node);\n }\n nodes.push(node);\n }\n return nodes;\n}\nconst EVENT_LATENCY = 50;\nlet clipboardEventTimeout = null;\n\n// TODO custom selection\n// TODO potentially have a node customizable version for plain text\n/**\n * Copies the content of the current selection to the clipboard in\n * text/plain, text/html, and application/x-lexical-editor (Lexical JSON)\n * formats.\n *\n * @param editor the LexicalEditor instance to copy content from\n * @param event the native browser ClipboardEvent to add the content to.\n * @returns\n */\nasync function copyToClipboard(editor, event, data) {\n if (clipboardEventTimeout !== null) {\n // Prevent weird race conditions that can happen when this function is run multiple times\n // synchronously. In the future, we can do better, we can cancel/override the previously running job.\n return false;\n }\n if (event !== null) {\n return new Promise((resolve, reject) => {\n editor.update(() => {\n resolve($copyToClipboardEvent(editor, event, data));\n });\n });\n }\n const rootElement = editor.getRootElement();\n const editorWindow = editor._window || window;\n const windowDocument = editorWindow.document;\n const domSelection = getDOMSelection(editorWindow);\n if (rootElement === null || domSelection === null) {\n return false;\n }\n const element = windowDocument.createElement('span');\n element.style.position = 'fixed';\n element.style.top = '-1000px';\n element.append(windowDocument.createTextNode('#'));\n rootElement.append(element);\n const range = new Range();\n range.setStart(element, 0);\n range.setEnd(element, 1);\n domSelection.removeAllRanges();\n domSelection.addRange(range);\n return new Promise((resolve, reject) => {\n const removeListener = editor.registerCommand(COPY_COMMAND, secondEvent => {\n if (objectKlassEquals(secondEvent, ClipboardEvent)) {\n removeListener();\n if (clipboardEventTimeout !== null) {\n editorWindow.clearTimeout(clipboardEventTimeout);\n clipboardEventTimeout = null;\n }\n resolve($copyToClipboardEvent(editor, secondEvent, data));\n }\n // Block the entire copy flow while we wait for the next ClipboardEvent\n return true;\n }, COMMAND_PRIORITY_CRITICAL);\n // If the above hack execCommand hack works, this timeout code should never fire. Otherwise,\n // the listener will be quickly freed so that the user can reuse it again\n clipboardEventTimeout = editorWindow.setTimeout(() => {\n removeListener();\n clipboardEventTimeout = null;\n resolve(false);\n }, EVENT_LATENCY);\n windowDocument.execCommand('copy');\n element.remove();\n });\n}\n\n// TODO shouldn't pass editor (pass namespace directly)\nfunction $copyToClipboardEvent(editor, event, data) {\n if (data === undefined) {\n const domSelection = getDOMSelection(editor._window);\n const selection = $getSelection();\n if (!selection || selection.isCollapsed()) {\n return false;\n }\n if (!domSelection) {\n return false;\n }\n const anchorDOM = domSelection.anchorNode;\n const focusDOM = domSelection.focusNode;\n if (anchorDOM !== null && focusDOM !== null && !isSelectionWithinEditor(editor, anchorDOM, focusDOM)) {\n return false;\n }\n data = $getClipboardDataFromSelection(selection);\n }\n event.preventDefault();\n const clipboardData = event.clipboardData;\n if (clipboardData === null) {\n return false;\n }\n setLexicalClipboardDataTransfer(clipboardData, data);\n return true;\n}\nconst clipboardDataFunctions = [['text/html', $getHtmlContent], ['application/x-lexical-editor', $getLexicalContent]];\n\n/**\n * Serialize the content of the current selection to strings in\n * text/plain, text/html, and application/x-lexical-editor (Lexical JSON)\n * formats (as available).\n *\n * @param selection the selection to serialize (defaults to $getSelection())\n * @returns LexicalClipboardData\n */\nfunction $getClipboardDataFromSelection(selection = $getSelection()) {\n return $getClipboardDataWithConfigFromSelection($getExportConfig(), selection);\n}\n\n/**\n * Call setData on the given clipboardData for each MIME type present\n * in the given data (from {@link $getClipboardDataFromSelection})\n *\n * @param clipboardData the event.clipboardData to populate from data\n * @param data The lexical data\n */\nfunction setLexicalClipboardDataTransfer(clipboardData, data) {\n for (const [k] of clipboardDataFunctions) {\n if (data[k] === undefined) {\n clipboardData.setData(k, '');\n }\n }\n for (const k in data) {\n const v = data[k];\n if (v !== undefined) {\n clipboardData.setData(k, v);\n }\n }\n}\nfunction $getExportConfig() {\n const editor = $getEditor();\n const builder = LexicalBuilder.maybeFromEditor(editor);\n if (builder && builder.hasExtensionByName(GetClipboardDataExtension.name)) {\n return getExtensionDependencyFromEditor(editor, GetClipboardDataExtension).output;\n }\n return DEFAULT_EXPORT_MIME_TYPE;\n}\nconst DEFAULT_EXPORT_MIME_TYPE = {\n 'application/x-lexical-editor': [(sel, next) => sel ? $getLexicalContent($getEditor(), sel) : next()],\n 'text/html': [(sel, next) => sel ? $getHtmlContent($getEditor(), sel) : next()],\n 'text/plain': [(sel, next) => sel ? sel.getTextContent() : next()]\n};\nfunction $getClipboardDataWithConfigFromSelection($exportMimeType, selection) {\n const clipboardData = {\n 'text/plain': ''\n };\n for (const [k, fns] of Object.entries($exportMimeType)) {\n const v = callExportMimeTypeFunctionStack(fns, selection);\n if (v !== null) {\n clipboardData[k] = v;\n }\n }\n return clipboardData;\n}\nfunction callExportMimeTypeFunctionStack(fns, selection) {\n const callAt = i => fns[i] ? fns[i](selection, callAt.bind(null, i - 1)) : null;\n return callAt(fns.length - 1);\n}\nconst GetClipboardDataExtension = defineExtension({\n build(editor, config, state) {\n return config.$exportMimeType;\n },\n config: safeCast({\n $exportMimeType: DEFAULT_EXPORT_MIME_TYPE\n }),\n mergeConfig(config, partial) {\n const merged = shallowMergeConfig(config, partial);\n if (partial.$exportMimeType) {\n const $exportMimeType = {\n ...config.$exportMimeType\n };\n for (const [k, v] of Object.entries(partial.$exportMimeType)) {\n $exportMimeType[k] = [...$exportMimeType[k], ...v];\n }\n merged.$exportMimeType = $exportMimeType;\n }\n return merged;\n },\n name: '@lexical/clipboard/GetClipboardData'\n});\n\nexport { $generateJSONFromSelectedNodes, $generateNodesFromSerializedNodes, $getClipboardDataFromSelection, $getHtmlContent, $getLexicalContent, $handlePlainTextDrop, $handleRichTextDrop, $insertDataTransferForPlainText, $insertDataTransferForRichText, $insertGeneratedNodes, $writeDragSourceToDataTransfer, copyToClipboard, setLexicalClipboardDataTransfer };\n"],"x_google_ignoreList":[0],"mappings":";;;;;;;;;;;;;;;;;;;;AAwBA,SAAS,sBAAsB,SAAS;CACtC,MAAM,IAAI,MAAM,OAAO;AACzB;;;;;;;;AAUA,SAAS,eAAe,GAAG,GAAG;CAC5B,IAAI,OAAO,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C;CACpG,aAAa,EAAE,KAAK,SAAS,MAAM,gBAAgB,WAAW,GAAG,GAAG,IAAI,KAAK,CAAC;CAC9E,cAAc,EAAE,KAAK,SAAS,MAAM,IAAI,eAAe,IAAI,KAAK,CAAC;AACnE;AACA,SAAS,yCAAyC,iBAAiB,WAAW;CAC5E,MAAM,gBAAgB,EACpB,cAAc,GAChB;CACA,KAAK,MAAM,CAAC,GAAG,QAAQ,OAAO,QAAQ,eAAe,GAAG;EACtD,MAAM,IAAI,gCAAgC,KAAK,SAAS;EACxD,IAAI,MAAM,MACR,cAAc,KAAK;CAEvB;CACA,OAAO;AACT;AACA,SAAS,gCAAgC,KAAK,WAAW;CACvD,MAAM,UAAS,MAAK,IAAI,KAAK,IAAI,GAAG,WAAW,OAAO,KAAK,MAAM,IAAI,CAAC,CAAC,IAAI;CAC3E,OAAO,OAAO,IAAI,SAAS,CAAC;AAC9B;AACA,MAAM,4BAA4B,gBAAgB;CAChD,MAAM,QAAQ,QAAQ,OAAO;EAC3B,OAAO,OAAO;CAChB;CACA,QAAQ,SAAS,EACf,iBAAiB,yBACnB,CAAC;CACD,YAAY,QAAQ,SAAS;EAC3B,MAAM,SAAS,mBAAmB,QAAQ,OAAO;EACjD,IAAI,QAAQ,iBAAiB;GAC3B,MAAM,kBAAkB,EACtB,GAAG,OAAO,gBACZ;GACA,KAAK,MAAM,CAAC,GAAG,MAAM,OAAO,QAAQ,QAAQ,eAAe,GACzD,gBAAgB,KAAK,CAAC,GAAG,gBAAgB,IAAI,GAAG,CAAC;GAEnD,OAAO,kBAAkB;EAC3B;EACA,OAAO;CACT;CACA,MAAM;AACR,CAAC"}
@@ -0,0 +1,26 @@
1
+ //#region ../../node_modules/.pnpm/@lexical+clipboard@0.44.0/node_modules/@lexical/clipboard/LexicalClipboard.node.mjs
2
+ /**
3
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ *
8
+ */
9
+ const mod = await (process.env.NODE_ENV !== "production" ? import("./LexicalClipboard.dev-CdeeWCIq.mjs") : import("./LexicalClipboard.prod-CsCWYmV7.mjs"));
10
+ mod.$generateJSONFromSelectedNodes;
11
+ mod.$generateNodesFromSerializedNodes;
12
+ const $getClipboardDataFromSelection = mod.$getClipboardDataFromSelection;
13
+ mod.$getHtmlContent;
14
+ mod.$getLexicalContent;
15
+ mod.$handlePlainTextDrop;
16
+ const $handleRichTextDrop = mod.$handleRichTextDrop;
17
+ mod.$insertDataTransferForPlainText;
18
+ const $insertDataTransferForRichText = mod.$insertDataTransferForRichText;
19
+ mod.$insertGeneratedNodes;
20
+ const $writeDragSourceToDataTransfer = mod.$writeDragSourceToDataTransfer;
21
+ const copyToClipboard = mod.copyToClipboard;
22
+ const setLexicalClipboardDataTransfer = mod.setLexicalClipboardDataTransfer;
23
+ //#endregion
24
+ export { copyToClipboard as a, $writeDragSourceToDataTransfer as i, $handleRichTextDrop as n, setLexicalClipboardDataTransfer as o, $insertDataTransferForRichText as r, $getClipboardDataFromSelection as t };
25
+
26
+ //# sourceMappingURL=LexicalClipboard.node-0e9GBL1g.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LexicalClipboard.node-0e9GBL1g.mjs","names":[],"sources":["../../../node_modules/.pnpm/@lexical+clipboard@0.44.0/node_modules/@lexical/clipboard/LexicalClipboard.node.mjs"],"sourcesContent":["/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nconst mod = await (process.env.NODE_ENV !== 'production' ? import('./LexicalClipboard.dev.mjs') : import('./LexicalClipboard.prod.mjs'));\nexport const $generateJSONFromSelectedNodes = mod.$generateJSONFromSelectedNodes;\nexport const $generateNodesFromSerializedNodes = mod.$generateNodesFromSerializedNodes;\nexport const $getClipboardDataFromSelection = mod.$getClipboardDataFromSelection;\nexport const $getHtmlContent = mod.$getHtmlContent;\nexport const $getLexicalContent = mod.$getLexicalContent;\nexport const $handlePlainTextDrop = mod.$handlePlainTextDrop;\nexport const $handleRichTextDrop = mod.$handleRichTextDrop;\nexport const $insertDataTransferForPlainText = mod.$insertDataTransferForPlainText;\nexport const $insertDataTransferForRichText = mod.$insertDataTransferForRichText;\nexport const $insertGeneratedNodes = mod.$insertGeneratedNodes;\nexport const $writeDragSourceToDataTransfer = mod.$writeDragSourceToDataTransfer;\nexport const copyToClipboard = mod.copyToClipboard;\nexport const setLexicalClipboardDataTransfer = mod.setLexicalClipboardDataTransfer;"],"x_google_ignoreList":[0],"mappings":";;;;;;;;AAQA,MAAM,MAAM,OAAO,QAAQ,IAAI,aAAa,eAAe,OAAO,yCAAgC,OAAO;AAC3D,IAAI;AACD,IAAI;AACrD,MAAa,iCAAiC,IAAI;AACnB,IAAI;AACD,IAAI;AACF,IAAI;AACxC,MAAa,sBAAsB,IAAI;AACQ,IAAI;AACnD,MAAa,iCAAiC,IAAI;AACb,IAAI;AACzC,MAAa,iCAAiC,IAAI;AAClD,MAAa,kBAAkB,IAAI;AACnC,MAAa,kCAAkC,IAAI"}