@harbour-enterprises/superdoc 1.2.0-next.6 → 1.2.2-next.1
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-BP3SAptw.cjs → PdfViewer-Cq1mqKR1.cjs} +2 -2
- package/dist/chunks/{PdfViewer-Cfz5f-Nx.es.js → PdfViewer-fdEUMidQ.es.js} +2 -2
- package/dist/chunks/{SuperConverter-BigfCP5Z.es.js → SuperConverter-C4sb9GH7.es.js} +35 -9
- package/dist/chunks/{SuperConverter-C5soSddX.cjs → SuperConverter-C_fR_pax.cjs} +35 -9
- package/dist/chunks/{index-Dxieqftp.cjs → index-B2xKsF_F.cjs} +252 -30
- package/dist/chunks/{index-DPtR8yGc.cjs → index-BS-AafWf.cjs} +4 -4
- package/dist/chunks/{index-C18YjNKj.es.js → index-CcYK8nzG.es.js} +252 -30
- package/dist/chunks/{index-D-gl9GKa.es.js → index-Di1Kp3nz.es.js} +4 -4
- package/dist/super-editor/converter.cjs +1 -1
- package/dist/super-editor/converter.es.js +1 -1
- package/dist/super-editor.cjs +2 -2
- package/dist/super-editor.es.js +3 -3
- package/dist/superdoc.cjs +3 -3
- package/dist/superdoc.es.js +3 -3
- package/dist/superdoc.umd.js +288 -40
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const vue = require("./vue-De9wkgLl.cjs");
|
|
4
|
-
const superdoc = require("./index-
|
|
5
|
-
const index = require("./index-
|
|
4
|
+
const superdoc = require("./index-BS-AafWf.cjs");
|
|
5
|
+
const index = require("./index-B2xKsF_F.cjs");
|
|
6
6
|
function self(vars) {
|
|
7
7
|
const {
|
|
8
8
|
opacityDisabled,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { d as defineComponent, h, T as Transition, p as process$1, w as watchEffect, c as computed, r as ref, f as onMounted, X as onUnmounted, E as createElementBlock, G as openBlock, K as createBaseVNode, M as createCommentVNode, I as createVNode, v as unref } from "./vue-BnBKJwCW.es.js";
|
|
2
|
-
import { N as NBaseLoading, u as useSuperdocStore, s as storeToRefs, a as useSelection } from "./index-
|
|
3
|
-
import { C as derived, r as c, q as cB, aF as fadeInTransition, y as cM, I as warnOnce, J as useConfig, N as useTheme, aG as pxfy, P as createKey, Q as useThemeClass, aH as useCompitable, ai as _export_sfc } from "./index-
|
|
2
|
+
import { N as NBaseLoading, u as useSuperdocStore, s as storeToRefs, a as useSelection } from "./index-Di1Kp3nz.es.js";
|
|
3
|
+
import { C as derived, r as c, q as cB, aF as fadeInTransition, y as cM, I as warnOnce, J as useConfig, N as useTheme, aG as pxfy, P as createKey, Q as useThemeClass, aH as useCompitable, ai as _export_sfc } from "./index-CcYK8nzG.es.js";
|
|
4
4
|
function self(vars) {
|
|
5
5
|
const {
|
|
6
6
|
opacityDisabled,
|
|
@@ -9053,6 +9053,17 @@ const attrConfig$f = Object.freeze({
|
|
|
9053
9053
|
const validXmlAttributes$b = [attrConfig$h, attrConfig$g, attrConfig$f];
|
|
9054
9054
|
const XML_NODE_NAME$k = "w:r";
|
|
9055
9055
|
const SD_KEY_NAME = "run";
|
|
9056
|
+
const createRunNodeWithContent = (content, encodedAttrs, runLevelMarks, runProperties) => {
|
|
9057
|
+
const node = {
|
|
9058
|
+
type: SD_KEY_NAME,
|
|
9059
|
+
content,
|
|
9060
|
+
attrs: { ...encodedAttrs, runProperties }
|
|
9061
|
+
};
|
|
9062
|
+
if (runLevelMarks.length) {
|
|
9063
|
+
node.marks = runLevelMarks.map((mark) => cloneMark$1(mark));
|
|
9064
|
+
}
|
|
9065
|
+
return node;
|
|
9066
|
+
};
|
|
9056
9067
|
const encode$x = (params, encodedAttrs = {}) => {
|
|
9057
9068
|
const { nodes = [], nodeListHandler } = params || {};
|
|
9058
9069
|
const runNode = nodes[0];
|
|
@@ -9097,15 +9108,30 @@ const encode$x = (params, encodedAttrs = {}) => {
|
|
|
9097
9108
|
return { ...child, marks: childMarks };
|
|
9098
9109
|
});
|
|
9099
9110
|
const filtered = contentWithRunMarks.filter(Boolean);
|
|
9100
|
-
const
|
|
9101
|
-
|
|
9102
|
-
|
|
9103
|
-
|
|
9111
|
+
const containsBreakNodes = filtered.some((child) => child?.type === "lineBreak");
|
|
9112
|
+
if (!containsBreakNodes) {
|
|
9113
|
+
const defaultNode = createRunNodeWithContent(filtered, encodedAttrs, runLevelMarks, runProperties);
|
|
9114
|
+
return defaultNode;
|
|
9115
|
+
}
|
|
9116
|
+
const splitRuns = [];
|
|
9117
|
+
let currentChunk = [];
|
|
9118
|
+
const finalizeTextChunk = () => {
|
|
9119
|
+
if (!currentChunk.length) return;
|
|
9120
|
+
const chunkNode = createRunNodeWithContent(currentChunk, encodedAttrs, runLevelMarks, runProperties);
|
|
9121
|
+
if (chunkNode) splitRuns.push(chunkNode);
|
|
9122
|
+
currentChunk = [];
|
|
9104
9123
|
};
|
|
9105
|
-
|
|
9106
|
-
|
|
9107
|
-
|
|
9108
|
-
|
|
9124
|
+
filtered.forEach((child) => {
|
|
9125
|
+
if (child?.type === "lineBreak") {
|
|
9126
|
+
finalizeTextChunk();
|
|
9127
|
+
const breakNode = createRunNodeWithContent([child], encodedAttrs, runLevelMarks, runProperties);
|
|
9128
|
+
if (breakNode) splitRuns.push(breakNode);
|
|
9129
|
+
} else {
|
|
9130
|
+
currentChunk.push(child);
|
|
9131
|
+
}
|
|
9132
|
+
});
|
|
9133
|
+
finalizeTextChunk();
|
|
9134
|
+
return splitRuns;
|
|
9109
9135
|
};
|
|
9110
9136
|
const decode$z = (params, decodedAttrs = {}) => {
|
|
9111
9137
|
const { node } = params || {};
|
|
@@ -30737,7 +30763,7 @@ class SuperConverter {
|
|
|
30737
30763
|
static getStoredSuperdocVersion(docx) {
|
|
30738
30764
|
return SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
|
|
30739
30765
|
}
|
|
30740
|
-
static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.2.
|
|
30766
|
+
static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.2.2-next.1") {
|
|
30741
30767
|
return SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version, false);
|
|
30742
30768
|
}
|
|
30743
30769
|
/**
|
|
@@ -9054,6 +9054,17 @@ const attrConfig$f = Object.freeze({
|
|
|
9054
9054
|
const validXmlAttributes$b = [attrConfig$h, attrConfig$g, attrConfig$f];
|
|
9055
9055
|
const XML_NODE_NAME$k = "w:r";
|
|
9056
9056
|
const SD_KEY_NAME = "run";
|
|
9057
|
+
const createRunNodeWithContent = (content, encodedAttrs, runLevelMarks, runProperties) => {
|
|
9058
|
+
const node = {
|
|
9059
|
+
type: SD_KEY_NAME,
|
|
9060
|
+
content,
|
|
9061
|
+
attrs: { ...encodedAttrs, runProperties }
|
|
9062
|
+
};
|
|
9063
|
+
if (runLevelMarks.length) {
|
|
9064
|
+
node.marks = runLevelMarks.map((mark) => cloneMark$1(mark));
|
|
9065
|
+
}
|
|
9066
|
+
return node;
|
|
9067
|
+
};
|
|
9057
9068
|
const encode$x = (params, encodedAttrs = {}) => {
|
|
9058
9069
|
const { nodes = [], nodeListHandler } = params || {};
|
|
9059
9070
|
const runNode = nodes[0];
|
|
@@ -9098,15 +9109,30 @@ const encode$x = (params, encodedAttrs = {}) => {
|
|
|
9098
9109
|
return { ...child, marks: childMarks };
|
|
9099
9110
|
});
|
|
9100
9111
|
const filtered = contentWithRunMarks.filter(Boolean);
|
|
9101
|
-
const
|
|
9102
|
-
|
|
9103
|
-
|
|
9104
|
-
|
|
9112
|
+
const containsBreakNodes = filtered.some((child) => child?.type === "lineBreak");
|
|
9113
|
+
if (!containsBreakNodes) {
|
|
9114
|
+
const defaultNode = createRunNodeWithContent(filtered, encodedAttrs, runLevelMarks, runProperties);
|
|
9115
|
+
return defaultNode;
|
|
9116
|
+
}
|
|
9117
|
+
const splitRuns = [];
|
|
9118
|
+
let currentChunk = [];
|
|
9119
|
+
const finalizeTextChunk = () => {
|
|
9120
|
+
if (!currentChunk.length) return;
|
|
9121
|
+
const chunkNode = createRunNodeWithContent(currentChunk, encodedAttrs, runLevelMarks, runProperties);
|
|
9122
|
+
if (chunkNode) splitRuns.push(chunkNode);
|
|
9123
|
+
currentChunk = [];
|
|
9105
9124
|
};
|
|
9106
|
-
|
|
9107
|
-
|
|
9108
|
-
|
|
9109
|
-
|
|
9125
|
+
filtered.forEach((child) => {
|
|
9126
|
+
if (child?.type === "lineBreak") {
|
|
9127
|
+
finalizeTextChunk();
|
|
9128
|
+
const breakNode = createRunNodeWithContent([child], encodedAttrs, runLevelMarks, runProperties);
|
|
9129
|
+
if (breakNode) splitRuns.push(breakNode);
|
|
9130
|
+
} else {
|
|
9131
|
+
currentChunk.push(child);
|
|
9132
|
+
}
|
|
9133
|
+
});
|
|
9134
|
+
finalizeTextChunk();
|
|
9135
|
+
return splitRuns;
|
|
9110
9136
|
};
|
|
9111
9137
|
const decode$z = (params, decodedAttrs = {}) => {
|
|
9112
9138
|
const { node } = params || {};
|
|
@@ -30738,7 +30764,7 @@ class SuperConverter {
|
|
|
30738
30764
|
static getStoredSuperdocVersion(docx) {
|
|
30739
30765
|
return SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
|
|
30740
30766
|
}
|
|
30741
|
-
static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.2.
|
|
30767
|
+
static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.2.2-next.1") {
|
|
30742
30768
|
return SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version, false);
|
|
30743
30769
|
}
|
|
30744
30770
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const jszip = require("./jszip-C8_CqJxM.cjs");
|
|
3
3
|
const helpers$1 = require("./helpers-nOdwpmwb.cjs");
|
|
4
|
-
const superEditor_converter = require("./SuperConverter-
|
|
4
|
+
const superEditor_converter = require("./SuperConverter-C_fR_pax.cjs");
|
|
5
5
|
const vue = require("./vue-De9wkgLl.cjs");
|
|
6
6
|
require("./jszip.min-BPh2MMAa.cjs");
|
|
7
7
|
const eventemitter3 = require("./eventemitter3-BQuRcMPI.cjs");
|
|
@@ -14915,7 +14915,7 @@ const canUseDOM = () => {
|
|
|
14915
14915
|
return false;
|
|
14916
14916
|
}
|
|
14917
14917
|
};
|
|
14918
|
-
const summaryVersion = "1.2.
|
|
14918
|
+
const summaryVersion = "1.2.2-next.1";
|
|
14919
14919
|
const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
|
|
14920
14920
|
const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
|
|
14921
14921
|
function mapAttributes(attrs) {
|
|
@@ -17548,7 +17548,7 @@ class Editor extends EventEmitter {
|
|
|
17548
17548
|
* Process collaboration migrations
|
|
17549
17549
|
*/
|
|
17550
17550
|
processCollaborationMigrations() {
|
|
17551
|
-
console.debug("[checkVersionMigrations] Current editor version", "1.2.
|
|
17551
|
+
console.debug("[checkVersionMigrations] Current editor version", "1.2.2-next.1");
|
|
17552
17552
|
if (!this.options.ydoc) return;
|
|
17553
17553
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
17554
17554
|
let docVersion = metaMap.get("version");
|
|
@@ -19807,6 +19807,15 @@ function calculateTabWidth(params2) {
|
|
|
19807
19807
|
tabStopPosUsed: nextStop.pos
|
|
19808
19808
|
};
|
|
19809
19809
|
}
|
|
19810
|
+
const OOXML_PCT_DIVISOR = 5e3;
|
|
19811
|
+
function resolveColumnWidths(columns, availableWidth) {
|
|
19812
|
+
const columnCount = columns.length;
|
|
19813
|
+
const width = availableWidth / columnCount;
|
|
19814
|
+
return columns.map(() => width);
|
|
19815
|
+
}
|
|
19816
|
+
function measureRowHeights(cells, _columnWidths) {
|
|
19817
|
+
return cells.map(() => 20);
|
|
19818
|
+
}
|
|
19810
19819
|
const SPACE_CHARS$1 = /* @__PURE__ */ new Set([" ", " "]);
|
|
19811
19820
|
function shouldApplyJustify(params2) {
|
|
19812
19821
|
const { alignment: alignment2, hasExplicitPositioning, isLastLineOfParagraph, paragraphEndsWithLineBreak, skipJustifyOverride } = params2;
|
|
@@ -20080,16 +20089,9 @@ function computeWrapExclusion(image, lineY, lineHeight2) {
|
|
|
20080
20089
|
return null;
|
|
20081
20090
|
}
|
|
20082
20091
|
}
|
|
20083
|
-
function resolveColumnWidths(columns, availableWidth) {
|
|
20084
|
-
const columnCount = columns.length;
|
|
20085
|
-
const width = availableWidth / columnCount;
|
|
20086
|
-
return columns.map(() => width);
|
|
20087
|
-
}
|
|
20088
|
-
function measureRowHeights(cells, _columnWidths) {
|
|
20089
|
-
return cells.map(() => 20);
|
|
20090
|
-
}
|
|
20091
20092
|
const Engines = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
20092
20093
|
__proto__: null,
|
|
20094
|
+
OOXML_PCT_DIVISOR,
|
|
20093
20095
|
calculateTabWidth,
|
|
20094
20096
|
computeListIndent,
|
|
20095
20097
|
computeTabStops: computeTabStops$1,
|
|
@@ -23191,6 +23193,37 @@ function renderListMarker(params2) {
|
|
|
23191
23193
|
lineContainer.appendChild(lineEl);
|
|
23192
23194
|
return lineContainer;
|
|
23193
23195
|
}
|
|
23196
|
+
function applyParagraphBordersAndShading(paraWrapper, block) {
|
|
23197
|
+
const borders = block.attrs?.borders;
|
|
23198
|
+
if (borders) {
|
|
23199
|
+
paraWrapper.style.boxSizing = "border-box";
|
|
23200
|
+
const sideStyles = {
|
|
23201
|
+
top: { width: "border-top-width", style: "border-top-style", color: "border-top-color" },
|
|
23202
|
+
bottom: { width: "border-bottom-width", style: "border-bottom-style", color: "border-bottom-color" },
|
|
23203
|
+
left: { width: "border-left-width", style: "border-left-style", color: "border-left-color" },
|
|
23204
|
+
right: { width: "border-right-width", style: "border-right-style", color: "border-right-color" }
|
|
23205
|
+
};
|
|
23206
|
+
["top", "bottom", "left", "right"].forEach((side) => {
|
|
23207
|
+
const border = borders[side];
|
|
23208
|
+
if (!border) return;
|
|
23209
|
+
const styleValue = border.style ?? "solid";
|
|
23210
|
+
let widthValue = typeof border.width === "number" ? Math.max(0, border.width) : 1;
|
|
23211
|
+
if (styleValue === "none") {
|
|
23212
|
+
widthValue = 0;
|
|
23213
|
+
}
|
|
23214
|
+
const cssKeys = sideStyles[side];
|
|
23215
|
+
paraWrapper.style.setProperty(cssKeys.style, styleValue);
|
|
23216
|
+
paraWrapper.style.setProperty(cssKeys.width, `${widthValue}px`);
|
|
23217
|
+
if (border.color) {
|
|
23218
|
+
paraWrapper.style.setProperty(cssKeys.color, border.color);
|
|
23219
|
+
}
|
|
23220
|
+
});
|
|
23221
|
+
}
|
|
23222
|
+
const shadingFill = block.attrs?.shading?.fill;
|
|
23223
|
+
if (shadingFill) {
|
|
23224
|
+
paraWrapper.style.backgroundColor = shadingFill;
|
|
23225
|
+
}
|
|
23226
|
+
}
|
|
23194
23227
|
const renderTableCell = (deps) => {
|
|
23195
23228
|
const {
|
|
23196
23229
|
doc: doc2,
|
|
@@ -23353,6 +23386,9 @@ const renderTableCell = (deps) => {
|
|
|
23353
23386
|
paraWrapper.style.left = "0";
|
|
23354
23387
|
paraWrapper.style.width = "100%";
|
|
23355
23388
|
applySdtDataset(paraWrapper, block.attrs?.sdt);
|
|
23389
|
+
applyParagraphBordersAndShading(paraWrapper, block);
|
|
23390
|
+
applyParagraphBorderStyles(paraWrapper, block.attrs?.borders);
|
|
23391
|
+
applyParagraphShadingStyles(paraWrapper, block.attrs?.shading);
|
|
23356
23392
|
let renderedHeight = 0;
|
|
23357
23393
|
for (let lineIdx = localStartLine; lineIdx < localEndLine && lineIdx < lines.length; lineIdx++) {
|
|
23358
23394
|
const line = lines[lineIdx];
|
|
@@ -23383,15 +23419,26 @@ const renderTableCell = (deps) => {
|
|
|
23383
23419
|
} else {
|
|
23384
23420
|
const indent = block.attrs?.indent;
|
|
23385
23421
|
if (indent) {
|
|
23386
|
-
|
|
23387
|
-
|
|
23422
|
+
const leftIndent = typeof indent.left === "number" ? indent.left : 0;
|
|
23423
|
+
const hanging = typeof indent.hanging === "number" ? indent.hanging : 0;
|
|
23424
|
+
const firstLine = typeof indent.firstLine === "number" ? indent.firstLine : 0;
|
|
23425
|
+
const isFirstLine = lineIdx === 0 && localStartLine === 0;
|
|
23426
|
+
const firstLineOffset = firstLine - hanging;
|
|
23427
|
+
if (isFirstLine) {
|
|
23428
|
+
if (leftIndent > 0) {
|
|
23429
|
+
lineEl.style.paddingLeft = `${leftIndent}px`;
|
|
23430
|
+
}
|
|
23431
|
+
if (firstLineOffset !== 0) {
|
|
23432
|
+
lineEl.style.textIndent = `${firstLineOffset}px`;
|
|
23433
|
+
}
|
|
23434
|
+
} else {
|
|
23435
|
+
if (leftIndent > 0) {
|
|
23436
|
+
lineEl.style.paddingLeft = `${leftIndent}px`;
|
|
23437
|
+
}
|
|
23388
23438
|
}
|
|
23389
23439
|
if (typeof indent.right === "number" && indent.right > 0) {
|
|
23390
23440
|
lineEl.style.paddingRight = `${indent.right}px`;
|
|
23391
23441
|
}
|
|
23392
|
-
if (lineIdx === 0 && typeof indent.firstLine === "number" && indent.firstLine !== 0) {
|
|
23393
|
-
lineEl.style.textIndent = `${indent.firstLine}px`;
|
|
23394
|
-
}
|
|
23395
23442
|
}
|
|
23396
23443
|
}
|
|
23397
23444
|
paraWrapper.appendChild(lineEl);
|
|
@@ -30309,12 +30356,18 @@ function buildMultiSectionIdentifier(sectionMetadata, pageStyles2, converterIds)
|
|
|
30309
30356
|
}
|
|
30310
30357
|
identifier.titlePg = identifier.sectionTitlePg.get(0) ?? false;
|
|
30311
30358
|
if (converterIds?.headerIds) {
|
|
30359
|
+
if (!identifier.titlePg && converterIds.headerIds.titlePg) {
|
|
30360
|
+
identifier.titlePg = true;
|
|
30361
|
+
}
|
|
30312
30362
|
identifier.headerIds.default = identifier.headerIds.default ?? converterIds.headerIds.default ?? null;
|
|
30313
30363
|
identifier.headerIds.first = identifier.headerIds.first ?? converterIds.headerIds.first ?? null;
|
|
30314
30364
|
identifier.headerIds.even = identifier.headerIds.even ?? converterIds.headerIds.even ?? null;
|
|
30315
30365
|
identifier.headerIds.odd = identifier.headerIds.odd ?? converterIds.headerIds.odd ?? null;
|
|
30316
30366
|
}
|
|
30317
30367
|
if (converterIds?.footerIds) {
|
|
30368
|
+
if (!identifier.titlePg && converterIds.footerIds.titlePg) {
|
|
30369
|
+
identifier.titlePg = true;
|
|
30370
|
+
}
|
|
30318
30371
|
identifier.footerIds.default = identifier.footerIds.default ?? converterIds.footerIds.default ?? null;
|
|
30319
30372
|
identifier.footerIds.first = identifier.footerIds.first ?? converterIds.footerIds.first ?? null;
|
|
30320
30373
|
identifier.footerIds.even = identifier.footerIds.even ?? converterIds.footerIds.even ?? null;
|
|
@@ -31493,6 +31546,27 @@ function getCellPadding(cellIdx, blockRow) {
|
|
|
31493
31546
|
function getCellTotalLines(cell) {
|
|
31494
31547
|
return getCellLines(cell).length;
|
|
31495
31548
|
}
|
|
31549
|
+
const ROW_HEIGHT_EPSILON = 0.1;
|
|
31550
|
+
function getRowContentHeight(blockRow, rowMeasure) {
|
|
31551
|
+
let contentHeight = 0;
|
|
31552
|
+
for (let cellIdx = 0; cellIdx < rowMeasure.cells.length; cellIdx++) {
|
|
31553
|
+
const cell = rowMeasure.cells[cellIdx];
|
|
31554
|
+
const cellPadding = getCellPadding(cellIdx, blockRow);
|
|
31555
|
+
const paddingTotal = cellPadding.top + cellPadding.bottom;
|
|
31556
|
+
const lines = getCellLines(cell);
|
|
31557
|
+
const linesHeight = lines.reduce((sum, line) => sum + (line.lineHeight || 0), 0);
|
|
31558
|
+
contentHeight = Math.max(contentHeight, linesHeight + paddingTotal);
|
|
31559
|
+
}
|
|
31560
|
+
return contentHeight;
|
|
31561
|
+
}
|
|
31562
|
+
function hasExplicitRowHeightSlack(blockRow, rowMeasure) {
|
|
31563
|
+
const rowHeightSpec = blockRow?.attrs?.rowHeight;
|
|
31564
|
+
if (!rowHeightSpec || rowHeightSpec.value == null || !Number.isFinite(rowHeightSpec.value)) {
|
|
31565
|
+
return false;
|
|
31566
|
+
}
|
|
31567
|
+
const contentHeight = getRowContentHeight(blockRow, rowMeasure);
|
|
31568
|
+
return rowMeasure.height > contentHeight + ROW_HEIGHT_EPSILON;
|
|
31569
|
+
}
|
|
31496
31570
|
function mergePmRange(target, range) {
|
|
31497
31571
|
if (typeof range.pmStart === "number") {
|
|
31498
31572
|
target.pmStart = target.pmStart == null ? range.pmStart : Math.min(target.pmStart, range.pmStart);
|
|
@@ -31662,8 +31736,12 @@ function findSplitPoint(block, measure, startRow, availableHeight, fullPageHeigh
|
|
|
31662
31736
|
let lastFitRow = startRow;
|
|
31663
31737
|
for (let i = startRow; i < block.rows.length; i++) {
|
|
31664
31738
|
const row = block.rows[i];
|
|
31665
|
-
const
|
|
31666
|
-
const
|
|
31739
|
+
const rowMeasure = measure.rows[i];
|
|
31740
|
+
const rowHeight = rowMeasure?.height || 0;
|
|
31741
|
+
let cantSplit = row.attrs?.tableRowProperties?.cantSplit === true;
|
|
31742
|
+
if (rowMeasure && hasExplicitRowHeightSlack(row, rowMeasure) && (!fullPageHeight || rowHeight <= fullPageHeight)) {
|
|
31743
|
+
cantSplit = true;
|
|
31744
|
+
}
|
|
31667
31745
|
if (accumulatedHeight + rowHeight <= availableHeight) {
|
|
31668
31746
|
accumulatedHeight += rowHeight;
|
|
31669
31747
|
lastFitRow = i + 1;
|
|
@@ -31754,7 +31832,10 @@ function layoutTableBlock({
|
|
|
31754
31832
|
if (hasMeasuredRows && hasPriorFragments) {
|
|
31755
31833
|
const firstRowCantSplit = block.rows[0]?.attrs?.tableRowProperties?.cantSplit === true;
|
|
31756
31834
|
const firstRowHeight = measure.rows[0]?.height ?? measure.totalHeight ?? 0;
|
|
31757
|
-
|
|
31835
|
+
const firstRowSlack = hasExplicitRowHeightSlack(block.rows[0], measure.rows[0]);
|
|
31836
|
+
const firstRowFitsPage = firstRowHeight <= state.contentBottom;
|
|
31837
|
+
const treatFirstRowAsCantSplit = firstRowCantSplit || firstRowSlack && firstRowFitsPage;
|
|
31838
|
+
if (treatFirstRowAsCantSplit) {
|
|
31758
31839
|
if (firstRowHeight > availableHeight) {
|
|
31759
31840
|
state = advanceColumn(state);
|
|
31760
31841
|
}
|
|
@@ -32320,6 +32401,36 @@ const DEFAULT_PARAGRAPH_LINE_HEIGHT_PX = 20;
|
|
|
32320
32401
|
function hasHeight(fragment) {
|
|
32321
32402
|
return fragment.kind === "image" || fragment.kind === "drawing" || fragment.kind === "table";
|
|
32322
32403
|
}
|
|
32404
|
+
function getParagraphSpacingBefore(block) {
|
|
32405
|
+
const spacing = block.attrs?.spacing;
|
|
32406
|
+
const value = spacing?.before ?? spacing?.lineSpaceBefore;
|
|
32407
|
+
return typeof value === "number" && Number.isFinite(value) && value > 0 ? value : 0;
|
|
32408
|
+
}
|
|
32409
|
+
function getParagraphSpacingAfter(block) {
|
|
32410
|
+
const spacing = block.attrs?.spacing;
|
|
32411
|
+
const value = spacing?.after ?? spacing?.lineSpaceAfter;
|
|
32412
|
+
return typeof value === "number" && Number.isFinite(value) && value > 0 ? value : 0;
|
|
32413
|
+
}
|
|
32414
|
+
function getMeasureHeight(block, measure) {
|
|
32415
|
+
switch (measure.kind) {
|
|
32416
|
+
case "paragraph":
|
|
32417
|
+
return measure.totalHeight;
|
|
32418
|
+
case "table":
|
|
32419
|
+
return measure.totalHeight;
|
|
32420
|
+
case "list":
|
|
32421
|
+
return measure.totalHeight;
|
|
32422
|
+
case "image":
|
|
32423
|
+
case "drawing":
|
|
32424
|
+
return measure.height;
|
|
32425
|
+
case "sectionBreak":
|
|
32426
|
+
case "pageBreak":
|
|
32427
|
+
case "columnBreak":
|
|
32428
|
+
return 0;
|
|
32429
|
+
default: {
|
|
32430
|
+
return block.kind === "paragraph" ? DEFAULT_PARAGRAPH_LINE_HEIGHT_PX : 0;
|
|
32431
|
+
}
|
|
32432
|
+
}
|
|
32433
|
+
}
|
|
32323
32434
|
const DEFAULT_PAGE_SIZE$2 = { w: 612, h: 792 };
|
|
32324
32435
|
const DEFAULT_MARGINS$2 = { top: 72, right: 72, bottom: 72, left: 72 };
|
|
32325
32436
|
const COLUMN_EPSILON = 1e-4;
|
|
@@ -33034,6 +33145,36 @@ function layoutDocument(blocks, measures, options = {}) {
|
|
|
33034
33145
|
placedAnchoredTableIds.add(tableBlock.id);
|
|
33035
33146
|
}
|
|
33036
33147
|
}
|
|
33148
|
+
if (paraBlock.attrs?.keepNext === true) {
|
|
33149
|
+
const nextBlock = blocks[index2 + 1];
|
|
33150
|
+
const nextMeasure = measures[index2 + 1];
|
|
33151
|
+
if (nextBlock && nextMeasure && nextBlock.kind !== "sectionBreak" && nextBlock.kind !== "pageBreak" && nextBlock.kind !== "columnBreak") {
|
|
33152
|
+
const shouldSkipAnchoredTable = nextBlock.kind === "table" && nextBlock.anchor?.isAnchored === true;
|
|
33153
|
+
if (!shouldSkipAnchoredTable) {
|
|
33154
|
+
let state = paginator.ensurePage();
|
|
33155
|
+
const availableHeight = state.contentBottom - state.cursorY;
|
|
33156
|
+
const spacingAfter = getParagraphSpacingAfter(paraBlock);
|
|
33157
|
+
const currentHeight = getMeasureHeight(paraBlock, measure);
|
|
33158
|
+
const nextHeight = getMeasureHeight(nextBlock, nextMeasure);
|
|
33159
|
+
const nextIsParagraph = nextBlock.kind === "paragraph" && nextMeasure.kind === "paragraph";
|
|
33160
|
+
const nextSpacingBefore = nextIsParagraph ? getParagraphSpacingBefore(nextBlock) : 0;
|
|
33161
|
+
const nextFirstLineHeight = (() => {
|
|
33162
|
+
if (!nextIsParagraph) {
|
|
33163
|
+
return nextHeight;
|
|
33164
|
+
}
|
|
33165
|
+
const firstLineHeight = nextMeasure.lines[0]?.lineHeight;
|
|
33166
|
+
if (typeof firstLineHeight === "number" && Number.isFinite(firstLineHeight) && firstLineHeight > 0) {
|
|
33167
|
+
return firstLineHeight;
|
|
33168
|
+
}
|
|
33169
|
+
return nextHeight;
|
|
33170
|
+
})();
|
|
33171
|
+
const combinedHeight = nextIsParagraph ? currentHeight + Math.max(spacingAfter, nextSpacingBefore) + nextFirstLineHeight : currentHeight + spacingAfter + nextHeight;
|
|
33172
|
+
if (combinedHeight > availableHeight && state.page.fragments.length > 0) {
|
|
33173
|
+
state = paginator.advanceColumn(state);
|
|
33174
|
+
}
|
|
33175
|
+
}
|
|
33176
|
+
}
|
|
33177
|
+
}
|
|
33037
33178
|
layoutParagraphBlock(
|
|
33038
33179
|
{
|
|
33039
33180
|
block,
|
|
@@ -40142,6 +40283,23 @@ const applyThemeShade = (baseHex, ratio) => {
|
|
|
40142
40283
|
};
|
|
40143
40284
|
return rgbToHex(shaded);
|
|
40144
40285
|
};
|
|
40286
|
+
const getLuminance = (hexColor) => {
|
|
40287
|
+
const rgb = hexToRgb(hexColor);
|
|
40288
|
+
if (!rgb) return 1;
|
|
40289
|
+
const toLinear = (channel) => {
|
|
40290
|
+
const c2 = channel / 255;
|
|
40291
|
+
return c2 <= 0.03928 ? c2 / 12.92 : Math.pow((c2 + 0.055) / 1.055, 2.4);
|
|
40292
|
+
};
|
|
40293
|
+
const R = toLinear(rgb.r);
|
|
40294
|
+
const G = toLinear(rgb.g);
|
|
40295
|
+
const B = toLinear(rgb.b);
|
|
40296
|
+
return 0.2126 * R + 0.7152 * G + 0.0722 * B;
|
|
40297
|
+
};
|
|
40298
|
+
const WCAG_AA_LUMINANCE_THRESHOLD = 0.18;
|
|
40299
|
+
const resolveAutoColor = (backgroundColor) => {
|
|
40300
|
+
const luminance = getLuminance(backgroundColor);
|
|
40301
|
+
return luminance < WCAG_AA_LUMINANCE_THRESHOLD ? "#FFFFFF" : "#000000";
|
|
40302
|
+
};
|
|
40145
40303
|
const resolveThemeColor = (attrs, themeColors) => {
|
|
40146
40304
|
if (!attrs || !themeColors) return void 0;
|
|
40147
40305
|
const rawKey = attrs.themeColor;
|
|
@@ -40467,8 +40625,9 @@ const applyTextStyleMark = (run, attrs, themeColors) => {
|
|
|
40467
40625
|
const DEFAULT_HYPERLINK_CONFIG = {
|
|
40468
40626
|
enableRichHyperlinks: false
|
|
40469
40627
|
};
|
|
40470
|
-
const applyMarksToRun = (run, marks, hyperlinkConfig = DEFAULT_HYPERLINK_CONFIG, themeColors) => {
|
|
40628
|
+
const applyMarksToRun = (run, marks, hyperlinkConfig = DEFAULT_HYPERLINK_CONFIG, themeColors, backgroundColor) => {
|
|
40471
40629
|
const isTabRun2 = run.kind === "tab";
|
|
40630
|
+
let markSetColor = false;
|
|
40472
40631
|
marks.forEach((mark) => {
|
|
40473
40632
|
const forwardedDataAttrs = extractDataAttributes(mark.attrs);
|
|
40474
40633
|
try {
|
|
@@ -40504,7 +40663,11 @@ const applyMarksToRun = (run, marks, hyperlinkConfig = DEFAULT_HYPERLINK_CONFIG,
|
|
|
40504
40663
|
}
|
|
40505
40664
|
case "textStyle":
|
|
40506
40665
|
if (!isTabRun2) {
|
|
40666
|
+
const colorBefore = run.color;
|
|
40507
40667
|
applyTextStyleMark(run, mark.attrs ?? {}, themeColors);
|
|
40668
|
+
if (run.color !== colorBefore && run.color !== void 0) {
|
|
40669
|
+
markSetColor = true;
|
|
40670
|
+
}
|
|
40508
40671
|
}
|
|
40509
40672
|
break;
|
|
40510
40673
|
case "commentMark":
|
|
@@ -40585,6 +40748,15 @@ const applyMarksToRun = (run, marks, hyperlinkConfig = DEFAULT_HYPERLINK_CONFIG,
|
|
|
40585
40748
|
run.dataAttrs = { ...run.dataAttrs ?? {}, ...forwardedDataAttrs };
|
|
40586
40749
|
}
|
|
40587
40750
|
});
|
|
40751
|
+
if (!isTabRun2 && !markSetColor && backgroundColor) {
|
|
40752
|
+
const normalizedExisting = normalizeColor$1(run.color);
|
|
40753
|
+
const normalizedUpper = normalizedExisting?.toUpperCase();
|
|
40754
|
+
const isDefaultBlack = normalizedUpper === "#000000" || normalizedUpper === "#000";
|
|
40755
|
+
const isAutoColorValue = typeof run.color === "string" && ["auto", "none"].includes(run.color.trim().replace(/^#/, "").toLowerCase());
|
|
40756
|
+
if (!normalizedExisting || isAutoColorValue || isDefaultBlack) {
|
|
40757
|
+
run.color = resolveAutoColor(backgroundColor);
|
|
40758
|
+
}
|
|
40759
|
+
}
|
|
40588
40760
|
};
|
|
40589
40761
|
function textNodeToRun(textNode, positions, defaultFont, defaultSize, inheritedMarks = [], sdtMetadata, hyperlinkConfig = DEFAULT_HYPERLINK_CONFIG$1, themeColors) {
|
|
40590
40762
|
const run = {
|
|
@@ -44407,7 +44579,13 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
|
|
|
44407
44579
|
const inlineStyleId = getInlineStyleId(inheritedMarks);
|
|
44408
44580
|
applyRunStyles2(run, inlineStyleId, activeRunStyleId);
|
|
44409
44581
|
applyBaseRunDefaults(run, baseRunDefaults, defaultFont, defaultSize);
|
|
44410
|
-
applyMarksToRun(
|
|
44582
|
+
applyMarksToRun(
|
|
44583
|
+
run,
|
|
44584
|
+
[...node.marks ?? [], ...inheritedMarks ?? []],
|
|
44585
|
+
hyperlinkConfig,
|
|
44586
|
+
themeColors,
|
|
44587
|
+
converterContext?.backgroundColor
|
|
44588
|
+
);
|
|
44411
44589
|
currentRuns.push(run);
|
|
44412
44590
|
return;
|
|
44413
44591
|
}
|
|
@@ -45126,9 +45304,21 @@ const parseTableCell = (args) => {
|
|
|
45126
45304
|
return null;
|
|
45127
45305
|
}
|
|
45128
45306
|
const blocks = [];
|
|
45129
|
-
const
|
|
45307
|
+
const cellBackground = cellNode.attrs?.background;
|
|
45308
|
+
let cellBackgroundColor;
|
|
45309
|
+
if (cellBackground && typeof cellBackground.color === "string") {
|
|
45310
|
+
const rawColor = cellBackground.color.trim();
|
|
45311
|
+
if (rawColor) {
|
|
45312
|
+
const normalized = rawColor.startsWith("#") ? rawColor : `#${rawColor}`;
|
|
45313
|
+
if (/^#[0-9A-Fa-f]{3}([0-9A-Fa-f]{3})?$/.test(normalized)) {
|
|
45314
|
+
cellBackgroundColor = normalized;
|
|
45315
|
+
}
|
|
45316
|
+
}
|
|
45317
|
+
}
|
|
45318
|
+
const cellConverterContext = tableStyleParagraphProps || cellBackgroundColor ? {
|
|
45130
45319
|
...context.converterContext,
|
|
45131
|
-
tableStyleParagraphProps
|
|
45320
|
+
...tableStyleParagraphProps && { tableStyleParagraphProps },
|
|
45321
|
+
...cellBackgroundColor && { backgroundColor: cellBackgroundColor }
|
|
45132
45322
|
} : context.converterContext;
|
|
45133
45323
|
const paragraphToFlowBlocks2 = context.converters?.paragraphToFlowBlocks ?? context.paragraphToFlowBlocks;
|
|
45134
45324
|
const listCounterContext = context.listCounterContext;
|
|
@@ -48508,8 +48698,33 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
48508
48698
|
...dropCapMeasure ? { dropCap: dropCapMeasure } : {}
|
|
48509
48699
|
};
|
|
48510
48700
|
}
|
|
48701
|
+
function validateTableWidthValue(attr) {
|
|
48702
|
+
const value = attr.width ?? attr.value;
|
|
48703
|
+
if (typeof value === "number" && Number.isFinite(value) && value > 0) {
|
|
48704
|
+
return value;
|
|
48705
|
+
}
|
|
48706
|
+
return void 0;
|
|
48707
|
+
}
|
|
48708
|
+
function resolveTableWidth(attrs, maxWidth) {
|
|
48709
|
+
const tableWidthAttr = attrs?.tableWidth;
|
|
48710
|
+
if (!tableWidthAttr || typeof tableWidthAttr !== "object") {
|
|
48711
|
+
return void 0;
|
|
48712
|
+
}
|
|
48713
|
+
const typedAttr = tableWidthAttr;
|
|
48714
|
+
const validValue = validateTableWidthValue(typedAttr);
|
|
48715
|
+
if (validValue === void 0) {
|
|
48716
|
+
return void 0;
|
|
48717
|
+
}
|
|
48718
|
+
if (typedAttr.type === "pct") {
|
|
48719
|
+
return Math.round(maxWidth * (validValue / OOXML_PCT_DIVISOR));
|
|
48720
|
+
} else if (typedAttr.type === "px" || typedAttr.type === "pixel") {
|
|
48721
|
+
return validValue;
|
|
48722
|
+
}
|
|
48723
|
+
return void 0;
|
|
48724
|
+
}
|
|
48511
48725
|
async function measureTableBlock(block, constraints) {
|
|
48512
48726
|
const maxWidth = typeof constraints === "number" ? constraints : constraints.maxWidth;
|
|
48727
|
+
const resolvedTableWidth = resolveTableWidth(block.attrs, maxWidth);
|
|
48513
48728
|
let columnWidths;
|
|
48514
48729
|
const scaleColumnWidths = (widths, targetWidth) => {
|
|
48515
48730
|
const totalWidth2 = widths.reduce((a, b) => a + b, 0);
|
|
@@ -48540,19 +48755,26 @@ async function measureTableBlock(block, constraints) {
|
|
|
48540
48755
|
return scaled;
|
|
48541
48756
|
};
|
|
48542
48757
|
const maxCellCount = Math.max(1, Math.max(...block.rows.map((r2) => r2.cells.length)));
|
|
48758
|
+
const effectiveTargetWidth = resolvedTableWidth != null ? Math.min(resolvedTableWidth, maxWidth) : maxWidth;
|
|
48543
48759
|
if (block.columnWidths && block.columnWidths.length > 0) {
|
|
48544
48760
|
columnWidths = [...block.columnWidths];
|
|
48545
|
-
const hasExplicitWidth =
|
|
48761
|
+
const hasExplicitWidth = resolvedTableWidth != null;
|
|
48546
48762
|
const hasFixedLayout = block.attrs?.tableLayout === "fixed";
|
|
48547
48763
|
if (hasExplicitWidth || hasFixedLayout) {
|
|
48548
48764
|
const totalWidth2 = columnWidths.reduce((a, b) => a + b, 0);
|
|
48549
|
-
if (totalWidth2 >
|
|
48550
|
-
|
|
48765
|
+
if (totalWidth2 !== effectiveTargetWidth && effectiveTargetWidth > 0) {
|
|
48766
|
+
const scale = effectiveTargetWidth / totalWidth2;
|
|
48767
|
+
columnWidths = columnWidths.map((w) => Math.max(1, Math.round(w * scale)));
|
|
48768
|
+
const scaledSum = columnWidths.reduce((a, b) => a + b, 0);
|
|
48769
|
+
if (scaledSum !== effectiveTargetWidth && columnWidths.length > 0) {
|
|
48770
|
+
const diff = effectiveTargetWidth - scaledSum;
|
|
48771
|
+
columnWidths[columnWidths.length - 1] = Math.max(1, columnWidths[columnWidths.length - 1] + diff);
|
|
48772
|
+
}
|
|
48551
48773
|
}
|
|
48552
48774
|
} else {
|
|
48553
48775
|
if (columnWidths.length < maxCellCount) {
|
|
48554
48776
|
const usedWidth = columnWidths.reduce((a, b) => a + b, 0);
|
|
48555
|
-
const remainingWidth = Math.max(0,
|
|
48777
|
+
const remainingWidth = Math.max(0, effectiveTargetWidth - usedWidth);
|
|
48556
48778
|
const missingColumns = maxCellCount - columnWidths.length;
|
|
48557
48779
|
const paddingWidth = Math.max(1, Math.floor(remainingWidth / missingColumns));
|
|
48558
48780
|
columnWidths.push(...Array.from({ length: missingColumns }, () => paddingWidth));
|
|
@@ -48560,12 +48782,12 @@ async function measureTableBlock(block, constraints) {
|
|
|
48560
48782
|
columnWidths = columnWidths.slice(0, maxCellCount);
|
|
48561
48783
|
}
|
|
48562
48784
|
const totalWidth2 = columnWidths.reduce((a, b) => a + b, 0);
|
|
48563
|
-
if (totalWidth2 >
|
|
48564
|
-
columnWidths = scaleColumnWidths(columnWidths,
|
|
48785
|
+
if (totalWidth2 > effectiveTargetWidth) {
|
|
48786
|
+
columnWidths = scaleColumnWidths(columnWidths, effectiveTargetWidth);
|
|
48565
48787
|
}
|
|
48566
48788
|
}
|
|
48567
48789
|
} else {
|
|
48568
|
-
const columnWidth = Math.max(1, Math.floor(
|
|
48790
|
+
const columnWidth = Math.max(1, Math.floor(effectiveTargetWidth / maxCellCount));
|
|
48569
48791
|
columnWidths = Array.from({ length: maxCellCount }, () => columnWidth);
|
|
48570
48792
|
}
|
|
48571
48793
|
const gridColumnCount = columnWidths.length;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const index = require("./index-
|
|
3
|
-
require("./SuperConverter-
|
|
2
|
+
const index = require("./index-B2xKsF_F.cjs");
|
|
3
|
+
require("./SuperConverter-C_fR_pax.cjs");
|
|
4
4
|
const blankDocx = require("./blank-docx-DfW3Eeh2.cjs");
|
|
5
5
|
const eventemitter3 = require("./eventemitter3-BQuRcMPI.cjs");
|
|
6
6
|
const provider = require("@hocuspocus/provider");
|
|
@@ -7461,7 +7461,7 @@ const _sfc_main = {
|
|
|
7461
7461
|
__name: "SuperDoc",
|
|
7462
7462
|
emits: ["selection-update"],
|
|
7463
7463
|
setup(__props, { emit: __emit }) {
|
|
7464
|
-
const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-
|
|
7464
|
+
const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-Cq1mqKR1.cjs")));
|
|
7465
7465
|
const superdocStore = useSuperdocStore();
|
|
7466
7466
|
const commentsStore = useCommentsStore();
|
|
7467
7467
|
const {
|
|
@@ -8367,7 +8367,7 @@ class SuperDoc extends eventemitter3.EventEmitter {
|
|
|
8367
8367
|
this.config.colors = shuffleArray(this.config.colors);
|
|
8368
8368
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
8369
8369
|
this.colorIndex = 0;
|
|
8370
|
-
this.version = "1.2.
|
|
8370
|
+
this.version = "1.2.2-next.1";
|
|
8371
8371
|
this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
|
|
8372
8372
|
this.superdocId = config.superdocId || uuid.v4();
|
|
8373
8373
|
this.colors = this.config.colors;
|