improve comments system

This commit is contained in:
isUnknown 2025-01-28 09:37:33 +01:00
parent 8bb4f552cd
commit e55eb48f45
5 changed files with 63 additions and 41 deletions

View file

@ -6,6 +6,7 @@
:src="openedFile.url"
local="fr_FR"
@loaded="onPdfLoaded"
ref="vpvRef"
/>
<button
id="toggle-comments"
@ -23,18 +24,17 @@
<script setup>
import Comments from "../comments/Comments.vue";
import { ref, watch } from "vue";
import { computed, ref, watch } from "vue";
import { useDialogStore } from "../../stores/dialog";
import { storeToRefs } from "pinia";
import { VPdfViewer, useLicense } from "@vue-pdf-viewer/viewer";
import { useRoute, useRouter } from "vue-router";
const licenseKey = import.meta.env.VITE_VPV_LICENSE ?? 'd0ab730a-ebba-4060-856c-76d322565645';
const licenseKey =
import.meta.env.VITE_VPV_LICENSE ?? "d0ab730a-ebba-4060-856c-76d322565645";
useLicense({ licenseKey });
const { openedFile, isCommentsOpen, comments, draftComment } = storeToRefs(
useDialogStore()
);
const { openedFile, isCommentsOpen, vpvRef } = storeToRefs(useDialogStore());
const { resetCommentMarkers } = useDialogStore();
const currentPageIndex = ref(1);
@ -46,6 +46,9 @@ const onPdfLoaded = () => {
(entries) => {
entries.forEach((entry, index) => {
if (entry.intersectionRatio > 0.5) {
if (isCommentsOpen.value) {
resetCommentMarkers();
}
currentPageIndex.value = parseInt(
entry.target.getAttribute("aria-label").split(" ")[1]
);