reactjs-tiptap-editor 0.3.3 → 0.3.4

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 (227) hide show
  1. package/lib/{ActionMenuButton-D5CqiauP.cjs → ActionMenuButton-DWudb-EA.cjs} +1 -1
  2. package/lib/{ActionMenuButton-DJQVpcjj.js → ActionMenuButton-_fmUfylg.js} +1 -1
  3. package/lib/Attachment.cjs +1 -1
  4. package/lib/Attachment.d.cts +17 -5
  5. package/lib/Attachment.d.ts +17 -5
  6. package/lib/Attachment.js +2 -2
  7. package/lib/Blockquote.cjs +1 -1
  8. package/lib/Blockquote.d.cts +17 -5
  9. package/lib/Blockquote.d.ts +17 -5
  10. package/lib/Blockquote.js +1 -1
  11. package/lib/Bold.cjs +1 -1
  12. package/lib/Bold.d.cts +17 -5
  13. package/lib/Bold.d.ts +17 -5
  14. package/lib/Bold.js +1 -1
  15. package/lib/BulletList.cjs +1 -1
  16. package/lib/BulletList.d.cts +17 -5
  17. package/lib/BulletList.d.ts +17 -5
  18. package/lib/BulletList.js +1 -1
  19. package/lib/Clear.cjs +1 -1
  20. package/lib/Clear.d.cts +17 -5
  21. package/lib/Clear.d.ts +17 -5
  22. package/lib/Clear.js +1 -1
  23. package/lib/Code.cjs +1 -1
  24. package/lib/Code.d.cts +17 -5
  25. package/lib/Code.d.ts +17 -5
  26. package/lib/Code.js +1 -1
  27. package/lib/CodeBlock.cjs +1 -1
  28. package/lib/CodeBlock.d.cts +17 -5
  29. package/lib/CodeBlock.d.ts +17 -5
  30. package/lib/CodeBlock.js +1 -1
  31. package/lib/CodeView.cjs +1 -0
  32. package/lib/CodeView.d.cts +354 -0
  33. package/lib/CodeView.d.ts +354 -0
  34. package/lib/CodeView.js +53 -0
  35. package/lib/Color.cjs +1 -1
  36. package/lib/Color.d.cts +17 -5
  37. package/lib/Color.d.ts +17 -5
  38. package/lib/Color.js +2 -2
  39. package/lib/Document.d.cts +17 -5
  40. package/lib/Document.d.ts +17 -5
  41. package/lib/{Drawer-82lBASmO.js → Drawer-C9nzP3w1.js} +18 -18
  42. package/lib/{Drawer-DLV1rOAE.cjs → Drawer-y2uXLloa.cjs} +1 -1
  43. package/lib/Drawer.cjs +1 -1
  44. package/lib/Drawer.d.cts +17 -5
  45. package/lib/Drawer.d.ts +17 -5
  46. package/lib/Drawer.js +2 -2
  47. package/lib/Emoji.cjs +1 -1
  48. package/lib/Emoji.d.cts +17 -5
  49. package/lib/Emoji.d.ts +17 -5
  50. package/lib/Emoji.js +2 -2
  51. package/lib/{Excalidraw-CsD-4eCA.js → Excalidraw-BihHDjEo.js} +2 -2
  52. package/lib/{Excalidraw-BuGGHrVK.cjs → Excalidraw-DMKzooX1.cjs} +1 -1
  53. package/lib/Excalidraw.cjs +1 -1
  54. package/lib/Excalidraw.d.cts +17 -5
  55. package/lib/Excalidraw.d.ts +17 -5
  56. package/lib/Excalidraw.js +1 -1
  57. package/lib/ExportPdf.cjs +1 -1
  58. package/lib/ExportPdf.d.cts +17 -5
  59. package/lib/ExportPdf.d.ts +17 -5
  60. package/lib/ExportPdf.js +1 -1
  61. package/lib/ExportWord.cjs +1 -1
  62. package/lib/ExportWord.d.cts +17 -5
  63. package/lib/ExportWord.d.ts +17 -5
  64. package/lib/ExportWord.js +1 -1
  65. package/lib/FontFamily.cjs +1 -1
  66. package/lib/FontFamily.d.cts +17 -5
  67. package/lib/FontFamily.d.ts +17 -5
  68. package/lib/FontFamily.js +3 -3
  69. package/lib/FontSize.cjs +1 -1
  70. package/lib/FontSize.d.cts +17 -5
  71. package/lib/FontSize.d.ts +17 -5
  72. package/lib/FontSize.js +3 -3
  73. package/lib/FormatPainter.cjs +1 -1
  74. package/lib/FormatPainter.d.cts +17 -5
  75. package/lib/FormatPainter.d.ts +17 -5
  76. package/lib/FormatPainter.js +1 -1
  77. package/lib/Heading.cjs +1 -1
  78. package/lib/Heading.d.cts +17 -5
  79. package/lib/Heading.d.ts +17 -5
  80. package/lib/Heading.js +2 -2
  81. package/lib/Highlight.cjs +1 -1
  82. package/lib/Highlight.d.cts +17 -5
  83. package/lib/Highlight.d.ts +17 -5
  84. package/lib/Highlight.js +1 -1
  85. package/lib/History.cjs +1 -1
  86. package/lib/History.d.cts +17 -5
  87. package/lib/History.d.ts +17 -5
  88. package/lib/History.js +1 -1
  89. package/lib/HorizontalRule.cjs +1 -1
  90. package/lib/HorizontalRule.d.cts +17 -5
  91. package/lib/HorizontalRule.d.ts +17 -5
  92. package/lib/HorizontalRule.js +1 -1
  93. package/lib/Iframe.cjs +1 -1
  94. package/lib/Iframe.d.cts +17 -5
  95. package/lib/Iframe.d.ts +17 -5
  96. package/lib/Iframe.js +1 -1
  97. package/lib/Image.cjs +1 -1
  98. package/lib/Image.d.cts +17 -5
  99. package/lib/Image.d.ts +17 -5
  100. package/lib/Image.js +1 -1
  101. package/lib/ImageGif.cjs +1 -1
  102. package/lib/ImageGif.d.cts +17 -5
  103. package/lib/ImageGif.d.ts +17 -5
  104. package/lib/ImageGif.js +1 -1
  105. package/lib/ImportWord.cjs +1 -1
  106. package/lib/ImportWord.d.cts +17 -5
  107. package/lib/ImportWord.d.ts +17 -5
  108. package/lib/ImportWord.js +2 -2
  109. package/lib/Indent.cjs +1 -1
  110. package/lib/Indent.d.cts +17 -5
  111. package/lib/Indent.d.ts +17 -5
  112. package/lib/Indent.js +1 -1
  113. package/lib/Italic.cjs +1 -1
  114. package/lib/Italic.d.cts +17 -5
  115. package/lib/Italic.d.ts +17 -5
  116. package/lib/Italic.js +1 -1
  117. package/lib/Katex.cjs +1 -1
  118. package/lib/Katex.d.cts +17 -5
  119. package/lib/Katex.d.ts +17 -5
  120. package/lib/Katex.js +3 -3
  121. package/lib/LineHeight.cjs +1 -1
  122. package/lib/LineHeight.d.cts +17 -5
  123. package/lib/LineHeight.d.ts +17 -5
  124. package/lib/LineHeight.js +8 -8
  125. package/lib/Link.cjs +1 -1
  126. package/lib/Link.d.cts +17 -5
  127. package/lib/Link.d.ts +17 -5
  128. package/lib/Link.js +1 -1
  129. package/lib/ListItem.d.cts +17 -5
  130. package/lib/ListItem.d.ts +17 -5
  131. package/lib/Mention.d.cts +17 -5
  132. package/lib/Mention.d.ts +17 -5
  133. package/lib/Mermaid.cjs +1 -1
  134. package/lib/Mermaid.d.cts +17 -5
  135. package/lib/Mermaid.d.ts +17 -5
  136. package/lib/Mermaid.js +14 -14
  137. package/lib/MoreMark.cjs +1 -1
  138. package/lib/MoreMark.d.cts +17 -5
  139. package/lib/MoreMark.d.ts +17 -5
  140. package/lib/MoreMark.js +1 -1
  141. package/lib/MultiColumn.cjs +1 -1
  142. package/lib/MultiColumn.d.cts +17 -5
  143. package/lib/MultiColumn.d.ts +17 -5
  144. package/lib/MultiColumn.js +1 -1
  145. package/lib/OrderedList.cjs +1 -1
  146. package/lib/OrderedList.d.cts +17 -5
  147. package/lib/OrderedList.d.ts +17 -5
  148. package/lib/OrderedList.js +1 -1
  149. package/lib/{RichTextEditor-BwuyWeH3.js → RichTextEditor-D5VO1y1d.js} +727 -716
  150. package/lib/RichTextEditor-qp9T7xuG.cjs +137 -0
  151. package/lib/SearchAndReplace.cjs +1 -1
  152. package/lib/SearchAndReplace.d.cts +17 -5
  153. package/lib/SearchAndReplace.d.ts +17 -5
  154. package/lib/SearchAndReplace.js +2 -2
  155. package/lib/Selection.d.cts +17 -5
  156. package/lib/Selection.d.ts +17 -5
  157. package/lib/SlashCommand.cjs +1 -1
  158. package/lib/SlashCommand.d.cts +17 -5
  159. package/lib/SlashCommand.d.ts +17 -5
  160. package/lib/SlashCommand.js +2 -2
  161. package/lib/Strike.cjs +1 -1
  162. package/lib/Strike.d.cts +17 -5
  163. package/lib/Strike.d.ts +17 -5
  164. package/lib/Strike.js +1 -1
  165. package/lib/SubAndSuperScript.cjs +1 -1
  166. package/lib/SubAndSuperScript.d.cts +17 -5
  167. package/lib/SubAndSuperScript.d.ts +17 -5
  168. package/lib/SubAndSuperScript.js +1 -1
  169. package/lib/Table.cjs +1 -1
  170. package/lib/Table.d.cts +17 -5
  171. package/lib/Table.d.ts +17 -5
  172. package/lib/Table.js +2 -2
  173. package/lib/TableOfContent.cjs +1 -1
  174. package/lib/TableOfContent.d.cts +17 -5
  175. package/lib/TableOfContent.d.ts +17 -5
  176. package/lib/TableOfContent.js +4 -4
  177. package/lib/TaskList.cjs +1 -1
  178. package/lib/TaskList.d.cts +17 -5
  179. package/lib/TaskList.d.ts +17 -5
  180. package/lib/TaskList.js +1 -1
  181. package/lib/TextAlign.cjs +1 -1
  182. package/lib/TextAlign.d.cts +17 -5
  183. package/lib/TextAlign.d.ts +17 -5
  184. package/lib/TextAlign.js +1 -1
  185. package/lib/TextBubble.cjs +1 -1
  186. package/lib/TextBubble.d.cts +17 -5
  187. package/lib/TextBubble.d.ts +17 -5
  188. package/lib/TextBubble.js +2 -2
  189. package/lib/TextDirection.cjs +1 -1
  190. package/lib/TextDirection.d.cts +17 -5
  191. package/lib/TextDirection.d.ts +17 -5
  192. package/lib/TextDirection.js +1 -1
  193. package/lib/TextUnderline.cjs +1 -1
  194. package/lib/TextUnderline.d.cts +17 -5
  195. package/lib/TextUnderline.d.ts +17 -5
  196. package/lib/TextUnderline.js +1 -1
  197. package/lib/TrailingNode.d.cts +17 -5
  198. package/lib/TrailingNode.d.ts +17 -5
  199. package/lib/{Twitter-Bstfoi9X.js → Twitter-CH7Z4Iof.js} +2 -2
  200. package/lib/{Twitter-D41ISCsH.cjs → Twitter-CgVy5oQW.cjs} +1 -1
  201. package/lib/Twitter.cjs +1 -1
  202. package/lib/Twitter.d.cts +17 -5
  203. package/lib/Twitter.d.ts +17 -5
  204. package/lib/Twitter.js +1 -1
  205. package/lib/Video.cjs +1 -1
  206. package/lib/Video.d.cts +17 -5
  207. package/lib/Video.d.ts +17 -5
  208. package/lib/Video.js +2 -2
  209. package/lib/bubble-extra.cjs +1 -1
  210. package/lib/bubble-extra.d.cts +17 -5
  211. package/lib/bubble-extra.d.ts +17 -5
  212. package/lib/bubble-extra.js +6 -6
  213. package/lib/{index-D9llIWB5.js → index-D-DR0FPY.js} +18 -13
  214. package/lib/index-Dz3YxLE7.cjs +1 -0
  215. package/lib/index.cjs +1 -1
  216. package/lib/index.d.cts +18 -5
  217. package/lib/index.d.ts +18 -5
  218. package/lib/index.js +3 -3
  219. package/lib/locale-bundle.cjs +1 -1
  220. package/lib/locale-bundle.d.cts +22 -5
  221. package/lib/locale-bundle.d.ts +22 -5
  222. package/lib/locale-bundle.js +1 -1
  223. package/lib/{textarea-CfH4-Iyy.js → textarea-CDp8O87y.js} +1 -1
  224. package/lib/{textarea-ZGJkH6ji.cjs → textarea-CqMUEJEj.cjs} +1 -1
  225. package/package.json +14 -1
  226. package/lib/RichTextEditor-NfX6yV6A.cjs +0 -137
  227. package/lib/index-LbrE7K9i.cjs +0 -1
@@ -0,0 +1,354 @@
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
+ export declare const CodeView: Extension<CodeViewOptions, any>;
58
+
59
+ export declare interface CodeViewOptions extends GeneralOptions<CodeViewOptions> {
60
+ isCodeViewMode?: boolean;
61
+ }
62
+
63
+ /**
64
+ * Represents the general options for Tiptap extensions.
65
+ */
66
+ declare interface GeneralOptions<T> {
67
+ /** Enabled divider */
68
+ divider: boolean;
69
+ /** Enabled spacer */
70
+ spacer: boolean;
71
+ /** Button view function */
72
+ button: ButtonView<T>;
73
+ /** Show on Toolbar */
74
+ toolbar?: boolean;
75
+ }
76
+
77
+ export { }
78
+
79
+
80
+ declare module '@tiptap/core' {
81
+ interface Commands<ReturnType> {
82
+ attachment: {
83
+ setAttachment: (attrs?: unknown) => ReturnType;
84
+ };
85
+ }
86
+ }
87
+
88
+
89
+ declare module '@tiptap/core' {
90
+ interface Commands<ReturnType> {
91
+ setCodeBlock: {
92
+ setCodeBlock: (options?: any) => ReturnType;
93
+ };
94
+ }
95
+ }
96
+
97
+
98
+ declare module '@tiptap/core' {
99
+ interface Commands<ReturnType> {
100
+ codeView: {
101
+ /**
102
+ * Toggle code view mode
103
+ */
104
+ toggleCodeView: () => ReturnType;
105
+ };
106
+ }
107
+ }
108
+
109
+
110
+ declare module '@tiptap/core' {
111
+ interface Commands<ReturnType> {
112
+ drawer: {
113
+ setDrawer: (options: any, replace?: any) => ReturnType;
114
+ setAlignImageDrawer: (align: 'left' | 'center' | 'right') => ReturnType;
115
+ };
116
+ }
117
+ }
118
+
119
+
120
+ declare module '@tiptap/core' {
121
+ interface Commands<ReturnType> {
122
+ emoji: {
123
+ setEmoji: (emoji: {
124
+ name: string;
125
+ emoji: string;
126
+ }) => ReturnType;
127
+ };
128
+ }
129
+ }
130
+
131
+
132
+ declare module '@tiptap/core' {
133
+ interface Commands<ReturnType> {
134
+ excalidraw: {
135
+ setExcalidraw: (attrs?: IExcalidrawAttrs) => ReturnType;
136
+ };
137
+ }
138
+ }
139
+
140
+
141
+ declare module '@tiptap/core' {
142
+ interface Commands<ReturnType> {
143
+ exportWord: {
144
+ exportToWord: () => ReturnType;
145
+ };
146
+ }
147
+ }
148
+
149
+
150
+ declare module '@tiptap/core' {
151
+ interface Commands<ReturnType> {
152
+ fontSize: {
153
+ /**
154
+ * Set the text font size. ex: "12px", "2em", or "small". Must be a valid
155
+ * CSS font-size
156
+ * (https://developer.mozilla.org/en-US/docs/Web/CSS/font-size).
157
+ */
158
+ setFontSize: (fontSize: string) => ReturnType;
159
+ /**
160
+ * Unset the font size
161
+ */
162
+ unsetFontSize: () => ReturnType;
163
+ };
164
+ }
165
+ }
166
+
167
+
168
+ declare module '@tiptap/core' {
169
+ interface Commands<ReturnType> {
170
+ painter: {
171
+ setPainter: (marks: Mark[]) => ReturnType;
172
+ };
173
+ }
174
+ }
175
+
176
+
177
+ declare module '@tiptap/core' {
178
+ interface Commands<ReturnType> {
179
+ iframe: {
180
+ /**
181
+ * Add an iframe
182
+ */
183
+ setIframe: (options: {
184
+ src: string;
185
+ service: string;
186
+ }) => ReturnType;
187
+ };
188
+ }
189
+ }
190
+
191
+
192
+ declare module '@tiptap/core' {
193
+ interface Commands<ReturnType> {
194
+ imageUpload: {
195
+ /**
196
+ * Add an image
197
+ */
198
+ setImageInline: (options: Partial<SetImageAttrsOptions>) => ReturnType;
199
+ /**
200
+ * Update an image
201
+ */
202
+ updateImage: (options: Partial<SetImageAttrsOptions>) => ReturnType;
203
+ /**
204
+ * Set image alignment
205
+ */
206
+ setAlignImage: (align: 'left' | 'center' | 'right') => ReturnType;
207
+ };
208
+ }
209
+ }
210
+
211
+
212
+ declare module '@tiptap/core' {
213
+ interface Commands<ReturnType> {
214
+ imageGifUpload: {
215
+ /**
216
+ * Add an image gif
217
+ */
218
+ setImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
219
+ /**
220
+ * Update an image gif
221
+ */
222
+ updateImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
223
+ /**
224
+ * Set image alignment
225
+ */
226
+ setAlignImageGif: (align: 'left' | 'center' | 'right') => ReturnType;
227
+ };
228
+ }
229
+ }
230
+
231
+
232
+ declare module '@tiptap/core' {
233
+ interface Commands<ReturnType> {
234
+ indent: {
235
+ /**
236
+ * Set the indent attribute
237
+ */
238
+ indent: () => ReturnType;
239
+ /**
240
+ * Set the outdent attribute
241
+ */
242
+ outdent: () => ReturnType;
243
+ };
244
+ }
245
+ }
246
+
247
+
248
+ declare module '@tiptap/core' {
249
+ interface Commands<ReturnType> {
250
+ katex: {
251
+ setKatex: (arg?: IKatexAttrs) => ReturnType;
252
+ };
253
+ }
254
+ }
255
+
256
+
257
+ declare module '@tiptap/core' {
258
+ interface Commands<ReturnType> {
259
+ lineHeight: {
260
+ setLineHeight: (lineHeight: string) => ReturnType;
261
+ unsetLineHeight: () => ReturnType;
262
+ };
263
+ }
264
+ }
265
+
266
+
267
+ declare module '@tiptap/core' {
268
+ interface Commands<ReturnType> {
269
+ mermaid: {
270
+ setMermaid: (options: any, replace?: any) => ReturnType;
271
+ setAlignImageMermaid: (align: 'left' | 'center' | 'right') => ReturnType;
272
+ };
273
+ }
274
+ }
275
+
276
+
277
+ declare module '@tiptap/core' {
278
+ interface Commands<ReturnType> {
279
+ columns: {
280
+ insertColumns: (attrs?: {
281
+ cols: number;
282
+ }) => ReturnType;
283
+ addColBefore: () => ReturnType;
284
+ addColAfter: () => ReturnType;
285
+ deleteCol: () => ReturnType;
286
+ };
287
+ }
288
+ }
289
+
290
+
291
+ declare module '@tiptap/core' {
292
+ interface Commands<ReturnType> {
293
+ search: {
294
+ setSearchTerm: (searchTerm: string) => ReturnType;
295
+ setReplaceTerm: (replaceTerm: string) => ReturnType;
296
+ replace: () => ReturnType;
297
+ replaceAll: () => ReturnType;
298
+ goToPrevSearchResult: () => void;
299
+ goToNextSearchResult: () => void;
300
+ setCaseSensitive: (caseSensitive: boolean) => ReturnType;
301
+ };
302
+ }
303
+ }
304
+
305
+
306
+ declare module '@tiptap/core' {
307
+ interface Commands<ReturnType> {
308
+ tableOfContents: {
309
+ setTableOfContents: () => ReturnType;
310
+ removeTableOfContents: () => ReturnType;
311
+ };
312
+ }
313
+ }
314
+
315
+
316
+ declare module '@tiptap/core' {
317
+ interface Commands<ReturnType> {
318
+ twitter: {
319
+ /**
320
+ * Insert a tweet
321
+ * @param options The tweet attributes
322
+ * @example editor.commands.setTweet({ src: 'https://x.com/seanpk/status/1800145949580517852' })
323
+ */
324
+ setTweet: (options: SetTweetOptions) => ReturnType;
325
+ updateTweet: (options: SetTweetOptions) => ReturnType;
326
+ };
327
+ }
328
+ }
329
+
330
+
331
+ declare module '@tiptap/core' {
332
+ interface Commands<ReturnType> {
333
+ video: {
334
+ /**
335
+ * Add an video
336
+ */
337
+ setVideo: (options: Partial<SetVideoOptions>) => ReturnType;
338
+ /**
339
+ * Update an video
340
+ */
341
+ updateVideo: (options: Partial<SetVideoOptions>) => ReturnType;
342
+ };
343
+ }
344
+ }
345
+
346
+
347
+ declare module '@tiptap/core' {
348
+ interface Commands<ReturnType> {
349
+ tableCellBackground: {
350
+ setTableCellBackground: (color: string) => ReturnType;
351
+ unsetTableCellBackground: () => ReturnType;
352
+ };
353
+ }
354
+ }
@@ -0,0 +1,53 @@
1
+ import { E as i } from "./index-Drmyqk9P.js";
2
+ import { A as s } from "./RichTextEditor-D5VO1y1d.js";
3
+ const r = /* @__PURE__ */ i.create({
4
+ name: "codeView",
5
+ addOptions() {
6
+ var e;
7
+ return {
8
+ ...(e = this.parent) == null ? void 0 : e.call(this),
9
+ button({ editor: t, t: o }) {
10
+ return {
11
+ component: s,
12
+ componentProps: {
13
+ action: () => {
14
+ t.commands.toggleCodeView();
15
+ },
16
+ isActive: () => t.storage.codeView.isActive || !1,
17
+ disabled: !1,
18
+ icon: "CodeView",
19
+ tooltip: o("editor.codeView.tooltip") || "View HTML Code",
20
+ customClass: "tiptap-code-view-button"
21
+ }
22
+ };
23
+ }
24
+ };
25
+ },
26
+ addStorage() {
27
+ return {
28
+ isActive: !1,
29
+ originalContent: ""
30
+ };
31
+ },
32
+ addCommands() {
33
+ return {
34
+ toggleCodeView: () => ({ editor: e }) => {
35
+ const t = e.storage.codeView.isActive;
36
+ if (t)
37
+ e.commands.setContent(e.getText());
38
+ else {
39
+ const o = e.getHTML();
40
+ e.storage.codeView.originalContent = o;
41
+ const n = o.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");
42
+ e.commands.setContent(
43
+ `<div class="tiptap-code-view-wrapper">${n}</div>`
44
+ );
45
+ }
46
+ return e.storage.codeView.isActive = !t, !0;
47
+ }
48
+ };
49
+ }
50
+ });
51
+ export {
52
+ r as CodeView
53
+ };
package/lib/Color.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./index-DjP7Onch.cjs");const u=require("./index-COecBbaE.cjs"),l=require("react/jsx-runtime"),s=require("react"),i=require("./RichTextEditor-NfX6yV6A.cjs"),x=u.Extension.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:e=>{var t;return(t=e.style.color)===null||t===void 0?void 0:t.replace(/['"]+/g,"")},renderHTML:e=>e.color?{style:`color: ${e.color}`}:{}}}}]},addCommands(){return{setColor:e=>({chain:t})=>t().setMark("textStyle",{color:e}).run(),unsetColor:()=>({chain:e})=>e().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}});function C({fill:e}){return l.jsx("svg",{width:"18px",height:"18px",viewBox:"0 0 240 240",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:l.jsx("g",{stroke:"none",strokeWidth:1,fill:"none",fillRule:"evenodd",children:l.jsx("g",{transform:"translate(0.000000, 0.500000)",children:l.jsxs("g",{transform:"translate(39.000000, 17.353553)",children:[l.jsx("path",{d:"M11,201.146447 L167,201.146447 C173.075132,201.146447 178,206.071314 178,212.146447 C178,218.221579 173.075132,223.146447 167,223.146447 L11,223.146447 C4.92486775,223.146447 7.43989126e-16,218.221579 0,212.146447 C-7.43989126e-16,206.071314 4.92486775,201.146447 11,201.146447 Z",id:"矩形",fill:e||"#DF2A3F",fillRule:"evenodd"}),l.jsx("path",{d:"M72.3425855,16.8295583 C75.799482,7.50883712 86.1577877,2.75526801 95.4785089,6.21216449 C100.284516,7.99463061 104.096358,11.7387855 105.968745,16.4968188 L106.112518,16.8745422 L159.385152,161.694068 C161.291848,166.877345 158.635655,172.624903 153.452378,174.531599 C148.358469,176.405421 142.719567,173.872338 140.716873,168.864661 L140.614848,168.598825 L89.211,28.86 L37.3759214,168.623816 C35.4885354,173.712715 29.8981043,176.351047 24.7909589,174.617647 L24.5226307,174.522368 C19.4337312,172.634982 16.7953993,167.044551 18.5287999,161.937406 L18.6240786,161.669077 L72.3425855,16.8295583 Z",id:"路径-21",fill:"currentColor",fillRule:"nonzero"}),l.jsx("path",{d:"M121,103.146447 C126.522847,103.146447 131,107.623599 131,113.146447 C131,118.575687 126.673329,122.994378 121.279905,123.142605 L121,123.146447 L55,123.146447 C49.4771525,123.146447 45,118.669294 45,113.146447 C45,107.717207 49.3266708,103.298515 54.7200952,103.150288 L55,103.146447 L121,103.146447 Z",id:"路径-22",fill:"currentColor",fillRule:"nonzero"})]})})})})}function h(e){const[t,c]=s.useState(void 0);function r(o){var a;(a=e.action)==null||a.call(e,o)}function n(){var o;(o=e.action)==null||o.call(e,t)}const d=s.useCallback(i.debounce(o=>{c(o)},350),[]);return l.jsxs("div",{className:"richtext-flex richtext-items-center richtext-h-[32px]",children:[l.jsx(i.ActionButton,{tooltip:e==null?void 0:e.tooltip,disabled:e==null?void 0:e.disabled,action:n,children:l.jsx("span",{className:"richtext-flex richtext-items-center richtext-justify-center richtext-text-sm",children:l.jsx(C,{fill:t})})}),l.jsx(i.ColorPicker,{selectedColor:t,setSelectedColor:d,onChange:r,disabled:e==null?void 0:e.disabled,colors:e==null?void 0:e.colors,defaultColor:e==null?void 0:e.defaultColor,children:l.jsx(i.Button,{variant:"ghost",size:"icon",className:"r!ichtext-h-[32px] !richtext-w-3",disabled:e==null?void 0:e.disabled,children:l.jsx(i.IconComponent,{className:"!richtext-w-3 !richtext-h-3 richtext-text-zinc-500",name:"MenuDown"})})})]})}const f=x.extend({addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),button({editor:t,t:c,extension:r}){return{component:h,componentProps:{colors:r.options.colors,defaultColor:r.options.defaultColor,action:n=>{n===void 0&&t.chain().focus().unsetColor().run(),typeof n=="string"&&t.chain().focus().setColor(n).run()},isActive:()=>{const{color:n}=t.getAttributes("textStyle");return n&&t.isActive({color:n})||!1},editor:t,disabled:!1,tooltip:c("editor.color.tooltip")}}}}}});exports.Color=f;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./index-DjP7Onch.cjs");const u=require("./index-COecBbaE.cjs"),l=require("react/jsx-runtime"),d=require("react"),i=require("./RichTextEditor-qp9T7xuG.cjs"),x=u.Extension.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:e=>{var t;return(t=e.style.color)===null||t===void 0?void 0:t.replace(/['"]+/g,"")},renderHTML:e=>e.color?{style:`color: ${e.color}`}:{}}}}]},addCommands(){return{setColor:e=>({chain:t})=>t().setMark("textStyle",{color:e}).run(),unsetColor:()=>({chain:e})=>e().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}});function C({fill:e}){return l.jsx("svg",{width:"18px",height:"18px",viewBox:"0 0 240 240",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:l.jsx("g",{stroke:"none",strokeWidth:1,fill:"none",fillRule:"evenodd",children:l.jsx("g",{transform:"translate(0.000000, 0.500000)",children:l.jsxs("g",{transform:"translate(39.000000, 17.353553)",children:[l.jsx("path",{d:"M11,201.146447 L167,201.146447 C173.075132,201.146447 178,206.071314 178,212.146447 C178,218.221579 173.075132,223.146447 167,223.146447 L11,223.146447 C4.92486775,223.146447 7.43989126e-16,218.221579 0,212.146447 C-7.43989126e-16,206.071314 4.92486775,201.146447 11,201.146447 Z",id:"矩形",fill:e||"#DF2A3F",fillRule:"evenodd"}),l.jsx("path",{d:"M72.3425855,16.8295583 C75.799482,7.50883712 86.1577877,2.75526801 95.4785089,6.21216449 C100.284516,7.99463061 104.096358,11.7387855 105.968745,16.4968188 L106.112518,16.8745422 L159.385152,161.694068 C161.291848,166.877345 158.635655,172.624903 153.452378,174.531599 C148.358469,176.405421 142.719567,173.872338 140.716873,168.864661 L140.614848,168.598825 L89.211,28.86 L37.3759214,168.623816 C35.4885354,173.712715 29.8981043,176.351047 24.7909589,174.617647 L24.5226307,174.522368 C19.4337312,172.634982 16.7953993,167.044551 18.5287999,161.937406 L18.6240786,161.669077 L72.3425855,16.8295583 Z",id:"路径-21",fill:"currentColor",fillRule:"nonzero"}),l.jsx("path",{d:"M121,103.146447 C126.522847,103.146447 131,107.623599 131,113.146447 C131,118.575687 126.673329,122.994378 121.279905,123.142605 L121,123.146447 L55,123.146447 C49.4771525,123.146447 45,118.669294 45,113.146447 C45,107.717207 49.3266708,103.298515 54.7200952,103.150288 L55,103.146447 L121,103.146447 Z",id:"路径-22",fill:"currentColor",fillRule:"nonzero"})]})})})})}function h(e){const[t,c]=d.useState(void 0);function r(o){var a;(a=e.action)==null||a.call(e,o)}function n(){var o;(o=e.action)==null||o.call(e,t)}const s=d.useCallback(i.debounce(o=>{c(o)},350),[]);return l.jsxs("div",{className:"richtext-flex richtext-items-center richtext-h-[32px]",children:[l.jsx(i.ActionButton,{tooltip:e==null?void 0:e.tooltip,disabled:e==null?void 0:e.disabled,action:n,children:l.jsx("span",{className:"richtext-flex richtext-items-center richtext-justify-center richtext-text-sm",children:l.jsx(C,{fill:t||e.initialDisplayedColor})})}),l.jsx(i.ColorPicker,{selectedColor:t,setSelectedColor:s,onChange:r,disabled:e==null?void 0:e.disabled,colors:e==null?void 0:e.colors,defaultColor:e==null?void 0:e.defaultColor,children:l.jsx(i.Button,{variant:"ghost",size:"icon",className:"r!ichtext-h-[32px] !richtext-w-3",disabled:e==null?void 0:e.disabled,children:l.jsx(i.IconComponent,{className:"!richtext-w-3 !richtext-h-3 richtext-text-zinc-500",name:"MenuDown"})})})]})}const f=x.extend({addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),button({editor:t,t:c,extension:r}){return{component:h,componentProps:{colors:r.options.colors,defaultColor:r.options.defaultColor,action:n=>{n===void 0&&t.chain().focus().unsetColor().run(),typeof n=="string"&&t.chain().focus().setColor(n).run()},isActive:()=>{const{color:n}=t.getAttributes("textStyle");return n&&t.isActive({color:n})||!1},editor:t,disabled:!1,tooltip:c("editor.color.tooltip")}}}}}});exports.Color=f;
package/lib/Color.d.cts CHANGED
@@ -105,11 +105,11 @@ declare module '@tiptap/core' {
105
105
 
106
106
  declare module '@tiptap/core' {
107
107
  interface Commands<ReturnType> {
108
- emoji: {
109
- setEmoji: (emoji: {
110
- name: string;
111
- emoji: string;
112
- }) => ReturnType;
108
+ codeView: {
109
+ /**
110
+ * Toggle code view mode
111
+ */
112
+ toggleCodeView: () => ReturnType;
113
113
  };
114
114
  }
115
115
  }
@@ -125,6 +125,18 @@ declare module '@tiptap/core' {
125
125
  }
126
126
 
127
127
 
128
+ declare module '@tiptap/core' {
129
+ interface Commands<ReturnType> {
130
+ emoji: {
131
+ setEmoji: (emoji: {
132
+ name: string;
133
+ emoji: string;
134
+ }) => ReturnType;
135
+ };
136
+ }
137
+ }
138
+
139
+
128
140
  declare module '@tiptap/core' {
129
141
  interface Commands<ReturnType> {
130
142
  excalidraw: {
package/lib/Color.d.ts CHANGED
@@ -105,11 +105,11 @@ declare module '@tiptap/core' {
105
105
 
106
106
  declare module '@tiptap/core' {
107
107
  interface Commands<ReturnType> {
108
- emoji: {
109
- setEmoji: (emoji: {
110
- name: string;
111
- emoji: string;
112
- }) => ReturnType;
108
+ codeView: {
109
+ /**
110
+ * Toggle code view mode
111
+ */
112
+ toggleCodeView: () => ReturnType;
113
113
  };
114
114
  }
115
115
  }
@@ -125,6 +125,18 @@ declare module '@tiptap/core' {
125
125
  }
126
126
 
127
127
 
128
+ declare module '@tiptap/core' {
129
+ interface Commands<ReturnType> {
130
+ emoji: {
131
+ setEmoji: (emoji: {
132
+ name: string;
133
+ emoji: string;
134
+ }) => ReturnType;
135
+ };
136
+ }
137
+ }
138
+
139
+
128
140
  declare module '@tiptap/core' {
129
141
  interface Commands<ReturnType> {
130
142
  excalidraw: {
package/lib/Color.js CHANGED
@@ -2,7 +2,7 @@ import "./index-DXBa3JBo.js";
2
2
  import { E as u } from "./index-Drmyqk9P.js";
3
3
  import { jsxs as a, jsx as l } from "react/jsx-runtime";
4
4
  import { useState as s, useCallback as C } from "react";
5
- import { t as h, A as f, C as x, B as m, k as v } from "./RichTextEditor-BwuyWeH3.js";
5
+ import { t as h, A as f, C as x, B as m, k as v } from "./RichTextEditor-D5VO1y1d.js";
6
6
  const L = u.create({
7
7
  name: "color",
8
8
  addOptions() {
@@ -94,7 +94,7 @@ function g(t) {
94
94
  []
95
95
  );
96
96
  return /* @__PURE__ */ a("div", { className: "richtext-flex richtext-items-center richtext-h-[32px]", children: [
97
- /* @__PURE__ */ l(f, { tooltip: t == null ? void 0 : t.tooltip, disabled: t == null ? void 0 : t.disabled, action: n, children: /* @__PURE__ */ l("span", { className: "richtext-flex richtext-items-center richtext-justify-center richtext-text-sm", children: /* @__PURE__ */ l(b, { fill: e }) }) }),
97
+ /* @__PURE__ */ l(f, { tooltip: t == null ? void 0 : t.tooltip, disabled: t == null ? void 0 : t.disabled, action: n, children: /* @__PURE__ */ l("span", { className: "richtext-flex richtext-items-center richtext-justify-center richtext-text-sm", children: /* @__PURE__ */ l(b, { fill: e || t.initialDisplayedColor }) }) }),
98
98
  /* @__PURE__ */ l(
99
99
  x,
100
100
  {
@@ -27,11 +27,11 @@ declare module '@tiptap/core' {
27
27
 
28
28
  declare module '@tiptap/core' {
29
29
  interface Commands<ReturnType> {
30
- emoji: {
31
- setEmoji: (emoji: {
32
- name: string;
33
- emoji: string;
34
- }) => ReturnType;
30
+ codeView: {
31
+ /**
32
+ * Toggle code view mode
33
+ */
34
+ toggleCodeView: () => ReturnType;
35
35
  };
36
36
  }
37
37
  }
@@ -47,6 +47,18 @@ declare module '@tiptap/core' {
47
47
  }
48
48
 
49
49
 
50
+ declare module '@tiptap/core' {
51
+ interface Commands<ReturnType> {
52
+ emoji: {
53
+ setEmoji: (emoji: {
54
+ name: string;
55
+ emoji: string;
56
+ }) => ReturnType;
57
+ };
58
+ }
59
+ }
60
+
61
+
50
62
  declare module '@tiptap/core' {
51
63
  interface Commands<ReturnType> {
52
64
  excalidraw: {
package/lib/Document.d.ts CHANGED
@@ -27,11 +27,11 @@ declare module '@tiptap/core' {
27
27
 
28
28
  declare module '@tiptap/core' {
29
29
  interface Commands<ReturnType> {
30
- emoji: {
31
- setEmoji: (emoji: {
32
- name: string;
33
- emoji: string;
34
- }) => ReturnType;
30
+ codeView: {
31
+ /**
32
+ * Toggle code view mode
33
+ */
34
+ toggleCodeView: () => ReturnType;
35
35
  };
36
36
  }
37
37
  }
@@ -47,6 +47,18 @@ declare module '@tiptap/core' {
47
47
  }
48
48
 
49
49
 
50
+ declare module '@tiptap/core' {
51
+ interface Commands<ReturnType> {
52
+ emoji: {
53
+ setEmoji: (emoji: {
54
+ name: string;
55
+ emoji: string;
56
+ }) => ReturnType;
57
+ };
58
+ }
59
+ }
60
+
61
+
50
62
  declare module '@tiptap/core' {
51
63
  interface Commands<ReturnType> {
52
64
  excalidraw: {