You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If we have a text with h2 heading, Changing it to h1 from toolbar will just reset it to plain text. The subtype attribute becomes null but the heading will be h1 which causes the "H1" highlighted in toolbar but Appflowy editor it renders it as plain text.
The problem is rooted in this part of code which is intended for toggling attribute so if we try to format a quote subtype text again to quote subtype it just removes the quote (toggles it).
How to Reproduce
From toolbar change plain text to "H2" heading then try to change it to "H1".
Expected Behavior
To change from "H2" heading to "H1".
Operating System
Arch Linux
AppFlowy Version(s)
0.1.2
Screenshots
No response
Additional Context
This test case does not pass. If I'm right it should get added to "format_rich_text_style_test.dart" file
testWidgets('formatHeading from h2 to h1', (tester) async {
const text ='Welcome to Appflowy 😁';
final editor = tester.editor
..insertTextNode(text, attributes: {
BuiltInAttributeKey.subtype:BuiltInAttributeKey.heading,
BuiltInAttributeKey.heading:BuiltInAttributeKey.h2,
});
await editor.startTesting();
await editor.updateSelection(
Selection.single(path: [0], startOffset:0, endOffset: text.length),
);
// format the text to QuoteformatHeading(editor.editorState, BuiltInAttributeKey.h1);
await tester.pumpAndSettle(constDuration(milliseconds:100));
expect(find.byType(HeadingTextNodeWidget), findsOneWidget);
final tn = editor.nodeAtPath([0])!;
expect(tn.attributes.containsKey(BuiltInAttributeKey.subtype), true);
expect(tn.attributes[BuiltInAttributeKey.subtype],
BuiltInAttributeKey.heading);
expect(tn.attributes.containsKey(BuiltInAttributeKey.heading), true);
expect(
tn.attributes[BuiltInAttributeKey.heading], BuiltInAttributeKey.h1);
});
I'm not sure about all the cases but maybe an applicable solution would be that on removing subtype we should check if all other keys are unchanged or not.
The text was updated successfully, but these errors were encountered:
Bug Description
If we have a text with h2 heading, Changing it to h1 from toolbar will just reset it to plain text. The
subtype
attribute becomes null but the heading will beh1
which causes the "H1" highlighted in toolbar but Appflowy editor it renders it as plain text.The problem is rooted in this part of code which is intended for toggling attribute so if we try to format a quote
subtype
text again to quotesubtype
it just removes the quote (toggles it).How to Reproduce
From toolbar change plain text to "H2" heading then try to change it to "H1".
Expected Behavior
To change from "H2" heading to "H1".
Operating System
Arch Linux
AppFlowy Version(s)
0.1.2
Screenshots
No response
Additional Context
This test case does not pass. If I'm right it should get added to "format_rich_text_style_test.dart" file
I'm not sure about all the cases but maybe an applicable solution would be that on removing
subtype
we should check if all other keys are unchanged or not.The text was updated successfully, but these errors were encountered: