Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions ios/inputParser/InputParser.mm
Original file line number Diff line number Diff line change
Expand Up @@ -610,9 +610,21 @@ - (NSArray *)getTextAndStylesFromHtml:(NSString *)fixedHtml {
} else if([tagName isEqualToString:@"code"]) {
[styleArr addObject:@([InlineCodeStyle getStyleType])];
} else if([tagName isEqualToString:@"a"]) {
NSRegularExpression *hrefRegex = [NSRegularExpression regularExpressionWithPattern:@"href=\".+\""
options:0
error:nullptr
];
NSTextCheckingResult* match = [hrefRegex firstMatchInString:params options:0 range: NSMakeRange(0, params.length)];

if(match == nullptr) {
// same as on Android, no href (or empty href) equals no link style
continue;
}

NSRange hrefRange = match.range;
[styleArr addObject:@([LinkStyle getStyleType])];
// cut only the url from the href="..." string
NSString *url = [params substringWithRange:NSMakeRange(6, params.length - 7)];
NSString *url = [params substringWithRange:NSMakeRange(hrefRange.location + 6, hrefRange.length - 7)];
Comment thread
szydlovsky marked this conversation as resolved.
stylePair.styleValue = url;
} else if([tagName isEqualToString:@"mention"]) {
[styleArr addObject:@([MentionStyle getStyleType])];
Expand Down Expand Up @@ -657,7 +669,7 @@ - (NSArray *)getTextAndStylesFromHtml:(NSString *)fixedHtml {
} else if([tagName isEqualToString:@"blockquote"]) {
[styleArr addObject:@([BlockQuoteStyle getStyleType])];
} else {
// some other external tags like span just don't get put into the processed styles
// some other external tags like span just don't get put into the processed styles
continue;
}

Expand Down
Loading