Skip to content

Build your personal knowledge base with Trilium Notes

fix(options): blinking when downloading a database

Elian Doran93ca135af275
diff --git a/apps/client/src/widgets/type_widgets/options/components/DatabaseFileList.css b/apps/client/src/widgets/type_widgets/options/components/DatabaseFileList.css
deleted file mode 100644
index 6409caf133..0000000000
--- a/apps/client/src/widgets/type_widgets/options/components/DatabaseFileList.css
+++ /dev/null
@@ -1,11 +0,0 @@
-/* The download action is an anchor (for the `download` attribute); without this
- the contained icon button would inherit the link color and look different from
- plain icon-action buttons. The :visited/:hover states must be covered explicitly,
- as the global `a:visited`/`a:hover` color rules have a higher specificity than
- a lone class selector (a previously downloaded file would turn blue again). */
-.database-file-download,
-.database-file-download:visited,
-.database-file-download:hover {
- color: inherit;
- text-decoration: none;
-}
diff --git a/apps/client/src/widgets/type_widgets/options/components/DatabaseFileList.tsx b/apps/client/src/widgets/type_widgets/options/components/DatabaseFileList.tsx
index 84b486c3ee..1e7236c266 100644
--- a/apps/client/src/widgets/type_widgets/options/components/DatabaseFileList.tsx
+++ b/apps/client/src/widgets/type_widgets/options/components/DatabaseFileList.tsx
@@ -1,8 +1,7 @@
-import "./DatabaseFileList.css";
-
import { ComponentChildren } from "preact";
import { useMemo } from "preact/hooks";
+import open from "../../../../services/open";
import { formatSize } from "../../../../services/utils";
import { formatDateTime } from "../../../../utils/formatters";
import ActionButton from "../../../react/ActionButton";
@@ -56,9 +55,11 @@ export default function DatabaseFileList({ title, locationDescription, files, do
label={<span className="selectable-text">{fileName}</span>}
description={`${mtime ? formatDateTime(mtime) : "-"} • ${formatSize(fileSize)}`}
>
- <a className="database-file-download" href={`${downloadEndpoint}?filePath=${encodeURIComponent(filePath)}`} download>
- <ActionButton icon="bx bx-download" text={downloadText} />
- </a>
+ <ActionButton
+ icon="bx bx-download"
+ text={downloadText}
+ onClick={() => open.download(open.getUrlForDownload(`${downloadEndpoint}?filePath=${encodeURIComponent(filePath)}`))}
+ />
</OptionsRow>
))
) : (