mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-06-29 03:21:39 +08:00
fix clipboard
This commit is contained in:
@@ -1,6 +1,17 @@
|
||||
// 请求和获取剪切板内容
|
||||
export async function getClipboardContent() {
|
||||
return await navigator.clipboard.readText()
|
||||
if (navigator.clipboard && window.isSecureContext) {
|
||||
return await navigator.clipboard.readText()
|
||||
}
|
||||
else {
|
||||
const input = document.createElement('input')
|
||||
document.body.appendChild(input)
|
||||
input.select()
|
||||
document.execCommand('paste')
|
||||
const content = input.value
|
||||
document.body.removeChild(input)
|
||||
return content
|
||||
}
|
||||
}
|
||||
|
||||
// 将内容复制到剪切板,兼容非安全域场景
|
||||
|
||||
Reference in New Issue
Block a user