asma-ui-richeditor 0.2.16 → 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.
@@ -1,4 +1,2 @@
1
- export declare const defaultExtensions: (import('@tiptap/core').Node<any, any> | import('@tiptap/core').Mark<import('node_modules/@tiptap/extension-text-style/dist').TextStyleOptions, any>)[];
2
- export declare const editModeExtensions: (import('@tiptap/core').Node<import('node_modules/@tiptap/extension-heading/dist').HeadingOptions, any> | import('@tiptap/core').Node<import('node_modules/@tiptap/extension-list-item/dist').ListItemOptions, any> | import('@tiptap/core').Node<import('node_modules/@tiptap/extension-bullet-list/dist').BulletListOptions, any> | import('@tiptap/core').Mark<import('node_modules/@tiptap/extension-bold/dist').BoldOptions, any> | import('@tiptap/core').Extension<{
3
- types: string[];
4
- }, any>)[];
1
+ import { Extensions } from '@tiptap/core';
2
+ export declare function resolveDefaultExtensions(): Extensions;
@@ -37,4 +37,37 @@ export interface IRichInput extends UseEditorOptions {
37
37
  key: string;
38
38
  dataTest: string;
39
39
  })[];
40
+ enableImageUpload?: boolean;
41
+ /**
42
+ * Function to handle the actual file upload to the storage microservice.
43
+ * Receives the raw File object, returns a Promise that resolves to the final URL.
44
+ * @param file - The image file selected by the user.
45
+ * @returns Promise<string> - The absolute URL to the uploaded image.
46
+ *
47
+ * @example
48
+ * const handleImageUpload = async (file: File): Promise<string> => {
49
+ * const formData = new FormData();
50
+ * formData.append('file', file);
51
+ * const response = await axios.post('/api/upload', formData);
52
+ * return response.data.url; // e.g., "https://cdn.example.com/uploads/abc.png"
53
+ * }
54
+ */
55
+ onImageUpload?: (file: File) => Promise<string>;
56
+ /**
57
+ * Callback function triggered when an image upload fails.
58
+ * Use this to display user-facing error messages (toasts, snackbars, etc.)
59
+ *
60
+ * @param error - The error that occurred during upload
61
+ * @param file - The file that failed to upload (optional)
62
+ *
63
+ * @example
64
+ * const handleImageUploadError = (error: Error, file?: File) => {
65
+ * processServerError(`Failed to upload ${file?.name || 'image'}: ${error.message}`);
66
+ * };
67
+ */
68
+ onImageUploadError?: (error: Error, file?: File) => void;
69
+ /**
70
+ * @description Enables YouTube extension for handling YouTube links
71
+ */
72
+ enableYoutube?: boolean;
40
73
  }
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.2.16",
6
+ "version": "0.3.0",
7
7
  "type": "module",
8
8
  "files": [
9
9
  "dist/**/*",
@@ -55,20 +55,13 @@
55
55
  "@emotion/styled": "^11.11.0",
56
56
  "@iconify/react": "^5.0.2",
57
57
  "@mui/material": "^5.13.7",
58
- "@tiptap/core": "^2.11.7",
59
- "@tiptap/extension-bold": "^2.11.7",
60
- "@tiptap/extension-bullet-list": "^2.11.7",
61
- "@tiptap/extension-document": "^2.11.7",
62
- "@tiptap/extension-heading": "^2.11.7",
63
- "@tiptap/extension-italic": "^2.11.7",
64
- "@tiptap/extension-link": "^2.11.7",
65
- "@tiptap/extension-list-item": "^2.11.7",
66
- "@tiptap/extension-ordered-list": "^2.11.7",
67
- "@tiptap/extension-paragraph": "^2.11.7",
68
- "@tiptap/extension-placeholder": "^2.11.7",
69
- "@tiptap/extension-text": "^2.27.2",
70
- "@tiptap/extension-text-style": "^2.11.7",
71
- "@tiptap/react": "^2.11.7",
58
+ "@tiptap/core": "^3.27.2",
59
+ "@tiptap/extension-image": "^3.27.1",
60
+ "@tiptap/extension-text-style": "^3.27.2",
61
+ "@tiptap/extension-youtube": "^3.27.1",
62
+ "@tiptap/extensions": "^3.27.2",
63
+ "@tiptap/react": "^3.27.2",
64
+ "@tiptap/starter-kit": "^3.27.2",
72
65
  "clsx": "^2.1.1",
73
66
  "emoji-picker-react": "^4.13.2",
74
67
  "tiptap-extension-font-size": "^1.2.0"