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

remove comment from map and context

parent cf28dafc
No related branches found
No related tags found
1 merge request!548Merge yjs with standard comments
......@@ -48,7 +48,7 @@ export default class CommentsService extends Service {
this.allCommentsFromStates = this.allCommentsFromStates.concat([
...items,
]);
commentsConfig.getComments(this.allCommentsFromStates);
if (this.app.context.options.resolvedComment) {
this.allCommentsFromStates = this.allCommentsFromStates.filter(
comm => {
......@@ -56,6 +56,7 @@ export default class CommentsService extends Service {
},
);
}
commentsConfig.getComments(this.allCommentsFromStates);
this.app.context.setOption({ comments: this.allCommentsFromStates });
},
};
......
......@@ -5,6 +5,7 @@ import useDeepCompareEffect from 'use-deep-compare-effect';
import { each, uniqBy, sortBy, groupBy } from 'lodash';
import { WaxContext, DocumentHelpers } from 'wax-prosemirror-core';
import BoxList from './BoxList';
import { CommentDecorationPluginKey } from '../plugins/CommentDecorationPlugin';
export default ({ area, users }) => {
const context = useContext(WaxContext);
......@@ -80,12 +81,22 @@ export default ({ area, users }) => {
WaxSurface.top +
parseInt(WaxSurfaceMarginTop.slice(0, -2), 10);
} else {
// comment is deleted
// comment is deleted from editing surface
context.setOption({ resolvedComment: id });
context.setOption({
comments: comments.filter(comment => {
return comment.id !== id;
}),
});
setTimeout(() => {
activeView.dispatch(
activeView.state.tr.setMeta(CommentDecorationPluginKey, {
type: 'deleteComment',
id,
}),
);
});
}
} else {
// Notes
......
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