@superdoc-dev/mcp 0.7.1-next.9 → 0.8.0-next.10
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 +973 -172
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -51891,7 +51891,7 @@ var init_remark_gfm_BhnWr3yf_es = __esm(() => {
|
|
|
51891
51891
|
emptyOptions2 = {};
|
|
51892
51892
|
});
|
|
51893
51893
|
|
|
51894
|
-
// ../../packages/superdoc/dist/chunks/SuperConverter-
|
|
51894
|
+
// ../../packages/superdoc/dist/chunks/SuperConverter-k7GHkV-c.es.js
|
|
51895
51895
|
function getExtensionConfigField(extension$1, field, context = { name: "" }) {
|
|
51896
51896
|
const fieldValue = extension$1.config[field];
|
|
51897
51897
|
if (typeof fieldValue === "function")
|
|
@@ -61026,6 +61026,10 @@ function resolveRunProperties(params, inlineRpr, resolvedPpr, tableInfo = null,
|
|
|
61026
61026
|
inlineRpr = {};
|
|
61027
61027
|
if (inlineRpr?.underline)
|
|
61028
61028
|
delete inlineRpr.underline;
|
|
61029
|
+
if (inlineRpr?.vanish)
|
|
61030
|
+
delete inlineRpr.vanish;
|
|
61031
|
+
if (inlineRpr?.specVanish)
|
|
61032
|
+
delete inlineRpr.specVanish;
|
|
61029
61033
|
styleChain = [
|
|
61030
61034
|
...defaultsChain,
|
|
61031
61035
|
tableStyleProps,
|
|
@@ -73566,6 +73570,36 @@ function updateSectionMargins(target, updates = {}) {
|
|
|
73566
73570
|
}
|
|
73567
73571
|
throw new Error(`updateSectionMargins: unsupported target type: ${target.type}`);
|
|
73568
73572
|
}
|
|
73573
|
+
function binaryStringToBase64(binary) {
|
|
73574
|
+
if (typeof globalThis.btoa === "function")
|
|
73575
|
+
return globalThis.btoa(binary);
|
|
73576
|
+
if (typeof Buffer3 !== "undefined")
|
|
73577
|
+
return Buffer3.from(binary, "latin1").toString("base64");
|
|
73578
|
+
throw new Error("[base64] encode requires btoa (browser) or Buffer (Node)");
|
|
73579
|
+
}
|
|
73580
|
+
function base64ToBinaryString(b64) {
|
|
73581
|
+
if (typeof globalThis.atob === "function")
|
|
73582
|
+
return globalThis.atob(b64);
|
|
73583
|
+
if (typeof Buffer3 !== "undefined")
|
|
73584
|
+
return Buffer3.from(b64, "base64").toString("latin1");
|
|
73585
|
+
throw new Error("[base64] decode requires atob (browser) or Buffer (Node)");
|
|
73586
|
+
}
|
|
73587
|
+
function encodeUtf8Base64(input) {
|
|
73588
|
+
return binaryStringToBase64(encodeURIComponent(input).replace(/%([0-9A-F]{2})/g, (_, hex3) => String.fromCharCode(parseInt(hex3, 16))));
|
|
73589
|
+
}
|
|
73590
|
+
function decodeUtf8Base64(b64) {
|
|
73591
|
+
if (!b64)
|
|
73592
|
+
return "";
|
|
73593
|
+
try {
|
|
73594
|
+
const bin = base64ToBinaryString(b64);
|
|
73595
|
+
let pct = "";
|
|
73596
|
+
for (let i$1 = 0;i$1 < bin.length; i$1 += 1)
|
|
73597
|
+
pct += `%${bin.charCodeAt(i$1).toString(16).padStart(2, "0")}`;
|
|
73598
|
+
return decodeURIComponent(pct);
|
|
73599
|
+
} catch {
|
|
73600
|
+
return "";
|
|
73601
|
+
}
|
|
73602
|
+
}
|
|
73569
73603
|
function collectReferencedImageMediaForClipboard(sliceJsonString, editor) {
|
|
73570
73604
|
if (!sliceJsonString || !editor?.storage?.image?.media)
|
|
73571
73605
|
return "";
|
|
@@ -73700,36 +73734,6 @@ function applySuperdocClipboardMedia(editor, clipboardData, sliceJson = null, me
|
|
|
73700
73734
|
}
|
|
73701
73735
|
return outSlice;
|
|
73702
73736
|
}
|
|
73703
|
-
function binaryStringToBase64(binary) {
|
|
73704
|
-
if (typeof globalThis.btoa === "function")
|
|
73705
|
-
return globalThis.btoa(binary);
|
|
73706
|
-
if (typeof Buffer3 !== "undefined")
|
|
73707
|
-
return Buffer3.from(binary, "latin1").toString("base64");
|
|
73708
|
-
throw new Error("[superdocClipboardSlice] base64 encode requires btoa (browser) or Buffer (Node)");
|
|
73709
|
-
}
|
|
73710
|
-
function base64ToBinaryString(b64) {
|
|
73711
|
-
if (typeof globalThis.atob === "function")
|
|
73712
|
-
return globalThis.atob(b64);
|
|
73713
|
-
if (typeof Buffer3 !== "undefined")
|
|
73714
|
-
return Buffer3.from(b64, "base64").toString("latin1");
|
|
73715
|
-
throw new Error("[superdocClipboardSlice] base64 decode requires atob (browser) or Buffer (Node)");
|
|
73716
|
-
}
|
|
73717
|
-
function encodeUtf8Base64(input) {
|
|
73718
|
-
return binaryStringToBase64(encodeURIComponent(input).replace(/%([0-9A-F]{2})/g, (_, hex3) => String.fromCharCode(parseInt(hex3, 16))));
|
|
73719
|
-
}
|
|
73720
|
-
function decodeUtf8Base64(b64) {
|
|
73721
|
-
if (!b64)
|
|
73722
|
-
return "";
|
|
73723
|
-
try {
|
|
73724
|
-
const bin = base64ToBinaryString(b64);
|
|
73725
|
-
let pct = "";
|
|
73726
|
-
for (let i$1 = 0;i$1 < bin.length; i$1 += 1)
|
|
73727
|
-
pct += `%${bin.charCodeAt(i$1).toString(16).padStart(2, "0")}`;
|
|
73728
|
-
return decodeURIComponent(pct);
|
|
73729
|
-
} catch {
|
|
73730
|
-
return "";
|
|
73731
|
-
}
|
|
73732
|
-
}
|
|
73733
73737
|
function bodySectPrShouldEmbed(bodySectPr) {
|
|
73734
73738
|
if (!bodySectPr || typeof bodySectPr !== "object")
|
|
73735
73739
|
return false;
|
|
@@ -80556,6 +80560,33 @@ function _getReferencedTableStyles(tableStyleReference, params) {
|
|
|
80556
80560
|
...styleProps
|
|
80557
80561
|
};
|
|
80558
80562
|
}
|
|
80563
|
+
function buildFieldResultRuns(params, outputMarks) {
|
|
80564
|
+
const { node: node2 } = params;
|
|
80565
|
+
const contentNodes = (node2.content ?? []).flatMap((child) => exportSchemaToJson({
|
|
80566
|
+
...params,
|
|
80567
|
+
node: child
|
|
80568
|
+
}));
|
|
80569
|
+
if (contentNodes.length > 0)
|
|
80570
|
+
return contentNodes;
|
|
80571
|
+
const resolvedText = node2.attrs?.resolvedText;
|
|
80572
|
+
if (typeof resolvedText !== "string" || resolvedText.length === 0)
|
|
80573
|
+
return [];
|
|
80574
|
+
const textAttributes = /^\s|\s$/.test(resolvedText) ? { "xml:space": "preserve" } : undefined;
|
|
80575
|
+
return [{
|
|
80576
|
+
name: "w:r",
|
|
80577
|
+
elements: [{
|
|
80578
|
+
name: "w:rPr",
|
|
80579
|
+
elements: outputMarks
|
|
80580
|
+
}, {
|
|
80581
|
+
name: "w:t",
|
|
80582
|
+
attributes: textAttributes,
|
|
80583
|
+
elements: [{
|
|
80584
|
+
text: resolvedText,
|
|
80585
|
+
type: "text"
|
|
80586
|
+
}]
|
|
80587
|
+
}]
|
|
80588
|
+
}];
|
|
80589
|
+
}
|
|
80559
80590
|
function parseTarget(instruction) {
|
|
80560
80591
|
if (!instruction)
|
|
80561
80592
|
return "";
|
|
@@ -80609,7 +80640,19 @@ function parseCitationSourceIds(instruction) {
|
|
|
80609
80640
|
function extractResolvedText$1(content$2) {
|
|
80610
80641
|
if (!Array.isArray(content$2))
|
|
80611
80642
|
return "";
|
|
80612
|
-
|
|
80643
|
+
let out = "";
|
|
80644
|
+
const walk = (nodes) => {
|
|
80645
|
+
for (const node2 of nodes) {
|
|
80646
|
+
if (!node2)
|
|
80647
|
+
continue;
|
|
80648
|
+
if (node2.type === "text")
|
|
80649
|
+
out += node2.text || "";
|
|
80650
|
+
else if (Array.isArray(node2.content))
|
|
80651
|
+
walk(node2.content);
|
|
80652
|
+
}
|
|
80653
|
+
};
|
|
80654
|
+
walk(content$2);
|
|
80655
|
+
return out;
|
|
80613
80656
|
}
|
|
80614
80657
|
function parseTaInstruction(instruction) {
|
|
80615
80658
|
let longCitation = "";
|
|
@@ -82007,8 +82050,12 @@ function handleShapeTextWatermarkImport({ pict }) {
|
|
|
82007
82050
|
marginTop: styleObj["margin-top"] || "0"
|
|
82008
82051
|
};
|
|
82009
82052
|
const rotation = parseFloat(styleObj.rotation) || 0;
|
|
82010
|
-
const
|
|
82011
|
-
const
|
|
82053
|
+
const explicitHPosition = styleObj["mso-position-horizontal"];
|
|
82054
|
+
const explicitVPosition = styleObj["mso-position-vertical"];
|
|
82055
|
+
const hasExplicitMarginLeft = styleObj["margin-left"] != null;
|
|
82056
|
+
const hasExplicitMarginTop = styleObj["margin-top"] != null;
|
|
82057
|
+
const hPosition = explicitHPosition || (hasExplicitMarginLeft ? undefined : DEFAULT_VML_TEXT_WATERMARK_ALIGNMENT);
|
|
82058
|
+
const vPosition = explicitVPosition || (hasExplicitMarginTop ? undefined : DEFAULT_VML_TEXT_WATERMARK_ALIGNMENT);
|
|
82012
82059
|
const hRelativeTo = styleObj["mso-position-horizontal-relative"] || "margin";
|
|
82013
82060
|
const vRelativeTo = styleObj["mso-position-vertical-relative"] || "margin";
|
|
82014
82061
|
const textAnchor = styleObj["v-text-anchor"] || "middle";
|
|
@@ -82017,7 +82064,7 @@ function handleShapeTextWatermarkImport({ pict }) {
|
|
|
82017
82064
|
const rawFillColor2 = fillAttrs.color2 || "#3f3f3f";
|
|
82018
82065
|
const fillColor = sanitizeColor(rawFillColor, "silver");
|
|
82019
82066
|
const fillColor2 = sanitizeColor(rawFillColor2, "#3f3f3f");
|
|
82020
|
-
const opacity = fillAttrs.opacity
|
|
82067
|
+
const opacity = fillAttrs.opacity ?? String(DEFAULT_VML_TEXT_WATERMARK_OPACITY);
|
|
82021
82068
|
const fillType = fillAttrs.type || "solid";
|
|
82022
82069
|
const strokeAttrs = shape.elements?.find((el) => el.name === "v:stroke")?.attributes || {};
|
|
82023
82070
|
const stroked = shapeAttrs.stroked || "f";
|
|
@@ -82025,10 +82072,9 @@ function handleShapeTextWatermarkImport({ pict }) {
|
|
|
82025
82072
|
const strokeJoinstyle = strokeAttrs.joinstyle || "round";
|
|
82026
82073
|
const strokeEndcap = strokeAttrs.endcap || "flat";
|
|
82027
82074
|
const textStyleObj = parseVmlStyle(textpathAttrs.style || "");
|
|
82028
|
-
const
|
|
82029
|
-
const fontFamily = sanitizeFontFamily(rawFontFamily);
|
|
82075
|
+
const fontFamily = sanitizeFontFamily(decodeXmlEntities(textStyleObj["font-family"] || "").replace(/['"]/g, ""));
|
|
82030
82076
|
const fontSize = textStyleObj["font-size"] || "1pt";
|
|
82031
|
-
const
|
|
82077
|
+
const shouldFitShape = (textpathAttrs.fitshape || "t") === "t";
|
|
82032
82078
|
const trim = textpathAttrs.trim || "t";
|
|
82033
82079
|
const textpathOn = textpathAttrs.on || "t";
|
|
82034
82080
|
const pathAttrs = shape.elements?.find((el) => el.name === "v:path")?.attributes || {};
|
|
@@ -82037,7 +82083,7 @@ function handleShapeTextWatermarkImport({ pict }) {
|
|
|
82037
82083
|
const wrapType = wrapAttrs.type || "none";
|
|
82038
82084
|
const widthPx = convertToPixels(width);
|
|
82039
82085
|
const heightPx = convertToPixels(height);
|
|
82040
|
-
const sanitizedOpacity = sanitizeNumeric(
|
|
82086
|
+
const sanitizedOpacity = sanitizeNumeric(parseVmlOpacity(opacity), DEFAULT_VML_TEXT_WATERMARK_OPACITY, 0, 1);
|
|
82041
82087
|
const sanitizedRotation = sanitizeNumeric(rotation, 0, -360, 360);
|
|
82042
82088
|
const svgResult = generateTextWatermarkSVG({
|
|
82043
82089
|
text: watermarkText,
|
|
@@ -82051,12 +82097,44 @@ function handleShapeTextWatermarkImport({ pict }) {
|
|
|
82051
82097
|
textStyle: {
|
|
82052
82098
|
fontFamily,
|
|
82053
82099
|
fontSize
|
|
82054
|
-
}
|
|
82100
|
+
},
|
|
82101
|
+
fitShape: shouldFitShape
|
|
82102
|
+
});
|
|
82103
|
+
const svgDataUri = svgResult.dataUri;
|
|
82104
|
+
const centerOffsetTop = getTextWatermarkCenterOffset({
|
|
82105
|
+
hPosition,
|
|
82106
|
+
vPosition,
|
|
82107
|
+
hRelativeTo,
|
|
82108
|
+
vRelativeTo,
|
|
82109
|
+
height: heightPx,
|
|
82110
|
+
rotation: sanitizedRotation
|
|
82111
|
+
});
|
|
82112
|
+
const marginOffset = resolveTextWatermarkMarginOffset({
|
|
82113
|
+
hPosition,
|
|
82114
|
+
vPosition,
|
|
82115
|
+
hRelativeTo,
|
|
82116
|
+
vRelativeTo,
|
|
82117
|
+
marginLeft: convertToPixels(position2.marginLeft),
|
|
82118
|
+
marginTop: convertToPixels(position2.marginTop),
|
|
82119
|
+
width: widthPx,
|
|
82120
|
+
height: heightPx,
|
|
82121
|
+
svgWidth: svgResult.svgWidth,
|
|
82122
|
+
svgHeight: svgResult.svgHeight,
|
|
82123
|
+
centerOffsetTop,
|
|
82124
|
+
rotation: sanitizedRotation
|
|
82055
82125
|
});
|
|
82126
|
+
const anchorData = {
|
|
82127
|
+
hRelativeFrom: hRelativeTo,
|
|
82128
|
+
vRelativeFrom: vRelativeTo
|
|
82129
|
+
};
|
|
82130
|
+
if (hPosition)
|
|
82131
|
+
anchorData.alignH = hPosition;
|
|
82132
|
+
if (vPosition)
|
|
82133
|
+
anchorData.alignV = vPosition;
|
|
82056
82134
|
return {
|
|
82057
82135
|
type: "image",
|
|
82058
82136
|
attrs: {
|
|
82059
|
-
src:
|
|
82137
|
+
src: svgDataUri,
|
|
82060
82138
|
alt: watermarkText,
|
|
82061
82139
|
title: watermarkText,
|
|
82062
82140
|
extension: "svg",
|
|
@@ -82075,20 +82153,12 @@ function handleShapeTextWatermarkImport({ pict }) {
|
|
|
82075
82153
|
type: wrapType === "none" ? "None" : wrapType,
|
|
82076
82154
|
attrs: { behindDoc: true }
|
|
82077
82155
|
},
|
|
82078
|
-
anchorData
|
|
82079
|
-
hRelativeFrom: hRelativeTo,
|
|
82080
|
-
vRelativeFrom: vRelativeTo,
|
|
82081
|
-
alignH: hPosition,
|
|
82082
|
-
alignV: vPosition
|
|
82083
|
-
},
|
|
82156
|
+
anchorData,
|
|
82084
82157
|
size: {
|
|
82085
82158
|
width: svgResult.svgWidth,
|
|
82086
82159
|
height: svgResult.svgHeight
|
|
82087
82160
|
},
|
|
82088
|
-
marginOffset
|
|
82089
|
-
horizontal: hPosition === "center" && hRelativeTo === "margin" ? 0 : convertToPixels(position2.marginLeft),
|
|
82090
|
-
top: vPosition === "center" && vRelativeTo === "margin" ? 0 : convertToPixels(position2.marginTop)
|
|
82091
|
-
},
|
|
82161
|
+
marginOffset,
|
|
82092
82162
|
textWatermarkData: {
|
|
82093
82163
|
text: watermarkText,
|
|
82094
82164
|
rotation: sanitizedRotation,
|
|
@@ -82111,7 +82181,7 @@ function handleShapeTextWatermarkImport({ pict }) {
|
|
|
82111
82181
|
},
|
|
82112
82182
|
textpath: {
|
|
82113
82183
|
on: textpathOn === "t",
|
|
82114
|
-
fitshape:
|
|
82184
|
+
fitshape: shouldFitShape,
|
|
82115
82185
|
trim: trim === "t",
|
|
82116
82186
|
textpathok: textpathok === "t"
|
|
82117
82187
|
}
|
|
@@ -82122,21 +82192,84 @@ function handleShapeTextWatermarkImport({ pict }) {
|
|
|
82122
82192
|
function sanitizeFontFamily(fontFamily) {
|
|
82123
82193
|
if (!fontFamily || typeof fontFamily !== "string")
|
|
82124
82194
|
return "Arial";
|
|
82125
|
-
return fontFamily.replace(/[^a-zA-Z0-9\s
|
|
82195
|
+
return fontFamily.replace(/[^a-zA-Z0-9\s,-]/g, "").trim() || "Arial";
|
|
82126
82196
|
}
|
|
82127
82197
|
function sanitizeColor(color2, defaultColor = "silver") {
|
|
82128
82198
|
if (!color2 || typeof color2 !== "string")
|
|
82129
82199
|
return defaultColor;
|
|
82130
82200
|
return color2.replace(/[^a-zA-Z0-9#%(),.]/g, "").trim() || defaultColor;
|
|
82131
82201
|
}
|
|
82202
|
+
function normalizeVmlColor(color2) {
|
|
82203
|
+
return {
|
|
82204
|
+
black: "#000000",
|
|
82205
|
+
blue: "#0000FF",
|
|
82206
|
+
gray: "#808080",
|
|
82207
|
+
green: "#008000",
|
|
82208
|
+
lime: "#00FF00",
|
|
82209
|
+
red: "#FF0000",
|
|
82210
|
+
silver: "#C0C0C0",
|
|
82211
|
+
white: "#FFFFFF",
|
|
82212
|
+
yellow: "#FFFF00"
|
|
82213
|
+
}[typeof color2 === "string" ? color2.trim().toLowerCase() : ""] || color2;
|
|
82214
|
+
}
|
|
82215
|
+
function decodeXmlEntities(value) {
|
|
82216
|
+
return value.replace(/"/g, '"').replace(/'/g, "'").replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&").replace(/&#(\d+);/g, (_, code$1) => decodeCodePoint(Number(code$1))).replace(/&#x([0-9a-fA-F]+);/g, (_, code$1) => decodeCodePoint(Number.parseInt(code$1, 16)));
|
|
82217
|
+
}
|
|
82218
|
+
function decodeCodePoint(codePoint) {
|
|
82219
|
+
if (!Number.isInteger(codePoint) || codePoint < 0 || codePoint > 1114111)
|
|
82220
|
+
return "";
|
|
82221
|
+
return String.fromCodePoint(codePoint);
|
|
82222
|
+
}
|
|
82132
82223
|
function sanitizeNumeric(value, defaultValue, min = -Infinity, max = Infinity) {
|
|
82133
82224
|
const num = typeof value === "number" ? value : parseFloat(value);
|
|
82134
82225
|
if (isNaN(num) || !isFinite(num))
|
|
82135
82226
|
return defaultValue;
|
|
82136
82227
|
return Math.max(min, Math.min(max, num));
|
|
82137
82228
|
}
|
|
82138
|
-
function
|
|
82139
|
-
|
|
82229
|
+
function parseVmlOpacity(value) {
|
|
82230
|
+
if (typeof value === "number")
|
|
82231
|
+
return value;
|
|
82232
|
+
if (!value || typeof value !== "string")
|
|
82233
|
+
return NaN;
|
|
82234
|
+
const normalized = value.trim().toLowerCase();
|
|
82235
|
+
if (normalized.endsWith("%"))
|
|
82236
|
+
return Number.parseFloat(normalized.slice(0, -1)) / 100;
|
|
82237
|
+
if (normalized.endsWith("f"))
|
|
82238
|
+
return Number.parseInt(normalized.slice(0, -1), 10) / 65536;
|
|
82239
|
+
return Number.parseFloat(normalized);
|
|
82240
|
+
}
|
|
82241
|
+
function getTextWatermarkCenterOffset({ hPosition, vPosition, hRelativeTo, vRelativeTo, height, rotation }) {
|
|
82242
|
+
if (!(hPosition === "center" && vPosition === "center" && hRelativeTo === "margin" && vRelativeTo === "margin") || rotation === 0)
|
|
82243
|
+
return 0;
|
|
82244
|
+
return sanitizeNumeric(height, 0, 0, MAX_ROTATED_CENTERED_WATERMARK_OFFSET_HEIGHT_PX) * ROTATED_CENTERED_WATERMARK_TOP_OFFSET_RATIO;
|
|
82245
|
+
}
|
|
82246
|
+
function resolveTextWatermarkMarginOffset({ hPosition, vPosition, hRelativeTo, vRelativeTo, marginLeft, marginTop, width, height, svgWidth, svgHeight, centerOffsetTop, rotation }) {
|
|
82247
|
+
const isCenteredHorizontally = hPosition === "center" && hRelativeTo === "margin";
|
|
82248
|
+
const isCenteredVertically = vPosition === "center" && vRelativeTo === "margin";
|
|
82249
|
+
return {
|
|
82250
|
+
horizontal: isCenteredHorizontally ? 0 : getAbsoluteShapeOffset({
|
|
82251
|
+
position: hPosition,
|
|
82252
|
+
margin: marginLeft,
|
|
82253
|
+
shapeSize: width,
|
|
82254
|
+
svgSize: svgWidth,
|
|
82255
|
+
rotation
|
|
82256
|
+
}),
|
|
82257
|
+
top: isCenteredVertically ? centerOffsetTop : getAbsoluteShapeOffset({
|
|
82258
|
+
position: vPosition,
|
|
82259
|
+
margin: marginTop,
|
|
82260
|
+
shapeSize: height,
|
|
82261
|
+
svgSize: svgHeight,
|
|
82262
|
+
rotation
|
|
82263
|
+
})
|
|
82264
|
+
};
|
|
82265
|
+
}
|
|
82266
|
+
function getAbsoluteShapeOffset({ position: position2, margin, shapeSize, svgSize, rotation }) {
|
|
82267
|
+
if (position2 || rotation === 0)
|
|
82268
|
+
return margin;
|
|
82269
|
+
return margin + shapeSize / 2 - svgSize / 2;
|
|
82270
|
+
}
|
|
82271
|
+
function generateTextWatermarkSVG({ text: text$2, width, height, rotation, fill, textStyle, fitShape }) {
|
|
82272
|
+
let fontSize = height * 1.12;
|
|
82140
82273
|
if (textStyle?.fontSize && textStyle.fontSize.trim() !== "1pt") {
|
|
82141
82274
|
const match = textStyle.fontSize.match(/^([\d.]+)(pt|px)?$/);
|
|
82142
82275
|
if (match) {
|
|
@@ -82145,9 +82278,9 @@ function generateTextWatermarkSVG({ text: text$2, width, height, rotation, fill,
|
|
|
82145
82278
|
}
|
|
82146
82279
|
}
|
|
82147
82280
|
fontSize = Math.max(fontSize, 48);
|
|
82148
|
-
const color2 = sanitizeColor(fill?.color, "silver");
|
|
82149
|
-
const opacity = sanitizeNumeric(fill?.opacity,
|
|
82150
|
-
const fontFamily = sanitizeFontFamily(textStyle?.fontFamily);
|
|
82281
|
+
const color2 = normalizeVmlColor(sanitizeColor(fill?.color, "silver"));
|
|
82282
|
+
const opacity = sanitizeNumeric(fill?.opacity, DEFAULT_VML_TEXT_WATERMARK_OPACITY, 0, 1);
|
|
82283
|
+
const fontFamily = resolveSvgFontFamily(sanitizeFontFamily(textStyle?.fontFamily));
|
|
82151
82284
|
const sanitizedRotation = sanitizeNumeric(rotation, 0, -360, 360);
|
|
82152
82285
|
const sanitizedWidth = sanitizeNumeric(width, 100, 1, 1e4);
|
|
82153
82286
|
const sanitizedHeight = sanitizeNumeric(height, 100, 1, 1e4);
|
|
@@ -82161,24 +82294,40 @@ function generateTextWatermarkSVG({ text: text$2, width, height, rotation, fill,
|
|
|
82161
82294
|
const svgHeight = Math.max(sanitizedHeight, rotatedHeight) * 1.1;
|
|
82162
82295
|
const centerX = svgWidth / 2;
|
|
82163
82296
|
const centerY = svgHeight / 2;
|
|
82164
|
-
const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="${svgWidth}" height="${svgHeight}" viewBox="0 0 ${svgWidth} ${svgHeight}" style="overflow: visible;">
|
|
82165
|
-
<text
|
|
82166
|
-
x="${centerX}"
|
|
82167
|
-
y="${centerY}"
|
|
82168
|
-
text-anchor="middle"
|
|
82169
|
-
dominant-baseline="middle"
|
|
82170
|
-
font-family="${fontFamily}"
|
|
82171
|
-
font-size="${sanitizedFontSize}px"
|
|
82172
|
-
fill="${color2}"
|
|
82173
|
-
opacity="${opacity}"
|
|
82174
|
-
transform="rotate(${sanitizedRotation} ${centerX} ${centerY})">${escapeXml(text$2)}</text>
|
|
82175
|
-
</svg>`;
|
|
82176
82297
|
return {
|
|
82177
|
-
dataUri: `data:image/svg+xml,${
|
|
82298
|
+
dataUri: `data:image/svg+xml;base64,${encodeUtf8Base64(`<svg xmlns="http://www.w3.org/2000/svg" width="${svgWidth}" height="${svgHeight}" viewBox="0 0 ${svgWidth} ${svgHeight}" style="overflow: visible;">
|
|
82299
|
+
<text ${[
|
|
82300
|
+
`x="${centerX}"`,
|
|
82301
|
+
`y="${centerY}"`,
|
|
82302
|
+
'text-anchor="middle"',
|
|
82303
|
+
'dominant-baseline="middle"',
|
|
82304
|
+
`font-family="${fontFamily}"`,
|
|
82305
|
+
`font-size="${sanitizedFontSize}px"`,
|
|
82306
|
+
...fitShape ? [`textLength="${sanitizedWidth}"`, 'lengthAdjust="spacingAndGlyphs"'] : [],
|
|
82307
|
+
`fill="${color2}"`,
|
|
82308
|
+
`fill-opacity="${opacity}"`,
|
|
82309
|
+
`transform="rotate(${sanitizedRotation} ${centerX} ${centerY})"`
|
|
82310
|
+
].map((attribute) => ` ${attribute}`).join(`
|
|
82311
|
+
`)}>${escapeXml(text$2)}</text>
|
|
82312
|
+
</svg>`)}`,
|
|
82178
82313
|
svgWidth,
|
|
82179
82314
|
svgHeight
|
|
82180
82315
|
};
|
|
82181
82316
|
}
|
|
82317
|
+
function resolveSvgFontFamily(fontFamily) {
|
|
82318
|
+
if (!fontFamily || typeof fontFamily !== "string")
|
|
82319
|
+
return "Arial, sans-serif";
|
|
82320
|
+
const normalized = fontFamily.trim();
|
|
82321
|
+
if (normalized.includes(","))
|
|
82322
|
+
return normalized;
|
|
82323
|
+
return `${normalized}, ${new Set([
|
|
82324
|
+
"cambria",
|
|
82325
|
+
"constantia",
|
|
82326
|
+
"georgia",
|
|
82327
|
+
"times new roman",
|
|
82328
|
+
"times"
|
|
82329
|
+
]).has(normalized.toLowerCase()) ? "serif" : "Arial, sans-serif"}`;
|
|
82330
|
+
}
|
|
82182
82331
|
function escapeXml(text$2) {
|
|
82183
82332
|
return text$2.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
82184
82333
|
}
|
|
@@ -82186,7 +82335,7 @@ function parseVmlStyle(style) {
|
|
|
82186
82335
|
const result = {};
|
|
82187
82336
|
if (!style)
|
|
82188
82337
|
return result;
|
|
82189
|
-
const declarations = style.split(";").filter((s) => s.trim());
|
|
82338
|
+
const declarations = decodeXmlEntities(style).split(";").filter((s) => s.trim());
|
|
82190
82339
|
for (const decl of declarations) {
|
|
82191
82340
|
const colonIndex = decl.indexOf(":");
|
|
82192
82341
|
if (colonIndex === -1)
|
|
@@ -102656,10 +102805,7 @@ var isRegExp = (value) => {
|
|
|
102656
102805
|
}, decode$20 = (params) => {
|
|
102657
102806
|
const { node: node2 } = params;
|
|
102658
102807
|
const outputMarks = processOutputMarks(node2.attrs?.marksAsAttrs || []);
|
|
102659
|
-
const contentNodes = (
|
|
102660
|
-
...params,
|
|
102661
|
-
node: n
|
|
102662
|
-
}));
|
|
102808
|
+
const contentNodes = buildFieldResultRuns(params, outputMarks);
|
|
102663
102809
|
const instructionElements = buildInstructionElements(node2.attrs?.instruction, node2.attrs?.instructionTokens);
|
|
102664
102810
|
return [
|
|
102665
102811
|
{
|
|
@@ -102724,10 +102870,7 @@ var isRegExp = (value) => {
|
|
|
102724
102870
|
}, decode$19 = (params) => {
|
|
102725
102871
|
const { node: node2 } = params;
|
|
102726
102872
|
const outputMarks = processOutputMarks(node2.attrs?.marksAsAttrs || []);
|
|
102727
|
-
const contentNodes = (
|
|
102728
|
-
...params,
|
|
102729
|
-
node: n
|
|
102730
|
-
}));
|
|
102873
|
+
const contentNodes = buildFieldResultRuns(params, outputMarks);
|
|
102731
102874
|
const instructionElements = buildInstructionElements(node2.attrs?.instruction, node2.attrs?.instructionTokens);
|
|
102732
102875
|
return [
|
|
102733
102876
|
{
|
|
@@ -104986,7 +105129,7 @@ var isRegExp = (value) => {
|
|
|
104986
105129
|
if (!settings)
|
|
104987
105130
|
return false;
|
|
104988
105131
|
return resolveEvenAndOddHeadersFromSettingsPart(settings) ?? false;
|
|
104989
|
-
}, FULL_WIDTH_PT = "468pt", FULL_WIDTH_PT_VALUE = 468, PX_PER_PT = 1.33, XML_NODE_NAME = "w:pict", SD_NODE_NAME, validXmlAttributes, config2, translator$29, DEFAULT_SECTION_PROPS_TWIPS, ensureSectionLayoutDefaults = (sectPr, converter) => {
|
|
105132
|
+
}, ROTATED_CENTERED_WATERMARK_TOP_OFFSET_RATIO = 0.25, MAX_ROTATED_CENTERED_WATERMARK_OFFSET_HEIGHT_PX = 1e4, DEFAULT_VML_TEXT_WATERMARK_OPACITY = 1, DEFAULT_VML_TEXT_WATERMARK_ALIGNMENT = "center", FULL_WIDTH_PT = "468pt", FULL_WIDTH_PT_VALUE = 468, PX_PER_PT = 1.33, XML_NODE_NAME = "w:pict", SD_NODE_NAME, validXmlAttributes, config2, translator$29, DEFAULT_SECTION_PROPS_TWIPS, ensureSectionLayoutDefaults = (sectPr, converter) => {
|
|
104990
105133
|
if (!sectPr)
|
|
104991
105134
|
return {
|
|
104992
105135
|
type: "element",
|
|
@@ -105867,7 +106010,7 @@ var isRegExp = (value) => {
|
|
|
105867
106010
|
state.kern = kernNode.attributes["w:val"];
|
|
105868
106011
|
}
|
|
105869
106012
|
}, SuperConverter;
|
|
105870
|
-
var
|
|
106013
|
+
var init_SuperConverter_k7GHkV_c_es = __esm(() => {
|
|
105871
106014
|
init_rolldown_runtime_Bg48TavK_es();
|
|
105872
106015
|
init_jszip_C49i9kUs_es();
|
|
105873
106016
|
init_xml_js_CqGKpaft_es();
|
|
@@ -144047,7 +144190,7 @@ var init_SuperConverter_opYK_HD4_es = __esm(() => {
|
|
|
144047
144190
|
};
|
|
144048
144191
|
});
|
|
144049
144192
|
|
|
144050
|
-
// ../../packages/superdoc/dist/chunks/create-headless-toolbar-
|
|
144193
|
+
// ../../packages/superdoc/dist/chunks/create-headless-toolbar-dycevpY9.es.js
|
|
144051
144194
|
function parseSizeUnit(val = "0") {
|
|
144052
144195
|
const length = val.toString() || "0";
|
|
144053
144196
|
const value = Number.parseFloat(length);
|
|
@@ -151846,6 +151989,8 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, Extension = class Extension2 {
|
|
|
151846
151989
|
const src = node2.attrs?.src;
|
|
151847
151990
|
if (typeof src !== "string" || src.length === 0)
|
|
151848
151991
|
return false;
|
|
151992
|
+
if (node2.attrs?.vmlTextWatermark)
|
|
151993
|
+
return false;
|
|
151849
151994
|
if (src.startsWith("word/media"))
|
|
151850
151995
|
return false;
|
|
151851
151996
|
if (src.startsWith("data:") && node2.attrs?.rId)
|
|
@@ -154070,8 +154215,8 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, Extension = class Extension2 {
|
|
|
154070
154215
|
}
|
|
154071
154216
|
};
|
|
154072
154217
|
};
|
|
154073
|
-
var
|
|
154074
|
-
|
|
154218
|
+
var init_create_headless_toolbar_dycevpY9_es = __esm(() => {
|
|
154219
|
+
init_SuperConverter_k7GHkV_c_es();
|
|
154075
154220
|
init_uuid_qzgm05fK_es();
|
|
154076
154221
|
init_constants_DrU4EASo_es();
|
|
154077
154222
|
init_dist_B8HfvhaK_es();
|
|
@@ -163022,7 +163167,7 @@ var require_decode_codepoint = __commonJS((exports) => {
|
|
|
163022
163167
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
163023
163168
|
exports.fromCodePoint = undefined;
|
|
163024
163169
|
exports.replaceCodePoint = replaceCodePoint;
|
|
163025
|
-
exports.decodeCodePoint =
|
|
163170
|
+
exports.decodeCodePoint = decodeCodePoint2;
|
|
163026
163171
|
var decodeMap = new Map([
|
|
163027
163172
|
[0, 65533],
|
|
163028
163173
|
[128, 8364],
|
|
@@ -163070,7 +163215,7 @@ var require_decode_codepoint = __commonJS((exports) => {
|
|
|
163070
163215
|
}
|
|
163071
163216
|
return (_a3 = decodeMap.get(codePoint)) !== null && _a3 !== undefined ? _a3 : codePoint;
|
|
163072
163217
|
}
|
|
163073
|
-
function
|
|
163218
|
+
function decodeCodePoint2(codePoint) {
|
|
163074
163219
|
return (0, exports.fromCodePoint)(replaceCodePoint(codePoint));
|
|
163075
163220
|
}
|
|
163076
163221
|
});
|
|
@@ -208797,7 +208942,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
|
|
|
208797
208942
|
init_remark_gfm_BhnWr3yf_es();
|
|
208798
208943
|
});
|
|
208799
208944
|
|
|
208800
|
-
// ../../packages/superdoc/dist/chunks/src-
|
|
208945
|
+
// ../../packages/superdoc/dist/chunks/src-CY28yu-i.es.js
|
|
208801
208946
|
function deleteProps(obj, propOrProps) {
|
|
208802
208947
|
const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
|
|
208803
208948
|
const removeNested = (target, pathParts, index2 = 0) => {
|
|
@@ -210684,6 +210829,86 @@ function backfillCapability(metaMap, ydoc) {
|
|
|
210684
210829
|
function createReplacer(data) {
|
|
210685
210830
|
return ({ part }) => replacePartData(part, data);
|
|
210686
210831
|
}
|
|
210832
|
+
function normalizeYjsFragmentForSchema(fragment) {
|
|
210833
|
+
if (!isTraversableYjsXml(fragment))
|
|
210834
|
+
return false;
|
|
210835
|
+
let changed = false;
|
|
210836
|
+
const normalize4 = () => {
|
|
210837
|
+
changed = stripSchemaAtomChildren(fragment) || changed;
|
|
210838
|
+
};
|
|
210839
|
+
if (fragment.doc)
|
|
210840
|
+
fragment.doc.transact(normalize4, NORMALIZE_YJS_FRAGMENT_ORIGIN);
|
|
210841
|
+
else
|
|
210842
|
+
normalize4();
|
|
210843
|
+
return changed;
|
|
210844
|
+
}
|
|
210845
|
+
function normalizeYjsFragmentEventsForSchema(events, fallbackFragment) {
|
|
210846
|
+
if (!Array.isArray(events) || events.length === 0)
|
|
210847
|
+
return normalizeYjsFragmentForSchema(fallbackFragment);
|
|
210848
|
+
if (events.some((event) => event?.transaction?.origin === NORMALIZE_YJS_FRAGMENT_ORIGIN))
|
|
210849
|
+
return false;
|
|
210850
|
+
let changed = false;
|
|
210851
|
+
const normalize4 = () => {
|
|
210852
|
+
const visited = /* @__PURE__ */ new Set;
|
|
210853
|
+
for (const event of events) {
|
|
210854
|
+
const target = findNormalizableEventTarget(event?.target);
|
|
210855
|
+
if (!isTraversableYjsXml(target) || visited.has(target))
|
|
210856
|
+
continue;
|
|
210857
|
+
visited.add(target);
|
|
210858
|
+
changed = stripSchemaAtomChildren(target) || changed;
|
|
210859
|
+
}
|
|
210860
|
+
};
|
|
210861
|
+
const doc$12 = fallbackFragment?.doc || findEventDoc(events);
|
|
210862
|
+
if (doc$12)
|
|
210863
|
+
doc$12.transact(normalize4, NORMALIZE_YJS_FRAGMENT_ORIGIN);
|
|
210864
|
+
else
|
|
210865
|
+
normalize4();
|
|
210866
|
+
return changed;
|
|
210867
|
+
}
|
|
210868
|
+
function stripSchemaAtomChildren(parent) {
|
|
210869
|
+
if (!isTraversableYjsXml(parent))
|
|
210870
|
+
return false;
|
|
210871
|
+
if (parent instanceof YXmlElement && SCHEMA_ATOM_NODE_NAMES.has(parent.nodeName)) {
|
|
210872
|
+
if (parent.length === 0)
|
|
210873
|
+
return false;
|
|
210874
|
+
parent.delete(0, parent.length);
|
|
210875
|
+
return true;
|
|
210876
|
+
}
|
|
210877
|
+
let changed = false;
|
|
210878
|
+
for (const child of parent.toArray()) {
|
|
210879
|
+
if (!(child instanceof YXmlElement))
|
|
210880
|
+
continue;
|
|
210881
|
+
if (SCHEMA_ATOM_NODE_NAMES.has(child.nodeName)) {
|
|
210882
|
+
if (child.length > 0) {
|
|
210883
|
+
child.delete(0, child.length);
|
|
210884
|
+
changed = true;
|
|
210885
|
+
}
|
|
210886
|
+
continue;
|
|
210887
|
+
}
|
|
210888
|
+
changed = stripSchemaAtomChildren(child) || changed;
|
|
210889
|
+
}
|
|
210890
|
+
return changed;
|
|
210891
|
+
}
|
|
210892
|
+
function findNormalizableEventTarget(target) {
|
|
210893
|
+
let current = target;
|
|
210894
|
+
while (current) {
|
|
210895
|
+
if (current instanceof YXmlElement && SCHEMA_ATOM_NODE_NAMES.has(current.nodeName))
|
|
210896
|
+
return current;
|
|
210897
|
+
current = current.parent;
|
|
210898
|
+
}
|
|
210899
|
+
return target;
|
|
210900
|
+
}
|
|
210901
|
+
function findEventDoc(events) {
|
|
210902
|
+
for (const event of events) {
|
|
210903
|
+
const doc$12 = event?.target?.doc;
|
|
210904
|
+
if (doc$12)
|
|
210905
|
+
return doc$12;
|
|
210906
|
+
}
|
|
210907
|
+
return null;
|
|
210908
|
+
}
|
|
210909
|
+
function isTraversableYjsXml(value) {
|
|
210910
|
+
return Boolean(value && typeof value.toArray === "function");
|
|
210911
|
+
}
|
|
210687
210912
|
function getEditorSurfaceElement(editor) {
|
|
210688
210913
|
if (!editor)
|
|
210689
210914
|
return null;
|
|
@@ -211186,13 +211411,8 @@ function splitBlockPatch(state, dispatch, editor) {
|
|
|
211186
211411
|
atStart = $from.start(d) == $from.pos - ($from.depth - d);
|
|
211187
211412
|
deflt = defaultBlockAt($from.node(d - 1).contentMatchAt($from.indexAfter(d - 1)));
|
|
211188
211413
|
const sourceParagraphStyleId = node2.attrs?.paragraphProperties?.styleId;
|
|
211189
|
-
|
|
211190
|
-
|
|
211191
|
-
sdBlockId: null,
|
|
211192
|
-
sdBlockRev: null,
|
|
211193
|
-
paraId: null,
|
|
211194
|
-
textId: null
|
|
211195
|
-
};
|
|
211414
|
+
const extensionAttrs = editor?.extensionService?.attributes ?? [];
|
|
211415
|
+
paragraphAttrs = Attribute2.getSplittedAttributes(extensionAttrs, node2.type.name, node2.attrs);
|
|
211196
211416
|
paragraphAttrs = clearInheritedLinkedStyleId(paragraphAttrs, editor, { emptyParagraph: atEnd });
|
|
211197
211417
|
if (atEnd && $from.parent.type.name === "run") {
|
|
211198
211418
|
if (!isLinkedParagraphStyleId(editor, sourceParagraphStyleId))
|
|
@@ -212911,12 +213131,10 @@ function createListBoundaryNavigationPlugin() {
|
|
|
212911
213131
|
const paragraph2 = getParagraphContext$1(selection.$from);
|
|
212912
213132
|
if (!paragraph2 || !isListParagraph(paragraph2.node))
|
|
212913
213133
|
return false;
|
|
212914
|
-
if (isRtlParagraph$1(paragraph2.node))
|
|
212915
|
-
return false;
|
|
212916
213134
|
const bounds = getParagraphTextBounds2(paragraph2.node, paragraph2.start);
|
|
212917
213135
|
if (!bounds)
|
|
212918
213136
|
return false;
|
|
212919
|
-
const direction = event.key === "ArrowLeft" ? -1 : 1;
|
|
213137
|
+
const direction = isRtlParagraph$1(paragraph2.node) ? event.key === "ArrowRight" ? -1 : 1 : event.key === "ArrowLeft" ? -1 : 1;
|
|
212920
213138
|
const atLeftBoundary = direction < 0 && selection.from <= bounds.first;
|
|
212921
213139
|
const atRightBoundary = direction > 0 && selection.from >= bounds.last;
|
|
212922
213140
|
if (!atLeftBoundary && !atRightBoundary)
|
|
@@ -232204,10 +232422,7 @@ function tablesSplitAdapter(editor, input2, options) {
|
|
|
232204
232422
|
const rEnd = tr.mapping.slice(mapFrom).map(rowPositions[i4] + tableNode.child(i4).nodeSize);
|
|
232205
232423
|
tr.delete(rp, rEnd);
|
|
232206
232424
|
}
|
|
232207
|
-
const newTableAttrs =
|
|
232208
|
-
delete newTableAttrs.sdBlockId;
|
|
232209
|
-
delete newTableAttrs.paraId;
|
|
232210
|
-
delete newTableAttrs.textId;
|
|
232425
|
+
const newTableAttrs = Attribute2.getSplittedAttributes(editor.extensionService?.attributes ?? [], tableNode.type.name, tableNode.attrs);
|
|
232211
232426
|
const newTable = schema.nodes.table.create(newTableAttrs, secondTableRows);
|
|
232212
232427
|
const separatorParagraph = createSeparatorParagraph(schema);
|
|
232213
232428
|
if (!separatorParagraph)
|
|
@@ -258995,13 +259210,13 @@ function bookmarkEndNodeToRun(params$1) {
|
|
|
258995
259210
|
};
|
|
258996
259211
|
return run2;
|
|
258997
259212
|
}
|
|
258998
|
-
function tabNodeToRun({ node: node2, positions, storyKey, tabOrdinal, paragraphAttrs, inheritedMarks, sdtMetadata }) {
|
|
259213
|
+
function tabNodeToRun({ node: node2, positions, storyKey, tabOrdinal, paragraphAttrs, inheritedMarks, sdtMetadata, runProperties, converterContext, inlineRunProperties }) {
|
|
258999
259214
|
const pos = positions.get(node2);
|
|
259000
259215
|
if (!pos)
|
|
259001
259216
|
return null;
|
|
259002
259217
|
const tabStops = paragraphAttrs.tabs;
|
|
259003
259218
|
const indent2 = paragraphAttrs.indent;
|
|
259004
|
-
|
|
259219
|
+
let run2 = {
|
|
259005
259220
|
kind: "tab",
|
|
259006
259221
|
text: "\t",
|
|
259007
259222
|
pmStart: pos.start,
|
|
@@ -259013,6 +259228,8 @@ function tabNodeToRun({ node: node2, positions, storyKey, tabOrdinal, paragraphA
|
|
|
259013
259228
|
};
|
|
259014
259229
|
if (sdtMetadata)
|
|
259015
259230
|
run2.sdt = sdtMetadata;
|
|
259231
|
+
if (runProperties)
|
|
259232
|
+
run2 = applyInlineRunProperties(run2, runProperties, converterContext, inlineRunProperties);
|
|
259016
259233
|
const marks = [...node2.marks ?? [], ...inheritedMarks ?? []];
|
|
259017
259234
|
if (marks.length > 0)
|
|
259018
259235
|
applyMarksToRun(run2, marks, undefined, undefined, undefined, true, storyKey);
|
|
@@ -260429,7 +260646,7 @@ function toFlowBlocks(pmDoc, options) {
|
|
|
260429
260646
|
blockCounts,
|
|
260430
260647
|
bookmarks: bookmarks.size
|
|
260431
260648
|
});
|
|
260432
|
-
const mergedBlocks = mergeDropCapParagraphs(hydrateImageBlocks(blocks2, options?.mediaFiles));
|
|
260649
|
+
const mergedBlocks = mergeFusedParagraphs(mergeDropCapParagraphs(hydrateImageBlocks(blocks2, options?.mediaFiles)));
|
|
260433
260650
|
flowBlockCache?.commit();
|
|
260434
260651
|
return {
|
|
260435
260652
|
blocks: mergedBlocks,
|
|
@@ -260466,6 +260683,32 @@ function mergeDropCapParagraphs(blocks2) {
|
|
|
260466
260683
|
}
|
|
260467
260684
|
return result;
|
|
260468
260685
|
}
|
|
260686
|
+
function mergeFusedParagraphs(blocks2) {
|
|
260687
|
+
const result = [];
|
|
260688
|
+
for (const block of blocks2) {
|
|
260689
|
+
const prev = result.length > 0 ? result[result.length - 1] : undefined;
|
|
260690
|
+
if (block.kind === "paragraph" && prev?.kind === "paragraph" && prev.attrs?.suppressParagraphBreak) {
|
|
260691
|
+
const head = prev;
|
|
260692
|
+
const tail = block;
|
|
260693
|
+
const mergedAttrs = { ...head.attrs };
|
|
260694
|
+
if (tail.attrs?.suppressParagraphBreak)
|
|
260695
|
+
mergedAttrs.suppressParagraphBreak = true;
|
|
260696
|
+
else
|
|
260697
|
+
delete mergedAttrs.suppressParagraphBreak;
|
|
260698
|
+
const merged = {
|
|
260699
|
+
kind: "paragraph",
|
|
260700
|
+
id: head.id,
|
|
260701
|
+
runs: [...head.runs, ...tail.runs],
|
|
260702
|
+
attrs: mergedAttrs,
|
|
260703
|
+
...head.sourceAnchor ? { sourceAnchor: head.sourceAnchor } : {}
|
|
260704
|
+
};
|
|
260705
|
+
result[result.length - 1] = merged;
|
|
260706
|
+
continue;
|
|
260707
|
+
}
|
|
260708
|
+
result.push(block);
|
|
260709
|
+
}
|
|
260710
|
+
return result;
|
|
260711
|
+
}
|
|
260469
260712
|
function normalizeConverterContext(context, defaultFont, defaultSize) {
|
|
260470
260713
|
if (!context)
|
|
260471
260714
|
context = {
|
|
@@ -268587,7 +268830,7 @@ var Node$13 = class Node$14 {
|
|
|
268587
268830
|
let $pos = doc$12.resolve(this.pos);
|
|
268588
268831
|
return GapCursor.valid($pos) ? new GapCursor($pos) : Selection.near($pos);
|
|
268589
268832
|
}
|
|
268590
|
-
}, handleKeyDown2, Gapcursor, PARTS_MAP_KEY = "parts", META_MAP_KEY = "meta", META_PARTS_SCHEMA_VERSION_KEY = "partsSchemaVersion", META_PARTS_MIGRATION_KEY = "partsMigration", META_PARTS_LAST_HYDRATED_AT_KEY = "partsLastHydratedAt", META_PARTS_FALLBACK_MODE_KEY = "partsFallbackMode", META_PARTS_CAPABILITY_KEY = "partsCapability", SOURCE_COLLAB_REMOTE_PARTS = "collab:remote:parts", SOURCE_COLLAB_REMOTE_PREFIX = "collab:remote:", EXCLUDED_PART_IDS, CRITICAL_PART_IDS, isApplyingRemoteParts = false, headlessBindingStateByEditor, headlessCleanupRegisteredEditors, META_BODY_SECT_PR_KEY = "bodySectPr", BODY_SECT_PR_SYNC_META_KEY = "bodySectPrSync", collaborationCleanupByEditor, registerHeadlessBindingCleanup = (editor, cleanup) => {
|
|
268833
|
+
}, handleKeyDown2, Gapcursor, PARTS_MAP_KEY = "parts", META_MAP_KEY = "meta", META_PARTS_SCHEMA_VERSION_KEY = "partsSchemaVersion", META_PARTS_MIGRATION_KEY = "partsMigration", META_PARTS_LAST_HYDRATED_AT_KEY = "partsLastHydratedAt", META_PARTS_FALLBACK_MODE_KEY = "partsFallbackMode", META_PARTS_CAPABILITY_KEY = "partsCapability", SOURCE_COLLAB_REMOTE_PARTS = "collab:remote:parts", SOURCE_COLLAB_REMOTE_PREFIX = "collab:remote:", EXCLUDED_PART_IDS, CRITICAL_PART_IDS, isApplyingRemoteParts = false, SCHEMA_ATOM_NODE_NAMES, NORMALIZE_YJS_FRAGMENT_ORIGIN, headlessBindingStateByEditor, headlessCleanupRegisteredEditors, META_BODY_SECT_PR_KEY = "bodySectPr", BODY_SECT_PR_SYNC_META_KEY = "bodySectPrSync", collaborationCleanupByEditor, registerHeadlessBindingCleanup = (editor, cleanup) => {
|
|
268591
268834
|
if (!cleanup || headlessCleanupRegisteredEditors.has(editor))
|
|
268592
268835
|
return;
|
|
268593
268836
|
headlessCleanupRegisteredEditors.add(editor);
|
|
@@ -268671,6 +268914,7 @@ var Node$13 = class Node$14 {
|
|
|
268671
268914
|
if (!cleanup)
|
|
268672
268915
|
return;
|
|
268673
268916
|
cleanup.syncListenerCleanup?.();
|
|
268917
|
+
cleanup.fragmentNormalizeCleanup?.();
|
|
268674
268918
|
cleanup.mediaMap?.unobserve?.(cleanup.mediaMapObserver);
|
|
268675
268919
|
cleanup.metaMap?.unobserve?.(cleanup.metaMapObserver);
|
|
268676
268920
|
cleanup.partSyncHandle?.destroy();
|
|
@@ -268681,12 +268925,23 @@ var Node$13 = class Node$14 {
|
|
|
268681
268925
|
collaborationCleanupByEditor.delete(editor);
|
|
268682
268926
|
}, createSyncPlugin = (ydoc, editor) => {
|
|
268683
268927
|
const fragment = ydoc.getXmlFragment("supereditor");
|
|
268928
|
+
normalizeYjsFragmentForSchema(fragment);
|
|
268684
268929
|
const onFirstRender = () => {
|
|
268685
268930
|
if (!editor.options.isNewFile)
|
|
268686
268931
|
return;
|
|
268687
268932
|
initializeMetaMap(ydoc, editor);
|
|
268688
268933
|
};
|
|
268689
268934
|
return [ySyncPlugin(fragment, { onFirstRender }), fragment];
|
|
268935
|
+
}, registerYjsFragmentNormalizer = (fragment) => {
|
|
268936
|
+
if (!fragment || typeof fragment.observeDeep !== "function" || typeof fragment.unobserveDeep !== "function")
|
|
268937
|
+
return () => {};
|
|
268938
|
+
const normalize4 = (events) => {
|
|
268939
|
+
normalizeYjsFragmentEventsForSchema(events, fragment);
|
|
268940
|
+
};
|
|
268941
|
+
fragment.observeDeep(normalize4);
|
|
268942
|
+
return () => {
|
|
268943
|
+
fragment.unobserveDeep(normalize4);
|
|
268944
|
+
};
|
|
268690
268945
|
}, initializeMetaMap = (ydoc, editor) => {
|
|
268691
268946
|
seedPartsFromEditor(editor, ydoc);
|
|
268692
268947
|
const mediaMap = ydoc.getMap("media");
|
|
@@ -285502,7 +285757,7 @@ menclose::after {
|
|
|
285502
285757
|
menclose.setAttribute("notation", notations.join(" "));
|
|
285503
285758
|
menclose.appendChild(innerMrow);
|
|
285504
285759
|
return menclose;
|
|
285505
|
-
}, MATHML_NS = "http://www.w3.org/1998/Math/MathML", MATH_OBJECT_REGISTRY, ARGUMENT_ELEMENTS, resolveOrBuildFragmentIdentity = (fragment, story, existing) => buildLayoutSourceIdentityForFragment(existing ? {
|
|
285760
|
+
}, MATHML_NS = "http://www.w3.org/1998/Math/MathML", MATH_OBJECT_REGISTRY, ARGUMENT_ELEMENTS, ACTIVE_HEADER_FOOTER_WATERMARK_PREVIEW_OPACITY = "1", INACTIVE_HEADER_FOOTER_WATERMARK_PREVIEW_OPACITY = "0.5", resolveOrBuildFragmentIdentity = (fragment, story, existing) => buildLayoutSourceIdentityForFragment(existing ? {
|
|
285506
285761
|
...fragment,
|
|
285507
285762
|
layoutSourceIdentity: existing,
|
|
285508
285763
|
sourceAnchor: fragment.sourceAnchor ?? existing.sourceAnchor
|
|
@@ -290494,6 +290749,8 @@ menclose::after {
|
|
|
290494
290749
|
pageBreakBefore: resolvedParagraphProperties.pageBreakBefore,
|
|
290495
290750
|
directionContext
|
|
290496
290751
|
};
|
|
290752
|
+
if (resolvedParagraphProperties.runProperties?.vanish === true || paragraphProperties.runProperties?.vanish === true)
|
|
290753
|
+
paragraphAttrs.suppressParagraphBreak = true;
|
|
290497
290754
|
if (normalizedNumberingProperties && normalizedListRendering) {
|
|
290498
290755
|
const markerRunAttrs = computeRunAttrs(resolveRunProperties(converterContext, resolvedParagraphProperties.runProperties, resolvedParagraphProperties, converterContext.tableInfo, true, Boolean(paragraphProperties.numberingProperties)), converterContext);
|
|
290499
290756
|
let markerFontFallback;
|
|
@@ -296067,6 +296324,8 @@ menclose::after {
|
|
|
296067
296324
|
this.#emitModeChanged();
|
|
296068
296325
|
this.#emitEditingContext(editor);
|
|
296069
296326
|
this.#deps?.notifyInputBridgeTargetChanged();
|
|
296327
|
+
this.#deps?.setPendingDocChange();
|
|
296328
|
+
this.#deps?.scheduleRerender();
|
|
296070
296329
|
return editor;
|
|
296071
296330
|
} catch (error48) {
|
|
296072
296331
|
console.error("[HeaderFooterSessionManager] Unexpected error in enterMode:", error48);
|
|
@@ -296182,6 +296441,13 @@ menclose::after {
|
|
|
296182
296441
|
this.#updateModeBanner();
|
|
296183
296442
|
this.#syncActiveBorder();
|
|
296184
296443
|
}
|
|
296444
|
+
#isActiveDecoration(kind, headerFooterRefId, pageNumber) {
|
|
296445
|
+
if (this.#session.mode !== kind)
|
|
296446
|
+
return false;
|
|
296447
|
+
if (headerFooterRefId && this.#session.headerFooterRefId)
|
|
296448
|
+
return headerFooterRefId === this.#session.headerFooterRefId;
|
|
296449
|
+
return this.#session.pageNumber === pageNumber;
|
|
296450
|
+
}
|
|
296185
296451
|
#emitEditingContext(editor) {
|
|
296186
296452
|
this.#callbacks.onEditingContext?.({
|
|
296187
296453
|
kind: this.#session.mode,
|
|
@@ -296869,9 +297135,12 @@ menclose::after {
|
|
|
296869
297135
|
const rawLayoutHeight$1 = rIdLayout.layout.height ?? 0;
|
|
296870
297136
|
const metrics$1 = this.#computeMetrics(kind, rawLayoutHeight$1, box$1, pageHeight$1, margins$1?.footer ?? 0);
|
|
296871
297137
|
const layoutMinY$1 = rIdLayout.layout.minY ?? 0;
|
|
297138
|
+
const normalizedFragments$1 = normalizeDecorationFragments(fragments$1, layoutMinY$1);
|
|
297139
|
+
const normalizedItems$1 = normalizeDecorationItems(alignedItems, layoutMinY$1);
|
|
297140
|
+
const isActiveHeaderFooter$1 = this.#isActiveDecoration(kind, sectionRId, pageNumber);
|
|
296872
297141
|
return {
|
|
296873
|
-
fragments:
|
|
296874
|
-
items:
|
|
297142
|
+
fragments: normalizedFragments$1,
|
|
297143
|
+
items: normalizedItems$1,
|
|
296875
297144
|
height: metrics$1.containerHeight,
|
|
296876
297145
|
contentHeight: metrics$1.layoutHeight > 0 ? metrics$1.layoutHeight : metrics$1.containerHeight,
|
|
296877
297146
|
offset: metrics$1.offset,
|
|
@@ -296879,6 +297148,7 @@ menclose::after {
|
|
|
296879
297148
|
contentWidth: effectiveWidth,
|
|
296880
297149
|
headerFooterRefId: sectionRId,
|
|
296881
297150
|
sectionType: headerFooterType,
|
|
297151
|
+
isActiveHeaderFooter: isActiveHeaderFooter$1,
|
|
296882
297152
|
minY: layoutMinY$1,
|
|
296883
297153
|
box: {
|
|
296884
297154
|
x: box$1.x,
|
|
@@ -296919,9 +297189,12 @@ menclose::after {
|
|
|
296919
297189
|
const rawLayoutHeight = variant.layout.height ?? 0;
|
|
296920
297190
|
const metrics = this.#computeMetrics(kind, rawLayoutHeight, box, pageHeight, margins?.footer ?? 0);
|
|
296921
297191
|
const layoutMinY = variant.layout.minY ?? 0;
|
|
297192
|
+
const normalizedFragments = normalizeDecorationFragments(fragments, layoutMinY);
|
|
297193
|
+
const normalizedItems = normalizeDecorationItems(alignedVariantItems, layoutMinY);
|
|
297194
|
+
const isActiveHeaderFooter = this.#isActiveDecoration(kind, finalHeaderId, pageNumber);
|
|
296922
297195
|
return {
|
|
296923
|
-
fragments:
|
|
296924
|
-
items:
|
|
297196
|
+
fragments: normalizedFragments,
|
|
297197
|
+
items: normalizedItems,
|
|
296925
297198
|
height: metrics.containerHeight,
|
|
296926
297199
|
contentHeight: metrics.layoutHeight > 0 ? metrics.layoutHeight : metrics.containerHeight,
|
|
296927
297200
|
offset: metrics.offset,
|
|
@@ -296929,6 +297202,7 @@ menclose::after {
|
|
|
296929
297202
|
contentWidth: box.width,
|
|
296930
297203
|
headerFooterRefId: finalHeaderId,
|
|
296931
297204
|
sectionType: headerFooterType,
|
|
297205
|
+
isActiveHeaderFooter,
|
|
296932
297206
|
minY: layoutMinY,
|
|
296933
297207
|
box: {
|
|
296934
297208
|
x: box.x,
|
|
@@ -297219,13 +297493,13 @@ menclose::after {
|
|
|
297219
297493
|
return;
|
|
297220
297494
|
console.log(...args$1);
|
|
297221
297495
|
}, 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;
|
|
297222
|
-
var
|
|
297496
|
+
var init_src_CY28yu_i_es = __esm(() => {
|
|
297223
297497
|
init_rolldown_runtime_Bg48TavK_es();
|
|
297224
|
-
|
|
297498
|
+
init_SuperConverter_k7GHkV_c_es();
|
|
297225
297499
|
init_jszip_C49i9kUs_es();
|
|
297226
297500
|
init_xml_js_CqGKpaft_es();
|
|
297227
297501
|
init_uuid_qzgm05fK_es();
|
|
297228
|
-
|
|
297502
|
+
init_create_headless_toolbar_dycevpY9_es();
|
|
297229
297503
|
init_constants_DrU4EASo_es();
|
|
297230
297504
|
init_dist_B8HfvhaK_es();
|
|
297231
297505
|
init_unified_Dsuw2be5_es();
|
|
@@ -298447,6 +298721,8 @@ ${err.toString()}`);
|
|
|
298447
298721
|
"word/_rels/document.xml.rels",
|
|
298448
298722
|
"[Content_Types].xml"
|
|
298449
298723
|
]);
|
|
298724
|
+
SCHEMA_ATOM_NODE_NAMES = new Set(["crossReference", "citation"]);
|
|
298725
|
+
NORMALIZE_YJS_FRAGMENT_ORIGIN = Symbol.for("superdoc/yjs-fragment-normalize");
|
|
298450
298726
|
new PluginKey("collaboration");
|
|
298451
298727
|
headlessBindingStateByEditor = /* @__PURE__ */ new WeakMap;
|
|
298452
298728
|
headlessCleanupRegisteredEditors = /* @__PURE__ */ new WeakSet;
|
|
@@ -298474,6 +298750,7 @@ ${err.toString()}`);
|
|
|
298474
298750
|
const syncListenerCleanup = initSyncListener(this.options.ydoc, this.editor, this);
|
|
298475
298751
|
const [syncPlugin, fragment] = createSyncPlugin(this.options.ydoc, this.editor);
|
|
298476
298752
|
this.options.fragment = fragment;
|
|
298753
|
+
const fragmentNormalizeCleanup = registerYjsFragmentNormalizer(fragment);
|
|
298477
298754
|
const mediaMap = this.options.ydoc.getMap("media");
|
|
298478
298755
|
const mediaMapObserver = (event) => {
|
|
298479
298756
|
event.changes.keys.forEach((_$1, key2) => {
|
|
@@ -298488,6 +298765,7 @@ ${err.toString()}`);
|
|
|
298488
298765
|
syncListenerCleanup,
|
|
298489
298766
|
mediaMap,
|
|
298490
298767
|
mediaMapObserver,
|
|
298768
|
+
fragmentNormalizeCleanup,
|
|
298491
298769
|
metaMap: null,
|
|
298492
298770
|
metaMapObserver: null,
|
|
298493
298771
|
partSyncHandle: null,
|
|
@@ -300106,8 +300384,14 @@ ${err.toString()}`);
|
|
|
300106
300384
|
},
|
|
300107
300385
|
addAttributes() {
|
|
300108
300386
|
return {
|
|
300109
|
-
paraId: {
|
|
300110
|
-
|
|
300387
|
+
paraId: {
|
|
300388
|
+
rendered: false,
|
|
300389
|
+
keepOnSplit: false
|
|
300390
|
+
},
|
|
300391
|
+
textId: {
|
|
300392
|
+
rendered: false,
|
|
300393
|
+
keepOnSplit: false
|
|
300394
|
+
},
|
|
300111
300395
|
rsidR: { rendered: false },
|
|
300112
300396
|
rsidRDefault: { rendered: false },
|
|
300113
300397
|
rsidP: { rendered: false },
|
|
@@ -303089,8 +303373,16 @@ ${err.toString()}`);
|
|
|
303089
303373
|
},
|
|
303090
303374
|
isAnchor: { rendered: false },
|
|
303091
303375
|
vmlWatermark: { rendered: false },
|
|
303376
|
+
vmlTextWatermark: { rendered: false },
|
|
303377
|
+
textWatermarkData: { rendered: false },
|
|
303378
|
+
vmlStyle: { rendered: false },
|
|
303092
303379
|
vmlAttributes: { rendered: false },
|
|
303093
303380
|
vmlImagedata: { rendered: false },
|
|
303381
|
+
vmlTextpathAttributes: { rendered: false },
|
|
303382
|
+
vmlPathAttributes: { rendered: false },
|
|
303383
|
+
vmlFillAttributes: { rendered: false },
|
|
303384
|
+
vmlStrokeAttributes: { rendered: false },
|
|
303385
|
+
vmlWrapAttributes: { rendered: false },
|
|
303094
303386
|
transformData: {
|
|
303095
303387
|
default: {},
|
|
303096
303388
|
renderDOM: ({ transformData }) => {
|
|
@@ -321256,6 +321548,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
321256
321548
|
}
|
|
321257
321549
|
#telemetry = null;
|
|
321258
321550
|
#documentOpenTracked = false;
|
|
321551
|
+
#constructorFragment = null;
|
|
321259
321552
|
constructor(options) {
|
|
321260
321553
|
super();
|
|
321261
321554
|
this.extensionStorage = {};
|
|
@@ -321361,6 +321654,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
321361
321654
|
resolvedOptions.element = null;
|
|
321362
321655
|
resolvedOptions.selector = null;
|
|
321363
321656
|
}
|
|
321657
|
+
this.#constructorFragment = resolvedOptions.fragment ?? null;
|
|
321364
321658
|
this.#checkHeadless(resolvedOptions);
|
|
321365
321659
|
this.setOptions(resolvedOptions);
|
|
321366
321660
|
this.#renderer = resolvedOptions.renderer ?? (domAvailable ? new ProseMirrorRenderer : null);
|
|
@@ -321482,6 +321776,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
321482
321776
|
try {
|
|
321483
321777
|
const resolvedMode = options?.mode ?? this.options.mode ?? "docx";
|
|
321484
321778
|
const explicitIsNewFile = options?.isNewFile;
|
|
321779
|
+
const hasOpenFragment = Object.prototype.hasOwnProperty.call(options ?? {}, "fragment");
|
|
321485
321780
|
const resolvedOptions = {
|
|
321486
321781
|
...this.options,
|
|
321487
321782
|
mode: resolvedMode,
|
|
@@ -321490,7 +321785,8 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
321490
321785
|
documentMode: options?.documentMode ?? this.options.documentMode ?? "editing",
|
|
321491
321786
|
html: options?.html,
|
|
321492
321787
|
markdown: options?.markdown,
|
|
321493
|
-
jsonOverride: options?.json ?? null
|
|
321788
|
+
jsonOverride: options?.json ?? null,
|
|
321789
|
+
fragment: hasOpenFragment ? options?.fragment ?? null : this.options.fragment ?? this.#constructorFragment
|
|
321494
321790
|
};
|
|
321495
321791
|
const loadOptions = options?.password ? { password: options.password } : undefined;
|
|
321496
321792
|
if (typeof source === "string")
|
|
@@ -321624,6 +321920,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
321624
321920
|
this.options.initialState = null;
|
|
321625
321921
|
this.options.content = "";
|
|
321626
321922
|
this.options.fileSource = null;
|
|
321923
|
+
this.options.fragment = null;
|
|
321627
321924
|
this._state = undefined;
|
|
321628
321925
|
}
|
|
321629
321926
|
#initProtectionState() {
|
|
@@ -322328,8 +322625,10 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
322328
322625
|
});
|
|
322329
322626
|
else if (this.options.jsonOverride)
|
|
322330
322627
|
doc$12 = this.schema.nodeFromJSON(this.options.jsonOverride);
|
|
322331
|
-
if (fragment)
|
|
322628
|
+
if (fragment) {
|
|
322629
|
+
normalizeYjsFragmentForSchema(fragment);
|
|
322332
322630
|
doc$12 = yXmlFragmentToProseMirrorRootNode(fragment, this.schema);
|
|
322631
|
+
}
|
|
322333
322632
|
}
|
|
322334
322633
|
else if (mode === "text" || mode === "html")
|
|
322335
322634
|
if (loadFromSchema && hasJsonContent(content3))
|
|
@@ -322895,12 +323194,13 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
322895
323194
|
isHeadless: !(config3?.element != null || config3?.selector != null),
|
|
322896
323195
|
...config3
|
|
322897
323196
|
};
|
|
322898
|
-
const { html: html3, markdown, json: json2, isCommentsEnabled, suppressDefaultDocxStyles, documentMode, content: content3, mediaFiles, fonts, isNewFile, password, ...editorConfig } = resolvedConfig;
|
|
323197
|
+
const { html: html3, markdown, json: json2, fragment, isCommentsEnabled, suppressDefaultDocxStyles, documentMode, content: content3, mediaFiles, fonts, isNewFile, password, ...editorConfig } = resolvedConfig;
|
|
322899
323198
|
const openOptions = {
|
|
322900
323199
|
mode: resolvedConfig.mode,
|
|
322901
323200
|
html: html3,
|
|
322902
323201
|
markdown,
|
|
322903
323202
|
json: json2,
|
|
323203
|
+
fragment,
|
|
322904
323204
|
isCommentsEnabled,
|
|
322905
323205
|
suppressDefaultDocxStyles,
|
|
322906
323206
|
documentMode,
|
|
@@ -324608,6 +324908,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
324608
324908
|
behindDocFragments.forEach(({ fragment, originalIndex }) => {
|
|
324609
324909
|
const resolvedItem = data.items?.[originalIndex];
|
|
324610
324910
|
const fragEl = this.renderFragment(fragment, context, undefined, betweenBorderFlags.get(originalIndex), resolvedItem);
|
|
324911
|
+
this.applyHeaderFooterTextWatermarkPreviewOpacity(fragEl, data.isActiveHeaderFooter === true);
|
|
324611
324912
|
const isPageRelative = this.isPageRelativeAnchoredFragment(fragment, resolvedItem);
|
|
324612
324913
|
let pageY;
|
|
324613
324914
|
if (isPageRelative && kind === "footer")
|
|
@@ -324625,6 +324926,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
324625
324926
|
normalFragments.forEach(({ fragment, originalIndex }) => {
|
|
324626
324927
|
const resolvedItem = data.items?.[originalIndex];
|
|
324627
324928
|
const fragEl = this.renderFragment(fragment, context, undefined, betweenBorderFlags.get(originalIndex), resolvedItem);
|
|
324929
|
+
this.applyHeaderFooterTextWatermarkPreviewOpacity(fragEl, data.isActiveHeaderFooter === true);
|
|
324628
324930
|
const isPageRelative = this.isPageRelativeAnchoredFragment(fragment, resolvedItem);
|
|
324629
324931
|
if (isPageRelative && kind === "footer")
|
|
324630
324932
|
fragEl.style.top = `${fragment.y + footerAnchorContainerOffsetY}px`;
|
|
@@ -325379,6 +325681,8 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
325379
325681
|
}
|
|
325380
325682
|
this.applySdtDataset(fragmentEl, block.attrs?.sdt);
|
|
325381
325683
|
this.applyContainerSdtDataset(fragmentEl, block.attrs?.containerSdt);
|
|
325684
|
+
if (this.isVmlTextWatermarkImage(block))
|
|
325685
|
+
fragmentEl.dataset.vmlTextWatermark = "true";
|
|
325382
325686
|
if (block.id)
|
|
325383
325687
|
fragmentEl.setAttribute("data-sd-block-id", block.id);
|
|
325384
325688
|
const imgPmStart = resolvedItem?.pmStart;
|
|
@@ -327466,7 +327770,11 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
327466
327770
|
shouldRenderBehindPageContent(fragment, section, resolvedItem) {
|
|
327467
327771
|
if (fragment.behindDoc === true || fragment.behindDoc == null && "zIndex" in fragment && fragment.zIndex === 0)
|
|
327468
327772
|
return true;
|
|
327469
|
-
|
|
327773
|
+
if (section !== "header")
|
|
327774
|
+
return false;
|
|
327775
|
+
if (fragment.kind === "drawing")
|
|
327776
|
+
return this.isHeaderWordArtWatermark(resolvedItem?.block);
|
|
327777
|
+
return this.isVmlTextWatermarkImage(resolvedItem?.block);
|
|
327470
327778
|
}
|
|
327471
327779
|
isHeaderWordArtWatermark(block) {
|
|
327472
327780
|
if (!block || block.kind !== "drawing" || block.drawingKind !== "vectorShape")
|
|
@@ -327475,6 +327783,14 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
327475
327783
|
const hasTextContent = Array.isArray(block.textContent?.parts) && block.textContent.parts.length > 0;
|
|
327476
327784
|
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";
|
|
327477
327785
|
}
|
|
327786
|
+
isVmlTextWatermarkImage(block) {
|
|
327787
|
+
return block?.kind === "image" && block.attrs?.vmlTextWatermark === true;
|
|
327788
|
+
}
|
|
327789
|
+
applyHeaderFooterTextWatermarkPreviewOpacity(el, isActiveHeaderFooter) {
|
|
327790
|
+
if (el.dataset.vmlTextWatermark !== "true")
|
|
327791
|
+
return;
|
|
327792
|
+
el.style.opacity = isActiveHeaderFooter ? ACTIVE_HEADER_FOOTER_WATERMARK_PREVIEW_OPACITY : INACTIVE_HEADER_FOOTER_WATERMARK_PREVIEW_OPACITY;
|
|
327793
|
+
}
|
|
327478
327794
|
resolveFragmentWrapperZIndex(fragment, resolvedZIndex) {
|
|
327479
327795
|
if (!this.isAnchoredMediaFragment(fragment))
|
|
327480
327796
|
return "";
|
|
@@ -334998,11 +335314,11 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
334998
335314
|
];
|
|
334999
335315
|
});
|
|
335000
335316
|
|
|
335001
|
-
// ../../packages/superdoc/dist/chunks/create-super-doc-ui-
|
|
335317
|
+
// ../../packages/superdoc/dist/chunks/create-super-doc-ui-BLDU9pTd.es.js
|
|
335002
335318
|
var MOD_ALIASES, ALT_ALIASES, CTRL_ALIASES, SHIFT_ALIASES, BUILTIN_CONTEXT_MENU_GROUPS, BUILTIN_GROUP_ORDER, RESERVED_PROXY_PROPERTY_NAMES, ALL_TOOLBAR_COMMAND_IDS, EMPTY_ACTIVE_IDS;
|
|
335003
|
-
var
|
|
335004
|
-
|
|
335005
|
-
|
|
335319
|
+
var init_create_super_doc_ui_BLDU9pTd_es = __esm(() => {
|
|
335320
|
+
init_SuperConverter_k7GHkV_c_es();
|
|
335321
|
+
init_create_headless_toolbar_dycevpY9_es();
|
|
335006
335322
|
MOD_ALIASES = new Set([
|
|
335007
335323
|
"Mod",
|
|
335008
335324
|
"Meta",
|
|
@@ -335044,16 +335360,16 @@ var init_zipper_yaJVJ4z9_es = __esm(() => {
|
|
|
335044
335360
|
|
|
335045
335361
|
// ../../packages/superdoc/dist/super-editor.es.js
|
|
335046
335362
|
var init_super_editor_es = __esm(() => {
|
|
335047
|
-
|
|
335048
|
-
|
|
335363
|
+
init_src_CY28yu_i_es();
|
|
335364
|
+
init_SuperConverter_k7GHkV_c_es();
|
|
335049
335365
|
init_jszip_C49i9kUs_es();
|
|
335050
335366
|
init_xml_js_CqGKpaft_es();
|
|
335051
|
-
|
|
335367
|
+
init_create_headless_toolbar_dycevpY9_es();
|
|
335052
335368
|
init_constants_DrU4EASo_es();
|
|
335053
335369
|
init_dist_B8HfvhaK_es();
|
|
335054
335370
|
init_unified_Dsuw2be5_es();
|
|
335055
335371
|
init_DocxZipper_CZMPWpOp_es();
|
|
335056
|
-
|
|
335372
|
+
init_create_super_doc_ui_BLDU9pTd_es();
|
|
335057
335373
|
init_ui_C5PAS9hY_es();
|
|
335058
335374
|
init_eventemitter3_BnGqBE_Q_es();
|
|
335059
335375
|
init_errors_CNaD6vcg_es();
|
|
@@ -376301,6 +376617,12 @@ function resolveRunProperties2(params3, inlineRpr, resolvedPpr, tableInfo = null
|
|
|
376301
376617
|
if (inlineRpr?.underline) {
|
|
376302
376618
|
delete inlineRpr.underline;
|
|
376303
376619
|
}
|
|
376620
|
+
if (inlineRpr?.vanish) {
|
|
376621
|
+
delete inlineRpr.vanish;
|
|
376622
|
+
}
|
|
376623
|
+
if (inlineRpr?.specVanish) {
|
|
376624
|
+
delete inlineRpr.specVanish;
|
|
376625
|
+
}
|
|
376304
376626
|
styleChain = [
|
|
376305
376627
|
...defaultsChain,
|
|
376306
376628
|
tableStyleProps,
|
|
@@ -393655,6 +393977,28 @@ function chainableEditorState2(transaction, state) {
|
|
|
393655
393977
|
}
|
|
393656
393978
|
};
|
|
393657
393979
|
}
|
|
393980
|
+
|
|
393981
|
+
// ../../packages/super-editor/src/editors/v1/core/helpers/getNodeType.js
|
|
393982
|
+
function getNodeType2(nameOrType, schema) {
|
|
393983
|
+
if (typeof nameOrType === "string") {
|
|
393984
|
+
if (!schema.nodes[nameOrType]) {
|
|
393985
|
+
throw Error(`There is no node type named '${nameOrType}' in schema.`);
|
|
393986
|
+
}
|
|
393987
|
+
return schema.nodes[nameOrType];
|
|
393988
|
+
}
|
|
393989
|
+
return nameOrType;
|
|
393990
|
+
}
|
|
393991
|
+
|
|
393992
|
+
// ../../packages/super-editor/src/editors/v1/core/helpers/getMarkType.js
|
|
393993
|
+
function getMarkType2(nameOrType, schema) {
|
|
393994
|
+
if (typeof nameOrType === "string") {
|
|
393995
|
+
if (!schema.marks[nameOrType]) {
|
|
393996
|
+
throw Error(`There is no mark type named '${nameOrType}' in schema.`);
|
|
393997
|
+
}
|
|
393998
|
+
return schema.marks[nameOrType];
|
|
393999
|
+
}
|
|
394000
|
+
return nameOrType;
|
|
394001
|
+
}
|
|
393658
394002
|
// ../../packages/super-editor/src/editors/v1/core/helpers/findParentNodeClosestToPos.js
|
|
393659
394003
|
var findParentNodeClosestToPos2 = ($pos, predicate) => {
|
|
393660
394004
|
for (let i4 = $pos.depth;i4 > 0; i4--) {
|
|
@@ -393713,6 +394057,16 @@ var init_isMarkActive = __esm(() => {
|
|
|
393713
394057
|
var init_getMarksBetween = __esm(() => {
|
|
393714
394058
|
init_getMarkRange();
|
|
393715
394059
|
});
|
|
394060
|
+
|
|
394061
|
+
// ../../packages/super-editor/src/editors/v1/core/helpers/getSchemaTypeNameByName.js
|
|
394062
|
+
function getSchemaTypeNameByName2(name, schema) {
|
|
394063
|
+
if (schema.nodes[name])
|
|
394064
|
+
return "node";
|
|
394065
|
+
if (schema.marks[name])
|
|
394066
|
+
return "mark";
|
|
394067
|
+
return null;
|
|
394068
|
+
}
|
|
394069
|
+
|
|
393716
394070
|
// ../../packages/super-editor/src/editors/v1/core/helpers/isNodeActive.js
|
|
393717
394071
|
var init_isNodeActive = __esm(() => {
|
|
393718
394072
|
init_objectIncludes();
|
|
@@ -418716,6 +419070,21 @@ var init_section_properties = __esm(() => {
|
|
|
418716
419070
|
init_helpers();
|
|
418717
419071
|
});
|
|
418718
419072
|
|
|
419073
|
+
// ../../packages/super-editor/src/editors/v1/core/helpers/base64.js
|
|
419074
|
+
function binaryStringToBase642(binary) {
|
|
419075
|
+
if (typeof globalThis.btoa === "function") {
|
|
419076
|
+
return globalThis.btoa(binary);
|
|
419077
|
+
}
|
|
419078
|
+
if (typeof Buffer !== "undefined") {
|
|
419079
|
+
return Buffer.from(binary, "latin1").toString("base64");
|
|
419080
|
+
}
|
|
419081
|
+
throw new Error("[base64] encode requires btoa (browser) or Buffer (Node)");
|
|
419082
|
+
}
|
|
419083
|
+
function encodeUtf8Base642(input2) {
|
|
419084
|
+
const binary = encodeURIComponent(input2).replace(/%([0-9A-F]{2})/g, (_3, hex3) => String.fromCharCode(parseInt(hex3, 16)));
|
|
419085
|
+
return binaryStringToBase642(binary);
|
|
419086
|
+
}
|
|
419087
|
+
|
|
418719
419088
|
// ../../packages/super-editor/src/editors/v1/core/helpers/superdocClipboardSlice.js
|
|
418720
419089
|
var init_superdocClipboardSlice = __esm(() => {
|
|
418721
419090
|
init_section_properties();
|
|
@@ -421594,8 +421963,34 @@ var buildInstructionElements2 = (instruction, instructionTokens) => {
|
|
|
421594
421963
|
];
|
|
421595
421964
|
};
|
|
421596
421965
|
|
|
421966
|
+
// ../../packages/super-editor/src/editors/v1/core/super-converter/v3/handlers/sd/shared/build-field-result-runs.js
|
|
421967
|
+
function buildFieldResultRuns2(params3, outputMarks) {
|
|
421968
|
+
const { node: node4 } = params3;
|
|
421969
|
+
const contentNodes = (node4.content ?? []).flatMap((child) => exportSchemaToJson2({ ...params3, node: child }));
|
|
421970
|
+
if (contentNodes.length > 0)
|
|
421971
|
+
return contentNodes;
|
|
421972
|
+
const resolvedText = node4.attrs?.resolvedText;
|
|
421973
|
+
if (typeof resolvedText !== "string" || resolvedText.length === 0)
|
|
421974
|
+
return [];
|
|
421975
|
+
const textAttributes = /^\s|\s$/.test(resolvedText) ? { "xml:space": "preserve" } : undefined;
|
|
421976
|
+
return [
|
|
421977
|
+
{
|
|
421978
|
+
name: "w:r",
|
|
421979
|
+
elements: [
|
|
421980
|
+
{ name: "w:rPr", elements: outputMarks },
|
|
421981
|
+
{ name: "w:t", attributes: textAttributes, elements: [{ text: resolvedText, type: "text" }] }
|
|
421982
|
+
]
|
|
421983
|
+
}
|
|
421984
|
+
];
|
|
421985
|
+
}
|
|
421986
|
+
var init_build_field_result_runs = __esm(() => {
|
|
421987
|
+
init_exporter();
|
|
421988
|
+
});
|
|
421989
|
+
|
|
421597
421990
|
// ../../packages/super-editor/src/editors/v1/core/super-converter/v3/handlers/sd/shared/index.js
|
|
421598
|
-
var init_shared = () => {
|
|
421991
|
+
var init_shared = __esm(() => {
|
|
421992
|
+
init_build_field_result_runs();
|
|
421993
|
+
});
|
|
421599
421994
|
|
|
421600
421995
|
// ../../packages/super-editor/src/editors/v1/core/super-converter/v3/handlers/sd/crossReference/crossReference-translator.js
|
|
421601
421996
|
function parseTarget3(instruction) {
|
|
@@ -421660,7 +422055,7 @@ var XML_NODE_NAME27 = "sd:crossReference", SD_NODE_NAME21 = "crossReference", en
|
|
|
421660
422055
|
}, decode68 = (params3) => {
|
|
421661
422056
|
const { node: node4 } = params3;
|
|
421662
422057
|
const outputMarks = processOutputMarks2(node4.attrs?.marksAsAttrs || []);
|
|
421663
|
-
const contentNodes = (
|
|
422058
|
+
const contentNodes = buildFieldResultRuns2(params3, outputMarks);
|
|
421664
422059
|
const instructionElements = buildInstructionElements2(node4.attrs?.instruction, node4.attrs?.instructionTokens);
|
|
421665
422060
|
return [
|
|
421666
422061
|
{
|
|
@@ -421723,7 +422118,20 @@ function parseCitationSourceIds2(instruction) {
|
|
|
421723
422118
|
function extractResolvedText3(content4) {
|
|
421724
422119
|
if (!Array.isArray(content4))
|
|
421725
422120
|
return "";
|
|
421726
|
-
|
|
422121
|
+
let out = "";
|
|
422122
|
+
const walk = (nodes) => {
|
|
422123
|
+
for (const node4 of nodes) {
|
|
422124
|
+
if (!node4)
|
|
422125
|
+
continue;
|
|
422126
|
+
if (node4.type === "text") {
|
|
422127
|
+
out += node4.text || "";
|
|
422128
|
+
} else if (Array.isArray(node4.content)) {
|
|
422129
|
+
walk(node4.content);
|
|
422130
|
+
}
|
|
422131
|
+
}
|
|
422132
|
+
};
|
|
422133
|
+
walk(content4);
|
|
422134
|
+
return out;
|
|
421727
422135
|
}
|
|
421728
422136
|
var XML_NODE_NAME28 = "sd:citation", SD_NODE_NAME22 = "citation", encode65 = (params3) => {
|
|
421729
422137
|
const { nodes = [], nodeListHandler } = params3 || {};
|
|
@@ -421748,7 +422156,7 @@ var XML_NODE_NAME28 = "sd:citation", SD_NODE_NAME22 = "citation", encode65 = (pa
|
|
|
421748
422156
|
}, decode69 = (params3) => {
|
|
421749
422157
|
const { node: node4 } = params3;
|
|
421750
422158
|
const outputMarks = processOutputMarks2(node4.attrs?.marksAsAttrs || []);
|
|
421751
|
-
const contentNodes = (
|
|
422159
|
+
const contentNodes = buildFieldResultRuns2(params3, outputMarks);
|
|
421752
422160
|
const instructionElements = buildInstructionElements2(node4.attrs?.instruction, node4.attrs?.instructionTokens);
|
|
421753
422161
|
return [
|
|
421754
422162
|
{
|
|
@@ -427178,8 +427586,12 @@ function handleShapeTextWatermarkImport2({ pict }) {
|
|
|
427178
427586
|
marginTop: styleObj["margin-top"] || "0"
|
|
427179
427587
|
};
|
|
427180
427588
|
const rotation = parseFloat(styleObj.rotation) || 0;
|
|
427181
|
-
const
|
|
427182
|
-
const
|
|
427589
|
+
const explicitHPosition = styleObj["mso-position-horizontal"];
|
|
427590
|
+
const explicitVPosition = styleObj["mso-position-vertical"];
|
|
427591
|
+
const hasExplicitMarginLeft = styleObj["margin-left"] != null;
|
|
427592
|
+
const hasExplicitMarginTop = styleObj["margin-top"] != null;
|
|
427593
|
+
const hPosition = explicitHPosition || (hasExplicitMarginLeft ? undefined : DEFAULT_VML_TEXT_WATERMARK_ALIGNMENT2);
|
|
427594
|
+
const vPosition = explicitVPosition || (hasExplicitMarginTop ? undefined : DEFAULT_VML_TEXT_WATERMARK_ALIGNMENT2);
|
|
427183
427595
|
const hRelativeTo = styleObj["mso-position-horizontal-relative"] || "margin";
|
|
427184
427596
|
const vRelativeTo = styleObj["mso-position-vertical-relative"] || "margin";
|
|
427185
427597
|
const textAnchor = styleObj["v-text-anchor"] || "middle";
|
|
@@ -427189,7 +427601,7 @@ function handleShapeTextWatermarkImport2({ pict }) {
|
|
|
427189
427601
|
const rawFillColor2 = fillAttrs.color2 || "#3f3f3f";
|
|
427190
427602
|
const fillColor = sanitizeColor2(rawFillColor, "silver");
|
|
427191
427603
|
const fillColor2 = sanitizeColor2(rawFillColor2, "#3f3f3f");
|
|
427192
|
-
const opacity = fillAttrs.opacity
|
|
427604
|
+
const opacity = fillAttrs.opacity ?? String(DEFAULT_VML_TEXT_WATERMARK_OPACITY2);
|
|
427193
427605
|
const fillType = fillAttrs.type || "solid";
|
|
427194
427606
|
const stroke = shape.elements?.find((el) => el.name === "v:stroke");
|
|
427195
427607
|
const strokeAttrs = stroke?.attributes || {};
|
|
@@ -427199,10 +427611,11 @@ function handleShapeTextWatermarkImport2({ pict }) {
|
|
|
427199
427611
|
const strokeEndcap = strokeAttrs.endcap || "flat";
|
|
427200
427612
|
const textpathStyle = textpathAttrs.style || "";
|
|
427201
427613
|
const textStyleObj = parseVmlStyle3(textpathStyle);
|
|
427202
|
-
const rawFontFamily = textStyleObj["font-family"]
|
|
427614
|
+
const rawFontFamily = decodeXmlEntities2(textStyleObj["font-family"] || "").replace(/['"]/g, "");
|
|
427203
427615
|
const fontFamily = sanitizeFontFamily3(rawFontFamily);
|
|
427204
427616
|
const fontSize = textStyleObj["font-size"] || "1pt";
|
|
427205
427617
|
const fitshape = textpathAttrs.fitshape || "t";
|
|
427618
|
+
const shouldFitShape = fitshape === "t";
|
|
427206
427619
|
const trim = textpathAttrs.trim || "t";
|
|
427207
427620
|
const textpathOn = textpathAttrs.on || "t";
|
|
427208
427621
|
const path3 = shape.elements?.find((el) => el.name === "v:path");
|
|
@@ -427213,7 +427626,7 @@ function handleShapeTextWatermarkImport2({ pict }) {
|
|
|
427213
427626
|
const wrapType = wrapAttrs.type || "none";
|
|
427214
427627
|
const widthPx = convertToPixels3(width);
|
|
427215
427628
|
const heightPx = convertToPixels3(height);
|
|
427216
|
-
const sanitizedOpacity = sanitizeNumeric2(
|
|
427629
|
+
const sanitizedOpacity = sanitizeNumeric2(parseVmlOpacity2(opacity), DEFAULT_VML_TEXT_WATERMARK_OPACITY2, 0, 1);
|
|
427217
427630
|
const sanitizedRotation = sanitizeNumeric2(rotation, 0, -360, 360);
|
|
427218
427631
|
const svgResult = generateTextWatermarkSVG2({
|
|
427219
427632
|
text: watermarkText,
|
|
@@ -427227,9 +427640,40 @@ function handleShapeTextWatermarkImport2({ pict }) {
|
|
|
427227
427640
|
textStyle: {
|
|
427228
427641
|
fontFamily,
|
|
427229
427642
|
fontSize
|
|
427230
|
-
}
|
|
427643
|
+
},
|
|
427644
|
+
fitShape: shouldFitShape
|
|
427231
427645
|
});
|
|
427232
427646
|
const svgDataUri = svgResult.dataUri;
|
|
427647
|
+
const centerOffsetTop = getTextWatermarkCenterOffset2({
|
|
427648
|
+
hPosition,
|
|
427649
|
+
vPosition,
|
|
427650
|
+
hRelativeTo,
|
|
427651
|
+
vRelativeTo,
|
|
427652
|
+
height: heightPx,
|
|
427653
|
+
rotation: sanitizedRotation
|
|
427654
|
+
});
|
|
427655
|
+
const marginOffset = resolveTextWatermarkMarginOffset2({
|
|
427656
|
+
hPosition,
|
|
427657
|
+
vPosition,
|
|
427658
|
+
hRelativeTo,
|
|
427659
|
+
vRelativeTo,
|
|
427660
|
+
marginLeft: convertToPixels3(position5.marginLeft),
|
|
427661
|
+
marginTop: convertToPixels3(position5.marginTop),
|
|
427662
|
+
width: widthPx,
|
|
427663
|
+
height: heightPx,
|
|
427664
|
+
svgWidth: svgResult.svgWidth,
|
|
427665
|
+
svgHeight: svgResult.svgHeight,
|
|
427666
|
+
centerOffsetTop,
|
|
427667
|
+
rotation: sanitizedRotation
|
|
427668
|
+
});
|
|
427669
|
+
const anchorData = {
|
|
427670
|
+
hRelativeFrom: hRelativeTo,
|
|
427671
|
+
vRelativeFrom: vRelativeTo
|
|
427672
|
+
};
|
|
427673
|
+
if (hPosition)
|
|
427674
|
+
anchorData.alignH = hPosition;
|
|
427675
|
+
if (vPosition)
|
|
427676
|
+
anchorData.alignV = vPosition;
|
|
427233
427677
|
const imageWatermarkNode = {
|
|
427234
427678
|
type: "image",
|
|
427235
427679
|
attrs: {
|
|
@@ -427254,20 +427698,12 @@ function handleShapeTextWatermarkImport2({ pict }) {
|
|
|
427254
427698
|
behindDoc: true
|
|
427255
427699
|
}
|
|
427256
427700
|
},
|
|
427257
|
-
anchorData
|
|
427258
|
-
hRelativeFrom: hRelativeTo,
|
|
427259
|
-
vRelativeFrom: vRelativeTo,
|
|
427260
|
-
alignH: hPosition,
|
|
427261
|
-
alignV: vPosition
|
|
427262
|
-
},
|
|
427701
|
+
anchorData,
|
|
427263
427702
|
size: {
|
|
427264
427703
|
width: svgResult.svgWidth,
|
|
427265
427704
|
height: svgResult.svgHeight
|
|
427266
427705
|
},
|
|
427267
|
-
marginOffset
|
|
427268
|
-
horizontal: hPosition === "center" && hRelativeTo === "margin" ? 0 : convertToPixels3(position5.marginLeft),
|
|
427269
|
-
top: vPosition === "center" && vRelativeTo === "margin" ? 0 : convertToPixels3(position5.marginTop)
|
|
427270
|
-
},
|
|
427706
|
+
marginOffset,
|
|
427271
427707
|
textWatermarkData: {
|
|
427272
427708
|
text: watermarkText,
|
|
427273
427709
|
rotation: sanitizedRotation,
|
|
@@ -427290,7 +427726,7 @@ function handleShapeTextWatermarkImport2({ pict }) {
|
|
|
427290
427726
|
},
|
|
427291
427727
|
textpath: {
|
|
427292
427728
|
on: textpathOn === "t",
|
|
427293
|
-
fitshape:
|
|
427729
|
+
fitshape: shouldFitShape,
|
|
427294
427730
|
trim: trim === "t",
|
|
427295
427731
|
textpathok: textpathok === "t"
|
|
427296
427732
|
}
|
|
@@ -427303,7 +427739,7 @@ function sanitizeFontFamily3(fontFamily) {
|
|
|
427303
427739
|
if (!fontFamily || typeof fontFamily !== "string") {
|
|
427304
427740
|
return "Arial";
|
|
427305
427741
|
}
|
|
427306
|
-
const sanitized = fontFamily.replace(/[^a-zA-Z0-9\s
|
|
427742
|
+
const sanitized = fontFamily.replace(/[^a-zA-Z0-9\s,-]/g, "").trim();
|
|
427307
427743
|
return sanitized || "Arial";
|
|
427308
427744
|
}
|
|
427309
427745
|
function sanitizeColor2(color3, defaultColor = "silver") {
|
|
@@ -427313,6 +427749,30 @@ function sanitizeColor2(color3, defaultColor = "silver") {
|
|
|
427313
427749
|
const sanitized = color3.replace(/[^a-zA-Z0-9#%(),.]/g, "").trim();
|
|
427314
427750
|
return sanitized || defaultColor;
|
|
427315
427751
|
}
|
|
427752
|
+
function normalizeVmlColor2(color3) {
|
|
427753
|
+
const namedColors = {
|
|
427754
|
+
black: "#000000",
|
|
427755
|
+
blue: "#0000FF",
|
|
427756
|
+
gray: "#808080",
|
|
427757
|
+
green: "#008000",
|
|
427758
|
+
lime: "#00FF00",
|
|
427759
|
+
red: "#FF0000",
|
|
427760
|
+
silver: "#C0C0C0",
|
|
427761
|
+
white: "#FFFFFF",
|
|
427762
|
+
yellow: "#FFFF00"
|
|
427763
|
+
};
|
|
427764
|
+
const key2 = typeof color3 === "string" ? color3.trim().toLowerCase() : "";
|
|
427765
|
+
return namedColors[key2] || color3;
|
|
427766
|
+
}
|
|
427767
|
+
function decodeXmlEntities2(value) {
|
|
427768
|
+
return value.replace(/"/g, '"').replace(/'/g, "'").replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&").replace(/&#(\d+);/g, (_3, code10) => decodeCodePoint2(Number(code10))).replace(/&#x([0-9a-fA-F]+);/g, (_3, code10) => decodeCodePoint2(Number.parseInt(code10, 16)));
|
|
427769
|
+
}
|
|
427770
|
+
function decodeCodePoint2(codePoint) {
|
|
427771
|
+
if (!Number.isInteger(codePoint) || codePoint < 0 || codePoint > 1114111) {
|
|
427772
|
+
return "";
|
|
427773
|
+
}
|
|
427774
|
+
return String.fromCodePoint(codePoint);
|
|
427775
|
+
}
|
|
427316
427776
|
function sanitizeNumeric2(value, defaultValue, min3 = -Infinity, max3 = Infinity) {
|
|
427317
427777
|
const num = typeof value === "number" ? value : parseFloat(value);
|
|
427318
427778
|
if (isNaN(num) || !isFinite(num)) {
|
|
@@ -427320,8 +427780,70 @@ function sanitizeNumeric2(value, defaultValue, min3 = -Infinity, max3 = Infinity
|
|
|
427320
427780
|
}
|
|
427321
427781
|
return Math.max(min3, Math.min(max3, num));
|
|
427322
427782
|
}
|
|
427323
|
-
function
|
|
427324
|
-
|
|
427783
|
+
function parseVmlOpacity2(value) {
|
|
427784
|
+
if (typeof value === "number") {
|
|
427785
|
+
return value;
|
|
427786
|
+
}
|
|
427787
|
+
if (!value || typeof value !== "string") {
|
|
427788
|
+
return NaN;
|
|
427789
|
+
}
|
|
427790
|
+
const normalized = value.trim().toLowerCase();
|
|
427791
|
+
if (normalized.endsWith("%")) {
|
|
427792
|
+
return Number.parseFloat(normalized.slice(0, -1)) / 100;
|
|
427793
|
+
}
|
|
427794
|
+
if (normalized.endsWith("f")) {
|
|
427795
|
+
return Number.parseInt(normalized.slice(0, -1), 10) / 65536;
|
|
427796
|
+
}
|
|
427797
|
+
return Number.parseFloat(normalized);
|
|
427798
|
+
}
|
|
427799
|
+
function getTextWatermarkCenterOffset2({ hPosition, vPosition, hRelativeTo, vRelativeTo, height, rotation }) {
|
|
427800
|
+
const isCenteredMarginWatermark = hPosition === "center" && vPosition === "center" && hRelativeTo === "margin" && vRelativeTo === "margin";
|
|
427801
|
+
if (!isCenteredMarginWatermark || rotation === 0) {
|
|
427802
|
+
return 0;
|
|
427803
|
+
}
|
|
427804
|
+
return sanitizeNumeric2(height, 0, 0, MAX_ROTATED_CENTERED_WATERMARK_OFFSET_HEIGHT_PX2) * ROTATED_CENTERED_WATERMARK_TOP_OFFSET_RATIO2;
|
|
427805
|
+
}
|
|
427806
|
+
function resolveTextWatermarkMarginOffset2({
|
|
427807
|
+
hPosition,
|
|
427808
|
+
vPosition,
|
|
427809
|
+
hRelativeTo,
|
|
427810
|
+
vRelativeTo,
|
|
427811
|
+
marginLeft,
|
|
427812
|
+
marginTop,
|
|
427813
|
+
width,
|
|
427814
|
+
height,
|
|
427815
|
+
svgWidth,
|
|
427816
|
+
svgHeight,
|
|
427817
|
+
centerOffsetTop,
|
|
427818
|
+
rotation
|
|
427819
|
+
}) {
|
|
427820
|
+
const isCenteredHorizontally = hPosition === "center" && hRelativeTo === "margin";
|
|
427821
|
+
const isCenteredVertically = vPosition === "center" && vRelativeTo === "margin";
|
|
427822
|
+
return {
|
|
427823
|
+
horizontal: isCenteredHorizontally ? 0 : getAbsoluteShapeOffset2({
|
|
427824
|
+
position: hPosition,
|
|
427825
|
+
margin: marginLeft,
|
|
427826
|
+
shapeSize: width,
|
|
427827
|
+
svgSize: svgWidth,
|
|
427828
|
+
rotation
|
|
427829
|
+
}),
|
|
427830
|
+
top: isCenteredVertically ? centerOffsetTop : getAbsoluteShapeOffset2({
|
|
427831
|
+
position: vPosition,
|
|
427832
|
+
margin: marginTop,
|
|
427833
|
+
shapeSize: height,
|
|
427834
|
+
svgSize: svgHeight,
|
|
427835
|
+
rotation
|
|
427836
|
+
})
|
|
427837
|
+
};
|
|
427838
|
+
}
|
|
427839
|
+
function getAbsoluteShapeOffset2({ position: position5, margin, shapeSize, svgSize, rotation }) {
|
|
427840
|
+
if (position5 || rotation === 0) {
|
|
427841
|
+
return margin;
|
|
427842
|
+
}
|
|
427843
|
+
return margin + shapeSize / 2 - svgSize / 2;
|
|
427844
|
+
}
|
|
427845
|
+
function generateTextWatermarkSVG2({ text: text7, width, height, rotation, fill, textStyle, fitShape }) {
|
|
427846
|
+
let fontSize = height * 1.12;
|
|
427325
427847
|
if (textStyle?.fontSize && textStyle.fontSize.trim() !== "1pt") {
|
|
427326
427848
|
const match2 = textStyle.fontSize.match(/^([\d.]+)(pt|px)?$/);
|
|
427327
427849
|
if (match2) {
|
|
@@ -427331,9 +427853,9 @@ function generateTextWatermarkSVG2({ text: text7, width, height, rotation, fill,
|
|
|
427331
427853
|
}
|
|
427332
427854
|
}
|
|
427333
427855
|
fontSize = Math.max(fontSize, 48);
|
|
427334
|
-
const color3 = sanitizeColor2(fill?.color, "silver");
|
|
427335
|
-
const opacity = sanitizeNumeric2(fill?.opacity,
|
|
427336
|
-
const fontFamily = sanitizeFontFamily3(textStyle?.fontFamily);
|
|
427856
|
+
const color3 = normalizeVmlColor2(sanitizeColor2(fill?.color, "silver"));
|
|
427857
|
+
const opacity = sanitizeNumeric2(fill?.opacity, DEFAULT_VML_TEXT_WATERMARK_OPACITY2, 0, 1);
|
|
427858
|
+
const fontFamily = resolveSvgFontFamily2(sanitizeFontFamily3(textStyle?.fontFamily));
|
|
427337
427859
|
const sanitizedRotation = sanitizeNumeric2(rotation, 0, -360, 360);
|
|
427338
427860
|
const sanitizedWidth = sanitizeNumeric2(width, 100, 1, 1e4);
|
|
427339
427861
|
const sanitizedHeight = sanitizeNumeric2(height, 100, 1, 1e4);
|
|
@@ -427347,24 +427869,40 @@ function generateTextWatermarkSVG2({ text: text7, width, height, rotation, fill,
|
|
|
427347
427869
|
const svgHeight = Math.max(sanitizedHeight, rotatedHeight) * 1.1;
|
|
427348
427870
|
const centerX = svgWidth / 2;
|
|
427349
427871
|
const centerY = svgHeight / 2;
|
|
427872
|
+
const textAttributes = [
|
|
427873
|
+
`x="${centerX}"`,
|
|
427874
|
+
`y="${centerY}"`,
|
|
427875
|
+
'text-anchor="middle"',
|
|
427876
|
+
'dominant-baseline="middle"',
|
|
427877
|
+
`font-family="${fontFamily}"`,
|
|
427878
|
+
`font-size="${sanitizedFontSize}px"`,
|
|
427879
|
+
...fitShape ? [`textLength="${sanitizedWidth}"`, 'lengthAdjust="spacingAndGlyphs"'] : [],
|
|
427880
|
+
`fill="${color3}"`,
|
|
427881
|
+
`fill-opacity="${opacity}"`,
|
|
427882
|
+
`transform="rotate(${sanitizedRotation} ${centerX} ${centerY})"`
|
|
427883
|
+
].map((attribute) => ` ${attribute}`).join(`
|
|
427884
|
+
`);
|
|
427350
427885
|
const svg2 = `<svg xmlns="http://www.w3.org/2000/svg" width="${svgWidth}" height="${svgHeight}" viewBox="0 0 ${svgWidth} ${svgHeight}" style="overflow: visible;">
|
|
427351
|
-
|
|
427352
|
-
|
|
427353
|
-
y="${centerY}"
|
|
427354
|
-
text-anchor="middle"
|
|
427355
|
-
dominant-baseline="middle"
|
|
427356
|
-
font-family="${fontFamily}"
|
|
427357
|
-
font-size="${sanitizedFontSize}px"
|
|
427358
|
-
fill="${color3}"
|
|
427359
|
-
opacity="${opacity}"
|
|
427360
|
-
transform="rotate(${sanitizedRotation} ${centerX} ${centerY})">${escapeXml2(text7)}</text>
|
|
427361
|
-
</svg>`;
|
|
427886
|
+
<text ${textAttributes}>${escapeXml2(text7)}</text>
|
|
427887
|
+
</svg>`;
|
|
427362
427888
|
return {
|
|
427363
|
-
dataUri: `data:image/svg+xml,${
|
|
427889
|
+
dataUri: `data:image/svg+xml;base64,${encodeUtf8Base642(svg2)}`,
|
|
427364
427890
|
svgWidth,
|
|
427365
427891
|
svgHeight
|
|
427366
427892
|
};
|
|
427367
427893
|
}
|
|
427894
|
+
function resolveSvgFontFamily2(fontFamily) {
|
|
427895
|
+
if (!fontFamily || typeof fontFamily !== "string") {
|
|
427896
|
+
return "Arial, sans-serif";
|
|
427897
|
+
}
|
|
427898
|
+
const normalized = fontFamily.trim();
|
|
427899
|
+
if (normalized.includes(",")) {
|
|
427900
|
+
return normalized;
|
|
427901
|
+
}
|
|
427902
|
+
const serifFonts = new Set(["cambria", "constantia", "georgia", "times new roman", "times"]);
|
|
427903
|
+
const generic = serifFonts.has(normalized.toLowerCase()) ? "serif" : "Arial, sans-serif";
|
|
427904
|
+
return `${normalized}, ${generic}`;
|
|
427905
|
+
}
|
|
427368
427906
|
function escapeXml2(text7) {
|
|
427369
427907
|
return text7.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
427370
427908
|
}
|
|
@@ -427372,7 +427910,7 @@ function parseVmlStyle3(style2) {
|
|
|
427372
427910
|
const result = {};
|
|
427373
427911
|
if (!style2)
|
|
427374
427912
|
return result;
|
|
427375
|
-
const declarations = style2.split(";").filter((s2) => s2.trim());
|
|
427913
|
+
const declarations = decodeXmlEntities2(style2).split(";").filter((s2) => s2.trim());
|
|
427376
427914
|
for (const decl of declarations) {
|
|
427377
427915
|
const colonIndex = decl.indexOf(":");
|
|
427378
427916
|
if (colonIndex === -1)
|
|
@@ -427412,6 +427950,8 @@ function convertToPixels3(value) {
|
|
|
427412
427950
|
return num;
|
|
427413
427951
|
}
|
|
427414
427952
|
}
|
|
427953
|
+
var ROTATED_CENTERED_WATERMARK_TOP_OFFSET_RATIO2 = 0.25, MAX_ROTATED_CENTERED_WATERMARK_OFFSET_HEIGHT_PX2 = 1e4, DEFAULT_VML_TEXT_WATERMARK_OPACITY2 = 1, DEFAULT_VML_TEXT_WATERMARK_ALIGNMENT2 = "center";
|
|
427954
|
+
var init_handle_shape_text_watermark_import = () => {};
|
|
427415
427955
|
|
|
427416
427956
|
// ../../packages/super-editor/src/editors/v1/core/super-converter/v3/handlers/w/pict/helpers/pict-node-type-strategy.js
|
|
427417
427957
|
function pictNodeTypeStrategy2(node4) {
|
|
@@ -427447,6 +427987,7 @@ var init_pict_node_type_strategy = __esm(() => {
|
|
|
427447
427987
|
init_handle_v_rect_import();
|
|
427448
427988
|
init_handle_shape_textbox_import();
|
|
427449
427989
|
init_handle_shape_image_watermark_import();
|
|
427990
|
+
init_handle_shape_text_watermark_import();
|
|
427450
427991
|
});
|
|
427451
427992
|
|
|
427452
427993
|
// ../../packages/super-editor/src/editors/v1/core/super-converter/v3/handlers/w/pict/helpers/translate-shape-container.js
|
|
@@ -432203,6 +432744,19 @@ function normalizeRunProperties2(runProperties) {
|
|
|
432203
432744
|
}
|
|
432204
432745
|
|
|
432205
432746
|
// ../../packages/super-editor/src/editors/v1/core/helpers/getMarksFromSelection.js
|
|
432747
|
+
function getMarksFromSelection2(state, editor) {
|
|
432748
|
+
return getSelectionFormattingState2(state, editor).resolvedMarks;
|
|
432749
|
+
}
|
|
432750
|
+
function getSelectionFormattingState2(state, editor) {
|
|
432751
|
+
const { from: from4, to, empty: empty6 } = state.selection;
|
|
432752
|
+
if (empty6) {
|
|
432753
|
+
return getFormattingStateAtPos2(state, state.selection.$head.pos, editor, {
|
|
432754
|
+
storedMarks: state.storedMarks ?? null,
|
|
432755
|
+
includeCursorMarksWithStoredMarks: true
|
|
432756
|
+
});
|
|
432757
|
+
}
|
|
432758
|
+
return getFormattingStateForRange2(state, from4, to, editor);
|
|
432759
|
+
}
|
|
432206
432760
|
function getFormattingStateAtPos2(state, pos, editor, options = {}) {
|
|
432207
432761
|
const {
|
|
432208
432762
|
storedMarks = null,
|
|
@@ -432259,6 +432813,37 @@ function getFormattingStateAtPos2(state, pos, editor, options = {}) {
|
|
|
432259
432813
|
styleRunProperties
|
|
432260
432814
|
};
|
|
432261
432815
|
}
|
|
432816
|
+
function getFormattingStateForRange2(state, from4, to, editor) {
|
|
432817
|
+
const segments = [];
|
|
432818
|
+
const seen = new Set;
|
|
432819
|
+
state.doc.nodesBetween(from4, to, (node4, pos) => {
|
|
432820
|
+
if (!node4.isText || node4.text?.length === 0)
|
|
432821
|
+
return;
|
|
432822
|
+
const segmentPos = pos + 1;
|
|
432823
|
+
if (seen.has(segmentPos))
|
|
432824
|
+
return;
|
|
432825
|
+
seen.add(segmentPos);
|
|
432826
|
+
segments.push(getFormattingStateAtPos2(state, segmentPos, editor));
|
|
432827
|
+
});
|
|
432828
|
+
if (segments.length === 0) {
|
|
432829
|
+
return getFormattingStateAtPos2(state, from4, editor);
|
|
432830
|
+
}
|
|
432831
|
+
return aggregateFormattingSegments2(state, editor, segments);
|
|
432832
|
+
}
|
|
432833
|
+
function aggregateFormattingSegments2(state, editor, segments) {
|
|
432834
|
+
const resolvedRunProperties = intersectRunProperties2(segments.map((segment) => segment.resolvedRunProperties));
|
|
432835
|
+
const inlineRunProperties = intersectRunProperties2(segments.map((segment) => segment.inlineRunProperties));
|
|
432836
|
+
const styleRunProperties = intersectRunProperties2(segments.map((segment) => segment.styleRunProperties));
|
|
432837
|
+
const resolvedMarks = createMarksFromRunProperties2(state, resolvedRunProperties, editor);
|
|
432838
|
+
const inlineMarks = createMarksFromRunProperties2(state, inlineRunProperties, editor);
|
|
432839
|
+
return {
|
|
432840
|
+
resolvedMarks: mergeResolvedMarksWithInlineFallback2(resolvedMarks, inlineMarks),
|
|
432841
|
+
inlineMarks,
|
|
432842
|
+
resolvedRunProperties,
|
|
432843
|
+
inlineRunProperties,
|
|
432844
|
+
styleRunProperties
|
|
432845
|
+
};
|
|
432846
|
+
}
|
|
432262
432847
|
function mergeResolvedMarksWithInlineFallback2(resolvedMarks, inlineMarks) {
|
|
432263
432848
|
if (!resolvedMarks.length)
|
|
432264
432849
|
return inlineMarks;
|
|
@@ -432268,6 +432853,20 @@ function mergeResolvedMarksWithInlineFallback2(resolvedMarks, inlineMarks) {
|
|
|
432268
432853
|
const missingInlineMarks = inlineMarks.filter((mark2) => !resolvedMarkNames.has(mark2.type.name));
|
|
432269
432854
|
return [...resolvedMarks, ...missingInlineMarks];
|
|
432270
432855
|
}
|
|
432856
|
+
function intersectRunProperties2(runPropertiesList) {
|
|
432857
|
+
const filtered = runPropertiesList.filter((props) => props && typeof props === "object");
|
|
432858
|
+
if (filtered.length === 0)
|
|
432859
|
+
return null;
|
|
432860
|
+
const first2 = filtered[0];
|
|
432861
|
+
const intersection3 = {};
|
|
432862
|
+
Object.keys(first2).forEach((key2) => {
|
|
432863
|
+
const serialized = JSON.stringify(first2[key2]);
|
|
432864
|
+
if (filtered.every((props) => JSON.stringify(props[key2]) === serialized)) {
|
|
432865
|
+
intersection3[key2] = first2[key2];
|
|
432866
|
+
}
|
|
432867
|
+
});
|
|
432868
|
+
return Object.keys(intersection3).length ? intersection3 : null;
|
|
432869
|
+
}
|
|
432271
432870
|
function getInheritedRunProperties2($pos, editor, inlineRunProperties) {
|
|
432272
432871
|
if (!editor) {
|
|
432273
432872
|
return {
|
|
@@ -448995,6 +449594,210 @@ function generateDocxHexId2() {
|
|
|
448995
449594
|
}
|
|
448996
449595
|
var DOCX_HEX_ID_LENGTH2 = 8;
|
|
448997
449596
|
|
|
449597
|
+
// ../../packages/super-editor/src/editors/v1/core/Attribute.ts
|
|
449598
|
+
class Attribute4 {
|
|
449599
|
+
static getAttributesFromExtensions(extensions) {
|
|
449600
|
+
const extensionAttributes = [];
|
|
449601
|
+
const defaultAttribute = {
|
|
449602
|
+
default: null,
|
|
449603
|
+
rendered: true,
|
|
449604
|
+
renderDOM: null,
|
|
449605
|
+
parseDOM: null,
|
|
449606
|
+
keepOnSplit: true
|
|
449607
|
+
};
|
|
449608
|
+
const globalAttributes = this.#getGlobalAttributes(extensions, defaultAttribute);
|
|
449609
|
+
const nodeAndMarksAttributes = this.#getNodeAndMarksAttributes(extensions, defaultAttribute);
|
|
449610
|
+
extensionAttributes.push(...globalAttributes, ...nodeAndMarksAttributes);
|
|
449611
|
+
return extensionAttributes;
|
|
449612
|
+
}
|
|
449613
|
+
static #getGlobalAttributes(extensions, defaultAttribute) {
|
|
449614
|
+
const extensionAttributes = [];
|
|
449615
|
+
const collectAttribute = (globalAttr) => {
|
|
449616
|
+
for (const type of globalAttr.types) {
|
|
449617
|
+
const entries = Object.entries(globalAttr.attributes);
|
|
449618
|
+
for (const [name, attribute] of entries) {
|
|
449619
|
+
extensionAttributes.push({
|
|
449620
|
+
type,
|
|
449621
|
+
name,
|
|
449622
|
+
attribute: {
|
|
449623
|
+
...defaultAttribute,
|
|
449624
|
+
...attribute
|
|
449625
|
+
}
|
|
449626
|
+
});
|
|
449627
|
+
}
|
|
449628
|
+
}
|
|
449629
|
+
};
|
|
449630
|
+
for (const extension3 of extensions) {
|
|
449631
|
+
const context = {
|
|
449632
|
+
name: extension3.name,
|
|
449633
|
+
options: extension3.options,
|
|
449634
|
+
storage: extension3.storage
|
|
449635
|
+
};
|
|
449636
|
+
const addGlobalAttributes = getExtensionConfigField2(extension3, "addGlobalAttributes", context);
|
|
449637
|
+
if (!addGlobalAttributes)
|
|
449638
|
+
continue;
|
|
449639
|
+
const globalAttributes = addGlobalAttributes();
|
|
449640
|
+
for (const globalAttr of globalAttributes) {
|
|
449641
|
+
collectAttribute(globalAttr);
|
|
449642
|
+
}
|
|
449643
|
+
}
|
|
449644
|
+
return extensionAttributes;
|
|
449645
|
+
}
|
|
449646
|
+
static #getNodeAndMarksAttributes(extensions, defaultAttribute) {
|
|
449647
|
+
const extensionAttributes = [];
|
|
449648
|
+
const nodeAndMarkExtensions = extensions.filter((e) => {
|
|
449649
|
+
return e.type === "node" || e.type === "mark";
|
|
449650
|
+
});
|
|
449651
|
+
for (const extension3 of nodeAndMarkExtensions) {
|
|
449652
|
+
const context = {
|
|
449653
|
+
name: extension3.name,
|
|
449654
|
+
options: extension3.options,
|
|
449655
|
+
storage: extension3.storage
|
|
449656
|
+
};
|
|
449657
|
+
const addAttributes = getExtensionConfigField2(extension3, "addAttributes", context);
|
|
449658
|
+
if (!addAttributes)
|
|
449659
|
+
continue;
|
|
449660
|
+
const attributes = addAttributes();
|
|
449661
|
+
for (const [name, attribute] of Object.entries(attributes)) {
|
|
449662
|
+
const merged = {
|
|
449663
|
+
...defaultAttribute,
|
|
449664
|
+
...attribute
|
|
449665
|
+
};
|
|
449666
|
+
if (typeof merged.default === "function") {
|
|
449667
|
+
merged.default = merged.default();
|
|
449668
|
+
}
|
|
449669
|
+
extensionAttributes.push({
|
|
449670
|
+
type: extension3.name,
|
|
449671
|
+
name,
|
|
449672
|
+
attribute: merged
|
|
449673
|
+
});
|
|
449674
|
+
}
|
|
449675
|
+
}
|
|
449676
|
+
return extensionAttributes;
|
|
449677
|
+
}
|
|
449678
|
+
static insertExtensionAttrsToParseRule(parseRule, extensionAttrs) {
|
|
449679
|
+
if ("style" in parseRule) {
|
|
449680
|
+
return parseRule;
|
|
449681
|
+
}
|
|
449682
|
+
return {
|
|
449683
|
+
...parseRule,
|
|
449684
|
+
getAttrs: (node4) => {
|
|
449685
|
+
const oldAttrs = parseRule.getAttrs ? parseRule.getAttrs(node4) : parseRule.attrs;
|
|
449686
|
+
if (oldAttrs === false)
|
|
449687
|
+
return false;
|
|
449688
|
+
const parseFromString = (value) => {
|
|
449689
|
+
if (typeof value !== "string")
|
|
449690
|
+
return value;
|
|
449691
|
+
if (value.match(/^[+-]?(\d*\.)?\d+$/))
|
|
449692
|
+
return Number(value);
|
|
449693
|
+
if (value === "true")
|
|
449694
|
+
return true;
|
|
449695
|
+
if (value === "false")
|
|
449696
|
+
return false;
|
|
449697
|
+
return value;
|
|
449698
|
+
};
|
|
449699
|
+
let newAttrs = {};
|
|
449700
|
+
for (const item of extensionAttrs) {
|
|
449701
|
+
const value = item.attribute.parseDOM ? item.attribute.parseDOM(node4) : parseFromString(node4.getAttribute(item.name));
|
|
449702
|
+
if (value === null || value === undefined)
|
|
449703
|
+
continue;
|
|
449704
|
+
newAttrs = {
|
|
449705
|
+
...newAttrs,
|
|
449706
|
+
[item.name]: value
|
|
449707
|
+
};
|
|
449708
|
+
}
|
|
449709
|
+
return { ...oldAttrs, ...newAttrs };
|
|
449710
|
+
}
|
|
449711
|
+
};
|
|
449712
|
+
}
|
|
449713
|
+
static getAttributesToRender(nodeOrMark, extensionAttrs) {
|
|
449714
|
+
const attributes = extensionAttrs.filter((item) => item.attribute.rendered).map((item) => {
|
|
449715
|
+
if (!item.attribute.renderDOM) {
|
|
449716
|
+
return { [item.name]: nodeOrMark.attrs[item.name] };
|
|
449717
|
+
}
|
|
449718
|
+
return item.attribute.renderDOM(nodeOrMark.attrs) || {};
|
|
449719
|
+
});
|
|
449720
|
+
let mergedAttrs = {};
|
|
449721
|
+
for (const attribute of attributes) {
|
|
449722
|
+
mergedAttrs = this.mergeAttributes(mergedAttrs, attribute);
|
|
449723
|
+
}
|
|
449724
|
+
return mergedAttrs;
|
|
449725
|
+
}
|
|
449726
|
+
static mergeAttributes(...objects) {
|
|
449727
|
+
const items = objects.filter((item) => !!item);
|
|
449728
|
+
let attrs = {};
|
|
449729
|
+
for (const item of items) {
|
|
449730
|
+
const mergedAttributes = { ...attrs };
|
|
449731
|
+
for (const [key2, value] of Object.entries(item)) {
|
|
449732
|
+
const exists = mergedAttributes[key2];
|
|
449733
|
+
if (!exists) {
|
|
449734
|
+
mergedAttributes[key2] = value;
|
|
449735
|
+
continue;
|
|
449736
|
+
}
|
|
449737
|
+
if (key2 === "class") {
|
|
449738
|
+
const valueStr = typeof value === "string" ? value : String(value);
|
|
449739
|
+
const existingStr = typeof mergedAttributes[key2] === "string" ? mergedAttributes[key2] : String(mergedAttributes[key2] || "");
|
|
449740
|
+
const valueClasses = valueStr ? valueStr.split(" ") : [];
|
|
449741
|
+
const existingClasses = existingStr ? existingStr.split(" ") : [];
|
|
449742
|
+
const insertClasses = valueClasses.filter((value2) => !existingClasses.includes(value2));
|
|
449743
|
+
mergedAttributes[key2] = [...existingClasses, ...insertClasses].join(" ");
|
|
449744
|
+
} else if (key2 === "style") {
|
|
449745
|
+
mergedAttributes[key2] = [mergedAttributes[key2], value].join("; ");
|
|
449746
|
+
} else {
|
|
449747
|
+
mergedAttributes[key2] = value;
|
|
449748
|
+
}
|
|
449749
|
+
}
|
|
449750
|
+
attrs = mergedAttributes;
|
|
449751
|
+
}
|
|
449752
|
+
return attrs;
|
|
449753
|
+
}
|
|
449754
|
+
static getSplittedAttributes(extensionAttrs, typeName, attributes) {
|
|
449755
|
+
const entries = Object.entries(attributes).filter(([name]) => {
|
|
449756
|
+
const extensionAttr = extensionAttrs.find((item) => {
|
|
449757
|
+
return item.type === typeName && item.name === name;
|
|
449758
|
+
});
|
|
449759
|
+
if (!extensionAttr)
|
|
449760
|
+
return false;
|
|
449761
|
+
return extensionAttr.attribute.keepOnSplit;
|
|
449762
|
+
});
|
|
449763
|
+
return Object.fromEntries(entries);
|
|
449764
|
+
}
|
|
449765
|
+
static getMarkAttributes(state, typeOrName) {
|
|
449766
|
+
const type = getMarkType2(typeOrName, state.schema);
|
|
449767
|
+
const marks = getMarksFromSelection2(state);
|
|
449768
|
+
const mark2 = marks.find((markItem) => markItem.type.name === type.name);
|
|
449769
|
+
if (!mark2)
|
|
449770
|
+
return {};
|
|
449771
|
+
return { ...mark2.attrs };
|
|
449772
|
+
}
|
|
449773
|
+
static getNodeAttributes(state, typeOrName) {
|
|
449774
|
+
const type = getNodeType2(typeOrName, state.schema);
|
|
449775
|
+
const { from: from4, to } = state.selection;
|
|
449776
|
+
const nodes = [];
|
|
449777
|
+
state.doc.nodesBetween(from4, to, (node5) => {
|
|
449778
|
+
nodes.push(node5);
|
|
449779
|
+
});
|
|
449780
|
+
const node4 = nodes.reverse().find((nodeItem) => nodeItem.type.name === type.name);
|
|
449781
|
+
if (!node4)
|
|
449782
|
+
return {};
|
|
449783
|
+
return { ...node4.attrs };
|
|
449784
|
+
}
|
|
449785
|
+
static getAttributes(state, typeOrName) {
|
|
449786
|
+
const schemaType = getSchemaTypeNameByName2(typeof typeOrName === "string" ? typeOrName : typeOrName.name, state.schema);
|
|
449787
|
+
if (schemaType === "node") {
|
|
449788
|
+
return this.getNodeAttributes(state, typeOrName);
|
|
449789
|
+
}
|
|
449790
|
+
if (schemaType === "mark") {
|
|
449791
|
+
return this.getMarkAttributes(state, typeOrName);
|
|
449792
|
+
}
|
|
449793
|
+
return {};
|
|
449794
|
+
}
|
|
449795
|
+
}
|
|
449796
|
+
var init_Attribute = __esm(() => {
|
|
449797
|
+
init_getExtensionConfigField();
|
|
449798
|
+
init_getMarksFromSelection();
|
|
449799
|
+
});
|
|
449800
|
+
|
|
448998
449801
|
// ../../packages/super-editor/src/editors/v1/extensions/table/tableHelpers/border-utils.js
|
|
448999
449802
|
function cloneBorders2(borders, sides) {
|
|
449000
449803
|
if (!borders || typeof borders !== "object")
|
|
@@ -450501,10 +451304,7 @@ function tablesSplitAdapter2(editor, input2, options) {
|
|
|
450501
451304
|
const rEnd = tr.mapping.slice(mapFrom).map(rowPositions[i5] + tableNode.child(i5).nodeSize);
|
|
450502
451305
|
tr.delete(rp, rEnd);
|
|
450503
451306
|
}
|
|
450504
|
-
const newTableAttrs =
|
|
450505
|
-
delete newTableAttrs.sdBlockId;
|
|
450506
|
-
delete newTableAttrs.paraId;
|
|
450507
|
-
delete newTableAttrs.textId;
|
|
451307
|
+
const newTableAttrs = Attribute4.getSplittedAttributes(editor.extensionService?.attributes ?? [], tableNode.type.name, tableNode.attrs);
|
|
450508
451308
|
const newTable = schema.nodes.table.create(newTableAttrs, secondTableRows);
|
|
450509
451309
|
const separatorParagraph = createSeparatorParagraph2(schema);
|
|
450510
451310
|
if (!separatorParagraph) {
|
|
@@ -452334,6 +453134,7 @@ var init_tables_adapter = __esm(() => {
|
|
|
452334
453134
|
init_errors4();
|
|
452335
453135
|
init_node_address_resolver();
|
|
452336
453136
|
init_ooxml();
|
|
453137
|
+
init_Attribute();
|
|
452337
453138
|
init_document_settings();
|
|
452338
453139
|
init_mutate_part();
|
|
452339
453140
|
init_table_attr_sync();
|