Implement detachment to eliminate spurious drag events

This commit is contained in:
Nathan Sobo
2017-03-14 20:32:25 -06:00
committed by Antonio Scandurra
parent 173cdcb372
commit ebad2e6605
2 changed files with 16 additions and 1 deletions

View File

@@ -599,7 +599,18 @@ class TextEditorComponent {
}
})
this.intersectionObserver.observe(this.element)
if (this.isVisible()) this.didShow()
if (this.isVisible()) {
this.didShow()
} else {
this.didHide()
}
}
}
didDetach () {
if (this.attached) {
this.didHide()
this.attached = false
}
}

View File

@@ -13,6 +13,10 @@ class TextEditorElement extends HTMLElement {
this.emitter.emit('did-attach')
}
detachedCallback () {
this.getComponent().didDetach()
}
getModel () {
return this.getComponent().getModel()
}