From 9162fdd36300d2478f13d6ad346ec2c323f40faa Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 26 Jul 2021 14:12:39 +0200 Subject: Refactor video links building --- client/src/app/core/renderer/markdown.service.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'client/src/app/core/renderer/markdown.service.ts') diff --git a/client/src/app/core/renderer/markdown.service.ts b/client/src/app/core/renderer/markdown.service.ts index ca1bf4eb9..01d44864b 100644 --- a/client/src/app/core/renderer/markdown.service.ts +++ b/client/src/app/core/renderer/markdown.service.ts @@ -1,5 +1,5 @@ import * as MarkdownIt from 'markdown-it' -import { buildVideoLink } from 'src/assets/player/utils' +import { buildVideoLink, decorateVideoLink } from 'src/assets/player/utils' import { Injectable } from '@angular/core' import { COMPLETE_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 `${str}` }) } -- cgit v1.2.3