Focus again on new message input after sending a message

Some browsers (like Firefox) automatically return the focus to the new
message input after sending a message, while others (like Chromium) do
not. Now the focus is explicitly given back to the new message input to
make more comfortable to keep writing new messages.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
This commit is contained in:
Daniel Calviño Sánchez 2018-01-09 11:05:54 +01:00
Родитель 63111646f5
Коммит d20dbf6ece
1 изменённых файлов: 4 добавлений и 0 удалений

Просмотреть файл

@ -302,6 +302,8 @@
$form.find('.submitLoading').addClass('hidden');
$form.find('.message').text('').prop('contenteditable', true);
$form.find('.message').focus();
// The new message does not need to be explicitly added to the list
// of messages; it will be automatically fetched from the server
// thanks to the auto-refresh of the list.
@ -312,6 +314,8 @@
$form.find('.submitLoading').addClass('hidden');
$form.find('.message').prop('contenteditable', true);
$form.find('.message').focus();
OC.Notification.show(t('spreed', 'Error occurred while sending message'), {type: 'error'});
},