From 397f1b4b80fdc9b532772fc62c601dc5a792b9b9 Mon Sep 17 00:00:00 2001 From: Bruno Charest Date: Wed, 22 Oct 2025 14:56:44 -0400 Subject: [PATCH] docs: remove legacy implementation docs in French --- README.md | 6 ++ .../EDITOR_IMPLEMENTATION_SUMMARY.md | 0 .../Nimbus_Interface/THEMING_STATUS.md | 0 .../PROPERTIES_POPOVER_IMPLEMENTATION.md | 0 package-lock.json | 8 +-- package.json | 2 +- src/app.component.ts | 19 ++++--- .../app/constants/help-note.content.ts | 37 +++++++++++- .../sidebar/app-sidebar-drawer.component.ts | 10 ++-- .../sidebar/nimbus-sidebar.component.ts | 10 ++-- src/env.d.ts | 12 ++++ src/services/vault.service.ts | 57 +++++++++++++++++++ src/types/custom.d.ts | 5 ++ src/utils/file-utils.ts | 17 ++++++ vault/.trash/archive/archived-note.md | 3 +- vault/.trash/archive/archived-note.md.bak | 7 +-- vault/HOME.md | 11 +++- vault/HOME.md.bak | 27 +++++++-- vault/Nouveau-markdown.md | 3 +- vault/Nouveau-markdown.md.bak | 3 +- vault/folder-4/test.md | 17 ++++++ vault/folder-4/test.md.bak | 0 vault/folder-4/test2.md | 17 ++++++ vault/folder-4/test2.md.bak | 0 vault/folder-5/file-5.md | 22 +++++++ vault/folder-5/file-5.md.bak | 22 +++++++ vault/help.md.bak | 36 ------------ vite.config.ts | 3 +- 28 files changed, 275 insertions(+), 79 deletions(-) rename EDITOR_IMPLEMENTATION_SUMMARY.md => docs/EDITOR_IMPLEMENTATION_SUMMARY.md (100%) rename THEMING_STATUS.md => docs/PROMPTS/Nimbus_Interface/THEMING_STATUS.md (100%) rename PROPERTIES_POPOVER_IMPLEMENTATION.md => docs/PROPERTIES_POPOVER_IMPLEMENTATION.md (100%) rename vault/help.md => src/app/constants/help-note.content.ts (50%) create mode 100644 src/env.d.ts create mode 100644 src/types/custom.d.ts create mode 100644 src/utils/file-utils.ts create mode 100644 vault/folder-4/test.md create mode 100644 vault/folder-4/test.md.bak create mode 100644 vault/folder-4/test2.md create mode 100644 vault/folder-4/test2.md.bak create mode 100644 vault/folder-5/file-5.md create mode 100644 vault/folder-5/file-5.md.bak diff --git a/README.md b/README.md index c01b0b1..9975f9b 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,12 @@ ObsiViewer est une application web **Angular 20** moderne et performante qui per - 📱 Accès mobile optimisé à votre base de connaissances - 🔍 Exploration visuelle des liens entre vos notes - 📊 Analyse du vault via graphe et statistiques +- 🎨 Thèmes personnalisables +- 📚 Support des notes Excalidraw +- 📝 Support des notes Markdown +- 📝 Mode Lecture et Édition +- 📝 Mode Dark et Light +- 📝 Mode Mobile et Desktop > 📝 Mode démo par défaut : l'interface fonctionne avec des données générées par `VaultService`. Connectez-la à vos fichiers Markdown réels via le serveur Express pour une utilisation complète. diff --git a/EDITOR_IMPLEMENTATION_SUMMARY.md b/docs/EDITOR_IMPLEMENTATION_SUMMARY.md similarity index 100% rename from EDITOR_IMPLEMENTATION_SUMMARY.md rename to docs/EDITOR_IMPLEMENTATION_SUMMARY.md diff --git a/THEMING_STATUS.md b/docs/PROMPTS/Nimbus_Interface/THEMING_STATUS.md similarity index 100% rename from THEMING_STATUS.md rename to docs/PROMPTS/Nimbus_Interface/THEMING_STATUS.md diff --git a/PROPERTIES_POPOVER_IMPLEMENTATION.md b/docs/PROPERTIES_POPOVER_IMPLEMENTATION.md similarity index 100% rename from PROPERTIES_POPOVER_IMPLEMENTATION.md rename to docs/PROPERTIES_POPOVER_IMPLEMENTATION.md diff --git a/package-lock.json b/package-lock.json index 2f130fe..95c31e0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -86,7 +86,7 @@ "@tailwindcss/typography": "^0.5.15", "@types/jasmine": "^5.1.9", "@types/jest": "^30.0.0", - "@types/node": "^22.14.0", + "@types/node": "^22.18.12", "@types/react": "^18.3.10", "@types/react-dom": "^18.3.0", "autocannon": "^7.15.0", @@ -6963,9 +6963,9 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "22.18.8", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.18.8.tgz", - "integrity": "sha512-pAZSHMiagDR7cARo/cch1f3rXy0AEXwsVsVH09FcyeJVAzCnGgmYis7P3JidtTUjyadhTeSo8TgRPswstghDaw==", + "version": "22.18.12", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.18.12.tgz", + "integrity": "sha512-BICHQ67iqxQGFSzfCFTT7MRQ5XcBjG5aeKh5Ok38UBbPe5fxTyE+aHFxwVrGyr8GNlqFMLKD1D3P2K/1ks8tog==", "devOptional": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index 6e49971..eb5c765 100644 --- a/package.json +++ b/package.json @@ -103,7 +103,7 @@ "@tailwindcss/typography": "^0.5.15", "@types/jasmine": "^5.1.9", "@types/jest": "^30.0.0", - "@types/node": "^22.14.0", + "@types/node": "^22.18.12", "@types/react": "^18.3.10", "@types/react-dom": "^18.3.0", "autocannon": "^7.15.0", diff --git a/src/app.component.ts b/src/app.component.ts index 6984158..04eb894 100644 --- a/src/app.component.ts +++ b/src/app.component.ts @@ -879,15 +879,16 @@ export class AppComponent implements OnInit, OnDestroy { } async openHelpPage(): Promise { - // Load the help.md file from the vault - const helpPath = 'help.md'; - await this.vaultService.ensureNoteLoadedByPath(helpPath); - const helpNoteId = this.vaultService.buildSlugIdFromPath(helpPath); - const helpNote = this.vaultService.getNoteById(helpNoteId); - - if (helpNote) { - this.selectNote(helpNote.id); - this.logService.log('HELP_PAGE_OPEN'); + try { + // Load the built-in help note (embedded in app code) + const helpNoteId = await this.vaultService.loadBuiltinHelpNote(); + if (helpNoteId) { + await this.selectNote(helpNoteId); + this.logService.log('HELP_PAGE_OPEN'); + } + } catch (error) { + console.error('Failed to open help page:', error); + // L'erreur est déjà loguée dans la console pour le débogage } } diff --git a/vault/help.md b/src/app/constants/help-note.content.ts similarity index 50% rename from vault/help.md rename to src/app/constants/help-note.content.ts index 3aff179..11b96bf 100644 --- a/vault/help.md +++ b/src/app/constants/help-note.content.ts @@ -1,4 +1,6 @@ ---- +// Contenu par défaut si le chargement du fichier échoue +export const DEFAULT_HELP_CONTENT = +`--- titre: Guide d'utilisateur auteur: Bruno Charest creation_date: 2025-10-21 @@ -10,7 +12,7 @@ tags: aliases: [] status: publié publish: false -favoris: false +favoris: true template: false task: false archive: false @@ -40,4 +42,33 @@ Ce guide vous aidera à comprendre les principales fonctionnalités : --- -💡 **Astuce :** vous pouvez mettre à jour ce guide directement depuis votre voute Markdown. +💡 **Astuce :** vous pouvez mettre à jour ce guide directement depuis votre voute Markdown.`; + +// Variable pour stocker le contenu du fichier help.md +let helpContent: string | null = null; + +// Fonction pour charger le contenu du fichier help.md +export async function loadHelpContent(): Promise { + if (helpContent) return helpContent; + + try { + // En mode développement, on utilise fetch pour charger le fichier + if (import.meta.env.DEV) { + const response = await fetch('/src/app/constants/help.md'); + if (response.ok) { + helpContent = await response.text(); + return helpContent; + } + } + + // En cas d'échec ou en production, utiliser le contenu par défaut + helpContent = DEFAULT_HELP_CONTENT; + return helpContent; + } catch (error) { + console.error('Erreur lors du chargement du fichier help.md:', error); + return DEFAULT_HELP_CONTENT; + } +} + +// Pour la rétrocompatibilité, on exporte une promesse qui se résout avec le contenu +export const HELP_NOTE_RAW = DEFAULT_HELP_CONTENT; diff --git a/src/app/features/sidebar/app-sidebar-drawer.component.ts b/src/app/features/sidebar/app-sidebar-drawer.component.ts index e75a7e3..9e8be80 100644 --- a/src/app/features/sidebar/app-sidebar-drawer.component.ts +++ b/src/app/features/sidebar/app-sidebar-drawer.component.ts @@ -33,7 +33,7 @@ import { TrashExplorerComponent } from '../../layout/sidebar/trash/trash-explore
@@ -49,7 +49,7 @@ import { TrashExplorerComponent } from '../../layout/sidebar/trash/trash-explore
@@ -61,7 +61,7 @@ import { TrashExplorerComponent } from '../../layout/sidebar/trash/trash-explore
@@ -73,7 +73,7 @@ import { TrashExplorerComponent } from '../../layout/sidebar/trash/trash-explore
@@ -93,7 +93,7 @@ import { TrashExplorerComponent } from '../../layout/sidebar/trash/trash-explore
diff --git a/src/app/features/sidebar/nimbus-sidebar.component.ts b/src/app/features/sidebar/nimbus-sidebar.component.ts index 01db22d..52afa2f 100644 --- a/src/app/features/sidebar/nimbus-sidebar.component.ts +++ b/src/app/features/sidebar/nimbus-sidebar.component.ts @@ -27,7 +27,7 @@ import { VaultService } from '../../../services/vault.service';
@@ -43,7 +43,7 @@ import { VaultService } from '../../../services/vault.service';
@@ -55,7 +55,7 @@ import { VaultService } from '../../../services/vault.service';
@@ -73,7 +73,7 @@ import { VaultService } from '../../../services/vault.service';
@@ -93,7 +93,7 @@ import { VaultService } from '../../../services/vault.service';
diff --git a/src/env.d.ts b/src/env.d.ts new file mode 100644 index 0000000..be6f15e --- /dev/null +++ b/src/env.d.ts @@ -0,0 +1,12 @@ +/// + +interface ImportMetaEnv { + readonly MODE: 'development' | 'production'; + readonly DEV: boolean; + readonly PROD: boolean; + // add other environment variables here as needed +} + +interface ImportMeta { + readonly env: ImportMetaEnv; +} diff --git a/src/services/vault.service.ts b/src/services/vault.service.ts index 6830070..2b6df18 100644 --- a/src/services/vault.service.ts +++ b/src/services/vault.service.ts @@ -4,6 +4,7 @@ import { Note, VaultNode, GraphData, TagInfo, VaultFolder, FileMetadata } from ' import { VaultEventsService, VaultEventPayload } from './vault-events.service'; import { Subscription, firstValueFrom } from 'rxjs'; import { rewriteTagsFrontmatter, rewriteBooleanFrontmatter } from '../app/shared/markdown/markdown-frontmatter.util'; +import { DEFAULT_HELP_CONTENT } from '../app/constants/help-note.content'; // ============================================================================ // INTERFACES @@ -191,6 +192,52 @@ export class VaultService implements OnDestroy { return this.notesMap().get(id); } + /** + * Load the built-in help note content into the in-memory notes map. + * This loads the help content from the embedded file. + * Returns a promise that resolves with the id (slug) of the registered note. + */ + async loadBuiltinHelpNote(): Promise { + const slugId = this.buildSlugIdFromPath('help.md'); // "help" + if (this.getNoteById(slugId)) return slugId; + + try { + // Load help content from embedded constant + const rawContent = DEFAULT_HELP_CONTENT; + + const normalizedContent = this.normalizeLineEndings(rawContent); + const { frontmatter, body } = this.parseFrontmatter(normalizedContent); + + const title = (frontmatter.title as string) || (frontmatter.titre as string) || 'Guide utilisateur'; + const nowIso = new Date().toISOString(); + const createdAt = typeof frontmatter.creation_date === 'string' ? frontmatter.creation_date : nowIso; + const updatedAt = typeof frontmatter.modification_date === 'string' ? frontmatter.modification_date : nowIso; + const tags = Array.isArray(frontmatter.tags) ? this.normalizeTags(frontmatter.tags as string[]) : []; + + const note: Note = { + id: slugId, + title, + content: body, + rawContent: normalizedContent, + tags, + frontmatter, + backlinks: [], + mtime: Date.now(), + fileName: 'help.md', + filePath: 'assets/help/help.md', + originalPath: 'help', + createdAt, + updatedAt, + }; + + this.registerBuiltinNote(note); + return slugId; + } catch (error) { + console.error('Failed to load built-in help note:', error); + throw new Error('Impossible de charger le guide d\'aide'); + } + } + async ensureNoteLoadedById(id: string): Promise { if (!id || this.getNoteById(id)) return !!id; @@ -677,7 +724,9 @@ export class VaultService implements OnDestroy { this.refreshTimeoutId = setTimeout(() => { this.refreshTimeoutId = null; + // Refresh notes contents and also reload the fast file tree to reflect new/removed folders this.refreshNotes(); + this.loadFastFileTree(); }, REFRESH_DEBOUNCE_MS); } @@ -1257,6 +1306,14 @@ export class VaultService implements OnDestroy { this.notesMap.set(current); } + /** Register a builtin (virtual) note without touching file indices. */ + private registerBuiltinNote(note: Note): void { + // Do not update fast indices that rely on physical paths + const current = new Map(this.notesMap()); + current.set(note.id, note); + this.notesMap.set(current); + } + private updateNoteInMap(note: Note, updates: Partial): void { const updated: Note = { ...note, ...updates }; const mapCopy = new Map(this.notesMap()); diff --git a/src/types/custom.d.ts b/src/types/custom.d.ts new file mode 100644 index 0000000..5e722c8 --- /dev/null +++ b/src/types/custom.d.ts @@ -0,0 +1,5 @@ +// Déclaration de type pour les imports bruts de fichiers .md +declare module '*.md?raw' { + const content: string; + export default content; +} diff --git a/src/utils/file-utils.ts b/src/utils/file-utils.ts new file mode 100644 index 0000000..a984ae0 --- /dev/null +++ b/src/utils/file-utils.ts @@ -0,0 +1,17 @@ +/** + * Charge le contenu d'un fichier en utilisant fetch + * @param url URL du fichier à charger + * @returns Contenu du fichier sous forme de chaîne + */ +export async function loadFileContent(url: string): Promise { + try { + const response = await fetch(url); + if (!response.ok) { + throw new Error(`Erreur lors du chargement du fichier: ${response.statusText}`); + } + return await response.text(); + } catch (error) { + console.error('Erreur lors du chargement du fichier:', error); + throw error; + } +} diff --git a/vault/.trash/archive/archived-note.md b/vault/.trash/archive/archived-note.md index 3bd2206..53e1370 100644 --- a/vault/.trash/archive/archived-note.md +++ b/vault/.trash/archive/archived-note.md @@ -5,9 +5,8 @@ creation_date: 2025-10-19T11:13:12-04:00 modification_date: 2025-10-19T12:09:46-04:00 catégorie: "" tags: + - bruno - configuration - - test - - tag3 aliases: [] status: en-cours publish: true diff --git a/vault/.trash/archive/archived-note.md.bak b/vault/.trash/archive/archived-note.md.bak index 3bd2206..a99adc2 100644 --- a/vault/.trash/archive/archived-note.md.bak +++ b/vault/.trash/archive/archived-note.md.bak @@ -4,10 +4,6 @@ auteur: Bruno Charest creation_date: 2025-10-19T11:13:12-04:00 modification_date: 2025-10-19T12:09:46-04:00 catégorie: "" -tags: - - configuration - - test - - tag3 aliases: [] status: en-cours publish: true @@ -17,6 +13,9 @@ task: true archive: false draft: false private: false +tags: + - bruno + - configuration --- # Archived Note diff --git a/vault/HOME.md b/vault/HOME.md index 502313b..1266ff2 100644 --- a/vault/HOME.md +++ b/vault/HOME.md @@ -9,10 +9,13 @@ tags: - accueil - configuration - test + - tag4 + - tag3 + - tag1 aliases: [] status: en-cours -publish: false -favoris: false +publish: true +favoris: true template: false task: false archive: false @@ -23,9 +26,11 @@ NomDeVoute: IT Description: Page d'accueil de la voute IT attachements-path: attachements/ --- -Page principal - IT +Page principal - Voute de test [[Voute_IT.png]] +Ceci est la voute Obsidian de test. Elle permet de tester l'application ObsiViewer. + [[test]] [[test2]] diff --git a/vault/HOME.md.bak b/vault/HOME.md.bak index f49e933..91d2315 100644 --- a/vault/HOME.md.bak +++ b/vault/HOME.md.bak @@ -1,17 +1,36 @@ --- -Titre: Page d'accueil -NomDeVoute: IT -Description: Page d'accueil de la voute IT +titre: HOME +auteur: Bruno Charest +creation_date: 2025-09-26T08:20:57-04:00 +modification_date: 2025-10-19T12:09:47-04:00 +catégorie: "" tags: - home - accueil - configuration - test + - tag4 + - tag3 + - tag1 +aliases: [] +status: en-cours +publish: false +favoris: true +template: false +task: false +archive: false +draft: false +private: false +Titre: Page d'accueil +NomDeVoute: IT +Description: Page d'accueil de la voute IT attachements-path: attachements/ --- -Page principal - IT +Page principal - Voute de test [[Voute_IT.png]] +Ceci est la voute Obsidian de test. Elle permet de tester l'application ObsiViewer. + [[test]] [[test2]] diff --git a/vault/Nouveau-markdown.md b/vault/Nouveau-markdown.md index c08bc70..8eb9200 100644 --- a/vault/Nouveau-markdown.md +++ b/vault/Nouveau-markdown.md @@ -9,13 +9,14 @@ tags: aliases: - nouveau status: en-cours -publish: true +publish: false favoris: true template: true task: true archive: true draft: true private: true +toto: tata --- Allo ceci est un tests toto diff --git a/vault/Nouveau-markdown.md.bak b/vault/Nouveau-markdown.md.bak index ef5c322..649cd01 100644 --- a/vault/Nouveau-markdown.md.bak +++ b/vault/Nouveau-markdown.md.bak @@ -10,12 +10,13 @@ aliases: - nouveau status: en-cours publish: true -favoris: false +favoris: true template: true task: true archive: true draft: true private: true +toto: tata --- Allo ceci est un tests toto diff --git a/vault/folder-4/test.md b/vault/folder-4/test.md new file mode 100644 index 0000000..e362101 --- /dev/null +++ b/vault/folder-4/test.md @@ -0,0 +1,17 @@ +--- +titre: test +auteur: Bruno Charest +creation_date: 2025-10-22T13:07:03-04:00 +modification_date: 2025-10-22T13:07:04-04:00 +catégorie: "" +tags: [] +aliases: [] +status: en-cours +publish: false +favoris: false +template: false +task: false +archive: false +draft: false +private: false +--- diff --git a/vault/folder-4/test.md.bak b/vault/folder-4/test.md.bak new file mode 100644 index 0000000..e69de29 diff --git a/vault/folder-4/test2.md b/vault/folder-4/test2.md new file mode 100644 index 0000000..5acf09d --- /dev/null +++ b/vault/folder-4/test2.md @@ -0,0 +1,17 @@ +--- +titre: test2 +auteur: Bruno Charest +creation_date: 2025-10-22T13:07:29-04:00 +modification_date: 2025-10-22T13:07:29-04:00 +catégorie: "" +tags: [] +aliases: [] +status: en-cours +publish: false +favoris: false +template: false +task: false +archive: false +draft: false +private: false +--- diff --git a/vault/folder-4/test2.md.bak b/vault/folder-4/test2.md.bak new file mode 100644 index 0000000..e69de29 diff --git a/vault/folder-5/file-5.md b/vault/folder-5/file-5.md new file mode 100644 index 0000000..ea9e7b3 --- /dev/null +++ b/vault/folder-5/file-5.md @@ -0,0 +1,22 @@ +--- +titre: file-5 +auteur: Bruno Charest +creation_date: 2025-10-22T13:26:59-04:00 +modification_date: 2025-10-22T13:26:59-04:00 +catégorie: "" +tags: + - configuration + - tag2 + - bruno + - test2 + - tag3 +aliases: [] +status: en-cours +publish: false +favoris: false +template: false +task: false +archive: false +draft: false +private: false +--- diff --git a/vault/folder-5/file-5.md.bak b/vault/folder-5/file-5.md.bak new file mode 100644 index 0000000..547a8a2 --- /dev/null +++ b/vault/folder-5/file-5.md.bak @@ -0,0 +1,22 @@ +--- +titre: file-5 +auteur: Bruno Charest +creation_date: 2025-10-22T13:26:59-04:00 +modification_date: 2025-10-22T13:26:59-04:00 +catégorie: "" +aliases: [] +status: en-cours +publish: false +favoris: false +template: false +task: false +archive: false +draft: false +private: false +tags: + - configuration + - tag2 + - bruno + - test2 + - tag3 +--- diff --git a/vault/help.md.bak b/vault/help.md.bak index 27667ec..e69de29 100644 --- a/vault/help.md.bak +++ b/vault/help.md.bak @@ -1,36 +0,0 @@ ---- -titre: Guide d'utilisateur -auteur: Bruno Charest -creation_date: 2025-10-21 -modification_date: 2025-10-21 -catégorie: documentation -tags: - - aide - - guide -status: publié ---- - -# 🧭 Guide d'utilisateur ObsiViewer - -Bienvenue dans **ObsiViewer** ! - -Ce guide vous aidera à comprendre les principales fonctionnalités : - -## 📂 Navigation -- La barre latérale permet d'accéder aux notes, favoris, tags et modèles. -- Les boutons en haut à droite donnent accès au mode édition, plein écran, et propriétés. - -## ✏️ Édition -- Le bouton ✏️ ouvre le **mode édition** basé sur CodeMirror 6. -- Toutes les modifications sont sauvegardées automatiquement. - -## 🏷️ Tags -- Cliquez sur un tag pour voir toutes les notes qui le contiennent. -- Utilisez l'icône 🏷️ à gauche pour modifier ou ajouter des tags. - -## ⚙️ Paramètres -- Les thèmes, langues et préférences sont gérés depuis le menu principal. - ---- - -💡 **Astuce :** vous pouvez mettre à jour ce guide directement depuis votre voute Markdown. diff --git a/vite.config.ts b/vite.config.ts index 287e808..bdfd8f5 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -35,4 +35,5 @@ export default defineConfig(({ mode }) => ({ ssr: { noExternal: ['@excalidraw/excalidraw'], }, -})); +}) +);