@ntlab/ntjs-assets 2.115.0 → 2.116.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/js/cdn.json +1 -1
- package/assets/js/cropper/cropper.d.ts +38 -1
- package/assets/js/cropper/cropper.esm.js +121 -38
- package/assets/js/cropper/cropper.esm.min.js +2 -2
- package/assets/js/cropper/cropper.esm.raw.js +33 -6
- package/assets/js/cropper/cropper.js +122 -37
- package/assets/js/cropper/cropper.min.js +2 -2
- package/assets/js/cropper/cropper.raw.js +32 -5
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! Cropper.js v2.
|
|
1
|
+
/*! Cropper.js v2.1.0 | (c) 2015-present Chen Fengyuan | MIT */
|
|
2
2
|
(function (global, factory) {
|
|
3
3
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@cropper/utils'), require('@cropper/elements')) :
|
|
4
4
|
typeof define === 'function' && define.amd ? define(['exports', '@cropper/utils', '@cropper/elements'], factory) :
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
elements.CropperViewer.$define();
|
|
40
40
|
class Cropper {
|
|
41
41
|
constructor(element, options) {
|
|
42
|
+
var _a;
|
|
42
43
|
this.options = DEFAULT_OPTIONS;
|
|
43
44
|
if (utils.isString(element)) {
|
|
44
45
|
element = document.querySelector(element);
|
|
@@ -49,11 +50,10 @@
|
|
|
49
50
|
this.element = element;
|
|
50
51
|
options = Object.assign(Object.assign({}, DEFAULT_OPTIONS), options);
|
|
51
52
|
this.options = options;
|
|
52
|
-
const { ownerDocument } = element;
|
|
53
53
|
let { container } = options;
|
|
54
54
|
if (container) {
|
|
55
55
|
if (utils.isString(container)) {
|
|
56
|
-
container =
|
|
56
|
+
container = (_a = utils.getRootDocument(element)) === null || _a === void 0 ? void 0 : _a.querySelector(container);
|
|
57
57
|
}
|
|
58
58
|
if (!utils.isElement(container)) {
|
|
59
59
|
throw new Error('The `container` option must be an element or a valid selector.');
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
container = element.parentElement;
|
|
65
65
|
}
|
|
66
66
|
else {
|
|
67
|
-
container = ownerDocument.body;
|
|
67
|
+
container = element.ownerDocument.body;
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
this.container = container;
|
|
@@ -85,6 +85,23 @@
|
|
|
85
85
|
Array.from(documentFragment.querySelectorAll(utils.CROPPER_IMAGE)).forEach((image) => {
|
|
86
86
|
image.setAttribute('src', src);
|
|
87
87
|
image.setAttribute('alt', element.alt || 'The image to crop');
|
|
88
|
+
// Inherit additional attributes from HTMLImageElement
|
|
89
|
+
if (tagName === 'img') {
|
|
90
|
+
[
|
|
91
|
+
'crossorigin',
|
|
92
|
+
'decoding',
|
|
93
|
+
'elementtiming',
|
|
94
|
+
'fetchpriority',
|
|
95
|
+
'loading',
|
|
96
|
+
'referrerpolicy',
|
|
97
|
+
'sizes',
|
|
98
|
+
'srcset',
|
|
99
|
+
].forEach((attribute) => {
|
|
100
|
+
if (element.hasAttribute(attribute)) {
|
|
101
|
+
image.setAttribute(attribute, element.getAttribute(attribute) || '');
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
}
|
|
88
105
|
});
|
|
89
106
|
if (element.parentElement) {
|
|
90
107
|
element.style.display = 'none';
|
|
@@ -107,8 +124,18 @@
|
|
|
107
124
|
getCropperSelections() {
|
|
108
125
|
return this.container.querySelectorAll(utils.CROPPER_SELECTION);
|
|
109
126
|
}
|
|
127
|
+
destroy() {
|
|
128
|
+
var _a;
|
|
129
|
+
const cropperCanvas = this.getCropperCanvas();
|
|
130
|
+
if (cropperCanvas) {
|
|
131
|
+
(_a = cropperCanvas.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(cropperCanvas);
|
|
132
|
+
}
|
|
133
|
+
if (this.element) {
|
|
134
|
+
this.element.style.display = '';
|
|
135
|
+
}
|
|
136
|
+
}
|
|
110
137
|
}
|
|
111
|
-
Cropper.version = '2.
|
|
138
|
+
Cropper.version = '2.1.0';
|
|
112
139
|
|
|
113
140
|
exports.DEFAULT_TEMPLATE = DEFAULT_TEMPLATE;
|
|
114
141
|
exports["default"] = Cropper;
|