diff --git a/editors/demo/src/Editoria/config/config.js b/editors/demo/src/Editoria/config/config.js index a3d88270db8064ef37483ad944169e5aceb75ee3..ccb479884740f03e17c0060d28e196afa52310cd 100644 --- a/editors/demo/src/Editoria/config/config.js +++ b/editors/demo/src/Editoria/config/config.js @@ -64,6 +64,10 @@ const updateTitle = debounce(title => { console.log(title); }, 100); +const getComments = debounce(comments => { + console.log(comments); +}, 100); + const saveTags = tags => { // console.log(tags); }; @@ -159,9 +163,12 @@ export default { ), ], ImageService: { showAlt: true }, + CommentsService: { showTitle: true, + getComments, }, + CustomTagService: { tags: [ { label: 'custom-tag-label-1', tagType: 'inline' }, diff --git a/wax-prosemirror-services/src/CommentsService/CommentsService.js b/wax-prosemirror-services/src/CommentsService/CommentsService.js index e58bf9a112d6b664933c820fdc53c31d59565721..5a6454014c4ae584db0447836dfe506575425ee0 100644 --- a/wax-prosemirror-services/src/CommentsService/CommentsService.js +++ b/wax-prosemirror-services/src/CommentsService/CommentsService.js @@ -11,6 +11,8 @@ const PLUGIN_KEY = 'commentPlugin'; export default class CommentsService extends Service { boot() { + const commentsConfig = this.app.config.get('config.CommentsService'); + console.log(commentsConfig); this.app.PmPlugins.add(PLUGIN_KEY, CommentPlugin(PLUGIN_KEY)); this.app.PmPlugins.add( 'copyPasteCommentPlugin', @@ -19,7 +21,7 @@ export default class CommentsService extends Service { const options = { styles: {}, - onSelectionChange: items => console.log(items), + onSelectionChange: items => commentsConfig.getComments(items), onAnnotationListChange: () => true, document: '', field: 'annotations', diff --git a/wax-prosemirror-services/src/CommentsService/plugins/AnnotationState.js b/wax-prosemirror-services/src/CommentsService/plugins/AnnotationState.js index 2d2cae12bb10f155fb5a3cb6e5d48ad7dc68fa34..5632de31bdb40ef0766fc2deb93deeb02d0ddf88 100644 --- a/wax-prosemirror-services/src/CommentsService/plugins/AnnotationState.js +++ b/wax-prosemirror-services/src/CommentsService/plugins/AnnotationState.js @@ -154,7 +154,6 @@ export default class AnnotationState { } // manually map annotation positions this.options.map.forEach((annotation, _) => { - console.log(this.decorations); if ('from' in annotation && 'to' in annotation) { annotation.from = transaction.mapping.map(annotation.from); annotation.to = transaction.mapping.map(annotation.to);