@harbour-enterprises/superdoc 1.3.1-next.2 → 1.4.0-next.1

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 (58) hide show
  1. package/dist/chunks/{PdfViewer-B0cx-Fxj.es.js → PdfViewer-DRTk3dY6.es.js} +2 -2
  2. package/dist/chunks/{PdfViewer-BFIKd3-b.cjs → PdfViewer-H9_8IbtN.cjs} +2 -2
  3. package/dist/chunks/{SuperConverter-BE5tNyQz.es.js → SuperConverter-CFRB4XNw.es.js} +3 -2
  4. package/dist/chunks/{SuperConverter-Cu6cvHlN.cjs → SuperConverter-CgY28MJz.cjs} +3 -2
  5. package/dist/chunks/{index-Dp7mSzy1.es.js → index-BP9aFfwI.es.js} +115 -22
  6. package/dist/chunks/{index-DWfzQ0RN.cjs → index-BdaseaBw.cjs} +115 -22
  7. package/dist/chunks/{index-BjQU1XSp.cjs → index-C3KRKogJ.cjs} +119 -21
  8. package/dist/chunks/{index-SYGYHKb5.es.js → index-CEcYlysg.es.js} +119 -21
  9. package/dist/style.css +49 -49
  10. package/dist/super-editor/converter.cjs +1 -1
  11. package/dist/super-editor/converter.es.js +1 -1
  12. package/dist/super-editor.cjs +2 -2
  13. package/dist/super-editor.es.js +3 -3
  14. package/dist/superdoc/src/components/CommentsLayer/types.d.ts +3 -157
  15. package/dist/superdoc/src/components/CommentsLayer/types.d.ts.map +1 -1
  16. package/dist/superdoc/src/core/SuperDoc.d.ts.map +1 -1
  17. package/dist/superdoc/src/core/types/index.d.ts +12 -0
  18. package/dist/superdoc/src/core/types/index.d.ts.map +1 -1
  19. package/dist/superdoc/src/stores/comments-store.d.ts +4 -1
  20. package/dist/superdoc/src/stores/comments-store.d.ts.map +1 -1
  21. package/dist/superdoc/src/stores/superdoc-store.d.ts +12 -3
  22. package/dist/superdoc/src/stores/superdoc-store.d.ts.map +1 -1
  23. package/dist/superdoc.cjs +3 -3
  24. package/dist/superdoc.es.js +3 -3
  25. package/dist/superdoc.umd.js +233 -41
  26. package/dist/superdoc.umd.js.map +1 -1
  27. package/package.json +1 -1
  28. package/dist/super-editor/src/core/Extension.d.ts +0 -33
  29. package/dist/super-editor/src/core/Extension.d.ts.map +0 -1
  30. package/dist/super-editor/src/core/helpers/getExtensionConfigField.d.ts +0 -35
  31. package/dist/super-editor/src/core/helpers/getExtensionConfigField.d.ts.map +0 -1
  32. package/dist/super-editor/src/core/utilities/callOrGet.d.ts +0 -13
  33. package/dist/super-editor/src/core/utilities/callOrGet.d.ts.map +0 -1
  34. package/dist/super-editor/src/extensions/comment/comments-constants.d.ts +0 -2
  35. package/dist/super-editor/src/extensions/comment/comments-constants.d.ts.map +0 -1
  36. package/dist/super-editor/src/extensions/comment/comments-plugin.d.ts +0 -1
  37. package/dist/superdoc/src/SuperDoc.test.d.ts +0 -2
  38. package/dist/superdoc/src/SuperDoc.test.d.ts.map +0 -1
  39. package/dist/superdoc/src/components/CommentsLayer/CommentDialog.test.d.ts +0 -2
  40. package/dist/superdoc/src/components/CommentsLayer/CommentDialog.test.d.ts.map +0 -1
  41. package/dist/superdoc/src/components/CommentsLayer/use-comment.test.d.ts +0 -2
  42. package/dist/superdoc/src/components/CommentsLayer/use-comment.test.d.ts.map +0 -1
  43. package/dist/superdoc/src/core/SuperDoc.test.d.ts +0 -2
  44. package/dist/superdoc/src/core/SuperDoc.test.d.ts.map +0 -1
  45. package/dist/superdoc/src/core/collaboration/collaboration.test.d.ts +0 -2
  46. package/dist/superdoc/src/core/collaboration/collaboration.test.d.ts.map +0 -1
  47. package/dist/superdoc/src/core/helpers/export.test.d.ts +0 -2
  48. package/dist/superdoc/src/core/helpers/export.test.d.ts.map +0 -1
  49. package/dist/superdoc/src/core/helpers/file.test.d.ts +0 -2
  50. package/dist/superdoc/src/core/helpers/file.test.d.ts.map +0 -1
  51. package/dist/superdoc/src/stores/comments-store.test.d.ts +0 -2
  52. package/dist/superdoc/src/stores/comments-store.test.d.ts.map +0 -1
  53. package/dist/superdoc/src/stores/hrbr-fields-store.test.d.ts +0 -2
  54. package/dist/superdoc/src/stores/hrbr-fields-store.test.d.ts.map +0 -1
  55. package/dist/superdoc/src/stores/superdoc-store.test.d.ts +0 -2
  56. package/dist/superdoc/src/stores/superdoc-store.test.d.ts.map +0 -1
  57. package/dist/superdoc/src/tests/helpers/group-changes.test.d.ts +0 -2
  58. package/dist/superdoc/src/tests/helpers/group-changes.test.d.ts.map +0 -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-BE5tNyQz.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-CFRB4XNw.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";
@@ -13542,6 +13542,12 @@ function findRangeById(doc2, id) {
13542
13542
  if (from3 === null || pos < from3) from3 = pos;
13543
13543
  if (to === null || pos + node.nodeSize > to) to = pos + node.nodeSize;
13544
13544
  }
13545
+ if (node.type.name === "commentRangeStart" && node.attrs["w:id"] === id) {
13546
+ from3 = pos;
13547
+ }
13548
+ if (node.type.name === "commentRangeEnd" && node.attrs["w:id"] === id) {
13549
+ to = pos;
13550
+ }
13545
13551
  });
13546
13552
  return from3 !== null && to !== null ? { from: from3, to } : null;
13547
13553
  }
@@ -15434,7 +15440,7 @@ const canUseDOM = () => {
15434
15440
  return false;
15435
15441
  }
15436
15442
  };
15437
- const summaryVersion = "1.3.1-next.2";
15443
+ const summaryVersion = "1.4.0-next.1";
15438
15444
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
15439
15445
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
15440
15446
  function mapAttributes(attrs) {
@@ -18066,7 +18072,7 @@ class Editor extends EventEmitter {
18066
18072
  * Process collaboration migrations
18067
18073
  */
18068
18074
  processCollaborationMigrations() {
18069
- console.debug("[checkVersionMigrations] Current editor version", "1.3.1-next.2");
18075
+ console.debug("[checkVersionMigrations] Current editor version", "1.4.0-next.1");
18070
18076
  if (!this.options.ydoc) return;
18071
18077
  const metaMap = this.options.ydoc.getMap("meta");
18072
18078
  let docVersion = metaMap.get("version");
@@ -31676,8 +31682,15 @@ function layoutParagraphBlock(ctx2, anchors) {
31676
31682
  } else if (vRelativeFrom === "paragraph") {
31677
31683
  const baseAnchorY = state.cursorY;
31678
31684
  const firstLineHeight = measure.lines?.[0]?.lineHeight ?? 0;
31679
- const paragraphAdjustment = firstLineHeight / 2;
31680
- anchorY = baseAnchorY + paragraphAdjustment + offsetV;
31685
+ if (alignV === "top") {
31686
+ anchorY = baseAnchorY + offsetV;
31687
+ } else if (alignV === "bottom") {
31688
+ anchorY = baseAnchorY + firstLineHeight - imageHeight + offsetV;
31689
+ } else if (alignV === "center") {
31690
+ anchorY = baseAnchorY + (firstLineHeight - imageHeight) / 2 + offsetV;
31691
+ } else {
31692
+ anchorY = baseAnchorY + offsetV;
31693
+ }
31681
31694
  } else {
31682
31695
  const baseAnchorY = state.cursorY;
31683
31696
  anchorY = baseAnchorY + offsetV;
@@ -32738,6 +32751,13 @@ function collectPreRegisteredAnchors(blocks, measures) {
32738
32751
  function collectAnchoredDrawings(blocks, measures) {
32739
32752
  const map3 = /* @__PURE__ */ new Map();
32740
32753
  const len = Math.min(blocks.length, measures.length);
32754
+ const paragraphIndexById = /* @__PURE__ */ new Map();
32755
+ for (let i = 0; i < len; i += 1) {
32756
+ const block = blocks[i];
32757
+ if (block.kind === "paragraph") {
32758
+ paragraphIndexById.set(block.id, i);
32759
+ }
32760
+ }
32741
32761
  const nearestPrevParagraph = (fromIndex) => {
32742
32762
  for (let i = fromIndex - 1; i >= 0; i -= 1) {
32743
32763
  if (blocks[i].kind === "paragraph") return i;
@@ -32764,7 +32784,11 @@ function collectAnchoredDrawings(blocks, measures) {
32764
32784
  if (isPageRelativeAnchor(drawingBlock)) {
32765
32785
  continue;
32766
32786
  }
32767
- let anchorParaIndex = nearestPrevParagraph(i);
32787
+ const anchorParagraphId = typeof drawingBlock.attrs === "object" && drawingBlock.attrs ? drawingBlock.attrs.anchorParagraphId : void 0;
32788
+ let anchorParaIndex = typeof anchorParagraphId === "string" ? paragraphIndexById.get(anchorParagraphId) ?? null : null;
32789
+ if (anchorParaIndex == null) {
32790
+ anchorParaIndex = nearestPrevParagraph(i);
32791
+ }
32768
32792
  if (anchorParaIndex == null) anchorParaIndex = nearestNextParagraph(i);
32769
32793
  if (anchorParaIndex == null) continue;
32770
32794
  const list = map3.get(anchorParaIndex) ?? [];
@@ -32775,6 +32799,13 @@ function collectAnchoredDrawings(blocks, measures) {
32775
32799
  }
32776
32800
  function collectAnchoredTables(blocks, measures) {
32777
32801
  const map3 = /* @__PURE__ */ new Map();
32802
+ const paragraphIndexById = /* @__PURE__ */ new Map();
32803
+ for (let i = 0; i < blocks.length; i += 1) {
32804
+ const block = blocks[i];
32805
+ if (block.kind === "paragraph") {
32806
+ paragraphIndexById.set(block.id, i);
32807
+ }
32808
+ }
32778
32809
  const nearestPrevParagraph = (fromIndex) => {
32779
32810
  for (let i = fromIndex - 1; i >= 0; i -= 1) {
32780
32811
  if (blocks[i].kind === "paragraph") return i;
@@ -32794,7 +32825,11 @@ function collectAnchoredTables(blocks, measures) {
32794
32825
  const tableBlock = block;
32795
32826
  const tableMeasure = measure;
32796
32827
  if (!tableBlock.anchor?.isAnchored) continue;
32797
- let anchorParaIndex = nearestPrevParagraph(i);
32828
+ const anchorParagraphId = typeof tableBlock.attrs === "object" && tableBlock.attrs ? tableBlock.attrs.anchorParagraphId : void 0;
32829
+ let anchorParaIndex = typeof anchorParagraphId === "string" ? paragraphIndexById.get(anchorParagraphId) ?? null : null;
32830
+ if (anchorParaIndex == null) {
32831
+ anchorParaIndex = nearestPrevParagraph(i);
32832
+ }
32798
32833
  if (anchorParaIndex == null) anchorParaIndex = nearestNextParagraph(i);
32799
32834
  if (anchorParaIndex == null) continue;
32800
32835
  const list = map3.get(anchorParaIndex) ?? [];
@@ -41816,7 +41851,13 @@ const spacingPxToPt = (spacing) => {
41816
41851
  const result = {};
41817
41852
  if (spacing.before != null) result.before = pxToPt(spacing.before);
41818
41853
  if (spacing.after != null) result.after = pxToPt(spacing.after);
41819
- if (spacing.line != null) result.line = pxToPt(spacing.line);
41854
+ if (spacing.line != null) {
41855
+ if (spacing.lineRule === "auto" && spacing.line > 0 && spacing.line <= MAX_AUTO_LINE_MULTIPLIER) {
41856
+ result.line = spacing.line;
41857
+ } else {
41858
+ result.line = pxToPt(spacing.line);
41859
+ }
41860
+ }
41820
41861
  if (spacing.lineRule) result.lineRule = spacing.lineRule;
41821
41862
  return result;
41822
41863
  };
@@ -41840,8 +41881,13 @@ const spacingPtToPx = (spacing, rawSpacing) => {
41840
41881
  if (after != null) result.after = after;
41841
41882
  }
41842
41883
  if (rawSpacing.line != null) {
41843
- const line = ptToPx(spacing.line);
41844
- if (line != null) result.line = line;
41884
+ const isAutoMultiplier = spacing.lineRule === "auto" && spacing.line != null && spacing.line > 0 && spacing.line <= MAX_AUTO_LINE_MULTIPLIER;
41885
+ if (isAutoMultiplier) {
41886
+ result.line = spacing.line;
41887
+ } else {
41888
+ const line = ptToPx(spacing.line);
41889
+ if (line != null) result.line = line;
41890
+ }
41845
41891
  if (spacing.lineRule) result.lineRule = spacing.lineRule;
41846
41892
  }
41847
41893
  }
@@ -41921,7 +41967,7 @@ const normalizeLineValue = (value, lineRule) => {
41921
41967
  if (value > 0 && value <= MAX_AUTO_LINE_MULTIPLIER) {
41922
41968
  return value;
41923
41969
  }
41924
- return twipsToPx$1(value);
41970
+ return value / 240;
41925
41971
  }
41926
41972
  return twipsToPx$1(value);
41927
41973
  };
@@ -45196,6 +45242,20 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
45196
45242
  let partIndex = 0;
45197
45243
  let tabOrdinal = 0;
45198
45244
  const nextId = () => partIndex === 0 ? baseBlockId : `${baseBlockId}-${partIndex}`;
45245
+ const attachAnchorParagraphId = (block, anchorParagraphId) => {
45246
+ const applicableKinds = /* @__PURE__ */ new Set(["drawing", "image", "table"]);
45247
+ if (!applicableKinds.has(block.kind)) {
45248
+ return block;
45249
+ }
45250
+ const blockWithAttrs = block;
45251
+ return {
45252
+ ...blockWithAttrs,
45253
+ attrs: {
45254
+ ...blockWithAttrs.attrs ?? {},
45255
+ anchorParagraphId
45256
+ }
45257
+ };
45258
+ };
45199
45259
  const flushParagraph = () => {
45200
45260
  if (currentRuns.length === 0) {
45201
45261
  return;
@@ -45427,6 +45487,7 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
45427
45487
  }
45428
45488
  return;
45429
45489
  }
45490
+ const anchorParagraphId = nextId();
45430
45491
  flushParagraph();
45431
45492
  const mergedMarks = [...node.marks ?? [], ...inheritedMarks ?? []];
45432
45493
  const trackedMeta = trackedChanges?.enabled ? collectTrackedChangeFromMarks(mergedMarks) : void 0;
@@ -45437,7 +45498,7 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
45437
45498
  const imageBlock = converters.imageNodeToBlock(node, nextBlockId, positions, trackedMeta, trackedChanges);
45438
45499
  if (imageBlock && imageBlock.kind === "image") {
45439
45500
  annotateBlockWithTrackedChange(imageBlock, trackedMeta, trackedChanges);
45440
- blocks.push(imageBlock);
45501
+ blocks.push(attachAnchorParagraphId(imageBlock, anchorParagraphId));
45441
45502
  }
45442
45503
  }
45443
45504
  return;
@@ -45445,6 +45506,7 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
45445
45506
  if (node.type === "contentBlock") {
45446
45507
  const attrs = node.attrs ?? {};
45447
45508
  if (attrs.horizontalRule === true) {
45509
+ const anchorParagraphId = nextId();
45448
45510
  flushParagraph();
45449
45511
  const indent = paragraphAttrs?.indent;
45450
45512
  const hrIndentLeft = typeof indent?.left === "number" ? indent.left : void 0;
@@ -45454,52 +45516,57 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
45454
45516
  const convert = converters?.contentBlockNodeToDrawingBlock ?? contentBlockNodeToDrawingBlock;
45455
45517
  const drawingBlock = convert(hrNode, nextBlockId, positions);
45456
45518
  if (drawingBlock) {
45457
- blocks.push(drawingBlock);
45519
+ blocks.push(attachAnchorParagraphId(drawingBlock, anchorParagraphId));
45458
45520
  }
45459
45521
  }
45460
45522
  return;
45461
45523
  }
45462
45524
  if (node.type === "vectorShape") {
45525
+ const anchorParagraphId = nextId();
45463
45526
  flushParagraph();
45464
45527
  if (converters?.vectorShapeNodeToDrawingBlock) {
45465
45528
  const drawingBlock = converters.vectorShapeNodeToDrawingBlock(node, nextBlockId, positions);
45466
45529
  if (drawingBlock) {
45467
- blocks.push(drawingBlock);
45530
+ blocks.push(attachAnchorParagraphId(drawingBlock, anchorParagraphId));
45468
45531
  }
45469
45532
  }
45470
45533
  return;
45471
45534
  }
45472
45535
  if (node.type === "shapeGroup") {
45536
+ const anchorParagraphId = nextId();
45473
45537
  flushParagraph();
45474
45538
  if (converters?.shapeGroupNodeToDrawingBlock) {
45475
45539
  const drawingBlock = converters.shapeGroupNodeToDrawingBlock(node, nextBlockId, positions);
45476
45540
  if (drawingBlock) {
45477
- blocks.push(drawingBlock);
45541
+ blocks.push(attachAnchorParagraphId(drawingBlock, anchorParagraphId));
45478
45542
  }
45479
45543
  }
45480
45544
  return;
45481
45545
  }
45482
45546
  if (node.type === "shapeContainer") {
45547
+ const anchorParagraphId = nextId();
45483
45548
  flushParagraph();
45484
45549
  if (converters?.shapeContainerNodeToDrawingBlock) {
45485
45550
  const drawingBlock = converters.shapeContainerNodeToDrawingBlock(node, nextBlockId, positions);
45486
45551
  if (drawingBlock) {
45487
- blocks.push(drawingBlock);
45552
+ blocks.push(attachAnchorParagraphId(drawingBlock, anchorParagraphId));
45488
45553
  }
45489
45554
  }
45490
45555
  return;
45491
45556
  }
45492
45557
  if (node.type === "shapeTextbox") {
45558
+ const anchorParagraphId = nextId();
45493
45559
  flushParagraph();
45494
45560
  if (converters?.shapeTextboxNodeToDrawingBlock) {
45495
45561
  const drawingBlock = converters.shapeTextboxNodeToDrawingBlock(node, nextBlockId, positions);
45496
45562
  if (drawingBlock) {
45497
- blocks.push(drawingBlock);
45563
+ blocks.push(attachAnchorParagraphId(drawingBlock, anchorParagraphId));
45498
45564
  }
45499
45565
  }
45500
45566
  return;
45501
45567
  }
45502
45568
  if (node.type === "table") {
45569
+ const anchorParagraphId = nextId();
45503
45570
  flushParagraph();
45504
45571
  if (converters?.tableNodeToBlock) {
45505
45572
  const tableBlock = converters.tableNodeToBlock(
@@ -45516,7 +45583,7 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
45516
45583
  ...converterContext !== void 0 ? [converterContext] : []
45517
45584
  );
45518
45585
  if (tableBlock) {
45519
- blocks.push(tableBlock);
45586
+ blocks.push(attachAnchorParagraphId(tableBlock, anchorParagraphId));
45520
45587
  }
45521
45588
  }
45522
45589
  return;
@@ -50041,7 +50108,8 @@ const resolveLineHeight = (spacing, baseLineHeight) => {
50041
50108
  return baseLineHeight;
50042
50109
  }
50043
50110
  const raw = spacing.line;
50044
- const treatAsMultiplier = (spacing.lineRule === "auto" || spacing.lineRule == null) && raw > 0 && raw <= 10;
50111
+ const isAuto = spacing.lineRule === "auto";
50112
+ const treatAsMultiplier = (isAuto || spacing.lineRule == null) && raw > 0 && (isAuto || raw <= 10);
50045
50113
  if (treatAsMultiplier) {
50046
50114
  return raw * baseLineHeight;
50047
50115
  }
@@ -50388,6 +50456,8 @@ class PresentationEditor extends EventEmitter {
50388
50456
  debugLabel: options.layoutEngineOptions?.debugLabel,
50389
50457
  layoutMode: options.layoutEngineOptions?.layoutMode ?? "vertical",
50390
50458
  trackedChanges: options.layoutEngineOptions?.trackedChanges,
50459
+ emitCommentPositionsInViewing: options.layoutEngineOptions?.emitCommentPositionsInViewing,
50460
+ enableCommentsInViewing: options.layoutEngineOptions?.enableCommentsInViewing,
50391
50461
  presence: validatedPresence
50392
50462
  };
50393
50463
  this.#trackedChangesOverrides = options.layoutEngineOptions?.trackedChanges;
@@ -50976,6 +51046,33 @@ class PresentationEditor extends EventEmitter {
50976
51046
  this.#scheduleRerender();
50977
51047
  }
50978
51048
  }
51049
+ /**
51050
+ * Update viewing-mode comment rendering behavior and re-render if needed.
51051
+ *
51052
+ * @param options - Viewing mode comment options.
51053
+ */
51054
+ setViewingCommentOptions(options = {}) {
51055
+ if (options !== void 0 && (typeof options !== "object" || options === null || Array.isArray(options))) {
51056
+ throw new TypeError("[PresentationEditor] setViewingCommentOptions expects an object or undefined");
51057
+ }
51058
+ let hasChanges = false;
51059
+ if (typeof options.emitCommentPositionsInViewing === "boolean") {
51060
+ if (this.#layoutOptions.emitCommentPositionsInViewing !== options.emitCommentPositionsInViewing) {
51061
+ this.#layoutOptions.emitCommentPositionsInViewing = options.emitCommentPositionsInViewing;
51062
+ hasChanges = true;
51063
+ }
51064
+ }
51065
+ if (typeof options.enableCommentsInViewing === "boolean") {
51066
+ if (this.#layoutOptions.enableCommentsInViewing !== options.enableCommentsInViewing) {
51067
+ this.#layoutOptions.enableCommentsInViewing = options.enableCommentsInViewing;
51068
+ hasChanges = true;
51069
+ }
51070
+ }
51071
+ if (hasChanges) {
51072
+ this.#pendingDocChange = true;
51073
+ this.#scheduleRerender();
51074
+ }
51075
+ }
50979
51076
  /**
50980
51077
  * Toggle the custom context menu at runtime to respect host-level guardrails.
50981
51078
  */
@@ -53357,7 +53454,7 @@ class PresentationEditor extends EventEmitter {
53357
53454
  } : void 0;
53358
53455
  const atomNodeTypes = getAtomNodeTypes(this.#editor?.schema ?? null);
53359
53456
  const positionMap = this.#editor?.state?.doc && docJson ? buildPositionMapFromPmDoc(this.#editor.state.doc, docJson) : null;
53360
- const commentsEnabled = this.#documentMode !== "viewing";
53457
+ const commentsEnabled = this.#documentMode !== "viewing" || this.#layoutOptions.enableCommentsInViewing === true;
53361
53458
  const result = toFlowBlocks(docJson, {
53362
53459
  mediaFiles: this.#editor?.storage?.image?.media,
53363
53460
  emitSectionBreaks: true,
@@ -53497,7 +53594,8 @@ class PresentationEditor extends EventEmitter {
53497
53594
  const payload = { layout, blocks, measures, metrics };
53498
53595
  this.emit("layoutUpdated", payload);
53499
53596
  this.emit("paginationUpdate", payload);
53500
- if (this.#documentMode !== "viewing") {
53597
+ const allowViewingCommentPositions = this.#layoutOptions.emitCommentPositionsInViewing === true;
53598
+ if (this.#documentMode !== "viewing" || allowViewingCommentPositions) {
53501
53599
  const commentPositions = this.#collectCommentPositions();
53502
53600
  const positionKeys = Object.keys(commentPositions);
53503
53601
  if (positionKeys.length > 0) {
package/dist/style.css CHANGED
@@ -2299,32 +2299,32 @@ span[data-v-53e13009] {
2299
2299
  display: inline-block;
2300
2300
  }
2301
2301
 
2302
- .change-type[data-v-dc2a79b5] {
2302
+ .change-type[data-v-d50fd675] {
2303
2303
  font-style: italic;
2304
2304
  font-weight: 600;
2305
2305
  font-size: 10px;
2306
2306
  color: #555;
2307
2307
  }
2308
- .tracked-change[data-v-dc2a79b5] {
2308
+ .tracked-change[data-v-d50fd675] {
2309
2309
  font-size: 12px;
2310
2310
  }
2311
- .tracked-change-text[data-v-dc2a79b5] {
2311
+ .tracked-change-text[data-v-d50fd675] {
2312
2312
  color: #111;
2313
2313
  }
2314
- .comment-separator[data-v-dc2a79b5] {
2314
+ .comment-separator[data-v-d50fd675] {
2315
2315
  background-color: #dbdbdb;
2316
2316
  height: 1px;
2317
2317
  width: 100%;
2318
2318
  margin: 10px 0;
2319
2319
  font-weight: 400;
2320
2320
  }
2321
- .existing-internal-input[data-v-dc2a79b5] {
2321
+ .existing-internal-input[data-v-d50fd675] {
2322
2322
  margin-bottom: 10px;
2323
2323
  }
2324
- .initial-internal-dropdown[data-v-dc2a79b5] {
2324
+ .initial-internal-dropdown[data-v-d50fd675] {
2325
2325
  margin-top: 10px;
2326
2326
  }
2327
- .comments-dialog[data-v-dc2a79b5] {
2327
+ .comments-dialog[data-v-d50fd675] {
2328
2328
  display: flex;
2329
2329
  flex-direction: column;
2330
2330
  padding: 10px 15px;
@@ -2340,39 +2340,39 @@ span[data-v-53e13009] {
2340
2340
  min-width: 200px;
2341
2341
  width: 100%;
2342
2342
  }
2343
- .is-active[data-v-dc2a79b5] {
2343
+ .is-active[data-v-d50fd675] {
2344
2344
  z-index: 10;
2345
2345
  }
2346
- .input-section[data-v-dc2a79b5] {
2346
+ .input-section[data-v-d50fd675] {
2347
2347
  margin-top: 10px;
2348
2348
  }
2349
- .sd-button[data-v-dc2a79b5] {
2349
+ .sd-button[data-v-d50fd675] {
2350
2350
  font-size: 12px;
2351
2351
  margin-left: 5px;
2352
2352
  }
2353
- .comment[data-v-dc2a79b5] {
2353
+ .comment[data-v-d50fd675] {
2354
2354
  font-size: 13px;
2355
2355
  margin: 10px 0;
2356
2356
  }
2357
- .is-resolved[data-v-dc2a79b5] {
2357
+ .is-resolved[data-v-d50fd675] {
2358
2358
  background-color: #f0f0f0;
2359
2359
  }
2360
- .comment-footer[data-v-dc2a79b5] {
2360
+ .comment-footer[data-v-d50fd675] {
2361
2361
  margin: 5px 0 5px;
2362
2362
  display: flex;
2363
2363
  justify-content: flex-end;
2364
2364
  width: 100%;
2365
2365
  }
2366
- .internal-dropdown[data-v-dc2a79b5] {
2366
+ .internal-dropdown[data-v-d50fd675] {
2367
2367
  display: inline-block;
2368
2368
  }
2369
- .comment-editing[data-v-dc2a79b5] {
2369
+ .comment-editing[data-v-d50fd675] {
2370
2370
  padding-bottom: 10px;
2371
2371
  }
2372
- .comment-editing button[data-v-dc2a79b5] {
2372
+ .comment-editing button[data-v-d50fd675] {
2373
2373
  margin-left: 5px;
2374
2374
  }
2375
- .tracked-change[data-v-dc2a79b5] {
2375
+ .tracked-change[data-v-d50fd675] {
2376
2376
  margin: 0;
2377
2377
  }
2378
2378
 
@@ -2420,23 +2420,23 @@ span[data-v-53e13009] {
2420
2420
  background-color: #1355ff7f;
2421
2421
  }
2422
2422
 
2423
- .comment-doc[data-v-d019784c] {
2423
+ .comment-doc[data-v-7d21d613] {
2424
2424
  position: relative;
2425
2425
  }
2426
- .comments-layer[data-v-d019784c] {
2426
+ .comments-layer[data-v-7d21d613] {
2427
2427
  position: relative;
2428
2428
  }
2429
- .sd-comment-anchor[data-v-d019784c] {
2429
+ .sd-comment-anchor[data-v-7d21d613] {
2430
2430
  position: absolute;
2431
2431
  cursor: pointer;
2432
2432
  z-index: 3;
2433
2433
  border-radius: 4px;
2434
2434
  transition: background-color 250ms ease;
2435
2435
  }
2436
- .bypass[data-v-d019784c] {
2436
+ .bypass[data-v-7d21d613] {
2437
2437
  display: none;
2438
2438
  }
2439
- .comments-container[data-v-d019784c] {
2439
+ .comments-container[data-v-7d21d613] {
2440
2440
  /* pointer-events: none; */
2441
2441
  }
2442
2442
 
@@ -2559,46 +2559,46 @@ img[data-v-7dd69850] {
2559
2559
  display: none;
2560
2560
  }
2561
2561
 
2562
- .superdoc[data-v-5196811d] {
2562
+ .superdoc[data-v-78737564] {
2563
2563
  display: flex;
2564
2564
  }
2565
- .right-sidebar[data-v-5196811d] {
2565
+ .right-sidebar[data-v-78737564] {
2566
2566
  min-width: 320px;
2567
2567
  }
2568
- .floating-comments[data-v-5196811d] {
2568
+ .floating-comments[data-v-78737564] {
2569
2569
  min-width: 300px;
2570
2570
  width: 300px;
2571
2571
  }
2572
- .superdoc__layers[data-v-5196811d] {
2572
+ .superdoc__layers[data-v-78737564] {
2573
2573
  height: 100%;
2574
2574
  position: relative;
2575
2575
  box-sizing: border-box;
2576
2576
  }
2577
- .superdoc__document[data-v-5196811d] {
2577
+ .superdoc__document[data-v-78737564] {
2578
2578
  width: 100%;
2579
2579
  position: relative;
2580
2580
  }
2581
- .superdoc__sub-document[data-v-5196811d] {
2581
+ .superdoc__sub-document[data-v-78737564] {
2582
2582
  width: 100%;
2583
2583
  position: relative;
2584
2584
  }
2585
- .superdoc__selection-layer[data-v-5196811d] {
2585
+ .superdoc__selection-layer[data-v-78737564] {
2586
2586
  position: absolute;
2587
2587
  min-width: 100%;
2588
2588
  min-height: 100%;
2589
2589
  z-index: 10;
2590
2590
  pointer-events: none;
2591
2591
  }
2592
- .superdoc__temp-selection[data-v-5196811d] {
2592
+ .superdoc__temp-selection[data-v-78737564] {
2593
2593
  position: absolute;
2594
2594
  }
2595
- .superdoc__comments-layer[data-v-5196811d] {
2595
+ .superdoc__comments-layer[data-v-78737564] {
2596
2596
  /* position: absolute; */
2597
2597
  top: 0;
2598
2598
  height: 100%;
2599
2599
  position: relative;
2600
2600
  }
2601
- .superdoc__right-sidebar[data-v-5196811d] {
2601
+ .superdoc__right-sidebar[data-v-78737564] {
2602
2602
  width: 320px;
2603
2603
  min-width: 320px;
2604
2604
  padding: 0 10px;
@@ -2608,14 +2608,14 @@ img[data-v-7dd69850] {
2608
2608
  }
2609
2609
 
2610
2610
  /* Tools styles */
2611
- .tools[data-v-5196811d] {
2611
+ .tools[data-v-78737564] {
2612
2612
  position: absolute;
2613
2613
  z-index: 3;
2614
2614
  display: flex;
2615
2615
  flex-direction: column;
2616
2616
  gap: 6px;
2617
2617
  }
2618
- .tools .tool-icon[data-v-5196811d] {
2618
+ .tools .tool-icon[data-v-78737564] {
2619
2619
  font-size: 20px;
2620
2620
  border-radius: 12px;
2621
2621
  border: none;
@@ -2623,7 +2623,7 @@ img[data-v-7dd69850] {
2623
2623
  background-color: #dbdbdb;
2624
2624
  cursor: pointer;
2625
2625
  }
2626
- .tools-item[data-v-5196811d] {
2626
+ .tools-item[data-v-78737564] {
2627
2627
  display: flex;
2628
2628
  align-items: center;
2629
2629
  justify-content: center;
@@ -2633,10 +2633,10 @@ img[data-v-7dd69850] {
2633
2633
  border-radius: 12px;
2634
2634
  cursor: pointer;
2635
2635
  }
2636
- .tools-item i[data-v-5196811d] {
2636
+ .tools-item i[data-v-78737564] {
2637
2637
  cursor: pointer;
2638
2638
  }
2639
- .superdoc__tools-icon[data-v-5196811d] {
2639
+ .superdoc__tools-icon[data-v-78737564] {
2640
2640
  width: 20px;
2641
2641
  height: 20px;
2642
2642
  flex-shrink: 0;
@@ -2651,15 +2651,15 @@ img[data-v-7dd69850] {
2651
2651
 
2652
2652
  /* 834px is iPad screen size in portrait orientation */
2653
2653
  @media (max-width: 834px) {
2654
- .superdoc .superdoc__layers[data-v-5196811d] {
2654
+ .superdoc .superdoc__layers[data-v-78737564] {
2655
2655
  margin: 0;
2656
2656
  border: 0 !important;
2657
2657
  box-shadow: none;
2658
2658
  }
2659
- .superdoc__sub-document[data-v-5196811d] {
2659
+ .superdoc__sub-document[data-v-78737564] {
2660
2660
  max-width: 100%;
2661
2661
  }
2662
- .superdoc__right-sidebar[data-v-5196811d] {
2662
+ .superdoc__right-sidebar[data-v-78737564] {
2663
2663
  padding: 10px;
2664
2664
  width: 55px;
2665
2665
  position: relative;
@@ -2667,7 +2667,7 @@ img[data-v-7dd69850] {
2667
2667
  }
2668
2668
 
2669
2669
  /* AI Writer styles */
2670
- .ai-writer-container[data-v-5196811d] {
2670
+ .ai-writer-container[data-v-78737564] {
2671
2671
  position: fixed;
2672
2672
  z-index: 1000;
2673
2673
  background: white;
@@ -2685,13 +2685,13 @@ img[data-v-7dd69850] {
2685
2685
  } */
2686
2686
 
2687
2687
  /* Tools styles */
2688
- .tools[data-v-5196811d] {
2688
+ .tools[data-v-78737564] {
2689
2689
  position: absolute;
2690
2690
  z-index: 3;
2691
2691
  display: flex;
2692
2692
  gap: 6px;
2693
2693
  }
2694
- .tools .tool-icon[data-v-5196811d] {
2694
+ .tools .tool-icon[data-v-78737564] {
2695
2695
  font-size: 20px;
2696
2696
  border-radius: 12px;
2697
2697
  border: none;
@@ -2699,7 +2699,7 @@ img[data-v-7dd69850] {
2699
2699
  background-color: #dbdbdb;
2700
2700
  cursor: pointer;
2701
2701
  }
2702
- .tools-item[data-v-5196811d] {
2702
+ .tools-item[data-v-78737564] {
2703
2703
  display: flex;
2704
2704
  align-items: center;
2705
2705
  justify-content: center;
@@ -2710,18 +2710,18 @@ img[data-v-7dd69850] {
2710
2710
  border-radius: 12px;
2711
2711
  cursor: pointer;
2712
2712
  }
2713
- .tools-item i[data-v-5196811d] {
2713
+ .tools-item i[data-v-78737564] {
2714
2714
  cursor: pointer;
2715
2715
  }
2716
- .superdoc__tools-icon[data-v-5196811d] {
2716
+ .superdoc__tools-icon[data-v-78737564] {
2717
2717
  width: 20px;
2718
2718
  height: 20px;
2719
2719
  flex-shrink: 0;
2720
2720
  }
2721
- .ai-tool > svg[data-v-5196811d] {
2721
+ .ai-tool > svg[data-v-78737564] {
2722
2722
  fill: transparent;
2723
2723
  }
2724
- .ai-tool[data-v-5196811d]::before {
2724
+ .ai-tool[data-v-78737564]::before {
2725
2725
  content: '';
2726
2726
  position: absolute;
2727
2727
  width: 20px;
@@ -2742,7 +2742,7 @@ img[data-v-7dd69850] {
2742
2742
  filter: brightness(1.2);
2743
2743
  transition: filter 0.2s ease;
2744
2744
  }
2745
- .ai-tool[data-v-5196811d]:hover::before {
2745
+ .ai-tool[data-v-78737564]:hover::before {
2746
2746
  filter: brightness(1.3);
2747
2747
  }
2748
2748
 
@@ -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-Cu6cvHlN.cjs");
5
+ const superEditor_converter = require("../chunks/SuperConverter-CgY28MJz.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-BE5tNyQz.es.js";
3
+ import { S } from "../chunks/SuperConverter-CFRB4XNw.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-BjQU1XSp.cjs");
3
+ const index = require("./chunks/index-C3KRKogJ.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-Cu6cvHlN.cjs");
7
+ const superEditor_converter = require("./chunks/SuperConverter-CgY28MJz.cjs");
8
8
  function isNodeType(node, name) {
9
9
  return node.type.name === name;
10
10
  }