This commit is contained in:
Hivert Quentin
2026-05-07 15:37:49 +02:00
parent f8124acec6
commit e515d6d573
+22 -16
View File
@@ -955,15 +955,18 @@ static NSString *_sanitizeHtmlForDisplay(NSString *content)
else
cssContent = @"";
regex = [NSRegularExpression regularExpressionWithPattern:@"margin-left\\s*:\\s*-[^;]+(\\s*!important)?"
options: NSRegularExpressionCaseInsensitive error:&error];
newResult = [regex stringByReplacingMatchesInString:cssContent options:0 range:NSMakeRange(0, [cssContent length]) withTemplate:@"margin-left: 0 !important"];
cssContent = [NSString stringWithString: newResult];
if([cssContent length])
{
regex = [NSRegularExpression regularExpressionWithPattern:@"margin-left\\s*:\\s*-[^;]+(\\s*!important)?"
options: NSRegularExpressionCaseInsensitive error:&error];
newResult = [regex stringByReplacingMatchesInString:cssContent options:0 range:NSMakeRange(0, [cssContent length]) withTemplate:@"margin-left: 0 !important"];
cssContent = [NSString stringWithString: newResult];
regex = [NSRegularExpression regularExpressionWithPattern:@"margin-right\\s*:\\s*-[^;]+(\\s*!important)?"
options: NSRegularExpressionCaseInsensitive error:&error];
newResult = [regex stringByReplacingMatchesInString:cssContent options:0 range:NSMakeRange(0, [cssContent length]) withTemplate:@"margin-right: 0 !important"];
cssContent = [NSString stringWithString: newResult];
regex = [NSRegularExpression regularExpressionWithPattern:@"margin-right\\s*:\\s*-[^;]+(\\s*!important)?"
options: NSRegularExpressionCaseInsensitive error:&error];
newResult = [regex stringByReplacingMatchesInString:cssContent options:0 range:NSMakeRange(0, [cssContent length]) withTemplate:@"margin-right: 0 !important"];
cssContent = [NSString stringWithString: newResult];
}
return cssContent;
}
@@ -1124,15 +1127,18 @@ static NSString *_sanitizeHtmlForDisplay(NSString *content)
else
cssContent = @"";
regex = [NSRegularExpression regularExpressionWithPattern:@"margin-(?:left|right)\\s*:\\s*-[^;]+(\\s*!important)?"
options: NSRegularExpressionCaseInsensitive error:&error];
newResult = [regex stringByReplacingMatchesInString:cssContent options:0 range:NSMakeRange(0, [cssContent length]) withTemplate:@"margin-left: 0 !important"];
cssContent = [NSString stringWithString: newResult];
if([cssContent length])
{
regex = [NSRegularExpression regularExpressionWithPattern:@"margin-left\\s*:\\s*-[^;]+(\\s*!important)?"
options: NSRegularExpressionCaseInsensitive error:&error];
newResult = [regex stringByReplacingMatchesInString:cssContent options:0 range:NSMakeRange(0, [cssContent length]) withTemplate:@"margin-left: 0 !important"];
cssContent = [NSString stringWithString: newResult];
regex = [NSRegularExpression regularExpressionWithPattern:@"margin-right\\s*:\\s*-[^;]+(\\s*!important)?"
options: NSRegularExpressionCaseInsensitive error:&error];
newResult = [regex stringByReplacingMatchesInString:cssContent options:0 range:NSMakeRange(0, [cssContent length]) withTemplate:@"margin-right: 0 !important"];
cssContent = [NSString stringWithString: newResult];
regex = [NSRegularExpression regularExpressionWithPattern:@"margin-right\\s*:\\s*-[^;]+(\\s*!important)?"
options: NSRegularExpressionCaseInsensitive error:&error];
newResult = [regex stringByReplacingMatchesInString:cssContent options:0 range:NSMakeRange(0, [cssContent length]) withTemplate:@"margin-right: 0 !important"];
cssContent = [NSString stringWithString: newResult];
}
return cssContent;
}