reactjs-tiptap-editor-pro 0.2.22

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.
package/lib/index.d.ts ADDED
@@ -0,0 +1,511 @@
1
+ import { AnyExtension } from '@tiptap/core';
2
+ import { BubbleMenu } from '@tiptap/react';
3
+ import { default as default_2 } from 'react';
4
+ import { Editor } from '@tiptap/react';
5
+ import { Editor as Editor_2 } from '@tiptap/core';
6
+ import { ForwardRefExoticComponent } from 'react';
7
+ import { RefAttributes } from 'react';
8
+ import { TooltipContentProps } from '@radix-ui/react-tooltip';
9
+ import { UseEditorOptions } from '@tiptap/react';
10
+
11
+ declare interface ActionButtonProps {
12
+ icon?: string;
13
+ title?: string;
14
+ tooltip?: string;
15
+ disabled?: boolean;
16
+ shortcutKeys?: string[];
17
+ customClass?: string;
18
+ loading?: boolean;
19
+ tooltipOptions?: TooltipContentProps;
20
+ color?: string;
21
+ action?: ButtonViewReturnComponentProps['action'];
22
+ isActive?: ButtonViewReturnComponentProps['isActive'];
23
+ children?: default_2.ReactNode;
24
+ asChild?: boolean;
25
+ upload?: boolean;
26
+ }
27
+
28
+ export { BubbleMenu }
29
+
30
+ declare interface BubbleMenuConfig {
31
+ /**
32
+ * @description Column menu hidden
33
+ * @default false
34
+ */
35
+ hidden?: boolean;
36
+ /**
37
+ * custom menu actions
38
+ */
39
+ actions?: ActionButtonProps[];
40
+ }
41
+
42
+ /**
43
+ * Represents the BubbleMenuProps.
44
+ */
45
+ declare interface BubbleMenuProps {
46
+ columnConfig?: {
47
+ /**
48
+ * @description Column menu hidden
49
+ * @default false
50
+ */
51
+ hidden?: boolean;
52
+ };
53
+ tableConfig?: BubbleMenuConfig;
54
+ floatingMenuConfig?: {
55
+ /**
56
+ * @description Floating menu hidden
57
+ * @default false
58
+ */
59
+ hidden?: boolean;
60
+ };
61
+ linkConfig?: {
62
+ /**
63
+ * @description Link menu hidden
64
+ * @default false
65
+ */
66
+ hidden?: boolean;
67
+ };
68
+ textConfig?: {
69
+ /**
70
+ * @description Text menu hidden
71
+ * @default false
72
+ */
73
+ hidden?: boolean;
74
+ };
75
+ imageConfig?: {
76
+ /**
77
+ * @description Image menu hidden
78
+ * @default false
79
+ */
80
+ hidden?: boolean;
81
+ };
82
+ imageGifConfig?: {
83
+ /**
84
+ * @description Image menu hidden
85
+ * @default false
86
+ */
87
+ hidden?: boolean;
88
+ };
89
+ videoConfig?: {
90
+ /**
91
+ * @description Video menu hidden
92
+ * @default false
93
+ */
94
+ hidden?: boolean;
95
+ };
96
+ katexConfig?: {
97
+ /**
98
+ * @description katex menu hidden
99
+ * @default false
100
+ */
101
+ hidden?: boolean;
102
+ };
103
+ excalidrawConfig?: {
104
+ /**
105
+ * @description excalidraw menu hidden
106
+ * @default false
107
+ */
108
+ hidden?: boolean;
109
+ };
110
+ iframeConfig?: {
111
+ /**
112
+ * @description iframe menu hidden
113
+ * @default false
114
+ */
115
+ hidden?: boolean;
116
+ };
117
+ mermaidConfig?: {
118
+ /**
119
+ * @description mermaid menu hidden
120
+ * @default false
121
+ */
122
+ hidden?: boolean;
123
+ };
124
+ twitterConfig?: {
125
+ /**
126
+ * @description twitter menu hidden
127
+ * @default false
128
+ */
129
+ hidden?: boolean;
130
+ };
131
+ drawerConfig?: {
132
+ /**
133
+ * @description twitter menu hidden
134
+ * @default false
135
+ */
136
+ hidden?: boolean;
137
+ };
138
+ render?: (props: BubbleMenuRenderProps, dom: React.ReactNode) => React.ReactNode;
139
+ }
140
+
141
+ /**
142
+ * Represents the BubbleMenuRenderProps.
143
+ */
144
+ declare interface BubbleMenuRenderProps {
145
+ editor: Editor;
146
+ disabled: boolean;
147
+ bubbleMenu: BubbleMenuProps;
148
+ }
149
+
150
+ /**
151
+ * Represents the props for the ButtonView component.
152
+ */
153
+ declare interface ButtonViewReturnComponentProps {
154
+ /** Method triggered when action is performed */
155
+ action?: (value?: any) => void;
156
+ /** Whether it is in the active state */
157
+ isActive?: () => boolean;
158
+ /** Button icon */
159
+ icon?: any;
160
+ /** Text displayed on hover */
161
+ tooltip?: string;
162
+ [x: string]: any;
163
+ }
164
+
165
+ declare const _default: ForwardRefExoticComponent<RichTextEditorProps & RefAttributes< {
166
+ editor: Editor_2 | null;
167
+ }>>;
168
+ export default _default;
169
+
170
+ export { Editor }
171
+
172
+ /**
173
+ * Interface for RichTextEditor component props
174
+ */
175
+ declare interface RichTextEditorProps {
176
+ /** Content of the editor */
177
+ content: string;
178
+ /** Extensions for the editor */
179
+ extensions: AnyExtension[];
180
+ /** Output format */
181
+ output: 'html' | 'json' | 'text';
182
+ /** Model value */
183
+ modelValue?: string | object;
184
+ /** Dark mode flag */
185
+ dark?: boolean;
186
+ /** Dense mode flag */
187
+ dense?: boolean;
188
+ /** Disabled flag */
189
+ disabled?: boolean;
190
+ /** Label for the editor */
191
+ label?: string;
192
+ /** Hide toolbar flag */
193
+ hideToolbar?: boolean;
194
+ /** Disable bubble menu flag */
195
+ disableBubble?: boolean;
196
+ /** Hide bubble menu flag */
197
+ hideBubble?: boolean;
198
+ /** Remove default wrapper flag */
199
+ removeDefaultWrapper?: boolean;
200
+ /** Maximum width */
201
+ maxWidth?: string | number;
202
+ /** Minimum height */
203
+ minHeight?: string | number;
204
+ /** Maximum height */
205
+ maxHeight?: string | number;
206
+ /** Content class */
207
+ contentClass?: string | string[] | Record<string, any>;
208
+ /** Content change callback */
209
+ onChangeContent?: (val: any) => void;
210
+ /** Bubble menu props */
211
+ bubbleMenu?: BubbleMenuProps;
212
+ /** Toolbar props */
213
+ toolbar?: ToolbarProps;
214
+ /** Use editor options */
215
+ useEditorOptions?: UseEditorOptions;
216
+ /** Use editor options */
217
+ resetCSS?: boolean;
218
+ }
219
+
220
+ /**
221
+ * Represents the ToolbarItemProps.
222
+ */
223
+ declare interface ToolbarItemProps {
224
+ button: {
225
+ component: React.ComponentType<any>;
226
+ componentProps: Record<string, any>;
227
+ };
228
+ divider: boolean;
229
+ spacer: boolean;
230
+ type: string;
231
+ name: string;
232
+ }
233
+
234
+ declare interface ToolbarProps {
235
+ render?: (props: ToolbarRenderProps, toolbarItems: ToolbarItemProps[], dom: any[], containerDom: (innerContent: React.ReactNode) => React.ReactNode) => React.ReactNode;
236
+ }
237
+
238
+ declare interface ToolbarRenderProps {
239
+ editor: Editor;
240
+ disabled: boolean;
241
+ }
242
+
243
+ export { UseEditorOptions }
244
+
245
+ export declare function useEditorState(): UseEditorStateReturn;
246
+
247
+ export declare interface UseEditorStateReturn {
248
+ isReady: boolean;
249
+ editor: Editor_2 | null;
250
+ editorRef: React.MutableRefObject<{
251
+ editor: Editor_2 | null;
252
+ }>;
253
+ }
254
+
255
+ export { }
256
+
257
+
258
+ declare module '@tiptap/core' {
259
+ interface Commands<ReturnType> {
260
+ video: {
261
+ /**
262
+ * Add an video
263
+ */
264
+ setVideo: (options: Partial<SetVideoOptions>) => ReturnType;
265
+ /**
266
+ * Update an video
267
+ */
268
+ updateVideo: (options: Partial<SetVideoOptions>) => ReturnType;
269
+ };
270
+ }
271
+ }
272
+
273
+
274
+ declare module '@tiptap/core' {
275
+ interface Commands<ReturnType> {
276
+ fontSize: {
277
+ /**
278
+ * Set the text font size. ex: "12px", "2em", or "small". Must be a valid
279
+ * CSS font-size
280
+ * (https://developer.mozilla.org/en-US/docs/Web/CSS/font-size).
281
+ */
282
+ setFontSize: (fontSize: string) => ReturnType;
283
+ /**
284
+ * Unset the font size
285
+ */
286
+ unsetFontSize: () => ReturnType;
287
+ };
288
+ }
289
+ }
290
+
291
+
292
+ declare module '@tiptap/core' {
293
+ interface Commands<ReturnType> {
294
+ columns: {
295
+ insertColumns: (attrs?: {
296
+ cols: number;
297
+ }) => ReturnType;
298
+ addColBefore: () => ReturnType;
299
+ addColAfter: () => ReturnType;
300
+ deleteCol: () => ReturnType;
301
+ };
302
+ }
303
+ }
304
+
305
+
306
+ declare module '@tiptap/core' {
307
+ interface Commands<ReturnType> {
308
+ painter: {
309
+ setPainter: (marks: Mark[]) => ReturnType;
310
+ };
311
+ }
312
+ }
313
+
314
+
315
+ declare module '@tiptap/core' {
316
+ interface Commands<ReturnType> {
317
+ lineHeight: {
318
+ setLineHeight: (lineHeight: string) => ReturnType;
319
+ unsetLineHeight: () => ReturnType;
320
+ };
321
+ }
322
+ }
323
+
324
+
325
+ declare module '@tiptap/core' {
326
+ interface Commands<ReturnType> {
327
+ indent: {
328
+ /**
329
+ * Set the indent attribute
330
+ */
331
+ indent: () => ReturnType;
332
+ /**
333
+ * Set the outdent attribute
334
+ */
335
+ outdent: () => ReturnType;
336
+ };
337
+ }
338
+ }
339
+
340
+
341
+ declare module '@tiptap/core' {
342
+ interface Commands<ReturnType> {
343
+ imageUpload: {
344
+ /**
345
+ * Add an image
346
+ */
347
+ setImageInline: (options: Partial<SetImageAttrsOptions>) => ReturnType;
348
+ /**
349
+ * Update an image
350
+ */
351
+ updateImage: (options: Partial<SetImageAttrsOptions>) => ReturnType;
352
+ /**
353
+ * Set image alignment
354
+ */
355
+ setAlignImage: (align: 'left' | 'center' | 'right') => ReturnType;
356
+ };
357
+ }
358
+ }
359
+
360
+
361
+ declare module '@tiptap/core' {
362
+ interface Commands<ReturnType> {
363
+ tableCellBackground: {
364
+ setTableCellBackground: (color: string) => ReturnType;
365
+ unsetTableCellBackground: () => ReturnType;
366
+ };
367
+ }
368
+ }
369
+
370
+
371
+ declare module '@tiptap/core' {
372
+ interface Commands<ReturnType> {
373
+ katex: {
374
+ setKatex: (arg?: IKatexAttrs) => ReturnType;
375
+ };
376
+ }
377
+ }
378
+
379
+
380
+ declare module '@tiptap/core' {
381
+ interface Commands<ReturnType> {
382
+ tableOfContents: {
383
+ setTableOfContents: () => ReturnType;
384
+ removeTableOfContents: () => ReturnType;
385
+ };
386
+ }
387
+ }
388
+
389
+
390
+ declare module '@tiptap/core' {
391
+ interface Commands<ReturnType> {
392
+ excalidraw: {
393
+ setExcalidraw: (attrs?: IExcalidrawAttrs) => ReturnType;
394
+ };
395
+ }
396
+ }
397
+
398
+
399
+ declare module '@tiptap/core' {
400
+ interface Commands<ReturnType> {
401
+ emoji: {
402
+ setEmoji: (emoji: {
403
+ name: string;
404
+ emoji: string;
405
+ }) => ReturnType;
406
+ };
407
+ }
408
+ }
409
+
410
+
411
+ declare module '@tiptap/core' {
412
+ interface Commands<ReturnType> {
413
+ iframe: {
414
+ /**
415
+ * Add an iframe
416
+ */
417
+ setIframe: (options: {
418
+ src: string;
419
+ service: string;
420
+ }) => ReturnType;
421
+ };
422
+ }
423
+ }
424
+
425
+
426
+ declare module '@tiptap/core' {
427
+ interface Commands<ReturnType> {
428
+ exportWord: {
429
+ exportToWord: () => ReturnType;
430
+ };
431
+ }
432
+ }
433
+
434
+
435
+ declare module '@tiptap/core' {
436
+ interface Commands<ReturnType> {
437
+ search: {
438
+ setSearchTerm: (searchTerm: string) => ReturnType;
439
+ setReplaceTerm: (replaceTerm: string) => ReturnType;
440
+ replace: () => ReturnType;
441
+ replaceAll: () => ReturnType;
442
+ goToPrevSearchResult: () => void;
443
+ goToNextSearchResult: () => void;
444
+ setCaseSensitive: (caseSensitive: boolean) => ReturnType;
445
+ };
446
+ }
447
+ }
448
+
449
+
450
+ declare module '@tiptap/core' {
451
+ interface Commands<ReturnType> {
452
+ imageGifUpload: {
453
+ /**
454
+ * Add an image gif
455
+ */
456
+ setImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
457
+ /**
458
+ * Update an image gif
459
+ */
460
+ updateImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
461
+ /**
462
+ * Set image alignment
463
+ */
464
+ setAlignImageGif: (align: 'left' | 'center' | 'right') => ReturnType;
465
+ };
466
+ }
467
+ }
468
+
469
+
470
+ declare module '@tiptap/core' {
471
+ interface Commands<ReturnType> {
472
+ mermaid: {
473
+ setMermaid: (options: any, replace?: any) => ReturnType;
474
+ setAlignImageMermaid: (align: 'left' | 'center' | 'right') => ReturnType;
475
+ };
476
+ }
477
+ }
478
+
479
+
480
+ declare module '@tiptap/core' {
481
+ interface Commands<ReturnType> {
482
+ attachment: {
483
+ setAttachment: (attrs?: unknown) => ReturnType;
484
+ };
485
+ }
486
+ }
487
+
488
+
489
+ declare module '@tiptap/core' {
490
+ interface Commands<ReturnType> {
491
+ twitter: {
492
+ /**
493
+ * Insert a tweet
494
+ * @param options The tweet attributes
495
+ * @example editor.commands.setTweet({ src: 'https://x.com/seanpk/status/1800145949580517852' })
496
+ */
497
+ setTweet: (options: SetTweetOptions) => ReturnType;
498
+ updateTweet: (options: SetTweetOptions) => ReturnType;
499
+ };
500
+ }
501
+ }
502
+
503
+
504
+ declare module '@tiptap/core' {
505
+ interface Commands<ReturnType> {
506
+ drawer: {
507
+ setDrawer: (options: any, replace?: any) => ReturnType;
508
+ setAlignImageDrawer: (align: 'left' | 'center' | 'right') => ReturnType;
509
+ };
510
+ }
511
+ }
package/lib/index.js ADDED
@@ -0,0 +1,16 @@
1
+ import { useRef as d, useState as o, useEffect as f } from "react";
2
+ import { R as m } from "./RichTextEditor-BnruDETn.js";
3
+ import { B as x } from "./tiptap-BV9BUpUC.js";
4
+ function c() {
5
+ var t;
6
+ const e = d({ editor: null }), [u, s] = o(!1), [i, n] = o(null);
7
+ return f(() => {
8
+ var r;
9
+ (r = e.current) != null && r.editor && (s(!0), n(e.current.editor));
10
+ }, [e, (t = e.current) == null ? void 0 : t.editor]), { isReady: u, editor: i, editorRef: e };
11
+ }
12
+ export {
13
+ x as BubbleMenu,
14
+ m as default,
15
+ c as useEditorState
16
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-CYg22iLG.cjs");exports.en=e.locale$1;exports.hu_HU=e.locale$2;exports.locale=e.locale;exports.pt_BR=e.locale$5;exports.vi=e.locale$3;exports.zh_CN=e.locale$4;