@cocreate/url-uploader 1.0.0 → 1.1.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/CHANGELOG.md CHANGED
@@ -1,3 +1,22 @@
1
+ # [1.1.0](https://github.com/CoCreate-app/CoCreate-url-uploader/compare/v1.0.1...v1.1.0) (2024-11-04)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * prettier.config options ([9d09104](https://github.com/CoCreate-app/CoCreate-url-uploader/commit/9d09104e1ab6b116adba53f83aaf55992c20c58e))
7
+
8
+
9
+ ### Features
10
+
11
+ * add prettier.config.js and format files ([81d1f3c](https://github.com/CoCreate-app/CoCreate-url-uploader/commit/81d1f3cff02d5d5ee1b060e62b0ae12d1f5faa90))
12
+
13
+ ## [1.0.1](https://github.com/CoCreate-app/CoCreate-url-uploader/compare/v1.0.0...v1.0.1) (2024-06-30)
14
+
15
+
16
+ ### Bug Fixes
17
+
18
+ * return error in data ([3e20409](https://github.com/CoCreate-app/CoCreate-url-uploader/commit/3e2040949f02643a50a0d5a116830d2655f6143f))
19
+
1
20
  # 1.0.0 (2024-06-29)
2
21
 
3
22
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/url-uploader",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "A simple url-uploader component in vanilla javascript. Easily configured using HTML5 data-attributes and/or JavaScript API.",
5
5
  "keywords": [
6
6
  "url-uploader",
@@ -0,0 +1,16 @@
1
+ module.exports = {
2
+ tabWidth: 4,
3
+ semi: true,
4
+ trailingComma: "none",
5
+ bracketSameLine: true,
6
+ useTabs: true,
7
+ overrides: [
8
+ {
9
+ files: ["*.json", "*.yml", "*.yaml"],
10
+ options: {
11
+ tabWidth: 2,
12
+ useTabs: false
13
+ },
14
+ }
15
+ ],
16
+ };
package/src/index.js CHANGED
@@ -39,11 +39,13 @@ class CoCreateUrlUploader {
39
39
  const response = await fetch(file.src);
40
40
 
41
41
  if (!response.ok) {
42
- throw new Error('Failed to fetch file: ' + response.statusText);
42
+ data.error = 'Failed to fetch file: ' + response.statusText
43
+ if (data.socket)
44
+ return this.crud.wsManager.send(data)
43
45
  }
44
46
 
45
47
  const arrayBuffer = await response.arrayBuffer();
46
- file.src = arrayBufferToBase64(arrayBuffer)
48
+ file.src = this.arrayBufferToBase64(arrayBuffer)
47
49
 
48
50
  file.size = arrayBuffer.byteLength
49
51
  file['content-type'] = response.headers.get('content-type')