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
44ef9d67
Commit
44ef9d67
authored
4 years ago
by
chris
Browse files
Options
Downloads
Patches
Plain Diff
temp fix for pasted comment ids
parent
48fb0b38
No related branches found
No related tags found
1 merge request
!104
temp fix for pasted comment ids
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
wax-prosemirror-components/src/components/comments/CommentComponent.js
+23
-2
23 additions, 2 deletions
...or-components/src/components/comments/CommentComponent.js
with
23 additions
and
2 deletions
wax-prosemirror-components/src/components/comments/CommentComponent.js
+
23
−
2
View file @
44ef9d67
...
...
@@ -11,6 +11,7 @@ import { WaxContext } from "wax-prosemirror-core";
import
{
DocumentHelpers
}
from
"
wax-prosemirror-utilities
"
;
import
CommentsBoxList
from
"
./CommentsBoxList
"
;
import
{
each
}
from
"
lodash
"
;
import
{
v4
as
uuidv4
}
from
"
uuid
"
;
export
default
({
area
})
=>
{
const
{
view
:
{
main
},
app
,
activeView
}
=
useContext
(
WaxContext
);
...
...
@@ -83,7 +84,7 @@ export default ({ area }) => {
let
i
=
pos
;
// first one active, none above
if
(
pos
===
0
)
b
=
false
;
if
(
i
===
0
)
b
=
false
;
while
(
b
)
{
const
boxAbove
=
comments
[
area
][
i
-
1
];
...
...
@@ -140,15 +141,35 @@ const updateComments = view => {
view
.
state
.
schema
.
marks
.
comment
,
true
);
const
allComments
=
nodes
.
map
(
node
=>
{
return
node
.
node
.
marks
.
filter
(
comment
=>
{
if
(
comment
.
type
.
name
===
"
comment
"
)
{
comment
.
pos
=
node
.
pos
;
comment
.
length
=
node
.
node
.
nodeSize
;
}
return
comment
.
type
.
name
===
"
comment
"
;
});
});
const
groupedComments
=
{};
allComments
.
forEach
(
comment
=>
{
//TEMP SOLUTION //TODO PROPERLY FIX IN PM PASTE
if
(
comment
[
0
].
attrs
.
id
===
""
)
{
const
commentMark
=
view
.
state
.
schema
.
marks
.
comment
;
const
{
tr
}
=
view
.
state
;
view
.
dispatch
(
tr
.
setMeta
(
"
addToHistory
"
,
false
).
addMark
(
comment
[
0
].
pos
,
comment
[
0
].
pos
+
comment
[
0
].
length
,
commentMark
.
create
({
...((
comment
[
0
]
&&
comment
[
0
].
attrs
)
||
{}),
id
:
uuidv4
()
})
)
);
}
// until here
if
(
!
groupedComments
[
comment
[
0
].
attrs
.
group
])
{
groupedComments
[
comment
[
0
].
attrs
.
group
]
=
[
comment
[
0
]];
}
else
{
...
...
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