Commit 253c4d73 authored by JC Brand's avatar JC Brand

Focus the textarea after toggling between spoiler or not

parent 19d9e281
...@@ -280,7 +280,7 @@ ...@@ -280,7 +280,7 @@
_.extend(this.model.toJSON(), { _.extend(this.model.toJSON(), {
'allow_spoiler_messages': _converse.allow_spoiler_messages, 'allow_spoiler_messages': _converse.allow_spoiler_messages,
'label_personal_message': placeholder, 'label_personal_message': placeholder,
'label_spoiler_hint': __('Optional spoiler hint'), 'label_spoiler_hint': __('Optional hint'),
'label_send': __('Send'), 'label_send': __('Send'),
'show_send_button': _converse.show_send_button, 'show_send_button': _converse.show_send_button,
'show_textarea': true, 'show_textarea': true,
...@@ -290,6 +290,10 @@ ...@@ -290,6 +290,10 @@
})); }));
}, },
afterRender () {
this.renderToolbar();
},
renderToolbar (toolbar, options) { renderToolbar (toolbar, options) {
if (!_converse.show_toolbar) { if (!_converse.show_toolbar) {
return this; return this;
...@@ -303,10 +307,6 @@ ...@@ -303,10 +307,6 @@
return this; return this;
}, },
afterRender () {
this.renderToolbar();
},
getToolbarOptions (options) { getToolbarOptions (options) {
return _.extend(options || {}, { return _.extend(options || {}, {
'allow_spoiler_messages': _converse.allow_spoiler_messages, 'allow_spoiler_messages': _converse.allow_spoiler_messages,
...@@ -335,6 +335,7 @@ ...@@ -335,6 +335,7 @@
this.model.toJSON(), {'title': spoiler_title}) this.model.toJSON(), {'title': spoiler_title})
) )
this.render(); this.render();
this.parent.focus();
} }
}); });
...@@ -390,6 +391,7 @@ ...@@ -390,6 +391,7 @@
this.message_form_view = new _converse.ChatBoxMessageForm({ this.message_form_view = new _converse.ChatBoxMessageForm({
'model': new Backbone.Model() 'model': new Backbone.Model()
}); });
this.message_form_view.parent = this;
this.message_form_view.render(); this.message_form_view.render();
this.content.insertAdjacentElement( this.content.insertAdjacentElement(
'afterEnd', 'afterEnd',
......
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
Strophe.addNamespace('ROSTERX', 'http://jabber.org/protocol/rosterx'); Strophe.addNamespace('ROSTERX', 'http://jabber.org/protocol/rosterx');
Strophe.addNamespace('RSM', 'http://jabber.org/protocol/rsm'); Strophe.addNamespace('RSM', 'http://jabber.org/protocol/rsm');
Strophe.addNamespace('SID', 'urn:xmpp:sid:0'); Strophe.addNamespace('SID', 'urn:xmpp:sid:0');
Strophe.addNamespace('SPOILER', 'urn:xmpp:spoiler:0');
Strophe.addNamespace('XFORM', 'jabber:x:data'); Strophe.addNamespace('XFORM', 'jabber:x:data');
// Use Mustache style syntax for variable interpolation // Use Mustache style syntax for variable interpolation
......
...@@ -5,12 +5,6 @@ ...@@ -5,12 +5,6 @@
], factory); ], factory);
}(this, function (converse) { }(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. // The following line registers your plugin.
converse.plugins.add("converse-spoilers", { converse.plugins.add("converse-spoilers", {
/* Optional dependencies are other plugins which might be /* Optional dependencies are other plugins which might be
...@@ -34,7 +28,6 @@ ...@@ -34,7 +28,6 @@
// //
// New functions which don't exist yet can also be added. // New functions which don't exist yet can also be added.
'ChatBoxView': { 'ChatBoxView': {
toggleSpoilerMessage (event) { toggleSpoilerMessage (event) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment