diff --git a/lib/index.js b/lib/index.js index 207be2c..ba76d74 100644 --- a/lib/index.js +++ b/lib/index.js @@ -33,11 +33,11 @@ function electronPrompt(options, parentWindow) { width: opts.width, height: opts.height, resizable: opts.resizable, - parent: parentWindow instanceof BrowserWindow ? parentWindow : null, + parent: parentWindow, skipTaskbar: true, alwaysOnTop: opts.alwaysOnTop, useContentSize: true, - modal: Boolean(parentWindow instanceof BrowserWindow), + modal: Boolean(parentWindow), title: opts.title, icon: opts.icon }); diff --git a/lib/page/prompt.js b/lib/page/prompt.js index aeeed43..db7044a 100644 --- a/lib/page/prompt.js +++ b/lib/page/prompt.js @@ -78,6 +78,9 @@ docReady(() => { if (e.which === 13) { promptSubmit(); } + if (e.which === 27) { + promptCancel(); + } }); } else if (promptOptions.type === 'select') { dataEl = document.createElement('select'); @@ -102,4 +105,7 @@ docReady(() => { dataEl.setAttribute('id', 'data'); dataEl.focus(); + if (promptOptions.type === 'input') { + dataEl.select(); + } }); diff --git a/package-lock.json b/package-lock.json index 8225c13..ac0db59 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "electron-prompt", - "version": "1.1.0-1", + "version": "1.2.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 0c90064..96fe2cf 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "electron-prompt", - "version": "1.1.0-1", + "version": "1.2.0", "description": "Electron helper to prompt for a value via input or select", "keywords": [ "electron", @@ -13,7 +13,7 @@ "url": "https://github.com/p-sam" }, "repository": { - "type": "git", + "type": "git", "url": "https://github.com/p-sam/electron-prompt.git" }, "license": "MIT",