Add estimated height to some block widget decorations (#16485)

GitOrigin-RevId: f59da18228e038b1295ccc0128a33acd2de4f9f9
This commit is contained in:
Alf Eaton 2024-01-18 12:53:21 +00:00 committed by Copybot
parent 6b3a953c8d
commit 4bca3de8d2
3 changed files with 10 additions and 2 deletions

View file

@ -21,7 +21,7 @@ export class EndDocumentWidget extends WidgetType {
return true
}
updateDOM(): boolean {
return true
get estimatedHeight() {
return 30
}
}

View file

@ -84,6 +84,10 @@ export class PreambleWidget extends WidgetType {
return this.expanded === other.expanded
}
get estimatedHeight() {
return this.expanded ? -1 : 54
}
getToggleText(view: EditorView) {
if (this.expanded) {
return view.state.phrase(`hide_document_preamble`)

View file

@ -59,6 +59,10 @@ export class TabularWidget extends WidgetType {
return true
}
get estimatedHeight() {
return this.parsedTableData.table.rows.length * 50
}
destroy(element: HTMLElement) {
ReactDOM.unmountComponentAtNode(element)
}