Fix initial comment expand state (#180941)

Fixes #169928
This commit is contained in:
Alex Ross
2023-04-26 15:58:12 +02:00
committed by GitHub
parent a7cfec356b
commit 4270de1f3a
2 changed files with 8 additions and 4 deletions

View File

@@ -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;
@@ -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) {

View File

@@ -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);