mirror of
https://github.com/kuaifan/dootask.git
synced 2026-02-08 07:15:36 +00:00
perf: 优化文本信息复制
This commit is contained in:
parent
94932c7486
commit
e32a3887cd
@ -3134,6 +3134,14 @@ export default {
|
||||
value: '',
|
||||
})
|
||||
}
|
||||
if (msgData.msg.type === 'md') {
|
||||
this.operateCopys.push({
|
||||
type: 'md',
|
||||
icon: '',
|
||||
label: '复制原文',
|
||||
value: '',
|
||||
})
|
||||
}
|
||||
}
|
||||
this.$nextTick(() => {
|
||||
const rect = el.getBoundingClientRect();
|
||||
@ -3563,12 +3571,19 @@ export default {
|
||||
case 'text':
|
||||
const copyEl = $A(this.$refs.scroller.$el).find(`[data-id="${this.operateItem.id}"]`).find('.dialog-content')
|
||||
if (copyEl.length > 0) {
|
||||
const text = copyEl[0].innerText.replace(/\n\n/g, "\n").replace(/(^\s*)|(\s*$)/g, "")
|
||||
this.copyText(text)
|
||||
let copyText = copyEl[0].innerText;
|
||||
if ($A.getObject(this.operateItem.msg, 'type') !== 'md') {
|
||||
copyText = copyText.replace(/\n\n/g, "\n").replace(/(^\s*)|(\s*$)/g, "")
|
||||
}
|
||||
this.copyText(copyText)
|
||||
} else {
|
||||
$A.messageWarning('不可复制的内容');
|
||||
}
|
||||
break;
|
||||
|
||||
case 'md':
|
||||
this.copyText(this.operateItem.msg.text)
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user