@playkit-js/transcript 3.5.0 → 3.5.1-canary.0-aa0c288
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@playkit-js/transcript",
|
|
3
|
-
"version": "3.5.0",
|
|
3
|
+
"version": "3.5.1-canary.0-aa0c288",
|
|
4
4
|
"main": "dist/playkit-transcript.js",
|
|
5
5
|
"license": "AGPL-3.0",
|
|
6
6
|
"private": false,
|
|
@@ -77,6 +77,7 @@
|
|
|
77
77
|
"@playkit-js/common": "^1.2.13",
|
|
78
78
|
"@playkit-js/playkit-js-ui": "^0.77.3",
|
|
79
79
|
"@playkit-js/ui-managers": "^1.3.11",
|
|
80
|
+
"sanitize-html": "^2.11.0",
|
|
80
81
|
"stream-browserify": "^3.0.0"
|
|
81
82
|
},
|
|
82
83
|
"kaltura": {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {Component, h} from 'preact';
|
|
2
|
-
import {A11yWrapper
|
|
2
|
+
import {A11yWrapper} from '@playkit-js/common/dist/hoc/a11y-wrapper';
|
|
3
3
|
import {secondsToTime} from '../../utils';
|
|
4
4
|
import {CuePointData} from '../../types';
|
|
5
5
|
import * as styles from './caption.scss';
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// @ts-ignore
|
|
2
|
+
import * as sanitizeHtml from 'sanitize-html';
|
|
1
3
|
import {h} from 'preact';
|
|
2
4
|
import {OnClickEvent} from '@playkit-js/common/dist/hoc/a11y-wrapper';
|
|
3
5
|
import {ui} from '@playkit-js/kaltura-player-js';
|
|
@@ -149,7 +151,7 @@ export class TranscriptPlugin extends KalturaPlayer.core.BasePlugin {
|
|
|
149
151
|
|
|
150
152
|
private _addCaptionData = (newData: CuePointData[]) => {
|
|
151
153
|
this._activeCaptionMapId = this._getCaptionMapId();
|
|
152
|
-
this._captionMap.set(this._activeCaptionMapId, newData);
|
|
154
|
+
this._captionMap.set(this._activeCaptionMapId, this._sanitizeCaptions(newData));
|
|
153
155
|
this._isLoading = false;
|
|
154
156
|
clearTimeout(this._loadingTimeoutId);
|
|
155
157
|
this._updateTranscriptPanel();
|
|
@@ -199,6 +201,13 @@ export class TranscriptPlugin extends KalturaPlayer.core.BasePlugin {
|
|
|
199
201
|
}
|
|
200
202
|
};
|
|
201
203
|
|
|
204
|
+
private _sanitizeCaptions = (data: CuePointData[]) => {
|
|
205
|
+
return data.map(caption => ({
|
|
206
|
+
...caption,
|
|
207
|
+
text: sanitizeHtml(caption.text || '', {allowedTags: []})
|
|
208
|
+
}));
|
|
209
|
+
};
|
|
210
|
+
|
|
202
211
|
private _addTranscriptItem(): void {
|
|
203
212
|
if (Math.max(this._transcriptPanel, this._transcriptIcon) > 0) {
|
|
204
213
|
// transcript panel or icon already exist
|