ObsiViewer/vault/tests/nimbus-editor-snapshot.md
Bruno Charest 2a5047b7f0 ```
feat: redesign code block header with professional action buttons and tabbed menu

- Replaced collapsible header with dedicated action buttons for line numbers, word wrap, and collapse/preview
- Added custom SVG icons for each action button with active/inactive states and hover effects
- Implemented tabbed menu interface with Language/Theme/Font/Options sections replacing vertical scrolling
- Added collapsed preview mode with syntax highlighting using cached highlightedHtml
- Introduced auto-detect language toggle
2025-11-19 17:30:37 -05:00

7.6 KiB

title, nimbusEditor, documentModelFormat
title nimbusEditor documentModelFormat
Éditeur Nimbus — Section Tests true block-model-v1
{
  "id": "block_1763149113471_461xyut80",
  "title": "Page Tests",
  "blocks": [
    {
      "id": "block_1763591049445_1hgsuarl4",
      "type": "code",
      "props": {
        "code": "#!/usr/bin/env pwsh\r\n# Script de démarrage rapide pour ObsiViewer en mode développement\r\n\r\nparam(\r\n    [string]$VaultPath = \"./vault\",\r\n    [switch]$SkipMeili,\r\n    [switch]$ResetMeili,\r\n    [switch]$Help\r\n)\r\n\r\nif ($Help) {\r\n    Write-Host @\"\r\nUsage: .\\start-dev.ps1 [-VaultPath <path>] [-SkipMeili] [-Help]\r\n\r\nOptions:\r\n  -VaultPath <path>  Chemin vers votre vault Obsidian (défaut: ./vault)\r\n  -SkipMeili         Ne pas démarrer Meilisearch\r\n  -ResetMeili        Supprimer le conteneur et le volume Meilisearch avant de redémarrer\r\n  -SkipMeili         Ne pas démarrer Meilisearch\r\n  -Help              Afficher cette aide\r\n\r\nExemples:\r\n  .\\start-dev.ps1\r\n  .\\start-dev.ps1 -VaultPath C:\\Users\\moi\\Documents\\MonVault\r\n  .\\start-dev.ps1 -SkipMeili\r\n\"@\r\n    exit 0\r\n}\r\n\r\n$ErrorActionPreference = \"Stop\"\r\n\r\nWrite-Host \"🚀 Démarrage d'ObsiViewer en mode développement\" -ForegroundColor Cyan\r\nWrite-Host \"\"\r\n\r\n# Diagnostic: Vérifier les variables Meilisearch existantes\r\n$meiliVars = Get-ChildItem Env: | Where-Object { $_.Name -like 'MEILI*' }\r\nif ($meiliVars) {\r\n    Write-Host \"⚠️  Variables Meilisearch détectées dans l'environnement:\" -ForegroundColor Yellow\r\n    foreach ($var in $meiliVars) {\r\n        Write-Host \"   $($var.Name) = $($var.Value)\" -ForegroundColor Gray\r\n    }\r\n    Write-Host \"   Ces variables seront purgées...\" -ForegroundColor Yellow\r\n    Write-Host \"\"\r\n}\r\n\r\n# Vérifier que le vault existe\r\nif (-not (Test-Path $VaultPath)) {\r\n    Write-Host \"⚠️  Le vault n'existe pas: $VaultPath\" -ForegroundColor Yellow\r\n    Write-Host \"   Création du dossier...\" -ForegroundColor Yellow\r\n    New-Item -ItemType Directory -Path $VaultPath -Force | Out-Null\r\n}\r\n\r\n$VaultPathAbsolute = Resolve-Path $VaultPath\r\nWrite-Host \"📁 Vault: $VaultPathAbsolute\" -ForegroundColor Green\r\n\r\n# Vérifier si .env existe\r\nif (-not (Test-Path \".env\")) {\r\n    Write-Host \"⚠️  Fichier .env manquant\" -ForegroundColor Yellow\r\n    if (Test-Path \".env.example\") {\r\n        Write-Host \"   Copie de .env.example vers .env...\" -ForegroundColor Yellow\r\n        Copy-Item \".env.example\" \".env\"\r\n    }\r\n}\r\n\r\n# Purger TOUTES les variables d'environnement Meilisearch conflictuelles\r\n$meiliVarsToPurge = Get-ChildItem Env: | Where-Object { $_.Name -like 'MEILI*' }\r\nif ($meiliVarsToPurge) {\r\n    Write-Host \"🧹 Purge des variables Meilisearch existantes...\" -ForegroundColor Cyan\r\n    foreach ($var in $meiliVarsToPurge) {\r\n        Remove-Item \"Env:\\$($var.Name)\" -ErrorAction SilentlyContinue\r\n        Write-Host \"   ✓ $($var.Name) supprimée\" -ForegroundColor Gray\r\n    }\r\n    Write-Host \"\"\r\n}\r\n\r\n# Définir les variables d'environnement pour la session\r\n$env:VAULT_PATH = $VaultPathAbsolute\r\n$env:MEILI_MASTER_KEY = \"devMeiliKey123\"\r\n$env:MEILI_HOST = \"http://127.0.0.1:7700\"\r\n$env:PORT = \"4000\"\r\n\r\nWrite-Host \"✅ Variables d'environnement définies:\" -ForegroundColor Green\r\nWrite-Host \"   VAULT_PATH=$env:VAULT_PATH\" -ForegroundColor Gray\r\nWrite-Host \"   MEILI_MASTER_KEY=devMeiliKey123\" -ForegroundColor Gray\r\nWrite-Host \"   MEILI_HOST=$env:MEILI_HOST\" -ForegroundColor Gray\r\n\r\n# Démarrer Meilisearch si demandé\r\nif (-not $SkipMeili) {\r\n    Write-Host \"\"\r\n    Write-Host \"🔍 Démarrage de Meilisearch...\" -ForegroundColor Cyan\r\n    \r\n    if ($ResetMeili) {\r\n        Write-Host \"🧹 Réinitialisation de Meilisearch (conteneur + volume)...\" -ForegroundColor Yellow\r\n        try {\r\n            Push-Location \"docker-compose\"\r\n            docker compose down -v meilisearch 2>$null | Out-Null\r\n            Pop-Location\r\n        } catch {\r\n            Pop-Location 2>$null\r\n        }\r\n        # Forcer la suppression ciblée si nécessaire\r\n        docker rm -f obsiviewer-meilisearch 2>$null | Out-Null\r\n        docker volume rm -f docker-compose_meili_data 2>$null | Out-Null\r\n    }\r\n\r\n    # Vérifier si Meilisearch est déjà en cours\r\n    $meiliRunning = docker ps --filter \"name=obsiviewer-meilisearch\" --format \"{{.Names}}\" 2>$null\r\n    \r\n    if ($meiliRunning) {\r\n        Write-Host \"   ✓ Meilisearch déjà en cours\" -ForegroundColor Green\r\n    } else {\r\n        npm run meili:up\r\n        Write-Host \"   ⏳ Attente du démarrage de Meilisearch...\" -ForegroundColor Yellow\r\n    }\r\n    \r\n    # Attendre la santé du service /health\r\n    $healthTimeoutSec = 30\r\n    $healthUrl = \"http://127.0.0.1:7700/health\"\r\n    $startWait = Get-Date\r\n    while ($true) {\r\n        try {\r\n            $resp = Invoke-RestMethod -Uri $healthUrl -Method GET -TimeoutSec 3\r\n            if ($resp.status -eq \"available\") {\r\n                Write-Host \"   ✓ Meilisearch est prêt\" -ForegroundColor Green\r\n                break\r\n            }\r\n        } catch {\r\n            # ignore and retry\r\n        }\r\n        if (((Get-Date) - $startWait).TotalSeconds -ge $healthTimeoutSec) {\r\n            Write-Host \"   ⚠️  Timeout d'attente de Meilisearch (continuer quand même)\" -ForegroundColor Yellow\r\n            break\r\n        }\r\n        Start-Sleep -Milliseconds 500\r\n    }\r\n\r\n    Write-Host \"\"\r\n    Write-Host \"📊 Indexation du vault...\" -ForegroundColor Cyan\r\n    npm run meili:reindex\r\n}\r\n\r\nWrite-Host \"\"\r\nWrite-Host \"✅ Configuration terminée!\" -ForegroundColor Green\r\nWrite-Host \"\"\r\nWrite-Host \"Les variables d'environnement sont définies dans cette session PowerShell.\" -ForegroundColor Yellow\r\nWrite-Host \"\"\r\nWrite-Host \"Pour démarrer l'application, ouvrez 2 terminaux:\" -ForegroundColor Yellow\r\nWrite-Host \"\"\r\nWrite-Host \"Terminal 1 (Backend):\" -ForegroundColor Cyan\r\nWrite-Host \"  node server/index.mjs\" -ForegroundColor White\r\nWrite-Host \"  (Les variables VAULT_PATH, MEILI_MASTER_KEY sont déjà définies)\" -ForegroundColor Gray\r\nWrite-Host \"\"\r\nWrite-Host \"Terminal 2 (Frontend):\" -ForegroundColor Cyan\r\nWrite-Host \"  npm run dev\" -ForegroundColor White\r\nWrite-Host \"\"\r\nWrite-Host \"⚠️  IMPORTANT: Si vous fermez ce terminal, les variables seront perdues.\" -ForegroundColor Yellow\r\nWrite-Host \"   Relancez ce script ou définissez manuellement:\" -ForegroundColor Yellow\r\nWrite-Host \"   `$env:VAULT_PATH='$VaultPathAbsolute'\" -ForegroundColor Gray\r\nWrite-Host \"   `$env:MEILI_MASTER_KEY='devMeiliKey123'\" -ForegroundColor Gray\r\nWrite-Host \"   Remove-Item Env:\\MEILI_API_KEY -ErrorAction SilentlyContinue\" -ForegroundColor Gray\r\nWrite-Host \"\"\r\nWrite-Host \"Accès:\" -ForegroundColor Yellow\r\nWrite-Host \"  Frontend:    http://localhost:3000\" -ForegroundColor White\r\nWrite-Host \"  Backend API: http://localhost:4000\" -ForegroundColor White\r\nWrite-Host \"  Meilisearch: http://localhost:7700\" -ForegroundColor White\r\nWrite-Host \"\"\r\n",
        "lang": "powershell",
        "theme": "default",
        "showLineNumbers": true,
        "enableWrap": false,
        "collapsed": true,
        "font": "courier",
        "autoDetectLang": false
      },
      "meta": {
        "createdAt": "2025-11-19T22:24:09.445Z",
        "updatedAt": "2025-11-19T22:29:31.546Z"
      }
    }
  ],
  "meta": {
    "createdAt": "2025-11-14T19:38:33.471Z",
    "updatedAt": "2025-11-19T22:29:31.546Z"
  }
}