@@ -10,6 +10,7 @@ import * as dom from '../utils/dom.js';
1010import { Svg } from '../utils/svg.js' ;
1111import type { WorkspaceSvg } from '../workspace_svg.js' ;
1212import { CommentBarButton } from './comment_bar_button.js' ;
13+ import type { CommentView } from './comment_view.js' ;
1314
1415/**
1516 * Magic string appended to the comment ID to create a unique ID for this button.
@@ -42,8 +43,9 @@ export class CollapseCommentBarButton extends CommentBarButton {
4243 protected readonly id : string ,
4344 protected readonly workspace : WorkspaceSvg ,
4445 protected readonly container : SVGGElement ,
46+ protected readonly commentView : CommentView ,
4547 ) {
46- super ( id , workspace , container ) ;
48+ super ( id , workspace , container , commentView ) ;
4749
4850 this . icon = dom . createSvgElement (
4951 Svg . IMAGE ,
@@ -86,14 +88,13 @@ export class CollapseCommentBarButton extends CommentBarButton {
8688 override performAction ( e ?: Event ) {
8789 touch . clearTouchIdentifier ( ) ;
8890
89- const comment = this . getParentComment ( ) ;
90- comment . view . bringToFront ( ) ;
91+ this . getCommentView ( ) . bringToFront ( ) ;
9192 if ( e && e instanceof PointerEvent && browserEvents . isRightButton ( e ) ) {
9293 e . stopPropagation ( ) ;
9394 return ;
9495 }
9596
96- comment . setCollapsed ( ! comment . isCollapsed ( ) ) ;
97+ this . getCommentView ( ) . setCollapsed ( ! this . getCommentView ( ) . isCollapsed ( ) ) ;
9798 this . workspace . hideChaff ( ) ;
9899
99100 e ?. stopPropagation ( ) ;
0 commit comments