feat(i18n): localise document editing controls
This commit is contained in:
@@ -7,6 +7,7 @@ import FormatUnderlinedIcon from "@mui/icons-material/FormatUnderlined";
|
||||
import LinkIcon from "@mui/icons-material/Link";
|
||||
|
||||
import { wrapSelection } from "../cvBuilder";
|
||||
import { useI18n } from "../i18n/I18nProvider";
|
||||
|
||||
// Lightweight rich text: a plain textarea plus a markdown toolbar. Storage stays plain text
|
||||
// (**bold**, *italic*, __underline__, [text](url)); the server renderer converts the same whitelist
|
||||
@@ -29,6 +30,7 @@ export default function RichTextField({
|
||||
ariaLabel?: string;
|
||||
disabled?: boolean;
|
||||
}) {
|
||||
const { t } = useI18n();
|
||||
const ref = useRef<HTMLTextAreaElement | null>(null);
|
||||
|
||||
const apply = (before: string, after: string, placeholderText: string) => {
|
||||
@@ -53,10 +55,10 @@ export default function RichTextField({
|
||||
return (
|
||||
<Box>
|
||||
<Box sx={{ display: "flex", gap: 0.25, mb: 0.25 }}>
|
||||
{btn("Bold", <FormatBoldIcon fontSize="inherit" />, "**", "**", "bold text")}
|
||||
{btn("Italic", <FormatItalicIcon fontSize="inherit" />, "*", "*", "italic text")}
|
||||
{btn("Underline", <FormatUnderlinedIcon fontSize="inherit" />, "__", "__", "underlined")}
|
||||
{btn("Link", <LinkIcon fontSize="inherit" />, "[", "](https://)", "link text")}
|
||||
{btn(t("richTextBold"), <FormatBoldIcon fontSize="inherit" />, "**", "**", t("richTextBoldPlaceholder"))}
|
||||
{btn(t("richTextItalic"), <FormatItalicIcon fontSize="inherit" />, "*", "*", t("richTextItalicPlaceholder"))}
|
||||
{btn(t("richTextUnderline"), <FormatUnderlinedIcon fontSize="inherit" />, "__", "__", t("richTextUnderlinePlaceholder"))}
|
||||
{btn(t("richTextLink"), <LinkIcon fontSize="inherit" />, "[", "](https://)", t("richTextLinkPlaceholder"))}
|
||||
</Box>
|
||||
<TextField
|
||||
inputRef={ref}
|
||||
|
||||
Reference in New Issue
Block a user