Keyboard shortcut to open the sticker picker (#7985)
This commit is contained in:
parent
1f4e286db9
commit
a792097d02
5 changed files with 26 additions and 0 deletions
|
@ -341,6 +341,10 @@ export default class MessageComposer extends React.Component<IProps, IState> {
|
|||
});
|
||||
};
|
||||
|
||||
private toggleStickerPickerOpen = () => {
|
||||
this.setStickerPickerOpen(!this.state.isStickerPickerOpen);
|
||||
};
|
||||
|
||||
private toggleButtonMenu = (): void => {
|
||||
this.setState({
|
||||
isMenuOpen: !this.state.isMenuOpen,
|
||||
|
@ -373,6 +377,7 @@ export default class MessageComposer extends React.Component<IProps, IState> {
|
|||
replyToEvent={this.props.replyToEvent}
|
||||
onChange={this.onChange}
|
||||
disabled={this.state.haveRecording}
|
||||
toggleStickerPickerOpen={this.toggleStickerPickerOpen}
|
||||
/>,
|
||||
);
|
||||
|
||||
|
|
|
@ -173,6 +173,7 @@ interface ISendMessageComposerProps extends MatrixClientProps {
|
|||
disabled?: boolean;
|
||||
onChange?(model: EditorModel): void;
|
||||
includeReplyLegacyFallback?: boolean;
|
||||
toggleStickerPickerOpen: () => void;
|
||||
}
|
||||
|
||||
@replaceableComponent("views.rooms.SendMessageComposer")
|
||||
|
@ -237,6 +238,14 @@ export class SendMessageComposer extends React.Component<ISendMessageComposerPro
|
|||
}
|
||||
break;
|
||||
}
|
||||
case KeyBindingAction.ShowStickerPicker: {
|
||||
if (!SettingsStore.getValue("MessageComposerInput.showStickersButton")) {
|
||||
return; // Do nothing if there is no Stickers button
|
||||
}
|
||||
this.props.toggleStickerPickerOpen();
|
||||
event.preventDefault();
|
||||
break;
|
||||
}
|
||||
case KeyBindingAction.EditPrevMessage:
|
||||
// selection must be collapsed and caret at start
|
||||
if (this.editorRef.current?.isSelectionCollapsed() && this.editorRef.current?.isCaretAtStart()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue