reactjs-tiptap-editor 0.4.1 → 1.0.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 (338) hide show
  1. package/lib/ActionMenuButton-BKOg7hkq.js +38 -0
  2. package/lib/ActionMenuButton-DLQyd_gx.cjs +1 -0
  3. package/lib/Attachment.cjs +2 -2
  4. package/lib/Attachment.d.cts +43 -55
  5. package/lib/Attachment.d.ts +43 -55
  6. package/lib/Attachment.js +129 -99
  7. package/lib/Blockquote.cjs +3 -3
  8. package/lib/Blockquote.d.cts +43 -55
  9. package/lib/Blockquote.d.ts +43 -55
  10. package/lib/Blockquote.js +50 -22
  11. package/lib/Bold.cjs +1 -1
  12. package/lib/Bold.d.cts +43 -55
  13. package/lib/Bold.d.ts +43 -55
  14. package/lib/Bold.js +48 -20
  15. package/lib/BulletList.cjs +1 -1
  16. package/lib/BulletList.d.cts +43 -55
  17. package/lib/BulletList.d.ts +43 -55
  18. package/lib/BulletList.js +38 -9
  19. package/lib/Clear.cjs +1 -1
  20. package/lib/Clear.d.cts +43 -55
  21. package/lib/Clear.d.ts +43 -55
  22. package/lib/Clear.js +32 -6
  23. package/lib/Code.cjs +1 -1
  24. package/lib/Code.d.cts +43 -55
  25. package/lib/Code.d.ts +43 -55
  26. package/lib/Code.js +53 -25
  27. package/lib/CodeBlock.cjs +35 -35
  28. package/lib/CodeBlock.d.cts +43 -55
  29. package/lib/CodeBlock.d.ts +43 -55
  30. package/lib/CodeBlock.js +605 -590
  31. package/lib/CodeView.cjs +1 -1
  32. package/lib/CodeView.d.cts +44 -56
  33. package/lib/CodeView.d.ts +44 -56
  34. package/lib/CodeView.js +49 -21
  35. package/lib/Color.cjs +1 -1
  36. package/lib/Color.d.cts +47 -55
  37. package/lib/Color.d.ts +47 -55
  38. package/lib/Color.js +123 -79
  39. package/lib/Column.cjs +1 -0
  40. package/lib/{Document.d.cts → Column.d.cts} +49 -58
  41. package/lib/{Document.d.ts → Column.d.ts} +49 -58
  42. package/lib/Column.js +217 -0
  43. package/lib/{Drawer-CaAfmqNo.js → Drawer-DZ5jvmrX.js} +404 -394
  44. package/lib/Drawer-SRhwOc6T.cjs +1 -0
  45. package/lib/Drawer.cjs +1 -1
  46. package/lib/Drawer.d.cts +43 -55
  47. package/lib/Drawer.d.ts +43 -55
  48. package/lib/Drawer.js +6 -5
  49. package/lib/Emoji.cjs +1 -1
  50. package/lib/Emoji.d.cts +43 -60
  51. package/lib/Emoji.d.ts +43 -60
  52. package/lib/Emoji.js +377 -392
  53. package/lib/Excalidraw-DwBRXEtC.js +345 -0
  54. package/lib/Excalidraw-ZN3DQvDC.cjs +1 -0
  55. package/lib/Excalidraw.cjs +1 -1
  56. package/lib/Excalidraw.d.cts +43 -55
  57. package/lib/Excalidraw.d.ts +43 -55
  58. package/lib/Excalidraw.js +6 -4
  59. package/lib/ExportPdf.cjs +5 -5
  60. package/lib/ExportPdf.d.cts +43 -55
  61. package/lib/ExportPdf.d.ts +43 -55
  62. package/lib/ExportPdf.js +60 -32
  63. package/lib/ExportWord.cjs +1 -1
  64. package/lib/ExportWord.d.cts +44 -56
  65. package/lib/ExportWord.d.ts +44 -56
  66. package/lib/ExportWord.js +84 -21
  67. package/lib/FontFamily.cjs +1 -1
  68. package/lib/FontFamily.d.cts +57 -58
  69. package/lib/FontFamily.d.ts +57 -58
  70. package/lib/FontFamily.js +72 -74
  71. package/lib/FontSize.cjs +1 -1
  72. package/lib/FontSize.d.cts +54 -58
  73. package/lib/FontSize.d.ts +54 -58
  74. package/lib/FontSize.js +72 -64
  75. package/lib/Heading.cjs +1 -1
  76. package/lib/Heading.d.cts +57 -55
  77. package/lib/Heading.d.ts +57 -55
  78. package/lib/Heading.js +91 -73
  79. package/lib/Highlight.cjs +1 -1
  80. package/lib/Highlight.d.cts +47 -55
  81. package/lib/Highlight.d.ts +47 -55
  82. package/lib/Highlight.js +152 -21
  83. package/lib/History.cjs +1 -1
  84. package/lib/History.d.cts +45 -55
  85. package/lib/History.d.ts +45 -55
  86. package/lib/History.js +976 -53
  87. package/lib/HorizontalRule.cjs +1 -1
  88. package/lib/HorizontalRule.d.cts +43 -55
  89. package/lib/HorizontalRule.d.ts +43 -55
  90. package/lib/HorizontalRule.js +97 -17
  91. package/lib/Icon-DUpv2cI6.cjs +1 -0
  92. package/lib/Icon-jKs8Hr6p.js +11 -0
  93. package/lib/Iframe-CmXkEqOd.js +431 -0
  94. package/lib/Iframe-Cvca2G7X.cjs +1 -0
  95. package/lib/Iframe.cjs +1 -1
  96. package/lib/Iframe.d.cts +42 -61
  97. package/lib/Iframe.d.ts +42 -61
  98. package/lib/Iframe.js +6 -4
  99. package/lib/Image.cjs +1 -1
  100. package/lib/Image.d.cts +43 -56
  101. package/lib/Image.d.ts +43 -56
  102. package/lib/Image.js +848 -5
  103. package/lib/ImageGif.cjs +1 -1
  104. package/lib/ImageGif.d.cts +44 -58
  105. package/lib/ImageGif.d.ts +44 -58
  106. package/lib/ImageGif.js +424 -5
  107. package/lib/ImportWord.cjs +48 -48
  108. package/lib/ImportWord.d.cts +44 -56
  109. package/lib/ImportWord.d.ts +44 -56
  110. package/lib/ImportWord.js +2596 -2588
  111. package/lib/Indent.cjs +1 -1
  112. package/lib/Indent.d.cts +43 -55
  113. package/lib/Indent.d.ts +43 -55
  114. package/lib/Indent.js +97 -27
  115. package/lib/Italic.cjs +1 -1
  116. package/lib/Italic.d.cts +43 -55
  117. package/lib/Italic.d.ts +43 -55
  118. package/lib/Italic.js +47 -19
  119. package/lib/Katex-DsYXsjSS.js +2740 -0
  120. package/lib/Katex-XfrNne6U.cjs +4 -0
  121. package/lib/Katex.cjs +1 -1
  122. package/lib/Katex.d.cts +43 -55
  123. package/lib/Katex.d.ts +43 -55
  124. package/lib/Katex.js +5 -196
  125. package/lib/LineHeight.cjs +1 -1
  126. package/lib/LineHeight.d.cts +45 -61
  127. package/lib/LineHeight.d.ts +45 -61
  128. package/lib/LineHeight.js +71 -112
  129. package/lib/Link.cjs +1 -1
  130. package/lib/Link.d.cts +44 -58
  131. package/lib/Link.d.ts +44 -58
  132. package/lib/Link.js +3 -3
  133. package/lib/LinkEditBlock-BZenZq-Z.cjs +5 -0
  134. package/lib/LinkEditBlock-CB8yIffE.js +1241 -0
  135. package/lib/Mention.cjs +1 -1
  136. package/lib/Mention.d.cts +40 -55
  137. package/lib/Mention.d.ts +40 -55
  138. package/lib/Mention.js +114 -130
  139. package/lib/Mermaid.cjs +2 -2
  140. package/lib/Mermaid.d.cts +43 -55
  141. package/lib/Mermaid.d.ts +43 -55
  142. package/lib/Mermaid.js +177 -165
  143. package/lib/MoreMark.cjs +1 -1
  144. package/lib/MoreMark.d.cts +58 -57
  145. package/lib/MoreMark.d.ts +58 -57
  146. package/lib/MoreMark.js +125 -55
  147. package/lib/OrderedList.cjs +1 -1
  148. package/lib/OrderedList.d.cts +43 -55
  149. package/lib/OrderedList.d.ts +43 -55
  150. package/lib/OrderedList.js +37 -9
  151. package/lib/SearchAndReplace.cjs +1 -1
  152. package/lib/SearchAndReplace.d.cts +43 -58
  153. package/lib/SearchAndReplace.d.ts +43 -58
  154. package/lib/SearchAndReplace.js +221 -197
  155. package/lib/SlashCommand.cjs +1 -1
  156. package/lib/SlashCommand.d.cts +55 -62
  157. package/lib/SlashCommand.d.ts +55 -62
  158. package/lib/SlashCommand.js +235 -249
  159. package/lib/Strike.cjs +1 -1
  160. package/lib/Strike.d.cts +43 -55
  161. package/lib/Strike.d.ts +43 -55
  162. package/lib/Strike.js +39 -11
  163. package/lib/Table-B1j1Ebmh.cjs +9 -0
  164. package/lib/Table-Db8TcQX8.js +1984 -0
  165. package/lib/Table.cjs +1 -9
  166. package/lib/Table.d.cts +44 -58
  167. package/lib/Table.d.ts +44 -58
  168. package/lib/Table.js +3 -558
  169. package/lib/TaskList.cjs +1 -1
  170. package/lib/TaskList.d.cts +43 -55
  171. package/lib/TaskList.d.ts +43 -55
  172. package/lib/TaskList.js +38 -10
  173. package/lib/TextAlign.cjs +1 -1
  174. package/lib/TextAlign.d.cts +56 -55
  175. package/lib/TextAlign.d.ts +56 -55
  176. package/lib/TextAlign.js +108 -101
  177. package/lib/TextDirection.cjs +1 -1
  178. package/lib/TextDirection.d.cts +72 -55
  179. package/lib/TextDirection.d.ts +72 -55
  180. package/lib/TextDirection.js +105 -112
  181. package/lib/TextUnderline.cjs +1 -1
  182. package/lib/TextUnderline.d.cts +43 -55
  183. package/lib/TextUnderline.d.ts +43 -55
  184. package/lib/TextUnderline.js +46 -18
  185. package/lib/{Twitter-BFULyqdR.js → Twitter-CXmmjz9R.js} +536 -498
  186. package/lib/Twitter-CtVTIWJW.cjs +1 -0
  187. package/lib/Twitter.cjs +1 -1
  188. package/lib/Twitter.d.cts +43 -55
  189. package/lib/Twitter.d.ts +43 -55
  190. package/lib/Twitter.js +5 -4
  191. package/lib/Video.cjs +1 -1
  192. package/lib/Video.d.cts +43 -55
  193. package/lib/Video.d.ts +43 -55
  194. package/lib/Video.js +261 -4
  195. package/lib/_commonjsHelpers-BItOPCY9.js +28 -0
  196. package/lib/_commonjsHelpers-BTDuMlIz.cjs +1 -0
  197. package/lib/bubble.cjs +2 -0
  198. package/lib/{bubble-extra.d.cts → bubble.d.cts} +69 -70
  199. package/lib/{bubble-extra.d.ts → bubble.d.ts} +69 -70
  200. package/lib/bubble.js +1925 -0
  201. package/lib/button-B12K7BJ4.cjs +1 -0
  202. package/lib/button-DXMsXUEn.js +43 -0
  203. package/lib/clsx-C11secjj.cjs +1 -0
  204. package/lib/clsx-OuTLNxxd.js +16 -0
  205. package/lib/delete-node-CosiBes5.cjs +1 -0
  206. package/lib/delete-node-IyVmiRbI.js +22 -0
  207. package/lib/dialog-CaCS-W5S.cjs +1 -0
  208. package/lib/dialog-PtQivpHS.js +100 -0
  209. package/lib/dom-dataset-BqoJhJXt.cjs +1 -0
  210. package/lib/dom-dataset-CIEeltF6.js +47 -0
  211. package/lib/dropdown-menu-BPp2Z_U-.js +136 -0
  212. package/lib/dropdown-menu-CdSm4emp.cjs +1 -0
  213. package/lib/file-BLas99n7.js +43 -0
  214. package/lib/file-i7e4nQY2.cjs +1 -0
  215. package/lib/floating-ui.dom-U1vPFQ5f.js +1151 -0
  216. package/lib/floating-ui.dom-VCrc58uF.cjs +1 -0
  217. package/lib/icons-Cllpys39.js +362 -0
  218. package/lib/icons-CqHjeW5T.cjs +1 -0
  219. package/lib/index-BH4bc3jN.cjs +33 -0
  220. package/lib/index-BPfVXs5_.js +2380 -0
  221. package/lib/index-Bnmd0WvY.js +1631 -0
  222. package/lib/{index-Ch6dBBad.js → index-CBce_TWY.js} +40 -42
  223. package/lib/{index-5iBZLua9.cjs → index-D-5U8dY8.cjs} +8 -8
  224. package/lib/{index-ByurDDMv.js → index-D2TUfKkC.js} +2 -2
  225. package/lib/index-DV5kbgRU.cjs +1 -0
  226. package/lib/{index-LmrOdnen.js → index-DYkucCoF.js} +396 -495
  227. package/lib/index-Dfmm6FTT.cjs +1 -0
  228. package/lib/index-DnWWK9F_.js +6374 -0
  229. package/lib/index-DzcKxutn.js +632 -0
  230. package/lib/index-DzvuNTxo.cjs +4 -0
  231. package/lib/{index-BeCTd5v2.cjs → index-N--9MohJ.cjs} +1 -1
  232. package/lib/index-RfTlOzIr.cjs +22 -0
  233. package/lib/index.cjs +132 -1
  234. package/lib/index.d.cts +45 -296
  235. package/lib/index.d.ts +45 -296
  236. package/lib/index.js +243 -2
  237. package/lib/input-_ECRfn3Y.cjs +1 -0
  238. package/lib/input-wJ9PDEzZ.js +21 -0
  239. package/lib/isNumber-ClPupm7P.cjs +1 -0
  240. package/lib/isNumber-fpLGS0AZ.js +15 -0
  241. package/lib/label-BkgAe7IY.cjs +1 -0
  242. package/lib/label-CGdLYWv7.js +19 -0
  243. package/lib/locale-bundle.cjs +1 -1
  244. package/lib/locale-bundle.d.cts +5421 -73
  245. package/lib/locale-bundle.d.ts +5421 -73
  246. package/lib/locale-bundle.js +9 -7
  247. package/lib/popover-BgmUNMHj.cjs +1 -0
  248. package/lib/popover-CAuEW0Mr.js +23 -0
  249. package/lib/separator-CuBW_w98.js +328 -0
  250. package/lib/separator-DRIrVZ2N.cjs +1 -0
  251. package/lib/store-DX599H5W.js +10 -0
  252. package/lib/store-WStcMOiW.cjs +1 -0
  253. package/lib/style.css +1 -1
  254. package/lib/switch-CnLJ7Y-b.cjs +1 -0
  255. package/lib/switch-Coix_FA1.js +27 -0
  256. package/lib/tabs-B5mVSN1I.js +46 -0
  257. package/lib/tabs-BoLCMcCI.cjs +1 -0
  258. package/lib/textarea-B-6zTKQz.cjs +1 -0
  259. package/lib/{textarea-aPtytkDx.js → textarea-DUUM1jZd.js} +1 -1
  260. package/lib/theme-B7aAsK_T.js +15 -0
  261. package/lib/theme-D8_cxGqB.cjs +1 -0
  262. package/lib/throttle-CdwDrFpn.js +249 -0
  263. package/lib/throttle-qX7Yjtsg.cjs +1 -0
  264. package/lib/toggle-Cdp4IT2U.js +85 -0
  265. package/lib/toggle-D41PzQLJ.cjs +1 -0
  266. package/lib/tooltip-BuEiE96N.cjs +1 -0
  267. package/lib/tooltip-CopwsU8q.js +23 -0
  268. package/lib/updatePosition-8Sdem5jb.cjs +1 -0
  269. package/lib/updatePosition-BPmcE0YD.js +215 -0
  270. package/lib/use-toast-Bz3QCOtE.cjs +1 -0
  271. package/lib/use-toast-Crf7-q5H.js +98 -0
  272. package/lib/useButtonProps-BsEd4zYM.js +141 -0
  273. package/lib/useButtonProps-C6Vpn190.cjs +1 -0
  274. package/package.json +22 -105
  275. package/lib/ActionMenuButton-CYdM1xx5.cjs +0 -1
  276. package/lib/ActionMenuButton-DKRF6oa0.js +0 -33
  277. package/lib/BaseKit.cjs +0 -3
  278. package/lib/BaseKit.d.cts +0 -481
  279. package/lib/BaseKit.d.ts +0 -481
  280. package/lib/BaseKit.js +0 -132
  281. package/lib/Document.cjs +0 -1
  282. package/lib/Document.js +0 -9
  283. package/lib/Drawer-CdvCMSzN.cjs +0 -1
  284. package/lib/Excalidraw-BbMQhNvs.cjs +0 -1
  285. package/lib/Excalidraw-CVWz2Vyn.js +0 -290
  286. package/lib/FormatPainter.cjs +0 -1
  287. package/lib/FormatPainter.d.cts +0 -372
  288. package/lib/FormatPainter.d.ts +0 -372
  289. package/lib/FormatPainter.js +0 -76
  290. package/lib/ListItem.cjs +0 -1
  291. package/lib/ListItem.d.cts +0 -290
  292. package/lib/ListItem.d.ts +0 -290
  293. package/lib/ListItem.js +0 -7
  294. package/lib/MultiColumn.cjs +0 -1
  295. package/lib/MultiColumn.d.cts +0 -294
  296. package/lib/MultiColumn.d.ts +0 -294
  297. package/lib/MultiColumn.js +0 -8
  298. package/lib/RichTextEditor-CxvwGvQG.cjs +0 -142
  299. package/lib/RichTextEditor-DGcKEUGr.js +0 -22166
  300. package/lib/Selection.cjs +0 -1
  301. package/lib/Selection.d.cts +0 -289
  302. package/lib/Selection.d.ts +0 -289
  303. package/lib/Selection.js +0 -25
  304. package/lib/SubAndSuperScript.cjs +0 -1
  305. package/lib/SubAndSuperScript.d.cts +0 -377
  306. package/lib/SubAndSuperScript.d.ts +0 -377
  307. package/lib/SubAndSuperScript.js +0 -43
  308. package/lib/TableOfContent.cjs +0 -1
  309. package/lib/TableOfContent.d.cts +0 -291
  310. package/lib/TableOfContent.d.ts +0 -291
  311. package/lib/TableOfContent.js +0 -185
  312. package/lib/TextBubble.cjs +0 -1
  313. package/lib/TextBubble.d.cts +0 -362
  314. package/lib/TextBubble.d.ts +0 -362
  315. package/lib/TextBubble.js +0 -133
  316. package/lib/TrailingNode.cjs +0 -1
  317. package/lib/TrailingNode.d.cts +0 -297
  318. package/lib/TrailingNode.d.ts +0 -297
  319. package/lib/TrailingNode.js +0 -41
  320. package/lib/Twitter-Cutpkh3h.cjs +0 -1
  321. package/lib/bubble-extra.cjs +0 -2
  322. package/lib/bubble-extra.js +0 -631
  323. package/lib/dom-dataset-_6-diIRQ.cjs +0 -33
  324. package/lib/dom-dataset-lYeH6gfI.js +0 -2361
  325. package/lib/index-6D1J-A-o.cjs +0 -1
  326. package/lib/index-B96Cclrj.cjs +0 -3
  327. package/lib/index-BBz7Nmv9.js +0 -55
  328. package/lib/index-CUogRI7j.cjs +0 -1
  329. package/lib/index-DF2Lp4HZ.cjs +0 -100
  330. package/lib/index-D_L6n8O8.js +0 -76
  331. package/lib/index-Dbvi-Bvh.cjs +0 -1
  332. package/lib/index-DpCrt7xs.cjs +0 -1
  333. package/lib/index-DsAX1Vq8.cjs +0 -1
  334. package/lib/index-Dy4DlW9o.js +0 -12
  335. package/lib/index-J3jHHZ4d.js +0 -200
  336. package/lib/index-VvXaaKe3.js +0 -898
  337. package/lib/index-kbO3iWqL.js +0 -13432
  338. package/lib/textarea-DFo_aXnj.cjs +0 -1
@@ -1,76 +0,0 @@
1
- import { M as r, m as e } from "./index-kbO3iWqL.js";
2
- var u = r.create({
3
- name: "subscript",
4
- addOptions() {
5
- return {
6
- HTMLAttributes: {}
7
- };
8
- },
9
- parseHTML() {
10
- return [
11
- {
12
- tag: "sub"
13
- },
14
- {
15
- style: "vertical-align",
16
- getAttrs(t) {
17
- return t !== "sub" ? !1 : null;
18
- }
19
- }
20
- ];
21
- },
22
- renderHTML({ HTMLAttributes: t }) {
23
- return ["sub", e(this.options.HTMLAttributes, t), 0];
24
- },
25
- addCommands() {
26
- return {
27
- setSubscript: () => ({ commands: t }) => t.setMark(this.name),
28
- toggleSubscript: () => ({ commands: t }) => t.toggleMark(this.name),
29
- unsetSubscript: () => ({ commands: t }) => t.unsetMark(this.name)
30
- };
31
- },
32
- addKeyboardShortcuts() {
33
- return {
34
- "Mod-,": () => this.editor.commands.toggleSubscript()
35
- };
36
- }
37
- }), a = r.create({
38
- name: "superscript",
39
- addOptions() {
40
- return {
41
- HTMLAttributes: {}
42
- };
43
- },
44
- parseHTML() {
45
- return [
46
- {
47
- tag: "sup"
48
- },
49
- {
50
- style: "vertical-align",
51
- getAttrs(t) {
52
- return t !== "super" ? !1 : null;
53
- }
54
- }
55
- ];
56
- },
57
- renderHTML({ HTMLAttributes: t }) {
58
- return ["sup", e(this.options.HTMLAttributes, t), 0];
59
- },
60
- addCommands() {
61
- return {
62
- setSuperscript: () => ({ commands: t }) => t.setMark(this.name),
63
- toggleSuperscript: () => ({ commands: t }) => t.toggleMark(this.name),
64
- unsetSuperscript: () => ({ commands: t }) => t.unsetMark(this.name)
65
- };
66
- },
67
- addKeyboardShortcuts() {
68
- return {
69
- "Mod-.": () => this.editor.commands.toggleSuperscript()
70
- };
71
- }
72
- });
73
- export {
74
- u as S,
75
- a
76
- };
@@ -1 +0,0 @@
1
- "use strict";const t=require("./index-DF2Lp4HZ.cjs");var h=t.Node3.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:r}){return["hr",t.mergeAttributes(this.options.HTMLAttributes,r)]},markdownTokenName:"hr",parseMarkdown:(r,o)=>o.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:r,state:o})=>{if(!t.canInsertNode(o,o.schema.nodes[this.name]))return!1;const{selection:i}=o,{$to:l}=i,s=r();return t.isNodeSelection(i)?s.insertContentAt(l.pos,{type:this.name}):s.insertContent({type:this.name}),s.command(({state:u,tr:e,dispatch:p})=>{if(p){const{$to:n}=e.selection,c=n.end();if(n.nodeAfter)n.nodeAfter.isTextblock?e.setSelection(t.TextSelection.create(e.doc,n.pos+1)):n.nodeAfter.isBlock?e.setSelection(t.NodeSelection.create(e.doc,n.pos)):e.setSelection(t.TextSelection.create(e.doc,n.pos));else{const a=u.schema.nodes[this.options.nextNodeType]||n.parent.type.contentMatch.defaultType,d=a==null?void 0:a.create();d&&(e.insert(c,d),e.setSelection(t.TextSelection.create(e.doc,c+1)))}e.scrollIntoView()}return!0}).run()}}},addInputRules(){return[t.nodeInputRule({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}});exports.HorizontalRule=h;
@@ -1 +0,0 @@
1
- "use strict";const w=require("./index-DF2Lp4HZ.cjs");function G(p){var c;const{char:D,allowSpaces:b,allowToIncludeChar:P,allowedPrefixes:_,startOfLine:F,$position:v}=p,B=b&&!P,m=w.escapeForRegEx(D),K=new RegExp(`\\s${m}$`),y=F?"^":"",M=P?"":m,N=B?new RegExp(`${y}${m}.*?(?=\\s${M}|$)`,"gm"):new RegExp(`${y}(?:^)?${m}[^\\s${M}]*`,"gm"),h=((c=v.nodeBefore)==null?void 0:c.isText)&&v.nodeBefore.text;if(!h)return null;const O=v.pos-h.length,l=Array.from(h.matchAll(N)).pop();if(!l||l.input===void 0||l.index===void 0)return null;const e=l.input.slice(Math.max(0,l.index-1),l.index),j=new RegExp(`^[${_==null?void 0:_.join("")}\0]?$`).test(e);if(_!==null&&!j)return null;const S=O+l.index;let x=S+l[0].length;return B&&K.test(h.slice(x-1,x+1))&&(l[0]+=" ",x+=1),S<v.pos&&x>=v.pos?{range:{from:S,to:x},query:l[0].slice(D.length),text:l[0]}:null}var H=new w.PluginKey("suggestion");function L({pluginKey:p=H,editor:c,char:D="@",allowSpaces:b=!1,allowToIncludeChar:P=!1,allowedPrefixes:_=[" "],startOfLine:F=!1,decorationTag:v="span",decorationClass:B="suggestion",decorationContent:m="",decorationEmptyClass:K="is-empty",command:y=()=>null,items:M=()=>[],render:N=()=>({}),allow:h=()=>!0,findSuggestionMatch:O=G}){let l;const e=N==null?void 0:N(),j=()=>{const n=c.state.selection.$anchor.pos,a=c.view.coordsAtPos(n),{top:r,right:s,bottom:o,left:i}=a;try{return new DOMRect(i,r,s-i,o-r)}catch{return null}},S=(n,a)=>a?()=>{const r=p.getState(c.state),s=r==null?void 0:r.decorationId,o=n.dom.querySelector(`[data-decoration-id="${s}"]`);return(o==null?void 0:o.getBoundingClientRect())||null}:j;function x(n,a){var r;try{const o=p.getState(n.state),i=o!=null&&o.decorationId?n.dom.querySelector(`[data-decoration-id="${o.decorationId}"]`):null,u={editor:c,range:(o==null?void 0:o.range)||{from:0,to:0},query:(o==null?void 0:o.query)||null,text:(o==null?void 0:o.text)||null,items:[],command:f=>y({editor:c,range:(o==null?void 0:o.range)||{from:0,to:0},props:f}),decorationNode:i,clientRect:S(n,i)};(r=e==null?void 0:e.onExit)==null||r.call(e,u)}catch{}const s=n.state.tr.setMeta(a,{exit:!0});n.dispatch(s)}const C=new w.Plugin({key:p,view(){return{update:async(n,a)=>{var r,s,o,i,u,f,q;const t=(r=this.key)==null?void 0:r.getState(a),g=(s=this.key)==null?void 0:s.getState(n.state),d=t.active&&g.active&&t.range.from!==g.range.from,E=!t.active&&g.active,A=t.active&&!g.active,I=!E&&!A&&t.query!==g.query,R=E||d&&I,k=I||d,T=A||d&&I;if(!R&&!k&&!T)return;const $=T&&!R?t:g,U=n.dom.querySelector(`[data-decoration-id="${$.decorationId}"]`);l={editor:c,range:$.range,query:$.query,text:$.text,items:[],command:z=>y({editor:c,range:$.range,props:z}),decorationNode:U,clientRect:S(n,U)},R&&((o=e==null?void 0:e.onBeforeStart)==null||o.call(e,l)),k&&((i=e==null?void 0:e.onBeforeUpdate)==null||i.call(e,l)),(k||R)&&(l.items=await M({editor:c,query:$.query})),T&&((u=e==null?void 0:e.onExit)==null||u.call(e,l)),k&&((f=e==null?void 0:e.onUpdate)==null||f.call(e,l)),R&&((q=e==null?void 0:e.onStart)==null||q.call(e,l))},destroy:()=>{var n;l&&((n=e==null?void 0:e.onExit)==null||n.call(e,l))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(n,a,r,s){const{isEditable:o}=c,{composing:i}=c.view,{selection:u}=n,{empty:f,from:q}=u,t={...a},g=n.getMeta(p);if(g&&g.exit)return t.active=!1,t.decorationId=null,t.range={from:0,to:0},t.query=null,t.text=null,t;if(t.composing=i,o&&(f||c.view.composing)){(q<a.range.from||q>a.range.to)&&!i&&!a.composing&&(t.active=!1);const d=O({char:D,allowSpaces:b,allowToIncludeChar:P,allowedPrefixes:_,startOfLine:F,$position:u.$from}),E=`id_${Math.floor(Math.random()*4294967295)}`;d&&h({editor:c,state:s,range:d.range,isActive:a.active})?(t.active=!0,t.decorationId=a.decorationId?a.decorationId:E,t.range=d.range,t.query=d.query,t.text=d.text):t.active=!1}else t.active=!1;return t.active||(t.decorationId=null,t.range={from:0,to:0},t.query=null,t.text=null),t}},props:{handleKeyDown(n,a){var r,s,o,i;const{active:u,range:f}=C.getState(n.state);if(!u)return!1;if(a.key==="Escape"||a.key==="Esc"){const t=C.getState(n.state),g=(r=l==null?void 0:l.decorationNode)!=null?r:null,d=g??(t!=null&&t.decorationId?n.dom.querySelector(`[data-decoration-id="${t.decorationId}"]`):null);if(((s=e==null?void 0:e.onKeyDown)==null?void 0:s.call(e,{view:n,event:a,range:t.range}))||!1)return!0;const A={editor:c,range:t.range,query:t.query,text:t.text,items:[],command:I=>y({editor:c,range:t.range,props:I}),decorationNode:d,clientRect:d?()=>d.getBoundingClientRect()||null:null};return(o=e==null?void 0:e.onExit)==null||o.call(e,A),x(n,p),!0}return((i=e==null?void 0:e.onKeyDown)==null?void 0:i.call(e,{view:n,event:a,range:f}))||!1},decorations(n){const{active:a,range:r,decorationId:s,query:o}=C.getState(n);if(!a)return null;const i=!(o!=null&&o.length),u=[B];return i&&u.push(K),w.DecorationSet.create(n.doc,[w.Decoration.inline(r.from,r.to,{nodeName:v,class:u.join(" "),"data-decoration-id":s,"data-decoration-content":m})])}}});return C}var J=L;exports.Suggestion=L;exports.index_default=J;
@@ -1 +0,0 @@
1
- "use strict";const d=require("./index-DF2Lp4HZ.cjs");function L(i={}){return new d.Plugin({view(e){return new G(e,i)}})}class G{constructor(e,t){var n;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(n=t.width)!==null&&n!==void 0?n:1,this.color=t.color===!1?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(r=>{let s=o=>{this[r](o)};return e.dom.addEventListener(r,s),{name:r,handler:s}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,n,r=this.editorView.dom,s=r.getBoundingClientRect(),o=s.width/r.offsetWidth,l=s.height/r.offsetHeight;if(t){let c=e.nodeBefore,h=e.nodeAfter;if(c||h){let m=this.editorView.nodeDOM(this.cursorPos-(c?c.nodeSize:0));if(m){let v=m.getBoundingClientRect(),E=c?v.bottom:v.top;c&&h&&(E=(E+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let x=this.width/2*l;n={left:v.left,right:v.right,top:E-x,bottom:E+x}}}}if(!n){let c=this.editorView.coordsAtPos(this.cursorPos),h=this.width/2*o;n={left:c.left-h,right:c.left+h,top:c.top,bottom:c.bottom}}let a=this.editorView.dom.offsetParent;this.element||(this.element=a.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",t),this.element.classList.toggle("prosemirror-dropcursor-inline",!t);let u,p;if(!a||a==document.body&&getComputedStyle(a).position=="static")u=-pageXOffset,p=-pageYOffset;else{let c=a.getBoundingClientRect(),h=c.width/a.offsetWidth,m=c.height/a.offsetHeight;u=c.left-a.scrollLeft*h,p=c.top-a.scrollTop*m}this.element.style.left=(n.left-u)/o+"px",this.element.style.top=(n.top-p)/l+"px",this.element.style.width=(n.right-n.left)/o+"px",this.element.style.height=(n.bottom-n.top)/l+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),r=n&&n.type.spec.disableDropCursor,s=typeof r=="function"?r(this.editorView,t,e):r;if(t&&!s){let o=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=d.dropPoint(this.editorView.state.doc,o,this.editorView.dragging.slice);l!=null&&(o=l)}this.setCursor(o),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class f extends d.Selection{constructor(e){super(e,e)}map(e,t){let n=e.resolve(t.map(this.head));return f.valid(n)?new f(n):d.Selection.near(n)}content(){return d.Slice.empty}eq(e){return e instanceof f&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new f(e.resolve(t.pos))}getBookmark(){return new O(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!B(e)||!K(e))return!1;let n=t.type.spec.allowGapCursor;if(n!=null)return n;let r=t.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(e,t,n=!1){e:for(;;){if(!n&&f.valid(e))return e;let r=e.pos,s=null;for(let o=e.depth;;o--){let l=e.node(o);if(t>0?e.indexAfter(o)<l.childCount:e.index(o)>0){s=l.child(t>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;r+=t;let a=e.doc.resolve(r);if(f.valid(a))return a}for(;;){let o=t>0?s.firstChild:s.lastChild;if(!o){if(s.isAtom&&!s.isText&&!d.NodeSelection.isSelectable(s)){e=e.doc.resolve(r+s.nodeSize*t),n=!1;continue e}break}s=o,r+=t;let l=e.doc.resolve(r);if(f.valid(l))return l}return null}}}f.prototype.visible=!1;f.findFrom=f.findGapCursorFrom;d.Selection.jsonID("gapcursor",f);class O{constructor(e){this.pos=e}map(e){return new O(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return f.valid(t)?new f(t):d.Selection.near(t)}}function N(i){return i.isAtom||i.spec.isolating||i.spec.createGapCursor}function B(i){for(let e=i.depth;e>=0;e--){let t=i.index(e),n=i.node(e);if(t==0){if(n.type.spec.isolating)return!0;continue}for(let r=n.child(t-1);;r=r.lastChild){if(r.childCount==0&&!r.inlineContent||N(r.type))return!0;if(r.inlineContent)return!1}}return!0}function K(i){for(let e=i.depth;e>=0;e--){let t=i.indexAfter(e),n=i.node(e);if(t==n.childCount){if(n.type.spec.isolating)return!0;continue}for(let r=n.child(t);;r=r.firstChild){if(r.childCount==0&&!r.inlineContent||N(r.type))return!0;if(r.inlineContent)return!1}}return!0}function _(){return new d.Plugin({props:{decorations:U,createSelectionBetween(i,e,t){return e.pos==t.pos&&f.valid(t)?new f(t):null},handleClick:W,handleKeyDown:H,handleDOMEvents:{beforeinput:j}}})}const H=d.keydownHandler({ArrowLeft:M("horiz",-1),ArrowRight:M("horiz",1),ArrowUp:M("vert",-1),ArrowDown:M("vert",1)});function M(i,e){const t=i=="vert"?e>0?"down":"up":e>0?"right":"left";return function(n,r,s){let o=n.selection,l=e>0?o.$to:o.$from,a=o.empty;if(o instanceof d.TextSelection){if(!s.endOfTextblock(t)||l.depth==0)return!1;a=!1,l=n.doc.resolve(e>0?l.after():l.before())}let u=f.findGapCursorFrom(l,e,a);return u?(r&&r(n.tr.setSelection(new f(u))),!0):!1}}function W(i,e,t){if(!i||!i.editable)return!1;let n=i.state.doc.resolve(e);if(!f.valid(n))return!1;let r=i.posAtCoords({left:t.clientX,top:t.clientY});return r&&r.inside>-1&&d.NodeSelection.isSelectable(i.state.doc.nodeAt(r.inside))?!1:(i.dispatch(i.state.tr.setSelection(new f(n))),!0)}function j(i,e){if(e.inputType!="insertCompositionText"||!(i.state.selection instanceof f))return!1;let{$from:t}=i.state.selection,n=t.parent.contentMatchAt(t.index()).findWrapping(i.state.schema.nodes.text);if(!n)return!1;let r=d.Fragment.empty;for(let o=n.length-1;o>=0;o--)r=d.Fragment.from(n[o].createAndFill(null,r));let s=i.state.tr.replace(t.pos,t.pos,new d.Slice(r,0,0));return s.setSelection(d.TextSelection.near(s.doc.resolve(t.pos+1))),i.dispatch(s),!1}function U(i){if(!(i.selection instanceof f))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",d.DecorationSet.create(i.doc,[d.Decoration.widget(i.selection.head,e,{key:"gapcursor"})])}var I=200,g=function(){};g.prototype.append=function(e){return e.length?(e=g.from(e),!this.length&&e||e.length<I&&this.leafAppend(e)||this.length<I&&e.leafPrepend(this)||this.appendInner(e)):this};g.prototype.prepend=function(e){return e.length?g.from(e).append(this):this};g.prototype.appendInner=function(e){return new X(this,e)};g.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?g.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};g.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};g.prototype.forEach=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)};g.prototype.map=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length);var r=[];return this.forEach(function(s,o){return r.push(e(s,o))},t,n),r};g.from=function(e){return e instanceof g?e:e&&e.length?new z(e):g.empty};var z=(function(i){function e(n){i.call(this),this.values=n}i&&(e.__proto__=i),e.prototype=Object.create(i&&i.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(r,s){return r==0&&s==this.length?this:new e(this.values.slice(r,s))},e.prototype.getInner=function(r){return this.values[r]},e.prototype.forEachInner=function(r,s,o,l){for(var a=s;a<o;a++)if(r(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(r,s,o,l){for(var a=s-1;a>=o;a--)if(r(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(r){if(this.length+r.length<=I)return new e(this.values.concat(r.flatten()))},e.prototype.leafPrepend=function(r){if(this.length+r.length<=I)return new e(r.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e})(g);g.empty=new z([]);var X=(function(i){function e(t,n){i.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return i&&(e.__proto__=i),e.prototype=Object.create(i&&i.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(n){return n<this.left.length?this.left.get(n):this.right.get(n-this.left.length)},e.prototype.forEachInner=function(n,r,s,o){var l=this.left.length;if(r<l&&this.left.forEachInner(n,r,Math.min(s,l),o)===!1||s>l&&this.right.forEachInner(n,Math.max(r-l,0),Math.min(this.length,s)-l,o+l)===!1)return!1},e.prototype.forEachInvertedInner=function(n,r,s,o){var l=this.left.length;if(r>l&&this.right.forEachInvertedInner(n,r-l,Math.max(s,l)-l,o+l)===!1||s<l&&this.left.forEachInvertedInner(n,Math.min(r,l),s,o)===!1)return!1},e.prototype.sliceInner=function(n,r){if(n==0&&r==this.length)return this;var s=this.left.length;return r<=s?this.left.slice(n,r):n>=s?this.right.slice(n-s,r-s):this.left.slice(n,s).append(this.right.slice(0,r-s))},e.prototype.leafAppend=function(n){var r=this.right.leafAppend(n);if(r)return new e(this.left,r)},e.prototype.leafPrepend=function(n){var r=this.left.leafPrepend(n);if(r)return new e(r,this.right)},e.prototype.appendInner=function(n){return this.left.depth>=Math.max(this.right.depth,n.depth)+1?new e(this.left,new e(this.right,n)):new e(this,n)},e})(g);const Y=500;class w{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let n=this.items.length;for(;;n--)if(this.items.get(n-1).selection){--n;break}let r,s;t&&(r=this.remapping(n,this.items.length),s=r.maps.length);let o=e.tr,l,a,u=[],p=[];return this.items.forEach((c,h)=>{if(!c.step){r||(r=this.remapping(n,h+1),s=r.maps.length),s--,p.push(c);return}if(r){p.push(new y(c.map));let m=c.step.map(r.slice(s)),v;m&&o.maybeStep(m).doc&&(v=o.mapping.maps[o.mapping.maps.length-1],u.push(new y(v,void 0,void 0,u.length+p.length))),s--,v&&r.appendMap(v,s)}else o.maybeStep(c.step);if(c.selection)return l=r?c.selection.map(r.slice(s)):c.selection,a=new w(this.items.slice(0,n).append(p.reverse().concat(u)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:o,selection:l}}addTransform(e,t,n,r){let s=[],o=this.eventCount,l=this.items,a=!r&&l.length?l.get(l.length-1):null;for(let p=0;p<e.steps.length;p++){let c=e.steps[p].invert(e.docs[p]),h=new y(e.mapping.maps[p],c,t),m;(m=a&&a.merge(h))&&(h=m,p?s.pop():l=l.slice(0,l.length-1)),s.push(h),t&&(o++,t=void 0),r||(a=h)}let u=o-n.depth;return u>Z&&(l=J(l,u),o-=u),new w(l.append(s),o)}remapping(e,t){let n=new d.Mapping;return this.items.forEach((r,s)=>{let o=r.mirrorOffset!=null&&s-r.mirrorOffset>=e?n.maps.length-r.mirrorOffset:void 0;n.appendMap(r.map,o)},e,t),n}addMaps(e){return this.eventCount==0?this:new w(this.items.append(e.map(t=>new y(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let n=[],r=Math.max(0,this.items.length-t),s=e.mapping,o=e.steps.length,l=this.eventCount;this.items.forEach(h=>{h.selection&&l--},r);let a=t;this.items.forEach(h=>{let m=s.getMirror(--a);if(m==null)return;o=Math.min(o,m);let v=s.maps[m];if(h.step){let E=e.steps[m].invert(e.docs[m]),x=h.selection&&h.selection.map(s.slice(a+1,m));x&&l++,n.push(new y(v,E,x))}else n.push(new y(v))},r);let u=[];for(let h=t;h<o;h++)u.push(new y(s.maps[h]));let p=this.items.slice(0,r).append(u).append(n),c=new w(p,l);return c.emptyItemCount()>Y&&(c=c.compress(this.items.length-n.length)),c}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),n=t.maps.length,r=[],s=0;return this.items.forEach((o,l)=>{if(l>=e)r.push(o),o.selection&&s++;else if(o.step){let a=o.step.map(t.slice(n)),u=a&&a.getMap();if(n--,u&&t.appendMap(u,n),a){let p=o.selection&&o.selection.map(t.slice(n));p&&s++;let c=new y(u.invert(),a,p),h,m=r.length-1;(h=r.length&&r[m].merge(c))?r[m]=h:r.push(c)}}else o.map&&n--},this.items.length,0),new w(g.from(r.reverse()),s)}}w.empty=new w(g.empty,0);function J(i,e){let t;return i.forEach((n,r)=>{if(n.selection&&e--==0)return t=r,!1}),i.slice(t)}class y{constructor(e,t,n,r){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=r}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new y(t.getMap().invert(),t,this.selection)}}}class C{constructor(e,t,n,r,s){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=r,this.prevComposition=s}}const Z=20;function Q(i,e,t,n){let r=t.getMeta(P),s;if(r)return r.historyState;t.getMeta(ee)&&(i=new C(i.done,i.undone,null,0,-1));let o=t.getMeta("appendedTransaction");if(t.steps.length==0)return i;if(o&&o.getMeta(P))return o.getMeta(P).redo?new C(i.done.addTransform(t,void 0,n,S(e)),i.undone,A(t.mapping.maps),i.prevTime,i.prevComposition):new C(i.done,i.undone.addTransform(t,void 0,n,S(e)),null,i.prevTime,i.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let l=t.getMeta("composition"),a=i.prevTime==0||!o&&i.prevComposition!=l&&(i.prevTime<(t.time||0)-n.newGroupDelay||!q(t,i.prevRanges)),u=o?b(i.prevRanges,t.mapping):A(t.mapping.maps);return new C(i.done.addTransform(t,a?e.selection.getBookmark():void 0,n,S(e)),w.empty,u,t.time,l??i.prevComposition)}else return(s=t.getMeta("rebased"))?new C(i.done.rebased(t,s),i.undone.rebased(t,s),b(i.prevRanges,t.mapping),i.prevTime,i.prevComposition):new C(i.done.addMaps(t.mapping.maps),i.undone.addMaps(t.mapping.maps),b(i.prevRanges,t.mapping),i.prevTime,i.prevComposition)}function q(i,e){if(!e)return!1;if(!i.docChanged)return!0;let t=!1;return i.mapping.maps[0].forEach((n,r)=>{for(let s=0;s<e.length;s+=2)n<=e[s+1]&&r>=e[s]&&(t=!0)}),t}function A(i){let e=[];for(let t=i.length-1;t>=0&&e.length==0;t--)i[t].forEach((n,r,s,o)=>e.push(s,o));return e}function b(i,e){if(!i)return null;let t=[];for(let n=0;n<i.length;n+=2){let r=e.map(i[n],1),s=e.map(i[n+1],-1);r<=s&&t.push(r,s)}return t}function $(i,e,t){let n=S(e),r=P.get(e).spec.config,s=(t?i.undone:i.done).popEvent(e,n);if(!s)return null;let o=s.selection.resolve(s.transform.doc),l=(t?i.done:i.undone).addTransform(s.transform,e.selection.getBookmark(),r,n),a=new C(t?l:s.remaining,t?s.remaining:l,null,0,-1);return s.transform.setSelection(o).setMeta(P,{redo:t,historyState:a})}let T=!1,D=null;function S(i){let e=i.plugins;if(D!=e){T=!1,D=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){T=!0;break}}return T}const P=new d.PluginKey("history"),ee=new d.PluginKey("closeHistory");function te(i={}){return i={depth:i.depth||100,newGroupDelay:i.newGroupDelay||500},new d.Plugin({key:P,state:{init(){return new C(w.empty,w.empty,null,0,-1)},apply(e,t,n){return Q(t,n,e,i)}},config:i,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,r=n=="historyUndo"?R:n=="historyRedo"?V:null;return!r||!e.editable?!1:(t.preventDefault(),r(e.state,e.dispatch))}}}})}function F(i,e){return(t,n)=>{let r=P.getState(t);if(!r||(i?r.undone:r.done).eventCount==0)return!1;if(n){let s=$(r,t,i);s&&n(e?s.scrollIntoView():s)}return!0}}const R=F(!1,!0),V=F(!0,!0);var ne=d.Extension.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:i=>i.length,wordCounter:i=>i.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=i=>{const e=(i==null?void 0:i.node)||this.editor.state.doc;if(((i==null?void 0:i.mode)||this.options.mode)==="textSize"){const n=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(n)}return e.nodeSize},this.storage.words=i=>{const e=(i==null?void 0:i.node)||this.editor.state.doc,t=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(t)}},addProseMirrorPlugins(){let i=!1;return[new d.Plugin({key:new d.PluginKey("characterCount"),appendTransaction:(e,t,n)=>{if(i)return;const r=this.options.limit;if(r==null||r===0){i=!0;return}const s=this.storage.characters({node:n.doc});if(s>r){const o=s-r,l=0,a=o;console.warn(`[CharacterCount] Initial content exceeded limit of ${r} characters. Content was automatically trimmed.`);const u=n.tr.deleteRange(l,a);return i=!0,u}i=!0},filterTransaction:(e,t)=>{const n=this.options.limit;if(!e.docChanged||n===0||n===null||n===void 0)return!0;const r=this.storage.characters({node:t.doc}),s=this.storage.characters({node:e.doc});if(s<=n||r>n&&s>n&&s<=r)return!0;if(r>n&&s>n&&s>r||!e.getMeta("paste"))return!1;const l=e.selection.$head.pos,a=s-n,u=l-a,p=l;return e.deleteRange(u,p),!(this.storage.characters({node:e.doc})>n)}})]}}),re=d.Extension.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[L(this.options)]}}),ie=d.Extension.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new d.Plugin({key:new d.PluginKey("focus"),props:{decorations:({doc:i,selection:e})=>{const{isEditable:t,isFocused:n}=this.editor,{anchor:r}=e,s=[];if(!t||!n)return d.DecorationSet.create(i,[]);let o=0;this.options.mode==="deepest"&&i.descendants((a,u)=>{if(a.isText)return;if(!(r>=u&&r<=u+a.nodeSize-1))return!1;o+=1});let l=0;return i.descendants((a,u)=>{if(a.isText||!(r>=u&&r<=u+a.nodeSize-1))return!1;if(l+=1,this.options.mode==="deepest"&&o-l>0||this.options.mode==="shallowest"&&l>1)return this.options.mode==="deepest";s.push(d.Decoration.node(u,u+a.nodeSize,{class:this.options.className}))}),d.DecorationSet.create(i,s)}}})]}}),se=d.Extension.create({name:"gapCursor",addProseMirrorPlugins(){return[_()]},extendNodeSchema(i){var e;const t={name:i.name,options:i.options,storage:i.storage};return{allowGapCursor:(e=d.callOrReturn(d.getExtensionField(i,"allowGapCursor",t)))!=null?e:null}}}),oe=d.Extension.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new d.Plugin({key:new d.PluginKey("placeholder"),props:{decorations:({doc:i,selection:e})=>{const t=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:n}=e,r=[];if(!t)return null;const s=this.editor.isEmpty;return i.descendants((o,l)=>{const a=n>=l&&n<=l+o.nodeSize,u=!o.isLeaf&&d.isNodeEmpty(o);if((a||!this.options.showOnlyCurrent)&&u){const p=[this.options.emptyNodeClass];s&&p.push(this.options.emptyEditorClass);const c=d.Decoration.node(l,l+o.nodeSize,{class:p.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:o,pos:l,hasAnchor:a}):this.options.placeholder});r.push(c)}return this.options.includeChildren}),d.DecorationSet.create(i,r)}}})]}}),le=d.Extension.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:i,options:e}=this;return[new d.Plugin({key:new d.PluginKey("selection"),props:{decorations(t){return t.selection.empty||i.isFocused||!i.isEditable||d.isNodeSelection(t.selection)||i.view.dragging?null:d.DecorationSet.create(t.doc,[d.Decoration.inline(t.selection.from,t.selection.to,{class:e.className})])}}})]}});function k({types:i,node:e}){return e&&Array.isArray(i)&&i.includes(e.type)||(e==null?void 0:e.type)===i}var ae=d.Extension.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var i;const e=new d.PluginKey(this.name),t=this.options.node||((i=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:i.name)||"paragraph",n=Object.entries(this.editor.schema.nodes).map(([,r])=>r).filter(r=>(this.options.notAfter||[]).concat(t).includes(r.name));return[new d.Plugin({key:e,appendTransaction:(r,s,o)=>{const{doc:l,tr:a,schema:u}=o,p=e.getState(o),c=l.content.size,h=u.nodes[t];if(p)return a.insert(c,h.create())},state:{init:(r,s)=>{const o=s.tr.doc.lastChild;return!k({node:o,types:n})},apply:(r,s)=>{if(!r.docChanged||r.getMeta("__uniqueIDTransaction"))return s;const o=r.doc.lastChild;return!k({node:o,types:n})}}})]}}),de=d.Extension.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:i,dispatch:e})=>R(i,e),redo:()=>({state:i,dispatch:e})=>V(i,e)}},addProseMirrorPlugins(){return[te(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}});exports.CharacterCount=ne;exports.Dropcursor=re;exports.Focus=ie;exports.Gapcursor=se;exports.Placeholder=oe;exports.Selection=le;exports.TrailingNode=ae;exports.UndoRedo=de;
@@ -1,12 +0,0 @@
1
- import { N as n } from "./index-kbO3iWqL.js";
2
- var o = n.create({
3
- name: "doc",
4
- topNode: !0,
5
- content: "block+",
6
- renderMarkdown: (e, r) => e.content ? r.renderChildren(e.content, `
7
-
8
- `) : ""
9
- });
10
- export {
11
- o as D
12
- };
@@ -1,200 +0,0 @@
1
- import { a as L, P as z, D as G, j as H, k as J } from "./index-kbO3iWqL.js";
2
- function Q(p) {
3
- var c;
4
- const { char: w, allowSpaces: A, allowToIncludeChar: D, allowedPrefixes: _, startOfLine: b, $position: m } = p, P = A && !D, x = J(w), j = new RegExp(`\\s${x}$`), y = b ? "^" : "", B = D ? "" : x, M = P ? new RegExp(`${y}${x}.*?(?=\\s${B}|$)`, "gm") : new RegExp(`${y}(?:^)?${x}[^\\s${B}]*`, "gm"), h = ((c = m.nodeBefore) == null ? void 0 : c.isText) && m.nodeBefore.text;
5
- if (!h)
6
- return null;
7
- const F = m.pos - h.length, a = Array.from(h.matchAll(M)).pop();
8
- if (!a || a.input === void 0 || a.index === void 0)
9
- return null;
10
- const e = a.input.slice(Math.max(0, a.index - 1), a.index), K = new RegExp(`^[${_ == null ? void 0 : _.join("")}\0]?$`).test(e);
11
- if (_ !== null && !K)
12
- return null;
13
- const S = F + a.index;
14
- let v = S + a[0].length;
15
- return P && j.test(h.slice(v - 1, v + 1)) && (a[0] += " ", v += 1), S < m.pos && v >= m.pos ? {
16
- range: {
17
- from: S,
18
- to: v
19
- },
20
- query: a[0].slice(w.length),
21
- text: a[0]
22
- } : null;
23
- }
24
- var V = new L("suggestion");
25
- function W({
26
- pluginKey: p = V,
27
- editor: c,
28
- char: w = "@",
29
- allowSpaces: A = !1,
30
- allowToIncludeChar: D = !1,
31
- allowedPrefixes: _ = [" "],
32
- startOfLine: b = !1,
33
- decorationTag: m = "span",
34
- decorationClass: P = "suggestion",
35
- decorationContent: x = "",
36
- decorationEmptyClass: j = "is-empty",
37
- command: y = () => null,
38
- items: B = () => [],
39
- render: M = () => ({}),
40
- allow: h = () => !0,
41
- findSuggestionMatch: F = Q
42
- }) {
43
- let a;
44
- const e = M == null ? void 0 : M(), K = () => {
45
- const n = c.state.selection.$anchor.pos, l = c.view.coordsAtPos(n), { top: r, right: s, bottom: o, left: i } = l;
46
- try {
47
- return new DOMRect(i, r, s - i, o - r);
48
- } catch {
49
- return null;
50
- }
51
- }, S = (n, l) => l ? () => {
52
- const r = p.getState(c.state), s = r == null ? void 0 : r.decorationId, o = n.dom.querySelector(`[data-decoration-id="${s}"]`);
53
- return (o == null ? void 0 : o.getBoundingClientRect()) || null;
54
- } : K;
55
- function v(n, l) {
56
- var r;
57
- try {
58
- const o = p.getState(n.state), i = o != null && o.decorationId ? n.dom.querySelector(`[data-decoration-id="${o.decorationId}"]`) : null, u = {
59
- // @ts-ignore editor is available in closure
60
- editor: c,
61
- range: (o == null ? void 0 : o.range) || { from: 0, to: 0 },
62
- query: (o == null ? void 0 : o.query) || null,
63
- text: (o == null ? void 0 : o.text) || null,
64
- items: [],
65
- command: (f) => y({ editor: c, range: (o == null ? void 0 : o.range) || { from: 0, to: 0 }, props: f }),
66
- decorationNode: i,
67
- clientRect: S(n, i)
68
- };
69
- (r = e == null ? void 0 : e.onExit) == null || r.call(e, u);
70
- } catch {
71
- }
72
- const s = n.state.tr.setMeta(l, { exit: !0 });
73
- n.dispatch(s);
74
- }
75
- const N = new z({
76
- key: p,
77
- view() {
78
- return {
79
- update: async (n, l) => {
80
- var r, s, o, i, u, f, q;
81
- const t = (r = this.key) == null ? void 0 : r.getState(l), g = (s = this.key) == null ? void 0 : s.getState(n.state), d = t.active && g.active && t.range.from !== g.range.from, E = !t.active && g.active, C = t.active && !g.active, I = !E && !C && t.query !== g.query, R = E || d && I, k = I || d, O = C || d && I;
82
- if (!R && !k && !O)
83
- return;
84
- const $ = O && !R ? t : g, T = n.dom.querySelector(`[data-decoration-id="${$.decorationId}"]`);
85
- a = {
86
- editor: c,
87
- range: $.range,
88
- query: $.query,
89
- text: $.text,
90
- items: [],
91
- command: (U) => y({
92
- editor: c,
93
- range: $.range,
94
- props: U
95
- }),
96
- decorationNode: T,
97
- clientRect: S(n, T)
98
- }, R && ((o = e == null ? void 0 : e.onBeforeStart) == null || o.call(e, a)), k && ((i = e == null ? void 0 : e.onBeforeUpdate) == null || i.call(e, a)), (k || R) && (a.items = await B({
99
- editor: c,
100
- query: $.query
101
- })), O && ((u = e == null ? void 0 : e.onExit) == null || u.call(e, a)), k && ((f = e == null ? void 0 : e.onUpdate) == null || f.call(e, a)), R && ((q = e == null ? void 0 : e.onStart) == null || q.call(e, a));
102
- },
103
- destroy: () => {
104
- var n;
105
- a && ((n = e == null ? void 0 : e.onExit) == null || n.call(e, a));
106
- }
107
- };
108
- },
109
- state: {
110
- // Initialize the plugin's internal state.
111
- init() {
112
- return {
113
- active: !1,
114
- range: {
115
- from: 0,
116
- to: 0
117
- },
118
- query: null,
119
- text: null,
120
- composing: !1
121
- };
122
- },
123
- // Apply changes to the plugin state from a view transaction.
124
- apply(n, l, r, s) {
125
- const { isEditable: o } = c, { composing: i } = c.view, { selection: u } = n, { empty: f, from: q } = u, t = { ...l }, g = n.getMeta(p);
126
- if (g && g.exit)
127
- return t.active = !1, t.decorationId = null, t.range = { from: 0, to: 0 }, t.query = null, t.text = null, t;
128
- if (t.composing = i, o && (f || c.view.composing)) {
129
- (q < l.range.from || q > l.range.to) && !i && !l.composing && (t.active = !1);
130
- const d = F({
131
- char: w,
132
- allowSpaces: A,
133
- allowToIncludeChar: D,
134
- allowedPrefixes: _,
135
- startOfLine: b,
136
- $position: u.$from
137
- }), E = `id_${Math.floor(Math.random() * 4294967295)}`;
138
- d && h({
139
- editor: c,
140
- state: s,
141
- range: d.range,
142
- isActive: l.active
143
- }) ? (t.active = !0, t.decorationId = l.decorationId ? l.decorationId : E, t.range = d.range, t.query = d.query, t.text = d.text) : t.active = !1;
144
- } else
145
- t.active = !1;
146
- return t.active || (t.decorationId = null, t.range = { from: 0, to: 0 }, t.query = null, t.text = null), t;
147
- }
148
- },
149
- props: {
150
- // Call the keydown hook if suggestion is active.
151
- handleKeyDown(n, l) {
152
- var r, s, o, i;
153
- const { active: u, range: f } = N.getState(n.state);
154
- if (!u)
155
- return !1;
156
- if (l.key === "Escape" || l.key === "Esc") {
157
- const t = N.getState(n.state), g = (r = a == null ? void 0 : a.decorationNode) != null ? r : null, d = g ?? (t != null && t.decorationId ? n.dom.querySelector(`[data-decoration-id="${t.decorationId}"]`) : null);
158
- if (((s = e == null ? void 0 : e.onKeyDown) == null ? void 0 : s.call(e, { view: n, event: l, range: t.range })) || !1)
159
- return !0;
160
- const C = {
161
- editor: c,
162
- range: t.range,
163
- query: t.query,
164
- text: t.text,
165
- items: [],
166
- command: (I) => y({ editor: c, range: t.range, props: I }),
167
- decorationNode: d,
168
- // If we have a cached decoration node, use it for the clientRect
169
- // to avoid another DOM lookup. If not, leave clientRect null and
170
- // let consumer decide if they want to query.
171
- clientRect: d ? () => d.getBoundingClientRect() || null : null
172
- };
173
- return (o = e == null ? void 0 : e.onExit) == null || o.call(e, C), v(n, p), !0;
174
- }
175
- return ((i = e == null ? void 0 : e.onKeyDown) == null ? void 0 : i.call(e, { view: n, event: l, range: f })) || !1;
176
- },
177
- // Setup decorator on the currently active suggestion.
178
- decorations(n) {
179
- const { active: l, range: r, decorationId: s, query: o } = N.getState(n);
180
- if (!l)
181
- return null;
182
- const i = !(o != null && o.length), u = [P];
183
- return i && u.push(j), G.create(n.doc, [
184
- H.inline(r.from, r.to, {
185
- nodeName: m,
186
- class: u.join(" "),
187
- "data-decoration-id": s,
188
- "data-decoration-content": x
189
- })
190
- ]);
191
- }
192
- }
193
- });
194
- return N;
195
- }
196
- var Y = W;
197
- export {
198
- W as S,
199
- Y as i
200
- };