mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
fix: markdown decoder and encoder test error
This commit is contained in:
parent
29952bc7fd
commit
114968f2ee
@ -80,7 +80,7 @@ class DocumentMarkdownDecoder extends Converter<String, Document> {
|
||||
BuiltInAttributeKey.subtype: BuiltInAttributeKey.quote,
|
||||
},
|
||||
);
|
||||
} else if (RegExp(r'^-*').stringMatch(text) == text) {
|
||||
} else if (text.isNotEmpty && RegExp(r'^-*').stringMatch(text) == text) {
|
||||
return Node(type: 'divider');
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,15 @@
|
||||
import 'package:appflowy_editor/appflowy_editor.dart';
|
||||
import 'package:appflowy_editor/src/plugins/markdown/encoder/parser/divider_node_parser.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() async {
|
||||
group('divider_node_parser.dart', () {
|
||||
test('parser divider node', () {
|
||||
final node = Node(
|
||||
type: 'divider',
|
||||
);
|
||||
final result = const DividerNodeParser().transform(node);
|
||||
expect(result, '---\n');
|
||||
});
|
||||
});
|
||||
}
|
@ -86,7 +86,7 @@ void main() async {
|
||||
final node = TextNode(
|
||||
delta: Delta(operations: [TextInsert(text)]),
|
||||
attributes: {
|
||||
BuiltInAttributeKey.subtype: 'code-block',
|
||||
BuiltInAttributeKey.subtype: 'code_block',
|
||||
},
|
||||
);
|
||||
expect(const TextNodeParser().transform(node), '```\n$text\n```');
|
||||
|
Loading…
Reference in New Issue
Block a user