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

remove broken if

parent 562d247e
No related branches found
No related tags found
No related merge requests found
...@@ -306,7 +306,7 @@ export default { ...@@ -306,7 +306,7 @@ export default {
// eslint-disable-next-line no-restricted-globals // eslint-disable-next-line no-restricted-globals
connectionUrl: 'ws://localhost:5010', connectionUrl: 'ws://localhost:5010',
// connectionUrl: 'ws://0.tcp.ap.ngrok.io:17607', // connectionUrl: 'ws://0.tcp.ap.ngrok.io:17607',
docIdentifier: 'prosemirror-rweedxefe5dc', docIdentifier: 'prosemirror-rweedxrefe5dc',
YjsType: 'prosemirror', YjsType: 'prosemirror',
}, },
......
...@@ -69,21 +69,17 @@ export default class CommentState { ...@@ -69,21 +69,17 @@ export default class CommentState {
if (ystate?.binding) { if (ystate?.binding) {
const { doc, type, binding } = ystate; const { doc, type, binding } = ystate;
this.allCommentsList().forEach((annotation, id) => { this.allCommentsList().forEach((annotation, id) => {
if (typeof annotation.data.yjsFrom !== 'object') { annotation.data.yjsFrom = absolutePositionToRelativePosition(
annotation.data.yjsFrom = absolutePositionToRelativePosition( annotation.data.pmFrom,
annotation.data.pmFrom, type,
type, binding.mapping,
binding.mapping, );
);
}
if (typeof annotation.data.yjsTo !== 'object') { annotation.data.yjsTo = absolutePositionToRelativePosition(
annotation.data.yjsTo = absolutePositionToRelativePosition( annotation.data.pmTo,
annotation.data.pmTo, type,
type, binding.mapping,
binding.mapping, );
);
}
const from = relativePositionToAbsolutePosition( const from = relativePositionToAbsolutePosition(
doc, doc,
...@@ -198,13 +194,14 @@ export default class CommentState { ...@@ -198,13 +194,14 @@ export default class CommentState {
if (action.type === 'createDecorations') { if (action.type === 'createDecorations') {
this.createDecorations(state); this.createDecorations(state);
} }
// this.createDecorations(state);
return this; return this;
} }
const ystate = ySyncPluginKey.getState(state); const ystate = ySyncPluginKey.getState(state);
if (ystate?.isChangeOrigin) { if (ystate?.isChangeOrigin) {
this.updateCommentPostions(ystate); // this.updateCommentPostions(ystate);
this.createDecorations(state); this.createDecorations(state);
return this; return this;
...@@ -226,17 +223,13 @@ export default class CommentState { ...@@ -226,17 +223,13 @@ export default class CommentState {
if (ystate?.binding && ystate?.binding.mapping) { if (ystate?.binding && ystate?.binding.mapping) {
this.updateCommentPostions(ystate); this.updateCommentPostions(ystate);
this.createDecorations(state);
return this; return this;
// eslint-disable-next-line no-else-return // eslint-disable-next-line no-else-return
} else { } else {
// Not YJS this.options.map.forEach((annotation, _) => {
map.forEach((annotation, _) => {
if ('from' in annotation && 'to' in annotation) { if ('from' in annotation && 'to' in annotation) {
annotation.data.pmFrom = transaction.mapping.map( annotation.from = transaction.mapping.map(annotation.from);
annotation.data.pmFrom, annotation.to = transaction.mapping.map(annotation.to);
);
annotation.data.pmTo = transaction.mapping.map(annotation.data.pmTo);
} }
}); });
this.createDecorations(state); this.createDecorations(state);
......
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