@harbour-enterprises/superdoc 1.0.0-alpha.13 → 1.0.0-alpha.14

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.
@@ -37425,9 +37425,10 @@ const _sfc_main$b = {
37425
37425
  const { selection } = conversation;
37426
37426
  const containerBounds = selection.getContainerLocation(props.parent);
37427
37427
  const placement = conversation.selection.selectionBounds;
37428
+ const top = parseFloat(placement.top) + containerBounds.top;
37428
37429
  return {
37429
37430
  position: "absolute",
37430
- top: placement.top + containerBounds.top + "px",
37431
+ top: top + "px",
37431
37432
  left: placement.left + "px",
37432
37433
  width: placement.right - placement.left + "px",
37433
37434
  height: placement.bottom - placement.top + "px"
@@ -37470,7 +37471,7 @@ const _sfc_main$b = {
37470
37471
  };
37471
37472
  }
37472
37473
  };
37473
- const CommentsLayer = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-caca3a11"]]);
37474
+ const CommentsLayer = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-13d89078"]]);
37474
37475
  function OrderedMap(content) {
37475
37476
  this.content = content;
37476
37477
  }
@@ -48492,7 +48493,7 @@ const _sfc_main$8 = {
48492
48493
  const superdocStore = useSuperdocStore();
48493
48494
  const commentsStore = useCommentsStore();
48494
48495
  const { COMMENT_EVENTS } = commentsStore;
48495
- const { getConfig, activeComment, pendingComment } = storeToRefs(commentsStore);
48496
+ const { getConfig, activeComment, pendingComment, floatingCommentsOffset } = storeToRefs(commentsStore);
48496
48497
  const { areDocumentsReady } = superdocStore;
48497
48498
  const { selectionPosition } = storeToRefs(superdocStore);
48498
48499
  const { proxy } = getCurrentInstance();
@@ -48567,6 +48568,7 @@ const _sfc_main$8 = {
48567
48568
  };
48568
48569
  const handleClickOutside = (e) => {
48569
48570
  if (activeComment.value === props.data.conversationId) {
48571
+ floatingCommentsOffset.value = 0;
48570
48572
  emit2("dialog-exit");
48571
48573
  if (e.target.dataset.id)
48572
48574
  activeComment.value = e.target.dataset.id;
@@ -48668,7 +48670,7 @@ const _sfc_main$8 = {
48668
48670
  };
48669
48671
  }
48670
48672
  };
48671
- const CommentDialog = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-8a710b97"]]);
48673
+ const CommentDialog = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-25f7474c"]]);
48672
48674
  function useFloatingConveration(params) {
48673
48675
  const id = params.conversationId;
48674
48676
  const conversation = ref(params);
@@ -48718,12 +48720,11 @@ const _sfc_main$7 = {
48718
48720
  const dialog = visibleConversations.value[dialogIndex];
48719
48721
  if (!dialog)
48720
48722
  return;
48721
- const containerBounds = floatingCommentsContainer.value.getBoundingClientRect();
48722
48723
  const selectionBounds = dialog.conversation.selection.getContainerLocation(props.parent);
48723
48724
  const position = elementRef.value.getBoundingClientRect();
48724
48725
  const selection = dialog.conversation.selection.selectionBounds;
48725
- const top = selection.top + position.top + selectionBounds.top - containerBounds.top;
48726
- const left = selection.left + position.left;
48726
+ const top = parseFloat(selection.top) + selectionBounds.top;
48727
+ const left = parseFloat(selection.left) + position.left;
48727
48728
  dialog.position = {
48728
48729
  top,
48729
48730
  left,
@@ -48745,7 +48746,7 @@ const _sfc_main$7 = {
48745
48746
  const topComparison = proposedPosition.top < previousPosition.bottom;
48746
48747
  if (topComparison) {
48747
48748
  const height = proposedPosition.bottom - proposedPosition.top;
48748
- const newTop = previousPosition.bottom + 2;
48749
+ const newTop = previousPosition.bottom + 5;
48749
48750
  currentItem.offset = newTop - proposedPosition.top;
48750
48751
  updatedPosition.top = newTop;
48751
48752
  updatedPosition.bottom = updatedPosition.top + height;
@@ -48779,10 +48780,8 @@ const _sfc_main$7 = {
48779
48780
  const conversations = [...firstDoc.conversations];
48780
48781
  sortedConversations.value = conversations.sort(sortByLocation);
48781
48782
  visibleConversations.value.push(useFloatingConveration(sortedConversations.value[0]));
48782
- if (!activeComment.value)
48783
- floatingCommentsOffset.value = 0;
48784
48783
  };
48785
- const getPosition = (convo) => {
48784
+ const getCommentPosition = (convo) => {
48786
48785
  return {
48787
48786
  top: convo.position.top + "px"
48788
48787
  };
@@ -48792,11 +48791,7 @@ const _sfc_main$7 = {
48792
48791
  marginTop: floatingCommentsOffset.value * (-1 / 2) + "px"
48793
48792
  };
48794
48793
  });
48795
- watch(documentsWithConverations, (newVal) => {
48796
- if (!newVal.length)
48797
- return;
48798
- initialize();
48799
- });
48794
+ watch(documentsWithConverations, (newVal) => newVal.length && initialize());
48800
48795
  onMounted(() => {
48801
48796
  initialize();
48802
48797
  });
@@ -48812,22 +48807,24 @@ const _sfc_main$7 = {
48812
48807
  class: "sidebar-container"
48813
48808
  }, [
48814
48809
  (openBlock(true), createElementBlock(Fragment$1, null, renderList(unref(visibleConversations), (floatingConversation) => {
48815
- return openBlock(), createBlock(CommentDialog, {
48816
- class: "floating-comment",
48817
- onReady: handleDialogReady,
48818
- onDialogExit: initialize,
48819
- style: normalizeStyle(getPosition(floatingConversation)),
48820
- data: floatingConversation.conversation,
48821
- "current-document": __props.currentDocument,
48822
- user: unref(user)
48823
- }, null, 8, ["style", "data", "current-document", "user"]);
48810
+ return openBlock(), createElementBlock("div", null, [
48811
+ createVNode(CommentDialog, {
48812
+ class: "floating-comment",
48813
+ onReady: handleDialogReady,
48814
+ onDialogExit: initialize,
48815
+ style: normalizeStyle(getCommentPosition(floatingConversation)),
48816
+ data: floatingConversation.conversation,
48817
+ "current-document": __props.currentDocument,
48818
+ user: unref(user)
48819
+ }, null, 8, ["style", "data", "current-document", "user"])
48820
+ ]);
48824
48821
  }), 256))
48825
48822
  ], 4)
48826
48823
  ], 512)) : createCommentVNode("", true);
48827
48824
  };
48828
48825
  }
48829
48826
  };
48830
- const FloatingComments = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-0e8a08a9"]]);
48827
+ const FloatingComments = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-858cd0cf"]]);
48831
48828
  const _sfc_main$6 = {
48832
48829
  __name: "TextField",
48833
48830
  props: {
@@ -52137,94 +52134,92 @@ const _sfc_main = {
52137
52134
  document.removeEventListener("mousedown", handleDocumentMouseDown);
52138
52135
  });
52139
52136
  return (_ctx, _cache) => {
52140
- return openBlock(), createElementBlock("div", null, [
52141
- createBaseVNode("div", _hoisted_1, [
52142
- createBaseVNode("div", {
52143
- class: "layers",
52144
- ref_key: "layers",
52145
- ref: layers
52137
+ return openBlock(), createElementBlock("div", _hoisted_1, [
52138
+ createBaseVNode("div", {
52139
+ class: "layers",
52140
+ ref_key: "layers",
52141
+ ref: layers
52142
+ }, [
52143
+ toolsMenuPosition.value && !unref(getConfig)?.readOnly ? (openBlock(), createElementBlock("div", {
52144
+ key: 0,
52145
+ class: "tools",
52146
+ style: normalizeStyle(toolsMenuPosition.value)
52146
52147
  }, [
52147
- toolsMenuPosition.value && !unref(getConfig)?.readOnly ? (openBlock(), createElementBlock("div", {
52148
+ createBaseVNode("i", {
52149
+ class: "fas fa-comment-alt-lines",
52150
+ "data-id": "is-tool",
52151
+ onClick: _cache[0] || (_cache[0] = withModifiers(($event) => handleToolClick("comments"), ["stop", "prevent"]))
52152
+ })
52153
+ ], 4)) : createCommentVNode("", true),
52154
+ !unref(getConfig)?.readOnly && unref(selectionPosition) ? (openBlock(), createElementBlock("div", {
52155
+ key: 1,
52156
+ style: normalizeStyle(unref(selectionPosition)),
52157
+ class: "sd-highlight sd-initial-highlight"
52158
+ }, null, 4)) : createCommentVNode("", true),
52159
+ createBaseVNode("div", _hoisted_2, [
52160
+ "hrbr-fields" in unref(modules) && layers.value ? (openBlock(), createBlock(HrbrFieldsLayer, {
52148
52161
  key: 0,
52149
- class: "tools",
52150
- style: normalizeStyle(toolsMenuPosition.value)
52151
- }, [
52152
- createBaseVNode("i", {
52153
- class: "fas fa-comment-alt-lines",
52154
- "data-id": "is-tool",
52155
- onClick: _cache[0] || (_cache[0] = withModifiers(($event) => handleToolClick("comments"), ["stop", "prevent"]))
52156
- })
52157
- ], 4)) : createCommentVNode("", true),
52158
- !unref(getConfig)?.readOnly && unref(selectionPosition) ? (openBlock(), createElementBlock("div", {
52162
+ fields: unref(modules)["hrbr-fields"],
52163
+ class: "comments-layer",
52164
+ style: { "z-index": "5", "background-color": "blue" },
52165
+ ref_key: "hrbrFieldsLayer",
52166
+ ref: hrbrFieldsLayer
52167
+ }, null, 8, ["fields"])) : createCommentVNode("", true),
52168
+ unref(isReady) && "comments" in unref(modules) && layers.value ? (openBlock(), createBlock(CommentsLayer, {
52159
52169
  key: 1,
52160
- style: normalizeStyle(unref(selectionPosition)),
52161
- class: "sd-highlight sd-initial-highlight"
52162
- }, null, 4)) : createCommentVNode("", true),
52163
- createBaseVNode("div", _hoisted_2, [
52164
- "hrbr-fields" in unref(modules) && layers.value ? (openBlock(), createBlock(HrbrFieldsLayer, {
52165
- key: 0,
52166
- fields: unref(modules)["hrbr-fields"],
52167
- class: "comments-layer",
52168
- style: { "z-index": "5", "background-color": "blue" },
52169
- ref_key: "hrbrFieldsLayer",
52170
- ref: hrbrFieldsLayer
52171
- }, null, 8, ["fields"])) : createCommentVNode("", true),
52172
- unref(isReady) && "comments" in unref(modules) && layers.value ? (openBlock(), createBlock(CommentsLayer, {
52173
- key: 1,
52174
- class: "comments-layer",
52175
- style: { "z-index": "3" },
52176
- ref_key: "commentsLayer",
52177
- ref: commentsLayer,
52178
- parent: layers.value,
52179
- user: unref(user),
52180
- onHighlightClick: handleHighlightClick
52181
- }, null, 8, ["parent", "user"])) : createCommentVNode("", true),
52182
- (openBlock(true), createElementBlock(Fragment$1, null, renderList(unref(documents), (doc2) => {
52183
- return openBlock(), createElementBlock("div", {
52184
- class: "sub-document",
52185
- ref_for: true,
52186
- ref_key: "documentContainers",
52187
- ref: documentContainers
52188
- }, [
52189
- doc2.type === "pdf" ? (openBlock(), createBlock(_sfc_main$c, {
52190
- key: 0,
52191
- "document-data": doc2,
52192
- onSelectionChange: handleSelectionChange,
52193
- onSelectionDrag: handleSelectionDrag,
52194
- onSelectionDragEnd: handleSelectionDragEnd,
52195
- onReady: handlePdfReady,
52196
- onPageLoaded: unref(handlePageReady)
52197
- }, null, 8, ["document-data", "onPageLoaded"])) : createCommentVNode("", true),
52198
- doc2.type === "docx" ? (openBlock(), createBlock(DocumentEditor, {
52199
- key: 1,
52200
- "document-data": doc2,
52201
- onReady: handlePdfReady
52202
- }, null, 8, ["document-data"])) : createCommentVNode("", true)
52203
- ], 512);
52204
- }), 256))
52205
- ])
52206
- ], 512),
52207
- (unref(pendingComment) || unref(documentsWithConverations).length) && layers.value && unref(isReady) ? (openBlock(), createElementBlock("div", _hoisted_3, [
52208
- unref(pendingComment) ? (openBlock(), createBlock(CommentDialog, {
52209
- key: 0,
52210
- data: unref(pendingComment),
52211
- "current-document": unref(getDocument2)(unref(pendingComment).documentId),
52170
+ class: "comments-layer",
52171
+ style: { "z-index": "3" },
52172
+ ref_key: "commentsLayer",
52173
+ ref: commentsLayer,
52174
+ parent: layers.value,
52212
52175
  user: unref(user),
52213
- parent: layers.value
52214
- }, null, 8, ["data", "current-document", "user", "parent"])) : createCommentVNode("", true),
52215
- (openBlock(true), createElementBlock(Fragment$1, null, renderList(unref(documentsWithConverations), (doc2) => {
52216
- return openBlock(), createBlock(FloatingComments, {
52217
- parent: layers.value,
52218
- "current-document": doc2
52219
- }, null, 8, ["parent", "current-document"]);
52176
+ onHighlightClick: handleHighlightClick
52177
+ }, null, 8, ["parent", "user"])) : createCommentVNode("", true),
52178
+ (openBlock(true), createElementBlock(Fragment$1, null, renderList(unref(documents), (doc2) => {
52179
+ return openBlock(), createElementBlock("div", {
52180
+ class: "sub-document",
52181
+ ref_for: true,
52182
+ ref_key: "documentContainers",
52183
+ ref: documentContainers
52184
+ }, [
52185
+ doc2.type === "pdf" ? (openBlock(), createBlock(_sfc_main$c, {
52186
+ key: 0,
52187
+ "document-data": doc2,
52188
+ onSelectionChange: handleSelectionChange,
52189
+ onSelectionDrag: handleSelectionDrag,
52190
+ onSelectionDragEnd: handleSelectionDragEnd,
52191
+ onReady: handlePdfReady,
52192
+ onPageLoaded: unref(handlePageReady)
52193
+ }, null, 8, ["document-data", "onPageLoaded"])) : createCommentVNode("", true),
52194
+ doc2.type === "docx" ? (openBlock(), createBlock(DocumentEditor, {
52195
+ key: 1,
52196
+ "document-data": doc2,
52197
+ onReady: handlePdfReady
52198
+ }, null, 8, ["document-data"])) : createCommentVNode("", true)
52199
+ ], 512);
52220
52200
  }), 256))
52221
- ])) : createCommentVNode("", true)
52222
- ])
52201
+ ])
52202
+ ], 512),
52203
+ (unref(pendingComment) || unref(documentsWithConverations).length) && layers.value && unref(isReady) ? (openBlock(), createElementBlock("div", _hoisted_3, [
52204
+ unref(pendingComment) ? (openBlock(), createBlock(CommentDialog, {
52205
+ key: 0,
52206
+ data: unref(pendingComment),
52207
+ "current-document": unref(getDocument2)(unref(pendingComment).documentId),
52208
+ user: unref(user),
52209
+ parent: layers.value
52210
+ }, null, 8, ["data", "current-document", "user", "parent"])) : createCommentVNode("", true),
52211
+ (openBlock(true), createElementBlock(Fragment$1, null, renderList(unref(documentsWithConverations), (doc2) => {
52212
+ return openBlock(), createBlock(FloatingComments, {
52213
+ parent: layers.value,
52214
+ "current-document": doc2
52215
+ }, null, 8, ["parent", "current-document"]);
52216
+ }), 256))
52217
+ ])) : createCommentVNode("", true)
52223
52218
  ]);
52224
52219
  };
52225
52220
  }
52226
52221
  };
52227
- const App = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-014ab368"]]);
52222
+ const App = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-49e265f8"]]);
52228
52223
  const createMyApp = () => {
52229
52224
  const app = createApp(App);
52230
52225
  const pinia = createPinia();