feat: comment collapse event (#7949)

* feat: define comment collapse event

* feat: add firing collapse events

* chore: add round-trip test

* chore: add tests for firing collapse events

* chore: format
This commit is contained in:
Beka Westberg
2024-04-04 22:48:34 +00:00
committed by GitHub
parent c0e6e6745f
commit fd177358ea
7 changed files with 195 additions and 0 deletions

View File

@@ -82,6 +82,15 @@ export class WorkspaceComment {
}
}
/** Fires a comment collapse event. */
private fireCollapseEvent(newCollapsed: boolean) {
if (eventUtils.isEnabled()) {
eventUtils.fire(
new (eventUtils.get(eventUtils.COMMENT_COLLAPSE))(this, newCollapsed),
);
}
}
/** Sets the text of the comment. */
setText(text: string) {
const oldText = this.text;
@@ -107,6 +116,7 @@ export class WorkspaceComment {
/** Sets whether the comment is collapsed or not. */
setCollapsed(collapsed: boolean) {
this.collapsed = collapsed;
this.fireCollapseEvent(collapsed);
}
/** Returns whether the comment is collapsed or not. */