Skip to content

Commit

Permalink
Bugfix: shouldn't change icon without update
Browse files Browse the repository at this point in the history
  • Loading branch information
jadeydi committed May 27, 2019
1 parent 9d6da38 commit a484322
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/client/index.js
Expand Up @@ -158,6 +158,7 @@ App.prototype = {
$('.icon.chooser').on('click', function () {
$('input[type=file]').trigger('click');
});
var change = false;
$('input[type=file]').on('change', function () {
var reader = new FileReader();
reader.addEventListener("load", function (event) {
Expand All @@ -167,13 +168,16 @@ App.prototype = {
}, false);
var file = this.files[0];
if (file) {
change = true;
reader.readAsDataURL(file);
}
});
$('input[type=submit]').on('click', function (event) {
event.preventDefault();
croppie.result({type: 'base64', size: {width: 512, height: 512}}).then(function(base64) {
$('input[name=icon_base64]').val(base64.substring(22));
if (change) {
$('input[name=icon_base64]').val(base64.substring(22));
}
$('form').submit();
});
});
Expand Down

0 comments on commit a484322

Please sign in to comment.