|
@@ -296,7 +296,9 @@ converse.plugins.add('converse-chatview', {
|
|
'click .toggle-smiley': 'toggleEmojiMenu',
|
|
'click .toggle-smiley': 'toggleEmojiMenu',
|
|
'click .upload-file': 'toggleFileUpload',
|
|
'click .upload-file': 'toggleFileUpload',
|
|
'input .chat-textarea': 'inputChanged',
|
|
'input .chat-textarea': 'inputChanged',
|
|
- 'keydown .chat-textarea': 'keyPressed'
|
|
|
|
|
|
+ 'keydown .chat-textarea': 'keyPressed',
|
|
|
|
+ 'dragover .chat-textarea': 'onDragOver',
|
|
|
|
+ 'drop .chat-textarea': 'onDrop',
|
|
},
|
|
},
|
|
|
|
|
|
initialize () {
|
|
initialize () {
|
|
@@ -398,6 +400,20 @@ converse.plugins.add('converse-chatview', {
|
|
this.model.sendFiles(evt.target.files);
|
|
this.model.sendFiles(evt.target.files);
|
|
},
|
|
},
|
|
|
|
|
|
|
|
+ onDragOver (evt) {
|
|
|
|
+ evt.preventDefault();
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ onDrop (evt) {
|
|
|
|
+ /* There are no files to be dropped, this isn’t a file transfer
|
|
|
|
+ * operation.
|
|
|
|
+ */
|
|
|
|
+ if (evt.dataTransfer.files.length == 0)
|
|
|
|
+ return;
|
|
|
|
+ evt.preventDefault();
|
|
|
|
+ this.model.sendFiles(evt.dataTransfer.files);
|
|
|
|
+ },
|
|
|
|
+
|
|
async addFileUploadButton (options) {
|
|
async addFileUploadButton (options) {
|
|
const result = await _converse.api.disco.supports(Strophe.NS.HTTPUPLOAD, _converse.domain);
|
|
const result = await _converse.api.disco.supports(Strophe.NS.HTTPUPLOAD, _converse.domain);
|
|
if (result.length) {
|
|
if (result.length) {
|