Files
atom/src/highlights-component.coffee
Nathan Sobo 5d15af943e Rename filterDecorationsByMarkerId to getHighlightDecorations
And rename local variable to highlightDecorations to clarify intent
2014-06-17 14:31:56 -06:00

25 lines
886 B
CoffeeScript

React = require 'react-atom-fork'
{div} = require 'reactionary-atom-fork'
{isEqualForProperties} = require 'underscore-plus'
HighlightComponent = require './highlight-component'
module.exports =
HighlightsComponent = React.createClass
displayName: 'HighlightsComponent'
render: ->
div className: 'highlights', @renderHighlights()
renderHighlights: ->
{editor, highlightDecorations, lineHeightInPixels} = @props
highlightComponents = []
for markerId, decorations of highlightDecorations
if decorations?
for decoration in decorations
highlightComponents.push(HighlightComponent({key: "#{markerId}-#{decoration.class}", decoration, editor, lineHeightInPixels}))
highlightComponents
shouldComponentUpdate: (newProps) ->
not isEqualForProperties(newProps, @props, 'highlightDecorations', 'lineHeightInPixels', 'defaultCharWidth')