mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
small fixes
This commit is contained in:
parent
6ae8508413
commit
18ffcf7880
@ -61,10 +61,17 @@ class Branch extends AbstractEntity {
|
|||||||
const childNote = this.childNote;
|
const childNote = this.childNote;
|
||||||
const parentNote = this.parentNote;
|
const parentNote = this.parentNote;
|
||||||
|
|
||||||
|
if (!childNote.parents.includes(parentNote)) {
|
||||||
childNote.parents.push(parentNote);
|
childNote.parents.push(parentNote);
|
||||||
childNote.parentBranches.push(this);
|
}
|
||||||
|
|
||||||
|
if (!childNote.parentBranches.includes(this)) {
|
||||||
|
childNote.parentBranches.push(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!parentNote.children.includes(childNote)) {
|
||||||
parentNote.children.push(childNote);
|
parentNote.children.push(childNote);
|
||||||
|
}
|
||||||
|
|
||||||
this.becca.branches[this.branchId] = this;
|
this.becca.branches[this.branchId] = this;
|
||||||
this.becca.childParentToBranch[`${this.noteId}-${this.parentNoteId}`] = this;
|
this.becca.childParentToBranch[`${this.noteId}-${this.parentNoteId}`] = this;
|
||||||
|
@ -389,13 +389,13 @@ export default class TabManager extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async removeAllTabsCommand() {
|
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);
|
await this.removeNoteContext(ntxIdToRemove);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async removeAllTabsExceptForThisCommand({ntxId}) {
|
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) {
|
if (ntxIdToRemove !== ntxId) {
|
||||||
await this.removeNoteContext(ntxIdToRemove);
|
await this.removeNoteContext(ntxIdToRemove);
|
||||||
}
|
}
|
||||||
|
@ -3,19 +3,15 @@ const sanitizeHtml = require('sanitize-html');
|
|||||||
// intended mainly as protection against XSS via import
|
// intended mainly as protection against XSS via import
|
||||||
// secondarily it (partly) protects against "CSS takeover"
|
// secondarily it (partly) protects against "CSS takeover"
|
||||||
function sanitize(dirtyHtml) {
|
function sanitize(dirtyHtml) {
|
||||||
|
|
||||||
// avoid H1 per https://github.com/zadam/trilium/issues/1552
|
// avoid H1 per https://github.com/zadam/trilium/issues/1552
|
||||||
// demote H1, and if that conflicts with existing H2, demote that, etc
|
// demote H1, and if that conflicts with existing H2, demote that, etc
|
||||||
let transformTags = {};
|
const transformTags = {};
|
||||||
const loweraseHtml = dirtyHtml.toLowerCase();
|
const lowercasedHtml = dirtyHtml.toLowerCase();
|
||||||
for (let i = 1; i < 6; ++i)
|
for (let i = 1; i < 6; ++i) {
|
||||||
{
|
if (lowercasedHtml.includes(`<h${i}`)) {
|
||||||
if (loweraseHtml.includes(`<h${i}`))
|
transformTags[`h${i}`] = `h${i + 1}`;
|
||||||
{
|
|
||||||
transformTags[`h${i}`] = `h${i+1}`;
|
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user