From fcba1223998d63cc83d877f1500d2037e4836d7c Mon Sep 17 00:00:00 2001 From: Pas <74743263+Pasithea0@users.noreply.github.com> Date: Mon, 2 Jun 2025 12:47:43 -0600 Subject: [PATCH] remove clean subtitles function --- src/components/player/base/SubtitleView.tsx | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/src/components/player/base/SubtitleView.tsx b/src/components/player/base/SubtitleView.tsx index 496b230c..9be8e569 100644 --- a/src/components/player/base/SubtitleView.tsx +++ b/src/components/player/base/SubtitleView.tsx @@ -10,12 +10,6 @@ import { Transition } from "@/components/utils/Transition"; import { usePlayerStore } from "@/stores/player/store"; import { SubtitleStyling, useSubtitleStore } from "@/stores/subtitles"; -// Clean-up function to remove unwanted subtitle tags -function cleanSubtitleText(text: string): string { - // Remove unwanted tags like \an1, \pos, \i1, etc. - return text.replace(/\\[a-zA-Z0-9(),\s\-_]+/g, "").replace(/\}\s*/g, ""); -} - const wordOverrides: Record = { i: "I", }; @@ -42,12 +36,9 @@ export function CaptionCue({ .replaceAll(/ i'/g, " I'") .replaceAll(/\r?\n/g, "
"); - // Clean the subtitle text before sanitizing it - const cleanedText = cleanSubtitleText(textWithNewlines); - // https://www.w3.org/TR/webvtt1/#dom-construction-rules // added a
for newlines - const html = sanitize(cleanedText, { + const html = sanitize(textWithNewlines, { ALLOWED_TAGS: ["c", "b", "i", "u", "span", "ruby", "rt", "br"], ADD_TAGS: ["v", "lang"], ALLOWED_ATTR: ["title", "lang"],