@fileverse-dev/ddoc 6.0.2 → 7.0.0-drop-in.0
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/README.md +89 -18
- package/dist/headless-editor-utils.es.js +1 -1
- package/dist/{index-DMZzrBLQ.mjs → index-C2HUe78M.mjs} +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.es.js +7621 -7374
- package/dist/package/components/editor-navbar.d.ts +12 -0
- package/dist/package/components/editor-toolbar.d.ts +2 -1
- package/dist/package/components/fullscreen-toolbar.d.ts +2 -2
- package/dist/package/components/mobile-toolbar.d.ts +2 -1
- package/dist/package/components/tabs/document-mobile-tab-panel.d.ts +3 -1
- package/dist/package/components/tabs/document-tabs-sidebar.d.ts +2 -1
- package/dist/package/components/toc/document-outline.d.ts +1 -1
- package/dist/package/components/toc/toc.d.ts +1 -1
- package/dist/package/components/toc/types.d.ts +7 -0
- package/dist/package/hooks/use-canvas-metrics.d.ts +16 -0
- package/dist/package/hooks/use-controllable-state.d.ts +3 -0
- package/dist/package/hooks/use-editor-media-query.d.ts +4 -0
- package/dist/package/hooks/use-focus-mode.d.ts +1 -3
- package/dist/package/hooks/use-tab-editor.d.ts +4 -1
- package/dist/package/types.d.ts +41 -5
- package/dist/package/use-ddoc-editor.d.ts +3 -1
- package/dist/package/utils/container-query-support.d.ts +1 -0
- package/dist/package/utils/editor-width-store.d.ts +6 -0
- package/dist/package/utils/responsive.d.ts +3 -1
- package/dist/package/utils/stats-publisher.d.ts +8 -0
- package/dist/style.css +1 -1
- package/dist/{use-headless-editor-CjWKprQH.mjs → use-headless-editor-Cipcv5df.mjs} +3945 -3929
- package/package.json +1 -1
- package/tailwind.preset.cjs +42 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Editor } from '@tiptap/react';
|
|
2
|
+
import { DdocProps } from '../types';
|
|
3
|
+
|
|
4
|
+
type EditorNavbarProps = {
|
|
5
|
+
editor: Editor | null;
|
|
6
|
+
renderNavbar?: DdocProps['renderNavbar'];
|
|
7
|
+
/** undefined: in flow. null: host element not attached yet, render nothing. */
|
|
8
|
+
container?: HTMLElement | null;
|
|
9
|
+
isHidden: boolean;
|
|
10
|
+
};
|
|
11
|
+
export declare const EditorNavbar: ({ editor, renderNavbar, container, isHidden, }: EditorNavbarProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
12
|
+
export {};
|
|
@@ -4,7 +4,7 @@ import { FontDescriptor, IpfsImageFetchPayload, IpfsImageUploadResponse } from '
|
|
|
4
4
|
import { Tab } from './tabs/utils/tab-utils';
|
|
5
5
|
|
|
6
6
|
import * as Y from 'yjs';
|
|
7
|
-
declare const MemoizedTiptapToolBar: React.MemoExoticComponent<({ editor, onError, isPresentationMode, setIsPresentationMode, enableCollaboration, zoomLevel, setZoomLevel, isNavbarVisible, setIsNavbarVisible, ipfsImageUploadFn, onMarkdownExport, onMarkdownImport, onPdfExport, onHtmlExport, onTxtExport, onOdtExport, onDocxImport, ipfsImageFetchFn, fetchV1ImageFn, isConnected, tabs, ydoc, onRegisterExportTrigger, toggleFocusMode, isSplitView, onToggleSplitView, fonts: consumerFonts, renderToolbarLeading, }: {
|
|
7
|
+
declare const MemoizedTiptapToolBar: React.MemoExoticComponent<({ editor, onError, isPresentationMode, setIsPresentationMode, enableCollaboration, zoomLevel, setZoomLevel, isNavbarVisible, setIsNavbarVisible, showNavbarToggle, ipfsImageUploadFn, onMarkdownExport, onMarkdownImport, onPdfExport, onHtmlExport, onTxtExport, onOdtExport, onDocxImport, ipfsImageFetchFn, fetchV1ImageFn, isConnected, tabs, ydoc, onRegisterExportTrigger, toggleFocusMode, isSplitView, onToggleSplitView, fonts: consumerFonts, renderToolbarLeading, }: {
|
|
8
8
|
editor: Editor | null;
|
|
9
9
|
onError?: (errorString: string) => void;
|
|
10
10
|
isPresentationMode?: boolean;
|
|
@@ -14,6 +14,7 @@ declare const MemoizedTiptapToolBar: React.MemoExoticComponent<({ editor, onErro
|
|
|
14
14
|
setZoomLevel: (zoom: string) => void;
|
|
15
15
|
isNavbarVisible: boolean;
|
|
16
16
|
setIsNavbarVisible: React.Dispatch<React.SetStateAction<boolean>>;
|
|
17
|
+
showNavbarToggle?: boolean;
|
|
17
18
|
ipfsImageUploadFn?: (file: File) => Promise<IpfsImageUploadResponse>;
|
|
18
19
|
onMarkdownExport?: () => void;
|
|
19
20
|
onMarkdownImport?: () => void;
|
|
@@ -4,8 +4,8 @@ import { DdocProps } from '../types';
|
|
|
4
4
|
type FullScreenToolbarProps = {
|
|
5
5
|
dropdownOpen: boolean;
|
|
6
6
|
setDropdownOpen: Dispatch<SetStateAction<boolean>>;
|
|
7
|
-
zoomLevel:
|
|
8
|
-
setZoomLevel:
|
|
7
|
+
zoomLevel: string;
|
|
8
|
+
setZoomLevel: Dispatch<SetStateAction<string>>;
|
|
9
9
|
showTOC: DdocProps['showTOC'];
|
|
10
10
|
setShowTOC: DdocProps['setShowTOC'];
|
|
11
11
|
toggleFocusMode: () => Promise<void>;
|
|
@@ -2,12 +2,13 @@ import { default as React } from 'react';
|
|
|
2
2
|
import { Editor } from '@tiptap/react';
|
|
3
3
|
import { FontDescriptor, IpfsImageFetchPayload, IpfsImageUploadResponse } from '../types';
|
|
4
4
|
|
|
5
|
-
declare const MemoizedMobileToolbar: React.MemoExoticComponent<({ editor, onError, isKeyboardVisible, isNavbarVisible, setIsNavbarVisible, ipfsImageUploadFn, ipfsImageFetchFn, fetchV1ImageFn, fonts, }: {
|
|
5
|
+
declare const MemoizedMobileToolbar: React.MemoExoticComponent<({ editor, onError, isKeyboardVisible, isNavbarVisible, setIsNavbarVisible, showNavbarToggle, ipfsImageUploadFn, ipfsImageFetchFn, fetchV1ImageFn, fonts, }: {
|
|
6
6
|
editor: Editor | null;
|
|
7
7
|
onError?: (errorString: string) => void;
|
|
8
8
|
isKeyboardVisible: boolean;
|
|
9
9
|
isNavbarVisible: boolean;
|
|
10
10
|
setIsNavbarVisible: React.Dispatch<React.SetStateAction<boolean>>;
|
|
11
|
+
showNavbarToggle?: boolean;
|
|
11
12
|
ipfsImageUploadFn?: (file: File) => Promise<IpfsImageUploadResponse>;
|
|
12
13
|
ipfsImageFetchFn?: (_data: IpfsImageFetchPayload) => Promise<{
|
|
13
14
|
url: string;
|
|
@@ -25,5 +25,7 @@ export interface DocumentMobileTabPanelProps {
|
|
|
25
25
|
isVersionHistoryMode: boolean;
|
|
26
26
|
isConnected?: boolean;
|
|
27
27
|
isFocusMode?: boolean;
|
|
28
|
+
layout?: DocumentOutlineProps['layout'];
|
|
29
|
+
tabPanelSlot?: HTMLElement | null;
|
|
28
30
|
}
|
|
29
|
-
export declare const DocumentMobileTabPanel: ({ tabs, activeTabId, setActiveTabId, editor, items, setItems, orientation, renameTab, createTab, duplicateTab, orderTab, deleteTab, tabCommentCounts, isPreviewMode, tabConfig, isVersionHistoryMode, isConnected, isFocusMode, }: DocumentMobileTabPanelProps) => import("react/jsx-runtime").JSX.Element;
|
|
31
|
+
export declare const DocumentMobileTabPanel: ({ tabs, activeTabId, setActiveTabId, editor, items, setItems, orientation, renameTab, createTab, duplicateTab, orderTab, deleteTab, tabCommentCounts, isPreviewMode, tabConfig, isVersionHistoryMode, isConnected, isFocusMode, layout, tabPanelSlot, }: DocumentMobileTabPanelProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -32,9 +32,10 @@ export interface DocumentTabsSidebarProps {
|
|
|
32
32
|
deleteTab?: (tabId: string) => void;
|
|
33
33
|
isConnected?: boolean;
|
|
34
34
|
isFocusMode?: boolean;
|
|
35
|
+
layout?: DocumentOutlineProps['layout'];
|
|
35
36
|
}
|
|
36
37
|
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;
|
|
38
|
+
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, layout, }: DocumentTabsSidebarProps) => import("react/jsx-runtime").JSX.Element;
|
|
38
39
|
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
40
|
tab: Tab;
|
|
40
41
|
tabIndex: number;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { DocumentOutlineProps } from './types';
|
|
2
2
|
|
|
3
|
-
export declare const DocumentOutline: ({ editor, hasToC, items, setItems, showTOC, setShowTOC, isPreviewMode, orientation, tabs, setTabs, activeTabId, setActiveTabId, createTab, renameTab, duplicateTab, orderTab, ydoc, tabCommentCounts, tabSectionContainer, isVersionHistoryMode, tabConfig, deleteTab, isConnected, isFocusMode, }: DocumentOutlineProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare const DocumentOutline: ({ editor, hasToC, items, setItems, showTOC, setShowTOC, isPreviewMode, orientation, tabs, setTabs, activeTabId, setActiveTabId, createTab, renameTab, duplicateTab, orderTab, ydoc, tabCommentCounts, tabSectionContainer, isVersionHistoryMode, tabConfig, deleteTab, isConnected, isFocusMode, layout, tabPanelSlot, }: DocumentOutlineProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ToCProps, ToCItemProps } from './types';
|
|
2
2
|
|
|
3
|
-
export declare const ToCItem: import('react').MemoExoticComponent<({ item, onItemClick, index, orientation, }: ToCItemProps) => import("react/jsx-runtime").JSX.Element>;
|
|
3
|
+
export declare const ToCItem: import('react').MemoExoticComponent<({ item, onItemClick, index, orientation, isMobile, isWide, }: ToCItemProps) => import("react/jsx-runtime").JSX.Element>;
|
|
4
4
|
export declare const ToCEmptyState: import('react').MemoExoticComponent<() => import("react/jsx-runtime").JSX.Element>;
|
|
5
5
|
export declare const ToC: import('react').MemoExoticComponent<({ items, editor, setItems, orientation }: ToCProps) => import("react/jsx-runtime").JSX.Element>;
|
|
@@ -22,6 +22,10 @@ export type ToCItemProps = {
|
|
|
22
22
|
onItemRemove: (e: React.MouseEvent, id: string) => void;
|
|
23
23
|
index: number;
|
|
24
24
|
orientation?: 'portrait' | 'landscape';
|
|
25
|
+
/** At or below 1280px: the item is in the mobile list. */
|
|
26
|
+
isMobile?: boolean;
|
|
27
|
+
/** At or above 1280px: the item takes the rail's width caps. */
|
|
28
|
+
isWide?: boolean;
|
|
25
29
|
};
|
|
26
30
|
export interface DocumentOutlineProps {
|
|
27
31
|
editor: Editor;
|
|
@@ -54,4 +58,7 @@ export interface DocumentOutlineProps {
|
|
|
54
58
|
deleteTab?: (tabId: string) => void;
|
|
55
59
|
isConnected?: boolean;
|
|
56
60
|
isFocusMode?: boolean;
|
|
61
|
+
/** 'contained': sized from the editor canvas. Only DdocEditor passes it. */
|
|
62
|
+
layout?: 'viewport' | 'contained';
|
|
63
|
+
tabPanelSlot?: HTMLElement | null;
|
|
57
64
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
import { EditorWidthStore } from '../utils/editor-width-store';
|
|
3
|
+
|
|
4
|
+
export declare const computeWidthDecisions: (width: number, scaledWidth: number, leftWidth: number) => {
|
|
5
|
+
shouldHideRight: boolean;
|
|
6
|
+
shouldScroll: boolean;
|
|
7
|
+
};
|
|
8
|
+
type WidthDecisions = ReturnType<typeof computeWidthDecisions>;
|
|
9
|
+
export declare const useCanvasMetrics: ({ canvasRef, rootRef, scaledWidth, leftWidth, widthStore, }: {
|
|
10
|
+
canvasRef: RefObject<HTMLElement | null>;
|
|
11
|
+
rootRef: RefObject<HTMLElement | null>;
|
|
12
|
+
scaledWidth: number;
|
|
13
|
+
leftWidth: number;
|
|
14
|
+
widthStore?: EditorWidthStore;
|
|
15
|
+
}) => WidthDecisions;
|
|
16
|
+
export {};
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
type UseFocusModeOptions = {
|
|
2
|
-
/**
|
|
2
|
+
/** @deprecated Use onFocusModeChange. Still fires on every change. */
|
|
3
3
|
onFocusMode?: (isFocusMode: boolean) => void;
|
|
4
|
-
/** Controlled value (D6). Omit for the legacy internal-state behavior. */
|
|
5
4
|
isFocusMode?: boolean;
|
|
6
|
-
/** Controlled setter — receives the next value instead of internal mutation. */
|
|
7
5
|
onFocusModeChange?: (isFocusMode: boolean) => void;
|
|
8
6
|
};
|
|
9
7
|
export declare const useFocusMode: ({ onFocusMode, isFocusMode: controlledValue, onFocusModeChange, }?: UseFocusModeOptions) => {
|
|
@@ -4,12 +4,14 @@ import { AnyExtension, Editor } from '@tiptap/react';
|
|
|
4
4
|
import { CommentAnchor } from '../extensions/comment/comment-decoration-plugin';
|
|
5
5
|
import { DBlockRuntimeStateRef } from '../extensions/d-block/dblock-runtime';
|
|
6
6
|
import { ToCItemType } from '../components/toc/types';
|
|
7
|
+
import { EditorWidthStore } from '../utils/editor-width-store';
|
|
7
8
|
import { CollabConnectionConfig, CollaborationProps } from '../sync-local/types';
|
|
8
9
|
|
|
9
10
|
import * as Y from 'yjs';
|
|
10
11
|
export declare const TAB_EDITOR_ATTRIBUTES: Record<string, string>;
|
|
11
12
|
interface UseTabEditorArgs {
|
|
12
13
|
ydoc: Y.Doc;
|
|
14
|
+
editorWidthStore?: EditorWidthStore;
|
|
13
15
|
isVersionMode?: boolean;
|
|
14
16
|
hasTabState?: boolean;
|
|
15
17
|
versionId?: string;
|
|
@@ -36,6 +38,7 @@ interface UseTabEditorArgs {
|
|
|
36
38
|
setWordCount?: DdocProps['setWordCount'];
|
|
37
39
|
setSelectedWordCount?: DdocProps['setSelectedWordCount'];
|
|
38
40
|
setPageCount?: DdocProps['setPageCount'];
|
|
41
|
+
onStatsChange?: DdocProps['onStatsChange'];
|
|
39
42
|
setIsContentLoading: Dispatch<SetStateAction<boolean>>;
|
|
40
43
|
setIsCollabContentLoading: Dispatch<SetStateAction<boolean>>;
|
|
41
44
|
unFocused?: boolean;
|
|
@@ -58,7 +61,7 @@ interface UseTabEditorArgs {
|
|
|
58
61
|
dBlockRuntimeStateRef?: DBlockRuntimeStateRef;
|
|
59
62
|
docSchemaVersion?: number;
|
|
60
63
|
}
|
|
61
|
-
export declare const useTabEditor: ({ ydoc, isVersionMode, hasTabState, versionId, isPreviewMode, viewerMode, initialContent, collaboration, isReady, awareness, disableInlineComment, isFocusMode, onCommentInteraction, onError, ipfsImageUploadFn, metadataProxyUrl, onCopyHeadingLink, ipfsImageFetchFn, fetchV1ImageFn, isConnected, activeModel, maxTokens, isAIAgentEnabled, setCharacterCount, setWordCount, setSelectedWordCount, setPageCount, setIsContentLoading, setIsCollabContentLoading, unFocused, zoomLevel, isPresentationMode, onInvalidContentError, ignoreCorruptedData, onConnect, onDisconnect, isIndexeddbSynced, hasCollabContentInitialised, initialiseYjsIndexedDbProvider, externalExtensions, isContentLoading, activeTabId, tabIds, theme, editorRef, initialCommentAnchors, dBlockRuntimeStateRef, docSchemaVersion, }: UseTabEditorArgs) => {
|
|
64
|
+
export declare const useTabEditor: ({ ydoc, editorWidthStore, isVersionMode, hasTabState, versionId, isPreviewMode, viewerMode, initialContent, collaboration, isReady, awareness, disableInlineComment, isFocusMode, onCommentInteraction, onError, ipfsImageUploadFn, metadataProxyUrl, onCopyHeadingLink, ipfsImageFetchFn, fetchV1ImageFn, isConnected, activeModel, maxTokens, isAIAgentEnabled, setCharacterCount, setWordCount, setSelectedWordCount, setPageCount, onStatsChange, setIsContentLoading, setIsCollabContentLoading, unFocused, zoomLevel, isPresentationMode, onInvalidContentError, ignoreCorruptedData, onConnect, onDisconnect, isIndexeddbSynced, hasCollabContentInitialised, initialiseYjsIndexedDbProvider, externalExtensions, isContentLoading, activeTabId, tabIds, theme, editorRef, initialCommentAnchors, dBlockRuntimeStateRef, docSchemaVersion, }: UseTabEditorArgs) => {
|
|
62
65
|
editor: Editor | null;
|
|
63
66
|
cachedEditorEntries: import('./use-tab-editor-cache').CachedTabEditorRenderEntry[];
|
|
64
67
|
ref: import('react').RefObject<HTMLDivElement>;
|
package/dist/package/types.d.ts
CHANGED
|
@@ -126,6 +126,13 @@ export interface DocumentStyling {
|
|
|
126
126
|
*/
|
|
127
127
|
customCSS?: string;
|
|
128
128
|
}
|
|
129
|
+
export type DdocStats = {
|
|
130
|
+
words: number;
|
|
131
|
+
characters: number;
|
|
132
|
+
selectedWords: number;
|
|
133
|
+
/** null until the active tab has been measured. */
|
|
134
|
+
pages: number | null;
|
|
135
|
+
};
|
|
129
136
|
export interface DdocProps extends CommentAccountProps {
|
|
130
137
|
/**
|
|
131
138
|
* Optional catalog of fonts available to the editor in addition to the
|
|
@@ -162,6 +169,8 @@ export interface DdocProps extends CommentAccountProps {
|
|
|
162
169
|
fetchV1ImageFn?: (url: string) => Promise<ArrayBuffer | undefined>;
|
|
163
170
|
disableInlineComment?: boolean;
|
|
164
171
|
commentDrawerOpen?: boolean;
|
|
172
|
+
onCommentDrawerOpenChange?: (open: boolean) => void;
|
|
173
|
+
/** @deprecated Use onCommentDrawerOpenChange. */
|
|
165
174
|
setCommentDrawerOpen?: React.Dispatch<SetStateAction<boolean>>;
|
|
166
175
|
initialComments?: IComment[];
|
|
167
176
|
initialCommentAnchors?: SerializedCommentAnchor[];
|
|
@@ -175,6 +184,8 @@ export interface DdocProps extends CommentAccountProps {
|
|
|
175
184
|
onDeleteComment?: (activeCommentId: string, meta?: CommentMutationMeta) => void;
|
|
176
185
|
onDeleteReply?: (activeCommentId: string, replyId: string) => void;
|
|
177
186
|
showTOC?: boolean;
|
|
187
|
+
onShowTOCChange?: (show: boolean) => void;
|
|
188
|
+
/** @deprecated Use onShowTOCChange. */
|
|
178
189
|
setShowTOC?: React.Dispatch<SetStateAction<boolean>>;
|
|
179
190
|
extensions?: Record<string, Extension | any>;
|
|
180
191
|
selectedTags?: TagType[];
|
|
@@ -184,13 +195,19 @@ export interface DdocProps extends CommentAccountProps {
|
|
|
184
195
|
inlineCommentData?: InlineCommentData;
|
|
185
196
|
setInlineCommentData?: React.Dispatch<React.SetStateAction<InlineCommentData>>;
|
|
186
197
|
theme?: ThemeKey;
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
198
|
+
/** Defaults to '1' when omitted. */
|
|
199
|
+
zoomLevel?: string;
|
|
200
|
+
onZoomLevelChange?: (zoomLevel: string) => void;
|
|
201
|
+
/** @deprecated Use onZoomLevelChange. */
|
|
202
|
+
setZoomLevel?: React.Dispatch<SetStateAction<string>>;
|
|
203
|
+
/** Defaults to true when omitted. */
|
|
204
|
+
isNavbarVisible?: boolean;
|
|
205
|
+
onNavbarVisibleChange?: (visible: boolean) => void;
|
|
206
|
+
/** @deprecated Use onNavbarVisibleChange. */
|
|
207
|
+
setIsNavbarVisible?: React.Dispatch<SetStateAction<boolean>>;
|
|
191
208
|
editorCanvasClassNames?: string;
|
|
192
209
|
isCommentSectionOpen?: boolean;
|
|
193
|
-
isPreviewMode
|
|
210
|
+
isPreviewMode?: boolean;
|
|
194
211
|
viewerMode?: 'suggest' | 'view-only';
|
|
195
212
|
ensResolutionUrl?: string;
|
|
196
213
|
/**
|
|
@@ -215,6 +232,13 @@ export interface DdocProps extends CommentAccountProps {
|
|
|
215
232
|
walletAddress?: string | null;
|
|
216
233
|
username?: string | null;
|
|
217
234
|
setUsername?: React.Dispatch<SetStateAction<string>>;
|
|
235
|
+
/**
|
|
236
|
+
* Host element to render the navbar into. Omit to render it as the editor's
|
|
237
|
+
* first row. Pass null while the element is not attached yet.
|
|
238
|
+
*/
|
|
239
|
+
navbarContainer?: HTMLElement | null;
|
|
240
|
+
/** Show the toolbar's navbar collapse chevron. Default true. */
|
|
241
|
+
showNavbarToggle?: boolean;
|
|
218
242
|
renderNavbar?: ({ editor, liveEditor, }: {
|
|
219
243
|
/** JSON snapshot — legacy field, unchanged. */
|
|
220
244
|
editor: JSONContent;
|
|
@@ -252,9 +276,15 @@ export interface DdocProps extends CommentAccountProps {
|
|
|
252
276
|
*/
|
|
253
277
|
enableFanficTemplate?: boolean;
|
|
254
278
|
onError?: (error: string) => void;
|
|
279
|
+
/** Active-tab stats. Fires with all four fields whenever one changes. */
|
|
280
|
+
onStatsChange?: (stats: DdocStats) => void;
|
|
281
|
+
/** @deprecated Use onStatsChange. */
|
|
255
282
|
setCharacterCount?: React.Dispatch<SetStateAction<number>>;
|
|
283
|
+
/** @deprecated Use onStatsChange. */
|
|
256
284
|
setWordCount?: React.Dispatch<SetStateAction<number>>;
|
|
285
|
+
/** @deprecated Use onStatsChange. */
|
|
257
286
|
setSelectedWordCount?: React.Dispatch<SetStateAction<number>>;
|
|
287
|
+
/** @deprecated Use onStatsChange. */
|
|
258
288
|
setPageCount?: React.Dispatch<SetStateAction<number>>;
|
|
259
289
|
tags?: Array<{
|
|
260
290
|
name: string;
|
|
@@ -263,12 +293,17 @@ export interface DdocProps extends CommentAccountProps {
|
|
|
263
293
|
className?: string;
|
|
264
294
|
unFocused?: boolean;
|
|
265
295
|
isPresentationMode?: boolean;
|
|
296
|
+
onPresentationModeChange?: (active: boolean) => void;
|
|
297
|
+
/** @deprecated Use onPresentationModeChange. */
|
|
266
298
|
setIsPresentationMode?: React.Dispatch<SetStateAction<boolean>>;
|
|
267
299
|
/** Split View: edit markdown on the left, see the read-only ddoc render on the right. */
|
|
268
300
|
isSplitView?: boolean;
|
|
301
|
+
onSplitViewChange?: (active: boolean) => void;
|
|
302
|
+
/** @deprecated Use onSplitViewChange. */
|
|
269
303
|
setIsSplitView?: React.Dispatch<SetStateAction<boolean>>;
|
|
270
304
|
onComment?: () => void;
|
|
271
305
|
onInlineComment?: () => void;
|
|
306
|
+
/** @deprecated Use onFocusModeChange. Still fires on every change. */
|
|
272
307
|
onFocusMode?: (isFocusMode: boolean) => void;
|
|
273
308
|
/** Controlled focus mode (D6). Omit for the legacy internal-state behavior. */
|
|
274
309
|
isFocusMode?: boolean;
|
|
@@ -294,6 +329,7 @@ export interface DdocProps extends CommentAccountProps {
|
|
|
294
329
|
renderToolbarLeading?: () => React.ReactNode;
|
|
295
330
|
metadataProxyUrl?: string;
|
|
296
331
|
onCopyHeadingLink?: (link: string) => void;
|
|
332
|
+
/** @deprecated No effect. The host footer sits outside the editor. */
|
|
297
333
|
footerHeight?: string;
|
|
298
334
|
activeModel?: CustomModel;
|
|
299
335
|
maxTokens?: number;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { DdocProps } from './types';
|
|
2
2
|
import { Editor } from '@tiptap/react';
|
|
3
3
|
import { DBlockRuntimeState } from './extensions/d-block/dblock-runtime';
|
|
4
|
+
import { EditorWidthStore } from './utils/editor-width-store';
|
|
4
5
|
|
|
5
|
-
export declare const useDdocEditor: ({ isPreviewMode, viewerMode, initialContent, versionHistoryState, collaboration, onChange, onLocalChange, isNewDocument, onCollaboratorChange, onCommentInteraction, onError, setCharacterCount, setWordCount, setSelectedWordCount, setPageCount, ipfsImageUploadFn, ddocId, enableIndexeddbSync, unFocused, isFocusMode, theme, zoomLevel, onInvalidContentError, ignoreCorruptedData, isPresentationMode, metadataProxyUrl, extensions: externalExtensions, onCopyHeadingLink, ipfsImageFetchFn, fetchV1ImageFn, isConnected, activeModel, maxTokens, isAIAgentEnabled, onIndexedDbError, disableInlineComment, initialCommentAnchors, isPreviewEditor, fonts, preferredSchemaVersion, onSchemaStampGuard, ...rest }: Partial<DdocProps> & {
|
|
6
|
+
export declare const useDdocEditor: ({ isPreviewMode, viewerMode, initialContent, versionHistoryState, collaboration, onChange, onLocalChange, isNewDocument, onCollaboratorChange, onCommentInteraction, onError, setCharacterCount, setWordCount, setSelectedWordCount, setPageCount, onStatsChange, ipfsImageUploadFn, ddocId, enableIndexeddbSync, unFocused, isFocusMode, theme, zoomLevel, onInvalidContentError, ignoreCorruptedData, isPresentationMode, metadataProxyUrl, extensions: externalExtensions, onCopyHeadingLink, ipfsImageFetchFn, fetchV1ImageFn, isConnected, activeModel, maxTokens, isAIAgentEnabled, onIndexedDbError, disableInlineComment, initialCommentAnchors, isPreviewEditor, fonts, preferredSchemaVersion, editorWidthStore, onSchemaStampGuard, ...rest }: Partial<DdocProps> & {
|
|
6
7
|
isFocusMode?: boolean;
|
|
7
8
|
isPreviewEditor?: boolean;
|
|
9
|
+
editorWidthStore?: EditorWidthStore;
|
|
8
10
|
}) => {
|
|
9
11
|
ydoc: import('yjs').Doc;
|
|
10
12
|
awareness: import('y-protocols/awareness.js').Awareness | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const canUseEditorContainerQueries: () => boolean;
|