@fileverse-dev/ddoc 2.0.4 → 2.0.5

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.
@@ -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 useEditorToolbar: ({ editor, onError, }: {
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)[];
@@ -0,0 +1,11 @@
1
+ import { FC } from 'react';
2
+
3
+ type Props = {
4
+ encryptedKey: string;
5
+ url: string;
6
+ iv: string;
7
+ privateKey: ArrayBuffer;
8
+ alt?: string;
9
+ };
10
+ export declare const SecureImage: FC<Props>;
11
+ 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: (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;
@@ -0,0 +1,4 @@
1
+ import { Extension } from '@tiptap/core';
2
+
3
+ declare const customTextInputRules: Extension<any, any>;
4
+ export default customTextInputRules;
@@ -1,4 +1,6 @@
1
1
  import { default as React } from 'react';
2
2
  import { NodeViewProps } from '@tiptap/react';
3
3
 
4
- export declare const DBlockNodeView: React.FC<NodeViewProps>;
4
+ export declare const DBlockNodeView: React.FC<NodeViewProps & {
5
+ secureImageUploadUrl?: string;
6
+ }>;
@@ -2,6 +2,7 @@ import { Node } from '@tiptap/core';
2
2
 
3
3
  export interface DBlockOptions {
4
4
  HTMLAttributes: Record<string, any>;
5
+ secureImageUploadUrl?: string;
5
6
  }
6
7
  declare module '@tiptap/core' {
7
8
  interface Commands<ReturnType> {
@@ -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;
@@ -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;
@@ -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>;