fix: Issues #225 done.

This commit is contained in:
chiayin
2024-03-05 11:02:36 +08:00
parent e8af9f93ec
commit b37e452a73
2 changed files with 19 additions and 4 deletions

View File

@@ -18,3 +18,8 @@
.h-screen-main { .h-screen-main {
height: calc(100vh - 104px); height: calc(100vh - 104px);
} }
/* button */
.disable-hover {
@apply pointer-events-none
}

View File

@@ -316,10 +316,6 @@ export async function renameModal(rename, type, id, baseName) {
inputAttributes: { inputAttributes: {
'maxlength': 200, 'maxlength': 200,
}, },
inputValidator: value => {
if(!value) return 'You need to write something!';
fileName = value;
},
icon: 'info', icon: 'info',
iconHtml: '<span class="material-symbols-outlined !text-[58px]">edit_square</span>', iconHtml: '<span class="material-symbols-outlined !text-[58px]">edit_square</span>',
iconColor: '#0099FF', iconColor: '#0099FF',
@@ -327,6 +323,20 @@ export async function renameModal(rename, type, id, baseName) {
confirmButtonColor: '#0099FF', confirmButtonColor: '#0099FF',
showCancelButton: '#94a3b8', showCancelButton: '#94a3b8',
customClass: customClass, customClass: customClass,
didOpen: () => {
const confirmButton = Swal.getConfirmButton();
const inputField = Swal.getInput();
inputField.addEventListener('input', function() {
if (!inputField.value.trim()) {
confirmButton.classList.add('disable-hover');
confirmButton.disabled = true;
} else {
confirmButton.classList.remove('disable-hover');
confirmButton.disabled = false;
}
});
}
}); });
// 改名成功 // 改名成功