Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F22425686
input.jsx
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
Unknown
Size
901 B
Referenced Files
None
Subscribers
None
input.jsx
View Options
var
React
=
require
(
'react'
);
var
PropTypes
=
React
.
PropTypes
;
var
Input
=
React
.
createClass
({
componentDidMount
:
function
()
{
this
.
selectText
(
this
.
props
.
begin
);
},
selectText
:
function
(
state
){
this
.
refs
.
input
.
focus
()
var
direction
;
if
(
state
.
start
<=
state
.
end
)
direction
=
"forward"
else
direction
=
"backward"
this
.
refs
.
input
.
setSelectionRange
(
state
.
start
,
state
.
end
,
direction
);
},
focusInput
:
function
(){
this
.
selectText
(
this
.
props
.
begin
);
},
clickInput
:
function
(){
alert
(
`Please don't cheat! :)`
);
this
.
selectText
(
this
.
props
.
last
);
},
render
:
function
()
{
return
(
<
div
>
<
textarea
className
=
"input"
type
=
"text"
value
=
{
this
.
props
.
begin
.
text
}
onChange
=
{
this
.
props
.
handleChange
}
onSelect
=
{
this
.
props
.
handleChange
}
onFocus
=
{
this
.
focusInput
}
onClick
=
{
this
.
clickInput
}
ref
=
"input"
/>
<
/div>
);
}
});
module
.
exports
=
Input
;
File Metadata
Details
Attached
Mime Type
application/javascript
Expires
Sat, Nov 28, 04:25 (20 h, 31 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1222536
Default Alt Text
input.jsx (901 B)
Attached To
Mode
rTG Typing Golf
Attached
Detach File
Event Timeline