@fileverse-dev/ddoc 3.3.7-beta.5 → 3.3.7-m-fixes
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 +36251 -36868
- package/dist/package/extensions/d-block/components/buttons.d.ts +1 -2
- package/dist/package/extensions/d-block/dblock-collapse.d.ts +32 -0
- package/dist/package/extensions/d-block/dblock-media-plugin.d.ts +22 -0
- package/dist/package/extensions/d-block/dblock-node-view.d.ts +34 -3
- package/dist/package/extensions/d-block/dblock-runtime.d.ts +11 -0
- package/dist/package/extensions/d-block/dblock-toolbar.d.ts +9 -0
- package/dist/package/extensions/d-block/dblock-view-registry.d.ts +49 -0
- package/dist/package/extensions/d-block/dblock.d.ts +3 -4
- package/dist/package/extensions/d-block/use-heading-collapse.d.ts +1 -17
- package/dist/package/extensions/default-extension.d.ts +5 -5
- package/dist/package/extensions/table-of-contents.d.ts +11 -0
- package/dist/package/hooks/use-content-item-actions.d.ts +6 -1
- package/dist/package/hooks/use-editing-context.d.ts +0 -1
- package/dist/package/hooks/use-tab-editor.d.ts +10 -3
- package/dist/package/hooks/use-yjs-setup.d.ts +1 -1
- package/dist/package/sync-local/SyncManager.d.ts +0 -5
- package/dist/package/sync-local/useSyncManager.d.ts +1 -1
- package/dist/package/types.d.ts +0 -1
- package/dist/package/use-ddoc-editor.d.ts +7 -3
- package/dist/package/utils/y-prosemirror-cleanup.d.ts +5 -0
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/dist/package/extensions/d-block/components/dblock-controls-layer.d.ts +0 -7
- package/dist/package/extensions/d-block/dblock-dom-node-view.d.ts +0 -21
- package/dist/package/extensions/d-block/dblock-plugin.d.ts +0 -6
- package/dist/package/extensions/d-block/dblock-store.d.ts +0 -42
- package/dist/package/extensions/d-block/heading-collapse-utils.d.ts +0 -21
- package/dist/package/utils/editor-scheduler.d.ts +0 -13
|
@@ -7,9 +7,8 @@ export declare const ActionButton: React.MemoExoticComponent<React.ForwardRefExo
|
|
|
7
7
|
variant?: "ghost";
|
|
8
8
|
className?: string;
|
|
9
9
|
} & React.RefAttributes<HTMLButtonElement>>>;
|
|
10
|
-
export declare const GripButton: React.MemoExoticComponent<({ onClick,
|
|
10
|
+
export declare const GripButton: React.MemoExoticComponent<({ onClick, className, }: {
|
|
11
11
|
onClick: (event: React.MouseEvent<HTMLDivElement>) => void;
|
|
12
|
-
onDragStart?: (event: React.DragEvent<HTMLDivElement>) => void;
|
|
13
12
|
className: string;
|
|
14
13
|
}) => import("react/jsx-runtime").JSX.Element>;
|
|
15
14
|
export declare const PlusButton: React.MemoExoticComponent<({ onClick, className, }: {
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Editor } from '@tiptap/core';
|
|
2
|
+
import { Node as ProseMirrorNode } from '@tiptap/pm/model';
|
|
3
|
+
import { EditorState, Plugin, PluginKey, Transaction } from '@tiptap/pm/state';
|
|
4
|
+
import { DecorationSet } from '@tiptap/pm/view';
|
|
5
|
+
|
|
6
|
+
export declare const DBLOCK_HIDDEN_CLASS = "d-block-hidden";
|
|
7
|
+
export interface HeadingLookup {
|
|
8
|
+
id: string;
|
|
9
|
+
level: number;
|
|
10
|
+
position: number;
|
|
11
|
+
children: string[];
|
|
12
|
+
parent?: string;
|
|
13
|
+
}
|
|
14
|
+
export type HeadingLookupMap = Map<string, HeadingLookup>;
|
|
15
|
+
export interface DBlockRenderMeta {
|
|
16
|
+
isHeading: boolean;
|
|
17
|
+
headingId: string | null;
|
|
18
|
+
isThisHeadingCollapsed: boolean;
|
|
19
|
+
headingAlignment?: string;
|
|
20
|
+
isTable: boolean;
|
|
21
|
+
}
|
|
22
|
+
export declare const getDBlockRenderMeta: (node: ProseMirrorNode, pos: number) => DBlockRenderMeta;
|
|
23
|
+
export declare const getHeadingAlignmentClass: (alignment?: string) => "justify-center" | "justify-end" | "justify-start";
|
|
24
|
+
export declare const getHeadingLinkSlug: (node: ProseMirrorNode, pos: number) => string | null;
|
|
25
|
+
export declare const buildHeadingMap: (doc: ProseMirrorNode) => HeadingLookupMap;
|
|
26
|
+
export declare const shouldHideDBlock: (doc: ProseMirrorNode, node: ProseMirrorNode, position: number, headingMap: HeadingLookupMap) => boolean;
|
|
27
|
+
export declare const findEndOfCollapsedContent: (doc: ProseMirrorNode, headingPos: number) => number;
|
|
28
|
+
export declare const buildToggleHeadingCollapseTransaction: (state: EditorState, position: number) => Transaction | null;
|
|
29
|
+
export declare const toggleHeadingCollapse: (editor: Editor, position: number) => boolean;
|
|
30
|
+
export declare const expandHeadingContent: (editor: Editor, nodePos: number) => boolean;
|
|
31
|
+
export declare const dBlockCollapsePluginKey: PluginKey<DecorationSet>;
|
|
32
|
+
export declare const createDBlockCollapsePlugin: () => Plugin<DecorationSet>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Node as ProseMirrorNode } from '@tiptap/pm/model';
|
|
2
|
+
import { Plugin } from '@tiptap/pm/state';
|
|
3
|
+
import { DBlockRuntimeState } from './dblock-runtime';
|
|
4
|
+
|
|
5
|
+
type MediaCandidate = {
|
|
6
|
+
type: 'img';
|
|
7
|
+
src: string;
|
|
8
|
+
from: number;
|
|
9
|
+
to: number;
|
|
10
|
+
} | {
|
|
11
|
+
type: 'iframe';
|
|
12
|
+
src: string;
|
|
13
|
+
from: number;
|
|
14
|
+
to: number;
|
|
15
|
+
};
|
|
16
|
+
interface MediaPluginState {
|
|
17
|
+
version: number;
|
|
18
|
+
shouldScan: boolean;
|
|
19
|
+
}
|
|
20
|
+
export declare const getDBlockMediaCandidate: (node: ProseMirrorNode, position: number) => MediaCandidate | null;
|
|
21
|
+
export declare const createDBlockMediaConversionPlugin: (getRuntimeState?: () => DBlockRuntimeState) => Plugin<MediaPluginState>;
|
|
22
|
+
export {};
|
|
@@ -1,4 +1,35 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Editor } from '@tiptap/core';
|
|
2
|
+
import { Node as ProseMirrorNode } from '@tiptap/pm/model';
|
|
3
|
+
import { Decoration, NodeView, ViewMutationRecord } from '@tiptap/pm/view';
|
|
4
|
+
import { DBlockRuntimeState } from './dblock-runtime';
|
|
3
5
|
|
|
4
|
-
|
|
6
|
+
interface DBlockNodeViewOptions {
|
|
7
|
+
editor: Editor;
|
|
8
|
+
node: ProseMirrorNode;
|
|
9
|
+
getPos: () => number;
|
|
10
|
+
decorations: readonly Decoration[];
|
|
11
|
+
HTMLAttributes: Record<string, unknown>;
|
|
12
|
+
getRuntimeState?: () => DBlockRuntimeState;
|
|
13
|
+
onCopyHeadingLink?: (link: string) => void;
|
|
14
|
+
}
|
|
15
|
+
export declare class DBlockNodeView implements NodeView {
|
|
16
|
+
node: ProseMirrorNode;
|
|
17
|
+
editor: Editor;
|
|
18
|
+
getPos: () => number;
|
|
19
|
+
dom: HTMLDivElement;
|
|
20
|
+
gutterElement: HTMLElement;
|
|
21
|
+
contentElement: HTMLDivElement;
|
|
22
|
+
contentDOM: HTMLDivElement;
|
|
23
|
+
private id;
|
|
24
|
+
private decorations;
|
|
25
|
+
private getRuntimeState?;
|
|
26
|
+
private unregister;
|
|
27
|
+
constructor({ editor, node, getPos, decorations, HTMLAttributes, getRuntimeState, onCopyHeadingLink, }: DBlockNodeViewOptions);
|
|
28
|
+
update(node: ProseMirrorNode, decorations: readonly Decoration[]): boolean;
|
|
29
|
+
ignoreMutation(mutation: ViewMutationRecord): boolean;
|
|
30
|
+
stopEvent(event: Event): boolean;
|
|
31
|
+
destroy(): void;
|
|
32
|
+
private syncDOM;
|
|
33
|
+
private safeGetPos;
|
|
34
|
+
}
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface DBlockRuntimeState {
|
|
2
|
+
isPreviewMode: boolean;
|
|
3
|
+
isPresentationMode: boolean;
|
|
4
|
+
isPreviewEditor: boolean;
|
|
5
|
+
isCollaboratorsDoc: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare const DEFAULT_DBLOCK_RUNTIME_STATE: DBlockRuntimeState;
|
|
8
|
+
export type DBlockRuntimeStateRef = {
|
|
9
|
+
current: DBlockRuntimeState;
|
|
10
|
+
};
|
|
11
|
+
export declare const getDBlockRuntimeState: (getRuntimeState?: () => DBlockRuntimeState) => DBlockRuntimeState;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { Editor } from '@tiptap/react';
|
|
3
|
+
import { DBlockRuntimeState } from './dblock-runtime';
|
|
4
|
+
|
|
5
|
+
export declare const DBlockToolbarProvider: ({ children, editor, runtimeState, }: {
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
editor: Editor | null;
|
|
8
|
+
runtimeState?: DBlockRuntimeState;
|
|
9
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Node as ProseMirrorNode } from '@tiptap/pm/model';
|
|
2
|
+
|
|
3
|
+
export interface DBlockViewHandle {
|
|
4
|
+
id: string;
|
|
5
|
+
dom: HTMLElement;
|
|
6
|
+
gutterElement: HTMLElement;
|
|
7
|
+
contentElement: HTMLElement;
|
|
8
|
+
getPos: () => number;
|
|
9
|
+
getNode: () => ProseMirrorNode;
|
|
10
|
+
refresh: () => void;
|
|
11
|
+
onCopyHeadingLink?: (link: string) => void;
|
|
12
|
+
}
|
|
13
|
+
type DBlockDebugExtra = Record<string, boolean | number | string | null | undefined>;
|
|
14
|
+
interface DestroyedDBlockNodeViewTargets {
|
|
15
|
+
nodeView: object;
|
|
16
|
+
dom: HTMLElement;
|
|
17
|
+
gutterElement: HTMLElement;
|
|
18
|
+
contentElement: HTMLElement;
|
|
19
|
+
contentDOM: HTMLElement;
|
|
20
|
+
}
|
|
21
|
+
export interface DBlockDebugSnapshot {
|
|
22
|
+
event: string;
|
|
23
|
+
label?: string;
|
|
24
|
+
created: number;
|
|
25
|
+
destroyed: number;
|
|
26
|
+
registered: number;
|
|
27
|
+
connected: number;
|
|
28
|
+
detached: number;
|
|
29
|
+
maxRegistered: number;
|
|
30
|
+
unregisterMisses: number;
|
|
31
|
+
[key: string]: boolean | number | string | null | undefined;
|
|
32
|
+
}
|
|
33
|
+
declare global {
|
|
34
|
+
interface Window {
|
|
35
|
+
__ddocDBlockDebug?: {
|
|
36
|
+
snapshot: (label?: string) => DBlockDebugSnapshot;
|
|
37
|
+
destroyedRefsSnapshot: (label?: string) => DBlockDebugSnapshot;
|
|
38
|
+
getStats: () => DBlockDebugSnapshot;
|
|
39
|
+
reset: () => DBlockDebugSnapshot;
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
export declare const logDBlockLifecycleSnapshot: (label: string, extra?: DBlockDebugExtra) => DBlockDebugSnapshot;
|
|
44
|
+
export declare const trackDestroyedDBlockNodeViewRefs: (targets: DestroyedDBlockNodeViewTargets) => void;
|
|
45
|
+
export declare const registerDBlockView: (handle: DBlockViewHandle) => () => void;
|
|
46
|
+
export declare const getDBlockViewFromElement: (element: Element | null) => DBlockViewHandle | null;
|
|
47
|
+
export declare const getDBlockViewFromEventTarget: (target: EventTarget | null) => DBlockViewHandle | null;
|
|
48
|
+
export declare const refreshRegisteredDBlockViews: () => void;
|
|
49
|
+
export {};
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import { Node } from '@tiptap/core';
|
|
2
2
|
import { IpfsImageUploadResponse } from '../../types';
|
|
3
|
+
import { DBlockRuntimeState } from './dblock-runtime';
|
|
3
4
|
|
|
4
5
|
export interface DBlockOptions {
|
|
5
6
|
HTMLAttributes: Record<string, any>;
|
|
6
7
|
ipfsImageUploadFn?: (file: File) => Promise<IpfsImageUploadResponse>;
|
|
7
8
|
onCopyHeadingLink?: (link: string) => void;
|
|
8
9
|
hasAvailableModels: boolean;
|
|
9
|
-
|
|
10
|
-
dBlockNodeViewImplementation?: 'dom' | 'react';
|
|
11
|
-
isPreviewMode?: boolean;
|
|
12
|
-
isPresentationMode?: boolean;
|
|
10
|
+
getRuntimeState?: () => DBlockRuntimeState;
|
|
13
11
|
}
|
|
14
12
|
declare module '@tiptap/core' {
|
|
15
13
|
interface Commands<ReturnType> {
|
|
@@ -19,3 +17,4 @@ declare module '@tiptap/core' {
|
|
|
19
17
|
}
|
|
20
18
|
}
|
|
21
19
|
export declare const DBlock: Node<DBlockOptions, any>;
|
|
20
|
+
export declare const createDBlockExtension: (options?: Partial<DBlockOptions>) => Node<DBlockOptions, any>;
|
|
@@ -1,17 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
interface UseHeadingCollapseProps {
|
|
4
|
-
node: any;
|
|
5
|
-
getPos: () => number;
|
|
6
|
-
editor: Editor;
|
|
7
|
-
}
|
|
8
|
-
export declare const useHeadingCollapse: ({ node, getPos, editor, }: UseHeadingCollapseProps) => {
|
|
9
|
-
isHeading: boolean;
|
|
10
|
-
headingId: any;
|
|
11
|
-
isThisHeadingCollapsed: any;
|
|
12
|
-
shouldBeHidden: boolean;
|
|
13
|
-
toggleCollapse: () => void;
|
|
14
|
-
headingAlignment: any;
|
|
15
|
-
};
|
|
16
|
-
export declare const expandHeadingContent: (editor: Editor, nodePos: number) => void;
|
|
17
|
-
export {};
|
|
1
|
+
export { buildHeadingMap, expandHeadingContent, findEndOfCollapsedContent, getDBlockRenderMeta, getHeadingLinkSlug, shouldHideDBlock, toggleHeadingCollapse, } from './dblock-collapse';
|
|
@@ -2,8 +2,9 @@ import { NodeType } from '@tiptap/pm/model';
|
|
|
2
2
|
import { InputRule } from '@tiptap/core';
|
|
3
3
|
import { IpfsImageFetchPayload, IpfsImageUploadResponse } from '../types';
|
|
4
4
|
import { ToCItemType } from '../components/toc/types';
|
|
5
|
+
import { DBlockRuntimeStateRef } from './d-block/dblock-runtime';
|
|
5
6
|
|
|
6
|
-
export declare const defaultExtensions: ({ ipfsImageFetchFn, onError, metadataProxyUrl, onCopyHeadingLink, ipfsImageUploadFn, fetchV1ImageFn, onTocUpdate,
|
|
7
|
+
export declare const defaultExtensions: ({ ipfsImageFetchFn, onError, metadataProxyUrl, onCopyHeadingLink, ipfsImageUploadFn, fetchV1ImageFn, onTocUpdate, dBlockRuntimeStateRef, hasAvailableModels, }: {
|
|
7
8
|
ipfsImageFetchFn?: (_data: IpfsImageFetchPayload) => Promise<{
|
|
8
9
|
url: string;
|
|
9
10
|
file: File;
|
|
@@ -14,8 +15,7 @@ export declare const defaultExtensions: ({ ipfsImageFetchFn, onError, metadataPr
|
|
|
14
15
|
onCopyHeadingLink?: (link: string) => void;
|
|
15
16
|
fetchV1ImageFn?: (url: string) => Promise<ArrayBuffer | undefined>;
|
|
16
17
|
onTocUpdate?: (data: ToCItemType[], isCreate?: boolean) => void;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}) => (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
|
+
dBlockRuntimeStateRef?: DBlockRuntimeStateRef;
|
|
19
|
+
hasAvailableModels?: boolean;
|
|
20
|
+
}) => (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').Extension<import('@tiptap/extension-table-of-contents').TableOfContentsOptions, import('@tiptap/extension-table-of-contents').TableOfContentsStorage> | 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-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>)[];
|
|
21
21
|
export declare const createInputRule: (pattern: RegExp, data: string, type: NodeType) => InputRule;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Editor } from '@tiptap/core';
|
|
2
|
+
import { TableOfContentsStorage } from '@tiptap/extension-table-of-contents';
|
|
3
|
+
|
|
4
|
+
type EditorWithTableOfContentsStorage = {
|
|
5
|
+
storage?: {
|
|
6
|
+
tableOfContents?: TableOfContentsStorage | null;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
export declare const clearTableOfContentsStorage: (target: Editor | EditorWithTableOfContentsStorage | TableOfContentsStorage | null | undefined) => boolean;
|
|
10
|
+
export declare const DdocTableOfContents: import('@tiptap/core').Extension<import('@tiptap/extension-table-of-contents').TableOfContentsOptions, TableOfContentsStorage>;
|
|
11
|
+
export {};
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { Node } from '@tiptap/pm/model';
|
|
2
2
|
import { Editor } from '@tiptap/react';
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
export interface ResolvedContentItem {
|
|
5
|
+
editor: Editor;
|
|
6
|
+
node: Node;
|
|
7
|
+
pos: number;
|
|
8
|
+
}
|
|
9
|
+
declare const useContentItemActions: (editor: Editor, resolveCurrentBlock: () => ResolvedContentItem | null) => {
|
|
5
10
|
resetTextFormatting: () => void;
|
|
6
11
|
duplicateNode: () => void;
|
|
7
12
|
copyNodeToClipboard: () => void;
|
|
@@ -2,10 +2,16 @@ import { Dispatch, MutableRefObject, SetStateAction } from 'react';
|
|
|
2
2
|
import { DdocProps, SerializedCommentAnchor, ThemeKey } from '../types';
|
|
3
3
|
import { AnyExtension, Editor } from '@tiptap/react';
|
|
4
4
|
import { CommentAnchor } from '../extensions/comment/comment-decoration-plugin';
|
|
5
|
+
import { DBlockRuntimeStateRef } from '../extensions/d-block/dblock-runtime';
|
|
5
6
|
import { ToCItemType } from '../components/toc/types';
|
|
6
7
|
import { CollabConnectionConfig, CollaborationProps } from '../sync-local/types';
|
|
7
8
|
|
|
8
9
|
import * as Y from 'yjs';
|
|
10
|
+
export interface CachedTabEditorRenderEntry {
|
|
11
|
+
tabId: string;
|
|
12
|
+
editor: Editor;
|
|
13
|
+
isActive: boolean;
|
|
14
|
+
}
|
|
9
15
|
interface UseTabEditorArgs {
|
|
10
16
|
ydoc: Y.Doc;
|
|
11
17
|
isVersionMode?: boolean;
|
|
@@ -48,13 +54,15 @@ interface UseTabEditorArgs {
|
|
|
48
54
|
externalExtensions?: Record<string, AnyExtension>;
|
|
49
55
|
isContentLoading?: boolean;
|
|
50
56
|
activeTabId: string;
|
|
57
|
+
tabIds?: string[];
|
|
51
58
|
theme?: ThemeKey;
|
|
52
59
|
editorRef?: MutableRefObject<Editor | null>;
|
|
53
60
|
initialCommentAnchors?: SerializedCommentAnchor[];
|
|
54
|
-
|
|
61
|
+
dBlockRuntimeStateRef?: DBlockRuntimeStateRef;
|
|
55
62
|
}
|
|
56
|
-
export declare const useTabEditor: ({ ydoc, isVersionMode, hasTabState, versionId, isPreviewMode, viewerMode, initialContent, collaboration, isReady, isSyncing, awareness, disableInlineComment, isFocusMode, 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, initialCommentAnchors,
|
|
63
|
+
export declare const useTabEditor: ({ ydoc, isVersionMode, hasTabState, versionId, isPreviewMode, viewerMode, initialContent, collaboration, isReady, isSyncing, awareness, disableInlineComment, isFocusMode, 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, tabIds, theme, editorRef, initialCommentAnchors, dBlockRuntimeStateRef, }: UseTabEditorArgs) => {
|
|
57
64
|
editor: Editor | null;
|
|
65
|
+
cachedEditorEntries: CachedTabEditorRenderEntry[];
|
|
58
66
|
ref: import('react').RefObject<HTMLDivElement>;
|
|
59
67
|
slides: string[];
|
|
60
68
|
setSlides: Dispatch<SetStateAction<string[]>>;
|
|
@@ -67,6 +75,5 @@ export declare const useTabEditor: ({ ydoc, isVersionMode, hasTabState, versionI
|
|
|
67
75
|
commentAnchorsRef: MutableRefObject<CommentAnchor[]>;
|
|
68
76
|
draftAnchorsRef: MutableRefObject<CommentAnchor[]>;
|
|
69
77
|
storeApiRef: MutableRefObject<import('zustand').StoreApi<import('../stores/comment-store').CommentStoreState> | null>;
|
|
70
|
-
editorSessionKey: string;
|
|
71
78
|
};
|
|
72
79
|
export {};
|
|
@@ -13,7 +13,7 @@ export declare const useYjsSetup: ({ onChange, enableIndexeddbSync, ddocId, coll
|
|
|
13
13
|
onConnect: (connectConfig: import('../types').CollabConnectionConfig) => void;
|
|
14
14
|
isReady: boolean;
|
|
15
15
|
isSyncing: boolean;
|
|
16
|
-
terminateSession: () =>
|
|
16
|
+
terminateSession: () => void;
|
|
17
17
|
awareness: import('y-protocols/awareness.js').Awareness | null;
|
|
18
18
|
hasCollabContentInitialised: boolean;
|
|
19
19
|
isIndexeddbSynced: boolean;
|
|
@@ -15,10 +15,7 @@ export declare class SyncManager {
|
|
|
15
15
|
private contentTobeAppliedQueue;
|
|
16
16
|
private isProcessing;
|
|
17
17
|
private flushTimer;
|
|
18
|
-
private remotePersistenceTask;
|
|
19
|
-
private pendingRemotePersistenceUpdates;
|
|
20
18
|
private readonly FLUSH_INTERVAL_MS;
|
|
21
|
-
private readonly REMOTE_PERSISTENCE_INTERVAL_MS;
|
|
22
19
|
private readonly MAX_QUEUE_SIZE;
|
|
23
20
|
private _awarenessUpdateHandler;
|
|
24
21
|
private ydoc;
|
|
@@ -49,8 +46,6 @@ export declare class SyncManager {
|
|
|
49
46
|
* ACK callback handles updateId tracking and auto-commit asynchronously.
|
|
50
47
|
*/
|
|
51
48
|
private sendUpdateBatch;
|
|
52
|
-
private scheduleRemotePersistence;
|
|
53
|
-
private flushRemotePersistence;
|
|
54
49
|
forceCleanup(): void;
|
|
55
50
|
private handleConnectionError;
|
|
56
51
|
private handleReconnection;
|
|
@@ -4,7 +4,7 @@ export declare const useSyncManager: (config: SyncManagerConfig) => {
|
|
|
4
4
|
state: CollabState;
|
|
5
5
|
connect: (connectConfig: CollabConnectionConfig) => void;
|
|
6
6
|
disconnect: () => void;
|
|
7
|
-
terminateSession: () =>
|
|
7
|
+
terminateSession: () => void;
|
|
8
8
|
isReady: boolean;
|
|
9
9
|
isSyncing: boolean;
|
|
10
10
|
awareness: import('y-protocols/awareness.js').Awareness | null;
|
package/dist/package/types.d.ts
CHANGED
|
@@ -157,7 +157,6 @@ export interface DdocProps extends CommentAccountProps {
|
|
|
157
157
|
ensResolutionUrl?: string;
|
|
158
158
|
ipfsImageUploadFn?: (file: File) => Promise<IpfsImageUploadResponse>;
|
|
159
159
|
enableIndexeddbSync?: boolean;
|
|
160
|
-
blockControlsMountStrategy?: 'active' | 'eager';
|
|
161
160
|
ddocId?: string;
|
|
162
161
|
initialContent?: JSONContent | string | string[] | null;
|
|
163
162
|
walletAddress?: string | null;
|
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
import { DdocProps } from './types';
|
|
2
2
|
import { Editor } from '@tiptap/react';
|
|
3
|
+
import { DBlockRuntimeState } from './extensions/d-block/dblock-runtime';
|
|
3
4
|
|
|
4
|
-
export declare const useDdocEditor: ({ isPreviewMode, viewerMode, initialContent, versionHistoryState, collaboration, onChange, onCollaboratorChange, onCommentInteraction, onError, setCharacterCount, setWordCount, setPageCount, ipfsImageUploadFn, ddocId, enableIndexeddbSync, unFocused, isFocusMode, theme, zoomLevel, onInvalidContentError, ignoreCorruptedData, isPresentationMode, metadataProxyUrl, extensions: externalExtensions, onCopyHeadingLink, ipfsImageFetchFn, fetchV1ImageFn, isConnected, activeModel, maxTokens, isAIAgentEnabled, onIndexedDbError, disableInlineComment, initialCommentAnchors,
|
|
5
|
+
export declare const useDdocEditor: ({ isPreviewMode, viewerMode, initialContent, versionHistoryState, collaboration, onChange, onCollaboratorChange, onCommentInteraction, onError, setCharacterCount, setWordCount, 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, ...rest }: Partial<DdocProps> & {
|
|
5
6
|
isFocusMode?: boolean;
|
|
7
|
+
isPreviewEditor?: boolean;
|
|
6
8
|
}) => {
|
|
7
9
|
ydoc: import('yjs').Doc;
|
|
8
10
|
awareness: import('y-protocols/awareness.js').Awareness | null;
|
|
9
11
|
refreshYjsIndexedDbProvider: () => Promise<void>;
|
|
10
|
-
terminateSession: () =>
|
|
12
|
+
terminateSession: () => void;
|
|
11
13
|
isContentLoading: boolean;
|
|
12
14
|
tabs: import('./components/tabs/utils/tab-utils').Tab[];
|
|
13
15
|
hasTabState: boolean;
|
|
16
|
+
dBlockRuntimeState: DBlockRuntimeState;
|
|
17
|
+
dBlockRuntimeStateRef: import('react').MutableRefObject<DBlockRuntimeState>;
|
|
14
18
|
isVersionMode: boolean;
|
|
15
19
|
activeTabId: string;
|
|
16
20
|
setTabs: import('react').Dispatch<import('react').SetStateAction<import('./components/tabs/utils/tab-utils').Tab[]>>;
|
|
@@ -32,6 +36,7 @@ export declare const useDdocEditor: ({ isPreviewMode, viewerMode, initialContent
|
|
|
32
36
|
flushPendingUpdate: () => void;
|
|
33
37
|
collabState: import('./types').CollabState;
|
|
34
38
|
editor: Editor | null;
|
|
39
|
+
cachedEditorEntries: import('./hooks/use-tab-editor').CachedTabEditorRenderEntry[];
|
|
35
40
|
ref: import('react').RefObject<HTMLDivElement>;
|
|
36
41
|
slides: string[];
|
|
37
42
|
setSlides: import('react').Dispatch<import('react').SetStateAction<string[]>>;
|
|
@@ -43,5 +48,4 @@ export declare const useDdocEditor: ({ isPreviewMode, viewerMode, initialContent
|
|
|
43
48
|
commentAnchorsRef: import('react').MutableRefObject<import('./extensions/comment/comment-decoration-plugin').CommentAnchor[]>;
|
|
44
49
|
draftAnchorsRef: import('react').MutableRefObject<import('./extensions/comment/comment-decoration-plugin').CommentAnchor[]>;
|
|
45
50
|
storeApiRef: import('react').MutableRefObject<import('zustand').StoreApi<import('./stores/comment-store').CommentStoreState> | null>;
|
|
46
|
-
editorSessionKey: string;
|
|
47
51
|
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Editor } from '@tiptap/core';
|
|
2
|
+
|
|
3
|
+
export declare const cleanupYProsemirrorBinding: (editor: Editor | null | undefined) => void;
|
|
4
|
+
export declare const cleanupYUndoManager: (editor: Editor | null | undefined) => void;
|
|
5
|
+
export declare const destroyEditorWithYSyncCleanup: (editor: Editor | null | undefined) => void;
|