@superdoc-dev/cli 0.8.0-next.11 → 0.8.0-next.12
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 +450 -844
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -65535,7 +65535,7 @@ var init_remark_gfm_BhnWr3yf_es = __esm(() => {
|
|
|
65535
65535
|
emptyOptions2 = {};
|
|
65536
65536
|
});
|
|
65537
65537
|
|
|
65538
|
-
// ../../packages/superdoc/dist/chunks/SuperConverter-
|
|
65538
|
+
// ../../packages/superdoc/dist/chunks/SuperConverter-D54XfHFt.es.js
|
|
65539
65539
|
function getExtensionConfigField(extension$1, field, context = { name: "" }) {
|
|
65540
65540
|
const fieldValue = extension$1.config[field];
|
|
65541
65541
|
if (typeof fieldValue === "function")
|
|
@@ -95679,6 +95679,11 @@ function createStoryEditor(parentEditor, content$2, options = {}) {
|
|
|
95679
95679
|
fragment: null,
|
|
95680
95680
|
...editorOptions
|
|
95681
95681
|
});
|
|
95682
|
+
const inheritedPresentationEditor = parentEditor.presentationEditor ?? parentEditor._presentationEditor ?? null;
|
|
95683
|
+
if (inheritedPresentationEditor) {
|
|
95684
|
+
storyEditor.presentationEditor = inheritedPresentationEditor;
|
|
95685
|
+
storyEditor._presentationEditor = inheritedPresentationEditor;
|
|
95686
|
+
}
|
|
95682
95687
|
if (storyEditor.options && typeof storyEditor.options === "object")
|
|
95683
95688
|
Object.defineProperty(storyEditor.options, "parentEditor", {
|
|
95684
95689
|
enumerable: false,
|
|
@@ -99742,6 +99747,17 @@ function resolveLiveStorySessionRuntime(hostEditor, storyKey) {
|
|
|
99742
99747
|
return null;
|
|
99743
99748
|
return buildLiveSessionRuntime(registration);
|
|
99744
99749
|
}
|
|
99750
|
+
function commitLiveStorySessionRuntimes(hostEditor) {
|
|
99751
|
+
const sessions = liveSessionsByHost.get(hostEditor);
|
|
99752
|
+
if (!sessions || sessions.size === 0)
|
|
99753
|
+
return 0;
|
|
99754
|
+
let committedCount = 0;
|
|
99755
|
+
for (const registration of [...sessions.values()]) {
|
|
99756
|
+
buildLiveSessionRuntime(registration).commit?.(hostEditor);
|
|
99757
|
+
committedCount += 1;
|
|
99758
|
+
}
|
|
99759
|
+
return committedCount;
|
|
99760
|
+
}
|
|
99745
99761
|
function unregisterLiveStorySessionRuntime(hostEditor, storyKey, editor) {
|
|
99746
99762
|
const sessions = liveSessionsByHost.get(hostEditor);
|
|
99747
99763
|
if (!sessions)
|
|
@@ -117714,7 +117730,7 @@ var isRegExp = (value) => {
|
|
|
117714
117730
|
state.kern = kernNode.attributes["w:val"];
|
|
117715
117731
|
}
|
|
117716
117732
|
}, SuperConverter;
|
|
117717
|
-
var
|
|
117733
|
+
var init_SuperConverter_D54XfHFt_es = __esm(() => {
|
|
117718
117734
|
init_rolldown_runtime_Bg48TavK_es();
|
|
117719
117735
|
init_jszip_C49i9kUs_es();
|
|
117720
117736
|
init_xml_js_CqGKpaft_es();
|
|
@@ -155130,7 +155146,7 @@ var init_SuperConverter_XXBr0N8c_es = __esm(() => {
|
|
|
155130
155146
|
};
|
|
155131
155147
|
});
|
|
155132
155148
|
|
|
155133
|
-
// ../../packages/superdoc/dist/chunks/create-headless-toolbar-
|
|
155149
|
+
// ../../packages/superdoc/dist/chunks/create-headless-toolbar-DrE9IMiD.es.js
|
|
155134
155150
|
function parseSizeUnit(val = "0") {
|
|
155135
155151
|
const length3 = val.toString() || "0";
|
|
155136
155152
|
const value = Number.parseFloat(length3);
|
|
@@ -157722,8 +157738,8 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, Extension = class Extension2 {
|
|
|
157722
157738
|
}
|
|
157723
157739
|
};
|
|
157724
157740
|
};
|
|
157725
|
-
var
|
|
157726
|
-
|
|
157741
|
+
var init_create_headless_toolbar_DrE9IMiD_es = __esm(() => {
|
|
157742
|
+
init_SuperConverter_D54XfHFt_es();
|
|
157727
157743
|
init_constants_CGhJRd87_es();
|
|
157728
157744
|
init_dist_B8HfvhaK_es();
|
|
157729
157745
|
CSS_DIMENSION_REGEX = /[\d-.]+(\w+)$/;
|
|
@@ -206410,7 +206426,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
|
|
|
206410
206426
|
init_remark_gfm_BhnWr3yf_es();
|
|
206411
206427
|
});
|
|
206412
206428
|
|
|
206413
|
-
// ../../packages/superdoc/dist/chunks/src-
|
|
206429
|
+
// ../../packages/superdoc/dist/chunks/src-BFNW1Ck5.es.js
|
|
206414
206430
|
function deleteProps(obj, propOrProps) {
|
|
206415
206431
|
const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
|
|
206416
206432
|
const removeNested = (target, pathParts, index2 = 0) => {
|
|
@@ -207989,7 +208005,8 @@ function getEditorSurfaceElement(editor) {
|
|
|
207989
208005
|
return null;
|
|
207990
208006
|
if (typeof editor.hitTest === "function" && editor.element instanceof HTMLElement)
|
|
207991
208007
|
return editor.element;
|
|
207992
|
-
|
|
208008
|
+
const parentEditor = editor.options?.parentEditor ?? null;
|
|
208009
|
+
return (editor.presentationEditor ?? parentEditor?.presentationEditor ?? parentEditor?._presentationEditor ?? null)?.element ?? editor.view?.dom ?? editor.options?.element ?? null;
|
|
207993
208010
|
}
|
|
207994
208011
|
function getSurfaceRelativePoint(editor, eventLocation = {}) {
|
|
207995
208012
|
const surface = getEditorSurfaceElement(editor);
|
|
@@ -249413,30 +249430,6 @@ function assertRequiredBlockMeasurePair(label, blocks2, measures) {
|
|
|
249413
249430
|
if (blocks2.length !== measures.length)
|
|
249414
249431
|
throw new Error(`${label} blocks and measures must have the same length.`);
|
|
249415
249432
|
}
|
|
249416
|
-
function normalizeRequiredBlockMeasurePair(label, blocks2, measures) {
|
|
249417
|
-
if (!Array.isArray(blocks2) || !Array.isArray(measures))
|
|
249418
|
-
throw new Error("DomPainterInput requires body blocks and measures; resolved-layout-only input is not supported.");
|
|
249419
|
-
assertRequiredBlockMeasurePair(label, blocks2, measures);
|
|
249420
|
-
return {
|
|
249421
|
-
blocks: blocks2,
|
|
249422
|
-
measures
|
|
249423
|
-
};
|
|
249424
|
-
}
|
|
249425
|
-
function normalizeOptionalBlockMeasurePair(label, blocks2, measures) {
|
|
249426
|
-
const hasBlocks = blocks2 !== undefined;
|
|
249427
|
-
const hasMeasures = measures !== undefined;
|
|
249428
|
-
if (hasBlocks !== hasMeasures)
|
|
249429
|
-
throw new Error(`${label}Blocks and ${label}Measures must both be provided or both be omitted.`);
|
|
249430
|
-
if (!hasBlocks || !hasMeasures)
|
|
249431
|
-
return;
|
|
249432
|
-
if (!Array.isArray(blocks2) || !Array.isArray(measures))
|
|
249433
|
-
throw new Error(`${label}Blocks and ${label}Measures must be arrays when provided.`);
|
|
249434
|
-
assertRequiredBlockMeasurePair(label, blocks2, measures);
|
|
249435
|
-
return {
|
|
249436
|
-
blocks: blocks2,
|
|
249437
|
-
measures
|
|
249438
|
-
};
|
|
249439
|
-
}
|
|
249440
249433
|
function createEmptyResolvedLayout(flowMode, pageGap) {
|
|
249441
249434
|
return {
|
|
249442
249435
|
version: 1,
|
|
@@ -249445,25 +249438,8 @@ function createEmptyResolvedLayout(flowMode, pageGap) {
|
|
|
249445
249438
|
pages: []
|
|
249446
249439
|
};
|
|
249447
249440
|
}
|
|
249448
|
-
function
|
|
249449
|
-
return "
|
|
249450
|
-
}
|
|
249451
|
-
function normalizeDomPainterInput(input2) {
|
|
249452
|
-
if (!input2.resolvedLayout || !input2.sourceLayout)
|
|
249453
|
-
throw new Error("DomPainterInput requires resolvedLayout and sourceLayout.");
|
|
249454
|
-
const body = normalizeRequiredBlockMeasurePair("body", input2.blocks, input2.measures);
|
|
249455
|
-
const header = normalizeOptionalBlockMeasurePair("header", input2.headerBlocks, input2.headerMeasures);
|
|
249456
|
-
const footer = normalizeOptionalBlockMeasurePair("footer", input2.footerBlocks, input2.footerMeasures);
|
|
249457
|
-
return {
|
|
249458
|
-
resolvedLayout: input2.resolvedLayout,
|
|
249459
|
-
sourceLayout: input2.sourceLayout,
|
|
249460
|
-
blocks: body.blocks,
|
|
249461
|
-
measures: body.measures,
|
|
249462
|
-
headerBlocks: header?.blocks,
|
|
249463
|
-
headerMeasures: header?.measures,
|
|
249464
|
-
footerBlocks: footer?.blocks,
|
|
249465
|
-
footerMeasures: footer?.measures
|
|
249466
|
-
};
|
|
249441
|
+
function isDomPainterInput(value) {
|
|
249442
|
+
return "resolvedLayout" in value && "sourceLayout" in value;
|
|
249467
249443
|
}
|
|
249468
249444
|
function buildLegacyPaintInput(layout, legacyState, flowMode, pageGap) {
|
|
249469
249445
|
let resolvedLayout;
|
|
@@ -249480,13 +249456,7 @@ function buildLegacyPaintInput(layout, legacyState, flowMode, pageGap) {
|
|
|
249480
249456
|
});
|
|
249481
249457
|
return {
|
|
249482
249458
|
resolvedLayout,
|
|
249483
|
-
sourceLayout: layout
|
|
249484
|
-
blocks: legacyState.blocks,
|
|
249485
|
-
measures: legacyState.measures,
|
|
249486
|
-
headerBlocks: legacyState.headerBlocks,
|
|
249487
|
-
headerMeasures: legacyState.headerMeasures,
|
|
249488
|
-
footerBlocks: legacyState.footerBlocks,
|
|
249489
|
-
footerMeasures: legacyState.footerMeasures
|
|
249459
|
+
sourceLayout: layout
|
|
249490
249460
|
};
|
|
249491
249461
|
}
|
|
249492
249462
|
function appendToArrayMap(map$12, key2, value) {
|
|
@@ -260839,7 +260809,7 @@ function normalizeConverterContext(context, defaultFont, defaultSize) {
|
|
|
260839
260809
|
context.translatedLinkedStyles.docDefaults.runProperties.fontSize = defaultSize * 0.75 * 2;
|
|
260840
260810
|
return context;
|
|
260841
260811
|
}
|
|
260842
|
-
function buildFootnotesInput(editorState, converter, converterContext, themeColors) {
|
|
260812
|
+
function buildFootnotesInput(editorState, converter, converterContext, themeColors, renderOverride = null) {
|
|
260843
260813
|
if (!editorState)
|
|
260844
260814
|
return null;
|
|
260845
260815
|
const footnoteNumberById = converterContext?.footnoteNumberById;
|
|
@@ -260866,14 +260836,11 @@ function buildFootnotesInput(editorState, converter, converterContext, themeColo
|
|
|
260866
260836
|
return null;
|
|
260867
260837
|
const blocksById = /* @__PURE__ */ new Map;
|
|
260868
260838
|
idsInUse.forEach((id2) => {
|
|
260869
|
-
const content3 = findNoteEntryById(importedFootnotes, id2)?.content;
|
|
260870
|
-
if (!Array.isArray(content3) || content3.length === 0)
|
|
260871
|
-
return;
|
|
260872
260839
|
try {
|
|
260873
|
-
const
|
|
260874
|
-
|
|
260875
|
-
|
|
260876
|
-
|
|
260840
|
+
const footnoteDoc = resolveNoteDocJson(id2, importedFootnotes, renderOverride);
|
|
260841
|
+
if (!footnoteDoc)
|
|
260842
|
+
return;
|
|
260843
|
+
const result = toFlowBlocks(footnoteDoc, {
|
|
260877
260844
|
blockIdPrefix: `footnote-${id2}-`,
|
|
260878
260845
|
storyKey: buildStoryKey({
|
|
260879
260846
|
kind: "story",
|
|
@@ -260941,6 +260908,23 @@ function buildMarkerRun$1(markerText, firstTextRun) {
|
|
|
260941
260908
|
markerRun.color = firstTextRun.color;
|
|
260942
260909
|
return markerRun;
|
|
260943
260910
|
}
|
|
260911
|
+
function cloneJsonValue$1(value) {
|
|
260912
|
+
return JSON.parse(JSON.stringify(value));
|
|
260913
|
+
}
|
|
260914
|
+
function cloneNoteContentJson$1(content3) {
|
|
260915
|
+
return cloneJsonValue$1(content3);
|
|
260916
|
+
}
|
|
260917
|
+
function resolveNoteDocJson(id2, importedFootnotes, renderOverride) {
|
|
260918
|
+
if (renderOverride && renderOverride.noteId === id2)
|
|
260919
|
+
return normalizeNotePmJson(cloneJsonValue$1(renderOverride.docJson));
|
|
260920
|
+
const content3 = findNoteEntryById(importedFootnotes, id2)?.content;
|
|
260921
|
+
if (!Array.isArray(content3) || content3.length === 0)
|
|
260922
|
+
return null;
|
|
260923
|
+
return normalizeNotePmJson({
|
|
260924
|
+
type: "doc",
|
|
260925
|
+
content: cloneNoteContentJson$1(content3)
|
|
260926
|
+
});
|
|
260927
|
+
}
|
|
260944
260928
|
function syncMarkerRun$1(target, source) {
|
|
260945
260929
|
target.kind = source.kind;
|
|
260946
260930
|
target.text = source.text;
|
|
@@ -265088,7 +265072,7 @@ function getHostEditor(editor) {
|
|
|
265088
265072
|
function resolveSessionHostEditor(editor, runtime) {
|
|
265089
265073
|
return getHostEditor(editor) ?? getHostEditor(runtime.editor) ?? runtime.editor;
|
|
265090
265074
|
}
|
|
265091
|
-
function buildEndnoteBlocks(editorState, converter, converterContext, themeColors) {
|
|
265075
|
+
function buildEndnoteBlocks(editorState, converter, converterContext, themeColors, renderOverride = null) {
|
|
265092
265076
|
if (!editorState)
|
|
265093
265077
|
return [];
|
|
265094
265078
|
const endnoteNumberById = converterContext?.endnoteNumberById;
|
|
@@ -265113,14 +265097,11 @@ function buildEndnoteBlocks(editorState, converter, converterContext, themeColor
|
|
|
265113
265097
|
return [];
|
|
265114
265098
|
const blocks2 = [];
|
|
265115
265099
|
orderedEndnoteIds.forEach((id2) => {
|
|
265116
|
-
const content3 = findNoteEntryById(importedEndnotes, id2)?.content;
|
|
265117
|
-
if (!Array.isArray(content3) || content3.length === 0)
|
|
265118
|
-
return;
|
|
265119
265100
|
try {
|
|
265120
|
-
const
|
|
265121
|
-
|
|
265122
|
-
|
|
265123
|
-
|
|
265101
|
+
const endnoteDoc = resolveEndnoteDocJson(id2, importedEndnotes, renderOverride);
|
|
265102
|
+
if (!endnoteDoc)
|
|
265103
|
+
return;
|
|
265104
|
+
const result = toFlowBlocks(endnoteDoc, {
|
|
265124
265105
|
blockIdPrefix: `endnote-${id2}-`,
|
|
265125
265106
|
storyKey: buildStoryKey({
|
|
265126
265107
|
kind: "story",
|
|
@@ -265195,6 +265176,23 @@ function syncMarkerRun(target, source) {
|
|
|
265195
265176
|
delete target.pmStart;
|
|
265196
265177
|
delete target.pmEnd;
|
|
265197
265178
|
}
|
|
265179
|
+
function cloneJsonValue(value) {
|
|
265180
|
+
return JSON.parse(JSON.stringify(value));
|
|
265181
|
+
}
|
|
265182
|
+
function cloneNoteContentJson(content3) {
|
|
265183
|
+
return cloneJsonValue(content3);
|
|
265184
|
+
}
|
|
265185
|
+
function resolveEndnoteDocJson(id2, importedEndnotes, renderOverride) {
|
|
265186
|
+
if (renderOverride && renderOverride.noteId === id2)
|
|
265187
|
+
return normalizeNotePmJson(cloneJsonValue(renderOverride.docJson));
|
|
265188
|
+
const content3 = findNoteEntryById(importedEndnotes, id2)?.content;
|
|
265189
|
+
if (!Array.isArray(content3) || content3.length === 0)
|
|
265190
|
+
return null;
|
|
265191
|
+
return normalizeNotePmJson({
|
|
265192
|
+
type: "doc",
|
|
265193
|
+
content: cloneNoteContentJson(content3)
|
|
265194
|
+
});
|
|
265195
|
+
}
|
|
265198
265196
|
function ensureEndnoteMarker(blocks2, id2, endnoteNumberById) {
|
|
265199
265197
|
const firstParagraph = blocks2.find((block) => block.kind === "paragraph");
|
|
265200
265198
|
if (!firstParagraph)
|
|
@@ -267166,26 +267164,26 @@ var Node$13 = class Node$14 {
|
|
|
267166
267164
|
cleanup();
|
|
267167
267165
|
headlessCleanupRegisteredEditors.delete(editor);
|
|
267168
267166
|
});
|
|
267169
|
-
}, cloneJsonValue = (value) => {
|
|
267167
|
+
}, cloneJsonValue$2 = (value) => {
|
|
267170
267168
|
if (value == null)
|
|
267171
267169
|
return null;
|
|
267172
267170
|
return JSON.parse(JSON.stringify(value));
|
|
267173
267171
|
}, serializeComparableValue = (value) => JSON.stringify(value ?? null), getEditorBodySectPr = (editor) => editor?.state?.doc?.attrs?.bodySectPr ?? null, setEditorConverterBodySectPr = (editor, bodySectPr) => {
|
|
267174
267172
|
if (!editor?.converter)
|
|
267175
267173
|
return;
|
|
267176
|
-
editor.converter.bodySectPr = cloneJsonValue(bodySectPr);
|
|
267174
|
+
editor.converter.bodySectPr = cloneJsonValue$2(bodySectPr);
|
|
267177
267175
|
}, syncBodySectPrToMetaMap = (ydoc, editor) => {
|
|
267178
267176
|
const metaMap = ydoc.getMap("meta");
|
|
267179
|
-
const nextBodySectPr = cloneJsonValue(getEditorBodySectPr(editor));
|
|
267180
|
-
const currentMetaBodySectPr = cloneJsonValue(metaMap.get(META_BODY_SECT_PR_KEY) ?? null);
|
|
267177
|
+
const nextBodySectPr = cloneJsonValue$2(getEditorBodySectPr(editor));
|
|
267178
|
+
const currentMetaBodySectPr = cloneJsonValue$2(metaMap.get(META_BODY_SECT_PR_KEY) ?? null);
|
|
267181
267179
|
setEditorConverterBodySectPr(editor, nextBodySectPr);
|
|
267182
267180
|
if (serializeComparableValue(nextBodySectPr) === serializeComparableValue(currentMetaBodySectPr))
|
|
267183
267181
|
return false;
|
|
267184
267182
|
metaMap.set(META_BODY_SECT_PR_KEY, nextBodySectPr);
|
|
267185
267183
|
return true;
|
|
267186
267184
|
}, applyBodySectPrFromMetaMap = (editor, ydoc) => {
|
|
267187
|
-
const nextBodySectPr = cloneJsonValue(ydoc.getMap("meta").get(META_BODY_SECT_PR_KEY) ?? null);
|
|
267188
|
-
const currentBodySectPr = cloneJsonValue(getEditorBodySectPr(editor));
|
|
267185
|
+
const nextBodySectPr = cloneJsonValue$2(ydoc.getMap("meta").get(META_BODY_SECT_PR_KEY) ?? null);
|
|
267186
|
+
const currentBodySectPr = cloneJsonValue$2(getEditorBodySectPr(editor));
|
|
267189
267187
|
setEditorConverterBodySectPr(editor, nextBodySectPr);
|
|
267190
267188
|
if (serializeComparableValue(nextBodySectPr) === serializeComparableValue(currentBodySectPr))
|
|
267191
267189
|
return false;
|
|
@@ -267228,8 +267226,8 @@ var Node$13 = class Node$14 {
|
|
|
267228
267226
|
applyBodySectPrFromMetaMap(editor, ydoc);
|
|
267229
267227
|
return;
|
|
267230
267228
|
}
|
|
267231
|
-
const previousBodySectPr = cloneJsonValue(transaction.before?.attrs?.bodySectPr ?? null);
|
|
267232
|
-
const nextBodySectPr = cloneJsonValue(getEditorBodySectPr(editor));
|
|
267229
|
+
const previousBodySectPr = cloneJsonValue$2(transaction.before?.attrs?.bodySectPr ?? null);
|
|
267230
|
+
const nextBodySectPr = cloneJsonValue$2(getEditorBodySectPr(editor));
|
|
267233
267231
|
if (serializeComparableValue(previousBodySectPr) === serializeComparableValue(nextBodySectPr))
|
|
267234
267232
|
return;
|
|
267235
267233
|
syncBodySectPrToMetaMap(ydoc, editor);
|
|
@@ -267362,8 +267360,8 @@ var Node$13 = class Node$14 {
|
|
|
267362
267360
|
}
|
|
267363
267361
|
if (transaction.getMeta?.(BODY_SECT_PR_SYNC_META_KEY))
|
|
267364
267362
|
return;
|
|
267365
|
-
const previousBodySectPr = cloneJsonValue(transaction.before?.attrs?.bodySectPr ?? null);
|
|
267366
|
-
const nextBodySectPr = cloneJsonValue(getEditorBodySectPr(editor));
|
|
267363
|
+
const previousBodySectPr = cloneJsonValue$2(transaction.before?.attrs?.bodySectPr ?? null);
|
|
267364
|
+
const nextBodySectPr = cloneJsonValue$2(getEditorBodySectPr(editor));
|
|
267367
267365
|
const bodySectPrChanged = serializeComparableValue(previousBodySectPr) !== serializeComparableValue(nextBodySectPr);
|
|
267368
267366
|
const binding = ensureInitializedBinding();
|
|
267369
267367
|
if (binding && typeof binding._prosemirrorChanged === "function") {
|
|
@@ -272553,7 +272551,7 @@ var Node$13 = class Node$14 {
|
|
|
272553
272551
|
...node3.attrs,
|
|
272554
272552
|
marksAsAttrs: newMarks
|
|
272555
272553
|
};
|
|
272556
|
-
dispatch(state.tr.setNodeMarkup(pos, undefined, newAttrs));
|
|
272554
|
+
dispatch(state.tr.setNodeMarkup(pos, undefined, newAttrs).setMeta("skipTrackChanges", true).setMeta("addToHistory", false));
|
|
272557
272555
|
}, 0);
|
|
272558
272556
|
}
|
|
272559
272557
|
update(node3) {
|
|
@@ -279944,89 +279942,6 @@ var Node$13 = class Node$14 {
|
|
|
279944
279942
|
if (borders.between)
|
|
279945
279943
|
parts.push(`bw:[${hashParagraphBorder$2(borders.between)}]`);
|
|
279946
279944
|
return parts.join(";");
|
|
279947
|
-
}, isNoneBorder$2 = (value) => {
|
|
279948
|
-
return typeof value === "object" && value !== null && "none" in value && value.none === true;
|
|
279949
|
-
}, isBorderSpec$2 = (value) => {
|
|
279950
|
-
return typeof value === "object" && value !== null && !("none" in value);
|
|
279951
|
-
}, hashBorderSpec$2 = (border) => {
|
|
279952
|
-
const parts = [];
|
|
279953
|
-
if (border.style !== undefined)
|
|
279954
|
-
parts.push(`s:${border.style}`);
|
|
279955
|
-
if (border.width !== undefined)
|
|
279956
|
-
parts.push(`w:${border.width}`);
|
|
279957
|
-
if (border.color !== undefined)
|
|
279958
|
-
parts.push(`c:${border.color}`);
|
|
279959
|
-
if (border.space !== undefined)
|
|
279960
|
-
parts.push(`sp:${border.space}`);
|
|
279961
|
-
return parts.join(",");
|
|
279962
|
-
}, hashTableBorderValue$2 = (borderValue) => {
|
|
279963
|
-
if (borderValue === undefined)
|
|
279964
|
-
return "";
|
|
279965
|
-
if (borderValue === null)
|
|
279966
|
-
return "null";
|
|
279967
|
-
if (isNoneBorder$2(borderValue))
|
|
279968
|
-
return "none";
|
|
279969
|
-
if (isBorderSpec$2(borderValue))
|
|
279970
|
-
return hashBorderSpec$2(borderValue);
|
|
279971
|
-
return "";
|
|
279972
|
-
}, hashTableBorders$2 = (borders) => {
|
|
279973
|
-
if (!borders)
|
|
279974
|
-
return "";
|
|
279975
|
-
const parts = [];
|
|
279976
|
-
if (borders.top !== undefined)
|
|
279977
|
-
parts.push(`t:[${hashTableBorderValue$2(borders.top)}]`);
|
|
279978
|
-
if (borders.right !== undefined)
|
|
279979
|
-
parts.push(`r:[${hashTableBorderValue$2(borders.right)}]`);
|
|
279980
|
-
if (borders.bottom !== undefined)
|
|
279981
|
-
parts.push(`b:[${hashTableBorderValue$2(borders.bottom)}]`);
|
|
279982
|
-
if (borders.left !== undefined)
|
|
279983
|
-
parts.push(`l:[${hashTableBorderValue$2(borders.left)}]`);
|
|
279984
|
-
if (borders.insideH !== undefined)
|
|
279985
|
-
parts.push(`ih:[${hashTableBorderValue$2(borders.insideH)}]`);
|
|
279986
|
-
if (borders.insideV !== undefined)
|
|
279987
|
-
parts.push(`iv:[${hashTableBorderValue$2(borders.insideV)}]`);
|
|
279988
|
-
return parts.join(";");
|
|
279989
|
-
}, hashCellBorders$2 = (borders) => {
|
|
279990
|
-
if (!borders)
|
|
279991
|
-
return "";
|
|
279992
|
-
const parts = [];
|
|
279993
|
-
if (borders.top)
|
|
279994
|
-
parts.push(`t:[${hashBorderSpec$2(borders.top)}]`);
|
|
279995
|
-
if (borders.right)
|
|
279996
|
-
parts.push(`r:[${hashBorderSpec$2(borders.right)}]`);
|
|
279997
|
-
if (borders.bottom)
|
|
279998
|
-
parts.push(`b:[${hashBorderSpec$2(borders.bottom)}]`);
|
|
279999
|
-
if (borders.left)
|
|
280000
|
-
parts.push(`l:[${hashBorderSpec$2(borders.left)}]`);
|
|
280001
|
-
return parts.join(";");
|
|
280002
|
-
}, hasStringProp$1 = (run2, prop) => {
|
|
280003
|
-
return prop in run2 && typeof run2[prop] === "string";
|
|
280004
|
-
}, hasNumberProp$1 = (run2, prop) => {
|
|
280005
|
-
return prop in run2 && typeof run2[prop] === "number";
|
|
280006
|
-
}, hasBooleanProp$1 = (run2, prop) => {
|
|
280007
|
-
return prop in run2 && typeof run2[prop] === "boolean";
|
|
280008
|
-
}, getRunStringProp$1 = (run2, prop) => {
|
|
280009
|
-
if (hasStringProp$1(run2, prop))
|
|
280010
|
-
return run2[prop];
|
|
280011
|
-
return "";
|
|
280012
|
-
}, getRunNumberProp$1 = (run2, prop) => {
|
|
280013
|
-
if (hasNumberProp$1(run2, prop))
|
|
280014
|
-
return run2[prop];
|
|
280015
|
-
return 0;
|
|
280016
|
-
}, getRunBooleanProp$1 = (run2, prop) => {
|
|
280017
|
-
if (hasBooleanProp$1(run2, prop))
|
|
280018
|
-
return run2[prop];
|
|
280019
|
-
return false;
|
|
280020
|
-
}, getRunUnderlineStyle$1 = (run2) => {
|
|
280021
|
-
if ("underline" in run2 && typeof run2.underline === "boolean")
|
|
280022
|
-
return run2.underline ? "single" : "";
|
|
280023
|
-
if ("underline" in run2 && run2.underline && typeof run2.underline === "object")
|
|
280024
|
-
return run2.underline.style ?? "";
|
|
280025
|
-
return "";
|
|
280026
|
-
}, getRunUnderlineColor$1 = (run2) => {
|
|
280027
|
-
if ("underline" in run2 && run2.underline && typeof run2.underline === "object")
|
|
280028
|
-
return run2.underline.color ?? "";
|
|
280029
|
-
return "";
|
|
280030
279945
|
}, isDevelopment = () => {
|
|
280031
279946
|
if (typeof process$1 !== "undefined" && typeof process$1.env !== "undefined")
|
|
280032
279947
|
return process$1.env.NODE_ENV === "development";
|
|
@@ -280711,43 +280626,11 @@ menclose::after {
|
|
|
280711
280626
|
styleEl.textContent = MATH_MENCLOSE_STYLES;
|
|
280712
280627
|
doc$12.head?.appendChild(styleEl);
|
|
280713
280628
|
mathMencloseStylesInjected = true;
|
|
280714
|
-
}, gradientIdCounter = 0,
|
|
280715
|
-
const lookup3 = blockLookup.get(fragment2.blockId);
|
|
280716
|
-
if (!lookup3)
|
|
280717
|
-
return;
|
|
280718
|
-
if (fragment2.kind === "para" && lookup3.block.kind === "paragraph")
|
|
280719
|
-
return lookup3.block.attrs?.borders;
|
|
280720
|
-
if (fragment2.kind === "list-item" && lookup3.block.kind === "list")
|
|
280721
|
-
return lookup3.block.items.find((entry) => entry.id === fragment2.itemId)?.paragraph.attrs?.borders;
|
|
280722
|
-
}, getFragmentHeight$1 = (fragment2, blockLookup) => {
|
|
280723
|
-
if (fragment2.kind === "table" || fragment2.kind === "image" || fragment2.kind === "drawing")
|
|
280724
|
-
return fragment2.height;
|
|
280725
|
-
const lookup3 = blockLookup.get(fragment2.blockId);
|
|
280726
|
-
if (!lookup3)
|
|
280727
|
-
return 0;
|
|
280728
|
-
if (fragment2.kind === "para" && lookup3.measure.kind === "paragraph") {
|
|
280729
|
-
const lines = fragment2.lines ?? lookup3.measure.lines.slice(fragment2.fromLine, fragment2.toLine);
|
|
280730
|
-
let totalHeight = 0;
|
|
280731
|
-
for (const line of lines)
|
|
280732
|
-
totalHeight += line.lineHeight ?? 0;
|
|
280733
|
-
return totalHeight;
|
|
280734
|
-
}
|
|
280735
|
-
if (fragment2.kind === "list-item" && lookup3.measure.kind === "list") {
|
|
280736
|
-
const item = lookup3.measure.items.find((it) => it.itemId === fragment2.itemId);
|
|
280737
|
-
if (!item)
|
|
280738
|
-
return 0;
|
|
280739
|
-
const lines = item.paragraph.lines.slice(fragment2.fromLine, fragment2.toLine);
|
|
280740
|
-
let totalHeight = 0;
|
|
280741
|
-
for (const line of lines)
|
|
280742
|
-
totalHeight += line.lineHeight ?? 0;
|
|
280743
|
-
return totalHeight;
|
|
280744
|
-
}
|
|
280745
|
-
return 0;
|
|
280746
|
-
}, isBetweenBorderNone = (borders) => {
|
|
280629
|
+
}, gradientIdCounter = 0, isBetweenBorderNone = (borders) => {
|
|
280747
280630
|
if (!borders?.between)
|
|
280748
280631
|
return true;
|
|
280749
280632
|
return borders.between.style === "none";
|
|
280750
|
-
}, computeBetweenBorderFlags = (fragments,
|
|
280633
|
+
}, computeBetweenBorderFlags = (fragments, resolvedItems) => {
|
|
280751
280634
|
const pairFlags = /* @__PURE__ */ new Set;
|
|
280752
280635
|
const noBetweenPairs = /* @__PURE__ */ new Set;
|
|
280753
280636
|
for (let i4 = 0;i4 < fragments.length - 1; i4 += 1) {
|
|
@@ -280756,10 +280639,10 @@ menclose::after {
|
|
|
280756
280639
|
continue;
|
|
280757
280640
|
if (frag.continuesOnNext)
|
|
280758
280641
|
continue;
|
|
280759
|
-
const resolvedCur = resolvedItems
|
|
280760
|
-
|
|
280761
|
-
if (!borders)
|
|
280642
|
+
const resolvedCur = resolvedItems[i4];
|
|
280643
|
+
if (!isResolvedFragmentWithBorders(resolvedCur))
|
|
280762
280644
|
continue;
|
|
280645
|
+
const borders = resolvedCur.paragraphBorders;
|
|
280763
280646
|
const next2 = fragments[i4 + 1];
|
|
280764
280647
|
if (next2.kind !== "para" && next2.kind !== "list-item")
|
|
280765
280648
|
continue;
|
|
@@ -280769,11 +280652,11 @@ menclose::after {
|
|
|
280769
280652
|
continue;
|
|
280770
280653
|
if (next2.blockId === frag.blockId && next2.kind === "list-item" && frag.kind === "list-item" && next2.itemId === frag.itemId)
|
|
280771
280654
|
continue;
|
|
280772
|
-
const resolvedNext = resolvedItems
|
|
280773
|
-
|
|
280774
|
-
if (!nextBorders)
|
|
280655
|
+
const resolvedNext = resolvedItems[i4 + 1];
|
|
280656
|
+
if (!isResolvedFragmentWithBorders(resolvedNext))
|
|
280775
280657
|
continue;
|
|
280776
|
-
|
|
280658
|
+
const nextBorders = resolvedNext.paragraphBorders;
|
|
280659
|
+
if (("paragraphBorderHash" in resolvedCur && resolvedCur.paragraphBorderHash ? resolvedCur.paragraphBorderHash : hashParagraphBorders$2(borders)) !== ("paragraphBorderHash" in resolvedNext && resolvedNext.paragraphBorderHash ? resolvedNext.paragraphBorderHash : hashParagraphBorders$2(nextBorders)))
|
|
280777
280660
|
continue;
|
|
280778
280661
|
if (frag.x !== next2.x)
|
|
280779
280662
|
continue;
|
|
@@ -280785,8 +280668,8 @@ menclose::after {
|
|
|
280785
280668
|
for (const i4 of pairFlags) {
|
|
280786
280669
|
const frag = fragments[i4];
|
|
280787
280670
|
const next2 = fragments[i4 + 1];
|
|
280788
|
-
const resolvedCur = resolvedItems
|
|
280789
|
-
const fragHeight = resolvedCur && "height" in resolvedCur && resolvedCur.height != null ? resolvedCur.height :
|
|
280671
|
+
const resolvedCur = resolvedItems[i4];
|
|
280672
|
+
const fragHeight = resolvedCur && "height" in resolvedCur && resolvedCur.height != null ? resolvedCur.height : 0;
|
|
280790
280673
|
const gapBelow = Math.max(0, next2.y - (frag.y + fragHeight));
|
|
280791
280674
|
const isNoBetween = noBetweenPairs.has(i4);
|
|
280792
280675
|
if (!result.has(i4))
|
|
@@ -282704,31 +282587,14 @@ menclose::after {
|
|
|
282704
282587
|
if (value != null)
|
|
282705
282588
|
element3.dataset[key2] = value;
|
|
282706
282589
|
});
|
|
282707
|
-
}, DomPainter,
|
|
282708
|
-
const lookup3 = blockLookup.get(fragment2.blockId);
|
|
282709
|
-
if (!lookup3)
|
|
282710
|
-
return null;
|
|
282711
|
-
const block = lookup3.block;
|
|
282712
|
-
if (fragment2.kind === "para" && block.kind === "paragraph") {
|
|
282713
|
-
const attrs = block.attrs;
|
|
282714
|
-
return getSdtContainerKey(attrs?.sdt, attrs?.containerSdt);
|
|
282715
|
-
}
|
|
282716
|
-
if (fragment2.kind === "list-item" && block.kind === "list") {
|
|
282717
|
-
const attrs = block.items.find((listItem2) => listItem2.id === fragment2.itemId)?.paragraph.attrs;
|
|
282718
|
-
return getSdtContainerKey(attrs?.sdt, attrs?.containerSdt);
|
|
282719
|
-
}
|
|
282720
|
-
if (fragment2.kind === "table" && block.kind === "table") {
|
|
282721
|
-
const attrs = block.attrs;
|
|
282722
|
-
return getSdtContainerKey(attrs?.sdt, attrs?.containerSdt);
|
|
282723
|
-
}
|
|
282724
|
-
return null;
|
|
282725
|
-
}, computeSdtBoundaries = (fragments, blockLookup, sdtLabelsRendered, resolvedItems) => {
|
|
282590
|
+
}, DomPainter, computeSdtBoundaries = (fragments, resolvedItems, sdtLabelsRendered) => {
|
|
282726
282591
|
const boundaries = /* @__PURE__ */ new Map;
|
|
282727
|
-
const containerKeys =
|
|
282728
|
-
|
|
282592
|
+
const containerKeys = fragments.map((_frag, idx) => {
|
|
282593
|
+
const item = resolvedItems[idx];
|
|
282594
|
+
if (item && "sdtContainerKey" in item)
|
|
282729
282595
|
return item.sdtContainerKey ?? null;
|
|
282730
282596
|
return null;
|
|
282731
|
-
})
|
|
282597
|
+
});
|
|
282732
282598
|
let i4 = 0;
|
|
282733
282599
|
while (i4 < fragments.length) {
|
|
282734
282600
|
const currentKey = containerKeys[i4];
|
|
@@ -282751,7 +282617,7 @@ menclose::after {
|
|
|
282751
282617
|
let paddingBottomOverride;
|
|
282752
282618
|
if (!isEnd) {
|
|
282753
282619
|
const nextFragment = fragments[k$1 + 1];
|
|
282754
|
-
const currentHeight = resolvedItems
|
|
282620
|
+
const currentHeight = resolvedItems[k$1]?.height ?? 0;
|
|
282755
282621
|
const currentBottom = fragment2.y + currentHeight;
|
|
282756
282622
|
const gapToNext = nextFragment.y - currentBottom;
|
|
282757
282623
|
if (gapToNext > 0)
|
|
@@ -282785,406 +282651,7 @@ menclose::after {
|
|
|
282785
282651
|
return `table:${fragment2.blockId}:${fragment2.fromRow}:${fragment2.toRow}${partialKey}`;
|
|
282786
282652
|
}
|
|
282787
282653
|
return fragment2;
|
|
282788
|
-
},
|
|
282789
|
-
const base5 = lookup3.get(fragment2.blockId)?.version ?? "missing";
|
|
282790
|
-
if (fragment2.kind === "para")
|
|
282791
|
-
return [
|
|
282792
|
-
base5,
|
|
282793
|
-
fragment2.fromLine,
|
|
282794
|
-
fragment2.toLine,
|
|
282795
|
-
fragment2.continuesFromPrev ? 1 : 0,
|
|
282796
|
-
fragment2.continuesOnNext ? 1 : 0,
|
|
282797
|
-
fragment2.markerWidth ?? ""
|
|
282798
|
-
].join("|");
|
|
282799
|
-
if (fragment2.kind === "list-item")
|
|
282800
|
-
return [
|
|
282801
|
-
base5,
|
|
282802
|
-
fragment2.itemId,
|
|
282803
|
-
fragment2.fromLine,
|
|
282804
|
-
fragment2.toLine,
|
|
282805
|
-
fragment2.continuesFromPrev ? 1 : 0,
|
|
282806
|
-
fragment2.continuesOnNext ? 1 : 0
|
|
282807
|
-
].join("|");
|
|
282808
|
-
if (fragment2.kind === "image")
|
|
282809
|
-
return [
|
|
282810
|
-
base5,
|
|
282811
|
-
fragment2.width,
|
|
282812
|
-
fragment2.height
|
|
282813
|
-
].join("|");
|
|
282814
|
-
if (fragment2.kind === "drawing")
|
|
282815
|
-
return [
|
|
282816
|
-
base5,
|
|
282817
|
-
fragment2.drawingKind,
|
|
282818
|
-
fragment2.drawingContentId ?? "",
|
|
282819
|
-
fragment2.width,
|
|
282820
|
-
fragment2.height,
|
|
282821
|
-
fragment2.geometry.width,
|
|
282822
|
-
fragment2.geometry.height,
|
|
282823
|
-
fragment2.geometry.rotation ?? 0,
|
|
282824
|
-
fragment2.scale ?? 1,
|
|
282825
|
-
fragment2.zIndex ?? ""
|
|
282826
|
-
].join("|");
|
|
282827
|
-
if (fragment2.kind === "table") {
|
|
282828
|
-
const partialSig = fragment2.partialRow ? `${fragment2.partialRow.fromLineByCell.join(",")}-${fragment2.partialRow.toLineByCell.join(",")}-${fragment2.partialRow.partialHeight}` : "";
|
|
282829
|
-
return [
|
|
282830
|
-
base5,
|
|
282831
|
-
fragment2.fromRow,
|
|
282832
|
-
fragment2.toRow,
|
|
282833
|
-
fragment2.width,
|
|
282834
|
-
fragment2.height,
|
|
282835
|
-
fragment2.continuesFromPrev ? 1 : 0,
|
|
282836
|
-
fragment2.continuesOnNext ? 1 : 0,
|
|
282837
|
-
fragment2.repeatHeaderCount ?? 0,
|
|
282838
|
-
partialSig
|
|
282839
|
-
].join("|");
|
|
282840
|
-
}
|
|
282841
|
-
return base5;
|
|
282842
|
-
}, hasFragmentGeometryChanged = (previous3, next2) => previous3.x !== next2.x || previous3.y !== next2.y || previous3.width !== next2.width || ("height" in previous3) && ("height" in next2) && typeof previous3.height === "number" && typeof next2.height === "number" && previous3.height !== next2.height, isNonBodyStoryBlockId = (blockId) => typeof blockId === "string" && (blockId.startsWith("footnote-") || blockId.startsWith("endnote-") || blockId.startsWith("__sd_semantic_footnote-") || blockId.startsWith("__sd_semantic_endnote-")), getSdtMetadataId$1 = (metadata) => {
|
|
282843
|
-
if (!metadata)
|
|
282844
|
-
return "";
|
|
282845
|
-
if ("id" in metadata && metadata.id != null)
|
|
282846
|
-
return String(metadata.id);
|
|
282847
|
-
return "";
|
|
282848
|
-
}, getSdtMetadataLockMode$1 = (metadata) => {
|
|
282849
|
-
if (!metadata)
|
|
282850
|
-
return "";
|
|
282851
|
-
return metadata.type === "structuredContent" ? metadata.lockMode ?? "" : "";
|
|
282852
|
-
}, getSdtMetadataVersion$1 = (metadata) => {
|
|
282853
|
-
if (!metadata)
|
|
282854
|
-
return "";
|
|
282855
|
-
return [
|
|
282856
|
-
metadata.type,
|
|
282857
|
-
getSdtMetadataLockMode$1(metadata),
|
|
282858
|
-
getSdtMetadataId$1(metadata)
|
|
282859
|
-
].join(":");
|
|
282860
|
-
}, hasListMarkerProperties$1 = (attrs) => {
|
|
282861
|
-
if (!attrs || typeof attrs !== "object")
|
|
282862
|
-
return false;
|
|
282863
|
-
const obj = attrs;
|
|
282864
|
-
if (!obj.numberingProperties || typeof obj.numberingProperties !== "object")
|
|
282865
|
-
return false;
|
|
282866
|
-
const numProps = obj.numberingProperties;
|
|
282867
|
-
if ("numId" in numProps) {
|
|
282868
|
-
const numId = numProps.numId;
|
|
282869
|
-
if (typeof numId !== "number" && typeof numId !== "string")
|
|
282870
|
-
return false;
|
|
282871
|
-
}
|
|
282872
|
-
if ("ilvl" in numProps) {
|
|
282873
|
-
if (typeof numProps.ilvl !== "number")
|
|
282874
|
-
return false;
|
|
282875
|
-
}
|
|
282876
|
-
if ("wordLayout" in obj && obj.wordLayout !== undefined) {
|
|
282877
|
-
if (typeof obj.wordLayout !== "object" || obj.wordLayout === null)
|
|
282878
|
-
return false;
|
|
282879
|
-
const wordLayout = obj.wordLayout;
|
|
282880
|
-
if ("marker" in wordLayout && wordLayout.marker !== undefined) {
|
|
282881
|
-
if (typeof wordLayout.marker !== "object" || wordLayout.marker === null)
|
|
282882
|
-
return false;
|
|
282883
|
-
const marker = wordLayout.marker;
|
|
282884
|
-
if ("markerText" in marker && marker.markerText !== undefined) {
|
|
282885
|
-
if (typeof marker.markerText !== "string")
|
|
282886
|
-
return false;
|
|
282887
|
-
}
|
|
282888
|
-
}
|
|
282889
|
-
}
|
|
282890
|
-
return true;
|
|
282891
|
-
}, deriveBlockVersion$1 = (block) => {
|
|
282892
|
-
if (block.kind === "paragraph") {
|
|
282893
|
-
const markerVersion = hasListMarkerProperties$1(block.attrs) ? `marker:${block.attrs.numberingProperties.numId ?? ""}:${block.attrs.numberingProperties.ilvl ?? 0}:${block.attrs.wordLayout?.marker?.markerText ?? ""}` : "";
|
|
282894
|
-
const runsVersion = block.runs.map((run2) => {
|
|
282895
|
-
if (run2.kind === "image") {
|
|
282896
|
-
const imgRun = run2;
|
|
282897
|
-
return [
|
|
282898
|
-
"img",
|
|
282899
|
-
imgRun.src,
|
|
282900
|
-
imgRun.width,
|
|
282901
|
-
imgRun.height,
|
|
282902
|
-
imgRun.alt ?? "",
|
|
282903
|
-
imgRun.title ?? "",
|
|
282904
|
-
imgRun.clipPath ?? "",
|
|
282905
|
-
imgRun.distTop ?? "",
|
|
282906
|
-
imgRun.distBottom ?? "",
|
|
282907
|
-
imgRun.distLeft ?? "",
|
|
282908
|
-
imgRun.distRight ?? "",
|
|
282909
|
-
readClipPathValue$1(imgRun.clipPath)
|
|
282910
|
-
].join(",");
|
|
282911
|
-
}
|
|
282912
|
-
if (run2.kind === "lineBreak")
|
|
282913
|
-
return "linebreak";
|
|
282914
|
-
if (run2.kind === "tab")
|
|
282915
|
-
return [run2.text ?? "", "tab"].join(",");
|
|
282916
|
-
if (run2.kind === "fieldAnnotation") {
|
|
282917
|
-
const size$1 = run2.size ? `${run2.size.width ?? ""}x${run2.size.height ?? ""}` : "";
|
|
282918
|
-
const highlighted = run2.highlighted !== false ? 1 : 0;
|
|
282919
|
-
return [
|
|
282920
|
-
"field",
|
|
282921
|
-
run2.variant ?? "",
|
|
282922
|
-
run2.displayLabel ?? "",
|
|
282923
|
-
run2.fieldColor ?? "",
|
|
282924
|
-
run2.borderColor ?? "",
|
|
282925
|
-
highlighted,
|
|
282926
|
-
run2.hidden ? 1 : 0,
|
|
282927
|
-
run2.visibility ?? "",
|
|
282928
|
-
run2.imageSrc ?? "",
|
|
282929
|
-
run2.linkUrl ?? "",
|
|
282930
|
-
run2.rawHtml ?? "",
|
|
282931
|
-
size$1,
|
|
282932
|
-
run2.fontFamily ?? "",
|
|
282933
|
-
run2.fontSize ?? "",
|
|
282934
|
-
run2.textColor ?? "",
|
|
282935
|
-
run2.textHighlight ?? "",
|
|
282936
|
-
run2.bold ? 1 : 0,
|
|
282937
|
-
run2.italic ? 1 : 0,
|
|
282938
|
-
run2.underline ? 1 : 0,
|
|
282939
|
-
run2.fieldId ?? "",
|
|
282940
|
-
run2.fieldType ?? ""
|
|
282941
|
-
].join(",");
|
|
282942
|
-
}
|
|
282943
|
-
const textRun = run2;
|
|
282944
|
-
const trackedChangeVersion = textRun.trackedChange ? [
|
|
282945
|
-
textRun.trackedChange.kind ?? "",
|
|
282946
|
-
textRun.trackedChange.id ?? "",
|
|
282947
|
-
textRun.trackedChange.storyKey ?? "",
|
|
282948
|
-
textRun.trackedChange.author ?? "",
|
|
282949
|
-
textRun.trackedChange.authorEmail ?? "",
|
|
282950
|
-
textRun.trackedChange.authorImage ?? "",
|
|
282951
|
-
textRun.trackedChange.date ?? "",
|
|
282952
|
-
textRun.trackedChange.before ? JSON.stringify(textRun.trackedChange.before) : "",
|
|
282953
|
-
textRun.trackedChange.after ? JSON.stringify(textRun.trackedChange.after) : ""
|
|
282954
|
-
].join(":") : "";
|
|
282955
|
-
return [
|
|
282956
|
-
textRun.text ?? "",
|
|
282957
|
-
textRun.fontFamily,
|
|
282958
|
-
textRun.fontSize,
|
|
282959
|
-
textRun.bold ? 1 : 0,
|
|
282960
|
-
textRun.italic ? 1 : 0,
|
|
282961
|
-
textRun.color ?? "",
|
|
282962
|
-
textRun.underline?.style ?? "",
|
|
282963
|
-
textRun.underline?.color ?? "",
|
|
282964
|
-
textRun.strike ? 1 : 0,
|
|
282965
|
-
textRun.highlight ?? "",
|
|
282966
|
-
textRun.letterSpacing != null ? textRun.letterSpacing : "",
|
|
282967
|
-
textRun.vertAlign ?? "",
|
|
282968
|
-
textRun.baselineShift != null ? textRun.baselineShift : "",
|
|
282969
|
-
textRun.token ?? "",
|
|
282970
|
-
trackedChangeVersion,
|
|
282971
|
-
textRun.comments?.length ?? 0
|
|
282972
|
-
].join(",");
|
|
282973
|
-
}).join("|");
|
|
282974
|
-
const attrs = block.attrs;
|
|
282975
|
-
const paragraphAttrsVersion = attrs ? [
|
|
282976
|
-
attrs.alignment ?? "",
|
|
282977
|
-
attrs.spacing?.before ?? "",
|
|
282978
|
-
attrs.spacing?.after ?? "",
|
|
282979
|
-
attrs.spacing?.line ?? "",
|
|
282980
|
-
attrs.spacing?.lineRule ?? "",
|
|
282981
|
-
attrs.indent?.left ?? "",
|
|
282982
|
-
attrs.indent?.right ?? "",
|
|
282983
|
-
attrs.indent?.firstLine ?? "",
|
|
282984
|
-
attrs.indent?.hanging ?? "",
|
|
282985
|
-
attrs.borders ? hashParagraphBorders$2(attrs.borders) : "",
|
|
282986
|
-
attrs.shading?.fill ?? "",
|
|
282987
|
-
attrs.shading?.color ?? "",
|
|
282988
|
-
attrs.direction ?? "",
|
|
282989
|
-
attrs.rtl ? "1" : "",
|
|
282990
|
-
attrs.tabs?.length ? JSON.stringify(attrs.tabs) : ""
|
|
282991
|
-
].join(":") : "";
|
|
282992
|
-
const sdtAttrs = block.attrs?.sdt;
|
|
282993
|
-
return [
|
|
282994
|
-
markerVersion,
|
|
282995
|
-
runsVersion,
|
|
282996
|
-
paragraphAttrsVersion,
|
|
282997
|
-
getSdtMetadataVersion$1(sdtAttrs)
|
|
282998
|
-
].filter(Boolean).join("|");
|
|
282999
|
-
}
|
|
283000
|
-
if (block.kind === "list")
|
|
283001
|
-
return block.items.map((item) => `${item.id}:${item.marker.text}:${deriveBlockVersion$1(item.paragraph)}`).join("|");
|
|
283002
|
-
if (block.kind === "image") {
|
|
283003
|
-
const imgSdt = block.attrs?.sdt;
|
|
283004
|
-
const imgSdtVersion = getSdtMetadataVersion$1(imgSdt);
|
|
283005
|
-
return [
|
|
283006
|
-
block.src ?? "",
|
|
283007
|
-
block.width ?? "",
|
|
283008
|
-
block.height ?? "",
|
|
283009
|
-
block.alt ?? "",
|
|
283010
|
-
block.title ?? "",
|
|
283011
|
-
resolveBlockClipPath$1(block),
|
|
283012
|
-
imgSdtVersion
|
|
283013
|
-
].join("|");
|
|
283014
|
-
}
|
|
283015
|
-
if (block.kind === "drawing") {
|
|
283016
|
-
if (block.drawingKind === "image") {
|
|
283017
|
-
const imageLike = block;
|
|
283018
|
-
return [
|
|
283019
|
-
"drawing:image",
|
|
283020
|
-
imageLike.src ?? "",
|
|
283021
|
-
imageLike.width ?? "",
|
|
283022
|
-
imageLike.height ?? "",
|
|
283023
|
-
imageLike.alt ?? "",
|
|
283024
|
-
resolveBlockClipPath$1(imageLike)
|
|
283025
|
-
].join("|");
|
|
283026
|
-
}
|
|
283027
|
-
if (block.drawingKind === "vectorShape") {
|
|
283028
|
-
const vector = block;
|
|
283029
|
-
return [
|
|
283030
|
-
"drawing:vector",
|
|
283031
|
-
vector.shapeKind ?? "",
|
|
283032
|
-
vector.fillColor ?? "",
|
|
283033
|
-
vector.strokeColor ?? "",
|
|
283034
|
-
vector.strokeWidth ?? "",
|
|
283035
|
-
vector.geometry.width,
|
|
283036
|
-
vector.geometry.height,
|
|
283037
|
-
vector.geometry.rotation ?? 0,
|
|
283038
|
-
vector.geometry.flipH ? 1 : 0,
|
|
283039
|
-
vector.geometry.flipV ? 1 : 0
|
|
283040
|
-
].join("|");
|
|
283041
|
-
}
|
|
283042
|
-
if (block.drawingKind === "shapeGroup") {
|
|
283043
|
-
const group = block;
|
|
283044
|
-
const childSignature = group.shapes.map((child) => `${child.shapeType}:${JSON.stringify(child.attrs ?? {})}`).join(";");
|
|
283045
|
-
return [
|
|
283046
|
-
"drawing:group",
|
|
283047
|
-
group.geometry.width,
|
|
283048
|
-
group.geometry.height,
|
|
283049
|
-
group.groupTransform ? JSON.stringify(group.groupTransform) : "",
|
|
283050
|
-
childSignature
|
|
283051
|
-
].join("|");
|
|
283052
|
-
}
|
|
283053
|
-
if (block.drawingKind === "chart")
|
|
283054
|
-
return [
|
|
283055
|
-
"drawing:chart",
|
|
283056
|
-
block.chartData?.chartType ?? "",
|
|
283057
|
-
block.chartData?.series?.length ?? 0,
|
|
283058
|
-
block.geometry.width,
|
|
283059
|
-
block.geometry.height,
|
|
283060
|
-
block.chartRelId ?? ""
|
|
283061
|
-
].join("|");
|
|
283062
|
-
return `drawing:unknown:${block.id}`;
|
|
283063
|
-
}
|
|
283064
|
-
if (block.kind === "table") {
|
|
283065
|
-
const tableBlock = block;
|
|
283066
|
-
const hashString$1 = (seed, value) => {
|
|
283067
|
-
let hash$4 = seed >>> 0;
|
|
283068
|
-
for (let i4 = 0;i4 < value.length; i4++) {
|
|
283069
|
-
hash$4 ^= value.charCodeAt(i4);
|
|
283070
|
-
hash$4 = Math.imul(hash$4, 16777619);
|
|
283071
|
-
}
|
|
283072
|
-
return hash$4 >>> 0;
|
|
283073
|
-
};
|
|
283074
|
-
const hashNumber$1 = (seed, value) => {
|
|
283075
|
-
let hash$4 = seed ^ (Number.isFinite(value) ? value : 0);
|
|
283076
|
-
hash$4 = Math.imul(hash$4, 16777619);
|
|
283077
|
-
hash$4 ^= hash$4 >>> 13;
|
|
283078
|
-
return hash$4 >>> 0;
|
|
283079
|
-
};
|
|
283080
|
-
let hash$3 = 2166136261;
|
|
283081
|
-
hash$3 = hashString$1(hash$3, block.id);
|
|
283082
|
-
hash$3 = hashNumber$1(hash$3, tableBlock.rows.length);
|
|
283083
|
-
hash$3 = (tableBlock.columnWidths ?? []).reduce((acc, width) => hashNumber$1(acc, Math.round(width * 1000)), hash$3);
|
|
283084
|
-
const rows = tableBlock.rows ?? [];
|
|
283085
|
-
for (const row2 of rows) {
|
|
283086
|
-
if (!row2 || !Array.isArray(row2.cells))
|
|
283087
|
-
continue;
|
|
283088
|
-
hash$3 = hashNumber$1(hash$3, row2.cells.length);
|
|
283089
|
-
for (const cell2 of row2.cells) {
|
|
283090
|
-
if (!cell2)
|
|
283091
|
-
continue;
|
|
283092
|
-
const cellBlocks = cell2.blocks ?? (cell2.paragraph ? [cell2.paragraph] : []);
|
|
283093
|
-
hash$3 = hashNumber$1(hash$3, cellBlocks.length);
|
|
283094
|
-
hash$3 = hashNumber$1(hash$3, cell2.rowSpan ?? 1);
|
|
283095
|
-
hash$3 = hashNumber$1(hash$3, cell2.colSpan ?? 1);
|
|
283096
|
-
if (cell2.attrs) {
|
|
283097
|
-
const cellAttrs = cell2.attrs;
|
|
283098
|
-
if (cellAttrs.borders)
|
|
283099
|
-
hash$3 = hashString$1(hash$3, hashCellBorders$2(cellAttrs.borders));
|
|
283100
|
-
if (cellAttrs.padding) {
|
|
283101
|
-
const p$12 = cellAttrs.padding;
|
|
283102
|
-
hash$3 = hashNumber$1(hash$3, p$12.top ?? 0);
|
|
283103
|
-
hash$3 = hashNumber$1(hash$3, p$12.right ?? 0);
|
|
283104
|
-
hash$3 = hashNumber$1(hash$3, p$12.bottom ?? 0);
|
|
283105
|
-
hash$3 = hashNumber$1(hash$3, p$12.left ?? 0);
|
|
283106
|
-
}
|
|
283107
|
-
if (cellAttrs.verticalAlign)
|
|
283108
|
-
hash$3 = hashString$1(hash$3, cellAttrs.verticalAlign);
|
|
283109
|
-
if (cellAttrs.background)
|
|
283110
|
-
hash$3 = hashString$1(hash$3, cellAttrs.background);
|
|
283111
|
-
}
|
|
283112
|
-
for (const cellBlock of cellBlocks) {
|
|
283113
|
-
hash$3 = hashString$1(hash$3, cellBlock?.kind ?? "unknown");
|
|
283114
|
-
if (cellBlock?.kind === "paragraph") {
|
|
283115
|
-
const paragraphBlock = cellBlock;
|
|
283116
|
-
const runs2 = paragraphBlock.runs ?? [];
|
|
283117
|
-
hash$3 = hashNumber$1(hash$3, runs2.length);
|
|
283118
|
-
const attrs = paragraphBlock.attrs;
|
|
283119
|
-
if (attrs) {
|
|
283120
|
-
hash$3 = hashString$1(hash$3, attrs.alignment ?? "");
|
|
283121
|
-
hash$3 = hashNumber$1(hash$3, attrs.spacing?.before ?? 0);
|
|
283122
|
-
hash$3 = hashNumber$1(hash$3, attrs.spacing?.after ?? 0);
|
|
283123
|
-
hash$3 = hashNumber$1(hash$3, attrs.spacing?.line ?? 0);
|
|
283124
|
-
hash$3 = hashString$1(hash$3, attrs.spacing?.lineRule ?? "");
|
|
283125
|
-
hash$3 = hashNumber$1(hash$3, attrs.indent?.left ?? 0);
|
|
283126
|
-
hash$3 = hashNumber$1(hash$3, attrs.indent?.right ?? 0);
|
|
283127
|
-
hash$3 = hashNumber$1(hash$3, attrs.indent?.firstLine ?? 0);
|
|
283128
|
-
hash$3 = hashNumber$1(hash$3, attrs.indent?.hanging ?? 0);
|
|
283129
|
-
hash$3 = hashString$1(hash$3, attrs.shading?.fill ?? "");
|
|
283130
|
-
hash$3 = hashString$1(hash$3, attrs.shading?.color ?? "");
|
|
283131
|
-
hash$3 = hashString$1(hash$3, attrs.direction ?? "");
|
|
283132
|
-
hash$3 = hashString$1(hash$3, attrs.rtl ? "1" : "");
|
|
283133
|
-
if (attrs.borders)
|
|
283134
|
-
hash$3 = hashString$1(hash$3, hashParagraphBorders$2(attrs.borders));
|
|
283135
|
-
}
|
|
283136
|
-
for (const run2 of runs2) {
|
|
283137
|
-
if ("text" in run2 && typeof run2.text === "string")
|
|
283138
|
-
hash$3 = hashString$1(hash$3, run2.text);
|
|
283139
|
-
hash$3 = hashNumber$1(hash$3, run2.pmStart ?? -1);
|
|
283140
|
-
hash$3 = hashNumber$1(hash$3, run2.pmEnd ?? -1);
|
|
283141
|
-
hash$3 = hashString$1(hash$3, getRunStringProp$1(run2, "color"));
|
|
283142
|
-
hash$3 = hashString$1(hash$3, getRunStringProp$1(run2, "highlight"));
|
|
283143
|
-
hash$3 = hashString$1(hash$3, getRunBooleanProp$1(run2, "bold") ? "1" : "");
|
|
283144
|
-
hash$3 = hashString$1(hash$3, getRunBooleanProp$1(run2, "italic") ? "1" : "");
|
|
283145
|
-
hash$3 = hashNumber$1(hash$3, getRunNumberProp$1(run2, "fontSize"));
|
|
283146
|
-
hash$3 = hashString$1(hash$3, getRunStringProp$1(run2, "fontFamily"));
|
|
283147
|
-
hash$3 = hashString$1(hash$3, getRunUnderlineStyle$1(run2));
|
|
283148
|
-
hash$3 = hashString$1(hash$3, getRunUnderlineColor$1(run2));
|
|
283149
|
-
hash$3 = hashString$1(hash$3, getRunBooleanProp$1(run2, "strike") ? "1" : "");
|
|
283150
|
-
hash$3 = hashString$1(hash$3, getRunStringProp$1(run2, "vertAlign"));
|
|
283151
|
-
hash$3 = hashNumber$1(hash$3, getRunNumberProp$1(run2, "baselineShift"));
|
|
283152
|
-
}
|
|
283153
|
-
} else if (cellBlock?.kind)
|
|
283154
|
-
hash$3 = hashString$1(hash$3, deriveBlockVersion$1(cellBlock));
|
|
283155
|
-
}
|
|
283156
|
-
}
|
|
283157
|
-
}
|
|
283158
|
-
if (tableBlock.attrs) {
|
|
283159
|
-
const tblAttrs = tableBlock.attrs;
|
|
283160
|
-
if (tblAttrs.borders)
|
|
283161
|
-
hash$3 = hashString$1(hash$3, hashTableBorders$2(tblAttrs.borders));
|
|
283162
|
-
if (tblAttrs.borderCollapse)
|
|
283163
|
-
hash$3 = hashString$1(hash$3, tblAttrs.borderCollapse);
|
|
283164
|
-
if (tblAttrs.cellSpacing !== undefined) {
|
|
283165
|
-
const cs = tblAttrs.cellSpacing;
|
|
283166
|
-
if (typeof cs === "number")
|
|
283167
|
-
hash$3 = hashNumber$1(hash$3, cs);
|
|
283168
|
-
else {
|
|
283169
|
-
const v = cs.value ?? 0;
|
|
283170
|
-
const t = cs.type ?? "px";
|
|
283171
|
-
hash$3 = hashString$1(hash$3, `cs:${v}:${t}`);
|
|
283172
|
-
}
|
|
283173
|
-
}
|
|
283174
|
-
if (tblAttrs.sdt) {
|
|
283175
|
-
hash$3 = hashString$1(hash$3, tblAttrs.sdt.type);
|
|
283176
|
-
hash$3 = hashString$1(hash$3, getSdtMetadataLockMode$1(tblAttrs.sdt));
|
|
283177
|
-
hash$3 = hashString$1(hash$3, getSdtMetadataId$1(tblAttrs.sdt));
|
|
283178
|
-
}
|
|
283179
|
-
}
|
|
283180
|
-
return [
|
|
283181
|
-
block.id,
|
|
283182
|
-
tableBlock.rows.length,
|
|
283183
|
-
hash$3.toString(16)
|
|
283184
|
-
].join("|");
|
|
283185
|
-
}
|
|
283186
|
-
return block.id;
|
|
283187
|
-
}, DEFAULT_SUPERSCRIPT_RAISE_RATIO = 0.33, DEFAULT_SUBSCRIPT_LOWER_RATIO = 0.14, hasVerticalPositioning = (run2) => normalizeBaselineShift(run2.baselineShift) != null || run2.vertAlign === "superscript" || run2.vertAlign === "subscript", applyRunVerticalPositioning = (element3, run2) => {
|
|
282654
|
+
}, hasFragmentGeometryChanged = (previous3, next2) => previous3.x !== next2.x || previous3.y !== next2.y || previous3.width !== next2.width || ("height" in previous3) && ("height" in next2) && typeof previous3.height === "number" && typeof next2.height === "number" && previous3.height !== next2.height, isNonBodyStoryBlockId = (blockId) => typeof blockId === "string" && (blockId.startsWith("footnote-") || blockId.startsWith("endnote-") || blockId.startsWith("__sd_semantic_footnote-") || blockId.startsWith("__sd_semantic_endnote-")), DEFAULT_SUPERSCRIPT_RAISE_RATIO = 0.33, DEFAULT_SUBSCRIPT_LOWER_RATIO = 0.14, hasVerticalPositioning = (run2) => normalizeBaselineShift(run2.baselineShift) != null || run2.vertAlign === "superscript" || run2.vertAlign === "subscript", applyRunVerticalPositioning = (element3, run2) => {
|
|
283188
282655
|
if (hasVerticalPositioning(run2))
|
|
283189
282656
|
element3.style.lineHeight = "1";
|
|
283190
282657
|
const explicitBaselineShift = normalizeBaselineShift(run2.baselineShift);
|
|
@@ -283911,19 +283378,13 @@ menclose::after {
|
|
|
283911
283378
|
};
|
|
283912
283379
|
return {
|
|
283913
283380
|
paint(input2, mount, mapping) {
|
|
283914
|
-
const normalizedInput =
|
|
283381
|
+
const normalizedInput = isDomPainterInput(input2) ? input2 : buildLegacyPaintInput(input2, legacyState, options.flowMode, options.pageGap);
|
|
283915
283382
|
painter.paint(normalizedInput, mount, mapping);
|
|
283916
283383
|
},
|
|
283917
|
-
setData(blocks2, measures
|
|
283384
|
+
setData(blocks2, measures) {
|
|
283918
283385
|
assertRequiredBlockMeasurePair("body", blocks2, measures);
|
|
283919
|
-
const normalizedHeader = normalizeOptionalBlockMeasurePair("header", headerBlocks, headerMeasures);
|
|
283920
|
-
const normalizedFooter = normalizeOptionalBlockMeasurePair("footer", footerBlocks, footerMeasures);
|
|
283921
283386
|
legacyState.blocks = blocks2;
|
|
283922
283387
|
legacyState.measures = measures;
|
|
283923
|
-
legacyState.headerBlocks = normalizedHeader?.blocks;
|
|
283924
|
-
legacyState.headerMeasures = normalizedHeader?.measures;
|
|
283925
|
-
legacyState.footerBlocks = normalizedFooter?.blocks;
|
|
283926
|
-
legacyState.footerMeasures = normalizedFooter?.measures;
|
|
283927
283388
|
},
|
|
283928
283389
|
setResolvedLayout(resolvedLayout) {
|
|
283929
283390
|
legacyState.resolvedLayout = resolvedLayout;
|
|
@@ -290552,7 +290013,7 @@ menclose::after {
|
|
|
290552
290013
|
}
|
|
290553
290014
|
const region = this.#callbacks.hitTestHeaderFooterRegion?.(normalized.x, normalized.y, normalized.pageIndex, normalized.pageLocalY);
|
|
290554
290015
|
if (region) {
|
|
290555
|
-
if (sessionMode === "body") {
|
|
290016
|
+
if (sessionMode === "body" || this.#isDifferentHeaderFooterRegionFromActiveSession(region)) {
|
|
290556
290017
|
event.preventDefault();
|
|
290557
290018
|
event.stopPropagation();
|
|
290558
290019
|
this.#callbacks.activateHeaderFooterRegion?.(region, {
|
|
@@ -290840,17 +290301,49 @@ menclose::after {
|
|
|
290840
290301
|
this.#callbacks.exitHeaderFooterMode?.();
|
|
290841
290302
|
return false;
|
|
290842
290303
|
}
|
|
290843
|
-
|
|
290304
|
+
const headerFooterRegion = this.#callbacks.hitTestHeaderFooterRegion?.(x, y$1, pageIndex, pageLocalY);
|
|
290305
|
+
if (!headerFooterRegion) {
|
|
290844
290306
|
this.#callbacks.exitHeaderFooterMode?.();
|
|
290845
290307
|
return false;
|
|
290846
290308
|
}
|
|
290847
290309
|
if (visiblePointerSurface?.kind === "headerFooter" && !clickedInsideVisibleActiveSurface) {
|
|
290310
|
+
if (this.#isDifferentHeaderFooterRegionFromActiveSession(headerFooterRegion)) {
|
|
290311
|
+
event.preventDefault();
|
|
290312
|
+
return true;
|
|
290313
|
+
}
|
|
290848
290314
|
this.#callbacks.exitHeaderFooterMode?.();
|
|
290849
290315
|
return false;
|
|
290850
290316
|
}
|
|
290851
290317
|
this.#syncNonBodyCommentSelection(event, event.target, this.#deps.getEditor(), { clearOnMiss: true });
|
|
290852
290318
|
return false;
|
|
290853
290319
|
}
|
|
290320
|
+
#isDifferentHeaderFooterRegionFromActiveSession(region) {
|
|
290321
|
+
const session = this.#deps?.getHeaderFooterSession()?.session;
|
|
290322
|
+
if (!session || session.mode === "body")
|
|
290323
|
+
return true;
|
|
290324
|
+
if (session.mode !== region.kind)
|
|
290325
|
+
return true;
|
|
290326
|
+
if (session.headerFooterRefId && region.headerFooterRefId && session.headerFooterRefId !== region.headerFooterRefId)
|
|
290327
|
+
return true;
|
|
290328
|
+
if (Number.isFinite(session.pageIndex) && Number.isFinite(region.pageIndex) && session.pageIndex !== region.pageIndex)
|
|
290329
|
+
return true;
|
|
290330
|
+
return (session.sectionType ?? null) !== (region.sectionType ?? null);
|
|
290331
|
+
}
|
|
290332
|
+
#isSameHeaderFooterRegion(left$1, right$1) {
|
|
290333
|
+
if (!left$1 || !right$1)
|
|
290334
|
+
return false;
|
|
290335
|
+
if (left$1.kind !== right$1.kind || left$1.pageIndex !== right$1.pageIndex)
|
|
290336
|
+
return false;
|
|
290337
|
+
if ((left$1.sectionId ?? null) !== (right$1.sectionId ?? null))
|
|
290338
|
+
return false;
|
|
290339
|
+
if ((left$1.sectionType ?? null) !== (right$1.sectionType ?? null))
|
|
290340
|
+
return false;
|
|
290341
|
+
const leftRefId = left$1.headerFooterRefId ?? null;
|
|
290342
|
+
const rightRefId = right$1.headerFooterRefId ?? null;
|
|
290343
|
+
if (leftRefId && rightRefId && leftRefId !== rightRefId)
|
|
290344
|
+
return false;
|
|
290345
|
+
return true;
|
|
290346
|
+
}
|
|
290854
290347
|
#handleInlineImageClick(event, targetImg, rawHit, doc$12, epochMapper) {
|
|
290855
290348
|
if (!targetImg)
|
|
290856
290349
|
return false;
|
|
@@ -291042,21 +290535,22 @@ menclose::after {
|
|
|
291042
290535
|
#handleHover(normalized) {
|
|
291043
290536
|
if (!this.#deps)
|
|
291044
290537
|
return;
|
|
291045
|
-
if ((this.#deps.getHeaderFooterSession()?.session?.mode ?? "body") !== "body") {
|
|
291046
|
-
this.#callbacks.clearHoverRegion?.();
|
|
291047
|
-
return;
|
|
291048
|
-
}
|
|
291049
290538
|
if (this.#deps.getDocumentMode() === "viewing") {
|
|
291050
290539
|
this.#callbacks.clearHoverRegion?.();
|
|
291051
290540
|
return;
|
|
291052
290541
|
}
|
|
290542
|
+
const sessionMode = this.#deps.getHeaderFooterSession()?.session?.mode ?? "body";
|
|
291053
290543
|
const region = this.#callbacks.hitTestHeaderFooterRegion?.(normalized.x, normalized.y, normalized.pageIndex, normalized.pageLocalY);
|
|
291054
290544
|
if (!region) {
|
|
291055
290545
|
this.#callbacks.clearHoverRegion?.();
|
|
291056
290546
|
return;
|
|
291057
290547
|
}
|
|
290548
|
+
if (sessionMode !== "body" && !this.#isDifferentHeaderFooterRegionFromActiveSession(region)) {
|
|
290549
|
+
this.#callbacks.clearHoverRegion?.();
|
|
290550
|
+
return;
|
|
290551
|
+
}
|
|
291058
290552
|
const currentHover = this.#deps.getHeaderFooterSession()?.hoverRegion;
|
|
291059
|
-
if (currentHover
|
|
290553
|
+
if (this.#isSameHeaderFooterRegion(currentHover, region))
|
|
291060
290554
|
return;
|
|
291061
290555
|
this.#deps.getHeaderFooterSession()?.renderHover(region);
|
|
291062
290556
|
this.#callbacks.renderHoverRegion?.(region);
|
|
@@ -292510,6 +292004,7 @@ menclose::after {
|
|
|
292510
292004
|
#hoverOverlay = null;
|
|
292511
292005
|
#hoverTooltip = null;
|
|
292512
292006
|
#modeBanner = null;
|
|
292007
|
+
#activeBorderLine = null;
|
|
292513
292008
|
#hoverRegion = null;
|
|
292514
292009
|
#documentMode = "editing";
|
|
292515
292010
|
#trackedChangesRenderConfig = {
|
|
@@ -292733,6 +292228,7 @@ menclose::after {
|
|
|
292733
292228
|
if (!region.sectionId)
|
|
292734
292229
|
console.error("[HeaderFooterSessionManager] Footer region missing sectionId", region);
|
|
292735
292230
|
}
|
|
292231
|
+
this.#syncActiveBorder();
|
|
292736
292232
|
}
|
|
292737
292233
|
#buildSectionIdMap() {
|
|
292738
292234
|
const map$12 = /* @__PURE__ */ new Map;
|
|
@@ -292960,22 +292456,11 @@ menclose::after {
|
|
|
292960
292456
|
});
|
|
292961
292457
|
return null;
|
|
292962
292458
|
}
|
|
292459
|
+
const shouldRestoreInitialSelection = options?.initialSelection !== "defer";
|
|
292963
292460
|
try {
|
|
292964
292461
|
this.#applyChildEditorDocumentMode(editor, this.#documentMode);
|
|
292965
|
-
if (
|
|
292966
|
-
|
|
292967
|
-
const doc$12 = editor.state?.doc;
|
|
292968
|
-
if (doc$12) {
|
|
292969
|
-
const endPos = doc$12.content.size - 1;
|
|
292970
|
-
const pos = Math.max(1, endPos);
|
|
292971
|
-
editor.commands?.setTextSelection?.({
|
|
292972
|
-
from: pos,
|
|
292973
|
-
to: pos
|
|
292974
|
-
});
|
|
292975
|
-
}
|
|
292976
|
-
} catch (cursorError) {
|
|
292977
|
-
console.warn("[HeaderFooterSessionManager] Could not set cursor to end:", cursorError);
|
|
292978
|
-
}
|
|
292462
|
+
if (shouldRestoreInitialSelection)
|
|
292463
|
+
this.#applyDefaultSelectionAtStoryEnd(editor, "Could not set cursor to end");
|
|
292979
292464
|
} catch (editableError) {
|
|
292980
292465
|
console.error("[HeaderFooterSessionManager] Error setting editor editable:", editableError);
|
|
292981
292466
|
this.clearHover();
|
|
@@ -293001,6 +292486,15 @@ menclose::after {
|
|
|
293001
292486
|
} catch (focusError) {
|
|
293002
292487
|
console.warn("[HeaderFooterSessionManager] Could not focus editor:", focusError);
|
|
293003
292488
|
}
|
|
292489
|
+
if (shouldRestoreInitialSelection) {
|
|
292490
|
+
this.#applyDefaultSelectionAtStoryEnd(editor, "Could not restore cursor after focus");
|
|
292491
|
+
try {
|
|
292492
|
+
editor.view?.focus();
|
|
292493
|
+
} catch (focusError) {
|
|
292494
|
+
console.warn("[HeaderFooterSessionManager] Could not refocus editor after restoring selection:", focusError);
|
|
292495
|
+
}
|
|
292496
|
+
this.#scheduleSelectionRestoreAfterFocus(editor);
|
|
292497
|
+
}
|
|
293004
292498
|
this.#emitModeChanged();
|
|
293005
292499
|
this.#emitEditingContext(editor);
|
|
293006
292500
|
this.#deps?.notifyInputBridgeTargetChanged();
|
|
@@ -293046,6 +292540,45 @@ menclose::after {
|
|
|
293046
292540
|
pm.classList.toggle("view-mode", mode === "viewing");
|
|
293047
292541
|
}
|
|
293048
292542
|
}
|
|
292543
|
+
#getDefaultSelectionAtStoryEnd(editor) {
|
|
292544
|
+
const doc$12 = editor.state?.doc;
|
|
292545
|
+
if (!doc$12)
|
|
292546
|
+
return null;
|
|
292547
|
+
const endPos = doc$12.content.size - 1;
|
|
292548
|
+
const pos = Math.max(1, endPos);
|
|
292549
|
+
return {
|
|
292550
|
+
from: pos,
|
|
292551
|
+
to: pos
|
|
292552
|
+
};
|
|
292553
|
+
}
|
|
292554
|
+
#applyEditorTextSelection(editor, selection, warningMessage) {
|
|
292555
|
+
try {
|
|
292556
|
+
editor.commands?.setTextSelection?.(selection);
|
|
292557
|
+
} catch (error3) {
|
|
292558
|
+
console.warn(`[HeaderFooterSessionManager] ${warningMessage}:`, error3);
|
|
292559
|
+
}
|
|
292560
|
+
}
|
|
292561
|
+
#applyDefaultSelectionAtStoryEnd(editor, warningMessage) {
|
|
292562
|
+
const selection = this.#getDefaultSelectionAtStoryEnd(editor);
|
|
292563
|
+
if (!selection)
|
|
292564
|
+
return;
|
|
292565
|
+
this.#applyEditorTextSelection(editor, selection, warningMessage);
|
|
292566
|
+
}
|
|
292567
|
+
#scheduleSelectionRestoreAfterFocus(editor) {
|
|
292568
|
+
const win = editor.view?.dom?.ownerDocument?.defaultView;
|
|
292569
|
+
if (!win)
|
|
292570
|
+
return;
|
|
292571
|
+
win.requestAnimationFrame(() => {
|
|
292572
|
+
if (this.#activeEditor !== editor || this.#session.mode === "body")
|
|
292573
|
+
return;
|
|
292574
|
+
this.#applyDefaultSelectionAtStoryEnd(editor, "Could not restore cursor on the next frame");
|
|
292575
|
+
try {
|
|
292576
|
+
editor.view?.focus();
|
|
292577
|
+
} catch (focusError) {
|
|
292578
|
+
console.warn("[HeaderFooterSessionManager] Could not refocus editor on the next frame:", focusError);
|
|
292579
|
+
}
|
|
292580
|
+
});
|
|
292581
|
+
}
|
|
293049
292582
|
#validateEditPermission() {
|
|
293050
292583
|
if (this.#deps?.isViewLocked())
|
|
293051
292584
|
return {
|
|
@@ -293078,6 +292611,7 @@ menclose::after {
|
|
|
293078
292611
|
this.#callbacks.onModeChanged?.(this.#session);
|
|
293079
292612
|
this.#callbacks.onUpdateAwarenessSession?.(this.#session);
|
|
293080
292613
|
this.#updateModeBanner();
|
|
292614
|
+
this.#syncActiveBorder();
|
|
293081
292615
|
}
|
|
293082
292616
|
#emitEditingContext(editor) {
|
|
293083
292617
|
this.#callbacks.onEditingContext?.({
|
|
@@ -293181,6 +292715,42 @@ menclose::after {
|
|
|
293181
292715
|
get hoverRegion() {
|
|
293182
292716
|
return this.#hoverRegion;
|
|
293183
292717
|
}
|
|
292718
|
+
#getActiveRegion() {
|
|
292719
|
+
if (this.#session.mode === "header")
|
|
292720
|
+
return this.#headerRegions.get(this.#session.pageIndex ?? -1) ?? null;
|
|
292721
|
+
if (this.#session.mode === "footer")
|
|
292722
|
+
return this.#footerRegions.get(this.#session.pageIndex ?? -1) ?? null;
|
|
292723
|
+
return null;
|
|
292724
|
+
}
|
|
292725
|
+
#hideActiveBorder() {
|
|
292726
|
+
if (this.#activeBorderLine) {
|
|
292727
|
+
this.#activeBorderLine.remove();
|
|
292728
|
+
this.#activeBorderLine = null;
|
|
292729
|
+
}
|
|
292730
|
+
}
|
|
292731
|
+
#syncActiveBorder() {
|
|
292732
|
+
this.#hideActiveBorder();
|
|
292733
|
+
const region = this.#getActiveRegion();
|
|
292734
|
+
if (!region || this.#session.mode === "body")
|
|
292735
|
+
return;
|
|
292736
|
+
const pageElement = this.#deps?.getPageElement(region.pageIndex);
|
|
292737
|
+
if (!pageElement)
|
|
292738
|
+
return;
|
|
292739
|
+
const borderLine = pageElement.ownerDocument.createElement("div");
|
|
292740
|
+
borderLine.className = "superdoc-header-footer-border";
|
|
292741
|
+
Object.assign(borderLine.style, {
|
|
292742
|
+
position: "absolute",
|
|
292743
|
+
left: "0",
|
|
292744
|
+
right: "0",
|
|
292745
|
+
top: `${region.kind === "header" ? region.localY + region.height : region.localY}px`,
|
|
292746
|
+
height: "1px",
|
|
292747
|
+
backgroundColor: "#4472c4",
|
|
292748
|
+
pointerEvents: "none",
|
|
292749
|
+
zIndex: "8"
|
|
292750
|
+
});
|
|
292751
|
+
pageElement.appendChild(borderLine);
|
|
292752
|
+
this.#activeBorderLine = borderLine;
|
|
292753
|
+
}
|
|
293184
292754
|
buildLayoutInput() {
|
|
293185
292755
|
if (!this.#headerFooterAdapter)
|
|
293186
292756
|
return null;
|
|
@@ -293834,6 +293404,7 @@ menclose::after {
|
|
|
293834
293404
|
this.#footerRegions.clear();
|
|
293835
293405
|
this.#session = { mode: "body" };
|
|
293836
293406
|
this.#activeEditor = null;
|
|
293407
|
+
this.#hideActiveBorder();
|
|
293837
293408
|
this.#hoverOverlay = null;
|
|
293838
293409
|
this.#hoverTooltip = null;
|
|
293839
293410
|
this.#modeBanner = null;
|
|
@@ -294035,12 +293606,12 @@ menclose::after {
|
|
|
294035
293606
|
return;
|
|
294036
293607
|
console.log(...args$1);
|
|
294037
293608
|
}, HEADER_FOOTER_INIT_BUDGET_MS = 200, MAX_ZOOM_WARNING_THRESHOLD = 10, MAX_SELECTION_RECTS_PER_USER = 100, SEMANTIC_RESIZE_DEBOUNCE_MS = 120, MIN_SEMANTIC_CONTENT_WIDTH_PX = 1, GLOBAL_PERFORMANCE, PresentationEditor, ICONS, TEXTS, tableActionsOptions;
|
|
294038
|
-
var
|
|
293609
|
+
var init_src_BFNW1Ck5_es = __esm(() => {
|
|
294039
293610
|
init_rolldown_runtime_Bg48TavK_es();
|
|
294040
|
-
|
|
293611
|
+
init_SuperConverter_D54XfHFt_es();
|
|
294041
293612
|
init_jszip_C49i9kUs_es();
|
|
294042
293613
|
init_uuid_qzgm05fK_es();
|
|
294043
|
-
|
|
293614
|
+
init_create_headless_toolbar_DrE9IMiD_es();
|
|
294044
293615
|
init_constants_CGhJRd87_es();
|
|
294045
293616
|
init_dist_B8HfvhaK_es();
|
|
294046
293617
|
init_unified_Dsuw2be5_es();
|
|
@@ -295596,7 +295167,7 @@ ${err.toString()}`);
|
|
|
295596
295167
|
isRightClick = true;
|
|
295597
295168
|
} else {
|
|
295598
295169
|
const relativePoint = getSurfaceRelativePoint(editor, meta2);
|
|
295599
|
-
const surface = editor
|
|
295170
|
+
const surface = getEditorSurfaceElement(editor);
|
|
295600
295171
|
if (relativePoint && surface)
|
|
295601
295172
|
try {
|
|
295602
295173
|
const rect = surface.getBoundingClientRect();
|
|
@@ -295616,7 +295187,7 @@ ${err.toString()}`);
|
|
|
295616
295187
|
return ensureStateShape(value);
|
|
295617
295188
|
}
|
|
295618
295189
|
}
|
|
295619
|
-
const containingBlock = findContainingBlockAncestor(editor
|
|
295190
|
+
const containingBlock = findContainingBlockAncestor(getEditorSurfaceElement(editor));
|
|
295620
295191
|
if (containingBlock)
|
|
295621
295192
|
try {
|
|
295622
295193
|
const cbRect = containingBlock.getBoundingClientRect();
|
|
@@ -318949,6 +318520,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
318949
318520
|
}
|
|
318950
318521
|
async exportDocx({ isFinalDoc = false, commentsType = "external", exportJsonOnly = false, exportXmlOnly = false, comments, getUpdatedDocs = false, fieldsHighlightColor = null, compression } = {}) {
|
|
318951
318522
|
try {
|
|
318523
|
+
commitLiveStorySessionRuntimes(resolveMainBodyEditor(this));
|
|
318952
318524
|
const preparedComments = (comments ?? this.converter.comments ?? []).map((comment2) => {
|
|
318953
318525
|
const elements = Array.isArray(comment2.elements) && comment2.elements.length ? comment2.elements : undefined;
|
|
318954
318526
|
return {
|
|
@@ -319951,7 +319523,6 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
319951
319523
|
this.options = options;
|
|
319952
319524
|
this.layoutMode = options.layoutMode ?? "vertical";
|
|
319953
319525
|
this.isSemanticFlow = (options.flowMode ?? "paginated") === "semantic";
|
|
319954
|
-
this.blockLookup = /* @__PURE__ */ new Map;
|
|
319955
319526
|
this.headerProvider = options.headerProvider;
|
|
319956
319527
|
this.footerProvider = options.footerProvider;
|
|
319957
319528
|
const defaultGap = this.layoutMode === "horizontal" ? 20 : 24;
|
|
@@ -320138,45 +319709,10 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
320138
319709
|
entities: collectPaintSnapshotEntitiesFromDomRoot(rootEl)
|
|
320139
319710
|
};
|
|
320140
319711
|
}
|
|
320141
|
-
normalizeOptionalBlockMeasurePair(label, blocks2, measures) {
|
|
320142
|
-
const hasBlocks = blocks2 !== undefined;
|
|
320143
|
-
const hasMeasures = measures !== undefined;
|
|
320144
|
-
if (hasBlocks !== hasMeasures)
|
|
320145
|
-
throw new Error(`DomPainter.paint requires ${label}Blocks and ${label}Measures to both be provided or both be omitted`);
|
|
320146
|
-
if (!hasBlocks || !hasMeasures)
|
|
320147
|
-
return;
|
|
320148
|
-
return {
|
|
320149
|
-
blocks: blocks2,
|
|
320150
|
-
measures
|
|
320151
|
-
};
|
|
320152
|
-
}
|
|
320153
|
-
updateBlockLookup(input2) {
|
|
320154
|
-
const { blocks: blocks2, measures, headerBlocks, headerMeasures, footerBlocks, footerMeasures } = input2;
|
|
320155
|
-
const resolvedBlockVersions = this.resolvedLayout?.blockVersions;
|
|
320156
|
-
const nextLookup = this.buildBlockLookup(blocks2, measures, resolvedBlockVersions);
|
|
320157
|
-
const normalizedHeader = this.normalizeOptionalBlockMeasurePair("header", headerBlocks, headerMeasures);
|
|
320158
|
-
if (normalizedHeader)
|
|
320159
|
-
this.buildBlockLookup(normalizedHeader.blocks, normalizedHeader.measures, resolvedBlockVersions).forEach((entry, id2) => {
|
|
320160
|
-
nextLookup.set(id2, entry);
|
|
320161
|
-
});
|
|
320162
|
-
const normalizedFooter = this.normalizeOptionalBlockMeasurePair("footer", footerBlocks, footerMeasures);
|
|
320163
|
-
if (normalizedFooter)
|
|
320164
|
-
this.buildBlockLookup(normalizedFooter.blocks, normalizedFooter.measures, resolvedBlockVersions).forEach((entry, id2) => {
|
|
320165
|
-
nextLookup.set(id2, entry);
|
|
320166
|
-
});
|
|
320167
|
-
const changed = /* @__PURE__ */ new Set;
|
|
320168
|
-
nextLookup.forEach((entry, id2) => {
|
|
320169
|
-
const previous3 = this.blockLookup.get(id2);
|
|
320170
|
-
if (!previous3 || previous3.version !== entry.version)
|
|
320171
|
-
changed.add(id2);
|
|
320172
|
-
});
|
|
320173
|
-
this.blockLookup = nextLookup;
|
|
320174
|
-
this.changedBlocks = changed;
|
|
320175
|
-
}
|
|
320176
319712
|
paint(input2, mount, mapping) {
|
|
320177
319713
|
const layout = input2.sourceLayout;
|
|
320178
319714
|
this.resolvedLayout = input2.resolvedLayout;
|
|
320179
|
-
this.
|
|
319715
|
+
this.changedBlocks.clear();
|
|
320180
319716
|
if (!(mount instanceof HTMLElement))
|
|
320181
319717
|
throw new Error("DomPainter.paint requires a valid HTMLElement mount");
|
|
320182
319718
|
const doc$12 = mount.ownerDocument ?? (typeof document !== "undefined" ? document : null);
|
|
@@ -320190,7 +319726,6 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
320190
319726
|
for (const item of page.items)
|
|
320191
319727
|
if ("blockId" in item)
|
|
320192
319728
|
this.changedBlocks.add(item.blockId);
|
|
320193
|
-
this.blockLookup.forEach((_$1, id2) => this.changedBlocks.add(id2));
|
|
320194
319729
|
this.currentMapping = null;
|
|
320195
319730
|
} else
|
|
320196
319731
|
this.currentMapping = mapping ?? null;
|
|
@@ -320610,8 +320145,9 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
320610
320145
|
pageNumberText: resolvedPage?.numberText ?? page.numberText,
|
|
320611
320146
|
pageIndex
|
|
320612
320147
|
};
|
|
320613
|
-
const
|
|
320614
|
-
const
|
|
320148
|
+
const resolvedItems = resolvedPage?.items ?? [];
|
|
320149
|
+
const sdtBoundaries = computeSdtBoundaries(page.fragments, resolvedItems, this.sdtLabelsRendered);
|
|
320150
|
+
const betweenBorderFlags = computeBetweenBorderFlags(page.fragments, resolvedItems);
|
|
320615
320151
|
page.fragments.forEach((fragment2, index2) => {
|
|
320616
320152
|
const sdtBoundary = sdtBoundaries.get(index2);
|
|
320617
320153
|
const resolvedItem = this.getResolvedFragmentItem(pageIndex, index2);
|
|
@@ -320743,7 +320279,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
320743
320279
|
isPageRelativeAnchoredFragment(fragment2, resolvedItem) {
|
|
320744
320280
|
if (fragment2.kind !== "image" && fragment2.kind !== "drawing")
|
|
320745
320281
|
return false;
|
|
320746
|
-
const block =
|
|
320282
|
+
const block = resolvedItem && "block" in resolvedItem ? resolvedItem.block : undefined;
|
|
320747
320283
|
if (!block || block.kind !== "image" && block.kind !== "drawing")
|
|
320748
320284
|
return false;
|
|
320749
320285
|
return block.anchor?.vRelativeFrom === "page";
|
|
@@ -320812,14 +320348,17 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
320812
320348
|
pageNumberText: resolvedPage?.numberText ?? page.numberText,
|
|
320813
320349
|
pageIndex
|
|
320814
320350
|
};
|
|
320815
|
-
const
|
|
320351
|
+
const decorationItems = data.items ?? [];
|
|
320352
|
+
const betweenBorderFlags = computeBetweenBorderFlags(data.fragments, decorationItems);
|
|
320816
320353
|
const behindDocFragments = [];
|
|
320817
320354
|
const normalFragments = [];
|
|
320818
320355
|
for (let fi = 0;fi < data.fragments.length; fi += 1) {
|
|
320819
320356
|
const fragment2 = data.fragments[fi];
|
|
320820
320357
|
let isBehindDoc = false;
|
|
320821
|
-
if (fragment2.kind === "image" || fragment2.kind === "drawing")
|
|
320822
|
-
|
|
320358
|
+
if (fragment2.kind === "image" || fragment2.kind === "drawing") {
|
|
320359
|
+
const resolvedItem = decorationItems[fi];
|
|
320360
|
+
isBehindDoc = fragment2.behindDoc === true || fragment2.behindDoc == null && "zIndex" in fragment2 && fragment2.zIndex === 0 || this.shouldRenderBehindPageContent(fragment2, kind, resolvedItem);
|
|
320361
|
+
}
|
|
320823
320362
|
if (isBehindDoc)
|
|
320824
320363
|
behindDocFragments.push({
|
|
320825
320364
|
fragment: fragment2,
|
|
@@ -320953,8 +320492,9 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
320953
320492
|
pageEl.dataset.layoutEpoch = String(this.layoutEpoch);
|
|
320954
320493
|
const existing = new Map(state.fragments.map((frag) => [frag.key, frag]));
|
|
320955
320494
|
const nextFragments = [];
|
|
320956
|
-
const
|
|
320957
|
-
const
|
|
320495
|
+
const resolvedItems = resolvedPage?.items ?? [];
|
|
320496
|
+
const sdtBoundaries = computeSdtBoundaries(page.fragments, resolvedItems, this.sdtLabelsRendered);
|
|
320497
|
+
const betweenBorderFlags = computeBetweenBorderFlags(page.fragments, resolvedItems);
|
|
320958
320498
|
const contextBase = {
|
|
320959
320499
|
pageNumber: page.number,
|
|
320960
320500
|
totalPages: this.totalPages,
|
|
@@ -320968,6 +320508,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
320968
320508
|
const sdtBoundary = sdtBoundaries.get(index2);
|
|
320969
320509
|
const betweenInfo = betweenBorderFlags.get(index2);
|
|
320970
320510
|
const resolvedItem = this.getResolvedFragmentItem(pageIndex, index2);
|
|
320511
|
+
const resolvedSig = resolvedItem?.version ?? "";
|
|
320971
320512
|
if (current) {
|
|
320972
320513
|
existing.delete(key2);
|
|
320973
320514
|
const geometryChanged = hasFragmentGeometryChanged(current.fragment, fragment2);
|
|
@@ -320975,12 +320516,11 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
320975
320516
|
const betweenBorderMismatch = current.element.dataset.betweenBorder === "true" !== (betweenInfo?.showBetweenBorder ?? false) || current.element.dataset.suppressTopBorder === "true" !== (betweenInfo?.suppressTopBorder ?? false) || (current.element.dataset.gapBelow ?? "") !== (betweenInfo?.gapBelow ? String(betweenInfo.gapBelow) : "");
|
|
320976
320517
|
const newPmStart = fragment2.pmStart;
|
|
320977
320518
|
const mappingUnreliable = this.currentMapping != null && newPmStart != null && current.element.dataset.pmStart != null && this.currentMapping.map(Number(current.element.dataset.pmStart)) !== newPmStart;
|
|
320978
|
-
|
|
320979
|
-
if (geometryChanged || this.changedBlocks.has(fragment2.blockId) || current.signature !== (resolvedSig ?? fragmentSignature$1(fragment2, this.blockLookup)) || sdtBoundaryMismatch || betweenBorderMismatch || mappingUnreliable) {
|
|
320519
|
+
if (geometryChanged || this.changedBlocks.has(fragment2.blockId) || current.signature !== resolvedSig || sdtBoundaryMismatch || betweenBorderMismatch || mappingUnreliable) {
|
|
320980
320520
|
const replacement = this.renderFragment(fragment2, contextBase, sdtBoundary, betweenInfo, resolvedItem);
|
|
320981
320521
|
pageEl.replaceChild(replacement, current.element);
|
|
320982
320522
|
current.element = replacement;
|
|
320983
|
-
current.signature = resolvedSig
|
|
320523
|
+
current.signature = resolvedSig;
|
|
320984
320524
|
} else if (this.currentMapping)
|
|
320985
320525
|
this.updatePositionAttributes(current.element, this.currentMapping);
|
|
320986
320526
|
this.updateFragmentElement(current.element, fragment2, contextBase.section, resolvedItem);
|
|
@@ -320994,12 +320534,11 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
320994
320534
|
}
|
|
320995
320535
|
const fresh = this.renderFragment(fragment2, contextBase, sdtBoundary, betweenInfo, resolvedItem);
|
|
320996
320536
|
pageEl.insertBefore(fresh, pageEl.children[index2] ?? null);
|
|
320997
|
-
const freshSig = resolvedItem && "version" in resolvedItem ? resolvedItem.version : undefined;
|
|
320998
320537
|
nextFragments.push({
|
|
320999
320538
|
key: key2,
|
|
321000
320539
|
fragment: fragment2,
|
|
321001
320540
|
element: fresh,
|
|
321002
|
-
signature:
|
|
320541
|
+
signature: resolvedSig,
|
|
321003
320542
|
context: contextBase
|
|
321004
320543
|
});
|
|
321005
320544
|
});
|
|
@@ -321061,17 +320600,18 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
321061
320600
|
pageNumberText: resolvedPage?.numberText ?? page.numberText,
|
|
321062
320601
|
pageIndex
|
|
321063
320602
|
};
|
|
321064
|
-
const
|
|
321065
|
-
const
|
|
320603
|
+
const resolvedItems = resolvedPage?.items ?? [];
|
|
320604
|
+
const sdtBoundaries = computeSdtBoundaries(page.fragments, resolvedItems, this.sdtLabelsRendered);
|
|
320605
|
+
const betweenBorderFlags = computeBetweenBorderFlags(page.fragments, resolvedItems);
|
|
321066
320606
|
const fragmentStates = page.fragments.map((fragment2, index2) => {
|
|
321067
320607
|
const sdtBoundary = sdtBoundaries.get(index2);
|
|
321068
320608
|
const resolvedItem = this.getResolvedFragmentItem(pageIndex, index2);
|
|
321069
320609
|
const fragmentEl = this.renderFragment(fragment2, contextBase, sdtBoundary, betweenBorderFlags.get(index2), resolvedItem);
|
|
321070
320610
|
el.appendChild(fragmentEl);
|
|
321071
|
-
const initSig = resolvedItem
|
|
320611
|
+
const initSig = resolvedItem?.version ?? "";
|
|
321072
320612
|
return {
|
|
321073
320613
|
key: fragmentKey(fragment2),
|
|
321074
|
-
signature: initSig
|
|
320614
|
+
signature: initSig,
|
|
321075
320615
|
fragment: fragment2,
|
|
321076
320616
|
element: fragmentEl,
|
|
321077
320617
|
context: contextBase
|
|
@@ -321126,7 +320666,10 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
321126
320666
|
try {
|
|
321127
320667
|
if (!this.doc)
|
|
321128
320668
|
throw new Error("DomPainter: document is not available");
|
|
321129
|
-
|
|
320669
|
+
if (resolvedItem?.block?.kind !== "paragraph" || resolvedItem?.measure?.kind !== "paragraph")
|
|
320670
|
+
throw new Error(`DomPainter: missing resolved paragraph block/measure for fragment ${fragment2.blockId}`);
|
|
320671
|
+
const block = resolvedItem.block;
|
|
320672
|
+
const measure = resolvedItem.measure;
|
|
321130
320673
|
const wordLayout = isMinimalWordLayout$1(block.attrs?.wordLayout) ? block.attrs.wordLayout : undefined;
|
|
321131
320674
|
const content3 = resolvedItem?.content;
|
|
321132
320675
|
const paraContinuesFromPrev = resolvedItem?.continuesFromPrev ?? fragment2.continuesFromPrev;
|
|
@@ -321478,7 +321021,10 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
321478
321021
|
try {
|
|
321479
321022
|
if (!this.doc)
|
|
321480
321023
|
throw new Error("DomPainter: document is not available");
|
|
321481
|
-
|
|
321024
|
+
if (resolvedItem?.block?.kind !== "list" || resolvedItem?.measure?.kind !== "list")
|
|
321025
|
+
throw new Error(`DomPainter: missing resolved list block/measure for fragment ${fragment2.blockId}`);
|
|
321026
|
+
const block = resolvedItem.block;
|
|
321027
|
+
const measure = resolvedItem.measure;
|
|
321482
321028
|
const item = block.items.find((entry) => entry.id === fragment2.itemId);
|
|
321483
321029
|
const itemMeasure = measure.items.find((entry) => entry.itemId === fragment2.itemId);
|
|
321484
321030
|
if (!item || !itemMeasure)
|
|
@@ -321577,7 +321123,9 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
321577
321123
|
}
|
|
321578
321124
|
renderImageFragment(fragment2, context, resolvedItem) {
|
|
321579
321125
|
try {
|
|
321580
|
-
|
|
321126
|
+
if (resolvedItem?.block?.kind !== "image")
|
|
321127
|
+
throw new Error(`DomPainter: missing resolved image block for fragment ${fragment2.blockId}`);
|
|
321128
|
+
const block = resolvedItem.block;
|
|
321581
321129
|
if (!this.doc)
|
|
321582
321130
|
throw new Error("DomPainter: document is not available");
|
|
321583
321131
|
const fragmentEl = this.doc.createElement("div");
|
|
@@ -321692,7 +321240,9 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
321692
321240
|
}
|
|
321693
321241
|
renderDrawingFragment(fragment2, context, resolvedItem) {
|
|
321694
321242
|
try {
|
|
321695
|
-
|
|
321243
|
+
if (resolvedItem?.block?.kind !== "drawing")
|
|
321244
|
+
throw new Error(`DomPainter: missing resolved drawing block for fragment ${fragment2.blockId}`);
|
|
321245
|
+
const block = resolvedItem.block;
|
|
321696
321246
|
if (!this.doc)
|
|
321697
321247
|
throw new Error("DomPainter: document is not available");
|
|
321698
321248
|
const fragmentEl = this.doc.createElement("div");
|
|
@@ -322355,23 +321905,13 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
322355
321905
|
return createChartElement(this.doc, block.chartData, block.geometry);
|
|
322356
321906
|
}
|
|
322357
321907
|
resolveTableRenderData(fragment2, resolvedItem) {
|
|
322358
|
-
if (resolvedItem)
|
|
322359
|
-
|
|
322360
|
-
block: resolvedItem.block,
|
|
322361
|
-
measure: resolvedItem.measure,
|
|
322362
|
-
cellSpacingPx: resolvedItem.cellSpacingPx,
|
|
322363
|
-
effectiveColumnWidths: resolvedItem.effectiveColumnWidths
|
|
322364
|
-
};
|
|
322365
|
-
const lookup3 = this.blockLookup.get(fragment2.blockId);
|
|
322366
|
-
if (!lookup3 || lookup3.block.kind !== "table" || lookup3.measure.kind !== "table")
|
|
322367
|
-
throw new Error(`DomPainter: missing table block for fragment ${fragment2.blockId}`);
|
|
322368
|
-
const block = lookup3.block;
|
|
322369
|
-
const measure = lookup3.measure;
|
|
321908
|
+
if (!resolvedItem)
|
|
321909
|
+
throw new Error(`DomPainter: missing resolved table item for fragment ${fragment2.blockId}`);
|
|
322370
321910
|
return {
|
|
322371
|
-
block,
|
|
322372
|
-
measure,
|
|
322373
|
-
cellSpacingPx:
|
|
322374
|
-
effectiveColumnWidths:
|
|
321911
|
+
block: resolvedItem.block,
|
|
321912
|
+
measure: resolvedItem.measure,
|
|
321913
|
+
cellSpacingPx: resolvedItem.cellSpacingPx,
|
|
321914
|
+
effectiveColumnWidths: resolvedItem.effectiveColumnWidths
|
|
322375
321915
|
};
|
|
322376
321916
|
}
|
|
322377
321917
|
renderTableFragment(fragment2, context, sdtBoundary, resolvedItem) {
|
|
@@ -323569,16 +323109,14 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
323569
323109
|
isAnchoredMediaFragment(fragment2) {
|
|
323570
323110
|
return (fragment2.kind === "image" || fragment2.kind === "drawing") && fragment2.isAnchored === true;
|
|
323571
323111
|
}
|
|
323572
|
-
shouldRenderBehindPageContent(fragment2, section) {
|
|
323112
|
+
shouldRenderBehindPageContent(fragment2, section, resolvedItem) {
|
|
323573
323113
|
if (fragment2.behindDoc === true || fragment2.behindDoc == null && "zIndex" in fragment2 && fragment2.zIndex === 0)
|
|
323574
323114
|
return true;
|
|
323575
|
-
return section === "header" && fragment2.kind === "drawing" && this.isHeaderWordArtWatermark(
|
|
323115
|
+
return section === "header" && fragment2.kind === "drawing" && this.isHeaderWordArtWatermark(resolvedItem?.block);
|
|
323576
323116
|
}
|
|
323577
|
-
isHeaderWordArtWatermark(
|
|
323578
|
-
|
|
323579
|
-
if (!lookup3 || lookup3.block.kind !== "drawing" || lookup3.block.drawingKind !== "vectorShape")
|
|
323117
|
+
isHeaderWordArtWatermark(block) {
|
|
323118
|
+
if (!block || block.kind !== "drawing" || block.drawingKind !== "vectorShape")
|
|
323580
323119
|
return false;
|
|
323581
|
-
const block = lookup3.block;
|
|
323582
323120
|
const attrs = block.attrs ?? {};
|
|
323583
323121
|
const hasTextContent = Array.isArray(block.textContent?.parts) && block.textContent.parts.length > 0;
|
|
323584
323122
|
return attrs.isWordArt === true && attrs.isTextBox === true && hasTextContent && block.anchor?.isAnchored === true && block.anchor.hRelativeFrom === "page" && block.anchor.alignH === "center" && block.anchor.vRelativeFrom === "page" && block.anchor.alignV === "center" && block.wrap?.type === "None";
|
|
@@ -323612,52 +323150,10 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
323612
323150
|
estimateFragmentHeight(fragment2, resolvedItem) {
|
|
323613
323151
|
if (resolvedItem && "height" in resolvedItem && typeof resolvedItem.height === "number")
|
|
323614
323152
|
return resolvedItem.height;
|
|
323615
|
-
|
|
323616
|
-
if (fragment2.kind === "para" && measure?.kind === "paragraph")
|
|
323617
|
-
return measure.totalHeight;
|
|
323618
|
-
if (fragment2.kind === "list-item" && measure?.kind === "list")
|
|
323619
|
-
return measure.totalHeight;
|
|
323620
|
-
if (fragment2.kind === "table")
|
|
323621
|
-
return fragment2.height;
|
|
323622
|
-
if (fragment2.kind === "image" || fragment2.kind === "drawing")
|
|
323153
|
+
if (fragment2.kind === "table" || fragment2.kind === "image" || fragment2.kind === "drawing")
|
|
323623
323154
|
return fragment2.height;
|
|
323624
323155
|
return 0;
|
|
323625
323156
|
}
|
|
323626
|
-
resolveBlockAndMeasure(fragment2, resolvedBlock, resolvedMeasure, blockKind, measureKind, errorLabel) {
|
|
323627
|
-
if (resolvedBlock?.kind === blockKind && resolvedMeasure?.kind === measureKind)
|
|
323628
|
-
return {
|
|
323629
|
-
block: resolvedBlock,
|
|
323630
|
-
measure: resolvedMeasure
|
|
323631
|
-
};
|
|
323632
|
-
const lookup3 = this.blockLookup.get(fragment2.blockId);
|
|
323633
|
-
if (!lookup3 || lookup3.block.kind !== blockKind || lookup3.measure.kind !== measureKind)
|
|
323634
|
-
throw new Error(`DomPainter: missing ${errorLabel} for fragment ${fragment2.blockId}`);
|
|
323635
|
-
return {
|
|
323636
|
-
block: lookup3.block,
|
|
323637
|
-
measure: lookup3.measure
|
|
323638
|
-
};
|
|
323639
|
-
}
|
|
323640
|
-
resolveBlock(fragment2, resolvedBlock, blockKind, errorLabel) {
|
|
323641
|
-
if (resolvedBlock?.kind === blockKind)
|
|
323642
|
-
return resolvedBlock;
|
|
323643
|
-
const lookup3 = this.blockLookup.get(fragment2.blockId);
|
|
323644
|
-
if (!lookup3 || lookup3.block.kind !== blockKind)
|
|
323645
|
-
throw new Error(`DomPainter: missing ${errorLabel} for fragment ${fragment2.blockId}`);
|
|
323646
|
-
return lookup3.block;
|
|
323647
|
-
}
|
|
323648
|
-
buildBlockLookup(blocks2, measures, precomputedVersions) {
|
|
323649
|
-
if (blocks2.length !== measures.length)
|
|
323650
|
-
throw new Error("DomPainter requires the same number of blocks and measures");
|
|
323651
|
-
const lookup3 = /* @__PURE__ */ new Map;
|
|
323652
|
-
blocks2.forEach((block, index2) => {
|
|
323653
|
-
lookup3.set(block.id, {
|
|
323654
|
-
block,
|
|
323655
|
-
measure: measures[index2],
|
|
323656
|
-
version: precomputedVersions?.[block.id] ?? deriveBlockVersion$1(block)
|
|
323657
|
-
});
|
|
323658
|
-
});
|
|
323659
|
-
return lookup3;
|
|
323660
|
-
}
|
|
323661
323157
|
static {
|
|
323662
323158
|
this.SDT_DATASET_KEYS = [
|
|
323663
323159
|
"sdtType",
|
|
@@ -324979,6 +324475,10 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
324979
324475
|
#storySessionSelectionHandler = null;
|
|
324980
324476
|
#storySessionTransactionHandler = null;
|
|
324981
324477
|
#storySessionEditor = null;
|
|
324478
|
+
#activeSurfaceUiEventEditor = null;
|
|
324479
|
+
#activeSurfaceUiUpdateHandler = null;
|
|
324480
|
+
#activeSurfaceUiContextMenuOpenHandler = null;
|
|
324481
|
+
#activeSurfaceUiContextMenuCloseHandler = null;
|
|
324982
324482
|
#lastSelectedFieldAnnotation = null;
|
|
324983
324483
|
#lastSelectedStructuredContentBlock = null;
|
|
324984
324484
|
#lastSelectedStructuredContentInline = null;
|
|
@@ -325372,6 +324872,19 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
325372
324872
|
return null;
|
|
325373
324873
|
return session;
|
|
325374
324874
|
}
|
|
324875
|
+
#buildActiveNoteRenderOverride(storyType) {
|
|
324876
|
+
const session = this.#getActiveNoteStorySession();
|
|
324877
|
+
if (!session || session.locator.storyType !== storyType)
|
|
324878
|
+
return null;
|
|
324879
|
+
const storyEditor = session.editor;
|
|
324880
|
+
const docJson = typeof storyEditor.getUpdatedJson === "function" ? storyEditor.getUpdatedJson() : typeof storyEditor.getJSON === "function" ? storyEditor.getJSON() : null;
|
|
324881
|
+
if (!docJson || typeof docJson !== "object")
|
|
324882
|
+
return null;
|
|
324883
|
+
return {
|
|
324884
|
+
noteId: session.locator.noteId,
|
|
324885
|
+
docJson
|
|
324886
|
+
};
|
|
324887
|
+
}
|
|
325375
324888
|
#getActiveTrackedChangeStorySurface() {
|
|
325376
324889
|
const storySession = this.#getActiveStorySession();
|
|
325377
324890
|
if (storySession)
|
|
@@ -325396,6 +324909,12 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
325396
324909
|
getStorySessionManager() {
|
|
325397
324910
|
return this.#storySessionManager;
|
|
325398
324911
|
}
|
|
324912
|
+
exitActiveStorySurface() {
|
|
324913
|
+
if ((this.#headerFooterSession?.session?.mode ?? "body") !== "body")
|
|
324914
|
+
this.#exitHeaderFooterMode();
|
|
324915
|
+
if (this.#getActiveStorySession())
|
|
324916
|
+
this.#exitActiveStorySession();
|
|
324917
|
+
}
|
|
325399
324918
|
#resolveActiveSurface() {
|
|
325400
324919
|
const mode = this.#headerFooterSession?.session?.mode ?? "body";
|
|
325401
324920
|
if (mode === "header")
|
|
@@ -325903,13 +325422,16 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
325903
325422
|
}).filter((rect) => Boolean(rect));
|
|
325904
325423
|
if (!rects.length)
|
|
325905
325424
|
return null;
|
|
325906
|
-
const
|
|
325425
|
+
const groupedRects = this.#groupRangeRectsByPage(rects);
|
|
325426
|
+
const preferredPageIndex = this.#getPreferredRenderedTrackedChangePageIndex(storyKey, groupedRects, relativeTo);
|
|
325427
|
+
const anchorRects = groupedRects.get(preferredPageIndex) ?? rects;
|
|
325428
|
+
const bounds = this.#aggregateLayoutBounds(anchorRects);
|
|
325907
325429
|
if (!bounds)
|
|
325908
325430
|
return null;
|
|
325909
325431
|
return {
|
|
325910
325432
|
bounds,
|
|
325911
325433
|
rects,
|
|
325912
|
-
pageIndex:
|
|
325434
|
+
pageIndex: preferredPageIndex
|
|
325913
325435
|
};
|
|
325914
325436
|
}
|
|
325915
325437
|
#findRenderedTrackedChangeElements(rawId, storyKey) {
|
|
@@ -325917,8 +325439,69 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
325917
325439
|
if (!host)
|
|
325918
325440
|
return [];
|
|
325919
325441
|
const baseSelector = `[data-track-change-id="${escapeAttrValue(rawId)}"]`;
|
|
325920
|
-
|
|
325921
|
-
|
|
325442
|
+
if (!storyKey)
|
|
325443
|
+
return Array.from(host.querySelectorAll(baseSelector));
|
|
325444
|
+
const storySelector = `${baseSelector}[data-story-key="${escapeAttrValue(storyKey)}"]`;
|
|
325445
|
+
const exactMatches = Array.from(host.querySelectorAll(storySelector));
|
|
325446
|
+
const allMatches = Array.from(host.querySelectorAll(baseSelector));
|
|
325447
|
+
if (exactMatches.length > 1 || exactMatches.length === allMatches.length || allMatches.length === 0)
|
|
325448
|
+
return exactMatches;
|
|
325449
|
+
return allMatches;
|
|
325450
|
+
}
|
|
325451
|
+
#groupRangeRectsByPage(rects) {
|
|
325452
|
+
const grouped = /* @__PURE__ */ new Map;
|
|
325453
|
+
rects.forEach((rect) => {
|
|
325454
|
+
const pageIndex = Number.isFinite(rect.pageIndex) ? rect.pageIndex : 0;
|
|
325455
|
+
const pageRects = grouped.get(pageIndex);
|
|
325456
|
+
if (pageRects) {
|
|
325457
|
+
pageRects.push(rect);
|
|
325458
|
+
return;
|
|
325459
|
+
}
|
|
325460
|
+
grouped.set(pageIndex, [rect]);
|
|
325461
|
+
});
|
|
325462
|
+
return grouped;
|
|
325463
|
+
}
|
|
325464
|
+
#getPreferredRenderedTrackedChangePageIndex(storyKey, groupedRects, relativeTo) {
|
|
325465
|
+
const activeHeaderFooterSession = this.#headerFooterSession?.session;
|
|
325466
|
+
const activePageIndex = (activeHeaderFooterSession?.mode !== "body" && activeHeaderFooterSession?.headerFooterRefId ? buildStoryKey({
|
|
325467
|
+
kind: "story",
|
|
325468
|
+
storyType: "headerFooterPart",
|
|
325469
|
+
refId: activeHeaderFooterSession.headerFooterRefId
|
|
325470
|
+
}) : null) === storyKey && Number.isFinite(activeHeaderFooterSession?.pageIndex) ? Number(activeHeaderFooterSession?.pageIndex) : null;
|
|
325471
|
+
if (activePageIndex != null && groupedRects.has(activePageIndex))
|
|
325472
|
+
return activePageIndex;
|
|
325473
|
+
const viewportRect = (this.#scrollContainer instanceof Window ? {
|
|
325474
|
+
top: 0,
|
|
325475
|
+
bottom: this.#scrollContainer.innerHeight
|
|
325476
|
+
} : this.#scrollContainer instanceof Element ? this.#scrollContainer.getBoundingClientRect() : this.#visibleHost?.ownerDocument?.defaultView ? {
|
|
325477
|
+
top: 0,
|
|
325478
|
+
bottom: this.#visibleHost.ownerDocument.defaultView.innerHeight
|
|
325479
|
+
} : this.#visibleHost?.getBoundingClientRect?.()) ?? null;
|
|
325480
|
+
if (viewportRect) {
|
|
325481
|
+
const relativeRect = relativeTo?.getBoundingClientRect?.();
|
|
325482
|
+
const visibleTop = viewportRect.top - (relativeRect?.top ?? 0);
|
|
325483
|
+
const visibleBottom = viewportRect.bottom - (relativeRect?.top ?? 0);
|
|
325484
|
+
const viewportCenter = visibleTop + (visibleBottom - visibleTop) / 2;
|
|
325485
|
+
let bestPageIndex = null;
|
|
325486
|
+
let bestIntersection = -1;
|
|
325487
|
+
let bestDistance = Number.POSITIVE_INFINITY;
|
|
325488
|
+
groupedRects.forEach((pageRects, pageIndex) => {
|
|
325489
|
+
const pageBounds = this.#aggregateLayoutBounds(pageRects);
|
|
325490
|
+
if (!pageBounds)
|
|
325491
|
+
return;
|
|
325492
|
+
const intersection = Math.max(0, Math.min(pageBounds.bottom, visibleBottom) - Math.max(pageBounds.top, visibleTop));
|
|
325493
|
+
const pageCenter = pageBounds.top + pageBounds.height / 2;
|
|
325494
|
+
const distance2 = Math.abs(pageCenter - viewportCenter);
|
|
325495
|
+
if (intersection > bestIntersection || intersection === bestIntersection && distance2 < bestDistance || intersection === bestIntersection && distance2 === bestDistance && (bestPageIndex == null || pageIndex < bestPageIndex)) {
|
|
325496
|
+
bestPageIndex = pageIndex;
|
|
325497
|
+
bestIntersection = intersection;
|
|
325498
|
+
bestDistance = distance2;
|
|
325499
|
+
}
|
|
325500
|
+
});
|
|
325501
|
+
if (bestPageIndex != null)
|
|
325502
|
+
return bestPageIndex;
|
|
325503
|
+
}
|
|
325504
|
+
return [...groupedRects.keys()].sort((left$1, right$1) => left$1 - right$1)[0] ?? 0;
|
|
325922
325505
|
}
|
|
325923
325506
|
getLayoutSnapshot() {
|
|
325924
325507
|
return {
|
|
@@ -326675,6 +326258,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
326675
326258
|
this.#a11ySelectionAnnounceTimeout = null;
|
|
326676
326259
|
}
|
|
326677
326260
|
this.#teardownStorySessionEventBridge();
|
|
326261
|
+
this.#teardownActiveSurfaceUiEventBridge();
|
|
326678
326262
|
if (this.#registryKey) {
|
|
326679
326263
|
PresentationEditor2.#instances.delete(this.#registryKey);
|
|
326680
326264
|
this.#registryKey = null;
|
|
@@ -326925,6 +326509,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
326925
326509
|
event: "stylesDefaultsChanged",
|
|
326926
326510
|
handler: handleStylesDefaultsChanged
|
|
326927
326511
|
});
|
|
326512
|
+
this.#syncActiveSurfaceUiEventBridge(this.#editor);
|
|
326928
326513
|
const handleNotesPartChanged = () => {
|
|
326929
326514
|
this.#flowBlockCache.setHasExternalChanges(true);
|
|
326930
326515
|
this.#pendingDocChange = true;
|
|
@@ -327255,6 +326840,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
327255
326840
|
this.#scheduleSelectionUpdate({ immediate: true });
|
|
327256
326841
|
this.#scheduleA11ySelectionAnnouncement({ immediate: true });
|
|
327257
326842
|
}
|
|
326843
|
+
this.#syncActiveSurfaceUiEventBridge();
|
|
327258
326844
|
},
|
|
327259
326845
|
onEditBlocked: (reason) => {
|
|
327260
326846
|
this.emit("headerFooterEditBlocked", { reason });
|
|
@@ -327315,6 +326901,47 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
327315
326901
|
this.#storySessionSelectionHandler = null;
|
|
327316
326902
|
this.#storySessionTransactionHandler = null;
|
|
327317
326903
|
}
|
|
326904
|
+
#teardownActiveSurfaceUiEventBridge() {
|
|
326905
|
+
if (this.#activeSurfaceUiEventEditor) {
|
|
326906
|
+
if (this.#activeSurfaceUiUpdateHandler)
|
|
326907
|
+
this.#activeSurfaceUiEventEditor.off?.("update", this.#activeSurfaceUiUpdateHandler);
|
|
326908
|
+
if (this.#activeSurfaceUiContextMenuOpenHandler)
|
|
326909
|
+
this.#activeSurfaceUiEventEditor.off?.("contextMenu:open", this.#activeSurfaceUiContextMenuOpenHandler);
|
|
326910
|
+
if (this.#activeSurfaceUiContextMenuCloseHandler)
|
|
326911
|
+
this.#activeSurfaceUiEventEditor.off?.("contextMenu:close", this.#activeSurfaceUiContextMenuCloseHandler);
|
|
326912
|
+
}
|
|
326913
|
+
this.#activeSurfaceUiEventEditor = null;
|
|
326914
|
+
this.#activeSurfaceUiUpdateHandler = null;
|
|
326915
|
+
this.#activeSurfaceUiContextMenuOpenHandler = null;
|
|
326916
|
+
this.#activeSurfaceUiContextMenuCloseHandler = null;
|
|
326917
|
+
}
|
|
326918
|
+
#syncActiveSurfaceUiEventBridge(editor = this.getActiveEditor()) {
|
|
326919
|
+
const nextEditor = editor ?? null;
|
|
326920
|
+
if (nextEditor === this.#activeSurfaceUiEventEditor)
|
|
326921
|
+
return;
|
|
326922
|
+
this.#teardownActiveSurfaceUiEventBridge();
|
|
326923
|
+
if (!nextEditor)
|
|
326924
|
+
return;
|
|
326925
|
+
const updateHandler = (event) => {
|
|
326926
|
+
this.emit("update", {
|
|
326927
|
+
...event ?? {},
|
|
326928
|
+
editor: this
|
|
326929
|
+
});
|
|
326930
|
+
};
|
|
326931
|
+
const contextMenuOpenHandler = (event) => {
|
|
326932
|
+
this.emit("contextMenu:open", event ?? {});
|
|
326933
|
+
};
|
|
326934
|
+
const contextMenuCloseHandler = () => {
|
|
326935
|
+
this.emit("contextMenu:close");
|
|
326936
|
+
};
|
|
326937
|
+
nextEditor.on?.("update", updateHandler);
|
|
326938
|
+
nextEditor.on?.("contextMenu:open", contextMenuOpenHandler);
|
|
326939
|
+
nextEditor.on?.("contextMenu:close", contextMenuCloseHandler);
|
|
326940
|
+
this.#activeSurfaceUiEventEditor = nextEditor;
|
|
326941
|
+
this.#activeSurfaceUiUpdateHandler = updateHandler;
|
|
326942
|
+
this.#activeSurfaceUiContextMenuOpenHandler = contextMenuOpenHandler;
|
|
326943
|
+
this.#activeSurfaceUiContextMenuCloseHandler = contextMenuCloseHandler;
|
|
326944
|
+
}
|
|
327318
326945
|
#syncStorySessionEventBridge(session) {
|
|
327319
326946
|
this.#teardownStorySessionEventBridge();
|
|
327320
326947
|
if (!session) {
|
|
@@ -327330,7 +326957,6 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
327330
326957
|
return;
|
|
327331
326958
|
if (session.kind === "note") {
|
|
327332
326959
|
this.#invalidateTrackedChangesForStory(session.locator);
|
|
327333
|
-
this.#flowBlockCache.setHasExternalChanges(true);
|
|
327334
326960
|
this.#pendingDocChange = true;
|
|
327335
326961
|
this.#selectionSync.onLayoutStart();
|
|
327336
326962
|
this.#scheduleRerender();
|
|
@@ -327343,6 +326969,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
327343
326969
|
this.#storySessionTransactionHandler = transactionHandler;
|
|
327344
326970
|
this.#scheduleSelectionUpdate({ immediate: true });
|
|
327345
326971
|
this.#scheduleA11ySelectionAnnouncement({ immediate: true });
|
|
326972
|
+
this.#syncActiveSurfaceUiEventBridge();
|
|
327346
326973
|
}
|
|
327347
326974
|
#syncActiveStorySessionDocumentMode(session) {
|
|
327348
326975
|
if (!session || session.kind !== "note")
|
|
@@ -327393,6 +327020,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
327393
327020
|
this.#wrapOffscreenEditorFocus(activeSession.editor);
|
|
327394
327021
|
this.#syncActiveStorySessionDocumentMode(activeSession);
|
|
327395
327022
|
this.#syncStorySessionEventBridge(activeSession);
|
|
327023
|
+
this.#syncActiveSurfaceUiEventBridge();
|
|
327396
327024
|
this.#inputBridge?.notifyTargetChanged();
|
|
327397
327025
|
}
|
|
327398
327026
|
});
|
|
@@ -327623,9 +327251,11 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
327623
327251
|
this.#applyHtmlAnnotationMeasurements(blocks2);
|
|
327624
327252
|
const isSemanticFlow = this.#isSemanticFlowMode();
|
|
327625
327253
|
const baseLayoutOptions = this.#resolveLayoutOptions(blocks2, sectionMetadata);
|
|
327626
|
-
const
|
|
327254
|
+
const activeFootnoteOverride = this.#buildActiveNoteRenderOverride("footnote");
|
|
327255
|
+
const footnotesLayoutInput = buildFootnotesInput(this.#editor?.state, this.#editor?.converter, converterContext, this.#editor?.converter?.themeColors ?? undefined, activeFootnoteOverride);
|
|
327627
327256
|
const semanticFootnoteBlocks = isSemanticFlow ? buildSemanticFootnoteBlocks(footnotesLayoutInput, this.#layoutOptions.semanticOptions?.footnotesMode) : [];
|
|
327628
|
-
const
|
|
327257
|
+
const activeEndnoteOverride = this.#buildActiveNoteRenderOverride("endnote");
|
|
327258
|
+
const endnoteBlocks = buildEndnoteBlocks(this.#editor?.state, this.#editor?.converter, converterContext, this.#editor?.converter?.themeColors ?? undefined, activeEndnoteOverride);
|
|
327629
327259
|
const blocksForLayout = semanticFootnoteBlocks.length > 0 || endnoteBlocks.length > 0 ? [
|
|
327630
327260
|
...blocks2,
|
|
327631
327261
|
...semanticFootnoteBlocks,
|
|
@@ -327736,45 +327366,13 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
327736
327366
|
this.#ensurePainter();
|
|
327737
327367
|
if (!isSemanticFlow)
|
|
327738
327368
|
this.#painterAdapter.setProviders(this.#headerFooterSession?.headerDecorationProvider, this.#headerFooterSession?.footerDecorationProvider);
|
|
327739
|
-
const headerBlocks = [];
|
|
327740
|
-
const headerMeasures = [];
|
|
327741
|
-
if (headerLayouts)
|
|
327742
|
-
for (const headerResult of headerLayouts) {
|
|
327743
|
-
headerBlocks.push(...headerResult.blocks);
|
|
327744
|
-
headerMeasures.push(...headerResult.measures);
|
|
327745
|
-
}
|
|
327746
|
-
const headerLayoutsByRId = this.#headerFooterSession?.headerLayoutsByRId;
|
|
327747
|
-
if (headerLayoutsByRId)
|
|
327748
|
-
for (const rIdResult of headerLayoutsByRId.values()) {
|
|
327749
|
-
headerBlocks.push(...rIdResult.blocks);
|
|
327750
|
-
headerMeasures.push(...rIdResult.measures);
|
|
327751
|
-
}
|
|
327752
|
-
const footerBlocks = [];
|
|
327753
|
-
const footerMeasures = [];
|
|
327754
|
-
if (footerLayouts)
|
|
327755
|
-
for (const footerResult of footerLayouts) {
|
|
327756
|
-
footerBlocks.push(...footerResult.blocks);
|
|
327757
|
-
footerMeasures.push(...footerResult.measures);
|
|
327758
|
-
}
|
|
327759
|
-
const footerLayoutsByRId = this.#headerFooterSession?.footerLayoutsByRId;
|
|
327760
|
-
if (footerLayoutsByRId)
|
|
327761
|
-
for (const rIdResult of footerLayoutsByRId.values()) {
|
|
327762
|
-
footerBlocks.push(...rIdResult.blocks);
|
|
327763
|
-
footerMeasures.push(...rIdResult.measures);
|
|
327764
|
-
}
|
|
327765
327369
|
this.#domIndexObserverManager?.pause();
|
|
327766
327370
|
const mapping = this.#pendingMapping;
|
|
327767
327371
|
this.#pendingMapping = null;
|
|
327768
327372
|
const painterPaintStart = perfNow();
|
|
327769
327373
|
const paintInput = {
|
|
327770
327374
|
resolvedLayout,
|
|
327771
|
-
sourceLayout: layout
|
|
327772
|
-
blocks: bodyBlocksForPaint,
|
|
327773
|
-
measures: bodyMeasuresForPaint,
|
|
327774
|
-
headerBlocks: headerBlocks.length > 0 ? headerBlocks : undefined,
|
|
327775
|
-
headerMeasures: headerMeasures.length > 0 ? headerMeasures : undefined,
|
|
327776
|
-
footerBlocks: footerBlocks.length > 0 ? footerBlocks : undefined,
|
|
327777
|
-
footerMeasures: footerMeasures.length > 0 ? footerMeasures : undefined
|
|
327375
|
+
sourceLayout: layout
|
|
327778
327376
|
};
|
|
327779
327377
|
this.#painterAdapter.paint(paintInput, this.#painterHost, mapping ?? undefined);
|
|
327780
327378
|
perfLog(`[Perf] painter.paint: ${(perfNow() - painterPaintStart).toFixed(2)}ms`);
|
|
@@ -328720,7 +328318,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
328720
328318
|
storyType: target.storyType,
|
|
328721
328319
|
noteId: target.noteId
|
|
328722
328320
|
}, {
|
|
328723
|
-
commitPolicy: "
|
|
328321
|
+
commitPolicy: "onExit",
|
|
328724
328322
|
preferHiddenHost: true,
|
|
328725
328323
|
hostWidthPx: targetContext?.hostWidthPx ?? this.#visibleHost.clientWidth ?? 1,
|
|
328726
328324
|
editorContext: {
|
|
@@ -328964,7 +328562,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
328964
328562
|
if (target.entityType === "comment")
|
|
328965
328563
|
return await this.#navigateToComment(target.entityId);
|
|
328966
328564
|
if (target.entityType === "trackedChange")
|
|
328967
|
-
return await this.#navigateToTrackedChange(target.entityId, resolveStoryKeyFromAddress(target.story));
|
|
328565
|
+
return await this.#navigateToTrackedChange(target.entityId, resolveStoryKeyFromAddress(target.story), target.pageIndex);
|
|
328968
328566
|
}
|
|
328969
328567
|
return false;
|
|
328970
328568
|
} catch (error3) {
|
|
@@ -329038,18 +328636,18 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
329038
328636
|
});
|
|
329039
328637
|
return true;
|
|
329040
328638
|
}
|
|
329041
|
-
async#navigateToTrackedChange(entityId, storyKey) {
|
|
328639
|
+
async#navigateToTrackedChange(entityId, storyKey, preferredPageIndex) {
|
|
329042
328640
|
const editor = this.#editor;
|
|
329043
328641
|
if (!editor)
|
|
329044
328642
|
return false;
|
|
329045
328643
|
if (storyKey && storyKey !== "body") {
|
|
329046
328644
|
if (this.#navigateToActiveStoryTrackedChange(entityId, storyKey))
|
|
329047
328645
|
return true;
|
|
329048
|
-
if (await this.#activateTrackedChangeStorySurface(entityId, storyKey)) {
|
|
328646
|
+
if (await this.#activateTrackedChangeStorySurface(entityId, storyKey, preferredPageIndex)) {
|
|
329049
328647
|
if (this.#navigateToActiveStoryTrackedChange(entityId, storyKey))
|
|
329050
328648
|
return true;
|
|
329051
328649
|
}
|
|
329052
|
-
return this.#scrollToRenderedTrackedChange(entityId, storyKey);
|
|
328650
|
+
return this.#scrollToRenderedTrackedChange(entityId, storyKey, preferredPageIndex);
|
|
329053
328651
|
}
|
|
329054
328652
|
const setCursorById = editor.commands?.setCursorById;
|
|
329055
328653
|
if (typeof setCursorById === "function" && setCursorById(entityId, { preferredActiveThreadId: entityId })) {
|
|
@@ -329061,7 +328659,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
329061
328659
|
}
|
|
329062
328660
|
const resolved = resolveTrackedChange(editor, entityId);
|
|
329063
328661
|
if (!resolved)
|
|
329064
|
-
return this.#scrollToRenderedTrackedChange(entityId);
|
|
328662
|
+
return this.#scrollToRenderedTrackedChange(entityId, undefined, preferredPageIndex);
|
|
329065
328663
|
if (typeof setCursorById === "function" && resolved.rawId !== entityId) {
|
|
329066
328664
|
if (setCursorById(resolved.rawId, { preferredActiveThreadId: resolved.rawId })) {
|
|
329067
328665
|
await this.scrollToPositionAsync(editor.state.selection.from, {
|
|
@@ -329083,7 +328681,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
329083
328681
|
editor.view?.focus?.();
|
|
329084
328682
|
return true;
|
|
329085
328683
|
}
|
|
329086
|
-
async#activateTrackedChangeStorySurface(entityId, storyKey) {
|
|
328684
|
+
async#activateTrackedChangeStorySurface(entityId, storyKey, preferredPageIndex) {
|
|
329087
328685
|
let locator = null;
|
|
329088
328686
|
try {
|
|
329089
328687
|
locator = parseStoryKey(storyKey);
|
|
@@ -329092,7 +328690,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
329092
328690
|
}
|
|
329093
328691
|
if (!locator || locator.storyType === "body")
|
|
329094
328692
|
return false;
|
|
329095
|
-
const candidate = this.#
|
|
328693
|
+
const candidate = this.#findRenderedTrackedChangeElement(entityId, storyKey, preferredPageIndex);
|
|
329096
328694
|
if (!candidate)
|
|
329097
328695
|
return false;
|
|
329098
328696
|
const rect = candidate.getBoundingClientRect();
|
|
@@ -329170,12 +328768,20 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
329170
328768
|
this.#shouldScrollSelectionIntoView = true;
|
|
329171
328769
|
this.#scheduleSelectionUpdate({ immediate: true });
|
|
329172
328770
|
}
|
|
329173
|
-
|
|
328771
|
+
#findRenderedTrackedChangeElement(entityId, storyKey, preferredPageIndex) {
|
|
329174
328772
|
const candidates = this.#findRenderedTrackedChangeElements(entityId, storyKey);
|
|
329175
328773
|
if (!candidates.length)
|
|
328774
|
+
return null;
|
|
328775
|
+
if (!Number.isFinite(preferredPageIndex))
|
|
328776
|
+
return candidates[0] ?? null;
|
|
328777
|
+
return candidates.find((candidate) => this.#resolveRenderedPageIndexForElement(candidate) === preferredPageIndex) ?? candidates[0] ?? null;
|
|
328778
|
+
}
|
|
328779
|
+
async#scrollToRenderedTrackedChange(entityId, storyKey, preferredPageIndex) {
|
|
328780
|
+
const candidate = this.#findRenderedTrackedChangeElement(entityId, storyKey, preferredPageIndex);
|
|
328781
|
+
if (!candidate)
|
|
329176
328782
|
return false;
|
|
329177
328783
|
try {
|
|
329178
|
-
|
|
328784
|
+
candidate.scrollIntoView({
|
|
329179
328785
|
behavior: "auto",
|
|
329180
328786
|
block: "center",
|
|
329181
328787
|
inline: "nearest"
|
|
@@ -330033,11 +329639,11 @@ var init_zipper_DbkgrypV_es = __esm(() => {
|
|
|
330033
329639
|
|
|
330034
329640
|
// ../../packages/superdoc/dist/super-editor.es.js
|
|
330035
329641
|
var init_super_editor_es = __esm(() => {
|
|
330036
|
-
|
|
330037
|
-
|
|
329642
|
+
init_src_BFNW1Ck5_es();
|
|
329643
|
+
init_SuperConverter_D54XfHFt_es();
|
|
330038
329644
|
init_jszip_C49i9kUs_es();
|
|
330039
329645
|
init_xml_js_CqGKpaft_es();
|
|
330040
|
-
|
|
329646
|
+
init_create_headless_toolbar_DrE9IMiD_es();
|
|
330041
329647
|
init_constants_CGhJRd87_es();
|
|
330042
329648
|
init_dist_B8HfvhaK_es();
|
|
330043
329649
|
init_unified_Dsuw2be5_es();
|