diff --git a/mnemo_cards_admin/src/components/CardEditorPreview.tsx b/mnemo_cards_admin/src/components/CardEditorPreview.tsx index ca8ba40..d94ac25 100644 --- a/mnemo_cards_admin/src/components/CardEditorPreview.tsx +++ b/mnemo_cards_admin/src/components/CardEditorPreview.tsx @@ -21,66 +21,6 @@ interface CardEditorPreviewProps { packColor?: string } -// Helper function to format text with mnemo syntax (similar to Flutter's MnemoText) -function formatMnemoText(text: string | null | undefined): React.ReactNode { - if (!text) return null - - // Replace \n with actual line breaks - const formattedText = text.replaceAll('\\n', '\n') - - // Find all matches of text in curly braces - const matches = Array.from(formattedText.matchAll(/\{(.*?)\}/g)) - - if (matches.length === 0) { - return {formattedText} - } - - const elements: React.ReactNode[] = [] - let lastIndex = 0 - - matches.forEach((match) => { - // Add text before the match - if (match.index !== undefined && match.index > lastIndex) { - elements.push( - - {formattedText.substring(lastIndex, match.index)} - - ) - } - - // Extract text inside braces - let mnemoText = match[1] - - // Check if text starts with color code #RRGGBB - let color = '#ef4444' // Default red color (mnemoRed) - if (mnemoText.startsWith('#') && mnemoText.length > 7) { - const colorCode = mnemoText.substring(0, 7) - color = colorCode - mnemoText = mnemoText.substring(7) - } - - // Add highlighted text - elements.push( - - {mnemoText} - - ) - - lastIndex = match.index! + match[0].length - }) - - // Add remaining text - if (lastIndex < formattedText.length) { - elements.push( - - {formattedText.substring(lastIndex)} - - ) - } - - return <>{elements} -} - // Helper to get image source function getImageSrc(image?: string): string | undefined { if (!image) return undefined