Cleanup cluster webview loading (#313)

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
Jari Kolehmainen authored and GitHub committed 2020-04-28 08:26:27 +03:00
1 parent 6d4a7f657d
commit 105021509c
1 file changed
+4 -26
+4 -26
View File
@@ -98,29 +98,6 @@ export default {
'document.styleSheets[0].insertRule("*, *::after, *::before { -webkit-user-drag: none; -webkit-app-region: no-drag; }", 1);'
);
},
addWebview: function() {
const container = document.getElementById("lens-container");
if (!container || !this.lens.webview) {
return
}
container.style = "display: block;"
let webview = null
container.childNodes.forEach((child) => {
if (child === this.lens.webview) {
webview = child
}
})
if (!webview) {
container.appendChild(this.lens.webview)
}
container.childNodes.forEach((child) => {
if (child !== this.lens.webview) {
child.style = "display: none;"
} else {
child.style = "top: 0; bottom: 20px;"
}
})
},
// Called only when online state changes
toggleLens: function() {
if (!this.lens) { return }
@@ -138,10 +115,11 @@ export default {
webview.addEventListener('did-finish-load', this.lensLoaded);
webview.src = this.cluster.url;
this.lens.webview = webview;
this.$store.dispatch("attachWebview", this.lens);
}
this.$store.dispatch("attachWebview", this.lens);
this.$tracker.event("cluster", "open");
setTimeout(() => { // see: https://github.com/electron/electron/issues/10016
this.$store.dispatch("attachWebview", this.lens);
this.$tracker.event("cluster", "open");
}, 0)
},
hideLens: function() {
this.$store.dispatch("hideWebviews");