From 19315390cf266710aafa89ca23a27690b784c465 Mon Sep 17 00:00:00 2001 From: Fabian Stiewitz Date: Fri, 26 Jun 2015 11:45:38 +0200 Subject: [PATCH] TextEditorElement: Add callback for TextEditor::onDidChangeMini --- src/text-editor-element.coffee | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/text-editor-element.coffee b/src/text-editor-element.coffee index e3eaaeb2a..a4c7c2652 100644 --- a/src/text-editor-element.coffee +++ b/src/text-editor-element.coffee @@ -83,11 +83,12 @@ class TextEditorElement extends HTMLElement @model = model @mountComponent() @addGrammarScopeAttribute() - @addMiniAttributeIfNeeded() + @addMiniAttribute() if @model.isMini() @addEncodingAttribute() @model.onDidChangeGrammar => @addGrammarScopeAttribute() @model.onDidChangeEncoding => @addEncodingAttribute() @model.onDidDestroy => @unmountComponent() + @model.onDidChangeMini (mini) => if mini then @addMiniAttribute() else @removeMiniAttribute() @__spacePenView.setModel(@model) if Grim.includeDeprecatedAPIs @model @@ -155,8 +156,11 @@ class TextEditorElement extends HTMLElement grammarScope = @model.getGrammar()?.scopeName?.replace(/\./g, ' ') @dataset.grammar = grammarScope - addMiniAttributeIfNeeded: -> - @setAttributeNode(document.createAttribute("mini")) if @model.isMini() + addMiniAttribute: -> + @setAttributeNode(document.createAttribute("mini")) + + removeMiniAttribute: -> + @removeAttribute("mini") addEncodingAttribute: -> @dataset.encoding = @model.getEncoding()