@fileverse-dev/ddoc 2.1.1-patch-8 → 2.1.1-v2-patch-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.es.js +27737 -26442
- package/dist/package/components/editor-bubble-menu/editor-bubble-menu.d.ts +3 -0
- package/dist/package/components/editor-bubble-menu/node-selector.d.ts +3 -0
- package/dist/package/components/editor-bubble-menu/props.d.ts +59 -0
- package/dist/package/components/{editor-bubble-menu.d.ts → editor-bubble-menu/types.d.ts} +10 -5
- package/dist/package/components/inline-comment/comment-bubble-card.d.ts +6 -0
- package/dist/package/components/inline-comment/comment-bubble-menu.d.ts +3 -0
- package/dist/package/components/inline-comment/comment-card.d.ts +3 -0
- package/dist/package/components/inline-comment/comment-drawer.d.ts +3 -0
- package/dist/package/components/inline-comment/comment-dropdown.d.ts +3 -0
- package/dist/package/components/inline-comment/comment-section.d.ts +3 -0
- package/dist/package/components/inline-comment/context/comment-context.d.ts +4 -0
- package/dist/package/components/inline-comment/context/types.d.ts +61 -0
- package/dist/package/components/inline-comment/types.d.ts +51 -0
- package/dist/package/components/inline-comment/use-comment-actions.d.ts +7 -0
- package/dist/package/components/presentation-mode/presentation-mode.d.ts +1 -1
- package/dist/package/extensions/comment/comment.d.ts +48 -0
- package/dist/package/extensions/comment/index.d.ts +2 -0
- package/dist/package/types.d.ts +10 -4
- package/dist/package/use-ddoc-editor.d.ts +3 -0
- package/dist/package/utils/responsive.d.ts +7 -0
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/dist/package/components/node-selector.d.ts +0 -9
@@ -0,0 +1,59 @@
|
|
1
|
+
import { Editor } from '@tiptap/core';
|
2
|
+
import { EditorBubbleMenuProps } from './types';
|
3
|
+
|
4
|
+
export declare const bubbleMenuProps: (props: EditorBubbleMenuProps) => {
|
5
|
+
tippyOptions: {
|
6
|
+
moveTransition: string;
|
7
|
+
duration: number;
|
8
|
+
animation: string;
|
9
|
+
zIndex: number;
|
10
|
+
appendTo: () => HTMLElement | null;
|
11
|
+
popperOptions: {
|
12
|
+
modifiers: ({
|
13
|
+
name: string;
|
14
|
+
options: {
|
15
|
+
gpuAcceleration: boolean;
|
16
|
+
adaptive: boolean;
|
17
|
+
boundary?: undefined;
|
18
|
+
padding?: undefined;
|
19
|
+
altAxis?: undefined;
|
20
|
+
};
|
21
|
+
} | {
|
22
|
+
name: string;
|
23
|
+
options: {
|
24
|
+
boundary: string;
|
25
|
+
padding: number;
|
26
|
+
altAxis: boolean;
|
27
|
+
gpuAcceleration?: undefined;
|
28
|
+
adaptive?: undefined;
|
29
|
+
};
|
30
|
+
})[];
|
31
|
+
};
|
32
|
+
};
|
33
|
+
editor: import('@tiptap/extension-bubble-menu').BubbleMenuPluginProps["editor"] | null;
|
34
|
+
pluginKey?: string | import('prosemirror-state').PluginKey<any> | undefined;
|
35
|
+
updateDelay?: number | undefined;
|
36
|
+
shouldShow?: (((props: {
|
37
|
+
editor: Editor;
|
38
|
+
view: import('prosemirror-view').EditorView;
|
39
|
+
state: import('prosemirror-state').EditorState;
|
40
|
+
oldState?: import('prosemirror-state').EditorState;
|
41
|
+
from: number;
|
42
|
+
to: number;
|
43
|
+
}) => boolean) | null) | undefined;
|
44
|
+
className?: string | undefined;
|
45
|
+
activeCommentId: string | null;
|
46
|
+
isPreviewMode: boolean;
|
47
|
+
onError?: (errorString: string) => void;
|
48
|
+
zoomLevel: string;
|
49
|
+
setIsCommentSectionOpen?: (isOpen: boolean) => void;
|
50
|
+
inlineCommentData?: import('../../types').InlineCommentData;
|
51
|
+
setInlineCommentData?: React.Dispatch<React.SetStateAction<import('../../types').InlineCommentData>>;
|
52
|
+
walletAddress?: string;
|
53
|
+
username?: string;
|
54
|
+
onInlineComment?: () => void;
|
55
|
+
setCommentDrawerOpen?: React.Dispatch<import('react').SetStateAction<boolean>>;
|
56
|
+
};
|
57
|
+
export declare const shouldShow: ({ editor }: {
|
58
|
+
editor: Editor;
|
59
|
+
}) => boolean;
|
@@ -1,5 +1,6 @@
|
|
1
|
-
import { BubbleMenuProps } from '@tiptap/react';
|
2
|
-
import {
|
1
|
+
import { BubbleMenuProps, Editor } from '@tiptap/react';
|
2
|
+
import { SetStateAction } from 'react';
|
3
|
+
import { InlineCommentData } from '../../types';
|
3
4
|
|
4
5
|
export interface BubbleMenuItem {
|
5
6
|
name: string;
|
@@ -7,7 +8,8 @@ export interface BubbleMenuItem {
|
|
7
8
|
command: () => void;
|
8
9
|
icon: any;
|
9
10
|
}
|
10
|
-
type EditorBubbleMenuProps = Omit<BubbleMenuProps, 'children'> & {
|
11
|
+
export type EditorBubbleMenuProps = Omit<BubbleMenuProps, 'children'> & {
|
12
|
+
activeCommentId: string | null;
|
11
13
|
isPreviewMode: boolean;
|
12
14
|
onError?: (errorString: string) => void;
|
13
15
|
zoomLevel: string;
|
@@ -17,6 +19,9 @@ type EditorBubbleMenuProps = Omit<BubbleMenuProps, 'children'> & {
|
|
17
19
|
walletAddress?: string;
|
18
20
|
username?: string;
|
19
21
|
onInlineComment?: () => void;
|
22
|
+
setCommentDrawerOpen?: React.Dispatch<SetStateAction<boolean>>;
|
20
23
|
};
|
21
|
-
export
|
22
|
-
|
24
|
+
export interface NodeSelectorProps {
|
25
|
+
editor: Editor;
|
26
|
+
elementRef: React.RefObject<HTMLDivElement>;
|
27
|
+
}
|
@@ -0,0 +1,3 @@
|
|
1
|
+
import { CommentCardProps } from './types';
|
2
|
+
|
3
|
+
export declare const CommentCard: ({ username, walletAddress, selectedText, comment, timestamp, replies, onResolve, onDelete, onUnresolve, isResolved, isDropdown, activeCommentId, id, }: CommentCardProps) => import("react/jsx-runtime").JSX.Element;
|
@@ -0,0 +1,4 @@
|
|
1
|
+
import { CommentContextType, CommentProviderProps } from './types';
|
2
|
+
|
3
|
+
export declare const CommentProvider: ({ children, editor, initialComments, setInitialComments, username, walletAddress, activeCommentId, setActiveCommentId, focusCommentWithActiveId, onNewComment, onCommentReply, }: CommentProviderProps) => import("react/jsx-runtime").JSX.Element;
|
4
|
+
export declare const useComments: () => CommentContextType;
|
@@ -0,0 +1,61 @@
|
|
1
|
+
import { Editor } from '@tiptap/react';
|
2
|
+
import { IComment } from '../../../extensions/comment';
|
3
|
+
import { SetStateAction } from 'react';
|
4
|
+
|
5
|
+
export interface CommentContextType {
|
6
|
+
comments: IComment[];
|
7
|
+
setComments: React.Dispatch<SetStateAction<IComment[]>>;
|
8
|
+
editor: Editor;
|
9
|
+
username?: string;
|
10
|
+
walletAddress?: string;
|
11
|
+
showResolved: boolean;
|
12
|
+
setShowResolved: (show: boolean) => void;
|
13
|
+
resolveComment: (commentId: string) => void;
|
14
|
+
unresolveComment: (commentId: string) => void;
|
15
|
+
deleteComment: (commentId: string) => void;
|
16
|
+
handleAddReply: (activeCommentId: string, replyContent: string, onCommentReply: (activeCommentId: string, reply: IComment) => void) => void;
|
17
|
+
focusCommentInEditor: (commentId: string) => void;
|
18
|
+
handleReplyChange: (event: React.ChangeEvent<HTMLTextAreaElement>) => void;
|
19
|
+
handleCommentChange: (event: React.ChangeEvent<HTMLTextAreaElement>) => void;
|
20
|
+
handleCommentKeyDown: (event: React.KeyboardEvent<HTMLTextAreaElement>) => void;
|
21
|
+
handleReplySubmit: () => void;
|
22
|
+
toggleResolved: () => void;
|
23
|
+
openReplyId: string | null;
|
24
|
+
setOpenReplyId: (id: string | null) => void;
|
25
|
+
handleReplyKeyDown: (event: React.KeyboardEvent<HTMLTextAreaElement>) => void;
|
26
|
+
commentsSectionRef: React.RefObject<HTMLDivElement>;
|
27
|
+
replySectionRef: React.RefObject<HTMLDivElement>;
|
28
|
+
addComment: (content?: string) => void;
|
29
|
+
handleCommentSubmit: () => void;
|
30
|
+
reply: string;
|
31
|
+
setReply: React.Dispatch<React.SetStateAction<string>>;
|
32
|
+
comment: string;
|
33
|
+
setComment: React.Dispatch<React.SetStateAction<string>>;
|
34
|
+
onPrevComment: () => void;
|
35
|
+
onNextComment: () => void;
|
36
|
+
activeCommentIndex: number;
|
37
|
+
activeComment: IComment | undefined;
|
38
|
+
selectedText: string;
|
39
|
+
isCommentOpen: boolean;
|
40
|
+
onInlineCommentClick: (event: React.MouseEvent) => void;
|
41
|
+
handleInlineComment: () => void;
|
42
|
+
portalRef: React.RefObject<HTMLDivElement>;
|
43
|
+
buttonRef: React.RefObject<HTMLDivElement>;
|
44
|
+
dropdownRef: React.RefObject<HTMLDivElement>;
|
45
|
+
activeComments: IComment[];
|
46
|
+
handleInput: (e: React.FormEvent<HTMLTextAreaElement>, content: string) => void;
|
47
|
+
isCommentActive: boolean;
|
48
|
+
}
|
49
|
+
export interface CommentProviderProps {
|
50
|
+
children: React.ReactNode;
|
51
|
+
editor: Editor;
|
52
|
+
initialComments?: IComment[];
|
53
|
+
setInitialComments?: React.Dispatch<SetStateAction<IComment[]>>;
|
54
|
+
onCommentReply?: (activeCommentId: string, reply: IComment) => void;
|
55
|
+
onNewComment?: (newComment: IComment) => void;
|
56
|
+
username: string;
|
57
|
+
walletAddress: string;
|
58
|
+
activeCommentId: string | null;
|
59
|
+
setActiveCommentId: React.Dispatch<React.SetStateAction<string | null>>;
|
60
|
+
focusCommentWithActiveId: (id: string) => void;
|
61
|
+
}
|
@@ -0,0 +1,51 @@
|
|
1
|
+
import { BubbleMenuProps, Editor } from '@tiptap/react';
|
2
|
+
import { IComment } from '../../extensions/comment';
|
3
|
+
import { SetStateAction } from 'react';
|
4
|
+
|
5
|
+
export interface UseCommentActionsProps {
|
6
|
+
editor: Editor;
|
7
|
+
comments: IComment[];
|
8
|
+
setComments: (comments: IComment[]) => void;
|
9
|
+
}
|
10
|
+
export interface CommentDropdownProps {
|
11
|
+
editor: Editor;
|
12
|
+
onSubmit: (content: string) => string;
|
13
|
+
onClose: () => void;
|
14
|
+
setComments?: (comments: IComment[]) => void;
|
15
|
+
comments?: IComment[];
|
16
|
+
username?: string;
|
17
|
+
walletAddress?: string;
|
18
|
+
activeCommentId?: string;
|
19
|
+
commentDrawerOpen?: boolean;
|
20
|
+
setCommentDrawerOpen?: React.Dispatch<SetStateAction<boolean>>;
|
21
|
+
initialComment?: string;
|
22
|
+
isBubbleMenu?: boolean;
|
23
|
+
selectedContent?: string;
|
24
|
+
}
|
25
|
+
export interface CommentDrawerProps {
|
26
|
+
isOpen: boolean;
|
27
|
+
onClose: () => void;
|
28
|
+
isNavbarVisible: boolean;
|
29
|
+
isPresentationMode: boolean;
|
30
|
+
activeCommentId: string | null;
|
31
|
+
}
|
32
|
+
export interface CommentCardProps {
|
33
|
+
username?: string;
|
34
|
+
walletAddress?: string;
|
35
|
+
selectedText: string;
|
36
|
+
comment?: string;
|
37
|
+
timestamp?: Date;
|
38
|
+
replies?: {
|
39
|
+
content: string;
|
40
|
+
}[];
|
41
|
+
onResolve?: () => void;
|
42
|
+
onDelete?: () => void;
|
43
|
+
onUnresolve?: () => void;
|
44
|
+
isResolved?: boolean;
|
45
|
+
isDropdown?: boolean;
|
46
|
+
activeCommentId?: string;
|
47
|
+
id?: string;
|
48
|
+
}
|
49
|
+
export type CommentBubbleMenuProps = Omit<BubbleMenuProps, 'children'> & {
|
50
|
+
zoomLevel: string;
|
51
|
+
};
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import { UseCommentActionsProps } from './types';
|
2
|
+
|
3
|
+
export declare const useCommentActions: ({ editor, comments, setComments, }: UseCommentActionsProps) => {
|
4
|
+
handleResolveComment: (commentId: string) => void;
|
5
|
+
handleUnresolveComment: (commentId: string) => void;
|
6
|
+
handleDeleteComment: (commentId: string) => void;
|
7
|
+
};
|
@@ -4,7 +4,7 @@ interface PresentationModeProps {
|
|
4
4
|
editor: Editor;
|
5
5
|
onClose: () => void;
|
6
6
|
isFullscreen: boolean;
|
7
|
-
setIsFullscreen:
|
7
|
+
setIsFullscreen: React.Dispatch<React.SetStateAction<boolean>>;
|
8
8
|
onError?: (error: string) => void;
|
9
9
|
setIsCommentSectionOpen: React.Dispatch<React.SetStateAction<boolean>> | undefined;
|
10
10
|
sharedSlidesLink?: string;
|
@@ -0,0 +1,48 @@
|
|
1
|
+
import { Mark, Range } from '@tiptap/core';
|
2
|
+
import { Mark as PMMark } from '@tiptap/pm/model';
|
3
|
+
|
4
|
+
declare module '@tiptap/core' {
|
5
|
+
interface Commands<ReturnType> {
|
6
|
+
comment: {
|
7
|
+
/**
|
8
|
+
* Set a comment (add)
|
9
|
+
*/
|
10
|
+
setComment: (commentId: string) => ReturnType;
|
11
|
+
/**
|
12
|
+
* Unset a comment (remove completely)
|
13
|
+
*/
|
14
|
+
unsetComment: (commentId: string) => ReturnType;
|
15
|
+
/**
|
16
|
+
* Resolve a comment (keep ID but update styling)
|
17
|
+
*/
|
18
|
+
resolveComment: (commentId: string) => ReturnType;
|
19
|
+
/**
|
20
|
+
* Unresolve a comment (switch back to unresolved state)
|
21
|
+
*/
|
22
|
+
unresolveComment: (commentId: string) => ReturnType;
|
23
|
+
};
|
24
|
+
}
|
25
|
+
}
|
26
|
+
export interface MarkWithRange {
|
27
|
+
mark: PMMark;
|
28
|
+
range: Range;
|
29
|
+
}
|
30
|
+
export interface CommentOptions {
|
31
|
+
HTMLAttributes: Record<string, any>;
|
32
|
+
onCommentActivated: (commentId: string) => void;
|
33
|
+
onCommentResolved?: (commentId: string) => void;
|
34
|
+
onCommentUnresolved?: (commentId: string) => void;
|
35
|
+
onCommentDeleted?: (commentId: string) => void;
|
36
|
+
}
|
37
|
+
export interface CommentStorage {
|
38
|
+
activeCommentId: string | null;
|
39
|
+
}
|
40
|
+
export interface IComment {
|
41
|
+
id: string;
|
42
|
+
selectedContent: string;
|
43
|
+
content: string;
|
44
|
+
replies: IComment[];
|
45
|
+
createdAt: Date;
|
46
|
+
resolved?: boolean;
|
47
|
+
}
|
48
|
+
export declare const CommentExtension: Mark<CommentOptions, CommentStorage>;
|
package/dist/package/types.d.ts
CHANGED
@@ -3,6 +3,7 @@ import { JSONContent } from '@tiptap/core';
|
|
3
3
|
import { EditorProps } from '@tiptap/pm/view';
|
4
4
|
import { Editor } from '@tiptap/react';
|
5
5
|
import { default as React, SetStateAction } from 'react';
|
6
|
+
import { IComment } from './extensions/comment';
|
6
7
|
|
7
8
|
export declare const DdocEditorProps: EditorProps;
|
8
9
|
export interface IDocCollabUsers {
|
@@ -10,12 +11,18 @@ export interface IDocCollabUsers {
|
|
10
11
|
isEns: string;
|
11
12
|
color: string;
|
12
13
|
}
|
13
|
-
type InlineCommentData = {
|
14
|
+
export type InlineCommentData = {
|
14
15
|
inlineCommentText: string;
|
15
16
|
highlightedTextContent: string;
|
16
17
|
handleClick: boolean;
|
17
18
|
};
|
18
19
|
export interface DdocProps {
|
20
|
+
commentDrawerOpen?: boolean;
|
21
|
+
setCommentDrawerOpen?: React.Dispatch<SetStateAction<boolean>>;
|
22
|
+
initialComments?: IComment[];
|
23
|
+
setInitialComments?: React.Dispatch<SetStateAction<IComment[]>>;
|
24
|
+
onCommentReply?: (activeCommentId: string, reply: IComment) => void;
|
25
|
+
onNewComment?: (newComment: IComment) => void;
|
19
26
|
selectedTags?: TagType[];
|
20
27
|
setSelectedTags?: React.Dispatch<SetStateAction<TagType[]>>;
|
21
28
|
enableCollaboration?: boolean | undefined;
|
@@ -40,7 +47,7 @@ export interface DdocProps {
|
|
40
47
|
renderNavbar?: ({ editor }: {
|
41
48
|
editor: JSONContent;
|
42
49
|
}) => JSX.Element;
|
43
|
-
onChange?: (
|
50
|
+
onChange?: (updatedDocContent: Data['editorJSONData'], updateChunk: string) => void;
|
44
51
|
onCollaboratorChange?: (collaborators: undefined | IDocCollabUsers[]) => void;
|
45
52
|
onTextSelection?: (data: IEditorSelectionData) => void;
|
46
53
|
onCommentInteraction?: (data: IEditorSelectionData) => void;
|
@@ -75,11 +82,10 @@ export interface IEditorSelectionData {
|
|
75
82
|
isHighlightedYellow: boolean;
|
76
83
|
}
|
77
84
|
export interface Data {
|
78
|
-
editorJSONData: JSONContent;
|
85
|
+
editorJSONData: string | JSONContent;
|
79
86
|
}
|
80
87
|
export interface IUser {
|
81
88
|
name: string;
|
82
89
|
color: string;
|
83
90
|
isEns: boolean;
|
84
91
|
}
|
85
|
-
export {};
|
@@ -8,6 +8,9 @@ export declare const useDdocEditor: ({ isPreviewMode, initialContent, enableColl
|
|
8
8
|
connect: (username: string | null | undefined, isEns?: boolean) => () => void;
|
9
9
|
ydoc: Y.Doc;
|
10
10
|
refreshYjsIndexedDbProvider: () => Promise<void>;
|
11
|
+
activeCommentId: string | null;
|
12
|
+
setActiveCommentId: import('react').Dispatch<import('react').SetStateAction<string | null>>;
|
13
|
+
focusCommentWithActiveId: (id: string) => void;
|
11
14
|
slides: string[];
|
12
15
|
setSlides: import('react').Dispatch<import('react').SetStateAction<string[]>>;
|
13
16
|
};
|