@harbour-enterprises/superdoc 1.3.1-next.2 → 1.3.1-next.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const vue = require("./vue-De9wkgLl.cjs");
4
- const superdoc = require("./index-DWfzQ0RN.cjs");
5
- const index = require("./index-BjQU1XSp.cjs");
4
+ const superdoc = require("./index-BQYtE-5U.cjs");
5
+ const index = require("./index-DLX_v-vr.cjs");
6
6
  function self(vars) {
7
7
  const {
8
8
  opacityDisabled,
@@ -1,6 +1,6 @@
1
1
  import { d as defineComponent, h, T as Transition, p as process$1, w as watchEffect, c as computed, r as ref, f as onMounted, X as onUnmounted, E as createElementBlock, G as openBlock, K as createBaseVNode, M as createCommentVNode, I as createVNode, v as unref } from "./vue-BnBKJwCW.es.js";
2
- import { N as NBaseLoading, u as useSuperdocStore, s as storeToRefs, a as useSelection } from "./index-Dp7mSzy1.es.js";
3
- import { C as derived, r as c, q as cB, aF as fadeInTransition, y as cM, I as warnOnce, J as useConfig, N as useTheme, aG as pxfy, P as createKey, Q as useThemeClass, aH as useCompitable, ai as _export_sfc } from "./index-SYGYHKb5.es.js";
2
+ import { N as NBaseLoading, u as useSuperdocStore, s as storeToRefs, a as useSelection } from "./index-DXSUcHli.es.js";
3
+ import { C as derived, r as c, q as cB, aF as fadeInTransition, y as cM, I as warnOnce, J as useConfig, N as useTheme, aG as pxfy, P as createKey, Q as useThemeClass, aH as useCompitable, ai as _export_sfc } from "./index-CJec1cbb.es.js";
4
4
  function self(vars) {
5
5
  const {
6
6
  opacityDisabled,
@@ -30414,9 +30414,10 @@ const updateCommentsXml = (commentDefs = [], commentsXml) => {
30414
30414
  const updateCommentsExtendedXml = (comments = [], commentsExtendedXml) => {
30415
30415
  const xmlCopy = carbonCopy(commentsExtendedXml);
30416
30416
  const commentsEx = comments.map((comment) => {
30417
+ const isResolved = comment.resolvedTime || comment.isDone;
30417
30418
  const attributes = {
30418
30419
  "w15:paraId": comment.commentParaId,
30419
- "w15:done": comment.resolvedTime ? "1" : "0"
30420
+ "w15:done": isResolved ? "1" : "0"
30420
30421
  };
30421
30422
  const parentId = comment.parentCommentId;
30422
30423
  if (parentId) {
@@ -31007,7 +31008,7 @@ class SuperConverter {
31007
31008
  static getStoredSuperdocVersion(docx) {
31008
31009
  return SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
31009
31010
  }
31010
- static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.3.1-next.2") {
31011
+ static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.3.1-next.3") {
31011
31012
  return SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version, false);
31012
31013
  }
31013
31014
  /**
@@ -30415,9 +30415,10 @@ const updateCommentsXml = (commentDefs = [], commentsXml) => {
30415
30415
  const updateCommentsExtendedXml = (comments = [], commentsExtendedXml) => {
30416
30416
  const xmlCopy = carbonCopy(commentsExtendedXml);
30417
30417
  const commentsEx = comments.map((comment) => {
30418
+ const isResolved = comment.resolvedTime || comment.isDone;
30418
30419
  const attributes = {
30419
30420
  "w15:paraId": comment.commentParaId,
30420
- "w15:done": comment.resolvedTime ? "1" : "0"
30421
+ "w15:done": isResolved ? "1" : "0"
30421
30422
  };
30422
30423
  const parentId = comment.parentCommentId;
30423
30424
  if (parentId) {
@@ -31008,7 +31009,7 @@ class SuperConverter {
31008
31009
  static getStoredSuperdocVersion(docx) {
31009
31010
  return SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
31010
31011
  }
31011
- static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.3.1-next.2") {
31012
+ static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.3.1-next.3") {
31012
31013
  return SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version, false);
31013
31014
  }
31014
31015
  /**
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
- const index = require("./index-BjQU1XSp.cjs");
3
- require("./SuperConverter-Cu6cvHlN.cjs");
2
+ const index = require("./index-DLX_v-vr.cjs");
3
+ require("./SuperConverter-p1tQGIew.cjs");
4
4
  const blankDocx = require("./blank-docx-DfW3Eeh2.cjs");
5
5
  const eventemitter3 = require("./eventemitter3-BQuRcMPI.cjs");
6
6
  const provider = require("@hocuspocus/provider");
@@ -6217,12 +6217,13 @@ const _sfc_main$c = {
6217
6217
  return currentCommentText.value && currentCommentText.value !== "<p></p>";
6218
6218
  });
6219
6219
  const setFocus = () => {
6220
- if (props.comment.resolvedTime) return;
6221
6220
  const editor = proxy.$superdoc.activeEditor;
6222
- activeComment.value = props.comment.commentId;
6223
- props.comment.setActive(proxy.$superdoc);
6221
+ if (!props.comment.resolvedTime) {
6222
+ activeComment.value = props.comment.commentId;
6223
+ props.comment.setActive(proxy.$superdoc);
6224
+ }
6224
6225
  if (editor) {
6225
- const cursorId = props.comment.importedId || props.comment.commentId;
6226
+ const cursorId = props.comment.resolvedTime ? props.comment.commentId : props.comment.importedId || props.comment.commentId;
6226
6227
  editor.commands?.setCursorById(cursorId);
6227
6228
  }
6228
6229
  };
@@ -6458,7 +6459,7 @@ const _sfc_main$c = {
6458
6459
  };
6459
6460
  }
6460
6461
  };
6461
- const CommentDialog = /* @__PURE__ */ index._export_sfc(_sfc_main$c, [["__scopeId", "data-v-dc2a79b5"]]);
6462
+ const CommentDialog = /* @__PURE__ */ index._export_sfc(_sfc_main$c, [["__scopeId", "data-v-d50fd675"]]);
6462
6463
  const _hoisted_1$a = { class: "comments-list" };
6463
6464
  const _hoisted_2$5 = { key: 0 };
6464
6465
  const _hoisted_3$3 = { class: "comment-item" };
@@ -7465,7 +7466,7 @@ const _sfc_main = {
7465
7466
  __name: "SuperDoc",
7466
7467
  emits: ["selection-update"],
7467
7468
  setup(__props, { emit: __emit }) {
7468
- const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-BFIKd3-b.cjs")));
7469
+ const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-BXbmY3Fc.cjs")));
7469
7470
  const superdocStore = useSuperdocStore();
7470
7471
  const commentsStore = useCommentsStore();
7471
7472
  const {
@@ -8394,7 +8395,7 @@ class SuperDoc extends eventemitter3.EventEmitter {
8394
8395
  this.config.colors = shuffleArray(this.config.colors);
8395
8396
  this.userColorMap = /* @__PURE__ */ new Map();
8396
8397
  this.colorIndex = 0;
8397
- this.version = "1.3.1-next.2";
8398
+ this.version = "1.3.1-next.3";
8398
8399
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
8399
8400
  this.superdocId = config.superdocId || uuid.v4();
8400
8401
  this.colors = this.config.colors;
@@ -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-BQ6PNaJ8.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.3.1-next.3";
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.3.1-next.3");
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) ?? [];
@@ -45196,6 +45231,20 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
45196
45231
  let partIndex = 0;
45197
45232
  let tabOrdinal = 0;
45198
45233
  const nextId = () => partIndex === 0 ? baseBlockId : `${baseBlockId}-${partIndex}`;
45234
+ const attachAnchorParagraphId = (block, anchorParagraphId) => {
45235
+ const applicableKinds = /* @__PURE__ */ new Set(["drawing", "image", "table"]);
45236
+ if (!applicableKinds.has(block.kind)) {
45237
+ return block;
45238
+ }
45239
+ const blockWithAttrs = block;
45240
+ return {
45241
+ ...blockWithAttrs,
45242
+ attrs: {
45243
+ ...blockWithAttrs.attrs ?? {},
45244
+ anchorParagraphId
45245
+ }
45246
+ };
45247
+ };
45199
45248
  const flushParagraph = () => {
45200
45249
  if (currentRuns.length === 0) {
45201
45250
  return;
@@ -45427,6 +45476,7 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
45427
45476
  }
45428
45477
  return;
45429
45478
  }
45479
+ const anchorParagraphId = nextId();
45430
45480
  flushParagraph();
45431
45481
  const mergedMarks = [...node.marks ?? [], ...inheritedMarks ?? []];
45432
45482
  const trackedMeta = trackedChanges?.enabled ? collectTrackedChangeFromMarks(mergedMarks) : void 0;
@@ -45437,7 +45487,7 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
45437
45487
  const imageBlock = converters.imageNodeToBlock(node, nextBlockId, positions, trackedMeta, trackedChanges);
45438
45488
  if (imageBlock && imageBlock.kind === "image") {
45439
45489
  annotateBlockWithTrackedChange(imageBlock, trackedMeta, trackedChanges);
45440
- blocks.push(imageBlock);
45490
+ blocks.push(attachAnchorParagraphId(imageBlock, anchorParagraphId));
45441
45491
  }
45442
45492
  }
45443
45493
  return;
@@ -45445,6 +45495,7 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
45445
45495
  if (node.type === "contentBlock") {
45446
45496
  const attrs = node.attrs ?? {};
45447
45497
  if (attrs.horizontalRule === true) {
45498
+ const anchorParagraphId = nextId();
45448
45499
  flushParagraph();
45449
45500
  const indent = paragraphAttrs?.indent;
45450
45501
  const hrIndentLeft = typeof indent?.left === "number" ? indent.left : void 0;
@@ -45454,52 +45505,57 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
45454
45505
  const convert = converters?.contentBlockNodeToDrawingBlock ?? contentBlockNodeToDrawingBlock;
45455
45506
  const drawingBlock = convert(hrNode, nextBlockId, positions);
45456
45507
  if (drawingBlock) {
45457
- blocks.push(drawingBlock);
45508
+ blocks.push(attachAnchorParagraphId(drawingBlock, anchorParagraphId));
45458
45509
  }
45459
45510
  }
45460
45511
  return;
45461
45512
  }
45462
45513
  if (node.type === "vectorShape") {
45514
+ const anchorParagraphId = nextId();
45463
45515
  flushParagraph();
45464
45516
  if (converters?.vectorShapeNodeToDrawingBlock) {
45465
45517
  const drawingBlock = converters.vectorShapeNodeToDrawingBlock(node, nextBlockId, positions);
45466
45518
  if (drawingBlock) {
45467
- blocks.push(drawingBlock);
45519
+ blocks.push(attachAnchorParagraphId(drawingBlock, anchorParagraphId));
45468
45520
  }
45469
45521
  }
45470
45522
  return;
45471
45523
  }
45472
45524
  if (node.type === "shapeGroup") {
45525
+ const anchorParagraphId = nextId();
45473
45526
  flushParagraph();
45474
45527
  if (converters?.shapeGroupNodeToDrawingBlock) {
45475
45528
  const drawingBlock = converters.shapeGroupNodeToDrawingBlock(node, nextBlockId, positions);
45476
45529
  if (drawingBlock) {
45477
- blocks.push(drawingBlock);
45530
+ blocks.push(attachAnchorParagraphId(drawingBlock, anchorParagraphId));
45478
45531
  }
45479
45532
  }
45480
45533
  return;
45481
45534
  }
45482
45535
  if (node.type === "shapeContainer") {
45536
+ const anchorParagraphId = nextId();
45483
45537
  flushParagraph();
45484
45538
  if (converters?.shapeContainerNodeToDrawingBlock) {
45485
45539
  const drawingBlock = converters.shapeContainerNodeToDrawingBlock(node, nextBlockId, positions);
45486
45540
  if (drawingBlock) {
45487
- blocks.push(drawingBlock);
45541
+ blocks.push(attachAnchorParagraphId(drawingBlock, anchorParagraphId));
45488
45542
  }
45489
45543
  }
45490
45544
  return;
45491
45545
  }
45492
45546
  if (node.type === "shapeTextbox") {
45547
+ const anchorParagraphId = nextId();
45493
45548
  flushParagraph();
45494
45549
  if (converters?.shapeTextboxNodeToDrawingBlock) {
45495
45550
  const drawingBlock = converters.shapeTextboxNodeToDrawingBlock(node, nextBlockId, positions);
45496
45551
  if (drawingBlock) {
45497
- blocks.push(drawingBlock);
45552
+ blocks.push(attachAnchorParagraphId(drawingBlock, anchorParagraphId));
45498
45553
  }
45499
45554
  }
45500
45555
  return;
45501
45556
  }
45502
45557
  if (node.type === "table") {
45558
+ const anchorParagraphId = nextId();
45503
45559
  flushParagraph();
45504
45560
  if (converters?.tableNodeToBlock) {
45505
45561
  const tableBlock = converters.tableNodeToBlock(
@@ -45516,7 +45572,7 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
45516
45572
  ...converterContext !== void 0 ? [converterContext] : []
45517
45573
  );
45518
45574
  if (tableBlock) {
45519
- blocks.push(tableBlock);
45575
+ blocks.push(attachAnchorParagraphId(tableBlock, anchorParagraphId));
45520
45576
  }
45521
45577
  }
45522
45578
  return;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  const jszip = require("./jszip-C8_CqJxM.cjs");
3
3
  const helpers$1 = require("./helpers-nOdwpmwb.cjs");
4
- const superEditor_converter = require("./SuperConverter-Cu6cvHlN.cjs");
4
+ const superEditor_converter = require("./SuperConverter-p1tQGIew.cjs");
5
5
  const vue = require("./vue-De9wkgLl.cjs");
6
6
  require("./jszip.min-BPh2MMAa.cjs");
7
7
  const eventemitter3 = require("./eventemitter3-BQuRcMPI.cjs");
@@ -13559,6 +13559,12 @@ function findRangeById(doc2, id) {
13559
13559
  if (from3 === null || pos < from3) from3 = pos;
13560
13560
  if (to === null || pos + node.nodeSize > to) to = pos + node.nodeSize;
13561
13561
  }
13562
+ if (node.type.name === "commentRangeStart" && node.attrs["w:id"] === id) {
13563
+ from3 = pos;
13564
+ }
13565
+ if (node.type.name === "commentRangeEnd" && node.attrs["w:id"] === id) {
13566
+ to = pos;
13567
+ }
13562
13568
  });
13563
13569
  return from3 !== null && to !== null ? { from: from3, to } : null;
13564
13570
  }
@@ -15451,7 +15457,7 @@ const canUseDOM = () => {
15451
15457
  return false;
15452
15458
  }
15453
15459
  };
15454
- const summaryVersion = "1.3.1-next.2";
15460
+ const summaryVersion = "1.3.1-next.3";
15455
15461
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
15456
15462
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
15457
15463
  function mapAttributes(attrs) {
@@ -18083,7 +18089,7 @@ class Editor extends EventEmitter {
18083
18089
  * Process collaboration migrations
18084
18090
  */
18085
18091
  processCollaborationMigrations() {
18086
- console.debug("[checkVersionMigrations] Current editor version", "1.3.1-next.2");
18092
+ console.debug("[checkVersionMigrations] Current editor version", "1.3.1-next.3");
18087
18093
  if (!this.options.ydoc) return;
18088
18094
  const metaMap = this.options.ydoc.getMap("meta");
18089
18095
  let docVersion = metaMap.get("version");
@@ -31693,8 +31699,15 @@ function layoutParagraphBlock(ctx2, anchors) {
31693
31699
  } else if (vRelativeFrom === "paragraph") {
31694
31700
  const baseAnchorY = state.cursorY;
31695
31701
  const firstLineHeight = measure.lines?.[0]?.lineHeight ?? 0;
31696
- const paragraphAdjustment = firstLineHeight / 2;
31697
- anchorY = baseAnchorY + paragraphAdjustment + offsetV;
31702
+ if (alignV === "top") {
31703
+ anchorY = baseAnchorY + offsetV;
31704
+ } else if (alignV === "bottom") {
31705
+ anchorY = baseAnchorY + firstLineHeight - imageHeight + offsetV;
31706
+ } else if (alignV === "center") {
31707
+ anchorY = baseAnchorY + (firstLineHeight - imageHeight) / 2 + offsetV;
31708
+ } else {
31709
+ anchorY = baseAnchorY + offsetV;
31710
+ }
31698
31711
  } else {
31699
31712
  const baseAnchorY = state.cursorY;
31700
31713
  anchorY = baseAnchorY + offsetV;
@@ -32755,6 +32768,13 @@ function collectPreRegisteredAnchors(blocks, measures) {
32755
32768
  function collectAnchoredDrawings(blocks, measures) {
32756
32769
  const map3 = /* @__PURE__ */ new Map();
32757
32770
  const len = Math.min(blocks.length, measures.length);
32771
+ const paragraphIndexById = /* @__PURE__ */ new Map();
32772
+ for (let i = 0; i < len; i += 1) {
32773
+ const block = blocks[i];
32774
+ if (block.kind === "paragraph") {
32775
+ paragraphIndexById.set(block.id, i);
32776
+ }
32777
+ }
32758
32778
  const nearestPrevParagraph = (fromIndex) => {
32759
32779
  for (let i = fromIndex - 1; i >= 0; i -= 1) {
32760
32780
  if (blocks[i].kind === "paragraph") return i;
@@ -32781,7 +32801,11 @@ function collectAnchoredDrawings(blocks, measures) {
32781
32801
  if (isPageRelativeAnchor(drawingBlock)) {
32782
32802
  continue;
32783
32803
  }
32784
- let anchorParaIndex = nearestPrevParagraph(i);
32804
+ const anchorParagraphId = typeof drawingBlock.attrs === "object" && drawingBlock.attrs ? drawingBlock.attrs.anchorParagraphId : void 0;
32805
+ let anchorParaIndex = typeof anchorParagraphId === "string" ? paragraphIndexById.get(anchorParagraphId) ?? null : null;
32806
+ if (anchorParaIndex == null) {
32807
+ anchorParaIndex = nearestPrevParagraph(i);
32808
+ }
32785
32809
  if (anchorParaIndex == null) anchorParaIndex = nearestNextParagraph(i);
32786
32810
  if (anchorParaIndex == null) continue;
32787
32811
  const list = map3.get(anchorParaIndex) ?? [];
@@ -32792,6 +32816,13 @@ function collectAnchoredDrawings(blocks, measures) {
32792
32816
  }
32793
32817
  function collectAnchoredTables(blocks, measures) {
32794
32818
  const map3 = /* @__PURE__ */ new Map();
32819
+ const paragraphIndexById = /* @__PURE__ */ new Map();
32820
+ for (let i = 0; i < blocks.length; i += 1) {
32821
+ const block = blocks[i];
32822
+ if (block.kind === "paragraph") {
32823
+ paragraphIndexById.set(block.id, i);
32824
+ }
32825
+ }
32795
32826
  const nearestPrevParagraph = (fromIndex) => {
32796
32827
  for (let i = fromIndex - 1; i >= 0; i -= 1) {
32797
32828
  if (blocks[i].kind === "paragraph") return i;
@@ -32811,7 +32842,11 @@ function collectAnchoredTables(blocks, measures) {
32811
32842
  const tableBlock = block;
32812
32843
  const tableMeasure = measure;
32813
32844
  if (!tableBlock.anchor?.isAnchored) continue;
32814
- let anchorParaIndex = nearestPrevParagraph(i);
32845
+ const anchorParagraphId = typeof tableBlock.attrs === "object" && tableBlock.attrs ? tableBlock.attrs.anchorParagraphId : void 0;
32846
+ let anchorParaIndex = typeof anchorParagraphId === "string" ? paragraphIndexById.get(anchorParagraphId) ?? null : null;
32847
+ if (anchorParaIndex == null) {
32848
+ anchorParaIndex = nearestPrevParagraph(i);
32849
+ }
32815
32850
  if (anchorParaIndex == null) anchorParaIndex = nearestNextParagraph(i);
32816
32851
  if (anchorParaIndex == null) continue;
32817
32852
  const list = map3.get(anchorParaIndex) ?? [];
@@ -45213,6 +45248,20 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
45213
45248
  let partIndex = 0;
45214
45249
  let tabOrdinal = 0;
45215
45250
  const nextId = () => partIndex === 0 ? baseBlockId : `${baseBlockId}-${partIndex}`;
45251
+ const attachAnchorParagraphId = (block, anchorParagraphId) => {
45252
+ const applicableKinds = /* @__PURE__ */ new Set(["drawing", "image", "table"]);
45253
+ if (!applicableKinds.has(block.kind)) {
45254
+ return block;
45255
+ }
45256
+ const blockWithAttrs = block;
45257
+ return {
45258
+ ...blockWithAttrs,
45259
+ attrs: {
45260
+ ...blockWithAttrs.attrs ?? {},
45261
+ anchorParagraphId
45262
+ }
45263
+ };
45264
+ };
45216
45265
  const flushParagraph = () => {
45217
45266
  if (currentRuns.length === 0) {
45218
45267
  return;
@@ -45444,6 +45493,7 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
45444
45493
  }
45445
45494
  return;
45446
45495
  }
45496
+ const anchorParagraphId = nextId();
45447
45497
  flushParagraph();
45448
45498
  const mergedMarks = [...node.marks ?? [], ...inheritedMarks ?? []];
45449
45499
  const trackedMeta = trackedChanges?.enabled ? collectTrackedChangeFromMarks(mergedMarks) : void 0;
@@ -45454,7 +45504,7 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
45454
45504
  const imageBlock = converters.imageNodeToBlock(node, nextBlockId, positions, trackedMeta, trackedChanges);
45455
45505
  if (imageBlock && imageBlock.kind === "image") {
45456
45506
  annotateBlockWithTrackedChange(imageBlock, trackedMeta, trackedChanges);
45457
- blocks.push(imageBlock);
45507
+ blocks.push(attachAnchorParagraphId(imageBlock, anchorParagraphId));
45458
45508
  }
45459
45509
  }
45460
45510
  return;
@@ -45462,6 +45512,7 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
45462
45512
  if (node.type === "contentBlock") {
45463
45513
  const attrs = node.attrs ?? {};
45464
45514
  if (attrs.horizontalRule === true) {
45515
+ const anchorParagraphId = nextId();
45465
45516
  flushParagraph();
45466
45517
  const indent = paragraphAttrs?.indent;
45467
45518
  const hrIndentLeft = typeof indent?.left === "number" ? indent.left : void 0;
@@ -45471,52 +45522,57 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
45471
45522
  const convert = converters?.contentBlockNodeToDrawingBlock ?? contentBlockNodeToDrawingBlock;
45472
45523
  const drawingBlock = convert(hrNode, nextBlockId, positions);
45473
45524
  if (drawingBlock) {
45474
- blocks.push(drawingBlock);
45525
+ blocks.push(attachAnchorParagraphId(drawingBlock, anchorParagraphId));
45475
45526
  }
45476
45527
  }
45477
45528
  return;
45478
45529
  }
45479
45530
  if (node.type === "vectorShape") {
45531
+ const anchorParagraphId = nextId();
45480
45532
  flushParagraph();
45481
45533
  if (converters?.vectorShapeNodeToDrawingBlock) {
45482
45534
  const drawingBlock = converters.vectorShapeNodeToDrawingBlock(node, nextBlockId, positions);
45483
45535
  if (drawingBlock) {
45484
- blocks.push(drawingBlock);
45536
+ blocks.push(attachAnchorParagraphId(drawingBlock, anchorParagraphId));
45485
45537
  }
45486
45538
  }
45487
45539
  return;
45488
45540
  }
45489
45541
  if (node.type === "shapeGroup") {
45542
+ const anchorParagraphId = nextId();
45490
45543
  flushParagraph();
45491
45544
  if (converters?.shapeGroupNodeToDrawingBlock) {
45492
45545
  const drawingBlock = converters.shapeGroupNodeToDrawingBlock(node, nextBlockId, positions);
45493
45546
  if (drawingBlock) {
45494
- blocks.push(drawingBlock);
45547
+ blocks.push(attachAnchorParagraphId(drawingBlock, anchorParagraphId));
45495
45548
  }
45496
45549
  }
45497
45550
  return;
45498
45551
  }
45499
45552
  if (node.type === "shapeContainer") {
45553
+ const anchorParagraphId = nextId();
45500
45554
  flushParagraph();
45501
45555
  if (converters?.shapeContainerNodeToDrawingBlock) {
45502
45556
  const drawingBlock = converters.shapeContainerNodeToDrawingBlock(node, nextBlockId, positions);
45503
45557
  if (drawingBlock) {
45504
- blocks.push(drawingBlock);
45558
+ blocks.push(attachAnchorParagraphId(drawingBlock, anchorParagraphId));
45505
45559
  }
45506
45560
  }
45507
45561
  return;
45508
45562
  }
45509
45563
  if (node.type === "shapeTextbox") {
45564
+ const anchorParagraphId = nextId();
45510
45565
  flushParagraph();
45511
45566
  if (converters?.shapeTextboxNodeToDrawingBlock) {
45512
45567
  const drawingBlock = converters.shapeTextboxNodeToDrawingBlock(node, nextBlockId, positions);
45513
45568
  if (drawingBlock) {
45514
- blocks.push(drawingBlock);
45569
+ blocks.push(attachAnchorParagraphId(drawingBlock, anchorParagraphId));
45515
45570
  }
45516
45571
  }
45517
45572
  return;
45518
45573
  }
45519
45574
  if (node.type === "table") {
45575
+ const anchorParagraphId = nextId();
45520
45576
  flushParagraph();
45521
45577
  if (converters?.tableNodeToBlock) {
45522
45578
  const tableBlock = converters.tableNodeToBlock(
@@ -45533,7 +45589,7 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
45533
45589
  ...converterContext !== void 0 ? [converterContext] : []
45534
45590
  );
45535
45591
  if (tableBlock) {
45536
- blocks.push(tableBlock);
45592
+ blocks.push(attachAnchorParagraphId(tableBlock, anchorParagraphId));
45537
45593
  }
45538
45594
  }
45539
45595
  return;
@@ -1,5 +1,5 @@
1
- import { B as BIT8, M as MAX_SAFE_INTEGER, c as create, a as BITS7, u as utf8TextDecoder, b as create$1, s as setIfUndefined, d as create$2, f as from, e as floor$1, g as equalityDeep, w as writeVarUint, h as writeVarString, t as toUint8Array, i as createEncoder, j as createInjectionKey, k as toString, l as throwError, m as useSsrAdapter, n as configProviderInjectionKey, o as cssrAnchorMetaName, p as globalStyle, q as cB, r as c, v as isMounted, x as commonVariables$2, y as cM, z as cNotM, A as cE, C as derived, D as changeColor, E as insideModal, F as insidePopover, G as resolveWrappedSlot, H as on, I as warnOnce, J as useConfig, K as useMergedState, L as useMemo, N as useTheme, O as useRtl, P as createKey, Q as useThemeClass, R as createId, S as call, T as render, U as messageProviderInjectionKey, V as messageApiInjectionKey, W as fromBase64, X as onChange, Y as varStorage, Z as toBase64, _ as createUint8ArrayFromArrayBuffer, $ as offChange, a0 as writeVarUint8Array, a1 as map, a2 as length, a3 as isNode, a4 as min, a5 as pow, a6 as comments_module_events, a7 as getFileObject, a8 as getTrackChanges, a9 as CommentsPluginKey, aa as TrackChangesBasePluginKey, ab as Editor, ac as getRichTextExtensions, ad as ellipsisVerticalSvg, ae as xmarkIconSvg, af as checkIconSvg, ag as caretDownIconSvg, ah as commentIconSvg, ai as _export_sfc, aj as NDropdown, ak as SuperInput, al as vClickOutside, am as PresentationEditor, an as SuperEditor, ao as AIWriter, ap as NConfigProvider, aq as SuperToolbar } from "./index-SYGYHKb5.es.js";
2
- import "./SuperConverter-BE5tNyQz.es.js";
1
+ import { B as BIT8, M as MAX_SAFE_INTEGER, c as create, a as BITS7, u as utf8TextDecoder, b as create$1, s as setIfUndefined, d as create$2, f as from, e as floor$1, g as equalityDeep, w as writeVarUint, h as writeVarString, t as toUint8Array, i as createEncoder, j as createInjectionKey, k as toString, l as throwError, m as useSsrAdapter, n as configProviderInjectionKey, o as cssrAnchorMetaName, p as globalStyle, q as cB, r as c, v as isMounted, x as commonVariables$2, y as cM, z as cNotM, A as cE, C as derived, D as changeColor, E as insideModal, F as insidePopover, G as resolveWrappedSlot, H as on, I as warnOnce, J as useConfig, K as useMergedState, L as useMemo, N as useTheme, O as useRtl, P as createKey, Q as useThemeClass, R as createId, S as call, T as render, U as messageProviderInjectionKey, V as messageApiInjectionKey, W as fromBase64, X as onChange, Y as varStorage, Z as toBase64, _ as createUint8ArrayFromArrayBuffer, $ as offChange, a0 as writeVarUint8Array, a1 as map, a2 as length, a3 as isNode, a4 as min, a5 as pow, a6 as comments_module_events, a7 as getFileObject, a8 as getTrackChanges, a9 as CommentsPluginKey, aa as TrackChangesBasePluginKey, ab as Editor, ac as getRichTextExtensions, ad as ellipsisVerticalSvg, ae as xmarkIconSvg, af as checkIconSvg, ag as caretDownIconSvg, ah as commentIconSvg, ai as _export_sfc, aj as NDropdown, ak as SuperInput, al as vClickOutside, am as PresentationEditor, an as SuperEditor, ao as AIWriter, ap as NConfigProvider, aq as SuperToolbar } from "./index-CJec1cbb.es.js";
2
+ import "./SuperConverter-BQ6PNaJ8.es.js";
3
3
  import { B as BlankDOCX } from "./blank-docx-ABm6XYAA.es.js";
4
4
  import { E as EventEmitter } from "./eventemitter3-CwrdEv8r.es.js";
5
5
  import { HocuspocusProvider, HocuspocusProviderWebsocket } from "@hocuspocus/provider";
@@ -6200,12 +6200,13 @@ const _sfc_main$c = {
6200
6200
  return currentCommentText.value && currentCommentText.value !== "<p></p>";
6201
6201
  });
6202
6202
  const setFocus = () => {
6203
- if (props.comment.resolvedTime) return;
6204
6203
  const editor = proxy.$superdoc.activeEditor;
6205
- activeComment.value = props.comment.commentId;
6206
- props.comment.setActive(proxy.$superdoc);
6204
+ if (!props.comment.resolvedTime) {
6205
+ activeComment.value = props.comment.commentId;
6206
+ props.comment.setActive(proxy.$superdoc);
6207
+ }
6207
6208
  if (editor) {
6208
- const cursorId = props.comment.importedId || props.comment.commentId;
6209
+ const cursorId = props.comment.resolvedTime ? props.comment.commentId : props.comment.importedId || props.comment.commentId;
6209
6210
  editor.commands?.setCursorById(cursorId);
6210
6211
  }
6211
6212
  };
@@ -6441,7 +6442,7 @@ const _sfc_main$c = {
6441
6442
  };
6442
6443
  }
6443
6444
  };
6444
- const CommentDialog = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__scopeId", "data-v-dc2a79b5"]]);
6445
+ const CommentDialog = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__scopeId", "data-v-d50fd675"]]);
6445
6446
  const _hoisted_1$a = { class: "comments-list" };
6446
6447
  const _hoisted_2$5 = { key: 0 };
6447
6448
  const _hoisted_3$3 = { class: "comment-item" };
@@ -7448,7 +7449,7 @@ const _sfc_main = {
7448
7449
  __name: "SuperDoc",
7449
7450
  emits: ["selection-update"],
7450
7451
  setup(__props, { emit: __emit }) {
7451
- const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-B0cx-Fxj.es.js"));
7452
+ const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-CPnVLLJm.es.js"));
7452
7453
  const superdocStore = useSuperdocStore();
7453
7454
  const commentsStore = useCommentsStore();
7454
7455
  const {
@@ -8377,7 +8378,7 @@ class SuperDoc extends EventEmitter {
8377
8378
  this.config.colors = shuffleArray(this.config.colors);
8378
8379
  this.userColorMap = /* @__PURE__ */ new Map();
8379
8380
  this.colorIndex = 0;
8380
- this.version = "1.3.1-next.2";
8381
+ this.version = "1.3.1-next.3";
8381
8382
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
8382
8383
  this.superdocId = config.superdocId || v4();
8383
8384
  this.colors = this.config.colors;