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