superdoc 1.0.0-beta.92 → 1.0.0-beta.94
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/chunks/{PdfViewer-CrMwuKcn.es.js → PdfViewer-BR7hR5hX.es.js} +1 -1
- package/dist/chunks/{PdfViewer-BYKB8fT_.cjs → PdfViewer-CC_fv7lS.cjs} +1 -1
- package/dist/chunks/{index-CqnVFwjL-zbanjw1O.cjs → index-BstIHBcW-6lPNsqaA.cjs} +1 -1
- package/dist/chunks/{index-CqnVFwjL-DJT5AqWq.es.js → index-BstIHBcW-BxKvjs-R.es.js} +1 -1
- package/dist/chunks/{index-BZloH4nq.cjs → index-DHRt1tCk.cjs} +3 -3
- package/dist/chunks/{index-CUUqzJ4M.es.js → index-JAE9iqTX.es.js} +3 -3
- package/dist/chunks/{super-editor.es-ALp2ApyE.es.js → super-editor.es-C1RjP_IO.es.js} +333 -24
- package/dist/chunks/{super-editor.es-DvpDTsC4.cjs → super-editor.es-DXKgM3JR.cjs} +333 -24
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-CpOA_SSA.js → converter-CIgfC-et.js} +1 -1
- package/dist/super-editor/chunks/{docx-zipper-zilXqAq6.js → docx-zipper-AQa91HPZ.js} +1 -1
- package/dist/super-editor/chunks/{editor-DvF9Gp0h.js → editor-6Tyu_6Nf.js} +334 -25
- package/dist/super-editor/chunks/{index-CqnVFwjL.js → index-BstIHBcW.js} +1 -1
- package/dist/super-editor/chunks/{toolbar-BVOTlKFf.js → toolbar-yzD6N9Br.js} +2 -2
- package/dist/super-editor/converter.es.js +1 -1
- package/dist/super-editor/docx-zipper.es.js +2 -2
- package/dist/super-editor/editor.es.js +3 -3
- package/dist/super-editor/file-zipper.es.js +1 -1
- package/dist/super-editor/super-editor.es.js +6 -6
- package/dist/super-editor/toolbar.es.js +2 -2
- package/dist/super-editor.cjs +1 -1
- package/dist/super-editor.es.js +1 -1
- package/dist/superdoc.cjs +2 -2
- package/dist/superdoc.es.js +2 -2
- package/dist/superdoc.umd.js +335 -26
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { y as defineComponent, z as h, O as Transition, a0 as process$1, J as watchEffect, a as computed, r as ref, j as onMounted, W as onUnmounted, b as createElementBlock, o as openBlock, f as createBaseVNode, e as createCommentVNode, u as createVNode, v as unref } from "./vue-Dysv_7z5.es.js";
|
|
2
|
-
import { d as derived, c, a as cB, f as fadeInTransition, b as cM, N as NBaseLoading, w as warnOnce, u as useConfig, e as useTheme, p as pxfy, g as createKey, h as useThemeClass, i as useCompitable, _ as _export_sfc, j as useSuperdocStore, s as storeToRefs, k as useSelection } from "./index-
|
|
2
|
+
import { d as derived, c, a as cB, f as fadeInTransition, b as cM, N as NBaseLoading, w as warnOnce, u as useConfig, e as useTheme, p as pxfy, g as createKey, h as useThemeClass, i as useCompitable, _ as _export_sfc, j as useSuperdocStore, s as storeToRefs, k as useSelection } from "./index-JAE9iqTX.es.js";
|
|
3
3
|
function self(vars) {
|
|
4
4
|
const {
|
|
5
5
|
opacityDisabled,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const vue = require("./vue-jWLMl8Ts.cjs");
|
|
4
|
-
const superdoc = require("./index-
|
|
4
|
+
const superdoc = require("./index-DHRt1tCk.cjs");
|
|
5
5
|
function self(vars) {
|
|
6
6
|
const {
|
|
7
7
|
opacityDisabled,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const superEditor_es = require("./super-editor.es-
|
|
3
|
+
const superEditor_es = require("./super-editor.es-DXKgM3JR.cjs");
|
|
4
4
|
const indexCvBqQJbG = require("./index-CvBqQJbG-Dwm0THD7.cjs");
|
|
5
5
|
function bail(error) {
|
|
6
6
|
if (error) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const superEditor_es = require("./super-editor.es-
|
|
2
|
+
const superEditor_es = require("./super-editor.es-DXKgM3JR.cjs");
|
|
3
3
|
const blankDocx = require("./blank-docx-DfW3Eeh2.cjs");
|
|
4
4
|
const eventemitter3 = require("./eventemitter3-DQmQUge-.cjs");
|
|
5
5
|
const provider = require("@hocuspocus/provider");
|
|
@@ -17268,7 +17268,7 @@ const _sfc_main = {
|
|
|
17268
17268
|
__name: "SuperDoc",
|
|
17269
17269
|
emits: ["selection-update"],
|
|
17270
17270
|
setup(__props, { emit: __emit }) {
|
|
17271
|
-
const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-
|
|
17271
|
+
const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-CC_fv7lS.cjs")));
|
|
17272
17272
|
const superdocStore = useSuperdocStore();
|
|
17273
17273
|
const commentsStore = useCommentsStore();
|
|
17274
17274
|
const {
|
|
@@ -18157,7 +18157,7 @@ class SuperDoc extends eventemitter3.EventEmitter {
|
|
|
18157
18157
|
this.config.colors = shuffleArray(this.config.colors);
|
|
18158
18158
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
18159
18159
|
this.colorIndex = 0;
|
|
18160
|
-
this.version = "1.0.0-beta.
|
|
18160
|
+
this.version = "1.0.0-beta.94";
|
|
18161
18161
|
this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
|
|
18162
18162
|
this.superdocId = config.superdocId || uuid.v4();
|
|
18163
18163
|
this.colors = this.config.colors;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { q as index, C as CommentsPluginKey, h as TrackChangesBasePluginKey, E as Editor, n as getRichTextExtensions, f as SuperInput, P as PresentationEditor, e as SuperEditor, A as AIWriter, g as SuperToolbar, i as createZip } from "./super-editor.es-
|
|
1
|
+
import { q as index, C as CommentsPluginKey, h as TrackChangesBasePluginKey, E as Editor, n as getRichTextExtensions, f as SuperInput, P as PresentationEditor, e as SuperEditor, A as AIWriter, g as SuperToolbar, i as createZip } from "./super-editor.es-C1RjP_IO.es.js";
|
|
2
2
|
import { B as BlankDOCX } from "./blank-docx-ABm6XYAA.es.js";
|
|
3
3
|
import { E as EventEmitter } from "./eventemitter3-CcXAdeql.es.js";
|
|
4
4
|
import { HocuspocusProvider, HocuspocusProviderWebsocket } from "@hocuspocus/provider";
|
|
@@ -17251,7 +17251,7 @@ const _sfc_main = {
|
|
|
17251
17251
|
__name: "SuperDoc",
|
|
17252
17252
|
emits: ["selection-update"],
|
|
17253
17253
|
setup(__props, { emit: __emit }) {
|
|
17254
|
-
const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-
|
|
17254
|
+
const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-BR7hR5hX.es.js"));
|
|
17255
17255
|
const superdocStore = useSuperdocStore();
|
|
17256
17256
|
const commentsStore = useCommentsStore();
|
|
17257
17257
|
const {
|
|
@@ -18140,7 +18140,7 @@ class SuperDoc extends EventEmitter {
|
|
|
18140
18140
|
this.config.colors = shuffleArray(this.config.colors);
|
|
18141
18141
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
18142
18142
|
this.colorIndex = 0;
|
|
18143
|
-
this.version = "1.0.0-beta.
|
|
18143
|
+
this.version = "1.0.0-beta.94";
|
|
18144
18144
|
this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
|
|
18145
18145
|
this.superdocId = config.superdocId || v4();
|
|
18146
18146
|
this.colors = this.config.colors;
|
|
@@ -42380,7 +42380,7 @@ const _SuperConverter = class _SuperConverter2 {
|
|
|
42380
42380
|
static getStoredSuperdocVersion(docx) {
|
|
42381
42381
|
return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
|
|
42382
42382
|
}
|
|
42383
|
-
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.
|
|
42383
|
+
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.94") {
|
|
42384
42384
|
return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
|
|
42385
42385
|
}
|
|
42386
42386
|
/**
|
|
@@ -56530,12 +56530,12 @@ const findTrackedMarkBetween = ({
|
|
|
56530
56530
|
const { doc: doc2 } = tr;
|
|
56531
56531
|
const startPos = Math.max(from2 - offset2, 0);
|
|
56532
56532
|
const endPos = Math.min(to + offset2, doc2.content.size);
|
|
56533
|
-
let markFound;
|
|
56534
|
-
|
|
56533
|
+
let markFound = null;
|
|
56534
|
+
const tryMatch = (node, pos) => {
|
|
56535
56535
|
if (!node || node?.nodeSize === void 0) {
|
|
56536
56536
|
return;
|
|
56537
56537
|
}
|
|
56538
|
-
const mark = node.marks
|
|
56538
|
+
const mark = node.marks?.find(
|
|
56539
56539
|
(mark2) => mark2.type.name === markName && Object.keys(attrs).every((attr) => mark2.attrs[attr] === attrs[attr])
|
|
56540
56540
|
);
|
|
56541
56541
|
if (mark && !markFound) {
|
|
@@ -56544,24 +56544,36 @@ const findTrackedMarkBetween = ({
|
|
|
56544
56544
|
to: pos + node.nodeSize,
|
|
56545
56545
|
mark
|
|
56546
56546
|
};
|
|
56547
|
+
return false;
|
|
56547
56548
|
}
|
|
56549
|
+
};
|
|
56550
|
+
doc2.nodesBetween(startPos, endPos, (node, pos) => {
|
|
56551
|
+
return tryMatch(node, pos);
|
|
56548
56552
|
});
|
|
56549
|
-
const
|
|
56550
|
-
|
|
56551
|
-
|
|
56552
|
-
|
|
56553
|
-
|
|
56554
|
-
|
|
56555
|
-
|
|
56556
|
-
);
|
|
56557
|
-
|
|
56558
|
-
|
|
56559
|
-
|
|
56560
|
-
|
|
56561
|
-
|
|
56562
|
-
|
|
56553
|
+
const inspectAroundPosition = (pos) => {
|
|
56554
|
+
if (pos < 0 || pos > doc2.content.size) {
|
|
56555
|
+
return;
|
|
56556
|
+
}
|
|
56557
|
+
const resolved = doc2.resolve(pos);
|
|
56558
|
+
const before = resolved.nodeBefore;
|
|
56559
|
+
if (before?.type?.name === "run") {
|
|
56560
|
+
const beforeStart = Math.max(pos - before.nodeSize, 0);
|
|
56561
|
+
const node = before.content?.content?.[0];
|
|
56562
|
+
if (node?.type?.name === "text") {
|
|
56563
|
+
tryMatch(node, beforeStart);
|
|
56564
|
+
}
|
|
56565
|
+
}
|
|
56566
|
+
const after = resolved.nodeAfter;
|
|
56567
|
+
if (after?.type?.name === "run") {
|
|
56568
|
+
const node = after.content?.content?.[0];
|
|
56569
|
+
if (node?.type?.name === "text") {
|
|
56570
|
+
tryMatch(node, pos);
|
|
56563
56571
|
}
|
|
56564
56572
|
}
|
|
56573
|
+
};
|
|
56574
|
+
if (!markFound) {
|
|
56575
|
+
inspectAroundPosition(startPos);
|
|
56576
|
+
inspectAroundPosition(endPos);
|
|
56565
56577
|
}
|
|
56566
56578
|
return markFound;
|
|
56567
56579
|
};
|
|
@@ -59586,7 +59598,7 @@ const isHeadless = (editor) => {
|
|
|
59586
59598
|
const shouldSkipNodeView = (editor) => {
|
|
59587
59599
|
return isHeadless(editor);
|
|
59588
59600
|
};
|
|
59589
|
-
const summaryVersion = "1.0.0-beta.
|
|
59601
|
+
const summaryVersion = "1.0.0-beta.94";
|
|
59590
59602
|
const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
|
|
59591
59603
|
const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
|
|
59592
59604
|
function mapAttributes(attrs) {
|
|
@@ -60375,7 +60387,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
60375
60387
|
{ default: remarkStringify },
|
|
60376
60388
|
{ default: remarkGfm }
|
|
60377
60389
|
] = await Promise.all([
|
|
60378
|
-
import("./index-
|
|
60390
|
+
import("./index-BstIHBcW-BxKvjs-R.es.js"),
|
|
60379
60391
|
import("./index-DRCvimau-Cw339678.es.js"),
|
|
60380
60392
|
import("./index-C_x_N6Uh-DJn8hIEt.es.js"),
|
|
60381
60393
|
import("./index-D_sWOSiG-DE96TaT5.es.js"),
|
|
@@ -60580,7 +60592,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
60580
60592
|
* Process collaboration migrations
|
|
60581
60593
|
*/
|
|
60582
60594
|
processCollaborationMigrations() {
|
|
60583
|
-
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.
|
|
60595
|
+
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.94");
|
|
60584
60596
|
if (!this.options.ydoc) return;
|
|
60585
60597
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
60586
60598
|
let docVersion = metaMap.get("version");
|
|
@@ -77457,10 +77469,31 @@ const deriveBlockVersion = (block) => {
|
|
|
77457
77469
|
textRun.letterSpacing != null ? textRun.letterSpacing : "",
|
|
77458
77470
|
textRun.pmStart ?? "",
|
|
77459
77471
|
textRun.pmEnd ?? "",
|
|
77460
|
-
textRun.token ?? ""
|
|
77472
|
+
textRun.token ?? "",
|
|
77473
|
+
// Tracked changes - force re-render when added or removed tracked change
|
|
77474
|
+
textRun.trackedChange ? 1 : 0
|
|
77461
77475
|
].join(",");
|
|
77462
77476
|
}).join("|");
|
|
77463
|
-
|
|
77477
|
+
const attrs = block.attrs;
|
|
77478
|
+
const paragraphAttrsVersion = attrs ? [
|
|
77479
|
+
attrs.alignment ?? "",
|
|
77480
|
+
attrs.spacing?.before ?? "",
|
|
77481
|
+
attrs.spacing?.after ?? "",
|
|
77482
|
+
attrs.spacing?.line ?? "",
|
|
77483
|
+
attrs.spacing?.lineRule ?? "",
|
|
77484
|
+
attrs.indent?.left ?? "",
|
|
77485
|
+
attrs.indent?.right ?? "",
|
|
77486
|
+
attrs.indent?.firstLine ?? "",
|
|
77487
|
+
attrs.indent?.hanging ?? "",
|
|
77488
|
+
attrs.borders ? JSON.stringify(attrs.borders) : "",
|
|
77489
|
+
attrs.shading?.fill ?? "",
|
|
77490
|
+
attrs.shading?.color ?? "",
|
|
77491
|
+
attrs.direction ?? "",
|
|
77492
|
+
attrs.rtl ? "1" : "",
|
|
77493
|
+
attrs.tabs?.length ? JSON.stringify(attrs.tabs) : ""
|
|
77494
|
+
].join(":") : "";
|
|
77495
|
+
const parts = [markerVersion, runsVersion, paragraphAttrsVersion].filter(Boolean);
|
|
77496
|
+
return parts.join("|");
|
|
77464
77497
|
}
|
|
77465
77498
|
if (block.kind === "list") {
|
|
77466
77499
|
return block.items.map((item) => `${item.id}:${item.marker.text}:${deriveBlockVersion(item.paragraph)}`).join("|");
|
|
@@ -81207,6 +81240,33 @@ const MAX_CACHE_SIZE$1 = 1e4;
|
|
|
81207
81240
|
const BYTES_PER_ENTRY_ESTIMATE = 5e3;
|
|
81208
81241
|
const NORMALIZED_WHITESPACE = /\s+/g;
|
|
81209
81242
|
const normalizeText = (text) => text.replace(NORMALIZED_WHITESPACE, " ");
|
|
81243
|
+
const hashParagraphBorder = (border) => {
|
|
81244
|
+
const parts = [];
|
|
81245
|
+
if (border.style !== void 0) parts.push(`s:${border.style}`);
|
|
81246
|
+
if (border.width !== void 0) parts.push(`w:${border.width}`);
|
|
81247
|
+
if (border.color !== void 0) parts.push(`c:${border.color}`);
|
|
81248
|
+
if (border.space !== void 0) parts.push(`sp:${border.space}`);
|
|
81249
|
+
return parts.join(",");
|
|
81250
|
+
};
|
|
81251
|
+
const hashParagraphBorders = (borders) => {
|
|
81252
|
+
const parts = [];
|
|
81253
|
+
if (borders.top) parts.push(`t:[${hashParagraphBorder(borders.top)}]`);
|
|
81254
|
+
if (borders.right) parts.push(`r:[${hashParagraphBorder(borders.right)}]`);
|
|
81255
|
+
if (borders.bottom) parts.push(`b:[${hashParagraphBorder(borders.bottom)}]`);
|
|
81256
|
+
if (borders.left) parts.push(`l:[${hashParagraphBorder(borders.left)}]`);
|
|
81257
|
+
return parts.join(";");
|
|
81258
|
+
};
|
|
81259
|
+
const hashParagraphFrame = (frame) => {
|
|
81260
|
+
const parts = [];
|
|
81261
|
+
if (frame.wrap !== void 0) parts.push(`w:${frame.wrap}`);
|
|
81262
|
+
if (frame.x !== void 0) parts.push(`x:${frame.x}`);
|
|
81263
|
+
if (frame.y !== void 0) parts.push(`y:${frame.y}`);
|
|
81264
|
+
if (frame.xAlign !== void 0) parts.push(`xa:${frame.xAlign}`);
|
|
81265
|
+
if (frame.yAlign !== void 0) parts.push(`ya:${frame.yAlign}`);
|
|
81266
|
+
if (frame.hAnchor !== void 0) parts.push(`ha:${frame.hAnchor}`);
|
|
81267
|
+
if (frame.vAnchor !== void 0) parts.push(`va:${frame.vAnchor}`);
|
|
81268
|
+
return parts.join(",");
|
|
81269
|
+
};
|
|
81210
81270
|
const hashRuns = (block) => {
|
|
81211
81271
|
if (block.kind === "table") {
|
|
81212
81272
|
const tableBlock = block;
|
|
@@ -81302,7 +81362,59 @@ const hashRuns = (block) => {
|
|
|
81302
81362
|
numberingKey = `|num:${np.numId ?? ""}:${np.ilvl ?? 0}:${markerTextKey}`;
|
|
81303
81363
|
}
|
|
81304
81364
|
}
|
|
81305
|
-
|
|
81365
|
+
let paragraphAttrsKey = "";
|
|
81366
|
+
if (block.attrs) {
|
|
81367
|
+
const attrs = block.attrs;
|
|
81368
|
+
const parts = [];
|
|
81369
|
+
if (attrs.alignment) parts.push(`al:${attrs.alignment}`);
|
|
81370
|
+
if (attrs.spacing) {
|
|
81371
|
+
const s2 = attrs.spacing;
|
|
81372
|
+
if (s2.before !== void 0) parts.push(`sb:${s2.before}`);
|
|
81373
|
+
if (s2.after !== void 0) parts.push(`sa:${s2.after}`);
|
|
81374
|
+
if (s2.line !== void 0) parts.push(`sl:${s2.line}`);
|
|
81375
|
+
if (s2.lineRule) parts.push(`sr:${s2.lineRule}`);
|
|
81376
|
+
}
|
|
81377
|
+
if (attrs.indent) {
|
|
81378
|
+
const ind = attrs.indent;
|
|
81379
|
+
if (ind.left !== void 0) parts.push(`il:${ind.left}`);
|
|
81380
|
+
if (ind.right !== void 0) parts.push(`ir:${ind.right}`);
|
|
81381
|
+
if (ind.firstLine !== void 0) parts.push(`if:${ind.firstLine}`);
|
|
81382
|
+
if (ind.hanging !== void 0) parts.push(`ih:${ind.hanging}`);
|
|
81383
|
+
}
|
|
81384
|
+
if (attrs.borders) {
|
|
81385
|
+
parts.push(`br:${hashParagraphBorders(attrs.borders)}`);
|
|
81386
|
+
}
|
|
81387
|
+
if (attrs.shading) {
|
|
81388
|
+
const sh = attrs.shading;
|
|
81389
|
+
if (sh.fill) parts.push(`shf:${sh.fill}`);
|
|
81390
|
+
if (sh.color) parts.push(`shc:${sh.color}`);
|
|
81391
|
+
}
|
|
81392
|
+
if (attrs.tabs && attrs.tabs.length > 0) {
|
|
81393
|
+
const tabsHash = attrs.tabs.map((t) => `${t.val ?? ""}:${t.pos ?? ""}:${t.leader ?? ""}`).join(",");
|
|
81394
|
+
parts.push(`tb:${tabsHash}`);
|
|
81395
|
+
}
|
|
81396
|
+
if (attrs.direction) parts.push(`dir:${attrs.direction}`);
|
|
81397
|
+
if (attrs.rtl) parts.push("rtl");
|
|
81398
|
+
if (attrs.keepNext) parts.push("kn");
|
|
81399
|
+
if (attrs.keepLines) parts.push("kl");
|
|
81400
|
+
if (attrs.floatAlignment) parts.push(`fa:${attrs.floatAlignment}`);
|
|
81401
|
+
if (attrs.contextualSpacing) parts.push("cs");
|
|
81402
|
+
if (attrs.suppressFirstLineIndent) parts.push("sfi");
|
|
81403
|
+
if (attrs.dropCap) parts.push(`dc:${attrs.dropCap}`);
|
|
81404
|
+
if (attrs.dropCapDescriptor) {
|
|
81405
|
+
const dcd = attrs.dropCapDescriptor;
|
|
81406
|
+
parts.push(`dcd:${dcd.mode ?? ""}:${dcd.lines ?? ""}`);
|
|
81407
|
+
}
|
|
81408
|
+
if (attrs.frame) {
|
|
81409
|
+
parts.push(`fr:${hashParagraphFrame(attrs.frame)}`);
|
|
81410
|
+
}
|
|
81411
|
+
if (attrs.tabIntervalTwips !== void 0) parts.push(`ti:${attrs.tabIntervalTwips}`);
|
|
81412
|
+
if (attrs.decimalSeparator) parts.push(`ds:${attrs.decimalSeparator}`);
|
|
81413
|
+
if (parts.length > 0) {
|
|
81414
|
+
paragraphAttrsKey = `|pa:${parts.join(":")}`;
|
|
81415
|
+
}
|
|
81416
|
+
}
|
|
81417
|
+
return `${trackedMode}:${trackedEnabled ? "on" : "off"}|${runsHash}${numberingKey}${paragraphAttrsKey}`;
|
|
81306
81418
|
};
|
|
81307
81419
|
const createStats = () => ({
|
|
81308
81420
|
hits: 0,
|
|
@@ -82187,6 +82299,75 @@ const getTrackedChangeKey = (run2) => {
|
|
|
82187
82299
|
}
|
|
82188
82300
|
return "";
|
|
82189
82301
|
};
|
|
82302
|
+
const paragraphSpacingEqual = (a, b2) => {
|
|
82303
|
+
if (a === b2) return true;
|
|
82304
|
+
if (!a || !b2) return !a && !b2;
|
|
82305
|
+
return a.before === b2.before && a.after === b2.after && a.line === b2.line && a.lineRule === b2.lineRule && a.beforeAutospacing === b2.beforeAutospacing && a.afterAutospacing === b2.afterAutospacing;
|
|
82306
|
+
};
|
|
82307
|
+
const paragraphIndentEqual = (a, b2) => {
|
|
82308
|
+
if (a === b2) return true;
|
|
82309
|
+
if (!a || !b2) return !a && !b2;
|
|
82310
|
+
return a.left === b2.left && a.right === b2.right && a.firstLine === b2.firstLine && a.hanging === b2.hanging;
|
|
82311
|
+
};
|
|
82312
|
+
const paragraphBorderEqual = (a, b2) => {
|
|
82313
|
+
if (a === b2) return true;
|
|
82314
|
+
if (!a || !b2) return !a && !b2;
|
|
82315
|
+
return a.style === b2.style && a.width === b2.width && a.color === b2.color && a.space === b2.space;
|
|
82316
|
+
};
|
|
82317
|
+
const paragraphBordersEqual = (a, b2) => {
|
|
82318
|
+
if (a === b2) return true;
|
|
82319
|
+
if (!a || !b2) return !a && !b2;
|
|
82320
|
+
return paragraphBorderEqual(a.top, b2.top) && paragraphBorderEqual(a.right, b2.right) && paragraphBorderEqual(a.bottom, b2.bottom) && paragraphBorderEqual(a.left, b2.left);
|
|
82321
|
+
};
|
|
82322
|
+
const paragraphShadingEqual = (a, b2) => {
|
|
82323
|
+
if (a === b2) return true;
|
|
82324
|
+
if (!a || !b2) return !a && !b2;
|
|
82325
|
+
return a.fill === b2.fill && a.color === b2.color && a.val === b2.val && a.themeColor === b2.themeColor && a.themeFill === b2.themeFill && a.themeFillShade === b2.themeFillShade && a.themeFillTint === b2.themeFillTint && a.themeShade === b2.themeShade && a.themeTint === b2.themeTint;
|
|
82326
|
+
};
|
|
82327
|
+
const tabStopEqual = (a, b2) => {
|
|
82328
|
+
return a.val === b2.val && a.pos === b2.pos && a.leader === b2.leader;
|
|
82329
|
+
};
|
|
82330
|
+
const tabStopsEqual = (a, b2) => {
|
|
82331
|
+
if (a === b2) return true;
|
|
82332
|
+
if (!a || !b2) return !a && !b2;
|
|
82333
|
+
if (a.length !== b2.length) return false;
|
|
82334
|
+
for (let i = 0; i < a.length; i += 1) {
|
|
82335
|
+
if (!tabStopEqual(a[i], b2[i])) return false;
|
|
82336
|
+
}
|
|
82337
|
+
return true;
|
|
82338
|
+
};
|
|
82339
|
+
const paragraphFrameEqual = (a, b2) => {
|
|
82340
|
+
if (a === b2) return true;
|
|
82341
|
+
if (!a || !b2) return !a && !b2;
|
|
82342
|
+
return a.wrap === b2.wrap && a.x === b2.x && a.y === b2.y && a.xAlign === b2.xAlign && a.yAlign === b2.yAlign && a.hAnchor === b2.hAnchor && a.vAnchor === b2.vAnchor;
|
|
82343
|
+
};
|
|
82344
|
+
const dropCapDescriptorEqual = (a, b2) => {
|
|
82345
|
+
if (a === b2) return true;
|
|
82346
|
+
if (!a || !b2) return !a && !b2;
|
|
82347
|
+
if (a.mode !== b2.mode || a.lines !== b2.lines) return false;
|
|
82348
|
+
const runA = a.run;
|
|
82349
|
+
const runB = b2.run;
|
|
82350
|
+
if (!runA || !runB) return !runA && !runB;
|
|
82351
|
+
if (runA.text !== runB.text || runA.fontFamily !== runB.fontFamily || runA.fontSize !== runB.fontSize || runA.bold !== runB.bold || runA.italic !== runB.italic || runA.color !== runB.color) {
|
|
82352
|
+
return false;
|
|
82353
|
+
}
|
|
82354
|
+
return true;
|
|
82355
|
+
};
|
|
82356
|
+
const paragraphAttrsEqual = (a, b2) => {
|
|
82357
|
+
if (a === b2) return true;
|
|
82358
|
+
if (!a || !b2) return !a && !b2;
|
|
82359
|
+
if (a.alignment !== b2.alignment || a.contextualSpacing !== b2.contextualSpacing || a.suppressFirstLineIndent !== b2.suppressFirstLineIndent || a.dropCap !== b2.dropCap || a.decimalSeparator !== b2.decimalSeparator || a.tabIntervalTwips !== b2.tabIntervalTwips || a.keepNext !== b2.keepNext || a.keepLines !== b2.keepLines || a.direction !== b2.direction || a.rtl !== b2.rtl || a.floatAlignment !== b2.floatAlignment) {
|
|
82360
|
+
return false;
|
|
82361
|
+
}
|
|
82362
|
+
if (!paragraphSpacingEqual(a.spacing, b2.spacing)) return false;
|
|
82363
|
+
if (!paragraphIndentEqual(a.indent, b2.indent)) return false;
|
|
82364
|
+
if (!paragraphBordersEqual(a.borders, b2.borders)) return false;
|
|
82365
|
+
if (!paragraphShadingEqual(a.shading, b2.shading)) return false;
|
|
82366
|
+
if (!tabStopsEqual(a.tabs, b2.tabs)) return false;
|
|
82367
|
+
if (!paragraphFrameEqual(a.frame, b2.frame)) return false;
|
|
82368
|
+
if (!dropCapDescriptorEqual(a.dropCapDescriptor, b2.dropCapDescriptor)) return false;
|
|
82369
|
+
return true;
|
|
82370
|
+
};
|
|
82190
82371
|
const paragraphBlocksEqual = (a, b2) => {
|
|
82191
82372
|
const aMode = a.attrs?.trackedChangesMode ?? "review";
|
|
82192
82373
|
const bMode = b2.attrs?.trackedChangesMode ?? "review";
|
|
@@ -82194,6 +82375,7 @@ const paragraphBlocksEqual = (a, b2) => {
|
|
|
82194
82375
|
const aEnabled = resolveTrackedChangesEnabled(a.attrs, true);
|
|
82195
82376
|
const bEnabled = resolveTrackedChangesEnabled(b2.attrs, true);
|
|
82196
82377
|
if (aEnabled !== bEnabled) return false;
|
|
82378
|
+
if (!paragraphAttrsEqual(a.attrs, b2.attrs)) return false;
|
|
82197
82379
|
if (a.runs.length !== b2.runs.length) return false;
|
|
82198
82380
|
for (let i = 0; i < a.runs.length; i += 1) {
|
|
82199
82381
|
const runA = a.runs[i];
|
|
@@ -84839,6 +85021,104 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
84839
85021
|
const wordStartChar = charPosInRun;
|
|
84840
85022
|
const wordEndNoSpace = charPosInRun + word.length;
|
|
84841
85023
|
const wordEndWithSpace = charPosInRun + (isLastWord ? word.length : word.length + 1);
|
|
85024
|
+
const effectiveMaxWidth = currentLine ? currentLine.maxWidth : getEffectiveWidth(lines.length === 0 ? initialAvailableWidth : contentWidth);
|
|
85025
|
+
if (wordOnlyWidth > effectiveMaxWidth && word.length > 1) {
|
|
85026
|
+
if (currentLine && currentLine.width > 0 && currentLine.segments.length > 0) {
|
|
85027
|
+
const metrics = calculateTypographyMetrics(currentLine.maxFontSize, spacing, currentLine.maxFontInfo);
|
|
85028
|
+
const { spaceCount: _sc, ...lineBase } = currentLine;
|
|
85029
|
+
const completedLine = { ...lineBase, ...metrics };
|
|
85030
|
+
addBarTabsToLine(completedLine);
|
|
85031
|
+
lines.push(completedLine);
|
|
85032
|
+
tabStopCursor = 0;
|
|
85033
|
+
pendingTabAlignment = null;
|
|
85034
|
+
currentLine = null;
|
|
85035
|
+
}
|
|
85036
|
+
const lineMaxWidth = getEffectiveWidth(lines.length === 0 ? initialAvailableWidth : contentWidth);
|
|
85037
|
+
const hasTabOnlyLine = currentLine && currentLine.segments.length === 0 && currentLine.width > 0;
|
|
85038
|
+
const remainingWidthAfterTab = hasTabOnlyLine ? currentLine.maxWidth - currentLine.width : lineMaxWidth;
|
|
85039
|
+
const chunkWidth = hasTabOnlyLine ? Math.max(remainingWidthAfterTab, lineMaxWidth * 0.25) : lineMaxWidth;
|
|
85040
|
+
const chunks = breakWordIntoChunks(word, chunkWidth - WIDTH_FUDGE_PX, font, ctx2, run2);
|
|
85041
|
+
let chunkCharOffset = wordStartChar;
|
|
85042
|
+
for (let chunkIndex = 0; chunkIndex < chunks.length; chunkIndex++) {
|
|
85043
|
+
const chunk = chunks[chunkIndex];
|
|
85044
|
+
const chunkStartChar = chunkCharOffset;
|
|
85045
|
+
const chunkEndChar = chunkCharOffset + chunk.text.length;
|
|
85046
|
+
const isLastChunk = chunkIndex === chunks.length - 1;
|
|
85047
|
+
const isFirstChunk = chunkIndex === 0;
|
|
85048
|
+
if (isFirstChunk && hasTabOnlyLine && currentLine) {
|
|
85049
|
+
currentLine.toRun = runIndex;
|
|
85050
|
+
currentLine.toChar = chunkEndChar;
|
|
85051
|
+
currentLine.width = roundValue(currentLine.width + chunk.width);
|
|
85052
|
+
currentLine.maxFontSize = Math.max(currentLine.maxFontSize, run2.fontSize);
|
|
85053
|
+
currentLine.maxFontInfo = getFontInfoFromRun(run2);
|
|
85054
|
+
currentLine.segments.push({
|
|
85055
|
+
runIndex,
|
|
85056
|
+
fromChar: chunkStartChar,
|
|
85057
|
+
toChar: chunkEndChar,
|
|
85058
|
+
width: chunk.width
|
|
85059
|
+
});
|
|
85060
|
+
if (isLastChunk) {
|
|
85061
|
+
const ls = run2.letterSpacing ?? 0;
|
|
85062
|
+
if (!isLastWord && currentLine.width + spaceWidth <= currentLine.maxWidth - WIDTH_FUDGE_PX) {
|
|
85063
|
+
currentLine.toChar = wordEndWithSpace;
|
|
85064
|
+
currentLine.width = roundValue(currentLine.width + spaceWidth + ls);
|
|
85065
|
+
charPosInRun = wordEndWithSpace;
|
|
85066
|
+
currentLine.spaceCount += 1;
|
|
85067
|
+
} else {
|
|
85068
|
+
charPosInRun = wordEndWithSpace;
|
|
85069
|
+
}
|
|
85070
|
+
} else {
|
|
85071
|
+
const metrics = calculateTypographyMetrics(currentLine.maxFontSize, spacing, currentLine.maxFontInfo);
|
|
85072
|
+
const { spaceCount: _sc, ...lineBase } = currentLine;
|
|
85073
|
+
const completedLine = { ...lineBase, ...metrics };
|
|
85074
|
+
addBarTabsToLine(completedLine);
|
|
85075
|
+
lines.push(completedLine);
|
|
85076
|
+
tabStopCursor = 0;
|
|
85077
|
+
pendingTabAlignment = null;
|
|
85078
|
+
currentLine = null;
|
|
85079
|
+
}
|
|
85080
|
+
} else if (isLastChunk) {
|
|
85081
|
+
currentLine = {
|
|
85082
|
+
fromRun: runIndex,
|
|
85083
|
+
fromChar: chunkStartChar,
|
|
85084
|
+
toRun: runIndex,
|
|
85085
|
+
toChar: chunkEndChar,
|
|
85086
|
+
width: chunk.width,
|
|
85087
|
+
maxFontSize: run2.fontSize,
|
|
85088
|
+
maxFontInfo: getFontInfoFromRun(run2),
|
|
85089
|
+
maxWidth: getEffectiveWidth(contentWidth),
|
|
85090
|
+
segments: [{ runIndex, fromChar: chunkStartChar, toChar: chunkEndChar, width: chunk.width }],
|
|
85091
|
+
spaceCount: 0
|
|
85092
|
+
};
|
|
85093
|
+
const ls = run2.letterSpacing ?? 0;
|
|
85094
|
+
if (!isLastWord && currentLine.width + spaceWidth <= currentLine.maxWidth - WIDTH_FUDGE_PX) {
|
|
85095
|
+
currentLine.toChar = wordEndWithSpace;
|
|
85096
|
+
currentLine.width = roundValue(currentLine.width + spaceWidth + ls);
|
|
85097
|
+
charPosInRun = wordEndWithSpace;
|
|
85098
|
+
currentLine.spaceCount += 1;
|
|
85099
|
+
} else {
|
|
85100
|
+
charPosInRun = wordEndWithSpace;
|
|
85101
|
+
}
|
|
85102
|
+
} else {
|
|
85103
|
+
const chunkLineMaxWidth = getEffectiveWidth(lines.length === 0 ? initialAvailableWidth : contentWidth);
|
|
85104
|
+
const metrics = calculateTypographyMetrics(run2.fontSize, spacing, getFontInfoFromRun(run2));
|
|
85105
|
+
const chunkLine = {
|
|
85106
|
+
fromRun: runIndex,
|
|
85107
|
+
fromChar: chunkStartChar,
|
|
85108
|
+
toRun: runIndex,
|
|
85109
|
+
toChar: chunkEndChar,
|
|
85110
|
+
width: chunk.width,
|
|
85111
|
+
maxWidth: chunkLineMaxWidth,
|
|
85112
|
+
segments: [{ runIndex, fromChar: chunkStartChar, toChar: chunkEndChar, width: chunk.width }],
|
|
85113
|
+
...metrics
|
|
85114
|
+
};
|
|
85115
|
+
addBarTabsToLine(chunkLine);
|
|
85116
|
+
lines.push(chunkLine);
|
|
85117
|
+
}
|
|
85118
|
+
chunkCharOffset = chunkEndChar;
|
|
85119
|
+
}
|
|
85120
|
+
continue;
|
|
85121
|
+
}
|
|
84842
85122
|
if (!currentLine) {
|
|
84843
85123
|
currentLine = {
|
|
84844
85124
|
fromRun: runIndex,
|
|
@@ -85417,6 +85697,35 @@ const measureRunWidth = (text, font, ctx2, run2) => {
|
|
|
85417
85697
|
const width = getMeasuredTextWidth(text, font, letterSpacing, ctx2);
|
|
85418
85698
|
return roundValue(width);
|
|
85419
85699
|
};
|
|
85700
|
+
const breakWordIntoChunks = (word, maxWidth, font, ctx2, run2) => {
|
|
85701
|
+
const chunks = [];
|
|
85702
|
+
if (maxWidth <= 0) {
|
|
85703
|
+
for (const char of word) {
|
|
85704
|
+
const charWidth = measureRunWidth(char, font, ctx2, run2);
|
|
85705
|
+
chunks.push({ text: char, width: charWidth });
|
|
85706
|
+
}
|
|
85707
|
+
return chunks;
|
|
85708
|
+
}
|
|
85709
|
+
let currentChunk = "";
|
|
85710
|
+
let currentWidth = 0;
|
|
85711
|
+
for (let i = 0; i < word.length; i++) {
|
|
85712
|
+
const char = word[i];
|
|
85713
|
+
const testChunk = currentChunk + char;
|
|
85714
|
+
const testWidth = measureRunWidth(testChunk, font, ctx2, run2);
|
|
85715
|
+
if (testWidth > maxWidth && currentChunk.length > 0) {
|
|
85716
|
+
chunks.push({ text: currentChunk, width: currentWidth });
|
|
85717
|
+
currentChunk = char;
|
|
85718
|
+
currentWidth = measureRunWidth(char, font, ctx2, run2);
|
|
85719
|
+
} else {
|
|
85720
|
+
currentChunk = testChunk;
|
|
85721
|
+
currentWidth = testWidth;
|
|
85722
|
+
}
|
|
85723
|
+
}
|
|
85724
|
+
if (currentChunk.length > 0) {
|
|
85725
|
+
chunks.push({ text: currentChunk, width: currentWidth });
|
|
85726
|
+
}
|
|
85727
|
+
return chunks;
|
|
85728
|
+
};
|
|
85420
85729
|
const appendSegment = (segments, runIndex, fromChar, toChar, width, x2) => {
|
|
85421
85730
|
if (!segments) return;
|
|
85422
85731
|
const last = segments[segments.length - 1];
|