Improve passing of inline dropped file through to vala !343
This commit is contained in:
parent
34664c4178
commit
fa430cac5d
2 changed files with 38 additions and 32 deletions
|
|
@ -398,9 +398,16 @@ ComposerPageState.prototype = {
|
|||
|
||||
const reader = new FileReader();
|
||||
reader.onload = (function(filename, imageType) { return function(loadEvent) {
|
||||
window.webkit.messageHandlers.dragDropReceived.postMessage(
|
||||
encodeURIComponent(filename) + "," + imageType + "," + loadEvent.target.result
|
||||
);
|
||||
// Remove prefixed file type and encoding type
|
||||
var parts = loadEvent.target.result.split(",");
|
||||
if (parts.length < 2)
|
||||
return;
|
||||
|
||||
window.webkit.messageHandlers.dragDropReceived.postMessage({
|
||||
fileName: encodeURIComponent(filename),
|
||||
fileType: imageType,
|
||||
content: parts[1]
|
||||
});
|
||||
}; })(file.name, file.type);
|
||||
reader.readAsDataURL(file);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue