Browse Source

Fix #454

pull/469/head
Timothée Jaussoin 8 years ago
parent
commit
9bd62d7b30
  1. 3
      app/widgets/Chat/_chat.tpl
  2. 17
      app/widgets/Chat/chat.js
  3. 1
      app/widgets/Chat/locales.ini

3
app/widgets/Chat/_chat.tpl

@ -108,6 +108,9 @@
<li onclick="MovimUtils.reload('{$c->route('contact', $contact->jid)}')">
<p class="normal">{$c->__('chat.profile')}</p>
</li>
<li class="on_mobile" onclick="Chat.editPrevious()">
<p class="normal">{$c->__('chat.edit_previous')}</p>
</li>
<li onclick="Chat_ajaxClearHistory('{$contact->jid}')">
<p class="normal">{$c->__('chat.clear')}</p>
</li>

17
app/widgets/Chat/chat.js

@ -147,6 +147,13 @@ var Chat = {
textarea.value = '';
MovimUtils.textareaAutoheight(textarea);
},
editPrevious: function()
{
var textarea = Chat.getTextarea();
if(textarea.value == '') {
Chat_ajaxLast(textarea.dataset.jid);
}
},
focus: function()
{
Chat.sended = false;
@ -166,8 +173,8 @@ var Chat = {
return;
}
if(event.keyCode == 38 && this.value == '') {
Chat_ajaxLast(this.dataset.jid);
if(event.keyCode == 38) {
Chat.editPrevious();
} else if(event.keyCode == 40
&& (this.value == '' || Chat.edit == true)) {
Chat.clearReplace();
@ -216,16 +223,16 @@ var Chat = {
};
if(document.documentElement.clientWidth > 1024) {
document.querySelector('#chat_textarea').focus();
textarea.focus();
}
},
setTextarea: function(value)
{
Chat.edit = true;
var textarea = document.querySelector('#chat_textarea');
var textarea = Chat.getTextarea();
textarea.value = value;
MovimUtils.textareaAutoheight(textarea);
textarea.focus();
},
notify : function(title, body, image)
{

1
app/widgets/Chat/locales.ini

@ -18,6 +18,7 @@ invitation = You received an invitation to join a chatroom
invitation_join = Join %s
profile = See the profile
clear = Clear the history
edit_previous = Edit last message
[chatroom]
members = Members

Loading…
Cancel
Save