@veritree/ui 0.16.3 → 0.16.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veritree/ui",
3
- "version": "0.16.3",
3
+ "version": "0.16.4",
4
4
  "description": "veritree ui library",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -9,15 +9,15 @@
9
9
  </template>
10
10
 
11
11
  <script>
12
- import { handleImageResizing } from "../../utils/images";
12
+ import { handleImageResizing } from '../../utils/images';
13
13
 
14
14
  export default {
15
- name: "VTImage",
15
+ name: 'VTImage',
16
16
 
17
17
  props: {
18
18
  src: {
19
19
  type: String,
20
- default: "",
20
+ default: '',
21
21
  },
22
22
  cdnSrc: {
23
23
  type: [String, Object],
@@ -67,7 +67,7 @@ export default {
67
67
 
68
68
  onError() {
69
69
  this.canLoad = false;
70
- this.$emit("error");
70
+ this.$emit('error');
71
71
  },
72
72
  },
73
73
  };
@@ -1,38 +1,45 @@
1
1
  export const handleImageResizing = (url, width) => {
2
- // early exit if url is null for whatever reason
3
- if (!url) {
4
- return '';
5
- }
2
+ try {
3
+ // early exit if url is null for whatever reason
4
+ if (!url) {
5
+ return '';
6
+ }
6
7
 
7
- let cdn;
8
+ let cdn;
8
9
 
9
- if (typeof url === 'object') {
10
- cdn = url.cdn_url;
11
- } else if (typeof url === 'string') {
12
- cdn = JSON.parse(url).cdn_url;
13
- }
10
+ if (typeof url === 'object') {
11
+ cdn = url.cdn_url;
12
+ }
13
+
14
+ if (typeof url === 'string') {
15
+ cdn = JSON.parse(url).cdn_url;
16
+ }
14
17
 
15
- const base64String = cdn.split('net/');
16
- const firstPart = base64String[0];
18
+ const base64String = cdn.split('net/');
19
+ const firstPart = base64String[0];
17
20
 
18
- // if atob is crossed and your editor says is not supported,
19
- // don't worry, it seems to be about NodeJS and not about
20
- // browsers.
21
- //
22
- // Details: https://developer.mozilla.org/en-US/docs/Web/API/atob
23
- const decodedString = JSON.parse(atob(base64String[1]));
21
+ // if atob is crossed and your editor says is not supported,
22
+ // don't worry, it seems to be about NodeJS and not about
23
+ // browsers.
24
+ //
25
+ // Details: https://developer.mozilla.org/en-US/docs/Web/API/atob
26
+ const decodedString = JSON.parse(atob(base64String[1]));
24
27
 
25
- width
26
- ? (decodedString.edits.resize.width = width)
27
- : (decodedString.edits.resize.width = 450);
28
+ width
29
+ ? (decodedString.edits.resize.width = width)
30
+ : (decodedString.edits.resize.width = 450);
28
31
 
29
- // if btoa is crossed and your editor says is not supported,
30
- // don't worry, it seems to be about NodeJS and not about
31
- // browsers.
32
- //
33
- // Details: https://developer.mozilla.org/en-US/docs/Web/API/atob
34
- const encodedString = btoa(JSON.stringify(decodedString));
35
- const encodedUrl = `${firstPart}net/${encodedString}`;
32
+ // if btoa is crossed and your editor says is not supported,
33
+ // don't worry, it seems to be about NodeJS and not about
34
+ // browsers.
35
+ //
36
+ // Details: https://developer.mozilla.org/en-US/docs/Web/API/atob
37
+ const encodedString = btoa(JSON.stringify(decodedString));
38
+ const encodedUrl = `${firstPart}net/${encodedString}`;
36
39
 
37
- return encodedUrl;
40
+ return encodedUrl
41
+ } catch(error) {
42
+ console.log(cdn);
43
+ console.log(error);
44
+ }
38
45
  };