vue-intergrall-plugins 0.0.183 → 0.0.185

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": "vue-intergrall-plugins",
3
- "version": "0.0.183",
3
+ "version": "0.0.185",
4
4
  "description": "",
5
5
  "main": "dist/vue-intergrall-plugins.ssr.js",
6
6
  "browser": "dist/vue-intergrall-plugins.esm.js",
@@ -62,6 +62,7 @@
62
62
  "dependencies": {
63
63
  "axios": "^0.26.0",
64
64
  "kind-of": "^6.0.3",
65
+ "link-preview-generator": "^1.1.0",
65
66
  "link-preview-js": "^2.1.13",
66
67
  "link-prevue": "^1.2.0"
67
68
  }
@@ -71,8 +71,8 @@ import AnexoMensagem from "./AnexoMensagem"
71
71
  import InteratividadeBotoes from "./InteratividadeBotoes"
72
72
  import InteratividadeFormulario from "./InteratividadeFormulario"
73
73
  import { formataTimezoneData } from "../../services/textFormatting"
74
+ import { getPreview } from "../../services/previewImage"
74
75
  import LinkPrevue from "link-prevue"
75
- import { getLinkPreview } from "link-preview-js";
76
76
 
77
77
  export default {
78
78
  components: { AnexoMensagem, InteratividadeBotoes, InteratividadeFormulario, LinkPrevue },
@@ -164,26 +164,27 @@ export default {
164
164
  }
165
165
  },
166
166
  validadeUrlToMsg(){
167
- this.message = this.msg
168
- if(this.validadeIfExistsSticker()){
169
- this.urlSticker = this.getUrlSticker()
170
- this.urlFileName = this.getUrlFileName()
171
- this.message = this.removeUrlStickerByString(this.urlSticker)
172
- }
173
- if(this.validadeIfExistsUrl()){
174
- const linkRegex = /(?:(?:https?|ftp|file):\/\/|www\.|ftp\.)(?:\([-A-Z0-9+&@#\/%=~_|$?!:,.]*\)|[-A-Z0-9+&@#\/%=~_|$?!:,.])*(?:\([-A-Z0-9+&@#\/%=~_|$?!:,.]*\)|[A-Z0-9+&@#\/%=~_|$])/igm;
175
- let link = [];
176
- link = this.message.match(linkRegex);
177
- if(!link || link.length == 0){
178
- return;
167
+ try {
168
+ this.message = this.msg
169
+ if(this.validadeIfExistsSticker()){
170
+ this.urlSticker = this.getUrlSticker()
171
+ this.urlFileName = this.getUrlFileName()
172
+ this.message = this.removeUrlStickerByString(this.urlSticker)
179
173
  }
180
- getLinkPreview(link[0]).then((data) => {
181
- if(data.images && data.images.length > 0){
182
- this.urlSticker = data.images[0];
174
+ if(this.validadeIfExistsUrl()){
175
+ const linkRegex = /(?:(?:https?|ftp|file):\/\/|www\.|ftp\.)(?:\([-A-Z0-9+&@#\/%=~_|$?!:,.]*\)|[-A-Z0-9+&@#\/%=~_|$?!:,.])*(?:\([-A-Z0-9+&@#\/%=~_|$?!:,.]*\)|[A-Z0-9+&@#\/%=~_|$])/igm;
176
+ let link = [];
177
+ link = this.message.match(linkRegex);
178
+ if(!link || link.length == 0){
179
+ return;
180
+ }
181
+ let urlImage = getPreview(link[0]);
182
+ if(urlImage){
183
+ this.urlSticker = urlImage;
183
184
  }
184
- }).catch(erro => {
185
- console.log(erro);
186
- });
185
+ }
186
+ } catch (error) {
187
+
187
188
  }
188
189
  },
189
190
  getUrlFileName(){