@superdoc-dev/cli 0.8.0-next.11 → 0.8.0-next.13
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 +500 -875
- 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-aq0iFjuQ.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,
|
|
@@ -95920,6 +95925,19 @@ function shouldRequirePageBoundary(current, next) {
|
|
|
95920
95925
|
function hasIntrinsicBoundarySignals(_) {
|
|
95921
95926
|
return false;
|
|
95922
95927
|
}
|
|
95928
|
+
function emitPendingSectionBreakForParagraph(args2) {
|
|
95929
|
+
const { sectionState, nextBlockId, blocks, recordBlockKind } = args2;
|
|
95930
|
+
if (!sectionState || sectionState.ranges.length === 0)
|
|
95931
|
+
return;
|
|
95932
|
+
const nextSection = sectionState.ranges[sectionState.currentSectionIndex + 1];
|
|
95933
|
+
if (!nextSection || sectionState.currentParagraphIndex !== nextSection.startParagraphIndex)
|
|
95934
|
+
return;
|
|
95935
|
+
const currentSection = sectionState.ranges[sectionState.currentSectionIndex];
|
|
95936
|
+
const sectionBreak = createSectionBreakBlock(nextSection, nextBlockId, shouldRequirePageBoundary(currentSection, nextSection) || hasIntrinsicBoundarySignals(nextSection) ? { requirePageBoundary: true } : undefined);
|
|
95937
|
+
blocks.push(sectionBreak);
|
|
95938
|
+
recordBlockKind?.(sectionBreak.kind);
|
|
95939
|
+
sectionState.currentSectionIndex++;
|
|
95940
|
+
}
|
|
95923
95941
|
function shouldIgnoreSectionBreak(paragraph2, index2, total, hasBodySectPr) {
|
|
95924
95942
|
const paragraphAttrs = paragraph2.attrs ?? {};
|
|
95925
95943
|
const sectPr = paragraphAttrs?.paragraphProperties?.sectPr;
|
|
@@ -95963,7 +95981,7 @@ function findParagraphsWithSectPr(doc$2) {
|
|
|
95963
95981
|
paragraphIndex++;
|
|
95964
95982
|
return;
|
|
95965
95983
|
}
|
|
95966
|
-
if (node3.type === "index" || node3.type === "bibliography" || node3.type === "tableOfAuthorities")
|
|
95984
|
+
if (node3.type === "index" || node3.type === "bibliography" || node3.type === "tableOfAuthorities" || node3.type === "documentPartObject" || node3.type === "tableOfContents")
|
|
95967
95985
|
getNodeChildren(node3).forEach(visitNode);
|
|
95968
95986
|
};
|
|
95969
95987
|
if (doc$2.content)
|
|
@@ -99742,6 +99760,17 @@ function resolveLiveStorySessionRuntime(hostEditor, storyKey) {
|
|
|
99742
99760
|
return null;
|
|
99743
99761
|
return buildLiveSessionRuntime(registration);
|
|
99744
99762
|
}
|
|
99763
|
+
function commitLiveStorySessionRuntimes(hostEditor) {
|
|
99764
|
+
const sessions = liveSessionsByHost.get(hostEditor);
|
|
99765
|
+
if (!sessions || sessions.size === 0)
|
|
99766
|
+
return 0;
|
|
99767
|
+
let committedCount = 0;
|
|
99768
|
+
for (const registration of [...sessions.values()]) {
|
|
99769
|
+
buildLiveSessionRuntime(registration).commit?.(hostEditor);
|
|
99770
|
+
committedCount += 1;
|
|
99771
|
+
}
|
|
99772
|
+
return committedCount;
|
|
99773
|
+
}
|
|
99745
99774
|
function unregisterLiveStorySessionRuntime(hostEditor, storyKey, editor) {
|
|
99746
99775
|
const sessions = liveSessionsByHost.get(hostEditor);
|
|
99747
99776
|
if (!sessions)
|
|
@@ -117714,7 +117743,7 @@ var isRegExp = (value) => {
|
|
|
117714
117743
|
state.kern = kernNode.attributes["w:val"];
|
|
117715
117744
|
}
|
|
117716
117745
|
}, SuperConverter;
|
|
117717
|
-
var
|
|
117746
|
+
var init_SuperConverter_aq0iFjuQ_es = __esm(() => {
|
|
117718
117747
|
init_rolldown_runtime_Bg48TavK_es();
|
|
117719
117748
|
init_jszip_C49i9kUs_es();
|
|
117720
117749
|
init_xml_js_CqGKpaft_es();
|
|
@@ -155130,7 +155159,7 @@ var init_SuperConverter_XXBr0N8c_es = __esm(() => {
|
|
|
155130
155159
|
};
|
|
155131
155160
|
});
|
|
155132
155161
|
|
|
155133
|
-
// ../../packages/superdoc/dist/chunks/create-headless-toolbar-
|
|
155162
|
+
// ../../packages/superdoc/dist/chunks/create-headless-toolbar-bhnvM7MP.es.js
|
|
155134
155163
|
function parseSizeUnit(val = "0") {
|
|
155135
155164
|
const length3 = val.toString() || "0";
|
|
155136
155165
|
const value = Number.parseFloat(length3);
|
|
@@ -157722,8 +157751,8 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, Extension = class Extension2 {
|
|
|
157722
157751
|
}
|
|
157723
157752
|
};
|
|
157724
157753
|
};
|
|
157725
|
-
var
|
|
157726
|
-
|
|
157754
|
+
var init_create_headless_toolbar_bhnvM7MP_es = __esm(() => {
|
|
157755
|
+
init_SuperConverter_aq0iFjuQ_es();
|
|
157727
157756
|
init_constants_CGhJRd87_es();
|
|
157728
157757
|
init_dist_B8HfvhaK_es();
|
|
157729
157758
|
CSS_DIMENSION_REGEX = /[\d-.]+(\w+)$/;
|
|
@@ -206410,7 +206439,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
|
|
|
206410
206439
|
init_remark_gfm_BhnWr3yf_es();
|
|
206411
206440
|
});
|
|
206412
206441
|
|
|
206413
|
-
// ../../packages/superdoc/dist/chunks/src-
|
|
206442
|
+
// ../../packages/superdoc/dist/chunks/src-1sL7dd0v.es.js
|
|
206414
206443
|
function deleteProps(obj, propOrProps) {
|
|
206415
206444
|
const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
|
|
206416
206445
|
const removeNested = (target, pathParts, index2 = 0) => {
|
|
@@ -207989,7 +208018,8 @@ function getEditorSurfaceElement(editor) {
|
|
|
207989
208018
|
return null;
|
|
207990
208019
|
if (typeof editor.hitTest === "function" && editor.element instanceof HTMLElement)
|
|
207991
208020
|
return editor.element;
|
|
207992
|
-
|
|
208021
|
+
const parentEditor = editor.options?.parentEditor ?? null;
|
|
208022
|
+
return (editor.presentationEditor ?? parentEditor?.presentationEditor ?? parentEditor?._presentationEditor ?? null)?.element ?? editor.view?.dom ?? editor.options?.element ?? null;
|
|
207993
208023
|
}
|
|
207994
208024
|
function getSurfaceRelativePoint(editor, eventLocation = {}) {
|
|
207995
208025
|
const surface = getEditorSurfaceElement(editor);
|
|
@@ -249413,30 +249443,6 @@ function assertRequiredBlockMeasurePair(label, blocks2, measures) {
|
|
|
249413
249443
|
if (blocks2.length !== measures.length)
|
|
249414
249444
|
throw new Error(`${label} blocks and measures must have the same length.`);
|
|
249415
249445
|
}
|
|
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
249446
|
function createEmptyResolvedLayout(flowMode, pageGap) {
|
|
249441
249447
|
return {
|
|
249442
249448
|
version: 1,
|
|
@@ -249445,25 +249451,8 @@ function createEmptyResolvedLayout(flowMode, pageGap) {
|
|
|
249445
249451
|
pages: []
|
|
249446
249452
|
};
|
|
249447
249453
|
}
|
|
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
|
-
};
|
|
249454
|
+
function isDomPainterInput(value) {
|
|
249455
|
+
return "resolvedLayout" in value && "sourceLayout" in value;
|
|
249467
249456
|
}
|
|
249468
249457
|
function buildLegacyPaintInput(layout, legacyState, flowMode, pageGap) {
|
|
249469
249458
|
let resolvedLayout;
|
|
@@ -249480,13 +249469,7 @@ function buildLegacyPaintInput(layout, legacyState, flowMode, pageGap) {
|
|
|
249480
249469
|
});
|
|
249481
249470
|
return {
|
|
249482
249471
|
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
|
|
249472
|
+
sourceLayout: layout
|
|
249490
249473
|
};
|
|
249491
249474
|
}
|
|
249492
249475
|
function appendToArrayMap(map$12, key2, value) {
|
|
@@ -258766,7 +258749,7 @@ function applyTocMetadata(blocks2, metadata) {
|
|
|
258766
258749
|
if (!block.attrs)
|
|
258767
258750
|
block.attrs = {};
|
|
258768
258751
|
block.attrs.isTocEntry = true;
|
|
258769
|
-
if (!block.attrs.sdt)
|
|
258752
|
+
if (!block.attrs.sdt && metadata.gallery)
|
|
258770
258753
|
block.attrs.sdt = {
|
|
258771
258754
|
type: "docPartObject",
|
|
258772
258755
|
gallery: metadata.gallery,
|
|
@@ -258784,6 +258767,12 @@ function processTocChildren(children, metadata, context, outputArrays) {
|
|
|
258784
258767
|
const { blocks: blocks2, recordBlockKind } = outputArrays;
|
|
258785
258768
|
children.forEach((child) => {
|
|
258786
258769
|
if (child.type === "paragraph") {
|
|
258770
|
+
emitPendingSectionBreakForParagraph({
|
|
258771
|
+
sectionState: context.sectionState,
|
|
258772
|
+
nextBlockId: context.nextBlockId,
|
|
258773
|
+
blocks: blocks2,
|
|
258774
|
+
recordBlockKind
|
|
258775
|
+
});
|
|
258787
258776
|
const paragraphBlocks = paragraphConverter({
|
|
258788
258777
|
para: child,
|
|
258789
258778
|
nextBlockId: context.nextBlockId,
|
|
@@ -258791,6 +258780,7 @@ function processTocChildren(children, metadata, context, outputArrays) {
|
|
|
258791
258780
|
trackedChangesConfig: context.trackedChangesConfig,
|
|
258792
258781
|
bookmarks: context.bookmarks,
|
|
258793
258782
|
hyperlinkConfig: context.hyperlinkConfig,
|
|
258783
|
+
themeColors: context.themeColors,
|
|
258794
258784
|
converters: context.converters,
|
|
258795
258785
|
enableComments: context.enableComments,
|
|
258796
258786
|
converterContext: context.converterContext
|
|
@@ -258805,6 +258795,8 @@ function processTocChildren(children, metadata, context, outputArrays) {
|
|
|
258805
258795
|
blocks2.push(block);
|
|
258806
258796
|
recordBlockKind?.(block.kind);
|
|
258807
258797
|
});
|
|
258798
|
+
if (context.sectionState)
|
|
258799
|
+
context.sectionState.currentParagraphIndex++;
|
|
258808
258800
|
} else if (child.type === "tableOfContents" && Array.isArray(child.content)) {
|
|
258809
258801
|
const finalInstruction = getNodeInstruction(child) ?? tocInstruction;
|
|
258810
258802
|
processTocChildren(child.content, {
|
|
@@ -258819,33 +258811,20 @@ function processTocChildren(children, metadata, context, outputArrays) {
|
|
|
258819
258811
|
function handleTableOfContentsNode(node3, context) {
|
|
258820
258812
|
if (!Array.isArray(node3.content))
|
|
258821
258813
|
return;
|
|
258822
|
-
|
|
258823
|
-
|
|
258824
|
-
|
|
258825
|
-
|
|
258826
|
-
|
|
258827
|
-
|
|
258828
|
-
|
|
258829
|
-
|
|
258830
|
-
|
|
258831
|
-
|
|
258832
|
-
|
|
258833
|
-
|
|
258834
|
-
|
|
258835
|
-
|
|
258836
|
-
enableComments,
|
|
258837
|
-
converterContext
|
|
258838
|
-
}).forEach((block) => {
|
|
258839
|
-
if (block.kind === "paragraph") {
|
|
258840
|
-
if (!block.attrs)
|
|
258841
|
-
block.attrs = {};
|
|
258842
|
-
block.attrs.isTocEntry = true;
|
|
258843
|
-
if (tocInstruction)
|
|
258844
|
-
block.attrs.tocInstruction = tocInstruction;
|
|
258845
|
-
}
|
|
258846
|
-
blocks2.push(block);
|
|
258847
|
-
recordBlockKind?.(block.kind);
|
|
258848
|
-
});
|
|
258814
|
+
processTocChildren(node3.content, { tocInstruction: getNodeInstruction(node3) }, {
|
|
258815
|
+
nextBlockId: context.nextBlockId,
|
|
258816
|
+
positions: context.positions,
|
|
258817
|
+
bookmarks: context.bookmarks,
|
|
258818
|
+
trackedChangesConfig: context.trackedChangesConfig,
|
|
258819
|
+
hyperlinkConfig: context.hyperlinkConfig,
|
|
258820
|
+
enableComments: context.enableComments,
|
|
258821
|
+
themeColors: context.themeColors,
|
|
258822
|
+
converters: context.converters,
|
|
258823
|
+
converterContext: context.converterContext,
|
|
258824
|
+
sectionState: context.sectionState
|
|
258825
|
+
}, {
|
|
258826
|
+
blocks: context.blocks,
|
|
258827
|
+
recordBlockKind: context.recordBlockKind
|
|
258849
258828
|
});
|
|
258850
258829
|
}
|
|
258851
258830
|
function handleIndexNode(node3, context) {
|
|
@@ -259101,7 +259080,7 @@ function handleDocumentSectionNode2(node3, context) {
|
|
|
259101
259080
|
function handleDocumentPartObjectNode(node3, context) {
|
|
259102
259081
|
if (!Array.isArray(node3.content))
|
|
259103
259082
|
return;
|
|
259104
|
-
const { blocks: blocks2, recordBlockKind, nextBlockId, positions, bookmarks, hyperlinkConfig, converters: converters$1, converterContext, enableComments, trackedChangesConfig, themeColors } = context;
|
|
259083
|
+
const { blocks: blocks2, recordBlockKind, nextBlockId, positions, bookmarks, hyperlinkConfig, sectionState, converters: converters$1, converterContext, enableComments, trackedChangesConfig, themeColors } = context;
|
|
259105
259084
|
const docPartGallery = getDocPartGallery(node3);
|
|
259106
259085
|
const docPartObjectId = getDocPartObjectId(node3);
|
|
259107
259086
|
const tocInstruction = getNodeInstruction(node3);
|
|
@@ -259120,8 +259099,10 @@ function handleDocumentPartObjectNode(node3, context) {
|
|
|
259120
259099
|
hyperlinkConfig,
|
|
259121
259100
|
enableComments,
|
|
259122
259101
|
trackedChangesConfig,
|
|
259102
|
+
themeColors,
|
|
259123
259103
|
converters: converters$1,
|
|
259124
|
-
converterContext
|
|
259104
|
+
converterContext,
|
|
259105
|
+
sectionState
|
|
259125
259106
|
}, {
|
|
259126
259107
|
blocks: blocks2,
|
|
259127
259108
|
recordBlockKind
|
|
@@ -259129,6 +259110,12 @@ function handleDocumentPartObjectNode(node3, context) {
|
|
|
259129
259110
|
else if (paragraphToFlowBlocks$1) {
|
|
259130
259111
|
for (const child of node3.content)
|
|
259131
259112
|
if (child.type === "paragraph") {
|
|
259113
|
+
emitPendingSectionBreakForParagraph({
|
|
259114
|
+
sectionState,
|
|
259115
|
+
nextBlockId,
|
|
259116
|
+
blocks: blocks2,
|
|
259117
|
+
recordBlockKind
|
|
259118
|
+
});
|
|
259132
259119
|
const childBlocks = paragraphToFlowBlocks$1({
|
|
259133
259120
|
para: child,
|
|
259134
259121
|
nextBlockId,
|
|
@@ -259145,6 +259132,8 @@ function handleDocumentPartObjectNode(node3, context) {
|
|
|
259145
259132
|
blocks2.push(block);
|
|
259146
259133
|
recordBlockKind?.(block.kind);
|
|
259147
259134
|
}
|
|
259135
|
+
if (sectionState)
|
|
259136
|
+
sectionState.currentParagraphIndex++;
|
|
259148
259137
|
}
|
|
259149
259138
|
}
|
|
259150
259139
|
}
|
|
@@ -260839,7 +260828,7 @@ function normalizeConverterContext(context, defaultFont, defaultSize) {
|
|
|
260839
260828
|
context.translatedLinkedStyles.docDefaults.runProperties.fontSize = defaultSize * 0.75 * 2;
|
|
260840
260829
|
return context;
|
|
260841
260830
|
}
|
|
260842
|
-
function buildFootnotesInput(editorState, converter, converterContext, themeColors) {
|
|
260831
|
+
function buildFootnotesInput(editorState, converter, converterContext, themeColors, renderOverride = null) {
|
|
260843
260832
|
if (!editorState)
|
|
260844
260833
|
return null;
|
|
260845
260834
|
const footnoteNumberById = converterContext?.footnoteNumberById;
|
|
@@ -260866,14 +260855,11 @@ function buildFootnotesInput(editorState, converter, converterContext, themeColo
|
|
|
260866
260855
|
return null;
|
|
260867
260856
|
const blocksById = /* @__PURE__ */ new Map;
|
|
260868
260857
|
idsInUse.forEach((id2) => {
|
|
260869
|
-
const content3 = findNoteEntryById(importedFootnotes, id2)?.content;
|
|
260870
|
-
if (!Array.isArray(content3) || content3.length === 0)
|
|
260871
|
-
return;
|
|
260872
260858
|
try {
|
|
260873
|
-
const
|
|
260874
|
-
|
|
260875
|
-
|
|
260876
|
-
|
|
260859
|
+
const footnoteDoc = resolveNoteDocJson(id2, importedFootnotes, renderOverride);
|
|
260860
|
+
if (!footnoteDoc)
|
|
260861
|
+
return;
|
|
260862
|
+
const result = toFlowBlocks(footnoteDoc, {
|
|
260877
260863
|
blockIdPrefix: `footnote-${id2}-`,
|
|
260878
260864
|
storyKey: buildStoryKey({
|
|
260879
260865
|
kind: "story",
|
|
@@ -260941,6 +260927,23 @@ function buildMarkerRun$1(markerText, firstTextRun) {
|
|
|
260941
260927
|
markerRun.color = firstTextRun.color;
|
|
260942
260928
|
return markerRun;
|
|
260943
260929
|
}
|
|
260930
|
+
function cloneJsonValue$1(value) {
|
|
260931
|
+
return JSON.parse(JSON.stringify(value));
|
|
260932
|
+
}
|
|
260933
|
+
function cloneNoteContentJson$1(content3) {
|
|
260934
|
+
return cloneJsonValue$1(content3);
|
|
260935
|
+
}
|
|
260936
|
+
function resolveNoteDocJson(id2, importedFootnotes, renderOverride) {
|
|
260937
|
+
if (renderOverride && renderOverride.noteId === id2)
|
|
260938
|
+
return normalizeNotePmJson(cloneJsonValue$1(renderOverride.docJson));
|
|
260939
|
+
const content3 = findNoteEntryById(importedFootnotes, id2)?.content;
|
|
260940
|
+
if (!Array.isArray(content3) || content3.length === 0)
|
|
260941
|
+
return null;
|
|
260942
|
+
return normalizeNotePmJson({
|
|
260943
|
+
type: "doc",
|
|
260944
|
+
content: cloneNoteContentJson$1(content3)
|
|
260945
|
+
});
|
|
260946
|
+
}
|
|
260944
260947
|
function syncMarkerRun$1(target, source) {
|
|
260945
260948
|
target.kind = source.kind;
|
|
260946
260949
|
target.text = source.text;
|
|
@@ -265088,7 +265091,7 @@ function getHostEditor(editor) {
|
|
|
265088
265091
|
function resolveSessionHostEditor(editor, runtime) {
|
|
265089
265092
|
return getHostEditor(editor) ?? getHostEditor(runtime.editor) ?? runtime.editor;
|
|
265090
265093
|
}
|
|
265091
|
-
function buildEndnoteBlocks(editorState, converter, converterContext, themeColors) {
|
|
265094
|
+
function buildEndnoteBlocks(editorState, converter, converterContext, themeColors, renderOverride = null) {
|
|
265092
265095
|
if (!editorState)
|
|
265093
265096
|
return [];
|
|
265094
265097
|
const endnoteNumberById = converterContext?.endnoteNumberById;
|
|
@@ -265113,14 +265116,11 @@ function buildEndnoteBlocks(editorState, converter, converterContext, themeColor
|
|
|
265113
265116
|
return [];
|
|
265114
265117
|
const blocks2 = [];
|
|
265115
265118
|
orderedEndnoteIds.forEach((id2) => {
|
|
265116
|
-
const content3 = findNoteEntryById(importedEndnotes, id2)?.content;
|
|
265117
|
-
if (!Array.isArray(content3) || content3.length === 0)
|
|
265118
|
-
return;
|
|
265119
265119
|
try {
|
|
265120
|
-
const
|
|
265121
|
-
|
|
265122
|
-
|
|
265123
|
-
|
|
265120
|
+
const endnoteDoc = resolveEndnoteDocJson(id2, importedEndnotes, renderOverride);
|
|
265121
|
+
if (!endnoteDoc)
|
|
265122
|
+
return;
|
|
265123
|
+
const result = toFlowBlocks(endnoteDoc, {
|
|
265124
265124
|
blockIdPrefix: `endnote-${id2}-`,
|
|
265125
265125
|
storyKey: buildStoryKey({
|
|
265126
265126
|
kind: "story",
|
|
@@ -265195,6 +265195,23 @@ function syncMarkerRun(target, source) {
|
|
|
265195
265195
|
delete target.pmStart;
|
|
265196
265196
|
delete target.pmEnd;
|
|
265197
265197
|
}
|
|
265198
|
+
function cloneJsonValue(value) {
|
|
265199
|
+
return JSON.parse(JSON.stringify(value));
|
|
265200
|
+
}
|
|
265201
|
+
function cloneNoteContentJson(content3) {
|
|
265202
|
+
return cloneJsonValue(content3);
|
|
265203
|
+
}
|
|
265204
|
+
function resolveEndnoteDocJson(id2, importedEndnotes, renderOverride) {
|
|
265205
|
+
if (renderOverride && renderOverride.noteId === id2)
|
|
265206
|
+
return normalizeNotePmJson(cloneJsonValue(renderOverride.docJson));
|
|
265207
|
+
const content3 = findNoteEntryById(importedEndnotes, id2)?.content;
|
|
265208
|
+
if (!Array.isArray(content3) || content3.length === 0)
|
|
265209
|
+
return null;
|
|
265210
|
+
return normalizeNotePmJson({
|
|
265211
|
+
type: "doc",
|
|
265212
|
+
content: cloneNoteContentJson(content3)
|
|
265213
|
+
});
|
|
265214
|
+
}
|
|
265198
265215
|
function ensureEndnoteMarker(blocks2, id2, endnoteNumberById) {
|
|
265199
265216
|
const firstParagraph = blocks2.find((block) => block.kind === "paragraph");
|
|
265200
265217
|
if (!firstParagraph)
|
|
@@ -267166,26 +267183,26 @@ var Node$13 = class Node$14 {
|
|
|
267166
267183
|
cleanup();
|
|
267167
267184
|
headlessCleanupRegisteredEditors.delete(editor);
|
|
267168
267185
|
});
|
|
267169
|
-
}, cloneJsonValue = (value) => {
|
|
267186
|
+
}, cloneJsonValue$2 = (value) => {
|
|
267170
267187
|
if (value == null)
|
|
267171
267188
|
return null;
|
|
267172
267189
|
return JSON.parse(JSON.stringify(value));
|
|
267173
267190
|
}, serializeComparableValue = (value) => JSON.stringify(value ?? null), getEditorBodySectPr = (editor) => editor?.state?.doc?.attrs?.bodySectPr ?? null, setEditorConverterBodySectPr = (editor, bodySectPr) => {
|
|
267174
267191
|
if (!editor?.converter)
|
|
267175
267192
|
return;
|
|
267176
|
-
editor.converter.bodySectPr = cloneJsonValue(bodySectPr);
|
|
267193
|
+
editor.converter.bodySectPr = cloneJsonValue$2(bodySectPr);
|
|
267177
267194
|
}, syncBodySectPrToMetaMap = (ydoc, editor) => {
|
|
267178
267195
|
const metaMap = ydoc.getMap("meta");
|
|
267179
|
-
const nextBodySectPr = cloneJsonValue(getEditorBodySectPr(editor));
|
|
267180
|
-
const currentMetaBodySectPr = cloneJsonValue(metaMap.get(META_BODY_SECT_PR_KEY) ?? null);
|
|
267196
|
+
const nextBodySectPr = cloneJsonValue$2(getEditorBodySectPr(editor));
|
|
267197
|
+
const currentMetaBodySectPr = cloneJsonValue$2(metaMap.get(META_BODY_SECT_PR_KEY) ?? null);
|
|
267181
267198
|
setEditorConverterBodySectPr(editor, nextBodySectPr);
|
|
267182
267199
|
if (serializeComparableValue(nextBodySectPr) === serializeComparableValue(currentMetaBodySectPr))
|
|
267183
267200
|
return false;
|
|
267184
267201
|
metaMap.set(META_BODY_SECT_PR_KEY, nextBodySectPr);
|
|
267185
267202
|
return true;
|
|
267186
267203
|
}, applyBodySectPrFromMetaMap = (editor, ydoc) => {
|
|
267187
|
-
const nextBodySectPr = cloneJsonValue(ydoc.getMap("meta").get(META_BODY_SECT_PR_KEY) ?? null);
|
|
267188
|
-
const currentBodySectPr = cloneJsonValue(getEditorBodySectPr(editor));
|
|
267204
|
+
const nextBodySectPr = cloneJsonValue$2(ydoc.getMap("meta").get(META_BODY_SECT_PR_KEY) ?? null);
|
|
267205
|
+
const currentBodySectPr = cloneJsonValue$2(getEditorBodySectPr(editor));
|
|
267189
267206
|
setEditorConverterBodySectPr(editor, nextBodySectPr);
|
|
267190
267207
|
if (serializeComparableValue(nextBodySectPr) === serializeComparableValue(currentBodySectPr))
|
|
267191
267208
|
return false;
|
|
@@ -267228,8 +267245,8 @@ var Node$13 = class Node$14 {
|
|
|
267228
267245
|
applyBodySectPrFromMetaMap(editor, ydoc);
|
|
267229
267246
|
return;
|
|
267230
267247
|
}
|
|
267231
|
-
const previousBodySectPr = cloneJsonValue(transaction.before?.attrs?.bodySectPr ?? null);
|
|
267232
|
-
const nextBodySectPr = cloneJsonValue(getEditorBodySectPr(editor));
|
|
267248
|
+
const previousBodySectPr = cloneJsonValue$2(transaction.before?.attrs?.bodySectPr ?? null);
|
|
267249
|
+
const nextBodySectPr = cloneJsonValue$2(getEditorBodySectPr(editor));
|
|
267233
267250
|
if (serializeComparableValue(previousBodySectPr) === serializeComparableValue(nextBodySectPr))
|
|
267234
267251
|
return;
|
|
267235
267252
|
syncBodySectPrToMetaMap(ydoc, editor);
|
|
@@ -267362,8 +267379,8 @@ var Node$13 = class Node$14 {
|
|
|
267362
267379
|
}
|
|
267363
267380
|
if (transaction.getMeta?.(BODY_SECT_PR_SYNC_META_KEY))
|
|
267364
267381
|
return;
|
|
267365
|
-
const previousBodySectPr = cloneJsonValue(transaction.before?.attrs?.bodySectPr ?? null);
|
|
267366
|
-
const nextBodySectPr = cloneJsonValue(getEditorBodySectPr(editor));
|
|
267382
|
+
const previousBodySectPr = cloneJsonValue$2(transaction.before?.attrs?.bodySectPr ?? null);
|
|
267383
|
+
const nextBodySectPr = cloneJsonValue$2(getEditorBodySectPr(editor));
|
|
267367
267384
|
const bodySectPrChanged = serializeComparableValue(previousBodySectPr) !== serializeComparableValue(nextBodySectPr);
|
|
267368
267385
|
const binding = ensureInitializedBinding();
|
|
267369
267386
|
if (binding && typeof binding._prosemirrorChanged === "function") {
|
|
@@ -272553,7 +272570,7 @@ var Node$13 = class Node$14 {
|
|
|
272553
272570
|
...node3.attrs,
|
|
272554
272571
|
marksAsAttrs: newMarks
|
|
272555
272572
|
};
|
|
272556
|
-
dispatch(state.tr.setNodeMarkup(pos, undefined, newAttrs));
|
|
272573
|
+
dispatch(state.tr.setNodeMarkup(pos, undefined, newAttrs).setMeta("skipTrackChanges", true).setMeta("addToHistory", false));
|
|
272557
272574
|
}, 0);
|
|
272558
272575
|
}
|
|
272559
272576
|
update(node3) {
|
|
@@ -279944,89 +279961,6 @@ var Node$13 = class Node$14 {
|
|
|
279944
279961
|
if (borders.between)
|
|
279945
279962
|
parts.push(`bw:[${hashParagraphBorder$2(borders.between)}]`);
|
|
279946
279963
|
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
279964
|
}, isDevelopment = () => {
|
|
280031
279965
|
if (typeof process$1 !== "undefined" && typeof process$1.env !== "undefined")
|
|
280032
279966
|
return process$1.env.NODE_ENV === "development";
|
|
@@ -280711,43 +280645,11 @@ menclose::after {
|
|
|
280711
280645
|
styleEl.textContent = MATH_MENCLOSE_STYLES;
|
|
280712
280646
|
doc$12.head?.appendChild(styleEl);
|
|
280713
280647
|
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) => {
|
|
280648
|
+
}, gradientIdCounter = 0, isBetweenBorderNone = (borders) => {
|
|
280747
280649
|
if (!borders?.between)
|
|
280748
280650
|
return true;
|
|
280749
280651
|
return borders.between.style === "none";
|
|
280750
|
-
}, computeBetweenBorderFlags = (fragments,
|
|
280652
|
+
}, computeBetweenBorderFlags = (fragments, resolvedItems) => {
|
|
280751
280653
|
const pairFlags = /* @__PURE__ */ new Set;
|
|
280752
280654
|
const noBetweenPairs = /* @__PURE__ */ new Set;
|
|
280753
280655
|
for (let i4 = 0;i4 < fragments.length - 1; i4 += 1) {
|
|
@@ -280756,10 +280658,10 @@ menclose::after {
|
|
|
280756
280658
|
continue;
|
|
280757
280659
|
if (frag.continuesOnNext)
|
|
280758
280660
|
continue;
|
|
280759
|
-
const resolvedCur = resolvedItems
|
|
280760
|
-
|
|
280761
|
-
if (!borders)
|
|
280661
|
+
const resolvedCur = resolvedItems[i4];
|
|
280662
|
+
if (!isResolvedFragmentWithBorders(resolvedCur))
|
|
280762
280663
|
continue;
|
|
280664
|
+
const borders = resolvedCur.paragraphBorders;
|
|
280763
280665
|
const next2 = fragments[i4 + 1];
|
|
280764
280666
|
if (next2.kind !== "para" && next2.kind !== "list-item")
|
|
280765
280667
|
continue;
|
|
@@ -280769,11 +280671,11 @@ menclose::after {
|
|
|
280769
280671
|
continue;
|
|
280770
280672
|
if (next2.blockId === frag.blockId && next2.kind === "list-item" && frag.kind === "list-item" && next2.itemId === frag.itemId)
|
|
280771
280673
|
continue;
|
|
280772
|
-
const resolvedNext = resolvedItems
|
|
280773
|
-
|
|
280774
|
-
if (!nextBorders)
|
|
280674
|
+
const resolvedNext = resolvedItems[i4 + 1];
|
|
280675
|
+
if (!isResolvedFragmentWithBorders(resolvedNext))
|
|
280775
280676
|
continue;
|
|
280776
|
-
|
|
280677
|
+
const nextBorders = resolvedNext.paragraphBorders;
|
|
280678
|
+
if (("paragraphBorderHash" in resolvedCur && resolvedCur.paragraphBorderHash ? resolvedCur.paragraphBorderHash : hashParagraphBorders$2(borders)) !== ("paragraphBorderHash" in resolvedNext && resolvedNext.paragraphBorderHash ? resolvedNext.paragraphBorderHash : hashParagraphBorders$2(nextBorders)))
|
|
280777
280679
|
continue;
|
|
280778
280680
|
if (frag.x !== next2.x)
|
|
280779
280681
|
continue;
|
|
@@ -280785,8 +280687,8 @@ menclose::after {
|
|
|
280785
280687
|
for (const i4 of pairFlags) {
|
|
280786
280688
|
const frag = fragments[i4];
|
|
280787
280689
|
const next2 = fragments[i4 + 1];
|
|
280788
|
-
const resolvedCur = resolvedItems
|
|
280789
|
-
const fragHeight = resolvedCur && "height" in resolvedCur && resolvedCur.height != null ? resolvedCur.height :
|
|
280690
|
+
const resolvedCur = resolvedItems[i4];
|
|
280691
|
+
const fragHeight = resolvedCur && "height" in resolvedCur && resolvedCur.height != null ? resolvedCur.height : 0;
|
|
280790
280692
|
const gapBelow = Math.max(0, next2.y - (frag.y + fragHeight));
|
|
280791
280693
|
const isNoBetween = noBetweenPairs.has(i4);
|
|
280792
280694
|
if (!result.has(i4))
|
|
@@ -282704,31 +282606,14 @@ menclose::after {
|
|
|
282704
282606
|
if (value != null)
|
|
282705
282607
|
element3.dataset[key2] = value;
|
|
282706
282608
|
});
|
|
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) => {
|
|
282609
|
+
}, DomPainter, computeSdtBoundaries = (fragments, resolvedItems, sdtLabelsRendered) => {
|
|
282726
282610
|
const boundaries = /* @__PURE__ */ new Map;
|
|
282727
|
-
const containerKeys =
|
|
282728
|
-
|
|
282611
|
+
const containerKeys = fragments.map((_frag, idx) => {
|
|
282612
|
+
const item = resolvedItems[idx];
|
|
282613
|
+
if (item && "sdtContainerKey" in item)
|
|
282729
282614
|
return item.sdtContainerKey ?? null;
|
|
282730
282615
|
return null;
|
|
282731
|
-
})
|
|
282616
|
+
});
|
|
282732
282617
|
let i4 = 0;
|
|
282733
282618
|
while (i4 < fragments.length) {
|
|
282734
282619
|
const currentKey = containerKeys[i4];
|
|
@@ -282751,7 +282636,7 @@ menclose::after {
|
|
|
282751
282636
|
let paddingBottomOverride;
|
|
282752
282637
|
if (!isEnd) {
|
|
282753
282638
|
const nextFragment = fragments[k$1 + 1];
|
|
282754
|
-
const currentHeight = resolvedItems
|
|
282639
|
+
const currentHeight = resolvedItems[k$1]?.height ?? 0;
|
|
282755
282640
|
const currentBottom = fragment2.y + currentHeight;
|
|
282756
282641
|
const gapToNext = nextFragment.y - currentBottom;
|
|
282757
282642
|
if (gapToNext > 0)
|
|
@@ -282785,406 +282670,7 @@ menclose::after {
|
|
|
282785
282670
|
return `table:${fragment2.blockId}:${fragment2.fromRow}:${fragment2.toRow}${partialKey}`;
|
|
282786
282671
|
}
|
|
282787
282672
|
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) => {
|
|
282673
|
+
}, 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
282674
|
if (hasVerticalPositioning(run2))
|
|
283189
282675
|
element3.style.lineHeight = "1";
|
|
283190
282676
|
const explicitBaselineShift = normalizeBaselineShift(run2.baselineShift);
|
|
@@ -283911,19 +283397,13 @@ menclose::after {
|
|
|
283911
283397
|
};
|
|
283912
283398
|
return {
|
|
283913
283399
|
paint(input2, mount, mapping) {
|
|
283914
|
-
const normalizedInput =
|
|
283400
|
+
const normalizedInput = isDomPainterInput(input2) ? input2 : buildLegacyPaintInput(input2, legacyState, options.flowMode, options.pageGap);
|
|
283915
283401
|
painter.paint(normalizedInput, mount, mapping);
|
|
283916
283402
|
},
|
|
283917
|
-
setData(blocks2, measures
|
|
283403
|
+
setData(blocks2, measures) {
|
|
283918
283404
|
assertRequiredBlockMeasurePair("body", blocks2, measures);
|
|
283919
|
-
const normalizedHeader = normalizeOptionalBlockMeasurePair("header", headerBlocks, headerMeasures);
|
|
283920
|
-
const normalizedFooter = normalizeOptionalBlockMeasurePair("footer", footerBlocks, footerMeasures);
|
|
283921
283405
|
legacyState.blocks = blocks2;
|
|
283922
283406
|
legacyState.measures = measures;
|
|
283923
|
-
legacyState.headerBlocks = normalizedHeader?.blocks;
|
|
283924
|
-
legacyState.headerMeasures = normalizedHeader?.measures;
|
|
283925
|
-
legacyState.footerBlocks = normalizedFooter?.blocks;
|
|
283926
|
-
legacyState.footerMeasures = normalizedFooter?.measures;
|
|
283927
283407
|
},
|
|
283928
283408
|
setResolvedLayout(resolvedLayout) {
|
|
283929
283409
|
legacyState.resolvedLayout = resolvedLayout;
|
|
@@ -290552,7 +290032,7 @@ menclose::after {
|
|
|
290552
290032
|
}
|
|
290553
290033
|
const region = this.#callbacks.hitTestHeaderFooterRegion?.(normalized.x, normalized.y, normalized.pageIndex, normalized.pageLocalY);
|
|
290554
290034
|
if (region) {
|
|
290555
|
-
if (sessionMode === "body") {
|
|
290035
|
+
if (sessionMode === "body" || this.#isDifferentHeaderFooterRegionFromActiveSession(region)) {
|
|
290556
290036
|
event.preventDefault();
|
|
290557
290037
|
event.stopPropagation();
|
|
290558
290038
|
this.#callbacks.activateHeaderFooterRegion?.(region, {
|
|
@@ -290840,17 +290320,49 @@ menclose::after {
|
|
|
290840
290320
|
this.#callbacks.exitHeaderFooterMode?.();
|
|
290841
290321
|
return false;
|
|
290842
290322
|
}
|
|
290843
|
-
|
|
290323
|
+
const headerFooterRegion = this.#callbacks.hitTestHeaderFooterRegion?.(x, y$1, pageIndex, pageLocalY);
|
|
290324
|
+
if (!headerFooterRegion) {
|
|
290844
290325
|
this.#callbacks.exitHeaderFooterMode?.();
|
|
290845
290326
|
return false;
|
|
290846
290327
|
}
|
|
290847
290328
|
if (visiblePointerSurface?.kind === "headerFooter" && !clickedInsideVisibleActiveSurface) {
|
|
290329
|
+
if (this.#isDifferentHeaderFooterRegionFromActiveSession(headerFooterRegion)) {
|
|
290330
|
+
event.preventDefault();
|
|
290331
|
+
return true;
|
|
290332
|
+
}
|
|
290848
290333
|
this.#callbacks.exitHeaderFooterMode?.();
|
|
290849
290334
|
return false;
|
|
290850
290335
|
}
|
|
290851
290336
|
this.#syncNonBodyCommentSelection(event, event.target, this.#deps.getEditor(), { clearOnMiss: true });
|
|
290852
290337
|
return false;
|
|
290853
290338
|
}
|
|
290339
|
+
#isDifferentHeaderFooterRegionFromActiveSession(region) {
|
|
290340
|
+
const session = this.#deps?.getHeaderFooterSession()?.session;
|
|
290341
|
+
if (!session || session.mode === "body")
|
|
290342
|
+
return true;
|
|
290343
|
+
if (session.mode !== region.kind)
|
|
290344
|
+
return true;
|
|
290345
|
+
if (session.headerFooterRefId && region.headerFooterRefId && session.headerFooterRefId !== region.headerFooterRefId)
|
|
290346
|
+
return true;
|
|
290347
|
+
if (Number.isFinite(session.pageIndex) && Number.isFinite(region.pageIndex) && session.pageIndex !== region.pageIndex)
|
|
290348
|
+
return true;
|
|
290349
|
+
return (session.sectionType ?? null) !== (region.sectionType ?? null);
|
|
290350
|
+
}
|
|
290351
|
+
#isSameHeaderFooterRegion(left$1, right$1) {
|
|
290352
|
+
if (!left$1 || !right$1)
|
|
290353
|
+
return false;
|
|
290354
|
+
if (left$1.kind !== right$1.kind || left$1.pageIndex !== right$1.pageIndex)
|
|
290355
|
+
return false;
|
|
290356
|
+
if ((left$1.sectionId ?? null) !== (right$1.sectionId ?? null))
|
|
290357
|
+
return false;
|
|
290358
|
+
if ((left$1.sectionType ?? null) !== (right$1.sectionType ?? null))
|
|
290359
|
+
return false;
|
|
290360
|
+
const leftRefId = left$1.headerFooterRefId ?? null;
|
|
290361
|
+
const rightRefId = right$1.headerFooterRefId ?? null;
|
|
290362
|
+
if (leftRefId && rightRefId && leftRefId !== rightRefId)
|
|
290363
|
+
return false;
|
|
290364
|
+
return true;
|
|
290365
|
+
}
|
|
290854
290366
|
#handleInlineImageClick(event, targetImg, rawHit, doc$12, epochMapper) {
|
|
290855
290367
|
if (!targetImg)
|
|
290856
290368
|
return false;
|
|
@@ -291042,21 +290554,22 @@ menclose::after {
|
|
|
291042
290554
|
#handleHover(normalized) {
|
|
291043
290555
|
if (!this.#deps)
|
|
291044
290556
|
return;
|
|
291045
|
-
if ((this.#deps.getHeaderFooterSession()?.session?.mode ?? "body") !== "body") {
|
|
291046
|
-
this.#callbacks.clearHoverRegion?.();
|
|
291047
|
-
return;
|
|
291048
|
-
}
|
|
291049
290557
|
if (this.#deps.getDocumentMode() === "viewing") {
|
|
291050
290558
|
this.#callbacks.clearHoverRegion?.();
|
|
291051
290559
|
return;
|
|
291052
290560
|
}
|
|
290561
|
+
const sessionMode = this.#deps.getHeaderFooterSession()?.session?.mode ?? "body";
|
|
291053
290562
|
const region = this.#callbacks.hitTestHeaderFooterRegion?.(normalized.x, normalized.y, normalized.pageIndex, normalized.pageLocalY);
|
|
291054
290563
|
if (!region) {
|
|
291055
290564
|
this.#callbacks.clearHoverRegion?.();
|
|
291056
290565
|
return;
|
|
291057
290566
|
}
|
|
290567
|
+
if (sessionMode !== "body" && !this.#isDifferentHeaderFooterRegionFromActiveSession(region)) {
|
|
290568
|
+
this.#callbacks.clearHoverRegion?.();
|
|
290569
|
+
return;
|
|
290570
|
+
}
|
|
291058
290571
|
const currentHover = this.#deps.getHeaderFooterSession()?.hoverRegion;
|
|
291059
|
-
if (currentHover
|
|
290572
|
+
if (this.#isSameHeaderFooterRegion(currentHover, region))
|
|
291060
290573
|
return;
|
|
291061
290574
|
this.#deps.getHeaderFooterSession()?.renderHover(region);
|
|
291062
290575
|
this.#callbacks.renderHoverRegion?.(region);
|
|
@@ -292510,6 +292023,7 @@ menclose::after {
|
|
|
292510
292023
|
#hoverOverlay = null;
|
|
292511
292024
|
#hoverTooltip = null;
|
|
292512
292025
|
#modeBanner = null;
|
|
292026
|
+
#activeBorderLine = null;
|
|
292513
292027
|
#hoverRegion = null;
|
|
292514
292028
|
#documentMode = "editing";
|
|
292515
292029
|
#trackedChangesRenderConfig = {
|
|
@@ -292733,6 +292247,7 @@ menclose::after {
|
|
|
292733
292247
|
if (!region.sectionId)
|
|
292734
292248
|
console.error("[HeaderFooterSessionManager] Footer region missing sectionId", region);
|
|
292735
292249
|
}
|
|
292250
|
+
this.#syncActiveBorder();
|
|
292736
292251
|
}
|
|
292737
292252
|
#buildSectionIdMap() {
|
|
292738
292253
|
const map$12 = /* @__PURE__ */ new Map;
|
|
@@ -292960,22 +292475,11 @@ menclose::after {
|
|
|
292960
292475
|
});
|
|
292961
292476
|
return null;
|
|
292962
292477
|
}
|
|
292478
|
+
const shouldRestoreInitialSelection = options?.initialSelection !== "defer";
|
|
292963
292479
|
try {
|
|
292964
292480
|
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
|
-
}
|
|
292481
|
+
if (shouldRestoreInitialSelection)
|
|
292482
|
+
this.#applyDefaultSelectionAtStoryEnd(editor, "Could not set cursor to end");
|
|
292979
292483
|
} catch (editableError) {
|
|
292980
292484
|
console.error("[HeaderFooterSessionManager] Error setting editor editable:", editableError);
|
|
292981
292485
|
this.clearHover();
|
|
@@ -293001,6 +292505,15 @@ menclose::after {
|
|
|
293001
292505
|
} catch (focusError) {
|
|
293002
292506
|
console.warn("[HeaderFooterSessionManager] Could not focus editor:", focusError);
|
|
293003
292507
|
}
|
|
292508
|
+
if (shouldRestoreInitialSelection) {
|
|
292509
|
+
this.#applyDefaultSelectionAtStoryEnd(editor, "Could not restore cursor after focus");
|
|
292510
|
+
try {
|
|
292511
|
+
editor.view?.focus();
|
|
292512
|
+
} catch (focusError) {
|
|
292513
|
+
console.warn("[HeaderFooterSessionManager] Could not refocus editor after restoring selection:", focusError);
|
|
292514
|
+
}
|
|
292515
|
+
this.#scheduleSelectionRestoreAfterFocus(editor);
|
|
292516
|
+
}
|
|
293004
292517
|
this.#emitModeChanged();
|
|
293005
292518
|
this.#emitEditingContext(editor);
|
|
293006
292519
|
this.#deps?.notifyInputBridgeTargetChanged();
|
|
@@ -293046,6 +292559,45 @@ menclose::after {
|
|
|
293046
292559
|
pm.classList.toggle("view-mode", mode === "viewing");
|
|
293047
292560
|
}
|
|
293048
292561
|
}
|
|
292562
|
+
#getDefaultSelectionAtStoryEnd(editor) {
|
|
292563
|
+
const doc$12 = editor.state?.doc;
|
|
292564
|
+
if (!doc$12)
|
|
292565
|
+
return null;
|
|
292566
|
+
const endPos = doc$12.content.size - 1;
|
|
292567
|
+
const pos = Math.max(1, endPos);
|
|
292568
|
+
return {
|
|
292569
|
+
from: pos,
|
|
292570
|
+
to: pos
|
|
292571
|
+
};
|
|
292572
|
+
}
|
|
292573
|
+
#applyEditorTextSelection(editor, selection, warningMessage) {
|
|
292574
|
+
try {
|
|
292575
|
+
editor.commands?.setTextSelection?.(selection);
|
|
292576
|
+
} catch (error3) {
|
|
292577
|
+
console.warn(`[HeaderFooterSessionManager] ${warningMessage}:`, error3);
|
|
292578
|
+
}
|
|
292579
|
+
}
|
|
292580
|
+
#applyDefaultSelectionAtStoryEnd(editor, warningMessage) {
|
|
292581
|
+
const selection = this.#getDefaultSelectionAtStoryEnd(editor);
|
|
292582
|
+
if (!selection)
|
|
292583
|
+
return;
|
|
292584
|
+
this.#applyEditorTextSelection(editor, selection, warningMessage);
|
|
292585
|
+
}
|
|
292586
|
+
#scheduleSelectionRestoreAfterFocus(editor) {
|
|
292587
|
+
const win = editor.view?.dom?.ownerDocument?.defaultView;
|
|
292588
|
+
if (!win)
|
|
292589
|
+
return;
|
|
292590
|
+
win.requestAnimationFrame(() => {
|
|
292591
|
+
if (this.#activeEditor !== editor || this.#session.mode === "body")
|
|
292592
|
+
return;
|
|
292593
|
+
this.#applyDefaultSelectionAtStoryEnd(editor, "Could not restore cursor on the next frame");
|
|
292594
|
+
try {
|
|
292595
|
+
editor.view?.focus();
|
|
292596
|
+
} catch (focusError) {
|
|
292597
|
+
console.warn("[HeaderFooterSessionManager] Could not refocus editor on the next frame:", focusError);
|
|
292598
|
+
}
|
|
292599
|
+
});
|
|
292600
|
+
}
|
|
293049
292601
|
#validateEditPermission() {
|
|
293050
292602
|
if (this.#deps?.isViewLocked())
|
|
293051
292603
|
return {
|
|
@@ -293078,6 +292630,7 @@ menclose::after {
|
|
|
293078
292630
|
this.#callbacks.onModeChanged?.(this.#session);
|
|
293079
292631
|
this.#callbacks.onUpdateAwarenessSession?.(this.#session);
|
|
293080
292632
|
this.#updateModeBanner();
|
|
292633
|
+
this.#syncActiveBorder();
|
|
293081
292634
|
}
|
|
293082
292635
|
#emitEditingContext(editor) {
|
|
293083
292636
|
this.#callbacks.onEditingContext?.({
|
|
@@ -293181,6 +292734,42 @@ menclose::after {
|
|
|
293181
292734
|
get hoverRegion() {
|
|
293182
292735
|
return this.#hoverRegion;
|
|
293183
292736
|
}
|
|
292737
|
+
#getActiveRegion() {
|
|
292738
|
+
if (this.#session.mode === "header")
|
|
292739
|
+
return this.#headerRegions.get(this.#session.pageIndex ?? -1) ?? null;
|
|
292740
|
+
if (this.#session.mode === "footer")
|
|
292741
|
+
return this.#footerRegions.get(this.#session.pageIndex ?? -1) ?? null;
|
|
292742
|
+
return null;
|
|
292743
|
+
}
|
|
292744
|
+
#hideActiveBorder() {
|
|
292745
|
+
if (this.#activeBorderLine) {
|
|
292746
|
+
this.#activeBorderLine.remove();
|
|
292747
|
+
this.#activeBorderLine = null;
|
|
292748
|
+
}
|
|
292749
|
+
}
|
|
292750
|
+
#syncActiveBorder() {
|
|
292751
|
+
this.#hideActiveBorder();
|
|
292752
|
+
const region = this.#getActiveRegion();
|
|
292753
|
+
if (!region || this.#session.mode === "body")
|
|
292754
|
+
return;
|
|
292755
|
+
const pageElement = this.#deps?.getPageElement(region.pageIndex);
|
|
292756
|
+
if (!pageElement)
|
|
292757
|
+
return;
|
|
292758
|
+
const borderLine = pageElement.ownerDocument.createElement("div");
|
|
292759
|
+
borderLine.className = "superdoc-header-footer-border";
|
|
292760
|
+
Object.assign(borderLine.style, {
|
|
292761
|
+
position: "absolute",
|
|
292762
|
+
left: "0",
|
|
292763
|
+
right: "0",
|
|
292764
|
+
top: `${region.kind === "header" ? region.localY + region.height : region.localY}px`,
|
|
292765
|
+
height: "1px",
|
|
292766
|
+
backgroundColor: "#4472c4",
|
|
292767
|
+
pointerEvents: "none",
|
|
292768
|
+
zIndex: "8"
|
|
292769
|
+
});
|
|
292770
|
+
pageElement.appendChild(borderLine);
|
|
292771
|
+
this.#activeBorderLine = borderLine;
|
|
292772
|
+
}
|
|
293184
292773
|
buildLayoutInput() {
|
|
293185
292774
|
if (!this.#headerFooterAdapter)
|
|
293186
292775
|
return null;
|
|
@@ -293834,6 +293423,7 @@ menclose::after {
|
|
|
293834
293423
|
this.#footerRegions.clear();
|
|
293835
293424
|
this.#session = { mode: "body" };
|
|
293836
293425
|
this.#activeEditor = null;
|
|
293426
|
+
this.#hideActiveBorder();
|
|
293837
293427
|
this.#hoverOverlay = null;
|
|
293838
293428
|
this.#hoverTooltip = null;
|
|
293839
293429
|
this.#modeBanner = null;
|
|
@@ -294035,12 +293625,12 @@ menclose::after {
|
|
|
294035
293625
|
return;
|
|
294036
293626
|
console.log(...args$1);
|
|
294037
293627
|
}, 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
|
|
293628
|
+
var init_src_1sL7dd0v_es = __esm(() => {
|
|
294039
293629
|
init_rolldown_runtime_Bg48TavK_es();
|
|
294040
|
-
|
|
293630
|
+
init_SuperConverter_aq0iFjuQ_es();
|
|
294041
293631
|
init_jszip_C49i9kUs_es();
|
|
294042
293632
|
init_uuid_qzgm05fK_es();
|
|
294043
|
-
|
|
293633
|
+
init_create_headless_toolbar_bhnvM7MP_es();
|
|
294044
293634
|
init_constants_CGhJRd87_es();
|
|
294045
293635
|
init_dist_B8HfvhaK_es();
|
|
294046
293636
|
init_unified_Dsuw2be5_es();
|
|
@@ -295596,7 +295186,7 @@ ${err.toString()}`);
|
|
|
295596
295186
|
isRightClick = true;
|
|
295597
295187
|
} else {
|
|
295598
295188
|
const relativePoint = getSurfaceRelativePoint(editor, meta2);
|
|
295599
|
-
const surface = editor
|
|
295189
|
+
const surface = getEditorSurfaceElement(editor);
|
|
295600
295190
|
if (relativePoint && surface)
|
|
295601
295191
|
try {
|
|
295602
295192
|
const rect = surface.getBoundingClientRect();
|
|
@@ -295616,7 +295206,7 @@ ${err.toString()}`);
|
|
|
295616
295206
|
return ensureStateShape(value);
|
|
295617
295207
|
}
|
|
295618
295208
|
}
|
|
295619
|
-
const containingBlock = findContainingBlockAncestor(editor
|
|
295209
|
+
const containingBlock = findContainingBlockAncestor(getEditorSurfaceElement(editor));
|
|
295620
295210
|
if (containingBlock)
|
|
295621
295211
|
try {
|
|
295622
295212
|
const cbRect = containingBlock.getBoundingClientRect();
|
|
@@ -318949,6 +318539,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
318949
318539
|
}
|
|
318950
318540
|
async exportDocx({ isFinalDoc = false, commentsType = "external", exportJsonOnly = false, exportXmlOnly = false, comments, getUpdatedDocs = false, fieldsHighlightColor = null, compression } = {}) {
|
|
318951
318541
|
try {
|
|
318542
|
+
commitLiveStorySessionRuntimes(resolveMainBodyEditor(this));
|
|
318952
318543
|
const preparedComments = (comments ?? this.converter.comments ?? []).map((comment2) => {
|
|
318953
318544
|
const elements = Array.isArray(comment2.elements) && comment2.elements.length ? comment2.elements : undefined;
|
|
318954
318545
|
return {
|
|
@@ -319951,7 +319542,6 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
319951
319542
|
this.options = options;
|
|
319952
319543
|
this.layoutMode = options.layoutMode ?? "vertical";
|
|
319953
319544
|
this.isSemanticFlow = (options.flowMode ?? "paginated") === "semantic";
|
|
319954
|
-
this.blockLookup = /* @__PURE__ */ new Map;
|
|
319955
319545
|
this.headerProvider = options.headerProvider;
|
|
319956
319546
|
this.footerProvider = options.footerProvider;
|
|
319957
319547
|
const defaultGap = this.layoutMode === "horizontal" ? 20 : 24;
|
|
@@ -320138,45 +319728,10 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
320138
319728
|
entities: collectPaintSnapshotEntitiesFromDomRoot(rootEl)
|
|
320139
319729
|
};
|
|
320140
319730
|
}
|
|
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
319731
|
paint(input2, mount, mapping) {
|
|
320177
319732
|
const layout = input2.sourceLayout;
|
|
320178
319733
|
this.resolvedLayout = input2.resolvedLayout;
|
|
320179
|
-
this.
|
|
319734
|
+
this.changedBlocks.clear();
|
|
320180
319735
|
if (!(mount instanceof HTMLElement))
|
|
320181
319736
|
throw new Error("DomPainter.paint requires a valid HTMLElement mount");
|
|
320182
319737
|
const doc$12 = mount.ownerDocument ?? (typeof document !== "undefined" ? document : null);
|
|
@@ -320190,7 +319745,6 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
320190
319745
|
for (const item of page.items)
|
|
320191
319746
|
if ("blockId" in item)
|
|
320192
319747
|
this.changedBlocks.add(item.blockId);
|
|
320193
|
-
this.blockLookup.forEach((_$1, id2) => this.changedBlocks.add(id2));
|
|
320194
319748
|
this.currentMapping = null;
|
|
320195
319749
|
} else
|
|
320196
319750
|
this.currentMapping = mapping ?? null;
|
|
@@ -320610,8 +320164,9 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
320610
320164
|
pageNumberText: resolvedPage?.numberText ?? page.numberText,
|
|
320611
320165
|
pageIndex
|
|
320612
320166
|
};
|
|
320613
|
-
const
|
|
320614
|
-
const
|
|
320167
|
+
const resolvedItems = resolvedPage?.items ?? [];
|
|
320168
|
+
const sdtBoundaries = computeSdtBoundaries(page.fragments, resolvedItems, this.sdtLabelsRendered);
|
|
320169
|
+
const betweenBorderFlags = computeBetweenBorderFlags(page.fragments, resolvedItems);
|
|
320615
320170
|
page.fragments.forEach((fragment2, index2) => {
|
|
320616
320171
|
const sdtBoundary = sdtBoundaries.get(index2);
|
|
320617
320172
|
const resolvedItem = this.getResolvedFragmentItem(pageIndex, index2);
|
|
@@ -320743,7 +320298,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
320743
320298
|
isPageRelativeAnchoredFragment(fragment2, resolvedItem) {
|
|
320744
320299
|
if (fragment2.kind !== "image" && fragment2.kind !== "drawing")
|
|
320745
320300
|
return false;
|
|
320746
|
-
const block =
|
|
320301
|
+
const block = resolvedItem && "block" in resolvedItem ? resolvedItem.block : undefined;
|
|
320747
320302
|
if (!block || block.kind !== "image" && block.kind !== "drawing")
|
|
320748
320303
|
return false;
|
|
320749
320304
|
return block.anchor?.vRelativeFrom === "page";
|
|
@@ -320812,14 +320367,17 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
320812
320367
|
pageNumberText: resolvedPage?.numberText ?? page.numberText,
|
|
320813
320368
|
pageIndex
|
|
320814
320369
|
};
|
|
320815
|
-
const
|
|
320370
|
+
const decorationItems = data.items ?? [];
|
|
320371
|
+
const betweenBorderFlags = computeBetweenBorderFlags(data.fragments, decorationItems);
|
|
320816
320372
|
const behindDocFragments = [];
|
|
320817
320373
|
const normalFragments = [];
|
|
320818
320374
|
for (let fi = 0;fi < data.fragments.length; fi += 1) {
|
|
320819
320375
|
const fragment2 = data.fragments[fi];
|
|
320820
320376
|
let isBehindDoc = false;
|
|
320821
|
-
if (fragment2.kind === "image" || fragment2.kind === "drawing")
|
|
320822
|
-
|
|
320377
|
+
if (fragment2.kind === "image" || fragment2.kind === "drawing") {
|
|
320378
|
+
const resolvedItem = decorationItems[fi];
|
|
320379
|
+
isBehindDoc = fragment2.behindDoc === true || fragment2.behindDoc == null && "zIndex" in fragment2 && fragment2.zIndex === 0 || this.shouldRenderBehindPageContent(fragment2, kind, resolvedItem);
|
|
320380
|
+
}
|
|
320823
320381
|
if (isBehindDoc)
|
|
320824
320382
|
behindDocFragments.push({
|
|
320825
320383
|
fragment: fragment2,
|
|
@@ -320953,8 +320511,9 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
320953
320511
|
pageEl.dataset.layoutEpoch = String(this.layoutEpoch);
|
|
320954
320512
|
const existing = new Map(state.fragments.map((frag) => [frag.key, frag]));
|
|
320955
320513
|
const nextFragments = [];
|
|
320956
|
-
const
|
|
320957
|
-
const
|
|
320514
|
+
const resolvedItems = resolvedPage?.items ?? [];
|
|
320515
|
+
const sdtBoundaries = computeSdtBoundaries(page.fragments, resolvedItems, this.sdtLabelsRendered);
|
|
320516
|
+
const betweenBorderFlags = computeBetweenBorderFlags(page.fragments, resolvedItems);
|
|
320958
320517
|
const contextBase = {
|
|
320959
320518
|
pageNumber: page.number,
|
|
320960
320519
|
totalPages: this.totalPages,
|
|
@@ -320968,6 +320527,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
320968
320527
|
const sdtBoundary = sdtBoundaries.get(index2);
|
|
320969
320528
|
const betweenInfo = betweenBorderFlags.get(index2);
|
|
320970
320529
|
const resolvedItem = this.getResolvedFragmentItem(pageIndex, index2);
|
|
320530
|
+
const resolvedSig = resolvedItem?.version ?? "";
|
|
320971
320531
|
if (current) {
|
|
320972
320532
|
existing.delete(key2);
|
|
320973
320533
|
const geometryChanged = hasFragmentGeometryChanged(current.fragment, fragment2);
|
|
@@ -320975,12 +320535,11 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
320975
320535
|
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
320536
|
const newPmStart = fragment2.pmStart;
|
|
320977
320537
|
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) {
|
|
320538
|
+
if (geometryChanged || this.changedBlocks.has(fragment2.blockId) || current.signature !== resolvedSig || sdtBoundaryMismatch || betweenBorderMismatch || mappingUnreliable) {
|
|
320980
320539
|
const replacement = this.renderFragment(fragment2, contextBase, sdtBoundary, betweenInfo, resolvedItem);
|
|
320981
320540
|
pageEl.replaceChild(replacement, current.element);
|
|
320982
320541
|
current.element = replacement;
|
|
320983
|
-
current.signature = resolvedSig
|
|
320542
|
+
current.signature = resolvedSig;
|
|
320984
320543
|
} else if (this.currentMapping)
|
|
320985
320544
|
this.updatePositionAttributes(current.element, this.currentMapping);
|
|
320986
320545
|
this.updateFragmentElement(current.element, fragment2, contextBase.section, resolvedItem);
|
|
@@ -320994,12 +320553,11 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
320994
320553
|
}
|
|
320995
320554
|
const fresh = this.renderFragment(fragment2, contextBase, sdtBoundary, betweenInfo, resolvedItem);
|
|
320996
320555
|
pageEl.insertBefore(fresh, pageEl.children[index2] ?? null);
|
|
320997
|
-
const freshSig = resolvedItem && "version" in resolvedItem ? resolvedItem.version : undefined;
|
|
320998
320556
|
nextFragments.push({
|
|
320999
320557
|
key: key2,
|
|
321000
320558
|
fragment: fragment2,
|
|
321001
320559
|
element: fresh,
|
|
321002
|
-
signature:
|
|
320560
|
+
signature: resolvedSig,
|
|
321003
320561
|
context: contextBase
|
|
321004
320562
|
});
|
|
321005
320563
|
});
|
|
@@ -321061,17 +320619,18 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
321061
320619
|
pageNumberText: resolvedPage?.numberText ?? page.numberText,
|
|
321062
320620
|
pageIndex
|
|
321063
320621
|
};
|
|
321064
|
-
const
|
|
321065
|
-
const
|
|
320622
|
+
const resolvedItems = resolvedPage?.items ?? [];
|
|
320623
|
+
const sdtBoundaries = computeSdtBoundaries(page.fragments, resolvedItems, this.sdtLabelsRendered);
|
|
320624
|
+
const betweenBorderFlags = computeBetweenBorderFlags(page.fragments, resolvedItems);
|
|
321066
320625
|
const fragmentStates = page.fragments.map((fragment2, index2) => {
|
|
321067
320626
|
const sdtBoundary = sdtBoundaries.get(index2);
|
|
321068
320627
|
const resolvedItem = this.getResolvedFragmentItem(pageIndex, index2);
|
|
321069
320628
|
const fragmentEl = this.renderFragment(fragment2, contextBase, sdtBoundary, betweenBorderFlags.get(index2), resolvedItem);
|
|
321070
320629
|
el.appendChild(fragmentEl);
|
|
321071
|
-
const initSig = resolvedItem
|
|
320630
|
+
const initSig = resolvedItem?.version ?? "";
|
|
321072
320631
|
return {
|
|
321073
320632
|
key: fragmentKey(fragment2),
|
|
321074
|
-
signature: initSig
|
|
320633
|
+
signature: initSig,
|
|
321075
320634
|
fragment: fragment2,
|
|
321076
320635
|
element: fragmentEl,
|
|
321077
320636
|
context: contextBase
|
|
@@ -321126,7 +320685,10 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
321126
320685
|
try {
|
|
321127
320686
|
if (!this.doc)
|
|
321128
320687
|
throw new Error("DomPainter: document is not available");
|
|
321129
|
-
|
|
320688
|
+
if (resolvedItem?.block?.kind !== "paragraph" || resolvedItem?.measure?.kind !== "paragraph")
|
|
320689
|
+
throw new Error(`DomPainter: missing resolved paragraph block/measure for fragment ${fragment2.blockId}`);
|
|
320690
|
+
const block = resolvedItem.block;
|
|
320691
|
+
const measure = resolvedItem.measure;
|
|
321130
320692
|
const wordLayout = isMinimalWordLayout$1(block.attrs?.wordLayout) ? block.attrs.wordLayout : undefined;
|
|
321131
320693
|
const content3 = resolvedItem?.content;
|
|
321132
320694
|
const paraContinuesFromPrev = resolvedItem?.continuesFromPrev ?? fragment2.continuesFromPrev;
|
|
@@ -321478,7 +321040,10 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
321478
321040
|
try {
|
|
321479
321041
|
if (!this.doc)
|
|
321480
321042
|
throw new Error("DomPainter: document is not available");
|
|
321481
|
-
|
|
321043
|
+
if (resolvedItem?.block?.kind !== "list" || resolvedItem?.measure?.kind !== "list")
|
|
321044
|
+
throw new Error(`DomPainter: missing resolved list block/measure for fragment ${fragment2.blockId}`);
|
|
321045
|
+
const block = resolvedItem.block;
|
|
321046
|
+
const measure = resolvedItem.measure;
|
|
321482
321047
|
const item = block.items.find((entry) => entry.id === fragment2.itemId);
|
|
321483
321048
|
const itemMeasure = measure.items.find((entry) => entry.itemId === fragment2.itemId);
|
|
321484
321049
|
if (!item || !itemMeasure)
|
|
@@ -321577,7 +321142,9 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
321577
321142
|
}
|
|
321578
321143
|
renderImageFragment(fragment2, context, resolvedItem) {
|
|
321579
321144
|
try {
|
|
321580
|
-
|
|
321145
|
+
if (resolvedItem?.block?.kind !== "image")
|
|
321146
|
+
throw new Error(`DomPainter: missing resolved image block for fragment ${fragment2.blockId}`);
|
|
321147
|
+
const block = resolvedItem.block;
|
|
321581
321148
|
if (!this.doc)
|
|
321582
321149
|
throw new Error("DomPainter: document is not available");
|
|
321583
321150
|
const fragmentEl = this.doc.createElement("div");
|
|
@@ -321692,7 +321259,9 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
321692
321259
|
}
|
|
321693
321260
|
renderDrawingFragment(fragment2, context, resolvedItem) {
|
|
321694
321261
|
try {
|
|
321695
|
-
|
|
321262
|
+
if (resolvedItem?.block?.kind !== "drawing")
|
|
321263
|
+
throw new Error(`DomPainter: missing resolved drawing block for fragment ${fragment2.blockId}`);
|
|
321264
|
+
const block = resolvedItem.block;
|
|
321696
321265
|
if (!this.doc)
|
|
321697
321266
|
throw new Error("DomPainter: document is not available");
|
|
321698
321267
|
const fragmentEl = this.doc.createElement("div");
|
|
@@ -322355,23 +321924,13 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
322355
321924
|
return createChartElement(this.doc, block.chartData, block.geometry);
|
|
322356
321925
|
}
|
|
322357
321926
|
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;
|
|
321927
|
+
if (!resolvedItem)
|
|
321928
|
+
throw new Error(`DomPainter: missing resolved table item for fragment ${fragment2.blockId}`);
|
|
322370
321929
|
return {
|
|
322371
|
-
block,
|
|
322372
|
-
measure,
|
|
322373
|
-
cellSpacingPx:
|
|
322374
|
-
effectiveColumnWidths:
|
|
321930
|
+
block: resolvedItem.block,
|
|
321931
|
+
measure: resolvedItem.measure,
|
|
321932
|
+
cellSpacingPx: resolvedItem.cellSpacingPx,
|
|
321933
|
+
effectiveColumnWidths: resolvedItem.effectiveColumnWidths
|
|
322375
321934
|
};
|
|
322376
321935
|
}
|
|
322377
321936
|
renderTableFragment(fragment2, context, sdtBoundary, resolvedItem) {
|
|
@@ -323569,16 +323128,14 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
323569
323128
|
isAnchoredMediaFragment(fragment2) {
|
|
323570
323129
|
return (fragment2.kind === "image" || fragment2.kind === "drawing") && fragment2.isAnchored === true;
|
|
323571
323130
|
}
|
|
323572
|
-
shouldRenderBehindPageContent(fragment2, section) {
|
|
323131
|
+
shouldRenderBehindPageContent(fragment2, section, resolvedItem) {
|
|
323573
323132
|
if (fragment2.behindDoc === true || fragment2.behindDoc == null && "zIndex" in fragment2 && fragment2.zIndex === 0)
|
|
323574
323133
|
return true;
|
|
323575
|
-
return section === "header" && fragment2.kind === "drawing" && this.isHeaderWordArtWatermark(
|
|
323134
|
+
return section === "header" && fragment2.kind === "drawing" && this.isHeaderWordArtWatermark(resolvedItem?.block);
|
|
323576
323135
|
}
|
|
323577
|
-
isHeaderWordArtWatermark(
|
|
323578
|
-
|
|
323579
|
-
if (!lookup3 || lookup3.block.kind !== "drawing" || lookup3.block.drawingKind !== "vectorShape")
|
|
323136
|
+
isHeaderWordArtWatermark(block) {
|
|
323137
|
+
if (!block || block.kind !== "drawing" || block.drawingKind !== "vectorShape")
|
|
323580
323138
|
return false;
|
|
323581
|
-
const block = lookup3.block;
|
|
323582
323139
|
const attrs = block.attrs ?? {};
|
|
323583
323140
|
const hasTextContent = Array.isArray(block.textContent?.parts) && block.textContent.parts.length > 0;
|
|
323584
323141
|
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 +323169,10 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
323612
323169
|
estimateFragmentHeight(fragment2, resolvedItem) {
|
|
323613
323170
|
if (resolvedItem && "height" in resolvedItem && typeof resolvedItem.height === "number")
|
|
323614
323171
|
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")
|
|
323172
|
+
if (fragment2.kind === "table" || fragment2.kind === "image" || fragment2.kind === "drawing")
|
|
323623
323173
|
return fragment2.height;
|
|
323624
323174
|
return 0;
|
|
323625
323175
|
}
|
|
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
323176
|
static {
|
|
323662
323177
|
this.SDT_DATASET_KEYS = [
|
|
323663
323178
|
"sdtType",
|
|
@@ -324979,6 +324494,10 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
324979
324494
|
#storySessionSelectionHandler = null;
|
|
324980
324495
|
#storySessionTransactionHandler = null;
|
|
324981
324496
|
#storySessionEditor = null;
|
|
324497
|
+
#activeSurfaceUiEventEditor = null;
|
|
324498
|
+
#activeSurfaceUiUpdateHandler = null;
|
|
324499
|
+
#activeSurfaceUiContextMenuOpenHandler = null;
|
|
324500
|
+
#activeSurfaceUiContextMenuCloseHandler = null;
|
|
324982
324501
|
#lastSelectedFieldAnnotation = null;
|
|
324983
324502
|
#lastSelectedStructuredContentBlock = null;
|
|
324984
324503
|
#lastSelectedStructuredContentInline = null;
|
|
@@ -325372,6 +324891,19 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
325372
324891
|
return null;
|
|
325373
324892
|
return session;
|
|
325374
324893
|
}
|
|
324894
|
+
#buildActiveNoteRenderOverride(storyType) {
|
|
324895
|
+
const session = this.#getActiveNoteStorySession();
|
|
324896
|
+
if (!session || session.locator.storyType !== storyType)
|
|
324897
|
+
return null;
|
|
324898
|
+
const storyEditor = session.editor;
|
|
324899
|
+
const docJson = typeof storyEditor.getUpdatedJson === "function" ? storyEditor.getUpdatedJson() : typeof storyEditor.getJSON === "function" ? storyEditor.getJSON() : null;
|
|
324900
|
+
if (!docJson || typeof docJson !== "object")
|
|
324901
|
+
return null;
|
|
324902
|
+
return {
|
|
324903
|
+
noteId: session.locator.noteId,
|
|
324904
|
+
docJson
|
|
324905
|
+
};
|
|
324906
|
+
}
|
|
325375
324907
|
#getActiveTrackedChangeStorySurface() {
|
|
325376
324908
|
const storySession = this.#getActiveStorySession();
|
|
325377
324909
|
if (storySession)
|
|
@@ -325396,6 +324928,12 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
325396
324928
|
getStorySessionManager() {
|
|
325397
324929
|
return this.#storySessionManager;
|
|
325398
324930
|
}
|
|
324931
|
+
exitActiveStorySurface() {
|
|
324932
|
+
if ((this.#headerFooterSession?.session?.mode ?? "body") !== "body")
|
|
324933
|
+
this.#exitHeaderFooterMode();
|
|
324934
|
+
if (this.#getActiveStorySession())
|
|
324935
|
+
this.#exitActiveStorySession();
|
|
324936
|
+
}
|
|
325399
324937
|
#resolveActiveSurface() {
|
|
325400
324938
|
const mode = this.#headerFooterSession?.session?.mode ?? "body";
|
|
325401
324939
|
if (mode === "header")
|
|
@@ -325903,13 +325441,16 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
325903
325441
|
}).filter((rect) => Boolean(rect));
|
|
325904
325442
|
if (!rects.length)
|
|
325905
325443
|
return null;
|
|
325906
|
-
const
|
|
325444
|
+
const groupedRects = this.#groupRangeRectsByPage(rects);
|
|
325445
|
+
const preferredPageIndex = this.#getPreferredRenderedTrackedChangePageIndex(storyKey, groupedRects, relativeTo);
|
|
325446
|
+
const anchorRects = groupedRects.get(preferredPageIndex) ?? rects;
|
|
325447
|
+
const bounds = this.#aggregateLayoutBounds(anchorRects);
|
|
325907
325448
|
if (!bounds)
|
|
325908
325449
|
return null;
|
|
325909
325450
|
return {
|
|
325910
325451
|
bounds,
|
|
325911
325452
|
rects,
|
|
325912
|
-
pageIndex:
|
|
325453
|
+
pageIndex: preferredPageIndex
|
|
325913
325454
|
};
|
|
325914
325455
|
}
|
|
325915
325456
|
#findRenderedTrackedChangeElements(rawId, storyKey) {
|
|
@@ -325917,8 +325458,69 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
325917
325458
|
if (!host)
|
|
325918
325459
|
return [];
|
|
325919
325460
|
const baseSelector = `[data-track-change-id="${escapeAttrValue(rawId)}"]`;
|
|
325920
|
-
|
|
325921
|
-
|
|
325461
|
+
if (!storyKey)
|
|
325462
|
+
return Array.from(host.querySelectorAll(baseSelector));
|
|
325463
|
+
const storySelector = `${baseSelector}[data-story-key="${escapeAttrValue(storyKey)}"]`;
|
|
325464
|
+
const exactMatches = Array.from(host.querySelectorAll(storySelector));
|
|
325465
|
+
const allMatches = Array.from(host.querySelectorAll(baseSelector));
|
|
325466
|
+
if (exactMatches.length > 1 || exactMatches.length === allMatches.length || allMatches.length === 0)
|
|
325467
|
+
return exactMatches;
|
|
325468
|
+
return allMatches;
|
|
325469
|
+
}
|
|
325470
|
+
#groupRangeRectsByPage(rects) {
|
|
325471
|
+
const grouped = /* @__PURE__ */ new Map;
|
|
325472
|
+
rects.forEach((rect) => {
|
|
325473
|
+
const pageIndex = Number.isFinite(rect.pageIndex) ? rect.pageIndex : 0;
|
|
325474
|
+
const pageRects = grouped.get(pageIndex);
|
|
325475
|
+
if (pageRects) {
|
|
325476
|
+
pageRects.push(rect);
|
|
325477
|
+
return;
|
|
325478
|
+
}
|
|
325479
|
+
grouped.set(pageIndex, [rect]);
|
|
325480
|
+
});
|
|
325481
|
+
return grouped;
|
|
325482
|
+
}
|
|
325483
|
+
#getPreferredRenderedTrackedChangePageIndex(storyKey, groupedRects, relativeTo) {
|
|
325484
|
+
const activeHeaderFooterSession = this.#headerFooterSession?.session;
|
|
325485
|
+
const activePageIndex = (activeHeaderFooterSession?.mode !== "body" && activeHeaderFooterSession?.headerFooterRefId ? buildStoryKey({
|
|
325486
|
+
kind: "story",
|
|
325487
|
+
storyType: "headerFooterPart",
|
|
325488
|
+
refId: activeHeaderFooterSession.headerFooterRefId
|
|
325489
|
+
}) : null) === storyKey && Number.isFinite(activeHeaderFooterSession?.pageIndex) ? Number(activeHeaderFooterSession?.pageIndex) : null;
|
|
325490
|
+
if (activePageIndex != null && groupedRects.has(activePageIndex))
|
|
325491
|
+
return activePageIndex;
|
|
325492
|
+
const viewportRect = (this.#scrollContainer instanceof Window ? {
|
|
325493
|
+
top: 0,
|
|
325494
|
+
bottom: this.#scrollContainer.innerHeight
|
|
325495
|
+
} : this.#scrollContainer instanceof Element ? this.#scrollContainer.getBoundingClientRect() : this.#visibleHost?.ownerDocument?.defaultView ? {
|
|
325496
|
+
top: 0,
|
|
325497
|
+
bottom: this.#visibleHost.ownerDocument.defaultView.innerHeight
|
|
325498
|
+
} : this.#visibleHost?.getBoundingClientRect?.()) ?? null;
|
|
325499
|
+
if (viewportRect) {
|
|
325500
|
+
const relativeRect = relativeTo?.getBoundingClientRect?.();
|
|
325501
|
+
const visibleTop = viewportRect.top - (relativeRect?.top ?? 0);
|
|
325502
|
+
const visibleBottom = viewportRect.bottom - (relativeRect?.top ?? 0);
|
|
325503
|
+
const viewportCenter = visibleTop + (visibleBottom - visibleTop) / 2;
|
|
325504
|
+
let bestPageIndex = null;
|
|
325505
|
+
let bestIntersection = -1;
|
|
325506
|
+
let bestDistance = Number.POSITIVE_INFINITY;
|
|
325507
|
+
groupedRects.forEach((pageRects, pageIndex) => {
|
|
325508
|
+
const pageBounds = this.#aggregateLayoutBounds(pageRects);
|
|
325509
|
+
if (!pageBounds)
|
|
325510
|
+
return;
|
|
325511
|
+
const intersection = Math.max(0, Math.min(pageBounds.bottom, visibleBottom) - Math.max(pageBounds.top, visibleTop));
|
|
325512
|
+
const pageCenter = pageBounds.top + pageBounds.height / 2;
|
|
325513
|
+
const distance2 = Math.abs(pageCenter - viewportCenter);
|
|
325514
|
+
if (intersection > bestIntersection || intersection === bestIntersection && distance2 < bestDistance || intersection === bestIntersection && distance2 === bestDistance && (bestPageIndex == null || pageIndex < bestPageIndex)) {
|
|
325515
|
+
bestPageIndex = pageIndex;
|
|
325516
|
+
bestIntersection = intersection;
|
|
325517
|
+
bestDistance = distance2;
|
|
325518
|
+
}
|
|
325519
|
+
});
|
|
325520
|
+
if (bestPageIndex != null)
|
|
325521
|
+
return bestPageIndex;
|
|
325522
|
+
}
|
|
325523
|
+
return [...groupedRects.keys()].sort((left$1, right$1) => left$1 - right$1)[0] ?? 0;
|
|
325922
325524
|
}
|
|
325923
325525
|
getLayoutSnapshot() {
|
|
325924
325526
|
return {
|
|
@@ -326675,6 +326277,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
326675
326277
|
this.#a11ySelectionAnnounceTimeout = null;
|
|
326676
326278
|
}
|
|
326677
326279
|
this.#teardownStorySessionEventBridge();
|
|
326280
|
+
this.#teardownActiveSurfaceUiEventBridge();
|
|
326678
326281
|
if (this.#registryKey) {
|
|
326679
326282
|
PresentationEditor2.#instances.delete(this.#registryKey);
|
|
326680
326283
|
this.#registryKey = null;
|
|
@@ -326925,6 +326528,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
326925
326528
|
event: "stylesDefaultsChanged",
|
|
326926
326529
|
handler: handleStylesDefaultsChanged
|
|
326927
326530
|
});
|
|
326531
|
+
this.#syncActiveSurfaceUiEventBridge(this.#editor);
|
|
326928
326532
|
const handleNotesPartChanged = () => {
|
|
326929
326533
|
this.#flowBlockCache.setHasExternalChanges(true);
|
|
326930
326534
|
this.#pendingDocChange = true;
|
|
@@ -327255,6 +326859,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
327255
326859
|
this.#scheduleSelectionUpdate({ immediate: true });
|
|
327256
326860
|
this.#scheduleA11ySelectionAnnouncement({ immediate: true });
|
|
327257
326861
|
}
|
|
326862
|
+
this.#syncActiveSurfaceUiEventBridge();
|
|
327258
326863
|
},
|
|
327259
326864
|
onEditBlocked: (reason) => {
|
|
327260
326865
|
this.emit("headerFooterEditBlocked", { reason });
|
|
@@ -327315,6 +326920,47 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
327315
326920
|
this.#storySessionSelectionHandler = null;
|
|
327316
326921
|
this.#storySessionTransactionHandler = null;
|
|
327317
326922
|
}
|
|
326923
|
+
#teardownActiveSurfaceUiEventBridge() {
|
|
326924
|
+
if (this.#activeSurfaceUiEventEditor) {
|
|
326925
|
+
if (this.#activeSurfaceUiUpdateHandler)
|
|
326926
|
+
this.#activeSurfaceUiEventEditor.off?.("update", this.#activeSurfaceUiUpdateHandler);
|
|
326927
|
+
if (this.#activeSurfaceUiContextMenuOpenHandler)
|
|
326928
|
+
this.#activeSurfaceUiEventEditor.off?.("contextMenu:open", this.#activeSurfaceUiContextMenuOpenHandler);
|
|
326929
|
+
if (this.#activeSurfaceUiContextMenuCloseHandler)
|
|
326930
|
+
this.#activeSurfaceUiEventEditor.off?.("contextMenu:close", this.#activeSurfaceUiContextMenuCloseHandler);
|
|
326931
|
+
}
|
|
326932
|
+
this.#activeSurfaceUiEventEditor = null;
|
|
326933
|
+
this.#activeSurfaceUiUpdateHandler = null;
|
|
326934
|
+
this.#activeSurfaceUiContextMenuOpenHandler = null;
|
|
326935
|
+
this.#activeSurfaceUiContextMenuCloseHandler = null;
|
|
326936
|
+
}
|
|
326937
|
+
#syncActiveSurfaceUiEventBridge(editor = this.getActiveEditor()) {
|
|
326938
|
+
const nextEditor = editor ?? null;
|
|
326939
|
+
if (nextEditor === this.#activeSurfaceUiEventEditor)
|
|
326940
|
+
return;
|
|
326941
|
+
this.#teardownActiveSurfaceUiEventBridge();
|
|
326942
|
+
if (!nextEditor)
|
|
326943
|
+
return;
|
|
326944
|
+
const updateHandler = (event) => {
|
|
326945
|
+
this.emit("update", {
|
|
326946
|
+
...event ?? {},
|
|
326947
|
+
editor: this
|
|
326948
|
+
});
|
|
326949
|
+
};
|
|
326950
|
+
const contextMenuOpenHandler = (event) => {
|
|
326951
|
+
this.emit("contextMenu:open", event ?? {});
|
|
326952
|
+
};
|
|
326953
|
+
const contextMenuCloseHandler = () => {
|
|
326954
|
+
this.emit("contextMenu:close");
|
|
326955
|
+
};
|
|
326956
|
+
nextEditor.on?.("update", updateHandler);
|
|
326957
|
+
nextEditor.on?.("contextMenu:open", contextMenuOpenHandler);
|
|
326958
|
+
nextEditor.on?.("contextMenu:close", contextMenuCloseHandler);
|
|
326959
|
+
this.#activeSurfaceUiEventEditor = nextEditor;
|
|
326960
|
+
this.#activeSurfaceUiUpdateHandler = updateHandler;
|
|
326961
|
+
this.#activeSurfaceUiContextMenuOpenHandler = contextMenuOpenHandler;
|
|
326962
|
+
this.#activeSurfaceUiContextMenuCloseHandler = contextMenuCloseHandler;
|
|
326963
|
+
}
|
|
327318
326964
|
#syncStorySessionEventBridge(session) {
|
|
327319
326965
|
this.#teardownStorySessionEventBridge();
|
|
327320
326966
|
if (!session) {
|
|
@@ -327330,7 +326976,6 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
327330
326976
|
return;
|
|
327331
326977
|
if (session.kind === "note") {
|
|
327332
326978
|
this.#invalidateTrackedChangesForStory(session.locator);
|
|
327333
|
-
this.#flowBlockCache.setHasExternalChanges(true);
|
|
327334
326979
|
this.#pendingDocChange = true;
|
|
327335
326980
|
this.#selectionSync.onLayoutStart();
|
|
327336
326981
|
this.#scheduleRerender();
|
|
@@ -327343,6 +326988,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
327343
326988
|
this.#storySessionTransactionHandler = transactionHandler;
|
|
327344
326989
|
this.#scheduleSelectionUpdate({ immediate: true });
|
|
327345
326990
|
this.#scheduleA11ySelectionAnnouncement({ immediate: true });
|
|
326991
|
+
this.#syncActiveSurfaceUiEventBridge();
|
|
327346
326992
|
}
|
|
327347
326993
|
#syncActiveStorySessionDocumentMode(session) {
|
|
327348
326994
|
if (!session || session.kind !== "note")
|
|
@@ -327393,6 +327039,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
327393
327039
|
this.#wrapOffscreenEditorFocus(activeSession.editor);
|
|
327394
327040
|
this.#syncActiveStorySessionDocumentMode(activeSession);
|
|
327395
327041
|
this.#syncStorySessionEventBridge(activeSession);
|
|
327042
|
+
this.#syncActiveSurfaceUiEventBridge();
|
|
327396
327043
|
this.#inputBridge?.notifyTargetChanged();
|
|
327397
327044
|
}
|
|
327398
327045
|
});
|
|
@@ -327623,9 +327270,11 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
327623
327270
|
this.#applyHtmlAnnotationMeasurements(blocks2);
|
|
327624
327271
|
const isSemanticFlow = this.#isSemanticFlowMode();
|
|
327625
327272
|
const baseLayoutOptions = this.#resolveLayoutOptions(blocks2, sectionMetadata);
|
|
327626
|
-
const
|
|
327273
|
+
const activeFootnoteOverride = this.#buildActiveNoteRenderOverride("footnote");
|
|
327274
|
+
const footnotesLayoutInput = buildFootnotesInput(this.#editor?.state, this.#editor?.converter, converterContext, this.#editor?.converter?.themeColors ?? undefined, activeFootnoteOverride);
|
|
327627
327275
|
const semanticFootnoteBlocks = isSemanticFlow ? buildSemanticFootnoteBlocks(footnotesLayoutInput, this.#layoutOptions.semanticOptions?.footnotesMode) : [];
|
|
327628
|
-
const
|
|
327276
|
+
const activeEndnoteOverride = this.#buildActiveNoteRenderOverride("endnote");
|
|
327277
|
+
const endnoteBlocks = buildEndnoteBlocks(this.#editor?.state, this.#editor?.converter, converterContext, this.#editor?.converter?.themeColors ?? undefined, activeEndnoteOverride);
|
|
327629
327278
|
const blocksForLayout = semanticFootnoteBlocks.length > 0 || endnoteBlocks.length > 0 ? [
|
|
327630
327279
|
...blocks2,
|
|
327631
327280
|
...semanticFootnoteBlocks,
|
|
@@ -327736,45 +327385,13 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
327736
327385
|
this.#ensurePainter();
|
|
327737
327386
|
if (!isSemanticFlow)
|
|
327738
327387
|
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
327388
|
this.#domIndexObserverManager?.pause();
|
|
327766
327389
|
const mapping = this.#pendingMapping;
|
|
327767
327390
|
this.#pendingMapping = null;
|
|
327768
327391
|
const painterPaintStart = perfNow();
|
|
327769
327392
|
const paintInput = {
|
|
327770
327393
|
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
|
|
327394
|
+
sourceLayout: layout
|
|
327778
327395
|
};
|
|
327779
327396
|
this.#painterAdapter.paint(paintInput, this.#painterHost, mapping ?? undefined);
|
|
327780
327397
|
perfLog(`[Perf] painter.paint: ${(perfNow() - painterPaintStart).toFixed(2)}ms`);
|
|
@@ -328720,7 +328337,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
328720
328337
|
storyType: target.storyType,
|
|
328721
328338
|
noteId: target.noteId
|
|
328722
328339
|
}, {
|
|
328723
|
-
commitPolicy: "
|
|
328340
|
+
commitPolicy: "onExit",
|
|
328724
328341
|
preferHiddenHost: true,
|
|
328725
328342
|
hostWidthPx: targetContext?.hostWidthPx ?? this.#visibleHost.clientWidth ?? 1,
|
|
328726
328343
|
editorContext: {
|
|
@@ -328964,7 +328581,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
328964
328581
|
if (target.entityType === "comment")
|
|
328965
328582
|
return await this.#navigateToComment(target.entityId);
|
|
328966
328583
|
if (target.entityType === "trackedChange")
|
|
328967
|
-
return await this.#navigateToTrackedChange(target.entityId, resolveStoryKeyFromAddress(target.story));
|
|
328584
|
+
return await this.#navigateToTrackedChange(target.entityId, resolveStoryKeyFromAddress(target.story), target.pageIndex);
|
|
328968
328585
|
}
|
|
328969
328586
|
return false;
|
|
328970
328587
|
} catch (error3) {
|
|
@@ -329038,18 +328655,18 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
329038
328655
|
});
|
|
329039
328656
|
return true;
|
|
329040
328657
|
}
|
|
329041
|
-
async#navigateToTrackedChange(entityId, storyKey) {
|
|
328658
|
+
async#navigateToTrackedChange(entityId, storyKey, preferredPageIndex) {
|
|
329042
328659
|
const editor = this.#editor;
|
|
329043
328660
|
if (!editor)
|
|
329044
328661
|
return false;
|
|
329045
328662
|
if (storyKey && storyKey !== "body") {
|
|
329046
328663
|
if (this.#navigateToActiveStoryTrackedChange(entityId, storyKey))
|
|
329047
328664
|
return true;
|
|
329048
|
-
if (await this.#activateTrackedChangeStorySurface(entityId, storyKey)) {
|
|
328665
|
+
if (await this.#activateTrackedChangeStorySurface(entityId, storyKey, preferredPageIndex)) {
|
|
329049
328666
|
if (this.#navigateToActiveStoryTrackedChange(entityId, storyKey))
|
|
329050
328667
|
return true;
|
|
329051
328668
|
}
|
|
329052
|
-
return this.#scrollToRenderedTrackedChange(entityId, storyKey);
|
|
328669
|
+
return this.#scrollToRenderedTrackedChange(entityId, storyKey, preferredPageIndex);
|
|
329053
328670
|
}
|
|
329054
328671
|
const setCursorById = editor.commands?.setCursorById;
|
|
329055
328672
|
if (typeof setCursorById === "function" && setCursorById(entityId, { preferredActiveThreadId: entityId })) {
|
|
@@ -329061,7 +328678,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
329061
328678
|
}
|
|
329062
328679
|
const resolved = resolveTrackedChange(editor, entityId);
|
|
329063
328680
|
if (!resolved)
|
|
329064
|
-
return this.#scrollToRenderedTrackedChange(entityId);
|
|
328681
|
+
return this.#scrollToRenderedTrackedChange(entityId, undefined, preferredPageIndex);
|
|
329065
328682
|
if (typeof setCursorById === "function" && resolved.rawId !== entityId) {
|
|
329066
328683
|
if (setCursorById(resolved.rawId, { preferredActiveThreadId: resolved.rawId })) {
|
|
329067
328684
|
await this.scrollToPositionAsync(editor.state.selection.from, {
|
|
@@ -329083,7 +328700,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
329083
328700
|
editor.view?.focus?.();
|
|
329084
328701
|
return true;
|
|
329085
328702
|
}
|
|
329086
|
-
async#activateTrackedChangeStorySurface(entityId, storyKey) {
|
|
328703
|
+
async#activateTrackedChangeStorySurface(entityId, storyKey, preferredPageIndex) {
|
|
329087
328704
|
let locator = null;
|
|
329088
328705
|
try {
|
|
329089
328706
|
locator = parseStoryKey(storyKey);
|
|
@@ -329092,7 +328709,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
329092
328709
|
}
|
|
329093
328710
|
if (!locator || locator.storyType === "body")
|
|
329094
328711
|
return false;
|
|
329095
|
-
const candidate = this.#
|
|
328712
|
+
const candidate = this.#findRenderedTrackedChangeElement(entityId, storyKey, preferredPageIndex);
|
|
329096
328713
|
if (!candidate)
|
|
329097
328714
|
return false;
|
|
329098
328715
|
const rect = candidate.getBoundingClientRect();
|
|
@@ -329170,12 +328787,20 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
329170
328787
|
this.#shouldScrollSelectionIntoView = true;
|
|
329171
328788
|
this.#scheduleSelectionUpdate({ immediate: true });
|
|
329172
328789
|
}
|
|
329173
|
-
|
|
328790
|
+
#findRenderedTrackedChangeElement(entityId, storyKey, preferredPageIndex) {
|
|
329174
328791
|
const candidates = this.#findRenderedTrackedChangeElements(entityId, storyKey);
|
|
329175
328792
|
if (!candidates.length)
|
|
328793
|
+
return null;
|
|
328794
|
+
if (!Number.isFinite(preferredPageIndex))
|
|
328795
|
+
return candidates[0] ?? null;
|
|
328796
|
+
return candidates.find((candidate) => this.#resolveRenderedPageIndexForElement(candidate) === preferredPageIndex) ?? candidates[0] ?? null;
|
|
328797
|
+
}
|
|
328798
|
+
async#scrollToRenderedTrackedChange(entityId, storyKey, preferredPageIndex) {
|
|
328799
|
+
const candidate = this.#findRenderedTrackedChangeElement(entityId, storyKey, preferredPageIndex);
|
|
328800
|
+
if (!candidate)
|
|
329176
328801
|
return false;
|
|
329177
328802
|
try {
|
|
329178
|
-
|
|
328803
|
+
candidate.scrollIntoView({
|
|
329179
328804
|
behavior: "auto",
|
|
329180
328805
|
block: "center",
|
|
329181
328806
|
inline: "nearest"
|
|
@@ -330033,11 +329658,11 @@ var init_zipper_DbkgrypV_es = __esm(() => {
|
|
|
330033
329658
|
|
|
330034
329659
|
// ../../packages/superdoc/dist/super-editor.es.js
|
|
330035
329660
|
var init_super_editor_es = __esm(() => {
|
|
330036
|
-
|
|
330037
|
-
|
|
329661
|
+
init_src_1sL7dd0v_es();
|
|
329662
|
+
init_SuperConverter_aq0iFjuQ_es();
|
|
330038
329663
|
init_jszip_C49i9kUs_es();
|
|
330039
329664
|
init_xml_js_CqGKpaft_es();
|
|
330040
|
-
|
|
329665
|
+
init_create_headless_toolbar_bhnvM7MP_es();
|
|
330041
329666
|
init_constants_CGhJRd87_es();
|
|
330042
329667
|
init_dist_B8HfvhaK_es();
|
|
330043
329668
|
init_unified_Dsuw2be5_es();
|