superdoc 1.0.0-beta.85 → 1.0.0-beta.87

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.
Files changed (27) hide show
  1. package/dist/chunks/{PdfViewer-CGlfOU3w.cjs → PdfViewer-Cwmc4rak.cjs} +1 -1
  2. package/dist/chunks/{PdfViewer-DKSowWMT.es.js → PdfViewer-DAayAt76.es.js} +1 -1
  3. package/dist/chunks/{index-B4I7N08F.es.js → index-BV2SxVfK.es.js} +3 -3
  4. package/dist/chunks/{index-nbBk8Xrw.cjs → index-huIbWXSg.cjs} +3 -3
  5. package/dist/chunks/{index-D8ciXlCs-B1Q8QwX8.cjs → index-rv7o9043-DD5SvBoC.cjs} +1 -1
  6. package/dist/chunks/{index-D8ciXlCs-CB0cgrGv.es.js → index-rv7o9043-DVlRSGhv.es.js} +1 -1
  7. package/dist/chunks/{super-editor.es-BblRVT7_.es.js → super-editor.es-BuujpqOr.es.js} +105 -13
  8. package/dist/chunks/{super-editor.es-Hkn9VlOX.cjs → super-editor.es-C43B4f8Z.cjs} +105 -13
  9. package/dist/super-editor/ai-writer.es.js +2 -2
  10. package/dist/super-editor/chunks/{converter-JgEU6dRK.js → converter-G519mwN2.js} +14 -8
  11. package/dist/super-editor/chunks/{docx-zipper-I9EOoeW0.js → docx-zipper-CHfjJ_h-.js} +1 -1
  12. package/dist/super-editor/chunks/{editor-tcvFrXO7.js → editor-BQsR9BR1.js} +93 -7
  13. package/dist/super-editor/chunks/{index-D8ciXlCs.js → index-rv7o9043.js} +1 -1
  14. package/dist/super-editor/chunks/{toolbar-CIlSwcI_.js → toolbar-DNfQq2Cl.js} +2 -2
  15. package/dist/super-editor/converter.es.js +1 -1
  16. package/dist/super-editor/docx-zipper.es.js +2 -2
  17. package/dist/super-editor/editor.es.js +3 -3
  18. package/dist/super-editor/file-zipper.es.js +1 -1
  19. package/dist/super-editor/super-editor.es.js +6 -6
  20. package/dist/super-editor/toolbar.es.js +2 -2
  21. package/dist/super-editor.cjs +1 -1
  22. package/dist/super-editor.es.js +1 -1
  23. package/dist/superdoc.cjs +2 -2
  24. package/dist/superdoc.es.js +2 -2
  25. package/dist/superdoc.umd.js +107 -15
  26. package/dist/superdoc.umd.js.map +1 -1
  27. package/package.json +1 -1
@@ -20311,6 +20311,7 @@
20311
20311
  params2,
20312
20312
  inlineParagraphProperties,
20313
20313
  insideTable,
20314
+ false,
20314
20315
  tableStyleId
20315
20316
  );
20316
20317
  const { elements = [], attributes = {}, marks = [] } = parseProperties(node2, params2.docx);
@@ -20999,7 +21000,9 @@
20999
21000
  (v2) => integerToString(v2)
21000
21001
  )
21001
21002
  );
21002
- const translator$Y = NodeTranslator.from(createSingleAttrPropertyHandler("w:vMerge"));
21003
+ const translator$Y = NodeTranslator.from(
21004
+ createSingleAttrPropertyHandler("w:vMerge", null, "w:val", (val) => !val ? "continue" : val)
21005
+ );
21003
21006
  const translator$X = NodeTranslator.from(createBorderPropertyHandler("w:end"));
21004
21007
  const translator$W = NodeTranslator.from(createMeasurementPropertyHandler("w:end", "marginEnd"));
21005
21008
  const translator$V = NodeTranslator.from(createBorderPropertyHandler("w:insideH"));
@@ -21378,11 +21381,12 @@
21378
21381
  delete tableCellProperties.vAlign;
21379
21382
  }
21380
21383
  const { rowspan } = attrs;
21381
- if (rowspan && rowspan > 1 && tableCellProperties.vMerge !== "restart") {
21384
+ const hasExistingVMerge = tableCellProperties.vMerge != null;
21385
+ if (rowspan && rowspan > 1) {
21382
21386
  tableCellProperties["vMerge"] = "restart";
21383
21387
  } else if (attrs.continueMerge) {
21384
21388
  tableCellProperties["vMerge"] = "continue";
21385
- } else if (tableCellProperties?.vMerge) {
21389
+ } else if (!hasExistingVMerge) {
21386
21390
  delete tableCellProperties.vMerge;
21387
21391
  }
21388
21392
  const { borders = {} } = attrs;
@@ -33472,12 +33476,14 @@
33472
33476
  if (cached) {
33473
33477
  return cached;
33474
33478
  }
33475
- const inTable = Boolean(findParentNodeClosestToPos($pos, (node22) => node22.type.name === "table"));
33479
+ const tableNode = findParentNodeClosestToPos($pos, (node22) => node22.type.name === "table");
33480
+ const tableStyleId = tableNode?.node.attrs.tableStyleId || null;
33476
33481
  const paragraphProperties = resolveParagraphProperties(
33477
33482
  { docx: editor.converter.convertedXml, numbering: editor.converter.numbering },
33478
33483
  node2.attrs.paragraphProperties || {},
33479
- inTable,
33480
- false
33484
+ Boolean(tableNode),
33485
+ false,
33486
+ tableStyleId
33481
33487
  );
33482
33488
  resolvedParagraphPropertiesCache.set(node2, paragraphProperties);
33483
33489
  return paragraphProperties;
@@ -38343,7 +38349,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
38343
38349
  const tblPr = styleTag.elements.find((el) => el.name === "w:tblPr");
38344
38350
  if (tblPr && tblPr.elements) {
38345
38351
  if (baseTblPr && baseTblPr.elements) {
38346
- tblPr.elements.push(...baseTblPr.elements);
38352
+ tblPr.elements = [...baseTblPr.elements, ...tblPr.elements];
38347
38353
  }
38348
38354
  const tableProperties = translator$c.encode({ ...params2, nodes: [tblPr] });
38349
38355
  if (tableProperties) {
@@ -42392,7 +42398,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
42392
42398
  static getStoredSuperdocVersion(docx) {
42393
42399
  return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
42394
42400
  }
42395
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.85") {
42401
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.87") {
42396
42402
  return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
42397
42403
  }
42398
42404
  /**
@@ -64415,6 +64421,23 @@ Please report this to https://github.com/markedjs/marked.`, e) {
64415
64421
  };
64416
64422
  }
64417
64423
  });
64424
+ const nodeAtEndPosition = doc2.nodeAt(endPos);
64425
+ if (nodeAtEndPosition?.type?.name === "run") {
64426
+ const node2 = nodeAtEndPosition.content?.content?.[0];
64427
+ const isTextNode = node2?.type?.name === "text";
64428
+ if (isTextNode) {
64429
+ const mark2 = node2.marks.find(
64430
+ (mark22) => mark22.type.name === markName && Object.keys(attrs).every((attr) => mark22.attrs[attr] === attrs[attr])
64431
+ );
64432
+ if (mark2 && !markFound) {
64433
+ markFound = {
64434
+ from: endPos,
64435
+ to: endPos + node2.nodeSize,
64436
+ mark: mark2
64437
+ };
64438
+ }
64439
+ }
64440
+ }
64418
64441
  return markFound;
64419
64442
  };
64420
64443
  const markInsertion = ({ tr, from: from2, to, user, date }) => {
@@ -67438,7 +67461,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
67438
67461
  const shouldSkipNodeView = (editor) => {
67439
67462
  return isHeadless(editor);
67440
67463
  };
67441
- const summaryVersion = "1.0.0-beta.85";
67464
+ const summaryVersion = "1.0.0-beta.87";
67442
67465
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
67443
67466
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
67444
67467
  function mapAttributes(attrs) {
@@ -68227,7 +68250,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
68227
68250
  { default: remarkStringify2 },
68228
68251
  { default: remarkGfm2 }
68229
68252
  ] = await Promise.all([
68230
- Promise.resolve().then(() => indexD8ciXlCs),
68253
+ Promise.resolve().then(() => indexRv7o9043),
68231
68254
  Promise.resolve().then(() => indexDRCvimau),
68232
68255
  Promise.resolve().then(() => indexC_x_N6Uh),
68233
68256
  Promise.resolve().then(() => indexD_sWOSiG),
@@ -68432,7 +68455,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
68432
68455
  * Process collaboration migrations
68433
68456
  */
68434
68457
  processCollaborationMigrations() {
68435
- console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.85");
68458
+ console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.87");
68436
68459
  if (!this.options.ydoc) return;
68437
68460
  const metaMap = this.options.ydoc.getMap("meta");
68438
68461
  let docVersion = metaMap.get("version");
@@ -71508,7 +71531,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
71508
71531
  let cellsChanged = false;
71509
71532
  const newCells = row2.cells.map((cell2) => {
71510
71533
  let cellChanged = false;
71511
- const hydratedBlocks = (cell2.blocks ?? (cell2.paragraph ? [cell2.paragraph] : [])).map((cb) => hydrateBlock(cb));
71534
+ const hydratedBlocks = (cell2.blocks ?? (cell2.paragraph ? [cell2.paragraph] : [])).map(
71535
+ (cb) => hydrateBlock(cb)
71536
+ );
71512
71537
  if (cell2.blocks && hydratedBlocks !== cell2.blocks) {
71513
71538
  cellChanged = true;
71514
71539
  }
@@ -71543,6 +71568,40 @@ Please report this to https://github.com/markedjs/marked.`, e) {
71543
71568
  }
71544
71569
  return blk;
71545
71570
  }
71571
+ if (blk.kind === "drawing") {
71572
+ const drawingBlock = blk;
71573
+ if (drawingBlock.drawingKind !== "shapeGroup") {
71574
+ return blk;
71575
+ }
71576
+ const shapeGroupBlock = drawingBlock;
71577
+ if (!shapeGroupBlock.shapes || shapeGroupBlock.shapes.length === 0) {
71578
+ return blk;
71579
+ }
71580
+ let shapesChanged = false;
71581
+ const hydratedShapes = shapeGroupBlock.shapes.map((shape) => {
71582
+ if (shape.shapeType !== "image") {
71583
+ return shape;
71584
+ }
71585
+ const imageChild = shape;
71586
+ const src = imageChild.attrs?.src;
71587
+ if (!src || src.startsWith("data:")) {
71588
+ return shape;
71589
+ }
71590
+ const resolvedSrc = resolveImageSrc(src);
71591
+ if (resolvedSrc) {
71592
+ shapesChanged = true;
71593
+ return {
71594
+ ...imageChild,
71595
+ attrs: { ...imageChild.attrs, src: resolvedSrc }
71596
+ };
71597
+ }
71598
+ return shape;
71599
+ });
71600
+ if (shapesChanged) {
71601
+ return { ...shapeGroupBlock, shapes: hydratedShapes };
71602
+ }
71603
+ return blk;
71604
+ }
71546
71605
  return blk;
71547
71606
  };
71548
71607
  return hydrateBlock(block);
@@ -81106,6 +81165,7 @@ ${l}
81106
81165
  cell: cell2,
81107
81166
  borders,
81108
81167
  renderLine,
81168
+ renderDrawingContent,
81109
81169
  context,
81110
81170
  applySdtDataset,
81111
81171
  fromLine,
@@ -81248,6 +81308,11 @@ ${l}
81248
81308
  img2.style.height = "100%";
81249
81309
  img2.style.objectFit = block.objectFit ?? "contain";
81250
81310
  drawingInner.appendChild(img2);
81311
+ } else if (renderDrawingContent) {
81312
+ const drawingContent = renderDrawingContent(block);
81313
+ drawingContent.style.width = "100%";
81314
+ drawingContent.style.height = "100%";
81315
+ drawingInner.appendChild(drawingContent);
81251
81316
  } else {
81252
81317
  const placeholder = doc2.createElement("div");
81253
81318
  placeholder.style.width = "100%";
@@ -81373,6 +81438,7 @@ ${l}
81373
81438
  allRowHeights,
81374
81439
  context,
81375
81440
  renderLine,
81441
+ renderDrawingContent,
81376
81442
  applySdtDataset,
81377
81443
  continuesFromPrev,
81378
81444
  continuesOnNext,
@@ -81469,6 +81535,7 @@ ${l}
81469
81535
  cell: cell2,
81470
81536
  borders: resolvedBorders,
81471
81537
  renderLine,
81538
+ renderDrawingContent,
81472
81539
  context,
81473
81540
  applySdtDataset,
81474
81541
  fromLine,
@@ -81522,7 +81589,17 @@ ${l}
81522
81589
  container.appendChild(labelEl);
81523
81590
  }
81524
81591
  const renderTableFragment = (deps) => {
81525
- const { doc: doc2, fragment, blockLookup, context, renderLine, applyFragmentFrame, applySdtDataset, applyStyles: applyStyles2 } = deps;
81592
+ const {
81593
+ doc: doc2,
81594
+ fragment,
81595
+ blockLookup,
81596
+ context,
81597
+ renderLine,
81598
+ renderDrawingContent,
81599
+ applyFragmentFrame,
81600
+ applySdtDataset,
81601
+ applyStyles: applyStyles2
81602
+ } = deps;
81526
81603
  if (!doc2) {
81527
81604
  console.error("DomPainter: document is not available");
81528
81605
  if (typeof document !== "undefined") {
@@ -81652,6 +81729,7 @@ ${l}
81652
81729
  allRowHeights,
81653
81730
  context,
81654
81731
  renderLine,
81732
+ renderDrawingContent,
81655
81733
  applySdtDataset,
81656
81734
  // Headers are always rendered as-is (no border suppression)
81657
81735
  continuesFromPrev: false,
@@ -81681,6 +81759,7 @@ ${l}
81681
81759
  allRowHeights,
81682
81760
  context,
81683
81761
  renderLine,
81762
+ renderDrawingContent,
81684
81763
  applySdtDataset,
81685
81764
  // Draw top border if table continues from previous fragment (MS Word behavior)
81686
81765
  continuesFromPrev: isFirstRenderedBodyRow && fragment.continuesFromPrev === true,
@@ -83923,12 +84002,25 @@ ${l}
83923
84002
  const renderLineForTableCell = (block, line, ctx2) => {
83924
84003
  return this.renderLine(block, line, ctx2, void 0, void 0, true);
83925
84004
  };
84005
+ const renderDrawingContentForTableCell = (block) => {
84006
+ if (block.drawingKind === "image") {
84007
+ return this.createDrawingImageElement(block);
84008
+ }
84009
+ if (block.drawingKind === "shapeGroup") {
84010
+ return this.createShapeGroupElement(block);
84011
+ }
84012
+ if (block.drawingKind === "vectorShape") {
84013
+ return this.createVectorShapeElement(block, block.geometry, false);
84014
+ }
84015
+ return this.createDrawingPlaceholder();
84016
+ };
83926
84017
  return renderTableFragment({
83927
84018
  doc: this.doc,
83928
84019
  fragment,
83929
84020
  context,
83930
84021
  blockLookup: this.blockLookup,
83931
84022
  renderLine: renderLineForTableCell,
84023
+ renderDrawingContent: renderDrawingContentForTableCell,
83932
84024
  applyFragmentFrame: applyFragmentFrameWithSection,
83933
84025
  applySdtDataset: this.applySdtDataset.bind(this),
83934
84026
  applyStyles: applyStyles$2
@@ -151301,7 +151393,7 @@ ${style2}
151301
151393
  this.config.colors = shuffleArray(this.config.colors);
151302
151394
  this.userColorMap = /* @__PURE__ */ new Map();
151303
151395
  this.colorIndex = 0;
151304
- this.version = "1.0.0-beta.85";
151396
+ this.version = "1.0.0-beta.87";
151305
151397
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
151306
151398
  this.superdocId = config2.superdocId || v4();
151307
151399
  this.colors = this.config.colors;
@@ -153773,7 +153865,7 @@ ${style2}
153773
153865
  value && typeof value === "object" && "byteLength" in value && "byteOffset" in value
153774
153866
  );
153775
153867
  }
153776
- const indexD8ciXlCs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
153868
+ const indexRv7o9043 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
153777
153869
  __proto__: null,
153778
153870
  unified
153779
153871
  }, Symbol.toStringTag, { value: "Module" }));