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
f25fdb97
Commit
f25fdb97
authored
4 years ago
by
chris
Browse files
Options
Downloads
Patches
Plain Diff
keep in grouped comments same id
parent
81629090
No related branches found
No related tags found
1 merge request
!108
show comments as one in plugin
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
wax-prosemirror-core/src/helpers/TransformPasted.js
+7
-4
7 additions, 4 deletions
wax-prosemirror-core/src/helpers/TransformPasted.js
wax-prosemirror-services/src/NoteService/helpers/TransformPasted.js
+18
-6
18 additions, 6 deletions
...irror-services/src/NoteService/helpers/TransformPasted.js
with
25 additions
and
10 deletions
wax-prosemirror-core/src/helpers/TransformPasted.js
+
7
−
4
View file @
f25fdb97
import
{
forEach
}
from
"
lodash
"
;
import
{
v4
as
uuidv4
}
from
"
uuid
"
;
import
{
v4
as
uuidv4
}
from
"
uuid
"
;
import
{
DocumentHelpers
}
from
"
wax-prosemirror-utilities
"
;
import
{
DocumentHelpers
}
from
"
wax-prosemirror-utilities
"
;
...
@@ -30,10 +31,12 @@ const transformPasted = (slice, view) => {
...
@@ -30,10 +31,12 @@ const transformPasted = (slice, view) => {
return
obj
;
return
obj
;
},
{});
},
{});
//TODO check to alter attr with transform
forEach
(
Object
.
keys
(
groupedCommentsById
),
key
=>
{
// allComments.forEach(comment => {
let
id
=
uuidv4
();
// comment[0].attrs.id = uuidv4();
forEach
(
groupedCommentsById
[
key
],
comment
=>
{
// });
comment
.
attrs
.
id
=
id
;
});
});
notes
.
forEach
(
note
=>
{
notes
.
forEach
(
note
=>
{
note
.
node
.
attrs
.
id
=
uuidv4
();
note
.
node
.
attrs
.
id
=
uuidv4
();
...
...
This diff is collapsed.
Click to expand it.
wax-prosemirror-services/src/NoteService/helpers/TransformPasted.js
+
18
−
6
View file @
f25fdb97
import
{
forEach
}
from
"
lodash
"
;
import
{
v4
as
uuidv4
}
from
"
uuid
"
;
import
{
v4
as
uuidv4
}
from
"
uuid
"
;
import
{
DocumentHelpers
}
from
"
wax-prosemirror-utilities
"
;
import
{
DocumentHelpers
}
from
"
wax-prosemirror-utilities
"
;
...
@@ -9,15 +10,26 @@ const transformPasted = (slice, view) => {
...
@@ -9,15 +10,26 @@ const transformPasted = (slice, view) => {
true
true
);
);
const
allComments
=
commentNodes
.
map
(
node
=>
{
const
allComments
=
[];
return
node
.
node
.
marks
.
filter
(
comment
=>
{
return
comment
.
type
.
name
===
"
comment
"
;
commentNodes
.
map
(
node
=>
{
node
.
node
.
marks
.
map
(
comment
=>
{
if
(
comment
.
type
.
name
===
"
comment
"
)
{
allComments
.
push
(
comment
);
}
});
});
});
});
//TODO check to alter attr with transform
let
groupedCommentsById
=
allComments
.
reduce
((
obj
,
mark
)
=>
{
allComments
.
forEach
(
comment
=>
{
obj
[
mark
.
attrs
.
id
]
=
[...(
obj
[
mark
.
attrs
.
id
]
||
[]),
mark
];
comment
[
0
].
attrs
.
id
=
uuidv4
();
return
obj
;
},
{});
forEach
(
Object
.
keys
(
groupedCommentsById
),
key
=>
{
let
id
=
uuidv4
();
forEach
(
groupedCommentsById
[
key
],
comment
=>
{
comment
.
attrs
.
id
=
id
;
});
});
});
return
slice
;
return
slice
;
...
...
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