Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit d3806a9

Browse files
committed
Add indent and unindent actions to RTE
1 parent bd279ac commit d3806a9

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

src/components/views/rooms/wysiwyg_composer/components/FormattingButtons.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ import { Icon as LinkIcon } from "../../../../../../res/img/element-icons/room/c
2828
import { Icon as BulletedListIcon } from "../../../../../../res/img/element-icons/room/composer/bulleted_list.svg";
2929
import { Icon as NumberedListIcon } from "../../../../../../res/img/element-icons/room/composer/numbered_list.svg";
3030
import { Icon as CodeBlockIcon } from "../../../../../../res/img/element-icons/room/composer/code_block.svg";
31+
import { Icon as IndentIcon } from "../../../../../../res/img/element-icons/room/composer/indent_increase.svg";
32+
import { Icon as UnIndentIcon } from "../../../../../../res/img/element-icons/room/composer/indent_decrease.svg";
3133
import AccessibleTooltipButton from "../../../elements/AccessibleTooltipButton";
3234
import { Alignment } from "../../../elements/Tooltip";
3335
import { KeyboardShortcut } from "../../../settings/KeyboardShortcut";
@@ -127,6 +129,18 @@ export function FormattingButtons({ composer, actionStates }: FormattingButtonsP
127129
onClick={() => composer.orderedList()}
128130
icon={<NumberedListIcon className="mx_FormattingButtons_Icon" />}
129131
/>
132+
<Button
133+
actionState={actionStates.indent}
134+
label={_td("Indent increase")}
135+
onClick={() => composer.indent()}
136+
icon={<IndentIcon className="mx_FormattingButtons_Icon" />}
137+
/>
138+
<Button
139+
actionState={actionStates.unIndent}
140+
label={_td("Indent decrease")}
141+
onClick={() => composer.unIndent()}
142+
icon={<UnIndentIcon className="mx_FormattingButtons_Icon" />}
143+
/>
130144
<Button
131145
actionState={actionStates.quote}
132146
label={_td("Quote")}

test/components/views/rooms/wysiwyg_composer/components/FormattingButtons-test.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ const mockWysiwyg = {
3333
orderedList: jest.fn(),
3434
unorderedList: jest.fn(),
3535
quote: jest.fn(),
36+
indent: jest.fn(),
37+
unIndent: jest.fn(),
3638
} as unknown as FormattingFunctions;
3739

3840
const openLinkModalSpy = jest.spyOn(LinkModal, "openLinkModal");
@@ -51,6 +53,8 @@ const testCases: Record<
5153
orderedList: { label: "Numbered list", mockFormatFn: mockWysiwyg.orderedList },
5254
unorderedList: { label: "Bulleted list", mockFormatFn: mockWysiwyg.unorderedList },
5355
quote: { label: "Quote", mockFormatFn: mockWysiwyg.quote },
56+
indent: { label: "Indent increase", mockFormatFn: mockWysiwyg.indent },
57+
unIndent: { label: "Indent decrease", mockFormatFn: mockWysiwyg.unIndent },
5458
};
5559

5660
const createActionStates = (state: ActionState): AllActionStates => {

0 commit comments

Comments
 (0)