show comments corresponding to current file
This commit is contained in:
parent
0d7d8e3f59
commit
cd9de2572a
3 changed files with 59 additions and 56 deletions
|
|
@ -13,6 +13,7 @@ export const useDialogStore = defineStore('dialog', () => {
|
|||
file.comments ? file.comments : []
|
||||
);
|
||||
}
|
||||
if (!openedFile.value) return [];
|
||||
return openedFile.value.comments;
|
||||
});
|
||||
|
||||
|
|
@ -68,7 +69,8 @@ export const useDialogStore = defineStore('dialog', () => {
|
|||
}
|
||||
});
|
||||
watch(openedFile, (newVal, oldVal) => {
|
||||
if (!isCommentsOpen.value || !oldVal || newVal.url == oldVal.url) return;
|
||||
if (!isCommentsOpen.value || !newVal || !oldVal || newVal.url == oldVal.url)
|
||||
return;
|
||||
|
||||
isViewerDisabled.value = true;
|
||||
|
||||
|
|
@ -82,12 +84,11 @@ export const useDialogStore = defineStore('dialog', () => {
|
|||
});
|
||||
|
||||
function setCommentMarkers() {
|
||||
if (!comments.value) return;
|
||||
if (!comments.value || !openedFile.value) return;
|
||||
comments.value.forEach((comment) => {
|
||||
const correspondingMarker = document.querySelector(
|
||||
`.comment-marker[href="#comment-${comment.id}"]`
|
||||
);
|
||||
console.log(openedFile.value);
|
||||
if (comment.location.file.uuid !== openedFile.value.uuid) return;
|
||||
if (comment.type === 'comment-reply') return;
|
||||
if (correspondingMarker) return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue