mirror of
https://github.com/atom/atom.git
synced 2026-01-27 07:47:58 -05:00
Take autoHeight as an argument.
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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.
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user