]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/core/renderer/markdown.service.ts
Refactor video links builders
[github/Chocobozzz/PeerTube.git] / client / src / app / core / renderer / markdown.service.ts
index ca1bf4eb95416515bfeb1ebaec3e6191d3cbb5b2..36258ca9872f6f1a471b9ac83c8b57f5341a0148 100644 (file)
@@ -1,6 +1,6 @@
 import * as MarkdownIt from 'markdown-it'
-import { buildVideoLink } from 'src/assets/player/utils'
 import { Injectable } from '@angular/core'
+import { buildVideoLink, decorateVideoLink } from '@shared/core-utils'
 import {
   COMPLETE_RULES,
   ENHANCED_RULES,
@@ -82,10 +82,14 @@ export class MarkdownService {
     return this.render({ name: 'customPageMarkdownIt', markdown, withEmoji: true, additionalAllowedTags })
   }
 
-  processVideoTimestamps (html: string) {
+  processVideoTimestamps (videoShortUUID: string, html: string) {
     return html.replace(/((\d{1,2}):)?(\d{1,2}):(\d{1,2})/g, function (str, _, h, m, s) {
       const t = (3600 * +(h || 0)) + (60 * +(m || 0)) + (+(s || 0))
-      const url = buildVideoLink({ startTime: t })
+
+      const url = decorateVideoLink({
+        url: buildVideoLink({ shortUUID: videoShortUUID }),
+        startTime: t
+      })
       return `<a class="video-timestamp" href="${url}">${str}</a>`
     })
   }