Fix image viewer with back button, join message spacing

This commit is contained in:
Max Leiter 2022-06-01 09:02:40 -07:00
parent 7b24050de9
commit d42232ab77
No known key found for this signature in database
GPG key ID: A3512F2F2F17EBDA
3 changed files with 14 additions and 13 deletions

View file

@ -98,16 +98,6 @@ export default defineComponent({
link.value = null;
};
onBeforeRouteLeave((to, from, next) => {
next();
// cancel the navigation if the user is trying to close the image viewer
if (link.value) {
closeViewer();
return false;
}
});
const setPrevNextImages = () => {
if (!channel.value || !link.value) {
return null;

View file

@ -142,6 +142,7 @@ import {
ref,
watch,
} from "vue";
import {onBeforeRouteUpdate} from "vue-router";
import eventbus from "../js/eventbus";
import friendlysize from "../js/helpers/friendlysize";
import {useStore} from "../js/store";
@ -168,6 +169,16 @@ export default defineComponent({
const isContentShown = ref(false);
const imageViewer = inject(imageViewerKey);
onBeforeRouteUpdate((to, from, next) => {
// cancel the navigation if the user is trying to close the image viewer
if (imageViewer?.value?.link) {
imageViewer.value.closeViewer();
return next(false);
}
next();
});
const content = ref<HTMLDivElement | null>(null);
const container = ref<HTMLDivElement | null>(null);

View file

@ -1,12 +1,12 @@
<template>
<span class="content">
<Username :user="message.from" />
<i class="hostmask"> (<ParsedMessage :network="network" :text="message.hostmask" />)</i>
<i class="hostmask"> (<ParsedMessage :network="network" :text="message.hostmask" />) </i>
<template v-if="message.account">
<i class="account"> [{{ message.account }}]</i>
<i class="account">[{{ message.account }}]</i>
</template>
<template v-if="message.gecos">
<i class="realname"> {{ message.gecos }}</i>
<i class="realname">{{ message.gecos }}</i>
</template>
has joined the channel
</span>