@harbour-enterprises/superdoc 1.0.0-alpha.58 → 1.0.0-alpha.59

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.
package/dist/style.css CHANGED
@@ -19157,23 +19157,23 @@ span[data-v-36fffb56] {
19157
19157
  background-color: #F3F3F5;
19158
19158
  }
19159
19159
 
19160
- .change-type[data-v-9ca65218] {
19160
+ .change-type[data-v-464575a4] {
19161
19161
  font-style: italic;
19162
19162
  font-weight: 600;
19163
19163
  }
19164
- .comment-separator[data-v-9ca65218] {
19164
+ .comment-separator[data-v-464575a4] {
19165
19165
  background-color: #DBDBDB;
19166
19166
  height: 1px;
19167
19167
  width: 100%;
19168
19168
  margin: 15px 0;
19169
19169
  }
19170
- .existing-internal-input[data-v-9ca65218] {
19170
+ .existing-internal-input[data-v-464575a4] {
19171
19171
  margin-bottom: 10px;
19172
19172
  }
19173
- .initial-internal-dropdown[data-v-9ca65218] {
19173
+ .initial-internal-dropdown[data-v-464575a4] {
19174
19174
  margin-top: 10px;
19175
19175
  }
19176
- .comments-dialog[data-v-9ca65218] {
19176
+ .comments-dialog[data-v-464575a4] {
19177
19177
  position: absolute;
19178
19178
  display: flex;
19179
19179
  flex-direction: column;
@@ -19187,14 +19187,14 @@ span[data-v-36fffb56] {
19187
19187
  z-index: 5;
19188
19188
  width: 300px;
19189
19189
  }
19190
- .is-active[data-v-9ca65218] {
19190
+ .is-active[data-v-464575a4] {
19191
19191
  z-index: 10;
19192
19192
  }
19193
- .overflow-menu[data-v-9ca65218] {
19193
+ .overflow-menu[data-v-464575a4] {
19194
19194
  flex-shrink: 1;
19195
19195
  display: flex;
19196
19196
  }
19197
- .overflow-menu i[data-v-9ca65218] {
19197
+ .overflow-menu i[data-v-464575a4] {
19198
19198
  width: 20px;
19199
19199
  height: 20px;
19200
19200
  display: flex;
@@ -19206,74 +19206,74 @@ span[data-v-36fffb56] {
19206
19206
  margin-left: 2px;
19207
19207
  cursor: pointer;
19208
19208
  }
19209
- .overflow-menu i[data-v-9ca65218]:hover {
19209
+ .overflow-menu i[data-v-464575a4]:hover {
19210
19210
  background-color: #DBDBDB;
19211
19211
  }
19212
- .comment-header[data-v-9ca65218] {
19212
+ .comment-header[data-v-464575a4] {
19213
19213
  display: flex;
19214
19214
  align-items: center;
19215
19215
  justify-content: space-between;
19216
19216
  margin-bottom: 10px;
19217
19217
  }
19218
- .comment-header-left[data-v-9ca65218] {
19218
+ .comment-header-left[data-v-464575a4] {
19219
19219
  display: flex;
19220
19220
  justify-content: space-between;
19221
19221
  align-items: center;
19222
19222
  }
19223
- .avatar[data-v-9ca65218] {
19223
+ .avatar[data-v-464575a4] {
19224
19224
  margin-right: 10px;
19225
19225
  }
19226
- .user-info[data-v-9ca65218] {
19226
+ .user-info[data-v-464575a4] {
19227
19227
  display: flex;
19228
19228
  flex-direction: column;
19229
19229
  font-size: 12px;
19230
19230
  }
19231
- .user-name[data-v-9ca65218] {
19231
+ .user-name[data-v-464575a4] {
19232
19232
  font-weight: 600;
19233
19233
  line-height: 1.2em;
19234
19234
  }
19235
- .user-timestamp[data-v-9ca65218] {
19235
+ .user-timestamp[data-v-464575a4] {
19236
19236
  line-height: 1.2em;
19237
19237
  font-size: 12px;
19238
19238
  color: #999;
19239
19239
  }
19240
- .input-section[data-v-9ca65218] {
19240
+ .input-section[data-v-464575a4] {
19241
19241
  margin-top: 10px;
19242
19242
  }
19243
- .sd-button[data-v-9ca65218] {
19243
+ .sd-button[data-v-464575a4] {
19244
19244
  font-size: 12px;
19245
19245
  margin-left: 5px;
19246
19246
  }
19247
- .comment[data-v-9ca65218] {
19247
+ .comment[data-v-464575a4] {
19248
19248
  font-size: 13px;
19249
19249
  margin: 10px 0;
19250
19250
  }
19251
- .conversation-item[data-v-9ca65218] {
19251
+ .conversation-item[data-v-464575a4] {
19252
19252
  border-bottom: 1px solid #DBDBDB;
19253
19253
  padding-bottom: 10px;
19254
19254
  }
19255
- .comment-footer[data-v-9ca65218] {
19255
+ .comment-footer[data-v-464575a4] {
19256
19256
  margin: 5px 0 5px;
19257
19257
  display: flex;
19258
19258
  justify-content: flex-end;
19259
19259
  width: 100%;
19260
19260
  }
19261
- .internal-dropdown[data-v-9ca65218] {
19261
+ .internal-dropdown[data-v-464575a4] {
19262
19262
  display: inline-block;
19263
19263
  }
19264
- .comment-editing[data-v-9ca65218] {
19264
+ .comment-editing[data-v-464575a4] {
19265
19265
  padding-bottom: 10px;
19266
19266
  }
19267
- .comment-editing button[data-v-9ca65218] {
19267
+ .comment-editing button[data-v-464575a4] {
19268
19268
  margin-left: 5px;
19269
19269
  }
19270
- .comment-entry[data-v-9ca65218] {
19270
+ .comment-entry[data-v-464575a4] {
19271
19271
  border-radius: 8px;
19272
19272
  border: 1px solid #DBDBDB !important;
19273
19273
  width: 100%;
19274
19274
  transition: all 250ms ease;
19275
19275
  }
19276
- .tracked-change[data-v-9ca65218] {
19276
+ .tracked-change[data-v-464575a4] {
19277
19277
  margin: 0;
19278
19278
  }
19279
19279
 
@@ -19416,74 +19416,74 @@ img[data-v-3a10cc41] {
19416
19416
  }
19417
19417
  }
19418
19418
 
19419
- .selection-layer[data-v-0f7b7f55] {
19419
+ .selection-layer[data-v-88384bc4] {
19420
19420
  position: absolute;
19421
19421
  min-height: 100%;
19422
19422
  min-width: 100%;
19423
19423
  z-index: 10;
19424
19424
  pointer-events: none;
19425
19425
  }
19426
- .temp-selection[data-v-0f7b7f55] {
19426
+ .temp-selection[data-v-88384bc4] {
19427
19427
  position: absolute;
19428
19428
  }
19429
19429
  /* Right sidebar drawer */
19430
- .right-sidebar[data-v-0f7b7f55] {
19430
+ .right-sidebar[data-v-88384bc4] {
19431
19431
  width: 320px;
19432
19432
  padding: 0 10px;
19433
19433
  min-height: 100%;
19434
19434
  position: relative;
19435
19435
  z-index: 100;
19436
19436
  }
19437
- .fa-tool-icon[data-v-0f7b7f55] {
19437
+ .fa-tool-icon[data-v-88384bc4] {
19438
19438
  cursor: pointer;
19439
19439
  }
19440
19440
 
19441
19441
  /* General Styles */
19442
- .box-sizing[data-v-0f7b7f55], .layers[data-v-0f7b7f55] {
19442
+ .box-sizing[data-v-88384bc4], .layers[data-v-88384bc4] {
19443
19443
  box-sizing: border-box;
19444
19444
  }
19445
- .cursor-pointer[data-v-0f7b7f55], .tools .tool-icon[data-v-0f7b7f55], .toolbar-item[data-v-0f7b7f55] {
19445
+ .cursor-pointer[data-v-88384bc4], .tools .tool-icon[data-v-88384bc4], .toolbar-item[data-v-88384bc4] {
19446
19446
  cursor: pointer;
19447
19447
  }
19448
- .flex[data-v-0f7b7f55] {
19448
+ .flex[data-v-88384bc4] {
19449
19449
  display: flex;
19450
19450
  }
19451
- .flex-column[data-v-0f7b7f55] {
19451
+ .flex-column[data-v-88384bc4] {
19452
19452
  flex-direction: column;
19453
19453
  }
19454
- .flex-center[data-v-0f7b7f55] {
19454
+ .flex-center[data-v-88384bc4] {
19455
19455
  display: flex;
19456
19456
  align-items: center;
19457
19457
  justify-content: center;
19458
19458
  }
19459
19459
 
19460
19460
  /* Layer Styles */
19461
- .comments-layer[data-v-0f7b7f55] {
19461
+ .comments-layer[data-v-88384bc4] {
19462
19462
  position: absolute;
19463
19463
  top: 0;
19464
19464
  height: 100%;
19465
19465
  position: relative;
19466
19466
  }
19467
- .layers[data-v-0f7b7f55] {
19467
+ .layers[data-v-88384bc4] {
19468
19468
  position: relative;
19469
19469
  }
19470
19470
 
19471
19471
  /* Document Styles */
19472
- .docx[data-v-0f7b7f55] {
19472
+ .docx[data-v-88384bc4] {
19473
19473
  border: 1px solid #DFDFDF;
19474
19474
  pointer-events: auto;
19475
19475
  }
19476
- .sub-document[data-v-0f7b7f55] {
19476
+ .sub-document[data-v-88384bc4] {
19477
19477
  position: relative;
19478
19478
  }
19479
19479
 
19480
19480
  /* Toolbar Styles */
19481
- .toolbar[data-v-0f7b7f55] {
19481
+ .toolbar[data-v-88384bc4] {
19482
19482
  height: 25px;
19483
19483
  background-color: #fff;
19484
19484
  margin-bottom: 5px;
19485
19485
  }
19486
- .toolbar-item[data-v-0f7b7f55] {
19486
+ .toolbar-item[data-v-88384bc4] {
19487
19487
  width: 20px;
19488
19488
  height: 20px;
19489
19489
  border-radius: 8px;
@@ -19495,12 +19495,12 @@ img[data-v-3a10cc41] {
19495
19495
  justify-content: center;
19496
19496
  transition: all 250ms ease;
19497
19497
  }
19498
- .toolbar-item[data-v-0f7b7f55]:hover {
19498
+ .toolbar-item[data-v-88384bc4]:hover {
19499
19499
  background-color: #DBDBDB;
19500
19500
  }
19501
19501
 
19502
19502
  /* Tools Styles */
19503
- .tools[data-v-0f7b7f55] {
19503
+ .tools[data-v-88384bc4] {
19504
19504
  position: absolute;
19505
19505
  width: 50px;
19506
19506
  height: 50px;
@@ -19511,7 +19511,7 @@ img[data-v-3a10cc41] {
19511
19511
  align-items: center;
19512
19512
  justify-content: center;
19513
19513
  }
19514
- .tools .tool-icon[data-v-0f7b7f55] {
19514
+ .tools .tool-icon[data-v-88384bc4] {
19515
19515
  font-size: 20px;
19516
19516
  border-radius: 12px;
19517
19517
  border: none;
@@ -19519,11 +19519,11 @@ img[data-v-3a10cc41] {
19519
19519
  background-color: #DBDBDB;
19520
19520
  }
19521
19521
  @media (max-width: 768px) {
19522
- .sub-document[data-v-0f7b7f55] {
19522
+ .sub-document[data-v-88384bc4] {
19523
19523
  max-width: 100%;
19524
19524
  overflow: hidden;
19525
19525
  }
19526
- .right-sidebar[data-v-0f7b7f55] {
19526
+ .right-sidebar[data-v-88384bc4] {
19527
19527
  padding: 10px;
19528
19528
  width: 55px;
19529
19529
  position: relative;
@@ -11033,6 +11033,7 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
11033
11033
  const commentDialogs = ref$1([]);
11034
11034
  const overlappingComments = ref$1([]);
11035
11035
  const overlappedIds = /* @__PURE__ */ new Set([]);
11036
+ const suppressInternalExternal = ref$1(false);
11036
11037
  const floatingCommentsOffset = ref$1(0);
11037
11038
  const sortedConversations = ref$1([]);
11038
11039
  const visibleConversations = ref$1([]);
@@ -11159,6 +11160,7 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
11159
11160
  commentDialogs,
11160
11161
  overlappingComments,
11161
11162
  overlappedIds,
11163
+ suppressInternalExternal,
11162
11164
  pendingComment,
11163
11165
  // Floating comments
11164
11166
  floatingCommentsOffset,
@@ -11383,6 +11385,9 @@ const useSuperdocStore = /* @__PURE__ */ defineStore("superdoc", () => {
11383
11385
  const smartDoc = useDocument(doc2, config);
11384
11386
  documents.value.push(smartDoc);
11385
11387
  });
11388
+ if ("comments" in modules) {
11389
+ commentsStore.suppressInternalExternal = modules.comments.suppressInternalExternal || false;
11390
+ }
11386
11391
  isReady.value = true;
11387
11392
  };
11388
11393
  const areDocumentsReady = computed(() => {
@@ -95340,7 +95345,7 @@ const _sfc_main$9 = {
95340
95345
  const superdocStore = useSuperdocStore();
95341
95346
  const commentsStore = useCommentsStore();
95342
95347
  const { COMMENT_EVENTS } = commentsStore;
95343
- const { getConfig, activeComment, pendingComment, floatingCommentsOffset } = storeToRefs(commentsStore);
95348
+ const { getConfig, activeComment, pendingComment, floatingCommentsOffset, suppressInternalExternal } = storeToRefs(commentsStore);
95344
95349
  const { areDocumentsReady, getDocument: getDocument2 } = superdocStore;
95345
95350
  const { selectionPosition, activeZoom } = storeToRefs(superdocStore);
95346
95351
  const { proxy } = getCurrentInstance();
@@ -95475,54 +95480,9 @@ const _sfc_main$9 = {
95475
95480
  proxy.$superdoc.broadcastComments(COMMENT_EVENTS.UPDATE, convo.getValues());
95476
95481
  }
95477
95482
  };
95478
- const overflowOptions = [
95479
- {
95480
- label: "Edit",
95481
- key: "edit"
95482
- },
95483
- {
95484
- label: "Delete",
95485
- key: "delete"
95486
- },
95487
- {
95488
- label: "Quote",
95489
- key: "delete",
95490
- disabled: true
95491
- }
95492
- ];
95493
95483
  const getCurrentConvo = () => {
95494
95484
  return props.currentDocument.conversations.find((c2) => c2.conversationId === props.data.conversationId);
95495
95485
  };
95496
- const handleOverflowSelection = (index2, item, key) => {
95497
- switch (key) {
95498
- case "edit":
95499
- handleEdit(item);
95500
- break;
95501
- case "delete":
95502
- handleDelete(index2);
95503
- break;
95504
- case "quote":
95505
- handleQuote();
95506
- break;
95507
- }
95508
- };
95509
- const handleEdit = (item) => {
95510
- currentComment.value = item.comment;
95511
- isEditing.value = item;
95512
- };
95513
- const handleDelete = (index2) => {
95514
- const convo = getCurrentConvo();
95515
- if (!convo) return;
95516
- if (convo.comments.length === 1) {
95517
- props.currentDocument.removeConversation(convo.conversationId);
95518
- } else {
95519
- convo.comments.splice(index2, 1);
95520
- }
95521
- proxy.$superdoc.broadcastComments(COMMENT_EVENTS.DELETED, convo.conversationId);
95522
- };
95523
- const handleQuote = () => {
95524
- console.log("Quote");
95525
- };
95526
95486
  const updateComment = (item) => {
95527
95487
  item.comment = currentComment.value;
95528
95488
  currentComment.value = "";
@@ -95569,7 +95529,7 @@ const _sfc_main$9 = {
95569
95529
  ref_key: "currentElement",
95570
95530
  ref: currentElement2
95571
95531
  }, [
95572
- !unref(pendingComment) && !__props.data.isTrackedChange ? (openBlock(), createElementBlock("div", _hoisted_2$2, [
95532
+ !unref(pendingComment) && !__props.data.isTrackedChange && !unref(suppressInternalExternal) ? (openBlock(), createElementBlock("div", _hoisted_2$2, [
95573
95533
  createVNode(InternalDropdown, {
95574
95534
  class: "internal-dropdown",
95575
95535
  state: props.data.isInternal ? "internal" : "external",
@@ -95607,29 +95567,16 @@ const _sfc_main$9 = {
95607
95567
  class: "fal fa-check",
95608
95568
  onClick: withModifiers(markDone, ["stop", "prevent"]),
95609
95569
  title: "Mark done and hide comment thread"
95610
- })) : createCommentVNode("", true),
95611
- createVNode(unref(NDropdown), {
95612
- trigger: "click",
95613
- options: overflowOptions,
95614
- onSelect: ($event) => handleOverflowSelection(index2, item, $event)
95615
- }, {
95616
- default: withCtx(() => _cache2[8] || (_cache2[8] = [
95617
- createBaseVNode("i", {
95618
- class: "fal fa-ellipsis-v",
95619
- title: "More options"
95620
- }, null, -1)
95621
- ])),
95622
- _: 2
95623
- }, 1032, ["onSelect"])
95570
+ })) : createCommentVNode("", true)
95624
95571
  ]))
95625
95572
  ]),
95626
95573
  __props.data.isTrackedChange && index2 === 0 ? (openBlock(), createElementBlock("div", _hoisted_12, [
95627
95574
  item.trackedChange?.insertion ? (openBlock(), createElementBlock("div", _hoisted_13, [
95628
- _cache2[9] || (_cache2[9] = createBaseVNode("span", { class: "change-type" }, "Add: ", -1)),
95575
+ _cache2[8] || (_cache2[8] = createBaseVNode("span", { class: "change-type" }, "Add: ", -1)),
95629
95576
  createTextVNode(" " + toDisplayString(item.trackedChange.insertion), 1)
95630
95577
  ])) : createCommentVNode("", true),
95631
95578
  item.trackedChange?.deletion ? (openBlock(), createElementBlock("div", _hoisted_14, [
95632
- _cache2[10] || (_cache2[10] = createBaseVNode("span", { class: "change-type" }, "Remove: ", -1)),
95579
+ _cache2[9] || (_cache2[9] = createBaseVNode("span", { class: "change-type" }, "Remove: ", -1)),
95633
95580
  createTextVNode(" " + toDisplayString(item.trackedChange.deletion), 1)
95634
95581
  ])) : createCommentVNode("", true)
95635
95582
  ])) : (openBlock(), createElementBlock("div", _hoisted_15, [
@@ -95637,7 +95584,7 @@ const _sfc_main$9 = {
95637
95584
  key: 0,
95638
95585
  class: "comment",
95639
95586
  innerHTML: item.comment
95640
- }, null, 8, _hoisted_16)) : item === isEditing.value ? (openBlock(), createElementBlock("div", _hoisted_17, [
95587
+ }, null, 8, _hoisted_16)) : item === isEditing.value && !unref(getConfig).readOnly ? (openBlock(), createElementBlock("div", _hoisted_17, [
95641
95588
  createBaseVNode("div", {
95642
95589
  class: normalizeClass(["comment-entry", { "input-active": isFocused.value }])
95643
95590
  }, [
@@ -95670,7 +95617,7 @@ const _sfc_main$9 = {
95670
95617
  showSeparator.value(index2) ? (openBlock(), createElementBlock("div", _hoisted_20)) : createCommentVNode("", true)
95671
95618
  ]);
95672
95619
  }), 256)),
95673
- showInputSection.value ? (openBlock(), createElementBlock("div", _hoisted_21, [
95620
+ showInputSection.value && !unref(getConfig).readOnly ? (openBlock(), createElementBlock("div", _hoisted_21, [
95674
95621
  createBaseVNode("div", _hoisted_22, [
95675
95622
  createBaseVNode("div", _hoisted_23, [
95676
95623
  createBaseVNode("div", _hoisted_24, [
@@ -95680,7 +95627,7 @@ const _sfc_main$9 = {
95680
95627
  ]),
95681
95628
  createBaseVNode("div", _hoisted_25, [
95682
95629
  createBaseVNode("div", _hoisted_26, toDisplayString(props.user.name), 1),
95683
- _cache2[11] || (_cache2[11] = createBaseVNode("div", { class: "user-timestamp" }, null, -1))
95630
+ _cache2[10] || (_cache2[10] = createBaseVNode("div", { class: "user-timestamp" }, null, -1))
95684
95631
  ])
95685
95632
  ])
95686
95633
  ]),
@@ -95701,13 +95648,13 @@ const _sfc_main$9 = {
95701
95648
  })
95702
95649
  }, null, 8, ["modelValue", "users"])
95703
95650
  ], 2),
95704
- unref(pendingComment) ? (openBlock(), createBlock(InternalDropdown, {
95651
+ unref(pendingComment) && !unref(suppressInternalExternal) ? (openBlock(), createBlock(InternalDropdown, {
95705
95652
  key: 0,
95706
95653
  class: "internal-dropdown initial-internal-dropdown",
95707
95654
  onSelect: _cache2[7] || (_cache2[7] = ($event) => setConversationInternal($event))
95708
95655
  })) : createCommentVNode("", true)
95709
95656
  ])) : createCommentVNode("", true),
95710
- showButtons.value ? (openBlock(), createElementBlock("div", _hoisted_27, [
95657
+ showButtons.value && !unref(getConfig).readOnly ? (openBlock(), createElementBlock("div", _hoisted_27, [
95711
95658
  createBaseVNode("button", {
95712
95659
  class: "sd-button",
95713
95660
  onClick: withModifiers(cancelComment, ["stop", "prevent"])
@@ -95723,7 +95670,7 @@ const _sfc_main$9 = {
95723
95670
  };
95724
95671
  }
95725
95672
  };
95726
- const CommentDialog = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-9ca65218"]]);
95673
+ const CommentDialog = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-464575a4"]]);
95727
95674
  function useFloatingConveration(params) {
95728
95675
  const id = params.conversationId;
95729
95676
  const conversation = ref$1(params);
@@ -96518,25 +96465,38 @@ const _sfc_main = {
96518
96465
  const isDragging = ref$1(false);
96519
96466
  const getSelectionPosition = computed(() => {
96520
96467
  if (!selectionPosition.value || selectionPosition.value.source === "super-editor") {
96521
- return { top: null, left: null, right: null, bottom: null };
96468
+ return { x: null, y: null };
96522
96469
  }
96470
+ const top2 = selectionPosition.value.top;
96471
+ const left2 = selectionPosition.value.left;
96472
+ const right2 = selectionPosition.value.right;
96473
+ const bottom2 = selectionPosition.value.bottom;
96523
96474
  const style2 = {
96524
96475
  zIndex: 500,
96525
96476
  borderRadius: "4px",
96526
- top: selectionPosition.value.top + "px",
96527
- left: selectionPosition.value.left + "px",
96528
- height: selectionPosition.value.height + "px",
96529
- width: selectionPosition.value.width + "px"
96477
+ top: top2 + "px",
96478
+ left: left2 + "px",
96479
+ height: Math.abs(top2 - bottom2) + "px",
96480
+ width: Math.abs(left2 - right2) + "px"
96530
96481
  };
96531
96482
  return style2;
96532
96483
  });
96533
96484
  const handleSelectionChange = (selection) => {
96534
96485
  if (!selection.selectionBounds || !isCommentsEnabled.value) return;
96535
- const x = selection.selectionBounds.left;
96536
- const y = selection.selectionBounds.top;
96537
- const x2 = selection.selectionBounds.right;
96538
- const y2 = selection.selectionBounds.bottom;
96539
- updateSelection2({ x, y, x2, y2, source: selection.source.value });
96486
+ updateSelection2({
96487
+ startX: selection.selectionBounds.left,
96488
+ startY: selection.selectionBounds.top,
96489
+ x: selection.selectionBounds.right,
96490
+ y: selection.selectionBounds.bottom,
96491
+ source: selection.source
96492
+ });
96493
+ const selectionIsWideEnough = Math.abs(selectionPosition.value.left - selectionPosition.value.right) > 5;
96494
+ const selectionIsTallEnough = Math.abs(selectionPosition.value.top - selectionPosition.value.bottom) > 5;
96495
+ if (!selectionIsWideEnough || !selectionIsTallEnough) {
96496
+ selectionLayer.value.style.pointerEvents = "none";
96497
+ resetSelection();
96498
+ return;
96499
+ }
96540
96500
  activeSelection.value = selection;
96541
96501
  let top2 = selection.selectionBounds.top;
96542
96502
  if (selection.bottom - selection.selectionBounds.top < 0) {
@@ -96544,42 +96504,69 @@ const _sfc_main = {
96544
96504
  }
96545
96505
  toolsMenuPosition.top = top2 - 20 + "px";
96546
96506
  };
96547
- const updateSelection2 = ({ x, y, x2, y2, source }) => {
96548
- if (y != null) {
96507
+ const resetSelection = () => {
96508
+ selectionPosition.value = null;
96509
+ };
96510
+ const updateSelection2 = ({ startX, startY, x, y, source }) => {
96511
+ const hasStartCoords = startX || startY;
96512
+ const hasEndCoords = x || y;
96513
+ if (!hasStartCoords && !hasEndCoords) {
96514
+ return selectionPosition.value = null;
96515
+ }
96516
+ if (!selectionPosition.value) {
96517
+ if (startY <= 0 || startX <= 0) return;
96518
+ selectionPosition.value = {
96519
+ top: startY,
96520
+ left: startX,
96521
+ right: startX,
96522
+ bottom: startY,
96523
+ startX,
96524
+ startY,
96525
+ source
96526
+ };
96527
+ }
96528
+ if (startX) selectionPosition.value.startX = startX;
96529
+ if (startY) selectionPosition.value.startY = startY;
96530
+ const selectionTop = selectionPosition.value.startY;
96531
+ if (y < selectionTop) {
96549
96532
  selectionPosition.value.top = y;
96550
- selectionPosition.value.height = 0;
96533
+ } else {
96534
+ selectionPosition.value.bottom = y;
96551
96535
  }
96552
- if (x != null) {
96536
+ const selectionLeft = selectionPosition.value.startX;
96537
+ if (x < selectionLeft) {
96553
96538
  selectionPosition.value.left = x;
96554
- selectionPosition.value.width = 0;
96539
+ } else {
96540
+ selectionPosition.value.right = x;
96555
96541
  }
96556
- if (y2 != null) selectionPosition.value.height = y2 - selectionPosition.value.top;
96557
- if (x2 != null) selectionPosition.value.width = x2 - selectionPosition.value.left;
96558
- selectionPosition.value.source = source;
96559
96542
  };
96560
96543
  const handleSelectionStart = (e) => {
96544
+ resetSelection();
96561
96545
  selectionLayer.value.style.pointerEvents = "auto";
96562
- isDragging.value = true;
96563
- const y = e.offsetY / activeZoom.value;
96564
- const x = e.offsetX / activeZoom.value;
96565
- updateSelection2({ x, y, x2: 0, y2: 0 });
96566
- selectionLayer.value.addEventListener("mousemove", handleDragMove);
96546
+ nextTick(() => {
96547
+ isDragging.value = true;
96548
+ const y = e.offsetY / activeZoom.value;
96549
+ const x = e.offsetX / activeZoom.value;
96550
+ updateSelection2({ startX: x, startY: y });
96551
+ selectionLayer.value.addEventListener("mousemove", handleDragMove);
96552
+ });
96567
96553
  };
96568
96554
  const handleDragMove = (e) => {
96569
96555
  if (!isDragging.value) return;
96570
- const y2 = e.offsetY / activeZoom.value;
96571
- const x2 = e.offsetX / activeZoom.value;
96572
- updateSelection2({ x2, y2 });
96556
+ const y = e.offsetY / activeZoom.value;
96557
+ const x = e.offsetX / activeZoom.value;
96558
+ updateSelection2({ x, y });
96573
96559
  };
96574
96560
  const handleDragEnd = (e) => {
96575
96561
  if (!isDragging.value) return;
96576
96562
  selectionLayer.value.removeEventListener("mousemove", handleDragMove);
96563
+ if (!selectionPosition.value) return;
96577
96564
  const selection = useSelection({
96578
96565
  selectionBounds: {
96579
96566
  top: selectionPosition.value.top,
96580
96567
  left: selectionPosition.value.left,
96581
- right: selectionPosition.value.left + selectionPosition.value.width,
96582
- bottom: selectionPosition.value.top + selectionPosition.value.height
96568
+ right: selectionPosition.value.right,
96569
+ bottom: selectionPosition.value.bottom
96583
96570
  },
96584
96571
  documentId: documents.value[0].id
96585
96572
  });
@@ -96588,6 +96575,7 @@ const _sfc_main = {
96588
96575
  };
96589
96576
  const handlePdfClick = (e) => {
96590
96577
  if (!isCommentsEnabled.value) return;
96578
+ resetSelection();
96591
96579
  isDragging.value = true;
96592
96580
  handleSelectionStart(e);
96593
96581
  };
@@ -96619,10 +96607,11 @@ const _sfc_main = {
96619
96607
  ref_key: "selectionLayer",
96620
96608
  ref: selectionLayer
96621
96609
  }, [
96622
- createBaseVNode("div", {
96610
+ unref(selectionPosition) ? (openBlock(), createElementBlock("div", {
96611
+ key: 0,
96623
96612
  style: normalizeStyle(getSelectionPosition.value),
96624
96613
  class: "sd-highlight sd-initial-highlight temp-selection"
96625
- }, null, 4)
96614
+ }, null, 4)) : createCommentVNode("", true)
96626
96615
  ], 544)) : createCommentVNode("", true),
96627
96616
  "hrbr-fields" in unref(modules) && layers.value ? (openBlock(), createBlock(HrbrFieldsLayer, {
96628
96617
  key: 1,
@@ -96654,12 +96643,10 @@ const _sfc_main = {
96654
96643
  key: 0,
96655
96644
  "document-data": doc2,
96656
96645
  onSelectionChange: handleSelectionChange,
96657
- onSelectionDrag: _ctx.handleSelectionDrag,
96658
- onSelectionDragEnd: _ctx.handleSelectionDragEnd,
96659
96646
  onReady: handleDocumentReady,
96660
96647
  onPageLoaded: unref(handlePageReady),
96661
96648
  onBypassSelection: handlePdfClick
96662
- }, null, 8, ["document-data", "onSelectionDrag", "onSelectionDragEnd", "onPageLoaded"])) : createCommentVNode("", true),
96649
+ }, null, 8, ["document-data", "onPageLoaded"])) : createCommentVNode("", true),
96663
96650
  doc2.type === unref(DOCX) ? (openBlock(), createBlock(unref(SuperEditor), {
96664
96651
  key: 1,
96665
96652
  "file-source": doc2.data,
@@ -96698,7 +96685,7 @@ const _sfc_main = {
96698
96685
  };
96699
96686
  }
96700
96687
  };
96701
- const App = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-0f7b7f55"]]);
96688
+ const App = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-88384bc4"]]);
96702
96689
  const createVueApp = () => {
96703
96690
  const app = createApp(App);
96704
96691
  const pinia = createPinia();
@@ -96816,12 +96803,7 @@ init_fn2 = function(config) {
96816
96803
  this.activeEditor = null;
96817
96804
  this.app.mount(config.selector);
96818
96805
  this.readyEditors = 0;
96819
- this.users = [
96820
- { name: "Nick Bernal", email: "nick@harbourshare.com" },
96821
- { name: "Artem Nistuley", email: "nick@harbourshare.com" },
96822
- { name: "Matthew Connelly", email: "matthew@harbourshare.com" },
96823
- { name: "Eric Doversberger", email: "eric@harbourshare.com" }
96824
- ];
96806
+ this.users = config.users || [];
96825
96807
  this.addToolbar(this);
96826
96808
  };
96827
96809
  preprocessDocuments_fn = function(documents) {