mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-09-07 01:09:54 +08:00
fix(editor): time issues of comment initialization (#13031)
#### PR Dependency Tree * **PR #13031** 👈 This tree was auto-generated by [Charcoal](https://github.com/danerwilliams/charcoal) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added the ability to filter comments by their resolution status (resolved, unresolved, or all) when viewing or managing comments. * **Refactor** * Improved the way commented text is identified and retrieved, resulting in more reliable comment selection and filtering. * Enhanced comment retrieval to support asynchronous data loading, ensuring up-to-date comment information. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -244,8 +244,14 @@ export function mockCommentProvider() {
|
||||
this.commentHighlightSubject.next(id);
|
||||
}
|
||||
|
||||
getComments() {
|
||||
return Array.from(this.comments.keys());
|
||||
getComments(type: 'resolved' | 'unresolved' | 'all' = 'all') {
|
||||
return Array.from(this.comments.entries())
|
||||
.filter(([_, comment]) => {
|
||||
if (type === 'all') return true;
|
||||
if (type === 'resolved') return comment.resolved;
|
||||
return !comment.resolved;
|
||||
})
|
||||
.map(([id]) => id);
|
||||
}
|
||||
|
||||
onCommentAdded(
|
||||
|
||||
Reference in New Issue
Block a user