mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-03 03:46:37 +01:00 
			
		
		
		
	fix tab title of deleted note
This commit is contained in:
		@@ -24,7 +24,6 @@ import NoteRevisionsWidget from "../widgets/collapsible_widgets/note_revisions.j
 | 
				
			|||||||
import SimilarNotesWidget from "../widgets/collapsible_widgets/similar_notes.js";
 | 
					import SimilarNotesWidget from "../widgets/collapsible_widgets/similar_notes.js";
 | 
				
			||||||
import WhatLinksHereWidget from "../widgets/collapsible_widgets/what_links_here.js";
 | 
					import WhatLinksHereWidget from "../widgets/collapsible_widgets/what_links_here.js";
 | 
				
			||||||
import SidePaneToggles from "../widgets/side_pane_toggles.js";
 | 
					import SidePaneToggles from "../widgets/side_pane_toggles.js";
 | 
				
			||||||
import appContext from "../services/app_context.js";
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
const RIGHT_PANE_CSS = `
 | 
					const RIGHT_PANE_CSS = `
 | 
				
			||||||
<style>
 | 
					<style>
 | 
				
			||||||
@@ -117,6 +116,7 @@ export default class DesktopMainWindowLayout {
 | 
				
			|||||||
                .hideInZenMode())
 | 
					                .hideInZenMode())
 | 
				
			||||||
            .child(new FlexContainer('row')
 | 
					            .child(new FlexContainer('row')
 | 
				
			||||||
                .collapsible()
 | 
					                .collapsible()
 | 
				
			||||||
 | 
					                .filling()
 | 
				
			||||||
                .child(new SidePaneContainer('left')
 | 
					                .child(new SidePaneContainer('left')
 | 
				
			||||||
                    .hideInZenMode()
 | 
					                    .hideInZenMode()
 | 
				
			||||||
                    .child(new GlobalButtonsWidget())
 | 
					                    .child(new GlobalButtonsWidget())
 | 
				
			||||||
@@ -153,4 +153,4 @@ export default class DesktopMainWindowLayout {
 | 
				
			|||||||
                .child(new SidePaneToggles().hideInZenMode())
 | 
					                .child(new SidePaneToggles().hideInZenMode())
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -30,6 +30,11 @@ class BasicWidget extends Component {
 | 
				
			|||||||
        return this;
 | 
					        return this;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    filling() {
 | 
				
			||||||
 | 
					        this.css('flex-grow', '1');
 | 
				
			||||||
 | 
					        return this;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    hideInZenMode() {
 | 
					    hideInZenMode() {
 | 
				
			||||||
        this.class('hide-in-zen-mode');
 | 
					        this.class('hide-in-zen-mode');
 | 
				
			||||||
        return this;
 | 
					        return this;
 | 
				
			||||||
@@ -109,4 +114,4 @@ class BasicWidget extends Component {
 | 
				
			|||||||
    cleanup() {}
 | 
					    cleanup() {}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export default BasicWidget;
 | 
					export default BasicWidget;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -602,18 +602,22 @@ export default class TabRowWidget extends BasicWidget {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    updateTab($tab, note) {
 | 
					    updateTab($tab, note) {
 | 
				
			||||||
        if (!note || !$tab.length) {
 | 
					        if (!$tab.length) {
 | 
				
			||||||
            return;
 | 
					            return;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        this.updateTitle($tab, note.title);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        for (const clazz of Array.from($tab[0].classList)) { // create copy to safely iterate over while removing classes
 | 
					        for (const clazz of Array.from($tab[0].classList)) { // create copy to safely iterate over while removing classes
 | 
				
			||||||
            if (clazz !== 'note-tab') {
 | 
					            if (clazz !== 'note-tab') {
 | 
				
			||||||
                $tab.removeClass(clazz);
 | 
					                $tab.removeClass(clazz);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (!note) {
 | 
				
			||||||
 | 
					            this.updateTitle($tab, 'New tab');
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        this.updateTitle($tab, note.title);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $tab.addClass(note.getCssClass());
 | 
					        $tab.addClass(note.getCssClass());
 | 
				
			||||||
        $tab.addClass(utils.getNoteTypeClass(note.type));
 | 
					        $tab.addClass(utils.getNoteTypeClass(note.type));
 | 
				
			||||||
        $tab.addClass(utils.getMimeTypeClass(note.mime));
 | 
					        $tab.addClass(utils.getMimeTypeClass(note.mime));
 | 
				
			||||||
@@ -636,4 +640,4 @@ export default class TabRowWidget extends BasicWidget {
 | 
				
			|||||||
            this.updateTab($tab, tabContext.note);
 | 
					            this.updateTab($tab, tabContext.note);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user