From 08c70b4dccdc5fec851da48f8400c63a8dc13b08 Mon Sep 17 00:00:00 2001 From: buttercheezii <buttercheezii@gmail.com> Date: Mon, 6 Dec 2021 06:08:17 -0800 Subject: [PATCH] allow pinning on trackpad + respect allowJs --- bbcode/UrlTagView.vue | 11 ++++++++--- chat/preview/ImagePreview.vue | 2 ++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/bbcode/UrlTagView.vue b/bbcode/UrlTagView.vue index af5557c..74dec9f 100644 --- a/bbcode/UrlTagView.vue +++ b/bbcode/UrlTagView.vue @@ -7,7 +7,7 @@ rel="nofollow noreferrer noopener" target="_blank" class="user-link" - @click="handleClick()" + @click="handleClick" @mouseover.prevent="show()" @mouseenter.prevent="show()" @mouseleave.prevent="dismiss()" @@ -66,8 +66,13 @@ EventBus.$emit('imagepreview-toggle-stickyness', {url: this.url}); } - handleClick(): void { - this.dismiss(true); + handleClick(e: MouseEvent): void { + if (e.altKey) { + this.toggleStickyness(); + e.preventDefault(); + } else { + this.dismiss(true); + } } } </script> diff --git a/chat/preview/ImagePreview.vue b/chat/preview/ImagePreview.vue index 5f78229..bc76f8f 100644 --- a/chat/preview/ImagePreview.vue +++ b/chat/preview/ImagePreview.vue @@ -560,6 +560,8 @@ async executeJavaScript(js: string | undefined, context: string = 'unknown', logDetails?: any): Promise<any> { + if (!this.runJs) return; + const webview = this.getWebview(); if (!js) {