mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-25 06:46:26 +00:00
Move image-paste blocking to transfer handler match function
By not matching, we allow other types of paste to happen, e.g. HTML/plain text. Bug: T142622 Change-Id: I3a2224ab23b5073eb7b031134ecc3170ccc782c0
This commit is contained in:
parent
f071b0380d
commit
56c56e81fe
|
@ -36,6 +36,13 @@ ve.ui.MWMediaTransferHandler.static.types = [ 'image/jpeg', 'image/png', 'image/
|
||||||
|
|
||||||
ve.ui.MWMediaTransferHandler.static.extensions = [ 'jpg', 'jpeg', 'png', 'gif', 'svg' ];
|
ve.ui.MWMediaTransferHandler.static.extensions = [ 'jpg', 'jpeg', 'png', 'gif', 'svg' ];
|
||||||
|
|
||||||
|
ve.ui.MWMediaTransferHandler.static.matchFunction = function ( item ) {
|
||||||
|
var file = item.getAsFile();
|
||||||
|
// If file is null, return true as the data is not available yet from the browser.
|
||||||
|
// If file is a non-File (pasted Blob), return false as this is not yet supported.
|
||||||
|
return !file || file instanceof File;
|
||||||
|
};
|
||||||
|
|
||||||
/* Methods */
|
/* Methods */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -45,11 +52,9 @@ ve.ui.MWMediaTransferHandler.prototype.process = function () {
|
||||||
var action,
|
var action,
|
||||||
file = this.item.getAsFile();
|
file = this.item.getAsFile();
|
||||||
|
|
||||||
// File upload doesn't support pasted Blobs yet
|
action = ve.ui.actionFactory.create( 'window', this.surface );
|
||||||
if ( file instanceof File ) {
|
action.open( 'media', { file: file } );
|
||||||
action = ve.ui.actionFactory.create( 'window', this.surface );
|
|
||||||
action.open( 'media', { file: file } );
|
|
||||||
}
|
|
||||||
this.insertableDataDeferred.reject();
|
this.insertableDataDeferred.reject();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue