Support custom output path for PDF previews and add styling for concept actions
This commit is contained in:
@@ -1303,6 +1303,7 @@ def preview_pdf(payload: Dict[str, Any]) -> Dict[str, Any]:
|
|||||||
concept_text = (payload.get("concept") or "").strip()
|
concept_text = (payload.get("concept") or "").strip()
|
||||||
title = (payload.get("title") or "").strip()
|
title = (payload.get("title") or "").strip()
|
||||||
files = payload.get("files") or []
|
files = payload.get("files") or []
|
||||||
|
output_path = (payload.get("output_path") or "").strip()
|
||||||
if not concept_text:
|
if not concept_text:
|
||||||
raise RuntimeError("Concept text is empty")
|
raise RuntimeError("Concept text is empty")
|
||||||
|
|
||||||
@@ -1328,7 +1329,15 @@ def preview_pdf(payload: Dict[str, Any]) -> Dict[str, Any]:
|
|||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
pdf_path = base / f"{slug}-preview.pdf"
|
if output_path:
|
||||||
|
pdf_path = Path(output_path).expanduser()
|
||||||
|
if pdf_path.exists() and pdf_path.is_dir():
|
||||||
|
raise RuntimeError(f"Output path is a directory: {pdf_path}")
|
||||||
|
if pdf_path.suffix.lower() != ".pdf":
|
||||||
|
pdf_path = Path(f"{pdf_path}.pdf")
|
||||||
|
else:
|
||||||
|
pdf_path = base / f"{slug}-preview.pdf"
|
||||||
|
|
||||||
ok, log_path = _convert_markdown_to_pdf(md_path, pdf_path)
|
ok, log_path = _convert_markdown_to_pdf(md_path, pdf_path)
|
||||||
return {
|
return {
|
||||||
"ok": ok,
|
"ok": ok,
|
||||||
|
|||||||
@@ -203,6 +203,10 @@ button.remove-row-button {
|
|||||||
gap: 8px;
|
gap: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.concept-actions {
|
||||||
|
justify-content: flex-end;
|
||||||
|
}
|
||||||
|
|
||||||
button {
|
button {
|
||||||
border: 1px solid var(--accent);
|
border: 1px solid var(--accent);
|
||||||
border-radius: var(--control-radius);
|
border-radius: var(--control-radius);
|
||||||
|
|||||||
Reference in New Issue
Block a user