Expose importing dropped images for consistent import
This commit is contained in:
parent
f69aa07ec1
commit
01e38be408
|
@ -6765,6 +6765,22 @@ function connectAPISlash(_, text) {
|
|||
toastr.info(`API set to ${text}, trying to connect..`);
|
||||
}
|
||||
|
||||
export function processDroppedFiles(files) {
|
||||
const allowedMimeTypes = [
|
||||
'application/json',
|
||||
'image/png',
|
||||
'image/webp',
|
||||
];
|
||||
|
||||
for (const file of files) {
|
||||
if (allowedMimeTypes.includes(file.type)) {
|
||||
importCharacter(file);
|
||||
} else {
|
||||
toastr.warning('Unsupported file type: ' + file.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function importCharacter(file) {
|
||||
const ext = file.name.match(/\.(\w+)$/);
|
||||
if (
|
||||
|
@ -8810,21 +8826,6 @@ jQuery(async function () {
|
|||
processDroppedFiles(files);
|
||||
});
|
||||
|
||||
function processDroppedFiles(files) {
|
||||
const allowedMimeTypes = [
|
||||
'application/json',
|
||||
'image/png',
|
||||
'image/webp',
|
||||
];
|
||||
|
||||
for (const file of files) {
|
||||
if (allowedMimeTypes.includes(file.type)) {
|
||||
importCharacter(file);
|
||||
} else {
|
||||
toastr.warning('Unsupported file type: ' + file.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$("#charListGridToggle").on('click', async () => {
|
||||
doCharListDisplaySwitch();
|
||||
|
|
Loading…
Reference in New Issue