Git Product home page Git Product logo

Comments (8)

p-sam avatar p-sam commented on July 20, 2024 1

Have you tried passing the main window as the parentWindow argument ? This would tie the prompt with the mainWindow

from electron-prompt.

blurymind avatar blurymind commented on July 20, 2024

I do:

const electron = require('electron')
const ipcRenderer = electron.ipcRenderer;
const remote = electron.remote, 
....
	prompt({
		title: 'Create New',
		label: 'Please enter the name:',
		value: 'new',
		parentWindow :remote.BrowserWindow,
		inputAttrs:{type: ''}}).then((newname) => {
			console.log('result', newname); // null if window was closed, or user clicked Cancel
			if (newname.length==0){alert("You didnt enter a name");return};
			createNew(newname);
			}).catch(console.error);

from electron-prompt.

blurymind avatar blurymind commented on July 20, 2024

when using
parentWindow :remote.getCurrentWindow()

I get
F:\stuff\elAPP\node_modules\electron-prompt\lib\index.js:38 Uncaught TypeError: Converting circular structure to JSON
and the prompt doesnt even initialize properly

from electron-prompt.

blurymind avatar blurymind commented on July 20, 2024

Ok, now I am initiating it differently and not getting the error:
#12 (comment)
However it doesnt resolve any of the two problems.
I workaround I found to this issue is to set
https://github.com/sperrichon/electron-prompt/blob/master/lib/index.js#L14
to true. Its an ugly workaround, but at least the user cant lose it that way

from electron-prompt.

p-sam avatar p-sam commented on July 20, 2024

Did you find any solution other than set the window to be alwaysOnTop ? I can't think of any solution that doesn't make the api user having to handle the window behavior himself, and I would want to avoid that

from electron-prompt.

kickthedragon avatar kickthedragon commented on July 20, 2024

I made a pull request that fixes this issue. You had a typo in your check for parent window that was passing a bool instead of the parent window object itself.

from electron-prompt.

p-sam avatar p-sam commented on July 20, 2024

Oh you're right it was introduced by PR #4 and I didn't see the bug

from electron-prompt.

p-sam avatar p-sam commented on July 20, 2024

Published/Released in 1.1.0 just now. I'm closing the issue, feel free to re-open if the bug was not completely resolved.

from electron-prompt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.