Merge pull request #2016 from famedly/krille/make-convert-linebreaks-optional
refactor: Make converting linebreaks in markdowntohtml optional
This commit is contained in:
commit
3353518cad
|
|
@ -107,6 +107,8 @@ class Client extends MatrixApi {
|
|||
|
||||
String? get syncFilterId => _syncFilterId;
|
||||
|
||||
final bool convertLinebreaksInFormatting;
|
||||
|
||||
final ComputeCallback? compute;
|
||||
|
||||
@Deprecated('Use [nativeImplementations] instead')
|
||||
|
|
@ -233,6 +235,10 @@ class Client extends MatrixApi {
|
|||
/// support.
|
||||
this.customRefreshTokenLifetime,
|
||||
this.typingIndicatorTimeout = const Duration(seconds: 30),
|
||||
|
||||
/// When sending a formatted message, converting linebreaks in markdown to
|
||||
/// <br/> tags:
|
||||
this.convertLinebreaksInFormatting = true,
|
||||
}) : syncFilter = syncFilter ??
|
||||
Filter(
|
||||
room: RoomFilter(
|
||||
|
|
|
|||
|
|
@ -646,6 +646,7 @@ class Room {
|
|||
event['body'],
|
||||
getEmotePacks: () => getImagePacksFlat(ImagePackUsage.emoticon),
|
||||
getMention: getMention,
|
||||
convertLinebreaks: client.convertLinebreaksInFormatting,
|
||||
);
|
||||
// if the decoded html is the same as the body, there is no need in sending a formatted message
|
||||
if (HtmlUnescape().convert(html.replaceAll(RegExp(r'<br />\n?'), '\n')) !=
|
||||
|
|
|
|||
Loading…
Reference in New Issue