From d17b7dbb9e4725a273da83f5c567fe27a8a090bc Mon Sep 17 00:00:00 2001 From: Vasily Belosludcev Date: Mon, 22 May 2017 14:59:54 +0500 Subject: [PATCH] fixed uploaded bug --- CHANGELOG.md | 5 +++++ composer.json | 2 +- src/resources/cropbox.js | 1 - src/resources/cropbox.min.js | 4 ++-- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7ad47c3..c28941f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ yii2-widget-cropbox =================== +v5.1.1 [2017-05-22] +------------------- + +- Fixed uploaded bug. + v5.1.0 [2017-05-20] ------------------- diff --git a/composer.json b/composer.json index 3b9d32e..4a3872d 100644 --- a/composer.json +++ b/composer.json @@ -3,7 +3,7 @@ "description": "This is widget wrapper of https://github.com/bupy7/js-cropbox. This widget allows crop image before to upload to server and send informations about crop as JSON string.", "keywords": ["yii2", "extension", "widget", "crop", "image"], "homepage": "https://github.com/bupy7/yii2-widget-cropbox", - "version": "5.1.0", + "version": "5.1.1", "type": "yii2-extension", "license": "BSD-3-Clause", "authors": [ diff --git a/src/resources/cropbox.js b/src/resources/cropbox.js index 7e74bca..377355e 100644 --- a/src/resources/cropbox.js +++ b/src/resources/cropbox.js @@ -62,7 +62,6 @@ fileReader.readAsDataURL(this.files[0]); fileReader.onload = function(event) { $th.cropbox('load', event.target.result); - $(s.fileInput).val(null); }; }); // reset diff --git a/src/resources/cropbox.min.js b/src/resources/cropbox.min.js index ab3685f..cba4b92 100644 --- a/src/resources/cropbox.min.js +++ b/src/resources/cropbox.min.js @@ -1,8 +1,8 @@ !function(e,t){"use strict" function o(t,o){function n(){e(t.croppedContainer).html(""),e(t.croppedDataInput).val("")}function a(){e(t.btnScaleIn).attr("disabled","disabled"),e(t.btnScaleOut).attr("disabled","disabled"),e(t.btnCrop).attr("disabled","disabled")}function r(n){var a=0 void 0===c.data("mi-cropbox")||n||(a=c.data("mi-cropbox")),void 0!==o[a]?e(t.messageContainer).html(o[a]).show():e(t.messageContainer).hide(),c.data("mi-cropbox",++a)}var c=e(this) -e(t.btnScaleIn).on("click",function(){c.cropbox("scale",1.05)}),e(t.btnScaleOut).on("click",function(){c.cropbox("scale",.95)}),e(c.cropbox("getMembrane")).on("wheel",function(e){e.originalEvent.deltaY<0?c.cropbox("scale",1.01):c.cropbox("scale",.99),e.preventDefault&&e.preventDefault()}),e(t.fileInput).on("change",function(){var o=new FileReader -o.readAsDataURL(this.files[0]),o.onload=function(o){c.cropbox("load",o.target.result),e(t.fileInput).val(null)}}),e(t.btnReset).on("click",function(){c.cropbox("reset")}),e(t.btnCrop).on("click",function(){c.cropbox("crop")}),c.on("cb:cropped",function(o){var n=e("",{src:o.detail.data.image,"class":"img-thumbnail"}) +e(t.btnScaleIn).on("click",function(){c.cropbox("scale",1.05)}),e(t.btnScaleOut).on("click",function(){c.cropbox("scale",.95)}),e(c.cropbox("getMembrane")).on("wheel",function(e){e.originalEvent.deltaY<0?c.cropbox("scale",1.01):c.cropbox("scale",.99),e.preventDefault&&e.preventDefault()}),e(t.fileInput).on("change",function(){var e=new FileReader +e.readAsDataURL(this.files[0]),e.onload=function(e){c.cropbox("load",e.target.result)}}),e(t.btnReset).on("click",function(){c.cropbox("reset")}),e(t.btnCrop).on("click",function(){c.cropbox("crop")}),c.on("cb:cropped",function(o){var n=e("",{src:o.detail.data.image,"class":"img-thumbnail"}) e(t.croppedContainer).append(n),e(t.croppedDataInput).val(JSON.stringify(c.cropbox("getData")))}),c.on("cb:reset",n),c.on("cb:ready",n),a(),c.on("cb:disabledCtrls",a),c.on("cb:enabledCtrls",function(){e(t.btnScaleIn).removeAttr("disabled"),e(t.btnScaleOut).removeAttr("disabled"),e(t.btnCrop).removeAttr("disabled")}),c.on("cb:cropped",function(){r()}),e(t.fileInput).on("change",function(){r(!0)}),c.on("cb:reset",function(){e(t.messageContainer).hide()})}e.fn.cropbox=function(n){if("string"==typeof n){var a=n.replace(/^[_]*/,"") if(t.prototype[a]){var r=e(this).data("cropbox") return r[a].apply(r,Array.prototype.slice.call(arguments,1))}}else{if("object"==typeof n||!n){var c=n.selectors,i=n.messages||[]