From bfda6a5c26249a5d48b5bb6c69d254ac5f3960be Mon Sep 17 00:00:00 2001 From: Creation's Date: Sat, 2 Nov 2024 00:18:12 -0400 Subject: [PATCH] fixes(imagePreview): & toggle setting --- src/equicordplugins/imagePreview/index.ts | 8 +++++--- src/equicordplugins/imagePreview/settings.ts | 5 +++++ src/equicordplugins/imagePreview/styles.css | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/equicordplugins/imagePreview/index.ts b/src/equicordplugins/imagePreview/index.ts index 4f77ab6b..486eb737 100644 --- a/src/equicordplugins/imagePreview/index.ts +++ b/src/equicordplugins/imagePreview/index.ts @@ -263,8 +263,10 @@ function loadImagePreview(url: string, sticker: boolean) { fileSize.appendChild(showingSize); } - preview.appendChild(fileName); - preview.appendChild(fileInfo); + if (settings.store.fileInformation) { + preview.appendChild(fileName); + preview.appendChild(fileInfo); + } }); if (loadingSpinner) loadingSpinner.remove(); @@ -287,7 +289,7 @@ function loadImagePreview(url: string, sticker: boolean) { } }); - currentPreview.addEventListener("mouseout", () => { + currentPreviewFile.addEventListener("mouseout", () => { if (currentPreview && !isCtrlHeld && shouldKeepPreviewOpen) { deleteCurrentPreview(); shouldKeepPreviewOpen = false; diff --git a/src/equicordplugins/imagePreview/settings.ts b/src/equicordplugins/imagePreview/settings.ts index d17c1ac0..46b865bb 100644 --- a/src/equicordplugins/imagePreview/settings.ts +++ b/src/equicordplugins/imagePreview/settings.ts @@ -43,6 +43,11 @@ const settings = definePluginSettings({ description: "Fixes the image preview to the initial point of hover", default: false }, + fileInformation: { + type: OptionType.BOOLEAN, + description: "Show file information on hover", + default: true + }, hoverDelay: { type: OptionType.SLIDER, description: "Delay in seconds before the image preview appears", diff --git a/src/equicordplugins/imagePreview/styles.css b/src/equicordplugins/imagePreview/styles.css index d513ec0a..4167d0a3 100644 --- a/src/equicordplugins/imagePreview/styles.css +++ b/src/equicordplugins/imagePreview/styles.css @@ -107,4 +107,4 @@ max-height: 90vh; object-fit: contain; display: none; -} \ No newline at end of file +}