When I call window.prompt I get “Error: prompt() is and will not be supported”. Why is this?
That is extremely annoying and it didn’t help at all. Everything in Atom is synchronous and alert/prompt are no different.
I seems prompt windows does not map to anything native & cross platform and maintainer of electron deemed it an edge case not worthy of developing.
However for basic scripting, things like alert and prompt are often all the UI needed. And I think atom should encourage such basic scripting use case.
That is why in the view framework demo thread I proposed to have some standard components ready to reuse.
Alternatively, maybe an atom package can provide service for basic gui like this.
It took me forever (an hour) but I implemented a pop-up prompt dialog for a package I did today. If anyone reading this needs an example of a prompt dialog, check out the package
shell-it. What the heck, here is the dialog code …
dialog = document.createElement "div" dialog.setAttribute 'style', 'width:100%' lbl = document.createElement "div" lbl.setAttribute 'style', 'position:relative; float:left; margin-right:10px;' + 'font-weight:bold; font-size:12px' lbl.appendChild document.createTextNode 'Shell Command:' dialog.appendChild lbl input = document.createElement 'input' input.setAttribute 'style', 'width:350px' input.classList.add 'native-key-bindings' dialog.appendChild input panel = atom.workspace.addModalPanel item: dialog input.focus() input.addEventListener 'keypress', (e) => if e.which is 13 @process input.value panel.destroy() return false