mirror of
https://github.com/wavetermdev/xterm.js.git
synced 2026-08-05 13:43:48 -07:00
Merge pull request #906 from npezza93/sync-bell-sound-on-change
When bellSound changes, update the bellAudioElements src
This commit is contained in:
+7
-4
@@ -485,7 +485,8 @@ export class Terminal extends EventEmitter implements ITerminal, IInputHandlingT
|
||||
this.viewport.syncScrollArea();
|
||||
break;
|
||||
case 'tabStopWidth': this.setupStops(); break;
|
||||
case 'bellStyle': this.preloadBellSound(); break;
|
||||
case 'bellSound':
|
||||
case 'bellStyle': this.syncBellSound(); break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -694,7 +695,7 @@ export class Terminal extends EventEmitter implements ITerminal, IInputHandlingT
|
||||
this.viewportElement.appendChild(this.viewportScrollArea);
|
||||
|
||||
// preload audio
|
||||
this.preloadBellSound();
|
||||
this.syncBellSound();
|
||||
|
||||
// Create the selection container.
|
||||
this.selectionContainer = document.createElement('div');
|
||||
@@ -2293,8 +2294,10 @@ export class Terminal extends EventEmitter implements ITerminal, IInputHandlingT
|
||||
this.options.bellStyle === 'both';
|
||||
}
|
||||
|
||||
private preloadBellSound(): void {
|
||||
if (this.soundBell()) {
|
||||
private syncBellSound(): void {
|
||||
if (this.soundBell() && this.bellAudioElement) {
|
||||
this.bellAudioElement.setAttribute('src', this.options.bellSound);
|
||||
} else if (this.soundBell()) {
|
||||
this.bellAudioElement = document.createElement('audio');
|
||||
this.bellAudioElement.setAttribute('preload', 'auto');
|
||||
this.bellAudioElement.setAttribute('src', this.options.bellSound);
|
||||
|
||||
@@ -31,6 +31,7 @@ export type BooleanOption =
|
||||
export type StringOption =
|
||||
'cursorStyle' |
|
||||
'bellStyle' |
|
||||
'bellSound' |
|
||||
'termName';
|
||||
export type StringArrayOption = 'colors';
|
||||
export type NumberOption =
|
||||
|
||||
Reference in New Issue
Block a user