@taole/dev-helper 0.1.21 → 0.1.23

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.
@@ -209,10 +209,12 @@
209
209
  window.addEventListener("visibilitychange", this._pagehideCallback);
210
210
  }
211
211
  this._updateTagAttr();
212
- this._initClipboardText();
213
212
  } else {
214
213
  this._log('open-diandian: not supported pc platform');
215
214
  }
215
+ if (!this._isApp) {
216
+ this._initClipboardText();
217
+ }
216
218
  }
217
219
  _handleAlinkClick() {
218
220
  this._writeClickboard();
@@ -272,10 +274,23 @@
272
274
  this._clipboardTextPs = new Promise(async (resolve, reject) => {
273
275
  try {
274
276
  await resolveTwKit();
275
- const urlText = `https://${twKit.isTest ? 'y-test.tuwan.com' : 'y.tuwan.com'}/events/app_transfer_page?extinfo=` + encodeURIComponent(extinfo);
277
+ let urlText = `https://${twKit.isTest ? 'y-test.tuwan.com' : 'y.tuwan.com'}/events/app_transfer_page?extinfo=` + encodeURIComponent(extinfo);
278
+ try {
279
+ const info = JSON.parse(extinfo);
280
+ if (info && info.openType == 3 && info.isPop && info.url) {
281
+ urlText = info.url;
282
+ }
283
+ } catch (e) {}
276
284
  const shorUrl = await twKit.genShortUrl(urlText);
277
285
  this._clipboardText = `【${this._appInfo.app_name}】 ${shorUrl} `;
278
286
  this._log("initClipboardText success", this._clipboardText);
287
+ this.dispatchEvent(new CustomEvent('clipboardtext', {
288
+ detail: {
289
+ text: this._clipboardText,
290
+ },
291
+ bubbles: true,
292
+ composed: true,
293
+ }));
279
294
  resolve();
280
295
  } catch (error) {
281
296
  this._log("initClipboardText error", error);
@@ -204,10 +204,12 @@ function createOpenDiandianElementClass() {
204
204
  window.addEventListener("visibilitychange", this._pagehideCallback);
205
205
  }
206
206
  this._updateTagAttr();
207
- this._initClipboardText();
208
207
  } else {
209
208
  this._log('open-diandian: not supported pc platform');
210
209
  }
210
+ if (!this._isApp) {
211
+ this._initClipboardText();
212
+ }
211
213
  }
212
214
  _handleAlinkClick() {
213
215
  this._writeClickboard();
@@ -267,10 +269,23 @@ function createOpenDiandianElementClass() {
267
269
  this._clipboardTextPs = new Promise(async (resolve, reject) => {
268
270
  try {
269
271
  await resolveTwKit();
270
- const urlText = `https://${twKit.isTest ? 'y-test.tuwan.com' : 'y.tuwan.com'}/events/app_transfer_page?extinfo=` + encodeURIComponent(extinfo);
272
+ let urlText = `https://${twKit.isTest ? 'y-test.tuwan.com' : 'y.tuwan.com'}/events/app_transfer_page?extinfo=` + encodeURIComponent(extinfo);
273
+ try {
274
+ const info = JSON.parse(extinfo);
275
+ if (info && info.openType == 3 && info.isPop && info.url) {
276
+ urlText = info.url;
277
+ }
278
+ } catch (e) {}
271
279
  const shorUrl = await twKit.genShortUrl(urlText);
272
280
  this._clipboardText = `【${this._appInfo.app_name}】 ${shorUrl} `;
273
281
  this._log("initClipboardText success", this._clipboardText);
282
+ this.dispatchEvent(new CustomEvent('clipboardtext', {
283
+ detail: {
284
+ text: this._clipboardText,
285
+ },
286
+ bubbles: true,
287
+ composed: true,
288
+ }));
274
289
  resolve();
275
290
  } catch (error) {
276
291
  this._log("initClipboardText error", error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taole/dev-helper",
3
- "version": "0.1.21",
3
+ "version": "0.1.23",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "dev-helper": "./bin/dev-helper.js"