Only allow image upload in onlyoffice

pull/1/head
yflory 5 years ago
parent 6fd079bfb0
commit cdbe4ed8eb

@ -831,7 +831,11 @@ define([
APP.AddImageErrorCallback = cb2; APP.AddImageErrorCallback = cb2;
common.openFilePicker({ common.openFilePicker({
types: ['file'], types: ['file'],
where: ['root'] where: ['root'],
filter: {
fileType: ['image/']
}
}); });
}; };

@ -111,6 +111,16 @@ define([
//If file, display the upload button //If file, display the upload button
if (types.indexOf('file') !== -1 && common.isLoggedIn()) { if (types.indexOf('file') !== -1 && common.isLoggedIn()) {
var f = (filters && filters.filter) || {};
delete data.accept;
if (f.fileType) {
data.accept = f.fileType.map(function (val) {
if (/^[a-z]+\/$/.test(val)) {
val += '*';
}
return val;
});
}
$filter.append(common.createButton('upload', false, data)); $filter.append(common.createButton('upload', false, data));
} }

Loading…
Cancel
Save