From a484322cbf67a534e9985649c384a27675e52beb Mon Sep 17 00:00:00 2001 From: Li Yuqing Date: Tue, 28 May 2019 00:07:56 +0800 Subject: [PATCH] Bugfix: shouldn't change icon without update --- src/client/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/client/index.js b/src/client/index.js index 639e33745..a1248bd5c 100644 --- a/src/client/index.js +++ b/src/client/index.js @@ -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) { @@ -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(); }); });