From cede0585d9b928419a51ff40d99927582b83c0d5 Mon Sep 17 00:00:00 2001 From: chris <kokosias@yahoo.gr> Date: Tue, 28 Mar 2023 12:22:33 +0300 Subject: [PATCH] add deletion --- .../track-changes/helpers/markDeletion.js | 14 +++++++++++--- .../track-changes/helpers/markInsertion.js | 2 ++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/wax-prosemirror-core/src/utilities/track-changes/helpers/markDeletion.js b/wax-prosemirror-core/src/utilities/track-changes/helpers/markDeletion.js index 8c0781266..8b4dce4c8 100644 --- a/wax-prosemirror-core/src/utilities/track-changes/helpers/markDeletion.js +++ b/wax-prosemirror-core/src/utilities/track-changes/helpers/markDeletion.js @@ -1,5 +1,7 @@ +/* eslint-disable prefer-object-spread */ /* eslint-disable consistent-return */ import { Selection, TextSelection } from 'prosemirror-state'; +import { v4 as uuidv4 } from 'uuid'; import { Slice } from 'prosemirror-model'; import { ReplaceStep, Mapping } from 'prosemirror-transform'; import removeNode from './removeNode'; @@ -97,13 +99,19 @@ const markDeletion = (tr, from, to, user, date, group, viewId) => { user: user.userId, username: user.username, style: `color: ${user.userColor.deletion};`, - - // date + date, + group, + viewid: viewId, }); tr.setNodeMarkup( deletionMap.map(pos), null, - Object.assign(node.attrs.track, { track }), + Object.assign({}, node.attrs, { + track, + group, + id: uuidv4(), + }), + // Object.assign(node.attrs.track, { track }), node.marks, ); } diff --git a/wax-prosemirror-core/src/utilities/track-changes/helpers/markInsertion.js b/wax-prosemirror-core/src/utilities/track-changes/helpers/markInsertion.js index 21ff69f48..de12bcf11 100644 --- a/wax-prosemirror-core/src/utilities/track-changes/helpers/markInsertion.js +++ b/wax-prosemirror-core/src/utilities/track-changes/helpers/markInsertion.js @@ -1,3 +1,4 @@ +/* eslint-disable no-else-return */ import { v4 as uuidv4 } from 'uuid'; const markInsertion = (tr, from, to, user, date, group, viewId) => { @@ -39,6 +40,7 @@ const markInsertion = (tr, from, to, user, date, group, viewId) => { tr.setNodeMarkup( pos, null, + // eslint-disable-next-line prefer-object-spread Object.assign({}, node.attrs, { track, group, -- GitLab