FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
atom/src/input-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
/
input-component.coffee
Copy path
More file actions
More file actions
Latest commit
History
History
History
39 lines (29 loc) · 1.1 KB
Breadcrumbs
atom
/
src
/
input-component.coffee
Copy path
File metadata and controls
39 lines (29 loc) · 1.1 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
32
33
34
35
36
37
38
39
{
last
,
isEqual
}
=
require
'
underscore-plus
'
React
=
require
'
react-atom-fork
'
{
input
}
=
require
'
reactionary-atom-fork
'
module
.
exports
=
InputComponent
=
React
.
createClass
displayName
:
'
InputComponent
'
render
:
->
{
className
,
style
}
=
@props
input
{className, style,
'
data-react-skip-selection-restoration
'
:
true
}
getInitialState
:
->
{
lastChar
:
'
'
}
componentDidMount
:
->
node
=
@
getDOMNode
()
node
.
addEventListener
'
paste
'
,
@onPaste
node
.
addEventListener
'
compositionupdate
'
,
@onCompositionUpdate
#
Don't let text accumulate in the input forever, but avoid excessive reflows
componentDidUpdate
:
->
if
@lastValueLength
>
500
and
not
@
isPressAndHoldCharacter
(
@state
.
lastChar
)
@
getDOMNode
().
value
=
'
'
@lastValueLength
=
0
#
This should actually consult the property lists in /System/Library/Input Methods/PressAndHold.app
isPressAndHoldCharacter
:
(
char
)
->
@state
.
lastChar
.
match
/
[aeiouAEIOU]
/
shouldComponentUpdate
:
(
newProps
)
->
not
isEqual
(
newProps
.
style
,
@props
.
style
)
onPaste
:
(
e
)
->
e
.
preventDefault
()
focus
:
->
@
getDOMNode
().
focus
()
Back
|
FazBrowse Home
|
New Git URL