Skip to content

Commit

Permalink
[#65904] Introduce signals and simplify comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Trzcin authored and mgielda committed Nov 5, 2024
1 parent 6750ecf commit 0f64498
Show file tree
Hide file tree
Showing 8 changed files with 113 additions and 155 deletions.
27 changes: 27 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"@codemirror/state": "^6.2.1",
"@codemirror/view": "^6.16.0",
"@preact/compat": "^17.1.2",
"@preact/signals": "^1.3.0",
"codemirror": "^6.0.1",
"dompurify": "^2.3.5",
"imurmurhash": "^0.1.4",
Expand Down
4 changes: 2 additions & 2 deletions src/comments/sidebarWidget.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class CommentMarker extends GutterMarker {

if (this.lineNumber) {
this.gutterMarker.style.width = this.lineNumber.toString().length * 7 + "px";
this.gutterMarker.ondrop = () => this.ycomments.moveOrMerge(this.ycomments.draggedComment, this.lineNumber);
this.gutterMarker.ondrop = () => this.ycomments.moveOrMerge(this.ycomments.draggedComment.value, this.lineNumber);
this.gutterMarker.ondragover = (e) => e.preventDefault();
}
}
Expand All @@ -48,7 +48,7 @@ class CommentMarker extends GutterMarker {
} else {
this.icon.onclick = () => this.ycomments.display().switchVisibility(this.commentId);
this.icon.onmouseenter = () => {
this.ycomments.commentWithPopup = this.commentId;
this.ycomments.commentWithPopup.value = this.commentId;
this.ycomments.updateMainCodeMirror();
};
}
Expand Down
3 changes: 1 addition & 2 deletions src/comments/textareaWidget.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,7 @@ const commentStateEffect = StateField.define({

moveComments(transaction, ycomments);

return ycomments
.iterComments()
return ycomments.comments.value
.sort(sortByLine)
.reduce(...buildTextareaWidgets(transaction))
.finish();
Expand Down
Loading

0 comments on commit 0f64498

Please sign in to comment.