Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
small fixes
zadam18ffcf7880ea
diff --git a/src/becca/entities/branch.js b/src/becca/entities/branch.jsindex 003c22df5e..a7ae115ae4 100644--- a/src/becca/entities/branch.js+++ b/src/becca/entities/branch.js@@ -61,10 +61,17 @@ class Branch extends AbstractEntity {const childNote = this.childNote;const parentNote = this.parentNote;- childNote.parents.push(parentNote);- childNote.parentBranches.push(this);+ if (!childNote.parents.includes(parentNote)) {+ childNote.parents.push(parentNote);+ }++ if (!childNote.parentBranches.includes(this)) {+ childNote.parentBranches.push(this);+ }- parentNote.children.push(childNote);+ if (!parentNote.children.includes(childNote)) {+ parentNote.children.push(childNote);+ }this.becca.branches[this.branchId] = this;this.becca.childParentToBranch[`${this.noteId}-${this.parentNoteId}`] = this;diff --git a/src/public/app/services/tab_manager.js b/src/public/app/services/tab_manager.jsindex 0e51864ec1..4ae14dc042 100644--- a/src/public/app/services/tab_manager.js+++ b/src/public/app/services/tab_manager.js@@ -389,13 +389,13 @@ export default class TabManager extends Component {}async removeAllTabsCommand() {- for (const ntxIdToRemove of this.noteContexts.map(nc => nc.ntxId)) {+ for (const ntxIdToRemove of this.mainNoteContexts.map(nc => nc.ntxId)) {await this.removeNoteContext(ntxIdToRemove);}}async removeAllTabsExceptForThisCommand({ntxId}) {- for (const ntxIdToRemove of this.noteContexts.map(nc => nc.ntxId)) {+ for (const ntxIdToRemove of this.mainNoteContexts.map(nc => nc.ntxId)) {if (ntxIdToRemove !== ntxId) {await this.removeNoteContext(ntxIdToRemove);}diff --git a/src/services/html_sanitizer.js b/src/services/html_sanitizer.jsindex 81e88224cd..5af84fbbbc 100644--- a/src/services/html_sanitizer.js+++ b/src/services/html_sanitizer.js@@ -3,19 +3,15 @@ const sanitizeHtml = require('sanitize-html');// intended mainly as protection against XSS via import// secondarily it (partly) protects against "CSS takeover"function sanitize(dirtyHtml) {-// avoid H1 per https://github.com/zadam/trilium/issues/1552// demote H1, and if that conflicts with existing H2, demote that, etc- let transformTags = {};- const loweraseHtml = dirtyHtml.toLowerCase();- for (let i = 1; i < 6; ++i)- {- if (loweraseHtml.includes(`<h${i}`))- {- transformTags[`h${i}`] = `h${i+1}`;+ const transformTags = {};+ const lowercasedHtml = dirtyHtml.toLowerCase();+ for (let i = 1; i < 6; ++i) {+ if (lowercasedHtml.includes(`<h${i}`)) {+ transformTags[`h${i}`] = `h${i + 1}`;}- else- {+ else {break;}}