@elia-ori/editor 0.1.11 → 0.1.13
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/dist/index.cjs +6031 -663
- package/dist/index.cjs.map +1 -1
- package/dist/index.css.map +1 -0
- package/dist/index.d.cts +55 -94
- package/dist/index.d.ts +55 -94
- package/dist/index.js +6057 -658
- package/dist/index.js.map +1 -1
- package/dist/styles/editor.css +2250 -1
- package/package.json +2 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,110 +1,71 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
3
|
-
import { LucideProps } from 'lucide-react';
|
|
4
|
-
import * as React$1 from 'react';
|
|
5
|
-
import { ComponentType } from 'react';
|
|
6
|
-
import { ClassValue } from 'clsx';
|
|
7
|
-
import * as TogglePrimitive from '@radix-ui/react-toggle';
|
|
8
|
-
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
|
2
|
+
import { NodeType } from '@tiptap/pm/model';
|
|
9
3
|
import { Node } from '@tiptap/core';
|
|
10
4
|
|
|
11
|
-
type
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
5
|
+
type UploadFunction = (file: File, onProgress?: (event: {
|
|
6
|
+
progress: number;
|
|
7
|
+
}) => void, abortSignal?: AbortSignal) => Promise<string>;
|
|
8
|
+
interface ImageUploadNodeOptions {
|
|
9
|
+
/**
|
|
10
|
+
* The type of the node.
|
|
11
|
+
* @default 'image'
|
|
12
|
+
*/
|
|
13
|
+
type?: string | NodeType | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* Acceptable file types for upload.
|
|
16
|
+
* @default 'image/*'
|
|
17
|
+
*/
|
|
18
|
+
accept?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Maximum number of files that can be uploaded.
|
|
21
|
+
* @default 1
|
|
22
|
+
*/
|
|
23
|
+
limit?: number;
|
|
24
|
+
/**
|
|
25
|
+
* Maximum file size in bytes (0 for unlimited).
|
|
26
|
+
* @default 0
|
|
27
|
+
*/
|
|
28
|
+
maxSize?: number;
|
|
29
|
+
/**
|
|
30
|
+
* Function to handle the upload process.
|
|
31
|
+
*/
|
|
32
|
+
upload?: UploadFunction;
|
|
33
|
+
/**
|
|
34
|
+
* Callback for upload errors.
|
|
35
|
+
*/
|
|
36
|
+
onError?: (error: Error) => void;
|
|
37
|
+
/**
|
|
38
|
+
* Callback for successful uploads.
|
|
39
|
+
*/
|
|
40
|
+
onSuccess?: (url: string) => void;
|
|
41
|
+
/**
|
|
42
|
+
* HTML attributes to add to the image element.
|
|
43
|
+
* @default {}
|
|
44
|
+
* @example { class: 'foo' }
|
|
45
|
+
*/
|
|
46
|
+
HTMLAttributes: Record<string, any>;
|
|
47
|
+
}
|
|
48
|
+
declare module "@tiptap/react" {
|
|
49
|
+
interface Commands<ReturnType> {
|
|
50
|
+
imageUpload: {
|
|
51
|
+
setImageUploadNode: (options?: ImageUploadNodeOptions) => ReturnType;
|
|
52
|
+
};
|
|
53
|
+
}
|
|
27
54
|
}
|
|
28
|
-
declare function Toolbar({ editor, config, toolbarStart, toolbarEnd, theme, onThemeToggle, onImageUpload, }: ToolbarProps): react_jsx_runtime.JSX.Element | null;
|
|
29
55
|
|
|
56
|
+
type ToolbarItem = 'undo-redo' | 'heading' | 'list' | 'blockquote' | 'code-block' | 'callout' | 'table' | 'format' | 'text-color' | 'highlight' | 'link' | 'superscript' | 'subscript' | 'align' | 'image';
|
|
30
57
|
interface EliaEditorProps {
|
|
31
58
|
content?: string;
|
|
32
59
|
onChange?: (html: string) => void;
|
|
33
60
|
placeholder?: string;
|
|
34
|
-
toolbar?: ToolbarItem[]
|
|
35
|
-
|
|
36
|
-
toolbarStart?: React.ReactNode;
|
|
37
|
-
toolbarEnd?: React.ReactNode;
|
|
38
|
-
footer?: React.ReactNode;
|
|
61
|
+
toolbar?: ToolbarItem[];
|
|
62
|
+
onImageUpload?: UploadFunction;
|
|
39
63
|
className?: string;
|
|
40
64
|
editorClassName?: string;
|
|
41
65
|
autofocus?: boolean;
|
|
42
66
|
readOnly?: boolean;
|
|
43
|
-
theme?: 'light' | 'dark';
|
|
44
|
-
onThemeToggle?: () => void;
|
|
45
|
-
onImageUpload?: (file: File) => Promise<string> | void;
|
|
46
|
-
}
|
|
47
|
-
declare function EliaEditor({ content, onChange, placeholder, toolbar, header, toolbarStart, toolbarEnd, footer, className, editorClassName, autofocus, readOnly, theme, onThemeToggle, onImageUpload, }: EliaEditorProps): react_jsx_runtime.JSX.Element;
|
|
48
|
-
|
|
49
|
-
declare function cn(...inputs: ClassValue[]): string;
|
|
50
|
-
|
|
51
|
-
interface ButtonProps extends React$1.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
52
|
-
variant?: 'default' | 'ghost' | 'outline';
|
|
53
|
-
size?: 'default' | 'sm' | 'lg';
|
|
54
|
-
}
|
|
55
|
-
declare const Button: React$1.ForwardRefExoticComponent<ButtonProps & React$1.RefAttributes<HTMLButtonElement>>;
|
|
56
|
-
|
|
57
|
-
interface ToggleProps extends React$1.ComponentPropsWithoutRef<typeof TogglePrimitive.Root> {
|
|
58
|
-
size?: 'default' | 'sm';
|
|
59
|
-
}
|
|
60
|
-
declare const Toggle: React$1.ForwardRefExoticComponent<ToggleProps & React$1.RefAttributes<HTMLButtonElement>>;
|
|
61
|
-
|
|
62
|
-
declare const DropdownMenu: React$1.FC<DropdownMenuPrimitive.DropdownMenuProps>;
|
|
63
|
-
declare const DropdownMenuTrigger: React$1.ForwardRefExoticComponent<DropdownMenuPrimitive.DropdownMenuTriggerProps & React$1.RefAttributes<HTMLButtonElement>>;
|
|
64
|
-
declare const DropdownMenuContent: React$1.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuContentProps & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
|
|
65
|
-
declare const DropdownMenuItem: React$1.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuItemProps & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
|
|
66
|
-
declare const DropdownMenuSeparator: React$1.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuSeparatorProps & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
|
|
67
|
-
|
|
68
|
-
interface ToolbarButtonProps {
|
|
69
|
-
pressed: boolean;
|
|
70
|
-
onPressedChange: () => void;
|
|
71
|
-
disabled?: boolean;
|
|
72
|
-
children: React.ReactNode;
|
|
73
|
-
title?: string;
|
|
74
|
-
}
|
|
75
|
-
declare function ToolbarButton({ pressed, onPressedChange, disabled, children, title, }: ToolbarButtonProps): react_jsx_runtime.JSX.Element;
|
|
76
|
-
|
|
77
|
-
declare function ToolbarDivider(): react_jsx_runtime.JSX.Element;
|
|
78
|
-
|
|
79
|
-
interface HeadingDropdownProps {
|
|
80
|
-
editor: Editor;
|
|
81
|
-
iconSize?: string;
|
|
82
|
-
}
|
|
83
|
-
declare function HeadingDropdown({ editor, iconSize }: HeadingDropdownProps): react_jsx_runtime.JSX.Element;
|
|
84
|
-
|
|
85
|
-
interface ListDropdownProps {
|
|
86
|
-
editor: Editor;
|
|
87
|
-
iconSize?: string;
|
|
88
|
-
}
|
|
89
|
-
declare function ListDropdown({ editor, iconSize }: ListDropdownProps): react_jsx_runtime.JSX.Element;
|
|
90
|
-
|
|
91
|
-
interface TableDropdownProps {
|
|
92
|
-
editor: Editor;
|
|
93
|
-
iconSize?: string;
|
|
94
|
-
}
|
|
95
|
-
declare function TableDropdown({ editor, iconSize }: TableDropdownProps): react_jsx_runtime.JSX.Element;
|
|
96
|
-
|
|
97
|
-
interface CalloutDropdownProps {
|
|
98
|
-
editor: Editor;
|
|
99
|
-
iconSize?: string;
|
|
100
|
-
}
|
|
101
|
-
declare function CalloutDropdown({ editor, iconSize }: CalloutDropdownProps): react_jsx_runtime.JSX.Element;
|
|
102
|
-
|
|
103
|
-
interface ColorPickerProps {
|
|
104
|
-
editor: Editor;
|
|
105
|
-
iconSize?: string;
|
|
106
67
|
}
|
|
107
|
-
declare function
|
|
68
|
+
declare function EliaEditor({ content, onChange, placeholder, toolbar, onImageUpload, className, editorClassName, autofocus, readOnly, }: EliaEditorProps): react_jsx_runtime.JSX.Element;
|
|
108
69
|
|
|
109
70
|
type CalloutType = 'success' | 'warning' | 'error' | 'info';
|
|
110
71
|
interface CalloutOptions {
|
|
@@ -125,4 +86,4 @@ declare module "@tiptap/core" {
|
|
|
125
86
|
}
|
|
126
87
|
declare const Callout: Node<CalloutOptions, any>;
|
|
127
88
|
|
|
128
|
-
export {
|
|
89
|
+
export { Callout, type CalloutOptions, type CalloutType, EliaEditor, type EliaEditorProps, EliaEditor as SimpleEditor, type ToolbarItem, type UploadFunction };
|