Skip to content

Quoting text containing an image is not rendered correctly #13

@mitalapo

Description

@mitalapo

When quoting a section with an embedded image, the image is shown just before the quoted section, instead of where it was initially.

As an example, the following bbcode:

Quoting text with an image:
[quote=Someone]Image should show below this line
[img]https://source.unsplash.com/random/100x100[/img]
Image should show above this line.[/quote]

rendered as follows:

image

The following worked around the issue for me:

class MyImgTag extends WrappedStyleTag {

  MyImgTag() : super("img");

  @override
  List<InlineSpan> wrap(
      FlutterRenderer renderer, bbob.Element element, List<InlineSpan> spans) {
    String url = element.children.first.textContent;

    return [
      WidgetSpan(
          child: Image.network(url, 
          errorBuilder: (context, error, stackTrace) {
              return Text("Error loading image ($url)\n$error");
          })),
    ];
  }
}

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions