@fileverse-dev/ddoc 4.1.11-patch-3 → 4.1.12-menubar-3
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-CAQPA7Hs.mjs → index-BWdjUdQy.mjs} +1 -1
- package/dist/{index-k1yI08g6.mjs → index-DwLAI_Ie.mjs} +22186 -22123
- package/dist/index.d.ts +2 -2
- package/dist/index.es.js +5 -6
- package/dist/{markdown-source-pane-BoxLMIir.mjs → markdown-source-pane-D6jRN_JD.mjs} +2 -2
- package/dist/package/components/editor-utils.d.ts +1 -25
- package/dist/package/components/split-view/split-view-markdown-pane.d.ts +1 -3
- package/dist/package/extensions/mardown-paste-handler/index.d.ts +0 -5
- package/dist/package/hooks/use-editor-commands.d.ts +20 -0
- package/dist/package/hooks/use-focus-mode.d.ts +6 -1
- package/dist/package/hooks/use-headless-editor.d.ts +9 -1
- package/dist/package/types.d.ts +7 -12
- package/dist/package/utils/insert-commands.d.ts +20 -0
- package/dist/package/utils/typography.d.ts +26 -0
- package/dist/{split-view-toolbar-ndChIJxD.mjs → split-view-toolbar-D4bIgxWm.mjs} +2 -2
- package/dist/style.css +1 -1
- package/package.json +10 -5
- package/dist/package/components/split-view/split-view-css-accordion.d.ts +0 -13
- package/dist/package/utils/sanitize-css.d.ts +0 -45
package/dist/index.d.ts
CHANGED
|
@@ -3,10 +3,10 @@ export { PreviewDdocEditor } from './package/preview-ddoc-editor';
|
|
|
3
3
|
export { handleContentPrint } from './package/utils/handle-print';
|
|
4
4
|
export { DdocExportModal } from './package/components/export-modal';
|
|
5
5
|
export { useHeadlessEditor } from './package/hooks/use-headless-editor';
|
|
6
|
+
export { useEditorCommands } from './package/hooks/use-editor-commands';
|
|
7
|
+
export type { EditorCommand, EditorCommandId, UseEditorCommandsOptions, } from './package/hooks/use-editor-commands';
|
|
6
8
|
export { useExportHeadlessEditorContent } from './package/hooks/use-export-headless-editor-content';
|
|
7
9
|
export { mergeTabAwareYjsUpdates } from './package/components/tabs/utils/tab-utils';
|
|
8
|
-
export { validateCustomCss, sanitizeCustomCss, } from './package/utils/sanitize-css';
|
|
9
|
-
export type { CssDiagnostic, CssValidationResult, } from './package/utils/sanitize-css';
|
|
10
10
|
export { buildVersionDiffSnapshot } from './package/components/tabs/utils/version-diff-snapshot';
|
|
11
11
|
export type { DdocExportModalProps, ExportFormatOption, ExportTabOption, } from './package/components/export-modal';
|
|
12
12
|
export type { VersionTabSnapshot } from './package/components/tabs/utils/version-diff-snapshot';
|
package/dist/index.es.js
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { D as e, a as o, E as
|
|
1
|
+
import { D as e, a as o, E as d, P as t, e as r, h as i, m as n, c as E, d as l, u as m } from "./index-DwLAI_Ie.mjs";
|
|
2
2
|
export {
|
|
3
3
|
e as DdocEditor,
|
|
4
4
|
o as DdocExportModal,
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
d as Editor,
|
|
6
|
+
t as PreviewDdocEditor,
|
|
7
7
|
r as buildVersionDiffSnapshot,
|
|
8
8
|
i as handleContentPrint,
|
|
9
9
|
n as mergeTabAwareYjsUpdates,
|
|
10
|
-
E as
|
|
10
|
+
E as useEditorCommands,
|
|
11
11
|
l as useExportHeadlessEditorContent,
|
|
12
|
-
|
|
13
|
-
C as validateCustomCss
|
|
12
|
+
m as useHeadlessEditor
|
|
14
13
|
};
|
|
@@ -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-DwLAI_Ie.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-BWdjUdQy.mjs";
|
|
7
7
|
class ua {
|
|
8
8
|
/**
|
|
9
9
|
Create a new completion context. (Mostly useful for testing
|
|
@@ -22,30 +22,7 @@ type PickerEntry = {
|
|
|
22
22
|
};
|
|
23
23
|
export declare const baselineFonts: PickerEntry[];
|
|
24
24
|
export declare function buildPickerEntries(consumerFonts: FontDescriptor[]): PickerEntry[];
|
|
25
|
-
export
|
|
26
|
-
export declare const getFontSizeOptions: (editor?: Editor) => {
|
|
27
|
-
title: string;
|
|
28
|
-
value: string;
|
|
29
|
-
label: string;
|
|
30
|
-
command: (editor: Editor) => void;
|
|
31
|
-
isActive: () => boolean | undefined;
|
|
32
|
-
}[];
|
|
33
|
-
export declare const getCurrentFontSize: (editor: Editor | null, currentSize: string) => string;
|
|
34
|
-
export declare const uiValueToPercentage: (uiValue: string) => string;
|
|
35
|
-
export declare const percentageToUiValue: (percentage: string) => string;
|
|
36
|
-
export declare const LINE_HEIGHT_OPTIONS: {
|
|
37
|
-
value: string;
|
|
38
|
-
label: string;
|
|
39
|
-
uiValue: string;
|
|
40
|
-
description: string;
|
|
41
|
-
}[];
|
|
42
|
-
export declare const getLineHeightOptions: () => {
|
|
43
|
-
value: string;
|
|
44
|
-
label: string;
|
|
45
|
-
uiValue: string;
|
|
46
|
-
description: string;
|
|
47
|
-
}[];
|
|
48
|
-
export declare const getCurrentLineHeight: (editor: Editor | null, currentLineHeight?: string) => string;
|
|
25
|
+
export * from '../utils/typography';
|
|
49
26
|
export declare const ERR_MSG_MAP: {
|
|
50
27
|
IMAGE_SIZE: string;
|
|
51
28
|
};
|
|
@@ -184,4 +161,3 @@ export declare const checkActiveListsAndDBlocks: (editor: Editor) => {
|
|
|
184
161
|
state: import('prosemirror-state').EditorState;
|
|
185
162
|
hasMultipleLists: boolean;
|
|
186
163
|
};
|
|
187
|
-
export {};
|
|
@@ -6,8 +6,6 @@ interface SplitViewMarkdownPaneProps {
|
|
|
6
6
|
/** Same uploader the editor uses — for the markdown toolbar's Image button. */
|
|
7
7
|
ipfsImageUploadFn?: (file: File) => Promise<IpfsImageUploadResponse>;
|
|
8
8
|
onError?: (error: string) => void;
|
|
9
|
-
/** Document custom CSS — shown read-only in a collapsible accordion. */
|
|
10
|
-
customCSS?: string;
|
|
11
9
|
/** Sizing for the resizable split (flex-grow set by the draggable splitter). */
|
|
12
10
|
style?: React.CSSProperties;
|
|
13
11
|
}
|
|
@@ -17,5 +15,5 @@ interface SplitViewMarkdownPaneProps {
|
|
|
17
15
|
* real ddoc editor itself — see ddoc-editor.tsx, which keeps that editor mounted
|
|
18
16
|
* in place (never a second <EditorContent>) so its React node views survive.
|
|
19
17
|
*/
|
|
20
|
-
export declare const SplitViewMarkdownPane: ({ markdown, onMarkdownChange, ipfsImageUploadFn, onError,
|
|
18
|
+
export declare const SplitViewMarkdownPane: ({ markdown, onMarkdownChange, ipfsImageUploadFn, onError, style, }: SplitViewMarkdownPaneProps) => import("react/jsx-runtime").JSX.Element;
|
|
21
19
|
export {};
|
|
@@ -7,11 +7,6 @@ export declare const turndownService: TurndownService;
|
|
|
7
7
|
export declare const setMarkdownInlineStyles: (enabled: boolean) => void;
|
|
8
8
|
export declare const setResolveColorVars: (enabled: boolean) => void;
|
|
9
9
|
declare module '@tiptap/core' {
|
|
10
|
-
interface Storage {
|
|
11
|
-
markdownPasteHandler: {
|
|
12
|
-
customCSS: string;
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
10
|
interface Commands {
|
|
16
11
|
uploadMarkdownFile: {
|
|
17
12
|
uploadMarkdownFile: (ipfsImageUploadFn?: (file: File) => Promise<IpfsImageUploadResponse>, onError?: (error: string) => void) => any;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Editor } from '@tiptap/react';
|
|
2
|
+
import { UploadImageOptions } from '../utils/insert-commands';
|
|
3
|
+
|
|
4
|
+
export type EditorCommand = {
|
|
5
|
+
run: (arg?: string) => void;
|
|
6
|
+
isActive?: boolean;
|
|
7
|
+
isEnabled: boolean;
|
|
8
|
+
current?: string | null;
|
|
9
|
+
};
|
|
10
|
+
export type EditorCommandId = 'edit.undo' | 'edit.redo' | 'edit.selectAll' | 'edit.cut' | 'edit.copy' | 'edit.paste' | 'edit.pasteWithoutFormatting' | 'edit.delete' | 'edit.findReplace' | 'insert.image' | 'insert.table' | 'insert.link' | 'insert.callout' | 'insert.quote' | 'insert.code' | 'insert.codeBlock' | 'insert.video' | 'insert.mermaid' | 'insert.plainText' | 'insert.tweet' | 'insert.soundcloud' | 'insert.divider' | 'insert.pageBreak' | 'insert.columns2' | 'insert.columns3' | 'format.bold' | 'format.italic' | 'format.underline' | 'format.strike' | 'format.superscript' | 'format.subscript' | 'format.heading' | 'format.align' | 'format.direction' | 'format.lineHeight' | 'format.fontFamily' | 'format.fontSize.increase' | 'format.fontSize.decrease' | 'format.list.bullet' | 'format.list.numbered' | 'format.list.check' | 'format.clearFormatting' | 'table.addRowAbove' | 'table.addRowBelow' | 'table.mergeCells' | 'table.deleteRow' | 'table.addColumnLeft' | 'table.addColumnRight' | 'table.deleteColumn' | 'table.toggleHeaderRow' | 'table.toggleHeaderColumn' | 'table.toggleHeaderCell' | 'table.deleteTable';
|
|
11
|
+
export type UseEditorCommandsOptions = UploadImageOptions;
|
|
12
|
+
/**
|
|
13
|
+
* Reactive, editor-derived command registry (architecture doc §2 bucket 1).
|
|
14
|
+
* INVARIANT: all isActive/current/isEnabled values are derived from the
|
|
15
|
+
* editor via `useEditorState` (Tiptap's useSyncExternalStore wrapper) — the
|
|
16
|
+
* hook holds no authoritative state of its own, so any number of instances
|
|
17
|
+
* stay in sync, and consumers only re-render when a derived value changes
|
|
18
|
+
* (deep-equality gated), not on every transaction.
|
|
19
|
+
*/
|
|
20
|
+
export declare const useEditorCommands: (editor: Editor | null, options?: UseEditorCommandsOptions) => Record<EditorCommandId, EditorCommand>;
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
type UseFocusModeOptions = {
|
|
2
|
+
/** Notify callback — fires on every toggle in both modes (existing API). */
|
|
2
3
|
onFocusMode?: (isFocusMode: boolean) => void;
|
|
4
|
+
/** Controlled value (D6). Omit for the legacy internal-state behavior. */
|
|
5
|
+
isFocusMode?: boolean;
|
|
6
|
+
/** Controlled setter — receives the next value instead of internal mutation. */
|
|
7
|
+
onFocusModeChange?: (isFocusMode: boolean) => void;
|
|
3
8
|
};
|
|
4
|
-
export declare const useFocusMode: ({ onFocusMode }?: UseFocusModeOptions) => {
|
|
9
|
+
export declare const useFocusMode: ({ onFocusMode, isFocusMode: controlledValue, onFocusModeChange, }?: UseFocusModeOptions) => {
|
|
5
10
|
isFocusMode: boolean;
|
|
6
11
|
toggleFocusMode: () => Promise<void>;
|
|
7
12
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Editor, JSONContent } from '@tiptap/react';
|
|
1
|
+
import { AnyExtension, Editor, JSONContent } from '@tiptap/react';
|
|
2
2
|
import { handleMarkdownContent } from '../extensions/mardown-paste-handler';
|
|
3
3
|
import { IpfsImageUploadResponse } from '../types';
|
|
4
4
|
|
|
@@ -6,6 +6,14 @@ import * as Y from 'yjs';
|
|
|
6
6
|
export interface UseHeadlessEditorProps {
|
|
7
7
|
optionalExtensions?: string[];
|
|
8
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* The exact extension set the headless editor runs with. Exported so tests
|
|
11
|
+
* can build an equivalent editor without the hook.
|
|
12
|
+
*/
|
|
13
|
+
export declare const getHeadlessExtensions: (options?: {
|
|
14
|
+
ydoc?: Y.Doc;
|
|
15
|
+
optionalExtensions?: string[];
|
|
16
|
+
}) => AnyExtension[];
|
|
9
17
|
export declare const useHeadlessEditor: (props?: UseHeadlessEditorProps) => {
|
|
10
18
|
setContent: (initialContent: string | string[] | JSONContent, editor: Editor, ydoc: Y.Doc) => void;
|
|
11
19
|
getEditor: () => {
|
package/dist/package/types.d.ts
CHANGED
|
@@ -103,17 +103,6 @@ export interface DocumentStyling {
|
|
|
103
103
|
* @example "portrait" | "landscape"
|
|
104
104
|
*/
|
|
105
105
|
orientation?: 'portrait' | 'landscape';
|
|
106
|
-
/**
|
|
107
|
-
* Custom CSS
|
|
108
|
-
* @description The author's escape hatch for styling the document beyond the
|
|
109
|
-
* structured options above. Write BARE selectors (`h1 { … }`, `p { … }`,
|
|
110
|
-
* `blockquote { … }`) — they are auto-scoped to the document content, so rules
|
|
111
|
-
* can't leak into the toolbar or the host app. Bare top-level declarations
|
|
112
|
-
* (e.g. `background`, `font-family`) style the document surface itself.
|
|
113
|
-
* Applies live in the editor, in preview, and in exports (Markdown/HTML).
|
|
114
|
-
* @example "h1 { letter-spacing: -0.02em } p { line-height: 1.8 }"
|
|
115
|
-
*/
|
|
116
|
-
customCSS?: string;
|
|
117
106
|
}
|
|
118
107
|
export interface DdocProps extends CommentAccountProps {
|
|
119
108
|
/**
|
|
@@ -180,8 +169,11 @@ export interface DdocProps extends CommentAccountProps {
|
|
|
180
169
|
walletAddress?: string | null;
|
|
181
170
|
username?: string | null;
|
|
182
171
|
setUsername?: React.Dispatch<SetStateAction<string>>;
|
|
183
|
-
renderNavbar?: ({ editor }: {
|
|
172
|
+
renderNavbar?: ({ editor, liveEditor, }: {
|
|
173
|
+
/** JSON snapshot — legacy field, unchanged. */
|
|
184
174
|
editor: JSONContent;
|
|
175
|
+
/** Live Tiptap editor instance (D8) — null until the editor is ready. */
|
|
176
|
+
liveEditor: Editor | null;
|
|
185
177
|
}) => JSX.Element;
|
|
186
178
|
onChange?: (updatedDocContent: string | JSONContent, updateChunk: string) => void;
|
|
187
179
|
onCollaboratorChange?: (collaborators: undefined | IDocCollabUsers[]) => void;
|
|
@@ -209,6 +201,9 @@ export interface DdocProps extends CommentAccountProps {
|
|
|
209
201
|
onComment?: () => void;
|
|
210
202
|
onInlineComment?: () => void;
|
|
211
203
|
onFocusMode?: (isFocusMode: boolean) => void;
|
|
204
|
+
/** Controlled focus mode (D6). Omit for the legacy internal-state behavior. */
|
|
205
|
+
isFocusMode?: boolean;
|
|
206
|
+
onFocusModeChange?: (isFocusMode: boolean) => void;
|
|
212
207
|
onMarkdownExport?: () => void;
|
|
213
208
|
onMarkdownImport?: () => void;
|
|
214
209
|
onPdfExport?: () => void;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Editor, Range } from '@tiptap/core';
|
|
2
|
+
import { IpfsImageUploadResponse } from '../types';
|
|
3
|
+
|
|
4
|
+
type InsertCommand = (editor: Editor, range?: Range) => void;
|
|
5
|
+
export type UploadImageOptions = {
|
|
6
|
+
onError?: (errorString: string) => void;
|
|
7
|
+
ipfsImageUploadFn?: (file: File) => Promise<IpfsImageUploadResponse>;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* File-picker image upload — mirrors the toolbar flow
|
|
11
|
+
* (editor-utils.tsx "Upload Image") and the slash "Image" item.
|
|
12
|
+
*/
|
|
13
|
+
export declare const uploadImageCommand: (editor: Editor, { onError, ipfsImageUploadFn }?: UploadImageOptions) => void;
|
|
14
|
+
/**
|
|
15
|
+
* Insert commands shared by the slash menu and `useEditorCommands`.
|
|
16
|
+
* Bodies are moved verbatim from `slash-command-utils.tsx`; the optional
|
|
17
|
+
* `range` only differs when invoked from the slash menu.
|
|
18
|
+
*/
|
|
19
|
+
export declare const insertCommands: Record<string, InsertCommand>;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Editor } from '@tiptap/core';
|
|
2
|
+
|
|
3
|
+
export declare const FONT_SIZES: readonly [8, 9, 10, 11, 12, 14, 16, 18, 24, 30, 32, 36, 48, 60, 72, 96];
|
|
4
|
+
export declare const getFontSizeOptions: (editor?: Editor) => {
|
|
5
|
+
title: string;
|
|
6
|
+
value: string;
|
|
7
|
+
label: string;
|
|
8
|
+
command: (editor: Editor) => void;
|
|
9
|
+
isActive: () => boolean | undefined;
|
|
10
|
+
}[];
|
|
11
|
+
export declare const getCurrentFontSize: (editor: Editor | null, currentSize: string) => string;
|
|
12
|
+
export declare const uiValueToPercentage: (uiValue: string) => string;
|
|
13
|
+
export declare const percentageToUiValue: (percentage: string) => string;
|
|
14
|
+
export declare const LINE_HEIGHT_OPTIONS: {
|
|
15
|
+
value: string;
|
|
16
|
+
label: string;
|
|
17
|
+
uiValue: string;
|
|
18
|
+
description: string;
|
|
19
|
+
}[];
|
|
20
|
+
export declare const getLineHeightOptions: () => {
|
|
21
|
+
value: string;
|
|
22
|
+
label: string;
|
|
23
|
+
uiValue: string;
|
|
24
|
+
description: string;
|
|
25
|
+
}[];
|
|
26
|
+
export declare const getCurrentLineHeight: (editor: Editor | null, currentLineHeight?: string) => string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { j as d } from "./index-
|
|
1
|
+
import { j as d } from "./index-DwLAI_Ie.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-BWdjUdQy.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(
|