mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
escape note titles in note map
This commit is contained in:
parent
2cfc43a4fd
commit
affd8062e2
@ -5,6 +5,9 @@ import hoistedNoteService from "../services/hoisted_note.js";
|
|||||||
import appContext from "../components/app_context.js";
|
import appContext from "../components/app_context.js";
|
||||||
import NoteContextAwareWidget from "./note_context_aware_widget.js";
|
import NoteContextAwareWidget from "./note_context_aware_widget.js";
|
||||||
import linkContextMenuService from "../menus/link_context_menu.js";
|
import linkContextMenuService from "../menus/link_context_menu.js";
|
||||||
|
import utils from "../services/utils.js";
|
||||||
|
|
||||||
|
const esc = utils.escapeHtml;
|
||||||
|
|
||||||
const TPL = `<div class="note-map-widget" style="position: relative;">
|
const TPL = `<div class="note-map-widget" style="position: relative;">
|
||||||
<style>
|
<style>
|
||||||
@ -102,7 +105,7 @@ export default class NoteMapWidget extends NoteContextAwareWidget {
|
|||||||
ctx.arc(node.x, node.y, this.noteIdToSizeMap[node.id], 0, 2 * Math.PI, false);
|
ctx.arc(node.x, node.y, this.noteIdToSizeMap[node.id], 0, 2 * Math.PI, false);
|
||||||
ctx.fill();
|
ctx.fill();
|
||||||
})
|
})
|
||||||
.nodeLabel(node => node.name)
|
.nodeLabel(node => esc(node.name))
|
||||||
.maxZoom(7)
|
.maxZoom(7)
|
||||||
.warmupTicks(30)
|
.warmupTicks(30)
|
||||||
.linkDirectionalArrowLength(5)
|
.linkDirectionalArrowLength(5)
|
||||||
@ -114,7 +117,7 @@ export default class NoteMapWidget extends NoteContextAwareWidget {
|
|||||||
|
|
||||||
if (this.mapType === 'link') {
|
if (this.mapType === 'link') {
|
||||||
this.graph
|
this.graph
|
||||||
.linkLabel(l => `${l.source.name} - <strong>${l.name}</strong> - ${l.target.name}`)
|
.linkLabel(l => `${esc(l.source.name)} - <strong>${esc(l.name)}</strong> - ${esc(l.target.name)}`)
|
||||||
.linkCanvasObject((link, ctx) => this.paintLink(link, ctx))
|
.linkCanvasObject((link, ctx) => this.paintLink(link, ctx))
|
||||||
.linkCanvasObjectMode(() => "after");
|
.linkCanvasObjectMode(() => "after");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user