add / show comments working
This commit is contained in:
parent
a9992b0ff5
commit
6bffbc1707
10 changed files with 163 additions and 40 deletions
|
|
@ -16,7 +16,7 @@
|
|||
<VPdfViewer
|
||||
:darkMode="true"
|
||||
:initialThumbnailsVisible="true"
|
||||
:src="src"
|
||||
:src="file.url"
|
||||
local="fr_FR"
|
||||
@loaded="onPdfLoaded"
|
||||
/>
|
||||
|
|
@ -29,7 +29,12 @@
|
|||
>
|
||||
<span class="sr-only">Afficher les commentaires</span>
|
||||
</button>
|
||||
<Comments v-if="isCommentsOpen" :current-page="currentPage" />
|
||||
<Comments
|
||||
v-if="isCommentsOpen"
|
||||
:current-page-index="currentPageIndex"
|
||||
:file="file"
|
||||
:comments="file.comments"
|
||||
/>
|
||||
</div>
|
||||
</Dialog>
|
||||
</template>
|
||||
|
|
@ -40,8 +45,8 @@ import Comments from "../../comments/Comments.vue";
|
|||
import { VPdfViewer, useLicense } from "@vue-pdf-viewer/viewer";
|
||||
import { ref, watch } from "vue";
|
||||
|
||||
const { src } = defineProps({
|
||||
src: String,
|
||||
const { file } = defineProps({
|
||||
file: Object,
|
||||
});
|
||||
|
||||
const emit = defineEmits("close");
|
||||
|
|
@ -55,7 +60,7 @@ watch(isOpen, (newValue) => {
|
|||
emit("close");
|
||||
});
|
||||
const isCommentsOpen = ref(false);
|
||||
const currentPage = ref(1);
|
||||
const currentPageIndex = ref(1);
|
||||
|
||||
// Functions
|
||||
const onPdfLoaded = () => {
|
||||
|
|
@ -65,7 +70,7 @@ const onPdfLoaded = () => {
|
|||
(entries) => {
|
||||
entries.forEach((entry, index) => {
|
||||
if (entry.intersectionRatio > 0.5) {
|
||||
currentPage.value = parseInt(
|
||||
currentPageIndex.value = parseInt(
|
||||
entry.target.getAttribute("aria-label").split(" ")[1]
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue