mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-10 02:54:15 +00:00
use copyToClipboard
util
This commit is contained in:
parent
91fe890c61
commit
7b56bd04f1
@ -1,14 +1,5 @@
|
||||
import download from "utils/download"
|
||||
|
||||
function copyToClipboard(text) {
|
||||
if (!navigator.clipboard?.writeText) {
|
||||
control.close()
|
||||
return app.message.error("Clipboard API not supported")
|
||||
}
|
||||
|
||||
navigator.clipboard.writeText(text)
|
||||
app.message.success("Copied to clipboard")
|
||||
}
|
||||
import { copyToClipboard } from "utils"
|
||||
|
||||
export default {
|
||||
"ignore": () => {
|
||||
|
8
packages/app/src/utils/copyToClipboard/index.js
Normal file
8
packages/app/src/utils/copyToClipboard/index.js
Normal file
@ -0,0 +1,8 @@
|
||||
export default (text) => {
|
||||
if (!navigator.clipboard?.writeText) {
|
||||
return app.message.error("Clipboard API not supported")
|
||||
}
|
||||
|
||||
navigator.clipboard.writeText(text)
|
||||
app.message.success("Copied to clipboard")
|
||||
}
|
@ -5,4 +5,5 @@ export { default as getBase64 } from "./getBase64"
|
||||
export { default as Haptics } from "./haptics"
|
||||
export { default as processString } from "./processString"
|
||||
export { default as deleteInternalStorage } from "./deleteInternalStorage"
|
||||
export { default as handleOpenDevTools } from "./handleOpenDevTools"
|
||||
export { default as handleOpenDevTools } from "./handleOpenDevTools"
|
||||
export { default as copyToClipboard } from "./copyToClipboard"
|
Loading…
x
Reference in New Issue
Block a user