mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Fix sprite upload replace existing
- Also fix form not resetting on cancel of replace popup
This commit is contained in:
@ -1739,12 +1739,13 @@ async function onClickExpressionUpload(event) {
|
||||
});
|
||||
}
|
||||
|
||||
spriteName = null;
|
||||
const suggestedSpriteName = generateUniqueSpriteName(expression, existingFiles);
|
||||
|
||||
const message = await renderExtensionTemplateAsync(MODULE_NAME, 'templates/upload-expression', { expression, clickedFileName });
|
||||
|
||||
spriteName = generateUniqueSpriteName(expression, existingFiles);
|
||||
|
||||
const input = await Popup.show.input(t`Upload Expression Sprite`, message,
|
||||
spriteName, { customButtons: customButtons });
|
||||
suggestedSpriteName, { customButtons: customButtons });
|
||||
|
||||
if (input) {
|
||||
if (!validateExpressionSpriteName(expression, input)) {
|
||||
@ -1752,8 +1753,6 @@ async function onClickExpressionUpload(event) {
|
||||
return;
|
||||
}
|
||||
spriteName = input;
|
||||
} else {
|
||||
spriteName = null;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -1762,6 +1761,8 @@ async function onClickExpressionUpload(event) {
|
||||
|
||||
if (!spriteName) {
|
||||
toastr.warning(t`Cancelled uploading sprite.`, t`Upload Cancelled`);
|
||||
// Reset the input
|
||||
e.target.form.reset();
|
||||
return;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user