draftify-react 0.1.7 → 0.1.8
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/index.d.ts +117 -4
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { JSX } from "react";
|
|
2
2
|
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
|
|
3
5
|
import type { DraftifyBlock } from "draftify";
|
|
4
6
|
|
|
5
7
|
/* ─────────────────────────────
|
|
@@ -172,21 +174,132 @@ export function useDraftifyReact(
|
|
|
172
174
|
): UseDraftifyReactReturn;
|
|
173
175
|
|
|
174
176
|
/* ─────────────────────────────
|
|
175
|
-
|
|
177
|
+
Components
|
|
176
178
|
───────────────────────────── */
|
|
177
|
-
|
|
179
|
+
|
|
180
|
+
export interface DraftifyReactProps {
|
|
178
181
|
blocksData: DraftifyBlock[];
|
|
179
182
|
modifyBlocks: React.Dispatch<React.SetStateAction<DraftifyBlock[]>>;
|
|
180
183
|
}
|
|
181
184
|
|
|
182
185
|
declare function DraftifyReact(props: DraftifyReactProps): JSX.Element;
|
|
183
186
|
|
|
184
|
-
interface ReaderProps {
|
|
187
|
+
export interface ReaderProps {
|
|
185
188
|
blocksData: DraftifyBlock[];
|
|
186
189
|
}
|
|
187
190
|
|
|
188
191
|
declare function DraftifyBlocksReader(props: ReaderProps): JSX.Element;
|
|
189
192
|
|
|
193
|
+
/* ─────────────────────────────
|
|
194
|
+
Hooks
|
|
195
|
+
───────────────────────────── */
|
|
196
|
+
|
|
197
|
+
export interface UseDraftifyReactProps {
|
|
198
|
+
blocksData: DraftifyBlock[];
|
|
199
|
+
modifyBlocks: React.Dispatch<React.SetStateAction<DraftifyBlock[]>>;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
export declare function useDraftifyReact(props: UseDraftifyReactProps): {
|
|
203
|
+
/* view */
|
|
204
|
+
view: string;
|
|
205
|
+
setView: React.Dispatch<React.SetStateAction<string>>;
|
|
206
|
+
|
|
207
|
+
/* background grid */
|
|
208
|
+
gridDots: any[];
|
|
209
|
+
setGridDots: React.Dispatch<React.SetStateAction<any[]>>;
|
|
210
|
+
|
|
211
|
+
/* document metadata */
|
|
212
|
+
docTitle: string;
|
|
213
|
+
setDocTitle: React.Dispatch<React.SetStateAction<string>>;
|
|
214
|
+
description: string;
|
|
215
|
+
setDescription: React.Dispatch<React.SetStateAction<string>>;
|
|
216
|
+
author: string;
|
|
217
|
+
setAuthor: React.Dispatch<React.SetStateAction<string>>;
|
|
218
|
+
|
|
219
|
+
/* prompt */
|
|
220
|
+
promptAction: string;
|
|
221
|
+
setPromptAction: React.Dispatch<React.SetStateAction<string>>;
|
|
222
|
+
promptVisibility: boolean;
|
|
223
|
+
setPromptVisiblility: React.Dispatch<React.SetStateAction<boolean>>;
|
|
224
|
+
handlePromptAction: (action: string, option?: string) => void;
|
|
225
|
+
|
|
226
|
+
/* blocks */
|
|
227
|
+
blocksData: DraftifyBlock[];
|
|
228
|
+
handleClick: (type: string, cells?: number) => void;
|
|
229
|
+
|
|
230
|
+
/* block modifiers */
|
|
231
|
+
modifyHeading: (args: any) => void;
|
|
232
|
+
modifySubheading: (args: any) => void;
|
|
233
|
+
modifyParagraph: (args: any) => void;
|
|
234
|
+
modifyQuote: (args: any) => void;
|
|
235
|
+
modifyList: (args: any) => void;
|
|
236
|
+
modifyTable: (args: any) => void;
|
|
237
|
+
modifyImage: (args: any) => void;
|
|
238
|
+
modifyVideo: (args: any) => void;
|
|
239
|
+
modifyLink: (args: any) => void;
|
|
240
|
+
modifyCode: (args: any) => void;
|
|
241
|
+
|
|
242
|
+
/* delete */
|
|
243
|
+
handleDelete: (id: string) => void;
|
|
244
|
+
|
|
245
|
+
/* drag & drop */
|
|
246
|
+
onDropHandler: (e: React.DragEvent, index: number) => void;
|
|
247
|
+
onDragStart: (e: React.DragEvent, index: number) => void;
|
|
248
|
+
onDragEnd: (e: React.DragEvent) => void;
|
|
249
|
+
onDragEnter: (e: React.DragEvent) => void;
|
|
250
|
+
onDragLeave: (e: React.DragEvent) => void;
|
|
251
|
+
|
|
252
|
+
/* animations */
|
|
253
|
+
containerVariants: Record<string, any>;
|
|
254
|
+
itemVariants: Record<string, any>;
|
|
255
|
+
transitions: Record<string, any>;
|
|
256
|
+
whileHover: Record<string, any>;
|
|
257
|
+
|
|
258
|
+
/* utils */
|
|
259
|
+
handleCopy: (content: any) => void;
|
|
260
|
+
};
|
|
261
|
+
|
|
262
|
+
/* ─────────────────────────────
|
|
263
|
+
Media utilities
|
|
264
|
+
───────────────────────────── */
|
|
265
|
+
|
|
266
|
+
declare function dropHandler(
|
|
267
|
+
e: React.DragEvent,
|
|
268
|
+
setFile: React.Dispatch<React.SetStateAction<string | null>>,
|
|
269
|
+
setFileName: React.Dispatch<React.SetStateAction<string>>,
|
|
270
|
+
setCompressing: React.Dispatch<React.SetStateAction<boolean>>,
|
|
271
|
+
setCompressionProgress: React.Dispatch<React.SetStateAction<number>>
|
|
272
|
+
): Promise<void>;
|
|
273
|
+
|
|
274
|
+
declare function onFileChange(
|
|
275
|
+
e: React.ChangeEvent<HTMLInputElement>,
|
|
276
|
+
setFile: React.Dispatch<React.SetStateAction<string | null>>,
|
|
277
|
+
setFileName: React.Dispatch<React.SetStateAction<string>>,
|
|
278
|
+
setCompressing: React.Dispatch<React.SetStateAction<boolean>>,
|
|
279
|
+
setCompressionProgress: React.Dispatch<React.SetStateAction<number>>
|
|
280
|
+
): Promise<void>;
|
|
281
|
+
|
|
282
|
+
declare function dragHandler(
|
|
283
|
+
e: React.DragEvent,
|
|
284
|
+
output: React.RefObject<HTMLElement>
|
|
285
|
+
): void;
|
|
286
|
+
|
|
287
|
+
declare function dragLeaveHandler(
|
|
288
|
+
e: React.DragEvent,
|
|
289
|
+
output: React.RefObject<HTMLElement>
|
|
290
|
+
): void;
|
|
291
|
+
|
|
292
|
+
/* ─────────────────────────────
|
|
293
|
+
Exports
|
|
294
|
+
───────────────────────────── */
|
|
295
|
+
|
|
190
296
|
export default DraftifyReact;
|
|
191
297
|
|
|
192
|
-
export {
|
|
298
|
+
export {
|
|
299
|
+
DraftifyReact,
|
|
300
|
+
DraftifyBlocksReader,
|
|
301
|
+
dropHandler,
|
|
302
|
+
onFileChange,
|
|
303
|
+
dragHandler,
|
|
304
|
+
dragLeaveHandler,
|
|
305
|
+
};
|