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
2bd11fa0
Commit
2bd11fa0
authored
4 years ago
by
chris
Browse files
Options
Downloads
Patches
Plain Diff
set input value
parent
7af918e8
No related branches found
No related tags found
1 merge request
!110
Display comment conversation
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
wax-prosemirror-components/src/components/comments/Comment.js
+42
-11
42 additions, 11 deletions
...prosemirror-components/src/components/comments/Comment.js
wax-prosemirror-components/src/components/link/LinkComponent.js
+0
-1
0 additions, 1 deletion
...osemirror-components/src/components/link/LinkComponent.js
with
42 additions
and
12 deletions
wax-prosemirror-components/src/components/comments/Comment.js
+
42
−
11
View file @
2bd11fa0
...
...
@@ -5,18 +5,24 @@ import React, {
useContext
,
useRef
}
from
"
react
"
;
import
{
v4
as
uuidv4
}
from
"
uuid
"
;
import
styled
from
"
styled-components
"
;
import
{
WaxContext
}
from
"
wax-prosemirror-core
"
;
const
SinlgeCommentRow
=
styled
.
div
`
padding: 4px;
border-bottom: 1px solid #ffab20;
`
;
export
default
({
comment
,
activeView
,
user
})
=>
{
const
commentInput
=
useRef
(
null
);
const
[
currentUser
,
setCurrentuser
]
=
useState
(
user
);
const
[
commentAnnotation
,
setCommentAnnotation
]
=
useState
(
comment
);
const
[
commentInputValue
,
setcommentInputValue
]
=
useState
(
""
);
const
{
state
,
dispatch
}
=
activeView
;
const
{
attrs
:
{
conversation
}
}
=
comment
;
console
.
log
(
"
dddd
"
,
conversation
);
const
handleKeyDown
=
event
=>
{
if
(
event
.
key
===
"
Enter
"
||
event
.
which
===
13
)
{
saveComment
();
...
...
@@ -41,19 +47,44 @@ export default ({ comment, activeView, user }) => {
})
)
);
setcommentInputValue
(
""
);
};
const
updateCommentInputValue
=
()
=>
{
const
{
current
:
{
value
}
}
=
commentInput
;
setcommentInputValue
(
value
);
};
const
commentInputReply
=
()
=>
{
return
(
<
Fragment
>
<
input
type
=
"
text
"
ref
=
{
commentInput
}
placeholder
=
"
add a new comment
"
onChange
=
{
updateCommentInputValue
}
onKeyPress
=
{
handleKeyDown
}
autoFocus
value
=
{
commentInputValue
}
/
>
<
button
onClick
=
{
saveComment
}
>
Post
<
/button
>
<
button
>
Cancel
<
/button
>
<
/Fragment
>
);
};
return
(
return
conversation
.
length
===
0
?
(
<
Fragment
>
{
commentInputReply
()}
<
/Fragment
>
)
:
(
<
Fragment
>
<
input
type
=
"
text
"
ref
=
{
commentInput
}
placeholder
=
"
add a new comment
"
onKeyPress
=
{
handleKeyDown
}
autoFocus
/>
<
button
onClick
=
{
saveComment
}
>
Post
<
/button
>
<
button
>
Cancel
<
/button
>
{
conversation
.
map
((
singleComment
,
index
)
=>
{
return
(
<
SinlgeCommentRow
key
=
{
uuidv4
()}
>
{
`
${
user
.
username
}
:
${
singleComment
[
user
.
username
]
}
`
}
<
/SinlgeCommentRow
>
);
})}
{
commentInputReply
()}
<
/Fragment
>
);
};
This diff is collapsed.
Click to expand it.
wax-prosemirror-components/src/components/link/LinkComponent.js
+
0
−
1
View file @
2bd11fa0
...
...
@@ -19,7 +19,6 @@ const Button = styled.button`
`
;
const
LinkComponent
=
({
mark
,
setPosition
,
position
})
=>
{
console
.
log
(
mark
);
const
href
=
mark
?
mark
.
attrs
.
href
:
null
,
linkMark
=
mark
?
mark
:
null
,
{
view
:
{
main
},
activeView
}
=
useContext
(
WaxContext
),
...
...
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