File tree Expand file tree Collapse file tree 2 files changed +7
-10
lines changed
frontend/appflowy_flutter
integration_test/desktop/document
lib/plugins/document/presentation/editor_plugins/delta Expand file tree Collapse file tree 2 files changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -483,16 +483,6 @@ void main() {
483483 });
484484 });
485485
486- testWidgets ('paste image url without extension' , (tester) async {
487- const plainText =
488- 'https://images.unsplash.com/photo-1469474968028-56623f02e42e?ixlib=rb-4.0.3&q=85&fm=jpg&crop=entropy&cs=srgb&dl=david-marcu-78A265wPiO4-unsplash.jpg&w=640' ;
489- await tester.pasteContent (plainText: plainText, (editorState) {
490- final node = editorState.getNodeAtPath ([0 ])! ;
491- expect (node.type, ImageBlockKeys .type);
492- expect (node.attributes[ImageBlockKeys .url], isNotEmpty);
493- });
494- });
495-
496486 const testMarkdownText = '''
497487# I'm h1
498488## I'm h2
Original file line number Diff line number Diff line change 1+ import 'package:appflowy/plugins/document/presentation/editor_plugins/link_preview/custom_link_parser.dart' ;
12import 'package:appflowy/plugins/document/presentation/editor_plugins/mention/mention_block.dart' ;
23import 'package:appflowy_editor/appflowy_editor.dart' ;
34
@@ -27,9 +28,15 @@ extension TextDeltaExtension on Delta {
2728 if (op.text == MentionBlockKeys .mentionChar) {
2829 final mention = attributes? [MentionBlockKeys .mention];
2930 final mentionPageId = mention? [MentionBlockKeys .pageId];
31+ final mentionType = mention? [MentionBlockKeys .type];
3032 if (mentionPageId != null ) {
3133 text += await getMentionPageName (mentionPageId);
3234 continue ;
35+ } else if (mentionType == MentionType .externalLink.name) {
36+ final url = mention? [MentionBlockKeys .url] ?? '' ;
37+ final info = await LinkInfoCache ().get (url);
38+ text += info? .siteName ?? url;
39+ continue ;
3340 }
3441 }
3542
You can’t perform that action at this time.
0 commit comments