@playkit-js/transcript 3.5.0 → 3.5.1-canary.0-18c13d8
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/CHANGELOG.md +2 -0
- package/dist/playkit-transcript.js +1 -1
- package/dist/playkit-transcript.js.LICENSE.txt +7 -0
- package/dist/playkit-transcript.js.map +1 -1
- package/package.json +2 -1
- package/src/components/caption/caption.tsx +1 -1
- package/src/components/caption-list/captionList.tsx +1 -1
- package/src/transcript-plugin.tsx +10 -1
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-18c13d8",
|
|
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';
|
|
@@ -105,7 +105,7 @@ export class CaptionList extends Component<Props> {
|
|
|
105
105
|
render() {
|
|
106
106
|
const {data} = this.props;
|
|
107
107
|
return (
|
|
108
|
-
<div className={styles.transcriptWrapper} onKeyUp={this._handleKeyUp}
|
|
108
|
+
<div className={styles.transcriptWrapper} onKeyUp={this._handleKeyUp}>
|
|
109
109
|
{data.map((captionData, index) => {
|
|
110
110
|
const captionProps = this._getCaptionProps(captionData);
|
|
111
111
|
return (
|
|
@@ -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
|