You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
742 B
24 lines
742 B
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={{ |
|
...captionSettings.style, |
|
}} |
|
/> |
|
); |
|
}
|
|
|