( props: SlateElementProps<TEquationElement> )
| 11 | import { inlineSuggestionVariants } from '@/registry/lib/suggestion'; |
| 12 | |
| 13 | export function EquationElementStatic( |
| 14 | props: SlateElementProps<TEquationElement> |
| 15 | ) { |
| 16 | const { element } = props; |
| 17 | |
| 18 | const html = getEquationHtml({ |
| 19 | element, |
| 20 | options: { |
| 21 | displayMode: true, |
| 22 | errorColor: '#cc0000', |
| 23 | fleqn: false, |
| 24 | leqno: false, |
| 25 | macros: { '\\f': '#1f(#2)' }, |
| 26 | output: 'htmlAndMathml', |
| 27 | strict: 'warn', |
| 28 | throwOnError: false, |
| 29 | trust: false, |
| 30 | }, |
| 31 | }); |
| 32 | |
| 33 | return ( |
| 34 | <SlateElement className="my-1" {...props}> |
| 35 | <div |
| 36 | className={cn( |
| 37 | 'group flex select-none items-center justify-center rounded-sm hover:bg-primary/10 data-[selected=true]:bg-primary/10', |
| 38 | element.texExpression.length === 0 ? 'bg-muted p-3 pr-9' : 'px-2 py-1' |
| 39 | )} |
| 40 | > |
| 41 | {element.texExpression.length > 0 ? ( |
| 42 | <span |
| 43 | dangerouslySetInnerHTML={{ |
| 44 | __html: html, |
| 45 | }} |
| 46 | /> |
| 47 | ) : ( |
| 48 | <div className="flex h-7 w-full items-center gap-2 whitespace-nowrap text-muted-foreground text-sm"> |
| 49 | <RadicalIcon className="size-6 text-muted-foreground/80" /> |
| 50 | <div>Add a Tex equation</div> |
| 51 | </div> |
| 52 | )} |
| 53 | </div> |
| 54 | {props.children} |
| 55 | </SlateElement> |
| 56 | ); |
| 57 | } |
| 58 | |
| 59 | export function InlineEquationElementStatic( |
| 60 | props: SlateElementProps<TEquationElement> |
nothing calls this directly
no test coverage detected
searching dependent graphs…