FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
atom/src/highlights-component.coffee at master · tml/atom · GitHub
tml
/
atom
Public
forked from
atom/atom
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
atom
/
src
/
highlights-component.coffee
Copy path
More file actions
More file actions
Latest commit
History
History
History
31 lines (24 loc) · 1.22 KB
Breadcrumbs
atom
/
src
/
highlights-component.coffee
Copy path
File metadata and controls
31 lines (24 loc) · 1.22 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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
()
if
@props
.
performedInitialMeasurement
renderHighlights
:
->
{
editor
,
highlightDecorations
,
lineHeightInPixels
}
=
@props
highlightComponents
=
[]
for
markerId, {startPixelPosition, endPixelPosition, decorations}
of
highlightDecorations
for
decoration
in
decorations
highlightComponents
.
push
(
HighlightComponent
({editor,
key
:
"
#{
markerId
}
-
#{
decoration
.
id
}
"
, startPixelPosition, endPixelPosition, decoration, lineHeightInPixels}))
highlightComponents
componentDidMount
:
->
if
atom
.
config
.
get
(
'
editor.useShadowDOM
'
)
insertionPoint
=
document
.
createElement
(
'
content
'
)
insertionPoint
.
setAttribute
(
'
select
'
,
'
.underlayer
'
)
@
getDOMNode
().
appendChild
(insertionPoint)
shouldComponentUpdate
:
(
newProps
)
->
not
isEqualForProperties
(newProps,
@props
,
'
highlightDecorations
'
,
'
lineHeightInPixels
'
,
'
defaultCharWidth
'
,
'
scopedCharacterWidthsChangeCount
'
)
Back
|
FazBrowse Home
|
New Git URL