Skip to content
This repository was archived by the owner on Dec 17, 2024. It is now read-only.

Commit f970cf0

Browse files
committed
update to electron 2.0
fix annoying loss of repl focus when moving window around Fixes #943 Fixes #944
1 parent 8cb9a92 commit f970cf0

File tree

4 files changed

+16
-4
lines changed

4 files changed

+16
-4
lines changed

app/content/css/ui.css

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,6 @@ body:not(.subwindow) repl.sidecar-visible .repl-block, body.sidecar-full-screen
208208
}
209209
.result-table .repl-result, .result-table.repl-result {
210210
display: table;
211-
border-collapse: collapse;
212211
border-spacing: 0;
213212
border: 1px solid;
214213
margin-top: 0.75em;
@@ -349,6 +348,9 @@ body/*:not(.sidecar-full-screen)*/ repl.sidecar-visible .repl-context, body/*:no
349348
text-overflow: ellipsis;
350349
white-space: nowrap;
351350
}
351+
.entity:first-child .entity-attributes > span {
352+
border-top: none;
353+
}
352354
.entity-attributes > span {
353355
display: table-cell;
354356
vertical-align: middle;

app/content/js/repl.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,12 @@ const formatOneListResult = options => (entity, idx, A) => {
123123
const interval = setInterval(() => {
124124
try {
125125
Promise.resolve(watch())
126-
.then(({ value, done=false, css, others=[] }) => {
126+
.then(({ value, done=false, css, others=[], unchanged=false }) => {
127+
if (unchanged) {
128+
// nothing to do, yet
129+
return
130+
}
131+
127132
// are we done polling for updates?
128133
if (!value || done) {
129134
clearInterval(interval)
@@ -427,6 +432,11 @@ self.init = (prefs={}) => {
427432
}
428433
}
429434

435+
// we don't want the prompt to lose focus when the user drags when
436+
// window around (which is initiated by clicking on the header)
437+
document.querySelector('.page > header').onclick = evt => {
438+
ui.getCurrentPrompt().focus()
439+
}
430440

431441
/** listen for paste events, focus on the current prompt first */
432442
document.body.onpaste = evt => {

app/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ function createWindow(noHeadless, executeThisArgvPlease, subwindowPlease, subwin
215215
const { clipboard, nativeImage, webContents } = electron
216216
webContents.fromId(contentsId).capturePage(rect, image => {
217217
try {
218-
const buf = image.toPng()
218+
const buf = image.toPNG()
219219
clipboard.writeImage(nativeImage.createFromBuffer(buf))
220220
event.sender.send('capture-page-to-clipboard-done', buf)
221221
} catch (err) {

app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"license": "Apache-2.0",
2626
"bugs": "https://github.com/ibm-functions/shell",
2727
"devDependencies": {
28-
"electron": "~1.8.4",
28+
"electron": "~2.0.0",
2929
"nyc": "^11.3.0"
3030
},
3131
"dependencies": {

0 commit comments

Comments
 (0)