Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
wax-prosemirror
Manage
Activity
Members
Labels
Plan
Issues
34
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
2
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
wax
wax-prosemirror
Commits
2e718aa6
Commit
2e718aa6
authored
4 years ago
by
chris
Browse files
Options
Downloads
Patches
Plain Diff
set on blur
parent
da063846
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!161
Connect ui
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
wax-prosemirror-components/src/ui/comments/CommentReply.js
+23
-9
23 additions, 9 deletions
wax-prosemirror-components/src/ui/comments/CommentReply.js
with
23 additions
and
9 deletions
wax-prosemirror-components/src/ui/comments/CommentReply.js
+
23
−
9
View file @
2e718aa6
...
@@ -47,7 +47,7 @@ const ButtonGroup = styled.div`
...
@@ -47,7 +47,7 @@ const ButtonGroup = styled.div`
const
CommentReply
=
props
=>
{
const
CommentReply
=
props
=>
{
const
{
className
,
isNewComment
,
onClickPost
}
=
props
;
const
{
className
,
isNewComment
,
onClickPost
}
=
props
;
const
[
v
alue
,
setValue
]
=
useState
(
''
);
const
[
commentV
alue
,
set
Comment
Value
]
=
useState
(
''
);
const
commentInput
=
useRef
(
null
);
const
commentInput
=
useRef
(
null
);
useEffect
(()
=>
{
useEffect
(()
=>
{
...
@@ -59,13 +59,26 @@ const CommentReply = props => {
...
@@ -59,13 +59,26 @@ const CommentReply = props => {
const
handleSubmit
=
e
=>
{
const
handleSubmit
=
e
=>
{
e
.
preventDefault
();
e
.
preventDefault
();
e
.
stopPropagation
();
e
.
stopPropagation
();
onClickPost
(
v
alue
);
onClickPost
(
commentV
alue
);
setValue
(
''
);
set
Comment
Value
(
''
);
};
};
const
resetValue
=
e
=>
{
const
resetValue
=
e
=>
{
e
.
preventDefault
();
e
.
preventDefault
();
setValue
(
''
);
setCommentValue
(
''
);
};
const
onBlur
=
()
=>
{
const
{
current
:
{
value
},
}
=
commentInput
;
if
(
value
!==
''
)
{
// Save into local storage
}
if
(
isNewComment
===
0
&&
value
===
''
)
{
// resolveComment();
}
};
};
return
(
return
(
...
@@ -74,25 +87,26 @@ const CommentReply = props => {
...
@@ -74,25 +87,26 @@ const CommentReply = props => {
<
TextWrapper
>
<
TextWrapper
>
<
ReplyTextArea
<
ReplyTextArea
ref
=
{
commentInput
}
ref
=
{
commentInput
}
onBlur
=
{
onBlur
}
placeholder
=
{
isNewComment
?
'
Write comment...
'
:
'
Reply...
'
}
placeholder
=
{
isNewComment
?
'
Write comment...
'
:
'
Reply...
'
}
onChange
=
{
e
=>
setValue
(
e
.
target
.
value
)}
onChange
=
{
e
=>
set
Comment
Value
(
e
.
target
.
value
)}
onKeyDown
=
{
e
=>
{
onKeyDown
=
{
e
=>
{
if
(
e
.
keyCode
===
13
&&
!
e
.
shiftKey
)
{
if
(
e
.
keyCode
===
13
&&
!
e
.
shiftKey
)
{
e
.
preventDefault
();
e
.
preventDefault
();
if
(
v
alue
)
handleSubmit
(
e
);
if
(
commentV
alue
)
handleSubmit
(
e
);
}
}
}}
}}
value
=
{
v
alue
}
value
=
{
commentV
alue
}
/
>
/
>
<
/TextWrapper
>
<
/TextWrapper
>
<
ActionWrapper
>
<
ActionWrapper
>
<
ButtonGroup
>
<
ButtonGroup
>
<
Button
disabled
=
{
v
alue
.
length
===
0
}
primary
type
=
"
submit
"
>
<
Button
disabled
=
{
commentV
alue
.
length
===
0
}
primary
type
=
"
submit
"
>
Post
Post
<
/Button
>
<
/Button
>
<
Button
disabled
=
{
v
alue
.
length
===
0
}
onClick
=
{
resetValue
}
>
<
Button
disabled
=
{
commentV
alue
.
length
===
0
}
onClick
=
{
resetValue
}
>
Cancel
Cancel
<
/Button
>
<
/Button
>
<
/ButtonGroup
>
<
/ButtonGroup
>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment