@fileverse-dev/ddoc 4.3.8 → 4.4.0-rc.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/dist/{index-U-iFjaSa.mjs → index-Bas9R2G_.mjs} +1 -1
- package/dist/{index-CaJoYVx1.mjs → index-dQPj88k1.mjs} +25372 -24386
- package/dist/index.es.js +1 -1
- package/dist/{markdown-source-pane-BatVxWUx.mjs → markdown-source-pane-B7SJdN2Z.mjs} +2 -2
- package/dist/package/components/editor-utils.d.ts +14 -0
- package/dist/package/extensions/ai-writer/ai-writer-space-trigger.d.ts +3 -0
- package/dist/package/extensions/block-id/index.d.ts +4 -0
- package/dist/package/extensions/d-block/components/buttons.d.ts +5 -9
- package/dist/package/extensions/d-block/components/tooltips.d.ts +0 -3
- package/dist/package/extensions/d-block/dblock-collapse.d.ts +6 -3
- package/dist/package/extensions/d-block/dblock-drag-handle.d.ts +11 -0
- package/dist/package/extensions/d-block/dblock-media-plugin.d.ts +5 -0
- package/dist/package/extensions/d-block/dblock-node-view.d.ts +6 -6
- package/dist/package/extensions/d-block/dblock-paste-normalizer.d.ts +25 -0
- package/dist/package/extensions/d-block/dblock-toolbar.d.ts +7 -0
- package/dist/package/extensions/d-block/dblock.d.ts +1 -1
- package/dist/package/extensions/d-block/heading-chrome-icons.d.ts +2 -0
- package/dist/package/extensions/default-extension.d.ts +3 -2
- package/dist/package/extensions/document/document.d.ts +1 -0
- package/dist/package/extensions/list-normalization.d.ts +4 -0
- package/dist/package/extensions/multi-column/column.d.ts +1 -0
- package/dist/package/extensions/multi-column/utils.d.ts +1 -1
- package/dist/package/extensions/undo-selection.d.ts +11 -0
- package/dist/package/hooks/use-doc-schema-version.d.ts +12 -0
- package/dist/package/hooks/use-export-headless-editor-content.d.ts +6 -2
- package/dist/package/hooks/use-headless-editor.d.ts +7 -2
- package/dist/package/hooks/use-tab-editor.d.ts +3 -1
- package/dist/package/types.d.ts +6 -0
- package/dist/package/use-ddoc-editor.d.ts +3 -1
- package/dist/package/utils/block-insert.d.ts +15 -0
- package/dist/package/utils/block-schema.d.ts +6 -0
- package/dist/package/utils/extract-title-from-content.d.ts +0 -4
- package/dist/package/utils/make-editor.d.ts +9 -0
- package/dist/package/utils/sanitize-content.d.ts +2 -1
- package/dist/package/utils/schema-version.d.ts +6 -0
- package/dist/{split-view-toolbar-afCdxk1V.mjs → split-view-toolbar-SJRwnSnM.mjs} +2 -2
- package/dist/style.css +1 -1
- package/package.json +13 -5
- package/dist/package/extensions/d-block/dblock-view-registry.d.ts +0 -16
package/dist/index.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as a, a as o, E as t, P as d, f as r, i, g as n, l as m, h as E, m as c, e as l, n as p, c as u, d as C, u as f, v as D } from "./index-
|
|
1
|
+
import { D as a, a as o, E as t, P as d, f as r, i, g as n, l as m, h as E, m as c, e as l, n as p, c as u, d as C, u as f, v as D } from "./index-dQPj88k1.mjs";
|
|
2
2
|
export {
|
|
3
3
|
a as DdocEditor,
|
|
4
4
|
o as DdocExportModal,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
var Vr = Object.defineProperty;
|
|
2
2
|
var Wr = (t, e, O) => e in t ? Vr(t, e, { enumerable: !0, configurable: !0, writable: !0, value: O }) : t[e] = O;
|
|
3
3
|
var gt = (t, e, O) => Wr(t, typeof e != "symbol" ? e + "" : e, O);
|
|
4
|
-
import { j as Cr } from "./index-
|
|
4
|
+
import { j as Cr } from "./index-dQPj88k1.mjs";
|
|
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-Bas9R2G_.mjs";
|
|
7
7
|
class ua {
|
|
8
8
|
/**
|
|
9
9
|
Create a new completion context. (Mostly useful for testing
|
|
@@ -2,6 +2,7 @@ import { default as React, Dispatch, SetStateAction } from 'react';
|
|
|
2
2
|
import { FontDescriptor, IpfsImageFetchPayload, IpfsImageUploadResponse } from '../types';
|
|
3
3
|
import { IEditorTool } from '../hooks/use-visibility';
|
|
4
4
|
import { Editor } from '@tiptap/react';
|
|
5
|
+
import { EditorProps } from '@tiptap/pm/view';
|
|
5
6
|
|
|
6
7
|
export interface IEditorToolElement {
|
|
7
8
|
icon: any;
|
|
@@ -36,6 +37,19 @@ export declare const IMG_UPLOAD_SETTINGS: {
|
|
|
36
37
|
errorMsg: string;
|
|
37
38
|
};
|
|
38
39
|
};
|
|
40
|
+
/**
|
|
41
|
+
* `Editor#setOptions({ editorProps })` replaces the whole `editorProps`
|
|
42
|
+
* object rather than merging it — tiptap merges top-level options but
|
|
43
|
+
* swaps nested objects like `editorProps` wholesale. Calling
|
|
44
|
+
* `editor.setOptions({ editorProps: { handleKeyDown } })` directly would
|
|
45
|
+
* silently discard everything else already configured on `editorProps`:
|
|
46
|
+
* `attributes` (including classes set at construction time, e.g.
|
|
47
|
+
* `main-doc-editor` from `DdocEditorProps`), `clipboardTextSerializer`,
|
|
48
|
+
* and the `handleDOMEvents` wired in `use-tab-editor.tsx`. Always patch
|
|
49
|
+
* `editorProps` through this helper instead of calling
|
|
50
|
+
* `editor.setOptions({ editorProps: ... })` directly.
|
|
51
|
+
*/
|
|
52
|
+
export declare const mergeEditorProps: (editor: Editor, patch: Partial<EditorProps>) => void;
|
|
39
53
|
export declare const useEditorToolbar: ({ editor, onError, isPresentationMode, setIsPresentationMode, enableCollaboration, ipfsImageUploadFn, onMarkdownExport, onMarkdownImport, onPdfExport, onHtmlExport, onTxtExport, onOdtExport, ipfsImageFetchFn, onDocxImport, fetchV1ImageFn, }: {
|
|
40
54
|
editor: Editor | null;
|
|
41
55
|
isPresentationMode?: boolean;
|
|
@@ -8,19 +8,15 @@ export declare const ActionButton: React.MemoExoticComponent<React.ForwardRefExo
|
|
|
8
8
|
className?: string;
|
|
9
9
|
} & React.RefAttributes<HTMLButtonElement>>>;
|
|
10
10
|
export declare const GripButton: React.MemoExoticComponent<React.ForwardRefExoticComponent<{
|
|
11
|
-
onClick: (event: React.MouseEvent<
|
|
11
|
+
onClick: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
12
12
|
className: string;
|
|
13
|
-
} & React.RefAttributes<
|
|
13
|
+
} & React.RefAttributes<HTMLButtonElement>>>;
|
|
14
14
|
export declare const PlusButton: React.MemoExoticComponent<React.ForwardRefExoticComponent<{
|
|
15
|
-
onClick: (event: React.MouseEvent<
|
|
15
|
+
onClick: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
16
16
|
className: string;
|
|
17
|
-
} & React.RefAttributes<
|
|
17
|
+
} & React.RefAttributes<HTMLButtonElement>>>;
|
|
18
18
|
export declare const CollapseButton: React.MemoExoticComponent<React.ForwardRefExoticComponent<{
|
|
19
19
|
isCollapsed: boolean;
|
|
20
20
|
onToggle: () => void;
|
|
21
21
|
className: string;
|
|
22
|
-
} & React.RefAttributes<
|
|
23
|
-
export declare const CopyLinkButton: React.MemoExoticComponent<React.ForwardRefExoticComponent<{
|
|
24
|
-
onClick: () => void;
|
|
25
|
-
className: string;
|
|
26
|
-
} & React.RefAttributes<HTMLDivElement>>>;
|
|
22
|
+
} & React.RefAttributes<HTMLButtonElement>>>;
|
|
@@ -15,6 +15,3 @@ export declare const CollapseTooltip: React.MemoExoticComponent<({ isCollapsed,
|
|
|
15
15
|
isCollapsed: boolean;
|
|
16
16
|
children: React.ReactNode;
|
|
17
17
|
}) => import("react/jsx-runtime").JSX.Element>;
|
|
18
|
-
export declare const CopyLinkTooltip: React.MemoExoticComponent<({ children }: {
|
|
19
|
-
children: React.ReactNode;
|
|
20
|
-
}) => import("react/jsx-runtime").JSX.Element>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Editor } from '@tiptap/core';
|
|
1
|
+
import { Extension, Editor } from '@tiptap/core';
|
|
2
2
|
import { Node as ProseMirrorNode } from '@tiptap/pm/model';
|
|
3
3
|
import { EditorState, Plugin, PluginKey, Transaction } from '@tiptap/pm/state';
|
|
4
4
|
import { DecorationSet } from '@tiptap/pm/view';
|
|
@@ -24,7 +24,6 @@ interface DBlockCollapsePluginState {
|
|
|
24
24
|
structureSignature: string;
|
|
25
25
|
}
|
|
26
26
|
export declare const getDBlockRenderMeta: (node: ProseMirrorNode, pos: number) => DBlockRenderMeta;
|
|
27
|
-
export declare const getHeadingAlignmentClass: (alignment?: string) => "justify-center" | "justify-end" | "justify-start";
|
|
28
27
|
export declare const getHeadingLinkSlug: (node: ProseMirrorNode, pos: number) => string | null;
|
|
29
28
|
export declare const buildHeadingMap: (doc: ProseMirrorNode) => HeadingLookupMap;
|
|
30
29
|
export declare const shouldHideDBlock: (doc: ProseMirrorNode, node: ProseMirrorNode, position: number, headingMap: HeadingLookupMap) => boolean;
|
|
@@ -33,5 +32,9 @@ export declare const buildToggleHeadingCollapseTransaction: (state: EditorState,
|
|
|
33
32
|
export declare const toggleHeadingCollapse: (editor: Editor, position: number) => boolean;
|
|
34
33
|
export declare const expandHeadingContent: (editor: Editor, nodePos: number) => boolean;
|
|
35
34
|
export declare const dBlockCollapsePluginKey: PluginKey<DBlockCollapsePluginState>;
|
|
36
|
-
export
|
|
35
|
+
export interface FlatHeadingCollapseOptions {
|
|
36
|
+
onCopyHeadingLink?: (link: string) => void;
|
|
37
|
+
}
|
|
38
|
+
export declare const FlatHeadingCollapse: Extension<FlatHeadingCollapseOptions, any>;
|
|
39
|
+
export declare const createDBlockCollapsePlugin: (onCopyHeadingLink?: (link: string) => void) => Plugin<DBlockCollapsePluginState>;
|
|
37
40
|
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Editor } from '@tiptap/react';
|
|
2
|
+
import { Node as ProseMirrorNode } from '@tiptap/pm/model';
|
|
3
|
+
import { ResolvedContentItem } from '../../hooks/use-content-item-actions';
|
|
4
|
+
import { DBlockRuntimeState } from './dblock-runtime';
|
|
5
|
+
|
|
6
|
+
export declare const resolveTopLevelBlock: (editor: Editor, pos: number) => ResolvedContentItem | null;
|
|
7
|
+
export declare const rescueLeafBlockDragStart: (editor: Editor, pos: number, node: ProseMirrorNode, event: DragEvent) => boolean;
|
|
8
|
+
export declare const DBlockDragHandle: ({ editor, runtimeState, }: {
|
|
9
|
+
editor: Editor;
|
|
10
|
+
runtimeState: DBlockRuntimeState;
|
|
11
|
+
}) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Extension } from '@tiptap/core';
|
|
1
2
|
import { Node as ProseMirrorNode } from '@tiptap/pm/model';
|
|
2
3
|
import { Plugin } from '@tiptap/pm/state';
|
|
3
4
|
import { DBlockRuntimeState } from './dblock-runtime';
|
|
@@ -19,4 +20,8 @@ interface MediaPluginState {
|
|
|
19
20
|
}
|
|
20
21
|
export declare const getDBlockMediaCandidate: (node: ProseMirrorNode, position: number) => MediaCandidate | null;
|
|
21
22
|
export declare const createDBlockMediaConversionPlugin: (getRuntimeState?: () => DBlockRuntimeState) => Plugin<MediaPluginState>;
|
|
23
|
+
export interface FlatMediaConversionOptions {
|
|
24
|
+
getRuntimeState?: () => DBlockRuntimeState;
|
|
25
|
+
}
|
|
26
|
+
export declare const FlatMediaConversion: Extension<FlatMediaConversionOptions, any>;
|
|
22
27
|
export {};
|
|
@@ -17,19 +17,19 @@ export declare class DBlockNodeView implements NodeView {
|
|
|
17
17
|
editor: Editor;
|
|
18
18
|
getPos: () => number;
|
|
19
19
|
dom: HTMLDivElement;
|
|
20
|
-
gutterElement: HTMLElement;
|
|
21
|
-
contentElement: HTMLDivElement;
|
|
22
20
|
contentDOM: HTMLDivElement;
|
|
23
|
-
private id;
|
|
24
21
|
private decorations;
|
|
25
22
|
private getRuntimeState?;
|
|
26
|
-
private
|
|
23
|
+
private onCopyHeadingLink?;
|
|
24
|
+
private previewControls;
|
|
25
|
+
private collapseButton;
|
|
27
26
|
constructor({ editor, node, getPos, decorations, HTMLAttributes, getRuntimeState, onCopyHeadingLink, }: DBlockNodeViewOptions);
|
|
28
27
|
update(node: ProseMirrorNode, decorations: readonly Decoration[]): boolean;
|
|
29
28
|
ignoreMutation(mutation: ViewMutationRecord): boolean;
|
|
30
|
-
stopEvent(event: Event): boolean;
|
|
31
|
-
destroy(): void;
|
|
32
29
|
private syncDOM;
|
|
30
|
+
private shouldShowPreviewControls;
|
|
31
|
+
private syncPreviewControls;
|
|
32
|
+
private buildPreviewControls;
|
|
33
33
|
private safeGetPos;
|
|
34
34
|
}
|
|
35
35
|
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Plugin } from 'prosemirror-state';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Rewraps pasted top-level bare blocks in dBlocks (v1 schema only).
|
|
5
|
+
*
|
|
6
|
+
* Slices copied from a flat v2 doc (or parsed from external HTML) carry
|
|
7
|
+
* bare blocks at the top level: `<heading, paragraph, ...>` with
|
|
8
|
+
* openStart/openEnd 1. The v1 doc only accepts `(dBlock|columns|pageBreak)+`
|
|
9
|
+
* and dBlock holds exactly one `(block|columns)`, so prosemirror's
|
|
10
|
+
* `replaceRange` finds no legal placement for a closed bare heading:
|
|
11
|
+
* `doc.canReplaceWith(..., heading)` fails (no wrapping is considered) and
|
|
12
|
+
* `dBlock.canReplaceWith(0, 0, heading)` fails (the wrapper already holds
|
|
13
|
+
* the target paragraph and its content expression allows only one child).
|
|
14
|
+
* The fitter then falls back to leaving the heading open and merging its
|
|
15
|
+
* inline content into the destination paragraph — the heading silently
|
|
16
|
+
* demotes to plain text. v1-native copies never hit this because their
|
|
17
|
+
* slices carry the dBlock wrappers, which fit at doc level as closed nodes.
|
|
18
|
+
*
|
|
19
|
+
* The fix: make foreign slices look exactly like v1-native ones before
|
|
20
|
+
* fitting — wrap every doc-illegal top-level block in a dBlock and grow the
|
|
21
|
+
* open depths across the added wrapper. PM's own defining-node machinery
|
|
22
|
+
* (heading has `defining: true`) then preserves headings, while partial
|
|
23
|
+
* inline pastes still merge into the caret block exactly as before.
|
|
24
|
+
*/
|
|
25
|
+
export declare const createDBlockPasteNormalizerPlugin: () => Plugin<any>;
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { Editor } from '@tiptap/react';
|
|
3
|
+
import { Node as ProseMirrorNode } from '@tiptap/pm/model';
|
|
3
4
|
import { DBlockRuntimeState } from './dblock-runtime';
|
|
4
5
|
|
|
6
|
+
interface DBlockTemplateTarget {
|
|
7
|
+
node: ProseMirrorNode;
|
|
8
|
+
pos: number;
|
|
9
|
+
}
|
|
10
|
+
export declare const getTemplateTarget: (editor: Editor | null, runtimeState: DBlockRuntimeState) => DBlockTemplateTarget | null;
|
|
5
11
|
export declare const DBlockToolbarProvider: ({ children, editor, runtimeState, }: {
|
|
6
12
|
children: React.ReactNode;
|
|
7
13
|
editor: Editor | null;
|
|
8
14
|
runtimeState?: DBlockRuntimeState;
|
|
9
15
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export {};
|
|
@@ -5,9 +5,9 @@ import { DBlockRuntimeState } from './dblock-runtime';
|
|
|
5
5
|
export interface DBlockOptions {
|
|
6
6
|
HTMLAttributes: Record<string, any>;
|
|
7
7
|
ipfsImageUploadFn?: (file: File) => Promise<IpfsImageUploadResponse>;
|
|
8
|
-
onCopyHeadingLink?: (link: string) => void;
|
|
9
8
|
hasAvailableModels: boolean;
|
|
10
9
|
getRuntimeState?: () => DBlockRuntimeState;
|
|
10
|
+
onCopyHeadingLink?: (link: string) => void;
|
|
11
11
|
}
|
|
12
12
|
declare module '@tiptap/core' {
|
|
13
13
|
interface Commands<ReturnType> {
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const CHEVRON_SVG = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"m6 9 6 6 6-6\"/></svg>";
|
|
2
|
+
export declare const LINK_SVG = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71\"/><path d=\"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71\"/></svg>";
|
|
@@ -4,7 +4,7 @@ import { IpfsImageFetchPayload, IpfsImageUploadResponse } from '../types';
|
|
|
4
4
|
import { ToCItemType } from '../components/toc/types';
|
|
5
5
|
import { DBlockRuntimeStateRef } from './d-block/dblock-runtime';
|
|
6
6
|
|
|
7
|
-
export declare const defaultExtensions: ({ ipfsImageFetchFn, onError, metadataProxyUrl, onCopyHeadingLink, ipfsImageUploadFn, fetchV1ImageFn, onTocUpdate, dBlockRuntimeStateRef, hasAvailableModels, }: {
|
|
7
|
+
export declare const defaultExtensions: ({ ipfsImageFetchFn, onError, metadataProxyUrl, onCopyHeadingLink, ipfsImageUploadFn, fetchV1ImageFn, onTocUpdate, dBlockRuntimeStateRef, hasAvailableModels, schemaVersion, }: {
|
|
8
8
|
ipfsImageFetchFn?: (_data: IpfsImageFetchPayload) => Promise<{
|
|
9
9
|
url: string;
|
|
10
10
|
file: File;
|
|
@@ -17,5 +17,6 @@ export declare const defaultExtensions: ({ ipfsImageFetchFn, onError, metadataPr
|
|
|
17
17
|
onTocUpdate?: (data: ToCItemType[], isCreate?: boolean) => void;
|
|
18
18
|
dBlockRuntimeStateRef?: DBlockRuntimeStateRef;
|
|
19
19
|
hasAvailableModels?: boolean;
|
|
20
|
-
|
|
20
|
+
schemaVersion?: number;
|
|
21
|
+
}) => (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').Extension<import('./d-block/dblock-collapse').FlatHeadingCollapseOptions, any> | import('@tiptap/core').Extension<import('./d-block/dblock-media-plugin').FlatMediaConversionOptions, 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('./code-block/custom-code-block-lowlight').CustomCodeBlockLowlightOptions, 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').Extension<import('./search-replace/search-replace').SearchAndReplaceOptions, import('./search-replace/search-replace').SearchAndReplaceStorage> | 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
22
|
export declare const createInputRule: (pattern: RegExp, data: string, type: NodeType) => InputRule;
|
|
@@ -6,7 +6,7 @@ export declare const buildParagraph: ({ content }: Partial<JSONContent>) => JSON
|
|
|
6
6
|
export declare const buildDBlock: ({ content }: Partial<JSONContent>) => JSONContent;
|
|
7
7
|
export declare const buildColumn: ({ content }: Partial<JSONContent>) => JSONContent;
|
|
8
8
|
export declare const buildColumnBlock: ({ content }: Partial<JSONContent>) => JSONContent;
|
|
9
|
-
export declare const buildNColumns: (n: number) => JSONContent[];
|
|
9
|
+
export declare const buildNColumns: (n: number, wrapInDBlock?: boolean) => JSONContent[];
|
|
10
10
|
interface PredicateProps {
|
|
11
11
|
node: Node;
|
|
12
12
|
pos: number;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Extension } from '@tiptap/core';
|
|
2
|
+
import { PluginKey, EditorState } from '@tiptap/pm/state';
|
|
3
|
+
|
|
4
|
+
export declare const undoSelectionKey: PluginKey<boolean>;
|
|
5
|
+
/**
|
|
6
|
+
* True while the current selection is one this plugin placed. The bubble menu
|
|
7
|
+
* reads it so a toolbar never appears over a selection the user did not make
|
|
8
|
+
* with their own gesture; the next click, drag or keystroke clears it.
|
|
9
|
+
*/
|
|
10
|
+
export declare const isUndoRedoSelection: (state: EditorState) => boolean;
|
|
11
|
+
export declare const UndoSelection: Extension<any, any>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as Y from 'yjs';
|
|
2
|
+
interface UseDocSchemaVersionArgs {
|
|
3
|
+
ydoc: Y.Doc;
|
|
4
|
+
isNewDdoc: boolean;
|
|
5
|
+
isContentResolved: boolean;
|
|
6
|
+
preferredSchemaVersion?: number;
|
|
7
|
+
}
|
|
8
|
+
export declare const useDocSchemaVersion: ({ ydoc, isNewDdoc, isContentResolved, preferredSchemaVersion, }: UseDocSchemaVersionArgs) => {
|
|
9
|
+
docSchemaVersion: number;
|
|
10
|
+
isSchemaUnsupported: boolean;
|
|
11
|
+
};
|
|
12
|
+
export {};
|
|
@@ -15,11 +15,15 @@ export declare const useExportHeadlessEditorContent: (props?: UseHeadlessEditorP
|
|
|
15
15
|
exportContent: (option: HeadlessEditorExportOption) => void;
|
|
16
16
|
exportModalProps: DdocExportModalProps;
|
|
17
17
|
setContent: (initialContent: string | string[] | JSONContent, editor: Editor, ydoc: Y.Doc) => void;
|
|
18
|
-
getEditor: (
|
|
18
|
+
getEditor: (options?: {
|
|
19
|
+
schemaVersion?: number;
|
|
20
|
+
}) => {
|
|
19
21
|
editor: Editor;
|
|
20
22
|
ydoc: Y.Doc;
|
|
21
23
|
};
|
|
22
|
-
getYjsConvertor: (
|
|
24
|
+
getYjsConvertor: (options?: {
|
|
25
|
+
schemaVersion?: number;
|
|
26
|
+
}) => {
|
|
23
27
|
convertJSONContentToYjsEncodedString: (content: JSONContent) => string;
|
|
24
28
|
cleanup: () => void;
|
|
25
29
|
};
|
|
@@ -13,14 +13,19 @@ export interface UseHeadlessEditorProps {
|
|
|
13
13
|
export declare const getHeadlessExtensions: (options?: {
|
|
14
14
|
ydoc?: Y.Doc;
|
|
15
15
|
optionalExtensions?: string[];
|
|
16
|
+
schemaVersion?: number;
|
|
16
17
|
}) => AnyExtension[];
|
|
17
18
|
export declare const useHeadlessEditor: (props?: UseHeadlessEditorProps) => {
|
|
18
19
|
setContent: (initialContent: string | string[] | JSONContent, editor: Editor, ydoc: Y.Doc) => void;
|
|
19
|
-
getEditor: (
|
|
20
|
+
getEditor: (options?: {
|
|
21
|
+
schemaVersion?: number;
|
|
22
|
+
}) => {
|
|
20
23
|
editor: Editor;
|
|
21
24
|
ydoc: Y.Doc;
|
|
22
25
|
};
|
|
23
|
-
getYjsConvertor: (
|
|
26
|
+
getYjsConvertor: (options?: {
|
|
27
|
+
schemaVersion?: number;
|
|
28
|
+
}) => {
|
|
24
29
|
convertJSONContentToYjsEncodedString: (content: JSONContent) => string;
|
|
25
30
|
cleanup: () => void;
|
|
26
31
|
};
|
|
@@ -7,6 +7,7 @@ import { ToCItemType } from '../components/toc/types';
|
|
|
7
7
|
import { CollabConnectionConfig, CollaborationProps } from '../sync-local/types';
|
|
8
8
|
|
|
9
9
|
import * as Y from 'yjs';
|
|
10
|
+
export declare const TAB_EDITOR_ATTRIBUTES: Record<string, string>;
|
|
10
11
|
interface UseTabEditorArgs {
|
|
11
12
|
ydoc: Y.Doc;
|
|
12
13
|
isVersionMode?: boolean;
|
|
@@ -55,8 +56,9 @@ interface UseTabEditorArgs {
|
|
|
55
56
|
editorRef?: MutableRefObject<Editor | null>;
|
|
56
57
|
initialCommentAnchors?: SerializedCommentAnchor[];
|
|
57
58
|
dBlockRuntimeStateRef?: DBlockRuntimeStateRef;
|
|
59
|
+
docSchemaVersion?: number;
|
|
58
60
|
}
|
|
59
|
-
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, }: UseTabEditorArgs) => {
|
|
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) => {
|
|
60
62
|
editor: Editor | null;
|
|
61
63
|
cachedEditorEntries: import('./use-tab-editor-cache').CachedTabEditorRenderEntry[];
|
|
62
64
|
ref: import('react').RefObject<HTMLDivElement>;
|
package/dist/package/types.d.ts
CHANGED
|
@@ -178,6 +178,12 @@ export interface DdocProps extends CommentAccountProps {
|
|
|
178
178
|
enableIndexeddbSync?: boolean;
|
|
179
179
|
ddocId?: string;
|
|
180
180
|
initialContent?: JSONContent | string | string[] | null;
|
|
181
|
+
/**
|
|
182
|
+
* Schema for newly created docs only: 1 = dBlock (default), 2 = flat.
|
|
183
|
+
* Ignored for existing docs, which always follow the schemaVersion marker
|
|
184
|
+
* stored inside the doc itself.
|
|
185
|
+
*/
|
|
186
|
+
preferredSchemaVersion?: 1 | 2;
|
|
181
187
|
walletAddress?: string | null;
|
|
182
188
|
username?: string | null;
|
|
183
189
|
setUsername?: React.Dispatch<SetStateAction<string>>;
|
|
@@ -2,7 +2,7 @@ import { DdocProps } from './types';
|
|
|
2
2
|
import { Editor } from '@tiptap/react';
|
|
3
3
|
import { DBlockRuntimeState } from './extensions/d-block/dblock-runtime';
|
|
4
4
|
|
|
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, ...rest }: Partial<DdocProps> & {
|
|
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
6
|
isFocusMode?: boolean;
|
|
7
7
|
isPreviewEditor?: boolean;
|
|
8
8
|
}) => {
|
|
@@ -11,6 +11,8 @@ export declare const useDdocEditor: ({ isPreviewMode, viewerMode, initialContent
|
|
|
11
11
|
refreshYjsIndexedDbProvider: () => Promise<void>;
|
|
12
12
|
terminateSession: () => void;
|
|
13
13
|
isContentLoading: boolean;
|
|
14
|
+
isSchemaUnsupported: boolean;
|
|
15
|
+
docSchemaVersion: number;
|
|
14
16
|
tabs: import('./components/tabs/utils/tab-utils').Tab[];
|
|
15
17
|
hasTabState: boolean;
|
|
16
18
|
dBlockRuntimeState: DBlockRuntimeState;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Node as ProseMirrorNode } from '@tiptap/pm/model';
|
|
2
|
+
import { Transaction } from '@tiptap/pm/state';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Replace the current (tr) selection with a block node, expanding over an
|
|
6
|
+
* empty parent (the just-emptied host paragraph, or the empty dBlock a
|
|
7
|
+
* caller left behind after deleting its child), then park the caret in the
|
|
8
|
+
* first textblock AFTER the inserted node — creating a trailing
|
|
9
|
+
* dBlock+paragraph when the node became the last block.
|
|
10
|
+
*
|
|
11
|
+
* Without the explicit placement, atom block inserts strand the selection
|
|
12
|
+
* at the dBlock boundary: the caret renders at the block edge and the next
|
|
13
|
+
* insert command silently fails (TEC-2539).
|
|
14
|
+
*/
|
|
15
|
+
export declare function replaceSelectionWithBlockNode(tr: Transaction, node: ProseMirrorNode): void;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { JSONContent } from '@tiptap/core';
|
|
2
|
+
import { Schema } from '@tiptap/pm/model';
|
|
3
|
+
|
|
4
|
+
export declare const schemaHasDBlock: (schema: Schema) => boolean;
|
|
5
|
+
export declare const wrapBlockNode: (schema: Schema, content: JSONContent) => JSONContent;
|
|
6
|
+
export declare const unwrapDBlocksInJSON: (node: JSONContent) => JSONContent;
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { JSONContent } from '@tiptap/core';
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* Extract title from document content (JSON structure from editor)
|
|
5
|
-
* Looks for H1 headings first, then any text content
|
|
6
|
-
*/
|
|
7
3
|
export declare const extractTitleFromContent: (changes: {
|
|
8
4
|
content: JSONContent;
|
|
9
5
|
}) => string | null;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Editor } from '@tiptap/react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Shared jsdom editor factory for unit tests (use-editor-commands.test.tsx,
|
|
5
|
+
* selection-utils.test.ts, ...). Collaboration owns the doc, so content must
|
|
6
|
+
* be set via `setContent` *after* construction — passing `content` to the
|
|
7
|
+
* `Editor` constructor is silently ignored once Collaboration is configured.
|
|
8
|
+
*/
|
|
9
|
+
export declare const makeEditor: (content?: string) => Editor;
|
|
@@ -4,6 +4,7 @@ type SanitizeContentProps = {
|
|
|
4
4
|
data: JSONContent;
|
|
5
5
|
ignoreCorruptedData?: boolean;
|
|
6
6
|
onInvalidContentError?: (e: unknown) => void;
|
|
7
|
+
wrapInDBlock?: boolean;
|
|
7
8
|
};
|
|
8
|
-
export declare const sanitizeContent: ({ data, ignoreCorruptedData, onInvalidContentError, }: SanitizeContentProps) => JSONContent;
|
|
9
|
+
export declare const sanitizeContent: ({ data, ignoreCorruptedData, onInvalidContentError, wrapInDBlock, }: SanitizeContentProps) => JSONContent;
|
|
9
10
|
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as Y from 'yjs';
|
|
2
|
+
export declare const DDOC_META_ROOT_KEY = "ddocMeta";
|
|
3
|
+
export declare const SCHEMA_VERSION_META_KEY = "schemaVersion";
|
|
4
|
+
export declare const SUPPORTED_SCHEMA_VERSION = 2;
|
|
5
|
+
export declare const getDocSchemaVersion: (doc: Y.Doc) => number;
|
|
6
|
+
export declare const isDocSchemaSupported: (doc: Y.Doc) => boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { j as d } from "./index-
|
|
1
|
+
import { j as d } from "./index-dQPj88k1.mjs";
|
|
2
2
|
import { useRef as I, useState as N, useEffect as D } from "react";
|
|
3
3
|
import { DynamicDropdown as E, Tooltip as R, IconButton as O } from "@fileverse/ui";
|
|
4
|
-
import { a3 as A, a4 as P, c as y } from "./index-
|
|
4
|
+
import { a3 as A, a4 as P, c as y } from "./index-Bas9R2G_.mjs";
|
|
5
5
|
const p = (e, t, o = t) => {
|
|
6
6
|
const { state: s } = e, l = s.changeByRange((n) => {
|
|
7
7
|
const u = s.sliceDoc(n.from, n.to), r = s.sliceDoc(
|