@fileverse-dev/ddoc 4.8.8 → 4.8.10-alpha.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 CHANGED
@@ -266,15 +266,7 @@ const fonts: FontDescriptor[] = [
266
266
  | `onSlidesShare` | `() => void` | Callback for slides sharing |
267
267
  | `onComment` | `() => void` | General comment callback |
268
268
 
269
- ## AI Writer Props
270
-
271
- | Property | Type | Description |
272
- | ------------------ | ------------- | ----------------------------------------------- |
273
- | `activeModel` | `CustomModel` | Currently selected AI model for text generation |
274
- | `maxTokens` | `number` | Maximum token limit for AI-generated content |
275
- | `isAIAgentEnabled` | `boolean` | Toggle for AI agent functionality |
276
-
277
- ### Steps to run this example locally
269
+ ## Steps to run this example locally
278
270
 
279
271
  - `npm i`
280
272
  - `npm run dev`
@@ -1,4 +1,4 @@
1
- import { c8 as s } from "./use-headless-editor-tGaiIKPG.mjs";
1
+ import { c8 as s } from "./use-headless-editor-D0K_krgH.mjs";
2
2
  const n = (e) => {
3
3
  const { getYjsConvertor: t, mergeYjsUpdates: r } = s(e);
4
4
  return { getYjsConvertor: t, mergeYjsUpdates: r };
@@ -1,4 +1,4 @@
1
- import { c9 as Ql, ca as Zl, cb as eh } from "./use-headless-editor-tGaiIKPG.mjs";
1
+ import { c9 as Ql, ca as Zl, cb as eh } from "./use-headless-editor-D0K_krgH.mjs";
2
2
  let An = [], Xr = [];
3
3
  (() => {
4
4
  let s = "lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,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k,6o".split(",").map((e) => e ? parseInt(e, 36) : 1);
package/dist/index.es.js CHANGED
@@ -2,8 +2,8 @@ var pm = Object.defineProperty;
2
2
  var mm = (e, t, r) => t in e ? pm(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
3
  var ye = (e, t, r) => mm(e, typeof t != "symbol" ? t + "" : t, r);
4
4
  import { jsx as d, jsxs as M, Fragment as Bt } from "react/jsx-runtime";
5
- import { P as so, a as io, i as cd, p as ld, N as gm, C as ym, E as ao, g as xm, b as bm, u as ud, c as dd, B as wm, M as vm, d as nc, e as Cm, f as Ti, s as Em, h as Sm, j as Dm, k as Am, l as fd, w as Ni, m as km, t as Tm, n as Nm, o as jt, q as le, r as On, v as hd, x as co, y as Ys, z as zo, A as _m, D as Rm, F as Im, L as Bm, G as pd, H as Ko, I as xa, J as dt, S as Om, K as ba, O as Lm, T as It, Q as Mm, R as Um, U as md, V as Fm, W as Pm, X as Ke, Y as gd, Z as Vr, _ as Hm, $ as zm, a0 as yd, a1 as rc, a2 as oc, a3 as xd, a4 as Km, a5 as jm, a6 as Vm, a7 as $m, a8 as qm, a9 as Wm, aa as Ym, ab as bd, ac as Gm, ad as Zm, ae as Xm, af as _i, ag as cl, ah as Qm, ai as Yt, aj as Jm, ak as ll, al as e0, am as t0, an as n0, ao as r0, ap as Cr, aq as wd, ar as sc, as as o0, at as Io, au as s0, av as Gs, aw as i0, ax as a0, ay as c0, az as l0, aA as u0, aB as vd, aC as jo, aD as Cd, aE as Ed, aF as To, aG as Sd, aH as ul, aI as dl, aJ as Kt, aK as d0, aL as f0, aM as h0, aN as Dd, aO as p0, aP as m0, aQ as g0, aR as y0, aS as x0, aT as b0, aU as w0, aV as v0, aW as C0, aX as E0, aY as S0, aZ as D0, a_ as A0, a$ as k0, b0 as Ri, b1 as Ad, b2 as kd, b3 as Sn, b4 as Ts, b5 as _t, b6 as ic, b7 as fl, b8 as Ii, b9 as T0, ba as N0, bb as _0, bc as yn, bd as R0, be as I0, bf as B0, bg as O0, bh as L0, bi as M0, bj as or, bk as U0, bl as Bo, bm as ac, bn as F0, bo as P0, bp as H0, bq as cc, br as z0, bs as K0, bt as Ns, bu as Bi, bv as Vo, bw as j0, bx as V0, by as $0, bz as q0, bA as W0, bB as Y0, bC as G0, bD as Z0, bE as X0, bF as Q0, bG as J0, bH as eg, bI as tg, bJ as ng, bK as wa, bL as va, bM as rg, bN as og, bO as sg, bP as ig, bQ as ag, bR as cg, bS as hl, bT as lg, bU as ug, bV as dg, bW as fg, bX as hg, bY as pg, bZ as mg, b_ as gg, b$ as yg, c0 as xg, c1 as bg, c2 as wg, c3 as Td, c4 as vg, c5 as Cg } from "./use-headless-editor-tGaiIKPG.mjs";
6
- import { c6 as e5, c7 as t5 } from "./use-headless-editor-tGaiIKPG.mjs";
5
+ import { P as so, a as io, i as cd, p as ld, N as gm, C as ym, E as ao, g as xm, b as bm, u as ud, c as dd, B as wm, M as vm, d as nc, e as Cm, f as Ti, s as Em, h as Sm, j as Dm, k as Am, l as fd, w as Ni, m as km, t as Tm, n as Nm, o as jt, q as le, r as On, v as hd, x as co, y as Ys, z as zo, A as _m, D as Rm, F as Im, L as Bm, G as pd, H as Ko, I as xa, J as dt, S as Om, K as ba, O as Lm, T as It, Q as Mm, R as Um, U as md, V as Fm, W as Pm, X as Ke, Y as gd, Z as Vr, _ as Hm, $ as zm, a0 as yd, a1 as rc, a2 as oc, a3 as xd, a4 as Km, a5 as jm, a6 as Vm, a7 as $m, a8 as qm, a9 as Wm, aa as Ym, ab as bd, ac as Gm, ad as Zm, ae as Xm, af as _i, ag as cl, ah as Qm, ai as Yt, aj as Jm, ak as ll, al as e0, am as t0, an as n0, ao as r0, ap as Cr, aq as wd, ar as sc, as as o0, at as Io, au as s0, av as Gs, aw as i0, ax as a0, ay as c0, az as l0, aA as u0, aB as vd, aC as jo, aD as Cd, aE as Ed, aF as To, aG as Sd, aH as ul, aI as dl, aJ as Kt, aK as d0, aL as f0, aM as h0, aN as Dd, aO as p0, aP as m0, aQ as g0, aR as y0, aS as x0, aT as b0, aU as w0, aV as v0, aW as C0, aX as E0, aY as S0, aZ as D0, a_ as A0, a$ as k0, b0 as Ri, b1 as Ad, b2 as kd, b3 as Sn, b4 as Ts, b5 as _t, b6 as ic, b7 as fl, b8 as Ii, b9 as T0, ba as N0, bb as _0, bc as yn, bd as R0, be as I0, bf as B0, bg as O0, bh as L0, bi as M0, bj as or, bk as U0, bl as Bo, bm as ac, bn as F0, bo as P0, bp as H0, bq as cc, br as z0, bs as K0, bt as Ns, bu as Bi, bv as Vo, bw as j0, bx as V0, by as $0, bz as q0, bA as W0, bB as Y0, bC as G0, bD as Z0, bE as X0, bF as Q0, bG as J0, bH as eg, bI as tg, bJ as ng, bK as wa, bL as va, bM as rg, bN as og, bO as sg, bP as ig, bQ as ag, bR as cg, bS as hl, bT as lg, bU as ug, bV as dg, bW as fg, bX as hg, bY as pg, bZ as mg, b_ as gg, b$ as yg, c0 as xg, c1 as bg, c2 as wg, c3 as Td, c4 as vg, c5 as Cg } from "./use-headless-editor-D0K_krgH.mjs";
6
+ import { c6 as e5, c7 as t5 } from "./use-headless-editor-D0K_krgH.mjs";
7
7
  import * as Tt from "react";
8
8
  import Ct, { useRef as ae, useEffect as ue, useState as he, useCallback as ne, useMemo as Ze, forwardRef as Jt, useReducer as Nd, useLayoutEffect as Zr, memo as Zs, createElement as Ca, lazy as _d, Suspense as pl, useImperativeHandle as Rd } from "react";
9
9
  import { createPortal as Xs } from "react-dom";
@@ -14128,7 +14128,7 @@ function Yv(e, t) {
14128
14128
  });
14129
14129
  r.sort((o, s) => !!o.isPlaceholder != !!s.isPlaceholder ? o.isPlaceholder ? 1 : -1 : String(o.clientId).localeCompare(String(s.clientId)));
14130
14130
  const n = /* @__PURE__ */ new Set();
14131
- return r.filter((o) => o.isPlaceholder || !o.name ? !0 : n.has(o.name) ? !1 : (n.add(o.name), !0));
14131
+ return r.filter((o) => o.isPlaceholder || !o.name || n.has(o.name) ? !1 : (n.add(o.name), !0));
14132
14132
  }
14133
14133
  function Gv(e, t) {
14134
14134
  const r = new Set(
@@ -29855,7 +29855,7 @@ const tS = [["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]], nS = eS("ChevronRi
29855
29855
  ),
29856
29856
  t && /* @__PURE__ */ d("pre", { className: "m-0 px-3 pb-2 text-[11px] leading-relaxed font-mono color-text-secondary whitespace-pre-wrap break-words max-h-40 overflow-auto select-text", children: n })
29857
29857
  ] }) : null;
29858
- }, oS = _d(() => import("./markdown-source-pane-BCz_3QdE.mjs")), sS = _d(() => import("./split-view-toolbar-Bq6YWZXf.mjs")), iS = ({
29858
+ }, oS = _d(() => import("./markdown-source-pane-CLsOC_HY.mjs")), sS = _d(() => import("./split-view-toolbar-BHCLUger.mjs")), iS = ({
29859
29859
  markdown: e,
29860
29860
  onMarkdownChange: t,
29861
29861
  ipfsImageUploadFn: r,
@@ -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-DcXAZw7b.mjs";
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-Ba6dC71x.mjs";
7
7
  class ua {
8
8
  /**
9
9
  Create a new completion context. (Mostly useful for testing
@@ -1,6 +1,7 @@
1
1
  import { Extension } from '@tiptap/core';
2
2
  import { IpfsImageUploadResponse } from '../../types';
3
3
 
4
+ export declare const DOCX_STYLE_MAP: string[];
4
5
  declare module '@tiptap/core' {
5
6
  interface Commands {
6
7
  uploadDocxFile: {
@@ -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 w:spacing at all. Structure still comes from mammoth; only the
7
- * presentational values we model are read here, from the same arrayBuffer.
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
- * Zip the spacing onto mammoth's HTML as inline styles, which the LineHeight
23
- * and ParagraphSpacing attributes already parse back on import.
24
- *
25
- * Alignment is positional, so it is verified rather than trusted: mammoth
26
- * relocates text boxes and appends footnotes, and `ignoreEmptyParagraphs`
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 the spacing out of the .docx archive and zip it onto mammoth's HTML.
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>;
@@ -43,6 +43,7 @@ declare const MarkdownPasteHandler: (ipfsImageUploadFn?: (file: File) => Promise
43
43
  url: string;
44
44
  file: File;
45
45
  }>, fetchV1ImageFn?: (url: string) => Promise<ArrayBuffer | undefined>) => Extension<any, any>;
46
+ export declare function isMarkdown(content: string): boolean;
46
47
  export declare const stripFrontmatter: (markdown: string) => string;
47
48
  export declare function handleMarkdownContent(view: any, content: string, ipfsImageUploadFn?: (file: File) => Promise<IpfsImageUploadResponse>, options?: {
48
49
  breaks?: boolean;
@@ -53,6 +54,10 @@ export declare function handleMarkdownContent(view: any, content: string, ipfsIm
53
54
  * paste leaves it off — markdown-it emits stray empty paragraphs of its
54
55
  * own that nobody typed. */
55
56
  preserveEmptyParagraphs?: boolean;
57
+ /** Input is HTML, not markdown — skip every markdown-shorthand rewrite so
58
+ * literal `*`, `^` and `~` survive. DOCX import sets this: a tilde the
59
+ * author typed is text, not formatting. */
60
+ preserveLiteralText?: boolean;
56
61
  }): Promise<void>;
57
62
  export default MarkdownPasteHandler;
58
63
  export declare function searchForSecureImageNodeAndEmbedImageContent(originalDoc: PMNode, ipfsImageFetchFn?: (_data: IpfsImageFetchPayload) => Promise<{
@@ -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-DcXAZw7b.mjs";
4
+ import { a3 as _, a4 as w, c as R } from "./index-Ba6dC71x.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(