@fileverse-dev/ddoc 3.1.5 → 3.1.6-patch-001
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 +38295 -37789
- package/dist/package/components/editor-toolbar.d.ts +1 -2
- package/dist/package/components/editor-utils.d.ts +1 -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-floating-container.d.ts +1 -0
- package/dist/package/components/inline-comment/comment-floating-layout.d.ts +31 -0
- package/dist/package/components/inline-comment/comment-input-field.d.ts +3 -0
- package/dist/package/components/inline-comment/comment-reply-input.d.ts +7 -0
- 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/constants.d.ts +1 -0
- package/dist/package/components/inline-comment/context/types.d.ts +46 -89
- package/dist/package/components/inline-comment/delete-confirm-overlay.d.ts +10 -0
- package/dist/package/components/inline-comment/empty-comments.d.ts +4 -1
- package/dist/package/components/inline-comment/floating-comment/comment-floating-container.d.ts +3 -0
- package/dist/package/components/inline-comment/floating-comment/draft-floating-card.d.ts +3 -0
- package/dist/package/components/inline-comment/floating-comment/floating-auth-prompt.d.ts +1 -0
- package/dist/package/components/inline-comment/floating-comment/floating-card-shell.d.ts +3 -0
- package/dist/package/components/inline-comment/floating-comment/index.d.ts +1 -0
- package/dist/package/components/inline-comment/floating-comment/thread-floating-card.d.ts +3 -0
- package/dist/package/components/inline-comment/floating-comment/types.d.ts +32 -0
- package/dist/package/components/inline-comment/floating-comment-layout-utils.d.ts +78 -0
- package/dist/package/components/inline-comment/resize-inline-comment-textarea.d.ts +1 -0
- package/dist/package/components/inline-comment/types.d.ts +22 -0
- package/dist/package/components/inline-comment/use-anchor-registry.d.ts +34 -0
- package/dist/package/components/inline-comment/use-comment-card.d.ts +29 -0
- package/dist/package/components/inline-comment/use-comment-list-container.d.ts +17 -0
- package/dist/package/components/inline-comment/use-ens-status.d.ts +3 -0
- package/dist/package/components/inline-comment/use-floating-card-state.d.ts +36 -0
- package/dist/package/components/inline-comment/use-floating-comment-card-layout.d.ts +23 -0
- package/dist/package/components/inline-comment/use-floating-comment-card-state.d.ts +13 -0
- package/dist/package/components/inline-comment/use-floating-layout-engine.d.ts +26 -0
- package/dist/package/components/presentation-mode/presentation-mode.d.ts +2 -2
- package/dist/package/components/presentation-mode/preview-panel.d.ts +2 -2
- package/dist/package/components/preview-export-trigger.d.ts +1 -2
- package/dist/package/components/tabs/document-tabs-sidebar.d.ts +2 -1
- package/dist/package/context/editor-context.d.ts +3 -3
- package/dist/package/extensions/comment/comment-decoration-plugin.d.ts +67 -0
- package/dist/package/extensions/comment/comment.d.ts +27 -0
- package/dist/package/extensions/default-extension.d.ts +1 -1
- package/dist/package/hooks/use-ddoc-export.d.ts +1 -1
- package/dist/package/hooks/use-export-headless-editor-content.d.ts +1 -1
- package/dist/package/hooks/use-tab-editor.d.ts +5 -3
- package/dist/package/hooks/use-tab-manager.d.ts +1 -2
- package/dist/package/stores/comment-store-provider.d.ts +50 -0
- package/dist/package/stores/comment-store.d.ts +185 -0
- package/dist/package/sync-local/SyncManager.d.ts +0 -12
- package/dist/package/sync-local/types/index.d.ts +0 -4
- package/dist/package/types.d.ts +17 -7
- package/dist/package/use-ddoc-editor.d.ts +1 -0
- package/dist/package/utils/colors.d.ts +1 -3
- package/dist/package/utils/document-styling.d.ts +3 -3
- package/dist/style.css +1 -1
- package/package.json +3 -3
- package/dist/package/components/inline-comment/context/comment-context.d.ts +0 -4
- package/dist/package/extensions/custom-link/index.d.ts +0 -19
- package/dist/package/extensions/odt-export/index.d.ts +0 -30
- package/dist/package/utils/heading-link.d.ts +0 -23
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
import { Editor } from '@tiptap/react';
|
|
3
|
+
import { CommentFloatingCard } from './context/types';
|
|
4
|
+
|
|
5
|
+
interface UseFloatingCommentCardLayoutProps {
|
|
6
|
+
blurFloatingCard: (floatingCardId: string) => void;
|
|
7
|
+
closeFloatingCard: (floatingCardId: string) => void;
|
|
8
|
+
editor: Editor;
|
|
9
|
+
editorWrapperRef: RefObject<HTMLDivElement>;
|
|
10
|
+
floatingCardIdsKey: string;
|
|
11
|
+
floatingCards: CommentFloatingCard[];
|
|
12
|
+
focusedFloatingCardId: string | null;
|
|
13
|
+
isDesktopFloatingEnabled: boolean;
|
|
14
|
+
isHidden: boolean;
|
|
15
|
+
scrollContainerRef: RefObject<HTMLDivElement>;
|
|
16
|
+
}
|
|
17
|
+
interface UseFloatingCommentCardLayoutResult {
|
|
18
|
+
floatingCardListContainerRef: RefObject<HTMLDivElement>;
|
|
19
|
+
mountedFloatingCardIds: string[];
|
|
20
|
+
registerCardNode: (floatingCardId: string, node: HTMLDivElement | null) => void;
|
|
21
|
+
}
|
|
22
|
+
export declare const useFloatingCommentCardLayout: ({ blurFloatingCard, closeFloatingCard, editor, editorWrapperRef, floatingCardIdsKey, floatingCards, focusedFloatingCardId, isDesktopFloatingEnabled, isHidden, scrollContainerRef, }: UseFloatingCommentCardLayoutProps) => UseFloatingCommentCardLayoutResult;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CommentFloatingCard } from './context/types';
|
|
2
|
+
|
|
3
|
+
interface UseFloatingCommentCardStateResult {
|
|
4
|
+
blurFloatingCard: (floatingCardId: string) => void;
|
|
5
|
+
closeFloatingCard: (floatingCardId: string) => void;
|
|
6
|
+
floatingCardIdsKey: string;
|
|
7
|
+
floatingCardMap: Map<string, CommentFloatingCard>;
|
|
8
|
+
floatingCards: CommentFloatingCard[];
|
|
9
|
+
focusedFloatingCardId: string | null;
|
|
10
|
+
isDesktopFloatingEnabled: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare const useFloatingCommentCardState: () => UseFloatingCommentCardStateResult;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
import { Editor } from '@tiptap/react';
|
|
3
|
+
import { CommentFloatingCard } from './context/types';
|
|
4
|
+
import { UseAnchorRegistryResult } from './use-anchor-registry';
|
|
5
|
+
import { UseFloatingCardStateResult } from './use-floating-card-state';
|
|
6
|
+
|
|
7
|
+
interface UseFloatingLayoutEngineProps {
|
|
8
|
+
blurFloatingCard: (floatingCardId: string) => void;
|
|
9
|
+
closeFloatingCard: (floatingCardId: string) => void;
|
|
10
|
+
editor: Editor;
|
|
11
|
+
editorWrapperRef: RefObject<HTMLDivElement>;
|
|
12
|
+
floatingCardIdsKey: string;
|
|
13
|
+
floatingCards: CommentFloatingCard[];
|
|
14
|
+
focusedFloatingCardId: string | null;
|
|
15
|
+
isDesktopFloatingEnabled: boolean;
|
|
16
|
+
isHidden: boolean;
|
|
17
|
+
scrollContainerRef: RefObject<HTMLDivElement>;
|
|
18
|
+
anchorRegistry: UseAnchorRegistryResult;
|
|
19
|
+
floatingCardState: UseFloatingCardStateResult;
|
|
20
|
+
}
|
|
21
|
+
export interface UseFloatingLayoutEngineResult {
|
|
22
|
+
floatingCardListContainerRef: RefObject<HTMLDivElement>;
|
|
23
|
+
registerCardNode: (floatingCardId: string, node: HTMLDivElement | null) => void;
|
|
24
|
+
}
|
|
25
|
+
export declare const useFloatingLayoutEngine: ({ blurFloatingCard, closeFloatingCard, editor, editorWrapperRef, floatingCardIdsKey, floatingCards, focusedFloatingCardId, isDesktopFloatingEnabled, isHidden, scrollContainerRef, anchorRegistry, floatingCardState, }: UseFloatingLayoutEngineProps) => UseFloatingLayoutEngineResult;
|
|
26
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Editor } from '@tiptap/react';
|
|
2
|
-
import { IpfsImageFetchPayload, DdocProps
|
|
2
|
+
import { IpfsImageFetchPayload, DdocProps } 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?:
|
|
25
|
+
theme?: 'light' | 'dark';
|
|
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
|
|
1
|
+
import { DdocProps } 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?:
|
|
8
|
+
theme?: 'light' | 'dark';
|
|
9
9
|
}
|
|
10
10
|
export declare const PreviewPanel: ({ slides, currentSlide, setCurrentSlide, documentStyling, theme, }: PreviewPanelProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
11
|
export {};
|
|
@@ -15,11 +15,10 @@ interface PreviewModeExportTriggerProps {
|
|
|
15
15
|
onPdfExport?: DdocProps['onPdfExport'];
|
|
16
16
|
onHtmlExport?: DdocProps['onHtmlExport'];
|
|
17
17
|
onTxtExport?: DdocProps['onTxtExport'];
|
|
18
|
-
onOdtExport?: DdocProps['onOdtExport'];
|
|
19
18
|
ipfsImageFetchFn?: DdocProps['ipfsImageFetchFn'];
|
|
20
19
|
onDocxImport?: DdocProps['onDocxImport'];
|
|
21
20
|
fetchV1ImageFn?: DdocProps['fetchV1ImageFn'];
|
|
22
21
|
isConnected?: DdocProps['isConnected'];
|
|
23
22
|
}
|
|
24
|
-
declare const PreviewModeExportTrigger: ({ editor, ydoc, tabs, onRegisterExportTrigger, onError, ipfsImageUploadFn, onMarkdownExport, onMarkdownImport, onPdfExport, onHtmlExport, onTxtExport,
|
|
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;
|
|
25
24
|
export { PreviewModeExportTrigger };
|
|
@@ -31,9 +31,10 @@ export interface DocumentTabsSidebarProps {
|
|
|
31
31
|
tabConfig?: DocumentOutlineProps['tabConfig'];
|
|
32
32
|
deleteTab?: (tabId: string) => void;
|
|
33
33
|
isConnected?: boolean;
|
|
34
|
+
isFocusMode?: boolean;
|
|
34
35
|
}
|
|
35
36
|
export declare const DocumentTabsSidebar: ({ tabSectionContainer, ...rest }: DocumentTabsSidebarProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
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;
|
|
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;
|
|
37
38
|
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, }: {
|
|
38
39
|
tab: Tab;
|
|
39
40
|
tabIndex: number;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { default as React, ReactNode } from 'react';
|
|
2
|
-
import { DocumentStyling
|
|
2
|
+
import { DocumentStyling } from '../types';
|
|
3
3
|
|
|
4
4
|
interface EditorContextType {
|
|
5
5
|
documentStyling?: DocumentStyling;
|
|
6
|
-
theme:
|
|
6
|
+
theme: 'light' | 'dark';
|
|
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?:
|
|
14
|
+
theme?: 'light' | 'dark';
|
|
15
15
|
isFocusMode?: boolean;
|
|
16
16
|
}>;
|
|
17
17
|
export {};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { Extension, Editor } from '@tiptap/core';
|
|
2
|
+
import { EditorState, PluginKey } from '@tiptap/pm/state';
|
|
3
|
+
import { Transform } from '@tiptap/pm/transform';
|
|
4
|
+
import { DecorationSet } from '@tiptap/pm/view';
|
|
5
|
+
|
|
6
|
+
import * as Y from 'yjs';
|
|
7
|
+
export interface CommentAnchor {
|
|
8
|
+
id: string;
|
|
9
|
+
anchorFrom: Y.RelativePosition;
|
|
10
|
+
anchorTo: Y.RelativePosition;
|
|
11
|
+
resolved: boolean;
|
|
12
|
+
deleted: boolean;
|
|
13
|
+
}
|
|
14
|
+
interface CommentDecorationPluginState {
|
|
15
|
+
decorations: DecorationSet;
|
|
16
|
+
}
|
|
17
|
+
type CommentAnchorRange = {
|
|
18
|
+
from: number;
|
|
19
|
+
to: number;
|
|
20
|
+
};
|
|
21
|
+
type CommentAnchorRelativeRange = {
|
|
22
|
+
anchorFrom: Y.RelativePosition;
|
|
23
|
+
anchorTo: Y.RelativePosition;
|
|
24
|
+
};
|
|
25
|
+
export type CommentAnchorTransactionChange = {
|
|
26
|
+
id: string;
|
|
27
|
+
type: 'unchanged';
|
|
28
|
+
} | {
|
|
29
|
+
id: string;
|
|
30
|
+
type: 'deleted';
|
|
31
|
+
} | ({
|
|
32
|
+
id: string;
|
|
33
|
+
type: 'edited';
|
|
34
|
+
} & CommentAnchorRange & CommentAnchorRelativeRange);
|
|
35
|
+
export declare const commentDecorationPluginKey: PluginKey<CommentDecorationPluginState>;
|
|
36
|
+
/**
|
|
37
|
+
* Analyze transaction changes to classify each active anchor's mutation status.
|
|
38
|
+
*
|
|
39
|
+
* This is the core transaction analysis function that determines
|
|
40
|
+
* whether each anchor remains unchanged, gets edited, or is deleted.
|
|
41
|
+
*
|
|
42
|
+
* Classification rules (in order):
|
|
43
|
+
* 1. Skip deleted or resolved anchors → 'unchanged'
|
|
44
|
+
* 2. If anchor has no old position → 'unchanged'
|
|
45
|
+
* 3. If no changed ranges touch the anchor → 'unchanged'
|
|
46
|
+
* 4. If any changed range fully covers the anchor → 'deleted' (full-span replacement)
|
|
47
|
+
* 5. If combined changed ranges fully cover the anchor → 'deleted' (multi-step removal)
|
|
48
|
+
* 6. If anchor maps through transform → check if position or content changed:
|
|
49
|
+
* a. If both unchanged → 'unchanged'
|
|
50
|
+
* b. Otherwise → 'edited' (return new position and relative anchor)
|
|
51
|
+
* 7. If mapping fails → 'deleted'
|
|
52
|
+
*/
|
|
53
|
+
export declare function analyzeCommentAnchorTransactionChanges(anchors: CommentAnchor[], oldState: EditorState, newState: EditorState, transform: Transform): CommentAnchorTransactionChange[];
|
|
54
|
+
export interface CommentDecorationOptions {
|
|
55
|
+
getAnchors: () => CommentAnchor[];
|
|
56
|
+
}
|
|
57
|
+
export declare const CommentDecorationExtension: Extension<CommentDecorationOptions, any>;
|
|
58
|
+
/**
|
|
59
|
+
* Public helper functions for comment anchor creation and inspection.
|
|
60
|
+
* These are consumed by the draft-creation flow and transaction-analysis layer.
|
|
61
|
+
*/
|
|
62
|
+
export declare function createCommentAnchorFromEditor(editor: Editor, from: number, to: number): CommentAnchorRelativeRange | null;
|
|
63
|
+
export declare function createCommentAnchorFromSelection(editor: Editor): CommentAnchorRelativeRange | null;
|
|
64
|
+
export declare function triggerDecorationRebuild(editor: Editor): void;
|
|
65
|
+
export declare function getCommentAtPosition(editor: Editor, pos: number, getAnchors: () => CommentAnchor[]): CommentAnchor | null;
|
|
66
|
+
export declare function getCommentAnchorRange(editor: Editor, commentId: string, getAnchors: () => CommentAnchor[]): CommentAnchorRange | null;
|
|
67
|
+
export {};
|
|
@@ -1,5 +1,7 @@
|
|
|
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';
|
|
3
5
|
|
|
4
6
|
declare module '@tiptap/core' {
|
|
5
7
|
interface Commands<ReturnType> {
|
|
@@ -28,6 +30,18 @@ declare module '@tiptap/core' {
|
|
|
28
30
|
* Unset comment active
|
|
29
31
|
*/
|
|
30
32
|
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;
|
|
31
45
|
};
|
|
32
46
|
}
|
|
33
47
|
}
|
|
@@ -45,6 +59,18 @@ export interface CommentOptions {
|
|
|
45
59
|
export interface CommentStorage {
|
|
46
60
|
activeCommentId: string | null;
|
|
47
61
|
}
|
|
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;
|
|
48
74
|
export interface IComment {
|
|
49
75
|
id?: string;
|
|
50
76
|
tabId?: string;
|
|
@@ -63,3 +89,4 @@ export interface IComment {
|
|
|
63
89
|
version?: string;
|
|
64
90
|
}
|
|
65
91
|
export declare const CommentExtension: Mark<CommentOptions, CommentStorage>;
|
|
92
|
+
export {};
|
|
@@ -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('
|
|
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>)[];
|
|
18
18
|
export declare const createInputRule: (pattern: RegExp, data: string, type: NodeType) => InputRule;
|
|
@@ -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";
|
|
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';
|
|
7
7
|
export interface HeadlessEditorExportOption {
|
|
8
8
|
content: string;
|
|
9
9
|
fileName?: string;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Dispatch, MutableRefObject, SetStateAction } from 'react';
|
|
2
|
-
import { DdocProps
|
|
2
|
+
import { DdocProps } from '../types';
|
|
3
3
|
import { AnyExtension, Editor } from '@tiptap/react';
|
|
4
|
+
import { CommentAnchor } from '../extensions/comment/comment-decoration-plugin';
|
|
4
5
|
import { ToCItemType } from '../components/toc/types';
|
|
5
6
|
import { CollabConnectionConfig, CollaborationProps } from '../sync-local/types';
|
|
6
7
|
|
|
@@ -45,10 +46,10 @@ interface UseTabEditorArgs {
|
|
|
45
46
|
externalExtensions?: Record<string, AnyExtension>;
|
|
46
47
|
isContentLoading?: boolean;
|
|
47
48
|
activeTabId: string;
|
|
48
|
-
theme?:
|
|
49
|
+
theme?: 'dark' | 'light';
|
|
49
50
|
editorRef?: MutableRefObject<Editor | null>;
|
|
50
51
|
}
|
|
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,
|
|
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) => {
|
|
52
53
|
editor: Editor | null;
|
|
53
54
|
ref: import('react').RefObject<HTMLDivElement>;
|
|
54
55
|
slides: string[];
|
|
@@ -59,5 +60,6 @@ export declare const useTabEditor: ({ ydoc, isVersionMode, hasTabState, versionI
|
|
|
59
60
|
setActiveCommentId: Dispatch<SetStateAction<string | null>>;
|
|
60
61
|
focusCommentWithActiveId: (id: string) => void;
|
|
61
62
|
isContentLoading: boolean | undefined;
|
|
63
|
+
commentAnchorsRef: MutableRefObject<CommentAnchor[]>;
|
|
62
64
|
};
|
|
63
65
|
export {};
|
|
@@ -10,13 +10,12 @@ interface UseTabManagerArgs {
|
|
|
10
10
|
createDefaultTabIfMissing: boolean;
|
|
11
11
|
shouldSyncActiveTab: boolean;
|
|
12
12
|
defaultTabId?: string;
|
|
13
|
-
preferFirstTabOnInit?: boolean;
|
|
14
13
|
onVersionHistoryActiveTabChange?: (tabId: string | null) => void;
|
|
15
14
|
getEditor?: () => Editor | null;
|
|
16
15
|
flushPendingUpdate?: () => void;
|
|
17
16
|
}
|
|
18
17
|
export declare const getNewTabId: () => string;
|
|
19
|
-
export declare const useTabManager: ({ ydoc, initialContent, enableCollaboration, isDDocOwner, createDefaultTabIfMissing, shouldSyncActiveTab, defaultTabId,
|
|
18
|
+
export declare const useTabManager: ({ ydoc, initialContent, enableCollaboration, isDDocOwner, createDefaultTabIfMissing, shouldSyncActiveTab, defaultTabId, onVersionHistoryActiveTabChange, flushPendingUpdate, getEditor, }: UseTabManagerArgs) => {
|
|
20
19
|
tabs: Tab[];
|
|
21
20
|
hasTabState: boolean;
|
|
22
21
|
activeTabId: string;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { Editor } from '@tiptap/core';
|
|
3
|
+
import { IComment } from '../extensions/comment';
|
|
4
|
+
import { CommentAnchor } from '../extensions/comment/comment-decoration-plugin';
|
|
5
|
+
import { CommentMutationMeta, SerializedCommentAnchor } from '../types';
|
|
6
|
+
|
|
7
|
+
import * as Y from 'yjs';
|
|
8
|
+
export interface CommentStoreProviderProps {
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
editor: Editor | null;
|
|
11
|
+
ydoc: Y.Doc;
|
|
12
|
+
isFocusMode?: boolean;
|
|
13
|
+
setActiveCommentId: (id: string | null) => void;
|
|
14
|
+
focusCommentWithActiveId: (id: string) => void;
|
|
15
|
+
setInitialComments?: React.Dispatch<React.SetStateAction<IComment[]>>;
|
|
16
|
+
onNewComment?: (comment: IComment, meta?: CommentMutationMeta) => void;
|
|
17
|
+
onEditComment?: (commentId: string, meta?: CommentMutationMeta) => void;
|
|
18
|
+
onEditReply?: (commentId: string, replyId: string, meta?: CommentMutationMeta) => void;
|
|
19
|
+
onCommentReply?: (activeCommentId: string, reply: IComment) => void;
|
|
20
|
+
onResolveComment?: (commentId: string, meta?: CommentMutationMeta) => void;
|
|
21
|
+
onUnresolveComment?: (commentId: string, meta?: CommentMutationMeta) => void;
|
|
22
|
+
onDeleteComment?: (commentId: string, meta?: CommentMutationMeta) => void;
|
|
23
|
+
onInlineComment?: () => void;
|
|
24
|
+
onComment?: () => void;
|
|
25
|
+
setCommentDrawerOpen?: (open: boolean) => void;
|
|
26
|
+
connectViaWallet?: () => Promise<void>;
|
|
27
|
+
connectViaUsername?: (username: string) => Promise<void>;
|
|
28
|
+
ensResolutionUrl: string;
|
|
29
|
+
commentAnchorsRef?: React.MutableRefObject<CommentAnchor[]>;
|
|
30
|
+
initialCommentAnchors?: SerializedCommentAnchor[];
|
|
31
|
+
initialComments: IComment[];
|
|
32
|
+
username: string | null;
|
|
33
|
+
activeCommentId: string | null;
|
|
34
|
+
activeTabId: string;
|
|
35
|
+
isConnected?: boolean;
|
|
36
|
+
isLoading?: boolean;
|
|
37
|
+
isDDocOwner?: boolean;
|
|
38
|
+
setUsername?: React.Dispatch<React.SetStateAction<string>>;
|
|
39
|
+
}
|
|
40
|
+
export declare const CommentStoreProvider: ({ children, editor, ydoc, isFocusMode, setActiveCommentId, focusCommentWithActiveId, setInitialComments, onNewComment, onEditComment, onEditReply, onCommentReply, onResolveComment, onUnresolveComment, onDeleteComment, onInlineComment, onComment, setCommentDrawerOpen, connectViaWallet, connectViaUsername, ensResolutionUrl, commentAnchorsRef, initialCommentAnchors, setUsername: setUsernameProp, initialComments, username, activeCommentId, activeTabId, isConnected, isLoading, isDDocOwner, }: CommentStoreProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
41
|
+
interface CommentRefsContextType {
|
|
42
|
+
commentsSectionRef: React.RefObject<HTMLDivElement>;
|
|
43
|
+
replySectionRef: React.RefObject<HTMLDivElement>;
|
|
44
|
+
portalRef: React.RefObject<HTMLDivElement>;
|
|
45
|
+
buttonRef: React.RefObject<HTMLDivElement>;
|
|
46
|
+
dropdownRef: React.RefObject<HTMLDivElement>;
|
|
47
|
+
mobileDraftRef: React.RefObject<HTMLDivElement>;
|
|
48
|
+
}
|
|
49
|
+
export declare const useCommentRefs: () => CommentRefsContextType;
|
|
50
|
+
export {};
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { Editor } from '@tiptap/react';
|
|
2
|
+
import { default as React } from 'react';
|
|
3
|
+
import { CommentAnchor } from '../extensions/comment/comment-decoration-plugin';
|
|
4
|
+
import { CommentFloatingCard, EnsCache, InlineCommentData, InlineCommentDraft, InlineDraftLocation } from '../components/inline-comment/context/types';
|
|
5
|
+
import { EnsStatus } from '../components/inline-comment/types';
|
|
6
|
+
import { IComment } from '../extensions/comment';
|
|
7
|
+
import { CommentMutationMeta, CommentMutationType } from '../types';
|
|
8
|
+
|
|
9
|
+
import * as Y from 'yjs';
|
|
10
|
+
export interface CommentExternalDeps {
|
|
11
|
+
editor: Editor | null;
|
|
12
|
+
ydoc: Y.Doc;
|
|
13
|
+
setActiveCommentId: (id: string | null) => void;
|
|
14
|
+
focusCommentWithActiveId: (id: string) => void;
|
|
15
|
+
setInitialComments?: React.Dispatch<React.SetStateAction<IComment[]>>;
|
|
16
|
+
setUsername?: React.Dispatch<React.SetStateAction<string>>;
|
|
17
|
+
onNewComment?: (comment: IComment, meta?: CommentMutationMeta) => void;
|
|
18
|
+
onEditComment?: (commentId: string, meta?: CommentMutationMeta) => void;
|
|
19
|
+
onEditReply?: (commentId: string, replyId: string, meta?: CommentMutationMeta) => void;
|
|
20
|
+
onCommentReply?: (activeCommentId: string, reply: IComment) => void;
|
|
21
|
+
onResolveComment?: (commentId: string, meta?: CommentMutationMeta) => void;
|
|
22
|
+
onUnresolveComment?: (commentId: string, meta?: CommentMutationMeta) => void;
|
|
23
|
+
onDeleteComment?: (commentId: string, meta?: CommentMutationMeta) => void;
|
|
24
|
+
onInlineComment?: () => void;
|
|
25
|
+
onComment?: () => void;
|
|
26
|
+
setCommentDrawerOpen?: (open: boolean) => void;
|
|
27
|
+
connectViaWallet?: () => Promise<void>;
|
|
28
|
+
connectViaUsername?: (username: string) => Promise<void>;
|
|
29
|
+
ensResolutionUrl: string;
|
|
30
|
+
commentAnchorsRef?: React.MutableRefObject<CommentAnchor[]>;
|
|
31
|
+
}
|
|
32
|
+
type FloatingCardsUpdater = React.SetStateAction<CommentFloatingCard[]>;
|
|
33
|
+
type InlineCommentDataUpdater = Partial<InlineCommentData> | ((prev: InlineCommentData) => Partial<InlineCommentData> | InlineCommentData);
|
|
34
|
+
type InlineDraftRecordMap = Record<string, InlineCommentDraft>;
|
|
35
|
+
type CreateInlineDraftOptions = {
|
|
36
|
+
location?: InlineDraftLocation;
|
|
37
|
+
tabId?: string;
|
|
38
|
+
allowEmptySelection?: boolean;
|
|
39
|
+
};
|
|
40
|
+
type CommentEditRequest = {
|
|
41
|
+
requestId: string;
|
|
42
|
+
kind: 'comment' | 'reply';
|
|
43
|
+
commentId: string;
|
|
44
|
+
replyId?: string;
|
|
45
|
+
text: string;
|
|
46
|
+
};
|
|
47
|
+
type ReplyEditTarget = {
|
|
48
|
+
kind: 'comment' | 'reply';
|
|
49
|
+
commentId: string;
|
|
50
|
+
replyId?: string;
|
|
51
|
+
originalText: string;
|
|
52
|
+
};
|
|
53
|
+
type CommentEditCompletion = {
|
|
54
|
+
nonce: number;
|
|
55
|
+
kind: 'comment' | 'reply';
|
|
56
|
+
commentId: string;
|
|
57
|
+
replyId?: string;
|
|
58
|
+
};
|
|
59
|
+
export interface CommentStoreState {
|
|
60
|
+
initialComments: IComment[];
|
|
61
|
+
tabComments: IComment[];
|
|
62
|
+
activeComments: IComment[];
|
|
63
|
+
activeComment: IComment | undefined;
|
|
64
|
+
activeCommentIndex: number;
|
|
65
|
+
username: string | null;
|
|
66
|
+
activeCommentId: string | null;
|
|
67
|
+
activeTabId: string;
|
|
68
|
+
isConnected: boolean;
|
|
69
|
+
isLoading: boolean;
|
|
70
|
+
isDDocOwner: boolean;
|
|
71
|
+
onComment: (() => void) | null;
|
|
72
|
+
setCommentDrawerOpen: ((open: boolean) => void) | null;
|
|
73
|
+
connectViaWallet: (() => Promise<void>) | null;
|
|
74
|
+
connectViaUsername: ((username: string) => Promise<void>) | null;
|
|
75
|
+
isCommentActive: boolean;
|
|
76
|
+
isCommentResolved: boolean;
|
|
77
|
+
showResolved: boolean;
|
|
78
|
+
reply: string;
|
|
79
|
+
comment: string;
|
|
80
|
+
openReplyId: string | null;
|
|
81
|
+
selectedText: string;
|
|
82
|
+
isCommentOpen: boolean;
|
|
83
|
+
isBubbleMenuSuppressed: boolean;
|
|
84
|
+
inlineCommentData: InlineCommentData;
|
|
85
|
+
floatingCards: CommentFloatingCard[];
|
|
86
|
+
inlineDrafts: InlineDraftRecordMap;
|
|
87
|
+
activeDraftId: string | null;
|
|
88
|
+
isDesktopFloatingEnabled: boolean;
|
|
89
|
+
ensCache: EnsCache;
|
|
90
|
+
inProgressFetch: string[];
|
|
91
|
+
editRequest: CommentEditRequest | null;
|
|
92
|
+
replyEditTarget: ReplyEditTarget | null;
|
|
93
|
+
editCompletion: CommentEditCompletion | null;
|
|
94
|
+
_externalDepsRef: React.RefObject<CommentExternalDeps | null> | null;
|
|
95
|
+
setExternalDepsRef: (ref: React.RefObject<CommentExternalDeps | null>) => void;
|
|
96
|
+
_recomputeDerived: () => void;
|
|
97
|
+
setInitialComments: (comments: IComment[]) => void;
|
|
98
|
+
setUsername: (username: string | null) => void;
|
|
99
|
+
setActiveCommentId: (id: string | null) => void;
|
|
100
|
+
setActiveTabId: (tabId: string) => void;
|
|
101
|
+
setIsConnected: (connected: boolean) => void;
|
|
102
|
+
setIsLoading: (loading: boolean) => void;
|
|
103
|
+
setIsDDocOwner: (isOwner: boolean) => void;
|
|
104
|
+
setOnComment: (fn: (() => void) | null) => void;
|
|
105
|
+
setCommentDrawerOpenFn: (fn: ((open: boolean) => void) | null) => void;
|
|
106
|
+
setConnectViaWallet: (fn: (() => Promise<void>) | null) => void;
|
|
107
|
+
setConnectViaUsername: (fn: ((username: string) => Promise<void>) | null) => void;
|
|
108
|
+
setIsCommentActive: (active: boolean) => void;
|
|
109
|
+
setIsCommentResolved: (resolved: boolean) => void;
|
|
110
|
+
getTabComments: () => IComment[];
|
|
111
|
+
getActiveComment: () => IComment | undefined;
|
|
112
|
+
getActiveComments: () => IComment[];
|
|
113
|
+
getActiveCommentIndex: () => number;
|
|
114
|
+
getIsCommentActive: () => boolean;
|
|
115
|
+
getIsCommentResolved: () => boolean;
|
|
116
|
+
setShowResolved: (show: boolean) => void;
|
|
117
|
+
setReply: (reply: string) => void;
|
|
118
|
+
setComment: (comment: string) => void;
|
|
119
|
+
setOpenReplyId: (id: string | null) => void;
|
|
120
|
+
setSelectedText: (text: string) => void;
|
|
121
|
+
setIsCommentOpen: (open: boolean) => void;
|
|
122
|
+
setIsBubbleMenuSuppressed: (suppressed: boolean) => void;
|
|
123
|
+
setInlineCommentData: (data: InlineCommentDataUpdater) => void;
|
|
124
|
+
setFloatingCards: (floatingCards: FloatingCardsUpdater) => void;
|
|
125
|
+
clearFloatingCards: () => void;
|
|
126
|
+
setActiveDraftId: (draftId: string | null) => void;
|
|
127
|
+
setIsDesktopFloatingEnabled: (enabled: boolean) => void;
|
|
128
|
+
toggleResolved: () => void;
|
|
129
|
+
clearEditRequest: (requestId: string) => void;
|
|
130
|
+
setReplyEditTarget: (target: ReplyEditTarget | null) => void;
|
|
131
|
+
cancelReplyEdit: () => void;
|
|
132
|
+
handleInput: (e: React.FormEvent<HTMLTextAreaElement>, content: string) => void;
|
|
133
|
+
handleReplyChange: (e: React.ChangeEvent<HTMLTextAreaElement>) => void;
|
|
134
|
+
handleCommentChange: (e: React.ChangeEvent<HTMLTextAreaElement>) => void;
|
|
135
|
+
handleCommentKeyDown: (e: React.KeyboardEvent<HTMLTextAreaElement>, tabId?: string) => void;
|
|
136
|
+
handleReplyKeyDown: (e: React.KeyboardEvent<HTMLTextAreaElement>) => void;
|
|
137
|
+
handleReplySubmit: () => void;
|
|
138
|
+
handleCommentSubmit: (tabId?: string) => void;
|
|
139
|
+
handleInlineComment: () => void;
|
|
140
|
+
addComment: (content?: string, usernameProp?: string) => string | undefined;
|
|
141
|
+
createFloatingDraft: (options?: CreateInlineDraftOptions) => string | null;
|
|
142
|
+
updateInlineDraftText: (draftId: string, value: string) => void;
|
|
143
|
+
cancelInlineDraft: (draftId: string) => void;
|
|
144
|
+
submitInlineDraft: (draftId: string) => void;
|
|
145
|
+
updateFloatingDraftText: (draftId: string, value: string) => void;
|
|
146
|
+
cancelFloatingDraft: (draftId: string) => void;
|
|
147
|
+
submitFloatingDraft: (draftId: string) => void;
|
|
148
|
+
openFloatingThread: (commentId: string) => void;
|
|
149
|
+
closeFloatingCard: (floatingCardId: string) => void;
|
|
150
|
+
blurFloatingCard: (floatingCardId: string) => void;
|
|
151
|
+
focusFloatingCard: (floatingCardId: string) => void;
|
|
152
|
+
removeInvalidFloatingCards: () => void;
|
|
153
|
+
syncFloatingThreadCardWithActiveComment: () => void;
|
|
154
|
+
submitPendingFloatingDrafts: () => void;
|
|
155
|
+
/**
|
|
156
|
+
* Apply anchor edits to local comment state.
|
|
157
|
+
* Called after transaction analysis identifies edited anchors.
|
|
158
|
+
* Updates selectedContent for each affected comment
|
|
159
|
+
* so thread display stays in sync immediately, before consumer rehydration.
|
|
160
|
+
*/
|
|
161
|
+
applyCommentAnchorEdits: (edits: Array<{
|
|
162
|
+
commentId: string;
|
|
163
|
+
selectedContent: string;
|
|
164
|
+
}>) => void;
|
|
165
|
+
resolveComment: (commentId: string) => void;
|
|
166
|
+
unresolveComment: (commentId: string) => void;
|
|
167
|
+
deleteComment: (commentId: string, options?: {
|
|
168
|
+
skipExternalCallback?: boolean;
|
|
169
|
+
}) => void;
|
|
170
|
+
deleteReply: (commentId: string, replyId: string) => void;
|
|
171
|
+
requestEditComment: (commentId: string) => void;
|
|
172
|
+
requestEditReply: (commentId: string, replyId: string) => void;
|
|
173
|
+
editCommentContent: (commentId: string, content: string) => void;
|
|
174
|
+
editReplyContent: (commentId: string, replyId: string, content: string) => void;
|
|
175
|
+
handleAddReply: (activeCommentId: string, replyContent: string, replyCallback?: (activeCommentId: string, reply: IComment) => void) => void;
|
|
176
|
+
focusCommentInEditor: (commentId: string) => void;
|
|
177
|
+
onPrevComment: () => void;
|
|
178
|
+
onNextComment: () => void;
|
|
179
|
+
getEnsStatus: (walletAddress: string, setEnsStatus: React.Dispatch<React.SetStateAction<EnsStatus>>) => void;
|
|
180
|
+
createMutationMeta: (type: CommentMutationType, mutate: () => boolean) => CommentMutationMeta | undefined;
|
|
181
|
+
}
|
|
182
|
+
export declare const createCommentStore: () => import('zustand').StoreApi<CommentStoreState>;
|
|
183
|
+
export declare const CommentStoreContext: React.Context<import('zustand').StoreApi<CommentStoreState> | null>;
|
|
184
|
+
export declare function useCommentStore<T>(selector: (state: CommentStoreState) => T): T;
|
|
185
|
+
export {};
|
|
@@ -14,9 +14,6 @@ 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;
|
|
20
17
|
private _awarenessUpdateHandler;
|
|
21
18
|
private ydoc;
|
|
22
19
|
private servicesRef;
|
|
@@ -37,15 +34,6 @@ export declare class SyncManager {
|
|
|
37
34
|
disconnect(): Promise<void>;
|
|
38
35
|
terminateSession(): Promise<void>;
|
|
39
36
|
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;
|
|
49
37
|
forceCleanup(): void;
|
|
50
38
|
private handleConnectionError;
|
|
51
39
|
private handleReconnection;
|
|
@@ -109,10 +109,6 @@ 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
|
-
}>;
|
|
116
112
|
}
|
|
117
113
|
export declare enum ServerErrorCode {
|
|
118
114
|
AUTH_TOKEN_MISSING = "AUTH_TOKEN_MISSING",
|