Skip to content

How to embeding the devtool into OpenSumi layout, instead of open it in a separated windows? #1426

Answered by mister-teddy
mister-teddy asked this question in Q&A
Discussion options

You must be logged in to vote

I managed to did it 👇 For someone who's looking for an answer: using BrowserView (instead of <webview> or <iframe>) did the trick. You can load the dev tools of the browser view inside another browser view like this:

const view = new BrowserView();
const devtoolsView = new BrowserView();
const browserWindow = this.app.getCodeWindows()[0].getBrowserWindow();
browserWindow.addBrowserView(view);
browserWindow.addBrowserView(devtoolsView);
view.webContents.on('dom-ready', () => {
  view.webContents.setDevToolsWebContents(devtoolsView.webContents);
  view.webContents.openDevTools({
    mode: 'detach', // detach mode is important otherwise it would cause unexpected behavior
  });
});

However us…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by mister-teddy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant