Apply suggestions from code review

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This commit is contained in:
Lucas 2025-12-04 13:08:28 -08:00 committed by GitHub
parent 2d3aa3a96e
commit f976dd8d30
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 4 additions and 4 deletions

View File

@ -688,7 +688,7 @@ async function downloadAsSvg(nameWithoutExtension: string, svgSource: string | S
backgroundColor: "transparent", backgroundColor: "transparent",
scale: 2 scale: 2
}); });
await triggerDownload(`${nameWithoutExtension}.svg`, result.url); triggerDownload(`${nameWithoutExtension}.svg`, result.url);
} finally { } finally {
cleanup(); cleanup();
} }

View File

@ -102,7 +102,7 @@ export default function MindMap({ note, ntxId, noteContext }: TypeWidgetProps) {
// Export as PNG or SVG. // Export as PNG or SVG.
useTriliumEvents([ "exportSvg", "exportPng" ], async ({ ntxId: eventNtxId }, eventName) => { useTriliumEvents([ "exportSvg", "exportPng" ], async ({ ntxId: eventNtxId }, eventName) => {
if (eventNtxId !== ntxId || !apiRef.current) return; if (eventNtxId !== ntxId || !apiRef.current) return;
const nodes = apiRef.current.nodes; const nodes = apiRef.current.nodes;
if (eventName === "exportSvg") { if (eventName === "exportSvg") {
await utils.downloadAsSvg(note.title, nodes); await utils.downloadAsSvg(note.title, nodes);
} else { } else {

View File

@ -83,7 +83,7 @@ export default function SvgSplitEditor({ ntxId, note, attachmentName, renderSvg,
try { try {
const svgEl = containerRef.current?.querySelector("svg"); const svgEl = containerRef.current?.querySelector("svg");
if (!svgEl) throw new Error("SVG element not found"); if (!svgEl) throw new Error("SVG element not found");
await utils.downloadAsSvg(note.title + '.svg', svgEl); await utils.downloadAsSvg(note.title, svgEl);
} catch (e) { } catch (e) {
console.warn(e); console.warn(e);
toast.showError(t("svg.export_to_svg")); toast.showError(t("svg.export_to_svg"));
@ -95,7 +95,7 @@ export default function SvgSplitEditor({ ntxId, note, attachmentName, renderSvg,
try { try {
const svgEl = containerRef.current?.querySelector("svg"); const svgEl = containerRef.current?.querySelector("svg");
if (!svgEl) throw new Error("SVG element not found"); if (!svgEl) throw new Error("SVG element not found");
await utils.downloadAsPng(note.title + '.png', svgEl); await utils.downloadAsPng(note.title, svgEl);
} catch (e) { } catch (e) {
console.warn(e); console.warn(e);
toast.showError(t("svg.export_to_png")); toast.showError(t("svg.export_to_png"));