askbot-dragon 1.6.73-beta → 1.6.74-beta

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": "askbot-dragon",
3
- "version": "1.6.73-beta",
3
+ "version": "1.6.74-beta",
4
4
  "scripts": {
5
5
  "serve": "vue-cli-service serve",
6
6
  "build": "vue-cli-service build",
@@ -173,7 +173,7 @@ export default {
173
173
  previewKnowledgeId:"",
174
174
  showSummary:true,
175
175
  iframeHeight:"100%",
176
- isDownload:false,
176
+ isDownload: false,
177
177
  textWatermarkStr:""
178
178
  }
179
179
  },
@@ -433,21 +433,24 @@ export default {
433
433
  if (res.data) {
434
434
  if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
435
435
  if (isMobile()) {
436
- setTimeout(() => {
437
- const range = document.createRange();
438
- const domText = document.createElement('div')
439
- domText.style.display = 'none'
440
- domText.innerText = res.data
441
- range.selectNode(domText);
442
- const selection = window.getSelection();
443
- //移除之前选中内容
444
- if (selection.rangeCount > 0) selection.removeAllRanges();
445
- selection.addRange(range);
446
- document.execCommand('copy');
447
- selection.removeAllRanges()
448
- Toast('下载地址已复制,请前往Safari浏览器访问下载');
436
+
437
+ const textArea = document.createElement("textarea");
438
+ // textarea 中插入需要复制的文本
439
+ textArea.value = res.data;
440
+ // textarea 添加到文档中
441
+ document.body.appendChild(textArea);
442
+ //选中 textarea 的内容
443
+ textArea.select();
444
+ var successful =document.execCommand('copy');
445
+ console.log(successful, 'successful');
446
+ if(successful) {
447
+ Toast('下载地址已复制,请前往Safari浏览器访问下载')} else {
448
+ Toast('请允许复制内容到剪贴板')
449
+ }
450
+ // 移除 textarea 元素
451
+ document.body.removeChild(textArea);
449
452
  this.close()
450
- }, 100)
453
+
451
454
  } else {
452
455
  navigator.clipboard.writeText(res.data)
453
456
  this.$message.success({