Fix loading button text getting stuck after command send
This commit is contained in:
parent
b2c4de90d6
commit
ed0a596b27
1 changed files with 6 additions and 2 deletions
|
|
@ -121,11 +121,15 @@
|
||||||
btn.classList.toggle('is-loading', loading);
|
btn.classList.toggle('is-loading', loading);
|
||||||
if (label) {
|
if (label) {
|
||||||
if (loading) {
|
if (loading) {
|
||||||
btn.dataset.originalText = btn.textContent;
|
if (!btn.dataset.originalText) btn.dataset.originalText = btn.textContent;
|
||||||
btn.textContent = label;
|
btn.textContent = label;
|
||||||
} else {
|
} else {
|
||||||
btn.textContent = btn.dataset.originalText || btn.textContent;
|
btn.textContent = btn.dataset.originalText || label || btn.textContent;
|
||||||
|
delete btn.dataset.originalText;
|
||||||
}
|
}
|
||||||
|
} else if (!loading && btn.dataset.originalText) {
|
||||||
|
btn.textContent = btn.dataset.originalText;
|
||||||
|
delete btn.dataset.originalText;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue