mirror of
https://git.proxmox.com/git/mirror_xterm.js
synced 2025-10-23 21:58:51 +00:00
Guard public selection api
This commit is contained in:
parent
7cfc2ffa32
commit
0af4b17c20
@ -1437,7 +1437,7 @@ Terminal.prototype.deregisterLinkMatcher = function(matcherId) {
|
||||
* Gets whether the terminal has an active selection.
|
||||
*/
|
||||
Terminal.prototype.hasSelection = function() {
|
||||
return this.selectionManager.hasSelection;
|
||||
return !!(this.selectionManager && this.selectionManager.hasSelection);
|
||||
};
|
||||
|
||||
/**
|
||||
@ -1445,21 +1445,25 @@ Terminal.prototype.hasSelection = function() {
|
||||
* behavior outside of xterm.js.
|
||||
*/
|
||||
Terminal.prototype.getSelection = function() {
|
||||
return this.selectionManager.selectionText;
|
||||
return this.selectionManager ? this.selectionManager.selectionText : '';
|
||||
};
|
||||
|
||||
/**
|
||||
* Clears the current terminal selection.
|
||||
*/
|
||||
Terminal.prototype.clearSelection = function() {
|
||||
if (this.selectionManager) {
|
||||
this.selectionManager.clearSelection();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Selects all text within the terminal.
|
||||
*/
|
||||
Terminal.prototype.selectAll = function() {
|
||||
if (this.selectionManager) {
|
||||
this.selectionManager.selectAll();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user