fix pageIndex pb

This commit is contained in:
isUnknown 2024-11-19 17:01:58 +01:00
parent 8b9bd9e4ab
commit 5f5c53e284
3 changed files with 35 additions and 13 deletions

View file

@ -156,8 +156,8 @@ Comments:
url: file://3vTh1tMFeFM2JxaN url: file://3vTh1tMFeFM2JxaN
position: position:
pageIndex: 1 pageIndex: 1
x: '27.327777224757' x: "27.327777224757"
y: '78.185328185328' y: "78.185328185328"
replies: [ ] replies: [ ]
text: test198 text: test198
author: author:
@ -169,6 +169,34 @@ Comments:
id: m3omw0ci id: m3omw0ci
type: comment type: comment
isRead: false isRead: false
-
location:
page:
uri: >
projects/miss-dior-blooming-bouquet/proposal
title: Offre commerciale
href: '/projects/miss-dior-blooming-bouquet?dialog=proposal&fileIndex=0#comment-m3omw0ci'
project:
title: Miss Dior Blooming Bouquet
uri: projects/miss-dior-blooming-bouquet
file:
uuid: file://3vTh1tMFeFM2JxaN
url: file://3vTh1tMFeFM2JxaN
position:
pageIndex: 1
x: '34.977005727351'
y: '48.455598455598'
replies: [ ]
text: test1287
author:
name: Adrien Payet
email: adrien.payet@outlook.com
uuid: user://WWjXgPWk
role: admin
date: 2024-11-19T17:01:26+01:00
id: m3on6nfv
type: comment
isRead: false
---- ----

View file

@ -118,7 +118,7 @@ import { useRoute } from "vue-router";
dayjs.locale("fr"); dayjs.locale("fr");
const emits = defineEmits(["show-draft-bubble", "hide-draft-bubble"]); const emits = defineEmits(["show-draft-marker"]);
const { user } = useUserStore(); const { user } = useUserStore();
const { page } = usePageStore(); const { page } = usePageStore();
@ -153,11 +153,8 @@ watch(isAddOpen, (newVal) => {
watch( watch(
draftComment, draftComment,
(newVal) => { (newVal) => {
console.log(newVal.position);
if (newVal.position) { if (newVal.position) {
emits("show-draft-bubble", newVal); emits("show-draft-marker", newVal);
} else {
emits("hide-draft-bubble");
} }
}, },
{ deep: true } { deep: true }
@ -188,7 +185,7 @@ function handleSubmit(event = null) {
date, date,
position: position:
{ {
pageIndex: draftComment.value.pageIndex, pageIndex: draftComment.value.position.pageIndex,
x: draftComment.value.position?.x, x: draftComment.value.position?.x,
y: draftComment.value.position?.y, y: draftComment.value.position?.y,
} ?? false, } ?? false,

View file

@ -30,7 +30,7 @@
> >
<span class="sr-only">Afficher les commentaires</span> <span class="sr-only">Afficher les commentaires</span>
</button> </button>
<Comments v-if="isCommentsOpen" @show-draft-bubble="showDraftBubble" /> <Comments v-if="isCommentsOpen" @show-draft-marker="showDraftMarker" />
</div> </div>
</Dialog> </Dialog>
</template> </template>
@ -76,7 +76,6 @@ watch(isCommentsOpen, (newVal) => {
watch(openedFile, (newVal) => { watch(openedFile, (newVal) => {
removeCommentMarkers(); removeCommentMarkers();
if (newVal.comments) { if (newVal.comments) {
console.log(newVal.comments);
setCommentMarkers(); setCommentMarkers();
} }
}); });
@ -160,8 +159,7 @@ function removeCommentMarkers() {
}); });
} }
function showDraftBubble(draftComment) { function showDraftMarker(draftComment) {
console.log(draftComment);
const bubble = document.createElement("a"); const bubble = document.createElement("a");
bubble.classList.add("comment-marker"); bubble.classList.add("comment-marker");
@ -175,7 +173,6 @@ function showDraftBubble(draftComment) {
); );
container.appendChild(bubble); container.appendChild(bubble);
console.log(container);
} }
</script> </script>