-
Notifications
You must be signed in to change notification settings - Fork 337
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[QUESTION] how to handle relative url of images? #50
Comments
What is your use case? Do you have HTML as |
initialText with relative image URLs |
The best way would be to use the html package: final doc = parse(htmlData);
doc.getElementsByTagName("img").forEach((element) {
element.attributes['src'] = "prefix here" + element.attributes['src']!;
});
String newHtmlData = doc.outerHtml; And use |
Thank you... |
That is correct it does, however I cannot implement it in the same way in this package (and you cannot use it to help you outside of I would have to use the code above since I never parse the HTML, it is handled by the webview. I would prefer not to add an extra dependency for a small feature, that's why I think its best the user handle those things on their own in Btw if you pass to var doc;
String newHtmlData;
@override
initState() {
doc = parse(htmlData);
doc.getElementsByTagName("img").forEach((element) {
element.attributes['src'] = "prefix here" + element.attributes['src']!;
});
newHtmlData = doc.outerHtml;
super.initState();
}
@override
Widget build(BuildContext context) {
return Column(
children: [
Html.fromDom(doc), //no need for customImageRender
HtmlEditor(initialText: newHtmlData),
]
);
} |
Understood, thanks a lot |
Type question here.
The text was updated successfully, but these errors were encountered: