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;
|
String? get syncFilterId => _syncFilterId;
|
||||||
|
|
||||||
|
final bool convertLinebreaksInFormatting;
|
||||||
|
|
||||||
final ComputeCallback? compute;
|
final ComputeCallback? compute;
|
||||||
|
|
||||||
@Deprecated('Use [nativeImplementations] instead')
|
@Deprecated('Use [nativeImplementations] instead')
|
||||||
|
|
@ -233,6 +235,10 @@ class Client extends MatrixApi {
|
||||||
/// support.
|
/// support.
|
||||||
this.customRefreshTokenLifetime,
|
this.customRefreshTokenLifetime,
|
||||||
this.typingIndicatorTimeout = const Duration(seconds: 30),
|
this.typingIndicatorTimeout = const Duration(seconds: 30),
|
||||||
|
|
||||||
|
/// When sending a formatted message, converting linebreaks in markdown to
|
||||||
|
/// <br/> tags:
|
||||||
|
this.convertLinebreaksInFormatting = true,
|
||||||
}) : syncFilter = syncFilter ??
|
}) : syncFilter = syncFilter ??
|
||||||
Filter(
|
Filter(
|
||||||
room: RoomFilter(
|
room: RoomFilter(
|
||||||
|
|
|
||||||
|
|
@ -646,6 +646,7 @@ class Room {
|
||||||
event['body'],
|
event['body'],
|
||||||
getEmotePacks: () => getImagePacksFlat(ImagePackUsage.emoticon),
|
getEmotePacks: () => getImagePacksFlat(ImagePackUsage.emoticon),
|
||||||
getMention: getMention,
|
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 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')) !=
|
if (HtmlUnescape().convert(html.replaceAll(RegExp(r'<br />\n?'), '\n')) !=
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue