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

fix yjs position from config

parent 37b8e537
No related branches found
No related tags found
1 merge request!548Merge yjs with standard comments
......@@ -119,6 +119,74 @@ const setComments = (
},
endHeight: 266.3579406738281,
},
{
id: 'b8d907d4-1859-49a9-abcd-13788d497758',
from: {
type: {
client: 2887320119,
clock: 150,
},
tname: null,
item: {
client: 2887320119,
clock: 185,
},
assoc: 0,
},
to: {
type: {
client: 2887320119,
clock: 150,
},
tname: null,
item: {
client: 2887320119,
clock: 195,
},
assoc: 0,
},
data: {
yjsFrom: {
type: {
client: 2887320119,
clock: 150,
},
tname: null,
item: {
client: 2887320119,
clock: 185,
},
assoc: 0,
},
yjsTo: {
type: {
client: 2887320119,
clock: 150,
},
tname: null,
item: {
client: 2887320119,
clock: 195,
},
assoc: 0,
},
pmFrom: 164,
pmTo: 174,
type: 'comment',
conversation: [
{
content: 'dfgdfgd',
displayName: 'admin',
userId: 'b3cfc28e-0f2e-45b5-b505-e66783d4f946',
timestamp: 1713699155995,
},
],
title: 'dgfdgf',
group: 'main',
viewId: 'main',
},
endHeight: 406.734375,
},
],
) => {
return comments;
......
......@@ -287,7 +287,7 @@ const updateMarks = (views, comments) => {
groupedMarkNodes.notes = groupedMarkNodes.notes.concat(newComments.notes);
return {
main: sortBy(groupedMarkNodes.main, ['from']),
main: sortBy(groupedMarkNodes.main, ['data.pmFrom']),
notes: groupedMarkNodes.notes,
};
}
......
......@@ -61,22 +61,20 @@ export default class CommentState {
if (ystate?.binding) {
const { doc, type, binding } = ystate;
console.log(this.allCommentsList());
this.allCommentsList().forEach((annotation, id) => {
if (typeof annotation.data.yjsFrom === 'number') {
annotation.data.yjsFrom = absolutePositionToRelativePosition(
annotation.data.yjsFrom,
type,
binding.mapping,
);
}
if (typeof annotation.data.yjsTo === 'number') {
annotation.data.yjsTo = absolutePositionToRelativePosition(
annotation.data.yjsTo,
type,
binding.mapping,
);
}
annotation.data.yjsFrom = absolutePositionToRelativePosition(
annotation.data.pmFrom,
type,
binding.mapping,
);
annotation.data.yjsTo = absolutePositionToRelativePosition(
annotation.data.pmTo,
type,
binding.mapping,
);
const from = relativePositionToAbsolutePosition(
doc,
type,
......
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