Skip to content

Commit

Permalink
修复:分离窗口不显示问题
Browse files Browse the repository at this point in the history
  • Loading branch information
modstart committed Dec 17, 2024
1 parent dd9186b commit 13ac1e8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
6 changes: 6 additions & 0 deletions electron/mapi/manager/plugin/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ export const ManagerPlugin = {
preloadBase = preloadDefault
}
}
if (preloadBase && !rendererIsUrl(preloadBase)) {
preloadBase = `file://${preloadBase}`
}
// preload
let preload = plugin.preload || null;
if (preload) {
Expand Down Expand Up @@ -87,6 +90,9 @@ export const ManagerPlugin = {
mainFastPanel = mainFastPanel.replace('<root>/', '')
mainFastPanel = rendererDistPath(mainFastPanel)
}
if (!rendererIsUrl(mainFastPanel)) {
mainFastPanel = `file://${mainFastPanel}`
}

// auto detach
let autoDetach = false
Expand Down
8 changes: 2 additions & 6 deletions electron/mapi/manager/window/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,7 @@ export const ManagerWindow = {
view._window = AppRuntime.mainWindow
remoteMain.enable(view.webContents)
AppRuntime.mainWindow.addBrowserView(view);
if (rendererIsUrl(main)) {
view.webContents.loadURL(main).then()
} else {
view.webContents.loadFile(main).then()
}
view.webContents.loadURL(main).then()
DevToolsManager.register(`MainCodeView.${plugin.name}`, view)
view.webContents.on('preload-error', (event, preloadPath, error) => {
Log.error('ManagerWindow.openForCode.preload-error', error)
Expand Down Expand Up @@ -260,7 +256,7 @@ export const ManagerWindow = {
}
});
view.webContents.on('preload-error', (event, preloadPath, error) => {
console.error('MainView.preload-error', error)
Log.error('ManagerWindow.open.preload-error', error)
})
view.webContents.setWindowOpenHandler(({url}) => {
if (url.startsWith('https://') || url.startsWith('http://')) {
Expand Down
8 changes: 4 additions & 4 deletions src/pages/FastPanel/FastPanelResult.vue
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ const queryWeb = () => {
})
aa['_web'].addEventListener('dom-ready', async () => {
await executePluginHooks(a['_web'], 'PluginReady', readyData)
aa['_web'].openDevTools({
mode: 'detach',
activate: false,
})
// aa['_web'].openDevTools({
// mode: 'detach',
// activate: false,
// })
})
aa['_web'].addEventListener('ipc-message', (event) => {
if ('FocusAny.FastPanel' === event.channel) {
Expand Down

0 comments on commit 13ac1e8

Please sign in to comment.