@widgetic/editor 3.10.43 → 3.10.44
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/lib/dev/editor.js +12 -4
- package/lib/editor.js +1 -1
- package/package.json +1 -1
- package/src/core/services/uploads.js +12 -3
package/package.json
CHANGED
|
@@ -29,14 +29,19 @@ const parseType = type =>
|
|
|
29
29
|
export default class UploadService extends EventsMixin(Service) {
|
|
30
30
|
constructor(user, token) {
|
|
31
31
|
super();
|
|
32
|
+
|
|
32
33
|
this.user = user.id;
|
|
33
|
-
this.maxFilesize = user.premium ? 250 : 100;
|
|
34
34
|
this.token = token;
|
|
35
35
|
|
|
36
|
-
this.files = [];
|
|
37
36
|
this.refreshed = {};
|
|
38
37
|
|
|
39
|
-
this.
|
|
38
|
+
this.files = [];
|
|
39
|
+
// max file size in MB
|
|
40
|
+
this.maxFilesize = user.premium ? 250 : 25; // MB limit / file for premium / free
|
|
41
|
+
|
|
42
|
+
// max quota in bytes
|
|
43
|
+
this.quota = 250 * 1000 * 1000; // 250 MB total quota for free users
|
|
44
|
+
// used quota in bytes
|
|
40
45
|
this.used = 0;
|
|
41
46
|
|
|
42
47
|
this.events = ['update', 'complete'];
|
|
@@ -88,6 +93,8 @@ export default class UploadService extends EventsMixin(Service) {
|
|
|
88
93
|
const response = JSON.parse(uploadFile.xhr.response);
|
|
89
94
|
|
|
90
95
|
const id = response.files.data[0].id;
|
|
96
|
+
|
|
97
|
+
// read quota from response
|
|
91
98
|
this.quota = response.quota.max;
|
|
92
99
|
this.used = response.quota.used;
|
|
93
100
|
|
|
@@ -157,6 +164,8 @@ export default class UploadService extends EventsMixin(Service) {
|
|
|
157
164
|
})
|
|
158
165
|
.then(response => {
|
|
159
166
|
this.refreshed[type] = true;
|
|
167
|
+
|
|
168
|
+
// read quota from response
|
|
160
169
|
this.quota = response.quota.max;
|
|
161
170
|
this.used = response.quota.used;
|
|
162
171
|
|