@fileverse-dev/ddoc 4.8.7 → 4.8.9
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 +1 -9
- package/dist/headless-editor-utils.es.js +1 -1
- package/dist/{index-LGuJAqEe.mjs → index-CUxUj0bK.mjs} +1 -1
- package/dist/index.es.js +3719 -3698
- package/dist/{markdown-source-pane-CddF_Vbc.mjs → markdown-source-pane-BSXJZ2bx.mjs} +1 -1
- package/dist/package/extensions/d-block/dblock-toolbar.d.ts +8 -0
- package/dist/package/extensions/docx/docx-import.d.ts +1 -0
- package/dist/package/extensions/docx/docx-spacing.d.ts +19 -16
- package/dist/package/extensions/table-of-contents.d.ts +4 -0
- package/dist/package/utils/typography.d.ts +7 -0
- package/dist/{split-view-toolbar-DUpCNmJ3.mjs → split-view-toolbar-CNXzTjyk.mjs} +1 -1
- package/dist/{use-headless-editor-BBVwebY0.mjs → use-headless-editor-D-WchBmL.mjs} +12865 -12562
- package/package.json +1 -1
|
@@ -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-CUxUj0bK.mjs";
|
|
7
7
|
class ua {
|
|
8
8
|
/**
|
|
9
9
|
Create a new completion context. (Mostly useful for testing
|
|
@@ -8,7 +8,15 @@ interface DBlockTemplateTarget {
|
|
|
8
8
|
node: ProseMirrorNode;
|
|
9
9
|
pos: number;
|
|
10
10
|
}
|
|
11
|
+
export declare const isDocumentBlank: (doc: ProseMirrorNode) => boolean;
|
|
12
|
+
export declare const getTemplateTargetFromBlankState: (editor: Editor | null, runtimeState: DBlockRuntimeState, documentIsBlank: boolean) => DBlockTemplateTarget | null;
|
|
11
13
|
export declare const getTemplateTarget: (editor: Editor | null, runtimeState: DBlockRuntimeState) => DBlockTemplateTarget | null;
|
|
14
|
+
export declare const DBlockTemplateOverlay: ({ editor, enableFanficTemplate, onApplyTabbedTemplate, runtimeState, }: {
|
|
15
|
+
editor: Editor | null;
|
|
16
|
+
enableFanficTemplate: boolean;
|
|
17
|
+
onApplyTabbedTemplate?: (template: TabbedJSONContent) => void;
|
|
18
|
+
runtimeState: DBlockRuntimeState;
|
|
19
|
+
}) => React.ReactPortal | null;
|
|
12
20
|
export declare const DBlockToolbarProvider: ({ children, editor, enableFanficTemplate, runtimeState, isPreviewEditor, onApplyTabbedTemplate, onCopyHeadingLink, }: {
|
|
13
21
|
children: React.ReactNode;
|
|
14
22
|
editor: Editor | null;
|
|
@@ -1,17 +1,26 @@
|
|
|
1
|
+
export type DocxRunFormatting = {
|
|
2
|
+
text: string;
|
|
3
|
+
color: string | null;
|
|
4
|
+
fontSize: string | null;
|
|
5
|
+
fontFamily: string | null;
|
|
6
|
+
};
|
|
1
7
|
/**
|
|
2
|
-
* Paragraph spacing read straight out of the OOXML.
|
|
8
|
+
* Paragraph spacing and formatting read straight out of the OOXML.
|
|
3
9
|
*
|
|
4
10
|
* Mammoth is a *semantic* converter — its README is explicit that it uses "the
|
|
5
11
|
* semantic information in the document, and ignoring other details" — so it
|
|
6
|
-
* never parses
|
|
7
|
-
*
|
|
12
|
+
* never parses presentation attributes (spacing, text color, font size, font family).
|
|
13
|
+
* Structure comes from mammoth; presentation values are merged here.
|
|
8
14
|
*/
|
|
9
15
|
export type DocxParagraphSpacing = {
|
|
10
16
|
spaceBefore: number | null;
|
|
11
17
|
spaceAfter: number | null;
|
|
12
18
|
lineHeight: string | null;
|
|
19
|
+
textAlign: string | null;
|
|
20
|
+
hasImage: boolean;
|
|
13
21
|
/** Paragraph text, used to verify alignment against mammoth's output. */
|
|
14
22
|
text: string;
|
|
23
|
+
runs: DocxRunFormatting[];
|
|
15
24
|
};
|
|
16
25
|
/**
|
|
17
26
|
* One entry per w:p, in document order — the same order mammoth emits its
|
|
@@ -19,21 +28,15 @@ export type DocxParagraphSpacing = {
|
|
|
19
28
|
*/
|
|
20
29
|
export declare const readDocxSpacing: (documentXml: string, stylesXml: string) => DocxParagraphSpacing[];
|
|
21
30
|
/**
|
|
22
|
-
*
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
*
|
|
27
|
-
* has to stay off for the counts to line up at all. On any divergence the
|
|
28
|
-
* HTML is returned untouched — no spacing is better than spacing on the
|
|
29
|
-
* wrong paragraphs, which is silent and hard to trace.
|
|
31
|
+
* Apply run styling (color, fontSize, fontFamily) to DOM Text nodes within a block.
|
|
32
|
+
*/
|
|
33
|
+
export declare const applyRunStylesToBlock: (block: HTMLElement, runs: DocxRunFormatting[]) => void;
|
|
34
|
+
/**
|
|
35
|
+
* Zip spacing, alignment, image alignment, and run formatting onto mammoth's HTML.
|
|
30
36
|
*/
|
|
31
37
|
export declare const applyDocxSpacingToHtml: (html: string, spacings: DocxParagraphSpacing[]) => string;
|
|
32
38
|
/**
|
|
33
|
-
* Read
|
|
34
|
-
*
|
|
35
|
-
* Reuses the arrayBuffer mammoth is already given, so the file is not read
|
|
36
|
-
* twice. Every failure path returns the original HTML: losing spacing is
|
|
37
|
-
* recoverable, losing the import is not.
|
|
39
|
+
* Read spacing, alignment, image presence, and run formatting from .docx archive
|
|
40
|
+
* and apply onto mammoth's HTML.
|
|
38
41
|
*/
|
|
39
42
|
export declare const readDocxSpacingFromArchive: (arrayBuffer: ArrayBuffer, html: string) => Promise<string>;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { Editor } from '@tiptap/core';
|
|
2
2
|
import { TableOfContentsStorage } from '@tiptap/extension-table-of-contents';
|
|
3
|
+
import { Node as ProseMirrorNode } from '@tiptap/pm/model';
|
|
4
|
+
import { Transaction } from '@tiptap/pm/state';
|
|
3
5
|
|
|
4
6
|
type EditorWithTableOfContentsStorage = {
|
|
5
7
|
storage?: {
|
|
@@ -7,5 +9,7 @@ type EditorWithTableOfContentsStorage = {
|
|
|
7
9
|
};
|
|
8
10
|
};
|
|
9
11
|
export declare const clearTableOfContentsStorage: (target: Editor | EditorWithTableOfContentsStorage | TableOfContentsStorage | null | undefined) => boolean;
|
|
12
|
+
export declare const getHeadingSignature: (doc: ProseMirrorNode) => string;
|
|
13
|
+
export declare const transactionCouldTouchHeading: (transaction: Transaction) => boolean;
|
|
10
14
|
export declare const DdocTableOfContents: import('@tiptap/core').Extension<import('@tiptap/extension-table-of-contents').TableOfContentsOptions, TableOfContentsStorage>;
|
|
11
15
|
export {};
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import { Editor } from '@tiptap/core';
|
|
2
2
|
|
|
3
3
|
export declare const FONT_SIZES: readonly [8, 9, 10, 11, 12, 14, 16, 18, 24, 30, 32, 36, 48, 60, 72, 96];
|
|
4
|
+
/** The font picker's entries. Its values are what `setFontFamily` stores, so
|
|
5
|
+
* anything written from elsewhere has to use the same stack to be recognised
|
|
6
|
+
* as the active font — and to inherit the fallbacks. */
|
|
7
|
+
export declare const FONT_STACK: Record<string, string>;
|
|
8
|
+
/** A family the picker knows becomes its full stack; anything else is passed
|
|
9
|
+
* through, so an unrecognised font still renders under its own name. */
|
|
10
|
+
export declare const toEditorFontStack: (family: string) => string;
|
|
4
11
|
export declare const getFontSizeOptions: (editor?: Editor) => {
|
|
5
12
|
title: string;
|
|
6
13
|
value: string;
|
|
@@ -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-CUxUj0bK.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(
|