mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
client,server: Set up SVG rendering for mindmap
This commit is contained in:
parent
ad88042e5b
commit
1437df7de1
@ -34,7 +34,7 @@ async function getRenderedContent(entity, options = {}) {
|
||||
else if (type === 'code') {
|
||||
await renderCode(entity, $renderedContent);
|
||||
}
|
||||
else if (type === 'image' || type === 'canvas') {
|
||||
else if (['image', 'canvas', 'mindMap'].includes(type)) {
|
||||
renderImage(entity, $renderedContent, options);
|
||||
}
|
||||
else if (!options.tooltip && ['file', 'pdf', 'audio', 'video'].includes(type)) {
|
||||
|
@ -83,8 +83,18 @@ export default class MindMapWidget extends TypeWidget {
|
||||
return;
|
||||
}
|
||||
|
||||
const svgContent = await this.mind.exportSvg().text();
|
||||
return {
|
||||
content: mind.getDataString()
|
||||
content: mind.getDataString(),
|
||||
attachments: [
|
||||
{
|
||||
role: "image",
|
||||
title: "mindmap-export.svg",
|
||||
mime: "image/svg+xml",
|
||||
content: svgContent,
|
||||
position: 0
|
||||
}
|
||||
]
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ function returnImageInt(image: BNote | BRevision | null, res: Response) {
|
||||
if (!image) {
|
||||
res.set('Content-Type', 'image/png');
|
||||
return res.send(fs.readFileSync(`${RESOURCE_DIR}/db/image-deleted.png`));
|
||||
} else if (!["image", "canvas", "mermaid"].includes(image.type)) {
|
||||
} else if (![ "image", "canvas", "mermaid", "mindMap" ].includes(image.type)) {
|
||||
return res.sendStatus(400);
|
||||
}
|
||||
|
||||
@ -33,6 +33,8 @@ function returnImageInt(image: BNote | BRevision | null, res: Response) {
|
||||
renderSvgAttachment(image, res, 'canvas-export.svg');
|
||||
} else if (image.type === 'mermaid') {
|
||||
renderSvgAttachment(image, res, 'mermaid-export.svg');
|
||||
} else if (image.type === "mindMap") {
|
||||
renderSvgAttachment(image, res, 'mindmap-export.svg');
|
||||
} else {
|
||||
res.set('Content-Type', image.mime);
|
||||
res.set("Cache-Control", "no-cache, no-store, must-revalidate");
|
||||
|
Loading…
x
Reference in New Issue
Block a user