allow copying error message for imports
This commit is contained in:
parent
ad30f6b1e3
commit
7fcd9e5810
|
@ -17,8 +17,8 @@ const utilsBridge = {
|
|||
ipcRenderer.invoke("open-external", url, background)
|
||||
},
|
||||
|
||||
showErrorBox: (title: string, content: string) => {
|
||||
ipcRenderer.invoke("show-error-box", title, content)
|
||||
showErrorBox: (title: string, content: string, copy?: string) => {
|
||||
ipcRenderer.invoke("show-error-box", title, content, copy)
|
||||
},
|
||||
|
||||
showMessageBox: async (
|
||||
|
|
|
@ -45,8 +45,23 @@ export function setUtilsListeners(manager: WindowManager) {
|
|||
openExternal(url, background)
|
||||
})
|
||||
|
||||
ipcMain.handle("show-error-box", (_, title, content) => {
|
||||
dialog.showErrorBox(title, content)
|
||||
ipcMain.handle("show-error-box", async (_, title, content, copy?: string) => {
|
||||
if (manager.hasWindow() && copy != null) {
|
||||
const response = await dialog.showMessageBox(manager.mainWindow, {
|
||||
type: 'error',
|
||||
title: title,
|
||||
message: title,
|
||||
detail: content,
|
||||
buttons: ["OK", copy],
|
||||
cancelId: 0,
|
||||
defaultId: 0,
|
||||
})
|
||||
if (response.response === 1) {
|
||||
clipboard.writeText(`${title}: ${content}`);
|
||||
}
|
||||
} else {
|
||||
dialog.showErrorBox(title, content)
|
||||
}
|
||||
})
|
||||
|
||||
ipcMain.handle(
|
||||
|
@ -56,7 +71,8 @@ export function setUtilsListeners(manager: WindowManager) {
|
|||
let response = await dialog.showMessageBox(manager.mainWindow, {
|
||||
type: type,
|
||||
title: title,
|
||||
message: message,
|
||||
message: title,
|
||||
detail: message,
|
||||
buttons:
|
||||
process.platform === "win32"
|
||||
? ["Yes", "No"]
|
||||
|
|
|
@ -300,7 +300,8 @@ export function importOPML(): AppThunk {
|
|||
.map(e => {
|
||||
return e[0] + "\n" + String(e[1])
|
||||
})
|
||||
.join("\n")
|
||||
.join("\n"),
|
||||
intl.get("context.copy")
|
||||
)
|
||||
}
|
||||
})
|
||||
|
|
|
@ -323,7 +323,8 @@ export function addSource(
|
|||
if (!batch) {
|
||||
window.utils.showErrorBox(
|
||||
intl.get("sources.errorAdd"),
|
||||
String(e)
|
||||
String(e),
|
||||
intl.get("context.copy")
|
||||
)
|
||||
}
|
||||
throw e
|
||||
|
|
Loading…
Reference in New Issue