editcrafter 1.0.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.
@@ -0,0 +1,147 @@
1
+ import { FC } from 'react';
2
+ import { JSX } from 'react/jsx-runtime';
3
+ import { Node as Node_2 } from '@tiptap/core';
4
+
5
+ export declare const CrafterPreview: FC<CrafterPreviewProps>;
6
+
7
+ export declare type CrafterPreviewProps = {
8
+ value: string;
9
+ className?: string;
10
+ };
11
+
12
+ export declare type EditCrafterProps = {
13
+ initialValue?: string;
14
+ onContentChange?: (value: string) => void;
15
+ wrapperClassName?: string;
16
+ contentClassName?: string;
17
+ imageUploaderConfig?: ImageUploaderType;
18
+ placeholder?: string;
19
+ };
20
+
21
+ /**
22
+ * Enhanced Image extension with support for alignment, sizing, and metadata
23
+ * Extends the base Tiptap Image extension
24
+ */
25
+ export declare const EnhancedImage: Node_2<EnhancedImageOptions, any>;
26
+
27
+ export declare interface EnhancedImageOptions {
28
+ /**
29
+ * Controls if images should be rendered inline or as blocks
30
+ * @default false
31
+ */
32
+ inline: boolean;
33
+ /**
34
+ * Controls if images should allow a base64 encoded image as src
35
+ * @default true
36
+ */
37
+ allowBase64: boolean;
38
+ /**
39
+ * HTML attributes to add to the image element
40
+ * @default {}
41
+ */
42
+ HTMLAttributes: Record<string, any>;
43
+ }
44
+
45
+ export declare type ImageUploaderType = {
46
+ enabledefault: true;
47
+ CustomToolbarButton?: React.ComponentType<{
48
+ addImage: (file: string) => void;
49
+ }>;
50
+ defaultUploadHandler: (file: File, onProgress?: (event: {
51
+ progress: number;
52
+ }) => void, abortSignal?: AbortSignal) => Promise<string>;
53
+ } | {
54
+ enabledefault?: false;
55
+ CustomToolbarButton: React.ComponentType<{
56
+ addImage: (file: string) => void;
57
+ }>;
58
+ defaultUploadHandler?: undefined;
59
+ };
60
+
61
+ export declare function SimpleEditor({ initialValue, onContentChange, wrapperClassName, contentClassName, imageUploaderConfig, placeholder, }: EditCrafterProps): JSX.Element;
62
+
63
+ export { }
64
+
65
+
66
+ declare module "@tiptap/core" {
67
+ interface Commands<ReturnType> {
68
+ enhancedImage: {
69
+ /**
70
+ * Set an image with optional width, height, and alignment
71
+ */
72
+ setImage: (options: {
73
+ src: string;
74
+ alt?: string;
75
+ title?: string;
76
+ width?: string;
77
+ height?: string;
78
+ align?: "left" | "center" | "right";
79
+ }) => ReturnType;
80
+ /**
81
+ * Update image alignment
82
+ */
83
+ setImageAlign: (align: "left" | "center" | "right") => ReturnType;
84
+ /**
85
+ * Update image width
86
+ */
87
+ setImageWidth: (width: string) => ReturnType;
88
+ /**
89
+ * Update image alt text
90
+ */
91
+ setImageAlt: (alt: string) => ReturnType;
92
+ /**
93
+ * Update image title
94
+ */
95
+ setImageTitle: (title: string) => ReturnType;
96
+ };
97
+ }
98
+ }
99
+
100
+
101
+ declare module "@tiptap/core" {
102
+ interface Commands<ReturnType> {
103
+ nodeBackground: {
104
+ setNodeBackgroundColor: (backgroundColor: string) => ReturnType;
105
+ unsetNodeBackgroundColor: () => ReturnType;
106
+ toggleNodeBackgroundColor: (backgroundColor: string) => ReturnType;
107
+ };
108
+ }
109
+ }
110
+
111
+
112
+ declare module "@tiptap/core" {
113
+ interface Commands<ReturnType> {
114
+ nodeAlignment: {
115
+ setNodeTextAlign: (textAlign: string) => ReturnType;
116
+ unsetNodeTextAlign: () => ReturnType;
117
+ toggleNodeTextAlign: (textAlign: string) => ReturnType;
118
+ setNodeVAlign: (verticalAlign: string) => ReturnType;
119
+ unsetNodeVAlign: () => ReturnType;
120
+ toggleNodeVAlign: (verticalAlign: string) => ReturnType;
121
+ setNodeAlignment: (textAlign?: string, verticalAlign?: string) => ReturnType;
122
+ unsetNodeAlignment: () => ReturnType;
123
+ };
124
+ }
125
+ }
126
+
127
+
128
+ declare module "@tiptap/react" {
129
+ interface Commands<ReturnType> {
130
+ imageUpload: {
131
+ setImageUploadNode: (options?: ImageUploadNodeOptions) => ReturnType;
132
+ };
133
+ }
134
+ }
135
+
136
+
137
+ declare module "@tiptap/core" {
138
+ interface Commands<ReturnType> {
139
+ tableHandle: {
140
+ freezeHandles: () => ReturnType;
141
+ unfreezeHandles: () => ReturnType;
142
+ };
143
+ }
144
+ interface EditorEvents {
145
+ tableHandleState: TableHandlesState;
146
+ }
147
+ }
package/dist/vite.svg ADDED
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
package/package.json ADDED
@@ -0,0 +1,69 @@
1
+ {
2
+ "name": "editcrafter",
3
+ "version": "1.0.0",
4
+ "type": "module",
5
+ "main": "./dist/editcrafter.umd.js",
6
+ "module": "./dist/editcrafter.es.js",
7
+ "types": "./dist/index.d.ts",
8
+ "files": [
9
+ "dist"
10
+ ],
11
+ "exports": {
12
+ ".": {
13
+ "types": "./dist/index.d.ts",
14
+ "import": "./dist/editcrafter.es.js",
15
+ "require": "./dist/editcrafter.umd.js"
16
+ }
17
+ },
18
+ "scripts": {
19
+ "dev": "vite",
20
+ "build": "tsc -b && vite build",
21
+ "lint": "eslint .",
22
+ "preview": "vite preview"
23
+ },
24
+ "dependencies": {
25
+ "@floating-ui/react": "^0.27.17",
26
+ "@radix-ui/react-dropdown-menu": "^2.1.16",
27
+ "@radix-ui/react-popover": "^1.1.15",
28
+ "@tiptap/core": "^3.19.0",
29
+ "@tiptap/extension-bubble-menu": "^3.19.0",
30
+ "@tiptap/extension-color": "^3.19.0",
31
+ "@tiptap/extension-highlight": "^3.19.0",
32
+ "@tiptap/extension-horizontal-rule": "^3.19.0",
33
+ "@tiptap/extension-image": "^3.19.0",
34
+ "@tiptap/extension-list": "^3.19.0",
35
+ "@tiptap/extension-subscript": "^3.19.0",
36
+ "@tiptap/extension-superscript": "^3.19.0",
37
+ "@tiptap/extension-table": "^3.19.0",
38
+ "@tiptap/extension-text-align": "^3.19.0",
39
+ "@tiptap/extension-text-style": "^3.19.0",
40
+ "@tiptap/extension-typography": "^3.19.0",
41
+ "@tiptap/extensions": "^3.19.0",
42
+ "@tiptap/pm": "^3.19.0",
43
+ "@tiptap/react": "^3.19.0",
44
+ "@tiptap/starter-kit": "^3.19.0",
45
+ "html-react-parser": "^5.2.17",
46
+ "lodash.throttle": "^4.1.1",
47
+ "react": "^19.2.0",
48
+ "react-dom": "^19.2.0",
49
+ "react-hotkeys-hook": "^5.2.4"
50
+ },
51
+ "devDependencies": {
52
+ "@ariakit/react": "^0.4.21",
53
+ "@eslint/js": "^9.39.1",
54
+ "@types/lodash.throttle": "^4.1.9",
55
+ "@types/node": "^24.10.1",
56
+ "@types/react": "^19.2.5",
57
+ "@types/react-dom": "^19.2.3",
58
+ "@vitejs/plugin-react": "^5.1.1",
59
+ "eslint": "^9.39.1",
60
+ "eslint-plugin-react-hooks": "^7.0.1",
61
+ "eslint-plugin-react-refresh": "^0.4.24",
62
+ "globals": "^16.5.0",
63
+ "sass-embedded": "^1.97.3",
64
+ "typescript": "~5.9.3",
65
+ "typescript-eslint": "^8.46.4",
66
+ "vite": "^7.2.4",
67
+ "vite-plugin-dts": "^4.5.4"
68
+ }
69
+ }