mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-13 07:55:18 +00:00
fix: playlist displaying descriptions unescaped html #1784
This commit is contained in:
parent
1119c0e47d
commit
57c8f85731
@ -58,7 +58,7 @@ class PlaybuttonCard extends HookWidget {
|
|||||||
others: 15,
|
others: 15,
|
||||||
);
|
);
|
||||||
|
|
||||||
var unescapeHtml = description?.unescapeHtml();
|
final unescapeHtml = description?.unescapeHtml().cleanHtml();
|
||||||
return Container(
|
return Container(
|
||||||
constraints: BoxConstraints(maxWidth: size),
|
constraints: BoxConstraints(maxWidth: size),
|
||||||
margin: margin,
|
margin: margin,
|
||||||
|
@ -128,7 +128,9 @@ class TrackViewFlexHeader extends HookConsumerWidget {
|
|||||||
if (props.description != null &&
|
if (props.description != null &&
|
||||||
props.description!.isNotEmpty)
|
props.description!.isNotEmpty)
|
||||||
Text(
|
Text(
|
||||||
props.description!.unescapeHtml(),
|
props.description!
|
||||||
|
.unescapeHtml()
|
||||||
|
.cleanHtml(),
|
||||||
style:
|
style:
|
||||||
defaultTextStyle.style.copyWith(
|
defaultTextStyle.style.copyWith(
|
||||||
color: palette.bodyTextColor,
|
color: palette.bodyTextColor,
|
||||||
|
@ -1,12 +1,15 @@
|
|||||||
import 'package:html_unescape/html_unescape.dart';
|
import 'package:html_unescape/html_unescape.dart';
|
||||||
|
import 'package:html/parser.dart';
|
||||||
|
|
||||||
final htmlEscape = HtmlUnescape();
|
final htmlEscape = HtmlUnescape();
|
||||||
|
|
||||||
extension UnescapeHtml on String {
|
extension UnescapeHtml on String {
|
||||||
|
String cleanHtml() => parse("<p>$this</p>").documentElement!.text;
|
||||||
String unescapeHtml() => htmlEscape.convert(this);
|
String unescapeHtml() => htmlEscape.convert(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
extension NullableUnescapeHtml on String? {
|
extension NullableUnescapeHtml on String? {
|
||||||
|
String? cleanHtml() => this?.cleanHtml();
|
||||||
String? unescapeHtml() => this?.unescapeHtml();
|
String? unescapeHtml() => this?.unescapeHtml();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user