Skip to content

Commit

Permalink
Fix initial comment expand state (#180941)
Browse files Browse the repository at this point in the history
Fixes #169928
  • Loading branch information
alexr00 authored Apr 26, 2023
1 parent a7cfec3 commit 4270de1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const COMMENTEDITOR_DECORATION_KEY = 'commenteditordecoration';

export class CommentThreadWidget<T extends IRange | ICellRange = IRange> extends Disposable implements ICommentThreadWidget {
private _header!: CommentThreadHeader<T>;
private _body!: CommentThreadBody<T>;
private _body: CommentThreadBody<T>;
private _commentReply?: CommentReply<T>;
private _additionalActions?: CommentThreadAdditionalActions<T>;
private _commentMenus: CommentMenus;
Expand Down Expand Up @@ -274,7 +274,7 @@ export class CommentThreadWidget<T extends IRange | ICellRange = IRange> extends
}

getDimensions() {
return this._body?.getDimensions();
return this._body.getDimensions();
}

layout(widthInPixel?: number) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -416,8 +416,12 @@ export class ReviewZoneWidget extends ZoneWidget implements ICommentThreadWidget
this._commentThreadWidget.submitComment();
}

_refresh(dimensions?: dom.Dimension) {
if (this._isExpanded && dimensions) {
_refresh(dimensions: dom.Dimension) {
if (dimensions.height === 0 && dimensions.width === 0) {
this.commentThread.collapsibleState = languages.CommentThreadCollapsibleState.Collapsed;
return;
}
if (this._isExpanded) {
this._commentThreadWidget.layout();

const headHeight = Math.ceil(this.editor.getOption(EditorOption.lineHeight) * 1.2);
Expand Down

0 comments on commit 4270de1

Please sign in to comment.