@@ -357,6 +357,73 @@ class ContentExample {
357
357
ImageNode (srcUrl: 'https://uploads.zulipusercontent.net/51b70540cf6a5b3c8a0b919c893b8abddd447e88/68747470733a2f2f656e2e77696b6970656469612e6f72672f7374617469632f696d616765732f69636f6e732f77696b6970656469612e706e673f763d33' ),
358
358
]),
359
359
]);
360
+
361
+ static const imageInImplicitParagraph = ContentExample (
362
+ 'image as immediate child in implicit paragraph' ,
363
+ "* https://chat.zulip.org/user_avatars/2/realm/icon.png" ,
364
+ '<ul>\n '
365
+ '<li>'
366
+ '<div class="message_inline_image">'
367
+ '<a href="https://chat.zulip.org/user_avatars/2/realm/icon.png">'
368
+ '<img src="https://chat.zulip.org/user_avatars/2/realm/icon.png"></a></div></li>\n </ul>' , [
369
+ ListNode (ListStyle .unordered, [[
370
+ ImageNodeList ([
371
+ ImageNode (srcUrl: 'https://chat.zulip.org/user_avatars/2/realm/icon.png' ),
372
+ ]),
373
+ ]]),
374
+ ]);
375
+
376
+ static const imageClusterInImplicitParagraph = ContentExample (
377
+ 'image cluster in implicit paragraph' ,
378
+ "* [icon.png](https://chat.zulip.org/user_avatars/2/realm/icon.png) [icon.png](https://chat.zulip.org/user_avatars/2/realm/icon.png?version=2)" ,
379
+ '<ul>\n '
380
+ '<li>'
381
+ '<a href="https://chat.zulip.org/user_avatars/2/realm/icon.png">icon.png</a> '
382
+ '<a href="https://chat.zulip.org/user_avatars/2/realm/icon.png?version=2">icon.png</a>'
383
+ '<div class="message_inline_image">'
384
+ '<a href="https://chat.zulip.org/user_avatars/2/realm/icon.png" title="icon.png">'
385
+ '<img src="https://chat.zulip.org/user_avatars/2/realm/icon.png"></a></div>'
386
+ '<div class="message_inline_image">'
387
+ '<a href="https://chat.zulip.org/user_avatars/2/realm/icon.png?version=2" title="icon.png">'
388
+ '<img src="https://chat.zulip.org/user_avatars/2/realm/icon.png?version=2"></a></div></li>\n </ul>' , [
389
+ ListNode (ListStyle .unordered, [[
390
+ ParagraphNode (wasImplicit: true , links: null , nodes: [
391
+ LinkNode (url: 'https://chat.zulip.org/user_avatars/2/realm/icon.png' , nodes: [TextNode ('icon.png' )]),
392
+ TextNode (' ' ),
393
+ LinkNode (url: 'https://chat.zulip.org/user_avatars/2/realm/icon.png?version=2' , nodes: [TextNode ('icon.png' )]),
394
+ ]),
395
+ ImageNodeList ([
396
+ ImageNode (srcUrl: 'https://chat.zulip.org/user_avatars/2/realm/icon.png' ),
397
+ ImageNode (srcUrl: 'https://chat.zulip.org/user_avatars/2/realm/icon.png?version=2' ),
398
+ ]),
399
+ ]]),
400
+ ]);
401
+
402
+ static final contentAfterImageClusterInImplicitParagraph = ContentExample (
403
+ 'impossible content after image cluster in implicit paragraph' ,
404
+ // Image previews are always inserted at the end of the paragraph
405
+ // so it would be impossible to have content after.
406
+ null ,
407
+ '<ul>\n '
408
+ '<li>'
409
+ '<a href="https://chat.zulip.org/user_avatars/2/realm/icon.png">icon.png</a> '
410
+ '<div class="message_inline_image">'
411
+ '<a href="https://chat.zulip.org/user_avatars/2/realm/icon.png" title="icon.png">'
412
+ '<img src="https://chat.zulip.org/user_avatars/2/realm/icon.png"></a></div>'
413
+ '<span>Some content</span></li>\n </ul>' , [
414
+ ListNode (ListStyle .unordered, [[
415
+ const ParagraphNode (wasImplicit: true , links: null , nodes: [
416
+ LinkNode (url: 'https://chat.zulip.org/user_avatars/2/realm/icon.png' , nodes: [TextNode ('icon.png' )]),
417
+ TextNode (' ' ),
418
+ ]),
419
+ const ImageNodeList ([
420
+ ImageNode (srcUrl: 'https://chat.zulip.org/user_avatars/2/realm/icon.png' ),
421
+ ]),
422
+ ParagraphNode (wasImplicit: true , links: null , nodes: [
423
+ inlineUnimplemented ('<span>Some content</span>' ),
424
+ ])
425
+ ]]),
426
+ ]);
360
427
}
361
428
362
429
UnimplementedBlockContentNode blockUnimplemented (String html) {
@@ -685,6 +752,9 @@ void main() {
685
752
testParseExample (ContentExample .multipleImages);
686
753
testParseExample (ContentExample .contentAfterImageCluster);
687
754
testParseExample (ContentExample .multipleImageClusters);
755
+ testParseExample (ContentExample .imageInImplicitParagraph);
756
+ testParseExample (ContentExample .imageClusterInImplicitParagraph);
757
+ testParseExample (ContentExample .contentAfterImageClusterInImplicitParagraph);
688
758
689
759
testParse ('parse nested lists, quotes, headings, code blocks' ,
690
760
// "1. > ###### two\n > * three\n\n four"
0 commit comments