1
0
mirror of https://github.com/moparisthebest/kaiwa synced 2024-08-13 17:03:51 -04:00

Resume writing a message

This commit is contained in:
Sebastien Hut 2015-02-09 15:27:16 +01:00
parent 9e06b50fd3
commit d150096ad9
3 changed files with 9 additions and 0 deletions

View File

@ -46,6 +46,7 @@ module.exports = {
app.cache = new AppCache();
app.storage = new Storage();
app.storage.open(cb);
app.composing = {};
app.mucInfos = [];
},
function (cb) {

View File

@ -52,6 +52,7 @@ module.exports = BasePage.extend({
show: function (animation) {
BasePage.prototype.show.apply(this, [animation]);
this.sendChatState('active');
this.$chatInput.focus();
},
hide: function () {
BasePage.prototype.hide.apply(this);
@ -66,6 +67,7 @@ module.exports = BasePage.extend({
this.renderAndBind();
this.$chatInput = this.$('.chatBox textarea');
this.$chatInput.val(app.composing[this.model.jid] || '');
this.$chatBox = this.$('.chatBox');
this.$messageList = this.$('.messages');
@ -105,6 +107,7 @@ module.exports = BasePage.extend({
},
handleKeyDown: function (e) {
if (e.which === 13 && !e.shiftKey) {
app.composing[this.model.jid] = '';
this.sendChat();
e.preventDefault();
return false;
@ -130,6 +133,7 @@ module.exports = BasePage.extend({
},
handleKeyUp: function (e) {
//this.resizeInput();
app.composing[this.model.jid] = this.$chatInput.val();
if (this.typing && this.$chatInput.val().length === 0) {
this.typing = false;
this.$chatInput.removeClass('typing');

View File

@ -48,6 +48,7 @@ module.exports = BasePage.extend({
to: this.model.jid,
chatState: 'active'
});
this.$chatInput.focus();
},
hide: function () {
BasePage.prototype.hide.apply(this);
@ -63,6 +64,7 @@ module.exports = BasePage.extend({
this.renderAndBind();
this.$chatInput = this.$('.chatBox textarea');
this.$chatInput.val(app.composing[this.model.jid] || '');
this.$chatBox = this.$('.chatBox');
this.$messageList = this.$('.messages');
@ -96,6 +98,7 @@ module.exports = BasePage.extend({
},
handleKeyDown: function (e) {
if (e.which === 13 && !e.shiftKey) {
app.composing[this.model.jid] = '';
this.sendChat();
e.preventDefault();
return false;
@ -124,6 +127,7 @@ module.exports = BasePage.extend({
},
handleKeyUp: function (e) {
//this.resizeInput();
app.composing[this.model.jid] = this.$chatInput.val();
if (this.typing && this.$chatInput.val().length === 0) {
this.typing = false;
this.paused = false;