mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Cleanup cluster webview loading (#313)
Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
parent
6d4a7f657d
commit
105021509c
@ -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);
|
||||
}
|
||||
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");
|
||||
|
||||
Loading…
Reference in New Issue
Block a user