Use presenter state in CursorsComponent

This commit is contained in:
Nathan Sobo
2015-01-23 08:09:13 -07:00
parent c8b58761ba
commit 4ed07bb66d
2 changed files with 5 additions and 10 deletions

View File

@@ -12,15 +12,15 @@ CursorsComponent = React.createClass
cursorBlinkIntervalHandle: null
render: ->
{performedInitialMeasurement, cursorPixelRects, defaultCharWidth} = @props
{presenter, defaultCharWidth} = @props
{blinkOff} = @state
className = 'cursors'
className += ' blink-off' if blinkOff
div {className},
if performedInitialMeasurement
for key, pixelRect of cursorPixelRects
if presenter?
for key, pixelRect of presenter.state.content.cursors
CursorComponent({key, pixelRect, defaultCharWidth})
getInitialState: ->
@@ -32,10 +32,6 @@ CursorsComponent = React.createClass
componentWillUnmount: ->
@stopBlinkingCursors()
shouldComponentUpdate: (newProps, newState) ->
not newState.blinkOff is @state.blinkOff or
not isEqualForProperties(newProps, @props, 'cursorPixelRects', 'scrollTop', 'scrollLeft', 'defaultCharWidth', 'useHardwareAcceleration')
componentWillUpdate: (newProps) ->
cursorsMoved = @props.cursorPixelRects? and
isEqualForProperties(newProps, @props, 'defaultCharWidth', 'scopedCharacterWidthsChangeCount') and

View File

@@ -17,7 +17,7 @@ LinesComponent = React.createClass
displayName: 'LinesComponent'
render: ->
{performedInitialMeasurement, cursorBlinkPeriod, cursorBlinkResumeDelay} = @props
{presenter, performedInitialMeasurement, cursorBlinkPeriod, cursorBlinkResumeDelay} = @props
if performedInitialMeasurement
{editor, presenter, overlayDecorations, highlightDecorations, placeholderText, backgroundColor} = @props
@@ -37,8 +37,7 @@ LinesComponent = React.createClass
div className: 'placeholder-text', placeholderText if placeholderText?
CursorsComponent {
cursorPixelRects, cursorBlinkPeriod, cursorBlinkResumeDelay, lineHeightInPixels,
defaultCharWidth, scopedCharacterWidthsChangeCount, performedInitialMeasurement
presenter, cursorBlinkPeriod, cursorBlinkResumeDelay, defaultCharWidth
}
HighlightsComponent {