added note name to browser title

This commit is contained in:
Gamosoft 2025-12-29 10:51:50 +01:00
parent 00b5ba0521
commit ecc3c45bee
1 changed files with 13 additions and 0 deletions

View File

@ -478,6 +478,7 @@ function noteApp() {
this.noteContent = ''; this.noteContent = '';
this.currentNoteName = ''; this.currentNoteName = '';
this.outline = []; this.outline = [];
document.title = 'NoteDiscovery';
// Restore homepage folder state if it was saved // Restore homepage folder state if it was saved
if (e.state && e.state.homepageFolder !== undefined) { if (e.state && e.state.homepageFolder !== undefined) {
@ -2147,6 +2148,10 @@ function noteApp() {
this.currentImage = imagePath; this.currentImage = imagePath;
this.viewMode = 'preview'; // Use preview mode to show image this.viewMode = 'preview'; // Use preview mode to show image
// Update browser tab title for image
const imageName = imagePath.split('/').pop();
document.title = `${imageName} - NoteDiscovery`;
// Update browser URL // Update browser URL
if (updateHistory) { if (updateHistory) {
// Encode each path segment to handle special characters // Encode each path segment to handle special characters
@ -2461,6 +2466,7 @@ function noteApp() {
this.currentNote = ''; this.currentNote = '';
this.noteContent = ''; this.noteContent = '';
this.currentImage = ''; this.currentImage = '';
document.title = 'NoteDiscovery';
return; return;
} }
throw new Error(`HTTP error! status: ${response.status}`); throw new Error(`HTTP error! status: ${response.status}`);
@ -2474,6 +2480,9 @@ function noteApp() {
this.noteContent = data.content; this.noteContent = data.content;
this.currentNoteName = notePath.split('/').pop().replace('.md', ''); this.currentNoteName = notePath.split('/').pop().replace('.md', '');
this.currentImage = ''; // Clear image viewer when loading a note this.currentImage = ''; // Clear image viewer when loading a note
// Update browser tab title
document.title = `${this.currentNoteName} - NoteDiscovery`;
this.lastSaved = false; this.lastSaved = false;
// Extract outline for TOC panel // Extract outline for TOC panel
@ -3058,6 +3067,7 @@ function noteApp() {
if (this.currentNote && this.currentNote.startsWith(folderPrefix)) { if (this.currentNote && this.currentNote.startsWith(folderPrefix)) {
this.currentNote = ''; this.currentNote = '';
this.noteContent = ''; this.noteContent = '';
document.title = 'NoteDiscovery';
} }
await this.loadNotes(); await this.loadNotes();
@ -3551,6 +3561,7 @@ function noteApp() {
this.currentNoteName = ''; this.currentNoteName = '';
this._lastRenderedContent = ''; // Clear render cache this._lastRenderedContent = ''; // Clear render cache
this._cachedRenderedHTML = ''; this._cachedRenderedHTML = '';
document.title = 'NoteDiscovery';
// Redirect to root // Redirect to root
window.history.replaceState({}, '', '/'); window.history.replaceState({}, '', '/');
} }
@ -4946,6 +4957,7 @@ function noteApp() {
this.noteContent = ''; this.noteContent = '';
this.currentImage = ''; this.currentImage = '';
this.outline = []; this.outline = [];
document.title = 'NoteDiscovery';
// Invalidate cache to force recalculation // Invalidate cache to force recalculation
this._homepageCache = { this._homepageCache = {
@ -4968,6 +4980,7 @@ function noteApp() {
this.currentImage = ''; this.currentImage = '';
this.outline = []; this.outline = [];
this.mobileSidebarOpen = false; this.mobileSidebarOpen = false;
document.title = 'NoteDiscovery';
// Clear undo/redo history // Clear undo/redo history
this.undoHistory = []; this.undoHistory = [];