Skip to content
Snippets Groups Projects
Commit d77f6c99 authored by chris's avatar chris
Browse files

cleanup comment state

parent 36e631cb
No related branches found
No related tags found
2 merge requests!548Merge yjs with standard comments,!545Overlapping comments
......@@ -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);
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment