@fileverse-dev/ddoc 3.2.2-sg-5 → 3.2.3-linkcaption-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 +28900 -29907
- package/dist/package/components/inline-comment/comment-card.d.ts +1 -19
- package/dist/package/components/inline-comment/context/types.d.ts +1 -7
- package/dist/package/components/inline-comment/floating-comment/types.d.ts +1 -6
- package/dist/package/components/inline-comment/floating-comment-layout-utils.d.ts +1 -4
- package/dist/package/extensions/comment/comment-decoration-plugin.d.ts +0 -25
- package/dist/package/extensions/comment/comment.d.ts +0 -5
- 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-editing-context.d.ts +0 -2
- package/dist/package/hooks/use-tab-editor.d.ts +1 -4
- package/dist/package/stores/comment-store-provider.d.ts +1 -9
- package/dist/package/stores/comment-store.d.ts +0 -74
- package/dist/package/types.d.ts +0 -9
- package/dist/package/use-ddoc-editor.d.ts +1 -3
- package/dist/style.css +1 -1
- package/package.json +2 -2
- package/dist/package/components/inline-comment/floating-comment/suggestion-draft-floating-card.d.ts +0 -17
- package/dist/package/components/inline-comment/floating-comment/suggestion-thread-floating-card.d.ts +0 -15
- package/dist/package/extensions/suggestion/suggestion-tracking-extension.d.ts +0 -43
|
@@ -1,22 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { CommentCardProps, CommentReplyProps, EnsStatus } from './types';
|
|
1
|
+
import { CommentCardProps } from './types';
|
|
3
2
|
|
|
4
|
-
export declare const CommentReply: ({ commentId, replyId, reply, username, createdAt, isThreadResolved, }: CommentReplyProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
-
interface CommentRepliesThreadProps {
|
|
6
|
-
id?: string;
|
|
7
|
-
displayedReplies: CommentCardProps['replies'];
|
|
8
|
-
ensStatus: EnsStatus;
|
|
9
|
-
handleReplyToggleClick: (event: MouseEvent<HTMLElement>) => void;
|
|
10
|
-
isCommentDrawerContext?: boolean;
|
|
11
|
-
isResolved?: boolean;
|
|
12
|
-
replyToggleLabel: string;
|
|
13
|
-
shouldShowReplyThread: boolean;
|
|
14
|
-
shouldShowReplyToggle: boolean;
|
|
15
|
-
shouldShowResolvedMobileReplyCount: boolean;
|
|
16
|
-
showAllReplies: boolean;
|
|
17
|
-
visibleReplies: CommentCardProps['replies'];
|
|
18
|
-
}
|
|
19
|
-
export declare const CommentRepliesThread: ({ id, displayedReplies, ensStatus, handleReplyToggleClick, isCommentDrawerContext, isResolved, replyToggleLabel, shouldShowReplyThread, shouldShowReplyToggle, shouldShowResolvedMobileReplyCount, showAllReplies, visibleReplies, }: CommentRepliesThreadProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
20
3
|
export declare const CommentCard: (props: CommentCardProps) => import("react/jsx-runtime").JSX.Element;
|
|
21
4
|
export declare const UserDisplaySkeleton: () => import("react/jsx-runtime").JSX.Element;
|
|
22
|
-
export {};
|
|
@@ -26,13 +26,7 @@ export interface CommentFloatingThreadCard extends CommentFloatingBaseCard {
|
|
|
26
26
|
type: 'thread';
|
|
27
27
|
commentId: string;
|
|
28
28
|
}
|
|
29
|
-
export
|
|
30
|
-
type: 'suggestion-draft';
|
|
31
|
-
suggestionId: string;
|
|
32
|
-
/** Accumulated inserted text from the live suggestion context. */
|
|
33
|
-
insertedText: string;
|
|
34
|
-
}
|
|
35
|
-
export type CommentFloatingCard = CommentFloatingDraftCard | CommentFloatingThreadCard | SuggestionFloatingDraftCard;
|
|
29
|
+
export type CommentFloatingCard = CommentFloatingDraftCard | CommentFloatingThreadCard;
|
|
36
30
|
export interface InlineCommentData {
|
|
37
31
|
highlightedTextContent?: string;
|
|
38
32
|
inlineCommentText: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Editor } from '@tiptap/react';
|
|
2
2
|
import { ReactNode, RefObject } from 'react';
|
|
3
3
|
import { IComment } from '../../../extensions/comment';
|
|
4
|
-
import { CommentFloatingDraftCard, CommentFloatingThreadCard
|
|
4
|
+
import { CommentFloatingDraftCard, CommentFloatingThreadCard } from '../context/types';
|
|
5
5
|
|
|
6
6
|
export type RegisterCardNode = (floatingCardId: string, node: HTMLDivElement | null) => void;
|
|
7
7
|
export interface CommentFloatingContainerProps {
|
|
@@ -32,8 +32,3 @@ export interface ThreadFloatingCardProps {
|
|
|
32
32
|
registerCardNode: RegisterCardNode;
|
|
33
33
|
isCollaborationEnabled?: boolean;
|
|
34
34
|
}
|
|
35
|
-
export interface SuggestionDraftFloatingCardProps {
|
|
36
|
-
card: SuggestionFloatingDraftCard;
|
|
37
|
-
isHidden: boolean;
|
|
38
|
-
registerCardNode: RegisterCardNode;
|
|
39
|
-
}
|
|
@@ -2,7 +2,7 @@ import { Editor } from '@tiptap/react';
|
|
|
2
2
|
import { FloatingLayoutInvalidationFlag, FloatingCardLayoutInput } from './comment-floating-layout';
|
|
3
3
|
import { CommentFloatingCard } from './context/types';
|
|
4
4
|
|
|
5
|
-
export type AnchorType = 'draft' | 'thread'
|
|
5
|
+
export type AnchorType = 'draft' | 'thread';
|
|
6
6
|
export interface CachedAnchorRect {
|
|
7
7
|
top: number;
|
|
8
8
|
height: number;
|
|
@@ -40,9 +40,6 @@ export declare const FLOATING_VIEWPORT_BUFFER_MULTIPLIER = 1;
|
|
|
40
40
|
export declare const getAnchorIdentity: (floatingCard: CommentFloatingCard) => {
|
|
41
41
|
anchorId: string;
|
|
42
42
|
anchorType: "draft";
|
|
43
|
-
} | {
|
|
44
|
-
anchorId: string;
|
|
45
|
-
anchorType: "suggestion-draft";
|
|
46
43
|
} | {
|
|
47
44
|
anchorId: string;
|
|
48
45
|
anchorType: "thread";
|
|
@@ -2,7 +2,6 @@ import { Extension, Editor } from '@tiptap/core';
|
|
|
2
2
|
import { EditorState, PluginKey } from '@tiptap/pm/state';
|
|
3
3
|
import { Transform } from '@tiptap/pm/transform';
|
|
4
4
|
import { DecorationSet } from '@tiptap/pm/view';
|
|
5
|
-
import { SuggestionType } from '../../types';
|
|
6
5
|
|
|
7
6
|
import * as Y from 'yjs';
|
|
8
7
|
export interface CommentAnchor {
|
|
@@ -11,10 +10,6 @@ export interface CommentAnchor {
|
|
|
11
10
|
anchorTo: Y.RelativePosition;
|
|
12
11
|
resolved: boolean;
|
|
13
12
|
deleted: boolean;
|
|
14
|
-
isSuggestion?: boolean;
|
|
15
|
-
suggestionType?: SuggestionType;
|
|
16
|
-
originalContent?: string;
|
|
17
|
-
suggestedContent?: string;
|
|
18
13
|
}
|
|
19
14
|
interface CommentDecorationPluginState {
|
|
20
15
|
decorations: DecorationSet;
|
|
@@ -39,13 +34,6 @@ export type CommentAnchorTransactionChange = {
|
|
|
39
34
|
} & CommentAnchorRange & CommentAnchorRelativeRange);
|
|
40
35
|
export declare const commentDecorationPluginKey: PluginKey<CommentDecorationPluginState>;
|
|
41
36
|
export declare function resolveCommentAnchorRangeInState(anchor: Pick<CommentAnchor, 'anchorFrom' | 'anchorTo'>, state: EditorState): CommentAnchorRange | null;
|
|
42
|
-
/**
|
|
43
|
-
* Resolve anchorFrom to a single absolute position.
|
|
44
|
-
* Used for 'add' suggestion anchors where anchorFrom === anchorTo (cursor,
|
|
45
|
-
* no initial selection) — resolveCommentAnchorRangeInState rejects from >= to,
|
|
46
|
-
* so we need a separate path that allows a point position.
|
|
47
|
-
*/
|
|
48
|
-
export declare function resolveCommentAnchorPointInState(anchor: Pick<CommentAnchor, 'anchorFrom'>, state: EditorState): number | null;
|
|
49
37
|
export declare function resolveCommentAnchorRangeForAnalysis(anchor: Pick<CommentAnchor, 'id' | 'anchorFrom' | 'anchorTo'>, state: EditorState): CommentAnchorRange | null;
|
|
50
38
|
/**
|
|
51
39
|
* Analyze transaction changes to classify each active anchor's mutation status.
|
|
@@ -75,21 +63,8 @@ export declare const CommentDecorationExtension: Extension<CommentDecorationOpti
|
|
|
75
63
|
* These are consumed by the draft-creation flow and transaction-analysis layer.
|
|
76
64
|
*/
|
|
77
65
|
export declare function createCommentAnchorFromEditor(editor: Editor, from: number, to: number): CommentAnchorRelativeRange | null;
|
|
78
|
-
/**
|
|
79
|
-
* Create a point anchor (anchorFrom === anchorTo) at a single doc position.
|
|
80
|
-
* Used by the suggestion-mode draft flow when the viewer places a cursor
|
|
81
|
-
* without selecting text — createCommentAnchorFromEditor rejects from >= to
|
|
82
|
-
* since an empty range is invalid for regular comments.
|
|
83
|
-
*/
|
|
84
|
-
export declare function createCommentAnchorPointFromEditor(editor: Editor, pos: number): CommentAnchorRelativeRange | null;
|
|
85
66
|
export declare function createCommentAnchorFromSelection(editor: Editor): CommentAnchorRelativeRange | null;
|
|
86
67
|
export declare function triggerDecorationRebuild(editor: Editor): void;
|
|
87
68
|
export declare function getCommentAtPosition(editor: Editor, pos: number, getAnchors: () => CommentAnchor[]): CommentAnchor | null;
|
|
88
69
|
export declare function getCommentAnchorRange(editor: Editor, commentId: string, getAnchors: () => CommentAnchor[]): CommentAnchorRange | null;
|
|
89
|
-
/**
|
|
90
|
-
* Apply the accepted suggestion's change to the document.
|
|
91
|
-
* Called by the store's acceptSuggestion action before resolving on-chain.
|
|
92
|
-
* Returns false if the anchor can't be resolved or the suggestion type is unknown.
|
|
93
|
-
*/
|
|
94
|
-
export declare function applyAcceptedSuggestion(editor: Editor, anchor: CommentAnchor): boolean;
|
|
95
70
|
export {};
|
|
@@ -2,7 +2,6 @@ import { Mark, Range } from '@tiptap/core';
|
|
|
2
2
|
import { Mark as PMMark } from '@tiptap/pm/model';
|
|
3
3
|
import { PluginKey, EditorState } from '@tiptap/pm/state';
|
|
4
4
|
import { DecorationSet } from '@tiptap/pm/view';
|
|
5
|
-
import { SuggestionType } from '../../types';
|
|
6
5
|
|
|
7
6
|
declare module '@tiptap/core' {
|
|
8
7
|
interface Commands<ReturnType> {
|
|
@@ -94,10 +93,6 @@ export interface IComment {
|
|
|
94
93
|
deleted?: boolean;
|
|
95
94
|
commentIndex?: number;
|
|
96
95
|
version?: string;
|
|
97
|
-
isSuggestion?: boolean;
|
|
98
|
-
suggestionType?: SuggestionType;
|
|
99
|
-
originalContent?: string;
|
|
100
|
-
suggestedContent?: string;
|
|
101
96
|
}
|
|
102
97
|
export declare const CommentExtension: Mark<CommentOptions, CommentStorage>;
|
|
103
98
|
export {};
|
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
import { Attrs } from '@tiptap/pm/model';
|
|
1
|
+
import { Attrs, Node as ProseMirrorNode } from '@tiptap/pm/model';
|
|
2
|
+
import { Editor } from '@tiptap/core';
|
|
2
3
|
|
|
3
4
|
interface ResizableMediaAttributes {
|
|
4
5
|
dataAlign: string;
|
|
5
6
|
dataFloat: null | string;
|
|
6
|
-
showCaptionInput?: boolean;
|
|
7
|
-
caption?: string;
|
|
8
7
|
}
|
|
9
8
|
type UpdateAttributes = (attrs: Partial<ResizableMediaAttributes>) => void;
|
|
10
|
-
type Action = (updateAttributes: UpdateAttributes) => void;
|
|
9
|
+
type Action = (updateAttributes: UpdateAttributes, editor?: Editor, getPos?: (() => number | undefined) | boolean) => void;
|
|
11
10
|
interface ResizableMediaAction {
|
|
12
11
|
tooltip: string;
|
|
13
12
|
icon?: string;
|
|
14
13
|
action?: Action;
|
|
15
|
-
isActive?: (attrs: Attrs) => boolean;
|
|
14
|
+
isActive?: (attrs: Attrs, node?: ProseMirrorNode) => boolean;
|
|
16
15
|
delete?: (d: () => void) => void;
|
|
17
16
|
}
|
|
18
17
|
export declare const resizableMediaActions: ResizableMediaAction[];
|
|
@@ -4,4 +4,4 @@ import { IpfsImageFetchPayload } from '../../types.ts';
|
|
|
4
4
|
export declare const getResizableMediaNodeView: (ipfsImageFetchFn: (_data: IpfsImageFetchPayload) => Promise<{
|
|
5
5
|
url: string;
|
|
6
6
|
file: File;
|
|
7
|
-
}>, fetchV1ImageFn: (url: string) => Promise<ArrayBuffer | undefined>) => ({ node, updateAttributes, deleteNode, selected }: NodeViewProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
}>, fetchV1ImageFn: (url: string) => Promise<ArrayBuffer | undefined>) => ({ node, updateAttributes, deleteNode, selected, editor, getPos, }: NodeViewProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -4,7 +4,6 @@ type EditingContextType = {
|
|
|
4
4
|
isPreviewMode: boolean;
|
|
5
5
|
isPresentationMode?: boolean;
|
|
6
6
|
isCollaboratorsDoc?: boolean;
|
|
7
|
-
isSuggestionMode?: boolean;
|
|
8
7
|
};
|
|
9
8
|
export declare const useEditingContext: () => EditingContextType;
|
|
10
9
|
type EditingProviderProps = {
|
|
@@ -13,7 +12,6 @@ type EditingProviderProps = {
|
|
|
13
12
|
isPresentationMode?: boolean;
|
|
14
13
|
isCollaboratorsDoc?: boolean;
|
|
15
14
|
isPreviewEditor?: boolean;
|
|
16
|
-
isSuggestionMode?: boolean;
|
|
17
15
|
};
|
|
18
16
|
export declare const EditingProvider: React.FC<EditingProviderProps>;
|
|
19
17
|
export {};
|
|
@@ -12,7 +12,6 @@ interface UseTabEditorArgs {
|
|
|
12
12
|
hasTabState?: boolean;
|
|
13
13
|
versionId?: string;
|
|
14
14
|
isPreviewMode?: boolean;
|
|
15
|
-
viewerMode?: DdocProps['viewerMode'];
|
|
16
15
|
initialContent: DdocProps['initialContent'];
|
|
17
16
|
collaboration?: CollaborationProps;
|
|
18
17
|
isReady?: boolean;
|
|
@@ -52,7 +51,7 @@ interface UseTabEditorArgs {
|
|
|
52
51
|
editorRef?: MutableRefObject<Editor | null>;
|
|
53
52
|
initialCommentAnchors?: SerializedCommentAnchor[];
|
|
54
53
|
}
|
|
55
|
-
export declare const useTabEditor: ({ ydoc, isVersionMode, hasTabState, versionId, isPreviewMode,
|
|
54
|
+
export declare const useTabEditor: ({ ydoc, isVersionMode, hasTabState, versionId, isPreviewMode, initialContent, collaboration, isReady, isSyncing, awareness, disableInlineComment, isFocusMode, 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, initialCommentAnchors, }: UseTabEditorArgs) => {
|
|
56
55
|
editor: Editor | null;
|
|
57
56
|
ref: import('react').RefObject<HTMLDivElement>;
|
|
58
57
|
slides: string[];
|
|
@@ -64,7 +63,5 @@ export declare const useTabEditor: ({ ydoc, isVersionMode, hasTabState, versionI
|
|
|
64
63
|
focusCommentWithActiveId: (id: string) => void;
|
|
65
64
|
isContentLoading: boolean | undefined;
|
|
66
65
|
commentAnchorsRef: MutableRefObject<CommentAnchor[]>;
|
|
67
|
-
draftAnchorsRef: MutableRefObject<CommentAnchor[]>;
|
|
68
|
-
storeApiRef: MutableRefObject<import('zustand').StoreApi<import('../stores/comment-store').CommentStoreState> | null>;
|
|
69
66
|
};
|
|
70
67
|
export {};
|
|
@@ -3,7 +3,6 @@ import { Editor } from '@tiptap/core';
|
|
|
3
3
|
import { IComment } from '../extensions/comment';
|
|
4
4
|
import { CommentAnchor } from '../extensions/comment/comment-decoration-plugin';
|
|
5
5
|
import { CommentMutationMeta, SerializedCommentAnchor } from '../types';
|
|
6
|
-
import { createCommentStore } from './comment-store';
|
|
7
6
|
|
|
8
7
|
import * as Y from 'yjs';
|
|
9
8
|
export interface CommentStoreProviderProps {
|
|
@@ -28,13 +27,6 @@ export interface CommentStoreProviderProps {
|
|
|
28
27
|
connectViaUsername?: (username: string) => Promise<void>;
|
|
29
28
|
ensResolutionUrl: string;
|
|
30
29
|
commentAnchorsRef?: React.MutableRefObject<CommentAnchor[]>;
|
|
31
|
-
draftAnchorsRef?: React.MutableRefObject<CommentAnchor[]>;
|
|
32
|
-
/**
|
|
33
|
-
* Ref populated by the provider with the Zustand store instance.
|
|
34
|
-
* SuggestionTrackingExtension reads this inside event handlers to route
|
|
35
|
-
* keystrokes into draft actions without rebuilding the editor.
|
|
36
|
-
*/
|
|
37
|
-
storeApiRef?: React.MutableRefObject<ReturnType<typeof createCommentStore> | null>;
|
|
38
30
|
initialCommentAnchors?: SerializedCommentAnchor[];
|
|
39
31
|
initialComments: IComment[];
|
|
40
32
|
username: string | null;
|
|
@@ -45,7 +37,7 @@ export interface CommentStoreProviderProps {
|
|
|
45
37
|
isDDocOwner?: boolean;
|
|
46
38
|
setUsername?: React.Dispatch<React.SetStateAction<string>>;
|
|
47
39
|
}
|
|
48
|
-
export declare const CommentStoreProvider: ({ children, editor, ydoc, isFocusMode, setActiveCommentId, focusCommentWithActiveId, setInitialComments, onNewComment, onEditComment, onEditReply, onCommentReply, onResolveComment, onUnresolveComment, onDeleteComment, onInlineComment, onComment, setCommentDrawerOpen, connectViaWallet, connectViaUsername, ensResolutionUrl, commentAnchorsRef,
|
|
40
|
+
export declare const CommentStoreProvider: ({ children, editor, ydoc, isFocusMode, setActiveCommentId, focusCommentWithActiveId, setInitialComments, onNewComment, onEditComment, onEditReply, onCommentReply, onResolveComment, onUnresolveComment, onDeleteComment, onInlineComment, onComment, setCommentDrawerOpen, connectViaWallet, connectViaUsername, ensResolutionUrl, commentAnchorsRef, initialCommentAnchors, setUsername: setUsernameProp, initialComments, username, activeCommentId, activeTabId, isConnected, isLoading, isDDocOwner, }: CommentStoreProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
49
41
|
interface CommentRefsContextType {
|
|
50
42
|
commentsSectionRef: React.RefObject<HTMLDivElement>;
|
|
51
43
|
replySectionRef: React.RefObject<HTMLDivElement>;
|
|
@@ -29,35 +29,7 @@ export interface CommentExternalDeps {
|
|
|
29
29
|
ensResolutionUrl: string;
|
|
30
30
|
commentAnchorsRef?: React.MutableRefObject<CommentAnchor[]>;
|
|
31
31
|
refreshCommentAnchorState?: () => void;
|
|
32
|
-
/**
|
|
33
|
-
* Derived anchor list for in-progress suggestion drafts. Maintained by the
|
|
34
|
-
* store (not the consumer) — draft actions upsert into this ref whenever
|
|
35
|
-
* state.drafts changes. The decoration extension reads this ref alongside
|
|
36
|
-
* commentAnchorsRef to render both layers identically.
|
|
37
|
-
*/
|
|
38
|
-
draftAnchorsRef?: React.MutableRefObject<CommentAnchor[]>;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* A suggestion draft is the viewer's in-progress proposed edit — kept local
|
|
42
|
-
* until Submit. Drafts live in memory only (lost on refresh). Derived into
|
|
43
|
-
* a CommentAnchor for decoration rendering via deriveDraftAnchor(). The
|
|
44
|
-
* suggestion type ('add' | 'delete' | 'replace') is not stored; it is derived
|
|
45
|
-
* at use time from hadDeletion + insertedText.
|
|
46
|
-
*/
|
|
47
|
-
export interface DraftSuggestion {
|
|
48
|
-
id: string;
|
|
49
|
-
anchorFrom: Y.RelativePosition;
|
|
50
|
-
anchorTo: Y.RelativePosition;
|
|
51
|
-
/** The text that was selected at draft creation (for Delete/Replace strikethrough). */
|
|
52
|
-
originalContent: string;
|
|
53
|
-
/** Accumulated text the viewer has typed. Empty for a pure Delete draft. */
|
|
54
|
-
insertedText: string;
|
|
55
|
-
/** Per-keystroke history for undo — each entry is one typed character. */
|
|
56
|
-
keystrokes: string[];
|
|
57
|
-
/** True when the draft was created via select+delete or select+type. */
|
|
58
|
-
hadDeletion: boolean;
|
|
59
32
|
}
|
|
60
|
-
type SuggestionDeleteDirection = 'backward' | 'forward';
|
|
61
33
|
type FloatingCardsUpdater = React.SetStateAction<CommentFloatingCard[]>;
|
|
62
34
|
type InlineCommentDataUpdater = Partial<InlineCommentData> | ((prev: InlineCommentData) => Partial<InlineCommentData> | InlineCommentData);
|
|
63
35
|
type InlineDraftRecordMap = Record<string, InlineCommentDraft>;
|
|
@@ -120,8 +92,6 @@ export interface CommentStoreState {
|
|
|
120
92
|
inlineCommentData: InlineCommentData;
|
|
121
93
|
floatingCards: CommentFloatingCard[];
|
|
122
94
|
pendingPrehydrationFloatingThreadIds: string[];
|
|
123
|
-
/** In-progress suggestion drafts — keyed by suggestionId. Viewer-local, lost on refresh. */
|
|
124
|
-
drafts: Record<string, DraftSuggestion>;
|
|
125
95
|
inlineDrafts: InlineDraftRecordMap;
|
|
126
96
|
activeDraftId: string | null;
|
|
127
97
|
isDesktopFloatingEnabled: boolean;
|
|
@@ -207,50 +177,6 @@ export interface CommentStoreState {
|
|
|
207
177
|
deleteComment: (commentId: string, options?: {
|
|
208
178
|
skipExternalCallback?: boolean;
|
|
209
179
|
}) => void;
|
|
210
|
-
acceptSuggestion: (commentId: string) => void;
|
|
211
|
-
/**
|
|
212
|
-
* Append typed characters to the draft at the current cursor position.
|
|
213
|
-
* Creates a new Add draft if no draft exists at the cursor.
|
|
214
|
-
*/
|
|
215
|
-
appendToDraftAtCursor: (text: string) => void;
|
|
216
|
-
/**
|
|
217
|
-
* Create a Delete (or pending Replace) draft from a selection range.
|
|
218
|
-
* Captures originalContent, leaves insertedText empty; type becomes 'replace'
|
|
219
|
-
* as soon as the viewer types.
|
|
220
|
-
*/
|
|
221
|
-
startDeleteDraft: (from: number, to: number, collapseTo?: number) => void;
|
|
222
|
-
/**
|
|
223
|
-
* Convert a collapsed-caret Backspace/Delete into a delete draft when the
|
|
224
|
-
* caret is adjacent to text, or shrink the active draft if the caret is
|
|
225
|
-
* already inside one.
|
|
226
|
-
*/
|
|
227
|
-
deleteAtCursorOrUndoActiveDraft: (direction: SuggestionDeleteDirection) => void;
|
|
228
|
-
/**
|
|
229
|
-
* Handle browser deletion paths that resolved to a concrete range even
|
|
230
|
-
* though the user had no explicit selection.
|
|
231
|
-
*/
|
|
232
|
-
deleteRangeOrUndoActiveDraft: (from: number, to: number) => void;
|
|
233
|
-
/**
|
|
234
|
-
* Undo the last keystroke in the draft at the current cursor position.
|
|
235
|
-
* When the draft has no keystrokes left, it is discarded.
|
|
236
|
-
* For a pure Delete draft (no keystrokes ever), calling this discards.
|
|
237
|
-
*/
|
|
238
|
-
undoLastKeystrokeInActiveDraft: () => void;
|
|
239
|
-
/** Drop a draft entirely — removes the inline overlay and draft card. */
|
|
240
|
-
discardDraft: (suggestionId: string) => void;
|
|
241
|
-
/**
|
|
242
|
-
* Refresh the `originalContent` (and the suggestion-draft card's selectedText)
|
|
243
|
-
* for a Delete/Replace draft whose anchored range still resolves but now
|
|
244
|
-
* covers different text — happens when the owner edits within the anchored
|
|
245
|
-
* range while the viewer's draft is open.
|
|
246
|
-
*/
|
|
247
|
-
refreshDraftOriginalContent: (suggestionId: string, currentText: string) => void;
|
|
248
|
-
/**
|
|
249
|
-
* Promote a draft to a submitted suggestion. Pushes the anchor into
|
|
250
|
-
* commentAnchorsRef, calls onNewComment, removes the draft, and swaps the
|
|
251
|
-
* suggestion-draft floating card for a thread card (same floatingCardId).
|
|
252
|
-
*/
|
|
253
|
-
submitDraft: (suggestionId: string) => void;
|
|
254
180
|
deleteReply: (commentId: string, replyId: string) => void;
|
|
255
181
|
requestEditComment: (commentId: string) => void;
|
|
256
182
|
requestEditReply: (commentId: string, replyId: string) => void;
|
package/dist/package/types.d.ts
CHANGED
|
@@ -20,7 +20,6 @@ export type InlineCommentData = {
|
|
|
20
20
|
handleClick: boolean;
|
|
21
21
|
};
|
|
22
22
|
export type CommentMutationType = 'create' | 'edit' | 'resolve' | 'unresolve' | 'delete';
|
|
23
|
-
export type SuggestionType = 'add' | 'replace' | 'delete';
|
|
24
23
|
export interface CommentMutationMeta {
|
|
25
24
|
type: CommentMutationType;
|
|
26
25
|
updateChunk?: string;
|
|
@@ -28,9 +27,6 @@ export interface CommentMutationMeta {
|
|
|
28
27
|
anchorTo?: string;
|
|
29
28
|
selectedContent?: string;
|
|
30
29
|
content?: string;
|
|
31
|
-
suggestionType?: SuggestionType;
|
|
32
|
-
originalContent?: string;
|
|
33
|
-
suggestedContent?: string;
|
|
34
30
|
}
|
|
35
31
|
export interface SerializedCommentAnchor {
|
|
36
32
|
id: string;
|
|
@@ -38,10 +34,6 @@ export interface SerializedCommentAnchor {
|
|
|
38
34
|
anchorTo: string;
|
|
39
35
|
resolved: boolean;
|
|
40
36
|
deleted: boolean;
|
|
41
|
-
isSuggestion?: boolean;
|
|
42
|
-
suggestionType?: SuggestionType;
|
|
43
|
-
originalContent?: string;
|
|
44
|
-
suggestedContent?: string;
|
|
45
37
|
}
|
|
46
38
|
export interface CommentAccountProps {
|
|
47
39
|
isConnected?: boolean;
|
|
@@ -152,7 +144,6 @@ export interface DdocProps extends CommentAccountProps {
|
|
|
152
144
|
editorCanvasClassNames?: string;
|
|
153
145
|
isCommentSectionOpen?: boolean;
|
|
154
146
|
isPreviewMode: boolean;
|
|
155
|
-
viewerMode?: 'suggest' | 'view-only';
|
|
156
147
|
ensResolutionUrl?: string;
|
|
157
148
|
ipfsImageUploadFn?: (file: File) => Promise<IpfsImageUploadResponse>;
|
|
158
149
|
enableIndexeddbSync?: boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DdocProps } from './types';
|
|
2
2
|
import { Editor } from '@tiptap/react';
|
|
3
3
|
|
|
4
|
-
export declare const useDdocEditor: ({ isPreviewMode,
|
|
4
|
+
export declare const useDdocEditor: ({ isPreviewMode, initialContent, versionHistoryState, collaboration, onChange, onCollaboratorChange, onCommentInteraction, onError, setCharacterCount, setWordCount, setPageCount, ipfsImageUploadFn, ddocId, enableIndexeddbSync, unFocused, isFocusMode, theme, zoomLevel, onInvalidContentError, ignoreCorruptedData, isPresentationMode, metadataProxyUrl, extensions: externalExtensions, onCopyHeadingLink, ipfsImageFetchFn, fetchV1ImageFn, isConnected, activeModel, maxTokens, isAIAgentEnabled, onIndexedDbError, disableInlineComment, initialCommentAnchors, ...rest }: Partial<DdocProps> & {
|
|
5
5
|
isFocusMode?: boolean;
|
|
6
6
|
}) => {
|
|
7
7
|
ydoc: import('yjs').Doc;
|
|
@@ -41,6 +41,4 @@ export declare const useDdocEditor: ({ isPreviewMode, viewerMode, initialContent
|
|
|
41
41
|
setActiveCommentId: import('react').Dispatch<import('react').SetStateAction<string | null>>;
|
|
42
42
|
focusCommentWithActiveId: (id: string) => void;
|
|
43
43
|
commentAnchorsRef: import('react').MutableRefObject<import('./extensions/comment/comment-decoration-plugin').CommentAnchor[]>;
|
|
44
|
-
draftAnchorsRef: import('react').MutableRefObject<import('./extensions/comment/comment-decoration-plugin').CommentAnchor[]>;
|
|
45
|
-
storeApiRef: import('react').MutableRefObject<import('zustand').StoreApi<import('./stores/comment-store').CommentStoreState> | null>;
|
|
46
44
|
};
|