| 25 | } |
| 26 | |
| 27 | const makeCodeTd = (type: string, text: string | undefined, html: string | undefined) => { |
| 28 | if (text === undefined) { |
| 29 | return {text: '', html: '', className: 'empty code'}; |
| 30 | } |
| 31 | html ??= escapeHtml(text); |
| 32 | text = text.replaceAll('\t', '\u00a0\u00a0\u00a0\u00a0'); |
| 33 | html = html.replaceAll('\t', '\u00a0\u00a0\u00a0\u00a0'); |
| 34 | const className = 'code ' + type; |
| 35 | return {className, html, text}; |
| 36 | }; |
| 37 | |
| 38 | export function DiffRow(props: DiffRowProps) { |
| 39 | const {beforeLineNum, afterLineNum, type, isSelected} = props; |