mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-27 22:49:56 -05:00
Added "file" fileType
to lexical uploader
refs https://github.com/TryGhost/Team/issues/2634 Added suport for type "file" which refers to basically any non-specific file type for use on the file card. Bypasses validation when a file gets uploaded.
This commit is contained in:
parent
234853aebf
commit
a057a4cb3d
1 changed files with 8 additions and 0 deletions
|
@ -31,6 +31,10 @@ export const fileTypes = {
|
|||
endpoint: '/media/thumbnail/upload/',
|
||||
requestMethod: 'put',
|
||||
resourceName: 'media'
|
||||
},
|
||||
file: {
|
||||
endpoint: '/files/upload/',
|
||||
resourceName: 'files'
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -177,6 +181,10 @@ export default class KoenigLexicalEditor extends Component {
|
|||
// we only check the file extension by default because IE doesn't always
|
||||
// expose the mime-type, we'll rely on the API for final validation
|
||||
function defaultValidator(file) {
|
||||
// if type is file we don't need to validate since the card can accept any file type
|
||||
if (type === 'file') {
|
||||
return true;
|
||||
}
|
||||
let extensions = fileTypes[type].extensions;
|
||||
let [, extension] = (/(?:\.([^.]+))?$/).exec(file.name);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue