@playkit-js/transcript 3.7.12 → 3.7.13-canary.0-1df2d96

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.7.12",
3
+ "version": "3.7.13-canary.0-1df2d96",
4
4
  "main": "dist/playkit-transcript.js",
5
5
  "license": "AGPL-3.0",
6
6
  "private": false,
@@ -25,6 +25,7 @@ export interface CaptionProps {
25
25
  navigationInstruction?: string;
26
26
  timeLabel?: string;
27
27
  setTextToRead: (textToRead: string, delay?: number) => void;
28
+ protectCaptionCopy: boolean;
28
29
  }
29
30
 
30
31
  interface ExtendedCaptionProps extends CaptionProps {
@@ -132,13 +133,15 @@ export class Caption extends Component<ExtendedCaptionProps> {
132
133
  };
133
134
 
134
135
  private _renderText = (text: string) => {
135
- const {activeSearchIndex, searchLength, indexMap} = this.props;
136
+ const {activeSearchIndex, searchLength, indexMap, protectCaptionCopy} = this.props;
136
137
  const indexArray = this.indexArray;
137
138
  if (text?.length === 0) {
138
139
  return null;
139
140
  }
141
+ // no-copy is a global class, no-copy-detached is a CSS module class for detached mode protection
142
+ const captionSpanClasses = protectCaptionCopy ? `${styles.captionSpan} no-copy ${styles.noCopyDetached}` : styles.captionSpan;
140
143
  return (
141
- <span className={`${styles.captionSpan} no-copy ${styles.noCopyDetached}`}>
144
+ <span className={captionSpanClasses}>
142
145
  {indexMap
143
146
  ? indexArray.map((el: string, index: number) => {
144
147
  const preSelected = index === 0 ? text.substring(0, indexMap[el]) : '';
@@ -13,6 +13,7 @@ export interface CaptionProps {
13
13
  scrollTo(el: HTMLElement): void;
14
14
  scrollToSearchMatch(el: HTMLElement): void;
15
15
  videoDuration: number;
16
+ protectCaptionCopy: boolean;
16
17
  }
17
18
 
18
19
  export interface Props {
@@ -124,6 +125,7 @@ export class CaptionList extends Component<Props> {
124
125
  shouldScrollToSearchMatch: this._getShouldScrollToSearchMatch(id),
125
126
  isAutoScrollEnabled,
126
127
  searchCaption: this.props.searchMap[id],
128
+ protectCaptionCopy: captionProps.protectCaptionCopy,
127
129
  ...this._getSearchProps(id)
128
130
  };
129
131
  return newCaptionProps;
@@ -82,6 +82,7 @@ export interface TranscriptProps {
82
82
  player: any;
83
83
  onOverlayOpen?: () => void;
84
84
  onOverlayClose?: () => void;
85
+ protectCaptionCopy: boolean;
85
86
  }
86
87
 
87
88
  interface TranscriptState {
@@ -455,7 +456,7 @@ export class Transcript extends Component<TranscriptProps, TranscriptState> {
455
456
  };
456
457
 
457
458
  private _renderTranscript = () => {
458
- const {captions, hasError, onRetryLoad, showTime, videoDuration, highlightedMap} = this.props;
459
+ const {captions, hasError, onRetryLoad, showTime, videoDuration, highlightedMap, protectCaptionCopy} = this.props;
459
460
  const {isAutoScrollEnabled, searchMap, activeSearchIndex, searchLength} = this.state;
460
461
 
461
462
  if (hasError) {
@@ -479,7 +480,8 @@ export class Transcript extends Component<TranscriptProps, TranscriptState> {
479
480
  searchLength,
480
481
  scrollTo: this._scrollTo,
481
482
  scrollToSearchMatch: this._scrollToSearchMatch,
482
- videoDuration
483
+ videoDuration,
484
+ protectCaptionCopy
483
485
  };
484
486
 
485
487
  return (
@@ -38,7 +38,8 @@ export class TranscriptPlugin extends KalturaPlayer.core.BasePlugin {
38
38
  searchDebounceTimeout: 250,
39
39
  searchNextPrevDebounceTimeout: 100,
40
40
  downloadDisabled: false,
41
- printDisabled: false
41
+ printDisabled: false,
42
+ protectCaptionCopy: true
42
43
  };
43
44
  private _activeCaptionMapId: string = '';
44
45
  private _activeCuePointsMap: HighlightedMap = {};
@@ -308,7 +309,8 @@ export class TranscriptPlugin extends KalturaPlayer.core.BasePlugin {
308
309
  searchDebounceTimeout,
309
310
  searchNextPrevDebounceTimeout,
310
311
  downloadDisabled,
311
- printDisabled
312
+ printDisabled,
313
+ protectCaptionCopy
312
314
  } = this.config;
313
315
  this._transcriptPanel = this.sidePanelsManager!.add({
314
316
  label: 'Transcript',
@@ -353,6 +355,7 @@ export class TranscriptPlugin extends KalturaPlayer.core.BasePlugin {
353
355
  player={this.player}
354
356
  onOverlayOpen={() => this.sidePanelsManager?.deactivateItem(this._transcriptPanel)}
355
357
  onOverlayClose={() => this.sidePanelsManager?.activateItem(this._transcriptPanel)}
358
+ protectCaptionCopy={getConfigValue(protectCaptionCopy, isBoolean, true)}
356
359
  />
357
360
  ) as any;
358
361
  },
@@ -8,4 +8,5 @@ export interface TranscriptConfig {
8
8
  downloadDisabled: boolean; // disable download menu
9
9
  printDisabled: boolean; // disable print menu
10
10
  expandMode: string; // over or pushing the player
11
+ protectCaptionCopy: boolean; // enable/disable copy protection for caption text (default: true)
11
12
  }