mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
title in fancytree needs to be escaped for HTML special characters
This commit is contained in:
parent
332fc16852
commit
6426157bb3
@ -186,13 +186,15 @@ const noteTree = (function() {
|
|||||||
const noteTreeId = getNoteTreeId(parentNoteId, noteId);
|
const noteTreeId = getNoteTreeId(parentNoteId, noteId);
|
||||||
const noteTree = notesTreeMap[noteTreeId];
|
const noteTree = notesTreeMap[noteTreeId];
|
||||||
|
|
||||||
|
const title = (noteTree.prefix ? (noteTree.prefix + " - ") : "") + noteIdToTitle[noteTree.note_id];
|
||||||
|
|
||||||
const node = {
|
const node = {
|
||||||
note_id: noteTree.note_id,
|
note_id: noteTree.note_id,
|
||||||
parent_note_id: noteTree.parent_note_id,
|
parent_note_id: noteTree.parent_note_id,
|
||||||
note_tree_id: noteTree.note_tree_id,
|
note_tree_id: noteTree.note_tree_id,
|
||||||
is_protected: noteTree.is_protected,
|
is_protected: noteTree.is_protected,
|
||||||
prefix: noteTree.prefix,
|
prefix: noteTree.prefix,
|
||||||
title: (noteTree.prefix ? (noteTree.prefix + " - ") : "") + noteIdToTitle[noteTree.note_id],
|
title: escapeHtml(title),
|
||||||
extraClasses: getExtraClasses(noteTree),
|
extraClasses: getExtraClasses(noteTree),
|
||||||
refKey: noteTree.note_id,
|
refKey: noteTree.note_id,
|
||||||
expanded: noteTree.is_expanded
|
expanded: noteTree.is_expanded
|
||||||
|
@ -37,7 +37,7 @@ const treeUtils = (function() {
|
|||||||
|
|
||||||
const title = (prefix ? (prefix + " - ") : "") + noteTitle;
|
const title = (prefix ? (prefix + " - ") : "") + noteTitle;
|
||||||
|
|
||||||
node.setTitle(title);
|
node.setTitle(escapeHtml(title));
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -94,3 +94,7 @@ function isTopLevelNode(node) {
|
|||||||
function isRootNode(node) {
|
function isRootNode(node) {
|
||||||
return node.key === "root_1";
|
return node.key === "root_1";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function escapeHtml(str) {
|
||||||
|
return $('<div/>').text(str).html();
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user