mirror of
https://github.com/atom/atom.git
synced 2026-01-23 05:48:10 -05:00
Unmount TextEditorComponent when TextEditor is destroyed
We don’t want to do it when the element is detached because it might be caused by moving the editor rather than destroying it. Unmounting the component entirely and then remounting it causes the hidden input to not be recycled, interfering with focus restoration. Watching for destruction of the model is a good way to ensure we always tear down the view at the right time without doing it prematurely.
This commit is contained in:
@@ -43,6 +43,7 @@ class TextEditorElement extends HTMLElement
|
||||
@mountComponent()
|
||||
@addGrammarScopeAttribute()
|
||||
@model.onDidChangeGrammar => @addGrammarScopeAttribute()
|
||||
@model.onDidDestroy => @unmountComponent()
|
||||
@__spacePenView.setModel(@model)
|
||||
@model
|
||||
|
||||
|
||||
Reference in New Issue
Block a user