mirror of
https://github.com/atom/atom.git
synced 2026-01-23 05:48:10 -05:00
Apply mini and is-focused class to both editor host element and root
This preserves existing theming behavior
This commit is contained in:
@@ -193,9 +193,9 @@ TextEditorComponent = React.createClass
|
||||
@checkForVisibilityChange()
|
||||
|
||||
componentWillUnmount: ->
|
||||
{editor, parentView} = @props
|
||||
{editor, hostElement} = @props
|
||||
|
||||
parentView.__spacePenView.trigger 'editor:will-be-removed', [parentView.__spacePenView]
|
||||
hostElement.__spacePenView.trigger 'editor:will-be-removed', [hostElement.__spacePenView]
|
||||
@unsubscribe()
|
||||
@scopedConfigSubscriptions.dispose()
|
||||
window.removeEventListener 'resize', @requestHeightAndWidthMeasurement
|
||||
@@ -215,9 +215,9 @@ TextEditorComponent = React.createClass
|
||||
if @props.editor.isAlive()
|
||||
@updateParentViewFocusedClassIfNeeded(prevState)
|
||||
@updateParentViewMiniClassIfNeeded(prevState)
|
||||
@props.parentView.__spacePenView.trigger 'cursor:moved' if cursorMoved
|
||||
@props.parentView.__spacePenView.trigger 'selection:changed' if selectionChanged
|
||||
@props.parentView.__spacePenView.trigger 'editor:display-updated'
|
||||
@props.hostElement.__spacePenView.trigger 'cursor:moved' if cursorMoved
|
||||
@props.hostElement.__spacePenView.trigger 'selection:changed' if selectionChanged
|
||||
@props.hostElement.__spacePenView.trigger 'editor:display-updated'
|
||||
|
||||
becameVisible: ->
|
||||
@updatesPaused = true
|
||||
@@ -261,7 +261,7 @@ TextEditorComponent = React.createClass
|
||||
@forceUpdate()
|
||||
|
||||
getTopmostDOMNode: ->
|
||||
@props.parentView
|
||||
@props.hostElement
|
||||
|
||||
getRenderedRowRange: ->
|
||||
{editor, lineOverdrawMargin} = @props
|
||||
@@ -772,10 +772,10 @@ TextEditorComponent = React.createClass
|
||||
measureHeightAndWidth: ->
|
||||
return unless @isMounted()
|
||||
|
||||
{editor, parentView} = @props
|
||||
{editor, hostElement} = @props
|
||||
scrollViewNode = @refs.scrollView.getDOMNode()
|
||||
{position} = getComputedStyle(parentView)
|
||||
{height} = parentView.style
|
||||
{position} = getComputedStyle(hostElement)
|
||||
{height} = hostElement.style
|
||||
|
||||
if position is 'absolute' or height
|
||||
if @autoHeight
|
||||
@@ -807,9 +807,9 @@ TextEditorComponent = React.createClass
|
||||
@remeasureCharacterWidths()
|
||||
|
||||
sampleBackgroundColors: (suppressUpdate) ->
|
||||
{parentView} = @props
|
||||
{hostElement} = @props
|
||||
{showLineNumbers} = @state
|
||||
{backgroundColor} = getComputedStyle(parentView)
|
||||
{backgroundColor} = getComputedStyle(hostElement)
|
||||
|
||||
if backgroundColor isnt @backgroundColor
|
||||
@backgroundColor = backgroundColor
|
||||
@@ -978,11 +978,13 @@ TextEditorComponent = React.createClass
|
||||
|
||||
updateParentViewFocusedClassIfNeeded: (prevState) ->
|
||||
if prevState.focused isnt @state.focused
|
||||
@props.parentView.classList.toggle('is-focused', @state.focused)
|
||||
@props.hostElement.classList.toggle('is-focused', @state.focused)
|
||||
@props.rootElement.classList.toggle('is-focused', @state.focused)
|
||||
|
||||
updateParentViewMiniClassIfNeeded: (prevProps) ->
|
||||
if prevProps.mini isnt @props.mini
|
||||
@props.parentView.classList.toggle('mini', @props.mini)
|
||||
@props.hostElement.classList.toggle('mini', @props.mini)
|
||||
@props.rootElement.classList.toggle('mini', @props.mini)
|
||||
|
||||
runScrollBenchmark: ->
|
||||
unless process.env.NODE_ENV is 'production'
|
||||
|
||||
@@ -31,9 +31,9 @@ class TextEditorElement extends HTMLElement
|
||||
stylesElement.initialize()
|
||||
@shadowRoot.appendChild(stylesElement)
|
||||
|
||||
@root = document.createElement('div')
|
||||
@root.classList.add('editor', 'editor-colors')
|
||||
@shadowRoot.appendChild(@root)
|
||||
@rootElement = document.createElement('div')
|
||||
@rootElement.classList.add('editor', 'editor-colors')
|
||||
@shadowRoot.appendChild(@rootElement)
|
||||
|
||||
createSpacePenShim: ->
|
||||
TextEditorView ?= require './text-editor-view'
|
||||
@@ -74,12 +74,13 @@ class TextEditorElement extends HTMLElement
|
||||
|
||||
mountComponent: ->
|
||||
@componentDescriptor ?= TextEditorComponent(
|
||||
parentView: this
|
||||
hostElement: this
|
||||
rootElement: @rootElement
|
||||
editor: @model
|
||||
mini: @model.mini
|
||||
lineOverdrawMargin: @lineOverdrawMargin
|
||||
)
|
||||
@component = React.renderComponent(@componentDescriptor, @root)
|
||||
@component = React.renderComponent(@componentDescriptor, @rootElement)
|
||||
|
||||
unmountComponent: ->
|
||||
return unless @component?.isMounted()
|
||||
|
||||
Reference in New Issue
Block a user