@fileverse-dev/ddoc 2.0.3-sync-patch-12 → 2.0.3-sync-patch-13

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.
@@ -0,0 +1,12 @@
1
+ import { Extension } from '@tiptap/core';
2
+ import { CollaborationCursorOptions, CollaborationCursorStorage } from '../types';
3
+
4
+ declare module '@tiptap/core' {
5
+ interface Commands<ReturnType> {
6
+ collaborationCursor: {
7
+ updateUser: (attributes: Record<string, any>) => ReturnType;
8
+ user: (attributes: Record<string, any>) => ReturnType;
9
+ };
10
+ }
11
+ }
12
+ export declare const SyncCursor: Extension<CollaborationCursorOptions, CollaborationCursorStorage>;
@@ -24,7 +24,7 @@ export interface DdocProps {
24
24
  renderNavbar?: ({ editor }: {
25
25
  editor: JSONContent;
26
26
  }) => JSX.Element;
27
- onChange?: (changes: Data['editorJSONData']) => void;
27
+ onChange?: (changes: string) => void;
28
28
  onCollaboratorChange?: (collaborators: undefined | IDocCollabUsers[]) => void;
29
29
  onTextSelection?: (data: IEditorSelectionData) => void;
30
30
  onCommentInteraction?: (data: IEditorSelectionData) => void;
@@ -34,6 +34,11 @@ export interface DdocProps {
34
34
  onError?: (error: string) => void;
35
35
  setCharacterCount?: React.Dispatch<SetStateAction<number>>;
36
36
  setWordCount?: React.Dispatch<SetStateAction<number>>;
37
+ collaborationKey?: string;
38
+ yjsUpdate?: string;
39
+ onDisconnectionDueToSyncError?: (syncError: {
40
+ message: string;
41
+ }) => void;
37
42
  tags?: Array<{
38
43
  name: string;
39
44
  color: string;
@@ -55,3 +60,19 @@ export interface IUser {
55
60
  color: string;
56
61
  isEns: boolean;
57
62
  }
63
+ export type CollaborationCursorStorage = {
64
+ users: {
65
+ clientId: number;
66
+ [key: string]: any;
67
+ }[];
68
+ };
69
+ export interface CollaborationCursorOptions {
70
+ provider: any;
71
+ user: Record<string, any>;
72
+ render(user: Record<string, any>): HTMLElement;
73
+ selectionRender(user: Record<string, any>): any;
74
+ onUpdate: (users: {
75
+ clientId: number;
76
+ [key: string]: any;
77
+ }[]) => null;
78
+ }
@@ -1,10 +1,14 @@
1
1
  import { DdocProps } from './types';
2
2
 
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, secureImageUploadUrl, scrollPosition, }: Partial<DdocProps>) => {
3
+ export declare const useDdocEditor: ({ isPreviewMode, initialContent, enableCollaboration, collaborationId, walletAddress, username, onChange, onCollaboratorChange, ensResolutionUrl, onError, setCharacterCount, setWordCount, collaborationKey, yjsUpdate, onDisconnectionDueToSyncError, secureImageUploadUrl, scrollPosition, }: Partial<DdocProps>) => {
5
4
  editor: import('@tiptap/core').Editor | null;
6
5
  isContentLoading: boolean;
7
6
  ref: import('react').RefObject<HTMLDivElement>;
8
- connect: (username: string | null | undefined, isEns?: boolean) => () => void;
9
- ydoc: Y.Doc;
7
+ connect: (username: string | null | undefined, isEns?: boolean) => void;
8
+ ydoc: import('yjs').Doc;
9
+ isCollaborationReady: boolean;
10
+ syncError: {
11
+ message: string;
12
+ } | null;
13
+ isSyncFetchingFromIpfs: boolean;
10
14
  };