Skip to content

Commit

Permalink
✨ Feature: add open devtool option
Browse files Browse the repository at this point in the history
  • Loading branch information
Molunerfinn committed Aug 29, 2021
1 parent 5895889 commit 75e3edc
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/main/events/ipcList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import getPicBeds from '~/main/utils/getPicBeds'
import shortKeyHandler from 'apis/app/shortKey/shortKeyHandler'
import bus from '@core/bus'
import {
TOGGLE_SHORTKEY_MODIFIED_MODE
TOGGLE_SHORTKEY_MODIFIED_MODE,
OPEN_DEVTOOLS
} from '#/events/constants'
import {
uploadClipboardFiles,
Expand Down Expand Up @@ -141,6 +142,9 @@ export default {
ipcMain.on('updateServer', () => {
server.restart()
})
ipcMain.on(OPEN_DEVTOOLS, (event: IpcMainEvent) => {
event.sender.openDevTools()
})
},
dispose () {}
}
9 changes: 8 additions & 1 deletion src/renderer/layouts/Main.vue
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,8 @@ import {
import mixin from '@/utils/mixin'
import InputBoxDialog from '@/components/InputBoxDialog.vue'
import {
SHOW_PRIVACY_MESSAGE
SHOW_PRIVACY_MESSAGE,
OPEN_DEVTOOLS
} from '~/universal/events/constants'
import { IConfig } from 'picgo/dist/src/types/index'
const { Menu, dialog, BrowserWindow } = remote
Expand Down Expand Up @@ -276,6 +277,12 @@ export default class extends Vue {
click () {
ipcRenderer.send(SHOW_PRIVACY_MESSAGE)
}
},
{
label: '打开调试器',
click () {
ipcRenderer.send(OPEN_DEVTOOLS)
}
}
]
this.menu = Menu.buildFromTemplate(template)
Expand Down
8 changes: 7 additions & 1 deletion src/renderer/pages/MiniPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {
IpcRendererEvent,
remote
} from 'electron'
import { SHOW_PRIVACY_MESSAGE } from '~/universal/events/constants'
import { SHOW_PRIVACY_MESSAGE, OPEN_DEVTOOLS } from '~/universal/events/constants'
@Component({
name: 'mini-page',
mixins: [mixin]
Expand Down Expand Up @@ -190,6 +190,12 @@ export default class extends Vue {
remote.app.exit(0)
}
},
{
label: '打开调试器',
click () {
ipcRenderer.send(OPEN_DEVTOOLS)
}
},
{
role: 'quit',
label: '退出'
Expand Down
1 change: 1 addition & 0 deletions src/universal/events/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ export const PICGO_UPDATE_BY_ID_DB = 'PICGO_UPDATE_BY_ID_DB'
export const PICGO_GET_BY_ID_DB = 'PICGO_GET_BY_ID_DB'
export const PICGO_REMOVE_BY_ID_DB = 'PICGO_REMOVE_BY_ID_DB'
export const PICGO_OPEN_FILE = 'PICGO_OPEN_FILE'
export const OPEN_DEVTOOLS = 'OPEN_DEVTOOLS'

0 comments on commit 75e3edc

Please sign in to comment.