@fileverse-dev/ddoc 3.0.96-zustand-7 → 3.0.97-patch.1
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.
- package/dist/index.es.js +23105 -23050
- package/dist/package/components/inline-comment/context/comment-context.d.ts +4 -0
- package/dist/package/components/inline-comment/context/types.d.ts +88 -1
- package/dist/package/hooks/use-tab-editor.d.ts +1 -1
- package/dist/package/sync-local/SyncManager.d.ts +12 -0
- package/dist/style.css +1 -1
- package/package.json +3 -4
- package/dist/package/components/inline-comment/comment-compose-input.d.ts +0 -1
- package/dist/package/components/inline-comment/comment-reply-input.d.ts +0 -8
- package/dist/package/stores/comment-store-provider.d.ts +0 -43
- package/dist/package/stores/comment-store.d.ts +0 -114
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { CommentContextType, CommentProviderProps } from './types';
|
|
2
|
+
|
|
3
|
+
export declare const CommentProvider: ({ children, editor, ydoc, initialComments, setInitialComments, username, setUsername, activeCommentId, setActiveCommentId, activeTabId, focusCommentWithActiveId, onNewComment, onCommentReply, ensResolutionUrl, onResolveComment, onUnresolveComment, onDeleteComment, isConnected, connectViaWallet, isLoading, connectViaUsername, isDDocOwner, onInlineComment, onComment, setCommentDrawerOpen, }: CommentProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export declare const useComments: () => CommentContextType;
|
|
@@ -1,6 +1,93 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Editor } from '@tiptap/react';
|
|
2
|
+
import { IComment } from '../../../extensions/comment';
|
|
2
3
|
import { SetStateAction } from 'react';
|
|
4
|
+
import { CommentAccountProps, CommentMutationMeta } from '../../../types';
|
|
5
|
+
import { EnsStatus } from '../types';
|
|
3
6
|
|
|
7
|
+
import * as Y from 'yjs';
|
|
8
|
+
export interface CommentContextType extends CommentAccountProps {
|
|
9
|
+
comments: IComment[];
|
|
10
|
+
setComments: React.Dispatch<SetStateAction<IComment[]>>;
|
|
11
|
+
editor: Editor;
|
|
12
|
+
username?: string | null;
|
|
13
|
+
setUsername?: React.Dispatch<SetStateAction<string>>;
|
|
14
|
+
showResolved: boolean;
|
|
15
|
+
setShowResolved: (show: boolean) => void;
|
|
16
|
+
resolveComment: (commentId: string) => void;
|
|
17
|
+
unresolveComment: (commentId: string) => void;
|
|
18
|
+
deleteComment: (commentId: string) => void;
|
|
19
|
+
handleAddReply: (activeCommentId: string, replyContent: string, onCommentReply: (activeCommentId: string, reply: IComment) => void) => void;
|
|
20
|
+
focusCommentInEditor: (commentId: string) => void;
|
|
21
|
+
handleReplyChange: (event: React.ChangeEvent<HTMLTextAreaElement>) => void;
|
|
22
|
+
handleCommentChange: (event: React.ChangeEvent<HTMLTextAreaElement>) => void;
|
|
23
|
+
handleCommentKeyDown: (event: React.KeyboardEvent<HTMLTextAreaElement>) => void;
|
|
24
|
+
handleReplySubmit: () => void;
|
|
25
|
+
toggleResolved: () => void;
|
|
26
|
+
openReplyId: string | null;
|
|
27
|
+
setOpenReplyId: (id: string | null) => void;
|
|
28
|
+
handleReplyKeyDown: (event: React.KeyboardEvent<HTMLTextAreaElement>) => void;
|
|
29
|
+
commentsSectionRef: React.RefObject<HTMLDivElement>;
|
|
30
|
+
replySectionRef: React.RefObject<HTMLDivElement>;
|
|
31
|
+
addComment: (content?: string) => void;
|
|
32
|
+
handleCommentSubmit: () => void;
|
|
33
|
+
reply: string;
|
|
34
|
+
setReply: React.Dispatch<React.SetStateAction<string>>;
|
|
35
|
+
comment: string;
|
|
36
|
+
setComment: React.Dispatch<React.SetStateAction<string>>;
|
|
37
|
+
onPrevComment: () => void;
|
|
38
|
+
onNextComment: () => void;
|
|
39
|
+
activeCommentIndex: number;
|
|
40
|
+
activeComment: IComment | undefined;
|
|
41
|
+
selectedText: string;
|
|
42
|
+
isCommentOpen: boolean;
|
|
43
|
+
isBubbleMenuSuppressed: boolean;
|
|
44
|
+
setIsBubbleMenuSuppressed: React.Dispatch<React.SetStateAction<boolean>>;
|
|
45
|
+
handleInlineComment: () => void;
|
|
46
|
+
portalRef: React.RefObject<HTMLDivElement>;
|
|
47
|
+
buttonRef: React.RefObject<HTMLDivElement>;
|
|
48
|
+
dropdownRef: React.RefObject<HTMLDivElement>;
|
|
49
|
+
activeComments: IComment[];
|
|
50
|
+
handleInput: (e: React.FormEvent<HTMLTextAreaElement>, content: string) => void;
|
|
51
|
+
isCommentActive: boolean;
|
|
52
|
+
isCommentResolved: boolean;
|
|
53
|
+
ensResolutionUrl: string;
|
|
54
|
+
activeTabId: string;
|
|
55
|
+
onCommentReply?: (activeCommentId: string, reply: IComment) => void;
|
|
56
|
+
onComment?: () => void;
|
|
57
|
+
setCommentDrawerOpen?: React.Dispatch<React.SetStateAction<boolean>>;
|
|
58
|
+
inlineCommentData: {
|
|
59
|
+
inlineCommentText: string;
|
|
60
|
+
handleClick: boolean;
|
|
61
|
+
};
|
|
62
|
+
setInlineCommentData: React.Dispatch<React.SetStateAction<{
|
|
63
|
+
inlineCommentText: string;
|
|
64
|
+
handleClick: boolean;
|
|
65
|
+
}>>;
|
|
66
|
+
getEnsStatus: (walletAddress: string, setEnsStatus: React.Dispatch<React.SetStateAction<EnsStatus>>) => void;
|
|
67
|
+
ensCache: EnsCache;
|
|
68
|
+
}
|
|
69
|
+
export interface CommentProviderProps extends CommentAccountProps {
|
|
70
|
+
children: React.ReactNode;
|
|
71
|
+
editor: Editor;
|
|
72
|
+
ydoc: Y.Doc;
|
|
73
|
+
initialComments?: IComment[];
|
|
74
|
+
setInitialComments?: React.Dispatch<SetStateAction<IComment[]>>;
|
|
75
|
+
onCommentReply?: (activeCommentId: string, reply: IComment) => void;
|
|
76
|
+
onNewComment?: (newComment: IComment, meta?: CommentMutationMeta) => void;
|
|
77
|
+
onResolveComment?: (activeCommentId: string, meta?: CommentMutationMeta) => void;
|
|
78
|
+
onUnresolveComment?: (activeCommentId: string, meta?: CommentMutationMeta) => void;
|
|
79
|
+
onDeleteComment?: (activeCommentId: string, meta?: CommentMutationMeta) => void;
|
|
80
|
+
username: string | null;
|
|
81
|
+
setUsername?: React.Dispatch<SetStateAction<string>>;
|
|
82
|
+
activeCommentId: string | null;
|
|
83
|
+
setActiveCommentId: React.Dispatch<React.SetStateAction<string | null>>;
|
|
84
|
+
activeTabId: string;
|
|
85
|
+
focusCommentWithActiveId: (id: string) => void;
|
|
86
|
+
ensResolutionUrl: string;
|
|
87
|
+
onInlineComment?: () => void;
|
|
88
|
+
onComment?: () => void;
|
|
89
|
+
setCommentDrawerOpen?: React.Dispatch<React.SetStateAction<boolean>>;
|
|
90
|
+
}
|
|
4
91
|
export interface CommentUsernameProps extends CommentAccountProps {
|
|
5
92
|
username?: string | null;
|
|
6
93
|
setUsername?: React.Dispatch<SetStateAction<string>>;
|
|
@@ -48,7 +48,7 @@ interface UseTabEditorArgs {
|
|
|
48
48
|
theme?: 'dark' | 'light';
|
|
49
49
|
editorRef?: MutableRefObject<Editor | null>;
|
|
50
50
|
}
|
|
51
|
-
export declare const useTabEditor: ({ ydoc, isVersionMode, hasTabState, versionId, isPreviewMode, initialContent, collaboration, isReady, isSyncing, awareness, disableInlineComment, onCommentInteraction, onError, ipfsImageUploadFn, metadataProxyUrl, onCopyHeadingLink, ipfsImageFetchFn, fetchV1ImageFn, isConnected, activeModel, maxTokens, isAIAgentEnabled, setCharacterCount, setWordCount, setPageCount, setIsContentLoading, setIsCollabContentLoading, unFocused, zoomLevel, isPresentationMode, onInvalidContentError, ignoreCorruptedData, onCollaboratorChange, onConnect, initialiseYjsIndexedDbProvider, externalExtensions, isContentLoading, activeTabId, theme, editorRef, }: UseTabEditorArgs) => {
|
|
51
|
+
export declare const useTabEditor: ({ ydoc, isVersionMode, hasTabState, versionId, isPreviewMode, initialContent, collaboration, isReady, isSyncing, awareness, disableInlineComment, onCommentInteraction, onError, ipfsImageUploadFn, metadataProxyUrl, onCopyHeadingLink, ipfsImageFetchFn, fetchV1ImageFn, isConnected, activeModel, maxTokens, isAIAgentEnabled, setCharacterCount, setWordCount, setPageCount, setIsContentLoading, setIsCollabContentLoading, unFocused, zoomLevel, isPresentationMode, onInvalidContentError, ignoreCorruptedData, onCollaboratorChange, onConnect, hasCollabContentInitialised, initialiseYjsIndexedDbProvider, externalExtensions, isContentLoading, activeTabId, theme, editorRef, }: UseTabEditorArgs) => {
|
|
52
52
|
editor: Editor | null;
|
|
53
53
|
ref: import('react').RefObject<HTMLDivElement>;
|
|
54
54
|
slides: string[];
|
|
@@ -14,6 +14,9 @@ export declare class SyncManager {
|
|
|
14
14
|
private uncommittedUpdatesIdList;
|
|
15
15
|
private contentTobeAppliedQueue;
|
|
16
16
|
private isProcessing;
|
|
17
|
+
private flushTimer;
|
|
18
|
+
private readonly FLUSH_INTERVAL_MS;
|
|
19
|
+
private readonly MAX_QUEUE_SIZE;
|
|
17
20
|
private _awarenessUpdateHandler;
|
|
18
21
|
private ydoc;
|
|
19
22
|
private servicesRef;
|
|
@@ -34,6 +37,15 @@ export declare class SyncManager {
|
|
|
34
37
|
disconnect(): Promise<void>;
|
|
35
38
|
terminateSession(): Promise<void>;
|
|
36
39
|
enqueueLocalUpdate(update: Uint8Array): void;
|
|
40
|
+
private flushUpdates;
|
|
41
|
+
private awaitFlush;
|
|
42
|
+
/**
|
|
43
|
+
* Fire-and-forget: merge all queued updates, encrypt, and emit via Socket.IO
|
|
44
|
+
* without awaiting the server ACK. The server broadcasts to peers immediately
|
|
45
|
+
* (before MongoDB write), so content reaches observers in near-real-time.
|
|
46
|
+
* ACK callback handles updateId tracking and auto-commit asynchronously.
|
|
47
|
+
*/
|
|
48
|
+
private sendUpdateBatch;
|
|
37
49
|
forceCleanup(): void;
|
|
38
50
|
private handleConnectionError;
|
|
39
51
|
private handleReconnection;
|