@harbour-enterprises/superdoc 1.0.0-beta.3 → 1.0.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{PdfViewer-CKzs9Ct5.es.js → PdfViewer-DUns3s8O.es.js} +1 -1
- package/dist/chunks/{PdfViewer-CxHbcDGx.cjs → PdfViewer-ZtwLhE_8.cjs} +1 -1
- package/dist/chunks/{index-CJUy3fVi-D8zt9F3Z.es.js → index-BNGaD3Up-CQuoo1EF.es.js} +1 -1
- package/dist/chunks/{index-CJUy3fVi-BGLfCP5B.cjs → index-BNGaD3Up-D2cRHMMk.cjs} +1 -1
- package/dist/chunks/{index-Dp3rVMnX.cjs → index-BW38mdZF.cjs} +3 -3
- package/dist/chunks/{index-DukSDI8_.es.js → index-DIccWgYh.es.js} +3 -3
- package/dist/chunks/{super-editor.es-CDiTp9Fe.cjs → super-editor.es-C06-V-Iy.cjs} +155 -27
- package/dist/chunks/{super-editor.es-BRKZG90h.es.js → super-editor.es-CtCHBIPE.es.js} +155 -27
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-B9YfBdcc.js → converter-ZJiSHoiq.js} +1 -1
- package/dist/super-editor/chunks/{docx-zipper-V16OzZ7a.js → docx-zipper-B7FStorN.js} +1 -1
- package/dist/super-editor/chunks/{editor-DlvlVSbc.js → editor-DvepAjbe.js} +156 -28
- package/dist/super-editor/chunks/{index-CJUy3fVi.js → index-BNGaD3Up.js} +1 -1
- package/dist/super-editor/chunks/{toolbar-cNDvtryE.js → toolbar-CKXXbIQO.js} +2 -2
- package/dist/super-editor/converter.es.js +1 -1
- package/dist/super-editor/docx-zipper.es.js +2 -2
- package/dist/super-editor/editor.es.js +3 -3
- package/dist/super-editor/file-zipper.es.js +1 -1
- package/dist/super-editor/super-editor.es.js +6 -6
- package/dist/super-editor/toolbar.es.js +2 -2
- package/dist/super-editor.cjs +1 -1
- package/dist/super-editor.es.js +1 -1
- package/dist/superdoc.cjs +2 -2
- package/dist/superdoc.es.js +2 -2
- package/dist/superdoc.umd.js +157 -29
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/superdoc.umd.js
CHANGED
|
@@ -35581,7 +35581,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
35581
35581
|
static getStoredSuperdocVersion(docx) {
|
|
35582
35582
|
return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
|
|
35583
35583
|
}
|
|
35584
|
-
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.
|
|
35584
|
+
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.4") {
|
|
35585
35585
|
return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
|
|
35586
35586
|
}
|
|
35587
35587
|
/**
|
|
@@ -60069,7 +60069,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
60069
60069
|
const shouldSkipNodeView = (editor) => {
|
|
60070
60070
|
return isHeadless(editor);
|
|
60071
60071
|
};
|
|
60072
|
-
const summaryVersion = "1.0.0-beta.
|
|
60072
|
+
const summaryVersion = "1.0.0-beta.4";
|
|
60073
60073
|
const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
|
|
60074
60074
|
const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
|
|
60075
60075
|
function mapAttributes(attrs) {
|
|
@@ -60848,7 +60848,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
60848
60848
|
{ default: remarkStringify2 },
|
|
60849
60849
|
{ default: remarkGfm2 }
|
|
60850
60850
|
] = await Promise.all([
|
|
60851
|
-
Promise.resolve().then(() =>
|
|
60851
|
+
Promise.resolve().then(() => indexBNGaD3Up),
|
|
60852
60852
|
Promise.resolve().then(() => indexDRCvimau),
|
|
60853
60853
|
Promise.resolve().then(() => indexC_x_N6Uh),
|
|
60854
60854
|
Promise.resolve().then(() => indexD_sWOSiG),
|
|
@@ -61053,7 +61053,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
61053
61053
|
* Process collaboration migrations
|
|
61054
61054
|
*/
|
|
61055
61055
|
processCollaborationMigrations() {
|
|
61056
|
-
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.
|
|
61056
|
+
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.4");
|
|
61057
61057
|
if (!this.options.ydoc) return;
|
|
61058
61058
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
61059
61059
|
let docVersion = metaMap.get("version");
|
|
@@ -62884,6 +62884,19 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
62884
62884
|
}
|
|
62885
62885
|
return sanitized;
|
|
62886
62886
|
};
|
|
62887
|
+
const normalizeFontSizePx = (value) => {
|
|
62888
|
+
if (isFiniteNumber(value)) return value;
|
|
62889
|
+
if (typeof value !== "string") return void 0;
|
|
62890
|
+
const trimmed = value.trim();
|
|
62891
|
+
if (!trimmed) return void 0;
|
|
62892
|
+
const numeric = Number.parseFloat(trimmed);
|
|
62893
|
+
if (!Number.isFinite(numeric)) return void 0;
|
|
62894
|
+
const unit = trimmed.match(/[a-zA-Z%]+$/)?.[0]?.toLowerCase();
|
|
62895
|
+
if (unit === "pt") {
|
|
62896
|
+
return ptToPx(numeric);
|
|
62897
|
+
}
|
|
62898
|
+
return numeric;
|
|
62899
|
+
};
|
|
62887
62900
|
const applyTextStyleMark = (run2, attrs, themeColors) => {
|
|
62888
62901
|
const resolvedColor = resolveColorFromAttributes(attrs, themeColors);
|
|
62889
62902
|
if (resolvedColor) {
|
|
@@ -62895,9 +62908,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
62895
62908
|
run2.fontFamily = sanitized;
|
|
62896
62909
|
}
|
|
62897
62910
|
}
|
|
62898
|
-
const
|
|
62899
|
-
if (
|
|
62900
|
-
run2.fontSize =
|
|
62911
|
+
const fontSizePx = normalizeFontSizePx(attrs.fontSize);
|
|
62912
|
+
if (fontSizePx !== void 0 && fontSizePx >= 1 && fontSizePx <= 1e3) {
|
|
62913
|
+
run2.fontSize = fontSizePx;
|
|
62901
62914
|
}
|
|
62902
62915
|
if (isFiniteNumber(attrs.letterSpacing)) {
|
|
62903
62916
|
const spacing = Number(attrs.letterSpacing);
|
|
@@ -73157,8 +73170,59 @@ ${l}
|
|
|
73157
73170
|
this.headerProvider = header;
|
|
73158
73171
|
this.footerProvider = footer;
|
|
73159
73172
|
}
|
|
73160
|
-
|
|
73173
|
+
/**
|
|
73174
|
+
* Updates the painter's block and measure data.
|
|
73175
|
+
*
|
|
73176
|
+
* @param blocks - Main document blocks
|
|
73177
|
+
* @param measures - Measures corresponding to main document blocks
|
|
73178
|
+
* @param headerBlocks - Optional header blocks from header/footer layout results
|
|
73179
|
+
* @param headerMeasures - Optional measures corresponding to header blocks
|
|
73180
|
+
* @param footerBlocks - Optional footer blocks from header/footer layout results
|
|
73181
|
+
* @param footerMeasures - Optional measures corresponding to footer blocks
|
|
73182
|
+
*/
|
|
73183
|
+
setData(blocks2, measures, headerBlocks, headerMeasures, footerBlocks, footerMeasures) {
|
|
73184
|
+
if (blocks2.length !== measures.length) {
|
|
73185
|
+
throw new Error(
|
|
73186
|
+
`setData: blocks and measures arrays must have the same length. Got blocks.length=${blocks2.length}, measures.length=${measures.length}`
|
|
73187
|
+
);
|
|
73188
|
+
}
|
|
73189
|
+
const hasHeaderBlocks = headerBlocks !== void 0;
|
|
73190
|
+
const hasHeaderMeasures = headerMeasures !== void 0;
|
|
73191
|
+
if (hasHeaderBlocks !== hasHeaderMeasures) {
|
|
73192
|
+
throw new Error(
|
|
73193
|
+
`setData: headerBlocks and headerMeasures must both be provided or both be omitted. Got headerBlocks=${hasHeaderBlocks ? "provided" : "omitted"}, headerMeasures=${hasHeaderMeasures ? "provided" : "omitted"}`
|
|
73194
|
+
);
|
|
73195
|
+
}
|
|
73196
|
+
if (hasHeaderBlocks && hasHeaderMeasures && headerBlocks.length !== headerMeasures.length) {
|
|
73197
|
+
throw new Error(
|
|
73198
|
+
`setData: headerBlocks and headerMeasures arrays must have the same length. Got headerBlocks.length=${headerBlocks.length}, headerMeasures.length=${headerMeasures.length}`
|
|
73199
|
+
);
|
|
73200
|
+
}
|
|
73201
|
+
const hasFooterBlocks = footerBlocks !== void 0;
|
|
73202
|
+
const hasFooterMeasures = footerMeasures !== void 0;
|
|
73203
|
+
if (hasFooterBlocks !== hasFooterMeasures) {
|
|
73204
|
+
throw new Error(
|
|
73205
|
+
`setData: footerBlocks and footerMeasures must both be provided or both be omitted. Got footerBlocks=${hasFooterBlocks ? "provided" : "omitted"}, footerMeasures=${hasFooterMeasures ? "provided" : "omitted"}`
|
|
73206
|
+
);
|
|
73207
|
+
}
|
|
73208
|
+
if (hasFooterBlocks && hasFooterMeasures && footerBlocks.length !== footerMeasures.length) {
|
|
73209
|
+
throw new Error(
|
|
73210
|
+
`setData: footerBlocks and footerMeasures arrays must have the same length. Got footerBlocks.length=${footerBlocks.length}, footerMeasures.length=${footerMeasures.length}`
|
|
73211
|
+
);
|
|
73212
|
+
}
|
|
73161
73213
|
const nextLookup = this.buildBlockLookup(blocks2, measures);
|
|
73214
|
+
if (headerBlocks && headerMeasures) {
|
|
73215
|
+
const headerLookup = this.buildBlockLookup(headerBlocks, headerMeasures);
|
|
73216
|
+
headerLookup.forEach((entry, id) => {
|
|
73217
|
+
nextLookup.set(id, entry);
|
|
73218
|
+
});
|
|
73219
|
+
}
|
|
73220
|
+
if (footerBlocks && footerMeasures) {
|
|
73221
|
+
const footerLookup = this.buildBlockLookup(footerBlocks, footerMeasures);
|
|
73222
|
+
footerLookup.forEach((entry, id) => {
|
|
73223
|
+
nextLookup.set(id, entry);
|
|
73224
|
+
});
|
|
73225
|
+
}
|
|
73162
73226
|
const changed = /* @__PURE__ */ new Set();
|
|
73163
73227
|
nextLookup.forEach((entry, id) => {
|
|
73164
73228
|
const previous2 = this.blockLookup.get(id);
|
|
@@ -73481,6 +73545,14 @@ ${l}
|
|
|
73481
73545
|
container.style.height = `${data.height}px`;
|
|
73482
73546
|
container.style.top = `${Math.max(0, offset2)}px`;
|
|
73483
73547
|
container.style.zIndex = "1";
|
|
73548
|
+
let footerYOffset = 0;
|
|
73549
|
+
if (kind === "footer" && data.fragments.length > 0) {
|
|
73550
|
+
const contentHeight = typeof data.contentHeight === "number" ? data.contentHeight : data.fragments.reduce((max2, f2) => {
|
|
73551
|
+
const fragHeight = "height" in f2 && typeof f2.height === "number" ? f2.height : this.estimateFragmentHeight(f2);
|
|
73552
|
+
return Math.max(max2, f2.y + Math.max(0, fragHeight));
|
|
73553
|
+
}, 0);
|
|
73554
|
+
footerYOffset = Math.max(0, data.height - contentHeight);
|
|
73555
|
+
}
|
|
73484
73556
|
const context = {
|
|
73485
73557
|
pageNumber: page.number,
|
|
73486
73558
|
totalPages: this.totalPages,
|
|
@@ -73489,6 +73561,10 @@ ${l}
|
|
|
73489
73561
|
};
|
|
73490
73562
|
data.fragments.forEach((fragment) => {
|
|
73491
73563
|
const fragEl = this.renderFragment(fragment, context);
|
|
73564
|
+
if (footerYOffset > 0) {
|
|
73565
|
+
const currentTop = parseFloat(fragEl.style.top) || fragment.y;
|
|
73566
|
+
fragEl.style.top = `${currentTop + footerYOffset}px`;
|
|
73567
|
+
}
|
|
73492
73568
|
container.appendChild(fragEl);
|
|
73493
73569
|
});
|
|
73494
73570
|
if (!existing) {
|
|
@@ -73800,13 +73876,13 @@ ${l}
|
|
|
73800
73876
|
const markerEl = this.doc.createElement("span");
|
|
73801
73877
|
markerEl.classList.add("superdoc-list-marker");
|
|
73802
73878
|
const wordLayout = item.paragraph.attrs?.wordLayout;
|
|
73803
|
-
|
|
73804
|
-
|
|
73805
|
-
markerEl.textContent = marker.markerText;
|
|
73879
|
+
const marker = wordLayout?.marker;
|
|
73880
|
+
if (marker) {
|
|
73881
|
+
markerEl.textContent = marker.markerText ?? null;
|
|
73806
73882
|
markerEl.style.display = "inline-block";
|
|
73807
73883
|
markerEl.style.width = `${Math.max(0, fragment.markerWidth - LIST_MARKER_GAP$1)}px`;
|
|
73808
73884
|
markerEl.style.paddingRight = `${LIST_MARKER_GAP$1}px`;
|
|
73809
|
-
markerEl.style.textAlign = marker.justification;
|
|
73885
|
+
markerEl.style.textAlign = marker.justification ?? "";
|
|
73810
73886
|
markerEl.style.fontFamily = marker.run.fontFamily;
|
|
73811
73887
|
markerEl.style.fontSize = `${marker.run.fontSize}px`;
|
|
73812
73888
|
if (marker.run.bold) markerEl.style.fontWeight = "bold";
|
|
@@ -74555,6 +74631,33 @@ ${l}
|
|
|
74555
74631
|
}
|
|
74556
74632
|
}
|
|
74557
74633
|
}
|
|
74634
|
+
/**
|
|
74635
|
+
* Estimates the height of a fragment when explicit height is not available.
|
|
74636
|
+
*
|
|
74637
|
+
* This method provides fallback height calculations for footer bottom-alignment
|
|
74638
|
+
* by consulting measure data for paragraphs and list items, or using the
|
|
74639
|
+
* fragment's height property for tables, images, and drawings.
|
|
74640
|
+
*
|
|
74641
|
+
* @param fragment - The fragment to estimate height for
|
|
74642
|
+
* @returns Estimated height in pixels, or 0 if height cannot be determined
|
|
74643
|
+
*/
|
|
74644
|
+
estimateFragmentHeight(fragment) {
|
|
74645
|
+
const lookup2 = this.blockLookup.get(fragment.blockId);
|
|
74646
|
+
const measure = lookup2?.measure;
|
|
74647
|
+
if (fragment.kind === "para" && measure?.kind === "paragraph") {
|
|
74648
|
+
return measure.totalHeight;
|
|
74649
|
+
}
|
|
74650
|
+
if (fragment.kind === "list-item" && measure?.kind === "list") {
|
|
74651
|
+
return measure.totalHeight;
|
|
74652
|
+
}
|
|
74653
|
+
if (fragment.kind === "table") {
|
|
74654
|
+
return fragment.height;
|
|
74655
|
+
}
|
|
74656
|
+
if (fragment.kind === "image" || fragment.kind === "drawing") {
|
|
74657
|
+
return fragment.height;
|
|
74658
|
+
}
|
|
74659
|
+
return 0;
|
|
74660
|
+
}
|
|
74558
74661
|
buildBlockLookup(blocks2, measures) {
|
|
74559
74662
|
if (blocks2.length !== measures.length) {
|
|
74560
74663
|
throw new Error("DomPainter requires the same number of blocks and measures");
|
|
@@ -75023,8 +75126,8 @@ ${l}
|
|
|
75023
75126
|
paint(layout, mount2) {
|
|
75024
75127
|
painter.paint(layout, mount2);
|
|
75025
75128
|
},
|
|
75026
|
-
setData(blocks2, measures) {
|
|
75027
|
-
painter.setData(blocks2, measures);
|
|
75129
|
+
setData(blocks2, measures, headerBlocks, headerMeasures, footerBlocks, footerMeasures) {
|
|
75130
|
+
painter.setData(blocks2, measures, headerBlocks, headerMeasures, footerBlocks, footerMeasures);
|
|
75028
75131
|
},
|
|
75029
75132
|
// Non-standard extension for demo app to avoid re-instantiating on provider changes
|
|
75030
75133
|
setProviders(header, footer) {
|
|
@@ -78413,7 +78516,30 @@ ${l}
|
|
|
78413
78516
|
if (typeof painter.setProviders === "function") {
|
|
78414
78517
|
painter.setProviders(__privateGet$1(this, _headerDecorationProvider), __privateGet$1(this, _footerDecorationProvider));
|
|
78415
78518
|
}
|
|
78416
|
-
|
|
78519
|
+
const headerBlocks = [];
|
|
78520
|
+
const headerMeasures = [];
|
|
78521
|
+
if (headerLayouts) {
|
|
78522
|
+
for (const headerResult of headerLayouts) {
|
|
78523
|
+
headerBlocks.push(...headerResult.blocks);
|
|
78524
|
+
headerMeasures.push(...headerResult.measures);
|
|
78525
|
+
}
|
|
78526
|
+
}
|
|
78527
|
+
const footerBlocks = [];
|
|
78528
|
+
const footerMeasures = [];
|
|
78529
|
+
if (footerLayouts) {
|
|
78530
|
+
for (const footerResult of footerLayouts) {
|
|
78531
|
+
footerBlocks.push(...footerResult.blocks);
|
|
78532
|
+
footerMeasures.push(...footerResult.measures);
|
|
78533
|
+
}
|
|
78534
|
+
}
|
|
78535
|
+
painter.setData?.(
|
|
78536
|
+
blocks2,
|
|
78537
|
+
measures,
|
|
78538
|
+
headerBlocks.length > 0 ? headerBlocks : void 0,
|
|
78539
|
+
headerMeasures.length > 0 ? headerMeasures : void 0,
|
|
78540
|
+
footerBlocks.length > 0 ? footerBlocks : void 0,
|
|
78541
|
+
footerMeasures.length > 0 ? footerMeasures : void 0
|
|
78542
|
+
);
|
|
78417
78543
|
painter.paint(layout, __privateGet$1(this, _painterHost));
|
|
78418
78544
|
__privateSet(this, _layoutError, null);
|
|
78419
78545
|
__privateSet(this, _layoutErrorState, "healthy");
|
|
@@ -78583,7 +78709,8 @@ ${l}
|
|
|
78583
78709
|
const finalHeaderId = headerId ?? fallbackId ?? void 0;
|
|
78584
78710
|
return {
|
|
78585
78711
|
fragments: slotPage.fragments,
|
|
78586
|
-
height:
|
|
78712
|
+
height: box.height,
|
|
78713
|
+
contentHeight: variant.layout.height ?? box.height,
|
|
78587
78714
|
offset: box.offset,
|
|
78588
78715
|
marginLeft: box.x,
|
|
78589
78716
|
contentWidth: box.width,
|
|
@@ -78610,18 +78737,19 @@ ${l}
|
|
|
78610
78737
|
const left2 = margins.left ?? DEFAULT_MARGINS.left;
|
|
78611
78738
|
const right2 = margins.right ?? DEFAULT_MARGINS.right;
|
|
78612
78739
|
const width = Math.max(pageSize.w - (left2 + right2), 1);
|
|
78613
|
-
const defaultHeight = kind === "header" ? margins.top ?? DEFAULT_MARGINS.top : margins.bottom ?? DEFAULT_MARGINS.bottom;
|
|
78614
|
-
const { headerSpace, footerSpace } = extractHeaderFooterSpace(margins);
|
|
78615
|
-
const target = kind === "header" ? headerSpace : footerSpace;
|
|
78616
|
-
const height = Math.max(target || defaultHeight || 1, 1);
|
|
78617
78740
|
const totalHeight = pageHeight ?? pageSize.h;
|
|
78618
|
-
|
|
78619
|
-
|
|
78620
|
-
|
|
78621
|
-
|
|
78622
|
-
height,
|
|
78623
|
-
|
|
78624
|
-
|
|
78741
|
+
if (kind === "header") {
|
|
78742
|
+
const headerMargin = margins.header ?? 0;
|
|
78743
|
+
const topMargin = margins.top ?? DEFAULT_MARGINS.top ?? 0;
|
|
78744
|
+
const height = Math.max(topMargin - headerMargin, 1);
|
|
78745
|
+
return { x: left2, width, height, offset: headerMargin };
|
|
78746
|
+
} else {
|
|
78747
|
+
const footerMargin = margins.footer ?? 0;
|
|
78748
|
+
const bottomMargin = margins.bottom ?? DEFAULT_MARGINS.bottom ?? 0;
|
|
78749
|
+
const height = Math.max(bottomMargin - footerMargin, 1);
|
|
78750
|
+
const offset2 = Math.max(0, totalHeight - footerMargin - height);
|
|
78751
|
+
return { x: left2, width, height, offset: offset2 };
|
|
78752
|
+
}
|
|
78625
78753
|
};
|
|
78626
78754
|
rebuildHeaderFooterRegions_fn = function(layout) {
|
|
78627
78755
|
__privateGet$1(this, _headerRegions).clear();
|
|
@@ -131046,7 +131174,7 @@ ${style2}
|
|
|
131046
131174
|
this.config.colors = shuffleArray(this.config.colors);
|
|
131047
131175
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
131048
131176
|
this.colorIndex = 0;
|
|
131049
|
-
this.version = "1.0.0-beta.
|
|
131177
|
+
this.version = "1.0.0-beta.4";
|
|
131050
131178
|
this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
|
|
131051
131179
|
this.superdocId = config2.superdocId || v4();
|
|
131052
131180
|
this.colors = this.config.colors;
|
|
@@ -133489,7 +133617,7 @@ ${style2}
|
|
|
133489
133617
|
value && typeof value === "object" && "byteLength" in value && "byteOffset" in value
|
|
133490
133618
|
);
|
|
133491
133619
|
}
|
|
133492
|
-
const
|
|
133620
|
+
const indexBNGaD3Up = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
133493
133621
|
__proto__: null,
|
|
133494
133622
|
unified
|
|
133495
133623
|
}, Symbol.toStringTag, { value: "Module" }));
|