Feat:减少一次在firefox浏览器上粘贴剪贴板内容时的提示
This commit is contained in:
parent
9ef90a7057
commit
b8765bdd99
@ -1080,14 +1080,15 @@ export const getDataFromClipboard = async () => {
|
|||||||
let text = null
|
let text = null
|
||||||
let img = null
|
let img = null
|
||||||
if (navigator.clipboard) {
|
if (navigator.clipboard) {
|
||||||
text = await navigator.clipboard.readText()
|
|
||||||
const items = await navigator.clipboard.read()
|
const items = await navigator.clipboard.read()
|
||||||
if (items && items.length > 0) {
|
if (items && items.length > 0) {
|
||||||
for (const clipboardItem of items) {
|
for (const clipboardItem of items) {
|
||||||
for (const type of clipboardItem.types) {
|
for (const type of clipboardItem.types) {
|
||||||
if (/^image\//.test(type)) {
|
if (/^image\//.test(type)) {
|
||||||
img = await clipboardItem.getType(type)
|
img = await clipboardItem.getType(type)
|
||||||
break
|
} else if (type === 'text/plain') {
|
||||||
|
const blob = await clipboardItem.getType(type)
|
||||||
|
text = await blob.text()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user