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
a989f418
Commit
a989f418
authored
4 years ago
by
chris
Browse files
Options
Downloads
Patches
Plain Diff
if all block is deleted mark it
parent
f56b6ed3
No related branches found
No related tags found
1 merge request
!143
Track changes
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
wax-prosemirror-services/src/TrackChangeService/track-changes/helpers/markDeletion.js
+25
-18
25 additions, 18 deletions
.../TrackChangeService/track-changes/helpers/markDeletion.js
with
25 additions
and
18 deletions
wax-prosemirror-services/src/TrackChangeService/track-changes/helpers/markDeletion.js
+
25
−
18
View file @
a989f418
...
...
@@ -51,9 +51,7 @@ const markDeletion = (tr, from, to, user, date, group) => {
)
)
{
let
removeStep
;
// user has created element. so (s)he is allowed to delete it again.
if
(
node
.
isTextblock
&&
to
<
pos
+
node
.
nodeSize
)
{
// The node is a textblock. So we need to merge into the last possible position inside the last text block.
const
selectionBefore
=
Selection
.
findFrom
(
tr
.
doc
.
resolve
(
pos
),
-
1
);
if
(
selectionBefore
instanceof
TextSelection
)
{
removeStep
=
new
ReplaceStep
(
...
...
@@ -73,22 +71,31 @@ const markDeletion = (tr, from, to, user, date, group) => {
if
(
!
tr
.
maybeStep
(
removeStep
).
failed
)
{
deletionMap
.
appendMap
(
removeStep
.
getMap
());
}
}
else
{
if
(
node
.
content
.
size
===
0
)
{
const
track
=
node
.
attrs
.
track
.
slice
();
track
.
push
({
type
:
'
deletion
'
,
user
:
user
.
userId
,
username
:
user
.
username
,
// date
});
tr
.
setNodeMarkup
(
deletionMap
.
map
(
pos
),
null
,
Object
.
assign
({},
node
.
attrs
,
{
track
}),
node
.
marks
,
);
}
}
let
counter
=
3
;
node
.
content
.
forEach
((
item
,
i
)
=>
{
item
.
marks
.
forEach
(
mark
=>
{
if
(
mark
.
type
.
name
===
'
deletion
'
)
{
counter
+=
item
.
nodeSize
;
}
});
});
if
(
node
.
content
.
size
===
0
||
counter
===
node
.
nodeSize
)
{
const
track
=
node
.
attrs
.
track
.
slice
();
track
.
push
({
type
:
'
deletion
'
,
user
:
user
.
userId
,
username
:
user
.
username
,
// date
});
tr
.
setNodeMarkup
(
deletionMap
.
map
(
pos
),
null
,
Object
.
assign
(
node
.
attrs
.
track
,
{
track
}),
node
.
marks
,
);
}
}
});
...
...
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