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 @@
_.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',
......
......@@ -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
......
......@@ -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) {
......
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