@fileverse-dev/ddoc 3.1.6-patch-001 → 3.1.6-patch-002

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.
Files changed (60) hide show
  1. package/dist/index.es.js +35447 -35952
  2. package/dist/package/components/editor-toolbar.d.ts +2 -1
  3. package/dist/package/components/editor-utils.d.ts +2 -1
  4. package/dist/package/components/inline-comment/comment-card.d.ts +1 -1
  5. package/dist/package/components/inline-comment/comment-drawer.d.ts +1 -1
  6. package/dist/package/components/inline-comment/comment-dropdown.d.ts +1 -1
  7. package/dist/package/components/inline-comment/comment-section.d.ts +1 -1
  8. package/dist/package/components/inline-comment/comment-username.d.ts +1 -1
  9. package/dist/package/components/inline-comment/context/comment-context.d.ts +4 -0
  10. package/dist/package/components/inline-comment/context/types.d.ts +89 -46
  11. package/dist/package/components/inline-comment/empty-comments.d.ts +1 -4
  12. package/dist/package/components/inline-comment/types.d.ts +0 -22
  13. package/dist/package/components/presentation-mode/presentation-mode.d.ts +2 -2
  14. package/dist/package/components/presentation-mode/preview-panel.d.ts +2 -2
  15. package/dist/package/components/preview-export-trigger.d.ts +2 -1
  16. package/dist/package/components/tabs/document-tabs-sidebar.d.ts +1 -2
  17. package/dist/package/context/editor-context.d.ts +3 -3
  18. package/dist/package/extensions/comment/comment.d.ts +0 -27
  19. package/dist/package/extensions/custom-link/index.d.ts +19 -0
  20. package/dist/package/extensions/default-extension.d.ts +1 -1
  21. package/dist/package/extensions/odt-export/index.d.ts +30 -0
  22. package/dist/package/hooks/use-ddoc-export.d.ts +1 -1
  23. package/dist/package/hooks/use-export-headless-editor-content.d.ts +1 -1
  24. package/dist/package/hooks/use-tab-editor.d.ts +3 -5
  25. package/dist/package/hooks/use-tab-manager.d.ts +2 -1
  26. package/dist/package/sync-local/SyncManager.d.ts +12 -0
  27. package/dist/package/sync-local/types/index.d.ts +4 -0
  28. package/dist/package/types.d.ts +7 -17
  29. package/dist/package/use-ddoc-editor.d.ts +0 -1
  30. package/dist/package/utils/colors.d.ts +3 -1
  31. package/dist/package/utils/document-styling.d.ts +3 -3
  32. package/dist/package/utils/heading-link.d.ts +23 -0
  33. package/dist/style.css +1 -1
  34. package/package.json +1 -1
  35. package/dist/package/components/inline-comment/comment-floating-container.d.ts +0 -1
  36. package/dist/package/components/inline-comment/comment-floating-layout.d.ts +0 -31
  37. package/dist/package/components/inline-comment/comment-input-field.d.ts +0 -3
  38. package/dist/package/components/inline-comment/comment-reply-input.d.ts +0 -7
  39. package/dist/package/components/inline-comment/constants.d.ts +0 -1
  40. package/dist/package/components/inline-comment/delete-confirm-overlay.d.ts +0 -10
  41. package/dist/package/components/inline-comment/floating-comment/comment-floating-container.d.ts +0 -3
  42. package/dist/package/components/inline-comment/floating-comment/draft-floating-card.d.ts +0 -3
  43. package/dist/package/components/inline-comment/floating-comment/floating-auth-prompt.d.ts +0 -1
  44. package/dist/package/components/inline-comment/floating-comment/floating-card-shell.d.ts +0 -3
  45. package/dist/package/components/inline-comment/floating-comment/index.d.ts +0 -1
  46. package/dist/package/components/inline-comment/floating-comment/thread-floating-card.d.ts +0 -3
  47. package/dist/package/components/inline-comment/floating-comment/types.d.ts +0 -32
  48. package/dist/package/components/inline-comment/floating-comment-layout-utils.d.ts +0 -78
  49. package/dist/package/components/inline-comment/resize-inline-comment-textarea.d.ts +0 -1
  50. package/dist/package/components/inline-comment/use-anchor-registry.d.ts +0 -34
  51. package/dist/package/components/inline-comment/use-comment-card.d.ts +0 -29
  52. package/dist/package/components/inline-comment/use-comment-list-container.d.ts +0 -17
  53. package/dist/package/components/inline-comment/use-ens-status.d.ts +0 -3
  54. package/dist/package/components/inline-comment/use-floating-card-state.d.ts +0 -36
  55. package/dist/package/components/inline-comment/use-floating-comment-card-layout.d.ts +0 -23
  56. package/dist/package/components/inline-comment/use-floating-comment-card-state.d.ts +0 -13
  57. package/dist/package/components/inline-comment/use-floating-layout-engine.d.ts +0 -26
  58. package/dist/package/extensions/comment/comment-decoration-plugin.d.ts +0 -67
  59. package/dist/package/stores/comment-store-provider.d.ts +0 -50
  60. package/dist/package/stores/comment-store.d.ts +0 -185
@@ -4,7 +4,7 @@ import { IpfsImageFetchPayload, IpfsImageUploadResponse } from '../types';
4
4
  import { Tab } from './tabs/utils/tab-utils';
5
5
 
6
6
  import * as Y from 'yjs';
7
- declare const TiptapToolBar: ({ editor, onError, zoomLevel, setZoomLevel, isNavbarVisible, setIsNavbarVisible, ipfsImageUploadFn, onMarkdownExport, onMarkdownImport, onPdfExport, onHtmlExport, onTxtExport, onDocxImport, isLoading, ipfsImageFetchFn, fetchV1ImageFn, isConnected, tabs, ydoc, onRegisterExportTrigger, toggleFocusMode, }: {
7
+ declare const TiptapToolBar: ({ editor, onError, zoomLevel, setZoomLevel, isNavbarVisible, setIsNavbarVisible, ipfsImageUploadFn, onMarkdownExport, onMarkdownImport, onPdfExport, onHtmlExport, onTxtExport, onOdtExport, onDocxImport, isLoading, ipfsImageFetchFn, fetchV1ImageFn, isConnected, tabs, ydoc, onRegisterExportTrigger, toggleFocusMode, }: {
8
8
  editor: Editor | null;
9
9
  onError?: (errorString: string) => void;
10
10
  zoomLevel: string;
@@ -17,6 +17,7 @@ declare const TiptapToolBar: ({ editor, onError, zoomLevel, setZoomLevel, isNavb
17
17
  onPdfExport?: () => void;
18
18
  onHtmlExport?: () => void;
19
19
  onTxtExport?: () => void;
20
+ onOdtExport?: () => void;
20
21
  onDocxImport?: () => void;
21
22
  isLoading: boolean;
22
23
  fetchV1ImageFn?: (url: string) => Promise<ArrayBuffer | undefined>;
@@ -56,7 +56,7 @@ export declare const IMG_UPLOAD_SETTINGS: {
56
56
  errorMsg: string;
57
57
  };
58
58
  };
59
- export declare const useEditorToolbar: ({ editor, onError, ipfsImageUploadFn, onMarkdownExport, onMarkdownImport, onPdfExport, onHtmlExport, onTxtExport, ipfsImageFetchFn, onDocxImport, fetchV1ImageFn, }: {
59
+ export declare const useEditorToolbar: ({ editor, onError, ipfsImageUploadFn, onMarkdownExport, onMarkdownImport, onPdfExport, onHtmlExport, onTxtExport, onOdtExport, ipfsImageFetchFn, onDocxImport, fetchV1ImageFn, }: {
60
60
  editor: Editor | null;
61
61
  onError?: (errorString: string) => void;
62
62
  ipfsImageUploadFn?: (file: File) => Promise<IpfsImageUploadResponse>;
@@ -65,6 +65,7 @@ export declare const useEditorToolbar: ({ editor, onError, ipfsImageUploadFn, on
65
65
  onPdfExport?: () => void;
66
66
  onHtmlExport?: () => void;
67
67
  onTxtExport?: () => void;
68
+ onOdtExport?: () => void;
68
69
  ipfsImageFetchFn?: (_data: IpfsImageFetchPayload) => Promise<{
69
70
  url: string;
70
71
  file: File;
@@ -1,4 +1,4 @@
1
1
  import { CommentCardProps } from './types';
2
2
 
3
- export declare const CommentCard: (props: CommentCardProps) => import("react/jsx-runtime").JSX.Element;
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, activeTabId, onTabChange, isPreviewMode, tabs, }: CommentDrawerProps) => import("react/jsx-runtime").JSX.Element;
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, isMobile, comments: commentsProp, commentType, tabNameById, selectedTabLabel, newCommentTabId, showNewCommentInput, onCommentFocus, onReset, }: CommentSectionProps) => import("react/jsx-runtime").JSX.Element;
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 { Dispatch, RefObject, SetStateAction } from 'react';
1
+ import { Editor } from '@tiptap/react';
2
2
  import { IComment } from '../../../extensions/comment';
3
- import { CommentStoreState } from '../../../stores/comment-store';
4
- import { CommentStoreProviderProps } from '../../../stores/comment-store-provider';
5
- import { CommentAccountProps } from '../../../types';
3
+ import { SetStateAction } from 'react';
4
+ import { CommentAccountProps, CommentMutationMeta } from '../../../types';
5
+ import { EnsStatus } from '../types';
6
6
 
7
- export interface CommentFloatingBaseCard {
8
- floatingCardId: string;
9
- selectedText: string;
10
- isFocused: boolean;
11
- }
12
- export type InlineDraftLocation = 'drawer' | 'floating';
13
- export interface InlineCommentDraft {
14
- draftId: string;
15
- tabId: string;
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
- text: string;
18
- location: InlineDraftLocation;
19
- isAuthPending: boolean;
20
- }
21
- export interface CommentFloatingDraftCard extends CommentFloatingBaseCard {
22
- type: 'draft';
23
- draftId: string;
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 CommentFloatingThreadCard extends CommentFloatingBaseCard {
26
- type: 'thread';
27
- commentId: string;
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 type CommentFloatingCard = CommentFloatingDraftCard | CommentFloatingThreadCard;
30
- export interface InlineCommentData {
31
- highlightedTextContent?: string;
32
- inlineCommentText: string;
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
- }
@@ -1,5 +1,2 @@
1
- declare const EmptyComments: ({ commentType, handleReset, }: {
2
- commentType: string;
3
- handleReset?: () => void;
4
- }) => import("react/jsx-runtime").JSX.Element;
1
+ declare const EmptyComments: () => import("react/jsx-runtime").JSX.Element;
5
2
  export { EmptyComments };
@@ -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,18 +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
35
  }
40
36
  export interface CommentCardProps extends IComment {
41
37
  comment?: string;
42
38
  onResolve?: (commentId: string) => void;
43
39
  onDelete?: (commentId: string) => void;
44
- onRequestDelete?: (commentId: string) => void;
45
40
  onUnresolve?: (commentId: string) => void;
46
- onFocusRequest?: () => void;
47
41
  isResolved?: boolean;
48
42
  isDropdown?: boolean;
49
43
  activeCommentId?: string;
@@ -51,21 +45,15 @@ export interface CommentCardProps extends IComment {
51
45
  isCommentOwner?: boolean;
52
46
  version?: string;
53
47
  emptyComment?: boolean;
54
- isFocused?: boolean;
55
- isCommentDrawerContext?: boolean;
56
48
  }
57
49
  export type CommentBubbleMenuProps = Omit<BubbleMenuProps, 'children'> & {
58
50
  zoomLevel: string;
59
51
  };
60
52
  export interface CommentReplyProps {
61
- commentId: string;
62
- replyId: string;
63
53
  reply: string;
64
54
  username: string;
65
55
  createdAt: Date;
66
56
  isLast: boolean;
67
- isThreadResolved?: boolean;
68
- isCommentDrawerContext?: boolean;
69
57
  }
70
58
  export interface EnsStatus {
71
59
  name: string;
@@ -75,16 +63,6 @@ export interface CommentSectionProps {
75
63
  activeCommentId: string | null;
76
64
  isNavbarVisible?: boolean;
77
65
  isPresentationMode?: boolean;
78
- isMobile?: boolean;
79
- comments?: IComment[];
80
- commentType?: 'all' | 'active' | 'resolved';
81
- sectionLabel?: string;
82
- tabNameById?: Record<string, string>;
83
- selectedTabLabel?: string;
84
- newCommentTabId?: string;
85
- showNewCommentInput?: boolean;
86
- onCommentFocus?: (commentId: string, tabId?: string) => void;
87
- onReset?: () => void;
88
66
  }
89
67
  export interface UserDisplayProps {
90
68
  username: string;
@@ -1,5 +1,5 @@
1
1
  import { Editor } from '@tiptap/react';
2
- import { IpfsImageFetchPayload, DdocProps } from '../../types';
2
+ import { IpfsImageFetchPayload, DdocProps, ThemeKey } from '../../types';
3
3
 
4
4
  interface PresentationModeProps {
5
5
  editor: Editor;
@@ -22,7 +22,7 @@ interface PresentationModeProps {
22
22
  }>;
23
23
  documentStyling?: DdocProps['documentStyling'];
24
24
  fetchV1ImageFn?: (url: string) => Promise<ArrayBuffer | undefined>;
25
- theme?: 'light' | 'dark';
25
+ theme?: ThemeKey;
26
26
  }
27
27
  export declare const PresentationMode: ({ editor, onClose, isFullscreen, setIsFullscreen, onError, setCommentDrawerOpen, sharedSlidesLink, isPreviewMode, documentName, onSlidesShare, slides, setSlides, renderThemeToggle, isContentLoading, ipfsImageFetchFn, documentStyling, fetchV1ImageFn, theme, }: PresentationModeProps) => import("react/jsx-runtime").JSX.Element | null;
28
28
  export {};
@@ -1,11 +1,11 @@
1
- import { DdocProps } from '../../types';
1
+ import { DdocProps, ThemeKey } from '../../types';
2
2
 
3
3
  interface PreviewPanelProps {
4
4
  slides: string[];
5
5
  currentSlide: number;
6
6
  setCurrentSlide: (index: number) => void;
7
7
  documentStyling?: DdocProps['documentStyling'];
8
- theme?: 'light' | 'dark';
8
+ theme?: ThemeKey;
9
9
  }
10
10
  export declare const PreviewPanel: ({ slides, currentSlide, setCurrentSlide, documentStyling, theme, }: PreviewPanelProps) => import("react/jsx-runtime").JSX.Element;
11
11
  export {};
@@ -15,10 +15,11 @@ interface PreviewModeExportTriggerProps {
15
15
  onPdfExport?: DdocProps['onPdfExport'];
16
16
  onHtmlExport?: DdocProps['onHtmlExport'];
17
17
  onTxtExport?: DdocProps['onTxtExport'];
18
+ onOdtExport?: DdocProps['onOdtExport'];
18
19
  ipfsImageFetchFn?: DdocProps['ipfsImageFetchFn'];
19
20
  onDocxImport?: DdocProps['onDocxImport'];
20
21
  fetchV1ImageFn?: DdocProps['fetchV1ImageFn'];
21
22
  isConnected?: DdocProps['isConnected'];
22
23
  }
23
- declare const PreviewModeExportTrigger: ({ editor, ydoc, tabs, onRegisterExportTrigger, onError, ipfsImageUploadFn, onMarkdownExport, onMarkdownImport, onPdfExport, onHtmlExport, onTxtExport, ipfsImageFetchFn, onDocxImport, fetchV1ImageFn, isConnected, }: PreviewModeExportTriggerProps) => import("react/jsx-runtime").JSX.Element;
24
+ declare const PreviewModeExportTrigger: ({ editor, ydoc, tabs, onRegisterExportTrigger, onError, ipfsImageUploadFn, onMarkdownExport, onMarkdownImport, onPdfExport, onHtmlExport, onTxtExport, onOdtExport, ipfsImageFetchFn, onDocxImport, fetchV1ImageFn, isConnected, }: PreviewModeExportTriggerProps) => import("react/jsx-runtime").JSX.Element;
24
25
  export { PreviewModeExportTrigger };
@@ -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, isFocusMode, }: DocumentTabsSidebarProps) => import("react/jsx-runtime").JSX.Element;
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,9 +1,9 @@
1
1
  import { default as React, ReactNode } from 'react';
2
- import { DocumentStyling } from '../types';
2
+ import { DocumentStyling, ThemeKey } from '../types';
3
3
 
4
4
  interface EditorContextType {
5
5
  documentStyling?: DocumentStyling;
6
- theme: 'light' | 'dark';
6
+ theme: ThemeKey;
7
7
  isFocusMode: boolean;
8
8
  }
9
9
  export declare const EditorContext: React.Context<EditorContextType | null>;
@@ -11,7 +11,7 @@ export declare const useEditorContext: () => EditorContextType;
11
11
  export declare const EditorProvider: React.FC<{
12
12
  children: ReactNode;
13
13
  documentStyling?: DocumentStyling;
14
- theme?: 'light' | 'dark';
14
+ theme?: ThemeKey;
15
15
  isFocusMode?: boolean;
16
16
  }>;
17
17
  export {};
@@ -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
  }
@@ -59,18 +45,6 @@ export interface CommentOptions {
59
45
  export interface CommentStorage {
60
46
  activeCommentId: string | null;
61
47
  }
62
- export interface DraftCommentRange {
63
- draftId: string;
64
- from: number;
65
- to: number;
66
- }
67
- interface DraftCommentPluginState {
68
- decorations: DecorationSet;
69
- drafts: Map<string, DraftCommentRange>;
70
- }
71
- export declare const draftCommentPluginKey: PluginKey<DraftCommentPluginState>;
72
- export declare const getDraftCommentState: (state: EditorState) => DraftCommentPluginState | undefined;
73
- export declare const getDraftCommentRange: (state: EditorState, draftId: string) => DraftCommentRange | null;
74
48
  export interface IComment {
75
49
  id?: string;
76
50
  tabId?: string;
@@ -89,4 +63,3 @@ export interface IComment {
89
63
  version?: string;
90
64
  }
91
65
  export declare const CommentExtension: Mark<CommentOptions, CommentStorage>;
92
- export {};
@@ -0,0 +1,19 @@
1
+ import { LinkOptions } from '@tiptap/extension-link';
2
+
3
+ export interface CustomLinkOptions extends LinkOptions {
4
+ /**
5
+ * Called when the user pastes a heading link URL whose target
6
+ * heading does not exist in the current document — i.e. the link
7
+ * belongs to a different dDoc.
8
+ */
9
+ onForeignHeadingLink?: (message: string) => void;
10
+ }
11
+ /**
12
+ * Extends tiptap's Link with a paste-time hook that detects
13
+ * heading links pointing at headings from other dDocs and dispatches
14
+ * a warning. A dedicated ProseMirror `handlePaste` is used (instead
15
+ * of piggybacking on `shouldAutoLink`) because `shouldAutoLink` is
16
+ * also called by the autolink plugin on every transaction — which
17
+ * would re-fire the warning on unrelated keystrokes like Enter.
18
+ */
19
+ export declare const CustomLink: import('@tiptap/core').Mark<CustomLinkOptions, any>;
@@ -14,5 +14,5 @@ export declare const defaultExtensions: ({ ipfsImageFetchFn, onError, metadataPr
14
14
  onCopyHeadingLink?: (link: string) => void;
15
15
  fetchV1ImageFn?: (url: string) => Promise<ArrayBuffer | undefined>;
16
16
  onTocUpdate?: (data: ToCItemType[], isCreate?: boolean) => void;
17
- }) => (import('@tiptap/core').AnyExtension | import('@tiptap/core').Node<import('@tiptap/extension-horizontal-rule').HorizontalRuleOptions, any> | import('@tiptap/core').Extension<import('./multi-column').ColumnExtensionOptions, any> | import('@tiptap/core').Node<import('@tiptap/extension-heading').HeadingOptions, any> | import('@tiptap/core').Node<import('./iframe').IframeOptions, any> | import('@tiptap/core').Node<import('./twitter-embed').EmbeddedTweetOptions, any> | import('@tiptap/core').Node<import('./d-block').DBlockOptions, any> | import('@tiptap/core').Extension<import('./trailing-node').TrailingNodeOptions, any> | import('@tiptap/core').Node<import('./action-button').ActionButtonOptions, any> | import('@tiptap/core').Node<import('./resizable-media').MediaOptions, any> | import('@tiptap/core').Extension<import('./link-preview/link-preview').LinkPreviewOptions, any> | import('@tiptap/core').Node<import('@tiptap/extension-code-block-lowlight').CodeBlockLowlightOptions, any> | import('@tiptap/core').Mark<import('@tiptap/extension-text-style').TextStyleOptions, any> | import('@tiptap/core').Mark<import('@tiptap/extension-subscript').SubscriptExtensionOptions, any> | import('@tiptap/core').Extension<import('@tiptap/extension-text-style').FontFamilyOptions, any> | import('@tiptap/core').Extension<import('@tiptap/starter-kit').StarterKitOptions, any> | import('@tiptap/core').Extension<import('@tiptap/extension-table-of-contents').TableOfContentsOptions, import('@tiptap/extension-table-of-contents').TableOfContentsStorage> | import('@tiptap/core').Extension<import('@tiptap/extension-typography').TypographyOptions, any> | import('@tiptap/core').Extension<import('@tiptap/extension-text-align').TextAlignOptions, any> | import('@tiptap/core').Extension<import('@tiptap/extensions').PlaceholderOptions, any> | import('@tiptap/core').Mark<import('@tiptap/extension-highlight').HighlightOptions, any> | import('@tiptap/core').Node<import('@tiptap/extension-list').TaskListOptions, any> | import('@tiptap/core').Node<import('@tiptap/extension-list').TaskItemOptions, any> | import('@tiptap/core').Node<import('@tiptap/extension-list').BulletListOptions, any> | import('@tiptap/core').Node<import('@tiptap/extension-list').ListItemOptions, any> | import('@tiptap/core').Extension<import('@tiptap/extensions').DropcursorOptions, any> | import('@tiptap/core').Extension<import('tiptap-markdown').MarkdownOptions, import('tiptap-markdown').MarkdownStorage> | import('@tiptap/core').Extension<import('@tiptap/extensions').CharacterCountOptions, import('@tiptap/extensions').CharacterCountStorage> | import('@tiptap/core').Extension<import('@aarkue/tiptap-math-extension').MathExtensionOption, any>)[];
17
+ }) => (import('@tiptap/core').AnyExtension | import('@tiptap/core').Node<import('@tiptap/extension-horizontal-rule').HorizontalRuleOptions, any> | import('@tiptap/core').Extension<import('./multi-column').ColumnExtensionOptions, any> | import('@tiptap/core').Node<import('@tiptap/extension-heading').HeadingOptions, any> | import('@tiptap/core').Node<import('./iframe').IframeOptions, any> | import('@tiptap/core').Node<import('./twitter-embed').EmbeddedTweetOptions, any> | import('@tiptap/core').Node<import('./d-block').DBlockOptions, any> | import('@tiptap/core').Extension<import('./trailing-node').TrailingNodeOptions, any> | import('@tiptap/core').Node<import('./action-button').ActionButtonOptions, any> | import('@tiptap/core').Node<import('./resizable-media').MediaOptions, any> | import('@tiptap/core').Extension<import('./link-preview/link-preview').LinkPreviewOptions, any> | import('@tiptap/core').Node<import('@tiptap/extension-code-block-lowlight').CodeBlockLowlightOptions, any> | import('@tiptap/core').Mark<import('./custom-link').CustomLinkOptions, any> | import('@tiptap/core').Mark<import('@tiptap/extension-text-style').TextStyleOptions, any> | import('@tiptap/core').Mark<import('@tiptap/extension-subscript').SubscriptExtensionOptions, any> | import('@tiptap/core').Extension<import('@tiptap/extension-text-style').FontFamilyOptions, any> | import('@tiptap/core').Extension<import('@tiptap/starter-kit').StarterKitOptions, any> | import('@tiptap/core').Extension<import('@tiptap/extension-table-of-contents').TableOfContentsOptions, import('@tiptap/extension-table-of-contents').TableOfContentsStorage> | import('@tiptap/core').Extension<import('@tiptap/extension-typography').TypographyOptions, any> | import('@tiptap/core').Extension<import('@tiptap/extension-text-align').TextAlignOptions, any> | import('@tiptap/core').Extension<import('@tiptap/extensions').PlaceholderOptions, any> | import('@tiptap/core').Mark<import('@tiptap/extension-highlight').HighlightOptions, any> | import('@tiptap/core').Node<import('@tiptap/extension-list').TaskListOptions, any> | import('@tiptap/core').Node<import('@tiptap/extension-list').TaskItemOptions, any> | import('@tiptap/core').Node<import('@tiptap/extension-list').BulletListOptions, any> | import('@tiptap/core').Node<import('@tiptap/extension-list').ListItemOptions, any> | import('@tiptap/core').Extension<import('@tiptap/extensions').DropcursorOptions, any> | import('@tiptap/core').Extension<import('tiptap-markdown').MarkdownOptions, import('tiptap-markdown').MarkdownStorage> | import('@tiptap/core').Extension<import('@tiptap/extensions').CharacterCountOptions, import('@tiptap/extensions').CharacterCountStorage> | import('@tiptap/core').Extension<import('@aarkue/tiptap-math-extension').MathExtensionOption, any>)[];
18
18
  export declare const createInputRule: (pattern: RegExp, data: string, type: NodeType) => InputRule;
@@ -0,0 +1,30 @@
1
+ import { Extension } from '@tiptap/core';
2
+ import { IpfsImageFetchPayload } from '../../types';
3
+
4
+ declare module '@tiptap/core' {
5
+ interface Commands {
6
+ exportOdtFile: {
7
+ exportOdtFile: (props?: {
8
+ title?: string;
9
+ }) => any;
10
+ };
11
+ }
12
+ }
13
+ /**
14
+ * Preprocess TipTap HTML for odf-kit compatibility:
15
+ * - Convert task lists to standard lists with checkbox text prefixes
16
+ * - Replace <img> tags with warning text (odf-kit v1 skips images)
17
+ * - Convert callouts (<aside>) to blockquotes
18
+ * - Convert Twitter embeds to links
19
+ * - Convert iframes (YouTube, SoundCloud, etc.) to links
20
+ * - Strip TipTap-specific data attributes
21
+ * - Convert void elements to self-closing XHTML for the XML parser
22
+ */
23
+ export declare function preprocessHtml(html: string): {
24
+ html: string;
25
+ };
26
+ declare const OdtExportExtension: (ipfsImageFetchFn?: (_data: IpfsImageFetchPayload) => Promise<{
27
+ url: string;
28
+ file: File;
29
+ }>, fetchV1ImageFn?: (url: string) => Promise<ArrayBuffer | undefined>) => Extension<any, any>;
30
+ export default OdtExportExtension;
@@ -10,7 +10,7 @@ interface UseDdocExportArgs {
10
10
  exportOptions: (IEditorToolElement | null)[];
11
11
  }
12
12
  declare const useDdocExport: ({ editor, tabs, ydoc, exportOptions, }: UseDdocExportArgs) => {
13
- getOptionFormat: (title: string) => "" | "md" | "pdf" | "html" | "txt";
13
+ getOptionFormat: (title: string) => "" | "md" | "pdf" | "html" | "txt" | "odt";
14
14
  formatSelectOptions: {
15
15
  id: string;
16
16
  label: string;
@@ -3,7 +3,7 @@ import { DdocExportModalProps } from '../components/export-modal';
3
3
  import { UseHeadlessEditorProps } from './use-headless-editor';
4
4
 
5
5
  import * as Y from 'yjs';
6
- export type HeadlessEditorExportFormat = 'pdf' | 'md' | 'html' | 'txt';
6
+ export type HeadlessEditorExportFormat = 'pdf' | 'md' | 'html' | 'txt' | 'odt';
7
7
  export interface HeadlessEditorExportOption {
8
8
  content: string;
9
9
  fileName?: string;
@@ -1,7 +1,6 @@
1
1
  import { Dispatch, MutableRefObject, SetStateAction } from 'react';
2
- import { DdocProps } from '../types';
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
 
@@ -46,10 +45,10 @@ interface UseTabEditorArgs {
46
45
  externalExtensions?: Record<string, AnyExtension>;
47
46
  isContentLoading?: boolean;
48
47
  activeTabId: string;
49
- theme?: 'dark' | 'light';
48
+ theme?: ThemeKey;
50
49
  editorRef?: MutableRefObject<Editor | null>;
51
50
  }
52
- 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, initialiseYjsIndexedDbProvider, externalExtensions, isContentLoading, activeTabId, theme, editorRef, }: UseTabEditorArgs) => {
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) => {
53
52
  editor: Editor | null;
54
53
  ref: import('react').RefObject<HTMLDivElement>;
55
54
  slides: string[];
@@ -60,6 +59,5 @@ export declare const useTabEditor: ({ ydoc, isVersionMode, hasTabState, versionI
60
59
  setActiveCommentId: Dispatch<SetStateAction<string | null>>;
61
60
  focusCommentWithActiveId: (id: string) => void;
62
61
  isContentLoading: boolean | undefined;
63
- commentAnchorsRef: MutableRefObject<CommentAnchor[]>;
64
62
  };
65
63
  export {};
@@ -10,12 +10,13 @@ interface UseTabManagerArgs {
10
10
  createDefaultTabIfMissing: boolean;
11
11
  shouldSyncActiveTab: boolean;
12
12
  defaultTabId?: string;
13
+ preferFirstTabOnInit?: boolean;
13
14
  onVersionHistoryActiveTabChange?: (tabId: string | null) => void;
14
15
  getEditor?: () => Editor | null;
15
16
  flushPendingUpdate?: () => void;
16
17
  }
17
18
  export declare const getNewTabId: () => string;
18
- export declare const useTabManager: ({ ydoc, initialContent, enableCollaboration, isDDocOwner, createDefaultTabIfMissing, shouldSyncActiveTab, defaultTabId, onVersionHistoryActiveTabChange, flushPendingUpdate, getEditor, }: UseTabManagerArgs) => {
19
+ export declare const useTabManager: ({ ydoc, initialContent, enableCollaboration, isDDocOwner, createDefaultTabIfMissing, shouldSyncActiveTab, defaultTabId, preferFirstTabOnInit, onVersionHistoryActiveTabChange, flushPendingUpdate, getEditor, }: UseTabManagerArgs) => {
19
20
  tabs: Tab[];
20
21
  hasTabState: boolean;
21
22
  activeTabId: string;
@@ -14,6 +14,9 @@ export declare class SyncManager {
14
14
  private uncommittedUpdatesIdList;
15
15
  private contentTobeAppliedQueue;
16
16
  private isProcessing;
17
+ private flushTimer;
18
+ private readonly FLUSH_INTERVAL_MS;
19
+ private readonly MAX_QUEUE_SIZE;
17
20
  private _awarenessUpdateHandler;
18
21
  private ydoc;
19
22
  private servicesRef;
@@ -34,6 +37,15 @@ export declare class SyncManager {
34
37
  disconnect(): Promise<void>;
35
38
  terminateSession(): Promise<void>;
36
39
  enqueueLocalUpdate(update: Uint8Array): void;
40
+ private flushUpdates;
41
+ private awaitFlush;
42
+ /**
43
+ * Fire-and-forget: merge all queued updates, encrypt, and emit via Socket.IO
44
+ * without awaiting the server ACK. The server broadcasts to peers immediately
45
+ * (before MongoDB write), so content reaches observers in near-real-time.
46
+ * ACK callback handles updateId tracking and auto-commit asynchronously.
47
+ */
48
+ private sendUpdateBatch;
37
49
  forceCleanup(): void;
38
50
  private handleConnectionError;
39
51
  private handleReconnection;
@@ -109,6 +109,10 @@ export interface SyncManagerConfig {
109
109
  services?: CollabServices;
110
110
  callbacks?: CollabCallbacks;
111
111
  onLocalUpdate?: (updatedDocContent: Data['editorJSONData'], updateChunk: string) => void;
112
+ /** Origins to ignore in the ydoc update handler (e.g. IndexedDB provider) */
113
+ ignoredOrigins?: Array<{
114
+ current: unknown;
115
+ }>;
112
116
  }
113
117
  export declare enum ServerErrorCode {
114
118
  AUTH_TOKEN_MISSING = "AUTH_TOKEN_MISSING",