viewer: prevent sidebar typing leak (fix #437)

pull/460/head
Varun Patil 2023-02-23 22:18:06 -08:00
parent c9fc7c3c60
commit 6a37009b02
1 changed files with 12 additions and 8 deletions

View File

@ -1029,16 +1029,20 @@ export default defineComponent({
},
handleAppSidebarOpen() {
if (this.show && this.photoswipe) {
const sidebar: HTMLElement =
document.querySelector("aside.app-sidebar");
if (sidebar) {
this.sidebarWidth = sidebar.offsetWidth - 2;
}
if (!(this.show && this.photoswipe)) return;
this.sidebarOpen = true;
this.updateSizeWithoutAnim();
const sidebar: HTMLElement = document.querySelector("aside.app-sidebar");
if (sidebar) {
this.sidebarWidth = sidebar.offsetWidth - 2;
// Stop sidebar typing from leaking to viewer
sidebar.addEventListener("keydown", (e) => {
if (e.key.length === 1) e.stopPropagation();
});
}
this.sidebarOpen = true;
this.updateSizeWithoutAnim();
},
handleAppSidebarClose() {