feat: unkown

This commit is contained in:
2025-12-26 15:53:11 +08:00
parent 1226bbe724
commit cffd536fb8
7 changed files with 244 additions and 187 deletions

View File

@@ -1,6 +1,7 @@
import { useState } from 'react';
import { X, Check, Copy, Download, Code2, Image as ImageIcon, FileText, ChevronRight } from 'lucide-react';
import { RecognitionResult } from '../types';
import { convertMathmlToOmml, wrapOmmlForClipboard } from '../lib/ommlConverter';
interface ExportSidebarProps {
isOpen: boolean;
@@ -84,7 +85,20 @@ export default function ExportSidebar({ isOpen, onClose, result }: ExportSidebar
];
const handleAction = async (option: ExportOption) => {
const content = option.getContent(result);
let content = option.getContent(result);
// Fallback: If Word MathML is missing, try to convert from MathML
if (option.id === 'mathml_word' && !content && result.mathml_content) {
try {
const omml = await convertMathmlToOmml(result.mathml_content);
if (omml) {
content = wrapOmmlForClipboard(omml);
}
} catch (err) {
console.error('Failed to convert MathML to OMML:', err);
}
}
if (!content) return;
try {