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
"...src/git@gitlab.coko.foundation:wax/wax-prosemirror.git" did not exist on "f98ca1ef71b957e0d9da1ad3b82bf363e9a27968"
Show more breadcrumbs
wax
wax-prosemirror
Commits
fa6436b9
Commit
fa6436b9
authored
4 years ago
by
chris
Browse files
Options
Downloads
Patches
Plain Diff
add top/position on connected component
parent
2faa3c17
No related branches found
No related tags found
1 merge request
!161
Connect ui
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
wax-prosemirror-components/src/components/comments/ConnectedComment.js
+18
-8
18 additions, 8 deletions
...or-components/src/components/comments/ConnectedComment.js
wax-prosemirror-components/src/ui/comments/CommentBox.js
+1
-16
1 addition, 16 deletions
wax-prosemirror-components/src/ui/comments/CommentBox.js
with
19 additions
and
24 deletions
wax-prosemirror-components/src/components/comments/ConnectedComment.js
+
18
−
8
View file @
fa6436b9
...
...
@@ -5,6 +5,10 @@ import { DocumentHelpers } from 'wax-prosemirror-utilities';
import
{
WaxContext
}
from
'
wax-prosemirror-core
'
;
import
CommentBox
from
'
../../ui/comments/CommentBox
'
;
const
ConnectedCommentStyled
=
styled
.
div
`
position: absolute;
`
;
export
default
({
key
,
comment
,
dataBox
,
top
,
commentId
,
commentData
})
=>
{
const
MemorizedComponent
=
memo
(()
=>
{
const
{
...
...
@@ -19,19 +23,25 @@ export default ({ key, comment, dataBox, top, commentId, commentData }) => {
}
=
useContext
(
WaxContext
);
let
active
=
false
;
const
styles
=
{
top
:
`
${
top
}
px`
,
};
const
commentPlugin
=
app
.
PmPlugins
.
get
(
'
commentPlugin
'
);
const
activeComment
=
commentPlugin
.
getState
(
activeView
.
state
).
comment
;
if
(
activeComment
&&
commentId
===
activeComment
.
attrs
.
id
)
active
=
true
;
return
(
<
CommentBox
key
=
{
commentId
}
active
=
{
active
}
dataBox
=
{
commentId
}
top
=
{
top
}
commentId
=
{
commentId
}
commentData
=
{
commentData
}
/
>
<
ConnectedCommentStyled
data
-
box
=
{
commentId
}
style
=
{
styles
}
>
<
CommentBox
key
=
{
commentId
}
active
=
{
active
}
dataBox
=
{
commentId
}
top
=
{
top
}
commentId
=
{
commentId
}
commentData
=
{
commentData
}
/
>
<
/ConnectedCommentStyled
>
);
});
return
<
MemorizedComponent
/>
;
...
...
This diff is collapsed.
Click to expand it.
wax-prosemirror-components/src/ui/comments/CommentBox.js
+
1
−
16
View file @
fa6436b9
...
...
@@ -25,7 +25,6 @@ const Wrapper = styled.div`
box-sizing: border-box;
display: flex;
flex-direction: column;
position: absolute;
/* padding: 8px 0; */
${
props
=>
!
props
.
active
&&
inactive
}
...
...
@@ -60,7 +59,6 @@ const CommentBox = props => {
onClickBox
,
onClickPost
,
onClickResolve
,
top
,
}
=
props
;
// send signal to make this comment active
...
...
@@ -71,19 +69,8 @@ const CommentBox = props => {
if
(
!
active
&&
(
!
commentData
||
commentData
.
length
===
0
))
return
null
;
const
style
=
{
top
:
`
${
top
}
px`
,
};
return
(
<
Wrapper
style
=
{
style
}
active
=
{
active
}
data
-
box
=
{
commentId
}
className
=
{
className
}
onClick
=
{
onClickWrapper
}
top
=
{
top
}
>
<
Wrapper
active
=
{
active
}
className
=
{
className
}
onClick
=
{
onClickWrapper
}
>
{
active
&&
commentData
.
length
>
0
&&
(
<
Head
>
<
Resolve
onClick
=
{()
=>
onClickResolve
(
commentId
)}
>
Resolve
<
/Resolve
>
...
...
@@ -105,7 +92,6 @@ const CommentBox = props => {
CommentBox
.
propTypes
=
{
/** Whether this is the current active comment */
active
:
PropTypes
.
bool
,
top
:
PropTypes
.
number
,
/** List of objects containing data for comment items */
commentData
:
PropTypes
.
arrayOf
(
PropTypes
.
shape
({
...
...
@@ -129,7 +115,6 @@ CommentBox.propTypes = {
};
CommentBox
.
defaultProps
=
{
top
:
0
,
active
:
false
,
commentData
:
[],
};
...
...
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