@harbour-enterprises/superdoc 1.0.0-next.4 → 1.0.0-next.6

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 (57) hide show
  1. package/dist/chunks/{PdfViewer-DtdN17V4.es.js → PdfViewer-BYeEi4Kx.es.js} +1 -1
  2. package/dist/chunks/{PdfViewer-CtSTAdvv.cjs → PdfViewer-CF4W_li8.cjs} +1 -1
  3. package/dist/chunks/{index-Bj1kFbYe.cjs → index-BcHbK1Ip.cjs} +99 -97
  4. package/dist/chunks/{index-D_KE9gpD-radGpP4I.cjs → index-CKb2zoi7-BEMsbmpK.cjs} +1 -1
  5. package/dist/chunks/{index-D_KE9gpD-aIqhxcuF.es.js → index-CKb2zoi7-aboErZCf.es.js} +1 -1
  6. package/dist/chunks/{index-Cxv7dMYN.es.js → index-CocFivpQ.es.js} +99 -97
  7. package/dist/chunks/{super-editor.es-B2fSLkzN.es.js → super-editor.es-C7JZxENm.es.js} +4 -4
  8. package/dist/chunks/{super-editor.es-BhQu31e4.cjs → super-editor.es-TXxmZOAu.cjs} +4 -4
  9. package/dist/packages/superdoc/src/core/collaboration/collaboration-comments.d.ts +3 -3
  10. package/dist/packages/superdoc/src/core/collaboration/collaboration-comments.d.ts.map +1 -1
  11. package/dist/packages/superdoc/src/core/collaboration/helpers.d.ts.map +1 -1
  12. package/dist/style.css +6 -6
  13. package/dist/super-editor/ai-writer.es.js +2 -2
  14. package/dist/super-editor/chunks/{converter-CVqUjX24.js → converter-CyZvCMe8.js} +1 -1
  15. package/dist/super-editor/chunks/{docx-zipper-CsWjoVKD.js → docx-zipper-DPV5rnMJ.js} +1 -1
  16. package/dist/super-editor/chunks/{editor-Cc8nus2C.js → editor-uiCiCr8n.js} +5 -5
  17. package/dist/super-editor/chunks/{index-D_KE9gpD.js → index-CKb2zoi7.js} +1 -1
  18. package/dist/super-editor/chunks/{toolbar-CoOpR1xE.js → toolbar-Icc3CdW0.js} +2 -2
  19. package/dist/super-editor/converter.es.js +1 -1
  20. package/dist/super-editor/docx-zipper.es.js +2 -2
  21. package/dist/super-editor/editor.es.js +3 -3
  22. package/dist/super-editor/file-zipper.es.js +1 -1
  23. package/dist/super-editor/super-editor.es.js +6 -6
  24. package/dist/super-editor/toolbar.es.js +2 -2
  25. package/dist/super-editor.cjs +1 -1
  26. package/dist/super-editor.es.js +1 -1
  27. package/dist/superdoc.cjs +2 -2
  28. package/dist/superdoc.es.js +2 -2
  29. package/dist/superdoc.umd.js +103 -101
  30. package/dist/superdoc.umd.js.map +1 -1
  31. package/package.json +1 -1
  32. package/dist/images/altText_add.svg +0 -3
  33. package/dist/images/altText_disclaimer.svg +0 -3
  34. package/dist/images/altText_done.svg +0 -3
  35. package/dist/images/altText_spinner.svg +0 -30
  36. package/dist/images/altText_warning.svg +0 -3
  37. package/dist/images/annotation-check.svg +0 -11
  38. package/dist/images/annotation-comment.svg +0 -16
  39. package/dist/images/annotation-help.svg +0 -26
  40. package/dist/images/annotation-insert.svg +0 -10
  41. package/dist/images/annotation-key.svg +0 -11
  42. package/dist/images/annotation-newparagraph.svg +0 -11
  43. package/dist/images/annotation-noicon.svg +0 -7
  44. package/dist/images/annotation-note.svg +0 -42
  45. package/dist/images/annotation-paperclip.svg +0 -6
  46. package/dist/images/annotation-paragraph.svg +0 -16
  47. package/dist/images/annotation-pushpin.svg +0 -7
  48. package/dist/images/cursor-editorFreeHighlight.svg +0 -6
  49. package/dist/images/cursor-editorFreeText.svg +0 -3
  50. package/dist/images/cursor-editorInk.svg +0 -4
  51. package/dist/images/cursor-editorTextHighlight.svg +0 -8
  52. package/dist/images/editor-toolbar-delete.svg +0 -5
  53. package/dist/images/loading-icon.gif +0 -0
  54. package/dist/images/messageBar_closingButton.svg +0 -3
  55. package/dist/images/messageBar_warning.svg +0 -3
  56. package/dist/images/toolbarButton-editorHighlight.svg +0 -6
  57. package/dist/images/toolbarButton-menuArrow.svg +0 -3
@@ -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-B2fSLkzN.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-C7JZxENm.es.js";
2
2
  import { B as BlankDOCX } from "./blank-docx-ABm6XYAA.es.js";
3
3
  import { E as EventEmitter } from "./eventemitter3-44XulWQe.es.js";
4
4
  import { HocuspocusProvider, HocuspocusProviderWebsocket } from "@hocuspocus/provider";
@@ -3310,17 +3310,17 @@ function setupAwarenessHandler(provider, superdocInstance, user) {
3310
3310
  });
3311
3311
  });
3312
3312
  }
3313
- const addYComment = (yArray, ydoc, event) => {
3313
+ const addYComment = (yArray, ydoc, event, user) => {
3314
3314
  const { comment } = event;
3315
3315
  const yComment = new Map$2(Object.entries(comment));
3316
3316
  ydoc.transact(
3317
3317
  () => {
3318
3318
  yArray.push([yComment]);
3319
3319
  },
3320
- { user: superdoc.user }
3320
+ { user }
3321
3321
  );
3322
3322
  };
3323
- const updateYComment = (yArray, ydoc, event) => {
3323
+ const updateYComment = (yArray, ydoc, event, user) => {
3324
3324
  const { comment } = event;
3325
3325
  const yComment = new Map$2(Object.entries(comment));
3326
3326
  const commentIndex = getCommentIndex(yArray, comment);
@@ -3330,10 +3330,10 @@ const updateYComment = (yArray, ydoc, event) => {
3330
3330
  yArray.delete(commentIndex, 1);
3331
3331
  yArray.insert(commentIndex, [yComment]);
3332
3332
  },
3333
- { user: superdoc.user }
3333
+ { user }
3334
3334
  );
3335
3335
  };
3336
- const deleteYComment = (yArray, ydoc, event) => {
3336
+ const deleteYComment = (yArray, ydoc, event, user) => {
3337
3337
  const { comment } = event;
3338
3338
  const commentIndex = getCommentIndex(yArray, comment);
3339
3339
  if (commentIndex === -1) return;
@@ -3341,26 +3341,26 @@ const deleteYComment = (yArray, ydoc, event) => {
3341
3341
  () => {
3342
3342
  yArray.delete(commentIndex, 1);
3343
3343
  },
3344
- { user: superdoc.user }
3344
+ { user }
3345
3345
  );
3346
3346
  };
3347
3347
  const getCommentIndex = (yArray, comment) => {
3348
3348
  const baseArray = yArray.toJSON();
3349
3349
  return baseArray.findIndex((c2) => c2.commentId === comment.commentId);
3350
3350
  };
3351
- const initCollaborationComments = (superdoc2) => {
3352
- if (!superdoc2.config.modules.comments || !superdoc2.provider) return;
3351
+ const initCollaborationComments = (superdoc) => {
3352
+ if (!superdoc.config.modules.comments || !superdoc.provider) return;
3353
3353
  const onSuperDocYdocSynced = () => {
3354
- const parent = superdoc2.commentsStore.commentsParentElement;
3355
- const ids = superdoc2.commentsStore.editorCommentIds;
3356
- superdoc2.commentsStore.handleEditorLocationsUpdate(parent, ids);
3357
- superdoc2.commentsStore.hasSyncedCollaborationComments = true;
3358
- superdoc2.provider.off("synced", onSuperDocYdocSynced);
3354
+ const parent = superdoc.commentsStore.commentsParentElement;
3355
+ const ids = superdoc.commentsStore.editorCommentIds;
3356
+ superdoc.commentsStore.handleEditorLocationsUpdate(parent, ids);
3357
+ superdoc.commentsStore.hasSyncedCollaborationComments = true;
3358
+ superdoc.provider.off("synced", onSuperDocYdocSynced);
3359
3359
  };
3360
- superdoc2.provider.on("synced", onSuperDocYdocSynced);
3361
- const commentsArray = superdoc2.ydoc.getArray("comments");
3360
+ superdoc.provider.on("synced", onSuperDocYdocSynced);
3361
+ const commentsArray = superdoc.ydoc.getArray("comments");
3362
3362
  commentsArray.observe((event) => {
3363
- const currentUser = superdoc2.config.user;
3363
+ const currentUser = superdoc.config.user;
3364
3364
  const { user = {} } = event.transaction.origin;
3365
3365
  if (currentUser.name === user.name && currentUser.email === user.email) return;
3366
3366
  const comments = commentsArray.toJSON();
@@ -3372,59 +3372,60 @@ const initCollaborationComments = (superdoc2) => {
3372
3372
  filtered.push(c2);
3373
3373
  }
3374
3374
  });
3375
- superdoc2.commentsStore.commentsList = filtered.map((c2) => useComment(c2));
3375
+ superdoc.commentsStore.commentsList = filtered.map((c2) => useComment(c2));
3376
3376
  });
3377
3377
  };
3378
- const initSuperdocYdoc = (superdoc2) => {
3379
- const { isInternal } = superdoc2.config;
3380
- const baseName = `${superdoc2.config.superdocId}-superdoc`;
3381
- if (!superdoc2.config.superdocId) return;
3378
+ const initSuperdocYdoc = (superdoc) => {
3379
+ const { isInternal } = superdoc.config;
3380
+ const baseName = `${superdoc.config.superdocId}-superdoc`;
3381
+ if (!superdoc.config.superdocId) return;
3382
3382
  const documentId = isInternal ? baseName : `${baseName}-external`;
3383
3383
  const superdocCollaborationOptions = {
3384
- config: superdoc2.config.modules.collaboration,
3385
- user: superdoc2.config.user,
3384
+ config: superdoc.config.modules.collaboration,
3385
+ user: superdoc.config.user,
3386
3386
  documentId,
3387
- socket: superdoc2.config.socket,
3388
- superdocInstance: superdoc2
3387
+ socket: superdoc.config.socket,
3388
+ superdocInstance: superdoc
3389
3389
  };
3390
3390
  const { provider: superdocProvider, ydoc: superdocYdoc } = createProvider(superdocCollaborationOptions);
3391
3391
  return { ydoc: superdocYdoc, provider: superdocProvider };
3392
3392
  };
3393
- const makeDocumentsCollaborative = (superdoc2) => {
3393
+ const makeDocumentsCollaborative = (superdoc) => {
3394
3394
  const processedDocuments = [];
3395
- superdoc2.config.documents.forEach((doc) => {
3396
- superdoc2.config.user.color = superdoc2.colors[0];
3395
+ superdoc.config.documents.forEach((doc) => {
3396
+ superdoc.config.user.color = superdoc.colors[0];
3397
3397
  const options = {
3398
- config: superdoc2.config.modules.collaboration,
3399
- user: superdoc2.config.user,
3398
+ config: superdoc.config.modules.collaboration,
3399
+ user: superdoc.config.user,
3400
3400
  documentId: doc.id,
3401
- socket: superdoc2.config.socket,
3402
- superdocInstance: superdoc2
3401
+ socket: superdoc.config.socket,
3402
+ superdocInstance: superdoc
3403
3403
  };
3404
3404
  const { provider, ydoc } = createProvider(options);
3405
3405
  doc.provider = provider;
3406
- doc.socket = superdoc2.config.socket;
3406
+ doc.socket = superdoc.config.socket;
3407
3407
  doc.ydoc = ydoc;
3408
- doc.role = superdoc2.config.role;
3408
+ doc.role = superdoc.config.role;
3409
3409
  processedDocuments.push(doc);
3410
3410
  });
3411
3411
  return processedDocuments;
3412
3412
  };
3413
- const syncCommentsToClients = (superdoc2, event) => {
3414
- if (!superdoc2.isCollaborative || !superdoc2.config.modules.comments) return;
3415
- const yArray = superdoc2.ydoc.getArray("comments");
3413
+ const syncCommentsToClients = (superdoc, event) => {
3414
+ if (!superdoc.isCollaborative || !superdoc.config.modules.comments) return;
3415
+ const yArray = superdoc.ydoc.getArray("comments");
3416
+ const user = superdoc.config.user;
3416
3417
  switch (event.type) {
3417
3418
  case "add":
3418
- addYComment(yArray, superdoc2.ydoc, event);
3419
+ addYComment(yArray, superdoc.ydoc, event, user);
3419
3420
  break;
3420
3421
  case "update":
3421
- updateYComment(yArray, superdoc2.ydoc, event);
3422
+ updateYComment(yArray, superdoc.ydoc, event, user);
3422
3423
  break;
3423
3424
  case "resolved":
3424
- updateYComment(yArray, superdoc2.ydoc, event);
3425
+ updateYComment(yArray, superdoc.ydoc, event, user);
3425
3426
  break;
3426
3427
  case "deleted":
3427
- deleteYComment(yArray, superdoc2.ydoc, event);
3428
+ deleteYComment(yArray, superdoc.ydoc, event, user);
3428
3429
  break;
3429
3430
  }
3430
3431
  };
@@ -3499,22 +3500,22 @@ function useComment(params2) {
3499
3500
  const resolvedTime = ref(params2.resolvedTime || null);
3500
3501
  const resolvedByEmail = ref(params2.resolvedByEmail || null);
3501
3502
  const resolvedByName = ref(params2.resolvedByName || null);
3502
- const resolveComment = ({ email, name, superdoc: superdoc2 }) => {
3503
+ const resolveComment = ({ email, name, superdoc }) => {
3503
3504
  if (resolvedTime.value) return;
3504
3505
  resolvedTime.value = Date.now();
3505
3506
  resolvedByEmail.value = email;
3506
3507
  resolvedByName.value = name;
3507
3508
  if (trackedChange.value) {
3508
3509
  const emitData2 = { type: comments_module_events.RESOLVED, comment: getValues() };
3509
- propagateUpdate(superdoc2, emitData2);
3510
- superdoc2.activeEditor?.commands?.resolveComment({ commentId, importedId });
3510
+ propagateUpdate(superdoc, emitData2);
3511
+ superdoc.activeEditor?.commands?.resolveComment({ commentId, importedId });
3511
3512
  return;
3512
3513
  }
3513
3514
  const emitData = { type: comments_module_events.RESOLVED, comment: getValues() };
3514
- propagateUpdate(superdoc2, emitData);
3515
- superdoc2.activeEditor?.commands?.resolveComment({ commentId, importedId });
3515
+ propagateUpdate(superdoc, emitData);
3516
+ superdoc.activeEditor?.commands?.resolveComment({ commentId, importedId });
3516
3517
  };
3517
- const setIsInternal = ({ isInternal: newIsInternal, superdoc: superdoc2 }) => {
3518
+ const setIsInternal = ({ isInternal: newIsInternal, superdoc }) => {
3518
3519
  const previousValue = isInternal.value;
3519
3520
  if (previousValue === newIsInternal) return;
3520
3521
  isInternal.value = newIsInternal;
@@ -3523,16 +3524,16 @@ function useComment(params2) {
3523
3524
  changes: [{ key: "isInternal", value: newIsInternal, previousValue }],
3524
3525
  comment: getValues()
3525
3526
  };
3526
- propagateUpdate(superdoc2, emitData);
3527
- const activeEditor = superdoc2.activeEditor;
3527
+ propagateUpdate(superdoc, emitData);
3528
+ const activeEditor = superdoc.activeEditor;
3528
3529
  if (!activeEditor) return;
3529
3530
  activeEditor.commands.setCommentInternal({ commentId, importedId, isInternal: newIsInternal });
3530
3531
  };
3531
- const setActive = (superdoc2) => {
3532
- const { activeEditor } = superdoc2;
3532
+ const setActive = (superdoc) => {
3533
+ const { activeEditor } = superdoc;
3533
3534
  activeEditor?.commands.setActiveComment({ commentId, importedId });
3534
3535
  };
3535
- const setText = ({ text, superdoc: superdoc2, suppressUpdate }) => {
3536
+ const setText = ({ text, superdoc, suppressUpdate }) => {
3536
3537
  commentText.value = text;
3537
3538
  mentions.value = extractMentions(text);
3538
3539
  if (suppressUpdate) return;
@@ -3541,7 +3542,7 @@ function useComment(params2) {
3541
3542
  changes: [{ key: "text", value: text }],
3542
3543
  comment: getValues()
3543
3544
  };
3544
- propagateUpdate(superdoc2, emitData);
3545
+ propagateUpdate(superdoc, emitData);
3545
3546
  };
3546
3547
  const extractMentions = (htmlString) => {
3547
3548
  const parser = new DOMParser();
@@ -3578,9 +3579,9 @@ function useComment(params2) {
3578
3579
  const user = importedAuthor.value ? { name: importedAuthor.value.name || "(Imported)", email: importedAuthor.value.email } : { name: creatorName, email: creatorEmail, image: creatorImage };
3579
3580
  return user;
3580
3581
  };
3581
- const propagateUpdate = (superdoc2, event) => {
3582
- superdoc2.emit("comments-update", event);
3583
- syncCommentsToClients(superdoc2, event);
3582
+ const propagateUpdate = (superdoc, event) => {
3583
+ superdoc.emit("comments-update", event);
3584
+ syncCommentsToClients(superdoc, event);
3584
3585
  };
3585
3586
  const getValues = () => {
3586
3587
  return {
@@ -4005,21 +4006,21 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
4005
4006
  if (id === void 0 || id === null) return null;
4006
4007
  return commentsList.value.find((c2) => c2.commentId == id || c2.importedId == id);
4007
4008
  };
4008
- const setActiveComment = (superdoc2, id) => {
4009
+ const setActiveComment = (superdoc, id) => {
4009
4010
  if (id === void 0 || id === null) {
4010
4011
  activeComment.value = null;
4011
- if (superdoc2.activeEditor) {
4012
- superdoc2.activeEditor.commands?.setActiveComment({ commentId: null });
4012
+ if (superdoc.activeEditor) {
4013
+ superdoc.activeEditor.commands?.setActiveComment({ commentId: null });
4013
4014
  }
4014
4015
  return;
4015
4016
  }
4016
4017
  const comment = getComment(id);
4017
4018
  if (comment) activeComment.value = comment.commentId;
4018
- if (superdoc2.activeEditor) {
4019
- superdoc2.activeEditor.commands?.setActiveComment({ commentId: activeComment.value });
4019
+ if (superdoc.activeEditor) {
4020
+ superdoc.activeEditor.commands?.setActiveComment({ commentId: activeComment.value });
4020
4021
  }
4021
4022
  };
4022
- const handleTrackedChangeUpdate = ({ superdoc: superdoc2, params: params2 }) => {
4023
+ const handleTrackedChangeUpdate = ({ superdoc, params: params2 }) => {
4023
4024
  const {
4024
4025
  event,
4025
4026
  changeId,
@@ -4052,7 +4053,7 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
4052
4053
  }
4053
4054
  });
4054
4055
  if (event === "add") {
4055
- addComment({ superdoc: superdoc2, comment });
4056
+ addComment({ superdoc, comment });
4056
4057
  } else if (event === "update") {
4057
4058
  const existingTrackedChange = commentsList.value.find((comment2) => comment2.commentId === changeId);
4058
4059
  if (!existingTrackedChange) return;
@@ -4064,33 +4065,33 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
4064
4065
  type: COMMENT_EVENTS.UPDATE,
4065
4066
  comment: existingTrackedChange.getValues()
4066
4067
  };
4067
- syncCommentsToClients(superdoc2, emitData);
4068
- debounceEmit(changeId, emitData, superdoc2);
4068
+ syncCommentsToClients(superdoc, emitData);
4069
+ debounceEmit(changeId, emitData, superdoc);
4069
4070
  }
4070
4071
  };
4071
- const debounceEmit = (commentId, event, superdoc2, delay = 1e3) => {
4072
+ const debounceEmit = (commentId, event, superdoc, delay = 1e3) => {
4072
4073
  if (debounceTimers[commentId]) {
4073
4074
  clearTimeout(debounceTimers[commentId]);
4074
4075
  }
4075
4076
  debounceTimers[commentId] = setTimeout(() => {
4076
- if (superdoc2) {
4077
- superdoc2.emit("comments-update", event);
4077
+ if (superdoc) {
4078
+ superdoc.emit("comments-update", event);
4078
4079
  }
4079
4080
  delete debounceTimers[commentId];
4080
4081
  }, delay);
4081
4082
  };
4082
- const showAddComment = (superdoc2) => {
4083
+ const showAddComment = (superdoc) => {
4083
4084
  const event = { type: COMMENT_EVENTS.PENDING };
4084
- superdoc2.emit("comments-update", event);
4085
+ superdoc.emit("comments-update", event);
4085
4086
  const selection = { ...superdocStore.activeSelection };
4086
4087
  selection.selectionBounds = { ...selection.selectionBounds };
4087
4088
  if (superdocStore.selectionPosition?.source) {
4088
4089
  superdocStore.selectionPosition.source = null;
4089
4090
  }
4090
4091
  pendingComment.value = getPendingComment({ selection, documentId: selection.documentId, parentCommentId: null });
4091
- if (!superdoc2.config.isInternal) pendingComment.value.isInternal = false;
4092
- if (superdoc2.activeEditor?.commands) {
4093
- superdoc2.activeEditor.commands.insertComment({
4092
+ if (!superdoc.config.isInternal) pendingComment.value.isInternal = false;
4093
+ if (superdoc.activeEditor?.commands) {
4094
+ superdoc.activeEditor.commands.insertComment({
4094
4095
  ...pendingComment.value.getValues(),
4095
4096
  commentId: "pending",
4096
4097
  skipEmit: true
@@ -4160,14 +4161,14 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
4160
4161
  ...options
4161
4162
  });
4162
4163
  };
4163
- const removePendingComment = (superdoc2) => {
4164
+ const removePendingComment = (superdoc) => {
4164
4165
  currentCommentText.value = "";
4165
4166
  pendingComment.value = null;
4166
4167
  activeComment.value = null;
4167
4168
  superdocStore.selectionPosition = null;
4168
- superdoc2.activeEditor?.commands.removeComment({ commentId: "pending" });
4169
+ superdoc.activeEditor?.commands.removeComment({ commentId: "pending" });
4169
4170
  };
4170
- const addComment = ({ superdoc: superdoc2, comment, skipEditorUpdate = false }) => {
4171
+ const addComment = ({ superdoc, comment, skipEditorUpdate = false }) => {
4171
4172
  let parentComment = commentsList.value.find((c2) => c2.commentId === activeComment.value);
4172
4173
  if (!parentComment) parentComment = comment;
4173
4174
  const newComment = useComment(comment.getValues());
@@ -4178,22 +4179,22 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
4178
4179
  const isParentInternal = parentComment.isInternal;
4179
4180
  newComment.isInternal = isParentInternal;
4180
4181
  }
4181
- if (!superdoc2.config.isInternal) newComment.isInternal = false;
4182
+ if (!superdoc.config.isInternal) newComment.isInternal = false;
4182
4183
  commentsList.value.push(newComment);
4183
- removePendingComment(superdoc2);
4184
- if (!skipEditorUpdate && !comment.trackedChange && superdoc2.activeEditor?.commands && !comment.parentCommentId) {
4185
- superdoc2.activeEditor.commands.insertComment({ ...newComment.getValues(), skipEmit: true });
4184
+ removePendingComment(superdoc);
4185
+ if (!skipEditorUpdate && !comment.trackedChange && superdoc.activeEditor?.commands && !comment.parentCommentId) {
4186
+ superdoc.activeEditor.commands.insertComment({ ...newComment.getValues(), skipEmit: true });
4186
4187
  }
4187
4188
  const event = { type: COMMENT_EVENTS.ADD, comment: newComment.getValues() };
4188
- syncCommentsToClients(superdoc2, event);
4189
- superdoc2.emit("comments-update", event);
4189
+ syncCommentsToClients(superdoc, event);
4190
+ superdoc.emit("comments-update", event);
4190
4191
  };
4191
- const deleteComment = ({ commentId: commentIdToDelete, superdoc: superdoc2 }) => {
4192
+ const deleteComment = ({ commentId: commentIdToDelete, superdoc }) => {
4192
4193
  const commentIndex = commentsList.value.findIndex((c2) => c2.commentId === commentIdToDelete);
4193
4194
  const comment = commentsList.value[commentIndex];
4194
4195
  const { commentId, importedId } = comment;
4195
4196
  const { fileId } = comment;
4196
- superdoc2.activeEditor?.commands?.removeComment({ commentId, importedId });
4197
+ superdoc.activeEditor?.commands?.removeComment({ commentId, importedId });
4197
4198
  commentsList.value.splice(commentIndex, 1);
4198
4199
  const childCommentIds = commentsList.value.filter((c2) => c2.parentCommentId === commentId).map((c2) => c2.commentId || c2.importedId);
4199
4200
  commentsList.value = commentsList.value.filter((c2) => !childCommentIds.includes(c2.commentId));
@@ -4202,13 +4203,13 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
4202
4203
  comment: comment.getValues(),
4203
4204
  changes: [{ key: "deleted", commentId, fileId }]
4204
4205
  };
4205
- superdoc2.emit("comments-update", event);
4206
- syncCommentsToClients(superdoc2, event);
4206
+ superdoc.emit("comments-update", event);
4207
+ syncCommentsToClients(superdoc, event);
4207
4208
  };
4208
- const cancelComment = (superdoc2) => {
4209
- removePendingComment(superdoc2);
4209
+ const cancelComment = (superdoc) => {
4210
+ removePendingComment(superdoc);
4210
4211
  };
4211
- const processLoadedDocxComments = async ({ superdoc: superdoc2, editor, comments, documentId }) => {
4212
+ const processLoadedDocxComments = async ({ superdoc, editor, comments, documentId }) => {
4212
4213
  const document2 = superdocStore.getDocument(documentId);
4213
4214
  comments.forEach((comment) => {
4214
4215
  const htmlContent = getHtmlFromComment(comment.textJson);
@@ -4240,7 +4241,7 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
4240
4241
  trackedChangeType: comment.trackedChangeType,
4241
4242
  deletedText: comment.trackedDeletedText
4242
4243
  });
4243
- addComment({ superdoc: superdoc2, comment: newComment });
4244
+ addComment({ superdoc, comment: newComment });
4244
4245
  });
4245
4246
  setTimeout(() => {
4246
4247
  createCommentForTrackChanges(editor);
@@ -16520,12 +16521,12 @@ class SuperComments extends EventEmitter {
16520
16521
  element: null,
16521
16522
  commentsStore: null
16522
16523
  };
16523
- constructor(options, superdoc2) {
16524
+ constructor(options, superdoc) {
16524
16525
  super();
16525
16526
  this.config = { ...this.config, ...options };
16526
16527
  this.element = this.config.element;
16527
16528
  this.app = null;
16528
- this.superdoc = superdoc2;
16529
+ this.superdoc = superdoc;
16529
16530
  this.open();
16530
16531
  }
16531
16532
  createVueApp() {
@@ -16754,7 +16755,8 @@ const _sfc_main$9 = {
16754
16755
  measurementTimeoutId.value = null;
16755
16756
  }
16756
16757
  const totalComments = getFloatingComments.value.length;
16757
- if (totalComments === 0) {
16758
+ const measuredComments = renderedSizes.value.length;
16759
+ if (totalComments === 0 || measuredComments === 0) {
16758
16760
  return;
16759
16761
  }
16760
16762
  nextTick(processLocations);
@@ -16835,7 +16837,7 @@ const _sfc_main$9 = {
16835
16837
  };
16836
16838
  }
16837
16839
  };
16838
- const FloatingComments = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-6905dd07"]]);
16840
+ const FloatingComments = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-1402ce8c"]]);
16839
16841
  const _sfc_main$8 = {
16840
16842
  __name: "TextField",
16841
16843
  props: {
@@ -17463,7 +17465,7 @@ const _sfc_main = {
17463
17465
  __name: "SuperDoc",
17464
17466
  emits: ["selection-update"],
17465
17467
  setup(__props, { emit: __emit }) {
17466
- const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-DtdN17V4.es.js"));
17468
+ const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-BYeEi4Kx.es.js"));
17467
17469
  const superdocStore = useSuperdocStore();
17468
17470
  const commentsStore = useCommentsStore();
17469
17471
  const {
@@ -18367,7 +18369,7 @@ class SuperDoc extends EventEmitter {
18367
18369
  this.config.colors = shuffleArray(this.config.colors);
18368
18370
  this.userColorMap = /* @__PURE__ */ new Map();
18369
18371
  this.colorIndex = 0;
18370
- this.version = "1.0.0-next.4";
18372
+ this.version = "1.0.0-next.6";
18371
18373
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
18372
18374
  this.superdocId = config.superdocId || v4();
18373
18375
  this.colors = this.config.colors;
@@ -42410,7 +42410,7 @@ const _SuperConverter = class _SuperConverter2 {
42410
42410
  static getStoredSuperdocVersion(docx) {
42411
42411
  return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
42412
42412
  }
42413
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-next.4") {
42413
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-next.6") {
42414
42414
  return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
42415
42415
  }
42416
42416
  /**
@@ -59638,7 +59638,7 @@ const isHeadless = (editor) => {
59638
59638
  const shouldSkipNodeView = (editor) => {
59639
59639
  return isHeadless(editor);
59640
59640
  };
59641
- const summaryVersion = "1.0.0-next.4";
59641
+ const summaryVersion = "1.0.0-next.6";
59642
59642
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
59643
59643
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
59644
59644
  function mapAttributes(attrs) {
@@ -60427,7 +60427,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
60427
60427
  { default: remarkStringify },
60428
60428
  { default: remarkGfm }
60429
60429
  ] = await Promise.all([
60430
- import("./index-D_KE9gpD-aIqhxcuF.es.js"),
60430
+ import("./index-CKb2zoi7-aboErZCf.es.js"),
60431
60431
  import("./index-DRCvimau-Cw339678.es.js"),
60432
60432
  import("./index-C_x_N6Uh-DJn8hIEt.es.js"),
60433
60433
  import("./index-D_sWOSiG-DE96TaT5.es.js"),
@@ -60632,7 +60632,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
60632
60632
  * Process collaboration migrations
60633
60633
  */
60634
60634
  processCollaborationMigrations() {
60635
- console.debug("[checkVersionMigrations] Current editor version", "1.0.0-next.4");
60635
+ console.debug("[checkVersionMigrations] Current editor version", "1.0.0-next.6");
60636
60636
  if (!this.options.ydoc) return;
60637
60637
  const metaMap = this.options.ydoc.getMap("meta");
60638
60638
  let docVersion = metaMap.get("version");
@@ -42427,7 +42427,7 @@ const _SuperConverter = class _SuperConverter2 {
42427
42427
  static getStoredSuperdocVersion(docx) {
42428
42428
  return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
42429
42429
  }
42430
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-next.4") {
42430
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-next.6") {
42431
42431
  return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
42432
42432
  }
42433
42433
  /**
@@ -59655,7 +59655,7 @@ const isHeadless = (editor) => {
59655
59655
  const shouldSkipNodeView = (editor) => {
59656
59656
  return isHeadless(editor);
59657
59657
  };
59658
- const summaryVersion = "1.0.0-next.4";
59658
+ const summaryVersion = "1.0.0-next.6";
59659
59659
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
59660
59660
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
59661
59661
  function mapAttributes(attrs) {
@@ -60444,7 +60444,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
60444
60444
  { default: remarkStringify },
60445
60445
  { default: remarkGfm }
60446
60446
  ] = await Promise.all([
60447
- Promise.resolve().then(() => require("./index-D_KE9gpD-radGpP4I.cjs")),
60447
+ Promise.resolve().then(() => require("./index-CKb2zoi7-BEMsbmpK.cjs")),
60448
60448
  Promise.resolve().then(() => require("./index-DRCvimau-H4Ck3S9a.cjs")),
60449
60449
  Promise.resolve().then(() => require("./index-C_x_N6Uh-Db3CUJMX.cjs")),
60450
60450
  Promise.resolve().then(() => require("./index-D_sWOSiG-BtDZzJ6I.cjs")),
@@ -60649,7 +60649,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
60649
60649
  * Process collaboration migrations
60650
60650
  */
60651
60651
  processCollaborationMigrations() {
60652
- console.debug("[checkVersionMigrations] Current editor version", "1.0.0-next.4");
60652
+ console.debug("[checkVersionMigrations] Current editor version", "1.0.0-next.6");
60653
60653
  if (!this.options.ydoc) return;
60654
60654
  const metaMap = this.options.ydoc.getMap("meta");
60655
60655
  let docVersion = metaMap.get("version");
@@ -1,5 +1,5 @@
1
- export function addYComment(yArray: any, ydoc: any, event: any): void;
2
- export function updateYComment(yArray: any, ydoc: any, event: any): void;
3
- export function deleteYComment(yArray: any, ydoc: any, event: any): void;
1
+ export function addYComment(yArray: any, ydoc: any, event: any, user: any): void;
2
+ export function updateYComment(yArray: any, ydoc: any, event: any, user: any): void;
3
+ export function deleteYComment(yArray: any, ydoc: any, event: any, user: any): void;
4
4
  export function getCommentIndex(yArray: any, comment: any): any;
5
5
  //# sourceMappingURL=collaboration-comments.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"collaboration-comments.d.ts","sourceRoot":"","sources":["../../../../../../src/core/collaboration/collaboration-comments.js"],"names":[],"mappings":"AAEO,sEAUN;AAEM,yEAaN;AAEM,yEAWN;AAEM,gEAGN"}
1
+ {"version":3,"file":"collaboration-comments.d.ts","sourceRoot":"","sources":["../../../../../../src/core/collaboration/collaboration-comments.js"],"names":[],"mappings":"AAEO,iFAUN;AAEM,oFAaN;AAEM,oFAWN;AAEM,gEAGN"}
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../../../src/core/collaboration/helpers.js"],"names":[],"mappings":"AAWO,oDAHI,MAAM,GACJ,IAAI,CA2ChB;AASM,2CAHI,MAAM,GACJ,IAAI,CAmBhB;AASM,qDAHI,MAAM,OAuBhB;AASM,gDAJI,MAAM,SACN,MAAM,GACJ,IAAI,CAqBhB"}
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../../../src/core/collaboration/helpers.js"],"names":[],"mappings":"AAWO,oDAHI,MAAM,GACJ,IAAI,CA2ChB;AASM,2CAHI,MAAM,GACJ,IAAI,CAmBhB;AASM,qDAHI,MAAM,OAuBhB;AASM,gDAJI,MAAM,SACN,MAAM,GACJ,IAAI,CAsBhB"}
package/dist/style.css CHANGED
@@ -2413,20 +2413,20 @@ https://github.com/ProseMirror/prosemirror-tables/blob/master/demo/index.html
2413
2413
  /* pointer-events: none; */
2414
2414
  }
2415
2415
 
2416
- .measure-comment[data-v-6905dd07] {
2416
+ .measure-comment[data-v-1402ce8c] {
2417
2417
  box-sizing: border-box;
2418
2418
  height: auto;
2419
2419
  }
2420
- .floating-comment[data-v-6905dd07] {
2420
+ .floating-comment[data-v-1402ce8c] {
2421
2421
  position: absolute;
2422
2422
  display: block;
2423
2423
  }
2424
- .sidebar-container[data-v-6905dd07] {
2424
+ .sidebar-container[data-v-1402ce8c] {
2425
2425
  position: absolute;
2426
2426
  width: 300px;
2427
2427
  min-height: 300px;
2428
2428
  }
2429
- .section-wrapper[data-v-6905dd07] {
2429
+ .section-wrapper[data-v-1402ce8c] {
2430
2430
  position: relative;
2431
2431
  min-height: 100%;
2432
2432
  width: 300px;
@@ -2434,11 +2434,11 @@ https://github.com/ProseMirror/prosemirror-tables/blob/master/demo/index.html
2434
2434
  align-items: flex-start;
2435
2435
  justify-content: flex-start;
2436
2436
  }
2437
- .floating-comment[data-v-6905dd07] {
2437
+ .floating-comment[data-v-1402ce8c] {
2438
2438
  position: absolute;
2439
2439
  min-width: 300px;
2440
2440
  }
2441
- .calculation-container[data-v-6905dd07] {
2441
+ .calculation-container[data-v-1402ce8c] {
2442
2442
  visibility: hidden;
2443
2443
  position: fixed;
2444
2444
  left: -9999px;
@@ -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-CVqUjX24.js";
3
- import { _ as _export_sfc } from "./chunks/editor-Cc8nus2C.js";
2
+ import { T as TextSelection } from "./chunks/converter-CyZvCMe8.js";
3
+ import { _ as _export_sfc } from "./chunks/editor-uiCiCr8n.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 = {}) {
@@ -42727,7 +42727,7 @@ const _SuperConverter = class _SuperConverter {
42727
42727
  static getStoredSuperdocVersion(docx) {
42728
42728
  return _SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
42729
42729
  }
42730
- static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.0.0-next.4") {
42730
+ static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.0.0-next.6") {
42731
42731
  return _SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version, false);
42732
42732
  }
42733
42733
  /**
@@ -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-CVqUjX24.js";
1
+ import { p as process$1, aJ as commonjsGlobal, B as Buffer, aK as getDefaultExportFromCjs, aL as getContentTypesFromXml, aM as xmljs } from "./converter-CyZvCMe8.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
  }