Fixed file paste in IE
This commit is contained in:
parent
a87ae20055
commit
9830340ef8
@ -1119,7 +1119,7 @@ angular.module('myApp.directives', ['myApp.filters'])
|
||||
return sendOnEnter;
|
||||
},
|
||||
onMessageSubmit: onMessageSubmit,
|
||||
onFilesPaste: onFilesPaste
|
||||
onFilePaste: onFilePaste
|
||||
});
|
||||
|
||||
var richTextarea = composer.richTextareaEl[0];
|
||||
@ -1223,9 +1223,9 @@ angular.module('myApp.directives', ['myApp.filters'])
|
||||
});
|
||||
}
|
||||
|
||||
function onFilesPaste (blobs) {
|
||||
function onFilePaste (blob) {
|
||||
ErrorService.confirm({type: 'FILE_CLIPBOARD_PASTE'}).then(function () {
|
||||
$scope.draftMessage.files = blobs;
|
||||
$scope.draftMessage.files = [blob];
|
||||
$scope.draftMessage.isMedia = true;
|
||||
});
|
||||
};
|
||||
|
@ -438,6 +438,7 @@ function MessageComposer (textarea, options) {
|
||||
this.onTyping = options.onTyping;
|
||||
this.onMessageSubmit = options.onMessageSubmit;
|
||||
this.getSendOnEnter = options.getSendOnEnter;
|
||||
this.onFilePaste = options.onFilePaste;
|
||||
}
|
||||
|
||||
MessageComposer.prototype.setUpInput = function () {
|
||||
@ -673,7 +674,11 @@ MessageComposer.prototype.onRichPaste = function (e) {
|
||||
}
|
||||
}
|
||||
|
||||
var text = (e.originalEvent || e).clipboardData.getData('text/plain');
|
||||
try {
|
||||
var text = cData.getData('text/plain');
|
||||
} catch (e) {
|
||||
return true;
|
||||
}
|
||||
setZeroTimeout(this.onChange.bind(this), 0);
|
||||
if (text.length) {
|
||||
document.execCommand('insertText', false, text);
|
||||
@ -692,7 +697,7 @@ MessageComposer.prototype.onRichPasteNode = function (e) {
|
||||
var blob = dataUrlToBlob(src);
|
||||
this.onFilePaste(blob);
|
||||
setZeroTimeout(function () {
|
||||
element.parentNode.removeChild(element);
|
||||
element.parentNode.replaceChild(document.createTextNode(' '), element);
|
||||
})
|
||||
}
|
||||
else if (src && !src.match(/img\/blank\.gif/)) {
|
||||
|
@ -3710,7 +3710,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
|
||||
// console.log(3, text, html);
|
||||
|
||||
if (emojiFound) {
|
||||
text = text.replace(/\ufe0f/g, '', text);
|
||||
text = text.replace(/\ufe0f|️/g, '', text);
|
||||
text = text.replace(/<span class="emoji emoji-(\d)-(\d+)-(\d+)"(.+?)<\/span>/g,
|
||||
'<span class="emoji emoji-spritesheet-$1" style="background-position: -$2px -$3px;" $4</span>');
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user