@fileverse-dev/ddoc 1.3.8 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +13 -12
- package/dist/constants/index.d.ts +7 -0
- package/dist/index.es.js +4337 -4247
- package/dist/index.umd.js +36 -36
- package/dist/packages/ddoc/components/bottom-toolbar.d.ts +2 -1
- package/dist/packages/ddoc/components/editor-toolbar.d.ts +2 -1
- package/dist/packages/ddoc/components/editor-utils.d.ts +2 -1
- package/dist/packages/ddoc/types.d.ts +7 -0
- package/dist/packages/ddoc/use-ddoc-editor.d.ts +3 -1
- package/dist/packages/ddoc/utils/buildUCANToken.d.ts +2 -0
- package/dist/packages/ddoc/utils/upload-images.d.ts +1 -2
- package/package.json +2 -1
@@ -1,6 +1,7 @@
|
|
1
1
|
import { Editor } from '@tiptap/react';
|
2
2
|
|
3
|
-
declare const BottomToolbar: ({ editor }: {
|
3
|
+
declare const BottomToolbar: ({ editor, uploadToIpfs, }: {
|
4
4
|
editor: Editor;
|
5
|
+
uploadToIpfs: (f: File) => Promise<string>;
|
5
6
|
}) => import("react/jsx-runtime").JSX.Element;
|
6
7
|
export default BottomToolbar;
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { Editor } from '@tiptap/react';
|
2
2
|
|
3
|
-
declare const TiptapToolBar: ({ editor }: {
|
3
|
+
declare const TiptapToolBar: ({ editor, uploadToIpfs, }: {
|
4
4
|
editor: Editor;
|
5
|
+
uploadToIpfs: (f: File) => Promise<string>;
|
5
6
|
}) => import("react/jsx-runtime").JSX.Element;
|
6
7
|
export default TiptapToolBar;
|
@@ -17,8 +17,9 @@ export declare const colors: {
|
|
17
17
|
color: string;
|
18
18
|
code: string;
|
19
19
|
}[];
|
20
|
-
export declare const useEditorToolbar: ({ editor }: {
|
20
|
+
export declare const useEditorToolbar: ({ editor, uploadToIpfs, }: {
|
21
21
|
editor: Editor;
|
22
|
+
uploadToIpfs: (file: File) => Promise<string>;
|
22
23
|
}) => {
|
23
24
|
toolbar: (IEditorToolElement | null)[];
|
24
25
|
bottomToolbar: (IEditorToolElement | null)[];
|
@@ -2,6 +2,11 @@ import { JSONContent } from '@tiptap/core';
|
|
2
2
|
import { EditorProps } from '@tiptap/pm/view';
|
3
3
|
|
4
4
|
export declare const DdocEditorProps: EditorProps;
|
5
|
+
export interface IDocCollabUsers {
|
6
|
+
name: string;
|
7
|
+
isEns: string;
|
8
|
+
color: string;
|
9
|
+
}
|
5
10
|
export interface DdocProps {
|
6
11
|
enableCollaboration?: boolean;
|
7
12
|
collaborationId?: string;
|
@@ -17,6 +22,8 @@ export interface DdocProps {
|
|
17
22
|
editor: JSONContent;
|
18
23
|
}) => JSX.Element;
|
19
24
|
onChange?: (changes: Data['editorJSONData']) => void;
|
25
|
+
handleImageUploadToIpfs: (file: File) => Promise<string>;
|
26
|
+
onCollaboratorChange?: (collaborators: undefined | IDocCollabUsers[]) => void;
|
20
27
|
}
|
21
28
|
export interface Data {
|
22
29
|
editorJSONData: JSONContent;
|
@@ -1,9 +1,11 @@
|
|
1
1
|
import { DdocProps } from './types';
|
2
2
|
|
3
|
-
|
3
|
+
import * as Y from 'yjs';
|
4
|
+
export declare const useDdocEditor: ({ isPreviewMode, initialContent, enableCollaboration, collaborationId, ensProviderUrl, username, onAutoSave, onChange, onCollaboratorChange }: Partial<DdocProps>) => {
|
4
5
|
editor: import('@tiptap/react').Editor | null;
|
5
6
|
focusEditor: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
|
6
7
|
ref: import('react').RefObject<HTMLDivElement>;
|
7
8
|
loading: boolean;
|
8
9
|
connect: (username: string, isEns?: boolean) => () => void;
|
10
|
+
ydoc: Y.Doc;
|
9
11
|
};
|
@@ -3,6 +3,5 @@ import { DecorationSet, EditorView } from '@tiptap/pm/view';
|
|
3
3
|
|
4
4
|
declare const UploadImagesPlugin: () => Plugin<DecorationSet>;
|
5
5
|
export default UploadImagesPlugin;
|
6
|
-
export declare function startImageUpload(file: File, view: EditorView, pos: number): void;
|
7
|
-
export declare const handleImageUpload: (file: File) => Promise<unknown>;
|
6
|
+
export declare function startImageUpload(file: File, view: EditorView, pos: number, handleImageUpload: (file: File) => Promise<string>): void;
|
8
7
|
export declare const uploadFn: (image: File) => Promise<string>;
|
package/package.json
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
"name": "@fileverse-dev/ddoc",
|
3
3
|
"private": false,
|
4
4
|
"description": "DDoc",
|
5
|
-
"version": "1.
|
5
|
+
"version": "1.4.0",
|
6
6
|
"main": "dist/index.umd.js",
|
7
7
|
"module": "dist/index.es.js",
|
8
8
|
"exports": {
|
@@ -62,6 +62,7 @@
|
|
62
62
|
"react-uuid": "^2.0.0",
|
63
63
|
"tailwindcss-animate": "^1.0.7",
|
64
64
|
"tippy.js": "^6.3.7",
|
65
|
+
"ucans": "^0.10.0",
|
65
66
|
"usehooks-ts": "^3.1.0",
|
66
67
|
"vaul": "^0.9.1",
|
67
68
|
"vite-plugin-dts": "^3.6.3",
|