@fileverse-dev/ddoc 5.1.9 → 6.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 -19
- package/dist/headless-editor-utils.es.js +3 -3
- package/dist/{index-DtE1zaH8.mjs → index-8MQH4TSF.mjs} +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.es.js +10142 -9893
- package/dist/{markdown-source-pane-CA4cDQyu.mjs → markdown-source-pane-CXO7aIOp.mjs} +1 -1
- package/dist/package/components/editor-navbar.d.ts +12 -0
- package/dist/package/components/fullscreen-toolbar.d.ts +2 -2
- 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/sync-local/socketClient.d.ts +2 -0
- package/dist/package/sync-local/types/index.d.ts +3 -0
- package/dist/package/types.d.ts +39 -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/{split-view-toolbar-8eYCwI8J.mjs → split-view-toolbar-BnfwwwTs.mjs} +1 -1
- package/dist/style.css +1 -1
- package/dist/{use-headless-editor-tZq6fxul.mjs → use-headless-editor-Buqsz3UI.mjs} +7628 -7612
- package/package.json +2 -2
- package/tailwind.preset.cjs +42 -0
|
@@ -3,7 +3,7 @@ var Wr = (t, e, O) => e in t ? Vr(t, e, { enumerable: !0, configurable: !0, writ
|
|
|
3
3
|
var gt = (t, e, O) => Wr(t, typeof e != "symbol" ? e + "" : e, O);
|
|
4
4
|
import { jsx as Cr } from "react/jsx-runtime";
|
|
5
5
|
import { useRef as pe, useEffect as St } from "react";
|
|
6
|
-
import { s as y, A as pO, T as dO, a as Gr, S as et, b as Lr, P as fO, E as j, i as QO, c as _, D as le, k as tt, F as Ar, M as Pt, W as Er, R as Ur, d as mO, N as oe, e as V, f as Mr, g as Ot, h as ce, p as $O, j as Y, t as h, l as Ir, I as rt, L as at, m as ye, n as ue, o as Qe, q as gO, r as te, u as SO, v as Br, w as Nr, x as PO, y as kO, z as Dr, B as Fr, C as Kr, G as Oe, H as ZO, J as Jr, K as kt, O as Hr, Q as ea, U as ta, V as Oa, X as ra, Y as aa, Z as ia, _ as sa, $ as na, a0 as la, a1 as oa, a2 as ca } from "./index-
|
|
6
|
+
import { s as y, A as pO, T as dO, a as Gr, S as et, b as Lr, P as fO, E as j, i as QO, c as _, D as le, k as tt, F as Ar, M as Pt, W as Er, R as Ur, d as mO, N as oe, e as V, f as Mr, g as Ot, h as ce, p as $O, j as Y, t as h, l as Ir, I as rt, L as at, m as ye, n as ue, o as Qe, q as gO, r as te, u as SO, v as Br, w as Nr, x as PO, y as kO, z as Dr, B as Fr, C as Kr, G as Oe, H as ZO, J as Jr, K as kt, O as Hr, Q as ea, U as ta, V as Oa, X as ra, Y as aa, Z as ia, _ as sa, $ as na, a0 as la, a1 as oa, a2 as ca } from "./index-8MQH4TSF.mjs";
|
|
7
7
|
class ua {
|
|
8
8
|
/**
|
|
9
9
|
Create a new completion context. (Mostly useful for testing
|
|
@@ -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,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>;
|
|
@@ -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>;
|
|
@@ -8,6 +8,7 @@ interface ISocketClientConfig {
|
|
|
8
8
|
ownerEdSecret?: string;
|
|
9
9
|
contractAddress?: string;
|
|
10
10
|
ownerAddress?: string;
|
|
11
|
+
ddocId?: string;
|
|
11
12
|
editLock?: string;
|
|
12
13
|
encryptedTitle?: string;
|
|
13
14
|
identityToken?: string;
|
|
@@ -74,6 +75,7 @@ export declare class SocketClient {
|
|
|
74
75
|
private ownerUcan?;
|
|
75
76
|
private collaborationUcan?;
|
|
76
77
|
private ownerAddress?;
|
|
78
|
+
private ddocId?;
|
|
77
79
|
private editLock?;
|
|
78
80
|
private encryptedTitle?;
|
|
79
81
|
private identityToken?;
|
|
@@ -83,6 +83,8 @@ export interface CollabConnectionConfig {
|
|
|
83
83
|
ownerEdSecret?: string;
|
|
84
84
|
contractAddress?: string;
|
|
85
85
|
ownerAddress?: string;
|
|
86
|
+
/** Host signal (opaque-link docs): the on-chain ddocId, sent to the server alongside the public room id. */
|
|
87
|
+
ddocId?: string;
|
|
86
88
|
roomInfo?: {
|
|
87
89
|
documentTitle: string;
|
|
88
90
|
portalAddress: string;
|
|
@@ -311,6 +313,7 @@ export interface IAuthArgs {
|
|
|
311
313
|
ownerToken?: string;
|
|
312
314
|
ownerAddress?: string;
|
|
313
315
|
contractAddress?: string;
|
|
316
|
+
ddocId?: string;
|
|
314
317
|
sessionDid?: string;
|
|
315
318
|
roomInfo?: string;
|
|
316
319
|
identityToken?: string;
|
package/dist/package/types.d.ts
CHANGED
|
@@ -116,6 +116,13 @@ export interface DocumentStyling {
|
|
|
116
116
|
*/
|
|
117
117
|
customCSS?: string;
|
|
118
118
|
}
|
|
119
|
+
export type DdocStats = {
|
|
120
|
+
words: number;
|
|
121
|
+
characters: number;
|
|
122
|
+
selectedWords: number;
|
|
123
|
+
/** null until the active tab has been measured. */
|
|
124
|
+
pages: number | null;
|
|
125
|
+
};
|
|
119
126
|
export interface DdocProps extends CommentAccountProps {
|
|
120
127
|
/**
|
|
121
128
|
* Optional catalog of fonts available to the editor in addition to the
|
|
@@ -143,6 +150,8 @@ export interface DdocProps extends CommentAccountProps {
|
|
|
143
150
|
fetchV1ImageFn?: (url: string) => Promise<ArrayBuffer | undefined>;
|
|
144
151
|
disableInlineComment?: boolean;
|
|
145
152
|
commentDrawerOpen?: boolean;
|
|
153
|
+
onCommentDrawerOpenChange?: (open: boolean) => void;
|
|
154
|
+
/** @deprecated Use onCommentDrawerOpenChange. */
|
|
146
155
|
setCommentDrawerOpen?: React.Dispatch<SetStateAction<boolean>>;
|
|
147
156
|
initialComments?: IComment[];
|
|
148
157
|
initialCommentAnchors?: SerializedCommentAnchor[];
|
|
@@ -156,6 +165,8 @@ export interface DdocProps extends CommentAccountProps {
|
|
|
156
165
|
onDeleteComment?: (activeCommentId: string, meta?: CommentMutationMeta) => void;
|
|
157
166
|
onDeleteReply?: (activeCommentId: string, replyId: string) => void;
|
|
158
167
|
showTOC?: boolean;
|
|
168
|
+
onShowTOCChange?: (show: boolean) => void;
|
|
169
|
+
/** @deprecated Use onShowTOCChange. */
|
|
159
170
|
setShowTOC?: React.Dispatch<SetStateAction<boolean>>;
|
|
160
171
|
extensions?: Record<string, Extension | any>;
|
|
161
172
|
selectedTags?: TagType[];
|
|
@@ -165,13 +176,19 @@ export interface DdocProps extends CommentAccountProps {
|
|
|
165
176
|
inlineCommentData?: InlineCommentData;
|
|
166
177
|
setInlineCommentData?: React.Dispatch<React.SetStateAction<InlineCommentData>>;
|
|
167
178
|
theme?: ThemeKey;
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
179
|
+
/** Defaults to '1' when omitted. */
|
|
180
|
+
zoomLevel?: string;
|
|
181
|
+
onZoomLevelChange?: (zoomLevel: string) => void;
|
|
182
|
+
/** @deprecated Use onZoomLevelChange. */
|
|
183
|
+
setZoomLevel?: React.Dispatch<SetStateAction<string>>;
|
|
184
|
+
/** Defaults to true when omitted. */
|
|
185
|
+
isNavbarVisible?: boolean;
|
|
186
|
+
onNavbarVisibleChange?: (visible: boolean) => void;
|
|
187
|
+
/** @deprecated Use onNavbarVisibleChange. */
|
|
188
|
+
setIsNavbarVisible?: React.Dispatch<SetStateAction<boolean>>;
|
|
172
189
|
editorCanvasClassNames?: string;
|
|
173
190
|
isCommentSectionOpen?: boolean;
|
|
174
|
-
isPreviewMode
|
|
191
|
+
isPreviewMode?: boolean;
|
|
175
192
|
viewerMode?: 'suggest' | 'view-only';
|
|
176
193
|
ensResolutionUrl?: string;
|
|
177
194
|
ipfsImageUploadFn?: (file: File) => Promise<IpfsImageUploadResponse>;
|
|
@@ -187,6 +204,11 @@ export interface DdocProps extends CommentAccountProps {
|
|
|
187
204
|
walletAddress?: string | null;
|
|
188
205
|
username?: string | null;
|
|
189
206
|
setUsername?: React.Dispatch<SetStateAction<string>>;
|
|
207
|
+
/**
|
|
208
|
+
* Host element to render the navbar into. Omit to render it as the editor's
|
|
209
|
+
* first row. Pass null while the element is not attached yet.
|
|
210
|
+
*/
|
|
211
|
+
navbarContainer?: HTMLElement | null;
|
|
190
212
|
renderNavbar?: ({ editor, liveEditor, }: {
|
|
191
213
|
/** JSON snapshot — legacy field, unchanged. */
|
|
192
214
|
editor: JSONContent;
|
|
@@ -206,9 +228,15 @@ export interface DdocProps extends CommentAccountProps {
|
|
|
206
228
|
*/
|
|
207
229
|
enableFanficTemplate?: boolean;
|
|
208
230
|
onError?: (error: string) => void;
|
|
231
|
+
/** Active-tab stats. Fires with all four fields whenever one changes. */
|
|
232
|
+
onStatsChange?: (stats: DdocStats) => void;
|
|
233
|
+
/** @deprecated Use onStatsChange. */
|
|
209
234
|
setCharacterCount?: React.Dispatch<SetStateAction<number>>;
|
|
235
|
+
/** @deprecated Use onStatsChange. */
|
|
210
236
|
setWordCount?: React.Dispatch<SetStateAction<number>>;
|
|
237
|
+
/** @deprecated Use onStatsChange. */
|
|
211
238
|
setSelectedWordCount?: React.Dispatch<SetStateAction<number>>;
|
|
239
|
+
/** @deprecated Use onStatsChange. */
|
|
212
240
|
setPageCount?: React.Dispatch<SetStateAction<number>>;
|
|
213
241
|
tags?: Array<{
|
|
214
242
|
name: string;
|
|
@@ -217,12 +245,17 @@ export interface DdocProps extends CommentAccountProps {
|
|
|
217
245
|
className?: string;
|
|
218
246
|
unFocused?: boolean;
|
|
219
247
|
isPresentationMode?: boolean;
|
|
248
|
+
onPresentationModeChange?: (active: boolean) => void;
|
|
249
|
+
/** @deprecated Use onPresentationModeChange. */
|
|
220
250
|
setIsPresentationMode?: React.Dispatch<SetStateAction<boolean>>;
|
|
221
251
|
/** Split View: edit markdown on the left, see the read-only ddoc render on the right. */
|
|
222
252
|
isSplitView?: boolean;
|
|
253
|
+
onSplitViewChange?: (active: boolean) => void;
|
|
254
|
+
/** @deprecated Use onSplitViewChange. */
|
|
223
255
|
setIsSplitView?: React.Dispatch<SetStateAction<boolean>>;
|
|
224
256
|
onComment?: () => void;
|
|
225
257
|
onInlineComment?: () => void;
|
|
258
|
+
/** @deprecated Use onFocusModeChange. Still fires on every change. */
|
|
226
259
|
onFocusMode?: (isFocusMode: boolean) => void;
|
|
227
260
|
/** Controlled focus mode (D6). Omit for the legacy internal-state behavior. */
|
|
228
261
|
isFocusMode?: boolean;
|
|
@@ -248,6 +281,7 @@ export interface DdocProps extends CommentAccountProps {
|
|
|
248
281
|
renderToolbarLeading?: () => React.ReactNode;
|
|
249
282
|
metadataProxyUrl?: string;
|
|
250
283
|
onCopyHeadingLink?: (link: string) => void;
|
|
284
|
+
/** @deprecated No effect. The host footer sits outside the editor. */
|
|
251
285
|
footerHeight?: string;
|
|
252
286
|
activeModel?: CustomModel;
|
|
253
287
|
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, 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, ...rest }: Partial<DdocProps> & {
|
|
6
|
+
export declare const useDdocEditor: ({ isPreviewMode, viewerMode, initialContent, versionHistoryState, collaboration, onChange, 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, ...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;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as m, jsxs as L } from "react/jsx-runtime";
|
|
2
2
|
import { useRef as D, useState as E, useEffect as A } from "react";
|
|
3
3
|
import { DynamicDropdown as P, Tooltip as O, IconButton as T } from "@fileverse/ui";
|
|
4
|
-
import { a3 as _, a4 as w, c as R } from "./index-
|
|
4
|
+
import { a3 as _, a4 as w, c as R } from "./index-8MQH4TSF.mjs";
|
|
5
5
|
const p = (e, n, o = n) => {
|
|
6
6
|
const { state: i } = e, l = i.changeByRange((t) => {
|
|
7
7
|
const d = i.sliceDoc(t.from, t.to), r = i.sliceDoc(
|