Path: blob/master/src/packages/frontend/app/localize-default-elements.tsx
1496 views
import { Typography } from "antd";12export const { Text, Title, Paragraph } = Typography;34const uniqueKey: { [tag: string]: number } = {};56// Note: this is e.g. necessary to render text in a modal, where some caching happens, apparently7function getKey(tag: string): number {8const n = (uniqueKey[tag] ?? 0) + 1;9uniqueKey[tag] = n;10return n;11}1213export const LOCALIZE_DEFAULT_ELEMENTS = {14strong: (ch) => (15<Text strong key={getKey("strong")}>16{ch}17</Text>18),19b: (ch) => (20<Text strong key={getKey("b")}>21{ch}22</Text>23),24i: (ch) => (25<Text italic key={getKey("i")}>26{ch}27</Text>28),29p: (ch) => <Paragraph key={getKey("p")}>{ch}</Paragraph>,30code: (ch) => (31<Text code key={getKey("code")}>32{ch}33</Text>34),35ul: (e) => <ul key={getKey("ul")}>{e}</ul>,36ol: (e) => <ol key={getKey("ol")}>{e}</ol>,37li: (e) => <li key={getKey("li")}>{e}</li>,38} as const;394041