fix #138
This commit is contained in:
parent
432f718b14
commit
f34ceb1559
5 changed files with 38 additions and 34 deletions
|
|
@ -15,21 +15,22 @@
|
|||
@click="isCommentsOpen = !isCommentsOpen"
|
||||
>
|
||||
<span class="sr-only"
|
||||
>{{ isCommentsOpen ? "Masquer" : "Afficher" }} les commentaires</span
|
||||
>{{ isCommentsOpen ? 'Masquer' : 'Afficher' }} les commentaires</span
|
||||
>
|
||||
</button>
|
||||
<Comments v-if="isCommentsOpen" />
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import Comments from "../comments/Comments.vue";
|
||||
import { 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";
|
||||
import Comments from '../comments/Comments.vue';
|
||||
import { 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(
|
||||
|
|
@ -40,14 +41,14 @@ const currentPageIndex = ref(1);
|
|||
|
||||
// Functions
|
||||
const onPdfLoaded = () => {
|
||||
const wrapper = document.querySelector(".vpv-pages-inner-container");
|
||||
const wrapper = document.querySelector('.vpv-pages-inner-container');
|
||||
|
||||
const observer = new IntersectionObserver(
|
||||
(entries) => {
|
||||
entries.forEach((entry, index) => {
|
||||
if (entry.intersectionRatio > 0.5) {
|
||||
currentPageIndex.value = parseInt(
|
||||
entry.target.getAttribute("aria-label").split(" ")[1]
|
||||
entry.target.getAttribute('aria-label').split(' ')[1]
|
||||
);
|
||||
}
|
||||
});
|
||||
|
|
@ -59,7 +60,7 @@ const onPdfLoaded = () => {
|
|||
);
|
||||
|
||||
const observePages = () => {
|
||||
const pages = document.querySelectorAll(".vpv-page-inner-container");
|
||||
const pages = document.querySelectorAll('.vpv-page-inner-container');
|
||||
pages.forEach((page) => {
|
||||
if (!page.__observed__) {
|
||||
observer.observe(page);
|
||||
|
|
@ -81,5 +82,5 @@ const onPdfLoaded = () => {
|
|||
</script>
|
||||
|
||||
<style scoped>
|
||||
@import "../../assets/css/src/2.blocks.pdf-viewer.css";
|
||||
@import '../../assets/css/src/2.blocks.pdf-viewer.css';
|
||||
</style>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue