reactjs-tiptap-editor 0.2.29 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (255) hide show
  1. package/lib/ActionMenuButton-BllDdN2-.js +33 -0
  2. package/lib/ActionMenuButton-tLPdHfCT.cjs +1 -0
  3. package/lib/Attachment.cjs +19 -0
  4. package/lib/Attachment.d.cts +344 -0
  5. package/lib/Attachment.d.ts +344 -0
  6. package/lib/Attachment.js +259 -0
  7. package/lib/Blockquote.cjs +1 -0
  8. package/lib/Blockquote.d.cts +343 -0
  9. package/lib/Blockquote.d.ts +343 -0
  10. package/lib/Blockquote.js +65 -0
  11. package/lib/Bold.cjs +1 -0
  12. package/lib/Bold.d.cts +343 -0
  13. package/lib/Bold.d.ts +343 -0
  14. package/lib/Bold.js +90 -0
  15. package/lib/BulletList.cjs +1 -0
  16. package/lib/BulletList.d.cts +343 -0
  17. package/lib/BulletList.d.ts +343 -0
  18. package/lib/BulletList.js +72 -0
  19. package/lib/Clear.cjs +1 -0
  20. package/lib/Clear.d.cts +342 -0
  21. package/lib/Clear.d.ts +342 -0
  22. package/lib/Clear.js +23 -0
  23. package/lib/Code.cjs +1 -0
  24. package/lib/Code.d.cts +343 -0
  25. package/lib/Code.d.ts +343 -0
  26. package/lib/Code.js +70 -0
  27. package/lib/CodeBlock.cjs +44 -0
  28. package/lib/CodeBlock.d.cts +352 -0
  29. package/lib/CodeBlock.d.ts +352 -0
  30. package/lib/CodeBlock.js +4189 -0
  31. package/lib/Color.cjs +1 -0
  32. package/lib/Color.d.cts +350 -0
  33. package/lib/Color.d.ts +350 -0
  34. package/lib/Color.js +141 -0
  35. package/lib/Document.cjs +1 -0
  36. package/lib/Document.d.cts +272 -0
  37. package/lib/Document.d.ts +272 -0
  38. package/lib/Document.js +13 -0
  39. package/lib/Drawer-BBmEHEAp.cjs +1 -0
  40. package/lib/Drawer-hyBIiEP6.js +1367 -0
  41. package/lib/Drawer.cjs +1 -0
  42. package/lib/Drawer.d.cts +344 -0
  43. package/lib/Drawer.d.ts +344 -0
  44. package/lib/Drawer.js +7 -0
  45. package/lib/Emoji.cjs +1 -0
  46. package/lib/Emoji.d.cts +277 -0
  47. package/lib/Emoji.d.ts +277 -0
  48. package/lib/Emoji.js +2168 -0
  49. package/lib/Excalidraw-BQ2PeAoa.js +651 -0
  50. package/lib/Excalidraw-Cd01zFJl.cjs +1 -0
  51. package/lib/Excalidraw.cjs +1 -0
  52. package/lib/Excalidraw.d.cts +278 -0
  53. package/lib/Excalidraw.d.ts +278 -0
  54. package/lib/Excalidraw.js +6 -0
  55. package/lib/ExportPdf.cjs +15 -0
  56. package/lib/ExportPdf.d.cts +270 -0
  57. package/lib/ExportPdf.d.ts +270 -0
  58. package/lib/ExportPdf.js +67 -0
  59. package/lib/ExportWord.cjs +1 -0
  60. package/lib/ExportWord.d.cts +341 -0
  61. package/lib/ExportWord.d.ts +341 -0
  62. package/lib/ExportWord.js +72 -0
  63. package/lib/FontFamily.cjs +1 -0
  64. package/lib/FontFamily.d.cts +354 -0
  65. package/lib/FontFamily.d.ts +354 -0
  66. package/lib/FontFamily.js +136 -0
  67. package/lib/FontSize.cjs +1 -0
  68. package/lib/FontSize.d.cts +359 -0
  69. package/lib/FontSize.d.ts +359 -0
  70. package/lib/FontSize.js +110 -0
  71. package/lib/FormatPainter.cjs +1 -0
  72. package/lib/FormatPainter.d.cts +353 -0
  73. package/lib/FormatPainter.d.ts +353 -0
  74. package/lib/FormatPainter.js +74 -0
  75. package/lib/Heading.cjs +1 -0
  76. package/lib/Heading.d.cts +343 -0
  77. package/lib/Heading.d.ts +343 -0
  78. package/lib/Heading.js +147 -0
  79. package/lib/Highlight.cjs +1 -0
  80. package/lib/Highlight.d.cts +344 -0
  81. package/lib/Highlight.d.ts +344 -0
  82. package/lib/Highlight.js +85 -0
  83. package/lib/History.cjs +1 -0
  84. package/lib/History.d.cts +343 -0
  85. package/lib/History.d.ts +343 -0
  86. package/lib/History.js +431 -0
  87. package/lib/HorizontalRule.cjs +1 -0
  88. package/lib/HorizontalRule.d.cts +343 -0
  89. package/lib/HorizontalRule.d.ts +343 -0
  90. package/lib/HorizontalRule.js +87 -0
  91. package/lib/Iframe.cjs +1 -0
  92. package/lib/Iframe.d.cts +277 -0
  93. package/lib/Iframe.d.ts +277 -0
  94. package/lib/Iframe.js +6 -0
  95. package/lib/Image.cjs +1 -0
  96. package/lib/Image.d.cts +370 -0
  97. package/lib/Image.d.ts +370 -0
  98. package/lib/Image.js +7 -0
  99. package/lib/ImageGif.cjs +1 -0
  100. package/lib/ImageGif.d.cts +292 -0
  101. package/lib/ImageGif.d.ts +292 -0
  102. package/lib/ImageGif.js +7 -0
  103. package/lib/ImportWord.cjs +231 -0
  104. package/lib/ImportWord.d.cts +353 -0
  105. package/lib/ImportWord.d.ts +353 -0
  106. package/lib/ImportWord.js +16620 -0
  107. package/lib/Indent.cjs +1 -0
  108. package/lib/Indent.d.cts +344 -0
  109. package/lib/Indent.d.ts +344 -0
  110. package/lib/Indent.js +78 -0
  111. package/lib/Italic.cjs +1 -0
  112. package/lib/Italic.d.cts +343 -0
  113. package/lib/Italic.d.ts +343 -0
  114. package/lib/Italic.js +91 -0
  115. package/lib/Katex.cjs +1 -0
  116. package/lib/Katex.d.cts +279 -0
  117. package/lib/Katex.d.ts +279 -0
  118. package/lib/Katex.js +197 -0
  119. package/lib/LineHeight.cjs +1 -0
  120. package/lib/LineHeight.d.cts +347 -0
  121. package/lib/LineHeight.d.ts +347 -0
  122. package/lib/LineHeight.js +137 -0
  123. package/lib/Link.cjs +5 -0
  124. package/lib/Link.d.cts +343 -0
  125. package/lib/Link.d.ts +343 -0
  126. package/lib/Link.js +1048 -0
  127. package/lib/ListItem.cjs +1 -0
  128. package/lib/ListItem.d.cts +269 -0
  129. package/lib/ListItem.d.ts +269 -0
  130. package/lib/ListItem.js +33 -0
  131. package/lib/Mention.cjs +1 -0
  132. package/lib/Mention.d.cts +272 -0
  133. package/lib/Mention.d.ts +272 -0
  134. package/lib/Mention.js +233 -0
  135. package/lib/Mermaid.cjs +2 -0
  136. package/lib/Mermaid.d.cts +344 -0
  137. package/lib/Mermaid.d.ts +344 -0
  138. package/lib/Mermaid.js +390 -0
  139. package/lib/MoreMark.cjs +1 -0
  140. package/lib/MoreMark.d.cts +355 -0
  141. package/lib/MoreMark.d.ts +355 -0
  142. package/lib/MoreMark.js +95 -0
  143. package/lib/MultiColumn.cjs +1 -0
  144. package/lib/MultiColumn.d.cts +277 -0
  145. package/lib/MultiColumn.d.ts +277 -0
  146. package/lib/MultiColumn.js +8 -0
  147. package/lib/OrderedList.cjs +1 -0
  148. package/lib/OrderedList.d.cts +343 -0
  149. package/lib/OrderedList.d.ts +343 -0
  150. package/lib/OrderedList.js +90 -0
  151. package/lib/RichTextEditor-CM-Xq9RS.cjs +137 -0
  152. package/lib/RichTextEditor-DvrUVNK2.js +11417 -0
  153. package/lib/SearchAndReplace.cjs +1 -0
  154. package/lib/SearchAndReplace.d.cts +358 -0
  155. package/lib/SearchAndReplace.d.ts +358 -0
  156. package/lib/SearchAndReplace.js +339 -0
  157. package/lib/Selection.cjs +1 -0
  158. package/lib/Selection.d.cts +272 -0
  159. package/lib/Selection.d.ts +272 -0
  160. package/lib/Selection.js +25 -0
  161. package/lib/SlashCommand.cjs +1 -0
  162. package/lib/SlashCommand.d.cts +299 -0
  163. package/lib/SlashCommand.d.ts +299 -0
  164. package/lib/SlashCommand.js +369 -0
  165. package/lib/Strike.cjs +1 -0
  166. package/lib/Strike.d.cts +343 -0
  167. package/lib/Strike.d.ts +343 -0
  168. package/lib/Strike.js +80 -0
  169. package/lib/SubAndSuperScript.cjs +1 -0
  170. package/lib/SubAndSuperScript.d.cts +358 -0
  171. package/lib/SubAndSuperScript.d.ts +358 -0
  172. package/lib/SubAndSuperScript.js +41 -0
  173. package/lib/Table.cjs +1 -0
  174. package/lib/Table.d.cts +366 -0
  175. package/lib/Table.d.ts +366 -0
  176. package/lib/Table.js +2165 -0
  177. package/lib/TableOfContent.cjs +1 -0
  178. package/lib/TableOfContent.d.cts +274 -0
  179. package/lib/TableOfContent.d.ts +274 -0
  180. package/lib/TableOfContent.js +184 -0
  181. package/lib/TaskList.cjs +1 -0
  182. package/lib/TaskList.d.cts +349 -0
  183. package/lib/TaskList.d.ts +349 -0
  184. package/lib/TaskList.js +175 -0
  185. package/lib/TextAlign.cjs +1 -0
  186. package/lib/TextAlign.d.cts +353 -0
  187. package/lib/TextAlign.d.ts +353 -0
  188. package/lib/TextAlign.js +165 -0
  189. package/lib/TextBubble.cjs +1 -0
  190. package/lib/TextBubble.d.cts +343 -0
  191. package/lib/TextBubble.d.ts +343 -0
  192. package/lib/TextBubble.js +131 -0
  193. package/lib/TextDirection.cjs +1 -0
  194. package/lib/TextDirection.d.cts +270 -0
  195. package/lib/TextDirection.d.ts +270 -0
  196. package/lib/TextDirection.js +142 -0
  197. package/lib/TextUnderline.cjs +1 -0
  198. package/lib/TextUnderline.d.cts +343 -0
  199. package/lib/TextUnderline.d.ts +343 -0
  200. package/lib/TextUnderline.js +61 -0
  201. package/lib/TrailingNode.cjs +1 -0
  202. package/lib/TrailingNode.d.cts +280 -0
  203. package/lib/TrailingNode.d.ts +280 -0
  204. package/lib/TrailingNode.js +41 -0
  205. package/lib/Twitter-BuMkJKBq.cjs +17 -0
  206. package/lib/Twitter-BvdxYuDK.js +1743 -0
  207. package/lib/Twitter.cjs +1 -0
  208. package/lib/Twitter.d.cts +295 -0
  209. package/lib/Twitter.d.ts +295 -0
  210. package/lib/Twitter.js +6 -0
  211. package/lib/Video.cjs +1 -0
  212. package/lib/Video.d.cts +371 -0
  213. package/lib/Video.d.ts +371 -0
  214. package/lib/Video.js +6 -0
  215. package/lib/bubble-extra.cjs +2 -0
  216. package/lib/bubble-extra.d.cts +294 -0
  217. package/lib/bubble-extra.d.ts +294 -0
  218. package/lib/bubble-extra.js +623 -0
  219. package/lib/dom-dataset-CAXnsjYE.cjs +33 -0
  220. package/lib/dom-dataset-CJ7GyQ2E.js +999 -0
  221. package/lib/index-COecBbaE.cjs +89 -0
  222. package/lib/index-ClFtfQ0J.cjs +1 -0
  223. package/lib/index-CvYIX2-x.js +129 -0
  224. package/lib/index-CySbCeQd.cjs +1 -0
  225. package/lib/{index-CO-iymkb.js → index-D9llIWB5.js} +442 -101
  226. package/lib/index-DXBa3JBo.js +46 -0
  227. package/lib/index-DjP7Onch.cjs +1 -0
  228. package/lib/index-Drmyqk9P.js +12322 -0
  229. package/lib/index-DuhDIOel.js +76 -0
  230. package/lib/index-LbrE7K9i.cjs +1 -0
  231. package/lib/index.cjs +2 -1
  232. package/lib/index.d.cts +290 -108
  233. package/lib/index.d.ts +290 -108
  234. package/lib/index.js +587 -13
  235. package/lib/locale-bundle.cjs +1 -1
  236. package/lib/locale-bundle.d.cts +108 -108
  237. package/lib/locale-bundle.d.ts +108 -108
  238. package/lib/locale-bundle.js +1 -1
  239. package/lib/shortId-Bfj8TyNr.cjs +2 -0
  240. package/lib/shortId-WJVkrvml.js +30 -0
  241. package/lib/style.css +1 -1
  242. package/lib/textarea-B172kMgC.js +20 -0
  243. package/lib/textarea-CapyElEP.cjs +1 -0
  244. package/package.json +678 -15
  245. package/lib/RichTextEditor-Ce2IeNE6.js +0 -8265
  246. package/lib/RichTextEditor-hDDApaDD.cjs +0 -136
  247. package/lib/extension-bundle.cjs +0 -33
  248. package/lib/extension-bundle.d.cts +0 -951
  249. package/lib/extension-bundle.d.ts +0 -951
  250. package/lib/extension-bundle.js +0 -5982
  251. package/lib/index-CJ6Hb9MN.cjs +0 -1
  252. package/lib/tiptap-DOP8lVCQ.js +0 -5950
  253. package/lib/tiptap-Dq62HiQ9.cjs +0 -113
  254. package/lib/vendor-BbgkyoD-.js +0 -40297
  255. package/lib/vendor-DdwtMmSr.cjs +0 -302
@@ -0,0 +1,369 @@
1
+ import { E as A, a as O } from "./index-Drmyqk9P.js";
2
+ import { a as D } from "./dom-dataset-CJ7GyQ2E.js";
3
+ import { S as P } from "./index-CvYIX2-x.js";
4
+ import B from "tippy.js";
5
+ import { jsx as g, jsxs as k } from "react/jsx-runtime";
6
+ import { forwardRef as $, useState as N, useRef as E, useImperativeHandle as z, useEffect as M, Fragment as T } from "react";
7
+ import { d as V, k as U, q, E as K, U as G, V as F, W } from "./RichTextEditor-DvrUVNK2.js";
8
+ import { u as j, m as h } from "./index-D9llIWB5.js";
9
+ function Q(i, m) {
10
+ var R, v;
11
+ const [t, n] = N(0), [e, a] = N(0), r = E(null), { t: s } = j(), u = E([]);
12
+ z(m, () => ({
13
+ onKeyDown: f
14
+ })), M(() => {
15
+ if (!r.current)
16
+ return;
17
+ const l = e * 1e3 + t, c = u.current[l];
18
+ c && c.scrollIntoView({
19
+ behavior: "smooth",
20
+ block: "nearest"
21
+ });
22
+ }, [t, e]);
23
+ function f({ event: l }) {
24
+ return l.key === "ArrowUp" ? (w(), !0) : l.key === "ArrowDown" ? (b(), !0) : l.key === "Enter" ? (L(), !0) : !1;
25
+ }
26
+ function w() {
27
+ var d;
28
+ if (i.items.length === 0)
29
+ return !1;
30
+ let l = t - 1, c = e;
31
+ l < 0 && (c = e - 1, l = ((d = i.items[c]) == null ? void 0 : d.commands.length) - 1 || 0), c < 0 && (c = i.items.length - 1, l = i.items[c].commands.length - 1), n(l), a(c);
32
+ }
33
+ function b() {
34
+ if (i.items.length === 0)
35
+ return !1;
36
+ const l = i.items[e].commands;
37
+ let c = t + 1, d = e;
38
+ l.length - 1 < c && (c = 0, d = e + 1), i.items.length - 1 < d && (d = 0), n(c), a(d);
39
+ }
40
+ function L() {
41
+ if (i.items.length === 0 || e === -1 || t === -1)
42
+ return !1;
43
+ C(e, t);
44
+ }
45
+ function C(l, c) {
46
+ const d = i.items[l].commands[c];
47
+ i.command(d);
48
+ }
49
+ function H(l, c) {
50
+ C(l, c);
51
+ }
52
+ function I(l, c, d) {
53
+ u.current[l * 1e3 + c] = d;
54
+ }
55
+ return /* @__PURE__ */ g(
56
+ "div",
57
+ {
58
+ className: "richtext-mb-8 richtext-max-h-[min(80vh,24rem)] richtext-flex-wrap richtext-overflow-auto richtext-rounded-lg !richtext-border !richtext-border-neutral-200 !richtext-bg-white richtext-p-1 !richtext-text-black richtext-shadow-sm dark:!richtext-border-neutral-800 dark:!richtext-bg-black",
59
+ ref: r,
60
+ children: (R = i == null ? void 0 : i.items) != null && R.length ? /* @__PURE__ */ g("div", { className: "richtext-grid richtext-min-w-48 richtext-grid-cols-1 richtext-gap-0.5", children: (v = i == null ? void 0 : i.items) == null ? void 0 : v.map((l, c) => /* @__PURE__ */ k(T, { children: [
61
+ /* @__PURE__ */ g("div", { className: "richtext-col-[1/-1] richtext-mx-2 richtext-mt-2 richtext-select-none richtext-text-[0.65rem] richtext-font-semibold richtext-uppercase richtext-tracking-wider !richtext-text-neutral-500 first:richtext-mt-0.5", children: l.title }),
62
+ l.commands.map((d, y) => /* @__PURE__ */ k(
63
+ "button",
64
+ {
65
+ onClick: () => H(c, y),
66
+ ref: (S) => I(c, y, S),
67
+ className: V("richtext-flex richtext-items-center richtext-gap-3 richtext-px-2 richtext-py-1.5 richtext-text-sm !richtext-text-neutral-800 dark:!richtext-text-neutral-200 richtext-text-left richtext-w-full richtext-rounded-sm richtext-outline-none richtext-transition-colors !richtext-bg-transparent hover:!richtext-bg-accent ", {
68
+ "slash-command-active": e === c && t === y
69
+ }),
70
+ children: [
71
+ d.iconUrl && /* @__PURE__ */ g(
72
+ "img",
73
+ {
74
+ alt: "",
75
+ className: "richtext-size-6",
76
+ src: d.iconUrl
77
+ }
78
+ ),
79
+ d.iconName && /* @__PURE__ */ g(
80
+ U,
81
+ {
82
+ className: "!richtext-mr-1 !richtext-text-lg",
83
+ name: d.iconName
84
+ }
85
+ ),
86
+ d.label
87
+ ]
88
+ },
89
+ `command-${y}`
90
+ ))
91
+ ] }, `slash-${l.title}`)) }) : /* @__PURE__ */ g("div", { className: "richtext-p-3", children: /* @__PURE__ */ g("span", { className: "richtext-text-xs richtext-text-gray-800 dark:richtext-text-gray-100", children: s("editor.slash.empty") }) })
92
+ }
93
+ );
94
+ }
95
+ const _ = $(Q), J = {
96
+ setOpen: (i, m) => {
97
+ q(K.UPLOAD_VIDEO(i), m);
98
+ }
99
+ };
100
+ function X(i, m) {
101
+ const t = [
102
+ {
103
+ name: "format",
104
+ title: h.t("editor.slash.format"),
105
+ commands: []
106
+ },
107
+ {
108
+ name: "insert",
109
+ title: h.t("editor.slash.insert"),
110
+ commands: []
111
+ }
112
+ ];
113
+ return i.forEach((n) => {
114
+ n.name.toLowerCase() === "heading" && n.options.levels.forEach((e) => {
115
+ t[0].commands.push({
116
+ name: `heading${e}`,
117
+ //@ts-expect-error
118
+ label: h.t(`editor.heading.h${e}.tooltip`),
119
+ aliases: [`h${e}`, "bt", `bt${e}`],
120
+ iconName: `Heading${e}`,
121
+ action: ({ editor: a, range: r }) => {
122
+ a.chain().focus().deleteRange(r).setHeading({ level: e }).run();
123
+ }
124
+ });
125
+ }), n.name.toLowerCase() === "bulletlist" && t[0].commands.push({
126
+ name: "bulletList",
127
+ label: h.t("editor.bulletlist.tooltip"),
128
+ aliases: ["ul", "yxlb"],
129
+ iconName: "List",
130
+ action: ({ editor: e, range: a }) => {
131
+ e.chain().focus().deleteRange(a).toggleBulletList().run();
132
+ }
133
+ }), n.name.toLowerCase() === "orderedlist" && t[0].commands.push({
134
+ name: "numberedList",
135
+ label: h.t("editor.orderedlist.tooltip"),
136
+ aliases: ["ol", "yxlb"],
137
+ iconName: "ListOrdered",
138
+ action: ({ editor: e, range: a }) => {
139
+ e.chain().focus().deleteRange(a).toggleOrderedList().run();
140
+ }
141
+ }), n.name.toLowerCase() === "tasklist" && t[0].commands.push({
142
+ name: "taskList",
143
+ label: h.t("editor.tasklist.tooltip"),
144
+ iconName: "ListTodo",
145
+ description: "Task list with todo items",
146
+ aliases: ["todo"],
147
+ action: ({ editor: e, range: a }) => {
148
+ e.chain().focus().deleteRange(a).toggleTaskList().run();
149
+ }
150
+ }), n.name.toLowerCase() === "blockquote" && t[0].commands.push({
151
+ name: "blockquote",
152
+ label: h.t("editor.blockquote.tooltip"),
153
+ description: "插入引入格式",
154
+ aliases: ["yr"],
155
+ iconName: "TextQuote",
156
+ action: ({ editor: e, range: a }) => {
157
+ e.chain().focus().deleteRange(a).setBlockquote().run();
158
+ }
159
+ }), n.name.toLowerCase() === "codeblock" && t[0].commands.push({
160
+ name: "codeBlock",
161
+ label: h.t("editor.codeblock.tooltip"),
162
+ iconName: "Code2",
163
+ description: "Code block with syntax highlighting",
164
+ shouldBeHidden: (e) => e.isActive("columns"),
165
+ action: ({ editor: e, range: a }) => {
166
+ e.chain().focus().deleteRange(a).setCodeBlock().run();
167
+ }
168
+ }), n.name.toLowerCase() === G.name && t[1].commands.push({
169
+ name: "image",
170
+ label: h.t("editor.image.tooltip"),
171
+ iconName: "ImageUp",
172
+ description: "Insert a image",
173
+ aliases: ["image", "tp", "tupian"],
174
+ shouldBeHidden: (e) => e.isActive("columns"),
175
+ action: ({ editor: e, range: a }) => {
176
+ e.chain().focus().deleteRange(a).run(), F.setOpen(e.id, !0);
177
+ }
178
+ }), n.name.toLowerCase() === W.name && t[1].commands.push({
179
+ name: "video",
180
+ label: h.t("editor.video.tooltip"),
181
+ iconName: "Video",
182
+ description: "Insert a video",
183
+ aliases: ["video", "sp", "shipin"],
184
+ shouldBeHidden: (e) => e.isActive("columns"),
185
+ action: ({ editor: e, range: a }) => {
186
+ e.chain().focus().deleteRange(a).run(), J.setOpen(e.id, !0);
187
+ }
188
+ }), n.name.toLowerCase() === "table" && t[1].commands.push({
189
+ name: "table",
190
+ label: h.t("editor.table.tooltip"),
191
+ iconName: "Table",
192
+ description: "Insert a table",
193
+ aliases: ["table", "bg", "biaoge", "biao"],
194
+ shouldBeHidden: (e) => e.isActive("columns"),
195
+ action: ({ editor: e, range: a }) => {
196
+ e.chain().focus().deleteRange(a).insertTable({ rows: 3, cols: 3, withHeaderRow: !1 }).run();
197
+ }
198
+ }), n.name.toLowerCase() === "horizontalrule" && t[1].commands.push({
199
+ name: "horizontalRule",
200
+ label: h.t("editor.horizontalrule.tooltip"),
201
+ iconName: "Minus",
202
+ description: "Insert a horizontal divider",
203
+ aliases: ["hr", "fgx", "fg"],
204
+ action: ({ editor: e, range: a }) => {
205
+ e.chain().focus().deleteRange(a).setHorizontalRule().run();
206
+ }
207
+ }), n.name.toLowerCase() === "columns" && t[1].commands.push({
208
+ name: "columns",
209
+ label: h.t("editor.columns.tooltip"),
210
+ iconName: "Columns2",
211
+ description: "Add two column content",
212
+ action: ({ editor: e }) => {
213
+ e.chain().focus().insertColumns({ cols: 2 }).run();
214
+ }
215
+ }), m == null || m(n, t);
216
+ }), t;
217
+ }
218
+ const x = "slashCommand";
219
+ let o;
220
+ const oe = /* @__PURE__ */ A.create({
221
+ name: x,
222
+ priority: 200,
223
+ onCreate() {
224
+ o = B("body", {
225
+ interactive: !0,
226
+ trigger: "manual",
227
+ placement: "bottom-start",
228
+ theme: "slash-command",
229
+ maxWidth: "16rem",
230
+ offset: [16, 8],
231
+ popperOptions: {
232
+ strategy: "fixed",
233
+ modifiers: [
234
+ {
235
+ name: "flip",
236
+ enabled: !1
237
+ }
238
+ ]
239
+ }
240
+ });
241
+ },
242
+ addProseMirrorPlugins() {
243
+ return [
244
+ P({
245
+ editor: this.editor,
246
+ char: "/",
247
+ allowSpaces: !0,
248
+ startOfLine: !0,
249
+ pluginKey: new O(x),
250
+ allow: ({ state: i, range: m }) => {
251
+ var f, w, b;
252
+ const t = i.doc.resolve(m.from), n = t.depth === 1, e = t.parent.type.name === "paragraph", a = ((f = t.parent.textContent) == null ? void 0 : f.charAt(0)) === "/", r = this.editor.isActive("column"), s = (b = t.parent.textContent) == null ? void 0 : b.slice(
253
+ Math.max(0, (w = t.parent.textContent) == null ? void 0 : w.indexOf("/"))
254
+ ), u = !(s != null && s.endsWith(" "));
255
+ return (n && e && a || r && e && a) && u;
256
+ },
257
+ command: ({ editor: i, range: m, props: t }) => {
258
+ const { view: n } = i;
259
+ t.action({ editor: i, range: m }), n.focus();
260
+ },
261
+ items: ({ query: i, editor: m }) => X(m.extensionManager.extensions, this.options.renderGroupItem).map((r) => ({
262
+ ...r,
263
+ commands: r.commands.filter((s) => {
264
+ const u = s.label.toLowerCase().trim(), f = i.toLowerCase().trim();
265
+ if (s.aliases) {
266
+ const w = s.aliases.map((C) => C.toLowerCase().trim()), b = u.match(f), L = w.some((C) => C.match(f));
267
+ return b || L;
268
+ }
269
+ return u.match(f);
270
+ }).filter(
271
+ (s) => s.shouldBeHidden ? !s.shouldBeHidden(this.editor) : !0
272
+ )
273
+ })).filter((r) => r.commands.length > 0).map((r) => ({
274
+ ...r,
275
+ commands: r.commands.map((s) => ({
276
+ ...s,
277
+ isEnabled: !0
278
+ }))
279
+ })),
280
+ render: () => {
281
+ let i, m = null;
282
+ return {
283
+ onStart: (t) => {
284
+ var a;
285
+ i = new D(_, {
286
+ props: t,
287
+ editor: t.editor
288
+ });
289
+ const { view: n } = t.editor, e = () => {
290
+ if (!t.clientRect)
291
+ return t.editor.storage[x].rect;
292
+ const r = t.clientRect();
293
+ if (!r)
294
+ return t.editor.storage[x].rect;
295
+ let s = r.y;
296
+ if (r.top + i.element.offsetHeight + 40 > window.innerHeight) {
297
+ const u = r.top + i.element.offsetHeight - window.innerHeight + 40;
298
+ s = r.y - u;
299
+ }
300
+ return new DOMRect(r.x, s, r.width, r.height);
301
+ };
302
+ m = () => {
303
+ o == null || o[0].setProps({
304
+ getReferenceClientRect: e
305
+ });
306
+ }, (a = n.dom.parentElement) == null || a.addEventListener("scroll", m), o == null || o[0].setProps({
307
+ getReferenceClientRect: e,
308
+ appendTo: () => document.body,
309
+ content: i.element
310
+ }), o == null || o[0].show();
311
+ },
312
+ onUpdate(t) {
313
+ var r;
314
+ i.updateProps(t);
315
+ const { view: n } = t.editor, e = () => {
316
+ if (!t.clientRect)
317
+ return t.editor.storage[x].rect;
318
+ const s = t.clientRect();
319
+ return s ? new DOMRect(s.x, s.y, s.width, s.height) : t.editor.storage[x].rect;
320
+ }, a = () => {
321
+ o == null || o[0].setProps({
322
+ getReferenceClientRect: e
323
+ });
324
+ };
325
+ (r = n.dom.parentElement) == null || r.addEventListener("scroll", a), t.editor.storage[x].rect = t.clientRect ? e() : {
326
+ width: 0,
327
+ height: 0,
328
+ left: 0,
329
+ top: 0,
330
+ right: 0,
331
+ bottom: 0
332
+ }, o == null || o[0].setProps({
333
+ getReferenceClientRect: e
334
+ });
335
+ },
336
+ onKeyDown(t) {
337
+ var n;
338
+ return t.event.key === "Escape" ? (o == null || o[0].hide(), !0) : (o != null && o[0].state.isShown || o == null || o[0].show(), (n = i.ref) == null ? void 0 : n.onKeyDown(t));
339
+ },
340
+ onExit(t) {
341
+ var n;
342
+ if (o == null || o[0].hide(), m) {
343
+ const { view: e } = t.editor;
344
+ (n = e.dom.parentElement) == null || n.removeEventListener("scroll", m);
345
+ }
346
+ i.destroy();
347
+ }
348
+ };
349
+ }
350
+ })
351
+ ];
352
+ },
353
+ addStorage() {
354
+ return {
355
+ rect: {
356
+ width: 0,
357
+ height: 0,
358
+ left: 0,
359
+ top: 0,
360
+ right: 0,
361
+ bottom: 0
362
+ }
363
+ };
364
+ }
365
+ });
366
+ export {
367
+ oe as SlashCommand,
368
+ oe as default
369
+ };
package/lib/Strike.cjs ADDED
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-COecBbaE.cjs"),n=require("./RichTextEditor-CM-Xq9RS.cjs"),i=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,o=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,a=e.Mark.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",e.mergeAttributes(this.options.HTMLAttributes,t),0]},addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[e.markInputRule({find:i,type:this.type})]},addPasteRules(){return[e.markPasteRule({find:o,type:this.type})]}}),u=a.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({editor:r,t:s})=>({component:n.ActionButton,componentProps:{action:()=>r.commands.toggleStrike(),isActive:()=>r.isActive("strike")||!1,disabled:!1,icon:"Strikethrough",shortcutKeys:["shift","mod","S"],tooltip:s("editor.strike.tooltip")}})}}});exports.Strike=u;