feat: distinct inline display latex

This commit is contained in:
liuyuanchuang
2026-01-08 16:43:10 +08:00
parent 022ef31bcc
commit 6747205bd0
2 changed files with 15 additions and 15 deletions

View File

@@ -1,5 +1,5 @@
import { useState } from 'react';
import { X, Check, Copy, Download, Code2, Image as ImageIcon, FileText, Loader2 } from 'lucide-react';
import { X, Check, Copy, Download, Code2, Image as ImageIcon, FileText, Loader2, LucideIcon } from 'lucide-react';
import { RecognitionResult } from '../types';
import { convertMathmlToOmml, wrapOmmlForClipboard } from '../lib/ommlConverter';
import { generateImageFromElement, copyImageToClipboard, downloadImage } from '../lib/imageGenerator';
@@ -38,8 +38,19 @@ export default function ExportSidebar({ isOpen, onClose, result }: ExportSidebar
getContent: (r) => r.markdown_content
},
{
id: 'latex',
label: 'Latex',
id: 'latex_inline',
label: 'LaTeX (Inline)',
category: 'Code',
getContent: (r) => {
if (!r.latex_content) return null;
// Remove existing \[ \] and wrap with \( \)
const content = r.latex_content.replace(/^\\\[/, '').replace(/\\\]$/, '').trim();
return `\\(${content}\\)`;
}
},
{
id: 'latex_display',
label: 'LaTeX (Display)',
category: 'Code',
getContent: (r) => r.latex_content
},
@@ -216,7 +227,7 @@ export default function ExportSidebar({ isOpen, onClose, result }: ExportSidebar
}
};
const categories: { id: ExportCategory; icon: any; label: string }[] = [
const categories: { id: ExportCategory; icon: LucideIcon; label: string }[] = [
{ id: 'Code', icon: Code2, label: 'Code' },
{ id: 'Image', icon: ImageIcon, label: 'Image' },
{ id: 'File', icon: FileText, label: 'File' },