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",
scale: 2
});
await triggerDownload(`${nameWithoutExtension}.svg`, result.url);
triggerDownload(`${nameWithoutExtension}.svg`, result.url);
} finally {
cleanup();
}

View File

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

View File

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