mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-11 03:24:16 +00:00
use copyToClipboard
util
This commit is contained in:
parent
766c4725cb
commit
67b4cfa64b
@ -1,14 +1,5 @@
|
|||||||
import download from "utils/download"
|
import download from "utils/download"
|
||||||
|
import { copyToClipboard } from "utils"
|
||||||
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")
|
|
||||||
}
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
"ignore": () => {
|
"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 Haptics } from "./haptics"
|
||||||
export { default as processString } from "./processString"
|
export { default as processString } from "./processString"
|
||||||
export { default as deleteInternalStorage } from "./deleteInternalStorage"
|
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