@harbour-enterprises/superdoc 2.0.0-next.13 → 2.0.0-next.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/dist/chunks/{PdfViewer-DGJe0yHt.es.js → PdfViewer-BmTqUXHe.es.js} +1 -1
  2. package/dist/chunks/{PdfViewer-CHWTTxtm.cjs → PdfViewer-DK5jEu1K.cjs} +1 -1
  3. package/dist/chunks/{index-DwECJSoY.cjs → index-B14ZiJ2S.cjs} +4 -6
  4. package/dist/chunks/{index-Bh0gd0Pm-DMBx9Ybz.es.js → index-DgGQUbNh-_ef55vRc.es.js} +1 -1
  5. package/dist/chunks/{index-Bh0gd0Pm-BGAaVc0H.cjs → index-DgGQUbNh-xpdP4M-B.cjs} +1 -1
  6. package/dist/chunks/{index-BbC6VsXh.es.js → index-nxK0aRdv.es.js} +4 -6
  7. package/dist/chunks/{super-editor.es-CZoFXUj4.cjs → super-editor.es-DL9CVTke.cjs} +99 -9
  8. package/dist/chunks/{super-editor.es-BJ1ZZaEo.es.js → super-editor.es-Ds9GHHHL.es.js} +99 -9
  9. package/dist/packages/superdoc/src/stores/comments-store.d.ts.map +1 -1
  10. package/dist/super-editor/ai-writer.es.js +2 -2
  11. package/dist/super-editor/chunks/{converter-Dx9n2qwO.js → converter-BvxISp2B.js} +1 -3
  12. package/dist/super-editor/chunks/{docx-zipper-Ds8FGkok.js → docx-zipper-BuXfTs6z.js} +1 -1
  13. package/dist/super-editor/chunks/{editor-C8TLVw8v.js → editor-Bgi8FGSM.js} +100 -8
  14. package/dist/super-editor/chunks/{index-Bh0gd0Pm.js → index-DgGQUbNh.js} +1 -1
  15. package/dist/super-editor/chunks/{toolbar-DpUoIWke.js → toolbar-C5SxMMRv.js} +2 -2
  16. package/dist/super-editor/converter.es.js +1 -1
  17. package/dist/super-editor/docx-zipper.es.js +2 -2
  18. package/dist/super-editor/editor.es.js +3 -3
  19. package/dist/super-editor/file-zipper.es.js +1 -1
  20. package/dist/super-editor/super-editor.es.js +6 -6
  21. package/dist/super-editor/toolbar.es.js +2 -2
  22. package/dist/super-editor.cjs +1 -1
  23. package/dist/super-editor.es.js +1 -1
  24. package/dist/superdoc.cjs +2 -2
  25. package/dist/superdoc.es.js +2 -2
  26. package/dist/superdoc.umd.js +102 -14
  27. package/dist/superdoc.umd.js.map +1 -1
  28. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  import { y as defineComponent, A as h, P as Transition, a0 as process$1, K as watchEffect, a as computed, r as ref, j as onMounted, X as onUnmounted, b as createElementBlock, o as openBlock, f as createBaseVNode, e as createCommentVNode, s as createVNode, x as unref } from "./vue-CLFbn_1r.es.js";
2
- import { d as derived, c, a as cB, f as fadeInTransition, b as cM, N as NBaseLoading, w as warnOnce, u as useConfig, e as useTheme, p as pxfy, g as createKey, h as useThemeClass, i as useCompitable, _ as _export_sfc, j as useSuperdocStore, s as storeToRefs, k as useSelection } from "./index-BbC6VsXh.es.js";
2
+ import { d as derived, c, a as cB, f as fadeInTransition, b as cM, N as NBaseLoading, w as warnOnce, u as useConfig, e as useTheme, p as pxfy, g as createKey, h as useThemeClass, i as useCompitable, _ as _export_sfc, j as useSuperdocStore, s as storeToRefs, k as useSelection } from "./index-nxK0aRdv.es.js";
3
3
  function self(vars) {
4
4
  const {
5
5
  opacityDisabled,
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const vue = require("./vue-gvuFr0vx.cjs");
4
- const superdoc = require("./index-DwECJSoY.cjs");
4
+ const superdoc = require("./index-B14ZiJ2S.cjs");
5
5
  function self(vars) {
6
6
  const {
7
7
  opacityDisabled,
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- const superEditor_es = require("./super-editor.es-CZoFXUj4.cjs");
2
+ const superEditor_es = require("./super-editor.es-DL9CVTke.cjs");
3
3
  const blankDocx = require("./blank-docx-DfW3Eeh2.cjs");
4
4
  const eventemitter3 = require("./eventemitter3-DIclNhoR.cjs");
5
5
  const provider = require("@hocuspocus/provider");
@@ -4313,12 +4313,10 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
4313
4313
  return processedComments;
4314
4314
  };
4315
4315
  const convertHtmlToSchema = (commentHTML) => {
4316
- const div = document.createElement("div");
4317
- div.innerHTML = commentHTML;
4318
4316
  const editor = new superEditor_es.Editor({
4319
4317
  mode: "text",
4320
4318
  isHeadless: true,
4321
- content: div,
4319
+ content: commentHTML,
4322
4320
  extensions: superEditor_es.getRichTextExtensions()
4323
4321
  });
4324
4322
  return editor.getJSON().content[0];
@@ -17487,7 +17485,7 @@ const _sfc_main = {
17487
17485
  __name: "SuperDoc",
17488
17486
  emits: ["selection-update"],
17489
17487
  setup(__props, { emit: __emit }) {
17490
- const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-CHWTTxtm.cjs")));
17488
+ const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-DK5jEu1K.cjs")));
17491
17489
  const superdocStore = useSuperdocStore();
17492
17490
  const commentsStore = useCommentsStore();
17493
17491
  const {
@@ -18391,7 +18389,7 @@ class SuperDoc extends eventemitter3.EventEmitter {
18391
18389
  this.config.colors = shuffleArray(this.config.colors);
18392
18390
  this.userColorMap = /* @__PURE__ */ new Map();
18393
18391
  this.colorIndex = 0;
18394
- this.version = "2.0.0-next.13";
18392
+ this.version = "2.0.0-next.15";
18395
18393
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
18396
18394
  this.superdocId = config.superdocId || uuid.v4();
18397
18395
  this.colors = this.config.colors;
@@ -1,4 +1,4 @@
1
- import { s as getDefaultExportFromCjs$2 } from "./super-editor.es-BJ1ZZaEo.es.js";
1
+ import { s as getDefaultExportFromCjs$2 } from "./super-editor.es-Ds9GHHHL.es.js";
2
2
  import { V as VFile } from "./index-CvBqQJbG-CvBqQJbG.es.js";
3
3
  function bail(error) {
4
4
  if (error) {
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const superEditor_es = require("./super-editor.es-CZoFXUj4.cjs");
3
+ const superEditor_es = require("./super-editor.es-DL9CVTke.cjs");
4
4
  const indexCvBqQJbG = require("./index-CvBqQJbG-Dwm0THD7.cjs");
5
5
  function bail(error) {
6
6
  if (error) {
@@ -1,4 +1,4 @@
1
- import { q as index, C as CommentsPluginKey, h as TrackChangesBasePluginKey, E as Editor, n as getRichTextExtensions, f as SuperInput, P as PresentationEditor, e as SuperEditor, A as AIWriter, g as SuperToolbar, i as createZip } from "./super-editor.es-BJ1ZZaEo.es.js";
1
+ import { q as index, C as CommentsPluginKey, h as TrackChangesBasePluginKey, E as Editor, n as getRichTextExtensions, f as SuperInput, P as PresentationEditor, e as SuperEditor, A as AIWriter, g as SuperToolbar, i as createZip } from "./super-editor.es-Ds9GHHHL.es.js";
2
2
  import { B as BlankDOCX } from "./blank-docx-ABm6XYAA.es.js";
3
3
  import { E as EventEmitter } from "./eventemitter3-D_2kqkfV.es.js";
4
4
  import { HocuspocusProvider, HocuspocusProviderWebsocket } from "@hocuspocus/provider";
@@ -4296,12 +4296,10 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
4296
4296
  return processedComments;
4297
4297
  };
4298
4298
  const convertHtmlToSchema = (commentHTML) => {
4299
- const div = document.createElement("div");
4300
- div.innerHTML = commentHTML;
4301
4299
  const editor = new Editor({
4302
4300
  mode: "text",
4303
4301
  isHeadless: true,
4304
- content: div,
4302
+ content: commentHTML,
4305
4303
  extensions: getRichTextExtensions()
4306
4304
  });
4307
4305
  return editor.getJSON().content[0];
@@ -17470,7 +17468,7 @@ const _sfc_main = {
17470
17468
  __name: "SuperDoc",
17471
17469
  emits: ["selection-update"],
17472
17470
  setup(__props, { emit: __emit }) {
17473
- const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-DGJe0yHt.es.js"));
17471
+ const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-BmTqUXHe.es.js"));
17474
17472
  const superdocStore = useSuperdocStore();
17475
17473
  const commentsStore = useCommentsStore();
17476
17474
  const {
@@ -18374,7 +18372,7 @@ class SuperDoc extends EventEmitter {
18374
18372
  this.config.colors = shuffleArray(this.config.colors);
18375
18373
  this.userColorMap = /* @__PURE__ */ new Map();
18376
18374
  this.colorIndex = 0;
18377
- this.version = "2.0.0-next.13";
18375
+ this.version = "2.0.0-next.15";
18378
18376
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
18379
18377
  this.superdocId = config.superdocId || v4();
18380
18378
  this.colors = this.config.colors;
@@ -38546,8 +38546,6 @@ const decode$7 = (params2) => {
38546
38546
  );
38547
38547
  const isInternal = parentComment?.isInternal || originalComment.isInternal;
38548
38548
  if (commentsExportType === "external" && isInternal) return;
38549
- const isResolved = !!originalComment.resolvedTime;
38550
- if (isResolved) return;
38551
38549
  if (node.type !== "commentRangeStart" && node.type !== "commentRangeEnd") {
38552
38550
  return;
38553
38551
  }
@@ -42469,7 +42467,7 @@ const _SuperConverter = class _SuperConverter2 {
42469
42467
  static getStoredSuperdocVersion(docx) {
42470
42468
  return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
42471
42469
  }
42472
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "2.0.0-next.13") {
42470
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "2.0.0-next.15") {
42473
42471
  return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
42474
42472
  }
42475
42473
  /**
@@ -57906,6 +57904,70 @@ const getCommentPositionsById = (commentId, doc2) => {
57906
57904
  });
57907
57905
  return positions;
57908
57906
  };
57907
+ const getCommentMarkSegmentsById = (commentId, doc2) => {
57908
+ const segments = [];
57909
+ doc2.descendants((node, pos) => {
57910
+ if (!node.isInline) return;
57911
+ const commentMark = node.marks?.find(
57912
+ (mark) => mark.type.name === CommentMarkName$1 && mark.attrs?.commentId === commentId
57913
+ );
57914
+ if (!commentMark) return;
57915
+ segments.push({
57916
+ from: pos,
57917
+ to: pos + node.nodeSize,
57918
+ attrs: commentMark.attrs || {}
57919
+ });
57920
+ });
57921
+ return segments;
57922
+ };
57923
+ const getCommentMarkRangesById = (commentId, doc2) => {
57924
+ const segments = getCommentMarkSegmentsById(commentId, doc2);
57925
+ if (!segments.length) return { segments, ranges: [] };
57926
+ const ranges = [];
57927
+ let active = null;
57928
+ segments.forEach((seg) => {
57929
+ if (!active) {
57930
+ active = {
57931
+ from: seg.from,
57932
+ to: seg.to,
57933
+ internal: !!seg.attrs?.internal
57934
+ };
57935
+ return;
57936
+ }
57937
+ if (seg.from <= active.to) {
57938
+ active.to = Math.max(active.to, seg.to);
57939
+ return;
57940
+ }
57941
+ ranges.push(active);
57942
+ active = {
57943
+ from: seg.from,
57944
+ to: seg.to,
57945
+ internal: !!seg.attrs?.internal
57946
+ };
57947
+ });
57948
+ if (active) ranges.push(active);
57949
+ return { segments, ranges };
57950
+ };
57951
+ const resolveCommentById = ({ commentId, state: state2, tr, dispatch }) => {
57952
+ const { schema } = state2;
57953
+ const markType = schema.marks?.[CommentMarkName$1];
57954
+ if (!markType) return false;
57955
+ const { segments, ranges } = getCommentMarkRangesById(commentId, state2.doc);
57956
+ if (!segments.length) return false;
57957
+ segments.forEach(({ from: from2, to, attrs }) => {
57958
+ tr.removeMark(from2, to, markType.create(attrs));
57959
+ });
57960
+ const startType = schema.nodes?.commentRangeStart;
57961
+ const endType = schema.nodes?.commentRangeEnd;
57962
+ if (startType && endType) {
57963
+ ranges.slice().sort((a, b2) => b2.from - a.from).forEach(({ from: from2, to, internal }) => {
57964
+ tr.insert(to, endType.create({ "w:id": commentId }));
57965
+ tr.insert(from2, startType.create({ "w:id": commentId, internal }));
57966
+ });
57967
+ }
57968
+ dispatch(tr);
57969
+ return true;
57970
+ };
57909
57971
  const prepareCommentsForExport = (doc2, tr, schema, comments = []) => {
57910
57972
  const commentMap = /* @__PURE__ */ new Map();
57911
57973
  comments.forEach((c2) => {
@@ -58012,6 +58074,7 @@ const getPreparedComment = (attrs) => {
58012
58074
  const prepareCommentsForImport = (doc2, tr, schema, converter) => {
58013
58075
  const toMark = [];
58014
58076
  const toDelete = [];
58077
+ const toUpdate = [];
58015
58078
  doc2.descendants((node, pos) => {
58016
58079
  const { type: type2 } = node;
58017
58080
  const commentNodes = ["commentRangeStart", "commentRangeEnd", "commentReference"];
@@ -58020,8 +58083,9 @@ const prepareCommentsForImport = (doc2, tr, schema, converter) => {
58020
58083
  converter,
58021
58084
  importedId: node.attrs["w:id"]
58022
58085
  });
58086
+ const isDone = !!matchingImportedComment?.isDone;
58023
58087
  if (type2.name === "commentRangeStart") {
58024
- if (!matchingImportedComment?.isDone) {
58088
+ if (!isDone) {
58025
58089
  toMark.push({
58026
58090
  commentId: resolvedCommentId,
58027
58091
  importedId,
@@ -58035,8 +58099,29 @@ const prepareCommentsForImport = (doc2, tr, schema, converter) => {
58035
58099
  commentId: resolvedCommentId,
58036
58100
  importedId
58037
58101
  });
58038
- toDelete.push({ start: pos, end: pos + 1 });
58102
+ if (isDone) {
58103
+ toUpdate.push({
58104
+ pos,
58105
+ attrs: {
58106
+ ...node.attrs,
58107
+ "w:id": resolvedCommentId,
58108
+ internal
58109
+ }
58110
+ });
58111
+ } else {
58112
+ toDelete.push({ start: pos, end: pos + 1 });
58113
+ }
58039
58114
  } else if (type2.name === "commentRangeEnd") {
58115
+ if (isDone) {
58116
+ toUpdate.push({
58117
+ pos,
58118
+ attrs: {
58119
+ ...node.attrs,
58120
+ "w:id": resolvedCommentId
58121
+ }
58122
+ });
58123
+ return;
58124
+ }
58040
58125
  const itemToMark = toMark.find((p) => p.importedId === importedId);
58041
58126
  if (!itemToMark) return;
58042
58127
  const { start: start2 } = itemToMark;
@@ -58051,6 +58136,11 @@ const prepareCommentsForImport = (doc2, tr, schema, converter) => {
58051
58136
  toDelete.push({ start: pos, end: pos + 1 });
58052
58137
  }
58053
58138
  });
58139
+ if (typeof tr.setNodeMarkup === "function") {
58140
+ toUpdate.sort((a, b2) => b2.pos - a.pos).forEach(({ pos, attrs }) => {
58141
+ tr.setNodeMarkup(pos, void 0, attrs);
58142
+ });
58143
+ }
58054
58144
  toDelete.sort((a, b2) => b2.start - a.start).forEach(({ start: start2, end: end2 }) => {
58055
58145
  tr.delete(start2, end2);
58056
58146
  });
@@ -58244,7 +58334,7 @@ const CommentsPlugin = Extension.create({
58244
58334
  },
58245
58335
  resolveComment: ({ commentId }) => ({ tr, dispatch, state: state2 }) => {
58246
58336
  tr.setMeta(CommentsPluginKey, { event: "update" });
58247
- removeCommentsById({ commentId, state: state2, tr, dispatch });
58337
+ return resolveCommentById({ commentId, state: state2, tr, dispatch });
58248
58338
  },
58249
58339
  setCursorById: (id) => ({ state: state2, editor }) => {
58250
58340
  const { from: from2 } = findRangeById(state2.doc, id) || {};
@@ -60550,7 +60640,7 @@ const isHeadless = (editor) => {
60550
60640
  const shouldSkipNodeView = (editor) => {
60551
60641
  return isHeadless(editor);
60552
60642
  };
60553
- const summaryVersion = "2.0.0-next.13";
60643
+ const summaryVersion = "2.0.0-next.15";
60554
60644
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
60555
60645
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
60556
60646
  function mapAttributes(attrs) {
@@ -61339,7 +61429,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
61339
61429
  { default: remarkStringify },
61340
61430
  { default: remarkGfm }
61341
61431
  ] = await Promise.all([
61342
- Promise.resolve().then(() => require("./index-Bh0gd0Pm-BGAaVc0H.cjs")),
61432
+ Promise.resolve().then(() => require("./index-DgGQUbNh-xpdP4M-B.cjs")),
61343
61433
  Promise.resolve().then(() => require("./index-DRCvimau-H4Ck3S9a.cjs")),
61344
61434
  Promise.resolve().then(() => require("./index-C_x_N6Uh-Db3CUJMX.cjs")),
61345
61435
  Promise.resolve().then(() => require("./index-D_sWOSiG-BtDZzJ6I.cjs")),
@@ -61544,7 +61634,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
61544
61634
  * Process collaboration migrations
61545
61635
  */
61546
61636
  processCollaborationMigrations() {
61547
- console.debug("[checkVersionMigrations] Current editor version", "2.0.0-next.13");
61637
+ console.debug("[checkVersionMigrations] Current editor version", "2.0.0-next.15");
61548
61638
  if (!this.options.ydoc) return;
61549
61639
  const metaMap = this.options.ydoc.getMap("meta");
61550
61640
  let docVersion = metaMap.get("version");
@@ -38529,8 +38529,6 @@ const decode$7 = (params2) => {
38529
38529
  );
38530
38530
  const isInternal = parentComment?.isInternal || originalComment.isInternal;
38531
38531
  if (commentsExportType === "external" && isInternal) return;
38532
- const isResolved = !!originalComment.resolvedTime;
38533
- if (isResolved) return;
38534
38532
  if (node.type !== "commentRangeStart" && node.type !== "commentRangeEnd") {
38535
38533
  return;
38536
38534
  }
@@ -42452,7 +42450,7 @@ const _SuperConverter = class _SuperConverter2 {
42452
42450
  static getStoredSuperdocVersion(docx) {
42453
42451
  return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
42454
42452
  }
42455
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "2.0.0-next.13") {
42453
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "2.0.0-next.15") {
42456
42454
  return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
42457
42455
  }
42458
42456
  /**
@@ -57889,6 +57887,70 @@ const getCommentPositionsById = (commentId, doc2) => {
57889
57887
  });
57890
57888
  return positions;
57891
57889
  };
57890
+ const getCommentMarkSegmentsById = (commentId, doc2) => {
57891
+ const segments = [];
57892
+ doc2.descendants((node, pos) => {
57893
+ if (!node.isInline) return;
57894
+ const commentMark = node.marks?.find(
57895
+ (mark) => mark.type.name === CommentMarkName$1 && mark.attrs?.commentId === commentId
57896
+ );
57897
+ if (!commentMark) return;
57898
+ segments.push({
57899
+ from: pos,
57900
+ to: pos + node.nodeSize,
57901
+ attrs: commentMark.attrs || {}
57902
+ });
57903
+ });
57904
+ return segments;
57905
+ };
57906
+ const getCommentMarkRangesById = (commentId, doc2) => {
57907
+ const segments = getCommentMarkSegmentsById(commentId, doc2);
57908
+ if (!segments.length) return { segments, ranges: [] };
57909
+ const ranges = [];
57910
+ let active = null;
57911
+ segments.forEach((seg) => {
57912
+ if (!active) {
57913
+ active = {
57914
+ from: seg.from,
57915
+ to: seg.to,
57916
+ internal: !!seg.attrs?.internal
57917
+ };
57918
+ return;
57919
+ }
57920
+ if (seg.from <= active.to) {
57921
+ active.to = Math.max(active.to, seg.to);
57922
+ return;
57923
+ }
57924
+ ranges.push(active);
57925
+ active = {
57926
+ from: seg.from,
57927
+ to: seg.to,
57928
+ internal: !!seg.attrs?.internal
57929
+ };
57930
+ });
57931
+ if (active) ranges.push(active);
57932
+ return { segments, ranges };
57933
+ };
57934
+ const resolveCommentById = ({ commentId, state: state2, tr, dispatch }) => {
57935
+ const { schema } = state2;
57936
+ const markType = schema.marks?.[CommentMarkName$1];
57937
+ if (!markType) return false;
57938
+ const { segments, ranges } = getCommentMarkRangesById(commentId, state2.doc);
57939
+ if (!segments.length) return false;
57940
+ segments.forEach(({ from: from2, to, attrs }) => {
57941
+ tr.removeMark(from2, to, markType.create(attrs));
57942
+ });
57943
+ const startType = schema.nodes?.commentRangeStart;
57944
+ const endType = schema.nodes?.commentRangeEnd;
57945
+ if (startType && endType) {
57946
+ ranges.slice().sort((a, b2) => b2.from - a.from).forEach(({ from: from2, to, internal }) => {
57947
+ tr.insert(to, endType.create({ "w:id": commentId }));
57948
+ tr.insert(from2, startType.create({ "w:id": commentId, internal }));
57949
+ });
57950
+ }
57951
+ dispatch(tr);
57952
+ return true;
57953
+ };
57892
57954
  const prepareCommentsForExport = (doc2, tr, schema, comments = []) => {
57893
57955
  const commentMap = /* @__PURE__ */ new Map();
57894
57956
  comments.forEach((c2) => {
@@ -57995,6 +58057,7 @@ const getPreparedComment = (attrs) => {
57995
58057
  const prepareCommentsForImport = (doc2, tr, schema, converter) => {
57996
58058
  const toMark = [];
57997
58059
  const toDelete = [];
58060
+ const toUpdate = [];
57998
58061
  doc2.descendants((node, pos) => {
57999
58062
  const { type: type2 } = node;
58000
58063
  const commentNodes = ["commentRangeStart", "commentRangeEnd", "commentReference"];
@@ -58003,8 +58066,9 @@ const prepareCommentsForImport = (doc2, tr, schema, converter) => {
58003
58066
  converter,
58004
58067
  importedId: node.attrs["w:id"]
58005
58068
  });
58069
+ const isDone = !!matchingImportedComment?.isDone;
58006
58070
  if (type2.name === "commentRangeStart") {
58007
- if (!matchingImportedComment?.isDone) {
58071
+ if (!isDone) {
58008
58072
  toMark.push({
58009
58073
  commentId: resolvedCommentId,
58010
58074
  importedId,
@@ -58018,8 +58082,29 @@ const prepareCommentsForImport = (doc2, tr, schema, converter) => {
58018
58082
  commentId: resolvedCommentId,
58019
58083
  importedId
58020
58084
  });
58021
- toDelete.push({ start: pos, end: pos + 1 });
58085
+ if (isDone) {
58086
+ toUpdate.push({
58087
+ pos,
58088
+ attrs: {
58089
+ ...node.attrs,
58090
+ "w:id": resolvedCommentId,
58091
+ internal
58092
+ }
58093
+ });
58094
+ } else {
58095
+ toDelete.push({ start: pos, end: pos + 1 });
58096
+ }
58022
58097
  } else if (type2.name === "commentRangeEnd") {
58098
+ if (isDone) {
58099
+ toUpdate.push({
58100
+ pos,
58101
+ attrs: {
58102
+ ...node.attrs,
58103
+ "w:id": resolvedCommentId
58104
+ }
58105
+ });
58106
+ return;
58107
+ }
58023
58108
  const itemToMark = toMark.find((p) => p.importedId === importedId);
58024
58109
  if (!itemToMark) return;
58025
58110
  const { start: start2 } = itemToMark;
@@ -58034,6 +58119,11 @@ const prepareCommentsForImport = (doc2, tr, schema, converter) => {
58034
58119
  toDelete.push({ start: pos, end: pos + 1 });
58035
58120
  }
58036
58121
  });
58122
+ if (typeof tr.setNodeMarkup === "function") {
58123
+ toUpdate.sort((a, b2) => b2.pos - a.pos).forEach(({ pos, attrs }) => {
58124
+ tr.setNodeMarkup(pos, void 0, attrs);
58125
+ });
58126
+ }
58037
58127
  toDelete.sort((a, b2) => b2.start - a.start).forEach(({ start: start2, end: end2 }) => {
58038
58128
  tr.delete(start2, end2);
58039
58129
  });
@@ -58227,7 +58317,7 @@ const CommentsPlugin = Extension.create({
58227
58317
  },
58228
58318
  resolveComment: ({ commentId }) => ({ tr, dispatch, state: state2 }) => {
58229
58319
  tr.setMeta(CommentsPluginKey, { event: "update" });
58230
- removeCommentsById({ commentId, state: state2, tr, dispatch });
58320
+ return resolveCommentById({ commentId, state: state2, tr, dispatch });
58231
58321
  },
58232
58322
  setCursorById: (id) => ({ state: state2, editor }) => {
58233
58323
  const { from: from2 } = findRangeById(state2.doc, id) || {};
@@ -60533,7 +60623,7 @@ const isHeadless = (editor) => {
60533
60623
  const shouldSkipNodeView = (editor) => {
60534
60624
  return isHeadless(editor);
60535
60625
  };
60536
- const summaryVersion = "2.0.0-next.13";
60626
+ const summaryVersion = "2.0.0-next.15";
60537
60627
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
60538
60628
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
60539
60629
  function mapAttributes(attrs) {
@@ -61322,7 +61412,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
61322
61412
  { default: remarkStringify },
61323
61413
  { default: remarkGfm }
61324
61414
  ] = await Promise.all([
61325
- import("./index-Bh0gd0Pm-DMBx9Ybz.es.js"),
61415
+ import("./index-DgGQUbNh-_ef55vRc.es.js"),
61326
61416
  import("./index-DRCvimau-Cw339678.es.js"),
61327
61417
  import("./index-C_x_N6Uh-DJn8hIEt.es.js"),
61328
61418
  import("./index-D_sWOSiG-DE96TaT5.es.js"),
@@ -61527,7 +61617,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
61527
61617
  * Process collaboration migrations
61528
61618
  */
61529
61619
  processCollaborationMigrations() {
61530
- console.debug("[checkVersionMigrations] Current editor version", "2.0.0-next.13");
61620
+ console.debug("[checkVersionMigrations] Current editor version", "2.0.0-next.15");
61531
61621
  if (!this.options.ydoc) return;
61532
61622
  const metaMap = this.options.ydoc.getMap("meta");
61533
61623
  let docVersion = metaMap.get("version");
@@ -1 +1 @@
1
- {"version":3,"file":"comments-store.d.ts","sourceRoot":"","sources":["../../../../../src/stores/comments-store.js"],"names":[],"mappings":"AAeA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBA2Ca,MAAM,KACJ,IAAI;qBAiBN,MAAM,KACJ,MAAM;0CAUR,MAAM,GAAG,SAAS,GAAG,IAAI,KACvB,IAAI;;;;;;gFA8Ld;QAAuB,SAAS,EAAxB,MAAM;QACS,UAAU;QACV,eAAe;KACtC,KAAU,MAAM;;0DAqDhB;QAAuB,QAAQ,EAAvB,MAAM;KACd,KAAU,IAAI;sCAyEJ,IAAI;;;;;6CAzFJ,IAAI;4EAsGd;QAAsB,QAAQ;QACP,UAAU;KACjC,KAAU,IAAI;;+DA4HJ,IAAI;sDAnbd;QAAuB,QAAQ,EAAvB,MAAM;QACS,MAAM,EAArB,MAAM;KACd,KAAU,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBAxDN,MAAM,KACJ,IAAI;qBAiBN,MAAM,KACJ,MAAM;0CAUR,MAAM,GAAG,SAAS,GAAG,IAAI,KACvB,IAAI;;;;;;gFA8Ld;QAAuB,SAAS,EAAxB,MAAM;QACS,UAAU;QACV,eAAe;KACtC,KAAU,MAAM;;0DAqDhB;QAAuB,QAAQ,EAAvB,MAAM;KACd,KAAU,IAAI;sCAyEJ,IAAI;;;;;6CAzFJ,IAAI;4EAsGd;QAAsB,QAAQ;QACP,UAAU;KACjC,KAAU,IAAI;;+DA4HJ,IAAI;sDAnbd;QAAuB,QAAQ,EAAvB,MAAM;QACS,MAAM,EAArB,MAAM;KACd,KAAU,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBAxDN,MAAM,KACJ,IAAI;qBAiBN,MAAM,KACJ,MAAM;0CAUR,MAAM,GAAG,SAAS,GAAG,IAAI,KACvB,IAAI;;;;;;gFA8Ld;QAAuB,SAAS,EAAxB,MAAM;QACS,UAAU;QACV,eAAe;KACtC,KAAU,MAAM;;0DAqDhB;QAAuB,QAAQ,EAAvB,MAAM;KACd,KAAU,IAAI;sCAyEJ,IAAI;;;;;6CAzFJ,IAAI;4EAsGd;QAAsB,QAAQ;QACP,UAAU;KACjC,KAAU,IAAI;;+DA4HJ,IAAI;sDAnbd;QAAuB,QAAQ,EAAvB,MAAM;QACS,MAAM,EAArB,MAAM;KACd,KAAU,IAAI;wUA2jBhB"}
1
+ {"version":3,"file":"comments-store.d.ts","sourceRoot":"","sources":["../../../../../src/stores/comments-store.js"],"names":[],"mappings":"AAeA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBA2Ca,MAAM,KACJ,IAAI;qBAiBN,MAAM,KACJ,MAAM;0CAUR,MAAM,GAAG,SAAS,GAAG,IAAI,KACvB,IAAI;;;;;;gFA8Ld;QAAuB,SAAS,EAAxB,MAAM;QACS,UAAU;QACV,eAAe;KACtC,KAAU,MAAM;;0DAqDhB;QAAuB,QAAQ,EAAvB,MAAM;KACd,KAAU,IAAI;sCAyEJ,IAAI;;;;;6CAzFJ,IAAI;4EAsGd;QAAsB,QAAQ;QACP,UAAU;KACjC,KAAU,IAAI;;+DA0HJ,IAAI;sDAjbd;QAAuB,QAAQ,EAAvB,MAAM;QACS,MAAM,EAArB,MAAM;KACd,KAAU,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBAxDN,MAAM,KACJ,IAAI;qBAiBN,MAAM,KACJ,MAAM;0CAUR,MAAM,GAAG,SAAS,GAAG,IAAI,KACvB,IAAI;;;;;;gFA8Ld;QAAuB,SAAS,EAAxB,MAAM;QACS,UAAU;QACV,eAAe;KACtC,KAAU,MAAM;;0DAqDhB;QAAuB,QAAQ,EAAvB,MAAM;KACd,KAAU,IAAI;sCAyEJ,IAAI;;;;;6CAzFJ,IAAI;4EAsGd;QAAsB,QAAQ;QACP,UAAU;KACjC,KAAU,IAAI;;+DA0HJ,IAAI;sDAjbd;QAAuB,QAAQ,EAAvB,MAAM;QACS,MAAM,EAArB,MAAM;KACd,KAAU,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBAxDN,MAAM,KACJ,IAAI;qBAiBN,MAAM,KACJ,MAAM;0CAUR,MAAM,GAAG,SAAS,GAAG,IAAI,KACvB,IAAI;;;;;;gFA8Ld;QAAuB,SAAS,EAAxB,MAAM;QACS,UAAU;QACV,eAAe;KACtC,KAAU,MAAM;;0DAqDhB;QAAuB,QAAQ,EAAvB,MAAM;KACd,KAAU,IAAI;sCAyEJ,IAAI;;;;;6CAzFJ,IAAI;4EAsGd;QAAsB,QAAQ;QACP,UAAU;KACjC,KAAU,IAAI;;+DA0HJ,IAAI;sDAjbd;QAAuB,QAAQ,EAAvB,MAAM;QACS,MAAM,EAArB,MAAM;KACd,KAAU,IAAI;wUAyjBhB"}
@@ -1,6 +1,6 @@
1
1
  import { ref, onMounted, onUnmounted, computed, createElementBlock, openBlock, withModifiers, createElementVNode, withDirectives, unref, vModelText, createCommentVNode, nextTick } from "vue";
2
- import { T as TextSelection } from "./chunks/converter-Dx9n2qwO.js";
3
- import { _ as _export_sfc } from "./chunks/editor-C8TLVw8v.js";
2
+ import { T as TextSelection } from "./chunks/converter-BvxISp2B.js";
3
+ import { _ as _export_sfc } from "./chunks/editor-Bgi8FGSM.js";
4
4
  const DEFAULT_API_ENDPOINT = "https://sd-dev-express-gateway-i6xtm.ondigitalocean.app/insights";
5
5
  const SYSTEM_PROMPT = "You are an expert copywriter and you are immersed in a document editor. You are to provide document related text responses based on the user prompts. Only write what is asked for. Do not provide explanations. Try to keep placeholders as short as possible. Do not output your prompt. Your instructions are: ";
6
6
  async function baseInsightsFetch(payload, options = {}) {
@@ -38535,8 +38535,6 @@ const decode$7 = (params) => {
38535
38535
  );
38536
38536
  const isInternal = parentComment?.isInternal || originalComment.isInternal;
38537
38537
  if (commentsExportType === "external" && isInternal) return;
38538
- const isResolved = !!originalComment.resolvedTime;
38539
- if (isResolved) return;
38540
38538
  if (node.type !== "commentRangeStart" && node.type !== "commentRangeEnd") {
38541
38539
  return;
38542
38540
  }
@@ -42769,7 +42767,7 @@ const _SuperConverter = class _SuperConverter {
42769
42767
  static getStoredSuperdocVersion(docx) {
42770
42768
  return _SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
42771
42769
  }
42772
- static setStoredSuperdocVersion(docx = this.convertedXml, version = "2.0.0-next.13") {
42770
+ static setStoredSuperdocVersion(docx = this.convertedXml, version = "2.0.0-next.15") {
42773
42771
  return _SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version, false);
42774
42772
  }
42775
42773
  /**
@@ -1,4 +1,4 @@
1
- import { p as process$1, aJ as commonjsGlobal, B as Buffer, aK as getDefaultExportFromCjs, aL as getContentTypesFromXml, aM as xmljs } from "./converter-Dx9n2qwO.js";
1
+ import { p as process$1, aJ as commonjsGlobal, B as Buffer, aK as getDefaultExportFromCjs, aL as getContentTypesFromXml, aM as xmljs } from "./converter-BvxISp2B.js";
2
2
  function commonjsRequire(path) {
3
3
  throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
4
4
  }