From 73986faa7d73c9fe0963e25274c6d7d74e0281e3 Mon Sep 17 00:00:00 2001 From: Florian Duros Date: Fri, 9 Dec 2022 14:06:15 +0100 Subject: [PATCH] Add inline code to rich text editor (#9720) Add inline code to rich text editor --- .../components/_FormattingButtons.pcss | 4 ++++ res/img/element-icons/room/composer/inline_code.svg | 5 +++++ .../wysiwyg_composer/components/FormattingButtons.tsx | 4 +++- src/i18n/strings/en_EN.json | 2 +- .../components/FormattingButtons-test.tsx | 10 ++++++++-- 5 files changed, 21 insertions(+), 4 deletions(-) create mode 100644 res/img/element-icons/room/composer/inline_code.svg diff --git a/res/css/views/rooms/wysiwyg_composer/components/_FormattingButtons.pcss b/res/css/views/rooms/wysiwyg_composer/components/_FormattingButtons.pcss index 342a40c606..02f875d24a 100644 --- a/res/css/views/rooms/wysiwyg_composer/components/_FormattingButtons.pcss +++ b/res/css/views/rooms/wysiwyg_composer/components/_FormattingButtons.pcss @@ -92,6 +92,10 @@ limitations under the License. .mx_FormattingButtons_Button_strikethrough::before { mask-image: url('$(res)/img/element-icons/room/composer/strikethrough.svg'); } + + .mx_FormattingButtons_Button_inline_code::before { + mask-image: url('$(res)/img/element-icons/room/composer/inline_code.svg'); + } } .mx_FormattingButtons_Tooltip { diff --git a/res/img/element-icons/room/composer/inline_code.svg b/res/img/element-icons/room/composer/inline_code.svg new file mode 100644 index 0000000000..a4392d9bce --- /dev/null +++ b/res/img/element-icons/room/composer/inline_code.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/src/components/views/rooms/wysiwyg_composer/components/FormattingButtons.tsx b/src/components/views/rooms/wysiwyg_composer/components/FormattingButtons.tsx index c9408c8f0f..98c13cfa43 100644 --- a/src/components/views/rooms/wysiwyg_composer/components/FormattingButtons.tsx +++ b/src/components/views/rooms/wysiwyg_composer/components/FormattingButtons.tsx @@ -23,6 +23,7 @@ import { Alignment } from "../../../elements/Tooltip"; import { KeyboardShortcut } from "../../../settings/KeyboardShortcut"; import { KeyCombo } from "../../../../../KeyBindingsManager"; import { _td } from "../../../../../languageHandler"; +import { ButtonEvent } from "../../../elements/AccessibleButton"; interface TooltipProps { label: string; @@ -45,7 +46,7 @@ interface ButtonProps extends TooltipProps { function Button({ label, keyCombo, onClick, isActive, className }: ButtonProps) { return void} title={label} className={ classNames('mx_FormattingButtons_Button', className, { @@ -68,5 +69,6 @@ export function FormattingButtons({ composer, actionStates }: FormattingButtonsP