Commit 5cc28ae9 authored by Marvin Scholz's avatar Marvin Scholz

macosx: Parse HTML descriptions in addons manager

With this commit, HTML descriptions in the addons manager
are parsed correctly and formatting is applied using a
NSAttributedString and a little bit of CSS to make it use
the system font.
parent 15ea477e
......@@ -205,7 +205,13 @@ static void addonsEventsCallback( const vlc_event_t *event, void *data )
[_name setStringValue:[currentItem name]];
[_author setStringValue:[currentItem author]];
[_version setStringValue:[currentItem version]];
[_description setString:[currentItem description]];
// Parse HTML description properly
NSMutableString *htmlDescription = [NSMutableString stringWithFormat:@"<style>body{ font-family: -apple-system-body, -apple-system, HelveticaNeue, Arial, sans-serif; }</style>%@", [currentItem description]];
[htmlDescription replaceOccurrencesOfString:@"\n" withString:@"<br />" options:NSLiteralSearch range:NSMakeRange(0, [htmlDescription length])];
NSAttributedString *attributedDescription = [[NSAttributedString alloc] initWithHTML:[htmlDescription dataUsingEncoding:NSUTF8StringEncoding]
[[_description textStorage] setAttributedString:attributedDescription];
[self updateInstallButton:[currentItem isInstalled]];
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment