fix: resolve data loss issue during block type conversion (#726)

* fix: resolve data loss issue during block type conversion

* fix: flutter test

* test: add more tests
This commit is contained in:
Lucas.Xu 2024-02-26 08:44:43 +07:00 • committed by GitHub
commit 5e5b908e78
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -10,10 +10,16 @@ Future<void> testFormatCharacterShortcut(
void Function(bool result, Node before, Node after, EditorState editorState)
test, {
String text = 'Welcome to AppFlowy Editor 🔥!',
Node? node,
}) async {
final document = Document.blank().addParagraph(
builder: (index) => Delta()..insert('$prefix$text'),
);
final document = Document.blank();
if (node != null) {
document.insert([0], [node]);
} else {
document.addParagraph(
builder: (index) => Delta()..insert('$prefix$text'),
);
}
final editorState = EditorState(document: document);
final selection = Selection.collapsed(