mirror of
https://github.com/thelounge/thelounge.git
synced 2024-06-01 13:22:29 +02:00
Fix image viewer with back button, join message spacing
This commit is contained in:
parent
7b24050de9
commit
d42232ab77
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue