diff --git a/editors/demo/src/Editoria/Editoria.js b/editors/demo/src/Editoria/Editoria.js index 8837b278e3d8c3e0e7c6f5a3ea237f63a71cfb22..3e85568eaea88403be4213b9ad9291685b3f3d73 100644 --- a/editors/demo/src/Editoria/Editoria.js +++ b/editors/demo/src/Editoria/Editoria.js @@ -55,7 +55,7 @@ const Editoria = () => { autoFocus placeholder="Type Something..." fileUpload={file => renderImage(file)} - value={demo} + // value={demo} // readonly layout={layout} // onChange={debounce(source => { diff --git a/editors/demo/src/Editoria/config/config.js b/editors/demo/src/Editoria/config/config.js index bfde4d975bc3f98198053ec259c9072afe60b5eb..fcabb130988d33322cfe306ac53ab50fac66481f 100644 --- a/editors/demo/src/Editoria/config/config.js +++ b/editors/demo/src/Editoria/config/config.js @@ -77,8 +77,8 @@ const setComments = ( to: 10, data: { type: 'comment', - yjsTo: 10, yjsFrom: 5, + yjsTo: 10, conversation: [ { content: '1111', @@ -231,11 +231,11 @@ export default { ], updateTags: saveTags, }, - // YjsService: { - // // eslint-disable-next-line no-restricted-globals - // connectionUrl: 'ws://localhost:4000', - // docIdentifier: 'prosemirror-demo', - // }, + YjsService: { + // eslint-disable-next-line no-restricted-globals + connectionUrl: 'ws://localhost:4000', + docIdentifier: 'prosemirror-demo', + }, AskAiContentService: { AskAiContentTransformation: DummyPromise, @@ -243,7 +243,7 @@ export default { }, services: [ - // new YjsService(), + new YjsService(), new BlockDropDownToolGroupService(), new AskAiContentService(), new CustomTagService(), diff --git a/wax-prosemirror-services/src/CommentsService/components/RightArea.js b/wax-prosemirror-services/src/CommentsService/components/RightArea.js index 9235252460aa325ddb6d1ba3fce600e4ff350851..2c2eec555382ae8d64bdad36f44b656872cbd2c4 100644 --- a/wax-prosemirror-services/src/CommentsService/components/RightArea.js +++ b/wax-prosemirror-services/src/CommentsService/components/RightArea.js @@ -14,7 +14,7 @@ export default ({ area, users }) => { pmViews: { main }, app, activeView, - options: { comments }, + options: { comments, commentsMap }, } = context; const commentPlugin = app.PmPlugins.get('commentPlugin'); @@ -80,7 +80,7 @@ export default ({ area, users }) => { markNodeEl.getBoundingClientRect().top - WaxSurface.top + parseInt(WaxSurfaceMarginTop.slice(0, -2), 10); - } else { + } else if (!isFirstRun) { // comment is deleted from editing surface context.setOption({ resolvedComment: id }); context.setOption({ @@ -96,6 +96,19 @@ export default ({ area, users }) => { id, }), ); + + if (context.app.config.get('config.YjsService')) { + commentsMap.observe(() => { + const transaction = context.pmViews.main.state.tr.setMeta( + CommentDecorationPluginKey, + { + type: 'createDecorations', + }, + ); + + context.pmViews.main.dispatch(transaction); + }); + } }); } } else { diff --git a/wax-prosemirror-services/src/CommentsService/plugins/CommentState.js b/wax-prosemirror-services/src/CommentsService/plugins/CommentState.js index 790cc86f88446302be2c36dba8a1e2b53f7d480a..02ce2d3f13f46099fec2c226ce85b10a4c8f0155 100644 --- a/wax-prosemirror-services/src/CommentsService/plugins/CommentState.js +++ b/wax-prosemirror-services/src/CommentsService/plugins/CommentState.js @@ -155,6 +155,7 @@ export default class CommentState { ); const annotation = this.options.map.get(id); + annotation.from = newFrom; annotation.to = newTo;