@harbour-enterprises/superdoc 1.5.0-next.2 → 1.5.0-next.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -36992,7 +36992,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
36992
36992
  static getStoredSuperdocVersion(docx) {
36993
36993
  return SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
36994
36994
  }
36995
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.5.0-next.2") {
36995
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.5.0-next.4") {
36996
36996
  return SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
36997
36997
  }
36998
36998
  /**
@@ -49220,6 +49220,13 @@ Please report this to https://github.com/markedjs/marked.`, e) {
49220
49220
  return insertionMark;
49221
49221
  };
49222
49222
  const markDeletion = ({ tr, from: from2, to, user, date, id: providedId }) => {
49223
+ const normalizeEmail2 = (value) => typeof value === "string" ? value.trim().toLowerCase() : "";
49224
+ const userEmail = normalizeEmail2(user?.email);
49225
+ const isOwnInsertion = (mark2) => {
49226
+ const authorEmail = normalizeEmail2(mark2?.attrs?.authorEmail);
49227
+ if (!authorEmail || !userEmail) return true;
49228
+ return authorEmail === userEmail;
49229
+ };
49223
49230
  let trackedMark = findTrackedMarkBetween({
49224
49231
  tr,
49225
49232
  from: from2,
@@ -49248,7 +49255,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
49248
49255
  if (node2.type.name.includes("table")) {
49249
49256
  return;
49250
49257
  }
49251
- if (node2.isInline && node2.marks.find((mark2) => mark2.type.name === TrackInsertMarkName$1 && mark2.attrs.authorEmail === user.email)) {
49258
+ const insertMark = node2.marks.find((mark2) => mark2.type.name === TrackInsertMarkName$1);
49259
+ if (node2.isInline && insertMark && isOwnInsertion(insertMark)) {
49252
49260
  const removeStep = new ReplaceStep(
49253
49261
  deletionMap.map(Math.max(from2, pos)),
49254
49262
  deletionMap.map(Math.min(to, pos + node2.nodeSize)),
@@ -62867,7 +62875,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
62867
62875
  return false;
62868
62876
  }
62869
62877
  };
62870
- const summaryVersion = "1.5.0-next.2";
62878
+ const summaryVersion = "1.5.0-next.4";
62871
62879
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
62872
62880
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
62873
62881
  function mapAttributes(attrs) {
@@ -65525,7 +65533,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
65525
65533
  * Process collaboration migrations
65526
65534
  */
65527
65535
  processCollaborationMigrations() {
65528
- console.debug("[checkVersionMigrations] Current editor version", "1.5.0-next.2");
65536
+ console.debug("[checkVersionMigrations] Current editor version", "1.5.0-next.4");
65529
65537
  if (!this.options.ydoc) return;
65530
65538
  const metaMap = this.options.ydoc.getMap("meta");
65531
65539
  let docVersion = metaMap.get("version");
@@ -71641,6 +71649,9 @@ ${o}
71641
71649
  container.dataset.sdtContainerStart = String(isStart);
71642
71650
  container.dataset.sdtContainerEnd = String(isEnd);
71643
71651
  container.style.overflow = "visible";
71652
+ if (boundaryOptions?.widthOverride != null) {
71653
+ container.style.width = `${boundaryOptions.widthOverride}px`;
71654
+ }
71644
71655
  if (isStart) {
71645
71656
  const labelEl = doc2.createElement("div");
71646
71657
  labelEl.className = config2.labelClassName;
@@ -72203,6 +72214,7 @@ ${o}
72203
72214
  fragment,
72204
72215
  blockLookup,
72205
72216
  context,
72217
+ sdtBoundary,
72206
72218
  renderLine,
72207
72219
  renderDrawingContent,
72208
72220
  applyFragmentFrame,
@@ -72243,7 +72255,7 @@ ${o}
72243
72255
  applyFragmentFrame(container, fragment);
72244
72256
  container.style.height = `${fragment.height}px`;
72245
72257
  applySdtDataset(container, block.attrs?.sdt);
72246
- applySdtContainerStyling(doc2, container, block.attrs?.sdt);
72258
+ applySdtContainerStyling(doc2, container, block.attrs?.sdt, block.attrs?.containerSdt, sdtBoundary);
72247
72259
  container.classList.add("superdoc-table-fragment");
72248
72260
  if (fragment.metadata?.columnBoundaries) {
72249
72261
  const columnCount = measure.columnWidths.length;
@@ -73882,6 +73894,9 @@ ${o}
73882
73894
  this.updatePositionAttributes(current.element, this.currentMapping);
73883
73895
  }
73884
73896
  this.updateFragmentElement(current.element, fragment, contextBase.section);
73897
+ if (sdtBoundary?.widthOverride != null) {
73898
+ current.element.style.width = `${sdtBoundary.widthOverride}px`;
73899
+ }
73885
73900
  current.fragment = fragment;
73886
73901
  current.key = key2;
73887
73902
  current.context = contextBase;
@@ -73997,7 +74012,7 @@ ${o}
73997
74012
  return this.renderDrawingFragment(fragment, context);
73998
74013
  }
73999
74014
  if (fragment.kind === "table") {
74000
- return this.renderTableFragment(fragment, context);
74015
+ return this.renderTableFragment(fragment, context, sdtBoundary);
74001
74016
  }
74002
74017
  throw new Error(`DomPainter: unsupported fragment kind ${fragment.kind}`);
74003
74018
  }
@@ -75124,7 +75139,7 @@ ${o}
75124
75139
  placeholder.style.border = "1px dashed rgba(15, 23, 42, 0.3)";
75125
75140
  return placeholder;
75126
75141
  }
75127
- renderTableFragment(fragment, context) {
75142
+ renderTableFragment(fragment, context, sdtBoundary) {
75128
75143
  if (!this.doc) {
75129
75144
  throw new Error("DomPainter: document is not available");
75130
75145
  }
@@ -75154,6 +75169,7 @@ ${o}
75154
75169
  fragment,
75155
75170
  context,
75156
75171
  blockLookup: this.blockLookup,
75172
+ sdtBoundary,
75157
75173
  renderLine: renderLineForTableCell,
75158
75174
  renderDrawingContent: renderDrawingContentForTableCell,
75159
75175
  applyFragmentFrame: applyFragmentFrameWithSection,
@@ -76473,19 +76489,40 @@ ${o}
76473
76489
  const attrs = item?.paragraph.attrs;
76474
76490
  return getSdtContainerKey(attrs?.sdt, attrs?.containerSdt);
76475
76491
  }
76492
+ if (fragment.kind === "table" && block.kind === "table") {
76493
+ const attrs = block.attrs;
76494
+ return getSdtContainerKey(attrs?.sdt, attrs?.containerSdt);
76495
+ }
76476
76496
  return null;
76477
76497
  };
76478
76498
  const computeSdtBoundaries = (fragments, blockLookup) => {
76479
76499
  const boundaries = /* @__PURE__ */ new Map();
76480
76500
  const containerKeys = fragments.map((fragment) => getFragmentSdtContainerKey(fragment, blockLookup));
76481
- for (let i2 = 0; i2 < fragments.length; i2 += 1) {
76501
+ let i2 = 0;
76502
+ while (i2 < fragments.length) {
76482
76503
  const currentKey = containerKeys[i2];
76483
- if (!currentKey) continue;
76484
- const prev = i2 > 0 ? containerKeys[i2 - 1] : null;
76485
- const next2 = i2 < fragments.length - 1 ? containerKeys[i2 + 1] : null;
76486
- const isStart = currentKey !== prev;
76487
- const isEnd = currentKey !== next2;
76488
- boundaries.set(i2, { isStart, isEnd });
76504
+ if (!currentKey) {
76505
+ i2 += 1;
76506
+ continue;
76507
+ }
76508
+ let groupRight = fragments[i2].x + fragments[i2].width;
76509
+ let j2 = i2;
76510
+ while (j2 + 1 < fragments.length && containerKeys[j2 + 1] === currentKey) {
76511
+ j2 += 1;
76512
+ const fragmentRight = fragments[j2].x + fragments[j2].width;
76513
+ if (fragmentRight > groupRight) {
76514
+ groupRight = fragmentRight;
76515
+ }
76516
+ }
76517
+ for (let k2 = i2; k2 <= j2; k2 += 1) {
76518
+ const fragment = fragments[k2];
76519
+ boundaries.set(k2, {
76520
+ isStart: k2 === i2,
76521
+ isEnd: k2 === j2,
76522
+ widthOverride: groupRight - fragment.x
76523
+ });
76524
+ }
76525
+ i2 = j2 + 1;
76489
76526
  }
76490
76527
  return boundaries;
76491
76528
  };
@@ -146900,7 +146937,7 @@ ${reason}`);
146900
146937
  this.config.colors = shuffleArray(this.config.colors);
146901
146938
  this.userColorMap = /* @__PURE__ */ new Map();
146902
146939
  this.colorIndex = 0;
146903
- this.version = "1.5.0-next.2";
146940
+ this.version = "1.5.0-next.4";
146904
146941
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
146905
146942
  this.superdocId = config2.superdocId || v4();
146906
146943
  this.colors = this.config.colors;