@fileverse-dev/ddoc 3.1.7-comment-re-arch-23 → 3.1.7-linkCaption-0
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 +28758 -32692
- package/dist/package/components/editor-bubble-menu/props.d.ts +0 -2
- package/dist/package/components/inline-comment/comment-card.d.ts +1 -1
- package/dist/package/components/inline-comment/comment-drawer.d.ts +1 -1
- package/dist/package/components/inline-comment/comment-dropdown.d.ts +1 -1
- package/dist/package/components/inline-comment/comment-section.d.ts +1 -1
- package/dist/package/components/inline-comment/comment-username.d.ts +1 -1
- package/dist/package/components/inline-comment/context/comment-context.d.ts +4 -0
- package/dist/package/components/inline-comment/context/types.d.ts +89 -46
- package/dist/package/components/inline-comment/empty-comments.d.ts +1 -4
- package/dist/package/components/inline-comment/types.d.ts +0 -24
- package/dist/package/components/tabs/document-tabs-sidebar.d.ts +1 -2
- package/dist/package/extensions/comment/comment.d.ts +0 -33
- package/dist/package/extensions/resizable-media/media-caption.d.ts +3 -0
- package/dist/package/extensions/resizable-media/resizable-media-menu-util.d.ts +4 -5
- package/dist/package/extensions/resizable-media/resizable-media-node-view.d.ts +1 -1
- package/dist/package/hooks/use-tab-editor.d.ts +2 -6
- package/dist/package/types.d.ts +2 -16
- package/dist/package/use-ddoc-editor.d.ts +1 -4
- package/dist/style.css +1 -1
- package/package.json +3 -4
- package/dist/package/components/inline-comment/comment-floating-container.d.ts +0 -1
- package/dist/package/components/inline-comment/comment-floating-layout.d.ts +0 -34
- package/dist/package/components/inline-comment/comment-input-field.d.ts +0 -4
- package/dist/package/components/inline-comment/comment-reply-input.d.ts +0 -8
- package/dist/package/components/inline-comment/constants.d.ts +0 -1
- package/dist/package/components/inline-comment/delete-confirm-overlay.d.ts +0 -10
- package/dist/package/components/inline-comment/floating-comment/comment-floating-container.d.ts +0 -3
- package/dist/package/components/inline-comment/floating-comment/draft-floating-card.d.ts +0 -3
- package/dist/package/components/inline-comment/floating-comment/floating-auth-prompt.d.ts +0 -1
- package/dist/package/components/inline-comment/floating-comment/floating-card-shell.d.ts +0 -3
- package/dist/package/components/inline-comment/floating-comment/index.d.ts +0 -1
- package/dist/package/components/inline-comment/floating-comment/thread-floating-card.d.ts +0 -3
- package/dist/package/components/inline-comment/floating-comment/types.d.ts +0 -34
- package/dist/package/components/inline-comment/floating-comment-layout-utils.d.ts +0 -78
- package/dist/package/components/inline-comment/resize-inline-comment-textarea.d.ts +0 -1
- package/dist/package/components/inline-comment/use-anchor-registry.d.ts +0 -34
- package/dist/package/components/inline-comment/use-comment-card.d.ts +0 -29
- package/dist/package/components/inline-comment/use-comment-list-container.d.ts +0 -17
- package/dist/package/components/inline-comment/use-ens-status.d.ts +0 -3
- package/dist/package/components/inline-comment/use-floating-card-state.d.ts +0 -36
- package/dist/package/components/inline-comment/use-floating-comment-card-layout.d.ts +0 -23
- package/dist/package/components/inline-comment/use-floating-comment-card-state.d.ts +0 -13
- package/dist/package/components/inline-comment/use-floating-layout-engine.d.ts +0 -26
- package/dist/package/components/inline-comment/use-is-selected-content-deleted.d.ts +0 -1
- package/dist/package/extensions/comment/comment-decoration-plugin.d.ts +0 -70
- package/dist/package/stores/comment-store-provider.d.ts +0 -56
- package/dist/package/stores/comment-store.d.ts +0 -195
- package/dist/package/utils/comment-anchor-serialization.d.ts +0 -5
- package/dist/package/utils/comment-scroll-into-view.d.ts +0 -21
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
import { Editor } from '@tiptap/react';
|
|
2
|
-
import { default as React } from 'react';
|
|
3
|
-
import { CommentAnchor } from '../extensions/comment/comment-decoration-plugin';
|
|
4
|
-
import { CommentFloatingCard, EnsCache, InlineCommentData, InlineCommentDraft, InlineDraftLocation } from '../components/inline-comment/context/types';
|
|
5
|
-
import { EnsStatus } from '../components/inline-comment/types';
|
|
6
|
-
import { IComment } from '../extensions/comment';
|
|
7
|
-
import { CommentMutationMeta, CommentMutationType } from '../types';
|
|
8
|
-
|
|
9
|
-
import * as Y from 'yjs';
|
|
10
|
-
export interface CommentExternalDeps {
|
|
11
|
-
editor: Editor | null;
|
|
12
|
-
ydoc: Y.Doc;
|
|
13
|
-
setActiveCommentId: (id: string | null) => void;
|
|
14
|
-
focusCommentWithActiveId: (id: string) => void;
|
|
15
|
-
setInitialComments?: React.Dispatch<React.SetStateAction<IComment[]>>;
|
|
16
|
-
setUsername?: React.Dispatch<React.SetStateAction<string>>;
|
|
17
|
-
onNewComment?: (comment: IComment, meta?: CommentMutationMeta) => void;
|
|
18
|
-
onEditComment?: (commentId: string, meta?: CommentMutationMeta) => void;
|
|
19
|
-
onEditReply?: (commentId: string, replyId: string, meta?: CommentMutationMeta) => void;
|
|
20
|
-
onCommentReply?: (activeCommentId: string, reply: IComment) => void;
|
|
21
|
-
onResolveComment?: (commentId: string, meta?: CommentMutationMeta) => void;
|
|
22
|
-
onUnresolveComment?: (commentId: string, meta?: CommentMutationMeta) => void;
|
|
23
|
-
onDeleteComment?: (commentId: string, meta?: CommentMutationMeta) => void;
|
|
24
|
-
onInlineComment?: () => void;
|
|
25
|
-
onComment?: () => void;
|
|
26
|
-
setCommentDrawerOpen?: (open: boolean) => void;
|
|
27
|
-
connectViaWallet?: () => Promise<void>;
|
|
28
|
-
connectViaUsername?: (username: string) => Promise<void>;
|
|
29
|
-
ensResolutionUrl: string;
|
|
30
|
-
commentAnchorsRef?: React.MutableRefObject<CommentAnchor[]>;
|
|
31
|
-
refreshCommentAnchorState?: () => void;
|
|
32
|
-
}
|
|
33
|
-
type FloatingCardsUpdater = React.SetStateAction<CommentFloatingCard[]>;
|
|
34
|
-
type InlineCommentDataUpdater = Partial<InlineCommentData> | ((prev: InlineCommentData) => Partial<InlineCommentData> | InlineCommentData);
|
|
35
|
-
type InlineDraftRecordMap = Record<string, InlineCommentDraft>;
|
|
36
|
-
type CreateInlineDraftOptions = {
|
|
37
|
-
location?: InlineDraftLocation;
|
|
38
|
-
tabId?: string;
|
|
39
|
-
allowEmptySelection?: boolean;
|
|
40
|
-
};
|
|
41
|
-
type CommentEditRequest = {
|
|
42
|
-
requestId: string;
|
|
43
|
-
kind: 'comment' | 'reply';
|
|
44
|
-
commentId: string;
|
|
45
|
-
replyId?: string;
|
|
46
|
-
text: string;
|
|
47
|
-
};
|
|
48
|
-
type ReplyEditTarget = {
|
|
49
|
-
kind: 'comment' | 'reply';
|
|
50
|
-
commentId: string;
|
|
51
|
-
replyId?: string;
|
|
52
|
-
originalText: string;
|
|
53
|
-
};
|
|
54
|
-
type CommentEditCompletion = {
|
|
55
|
-
nonce: number;
|
|
56
|
-
kind: 'comment' | 'reply';
|
|
57
|
-
commentId: string;
|
|
58
|
-
replyId?: string;
|
|
59
|
-
};
|
|
60
|
-
type FocusCommentInEditorOptions = {
|
|
61
|
-
source?: 'explicit-ui' | 'passive';
|
|
62
|
-
};
|
|
63
|
-
type ReconcileFloatingThreadsForActiveTabOptions = {
|
|
64
|
-
hydrationReady: boolean;
|
|
65
|
-
};
|
|
66
|
-
export declare const EXPLICIT_COMMENT_FOCUS_META = "inlineCommentExplicitFocus";
|
|
67
|
-
export interface CommentStoreState {
|
|
68
|
-
initialComments: IComment[];
|
|
69
|
-
tabComments: IComment[];
|
|
70
|
-
activeComments: IComment[];
|
|
71
|
-
activeComment: IComment | undefined;
|
|
72
|
-
activeCommentIndex: number;
|
|
73
|
-
username: string | null;
|
|
74
|
-
activeCommentId: string | null;
|
|
75
|
-
activeTabId: string;
|
|
76
|
-
isConnected: boolean;
|
|
77
|
-
isLoading: boolean;
|
|
78
|
-
isDDocOwner: boolean;
|
|
79
|
-
onComment: (() => void) | null;
|
|
80
|
-
setCommentDrawerOpen: ((open: boolean) => void) | null;
|
|
81
|
-
connectViaWallet: (() => Promise<void>) | null;
|
|
82
|
-
connectViaUsername: ((username: string) => Promise<void>) | null;
|
|
83
|
-
isCommentActive: boolean;
|
|
84
|
-
isCommentResolved: boolean;
|
|
85
|
-
showResolved: boolean;
|
|
86
|
-
reply: string;
|
|
87
|
-
comment: string;
|
|
88
|
-
openReplyId: string | null;
|
|
89
|
-
selectedText: string;
|
|
90
|
-
isCommentOpen: boolean;
|
|
91
|
-
isBubbleMenuSuppressed: boolean;
|
|
92
|
-
inlineCommentData: InlineCommentData;
|
|
93
|
-
floatingCards: CommentFloatingCard[];
|
|
94
|
-
pendingPrehydrationFloatingThreadIds: string[];
|
|
95
|
-
inlineDrafts: InlineDraftRecordMap;
|
|
96
|
-
activeDraftId: string | null;
|
|
97
|
-
isDesktopFloatingEnabled: boolean;
|
|
98
|
-
ensCache: EnsCache;
|
|
99
|
-
inProgressFetch: string[];
|
|
100
|
-
editRequest: CommentEditRequest | null;
|
|
101
|
-
replyEditTarget: ReplyEditTarget | null;
|
|
102
|
-
editCompletion: CommentEditCompletion | null;
|
|
103
|
-
_externalDepsRef: React.RefObject<CommentExternalDeps | null> | null;
|
|
104
|
-
setExternalDepsRef: (ref: React.RefObject<CommentExternalDeps | null>) => void;
|
|
105
|
-
_recomputeDerived: () => void;
|
|
106
|
-
setInitialComments: (comments: IComment[]) => void;
|
|
107
|
-
setUsername: (username: string | null) => void;
|
|
108
|
-
setActiveCommentId: (id: string | null) => void;
|
|
109
|
-
setActiveTabId: (tabId: string) => void;
|
|
110
|
-
setIsConnected: (connected: boolean) => void;
|
|
111
|
-
setIsLoading: (loading: boolean) => void;
|
|
112
|
-
setIsDDocOwner: (isOwner: boolean) => void;
|
|
113
|
-
setOnComment: (fn: (() => void) | null) => void;
|
|
114
|
-
setCommentDrawerOpenFn: (fn: ((open: boolean) => void) | null) => void;
|
|
115
|
-
setConnectViaWallet: (fn: (() => Promise<void>) | null) => void;
|
|
116
|
-
setConnectViaUsername: (fn: ((username: string) => Promise<void>) | null) => void;
|
|
117
|
-
setIsCommentActive: (active: boolean) => void;
|
|
118
|
-
setIsCommentResolved: (resolved: boolean) => void;
|
|
119
|
-
getTabComments: () => IComment[];
|
|
120
|
-
getActiveComment: () => IComment | undefined;
|
|
121
|
-
getActiveComments: () => IComment[];
|
|
122
|
-
getActiveCommentIndex: () => number;
|
|
123
|
-
getIsCommentActive: () => boolean;
|
|
124
|
-
getIsCommentResolved: () => boolean;
|
|
125
|
-
setShowResolved: (show: boolean) => void;
|
|
126
|
-
setReply: (reply: string) => void;
|
|
127
|
-
setComment: (comment: string) => void;
|
|
128
|
-
setOpenReplyId: (id: string | null) => void;
|
|
129
|
-
setSelectedText: (text: string) => void;
|
|
130
|
-
setIsCommentOpen: (open: boolean) => void;
|
|
131
|
-
setIsBubbleMenuSuppressed: (suppressed: boolean) => void;
|
|
132
|
-
setInlineCommentData: (data: InlineCommentDataUpdater) => void;
|
|
133
|
-
setFloatingCards: (floatingCards: FloatingCardsUpdater) => void;
|
|
134
|
-
clearFloatingCards: () => void;
|
|
135
|
-
setActiveDraftId: (draftId: string | null) => void;
|
|
136
|
-
setIsDesktopFloatingEnabled: (enabled: boolean) => void;
|
|
137
|
-
toggleResolved: () => void;
|
|
138
|
-
clearEditRequest: (requestId: string) => void;
|
|
139
|
-
setReplyEditTarget: (target: ReplyEditTarget | null) => void;
|
|
140
|
-
cancelReplyEdit: () => void;
|
|
141
|
-
handleInput: (e: React.FormEvent<HTMLTextAreaElement>, content: string) => void;
|
|
142
|
-
handleReplyChange: (e: React.ChangeEvent<HTMLTextAreaElement>) => void;
|
|
143
|
-
handleCommentChange: (e: React.ChangeEvent<HTMLTextAreaElement>) => void;
|
|
144
|
-
handleCommentKeyDown: (e: React.KeyboardEvent<HTMLTextAreaElement>, tabId?: string) => void;
|
|
145
|
-
handleReplyKeyDown: (e: React.KeyboardEvent<HTMLTextAreaElement>) => void;
|
|
146
|
-
handleReplySubmit: () => void;
|
|
147
|
-
handleCommentSubmit: (tabId?: string) => void;
|
|
148
|
-
handleInlineComment: () => void;
|
|
149
|
-
addComment: (content?: string, usernameProp?: string) => string | undefined;
|
|
150
|
-
createFloatingDraft: (options?: CreateInlineDraftOptions) => string | null;
|
|
151
|
-
updateInlineDraftText: (draftId: string, value: string) => void;
|
|
152
|
-
cancelInlineDraft: (draftId: string) => void;
|
|
153
|
-
submitInlineDraft: (draftId: string) => void;
|
|
154
|
-
updateFloatingDraftText: (draftId: string, value: string) => void;
|
|
155
|
-
cancelFloatingDraft: (draftId: string) => void;
|
|
156
|
-
submitFloatingDraft: (draftId: string) => void;
|
|
157
|
-
openFloatingThread: (commentId: string) => void;
|
|
158
|
-
closeFloatingCard: (floatingCardId: string) => void;
|
|
159
|
-
blurFloatingCard: (floatingCardId: string) => void;
|
|
160
|
-
focusFloatingCard: (floatingCardId: string) => void;
|
|
161
|
-
removeInvalidFloatingDrafts: () => void;
|
|
162
|
-
reconcileFloatingThreadsForActiveTab: (options: ReconcileFloatingThreadsForActiveTabOptions) => void;
|
|
163
|
-
syncFloatingThreadCardWithActiveComment: () => void;
|
|
164
|
-
submitPendingFloatingDrafts: () => void;
|
|
165
|
-
/**
|
|
166
|
-
* Apply anchor edits to local comment state.
|
|
167
|
-
* Called after transaction analysis identifies edited anchors.
|
|
168
|
-
* Updates selectedContent for each affected comment
|
|
169
|
-
* so thread display stays in sync immediately, before consumer rehydration.
|
|
170
|
-
*/
|
|
171
|
-
applyCommentAnchorEdits: (edits: Array<{
|
|
172
|
-
commentId: string;
|
|
173
|
-
selectedContent: string;
|
|
174
|
-
}>) => void;
|
|
175
|
-
resolveComment: (commentId: string) => void;
|
|
176
|
-
unresolveComment: (commentId: string) => void;
|
|
177
|
-
deleteComment: (commentId: string, options?: {
|
|
178
|
-
skipExternalCallback?: boolean;
|
|
179
|
-
}) => void;
|
|
180
|
-
deleteReply: (commentId: string, replyId: string) => void;
|
|
181
|
-
requestEditComment: (commentId: string) => void;
|
|
182
|
-
requestEditReply: (commentId: string, replyId: string) => void;
|
|
183
|
-
editCommentContent: (commentId: string, content: string) => void;
|
|
184
|
-
editReplyContent: (commentId: string, replyId: string, content: string) => void;
|
|
185
|
-
handleAddReply: (activeCommentId: string, replyContent: string, replyCallback?: (activeCommentId: string, reply: IComment) => void) => void;
|
|
186
|
-
focusCommentInEditor: (commentId: string, options?: FocusCommentInEditorOptions) => void;
|
|
187
|
-
onPrevComment: () => void;
|
|
188
|
-
onNextComment: () => void;
|
|
189
|
-
getEnsStatus: (walletAddress: string, setEnsStatus: React.Dispatch<React.SetStateAction<EnsStatus>>) => void;
|
|
190
|
-
createMutationMeta: (type: CommentMutationType, mutate: () => boolean) => CommentMutationMeta | undefined;
|
|
191
|
-
}
|
|
192
|
-
export declare const createCommentStore: () => import('zustand').StoreApi<CommentStoreState>;
|
|
193
|
-
export declare const CommentStoreContext: React.Context<import('zustand').StoreApi<CommentStoreState> | null>;
|
|
194
|
-
export declare function useCommentStore<T>(selector: (state: CommentStoreState) => T): T;
|
|
195
|
-
export {};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { CommentAnchor } from '../extensions/comment/comment-decoration-plugin';
|
|
2
|
-
import { SerializedCommentAnchor } from '../types';
|
|
3
|
-
|
|
4
|
-
export declare const getSerializedCommentAnchorsKey: (anchors?: SerializedCommentAnchor[]) => string | null;
|
|
5
|
-
export declare const deserializeCommentAnchors: (anchors?: SerializedCommentAnchor[]) => CommentAnchor[];
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { MutableRefObject } from 'react';
|
|
2
|
-
import { Editor } from '@tiptap/react';
|
|
3
|
-
import { CommentAnchor } from '../extensions/comment/comment-decoration-plugin';
|
|
4
|
-
|
|
5
|
-
export declare const MOBILE_COMMENT_DRAWER_CANVAS_OFFSET_VAR = "--mobile-comment-drawer-canvas-offset";
|
|
6
|
-
type CommentSelectionRange = {
|
|
7
|
-
from: number;
|
|
8
|
-
to: number;
|
|
9
|
-
};
|
|
10
|
-
export declare const clearMobileCommentDrawerCanvasOffset: (editorRoot?: HTMLElement | null) => void;
|
|
11
|
-
export declare const resolveCommentSelectionRange: ({ editor, commentId, commentAnchorsRef, }: {
|
|
12
|
-
editor: Editor;
|
|
13
|
-
commentId: string;
|
|
14
|
-
commentAnchorsRef?: MutableRefObject<CommentAnchor[]>;
|
|
15
|
-
}) => CommentSelectionRange | null;
|
|
16
|
-
export declare const scrollCommentSelectionRangeIntoView: ({ editor, selectionRange, behavior, }: {
|
|
17
|
-
editor: Editor;
|
|
18
|
-
selectionRange: CommentSelectionRange;
|
|
19
|
-
behavior?: ScrollBehavior;
|
|
20
|
-
}) => void;
|
|
21
|
-
export {};
|