@arbidocs/blocks 0.4.108 → 0.4.109
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/{NativeDocxEditor-UAZUKZ77.js → NativeDocxEditor-4PY4YZYC.js} +3 -3
- package/dist/{NativeDocxEditor-UAZUKZ77.js.map → NativeDocxEditor-4PY4YZYC.js.map} +1 -1
- package/dist/{NativeDocxEditor-YX7B7OFH.cjs → NativeDocxEditor-WODZAURG.cjs} +7 -7
- package/dist/{NativeDocxEditor-YX7B7OFH.cjs.map → NativeDocxEditor-WODZAURG.cjs.map} +1 -1
- package/dist/agents/index.cjs +207 -207
- package/dist/agents/index.js +2 -2
- package/dist/chat/index.cjs +124 -124
- package/dist/chat/index.js +2 -2
- package/dist/{chunk-QT6EGMAJ.cjs → chunk-2NIL2ASF.cjs} +38 -294
- package/dist/chunk-2NIL2ASF.cjs.map +1 -0
- package/dist/{chunk-TTXK62YI.cjs → chunk-54WBIVHV.cjs} +5 -5
- package/dist/{chunk-TTXK62YI.cjs.map → chunk-54WBIVHV.cjs.map} +1 -1
- package/dist/{chunk-IXALYQT7.cjs → chunk-C2CWWEHO.cjs} +2 -2
- package/dist/chunk-C2CWWEHO.cjs.map +1 -0
- package/dist/{chunk-XQKGYGCJ.js → chunk-DQCYCEDR.js} +3 -3
- package/dist/{chunk-XQKGYGCJ.js.map → chunk-DQCYCEDR.js.map} +1 -1
- package/dist/{chunk-ZYSY4L5L.cjs → chunk-ELDUWTRR.cjs} +4 -4
- package/dist/{chunk-ZYSY4L5L.cjs.map → chunk-ELDUWTRR.cjs.map} +1 -1
- package/dist/{chunk-3Y6NQIDE.js → chunk-FQX6N5G6.js} +5 -4
- package/dist/chunk-FQX6N5G6.js.map +1 -0
- package/dist/{chunk-LLFW2T6S.cjs → chunk-GBYY3PIC.cjs} +9 -8
- package/dist/chunk-GBYY3PIC.cjs.map +1 -0
- package/dist/{chunk-A2MN2ZLX.js → chunk-GKDWQLVU.js} +13 -274
- package/dist/chunk-GKDWQLVU.js.map +1 -0
- package/dist/{chunk-24ND4S6Y.cjs → chunk-I4XQCE6U.cjs} +5 -5
- package/dist/{chunk-24ND4S6Y.cjs.map → chunk-I4XQCE6U.cjs.map} +1 -1
- package/dist/{chunk-P2KPDPFF.js → chunk-IXTQYFIF.js} +23 -15
- package/dist/chunk-IXTQYFIF.js.map +1 -0
- package/dist/{chunk-JQVPGMLU.js → chunk-JB32KYAH.js} +3 -3
- package/dist/{chunk-JQVPGMLU.js.map → chunk-JB32KYAH.js.map} +1 -1
- package/dist/{chunk-PBS5MFIY.cjs → chunk-JK45LSIH.cjs} +3 -3
- package/dist/{chunk-PBS5MFIY.cjs.map → chunk-JK45LSIH.cjs.map} +1 -1
- package/dist/{chunk-ZPLG7QYF.js → chunk-N5YEF3LC.js} +2 -2
- package/dist/chunk-N5YEF3LC.js.map +1 -0
- package/dist/{chunk-EWSEQEPL.js → chunk-NUTLXVPX.js} +3 -2
- package/dist/chunk-NUTLXVPX.js.map +1 -0
- package/dist/{chunk-MP6FK43E.cjs → chunk-PDRYGPZB.cjs} +3 -2
- package/dist/chunk-PDRYGPZB.cjs.map +1 -0
- package/dist/{chunk-EGDWNEAG.js → chunk-PEHLUB52.js} +3 -3
- package/dist/{chunk-EGDWNEAG.js.map → chunk-PEHLUB52.js.map} +1 -1
- package/dist/{chunk-XMBYDLZQ.cjs → chunk-QKWQMOHN.cjs} +4 -4
- package/dist/{chunk-XMBYDLZQ.cjs.map → chunk-QKWQMOHN.cjs.map} +1 -1
- package/dist/{chunk-DTBSGG36.cjs → chunk-U6MPHCEB.cjs} +24 -16
- package/dist/chunk-U6MPHCEB.cjs.map +1 -0
- package/dist/{chunk-XQDM6T6C.js → chunk-UABPHZWZ.js} +3 -3
- package/dist/{chunk-XQDM6T6C.js.map → chunk-UABPHZWZ.js.map} +1 -1
- package/dist/{chunk-S7RHJI5Q.js → chunk-ZSV2NQQP.js} +3 -3
- package/dist/{chunk-S7RHJI5Q.js.map → chunk-ZSV2NQQP.js.map} +1 -1
- package/dist/citations/index.cjs +10 -10
- package/dist/citations/index.js +1 -1
- package/dist/collaboration/index.cjs +16 -16
- package/dist/collaboration/index.js +2 -2
- package/dist/connect/docx.cjs +6 -6
- package/dist/connect/docx.js +4 -4
- package/dist/connect/index.cjs +37 -37
- package/dist/connect/index.js +8 -8
- package/dist/databases/index.cjs +2 -2
- package/dist/databases/index.js +1 -1
- package/dist/docx/definitions/fragment.d.ts +2 -6
- package/dist/docx/definitions/port.d.ts +2 -57
- package/dist/docx/index.cjs +46 -46
- package/dist/docx/index.js +3 -3
- package/dist/docx/references/commands.d.ts +3 -31
- package/dist/docx/references/numbering.d.ts +3 -47
- package/dist/facts/index.cjs +2 -2
- package/dist/facts/index.js +1 -1
- package/dist/files/GridView.d.ts +4 -1
- package/dist/files/TagPassagePanel.d.ts +2 -0
- package/dist/files/index.cjs +84 -74
- package/dist/files/index.cjs.map +1 -1
- package/dist/files/index.js +84 -74
- package/dist/files/index.js.map +1 -1
- package/dist/index.cjs +422 -422
- package/dist/index.js +7 -7
- package/dist/settings/FirmPool.d.ts +45 -0
- package/dist/settings/index.cjs +97 -0
- package/dist/settings/index.cjs.map +1 -1
- package/dist/settings/index.d.ts +1 -0
- package/dist/settings/index.js +95 -1
- package/dist/settings/index.js.map +1 -1
- package/dist/studio/index.cjs +3 -3
- package/dist/studio/index.js +2 -2
- package/dist/workflow-canvas/index.cjs +9 -9
- package/dist/workflow-canvas/index.js +2 -2
- package/dist/workspaces/index.cjs +1 -1
- package/dist/workspaces/index.cjs.map +1 -1
- package/dist/workspaces/index.js +1 -1
- package/dist/workspaces/index.js.map +1 -1
- package/node_modules/@arbidocs/coedit/dist/commands.cjs +356 -0
- package/node_modules/@arbidocs/coedit/dist/commands.cjs.map +1 -0
- package/node_modules/@arbidocs/coedit/dist/commands.d.cts +235 -0
- package/node_modules/@arbidocs/coedit/dist/commands.d.ts +235 -0
- package/node_modules/@arbidocs/coedit/dist/commands.js +338 -0
- package/node_modules/@arbidocs/coedit/dist/commands.js.map +1 -0
- package/node_modules/@arbidocs/coedit/package.json +6 -1
- package/package.json +4 -4
- package/dist/chunk-3Y6NQIDE.js.map +0 -1
- package/dist/chunk-A2MN2ZLX.js.map +0 -1
- package/dist/chunk-DTBSGG36.cjs.map +0 -1
- package/dist/chunk-EWSEQEPL.js.map +0 -1
- package/dist/chunk-IXALYQT7.cjs.map +0 -1
- package/dist/chunk-LLFW2T6S.cjs.map +0 -1
- package/dist/chunk-MP6FK43E.cjs.map +0 -1
- package/dist/chunk-P2KPDPFF.js.map +0 -1
- package/dist/chunk-QT6EGMAJ.cjs.map +0 -1
- package/dist/chunk-ZPLG7QYF.js.map +0 -1
|
@@ -15,7 +15,8 @@ import * as Y from 'yjs';
|
|
|
15
15
|
import { DOCUMENT_COLLABORATION_VERSIONS, collaborationModule } from '@arbidocs/coedit';
|
|
16
16
|
import { createHocuspocusCollaboration } from '@arbidocs/coedit/hocuspocus';
|
|
17
17
|
import { defaultLegalTemplate, listBuildingBlocks, attachedTemplateOf, linkedLevelStyles, styleDivergence, buildingBlockFragment, fragmentClipboardHtml, trackInsertion, newFromTemplate } from '@arbidocs/coedit/template';
|
|
18
|
-
import {
|
|
18
|
+
import { readParagraphs, documentNumbering, listTargets, REF_BOOKMARK_PREFIX, filterTargets, paragraphNumber, FIELD_ATOM, staleCrossReferences, brokenCrossReferences, BROKEN_CROSS_REFERENCE_STYLE, CROSS_REFERENCE_STYLE, DEFINED_TERM_STYLE } from '@arbidocs/coedit/commands';
|
|
19
|
+
export { listTargets, paragraphNumber } from '@arbidocs/coedit/commands';
|
|
19
20
|
import { executeImageCommand } from '@docx-editor.dev/core/editor';
|
|
20
21
|
|
|
21
22
|
function normalizeDocxExport(data) {
|
|
@@ -1350,9 +1351,6 @@ function DocxMentions({
|
|
|
1350
1351
|
}
|
|
1351
1352
|
) });
|
|
1352
1353
|
}
|
|
1353
|
-
var DEFINED_TERM_STYLE = "DefinedTerm";
|
|
1354
|
-
var CROSS_REFERENCE_STYLE = "CrossReference";
|
|
1355
|
-
var BROKEN_CROSS_REFERENCE_STYLE = "CrossReferenceBroken";
|
|
1356
1354
|
var CHARACTER_STYLES = {
|
|
1357
1355
|
[DEFINED_TERM_STYLE]: `<w:style w:type="character" w:customStyle="1" w:styleId="${DEFINED_TERM_STYLE}"><w:name w:val="Defined Term"/><w:rPr><w:u w:val="dotted" w:color="7F7F7F"/></w:rPr></w:style>`,
|
|
1358
1356
|
[CROSS_REFERENCE_STYLE]: `<w:style w:type="character" w:customStyle="1" w:styleId="${CROSS_REFERENCE_STYLE}"><w:name w:val="Cross Reference"/><w:rPr><w:color w:val="1F4E79"/><w:u w:val="dotted" w:color="8EA9C1"/></w:rPr></w:style>`,
|
|
@@ -1581,136 +1579,7 @@ function LinkHoverCard({
|
|
|
1581
1579
|
document.body
|
|
1582
1580
|
);
|
|
1583
1581
|
}
|
|
1584
|
-
|
|
1585
|
-
// src/docx/definitions/port.ts
|
|
1586
|
-
var WATCHED_STYLES = /* @__PURE__ */ new Set([BROKEN_CROSS_REFERENCE_STYLE]);
|
|
1587
1582
|
var attr = (node, name) => node.attributes?.find((a) => a.localName === name)?.value;
|
|
1588
|
-
var FIELD_ATOM = "\uFFFC";
|
|
1589
|
-
var HEADING_STYLE = /^(heading|berschrift|titre|t[ií]tulo|titolo|kop)\s*\d/i;
|
|
1590
|
-
function readParagraphs(root) {
|
|
1591
|
-
const out = [];
|
|
1592
|
-
const body = root.children?.find((n) => n.kind === "body") ?? root;
|
|
1593
|
-
const visit = (node, topLevel, pending) => {
|
|
1594
|
-
for (const child of node.children ?? []) {
|
|
1595
|
-
if (child.kind === "paragraph") {
|
|
1596
|
-
out.push(readParagraph(child, topLevel, pending.splice(0)));
|
|
1597
|
-
} else if (child.localName === "bookmarkStart") {
|
|
1598
|
-
const name = attr(child, "name");
|
|
1599
|
-
if (name) pending.push(name);
|
|
1600
|
-
} else if (child.localName === "tbl" || child.localName === "tr" || child.localName === "tc") {
|
|
1601
|
-
visit(child, false, pending);
|
|
1602
|
-
} else if (child.localName === "sdt" || child.localName === "sdtContent") {
|
|
1603
|
-
visit(child, topLevel, pending);
|
|
1604
|
-
}
|
|
1605
|
-
}
|
|
1606
|
-
};
|
|
1607
|
-
visit(body, true, []);
|
|
1608
|
-
return out;
|
|
1609
|
-
}
|
|
1610
|
-
function readParagraph(node, topLevel, bookmarks) {
|
|
1611
|
-
let text = "";
|
|
1612
|
-
const links = [];
|
|
1613
|
-
let styleId;
|
|
1614
|
-
let outline = false;
|
|
1615
|
-
let fieldDepth = 0;
|
|
1616
|
-
const marks = [];
|
|
1617
|
-
let runStyle;
|
|
1618
|
-
const fields = [];
|
|
1619
|
-
let current = null;
|
|
1620
|
-
const field = (c) => {
|
|
1621
|
-
const type = attr(c, "fldCharType");
|
|
1622
|
-
if (type === "begin") {
|
|
1623
|
-
if (fieldDepth === 0) {
|
|
1624
|
-
current = { offset: text.length, instruction: "", result: "", inResult: false };
|
|
1625
|
-
text += FIELD_ATOM;
|
|
1626
|
-
}
|
|
1627
|
-
fieldDepth++;
|
|
1628
|
-
} else if (type === "separate" && fieldDepth === 1 && current) current.inResult = true;
|
|
1629
|
-
else if (type === "end") {
|
|
1630
|
-
fieldDepth = Math.max(0, fieldDepth - 1);
|
|
1631
|
-
if (fieldDepth === 0 && current) {
|
|
1632
|
-
const { offset, instruction, result } = current;
|
|
1633
|
-
fields.push({ offset, instruction: instruction.trim(), result });
|
|
1634
|
-
current = null;
|
|
1635
|
-
}
|
|
1636
|
-
}
|
|
1637
|
-
};
|
|
1638
|
-
const walk = (n, link) => {
|
|
1639
|
-
for (const c of n.children ?? []) {
|
|
1640
|
-
if (c.localName === "fldChar") {
|
|
1641
|
-
field(c);
|
|
1642
|
-
continue;
|
|
1643
|
-
}
|
|
1644
|
-
if (c.localName === "fldSimple") {
|
|
1645
|
-
if (fieldDepth === 0) text += FIELD_ATOM;
|
|
1646
|
-
continue;
|
|
1647
|
-
}
|
|
1648
|
-
if (c.localName === "instrText") {
|
|
1649
|
-
if (fieldDepth === 1 && current)
|
|
1650
|
-
current.instruction += (c.children ?? []).map((t) => t.value ?? "").join("");
|
|
1651
|
-
continue;
|
|
1652
|
-
}
|
|
1653
|
-
if (c.kind === "paragraphProperties" || c.localName === "pPr") {
|
|
1654
|
-
for (const p of c.children ?? []) {
|
|
1655
|
-
if (p.localName === "pStyle") styleId = attr(p, "val");
|
|
1656
|
-
if (p.localName === "outlineLvl" && Number(attr(p, "val")) < 9) outline = true;
|
|
1657
|
-
}
|
|
1658
|
-
continue;
|
|
1659
|
-
}
|
|
1660
|
-
if (c.localName === "delText" || c.localName === "del" || c.localName === "rPr") continue;
|
|
1661
|
-
if (c.localName === "r") {
|
|
1662
|
-
const rStyle = c.children?.find((x) => x.localName === "rPr")?.children?.find((x) => x.localName === "rStyle");
|
|
1663
|
-
const watched = rStyle && attr(rStyle, "val");
|
|
1664
|
-
runStyle = watched && WATCHED_STYLES.has(watched) ? watched : void 0;
|
|
1665
|
-
walk(c, link);
|
|
1666
|
-
runStyle = void 0;
|
|
1667
|
-
continue;
|
|
1668
|
-
}
|
|
1669
|
-
if (c.localName === "bookmarkStart") {
|
|
1670
|
-
const name = attr(c, "name");
|
|
1671
|
-
if (name) bookmarks.push(name);
|
|
1672
|
-
continue;
|
|
1673
|
-
}
|
|
1674
|
-
if (c.localName === "hyperlink") {
|
|
1675
|
-
const anchor = attr(c, "anchor");
|
|
1676
|
-
const next = anchor ? { anchor, text: "" } : void 0;
|
|
1677
|
-
walk(c, next ?? link);
|
|
1678
|
-
if (next) links.push(next);
|
|
1679
|
-
continue;
|
|
1680
|
-
}
|
|
1681
|
-
if (c.kind === "textValue") {
|
|
1682
|
-
if (fieldDepth > 0) {
|
|
1683
|
-
const open = current;
|
|
1684
|
-
if (fieldDepth === 1 && open?.inResult) open.result += c.value ?? "";
|
|
1685
|
-
continue;
|
|
1686
|
-
}
|
|
1687
|
-
if (runStyle && c.value) {
|
|
1688
|
-
const last = marks[marks.length - 1];
|
|
1689
|
-
if (last && last.styleId === runStyle && last.offset + last.text.length === text.length)
|
|
1690
|
-
last.text += c.value;
|
|
1691
|
-
else marks.push({ styleId: runStyle, offset: text.length, text: c.value });
|
|
1692
|
-
}
|
|
1693
|
-
text += c.value ?? "";
|
|
1694
|
-
if (link) link.text += c.value ?? "";
|
|
1695
|
-
continue;
|
|
1696
|
-
}
|
|
1697
|
-
if (c.localName === "tab" && fieldDepth === 0) text += " ";
|
|
1698
|
-
walk(c, link);
|
|
1699
|
-
}
|
|
1700
|
-
};
|
|
1701
|
-
walk(node);
|
|
1702
|
-
return {
|
|
1703
|
-
id: node.id,
|
|
1704
|
-
text,
|
|
1705
|
-
heading: outline || !!styleId && HEADING_STYLE.test(styleId),
|
|
1706
|
-
styleId,
|
|
1707
|
-
topLevel,
|
|
1708
|
-
bookmarks,
|
|
1709
|
-
links,
|
|
1710
|
-
...fields.length ? { fields } : {},
|
|
1711
|
-
...marks.length ? { marks } : {}
|
|
1712
|
-
};
|
|
1713
|
-
}
|
|
1714
1583
|
function documentStyleIds(root) {
|
|
1715
1584
|
const ids = /* @__PURE__ */ new Set();
|
|
1716
1585
|
for (const style of root?.children ?? [])
|
|
@@ -2987,75 +2856,6 @@ function runBeforeSave(editor) {
|
|
|
2987
2856
|
} catch {
|
|
2988
2857
|
}
|
|
2989
2858
|
}
|
|
2990
|
-
|
|
2991
|
-
// src/docx/references/numbering.ts
|
|
2992
|
-
var numbers = (level) => !!level && level.numFmt !== "bullet" && level.numFmt !== "none" && (level.lvlText ?? level.markerText ?? "").length > 0;
|
|
2993
|
-
function paragraphNumber(order, items, levelOf, paragraphId) {
|
|
2994
|
-
const item = items.get(paragraphId);
|
|
2995
|
-
if (!item || !numbers(item)) return null;
|
|
2996
|
-
const at = order.indexOf(paragraphId);
|
|
2997
|
-
const markerAt = (ilvl) => {
|
|
2998
|
-
if (ilvl === item.ilvl) return item.markerText;
|
|
2999
|
-
for (let i = at - 1; i >= 0; i--) {
|
|
3000
|
-
const other = items.get(order[i]);
|
|
3001
|
-
if (other && other.numId === item.numId && other.ilvl === ilvl) return other.markerText;
|
|
3002
|
-
}
|
|
3003
|
-
return null;
|
|
3004
|
-
};
|
|
3005
|
-
const chain = [];
|
|
3006
|
-
const texts = [];
|
|
3007
|
-
for (let u = item.ilvl; u >= 0; u--) {
|
|
3008
|
-
const level = levelOf(item.numId, u);
|
|
3009
|
-
if (!level || !numbers(level)) continue;
|
|
3010
|
-
if (u !== item.ilvl && texts.some((t) => t.includes(`%${u + 1}`))) continue;
|
|
3011
|
-
chain.push(u);
|
|
3012
|
-
texts.push(level.lvlText);
|
|
3013
|
-
}
|
|
3014
|
-
const value = chain.reverse().map((u) => markerAt(u) ?? "").join("");
|
|
3015
|
-
if (!value) return null;
|
|
3016
|
-
return value.length > 1 && value.endsWith(".") ? value.slice(0, -1) : value;
|
|
3017
|
-
}
|
|
3018
|
-
function listTargets(paragraphs, items, levelOf) {
|
|
3019
|
-
const order = paragraphs.map((p) => p.id);
|
|
3020
|
-
const out = [];
|
|
3021
|
-
for (const p of paragraphs) {
|
|
3022
|
-
const text = p.text.replace(//g, "").trim();
|
|
3023
|
-
if (!text) continue;
|
|
3024
|
-
const number = paragraphNumber(order, items, levelOf, p.id);
|
|
3025
|
-
const item = items.get(p.id);
|
|
3026
|
-
if (number !== null)
|
|
3027
|
-
out.push({
|
|
3028
|
-
paragraphId: p.id,
|
|
3029
|
-
kind: "numbered",
|
|
3030
|
-
number,
|
|
3031
|
-
marker: item?.markerText ?? "",
|
|
3032
|
-
text,
|
|
3033
|
-
heading: p.heading,
|
|
3034
|
-
level: item?.ilvl ?? 0
|
|
3035
|
-
});
|
|
3036
|
-
else if (p.heading)
|
|
3037
|
-
out.push({
|
|
3038
|
-
paragraphId: p.id,
|
|
3039
|
-
kind: "heading",
|
|
3040
|
-
number: null,
|
|
3041
|
-
marker: "",
|
|
3042
|
-
text,
|
|
3043
|
-
heading: true,
|
|
3044
|
-
level: 0
|
|
3045
|
-
});
|
|
3046
|
-
}
|
|
3047
|
-
return out;
|
|
3048
|
-
}
|
|
3049
|
-
function filterTargets(targets, query) {
|
|
3050
|
-
const q = query.trim().toLowerCase();
|
|
3051
|
-
if (!q) return [...targets];
|
|
3052
|
-
return targets.filter(
|
|
3053
|
-
(t) => (t.number ?? "").toLowerCase().startsWith(q) || t.text.toLowerCase().includes(q)
|
|
3054
|
-
);
|
|
3055
|
-
}
|
|
3056
|
-
|
|
3057
|
-
// src/docx/references/commands.ts
|
|
3058
|
-
var REF_BOOKMARK_PREFIX = "_Ref";
|
|
3059
2859
|
function newRefBookmark(taken, random = Math.random) {
|
|
3060
2860
|
for (; ; ) {
|
|
3061
2861
|
const name = `${REF_BOOKMARK_PREFIX}${String(Math.floor(random() * 9e8) + 1e8)}`;
|
|
@@ -3140,44 +2940,6 @@ function insertDocumentReference(port, reference, caret) {
|
|
|
3140
2940
|
throw new Error("The reference could not be inserted.");
|
|
3141
2941
|
port.setCaret({ paragraphId: caret.paragraphId, offset: caret.offset + text.length });
|
|
3142
2942
|
}
|
|
3143
|
-
var REF_FIELD = /^REF\s+(\S+)((?:\s+\\[A-Za-z*]+(?:\s+MERGEFORMAT)?)*)\s*$/i;
|
|
3144
|
-
function staleCrossReferences(port) {
|
|
3145
|
-
const paragraphs = port.paragraphs();
|
|
3146
|
-
if (!paragraphs.some((p) => p.fields?.length)) return [];
|
|
3147
|
-
const items = port.listItems();
|
|
3148
|
-
const order = paragraphs.map((p) => p.id);
|
|
3149
|
-
const owner = /* @__PURE__ */ new Map();
|
|
3150
|
-
for (const p of paragraphs) for (const b of p.bookmarks) if (!owner.has(b)) owner.set(b, p.id);
|
|
3151
|
-
const out = [];
|
|
3152
|
-
for (const p of paragraphs)
|
|
3153
|
-
for (const field of p.fields ?? []) {
|
|
3154
|
-
const match = REF_FIELD.exec(field.instruction);
|
|
3155
|
-
if (!match || !match[1].startsWith(REF_BOOKMARK_PREFIX)) continue;
|
|
3156
|
-
const switches = match[2].toLowerCase();
|
|
3157
|
-
const mode = /\\[rwn]\b/.test(switches) ? "number" : "text";
|
|
3158
|
-
const target = owner.get(match[1]);
|
|
3159
|
-
const base = {
|
|
3160
|
-
paragraphId: p.id,
|
|
3161
|
-
offset: field.offset,
|
|
3162
|
-
instruction: field.instruction,
|
|
3163
|
-
cached: field.result,
|
|
3164
|
-
bookmark: match[1],
|
|
3165
|
-
mode
|
|
3166
|
-
};
|
|
3167
|
-
if (!target) {
|
|
3168
|
-
out.push({ ...base, value: null });
|
|
3169
|
-
continue;
|
|
3170
|
-
}
|
|
3171
|
-
const value = /\\[rwn]\b/.test(switches) ? switches.includes("\\r") ? paragraphNumber(order, items, port.levelOf, target) : null : (paragraphs.find((x) => x.id === target)?.text ?? "").replace(//g, "").trim();
|
|
3172
|
-
if (value && value !== field.result.trim()) out.push({ ...base, value });
|
|
3173
|
-
}
|
|
3174
|
-
return out;
|
|
3175
|
-
}
|
|
3176
|
-
function brokenCrossReferences(port) {
|
|
3177
|
-
return port.paragraphs().flatMap(
|
|
3178
|
-
(p) => (p.marks ?? []).filter((m) => m.styleId === BROKEN_CROSS_REFERENCE_STYLE).map((m) => ({ paragraphId: p.id, offset: m.offset, text: m.text }))
|
|
3179
|
-
);
|
|
3180
|
-
}
|
|
3181
2943
|
function refreshCrossReferences(port) {
|
|
3182
2944
|
const stale = staleCrossReferences(port).sort(
|
|
3183
2945
|
(a, b) => a.paragraphId === b.paragraphId ? b.offset - a.offset : 0
|
|
@@ -3259,39 +3021,16 @@ function referencesPort(editor, revision) {
|
|
|
3259
3021
|
return s;
|
|
3260
3022
|
};
|
|
3261
3023
|
const root = () => session().part().root;
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
numbering = withNumberingStyleLinks(buildNumberingIndex(s.numberingRoot()), cascade);
|
|
3269
|
-
}
|
|
3270
|
-
return numbering;
|
|
3271
|
-
};
|
|
3024
|
+
const numbering = documentNumbering({
|
|
3025
|
+
root,
|
|
3026
|
+
stylesRoot: () => session().stylesRoot(),
|
|
3027
|
+
numberingRoot: () => session().numberingRoot(),
|
|
3028
|
+
settingsRoot: () => session().settingsRoot()
|
|
3029
|
+
});
|
|
3272
3030
|
return {
|
|
3273
3031
|
...base,
|
|
3274
|
-
listItems:
|
|
3275
|
-
|
|
3276
|
-
const items = resolveStoryListItems(
|
|
3277
|
-
body?.children ?? [],
|
|
3278
|
-
index(),
|
|
3279
|
-
cascade
|
|
3280
|
-
);
|
|
3281
|
-
const out = /* @__PURE__ */ new Map();
|
|
3282
|
-
for (const [id, item] of items)
|
|
3283
|
-
out.set(id, {
|
|
3284
|
-
numId: item.numId,
|
|
3285
|
-
ilvl: item.ilvl,
|
|
3286
|
-
markerText: item.markerText,
|
|
3287
|
-
numFmt: item.numFmt
|
|
3288
|
-
});
|
|
3289
|
-
return out;
|
|
3290
|
-
},
|
|
3291
|
-
levelOf: (numId, ilvl) => {
|
|
3292
|
-
const level = resolveNumberingLevel(index(), numId, ilvl)?.level;
|
|
3293
|
-
return level ? { lvlText: level.lvlText, numFmt: level.numFmt } : null;
|
|
3294
|
-
},
|
|
3032
|
+
listItems: numbering.listItems,
|
|
3033
|
+
levelOf: numbering.levelOf,
|
|
3295
3034
|
runsXml: (paragraphId) => {
|
|
3296
3035
|
const node = findNode2(root(), paragraphId);
|
|
3297
3036
|
return node ? paragraphRunsXml(node) : null;
|
|
@@ -5417,6 +5156,6 @@ function NativeDocxEditor({
|
|
|
5417
5156
|
);
|
|
5418
5157
|
}
|
|
5419
5158
|
|
|
5420
|
-
export { BUILTIN_TEMPLATE_NAME, CrossReferenceDialog, CrossReferencesProvider, DEFAULT_CROSS_REFERENCES_LABELS, DEFAULT_DEFINED_TERMS_LABELS, DEFINED_TERM_TRIGGER, DefinedTermsProvider, DocxAuthorContext, DocxCommentActivity, DocxEditorReview, DocxMentions, DocxParticipants, DocxRibbon, GenerateImageButton, HouseTemplateProvider, LinkHoverCard, NativeDocxEditor, builtinHouseTemplate, contentPath, editorPort, findDefinitionsSection, insertCrossReference, insertDefinedTerm, insertDocumentReference,
|
|
5421
|
-
//# sourceMappingURL=chunk-
|
|
5422
|
-
//# sourceMappingURL=chunk-
|
|
5159
|
+
export { BUILTIN_TEMPLATE_NAME, CrossReferenceDialog, CrossReferencesProvider, DEFAULT_CROSS_REFERENCES_LABELS, DEFAULT_DEFINED_TERMS_LABELS, DEFINED_TERM_TRIGGER, DefinedTermsProvider, DocxAuthorContext, DocxCommentActivity, DocxEditorReview, DocxMentions, DocxParticipants, DocxRibbon, GenerateImageButton, HouseTemplateProvider, LinkHoverCard, NativeDocxEditor, builtinHouseTemplate, contentPath, editorPort, findDefinitionsSection, insertCrossReference, insertDefinedTerm, insertDocumentReference, normalizeDocxExport, referenceText, referencesPort, resolveHouseTemplate, reviewModule, shortTitle, structuralPort, templateFileName, trackedOrNoted, useCrossReferences, useDefinedTerms, useHouseTemplate, useReview, useReviewItem, useTrackedOrNoted, withDirectEditing };
|
|
5160
|
+
//# sourceMappingURL=chunk-GKDWQLVU.js.map
|
|
5161
|
+
//# sourceMappingURL=chunk-GKDWQLVU.js.map
|