This commit is contained in:
lyswhut
2022-10-29 11:36:35 +08:00
parent 66b965d9f7
commit e45cee6596
715 changed files with 57096 additions and 31771 deletions
+38
View File
@@ -0,0 +1,38 @@
import { shell, clipboard } from 'electron'
/**
* 在资源管理器中打开目录
* @param {string} dir
*/
export const openDirInExplorer = (dir: string) => {
shell.showItemInFolder(dir)
}
/**
* 在浏览器打开URL
* @param {*} url
*/
export const openUrl = async(url: string) => {
if (!/^https?:\/\//.test(url)) return
await shell.openExternal(url)
}
/**
* 复制文本到剪贴板
* @param str
*/
export const clipboardWriteText = (str: string) => {
clipboard.writeText(str)
}
/**
* 从剪贴板读取文本
* @returns
*/
export const clipboardReadText = (): string => {
return clipboard.readText()
}