chore: version 2.8.3 (#175)

* feat: 保留已存在的内容直到手动操作

* feat: 支持复制文本

* chore: version 2.8.3
This commit is contained in:
Redon
2023-03-01 13:20:31 +08:00
committed by GitHub
parent 94e23bb916
commit 42e320fe35
12 changed files with 175 additions and 32 deletions

View File

@@ -13,3 +13,15 @@ export function includeCode(text: string | null | undefined) {
const regexp = /^(?:\s{4}|\t).+/gm
return !!(text?.includes(' = ') || text?.match(regexp))
}
// 复制文本
export function copyText(text: string) {
const input = document.createElement('input')
input.setAttribute('readonly', 'readonly')
input.setAttribute('value', text)
document.body.appendChild(input)
input.select()
if (document.execCommand('copy'))
document.execCommand('copy')
document.body.removeChild(input)
}