@harbour-enterprises/superdoc 1.0.0-beta.93 → 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-DDlUqq8s.es.js → PdfViewer-BR7hR5hX.es.js} +1 -1
- package/dist/chunks/{PdfViewer-DbMCgjlc.cjs → PdfViewer-CC_fv7lS.cjs} +1 -1
- package/dist/chunks/{index-Cyp2JwAE-BDSzsvVr.cjs → index-BstIHBcW-6lPNsqaA.cjs} +1 -1
- package/dist/chunks/{index-Cyp2JwAE-C4V2XscX.es.js → index-BstIHBcW-BxKvjs-R.es.js} +1 -1
- package/dist/chunks/{index-CIyFPdjr.cjs → index-DHRt1tCk.cjs} +3 -3
- package/dist/chunks/{index-D1G3HZnw.es.js → index-JAE9iqTX.es.js} +3 -3
- package/dist/chunks/{super-editor.es-BLW0IRfr.es.js → super-editor.es-C1RjP_IO.es.js} +163 -22
- package/dist/chunks/{super-editor.es-CZ_EMz2h.cjs → super-editor.es-DXKgM3JR.cjs} +163 -22
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-CvPb50HR.js → converter-CIgfC-et.js} +1 -1
- package/dist/super-editor/chunks/{docx-zipper-BWUuyGDp.js → docx-zipper-AQa91HPZ.js} +1 -1
- package/dist/super-editor/chunks/{editor-CsWOz21v.js → editor-6Tyu_6Nf.js} +164 -23
- package/dist/super-editor/chunks/{index-Cyp2JwAE.js → index-BstIHBcW.js} +1 -1
- package/dist/super-editor/chunks/{toolbar-DjWypz4_.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 +165 -24
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/superdoc.umd.js
CHANGED
|
@@ -42398,7 +42398,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
42398
42398
|
static getStoredSuperdocVersion(docx) {
|
|
42399
42399
|
return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
|
|
42400
42400
|
}
|
|
42401
|
-
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.
|
|
42401
|
+
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.94") {
|
|
42402
42402
|
return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
|
|
42403
42403
|
}
|
|
42404
42404
|
/**
|
|
@@ -64405,12 +64405,12 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
64405
64405
|
const { doc: doc2 } = tr;
|
|
64406
64406
|
const startPos = Math.max(from2 - offset2, 0);
|
|
64407
64407
|
const endPos = Math.min(to + offset2, doc2.content.size);
|
|
64408
|
-
let markFound;
|
|
64409
|
-
|
|
64408
|
+
let markFound = null;
|
|
64409
|
+
const tryMatch = (node2, pos) => {
|
|
64410
64410
|
if (!node2 || node2?.nodeSize === void 0) {
|
|
64411
64411
|
return;
|
|
64412
64412
|
}
|
|
64413
|
-
const mark2 = node2.marks
|
|
64413
|
+
const mark2 = node2.marks?.find(
|
|
64414
64414
|
(mark22) => mark22.type.name === markName && Object.keys(attrs).every((attr) => mark22.attrs[attr] === attrs[attr])
|
|
64415
64415
|
);
|
|
64416
64416
|
if (mark2 && !markFound) {
|
|
@@ -64419,24 +64419,36 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
64419
64419
|
to: pos + node2.nodeSize,
|
|
64420
64420
|
mark: mark2
|
|
64421
64421
|
};
|
|
64422
|
+
return false;
|
|
64422
64423
|
}
|
|
64424
|
+
};
|
|
64425
|
+
doc2.nodesBetween(startPos, endPos, (node2, pos) => {
|
|
64426
|
+
return tryMatch(node2, pos);
|
|
64423
64427
|
});
|
|
64424
|
-
const
|
|
64425
|
-
|
|
64426
|
-
|
|
64427
|
-
|
|
64428
|
-
|
|
64429
|
-
|
|
64430
|
-
|
|
64431
|
-
);
|
|
64432
|
-
|
|
64433
|
-
|
|
64434
|
-
|
|
64435
|
-
to: endPos + node2.nodeSize,
|
|
64436
|
-
mark: mark2
|
|
64437
|
-
};
|
|
64428
|
+
const inspectAroundPosition = (pos) => {
|
|
64429
|
+
if (pos < 0 || pos > doc2.content.size) {
|
|
64430
|
+
return;
|
|
64431
|
+
}
|
|
64432
|
+
const resolved = doc2.resolve(pos);
|
|
64433
|
+
const before = resolved.nodeBefore;
|
|
64434
|
+
if (before?.type?.name === "run") {
|
|
64435
|
+
const beforeStart = Math.max(pos - before.nodeSize, 0);
|
|
64436
|
+
const node2 = before.content?.content?.[0];
|
|
64437
|
+
if (node2?.type?.name === "text") {
|
|
64438
|
+
tryMatch(node2, beforeStart);
|
|
64438
64439
|
}
|
|
64439
64440
|
}
|
|
64441
|
+
const after = resolved.nodeAfter;
|
|
64442
|
+
if (after?.type?.name === "run") {
|
|
64443
|
+
const node2 = after.content?.content?.[0];
|
|
64444
|
+
if (node2?.type?.name === "text") {
|
|
64445
|
+
tryMatch(node2, pos);
|
|
64446
|
+
}
|
|
64447
|
+
}
|
|
64448
|
+
};
|
|
64449
|
+
if (!markFound) {
|
|
64450
|
+
inspectAroundPosition(startPos);
|
|
64451
|
+
inspectAroundPosition(endPos);
|
|
64440
64452
|
}
|
|
64441
64453
|
return markFound;
|
|
64442
64454
|
};
|
|
@@ -67461,7 +67473,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
67461
67473
|
const shouldSkipNodeView = (editor) => {
|
|
67462
67474
|
return isHeadless(editor);
|
|
67463
67475
|
};
|
|
67464
|
-
const summaryVersion = "1.0.0-beta.
|
|
67476
|
+
const summaryVersion = "1.0.0-beta.94";
|
|
67465
67477
|
const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
|
|
67466
67478
|
const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
|
|
67467
67479
|
function mapAttributes(attrs) {
|
|
@@ -68250,7 +68262,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
68250
68262
|
{ default: remarkStringify2 },
|
|
68251
68263
|
{ default: remarkGfm2 }
|
|
68252
68264
|
] = await Promise.all([
|
|
68253
|
-
Promise.resolve().then(() =>
|
|
68265
|
+
Promise.resolve().then(() => indexBstIHBcW),
|
|
68254
68266
|
Promise.resolve().then(() => indexDRCvimau),
|
|
68255
68267
|
Promise.resolve().then(() => indexC_x_N6Uh),
|
|
68256
68268
|
Promise.resolve().then(() => indexD_sWOSiG),
|
|
@@ -68455,7 +68467,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
68455
68467
|
* Process collaboration migrations
|
|
68456
68468
|
*/
|
|
68457
68469
|
processCollaborationMigrations() {
|
|
68458
|
-
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.
|
|
68470
|
+
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.94");
|
|
68459
68471
|
if (!this.options.ydoc) return;
|
|
68460
68472
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
68461
68473
|
let docVersion = metaMap.get("version");
|
|
@@ -85332,7 +85344,9 @@ ${l}
|
|
|
85332
85344
|
textRun.letterSpacing != null ? textRun.letterSpacing : "",
|
|
85333
85345
|
textRun.pmStart ?? "",
|
|
85334
85346
|
textRun.pmEnd ?? "",
|
|
85335
|
-
textRun.token ?? ""
|
|
85347
|
+
textRun.token ?? "",
|
|
85348
|
+
// Tracked changes - force re-render when added or removed tracked change
|
|
85349
|
+
textRun.trackedChange ? 1 : 0
|
|
85336
85350
|
].join(",");
|
|
85337
85351
|
}).join("|");
|
|
85338
85352
|
const attrs = block.attrs;
|
|
@@ -92882,6 +92896,104 @@ ${l}
|
|
|
92882
92896
|
const wordStartChar = charPosInRun;
|
|
92883
92897
|
const wordEndNoSpace = charPosInRun + word.length;
|
|
92884
92898
|
const wordEndWithSpace = charPosInRun + (isLastWord ? word.length : word.length + 1);
|
|
92899
|
+
const effectiveMaxWidth = currentLine ? currentLine.maxWidth : getEffectiveWidth(lines.length === 0 ? initialAvailableWidth : contentWidth);
|
|
92900
|
+
if (wordOnlyWidth > effectiveMaxWidth && word.length > 1) {
|
|
92901
|
+
if (currentLine && currentLine.width > 0 && currentLine.segments.length > 0) {
|
|
92902
|
+
const metrics = calculateTypographyMetrics(currentLine.maxFontSize, spacing, currentLine.maxFontInfo);
|
|
92903
|
+
const { spaceCount: _sc, ...lineBase } = currentLine;
|
|
92904
|
+
const completedLine = { ...lineBase, ...metrics };
|
|
92905
|
+
addBarTabsToLine(completedLine);
|
|
92906
|
+
lines.push(completedLine);
|
|
92907
|
+
tabStopCursor = 0;
|
|
92908
|
+
pendingTabAlignment = null;
|
|
92909
|
+
currentLine = null;
|
|
92910
|
+
}
|
|
92911
|
+
const lineMaxWidth = getEffectiveWidth(lines.length === 0 ? initialAvailableWidth : contentWidth);
|
|
92912
|
+
const hasTabOnlyLine = currentLine && currentLine.segments.length === 0 && currentLine.width > 0;
|
|
92913
|
+
const remainingWidthAfterTab = hasTabOnlyLine ? currentLine.maxWidth - currentLine.width : lineMaxWidth;
|
|
92914
|
+
const chunkWidth = hasTabOnlyLine ? Math.max(remainingWidthAfterTab, lineMaxWidth * 0.25) : lineMaxWidth;
|
|
92915
|
+
const chunks = breakWordIntoChunks(word, chunkWidth - WIDTH_FUDGE_PX, font, ctx2, run2);
|
|
92916
|
+
let chunkCharOffset = wordStartChar;
|
|
92917
|
+
for (let chunkIndex = 0; chunkIndex < chunks.length; chunkIndex++) {
|
|
92918
|
+
const chunk = chunks[chunkIndex];
|
|
92919
|
+
const chunkStartChar = chunkCharOffset;
|
|
92920
|
+
const chunkEndChar = chunkCharOffset + chunk.text.length;
|
|
92921
|
+
const isLastChunk = chunkIndex === chunks.length - 1;
|
|
92922
|
+
const isFirstChunk = chunkIndex === 0;
|
|
92923
|
+
if (isFirstChunk && hasTabOnlyLine && currentLine) {
|
|
92924
|
+
currentLine.toRun = runIndex;
|
|
92925
|
+
currentLine.toChar = chunkEndChar;
|
|
92926
|
+
currentLine.width = roundValue(currentLine.width + chunk.width);
|
|
92927
|
+
currentLine.maxFontSize = Math.max(currentLine.maxFontSize, run2.fontSize);
|
|
92928
|
+
currentLine.maxFontInfo = getFontInfoFromRun(run2);
|
|
92929
|
+
currentLine.segments.push({
|
|
92930
|
+
runIndex,
|
|
92931
|
+
fromChar: chunkStartChar,
|
|
92932
|
+
toChar: chunkEndChar,
|
|
92933
|
+
width: chunk.width
|
|
92934
|
+
});
|
|
92935
|
+
if (isLastChunk) {
|
|
92936
|
+
const ls = run2.letterSpacing ?? 0;
|
|
92937
|
+
if (!isLastWord && currentLine.width + spaceWidth <= currentLine.maxWidth - WIDTH_FUDGE_PX) {
|
|
92938
|
+
currentLine.toChar = wordEndWithSpace;
|
|
92939
|
+
currentLine.width = roundValue(currentLine.width + spaceWidth + ls);
|
|
92940
|
+
charPosInRun = wordEndWithSpace;
|
|
92941
|
+
currentLine.spaceCount += 1;
|
|
92942
|
+
} else {
|
|
92943
|
+
charPosInRun = wordEndWithSpace;
|
|
92944
|
+
}
|
|
92945
|
+
} else {
|
|
92946
|
+
const metrics = calculateTypographyMetrics(currentLine.maxFontSize, spacing, currentLine.maxFontInfo);
|
|
92947
|
+
const { spaceCount: _sc, ...lineBase } = currentLine;
|
|
92948
|
+
const completedLine = { ...lineBase, ...metrics };
|
|
92949
|
+
addBarTabsToLine(completedLine);
|
|
92950
|
+
lines.push(completedLine);
|
|
92951
|
+
tabStopCursor = 0;
|
|
92952
|
+
pendingTabAlignment = null;
|
|
92953
|
+
currentLine = null;
|
|
92954
|
+
}
|
|
92955
|
+
} else if (isLastChunk) {
|
|
92956
|
+
currentLine = {
|
|
92957
|
+
fromRun: runIndex,
|
|
92958
|
+
fromChar: chunkStartChar,
|
|
92959
|
+
toRun: runIndex,
|
|
92960
|
+
toChar: chunkEndChar,
|
|
92961
|
+
width: chunk.width,
|
|
92962
|
+
maxFontSize: run2.fontSize,
|
|
92963
|
+
maxFontInfo: getFontInfoFromRun(run2),
|
|
92964
|
+
maxWidth: getEffectiveWidth(contentWidth),
|
|
92965
|
+
segments: [{ runIndex, fromChar: chunkStartChar, toChar: chunkEndChar, width: chunk.width }],
|
|
92966
|
+
spaceCount: 0
|
|
92967
|
+
};
|
|
92968
|
+
const ls = run2.letterSpacing ?? 0;
|
|
92969
|
+
if (!isLastWord && currentLine.width + spaceWidth <= currentLine.maxWidth - WIDTH_FUDGE_PX) {
|
|
92970
|
+
currentLine.toChar = wordEndWithSpace;
|
|
92971
|
+
currentLine.width = roundValue(currentLine.width + spaceWidth + ls);
|
|
92972
|
+
charPosInRun = wordEndWithSpace;
|
|
92973
|
+
currentLine.spaceCount += 1;
|
|
92974
|
+
} else {
|
|
92975
|
+
charPosInRun = wordEndWithSpace;
|
|
92976
|
+
}
|
|
92977
|
+
} else {
|
|
92978
|
+
const chunkLineMaxWidth = getEffectiveWidth(lines.length === 0 ? initialAvailableWidth : contentWidth);
|
|
92979
|
+
const metrics = calculateTypographyMetrics(run2.fontSize, spacing, getFontInfoFromRun(run2));
|
|
92980
|
+
const chunkLine = {
|
|
92981
|
+
fromRun: runIndex,
|
|
92982
|
+
fromChar: chunkStartChar,
|
|
92983
|
+
toRun: runIndex,
|
|
92984
|
+
toChar: chunkEndChar,
|
|
92985
|
+
width: chunk.width,
|
|
92986
|
+
maxWidth: chunkLineMaxWidth,
|
|
92987
|
+
segments: [{ runIndex, fromChar: chunkStartChar, toChar: chunkEndChar, width: chunk.width }],
|
|
92988
|
+
...metrics
|
|
92989
|
+
};
|
|
92990
|
+
addBarTabsToLine(chunkLine);
|
|
92991
|
+
lines.push(chunkLine);
|
|
92992
|
+
}
|
|
92993
|
+
chunkCharOffset = chunkEndChar;
|
|
92994
|
+
}
|
|
92995
|
+
continue;
|
|
92996
|
+
}
|
|
92885
92997
|
if (!currentLine) {
|
|
92886
92998
|
currentLine = {
|
|
92887
92999
|
fromRun: runIndex,
|
|
@@ -93460,6 +93572,35 @@ ${l}
|
|
|
93460
93572
|
const width = getMeasuredTextWidth(text2, font, letterSpacing, ctx2);
|
|
93461
93573
|
return roundValue(width);
|
|
93462
93574
|
};
|
|
93575
|
+
const breakWordIntoChunks = (word, maxWidth, font, ctx2, run2) => {
|
|
93576
|
+
const chunks = [];
|
|
93577
|
+
if (maxWidth <= 0) {
|
|
93578
|
+
for (const char of word) {
|
|
93579
|
+
const charWidth = measureRunWidth(char, font, ctx2, run2);
|
|
93580
|
+
chunks.push({ text: char, width: charWidth });
|
|
93581
|
+
}
|
|
93582
|
+
return chunks;
|
|
93583
|
+
}
|
|
93584
|
+
let currentChunk = "";
|
|
93585
|
+
let currentWidth = 0;
|
|
93586
|
+
for (let i2 = 0; i2 < word.length; i2++) {
|
|
93587
|
+
const char = word[i2];
|
|
93588
|
+
const testChunk = currentChunk + char;
|
|
93589
|
+
const testWidth = measureRunWidth(testChunk, font, ctx2, run2);
|
|
93590
|
+
if (testWidth > maxWidth && currentChunk.length > 0) {
|
|
93591
|
+
chunks.push({ text: currentChunk, width: currentWidth });
|
|
93592
|
+
currentChunk = char;
|
|
93593
|
+
currentWidth = measureRunWidth(char, font, ctx2, run2);
|
|
93594
|
+
} else {
|
|
93595
|
+
currentChunk = testChunk;
|
|
93596
|
+
currentWidth = testWidth;
|
|
93597
|
+
}
|
|
93598
|
+
}
|
|
93599
|
+
if (currentChunk.length > 0) {
|
|
93600
|
+
chunks.push({ text: currentChunk, width: currentWidth });
|
|
93601
|
+
}
|
|
93602
|
+
return chunks;
|
|
93603
|
+
};
|
|
93463
93604
|
const appendSegment = (segments, runIndex, fromChar, toChar, width, x2) => {
|
|
93464
93605
|
if (!segments) return;
|
|
93465
93606
|
const last = segments[segments.length - 1];
|
|
@@ -151785,7 +151926,7 @@ ${style2}
|
|
|
151785
151926
|
this.config.colors = shuffleArray(this.config.colors);
|
|
151786
151927
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
151787
151928
|
this.colorIndex = 0;
|
|
151788
|
-
this.version = "1.0.0-beta.
|
|
151929
|
+
this.version = "1.0.0-beta.94";
|
|
151789
151930
|
this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
|
|
151790
151931
|
this.superdocId = config2.superdocId || v4();
|
|
151791
151932
|
this.colors = this.config.colors;
|
|
@@ -154257,7 +154398,7 @@ ${style2}
|
|
|
154257
154398
|
value && typeof value === "object" && "byteLength" in value && "byteOffset" in value
|
|
154258
154399
|
);
|
|
154259
154400
|
}
|
|
154260
|
-
const
|
|
154401
|
+
const indexBstIHBcW = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
154261
154402
|
__proto__: null,
|
|
154262
154403
|
unified
|
|
154263
154404
|
}, Symbol.toStringTag, { value: "Module" }));
|