Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.
Dart blogconfluence-alternativecontent-managementcontent-servicesdocumentationflutternote-takingnotion-alternativeproject-managementtask-managementteam-collaborationwiki
fix: do not wrap the inline math equation in a new line (#7035)
Lucasd7bda10e6f80
diff --git a/frontend/appflowy_flutter/integration_test/desktop/document/document_with_inline_math_equation_test.dart b/frontend/appflowy_flutter/integration_test/desktop/document/document_with_inline_math_equation_test.dartindex d437651672..45f688bd58 100644--- a/frontend/appflowy_flutter/integration_test/desktop/document/document_with_inline_math_equation_test.dart+++ b/frontend/appflowy_flutter/integration_test/desktop/document/document_with_inline_math_equation_test.dart@@ -147,7 +147,21 @@ void main() {const text = 'Hello World';await tester.ime.insertText(text);- expect(find.textContaining(text, findRichText: true), findsOneWidget);+ final inlineText = find.textContaining(text, findRichText: true);+ expect(inlineText, findsOneWidget);++ // the text should be in the same line with the math equation+ final inlineMathEquationPosition = tester.getRect(inlineMathEquation);+ final textPosition = tester.getRect(inlineText);+ // allow 5px difference+ expect(+ (textPosition.top - inlineMathEquationPosition.top).abs(),+ lessThan(5),+ );+ expect(+ (textPosition.bottom - inlineMathEquationPosition.bottom).abs(),+ lessThan(5),+ );});});}diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/inline_math_equation/inline_math_equation.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/inline_math_equation/inline_math_equation.dartindex 8daaa9f86f..e41bdc1114 100644--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/inline_math_equation/inline_math_equation.dart+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/inline_math_equation/inline_math_equation.dart@@ -80,20 +80,18 @@ class _InlineMathEquationState extends State<InlineMathEquation> {mathFontOptions: const FontOptions(fontShape: FontStyle.italic,),- fontSize: 14.0,+ fontSize: widget.textStyle?.fontSize ?? 14.0,color: widget.textStyle?.color ?? theme.colorScheme.onSurface,),onErrorFallback: (errmsg) {return FlowyText(errmsg.message,+ fontSize: widget.textStyle?.fontSize ?? 14.0,+ color: widget.textStyle?.color ?? theme.colorScheme.onSurface,);},);- return Row(- children: [- longEq,- ],- );+ return longEq;}}diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_style.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_style.dartindex 94f4c6c8d5..b3700d6e71 100644--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_style.dart+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_style.dart@@ -363,6 +363,7 @@ class EditorStyleCustomizer {if (formula is String) {return WidgetSpan(style: after.style,+ alignment: PlaceholderAlignment.middle,child: InlineMathEquation(node: node,index: index,