diff --git a/src/react-editor-view.coffee b/src/react-editor-view.coffee index 3b166cbbf..11b7900ff 100644 --- a/src/react-editor-view.coffee +++ b/src/react-editor-view.coffee @@ -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)