1
0
mirror of https://github.com/teoxoy/factorio-blueprint-editor.git synced 2025-03-27 21:39:03 +02:00

only use new clipboard API

This commit is contained in:
teoxoy 2024-12-10 03:00:07 +01:00
parent 886ce08eb9
commit ddbdb81155

View File

@ -159,11 +159,7 @@ document.addEventListener('copy', (e: ClipboardEvent) => {
}
encode(book || bp)
.then(s =>
navigator.clipboard && navigator.clipboard.writeText
? navigator.clipboard.writeText(s)
: e.clipboardData.setData('text/plain', s)
)
.then(s => navigator.clipboard.writeText(s))
.then(onSuccess)
.catch(onError)
})
@ -174,12 +170,8 @@ document.addEventListener('paste', (e: ClipboardEvent) => {
loadingScreen.show()
const promise =
navigator.clipboard && navigator.clipboard.readText
? navigator.clipboard.readText()
: Promise.resolve(e.clipboardData.getData('text'))
promise
navigator.clipboard
.readText()
.then(getBlueprintOrBookFromSource)
.then(loadBp)
.catch(error => {