chore: Follow up selectable text
This commit is contained in:
parent
60bcc6b89f
commit
8148999512
1 changed files with 76 additions and 73 deletions
|
|
@ -74,79 +74,82 @@ class HtmlMessage extends StatelessWidget {
|
||||||
);
|
);
|
||||||
|
|
||||||
// there is no need to pre-validate the html, as we validate it while rendering
|
// there is no need to pre-validate the html, as we validate it while rendering
|
||||||
return Html(
|
return MouseRegion(
|
||||||
data: linkifiedRenderHtml,
|
cursor: SystemMouseCursors.text,
|
||||||
style: {
|
child: Html(
|
||||||
'*': Style(
|
data: linkifiedRenderHtml,
|
||||||
color: textColor,
|
style: {
|
||||||
margin: Margins.all(0),
|
'*': Style(
|
||||||
fontSize: FontSize(fontSize),
|
color: textColor,
|
||||||
),
|
margin: Margins.all(0),
|
||||||
'a': Style(color: linkColor, textDecorationColor: linkColor),
|
fontSize: FontSize(fontSize),
|
||||||
'h1': Style(
|
),
|
||||||
fontSize: FontSize(fontSize * 2),
|
'a': Style(color: linkColor, textDecorationColor: linkColor),
|
||||||
lineHeight: LineHeight.number(1.5),
|
'h1': Style(
|
||||||
fontWeight: FontWeight.w600,
|
fontSize: FontSize(fontSize * 2),
|
||||||
),
|
lineHeight: LineHeight.number(1.5),
|
||||||
'h2': Style(
|
fontWeight: FontWeight.w600,
|
||||||
fontSize: FontSize(fontSize * 1.75),
|
),
|
||||||
lineHeight: LineHeight.number(1.5),
|
'h2': Style(
|
||||||
fontWeight: FontWeight.w500,
|
fontSize: FontSize(fontSize * 1.75),
|
||||||
),
|
lineHeight: LineHeight.number(1.5),
|
||||||
'h3': Style(
|
fontWeight: FontWeight.w500,
|
||||||
fontSize: FontSize(fontSize * 1.5),
|
),
|
||||||
lineHeight: LineHeight.number(1.5),
|
'h3': Style(
|
||||||
),
|
fontSize: FontSize(fontSize * 1.5),
|
||||||
'h4': Style(
|
lineHeight: LineHeight.number(1.5),
|
||||||
fontSize: FontSize(fontSize * 1.25),
|
),
|
||||||
lineHeight: LineHeight.number(1.5),
|
'h4': Style(
|
||||||
),
|
fontSize: FontSize(fontSize * 1.25),
|
||||||
'h5': Style(
|
lineHeight: LineHeight.number(1.5),
|
||||||
fontSize: FontSize(fontSize * 1.25),
|
),
|
||||||
lineHeight: LineHeight.number(1.5),
|
'h5': Style(
|
||||||
),
|
fontSize: FontSize(fontSize * 1.25),
|
||||||
'h6': Style(
|
lineHeight: LineHeight.number(1.5),
|
||||||
fontSize: FontSize(fontSize),
|
),
|
||||||
lineHeight: LineHeight.number(1.5),
|
'h6': Style(
|
||||||
),
|
fontSize: FontSize(fontSize),
|
||||||
'blockquote': blockquoteStyle,
|
lineHeight: LineHeight.number(1.5),
|
||||||
'tg-forward': blockquoteStyle,
|
),
|
||||||
'hr': Style(
|
'blockquote': blockquoteStyle,
|
||||||
border: Border.all(color: textColor, width: 0.5),
|
'tg-forward': blockquoteStyle,
|
||||||
),
|
'hr': Style(
|
||||||
'table': Style(
|
border: Border.all(color: textColor, width: 0.5),
|
||||||
border: Border.all(color: textColor, width: 0.5),
|
),
|
||||||
),
|
'table': Style(
|
||||||
'tr': Style(
|
border: Border.all(color: textColor, width: 0.5),
|
||||||
border: Border.all(color: textColor, width: 0.5),
|
),
|
||||||
),
|
'tr': Style(
|
||||||
'td': Style(
|
border: Border.all(color: textColor, width: 0.5),
|
||||||
border: Border.all(color: textColor, width: 0.5),
|
),
|
||||||
padding: HtmlPaddings.all(2),
|
'td': Style(
|
||||||
),
|
border: Border.all(color: textColor, width: 0.5),
|
||||||
'th': Style(
|
padding: HtmlPaddings.all(2),
|
||||||
border: Border.all(color: textColor, width: 0.5),
|
),
|
||||||
),
|
'th': Style(
|
||||||
},
|
border: Border.all(color: textColor, width: 0.5),
|
||||||
extensions: [
|
),
|
||||||
RoomPillExtension(context, room),
|
},
|
||||||
CodeExtension(fontSize: fontSize),
|
extensions: [
|
||||||
MatrixMathExtension(
|
RoomPillExtension(context, room),
|
||||||
style: TextStyle(fontSize: fontSize, color: textColor),
|
CodeExtension(fontSize: fontSize),
|
||||||
),
|
MatrixMathExtension(
|
||||||
const TableHtmlExtension(),
|
style: TextStyle(fontSize: fontSize, color: textColor),
|
||||||
SpoilerExtension(textColor: textColor),
|
),
|
||||||
const ImageExtension(),
|
const TableHtmlExtension(),
|
||||||
FontColorExtension(),
|
SpoilerExtension(textColor: textColor),
|
||||||
],
|
const ImageExtension(),
|
||||||
onLinkTap: (url, _, __) => UrlLauncher(context, url).launchUrl(),
|
FontColorExtension(),
|
||||||
onlyRenderTheseTags: const {
|
],
|
||||||
...allowedHtmlTags,
|
onLinkTap: (url, _, __) => UrlLauncher(context, url).launchUrl(),
|
||||||
// Needed to make it work properly
|
onlyRenderTheseTags: const {
|
||||||
'body',
|
...allowedHtmlTags,
|
||||||
'html',
|
// Needed to make it work properly
|
||||||
},
|
'body',
|
||||||
shrinkWrap: true,
|
'html',
|
||||||
|
},
|
||||||
|
shrinkWrap: true,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue