0
0
Fork 0

Reset preview image if avatar/header image selection was cancelled (#4893)

This commit is contained in:
unarist 2017-09-11 23:19:54 +09:00 committed by Eugen Rochko
parent 3018043fc2
commit 47d48fed8d
2 changed files with 4 additions and 4 deletions

View file

@ -124,7 +124,7 @@ function main() {
delegate(document, '#account_avatar', 'change', ({ target }) => {
const avatar = document.querySelector('.card.compact .avatar img');
const [file] = target.files || [];
const url = URL.createObjectURL(file);
const url = file ? URL.createObjectURL(file) : avatar.dataset.originalSrc;
avatar.src = url;
});
@ -132,7 +132,7 @@ function main() {
delegate(document, '#account_header', 'change', ({ target }) => {
const header = document.querySelector('.card.compact');
const [file] = target.files || [];
const url = URL.createObjectURL(file);
const url = file ? URL.createObjectURL(file) : header.dataset.originalSrc;
header.style.backgroundImage = `url(${url})`;
});