mirror of
https://github.com/atom/atom.git
synced 2026-01-22 13:28:01 -05:00
This commit breaks the initial render of the editor component into two stages. The first stage just renders the shell of the editor so the height, width, line height, and default character width can be measured. Nothing that depends on these values is rendered on the first render pass. Once the editor component is mounted, all these values are measured and we force another update, which fills in the lines, line numbers, selections, etc. We also refrain from assigning an explicit height and width on the model if these values aren't explicitly styled in the DOM, and just assume the editor will stretch to accommodate its contents.
17 lines
499 B
CoffeeScript
17 lines
499 B
CoffeeScript
React = require 'react'
|
|
{div} = require 'reactionary'
|
|
SelectionComponent = require './selection-component'
|
|
|
|
module.exports =
|
|
SelectionsComponent = React.createClass
|
|
displayName: 'SelectionsComponent'
|
|
|
|
render: ->
|
|
{editor} = @props
|
|
|
|
div className: 'selections',
|
|
if @isMounted()
|
|
for selection in editor.getSelections()
|
|
if not selection.isEmpty() and editor.selectionIntersectsVisibleRowRange(selection)
|
|
SelectionComponent({key: selection.id, selection})
|