diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_configuration.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_configuration.dart index c8222c5e03..39cd608d0e 100644 --- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_configuration.dart +++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_configuration.dart @@ -92,8 +92,9 @@ Map getEditorBuilderMap({ final factor = pageStyle.fontLayout.factor; final headingPaddings = pageStyle.lineHeightLayout.headingPaddings .map((e) => e * factor); - final level = node.attributes[HeadingBlockKeys.level] ?? 6; - return EdgeInsets.only(top: headingPaddings.elementAt(level)); + int level = node.attributes[HeadingBlockKeys.level] ?? 6; + level = level.clamp(1, 6); + return EdgeInsets.only(top: headingPaddings.elementAt(level - 1)); } return const EdgeInsets.only(top: 12.0, bottom: 4.0);