mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2025-12-28 23:58:28 +00:00
fix: do not wrap the inline math equation in a new line (#7035)
* fix: do not wrap the inline math equation in new line * test: inline equation text and inline text align
This commit is contained in:
parent
20bff9003e
commit
d7bda10e6f
@ -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),
|
||||
);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -363,6 +363,7 @@ class EditorStyleCustomizer {
|
||||
if (formula is String) {
|
||||
return WidgetSpan(
|
||||
style: after.style,
|
||||
alignment: PlaceholderAlignment.middle,
|
||||
child: InlineMathEquation(
|
||||
node: node,
|
||||
index: index,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user