reactjs-tiptap-editor 0.2.29 → 0.3.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 (255) hide show
  1. package/lib/ActionMenuButton-Bycn676n.js +33 -0
  2. package/lib/ActionMenuButton-CpFNwSUZ.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 +39 -0
  28. package/lib/CodeBlock.d.cts +352 -0
  29. package/lib/CodeBlock.d.ts +352 -0
  30. package/lib/CodeBlock.js +3639 -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-BZadE1gM.js +1367 -0
  40. package/lib/Drawer-rwnFvgZR.cjs +1 -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-B2414Smc.js +651 -0
  50. package/lib/Excalidraw-D21vMFe0.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-Cy9XKEI5.js +11178 -0
  152. package/lib/RichTextEditor-DkpDEr5U.cjs +137 -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-B_tSItrW.js +1743 -0
  206. package/lib/Twitter-CfDC4bFV.cjs +17 -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-B45fP3gP.cjs +1 -0
  243. package/lib/textarea-DXTdXr2y.js +20 -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,358 @@
1
+ import { Editor } from '@tiptap/react';
2
+ import { Extension } from '@tiptap/core';
3
+
4
+ /**
5
+ * Represents the ButtonView function.
6
+ */
7
+ declare type ButtonView<T = any> = (options: ButtonViewParams<T>) => ButtonViewReturn | ButtonViewReturn[];
8
+
9
+ /**
10
+ * Represents the parameters for the ButtonView function.
11
+ */
12
+ declare interface ButtonViewParams<T = any> {
13
+ /** Editor object */
14
+ editor: Editor;
15
+ /** Extension object */
16
+ extension: Extension<T>;
17
+ /** Translation function */
18
+ t: (path: string) => string;
19
+ }
20
+
21
+ /**
22
+ * Represents the return value for the ButtonView component.
23
+ */
24
+ declare interface ButtonViewReturn {
25
+ /** Component */
26
+ component: unknown;
27
+ /** Component props */
28
+ componentProps: ButtonViewReturnComponentProps;
29
+ /** Component slots */
30
+ componentSlots?: ButtonViewReturnComponentSlots;
31
+ }
32
+
33
+ /**
34
+ * Represents the props for the ButtonView component.
35
+ */
36
+ declare interface ButtonViewReturnComponentProps {
37
+ /** Method triggered when action is performed */
38
+ action?: (value?: any) => void;
39
+ /** Whether it is in the active state */
40
+ isActive?: () => boolean;
41
+ /** Button icon */
42
+ icon?: any;
43
+ /** Text displayed on hover */
44
+ tooltip?: string;
45
+ [x: string]: any;
46
+ }
47
+
48
+ /**
49
+ * Represents the slots for the ButtonView component.
50
+ */
51
+ declare interface ButtonViewReturnComponentSlots {
52
+ /** Dialog slot */
53
+ dialog: () => any;
54
+ [x: string]: () => any;
55
+ }
56
+
57
+ /**
58
+ * Represents the general options for Tiptap extensions.
59
+ */
60
+ declare interface GeneralOptions<T> {
61
+ /** Enabled divider */
62
+ divider: boolean;
63
+ /** Enabled spacer */
64
+ spacer: boolean;
65
+ /** Button view function */
66
+ button: ButtonView<T>;
67
+ /** Show on Toolbar */
68
+ toolbar?: boolean;
69
+ }
70
+
71
+ declare interface Result {
72
+ from: number;
73
+ to: number;
74
+ }
75
+
76
+ export declare const SearchAndReplace: Extension<SearchOptions, SearchStorage>;
77
+
78
+ declare interface SearchOptions extends GeneralOptions<SearchOptions> {
79
+ searchTerm: string;
80
+ replaceTerm: string;
81
+ searchResultClass: string;
82
+ searchResultCurrentClass: string;
83
+ caseSensitive: boolean;
84
+ disableRegex: boolean;
85
+ onChange?: () => void;
86
+ }
87
+
88
+ declare interface SearchStorage {
89
+ results: Result[];
90
+ currentIndex: number;
91
+ }
92
+
93
+ export { }
94
+
95
+
96
+ declare module '@tiptap/core' {
97
+ interface Commands<ReturnType> {
98
+ attachment: {
99
+ setAttachment: (attrs?: unknown) => ReturnType;
100
+ };
101
+ }
102
+ }
103
+
104
+
105
+ declare module '@tiptap/core' {
106
+ interface Commands<ReturnType> {
107
+ setCodeBlock: {
108
+ setCodeBlock: (options?: any) => ReturnType;
109
+ };
110
+ }
111
+ }
112
+
113
+
114
+ declare module '@tiptap/core' {
115
+ interface Commands<ReturnType> {
116
+ excalidraw: {
117
+ setExcalidraw: (attrs?: IExcalidrawAttrs) => ReturnType;
118
+ };
119
+ }
120
+ }
121
+
122
+
123
+ declare module '@tiptap/core' {
124
+ interface Commands<ReturnType> {
125
+ emoji: {
126
+ setEmoji: (emoji: {
127
+ name: string;
128
+ emoji: string;
129
+ }) => ReturnType;
130
+ };
131
+ }
132
+ }
133
+
134
+
135
+ declare module '@tiptap/core' {
136
+ interface Commands<ReturnType> {
137
+ drawer: {
138
+ setDrawer: (options: any, replace?: any) => ReturnType;
139
+ setAlignImageDrawer: (align: 'left' | 'center' | 'right') => ReturnType;
140
+ };
141
+ }
142
+ }
143
+
144
+
145
+ declare module '@tiptap/core' {
146
+ interface Commands<ReturnType> {
147
+ exportWord: {
148
+ exportToWord: () => ReturnType;
149
+ };
150
+ }
151
+ }
152
+
153
+
154
+ declare module '@tiptap/core' {
155
+ interface Commands<ReturnType> {
156
+ fontSize: {
157
+ /**
158
+ * Set the text font size. ex: "12px", "2em", or "small". Must be a valid
159
+ * CSS font-size
160
+ * (https://developer.mozilla.org/en-US/docs/Web/CSS/font-size).
161
+ */
162
+ setFontSize: (fontSize: string) => ReturnType;
163
+ /**
164
+ * Unset the font size
165
+ */
166
+ unsetFontSize: () => ReturnType;
167
+ };
168
+ }
169
+ }
170
+
171
+
172
+ declare module '@tiptap/core' {
173
+ interface Commands<ReturnType> {
174
+ painter: {
175
+ setPainter: (marks: Mark[]) => ReturnType;
176
+ };
177
+ }
178
+ }
179
+
180
+
181
+ declare module '@tiptap/core' {
182
+ interface Commands<ReturnType> {
183
+ iframe: {
184
+ /**
185
+ * Add an iframe
186
+ */
187
+ setIframe: (options: {
188
+ src: string;
189
+ service: string;
190
+ }) => ReturnType;
191
+ };
192
+ }
193
+ }
194
+
195
+
196
+ declare module '@tiptap/core' {
197
+ interface Commands<ReturnType> {
198
+ imageUpload: {
199
+ /**
200
+ * Add an image
201
+ */
202
+ setImageInline: (options: Partial<SetImageAttrsOptions>) => ReturnType;
203
+ /**
204
+ * Update an image
205
+ */
206
+ updateImage: (options: Partial<SetImageAttrsOptions>) => ReturnType;
207
+ /**
208
+ * Set image alignment
209
+ */
210
+ setAlignImage: (align: 'left' | 'center' | 'right') => ReturnType;
211
+ };
212
+ }
213
+ }
214
+
215
+
216
+ declare module '@tiptap/core' {
217
+ interface Commands<ReturnType> {
218
+ imageGifUpload: {
219
+ /**
220
+ * Add an image gif
221
+ */
222
+ setImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
223
+ /**
224
+ * Update an image gif
225
+ */
226
+ updateImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
227
+ /**
228
+ * Set image alignment
229
+ */
230
+ setAlignImageGif: (align: 'left' | 'center' | 'right') => ReturnType;
231
+ };
232
+ }
233
+ }
234
+
235
+
236
+ declare module '@tiptap/core' {
237
+ interface Commands<ReturnType> {
238
+ indent: {
239
+ /**
240
+ * Set the indent attribute
241
+ */
242
+ indent: () => ReturnType;
243
+ /**
244
+ * Set the outdent attribute
245
+ */
246
+ outdent: () => ReturnType;
247
+ };
248
+ }
249
+ }
250
+
251
+
252
+ declare module '@tiptap/core' {
253
+ interface Commands<ReturnType> {
254
+ katex: {
255
+ setKatex: (arg?: IKatexAttrs) => ReturnType;
256
+ };
257
+ }
258
+ }
259
+
260
+
261
+ declare module '@tiptap/core' {
262
+ interface Commands<ReturnType> {
263
+ lineHeight: {
264
+ setLineHeight: (lineHeight: string) => ReturnType;
265
+ unsetLineHeight: () => ReturnType;
266
+ };
267
+ }
268
+ }
269
+
270
+
271
+ declare module '@tiptap/core' {
272
+ interface Commands<ReturnType> {
273
+ mermaid: {
274
+ setMermaid: (options: any, replace?: any) => ReturnType;
275
+ setAlignImageMermaid: (align: 'left' | 'center' | 'right') => ReturnType;
276
+ };
277
+ }
278
+ }
279
+
280
+
281
+ declare module '@tiptap/core' {
282
+ interface Commands<ReturnType> {
283
+ columns: {
284
+ insertColumns: (attrs?: {
285
+ cols: number;
286
+ }) => ReturnType;
287
+ addColBefore: () => ReturnType;
288
+ addColAfter: () => ReturnType;
289
+ deleteCol: () => ReturnType;
290
+ };
291
+ }
292
+ }
293
+
294
+
295
+ declare module '@tiptap/core' {
296
+ interface Commands<ReturnType> {
297
+ search: {
298
+ setSearchTerm: (searchTerm: string) => ReturnType;
299
+ setReplaceTerm: (replaceTerm: string) => ReturnType;
300
+ replace: () => ReturnType;
301
+ replaceAll: () => ReturnType;
302
+ goToPrevSearchResult: () => void;
303
+ goToNextSearchResult: () => void;
304
+ setCaseSensitive: (caseSensitive: boolean) => ReturnType;
305
+ };
306
+ }
307
+ }
308
+
309
+
310
+ declare module '@tiptap/core' {
311
+ interface Commands<ReturnType> {
312
+ tableOfContents: {
313
+ setTableOfContents: () => ReturnType;
314
+ removeTableOfContents: () => ReturnType;
315
+ };
316
+ }
317
+ }
318
+
319
+
320
+ declare module '@tiptap/core' {
321
+ interface Commands<ReturnType> {
322
+ twitter: {
323
+ /**
324
+ * Insert a tweet
325
+ * @param options The tweet attributes
326
+ * @example editor.commands.setTweet({ src: 'https://x.com/seanpk/status/1800145949580517852' })
327
+ */
328
+ setTweet: (options: SetTweetOptions) => ReturnType;
329
+ updateTweet: (options: SetTweetOptions) => ReturnType;
330
+ };
331
+ }
332
+ }
333
+
334
+
335
+ declare module '@tiptap/core' {
336
+ interface Commands<ReturnType> {
337
+ video: {
338
+ /**
339
+ * Add an video
340
+ */
341
+ setVideo: (options: Partial<SetVideoOptions>) => ReturnType;
342
+ /**
343
+ * Update an video
344
+ */
345
+ updateVideo: (options: Partial<SetVideoOptions>) => ReturnType;
346
+ };
347
+ }
348
+ }
349
+
350
+
351
+ declare module '@tiptap/core' {
352
+ interface Commands<ReturnType> {
353
+ tableCellBackground: {
354
+ setTableCellBackground: (color: string) => ReturnType;
355
+ unsetTableCellBackground: () => ReturnType;
356
+ };
357
+ }
358
+ }
@@ -0,0 +1,339 @@
1
+ import { E as _, P as M, a as $, b as N, D as P } from "./index-Drmyqk9P.js";
2
+ import q from "scroll-into-view-if-needed";
3
+ import { jsxs as f, jsx as o } from "react/jsx-runtime";
4
+ import { useState as g, useEffect as E } from "react";
5
+ import { l as k, E as d, P as B, m as j, A as F, k as A, n as O, L as I, o as y, B as T, S as W, p as K, q as R } from "./RichTextEditor-Cy9XKEI5.js";
6
+ import { u as U } from "./index-D9llIWB5.js";
7
+ function z({ editor: e, ...t }) {
8
+ const { t: s } = U(), [c, r] = g(-1), [n, i] = g([]), [a, u] = g(""), [l, h] = g(""), [x, v] = g(!1), [b, V] = g(!1);
9
+ return E(() => {
10
+ x || (u(""), h(""), r(-1), i([]), e.commands.setSearchTerm(""), e.commands.setReplaceTerm(""));
11
+ }, [e, x]), E(() => {
12
+ x && e && e.commands && e.commands.setSearchTerm && e.commands.setSearchTerm(a);
13
+ }, [x, a, e]), E(() => {
14
+ x && e && e.commands && e.commands.setReplaceTerm && e.commands.setReplaceTerm(l);
15
+ }, [x, l, e]), E(() => {
16
+ if (!e)
17
+ return;
18
+ const m = e.extensionManager.extensions.find((S) => S.name === Y.name);
19
+ if (!m)
20
+ return;
21
+ const w = () => {
22
+ if (!x)
23
+ return;
24
+ const S = m ? m.storage.currentIndex : -1, L = m ? m.storage.results : [];
25
+ r((C) => C !== S ? S : C), i((C) => K(C, L) ? C : L);
26
+ };
27
+ return k(d.SEARCH_REPLCE, w), () => {
28
+ m && k(d.SEARCH_REPLCE, w);
29
+ };
30
+ }, [x, e]), /* @__PURE__ */ f(
31
+ B,
32
+ {
33
+ onOpenChange: v,
34
+ open: x,
35
+ children: [
36
+ /* @__PURE__ */ o(
37
+ j,
38
+ {
39
+ asChild: !0,
40
+ disabled: t == null ? void 0 : t.disabled,
41
+ children: /* @__PURE__ */ o(
42
+ F,
43
+ {
44
+ disabled: t == null ? void 0 : t.disabled,
45
+ isActive: t == null ? void 0 : t.isActive,
46
+ tooltip: t == null ? void 0 : t.tooltip,
47
+ children: /* @__PURE__ */ o(A, { name: t == null ? void 0 : t.icon })
48
+ }
49
+ )
50
+ }
51
+ ),
52
+ /* @__PURE__ */ f(
53
+ O,
54
+ {
55
+ align: "start",
56
+ className: "richtext-w-full",
57
+ hideWhenDetached: !0,
58
+ side: "bottom",
59
+ children: [
60
+ /* @__PURE__ */ f("div", { className: "richtext-mb-[6px] richtext-flex richtext-items-center richtext-justify-between", children: [
61
+ /* @__PURE__ */ o(I, { children: s("editor.search.dialog.text") }),
62
+ /* @__PURE__ */ o("span", { className: "richtext-font-semibold", children: n.length > 0 ? `${c + 1}/${n.length}` : "0/0" })
63
+ ] }),
64
+ /* @__PURE__ */ f("div", { className: "richtext-mb-[10px] richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5", children: [
65
+ /* @__PURE__ */ o(
66
+ y,
67
+ {
68
+ autoFocus: !0,
69
+ className: "richtext-w-full",
70
+ onChange: (m) => u(m.target.value),
71
+ placeholder: "Text",
72
+ required: !0,
73
+ type: "text",
74
+ value: a
75
+ }
76
+ ),
77
+ /* @__PURE__ */ o(
78
+ T,
79
+ {
80
+ className: "richtext-flex-1",
81
+ disabled: n.length === 0,
82
+ onClick: e.commands.goToPrevSearchResult,
83
+ children: /* @__PURE__ */ o(A, { name: "ChevronUp" })
84
+ }
85
+ ),
86
+ /* @__PURE__ */ o(
87
+ T,
88
+ {
89
+ className: "richtext-flex-1",
90
+ disabled: n.length === 0,
91
+ onClick: e.commands.goToNextSearchResult,
92
+ children: /* @__PURE__ */ o(A, { name: "ChevronDown" })
93
+ }
94
+ )
95
+ ] }),
96
+ /* @__PURE__ */ o(I, { className: "richtext-mb-[6px]", children: s("editor.replace.dialog.text") }),
97
+ /* @__PURE__ */ o("div", { className: "richtext-mb-[5px] richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5", children: /* @__PURE__ */ o("div", { className: "richtext-relative richtext-w-full richtext-max-w-sm richtext-items-center", children: /* @__PURE__ */ o(
98
+ y,
99
+ {
100
+ className: "richtext-w-80",
101
+ onChange: (m) => h(m.target.value),
102
+ placeholder: "Text",
103
+ required: !0,
104
+ type: "text",
105
+ value: l
106
+ }
107
+ ) }) }),
108
+ /* @__PURE__ */ f("div", { className: "richtext-mb-[10px] richtext-flex richtext-items-center richtext-space-x-2", children: [
109
+ /* @__PURE__ */ o(
110
+ W,
111
+ {
112
+ checked: b,
113
+ onCheckedChange: (m) => {
114
+ V(m), e.commands.setCaseSensitive(m);
115
+ }
116
+ }
117
+ ),
118
+ /* @__PURE__ */ o(I, { children: s("editor.replace.caseSensitive") })
119
+ ] }),
120
+ /* @__PURE__ */ f("div", { className: "richtext-flex richtext-items-center richtext-gap-[10px]", children: [
121
+ /* @__PURE__ */ o(
122
+ T,
123
+ {
124
+ className: "richtext-flex-1",
125
+ disabled: n.length === 0,
126
+ onClick: e.commands.replace,
127
+ children: s("editor.replace.dialog.text")
128
+ }
129
+ ),
130
+ /* @__PURE__ */ o(
131
+ T,
132
+ {
133
+ className: "richtext-flex-1",
134
+ disabled: n.length === 0,
135
+ onClick: e.commands.replaceAll,
136
+ children: s("editor.replaceAll.dialog.text")
137
+ }
138
+ )
139
+ ] })
140
+ ]
141
+ }
142
+ )
143
+ ]
144
+ }
145
+ );
146
+ }
147
+ const p = (e, t) => t(e.tr);
148
+ function G(e, t, s) {
149
+ return RegExp(t ? e.replace(/[$()*+./?[\\\]^{|}-]/g, String.raw`\$&`) : e, s ? "gu" : "gui");
150
+ }
151
+ function J(e, t, s) {
152
+ const c = [];
153
+ let r = [];
154
+ const n = [];
155
+ let i = 0;
156
+ if (!t)
157
+ return { decorationsToReturn: [], results: [] };
158
+ e == null || e.descendants((a, u) => {
159
+ a.isText ? r[i] ? r[i] = {
160
+ text: r[i].text + a.text,
161
+ pos: r[i].pos
162
+ } : r[i] = {
163
+ text: `${a.text}`,
164
+ pos: u
165
+ } : i += 1;
166
+ }), r = r.filter(Boolean);
167
+ for (const { text: a, pos: u } of r) {
168
+ const l = [...a.matchAll(t)];
169
+ for (const h of l) {
170
+ if (h[0] === "")
171
+ break;
172
+ h.index !== void 0 && n.push({
173
+ from: u + h.index,
174
+ to: u + h.index + h[0].length
175
+ });
176
+ }
177
+ }
178
+ for (const a of n)
179
+ c.push(N.inline(a.from, a.to, { class: s }));
180
+ return {
181
+ decorationsToReturn: c,
182
+ results: n
183
+ };
184
+ }
185
+ function D(e, t, { state: s, dispatch: c }) {
186
+ if (!t[0])
187
+ return;
188
+ const { from: n, to: i } = t[0];
189
+ c && c(s.tr.insertText(e, n, i));
190
+ }
191
+ function Q(e, t, s, c) {
192
+ const r = t + 1;
193
+ if (!c[r])
194
+ return null;
195
+ const { from: n, to: i } = c[t], a = i - n - e.length + s, { from: u, to: l } = c[r];
196
+ return c[r] = {
197
+ to: l - a,
198
+ from: u - a
199
+ }, [a, c];
200
+ }
201
+ function X(e, t, { tr: s, dispatch: c }) {
202
+ let r = 0, n = t.slice();
203
+ if (n.length === 0)
204
+ return !1;
205
+ for (let i = 0; i < n.length; i += 1) {
206
+ const { from: a, to: u } = n[i];
207
+ s.insertText(e, a, u);
208
+ const l = Q(e, i, r, n);
209
+ l && (r = l[0], n = l[1]);
210
+ }
211
+ return c(s), !0;
212
+ }
213
+ function H({ view: e, tr: t, searchResults: s, searchResultCurrentClass: c, gotoIndex: r }) {
214
+ const n = s[r];
215
+ if (n) {
216
+ const i = t.setMeta("directDecoration", {
217
+ fromPos: n.from,
218
+ toPos: n.to,
219
+ attrs: { class: c }
220
+ });
221
+ return e == null || e.dispatch(i), setTimeout(() => {
222
+ const a = window.document.querySelector(`.${c}`);
223
+ a && q(a, { behavior: "smooth", scrollMode: "if-needed" });
224
+ }, 0), !0;
225
+ }
226
+ return !1;
227
+ }
228
+ const Y = /* @__PURE__ */ _.create({
229
+ name: "search",
230
+ addOptions() {
231
+ var e;
232
+ return {
233
+ ...(e = this.parent) == null ? void 0 : e.call(this),
234
+ searchTerm: "",
235
+ replaceTerm: "",
236
+ results: [],
237
+ currentIndex: 0,
238
+ searchResultClass: "search-result",
239
+ searchResultCurrentClass: "search-result-current",
240
+ caseSensitive: !1,
241
+ disableRegex: !1,
242
+ onChange: () => {
243
+ },
244
+ button: ({ editor: t, t: s }) => ({
245
+ component: z,
246
+ componentProps: {
247
+ action: () => {
248
+ },
249
+ icon: "SearchAndReplace",
250
+ tooltip: s("editor.searchAndReplace.tooltip"),
251
+ isActive: () => !1,
252
+ disabled: !1,
253
+ editor: t
254
+ }
255
+ })
256
+ };
257
+ },
258
+ addStorage() {
259
+ return {
260
+ results: [],
261
+ currentIndex: -1
262
+ };
263
+ },
264
+ addCommands() {
265
+ return {
266
+ setSearchTerm: (e) => ({ state: t, dispatch: s }) => (this.options.searchTerm = e, this.storage.results = [], this.storage.currentIndex = 0, R(d.SEARCH_REPLCE), p(t, s), !1),
267
+ setReplaceTerm: (e) => ({ state: t, dispatch: s }) => (this.options.replaceTerm = e, p(t, s), !1),
268
+ setCaseSensitive: (e) => ({ state: t, dispatch: s }) => (this.options.caseSensitive = e, p(t, s), !1),
269
+ replace: () => ({ state: e, dispatch: t }) => {
270
+ const { replaceTerm: s } = this.options, { currentIndex: c, results: r } = this.storage, n = r[c];
271
+ return n ? (D(s, [n], { state: e, dispatch: t }), this.storage.results.splice(c, 1)) : (D(s, r, { state: e, dispatch: t }), this.storage.results.shift()), R(d.SEARCH_REPLCE), p(e, t), !1;
272
+ },
273
+ replaceAll: () => ({ state: e, tr: t, dispatch: s }) => {
274
+ const { replaceTerm: c } = this.options, { results: r } = this.storage;
275
+ return X(c, r, { tr: t, dispatch: s }), this.storage.currentIndex = -1, this.storage.results = [], R(d.SEARCH_REPLCE), p(e, s), !1;
276
+ },
277
+ goToPrevSearchResult: () => ({ view: e, tr: t }) => {
278
+ const { searchResultCurrentClass: s } = this.options, { currentIndex: c, results: r } = this.storage, n = (c + r.length - 1) % r.length;
279
+ return this.storage.currentIndex = n, R(d.SEARCH_REPLCE), H({
280
+ view: e,
281
+ tr: t,
282
+ searchResults: r,
283
+ searchResultCurrentClass: s,
284
+ gotoIndex: n
285
+ });
286
+ },
287
+ goToNextSearchResult: () => ({ view: e, tr: t }) => {
288
+ const { searchResultCurrentClass: s } = this.options, { currentIndex: c, results: r } = this.storage, n = (c + 1) % r.length;
289
+ return this.storage.currentIndex = n, this.options.onChange && this.options.onChange(), R(d.SEARCH_REPLCE), H({
290
+ view: e,
291
+ tr: t,
292
+ searchResults: r,
293
+ searchResultCurrentClass: s,
294
+ gotoIndex: n
295
+ });
296
+ }
297
+ };
298
+ },
299
+ addProseMirrorPlugins() {
300
+ const e = this;
301
+ return [
302
+ new M({
303
+ key: new $("search"),
304
+ state: {
305
+ init() {
306
+ return P.empty;
307
+ },
308
+ apply(t) {
309
+ const { doc: s, docChanged: c } = t, { searchTerm: r, searchResultClass: n, searchResultCurrentClass: i, disableRegex: a, caseSensitive: u } = e.options;
310
+ if (c || r) {
311
+ const { decorationsToReturn: l, results: h } = J(
312
+ s,
313
+ G(r, a, u),
314
+ n
315
+ );
316
+ if (e.storage.results = h, e.storage.currentIndex > h.length - 1 && (e.storage.currentIndex = 0), R(d.SEARCH_REPLCE), t.getMeta("directDecoration")) {
317
+ const { fromPos: x, toPos: v, attrs: b } = t.getMeta("directDecoration");
318
+ l.push(N.inline(x, v, b));
319
+ } else
320
+ h.length > 0 && (l[0] = N.inline(h[0].from, h[0].to, {
321
+ class: i
322
+ }));
323
+ return P.create(s, l);
324
+ }
325
+ return P.empty;
326
+ }
327
+ },
328
+ props: {
329
+ decorations(t) {
330
+ return this.getState(t);
331
+ }
332
+ }
333
+ })
334
+ ];
335
+ }
336
+ });
337
+ export {
338
+ Y as SearchAndReplace
339
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./index-COecBbaE.cjs"),o=e.Extension.create({name:"selection",addProseMirrorPlugins(){const{editor:i}=this;return[new e.Plugin({key:new e.PluginKey("selection"),props:{decorations(n){return n.selection.empty||i.isFocused===!0?null:e.DecorationSet.create(n.doc,[e.Decoration.inline(n.selection.from,n.selection.to,{class:"selection"})])}}})]}});exports.Selection=o;exports.default=o;