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

Avoid calling prepareToEncrypt onKeyDown #10828

Merged
merged 2 commits into from
May 9, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions src/components/views/rooms/SendMessageComposer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -353,11 +353,6 @@ export class SendMessageComposer extends React.Component<ISendMessageComposerPro
context: this.context.timelineRenderingType,
});
break;
default:
if (this.prepareToEncrypt) {
// This needs to be last!
this.prepareToEncrypt();
}
}
};

Expand Down Expand Up @@ -690,7 +685,10 @@ export class SendMessageComposer extends React.Component<ISendMessageComposerPro
};

private onChange = (): void => {
if (this.props.onChange) this.props.onChange(this.model);
// We call this in here rather than onKeyDown as that would trip it on global shortcuts e.g. Ctrl-k also
this.prepareToEncrypt?.();

this.props.onChange?.(this.model);
};

private focusComposer = (): void => {
Expand Down