Feature: manual page now open in a new window

This commit is contained in:
萌萌哒赫萝 2023-09-12 00:31:41 -07:00
parent d776600df9
commit b197b32935
6 changed files with 52 additions and 7 deletions

View File

@ -19,3 +19,7 @@ export const RENAME_WINDOW_URL = process.env.NODE_ENV === 'development'
export const TOOLBOX_WINDOW_URL = process.env.NODE_ENV === 'development' export const TOOLBOX_WINDOW_URL = process.env.NODE_ENV === 'development'
? `${(process.env.WEBPACK_DEV_SERVER_URL as string)}#toolbox-page` ? `${(process.env.WEBPACK_DEV_SERVER_URL as string)}#toolbox-page`
: 'picgo://./index.html#toolbox-page' : 'picgo://./index.html#toolbox-page'
export const MANUAL_WINDOW_URL = process.env.NODE_ENV === 'development'
? `${(process.env.WEBPACK_DEV_SERVER_URL as string)}#documents`
: 'picgo://./index.html#documents'

View File

@ -13,7 +13,8 @@ import {
TRAY_WINDOW_URL, TRAY_WINDOW_URL,
MINI_WINDOW_URL, MINI_WINDOW_URL,
RENAME_WINDOW_URL, RENAME_WINDOW_URL,
TOOLBOX_WINDOW_URL TOOLBOX_WINDOW_URL,
MANUAL_WINDOW_URL
} from './constants' } from './constants'
// Custom types/enums // Custom types/enums
@ -57,6 +58,27 @@ const trayWindowOptions = {
} }
} }
const manualWindowOptions = {
height: 800,
width: 1200,
show: false,
frame: true,
center: true,
fullscreenable: true,
resizable: true,
title: 'Manual',
vibrancy: 'ultra-dark',
transparent: false,
webPreferences: {
webviewTag: true,
backgroundThrottling: false,
nodeIntegration: !!process.env.ELECTRON_NODE_INTEGRATION,
contextIsolation: !process.env.ELECTRON_NODE_INTEGRATION,
nodeIntegrationInWorker: true,
webSecurity: false
}
} as IBrowserWindowOptions
const settingWindowOptions = { const settingWindowOptions = {
height: defaultWindowHeight, height: defaultWindowHeight,
width: defaultWindowWidth, width: defaultWindowWidth,
@ -169,6 +191,16 @@ windowList.set(IWindowList.TRAY_WINDOW, {
} }
}) })
windowList.set(IWindowList.MANUAL_WINDOW, {
isValid: true,
multiple: false,
options: () => manualWindowOptions,
callback (window) {
window.loadURL(handleWindowParams(MANUAL_WINDOW_URL))
window.focus()
}
})
windowList.set(IWindowList.SETTING_WINDOW, { windowList.set(IWindowList.SETTING_WINDOW, {
isValid: true, isValid: true,
multiple: false, multiple: false,

View File

@ -306,6 +306,10 @@ export default {
} }
}) })
ipcMain.on('openManualWindow', () => {
windowManager.get(IWindowList.MANUAL_WINDOW)!.show()
})
ipcMain.on('openMiniWindow', () => { ipcMain.on('openMiniWindow', () => {
const miniWindow = windowManager.get(IWindowList.MINI_WINDOW)! const miniWindow = windowManager.get(IWindowList.MINI_WINDOW)!
const settingWindow = windowManager.get(IWindowList.SETTING_WINDOW)! const settingWindow = windowManager.get(IWindowList.SETTING_WINDOW)!

View File

@ -358,6 +358,10 @@ const handleGetPicPeds = () => {
const handleSelect = (index: string) => { const handleSelect = (index: string) => {
defaultActive.value = index defaultActive.value = index
if (index === routerConfig.DocumentPage) {
ipcRenderer.send('openManualWindow')
return
}
const type = index.match(routerConfig.UPLOADER_CONFIG_PAGE) const type = index.match(routerConfig.UPLOADER_CONFIG_PAGE)
if (type === null) { if (type === null) {
$router.push({ $router.push({

View File

@ -79,11 +79,6 @@ export default createRouter({
component: () => import(/* webpackChunkName: "Plugin" */ '@/pages/Plugin.vue'), component: () => import(/* webpackChunkName: "Plugin" */ '@/pages/Plugin.vue'),
name: config.PLUGIN_PAGE name: config.PLUGIN_PAGE
}, },
{
path: 'documents',
component: () => import(/* webpackChunkName: "DocumentPage" */ '@/pages/DocumentPage.vue'),
name: config.DocumentPage
},
{ {
path: 'shortKey', path: 'shortKey',
component: () => import(/* webpackChunkName: "ShortkeyPage" */ '@/pages/ShortKey.vue'), component: () => import(/* webpackChunkName: "ShortkeyPage" */ '@/pages/ShortKey.vue'),
@ -96,6 +91,11 @@ export default createRouter({
} }
] ]
}, },
{
path: '/documents',
component: () => import(/* webpackChunkName: "DocumentPage" */ '@/pages/DocumentPage.vue'),
name: config.DocumentPage
},
{ {
path: '/toolbox-page', path: '/toolbox-page',
name: config.TOOLBOX_CONFIG_PAGE, name: config.TOOLBOX_CONFIG_PAGE,

View File

@ -33,7 +33,8 @@ export enum IWindowList {
TRAY_WINDOW = 'TRAY_WINDOW', TRAY_WINDOW = 'TRAY_WINDOW',
MINI_WINDOW = 'MINI_WINDOW', MINI_WINDOW = 'MINI_WINDOW',
RENAME_WINDOW = 'RENAME_WINDOW', RENAME_WINDOW = 'RENAME_WINDOW',
TOOLBOX_WINDOW = 'TOOLBOX_WINDOW' TOOLBOX_WINDOW = 'TOOLBOX_WINDOW',
MANUAL_WINDOW = 'MANUAL_WINDOW'
} }
export enum IRemoteNoticeActionType { export enum IRemoteNoticeActionType {