@superdoc-dev/cli 0.3.0-next.47 → 0.3.0-next.49
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/index.js +345 -128
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -39922,7 +39922,7 @@ var init_remark_gfm_z_sDF4ss_es = __esm(() => {
|
|
|
39922
39922
|
emptyOptions2 = {};
|
|
39923
39923
|
});
|
|
39924
39924
|
|
|
39925
|
-
// ../../packages/superdoc/dist/chunks/SuperConverter
|
|
39925
|
+
// ../../packages/superdoc/dist/chunks/SuperConverter-DvkQFRg9.es.js
|
|
39926
39926
|
function getExtensionConfigField(extension$1, field, context = { name: "" }) {
|
|
39927
39927
|
const fieldValue = extension$1.config[field];
|
|
39928
39928
|
if (typeof fieldValue === "function")
|
|
@@ -65485,6 +65485,7 @@ function importCommentData({ docx, editor, converter }) {
|
|
|
65485
65485
|
const trackedChange = attributes["custom:trackedChange"] === "true";
|
|
65486
65486
|
const trackedChangeType = attributes["custom:trackedChangeType"];
|
|
65487
65487
|
const trackedChangeText = attributes["custom:trackedChangeText"] !== "null" ? attributes["custom:trackedChangeText"] : null;
|
|
65488
|
+
const trackedChangeDisplayType = attributes["custom:trackedChangeDisplayType"] !== "null" ? attributes["custom:trackedChangeDisplayType"] : null;
|
|
65488
65489
|
const trackedDeletedText = attributes["custom:trackedDeletedText"] !== "null" ? attributes["custom:trackedDeletedText"] : null;
|
|
65489
65490
|
const unixTimestampMs = new Date(createdDate).getTime();
|
|
65490
65491
|
const parsedElements = nodeListHandler.handler({
|
|
@@ -65510,6 +65511,7 @@ function importCommentData({ docx, editor, converter }) {
|
|
|
65510
65511
|
trackedChange,
|
|
65511
65512
|
trackedChangeText,
|
|
65512
65513
|
trackedChangeType,
|
|
65514
|
+
trackedChangeDisplayType,
|
|
65513
65515
|
trackedDeletedText,
|
|
65514
65516
|
isDone: false,
|
|
65515
65517
|
origin: converter?.documentOrigin || "word",
|
|
@@ -72182,7 +72184,7 @@ var isRegExp = (value) => {
|
|
|
72182
72184
|
return true;
|
|
72183
72185
|
}, areAttrsEqual = (attrsA = {}, attrsB = {}) => {
|
|
72184
72186
|
return objectIncludes(attrsA, attrsB);
|
|
72185
|
-
}, TrackInsertMarkName = "trackInsert", TrackDeleteMarkName = "trackDelete", TrackFormatMarkName = "trackFormat", TABLE_STYLE_ID_TABLE_GRID = "TableGrid", TABLE_FALLBACK_BORDER, TABLE_FALLBACK_BORDERS, TABLE_FALLBACK_CELL_PADDING, DEFAULT_TBL_LOOK, CNF_STYLE_MAP, TABLE_STYLE_PRECEDENCE, getToCssFontFamily = () => {
|
|
72187
|
+
}, TrackInsertMarkName = "trackInsert", TrackDeleteMarkName = "trackDelete", TrackFormatMarkName = "trackFormat", TrackedFormatMarkNames, TABLE_STYLE_ID_TABLE_GRID = "TableGrid", TABLE_FALLBACK_BORDER, TABLE_FALLBACK_BORDERS, TABLE_FALLBACK_CELL_PADDING, DEFAULT_TBL_LOOK, CNF_STYLE_MAP, TABLE_STYLE_PRECEDENCE, getToCssFontFamily = () => {
|
|
72186
72188
|
return SuperConverter.toCssFontFamily;
|
|
72187
72189
|
}, SUBSCRIPT_SUPERSCRIPT_SCALE = 0.65, getSpacingStyle = (spacing, isListItem$1) => {
|
|
72188
72190
|
let { before, after, line, lineRule, beforeAutospacing, afterAutospacing } = spacing;
|
|
@@ -85455,6 +85457,7 @@ var isRegExp = (value) => {
|
|
|
85455
85457
|
"custom:trackedChange": comment.trackedChange,
|
|
85456
85458
|
"custom:trackedChangeText": comment.trackedChangeText || null,
|
|
85457
85459
|
"custom:trackedChangeType": comment.trackedChangeType,
|
|
85460
|
+
"custom:trackedChangeDisplayType": comment.trackedChangeDisplayType || null,
|
|
85458
85461
|
"custom:trackedDeletedText": comment.deletedText || null
|
|
85459
85462
|
};
|
|
85460
85463
|
if (comment?.parentCommentId) {
|
|
@@ -85501,6 +85504,7 @@ var isRegExp = (value) => {
|
|
|
85501
85504
|
"custom:trackedChange": commentDef.attributes["custom:trackedChange"],
|
|
85502
85505
|
"custom:trackedChangeText": commentDef.attributes["custom:trackedChangeText"],
|
|
85503
85506
|
"custom:trackedChangeType": commentDef.attributes["custom:trackedChangeType"],
|
|
85507
|
+
"custom:trackedChangeDisplayType": commentDef.attributes["custom:trackedChangeDisplayType"],
|
|
85504
85508
|
"custom:trackedDeletedText": commentDef.attributes["custom:trackedDeletedText"],
|
|
85505
85509
|
"xmlns:custom": "http://schemas.openxmlformats.org/wordprocessingml/2006/main"
|
|
85506
85510
|
};
|
|
@@ -86021,7 +86025,7 @@ var isRegExp = (value) => {
|
|
|
86021
86025
|
state.kern = kernNode.attributes["w:val"];
|
|
86022
86026
|
}
|
|
86023
86027
|
}, SuperConverter;
|
|
86024
|
-
var
|
|
86028
|
+
var init_SuperConverter_DvkQFRg9_es = __esm(() => {
|
|
86025
86029
|
init_rolldown_runtime_B2q5OVn9_es();
|
|
86026
86030
|
init_jszip_ChlR43oI_es();
|
|
86027
86031
|
init_xml_js_BtmJ6bNs_es();
|
|
@@ -100512,6 +100516,15 @@ var init_SuperConverter_IVMRugL_es = __esm(() => {
|
|
|
100512
100516
|
attributes: attributes_default$6
|
|
100513
100517
|
};
|
|
100514
100518
|
translator$3 = NodeTranslator.from(config$36);
|
|
100519
|
+
TrackedFormatMarkNames = [
|
|
100520
|
+
"bold",
|
|
100521
|
+
"italic",
|
|
100522
|
+
"strike",
|
|
100523
|
+
"underline",
|
|
100524
|
+
"textStyle",
|
|
100525
|
+
"highlight",
|
|
100526
|
+
"link"
|
|
100527
|
+
];
|
|
100515
100528
|
TABLE_FALLBACK_BORDER = {
|
|
100516
100529
|
val: "single",
|
|
100517
100530
|
size: 4,
|
|
@@ -148837,7 +148850,7 @@ var init_remark_gfm_CjV8kaUy_es = __esm(() => {
|
|
|
148837
148850
|
init_remark_gfm_z_sDF4ss_es();
|
|
148838
148851
|
});
|
|
148839
148852
|
|
|
148840
|
-
// ../../packages/superdoc/dist/chunks/src-
|
|
148853
|
+
// ../../packages/superdoc/dist/chunks/src-BeJRbQ1S.es.js
|
|
148841
148854
|
function deleteProps(obj, propOrProps) {
|
|
148842
148855
|
const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
|
|
148843
148856
|
const removeNested = (target, pathParts, index2 = 0) => {
|
|
@@ -187305,6 +187318,43 @@ function collectAnchoredTables(blocks2, measures) {
|
|
|
187305
187318
|
}
|
|
187306
187319
|
return map$12;
|
|
187307
187320
|
}
|
|
187321
|
+
function computePhysicalAnchorY(block, fragmentHeight, pageHeight) {
|
|
187322
|
+
const alignV = block.anchor?.alignV ?? "top";
|
|
187323
|
+
const offsetV = block.anchor?.offsetV ?? 0;
|
|
187324
|
+
if (alignV === "bottom")
|
|
187325
|
+
return pageHeight - fragmentHeight + offsetV;
|
|
187326
|
+
if (alignV === "center")
|
|
187327
|
+
return (pageHeight - fragmentHeight) / 2 + offsetV;
|
|
187328
|
+
return offsetV;
|
|
187329
|
+
}
|
|
187330
|
+
function computeFooterBandOrigin(constraints) {
|
|
187331
|
+
return (constraints.pageHeight ?? 0) - (constraints.margins?.bottom ?? 0);
|
|
187332
|
+
}
|
|
187333
|
+
function isAnchoredFragment(fragment2) {
|
|
187334
|
+
return (fragment2.kind === "image" || fragment2.kind === "drawing") && fragment2.isAnchored === true;
|
|
187335
|
+
}
|
|
187336
|
+
function isPageRelativeBlock(block) {
|
|
187337
|
+
return (block.kind === "image" || block.kind === "drawing") && block.anchor?.vRelativeFrom === "page";
|
|
187338
|
+
}
|
|
187339
|
+
function normalizeFragmentsForRegion(pages, blocks2, _measures, _kind, constraints) {
|
|
187340
|
+
if (constraints.pageHeight == null || !constraints.margins)
|
|
187341
|
+
return pages;
|
|
187342
|
+
const pageHeight = constraints.pageHeight;
|
|
187343
|
+
const bandOrigin = computeFooterBandOrigin(constraints);
|
|
187344
|
+
const blockById = /* @__PURE__ */ new Map;
|
|
187345
|
+
for (const block of blocks2)
|
|
187346
|
+
blockById.set(block.id, block);
|
|
187347
|
+
for (const page of pages)
|
|
187348
|
+
for (const fragment2 of page.fragments) {
|
|
187349
|
+
if (!isAnchoredFragment(fragment2))
|
|
187350
|
+
continue;
|
|
187351
|
+
const block = blockById.get(fragment2.blockId);
|
|
187352
|
+
if (!block || !isPageRelativeBlock(block))
|
|
187353
|
+
continue;
|
|
187354
|
+
fragment2.y = computePhysicalAnchorY(block, fragment2.height ?? 0, pageHeight) - bandOrigin;
|
|
187355
|
+
}
|
|
187356
|
+
return pages;
|
|
187357
|
+
}
|
|
187308
187358
|
function createPaginator(opts) {
|
|
187309
187359
|
const states = [];
|
|
187310
187360
|
const pages = [];
|
|
@@ -188979,7 +189029,51 @@ function layoutDocument(blocks2, measures, options = {}) {
|
|
|
188979
189029
|
} : undefined
|
|
188980
189030
|
};
|
|
188981
189031
|
}
|
|
188982
|
-
function
|
|
189032
|
+
function computeFragmentBottom(fragment2, block, measure) {
|
|
189033
|
+
let bottom$1 = fragment2.y;
|
|
189034
|
+
if (fragment2.kind === "para" && measure?.kind === "paragraph") {
|
|
189035
|
+
let sum = 0;
|
|
189036
|
+
for (let li2 = fragment2.fromLine;li2 < fragment2.toLine; li2 += 1)
|
|
189037
|
+
sum += measure.lines[li2]?.lineHeight ?? 0;
|
|
189038
|
+
bottom$1 += sum;
|
|
189039
|
+
const spacingAfter = block?.attrs?.spacing?.after;
|
|
189040
|
+
if (spacingAfter && fragment2.toLine === measure.lines.length)
|
|
189041
|
+
bottom$1 += Math.max(0, Number(spacingAfter));
|
|
189042
|
+
} else if (fragment2.kind === "image")
|
|
189043
|
+
bottom$1 += typeof fragment2.height === "number" ? fragment2.height : measure?.height ?? 0;
|
|
189044
|
+
else if (fragment2.kind === "drawing")
|
|
189045
|
+
bottom$1 += typeof fragment2.height === "number" ? fragment2.height : measure?.height ?? 0;
|
|
189046
|
+
else if (fragment2.kind === "list-item") {
|
|
189047
|
+
const listMeasure = measure;
|
|
189048
|
+
if (listMeasure) {
|
|
189049
|
+
const item = listMeasure.items.find((it) => it.itemId === fragment2.itemId);
|
|
189050
|
+
if (item?.paragraph) {
|
|
189051
|
+
let sum = 0;
|
|
189052
|
+
for (let li2 = fragment2.fromLine;li2 < fragment2.toLine; li2 += 1)
|
|
189053
|
+
sum += item.paragraph.lines[li2]?.lineHeight ?? 0;
|
|
189054
|
+
bottom$1 += sum;
|
|
189055
|
+
}
|
|
189056
|
+
}
|
|
189057
|
+
}
|
|
189058
|
+
return bottom$1;
|
|
189059
|
+
}
|
|
189060
|
+
function shouldExcludeFromMeasurement(fragment2, block, canvasHeight) {
|
|
189061
|
+
if (!((fragment2.kind === "image" || fragment2.kind === "drawing") && fragment2.isAnchored === true))
|
|
189062
|
+
return false;
|
|
189063
|
+
if (block.kind !== "image" && block.kind !== "drawing")
|
|
189064
|
+
throw new Error(`Type mismatch: fragment kind is ${fragment2.kind} but block kind is ${block.kind} for block ${block.id}`);
|
|
189065
|
+
const anchoredBlock = block;
|
|
189066
|
+
if (anchoredBlock.anchor?.behindDoc)
|
|
189067
|
+
return true;
|
|
189068
|
+
if (isPageRelativeAnchor(anchoredBlock)) {
|
|
189069
|
+
const fragmentHeight = fragment2.height ?? 0;
|
|
189070
|
+
const fragmentTop = fragment2.y;
|
|
189071
|
+
if (fragment2.y + fragmentHeight <= 0 || fragmentTop >= canvasHeight)
|
|
189072
|
+
return true;
|
|
189073
|
+
}
|
|
189074
|
+
return false;
|
|
189075
|
+
}
|
|
189076
|
+
function layoutHeaderFooter(blocks2, measures, constraints, kind) {
|
|
188983
189077
|
if (blocks2.length !== measures.length)
|
|
188984
189078
|
throw new Error(`layoutHeaderFooter expected measures for every block (blocks=${blocks2.length}, measures=${measures.length})`);
|
|
188985
189079
|
const width = Number(constraints?.width);
|
|
@@ -188991,18 +189085,7 @@ function layoutHeaderFooter(blocks2, measures, constraints) {
|
|
|
188991
189085
|
pages: [],
|
|
188992
189086
|
height: 0
|
|
188993
189087
|
};
|
|
188994
|
-
const
|
|
188995
|
-
const layout = layoutDocument(marginLeft > 0 ? blocks2.map((block) => {
|
|
188996
|
-
if ((block.kind === "image" || block.kind === "drawing") && block.anchor?.hRelativeFrom === "page" && block.anchor.offsetH != null)
|
|
188997
|
-
return {
|
|
188998
|
-
...block,
|
|
188999
|
-
anchor: {
|
|
189000
|
-
...block.anchor,
|
|
189001
|
-
offsetH: block.anchor.offsetH - marginLeft
|
|
189002
|
-
}
|
|
189003
|
-
};
|
|
189004
|
-
return block;
|
|
189005
|
-
}) : blocks2, measures, {
|
|
189088
|
+
const layout = layoutDocument(blocks2, measures, {
|
|
189006
189089
|
pageSize: {
|
|
189007
189090
|
w: width,
|
|
189008
189091
|
h: height
|
|
@@ -189014,11 +189097,15 @@ function layoutHeaderFooter(blocks2, measures, constraints) {
|
|
|
189014
189097
|
left: 0
|
|
189015
189098
|
}
|
|
189016
189099
|
});
|
|
189100
|
+
if (kind === "footer" && constraints.pageHeight != null)
|
|
189101
|
+
normalizeFragmentsForRegion(layout.pages, blocks2, measures, kind, constraints);
|
|
189017
189102
|
const idToIndex = /* @__PURE__ */ new Map;
|
|
189018
189103
|
for (let i4 = 0;i4 < blocks2.length; i4 += 1)
|
|
189019
189104
|
idToIndex.set(blocks2[i4].id, i4);
|
|
189020
|
-
let
|
|
189021
|
-
let
|
|
189105
|
+
let measureMinY = 0;
|
|
189106
|
+
let measureMaxY = 0;
|
|
189107
|
+
let renderMinY = 0;
|
|
189108
|
+
let renderMaxY = 0;
|
|
189022
189109
|
for (const page of layout.pages)
|
|
189023
189110
|
for (const fragment2 of page.fragments) {
|
|
189024
189111
|
const idx = idToIndex.get(fragment2.blockId);
|
|
@@ -189026,48 +189113,23 @@ function layoutHeaderFooter(blocks2, measures, constraints) {
|
|
|
189026
189113
|
continue;
|
|
189027
189114
|
const block = blocks2[idx];
|
|
189028
189115
|
const measure = measures[idx];
|
|
189029
|
-
|
|
189030
|
-
|
|
189031
|
-
|
|
189032
|
-
|
|
189033
|
-
|
|
189034
|
-
|
|
189035
|
-
|
|
189036
|
-
|
|
189037
|
-
|
|
189038
|
-
if (
|
|
189039
|
-
|
|
189040
|
-
for (let li2 = fragment2.fromLine;li2 < fragment2.toLine; li2 += 1)
|
|
189041
|
-
sum += measure.lines[li2]?.lineHeight ?? 0;
|
|
189042
|
-
bottom$1 += sum;
|
|
189043
|
-
const spacingAfter = block?.attrs?.spacing?.after;
|
|
189044
|
-
if (spacingAfter && fragment2.toLine === measure.lines.length)
|
|
189045
|
-
bottom$1 += Math.max(0, Number(spacingAfter));
|
|
189046
|
-
} else if (fragment2.kind === "image") {
|
|
189047
|
-
const h$2 = typeof fragment2.height === "number" ? fragment2.height : measure?.height ?? 0;
|
|
189048
|
-
bottom$1 += h$2;
|
|
189049
|
-
} else if (fragment2.kind === "drawing") {
|
|
189050
|
-
const drawingHeight = typeof fragment2.height === "number" ? fragment2.height : measure?.height ?? 0;
|
|
189051
|
-
bottom$1 += drawingHeight;
|
|
189052
|
-
} else if (fragment2.kind === "list-item") {
|
|
189053
|
-
const listMeasure = measure;
|
|
189054
|
-
if (listMeasure) {
|
|
189055
|
-
const item = listMeasure.items.find((it) => it.itemId === fragment2.itemId);
|
|
189056
|
-
if (item?.paragraph) {
|
|
189057
|
-
let sum = 0;
|
|
189058
|
-
for (let li2 = fragment2.fromLine;li2 < fragment2.toLine; li2 += 1)
|
|
189059
|
-
sum += item.paragraph.lines[li2]?.lineHeight ?? 0;
|
|
189060
|
-
bottom$1 += sum;
|
|
189061
|
-
}
|
|
189062
|
-
}
|
|
189063
|
-
}
|
|
189064
|
-
if (bottom$1 > maxY)
|
|
189065
|
-
maxY = bottom$1;
|
|
189116
|
+
const bottom$1 = computeFragmentBottom(fragment2, block, measure);
|
|
189117
|
+
if (fragment2.y < renderMinY)
|
|
189118
|
+
renderMinY = fragment2.y;
|
|
189119
|
+
if (bottom$1 > renderMaxY)
|
|
189120
|
+
renderMaxY = bottom$1;
|
|
189121
|
+
if (shouldExcludeFromMeasurement(fragment2, block, height))
|
|
189122
|
+
continue;
|
|
189123
|
+
if (fragment2.y < measureMinY)
|
|
189124
|
+
measureMinY = fragment2.y;
|
|
189125
|
+
if (bottom$1 > measureMaxY)
|
|
189126
|
+
measureMaxY = bottom$1;
|
|
189066
189127
|
}
|
|
189067
189128
|
return {
|
|
189068
|
-
height:
|
|
189069
|
-
minY,
|
|
189070
|
-
maxY,
|
|
189129
|
+
height: measureMaxY - measureMinY,
|
|
189130
|
+
minY: renderMinY,
|
|
189131
|
+
maxY: renderMaxY,
|
|
189132
|
+
renderHeight: renderMaxY - renderMinY,
|
|
189071
189133
|
pages: layout.pages.map((page) => ({
|
|
189072
189134
|
number: page.number,
|
|
189073
189135
|
fragments: page.fragments
|
|
@@ -193922,7 +193984,7 @@ function hasPageTokens(blocks2) {
|
|
|
193922
193984
|
}
|
|
193923
193985
|
return false;
|
|
193924
193986
|
}
|
|
193925
|
-
async function layoutHeaderFooterWithCache(sections, constraints, measureBlock$1, cache$2 = sharedHeaderFooterCache, totalPages, pageResolver) {
|
|
193987
|
+
async function layoutHeaderFooterWithCache(sections, constraints, measureBlock$1, cache$2 = sharedHeaderFooterCache, totalPages, pageResolver, kind) {
|
|
193926
193988
|
const result = {};
|
|
193927
193989
|
if (!pageResolver) {
|
|
193928
193990
|
const numPages = totalPages ?? 1;
|
|
@@ -193935,7 +193997,7 @@ async function layoutHeaderFooterWithCache(sections, constraints, measureBlock$1
|
|
|
193935
193997
|
result[type] = {
|
|
193936
193998
|
blocks: clonedBlocks,
|
|
193937
193999
|
measures,
|
|
193938
|
-
layout: layoutHeaderFooter(clonedBlocks, measures, constraints)
|
|
194000
|
+
layout: layoutHeaderFooter(clonedBlocks, measures, constraints, kind)
|
|
193939
194001
|
};
|
|
193940
194002
|
}
|
|
193941
194003
|
return result;
|
|
@@ -193950,7 +194012,7 @@ async function layoutHeaderFooterWithCache(sections, constraints, measureBlock$1
|
|
|
193950
194012
|
result[type] = {
|
|
193951
194013
|
blocks: blocks2,
|
|
193952
194014
|
measures,
|
|
193953
|
-
layout: layoutHeaderFooter(blocks2, measures, constraints)
|
|
194015
|
+
layout: layoutHeaderFooter(blocks2, measures, constraints, kind)
|
|
193954
194016
|
};
|
|
193955
194017
|
continue;
|
|
193956
194018
|
}
|
|
@@ -193971,7 +194033,7 @@ async function layoutHeaderFooterWithCache(sections, constraints, measureBlock$1
|
|
|
193971
194033
|
const { displayText, totalPages: totalPagesForPage } = pageResolver(pageNum);
|
|
193972
194034
|
resolveHeaderFooterTokens(clonedBlocks, pageNum, totalPagesForPage, displayText);
|
|
193973
194035
|
const measures = await cache$2.measureBlocks(clonedBlocks, constraints, measureBlock$1);
|
|
193974
|
-
const pageLayout = layoutHeaderFooter(clonedBlocks, measures, constraints);
|
|
194036
|
+
const pageLayout = layoutHeaderFooter(clonedBlocks, measures, constraints, kind);
|
|
193975
194037
|
const measuresById = /* @__PURE__ */ new Map;
|
|
193976
194038
|
for (let i4 = 0;i4 < clonedBlocks.length; i4 += 1)
|
|
193977
194039
|
measuresById.set(clonedBlocks[i4].id, measures[i4]);
|
|
@@ -193993,7 +194055,7 @@ async function layoutHeaderFooterWithCache(sections, constraints, measureBlock$1
|
|
|
193993
194055
|
fragments: fragmentsWithLines
|
|
193994
194056
|
});
|
|
193995
194057
|
}
|
|
193996
|
-
const firstPageLayout = pages[0] ? layoutHeaderFooter(pages[0].blocks, pages[0].measures, constraints) : {
|
|
194058
|
+
const firstPageLayout = pages[0] ? layoutHeaderFooter(pages[0].blocks, pages[0].measures, constraints, kind) : {
|
|
193997
194059
|
height: 0,
|
|
193998
194060
|
pages: []
|
|
193999
194061
|
};
|
|
@@ -194001,6 +194063,7 @@ async function layoutHeaderFooterWithCache(sections, constraints, measureBlock$1
|
|
|
194001
194063
|
height: firstPageLayout.height,
|
|
194002
194064
|
minY: firstPageLayout.minY,
|
|
194003
194065
|
maxY: firstPageLayout.maxY,
|
|
194066
|
+
renderHeight: firstPageLayout.renderHeight,
|
|
194004
194067
|
pages: pages.map((p$12) => ({
|
|
194005
194068
|
number: p$12.number,
|
|
194006
194069
|
fragments: p$12.fragments
|
|
@@ -194599,7 +194662,7 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
|
|
|
194599
194662
|
};
|
|
194600
194663
|
headerContentHeights = {};
|
|
194601
194664
|
if (hasHeaderBlocks && headerFooter.headerBlocks) {
|
|
194602
|
-
const preHeaderLayouts = await layoutHeaderFooterWithCache(headerFooter.headerBlocks, headerFooter.constraints, measureFn, headerMeasureCache, HEADER_PRELAYOUT_PLACEHOLDER_PAGE_COUNT, undefined);
|
|
194665
|
+
const preHeaderLayouts = await layoutHeaderFooterWithCache(headerFooter.headerBlocks, headerFooter.constraints, measureFn, headerMeasureCache, HEADER_PRELAYOUT_PLACEHOLDER_PAGE_COUNT, undefined, "header");
|
|
194603
194666
|
for (const [type, value] of Object.entries(preHeaderLayouts)) {
|
|
194604
194667
|
if (!isValidHeaderType(type))
|
|
194605
194668
|
continue;
|
|
@@ -194619,10 +194682,7 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
|
|
|
194619
194682
|
maxWidth: headerFooter.constraints.width,
|
|
194620
194683
|
maxHeight: headerFooter.constraints.height
|
|
194621
194684
|
};
|
|
194622
|
-
const layout$1 = layoutHeaderFooter(blocks2, await Promise.all(blocks2.map((block) => measureFn(block, measureConstraints))),
|
|
194623
|
-
width: headerFooter.constraints.width,
|
|
194624
|
-
height: headerFooter.constraints.height
|
|
194625
|
-
});
|
|
194685
|
+
const layout$1 = layoutHeaderFooter(blocks2, await Promise.all(blocks2.map((block) => measureFn(block, measureConstraints))), headerFooter.constraints, "header");
|
|
194626
194686
|
if (layout$1.height > 0)
|
|
194627
194687
|
headerContentHeightsByRId.set(rId, layout$1.height);
|
|
194628
194688
|
}
|
|
@@ -194650,7 +194710,7 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
|
|
|
194650
194710
|
footerContentHeights = {};
|
|
194651
194711
|
try {
|
|
194652
194712
|
if (hasFooterBlocks && headerFooter.footerBlocks) {
|
|
194653
|
-
const preFooterLayouts = await layoutHeaderFooterWithCache(headerFooter.footerBlocks, headerFooter.constraints, measureFn, headerMeasureCache, FOOTER_PRELAYOUT_PLACEHOLDER_PAGE_COUNT, undefined);
|
|
194713
|
+
const preFooterLayouts = await layoutHeaderFooterWithCache(headerFooter.footerBlocks, headerFooter.constraints, measureFn, headerMeasureCache, FOOTER_PRELAYOUT_PLACEHOLDER_PAGE_COUNT, undefined, "footer");
|
|
194654
194714
|
for (const [type, value] of Object.entries(preFooterLayouts)) {
|
|
194655
194715
|
if (!isValidFooterType(type))
|
|
194656
194716
|
continue;
|
|
@@ -194670,10 +194730,7 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
|
|
|
194670
194730
|
maxWidth: headerFooter.constraints.width,
|
|
194671
194731
|
maxHeight: headerFooter.constraints.height
|
|
194672
194732
|
};
|
|
194673
|
-
const layout$1 = layoutHeaderFooter(blocks2, await Promise.all(blocks2.map((block) => measureFn(block, measureConstraints))),
|
|
194674
|
-
width: headerFooter.constraints.width,
|
|
194675
|
-
height: headerFooter.constraints.height
|
|
194676
|
-
});
|
|
194733
|
+
const layout$1 = layoutHeaderFooter(blocks2, await Promise.all(blocks2.map((block) => measureFn(block, measureConstraints))), headerFooter.constraints, "footer");
|
|
194677
194734
|
if (layout$1.height > 0)
|
|
194678
194735
|
footerContentHeightsByRId.set(rId, layout$1.height);
|
|
194679
194736
|
}
|
|
@@ -195283,9 +195340,9 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
|
|
|
195283
195340
|
};
|
|
195284
195341
|
} : undefined;
|
|
195285
195342
|
if (headerFooter.headerBlocks)
|
|
195286
|
-
headers = serializeHeaderFooterResults("header", await layoutHeaderFooterWithCache(headerFooter.headerBlocks, headerFooter.constraints, measureFn, headerMeasureCache, FeatureFlags.HEADER_FOOTER_PAGE_TOKENS ? undefined : numberingCtx.totalPages, pageResolver));
|
|
195343
|
+
headers = serializeHeaderFooterResults("header", await layoutHeaderFooterWithCache(headerFooter.headerBlocks, headerFooter.constraints, measureFn, headerMeasureCache, FeatureFlags.HEADER_FOOTER_PAGE_TOKENS ? undefined : numberingCtx.totalPages, pageResolver, "header"));
|
|
195287
195344
|
if (headerFooter.footerBlocks)
|
|
195288
|
-
footers = serializeHeaderFooterResults("footer", await layoutHeaderFooterWithCache(headerFooter.footerBlocks, headerFooter.constraints, measureFn, headerMeasureCache, FeatureFlags.HEADER_FOOTER_PAGE_TOKENS ? undefined : numberingCtx.totalPages, pageResolver));
|
|
195345
|
+
footers = serializeHeaderFooterResults("footer", await layoutHeaderFooterWithCache(headerFooter.footerBlocks, headerFooter.constraints, measureFn, headerMeasureCache, FeatureFlags.HEADER_FOOTER_PAGE_TOKENS ? undefined : numberingCtx.totalPages, pageResolver, "footer"));
|
|
195289
195346
|
perfLog$1(`[Perf] 4.4 Header/footer layout: ${(performance.now() - hfStart).toFixed(2)}ms`);
|
|
195290
195347
|
const cacheStats = headerMeasureCache.getStats();
|
|
195291
195348
|
globalMetrics.recordHeaderFooterCacheMetrics(cacheStats);
|
|
@@ -197746,25 +197803,37 @@ function initHeaderFooterRegistry({ painterHost, visibleHost, selectionOverlay,
|
|
|
197746
197803
|
};
|
|
197747
197804
|
}
|
|
197748
197805
|
function buildSectionContentWidth(section, fallback) {
|
|
197749
|
-
const pageW = section.pageSize?.w ?? fallback.pageWidth;
|
|
197750
|
-
const marginL = section.margins?.left ?? fallback.margins
|
|
197751
|
-
const marginR = section.margins?.right ?? fallback.margins
|
|
197806
|
+
const pageW = section.pageSize?.w ?? fallback.pageWidth ?? 0;
|
|
197807
|
+
const marginL = section.margins?.left ?? fallback.margins?.left ?? 0;
|
|
197808
|
+
const marginR = section.margins?.right ?? fallback.margins?.right ?? 0;
|
|
197752
197809
|
return pageW - marginL - marginR;
|
|
197753
197810
|
}
|
|
197754
197811
|
function buildConstraintsForSection(section, fallback, minWidth) {
|
|
197755
|
-
const pageW = section.pageSize?.w ?? fallback.pageWidth;
|
|
197756
|
-
const
|
|
197757
|
-
const
|
|
197812
|
+
const pageW = section.pageSize?.w ?? fallback.pageWidth ?? 0;
|
|
197813
|
+
const pageH = section.pageSize?.h ?? fallback.pageHeight;
|
|
197814
|
+
const marginL = section.margins?.left ?? fallback.margins?.left ?? 0;
|
|
197815
|
+
const marginR = section.margins?.right ?? fallback.margins?.right ?? 0;
|
|
197816
|
+
const marginT = section.margins?.top ?? fallback.margins?.top;
|
|
197817
|
+
const marginB = section.margins?.bottom ?? fallback.margins?.bottom;
|
|
197818
|
+
const marginHeader = section.margins?.header ?? fallback.margins?.header;
|
|
197758
197819
|
const contentWidth = pageW - marginL - marginR;
|
|
197759
197820
|
const maxWidth = pageW - marginL;
|
|
197821
|
+
const effectiveWidth = minWidth ? Math.min(Math.max(contentWidth, minWidth), maxWidth) : contentWidth;
|
|
197822
|
+
const sectionMarginTop = marginT ?? 0;
|
|
197823
|
+
const sectionMarginBottom = marginB ?? 0;
|
|
197760
197824
|
return {
|
|
197761
|
-
width:
|
|
197762
|
-
height: fallback.height,
|
|
197825
|
+
width: effectiveWidth,
|
|
197826
|
+
height: pageH != null ? Math.max(1, pageH - sectionMarginTop - sectionMarginBottom) : fallback.height,
|
|
197763
197827
|
pageWidth: pageW,
|
|
197828
|
+
pageHeight: pageH,
|
|
197764
197829
|
margins: {
|
|
197765
197830
|
left: marginL,
|
|
197766
|
-
right: marginR
|
|
197767
|
-
|
|
197831
|
+
right: marginR,
|
|
197832
|
+
top: marginT,
|
|
197833
|
+
bottom: marginB,
|
|
197834
|
+
header: marginHeader
|
|
197835
|
+
},
|
|
197836
|
+
overflowBaseHeight: fallback.overflowBaseHeight
|
|
197768
197837
|
};
|
|
197769
197838
|
}
|
|
197770
197839
|
function getTableWidthSpec(blocks2) {
|
|
@@ -197852,7 +197921,7 @@ async function layoutBlocksByRId(kind, blocksByRId, constraints, pageResolver, l
|
|
|
197852
197921
|
if (!blocks2 || blocks2.length === 0)
|
|
197853
197922
|
continue;
|
|
197854
197923
|
try {
|
|
197855
|
-
const batchResult = await layoutHeaderFooterWithCache({ default: blocks2 }, constraints, (block, c) => measureBlock(block, c), undefined, undefined, pageResolver);
|
|
197924
|
+
const batchResult = await layoutHeaderFooterWithCache({ default: blocks2 }, constraints, (block, c) => measureBlock(block, c), undefined, undefined, pageResolver, kind);
|
|
197856
197925
|
if (batchResult.default)
|
|
197857
197926
|
layoutsByRId.set(rId, {
|
|
197858
197927
|
kind,
|
|
@@ -197916,7 +197985,7 @@ async function layoutWithPerSectionConstraints(kind, blocksByRId, sectionMetadat
|
|
|
197916
197985
|
const contentWidth = buildSectionContentWidth(section, fallbackConstraints);
|
|
197917
197986
|
const sectionConstraints = buildConstraintsForSection(section, fallbackConstraints, resolveTableMinWidth(tableWidthSpecByRId.get(rId), contentWidth) || undefined);
|
|
197918
197987
|
const effectiveWidth = sectionConstraints.width;
|
|
197919
|
-
const groupKey = `${rId}::w${effectiveWidth}`;
|
|
197988
|
+
const groupKey = `${rId}::w${effectiveWidth}::ph${sectionConstraints.pageHeight ?? ""}::mt${sectionConstraints.margins?.top ?? ""}::mb${sectionConstraints.margins?.bottom ?? ""}::mh${sectionConstraints.margins?.header ?? ""}`;
|
|
197920
197989
|
let group = groups.get(groupKey);
|
|
197921
197990
|
if (!group) {
|
|
197922
197991
|
group = {
|
|
@@ -197934,7 +198003,7 @@ async function layoutWithPerSectionConstraints(kind, blocksByRId, sectionMetadat
|
|
|
197934
198003
|
if (!blocks2 || blocks2.length === 0)
|
|
197935
198004
|
continue;
|
|
197936
198005
|
try {
|
|
197937
|
-
const batchResult = await layoutHeaderFooterWithCache({ default: blocks2 }, group.sectionConstraints, (block, c) => measureBlock(block, c), undefined, undefined, pageResolver);
|
|
198006
|
+
const batchResult = await layoutHeaderFooterWithCache({ default: blocks2 }, group.sectionConstraints, (block, c) => measureBlock(block, c), undefined, undefined, pageResolver, kind);
|
|
197938
198007
|
if (batchResult.default)
|
|
197939
198008
|
for (const sectionIndex of group.sectionIndices) {
|
|
197940
198009
|
const contentWidth = buildSectionContentWidth(sectionMetadata.find((s2) => s2.sectionIndex === sectionIndex), fallbackConstraints);
|
|
@@ -207933,6 +208002,102 @@ var Node$13 = class Node$14 {
|
|
|
207933
208002
|
if (isActive$1 && activeOverride)
|
|
207934
208003
|
return activeOverride;
|
|
207935
208004
|
return applyAlphaToHex(baseColor, clampOpacity(isActive$1 ? highlightOpacity.active : highlightOpacity.inactive) ?? (isActive$1 ? DEFAULT_ACTIVE_ALPHA : DEFAULT_INACTIVE_ALPHA));
|
|
208005
|
+
}, HyperlinkAddedDisplayType = "hyperlinkAdded", HyperlinkModifiedDisplayType = "hyperlinkModified", getMarkSnapshots = (attrs = {}) => {
|
|
208006
|
+
return {
|
|
208007
|
+
before: Array.isArray(attrs.before) ? attrs.before : [],
|
|
208008
|
+
after: Array.isArray(attrs.after) ? attrs.after : []
|
|
208009
|
+
};
|
|
208010
|
+
}, findSnapshotByType = (snapshots, type) => {
|
|
208011
|
+
return snapshots.find((snapshot2) => snapshot2?.type === type) ?? null;
|
|
208012
|
+
}, getNodeText = (nodes = []) => {
|
|
208013
|
+
return nodes.map((node3) => node3?.text || node3?.textContent || "").join("").trim();
|
|
208014
|
+
}, getHyperlinkTarget = (linkSnapshot) => {
|
|
208015
|
+
const href = linkSnapshot?.attrs?.href;
|
|
208016
|
+
if (typeof href === "string" && href.trim().length > 0)
|
|
208017
|
+
return href.trim();
|
|
208018
|
+
const anchor = linkSnapshot?.attrs?.anchor;
|
|
208019
|
+
if (typeof anchor === "string" && anchor.trim().length > 0)
|
|
208020
|
+
return `#${anchor.trim()}`;
|
|
208021
|
+
return null;
|
|
208022
|
+
}, getLiveLinkMark = (nodes = []) => {
|
|
208023
|
+
for (const node3 of nodes) {
|
|
208024
|
+
const linkMark = node3?.marks?.find((mark2) => mark2?.type?.name === "link");
|
|
208025
|
+
if (linkMark)
|
|
208026
|
+
return linkMark;
|
|
208027
|
+
}
|
|
208028
|
+
return null;
|
|
208029
|
+
}, getHyperlinkLabel = ({ linkSnapshot, nodes }) => {
|
|
208030
|
+
return getHyperlinkTarget(linkSnapshot) || (typeof linkSnapshot?.attrs?.text === "string" && linkSnapshot.attrs.text.trim().length > 0 ? linkSnapshot.attrs.text.trim() : null) || getNodeText(nodes);
|
|
208031
|
+
}, getAddedMarkTypes = ({ before, after }) => {
|
|
208032
|
+
const beforeTypes = new Set(before.map((snapshot2) => snapshot2?.type).filter(Boolean));
|
|
208033
|
+
return [...new Set(after.map((snapshot2) => snapshot2?.type).filter(Boolean))].filter((type) => !beforeTypes.has(type));
|
|
208034
|
+
}, getRemovedMarkTypes = ({ before, after }) => {
|
|
208035
|
+
const beforeTypes = new Set(before.map((snapshot2) => snapshot2?.type).filter(Boolean));
|
|
208036
|
+
const afterTypes = new Set(after.map((snapshot2) => snapshot2?.type).filter(Boolean));
|
|
208037
|
+
return [...beforeTypes].filter((type) => !afterTypes.has(type));
|
|
208038
|
+
}, isUnderlineOnlyFormatDelta = ({ before, after }) => {
|
|
208039
|
+
const addedTypes = getAddedMarkTypes({
|
|
208040
|
+
before,
|
|
208041
|
+
after
|
|
208042
|
+
});
|
|
208043
|
+
return getRemovedMarkTypes({
|
|
208044
|
+
before,
|
|
208045
|
+
after
|
|
208046
|
+
}).length === 0 && addedTypes.length === 1 && addedTypes[0] === "underline";
|
|
208047
|
+
}, snapshotAttrsEqual = (a2, b$1) => {
|
|
208048
|
+
if (a2 === b$1)
|
|
208049
|
+
return true;
|
|
208050
|
+
if (!a2 || !b$1)
|
|
208051
|
+
return false;
|
|
208052
|
+
const keysA = Object.keys(a2);
|
|
208053
|
+
const keysB = Object.keys(b$1);
|
|
208054
|
+
if (keysA.length !== keysB.length)
|
|
208055
|
+
return false;
|
|
208056
|
+
return keysA.every((key$1) => {
|
|
208057
|
+
const valA = a2[key$1];
|
|
208058
|
+
const valB = b$1[key$1];
|
|
208059
|
+
if (valA == null && valB == null)
|
|
208060
|
+
return true;
|
|
208061
|
+
return valA === valB;
|
|
208062
|
+
});
|
|
208063
|
+
}, resolveTrackedFormatDisplay = ({ attrs = {}, nodes = [] }) => {
|
|
208064
|
+
const { before, after } = getMarkSnapshots(attrs);
|
|
208065
|
+
const beforeLink = findSnapshotByType(before, "link");
|
|
208066
|
+
const afterLink = findSnapshotByType(after, "link");
|
|
208067
|
+
const inferredLiveLink = !beforeLink && !afterLink && isUnderlineOnlyFormatDelta({
|
|
208068
|
+
before,
|
|
208069
|
+
after
|
|
208070
|
+
}) ? getLiveLinkMark(nodes) : null;
|
|
208071
|
+
const addedLink = afterLink || inferredLiveLink;
|
|
208072
|
+
if (beforeLink && addedLink) {
|
|
208073
|
+
if (snapshotAttrsEqual(beforeLink.attrs, addedLink.attrs))
|
|
208074
|
+
return {
|
|
208075
|
+
trackedChangeDisplayType: null,
|
|
208076
|
+
trackedChangeText: ""
|
|
208077
|
+
};
|
|
208078
|
+
const trackedChangeText$1 = getHyperlinkLabel({
|
|
208079
|
+
linkSnapshot: addedLink,
|
|
208080
|
+
nodes
|
|
208081
|
+
});
|
|
208082
|
+
if (!trackedChangeText$1)
|
|
208083
|
+
return null;
|
|
208084
|
+
return {
|
|
208085
|
+
trackedChangeDisplayType: HyperlinkModifiedDisplayType,
|
|
208086
|
+
trackedChangeText: trackedChangeText$1
|
|
208087
|
+
};
|
|
208088
|
+
}
|
|
208089
|
+
if (!addedLink)
|
|
208090
|
+
return null;
|
|
208091
|
+
const trackedChangeText = getHyperlinkLabel({
|
|
208092
|
+
linkSnapshot: addedLink,
|
|
208093
|
+
nodes
|
|
208094
|
+
});
|
|
208095
|
+
if (!trackedChangeText)
|
|
208096
|
+
return null;
|
|
208097
|
+
return {
|
|
208098
|
+
trackedChangeDisplayType: HyperlinkAddedDisplayType,
|
|
208099
|
+
trackedChangeText
|
|
208100
|
+
};
|
|
207936
208101
|
}, normalizeCommentEventPayload = ({ conversation, editorOptions, fallbackCommentId, fallbackInternal }) => {
|
|
207937
208102
|
const { user, documentId } = editorOptions || {};
|
|
207938
208103
|
const normalized = {
|
|
@@ -208164,6 +208329,7 @@ var Node$13 = class Node$14 {
|
|
|
208164
208329
|
}, getTrackedChangeText = ({ nodes, mark: mark2, trackedChangeType, isDeletionInsertion }) => {
|
|
208165
208330
|
let trackedChangeText = "";
|
|
208166
208331
|
let deletionText = "";
|
|
208332
|
+
let trackedChangeDisplayType = null;
|
|
208167
208333
|
if (trackedChangeType === "trackDelete" || isDeletionInsertion)
|
|
208168
208334
|
deletionText = nodes.reduce((acc, node3) => {
|
|
208169
208335
|
if (!node3.marks.find((nodeMark) => nodeMark.type.name === "trackDelete"))
|
|
@@ -208180,27 +208346,43 @@ var Node$13 = class Node$14 {
|
|
|
208180
208346
|
acc += nodeText;
|
|
208181
208347
|
return acc;
|
|
208182
208348
|
}, "");
|
|
208183
|
-
if (trackedChangeType === "trackFormat")
|
|
208184
|
-
|
|
208349
|
+
if (trackedChangeType === "trackFormat") {
|
|
208350
|
+
const normalizedFormatAttrs = normalizeFormatAttrsForCommentText(mark2.attrs, nodes);
|
|
208351
|
+
const trackedFormatDisplay = resolveTrackedFormatDisplay({
|
|
208352
|
+
attrs: normalizedFormatAttrs,
|
|
208353
|
+
nodes
|
|
208354
|
+
});
|
|
208355
|
+
if (trackedFormatDisplay) {
|
|
208356
|
+
trackedChangeText = trackedFormatDisplay.trackedChangeText;
|
|
208357
|
+
trackedChangeDisplayType = trackedFormatDisplay.trackedChangeDisplayType;
|
|
208358
|
+
} else
|
|
208359
|
+
trackedChangeText = translateFormatChangesToEnglish(normalizedFormatAttrs);
|
|
208360
|
+
}
|
|
208185
208361
|
return {
|
|
208186
208362
|
deletionText,
|
|
208187
|
-
trackedChangeText
|
|
208363
|
+
trackedChangeText,
|
|
208364
|
+
trackedChangeDisplayType
|
|
208188
208365
|
};
|
|
208189
208366
|
}, createOrUpdateTrackedChangeComment = ({ event, marks, deletionNodes, nodes, newEditorState, documentId, trackedChangesForId }) => {
|
|
208190
|
-
const
|
|
208367
|
+
const node3 = nodes[0];
|
|
208368
|
+
const fallbackTrackedMark = marks.insertedMark || marks.deletionMark || marks.formatMark;
|
|
208369
|
+
if (!fallbackTrackedMark)
|
|
208370
|
+
return;
|
|
208371
|
+
const fallbackTrackedMarkId = fallbackTrackedMark.attrs?.id;
|
|
208372
|
+
const trackedChangesWithId = trackedChangesForId || getTrackChanges(newEditorState, fallbackTrackedMarkId);
|
|
208373
|
+
const liveFormatMark = trackedChangesWithId.find(({ mark: mark2 }) => mark2.type.name === "trackFormat")?.mark ?? null;
|
|
208374
|
+
const trackedMark = marks.insertedMark || marks.deletionMark || liveFormatMark || marks.formatMark;
|
|
208191
208375
|
const { type, attrs } = trackedMark;
|
|
208192
208376
|
const { name: trackedChangeType } = type;
|
|
208193
208377
|
const { author, authorEmail, authorImage, date, importedAuthor } = attrs;
|
|
208194
208378
|
const id2 = attrs.id;
|
|
208195
|
-
const node3 = nodes[0];
|
|
208196
|
-
const trackedChangesWithId = trackedChangesForId || getTrackChanges(newEditorState, id2);
|
|
208197
208379
|
let isDeletionInsertion = !!(marks.insertedMark && marks.deletionMark);
|
|
208198
208380
|
if (!isDeletionInsertion) {
|
|
208199
208381
|
const hasInsertMark = trackedChangesWithId.some(({ mark: mark2 }) => mark2.type.name === TrackInsertMarkName);
|
|
208200
208382
|
const hasDeleteMark = trackedChangesWithId.some(({ mark: mark2 }) => mark2.type.name === TrackDeleteMarkName);
|
|
208201
208383
|
isDeletionInsertion = hasInsertMark && hasDeleteMark;
|
|
208202
208384
|
}
|
|
208203
|
-
|
|
208385
|
+
const nodesWithMark = [];
|
|
208204
208386
|
trackedChangesWithId.forEach(({ from: from$1, to }) => {
|
|
208205
208387
|
newEditorState.doc.nodesBetween(from$1, to, (node$1) => {
|
|
208206
208388
|
if (node$1.isText) {
|
|
@@ -208221,8 +208403,7 @@ var Node$13 = class Node$14 {
|
|
|
208221
208403
|
nodesToUse = nodesWithMark.length ? nodesWithMark : node3 ? [node3] : [];
|
|
208222
208404
|
if (!nodesToUse.length)
|
|
208223
208405
|
return;
|
|
208224
|
-
const { deletionText, trackedChangeText } = getTrackedChangeText({
|
|
208225
|
-
state: newEditorState,
|
|
208406
|
+
const { deletionText, trackedChangeText, trackedChangeDisplayType } = getTrackedChangeText({
|
|
208226
208407
|
nodes: nodesToUse,
|
|
208227
208408
|
mark: trackedMark,
|
|
208228
208409
|
trackedChangeType,
|
|
@@ -208238,6 +208419,7 @@ var Node$13 = class Node$14 {
|
|
|
208238
208419
|
changeId: id2,
|
|
208239
208420
|
trackedChangeType: isDeletionInsertion ? "both" : trackedChangeType,
|
|
208240
208421
|
trackedChangeText,
|
|
208422
|
+
trackedChangeDisplayType,
|
|
208241
208423
|
deletedText: marks.deletionMark ? deletionText : null,
|
|
208242
208424
|
author,
|
|
208243
208425
|
authorEmail,
|
|
@@ -208570,14 +208752,7 @@ var Node$13 = class Node$14 {
|
|
|
208570
208752
|
const existingChangeMark = liveMarks.find((mark2) => [TrackDeleteMarkName, TrackFormatMarkName].includes(mark2.type.name));
|
|
208571
208753
|
const wid = existingChangeMark ? existingChangeMark.attrs.id : sharedWid ?? (sharedWid = v4_default());
|
|
208572
208754
|
newTr.addMark(Math.max(step3.from, pos), Math.min(step3.to, pos + node3.nodeSize), step3.mark);
|
|
208573
|
-
if (
|
|
208574
|
-
"bold",
|
|
208575
|
-
"italic",
|
|
208576
|
-
"strike",
|
|
208577
|
-
"underline",
|
|
208578
|
-
"textStyle",
|
|
208579
|
-
"highlight"
|
|
208580
|
-
].includes(step3.mark.type.name) && !hasMatchingMark(liveMarks, step3.mark)) {
|
|
208755
|
+
if (TrackedFormatMarkNames.includes(step3.mark.type.name) && !hasMatchingMark(liveMarks, step3.mark)) {
|
|
208581
208756
|
const formatChangeMark = liveMarks.find((mark2) => mark2.type.name === TrackFormatMarkName);
|
|
208582
208757
|
let after = [];
|
|
208583
208758
|
let before = [];
|
|
@@ -208643,14 +208818,7 @@ var Node$13 = class Node$14 {
|
|
|
208643
208818
|
to: rangeTo
|
|
208644
208819
|
});
|
|
208645
208820
|
newTr.removeMark(Math.max(step3.from, pos), Math.min(step3.to, pos + node3.nodeSize), step3.mark);
|
|
208646
|
-
if (
|
|
208647
|
-
"bold",
|
|
208648
|
-
"italic",
|
|
208649
|
-
"strike",
|
|
208650
|
-
"underline",
|
|
208651
|
-
"textStyle",
|
|
208652
|
-
"highlight"
|
|
208653
|
-
].includes(step3.mark.type.name) && hasMatchingMark(liveMarksBeforeRemove, step3.mark)) {
|
|
208821
|
+
if (TrackedFormatMarkNames.includes(step3.mark.type.name) && hasMatchingMark(liveMarksBeforeRemove, step3.mark)) {
|
|
208654
208822
|
const formatChangeMark = liveMarksBeforeRemove.find((mark2) => mark2.type.name === TrackFormatMarkName);
|
|
208655
208823
|
let after = [];
|
|
208656
208824
|
let before = [];
|
|
@@ -215503,11 +215671,25 @@ var Node$13 = class Node$14 {
|
|
|
215503
215671
|
console.warn(`[DomPainter] Failed to set data attribute "${key$1}":`, error);
|
|
215504
215672
|
}
|
|
215505
215673
|
});
|
|
215674
|
+
}, resolveParagraphDirection = (attrs) => {
|
|
215675
|
+
if (attrs?.direction)
|
|
215676
|
+
return attrs.direction;
|
|
215677
|
+
if (attrs?.rtl === true)
|
|
215678
|
+
return "rtl";
|
|
215679
|
+
if (attrs?.rtl === false)
|
|
215680
|
+
return "ltr";
|
|
215681
|
+
}, applyParagraphDirection = (element3, attrs) => {
|
|
215682
|
+
const direction = resolveParagraphDirection(attrs);
|
|
215683
|
+
if (!direction)
|
|
215684
|
+
return;
|
|
215685
|
+
element3.setAttribute("dir", direction);
|
|
215686
|
+
element3.style.direction = direction;
|
|
215506
215687
|
}, applyParagraphBlockStyles = (element3, attrs) => {
|
|
215507
215688
|
if (!attrs)
|
|
215508
215689
|
return;
|
|
215509
215690
|
if (attrs.styleId)
|
|
215510
215691
|
element3.setAttribute("styleid", attrs.styleId);
|
|
215692
|
+
applyParagraphDirection(element3, attrs);
|
|
215511
215693
|
if (attrs.alignment)
|
|
215512
215694
|
element3.style.textAlign = attrs.alignment === "justify" ? "left" : attrs.alignment;
|
|
215513
215695
|
if (attrs.dropCap)
|
|
@@ -216507,6 +216689,7 @@ var Node$13 = class Node$14 {
|
|
|
216507
216689
|
const paragraphDecimalSeparator = DEFAULT_DECIMAL_SEPARATOR;
|
|
216508
216690
|
const tabIntervalTwips = DEFAULT_TAB_INTERVAL_TWIPS$1;
|
|
216509
216691
|
const normalizedFramePr = normalizeFramePr(resolvedParagraphProperties.framePr);
|
|
216692
|
+
const normalizedDirection = resolvedParagraphProperties.rightToLeft === true ? "rtl" : resolvedParagraphProperties.rightToLeft === false ? "ltr" : undefined;
|
|
216510
216693
|
const floatAlignment = normalizedFramePr?.xAlign;
|
|
216511
216694
|
const normalizedNumberingProperties = normalizeNumberingProperties(resolvedParagraphProperties.numberingProperties);
|
|
216512
216695
|
const dropCapDescriptor = normalizeDropCap(resolvedParagraphProperties.framePr, para, converterContext);
|
|
@@ -216529,7 +216712,8 @@ var Node$13 = class Node$14 {
|
|
|
216529
216712
|
keepLines: resolvedParagraphProperties.keepLines,
|
|
216530
216713
|
floatAlignment,
|
|
216531
216714
|
pageBreakBefore: resolvedParagraphProperties.pageBreakBefore,
|
|
216532
|
-
direction:
|
|
216715
|
+
direction: normalizedDirection,
|
|
216716
|
+
rtl: normalizedDirection === "rtl" ? true : normalizedDirection === "ltr" ? false : undefined
|
|
216533
216717
|
};
|
|
216534
216718
|
if (normalizedNumberingProperties && normalizedListRendering) {
|
|
216535
216719
|
const markerRunAttrs = computeRunAttrs(resolveRunProperties(converterContext, resolvedParagraphProperties.runProperties, resolvedParagraphProperties, converterContext.tableInfo, true, Boolean(paragraphProperties.numberingProperties)), converterContext);
|
|
@@ -223762,9 +223946,13 @@ var Node$13 = class Node$14 {
|
|
|
223762
223946
|
width: measurementWidth,
|
|
223763
223947
|
height,
|
|
223764
223948
|
pageWidth: pageSize.w,
|
|
223949
|
+
pageHeight: pageSize.h,
|
|
223765
223950
|
margins: {
|
|
223766
223951
|
left: marginLeft,
|
|
223767
|
-
right: marginRight
|
|
223952
|
+
right: marginRight,
|
|
223953
|
+
top: marginTop,
|
|
223954
|
+
bottom: marginBottom,
|
|
223955
|
+
header: headerMargin
|
|
223768
223956
|
},
|
|
223769
223957
|
overflowBaseHeight
|
|
223770
223958
|
};
|
|
@@ -229098,9 +229286,9 @@ var Node$13 = class Node$14 {
|
|
|
229098
229286
|
return false;
|
|
229099
229287
|
return Boolean(checker(attrs));
|
|
229100
229288
|
}, SuperToolbar, ICONS, TEXTS, tableActionsOptions;
|
|
229101
|
-
var
|
|
229289
|
+
var init_src_BeJRbQ1S_es = __esm(() => {
|
|
229102
229290
|
init_rolldown_runtime_B2q5OVn9_es();
|
|
229103
|
-
|
|
229291
|
+
init_SuperConverter_DvkQFRg9_es();
|
|
229104
229292
|
init_jszip_ChlR43oI_es();
|
|
229105
229293
|
init_uuid_qzgm05fK_es();
|
|
229106
229294
|
init_constants_ep1_Gwqi_es();
|
|
@@ -243529,7 +243717,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
243529
243717
|
this.renderDecorationSection(pageEl, page, pageIndex, "header");
|
|
243530
243718
|
this.renderDecorationSection(pageEl, page, pageIndex, "footer");
|
|
243531
243719
|
}
|
|
243532
|
-
|
|
243720
|
+
isPageRelativeAnchoredFragment(fragment2) {
|
|
243533
243721
|
if (fragment2.kind !== "image" && fragment2.kind !== "drawing")
|
|
243534
243722
|
return false;
|
|
243535
243723
|
const lookup3 = this.blockLookup.get(fragment2.blockId);
|
|
@@ -243540,6 +243728,18 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
243540
243728
|
return false;
|
|
243541
243729
|
return block.anchor?.vRelativeFrom === "page";
|
|
243542
243730
|
}
|
|
243731
|
+
getDecorationAnchorPageOriginY(pageEl, page, kind, effectiveOffset) {
|
|
243732
|
+
if (kind === "header")
|
|
243733
|
+
return effectiveOffset;
|
|
243734
|
+
const bottomMargin = page.margins?.bottom;
|
|
243735
|
+
if (bottomMargin == null)
|
|
243736
|
+
return effectiveOffset;
|
|
243737
|
+
const footnoteReserve = page.footnoteReserved ?? 0;
|
|
243738
|
+
const adjustedBottomMargin = Math.max(0, bottomMargin - footnoteReserve);
|
|
243739
|
+
const styledPageHeight = Number.parseFloat(pageEl.style.height || "");
|
|
243740
|
+
const pageHeight = page.size?.h ?? this.currentLayout?.pageSize?.h ?? (Number.isFinite(styledPageHeight) ? styledPageHeight : pageEl.clientHeight);
|
|
243741
|
+
return Math.max(0, pageHeight - adjustedBottomMargin);
|
|
243742
|
+
}
|
|
243543
243743
|
renderDecorationSection(pageEl, page, pageIndex, kind) {
|
|
243544
243744
|
if (!this.doc)
|
|
243545
243745
|
return;
|
|
@@ -243574,6 +243774,8 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
243574
243774
|
container.style.top = `${Math.max(0, effectiveOffset)}px`;
|
|
243575
243775
|
container.style.zIndex = "1";
|
|
243576
243776
|
container.style.overflow = "visible";
|
|
243777
|
+
const footerAnchorPageOriginY = kind === "footer" ? this.getDecorationAnchorPageOriginY(pageEl, page, kind, effectiveOffset) : 0;
|
|
243778
|
+
const footerAnchorContainerOffsetY = kind === "footer" ? footerAnchorPageOriginY - effectiveOffset : 0;
|
|
243577
243779
|
let footerYOffset = 0;
|
|
243578
243780
|
if (kind === "footer" && data.fragments.length > 0) {
|
|
243579
243781
|
const contentHeight = typeof data.contentHeight === "number" ? data.contentHeight : data.fragments.reduce((max$2, f2) => {
|
|
@@ -243612,7 +243814,14 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
243612
243814
|
pageEl.querySelectorAll(behindDocSelector).forEach((el) => el.remove());
|
|
243613
243815
|
behindDocFragments.forEach(({ fragment: fragment2, originalIndex }) => {
|
|
243614
243816
|
const fragEl = this.renderFragment(fragment2, context, undefined, betweenBorderFlags.get(originalIndex));
|
|
243615
|
-
const
|
|
243817
|
+
const isPageRelative = this.isPageRelativeAnchoredFragment(fragment2);
|
|
243818
|
+
let pageY;
|
|
243819
|
+
if (isPageRelative && kind === "footer")
|
|
243820
|
+
pageY = footerAnchorPageOriginY + fragment2.y;
|
|
243821
|
+
else if (isPageRelative)
|
|
243822
|
+
pageY = fragment2.y;
|
|
243823
|
+
else
|
|
243824
|
+
pageY = effectiveOffset + fragment2.y + (kind === "footer" ? footerYOffset : 0);
|
|
243616
243825
|
fragEl.style.top = `${pageY}px`;
|
|
243617
243826
|
fragEl.style.left = `${marginLeft + fragment2.x}px`;
|
|
243618
243827
|
fragEl.style.zIndex = "0";
|
|
@@ -243621,10 +243830,12 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
243621
243830
|
});
|
|
243622
243831
|
normalFragments.forEach(({ fragment: fragment2, originalIndex }) => {
|
|
243623
243832
|
const fragEl = this.renderFragment(fragment2, context, undefined, betweenBorderFlags.get(originalIndex));
|
|
243624
|
-
const
|
|
243625
|
-
if (
|
|
243833
|
+
const isPageRelative = this.isPageRelativeAnchoredFragment(fragment2);
|
|
243834
|
+
if (isPageRelative && kind === "footer")
|
|
243835
|
+
fragEl.style.top = `${fragment2.y + footerAnchorContainerOffsetY}px`;
|
|
243836
|
+
else if (isPageRelative)
|
|
243626
243837
|
fragEl.style.top = `${fragment2.y - effectiveOffset}px`;
|
|
243627
|
-
if (footerYOffset > 0
|
|
243838
|
+
else if (footerYOffset > 0) {
|
|
243628
243839
|
const currentTop = parseFloat(fragEl.style.top) || fragment2.y;
|
|
243629
243840
|
fragEl.style.top = `${currentTop + footerYOffset}px`;
|
|
243630
243841
|
}
|
|
@@ -245449,10 +245660,12 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
245449
245660
|
el.classList.add(CLASS_NAMES$1.line);
|
|
245450
245661
|
applyStyles$1(el, lineStyles(line.lineHeight));
|
|
245451
245662
|
el.dataset.layoutEpoch = String(this.layoutEpoch);
|
|
245452
|
-
const
|
|
245663
|
+
const paragraphAttrs = block.attrs ?? {};
|
|
245664
|
+
const styleId = paragraphAttrs.styleId;
|
|
245453
245665
|
if (styleId)
|
|
245454
245666
|
el.setAttribute("styleid", styleId);
|
|
245455
|
-
|
|
245667
|
+
applyParagraphDirection(el, paragraphAttrs);
|
|
245668
|
+
const alignment$1 = paragraphAttrs.alignment;
|
|
245456
245669
|
if (alignment$1 === "center" || alignment$1 === "right")
|
|
245457
245670
|
el.style.textAlign = alignment$1;
|
|
245458
245671
|
else
|
|
@@ -250033,9 +250246,13 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
250033
250246
|
width: measurementWidth,
|
|
250034
250247
|
height,
|
|
250035
250248
|
pageWidth: pageSize.w,
|
|
250249
|
+
pageHeight: pageSize.h,
|
|
250036
250250
|
margins: {
|
|
250037
250251
|
left: marginLeft,
|
|
250038
|
-
right: marginRight
|
|
250252
|
+
right: marginRight,
|
|
250253
|
+
top: marginTop,
|
|
250254
|
+
bottom: marginBottom,
|
|
250255
|
+
header: headerMargin
|
|
250039
250256
|
},
|
|
250040
250257
|
overflowBaseHeight
|
|
250041
250258
|
};
|
|
@@ -262432,8 +262649,8 @@ var init_zipper_DqXT7uTa_es = __esm(() => {
|
|
|
262432
262649
|
|
|
262433
262650
|
// ../../packages/superdoc/dist/super-editor.es.js
|
|
262434
262651
|
var init_super_editor_es = __esm(() => {
|
|
262435
|
-
|
|
262436
|
-
|
|
262652
|
+
init_src_BeJRbQ1S_es();
|
|
262653
|
+
init_SuperConverter_DvkQFRg9_es();
|
|
262437
262654
|
init_jszip_ChlR43oI_es();
|
|
262438
262655
|
init_xml_js_BtmJ6bNs_es();
|
|
262439
262656
|
init_constants_ep1_Gwqi_es();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superdoc-dev/cli",
|
|
3
|
-
"version": "0.3.0-next.
|
|
3
|
+
"version": "0.3.0-next.49",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"superdoc": "./dist/index.js"
|
|
@@ -20,21 +20,21 @@
|
|
|
20
20
|
"@types/bun": "^1.3.8",
|
|
21
21
|
"@types/node": "22.19.2",
|
|
22
22
|
"typescript": "^5.9.2",
|
|
23
|
+
"@superdoc/document-api": "0.0.1",
|
|
23
24
|
"@superdoc/pm-adapter": "0.0.0",
|
|
24
25
|
"@superdoc/super-editor": "0.0.1",
|
|
25
|
-
"superdoc": "1.20.0"
|
|
26
|
-
"@superdoc/document-api": "0.0.1"
|
|
26
|
+
"superdoc": "1.20.0"
|
|
27
27
|
},
|
|
28
28
|
"module": "src/index.ts",
|
|
29
29
|
"publishConfig": {
|
|
30
30
|
"access": "public"
|
|
31
31
|
},
|
|
32
32
|
"optionalDependencies": {
|
|
33
|
-
"@superdoc-dev/cli-darwin-arm64": "0.3.0-next.
|
|
34
|
-
"@superdoc-dev/cli-
|
|
35
|
-
"@superdoc-dev/cli-
|
|
36
|
-
"@superdoc-dev/cli-linux-arm64": "0.3.0-next.
|
|
37
|
-
"@superdoc-dev/cli-windows-x64": "0.3.0-next.
|
|
33
|
+
"@superdoc-dev/cli-darwin-arm64": "0.3.0-next.49",
|
|
34
|
+
"@superdoc-dev/cli-darwin-x64": "0.3.0-next.49",
|
|
35
|
+
"@superdoc-dev/cli-linux-x64": "0.3.0-next.49",
|
|
36
|
+
"@superdoc-dev/cli-linux-arm64": "0.3.0-next.49",
|
|
37
|
+
"@superdoc-dev/cli-windows-x64": "0.3.0-next.49"
|
|
38
38
|
},
|
|
39
39
|
"scripts": {
|
|
40
40
|
"predev": "node scripts/ensure-superdoc-build.js",
|