mirror of
https://github.com/wavetermdev/xterm.js.git
synced 2026-08-05 13:43:48 -07:00
Merge pull request #1113 from bmf-ribeiro/selection-event-1093
Expose a selection event
This commit is contained in:
@@ -64,6 +64,7 @@ namespace methods_core {
|
||||
t.on('blur', () => {});
|
||||
t.on('focus', () => {});
|
||||
t.on('lineFeed', () => {});
|
||||
t.on('selection', () => {});
|
||||
// args
|
||||
t.on('data', () => {});
|
||||
t.on('data', (data: string) => console.log(data));
|
||||
@@ -89,6 +90,7 @@ namespace methods_core {
|
||||
t.off('blur', () => {});
|
||||
t.off('focus', () => {});
|
||||
t.off('lineFeed', () => {});
|
||||
t.off('selection', () => {});
|
||||
// args
|
||||
t.off('data', () => {});
|
||||
t.off('data', (data: string) => console.log(data));
|
||||
|
||||
@@ -255,6 +255,7 @@ export class SelectionManager extends EventEmitter implements ISelectionManager
|
||||
public selectAll(): void {
|
||||
this._model.isSelectAllActive = true;
|
||||
this.refresh();
|
||||
this.emit('selection');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -541,6 +542,9 @@ export class SelectionManager extends EventEmitter implements ISelectionManager
|
||||
*/
|
||||
private _onMouseUp(event: MouseEvent): void {
|
||||
this._removeMouseDownListeners();
|
||||
|
||||
if (this.hasSelection)
|
||||
this.emit('selection');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Vendored
+2
-2
@@ -218,7 +218,7 @@ declare module 'xterm' {
|
||||
* @param type The type of the event.
|
||||
* @param listener The listener.
|
||||
*/
|
||||
on(type: 'blur' | 'focus' | 'lineFeed', listener: () => void): void;
|
||||
on(type: 'blur' | 'focus' | 'lineFeed' | 'selection', listener: () => void): void;
|
||||
/**
|
||||
* Registers an event listener.
|
||||
* @param type The type of the event.
|
||||
@@ -273,7 +273,7 @@ declare module 'xterm' {
|
||||
* @param type The type of the event.
|
||||
* @param listener The listener.
|
||||
*/
|
||||
off(type: 'blur' | 'focus' | 'lineFeed' | 'data' | 'key' | 'keypress' | 'keydown' | 'refresh' | 'resize' | 'scroll' | 'title' | string, listener: (...args: any[]) => void): void;
|
||||
off(type: 'blur' | 'focus' | 'lineFeed' | 'selection' | 'data' | 'key' | 'keypress' | 'keydown' | 'refresh' | 'resize' | 'scroll' | 'title' | string, listener: (...args: any[]) => void): void;
|
||||
|
||||
/**
|
||||
* Resizes the terminal.
|
||||
|
||||
Reference in New Issue
Block a user