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

Commit 45d53d3

Browse files
committed
Update @matrix-org/matrix-wysiwyg dependency
1 parent 18c03da commit 45d53d3

File tree

9 files changed

+22
-22
lines changed

9 files changed

+22
-22
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
"dependencies": {
5858
"@babel/runtime": "^7.12.5",
5959
"@matrix-org/analytics-events": "^0.3.0",
60-
"@matrix-org/matrix-wysiwyg": "^0.3.2",
60+
"@matrix-org/matrix-wysiwyg": "^0.6.0",
6161
"@matrix-org/react-sdk-module-api": "^0.0.3",
6262
"@sentry/browser": "^6.11.0",
6363
"@sentry/tracing": "^6.11.0",

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ limitations under the License.
1515
*/
1616

1717
import React, { MouseEventHandler } from "react";
18-
import { FormattingFunctions, FormattingStates } from "@matrix-org/matrix-wysiwyg";
18+
import { FormattingFunctions, AllActionStates } from "@matrix-org/matrix-wysiwyg";
1919
import classNames from "classnames";
2020

2121
import AccessibleTooltipButton from "../../../elements/AccessibleTooltipButton";
@@ -56,14 +56,14 @@ function Button({ label, keyCombo, onClick, isActive, className }: ButtonProps)
5656

5757
interface FormattingButtonsProps {
5858
composer: FormattingFunctions;
59-
formattingStates: FormattingStates;
59+
actionStates: AllActionStates;
6060
}
6161

62-
export function FormattingButtons({ composer, formattingStates }: FormattingButtonsProps) {
62+
export function FormattingButtons({ composer, actionStates }: FormattingButtonsProps) {
6363
return <div className="mx_FormattingButtons">
64-
<Button isActive={formattingStates.bold === 'reversed'} label={_td("Bold")} keyCombo={{ ctrlOrCmdKey: true, key: 'b' }} onClick={() => composer.bold()} className="mx_FormattingButtons_Button_bold" />
65-
<Button isActive={formattingStates.italic === 'reversed'} label={_td('Italic')} keyCombo={{ ctrlOrCmdKey: true, key: 'i' }} onClick={() => composer.italic()} className="mx_FormattingButtons_Button_italic" />
66-
<Button isActive={formattingStates.underline === 'reversed'} label={_td('Underline')} keyCombo={{ ctrlOrCmdKey: true, key: 'u' }} onClick={() => composer.underline()} className="mx_FormattingButtons_Button_underline" />
67-
<Button isActive={formattingStates.strikeThrough === 'reversed'} label={_td('Strikethrough')} onClick={() => composer.strikeThrough()} className="mx_FormattingButtons_Button_strikethrough" />
64+
<Button isActive={actionStates.bold === 'reversed'} label={_td("Bold")} keyCombo={{ ctrlOrCmdKey: true, key: 'b' }} onClick={() => composer.bold()} className="mx_FormattingButtons_Button_bold" />
65+
<Button isActive={actionStates.italic === 'reversed'} label={_td('Italic')} keyCombo={{ ctrlOrCmdKey: true, key: 'i' }} onClick={() => composer.italic()} className="mx_FormattingButtons_Button_italic" />
66+
<Button isActive={actionStates.underline === 'reversed'} label={_td('Underline')} keyCombo={{ ctrlOrCmdKey: true, key: 'u' }} onClick={() => composer.underline()} className="mx_FormattingButtons_Button_underline" />
67+
<Button isActive={actionStates.strikeThrough === 'reversed'} label={_td('Strikethrough')} onClick={() => composer.strikeThrough()} className="mx_FormattingButtons_Button_strikethrough" />
6868
</div>;
6969
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export const WysiwygComposer = memo(function WysiwygComposer(
5252
) {
5353
const inputEventProcessor = useInputEventProcessor(onSend);
5454

55-
const { ref, isWysiwygReady, content, formattingStates, wysiwyg } =
55+
const { ref, isWysiwygReady, content, actionStates, wysiwyg } =
5656
useWysiwyg({ initialContent, inputEventProcessor });
5757

5858
useEffect(() => {
@@ -68,7 +68,7 @@ export const WysiwygComposer = memo(function WysiwygComposer(
6868

6969
return (
7070
<div data-testid="WysiwygComposer" className={classNames(className, { [`${className}-focused`]: isFocused })} onFocus={onFocus} onBlur={onFocus}>
71-
<FormattingButtons composer={wysiwyg} formattingStates={formattingStates} />
71+
<FormattingButtons composer={wysiwyg} actionStates={actionStates} />
7272
<Editor ref={ref} disabled={!isReady} leftComponent={leftComponent} rightComponent={rightComponent} />
7373
{ children?.(ref, wysiwyg) }
7474
</div>

test/components/views/rooms/MessageComposer-test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ import { SendWysiwygComposer } from "../../../../src/components/views/rooms/wysi
4747
jest.mock("@matrix-org/matrix-wysiwyg", () => ({
4848
useWysiwyg: () => {
4949
return { ref: { current: null }, isWysiwygReady: true, wysiwyg: { clear: () => void 0 },
50-
formattingStates: { bold: 'enabled', italic: 'enabled', underline: 'enabled', strikeThrough: 'enabled' } };
50+
actionStates: { bold: 'enabled', italic: 'enabled', underline: 'enabled', strikeThrough: 'enabled' } };
5151
},
5252
}));
5353

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jest.mock("@matrix-org/matrix-wysiwyg", () => ({
4545
content: mockContent,
4646
isWysiwygReady: true,
4747
wysiwyg: { clear: mockClear },
48-
formattingStates: {
48+
actionStates: {
4949
bold: 'enabled',
5050
italic: 'enabled',
5151
underline: 'enabled',

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jest.mock("@matrix-org/matrix-wysiwyg", () => ({
4141
content: '<b>html</b>',
4242
isWysiwygReady: true,
4343
wysiwyg: { clear: mockClear },
44-
formattingStates: {
44+
actionStates: {
4545
bold: 'enabled',
4646
italic: 'enabled',
4747
underline: 'enabled',

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ describe('FormattingButtons', () => {
2929
strikeThrough: jest.fn(),
3030
} as any;
3131

32-
const formattingStates = {
32+
const actionStates = {
3333
bold: 'reversed',
3434
italic: 'reversed',
3535
underline: 'enabled',
@@ -42,7 +42,7 @@ describe('FormattingButtons', () => {
4242

4343
it('Should have the correspond CSS classes', () => {
4444
// When
45-
render(<FormattingButtons composer={wysiwyg} formattingStates={formattingStates} />);
45+
render(<FormattingButtons composer={wysiwyg} actionStates={actionStates} />);
4646

4747
// Then
4848
expect(screen.getByLabelText('Bold')).toHaveClass('mx_FormattingButtons_active');
@@ -53,7 +53,7 @@ describe('FormattingButtons', () => {
5353

5454
it('Should call wysiwyg function on button click', () => {
5555
// When
56-
render(<FormattingButtons composer={wysiwyg} formattingStates={formattingStates} />);
56+
render(<FormattingButtons composer={wysiwyg} actionStates={actionStates} />);
5757
screen.getByLabelText('Bold').click();
5858
screen.getByLabelText('Italic').click();
5959
screen.getByLabelText('Underline').click();
@@ -69,7 +69,7 @@ describe('FormattingButtons', () => {
6969
it('Should display the tooltip on mouse over', async () => {
7070
// When
7171
const user = userEvent.setup();
72-
render(<FormattingButtons composer={wysiwyg} formattingStates={formattingStates} />);
72+
render(<FormattingButtons composer={wysiwyg} actionStates={actionStates} />);
7373
await user.hover(screen.getByLabelText('Bold'));
7474

7575
// Then

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jest.mock("@matrix-org/matrix-wysiwyg", () => ({
3535
content: '<b>html</b>',
3636
isWysiwygReady: true,
3737
wysiwyg: { clear: () => void 0 },
38-
formattingStates: {
38+
actionStates: {
3939
bold: 'enabled',
4040
italic: 'enabled',
4141
underline: 'enabled',

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1788,10 +1788,10 @@
17881788
resolved "https://registry.yarnpkg.com/@matrix-org/analytics-events/-/analytics-events-0.3.0.tgz#a428f7e3f164ffadf38f35bc0f0f9a3e47369ce6"
17891789
integrity sha512-f1WIMA8tjNB3V5g1C34yIpIJK47z6IJ4SLiY4j+J9Gw4X8C3TKGTAx563rMcMvW3Uk/PFqnIBXtkavHBXoYJ9A==
17901790

1791-
"@matrix-org/matrix-wysiwyg@^0.3.2":
1792-
version "0.3.2"
1793-
resolved "https://registry.yarnpkg.com/@matrix-org/matrix-wysiwyg/-/matrix-wysiwyg-0.3.2.tgz#586f3ad2f4a7bf39d8e2063630c52294c877bcd6"
1794-
integrity sha512-Q6Ntj2q1/7rVUlro94snn9eZy/3EbrGqaq5nqNMbttXcnFzYtgligDV1avViB4Um6ZRdDOxnQEPkMca/SqYSmw==
1791+
"@matrix-org/matrix-wysiwyg@^0.6.0":
1792+
version "0.6.0"
1793+
resolved "https://registry.yarnpkg.com/@matrix-org/matrix-wysiwyg/-/matrix-wysiwyg-0.6.0.tgz#f06577eec5a98fa414d2cd66688d32d984544c94"
1794+
integrity sha512-6wq6RzpGZLxAcczHL7+QuGLJwGcvUSAm1zXd/0FzevfIKORbGKF2uCWgQ4JoZVpe4rbBNJgtPGb1r36W/i66/A==
17951795

17961796
"@matrix-org/olm@https://gitlab.matrix.org/api/v4/projects/27/packages/npm/@matrix-org/olm/-/@matrix-org/olm-3.2.8.tgz":
17971797
version "3.2.8"

0 commit comments

Comments
 (0)