Skip to content

Commit

Permalink
fix: error with natural height when no lines exist (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
StevenEWright committed Aug 29, 2023
1 parent 34736ce commit 7706db5
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/internals/text_editor/text_editor_view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,11 @@ export class TextEditorView {

/** @inheritDoc */
get naturalHeight(): string {
if (this.lineMetrics.length === 0) {
return `calc(${getComputedStyle(this.contentEditableSurface).paddingTop} + ${
getComputedStyle(this.contentEditableSurface).paddingBottom
})`;
}
const lastLine = this.lineMetrics[this.lineMetrics.length - 1];
const bottomContent = lastLine.top + lastLine.height;
let bottomPadding = getComputedStyle(this.contentEditableSurface).paddingBottom;
Expand Down

0 comments on commit 7706db5

Please sign in to comment.