@playkit-js/transcript 3.6.0-canary.0-ebba9a2 → 3.6.0-canary.0-a940bfb
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 -2
- package/dist/playkit-transcript.js +1 -1
- package/dist/playkit-transcript.js.map +1 -1
- package/package.json +2 -2
- package/src/components/attach-placeholder/attach-placeholder.scss +40 -14
- package/src/components/attach-placeholder/attach-placeholder.tsx +16 -6
- package/src/components/caption/caption.tsx +1 -1
- package/src/components/transcript/transcript.scss +2 -1
- package/src/components/transcript/transcript.tsx +25 -26
- package/src/events/events.ts +10 -1
- package/src/transcript-plugin.tsx +25 -4
- package/src/variables.scss +2 -0
- package/translations/en.i18n.json +2 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@playkit-js/transcript",
|
|
3
|
-
"version": "3.6.0-canary.0-
|
|
3
|
+
"version": "3.6.0-canary.0-a940bfb",
|
|
4
4
|
"main": "dist/playkit-transcript.js",
|
|
5
5
|
"license": "AGPL-3.0",
|
|
6
6
|
"private": false,
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"devDependencies": {
|
|
16
16
|
"@playkit-js/kaltura-player-js": "3.17.9",
|
|
17
17
|
"@playkit-js/playkit-js-ui": "0.78.0",
|
|
18
|
-
"@playkit-js/ui-managers": "1.
|
|
18
|
+
"@playkit-js/ui-managers": "1.5.4-canary.0-9261ea6",
|
|
19
19
|
"@types/sanitize-html": "^2.9.3",
|
|
20
20
|
"conventional-github-releaser": "3.1.3",
|
|
21
21
|
"copyfiles": "^2.4.1",
|
|
@@ -1,21 +1,47 @@
|
|
|
1
1
|
@import '~@playkit-js/playkit-js-ui';
|
|
2
|
+
@import '../../variables.scss';
|
|
2
3
|
|
|
3
4
|
.attach-placeholder-container {
|
|
4
5
|
position: absolute;
|
|
5
|
-
top:
|
|
6
|
-
left:
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
6
|
+
top: 0;
|
|
7
|
+
left: 0;
|
|
8
|
+
width: 100%;
|
|
9
|
+
height: 100%;
|
|
10
|
+
background: $plugin-background;
|
|
11
|
+
.attach-header {
|
|
12
|
+
position: absolute;
|
|
13
|
+
top: 16px;
|
|
14
|
+
left: 0;
|
|
15
|
+
width: 100%;
|
|
16
|
+
height: 32px;
|
|
17
|
+
display: flex;
|
|
18
|
+
align-items: center;
|
|
19
|
+
justify-content: space-between;
|
|
20
|
+
padding: 0 16px;
|
|
21
|
+
.attach-header-title {
|
|
22
|
+
font-weight: 700;
|
|
23
|
+
font-size: 16px;
|
|
24
|
+
color: $tone-1-color;
|
|
25
|
+
}
|
|
17
26
|
}
|
|
18
|
-
.attach-
|
|
19
|
-
|
|
27
|
+
.attach-content {
|
|
28
|
+
position: absolute;
|
|
29
|
+
top: 50%;
|
|
30
|
+
left: 50%;
|
|
31
|
+
transform: translate(-50%, -50%);
|
|
32
|
+
display: flex;
|
|
33
|
+
justify-content: center;
|
|
34
|
+
align-items: center;
|
|
35
|
+
flex-direction: column;
|
|
36
|
+
.attach-text {
|
|
37
|
+
line-height: 20px;
|
|
38
|
+
font-weight: 700;
|
|
39
|
+
letter-spacing: normal;
|
|
40
|
+
color: $tone-1-color;
|
|
41
|
+
text-align: center;
|
|
42
|
+
}
|
|
43
|
+
.attach-button {
|
|
44
|
+
margin-top: 20px;
|
|
45
|
+
}
|
|
20
46
|
}
|
|
21
47
|
}
|
|
@@ -1,23 +1,33 @@
|
|
|
1
1
|
import {h} from 'preact';
|
|
2
2
|
import {ui} from '@playkit-js/kaltura-player-js';
|
|
3
3
|
import {Button, ButtonType, ButtonSize} from '@playkit-js/common/dist/components/button';
|
|
4
|
+
import {OnClickEvent} from '@playkit-js/common/dist/hoc/a11y-wrapper';
|
|
4
5
|
import * as styles from './attach-placeholder.scss';
|
|
5
6
|
|
|
6
7
|
const {Text} = ui.preacti18n;
|
|
7
8
|
|
|
8
9
|
interface AttachPlaceholderProps {
|
|
9
10
|
onAttach: () => void;
|
|
11
|
+
onClose: (e: OnClickEvent, byKeyboard: boolean) => void;
|
|
10
12
|
}
|
|
11
13
|
|
|
12
|
-
export const AttachPlaceholder = ({onAttach}: AttachPlaceholderProps) => {
|
|
14
|
+
export const AttachPlaceholder = ({onAttach, onClose}: AttachPlaceholderProps) => {
|
|
13
15
|
return (
|
|
14
16
|
<div className={styles.attachPlaceholderContainer} data-testid="transcriptAttachPlaceholder">
|
|
15
|
-
<div className={styles.
|
|
16
|
-
<
|
|
17
|
+
<div className={styles.attachHeader}>
|
|
18
|
+
<div className={styles.attachHeaderTitle}>
|
|
19
|
+
<Text id="transcript.transcript">Transcript</Text>
|
|
20
|
+
</div>
|
|
21
|
+
<Button type={ButtonType.borderless} size={ButtonSize.medium} icon={'close'} onClick={onClose}/>
|
|
22
|
+
</div>
|
|
23
|
+
<div className={styles.attachContent}>
|
|
24
|
+
<div className={styles.attachText}>
|
|
25
|
+
<Text id="transcript.attachTranscriptText">Transcript popped out</Text>
|
|
26
|
+
</div>
|
|
27
|
+
<Button type={ButtonType.primary} size={ButtonSize.medium} className={styles.attachButton} onClick={onAttach} testId="transcriptAttachButton">
|
|
28
|
+
<Text id="transcript.attachTranscriptButton">Bring it back</Text>
|
|
29
|
+
</Button>
|
|
17
30
|
</div>
|
|
18
|
-
<Button type={ButtonType.primary} size={ButtonSize.medium} className={styles.attachButton} onClick={onAttach} testId="transcriptAttachButton">
|
|
19
|
-
<Text id="transcript.attachTranscriptButton">Bring it back</Text>
|
|
20
|
-
</Button>
|
|
21
31
|
</div>
|
|
22
32
|
);
|
|
23
33
|
};
|
|
@@ -101,7 +101,7 @@ export class Caption extends Component<ExtendedCaptionProps> {
|
|
|
101
101
|
render() {
|
|
102
102
|
const {caption, highlighted, showTime, longerThanHour} = this.props;
|
|
103
103
|
const {startTime, id} = caption;
|
|
104
|
-
const isHighlighted = Object.keys(highlighted)
|
|
104
|
+
const isHighlighted = Object.keys(highlighted).some(c => c === id) ;
|
|
105
105
|
const time = showTime ? secondsToTime(startTime, longerThanHour) : '';
|
|
106
106
|
|
|
107
107
|
const captionA11yProps: Record<string, any> = {
|
|
@@ -12,10 +12,11 @@
|
|
|
12
12
|
height: 100%;
|
|
13
13
|
width: 100%;
|
|
14
14
|
position: absolute;
|
|
15
|
-
background:
|
|
15
|
+
background: $plugin-background;
|
|
16
16
|
backdrop-filter: blur(8px);
|
|
17
17
|
-webkit-backdrop-filter: blur(8px);
|
|
18
18
|
z-index: 1;
|
|
19
|
+
cursor: default;
|
|
19
20
|
.skip-transcript-button {
|
|
20
21
|
position: absolute;
|
|
21
22
|
top: -1000px;
|
|
@@ -64,6 +64,7 @@ export interface TranscriptProps {
|
|
|
64
64
|
onDetach: () => void;
|
|
65
65
|
onAttach: () => void;
|
|
66
66
|
kitchenSinkDetached: boolean;
|
|
67
|
+
isMobile?: boolean;
|
|
67
68
|
}
|
|
68
69
|
|
|
69
70
|
interface TranscriptState {
|
|
@@ -88,7 +89,8 @@ const SEARCHBAR_HEIGHT = 38; // height of search bar with margins
|
|
|
88
89
|
const smallScreen = PLAYER_BREAK_POINTS?.SMALL || 480;
|
|
89
90
|
|
|
90
91
|
const mapStateToProps = (state: any, ownProps: Pick<TranscriptProps, 'expandMode'>) => ({
|
|
91
|
-
smallScreen: ownProps.expandMode === SidePanelModes.ALONGSIDE && state.shell.playerClientRect?.width < smallScreen
|
|
92
|
+
smallScreen: ownProps.expandMode === SidePanelModes.ALONGSIDE && state.shell.playerClientRect?.width < smallScreen,
|
|
93
|
+
isMobile: state.shell.isMobile
|
|
92
94
|
});
|
|
93
95
|
|
|
94
96
|
// @ts-ignore
|
|
@@ -157,6 +159,25 @@ export class Transcript extends Component<TranscriptProps, TranscriptState> {
|
|
|
157
159
|
);
|
|
158
160
|
};
|
|
159
161
|
|
|
162
|
+
private _renderDetachButton = () => {
|
|
163
|
+
const {onAttach, onDetach, attachTranscript, detachTranscript, kitchenSinkDetached, isMobile} = this.props;
|
|
164
|
+
if (isMobile) {
|
|
165
|
+
return null;
|
|
166
|
+
}
|
|
167
|
+
return (
|
|
168
|
+
<div data-testid="transcriptDetachAttachButton">
|
|
169
|
+
<Button
|
|
170
|
+
type={ButtonType.borderless}
|
|
171
|
+
size={ButtonSize.medium}
|
|
172
|
+
onClick={kitchenSinkDetached ? onAttach : onDetach}
|
|
173
|
+
icon={kitchenSinkDetached ? 'attach' : 'detach'}
|
|
174
|
+
ariaLabel={kitchenSinkDetached ? attachTranscript : detachTranscript}
|
|
175
|
+
tooltip={{label: kitchenSinkDetached ? attachTranscript! : detachTranscript!}}
|
|
176
|
+
/>
|
|
177
|
+
</div>
|
|
178
|
+
);
|
|
179
|
+
};
|
|
180
|
+
|
|
160
181
|
private _onSearch = (search: string) => {
|
|
161
182
|
this.setState({search});
|
|
162
183
|
};
|
|
@@ -217,20 +238,7 @@ export class Transcript extends Component<TranscriptProps, TranscriptState> {
|
|
|
217
238
|
};
|
|
218
239
|
|
|
219
240
|
private _renderHeader = () => {
|
|
220
|
-
const {
|
|
221
|
-
toggledWithEnter,
|
|
222
|
-
kitchenSinkActive,
|
|
223
|
-
kitchenSinkDetached,
|
|
224
|
-
downloadDisabled,
|
|
225
|
-
onDownload,
|
|
226
|
-
printDisabled,
|
|
227
|
-
onPrint,
|
|
228
|
-
isLoading,
|
|
229
|
-
onAttach,
|
|
230
|
-
onDetach,
|
|
231
|
-
attachTranscript,
|
|
232
|
-
detachTranscript
|
|
233
|
-
} = this.props;
|
|
241
|
+
const {toggledWithEnter, kitchenSinkActive, kitchenSinkDetached, downloadDisabled, onDownload, printDisabled, onPrint, isLoading} = this.props;
|
|
234
242
|
const {search, activeSearchIndex, totalSearchResults} = this.state;
|
|
235
243
|
return (
|
|
236
244
|
<div className={[styles.header, this._getHeaderStyles()].join(' ')} data-testid="transcript_header">
|
|
@@ -244,16 +252,7 @@ export class Transcript extends Component<TranscriptProps, TranscriptState> {
|
|
|
244
252
|
kitchenSinkActive={kitchenSinkActive}
|
|
245
253
|
/>
|
|
246
254
|
<TranscriptMenu {...{downloadDisabled, onDownload, printDisabled, onPrint, isLoading}} />
|
|
247
|
-
|
|
248
|
-
<Button
|
|
249
|
-
type={ButtonType.borderless}
|
|
250
|
-
size={ButtonSize.medium}
|
|
251
|
-
onClick={kitchenSinkDetached ? onAttach : onDetach}
|
|
252
|
-
icon={kitchenSinkDetached ? 'attach' : 'detach'}
|
|
253
|
-
ariaLabel={kitchenSinkDetached ? attachTranscript : detachTranscript}
|
|
254
|
-
tooltip={{label: kitchenSinkDetached ? attachTranscript! : detachTranscript!}}
|
|
255
|
-
/>
|
|
256
|
-
</div>
|
|
255
|
+
{this._renderDetachButton()}
|
|
257
256
|
{!kitchenSinkDetached && (
|
|
258
257
|
<div data-testid="transcriptCloseButton">
|
|
259
258
|
<Button
|
|
@@ -429,7 +428,7 @@ export class Transcript extends Component<TranscriptProps, TranscriptState> {
|
|
|
429
428
|
this._widgetRootRef = node;
|
|
430
429
|
}}
|
|
431
430
|
data-testid="transcript_root">
|
|
432
|
-
{smallScreen ? (
|
|
431
|
+
{smallScreen && !kitchenSinkDetached ? (
|
|
433
432
|
<SmallScreenSlate onClose={this.props.onClose} toggledWithEnter={toggledWithEnter} />
|
|
434
433
|
) : (
|
|
435
434
|
<div className={styles.globalContainer}>
|
package/src/events/events.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
export const TranscriptEvents = {
|
|
3
2
|
TRANSCRIPT_OPEN: 'transcript_open',
|
|
4
3
|
TRANSCRIPT_CLOSE: 'transcript_close',
|
|
@@ -6,4 +5,14 @@ export const TranscriptEvents = {
|
|
|
6
5
|
TRANSCRIPT_PRINT: 'transcript_print',
|
|
7
6
|
TRANSCRIPT_SEARCH: 'transcript_search',
|
|
8
7
|
TRANSCRIPT_NAVIGATE_RESULT: 'transcript_navigate_result',
|
|
8
|
+
TRANSCRIPT_POPOUT_OPEN: 'transcript_popout_open',
|
|
9
|
+
TRANSCRIPT_POPOUT_CLOSE: 'transcript_popout_close',
|
|
10
|
+
TRANSCRIPT_POPOUT_DRAG: 'transcript_popout_drag',
|
|
11
|
+
TRANSCRIPT_POPOUT_RESIZE: 'transcript_popout_resize'
|
|
9
12
|
};
|
|
13
|
+
|
|
14
|
+
export enum CloseDetachTypes {
|
|
15
|
+
closeWindow = 'close_window',
|
|
16
|
+
bringBack = 'bring_back',
|
|
17
|
+
arrow = 'arrow'
|
|
18
|
+
}
|
|
@@ -9,7 +9,7 @@ import {PluginButton} from './components/plugin-button/plugin-button';
|
|
|
9
9
|
import {Transcript} from './components/transcript';
|
|
10
10
|
import {getConfigValue, isBoolean, makePlainText, prepareCuePoint} from './utils';
|
|
11
11
|
import {TranscriptConfig, PluginStates, HighlightedMap, CuePointData, ItemTypes, CuePoint} from './types';
|
|
12
|
-
import {TranscriptEvents} from './events/events';
|
|
12
|
+
import {TranscriptEvents, CloseDetachTypes} from './events/events';
|
|
13
13
|
import {AttachPlaceholder} from './components/attach-placeholder';
|
|
14
14
|
|
|
15
15
|
export const pluginName: string = 'playkit-js-transcript';
|
|
@@ -233,11 +233,30 @@ export class TranscriptPlugin extends KalturaPlayer.core.BasePlugin {
|
|
|
233
233
|
width: 600,
|
|
234
234
|
height: 600,
|
|
235
235
|
title: 'Transcript',
|
|
236
|
-
attachPlaceholder: () =>
|
|
236
|
+
attachPlaceholder: () =>
|
|
237
|
+
(
|
|
238
|
+
<AttachPlaceholder
|
|
239
|
+
onAttach={() => {
|
|
240
|
+
this._handleAttach(CloseDetachTypes.bringBack);
|
|
241
|
+
}}
|
|
242
|
+
onClose={this._handleClose}
|
|
243
|
+
/>
|
|
244
|
+
) as any,
|
|
245
|
+
onDetachWindowClose: () => {
|
|
246
|
+
this.dispatchEvent(TranscriptEvents.TRANSCRIPT_POPOUT_CLOSE, {type: CloseDetachTypes.closeWindow});
|
|
247
|
+
},
|
|
248
|
+
onDetachResize: (width: number, height: number) => {
|
|
249
|
+
this.dispatchEvent(TranscriptEvents.TRANSCRIPT_POPOUT_RESIZE, {size: {x: width, y: height}});
|
|
250
|
+
},
|
|
251
|
+
onDetachMove: (x: number, y: number) => {
|
|
252
|
+
this.dispatchEvent(TranscriptEvents.TRANSCRIPT_POPOUT_DRAG, {position: {x, y}});
|
|
253
|
+
}
|
|
237
254
|
});
|
|
255
|
+
this.dispatchEvent(TranscriptEvents.TRANSCRIPT_POPOUT_OPEN);
|
|
238
256
|
};
|
|
239
|
-
private _handleAttach = () => {
|
|
257
|
+
private _handleAttach = (type: string) => {
|
|
240
258
|
this.sidePanelsManager?.attachItem(this._transcriptPanel);
|
|
259
|
+
this.dispatchEvent(TranscriptEvents.TRANSCRIPT_POPOUT_CLOSE, {type});
|
|
241
260
|
};
|
|
242
261
|
private _isDetached = (): boolean => {
|
|
243
262
|
return this.sidePanelsManager!.isItemDetached(this._transcriptPanel);
|
|
@@ -290,7 +309,9 @@ export class TranscriptPlugin extends KalturaPlayer.core.BasePlugin {
|
|
|
290
309
|
dispatcher={(eventType, payload) => this.dispatchEvent(eventType, payload)}
|
|
291
310
|
activeCaptionLanguage={this._activeCaptionMapId}
|
|
292
311
|
onDetach={this._handleDetach}
|
|
293
|
-
onAttach={
|
|
312
|
+
onAttach={() => {
|
|
313
|
+
this._handleAttach(CloseDetachTypes.arrow);
|
|
314
|
+
}}
|
|
294
315
|
/>
|
|
295
316
|
) as any;
|
|
296
317
|
},
|
package/src/variables.scss
CHANGED
|
@@ -20,7 +20,8 @@
|
|
|
20
20
|
"attachTranscriptText": "Transcript popped out",
|
|
21
21
|
"attachTranscriptButton": "Bring it back",
|
|
22
22
|
"attachTranscript": "Bring Transcript back",
|
|
23
|
-
"detachTranscript": "Popout Transcript"
|
|
23
|
+
"detachTranscript": "Popout Transcript",
|
|
24
|
+
"transcript": "Transcript"
|
|
24
25
|
}
|
|
25
26
|
}
|
|
26
27
|
}
|