@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.
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  const jszip = require("./jszip-C8_CqJxM.cjs");
3
3
  const helpers$1 = require("./helpers-nOdwpmwb.cjs");
4
- const superEditor_converter = require("./SuperConverter-CgY28MJz.cjs");
4
+ const superEditor_converter = require("./SuperConverter-pEsdZ6oR.cjs");
5
5
  const vue = require("./vue-De9wkgLl.cjs");
6
6
  require("./jszip.min-BPh2MMAa.cjs");
7
7
  const eventemitter3 = require("./eventemitter3-BQuRcMPI.cjs");
@@ -15457,7 +15457,7 @@ const canUseDOM = () => {
15457
15457
  return false;
15458
15458
  }
15459
15459
  };
15460
- const summaryVersion = "1.4.0-next.1";
15460
+ const summaryVersion = "1.4.0-next.3";
15461
15461
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
15462
15462
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
15463
15463
  function mapAttributes(attrs) {
@@ -18089,7 +18089,7 @@ class Editor extends EventEmitter {
18089
18089
  * Process collaboration migrations
18090
18090
  */
18091
18091
  processCollaborationMigrations() {
18092
- console.debug("[checkVersionMigrations] Current editor version", "1.4.0-next.1");
18092
+ console.debug("[checkVersionMigrations] Current editor version", "1.4.0-next.3");
18093
18093
  if (!this.options.ydoc) return;
18094
18094
  const metaMap = this.options.ydoc.getMap("meta");
18095
18095
  let docVersion = metaMap.get("version");
@@ -23822,6 +23822,9 @@ const renderTableCell = (deps) => {
23822
23822
  imgEl.style.width = "100%";
23823
23823
  imgEl.style.height = "100%";
23824
23824
  imgEl.style.objectFit = block.objectFit ?? "contain";
23825
+ if (block.objectFit === "cover") {
23826
+ imgEl.style.objectPosition = "left top";
23827
+ }
23825
23828
  imgEl.style.display = "block";
23826
23829
  imageWrapper.appendChild(imgEl);
23827
23830
  content.appendChild(imageWrapper);
@@ -23851,6 +23854,9 @@ const renderTableCell = (deps) => {
23851
23854
  img.style.width = "100%";
23852
23855
  img.style.height = "100%";
23853
23856
  img.style.objectFit = block.objectFit ?? "contain";
23857
+ if (block.objectFit === "cover") {
23858
+ img.style.objectPosition = "left top";
23859
+ }
23854
23860
  drawingInner.appendChild(img);
23855
23861
  } else if (renderDrawingContent) {
23856
23862
  const drawingContent = renderDrawingContent(block);
@@ -26422,7 +26428,7 @@ class DomPainter {
26422
26428
  if (fragment.pmEnd != null) {
26423
26429
  fragmentEl.dataset.pmEnd = String(fragment.pmEnd);
26424
26430
  }
26425
- if (fragment.metadata) {
26431
+ if (fragment.metadata && !block.attrs?.vmlWatermark) {
26426
26432
  fragmentEl.setAttribute("data-image-metadata", JSON.stringify(fragment.metadata));
26427
26433
  }
26428
26434
  const img = this.doc.createElement("img");
@@ -26433,7 +26439,28 @@ class DomPainter {
26433
26439
  img.style.width = "100%";
26434
26440
  img.style.height = "100%";
26435
26441
  img.style.objectFit = block.objectFit ?? "contain";
26442
+ if (block.objectFit === "cover") {
26443
+ img.style.objectPosition = "left top";
26444
+ }
26436
26445
  img.style.display = block.display === "inline" ? "inline-block" : "block";
26446
+ const filters = [];
26447
+ if (block.gain != null || block.blacklevel != null) {
26448
+ if (block.gain && typeof block.gain === "string" && block.gain.endsWith("f")) {
26449
+ const contrast = Math.max(0, parseInt(block.gain) / 65536);
26450
+ if (contrast > 0) {
26451
+ filters.push(`contrast(${contrast})`);
26452
+ }
26453
+ }
26454
+ if (block.blacklevel && typeof block.blacklevel === "string" && block.blacklevel.endsWith("f")) {
26455
+ const brightness = Math.max(0, 1 + parseInt(block.blacklevel) / 327 / 100) + 0.5;
26456
+ if (brightness > 0) {
26457
+ filters.push(`brightness(${brightness})`);
26458
+ }
26459
+ }
26460
+ if (filters.length > 0) {
26461
+ img.style.filter = filters.join(" ");
26462
+ }
26463
+ }
26437
26464
  fragmentEl.appendChild(img);
26438
26465
  return fragmentEl;
26439
26466
  } catch (error) {
@@ -26513,6 +26540,9 @@ class DomPainter {
26513
26540
  img.style.width = "100%";
26514
26541
  img.style.height = "100%";
26515
26542
  img.style.objectFit = drawing.objectFit ?? "contain";
26543
+ if (drawing.objectFit === "cover") {
26544
+ img.style.objectPosition = "left top";
26545
+ }
26516
26546
  img.style.display = "block";
26517
26547
  return img;
26518
26548
  }
@@ -31263,13 +31293,8 @@ function computeAnchorX(anchor, columnIndex, columns, imageWidth, margins, pageW
31263
31293
  let baseX;
31264
31294
  let availableWidth;
31265
31295
  if (relativeFrom === "page") {
31266
- if (columns.count === 1) {
31267
- baseX = contentLeft;
31268
- availableWidth = contentWidth;
31269
- } else {
31270
- baseX = 0;
31271
- availableWidth = pageWidth != null ? pageWidth : contentWidth;
31272
- }
31296
+ baseX = 0;
31297
+ availableWidth = pageWidth != null ? pageWidth : contentWidth + marginLeft + marginRight;
31273
31298
  } else if (relativeFrom === "margin") {
31274
31299
  baseX = contentLeft;
31275
31300
  availableWidth = contentWidth;
@@ -32758,7 +32783,9 @@ function collectPreRegisteredAnchors(blocks, measures) {
32758
32783
  if (!isImage && !isDrawing) continue;
32759
32784
  const drawingBlock = block;
32760
32785
  const drawingMeasure = measure;
32761
- if (!drawingBlock.anchor?.isAnchored) continue;
32786
+ if (!drawingBlock.anchor?.isAnchored) {
32787
+ continue;
32788
+ }
32762
32789
  if (isPageRelativeAnchor(drawingBlock)) {
32763
32790
  result.push({ block: drawingBlock, measure: drawingMeasure });
32764
32791
  }
@@ -43629,18 +43656,38 @@ const computeParagraphAttrs = (para, styleContext, listCounterContext, converter
43629
43656
  return unwrapped.length > 0 ? unwrapped : void 0;
43630
43657
  };
43631
43658
  const styleNodeAttrs = { ...attrs };
43632
- const attrTabStops = unwrapTabStops(styleNodeAttrs.tabStops ?? styleNodeAttrs.tabs) ?? styleNodeAttrs.tabStops;
43633
- const hydratedTabStops = unwrapTabStops(hydrated?.tabStops) ?? hydrated?.tabStops;
43634
- const paragraphTabStops = unwrapTabStops(paragraphProps.tabStops) ?? paragraphProps.tabStops;
43635
- let tabSource = attrTabStops;
43636
- if (!tabSource && hydratedTabStops) {
43637
- tabSource = hydratedTabStops;
43638
- }
43639
- if (!tabSource && paragraphTabStops) {
43640
- tabSource = paragraphTabStops;
43641
- }
43642
- if (tabSource) {
43643
- styleNodeAttrs.tabStops = tabSource;
43659
+ const asTabStopArray = (value) => {
43660
+ return Array.isArray(value) ? value : void 0;
43661
+ };
43662
+ const attrTabStops = unwrapTabStops(styleNodeAttrs.tabStops ?? styleNodeAttrs.tabs) ?? asTabStopArray(styleNodeAttrs.tabStops);
43663
+ const hydratedTabStops = unwrapTabStops(hydrated?.tabStops) ?? asTabStopArray(hydrated?.tabStops);
43664
+ const paragraphTabStops = unwrapTabStops(paragraphProps.tabStops) ?? asTabStopArray(paragraphProps.tabStops);
43665
+ const TAB_STOP_PX_TO_TWIPS = 15;
43666
+ const TAB_STOP_TWIPS_THRESHOLD = 1e3;
43667
+ const getTabStopPosition = (entry) => {
43668
+ const originalPos = pickNumber(entry.originalPos);
43669
+ if (originalPos != null) return originalPos;
43670
+ const posValue = pickNumber(entry.pos ?? entry.position ?? entry.offset);
43671
+ if (posValue == null) return void 0;
43672
+ return posValue > TAB_STOP_TWIPS_THRESHOLD ? posValue : Math.round(posValue * TAB_STOP_PX_TO_TWIPS);
43673
+ };
43674
+ const mergeTabStopSources = (...sources) => {
43675
+ const merged = /* @__PURE__ */ new Map();
43676
+ for (const source of sources) {
43677
+ if (!Array.isArray(source)) continue;
43678
+ for (const stop of source) {
43679
+ if (!stop || typeof stop !== "object") continue;
43680
+ const position = getTabStopPosition(stop);
43681
+ if (position == null) continue;
43682
+ merged.set(position, { ...stop });
43683
+ }
43684
+ }
43685
+ if (merged.size === 0) return void 0;
43686
+ return Array.from(merged.entries()).sort(([a], [b]) => a - b).map(([, stop]) => stop);
43687
+ };
43688
+ const mergedTabStops = mergeTabStopSources(hydratedTabStops, paragraphTabStops, attrTabStops);
43689
+ if (mergedTabStops) {
43690
+ styleNodeAttrs.tabStops = mergedTabStops;
43644
43691
  if ("tabs" in styleNodeAttrs) {
43645
43692
  delete styleNodeAttrs.tabs;
43646
43693
  }
@@ -43733,6 +43780,11 @@ const computeParagraphAttrs = (para, styleContext, listCounterContext, converter
43733
43780
  }
43734
43781
  if (computed.paragraph.tabs && computed.paragraph.tabs.length > 0) {
43735
43782
  paragraphAttrs.tabs = computed.paragraph.tabs.map((tab) => ({ ...tab }));
43783
+ } else if (mergedTabStops) {
43784
+ const normalizedTabs = normalizeOoxmlTabs(mergedTabStops);
43785
+ if (normalizedTabs) {
43786
+ paragraphAttrs.tabs = normalizedTabs;
43787
+ }
43736
43788
  } else if (hydratedTabStops) {
43737
43789
  const normalizedTabs = normalizeOoxmlTabs(hydratedTabStops);
43738
43790
  if (normalizedTabs) {
@@ -45136,9 +45188,19 @@ const applyInlineRunProperties = (run, runProperties) => {
45136
45188
  run.letterSpacing = twipsToPx$1(runProperties.letterSpacing);
45137
45189
  }
45138
45190
  };
45191
+ const getVanishValue = (runProperties) => {
45192
+ if (!runProperties || typeof runProperties !== "object" || Array.isArray(runProperties)) {
45193
+ return void 0;
45194
+ }
45195
+ if (!Object.prototype.hasOwnProperty.call(runProperties, "vanish")) {
45196
+ return void 0;
45197
+ }
45198
+ return runProperties.vanish === true;
45199
+ };
45139
45200
  function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defaultSize, styleContext, listCounterContext, trackedChanges, bookmarks, hyperlinkConfig = DEFAULT_HYPERLINK_CONFIG$1, themeColors, converters, converterContext, enableComments = true) {
45140
45201
  const baseBlockId = nextBlockId("paragraph");
45141
45202
  const paragraphProps = typeof para.attrs?.paragraphProperties === "object" && para.attrs.paragraphProperties !== null ? para.attrs.paragraphProperties : {};
45203
+ const paragraphHiddenByVanish = getVanishValue(paragraphProps.runProperties) === true;
45142
45204
  const paragraphStyleId = typeof para.attrs?.styleId === "string" && para.attrs.styleId.trim() ? para.attrs.styleId : typeof paragraphProps.styleId === "string" && paragraphProps.styleId.trim() ? paragraphProps.styleId : null;
45143
45205
  const paragraphHydration = converterContext ? hydrateParagraphStyleAttrs(para, converterContext) : null;
45144
45206
  let baseRunDefaults = {};
@@ -45237,6 +45299,9 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
45237
45299
  });
45238
45300
  }
45239
45301
  if (!para.content || para.content.length === 0) {
45302
+ if (paragraphHiddenByVanish) {
45303
+ return blocks;
45304
+ }
45240
45305
  const paraPos = positions.get(para);
45241
45306
  const emptyRun = {
45242
45307
  text: "",
@@ -45258,6 +45323,7 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
45258
45323
  let currentRuns = [];
45259
45324
  let partIndex = 0;
45260
45325
  let tabOrdinal = 0;
45326
+ let suppressedByVanish = false;
45261
45327
  const nextId = () => partIndex === 0 ? baseBlockId : `${baseBlockId}-${partIndex}`;
45262
45328
  const attachAnchorParagraphId = (block, anchorParagraphId) => {
45263
45329
  const applicableKinds = /* @__PURE__ */ new Set(["drawing", "image", "table"]);
@@ -45302,7 +45368,11 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
45302
45368
  runStyleId
45303
45369
  });
45304
45370
  };
45305
- const visitNode = (node, inheritedMarks = [], activeSdt, activeRunStyleId = null, activeRunProperties) => {
45371
+ const visitNode = (node, inheritedMarks = [], activeSdt, activeRunStyleId = null, activeRunProperties, activeHidden = false) => {
45372
+ if (activeHidden && node.type !== "run") {
45373
+ suppressedByVanish = true;
45374
+ return;
45375
+ }
45306
45376
  if (node.type === "text" && node.text) {
45307
45377
  const run = textNodeToRun(
45308
45378
  node,
@@ -45333,18 +45403,32 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
45333
45403
  if (node.type === "run" && Array.isArray(node.content)) {
45334
45404
  const mergedMarks = [...node.marks ?? [], ...inheritedMarks ?? []];
45335
45405
  const runProperties = typeof node.attrs?.runProperties === "object" && node.attrs.runProperties !== null ? node.attrs.runProperties : null;
45406
+ const runVanish = getVanishValue(runProperties);
45407
+ const nextHidden = runVanish === void 0 ? activeHidden : runVanish;
45408
+ if (nextHidden) {
45409
+ suppressedByVanish = true;
45410
+ return;
45411
+ }
45336
45412
  const nextRunStyleId = extractRunStyleId(runProperties) ?? activeRunStyleId;
45337
45413
  const nextRunProperties = runProperties ?? activeRunProperties;
45338
- node.content.forEach((child) => visitNode(child, mergedMarks, activeSdt, nextRunStyleId, nextRunProperties));
45414
+ node.content.forEach(
45415
+ (child) => visitNode(child, mergedMarks, activeSdt, nextRunStyleId, nextRunProperties, nextHidden)
45416
+ );
45339
45417
  return;
45340
45418
  }
45341
45419
  if (node.type === "structuredContent" && Array.isArray(node.content)) {
45342
45420
  const inlineMetadata = resolveNodeSdtMetadata(node, "structuredContent");
45343
45421
  const nextSdt = inlineMetadata ?? activeSdt;
45344
- node.content.forEach((child) => visitNode(child, inheritedMarks, nextSdt, activeRunStyleId, activeRunProperties));
45422
+ node.content.forEach(
45423
+ (child) => visitNode(child, inheritedMarks, nextSdt, activeRunStyleId, activeRunProperties, activeHidden)
45424
+ );
45345
45425
  return;
45346
45426
  }
45347
45427
  if (node.type === "fieldAnnotation") {
45428
+ if (activeHidden) {
45429
+ suppressedByVanish = true;
45430
+ return;
45431
+ }
45348
45432
  const fieldMetadata = resolveNodeSdtMetadata(node, "fieldAnnotation");
45349
45433
  let contentText;
45350
45434
  if (Array.isArray(node.content) && node.content.length > 0) {
@@ -45363,6 +45447,10 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
45363
45447
  return;
45364
45448
  }
45365
45449
  if (node.type === "pageReference") {
45450
+ if (activeHidden) {
45451
+ suppressedByVanish = true;
45452
+ return;
45453
+ }
45366
45454
  const instruction = getNodeInstruction(node) || "";
45367
45455
  const nodeAttrs = typeof node.attrs === "object" && node.attrs !== null ? node.attrs : {};
45368
45456
  const refMarks = Array.isArray(nodeAttrs.marksAsAttrs) ? nodeAttrs.marksAsAttrs : [];
@@ -45496,6 +45584,10 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
45496
45584
  return;
45497
45585
  }
45498
45586
  if (node.type === "image") {
45587
+ if (activeHidden) {
45588
+ suppressedByVanish = true;
45589
+ return;
45590
+ }
45499
45591
  const isInline2 = isInlineImage(node);
45500
45592
  if (isInline2) {
45501
45593
  const imageRun = imageNodeToRun(node, positions, activeSdt);
@@ -45521,6 +45613,10 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
45521
45613
  return;
45522
45614
  }
45523
45615
  if (node.type === "contentBlock") {
45616
+ if (activeHidden) {
45617
+ suppressedByVanish = true;
45618
+ return;
45619
+ }
45524
45620
  const attrs = node.attrs ?? {};
45525
45621
  if (attrs.horizontalRule === true) {
45526
45622
  const anchorParagraphId = nextId();
@@ -45539,6 +45635,10 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
45539
45635
  return;
45540
45636
  }
45541
45637
  if (node.type === "vectorShape") {
45638
+ if (activeHidden) {
45639
+ suppressedByVanish = true;
45640
+ return;
45641
+ }
45542
45642
  const anchorParagraphId = nextId();
45543
45643
  flushParagraph();
45544
45644
  if (converters?.vectorShapeNodeToDrawingBlock) {
@@ -45550,6 +45650,10 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
45550
45650
  return;
45551
45651
  }
45552
45652
  if (node.type === "shapeGroup") {
45653
+ if (activeHidden) {
45654
+ suppressedByVanish = true;
45655
+ return;
45656
+ }
45553
45657
  const anchorParagraphId = nextId();
45554
45658
  flushParagraph();
45555
45659
  if (converters?.shapeGroupNodeToDrawingBlock) {
@@ -45561,6 +45665,10 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
45561
45665
  return;
45562
45666
  }
45563
45667
  if (node.type === "shapeContainer") {
45668
+ if (activeHidden) {
45669
+ suppressedByVanish = true;
45670
+ return;
45671
+ }
45564
45672
  const anchorParagraphId = nextId();
45565
45673
  flushParagraph();
45566
45674
  if (converters?.shapeContainerNodeToDrawingBlock) {
@@ -45572,6 +45680,10 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
45572
45680
  return;
45573
45681
  }
45574
45682
  if (node.type === "shapeTextbox") {
45683
+ if (activeHidden) {
45684
+ suppressedByVanish = true;
45685
+ return;
45686
+ }
45575
45687
  const anchorParagraphId = nextId();
45576
45688
  flushParagraph();
45577
45689
  if (converters?.shapeTextboxNodeToDrawingBlock) {
@@ -45583,6 +45695,10 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
45583
45695
  return;
45584
45696
  }
45585
45697
  if (node.type === "table") {
45698
+ if (activeHidden) {
45699
+ suppressedByVanish = true;
45700
+ return;
45701
+ }
45586
45702
  const anchorParagraphId = nextId();
45587
45703
  flushParagraph();
45588
45704
  if (converters?.tableNodeToBlock) {
@@ -45606,6 +45722,10 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
45606
45722
  return;
45607
45723
  }
45608
45724
  if (node.type === "hardBreak" || node.type === "lineBreak") {
45725
+ if (activeHidden) {
45726
+ suppressedByVanish = true;
45727
+ return;
45728
+ }
45609
45729
  const attrs = node.attrs ?? {};
45610
45730
  const breakType = attrs.pageBreakType ?? attrs.lineBreakType ?? "line";
45611
45731
  if (breakType === "page") {
@@ -45648,11 +45768,11 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
45648
45768
  }
45649
45769
  };
45650
45770
  para.content.forEach((child) => {
45651
- visitNode(child, [], void 0, null);
45771
+ visitNode(child, [], void 0, null, void 0);
45652
45772
  });
45653
45773
  flushParagraph();
45654
45774
  const hasParagraphBlock = blocks.some((block) => block.kind === "paragraph");
45655
- if (!hasParagraphBlock) {
45775
+ if (!hasParagraphBlock && !suppressedByVanish && !paragraphHiddenByVanish) {
45656
45776
  blocks.push({
45657
45777
  kind: "paragraph",
45658
45778
  id: baseBlockId,
@@ -45906,8 +46026,9 @@ function imageNodeToBlock(node, nextBlockId, positions, _trackedMeta, _trackedCh
45906
46026
  const isInline2 = normalizedWrap?.type === "Inline" || typeof attrs.inline === "boolean" && attrs.inline;
45907
46027
  const display = explicitDisplay === "inline" || explicitDisplay === "block" ? explicitDisplay : isInline2 ? "inline" : "block";
45908
46028
  const explicitObjectFit = typeof attrs.objectFit === "string" ? attrs.objectFit : void 0;
46029
+ const shouldCover = attrs.shouldCover === true;
45909
46030
  const isAnchor = anchor?.isAnchored ?? (typeof attrs.isAnchor === "boolean" ? attrs.isAnchor : false);
45910
- const objectFit = isAllowedObjectFit(explicitObjectFit) ? explicitObjectFit : display === "inline" ? "scale-down" : isAnchor ? "contain" : "contain";
46031
+ const objectFit = isAllowedObjectFit(explicitObjectFit) ? explicitObjectFit : shouldCover ? "cover" : display === "inline" ? "scale-down" : isAnchor ? "contain" : "contain";
45911
46032
  return {
45912
46033
  kind: "image",
45913
46034
  id: nextBlockId("image"),
@@ -45922,7 +46043,10 @@ function imageNodeToBlock(node, nextBlockId, positions, _trackedMeta, _trackedCh
45922
46043
  margin: toBoxSpacing(attrs.marginOffset),
45923
46044
  anchor,
45924
46045
  wrap: normalizedWrap,
45925
- attrs: attrsWithPm
46046
+ attrs: attrsWithPm,
46047
+ // VML image adjustments for watermark effects
46048
+ gain: typeof attrs.gain === "string" || typeof attrs.gain === "number" ? attrs.gain : void 0,
46049
+ blacklevel: typeof attrs.blacklevel === "string" || typeof attrs.blacklevel === "number" ? attrs.blacklevel : void 0
45926
46050
  };
45927
46051
  }
45928
46052
  function handleImageNode(node, context) {
@@ -49872,11 +49996,13 @@ async function measureImageBlock(block, constraints) {
49872
49996
  const intrinsic = getIntrinsicImageSize(block, constraints.maxWidth);
49873
49997
  const isBlockBehindDoc = block.anchor?.behindDoc;
49874
49998
  const isBlockWrapBehindDoc = block.wrap?.type === "None" && block.wrap?.behindDoc;
49875
- const bypassWidthConstraint = isBlockBehindDoc || isBlockWrapBehindDoc;
49999
+ const isPageRelativeAnchor2 = block.anchor?.isAnchored && (block.anchor?.hRelativeFrom === "page" || block.anchor?.hRelativeFrom === "margin");
50000
+ const bypassWidthConstraint = isBlockBehindDoc || isBlockWrapBehindDoc || isPageRelativeAnchor2;
49876
50001
  const isWidthConstraintBypassed = bypassWidthConstraint || constraints.maxWidth <= 0;
49877
50002
  const maxWidth = isWidthConstraintBypassed ? intrinsic.width : constraints.maxWidth;
49878
50003
  const hasNegativeVerticalPosition = block.anchor?.isAnchored && (typeof block.anchor?.offsetV === "number" && block.anchor.offsetV < 0 || typeof block.margin?.top === "number" && block.margin.top < 0);
49879
- const maxHeight = hasNegativeVerticalPosition || !constraints.maxHeight || constraints.maxHeight <= 0 ? Infinity : constraints.maxHeight;
50004
+ const shouldBypassHeightConstraint = hasNegativeVerticalPosition || block.objectFit === "cover";
50005
+ const maxHeight = shouldBypassHeightConstraint || !constraints.maxHeight || constraints.maxHeight <= 0 ? Infinity : constraints.maxHeight;
49880
50006
  const widthScale = maxWidth / intrinsic.width;
49881
50007
  const heightScale = maxHeight / intrinsic.height;
49882
50008
  const scale = Math.min(1, widthScale, heightScale);
@@ -64538,18 +64664,18 @@ const Image = Node$1.create({
64538
64664
  // Used during DOCX export to restore the original metafile format.
64539
64665
  originalExtension: { rendered: false },
64540
64666
  originalSrc: { rendered: false },
64541
- shouldStretch: {
64667
+ shouldCover: {
64542
64668
  default: false,
64543
64669
  rendered: false
64544
64670
  },
64545
64671
  size: {
64546
64672
  default: {},
64547
- renderDOM: ({ size: size2, shouldStretch }) => {
64673
+ renderDOM: ({ size: size2, shouldCover }) => {
64548
64674
  let style2 = "";
64549
64675
  let { width, height } = size2 ?? {};
64550
64676
  if (width) style2 += `width: ${width}px;`;
64551
- if (height && shouldStretch) {
64552
- style2 += `height: ${height}px; object-fit: fill;`;
64677
+ if (height && shouldCover) {
64678
+ style2 += `height: ${height}px; object-fit: cover; object-position: left top;`;
64553
64679
  } else if (height) style2 += "height: auto;";
64554
64680
  return { style: style2 };
64555
64681
  }
@@ -72832,6 +72958,9 @@ const nodeResizer = (nodeNames = ["image"], editor) => {
72832
72958
  if (!node || !nodeNames.includes(node.type.name)) {
72833
72959
  return DecorationSet.empty;
72834
72960
  }
72961
+ if (node.attrs?.vmlWatermark === true) {
72962
+ return DecorationSet.empty;
72963
+ }
72835
72964
  const decorations = [];
72836
72965
  if (nodeNames.includes(selection.node?.type.name)) {
72837
72966
  decorations.push(
@@ -72914,6 +73043,7 @@ const nodeResizer = (nodeNames = ["image"], editor) => {
72914
73043
  const pos = Number.parseInt(wrapper.getAttribute("data-pos"), 10);
72915
73044
  const node = view.state.doc.nodeAt(pos);
72916
73045
  if (!nodeNames.includes(node?.type.name)) return;
73046
+ if (node?.attrs?.vmlWatermark === true) return;
72917
73047
  currentWrapper = wrapper;
72918
73048
  resizeContainer = document.createElement("div");
72919
73049
  resizeContainer.className = "sd-editor-resize-container";
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
- const index = require("./index-C3KRKogJ.cjs");
3
- require("./SuperConverter-CgY28MJz.cjs");
2
+ const index = require("./index-C0kuhYCD.cjs");
3
+ require("./SuperConverter-pEsdZ6oR.cjs");
4
4
  const blankDocx = require("./blank-docx-DfW3Eeh2.cjs");
5
5
  const eventemitter3 = require("./eventemitter3-BQuRcMPI.cjs");
6
6
  const provider = require("@hocuspocus/provider");
@@ -7496,7 +7496,7 @@ const _sfc_main = {
7496
7496
  __name: "SuperDoc",
7497
7497
  emits: ["selection-update"],
7498
7498
  setup(__props, { emit: __emit }) {
7499
- const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-H9_8IbtN.cjs")));
7499
+ const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-BFLlmRke.cjs")));
7500
7500
  const superdocStore = useSuperdocStore();
7501
7501
  const commentsStore = useCommentsStore();
7502
7502
  const {
@@ -8450,7 +8450,7 @@ class SuperDoc extends eventemitter3.EventEmitter {
8450
8450
  this.config.colors = shuffleArray(this.config.colors);
8451
8451
  this.userColorMap = /* @__PURE__ */ new Map();
8452
8452
  this.colorIndex = 0;
8453
- this.version = "1.4.0-next.1";
8453
+ this.version = "1.4.0-next.3";
8454
8454
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
8455
8455
  this.superdocId = config.superdocId || uuid.v4();
8456
8456
  this.colors = this.config.colors;
@@ -1,5 +1,5 @@
1
- import { B as BIT8, M as MAX_SAFE_INTEGER, c as create, a as BITS7, u as utf8TextDecoder, b as create$1, s as setIfUndefined, d as create$2, f as from, e as floor$1, g as equalityDeep, w as writeVarUint, h as writeVarString, t as toUint8Array, i as createEncoder, j as createInjectionKey, k as toString, l as throwError, m as useSsrAdapter, n as configProviderInjectionKey, o as cssrAnchorMetaName, p as globalStyle, q as cB, r as c, v as isMounted, x as commonVariables$2, y as cM, z as cNotM, A as cE, C as derived, D as changeColor, E as insideModal, F as insidePopover, G as resolveWrappedSlot, H as on, I as warnOnce, J as useConfig, K as useMergedState, L as useMemo, N as useTheme, O as useRtl, P as createKey, Q as useThemeClass, R as createId, S as call, T as render, U as messageProviderInjectionKey, V as messageApiInjectionKey, W as fromBase64, X as onChange, Y as varStorage, Z as toBase64, _ as createUint8ArrayFromArrayBuffer, $ as offChange, a0 as writeVarUint8Array, a1 as map, a2 as length, a3 as isNode, a4 as min, a5 as pow, a6 as comments_module_events, a7 as getFileObject, a8 as getTrackChanges, a9 as CommentsPluginKey, aa as TrackChangesBasePluginKey, ab as Editor, ac as getRichTextExtensions, ad as ellipsisVerticalSvg, ae as xmarkIconSvg, af as checkIconSvg, ag as caretDownIconSvg, ah as commentIconSvg, ai as _export_sfc, aj as NDropdown, ak as SuperInput, al as vClickOutside, am as PresentationEditor, an as SuperEditor, ao as AIWriter, ap as NConfigProvider, aq as SuperToolbar } from "./index-CEcYlysg.es.js";
2
- import "./SuperConverter-CFRB4XNw.es.js";
1
+ import { B as BIT8, M as MAX_SAFE_INTEGER, c as create, a as BITS7, u as utf8TextDecoder, b as create$1, s as setIfUndefined, d as create$2, f as from, e as floor$1, g as equalityDeep, w as writeVarUint, h as writeVarString, t as toUint8Array, i as createEncoder, j as createInjectionKey, k as toString, l as throwError, m as useSsrAdapter, n as configProviderInjectionKey, o as cssrAnchorMetaName, p as globalStyle, q as cB, r as c, v as isMounted, x as commonVariables$2, y as cM, z as cNotM, A as cE, C as derived, D as changeColor, E as insideModal, F as insidePopover, G as resolveWrappedSlot, H as on, I as warnOnce, J as useConfig, K as useMergedState, L as useMemo, N as useTheme, O as useRtl, P as createKey, Q as useThemeClass, R as createId, S as call, T as render, U as messageProviderInjectionKey, V as messageApiInjectionKey, W as fromBase64, X as onChange, Y as varStorage, Z as toBase64, _ as createUint8ArrayFromArrayBuffer, $ as offChange, a0 as writeVarUint8Array, a1 as map, a2 as length, a3 as isNode, a4 as min, a5 as pow, a6 as comments_module_events, a7 as getFileObject, a8 as getTrackChanges, a9 as CommentsPluginKey, aa as TrackChangesBasePluginKey, ab as Editor, ac as getRichTextExtensions, ad as ellipsisVerticalSvg, ae as xmarkIconSvg, af as checkIconSvg, ag as caretDownIconSvg, ah as commentIconSvg, ai as _export_sfc, aj as NDropdown, ak as SuperInput, al as vClickOutside, am as PresentationEditor, an as SuperEditor, ao as AIWriter, ap as NConfigProvider, aq as SuperToolbar } from "./index-B-20lDKU.es.js";
2
+ import "./SuperConverter-MYkKoPrv.es.js";
3
3
  import { B as BlankDOCX } from "./blank-docx-ABm6XYAA.es.js";
4
4
  import { E as EventEmitter } from "./eventemitter3-CwrdEv8r.es.js";
5
5
  import { HocuspocusProvider, HocuspocusProviderWebsocket } from "@hocuspocus/provider";
@@ -7479,7 +7479,7 @@ const _sfc_main = {
7479
7479
  __name: "SuperDoc",
7480
7480
  emits: ["selection-update"],
7481
7481
  setup(__props, { emit: __emit }) {
7482
- const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-DRTk3dY6.es.js"));
7482
+ const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-D859yVUF.es.js"));
7483
7483
  const superdocStore = useSuperdocStore();
7484
7484
  const commentsStore = useCommentsStore();
7485
7485
  const {
@@ -8433,7 +8433,7 @@ class SuperDoc extends EventEmitter {
8433
8433
  this.config.colors = shuffleArray(this.config.colors);
8434
8434
  this.userColorMap = /* @__PURE__ */ new Map();
8435
8435
  this.colorIndex = 0;
8436
- this.version = "1.4.0-next.1";
8436
+ this.version = "1.4.0-next.3";
8437
8437
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
8438
8438
  this.superdocId = config.superdocId || v4();
8439
8439
  this.colors = this.config.colors;
@@ -2,6 +2,6 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  require("../chunks/jszip-C8_CqJxM.cjs");
4
4
  require("../chunks/helpers-nOdwpmwb.cjs");
5
- const superEditor_converter = require("../chunks/SuperConverter-CgY28MJz.cjs");
5
+ const superEditor_converter = require("../chunks/SuperConverter-pEsdZ6oR.cjs");
6
6
  require("../chunks/uuid-R7L08bOx.cjs");
7
7
  exports.SuperConverter = superEditor_converter.SuperConverter;
@@ -1,6 +1,6 @@
1
1
  import "../chunks/jszip-B1fkPkPJ.es.js";
2
2
  import "../chunks/helpers-C8e9wR5l.es.js";
3
- import { S } from "../chunks/SuperConverter-CFRB4XNw.es.js";
3
+ import { S } from "../chunks/SuperConverter-MYkKoPrv.es.js";
4
4
  import "../chunks/uuid-CjlX8hrF.es.js";
5
5
  export {
6
6
  S as SuperConverter
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("./chunks/index-C3KRKogJ.cjs");
3
+ const index = require("./chunks/index-C0kuhYCD.cjs");
4
4
  const superEditor_docxZipper = require("./super-editor/docx-zipper.cjs");
5
5
  const superEditor_fileZipper = require("./super-editor/file-zipper.cjs");
6
6
  const vue = require("./chunks/vue-De9wkgLl.cjs");
7
- const superEditor_converter = require("./chunks/SuperConverter-CgY28MJz.cjs");
7
+ const superEditor_converter = require("./chunks/SuperConverter-pEsdZ6oR.cjs");
8
8
  function isNodeType(node, name) {
9
9
  return node.type.name === name;
10
10
  }
@@ -1,9 +1,9 @@
1
- import { ax as Node, ay as Mark } from "./chunks/index-CEcYlysg.es.js";
2
- import { ao, au, a9, ab, aw, am, av, aA, an, ak, aq, az, aa, as, aC, aE, aB, ac, aD, ar, at } from "./chunks/index-CEcYlysg.es.js";
1
+ import { ax as Node, ay as Mark } from "./chunks/index-B-20lDKU.es.js";
2
+ import { ao, au, a9, ab, aw, am, av, aA, an, ak, aq, az, aa, as, aC, aE, aB, ac, aD, ar, at } from "./chunks/index-B-20lDKU.es.js";
3
3
  import { default as default2 } from "./super-editor/docx-zipper.es.js";
4
4
  import { createZip } from "./super-editor/file-zipper.es.js";
5
5
  import { d as defineComponent, E as createElementBlock, G as openBlock, K as createBaseVNode } from "./chunks/vue-BnBKJwCW.es.js";
6
- import { S, r } from "./chunks/SuperConverter-CFRB4XNw.es.js";
6
+ import { S, r } from "./chunks/SuperConverter-MYkKoPrv.es.js";
7
7
  function isNodeType(node, name) {
8
8
  return node.type.name === name;
9
9
  }
package/dist/superdoc.cjs CHANGED
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("./chunks/index-C3KRKogJ.cjs");
4
- const superdoc = require("./chunks/index-BdaseaBw.cjs");
5
- const superEditor_converter = require("./chunks/SuperConverter-CgY28MJz.cjs");
3
+ const index = require("./chunks/index-C0kuhYCD.cjs");
4
+ const superdoc = require("./chunks/index-D3X3kMWD.cjs");
5
+ const superEditor_converter = require("./chunks/SuperConverter-pEsdZ6oR.cjs");
6
6
  const blankDocx = require("./chunks/blank-docx-DfW3Eeh2.cjs");
7
7
  require("./chunks/jszip-C8_CqJxM.cjs");
8
8
  require("./chunks/helpers-nOdwpmwb.cjs");
@@ -1,6 +1,6 @@
1
- import { au, ab, aw, av, as, a7, ac, ar, at } from "./chunks/index-CEcYlysg.es.js";
2
- import { D, H, P, S, c } from "./chunks/index-BP9aFfwI.es.js";
3
- import { S as S2, r } from "./chunks/SuperConverter-CFRB4XNw.es.js";
1
+ import { au, ab, aw, av, as, a7, ac, ar, at } from "./chunks/index-B-20lDKU.es.js";
2
+ import { D, H, P, S, c } from "./chunks/index-DF3OVaQj.es.js";
3
+ import { S as S2, r } from "./chunks/SuperConverter-MYkKoPrv.es.js";
4
4
  import { B } from "./chunks/blank-docx-ABm6XYAA.es.js";
5
5
  import "./chunks/jszip-B1fkPkPJ.es.js";
6
6
  import "./chunks/helpers-C8e9wR5l.es.js";