Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic navigation #8

Open
CodyBontecou opened this issue May 4, 2021 · 1 comment
Open

Basic navigation #8

CodyBontecou opened this issue May 4, 2021 · 1 comment

Comments

@CodyBontecou
Copy link

Is it possible to add an input field in a similar fashion as the drag button that can take user input and communicate it with the BrowserWindow object?

I've been playing around with this idea and tried a preload script,

webPreferences: {
    preload: path.join(__dirname, 'renderer.js'),
},

but I'm not sure if this is the correct route, or if this is even possible. I can't seem to get access to the client-side's window or document objects in order to execute

const input = document.getElementById('url-input')
input.addEventListener('submit', () => {
  ipcRenderer.send('search', input.value)
})
@antfu
Copy link
Owner

antfu commented May 5, 2021

Yeah, have thought about that. But I kinda feel that's too much to implement this simple feature. And sadly, it looks like Electron does not provide native prompts. electron/electron#472

If anyone could find an elegant way to do that, I am happy to have it. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants