Closed mbleigh closed 10 years ago
This is not necessarily a slam-dunk, because the text in the editor is potentially long, and updating a bindable text value on every change may just be a performance footgun.
To address @sjmiles concern, it may be better to have a "live value" concept distinct from the value property. This "live value" could be done as you have although it looks like it's better to hook CodeMirror's 'changes' event than the 'change' event. The "live value" could be updated when the editor loses focus.
@mbleigh would you be interested in refactoring your initial PR to address the live value suggestion from @sorvell above? (this PR currently requires rebasing anyway).
Closing this, but will be readdressing momentarily in a different PR.
While this element is a nice demo, it had a fatal flaw: the
value
wasn't actually syncing back from the mirror when it was edited! Added a listener on the element so that value gets updated both TO the mirror and FROM the mirror.