@lemonadejs/cropper 1.6.2 → 5.0.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/dist/cropper.js +369 -365
- package/package.json +5 -4
package/dist/cropper.js
CHANGED
|
@@ -1,366 +1,370 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* (c) LemonadeJS components
|
|
3
|
-
*
|
|
4
|
-
* Website: https://lemonadejs.
|
|
5
|
-
* Description: Image cropper
|
|
6
|
-
*
|
|
7
|
-
* MIT License
|
|
8
|
-
*
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
if (typeof(
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
self.
|
|
57
|
-
self.
|
|
58
|
-
self.
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
self.
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
1
|
+
/**
|
|
2
|
+
* (c) LemonadeJS components
|
|
3
|
+
*
|
|
4
|
+
* Website: https://lemonadejs.com
|
|
5
|
+
* Description: Image cropper v5
|
|
6
|
+
*
|
|
7
|
+
* MIT License
|
|
8
|
+
*
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
if (!lemonade && typeof (require) === 'function') {
|
|
12
|
+
var lemonade = require('lemonadejs');
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
if (!studio && typeof (require) === 'function') {
|
|
16
|
+
var studio = require('@lemonadejs/studio');
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// Load jsuites
|
|
20
|
+
if (typeof(jSuites) == 'undefined') {
|
|
21
|
+
if (typeof(require) === 'function') {
|
|
22
|
+
var jSuites = require('jsuites');
|
|
23
|
+
} else if (window.jSuites) {
|
|
24
|
+
var jSuites = window.jSuites;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (typeof(cropper) == 'undefined') {
|
|
29
|
+
if (typeof(require) === 'function') {
|
|
30
|
+
var Crop = require('@jsuites/cropper');
|
|
31
|
+
} else if (window.cropper) {
|
|
32
|
+
var Crop = window.cropper;
|
|
33
|
+
}
|
|
34
|
+
} else {
|
|
35
|
+
var Crop = cropper;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
;(function (global, factory) {
|
|
39
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
40
|
+
typeof define === 'function' && define.amd ? define(factory) :
|
|
41
|
+
global.Cropper = factory();
|
|
42
|
+
}(this, (function () {
|
|
43
|
+
|
|
44
|
+
'use strict';
|
|
45
|
+
|
|
46
|
+
const Cropper = function() {
|
|
47
|
+
let self = this;
|
|
48
|
+
let original = self.original ? 1 : 0;
|
|
49
|
+
let width = self.width || 300;
|
|
50
|
+
let height = self.height || 240;
|
|
51
|
+
let modal = null;
|
|
52
|
+
let crop = null;
|
|
53
|
+
let menu = null;
|
|
54
|
+
|
|
55
|
+
self.cropperArea = null;
|
|
56
|
+
self.brightness = 0;
|
|
57
|
+
self.contrast = 0;
|
|
58
|
+
self.greyscale = 0;
|
|
59
|
+
|
|
60
|
+
// Methods
|
|
61
|
+
self.createModal = function(o) {
|
|
62
|
+
modal = jSuites.modal(o, {
|
|
63
|
+
closed: true,
|
|
64
|
+
width: '800px',
|
|
65
|
+
height: '680px',
|
|
66
|
+
title: 'Photo Upload',
|
|
67
|
+
padding: '0',
|
|
68
|
+
icon: 'photo'
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
self.createCropper = function(o) {
|
|
73
|
+
let area = jSuites.getWindowWidth();
|
|
74
|
+
let a;
|
|
75
|
+
let c;
|
|
76
|
+
if (area < 800) {
|
|
77
|
+
a = [ area, area ];
|
|
78
|
+
c = [ area, area ];
|
|
79
|
+
} else {
|
|
80
|
+
a = [798, 360];
|
|
81
|
+
c = [width, height];
|
|
82
|
+
}
|
|
83
|
+
crop = Crop(o, {
|
|
84
|
+
area: a,
|
|
85
|
+
crop: c ,
|
|
86
|
+
allowResize: false,
|
|
87
|
+
onchange: function(el, image) {
|
|
88
|
+
if (image) {
|
|
89
|
+
self.setControls(true);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
self.createMenu = function(o) {
|
|
96
|
+
// Start contextmenu component
|
|
97
|
+
menu = jSuites.contextmenu(o, {
|
|
98
|
+
onclick: function(a,b) {
|
|
99
|
+
a.close();
|
|
100
|
+
b.stopPropagation();
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// Controls
|
|
106
|
+
self.createControls = function(o) {
|
|
107
|
+
let tabs = jSuites.tabs(o.children[0], {
|
|
108
|
+
data: [{
|
|
109
|
+
title: 'Crop',
|
|
110
|
+
icon: 'crop',
|
|
111
|
+
width: '100px',
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
title:'Adjusts',
|
|
115
|
+
icon: 'image',
|
|
116
|
+
width: '100px',
|
|
117
|
+
}],
|
|
118
|
+
padding:'10px',
|
|
119
|
+
animation: true,
|
|
120
|
+
position: 'bottom',
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
tabs.content.style.backgroundColor = '#eee';
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
const updateZoom = (e) => {
|
|
127
|
+
crop.zoom(e.target.value);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
const updateRotate = (e) => {
|
|
131
|
+
crop.rotate(e.target.value);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
const setBrightness = (e) => {
|
|
135
|
+
crop.brightness(e.target.value);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
const setContrast = (e) => {
|
|
139
|
+
crop.contrast(e.target.value);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
const updatePhoto = () => {
|
|
143
|
+
// Checks if cropper container is editable
|
|
144
|
+
if (self.cropperArea.classList.contains('jcrop_edition')) {
|
|
145
|
+
self.image.innerHTML = '';
|
|
146
|
+
// Create image with metadata
|
|
147
|
+
let newImage = crop.getCroppedImage();
|
|
148
|
+
// Callback for the blob
|
|
149
|
+
let createImage = function(b) {
|
|
150
|
+
// Transform to blob
|
|
151
|
+
let filename = window.URL.createObjectURL(b);
|
|
152
|
+
// Set upload information
|
|
153
|
+
let data = {
|
|
154
|
+
file: filename,
|
|
155
|
+
content: newImage.src,
|
|
156
|
+
extension: newImage.content.extension,
|
|
157
|
+
};
|
|
158
|
+
// Upload original image
|
|
159
|
+
if (original == true) {
|
|
160
|
+
data.original = crop.getImage().src;
|
|
161
|
+
}
|
|
162
|
+
// Update file to blob
|
|
163
|
+
newImage.src = filename;
|
|
164
|
+
// Integration with jSuites.form
|
|
165
|
+
if (self.name) {
|
|
166
|
+
newImage.classList.remove('jfile');
|
|
167
|
+
}
|
|
168
|
+
// Value
|
|
169
|
+
self.value = [data];
|
|
170
|
+
// Append new image
|
|
171
|
+
self.image.appendChild(newImage);
|
|
172
|
+
}
|
|
173
|
+
// Create image
|
|
174
|
+
crop.getCroppedAsBlob(createImage);
|
|
175
|
+
// Close the modal
|
|
176
|
+
setTimeout(function() {
|
|
177
|
+
modal.close();
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
const uploadPhoto = () => {
|
|
183
|
+
jSuites.click(crop.getFileInput());
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
const deletePhoto = function() {
|
|
187
|
+
if (self.image) {
|
|
188
|
+
// Reset photo from crop
|
|
189
|
+
crop.reset();
|
|
190
|
+
// Disable controls
|
|
191
|
+
self.setControls(false);
|
|
192
|
+
// Reset from container
|
|
193
|
+
self.image.innerHTML = '';
|
|
194
|
+
// Reset container
|
|
195
|
+
self.value = null;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
self.setControls = function(state) {
|
|
200
|
+
let controls = self.el.querySelectorAll('input.controls');
|
|
201
|
+
if (state == false) {
|
|
202
|
+
for (let i = 0; i < controls.length; i++) {
|
|
203
|
+
controls[i].setAttribute('disabled', 'disabled');
|
|
204
|
+
}
|
|
205
|
+
} else {
|
|
206
|
+
for (let i = 0; i < controls.length; i++) {
|
|
207
|
+
controls[i].removeAttribute('disabled');
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
for (let i = 0; i < controls.length; i++) {
|
|
212
|
+
if (controls[i].type === 'range') {
|
|
213
|
+
controls[i].value = 0;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
self.getValue = function() {
|
|
219
|
+
return self.value;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
self.setValue = function(data) {
|
|
223
|
+
if (! data) {
|
|
224
|
+
// Reset container
|
|
225
|
+
deletePhoto();
|
|
226
|
+
} else {
|
|
227
|
+
if (typeof(data) == 'string') {
|
|
228
|
+
data = {
|
|
229
|
+
file: data
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
if (data.file) {
|
|
234
|
+
let img = document.createElement('img');
|
|
235
|
+
img.setAttribute('src', data.file);
|
|
236
|
+
img.setAttribute('tabindex', -1);
|
|
237
|
+
self.image.innerHTML = '';
|
|
238
|
+
self.image.appendChild(img);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
if (data.original) {
|
|
242
|
+
crop.addFromFile(data.original);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
self.value = [data];
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
self.open = function() {
|
|
250
|
+
if (! modal.isOpen()) {
|
|
251
|
+
modal.open();
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
self.onload = function() {
|
|
256
|
+
self.image.style.maxWidth = self.width + 'px';
|
|
257
|
+
self.image.style.maxHeight = self.height + 'px';
|
|
258
|
+
|
|
259
|
+
// Onclick event
|
|
260
|
+
self.el.addEventListener('mousedown', function(e) {
|
|
261
|
+
let mouseButton;
|
|
262
|
+
e = e || window.event;
|
|
263
|
+
if (e.buttons) {
|
|
264
|
+
mouseButton = e.buttons;
|
|
265
|
+
} else if (e.button) {
|
|
266
|
+
mouseButton = e.button;
|
|
267
|
+
} else {
|
|
268
|
+
mouseButton = e.which;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
if (mouseButton == 1) {
|
|
272
|
+
self.open();
|
|
273
|
+
} else {
|
|
274
|
+
if (e.target.tagName == 'IMG') {
|
|
275
|
+
e.target.focus();
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
});
|
|
279
|
+
|
|
280
|
+
self.el.addEventListener('contextmenu', function(e) {
|
|
281
|
+
if (e.target.tagName == 'IMG') {
|
|
282
|
+
menu.open(e, [
|
|
283
|
+
{
|
|
284
|
+
title: jSuites.translate('Change image'),
|
|
285
|
+
icon: 'edit',
|
|
286
|
+
onclick: function() {
|
|
287
|
+
self.open();
|
|
288
|
+
}
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
title: jSuites.translate('Delete image'),
|
|
292
|
+
icon: 'delete',
|
|
293
|
+
shortcut: 'DELETE',
|
|
294
|
+
onclick: function() {
|
|
295
|
+
e.target.remove();
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
]);
|
|
299
|
+
e.preventDefault();
|
|
300
|
+
}
|
|
301
|
+
});
|
|
302
|
+
|
|
303
|
+
self.el.addEventListener('onkeydown', function(e) {
|
|
304
|
+
if (e.key == 'Delete' && e.target.tagName == 'IMG') {
|
|
305
|
+
deletePhoto();
|
|
306
|
+
}
|
|
307
|
+
})
|
|
308
|
+
|
|
309
|
+
self.el.val = function(v) {
|
|
310
|
+
if (v === undefined) {
|
|
311
|
+
return self.getValue();
|
|
312
|
+
} else {
|
|
313
|
+
self.setValue(v);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
// Template
|
|
320
|
+
return render => render `<div name="{{self.name}}" value="{{self.value}}">
|
|
321
|
+
<div :ref='this.image' class="jphoto jcropper"></div>
|
|
322
|
+
<div :ready='self.createModal'>
|
|
323
|
+
<div :ready='self.createCropper' :ref='self.cropperArea'></div>
|
|
324
|
+
<div :ready='self.createControls' class="controls">
|
|
325
|
+
<div role='tabs'>
|
|
326
|
+
<div role='headers'>
|
|
327
|
+
<div style="background-color: white; padding: 15px !important;"></div>
|
|
328
|
+
<div style="background-color: white;"></div>
|
|
329
|
+
</div>
|
|
330
|
+
<div role='content' style='background-color: #ccc;'>
|
|
331
|
+
<div>
|
|
332
|
+
<div class="lm-center lm-row">
|
|
333
|
+
<label class="lm-f1 lm-p6"> Zoom <input type='range' step='.05' min='0.1' max='5.45' value='1' oninput='${updateZoom}' style="margin-top:10px;" class='jrange controls' disabled='disabled'></label>
|
|
334
|
+
<label class="lm-f1 lm-p6"> Rotate <input type='range' step='.05' min='-1' max='1' value='0' oninput='${updateRotate}' style="margin-top:10px;" class='jrange controls' disabled='disabled'></label>
|
|
335
|
+
</div>
|
|
336
|
+
</div>
|
|
337
|
+
<div>
|
|
338
|
+
<div class="lm-center lm-row">
|
|
339
|
+
<label class="lm-f1 lm-p6"> Brigthness <input type='range' min='-1' max='1' step='.05' value='0' :bind='self.brightness' oninput='${setBrightness}' style="margin-top:10px;" class='jrange controls' disabled='disabled'></label>
|
|
340
|
+
<label class="lm-f1 lm-p6"> Contrast <input type='range' min='-1' max='1' step='.05' value='0' :bind='self.contrast' oninput='${setContrast}' style="margin-top:10px;" class='jrange controls' disabled='disabled'></label>
|
|
341
|
+
</div>
|
|
342
|
+
</div>
|
|
343
|
+
</div>
|
|
344
|
+
</div>
|
|
345
|
+
<div class='lm-row om-p20' style='border-top: 1px solid #aaa'>
|
|
346
|
+
<div class='lm-column lm-p6 lm-f1'>
|
|
347
|
+
<input type='button' value='Save Photo' class='lm-button controls' style='min-width: 140px;' onclick='${updatePhoto}' disabled='disabled'>
|
|
348
|
+
</div><div class='lm-column lm-p6'>
|
|
349
|
+
<input type='button' value='Upload Photo' class='lm-button' style='min-width: 140px;' onclick='${uploadPhoto}'>
|
|
350
|
+
</div><div class='lm-column lm-p6' style='text-align:right'>
|
|
351
|
+
<input type='button' value='Delete Photo' class='lm-button controls' style='min-width: 140px;' onclick='${deletePhoto}' disabled='disabled'>
|
|
352
|
+
</div>
|
|
353
|
+
</div>
|
|
354
|
+
</div>
|
|
355
|
+
</div>
|
|
356
|
+
<div :ready="self.createMenu"></div>
|
|
357
|
+
</div>`;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
lemonade.setComponents({ Cropper: Cropper });
|
|
361
|
+
|
|
362
|
+
return function (root, options, template) {
|
|
363
|
+
if (typeof (root) === 'object') {
|
|
364
|
+
lemonade.render(Cropper, root, options, template)
|
|
365
|
+
return options;
|
|
366
|
+
} else {
|
|
367
|
+
return Cropper.call(this, root, template)
|
|
368
|
+
}
|
|
369
|
+
}
|
|
366
370
|
})));
|
package/package.json
CHANGED
|
@@ -14,10 +14,11 @@
|
|
|
14
14
|
"javascript plugins"
|
|
15
15
|
],
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"lemonadejs": "^
|
|
18
|
-
"
|
|
19
|
-
"
|
|
17
|
+
"lemonadejs": "^5.0.6",
|
|
18
|
+
"@lemonadejs/studio": "^5.0.0",
|
|
19
|
+
"jsuites": "^5.9.2",
|
|
20
|
+
"@jsuites/cropper": "^1.6.2"
|
|
20
21
|
},
|
|
21
22
|
"main": "dist/cropper.js",
|
|
22
|
-
"version": "
|
|
23
|
+
"version": "5.0.0"
|
|
23
24
|
}
|