shift + enterでも改行
This commit is contained in:
parent
861c3f3a0d
commit
73f5dfebca
1 changed files with 4 additions and 7 deletions
|
@ -143,17 +143,14 @@ function onDrop(ev: DragEvent): void {
|
||||||
|
|
||||||
function onKeydown(ev: KeyboardEvent) {
|
function onKeydown(ev: KeyboardEvent) {
|
||||||
typing();
|
typing();
|
||||||
let sendOnEnter = localStorage.getItem('enterSendsMessage') === 'true' || defaultStore.state.enterSendsMessage;
|
if (defaultStore.state.enterSendsMessage) {
|
||||||
if (sendOnEnter) {
|
if ((ev.key === 'Enter') && (ev.ctrlKey || ev.metaKey || ev.shiftKey)) {
|
||||||
if ((ev.key === 'Enter') && (ev.ctrlKey || ev.metaKey)) {
|
|
||||||
textEl.value += '\n';
|
textEl.value += '\n';
|
||||||
}
|
} else if (ev.key === 'Enter' && !ev.shiftKey && !('ontouchstart' in document.documentElement) && canSend) {
|
||||||
else if (ev.key === 'Enter' && !ev.shiftKey && !('ontouchstart' in document.documentElement) && canSend) {
|
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
send();
|
send();
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if ((ev.key === 'Enter') && (ev.ctrlKey || ev.metaKey) && canSend) {
|
if ((ev.key === 'Enter') && (ev.ctrlKey || ev.metaKey) && canSend) {
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
send();
|
send();
|
||||||
|
|
Loading…
Reference in a new issue