Skip to content
Open
Changes from all commits
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
19 changes: 18 additions & 1 deletion js/app/packages/channel/Channel/create-channel-hotkeys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ export function createChannelHotkeys(options: CreateChannelHotkeysOptions) {
return options.messageById().get(id);
};

const focusInput = () => {
inputEl?.querySelector<HTMLElement>('[contenteditable]')?.focus();
};

registerHotkey({
scopeId: messageListScope,
hotkey: 'arrowup',
Expand All @@ -79,7 +83,7 @@ export function createChannelHotkeys(options: CreateChannelHotkeysOptions) {
options.navigation()?.markUserIntent('down');
options.navigation()?.scrollToId(id, { align: 'nearest' });
} else {
inputEl?.querySelector<HTMLElement>('[contenteditable]')?.focus();
focusInput();
}
return true;
},
Expand Down Expand Up @@ -112,6 +116,19 @@ export function createChannelHotkeys(options: CreateChannelHotkeysOptions) {
},
});

registerHotkey({
scopeId: messageListScope,
hotkey: 'enter',
hotkeyToken: TOKENS.channel.focusInput,
description: 'Focus input',
registrationType: 'add',
condition: () => !hasSelection(),
keyDownHandler: () => {
focusInput();
return true;
},
});

registerHotkey({
scopeId: messageListScope,
hotkey: 'e',
Expand Down
Loading