@harbour-enterprises/superdoc 1.4.0-next.1 → 1.4.0-next.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{PdfViewer-H9_8IbtN.cjs → PdfViewer-BFLlmRke.cjs} +2 -2
- package/dist/chunks/{PdfViewer-DRTk3dY6.es.js → PdfViewer-D859yVUF.es.js} +2 -2
- package/dist/chunks/{SuperConverter-CFRB4XNw.es.js → SuperConverter-MYkKoPrv.es.js} +266 -6
- package/dist/chunks/{SuperConverter-CgY28MJz.cjs → SuperConverter-pEsdZ6oR.cjs} +266 -6
- package/dist/chunks/{index-CEcYlysg.es.js → index-B-20lDKU.es.js} +167 -37
- package/dist/chunks/{index-C3KRKogJ.cjs → index-C0kuhYCD.cjs} +167 -37
- package/dist/chunks/{index-BdaseaBw.cjs → index-D3X3kMWD.cjs} +4 -4
- package/dist/chunks/{index-BP9aFfwI.es.js → index-DF3OVaQj.es.js} +4 -4
- package/dist/super-editor/converter.cjs +1 -1
- package/dist/super-editor/converter.es.js +1 -1
- package/dist/super-editor.cjs +2 -2
- package/dist/super-editor.es.js +3 -3
- package/dist/superdoc.cjs +3 -3
- package/dist/superdoc.es.js +3 -3
- package/dist/superdoc.umd.js +433 -43
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { B as Buffer$2 } from "./jszip-B1fkPkPJ.es.js";
|
|
2
2
|
import { t as twipsToInches, i as inchesToTwips, p as ptToTwips, l as linesToTwips, a as twipsToLines, b as pixelsToTwips, h as halfPointToPoints, c as twipsToPixels$2, d as convertSizeToCSS, e as inchesToPixels } from "./helpers-C8e9wR5l.es.js";
|
|
3
|
-
import { g as generateDocxRandomId, T as TextSelection$1, o as objectIncludes, w as wrapTextsInRuns, D as DOMParser$1, c as createDocFromMarkdown, a as createDocFromHTML, b as chainableEditorState, d as convertMarkdownToHTML, f as findParentNode, e as findParentNodeClosestToPos, h as generateRandom32BitHex, i as generateRandomSigned32BitIntStrId, P as PluginKey, j as Plugin, M as Mapping, N as NodeSelection, k as Selection, l as Slice, m as DOMSerializer, F as Fragment, n as Mark$1, p as dropPoint, A as AllSelection, q as Schema$1, s as canSplit, t as resolveRunProperties, u as encodeMarksFromRPr, v as liftTarget, x as canJoin, y as joinPoint, z as replaceStep$1, R as ReplaceAroundStep$1, B as htmlHandler, C as ReplaceStep, E as getResolvedParagraphProperties, G as changeListLevel, H as isList$1, I as updateNumberingProperties, L as ListHelpers, J as inputRulesPlugin, K as TrackDeleteMarkName$1, O as TrackInsertMarkName$1, Q as TrackFormatMarkName$1, U as AddMarkStep, V as RemoveMarkStep, W as CommandService, S as SuperConverter, X as EditorState, Y as unflattenListsInHtml, Z as SelectionRange, _ as Transform, $ as createOoxmlResolver, a0 as translator, a1 as translator$1, a2 as resolveDocxFontFamily, a3 as combineIndentProperties, a4 as _getReferencedTableStyles, a5 as decodeRPrFromMarks, a6 as calculateResolvedParagraphProperties, a7 as encodeCSSFromPPr, a8 as encodeCSSFromRPr, a9 as generateOrderedListIndex, aa as docxNumberingHelpers, ab as InputRule, ac as insertNewRelationship, ad as kebabCase$1, ae as getUnderlineCssString } from "./SuperConverter-
|
|
3
|
+
import { g as generateDocxRandomId, T as TextSelection$1, o as objectIncludes, w as wrapTextsInRuns, D as DOMParser$1, c as createDocFromMarkdown, a as createDocFromHTML, b as chainableEditorState, d as convertMarkdownToHTML, f as findParentNode, e as findParentNodeClosestToPos, h as generateRandom32BitHex, i as generateRandomSigned32BitIntStrId, P as PluginKey, j as Plugin, M as Mapping, N as NodeSelection, k as Selection, l as Slice, m as DOMSerializer, F as Fragment, n as Mark$1, p as dropPoint, A as AllSelection, q as Schema$1, s as canSplit, t as resolveRunProperties, u as encodeMarksFromRPr, v as liftTarget, x as canJoin, y as joinPoint, z as replaceStep$1, R as ReplaceAroundStep$1, B as htmlHandler, C as ReplaceStep, E as getResolvedParagraphProperties, G as changeListLevel, H as isList$1, I as updateNumberingProperties, L as ListHelpers, J as inputRulesPlugin, K as TrackDeleteMarkName$1, O as TrackInsertMarkName$1, Q as TrackFormatMarkName$1, U as AddMarkStep, V as RemoveMarkStep, W as CommandService, S as SuperConverter, X as EditorState, Y as unflattenListsInHtml, Z as SelectionRange, _ as Transform, $ as createOoxmlResolver, a0 as translator, a1 as translator$1, a2 as resolveDocxFontFamily, a3 as combineIndentProperties, a4 as _getReferencedTableStyles, a5 as decodeRPrFromMarks, a6 as calculateResolvedParagraphProperties, a7 as encodeCSSFromPPr, a8 as encodeCSSFromRPr, a9 as generateOrderedListIndex, aa as docxNumberingHelpers, ab as InputRule, ac as insertNewRelationship, ad as kebabCase$1, ae as getUnderlineCssString } from "./SuperConverter-MYkKoPrv.es.js";
|
|
4
4
|
import { p as process$1, r as ref, C as global$1, c as computed, E as createElementBlock, F as Fragment$1, S as renderList, O as withModifiers, G as openBlock, P as normalizeClass, M as createCommentVNode, H as toDisplayString, K as createBaseVNode, U as createApp, f as onMounted, X as onUnmounted, R as withDirectives, v as unref, Y as vModelText, y as nextTick, L as normalizeStyle, u as watch, Z as withKeys, _ as createTextVNode, I as createVNode, h, $ as readonly, s as getCurrentInstance, o as onBeforeUnmount, j as reactive, b as onBeforeMount, i as inject, a0 as onActivated, a1 as onDeactivated, a2 as Comment, d as defineComponent, a as provide, g as Teleport, t as toRef, a3 as renderSlot, a4 as isVNode, D as shallowRef, w as watchEffect, T as Transition, a5 as mergeProps, a6 as vShow, a7 as cloneVNode, a8 as Text$2, m as markRaw, N as createBlock, J as withCtx, a9 as useCssVars, V as resolveDynamicComponent, aa as normalizeProps, ab as guardReactiveProps } from "./vue-BnBKJwCW.es.js";
|
|
5
5
|
import "./jszip.min-DCl8qkFO.es.js";
|
|
6
6
|
import { E as EventEmitter$1 } from "./eventemitter3-CwrdEv8r.es.js";
|
|
@@ -15440,7 +15440,7 @@ const canUseDOM = () => {
|
|
|
15440
15440
|
return false;
|
|
15441
15441
|
}
|
|
15442
15442
|
};
|
|
15443
|
-
const summaryVersion = "1.4.0-next.
|
|
15443
|
+
const summaryVersion = "1.4.0-next.3";
|
|
15444
15444
|
const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
|
|
15445
15445
|
const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
|
|
15446
15446
|
function mapAttributes(attrs) {
|
|
@@ -18072,7 +18072,7 @@ class Editor extends EventEmitter {
|
|
|
18072
18072
|
* Process collaboration migrations
|
|
18073
18073
|
*/
|
|
18074
18074
|
processCollaborationMigrations() {
|
|
18075
|
-
console.debug("[checkVersionMigrations] Current editor version", "1.4.0-next.
|
|
18075
|
+
console.debug("[checkVersionMigrations] Current editor version", "1.4.0-next.3");
|
|
18076
18076
|
if (!this.options.ydoc) return;
|
|
18077
18077
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
18078
18078
|
let docVersion = metaMap.get("version");
|
|
@@ -23805,6 +23805,9 @@ const renderTableCell = (deps) => {
|
|
|
23805
23805
|
imgEl.style.width = "100%";
|
|
23806
23806
|
imgEl.style.height = "100%";
|
|
23807
23807
|
imgEl.style.objectFit = block.objectFit ?? "contain";
|
|
23808
|
+
if (block.objectFit === "cover") {
|
|
23809
|
+
imgEl.style.objectPosition = "left top";
|
|
23810
|
+
}
|
|
23808
23811
|
imgEl.style.display = "block";
|
|
23809
23812
|
imageWrapper.appendChild(imgEl);
|
|
23810
23813
|
content.appendChild(imageWrapper);
|
|
@@ -23834,6 +23837,9 @@ const renderTableCell = (deps) => {
|
|
|
23834
23837
|
img.style.width = "100%";
|
|
23835
23838
|
img.style.height = "100%";
|
|
23836
23839
|
img.style.objectFit = block.objectFit ?? "contain";
|
|
23840
|
+
if (block.objectFit === "cover") {
|
|
23841
|
+
img.style.objectPosition = "left top";
|
|
23842
|
+
}
|
|
23837
23843
|
drawingInner.appendChild(img);
|
|
23838
23844
|
} else if (renderDrawingContent) {
|
|
23839
23845
|
const drawingContent = renderDrawingContent(block);
|
|
@@ -26405,7 +26411,7 @@ class DomPainter {
|
|
|
26405
26411
|
if (fragment.pmEnd != null) {
|
|
26406
26412
|
fragmentEl.dataset.pmEnd = String(fragment.pmEnd);
|
|
26407
26413
|
}
|
|
26408
|
-
if (fragment.metadata) {
|
|
26414
|
+
if (fragment.metadata && !block.attrs?.vmlWatermark) {
|
|
26409
26415
|
fragmentEl.setAttribute("data-image-metadata", JSON.stringify(fragment.metadata));
|
|
26410
26416
|
}
|
|
26411
26417
|
const img = this.doc.createElement("img");
|
|
@@ -26416,7 +26422,28 @@ class DomPainter {
|
|
|
26416
26422
|
img.style.width = "100%";
|
|
26417
26423
|
img.style.height = "100%";
|
|
26418
26424
|
img.style.objectFit = block.objectFit ?? "contain";
|
|
26425
|
+
if (block.objectFit === "cover") {
|
|
26426
|
+
img.style.objectPosition = "left top";
|
|
26427
|
+
}
|
|
26419
26428
|
img.style.display = block.display === "inline" ? "inline-block" : "block";
|
|
26429
|
+
const filters = [];
|
|
26430
|
+
if (block.gain != null || block.blacklevel != null) {
|
|
26431
|
+
if (block.gain && typeof block.gain === "string" && block.gain.endsWith("f")) {
|
|
26432
|
+
const contrast = Math.max(0, parseInt(block.gain) / 65536);
|
|
26433
|
+
if (contrast > 0) {
|
|
26434
|
+
filters.push(`contrast(${contrast})`);
|
|
26435
|
+
}
|
|
26436
|
+
}
|
|
26437
|
+
if (block.blacklevel && typeof block.blacklevel === "string" && block.blacklevel.endsWith("f")) {
|
|
26438
|
+
const brightness = Math.max(0, 1 + parseInt(block.blacklevel) / 327 / 100) + 0.5;
|
|
26439
|
+
if (brightness > 0) {
|
|
26440
|
+
filters.push(`brightness(${brightness})`);
|
|
26441
|
+
}
|
|
26442
|
+
}
|
|
26443
|
+
if (filters.length > 0) {
|
|
26444
|
+
img.style.filter = filters.join(" ");
|
|
26445
|
+
}
|
|
26446
|
+
}
|
|
26420
26447
|
fragmentEl.appendChild(img);
|
|
26421
26448
|
return fragmentEl;
|
|
26422
26449
|
} catch (error) {
|
|
@@ -26496,6 +26523,9 @@ class DomPainter {
|
|
|
26496
26523
|
img.style.width = "100%";
|
|
26497
26524
|
img.style.height = "100%";
|
|
26498
26525
|
img.style.objectFit = drawing.objectFit ?? "contain";
|
|
26526
|
+
if (drawing.objectFit === "cover") {
|
|
26527
|
+
img.style.objectPosition = "left top";
|
|
26528
|
+
}
|
|
26499
26529
|
img.style.display = "block";
|
|
26500
26530
|
return img;
|
|
26501
26531
|
}
|
|
@@ -31246,13 +31276,8 @@ function computeAnchorX(anchor, columnIndex, columns, imageWidth, margins, pageW
|
|
|
31246
31276
|
let baseX;
|
|
31247
31277
|
let availableWidth;
|
|
31248
31278
|
if (relativeFrom === "page") {
|
|
31249
|
-
|
|
31250
|
-
|
|
31251
|
-
availableWidth = contentWidth;
|
|
31252
|
-
} else {
|
|
31253
|
-
baseX = 0;
|
|
31254
|
-
availableWidth = pageWidth != null ? pageWidth : contentWidth;
|
|
31255
|
-
}
|
|
31279
|
+
baseX = 0;
|
|
31280
|
+
availableWidth = pageWidth != null ? pageWidth : contentWidth + marginLeft + marginRight;
|
|
31256
31281
|
} else if (relativeFrom === "margin") {
|
|
31257
31282
|
baseX = contentLeft;
|
|
31258
31283
|
availableWidth = contentWidth;
|
|
@@ -32741,7 +32766,9 @@ function collectPreRegisteredAnchors(blocks, measures) {
|
|
|
32741
32766
|
if (!isImage && !isDrawing) continue;
|
|
32742
32767
|
const drawingBlock = block;
|
|
32743
32768
|
const drawingMeasure = measure;
|
|
32744
|
-
if (!drawingBlock.anchor?.isAnchored)
|
|
32769
|
+
if (!drawingBlock.anchor?.isAnchored) {
|
|
32770
|
+
continue;
|
|
32771
|
+
}
|
|
32745
32772
|
if (isPageRelativeAnchor(drawingBlock)) {
|
|
32746
32773
|
result.push({ block: drawingBlock, measure: drawingMeasure });
|
|
32747
32774
|
}
|
|
@@ -43612,18 +43639,38 @@ const computeParagraphAttrs = (para, styleContext, listCounterContext, converter
|
|
|
43612
43639
|
return unwrapped.length > 0 ? unwrapped : void 0;
|
|
43613
43640
|
};
|
|
43614
43641
|
const styleNodeAttrs = { ...attrs };
|
|
43615
|
-
const
|
|
43616
|
-
|
|
43617
|
-
|
|
43618
|
-
|
|
43619
|
-
|
|
43620
|
-
|
|
43621
|
-
|
|
43622
|
-
|
|
43623
|
-
|
|
43624
|
-
|
|
43625
|
-
|
|
43626
|
-
|
|
43642
|
+
const asTabStopArray = (value) => {
|
|
43643
|
+
return Array.isArray(value) ? value : void 0;
|
|
43644
|
+
};
|
|
43645
|
+
const attrTabStops = unwrapTabStops(styleNodeAttrs.tabStops ?? styleNodeAttrs.tabs) ?? asTabStopArray(styleNodeAttrs.tabStops);
|
|
43646
|
+
const hydratedTabStops = unwrapTabStops(hydrated?.tabStops) ?? asTabStopArray(hydrated?.tabStops);
|
|
43647
|
+
const paragraphTabStops = unwrapTabStops(paragraphProps.tabStops) ?? asTabStopArray(paragraphProps.tabStops);
|
|
43648
|
+
const TAB_STOP_PX_TO_TWIPS = 15;
|
|
43649
|
+
const TAB_STOP_TWIPS_THRESHOLD = 1e3;
|
|
43650
|
+
const getTabStopPosition = (entry) => {
|
|
43651
|
+
const originalPos = pickNumber(entry.originalPos);
|
|
43652
|
+
if (originalPos != null) return originalPos;
|
|
43653
|
+
const posValue = pickNumber(entry.pos ?? entry.position ?? entry.offset);
|
|
43654
|
+
if (posValue == null) return void 0;
|
|
43655
|
+
return posValue > TAB_STOP_TWIPS_THRESHOLD ? posValue : Math.round(posValue * TAB_STOP_PX_TO_TWIPS);
|
|
43656
|
+
};
|
|
43657
|
+
const mergeTabStopSources = (...sources) => {
|
|
43658
|
+
const merged = /* @__PURE__ */ new Map();
|
|
43659
|
+
for (const source of sources) {
|
|
43660
|
+
if (!Array.isArray(source)) continue;
|
|
43661
|
+
for (const stop of source) {
|
|
43662
|
+
if (!stop || typeof stop !== "object") continue;
|
|
43663
|
+
const position = getTabStopPosition(stop);
|
|
43664
|
+
if (position == null) continue;
|
|
43665
|
+
merged.set(position, { ...stop });
|
|
43666
|
+
}
|
|
43667
|
+
}
|
|
43668
|
+
if (merged.size === 0) return void 0;
|
|
43669
|
+
return Array.from(merged.entries()).sort(([a], [b]) => a - b).map(([, stop]) => stop);
|
|
43670
|
+
};
|
|
43671
|
+
const mergedTabStops = mergeTabStopSources(hydratedTabStops, paragraphTabStops, attrTabStops);
|
|
43672
|
+
if (mergedTabStops) {
|
|
43673
|
+
styleNodeAttrs.tabStops = mergedTabStops;
|
|
43627
43674
|
if ("tabs" in styleNodeAttrs) {
|
|
43628
43675
|
delete styleNodeAttrs.tabs;
|
|
43629
43676
|
}
|
|
@@ -43716,6 +43763,11 @@ const computeParagraphAttrs = (para, styleContext, listCounterContext, converter
|
|
|
43716
43763
|
}
|
|
43717
43764
|
if (computed2.paragraph.tabs && computed2.paragraph.tabs.length > 0) {
|
|
43718
43765
|
paragraphAttrs.tabs = computed2.paragraph.tabs.map((tab) => ({ ...tab }));
|
|
43766
|
+
} else if (mergedTabStops) {
|
|
43767
|
+
const normalizedTabs = normalizeOoxmlTabs(mergedTabStops);
|
|
43768
|
+
if (normalizedTabs) {
|
|
43769
|
+
paragraphAttrs.tabs = normalizedTabs;
|
|
43770
|
+
}
|
|
43719
43771
|
} else if (hydratedTabStops) {
|
|
43720
43772
|
const normalizedTabs = normalizeOoxmlTabs(hydratedTabStops);
|
|
43721
43773
|
if (normalizedTabs) {
|
|
@@ -45119,9 +45171,19 @@ const applyInlineRunProperties = (run, runProperties) => {
|
|
|
45119
45171
|
run.letterSpacing = twipsToPx$1(runProperties.letterSpacing);
|
|
45120
45172
|
}
|
|
45121
45173
|
};
|
|
45174
|
+
const getVanishValue = (runProperties) => {
|
|
45175
|
+
if (!runProperties || typeof runProperties !== "object" || Array.isArray(runProperties)) {
|
|
45176
|
+
return void 0;
|
|
45177
|
+
}
|
|
45178
|
+
if (!Object.prototype.hasOwnProperty.call(runProperties, "vanish")) {
|
|
45179
|
+
return void 0;
|
|
45180
|
+
}
|
|
45181
|
+
return runProperties.vanish === true;
|
|
45182
|
+
};
|
|
45122
45183
|
function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defaultSize, styleContext, listCounterContext, trackedChanges, bookmarks, hyperlinkConfig = DEFAULT_HYPERLINK_CONFIG$1, themeColors, converters, converterContext, enableComments = true) {
|
|
45123
45184
|
const baseBlockId = nextBlockId("paragraph");
|
|
45124
45185
|
const paragraphProps = typeof para.attrs?.paragraphProperties === "object" && para.attrs.paragraphProperties !== null ? para.attrs.paragraphProperties : {};
|
|
45186
|
+
const paragraphHiddenByVanish = getVanishValue(paragraphProps.runProperties) === true;
|
|
45125
45187
|
const paragraphStyleId = typeof para.attrs?.styleId === "string" && para.attrs.styleId.trim() ? para.attrs.styleId : typeof paragraphProps.styleId === "string" && paragraphProps.styleId.trim() ? paragraphProps.styleId : null;
|
|
45126
45188
|
const paragraphHydration = converterContext ? hydrateParagraphStyleAttrs(para, converterContext) : null;
|
|
45127
45189
|
let baseRunDefaults = {};
|
|
@@ -45220,6 +45282,9 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
|
|
|
45220
45282
|
});
|
|
45221
45283
|
}
|
|
45222
45284
|
if (!para.content || para.content.length === 0) {
|
|
45285
|
+
if (paragraphHiddenByVanish) {
|
|
45286
|
+
return blocks;
|
|
45287
|
+
}
|
|
45223
45288
|
const paraPos = positions.get(para);
|
|
45224
45289
|
const emptyRun = {
|
|
45225
45290
|
text: "",
|
|
@@ -45241,6 +45306,7 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
|
|
|
45241
45306
|
let currentRuns = [];
|
|
45242
45307
|
let partIndex = 0;
|
|
45243
45308
|
let tabOrdinal = 0;
|
|
45309
|
+
let suppressedByVanish = false;
|
|
45244
45310
|
const nextId = () => partIndex === 0 ? baseBlockId : `${baseBlockId}-${partIndex}`;
|
|
45245
45311
|
const attachAnchorParagraphId = (block, anchorParagraphId) => {
|
|
45246
45312
|
const applicableKinds = /* @__PURE__ */ new Set(["drawing", "image", "table"]);
|
|
@@ -45285,7 +45351,11 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
|
|
|
45285
45351
|
runStyleId
|
|
45286
45352
|
});
|
|
45287
45353
|
};
|
|
45288
|
-
const visitNode = (node, inheritedMarks = [], activeSdt, activeRunStyleId = null, activeRunProperties) => {
|
|
45354
|
+
const visitNode = (node, inheritedMarks = [], activeSdt, activeRunStyleId = null, activeRunProperties, activeHidden = false) => {
|
|
45355
|
+
if (activeHidden && node.type !== "run") {
|
|
45356
|
+
suppressedByVanish = true;
|
|
45357
|
+
return;
|
|
45358
|
+
}
|
|
45289
45359
|
if (node.type === "text" && node.text) {
|
|
45290
45360
|
const run = textNodeToRun(
|
|
45291
45361
|
node,
|
|
@@ -45316,18 +45386,32 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
|
|
|
45316
45386
|
if (node.type === "run" && Array.isArray(node.content)) {
|
|
45317
45387
|
const mergedMarks = [...node.marks ?? [], ...inheritedMarks ?? []];
|
|
45318
45388
|
const runProperties = typeof node.attrs?.runProperties === "object" && node.attrs.runProperties !== null ? node.attrs.runProperties : null;
|
|
45389
|
+
const runVanish = getVanishValue(runProperties);
|
|
45390
|
+
const nextHidden = runVanish === void 0 ? activeHidden : runVanish;
|
|
45391
|
+
if (nextHidden) {
|
|
45392
|
+
suppressedByVanish = true;
|
|
45393
|
+
return;
|
|
45394
|
+
}
|
|
45319
45395
|
const nextRunStyleId = extractRunStyleId(runProperties) ?? activeRunStyleId;
|
|
45320
45396
|
const nextRunProperties = runProperties ?? activeRunProperties;
|
|
45321
|
-
node.content.forEach(
|
|
45397
|
+
node.content.forEach(
|
|
45398
|
+
(child) => visitNode(child, mergedMarks, activeSdt, nextRunStyleId, nextRunProperties, nextHidden)
|
|
45399
|
+
);
|
|
45322
45400
|
return;
|
|
45323
45401
|
}
|
|
45324
45402
|
if (node.type === "structuredContent" && Array.isArray(node.content)) {
|
|
45325
45403
|
const inlineMetadata = resolveNodeSdtMetadata(node, "structuredContent");
|
|
45326
45404
|
const nextSdt = inlineMetadata ?? activeSdt;
|
|
45327
|
-
node.content.forEach(
|
|
45405
|
+
node.content.forEach(
|
|
45406
|
+
(child) => visitNode(child, inheritedMarks, nextSdt, activeRunStyleId, activeRunProperties, activeHidden)
|
|
45407
|
+
);
|
|
45328
45408
|
return;
|
|
45329
45409
|
}
|
|
45330
45410
|
if (node.type === "fieldAnnotation") {
|
|
45411
|
+
if (activeHidden) {
|
|
45412
|
+
suppressedByVanish = true;
|
|
45413
|
+
return;
|
|
45414
|
+
}
|
|
45331
45415
|
const fieldMetadata = resolveNodeSdtMetadata(node, "fieldAnnotation");
|
|
45332
45416
|
let contentText;
|
|
45333
45417
|
if (Array.isArray(node.content) && node.content.length > 0) {
|
|
@@ -45346,6 +45430,10 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
|
|
|
45346
45430
|
return;
|
|
45347
45431
|
}
|
|
45348
45432
|
if (node.type === "pageReference") {
|
|
45433
|
+
if (activeHidden) {
|
|
45434
|
+
suppressedByVanish = true;
|
|
45435
|
+
return;
|
|
45436
|
+
}
|
|
45349
45437
|
const instruction = getNodeInstruction(node) || "";
|
|
45350
45438
|
const nodeAttrs = typeof node.attrs === "object" && node.attrs !== null ? node.attrs : {};
|
|
45351
45439
|
const refMarks = Array.isArray(nodeAttrs.marksAsAttrs) ? nodeAttrs.marksAsAttrs : [];
|
|
@@ -45479,6 +45567,10 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
|
|
|
45479
45567
|
return;
|
|
45480
45568
|
}
|
|
45481
45569
|
if (node.type === "image") {
|
|
45570
|
+
if (activeHidden) {
|
|
45571
|
+
suppressedByVanish = true;
|
|
45572
|
+
return;
|
|
45573
|
+
}
|
|
45482
45574
|
const isInline2 = isInlineImage(node);
|
|
45483
45575
|
if (isInline2) {
|
|
45484
45576
|
const imageRun = imageNodeToRun(node, positions, activeSdt);
|
|
@@ -45504,6 +45596,10 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
|
|
|
45504
45596
|
return;
|
|
45505
45597
|
}
|
|
45506
45598
|
if (node.type === "contentBlock") {
|
|
45599
|
+
if (activeHidden) {
|
|
45600
|
+
suppressedByVanish = true;
|
|
45601
|
+
return;
|
|
45602
|
+
}
|
|
45507
45603
|
const attrs = node.attrs ?? {};
|
|
45508
45604
|
if (attrs.horizontalRule === true) {
|
|
45509
45605
|
const anchorParagraphId = nextId();
|
|
@@ -45522,6 +45618,10 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
|
|
|
45522
45618
|
return;
|
|
45523
45619
|
}
|
|
45524
45620
|
if (node.type === "vectorShape") {
|
|
45621
|
+
if (activeHidden) {
|
|
45622
|
+
suppressedByVanish = true;
|
|
45623
|
+
return;
|
|
45624
|
+
}
|
|
45525
45625
|
const anchorParagraphId = nextId();
|
|
45526
45626
|
flushParagraph();
|
|
45527
45627
|
if (converters?.vectorShapeNodeToDrawingBlock) {
|
|
@@ -45533,6 +45633,10 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
|
|
|
45533
45633
|
return;
|
|
45534
45634
|
}
|
|
45535
45635
|
if (node.type === "shapeGroup") {
|
|
45636
|
+
if (activeHidden) {
|
|
45637
|
+
suppressedByVanish = true;
|
|
45638
|
+
return;
|
|
45639
|
+
}
|
|
45536
45640
|
const anchorParagraphId = nextId();
|
|
45537
45641
|
flushParagraph();
|
|
45538
45642
|
if (converters?.shapeGroupNodeToDrawingBlock) {
|
|
@@ -45544,6 +45648,10 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
|
|
|
45544
45648
|
return;
|
|
45545
45649
|
}
|
|
45546
45650
|
if (node.type === "shapeContainer") {
|
|
45651
|
+
if (activeHidden) {
|
|
45652
|
+
suppressedByVanish = true;
|
|
45653
|
+
return;
|
|
45654
|
+
}
|
|
45547
45655
|
const anchorParagraphId = nextId();
|
|
45548
45656
|
flushParagraph();
|
|
45549
45657
|
if (converters?.shapeContainerNodeToDrawingBlock) {
|
|
@@ -45555,6 +45663,10 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
|
|
|
45555
45663
|
return;
|
|
45556
45664
|
}
|
|
45557
45665
|
if (node.type === "shapeTextbox") {
|
|
45666
|
+
if (activeHidden) {
|
|
45667
|
+
suppressedByVanish = true;
|
|
45668
|
+
return;
|
|
45669
|
+
}
|
|
45558
45670
|
const anchorParagraphId = nextId();
|
|
45559
45671
|
flushParagraph();
|
|
45560
45672
|
if (converters?.shapeTextboxNodeToDrawingBlock) {
|
|
@@ -45566,6 +45678,10 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
|
|
|
45566
45678
|
return;
|
|
45567
45679
|
}
|
|
45568
45680
|
if (node.type === "table") {
|
|
45681
|
+
if (activeHidden) {
|
|
45682
|
+
suppressedByVanish = true;
|
|
45683
|
+
return;
|
|
45684
|
+
}
|
|
45569
45685
|
const anchorParagraphId = nextId();
|
|
45570
45686
|
flushParagraph();
|
|
45571
45687
|
if (converters?.tableNodeToBlock) {
|
|
@@ -45589,6 +45705,10 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
|
|
|
45589
45705
|
return;
|
|
45590
45706
|
}
|
|
45591
45707
|
if (node.type === "hardBreak" || node.type === "lineBreak") {
|
|
45708
|
+
if (activeHidden) {
|
|
45709
|
+
suppressedByVanish = true;
|
|
45710
|
+
return;
|
|
45711
|
+
}
|
|
45592
45712
|
const attrs = node.attrs ?? {};
|
|
45593
45713
|
const breakType = attrs.pageBreakType ?? attrs.lineBreakType ?? "line";
|
|
45594
45714
|
if (breakType === "page") {
|
|
@@ -45631,11 +45751,11 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
|
|
|
45631
45751
|
}
|
|
45632
45752
|
};
|
|
45633
45753
|
para.content.forEach((child) => {
|
|
45634
|
-
visitNode(child, [], void 0, null);
|
|
45754
|
+
visitNode(child, [], void 0, null, void 0);
|
|
45635
45755
|
});
|
|
45636
45756
|
flushParagraph();
|
|
45637
45757
|
const hasParagraphBlock = blocks.some((block) => block.kind === "paragraph");
|
|
45638
|
-
if (!hasParagraphBlock) {
|
|
45758
|
+
if (!hasParagraphBlock && !suppressedByVanish && !paragraphHiddenByVanish) {
|
|
45639
45759
|
blocks.push({
|
|
45640
45760
|
kind: "paragraph",
|
|
45641
45761
|
id: baseBlockId,
|
|
@@ -45889,8 +46009,9 @@ function imageNodeToBlock(node, nextBlockId, positions, _trackedMeta, _trackedCh
|
|
|
45889
46009
|
const isInline2 = normalizedWrap?.type === "Inline" || typeof attrs.inline === "boolean" && attrs.inline;
|
|
45890
46010
|
const display = explicitDisplay === "inline" || explicitDisplay === "block" ? explicitDisplay : isInline2 ? "inline" : "block";
|
|
45891
46011
|
const explicitObjectFit = typeof attrs.objectFit === "string" ? attrs.objectFit : void 0;
|
|
46012
|
+
const shouldCover = attrs.shouldCover === true;
|
|
45892
46013
|
const isAnchor = anchor?.isAnchored ?? (typeof attrs.isAnchor === "boolean" ? attrs.isAnchor : false);
|
|
45893
|
-
const objectFit = isAllowedObjectFit(explicitObjectFit) ? explicitObjectFit : display === "inline" ? "scale-down" : isAnchor ? "contain" : "contain";
|
|
46014
|
+
const objectFit = isAllowedObjectFit(explicitObjectFit) ? explicitObjectFit : shouldCover ? "cover" : display === "inline" ? "scale-down" : isAnchor ? "contain" : "contain";
|
|
45894
46015
|
return {
|
|
45895
46016
|
kind: "image",
|
|
45896
46017
|
id: nextBlockId("image"),
|
|
@@ -45905,7 +46026,10 @@ function imageNodeToBlock(node, nextBlockId, positions, _trackedMeta, _trackedCh
|
|
|
45905
46026
|
margin: toBoxSpacing(attrs.marginOffset),
|
|
45906
46027
|
anchor,
|
|
45907
46028
|
wrap: normalizedWrap,
|
|
45908
|
-
attrs: attrsWithPm
|
|
46029
|
+
attrs: attrsWithPm,
|
|
46030
|
+
// VML image adjustments for watermark effects
|
|
46031
|
+
gain: typeof attrs.gain === "string" || typeof attrs.gain === "number" ? attrs.gain : void 0,
|
|
46032
|
+
blacklevel: typeof attrs.blacklevel === "string" || typeof attrs.blacklevel === "number" ? attrs.blacklevel : void 0
|
|
45909
46033
|
};
|
|
45910
46034
|
}
|
|
45911
46035
|
function handleImageNode(node, context) {
|
|
@@ -49855,11 +49979,13 @@ async function measureImageBlock(block, constraints) {
|
|
|
49855
49979
|
const intrinsic = getIntrinsicImageSize(block, constraints.maxWidth);
|
|
49856
49980
|
const isBlockBehindDoc = block.anchor?.behindDoc;
|
|
49857
49981
|
const isBlockWrapBehindDoc = block.wrap?.type === "None" && block.wrap?.behindDoc;
|
|
49858
|
-
const
|
|
49982
|
+
const isPageRelativeAnchor2 = block.anchor?.isAnchored && (block.anchor?.hRelativeFrom === "page" || block.anchor?.hRelativeFrom === "margin");
|
|
49983
|
+
const bypassWidthConstraint = isBlockBehindDoc || isBlockWrapBehindDoc || isPageRelativeAnchor2;
|
|
49859
49984
|
const isWidthConstraintBypassed = bypassWidthConstraint || constraints.maxWidth <= 0;
|
|
49860
49985
|
const maxWidth = isWidthConstraintBypassed ? intrinsic.width : constraints.maxWidth;
|
|
49861
49986
|
const hasNegativeVerticalPosition = block.anchor?.isAnchored && (typeof block.anchor?.offsetV === "number" && block.anchor.offsetV < 0 || typeof block.margin?.top === "number" && block.margin.top < 0);
|
|
49862
|
-
const
|
|
49987
|
+
const shouldBypassHeightConstraint = hasNegativeVerticalPosition || block.objectFit === "cover";
|
|
49988
|
+
const maxHeight = shouldBypassHeightConstraint || !constraints.maxHeight || constraints.maxHeight <= 0 ? Infinity : constraints.maxHeight;
|
|
49863
49989
|
const widthScale = maxWidth / intrinsic.width;
|
|
49864
49990
|
const heightScale = maxHeight / intrinsic.height;
|
|
49865
49991
|
const scale = Math.min(1, widthScale, heightScale);
|
|
@@ -64521,18 +64647,18 @@ const Image = Node$1.create({
|
|
|
64521
64647
|
// Used during DOCX export to restore the original metafile format.
|
|
64522
64648
|
originalExtension: { rendered: false },
|
|
64523
64649
|
originalSrc: { rendered: false },
|
|
64524
|
-
|
|
64650
|
+
shouldCover: {
|
|
64525
64651
|
default: false,
|
|
64526
64652
|
rendered: false
|
|
64527
64653
|
},
|
|
64528
64654
|
size: {
|
|
64529
64655
|
default: {},
|
|
64530
|
-
renderDOM: ({ size: size2,
|
|
64656
|
+
renderDOM: ({ size: size2, shouldCover }) => {
|
|
64531
64657
|
let style2 = "";
|
|
64532
64658
|
let { width, height } = size2 ?? {};
|
|
64533
64659
|
if (width) style2 += `width: ${width}px;`;
|
|
64534
|
-
if (height &&
|
|
64535
|
-
style2 += `height: ${height}px; object-fit:
|
|
64660
|
+
if (height && shouldCover) {
|
|
64661
|
+
style2 += `height: ${height}px; object-fit: cover; object-position: left top;`;
|
|
64536
64662
|
} else if (height) style2 += "height: auto;";
|
|
64537
64663
|
return { style: style2 };
|
|
64538
64664
|
}
|
|
@@ -72815,6 +72941,9 @@ const nodeResizer = (nodeNames = ["image"], editor) => {
|
|
|
72815
72941
|
if (!node || !nodeNames.includes(node.type.name)) {
|
|
72816
72942
|
return DecorationSet.empty;
|
|
72817
72943
|
}
|
|
72944
|
+
if (node.attrs?.vmlWatermark === true) {
|
|
72945
|
+
return DecorationSet.empty;
|
|
72946
|
+
}
|
|
72818
72947
|
const decorations = [];
|
|
72819
72948
|
if (nodeNames.includes(selection.node?.type.name)) {
|
|
72820
72949
|
decorations.push(
|
|
@@ -72897,6 +73026,7 @@ const nodeResizer = (nodeNames = ["image"], editor) => {
|
|
|
72897
73026
|
const pos = Number.parseInt(wrapper.getAttribute("data-pos"), 10);
|
|
72898
73027
|
const node = view.state.doc.nodeAt(pos);
|
|
72899
73028
|
if (!nodeNames.includes(node?.type.name)) return;
|
|
73029
|
+
if (node?.attrs?.vmlWatermark === true) return;
|
|
72900
73030
|
currentWrapper = wrapper;
|
|
72901
73031
|
resizeContainer = document.createElement("div");
|
|
72902
73032
|
resizeContainer.className = "sd-editor-resize-container";
|