Use correct translation function for WYSIWYG buttons (#11315)
* Use correct translation function for WYSIWYG buttons * Add tests
This commit is contained in:
parent
9319911a27
commit
22f83e7917
3 changed files with 132 additions and 13 deletions
|
@ -34,7 +34,7 @@ import AccessibleTooltipButton from "../../../elements/AccessibleTooltipButton";
|
|||
import { Alignment } from "../../../elements/Tooltip";
|
||||
import { KeyboardShortcut } from "../../../settings/KeyboardShortcut";
|
||||
import { KeyCombo } from "../../../../../KeyBindingsManager";
|
||||
import { _td } from "../../../../../languageHandler";
|
||||
import { _t } from "../../../../../languageHandler";
|
||||
import { ButtonEvent } from "../../../elements/AccessibleButton";
|
||||
import { openLinkModal } from "./LinkModal";
|
||||
import { useComposerContext } from "../ComposerContext";
|
||||
|
@ -93,47 +93,47 @@ export function FormattingButtons({ composer, actionStates }: FormattingButtonsP
|
|||
<div className="mx_FormattingButtons">
|
||||
<Button
|
||||
actionState={actionStates.bold}
|
||||
label={_td("Bold")}
|
||||
label={_t("Bold")}
|
||||
keyCombo={{ ctrlOrCmdKey: true, key: "b" }}
|
||||
onClick={() => composer.bold()}
|
||||
icon={<BoldIcon className="mx_FormattingButtons_Icon" />}
|
||||
/>
|
||||
<Button
|
||||
actionState={actionStates.italic}
|
||||
label={_td("Italic")}
|
||||
label={_t("Italic")}
|
||||
keyCombo={{ ctrlOrCmdKey: true, key: "i" }}
|
||||
onClick={() => composer.italic()}
|
||||
icon={<ItalicIcon className="mx_FormattingButtons_Icon" />}
|
||||
/>
|
||||
<Button
|
||||
actionState={actionStates.underline}
|
||||
label={_td("Underline")}
|
||||
label={_t("Underline")}
|
||||
keyCombo={{ ctrlOrCmdKey: true, key: "u" }}
|
||||
onClick={() => composer.underline()}
|
||||
icon={<UnderlineIcon className="mx_FormattingButtons_Icon" />}
|
||||
/>
|
||||
<Button
|
||||
actionState={actionStates.strikeThrough}
|
||||
label={_td("Strikethrough")}
|
||||
label={_t("Strikethrough")}
|
||||
onClick={() => composer.strikeThrough()}
|
||||
icon={<StrikeThroughIcon className="mx_FormattingButtons_Icon" />}
|
||||
/>
|
||||
<Button
|
||||
actionState={actionStates.unorderedList}
|
||||
label={_td("Bulleted list")}
|
||||
label={_t("Bulleted list")}
|
||||
onClick={() => composer.unorderedList()}
|
||||
icon={<BulletedListIcon className="mx_FormattingButtons_Icon" />}
|
||||
/>
|
||||
<Button
|
||||
actionState={actionStates.orderedList}
|
||||
label={_td("Numbered list")}
|
||||
label={_t("Numbered list")}
|
||||
onClick={() => composer.orderedList()}
|
||||
icon={<NumberedListIcon className="mx_FormattingButtons_Icon" />}
|
||||
/>
|
||||
{isInList && (
|
||||
<Button
|
||||
actionState={actionStates.indent}
|
||||
label={_td("Indent increase")}
|
||||
label={_t("Indent increase")}
|
||||
onClick={() => composer.indent()}
|
||||
icon={<IndentIcon className="mx_FormattingButtons_Icon" />}
|
||||
/>
|
||||
|
@ -141,33 +141,33 @@ export function FormattingButtons({ composer, actionStates }: FormattingButtonsP
|
|||
{isInList && (
|
||||
<Button
|
||||
actionState={actionStates.unindent}
|
||||
label={_td("Indent decrease")}
|
||||
label={_t("Indent decrease")}
|
||||
onClick={() => composer.unindent()}
|
||||
icon={<UnIndentIcon className="mx_FormattingButtons_Icon" />}
|
||||
/>
|
||||
)}
|
||||
<Button
|
||||
actionState={actionStates.quote}
|
||||
label={_td("Quote")}
|
||||
label={_t("Quote")}
|
||||
onClick={() => composer.quote()}
|
||||
icon={<QuoteIcon className="mx_FormattingButtons_Icon" />}
|
||||
/>
|
||||
<Button
|
||||
actionState={actionStates.inlineCode}
|
||||
label={_td("Code")}
|
||||
label={_t("Code")}
|
||||
keyCombo={{ ctrlOrCmdKey: true, key: "e" }}
|
||||
onClick={() => composer.inlineCode()}
|
||||
icon={<InlineCodeIcon className="mx_FormattingButtons_Icon" />}
|
||||
/>
|
||||
<Button
|
||||
actionState={actionStates.codeBlock}
|
||||
label={_td("Code block")}
|
||||
label={_t("Code block")}
|
||||
onClick={() => composer.codeBlock()}
|
||||
icon={<CodeBlockIcon className="mx_FormattingButtons_Icon" />}
|
||||
/>
|
||||
<Button
|
||||
actionState={actionStates.link}
|
||||
label={_td("Link")}
|
||||
label={_t("Link")}
|
||||
onClick={() => openLinkModal(composer, composerContext, actionStates.link === "reversed")}
|
||||
icon={<LinkIcon className="mx_FormattingButtons_Icon" />}
|
||||
/>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue