When correcting a message, also highlight the textarea.

This commit is contained in:
JC Brand 2018-08-07 08:54:50 +02:00
parent 27bc33ba09
commit 08dce556f9
6 changed files with 29 additions and 13 deletions

View File

@ -7490,6 +7490,8 @@ body.reset {
margin-bottom: -4px; }
#conversejs .chatbox .sendXMPPMessage .chat-textarea.spoiler {
height: 42px; }
#conversejs .chatbox .sendXMPPMessage .chat-textarea.correcting {
background-color: #e7f7ee; }
#conversejs .chatbox .sendXMPPMessage .send-button {
position: absolute;
left: 3px;
@ -8676,6 +8678,9 @@ body.reset {
#conversejs.converse-embedded .chatroom .sendXMPPMessage .chat-textarea,
#conversejs .chatroom .sendXMPPMessage .chat-textarea {
border-bottom-right-radius: 0; }
#conversejs.converse-embedded .chatroom .sendXMPPMessage .chat-textarea.correcting,
#conversejs .chatroom .sendXMPPMessage .chat-textarea.correcting {
background-color: #fadfd7; }
#conversejs.converse-embedded .chatroom .sendXMPPMessage .send-button,
#conversejs .chatroom .sendXMPPMessage .send-button {
background-color: #E77051; }
@ -8840,7 +8845,7 @@ body.reset {
#conversejs .message.chat-msg:hover .chat-msg__actions .chat-msg__action {
opacity: 1; }
#conversejs .message.chat-msg.correcting.groupchat {
background-color: #fdf1ee; }
background-color: #fadfd7; }
#conversejs .message.chat-msg.correcting:not(.groupchat) {
background-color: #e7f7ee; }
#conversejs .message.chat-msg .spoiler {

View File

@ -251,6 +251,9 @@
&.spoiler {
height: 42px;
}
&.correcting {
background-color: lighten($chat-head-color, 50%);
}
}
.send-button {

View File

@ -271,6 +271,9 @@
}
.chat-textarea {
border-bottom-right-radius: 0;
&.correcting {
background-color: lighten($chatroom-head-color, 30%);
}
}
.send-button {
background-color: $chatroom-head-color;

View File

@ -80,7 +80,7 @@
}
&.correcting {
&.groupchat {
background-color: lighten($chatroom-head-color, 35%);
background-color: lighten($chatroom-head-color, 30%);
}
&:not(.groupchat) {
background-color: lighten($chat-head-color, 50%);

View File

@ -803,7 +803,7 @@
*/
this.showMessage(message);
if (message.get('correcting')) {
this.insertIntoTextArea(message.get('message'), true);
this.insertIntoTextArea(message.get('message'), true, true);
}
_converse.emit('messageAdded', {
'message': message,
@ -944,10 +944,10 @@
currently_correcting.save('correcting', false);
}
message.save('correcting', true);
this.insertIntoTextArea(message.get('message'), true);
this.insertIntoTextArea(message.get('message'), true, true);
} else {
message.save('correcting', false);
this.insertIntoTextArea('', true);
this.insertIntoTextArea('', true, false);
}
},
@ -966,10 +966,10 @@
}
}
if (message) {
this.insertIntoTextArea(message.get('message'), true);
this.insertIntoTextArea(message.get('message'), true, true);
message.save('correcting', true);
} else {
this.insertIntoTextArea('', true);
this.insertIntoTextArea('', true, false);
}
},
@ -989,7 +989,7 @@
}
message = message || this.getOwnMessages().findLast((msg) => msg.get('message'));
if (message) {
this.insertIntoTextArea(message.get('message'), true);
this.insertIntoTextArea(message.get('message'), true, true);
message.save('correcting', true);
}
},
@ -1010,7 +1010,7 @@
return this;
},
insertIntoTextArea (value, replace=false) {
insertIntoTextArea (value, replace=false, correcting=false) {
const textarea = this.el.querySelector('.chat-textarea');
if (replace) {
textarea.value = value;
@ -1021,6 +1021,11 @@
}
textarea.value = existing+value+' ';
}
if (correcting) {
u.addClass('correcting', textarea);
} else {
u.removeClass('correcting', textarea);
}
textarea.focus()
},

View File

@ -154,10 +154,10 @@
// Refer to docs/source/configuration.rst for explanations of these
// configuration settings.
_converse.api.settings.update({
auto_list_rooms: false,
hide_muc_server: false, // TODO: no longer implemented...
muc_disable_moderator_commands: false,
visible_toolbar_buttons: {
'auto_list_rooms': false,
'hide_muc_server': false, // TODO: no longer implemented...
'muc_disable_moderator_commands': false,
'visible_toolbar_buttons': {
'toggle_occupants': true
}
});