Blink cursors based on presenter state

Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
This commit is contained in:
Nathan Sobo
2015-01-23 10:26:00 -07:00
parent b412c2642d
commit 3b93f3d71b
3 changed files with 23 additions and 49 deletions

View File

@@ -226,16 +226,22 @@ TextEditorComponent = React.createClass
@performedInitialMeasurement = true
@updatesPaused = false
{editor, lineOverdrawMargin} = @props
@presenter ?= new TextEditorPresenter
model: editor
clientHeight: editor.getHeight()
clientWidth: editor.getWidth()
scrollTop: editor.getScrollTop()
scrollLeft: editor.getScrollLeft()
lineHeight: editor.getLineHeightInPixels()
baseCharacterWidth: editor.getDefaultCharWidth()
lineOverdrawMargin: lineOverdrawMargin
{editor, lineOverdrawMargin, cursorBlinkPeriod, cursorBlinkResumeDelay} = @props
unless @presenter?
@presenter = new TextEditorPresenter
model: editor
clientHeight: editor.getHeight()
clientWidth: editor.getWidth()
scrollTop: editor.getScrollTop()
scrollLeft: editor.getScrollLeft()
lineHeight: editor.getLineHeightInPixels()
baseCharacterWidth: editor.getDefaultCharWidth()
lineOverdrawMargin: lineOverdrawMargin
cursorBlinkPeriod: cursorBlinkPeriod
cursorBlinkResumeDelay: cursorBlinkResumeDelay
@presenter.onDidUpdateState(@requestUpdate)
@forceUpdate() if @canUpdate()