Focus the textarea after toggling between spoiler or not

This commit is contained in:
JC Brand 2018-02-05 21:42:29 +01:00
parent 19d9e281ae
commit 253c4d736e
3 changed files with 8 additions and 12 deletions

View File

@ -280,7 +280,7 @@
_.extend(this.model.toJSON(), {
'allow_spoiler_messages': _converse.allow_spoiler_messages,
'label_personal_message': placeholder,
'label_spoiler_hint': __('Optional spoiler hint'),
'label_spoiler_hint': __('Optional hint'),
'label_send': __('Send'),
'show_send_button': _converse.show_send_button,
'show_textarea': true,
@ -290,6 +290,10 @@
}));
},
afterRender () {
this.renderToolbar();
},
renderToolbar (toolbar, options) {
if (!_converse.show_toolbar) {
return this;
@ -303,10 +307,6 @@
return this;
},
afterRender () {
this.renderToolbar();
},
getToolbarOptions (options) {
return _.extend(options || {}, {
'allow_spoiler_messages': _converse.allow_spoiler_messages,
@ -335,6 +335,7 @@
this.model.toJSON(), {'title': spoiler_title})
)
this.render();
this.parent.focus();
}
});
@ -390,6 +391,7 @@
this.message_form_view = new _converse.ChatBoxMessageForm({
'model': new Backbone.Model()
});
this.message_form_view.parent = this;
this.message_form_view.render();
this.content.insertAdjacentElement(
'afterEnd',

View File

@ -44,6 +44,7 @@
Strophe.addNamespace('ROSTERX', 'http://jabber.org/protocol/rosterx');
Strophe.addNamespace('RSM', 'http://jabber.org/protocol/rsm');
Strophe.addNamespace('SID', 'urn:xmpp:sid:0');
Strophe.addNamespace('SPOILER', 'urn:xmpp:spoiler:0');
Strophe.addNamespace('XFORM', 'jabber:x:data');
// Use Mustache style syntax for variable interpolation

View File

@ -5,12 +5,6 @@
], factory);
}(this, function (converse) {
const { _, Strophe } = converse.env;
const u = converse.env.utils;
Strophe.addNamespace('SPOILER', 'urn:xmpp:spoiler:0');
// The following line registers your plugin.
converse.plugins.add("converse-spoilers", {
/* Optional dependencies are other plugins which might be
@ -34,7 +28,6 @@
//
// New functions which don't exist yet can also be added.
'ChatBoxView': {
toggleSpoilerMessage (event) {