@fileverse-dev/ddoc 3.1.7-comment-re-arch-23 → 3.1.7-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 +28765 -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,7 +1,5 @@
|
|
|
1
1
|
import { Editor } from '@tiptap/core';
|
|
2
2
|
|
|
3
|
-
export declare const isSelectionInsideEditor: (editor: Editor) => boolean;
|
|
4
3
|
export declare const shouldShow: ({ editor }: {
|
|
5
4
|
editor: Editor;
|
|
6
5
|
}) => boolean;
|
|
7
|
-
export declare const shouldShowIgnoringFocus: (editor: Editor) => boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { CommentCardProps } from './types';
|
|
2
2
|
|
|
3
|
-
export declare const CommentCard: (
|
|
3
|
+
export declare const CommentCard: ({ username, selectedContent, comment, createdAt, replies, onResolve, onDelete, onUnresolve, isResolved, isDropdown, activeCommentId, id, isDisabled, isCommentOwner, version, emptyComment, }: CommentCardProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
export declare const UserDisplaySkeleton: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { CommentDrawerProps } from './types';
|
|
2
2
|
|
|
3
|
-
export declare const CommentDrawer: ({ isOpen, onClose, isNavbarVisible, isPresentationMode, activeCommentId,
|
|
3
|
+
export declare const CommentDrawer: ({ isOpen, onClose, isNavbarVisible, isPresentationMode, activeCommentId, isPreviewMode, }: CommentDrawerProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { CommentDropdownProps } from './types';
|
|
2
2
|
|
|
3
|
-
export declare const CommentDropdown: ({ activeCommentId, isBubbleMenu, isDisabled, isCommentOwner, }: CommentDropdownProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
3
|
+
export declare const CommentDropdown: ({ activeCommentId, initialComment, isBubbleMenu, selectedContent, isDisabled, isCommentOwner, }: CommentDropdownProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { CommentSectionProps } from './types';
|
|
2
2
|
|
|
3
|
-
export declare const CommentSection: ({ activeCommentId, isNavbarVisible, isPresentationMode,
|
|
3
|
+
export declare const CommentSection: ({ activeCommentId, isNavbarVisible, isPresentationMode, }: CommentSectionProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { CommentUsernameProps } from './context/types';
|
|
2
2
|
|
|
3
|
-
declare const CommentUsername: ({ username, setUsername, isConnected, connectViaUsername, connectViaWallet, isLoading, }: CommentUsernameProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
declare const CommentUsername: ({ username, setUsername, isNavbarVisible, isConnected, connectViaUsername, connectViaWallet, isLoading, }: CommentUsernameProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
export { CommentUsername };
|
|
@@ -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,57 +1,100 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Editor } from '@tiptap/react';
|
|
2
2
|
import { IComment } from '../../../extensions/comment';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { SetStateAction } from 'react';
|
|
4
|
+
import { CommentAccountProps, CommentMutationMeta } from '../../../types';
|
|
5
|
+
import { EnsStatus } from '../types';
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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;
|
|
16
41
|
selectedText: string;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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;
|
|
24
68
|
}
|
|
25
|
-
export interface
|
|
26
|
-
|
|
27
|
-
|
|
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>>;
|
|
28
90
|
}
|
|
29
|
-
export
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
handleClick: boolean;
|
|
91
|
+
export interface CommentUsernameProps extends CommentAccountProps {
|
|
92
|
+
username?: string | null;
|
|
93
|
+
setUsername?: React.Dispatch<SetStateAction<string>>;
|
|
94
|
+
isNavbarVisible?: boolean;
|
|
34
95
|
}
|
|
35
96
|
export interface EnsEntry {
|
|
36
97
|
name: string;
|
|
37
98
|
isEns: boolean;
|
|
38
99
|
}
|
|
39
100
|
export type EnsCache = Record<string, EnsEntry>;
|
|
40
|
-
export type CommentProviderProps = CommentStoreProviderProps;
|
|
41
|
-
export type CommentContextType = Pick<CommentStoreState, 'activeComment' | 'activeCommentIndex' | 'activeComments' | 'activeTabId' | 'addComment' | 'blurFloatingCard' | 'cancelFloatingDraft' | 'closeFloatingCard' | 'comment' | 'connectViaUsername' | 'connectViaWallet' | 'createFloatingDraft' | 'deleteComment' | 'deleteReply' | 'ensCache' | 'floatingCards' | 'focusCommentInEditor' | 'focusFloatingCard' | 'getEnsStatus' | 'handleAddReply' | 'handleCommentChange' | 'handleCommentKeyDown' | 'handleCommentSubmit' | 'handleInlineComment' | 'handleInput' | 'handleReplyChange' | 'handleReplyKeyDown' | 'handleReplySubmit' | 'inlineCommentData' | 'isBubbleMenuSuppressed' | 'isCommentActive' | 'isCommentOpen' | 'isCommentResolved' | 'isConnected' | 'isDDocOwner' | 'isDesktopFloatingEnabled' | 'isLoading' | 'onComment' | 'onNextComment' | 'onPrevComment' | 'openFloatingThread' | 'openReplyId' | 'reply' | 'resolveComment' | 'setComment' | 'setCommentDrawerOpen' | 'setInlineCommentData' | 'setIsBubbleMenuSuppressed' | 'setOpenReplyId' | 'setReply' | 'setShowResolved' | 'setUsername' | 'selectedText' | 'showResolved' | 'submitFloatingDraft' | 'toggleResolved' | 'unresolveComment' | 'updateFloatingDraftText' | 'username'> & {
|
|
42
|
-
comments: IComment[];
|
|
43
|
-
commentsSectionRef: RefObject<HTMLDivElement>;
|
|
44
|
-
dropdownRef: RefObject<HTMLDivElement>;
|
|
45
|
-
buttonRef: RefObject<HTMLDivElement>;
|
|
46
|
-
portalRef: RefObject<HTMLDivElement>;
|
|
47
|
-
replySectionRef: RefObject<HTMLDivElement>;
|
|
48
|
-
editor: CommentStoreProviderProps['editor'];
|
|
49
|
-
ensResolutionUrl: string;
|
|
50
|
-
onCommentReply?: CommentStoreProviderProps['onCommentReply'];
|
|
51
|
-
setComments?: Dispatch<SetStateAction<IComment[]>>;
|
|
52
|
-
};
|
|
53
|
-
export interface CommentUsernameProps extends CommentAccountProps {
|
|
54
|
-
username?: string | null;
|
|
55
|
-
setUsername?: Dispatch<SetStateAction<string>>;
|
|
56
|
-
isNavbarVisible?: boolean;
|
|
57
|
-
}
|
|
@@ -2,7 +2,6 @@ import { BubbleMenuProps } from '@tiptap/react/menus';
|
|
|
2
2
|
import { Editor } from '@tiptap/react';
|
|
3
3
|
import { IComment } from '../../extensions/comment';
|
|
4
4
|
import { SetStateAction } from 'react';
|
|
5
|
-
import { Tab } from '../tabs/utils/tab-utils';
|
|
6
5
|
|
|
7
6
|
export interface UseCommentActionsProps {
|
|
8
7
|
editor: Editor;
|
|
@@ -32,19 +31,13 @@ export interface CommentDrawerProps {
|
|
|
32
31
|
isNavbarVisible: boolean;
|
|
33
32
|
isPresentationMode: boolean;
|
|
34
33
|
activeCommentId: string | null;
|
|
35
|
-
activeTabId: string;
|
|
36
|
-
onTabChange?: (tabId: string) => void;
|
|
37
34
|
isPreviewMode: boolean;
|
|
38
|
-
tabs: Tab[];
|
|
39
|
-
isCollaborationEnabled: boolean;
|
|
40
35
|
}
|
|
41
36
|
export interface CommentCardProps extends IComment {
|
|
42
37
|
comment?: string;
|
|
43
38
|
onResolve?: (commentId: string) => void;
|
|
44
39
|
onDelete?: (commentId: string) => void;
|
|
45
|
-
onRequestDelete?: (commentId: string) => void;
|
|
46
40
|
onUnresolve?: (commentId: string) => void;
|
|
47
|
-
onFocusRequest?: () => void;
|
|
48
41
|
isResolved?: boolean;
|
|
49
42
|
isDropdown?: boolean;
|
|
50
43
|
activeCommentId?: string;
|
|
@@ -52,21 +45,15 @@ export interface CommentCardProps extends IComment {
|
|
|
52
45
|
isCommentOwner?: boolean;
|
|
53
46
|
version?: string;
|
|
54
47
|
emptyComment?: boolean;
|
|
55
|
-
isFocused?: boolean;
|
|
56
|
-
isCommentDrawerContext?: boolean;
|
|
57
48
|
}
|
|
58
49
|
export type CommentBubbleMenuProps = Omit<BubbleMenuProps, 'children'> & {
|
|
59
50
|
zoomLevel: string;
|
|
60
51
|
};
|
|
61
52
|
export interface CommentReplyProps {
|
|
62
|
-
commentId: string;
|
|
63
|
-
replyId: string;
|
|
64
53
|
reply: string;
|
|
65
54
|
username: string;
|
|
66
55
|
createdAt: Date;
|
|
67
56
|
isLast: boolean;
|
|
68
|
-
isThreadResolved?: boolean;
|
|
69
|
-
isCommentDrawerContext?: boolean;
|
|
70
57
|
}
|
|
71
58
|
export interface EnsStatus {
|
|
72
59
|
name: string;
|
|
@@ -76,17 +63,6 @@ export interface CommentSectionProps {
|
|
|
76
63
|
activeCommentId: string | null;
|
|
77
64
|
isNavbarVisible?: boolean;
|
|
78
65
|
isPresentationMode?: boolean;
|
|
79
|
-
isMobile?: boolean;
|
|
80
|
-
comments?: IComment[];
|
|
81
|
-
commentType?: 'all' | 'active' | 'resolved';
|
|
82
|
-
sectionLabel?: string;
|
|
83
|
-
tabNameById?: Record<string, string>;
|
|
84
|
-
selectedTabLabel?: string;
|
|
85
|
-
newCommentTabId?: string;
|
|
86
|
-
showNewCommentInput?: boolean;
|
|
87
|
-
onCommentFocus?: (commentId: string, tabId?: string) => void;
|
|
88
|
-
onReset?: () => void;
|
|
89
|
-
isCollaborationEnabled: boolean;
|
|
90
66
|
}
|
|
91
67
|
export interface UserDisplayProps {
|
|
92
68
|
username: string;
|
|
@@ -31,10 +31,9 @@ export interface DocumentTabsSidebarProps {
|
|
|
31
31
|
tabConfig?: DocumentOutlineProps['tabConfig'];
|
|
32
32
|
deleteTab?: (tabId: string) => void;
|
|
33
33
|
isConnected?: boolean;
|
|
34
|
-
isFocusMode?: boolean;
|
|
35
34
|
}
|
|
36
35
|
export declare const DocumentTabsSidebar: ({ tabSectionContainer, ...rest }: DocumentTabsSidebarProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
37
|
-
export declare const TabSidebar: ({ tabs, activeTabId, setActiveTabId, showTOC, setShowTOC, hasToC, isPreviewMode, editor, items, setItems, orientation, createTab, renameTab, duplicateTab, orderTab, tabCommentCounts, isVersionHistoryMode, tabConfig, deleteTab, isConnected,
|
|
36
|
+
export declare const TabSidebar: ({ tabs, activeTabId, setActiveTabId, showTOC, setShowTOC, hasToC, isPreviewMode, editor, items, setItems, orientation, createTab, renameTab, duplicateTab, orderTab, tabCommentCounts, isVersionHistoryMode, tabConfig, deleteTab, isConnected, }: DocumentTabsSidebarProps) => import("react/jsx-runtime").JSX.Element;
|
|
38
37
|
export declare const DdocTab: ({ tab, tabIndex, tabCount, handleEmojiChange, handleNameChange, onClick, editor, tocItem, setTocItems, orientation, activeTabId, duplicateTab, commentCount, moveTabUp, moveTabDown, isPreviewMode, isVersionHistoryMode, tabConfig, onDelete, showOutline, onShowOutlineChange, isConnected, }: {
|
|
39
38
|
tab: Tab;
|
|
40
39
|
tabIndex: number;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { Mark, Range } from '@tiptap/core';
|
|
2
2
|
import { Mark as PMMark } from '@tiptap/pm/model';
|
|
3
|
-
import { PluginKey, EditorState } from '@tiptap/pm/state';
|
|
4
|
-
import { DecorationSet } from '@tiptap/pm/view';
|
|
5
3
|
|
|
6
4
|
declare module '@tiptap/core' {
|
|
7
5
|
interface Commands<ReturnType> {
|
|
@@ -30,18 +28,6 @@ declare module '@tiptap/core' {
|
|
|
30
28
|
* Unset comment active
|
|
31
29
|
*/
|
|
32
30
|
unsetCommentActive: () => ReturnType;
|
|
33
|
-
/**
|
|
34
|
-
* Add a local draft anchor that tracks through transactions.
|
|
35
|
-
*/
|
|
36
|
-
setDraftComment: (draftId: string) => ReturnType;
|
|
37
|
-
/**
|
|
38
|
-
* Remove a local draft anchor.
|
|
39
|
-
*/
|
|
40
|
-
unsetDraftComment: (draftId: string) => ReturnType;
|
|
41
|
-
/**
|
|
42
|
-
* Replace a draft anchor with a persisted comment mark.
|
|
43
|
-
*/
|
|
44
|
-
promoteDraftComment: (draftId: string, commentId: string) => ReturnType;
|
|
45
31
|
};
|
|
46
32
|
}
|
|
47
33
|
}
|
|
@@ -49,10 +35,6 @@ export interface MarkWithRange {
|
|
|
49
35
|
mark: PMMark;
|
|
50
36
|
range: Range;
|
|
51
37
|
}
|
|
52
|
-
export interface CommentMarkMatch {
|
|
53
|
-
commentId: string;
|
|
54
|
-
resolved: boolean;
|
|
55
|
-
}
|
|
56
38
|
export interface CommentOptions {
|
|
57
39
|
HTMLAttributes: Record<string, any>;
|
|
58
40
|
onCommentActivated: (commentId: string) => void;
|
|
@@ -63,20 +45,6 @@ export interface CommentOptions {
|
|
|
63
45
|
export interface CommentStorage {
|
|
64
46
|
activeCommentId: string | null;
|
|
65
47
|
}
|
|
66
|
-
export interface DraftCommentRange {
|
|
67
|
-
draftId: string;
|
|
68
|
-
from: number;
|
|
69
|
-
to: number;
|
|
70
|
-
}
|
|
71
|
-
interface DraftCommentPluginState {
|
|
72
|
-
decorations: DecorationSet;
|
|
73
|
-
drafts: Map<string, DraftCommentRange>;
|
|
74
|
-
}
|
|
75
|
-
export declare const draftCommentPluginKey: PluginKey<DraftCommentPluginState>;
|
|
76
|
-
export declare const getDraftCommentState: (state: EditorState) => DraftCommentPluginState | undefined;
|
|
77
|
-
export declare const getDraftCommentRange: (state: EditorState, draftId: string) => DraftCommentRange | null;
|
|
78
|
-
export declare const getCommentMarkAtPosition: (state: EditorState, pos: number) => CommentMarkMatch | null;
|
|
79
|
-
export declare const getCommentMarkRange: (state: EditorState, commentId: string) => Range | null;
|
|
80
48
|
export interface IComment {
|
|
81
49
|
id?: string;
|
|
82
50
|
tabId?: string;
|
|
@@ -95,4 +63,3 @@ export interface IComment {
|
|
|
95
63
|
version?: string;
|
|
96
64
|
}
|
|
97
65
|
export declare const CommentExtension: Mark<CommentOptions, CommentStorage>;
|
|
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;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Dispatch, MutableRefObject, SetStateAction } from 'react';
|
|
2
|
-
import { DdocProps,
|
|
2
|
+
import { DdocProps, ThemeKey } from '../types';
|
|
3
3
|
import { AnyExtension, Editor } from '@tiptap/react';
|
|
4
|
-
import { CommentAnchor } from '../extensions/comment/comment-decoration-plugin';
|
|
5
4
|
import { ToCItemType } from '../components/toc/types';
|
|
6
5
|
import { CollabConnectionConfig, CollaborationProps } from '../sync-local/types';
|
|
7
6
|
|
|
@@ -18,7 +17,6 @@ interface UseTabEditorArgs {
|
|
|
18
17
|
isSyncing?: boolean;
|
|
19
18
|
awareness?: any;
|
|
20
19
|
disableInlineComment?: boolean;
|
|
21
|
-
isFocusMode?: boolean;
|
|
22
20
|
onCommentInteraction?: DdocProps['onCommentInteraction'];
|
|
23
21
|
onError?: DdocProps['onError'];
|
|
24
22
|
ipfsImageUploadFn?: DdocProps['ipfsImageUploadFn'];
|
|
@@ -49,9 +47,8 @@ interface UseTabEditorArgs {
|
|
|
49
47
|
activeTabId: string;
|
|
50
48
|
theme?: ThemeKey;
|
|
51
49
|
editorRef?: MutableRefObject<Editor | null>;
|
|
52
|
-
initialCommentAnchors?: SerializedCommentAnchor[];
|
|
53
50
|
}
|
|
54
|
-
export declare const useTabEditor: ({ ydoc, isVersionMode, hasTabState, versionId, isPreviewMode, initialContent, collaboration, isReady, isSyncing, awareness, disableInlineComment,
|
|
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) => {
|
|
55
52
|
editor: Editor | null;
|
|
56
53
|
ref: import('react').RefObject<HTMLDivElement>;
|
|
57
54
|
slides: string[];
|
|
@@ -62,6 +59,5 @@ export declare const useTabEditor: ({ ydoc, isVersionMode, hasTabState, versionI
|
|
|
62
59
|
setActiveCommentId: Dispatch<SetStateAction<string | null>>;
|
|
63
60
|
focusCommentWithActiveId: (id: string) => void;
|
|
64
61
|
isContentLoading: boolean | undefined;
|
|
65
|
-
commentAnchorsRef: MutableRefObject<CommentAnchor[]>;
|
|
66
62
|
};
|
|
67
63
|
export {};
|
package/dist/package/types.d.ts
CHANGED
|
@@ -19,21 +19,10 @@ export type InlineCommentData = {
|
|
|
19
19
|
highlightedTextContent: string;
|
|
20
20
|
handleClick: boolean;
|
|
21
21
|
};
|
|
22
|
-
export type CommentMutationType = 'create' | '
|
|
22
|
+
export type CommentMutationType = 'create' | 'resolve' | 'unresolve' | 'delete';
|
|
23
23
|
export interface CommentMutationMeta {
|
|
24
24
|
type: CommentMutationType;
|
|
25
|
-
updateChunk
|
|
26
|
-
anchorFrom?: string;
|
|
27
|
-
anchorTo?: string;
|
|
28
|
-
selectedContent?: string;
|
|
29
|
-
content?: string;
|
|
30
|
-
}
|
|
31
|
-
export interface SerializedCommentAnchor {
|
|
32
|
-
id: string;
|
|
33
|
-
anchorFrom: string;
|
|
34
|
-
anchorTo: string;
|
|
35
|
-
resolved: boolean;
|
|
36
|
-
deleted: boolean;
|
|
25
|
+
updateChunk: string;
|
|
37
26
|
}
|
|
38
27
|
export interface CommentAccountProps {
|
|
39
28
|
isConnected?: boolean;
|
|
@@ -118,12 +107,9 @@ export interface DdocProps extends CommentAccountProps {
|
|
|
118
107
|
commentDrawerOpen?: boolean;
|
|
119
108
|
setCommentDrawerOpen?: React.Dispatch<SetStateAction<boolean>>;
|
|
120
109
|
initialComments?: IComment[];
|
|
121
|
-
initialCommentAnchors?: SerializedCommentAnchor[];
|
|
122
110
|
setInitialComments?: React.Dispatch<SetStateAction<IComment[]>>;
|
|
123
111
|
onCommentReply?: (activeCommentId: string, reply: IComment) => void;
|
|
124
112
|
onNewComment?: (newComment: IComment, meta?: CommentMutationMeta) => void;
|
|
125
|
-
onEditComment?: (activeCommentId: string, meta?: CommentMutationMeta) => void;
|
|
126
|
-
onEditReply?: (activeCommentId: string, replyId: string, meta?: CommentMutationMeta) => void;
|
|
127
113
|
onResolveComment?: (activeCommentId: string, meta?: CommentMutationMeta) => void;
|
|
128
114
|
onUnresolveComment?: (activeCommentId: string, meta?: CommentMutationMeta) => void;
|
|
129
115
|
onDeleteComment?: (activeCommentId: string, meta?: CommentMutationMeta) => void;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { DdocProps } from './types';
|
|
2
2
|
import { Editor } from '@tiptap/react';
|
|
3
3
|
|
|
4
|
-
export declare const useDdocEditor: ({ isPreviewMode, initialContent, versionHistoryState, collaboration, onChange, onCollaboratorChange, onCommentInteraction, onError, setCharacterCount, setWordCount, setPageCount, ipfsImageUploadFn, ddocId, enableIndexeddbSync, unFocused,
|
|
5
|
-
isFocusMode?: boolean;
|
|
6
|
-
}) => {
|
|
4
|
+
export declare const useDdocEditor: ({ isPreviewMode, initialContent, versionHistoryState, collaboration, onChange, onCollaboratorChange, onCommentInteraction, onError, setCharacterCount, setWordCount, setPageCount, ipfsImageUploadFn, ddocId, enableIndexeddbSync, unFocused, theme, zoomLevel, onInvalidContentError, ignoreCorruptedData, isPresentationMode, metadataProxyUrl, extensions: externalExtensions, onCopyHeadingLink, ipfsImageFetchFn, fetchV1ImageFn, isConnected, activeModel, maxTokens, isAIAgentEnabled, onIndexedDbError, disableInlineComment, ...rest }: Partial<DdocProps>) => {
|
|
7
5
|
ydoc: import('yjs').Doc;
|
|
8
6
|
awareness: import('y-protocols/awareness.js').Awareness | null;
|
|
9
7
|
refreshYjsIndexedDbProvider: () => Promise<void>;
|
|
@@ -40,5 +38,4 @@ export declare const useDdocEditor: ({ isPreviewMode, initialContent, versionHis
|
|
|
40
38
|
activeCommentId: string | null;
|
|
41
39
|
setActiveCommentId: import('react').Dispatch<import('react').SetStateAction<string | null>>;
|
|
42
40
|
focusCommentWithActiveId: (id: string) => void;
|
|
43
|
-
commentAnchorsRef: import('react').MutableRefObject<import('./extensions/comment/comment-decoration-plugin').CommentAnchor[]>;
|
|
44
41
|
};
|