Take autoHeight as an argument.

This commit is contained in:
joshaber
2016-02-25 17:11:04 -05:00
parent ff0b9e30a9
commit dfd3e1b948
2 changed files with 5 additions and 10 deletions

View File

@@ -39,6 +39,9 @@ class TextEditorElement extends HTMLElement
@setAttribute('tabindex', -1)
initializeContent: (attributes) ->
unless @autoHeight
@style.height = "100%"
if @config.get('editor.useShadowDOM')
@useShadowDOM = true
@@ -87,7 +90,7 @@ class TextEditorElement extends HTMLElement
@subscriptions.add @component.onDidChangeScrollLeft =>
@emitter.emit("did-change-scroll-left", arguments...)
initialize: (model, {@views, @config, @themes, @workspace, @assert, @styles, @grammars}, @ignoreScrollPastEnd = false) ->
initialize: (model, {@views, @config, @themes, @workspace, @assert, @styles, @grammars}, @autoHeight = true, @ignoreScrollPastEnd = false) ->
throw new Error("Must pass a config parameter when initializing TextEditorElements") unless @views?
throw new Error("Must pass a config parameter when initializing TextEditorElements") unless @config?
throw new Error("Must pass a themes parameter when initializing TextEditorElements") unless @themes?
@@ -346,10 +349,6 @@ class TextEditorElement extends HTMLElement
@style.height = height + "px"
@component.measureDimensions()
disableAutoHeight: ->
@style.height = "100%"
@component.measureDimensions()
getHeight: ->
@offsetHeight

View File

@@ -3154,11 +3154,7 @@ class TextEditor extends Model
# Get the Element for the editor.
getElement: ->
unless @editorElement?
@editorElement = new TextEditorElement().initialize(this, atom, @ignoreScrollPastEnd)
unless @autoHeight
@editorElement.disableAutoHeight()
@editorElement
@editorElement ?= new TextEditorElement().initialize(this, atom, @autoHeight, @ignoreScrollPastEnd)
# Essential: Retrieves the greyed out placeholder of a mini editor.
#