@fileverse-dev/ddoc 2.0.4 → 2.0.5
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +1 -1
- package/dist/index.es.js +21285 -20756
- package/dist/package/components/editor-toolbar.d.ts +2 -1
- package/dist/package/components/editor-utils.d.ts +12 -2
- package/dist/package/components/secure-image.d.ts +11 -0
- package/dist/package/components/slash-comand.d.ts +1 -1
- package/dist/package/extensions/customTextInputRules.d.ts +4 -0
- package/dist/package/extensions/d-block/dblock-node-view.d.ts +3 -1
- package/dist/package/extensions/d-block/dblock.d.ts +1 -0
- package/dist/package/extensions/default-extension.d.ts +1 -1
- package/dist/package/extensions/resizable-media/media-paste-drop-plugin/media-paste-drop-plugin.d.ts +1 -1
- package/dist/package/extensions/resizable-media/resizable-media.d.ts +2 -0
- package/dist/package/types.d.ts +4 -0
- package/dist/package/use-ddoc-editor.d.ts +1 -1
- package/dist/package/utils/security.d.ts +17 -0
- package/dist/package/utils/upload-images.d.ts +2 -1
- package/dist/style.css +1 -1
- package/package.json +3 -2
@@ -1,10 +1,11 @@
|
|
1
1
|
import { default as React } from 'react';
|
2
2
|
import { Editor } from '@tiptap/react';
|
3
3
|
|
4
|
-
declare const TiptapToolBar: ({ editor, onError, isNavbarVisible, setIsNavbarVisible, }: {
|
4
|
+
declare const TiptapToolBar: ({ editor, onError, isNavbarVisible, setIsNavbarVisible, secureImageUploadUrl, }: {
|
5
5
|
editor: Editor;
|
6
6
|
onError?: (errorString: string) => void;
|
7
7
|
isNavbarVisible: boolean;
|
8
8
|
setIsNavbarVisible: React.Dispatch<React.SetStateAction<boolean>>;
|
9
|
+
secureImageUploadUrl?: string;
|
9
10
|
}) => import("react/jsx-runtime").JSX.Element;
|
10
11
|
export default TiptapToolBar;
|
@@ -13,13 +13,23 @@ export declare const fonts: {
|
|
13
13
|
value: string;
|
14
14
|
command: (editor: Editor) => void;
|
15
15
|
}[];
|
16
|
-
export declare const MAX_IMAGE_SIZE: number;
|
17
16
|
export declare const ERR_MSG_MAP: {
|
18
17
|
IMAGE_SIZE: string;
|
19
18
|
};
|
20
|
-
export declare const
|
19
|
+
export declare const IMG_UPLOAD_SETTINGS: {
|
20
|
+
Extended: {
|
21
|
+
maxSize: number;
|
22
|
+
errorMsg: string;
|
23
|
+
};
|
24
|
+
Base: {
|
25
|
+
maxSize: number;
|
26
|
+
errorMsg: string;
|
27
|
+
};
|
28
|
+
};
|
29
|
+
export declare const useEditorToolbar: ({ editor, onError, secureImageUploadUrl, }: {
|
21
30
|
editor: Editor;
|
22
31
|
onError?: (errorString: string) => void;
|
32
|
+
secureImageUploadUrl?: string;
|
23
33
|
}) => {
|
24
34
|
undoRedoTools: (IEditorToolElement | null)[];
|
25
35
|
toolbar: (IEditorToolElement | null)[];
|
@@ -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: (onError?: (errorString: string) => void) => Extension<any, any>;
|
4
|
+
declare const SlashCommand: (onError?: (errorString: string) => void, secureImageUploadUrl?: string) => Extension<any, any>;
|
5
5
|
export default SlashCommand;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { NodeType } from '@tiptap/pm/model';
|
2
2
|
import { InputRule } from '@tiptap/core';
|
3
3
|
|
4
|
-
export declare const defaultExtensions: (import('@tiptap/core').Node<any, any> | import('@tiptap/core').Extension<any, any> | import('@tiptap/core').Mark<any, any>)[];
|
4
|
+
export declare const defaultExtensions: (onError: (error: string) => void, secureImageUploadUrl?: string) => (import('@tiptap/core').Node<any, any> | import('@tiptap/core').Extension<any, any> | import('@tiptap/core').Mark<any, any>)[];
|
5
5
|
export declare const createInputRule: (pattern: RegExp, data: string, type: NodeType) => InputRule;
|
package/dist/package/extensions/resizable-media/media-paste-drop-plugin/media-paste-drop-plugin.d.ts
CHANGED
@@ -9,4 +9,4 @@ export type UploadFnType = (image: File) => Promise<string>;
|
|
9
9
|
* If no upload function is provided, it reads the media file as DataURL and uses this in the new node.
|
10
10
|
* The function returns a new instance of the Plugin.
|
11
11
|
*/
|
12
|
-
export declare const getMediaPasteDropPlugin: (upload: UploadFnType, onError: (error: string) => void) => Plugin<any>;
|
12
|
+
export declare const getMediaPasteDropPlugin: (upload: UploadFnType, onError: (error: string) => void, secureImageUploadUrl?: string) => Plugin<any>;
|
@@ -21,6 +21,8 @@ declare module '@tiptap/core' {
|
|
21
21
|
export interface MediaOptions {
|
22
22
|
HTMLAttributes: Record<string, any>;
|
23
23
|
uploadFn: UploadFnType;
|
24
|
+
onError: (error: string) => void;
|
25
|
+
secureImageUploadUrl?: string;
|
24
26
|
}
|
25
27
|
export declare const IMAGE_INPUT_REGEX: RegExp;
|
26
28
|
export declare const VIDEO_INPUT_REGEX: RegExp;
|
package/dist/package/types.d.ts
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
import { TagType } from '@fileverse/ui';
|
1
2
|
import { JSONContent } from '@tiptap/core';
|
2
3
|
import { EditorProps } from '@tiptap/pm/view';
|
3
4
|
import { Editor } from '@tiptap/react';
|
@@ -10,10 +11,13 @@ export interface IDocCollabUsers {
|
|
10
11
|
color: string;
|
11
12
|
}
|
12
13
|
export interface DdocProps {
|
14
|
+
selectedTags?: TagType[];
|
15
|
+
setSelectedTags?: React.Dispatch<SetStateAction<TagType[]>>;
|
13
16
|
enableCollaboration?: boolean;
|
14
17
|
collaborationId?: string;
|
15
18
|
isPreviewMode: boolean;
|
16
19
|
ensResolutionUrl?: string;
|
20
|
+
secureImageUploadUrl?: string;
|
17
21
|
initialContent?: JSONContent | null;
|
18
22
|
walletAddress?: string | null;
|
19
23
|
username?: string | null;
|
@@ -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, onError, setCharacterCount, setWordCount, }: Partial<DdocProps>) => {
|
4
|
+
export declare const useDdocEditor: ({ isPreviewMode, initialContent, enableCollaboration, collaborationId, walletAddress, username, onChange, onCollaboratorChange, onCommentInteraction, onTextSelection, ensResolutionUrl, onError, setCharacterCount, setWordCount, secureImageUploadUrl }: Partial<DdocProps>) => {
|
5
5
|
editor: import('@tiptap/core').Editor | null;
|
6
6
|
isContentLoading: boolean;
|
7
7
|
ref: import('react').RefObject<HTMLDivElement>;
|
@@ -0,0 +1,17 @@
|
|
1
|
+
export declare const base64ToArrayBuffer: (base64String: string) => ArrayBufferLike;
|
2
|
+
export declare const arrayBufferToBase64: (buffer: ArrayBuffer) => string;
|
3
|
+
export declare const generateRSAKeyPair: () => Promise<{
|
4
|
+
publicKey: ArrayBuffer;
|
5
|
+
privateKey: ArrayBuffer;
|
6
|
+
}>;
|
7
|
+
export declare const decryptAESKey: (encryptedKeyBase64: string, privateKeyPem: BufferSource) => Promise<ArrayBuffer>;
|
8
|
+
export declare const decryptImageData: (encryptedImageData: ArrayBuffer, aesKeyBuffer: ArrayBuffer, iv: string) => Promise<ArrayBuffer>;
|
9
|
+
export declare const fetchImage: (url: string) => Promise<ArrayBuffer | undefined>;
|
10
|
+
type DecryptImage = {
|
11
|
+
encryptedKey: string;
|
12
|
+
privateKey: BufferSource;
|
13
|
+
iv: string;
|
14
|
+
imageBuffer: ArrayBuffer;
|
15
|
+
};
|
16
|
+
export declare const decryptImage: ({ encryptedKey, privateKey, iv, imageBuffer }: DecryptImage) => Promise<ArrayBuffer | undefined>;
|
17
|
+
export {};
|
@@ -3,5 +3,6 @@ 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
|
6
|
+
export declare function startImageUpload(file: File, view: EditorView, pos: number, secureImageUploadUrl?: string): Promise<void>;
|
7
7
|
export declare const uploadFn: (image: File) => Promise<string>;
|
8
|
+
export declare const uploadSecureImage: (url: string, image: File, publicKey: ArrayBuffer) => Promise<any>;
|