Remove unused properties in EditorComponent and children

This commit is contained in:
Nathan Sobo 2015-01-27 08:12:33 -07:00
parent c4b5a0f411
commit a5580a704d
4 changed files with 21 additions and 26 deletions

View File

@ -9,10 +9,10 @@ HighlightsComponent = React.createClass
render: ->
div className: 'highlights',
@renderHighlights() if @props.performedInitialMeasurement
@renderHighlights() if @props.presenter?
renderHighlights: ->
{editor, presenter} = @props
{presenter} = @props
highlightComponents = []
for key, state of presenter.state.content.highlights
highlightComponents.push(HighlightComponent({key, state}))

View File

@ -17,11 +17,10 @@ LinesComponent = React.createClass
displayName: 'LinesComponent'
render: ->
{presenter, performedInitialMeasurement, cursorBlinkPeriod, cursorBlinkResumeDelay} = @props
{presenter} = @props
if performedInitialMeasurement
{editor, presenter, overlayDecorations, highlightDecorations, placeholderText, backgroundColor} = @props
{lineHeightInPixels, defaultCharWidth, scrollViewHeight, scopedCharacterWidthsChangeCount, cursorPixelRects} = @props
if presenter?
{editor, presenter, overlayDecorations, placeholderText, backgroundColor} = @props
@oldState ?= {content: {lines: {}}}
@newState = presenter.state
@ -29,7 +28,7 @@ LinesComponent = React.createClass
{scrollWidth} = @newState.content
style =
height: Math.max(scrollHeight, scrollViewHeight)
height: scrollHeight
width: scrollWidth
WebkitTransform: @getTransform()
backgroundColor: if editor.isMini() then null else backgroundColor
@ -38,7 +37,7 @@ LinesComponent = React.createClass
div className: 'placeholder-text', placeholderText if placeholderText?
CursorsComponent {presenter}
HighlightsComponent {presenter, performedInitialMeasurement}
HighlightsComponent {presenter}
getTransform: ->
{scrollTop} = @newState
@ -70,9 +69,9 @@ LinesComponent = React.createClass
else
@overlayManager = new OverlayManager(@getDOMNode())
componentDidUpdate: (prevProps) ->
{visible, scrollingVertically, performedInitialMeasurement} = @props
return unless performedInitialMeasurement
componentDidUpdate: ->
{visible, scrollingVertically, presenter} = @props
return unless presenter?
@removeLineNodes() unless @oldState?.content.indentGuidesVisible is @newState?.content.indentGuidesVisible
@updateLineNodes()
@ -268,7 +267,7 @@ LinesComponent = React.createClass
editor.setDefaultCharWidth(charWidth)
remeasureCharacterWidths: ->
return unless @props.performedInitialMeasurement
return unless @props.presenter?
@clearScopedCharWidths()
@measureCharactersInNewLines()

View File

@ -4,7 +4,8 @@ class OverlayManager
@overlays = {}
render: (props) ->
{editor, overlayDecorations, lineHeightInPixels} = props
{presenter, editor, overlayDecorations} = props
lineHeight = presenter.getLineHeight()
existingDecorations = null
for markerId, {headPixelPosition, tailPixelPosition, decorations} of overlayDecorations
@ -12,7 +13,7 @@ class OverlayManager
pixelPosition =
if decoration.position is 'tail' then tailPixelPosition else headPixelPosition
@renderOverlay(editor, decoration, pixelPosition, lineHeightInPixels)
@renderOverlay(editor, decoration, pixelPosition, lineHeight)
existingDecorations ?= {}
existingDecorations[decoration.id] = true
@ -24,7 +25,7 @@ class OverlayManager
return
renderOverlay: (editor, decoration, pixelPosition, lineHeightInPixels) ->
renderOverlay: (editor, decoration, pixelPosition, lineHeight) ->
item = atom.views.getView(decoration.item)
unless overlay = @overlays[decoration.id]
overlay = @overlays[decoration.id] = document.createElement('atom-overlay')
@ -38,9 +39,9 @@ class OverlayManager
if left + itemWidth - editor.getScrollLeft() > editor.getWidth() and left - itemWidth >= editor.getScrollLeft()
left -= itemWidth
top = pixelPosition.top + lineHeightInPixels
if top + itemHeight - editor.getScrollTop() > editor.getHeight() and top - itemHeight - lineHeightInPixels >= editor.getScrollTop()
top -= itemHeight + lineHeightInPixels
top = pixelPosition.top + lineHeight
if top + itemHeight - editor.getScrollTop() > editor.getHeight() and top - itemHeight - lineHeight >= editor.getScrollTop()
top -= itemHeight + lineHeight
overlay.style.top = top + 'px'
overlay.style.left = left + 'px'

View File

@ -113,14 +113,9 @@ TextEditorComponent = React.createClass
style: hiddenInputStyle
LinesComponent {
ref: 'lines',
editor, lineHeightInPixels, defaultCharWidth, tokenizedLines,
lineDecorations, highlightDecorations, overlayDecorations, hostElement,
renderedRowRange, @pendingChanges, scrollTop, scrollLeft,
@scrollingVertically, scrollHeight, scrollWidth, mouseWheelScreenRow,
visible, scrollViewHeight, @scopedCharacterWidthsChangeCount, lineWidth, @useHardwareAcceleration,
placeholderText, @performedInitialMeasurement, @backgroundColor, cursorPixelRects,
cursorBlinkPeriod, cursorBlinkResumeDelay, useShadowDOM, @presenter
ref: 'lines', @presenter, editor, hostElement, @useHardwareAcceleration, useShadowDOM,
@scrollingVertically, mouseWheelScreenRow, visible, placeholderText, @backgroundColor,
overlayDecorations
}
ScrollbarComponent