]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/shared/renderer/html-renderer.service.ts
Optimize list my playlists SQL query
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / renderer / html-renderer.service.ts
index d49df9b6d9a7c6e9ca2262982dbb1683fbabdd2c..94a8aa4c655742aa929350f4647e75189cfab6ce 100644 (file)
@@ -1,6 +1,5 @@
 import { Injectable } from '@angular/core'
 import { LinkifierService } from '@app/shared/renderer/linkifier.service'
-import * as sanitizeHtml from 'sanitize-html'
 
 @Injectable()
 export class HtmlRendererService {
@@ -9,12 +8,15 @@ export class HtmlRendererService {
 
   }
 
-  toSafeHtml (text: string) {
+  async toSafeHtml (text: string) {
+    // FIXME: import('..') returns a struct module, containing a "default" field corresponding to our sanitizeHtml function
+    const sanitizeHtml: typeof import ('sanitize-html') = (await import('sanitize-html') as any).default
+
     // Convert possible markdown to html
     const html = this.linkifier.linkify(text)
 
     return sanitizeHtml(html, {
-      allowedTags: [ 'a', 'p', 'span', 'br' ],
+      allowedTags: [ 'a', 'p', 'span', 'br', 'strong', 'em', 'ul', 'ol', 'li' ],
       allowedSchemes: [ 'http', 'https' ],
       allowedAttributes: {
         'a': [ 'href', 'class', 'target' ]