mirror of
https://github.com/atom/atom.git
synced 2026-01-23 05:48:10 -05:00
Implement support for React Editor
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user