@harbour-enterprises/superdoc 1.3.1-next.1 → 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,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-rwP6nlvC.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.1";
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.1");
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");
@@ -25097,6 +25103,7 @@ class DomPainter {
25097
25103
  this.layoutVersion = 0;
25098
25104
  this.layoutEpoch = 0;
25099
25105
  this.processedLayoutVersion = -1;
25106
+ this.currentMapping = null;
25100
25107
  this.onScrollHandler = null;
25101
25108
  this.onWindowScrollHandler = null;
25102
25109
  this.onResizeHandler = null;
@@ -25202,7 +25209,7 @@ class DomPainter {
25202
25209
  this.blockLookup = nextLookup;
25203
25210
  this.changedBlocks = changed;
25204
25211
  }
25205
- paint(layout, mount2) {
25212
+ paint(layout, mount2, mapping) {
25206
25213
  if (!(mount2 instanceof HTMLElement)) {
25207
25214
  throw new Error("DomPainter.paint requires a valid HTMLElement mount");
25208
25215
  }
@@ -25211,6 +25218,13 @@ class DomPainter {
25211
25218
  throw new Error("DomPainter.paint requires a DOM-like document");
25212
25219
  }
25213
25220
  this.doc = doc2;
25221
+ const isSimpleTransaction = mapping && mapping.maps.length === 1;
25222
+ if (mapping && !isSimpleTransaction) {
25223
+ this.blockLookup.forEach((_, id) => this.changedBlocks.add(id));
25224
+ this.currentMapping = null;
25225
+ } else {
25226
+ this.currentMapping = mapping ?? null;
25227
+ }
25214
25228
  ensurePrintStyles(doc2);
25215
25229
  ensureLinkStyles(doc2);
25216
25230
  ensureTrackChangeStyles(doc2);
@@ -25237,6 +25251,7 @@ class DomPainter {
25237
25251
  this.currentLayout = layout;
25238
25252
  this.pageStates = [];
25239
25253
  this.changedBlocks.clear();
25254
+ this.currentMapping = null;
25240
25255
  return;
25241
25256
  }
25242
25257
  if (mode === "book") {
@@ -25245,6 +25260,7 @@ class DomPainter {
25245
25260
  this.currentLayout = layout;
25246
25261
  this.pageStates = [];
25247
25262
  this.changedBlocks.clear();
25263
+ this.currentMapping = null;
25248
25264
  return;
25249
25265
  }
25250
25266
  applyStyles$2(mount2, containerStyles);
@@ -25253,6 +25269,7 @@ class DomPainter {
25253
25269
  this.renderVirtualized(layout, mount2);
25254
25270
  this.currentLayout = layout;
25255
25271
  this.changedBlocks.clear();
25272
+ this.currentMapping = null;
25256
25273
  return;
25257
25274
  }
25258
25275
  mount2.style.gap = `${this.pageGap}px`;
@@ -25263,6 +25280,7 @@ class DomPainter {
25263
25280
  }
25264
25281
  this.currentLayout = layout;
25265
25282
  this.changedBlocks.clear();
25283
+ this.currentMapping = null;
25266
25284
  }
25267
25285
  // ----------------
25268
25286
  // Virtualized path
@@ -25794,6 +25812,8 @@ class DomPainter {
25794
25812
  pageEl.replaceChild(replacement, current.element);
25795
25813
  current.element = replacement;
25796
25814
  current.signature = fragmentSignature(fragment, this.blockLookup);
25815
+ } else if (this.currentMapping) {
25816
+ this.updatePositionAttributes(current.element, this.currentMapping);
25797
25817
  }
25798
25818
  this.updateFragmentElement(current.element, fragment, contextBase.section);
25799
25819
  current.fragment = fragment;
@@ -25822,6 +25842,45 @@ class DomPainter {
25822
25842
  state.fragments = nextFragments;
25823
25843
  this.renderDecorationsForPage(pageEl, page);
25824
25844
  }
25845
+ /**
25846
+ * Updates data-pm-start/data-pm-end attributes on all elements within a fragment
25847
+ * using the transaction's mapping. Skips header/footer content (separate PM coordinate space).
25848
+ * Also skips fragments that end before the edit point (their positions don't change).
25849
+ */
25850
+ updatePositionAttributes(fragmentEl, mapping) {
25851
+ if (fragmentEl.closest(".superdoc-page-header, .superdoc-page-footer")) {
25852
+ return;
25853
+ }
25854
+ try {
25855
+ const fragEnd = fragmentEl.dataset.pmEnd;
25856
+ if (fragEnd !== void 0 && fragEnd !== "") {
25857
+ const endNum = Number(fragEnd);
25858
+ if (Number.isFinite(endNum) && mapping.map(endNum, -1) === endNum) {
25859
+ return;
25860
+ }
25861
+ }
25862
+ const elements = fragmentEl.querySelectorAll("[data-pm-start], [data-pm-end]");
25863
+ const allElements = [fragmentEl, ...Array.from(elements)];
25864
+ for (const el of allElements) {
25865
+ const oldStart = el.dataset.pmStart;
25866
+ const oldEnd = el.dataset.pmEnd;
25867
+ if (oldStart !== void 0 && oldStart !== "") {
25868
+ const num = Number(oldStart);
25869
+ if (Number.isFinite(num)) {
25870
+ el.dataset.pmStart = String(mapping.map(num));
25871
+ }
25872
+ }
25873
+ if (oldEnd !== void 0 && oldEnd !== "") {
25874
+ const num = Number(oldEnd);
25875
+ if (Number.isFinite(num)) {
25876
+ el.dataset.pmEnd = String(mapping.map(num, -1));
25877
+ }
25878
+ }
25879
+ }
25880
+ } catch (error) {
25881
+ console.error("Error updating position attributes with mapping:", error);
25882
+ }
25883
+ }
25825
25884
  createPageState(page, pageSize) {
25826
25885
  if (!this.doc) {
25827
25886
  throw new Error("DomPainter.createPageState requires a document");
@@ -28199,8 +28258,6 @@ const fragmentSignature = (fragment, lookup) => {
28199
28258
  base2,
28200
28259
  fragment.fromLine,
28201
28260
  fragment.toLine,
28202
- fragment.pmStart ?? "",
28203
- fragment.pmEnd ?? "",
28204
28261
  fragment.continuesFromPrev ? 1 : 0,
28205
28262
  fragment.continuesOnNext ? 1 : 0,
28206
28263
  fragment.markerWidth ?? ""
@@ -28292,16 +28349,15 @@ const deriveBlockVersion = (block) => {
28292
28349
  imgRun.distTop ?? "",
28293
28350
  imgRun.distBottom ?? "",
28294
28351
  imgRun.distLeft ?? "",
28295
- imgRun.distRight ?? "",
28296
- imgRun.pmStart ?? "",
28297
- imgRun.pmEnd ?? ""
28352
+ imgRun.distRight ?? ""
28353
+ // Note: pmStart/pmEnd intentionally excluded to prevent O(n) change detection
28298
28354
  ].join(",");
28299
28355
  }
28300
28356
  if (run.kind === "lineBreak") {
28301
- return ["linebreak", run.pmStart ?? "", run.pmEnd ?? ""].join(",");
28357
+ return "linebreak";
28302
28358
  }
28303
28359
  if (run.kind === "tab") {
28304
- return [run.text ?? "", "tab", run.pmStart ?? "", run.pmEnd ?? ""].join(",");
28360
+ return [run.text ?? "", "tab"].join(",");
28305
28361
  }
28306
28362
  const textRun = run;
28307
28363
  return [
@@ -28317,8 +28373,7 @@ const deriveBlockVersion = (block) => {
28317
28373
  textRun.strike ? 1 : 0,
28318
28374
  textRun.highlight ?? "",
28319
28375
  textRun.letterSpacing != null ? textRun.letterSpacing : "",
28320
- textRun.pmStart ?? "",
28321
- textRun.pmEnd ?? "",
28376
+ // Note: pmStart/pmEnd intentionally excluded to prevent O(n) change detection
28322
28377
  textRun.token ?? "",
28323
28378
  // Tracked changes - force re-render when added or removed tracked change
28324
28379
  textRun.trackedChange ? 1 : 0,
@@ -28777,8 +28832,8 @@ const createDomPainter = (options) => {
28777
28832
  ruler: options.ruler
28778
28833
  });
28779
28834
  return {
28780
- paint(layout, mount2) {
28781
- painter.paint(layout, mount2);
28835
+ paint(layout, mount2, mapping) {
28836
+ painter.paint(layout, mount2, mapping);
28782
28837
  },
28783
28838
  setData(blocks, measures, headerBlocks, headerMeasures, footerBlocks, footerMeasures) {
28784
28839
  painter.setData(blocks, measures, headerBlocks, headerMeasures, footerBlocks, footerMeasures);
@@ -31644,8 +31699,15 @@ function layoutParagraphBlock(ctx2, anchors) {
31644
31699
  } else if (vRelativeFrom === "paragraph") {
31645
31700
  const baseAnchorY = state.cursorY;
31646
31701
  const firstLineHeight = measure.lines?.[0]?.lineHeight ?? 0;
31647
- const paragraphAdjustment = firstLineHeight / 2;
31648
- 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
+ }
31649
31711
  } else {
31650
31712
  const baseAnchorY = state.cursorY;
31651
31713
  anchorY = baseAnchorY + offsetV;
@@ -32706,6 +32768,13 @@ function collectPreRegisteredAnchors(blocks, measures) {
32706
32768
  function collectAnchoredDrawings(blocks, measures) {
32707
32769
  const map3 = /* @__PURE__ */ new Map();
32708
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
+ }
32709
32778
  const nearestPrevParagraph = (fromIndex) => {
32710
32779
  for (let i = fromIndex - 1; i >= 0; i -= 1) {
32711
32780
  if (blocks[i].kind === "paragraph") return i;
@@ -32732,7 +32801,11 @@ function collectAnchoredDrawings(blocks, measures) {
32732
32801
  if (isPageRelativeAnchor(drawingBlock)) {
32733
32802
  continue;
32734
32803
  }
32735
- 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
+ }
32736
32809
  if (anchorParaIndex == null) anchorParaIndex = nearestNextParagraph(i);
32737
32810
  if (anchorParaIndex == null) continue;
32738
32811
  const list = map3.get(anchorParaIndex) ?? [];
@@ -32743,6 +32816,13 @@ function collectAnchoredDrawings(blocks, measures) {
32743
32816
  }
32744
32817
  function collectAnchoredTables(blocks, measures) {
32745
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
+ }
32746
32826
  const nearestPrevParagraph = (fromIndex) => {
32747
32827
  for (let i = fromIndex - 1; i >= 0; i -= 1) {
32748
32828
  if (blocks[i].kind === "paragraph") return i;
@@ -32762,7 +32842,11 @@ function collectAnchoredTables(blocks, measures) {
32762
32842
  const tableBlock = block;
32763
32843
  const tableMeasure = measure;
32764
32844
  if (!tableBlock.anchor?.isAnchored) continue;
32765
- 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
+ }
32766
32850
  if (anchorParaIndex == null) anchorParaIndex = nearestNextParagraph(i);
32767
32851
  if (anchorParaIndex == null) continue;
32768
32852
  const list = map3.get(anchorParaIndex) ?? [];
@@ -45164,6 +45248,20 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
45164
45248
  let partIndex = 0;
45165
45249
  let tabOrdinal = 0;
45166
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
+ };
45167
45265
  const flushParagraph = () => {
45168
45266
  if (currentRuns.length === 0) {
45169
45267
  return;
@@ -45395,6 +45493,7 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
45395
45493
  }
45396
45494
  return;
45397
45495
  }
45496
+ const anchorParagraphId = nextId();
45398
45497
  flushParagraph();
45399
45498
  const mergedMarks = [...node.marks ?? [], ...inheritedMarks ?? []];
45400
45499
  const trackedMeta = trackedChanges?.enabled ? collectTrackedChangeFromMarks(mergedMarks) : void 0;
@@ -45405,7 +45504,7 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
45405
45504
  const imageBlock = converters.imageNodeToBlock(node, nextBlockId, positions, trackedMeta, trackedChanges);
45406
45505
  if (imageBlock && imageBlock.kind === "image") {
45407
45506
  annotateBlockWithTrackedChange(imageBlock, trackedMeta, trackedChanges);
45408
- blocks.push(imageBlock);
45507
+ blocks.push(attachAnchorParagraphId(imageBlock, anchorParagraphId));
45409
45508
  }
45410
45509
  }
45411
45510
  return;
@@ -45413,6 +45512,7 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
45413
45512
  if (node.type === "contentBlock") {
45414
45513
  const attrs = node.attrs ?? {};
45415
45514
  if (attrs.horizontalRule === true) {
45515
+ const anchorParagraphId = nextId();
45416
45516
  flushParagraph();
45417
45517
  const indent = paragraphAttrs?.indent;
45418
45518
  const hrIndentLeft = typeof indent?.left === "number" ? indent.left : void 0;
@@ -45422,52 +45522,57 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
45422
45522
  const convert = converters?.contentBlockNodeToDrawingBlock ?? contentBlockNodeToDrawingBlock;
45423
45523
  const drawingBlock = convert(hrNode, nextBlockId, positions);
45424
45524
  if (drawingBlock) {
45425
- blocks.push(drawingBlock);
45525
+ blocks.push(attachAnchorParagraphId(drawingBlock, anchorParagraphId));
45426
45526
  }
45427
45527
  }
45428
45528
  return;
45429
45529
  }
45430
45530
  if (node.type === "vectorShape") {
45531
+ const anchorParagraphId = nextId();
45431
45532
  flushParagraph();
45432
45533
  if (converters?.vectorShapeNodeToDrawingBlock) {
45433
45534
  const drawingBlock = converters.vectorShapeNodeToDrawingBlock(node, nextBlockId, positions);
45434
45535
  if (drawingBlock) {
45435
- blocks.push(drawingBlock);
45536
+ blocks.push(attachAnchorParagraphId(drawingBlock, anchorParagraphId));
45436
45537
  }
45437
45538
  }
45438
45539
  return;
45439
45540
  }
45440
45541
  if (node.type === "shapeGroup") {
45542
+ const anchorParagraphId = nextId();
45441
45543
  flushParagraph();
45442
45544
  if (converters?.shapeGroupNodeToDrawingBlock) {
45443
45545
  const drawingBlock = converters.shapeGroupNodeToDrawingBlock(node, nextBlockId, positions);
45444
45546
  if (drawingBlock) {
45445
- blocks.push(drawingBlock);
45547
+ blocks.push(attachAnchorParagraphId(drawingBlock, anchorParagraphId));
45446
45548
  }
45447
45549
  }
45448
45550
  return;
45449
45551
  }
45450
45552
  if (node.type === "shapeContainer") {
45553
+ const anchorParagraphId = nextId();
45451
45554
  flushParagraph();
45452
45555
  if (converters?.shapeContainerNodeToDrawingBlock) {
45453
45556
  const drawingBlock = converters.shapeContainerNodeToDrawingBlock(node, nextBlockId, positions);
45454
45557
  if (drawingBlock) {
45455
- blocks.push(drawingBlock);
45558
+ blocks.push(attachAnchorParagraphId(drawingBlock, anchorParagraphId));
45456
45559
  }
45457
45560
  }
45458
45561
  return;
45459
45562
  }
45460
45563
  if (node.type === "shapeTextbox") {
45564
+ const anchorParagraphId = nextId();
45461
45565
  flushParagraph();
45462
45566
  if (converters?.shapeTextboxNodeToDrawingBlock) {
45463
45567
  const drawingBlock = converters.shapeTextboxNodeToDrawingBlock(node, nextBlockId, positions);
45464
45568
  if (drawingBlock) {
45465
- blocks.push(drawingBlock);
45569
+ blocks.push(attachAnchorParagraphId(drawingBlock, anchorParagraphId));
45466
45570
  }
45467
45571
  }
45468
45572
  return;
45469
45573
  }
45470
45574
  if (node.type === "table") {
45575
+ const anchorParagraphId = nextId();
45471
45576
  flushParagraph();
45472
45577
  if (converters?.tableNodeToBlock) {
45473
45578
  const tableBlock = converters.tableNodeToBlock(
@@ -45484,7 +45589,7 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
45484
45589
  ...converterContext !== void 0 ? [converterContext] : []
45485
45590
  );
45486
45591
  if (tableBlock) {
45487
- blocks.push(tableBlock);
45592
+ blocks.push(attachAnchorParagraphId(tableBlock, anchorParagraphId));
45488
45593
  }
45489
45594
  }
45490
45595
  return;
@@ -50238,6 +50343,7 @@ class PresentationEditor extends EventEmitter {
50238
50343
  #telemetryEmitter = null;
50239
50344
  #renderScheduled = false;
50240
50345
  #pendingDocChange = false;
50346
+ #pendingMapping = null;
50241
50347
  #isRerendering = false;
50242
50348
  #selectionSync = new SelectionSyncCoordinator();
50243
50349
  #remoteCursorUpdateScheduled = false;
@@ -51845,6 +51951,15 @@ class PresentationEditor extends EventEmitter {
51845
51951
  }
51846
51952
  if (trackedChangesChanged || transaction?.docChanged) {
51847
51953
  this.#pendingDocChange = true;
51954
+ if (transaction?.docChanged) {
51955
+ if (this.#pendingMapping !== null) {
51956
+ const combined = this.#pendingMapping.slice();
51957
+ combined.appendMapping(transaction.mapping);
51958
+ this.#pendingMapping = combined;
51959
+ } else {
51960
+ this.#pendingMapping = transaction.mapping;
51961
+ }
51962
+ }
51848
51963
  this.#selectionSync.onLayoutStart();
51849
51964
  this.#scheduleRerender();
51850
51965
  }
@@ -53437,7 +53552,9 @@ class PresentationEditor extends EventEmitter {
53437
53552
  footerMeasures.length > 0 ? footerMeasures : void 0
53438
53553
  );
53439
53554
  this.#domIndexObserverManager?.pause();
53440
- painter.paint(layout, this.#painterHost);
53555
+ const mapping = this.#pendingMapping;
53556
+ this.#pendingMapping = null;
53557
+ painter.paint(layout, this.#painterHost, mapping ?? void 0);
53441
53558
  this.#applyVertAlignToLayout();
53442
53559
  this.#rebuildDomPositionIndex();
53443
53560
  this.#domIndexObserverManager?.resume();
@@ -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-DZF2SDeC.es.js";
2
- import "./SuperConverter-AxPNFosS.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-BVvi-ZEK.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.1";
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;
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
 
@@ -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-rwP6nlvC.cjs");
5
+ const superEditor_converter = require("../chunks/SuperConverter-p1tQGIew.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-AxPNFosS.es.js";
3
+ import { S } from "../chunks/SuperConverter-BQ6PNaJ8.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-Ccw24rQt.cjs");
3
+ const index = require("./chunks/index-DLX_v-vr.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-rwP6nlvC.cjs");
7
+ const superEditor_converter = require("./chunks/SuperConverter-p1tQGIew.cjs");
8
8
  function isNodeType(node, name) {
9
9
  return node.type.name === name;
10
10
  }
@@ -1,9 +1,9 @@
1
- import { ax as Node, ay as Mark } from "./chunks/index-DZF2SDeC.es.js";
2
- import { ao, au, a9, ab, aw, am, av, aA, an, ak, aq, az, aa, as, aC, aE, aB, ac, aD, ar, at } from "./chunks/index-DZF2SDeC.es.js";
1
+ import { ax as Node, ay as Mark } from "./chunks/index-CJec1cbb.es.js";
2
+ import { ao, au, a9, ab, aw, am, av, aA, an, ak, aq, az, aa, as, aC, aE, aB, ac, aD, ar, at } from "./chunks/index-CJec1cbb.es.js";
3
3
  import { default as default2 } from "./super-editor/docx-zipper.es.js";
4
4
  import { createZip } from "./super-editor/file-zipper.es.js";
5
5
  import { d as defineComponent, E as createElementBlock, G as openBlock, K as createBaseVNode } from "./chunks/vue-BnBKJwCW.es.js";
6
- import { S, r } from "./chunks/SuperConverter-AxPNFosS.es.js";
6
+ import { S, r } from "./chunks/SuperConverter-BQ6PNaJ8.es.js";
7
7
  function isNodeType(node, name) {
8
8
  return node.type.name === name;
9
9
  }
package/dist/superdoc.cjs CHANGED
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("./chunks/index-Ccw24rQt.cjs");
4
- const superdoc = require("./chunks/index-BmwaXglr.cjs");
5
- const superEditor_converter = require("./chunks/SuperConverter-rwP6nlvC.cjs");
3
+ const index = require("./chunks/index-DLX_v-vr.cjs");
4
+ const superdoc = require("./chunks/index-BQYtE-5U.cjs");
5
+ const superEditor_converter = require("./chunks/SuperConverter-p1tQGIew.cjs");
6
6
  const blankDocx = require("./chunks/blank-docx-DfW3Eeh2.cjs");
7
7
  require("./chunks/jszip-C8_CqJxM.cjs");
8
8
  require("./chunks/helpers-nOdwpmwb.cjs");
@@ -1,6 +1,6 @@
1
- import { au, ab, aw, av, as, a7, ac, ar, at } from "./chunks/index-DZF2SDeC.es.js";
2
- import { D, H, P, S, c } from "./chunks/index-IUXq0EQx.es.js";
3
- import { S as S2, r } from "./chunks/SuperConverter-AxPNFosS.es.js";
1
+ import { au, ab, aw, av, as, a7, ac, ar, at } from "./chunks/index-CJec1cbb.es.js";
2
+ import { D, H, P, S, c } from "./chunks/index-DXSUcHli.es.js";
3
+ import { S as S2, r } from "./chunks/SuperConverter-BQ6PNaJ8.es.js";
4
4
  import { B } from "./chunks/blank-docx-ABm6XYAA.es.js";
5
5
  import "./chunks/jszip-B1fkPkPJ.es.js";
6
6
  import "./chunks/helpers-C8e9wR5l.es.js";