Update texture name when choosing file again

This commit is contained in:
gplane 2017-04-20 23:46:06 +08:00
parent 7dcc1eb87e
commit e3e70a59e6

View File

@ -156,7 +156,11 @@ function handleFiles(files, type) {
img.onload = () => {
(type == "skin") ? MSP.changeSkin(img.src) : MSP.changeCape(img.src);
$('#name').val($('#name').val() == "" ? file.name.split('.png')[0] : $('#name').val());
let domTextureName = $('#name');
if (domTextureName.val() === '' || domTextureName.val() === domTextureName.attr('data-last-file-name')) {
domTextureName.attr('data-last-file-name', file.name);
domTextureName.val(file.name);
}
};
img.onerror = () => toastr.warning(trans('skinlib.fileExtError'));