From d77f6c999d7569268c1c7f6b83b7d7e3b363e595 Mon Sep 17 00:00:00 2001 From: chris <kokosias@yahoo.gr> Date: Tue, 19 Mar 2024 13:09:10 +0200 Subject: [PATCH] cleanup comment state --- .../CommentsService/plugins/CommentState.js | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/wax-prosemirror-services/src/CommentsService/plugins/CommentState.js b/wax-prosemirror-services/src/CommentsService/plugins/CommentState.js index ab427cc3b..f7e55fc20 100644 --- a/wax-prosemirror-services/src/CommentsService/plugins/CommentState.js +++ b/wax-prosemirror-services/src/CommentsService/plugins/CommentState.js @@ -43,29 +43,16 @@ export default class CommentState { allCommentsList() { const { map } = this.options; return Array.from(map, ([key, value]) => { - // eslint-disable-next-line prefer-object-spread - return Object.assign(Object.assign({}, value), { - id: key, - }); + return { ...value, id: key }; }).filter(value => { return 'from' in value && 'to' in value; }); } createDecorations(state) { - const { map } = this.options; - const decorations = []; - const termList = Array.from(map, ([key, value]) => { - // eslint-disable-next-line prefer-object-spread - return Object.assign(Object.assign({}, value), { - id: key, - }); - }).filter(value => { - return 'from' in value && 'to' in value; - }); - termList.forEach(annotation => { + this.allCommentsList().forEach(annotation => { const { from, to } = annotation; decorations.push( @@ -103,7 +90,6 @@ export default class CommentState { return this; } - // manually map annotation positions this.options.map.forEach((annotation, _) => { if ('from' in annotation && 'to' in annotation) { annotation.from = transaction.mapping.map(annotation.from); -- GitLab