9 changed files with 43 additions and 85 deletions
@ -1,25 +0,0 @@
@@ -1,25 +0,0 @@
|
||||
import { sanitize } from "@/backend/helpers/captions"; |
||||
import { useSettings } from "@/state/settings"; |
||||
|
||||
export function Caption({ text }: { text?: string }) { |
||||
const { captionSettings } = useSettings(); |
||||
return ( |
||||
<span |
||||
className="pointer-events-none mb-1 select-none px-1 text-center" |
||||
dir="auto" |
||||
// eslint-disable-next-line react/no-danger
|
||||
dangerouslySetInnerHTML={{ |
||||
__html: sanitize(text || "", { |
||||
// https://www.w3.org/TR/webvtt1/#dom-construction-rules
|
||||
ALLOWED_TAGS: ["c", "b", "i", "u", "span", "ruby", "rt"], |
||||
ADD_TAGS: ["v", "lang"], |
||||
ALLOWED_ATTR: ["title", "lang"], |
||||
}), |
||||
}} |
||||
style={{ |
||||
whiteSpace: "pre-line", |
||||
...captionSettings.style, |
||||
}} |
||||
/> |
||||
); |
||||
} |
Loading…
Reference in new issue