draftify-react 0.1.9 → 0.2.1
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/draftify-react.css +1 -2
- package/dist/draftify-react.es.js +4988 -4568
- package/dist/draftify-react.umd.js +11 -12
- package/index.d.ts +28 -2
- package/package.json +8 -15
package/index.d.ts
CHANGED
|
@@ -20,7 +20,10 @@ export type BlockType =
|
|
|
20
20
|
| "image"
|
|
21
21
|
| "video"
|
|
22
22
|
| "link"
|
|
23
|
-
| "code"
|
|
23
|
+
| "code"
|
|
24
|
+
| "custom-1"
|
|
25
|
+
| "custom-2"
|
|
26
|
+
| "custom-3";
|
|
24
27
|
|
|
25
28
|
export interface BaseBlock {
|
|
26
29
|
id: string;
|
|
@@ -99,6 +102,11 @@ export interface ModifyCodePayload {
|
|
|
99
102
|
code: string;
|
|
100
103
|
}
|
|
101
104
|
|
|
105
|
+
export interface ModifyCustomPayload {
|
|
106
|
+
customBlockId: string;
|
|
107
|
+
payload: any;
|
|
108
|
+
}
|
|
109
|
+
|
|
102
110
|
/* ─────────────────────────────
|
|
103
111
|
Hook return type
|
|
104
112
|
───────────────────────────── */
|
|
@@ -147,6 +155,7 @@ export interface UseDraftifyReactReturn {
|
|
|
147
155
|
modifyVideo: (p: ModifyVideoPayload) => void;
|
|
148
156
|
modifyLink: (p: ModifyLinkPayload) => void;
|
|
149
157
|
modifyCode: (p: ModifyCodePayload) => void;
|
|
158
|
+
modifyCustom: (p: ModifyCustomPayload) => void;
|
|
150
159
|
|
|
151
160
|
/* clipboard / export */
|
|
152
161
|
handleCopy: () => void;
|
|
@@ -180,12 +189,25 @@ export function useDraftifyReact(
|
|
|
180
189
|
export interface DraftifyReactProps {
|
|
181
190
|
blocksData: DraftifyBlock[];
|
|
182
191
|
modifyBlocks: React.Dispatch<React.SetStateAction<DraftifyBlock[]>>;
|
|
192
|
+
options: string[];
|
|
193
|
+
CustomEditor1?: HTMLElement | JSX.Element;
|
|
194
|
+
CustomEditor2?: HTMLElement | JSX.Element;
|
|
195
|
+
CustomEditor3?: HTMLElement | JSX.Element;
|
|
196
|
+
CustomOutput1?: HTMLElement | JSX.Element;
|
|
197
|
+
CustomOutput2?: HTMLElement | JSX.Element;
|
|
198
|
+
CustomOutput3?: HTMLElement | JSX.Element;
|
|
199
|
+
defaultCustomData1?: Object;
|
|
200
|
+
defaultCustomData2?: Object;
|
|
201
|
+
defaultCustomData3?: Object;
|
|
183
202
|
}
|
|
184
203
|
|
|
185
204
|
declare function DraftifyReact(props: DraftifyReactProps): JSX.Element;
|
|
186
205
|
|
|
187
206
|
export interface ReaderProps {
|
|
188
207
|
blocksData: DraftifyBlock[];
|
|
208
|
+
CustomOutput1?: HTMLElement | JSX.Element;
|
|
209
|
+
CustomOutput2?: HTMLElement | JSX.Element;
|
|
210
|
+
CustomOutput3?: HTMLElement | JSX.Element;
|
|
189
211
|
}
|
|
190
212
|
|
|
191
213
|
declare function DraftifyBlocksReader(props: ReaderProps): JSX.Element;
|
|
@@ -197,6 +219,9 @@ declare function DraftifyBlocksReader(props: ReaderProps): JSX.Element;
|
|
|
197
219
|
export interface UseDraftifyReactProps {
|
|
198
220
|
blocksData: DraftifyBlock[];
|
|
199
221
|
modifyBlocks: React.Dispatch<React.SetStateAction<DraftifyBlock[]>>;
|
|
222
|
+
defaultCustomData1: any;
|
|
223
|
+
defaultCustomData2: any;
|
|
224
|
+
defaultCustomData3: any;
|
|
200
225
|
}
|
|
201
226
|
|
|
202
227
|
export declare function useDraftifyReact(props: UseDraftifyReactProps): {
|
|
@@ -238,6 +263,7 @@ export declare function useDraftifyReact(props: UseDraftifyReactProps): {
|
|
|
238
263
|
modifyVideo: (args: any) => void;
|
|
239
264
|
modifyLink: (args: any) => void;
|
|
240
265
|
modifyCode: (args: any) => void;
|
|
266
|
+
modifyCustom: (args: any) => void;
|
|
241
267
|
|
|
242
268
|
/* delete */
|
|
243
269
|
handleDelete: (id: string) => void;
|
|
@@ -285,7 +311,7 @@ declare function dragHandler(
|
|
|
285
311
|
): void;
|
|
286
312
|
|
|
287
313
|
declare function dragLeaveHandler(
|
|
288
|
-
e: React.DragEvent,
|
|
314
|
+
e: React.DragEvent | React.MouseEvent<HTMLDivElement, MouseEvent>,
|
|
289
315
|
output: React.RefObject<HTMLElement | null>
|
|
290
316
|
): void;
|
|
291
317
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "draftify-react",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/draftify-react.umd.js",
|
|
6
6
|
"module": "dist/draftify-react.es.js",
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
"dist",
|
|
10
10
|
"index.d.ts"
|
|
11
11
|
],
|
|
12
|
+
"style": "./dist/draftify-react.css",
|
|
12
13
|
"exports": {
|
|
13
14
|
".": {
|
|
14
15
|
"types": "./index.d.ts",
|
|
@@ -17,34 +18,26 @@
|
|
|
17
18
|
},
|
|
18
19
|
"./styles.css": "./dist/draftify-react.css"
|
|
19
20
|
},
|
|
20
|
-
"style": "dist/draftify-react.css",
|
|
21
21
|
"scripts": {
|
|
22
22
|
"dev": "vite",
|
|
23
|
-
"build
|
|
24
|
-
"build": "vite build && npm run build:css",
|
|
23
|
+
"build": "vite build",
|
|
25
24
|
"preview": "vite preview"
|
|
26
25
|
},
|
|
27
26
|
"peerDependencies": {
|
|
28
27
|
"react": ">=18",
|
|
29
28
|
"react-dom": ">=18"
|
|
30
29
|
},
|
|
31
|
-
"devDependencies": {
|
|
32
|
-
"@tailwindcss/cli": "^4.1.18",
|
|
33
|
-
"@vitejs/plugin-react": "^5.0.4",
|
|
34
|
-
"tailwindcss": "^4.1.18",
|
|
35
|
-
"vite": "^7.1.7"
|
|
36
|
-
},
|
|
37
30
|
"dependencies": {
|
|
38
31
|
"@fortawesome/fontawesome-svg-core": "^7.1.0",
|
|
39
32
|
"@fortawesome/free-regular-svg-icons": "^7.1.0",
|
|
40
33
|
"@fortawesome/free-solid-svg-icons": "^7.1.0",
|
|
41
34
|
"@fortawesome/react-fontawesome": "^3.1.0",
|
|
42
|
-
"@tailwindcss/vite": "^4.1.18",
|
|
43
35
|
"browser-image-compression": "^2.0.2",
|
|
44
|
-
"
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
"react
|
|
36
|
+
"framer-motion": "^12.23.24"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"@vitejs/plugin-react": "^5.0.4",
|
|
40
|
+
"vite": "^7.1.7"
|
|
48
41
|
},
|
|
49
42
|
"repository": "https://github.com/Bernard-Kuria/draftify-react.git",
|
|
50
43
|
"publishConfig": {
|