@harbour-enterprises/superdoc 1.0.0-beta.101 → 1.0.0-beta.103

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 (28) hide show
  1. package/dist/chunks/{PdfViewer-Cd9VR_tI.es.js → PdfViewer-Dbqwkn0G.es.js} +1 -1
  2. package/dist/chunks/{PdfViewer-DZWkMtTG.cjs → PdfViewer-S_8SIFPi.cjs} +1 -1
  3. package/dist/chunks/{index-BzQ_CQ_p.es.js → index-C5Rf8gqE.es.js} +3 -3
  4. package/dist/chunks/{index-BavMv0sW.cjs → index-D4NTCKO5.cjs} +3 -3
  5. package/dist/chunks/{index-N8gZUeSO-BneVBXkH.cjs → index-DQVMKA35-DwhGWytr.cjs} +1 -1
  6. package/dist/chunks/{index-N8gZUeSO-Dxit0pPr.es.js → index-DQVMKA35-xsiaflRZ.es.js} +1 -1
  7. package/dist/chunks/{super-editor.es-BGncr3MA.cjs → super-editor.es-CCmmUDjt.cjs} +264 -58
  8. package/dist/chunks/{super-editor.es-0IwuILla.es.js → super-editor.es-D6ttXPUE.es.js} +264 -58
  9. package/dist/packages/superdoc/src/core/SuperDoc.d.ts.map +1 -1
  10. package/dist/super-editor/ai-writer.es.js +2 -2
  11. package/dist/super-editor/chunks/{converter---tUwTA4.js → converter-CE9B4HYb.js} +12 -6
  12. package/dist/super-editor/chunks/{docx-zipper-B8zS8jbu.js → docx-zipper-Bt1IoMBF.js} +1 -1
  13. package/dist/super-editor/chunks/{editor-3H6s48L7.js → editor-DLjQOZqB.js} +250 -50
  14. package/dist/super-editor/chunks/{index-N8gZUeSO.js → index-DQVMKA35.js} +1 -1
  15. package/dist/super-editor/chunks/{toolbar-FxiK-_cI.js → toolbar-CqeJTLhO.js} +2 -2
  16. package/dist/super-editor/converter.es.js +1 -1
  17. package/dist/super-editor/docx-zipper.es.js +2 -2
  18. package/dist/super-editor/editor.es.js +3 -3
  19. package/dist/super-editor/file-zipper.es.js +1 -1
  20. package/dist/super-editor/super-editor.es.js +10 -10
  21. package/dist/super-editor/toolbar.es.js +2 -2
  22. package/dist/super-editor.cjs +1 -1
  23. package/dist/super-editor.es.js +1 -1
  24. package/dist/superdoc.cjs +2 -2
  25. package/dist/superdoc.es.js +2 -2
  26. package/dist/superdoc.umd.js +266 -60
  27. package/dist/superdoc.umd.js.map +1 -1
  28. package/package.json +1 -1
@@ -39793,7 +39793,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
39793
39793
  const trackedDeletedText = attributes["custom:trackedDeletedText"] !== "null" ? attributes["custom:trackedDeletedText"] : null;
39794
39794
  const date = new Date(createdDate);
39795
39795
  const unixTimestampMs = date.getTime();
39796
- const parsedComment = nodeListHandler.handler({
39796
+ const parsedElements = nodeListHandler.handler({
39797
39797
  nodes: el.elements,
39798
39798
  nodeListHandler,
39799
39799
  docx,
@@ -39801,7 +39801,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
39801
39801
  converter,
39802
39802
  path: [el]
39803
39803
  });
39804
- const { attrs } = parsedComment[0];
39804
+ const { attrs } = parsedElements[0];
39805
39805
  const paraId = attrs["w14:paraId"];
39806
39806
  return {
39807
39807
  commentId: internalId || v4$1(),
@@ -39809,7 +39809,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
39809
39809
  creatorName: authorName,
39810
39810
  creatorEmail: authorEmail,
39811
39811
  createdTime: unixTimestampMs,
39812
- textJson: parsedComment[0],
39812
+ textJson: parsedElements[0],
39813
+ elements: parsedElements,
39813
39814
  initials,
39814
39815
  paraId,
39815
39816
  trackedChange,
@@ -39835,7 +39836,12 @@ Please report this to https://github.com/markedjs/marked.`, e) {
39835
39836
  const { elements = [] } = initialElements[0] ?? {};
39836
39837
  const commentEx = elements.filter((el) => el.name === "w15:commentEx");
39837
39838
  return comments.map((comment2) => {
39838
- const extendedDef = commentEx.find((ce2) => ce2.attributes["w15:paraId"] === comment2.paraId);
39839
+ const extendedDef = commentEx.find((ce2) => {
39840
+ const isIncludedInCommentElements = comment2.elements?.some(
39841
+ (el) => el.attrs?.["w14:paraId"] === ce2.attributes["w15:paraId"]
39842
+ );
39843
+ return isIncludedInCommentElements;
39844
+ });
39839
39845
  if (!extendedDef) return { ...comment2, isDone: comment2.isDone ?? false };
39840
39846
  const { isDone, paraIdParent } = getExtendedDetails(extendedDef);
39841
39847
  let parentComment;
@@ -41956,7 +41962,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
41956
41962
  name: "w16cex:commentExtensible",
41957
41963
  attributes: {
41958
41964
  "w16cex:durableId": newDurableId,
41959
- "w16cex:dateUtc": toIsoNoFractional()
41965
+ "w16cex:dateUtc": toIsoNoFractional(comment2.createdTime)
41960
41966
  }
41961
41967
  };
41962
41968
  extensibleUpdated.elements[0].elements.push(newExtensible);
@@ -42422,7 +42428,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
42422
42428
  static getStoredSuperdocVersion(docx) {
42423
42429
  return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
42424
42430
  }
42425
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.101") {
42431
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.103") {
42426
42432
  return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
42427
42433
  }
42428
42434
  /**
@@ -62675,6 +62681,14 @@ Please report this to https://github.com/markedjs/marked.`, e) {
62675
62681
  const selectAll = () => ({ state: state2, dispatch }) => selectAll$1(state2, dispatch);
62676
62682
  const deleteSelection = () => ({ state: state2, tr, dispatch }) => {
62677
62683
  const { from: from2, to, empty: empty2 } = state2.selection;
62684
+ if (typeof document !== "undefined" && document.getSelection) {
62685
+ const currentDomSelection = document.getSelection();
62686
+ const selectedLength = currentDomSelection?.toString?.().length;
62687
+ const isCollapsed = currentDomSelection?.isCollapsed;
62688
+ if (!isCollapsed && selectedLength === 1) {
62689
+ return false;
62690
+ }
62691
+ }
62678
62692
  if (empty2) {
62679
62693
  return deleteSelection$1(state2, dispatch);
62680
62694
  }
@@ -64974,12 +64988,14 @@ Please report this to https://github.com/markedjs/marked.`, e) {
64974
64988
  importedId: node2.attrs["w:id"]
64975
64989
  });
64976
64990
  if (type2.name === "commentRangeStart") {
64977
- toMark.push({
64978
- commentId: resolvedCommentId,
64979
- importedId,
64980
- internal,
64981
- start: pos
64982
- });
64991
+ if (!matchingImportedComment?.isDone) {
64992
+ toMark.push({
64993
+ commentId: resolvedCommentId,
64994
+ importedId,
64995
+ internal,
64996
+ start: pos
64997
+ });
64998
+ }
64983
64999
  ensureFallbackComment({
64984
65000
  converter,
64985
65001
  matchingImportedComment,
@@ -67497,7 +67513,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
67497
67513
  const shouldSkipNodeView = (editor) => {
67498
67514
  return isHeadless(editor);
67499
67515
  };
67500
- const summaryVersion = "1.0.0-beta.101";
67516
+ const summaryVersion = "1.0.0-beta.103";
67501
67517
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
67502
67518
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
67503
67519
  function mapAttributes(attrs) {
@@ -67857,11 +67873,11 @@ Please report this to https://github.com/markedjs/marked.`, e) {
67857
67873
  if (!this.options.isNewFile || !this.options.collaborationProvider) return;
67858
67874
  const provider2 = this.options.collaborationProvider;
67859
67875
  const postSyncInit = () => {
67860
- provider2.off("synced", postSyncInit);
67876
+ provider2.off?.("synced", postSyncInit);
67861
67877
  __privateMethod$1(this, _Editor_instances, insertNewFileData_fn).call(this);
67862
67878
  };
67863
67879
  if (provider2.synced) __privateMethod$1(this, _Editor_instances, insertNewFileData_fn).call(this);
67864
- else provider2.on("synced", postSyncInit);
67880
+ else provider2.on?.("synced", postSyncInit);
67865
67881
  }
67866
67882
  /**
67867
67883
  * Replace content of editor that was created with loadFromSchema option
@@ -68286,7 +68302,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
68286
68302
  { default: remarkStringify2 },
68287
68303
  { default: remarkGfm2 }
68288
68304
  ] = await Promise.all([
68289
- Promise.resolve().then(() => indexN8gZUeSO),
68305
+ Promise.resolve().then(() => indexDQVMKA35),
68290
68306
  Promise.resolve().then(() => indexDRCvimau),
68291
68307
  Promise.resolve().then(() => indexC_x_N6Uh),
68292
68308
  Promise.resolve().then(() => indexD_sWOSiG),
@@ -68491,7 +68507,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
68491
68507
  * Process collaboration migrations
68492
68508
  */
68493
68509
  processCollaborationMigrations() {
68494
- console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.101");
68510
+ console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.103");
68495
68511
  if (!this.options.ydoc) return;
68496
68512
  const metaMap = this.options.ydoc.getMap("meta");
68497
68513
  let docVersion = metaMap.get("version");
@@ -71606,6 +71622,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
71606
71622
  if (cellChanged) {
71607
71623
  return {
71608
71624
  ...cell2,
71625
+ // Cast to expected type - hydrateBlock preserves block kinds, just hydrates image sources
71609
71626
  blocks: hydratedBlocks.length > 0 ? hydratedBlocks : cell2.blocks,
71610
71627
  paragraph: hydratedParagraph
71611
71628
  };
@@ -75226,7 +75243,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
75226
75243
  };
75227
75244
  }
75228
75245
  const hasValidNumbering = rawNumberingProps && isValidNumberingId(rawNumberingProps.numId);
75229
- if (hasValidNumbering) {
75246
+ if (hasValidNumbering && rawNumberingProps) {
75230
75247
  const numberingProps = rawNumberingProps;
75231
75248
  const numId = numberingProps.numId;
75232
75249
  const ilvl = Number.isFinite(numberingProps.ilvl) ? Math.max(0, Math.floor(Number(numberingProps.ilvl))) : 0;
@@ -75266,6 +75283,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
75266
75283
  const resolvedCounterValue = path2[path2.length - 1] ?? counterValue;
75267
75284
  const enrichedNumberingProps = {
75268
75285
  ...numberingProps,
75286
+ numId: numberingProps.numId,
75287
+ ilvl: numberingProps.ilvl,
75269
75288
  path: path2,
75270
75289
  counterValue: resolvedCounterValue
75271
75290
  };
@@ -77362,7 +77381,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
77362
77381
  context.nextBlockId,
77363
77382
  context.positions
77364
77383
  );
77365
- if (drawingBlock) {
77384
+ if (drawingBlock && drawingBlock.kind === "drawing") {
77366
77385
  blocks2.push(drawingBlock);
77367
77386
  }
77368
77387
  continue;
@@ -77373,7 +77392,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
77373
77392
  context.nextBlockId,
77374
77393
  context.positions
77375
77394
  );
77376
- if (drawingBlock) {
77395
+ if (drawingBlock && drawingBlock.kind === "drawing") {
77377
77396
  blocks2.push(drawingBlock);
77378
77397
  }
77379
77398
  continue;
@@ -77384,7 +77403,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
77384
77403
  context.nextBlockId,
77385
77404
  context.positions
77386
77405
  );
77387
- if (drawingBlock) {
77406
+ if (drawingBlock && drawingBlock.kind === "drawing") {
77388
77407
  blocks2.push(drawingBlock);
77389
77408
  }
77390
77409
  continue;
@@ -77395,7 +77414,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
77395
77414
  context.nextBlockId,
77396
77415
  context.positions
77397
77416
  );
77398
- if (drawingBlock) {
77417
+ if (drawingBlock && drawingBlock.kind === "drawing") {
77399
77418
  blocks2.push(drawingBlock);
77400
77419
  }
77401
77420
  }
@@ -77850,7 +77869,19 @@ Please report this to https://github.com/markedjs/marked.`, e) {
77850
77869
  bookmarks2,
77851
77870
  hyperlinkConfig2,
77852
77871
  themeColorsParam ?? themeColors,
77853
- paragraphConverter
77872
+ paragraphConverter,
77873
+ converterCtx ?? converterContext,
77874
+ {
77875
+ listCounterContext: { getListCounter, incrementListCounter, resetListCounter },
77876
+ converters: {
77877
+ paragraphToFlowBlocks: paragraphConverter,
77878
+ imageNodeToBlock,
77879
+ vectorShapeNodeToDrawingBlock,
77880
+ shapeGroupNodeToDrawingBlock,
77881
+ shapeContainerNodeToDrawingBlock,
77882
+ shapeTextboxNodeToDrawingBlock
77883
+ }
77884
+ }
77854
77885
  );
77855
77886
  const handlerContext = {
77856
77887
  blocks: blocks2,
@@ -77871,6 +77902,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
77871
77902
  currentParagraphIndex: 0
77872
77903
  },
77873
77904
  converters: {
77905
+ // Type assertion needed due to signature mismatch between actual function and type definition
77874
77906
  paragraphToFlowBlocks: paragraphConverter,
77875
77907
  tableNodeToBlock: tableConverter,
77876
77908
  imageNodeToBlock,
@@ -77966,6 +77998,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
77966
77998
  {
77967
77999
  listCounterContext,
77968
78000
  converters: {
78001
+ // Type assertion needed due to signature mismatch between actual function and type definition
77969
78002
  paragraphToFlowBlocks: paragraphToFlowBlocks$1,
77970
78003
  imageNodeToBlock,
77971
78004
  vectorShapeNodeToDrawingBlock,
@@ -77979,7 +78012,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
77979
78012
  converterContext
77980
78013
  );
77981
78014
  }
77982
- function tableNodeToBlock(node2, nextBlockId, positions, defaultFont, defaultSize, styleContext, trackedChanges, bookmarks, hyperlinkConfig, themeColors, converterContext) {
78015
+ function tableNodeToBlock(node2, nextBlockId, positions, defaultFont, defaultSize, styleContext, trackedChanges, bookmarks, hyperlinkConfig, themeColors, _paragraphToFlowBlocksParam, converterContext, options) {
77983
78016
  return tableNodeToBlock$1(
77984
78017
  node2,
77985
78018
  nextBlockId,
@@ -77993,8 +78026,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
77993
78026
  themeColors,
77994
78027
  paragraphToFlowBlocks,
77995
78028
  converterContext,
77996
- {
78029
+ options ?? {
77997
78030
  converters: {
78031
+ // Type assertion needed due to signature mismatch between actual function and type definition
77998
78032
  paragraphToFlowBlocks: paragraphToFlowBlocks$1,
77999
78033
  imageNodeToBlock,
78000
78034
  vectorShapeNodeToDrawingBlock,
@@ -82298,6 +82332,49 @@ ${l}
82298
82332
  if (borders.left) parts.push(`l:[${hashParagraphBorder$1(borders.left)}]`);
82299
82333
  return parts.join(";");
82300
82334
  };
82335
+ const isNoneBorder$1 = (value) => {
82336
+ return typeof value === "object" && value !== null && "none" in value && value.none === true;
82337
+ };
82338
+ const isBorderSpec$1 = (value) => {
82339
+ return typeof value === "object" && value !== null && !("none" in value);
82340
+ };
82341
+ const hashBorderSpec$1 = (border) => {
82342
+ const parts = [];
82343
+ if (border.style !== void 0) parts.push(`s:${border.style}`);
82344
+ if (border.width !== void 0) parts.push(`w:${border.width}`);
82345
+ if (border.color !== void 0) parts.push(`c:${border.color}`);
82346
+ if (border.space !== void 0) parts.push(`sp:${border.space}`);
82347
+ return parts.join(",");
82348
+ };
82349
+ const hashTableBorderValue$1 = (borderValue) => {
82350
+ if (borderValue === void 0) return "";
82351
+ if (borderValue === null) return "null";
82352
+ if (isNoneBorder$1(borderValue)) return "none";
82353
+ if (isBorderSpec$1(borderValue)) {
82354
+ return hashBorderSpec$1(borderValue);
82355
+ }
82356
+ return "";
82357
+ };
82358
+ const hashTableBorders$1 = (borders) => {
82359
+ if (!borders) return "";
82360
+ const parts = [];
82361
+ if (borders.top !== void 0) parts.push(`t:[${hashTableBorderValue$1(borders.top)}]`);
82362
+ if (borders.right !== void 0) parts.push(`r:[${hashTableBorderValue$1(borders.right)}]`);
82363
+ if (borders.bottom !== void 0) parts.push(`b:[${hashTableBorderValue$1(borders.bottom)}]`);
82364
+ if (borders.left !== void 0) parts.push(`l:[${hashTableBorderValue$1(borders.left)}]`);
82365
+ if (borders.insideH !== void 0) parts.push(`ih:[${hashTableBorderValue$1(borders.insideH)}]`);
82366
+ if (borders.insideV !== void 0) parts.push(`iv:[${hashTableBorderValue$1(borders.insideV)}]`);
82367
+ return parts.join(";");
82368
+ };
82369
+ const hashCellBorders$1 = (borders) => {
82370
+ if (!borders) return "";
82371
+ const parts = [];
82372
+ if (borders.top) parts.push(`t:[${hashBorderSpec$1(borders.top)}]`);
82373
+ if (borders.right) parts.push(`r:[${hashBorderSpec$1(borders.right)}]`);
82374
+ if (borders.bottom) parts.push(`b:[${hashBorderSpec$1(borders.bottom)}]`);
82375
+ if (borders.left) parts.push(`l:[${hashBorderSpec$1(borders.left)}]`);
82376
+ return parts.join(";");
82377
+ };
82301
82378
  const hasStringProp = (run2, prop) => {
82302
82379
  return prop in run2 && typeof run2[prop] === "string";
82303
82380
  };
@@ -85513,6 +85590,25 @@ ${l}
85513
85590
  hash2 = hashNumber(hash2, cellBlocks.length);
85514
85591
  hash2 = hashNumber(hash2, cell2.rowSpan ?? 1);
85515
85592
  hash2 = hashNumber(hash2, cell2.colSpan ?? 1);
85593
+ if (cell2.attrs) {
85594
+ const cellAttrs = cell2.attrs;
85595
+ if (cellAttrs.borders) {
85596
+ hash2 = hashString(hash2, hashCellBorders$1(cellAttrs.borders));
85597
+ }
85598
+ if (cellAttrs.padding) {
85599
+ const p2 = cellAttrs.padding;
85600
+ hash2 = hashNumber(hash2, p2.top ?? 0);
85601
+ hash2 = hashNumber(hash2, p2.right ?? 0);
85602
+ hash2 = hashNumber(hash2, p2.bottom ?? 0);
85603
+ hash2 = hashNumber(hash2, p2.left ?? 0);
85604
+ }
85605
+ if (cellAttrs.verticalAlign) {
85606
+ hash2 = hashString(hash2, cellAttrs.verticalAlign);
85607
+ }
85608
+ if (cellAttrs.background) {
85609
+ hash2 = hashString(hash2, cellAttrs.background);
85610
+ }
85611
+ }
85516
85612
  for (const cellBlock of cellBlocks) {
85517
85613
  hash2 = hashString(hash2, cellBlock?.kind ?? "unknown");
85518
85614
  if (cellBlock?.kind === "paragraph") {
@@ -85558,6 +85654,18 @@ ${l}
85558
85654
  }
85559
85655
  }
85560
85656
  }
85657
+ if (tableBlock.attrs) {
85658
+ const tblAttrs = tableBlock.attrs;
85659
+ if (tblAttrs.borders) {
85660
+ hash2 = hashString(hash2, hashTableBorders$1(tblAttrs.borders));
85661
+ }
85662
+ if (tblAttrs.borderCollapse) {
85663
+ hash2 = hashString(hash2, tblAttrs.borderCollapse);
85664
+ }
85665
+ if (tblAttrs.cellSpacing !== void 0) {
85666
+ hash2 = hashNumber(hash2, tblAttrs.cellSpacing);
85667
+ }
85668
+ }
85561
85669
  return [block.id, tableBlock.rows.length, hash2.toString(16)].join("|");
85562
85670
  }
85563
85671
  return block.id;
@@ -86310,7 +86418,7 @@ ${l}
86310
86418
  return false;
86311
86419
  }
86312
86420
  const wordLayout = getWordLayoutConfig(block);
86313
- const hasListAttrs = block.attrs?.listItem != null || wordLayout?.marker != null;
86421
+ const hasListAttrs = block.attrs?.listItem != null || block.attrs?.numberingProperties != null || wordLayout?.marker != null;
86314
86422
  if (hasListAttrs) {
86315
86423
  return true;
86316
86424
  }
@@ -89296,6 +89404,49 @@ ${l}
89296
89404
  if (borders.left) parts.push(`l:[${hashParagraphBorder(borders.left)}]`);
89297
89405
  return parts.join(";");
89298
89406
  };
89407
+ function isNoneBorder(value) {
89408
+ return typeof value === "object" && value !== null && "none" in value && value.none === true;
89409
+ }
89410
+ function isBorderSpec(value) {
89411
+ return typeof value === "object" && value !== null && !("none" in value);
89412
+ }
89413
+ const hashBorderSpec = (border) => {
89414
+ const parts = [];
89415
+ if (border.style !== void 0) parts.push(`s:${border.style}`);
89416
+ if (border.width !== void 0) parts.push(`w:${border.width}`);
89417
+ if (border.color !== void 0) parts.push(`c:${border.color}`);
89418
+ if (border.space !== void 0) parts.push(`sp:${border.space}`);
89419
+ return parts.join(",");
89420
+ };
89421
+ const hashTableBorderValue = (borderValue) => {
89422
+ if (borderValue === void 0) return "";
89423
+ if (borderValue === null) return "null";
89424
+ if (isNoneBorder(borderValue)) return "none";
89425
+ if (isBorderSpec(borderValue)) {
89426
+ return hashBorderSpec(borderValue);
89427
+ }
89428
+ return "";
89429
+ };
89430
+ const hashTableBorders = (borders) => {
89431
+ if (!borders) return "";
89432
+ const parts = [];
89433
+ if (borders.top !== void 0) parts.push(`t:[${hashTableBorderValue(borders.top)}]`);
89434
+ if (borders.right !== void 0) parts.push(`r:[${hashTableBorderValue(borders.right)}]`);
89435
+ if (borders.bottom !== void 0) parts.push(`b:[${hashTableBorderValue(borders.bottom)}]`);
89436
+ if (borders.left !== void 0) parts.push(`l:[${hashTableBorderValue(borders.left)}]`);
89437
+ if (borders.insideH !== void 0) parts.push(`ih:[${hashTableBorderValue(borders.insideH)}]`);
89438
+ if (borders.insideV !== void 0) parts.push(`iv:[${hashTableBorderValue(borders.insideV)}]`);
89439
+ return parts.join(";");
89440
+ };
89441
+ const hashCellBorders = (borders) => {
89442
+ if (!borders) return "";
89443
+ const parts = [];
89444
+ if (borders.top) parts.push(`t:[${hashBorderSpec(borders.top)}]`);
89445
+ if (borders.right) parts.push(`r:[${hashBorderSpec(borders.right)}]`);
89446
+ if (borders.bottom) parts.push(`b:[${hashBorderSpec(borders.bottom)}]`);
89447
+ if (borders.left) parts.push(`l:[${hashBorderSpec(borders.left)}]`);
89448
+ return parts.join(";");
89449
+ };
89299
89450
  const MAX_CACHE_SIZE$1 = 1e4;
89300
89451
  const BYTES_PER_ENTRY_ESTIMATE = 5e3;
89301
89452
  const NORMALIZED_WHITESPACE = /\s+/g;
@@ -89323,6 +89474,26 @@ ${l}
89323
89474
  continue;
89324
89475
  }
89325
89476
  for (const cell2 of row2.cells) {
89477
+ if (cell2.attrs) {
89478
+ const cellAttrs = cell2.attrs;
89479
+ const cellAttrParts = [];
89480
+ if (cellAttrs.borders) {
89481
+ cellAttrParts.push(`cb:${hashCellBorders(cellAttrs.borders)}`);
89482
+ }
89483
+ if (cellAttrs.padding) {
89484
+ const p2 = cellAttrs.padding;
89485
+ cellAttrParts.push(`cp:${p2.top ?? 0}:${p2.right ?? 0}:${p2.bottom ?? 0}:${p2.left ?? 0}`);
89486
+ }
89487
+ if (cellAttrs.verticalAlign) {
89488
+ cellAttrParts.push(`va:${cellAttrs.verticalAlign}`);
89489
+ }
89490
+ if (cellAttrs.background) {
89491
+ cellAttrParts.push(`bg:${cellAttrs.background}`);
89492
+ }
89493
+ if (cellAttrParts.length > 0) {
89494
+ cellHashes.push(`ca:${cellAttrParts.join(":")}`);
89495
+ }
89496
+ }
89326
89497
  const cellBlocks = cell2.blocks ?? (cell2.paragraph ? [cell2.paragraph] : []);
89327
89498
  for (const cellBlock of cellBlocks) {
89328
89499
  const paragraphBlock = cellBlock;
@@ -89389,8 +89560,25 @@ ${l}
89389
89560
  }
89390
89561
  }
89391
89562
  }
89563
+ let tableAttrsKey = "";
89564
+ if (tableBlock.attrs) {
89565
+ const tblAttrs = tableBlock.attrs;
89566
+ const tableAttrParts = [];
89567
+ if (tblAttrs.borders) {
89568
+ tableAttrParts.push(`tb:${hashTableBorders(tblAttrs.borders)}`);
89569
+ }
89570
+ if (tblAttrs.borderCollapse) {
89571
+ tableAttrParts.push(`bc:${tblAttrs.borderCollapse}`);
89572
+ }
89573
+ if (tblAttrs.cellSpacing !== void 0) {
89574
+ tableAttrParts.push(`cs:${tblAttrs.cellSpacing}`);
89575
+ }
89576
+ if (tableAttrParts.length > 0) {
89577
+ tableAttrsKey = `|ta:${tableAttrParts.join(":")}`;
89578
+ }
89579
+ }
89392
89580
  const contentHash = cellHashes.join("|");
89393
- return `${block.id}:table:${contentHash}`;
89581
+ return `${block.id}:table:${contentHash}${tableAttrsKey}`;
89394
89582
  }
89395
89583
  if (block.kind !== "paragraph") return block.id;
89396
89584
  const trackedMode = block.attrs && "trackedChangesMode" in block.attrs && block.attrs.trackedChangesMode || "review";
@@ -93622,7 +93810,7 @@ ${l}
93622
93810
  const wordEndWithSpace = charPosInRun + (isLastWord ? word.length : word.length + 1);
93623
93811
  const effectiveMaxWidth = currentLine ? currentLine.maxWidth : getEffectiveWidth(lines.length === 0 ? initialAvailableWidth : contentWidth);
93624
93812
  if (wordOnlyWidth > effectiveMaxWidth && word.length > 1) {
93625
- if (currentLine && currentLine.width > 0 && currentLine.segments.length > 0) {
93813
+ if (currentLine && currentLine.width > 0 && currentLine.segments && currentLine.segments.length > 0) {
93626
93814
  const metrics = calculateTypographyMetrics(currentLine.maxFontSize, spacing, currentLine.maxFontInfo);
93627
93815
  const { spaceCount: _sc, ...lineBase } = currentLine;
93628
93816
  const completedLine = { ...lineBase, ...metrics };
@@ -93633,7 +93821,7 @@ ${l}
93633
93821
  currentLine = null;
93634
93822
  }
93635
93823
  const lineMaxWidth = getEffectiveWidth(lines.length === 0 ? initialAvailableWidth : contentWidth);
93636
- const hasTabOnlyLine = currentLine && currentLine.segments.length === 0 && currentLine.width > 0;
93824
+ const hasTabOnlyLine = currentLine && currentLine.segments && currentLine.segments.length === 0 && currentLine.width > 0;
93637
93825
  const remainingWidthAfterTab = hasTabOnlyLine ? currentLine.maxWidth - currentLine.width : lineMaxWidth;
93638
93826
  const chunkWidth = hasTabOnlyLine ? Math.max(remainingWidthAfterTab, lineMaxWidth * 0.25) : lineMaxWidth;
93639
93827
  const chunks = breakWordIntoChunks(word, chunkWidth - WIDTH_FUDGE_PX2, font, ctx2, run2);
@@ -93644,7 +93832,7 @@ ${l}
93644
93832
  const chunkEndChar = chunkCharOffset + chunk.text.length;
93645
93833
  const isLastChunk = chunkIndex === chunks.length - 1;
93646
93834
  const isFirstChunk = chunkIndex === 0;
93647
- if (isFirstChunk && hasTabOnlyLine && currentLine) {
93835
+ if (isFirstChunk && hasTabOnlyLine && currentLine && currentLine.segments) {
93648
93836
  currentLine.toRun = runIndex;
93649
93837
  currentLine.toChar = chunkEndChar;
93650
93838
  currentLine.width = roundValue(currentLine.width + chunk.width);
@@ -97881,18 +98069,19 @@ ${l}
97881
98069
  const normalized = /* @__PURE__ */ new Map();
97882
98070
  states?.forEach((aw, clientId) => {
97883
98071
  if (clientId === provider2.awareness?.clientID) return;
97884
- if (!aw.cursor) return;
98072
+ const awState = aw;
98073
+ if (!awState.cursor) return;
97885
98074
  try {
97886
98075
  const anchor = relativePositionToAbsolutePosition(
97887
98076
  ystate.doc,
97888
98077
  ystate.type,
97889
- Y__namespace.createRelativePositionFromJSON(aw.cursor.anchor),
98078
+ Y__namespace.createRelativePositionFromJSON(awState.cursor.anchor),
97890
98079
  ystate.binding.mapping
97891
98080
  );
97892
98081
  const head = relativePositionToAbsolutePosition(
97893
98082
  ystate.doc,
97894
98083
  ystate.type,
97895
- Y__namespace.createRelativePositionFromJSON(aw.cursor.head),
98084
+ Y__namespace.createRelativePositionFromJSON(awState.cursor.head),
97896
98085
  ystate.binding.mapping
97897
98086
  );
97898
98087
  if (anchor === null || head === null) return;
@@ -97904,9 +98093,9 @@ ${l}
97904
98093
  normalized.set(clientId, {
97905
98094
  clientId,
97906
98095
  user: {
97907
- name: aw.user?.name,
97908
- email: aw.user?.email,
97909
- color: aw.user?.color || __privateMethod$1(this, _PresentationEditor_instances, getFallbackColor_fn).call(this, clientId)
98096
+ name: awState.user?.name,
98097
+ email: awState.user?.email,
98098
+ color: awState.user?.color || __privateMethod$1(this, _PresentationEditor_instances, getFallbackColor_fn).call(this, clientId)
97910
98099
  },
97911
98100
  anchor: clampedAnchor,
97912
98101
  head: clampedHead,
@@ -100380,8 +100569,8 @@ ${l}
100380
100569
  const zoom2 = __privateGet$1(this, _layoutOptions).zoom ?? 1;
100381
100570
  let domCaretX2 = null;
100382
100571
  let domCaretY2 = null;
100383
- const spanEls2 = pageEl2?.querySelectorAll("span[data-pm-start][data-pm-end]") ?? [];
100384
- for (const spanEl of spanEls2) {
100572
+ const spanEls2 = pageEl2?.querySelectorAll("span[data-pm-start][data-pm-end]");
100573
+ for (const spanEl of Array.from(spanEls2 ?? [])) {
100385
100574
  const pmStart = Number(spanEl.dataset.pmStart);
100386
100575
  const pmEnd = Number(spanEl.dataset.pmEnd);
100387
100576
  if (pos >= pmStart && pos <= pmEnd && spanEl.firstChild?.nodeType === Node.TEXT_NODE) {
@@ -100433,8 +100622,8 @@ ${l}
100433
100622
  const zoom = __privateGet$1(this, _layoutOptions).zoom ?? 1;
100434
100623
  let domCaretX = null;
100435
100624
  let domCaretY = null;
100436
- const spanEls = pageEl?.querySelectorAll("span[data-pm-start][data-pm-end]") ?? [];
100437
- for (const spanEl of spanEls) {
100625
+ const spanEls = pageEl?.querySelectorAll("span[data-pm-start][data-pm-end]");
100626
+ for (const spanEl of Array.from(spanEls ?? [])) {
100438
100627
  const pmStart = Number(spanEl.dataset.pmStart);
100439
100628
  const pmEnd = Number(spanEl.dataset.pmEnd);
100440
100629
  if (pos >= pmStart && pos <= pmEnd && spanEl.firstChild?.nodeType === Node.TEXT_NODE) {
@@ -106003,14 +106192,19 @@ ${l}
106003
106192
  }
106004
106193
  return cellType.createAndFill();
106005
106194
  };
106006
- const createTableBorders = ({ size: size2 = 0.66665, color: color2 = "#000000" } = {}) => {
106195
+ const createTableBorders = (borderSpec = {}) => {
106196
+ borderSpec = {
106197
+ size: 0.66665,
106198
+ color: "#000000",
106199
+ ...borderSpec
106200
+ };
106007
106201
  return {
106008
- top: { size: size2, color: color2 },
106009
- left: { size: size2, color: color2 },
106010
- bottom: { size: size2, color: color2 },
106011
- right: { size: size2, color: color2 },
106012
- insideH: { size: size2, color: color2 },
106013
- insideV: { size: size2, color: color2 }
106202
+ top: borderSpec,
106203
+ left: borderSpec,
106204
+ bottom: borderSpec,
106205
+ right: borderSpec,
106206
+ insideH: borderSpec,
106207
+ insideV: borderSpec
106014
106208
  };
106015
106209
  };
106016
106210
  const createTable = (schema, rowsCount, colsCount, withHeaderRow, cellContent = null) => {
@@ -106138,12 +106332,17 @@ ${l}
106138
106332
  editor.commands.deleteTable();
106139
106333
  return true;
106140
106334
  };
106141
- const createCellBorders = ({ size: size2 = 0.66665, color: color2 = "#000000" } = {}) => {
106335
+ const createCellBorders = (borderSpec = {}) => {
106336
+ borderSpec = {
106337
+ size: 0.66665,
106338
+ color: "#000000",
106339
+ ...borderSpec
106340
+ };
106142
106341
  return {
106143
- top: { size: size2, color: color2 },
106144
- left: { size: size2, color: color2 },
106145
- bottom: { size: size2, color: color2 },
106146
- right: { size: size2, color: color2 }
106342
+ top: borderSpec,
106343
+ left: borderSpec,
106344
+ bottom: borderSpec,
106345
+ right: borderSpec
106147
106346
  };
106148
106347
  };
106149
106348
  function cellAround($pos) {
@@ -106910,13 +107109,20 @@ ${l}
106910
107109
  if (["tableCell", "tableHeader"].includes(node2.type.name)) {
106911
107110
  tr.setNodeMarkup(pos, void 0, {
106912
107111
  ...node2.attrs,
106913
- borders: createCellBorders({ size: 0 })
107112
+ borders: createCellBorders({ size: 0, space: 0, val: "none", color: "auto" })
106914
107113
  });
106915
107114
  }
106916
107115
  });
106917
107116
  tr.setNodeMarkup(table2.pos, void 0, {
106918
107117
  ...table2.node.attrs,
106919
- borders: createTableBorders({ size: 0 })
107118
+ borders: createTableBorders({ size: 0 }),
107119
+ // TODO: This works around the issue that table borders are duplicated between
107120
+ // the attributes of the table and the tableProperties attribute.
107121
+ // This can be removed when the redundancy is eliminated.
107122
+ tableProperties: {
107123
+ ...table2.node.attrs.tableProperties,
107124
+ borders: createTableBorders({ size: 0, space: 0, val: "none", color: "auto" })
107125
+ }
106920
107126
  });
106921
107127
  return true;
106922
107128
  }
@@ -130918,7 +131124,7 @@ ${style2}
130918
131124
  }
130919
131125
  },
130920
131126
  {
130921
- label: toolbarTexts2.transparentBorders,
131127
+ label: toolbarTexts2.removeBorders,
130922
131128
  command: "deleteCellAndTableBorders",
130923
131129
  icon: toolbarIcons2.deleteBorders,
130924
131130
  bottomBorder: true,
@@ -131499,7 +131705,7 @@ ${style2}
131499
131705
  deleteRow: "Delete row",
131500
131706
  deleteColumn: "Delete column",
131501
131707
  deleteTable: "Delete table",
131502
- transparentBorders: "Transparent borders",
131708
+ removeBorders: "Remove borders",
131503
131709
  mergeCells: "Merge cells",
131504
131710
  splitCell: "Split cell",
131505
131711
  fixTables: "Fix tables",
@@ -132537,7 +132743,7 @@ ${style2}
132537
132743
  deleteRow: "Delete row",
132538
132744
  deleteColumn: "Delete column",
132539
132745
  deleteTable: "Delete table",
132540
- transparentBorders: "Transparent borders",
132746
+ removeBorders: "Remove borders",
132541
132747
  mergeCells: "Merge cells",
132542
132748
  splitCell: "Split cell",
132543
132749
  fixTables: "Fix tables",
@@ -132620,7 +132826,7 @@ ${style2}
132620
132826
  }
132621
132827
  },
132622
132828
  {
132623
- label: TEXTS.transparentBorders,
132829
+ label: TEXTS.removeBorders,
132624
132830
  command: "deleteCellAndTableBorders",
132625
132831
  icon: ICONS.deleteBorders,
132626
132832
  bottomBorder: true,
@@ -152765,7 +152971,7 @@ ${style2}
152765
152971
  this.config.colors = shuffleArray(this.config.colors);
152766
152972
  this.userColorMap = /* @__PURE__ */ new Map();
152767
152973
  this.colorIndex = 0;
152768
- this.version = "1.0.0-beta.101";
152974
+ this.version = "1.0.0-beta.103";
152769
152975
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
152770
152976
  this.superdocId = config2.superdocId || v4();
152771
152977
  this.colors = this.config.colors;
@@ -155237,7 +155443,7 @@ ${style2}
155237
155443
  value && typeof value === "object" && "byteLength" in value && "byteOffset" in value
155238
155444
  );
155239
155445
  }
155240
- const indexN8gZUeSO = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
155446
+ const indexDQVMKA35 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
155241
155447
  __proto__: null,
155242
155448
  unified
155243
155449
  }, Symbol.toStringTag, { value: "Module" }));