fix: improve download button visibility and add DOCX export
Some checks failed
Test / rust-fmt-check (push) Has been cancelled
Test / rust-clippy (push) Has been cancelled
Test / rust-tests (push) Has been cancelled
Test / frontend-typecheck (push) Has been cancelled
Test / frontend-tests (push) Has been cancelled
Auto Tag / auto-tag (push) Has been cancelled
Some checks failed
Test / rust-fmt-check (push) Has been cancelled
Test / rust-clippy (push) Has been cancelled
Test / rust-tests (push) Has been cancelled
Test / frontend-typecheck (push) Has been cancelled
Test / frontend-tests (push) Has been cancelled
Auto Tag / auto-tag (push) Has been cancelled
1. Download Button Visibility: - Changed from variant=outline to default variant (solid background) - Provides better contrast and icon visibility in both themes - Removed unnecessary text-foreground class 2. DOCX Export Support: - Added DOCX export via pandoc conversion - Writes temp markdown file, converts with pandoc, cleans up - Returns clear error if pandoc not installed - Supports same workflow as MD/PDF exports 3. Triaging Status Investigation: - triaging status is defined in schema and used in dashboard counts - Currently not automatically set when entering triage - Kept in filter dropdown as part of the data model Tested: Rust compilation, TypeScript types, Rust formatting Note: DOCX export requires pandoc to be installed on the system. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
952cf4fe27
commit
6602fd7cd2
@ -201,6 +201,39 @@ pub async fn export_document(
|
||||
.map_err(|e| e.to_string())?;
|
||||
path.to_string_lossy().to_string()
|
||||
}
|
||||
"docx" => {
|
||||
// DOCX export via pandoc
|
||||
let md_path = base_dir.join(format!("{safe_title}_temp.md"));
|
||||
let docx_path = base_dir.join(format!("{safe_title}.docx"));
|
||||
|
||||
// Write markdown to temp file
|
||||
std::fs::write(&md_path, &content_md)
|
||||
.map_err(|e| format!("Failed to write temp markdown: {}", e))?;
|
||||
|
||||
// Use pandoc to convert
|
||||
let output = std::process::Command::new("pandoc")
|
||||
.arg(md_path.to_str().unwrap())
|
||||
.arg("-o")
|
||||
.arg(docx_path.to_str().unwrap())
|
||||
.arg("-f")
|
||||
.arg("markdown")
|
||||
.arg("-t")
|
||||
.arg("docx")
|
||||
.output()
|
||||
.map_err(|e| format!("Failed to run pandoc (is it installed?): {}", e))?;
|
||||
|
||||
// Clean up temp file
|
||||
let _ = std::fs::remove_file(&md_path);
|
||||
|
||||
if !output.status.success() {
|
||||
return Err(format!(
|
||||
"Pandoc conversion failed: {}",
|
||||
String::from_utf8_lossy(&output.stderr)
|
||||
));
|
||||
}
|
||||
|
||||
docx_path.to_string_lossy().to_string()
|
||||
}
|
||||
_ => return Err(format!("Unsupported export format: {format}")),
|
||||
};
|
||||
|
||||
|
||||
@ -53,16 +53,16 @@ export function DocEditor({ content, onChange, version, updatedAt, onExport }: D
|
||||
)}
|
||||
{onExport && (
|
||||
<div className="flex items-center gap-1">
|
||||
<Button size="sm" variant="outline" onClick={() => onExport("md")}>
|
||||
<Button size="sm" onClick={() => onExport("md")}>
|
||||
<FileText className="w-3 h-3 mr-1" />
|
||||
MD
|
||||
</Button>
|
||||
<Button size="sm" variant="outline" onClick={() => onExport("pdf")}>
|
||||
<Download className="w-3 h-3 mr-1 text-foreground" />
|
||||
<Button size="sm" onClick={() => onExport("pdf")}>
|
||||
<Download className="w-3 h-3 mr-1" />
|
||||
PDF
|
||||
</Button>
|
||||
<Button size="sm" variant="outline" onClick={() => onExport("docx")}>
|
||||
<Download className="w-3 h-3 mr-1 text-foreground" />
|
||||
<Button size="sm" onClick={() => onExport("docx")}>
|
||||
<Download className="w-3 h-3 mr-1" />
|
||||
DOCX
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user