@fileverse-dev/ddoc 1.7.0 → 1.7.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  import { Editor } from '@tiptap/react';
2
2
 
3
- declare const BottomToolbar: ({ editor, uploadToIpfs, }: {
3
+ declare const BottomToolbar: ({ editor, onError, }: {
4
4
  editor: Editor;
5
- uploadToIpfs: (f: File) => Promise<string>;
5
+ onError?: (errorString: string) => void;
6
6
  }) => import("react/jsx-runtime").JSX.Element;
7
7
  export default BottomToolbar;
@@ -1,7 +1,7 @@
1
1
  import { Editor } from '@tiptap/react';
2
2
 
3
- declare const TiptapToolBar: ({ editor, uploadToIpfs, }: {
3
+ declare const TiptapToolBar: ({ editor, onError, }: {
4
4
  editor: Editor;
5
- uploadToIpfs: (f: File) => Promise<string>;
5
+ onError?: (errorString: string) => void;
6
6
  }) => import("react/jsx-runtime").JSX.Element;
7
7
  export default TiptapToolBar;
@@ -17,9 +17,13 @@ export declare const colors: {
17
17
  color: string;
18
18
  code: string;
19
19
  }[];
20
- export declare const useEditorToolbar: ({ editor, uploadToIpfs, }: {
20
+ export declare const MAX_IMAGE_SIZE: number;
21
+ export declare const ERR_MSG_MAP: {
22
+ IMAGE_SIZE: string;
23
+ };
24
+ export declare const useEditorToolbar: ({ editor, onError, }: {
21
25
  editor: Editor;
22
- uploadToIpfs: (file: File) => Promise<string>;
26
+ onError?: (errorString: string) => void;
23
27
  }) => {
24
28
  toolbar: (IEditorToolElement | null)[];
25
29
  bottomToolbar: (IEditorToolElement | null)[];
@@ -68,7 +72,7 @@ export declare const TextFormatingPopup: ({ editor, setToolVisibility, }: {
68
72
  editor: Editor;
69
73
  setToolVisibility: Dispatch<SetStateAction<IEditorTool>>;
70
74
  }) => import("react/jsx-runtime").JSX.Element;
71
- export declare const TextColorPicker: ({ editor, }: {
75
+ export declare const TextColorPicker: ({ editor }: {
72
76
  editor: Editor;
73
77
  }) => import("react/jsx-runtime").JSX.Element;
74
78
  export {};
@@ -1,5 +1,5 @@
1
1
  import { Extension } from '@tiptap/core';
2
2
 
3
3
  export declare const updateScrollView: (container: HTMLElement, item: HTMLElement) => void;
4
- declare const SlashCommand: (uploadToIpfs: (file: File) => Promise<string>) => Extension<any, any>;
4
+ declare const SlashCommand: (onError?: (errorString: string) => void) => Extension<any, any>;
5
5
  export default SlashCommand;
@@ -23,13 +23,13 @@ export interface DdocProps {
23
23
  editor: JSONContent;
24
24
  }) => JSX.Element;
25
25
  onChange?: (changes: Data['editorJSONData']) => void;
26
- handleImageUploadToIpfs: (file: File) => Promise<string>;
27
26
  onCollaboratorChange?: (collaborators: undefined | IDocCollabUsers[]) => void;
28
27
  onTextSelection?: (data: IEditorSelectionData) => void;
29
28
  onCommentInteraction?: (data: IEditorSelectionData) => void;
30
29
  handleCommentButtonClick?: (e: Editor) => void;
31
30
  showCommentButton?: boolean;
32
31
  disableBottomToolbar?: boolean;
32
+ onError?: (error: string) => void;
33
33
  }
34
34
  export interface IEditorSelectionData {
35
35
  from: number;
@@ -1,7 +1,7 @@
1
1
  import { DdocProps } from './types';
2
2
 
3
3
  import * as Y from 'yjs';
4
- export declare const useDdocEditor: ({ isPreviewMode, initialContent, enableCollaboration, collaborationId, walletAddress, username, onChange, onCollaboratorChange, onCommentInteraction, onTextSelection, ensResolutionUrl, handleImageUploadToIpfs, }: Partial<DdocProps>) => {
4
+ export declare const useDdocEditor: ({ isPreviewMode, initialContent, enableCollaboration, collaborationId, walletAddress, username, onChange, onCollaboratorChange, onCommentInteraction, onTextSelection, ensResolutionUrl, onError, }: Partial<DdocProps>) => {
5
5
  editor: import('@tiptap/react').Editor | null;
6
6
  ref: import('react').RefObject<HTMLDivElement>;
7
7
  connect: (username: string | null | undefined, isEns?: boolean) => () => void;
@@ -3,5 +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, handleImageUpload: (file: File) => Promise<string>): void;
6
+ export declare function startImageUpload(file: File, view: EditorView, pos: number): void;
7
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.7.0",
5
+ "version": "1.7.2",
6
6
  "main": "dist/index.umd.js",
7
7
  "module": "dist/index.es.js",
8
8
  "exports": {
@@ -28,6 +28,7 @@
28
28
  },
29
29
  "dependencies": {
30
30
  "@_ueberdosis/prosemirror-tables": "^1.1.3",
31
+ "@radix-ui/react-focus-scope": "^1.1.0",
31
32
  "@radix-ui/react-popover": "^1.0.7",
32
33
  "@tippyjs/react": "^4.2.6",
33
34
  "@tiptap/core": "^2.5.4",