tiptop-editor 1.0.18 → 1.2.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.
- package/README.md +223 -43
- package/dist/components/editor/TableSelectionMenu.d.ts +4 -0
- package/dist/components/editor/TiptopEditor.d.ts +3 -0
- package/dist/components/editor/TiptopEditor.stories.d.ts +16 -0
- package/dist/components/{ColorButton.d.ts → menus/ColorButton.d.ts} +1 -1
- package/dist/components/menus/TableButtonMenu.d.ts +7 -0
- package/dist/components/{TextSelectionMenu.d.ts → menus/TextSelectionMenu.d.ts} +1 -1
- package/dist/components/{EditorButton.d.ts → ui/EditorButton.d.ts} +1 -1
- package/dist/extensions/slashCommand/SlashCommand.d.ts +6 -1
- package/dist/extensions/slashCommand/SlashCommandSuggestion.d.ts +3 -29
- package/dist/helpers.d.ts +3 -3
- package/dist/index.d.ts +1 -1
- package/dist/tiptop-editor.css +1 -1
- package/dist/tiptop-editor.es.js +5284 -4288
- package/dist/tiptop-editor.umd.js +30 -11
- package/dist/types.d.ts +38 -15
- package/package.json +12 -2
- package/dist/components/TiptopEditor.d.ts +0 -7
- /package/dist/components/{DragHandleColorList.d.ts → editor/DragHandleColorList.d.ts} +0 -0
- /package/dist/components/{TiptopDragHandle.d.ts → editor/TiptopDragHandle.d.ts} +0 -0
- /package/dist/components/{TransformIntoIcon.d.ts → editor/TransformIntoIcon.d.ts} +0 -0
- /package/dist/components/{ColorButtonMenu.d.ts → menus/ColorButtonMenu.d.ts} +0 -0
- /package/dist/components/{LinkButtonMenu.d.ts → menus/LinkButtonMenu.d.ts} +0 -0
- /package/dist/components/{MoreOptionsButtonMenu.d.ts → menus/MoreOptionsButtonMenu.d.ts} +0 -0
- /package/dist/components/{TransformIntoButtonMenu.d.ts → menus/TransformIntoButtonMenu.d.ts} +0 -0
- /package/dist/components/{CloseIcon.d.ts → ui/CloseIcon.d.ts} +0 -0
- /package/dist/components/{ColorIcon.d.ts → ui/ColorIcon.d.ts} +0 -0
- /package/dist/components/{Icon.d.ts → ui/Icon.d.ts} +0 -0
package/dist/types.d.ts
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
import { Editor, EditorContentProps, Range, UseEditorOptions } from '@tiptap/react';
|
|
2
2
|
import { icons } from 'lucide-react';
|
|
3
|
+
export type ImageUploadResponseResolver = string | string[] | ((response: Record<string, unknown>) => string | null | undefined);
|
|
4
|
+
export type TiptopEditorOptions = Omit<Partial<UseEditorOptions & {
|
|
5
|
+
/**
|
|
6
|
+
* The url of the server where the file should be uploaded.
|
|
7
|
+
* If not specified, the imageUploader will "fake" an upload for
|
|
8
|
+
* some seconds and create a local Url with the image file.
|
|
9
|
+
* @default undefined
|
|
10
|
+
*/
|
|
11
|
+
imgUploadUrl?: string;
|
|
12
|
+
/**
|
|
13
|
+
* The key that holds the value of the image url from your server's response.
|
|
14
|
+
* Supports nested paths like `data.url`, path arrays like `['data', 'url']`,
|
|
15
|
+
* or a custom resolver function.
|
|
16
|
+
* @default undefined
|
|
17
|
+
*/
|
|
18
|
+
imgUploadResponseKey?: ImageUploadResponseResolver;
|
|
19
|
+
/**
|
|
20
|
+
* Disables the default Card wrapper and removes the editor's built-in padding.
|
|
21
|
+
* Use this when you want to embed the editor inside your own layout container.
|
|
22
|
+
* @default false
|
|
23
|
+
*/
|
|
24
|
+
disableDefaultContainer?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Controls whether the drag handle is rendered.
|
|
27
|
+
* @default true
|
|
28
|
+
*/
|
|
29
|
+
showDragHandle?: boolean;
|
|
30
|
+
}>, 'extensions'>;
|
|
3
31
|
export interface EditorButtonProps {
|
|
4
32
|
tooltipText?: React.ReactNode;
|
|
5
33
|
isIconOnly?: boolean;
|
|
@@ -35,20 +63,7 @@ export type TiptopEditorProps = Omit<EditorContentProps, 'editor'> & {
|
|
|
35
63
|
* plus some other options specific to the Tiptop ccomponent
|
|
36
64
|
* implementation.
|
|
37
65
|
*/
|
|
38
|
-
editorOptions?:
|
|
39
|
-
/**
|
|
40
|
-
* The url of the server where the file should be uploaded.
|
|
41
|
-
* If not specified, the imageUploader will "fake" an upload for
|
|
42
|
-
* some seconds and create a local Url with the image file.
|
|
43
|
-
* @default undefined
|
|
44
|
-
*/
|
|
45
|
-
imgUploadUrl?: string;
|
|
46
|
-
/**
|
|
47
|
-
* The key that holds the value of the image url from your server's response.
|
|
48
|
-
* @default undefined
|
|
49
|
-
*/
|
|
50
|
-
imgUploadResponseKey?: string;
|
|
51
|
-
}>, 'extensions'>;
|
|
66
|
+
editorOptions?: TiptopEditorOptions;
|
|
52
67
|
};
|
|
53
68
|
export interface ColorButtonProps {
|
|
54
69
|
editor: Editor;
|
|
@@ -64,6 +79,12 @@ export interface TextSelectionMenuProps {
|
|
|
64
79
|
prepend?: React.ReactNode;
|
|
65
80
|
append?: React.ReactNode;
|
|
66
81
|
}
|
|
82
|
+
export interface TiptopEditorHandle {
|
|
83
|
+
getEditor: () => Editor | null;
|
|
84
|
+
on: Editor['on'];
|
|
85
|
+
off: Editor['off'];
|
|
86
|
+
once: Editor['once'];
|
|
87
|
+
}
|
|
67
88
|
export interface KeyDownRef {
|
|
68
89
|
onKeyDown: (props: {
|
|
69
90
|
event: KeyboardEvent;
|
|
@@ -79,9 +100,11 @@ export interface ImageUploaderExtensionOptions {
|
|
|
79
100
|
imgUploadUrl?: string;
|
|
80
101
|
/**
|
|
81
102
|
* The key that holds the value of the image url from your server's response.
|
|
103
|
+
* Supports nested paths like `data.url`, path arrays like `['data', 'url']`,
|
|
104
|
+
* or a custom resolver function.
|
|
82
105
|
* @default undefined
|
|
83
106
|
*/
|
|
84
|
-
imgUploadResponseKey?:
|
|
107
|
+
imgUploadResponseKey?: ImageUploadResponseResolver;
|
|
85
108
|
allowedMimeTypes?: string[];
|
|
86
109
|
maxFileSize: number;
|
|
87
110
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tiptop-editor",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Notion-like editor built with Tiptap v3 and HeroUI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/tiptop-editor.umd.js",
|
|
@@ -17,6 +17,10 @@
|
|
|
17
17
|
"files": [
|
|
18
18
|
"dist"
|
|
19
19
|
],
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "https://github.com/ds-mbappe/tiptop-editor"
|
|
23
|
+
},
|
|
20
24
|
"homepage": "https://github.com/ds-mbappe/tiptop-editor#readme",
|
|
21
25
|
"bugs": {
|
|
22
26
|
"url": "https://github.com/ds-mbappe/tiptop-editor/issues",
|
|
@@ -26,7 +30,9 @@
|
|
|
26
30
|
"dev": "vite",
|
|
27
31
|
"clean": "rm -rf dist",
|
|
28
32
|
"preview": "vite preview",
|
|
29
|
-
"build": "npm run clean && vite build"
|
|
33
|
+
"build": "npm run clean && vite build",
|
|
34
|
+
"storybook": "storybook dev -p 6006",
|
|
35
|
+
"build-storybook": "storybook build"
|
|
30
36
|
},
|
|
31
37
|
"keywords": [
|
|
32
38
|
"tiptap",
|
|
@@ -78,6 +84,7 @@
|
|
|
78
84
|
"@tiptap/extension-node-range": "^3.0.9",
|
|
79
85
|
"@tiptap/extension-subscript": "^3.0.9",
|
|
80
86
|
"@tiptap/extension-superscript": "^3.0.9",
|
|
87
|
+
"@tiptap/extension-table": "^3.20.0",
|
|
81
88
|
"@tiptap/extension-text-align": "^3.0.9",
|
|
82
89
|
"@tiptap/extension-text-style": "^3.0.9",
|
|
83
90
|
"@tiptap/extensions": "^3.0.9",
|
|
@@ -86,6 +93,8 @@
|
|
|
86
93
|
},
|
|
87
94
|
"devDependencies": {
|
|
88
95
|
"@eslint/js": "^9.30.1",
|
|
96
|
+
"@storybook/addon-docs": "^10.2.13",
|
|
97
|
+
"@storybook/react-vite": "^10.2.13",
|
|
89
98
|
"@tailwindcss/vite": "^4.1.11",
|
|
90
99
|
"@types/node": "^24.1.0",
|
|
91
100
|
"@types/react": "^19.1.8",
|
|
@@ -96,6 +105,7 @@
|
|
|
96
105
|
"eslint-plugin-react-refresh": "^0.4.20",
|
|
97
106
|
"globals": "^16.3.0",
|
|
98
107
|
"rollup-plugin-visualizer": "^6.0.3",
|
|
108
|
+
"storybook": "^10.2.13",
|
|
99
109
|
"tailwindcss": "^4.1.11",
|
|
100
110
|
"typescript": "~5.8.3",
|
|
101
111
|
"typescript-eslint": "^8.35.1",
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { useEditorState } from '@tiptap/react';
|
|
2
|
-
import { TiptopEditorProps } from '../types';
|
|
3
|
-
export interface TiptopEditorHandle {
|
|
4
|
-
getEditor: () => ReturnType<typeof useEditorState> | null;
|
|
5
|
-
}
|
|
6
|
-
declare const TiptopEditor: import('react').ForwardRefExoticComponent<Omit<TiptopEditorProps, "ref"> & import('react').RefAttributes<TiptopEditorHandle>>;
|
|
7
|
-
export default TiptopEditor;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/dist/components/{TransformIntoButtonMenu.d.ts → menus/TransformIntoButtonMenu.d.ts}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|