mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-09-05 23:56:42 +08:00
fix clipboard
This commit is contained in:
@@ -1,6 +1,17 @@
|
|||||||
// 请求和获取剪切板内容
|
// 请求和获取剪切板内容
|
||||||
export async function getClipboardContent() {
|
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