Add a SelectionsComponent containing all selections

This commit is contained in:
Nathan Sobo
2014-04-14 14:08:43 -06:00
parent 14bfa90004
commit eeba559ec7
2 changed files with 15 additions and 9 deletions

View File

@@ -5,7 +5,7 @@ ReactUpdates = require 'react/lib/ReactUpdates'
InputComponent = require './input-component'
LinesComponent = require './lines-component'
CursorsComponent = require './cursors-component'
SelectionComponent = require './selection-component'
SelectionsComponent = require './selections-component'
module.exports =
EditorScrollViewComponent = React.createClass
@@ -28,14 +28,8 @@ EditorScrollViewComponent = React.createClass
div className: 'scroll-view-content', style: contentStyle, onMouseDown: @onMouseDown,
CursorsComponent({editor, cursorBlinkPeriod, cursorBlinkResumeDelay})
LinesComponent({ref: 'lines', editor, fontSize, fontFamily, lineHeight, visibleRowRange, showIndentGuide})
@renderUnderlayer()
renderUnderlayer: ->
{editor} = @props
div className: 'underlayer',
for selection in editor.getSelections() when editor.selectionIntersectsVisibleRowRange(selection)
SelectionComponent({selection})
div className: 'underlayer',
SelectionsComponent({editor})
componentDidMount: ->
@getDOMNode().addEventListener 'overflowchanged', @updateModelDimensions

View File

@@ -0,0 +1,12 @@
React = require 'react'
{div} = require 'reactionary'
SelectionComponent = require './selection-component'
module.exports =
SelectionsComponent = React.createClass
render: ->
{editor} = @props
div className: 'selections',
for selection in editor.getSelections() when editor.selectionIntersectsVisibleRowRange(selection)
SelectionComponent({selection})