|
@@ -20,11 +20,11 @@
|
|
"tpl!help_message",
|
|
"tpl!help_message",
|
|
"tpl!info",
|
|
"tpl!info",
|
|
"tpl!new_day",
|
|
"tpl!new_day",
|
|
|
|
+ "tpl!toolbar_fileupload",
|
|
"tpl!spinner",
|
|
"tpl!spinner",
|
|
"tpl!spoiler_button",
|
|
"tpl!spoiler_button",
|
|
"tpl!status_message",
|
|
"tpl!status_message",
|
|
"tpl!toolbar",
|
|
"tpl!toolbar",
|
|
- "converse-http-file-upload",
|
|
|
|
"converse-chatboxes",
|
|
"converse-chatboxes",
|
|
"converse-message-view"
|
|
"converse-message-view"
|
|
], factory);
|
|
], factory);
|
|
@@ -43,6 +43,7 @@
|
|
tpl_help_message,
|
|
tpl_help_message,
|
|
tpl_info,
|
|
tpl_info,
|
|
tpl_new_day,
|
|
tpl_new_day,
|
|
|
|
+ tpl_toolbar_fileupload,
|
|
tpl_spinner,
|
|
tpl_spinner,
|
|
tpl_spoiler_button,
|
|
tpl_spoiler_button,
|
|
tpl_status_message,
|
|
tpl_status_message,
|
|
@@ -240,15 +241,17 @@
|
|
is_chatroom: false, // Leaky abstraction from MUC
|
|
is_chatroom: false, // Leaky abstraction from MUC
|
|
|
|
|
|
events: {
|
|
events: {
|
|
|
|
+ 'change input.fileupload': 'onFileSelection',
|
|
'click .close-chatbox-button': 'close',
|
|
'click .close-chatbox-button': 'close',
|
|
'click .new-msgs-indicator': 'viewUnreadMessages',
|
|
'click .new-msgs-indicator': 'viewUnreadMessages',
|
|
'click .send-button': 'onFormSubmitted',
|
|
'click .send-button': 'onFormSubmitted',
|
|
'click .toggle-call': 'toggleCall',
|
|
'click .toggle-call': 'toggleCall',
|
|
'click .toggle-clear': 'clearMessages',
|
|
'click .toggle-clear': 'clearMessages',
|
|
|
|
+ 'click .toggle-compose-spoiler': 'toggleComposeSpoilerMessage',
|
|
'click .toggle-smiley ul.emoji-picker li': 'insertEmoji',
|
|
'click .toggle-smiley ul.emoji-picker li': 'insertEmoji',
|
|
'click .toggle-smiley': 'toggleEmojiMenu',
|
|
'click .toggle-smiley': 'toggleEmojiMenu',
|
|
'click .toggle-spoiler': 'toggleSpoilerMessage',
|
|
'click .toggle-spoiler': 'toggleSpoilerMessage',
|
|
- 'click .toggle-compose-spoiler': 'toggleComposeSpoilerMessage',
|
|
|
|
|
|
+ 'click .upload-file': 'toggleFileUpload',
|
|
'keypress .chat-textarea': 'keyPressed'
|
|
'keypress .chat-textarea': 'keyPressed'
|
|
},
|
|
},
|
|
|
|
|
|
@@ -296,6 +299,7 @@
|
|
);
|
|
);
|
|
this.el.querySelector('.chat-toolbar').innerHTML = toolbar(options);
|
|
this.el.querySelector('.chat-toolbar').innerHTML = toolbar(options);
|
|
this.addSpoilerButton(options);
|
|
this.addSpoilerButton(options);
|
|
|
|
+ this.addFileUploadButton();
|
|
this.insertEmojiPicker();
|
|
this.insertEmojiPicker();
|
|
return this;
|
|
return this;
|
|
},
|
|
},
|
|
@@ -322,6 +326,22 @@
|
|
this.renderToolbar();
|
|
this.renderToolbar();
|
|
},
|
|
},
|
|
|
|
|
|
|
|
+ toggleFileUpload (ev) {
|
|
|
|
+ this.el.querySelector('input.fileupload').click();
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ onFileSelection (evt) {
|
|
|
|
+ this.model.sendFiles(evt.target.files);
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ addFileUploadButton (options) {
|
|
|
|
+ _converse.api.disco.supports(Strophe.NS.HTTPUPLOAD, _converse.domain).then((result) => {
|
|
|
|
+ this.el.querySelector('.chat-toolbar').insertAdjacentHTML(
|
|
|
|
+ 'beforeend',
|
|
|
|
+ tpl_toolbar_fileupload({'tooltip_upload_file': __('Choose a file to send')}));
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+
|
|
addSpoilerButton (options) {
|
|
addSpoilerButton (options) {
|
|
/* Asynchronously adds a button for writing spoiler
|
|
/* Asynchronously adds a button for writing spoiler
|
|
* messages, based on whether the contact's client supports
|
|
* messages, based on whether the contact's client supports
|