Implement support for React Editor

This commit is contained in:
Thomas Johansen
2014-07-16 23:42:46 +02:00
parent 6b1868efd5
commit 9c154a2f5a

View File

@@ -81,8 +81,17 @@ class ReactEditorView extends View
@attached = true
@component.pollDOM()
@focus() if @focusOnAttach
@addGrammarScopeAttribute()
@subscribe @editor, 'grammar-changed', =>
@addGrammarScopeAttribute()
@trigger 'editor:attached', [this]
addGrammarScopeAttribute: ->
grammarScope = @editor.getGrammar()?.scopeName?.replace(/\./g, ' ')
@attr('data-scope', grammarScope)
scrollTop: (scrollTop) ->
if scrollTop?
@editor.setScrollTop(scrollTop)