diff --git a/backend/main.py b/backend/main.py index 4218bda..6e53ec1 100644 --- a/backend/main.py +++ b/backend/main.py @@ -1455,6 +1455,14 @@ async def api_diagnostics(current_user=Depends(require_admin)): if FRONTEND_DIR.exists(): app.mount("/static", StaticFiles(directory=str(FRONTEND_DIR)), name="static") + @app.get("/popout/{vault_name}/{path:path}") + async def serve_popout(vault_name: str, path: str): + """Serve the minimalist popout page for a specific file.""" + popout_file = FRONTEND_DIR / "popout.html" + if popout_file.exists(): + return HTMLResponse(content=popout_file.read_text(encoding="utf-8")) + raise HTTPException(status_code=404, detail="Popout template not found") + @app.get("/{full_path:path}") async def serve_spa(full_path: str): """Serve the SPA index.html for all non-API routes.""" diff --git a/frontend/app.js b/frontend/app.js index f35cc28..f9e29ab 100644 --- a/frontend/app.js +++ b/frontend/app.js @@ -2179,9 +2179,8 @@ document.createTextNode("Nouvelle fenêtre"), ]); openNewWindowBtn.addEventListener("click", () => { - const currentUrl = window.location.origin + window.location.pathname; - const fileUrl = `${currentUrl}?popup=true#file=${encodeURIComponent(data.vault)}:${encodeURIComponent(data.path)}`; - window.open(fileUrl, '_blank', 'menubar=no,toolbar=no,location=no,status=no,width=1000,height=800'); + const popoutUrl = `/popout/${encodeURIComponent(data.vault)}/${encodeURIComponent(data.path)}`; + window.open(popoutUrl, `popout_${data.vault}_${data.path.replace(/[^a-zA-Z0-9]/g, '_')}`, 'width=1000,height=700,menubar=no,toolbar=no,location=no,status=no,resizable=yes,scrollbars=no'); }); // Frontmatter diff --git a/frontend/popout.html b/frontend/popout.html new file mode 100644 index 0000000..f755876 --- /dev/null +++ b/frontend/popout.html @@ -0,0 +1,138 @@ + + +
+ + +