broz icon indicating copy to clipboard operation
broz copied to clipboard

Basic navigation

Open CodyBontecou opened this issue 3 years ago • 1 comments

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)
})

CodyBontecou avatar May 04 '21 17:05 CodyBontecou

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. https://github.com/electron/electron/issues/472

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

antfu avatar May 05 '21 03:05 antfu