fix(multiple-subtitles): [PKG-MULTI-SUB-08] preserve entity text and semantic cue wrappers

This commit is contained in:
Harvey Zhao committed 2026-09-14 12:14:21 +08:00
1 parent 4acf85ea69
commit 675b095b27
22 files changed
+744 -59

No files matched your search

@@ -0,0 +1,20 @@
// Keep the vendor's lenient aliases while making complete named references exact.
export const cueEntities = {
'&amp': '&',
'&': '&',
'&lt': '<',
'&lt;': '<',
'&gt': '>',
'&gt;': '>',
'&lrm': '\u200E',
'&lrm;': '\u200E',
'&rlm': '\u200F',
'&rlm;': '\u200F',
'&nbsp': '\u00A0',
'&nbsp;': '\u00A0',
}
// Serialization protects the whole VTT once; this protects cue text after onVttLoad unescape.
export function escapeCueText(value: string): string {
return value.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;')
}