Skip to content

Commit

Permalink
build: release 1.5.4
Browse files Browse the repository at this point in the history
  • Loading branch information
fengyuanchen committed Jul 20, 2019
1 parent 153f9e3 commit 6f9218d
Show file tree
Hide file tree
Showing 12 changed files with 861 additions and 451 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# Changelog

## next
## 1.5.4 (Jul 20, 2019)

- Avoid removing the events of the original image.
- Avoid requesting any Data URLs by XMLHttpRequest for better performance (#526).
- Add an `alt` attribute to all internal images for better accessibility (#548).
- Transform `enum`s to `type`s from the definition files for TypeScript (#550).

## 1.5.3 (Jul 10, 2019)

Expand Down
35 changes: 26 additions & 9 deletions dist/cropper.common.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/*!
* Cropper.js v1.5.3
* Cropper.js v1.5.4
* https://fengyuanchen.github.io/cropperjs
*
* Copyright 2015-present Chen Fengyuan
* Released under the MIT license
*
* Date: 2019-07-10T12:07:44.557Z
* Date: 2019-07-20T02:37:47.411Z
*/

'use strict';
Expand Down Expand Up @@ -119,6 +119,7 @@ var EVENT_ZOOM = 'zoom'; // Mime types
var MIME_TYPE_JPEG = 'image/jpeg'; // RegExps

var REGEXP_ACTIONS = /^e|w|s|n|se|sw|ne|nw|all|crop|move|zoom$/;
var REGEXP_DATA_URL = /^data:/;
var REGEXP_DATA_URL_JPEG = /^data:image\/jpeg;base64,/;
var REGEXP_TAG_NAME = /^img|canvas$/i; // Misc
// Inspired by the default width and height of a canvas element.
Expand Down Expand Up @@ -1520,16 +1521,19 @@ var render = {

var preview = {
initPreview: function initPreview() {
var crossOrigin = this.crossOrigin;
var element = this.element,
crossOrigin = this.crossOrigin;
var preview = this.options.preview;
var url = crossOrigin ? this.crossOriginUrl : this.url;
var alt = element.alt || 'The image to preview';
var image = document.createElement('img');

if (crossOrigin) {
image.crossOrigin = crossOrigin;
}

image.src = url;
image.alt = alt;
this.viewBox.appendChild(image);
this.viewBoxImage = image;

Expand All @@ -1540,7 +1544,7 @@ var preview = {
var previews = preview;

if (typeof preview === 'string') {
previews = this.element.ownerDocument.querySelectorAll(preview);
previews = element.ownerDocument.querySelectorAll(preview);
} else if (preview.querySelector) {
previews = [preview];
}
Expand All @@ -1560,6 +1564,7 @@ var preview = {
}

img.src = url;
img.alt = alt;
/**
* Override img element styles
* Add `display:block` to avoid margin top issue
Expand Down Expand Up @@ -3223,13 +3228,23 @@ function () {
if (!options.checkOrientation || !window.ArrayBuffer) {
this.clone();
return;
} // Read ArrayBuffer from Data URL of JPEG images directly for better performance.
} // Detect the mime type of the image directly if it is a Data URL


if (REGEXP_DATA_URL.test(url)) {
// Read ArrayBuffer from Data URL of JPEG images directly for better performance
if (REGEXP_DATA_URL_JPEG.test(url)) {
this.read(dataURLToArrayBuffer(url));
} else {
// Only a JPEG image may contains Exif Orientation information,
// the rest types of Data URLs are not necessary to check orientation at all.
this.clone();
}

if (REGEXP_DATA_URL_JPEG.test(url)) {
this.read(dataURLToArrayBuffer(url));
return;
}
} // 1. Detect the mime type of the image by a XMLHttpRequest.
// 2. Load the image as ArrayBuffer for reading orientation if its a JPEG image.


var xhr = new XMLHttpRequest();
var clone = this.clone.bind(this);
Expand All @@ -3244,6 +3259,7 @@ function () {
xhr.ontimeout = clone;

xhr.onprogress = function () {
// Abort the request directly if it not a JPEG image for better performance
if (xhr.getResponseHeader('content-type') !== MIME_TYPE_JPEG) {
xhr.abort();
}
Expand Down Expand Up @@ -3330,6 +3346,7 @@ function () {
}

image.src = crossOriginUrl || url;
image.alt = element.alt || 'The image to crop';
this.image = image;
image.onload = this.start.bind(this);
image.onerror = this.stop.bind(this);
Expand All @@ -3341,7 +3358,7 @@ function () {
value: function start() {
var _this2 = this;

var image = this.isImg ? this.element : this.image;
var image = this.image;
image.onload = null;
image.onerror = null;
this.sizing = true; // Match all browsers that use WebKit as the layout engine in iOS devices,
Expand Down
4 changes: 2 additions & 2 deletions dist/cropper.css
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/*!
* Cropper.js v1.5.3
* Cropper.js v1.5.4
* https://fengyuanchen.github.io/cropperjs
*
* Copyright 2015-present Chen Fengyuan
* Released under the MIT license
*
* Date: 2019-07-10T12:07:41.696Z
* Date: 2019-07-20T02:37:43.686Z
*/

.cropper-container {
Expand Down
35 changes: 26 additions & 9 deletions dist/cropper.esm.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/*!
* Cropper.js v1.5.3
* Cropper.js v1.5.4
* https://fengyuanchen.github.io/cropperjs
*
* Copyright 2015-present Chen Fengyuan
* Released under the MIT license
*
* Date: 2019-07-10T12:07:44.557Z
* Date: 2019-07-20T02:37:47.411Z
*/

function _typeof(obj) {
Expand Down Expand Up @@ -117,6 +117,7 @@ var EVENT_ZOOM = 'zoom'; // Mime types
var MIME_TYPE_JPEG = 'image/jpeg'; // RegExps

var REGEXP_ACTIONS = /^e|w|s|n|se|sw|ne|nw|all|crop|move|zoom$/;
var REGEXP_DATA_URL = /^data:/;
var REGEXP_DATA_URL_JPEG = /^data:image\/jpeg;base64,/;
var REGEXP_TAG_NAME = /^img|canvas$/i; // Misc
// Inspired by the default width and height of a canvas element.
Expand Down Expand Up @@ -1518,16 +1519,19 @@ var render = {

var preview = {
initPreview: function initPreview() {
var crossOrigin = this.crossOrigin;
var element = this.element,
crossOrigin = this.crossOrigin;
var preview = this.options.preview;
var url = crossOrigin ? this.crossOriginUrl : this.url;
var alt = element.alt || 'The image to preview';
var image = document.createElement('img');

if (crossOrigin) {
image.crossOrigin = crossOrigin;
}

image.src = url;
image.alt = alt;
this.viewBox.appendChild(image);
this.viewBoxImage = image;

Expand All @@ -1538,7 +1542,7 @@ var preview = {
var previews = preview;

if (typeof preview === 'string') {
previews = this.element.ownerDocument.querySelectorAll(preview);
previews = element.ownerDocument.querySelectorAll(preview);
} else if (preview.querySelector) {
previews = [preview];
}
Expand All @@ -1558,6 +1562,7 @@ var preview = {
}

img.src = url;
img.alt = alt;
/**
* Override img element styles
* Add `display:block` to avoid margin top issue
Expand Down Expand Up @@ -3221,13 +3226,23 @@ function () {
if (!options.checkOrientation || !window.ArrayBuffer) {
this.clone();
return;
} // Read ArrayBuffer from Data URL of JPEG images directly for better performance.
} // Detect the mime type of the image directly if it is a Data URL


if (REGEXP_DATA_URL.test(url)) {
// Read ArrayBuffer from Data URL of JPEG images directly for better performance
if (REGEXP_DATA_URL_JPEG.test(url)) {
this.read(dataURLToArrayBuffer(url));
} else {
// Only a JPEG image may contains Exif Orientation information,
// the rest types of Data URLs are not necessary to check orientation at all.
this.clone();
}

if (REGEXP_DATA_URL_JPEG.test(url)) {
this.read(dataURLToArrayBuffer(url));
return;
}
} // 1. Detect the mime type of the image by a XMLHttpRequest.
// 2. Load the image as ArrayBuffer for reading orientation if its a JPEG image.


var xhr = new XMLHttpRequest();
var clone = this.clone.bind(this);
Expand All @@ -3242,6 +3257,7 @@ function () {
xhr.ontimeout = clone;

xhr.onprogress = function () {
// Abort the request directly if it not a JPEG image for better performance
if (xhr.getResponseHeader('content-type') !== MIME_TYPE_JPEG) {
xhr.abort();
}
Expand Down Expand Up @@ -3328,6 +3344,7 @@ function () {
}

image.src = crossOriginUrl || url;
image.alt = element.alt || 'The image to crop';
this.image = image;
image.onload = this.start.bind(this);
image.onerror = this.stop.bind(this);
Expand All @@ -3339,7 +3356,7 @@ function () {
value: function start() {
var _this2 = this;

var image = this.isImg ? this.element : this.image;
var image = this.image;
image.onload = null;
image.onerror = null;
this.sizing = true; // Match all browsers that use WebKit as the layout engine in iOS devices,
Expand Down
35 changes: 26 additions & 9 deletions dist/cropper.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/*!
* Cropper.js v1.5.3
* Cropper.js v1.5.4
* https://fengyuanchen.github.io/cropperjs
*
* Copyright 2015-present Chen Fengyuan
* Released under the MIT license
*
* Date: 2019-07-10T12:07:44.557Z
* Date: 2019-07-20T02:37:47.411Z
*/

(function (global, factory) {
Expand Down Expand Up @@ -123,6 +123,7 @@
var MIME_TYPE_JPEG = 'image/jpeg'; // RegExps

var REGEXP_ACTIONS = /^e|w|s|n|se|sw|ne|nw|all|crop|move|zoom$/;
var REGEXP_DATA_URL = /^data:/;
var REGEXP_DATA_URL_JPEG = /^data:image\/jpeg;base64,/;
var REGEXP_TAG_NAME = /^img|canvas$/i; // Misc
// Inspired by the default width and height of a canvas element.
Expand Down Expand Up @@ -1524,16 +1525,19 @@

var preview = {
initPreview: function initPreview() {
var crossOrigin = this.crossOrigin;
var element = this.element,
crossOrigin = this.crossOrigin;
var preview = this.options.preview;
var url = crossOrigin ? this.crossOriginUrl : this.url;
var alt = element.alt || 'The image to preview';
var image = document.createElement('img');

if (crossOrigin) {
image.crossOrigin = crossOrigin;
}

image.src = url;
image.alt = alt;
this.viewBox.appendChild(image);
this.viewBoxImage = image;

Expand All @@ -1544,7 +1548,7 @@
var previews = preview;

if (typeof preview === 'string') {
previews = this.element.ownerDocument.querySelectorAll(preview);
previews = element.ownerDocument.querySelectorAll(preview);
} else if (preview.querySelector) {
previews = [preview];
}
Expand All @@ -1564,6 +1568,7 @@
}

img.src = url;
img.alt = alt;
/**
* Override img element styles
* Add `display:block` to avoid margin top issue
Expand Down Expand Up @@ -3227,13 +3232,23 @@
if (!options.checkOrientation || !window.ArrayBuffer) {
this.clone();
return;
} // Read ArrayBuffer from Data URL of JPEG images directly for better performance.
} // Detect the mime type of the image directly if it is a Data URL


if (REGEXP_DATA_URL.test(url)) {
// Read ArrayBuffer from Data URL of JPEG images directly for better performance
if (REGEXP_DATA_URL_JPEG.test(url)) {
this.read(dataURLToArrayBuffer(url));
} else {
// Only a JPEG image may contains Exif Orientation information,
// the rest types of Data URLs are not necessary to check orientation at all.
this.clone();
}

if (REGEXP_DATA_URL_JPEG.test(url)) {
this.read(dataURLToArrayBuffer(url));
return;
}
} // 1. Detect the mime type of the image by a XMLHttpRequest.
// 2. Load the image as ArrayBuffer for reading orientation if its a JPEG image.


var xhr = new XMLHttpRequest();
var clone = this.clone.bind(this);
Expand All @@ -3248,6 +3263,7 @@
xhr.ontimeout = clone;

xhr.onprogress = function () {
// Abort the request directly if it not a JPEG image for better performance
if (xhr.getResponseHeader('content-type') !== MIME_TYPE_JPEG) {
xhr.abort();
}
Expand Down Expand Up @@ -3334,6 +3350,7 @@
}

image.src = crossOriginUrl || url;
image.alt = element.alt || 'The image to crop';
this.image = image;
image.onload = this.start.bind(this);
image.onerror = this.stop.bind(this);
Expand All @@ -3345,7 +3362,7 @@
value: function start() {
var _this2 = this;

var image = this.isImg ? this.element : this.image;
var image = this.image;
image.onload = null;
image.onerror = null;
this.sizing = true; // Match all browsers that use WebKit as the layout engine in iOS devices,
Expand Down
4 changes: 2 additions & 2 deletions dist/cropper.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions dist/cropper.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/css/cropper.css
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/*!
* Cropper.js v1.5.3
* Cropper.js v1.5.4
* https://fengyuanchen.github.io/cropperjs
*
* Copyright 2015-present Chen Fengyuan
* Released under the MIT license
*
* Date: 2019-07-10T12:07:41.696Z
* Date: 2019-07-20T02:37:43.686Z
*/

.cropper-container {
Expand Down
Loading

0 comments on commit 6f9218d

Please sign in to comment.