fix tab title of deleted note

This commit is contained in:
zadam
2020-05-12 12:45:32 +02:00
parent b063b4c528
commit 30b9ef8604
3 changed files with 16 additions and 7 deletions

View File

@@ -602,18 +602,22 @@ export default class TabRowWidget extends BasicWidget {
}
updateTab($tab, note) {
if (!note || !$tab.length) {
if (!$tab.length) {
return;
}
this.updateTitle($tab, note.title);
for (const clazz of Array.from($tab[0].classList)) { // create copy to safely iterate over while removing classes
if (clazz !== 'note-tab') {
$tab.removeClass(clazz);
}
}
if (!note) {
this.updateTitle($tab, 'New tab');
}
this.updateTitle($tab, note.title);
$tab.addClass(note.getCssClass());
$tab.addClass(utils.getNoteTypeClass(note.type));
$tab.addClass(utils.getMimeTypeClass(note.mime));
@@ -636,4 +640,4 @@ export default class TabRowWidget extends BasicWidget {
this.updateTab($tab, tabContext.note);
}
}
}
}