@fileverse-dev/ddoc 3.2.9-sg-3 → 3.2.10
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 +28675 -30775
- package/dist/package/components/inline-comment/comment-card.d.ts +1 -19
- package/dist/package/components/inline-comment/comment-floating-layout.d.ts +0 -2
- package/dist/package/components/inline-comment/comment-reply-input.d.ts +1 -1
- package/dist/package/components/inline-comment/context/types.d.ts +1 -9
- 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 +2 -9
- package/dist/package/components/inline-comment/types.d.ts +0 -1
- package/dist/package/components/inline-comment/use-is-selected-content-deleted.d.ts +1 -1
- package/dist/package/extensions/comment/comment-decoration-plugin.d.ts +7 -34
- package/dist/package/extensions/comment/comment.d.ts +0 -5
- 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 -1
- package/dist/package/stores/comment-store.d.ts +0 -84
- 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/comment-drawer-constants.d.ts +0 -1
- package/dist/package/components/inline-comment/comment-drawer-desktop.d.ts +0 -35
- package/dist/package/components/inline-comment/comment-drawer-mobile.d.ts +0 -43
- 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/components/inline-comment/mobile-inline-comment-sheet.d.ts +0 -15
- package/dist/package/components/inline-comment/mobile-suggestion-draft-sheet.d.ts +0 -15
- package/dist/package/components/inline-comment/use-comment-drawer-drafts.d.ts +0 -22
- package/dist/package/components/inline-comment/use-comment-drawer-filters.d.ts +0 -40
- package/dist/package/components/inline-comment/use-comment-drawer-focus.d.ts +0 -17
- package/dist/package/components/inline-comment/use-comment-drawer-lifecycle.d.ts +0 -13
- package/dist/package/components/inline-comment/use-mobile-comment-navigation.d.ts +0 -20
- package/dist/package/extensions/suggestion/suggestion-tracking-extension.d.ts +0 -45
|
@@ -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 {};
|
|
@@ -4,5 +4,5 @@ interface CommentReplyInputProps {
|
|
|
4
4
|
replyCount: number;
|
|
5
5
|
isCollaborationEnabled: boolean;
|
|
6
6
|
}
|
|
7
|
-
export declare const CommentReplyInput: ({ commentId, replyCount, isCollaborationEnabled,
|
|
7
|
+
export declare const CommentReplyInput: ({ commentId, replyCount, isCollaborationEnabled, }: CommentReplyInputProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
8
|
export {};
|
|
@@ -26,15 +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
|
-
/** Pasted link href for link suggestions. */
|
|
35
|
-
linkHref?: string;
|
|
36
|
-
}
|
|
37
|
-
export type CommentFloatingCard = CommentFloatingDraftCard | CommentFloatingThreadCard | SuggestionFloatingDraftCard;
|
|
29
|
+
export type CommentFloatingCard = CommentFloatingDraftCard | CommentFloatingThreadCard;
|
|
38
30
|
export interface InlineCommentData {
|
|
39
31
|
highlightedTextContent?: string;
|
|
40
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";
|
|
@@ -68,11 +65,7 @@ export declare const getRect: ({ elements, viewportTop, viewportBottom, }: {
|
|
|
68
65
|
elements: HTMLElement[];
|
|
69
66
|
viewportTop: number;
|
|
70
67
|
viewportBottom: number;
|
|
71
|
-
}) =>
|
|
72
|
-
top: number;
|
|
73
|
-
height: number;
|
|
74
|
-
intersectsViewport: boolean;
|
|
75
|
-
} | null;
|
|
68
|
+
}) => DOMRect | null;
|
|
76
69
|
export declare const reconcileOrderedFloatingCardIds: ({ previousOrderedFloatingCardIds, nextFloatingCards, getPos, }: {
|
|
77
70
|
previousOrderedFloatingCardIds: string[];
|
|
78
71
|
nextFloatingCards: CommentFloatingCard[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function useIsSelectedContentDeleted(commentId: string | undefined, selectedContent: string | undefined, commentTabId: string | undefined
|
|
1
|
+
export declare function useIsSelectedContentDeleted(commentId: string | undefined, selectedContent: string | undefined, commentTabId: string | undefined): boolean;
|
|
@@ -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,15 +34,7 @@ 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
|
-
export declare function resolveCommentAnchorPointForAnalysis(anchor: Pick<CommentAnchor, 'id' | 'anchorFrom'>, state: EditorState): number | null;
|
|
51
38
|
/**
|
|
52
39
|
* Analyze transaction changes to classify each active anchor's mutation status.
|
|
53
40
|
*
|
|
@@ -55,16 +42,15 @@ export declare function resolveCommentAnchorPointForAnalysis(anchor: Pick<Commen
|
|
|
55
42
|
* whether each anchor remains unchanged, gets edited, or is deleted.
|
|
56
43
|
*
|
|
57
44
|
* Classification rules (in order):
|
|
58
|
-
* 1.
|
|
59
|
-
* 2.
|
|
60
|
-
* 3. If
|
|
61
|
-
* 4. If
|
|
62
|
-
* 5. If
|
|
63
|
-
* 6. If
|
|
64
|
-
* 7. If anchor maps through transform → check if position or content changed:
|
|
45
|
+
* 1. Skip deleted or resolved anchors → 'unchanged'
|
|
46
|
+
* 2. If anchor has no old position → 'unchanged'
|
|
47
|
+
* 3. If no changed ranges touch the anchor → 'unchanged'
|
|
48
|
+
* 4. If any changed range fully covers the anchor → 'deleted' (full-span replacement)
|
|
49
|
+
* 5. If combined changed ranges fully cover the anchor → 'deleted' (multi-step removal)
|
|
50
|
+
* 6. If anchor maps through transform → check if position or content changed:
|
|
65
51
|
* a. If both unchanged → 'unchanged'
|
|
66
52
|
* b. Otherwise → 'edited' (return new position and relative anchor)
|
|
67
|
-
*
|
|
53
|
+
* 7. If mapping fails → 'deleted'
|
|
68
54
|
*/
|
|
69
55
|
export declare function analyzeCommentAnchorTransactionChanges(anchors: CommentAnchor[], oldState: EditorState, newState: EditorState, transform: Transform): CommentAnchorTransactionChange[];
|
|
70
56
|
export interface CommentDecorationOptions {
|
|
@@ -77,21 +63,8 @@ export declare const CommentDecorationExtension: Extension<CommentDecorationOpti
|
|
|
77
63
|
* These are consumed by the draft-creation flow and transaction-analysis layer.
|
|
78
64
|
*/
|
|
79
65
|
export declare function createCommentAnchorFromEditor(editor: Editor, from: number, to: number): CommentAnchorRelativeRange | null;
|
|
80
|
-
/**
|
|
81
|
-
* Create a point anchor (anchorFrom === anchorTo) at a single doc position.
|
|
82
|
-
* Used by the suggestion-mode draft flow when the viewer places a cursor
|
|
83
|
-
* without selecting text — createCommentAnchorFromEditor rejects from >= to
|
|
84
|
-
* since an empty range is invalid for regular comments.
|
|
85
|
-
*/
|
|
86
|
-
export declare function createCommentAnchorPointFromEditor(editor: Editor, pos: number): CommentAnchorRelativeRange | null;
|
|
87
66
|
export declare function createCommentAnchorFromSelection(editor: Editor): CommentAnchorRelativeRange | null;
|
|
88
67
|
export declare function triggerDecorationRebuild(editor: Editor): void;
|
|
89
68
|
export declare function getCommentAtPosition(editor: Editor, pos: number, getAnchors: () => CommentAnchor[]): CommentAnchor | null;
|
|
90
69
|
export declare function getCommentAnchorRange(editor: Editor, commentId: string, getAnchors: () => CommentAnchor[]): CommentAnchorRange | null;
|
|
91
|
-
/**
|
|
92
|
-
* Apply the accepted suggestion's change to the document.
|
|
93
|
-
* Called by the store's acceptSuggestion action before resolving on-chain.
|
|
94
|
-
* Returns false if the anchor can't be resolved or the suggestion type is unknown.
|
|
95
|
-
*/
|
|
96
|
-
export declare function applyAcceptedSuggestion(editor: Editor, anchor: CommentAnchor): boolean;
|
|
97
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 {};
|
|
@@ -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 {};
|
|
@@ -46,7 +46,7 @@ export interface CommentStoreProviderProps {
|
|
|
46
46
|
isDDocOwner?: boolean;
|
|
47
47
|
setUsername?: React.Dispatch<React.SetStateAction<string>>;
|
|
48
48
|
}
|
|
49
|
-
export declare const CommentStoreProvider: ({ children, editor, ydoc, isFocusMode, setActiveCommentId, focusCommentWithActiveId, setInitialComments, onNewComment, onEditComment, onEditReply, onCommentReply, onResolveComment, onUnresolveComment, onDeleteComment, onDeleteReply, onInlineComment, onComment, setCommentDrawerOpen, connectViaWallet, connectViaUsername, ensResolutionUrl, commentAnchorsRef,
|
|
49
|
+
export declare const CommentStoreProvider: ({ children, editor, ydoc, isFocusMode, setActiveCommentId, focusCommentWithActiveId, setInitialComments, onNewComment, onEditComment, onEditReply, onCommentReply, onResolveComment, onUnresolveComment, onDeleteComment, onDeleteReply, onInlineComment, onComment, setCommentDrawerOpen, connectViaWallet, connectViaUsername, ensResolutionUrl, commentAnchorsRef, initialCommentAnchors, setUsername: setUsernameProp, initialComments, username, activeCommentId, activeTabId, isConnected, isLoading, isDDocOwner, }: CommentStoreProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
50
50
|
interface CommentRefsContextType {
|
|
51
51
|
commentsSectionRef: React.RefObject<HTMLDivElement>;
|
|
52
52
|
replySectionRef: React.RefObject<HTMLDivElement>;
|
|
@@ -30,38 +30,7 @@ export interface CommentExternalDeps {
|
|
|
30
30
|
ensResolutionUrl: string;
|
|
31
31
|
commentAnchorsRef?: React.MutableRefObject<CommentAnchor[]>;
|
|
32
32
|
refreshCommentAnchorState?: () => void;
|
|
33
|
-
/**
|
|
34
|
-
* Derived anchor list for in-progress suggestion drafts. Maintained by the
|
|
35
|
-
* store (not the consumer) — draft actions upsert into this ref whenever
|
|
36
|
-
* state.drafts changes. The decoration extension reads this ref alongside
|
|
37
|
-
* commentAnchorsRef to render both layers identically.
|
|
38
|
-
*/
|
|
39
|
-
draftAnchorsRef?: React.MutableRefObject<CommentAnchor[]>;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* A suggestion draft is the viewer's in-progress proposed edit — kept local
|
|
43
|
-
* until Submit. Drafts live in memory only (lost on refresh). Derived into
|
|
44
|
-
* a CommentAnchor for decoration rendering via deriveDraftAnchor(). Most
|
|
45
|
-
* suggestion types are derived at use time from hadDeletion + insertedText;
|
|
46
|
-
* linkHref marks a link suggestion over the original selected text.
|
|
47
|
-
*/
|
|
48
|
-
export interface DraftSuggestion {
|
|
49
|
-
id: string;
|
|
50
|
-
anchorFrom: Y.RelativePosition;
|
|
51
|
-
anchorTo: Y.RelativePosition;
|
|
52
|
-
/** The text that was selected at draft creation (for Delete/Replace strikethrough). */
|
|
53
|
-
originalContent: string;
|
|
54
|
-
/** Accumulated text the viewer has typed. Empty for a pure Delete draft. */
|
|
55
|
-
insertedText: string;
|
|
56
|
-
/** Per-keystroke history for undo — each entry is one typed character. */
|
|
57
|
-
keystrokes: string[];
|
|
58
|
-
/** True when the draft was created via select+delete or select+type. */
|
|
59
|
-
hadDeletion: boolean;
|
|
60
|
-
/** Pasted link href for a link suggestion. */
|
|
61
|
-
linkHref?: string;
|
|
62
33
|
}
|
|
63
|
-
type SuggestionDeleteDirection = 'backward' | 'forward';
|
|
64
|
-
export declare function isRangeDraft(draft: DraftSuggestion): boolean;
|
|
65
34
|
type FloatingCardsUpdater = React.SetStateAction<CommentFloatingCard[]>;
|
|
66
35
|
type InlineCommentDataUpdater = Partial<InlineCommentData> | ((prev: InlineCommentData) => Partial<InlineCommentData> | InlineCommentData);
|
|
67
36
|
type InlineDraftRecordMap = Record<string, InlineCommentDraft>;
|
|
@@ -124,8 +93,6 @@ export interface CommentStoreState {
|
|
|
124
93
|
inlineCommentData: InlineCommentData;
|
|
125
94
|
floatingCards: CommentFloatingCard[];
|
|
126
95
|
pendingPrehydrationFloatingThreadIds: string[];
|
|
127
|
-
/** In-progress suggestion drafts — keyed by suggestionId. Viewer-local, lost on refresh. */
|
|
128
|
-
drafts: Record<string, DraftSuggestion>;
|
|
129
96
|
inlineDrafts: InlineDraftRecordMap;
|
|
130
97
|
activeDraftId: string | null;
|
|
131
98
|
isDesktopFloatingEnabled: boolean;
|
|
@@ -189,7 +156,6 @@ export interface CommentStoreState {
|
|
|
189
156
|
cancelFloatingDraft: (draftId: string) => void;
|
|
190
157
|
submitFloatingDraft: (draftId: string) => void;
|
|
191
158
|
openFloatingThread: (commentId: string) => void;
|
|
192
|
-
focusSubmittedSuggestionFromEditor: (commentId: string) => boolean;
|
|
193
159
|
closeFloatingCard: (floatingCardId: string) => void;
|
|
194
160
|
blurFloatingCard: (floatingCardId: string) => void;
|
|
195
161
|
focusFloatingCard: (floatingCardId: string) => void;
|
|
@@ -212,55 +178,6 @@ export interface CommentStoreState {
|
|
|
212
178
|
deleteComment: (commentId: string, options?: {
|
|
213
179
|
skipExternalCallback?: boolean;
|
|
214
180
|
}) => void;
|
|
215
|
-
acceptSuggestion: (commentId: string) => void;
|
|
216
|
-
/**
|
|
217
|
-
* Append typed characters to the draft at the current cursor position.
|
|
218
|
-
* Creates a new Add draft if no draft exists at the cursor.
|
|
219
|
-
*/
|
|
220
|
-
appendToDraftAtCursor: (text: string) => void;
|
|
221
|
-
/**
|
|
222
|
-
* Create a Delete (or pending Replace) draft from a selection range.
|
|
223
|
-
* Captures originalContent, leaves insertedText empty; type becomes 'replace'
|
|
224
|
-
* as soon as the viewer types.
|
|
225
|
-
*/
|
|
226
|
-
startDeleteDraft: (from: number, to: number, collapseTo?: number) => void;
|
|
227
|
-
/**
|
|
228
|
-
* Create a link suggestion from a selected range and pasted href.
|
|
229
|
-
* The document stays unchanged until the owner accepts the suggestion.
|
|
230
|
-
*/
|
|
231
|
-
startLinkDraft: (from: number, to: number, href: string) => void;
|
|
232
|
-
/**
|
|
233
|
-
* Convert a collapsed-caret Backspace/Delete into a delete draft when the
|
|
234
|
-
* caret is adjacent to text, or shrink the active draft if the caret is
|
|
235
|
-
* already inside one.
|
|
236
|
-
*/
|
|
237
|
-
deleteAtCursorOrUndoActiveDraft: (direction: SuggestionDeleteDirection) => void;
|
|
238
|
-
/**
|
|
239
|
-
* Handle browser deletion paths that resolved to a concrete range even
|
|
240
|
-
* though the user had no explicit selection.
|
|
241
|
-
*/
|
|
242
|
-
deleteRangeOrUndoActiveDraft: (from: number, to: number) => void;
|
|
243
|
-
/**
|
|
244
|
-
* Undo the last keystroke in the draft at the current cursor position.
|
|
245
|
-
* When the draft has no keystrokes left, it is discarded.
|
|
246
|
-
* For a pure Delete draft (no keystrokes ever), calling this discards.
|
|
247
|
-
*/
|
|
248
|
-
undoLastKeystrokeInActiveDraft: () => void;
|
|
249
|
-
/** Drop a draft entirely — removes the inline overlay and draft card. */
|
|
250
|
-
discardDraft: (suggestionId: string) => void;
|
|
251
|
-
/**
|
|
252
|
-
* Refresh the `originalContent` (and the suggestion-draft card's selectedText)
|
|
253
|
-
* for a Delete/Replace draft whose anchored range still resolves but now
|
|
254
|
-
* covers different text — happens when the owner edits within the anchored
|
|
255
|
-
* range while the viewer's draft is open.
|
|
256
|
-
*/
|
|
257
|
-
refreshDraftOriginalContent: (suggestionId: string, currentText: string) => void;
|
|
258
|
-
/**
|
|
259
|
-
* Promote a draft to a submitted suggestion. Pushes the anchor into
|
|
260
|
-
* commentAnchorsRef, calls onNewComment, removes the draft, and swaps the
|
|
261
|
-
* suggestion-draft floating card for a thread card (same floatingCardId).
|
|
262
|
-
*/
|
|
263
|
-
submitDraft: (suggestionId: string) => void;
|
|
264
181
|
deleteReply: (commentId: string, replyId: string) => void;
|
|
265
182
|
requestEditComment: (commentId: string) => void;
|
|
266
183
|
requestEditReply: (commentId: string, replyId: string) => void;
|
|
@@ -268,7 +185,6 @@ export interface CommentStoreState {
|
|
|
268
185
|
editReplyContent: (commentId: string, replyId: string, content: string) => void;
|
|
269
186
|
handleAddReply: (activeCommentId: string, replyContent: string, replyCallback?: (activeCommentId: string, reply: IComment) => void) => void;
|
|
270
187
|
focusCommentInEditor: (commentId: string, options?: FocusCommentInEditorOptions) => void;
|
|
271
|
-
focusSuggestionDraftInEditor: (suggestionId: string) => void;
|
|
272
188
|
onPrevComment: () => void;
|
|
273
189
|
onNextComment: () => void;
|
|
274
190
|
getEnsStatus: (walletAddress: string, setEnsStatus: React.Dispatch<React.SetStateAction<EnsStatus>>) => 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' | 'link';
|
|
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;
|
|
@@ -153,7 +145,6 @@ export interface DdocProps extends CommentAccountProps {
|
|
|
153
145
|
editorCanvasClassNames?: string;
|
|
154
146
|
isCommentSectionOpen?: boolean;
|
|
155
147
|
isPreviewMode: boolean;
|
|
156
|
-
viewerMode?: 'suggest' | 'view-only';
|
|
157
148
|
ensResolutionUrl?: string;
|
|
158
149
|
ipfsImageUploadFn?: (file: File) => Promise<IpfsImageUploadResponse>;
|
|
159
150
|
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
|
};
|